root/trunk/calendar3/deployment/webpublic/webapp/resources/demoskins/SoEDepartmental/default/default/videocal.xsl

Revision 618 (checked in by douglm, 7 years ago)

Finish off additions. Multi-stage adds due to confused eclipse plugin (user?)

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3   <xsl:output method="html" indent="yes" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd" standalone="yes"/>
4   <!-- ======================= -->
5   <!--  VIDEO FEED STYLESHEET  -->
6   <!-- ======================= -->
7
8   <!-- Run your browser full screen at 800 x 600 and feed this to video.
9        There are better approaches to this, but it's an interesting example. -->
10
11
12   <!-- **********************************************************************
13     Copyright 2006 Rensselaer Polytechnic Institute. All worldwide rights reserved.
14
15     Redistribution and use of this distribution in source and binary forms,
16     with or without modification, are permitted provided that:
17        The above copyright notice and this permission notice appear in all
18         copies and supporting documentation;
19
20         The name, identifiers, and trademarks of Rensselaer Polytechnic
21         Institute are not used in advertising or publicity without the
22         express prior written permission of Rensselaer Polytechnic Institute;
23
24     DISCLAIMER: The software is distributed" AS IS" without any express or
25     implied warranty, including but not limited to, any implied warranties
26     of merchantability or fitness for a particular purpose or any warrant)'
27     of non-infringement of any current or pending patent rights. The authors
28     of the software make no representations about the suitability of this
29     software for any particular purpose. The entire risk as to the quality
30     and performance of the software is with the user. Should the software
31     prove defective, the user assumes the cost of all necessary servicing,
32     repair or correction. In particular, neither Rensselaer Polytechnic
33     Institute, nor the authors of the software are liable for any indirect,
34     special, consequential, or incidental damages related to the software,
35     to the maximum extent the law permits. -->
36
37   <!-- DEFINE GLOBAL CONSTANTS -->
38   <xsl:variable name="appRoot" select="/bedework/approot"/>
39   <xsl:variable name="urlPrefix" select="/bedework/urlprefix"/>
40   <xsl:variable name="prevDate" select="/bedework/previousdate"/>
41   <xsl:variable name="nextDate" select="/bedework/nextdate"/>
42   <xsl:variable name="curDate" select="/bedework/currentdate/date"/>
43
44   <!-- Duration of each slide in seconds; set this to your preference -->
45   <xsl:variable name="slideDuration">10</xsl:variable>
46
47   <!-- Number of consecutive days to iterate over; set this to your preference -->
48   <xsl:variable name="dayCount">5</xsl:variable>
49
50   <!-- Skin name -->
51   <xsl:variable name="skinName">videocal</xsl:variable>
52
53   <!-- Position of the current day to be displayed -->
54   <xsl:variable name="day">
55     <xsl:choose>
56       <xsl:when test="/bedework/appvar[key='day']">
57         <xsl:choose>
58           <xsl:when test="/bedework/appvar[key='day']/value > $dayCount">1</xsl:when>
59           <xsl:otherwise>
60             <xsl:value-of select="/bedework/appvar[key='day']/value"/>
61           </xsl:otherwise>
62         </xsl:choose>
63       </xsl:when>
64       <xsl:otherwise>1</xsl:otherwise>
65     </xsl:choose>
66   </xsl:variable>
67
68   <!-- Position of the next day (add 1)-->
69   <xsl:variable name="nextDay" select="number($day)+1"/>
70
71   <!-- Event count for the current day -->
72   <xsl:variable name="eventCount" select="count(/bedework/eventscalendar/year/month/week/day[date=$curDate]/event)"/>
73
74   <!-- Position of the current event being displayed -->
75   <xsl:variable name="event">
76     <xsl:choose>
77       <xsl:when test="/bedework/appvar[key='event']">
78         <xsl:choose>
79           <xsl:when test="/bedework/appvar[key='event']/value > $eventCount">1</xsl:when>
80           <xsl:otherwise>
81             <xsl:value-of select="/bedework/appvar[key='event']/value"/>
82           </xsl:otherwise>
83         </xsl:choose>
84       </xsl:when>
85       <xsl:otherwise>1</xsl:otherwise>
86     </xsl:choose>
87   </xsl:variable>
88
89   <!-- Position of the next event (add 1)-->
90   <xsl:variable name="nextEvent" select="number($event)+1"/>
91
92   <!-- MAIN TEMPLATE -->
93   <xsl:template match="/">
94     <html lang="en">
95       <head>
96         <title>Event Calendar Video Feed</title>
97         <link rel="stylesheet" href="{$appRoot}/default/default/videocal.css"/>
98         <meta name="robots" content="noindex,nofollow"/>
99         <script language="JavaScript">
100           function today() {
101             var now = new Date();
102             var today;
103             today = now.getFullYear().toString();
104             if (now.getMonth() &lt; 9) {
105               today += "0";
106             }
107             today += (now.getMonth() + 1).toString();
108             today += now.getDate().toString();
109             return today;
110           }
111         </script>
112         <xsl:choose>
113           <xsl:when test="/bedework/periodname!='Day'">
114             <!-- we're starting up on the wrong view; go to today and begin with the first event;
115                  the title slide will display during this switch. -->
116             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/setViewPeriod.do?viewType=todayView&amp;setappvar=event(1)&amp;setappvar=day(1)&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
117           </xsl:when>
118           <xsl:when test="($nextDay > $dayCount) and ($nextEvent > $eventCount)">
119             <!-- passed the last day, and all events have been displayed,
120                  so start over: go to today, set day=1 and *event=0* to allow
121                  for the title slide "calPlug" -->
122             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/setViewPeriod.do?viewType=todayView&amp;setappvar=event(0)&amp;setappvar=day(1)&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
123           </xsl:when>
124           <xsl:when test="$nextEvent > $eventCount">
125             <!-- passed the last event for the day; go to the next day and set event=1 -->
126             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/setViewPeriod.do?date={$nextDate}&amp;viewType=dayView&amp;setappvar=event(1)&amp;setappvar=day({$nextDay})&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
127           </xsl:when>
128           <xsl:otherwise>
129             <!-- otherwise, go to the next event on the same day -->
130             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/setup.do?viewType=dayView&amp;setappvar=event({$nextEvent})&amp;setappvar=day({$day})&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
131           </xsl:otherwise>
132         </xsl:choose>
133       </head>
134       <body>
135         <xsl:choose>
136           <xsl:when test="($eventCount = 0) or ($event = 0) or (/bedework/periodname!='Day')">
137             <div id="calPlug">
138               <h1>
139                 Bedework Calendar of Events
140                 Video Feed
141               </h1>
142               <h2>http://www.bedework.org</h2>
143             </div>
144           </xsl:when>
145           <xsl:otherwise>
146             <h2 id="calTitle">
147               BEDEWORK CALENDAR OF EVENTS
148             </h2>
149             <h2 id="dayTitle">
150               <xsl:value-of select="/bedework/firstday/longdate"/><!--
151               <br/>Events: <xsl:value-of select="$event"/> of <xsl:value-of select="$eventCount"/>
152               <br/>Days: <xsl:value-of select="$day"/> of <xsl:value-of select="$dayCount"/> -->
153             </h2>
154             <xsl:apply-templates select="/bedework/eventscalendar/year/month/week/day[date=$curDate]/event[position()=$event]"/>
155           </xsl:otherwise>
156         </xsl:choose>
157         <!-- remove the following two divs if used for video -->
158         <div id="getBack">
159           (<a href="setup.do?skinNameSticky=default">restore normal calendar</a>)
160         </div>
161         <div id="info">
162           This stylesheet will rotate through five days of events at ten
163           second intervals.  It is intended as a video feed running full screen
164           at 800x600px.  It's settings
165           can be set from the top of
166           the videocal.xsl stylesheet.
167         </div>
168       </body>
169     </html>
170   </xsl:template>
171
172   <!--==== SINGLE EVENT ====-->
173   <xsl:template match="event">
174     <h1>
175       <xsl:value-of select="summary"/>
176     </h1>
177     <xsl:if test="(start/allday = 'false')">
178       <div id="time">
179         <!-- this logic needs to be updated for new event model -->
180         <xsl:choose>
181           <xsl:when test="start/time=''">
182             <xsl:value-of select="start/shortdate"/>
183           </xsl:when>
184           <xsl:when test="start/date != /bedework/firstday">
185             <xsl:value-of select="start/shortdate"/>
186             <xsl:value-of select="start/time"/>
187           </xsl:when>
188           <xsl:otherwise>
189             <xsl:value-of select="start/time"/>
190           </xsl:otherwise>
191         </xsl:choose>
192         -
193         <xsl:if test="end/longdate != start/longdate">
194           <xsl:value-of select="end/shortdate"/>
195           <xsl:text> </xsl:text>
196         </xsl:if>
197         <xsl:value-of select="end/time"/>
198       </div>
199     </xsl:if>
200     <xsl:if test="location/address!='Campus-wide'">
201       <div id="location">
202         <xsl:value-of select="location/address"/>
203       </div>
204     </xsl:if>
205     <div id="description">
206       <xsl:value-of select="description"/>
207     </div>
208   </xsl:template>
209
210 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.