diff options
-rw-r--r-- | gentoobrowse/base.xslt | 1 | ||||
-rw-r--r-- | gentoobrowse/popular.xslt | 28 | ||||
-rw-r--r-- | gentoobrowse/present/popular.xml | 4 | ||||
-rw-r--r-- | gentoobrowse/views/popular.xml | 16 |
4 files changed, 49 insertions, 0 deletions
diff --git a/gentoobrowse/base.xslt b/gentoobrowse/base.xslt index 6653113..0a7efdc 100644 --- a/gentoobrowse/base.xslt +++ b/gentoobrowse/base.xslt @@ -28,6 +28,7 @@ <div class="tabs"> <a href="/">Home</a> | <a href="/categories">Browse</a> | + <a href="/popular">Popular</a> | <a href="/search" rel="nofollow">Search</a> | <xsl:if test="count(/gentoo/project2:session/project2:var[@name='loggedInUserID']) = 0"> <a href="/login" rel="nofollow">Login</a> diff --git a/gentoobrowse/popular.xslt b/gentoobrowse/popular.xslt new file mode 100644 index 0000000..c65b6fa --- /dev/null +++ b/gentoobrowse/popular.xslt @@ -0,0 +1,28 @@ +<?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" + doctype-system="http://www.w3.org/TR/html4/loose.dtd" + doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" /> + <xsl:template name="head"> + <title>Popular Package List - Gentoo Browse</title> + <meta name="description"> + <xsl:attribute name="content">List of Gentoo packages track by users</xsl:attribute> + </meta> + <meta name="keywords"> + <xsl:attribute name="content"> + <xsl:for-each select="/gentoo/packages/package/pkgname"><xsl:value-of select="." />, </xsl:for-each> + </xsl:attribute> + </meta> + </xsl:template> + <xsl:template name="content"> + <xsl:apply-templates select="/gentoo/packages" /> + </xsl:template> + <xsl:template match="/gentoo/packages"> + <h2>Popular Packages</h2> + <ul> + <xsl:apply-templates select="/gentoo/packages/package" /> + </ul> + </xsl:template> +</xsl:stylesheet> diff --git a/gentoobrowse/present/popular.xml b/gentoobrowse/present/popular.xml new file mode 100644 index 0000000..8f89d1a --- /dev/null +++ b/gentoobrowse/present/popular.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<view name="popular" root="gentoo" style="popular.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../views/popular.xml" /> +</view> diff --git a/gentoobrowse/views/popular.xml b/gentoobrowse/views/popular.xml new file mode 100644 index 0000000..873805a --- /dev/null +++ b/gentoobrowse/views/popular.xml @@ -0,0 +1,16 @@ +<?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:sqlview name="packages" recordname="package" datasource="postgres-web"> + <sql> + SELECT p.packageid, MIN(c.name) AS catname, MIN(p.name) AS pkgname, MIN(p.description) AS description + 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) + LIMIT 50 + </sql> + </project2:sqlview> +</block> |