summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-03-13 20:17:26 +0000
committerrandomdan <randomdan@localhost>2012-03-13 20:17:26 +0000
commit9019eda559a27b9c486fdc8a08a6bca511b764e6 (patch)
tree2bbe629fd146253100acfe155d41b8415244fb36
parentFix xsl paths for new output (diff)
downloadgentoobrowse-9019eda559a27b9c486fdc8a08a6bca511b764e6.tar.bz2
gentoobrowse-9019eda559a27b9c486fdc8a08a6bca511b764e6.tar.xz
gentoobrowse-9019eda559a27b9c486fdc8a08a6bca511b764e6.zip
Minor fixes and add pages for browsing by USE flag
-rw-r--r--gentoobrowse/BingSiteAuth.xml4
-rw-r--r--gentoobrowse/console/use.local.xml4
-rw-r--r--gentoobrowse/present/package.xml6
-rw-r--r--gentoobrowse/present/use.xml23
-rw-r--r--gentoobrowse/views/search.xml13
-rw-r--r--gentoobrowse/views/use.xml44
-rw-r--r--gentoobrowse/xslt/base.xslt22
-rw-r--r--gentoobrowse/xslt/package.xslt26
-rw-r--r--gentoobrowse/xslt/use.xslt25
9 files changed, 163 insertions, 4 deletions
diff --git a/gentoobrowse/BingSiteAuth.xml b/gentoobrowse/BingSiteAuth.xml
new file mode 100644
index 0000000..55f6af2
--- /dev/null
+++ b/gentoobrowse/BingSiteAuth.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<users>
+ <user>73B32731E60AB08699031ED48022DB7A</user>
+</users> \ No newline at end of file
diff --git a/gentoobrowse/console/use.local.xml b/gentoobrowse/console/use.local.xml
index 456c5cc..e35e3ba 100644
--- a/gentoobrowse/console/use.local.xml
+++ b/gentoobrowse/console/use.local.xml
@@ -19,6 +19,8 @@
<project2:sqlmerge name="mergeguse" datasource="postgres" targettable="use_local">
<project2:iterate name="lines" source="cl">
<project2:iterate name="flags" source="cla">
+ <project2:handler>
+ <try>
<project2:sqlmergeinsert name="insertFile">
<parameters>
<packageid source="lookup" name="packageid">
@@ -38,6 +40,8 @@
<description source="parent" name="description" depth="1" />
</parameters>
</project2:sqlmergeinsert>
+ </try>
+ </project2:handler>
</project2:iterate>
</project2:iterate>
<columns>
diff --git a/gentoobrowse/present/package.xml b/gentoobrowse/present/package.xml
index 62d4226..db09c42 100644
--- a/gentoobrowse/present/package.xml
+++ b/gentoobrowse/present/package.xml
@@ -2,6 +2,7 @@
<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" rootname="summary" recordname="package" filter="catAndName">
<parameters>
@@ -14,6 +15,11 @@
<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:view>
<project2:view name="versions" source="versions" rootname="versions" recordname="version" filter="pkg">
<parameters>
<pkgid source="parent" name="packageid" depth="1" />
diff --git a/gentoobrowse/present/use.xml b/gentoobrowse/present/use.xml
new file mode 100644
index 0000000..b1ae7b1
--- /dev/null
+++ b/gentoobrowse/present/use.xml
@@ -0,0 +1,23 @@
+<?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:view>
+</view>
+
diff --git a/gentoobrowse/views/search.xml b/gentoobrowse/views/search.xml
index b3a5ed2..db08d33 100644
--- a/gentoobrowse/views/search.xml
+++ b/gentoobrowse/views/search.xml
@@ -30,6 +30,19 @@
</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 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
diff --git a/gentoobrowse/views/use.xml b/gentoobrowse/views/use.xml
new file mode 100644
index 0000000..f0938bd
--- /dev/null
+++ b/gentoobrowse/views/use.xml
@@ -0,0 +1,44 @@
+<?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)) AS description
+ 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)
+ 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 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 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/xslt/base.xslt b/gentoobrowse/xslt/base.xslt
index e1c721f..88bea15 100644
--- a/gentoobrowse/xslt/base.xslt
+++ b/gentoobrowse/xslt/base.xslt
@@ -29,10 +29,10 @@
<li><a href="/categories">Browse</a></li>
<li><a href="/popular">Popular</a></li>
<li><a href="JavaScript: void(0);" onclick="toggleForm('#search');" rel="nofollow">Search</a></li>
- <xsl:if test="count(/gentoo/project2:session/var[@name='loggedInUserID']) = 0">
+ <xsl:if test="count(/gentoo/project2:session/loggedInUserID) = 0">
<li><a href="JavaScript: void(0);" onclick="toggleForm('#login');" rel="nofollow">Login</a></li>
</xsl:if>
- <xsl:if test="count(/gentoo/project2:session/var[@name='loggedInUserID']) &gt; 0">
+ <xsl:if test="count(/gentoo/project2:session/loggedInUserID) &gt; 0">
<li><a href="/accountHome" rel="nofollow">My Account</a></li>
</xsl:if>
</ul>
@@ -91,4 +91,22 @@
</a> - <xsl:value-of select="description" />
</li>
</xsl:template>
+ <xsl:template match="package" mode="withuse">
+ <li>
+ <a>
+ <xsl:attribute name="href">/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute>
+ <xsl:attribute name="title"><xsl:value-of select="description" /></xsl:attribute>
+ <xsl:value-of select="catname" />/<xsl:value-of select="pkgname" />
+ </a> - <xsl:value-of select="description" />
+ <xsl:if test="count(/gentoo/local/use[packageid = current()/packageid]) &gt; 0">
+ <ul>
+ <xsl:for-each select="/gentoo/local/use[packageid = current()/packageid]">
+ <li>
+ <xsl:value-of select="description" />
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </li>
+ </xsl:template>
</xsl:stylesheet>
diff --git a/gentoobrowse/xslt/package.xslt b/gentoobrowse/xslt/package.xslt
index 8547ff3..efba87d 100644
--- a/gentoobrowse/xslt/package.xslt
+++ b/gentoobrowse/xslt/package.xslt
@@ -13,7 +13,7 @@
$("section#pkgdetails").tabs();
})
</script>
- <xsl:if test="count(/gentoo/project2:session/var[@name='loggedInUserID']) != 0">
+ <xsl:if test="count(/gentoo/project2:session/loggedInUserID) != 0">
<script type="text/javascript" src="/js/pkgtracking.js" />
</xsl:if>
</xsl:template>
@@ -36,7 +36,7 @@
<xsl:value-of select="herd" />
</a>)</small>
</xsl:if>
- <xsl:if test="count(/gentoo/project2:session/var[@name='loggedInUserID']) != 0">
+ <xsl:if test="count(/gentoo/project2:session/loggedInUserID) != 0">
<a id="dotrack">
<xsl:attribute name="href">javascript:track(<xsl:value-of select="/gentoo/summary/package/packageid" />);</xsl:attribute>
<xsl:if test="count(tracks/track) = 1">
@@ -62,6 +62,9 @@
<!-- handles -->
<ul>
<li><a href="#versions">Versions</a></li>
+ <xsl:if test="count(/gentoo/summary/package/uses/use) &gt; 0">
+ <li><a href="#uses">Uses</a></li>
+ </xsl:if>
<xsl:if test="count(/gentoo/summary/package/deps/package) &gt; 0">
<li><a href="#deps">Dependencies</a></li>
</xsl:if>
@@ -83,6 +86,7 @@
</ul>
<!-- content -->
<xsl:apply-templates select="versions" />
+ <xsl:apply-templates select="uses" />
<xsl:apply-templates select="deps" />
<xsl:apply-templates select="rdeps" />
<xsl:apply-templates select="depees" />
@@ -104,6 +108,24 @@
</section>
</xsl:template>
+ <!-- Uses -->
+ <xsl:template match="/gentoo/summary/package/uses">
+ <xsl:if test="/gentoo/summary/package/uses/use">
+ <section id="uses">
+ <ul>
+ <xsl:apply-templates select="use" />
+ </ul>
+ </section>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/uses/use">
+ <li>
+ <a>
+ <xsl:attribute name="href">/use/<xsl:value-of select="use" /></xsl:attribute>
+ <xsl:value-of select="use" />
+ </a> - <xsl:value-of select="description" />
+ </li>
+ </xsl:template>
<!-- Versions -->
<xsl:template match="/gentoo/summary/package/versions">
<section id="versions">
diff --git a/gentoobrowse/xslt/use.xslt b/gentoobrowse/xslt/use.xslt
new file mode 100644
index 0000000..3bd2780
--- /dev/null
+++ b/gentoobrowse/xslt/use.xslt
@@ -0,0 +1,25 @@
+<?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/1999/xhtml"
+ 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 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>
+ </xsl:template>
+ <xsl:template name="content">
+ <xsl:apply-templates select="/gentoo/packages" />
+ </xsl:template>
+ <xsl:template match="/gentoo/packages">
+ <h2>Packages with the <xsl:value-of select="/gentoo/project2:uriElems/uriElem[2]" /> USE flag</h2>
+ <xsl:if test="/gentoo/global/use">
+ <p>Global definition: <xsl:value-of select="/gentoo/global/use/description" />.</p>
+ </xsl:if>
+ <ul>
+ <xsl:apply-templates select="/gentoo/packages/package" mode="withuse" />
+ </ul>
+ </xsl:template>
+</xsl:stylesheet>
+