www/xsl/media.xsl

139 lines
5.1 KiB
XML
Raw Normal View History

<?xml version='1.0'?>
2007-08-11 04:26:38 -04:00
<xsl:stylesheet version="2.0"
2007-08-11 05:24:19 -04:00
xmlns="http://www.w3.org/1999/xhtml"
2007-08-11 04:26:38 -04:00
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
<xsl:template match="mediafile">
<xsl:param name="ext" />
<xsl:param name="mirror" />
<a href="{$mirror}{@file}{$ext}"><xsl:value-of select="@type" /></a>,
</xsl:template>
<xsl:template match="flvfile">
<xsl:param name="mirror" />
2007-08-11 04:26:38 -04:00
<script type="text/javascript" src="flash/swfobject.js"><xsl:text> </xsl:text></script>
<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
Get the Flash Player</a> to see this video using Flash Player.</p>
<script type="text/javascript">
var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7");
s1.addParam("allowfullscreen","true");
s1.addVariable("file","<xsl:value-of select="$mirror" /><xsl:value-of select="@file" />");
<xsl:if test="@preview">
s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />");
</xsl:if>
s1.write("player1");
</script>
</xsl:template>
<xsl:template match="mediaitem">
<xsl:call-template name="makemediaitem">
<xsl:with-param name="mirror" select="$mirror_csc" />
<xsl:with-param name="bittorrent">true</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="makemediaitem">
<xsl:with-param name="suffix">-uw</xsl:with-param>
<xsl:with-param name="infotext">
If you are in residence, downloading these files will not count against
your ResNet quota.<br/><br/>
</xsl:with-param>
<xsl:with-param name="mirror" select="$mirror_cs" />
</xsl:call-template>
</xsl:template>
<xsl:template name="makemediaitem">
<xsl:param name="suffix" />
<xsl:param name="infotext" />
<xsl:param name="mirror" />
<xsl:param name="bittorrent" />
2007-08-11 04:26:38 -04:00
<xsl:result-document method="xml" encoding="ISO-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
href="{translate(concat($g_root, '/media/', @title , $suffix, '.html'), ' ', ' ')}">
<html>
<head>
<title><xsl:value-of select="@title" /></title>
<link rel="stylesheet" href="{$pre}default.css" type="text/css" />
</head>
<body><div>
2007-08-11 04:26:38 -04:00
<xsl:call-template name="header" />
<xsl:if test="abstract">
<h2>Abstract</h2>
<div>
<xsl:apply-templates select="abstract/node()" />
</div>
</xsl:if>
<xsl:if test="flvfile">
<h2>View</h2>
<div>
<xsl:apply-templates select="flvfile">
<xsl:with-param name="mirror" select="$mirror" />
</xsl:apply-templates>
</div>
</xsl:if>
<xsl:if test="mediafile">
<h2>Download</h2>
<div><strong>
<xsl:value-of select="$infotext" />
HTTP (web browser):
<xsl:apply-templates select="mediafile">
<xsl:with-param name="mirror" select="$mirror" />
</xsl:apply-templates>
<xsl:if test="$bittorrent">
<br/><br/>
BitTorrent:
<xsl:apply-templates select="mediafile">
<xsl:with-param name="ext">.torrent</xsl:with-param>
<xsl:with-param name="mirror" select="$mirror" />
</xsl:apply-templates>
</xsl:if>
</strong></div>
</xsl:if>
<xsl:if test="@buttons">
<br/><br/>
<!-- digg button -->
2007-08-11 04:26:38 -04:00
<script src="http://digg.com/tools/diggthis.js"
type="text/javascript"><xsl:text> </xsl:text></script>
<!-- reddit button -->
<script type="text/javascript"
2007-08-11 04:26:38 -04:00
src="http://reddit.com/button.js?t=3"><xsl:text> </xsl:text></script>
</xsl:if>
2007-07-20 03:27:01 -04:00
<xsl:if test="other">
<div>
<xsl:copy-of select="other/node()"/>
</div>
</xsl:if>
<br/>
<!-- AddThis Bookmark Button -->
<script type="text/javascript">
addthis_url = location.href;
addthis_title = document.title;
addthis_pub = 'calumt';
</script>
<script type="text/javascript"
2007-08-11 04:26:38 -04:00
src="http://s7.addthis.com/js/addthis_widget.php?v=12"><xsl:text> </xsl:text></script>
<!-- google ads -->
<!--
<script type="text/javascript">
google_ad_client = "pub-5235744946475097";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2007-03-21: mcc
google_ad_channel = "1106187834";
</script>
<script type="text/javascript"
2007-08-11 04:26:38 -04:00
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><xsl:text> </xsl:text></script>
-->
<xsl:call-template name="footer" />
</div></body>
</html>
2007-08-11 04:26:38 -04:00
</xsl:result-document>
<li><a href= "{@title}.html"><xsl:value-of select="@title" /></a></li>
</xsl:template>
</xsl:stylesheet>