javascript playback degrades gracefully, also refactoring of source

git-svn-id: http://yolanda.mister-muffin.de/svn@248 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
erlehmann 2008-03-07 19:49:19 +00:00
parent 20687eb49e
commit d29472ed63
4 changed files with 288 additions and 48 deletions

View file

@ -0,0 +1,61 @@
<?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="footer">
<div class="footer">
<a class="footer view-license">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_license']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='footer_license']" />
</a>
<a class="footer view-source-code">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_source-code']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='footer_source_code']" />
</a>
<a class="footer report-bug">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_report_bug']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='footer_report_bug']" />
</a>
<a class="footer view-xml">
<xsl:attribute name="href">
<!--
caveat: this currently does not work on root level
apache magic wanted
-->
?xslt=null
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='footer_view_xml']" />
</a>
</div>
<!--
<br />
<xsl:value-of select="$locale_strings[@id='footer_copyright']" />
-->
<br />
<span class="protip">
<xsl:value-of select="$locale_strings[@id='footer_warranty']" />
</span>
</xsl:template>
</xsl:stylesheet>

110
trunk/xsl/xhtml/header.xsl Normal file
View file

@ -0,0 +1,110 @@
<?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="header">
<div class="header">
<a class="header latest-additions">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_query_latestadditions']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='query_latestadditions']" />
</a>
<a class="header most-views">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_query_mostviews']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='query_mostviews']" />
</a>
<a class="header most-downloads">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_query_mostdownloads']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='query_mostdownloads']" />
</a>
<xsl:choose>
<xsl:when test="string-length(//@username)=0">
<!--
<a class="header">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='header_login-to-upload']" />
</a>
-->
<a class="header register">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_register']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='register']" />
</a>
<a class="header login">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='login']" />
</a>
<a class="header login-openid">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_login-openid']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='login_openid']" />
</a>
</xsl:when>
<xsl:otherwise>
<a class="header upload-video">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_upload']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='header_upload-video']" />
</a>
<a class="header preferences">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_settings']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='settings_details']" />
</a>
<!--
<xsl:value-of select="$locale_strings[@id='logged_in_as']" />
<a class="header">
<xsl:attribute name="href">
user/<xsl:value-of select="//@username" />
</xsl:attribute>
<xsl:value-of select="//@username" />
</a>
-->
<a class="header logout">
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_logout']" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='logout']" />
</a>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
</xsl:stylesheet>

View file

@ -38,26 +38,39 @@
<xsl:text disable-output-escaping="yes">&lt;![CDATA[ <xsl:text disable-output-escaping="yes">&lt;![CDATA[
<![CDATA[ <![CDATA[
//alert('script works');
function hide_movie() function hide_movie()
{ {
var _video = document.getElementById('video'); document.getElementById('video').style.display = 'none';
_video.style.display = 'none'; document.getElementById('thumbnail').style.display = 'block';
} }
function show_movie() function show_movie()
{ {
document.getElementById('video').style.display = 'block'; document.getElementById('video').style.display = 'block';
document.getElementById('thumbnail').style.display = 'none';
} }
]]]]></xsl:text> ]]]]></xsl:text>
<xsl:text disable-output-escaping="yes">></xsl:text> <xsl:text disable-output-escaping="yes">></xsl:text>
</script> </script>
<div class="video" id="container"> <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>
<img src="/images/flash-sucks.png"/><br />
<img src="/images/vlc.png"/>
<img src="/images/mplayer.png"/>
</object>
<div id="thumbnail" style="display: none;">
<div id="thumbnail">
<img> <img>
<xsl:attribute name="src"> <xsl:attribute name="src">
<xsl:value-of select="//video/@thumbnail" /> <xsl:value-of select="//video/@thumbnail" />
@ -72,6 +85,7 @@
<xsl:value-of select="//video/@width" /> <xsl:value-of select="//video/@width" />
</xsl:attribute> </xsl:attribute>
</img> </img>
<form method="get"> <form method="get">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="//video/rdf:RDF/cc:Work/@rdf:about" /> <xsl:value-of select="//video/rdf:RDF/cc:Work/@rdf:about" />
@ -90,22 +104,6 @@
<img src="/images/tango/document-save.png" alt="download" /> <img src="/images/tango/document-save.png" alt="download" />
</button> </button>
</form> </form>
</div>
<object type="application/ogg" style="display: none;" 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>
<img src="/images/flash-sucks.png"/><br />
<img src="/images/vlc.png"/>
<img src="/images/mplayer.png"/>
</object>
</div> </div>

View file

@ -0,0 +1,71 @@
<?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="xhtml-body">
<body>
<xsl:if test="//video">
<xsl:attribute name="onload">
hide_movie()
</xsl:attribute>
</xsl:if>
<xsl:if test="not(//@embed)">
<xsl:call-template name="header"/>
<xsl:if test="//message">
<xsl:call-template name="message"/>
</xsl:if>
<xsl:if test="//search">
<xsl:call-template name="searchbar"/>
</xsl:if>
</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="//search">
<xsl:call-template name="results"/>
</xsl:when>
<xsl:when test="//advancedsearch">
<xsl:call-template name="advancedsearch"/>
</xsl:when>
<xsl:when test="//video">
<xsl:call-template name="video"/>
</xsl:when>
<xsl:when test="//settings">
<xsl:call-template name="settings"/>
</xsl:when>
</xsl:choose>
<xsl:if test="not(//@embed)">
<xsl:call-template name="footer"/>
</xsl:if>
</body>
</xsl:template>
</xsl:stylesheet>