Generate two media pages (on-campus and external) instead of using dynamic SSI pages.
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Sun, 12 Aug 2007 01:55:47 +0000 (21:55 -0400)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Sun, 12 Aug 2007 01:55:47 +0000 (21:55 -0400)
media/.htaccess [deleted file]
xsl/media.xsl

diff --git a/media/.htaccess b/media/.htaccess
deleted file mode 100644 (file)
index b22fc48..0000000
+++ /dev/null
@@ -1 +0,0 @@
-AddHandler server-parsed .html
index 83dd007..e7078ad 100644 (file)
 </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" />
   <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 , '.html'), ' ', ' ')}">
+      href="{translate(concat($g_root, '/media/', @title , $suffix, '.html'), ' ', ' ')}">
     <html>
       <head>
         <title><xsl:value-of select="@title" /></title>
         <xsl:if test="flvfile">
           <h2>View</h2>
         <div>
-          <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_cs" />
-            </xsl:apply-templates>
-          <xsl:comment><![CDATA[#else ]]></xsl:comment>
-            <xsl:apply-templates select="flvfile">
-              <xsl:with-param name="mirror" select="$mirror_csc" />
-            </xsl:apply-templates>
-          <xsl:comment><![CDATA[#endif ]]></xsl:comment>
+          <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: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>
+            <xsl:value-of select="$infotext" />
             HTTP (web browser):
-            <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:with-param name="mirror" select="$mirror" />
               </xsl:apply-templates>
-            <xsl:comment><![CDATA[#endif ]]></xsl:comment>
-            <xsl:comment><![CDATA[#if expr="($REMOTE_ADDR != /^129\.97\./) || ($QUERY_STRING = test)" ]]></xsl:comment>
+            <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_csc" />
+                <xsl:with-param name="mirror" select="$mirror" />
               </xsl:apply-templates>
-            <xsl:comment><![CDATA[#endif ]]></xsl:comment>
+            </xsl:if>
           </strong></div>
         </xsl:if>
         <xsl:if test="@buttons">