diff options
111 files changed, 2290 insertions, 3176 deletions
diff --git a/gentoobrowse/.htaccess b/gentoobrowse/.htaccess index e4d5a37..40f4020 100644 --- a/gentoobrowse/.htaccess +++ b/gentoobrowse/.htaccess @@ -1,13 +1,13 @@ -<Files "p2fcgi"> - sethandler fcgid-script +<Files "gentoobrowse-cgi"> + sethandler cgi-script </Files> RewriteEngine on RewriteCond %{REQUEST_URI} !^/css/ RewriteCond %{REQUEST_URI} !^/js/ RewriteCond %{REQUEST_URI} !^/img/ RewriteCond %{REQUEST_URI} !^/[^/]+\.[^/]+$ -RewriteCond %{REQUEST_URI} !^/p2fcgi -RewriteRule ^(.*) /p2fcgi/\1 [L] +RewriteCond %{REQUEST_URI} !^/gentoobrowse-cgi +RewriteRule ^(.*) /gentoobrowse-cgi/\1 [L] RewriteCond %{REQUEST_URI} ^/sitemap\.xml$ -RewriteRule ^(.*) /p2fcgi/\1 [L] +RewriteRule ^(.*) /gentoobrowse-cgi/\1 [L] diff --git a/gentoobrowse/Jamfile.jam b/gentoobrowse/Jamfile.jam new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gentoobrowse/Jamfile.jam diff --git a/gentoobrowse/checks/.htaccess b/gentoobrowse/checks/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/checks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/checks/loggedIn.xml b/gentoobrowse/checks/loggedIn.xml deleted file mode 100644 index 49893c3..0000000 --- a/gentoobrowse/checks/loggedIn.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<project2:check xmlns:project2="http://project2.randomdan.homeip.net" present="login" name="loggedIn" message="Not logged in"> - <project2:regextest regex="[1-9][0-9]*"> - <apply-to source="session" name="loggedInUserID"><default value="" /></apply-to> - </project2:regextest> -</project2:check> - diff --git a/gentoobrowse/config/ice.properties b/gentoobrowse/config/ice.properties new file mode 100644 index 0000000..dc0baab --- /dev/null +++ b/gentoobrowse/config/ice.properties @@ -0,0 +1,7 @@ +Gentoo.Portage = portage:tcp -h localhost -p 9001 +Gentoo.Users = users:tcp -h localhost -p 9001 +IceSpider.SessionManager = IceSpider-FileSessions +IceSpider.FileSessions.Path = /var/tmp/icespider-sessions/gentoobrowse +Ice.ThreadPool.Client.SizeMax = 20 +Ice.ThreadPool.Client.Size = 5 +Ice.MessageSizeMax = 4000 diff --git a/gentoobrowse/console/.htaccess b/gentoobrowse/console/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/console/bug.urls b/gentoobrowse/console/bug.urls deleted file mode 100644 index 0209f97..0000000 --- a/gentoobrowse/console/bug.urls +++ /dev/null @@ -1,3 +0,0 @@ -http://bugs.gentoo.org/data/cached/buglist-UNCONFIRMED.htmlgz -http://bugs.gentoo.org/data/cached/buglist-CONFIRMED.htmlgz -http://bugs.gentoo.org/data/cached/buglist-IN_PROGRESS.htmlgz diff --git a/gentoobrowse/console/bugassociate.xml b/gentoobrowse/console/bugassociate.xml deleted file mode 100644 index d0b9ed1..0000000 --- a/gentoobrowse/console/bugassociate.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> -<bugassoc name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="bugbind" datasource="postgres" targettable="package_bugs" useview="yes"> - <sql> - SELECT b.bugid, p.packageid - FROM bugs b, packages p, categories c - WHERE p.categoryid = c.categoryid - AND namedpackages(b.summary) @> ARRAY[c.name || '/' || p.name] - </sql> - <columns> - <bugid key="true" /> - <packageid key="true" /> - </columns> - </project2:sqlmerge> -</bugassoc> - diff --git a/gentoobrowse/console/bugimport.xml b/gentoobrowse/console/bugimport.xml deleted file mode 100644 index b6b0747..0000000 --- a/gentoobrowse/console/bugimport.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0"?> -<bugimport name="bugimport" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:streamrows name="bugurls" newline=" " encoding="ascii" fieldSep="" quoteChar=""> - <project2:filestream path="console/bug.urls" /> - <columns> - <url /> - </columns> - </project2:streamrows> - <project2:xpathrows name="buglist" html="true" warnings="false" timeout="60000" encoding="utf-8"> - <proxy value="cache.random.lan:8080" /> - <url source="parent" name="url" depth="1" /> - <filterviews> - <bugdetails root="/html/body/div/ul/li/a"> - <fields> - <bugid xpath="number(substring-before(substring-after(.,'Bug:'),' '))" /> - <summary xpath="em" /> - <status xpath="substring-before(substring-after(.,'status:'),' ')" /> - <severity xpath="substring-after(.,'severity:')" /> - </fields> - </bugdetails> - </filterviews> - </project2:xpathrows> - - <project2:iterate name="eachurl" source="bugurls"> - <project2:xmldocumentprefetch name="eachbug" html="true" warnings="false" timeout="60000" encoding="utf-8"> - <proxy value="cache.random.lan:8080" /> - <url source="parent" name="url" depth="1" /> - </project2:xmldocumentprefetch> - </project2:iterate> - - <project2:sqlmerge name="bugimport" datasource="postgres" targettable="bugs"> - <project2:iterate name="eachurl" source="bugurls"> - <project2:iterate name="eachbug" source="buglist" filter="bugdetails" /> - </project2:iterate> - <columns> - <bugid key="true" /> - <severity /> - <status /> - <summary /> - </columns> - </project2:sqlmerge> - <xi:include href="bugassociate.xml" /> -</bugimport> diff --git a/gentoobrowse/console/changelogs.xml b/gentoobrowse/console/changelogs.xml deleted file mode 100644 index 0cdc351..0000000 --- a/gentoobrowse/console/changelogs.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0"?> -<packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="changelogs" datasource="postgres" targettable="package_changelogs"> - <updatewhere> - (a.packageid, a.repoid) IN ( - SELECT p.packageid, f.repoid - FROM files f, packages p, categories c - WHERE f.filetypeid = 2 - AND (f.cachedat IS NULL OR f.cachedat != f.moddate) - AND p.name = f.pathparts[2] - AND c.name = f.pathparts[1] - AND c.categoryid = p.categoryid) - </updatewhere> - <sql> - SELECT repoid, p.packageid, RANK() OVER(PARTITION BY repoid, packageid, TO_DATE(l[1], 'DD Mon YYYY') ORDER BY n DESC) AS n, - TO_DATE(l[1], 'DD Mon YYYY') AS date, - TRIM(l[2]) AS person, - TRIM(l[3]) AS email, - TRIM(l[4]) AS comment - FROM ( - SELECT repoid, cat, pkg, n, - REGEXP_MATCHES(r, '(\d{1,2} *(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w* 2\d{3}); (.+)? <(.+@[^ >]+)[>\s] (?:[^:]*:)? (.*)', 'i') l - FROM ( - SELECT repoid, pathparts[1] cat, pathparts[2] pkg, REGEXP_REPLACE(r, '\s+', ' ', 'g') r, ROW_NUMBER() OVER() n - FROM files f, REGEXP_SPLIT_TO_TABLE(f.filecontent, '\n\s*\n') r - WHERE filetypeid = 2 - AND (f.cachedat IS NULL OR f.cachedat != f.moddate)) f - ) f, packages p, categories c - WHERE p.name = f.pkg - AND c.name = f.cat - AND p.categoryid = c.categoryid - </sql> - <columns> - <packageid key="true" /> - <date key="true" /> - <n key="true" /> - <repoid key="true" /> - <person /> - <email /> - <comment /> - </columns> - </project2:sqlmerge> - <project2:sqltask name="update" datasource="postgres"> - <sql> - UPDATE files SET - cachedat = moddate - WHERE filetypeid = 2 - </sql> - </project2:sqltask> -</packageimport> diff --git a/gentoobrowse/console/emailebuilds.xml b/gentoobrowse/console/emailebuilds.xml deleted file mode 100644 index 660e2d7..0000000 --- a/gentoobrowse/console/emailebuilds.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0"?> -<emailebuild name="emailebuild" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="usersToEmail" datasource="postgres"> - <sql> - select ut.userid, ut.useremail from - (select e.ebuildid, u.userid, u.useremail - from ebuilds e, user_packages up, users u - where e.packageid = up.packageid - and u.userid = up.userid - and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe - on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid - where ebe.userid is null - group by ut.userid, ut.useremail - </sql> - </project2:sqlrows> - <project2:iterate name="users" source="usersToEmail"> - <project2:sendmail name="sendemail" server="smtp.random.lan:25" subject="Gentoo Browse - New package versions" - present="newpackageversions" from=""Gentoo Browse" <noreply@gentoobrowse.randomdan.homeip.net>"> - <to source="parent" name="useremail" depth="1" /> - </project2:sendmail> - <project2:sqltask name="recordsent" datasource="postgres"> - <sql> - insert into user_ebuild_emails(ebuildid, userid, sentat) - select ut.ebuildid, ut.userid, now() - from ( - select e.ebuildid, up.userid - from ebuilds e, user_packages up, users u - where e.packageid = up.packageid - and u.userid = up.userid - and u.userid = <param source="parent" name="userid" /> - and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe - on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid - where ebe.userid is null - </sql> - </project2:sqltask> - </project2:iterate> -</emailebuild> - - diff --git a/gentoobrowse/console/fileimport.xml b/gentoobrowse/console/fileimport.xml deleted file mode 100644 index 149f094..0000000 --- a/gentoobrowse/console/fileimport.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0"?> -<packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="repos" datasource="postgres" targettable="repos" useview="yes"> - <sql>SELECT name FROM PG_LS_DIR('gentoobrowse') name</sql> - <columns> - <name key="true" /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="files" datasource="postgres" targettable="files"> - <sql> - WITH RECURSIVE filelist AS ( - SELECT ('gentoobrowse/' || pg_ls_dir) AS filename, st.size, st.modification, st.isdir - FROM PG_LS_DIR('gentoobrowse'), PG_STAT_FILE('gentoobrowse') st - UNION ALL - SELECT parent.filename || '/' || cur, st.size, st.modification, st.isdir - FROM filelist parent, PG_LS_DIR(parent.filename) cur, PG_STAT_FILE(parent.filename || '/' || cur) st - WHERE parent.isdir - AND cur != 'packages' - AND cur != 'lost+found' - AND cur != 'distfiles' - AND cur NOT LIKE '.%' - ) - SELECT - r.repoid, - fl.filename, - ft.filetypeid, - (STRING_TO_ARRAY(fl.filename, '/'))[3:100] pathparts, - fl.size filesize, - fl.modification AT TIME ZONE 'utc' moddate - FROM filelist fl, repos r, filetypes ft - WHERE (STRING_TO_ARRAY(fl.filename, '/'))[2] = r.name - AND (STRING_TO_ARRAY(fl.filename, '/'))[3:100] ~ ft.spec - AND NOT fl.isdir - </sql> - <columns> - <filename key="true" /> - <repoid key="true" /> - <pathparts /> - <filesize /> - <moddate /> - <filetypeid /> - </columns> - </project2:sqlmerge> -</packageimport> diff --git a/gentoobrowse/console/newsimport.xml b/gentoobrowse/console/newsimport.xml deleted file mode 100644 index 6b6c039..0000000 --- a/gentoobrowse/console/newsimport.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0"?> -<packageimport name="import news" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="merge news" datasource="postgres" targettable="news"> - <updatewhere> - a.newsid IN ( - SELECT f.pathparts[3] - FROM files f - WHERE f.filetypeid = 11 - AND (f.cachedat IS NULL OR f.cachedat != f.moddate)) - </updatewhere> - <sql> - SELECT - newsid, - (SELECT REGEXP_MATCHES(p[1], 'Title: ([^\n]+)'))[1] title, - CAST((SELECT REGEXP_MATCHES(p[1], 'Posted: ([^\n]+)'))[1] AS DATE) posted, - (SELECT REGEXP_MATCHES(P[1], 'Author: ([^\n]+) <'))[1] authorname, - (SELECT REGEXP_MATCHES(P[1], 'Author:.*?<([^>]+)>'))[1] authoremail, - (SELECT ARRAY_AGG(pkg) FROM (SELECT (REGEXP_MATCHES(P[1], 'Display-If-Installed: ([^\n]+)', 'g') )[1] pkg) p) atomspec, - (SELECT ARRAY_AGG(REGEXP_REPLACE(PARA, '\s+', ' ', 'g')) FROM (SELECT REGEXP_SPLIT_TO_TABLE(p[2], '\n\n') para) p) body, - (SELECT ARRAY_AGG(url) FROM (SELECT (REGEXP_MATCHES(p[3], '(\w+://[^\s]+)', 'g'))[1] url) u) urls - FROM ( - SELECT pathparts[3] newsid, REGEXP_MATCHES(f.filecontent, '^(.*?)\n\n(.*?)(\n(\n\[[\d]+\] \w+://[^ ]+)*)?$') p - FROM files f - WHERE f.filetypeid = 11 - AND (f.cachedat IS NULL OR f.cachedat != f.moddate) - ) newsfiles - </sql> - <columns> - <newsid key="true" /> - <title /> - <posted /> - <authorname /> - <authoremail /> - <atomspec /> - <body /> - <urls /> - </columns> - </project2:sqlmerge> - <project2:sqltask name="update" datasource="postgres"> - <sql> - UPDATE files SET - cachedat = moddate - WHERE filetypeid = 11 - </sql> - </project2:sqltask> -</packageimport> diff --git a/gentoobrowse/console/packageimport.xml b/gentoobrowse/console/packageimport.xml deleted file mode 100644 index 54b1a62..0000000 --- a/gentoobrowse/console/packageimport.xml +++ /dev/null @@ -1,203 +0,0 @@ -<?xml version="1.0"?> -<packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="categories" datasource="postgres" targettable="categories" useview="yes"> - <sql> - SELECT c.name, m.summary - FROM (SELECT DISTINCT pathparts[3] AS name FROM files WHERE filetypeid = 1) c - LEFT OUTER JOIN ( - SELECT f.pathparts[1] AS name, RANK() OVER(PARTITION BY f.pathparts[1] ORDER BY repoid DESC) r, - TRIM(REGEXP_REPLACE(CAST((XPATH('/catmetadata/longdescription[@lang="en"]/text()', doc))[1] AS TEXT), '\s+', ' ', 'g')) summary - FROM files f, XMLPARSE(DOCUMENT f.filecontent) doc - WHERE filetypeid = 10) m ON m.name = c.name - </sql> - <columns> - <name key="true" /> - <summary /> - </columns> - </project2:sqlmerge> - - <project2:sqltask name="tmpdefs" datasource="postgres"> - <sql> - CREATE TEMPORARY TABLE ebuilddefs AS - SELECT p.*, d[1] pkgname, d[2] AS version, ebuildversion_constructor(d[2]) AS versioninst - FROM ( - SELECT c.name catname, c.categoryid, f.repoid, f.firstseen, f.moddate, REGEXP_MATCHES(pathparts[4], '^(.+)-([0-9].*)$') AS d, p.* - FROM CROSSTAB($$ - SELECT fileid, a, SUBSTRING(md FROM '=(.*)') v - FROM ( - SELECT f.fileid, f.filecontent, a - FROM files f, unnest(array['DEFINED_PHASES', 'DEPEND', 'DESCRIPTION', 'EAPI', 'HOMEPAGE', 'IUSE', 'KEYWORDS', - 'LICENSE', 'PDEPEND', 'PROPERTIES', 'RDEPEND', 'REQUIRED_USE', 'RESTRICT', 'SLOT', 'SRC_URI']) a - WHERE filetypeid = 1 - ) f LEFT OUTER JOIN REGEXP_SPLIT_TO_TABLE(filecontent, '\n') md - ON SPLIT_PART(md, '=' ,1) = a - ORDER BY FILEID, a $$) AS p(fileid INT, defined_phases TEXT, depend TEXT, description TEXT, eapi text, homepage TEXT, - iuse TEXT, keywords TEXT, license TEXT, pdepend TEXT, properties TEXT, rdepend TEXT, required_use TEXT, - restrict TEXT, slot TEXT, src_uri TEXT), files f, categories c - WHERE f.fileid = p.fileid - AND f.pathparts[3] = c.name) p - </sql> - </project2:sqltask> - - <project2:sqlmerge name="packages" datasource="postgres" targettable="packages" useview="no"> - <sql> - SELECT d.categoryid, d.pkgname AS name, description, maintainer, maintainername, herd, summary, image - FROM ( - SELECT categoryid, pkgname, description, RANK() OVER(PARTITION BY categoryid, pkgname ORDER BY version DESC) r - FROM ebuilddefs) d - LEFT OUTER JOIN ( - SELECT categoryid, pkgname, maintainer, maintainername, herd, r, - TRIM(REGEXP_REPLACE(REGEXP_REPLACE(COALESCE(longdescen, longdesc), '<<data:image/[^>]+>>', ''), '\s+', ' ', 'g')) AS summary, - (SELECT REGEXP_MATCHES(COALESCE(longdescen, longdesc), '<<(data:image/[^>]+)>>')) AS image - FROM ( - SELECT categoryid, pkgname, RANK() OVER(PARTITION BY categoryid, pkgname ORDER BY repoid DESC) r, - CAST((XPATH('/pkgmetadata/maintainer/email/text()', doc))[1] AS TEXT) maintainer, - CAST((XPATH('/pkgmetadata/maintainer/name/text()', doc))[1] AS TEXT) maintainername, - CAST((XPATH('/pkgmetadata/longdescription[@lang="en"]/text()', doc))[1] AS TEXT) longdescen, - CAST((XPATH('/pkgmetadata/longdescription[not(@lang)]/text()', doc))[1] AS TEXT) longdesc, - CAST((XPATH('/pkgmetadata/herd/text()', doc))[1] AS TEXT) herd - FROM ( - SELECT f.repoid, categoryid, f.pathparts[2] pkgname, XMLPARSE(DOCUMENT f.filecontent) doc - FROM files f, categories c - WHERE filetypeid = 4 - AND f.pathparts[1] = c.name) x) x - ) m ON m.categoryid = d.categoryid AND m.pkgname = d.pkgname AND m.r = 1 - WHERE d.r = 1 - </sql> - <columns> - <categoryid key="true" /> - <name key="true" /> - <description /> - <maintainer /> - <maintainername /> - <herd /> - <summary /> - <image /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="ebuilds" datasource="postgres" targettable="ebuilds" useview="yes"> - <sql> - SELECT p.packageid, e.version, e.fileid AS ebuildid, e.versioninst, e.slot, e.license, e.firstseen, e.moddate, e.repoid - FROM ebuilddefs e, packages p - WHERE e.pkgname = p.name - AND e.categoryid = p.categoryid - </sql> - <columns> - <ebuildid key="true" /> - <packageid /> - <version /> - <versioninst /> - <slot /> - <license /> - <firstseen /> - <moddate /> - <repoid /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="archs" datasource="postgres" targettable="ebuild_archs" useview="yes"> - <sql> - SELECT DISTINCT e.fileid AS ebuildid, REGEXP_SPLIT_TO_TABLE(e.keywords, ' ') AS arch - FROM ebuilddefs e - </sql> - <columns> - <ebuildid key="true" /> - <arch key="true" /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="uses" datasource="postgres" targettable="ebuild_uses" useview="yes"> - <sql> - SELECT DISTINCT e.fileid AS ebuildid, REGEXP_SPLIT_TO_TABLE(e.iuse, ' ') AS use - FROM ebuilddefs e - </sql> - <columns> - <ebuildid key="true" /> - <use key="true" /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="urls" datasource="postgres" targettable="package_urls" useview="yes"> - <sql> - SELECT DISTINCT p.packageid, REGEXP_SPLIT_TO_TABLE(e.homepage, ' ') AS url - FROM ebuilddefs e, packages p - WHERE e.pkgname = p.name - AND e.categoryid = p.categoryid - AND homepage LIKE '%://%' - </sql> - <columns> - <packageid key="true" /> - <url key="true" /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="deps" datasource="postgres" targettable="ebuild_deps" useview="no"> - <sql> - SELECT fileid AS ebuildid, packageid, COALESCE(slot, '') AS slot, COALESCE(op, '') AS op, - COALESCE(versionspec, '') AS versionspec, COALESCE(flags, '') AS flags - FROM ( - SELECT DISTINCT fileid, field[2] AS cat, field[3] AS pkg, field[7] AS slot, - field[1] AS op, field[5] AS versionspec, field[9] AS flags - FROM ( - SELECT fileid, REGEXP_MATCHES(dep, - E'([^a-zA-Z0-9]*)([a-zA-Z0-9-]+)/([a-zA-Z0-9_+-]+?)(-([0-9][^:]*))?(:([0-9.]+))?(\\[([^]]+)\\])?') as field - FROM ( - SELECT e.fileid, REGEXP_SPLIT_TO_TABLE(e.depend, ' ') AS dep - FROM ebuilddefs e - ) src - ) AS src2 - ) AS src3, categories c, packages p - WHERE p.categoryid = c.categoryid - AND p.name = pkg - AND c.name = cat - </sql> - <columns> - <ebuildid key="true" /> - <packageid key="true" /> - <slot key="true" /> - <op key="true" /> - <versionspec key="true" /> - <flags key="true" /> - </columns> - </project2:sqlmerge> - - <project2:sqlmerge name="rdeps" datasource="postgres" targettable="ebuild_rdeps" useview="no"> - <sql> - SELECT fileid AS ebuildid, packageid, COALESCE(slot, '') AS slot, COALESCE(op, '') AS op, - COALESCE(versionspec, '') AS versionspec, COALESCE(flags, '') AS flags - FROM ( - SELECT DISTINCT fileid, field[2] AS cat, field[3] AS pkg, field[7] AS slot, - field[1] AS op, field[5] AS versionspec, field[9] AS flags - FROM ( - SELECT fileid, REGEXP_MATCHES(dep, - E'([^a-zA-Z0-9]*)([a-zA-Z0-9-]+)/([a-zA-Z0-9_+-]+?)(-([0-9][^:]*))?(:([0-9.]+))?(\\[([^]]+)\\])?') as field - FROM ( - SELECT e.fileid, REGEXP_SPLIT_TO_TABLE(e.rdepend, ' ') AS dep - FROM ebuilddefs e - ) src - ) AS src2 - ) AS src3, categories c, packages p - WHERE p.categoryid = c.categoryid - AND p.name = pkg - AND c.name = cat - </sql> - <columns> - <ebuildid key="true" /> - <packageid key="true" /> - <slot key="true" /> - <op key="true" /> - <versionspec key="true" /> - <flags key="true" /> - </columns> - </project2:sqlmerge> - - <xi:include href="changelogs.xml" /> - <xi:include href="packagelicenses.xml" /> - <xi:include href="use.global.xml" /> - <xi:include href="use.local.xml" /> - <xi:include href="use.grouped.xml" /> - <xi:include href="packagemasks.xml" /> - <xi:include href="bugassociate.xml" /> -</packageimport> diff --git a/gentoobrowse/console/packagelicenses.xml b/gentoobrowse/console/packagelicenses.xml deleted file mode 100644 index baa88b0..0000000 --- a/gentoobrowse/console/packagelicenses.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<homepages name="bugimport" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="update" datasource="postgres" targettable="license"> - <updatewhere>a.name IN (SELECT o.pathparts[2] FROM files o WHERE o.cachedat IS NULL OR o.cachedat != o.moddate)</updatewhere> - <sql> - SELECT f.pathparts[2] AS name, f.filecontent legalbumph - FROM files f - WHERE (f.cachedat IS NULL OR f.cachedat != f.moddate) - AND f.filetypeid = 7 - </sql> - <columns> - <name key="true" /> - <legalbumph /> - </columns> - </project2:sqlmerge> - <project2:sqltask name="update" datasource="postgres"> - <sql> - UPDATE files SET - cachedat = moddate - WHERE filetypeid = 7 - </sql> - </project2:sqltask> -</homepages> diff --git a/gentoobrowse/console/packagemasks.xml b/gentoobrowse/console/packagemasks.xml deleted file mode 100644 index fd03528..0000000 --- a/gentoobrowse/console/packagemasks.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<packagemasks name="packagemasks" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqltask name="tmpmasks" datasource="postgres"> - <sql> - CREATE TEMPORARY TABLE tmpmasks AS - SELECT to_date(m[3], 'dd mon yyyy') as dateadded, RANK() OVER(PARTITION BY to_date(m[3], 'dd mon yyyy') ORDER BY n DESC) n, - TRIM(m[1]) as person, m[2] as email, m[4] as message, m[5] as atoms - FROM ( - SELECT row_number() over() n, - regexp_matches(r, '^# ([^<]+)? ?<(.+?@[^>]+)> \((\d+ *(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) \d+)\)\n((?:#[^\n]*\n)+)(.*)$', 'i') m - FROM files f, REGEXP_SPLIT_TO_TABLE(f.filecontent, '\n\s*\n') r - WHERE filetypeid = 3) m - </sql> - </project2:sqltask> - <project2:sqlmerge name="masksets" datasource="postgres" targettable="masksets" useview="yes"> - <sql> - SELECT dateadded, n, person, email, - TRIM(REGEXP_REPLACE(message, '#?\s+', ' ', 'g')) message - FROM tmpmasks - </sql> - <columns> - <dateadded key="true" /> - <n key="true" /> - <person /> - <email /> - <message /> - </columns> - </project2:sqlmerge> - <project2:sqlmerge name="masks" datasource="postgres" targettable="ebuild_masks" useview="yes"> - <sql> - SELECT DISTINCT s.setno, ebuildfilter(REGEXP_SPLIT_TO_TABLE(tm.atoms, '\n')) ebuildid - FROM tmpmasks tm, masksets s - WHERE tm.dateadded = s.dateadded - AND tm.n = s.n - </sql> - <columns> - <setno key="true" /> - <ebuildid key="true" /> - </columns> - </project2:sqlmerge> -</packagemasks> - diff --git a/gentoobrowse/console/use.global.xml b/gentoobrowse/console/use.global.xml deleted file mode 100644 index e437514..0000000 --- a/gentoobrowse/console/use.global.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<test name="test" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="mergeguse" datasource="postgres" targettable="use_global"> - <sql> - SELECT u.ud[1] AS use, u.ud[2] AS description - FROM (SELECT regexp_matches(u, '([^ ]+) - (.+)') ud - FROM files f, regexp_split_to_table(f.filecontent, '\n') u - WHERE f.filetypeid = 5) u - </sql> - <columns> - <use key="true" /> - <description /> - </columns> - </project2:sqlmerge> -</test> diff --git a/gentoobrowse/console/use.grouped.xml b/gentoobrowse/console/use.grouped.xml deleted file mode 100644 index ea93357..0000000 --- a/gentoobrowse/console/use.grouped.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0"?> -<packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="categories" datasource="postgres" targettable="use_groups" useview="yes"> - <sql> - SELECT DISTINCT split_part(pathparts[3], '.', 1) AS name - FROM files f - WHERE f.filetypeid = 9 - </sql> - <columns> - <name key="true" /> - </columns> - </project2:sqlmerge> - <project2:sqlmerge datasource="postgres" targettable="use_group"> - <sql> - SELECT ug.usegroupid, u.ud[1] AS use, MIN(u.ud[2]) AS description - FROM (SELECT split_part(pathparts[3], '.', 1) AS name, regexp_matches(u, '([^ ]+) - (.*)') ud - FROM files f, regexp_split_to_table(f.filecontent, '\n') u - WHERE f.filetypeid = 9) u, use_groups ug - WHERE ug.name = u.name - GROUP BY ug.usegroupid, u.ud[1] - </sql> - <columns> - <usegroupid key="true" /> - <use key="true" /> - <description /> - </columns> - </project2:sqlmerge> -</packageimport> diff --git a/gentoobrowse/console/use.local.xml b/gentoobrowse/console/use.local.xml deleted file mode 100644 index e9e5f52..0000000 --- a/gentoobrowse/console/use.local.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<test name="test" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlmerge name="mergeguse" datasource="postgres" targettable="use_local"> - <sql> - SELECT p.packageid, u.ud[3] AS use, u.ud[4] AS description - FROM (SELECT regexp_matches(u, '([^/]+)/([^:]+):([^ ]+) - (.+)') ud - FROM files f, regexp_split_to_table(f.filecontent, '\n') u - WHERE f.filetypeid = 6) u, categories c, packages p - WHERE c.name = u.ud[1] - AND p.name = u.ud[2] - AND c.categoryid = p.categoryid - </sql> - <columns> - <packageid key="true" /> - <use key="true" /> - <description /> - </columns> - </project2:sqlmerge> -</test> diff --git a/gentoobrowse/css/general.css b/gentoobrowse/css/general.css index 35a46c7..2b4d500 100644 --- a/gentoobrowse/css/general.css +++ b/gentoobrowse/css/general.css @@ -1062,10 +1062,13 @@ form.bs-docs-example { +.local { + font-style: italic; +} - - - +.block { + text-decoration: line-through; +} form#search input[type=search] { width: 516px; diff --git a/gentoobrowse/datasources/.htaccess b/gentoobrowse/datasources/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/datasources/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/datasources/database.mk b/gentoobrowse/datasources/database.mk deleted file mode 100644 index 0d242d0..0000000 --- a/gentoobrowse/datasources/database.mk +++ /dev/null @@ -1,11 +0,0 @@ -.PHONY : database current.sql schema.sql - -database: patch.sql - psql -U gentoo gentoo -qf $< - -current.sql : - pg_dump -U gentoo gentoo -n gentoobrowse -s -E utf8 | grep -v _gentoo > $@ - -patch.sql : current.sql schema.sql - apgdiff --add-transaction current.sql schema.sql | tee $@ - diff --git a/gentoobrowse/datasources/postgres-web.xml b/gentoobrowse/datasources/postgres-web.xml deleted file mode 100644 index be19a4e..0000000 --- a/gentoobrowse/datasources/postgres-web.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<project2:rdbmsdatasource xmlns:project2="http://project2.randomdan.homeip.net" name="postgres-web" preferlocal="true"> - <readonly> - <dsn host="firebrand" provider="postgresql" dsn="host=firebrand.random.lan user=apache dbname=gentoo options='-c search_path=gentoobrowse,public'" /> - <dsn host="defiant" provider="postgresql" dsn="host=defiant.random.lan user=apache dbname=gentoo options='-c search_path=gentoobrowse,public'" /> - <dsn host="akira" provider="postgresql" dsn="host=akira.random.lan user=apache dbname=gentoo options='-c search_path=gentoobrowse,public'" /> - <dsn host="riogrande" provider="postgresql" dsn="host=riogrande.random.lan user=apache dbname=gentoo options='-c search_path=gentoobrowse,public'" /> - </readonly> - <masterdsn provider="postgresql" dsn="host=firebrand.random.lan user=apache dbname=gentoo options='-c search_path=gentoobrowse,public'" /> -</project2:rdbmsdatasource> diff --git a/gentoobrowse/datasources/postgres.xml b/gentoobrowse/datasources/postgres.xml deleted file mode 100644 index 8281549..0000000 --- a/gentoobrowse/datasources/postgres.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<project2:rdbmsdatasource xmlns:project2="http://project2.randomdan.homeip.net" name="postgres" preferlocal="true"> - <readonly> - <dsn host="firebrand" provider="postgresql" dsn="sslmode=disable user=gentoo dbname=gentoo options='-c search_path=gentoobrowse,public'" /> - </readonly> - <masterdsn provider="postgresql" dsn="sslmode=disable user=gentoo dbname=gentoo options='-c search_path=gentoobrowse,public'" /> -</project2:rdbmsdatasource> diff --git a/gentoobrowse/datasources/poweredBy.txt b/gentoobrowse/datasources/poweredBy.txt deleted file mode 100644 index b7d9dde..0000000 --- a/gentoobrowse/datasources/poweredBy.txt +++ /dev/null @@ -1,9 +0,0 @@ -Gentoo|http://www.gentoo.org/ -PostgreSQL|http://www.postgresql.org/ -Apache|http://httpd.apache.org/ -FastCGI|http://www.fastcgi.com/drupal/ -XSLT|http://www.w3.org/TR/xslt/ -jQuery|http://jquery.com/ -Boost|http://www.boost.org/ -Bootstrap|http://twitter.github.com/bootstrap/index.html -Project2|http://project2.randomdan.homeip.net/ diff --git a/gentoobrowse/datasources/schema.mk b/gentoobrowse/datasources/schema.mk deleted file mode 100644 index 42d4586..0000000 --- a/gentoobrowse/datasources/schema.mk +++ /dev/null @@ -1,5 +0,0 @@ -.PHONY : schema.sql - -schema.sql : - pg_dump -U gentoo gentoo -n gentoobrowse -s -E utf8 | grep -v _gentoo | grep -v '^\(--\|\)$$' > $@ - diff --git a/gentoobrowse/datasources/schema.sql b/gentoobrowse/datasources/schema.sql deleted file mode 100644 index 119d5bc..0000000 --- a/gentoobrowse/datasources/schema.sql +++ /dev/null @@ -1,907 +0,0 @@ --- PostgreSQL database dump -SET statement_timeout = 0; -SET lock_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SET check_function_bodies = false; -SET client_min_messages = warning; --- Name: gentoobrowse; Type: SCHEMA; Schema: -; Owner: gentoo -CREATE SCHEMA gentoobrowse; -ALTER SCHEMA gentoobrowse OWNER TO gentoo; -SET search_path = gentoobrowse, pg_catalog; --- Name: ebuildversion; Type: TYPE; Schema: gentoobrowse; Owner: gentoo -CREATE TYPE ebuildversion AS ( - ver bigint[], - versuffix character(1), - suffix bigint, - suffixnum bigint, - revision bigint -); -ALTER TYPE ebuildversion OWNER TO gentoo; --- Name: filterspec; Type: TYPE; Schema: gentoobrowse; Owner: gentoo -CREATE TYPE filterspec AS ( - part integer, - pattern text -); -ALTER TYPE filterspec OWNER TO gentoo; -SET default_tablespace = ''; -SET default_with_oids = false; --- Name: bugs; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE bugs ( - bugid integer NOT NULL, - severity text NOT NULL, - status text NOT NULL, - summary text NOT NULL, - firstseen timestamp without time zone DEFAULT now() NOT NULL -); -ALTER TABLE bugs OWNER TO gentoo; --- Name: TABLE bugs; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE bugs IS 'Import of Gentoo Bugs bug list from snapshots'; --- Name: bugfts(bugs); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION bugfts(b bugs) RETURNS tsvector - LANGUAGE plpgsql IMMUTABLE - AS $$ -BEGIN - RETURN TO_TSVECTOR('english', regexp_replace(b.summary, '-[0-9][^ ]*', '', 'g')); -END -$$; -ALTER FUNCTION gentoobrowse.bugfts(b bugs) OWNER TO gentoo; --- Name: ebuildfilter(text); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION ebuildfilter(atomspec text) RETURNS SETOF integer - LANGUAGE plpgsql - AS $_$ -declare - op text; - cat text; - pkg text; - ver gentoobrowse.ebuildversion; -begin -if (atomspec like '=%*') then - atomspec = '~' || substr(atomspec, 2, length(atomspec) - 2); -end if; -op = (regexp_matches(atomspec, '^([^a-z]*)'))[1]; -cat = (regexp_matches(atomspec, '^[^a-z]*([^/]+)/'))[1]; -pkg = (regexp_matches(atomspec, '/(.+?)((-[0-9])|$)'))[1]; -ver = ebuildversion_constructor((regexp_matches(atomspec, '-([0-9]+.*)$'))[1]); -return query select ebuildid -from ebuilds e, packages p, categories c -where e.packageid = p.packageid -and p.categoryid = c.categoryid -and p.name = pkg -and c.name = cat -and case - when op = '=' then e.versioninst = ver - when op = '>=' then e.versioninst >= ver - when op = '<=' then e.versioninst <= ver - when op = '<' then e.versioninst < ver - when op = '>' then e.versioninst > ver - when op = '~' then e.versioninst ~ ver - when op = '' then true - else false -end -; -end; -$_$; -ALTER FUNCTION gentoobrowse.ebuildfilter(atomspec text) OWNER TO gentoo; --- Name: ebuildversion_constructor(text); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION ebuildversion_constructor(val text) RETURNS ebuildversion - LANGUAGE plpgsql IMMUTABLE - AS $_$ -declare - v ebuildversion; - s text; -begin - v.ver = string_to_array((regexp_matches(val, '^([0-9.]+)'))[1], '.')::bigint[]; - v.versuffix = (regexp_matches(val, '[0-9]([a-z])'))[1]; - v.versuffix = coalesce(v.versuffix, '@'); - s = (regexp_matches(val, '_([a-z]+)'))[1]; - case - when s = 'alpha' then v.suffix = -4; - when s = 'beta' then v.suffix = -3; - when s = 'pre' then v.suffix = -2; - when s = 'rc' then v.suffix = -1; - when s = 'p' then v.suffix = 1; - else v.suffix = 0; - end case; - v.suffixnum = (regexp_matches(val, '_[a-z]+([0-9]+)'))[1]; - v.suffixnum = coalesce(v.suffixnum, 0); - v.revision = (regexp_matches(val, '-r([0-9]+)$'))[1]; - v.revision = coalesce(v.revision, 0); - return v; -end; -$_$; -ALTER FUNCTION gentoobrowse.ebuildversion_constructor(val text) OWNER TO gentoo; --- Name: ebuildversionrange(ebuildversion, ebuildversion); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION ebuildversionrange(a ebuildversion, b ebuildversion) RETURNS boolean - LANGUAGE plpgsql - AS $$begin --- If spec if longer, can't match -if (array_length(a.ver, 1) < array_length(b.ver, 1)) then - return false; -end if; --- Otherwise, they have to start the same -if (position(array_to_string(b.ver, '.') in array_to_string(a.ver, '.')) != 1) then - return false; -end if; -if (a.ver = b.ver) then - if (a.versuffix != b.versuffix and b.versuffix != '@') then - return false; - end if; - if (a.suffix != b.suffix and b.suffix != 0) then - return false; - end if; - if (a.suffixnum != b.suffixnum and b.suffixnum != 0) then - return false; - end if; - if (a.revision != b.revision and b.revision != 0) then - return false; - end if; - return true; -else - return ((b.versuffix = '@' - and b.suffix = 0 - and b.suffixnum = 0 - and b.revision = 0) or b is null); -end if; -end -$$; -ALTER FUNCTION gentoobrowse.ebuildversionrange(a ebuildversion, b ebuildversion) OWNER TO gentoo; --- Name: ebuildversiontotext(ebuildversion); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION ebuildversiontotext(v ebuildversion) RETURNS text - LANGUAGE plpgsql - AS $_$ -declare -str text; -begin -str = array_to_string($1.ver, '.'); -if ($1.versuffix != '@') then - str = str || $1.versuffix; -end if; -if ($1.suffix != 0) then -str = str || ( - case - when $1.suffix = -4 then '_alpha' - when $1.suffix = -3 then '_beta' - when $1.suffix = -2 then '_pre' - when $1.suffix = -1 then '_rc' - when $1.suffix = 1 then '_p' - end ); - str = str || $1.suffixnum; -end if; -if ($1.revision != 0) then - str = str || '-r' || $1.revision; -end if; -return str; -end; -$_$; -ALTER FUNCTION gentoobrowse.ebuildversiontotext(v ebuildversion) OWNER TO gentoo; --- Name: namedpackages(text); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION namedpackages(str text) RETURNS text[] - LANGUAGE plpgsql IMMUTABLE - AS $$ -declare - pkgs text[]; - p record; -begin - for p in select regexp_matches(str, '([[:alnum:]]+-[[:alnum:]]+/(?:-?[_[:alpha:]+][[:alnum:]+]+)+)', 'g') as p - loop - pkgs = array_append(pkgs, p.p[1]); - end loop; - return pkgs; -end -$$; -ALTER FUNCTION gentoobrowse.namedpackages(str text) OWNER TO gentoo; --- Name: packages; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE packages ( - packageid integer NOT NULL, - categoryid integer NOT NULL, - name text NOT NULL, - firstseen timestamp without time zone DEFAULT now() NOT NULL, - description text NOT NULL, - summary text, - maintainer text, - herd text, - image text, - maintainername text -); -ALTER TABLE packages OWNER TO gentoo; --- Name: TABLE packages; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE packages IS 'Packages as summarised from their ebuilds'; --- Name: packagefts(packages); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION packagefts(p packages) RETURNS tsvector - LANGUAGE plpgsql IMMUTABLE - AS $$ -BEGIN - RETURN (SETWEIGHT(TO_TSVECTOR('english', p.name), 'A') || - SETWEIGHT(TO_TSVECTOR('english', p.description), 'B') || - SETWEIGHT(TO_TSVECTOR('english', COALESCE(p.summary, '')), 'C')); -END -$$; -ALTER FUNCTION gentoobrowse.packagefts(p packages) OWNER TO gentoo; --- Name: pathpartsmatchesspecs(text[], filterspec[]); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION pathpartsmatchesspecs(pathparts text[], spec filterspec[]) RETURNS boolean - LANGUAGE plpgsql - AS $$ -DECLARE - i integer; - p integer; -BEGIN - p := array_upper(pathparts, 1); - FOR i IN 1 .. array_upper(spec, 1) LOOP - IF (p < spec[i].part) THEN RETURN FALSE; END IF; - IF (spec[i].part <= 0) THEN - IF (pathparts[p - spec[i].part] NOT LIKE spec[i].pattern) THEN RETURN FALSE; END IF; - ELSE - IF (pathparts[spec[i].part] NOT LIKE spec[i].pattern) THEN RETURN FALSE; END IF; - END IF; - END LOOP; - RETURN TRUE; -END; -$$; -ALTER FUNCTION gentoobrowse.pathpartsmatchesspecs(pathparts text[], spec filterspec[]) OWNER TO gentoo; --- Name: sum(tsvector); Type: AGGREGATE; Schema: gentoobrowse; Owner: postgres -CREATE AGGREGATE sum(tsvector) ( - SFUNC = tsvector_concat, - STYPE = tsvector -); -ALTER AGGREGATE gentoobrowse.sum(tsvector) OWNER TO postgres; --- Name: ~; Type: OPERATOR; Schema: gentoobrowse; Owner: gentoo -CREATE OPERATOR ~ ( - PROCEDURE = ebuildversionrange, - LEFTARG = ebuildversion, - RIGHTARG = ebuildversion -); -ALTER OPERATOR gentoobrowse.~ (ebuildversion, ebuildversion) OWNER TO gentoo; --- Name: ~; Type: OPERATOR; Schema: gentoobrowse; Owner: gentoo -CREATE OPERATOR ~ ( - PROCEDURE = pathpartsmatchesspecs, - LEFTARG = text[], - RIGHTARG = filterspec[] -); -ALTER OPERATOR gentoobrowse.~ (text[], filterspec[]) OWNER TO gentoo; --- Name: categories; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE categories ( - categoryid integer NOT NULL, - name text, - summary text -); -ALTER TABLE categories OWNER TO gentoo; --- Name: TABLE categories; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE categories IS 'Gentoo defined package categories'; --- Name: ebuild_archs; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE ebuild_archs ( - ebuildid integer NOT NULL, - arch text NOT NULL -); -ALTER TABLE ebuild_archs OWNER TO gentoo; --- Name: TABLE ebuild_archs; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE ebuild_archs IS 'Architectures an ebuild is suitable for'; --- Name: ebuild_deps; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE ebuild_deps ( - ebuildid integer NOT NULL, - packageid integer NOT NULL, - versionspec text NOT NULL, - flags text NOT NULL, - op character varying(4) NOT NULL, - slot text NOT NULL -); -ALTER TABLE ebuild_deps OWNER TO gentoo; --- Name: TABLE ebuild_deps; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE ebuild_deps IS 'The dependencies of ebuilds (includes blocks, etc)'; --- Name: ebuild_masks; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE ebuild_masks ( - setno integer NOT NULL, - ebuildid integer NOT NULL -); -ALTER TABLE ebuild_masks OWNER TO gentoo; --- Name: ebuild_rdeps; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE ebuild_rdeps ( - ebuildid integer NOT NULL, - packageid integer NOT NULL, - versionspec text NOT NULL, - flags text NOT NULL, - op character varying(4) NOT NULL, - slot text NOT NULL -); -ALTER TABLE ebuild_rdeps OWNER TO gentoo; --- Name: ebuild_uses; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE ebuild_uses ( - ebuildid integer NOT NULL, - use text NOT NULL -); -ALTER TABLE ebuild_uses OWNER TO gentoo; --- Name: TABLE ebuild_uses; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE ebuild_uses IS 'Use flags affecting ebuilds'; --- Name: ebuilds; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE ebuilds ( - ebuildid integer NOT NULL, - packageid integer NOT NULL, - version text NOT NULL, - versioninst ebuildversion NOT NULL, - slot text NOT NULL, - license text, - firstseen timestamp without time zone NOT NULL, - moddate timestamp without time zone NOT NULL, - repoid integer NOT NULL -); -ALTER TABLE ebuilds OWNER TO gentoo; --- Name: TABLE ebuilds; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE ebuilds IS 'Ebuilds :-)'; --- Name: files; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE files ( - filename text NOT NULL, - fileid integer NOT NULL, - moddate timestamp without time zone NOT NULL, - firstseen timestamp without time zone DEFAULT now() NOT NULL, - cachedat timestamp without time zone, - filetypeid integer NOT NULL, - repoid integer NOT NULL, - filesize integer NOT NULL, - pathparts text[] NOT NULL, - encoding text -); -ALTER TABLE files OWNER TO gentoo; --- Name: filecontent(files); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION filecontent(f files) RETURNS text - LANGUAGE plpgsql IMMUTABLE - AS $$ -begin - return CONVERT_FROM(PG_READ_BINARY_FILE(f.filename), COALESCE(f.encoding, 'utf-8')); -end -$$; -ALTER FUNCTION gentoobrowse.filecontent(f files) OWNER TO gentoo; --- Name: filetypes; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE filetypes ( - filetypeid integer NOT NULL, - description text NOT NULL, - spec filterspec[] NOT NULL -); -ALTER TABLE filetypes OWNER TO gentoo; --- Name: TABLE filetypes; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE filetypes IS 'What kind of file is this?... metadata, changelog, etc'; --- Name: license; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE license ( - name text NOT NULL, - legalbumph text NOT NULL -); -ALTER TABLE license OWNER TO gentoo; --- Name: masksets; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE masksets ( - setno integer NOT NULL, - person text, - email text NOT NULL, - dateadded date NOT NULL, - message text NOT NULL, - n smallint NOT NULL -); -ALTER TABLE masksets OWNER TO gentoo; --- Name: masksets_setno_seq; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE masksets_setno_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE masksets_setno_seq OWNER TO gentoo; --- Name: masksets_setno_seq; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE masksets_setno_seq OWNED BY masksets.setno; --- Name: news; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE news ( - newsid text NOT NULL, - title text NOT NULL, - posted date NOT NULL, - authorname text, - authoremail text, - atomspec text[], - body text[] NOT NULL, - urls text[] -); -ALTER TABLE news OWNER TO gentoo; --- Name: newsfts(news); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo -CREATE FUNCTION newsfts(n news) RETURNS tsvector - LANGUAGE plpgsql IMMUTABLE - AS $$ -BEGIN - RETURN SUM(t) FROM (SELECT TO_TSVECTOR('english', UNNEST(n.body)) t) a; -END -$$; -ALTER FUNCTION gentoobrowse.newsfts(n news) OWNER TO gentoo; --- Name: package_bugs; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE package_bugs ( - packageid integer NOT NULL, - bugid integer NOT NULL, - firstseen timestamp without time zone DEFAULT now() NOT NULL -); -ALTER TABLE package_bugs OWNER TO gentoo; --- Name: TABLE package_bugs; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE package_bugs IS 'Association of bugs to products by bug description'; --- Name: package_changelogs; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE package_changelogs ( - packageid integer NOT NULL, - date date NOT NULL, - n smallint NOT NULL, - person text, - email text, - comment text, - repoid integer NOT NULL -); -ALTER TABLE package_changelogs OWNER TO gentoo; --- Name: package_urls; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE package_urls ( - packageid integer NOT NULL, - url text NOT NULL -); -ALTER TABLE package_urls OWNER TO gentoo; --- Name: TABLE package_urls; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE package_urls IS 'URLs associated with a given package'; --- Name: repos; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE repos ( - repoid integer NOT NULL, - name text NOT NULL -); -ALTER TABLE repos OWNER TO gentoo; --- Name: repos_repoid_seq; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE repos_repoid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE repos_repoid_seq OWNER TO gentoo; --- Name: repos_repoid_seq; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE repos_repoid_seq OWNED BY repos.repoid; --- Name: seq_categoryid; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE seq_categoryid - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE seq_categoryid OWNER TO gentoo; --- Name: seq_categoryid; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE seq_categoryid OWNED BY categories.categoryid; --- Name: seq_fileid; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE seq_fileid - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE seq_fileid OWNER TO gentoo; --- Name: seq_fileid; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE seq_fileid OWNED BY files.fileid; --- Name: seq_packageid; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE seq_packageid - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE seq_packageid OWNER TO gentoo; --- Name: seq_packageid; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE seq_packageid OWNED BY packages.packageid; --- Name: use_global; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE use_global ( - use text NOT NULL, - description text -); -ALTER TABLE use_global OWNER TO gentoo; --- Name: use_group; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE use_group ( - usegroupid integer NOT NULL, - use text NOT NULL, - description text NOT NULL -); -ALTER TABLE use_group OWNER TO gentoo; --- Name: use_groups; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE use_groups ( - usegroupid integer NOT NULL, - name text NOT NULL -); -ALTER TABLE use_groups OWNER TO gentoo; --- Name: use_groups_usegroupid_seq; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE use_groups_usegroupid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE use_groups_usegroupid_seq OWNER TO gentoo; --- Name: use_groups_usegroupid_seq; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE use_groups_usegroupid_seq OWNED BY use_groups.usegroupid; --- Name: use_local; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE use_local ( - packageid integer NOT NULL, - use text NOT NULL, - description text NOT NULL -); -ALTER TABLE use_local OWNER TO gentoo; --- Name: user_ebuild_emails; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE user_ebuild_emails ( - userid integer NOT NULL, - ebuildid integer NOT NULL, - sentat timestamp without time zone NOT NULL -); -ALTER TABLE user_ebuild_emails OWNER TO gentoo; --- Name: user_packages; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE user_packages ( - userid integer NOT NULL, - packageid integer NOT NULL, - trackedsince timestamp without time zone DEFAULT now() NOT NULL -); -ALTER TABLE user_packages OWNER TO gentoo; --- Name: TABLE user_packages; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE user_packages IS 'Lists packages that registered users are interested in'; --- Name: users; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE TABLE users ( - userid integer NOT NULL, - username text NOT NULL, - userrealname text NOT NULL, - userpassword text NOT NULL, - useremail text NOT NULL, - verifyguid uuid -); -ALTER TABLE users OWNER TO gentoo; --- Name: TABLE users; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo -COMMENT ON TABLE users IS 'Registered users'; --- Name: users_userid_seq; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo -CREATE SEQUENCE users_userid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; -ALTER TABLE users_userid_seq OWNER TO gentoo; --- Name: users_userid_seq; Type: SEQUENCE OWNED BY; Schema: gentoobrowse; Owner: gentoo -ALTER SEQUENCE users_userid_seq OWNED BY users.userid; --- Name: categoryid; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY categories ALTER COLUMN categoryid SET DEFAULT nextval('seq_categoryid'::regclass); --- Name: fileid; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY files ALTER COLUMN fileid SET DEFAULT nextval('seq_fileid'::regclass); --- Name: setno; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY masksets ALTER COLUMN setno SET DEFAULT nextval('masksets_setno_seq'::regclass); --- Name: packageid; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY packages ALTER COLUMN packageid SET DEFAULT nextval('seq_packageid'::regclass); --- Name: repoid; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY repos ALTER COLUMN repoid SET DEFAULT nextval('repos_repoid_seq'::regclass); --- Name: usegroupid; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY use_groups ALTER COLUMN usegroupid SET DEFAULT nextval('use_groups_usegroupid_seq'::regclass); --- Name: userid; Type: DEFAULT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY users ALTER COLUMN userid SET DEFAULT nextval('users_userid_seq'::regclass); --- Name: license_pkey; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY license - ADD CONSTRAINT license_pkey PRIMARY KEY (name); --- Name: pk_bugs; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY bugs - ADD CONSTRAINT pk_bugs PRIMARY KEY (bugid); --- Name: pk_ebuild; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuilds - ADD CONSTRAINT pk_ebuild PRIMARY KEY (ebuildid); --- Name: pk_ebuildarch; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuild_archs - ADD CONSTRAINT pk_ebuildarch PRIMARY KEY (ebuildid, arch); -ALTER TABLE ebuild_archs CLUSTER ON pk_ebuildarch; --- Name: pk_ebuilddeps; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuild_deps - ADD CONSTRAINT pk_ebuilddeps PRIMARY KEY (ebuildid, packageid, versionspec, flags, slot, op); -ALTER TABLE ebuild_deps CLUSTER ON pk_ebuilddeps; --- Name: pk_ebuildmasks; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuild_masks - ADD CONSTRAINT pk_ebuildmasks PRIMARY KEY (ebuildid, setno); --- Name: pk_ebuildrdeps; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuild_rdeps - ADD CONSTRAINT pk_ebuildrdeps PRIMARY KEY (ebuildid, packageid, versionspec, flags, slot, op); -ALTER TABLE ebuild_rdeps CLUSTER ON pk_ebuildrdeps; --- Name: pk_ebuilduses; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuild_uses - ADD CONSTRAINT pk_ebuilduses PRIMARY KEY (ebuildid, use); -ALTER TABLE ebuild_uses CLUSTER ON pk_ebuilduses; --- Name: pk_fileclass; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY filetypes - ADD CONSTRAINT pk_fileclass PRIMARY KEY (filetypeid); --- Name: pk_files; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY files - ADD CONSTRAINT pk_files PRIMARY KEY (fileid); --- Name: pk_news; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY news - ADD CONSTRAINT pk_news PRIMARY KEY (newsid); --- Name: pk_package_changelogs; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY package_changelogs - ADD CONSTRAINT pk_package_changelogs PRIMARY KEY (packageid, date, n, repoid); -ALTER TABLE package_changelogs CLUSTER ON pk_package_changelogs; --- Name: pk_packagebugs; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY package_bugs - ADD CONSTRAINT pk_packagebugs PRIMARY KEY (packageid, bugid); -ALTER TABLE package_bugs CLUSTER ON pk_packagebugs; --- Name: pk_packagemasksets; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY masksets - ADD CONSTRAINT pk_packagemasksets PRIMARY KEY (setno); --- Name: pk_packages; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY packages - ADD CONSTRAINT pk_packages PRIMARY KEY (packageid); --- Name: pk_pkggroup; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY categories - ADD CONSTRAINT pk_pkggroup PRIMARY KEY (categoryid); --- Name: pk_pkgurls; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY package_urls - ADD CONSTRAINT pk_pkgurls PRIMARY KEY (packageid, url); -ALTER TABLE package_urls CLUSTER ON pk_pkgurls; --- Name: pk_usegroup; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY use_groups - ADD CONSTRAINT pk_usegroup PRIMARY KEY (usegroupid); --- Name: pk_userebuildemails; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY user_ebuild_emails - ADD CONSTRAINT pk_userebuildemails PRIMARY KEY (userid, ebuildid); --- Name: pk_userpackages; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY user_packages - ADD CONSTRAINT pk_userpackages PRIMARY KEY (userid, packageid); -ALTER TABLE user_packages CLUSTER ON pk_userpackages; --- Name: pk_users; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY users - ADD CONSTRAINT pk_users PRIMARY KEY (userid); --- Name: repos_pkey; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY repos - ADD CONSTRAINT repos_pkey PRIMARY KEY (repoid); --- Name: uni_ebuild_pkgverrepo; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY ebuilds - ADD CONSTRAINT uni_ebuild_pkgverrepo UNIQUE (packageid, version, repoid); -ALTER TABLE ebuilds CLUSTER ON uni_ebuild_pkgverrepo; --- Name: uni_files_filename; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY files - ADD CONSTRAINT uni_files_filename UNIQUE (filename); --- Name: uni_pkg_name; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY packages - ADD CONSTRAINT uni_pkg_name UNIQUE (categoryid, name); -ALTER TABLE packages CLUSTER ON uni_pkg_name; --- Name: uni_pkggroup_group; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY categories - ADD CONSTRAINT uni_pkggroup_group UNIQUE (name); --- Name: uni_useremail; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY users - ADD CONSTRAINT uni_useremail UNIQUE (useremail); --- Name: uni_username; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY users - ADD CONSTRAINT uni_username UNIQUE (username); --- Name: use_global_pkey; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY use_global - ADD CONSTRAINT use_global_pkey PRIMARY KEY (use); --- Name: use_group_pkey; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY use_group - ADD CONSTRAINT use_group_pkey PRIMARY KEY (usegroupid, use); --- Name: use_local_pkey; Type: CONSTRAINT; Schema: gentoobrowse; Owner: gentoo; Tablespace: -ALTER TABLE ONLY use_local - ADD CONSTRAINT use_local_pkey PRIMARY KEY (packageid, use); -ALTER TABLE use_local CLUSTER ON use_local_pkey; --- Name: idx_bug_fts; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_bug_fts ON bugs USING gin (bugfts(bugs.*)); --- Name: idx_bugs_firstseen; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_bugs_firstseen ON bugs USING btree (firstseen DESC); --- Name: idx_bugs_summarypackages; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_bugs_summarypackages ON bugs USING gin (namedpackages(summary)); --- Name: idx_ebuilddeps_package; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_ebuilddeps_package ON ebuild_deps USING btree (packageid); --- Name: idx_ebuildrdeps_package; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_ebuildrdeps_package ON ebuild_rdeps USING btree (packageid); --- Name: idx_ebuilds_firstseen; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_ebuilds_firstseen ON ebuilds USING btree (firstseen); --- Name: idx_ebuilduses_use; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_ebuilduses_use ON ebuild_uses USING btree (use); --- Name: idx_news_fts; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_news_fts ON news USING gin (newsfts(news.*)); --- Name: idx_news_posted; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_news_posted ON news USING btree (posted); --- Name: idx_package_name; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_package_name ON packages USING btree (name); --- Name: idx_packagebugs_bug; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_packagebugs_bug ON package_bugs USING btree (bugid); --- Name: idx_packages_fts; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_packages_fts ON packages USING gin (packagefts(packages.*)); --- Name: idx_packages_herd; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_packages_herd ON packages USING btree (herd); --- Name: idx_uselocal_use; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_uselocal_use ON use_local USING btree (use); --- Name: idx_userpackages_package; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX idx_userpackages_package ON user_packages USING btree (packageid); --- Name: uni_masksets_dateaddedn; Type: INDEX; Schema: gentoobrowse; Owner: gentoo; Tablespace: -CREATE INDEX uni_masksets_dateaddedn ON masksets USING btree (dateadded, n); --- Name: fk_ebuild_pkg; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuilds - ADD CONSTRAINT fk_ebuild_pkg FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuild_repo; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuilds - ADD CONSTRAINT fk_ebuild_repo FOREIGN KEY (repoid) REFERENCES repos(repoid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuildarch_file; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_archs - ADD CONSTRAINT fk_ebuildarch_file FOREIGN KEY (ebuildid) REFERENCES ebuilds(ebuildid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuilddeps_ebuild; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_deps - ADD CONSTRAINT fk_ebuilddeps_ebuild FOREIGN KEY (ebuildid) REFERENCES ebuilds(ebuildid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuilddeps_pkg; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_deps - ADD CONSTRAINT fk_ebuilddeps_pkg FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuildmasks_ebuild; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_masks - ADD CONSTRAINT fk_ebuildmasks_ebuild FOREIGN KEY (ebuildid) REFERENCES ebuilds(ebuildid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuildmasks_maskset; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_masks - ADD CONSTRAINT fk_ebuildmasks_maskset FOREIGN KEY (setno) REFERENCES masksets(setno) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuildrdeps_ebuild; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_rdeps - ADD CONSTRAINT fk_ebuildrdeps_ebuild FOREIGN KEY (ebuildid) REFERENCES ebuilds(ebuildid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuildrdeps_pkg; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_rdeps - ADD CONSTRAINT fk_ebuildrdeps_pkg FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_ebuilduses_file; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY ebuild_uses - ADD CONSTRAINT fk_ebuilduses_file FOREIGN KEY (ebuildid) REFERENCES ebuilds(ebuildid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_files_type; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY files - ADD CONSTRAINT fk_files_type FOREIGN KEY (filetypeid) REFERENCES filetypes(filetypeid) ON UPDATE CASCADE; --- Name: fk_packagebugs_bug; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY package_bugs - ADD CONSTRAINT fk_packagebugs_bug FOREIGN KEY (bugid) REFERENCES bugs(bugid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_packagebugs_package; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY package_bugs - ADD CONSTRAINT fk_packagebugs_package FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_packagechangelogs_package; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY package_changelogs - ADD CONSTRAINT fk_packagechangelogs_package FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_packagechangelogs_repo; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY package_changelogs - ADD CONSTRAINT fk_packagechangelogs_repo FOREIGN KEY (repoid) REFERENCES repos(repoid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_packageurls_package; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY package_urls - ADD CONSTRAINT fk_packageurls_package FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_pkg_grp; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY packages - ADD CONSTRAINT fk_pkg_grp FOREIGN KEY (categoryid) REFERENCES categories(categoryid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_pkgurls_pkg; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY package_urls - ADD CONSTRAINT fk_pkgurls_pkg FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_usegroup_groupid; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY use_group - ADD CONSTRAINT fk_usegroup_groupid FOREIGN KEY (usegroupid) REFERENCES use_groups(usegroupid) ON DELETE CASCADE; --- Name: fk_uselocal_package; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY use_local - ADD CONSTRAINT fk_uselocal_package FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_userebuildemails_ebuild; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY user_ebuild_emails - ADD CONSTRAINT fk_userebuildemails_ebuild FOREIGN KEY (ebuildid) REFERENCES ebuilds(ebuildid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_userebuildemails_user; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY user_ebuild_emails - ADD CONSTRAINT fk_userebuildemails_user FOREIGN KEY (userid) REFERENCES users(userid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_userpackage_package; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY user_packages - ADD CONSTRAINT fk_userpackage_package FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_userpackage_user; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY user_packages - ADD CONSTRAINT fk_userpackage_user FOREIGN KEY (userid) REFERENCES users(userid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: fk_userpackages_package; Type: FK CONSTRAINT; Schema: gentoobrowse; Owner: gentoo -ALTER TABLE ONLY user_packages - ADD CONSTRAINT fk_userpackages_package FOREIGN KEY (packageid) REFERENCES packages(packageid) ON UPDATE CASCADE ON DELETE CASCADE; --- Name: gentoobrowse; Type: ACL; Schema: -; Owner: gentoo -REVOKE ALL ON SCHEMA gentoobrowse FROM PUBLIC; -REVOKE ALL ON SCHEMA gentoobrowse FROM gentoo; -GRANT USAGE ON SCHEMA gentoobrowse TO apache; -GRANT USAGE ON SCHEMA gentoobrowse TO gentoo; --- Name: bugs; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE bugs FROM PUBLIC; -REVOKE ALL ON TABLE bugs FROM gentoo; -GRANT ALL ON TABLE bugs TO gentoo; -GRANT SELECT ON TABLE bugs TO apache; --- Name: packages; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE packages FROM PUBLIC; -REVOKE ALL ON TABLE packages FROM gentoo; -GRANT ALL ON TABLE packages TO gentoo; -GRANT SELECT ON TABLE packages TO apache; --- Name: categories; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE categories FROM PUBLIC; -REVOKE ALL ON TABLE categories FROM gentoo; -GRANT ALL ON TABLE categories TO gentoo; -GRANT SELECT ON TABLE categories TO apache; --- Name: ebuild_archs; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE ebuild_archs FROM PUBLIC; -REVOKE ALL ON TABLE ebuild_archs FROM gentoo; -GRANT ALL ON TABLE ebuild_archs TO gentoo; -GRANT SELECT ON TABLE ebuild_archs TO apache; --- Name: ebuild_deps; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE ebuild_deps FROM PUBLIC; -REVOKE ALL ON TABLE ebuild_deps FROM gentoo; -GRANT ALL ON TABLE ebuild_deps TO gentoo; -GRANT SELECT ON TABLE ebuild_deps TO apache; --- Name: ebuild_masks; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE ebuild_masks FROM PUBLIC; -REVOKE ALL ON TABLE ebuild_masks FROM gentoo; -GRANT ALL ON TABLE ebuild_masks TO gentoo; -GRANT SELECT ON TABLE ebuild_masks TO apache; --- Name: ebuild_rdeps; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE ebuild_rdeps FROM PUBLIC; -REVOKE ALL ON TABLE ebuild_rdeps FROM gentoo; -GRANT ALL ON TABLE ebuild_rdeps TO gentoo; -GRANT SELECT ON TABLE ebuild_rdeps TO apache; --- Name: ebuild_uses; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE ebuild_uses FROM PUBLIC; -REVOKE ALL ON TABLE ebuild_uses FROM gentoo; -GRANT ALL ON TABLE ebuild_uses TO gentoo; -GRANT SELECT ON TABLE ebuild_uses TO apache; --- Name: ebuilds; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE ebuilds FROM PUBLIC; -REVOKE ALL ON TABLE ebuilds FROM gentoo; -GRANT ALL ON TABLE ebuilds TO gentoo; -GRANT SELECT ON TABLE ebuilds TO apache; --- Name: files; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE files FROM PUBLIC; -REVOKE ALL ON TABLE files FROM gentoo; -GRANT ALL ON TABLE files TO gentoo; -GRANT SELECT ON TABLE files TO apache; --- Name: filetypes; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE filetypes FROM PUBLIC; -REVOKE ALL ON TABLE filetypes FROM gentoo; -GRANT ALL ON TABLE filetypes TO gentoo; -GRANT SELECT ON TABLE filetypes TO apache; --- Name: masksets; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE masksets FROM PUBLIC; -REVOKE ALL ON TABLE masksets FROM gentoo; -GRANT ALL ON TABLE masksets TO gentoo; -GRANT SELECT ON TABLE masksets TO apache; --- Name: package_bugs; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE package_bugs FROM PUBLIC; -REVOKE ALL ON TABLE package_bugs FROM gentoo; -GRANT ALL ON TABLE package_bugs TO gentoo; -GRANT SELECT ON TABLE package_bugs TO apache; --- Name: package_changelogs; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE package_changelogs FROM PUBLIC; -REVOKE ALL ON TABLE package_changelogs FROM gentoo; -GRANT ALL ON TABLE package_changelogs TO gentoo; -GRANT SELECT ON TABLE package_changelogs TO apache; --- Name: package_urls; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE package_urls FROM PUBLIC; -REVOKE ALL ON TABLE package_urls FROM gentoo; -GRANT ALL ON TABLE package_urls TO gentoo; -GRANT SELECT ON TABLE package_urls TO apache; --- Name: repos; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE repos FROM PUBLIC; -REVOKE ALL ON TABLE repos FROM gentoo; -GRANT ALL ON TABLE repos TO gentoo; -GRANT SELECT ON TABLE repos TO apache; --- Name: use_global; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE use_global FROM PUBLIC; -REVOKE ALL ON TABLE use_global FROM gentoo; -GRANT ALL ON TABLE use_global TO gentoo; -GRANT SELECT ON TABLE use_global TO apache; --- Name: use_group; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE use_group FROM PUBLIC; -REVOKE ALL ON TABLE use_group FROM gentoo; -GRANT ALL ON TABLE use_group TO gentoo; -GRANT SELECT ON TABLE use_group TO apache; --- Name: use_groups; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE use_groups FROM PUBLIC; -REVOKE ALL ON TABLE use_groups FROM gentoo; -GRANT ALL ON TABLE use_groups TO gentoo; -GRANT SELECT ON TABLE use_groups TO apache; --- Name: use_local; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE use_local FROM PUBLIC; -REVOKE ALL ON TABLE use_local FROM gentoo; -GRANT ALL ON TABLE use_local TO gentoo; -GRANT SELECT ON TABLE use_local TO apache; --- Name: user_ebuild_emails; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE user_ebuild_emails FROM PUBLIC; -REVOKE ALL ON TABLE user_ebuild_emails FROM gentoo; -GRANT ALL ON TABLE user_ebuild_emails TO gentoo; -GRANT SELECT ON TABLE user_ebuild_emails TO apache; --- Name: user_packages; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE user_packages FROM PUBLIC; -REVOKE ALL ON TABLE user_packages FROM gentoo; -GRANT ALL ON TABLE user_packages TO gentoo; -GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE user_packages TO apache; --- Name: users; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON TABLE users FROM PUBLIC; -REVOKE ALL ON TABLE users FROM gentoo; -GRANT ALL ON TABLE users TO gentoo; -GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE users TO apache; --- Name: users_userid_seq; Type: ACL; Schema: gentoobrowse; Owner: gentoo -REVOKE ALL ON SEQUENCE users_userid_seq FROM PUBLIC; -REVOKE ALL ON SEQUENCE users_userid_seq FROM gentoo; -GRANT ALL ON SEQUENCE users_userid_seq TO gentoo; -GRANT ALL ON SEQUENCE users_userid_seq TO apache; --- PostgreSQL database dump complete diff --git a/gentoobrowse/emails/.htaccess b/gentoobrowse/emails/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/emails/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/emails/base.xslt b/gentoobrowse/emails/base.xslt deleted file mode 100644 index a8ceaac..0000000 --- a/gentoobrowse/emails/base.xslt +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > - <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> - - <xsl:template match="/*"> - <xsl:text disable-output-escaping="yes"><!DOCTYPE html> </xsl:text> - <html lang="en"> - <head> - <meta charset="utf-8" /> - <link href="http://gentoobrowse.randomdan.homeip.net/css/bootstrap.min.css" rel="stylesheet" media="screen" /> - <link href="http://gentoobrowse.randomdan.homeip.net/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen" /> - <link href="http://gentoobrowse.randomdan.homeip.net/css/general.css" rel="stylesheet" media="screen" /> - <xsl:call-template name="head" /> - </head> - <body data-spy="scroll" data-target=".bs-docs-sidebar"> - <!-- nav --> - <nav class="navbar navbar-inverse navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container"> - <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="brand" href="http://gentoobrowse.randomdan.homeip.net/">Gentoo Browse</a> - <div class="nav-collapse collapse"> - <ul class="nav"> - <li><a href="http://gentoobrowse.randomdan.homeip.net/">Home</a></li> - <li><a href="http://gentoobrowse.randomdan.homeip.net/categories">Browse</a></li> - <li><a href="http://gentoobrowse.randomdan.homeip.net/popular">Popular</a></li> - </ul> - </div> - </div> - </div> - </nav> - - <!-- page content --> - <header class="jumbotron subhead"> - <div class="container"> - <xsl:call-template name="header" /> - </div> - </header> - <div class="container"> - <article class="row"> - <xsl:call-template name="content" /> - </article> - </div> - - <!-- footer --> - <footer class="footer"> - <div class="container"> - <p>Gentoo Browse is not an official Gentoo website. The name "Gentoo" and the "g" logo are trademarks of the Gentoo Foundation, Inc.</p> - </div> - </footer> - - <script src="http://code.jquery.com/jquery-latest.js"></script> - <script src="http://gentoobrowse.randomdan.homeip.net/js/bootstrap.min.js"></script> - <script src="http://gentoobrowse.randomdan.homeip.net/js/js.js"></script> - </body> - </html> - </xsl:template> - - <xsl:template name="head"> - </xsl:template> - - <xsl:template name="header"> - </xsl:template> -</xsl:stylesheet> diff --git a/gentoobrowse/emails/newpackageversions.xml b/gentoobrowse/emails/newpackageversions.xml deleted file mode 100644 index 08825e3..0000000 --- a/gentoobrowse/emails/newpackageversions.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?> -<view root="newpackageversions" style="emails/newpackageversions.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="newpackageversions" datasource="postgres"> - <sql> - select ut.cname, ut.pname, ut.version, ut.description - from ( - select e.ebuildid, up.userid, u.useremail, p.name as pname, c.name as cname, e.version, p.description - from ebuilds e, user_packages up, users u, packages p, categories c - where e.packageid = up.packageid - and u.userid = up.userid - and u.userid = <param name="userid" /> - and e.packageid = p.packageid - and c.categoryid = p.categoryid - and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe - on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid - where ebe.userid is null - order by ut.cname, ut.pname, ut.version - </sql> - </project2:sqlrows> - <project2:autotree name="newpackageversionsforuser" source="newpackageversions"> - <parameters> - <userid source="parent" name="userid" depth="1" /> - </parameters> - <tree rootname="categories" objectname="category"> - <key source="parent" name="cname" /> - <tree rootname="packages" objectname="package"> - <key source="parent" name="pname" /> - <include source="parent" name="description" /> - <tree rootname="versions"> - <key source="parent" name="version" /> - </tree> - </tree> - </tree> - </project2:autotree> -</view> - diff --git a/gentoobrowse/emails/newpackageversions.xslt b/gentoobrowse/emails/newpackageversions.xslt deleted file mode 100644 index 928edd5..0000000 --- a/gentoobrowse/emails/newpackageversions.xslt +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://exslt.org/strings" xmlns:project2="http://project2.randomdan.homeip.net" version="1.0" exclude-result-prefixes="project2 fn"> - <xsl:import href="base.xslt"/> - <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"/> - - <xsl:template name="header"> - <h2>New versions of packages you're tracking.</h2> - </xsl:template> - - <xsl:template name="content"> - <div class="span3 bs-docs-sidebar"> - <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="categories/category"> - <li> - <a> - <xsl:attribute name="href">#<xsl:value-of select="cname" /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="cname" /> - </a> - </li> - </xsl:for-each> - </ul> - </div> - <div class="span9"> - <xsl:for-each select="categories//package"> - <section> - <xsl:if test="count(preceding-sibling::package) = 0"> - <xsl:attribute name="id"><xsl:value-of select="../../cname" /></xsl:attribute> - </xsl:if> - <h3> - <xsl:value-of select="../../cname"/> / - <a> - <xsl:attribute name="href">http://gentoobrowse.randomdan.homeip.net/package/<xsl:value-of select="../../cname"/>/<xsl:value-of select="pname"/></xsl:attribute> - <xsl:value-of select="pname"/> - </a> - </h3> - <p> - <xsl:value-of select="description"/> - </p> - <ul> - <xsl:for-each select="versions/version"> - <li><xsl:value-of select="../../../../cname"/>/<xsl:value-of select="../../pname"/>-<xsl:value-of select="."/></li> - </xsl:for-each> - </ul> - </section> - </xsl:for-each> - </div> - </xsl:template> -</xsl:stylesheet> diff --git a/gentoobrowse/emails/signup.xslt b/gentoobrowse/emails/signup.xslt deleted file mode 100644 index d0a0823..0000000 --- a/gentoobrowse/emails/signup.xslt +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > - <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" - doctype-system="http://www.w3.org/TR/html4/loose.dtd" - doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" /> - <xsl:template match="/signup"> - <html> - <head> - <title>Welcome to Gentoo Browse</title> - </head> - <body> - <p>Welcome to Gentoo Browse!</p> - <p> - Click <a><xsl:attribute name="href">http://gentoobrowse.randomdan.homeip.net/confirm?verifyguid=<xsl:value-of select="/signup/verifyguids/verifyguid/guid" /> - </xsl:attribute>this link</a> to confirm your account. - </p> - <p>Or alternatively, copy and paste this code into the confirmation page: <xsl:value-of select="/signup/verifyguids/verifyguid/guid" /></p> - </body> - </html> - </xsl:template> -</xsl:stylesheet> - diff --git a/gentoobrowse/emails/welcome.xml b/gentoobrowse/emails/welcome.xml deleted file mode 100644 index e245a34..0000000 --- a/gentoobrowse/emails/welcome.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> -<view root="signup" style="emails/signup.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="verifyguidsbyemail" datasource="postgres-web"> - <sql> - SELECT userid, CAST(verifyguid AS TEXT) AS guid - FROM users u - WHERE useremail = <param name="email" /> - AND verifyguid IS NOT NULL - </sql> - </project2:sqlrows> - <project2:view name="verifyguids" source="verifyguidsbyemail" rootname="verifyguids" recordname="verifyguid"> - <parameters> - <email source="param" name="email" /> - </parameters> - </project2:view> -</view> diff --git a/gentoobrowse/gentoobrowse-cgi b/gentoobrowse/gentoobrowse-cgi new file mode 120000 index 0000000..190d839 --- /dev/null +++ b/gentoobrowse/gentoobrowse-cgi @@ -0,0 +1 @@ +src/bin/gcc-5.4.0/release/allow-ice-yes/slicer-yes/strip-on/gentoobrowse-cgi
\ No newline at end of file diff --git a/gentoobrowse/js/pkgtracking.js b/gentoobrowse/js/pkgtracking.js index 1c171b6..523c102 100644 --- a/gentoobrowse/js/pkgtracking.js +++ b/gentoobrowse/js/pkgtracking.js @@ -1,27 +1,20 @@ -function track(pid) +function track() { - xmlhttp = new XMLHttpRequest(); - xmlhttp.open("POST", "/track", false); - xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - xmlhttp.send("packageid=" + pid); - if (xmlhttp.status == 200) { - toggleTracking(); - } + toggleTracking('PUT'); } -function untrack(pid) +function untrack() { - xmlhttp = new XMLHttpRequest(); - xmlhttp.open("POST", "/untrack", false); - xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - xmlhttp.send("packageid=" + pid); - if (xmlhttp.status == 200) { - toggleTracking(); - } + toggleTracking('DELETE'); } -function toggleTracking() +function toggleTracking(method) { - $('#dotrack').toggle(); - $('#dountrack').toggle(); + $.ajax(window.location.pathname + '/tracked', { + method: method, + success: function() { + $('#dotrack').toggle(); + $('#dountrack').toggle(); + } + }); } diff --git a/gentoobrowse/present/.htaccess b/gentoobrowse/present/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/present/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/present/accountHome.xml b/gentoobrowse/present/accountHome.xml deleted file mode 100644 index e28caf8..0000000 --- a/gentoobrowse/present/accountHome.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<view name="index" root="gentoo" contenttype="text/xml-xslt" style="xslt/login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/webcommon.xml" /> - <xi:include href="../checks/loggedIn.xml" /> - <project2:rawview> - <form caption="Logout" submit="Logout" action="/dologout" method="post" /> - <para><p>View my <a href="/accountTracked">tracked packages</a></p></para> - </project2:rawview> -</view> - diff --git a/gentoobrowse/present/accountTracked.xml b/gentoobrowse/present/accountTracked.xml deleted file mode 100644 index 14eaf2f..0000000 --- a/gentoobrowse/present/accountTracked.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?> -<view name="index" root="gentoo" contenttype="text/xml-xslt" style="xslt/login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../checks/loggedIn.xml" /> - <xi:include href="../views/tracked.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="trackedPackages" source="trackedPackages" rootname="trackedpackages" recordname="package" filter="userid"> - <parameters> - <userid source="session" name="loggedInUserID" /> - </parameters> - <project2:distinct name="categories"> - <value source="parent" name="catname" /> - </project2:distinct> - </project2:view> -</view> - - diff --git a/gentoobrowse/present/atom.xml b/gentoobrowse/present/atom.xml deleted file mode 100644 index 48d12dd..0000000 --- a/gentoobrowse/present/atom.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<view name="atomebuilds" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/newebuildsatom.xml" /> - <project2:view name="atomebuilds" source="newebuilds" rootname="newebuilds" recordname="ebuild"> - <parameters> - <username source="uri" index="1" /> - </parameters> - <project2:max name="lastBuildDate"> - <value source="parent" name="moddate" /> - </project2:max> - </project2:view> - <project2:xml root="gentoo" style="xslt/atomebuilds.xslt" dateformat="%a, %d %b %Y %T UT"> - <project2:htmldocument /> - </project2:xml> -</view> diff --git a/gentoobrowse/present/categories.xml b/gentoobrowse/present/categories.xml deleted file mode 100644 index 94f827e..0000000 --- a/gentoobrowse/present/categories.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<view name="categories" root="gentoo" contenttype="text/xml-xslt" style="xslt/categories.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/categories.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="categories" source="categories" rootname="categories" recordname="category"> - <project2:distinct name="supers"> - <value source="parent" depth="1" name="super" /> - </project2:distinct> - </project2:view> -</view> diff --git a/gentoobrowse/present/category.xml b/gentoobrowse/present/category.xml deleted file mode 100644 index aed525d..0000000 --- a/gentoobrowse/present/category.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<view name="category" root="gentoo" contenttype="text/xml-xslt" style="xslt/category.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/category.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="categoryPackages" source="categoryPackages" rootname="packages" recordname="package" filter="byCatName" required="true"> - <parameters> - <catname source="uri" index="1" /> - </parameters> - <project2:distinct name="herds"> - <value source="parent" name="herd" /> - </project2:distinct> - </project2:view> -</view> diff --git a/gentoobrowse/present/confirm.xml b/gentoobrowse/present/confirm.xml deleted file mode 100644 index 98b7240..0000000 --- a/gentoobrowse/present/confirm.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<view name="confirm" root="gentoo" contenttype="text/xml-xslt" style="xslt/login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/webcommon.xml" /> - <project2:rawview> - <para><p xmlns="http://www.w3.org/1999/xhtml">Please enter the confirmation code from your welcome email.</p></para> - <form caption="Confirmation" submit="Confirm" action="/doconfirm" method="post"> - <input type="text" name="verifyguid" caption="Confirmation code" - xslvalue="/gentoo/project2:params/project2:param[@name='verifyguid']/@value" /> - </form> - </project2:rawview> -</view> - - diff --git a/gentoobrowse/present/herd.xml b/gentoobrowse/present/herd.xml deleted file mode 100644 index dca80b5..0000000 --- a/gentoobrowse/present/herd.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<view name="popular" root="gentoo" contenttype="text/xml-xslt" style="xslt/herd.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/search.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="packagesInHerd" source="packagesInHerd" rootname="packages" recordname="package" filter="byHerd"> - <parameters> - <herd source="uri" index="1" /> - </parameters> - <project2:distinct name="categories"> - <value source="parent" name="catname" /> - </project2:distinct> - </project2:view> -</view> diff --git a/gentoobrowse/present/index.xml b/gentoobrowse/present/index.xml deleted file mode 100644 index 64e62a7..0000000 --- a/gentoobrowse/present/index.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<view name="index" root="gentoo" contenttype="text/xml-xslt" style="xslt/home.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/newebuilds.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="newebuilds" source="newebuilds" rootname="newebuilds" recordname="ebuild" filter="syncCount"> - <project2:max name="lastsync"> - <value source="parent" depth="1" name="sync" /> - </project2:max> - <project2:distinct name="syncs"> - <value source="parent" depth="1" name="sync" /> - </project2:distinct> - <parameters> - <count value="3" /> - <userID source="session" name="loggedInUserID"><default value="0" type="int" /></userID> - </parameters> - </project2:view> -</view> diff --git a/gentoobrowse/present/login.xml b/gentoobrowse/present/login.xml deleted file mode 100644 index 09a7e37..0000000 --- a/gentoobrowse/present/login.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<view name="login" root="gentoo" contenttype="text/xml-xslt" style="xslt/login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/webcommon.xml" /> - <project2:rawview> - <form caption="Login" submit="Login" action="/dologin" method="post"> - <input type="text" name="username" caption="User name" - xslvalue="/gentoo/project2:params/project2:param[@name='username']" /> - <input type="password" name="password" caption="Password" - xslvalue="/gentoo/project2:params/project2:param[@name='password']" /> - </form> - <para> - <p xmlns="http://www.w3.org/1999/xhtml"> - I don't have an account... so I'll <a href="/signup">signup...</a> - </p> - </para> - </project2:rawview> -</view> - diff --git a/gentoobrowse/present/package.xml b/gentoobrowse/present/package.xml deleted file mode 100644 index 4e266e4..0000000 --- a/gentoobrowse/present/package.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0"?> -<view name="package" root="gentoo" contenttype="text/xml-xslt" style="xslt/package.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/package.xml" /> - <xi:include href="../views/use.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="package" source="packages" recordname="package" filter="catAndName" required="true"> - <parameters> - <cat source="uri" index="1" /> - <pkg source="uri" index="2" /> - </parameters> - <project2:view name="tracked" source="tracks" rootname="tracks" recordname="track" filter="isPkgTrackedByUser"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - <userid source="session" name="loggedInUserID"><default value="0" type="int" /></userid> - </parameters> - </project2:view> - <project2:view name="uses" source="package-uses" rootname="uses" recordname="use" filter="byPackageID"> - <parameters> - <packageid source="parent" name="packageid" depth="1" /> - </parameters> - <project2:distinct name="usegroups"> - <value source="parent" name="usegroup" /> - </project2:distinct> - </project2:view> - <project2:view name="versions" source="versions" rootname="versions" recordname="version" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="urls" source="packageUrls" rootname="urls" recordname="url" isobject="false" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="uses" source="versionUses" rootname="versionUses" recordname="use" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="archs" source="versionArchs" rootname="versionArchs" recordname="arch" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="bugs" source="packageBugs" rootname="packageBugs" recordname="bug" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="deps" source="packageDeps" rootname="deps" recordname="package" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="rdeps" source="packageRdeps" rootname="rdeps" recordname="package" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="depees" source="packageDepees" rootname="depees" recordname="package" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="maskStatus" source="maskStatus" rootname="maskstatus" recordname="mask" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="maskDetails" source="maskDetails" rootname="maskdetails" recordname="mask" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - <project2:view name="changeLog" source="changeLog" rootname="changelog" recordname="entry" filter="pkg"> - <parameters> - <pkgid source="parent" name="packageid" depth="1" /> - </parameters> - </project2:view> - </project2:view> -</view> diff --git a/gentoobrowse/present/popular.xml b/gentoobrowse/present/popular.xml deleted file mode 100644 index 9fc59b2..0000000 --- a/gentoobrowse/present/popular.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<view name="popular" root="gentoo" contenttype="text/xml-xslt" style="xslt/popular.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/popular.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="popularPackages" source="popularPackages" rootname="packages" recordname="package"> - <project2:distinct name="categories"> - <value source="parent" depth="1" name="catname" /> - </project2:distinct> - </project2:view> -</view> diff --git a/gentoobrowse/present/search.xml b/gentoobrowse/present/search.xml deleted file mode 100644 index 3bcb9cb..0000000 --- a/gentoobrowse/present/search.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<view name="search" root="gentoo" contenttype="text/xml-xslt" style="xslt/search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/search.xml" /> - <xi:include href="../views/webcommon.xml" /> - - <project2:if name="haveCriteria"> - <project2:regextest name="criteriaLength" regex=".+"> - <apply-to source="param" name="criteria" default="" /> - </project2:regextest> - <project2:view name="searchResults" source="packageSearch" rootname="searchResults" recordname="package" filter="freeText"> - <parameters> - <criteria source="param" name="criteria" default="" /> - </parameters> - </project2:view> - <project2:view name="bugSearchResults" source="bugSearch" rootname="bugSearchResults" recordname="bug" filter="freeText"> - <parameters> - <criteria source="param" name="criteria" default="" /> - </parameters> - </project2:view> - </project2:if> -</view> diff --git a/gentoobrowse/present/signup.xml b/gentoobrowse/present/signup.xml deleted file mode 100644 index fcf3d8c..0000000 --- a/gentoobrowse/present/signup.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<view name="index" root="gentoo" contenttype="text/xml-xslt" style="xslt/login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/webcommon.xml" /> - <project2:rawview> - <form caption="Signup" submit="Signup" action="/dosignup" method="post"> - <input type="text" name="username" caption="User name" auto="off" /> - <input type="email" name="email" caption="Email address" auto="off" /> - <input type="text" name="realname" caption="Real name" auto="off" /> - <input type="password" name="password" caption="Password" auto="off" /> - </form> - </project2:rawview> -</view> - diff --git a/gentoobrowse/present/sitemap.xml.xml b/gentoobrowse/present/sitemap.xml.xml deleted file mode 100644 index 900fcc0..0000000 --- a/gentoobrowse/present/sitemap.xml.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0"?> -<view name="sitemap" root="gentoo" contenttype="text/xml-xslt" style="xslt/sitemap.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/categories.xml" /> - <xi:include href="../views/package.xml" /> - <project2:view name="categories" source="categories" rootname="categories" recordname="category" /> - <project2:view name="packages" source="sitemap-packages" rootname="packages" recordname="package" /> -</view> - diff --git a/gentoobrowse/present/use.xml b/gentoobrowse/present/use.xml deleted file mode 100644 index 760dc7c..0000000 --- a/gentoobrowse/present/use.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<view name="popular" root="gentoo" contenttype="text/xml-xslt" style="xslt/use.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/search.xml" /> - <xi:include href="../views/use.xml" /> - <xi:include href="../views/webcommon.xml" /> - <project2:view name="packagesLocalDef" source="use-local" rootname="local" recordname="use" filter="use"> - <parameters> - <use source="uri" index="1" /> - </parameters> - </project2:view> - <project2:view name="packagesGlobalDef" source="use-global" rootname="global" recordname="use" filter="use"> - <parameters> - <use source="uri" index="1" /> - </parameters> - </project2:view> - <project2:view name="packagesWithUse" source="packagesWithUse" rootname="packages" recordname="package" filter="byUse"> - <parameters> - <use source="uri" index="1" /> - </parameters> - <project2:distinct name="categories"> - <value source="parent" name="catname" /> - </project2:distinct> - </project2:view> -</view> - diff --git a/gentoobrowse/request/.htaccess b/gentoobrowse/request/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/request/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/request/doconfirm.xml b/gentoobrowse/request/doconfirm.xml deleted file mode 100644 index 2e73a08..0000000 --- a/gentoobrowse/request/doconfirm.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> -<view name="doconfirm" present="accountHome" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/user.xml" /> - <project2:check present="login" name="checkUserAuth" message="No such pending account"> - <project2:sqltest datasource="postgres-web" testOp="=" testValue="1"> - <sql> - SELECT COUNT(*) - FROM users - WHERE verifyguid = <param source="param" name="verifyguid" /> - </sql> - </project2:sqltest> - </project2:check> - <project2:iterate datasource="postgres-web" name="getUidFromDatabase" source="users" filter="verifyguid"> - <parameters> - <verifyguid source="param" name="verifyguid" /> - </parameters> - <tasks> - <project2:sessionset key="loggedInUserID" name="setUidInSession"> - <value source="parent" name="userid" depth="1" /> - </project2:sessionset> - </tasks> - </project2:iterate> - <project2:sqltask datasource="postgres-web"> - <sql>UPDATE users SET verifyguid = NULL WHERE verifyguid = <param source="param" name="verifyguid" /></sql> - </project2:sqltask> -</view> diff --git a/gentoobrowse/request/dologin.xml b/gentoobrowse/request/dologin.xml deleted file mode 100644 index 0bd5517..0000000 --- a/gentoobrowse/request/dologin.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<view name="dologin" redirect="/accountHome" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <xi:include href="../views/user.xml" /> - - <project2:check present="login" name="usernameEntered" message="User name required"> - <project2:regextest regex=".+"> - <apply-to source="param" name="username" /> - </project2:regextest> - </project2:check> - <project2:check present="login" name="passwordLength" message="Password too short"> - <project2:regextest regex=".{6,}"> - <apply-to source="param" name="password" /> - </project2:regextest> - </project2:check> - <project2:check present="login" name="checkUserAuth" message="Invalid username or password"> - <project2:sqltest datasource="postgres-web" testOp="=" testValue="1"> - <sql> - SELECT COUNT(*) - FROM users - WHERE username = <param source="param" name="username" /> - AND userpassword = <param source="param" name="password" /> - </sql> - </project2:sqltest> - </project2:check> - <project2:check present="confirm" name="checkConfirmed" message="Confirmation code required"> - <project2:sqltest datasource="postgres-web" testOp="=" testValue="1"> - <sql> - SELECT COUNT(*) - FROM users - WHERE username = <param source="param" name="username" /> - AND verifyguid IS NULL - </sql> - </project2:sqltest> - </project2:check> - - <project2:iterate datasource="postgres-web" name="getUidFromDatabase" source="users" filter="username"> - <parameters> - <username source="param" name="username" /> - </parameters> - <tasks> - <project2:sessionset key="loggedInUserID" name="setUidInSession"> - <value source="parent" name="userid" depth="1" /> - </project2:sessionset> - </tasks> - </project2:iterate> -</view> - diff --git a/gentoobrowse/request/dologout.xml b/gentoobrowse/request/dologout.xml deleted file mode 100644 index c83d4f8..0000000 --- a/gentoobrowse/request/dologout.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<view name="dologin" redirect="/" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sessionclear key="loggedInUserID" /> -</view> - diff --git a/gentoobrowse/request/dosignup.xml b/gentoobrowse/request/dosignup.xml deleted file mode 100644 index 5082fe0..0000000 --- a/gentoobrowse/request/dosignup.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<view name="dosignup" present="confirm" xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:check present="signup" name="usernameEntered" message="User name required"> - <project2:regextest regex=".+"> - <apply-to source="param" name="username" /> - </project2:regextest> - </project2:check> - <project2:check present="signup" name="passwordLength" message="Password too short"> - <project2:regextest regex=".{6,}"> - <apply-to source="param" name="password" /> - </project2:regextest> - </project2:check> - <project2:check present="signup" name="freeUsername" message="Username already used"> - <project2:sqltest datasource="postgres-web" testOp="=" testValue="0"> - <sql> - SELECT COUNT(*) - FROM users - WHERE username = <param source="param" name="username" /> - </sql> - </project2:sqltest> - </project2:check> - <project2:check present="signup" name="freeEmail" message="Email address already used"> - <project2:sqltest datasource="postgres-web" testOp="=" testValue="0"> - <sql> - SELECT COUNT(*) - FROM users - WHERE useremail = <param source="param" name="email" /> - </sql> - </project2:sqltest> - </project2:check> - - <project2:sqltask datasource="postgres-web" name="insertUser"> - <sql>INSERT INTO users(username, userrealname, userpassword, useremail, verifyguid) - VALUES(<param source="param" name="username" />, <param source="param" name="realname" />, - <param source="param" name="password" />, <param source="param" name="email" />, uuid_generate_v4())</sql> - </project2:sqltask> - <project2:sendmail server="smtp.random.lan:25" subject="Welcome to Gentoo Browse" name="sendWelcome" - present="welcome" from=""Gentoo Browse" <noreply@gentoobrowse.randomdan.homeip.net>"> - <to source="param" name="email" /> - </project2:sendmail> -</view> - diff --git a/gentoobrowse/request/track.xml b/gentoobrowse/request/track.xml deleted file mode 100644 index 5bd9ae4..0000000 --- a/gentoobrowse/request/track.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<request name="track" xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:check present="ok" name="checkNotTracked" message="Package already tracked"> - <project2:sqltest datasource="postgres-web" testOp="=" testValue="0"> - <sql> - SELECT COUNT(*) - FROM user_packages - WHERE packageid = <param source="param" name="packageid" /> - AND userid = <param source="session" name="loggedInUserID" /> - </sql> - </project2:sqltest> - </project2:check> - - <project2:sqltask datasource="postgres-web" name="addTrack"> - <sql>INSERT INTO user_packages(packageid, userid, trackedsince) VALUES( - <param source="param" name="packageid" />, <param source="session" name="loggedInUserID" />, NOW())</sql> - </project2:sqltask> -</request> - diff --git a/gentoobrowse/request/untrack.xml b/gentoobrowse/request/untrack.xml deleted file mode 100644 index 69acd33..0000000 --- a/gentoobrowse/request/untrack.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<request name="track" xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqltask datasource="postgres-web" name="addTrack"> - <sql> - DELETE FROM user_packages - WHERE packageid = <param source="param" name="packageid" /> - AND userid = <param source="session" name="loggedInUserID" /> - </sql> - </project2:sqltask> -</request> - diff --git a/gentoobrowse/robots.txt b/gentoobrowse/robots.txt index bc11640..c2a49f4 100644 --- a/gentoobrowse/robots.txt +++ b/gentoobrowse/robots.txt @@ -1,3 +1,2 @@ -User-agent: *
-Allow: /
-
+User-agent: * +Allow: / diff --git a/gentoobrowse/src/Jamfile.jam b/gentoobrowse/src/Jamfile.jam new file mode 100644 index 0000000..96b77e5 --- /dev/null +++ b/gentoobrowse/src/Jamfile.jam @@ -0,0 +1,59 @@ +import icespider ; + +lib icespider-common ; +lib icespider-xslt : : : : <library>../..//libxmlpp ; +lib icespider-fcgi ; +lib icespider-filesessions ; +lib adhocutil ; +lib Ice ; +lib IceUtil ; +lib pthread ; +lib boost_system ; +lib slicer ; +lib slicer-json ; +lib slicer-xml ; +lib slicer-db ; +lib gentoobrowse-domain ; +lib gentoobrowse : : + <name>gentoobrowse-api + : : + <include>/usr/share/gentoobrowse-api + <include>/usr/share/slicer/ice + <include>/usr/include/gentoobrowse-api + <include>/usr/include/slicer/db + <include>/usr/include/slicer/slicer + <library>gentoobrowse-domain + <library>slicer-db + ; +lib icespider : : + <name>icespider-core + : : + <include>/usr/include/icespider + <include>/usr/include/slicer + <include>/usr/include/adhocutil + <include>/usr/share/icespider/ice + <library>icespider-common + <library>icespider-xslt + <library>icespider-fcgi + <library>icespider-filesessions + <library>adhocutil + <library>Ice + <library>IceUtil + <library>pthread + <library>slicer + <library>boost_system + <allow-ice>yes + ; + +exe gentoobrowse-cgi : + [ glob *.cpp *.ice *.json ] + : + <variant>release:<cxxflags>-flto=3 + <variant>release:<linkflags>-flto=3 + <slicer>yes + <include>. + <library>icespider + <library>gentoobrowse + <library>slicer-json + <library>slicer-xml + ; diff --git a/gentoobrowse/src/base.cpp b/gentoobrowse/src/base.cpp new file mode 100644 index 0000000..9656a1f --- /dev/null +++ b/gentoobrowse/src/base.cpp @@ -0,0 +1,67 @@ +#ifndef GENTOOBROWSE_BASE_H +#define GENTOOBROWSE_BASE_H + +#include <icespider-routes-base.h> +#include <mash.h> +#include <algorithm> + +namespace GentooBrowse { + ::Gentoo::UserPtr + common::currentUser(const IceSpider::IHttpRequest * request) const + { + if (auto sid = request->getCookieParam("sessionId")) { + if (auto s = prx0->getSession(*sid)) { + auto uid = s->variables.find("userId"); + if (uid != s->variables.end()) { + return prx1->get(boost::lexical_cast<Ice::Int>(uid->second)); + } + } + } + return nullptr; + } + + void + common::addUser(const IceSpider::IHttpRequest * request, const PageBasePtr & model) const + { + model->user = currentUser(request); + } + + void + common::trimCategories(Gentoo::Categories & categories, const Gentoo::Packages & packages) const + { + std::set<Ice::Int> ids; + std::transform(packages.begin(), packages.end(), std::inserter(ids, ids.begin()), [](auto p) { + return p->categoryid; + }); + categories.erase(std::remove_if(categories.begin(), categories.end(), [&ids](auto category) { + return ids.find(category->categoryid) == ids.end(); + }), categories.end()); + } + + void + common::trimCategories(Gentoo::Categories & categories, const Gentoo::SearchResultPackages & packages) const + { + std::set<Ice::Int> ids; + std::transform(packages.begin(), packages.end(), std::inserter(ids, ids.begin()), [](auto p) { + return p->categoryid; + }); + categories.erase(std::remove_if(categories.begin(), categories.end(), [&ids](auto category) { + return ids.find(category->categoryid) == ids.end(); + }), categories.end()); + } + + void + common::trimPackages(Gentoo::Packages & packages, const Gentoo::Ebuilds & ebuilds) const + { + std::set<Ice::Int> ids; + std::transform(ebuilds.begin(), ebuilds.end(), std::inserter(ids, ids.begin()), [](auto e) { + return e->packageid; + }); + packages.erase(std::remove_if(packages.begin(), packages.end(), [&ids](auto package) { + return ids.find(package->packageid) == ids.end(); + }), packages.end()); + } +} + +#endif + diff --git a/gentoobrowse/src/base.json b/gentoobrowse/src/base.json new file mode 100644 index 0000000..c1164ee --- /dev/null +++ b/gentoobrowse/src/base.json @@ -0,0 +1,21 @@ +{ + "name": "GentooBrowse", + "routeBases": { + "common": { + "proxies": [ "IceSpider.SessionManager", "Gentoo.Users" ], + "functions": [ + "::Gentoo::UserPtr currentUser(const IceSpider::IHttpRequest *) const", + "void trimCategories(Gentoo::Categories &, const Gentoo::Packages &) const", + "void trimCategories(Gentoo::Categories &, const Gentoo::SearchResultPackages &) const", + "void trimPackages(Gentoo::Packages &, const Gentoo::Ebuilds &) const", + "template<typename T> void trimCategories(const IceSpider::IHttpRequest *, const IceInternal::Handle<T> & p) const { trimCategories(p->categories, p->packages); }", + "void addUser(const IceSpider::IHttpRequest *, const PageBasePtr &) const" + ] + } + }, + "slices": [ + "mash.ice", + "session.ice", + "users.ice" + ] +} diff --git a/gentoobrowse/src/mash.ice b/gentoobrowse/src/mash.ice new file mode 100644 index 0000000..98d4cc1 --- /dev/null +++ b/gentoobrowse/src/mash.ice @@ -0,0 +1,107 @@ +#include <portage.ice> +#include <users.ice> +#include <pagebase.ice> + +module GentooBrowse { + module Wrappers { + struct PK { + ["slicer:xml:attribute"] + bool tracked; + ["slicer:xml:text"] + string name; + }; + + struct Package { + Gentoo::Package detail; + Gentoo::Ebuilds ebuilds; + }; + + ["slicer:key:id","slicer:value:package","slicer:item:package"] + dictionary<PK, Package> Packages; + + ["slicer:key:id","slicer:value:packages","slicer:item:category"] + dictionary<PK, Packages> Categories; + + ["slicer:key:timestamp","slicer:value:categories","slicer:item:sync"] + dictionary<string, Categories> Syncs; + + struct SiteMapCategory { + ["slicer:name:detail"] + Gentoo::OverviewCategory category; + Gentoo::Packages packages; + }; + + ["slicer:element:category"] + sequence<SiteMapCategory> SiteMapCategories; + }; + + ["slicer:root:gentoo"] + class Index extends PageBase { + Wrappers::Syncs syncs; + }; + + ["slicer:root:gentoo"] + class Browse extends PageBase { + Gentoo::OverviewCategoriesBySuper categories; + }; + + ["slicer:root:gentoo"] + class Popular extends PageBase { + Gentoo::Categories categories; + Gentoo::Packages packages; + }; + + ["slicer:root:gentoo"] + class UserTracked extends Popular { + Gentoo::Ebuilds versions; + }; + + ["slicer:root:gentoo"] + class Sitemap extends PageBase { + Wrappers::SiteMapCategories categories; + }; + + ["slicer:root:gentoo"] + class Search extends PageBase { + Gentoo::Categories categories; + Gentoo::SearchResultPackages packages; + Gentoo::SearchResultBugs bugs; + Gentoo::News news; + Gentoo::Uses uses; + string query; + }; + + ["slicer:root:gentoo"] + class Category extends PageBase { + Gentoo::Category category; + Gentoo::Packages packages; + }; + + ["slicer:root:gentoo"] + class Package extends PageBase { + Gentoo::Categories categories; + Gentoo::Package package; + Gentoo::ChangeLog changelog; + Gentoo::EbuildDetails ebuilds; + Gentoo::PackageDependencyPackages dependencies; + Gentoo::PackageDependencyPackages rdependencies; + Gentoo::PackageDependencyPackages depending; + Gentoo::PackageMasks masks; + Gentoo::Uses uses; + Gentoo::Bugs bugs; + Gentoo::Repositories repos; + bool tracked = false; + }; + + ["slicer:root:gentoo"] + class Use extends PageBase { + Gentoo::Categories categories; + Gentoo::Uses usage; + Gentoo::Packages packages; + }; + + ["slicer:root:gentoo"] + class UseIndex extends PageBase { + Gentoo::Uses uses; + }; +}; diff --git a/gentoobrowse/src/news.ice b/gentoobrowse/src/news.ice new file mode 100644 index 0000000..18af2a9 --- /dev/null +++ b/gentoobrowse/src/news.ice @@ -0,0 +1,14 @@ +#include <portage.ice> +#include <pagebase.ice> + +module GentooBrowse { + class NewsRecent extends PageBase { + ["slicer:root:gentoo"] + Gentoo::News articles; + }; + class NewsArticle extends PageBase { + ["slicer:root:gentoo"] + Gentoo::NewsItem article; + }; +}; + diff --git a/gentoobrowse/src/news.json b/gentoobrowse/src/news.json new file mode 100644 index 0000000..ce05e2a --- /dev/null +++ b/gentoobrowse/src/news.json @@ -0,0 +1,52 @@ +{ + "name": "GentooBrowse", + "headers": [ "xsltStreamSerializer.h", "icespider-routes-base.h" ], + "routes": { + "news": { + "path": "/news", + "bases": [ "common" ], + "mutators": [ "addUser" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/news.xslt\"" ] + }, + "application/atom+xml": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/news-atom.xslt\"" ] + } + }, + "operations": { + "articles": { + "operation": "Gentoo.Portage.getNewsRecent" + } + }, + "type": "GentooBrowse.NewsRecent", + "params": { + "items": { + "default": "10" + } + } + }, + "newsitem": { + "path": "/news/{newsid}", + "bases": [ "common" ], + "mutators": [ "addUser" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/newsitem.xslt\"" ] + } + }, + "operations": { + "article": { + "operation": "Gentoo.Portage.getNewsItem" + } + }, + "type": "GentooBrowse.NewsArticle" + } + }, + "slices": [ + "news.ice" + ] +} diff --git a/gentoobrowse/src/packages.cpp b/gentoobrowse/src/packages.cpp new file mode 100644 index 0000000..f652900 --- /dev/null +++ b/gentoobrowse/src/packages.cpp @@ -0,0 +1,323 @@ +// Standard headers. +#include <irouteHandler.h> +#include <core.h> +#include <util.h> +#include <slicer/serializer.h> + +// Interface headers. +#include <mash.h> +#include <portage.h> + +// Extra headers. +#include <xsltStreamSerializer.h> +#include <icespider-routes-base.h> +#include <safeMapFind.h> + +namespace GentooBrowse { + template<typename I, typename T> std::map<I, T> makeMap(const std::vector<T> & items, const boost::function<I(const T &)> & id) + { + std::map<I, T> rtn; + for (const auto & item : items) { + rtn.insert({ id(item), item }); + } + return rtn; + } + + // Implementation classes. + + // Route name: index + // path: / + class index : public IceSpider::IRouteHandler, + public common { + public: + index(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/"), + common(core), + prx0(core->getProxy<Gentoo::Portage>()), + prx1(core->getProxy<Gentoo::Users>()), + _pd_syncs(3) + { + addRouteSerializer({ "application", "atom+xml" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/home-atom.xslt")); + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/home.xslt")); + } + + ~index() + { + removeRouteSerializer({ "application", "atom+xml" }); + removeRouteSerializer({ "text", "html" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + ::GentooBrowse::IndexPtr _responseModel = new ::GentooBrowse::Index(); + auto _ar_categories = prx0->begin_getCategoriesWithRecentAdditions(_pd_syncs, request->getContext()); + auto _ar_ebuilds = prx0->begin_getRecentAdditions(_pd_syncs, request->getContext()); + auto _ar_packages = prx0->begin_getPackagesWithRecentAdditions(_pd_syncs, request->getContext()); + addUser(request, _responseModel); + Ice::AsyncResultPtr _ar_t; + if (_responseModel->user) { + _ar_t = prx1->begin_tracked(_responseModel->user->userid); + } + auto ebuilds = prx0->end_getRecentAdditions(_ar_ebuilds); + auto packages = GentooBrowse::makeMap<Ice::Int, Gentoo::PackagePtr>(prx0->end_getPackagesWithRecentAdditions(_ar_packages), [](auto p){ return p->packageid; }); + auto categories = GentooBrowse::makeMap<Ice::Int, Gentoo::CategoryPtr>(prx0->end_getCategoriesWithRecentAdditions(_ar_categories), [](auto c){ return c->categoryid; }); + decltype(prx1->end_tracked(_ar_t)) tracked; + if (_ar_t) { + tracked = prx1->end_tracked(_ar_t); + } + for(const auto & ebuild : ebuilds) { + auto & p = packages[ebuild->packageid]; + auto & c = categories[p->categoryid]; + auto & s = _responseModel->syncs[ebuild->moddate.substr(0, 10)]; + bool isTracked = std::find(tracked.begin(), tracked.end(), p->packageid) != tracked.end(); + auto & pw = s[{ isTracked, c->name }][{ isTracked, p->name }]; + if (!pw.detail) pw.detail = p; + pw.ebuilds.push_back(ebuild); + } + request->response(this, _responseModel); + } + + private: + const Gentoo::PortagePrx prx0; + const Gentoo::UsersPrx prx1; + const ::Ice::Int _pd_syncs; + }; + + // Route name: category + // path: /packages/{category} + class category : public IceSpider::IRouteHandler, + public common { + public: + category(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/packages/{category}"), + common(core), + prx0(core->getProxy<Gentoo::Portage>()), + _pi_category(1) + { + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/category.xslt")); + } + + ~category() + { + removeRouteSerializer({ "text", "html" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _p_category(request->getURLParam<::std::string>(_pi_category)); + auto cat = prx0->findCategory(_p_category, request->getContext()); + auto _ar_pkgs = prx0->begin_getPackagesInCategory(cat->categoryid, request->getContext()); + ::GentooBrowse::CategoryPtr model = new ::GentooBrowse::Category(); + model->category = cat; + model->packages = prx0->end_getPackagesInCategory(_ar_pkgs); + addUser(request, model); + request->response(this, model); + } + + private: + const Gentoo::PortagePrx prx0; + const ::Ice::Int _pi_category; + }; + + // Route name: package + // path: /packages/{category}/{package} + class package : public IceSpider::IRouteHandler, + public common { + public: + package(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/packages/{category}/{package}"), + common(core), + prx0(core->getProxy<Gentoo::Portage>()), + prx1(core->getProxy<Gentoo::Users>()), + _pi_category(1), + _pi_package(2) + { + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/package.xslt")); + } + + ~package() + { + removeRouteSerializer({ "text", "html" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _p_category(request->getURLParam<::std::string>(_pi_category)); + auto _p_package(request->getURLParam<::std::string>(_pi_package)); + auto _ar_p = prx0->begin_findPackage(_p_category, _p_package, request->getContext()); + auto _ar_r = prx0->begin_getRepositories(request->getContext()); + auto _ar_cats = prx0->begin_getAllCategories(request->getContext()); + ::GentooBrowse::PackagePtr model = new ::GentooBrowse::Package(); + model->package = prx0->end_findPackage(_ar_p); + Ice::AsyncResultPtr _ar_t; + auto _ar_cl = prx0->begin_getPackageChangeLog(model->package->packageid, request->getContext()); + auto _ar_ebuilds = prx0->begin_getPackageVersionDetails(model->package->packageid, request->getContext()); + auto _ar_bugs = prx0->begin_getPackageBugs(model->package->packageid, request->getContext()); + auto _ar_d = prx0->begin_getPackageDependencies(model->package->packageid, request->getContext()); + auto _ar_rd = prx0->begin_getPackageRuntimeDependencies(model->package->packageid, request->getContext()); + auto _ar_dp = prx0->begin_getPackagesDepending(model->package->packageid, request->getContext()); + auto _ar_m = prx0->begin_getPackageMasks(model->package->packageid, request->getContext()); + auto _ar_u = prx0->begin_getPackageUses(model->package->packageid, request->getContext()); + addUser(request, model); + if (model->user) { + _ar_t = prx1->begin_tracked(model->user->userid); + } + model->categories = prx0->end_getAllCategories(_ar_cats); + model->changelog = prx0->end_getPackageChangeLog(_ar_cl); + model->ebuilds = prx0->end_getPackageVersionDetails(_ar_ebuilds); + model->bugs = prx0->end_getPackageBugs(_ar_bugs); + model->dependencies = prx0->end_getPackageDependencies(_ar_d); + model->rdependencies = prx0->end_getPackageRuntimeDependencies(_ar_rd); + model->depending = prx0->end_getPackagesDepending(_ar_dp); + model->masks = prx0->end_getPackageMasks(_ar_m); + model->uses = prx0->end_getPackageUses(_ar_u); + model->repos = prx0->end_getRepositories(_ar_r); + std::set<Ice::Int> ids({ model->package->categoryid }); + collateCategoryIds(ids, model->dependencies); + collateCategoryIds(ids, model->depending); + collateCategoryIds(ids, model->rdependencies); + model->categories.erase(std::remove_if(model->categories.begin(), model->categories.end(), [&ids](auto category) { + return ids.find(category->categoryid) == ids.end(); + }), model->categories.end()); + if (_ar_t) { + model->tracked = AdHoc::containerContains(prx1->end_tracked(_ar_t), model->package->packageid); + } + request->response(this, model); + } + + private: + template<typename T> + static void collateCategoryIds(std::set<Ice::Int> & ids, const std::vector<T> & packages) + { + std::transform(packages.begin(), packages.end(), std::inserter(ids, ids.begin()), [](auto p) { + return p->categoryid; + }); + } + const Gentoo::PortagePrx prx0; + const Gentoo::UsersPrx prx1; + const ::Ice::Int _pi_category; + const ::Ice::Int _pi_package; + }; + + + // Route name: track package + // path: /packages/{category}/{package}/tracked + class packageTrack : public IceSpider::IRouteHandler, + public common { + public: + packageTrack(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::PUT, "/packages/{category}/{package}/tracked"), + common(core), + prx0(core->getProxy<Gentoo::Portage>()), + prx1(core->getProxy<Gentoo::Users>()), + _pi_category(1), + _pi_package(2) + { + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _p_category(request->getURLParam<::std::string>(_pi_category)); + auto _p_package(request->getURLParam<::std::string>(_pi_package)); + auto p = prx0->findPackage(_p_category, _p_package, request->getContext()); + auto u = this->currentUser(request); + prx1->track(u->userid, p->packageid); + request->response(204, "Tracked"); + } + + private: + const Gentoo::PortagePrx prx0; + const Gentoo::UsersPrx prx1; + const ::Ice::Int _pi_category; + const ::Ice::Int _pi_package; + }; + + + // Route name: untrack package + // path: /packages/{category}/{package}/tracked + class packageUntrack : public IceSpider::IRouteHandler, + public common { + public: + packageUntrack(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::DELETE, "/packages/{category}/{package}/tracked"), + common(core), + prx0(core->getProxy<Gentoo::Portage>()), + prx1(core->getProxy<Gentoo::Users>()), + _pi_category(1), + _pi_package(2) + { + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _p_category(request->getURLParam<::std::string>(_pi_category)); + auto _p_package(request->getURLParam<::std::string>(_pi_package)); + auto p = prx0->findPackage(_p_category, _p_package, request->getContext()); + auto u = this->currentUser(request); + prx1->untrack(u->userid, p->packageid); + request->response(204, "Untracked"); + } + + private: + const Gentoo::PortagePrx prx0; + const Gentoo::UsersPrx prx1; + const ::Ice::Int _pi_category; + const ::Ice::Int _pi_package; + }; + + + // Route name: userAtom + // path: /atom/{username} + class userAtom : public IceSpider::IRouteHandler, + public common { + public: + userAtom(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/atom/{username}"), + common(core), + prx0(core->getProxy<Gentoo::Portage>()), + prx1(core->getProxy<Gentoo::Users>()), + _pi_username(1) + { + addRouteSerializer({ "application", "atom+xml" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/user-atom.xslt")); + removeRouteSerializer({ "application", "xml" }); + removeRouteSerializer({ "application", "json" }); + } + + ~userAtom() + { + removeRouteSerializer({ "application", "atom+xml" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _p_username(request->getURLParam<::std::string>(_pi_username)); + auto user = prx1->find(_p_username); + auto _ar_cs = prx0->begin_getAllCategories(request->getContext()); + auto _ar_ps = prx0->begin_getUserTrackedPackages(user->userid, request->getContext()); + auto _ar_vs = prx0->begin_getUserTrackedRecentVersions(user->userid, 50, request->getContext()); + GentooBrowse::UserTrackedPtr ut = new GentooBrowse::UserTracked(); + ut->categories = prx0->end_getAllCategories(_ar_cs); + ut->packages = prx0->end_getUserTrackedPackages(_ar_ps); + ut->versions = prx0->end_getUserTrackedRecentVersions(_ar_vs); + common::trimPackages(ut->packages, ut->versions); + common::trimCategories(ut->categories, ut->packages); + request->response(this, ut); + } + + private: + const Gentoo::PortagePrx prx0; + const Gentoo::UsersPrx prx1; + const ::Ice::Int _pi_username; + }; + + +} // namespace gentoobrowse + +// Register route handlers. +FACTORY(GentooBrowse::index, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::category, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::package, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::packageTrack, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::packageUntrack, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::userAtom, IceSpider::RouteHandlerFactory); + diff --git a/gentoobrowse/src/packages.json b/gentoobrowse/src/packages.json new file mode 100644 index 0000000..aa65b0b --- /dev/null +++ b/gentoobrowse/src/packages.json @@ -0,0 +1,52 @@ +{ + "name": "GentooBrowse", + "headers": [ "xsltStreamSerializer.h", "icespider-routes-base.h" ], + "routes": { + "browse": { + "path": "/packages", + "bases": [ "common" ], + "mutators": [ "addUser" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/categories.xslt\"" ] + } + }, + "operations": { + "categories": { + "operation": "Gentoo.Portage.getAllOverviewCategories" + } + }, + "type": "GentooBrowse.Browse" + }, + "popular": { + "path": "/packages/popular", + "bases": [ "common" ], + "mutators": [ "addUser", "trimCategories" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/popular.xslt\"" ] + } + }, + "operations": { + "categories": { + "operation": "Gentoo.Portage.getAllCategories" + }, + "packages": { + "operation": "Gentoo.Portage.getTopTrackedPackages" + } + }, + "type": "GentooBrowse.Popular", + "params": { + "n": { + "default": "50" + } + } + } + }, + "slices": [ + "mash.ice", + "portage.ice" + ] +} diff --git a/gentoobrowse/src/pagebase.ice b/gentoobrowse/src/pagebase.ice new file mode 100644 index 0000000..7fbb953 --- /dev/null +++ b/gentoobrowse/src/pagebase.ice @@ -0,0 +1,26 @@ +#ifndef GENTOOBRWOSE_PAGEBASE_ICE +#define GENTOOBRWOSE_PAGEBASE_ICE + +#include <user-models.ice> + +module GentooBrowse { + const string USERID = "userId"; + const string SESSIONID = "sessionId"; + + class PageBase { + Gentoo::User user; + }; + + class Credentials { + string username; + string password; + }; + + class SignUp extends Credentials { + string realname; + string email; + }; +}; + +#endif + diff --git a/gentoobrowse/src/search.cpp b/gentoobrowse/src/search.cpp new file mode 100644 index 0000000..c435df1 --- /dev/null +++ b/gentoobrowse/src/search.cpp @@ -0,0 +1,67 @@ +// Standard headers. +#include <irouteHandler.h> +#include <core.h> +#include <util.h> +#include <slicer/serializer.h> + +// Interface headers. +#include <mash.h> +#include <portage.h> + +// Extra headers. +#include <xsltStreamSerializer.h> +#include <icespider-routes-base.h> +#include <safeMapFind.h> + +namespace GentooBrowse { + // Base classes. + +} // namespace GentooBrowse + + +namespace GentooBrowse { + // Route name: sitemap + // path: /sitemap.xml + class sitemap : public IceSpider::IRouteHandler { + public: + sitemap(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/sitemap.xml"), + prx0(core->getProxy<Gentoo::Portage>()) + { + addRouteSerializer({ "application", "xml" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/sitemap.xslt")); + } + + ~sitemap() + { + removeRouteSerializer({ "application", "xml" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _ar_categories = prx0->begin_getAllOverviewCategories(request->getContext()); + auto _ar_packages = prx0->begin_getAllPackages(request->getContext()); + ::GentooBrowse::SitemapPtr _responseModel = new ::GentooBrowse::Sitemap(); + auto categories = prx0->end_getAllOverviewCategories(_ar_categories); + auto packages = prx0->end_getAllPackages(_ar_packages); + for (const auto & super : categories) { + std::transform(super.second.begin(), super.second.end(), + std::inserter(_responseModel->categories, _responseModel->categories.begin()), [&packages](auto c) { + Gentoo::Packages ps; + std::copy_if(packages.begin(), packages.end(), std::inserter(ps, ps.begin()), [&c](auto p) { + return p->categoryid == c->categoryid; + }); + return GentooBrowse::Wrappers::SiteMapCategory({ c, ps }); + }); + } + request->response(this, _responseModel); + } + + private: + const Gentoo::PortagePrx prx0; + }; + +} // namespace GentooBrowse + +// Register route handlers. +FACTORY(GentooBrowse::sitemap, IceSpider::RouteHandlerFactory); + diff --git a/gentoobrowse/src/search.json b/gentoobrowse/src/search.json new file mode 100644 index 0000000..aea47c3 --- /dev/null +++ b/gentoobrowse/src/search.json @@ -0,0 +1,45 @@ +{ + "name": "GentooBrowse", + "headers": [ "xsltStreamSerializer.h", "icespider-routes-base.h" ], + "routes": { + "search": { + "path": "/search", + "bases": [ "common" ], + "mutators": [ "addUser", "trimCategories" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/search.xslt\"" ] + } + }, + "operations": { + "categories": { + "operation": "Gentoo.Portage.getAllCategories" + }, + "packages": { + "operation": "Gentoo.Portage.getPackagesSearch" + }, + "bugs": { + "operation": "Gentoo.Portage.getBugsSearch" + }, + "uses": { + "operation": "Gentoo.Portage.getUsesSearch" + }, + "news": { + "operation": "Gentoo.Portage.getNewsSearch" + } + }, + "type": "GentooBrowse.Search", + "params": { + "query": { + "source": "QueryString", + "key": "criteria" + } + } + } + }, + "slices": [ + "mash.ice", + "portage.ice" + ] +} diff --git a/gentoobrowse/src/use.json b/gentoobrowse/src/use.json new file mode 100644 index 0000000..63a9161 --- /dev/null +++ b/gentoobrowse/src/use.json @@ -0,0 +1,50 @@ +{ + "name": "GentooBrowse", + "headers": [ "xsltStreamSerializer.h", "icespider-routes-base.h" ], + "routes": { + "useIndex": { + "path": "/use", + "bases": [ "common" ], + "mutators": [ "addUser" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/use.xslt\"" ] + } + }, + "operations": { + "uses": { + "operation": "Gentoo.Portage.getGlobalUses" + } + }, + "type": "GentooBrowse.UseIndex" + }, + "useDetail": { + "path": "/use/{flag}", + "bases": [ "common" ], + "mutators": [ "addUser", "trimCategories" ], + "outputSerializers": { + "text/html": { + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/use-detail.xslt\"" ] + } + }, + "operations": { + "categories": { + "operation": "Gentoo.Portage.getAllCategories" + }, + "packages": { + "operation": "Gentoo.Portage.getUsePackages" + }, + "usage": { + "operation": "Gentoo.Portage.getUseUsage" + } + }, + "type": "GentooBrowse.Use" + } + }, + "slices": [ + "mash.ice", + "portage.ice" + ] +} diff --git a/gentoobrowse/src/user.cpp b/gentoobrowse/src/user.cpp new file mode 100644 index 0000000..1bd5b88 --- /dev/null +++ b/gentoobrowse/src/user.cpp @@ -0,0 +1,236 @@ +// Standard headers. +#include <irouteHandler.h> +#include <core.h> +#include <slicer/serializer.h> + +// Interface headers. +#include <mash.h> +#include <users.h> +#include <session.h> + +// Extra headers. +#include <xsltStreamSerializer.h> +#include <icespider-routes-base.h> + +namespace GentooBrowse { + // Implementation classes. + + // Route name: login + // path: /user/login + class login : public IceSpider::IRouteHandler { + public: + login(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::POST, "/user/login"), + prx0(core->getProxy<IceSpider::SessionManager>()), + prx1(core->getProxy<Gentoo::Users>()) + { + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto credentials = *request->getBody<GentooBrowse::CredentialsPtr>(); + auto user = prx1->authenticate(credentials->username, credentials->password); + auto s = prx0->createSession(); + s->variables[USERID] = boost::lexical_cast<std::string>(user->userid); + prx0->updateSession(s); + request->setCookie(SESSIONID, s->id, IceUtil::None, "/"); + request->responseRedirect("/user/home", "Authenticated"); + } + + private: + const IceSpider::SessionManagerPrx prx0; + const Gentoo::UsersPrx prx1; + }; + + // Route name: signup + // path: /user/signup + class signup : public IceSpider::IRouteHandler { + public: + signup(const IceSpider::Core *) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/signup") + { + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/user-signup.xslt")); + } + + void execute(IceSpider::IHttpRequest * request) const + { + PageBasePtr p = new PageBase(); + request->response(this, p); + } + }; + + // Route name: signup post + // path: /user/signup + class signupPost : public IceSpider::IRouteHandler { + public: + signupPost(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::POST, "/user/signup"), + prx1(core->getProxy<Gentoo::Users>()) + { + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto signup = *request->getBody<GentooBrowse::SignUpPtr>(); + auto user = prx1->create(signup->username, signup->password, signup->realname, signup->email); + request->responseRedirect("/user/verification", "Pending verification"); + } + + private: + const Gentoo::UsersPrx prx1; + }; + + // Route name: verification + // path: /user/verification + class verification : public IceSpider::IRouteHandler { + public: + verification(const IceSpider::Core *) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/verification") + { + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/user-verification.xslt")); + } + + void execute(IceSpider::IHttpRequest * request) const + { + PageBasePtr p = new PageBase(); + request->response(this, p); + } + }; + + // Route name: verification post + // path: /user/verification + class verificationPost : public IceSpider::IRouteHandler { + public: + verificationPost(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::POST, "/user/verification"), + prx0(core->getProxy<IceSpider::SessionManager>()), + prx1(core->getProxy<Gentoo::Users>()), + _pn_username("username"), + _pn_guid("guid") + { + } + + void execute(IceSpider::IHttpRequest * request) const + { + auto _pbody(request->getBody<IceSpider::StringMap>()); + auto _p_username(request->getBodyParam<::std::string>(_pbody, _pn_username) / + [this]() { return requiredParameterNotFound<::std::string>("Body", _pn_username); }); + auto _p_guid(request->getBodyParam<::std::string>(_pbody, _pn_guid) / + [this]() { return requiredParameterNotFound<::std::string>("Body", _pn_guid); }); + auto user = prx1->verify(_p_username, _p_guid, request->getContext()); + auto s = prx0->createSession(); + s->variables[USERID] = boost::lexical_cast<std::string>(user->userid); + prx0->updateSession(s); + request->setCookie(SESSIONID, s->id, IceUtil::None, "/"); + request->responseRedirect("/user/home", "Verified, welcome!"); + } + + private: + const IceSpider::SessionManagerPrx prx0; + const Gentoo::UsersPrx prx1; + const std::string _pn_username; + const std::string _pn_guid; + }; + + // Route name: home + // path: /user/home + class home : public IceSpider::IRouteHandler, + public common { + public: + home(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/home"), + common(core), + prx0(core->getProxy<IceSpider::SessionManager>()), + prx1(core->getProxy<Gentoo::Users>()) + { + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/user-home.xslt")); + } + + ~home() + { + removeRouteSerializer({ "text", "html" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + PageBasePtr p = new PageBase(); + addUser(request, p); + request->response(this, p); + } + + private: + const IceSpider::SessionManagerPrx prx0; + const Gentoo::UsersPrx prx1; + }; + + // Route name: tracked + // path: /user/tracked + class tracked : public IceSpider::IRouteHandler, + public common { + public: + tracked(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/tracked"), + common(core), + prx0(core->getProxy<IceSpider::SessionManager>()), + prx1(core->getProxy<Gentoo::Users>()), + prx2(core->getProxy<Gentoo::Portage>()) + { + addRouteSerializer({ "text", "html" }, new IceSpider::XsltStreamSerializer::IceSpiderFactory("xslt/user-tracked.xslt")); + } + + ~tracked() + { + removeRouteSerializer({ "text", "html" }); + } + + void execute(IceSpider::IHttpRequest * request) const + { + PopularPtr u = new Popular(); + auto _ar_c = prx2->begin_getAllCategories(request->getContext()); + addUser(request, u); + auto _ar_p = prx2->begin_getUserTrackedPackages(u->user->userid, request->getContext()); + u->categories = prx2->end_getAllCategories(_ar_c); + u->packages = prx2->end_getUserTrackedPackages(_ar_p); + request->response(this, u); + } + + private: + const IceSpider::SessionManagerPrx prx0; + const Gentoo::UsersPrx prx1; + const Gentoo::PortagePrx prx2; + }; + + // Route name: logout + // path: /user/logout + class logout : public IceSpider::IRouteHandler { + public: + logout(const IceSpider::Core * core) : + IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/logout"), + prx0(core->getProxy<IceSpider::SessionManager>()) + { + } + + void execute(IceSpider::IHttpRequest * request) const + { + prx0->destroySession(*request->getCookieParam<std::string>(SESSIONID)); + request->setCookie(SESSIONID, std::string(), IceUtil::None, "/", false, 0); + request->responseRedirect("/", "Logged out"); + } + + private: + const IceSpider::SessionManagerPrx prx0; + }; + + +} // namespace gentoobrowse + +// Register route handlers. +FACTORY(GentooBrowse::login, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::home, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::tracked, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::logout, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::signup, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::signupPost, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::verification, IceSpider::RouteHandlerFactory); +FACTORY(GentooBrowse::verificationPost, IceSpider::RouteHandlerFactory); + diff --git a/gentoobrowse/tasks/.htaccess b/gentoobrowse/tasks/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/tasks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/views/.htaccess b/gentoobrowse/views/.htaccess deleted file mode 100644 index e13f618..0000000 --- a/gentoobrowse/views/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Order allow,deny diff --git a/gentoobrowse/views/categories.xml b/gentoobrowse/views/categories.xml deleted file mode 100644 index c6fb59e..0000000 --- a/gentoobrowse/views/categories.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="categories" datasource="postgres-web"> - <sql> - SELECT c.categoryid, MIN(c.name) AS catname, COUNT(*) AS packages, MIN(c.summary) AS summary, MAX(p.firstseen) AS pkgfirstseen, - split_part(MIN(c.name), '-', 1) super - FROM categories c, packages p - WHERE c.categoryid = p.categoryid - GROUP BY c.categoryid - ORDER BY MIN(c.name) - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/category.xml b/gentoobrowse/views/category.xml deleted file mode 100644 index c14c2d2..0000000 --- a/gentoobrowse/views/category.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="categoryPackages" datasource="postgres-web"> - <sql> - SELECT c.name AS catname, p.name AS pkgname, p.description, COALESCE(herd, '-none-') herd - FROM categories c, packages p - WHERE c.categoryid = p.categoryid - <filter name="byCatName">AND c.name = <param name="catname" /></filter> - <filter name="byCatID">AND c.categoryid = <param name="catid" /></filter> - ORDER BY p.name - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/newebuilds.xml b/gentoobrowse/views/newebuilds.xml deleted file mode 100644 index de546c9..0000000 --- a/gentoobrowse/views/newebuilds.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:project2="http://project2.randomdan.homeip.net" xmlns:xi="http://www.w3.org/2001/XInclude"> - <project2:sqlrows name="newebuilds" datasource="postgres-web"> - <sql> - SELECT description, moddate, p.name AS pkgname, c.name AS catname, e.version, e.firstseen sync, - up.trackedsince IS NOT NULL AS tracked, p.packageid - FROM ebuilds e, categories c, packages p LEFT OUTER JOIN user_packages up - ON up.userid = <param name="userID" /> - AND up.packageid = p.packageid - WHERE e.packageid = p.packageid - AND p.categoryid = c.categoryid - <filter name="syncCount">AND e.firstseen IN ( - SELECT DISTINCT e.firstseen - FROM ebuilds e - ORDER BY e.firstseen DESC - LIMIT <param name="count" />)</filter> - ORDER BY tracked DESC, e.firstseen, c.name, p.name, e.versioninst - </sql> - </project2:sqlrows> - <project2:sqlrows name="syncs" datasource="postgres-web"> - <sql> - SELECT DISTINCT e.firstseen AS synctime - FROM ebuilds e - ORDER BY e.firstseen DESC - <filter name="syncCount"> LIMIT <param name="count" /></filter> - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/newebuildsatom.xml b/gentoobrowse/views/newebuildsatom.xml deleted file mode 100644 index fcc7e8f..0000000 --- a/gentoobrowse/views/newebuildsatom.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:project2="http://project2.randomdan.homeip.net" xmlns:xi="http://www.w3.org/2001/XInclude"> - <project2:sqlrows name="newebuilds" datasource="postgres-web"> - <sql> - SELECT version, description, moddate, p.name AS pkgname, c.name AS catname, e.firstseen sync - FROM ebuilds e, categories c, packages p, user_packages up, users u - WHERE e.packageid = p.packageid - AND p.categoryid = c.categoryid - AND up.userid = u.userid - AND u.username = <param name="username" /> - AND up.packageid = p.packageid - AND e.firstseen >= up.trackedsince - ORDER BY e.firstseen DESC, c.name, p.name, e.versioninst - LIMIT 50 - </sql> - </project2:sqlrows> -</block> - diff --git a/gentoobrowse/views/package.xml b/gentoobrowse/views/package.xml deleted file mode 100644 index e581430..0000000 --- a/gentoobrowse/views/package.xml +++ /dev/null @@ -1,174 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="sitemap-packages" datasource="postgres-web"> - <sql> - SELECT c.name AS catname, p.name AS pkgname, MAX(e.moddate) AS moddate - FROM categories c, packages p, ebuilds e - WHERE p.packageid = e.packageid - AND c.categoryid = p.categoryid - GROUP BY c.name, p.name - </sql> - </project2:sqlrows> - <project2:sqlrows name="packages" datasource="postgres-web"> - <sql> - SELECT p.packageid, p.name AS pkgname, p.description, p.firstseen, c.name AS catname, p.herd, p.summary, p.image - FROM packages p, categories c - WHERE p.categoryid = c.categoryid - <filter name="catAndName"> - AND c.name = <param name="cat" /> - AND p.name = <param name="pkg" /> - </filter> - </sql> - </project2:sqlrows> - <project2:sqlrows name="tracks" datasource="postgres-web"> - <sql> - SELECT up.packageid, up.trackedsince, up.userid - FROM user_packages up - <filter name="isPkgTrackedByUser"> - WHERE up.packageid = <param name="pkgid" /> - AND up.userid = <param name="userid" /> - </filter> - </sql> - </project2:sqlrows> - <project2:sqlrows name="versions" datasource="postgres-web"> - <sql> - SELECT e.ebuildid, e.version, e.moddate, e.slot, e.license, r.name AS reponame - FROM ebuilds e, repos r - WHERE e.repoid = r.repoid - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - ORDER BY versioninst desc - </sql> - </project2:sqlrows> - <project2:sqlrows name="packageUrls" datasource="postgres-web"> - <sql> - SELECT pu.url - FROM package_urls pu - <filter name="pkg"> - WHERE pu.packageid = <param name="pkgid" /> - </filter> - ORDER BY pu.url - </sql> - </project2:sqlrows> - <project2:sqlrows name="versionUses" datasource="postgres-web"> - <sql> - SELECT u.* - FROM ebuilds e, ebuild_uses u - LEFT OUTER JOIN use_groups ug ON LTRIM(u.use, '+') LIKE ug.name || '%' - WHERE e.ebuildid = u.ebuildid - AND ug.usegroupid IS NULL - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - ORDER BY version - </sql> - </project2:sqlrows> - <project2:sqlrows name="versionArchs" datasource="postgres-web"> - <sql> - SELECT a.* - FROM ebuilds e, ebuild_archs a - WHERE e.ebuildid = a.ebuildid - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - ORDER BY version - </sql> - </project2:sqlrows> - <project2:sqlrows name="packageBugs" datasource="postgres-web"> - <sql> - SELECT b.bugid, b.summary - FROM bugs b, categories c, packages p - WHERE p.categoryid = c.categoryid - AND gentoobrowse.bugpackages(b) @> array[c.name || '/' || p.name] - <filter name="pkg"> - AND p.packageid = <param name="pkgid" /> - </filter> - ORDER BY b.bugid - </sql> - </project2:sqlrows> - <project2:sqlrows name="packageDeps" datasource="postgres-web"> - <sql> - SELECT DISTINCT cd.name AS catname, pd.name AS pkgname, pd.description - FROM ebuilds e, ebuild_deps d, packages pd, categories cd - WHERE d.ebuildid = e.ebuildid - AND pd.packageid = d.packageid - AND pd.categoryid = cd.categoryid - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - ORDER BY cd.name, pd.name - </sql> - </project2:sqlrows> - <project2:sqlrows name="packageRdeps" datasource="postgres-web"> - <sql> - SELECT DISTINCT cd.name AS catname, pd.name AS pkgname, pd.description - FROM ebuilds e, ebuild_rdeps d, packages pd, categories cd - WHERE d.ebuildid = e.ebuildid - AND pd.packageid = d.packageid - AND pd.categoryid = cd.categoryid - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - ORDER BY cd.name, pd.name - </sql> - </project2:sqlrows> - <project2:sqlrows name="packageDepees" datasource="postgres-web"> - <sql> - SELECT DISTINCT cd.name AS catname, pd.name AS pkgname, pd.description - FROM ebuilds e, ( - SELECT ebuildid - FROM ebuild_rdeps d - <filter name="pkg"> - WHERE d.packageid = <param name="pkgid" /> - </filter> - UNION - SELECT ebuildid - FROM ebuild_deps d - <filter name="pkg"> - WHERE d.packageid = <param name="pkgid" /> - </filter>) d, packages pd, categories cd - WHERE d.ebuildid = e.ebuildid - AND pd.packageid = e.packageid - AND pd.categoryid = cd.categoryid - ORDER BY cd.name, pd.name - </sql> - </project2:sqlrows> - <project2:sqlrows name="maskStatus" datasource="postgres-web"> - <sql> - SELECT em.ebuildid, DENSE_RANK() OVER(ORDER BY em.setno) AS setno - FROM ebuild_masks em, ebuilds e - WHERE em.ebuildid = e.ebuildid - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - </sql> - </project2:sqlrows> - <project2:sqlrows name="maskDetails" datasource="postgres-web"> - <sql> - SELECT DISTINCT DENSE_RANK() OVER(ORDER BY em.setno), ms.person, ms.message, ms.dateadded - FROM ebuild_masks em, ebuilds e, masksets ms - WHERE em.ebuildid = e.ebuildid - AND ms.setno = em.setno - <filter name="pkg"> - AND e.packageid = <param name="pkgid" /> - </filter> - ORDER BY DENSE_RANK() OVER(ORDER BY em.setno) - </sql> - </project2:sqlrows> - <project2:sqlrows name="changeLog" datasource="postgres-web"> - <sql> - SELECT committime AS date, authorname person, authoremail email, cl.summary AS comment, r.name AS reponame - FROM changelog cl, categories c, packages p, repos r - WHERE p.categoryid = c.categoryid - AND cl.repoid = r.repoid - AND gentoobrowse.changelogpackages(cl) @> array[c.name || '/' || p.name] - <filter name="pkg"> - AND packageid = <param name="pkgid" /> - </filter> - AND cl.authoremail != 'repo-qa-checks@gentoo.org' - ORDER BY cl.committime DESC, cl.repoid - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/popular.xml b/gentoobrowse/views/popular.xml deleted file mode 100644 index 9668a7d..0000000 --- a/gentoobrowse/views/popular.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="popularPackages" datasource="postgres-web"> - <sql> - SELECT p.packageid, MIN(c.name) AS catname, MIN(p.name) AS pkgname, MIN(p.description) AS description, COUNT(*) AS trackers - FROM user_packages up, packages p, categories c - WHERE up.packageid = p.packageid - AND p.categoryid = c.categoryid - GROUP BY p.packageid - ORDER BY COUNT(*) DESC, MIN(c.name), MIN(p.name) - LIMIT 50 - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/poweredBy.xml b/gentoobrowse/views/poweredBy.xml deleted file mode 100644 index abec8a9..0000000 --- a/gentoobrowse/views/poweredBy.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:streamrows name="poweredBy" fieldSep="|" newline=" " encoding="ascii"> - <project2:filestream path="datasources/poweredBy.txt" /> - <columns> - <name /> - <url /> - </columns> - </project2:streamrows> - <project2:view name="viewPoweredBy" source="poweredBy" rootname="power" recordname="by" /> -</block> - diff --git a/gentoobrowse/views/search.xml b/gentoobrowse/views/search.xml deleted file mode 100644 index 063098d..0000000 --- a/gentoobrowse/views/search.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="packageSearch" datasource="postgres-web"> - <sql> - select c.name as catname, p.name as pkgname, description - <filter name="freeText">, - ts_rank(packagefts(p), plainto_tsquery('english', <param name="criteria" />)) as rank - </filter> - from packages p, categories c - where p.categoryid = c.categoryid - <filter name="freeText"> - and packagefts(p) @@ plainto_tsquery('english', <param name="criteria" />) - order by rank desc, p.name - </filter> - </sql> - </project2:sqlrows> - <project2:sqlrows name="bugSearch" datasource="postgres-web"> - <sql> - SELECT b.bugid, b.severity, b.status, b.summary, b.firstseen - <filter name="freeText">, - ts_rank(bugfts(b), plainto_tsquery('english', <param name="criteria" />)) as rank - </filter> - FROM bugs b - <filter name="freeText"> - WHERE bugfts(b) @@ plainto_tsquery('english', <param name="criteria" />) - ORDER BY rank DESC, bugid DESC - </filter> - </sql> - </project2:sqlrows> - <project2:sqlrows name="packagesWithUse" datasource="postgres-web"> - <sql> - SELECT DISTINCT p.packageid, c.name AS catname, p.name AS pkgname, description - FROM ebuild_uses eu, ebuilds e, packages p, categories c - WHERE e.ebuildid = eu.ebuildid - AND e.packageid = p.packageid - AND p.categoryid = c.categoryid - <filter name="byUse"> - AND LTRIM(eu.use, '+') = <param name="use" /> - </filter> - ORDER BY c.name, p.name - </sql> - </project2:sqlrows> - <project2:sqlrows name="packagesInHerd" datasource="postgres-web"> - <sql> - SELECT c.name as catname, p.name as pkgname, description - FROM packages p, categories c - WHERE p.categoryid = c.categoryid - <filter name="byHerd"> - AND p.herd = <param name="herd" /> - </filter> - ORDER BY c.name, p.name - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/tracked.xml b/gentoobrowse/views/tracked.xml deleted file mode 100644 index c36f2a8..0000000 --- a/gentoobrowse/views/tracked.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="trackedPackages" datasource="postgres-web"> - <sql> - SELECT c.name as catname, p.name as pkgname, description - FROM user_packages up, packages p, categories c - WHERE up.packageid = p.packageid - AND c.categoryid = p.categoryid - <filter name="userid">AND up.userid = <param name="userid" /></filter> - ORDER BY c.name, p.name - </sql> - </project2:sqlrows> -</block> - diff --git a/gentoobrowse/views/use.xml b/gentoobrowse/views/use.xml deleted file mode 100644 index 67a4c63..0000000 --- a/gentoobrowse/views/use.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="package-uses" datasource="postgres-web"> - <sql> - SELECT LTRIM(p.use, '+') AS use, COALESCE(MIN(l.description), MIN(g.description), MIN(ug.description)) AS description, - MIN(gs.name) AS usegroup - FROM (SELECT e.packageid, u.use - FROM ebuilds e, ebuild_uses u - WHERE e.ebuildid = u.ebuildid - <filter name="byPackageID"> - AND e.packageid = <param name="packageid" /> - </filter>) AS p - LEFT OUTER JOIN use_global g ON LTRIM(p.use, '+') = g.use - LEFT OUTER JOIN use_local l ON LTRIM(p.use, '+') = l.use - AND (l.packageid = p.packageid OR l.packageid IS NULL) - AND (l.description IS NOT NULL OR g.description IS NOT NULL) - LEFT OUTER JOIN use_groups gs ON LTRIM(p.use, '+') LIKE gs.name || '%' - LEFT OUTER JOIN use_group ug ON gs.usegroupid = ug.usegroupid - AND gs.name || '_' || ug.use = LTRIM(p.use, '+') - GROUP BY LTRIM(p.use, '+') - ORDER BY LTRIM(p.use, '+') - </sql> - </project2:sqlrows> - <project2:sqlrows name="use-global" datasource="postgres-web"> - <sql> - SELECT use, description - FROM use_global - <filter name="use"> - WHERE LTRIM(use, '+') = <param name="use" /> - </filter> - </sql> - </project2:sqlrows> - <project2:sqlrows name="use-local" datasource="postgres-web"> - <sql> - SELECT packageid, use, description - FROM use_local - <filter name="use"> - WHERE LTRIM(use, '+') = <param name="use" /> - ORDER BY packageid - </filter> - <filter name="package"> - WHERE packageid = <param name="packageid" /> - ORDER BY use - </filter> - </sql> - </project2:sqlrows> -</block> diff --git a/gentoobrowse/views/user.xml b/gentoobrowse/views/user.xml deleted file mode 100644 index f989514..0000000 --- a/gentoobrowse/views/user.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlrows name="users" datasource="postgres-web"> - <sql> - SELECT u.* - FROM users u - <filter name="username">WHERE u.username = <param name="username" /></filter> - <filter name="verifyguid">WHERE u.verifyguid = <param name="verifyguid" /></filter> - </sql> - </project2:sqlrows> -</block> - diff --git a/gentoobrowse/views/webcommon.xml b/gentoobrowse/views/webcommon.xml deleted file mode 100644 index fd84a41..0000000 --- a/gentoobrowse/views/webcommon.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"?> -<block xmlns:xi="http://www.w3.org/2001/XInclude"> - <xi:include href="poweredBy.xml" /> -</block> - diff --git a/gentoobrowse/xslt/atom.xslt b/gentoobrowse/xslt/atom.xslt new file mode 100644 index 0000000..d0ed8c0 --- /dev/null +++ b/gentoobrowse/xslt/atom.xslt @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + exclude-result-prefixes="date"> + + <xsl:template name="atomDate"> + <xsl:param name="date"/> + <xsl:value-of select="date:date($date)" /> + <xsl:text>T</xsl:text> + <xsl:if test="string-length($date) > 10"> + <xsl:value-of select="format-number(date:hour-in-day($date), '00')" /> + <xsl:text>:</xsl:text> + <xsl:value-of select="format-number(date:minute-in-hour($date), '00')" /> + <xsl:text>:</xsl:text> + <xsl:value-of select="format-number(date:second-in-minute($date), '00')" /> + </xsl:if> + <xsl:if test="string-length($date) <= 10"> + <xsl:text>00:00:00</xsl:text> + </xsl:if> + <xsl:text>Z</xsl:text> + </xsl:template> +</xsl:stylesheet> diff --git a/gentoobrowse/xslt/atomebuilds.xslt b/gentoobrowse/xslt/atomebuilds.xslt deleted file mode 100644 index 4d647f4..0000000 --- a/gentoobrowse/xslt/atomebuilds.xslt +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > - <xsl:output encoding="utf-8" method="xml" media-type="text/xml" indent="yes"/> - <xsl:template match="/gentoo"> - <rss version="2.0"> - <xsl:apply-templates select="/gentoo/newebuilds" /> - </rss> - </xsl:template> - <xsl:template match="/gentoo/newebuilds"> - <channel> - <title>Gentoo Browse | New ebuilds</title> - <link>http://gentoobrowse.randomdan.homeip.net/</link> - <atom:link rel="self" type="application/rss+xml"> - <xsl:attribute name="href">http://<xsl:value-of select="/gentoo/project2:environment/servername" />/atom/<xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /></xsl:attribute> - </atom:link> - <description>Unofficial Gentoo package browser</description> - <language>en-gb</language> - <lastBuildDate> - <xsl:value-of select="/gentoo/newebuilds/lastBuildDate/@custom" /> - </lastBuildDate> - <copyright>Copyright: (C) Gentoo Foundation, Inc.</copyright> - <ttl>15</ttl> - <xsl:apply-templates select="/gentoo/newebuilds/ebuild" /> - </channel> - </xsl:template> - <xsl:template match="/gentoo/newebuilds/ebuild"> - <item> - <title><xsl:value-of select="catname" />/<xsl:value-of select="pkgname" />-<xsl:value-of select="version" /></title> - <description><xsl:value-of select="description" /></description> - <link>http://<xsl:value-of select="/gentoo/project2:environment/servername" />/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></link> - <guid isPermaLink="false">http://<xsl:value-of select="/gentoo/project2:environment/servername" />/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" />-<xsl:value-of select="version" /></guid> - <pubDate><xsl:value-of select="moddate/@custom" /></pubDate> - <category>ebuild</category> - </item> - </xsl:template> -</xsl:stylesheet> diff --git a/gentoobrowse/xslt/base.xslt b/gentoobrowse/xslt/base.xslt index 5dd2cf7..1efd644 100644 --- a/gentoobrowse/xslt/base.xslt +++ b/gentoobrowse/xslt/base.xslt @@ -1,9 +1,58 @@ <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2 str" > + xmlns:date="http://exslt.org/dates-and-times" + exclude-result-prefixes="str date"> + <xsl:import href="form.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + <xsl:template name="humanDate"> + <xsl:param name="date"/> + <time> + <xsl:attribute name="datetime"><xsl:value-of select="$date" /></xsl:attribute> + <xsl:if test="date:year($date) = date:year(date:date-time())"> + <xsl:value-of select="date:day-name($date)" /> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="format-number(date:day-in-month($date), '00')" /> + <xsl:text> </xsl:text> + <xsl:value-of select="date:month-name($date)" /> + <xsl:if test="date:year($date) != date:year(date:date-time())"> + <xsl:text> </xsl:text> + <xsl:value-of select="date:year($date)" /> + </xsl:if> + </time> + </xsl:template> + + <xsl:template name="humanDateTime"> + <xsl:param name="date"/> + <time> + <xsl:attribute name="datetime"><xsl:value-of select="$date" /></xsl:attribute> + <xsl:if test="date:year($date) = date:year(date:date-time())"> + <xsl:value-of select="date:day-name($date)" /> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="format-number(date:day-in-month($date), '00')" /> + <xsl:text> </xsl:text> + <xsl:value-of select="date:month-name($date)" /> + <xsl:text> </xsl:text> + <xsl:if test="date:year($date) = date:year(date:date-time())"> + <xsl:value-of select="format-number(date:hour-in-day($date), '00')" />:<small><xsl:value-of select="format-number(date:minute-in-hour($date), '00')" /></small> + </xsl:if> + <xsl:if test="date:year($date) != date:year(date:date-time())"> + <xsl:value-of select="date:year($date)" /> + </xsl:if> + </time> + </xsl:template> + + <xsl:template name="simpleTime"> + <xsl:param name="date"/> + <time> + <xsl:attribute name="datetime"><xsl:value-of select="$date" /></xsl:attribute> + <xsl:value-of select="format-number(date:hour-in-day($date), '00')" />:<small><xsl:value-of select="format-number(date:minute-in-hour($date), '00')" /></small> + </time> + </xsl:template> + <xsl:template match="/*"> <xsl:text disable-output-escaping="yes"><!DOCTYPE html> </xsl:text> <html lang="en"> @@ -32,14 +81,21 @@ <div class="nav-collapse collapse"> <ul class="nav"> <li><a href="/">Home</a></li> - <li><a href="/categories">Browse</a></li> - <li><a href="/popular">Popular</a></li> + <li><a href="/news">News</a></li> + <li><a href="/packages">Browse</a></li> + <li><a href="/packages/popular">Popular</a></li> + <li><a href="/use">Use</a></li> <li><a href="JavaScript: void(0);" onclick="$('#search').modal('show');" rel="nofollow">Search</a></li> - <xsl:if test="not(/gentoo/project2:session/loggedInUserID)"> + <xsl:if test="not(user)"> <li><a href="JavaScript: void(0);" onclick="$('#login').modal('show');" rel="nofollow">Login/Sign up</a></li> </xsl:if> - <xsl:if test="/gentoo/project2:session/loggedInUserID"> - <li><a href="/accountHome" rel="nofollow">My Account</a></li> + <xsl:if test="user"> + <li> + <a href="/user/home" rel="nofollow"> + My Account + <small>(<xsl:value-of select="user/username" />)</small> + </a> + </li> </xsl:if> </ul> </div> @@ -65,51 +121,51 @@ <p>Gentoo Browse is not an official Gentoo website. The name "Gentoo" and the "g" logo are trademarks of the Gentoo Foundation, Inc.</p> <p>Many thanks to the people behind the tech powering Gentoo Browse.</p> <ul class="footer-links"> - <li class="muted">·</li> - <xsl:for-each select="/gentoo/power/by"> - <li> - <a> - <xsl:attribute name="href"><xsl:value-of select="url" /></xsl:attribute> - <xsl:value-of select="name" /> - </a> - </li> - <wbr/> - <li class="muted">·</li> - </xsl:for-each> + <li class="muted">·</li> + <li><a href="http://www.gentoo.org/">Gentoo</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://www.postgresql.org/">PostgreSQL</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://httpd.apache.org/">Apache</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://www.fastcgi.com/drupal/">FastCGI</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://www.w3.org/TR/xslt/">XSLT</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://www.boost.org/">Boost</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="https://zeroc.com/products/ice">ZeroC Ice</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://twitter.github.com/bootstrap/index.html">Bootstrap</a></li><wbr></wbr> + <li class="muted">·</li> + <li><a href="http://icespider.randomdan.homeip.net/">IceSpider</a></li><wbr></wbr> + <li class="muted">·</li> </ul> </div> </footer> <!-- popup forms --> - <form id="search" class="modal hide fade" action="/search" method="get"> - <div class="modal-header"> - <h3>Site search</h3> - </div> - <div class="modal-body"> - <input type="search" name="criteria" placeholder="Search criteria" required="required" autofocus="autofocus"> - <xsl:attribute name="value"><xsl:value-of select="/gentoo/project2:params/criteria" /></xsl:attribute> - </input> - <p>Searches package names, descriptions and bug summaries.</p> - </div> - <div class="modal-footer"> - <input type="button" value="Cancel" class="btn" onclick="$('#search').modal('hide'); return false;" /> - <input type="submit" value="Search" class="btn btn-primary" /> - </div> - </form> - <form id="login" class="modal hide fade" action="/dologin" method="post"> - <div class="modal-header"> - <h3>Login</h3> - </div> - <div class="modal-body"> - <input type="text" name="username" placeholder="Username" required="required" autofocus="autofocus" /> - <input type="password" name="password" placeholder="Password" required="required" /> - <p><a href="/signup">Sign up</a></p> - </div> - <div class="modal-footer"> - <input type="button" value="Cancel" class="btn" onclick="$('#login').modal('hide'); return false;" /> - <input type="submit" value="Login" class="btn btn-primary" /> - </div> - </form> + <xsl:call-template name="popup"> + <xsl:with-param name="form"> + <form id="search" action="/search" method="get" caption="Site search" submit="Search"> + <input type="search" name="criteria" placeholder="Search criteria" required="required"> + <xsl:attribute name="value"> + <xsl:value-of select="/gentoo/query" /> + </xsl:attribute> + </input> + <p>Searches package names, descriptions, news, bug summaries and use flags.</p> + </form> + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="popup"> + <xsl:with-param name="form"> + <form id="login" action="/user/login" method="post" caption="Login" submit="Login"> + <input type="text" name="username" placeholder="Username" required="required" /> + <input type="password" name="password" placeholder="Password" required="required" /> + <p><a href="/user/signup">Sign up</a></p> + </form> + </xsl:with-param> + </xsl:call-template> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script src="/js/bootstrap.min.js"></script> @@ -127,23 +183,27 @@ </xsl:template> <xsl:template match="package"> + <xsl:variable name="category" select="/gentoo/category | /gentoo/categories/category[categoryid = current()/categoryid]" /> <p> + <xsl:if test="block = 'true'"> + <xsl:attribute name="class">block</xsl:attribute> + </xsl:if> <a> - <xsl:attribute name="href">/category/<xsl:value-of select="catname" /></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="catname" /></xsl:attribute> - <xsl:value-of select="catname" /> + <xsl:attribute name="href">/packages/<xsl:value-of select="$category/name" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="$category/summary" /></xsl:attribute> + <xsl:value-of select="$category/name" /> </a> / <a> - <xsl:attribute name="href">/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute> + <xsl:attribute name="href">/packages/<xsl:value-of select="$category/name" />/<xsl:value-of select="name" /></xsl:attribute> <xsl:attribute name="title"><xsl:value-of select="description" /></xsl:attribute> - <xsl:value-of select="pkgname" /> + <xsl:value-of select="name" /> </a> : <xsl:value-of select="description" /> - <xsl:if test="count(/gentoo/local/use[packageid = current()/packageid]) > 0"> + <xsl:if test="/gentoo/usage/use[packageid = current()/packageid]"> <ul> - <xsl:for-each select="/gentoo/local/use[packageid = current()/packageid]"> + <xsl:for-each select="/gentoo/usage/use[packageid = current()/packageid]"> <li> <xsl:value-of select="description" /> </li> diff --git a/gentoobrowse/xslt/categories.xslt b/gentoobrowse/xslt/categories.xslt index d25d135..c800717 100644 --- a/gentoobrowse/xslt/categories.xslt +++ b/gentoobrowse/xslt/categories.xslt @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> @@ -8,59 +7,61 @@ <title>Category List · Gentoo Browse</title> <meta name="description" content="Complete list of Gentoo Linux package categories" /> </xsl:template> - + <xsl:template name="header"> <h1>Package categories</h1> <p class="lead"> - <xsl:value-of select="count(/gentoo/categories/category)" /> + <xsl:value-of select="count(/gentoo/categories/super/categories/category)" /> package categories in - <xsl:value-of select="count(/gentoo/categories/supers/value)" /> + <xsl:value-of select="count(/gentoo/categories/super)" /> groups. </p> </xsl:template> - + <xsl:template name="content"> <xsl:apply-templates select="/gentoo/categories" /> </xsl:template> - + <xsl:template match="/gentoo/categories"> <div class="span3 bs-docs-sidebar"> <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="supers/value"> + <xsl:for-each select="super"> <li> <a> - <xsl:attribute name="href">#<xsl:value-of select="." /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="." /> + <xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute> + <i class="icon-chevron-right"></i> <xsl:value-of select="name" /> </a> </li> </xsl:for-each> </ul> </div> <div class="span9"> - <xsl:for-each select="supers/value"> + <xsl:for-each select="super"> <section> - <xsl:attribute name="id"><xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="id"><xsl:value-of select="name" /></xsl:attribute> <h2 class="page-header"> - <xsl:value-of select="." /> + <xsl:value-of select="name" /> </h2> - <xsl:apply-templates select="/gentoo/categories/category[super = current()/.]" /> + <xsl:apply-templates select="categories/category" /> </section> </xsl:for-each> </div> </xsl:template> - - <xsl:template match="/gentoo/categories/category"> + + <xsl:template match="/gentoo/categories/super/categories/category"> <h3> - <xsl:value-of select="catname" /> + <xsl:value-of select="name" /> </h3> <p> <xsl:value-of select="summary" /> Contains <a> - <xsl:attribute name="href">/category/<xsl:value-of select="catname" /></xsl:attribute> - <xsl:value-of select="packages" /> packages</a> + <xsl:attribute name="href">/packages/<xsl:value-of select="name" /></xsl:attribute> + <xsl:value-of select="packagecount" /> packages</a> last updated - <xsl:value-of select="pkgfirstseen/@custom" />. + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="lastaddition" /> + </xsl:call-template>. </p> </xsl:template> </xsl:stylesheet> diff --git a/gentoobrowse/xslt/category.xslt b/gentoobrowse/xslt/category.xslt index f7dedc5..622b9eb 100644 --- a/gentoobrowse/xslt/category.xslt +++ b/gentoobrowse/xslt/category.xslt @@ -1,24 +1,23 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> <xsl:template name="head"> - <title><xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> Package List · Gentoo Browse</title> + <title><xsl:value-of select="/gentoo/category/name" /> Package List · Gentoo Browse</title> <meta name="description"> - <xsl:attribute name="content">Complete list of Gentoo Linux packages in the <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> category</xsl:attribute> + <xsl:attribute name="content">Complete list of Gentoo Linux packages in the <xsl:value-of select="/gentoo/category/name" /> category</xsl:attribute> </meta> <link rel="contents" href="/categories" /> </xsl:template> <xsl:template name="header"> - <h1><xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> packages</h1> + <h1><xsl:value-of select="/gentoo/category/name" /> packages</h1> <p class="lead"> - <xsl:value-of select="count(/gentoo/packages/package)" /> - packages from - <xsl:value-of select="count(/gentoo/packages/herds/value)" /> - herds. + <xsl:value-of select="count(/gentoo/packages/package)" /> packages - + <small> + <xsl:value-of select="/gentoo/category/summary" /> + </small> </p> </xsl:template> @@ -29,26 +28,14 @@ <xsl:template match="/gentoo/packages"> <div class="span3 bs-docs-sidebar"> <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="herds/value"> - <li> - <a> - <xsl:attribute name="href">#<xsl:value-of select="." /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="." /> - </a> - </li> - </xsl:for-each> + <li> + </li> </ul> </div> <div class="span9"> - <xsl:for-each select="herds/value"> - <section> - <xsl:attribute name="id"><xsl:value-of select="." /></xsl:attribute> - <h2 class="page-header"> - <xsl:value-of select="." /> - </h2> - <xsl:apply-templates select="/gentoo/packages/package[herd = current()/.]" /> - </section> - </xsl:for-each> + <p> + </p> + <xsl:apply-templates select="/gentoo/packages/package" /> </div> </xsl:template> </xsl:stylesheet> diff --git a/gentoobrowse/xslt/error.xslt b/gentoobrowse/xslt/error.xslt index e20973a..0ba1530 100644 --- a/gentoobrowse/xslt/error.xslt +++ b/gentoobrowse/xslt/error.xslt @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net"> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> diff --git a/gentoobrowse/xslt/form.xslt b/gentoobrowse/xslt/form.xslt index df4ff98..9f83b4b 100644 --- a/gentoobrowse/xslt/form.xslt +++ b/gentoobrowse/xslt/form.xslt @@ -1,58 +1,69 @@ <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" - xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn"> + xmlns:common="http://exslt.org/common" extension-element-prefixes="common"> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> - <xsl:template match="para" mode="menu"/> - <xsl:template match="form" mode="menu"/> - - <xsl:template match="para" mode="content"> - <xsl:copy-of select="*" /> + <xsl:template name="popup"> + <xsl:param name="form"/> + <xsl:variable name="f" select="common:node-set($form)/form"/> + <form class="modal hide fade"> + <xsl:copy-of select="$f/@id|$f/@action|$f/@method"/> + <div class="modal-header"> + <h3> + <xsl:value-of select="$f/@caption"/> + </h3> + </div> + <div class="modal-body"> + <xsl:copy-of select="$f/*"/> + </div> + <div class="modal-footer"> + <input type="button" value="Cancel" class="btn"> + <xsl:attribute name="onclick">$('#<xsl:value-of select="$f/@id" />').modal('hide'); return false;</xsl:attribute> + </input> + <input type="submit" class="btn btn-primary"> + <xsl:attribute name="value"> + <xsl:value-of select="$f/@submit" /> + </xsl:attribute> + </input> + </div> + </form> </xsl:template> - - <xsl:template match="form" mode="content"> + + <xsl:template name="form"> + <xsl:param name="form"/> + <xsl:variable name="f" select="common:node-set($form)/form"/> <form class="generalForm"> - <xsl:attribute name="action"><xsl:value-of select="@action" /></xsl:attribute> - <xsl:attribute name="method"><xsl:value-of select="@method" /></xsl:attribute> + <xsl:copy-of select="$f/@action|$f/@method"/> <section> <h2 class="page-header"> - <xsl:value-of select="@caption" /> + <xsl:value-of select="$f/@caption" /> </h2> - <table> - <xsl:for-each select="input"> - <tr> - <th width="25%"><xsl:value-of select="@caption" /></th> - <td colspan="2" width="75%"> - <input> - <xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute> - <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> - <xsl:attribute name="id">form_<xsl:value-of select="@name" /></xsl:attribute> - <xsl:attribute name="value"> - <xsl:value-of select="dyn:evaluate(@xslvalue)" /> - </xsl:attribute> - </input> - </td> - </tr> - </xsl:for-each> - <tr> - <th colspan="2" width="75%"> - <xsl:for-each select="/gentoo/project2:messages/message"> - <p class="error"><xsl:value-of select="@text" /></p> - </xsl:for-each> - </th> - <th align="right" width="25%"> - <input type="submit"> - <xsl:attribute name="value"><xsl:value-of select="@submit" /></xsl:attribute> + <dl class="dl-horizontal"> + <xsl:for-each select="$f/input"> + <dt style="line-height: 30px"> + <xsl:value-of select="@caption" /> + </dt> + <dd> + <input> + <xsl:copy-of select="@type|@name|@id|@required|@value"/> + <xsl:attribute name="placeholder"><xsl:value-of select="@caption" /></xsl:attribute> </input> - </th> - </tr> - </table> + </dd> + </xsl:for-each> + <xsl:copy-of select="$f/p"/> + <dd> + <input type="submit" class="btn btn-primary"> + <xsl:attribute name="value"> + <xsl:value-of select="$f/@submit" /> + </xsl:attribute> + </input> + </dd> + </dl> </section> </form> - <xsl:if test="@autofocus != ''"> + <xsl:if test="$f/@autofocus"> <script type="text/javascript"> - document.getElementById('form_<xsl:value-of select="@autofocus" />').focus(); + document.getElementById('form_<xsl:value-of select="$f/@autofocus" />').focus(); </script> </xsl:if> </xsl:template> diff --git a/gentoobrowse/xslt/herd.xslt b/gentoobrowse/xslt/herd.xslt deleted file mode 100644 index bb7b291..0000000 --- a/gentoobrowse/xslt/herd.xslt +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > - <xsl:import href="base.xslt" /> - <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> - - <xsl:template name="head"> - <title>Packages in the <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> herd · Gentoo Browse</title> - <meta name="description"> - <xsl:attribute name="content">Packages in the <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> herd</xsl:attribute> - </meta> - </xsl:template> - - <xsl:template name="header"> - <h1>The <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> herd</h1> - <p class="lead"> - <xsl:value-of select="count(/gentoo/packages/package)" /> - packages in - <xsl:value-of select="count(/gentoo/packages/categories/value)" /> - categories. - </p> - </xsl:template> - - <xsl:template name="content"> - <xsl:apply-templates select="/gentoo/packages" /> - </xsl:template> - - <xsl:template match="/gentoo/packages"> - <div class="span3 bs-docs-sidebar"> - <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="categories/value"> - <li> - <a> - <xsl:attribute name="href">#<xsl:value-of select="." /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="." /> - </a> - </li> - </xsl:for-each> - </ul> - </div> - <div class="span9"> - <xsl:for-each select="categories/value"> - <section> - <xsl:attribute name="id"><xsl:value-of select="." /></xsl:attribute> - <h2 class="page-header"> - <xsl:value-of select="." /> - </h2> - <xsl:apply-templates select="/gentoo/packages/package[catname = current()/.]" /> - </section> - </xsl:for-each> - </div> - </xsl:template> -</xsl:stylesheet> diff --git a/gentoobrowse/xslt/home-atom.xslt b/gentoobrowse/xslt/home-atom.xslt new file mode 100644 index 0000000..11ea8d1 --- /dev/null +++ b/gentoobrowse/xslt/home-atom.xslt @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/2005/Atom"> + <xsl:import href="atom.xslt" /> + <xsl:output encoding="utf-8" method="xml" media-type="application/atom+xml" indent="yes" /> + + <xsl:template match="/*"> + <feed> + <title>Recent updates · Gentoo Browse</title> + <subtitle>Packages</subtitle> + <link href="http://gentoobrowse.randomdan.homeip.net/" rel="self" /> + <id>http://gentoobrowse.randomdan.homeip.net/</id> + <updated> + <xsl:call-template name="atomDate"> + <xsl:with-param name="date" select="syncs/sync[last()]/timestamp" /> + </xsl:call-template> + </updated> + <xsl:apply-templates select="syncs/sync/categories/category/packages/package"> + <xsl:sort select="../../../../timestamp" order="ascending" type="text" /> + <xsl:sort select="../../id" order="ascending" type="text" /> + <xsl:sort select="id" order="ascending" type="text" /> + </xsl:apply-templates> + </feed> + </xsl:template> + + <xsl:template match="package"> + <xsl:variable name="category" select="../.." /> + <entry> + <title> + <xsl:value-of select="$category/id" />/<xsl:value-of select="id" /> + </title> + <link rel="alternate" type="text/html"> + <xsl:attribute name="href"> + <xsl:text>http://gentoobrowse.randomdan.homeip.net/packages/</xsl:text> + <xsl:value-of select="$category/id" /> + <xsl:text>/</xsl:text> + <xsl:value-of select="id" /> + </xsl:attribute> + </link> + <id> + <xsl:text>http://gentoobrowse.randomdan.homeip.net/</xsl:text> + <xsl:value-of select="../../../../timestamp" /> + <xsl:text>/</xsl:text> + <xsl:value-of select="$category/id" /> + <xsl:text>/</xsl:text> + <xsl:value-of select="id" /> + </id> + <updated> + <xsl:call-template name="atomDate"> + <xsl:with-param name="date" select="../../../../timestamp" /> + </xsl:call-template> + </updated> + <summary> + <xsl:value-of select="package/detail/description" /> + </summary> + <author> + <name> + <xsl:value-of select="package/detail/maintainername" /> + </name> + <email> + <xsl:value-of select="package/detail/maintainer" /> + </email> + </author> + </entry> + </xsl:template> +</xsl:stylesheet> diff --git a/gentoobrowse/xslt/home.xslt b/gentoobrowse/xslt/home.xslt index 4d85870..bc7e657 100644 --- a/gentoobrowse/xslt/home.xslt +++ b/gentoobrowse/xslt/home.xslt @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + exclude-result-prefixes="date"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> @@ -7,78 +9,91 @@ <title>Newest ebuilds · Gentoo Browse</title> <meta name="google-site-verification" content="f2uqzTiSxj7gbzzRzf4nOCB3WfQuWV9Knfjb9ju69jU" /> <meta name="description" content="List of newest released package ebuilds for Gentoo Linux" /> + <link href="/" type="application/atom+xml" rel="alternate" title="New ebuilds ATOM Feed" /> + <xsl:if test="user"> + <link type="application/atom+xml" rel="alternate" title="New ebuilds ATOM Feed"> + <xsl:attribute name="href"> + <xsl:text>/atom/</xsl:text> + <xsl:value-of select="user/username"/> + </xsl:attribute> + </link> + </xsl:if> </xsl:template> <xsl:template name="header"> <h1>Newest ebuilds</h1> <p class="lead"> - <xsl:value-of select="count(/gentoo/newebuilds/ebuild[sync = /gentoo/newebuilds/lastsync])" /> + <xsl:value-of select="count(/gentoo/syncs/sync[last()]//ebuild)" /> new ebuilds in today. </p> </xsl:template> <xsl:template name="content"> - <xsl:apply-templates select="/gentoo/newebuilds" /> - </xsl:template> - - <xsl:template match="/gentoo/newebuilds"> <div class="span3 bs-docs-sidebar"> <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="syncs/value"> - <xsl:sort select="position()" data-type="number" order="descending" /> + <xsl:for-each select="syncs/sync"> + <xsl:sort select="timestamp" data-type="text" order="descending" /> <li> <a> - <xsl:attribute name="href">#<xsl:value-of select="current()/@date" /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="current()/@custom" /> + <xsl:attribute name="href">#<xsl:value-of select="date:date(timestamp)" /></xsl:attribute> + <i class="icon-chevron-right"></i> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="timestamp" /> + </xsl:call-template> </a> </li> </xsl:for-each> </ul> </div> + <div class="span9"> - <xsl:for-each select="syncs/value"> - <xsl:sort select="position()" data-type="number" order="descending"/> + <xsl:for-each select="syncs/sync"> + <xsl:sort select="timestamp" data-type="text" order="descending"/> <section> - <xsl:attribute name="id"><xsl:value-of select="current()/@date" /></xsl:attribute> + <xsl:attribute name="id"><xsl:value-of select="date:date(timestamp)" /></xsl:attribute> <h2 class="page-header"> - <time> - <xsl:attribute name="datetime"><xsl:value-of select="current()" /></xsl:attribute> - <span class="syncdate"><xsl:value-of select="current()/@custom" /></span> - </time> + <span class="syncdate"> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="timestamp" /> + </xsl:call-template> + </span> </h2> - <xsl:apply-templates select="/gentoo/newebuilds/ebuild[sync = current()]" /> + + <xsl:for-each select="categories/category"> + <xsl:sort select="id/@tracked" order="descending"/> + <xsl:variable name="category" select="."/> + <h3> + <xsl:value-of select="id" /> + </h3> + <xsl:for-each select="packages/package"> + <xsl:sort select="id/@tracked" order="descending"/> + <p> + <a> + <xsl:attribute name="href">/packages/<xsl:value-of select="$category/id" /></xsl:attribute> + <xsl:value-of select="$category/id" /> + </a> + <xsl:text> / </xsl:text> + <a> + <xsl:attribute name="href">/packages/<xsl:value-of select="$category/id" />/<xsl:value-of select="id" /></xsl:attribute> + <xsl:value-of select="id" /> + </a> + <xsl:text> : </xsl:text> + <xsl:value-of select="package/detail/description" /> + </p> + <xsl:for-each select="package/ebuilds/ebuild"> + <p> + <xsl:text>v</xsl:text> + <xsl:value-of select="version" /> - <small> + <xsl:text>(updated </xsl:text> + <xsl:call-template name="simpleTime"> + <xsl:with-param name="date" select="firstseen"/> + </xsl:call-template>)</small> + </p> + </xsl:for-each> + </xsl:for-each> + </xsl:for-each> </section> </xsl:for-each> </div> </xsl:template> - - <xsl:template match="/gentoo/newebuilds/ebuild"> - <xsl:if test="position() = 1 or preceding-sibling::ebuild[1]/catname != catname or preceding-sibling::ebuild[1]/sync/@date != sync/@date"> - <h3> - <xsl:value-of select="catname" /> - </h3> - </xsl:if> - <xsl:if test="position() = 1 or preceding-sibling::ebuild[1]/packageid != packageid or preceding-sibling::ebuild[1]/sync != sync"> - <p> - <xsl:if test="tracked = 1"> - <i class="icon-eye-open" /> - <xsl:text> </xsl:text> - </xsl:if> - <a> - <xsl:attribute name="href">/category/<xsl:value-of select="catname" /></xsl:attribute> - <xsl:value-of select="catname" /> - </a> - / - <a> - <xsl:attribute name="href">/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute> - <xsl:value-of select="pkgname" /> - </a> - : - <xsl:value-of select="description" /> - </p> - </xsl:if> - <p> - v<xsl:value-of select="version" /> - <small>(updated <xsl:value-of select="moddate/@time" />)</small> - </p> - </xsl:template> </xsl:stylesheet> diff --git a/gentoobrowse/xslt/login.xslt b/gentoobrowse/xslt/login.xslt deleted file mode 100644 index d599761..0000000 --- a/gentoobrowse/xslt/login.xslt +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" - xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn"> - <xsl:import href="base.xslt" /> - <xsl:import href="form.xslt" /> - <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> - - <xsl:template name="header"> - <h1>Your Gentoo Browse</h1> - <p class="lead">Customise what you like and what you want to hear about.</p> - </xsl:template> - - <xsl:template name="content"> - <div class="span3 bs-docs-sidebar"> - <xsl:apply-templates select="form|para|trackedpackages" mode="menu" /> - </div> - <div class="span9"> - <xsl:apply-templates select="form|para|trackedpackages" mode="content" /> - </div> - </xsl:template> - - <xsl:template match="/gentoo/trackedpackages" mode="menu"> - <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="categories/value"> - <li> - <a> - <xsl:attribute name="href">#<xsl:value-of select="." /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="." /> - </a> - </li> - </xsl:for-each> - </ul> - </xsl:template> - - <xsl:template match="/gentoo/trackedpackages" mode="content"> - <xsl:for-each select="categories/value"> - <section> - <xsl:attribute name="id"><xsl:value-of select="." /></xsl:attribute> - <h2 class="page-header"> - <xsl:value-of select="." /> - </h2> - <xsl:apply-templates select="../../package[catname = current()/.]" /> - </section> - </xsl:for-each> - </xsl:template> - -</xsl:stylesheet> diff --git a/gentoobrowse/xslt/news-atom.xslt b/gentoobrowse/xslt/news-atom.xslt new file mode 100644 index 0000000..bf4350d --- /dev/null +++ b/gentoobrowse/xslt/news-atom.xslt @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/2005/Atom"> + <xsl:import href="atom.xslt" /> + <xsl:output encoding="utf-8" method="xml" media-type="application/atom+xml" indent="yes" /> + <xsl:variable name="base">http://gentoobrowse.randomdan.homeip.net/</xsl:variable> + + <xsl:template match="/NewsRecent"> + <feed> + <title>Recent updates · Gentoo Browse</title> + <subtitle>News</subtitle> + <link rel="self"> + <xsl:attribute name="href"> + <xsl:value-of select="$base"/> + <xsl:text>news</xsl:text> + </xsl:attribute> + </link> + <id> + <xsl:value-of select="$base"/> + <xsl:text>news</xsl:text> + </id> + <updated> + <xsl:call-template name="atomDate"> + <xsl:with-param name="date" select="articles/article[1]/posted" /> + </xsl:call-template> + </updated> + <xsl:apply-templates select="articles/article"> + <xsl:sort select="posted" order="descending" type="string" /> + </xsl:apply-templates> + </feed> + </xsl:template> + + <xsl:template match="/NewsRecent/articles/article"> + <entry> + <title> + <xsl:value-of select="title" /> + </title> + <link rel="alternate" type="text/html"> + <xsl:attribute name="href"> + <xsl:value-of select="$base"/> + <xsl:text>news/</xsl:text> + <xsl:value-of select="newsid" /> + </xsl:attribute> + </link> + <id> + <xsl:value-of select="$base"/> + <xsl:text>news/</xsl:text> + <xsl:value-of select="newsid" /> + </id> + <updated> + <xsl:call-template name="atomDate"> + <xsl:with-param name="date" select="posted" /> + </xsl:call-template> + </updated> + <summary> + <xsl:value-of select="title" /> + </summary> + <content type="xhtml"> + <div xmlns="http://www.w3.org/1999/xhtml"> + <h1> + <xsl:value-of select="title" /> + </h1> + <xsl:for-each select="body/element"> + <p><xsl:value-of select="." /></p> + </xsl:for-each> + </div> + </content> + <author> + <name> + <xsl:value-of select="authorname" /> + </name> + <email> + <xsl:value-of select="authoremail" /> + </email> + </author> + </entry> + </xsl:template> +</xsl:stylesheet> diff --git a/gentoobrowse/xslt/news.xslt b/gentoobrowse/xslt/news.xslt new file mode 100644 index 0000000..76b5a3a --- /dev/null +++ b/gentoobrowse/xslt/news.xslt @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="head"> + <title>News · Gentoo Browse</title> + <meta name="description"> + <xsl:attribute name="content">Recent news</xsl:attribute> + </meta> + <link href="/news" type="application/atom+xml" rel="alternate" title="Recent news ATOM Feed" /> + </xsl:template> + + <xsl:template name="header"> + <h1>Recent news</h1> + </xsl:template> + + <xsl:template name="content"> + <div class="span3 bs-docs-sidebar"> + <ul class="nav nav-list bs-docs-sidenav"> + <xsl:for-each select="articles/article"> + <xsl:sort select="timestamp" data-type="text" order="descending" /> + <li> + <a> + <xsl:attribute name="href">#<xsl:value-of select="newsid" /></xsl:attribute> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="posted" /> + </xsl:call-template> + </a> + </li> + </xsl:for-each> + </ul> + </div> + <div class="span9"> + <h2 class="page-header">News</h2> + <xsl:for-each select="articles/article"> + <section> + <xsl:attribute name="id"><xsl:value-of select="newsid" /></xsl:attribute> + <h3> + <xsl:value-of select="title" /> + </h3> + <dl class="dl-horizontal"> + <dt>Posted</dt> + <dd> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="posted" /> + </xsl:call-template> + </dd> + <dt>Author</dt> + <dd> + <a> + <xsl:attribute name="href"> + mailto:<xsl:value-of select="authoremail" /> + </xsl:attribute> + <xsl:value-of select="authorname" /> + </a> + </dd> + <xsl:if test="atomspec/element"> + <dt>Applies to</dt> + <dd> + <ul> + <xsl:for-each select="atomspec/element"> + <li><xsl:value-of select="." /></li> + </xsl:for-each> + </ul> + </dd> + </xsl:if> + <dt>Details</dt> + <dd> + <a> + <xsl:attribute name="href"> + /news/<xsl:value-of select="newsid" /> + </xsl:attribute> + <xsl:value-of select="newsid" /> + </a> + </dd> + </dl> + </section> + </xsl:for-each> + </div> + </xsl:template> +</xsl:stylesheet> + diff --git a/gentoobrowse/xslt/newsitem.xslt b/gentoobrowse/xslt/newsitem.xslt new file mode 100644 index 0000000..6dcc613 --- /dev/null +++ b/gentoobrowse/xslt/newsitem.xslt @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="head"> + <title><xsl:value-of select="article/title" /> · Gentoo Browse</title> + <meta name="description"> + <xsl:attribute name="content"> + <xsl:value-of select="article/title" /> + </xsl:attribute> + </meta> + </xsl:template> + + <xsl:template name="header"> + <h1>News article</h1> + </xsl:template> + + <xsl:template name="content"> + <div class="span3 bs-docs-sidebar"> + <ul class="nav nav-list bs-docs-sidenav"> + <li> + <a> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="article/posted" /> + </xsl:call-template> + </a> + </li> + <li> + <a> + <xsl:attribute name="href"> + mailto:<xsl:value-of select="article/authoremail" /> + </xsl:attribute> + <xsl:value-of select="article/authorname" /> + </a> + </li> + </ul> + </div> + <div class="span9"> + <h2 class="page-header"> + <xsl:value-of select="article/title" /> + </h2> + <section> + <xsl:for-each select="article/body/element"> + <p> + <xsl:value-of select="." /> + </p> + </xsl:for-each> + <xsl:if test="article/atomspec/element"> + <h3>Applies to</h3> + <ul> + <xsl:for-each select="article/atomspec/element"> + <li> + <xsl:value-of select="." /> + </li> + </xsl:for-each> + </ul> + </xsl:if> + <xsl:if test="article/urls/element"> + <h3>Also see</h3> + <ul> + <xsl:for-each select="article/urls/element"> + <li> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="." /> + </xsl:attribute> + <xsl:value-of select="." /> + </a> + </li> + </xsl:for-each> + </ul> + </xsl:if> + </section> + </div> + </xsl:template> +</xsl:stylesheet> + diff --git a/gentoobrowse/xslt/package.xslt b/gentoobrowse/xslt/package.xslt index 09155d7..f435ea3 100644 --- a/gentoobrowse/xslt/package.xslt +++ b/gentoobrowse/xslt/package.xslt @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + <xsl:variable name="category" select="/gentoo/categories/category[categoryid = /gentoo/package/categoryid]" /> <xsl:template name="head"> - <title><xsl:value-of select="/gentoo/package/catname" />/<xsl:value-of select="/gentoo/package/pkgname" /> Package Details · Gentoo Browse</title> + <title><xsl:value-of select="$category/name" />/<xsl:value-of select="/gentoo/package/name" /> Package Details · Gentoo Browse</title> <meta name="description"> - <xsl:attribute name="content">Gentoo Linux package details for <xsl:value-of select="/gentoo/summary/package/catname" />/<xsl:value-of select="/gentoo/summary/package/pkgname" />: <xsl:value-of select="/gentoo/summary/package/description" /></xsl:attribute> + <xsl:attribute name="content">Gentoo Linux package details for <xsl:value-of select="$category/name" />/<xsl:value-of select="/gentoo/package/name" />: <xsl:value-of select="/gentoo/summary/package/description" /></xsl:attribute> </meta> - <xsl:if test="/gentoo/project2:session/loggedInUserID"> + <xsl:if test="/gentoo/user"> <script type="text/javascript" src="/js/pkgtracking.js" /> </xsl:if> </xsl:template> @@ -17,23 +17,17 @@ <xsl:template name="header"> <h1> <a> - <xsl:attribute name="href">/category/<xsl:value-of select="/gentoo/package/catname" /></xsl:attribute> - <xsl:attribute name="title">Other packages in the <xsl:value-of select="/gentoo/package/catname" /> category</xsl:attribute> - <xsl:value-of select="/gentoo/package/catname" /> + <xsl:attribute name="href">/packages/<xsl:value-of select="$category/name" /></xsl:attribute> + <xsl:attribute name="title">Other packages in the <xsl:value-of select="$category/name" /> category</xsl:attribute> + <xsl:value-of select="$category/name" /> </a> / - <xsl:value-of select="/gentoo/package/pkgname" /> + <xsl:value-of select="/gentoo/package/name" /> </h1> <p class="lead"> <xsl:value-of select="/gentoo/package/description" /> - <xsl:if test="/gentoo/package/herd != 'no-herd' and /gentoo/package/herd != ''"> - <small><xsl:text> </xsl:text>(<a> - <xsl:attribute name="href">/herd/<xsl:value-of select="/gentoo/package/herd" /></xsl:attribute> - <xsl:attribute name="title">Other packages in the <xsl:value-of select="/gentoo/package/herd" /> herd</xsl:attribute> - <xsl:value-of select="/gentoo/package/herd" /> herd</a>)</small> - </xsl:if> </p> - <xsl:apply-templates select="/gentoo/package/urls" /> + <xsl:apply-templates select="/gentoo/package/urls/element" /> </xsl:template> <xsl:template name="content"> @@ -43,37 +37,37 @@ <li><a href="#summary"><i class="icon-chevron-right"/>Summary</a></li> </xsl:if> <li><a href="#versions"><i class="icon-chevron-right"/>Versions</a></li> - <xsl:if test="/gentoo/package/uses/use"> + <xsl:if test="/gentoo/uses/use"> <li><a href="#uses"><i class="icon-chevron-right"/>USE flags</a></li> </xsl:if> - <xsl:if test="/gentoo/package/deps/package"> + <xsl:if test="/gentoo/dependencies/package"> <li><a href="#deps"><i class="icon-chevron-right"/>Dependencies</a></li> </xsl:if> - <xsl:if test="/gentoo/package/rdeps/package"> + <xsl:if test="/gentoo/rdependencies/package"> <li><a href="#rdeps"><i class="icon-chevron-right"/>Runtime dependencies</a></li> </xsl:if> - <xsl:if test="/gentoo/package/depees/package"> + <xsl:if test="/gentoo/depending/package"> <li><a href="#depees"><i class="icon-chevron-right"/>Depending packages</a></li> </xsl:if> - <xsl:if test="/gentoo/package/packageBugs/bug"> + <xsl:if test="/gentoo/bugs/bug"> <li><a href="#bugs"><i class="icon-chevron-right"/>Open bugs</a></li> </xsl:if> - <xsl:if test="/gentoo/package/maskdetails/mask"> + <xsl:if test="/gentoo/masks/mask"> <li><a href="#masks"><i class="icon-chevron-right"/>Masks</a></li> </xsl:if> - <xsl:if test="/gentoo/package/changelog/entry"> + <xsl:if test="/gentoo/changelog/entry"> <li><a href="#changelog"><i class="icon-chevron-right"/>Change log</a></li> </xsl:if> - <xsl:if test="/gentoo/project2:session/loggedInUserID"> + <xsl:if test="user"> <li> <a id="dotrack"> <xsl:attribute name="href">javascript:track(<xsl:value-of select="/gentoo/package/packageid" />);</xsl:attribute> - <xsl:if test="count(/gentoo/package/tracks/track) = 1"> + <xsl:if test="tracked = 'true'"> <xsl:attribute name="style">display: none</xsl:attribute> </xsl:if><i class="icon-eye-close"/>Follow</a> <a id="dountrack"> <xsl:attribute name="href">javascript:untrack(<xsl:value-of select="/gentoo/package/packageid" />);</xsl:attribute> - <xsl:if test="count(/gentoo/package/tracks/track) = 0"> + <xsl:if test="tracked = 'false'"> <xsl:attribute name="style">display: none</xsl:attribute> </xsl:if><i class="icon-eye-open"/>Unfollow</a> </li> @@ -82,14 +76,14 @@ </div> <div class="span9"> <xsl:apply-templates select="package/summary" /> - <xsl:apply-templates select="package/versions" /> - <xsl:apply-templates select="package/uses" /> - <xsl:apply-templates select="package/deps" /> - <xsl:apply-templates select="package/rdeps" /> - <xsl:apply-templates select="package/depees" /> - <xsl:apply-templates select="package/packageBugs" /> - <xsl:apply-templates select="package/maskdetails" /> - <xsl:apply-templates select="package/changelog" /> + <xsl:apply-templates select="ebuilds" /> + <xsl:apply-templates select="uses" /> + <xsl:apply-templates select="dependencies" /> + <xsl:apply-templates select="rdependencies" /> + <xsl:apply-templates select="depending" /> + <xsl:apply-templates select="bugs" /> + <xsl:apply-templates select="masks" /> + <xsl:apply-templates select="changelog" /> </div> </xsl:template> @@ -130,37 +124,42 @@ </xsl:template> <!-- Uses --> - <xsl:template match="/gentoo/package/uses"> - <xsl:if test="/gentoo/package/uses/use"> + <xsl:template match="/gentoo/uses"> + <xsl:if test="use"> <section id="uses"> <h2 class="page-header">USE flags</h2> - <xsl:if test="use[not(usegroup) and description]"> + <xsl:if test="use[not(group)]"> <h3>General</h3> <dl class="dl-horizontal"> - <xsl:apply-templates select="use[not(usegroup) and description]" /> + <xsl:apply-templates select="use[not(group)]" /> </dl> </xsl:if> - <xsl:for-each select="/gentoo/package/uses/usegroups/value"> + <xsl:for-each select="use[group != preceding-sibling::use[1]/group or not(preceding-sibling::use[1]/group)]/group"> <h3> <xsl:value-of select="." /> </h3> <dl class="dl-horizontal"> - <xsl:apply-templates select="../../use[usegroup = current() and description]" /> + <xsl:apply-templates select="../../use[group = current()]" /> </dl> </xsl:for-each> </section> </xsl:if> </xsl:template> - <xsl:template match="/gentoo/package/uses/use"> + <xsl:template match="/gentoo/uses/use"> <dt> <a> - <xsl:attribute name="href">/use/<xsl:value-of select="use" /></xsl:attribute> - <xsl:if test="not(usegroup)"> + <xsl:attribute name="href"> + <xsl:text>/use/</xsl:text> + <xsl:if test="group"> + <xsl:value-of select="group" /> + <xsl:text>_</xsl:text> + </xsl:if> <xsl:value-of select="use" /> + </xsl:attribute> + <xsl:if test="packageid"> + <xsl:attribute name="class">local</xsl:attribute> </xsl:if> - <xsl:if test="usegroup"> - <xsl:value-of select="substring(use, string-length(usegroup) + 2)" /> - </xsl:if> + <xsl:value-of select="use" /> </a> </dt> <dd> @@ -169,21 +168,21 @@ </xsl:template> <!-- Versions --> - <xsl:template match="/gentoo/package/versions"> + <xsl:template match="/gentoo/ebuilds"> <section id="versions"> <h2 class="page-header">Versions</h2> - <xsl:for-each select="version"> + <xsl:for-each select="ebuild"> <p class="lead"> v<xsl:value-of select="version" /> <span class="ebuild-minor"> :: <xsl:value-of select="slot" /> - :: <xsl:value-of select="reponame" /> + :: <xsl:value-of select="/gentoo/repos/repo[repoid = current()/repoid]/name" /> </span> - <xsl:if test="../../maskstatus/mask[ebuildid=current()/ebuildid]"> + <xsl:if test="/gentoo/masks/mask[ebuildids/element = current()/ebuildid]"> <small> (<a class="text-warning" href="#masks">Masked by set - <xsl:for-each select="../../maskstatus/mask[ebuildid=current()/ebuildid]"> - <xsl:value-of select="setno" /> + <xsl:for-each select="/gentoo/masks/mask[ebuildids/element = current()/ebuildid]"> + <xsl:value-of select="position()" /> </xsl:for-each> </a>) </small> @@ -192,35 +191,30 @@ <dl class="dl-horizontal"> <dt>Modified</dt> <dd> - <time> - <xsl:attribute name="datetime"> - <xsl:value-of select="moddate" /> - </xsl:attribute> - <xsl:value-of select="moddate/@custom" /> - <xsl:text> </xsl:text> - <xsl:value-of select="moddate/@time" /> - </time> + <xsl:call-template name="humanDateTime"> + <xsl:with-param name="date" select="moddate" /> + </xsl:call-template> </dd> <xsl:if test="license"><xsl:text> </xsl:text> <dt>License</dt> <dd><xsl:value-of select="license" /></dd> </xsl:if> - <xsl:if test="../../versionArchs/arch[ebuildid=current()/ebuildid]"> + <xsl:if test="archs/element"> <dt>Keywords</dt> <dd> - <xsl:for-each select="../../versionArchs/arch[ebuildid=current()/ebuildid]"> - <xsl:sort select="arch" /> - <xsl:value-of select="arch" /> + <xsl:for-each select="archs/element"> + <xsl:sort select="." /> + <xsl:value-of select="." /> <xsl:text> </xsl:text> </xsl:for-each> </dd> </xsl:if> - <xsl:if test="../../versionUses/use[ebuildid=current()/ebuildid and not(usegroup)]"> + <xsl:if test="uses/element[not(contains(., '_'))]"> <dt>USE flags</dt> <dd> - <xsl:for-each select="../../versionUses/use[ebuildid=current()/ebuildid and not(usegroup)]"> - <xsl:sort select="use" /> - <xsl:value-of select="use" /> + <xsl:for-each select="uses/element[not(contains(., '_'))]"> + <xsl:sort select="." /> + <xsl:value-of select="." /> <xsl:text> </xsl:text> </xsl:for-each> </dd> @@ -231,50 +225,54 @@ </xsl:template> <!-- Package bugs --> - <xsl:template match="/gentoo/package/packageBugs"> - <xsl:if test="/gentoo/package/packageBugs/bug"> + <xsl:template match="/gentoo/bugs"> + <xsl:if test="bug"> <section id="bugs"> <h2 class="page-header">Bugs</h2> - <xsl:for-each select="bug"> - <p> - <a> - <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute> - <xsl:value-of select="bugid" /> - </a> - : - <xsl:value-of select="summary" /> - </p> - </xsl:for-each> + <dl class="dl-horizontal"> + <xsl:for-each select="bug"> + <dt> + <a> + <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute> + <xsl:value-of select="bugid" /> + </a> + </dt> + <dd> + <xsl:value-of select="summary" /> + </dd> + </xsl:for-each> + </dl> </section> </xsl:if> </xsl:template> <!-- Change log --> - <xsl:template match="/gentoo/package/changelog"> - <xsl:if test="/gentoo/package/changelog/entry"> + <xsl:template match="/gentoo/changelog"> + <xsl:if test="entry[authoremail != 'repo-qa-checks@gentoo.org']"> <section id="changelog"> <h2 class="page-header">Change logs</h2> <dl class="dl-horizontal"> - <xsl:for-each select="entry"> + <xsl:for-each select="entry[authoremail != 'repo-qa-checks@gentoo.org']"> <dt> - <time> - <xsl:attribute name="datetime"> - <xsl:value-of select="date/@date" /> - </xsl:attribute> - <xsl:value-of select="date/@custom" /> - </time> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="committime" /> + </xsl:call-template> </dt> <dd> <a> <xsl:attribute name="href"> - mailto:<xsl:value-of select="email" /> + mailto:<xsl:value-of select="authoremail" /> </xsl:attribute> - <xsl:value-of select="person" /> + <xsl:value-of select="authorname" /> </a> - <span class="repo"> · <xsl:value-of select="reponame" /></span> + <span class="repo"> · <xsl:value-of select="/gentoo/repos/repo[repoid = current()/repoid]/name" /></span> <br /> - <xsl:value-of select="comment" /> + <xsl:value-of select="summary" /> + <xsl:if test="body"> + <br /> + <xsl:value-of select="body" /> + </xsl:if> </dd> </xsl:for-each> </dl> @@ -283,54 +281,71 @@ </xsl:template> <!-- Package dependencies --> - <xsl:template match="/gentoo/package/deps"> - <xsl:if test="/gentoo/package/deps/package"> + <xsl:template match="/gentoo/dependencies"> + <xsl:if test="package"> <section id="deps"> <h2 class="page-header">Dependencies</h2> - <xsl:apply-templates match="/gentoo/package/deps/package" /> + <xsl:apply-templates match="package"> + <xsl:sort select="/gentoo/categories/category[categoryid = current()/categoryid]/name" /> + <xsl:sort select="name" /> + </xsl:apply-templates> </section> </xsl:if> </xsl:template> <!-- Package runtime dependencies --> - <xsl:template match="/gentoo/package/rdeps"> - <xsl:if test="/gentoo/package/rdeps/package"> + <xsl:template match="/gentoo/rdependencies"> + <xsl:if test="package"> <section id="rdeps"> <h2 class="page-header">Runtime Dependencies</h2> - <xsl:apply-templates match="/gentoo/package/rdeps/package" /> + <xsl:apply-templates match="package"> + <xsl:sort select="/gentoo/categories/category[categoryid = current()/categoryid]/name" /> + <xsl:sort select="name" /> + </xsl:apply-templates> </section> </xsl:if> </xsl:template> <!-- Depending packages --> - <xsl:template match="/gentoo/package/depees"> - <xsl:if test="/gentoo/package/depees/package"> + <xsl:template match="/gentoo/depending"> + <xsl:if test="package"> <section id="depees"> <h2 class="page-header">Depending packages</h2> - <xsl:apply-templates match="/gentoo/package/depees/package" /> + <xsl:apply-templates match="package"> + <xsl:sort select="/gentoo/categories/category[categoryid = current()/categoryid]/name" /> + <xsl:sort select="name" /> + </xsl:apply-templates> </section> </xsl:if> </xsl:template> <!-- Package mask details --> - <xsl:template match="/gentoo/package/maskdetails"> - <xsl:if test="/gentoo/package/maskdetails/mask"> + <xsl:template match="/gentoo/masks"> + <xsl:if test="mask"> <section id="masks"> <h2 class="page-header">Masks</h2> <dl class="dl-horizontal"> <xsl:for-each select="mask"> <dt> - <time> - <xsl:attribute name="datetime"> - <xsl:value-of select="dateadded" /> - </xsl:attribute> - <xsl:value-of select="dateadded/@custom" /> - </time> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="dateadded" /> + </xsl:call-template> </dt> <dd> - <xsl:value-of select="person" /> + <a> + <xsl:attribute name="href">mailto:<xsl:value-of select="email" /></xsl:attribute> + <xsl:value-of select="person" /> + </a> <br /> <xsl:value-of select="message" /> + <br /> + <ul> + <xsl:for-each select="atomspec/element"> + <li> + <xsl:value-of select="." /> + </li> + </xsl:for-each> + </ul> </dd> </xsl:for-each> </dl> diff --git a/gentoobrowse/xslt/popular.xslt b/gentoobrowse/xslt/popular.xslt index d683573..9e11307 100644 --- a/gentoobrowse/xslt/popular.xslt +++ b/gentoobrowse/xslt/popular.xslt @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> @@ -11,41 +10,50 @@ </meta> </xsl:template> + <xsl:variable name="categories" select="/gentoo/categories/category[categoryid = /gentoo/packages/package/categoryid]" /> + <xsl:template name="header"> <h1>Popular packages</h1> <p class="lead"> <xsl:value-of select="count(/gentoo/packages/package)" /> most popular tracked packages in - <xsl:value-of select="count(/gentoo/packages/categories/value)" /> + <xsl:value-of select="count($categories)" /> categories. </p> </xsl:template> - + <xsl:template name="content"> + <xsl:apply-templates select="/gentoo/categories" /> <xsl:apply-templates select="/gentoo/packages" /> </xsl:template> - <xsl:template match="/gentoo/packages"> + <xsl:template match="/gentoo/categories"> <div class="span3 bs-docs-sidebar"> <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="categories/value"> + <xsl:for-each select="$categories"> <li> <a> - <xsl:attribute name="href">#<xsl:value-of select="." /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="." /> + <xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute> + <i class="icon-chevron-right"></i> <xsl:value-of select="name" /> </a> </li> </xsl:for-each> </ul> </div> + </xsl:template> + + <xsl:template match="/gentoo/packages"> <div class="span9"> - <xsl:for-each select="categories/value"> + <xsl:for-each select="$categories"> <section> - <xsl:attribute name="id"><xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="id"><xsl:value-of select="name" /></xsl:attribute> <h2 class="page-header"> - <xsl:value-of select="." /> + <xsl:value-of select="name" /> </h2> - <xsl:apply-templates select="/gentoo/packages/package[catname = current()/.]" /> + <p> + <xsl:value-of select="summary" /> + </p> + <xsl:apply-templates select="/gentoo/packages/package[categoryid = current()/categoryid]" /> </section> </xsl:for-each> </div> diff --git a/gentoobrowse/xslt/search.xslt b/gentoobrowse/xslt/search.xslt index 644a906..5ec8c83 100644 --- a/gentoobrowse/xslt/search.xslt +++ b/gentoobrowse/xslt/search.xslt @@ -1,41 +1,50 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> <xsl:template name="head"> - <title>Search results for "<xsl:value-of select="/gentoo/project2:params/criteria"/>" · Gentoo Browse</title> + <title>Search results for "<xsl:value-of select="/gentoo/query"/>" · Gentoo Browse</title> </xsl:template> - + <xsl:template name="header"> <h1>Search results</h1> <p class="lead"> - <xsl:value-of select="count(/gentoo/searchResults/package)" /> packages, - <xsl:value-of select="count(/gentoo/bugSearchResults/bug)" /> bugs + <xsl:value-of select="count(/gentoo/packages/package)" /> packages, + <xsl:value-of select="count(/gentoo/uses/use)" /> use flags, + <xsl:value-of select="count(/gentoo/bugs/bug)" /> bugs, + <xsl:value-of select="count(/gentoo/news/article)" /> news articles </p> <xsl:apply-templates select="/gentoo/package/urls" /> </xsl:template> <xsl:template name="content"> <div class="span3 bs-docs-sidebar"> - <xsl:if test="/gentoo/searchResults|bugSearchResults/*"> + <xsl:if test="/gentoo/packages|bugs|news/*"> <ul class="nav nav-list bs-docs-sidenav"> - <xsl:if test="/gentoo/searchResults/*"> + <xsl:if test="/gentoo/packages/*"> <li><a href="#packages"><i class="icon-chevron-right"></i>Packages</a></li> </xsl:if> - <xsl:if test="/gentoo/bugSearchResults/*"> + <xsl:if test="/gentoo/uses/*"> + <li><a href="#uses"><i class="icon-chevron-right"></i>Use flags</a></li> + </xsl:if> + <xsl:if test="/gentoo/bugs/*"> <li><a href="#bugs"><i class="icon-chevron-right"></i>Bugs</a></li> </xsl:if> + <xsl:if test="/gentoo/news/*"> + <li><a href="#news"><i class="icon-chevron-right"></i>News</a></li> + </xsl:if> </ul> </xsl:if> </div> <div class="span9"> - <xsl:if test="/gentoo/searchResults/*|/gentoo/bugSearchResults/*"> - <xsl:apply-templates select="/gentoo/searchResults" /> - <xsl:apply-templates select="/gentoo/bugSearchResults" /> + <xsl:if test="/gentoo/packages|uses|bugs|news/*"> + <xsl:apply-templates select="/gentoo/packages" /> + <xsl:apply-templates select="/gentoo/uses" /> + <xsl:apply-templates select="/gentoo/bugs" /> + <xsl:apply-templates select="/gentoo/news" /> </xsl:if> - <xsl:if test="not(/gentoo/searchResults/*|/gentoo/bugSearchResults/*)"> + <xsl:if test="not(/gentoo/packages/*|/gentoo/uses/*|/gentoo/bugs/*|/gentoo/news/*)"> <section id="nothing"> <h2 class="page-header">Sorry</h2> <p class="text-warning">Nothing found matching your search terms.</p> @@ -43,9 +52,9 @@ </xsl:if> </div> </xsl:template> - - <xsl:template match="/gentoo/searchResults"> - <xsl:if test="/gentoo/searchResults/*"> + + <xsl:template match="/gentoo/packages"> + <xsl:if test="package"> <section id="packages"> <h2 class="page-header">Packages</h2> <xsl:apply-templates select="package" /> @@ -53,21 +62,70 @@ </xsl:if> </xsl:template> - <xsl:template match="/gentoo/bugSearchResults"> - <xsl:if test="/gentoo/bugSearchResults/*"> + <xsl:template match="/gentoo/uses"> + <xsl:if test="use"> + <section id="uses"> + <h2 class="page-header">Use flags</h2> + <dl class="dl-horizontal"> + <xsl:for-each select="use"> + <dt> + <a> + <xsl:attribute name="href">/use/<xsl:value-of select="use" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="description" /></xsl:attribute> + <xsl:value-of select="use" /> + </a> + </dt> + <dd> + <xsl:value-of select="description" /> + </dd> + </xsl:for-each> + </dl> + </section> + </xsl:if> + </xsl:template> + + <xsl:template match="/gentoo/bugs"> + <xsl:if test="bug"> <section id="bugs"> <h2 class="page-header">Bugs</h2> - <xsl:for-each select="bug"> - <p> - <a> - <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute> - <xsl:value-of select="bugid" /> - </a> - : - <xsl:value-of select="summary" /> - </p> - </xsl:for-each> + <dl class="dl-horizontal"> + <xsl:for-each select="bug"> + <dt> + <a> + <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute> + <xsl:value-of select="bugid" /> + </a> + </dt> + <dd> + <xsl:value-of select="summary" /> + </dd> + </xsl:for-each> + </dl> + </section> + </xsl:if> + </xsl:template> + + <xsl:template match="/gentoo/news"> + <xsl:if test="article"> + <section id="news"> + <h2 class="page-header">News</h2> + <dl class="dl-horizontal"> + <xsl:for-each select="article"> + <dt> + <xsl:call-template name="humanDate"> + <xsl:with-param name="date" select="posted" /> + </xsl:call-template> + </dt> + <dd> + <a> + <xsl:attribute name="href">/news/<xsl:value-of select="newsid" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="title" /></xsl:attribute> + <xsl:value-of select="title" /> + </a> + </dd> + </xsl:for-each> + </dl> </section> </xsl:if> </xsl:template> diff --git a/gentoobrowse/xslt/sitemap.xslt b/gentoobrowse/xslt/sitemap.xslt index 28cbc70..a30df8c 100644 --- a/gentoobrowse/xslt/sitemap.xslt +++ b/gentoobrowse/xslt/sitemap.xslt @@ -1,36 +1,43 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > - <xsl:output encoding="utf-8" method="xml" media-type="text/xml" indent="yes" /> +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:date="http://exslt.org/dates-and-times" version="1.0" exclude-result-prefixes="date"> + <xsl:output encoding="utf-8" method="xml" media-type="text/xml" indent="yes"/> + <xsl:variable name="base">http://gentoobrowse.randomdan.homeip.net/</xsl:variable> <xsl:template match="/gentoo"> - <urlset> - <url> - <loc>http://gentoobrowse.randomdan.homeip.net/</loc> - <changefreq>daily</changefreq> - </url> - <url> - <loc>http://gentoobrowse.randomdan.homeip.net/popular</loc> - <changefreq>weekly</changefreq> - </url> - <url> - <loc>http://gentoobrowse.randomdan.homeip.net/categories</loc> - <changefreq>monthly</changefreq> - </url> - <xsl:for-each select="packages/package"> - <url> - <loc>http://gentoobrowse.randomdan.homeip.net/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></loc> - <lastmod><xsl:value-of select="moddate/@date" /></lastmod> - <changefreq>weekly</changefreq> - </url> - </xsl:for-each> - <xsl:for-each select="categories/category"> - <url> - <loc>http://gentoobrowse.randomdan.homeip.net/category/<xsl:value-of select="catname" /></loc> - <lastmod><xsl:value-of select="pkgfirstseen/@date" /></lastmod> - <changefreq>daily</changefreq> - </url> - </xsl:for-each> - </urlset> - </xsl:template> + <urlset> + <url> + <loc><xsl:value-of select="$base"/></loc> + <changefreq>daily</changefreq> + </url> + <url> + <loc><xsl:value-of select="$base"/>packages</loc> + <changefreq>monthly</changefreq> + </url> + <url> + <loc><xsl:value-of select="$base"/>packages/popular</loc> + <changefreq>weekly</changefreq> + </url> + <xsl:for-each select="categories/category"> + <xsl:sort select="detail/name"/> + <xsl:variable name="category" select="detail"/> + <url> + <loc><xsl:value-of select="$base"/>packages/<xsl:value-of select="$category/name"/></loc> + <lastmod> + <xsl:value-of select="date:date($category/lastaddition)"/> + </lastmod> + <changefreq>daily</changefreq> + </url> + <xsl:for-each select="packages/package"> + <xsl:sort select="name"/> + <url> + <loc><xsl:value-of select="$base"/>packages/<xsl:value-of select="$category/name"/>/<xsl:value-of select="name"/></loc> + <changefreq>weekly</changefreq> + </url> + </xsl:for-each> + </xsl:for-each> + <url> + <loc><xsl:value-of select="$base"/>news</loc> + <changefreq>daily</changefreq> + </url> + </urlset> + </xsl:template> </xsl:stylesheet> - diff --git a/gentoobrowse/xslt/use-detail.xslt b/gentoobrowse/xslt/use-detail.xslt new file mode 100644 index 0000000..6d114ce --- /dev/null +++ b/gentoobrowse/xslt/use-detail.xslt @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="head"> + <title>Packages with the <xsl:value-of select="/gentoo/usage/use[1]/use" /> use flag · Gentoo Browse</title> + <meta name="description"> + <xsl:attribute name="content">Packages with the <xsl:value-of select="/gentoo/usage/use[1]/use" /> use flag</xsl:attribute> + </meta> + </xsl:template> + + <xsl:template name="header"> + <h1> + Packages with the + <xsl:call-template name="split"> + <xsl:with-param name="pText" select="/gentoo/usage/use[1]/use" /> + <xsl:with-param name="pBy" select="'_'" /> + </xsl:call-template> + use flag + </h1> + <xsl:if test="/gentoo/usage/use[not(packageid)]"> + <p class="lead">Global definition: <xsl:value-of select="/gentoo/usage/use[not(packageid)]/description" />.</p> + </xsl:if> + </xsl:template> + + <xsl:template name="content"> + <xsl:apply-templates select="/gentoo/usage" /> + </xsl:template> + + <xsl:template match="/gentoo/usage"> + <xsl:variable name="categories" select="/gentoo/categories/category[categoryid = /gentoo/packages/package/categoryid]" /> + <div class="span3 bs-docs-sidebar"> + <ul class="nav nav-list bs-docs-sidenav"> + <xsl:for-each select="$categories"> + <li> + <a> + <xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute> + <i class="icon-chevron-right"></i> <xsl:value-of select="name" /> + </a> + </li> + </xsl:for-each> + </ul> + </div> + <div class="span9"> + <xsl:for-each select="$categories"> + <section> + <xsl:attribute name="id"><xsl:value-of select="name" /></xsl:attribute> + <h2 class="page-header"> + <xsl:value-of select="name" /> + </h2> + <xsl:apply-templates select="/gentoo/packages/package[categoryid = current()/categoryid]" /> + </section> + </xsl:for-each> + </div> + </xsl:template> +</xsl:stylesheet> + diff --git a/gentoobrowse/xslt/use.xslt b/gentoobrowse/xslt/use.xslt index 4fecc13..e8c5ea8 100644 --- a/gentoobrowse/xslt/use.xslt +++ b/gentoobrowse/xslt/use.xslt @@ -1,55 +1,57 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="base.xslt" /> <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> <xsl:template name="head"> - <title>Packages with the <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> USE flag · Gentoo Browse</title> - <meta name="description"> - <xsl:attribute name="content">Packages with the <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> USE flag</xsl:attribute> - </meta> + <title>Use flag index · Gentoo Browse</title> + <meta name="description">Use flag index</meta> </xsl:template> <xsl:template name="header"> - <h1> - Packages with the - <xsl:call-template name="split"> - <xsl:with-param name="pText" select="/gentoo/project2:uriElems/uriElem[2]" /> - <xsl:with-param name="pBy" select="'_'" /> - </xsl:call-template> - USE flag - </h1> - <xsl:if test="/gentoo/global/use"> - <p class="lead">Global definition: <xsl:value-of select="/gentoo/global/use/description" />.</p> - </xsl:if> + <h1>Use flag index</h1> </xsl:template> <xsl:template name="content"> - <xsl:apply-templates select="/gentoo/packages" /> + <xsl:apply-templates select="/gentoo/uses" /> </xsl:template> - <xsl:template match="/gentoo/packages"> + <xsl:template match="/gentoo/uses"> + <xsl:variable name="firsts" select="use[substring(use, 1, 1) != substring(preceding-sibling::use[1]/use, 1, 1)]" /> <div class="span3 bs-docs-sidebar"> <ul class="nav nav-list bs-docs-sidenav"> - <xsl:for-each select="categories/value"> + <xsl:for-each select="$firsts"> + <xsl:variable name="char" select="substring(use, 1, 1)" /> <li> <a> - <xsl:attribute name="href">#<xsl:value-of select="." /></xsl:attribute> - <i class="icon-chevron-right"></i> <xsl:value-of select="." /> + <xsl:attribute name="href">#<xsl:value-of select="$char" /></xsl:attribute> + <i class="icon-chevron-right"></i> <xsl:value-of select="$char" /> </a> </li> </xsl:for-each> </ul> </div> <div class="span9"> - <xsl:for-each select="categories/value"> + <xsl:for-each select="$firsts"> + <xsl:variable name="char" select="substring(use, 1, 1)" /> <section> - <xsl:attribute name="id"><xsl:value-of select="." /></xsl:attribute> + <xsl:attribute name="id"><xsl:value-of select="$char" /></xsl:attribute> <h2 class="page-header"> - <xsl:value-of select="." /> + <xsl:value-of select="$char" /> </h2> - <xsl:apply-templates select="/gentoo/packages/package[catname = current()/.]" /> + <dl class="dl-horizontal"> + <xsl:for-each select="../use[substring(use, 1, 1) = $char]"> + <dt> + <a> + <xsl:attribute name="href">/use/<xsl:value-of select="use" /></xsl:attribute> + <xsl:value-of select="use" /> + </a> + </dt> + <dd> + <xsl:value-of select="description" /> + </dd> + </xsl:for-each> + </dl> </section> </xsl:for-each> </div> diff --git a/gentoobrowse/xslt/user-atom.xslt b/gentoobrowse/xslt/user-atom.xslt new file mode 100644 index 0000000..e1dcdf4 --- /dev/null +++ b/gentoobrowse/xslt/user-atom.xslt @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/2005/Atom"> + <xsl:import href="atom.xslt" /> + <xsl:output encoding="utf-8" method="xml" media-type="application/atom+xml" indent="yes" /> + + <xsl:template match="/*"> + <feed> + <title>Recent updates · Gentoo Browse</title> + <subtitle>Packages</subtitle> + <link href="http://gentoobrowse.randomdan.homeip.net/" rel="self" /> + <id>http://gentoobrowse.randomdan.homeip.net/</id> + <updated> + <xsl:call-template name="atomDate"> + <xsl:with-param name="date" select="versions/ebuild[1]/firstseen" /> + </xsl:call-template> + </updated> + <xsl:apply-templates select="versions/ebuild"> + <xsl:sort select="firstseen" order="descending" type="text" /> + </xsl:apply-templates> + </feed> + </xsl:template> + + <xsl:template match="ebuild"> + <xsl:variable name="package" select="../../packages/package[packageid = current()/packageid]" /> + <xsl:variable name="category" select="../../categories/category[categoryid = $package/categoryid]" /> + <entry> + <title> + <xsl:value-of select="$category/name" />/<xsl:value-of select="$package/name" /> + </title> + <link rel="alternate" type="text/html"> + <xsl:attribute name="href"> + <xsl:text>http://gentoobrowse.randomdan.homeip.net/packages/</xsl:text> + <xsl:value-of select="$category/name" /> + <xsl:text>/</xsl:text> + <xsl:value-of select="$package/name" /> + </xsl:attribute> + </link> + <id> + <xsl:text>http://gentoobrowse.randomdan.homeip.net/packages/</xsl:text> + <xsl:value-of select="$category/name" /> + <xsl:text>/</xsl:text> + <xsl:value-of select="$package/name" /> + <xsl:text>/</xsl:text> + <xsl:value-of select="version" /> + </id> + <updated> + <xsl:call-template name="atomDate"> + <xsl:with-param name="date" select="moddate" /> + </xsl:call-template> + </updated> + <summary> + <xsl:value-of select="$package/description" /> + </summary> + <author> + <name> + <xsl:value-of select="$package/maintainername" /> + </name> + <email> + <xsl:value-of select="$package/maintainer" /> + </email> + </author> + </entry> + </xsl:template> +</xsl:stylesheet> + diff --git a/gentoobrowse/xslt/user-home.xslt b/gentoobrowse/xslt/user-home.xslt new file mode 100644 index 0000000..0a8b856 --- /dev/null +++ b/gentoobrowse/xslt/user-home.xslt @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn"> + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="header"> + <h1>Account Home</h1> + </xsl:template> + + <xsl:template name="content"> + <div class="span3 bs-docs-sidebar"> + <ul class="nav nav-list bs-docs-sidenav"> + <li> + <a href="/user/tracked">Tracked packages</a> + </li> + <li> + <a href="/user/logout">Log out</a> + </li> + </ul> + </div> + </xsl:template> + +</xsl:stylesheet> diff --git a/gentoobrowse/xslt/user-signup.xslt b/gentoobrowse/xslt/user-signup.xslt new file mode 100644 index 0000000..dc1f41a --- /dev/null +++ b/gentoobrowse/xslt/user-signup.xslt @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="head"> + <title>Sign up · Gentoo Browse</title> + </xsl:template> + + <xsl:template name="header"> + <h1>Your Gentoo Browse</h1> + <p class="lead">Customise what you like and what you want to hear about.</p> + </xsl:template> + + <xsl:template name="content"> + <div class="span3 bs-docs-sidebar"/> + <div class="span9"> + <xsl:call-template name="form"> + <xsl:with-param name="form"> + <form action="/user/signup" method="post" caption="Sign up" submit="Sign up"> + <input type="text" name="username" caption="User name" required="required"/> + <input type="email" name="email" caption="Email address" required="required"/> + <input type="text" name="realname" caption="Real name" required="required"/> + <input type="password" name="password" caption="Password" required="required"/> + </form> + </xsl:with-param> + </xsl:call-template> + </div> + </xsl:template> +</xsl:stylesheet> diff --git a/gentoobrowse/xslt/user-tracked.xslt b/gentoobrowse/xslt/user-tracked.xslt new file mode 100644 index 0000000..0b25658 --- /dev/null +++ b/gentoobrowse/xslt/user-tracked.xslt @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn"> + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="header"> + <h1>Tracked packages</h1> + </xsl:template> + + <xsl:template name="content"> + <xsl:variable name="categories" select="categories/category[categoryid = /gentoo/packages/package/categoryid]"/> + <div class="span3 bs-docs-sidebar"> + <ul class="nav nav-list bs-docs-sidenav"> + <xsl:for-each select="$categories"> + <li> + <a> + <xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute> + <i class="icon-chevron-right"></i> <xsl:value-of select="name" /> + </a> + </li> + </xsl:for-each> + </ul> + </div> + <div class="span9"> + <xsl:for-each select="$categories"> + <section> + <xsl:attribute name="id"><xsl:value-of select="name" /></xsl:attribute> + <h2 class="page-header"> + <xsl:value-of select="name" /> + </h2> + <xsl:apply-templates select="/gentoo/packages/package[categoryid = current()/categoryid]" /> + </section> + </xsl:for-each> + </div> + </xsl:template> +</xsl:stylesheet> diff --git a/gentoobrowse/xslt/user-verification.xslt b/gentoobrowse/xslt/user-verification.xslt new file mode 100644 index 0000000..837fb9a --- /dev/null +++ b/gentoobrowse/xslt/user-verification.xslt @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:import href="base.xslt" /> + <xsl:import href="form.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" /> + + <xsl:template name="head"> + <title>Verification · Gentoo Browse</title> + </xsl:template> + + <xsl:template name="header"> + <h1>Your Gentoo Browse</h1> + <p class="lead">Verification of your email address.</p> + </xsl:template> + + <xsl:template name="content"> + <div class="span3 bs-docs-sidebar"/> + <div class="span9"> + <xsl:call-template name="form"> + <xsl:with-param name="form"> + <form action="/user/verification" method="POST" caption="Verification" submit="Verify"> + <input type="text" name="username" caption="User name"/> + <input type="text" name="guid" caption="Token"/> + </form> + </xsl:with-param> + </xsl:call-template> + </div> + </xsl:template> +</xsl:stylesheet> |