splitted xslt

git-svn-id: http://yolanda.mister-muffin.de/svn@148 7eef14d0-6ed0-489d-bf55-20463b2d70db
main
josch 17 years ago
parent d8aa4854e9
commit e8a1ac1b2b

@ -266,3 +266,8 @@ td
{
vertical-align: top;
}
img
{
border: 0;
}

@ -17,9 +17,21 @@
omit-xml-declaration="no"
/>
<xsl:include href="/xsl/xhtml/results.xsl"/>
<xsl:include href="/xsl/xhtml/video.xsl"/>
<xsl:variable name="site_strings" select="document('../site/gnutube.xml')//strings/str" />
<xsl:variable name="locale_strings" select="document(concat('../locale/',/page/@locale,'.xml'))//strings/str" />
<!-- this kills 99% of the processed XML... sorry Tim Bray.... -->
<xsl:template match="@*|node()">
<xsl:if test="not(/)">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
@ -133,7 +145,30 @@
<hr />
<xsl:apply-templates />
<xsl:if test="//message">
<xsl:call-template name="message"/>
</xsl:if>
<xsl:choose>
<xsl:when test="//frontpage">
<xsl:call-template name="frontpage"/>
</xsl:when>
<xsl:when test="//registerform">
<xsl:call-template name="registerform"/>
</xsl:when>
<xsl:when test="//loginform">
<xsl:call-template name="loginform"/>
</xsl:when>
<xsl:when test="//uploadform">
<xsl:call-template name="uploadform"/>
</xsl:when>
<xsl:when test="//results">
<xsl:call-template name="results"/>
</xsl:when>
<xsl:when test="//video">
<xsl:call-template name="video"/>
</xsl:when>
</xsl:choose>
<div class="footer">
<a>
@ -163,7 +198,7 @@
</html>
</xsl:template>
<xsl:template match="frontpage">
<xsl:template name="frontpage">
<div class="logo-big">
<img src="/images/logo-big.png" alt="GNUtube logo (320x100)" />
@ -203,12 +238,16 @@
<a href="about:blank"><xsl:value-of select="$locale_strings[@id='query_bestrated']" /></a>
</div>
<xsl:call-template name="tagcloud"/>
</xsl:template>
<xsl:template name="searchbar">
<div class="logo-small-top">
<img src="/images/logo-small-top.png" alt="GNUtube logo top (160x25)" />
<a href="/">
<img src="/images/logo-small-top.png" alt="GNUtube logo top (160x25)" />
</a>
</div>
<div class="search-small">
@ -224,39 +263,41 @@
</div>
<div class="logo-small-bottom">
<img src="/images/logo-small-bottom.png" alt="GNUtube logo top (160x25)" />
<a href="/">
<img src="/images/logo-small-bottom.png" alt="GNUtube logo top (160x25)" />
</a>
</div>
</xsl:template>
<xsl:template match="message">
<xsl:template name="message">
<div class="messagebox">
<xsl:attribute name="id">
<xsl:value-of select="@type" />
<xsl:value-of select="/page/message/@type" />
</xsl:attribute>
<xsl:choose>
<xsl:when test="@type='error'">
<xsl:when test="/page/message/@type='error'">
<img src="/images/tango/dialog-error.png" />
</xsl:when>
<xsl:when test="@type='information'">
<xsl:when test="/page/message/@type='information'">
<img src="/images/tango/dialog-information.png" />
</xsl:when>
<xsl:when test="@type='warning'">
<xsl:when test="/page/message/@type='warning'">
<img src="/images/tango/dialog-warning.png" />
</xsl:when>
</xsl:choose>
<xsl:variable name="messagetext" select="@text" />
<xsl:variable name="messagetext" select="/page/message/@text" />
<xsl:value-of select="$locale_strings[@id=$messagetext]" />
<!-- probably one can do this on one line, dunno how -->
</div>
</xsl:template>
<xsl:template match="tagcloud">
<xsl:template name="tagcloud">
<div class="tagcloud">
<xsl:for-each select="tag">
<xsl:for-each select="//tagcloud/tag">
<xsl:sort select="text" order="ascending" data-type="text" />
<a class="tag">
<xsl:attribute name="style">
@ -281,599 +322,9 @@
</xsl:template>
<xsl:template name="pagination">
<div>
<xsl:choose>
<xsl:when test="@currentpage&lt;=1">
&lt;&lt; &lt;
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=1')" />
</xsl:attribute>
&lt;&lt;
</a>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage - 1)" />
</xsl:attribute>
&lt;
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@currentpage > 2">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage - 2)" />
</xsl:attribute>
<xsl:value-of select="@currentpage - 2" />
</a>
</xsl:if>
<xsl:if test="@currentpage > 1">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage - 1)" />
</xsl:attribute>
<xsl:value-of select="@currentpage - 1" />
</a>
</xsl:if>
<xsl:value-of select="@currentpage" />
<xsl:variable name="temp" select="@lastpage - @currentpage" />
<xsl:if test="$temp > 0">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage + 1)" />
</xsl:attribute>
<xsl:value-of select="@currentpage + 1" />
</a>
</xsl:if>
<xsl:if test="$temp > 1">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage + 2)" />
</xsl:attribute>
<xsl:value-of select="@currentpage + 2" />
</a>
</xsl:if>
<xsl:choose>
<xsl:when test="@lastpage&lt;=@currentpage">
&gt; &gt;&gt;
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @currentpage + 1)" />
</xsl:attribute>
&gt;
</a>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(@scriptname, '?', @argument, '=', @value, '&amp;orderby=', @orderby, '&amp;sort=', @sort, '&amp;page=', @lastpage)" />
</xsl:attribute>
&gt;&gt;
</a>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template name="registerform">
<xsl:template match="results">
<xsl:call-template name="searchbar"/>
<div>
<xsl:choose>
<xsl:when test="@query!=''">
<xsl:value-of select="$locale_strings[@id='results_for_query']" />
"<xsl:value-of select="@query" />"
<xsl:if test="@orderby!=''">
<xsl:value-of select="$locale_strings[@id='ordered_by']" />
<xsl:choose>
<xsl:when test="@orderby='relevance'">
<xsl:value-of select="$locale_strings[@id='relevance']" />
</xsl:when>
<xsl:when test="@orderby='duration'">
<xsl:value-of select="$locale_strings[@id='duration']" />
</xsl:when>
<xsl:when test="@orderby='filesize'">
<xsl:value-of select="$locale_strings[@id='filesize']" />
</xsl:when>
<xsl:when test="@orderby='viewcount'">
<xsl:value-of select="$locale_strings[@id='viewcount']" />
</xsl:when>
<xsl:when test="@orderby='downloadcount'">
<xsl:value-of select="$locale_strings[@id='downloadcount']" />
</xsl:when>
<xsl:when test="@orderby='timestamp'">
<xsl:value-of select="$locale_strings[@id='timestamp']" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="@sort='asc'">
<xsl:value-of select="$locale_strings[@id='ascending']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$locale_strings[@id='descending']" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:when test="@orderby!=''">
<xsl:choose>
<xsl:when test="@orderby='timestamp'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the oldest videos
</xsl:when>
<xsl:otherwise>
the newest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='downloadcount'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the least downloaded videos
</xsl:when>
<xsl:otherwise>
the most downloaded videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='viewcount'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the least viewed videos
</xsl:when>
<xsl:otherwise>
the most viewed videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='duration'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the shortest videos
</xsl:when>
<xsl:otherwise>
the lengthest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@orderby='filesize'">
<xsl:choose>
<xsl:when test="@sort='asc'">
the smallest videos
</xsl:when>
<xsl:otherwise>
the biggest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</div>
<div>
<xsl:value-of select="@resultcount" /> results on <xsl:value-of select="@lastpage" /> pages
</div>
<xsl:call-template name="pagination"/>
<table class="results" align="center">
<xsl:for-each select="result">
<tr class="result">
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<img>
<xsl:attribute name="src">
<xsl:value-of select="@thumbnail" />
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
</xsl:attribute>
</img>
</a>
</td>
<td><h2>
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
</a>
</h2>
<table class="videometadata">
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='duration']" />:
</td>
<td class="rightcell">
<xsl:variable name="minutes" select="floor(@duration div 60)" />
<xsl:variable name="hours" select="floor(@duration div 3600)" />
<xsl:variable name="seconds" select="@duration - $minutes*60 - $hours*3600" />
<xsl:value-of select="concat($hours, ':', format-number($minutes, '00'), ':', format-number($seconds, '00'))" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='viewcount']" />:
</td>
<td class="rightcell">
<xsl:value-of select="@viewcount" />
</td>
</tr>
</table>
<xsl:if test="@edit='true'">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@duration=0">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(rdf:RDF/cc:Work/dc:identifier, '/edit=true')" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<img src="/images/tango/accessories-text-editor.png" style="border:0;vertical-align:bottom;" />edit
</a>
</xsl:if>
</td>
</tr>
</xsl:for-each>
</table>
<xsl:call-template name="pagination"/>
<div>
<form method="get">
<xsl:attribute name="action">
<xsl:value-of select="@scriptname" />
</xsl:attribute>
<fieldset>
<input type="hidden">
<xsl:attribute name="name">
<xsl:value-of select="@argument" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
</input>
order by:
<select name="orderby">
<xsl:if test="@query!=''">
<option value="relevance">
<xsl:if test="@orderby='relevance'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='relevance']" />
</option>
</xsl:if>
<option value="filesize">
<xsl:if test="@orderby='filesize'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='filesize']" />
</option>
<option value="duration">
<xsl:if test="@orderby='duration'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='duration']" />
</option>
<option value="viewcount">
<xsl:if test="@orderby='viewcount'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='viewcount']" />
</option>
<option value="downloadcount">
<xsl:if test="@orderby='downloadcount'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='downloadcount']" />
</option>
<option value="timestamp">
<xsl:if test="@orderby='timestamp'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='timestamp']" />
</option>
</select>
<select name="sort">
<option value="desc">
<xsl:if test="@sort='desc'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='descending']" />
</option>
<option value="asc">
<xsl:if test="@sort='asc'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='ascending']" />
</option>
</select>
<input type="submit" />
</fieldset>
</form>
</div>
</xsl:template>
<xsl:template match="video">
<xsl:call-template name="searchbar"/>
<div class="video">
<xsl:choose>
<xsl:when test="@cortado='true'">
<applet
code="com.fluendo.player.Cortado.class"
archive="/java/cortado-ovt-stripped-0.2.2.jar"
>
<xsl:attribute name="width">
<xsl:value-of select="@width" />
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="@height" />
</xsl:attribute>
<param name="url">
<xsl:attribute name="value">
<xsl:value-of select="concat(rdf:RDF/cc:Work/@rdf:about,'/view=true')" />
</xsl:attribute>
</param>
<param name="seekable" value="true"/>
<param name="duration">
<xsl:attribute name="value">
<xsl:value-of select="@duration" />
</xsl:attribute>
</param>
<param name="keepAspect" value="true"/>
<param name="video" value="true"/>
<param name="audio" value="true"/>
<param name="statusHeight" value="24"/>
<param name="autoPlay" value="true"/>
<param name="showStatus" value="show"/>
<param name="bufferSize" value="200"/>
</applet>
<div>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(rdf:RDF/cc:Work/dc:identifier, '/cortado=false')" />
</xsl:attribute>
Watch using Browser Video Plugin
</a>
</div>
</xsl:when>
<xsl:otherwise>
<object>
<xsl:attribute name="width">
<xsl:value-of select="@width" />
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="@height + 16" />
</xsl:attribute>
<xsl:attribute name="data">
<xsl:value-of select="concat(rdf:RDF/cc:Work/@rdf:about,'/view=true')" />
</xsl:attribute>
</object>
<div>
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
Watch using Cortado Java Applet
</a>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
<div class="videodownload">
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute>
<img src="/images/tango/document-save.png" />
</a>
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute>
<br />
<xsl:value-of select="$locale_strings[@id='download_video']" />
</a>
</div>
<div class="videoccdata">
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:License/@rdf:about" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='license_conditions']" />:
</a>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:License/@rdf:about" />
</xsl:attribute>
<!--
unfinished bizness
<xsl:value-of select="@rdf:about" />
<xsl:if test="true()">
<img src="./images/cc/somerights.png" />
</xsl:if>
-->
<xsl:for-each select="rdf:RDF/cc:License/cc:permits">
<!--
since we are talking about digital media here, distribution actually /is/ reproduction
(also, i was too stupid to figure out how to test for both conditions).
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/Reproduction'">
<img src="./images/cc/cc-share.png" />
</xsl:if>
-->
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/Distribution'">
<img src="./images/cc/cc-share.png" />
</xsl:if>
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/DerivativeWorks'">
<img src="./images/cc/cc-remix.png" />
</xsl:if>
</xsl:for-each>
<xsl:for-each select="rdf:RDF/cc:License/cc:requires">
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/Notice'">
<img src="./images/cc/cc-by.png" />
</xsl:if>
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/ShareAlike'">
<img src="./images/cc/cc-sharealike.png" />
</xsl:if>
<!--
source code doesn't make much sense in video context.
still, this is preserved for potential future use.
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/SourceCode'">
SOURCE
</xsl:if>
-->
</xsl:for-each>
<xsl:for-each select="rdf:RDF/cc:License/cc:prohibits">
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/CommercialUse'">
<img src="./images/cc/cc-noncommercial.png" />
</xsl:if>
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/DerivativeWorks'">
<img src="./images/cc/cc-noderivatives.png" />
</xsl:if>
</xsl:for-each>
</a>
</div>
<table class="videometadata">
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Title']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Creator']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:creator" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Subject']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:subject" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Description']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:description" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Publisher']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:publisher" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Date']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:date" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Source']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:source" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Rights']" />:
</td>
<td class="rightcell">
<xsl:value-of select="rdf:RDF/cc:Work/dc:rights" />
</td>
</tr>
</table>
<table class="referer">
<xsl:for-each select="/page/referers/referer">
<tr>
<td class="leftcell">
<xsl:value-of select="@count" />
</td>
<td class="rightcell">
<xsl:value-of select="@referer" />
</td>
</tr>
</xsl:for-each>
</table>
<div class="commentform">
<form method="post">
<xsl:attribute name="action">
<xsl:value-of select="/page/video/rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<fieldset>
<br />
<textarea name="comment" cols="30" rows="3" />
<br />
<input type="submit" name="send">
<xsl:attribute name="value">
<xsl:value-of select="$locale_strings[@id='comment_post']" />
</xsl:attribute>
</input>
</fieldset>
</form>
</div>
</xsl:template>
<xsl:template match="comments">
<div class="comments">
<span class="protip">
<xsl:value-of select="$locale_strings[@id='comment_on_video']" />
</span>
<br />
<xsl:for-each select="comment">
<div class="comment">
<a>
<xsl:attribute name="href">
./user/<xsl:value-of select="@username" />
</xsl:attribute>
<xsl:value-of select="@username" />
</a>:
<br />
<xsl:value-of select="." />
</div>
</xsl:for-each>
</div>
</xsl:template>
<xsl:template match="registerform">
<div class="registerform">
@ -902,7 +353,9 @@
</xsl:template>
<xsl:template match="loginform">
<xsl:template name="loginform">
<xsl:call-template name="searchbar"/>
<div class="loginform">
@ -948,7 +401,9 @@
</xsl:template>
<xsl:template match="uploadform">
<xsl:template name="uploadform">
<xsl:call-template name="searchbar"/>
<div class="uploadform">
<xsl:choose>

@ -0,0 +1,380 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<xsl:template name="results">
<xsl:call-template name="searchbar"/>
<div>
<xsl:choose>
<xsl:when test="//results/@query!=''">
<xsl:value-of select="$locale_strings[@id='results_for_query']" />
"<xsl:value-of select="//results/@query" />"
<xsl:if test="//results/@orderby!=''">
<xsl:value-of select="$locale_strings[@id='ordered_by']" />
<xsl:choose>
<xsl:when test="//results/@orderby='relevance'">
<xsl:value-of select="$locale_strings[@id='relevance']" />
</xsl:when>
<xsl:when test="//results/@orderby='duration'">
<xsl:value-of select="$locale_strings[@id='duration']" />
</xsl:when>
<xsl:when test="//results/@orderby='filesize'">
<xsl:value-of select="$locale_strings[@id='filesize']" />
</xsl:when>
<xsl:when test="//results/@orderby='viewcount'">
<xsl:value-of select="$locale_strings[@id='viewcount']" />
</xsl:when>
<xsl:when test="//results/@orderby='downloadcount'">
<xsl:value-of select="$locale_strings[@id='downloadcount']" />
</xsl:when>
<xsl:when test="//results/@orderby='timestamp'">
<xsl:value-of select="$locale_strings[@id='timestamp']" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="//results/@sort='asc'">
<xsl:value-of select="$locale_strings[@id='ascending']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$locale_strings[@id='descending']" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:when test="//results/@orderby!=''">
<xsl:choose>
<xsl:when test="//results/@orderby='timestamp'">
<xsl:choose>
<xsl:when test="//results/@sort='asc'">
the oldest videos
</xsl:when>
<xsl:otherwise>
the newest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="//results/@orderby='downloadcount'">
<xsl:choose>
<xsl:when test="//results/@sort='asc'">
the least downloaded videos
</xsl:when>
<xsl:otherwise>
the most downloaded videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="//results/@orderby='viewcount'">
<xsl:choose>
<xsl:when test="//results/@sort='asc'">
the least viewed videos
</xsl:when>
<xsl:otherwise>
the most viewed videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="//results/@orderby='duration'">
<xsl:choose>
<xsl:when test="//results/@sort='asc'">
the shortest videos
</xsl:when>
<xsl:otherwise>
the lengthest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="//results/@orderby='filesize'">
<xsl:choose>
<xsl:when test="//results/@sort='asc'">
the smallest videos
</xsl:when>
<xsl:otherwise>
the biggest videos
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</div>
<div>
<xsl:value-of select="//results/@resultcount" /> results on <xsl:value-of select="//results/@lastpage" /> pages
</div>
<xsl:call-template name="pagination"/>
<table class="results" align="center">
<xsl:for-each select="//results/result">
<tr class="result">
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<img>
<xsl:attribute name="src">
<xsl:value-of select="@thumbnail" />
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
</xsl:attribute>
</img>
</a>
</td>
<td><h2>
<a>
<xsl:attribute name="href">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
</a>
</h2>
<table class="videometadata">
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='duration']" />:
</td>
<td class="rightcell">
<xsl:variable name="minutes" select="floor(@duration div 60)" />
<xsl:variable name="hours" select="floor(@duration div 3600)" />
<xsl:variable name="seconds" select="@duration - $minutes*60 - $hours*3600" />
<xsl:value-of select="concat($hours, ':', format-number($minutes, '00'), ':', format-number($seconds, '00'))" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='viewcount']" />:
</td>
<td class="rightcell">
<xsl:value-of select="@viewcount" />
</td>
</tr>
</table>
<xsl:if test="@edit='true'">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@duration=0">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(rdf:RDF/cc:Work/dc:identifier, '/edit=true')" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<img src="/images/tango/accessories-text-editor.png" style="border:0;vertical-align:bottom;" />edit
</a>
</xsl:if>
</td>
</tr>
</xsl:for-each>
</table>
<xsl:call-template name="pagination"/>
<div>
<form method="get">
<xsl:attribute name="action">
<xsl:value-of select="//results/@scriptname" />
</xsl:attribute>
<fieldset>
<input type="hidden">
<xsl:attribute name="name">
<xsl:value-of select="//results/@argument" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="//results/@value" />
</xsl:attribute>
</input>
order by:
<select name="orderby">
<xsl:if test="//results/@query!=''">
<option value="relevance">
<xsl:if test="//results/@orderby='relevance'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='relevance']" />
</option>
</xsl:if>
<option value="filesize">
<xsl:if test="//results/@orderby='filesize'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='filesize']" />
</option>
<option value="duration">
<xsl:if test="//results/@orderby='duration'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='duration']" />
</option>
<option value="viewcount">
<xsl:if test="//results/@orderby='viewcount'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='viewcount']" />
</option>
<option value="downloadcount">
<xsl:if test="//results/@orderby='downloadcount'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='downloadcount']" />
</option>
<option value="timestamp">
<xsl:if test="//results/@orderby='timestamp'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='timestamp']" />
</option>
</select>
<select name="sort">
<option value="desc">
<xsl:if test="//results/@sort='desc'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='descending']" />
</option>
<option value="asc">
<xsl:if test="//results/@sort='asc'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='ascending']" />
</option>
</select>
pagesize:
<select name="pagesize">
<option>
<xsl:if test="//results/@pagesize='1'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
1
</option>
<option>
<xsl:if test="//results/@pagesize='2'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
2
</option>
<option>
<xsl:if test="//results/@pagesize='5'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
5
</option>
<option>
<xsl:if test="//results/@pagesize='10'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
10
</option>
<option>
<xsl:if test="//results/@pagesize='20'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
20
</option>
<option>
<xsl:if test="//results/@pagesize='50'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
50
</option>
<option>
<xsl:if test="//results/@pagesize='100'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
100
</option>
</select>
<input type="submit" />
</fieldset>
</form>
</div>
</xsl:template>
<xsl:template name="pagination">
<xsl:variable name="query_string" select="concat(//results/@scriptname, '?', //results/@argument, '=', //results/@value, '&amp;orderby=', //results/@orderby, '&amp;sort=', //results/@sort, '&amp;pagesize=', //results/@pagesize)" />
<div>
<xsl:choose>
<xsl:when test="//results/@currentpage&lt;=1">
&lt;&lt; &lt;
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=1')" />
</xsl:attribute>
&lt;&lt;
</a>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@currentpage - 1)" />
</xsl:attribute>
&lt;
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="//results/@currentpage > 2">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@currentpage - 2)" />
</xsl:attribute>
<xsl:value-of select="//results/@currentpage - 2" />
</a>
</xsl:if>
<xsl:if test="//results/@currentpage > 1">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@currentpage - 1)" />
</xsl:attribute>
<xsl:value-of select="//results/@currentpage - 1" />
</a>
</xsl:if>
<xsl:value-of select="//results/@currentpage" />
<xsl:variable name="temp" select="//results/@lastpage - //results/@currentpage" />
<xsl:if test="$temp > 0">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@currentpage + 1)" />
</xsl:attribute>
<xsl:value-of select="//results/@currentpage + 1" />
</a>
</xsl:if>
<xsl:if test="$temp > 1">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@currentpage + 2)" />
</xsl:attribute>
<xsl:value-of select="//results/@currentpage + 2" />
</a>
</xsl:if>
<xsl:choose>
<xsl:when test="//results/@lastpage&lt;=//results/@currentpage">
&gt; &gt;&gt;
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@currentpage + 1)" />
</xsl:attribute>
&gt;
</a>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($query_string, '&amp;page=', //results/@lastpage)" />
</xsl:attribute>
&gt;&gt;
</a>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<xsl:template name="video">
<xsl:call-template name="searchbar"/>
<div class="video">
<xsl:choose>
<xsl:when test="//video/@cortado='true'">
<applet
code="com.fluendo.player.Cortado.class"
archive="/java/cortado-ovt-stripped-0.2.2.jar"
>
<xsl:attribute name="width">
<xsl:value-of select="//video/@width" />
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="//video/@height" />
</xsl:attribute>
<param name="url">
<xsl:attribute name="value">
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/@rdf:about,'/view=true')" />
</xsl:attribute>
</param>
<param name="seekable" value="true"/>
<param name="duration">
<xsl:attribute name="value">
<xsl:value-of select="//video/@duration" />
</xsl:attribute>
</param>
<param name="keepAspect" value="true"/>
<param name="video" value="true"/>
<param name="audio" value="true"/>
<param name="statusHeight" value="24"/>
<param name="autoPlay" value="true"/>
<param name="showStatus" value="show"/>
<param name="bufferSize" value="200"/>
</applet>
<div>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, '/cortado=false')" />
</xsl:attribute>
Watch using Browser Video Plugin
</a>
</div>
</xsl:when>
<xsl:otherwise>
<object>
<xsl:attribute name="width">
<xsl:value-of select="//video/@width" />
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="//video/@height + 16" />
</xsl:attribute>
<xsl:attribute name="data">
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/@rdf:about,'/view=true')" />
</xsl:attribute>
</object>
<div>
<a>
<xsl:attribute name="href">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
Watch using Cortado Java Applet
</a>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
<div class="videodownload">
<a>
<xsl:attribute name="href">
<xsl:value-of select="//video/rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute>
<img src="/images/tango/document-save.png" />
</a>
<a>
<xsl:attribute name="href">
<xsl:value-of select="//video/rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute>
<br />
<xsl:value-of select="$locale_strings[@id='download_video']" />
</a>
</div>
<div class="videoccdata">
<a>
<xsl:attribute name="href">
<xsl:value-of select="//video/rdf:RDF/cc:License/@rdf:about" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='license_conditions']" />:
</a>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="//video/rdf:RDF/cc:License/@rdf:about" />
</xsl:attribute>
<!--
unfinished bizness
<xsl:value-of select="@rdf:about" />
<xsl:if test="true()">
<img src="./images/cc/somerights.png" />
</xsl:if>
-->
<xsl:for-each select="//video/rdf:RDF/cc:License/cc:permits">
<!--
since we are talking about digital media here, distribution actually /is/ reproduction
(also, i was too stupid to figure out how to test for both conditions).
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/Reproduction'">
<img src="./images/cc/cc-share.png" />
</xsl:if>
-->
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/Distribution'">
<img src="./images/cc/cc-share.png" />
</xsl:if>
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/DerivativeWorks'">
<img src="./images/cc/cc-remix.png" />
</xsl:if>
</xsl:for-each>
<xsl:for-each select="rdf:RDF/cc:License/cc:requires">
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/Notice'">
<img src="./images/cc/cc-by.png" />
</xsl:if>
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/ShareAlike'">
<img src="./images/cc/cc-sharealike.png" />
</xsl:if>
<!--
source code doesn't make much sense in video context.
still, this is preserved for potential future use.
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/SourceCode'">
SOURCE
</xsl:if>
-->
</xsl:for-each>
<xsl:for-each select="rdf:RDF/cc:License/cc:prohibits">
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/CommercialUse'">
<img src="./images/cc/cc-noncommercial.png" />
</xsl:if>
<xsl:if test="@rdf:resource = 'http://web.resource.org/cc/DerivativeWorks'">
<img src="./images/cc/cc-noderivatives.png" />
</xsl:if>
</xsl:for-each>
</a>
</div>
<table class="videometadata">
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Title']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:title" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Creator']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:creator" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Subject']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:subject" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Description']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:description" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Publisher']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:publisher" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Date']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:date" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Source']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:source" />
</td>
</tr>
<tr>
<td class="leftcell">
<xsl:value-of select="$locale_strings[@id='DC.Rights']" />:
</td>
<td class="rightcell">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:rights" />
</td>
</tr>
</table>
<table class="referer">
<xsl:for-each select="//referers/referer">
<tr>
<td class="leftcell">
<xsl:value-of select="@count" />
</td>
<td class="rightcell">
<xsl:value-of select="@referer" />
</td>
</tr>
</xsl:for-each>
</table>
<xsl:call-template name="comments"/>
<xsl:if test="not(//@username='')">
<div class="commentform">
<form method="post">
<xsl:attribute name="action">
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:identifier" />
</xsl:attribute>
<fieldset>
<br />
<textarea name="comment" cols="30" rows="3" />
<br />
<input type="submit" name="send">
<xsl:attribute name="value">
<xsl:value-of select="$locale_strings[@id='comment_post']" />
</xsl:attribute>
</input>
</fieldset>
</form>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="comments">
<div class="comments">
<span class="protip">
<xsl:value-of select="$locale_strings[@id='comment_on_video']" />
</span>
<br />
<xsl:for-each select="//comments/comment">
<div class="comment">
<a>
<xsl:attribute name="href">
./user/<xsl:value-of select="@username" />
</xsl:attribute>
<xsl:value-of select="@username" />
</a>:
<br />
<xsl:value-of select="." />
</div>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save