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