Actually use pipe instead of comma
[mspang/www.git] / xsl / media.xsl
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet version="1.0"
4     xmlns="http://www.w3.org/1999/xhtml"
5     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6     xmlns:csc="http://csclub.uwaterloo.ca/xsltproc">
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:if test="position() != last()"> | </xsl:if>
13 </xsl:template>
14
15 <xsl:template match="flvfile">
16   <xsl:param name="mirror" />
17   <script type="text/javascript" src="../flash/swfobject.js"><xsl:text> </xsl:text></script>
18   <p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
19     Get the Flash Player</a> to see this video using Flash Player.</p>
20   <script type="text/javascript">
21     var s1 = new SWFObject("../flash/flvplayer.swf","single","400","300","7");
22     s1.addParam("allowfullscreen","true");
23     s1.addVariable("file","<xsl:value-of select="$mirror" /><xsl:value-of select="@file" />");
24     <xsl:if test="@preview">
25       s1.addVariable("image","http://csclub.uwaterloo.ca/files/<xsl:value-of select="@preview" />");
26     </xsl:if>
27     s1.write("player1");
28   </script>
29 </xsl:template>
30
31 <xsl:template match="mediaitem">
32   <xsl:call-template name="makemediaitem">
33     <xsl:with-param name="mirror" select="$g_mirror_csc" />
34     <xsl:with-param name="bittorrent">yes</xsl:with-param>
35     <xsl:with-param name="ads">yes</xsl:with-param>
36   </xsl:call-template>
37   <xsl:call-template name="makemediaitem">
38     <xsl:with-param name="suffix">-uw</xsl:with-param>
39     <xsl:with-param name="infotext">
40       <p>
41         If you are in residence, downloading these files will not count
42         against your ResNet quota.
43       </p>
44     </xsl:with-param>
45     <xsl:with-param name="mirror" select="$g_mirror_cs" />
46   </xsl:call-template>
47   <li><a href= "{@title}.html"><xsl:value-of select="@title" /></a></li>
48 </xsl:template>
49
50 <xsl:template name="makemediaitem">
51   <xsl:param name="suffix" />
52   <xsl:param name="infotext" />
53   <xsl:param name="mirror" />
54   <xsl:param name="bittorrent" />
55   <xsl:param name="ads" />
56   <xsl:variable name="realurl" select="concat('http://csclub.uwaterloo.ca/media/', csc:encode-for-uri(@title), '.html')" />
57   <xsl:document method="xml" encoding="ISO-8859-1"
58       doctype-public="-//W3C//DTD XHTML 1.1//EN"
59       doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
60       href="{concat($g_outdir, @title, $suffix, '.html')}">
61     <html>
62       <head>
63         <title><xsl:value-of select="@title" /></title>
64         <link rel="stylesheet" href="{$g_pre}default.css" type="text/css" />
65       </head>
66       <body><div>
67         <xsl:call-template name="header">
68           <xsl:with-param name="title" select="@title" />
69           <xsl:with-param name="href" select="concat(@title, $suffix, '.html')" />
70         </xsl:call-template>
71         <xsl:call-template name="donate-now" />
72         <xsl:if test="abstract">
73           <h2>Abstract</h2>
74           <div>
75             <xsl:apply-templates select="abstract/node()" />
76           </div>
77         </xsl:if>
78         <xsl:if test="flvfile">
79           <h2>View</h2>
80         <div>
81           <xsl:apply-templates select="flvfile">
82             <xsl:with-param name="mirror" select="$mirror" />
83           </xsl:apply-templates>
84         </div>
85         </xsl:if>
86         <xsl:if test="mediafile">
87           <h2>Download</h2>
88           <div>
89             <xsl:copy-of select="$infotext" />
90             <xsl:if test="$bittorrent = 'yes'">
91               <p class="mediafile">
92                 BitTorrent:
93                 <xsl:apply-templates select="mediafile">
94                   <xsl:with-param name="ext">.torrent</xsl:with-param>
95                   <xsl:with-param name="mirror" select="$mirror" />
96                 </xsl:apply-templates>
97               </p>
98             </xsl:if>
99             <p class="mediafile">
100               HTTP (web browser):
101               <xsl:apply-templates select="mediafile">
102                 <xsl:with-param name="mirror" select="$mirror" />
103               </xsl:apply-templates>
104             </p>
105           </div>
106         </xsl:if>
107         <xsl:if test="@buttons = 'yes'">
108           <p>
109             <!-- digg button -->
110             <script type="text/javascript">
111               digg_url = '<xsl:value-of select="$realurl" />';
112             </script>
113             <script src="http://digg.com/tools/diggthis.js"
114                     type="text/javascript">
115               <xsl:text> </xsl:text>
116             </script>
117             <!-- reddit button -->
118             <script type="text/javascript">
119               reddit_url = '<xsl:value-of select="$realurl" />';
120               reddit_title = '<xsl:value-of select="csc:encode-for-uri(@title)" />';
121             </script>
122             <script src="http://reddit.com/button.js?t=3"
123                     type="text/javascript">
124               <xsl:text> </xsl:text>
125             </script>
126           </p>
127         </xsl:if>
128         <xsl:if test="other">
129         <div>
130           <xsl:apply-templates select="other/node()" />
131           </div>
132         </xsl:if>
133         <p>
134           <!-- AddThis Bookmark Button -->
135           <script type="text/javascript">
136             addthis_url = '<xsl:value-of select="$realurl" />';
137             addthis_title = document.title;
138             addthis_pub = 'calumt';
139           </script>
140           <script type="text/javascript"
141                   src="http://s7.addthis.com/js/addthis_widget.php?v=12">
142             <xsl:text> </xsl:text>
143           </script>
144         </p>
145         <xsl:call-template name="donate-now" />
146         <xsl:if test="$ads">
147           <xsl:call-template name="inline-ads" />
148         </xsl:if>
149         <xsl:call-template name="footer" />
150       </div></body>
151     </html>
152   </xsl:document>
153 </xsl:template>
154
155 </xsl:stylesheet>