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 include ../default.mk
all: all:
: chmod u+x *.html

View File

@ -4,19 +4,24 @@
xmlns:csc="http://www.csclub.uwaterloo.ca/cow" xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
extension-element-prefixes="csc"> 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:template match="mediafile">
<xsl:param name="ext" /> <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>
<xsl:template match="flvfile"> <xsl:template match="flvfile">
<xsl:param name="mirror" />
<script type="text/javascript" src="flash/swfobject.js"></script> <script type="text/javascript" src="flash/swfobject.js"></script>
<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer"> <p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
Get the Flash Player</a> to see this video using Flash Player.</p> Get the Flash Player</a> to see this video using Flash Player.</p>
<script type="text/javascript"> <script type="text/javascript">
var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7"); var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7");
s1.addParam("allowfullscreen","true"); 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"> <xsl:if test="@preview">
s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />"); s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />");
</xsl:if> </xsl:if>
@ -47,19 +52,43 @@
<xsl:if test="flvfile"> <xsl:if test="flvfile">
<h2>View</h2> <h2>View</h2>
<div> <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> </div>
</xsl:if> </xsl:if>
<xsl:if test="mediafile"> <xsl:if test="mediafile">
<h2>Download</h2> <h2>Download</h2>
<div><strong> <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): HTTP (web browser):
<xsl:apply-templates select="mediafile" /> <xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
<br/><br/> <xsl:apply-templates select="mediafile">
BitTorrent: <xsl:with-param name="mirror" select="$mirror_cs" />
<xsl:apply-templates select="mediafile" > </xsl:apply-templates>
<xsl:with-param name="ext">.torrent</xsl:with-param> <xsl:comment><![CDATA[#else ]]></xsl:comment>
</xsl:apply-templates> <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> </strong></div>
</xsl:if> </xsl:if>
<xsl:if test="@buttons"> <xsl:if test="@buttons">