diff options
34 files changed, 445 insertions, 328 deletions
diff --git a/gentoobrowse/checks/loggedIn.xml b/gentoobrowse/checks/loggedIn.xml index 7e83515..0b120c2 100644 --- a/gentoobrowse/checks/loggedIn.xml +++ b/gentoobrowse/checks/loggedIn.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <project2:regexcheck xmlns:project2="http://project2.randomdan.homeip.net" apply-to="%loggedInUserID|" present="login" name="loggedIn"> - <regex>.</regex> + <regex>[1-9][0-9]*</regex> <message>Not logged in</message> </project2:regexcheck> diff --git a/gentoobrowse/console/bugimport.xml b/gentoobrowse/console/bugimport.xml index 090caba..738a62f 100644 --- a/gentoobrowse/console/bugimport.xml +++ b/gentoobrowse/console/bugimport.xml @@ -2,15 +2,19 @@ <bugimport name="bugimport" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres.xml" /> + <project2:procrows name="bugsourceUnc" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" + path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-UNCONFIRMED.htmlgz" /> + <project2:procrows name="bugsourceAss" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" + path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-ASSIGNED.htmlgz" /> + <project2:procrows name="bugsourceROp" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" + path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-REOPENED.htmlgz" /> + <project2:procrows name="bugsourceNew" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" + path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-NEW.htmlgz" /> <project2:sqlmerge name="bugimport" datasource="postgres" targettable="bugs"> - <project2:prociterate name="bugsourceUnc" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" - path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-UNCONFIRMED.htmlgz" /> - <project2:prociterate name="bugsourceAss" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" - path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-ASSIGNED.htmlgz" /> - <project2:prociterate name="bugsourceROp" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" - path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-REOPENED.htmlgz" /> - <project2:prociterate name="bugsourceNew" newline=" " encoding="utf-8" fieldSep="," quoteChar=""" - path="xsltproc -novalid console/bugs.xslt http://bugs.gentoo.org/data/cached/buglist-NEW.htmlgz" /> + <project2:iterate name="Unc" source="bugsourceUnc" /> + <project2:iterate name="Ass" source="bugsourceAss" /> + <project2:iterate name="ROp" source="bugsourceROp" /> + <project2:iterate name="New" source="bugsourceNew" /> <columns> <column key="true">bugid</column> <column>severity</column> diff --git a/gentoobrowse/console/emailebuilds.xml b/gentoobrowse/console/emailebuilds.xml index 7df144f..051b78c 100644 --- a/gentoobrowse/console/emailebuilds.xml +++ b/gentoobrowse/console/emailebuilds.xml @@ -2,7 +2,7 @@ <emailebuild name="emailebuild" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres.xml" /> - <project2:sqliterate name="users" recordname="user" datasource="postgres"> + <project2:sqlrows name="usersToEmail" datasource="postgres"> <sql> select ut.userid, ut.useremail from (select e.ebuildid, u.userid, u.useremail @@ -14,6 +14,8 @@ where ebe.userid is null group by ut.userid, ut.useremail </sql> + </project2:sqlrows> + <project2:iterate name="users" source="usersToEmail"> <project2:sendmail to="^useremail" server="smtp.random.lan:25" subject="Gentoo Browse - New package versions" present="newpackageversions" from="noreply@gentoobrowse.randomdan.homeip.net" /> <project2:sqltask datasource="postgres"> @@ -31,10 +33,10 @@ where ebe.userid is null </sql> <parameters> - <param bind="0" value="^userid" /> + <param name="0" value="^userid" /> </parameters> </project2:sqltask> - </project2:sqliterate> + </project2:iterate> </emailebuild> diff --git a/gentoobrowse/console/fileimport.xml b/gentoobrowse/console/fileimport.xml index 5d326e9..b65573f 100644 --- a/gentoobrowse/console/fileimport.xml +++ b/gentoobrowse/console/fileimport.xml @@ -2,22 +2,26 @@ <packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres.xml" /> + <project2:sqlrows name="fileTypes" datasource="postgres"> + <sql> + SELECT filetypeid, searchroot, LENGTH(searchroot) + 1 || '-' AS rootlen, searchspec + FROM filetypes + ORDER BY filetypeid DESC + </sql> + </project2:sqlrows> + <project2:procrows name="findCacheFiles" newline=" " encoding="ascii" fieldSep="|" quoteChar="" + path="*find ^searchroot ^searchspec -printf "%p|%t\n" | cut -b ^rootlen | sed 's#^# ^filetypeid |#'" > + <columns> + <column>filetypeid</column> + <column>filename</column> + <column>moddate</column> + </columns> + </project2:procrows> + <project2:sqlmerge name="files" datasource="postgres" targettable="files"> - <project2:sqliterate name="filetypes" datasource="postgres"> - <sql> - SELECT filetypeid, searchroot, LENGTH(searchroot) + 1 || '-' AS rootlen, searchspec - FROM filetypes - ORDER BY filetypeid DESC - </sql> - <project2:prociterate name="findCacheFiles" newline=" " encoding="ascii" fieldSep="|" quoteChar="" - path="*find ^searchroot ^searchspec -printf "%p|%t\n" | cut -b ^rootlen | sed 's#^# ^filetypeid |#'" > - <columns> - <column>filetypeid</column> - <column>filename</column> - <column>moddate</column> - </columns> - </project2:prociterate> - </project2:sqliterate> + <project2:iterate name="eachFileType" source="fileTypes"> + <project2:iterate name="eachCacheFile" source="findCacheFiles" /> + </project2:iterate> <columns> <column key="true">filename</column> <column>moddate</column> @@ -25,31 +29,36 @@ </columns> </project2:sqlmerge> + <project2:sqlrows name="outDatedFiles" datasource="postgres"> + <sql> + SELECT f.fileid, ft.searchroot || f.filename AS filename, f.cachedat, f.moddate + FROM files f, filetypes ft + WHERE (f.cachedat IS NULL OR f.cachedat != f.moddate) + AND f.filetypeid = ft.filetypeid + ORDER BY f.fileid + </sql> + </project2:sqlrows> + <project2:procrows name="readFileContent" newline=" " encoding="utf-8" fieldSep="|" quoteChar="" + path="*grep -n . ^filename | sed -e 's#:#|#' -e 's#^# ^fileid |#'" > + <columns> + <column>fileid</column> + <column>line</column> + <column>content</column> + </columns> + </project2:procrows> + <project2:sqlmerge name="loadCacheContent" datasource="postgres" targettable="filecache" updatewhere="*a.fileid IN (SELECT o.fileid FROM files o WHERE o.cachedat IS NULL OR o.cachedat != o.moddate)"> - <project2:sqliterate name="outDatadFiles" datasource="postgres"> - <sql> - SELECT f.fileid, ft.searchroot || f.filename AS filename, f.cachedat, f.moddate - FROM files f, filetypes ft - WHERE (f.cachedat IS NULL OR f.cachedat != f.moddate) - AND f.filetypeid = ft.filetypeid - ORDER BY f.fileid; - </sql> - <project2:prociterate name="readFileContent" newline=" " encoding="utf-8" fieldSep="|" quoteChar="" - path="*grep -n . ^filename | sed -e 's#:#|#' -e 's#^# ^fileid |#'" > - <columns> - <column>fileid</column> - <column>line</column> - <column>content</column> - </columns> - </project2:prociterate> - </project2:sqliterate> + <project2:iterate name="eachOutDatedFile" source="outDatedFiles"> + <project2:iterate name="eachFileContent" source="readFileContent" /> + </project2:iterate> <columns> <column key="true">fileid</column> <column key="true">line</column> <column>content</column> </columns> </project2:sqlmerge> + <project2:sqltask name="setCachedTime" datasource="postgres"> <sql>UPDATE files SET cachedat = moddate WHERE cachedat != moddate OR cachedat IS NULL</sql> </project2:sqltask> diff --git a/gentoobrowse/emails/newpackageversions.xml b/gentoobrowse/emails/newpackageversions.xml index f65a2de..45bba93 100644 --- a/gentoobrowse/emails/newpackageversions.xml +++ b/gentoobrowse/emails/newpackageversions.xml @@ -2,7 +2,7 @@ <view root="newpackageversions" style="emails/newpackageversions.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres.xml" /> - <project2:sqlview name="newpackageversions" recordname="version" datasource="postgres"> + <project2:sqlrows name="newpackageversions" datasource="postgres"> <sql> select ut.cname, ut.pname, ut.version from ( @@ -10,7 +10,7 @@ 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 = ? + 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 @@ -18,9 +18,11 @@ where ebe.userid is null order by ut.cname, ut.pname, ut.version </sql> + </project2:sqlrows> + <project2:view name="newpackageversionsforuser" source="newpackageversions" rootname="newpackageversions" recordname="version"> <parameters> - <param bind="0" value="^userid" /> + <param name="userid" value="^^userid" /> </parameters> - </project2:sqlview> + </project2:view> </view> diff --git a/gentoobrowse/emails/newpackageversions.xslt b/gentoobrowse/emails/newpackageversions.xslt index 67301db..e5e23be 100644 --- a/gentoobrowse/emails/newpackageversions.xslt +++ b/gentoobrowse/emails/newpackageversions.xslt @@ -14,7 +14,10 @@ <ul> <xsl:for-each select="newpackageversions/version"> <li> - <xsl:value-of select="cname"/>/<xsl:value-of select="pname"/>-<xsl:value-of select="version"/> + <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="cname"/>/<xsl:value-of select="pname"/>-<xsl:value-of select="version"/> + </a> </li> </xsl:for-each> </ul> diff --git a/gentoobrowse/emails/welcome.xml b/gentoobrowse/emails/welcome.xml index 09d2c3d..ad48f66 100644 --- a/gentoobrowse/emails/welcome.xml +++ b/gentoobrowse/emails/welcome.xml @@ -1,16 +1,18 @@ <?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"> - <xi:include href="../datasources/postgres.xml" /> - <project2:sqlview name="verifyguids" recordname="verifyguid" datasource="postgres"> + <xi:include href="../datasources/postgres-web.xml" /> + <project2:sqlrows name="verifyguidsbyemail" datasource="postgres-web"> <sql> SELECT userid, CAST(verifyguid AS TEXT) AS guid FROM users u - WHERE useremail = ? + WHERE useremail = <param name="email" /> AND verifyguid IS NOT NULL </sql> + </project2:sqlrows> + <project2:view name="verifyguids" source="verifyguidsbyemail" rootname="verifyguids" recordname="verifyguid"> <parameters> - <param bind="0" value="$email" /> + <param name="email" value="$email" /> </parameters> - </project2:sqlview> + </project2:view> </view> diff --git a/gentoobrowse/present/accountHome.xml b/gentoobrowse/present/accountHome.xml index 6ceda4c..f725272 100644 --- a/gentoobrowse/present/accountHome.xml +++ b/gentoobrowse/present/accountHome.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> -<view name="index" root="gentoo" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" +<view name="index" root="gentoo" contenttype="text/xml-xslt" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../checks/loggedIn.xml" /> <project2:rawview> <form caption="Logout" submit="Logout" action="/dologout" method="post" /> - <para><p xmlns="http://www.w3.org/1999/xhtml">View my <a href="/accountTracked">tracked packages</a>.</p></para> + <para><p xmlns="http://www.w3.org/1999/xhtml">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 index 590a8db..5dded3f 100644 --- a/gentoobrowse/present/accountTracked.xml +++ b/gentoobrowse/present/accountTracked.xml @@ -1,26 +1,14 @@ <?xml version="1.0"?> -<view name="index" root="gentoo" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" +<view name="index" root="gentoo" contenttype="text/xml-xslt" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> <xi:include href="../checks/loggedIn.xml" /> - <project2:sqlview name="trackedebuilds" recordname="ebuild" datasource="postgres-web"> - <sql> - SELECT c.name AS catname, p.name AS pkgname, ( - SELECT e.version - FROM ebuilds e - WHERE e.packageid = p.packageid - ORDER BY e.versioninst - DESC LIMIT 1) AS latestversion - FROM user_packages up, packages p, categories c - WHERE up.packageid = p.packageid - AND c.categoryid = p.categoryid - AND up.userid = ? - ORDER BY c.name, p.name - </sql> + <xi:include href="../views/tracked.xml" /> + <project2:view name="trackedPackages" source="trackedPackages" rootname="trackedebuilds" recordname="ebuild" filter="userid"> <parameters> - <param bind="0" value="%loggedInUserID|0" /> + <param name="userid" value="%loggedInUserID" /> </parameters> - </project2:sqlview> + </project2:view> </view> diff --git a/gentoobrowse/present/atom.xml b/gentoobrowse/present/atom.xml index 72c1695..ecbb0b5 100644 --- a/gentoobrowse/present/atom.xml +++ b/gentoobrowse/present/atom.xml @@ -1,4 +1,10 @@ <?xml version="1.0"?> -<view name="atomebuilds" root="gentoo" style="atomebuilds.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="atomebuilds" root="gentoo" contenttype="text/xml-xslt" style="atomebuilds.xslt" 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> + <param name="username" value="/1" /> + </parameters> + </project2:view> </view> diff --git a/gentoobrowse/present/categories.xml b/gentoobrowse/present/categories.xml index 4a6d3dc..aa63a6c 100644 --- a/gentoobrowse/present/categories.xml +++ b/gentoobrowse/present/categories.xml @@ -1,4 +1,6 @@ <?xml version="1.0"?> -<view name="categories" root="gentoo" style="categories.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="categories" root="gentoo" contenttype="text/xml-xslt" style="categories.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/categories.xml" /> + <project2:view name="categories" source="categories" rootname="categories" recordname="category" /> </view> diff --git a/gentoobrowse/present/category.xml b/gentoobrowse/present/category.xml index 8f0f031..6de3875 100644 --- a/gentoobrowse/present/category.xml +++ b/gentoobrowse/present/category.xml @@ -1,4 +1,10 @@ <?xml version="1.0"?> -<view name="category" root="gentoo" style="category.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="category" root="gentoo" contenttype="text/xml-xslt" style="category.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/category.xml" /> + <project2:view name="categoryPackages" source="categoryPackages" rootname="packages" recordname="package" filter="byCatName"> + <parameters> + <param name="catname" value="/1" /> + </parameters> + </project2:view> </view> diff --git a/gentoobrowse/present/confirm.xml b/gentoobrowse/present/confirm.xml index cdadf68..adf62a7 100644 --- a/gentoobrowse/present/confirm.xml +++ b/gentoobrowse/present/confirm.xml @@ -1,11 +1,11 @@ <?xml version="1.0"?> -<view name="confirm" root="gentoo" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" +<view name="confirm" root="gentoo" contenttype="text/xml-xslt" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <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']" /> + xslvalue="/gentoo/project2:params/project2:param[@name='verifyguid']/@value" /> </form> </project2:rawview> </view> diff --git a/gentoobrowse/present/index.xml b/gentoobrowse/present/index.xml index 15dacee..4fa7946 100644 --- a/gentoobrowse/present/index.xml +++ b/gentoobrowse/present/index.xml @@ -1,4 +1,16 @@ <?xml version="1.0"?> -<view name="index" root="gentoo" style="home.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="index" root="gentoo" contenttype="text/xml-xslt" style="home.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/newebuilds.xml" /> + <project2:view name="newebuilds" source="newebuilds" rootname="newebuilds" recordname="ebuild" filter="syncCount"> + <parameters> + <param name="count" value="3" /> + <param name="userID" value="%loggedInUserID|0" /> + </parameters> + </project2:view> + <project2:view name="syncs" source="syncs" rootname="syncs" recordname="sync" filter="syncCount"> + <parameters> + <param name="count" value="3" /> + </parameters> + </project2:view> </view> diff --git a/gentoobrowse/present/login.xml b/gentoobrowse/present/login.xml index 1bab32a..b21689f 100644 --- a/gentoobrowse/present/login.xml +++ b/gentoobrowse/present/login.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<view name="login" root="gentoo" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" +<view name="login" root="gentoo" contenttype="text/xml-xslt" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <project2:rawview> <form caption="Login" submit="Login" action="/dologin" method="post"> diff --git a/gentoobrowse/present/package.xml b/gentoobrowse/present/package.xml index 9abb818..0b93d04 100644 --- a/gentoobrowse/present/package.xml +++ b/gentoobrowse/present/package.xml @@ -1,4 +1,72 @@ <?xml version="1.0"?> -<view name="package" root="gentoo" style="package.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="package" root="gentoo" contenttype="text/xml-xslt" style="package.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/package.xml" /> + <project2:view name="package" source="packages" rootname="summary" recordname="package" filter="catAndName"> + <parameters> + <param name="cat" value="/1" /> + <param name="pkg" value="/2" /> + </parameters> + <project2:view name="tracked" source="tracks" rootname="tracks" recordname="track" filter="isPkgTrackedByUser"> + <parameters> + <param name="pkgid" value="^packageid" /> + <param name="userid" value="%loggedInUserID|0" /> + </parameters> + </project2:view> + <project2:view name="versions" source="versions" rootname="versions" recordname="version" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="urls" source="packageUrls" rootname="packageUrls" recordname="url" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="uses" source="versionUses" rootname="versionUses" recordname="use" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="archs" source="versionArchs" rootname="versionArchs" recordname="arch" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="bugs" source="packageBugs" rootname="packageBugs" recordname="bug" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="deps" source="packageDeps" rootname="deps" recordname="package" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="rdeps" source="packageRdeps" rootname="rdeps" recordname="package" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="depees" source="packageDepees" rootname="depees" recordname="package" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="maskStatus" source="maskStatus" rootname="maskstatus" recordname="mask" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="maskDetails" source="maskDetails" rootname="maskdetails" recordname="mask" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + <project2:view name="changeLog" source="changeLog" rootname="changelog" recordname="entry" filter="pkg"> + <parameters> + <param name="pkgid" value="^packageid" /> + </parameters> + </project2:view> + </project2:view> </view> diff --git a/gentoobrowse/present/popular.xml b/gentoobrowse/present/popular.xml index 8f89d1a..1ca9850 100644 --- a/gentoobrowse/present/popular.xml +++ b/gentoobrowse/present/popular.xml @@ -1,4 +1,6 @@ <?xml version="1.0"?> -<view name="popular" root="gentoo" style="popular.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> +<view name="popular" root="gentoo" contenttype="text/xml-xslt" style="popular.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/popular.xml" /> + <project2:view name="popularPackages" source="popularPackages" rootname="packages" recordname="package" /> </view> diff --git a/gentoobrowse/present/search.xml b/gentoobrowse/present/search.xml index 0c61f35..60610df 100644 --- a/gentoobrowse/present/search.xml +++ b/gentoobrowse/present/search.xml @@ -1,11 +1,16 @@ <?xml version="1.0"?> -<view name="search" root="gentoo" style="search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" +<view name="search" root="gentoo" contenttype="text/xml-xslt" style="search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> + <xi:include href="../views/search.xml" /> <project2:rawview> <form caption="Search" submit="Search" action="/search" method="get" autofocus="criteria"> <input type="text" caption="Criteria" name="criteria" - xslvalue="/gentoo/project2:params/project2:param[@name='criteria']" /> + xslvalue="/gentoo/project2:params/project2:param[@name='criteria']/@value" /> </form> </project2:rawview> - <xi:include href="../views/search.xml" /> + <project2:view name="searchResults" source="packageSearch" rootname="searchResults" recordname="package" filter="freeText"> + <parameters> + <param name="criteria" value="$criteria|" /> + </parameters> + </project2:view> </view> diff --git a/gentoobrowse/present/signup.xml b/gentoobrowse/present/signup.xml index 9e74e3f..44640ce 100644 --- a/gentoobrowse/present/signup.xml +++ b/gentoobrowse/present/signup.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<view name="index" root="gentoo" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" +<view name="index" root="gentoo" contenttype="text/xml-xslt" style="login.xslt" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <project2:rawview> <form caption="Signup" submit="Signup" action="/dosignup" method="post"> diff --git a/gentoobrowse/request/doconfirm.xml b/gentoobrowse/request/doconfirm.xml index 71f5d34..9b2b0e5 100644 --- a/gentoobrowse/request/doconfirm.xml +++ b/gentoobrowse/request/doconfirm.xml @@ -2,34 +2,30 @@ <view name="doconfirm" present="accountHome" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> + <xi:include href="../views/user.xml" /> <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="1" present="login" name="checkUserAuth"> - <message>Invalid username or password</message> + <message>No such pending account</message> <sql> SELECT COUNT(*) FROM users WHERE verifyguid = ? </sql> <parameters> - <param bind="0" value="$verifyguid" /> + <param name="0" value="$verifyguid" /> </parameters> </project2:sqlcheck> - <project2:sqliterate datasource="postgres-web" name="getUidFromDatabase"> - <sql> - SELECT userid - FROM users - WHERE verifyguid = ? - </sql> + <project2:iterate datasource="postgres-web" name="getUidFromDatabase" source="users" filter="verifyguid"> <parameters> - <param bind="0" value="$verifyguid" /> + <param name="verifyguid" value="$verifyguid" /> </parameters> <tasks> <project2:sessionset key="loggedInUserID" value="^userid" name="setUidInSession" /> </tasks> - </project2:sqliterate> + </project2:iterate> <project2:sqltask datasource="postgres-web"> <sql>UPDATE users SET verifyguid = NULL WHERE verifyguid = ?</sql> <parameters> - <param bind="0" value="$verifyguid" /> + <param name="0" value="$verifyguid" /> </parameters> </project2:sqltask> </view> diff --git a/gentoobrowse/request/dologin.xml b/gentoobrowse/request/dologin.xml index 672050d..9e1bc19 100644 --- a/gentoobrowse/request/dologin.xml +++ b/gentoobrowse/request/dologin.xml @@ -2,6 +2,7 @@ <view name="dologin" present="accountHome" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> + <xi:include href="../views/user.xml" /> <project2:regexcheck apply-to="$username" present="login" name="usernameEntered"> <regex>.+</regex> <message>User name required</message> @@ -19,8 +20,8 @@ AND userpassword = ? </sql> <parameters> - <param bind="0" value="$username" /> - <param bind="1" value="$password" /> + <param name="0" value="$username" /> + <param name="1" value="$password" /> </parameters> </project2:sqlcheck> <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="1" present="confirm" name="checkConfirmed"> @@ -32,21 +33,16 @@ AND verifyguid IS NULL </sql> <parameters> - <param bind="0" value="$username" /> + <param name="0" value="$username" /> </parameters> </project2:sqlcheck> - <project2:sqliterate datasource="postgres-web" name="getUidFromDatabase"> - <sql> - SELECT userid - FROM users - WHERE username = ? - </sql> + <project2:iterate datasource="postgres-web" name="getUidFromDatabase" source="users" filter="username"> <parameters> - <param bind="0" value="$username" /> + <param name="username" value="$username" /> </parameters> <tasks> <project2:sessionset key="loggedInUserID" value="^userid" name="setUidInSession" /> </tasks> - </project2:sqliterate> + </project2:iterate> </view> diff --git a/gentoobrowse/request/dosignup.xml b/gentoobrowse/request/dosignup.xml index d1fbe2e..386b585 100644 --- a/gentoobrowse/request/dosignup.xml +++ b/gentoobrowse/request/dosignup.xml @@ -18,7 +18,7 @@ WHERE username = ? </sql> <parameters> - <param bind="0" value="$username" /> + <param name="0" value="$username" /> </parameters> </project2:sqlcheck> <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="0" present="signup" name="freeEmail"> @@ -29,17 +29,17 @@ WHERE useremail = ? </sql> <parameters> - <param bind="0" value="$email" /> + <param name="0" value="$email" /> </parameters> </project2:sqlcheck> <project2:sqltask datasource="postgres-web"> <sql>INSERT INTO users(username, userrealname, userpassword, useremail, verifyguid) VALUES(?, ?, ?, ?, uuid_generate_v4())</sql> <parameters> - <param bind="0" value="$username" /> - <param bind="1" value="$realname" /> - <param bind="2" value="$password" /> - <param bind="3" value="$email" /> + <param name="0" value="$username" /> + <param name="1" value="$realname" /> + <param name="2" value="$password" /> + <param name="3" value="$email" /> </parameters> </project2:sqltask> <project2:sendmail to="$email" server="smtp.random.lan:25" subject="Welcome to Gentoo Browse" diff --git a/gentoobrowse/request/track.xml b/gentoobrowse/request/track.xml index f1d3c3f..24ced59 100644 --- a/gentoobrowse/request/track.xml +++ b/gentoobrowse/request/track.xml @@ -11,15 +11,15 @@ AND userid = ? </sql> <parameters> - <param bind="0" value="$packageid" /> - <param bind="1" value="%loggedInUserID" /> + <param name="0" value="$packageid" /> + <param name="1" value="%loggedInUserID" /> </parameters> </project2:sqlcheck> <project2:sqltask datasource="postgres-web" name="addTrack"> <sql>INSERT INTO user_packages(packageid, userid, trackedsince) VALUES(?, ?, NOW())</sql> <parameters> - <param bind="0" value="$packageid" /> - <param bind="1" value="%loggedInUserID" /> + <param name="0" value="$packageid" /> + <param name="1" value="%loggedInUserID" /> </parameters> </project2:sqltask> </request> diff --git a/gentoobrowse/request/untrack.xml b/gentoobrowse/request/untrack.xml index 4394278..88bcdf9 100644 --- a/gentoobrowse/request/untrack.xml +++ b/gentoobrowse/request/untrack.xml @@ -9,8 +9,8 @@ AND userid = ? </sql> <parameters> - <param bind="0" value="$packageid" /> - <param bind="1" value="%loggedInUserID" /> + <param name="0" value="$packageid" /> + <param name="1" value="%loggedInUserID" /> </parameters> </project2:sqltask> </request> diff --git a/gentoobrowse/search.xslt b/gentoobrowse/search.xslt index 362a827..063c0b7 100644 --- a/gentoobrowse/search.xslt +++ b/gentoobrowse/search.xslt @@ -11,9 +11,9 @@ <xsl:apply-templates select="/gentoo/searchResults" /> </xsl:template> <xsl:template match="/gentoo/searchResults"> - <xsl:if test="/gentoo/project2:params/project2:param[@name='criteria'] != ''"> + <xsl:if test="/gentoo/project2:params/project2:param[@name='criteria']/@value != ''"> <xsl:if test="count(/gentoo/searchResults/package) > 0"> - <h2>Search Results for "<xsl:value-of select="/gentoo/project2:params/project2:param[@name='criteria']"/>"</h2> + <h2>Search Results for "<xsl:value-of select="/gentoo/project2:params/project2:param[@name='criteria']/@value"/>"</h2> <ul> <xsl:apply-templates select="/gentoo/searchResults/package" /> </ul> diff --git a/gentoobrowse/views/categories.xml b/gentoobrowse/views/categories.xml index 9e05f71..15b74a1 100644 --- a/gentoobrowse/views/categories.xml +++ b/gentoobrowse/views/categories.xml @@ -2,7 +2,7 @@ <block xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="categories" recordname="category" datasource="postgres-web"> + <project2:sqlrows name="categories" datasource="postgres-web"> <sql> SELECT c.categoryid, MIN(c.name) AS catname, COUNT(*) AS packages FROM categories c, packages p @@ -10,5 +10,5 @@ GROUP BY c.categoryid ORDER BY MIN(c.name) </sql> - </project2:sqlview> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/category.xml b/gentoobrowse/views/category.xml index cb810a9..ebb4470 100644 --- a/gentoobrowse/views/category.xml +++ b/gentoobrowse/views/category.xml @@ -2,16 +2,14 @@ <block xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="packages" recordname="package" datasource="postgres-web"> + <project2:sqlrows name="categoryPackages" datasource="postgres-web"> <sql> SELECT c.name AS catname, p.name AS pkgname, p.description FROM categories c, packages p WHERE c.categoryid = p.categoryid - AND c.name = ? + <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> - <parameters> - <param bind="0" value="/1" /> - </parameters> - </project2:sqlview> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/newebuilds.xml b/gentoobrowse/views/newebuilds.xml index 9a4cbf3..2fc10c4 100644 --- a/gentoobrowse/views/newebuilds.xml +++ b/gentoobrowse/views/newebuilds.xml @@ -1,32 +1,29 @@ <?xml version="1.0"?> <block xmlns:project2="http://project2.randomdan.homeip.net" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="newebuilds" recordname="ebuild" datasource="postgres-web"> + <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 FROM ebuilds e, categories c, packages p LEFT OUTER JOIN user_packages up - ON up.userid = ? + ON up.userid = <param name="userID" /> AND up.packageid = p.packageid WHERE e.packageid = p.packageid AND p.categoryid = c.categoryid - AND e.firstseen IN ( + <filter name="syncCount">AND e.firstseen IN ( SELECT DISTINCT e.firstseen FROM ebuilds e - ORDER BY e.firstseen - DESC LIMIT 3) + ORDER BY e.firstseen DESC + LIMIT <param name="count" />)</filter> ORDER BY tracked DESC, c.name, p.name, e.versioninst </sql> - <parameters> - <param bind="0" value="%loggedInUserID|0" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="syncs" recordname="sync" datasource="postgres-web"> + </project2:sqlrows> + <project2:sqlrows name="syncs" datasource="postgres-web"> <sql> SELECT DISTINCT e.firstseen AS synctime FROM ebuilds e - ORDER BY e.firstseen - DESC LIMIT 3 + ORDER BY e.firstseen DESC + <filter name="syncCount"> LIMIT <param name="count" /></filter> </sql> - </project2:sqlview> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/newebuildsatom.xml b/gentoobrowse/views/newebuildsatom.xml index 76cc414..d229b45 100644 --- a/gentoobrowse/views/newebuildsatom.xml +++ b/gentoobrowse/views/newebuildsatom.xml @@ -1,22 +1,19 @@ <?xml version="1.0"?> <block xmlns:project2="http://project2.randomdan.homeip.net" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="newebuilds" recordname="ebuild" datasource="postgres-web"> + <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 = ? + 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> - <parameters> - <param bind="0" value="/1" /> - </parameters> - </project2:sqlview> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/package.xml b/gentoobrowse/views/package.xml index 2e18435..e4797e9 100644 --- a/gentoobrowse/views/package.xml +++ b/gentoobrowse/views/package.xml @@ -2,171 +2,157 @@ <block xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="summary" recordname="package" datasource="postgres-web"> + <project2:sqlrows name="packages" datasource="postgres-web"> <sql> SELECT p.packageid, p.name AS pkgname, p.description, p.firstseen, c.name AS catname FROM packages p, categories c - WHERE c.name = ? - AND p.name = ? - AND p.categoryid = c.categoryid + WHERE p.categoryid = c.categoryid + <filter name="catAndName"> + AND c.name = <param name="cat" /> + AND p.name = <param name="pkg" /> + </filter> </sql> - <parameters> - <param bind="0" value="/1" /> - <param bind="1" value="/2" /> - </parameters> - <project2:sqlview name="tracks" recordname="track" datasource="postgres-web"> - <sql> - SELECT trackedsince - FROM user_packages up - WHERE up.packageid = ? - AND up.userid = ? - </sql> - <parameters> - <param bind="0" value="^packageid" /> - <param bind="1" value="%loggedInUserID|0" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="versions" recordname="version" datasource="postgres-web"> - <sql> - SELECT e.ebuildid, e.version, e.moddate, e.slot, e.license - FROM ebuilds e - WHERE e.packageid = ? - ORDER BY versioninst desc - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="packageUrls" recordname="url" datasource="postgres-web"> - <sql> - SELECT pu.url - FROM package_urls pu - WHERE pu.packageid = ? - ORDER BY pu.url - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="versionUses" recordname="use" datasource="postgres-web"> - <sql> - SELECT u.* - FROM ebuilds e, ebuild_uses u - WHERE e.packageid = ? - AND e.ebuildid = u.ebuildid - ORDER BY version - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="versionArchs" recordname="arch" datasource="postgres-web"> - <sql> - SELECT a.* - FROM ebuilds e, ebuild_archs a - WHERE e.packageid = ? - AND e.ebuildid = a.ebuildid - ORDER BY version - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="packageBugs" recordname="bug" datasource="postgres-web"> - <sql> - SELECT b.bugid, b.summary - FROM bugs b, package_bugs pb - WHERE b.bugid = pb.bugid - AND pb.packageid = ? - ORDER BY b.bugid - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="deps" recordname="package" 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 e.packageid = ? - AND d.ebuildid = e.ebuildid - AND pd.packageid = d.packageid - AND pd.categoryid = cd.categoryid - ORDER BY cd.name, pd.name - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="rdeps" recordname="package" 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 e.packageid = ? - AND d.ebuildid = e.ebuildid - AND pd.packageid = d.packageid - AND pd.categoryid = cd.categoryid - ORDER BY cd.name, pd.name - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="depees" recordname="package" 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 - WHERE d.packageid = ? - UNION - SELECT ebuildid - FROM ebuild_deps d - WHERE d.packageid = ?) 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> - <parameters> - <param bind="0" value="^packageid" /> - <param bind="1" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="maskstatus" recordname="mask" 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 - AND e.packageid = ? - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="maskdetails" recordname="mask" 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 - AND e.packageid = ? - ORDER BY DENSE_RANK() OVER(ORDER BY em.setno) - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - <project2:sqlview name="changelog" recordname="entry" datasource="postgres-web"> - <sql> - SELECT date, person, email, comment - FROM package_changelogs - WHERE packageid = ? - ORDER BY date DESC, n - </sql> - <parameters> - <param bind="0" value="^packageid" /> - </parameters> - </project2:sqlview> - </project2:sqlview> + </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 + FROM ebuilds e + <filter name="pkg"> + WHERE 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 + WHERE e.ebuildid = u.ebuildid + <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, package_bugs pb + WHERE b.bugid = pb.bugid + <filter name="pkg"> + AND pb.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 date, person, email, comment + FROM package_changelogs + <filter name="pkg"> + WHERE packageid = <param name="pkgid" /> + </filter> + ORDER BY date DESC, n + </sql> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/popular.xml b/gentoobrowse/views/popular.xml index 873805a..e21a296 100644 --- a/gentoobrowse/views/popular.xml +++ b/gentoobrowse/views/popular.xml @@ -2,15 +2,15 @@ <block xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="packages" recordname="package" datasource="postgres-web"> + <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 + 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(*), MIN(c.name), MIN(p.name) + ORDER BY COUNT(*) DESC, MIN(c.name), MIN(p.name) LIMIT 50 </sql> - </project2:sqlview> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/search.xml b/gentoobrowse/views/search.xml index 1b7a177..820c3ea 100644 --- a/gentoobrowse/views/search.xml +++ b/gentoobrowse/views/search.xml @@ -2,19 +2,20 @@ <block xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../datasources/postgres-web.xml" /> - <project2:sqlview name="searchResults" recordname="package" datasource="postgres-web"> + <project2:sqlrows name="packageSearch" datasource="postgres-web"> <sql> - select c.name as catname, p.name as pkgname, description, - ts_rank((setweight(to_tsvector('english', p.name), 'A') || setweight(to_tsvector('english', p.description), 'B')), - plainto_tsquery('english', ?)) as rank + select c.name as catname, p.name as pkgname, description + <filter name="freeText">, + ts_rank((setweight(to_tsvector('english', p.name), 'A') || setweight(to_tsvector('english', p.description), 'B')), + plainto_tsquery('english', <param name="criteria" />)) as rank + </filter> from packages p, categories c - where (setweight(to_tsvector('english', p.name), 'A') || setweight(to_tsvector('english', p.description), 'B')) @@ plainto_tsquery('english', ?) - and p.categoryid = c.categoryid - order by rank desc, p.name + where p.categoryid = c.categoryid + <filter name="freeText"> + and (setweight(to_tsvector('english', p.name), 'A') || setweight(to_tsvector('english', p.description), 'B')) + @@ plainto_tsquery('english', <param name="criteria" />) + order by rank desc, p.name + </filter> </sql> - <parameters> - <param bind="0" value="$criteria|" /> - <param bind="1" value="$criteria|" /> - </parameters> - </project2:sqlview> + </project2:sqlrows> </block> diff --git a/gentoobrowse/views/tracked.xml b/gentoobrowse/views/tracked.xml new file mode 100644 index 0000000..a7b50a9 --- /dev/null +++ b/gentoobrowse/views/tracked.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<block xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> + <xi:include href="../datasources/postgres-web.xml" /> + <project2:sqlrows name="trackedPackages" datasource="postgres-web"> + <sql> + SELECT c.name AS catname, p.name AS pkgname, ( + SELECT e.version + FROM ebuilds e + WHERE e.packageid = p.packageid + ORDER BY e.versioninst + DESC LIMIT 1) AS latestversion + 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/user.xml b/gentoobrowse/views/user.xml new file mode 100644 index 0000000..a2ea60d --- /dev/null +++ b/gentoobrowse/views/user.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<block xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> + <xi:include href="../datasources/postgres-web.xml" /> + <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> + |