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

Revision 2448 (checked in by johnsa, 4 years ago)

public client: full restructuring in preparation for new default skin

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   <!-- URL of html resources (images, css, other html); by default this is
45        set to the current theme directory  -->
46   <xsl:variable name="resourcesRoot"><xsl:value-of select="/bedework/approot"/>/default/default/videocalTheme</xsl:variable>
47
48   <!-- Duration of each slide in seconds; set this to your preference -->
49   <xsl:variable name="slideDuration">10</xsl:variable>
50
51   <!-- Number of consecutive days to iterate over; set this to your preference -->
52   <xsl:variable name="dayCount">5</xsl:variable>
53
54   <!-- Skin name -->
55   <xsl:variable name="skinName">videocal</xsl:variable>
56
57   <!-- Position of the current day to be displayed -->
58   <xsl:variable name="day">
59     <xsl:choose>
60       <xsl:when test="/bedework/appvar[key='day']">
61         <xsl:choose>
62           <xsl:when test="/bedework/appvar[key='day']/value > $dayCount">1</xsl:when>
63           <xsl:otherwise>
64             <xsl:value-of select="/bedework/appvar[key='day']/value"/>
65           </xsl:otherwise>
66         </xsl:choose>
67       </xsl:when>
68       <xsl:otherwise>1</xsl:otherwise>
69     </xsl:choose>
70   </xsl:variable>
71
72   <!-- Position of the next day (add 1)-->
73   <xsl:variable name="nextDay" select="number($day)+1"/>
74
75   <!-- Event count for the current day -->
76   <xsl:variable name="eventCount" select="count(/bedework/eventscalendar/year/month/week/day[date=$curDate]/event)"/>
77
78   <!-- Position of the current event being displayed -->
79   <xsl:variable name="event">
80     <xsl:choose>
81       <xsl:when test="/bedework/appvar[key='event']">
82         <xsl:choose>
83           <xsl:when test="/bedework/appvar[key='event']/value > $eventCount">1</xsl:when>
84           <xsl:otherwise>
85             <xsl:value-of select="/bedework/appvar[key='event']/value"/>
86           </xsl:otherwise>
87         </xsl:choose>
88       </xsl:when>
89       <xsl:otherwise>1</xsl:otherwise>
90     </xsl:choose>
91   </xsl:variable>
92
93   <!-- Position of the next event (add 1)-->
94   <xsl:variable name="nextEvent" select="number($event)+1"/>
95
96   <!-- MAIN TEMPLATE -->
97   <xsl:template match="/">
98     <html lang="en">
99       <head>
100         <title>Event Calendar Video Feed</title>
101         <link rel="stylesheet" href="{$resourcesRoot}/videocal.css"/>
102         <meta name="robots" content="noindex,nofollow"/>
103         <script language="JavaScript">
104           function today() {
105             var now = new Date();
106             var today;
107             today = now.getFullYear().toString();
108             if (now.getMonth() &lt; 9) {
109               today += "0";
110             }
111             today += (now.getMonth() + 1).toString();
112             today += now.getDate().toString();
113             return today;
114           }
115         </script>
116         <xsl:choose>
117           <xsl:when test="/bedework/periodname!='Day'">
118             <!-- we're starting up on the wrong view; go to today and begin with the first event;
119                  the title slide will display during this switch. -->
120             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/main/setViewPeriod.do?viewType=todayView&amp;setappvar=event(1)&amp;setappvar=day(1)&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
121           </xsl:when>
122           <xsl:when test="($nextDay > $dayCount) and ($nextEvent > $eventCount)">
123             <!-- passed the last day, and all events have been displayed,
124                  so start over: go to today, set day=1 and *event=0* to allow
125                  for the title slide "calPlug" -->
126             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/main/setViewPeriod.do?viewType=todayView&amp;setappvar=event(0)&amp;setappvar=day(1)&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
127           </xsl:when>
128           <xsl:when test="$nextEvent > $eventCount">
129             <!-- passed the last event for the day; go to the next day and set event=1 -->
130             <meta http-equiv="refresh" content="{$slideDuration};url={$urlPrefix}/main/setViewPeriod.do?date={$nextDate}&amp;viewType=dayView&amp;setappvar=event(1)&amp;setappvar=day({$nextDay})&amp;skinNameSticky={$skinName}&amp;setappvar=summaryMode(details)"/>
131           </xsl:when>
132           <xsl:otherwise>
133             <!-- otherwise, go to the next event on the same day -->
134             <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)"/>
135           </xsl:otherwise>
136         </xsl:choose>
137       </head>
138       <body>
139         <xsl:choose>
140           <xsl:when test="($eventCount = 0) or ($event = 0) or (/bedework/periodname!='Day')">
141             <div id="calPlug">
142               <h1>
143                 Bedework Calendar of Events
144                 Video Feed
145               </h1>
146               <h2>http://www.bedework.org</h2>
147             </div>
148           </xsl:when>
149           <xsl:otherwise>
150             <h2 id="calTitle">
151               BEDEWORK CALENDAR OF EVENTS
152             </h2>
153             <h2 id="dayTitle">
154               <xsl:value-of select="/bedework/firstday/longdate"/><!--
155               <br/>Events: <xsl:value-of select="$event"/> of <xsl:value-of select="$eventCount"/>
156               <br/>Days: <xsl:value-of select="$day"/> of <xsl:value-of select="$dayCount"/> -->
157             </h2>
158             <xsl:apply-templates select="/bedework/eventscalendar/year/month/week/day[date=$curDate]/event[position()=$event]"/>
159           </xsl:otherwise>
160         </xsl:choose>
161         <!-- remove the following two divs if used for video -->
162         <div id="getBack">
163           (<a href="{$urlPrefix}/setup.do?skinNameSticky=default">restore normal calendar</a>)
164         </div>
165         <div id="info">
166           This stylesheet will rotate through five days of events at ten
167           second intervals.  It is intended as a video feed running full screen
168           at 800x600px.  It's settings
169           can be set from the top of
170           the videocal.xsl stylesheet.
171         </div>
172       </body>
173     </html>
174   </xsl:template>
175
176   <!--==== SINGLE EVENT ====-->
177   <xsl:template match="event">
178     <h1>
179       <xsl:value-of select="summary"/>
180     </h1>
181     <xsl:if test="(start/allday = 'false')">
182       <div id="time">
183         <!-- this logic needs to be updated for new event model -->
184         <xsl:choose>
185           <xsl:when test="start/time=''">
186             <xsl:value-of select="start/shortdate"/>
187           </xsl:when>
188           <xsl:when test="start/date != /bedework/firstday">
189             <xsl:value-of select="start/shortdate"/>
190             <xsl:value-of select="start/time"/>
191           </xsl:when>
192           <xsl:otherwise>
193             <xsl:value-of select="start/time"/>
194           </xsl:otherwise>
195         </xsl:choose>
196         -
197         <xsl:if test="end/longdate != start/longdate">
198           <xsl:value-of select="end/shortdate"/>
199           <xsl:text> </xsl:text>
200         </xsl:if>
201         <xsl:value-of select="end/time"/>
202       </div>
203     </xsl:if>
204     <xsl:if test="location/address!='Campus-wide'">
205       <div id="location">
206         <xsl:value-of select="location/address"/>
207       </div>
208     </xsl:if>
209     <div id="description">
210       <xsl:value-of select="description"/>
211     </div>
212   </xsl:template>
213
214 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.