Added SSI code to use mirror.cs if remote client is within UW network

This commit is contained in:
David Bartley 2007-08-10 14:27:57 -04:00
parent e849e61ef7
commit dc0cc52db0
2 changed files with 39 additions and 13 deletions

View File

@ -4,7 +4,4 @@ SUBDIRS =
include ../default.mk
all:
:
chmod u+x *.html

View File

@ -4,19 +4,24 @@
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc">
<xsl:variable name="mirror_csc">http://csclub.uwaterloo.ca/files/</xsl:variable>
<xsl:variable name="mirror_cs">http://mirror.cs.uwaterloo.ca/csc/</xsl:variable>
<xsl:template match="mediafile">
<xsl:param name="ext" />
<a href="/files/{@file}{$ext}"><xsl:value-of select="@type" /></a>,
<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" />
<script type="text/javascript" src="flash/swfobject.js"></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","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@file" />");
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>
@ -47,19 +52,43 @@
<xsl:if test="flvfile">
<h2>View</h2>
<div>
<xsl:apply-templates select="flvfile" />
<xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
<xsl:apply-templates select="flvfile">
<xsl:with-param name="mirror" select="$mirror_csc" />
</xsl:apply-templates>
<xsl:comment><![CDATA[#else ]]></xsl:comment>
<xsl:apply-templates select="flvfile">
<xsl:with-param name="mirror" select="$mirror_cs" />
</xsl:apply-templates>
<xsl:comment><![CDATA[#endif ]]></xsl:comment>
</div>
</xsl:if>
<xsl:if test="mediafile">
<h2>Download</h2>
<div><strong>
<xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
If you are in residence, downloading these files will not count
against your ResNet quota.
<br/><br/>
<xsl:comment><![CDATA[#endif ]]></xsl:comment>
HTTP (web browser):
<xsl:apply-templates select="mediafile" />
<br/><br/>
BitTorrent:
<xsl:apply-templates select="mediafile" >
<xsl:with-param name="ext">.torrent</xsl:with-param>
</xsl:apply-templates>
<xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
<xsl:apply-templates select="mediafile">
<xsl:with-param name="mirror" select="$mirror_cs" />
</xsl:apply-templates>
<xsl:comment><![CDATA[#else ]]></xsl:comment>
<xsl:apply-templates select="mediafile">
<xsl:with-param name="mirror" select="$mirror_csc" />
</xsl:apply-templates>
<xsl:comment><![CDATA[#endif ]]></xsl:comment>
<xsl:comment><![CDATA[#if expr="($REMOTE_ADDR != /^129\.97\./) || ($QUERY_STRING = test)" ]]></xsl:comment>
<br/><br/>
BitTorrent:
<xsl:apply-templates select="mediafile">
<xsl:with-param name="ext">.torrent"</xsl:with-param>
<xsl:with-param name="mirror" select="$mirror_csc" />
</xsl:apply-templates>
<xsl:comment><![CDATA[#endif ]]></xsl:comment>
</strong></div>
</xsl:if>
<xsl:if test="@buttons">