summaryrefslogtreecommitdiff
path: root/gentoobrowse/xslt/base.xslt
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse/xslt/base.xslt')
-rw-r--r--gentoobrowse/xslt/base.xslt166
1 files changed, 113 insertions, 53 deletions
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">&lt;!DOCTYPE html&gt;&#10;</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">&#183;</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">&#183;</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]) &gt; 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>