2007-10-28 03:06:45 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version= "1.0"
2008-02-14 22:23:25 +00:00
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#"
2007-10-28 03:06:45 +00:00
>
<xsl:template name= "video" >
2007-12-27 01:54:22 +00:00
2008-03-02 09:56:02 +00:00
<!--
2008-03-24 16:04:46 +00:00
<div class= "videotitle" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:title" />
<xsl:variable name= "hours" select= "floor(//video/@duration div 3600)" />
<xsl:variable name= "minutes" select= "floor((//video/@duration - $hours*3600) div 60)" />
<xsl:variable name= "seconds" select= "//video/@duration - $minutes*60 - $hours*3600" />
<xsl:choose >
<xsl:when test= "$hours=0" >
(<xsl:value-of select= "concat(format-number($minutes, '00'), ':', format-number($seconds, '00'))" /> )
</xsl:when>
<xsl:otherwise >
(<xsl:value-of select= "concat($hours, ':', format-number($minutes, '00'), ':', format-number($seconds, '00'))" /> )
</xsl:otherwise>
</xsl:choose>
</div>
2008-03-02 09:56:02 +00:00
-->
<script type= "text/javascript" >
<!--
this looks awfully ugly, but nevertheless generates javascript inside _valid_ XHTML
kudos to toby white who details the solution on http://scispace.net/tow21/weblog/718.html
-->
<xsl:text disable-output-escaping= "yes" > < ![CDATA[
< ![CDATA[
function hide_movie()
{
2008-03-07 19:49:19 +00:00
document.getElementById('video').style.display = 'none';
2008-03-24 16:04:46 +00:00
document.getElementById('preview').style.display = 'block';
2008-03-02 09:56:02 +00:00
}
function show_movie()
{
2008-03-08 19:40:02 +00:00
document.getElementById('video').style.display = 'inline';
2008-03-24 16:04:46 +00:00
document.getElementById('preview').style.display = 'none';
window.setTimeout("hide_movie()",
]]>
</xsl:text>
<!--
window.setTimeout is the stupidest hack i could imagine
it doesn't work reliably because of BUFFERING, but
3 seconds for initializing should be enough for now ...
-->
<xsl:value-of select= "(//video/@duration + 3) * 1000" />
<xsl:text disable-output-escaping= "yes" >
< ![CDATA[
);
2008-03-07 18:43:25 +00:00
}
2008-03-02 09:56:02 +00:00
]]]]></xsl:text>
<xsl:text disable-output-escaping= "yes" > ></xsl:text>
</script>
2008-03-24 16:04:46 +00:00
<xsl:call-template name= "video-description" />
2008-03-08 19:40:02 +00:00
2008-03-27 16:43:08 +00:00
<xsl:call-template name= "video-cclicense" />
2008-03-24 16:04:46 +00:00
<xsl:call-template name= "video-metadata" />
2008-03-02 09:56:02 +00:00
2008-03-27 16:43:08 +00:00
<!--
2008-03-24 16:04:46 +00:00
<xsl:call-template name= "video-actions" />
2008-03-27 16:43:08 +00:00
-->
2008-02-14 22:23:25 +00:00
2008-03-24 16:04:46 +00:00
<xsl:call-template name= "video-object" />
2008-03-08 19:40:02 +00:00
2008-03-27 16:43:08 +00:00
<div class= "protip-embed" >
<xsl:value-of select= "$locale_strings[@id='protip_embed']" />
<br />
<code >
< object data="<xsl:value-of select= "concat(//rdf:RDF/cc:Work/dc:identifier, 'embed=true')" /> "
type="application/xml"
width=<xsl:value-of select= "//video/@width + 24" />
height=<xsl:value-of select= "//video/@height + 48" />
/>
</code>
2008-03-08 19:40:02 +00:00
</div>
2008-02-14 22:23:25 +00:00
2008-03-02 09:56:02 +00:00
<!--
2008-03-24 16:04:46 +00:00
comment system is broken (similar to the german online petition system)
if a video ever gets OVER NEIN THOUSAND comments, the shit hits the fan
2008-02-14 22:23:25 +00:00
2008-03-24 16:04:46 +00:00
<xsl:call-template name= "commentform" />
<xsl:call-template name= "comments" />
-->
2008-02-14 22:23:25 +00:00
2007-10-28 03:06:45 +00:00
</xsl:template>
<xsl:template name= "comments" >
2008-02-14 22:23:25 +00:00
<div class= "comments" >
<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>
2007-10-28 03:06:45 +00:00
</xsl:template>
2007-12-27 01:54:22 +00:00
<xsl:template name= "commentform" >
2008-02-14 22:23:25 +00:00
<xsl:choose >
<xsl:when 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:when>
<xsl:otherwise >
<div class= "commentform" >
<span class= "protip" >
<xsl:value-of select= "$locale_strings[@id='login_to_comment']" />
</span>
</div>
</xsl:otherwise>
</xsl:choose>
2007-12-27 01:54:22 +00:00
</xsl:template>
2008-03-27 16:43:08 +00:00
<xsl:template name= "video-cclicense" >
<div class= "cc-license" >
<!--
TODO: make image paths relative
TODO: internationalized alt attributes
2007-12-07 20:54:21 +00:00
2008-02-14 22:23:25 +00:00
<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 />
2008-03-27 16:43:08 +00:00
-->
2008-02-14 22:23:25 +00:00
<a >
<xsl:attribute name= "href" >
<xsl:value-of select= "//video/rdf:RDF/cc:License/@rdf:about" />
</xsl:attribute>
2007-12-07 20:54:21 +00:00
<!--
2008-02-14 22:23:25 +00:00
unfinished bizness
<xsl:value-of select= "@rdf:about" />
<xsl:if test= "true()" >
2008-03-27 16:43:08 +00:00
<img src= "/images/cc/somerights.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
2007-12-07 20:54:21 +00:00
-->
2008-02-14 22:23:25 +00:00
<xsl:for-each select= "//video/rdf:RDF/cc:License/cc:permits" >
2007-12-07 20:54:21 +00:00
<!--
2008-03-27 16:43:08 +00:00
since we are talking about digital media here, distribution actually /is/ reproduction.
2008-02-14 22:23:25 +00:00
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/Reproduction'" >
2008-03-27 16:43:08 +00:00
<img src= "./images/cc/32x32/cc-share.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
2007-12-07 20:54:21 +00:00
-->
2008-02-14 22:23:25 +00:00
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/Distribution'" >
2008-03-27 16:43:08 +00:00
<img alt= "share" src= "/images/cc/32x32/cc-share.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/DerivativeWorks'" >
2008-03-27 16:43:08 +00:00
<img alt= "remix" src= "/images/cc/32x32/cc-remix.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
</xsl:for-each>
2008-03-27 16:43:08 +00:00
<xsl:for-each select= "//video/rdf:RDF/cc:License/cc:requires" >
2008-02-14 22:23:25 +00:00
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/Notice'" >
2008-03-27 16:43:08 +00:00
<img alt= "by" src= "/images/cc/32x32/cc-by.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/ShareAlike'" >
2008-03-27 16:43:08 +00:00
<img alt= "sharealike" src= "/images/cc/32x32/cc-sharealike.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
2007-12-07 20:54:21 +00:00
<!--
2008-03-27 16:43:08 +00:00
source code doesn't make much sense in video context
(the blender people probably would like it)
2008-02-14 22:23:25 +00:00
still, this is preserved for potential future use.
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/SourceCode'" >
2008-03-27 16:43:08 +00:00
<img src= "/images/cc/32x32/cc-source-code.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
2008-03-27 16:43:08 +00:00
--> </xsl:for-each>
<xsl:for-each select= "//video/rdf:RDF/cc:License/cc:prohibits" >
2008-02-14 22:23:25 +00:00
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/CommercialUse'" >
2008-03-27 16:43:08 +00:00
<img alt= "noncommercial" src= "/images/cc/32x32/cc-noncommercial.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
<xsl:if test= "@rdf:resource = 'http://web.resource.org/cc/DerivativeWorks'" >
2008-03-27 16:43:08 +00:00
<img alt= "noderivatives" src= "/images/cc/32x32/cc-noderivatives.png" />
2008-02-14 22:23:25 +00:00
</xsl:if>
</xsl:for-each>
</a>
</div>
2007-12-07 20:54:21 +00:00
</xsl:template>
2008-03-27 16:43:08 +00:00
<!--
2008-03-24 16:04:46 +00:00
<xsl:template name= "video-actions" >
<div class= "button-download" >
<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>
<br />
<a >
<xsl:attribute name= "href" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute>
<xsl:value-of select= "$locale_strings[@id='video_download']" />
</a>
<br />
(<xsl:value-of select= "format-number(number(round(//video/@filesize) div 1048576), '0.0#')" />   <xsl:value-of select= "$locale_strings[@id='unit_megabytes']" /> )
</div>
</xsl:template>
2008-03-27 16:43:08 +00:00
-->
2007-12-27 01:54:22 +00:00
2008-03-24 16:04:46 +00:00
<xsl:template name= "video-description" >
2007-12-27 01:54:22 +00:00
2008-03-24 16:04:46 +00:00
<div class= "description" >
<h1 >
2008-03-27 16:43:08 +00:00
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:title" />  
2008-03-24 16:04:46 +00:00
<span class= "duration" >
<xsl:variable name= "hours" select= "floor(//video/@duration div 3600)" />
<xsl:variable name= "minutes" select= "floor((//video/@duration - $hours*3600) div 60)" />
<xsl:variable name= "seconds" select= "//video/@duration - $minutes*60 - $hours*3600" />
<xsl:choose >
<xsl:when test= "$hours=0" >
<xsl:value-of select= "concat(format-number($minutes, '00'), ':', format-number($seconds, '00'))" />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "concat($hours, ':', format-number($minutes, '00'), ':', format-number($seconds, '00'))" />
</xsl:otherwise>
</xsl:choose>
</span>
</h1>
2008-02-14 22:23:25 +00:00
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:description" />
2008-03-24 16:04:46 +00:00
</div>
2007-12-27 01:54:22 +00:00
2008-03-24 16:04:46 +00:00
</xsl:template>
<xsl:template name= "video-metadata" >
<div class= "metadata" >
2007-12-27 01:54:22 +00:00
2008-02-14 22:23:25 +00:00
<table class= "metadata" >
2007-12-27 01:54:22 +00:00
2008-02-14 22:23:25 +00:00
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Creator']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:creator" />
</td>
</tr>
2007-12-27 01:54:22 +00:00
<!--
2008-02-14 22:23:25 +00:00
dc:contributor is not in upload interface
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Contributor']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:contributor" />
</td>
</tr>
2007-12-27 01:54:22 +00:00
-->
2008-02-14 22:23:25 +00:00
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Coverage']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:coverage" />
</td>
</tr>
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Rights']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:rights" />
</td>
</tr>
2008-03-27 16:43:08 +00:00
<!--
2008-02-14 22:23:25 +00:00
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Publisher']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:publisher" />
</td>
</tr>
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Date']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:date" />
</td>
</tr>
2008-03-27 16:43:08 +00:00
-->
2008-02-14 22:23:25 +00:00
<tr >
<td class= "metadata-title" >
<xsl:value-of select= "$locale_strings[@id='DC.Source']" /> :
</td>
<td class= "metadata-content" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:source" />
</td>
</tr>
</table>
</div>
2007-12-27 01:54:22 +00:00
</xsl:template>
2008-03-24 16:04:46 +00:00
<xsl:template name= "video-object" >
<object type= "application/ogg" id= "video" >
<xsl:attribute name= "width" >
<xsl:value-of select= "//video/@width" />
</xsl:attribute>
<xsl:attribute name= "height" >
<xsl:value-of select= "//video/@height" />
</xsl:attribute>
<xsl:attribute name= "data" >
<xsl:value-of select= "concat(//video/rdf:RDF/cc:Work/@rdf:about,'view=true')" />
</xsl:attribute>
<div class= "messagebox" id= "error" >
<xsl:value-of select= "$locale_strings[@id='error_no_ogg_plugin']" />
</div>
<div style= "margin-right:22em;" >
<!--
TODO: we need a plugin download area
(has to contain download links for every system)
-->
<img src= "/images/vlc.png" />
<img src= "/images/mplayer.png" />
<img src= "/images/totem.png" />
</div>
</object>
<div id= "preview" style= "display: none;" >
<img >
<xsl:attribute name= "src" >
<xsl:value-of select= "//video/@thumbnail" />
</xsl:attribute>
<xsl:attribute name= "alt" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/dc:title" />
</xsl:attribute>
<xsl:attribute name= "height" >
<xsl:value-of select= "//video/@height" />
</xsl:attribute>
<xsl:attribute name= "width" >
<xsl:value-of select= "//video/@width" />
</xsl:attribute>
</img>
<form >
<xsl:attribute name= "action" >
<xsl:value-of select= "//video/rdf:RDF/cc:Work/@rdf:about" />
</xsl:attribute>
<button
name="playback"
type="button"
onclick="show_movie()"
>
<xsl:attribute name= "value" >
<xsl:value-of select= "$locale_strings[@id='video_playback']" />
</xsl:attribute>
<img src= "/images/tango/128x128/player_play.png" >
<xsl:attribute name= "alt" >
<xsl:value-of select= "$locale_strings[@id='video_playback']" />
</xsl:attribute>
</img>
</button>
<button
name="download"
type="submit"
>
<xsl:attribute name= "value" >
<xsl:value-of select= "$locale_strings[@id='video_download']" />
</xsl:attribute>
<img src= "/images/tango/128x128/document-save.png" >
<xsl:attribute name= "alt" >
<xsl:value-of select= "$locale_strings[@id='video_download']" />
</xsl:attribute>
</img>
</button>
</form>
</div>
</xsl:template>
2007-10-28 03:06:45 +00:00
</xsl:stylesheet>