Merge branch 'master' of disk:/users/www/www/
[mspang/www.git] / xsl / media.xsl
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet version="2.0"
4     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5     xmlns:xs="http://www.w3.org/2001/XMLSchema"
6     xmlns:csc="http://www.csclub.uwaterloo.ca/xslt">
7
8 <xsl:template match="mediafile">
9   <xsl:param name="ext" />
10   <xsl:param name="mirror" />
11     <a href="{$mirror}{@file}{$ext}"><xsl:value-of select="@type" /></a>, 
12 </xsl:template>
13
14 <xsl:template match="flvfile">
15   <xsl:param name="mirror" />
16   <script type="text/javascript" src="flash/swfobject.js"><xsl:text> </xsl:text></script>
17   <p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
18     Get the Flash Player</a> to see this video using Flash Player.</p>
19   <script type="text/javascript">
20     var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7");
21     s1.addParam("allowfullscreen","true");
22     s1.addVariable("file","<xsl:value-of select="$mirror" /><xsl:value-of select="@file" />");
23     <xsl:if test="@preview">
24       s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />");
25     </xsl:if>
26     s1.write("player1");
27   </script>
28 </xsl:template>
29
30 <xsl:template match="mediaitem">
31   <xsl:result-document method="xml" encoding="ISO-8859-1" 
32       doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
33       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
34       href="{translate(concat($g_root, '/media/', @title , '.html'), ' ', ' ')}">
35     <html>
36       <head>
37         <title><xsl:value-of select="@title" /></title>
38         <link rel="stylesheet" href="{$pre}default.css" type="text/css" />
39       </head>
40       <body><div>
41         <xsl:call-template name="header" />
42         <xsl:if test="abstract">
43           <h2>Abstract</h2>
44           <div>
45             <xsl:apply-templates select="abstract/node()" />
46           </div>
47         </xsl:if>
48         <xsl:if test="flvfile">
49           <h2>View</h2>
50         <div>
51           <xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
52             <xsl:apply-templates select="flvfile">
53               <xsl:with-param name="mirror" select="$mirror_cs" />
54             </xsl:apply-templates>
55           <xsl:comment><![CDATA[#else ]]></xsl:comment>
56             <xsl:apply-templates select="flvfile">
57               <xsl:with-param name="mirror" select="$mirror_csc" />
58             </xsl:apply-templates>
59           <xsl:comment><![CDATA[#endif ]]></xsl:comment>
60         </div>
61         </xsl:if>
62         <xsl:if test="mediafile">
63           <h2>Download</h2>
64           <div><strong>
65             <xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
66               If you are in residence, downloading these files will not count
67               against your ResNet quota.
68               <br/><br/>
69             <xsl:comment><![CDATA[#endif ]]></xsl:comment>
70             HTTP (web browser):
71             <xsl:comment><![CDATA[#if expr="($REMOTE_ADDR = /^129\.97\./) && ($QUERY_STRING != test)" ]]></xsl:comment>
72               <xsl:apply-templates select="mediafile">
73                 <xsl:with-param name="mirror" select="$mirror_cs" />
74               </xsl:apply-templates>
75             <xsl:comment><![CDATA[#else ]]></xsl:comment>
76               <xsl:apply-templates select="mediafile">
77                 <xsl:with-param name="mirror" select="$mirror_csc" />
78               </xsl:apply-templates>
79             <xsl:comment><![CDATA[#endif ]]></xsl:comment>
80             <xsl:comment><![CDATA[#if expr="($REMOTE_ADDR != /^129\.97\./) || ($QUERY_STRING = test)" ]]></xsl:comment>
81               <br/><br/>
82               BitTorrent:
83               <xsl:apply-templates select="mediafile">
84                 <xsl:with-param name="ext">.torrent</xsl:with-param>
85                 <xsl:with-param name="mirror" select="$mirror_csc" />
86               </xsl:apply-templates>
87             <xsl:comment><![CDATA[#endif ]]></xsl:comment>
88           </strong></div>
89         </xsl:if>
90         <xsl:if test="@buttons">
91           <br/><br/>
92           <!-- digg button -->
93           <script src="http://digg.com/tools/diggthis.js"
94                   type="text/javascript"><xsl:text> </xsl:text></script>
95           <!-- reddit button -->
96           <script type="text/javascript" 
97                   src="http://reddit.com/button.js?t=3"><xsl:text> </xsl:text></script>
98         </xsl:if>
99         <xsl:if test="other">
100         <div>
101           <xsl:copy-of select="other/node()"/>
102           </div>
103         </xsl:if>
104         <br/>
105         <!-- AddThis Bookmark Button -->
106         <script type="text/javascript">
107           addthis_url    = location.href;
108           addthis_title  = document.title;
109           addthis_pub    = 'calumt';
110         </script>
111         <script type="text/javascript"
112             src="http://s7.addthis.com/js/addthis_widget.php?v=12"><xsl:text> </xsl:text></script>
113         <!-- google ads -->
114         <!--
115         <script type="text/javascript">
116           google_ad_client = "pub-5235744946475097";
117           google_ad_width = 728;
118           google_ad_height = 90;
119           google_ad_format = "728x90_as";
120           google_ad_type = "text_image";
121           //2007-03-21: mcc
122           google_ad_channel = "1106187834";
123         </script>
124         <script type="text/javascript"
125             src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><xsl:text> </xsl:text></script>
126         -->
127         <xsl:call-template name="footer" />
128       </div></body>
129     </html>
130   </xsl:result-document>
131   <li><a href= "{@title}.html"><xsl:value-of select="@title" /></a></li>
132 </xsl:template>
133
134 </xsl:stylesheet>