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

Revision 625 (checked in by johnsa, 7 years ago)

Appaned all urlPrefixes with ?b=de so that every query string in the xslt can begin with an ampersand (most already use this convention - the rest were holdovers). This will make the creation of links consistent across the applications and makes portlet link generation behave well. There may still be some work to do here. Please note: if you are maintaining your own stylesheets, you will need to modify anchor tags and replace all question marks in the urls with & to upgrade to 3.1.

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
4   method="html"
5   indent="yes"
6   media-type="text/html"
7   doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
8   doctype-system="http://www.w3.org/TR/html4/loose.dtd"
9   standalone="yes"
10 />
11
12 <!-- =========================================================
13
14         DEMONSTRATION "DEPARTMENTAL" CALENDAR STYLESHEET
15
16      This stylesheet is for the "soe" (School of Engineering)
17      calendar suite; it is an example of a departmental skin.
18
19      This skin, along with the preferences for the Calendar
20      Suite owner, differs from the main public skin (default.xsl) in the
21      following ways:
22        - different header, title, and footer
23        - default layout = list view (rather than calendar grid)
24        - different color scheme
25
26      Otherwise, for the sake of demonstration, we've left most of the
27      functionality of the public client in place.
28
29      For detailed instructions on how to work with the XSLT
30      stylesheets included with this distribution, please see the
31                  Bedework Design Guide at
32      http://www.bedework.org/bedework/update.do?artcenterkey=24
33
34 ===============================================================  -->
35
36 <!-- **********************************************************************
37   Copyright 2006 Rensselaer Polytechnic Institute. All worldwide rights reserved.
38
39   Redistribution and use of this distribution in source and binary forms,
40   with or without modification, are permitted provided that:
41      The above copyright notice and this permission notice appear in all
42       copies and supporting documentation;
43
44       The name, identifiers, and trademarks of Rensselaer Polytechnic
45       Institute are not used in advertising or publicity without the
46       express prior written permission of Rensselaer Polytechnic Institute;
47
48   DISCLAIMER: The software is distributed" AS IS" without any express or
49   implied warranty, including but not limited to, any implied warranties
50   of merchantability or fitness for a particular purpose or any warrant)'
51   of non-infringement of any current or pending patent rights. The authors
52   of the software make no representations about the suitability of this
53   software for any particular purpose. The entire risk as to the quality
54   and performance of the software is with the user. Should the software
55   prove defective, the user assumes the cost of all necessary servicing,
56   repair or correction. In particular, neither Rensselaer Polytechnic
57   Institute, nor the authors of the software are liable for any indirect,
58   special, consequential, or incidental damages related to the software,
59   to the maximum extent the law permits. -->
60
61   <!-- ================================= -->
62   <!--  DEMO PUBLIC CALENDAR STYLESHEET  -->
63   <!-- ================================= -->
64
65   <!-- DEFINE INCLUDES -->
66   <xsl:include href="errors.xsl"/>
67
68   <!-- DEFINE GLOBAL CONSTANTS -->
69
70   <!-- URL of the XSL template directory -->
71   <!-- The approot is an appropriate place to put
72        included stylesheets and xml fragments. These are generally
73        referenced relatively (like errors.xsl and messages.xsl above);
74        this variable is here for your convenience if you choose to
75        reference it explicitly.  It is not used in this stylesheet, however,
76        and can be safely removed if you so choose. -->
77   <xsl:variable name="appRoot" select="/bedework/approot"/>
78
79   <!-- URL of html resources (images, css, other html); by default this is
80        set to the application root -->
81   <xsl:variable name="resourcesRoot" select="/bedework/approot"/>
82
83   <!-- Properly encoded prefixes to the application actions; use these to build
84        urls; allows the application to be used without cookies or within a portal. -->
85   <xsl:variable name="setup" select="/bedework/urlPrefixes/setup"/>
86   <xsl:variable name="setSelection" select="/bedework/urlPrefixes/setSelection"/>
87   <xsl:variable name="fetchPublicCalendars" select="/bedework/urlPrefixes/fetchPublicCalendars"/>
88   <xsl:variable name="setViewPeriod" select="/bedework/urlPrefixes/setViewPeriod"/>
89   <xsl:variable name="eventView" select="/bedework/urlPrefixes/eventView"/>
90   <xsl:variable name="addEventRef" select="/bedework/urlPrefixes/addEventRef"/>
91   <xsl:variable name="export" select="/bedework/urlPrefixes/export"/>
92   <xsl:variable name="mailEvent" select="/bedework/urlPrefixes/mailEvent"/>
93   <xsl:variable name="showPage" select="/bedework/urlPrefixes/showPage"/>
94   <xsl:variable name="stats" select="/bedework/urlPrefixes/stats"/>
95
96   <!-- Other generally useful global variables -->
97   <xsl:variable name="privateCal">/ucal</xsl:variable>
98   <xsl:variable name="prevdate" select="/bedework/previousdate"/>
99   <xsl:variable name="nextdate" select="/bedework/nextdate"/>
100   <xsl:variable name="curdate" select="/bedework/currentdate/date"/>
101   <xsl:variable name="skin">default</xsl:variable>
102
103
104   <!-- MAIN TEMPLATE -->
105   <xsl:template match="/">
106     <html lang="en">
107       <head>
108         <title>School of Engineering: Example Bedework Departmental Calendar Suite</title>
109         <link rel="stylesheet" type="text/css" href="{$resourcesRoot}/default/default/soe.css" />
110         <link rel="icon" type="image/ico" href="{$resourcesRoot}/images/bedework.ico" />
111       </head>
112       <body>
113         <xsl:call-template name="headBar"/>
114         <xsl:if test="/bedework/error">
115           <div id="errors">
116             <xsl:apply-templates select="/bedework/error"/>
117           </div>
118         </xsl:if>
119         <xsl:call-template name="tabs"/>
120         <xsl:call-template name="navigation"/>
121         <xsl:choose>
122           <xsl:when test="/bedework/page='event'">
123             <!-- show an event -->
124             <xsl:apply-templates select="/bedework/event"/>
125           </xsl:when>
126           <xsl:when test="/bedework/page='showSysStats'">
127             <!-- show system stats -->
128             <xsl:call-template name="stats"/>
129           </xsl:when>
130           <xsl:when test="/bedework/page='calendarList'">
131             <!-- show a list of all calendars -->
132             <xsl:apply-templates select="/bedework/calendars"/>
133           </xsl:when>
134           <xsl:otherwise>
135             <!-- otherwise, show the eventsCalendar -->
136             <xsl:if test="/bedework/periodname!='Year'">
137               <xsl:call-template name="searchBar"/>
138             </xsl:if>
139             <!-- main eventCalendar content -->
140             <xsl:choose>
141               <xsl:when test="/bedework/periodname='Day'">
142                 <xsl:call-template name="listView"/>
143               </xsl:when>
144               <xsl:when test="/bedework/periodname='Week' or /bedework/periodname=''">
145                 <xsl:choose>
146                   <xsl:when test="/bedework/appvar[key='weekViewMode']/value='cal'">
147                     <xsl:call-template name="weekView"/>
148                   </xsl:when>
149                   <xsl:otherwise>
150                     <xsl:call-template name="listView"/>
151                   </xsl:otherwise>
152                 </xsl:choose>
153               </xsl:when>
154               <xsl:when test="/bedework/periodname='Month'">
155                 <xsl:choose>
156                   <xsl:when test="/bedework/appvar[key='monthViewMode']/value='list'">
157                     <xsl:call-template name="listView"/>
158                   </xsl:when>
159                   <xsl:otherwise>
160                     <xsl:call-template name="monthView"/>
161                   </xsl:otherwise>
162                 </xsl:choose>
163               </xsl:when>
164               <xsl:otherwise>
165                 <xsl:call-template name="yearView"/>
166               </xsl:otherwise>
167             </xsl:choose>
168           </xsl:otherwise>
169         </xsl:choose>
170         <!-- footer -->
171         <xsl:call-template name="footer"/>
172       </body>
173     </html>
174   </xsl:template>
175
176   <!--==== HEADER TEMPLATES and NAVIGATION  ====-->
177   <!-- these templates are separated out for convenience and to simplify the default template -->
178
179   <xsl:template name="headBar">
180     <div id="headBar">
181       <div id="bedeworkLogo">
182         <a href="http://www.bedework.org/">
183           <img src="{$resourcesRoot}/images/soecal/soeBedeworkLogo.gif" width="296" height="69" border="0" alt="Bedework" align="right"/>
184         </a>
185       </div>
186       <h1>Example Departmental Calendar Suite</h1>
187       <!--<ul id="schoolLinks">
188         <li><a href="{$privateCal}">Personal Calendar</a></li>
189         <li><a href="http://www.yourschoolhere.edu">School Home</a></li>
190         <li><a href="http://www.bedework.org/">Other Link</a></li>
191         <li>
192           <a href="http://helpdesk.rpi.edu/update.do?catcenterkey=51">
193             Example Calendar Help
194           </a>
195         </li>
196       </ul> -->
197     </div>
198     <!--  Turn off the date range table for this departmental view -->
199     <!--<table id="curDateRangeTable"  cellspacing="0">
200       <td class="sideBarOpenCloseIcon">
201         &#160; -->
202         <!--
203         we may choose to implement calendar selection in the public calendar
204         using a sidebar; leave this comment here for now.
205         <xsl:choose>
206           <xsl:when test="/bedework/appvar[key='sidebar']/value='closed'">
207             <a href="?setappvar=sidebar(opened)">
208               <img alt="open sidebar" src="{$resourcesRoot}/resources/sideBarArrowOpen.gif" width="21" height="16" border="0" align="left"/>
209             </a>
210           </xsl:when>
211           <xsl:otherwise>
212             <a href="?setappvar=sidebar(closed)">
213               <img alt="close sidebar" src="{$resourcesRoot}/resources/sideBarArrowClose.gif" width="21" height="16" border="0" align="left"/>
214             </a>
215           </xsl:otherwise>
216         </xsl:choose>-->
217       <!-- </td>
218       <td class="date">
219         <xsl:choose>
220           <xsl:when test="/bedework/page='event'">
221             Event Information
222           </xsl:when>
223           <xsl:when test="/bedework/page='showSysStats' or
224                           /bedework/page='calendars'">
225             &#160;
226           </xsl:when>
227           <xsl:otherwise>
228             <xsl:value-of select="/bedework/firstday/longdate"/>
229             <xsl:if test="/bedework/periodname!='Day'">
230               -
231               <xsl:value-of select="/bedework/lastday/longdate"/>
232             </xsl:if>
233           </xsl:otherwise>
234         </xsl:choose>
235       </td>
236       <td class="rssPrint">
237         <a href="javascript:window.print()" title="print this view">
238           <img alt="print this view" src="{$resourcesRoot}/images/std-print-icon.gif" width="20" height="14" border="0"/> print
239         </a>
240         <a class="rss" href="{$setSelection}&amp;setappvar=summaryMode(details)&amp;skinName=rss" title="RSS feed">RSS</a>
241       </td>
242     </table>-->
243   </xsl:template>
244
245   <xsl:template name="tabs">
246     <xsl:choose>
247       <xsl:when test="/bedework/page='eventscalendar'">
248         <table border="0" cellpadding="0" cellspacing="0" id="tabsTable">
249           <tr>
250             <td>
251               <xsl:choose>
252                 <xsl:when test="/bedework/periodname='Day'">
253                   <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-day-on.gif" width="91" height="20" border="0" alt="DAY"/></a>
254                 </xsl:when>
255                 <xsl:otherwise>
256                   <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-day-off.gif" width="91" height="20" border="0" alt="DAY"/></a>
257                 </xsl:otherwise>
258               </xsl:choose>
259             </td>
260             <td>
261               <xsl:choose>
262                 <xsl:when test="/bedework/periodname='Week' or /bedework/periodname=''">
263                   <a href="{$setViewPeriod}&amp;viewType=weekView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-week-on.gif" width="92" height="20" border="0" alt="WEEK"/></a>
264                  </xsl:when>
265                 <xsl:otherwise>
266                   <a href="{$setViewPeriod}&amp;viewType=weekView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-week-off.gif" width="92" height="20" border="0" alt="WEEK"/></a>
267                  </xsl:otherwise>
268               </xsl:choose>
269             </td>
270             <td>
271               <xsl:choose>
272                 <xsl:when test="/bedework/periodname='Month'">
273                   <a href="{$setViewPeriod}&amp;viewType=monthView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-month-on.gif" width="90" height="20" border="0" alt="MONTH"/></a>
274                 </xsl:when>
275                 <xsl:otherwise>
276                   <a href="{$setViewPeriod}&amp;viewType=monthView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-month-off.gif" width="90" height="20" border="0" alt="MONTH"/></a>
277                 </xsl:otherwise>
278               </xsl:choose>
279             </td>
280             <td>
281               <xsl:choose>
282                 <xsl:when test="/bedework/periodname='Year'">
283                   <a href="{$setViewPeriod}&amp;viewType=yearView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-year-on.gif" width="92" height="20" border="0" alt="YEAR"/></a>
284                 </xsl:when>
285                 <xsl:otherwise>
286                   <a href="{$setViewPeriod}&amp;viewType=yearView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-year-off.gif" width="92" height="20" border="0" alt="YEAR"/></a>
287                 </xsl:otherwise>
288               </xsl:choose>
289             </td>
290             <td class="rssPrint">
291               <a href="javascript:window.print()" title="print this view">
292                 <img alt="print this view" src="{$resourcesRoot}/images/std-print-icon.gif" width="20" height="14" border="0"/> print
293               </a>
294               <a class="rss" href="{$setSelection}&amp;setappvar=summaryMode(details)&amp;skinName=rss" title="RSS feed">RSS</a>
295             </td>
296           </tr>
297         </table>
298       </xsl:when>
299       <xsl:otherwise>
300         <table border="0" cellpadding="0" cellspacing="0" id="tabsTable">
301           <tr>
302             <td>
303               <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-day-off.gif" width="91" height="20" border="0" alt="DAY"/></a>
304             </td>
305             <td>
306               <a href="{$setViewPeriod}&amp;viewType=weekView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-week-off.gif" width="92" height="20" border="0" alt="WEEK"/></a>
307             </td>
308             <td>
309               <a href="{$setViewPeriod}&amp;viewType=monthView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-month-off.gif" width="90" height="20" border="0" alt="MONTH"/></a>
310             </td>
311             <td>
312               <a href="{$setViewPeriod}&amp;viewType=yearView&amp;date={$curdate}"><img src="{$resourcesRoot}/images/std-tab-year-off.gif" width="92" height="20" border="0" alt="YEAR"/></a>
313             </td>
314             <td class="rssPrint">
315               <a href="javascript:window.print()" title="print this view">
316                 <img alt="print this view" src="{$resourcesRoot}/images/std-print-icon.gif" width="20" height="14" border="0"/> print
317               </a>
318               <a class="rss" href="{$setSelection}&amp;setappvar=summaryMode(details)&amp;skinName=rss" title="RSS feed">RSS</a>
319             </td>
320           </tr>
321         </table>
322       </xsl:otherwise>
323     </xsl:choose>
324   </xsl:template>
325
326   <xsl:template name="navigation">
327     <table border="0" cellpadding="0" cellspacing="0" id="navigationBarTable">
328       <tr>
329         <td class="leftCell">
330           <a id="prevViewPeriod" href="{$setViewPeriod}&amp;date={$prevdate}"><img src="{$resourcesRoot}/images/std-arrow-left.gif" alt="previous" width="13" height="16" class="prevImg" border="0"/></a>
331           <a id="nextViewPeriod" href="{$setViewPeriod}&amp;date={$nextdate}"><img src="{$resourcesRoot}/images/std-arrow-right.gif" alt="next" width="13" height="16" class="nextImg" border="0"/></a>
332           <xsl:choose>
333             <xsl:when test="/bedework/periodname='Year'">
334               <xsl:value-of select="substring(/bedework/firstday/date,1,4)"/>
335             </xsl:when>
336             <xsl:when test="/bedework/periodname='Month'">
337               <xsl:value-of select="/bedework/firstday/monthname"/>, <xsl:value-of select="substring(/bedework/firstday/date,1,4)"/>
338             </xsl:when>
339             <xsl:when test="/bedework/periodname='Week'">
340               Week of <xsl:value-of select="substring-after(/bedework/firstday/longdate,', ')"/>
341             </xsl:when>
342             <xsl:otherwise>
343               <xsl:value-of select="/bedework/firstday/longdate"/>
344             </xsl:otherwise>
345           </xsl:choose>
346         </td>
347         <td class="todayButton">
348           <a href="{$setViewPeriod}&amp;viewType=todayView&amp;date={$curdate}">
349             <img src="{$resourcesRoot}/images/std-button-today-off.gif" width="54" height="22" border="0" alt="Go to Today" align="left"/>
350           </a>
351         </td>
352         <td align="right" class="gotoForm">
353           <form name="calForm" method="get" action="{$setViewPeriod}">
354              <table border="0" cellpadding="0" cellspacing="0">
355               <tr>
356                 <xsl:if test="/bedework/periodname!='Year'">
357                   <td>
358                     <select name="viewStartDate.month">
359                       <xsl:for-each select="/bedework/monthvalues/val">
360                         <xsl:variable name="temp" select="."/>
361                         <xsl:variable name="pos" select="position()"/>
362                         <xsl:choose>
363                           <xsl:when test="/bedework/monthvalues[start=$temp]">
364                             <option value="{$temp}" selected="selected">
365                               <xsl:value-of select="/bedework/monthlabels/val[position()=$pos]"/>
366                             </option>
367                           </xsl:when>
368                           <xsl:otherwise>
369                             <option value="{$temp}">
370                               <xsl:value-of select="/bedework/monthlabels/val[position()=$pos]"/>
371                             </option>
372                           </xsl:otherwise>
373                         </xsl:choose>
374                       </xsl:for-each>
375                     </select>
376                   </td>
377                   <xsl:if test="/bedework/periodname!='Month'">
378                     <td>
379                       <select name="viewStartDate.day">
380                         <xsl:for-each select="/bedework/dayvalues/val">
381                           <xsl:variable name="temp" select="."/>
382                           <xsl:variable name="pos" select="position()"/>
383                           <xsl:choose>
384                             <xsl:when test="/bedework/dayvalues[start=$temp]">
385                               <option value="{$temp}" selected="selected">
386                                 <xsl:value-of select="/bedework/daylabels/val[position()=$pos]"/>
387                               </option>
388                             </xsl:when>
389                             <xsl:otherwise>
390                               <option value="{$temp}">
391                                 <xsl:value-of select="/bedework/daylabels/val[position()=$pos]"/>
392                               </option>
393                             </xsl:otherwise>
394                           </xsl:choose>
395                         </xsl:for-each>
396                       </select>
397                     </td>
398                   </xsl:if>
399                 </xsl:if>
400                 <td>
401                   <xsl:variable name="temp" select="/bedework/yearvalues/start"/>
402                   <input type="text" name="viewStartDate.year" maxlength="4" size="4" value="{$temp}"/>
403                 </td>
404                 <td>
405                   <input name="submit" type="submit" value="go"/>
406                 </td>
407               </tr>
408             </table>
409           </form>
410         </td>
411         <td class="rightCell">
412         </td>
413       </tr>
414     </table>
415   </xsl:template>
416
417   <xsl:template name="searchBar">
418     <table width="100%" border="0" cellpadding="0" cellspacing="0" id="searchBarTable">
419        <tr>
420          <td class="leftCell">
421            <xsl:choose>
422              <xsl:when test="/bedework/selectionState/selectionType = 'calendar'">
423                Calendar: <xsl:value-of select="/bedework/selectionState/subscriptions/subscription/calendar/name"/>
424                <span class="link">[<a href="{$setSelection}">default view</a>]</span>
425              </xsl:when>
426              <xsl:when test="/bedework/selectionState/selectionType = 'search'">
427                Current search: <xsl:value-of select="/bedework/search"/>
428                <span class="link">[<a href="{$setSelection}">default view</a>]</span>
429              </xsl:when>
430              <xsl:when test="/bedework/selectionState/selectionType = 'subscription'">
431                Subscription: (not implemented yet)
432                <span class="link">[<a href="{$setSelection}">default view</a>]</span>
433              </xsl:when>
434              <xsl:when test="/bedework/selectionState/selectionType = 'filter'">
435                Filter: (not implemented yet)
436                <span class="link">[<a href="{$setSelection}">default view</a>]</span>
437              </xsl:when>
438              <xsl:otherwise><!-- view -->
439                View:
440                <form name="selectViewForm" method="get" action="{$setSelection}">
441                 <select name="viewName" onChange="submit()" >
442                   <xsl:for-each select="/bedework/views/view">
443                     <xsl:variable name="name" select="name"/>
444                     <xsl:choose>
445                       <xsl:when test="name=/bedework/selectionState/view/name">
446                         <option value="{$name}" selected="selected"><xsl:value-of select="name"/></option>
447                       </xsl:when>
448                       <xsl:otherwise>
449                         <option value="{$name}"><xsl:value-of select="name"/></option>
450                       </xsl:otherwise>
451                     </xsl:choose>
452                   </xsl:for-each>
453                 </select>
454               </form>
455               <span class="calLinks"><a href="{$setSelection}">default view</a> | <a href="{$fetchPublicCalendars}">available calendars</a></span>
456              </xsl:otherwise>
457            </xsl:choose>
458          </td>
459          <td class="rightCell">
460             <xsl:choose>
461               <xsl:when test="/bedework/periodname='Day'">
462                 <img src="{$resourcesRoot}/images/std-button-listview-off.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
463               </xsl:when>
464               <xsl:when test="/bedework/periodname='Year'">
465                 <img src="{$resourcesRoot}/images/std-button-calview-off.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
466               </xsl:when>
467               <xsl:when test="/bedework/periodname='Month'">
468                 <xsl:choose>
469                   <xsl:when test="/bedework/appvar[key='monthViewMode']/value='list'">
470                     <a href="{$setup}&amp;setappvar=monthViewMode(cal)" title="toggle list/calendar view">
471                       <img src="{$resourcesRoot}/images/std-button-calview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
472                     </a>
473                   </xsl:when>
474                   <xsl:otherwise>
475                     <a href="{$setup}&amp;setappvar=monthViewMode(list)" title="toggle list/calendar view">
476                       <img src="{$resourcesRoot}/images/std-button-listview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
477                     </a>
478                   </xsl:otherwise>
479                 </xsl:choose>
480               </xsl:when>
481               <xsl:otherwise>
482                 <xsl:choose>
483                   <xsl:when test="/bedework/appvar[key='weekViewMode']/value='cal'">
484                     <a href="{$setup}&amp;setappvar=weekViewMode(list)" title="toggle list/calendar view">
485                       <img src="{$resourcesRoot}/images/std-button-listview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
486                     </a>
487                   </xsl:when>
488                   <xsl:otherwise>
489                     <a href="{$setup}&amp;setappvar=weekViewMode(cal)" title="toggle list/calendar view">
490                       <img src="{$resourcesRoot}/images/std-button-calview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
491                     </a>
492                   </xsl:otherwise>
493                 </xsl:choose>
494               </xsl:otherwise>
495             </xsl:choose>
496             <xsl:choose>
497               <xsl:when test="/bedework/periodname='Year' or
498                               (/bedework/periodname='Month' and
499                               (/bedework/appvar[key='monthViewMode']/value='cal' or
500                                not(/bedework/appvar[key='monthViewMode']))) or
501                               (/bedework/periodname='Week' and
502                               (/bedework/appvar[key='weekViewMode']/value='cal' or
503                                not(/bedework/appvar[key='weekViewMode'])))">
504                 <xsl:choose>
505                   <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
506                     <img src="{$resourcesRoot}/images/std-button-summary-off.gif" width="62" height="21" border="0" alt="only summaries of events supported in this view"/>
507                   </xsl:when>
508                   <xsl:otherwise>
509                     <img src="{$resourcesRoot}/images/std-button-details-off.gif" width="62" height="21" border="0" alt="only summaries of events supported in this view"/>
510                   </xsl:otherwise>
511                 </xsl:choose>
512               </xsl:when>
513               <xsl:otherwise>
514                 <xsl:choose>
515                   <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
516                     <a href="{$setup}&amp;setappvar=summaryMode(summary)" title="toggle summary/detailed view">
517                       <img src="{$resourcesRoot}/images/std-button-summary.gif" width="62" height="21" border="0" alt="toggle summary/detailed view"/>
518                     </a>
519                   </xsl:when>
520                   <xsl:otherwise>
521                     <a href="{$setup}&amp;setappvar=summaryMode(details)" title="toggle summary/detailed view">
522                       <img src="{$resourcesRoot}/images/std-button-details.gif" width="62" height="21" border="0" alt="toggle summary/detailed view"/>
523                     </a>
524                   </xsl:otherwise>
525                 </xsl:choose>
526               </xsl:otherwise>
527             </xsl:choose>
528             <a href="setup.do"><img src="{$resourcesRoot}/images/std-button-refresh.gif" width="70" height="21" border="0" alt="refresh view"/></a>
529           </td>
530        </tr>
531     </table>
532   </xsl:template>
533
534   <!--==== SINGLE EVENT ====-->
535   <xsl:template match="event">
536     <xsl:variable name="statusClass">
537       <xsl:choose>
538         <xsl:when test="status='CANCELLED'">bwStatusCancelled</xsl:when>
539         <xsl:when test="status='TENTATIVE'">bwStatusTentative</xsl:when>
540         <xsl:otherwise>bwStatusConfirmed</xsl:otherwise>
541       </xsl:choose>
542     </xsl:variable>
543     <h2 class="{$statusClass}">
544       <xsl:if test="status='CANCELLED'">CANCELLED: </xsl:if>
545       <xsl:choose>
546         <xsl:when test="link != ''">
547           <xsl:variable name="link" select="link"/>
548           <a href="{$link}">
549             <xsl:value-of select="summary"/>
550           </a>
551         </xsl:when>
552         <xsl:otherwise>
553           <xsl:value-of select="summary"/>
554         </xsl:otherwise>
555       </xsl:choose>
556     </h2>
557     <table id="eventTable" cellpadding="0" cellspacing="0">
558       <tr>
559         <td class="fieldname">When:</td>
560         <td class="fieldval">
561           <xsl:value-of select="start/dayname"/>, <xsl:value-of select="start/longdate"/><xsl:text> </xsl:text>
562           <xsl:if test="start/allday = 'false'">
563             <span class="time"><xsl:value-of select="start/time"/></span>
564           </xsl:if>
565           <xsl:if test="(end/longdate != start/longdate) or
566                         ((end/longdate = start/longdate) and (end/time != start/time))"> - </xsl:if>
567           <xsl:if test="end/longdate != start/longdate">
568             <xsl:value-of select="substring(end/dayname,1,3)"/>, <xsl:value-of select="end/longdate"/><xsl:text> </xsl:text>
569           </xsl:if>
570           <xsl:choose>
571             <xsl:when test="start/allday = 'true'">
572               <span class="time"><em>(all day)</em></span>
573             </xsl:when>
574             <xsl:when test="end/longdate != start/longdate">
575               <span class="time"><xsl:value-of select="end/time"/></span>
576             </xsl:when>
577             <xsl:when test="end/time != start/time">
578               <span class="time"><xsl:value-of select="end/time"/></span>
579             </xsl:when>
580           </xsl:choose>
581         </td>
582         <th class="icalIcon" rowspan="2">
583           <div id="eventIcons">
584                                                 <xsl:variable name="id" select="id"/>
585                                                 <xsl:variable name="subscriptionId" select="subscription/id"/>
586                                                 <xsl:variable name="calPath" select="calendar/encodedPath"/>
587                                                 <xsl:variable name="guid" select="guid"/>
588                                                 <xsl:variable name="recurrenceId" select="recurrenceId"/>
589                                                 <a href="{$privateCal}/addEventRef.do?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="Add event to MyCalendar" target="myCalendar">
590                                                         <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon.gif" width="20" height="26" border="0" alt="Add event to MyCalendar"/>
591                                                 add to my calendar</a>
592                                                 <xsl:variable name="eventIcalName" select="concat($id,'.ics')"/>
593                                                 <a href="{$export}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;skinName=ical&amp;contentType=text/calendar&amp;contentName={$eventIcalName}" title="Download event as ical - for Outlook, PDAs, iCal, and other desktop calendars">
594                                                         <img src="{$resourcesRoot}/images/std-ical_icon.gif" width="20" height="26" border="0" alt="Download this event"/>
595                                                  download</a>
596                                         </div>
597         </th>
598       </tr>
599       <tr>
600         <td class="fieldname">Where:</td>
601         <td class="fieldval">
602           <xsl:choose>
603             <xsl:when test="location/link=''">
604               <xsl:value-of select="location/address"/>
605             </xsl:when>
606             <xsl:otherwise>
607               <xsl:variable name="locationLink" select="location/link"/>
608               <a href="{$locationLink}">
609                 <xsl:value-of select="location/address"/>
610               </a>
611             </xsl:otherwise>
612           </xsl:choose>
613           <xsl:if test="location/subaddress!=''">
614             <br/><xsl:value-of select="location/subaddress"/>
615           </xsl:if>
616         </td>
617       </tr>
618       <tr>
619         <td class="fieldname">Description:</td>
620         <td colspan="2" class="fieldval description">
621           <xsl:call-template name="replace">
622             <xsl:with-param name="string" select="description"/>
623             <xsl:with-param name="pattern" select="'&#xA;'"/>
624             <xsl:with-param name="replacement"><br/></xsl:with-param>
625           </xsl:call-template>
626         </td>
627       </tr>
628       <xsl:if test="status !='' and status != 'CONFIRMED'">
629         <tr>
630           <td class="fieldname">Status:</td>
631           <td class="fieldval">
632             <xsl:value-of select="status"/>
633           </td>
634         </tr>
635       </xsl:if>
636       <xsl:if test="cost!=''">
637         <tr>
638           <td class="fieldname">Cost:</td>
639           <td colspan="2" class="fieldval"><xsl:value-of select="cost"/></td>
640         </tr>
641       </xsl:if>
642       <xsl:if test="link != ''">
643         <tr>
644           <td class="fieldname">See:</td>
645           <td colspan="2" class="fieldval">
646             <xsl:variable name="link" select="link"/>
647             <a href="{$link}"><xsl:value-of select="link"/></a>
648           </td>
649         </tr>
650       </xsl:if>
651       <xsl:if test="sponsor/name!='none'">
652         <tr>
653           <td class="fieldname">Contact:</td>
654           <td colspan="2" class="fieldval">
655             <xsl:choose>
656               <xsl:when test="sponsor/link=''">
657                 <xsl:value-of select="sponsor/name"/>
658               </xsl:when>
659               <xsl:otherwise>
660                 <xsl:variable name="sponsorLink" select="sponsor/link"/>
661                 <a href="{$sponsorLink}">
662                   <xsl:value-of select="sponsor/name"/>
663                 </a>
664               </xsl:otherwise>
665             </xsl:choose>
666             <xsl:if test="sponsor/phone!=''">
667               <br /><xsl:value-of select="sponsor/phone"/>
668             </xsl:if>
669             <!-- If you want to display email addresses, uncomment the
670                  following 8 lines. -->
671             <!-- <xsl:if test="sponsor/email!=''">
672               <br />
673               <xsl:variable name="email" select="sponsor/email"/>
674               <xsl:variable name="subject" select="summary"/>
675               <a href="mailto:{$email}&amp;subject={$subject}">
676                 <xsl:value-of select="sponsor/email"/>
677               </a>
678             </xsl:if> -->
679           </td>
680         </tr>
681       </xsl:if>
682       <tr>
683         <td class="fieldname">Calendar:</td>
684         <td class="fieldval">
685           <xsl:variable name="calUrl" select="calendar/path"/>
686           <a href="{$setSelection}&amp;calUrl={$calUrl}">
687             <xsl:value-of select="calendar/name"/>
688           </a>
689         </td>
690       </tr>
691     </table>
692   </xsl:template>
693
694   <!--==== LIST VIEW  (for day, week, and month) ====-->
695   <xsl:template name="listView">
696     <table id="listTable" border="0" cellpadding="0" cellspacing="0">
697       <xsl:choose>
698         <xsl:when test="not(/bedework/eventscalendar/year/month/week/day/event)">
699           <tr>
700             <td class="noEventsCell">
701               No events to display.
702             </td>
703           </tr>
704         </xsl:when>
705         <xsl:otherwise>
706           <xsl:for-each select="/bedework/eventscalendar/year/month/week/day[event]">
707             <xsl:if test="/bedework/periodname='Week' or /bedework/periodname='Month' or /bedework/periodname=''">
708               <tr>
709                 <td colspan="5" class="dateRow">
710                    <xsl:variable name="date" select="date"/>
711                    <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$date}">
712                      <xsl:value-of select="name"/>, <xsl:value-of select="longdate"/>
713                    </a>
714                 </td>
715               </tr>
716             </xsl:if>
717             <xsl:for-each select="event">
718               <xsl:variable name="id" select="id"/>
719               <xsl:variable name="subscriptionId" select="subscription/id"/>
720               <xsl:variable name="calPath" select="calendar/encodedPath"/>
721               <xsl:variable name="guid" select="guid"/>
722               <xsl:variable name="recurrenceId" select="recurrenceId"/>
723               <tr>
724                 <xsl:variable name="dateRangeStyle">
725                   <xsl:choose>
726                     <xsl:when test="start/shortdate = parent::day/shortdate">
727                       <xsl:choose>
728                         <xsl:when test="start/allday = 'true'">dateRangeCrossDay</xsl:when>
729                         <xsl:when test="start/hour24 &lt; 6">dateRangeEarlyMorning</xsl:when>
730                         <xsl:when test="start/hour24 &lt; 12">dateRangeMorning</xsl:when>
731                         <xsl:when test="start/hour24 &lt; 18">dateRangeAfternoon</xsl:when>
732                         <xsl:otherwise>dateRangeEvening</xsl:otherwise>
733                       </xsl:choose>
734                     </xsl:when>
735                     <xsl:otherwise>dateRangeCrossDay</xsl:otherwise>
736                   </xsl:choose>
737                 </xsl:variable>
738                 <xsl:choose>
739                   <xsl:when test="start/allday = 'true' and
740                                   start/shortdate = end/shortdate">
741                     <td class="{$dateRangeStyle} center" colspan="3">
742                       all day
743                     </td>
744                   </xsl:when>
745                   <xsl:when test="start/shortdate = end/shortdate and
746                                   start/time = end/time">
747                     <td class="{$dateRangeStyle} center" colspan="3">
748                       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
749                         <xsl:value-of select="start/time"/>
750                       </a>
751                     </td>
752                   </xsl:when>
753                   <xsl:otherwise>
754                     <td class="{$dateRangeStyle} right">
755                       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
756                       <xsl:choose>
757                         <xsl:when test="start/allday = 'true' and
758                                         parent::day/shortdate = start/shortdate">
759                           today
760                         </xsl:when>
761                         <xsl:when test="parent::day/shortdate != start/shortdate">
762                           <span class="littleArrow">&#171;</span>&#160;
763                           <xsl:value-of select="start/month"/>/<xsl:value-of select="start/day"/>
764                         </xsl:when>
765                         <xsl:otherwise>
766                           <xsl:value-of select="start/time"/>
767                         </xsl:otherwise>
768                       </xsl:choose>
769                       </a>
770                     </td>
771                     <td class="{$dateRangeStyle} center">
772                       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">-</a>
773                     </td>
774                     <td class="{$dateRangeStyle} left">
775                       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
776                       <xsl:choose>
777                         <xsl:when test="end/allday = 'true' and
778                                         parent::day/shortdate = end/shortdate">
779                           today
780                         </xsl:when>
781                         <xsl:when test="parent::day/shortdate != end/shortdate">
782                           <xsl:value-of select="end/month"/>/<xsl:value-of select="end/day"/>
783                           &#160;<span class="littleArrow">&#187;</span>
784                         </xsl:when>
785                         <xsl:otherwise>
786                           <xsl:value-of select="end/time"/>
787                         </xsl:otherwise>
788                       </xsl:choose>
789                       </a>
790                     </td>
791                   </xsl:otherwise>
792                 </xsl:choose>
793                 <xsl:variable name="descriptionClass">
794                   <xsl:choose>
795                     <xsl:when test="status='CANCELLED'">description bwStatusCancelled</xsl:when>
796                     <xsl:when test="status='TENTATIVE'">description bwStatusTentative</xsl:when>
797                     <xsl:otherwise>description</xsl:otherwise>
798                   </xsl:choose>
799                 </xsl:variable>
800                 <td class="{$descriptionClass}">
801                   <xsl:if test="status='CANCELLED'"><strong>CANCELLED: </strong></xsl:if>
802                   <xsl:choose>
803                     <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
804                       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
805                         <strong>
806                           <xsl:value-of select="summary"/>:
807                         </strong>
808                         <xsl:value-of select="description"/>&#160;
809                         <em>
810                           <xsl:value-of select="location/address"/>
811                           <xsl:if test="location/subaddress != ''">
812                             , <xsl:value-of select="location/subaddress"/>
813                           </xsl:if>.&#160;
814                           <xsl:if test="cost!=''">
815                             <xsl:value-of select="cost"/>.&#160;
816                           </xsl:if>
817                           <xsl:if test="sponsor/name!='none'">
818                             Contact: <xsl:value-of select="sponsor/name"/>
819                           </xsl:if>
820                         </em>
821                       </a>
822                       <xsl:if test="link != ''">
823                         <xsl:variable name="link" select="link"/>
824                         <a href="{$link}" class="moreLink"><xsl:value-of select="link"/></a>
825                       </xsl:if>
826                     </xsl:when>
827                     <xsl:otherwise>
828                       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
829                         <xsl:value-of select="summary"/>
830                         <xsl:if test="location/address != ''">, <xsl:value-of select="location/address"/></xsl:if>
831                       </a>
832                     </xsl:otherwise>
833                   </xsl:choose>
834                 </td>
835                 <td class="icons">
836                   <variable name="confId" select="/bedework/confirmationid"/>
837                   <a href="{$privateCal}/addEventRef.do?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="Add event to MyCalendar" target="myCalendar">
838                     <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon-small.gif" width="12" height="16" border="0" alt="Add event to MyCalendar"/>
839                   </a>
840                   <xsl:variable name="eventIcalName" select="concat($id,'.ics')"/>
841                   <a href="{$export}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;skinName=ical&amp;contentType=text/calendar&amp;contentName={$eventIcalName}" title="Download event as ical - for Outlook, PDAs, iCal, and other desktop calendars">
842                     <img src="{$resourcesRoot}/images/std-ical_icon_small.gif" width="12" height="16" border="0" alt="Download event as ical - for Outlook, PDAs, iCal, and other desktop calendars"/>
843                   </a>
844                 </td>
845               </tr>
846             </xsl:for-each>
847           </xsl:for-each>
848         </xsl:otherwise>
849       </xsl:choose>
850     </table>
851   </xsl:template>
852
853   <!--==== WEEK CALENDAR VIEW ====-->
854   <xsl:template name="weekView">
855     <table id="monthCalendarTable" border="0" cellpadding="0" cellspacing="0">
856       <tr>
857         <xsl:for-each select="/bedework/daynames/val">
858           <th class="dayHeading"><xsl:value-of select="."/></th>
859         </xsl:for-each>
860       </tr>
861       <tr>
862         <xsl:for-each select="/bedework/eventscalendar/year/month/week/day">
863           <xsl:variable name="dayPos" select="position()"/>
864           <xsl:if test="filler='false'">
865             <td>
866               <xsl:variable name="dayDate" select="date"/>
867               <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$dayDate}" class="dayLink">
868                 <xsl:value-of select="value"/>
869               </a>
870               <ul>
871                 <xsl:apply-templates select="event" mode="calendarLayout">
872                   <xsl:with-param name="dayPos" select="$dayPos"/>
873                 </xsl:apply-templates>
874               </ul>
875             </td>
876           </xsl:if>
877         </xsl:for-each>
878       </tr>
879     </table>
880   </xsl:template>
881
882   <!--==== MONTH CALENDAR VIEW ====-->
883   <xsl:template name="monthView">
884     <table id="monthCalendarTable" border="0" cellpadding="0" cellspacing="0">
885       <tr>
886         <xsl:for-each select="/bedework/daynames/val">
887           <th class="dayHeading"><xsl:value-of select="."/></th>
888         </xsl:for-each>
889       </tr>
890       <xsl:for-each select="/bedework/eventscalendar/year/month/week">
891         <tr>
892           <xsl:for-each select="day">
893             <xsl:variable name="dayPos" select="position()"/>
894             <xsl:choose>
895               <xsl:when test="filler='true'">
896                 <td class="filler">&#160;</td>
897               </xsl:when>
898               <xsl:otherwise>
899                 <td>
900                   <xsl:variable name="dayDate" select="date"/>
901                   <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$dayDate}" class="dayLink">
902                     <xsl:value-of select="value"/>
903                   </a>
904                   <ul>
905                     <xsl:apply-templates select="event" mode="calendarLayout">
906                       <xsl:with-param name="dayPos" select="$dayPos"/>
907                     </xsl:apply-templates>
908                   </ul>
909                 </td>
910               </xsl:otherwise>
911             </xsl:choose>
912           </xsl:for-each>
913         </tr>
914       </xsl:for-each>
915     </table>
916   </xsl:template>
917
918   <xsl:template match="event" mode="calendarLayout">
919     <xsl:param name="dayPos"/>
920     <xsl:variable name="subscriptionId" select="subscription/id"/>
921     <xsl:variable name="calPath" select="calendar/encodedPath"/>
922     <xsl:variable name="guid" select="guid"/>
923     <xsl:variable name="recurrenceId" select="recurrenceId"/>
924     <xsl:variable name="eventClass">
925       <xsl:choose>
926         <!-- Special styles for the month grid -->
927         <xsl:when test="status='CANCELLED'">eventCancelled</xsl:when>
928         <xsl:when test="status='TENTATIVE'">eventTentative</xsl:when>
929         <xsl:when test="calendar/name='Holidays'">holiday</xsl:when>
930         <!-- Alternating colors for all standard events -->
931         <xsl:when test="position() mod 2 = 1">eventLinkA</xsl:when>
932         <xsl:otherwise>eventLinkB</xsl:otherwise>
933       </xsl:choose>
934     </xsl:variable>
935     <li>
936       <a href="{$eventView}&amp;subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" class="{$eventClass}">
937         <xsl:if test="status='CANCELLED'">CANCELLED: </xsl:if>
938         <xsl:value-of select="summary"/>
939         <xsl:variable name="eventTipClass">
940           <xsl:choose>
941             <xsl:when test="$dayPos &gt; 5">eventTipReverse</xsl:when>
942             <xsl:otherwise>eventTip</xsl:otherwise>
943           </xsl:choose>
944         </xsl:variable>
945         <span class="{$eventTipClass}">
946           <xsl:if test="status='CANCELLED'"><span class="eventTipStatusCancelled">CANCELLED</span></xsl:if>
947           <xsl:if test="status='TENTATIVE'"><span class="eventTipStatusTentative">TENTATIVE</span></xsl:if>
948           <strong><xsl:value-of select="summary"/></strong><br/>
949           Time:
950           <xsl:choose>
951             <xsl:when test="start/allday = 'false'">
952               <xsl:value-of select="start/time"/>
953               <xsl:if test="start/time != end/time">
954                 - <xsl:value-of select="end/time"/>
955               </xsl:if>
956             </xsl:when>
957             <xsl:otherwise>
958               all day
959             </xsl:otherwise>
960           </xsl:choose><br/>
961           <xsl:if test="location/address">
962             Location: <xsl:value-of select="location/address"/><br/>
963           </xsl:if>
964           Calendar: <xsl:value-of select="calendar/name"/>
965         </span>
966       </a>
967     </li>
968   </xsl:template>
969
970   <!--==== YEAR VIEW ====-->
971   <xsl:template name="yearView">
972     <table id="yearCalendarTable" border="0" cellpadding="0" cellspacing="0">
973       <tr>
974         <xsl:apply-templates select="/bedework/eventscalendar/year/month[position() &lt;= 3]"/>
975       </tr>
976       <tr>
977         <xsl:apply-templates select="/bedework/eventscalendar/year/month[(position() &gt; 3) and (position() &lt;= 6)]"/>
978       </tr>
979       <tr>
980         <xsl:apply-templates select="/bedework/eventscalendar/year/month[(position() &gt; 6) and (position() &lt;= 9)]"/>
981       </tr>
982       <tr>
983         <xsl:apply-templates select="/bedework/eventscalendar/year/month[position() &gt; 9]"/>
984       </tr>
985     </table>
986   </xsl:template>
987
988   <!-- year view month tables -->
989   <xsl:template match="month">
990     <td>
991       <table class="yearViewMonthTable" border="0" cellpadding="0" cellspacing="0">
992         <tr>
993           <td colspan="8" class="monthName">
994             <xsl:variable name="firstDayOfMonth" select="week/day/date"/>
995             <a href="{$setViewPeriod}&amp;viewType=monthView&amp;date={$firstDayOfMonth}">
996               <xsl:value-of select="longname"/>
997             </a>
998           </td>
999         </tr>
1000         <tr>
1001           <th>&#160;</th>
1002           <xsl:for-each select="/bedework/shortdaynames/val">
1003             <th><xsl:value-of select="."/></th>
1004           </xsl:for-each>
1005         </tr>
1006         <xsl:for-each select="week">
1007           <tr>
1008             <td class="weekCell">
1009               <xsl:variable name="firstDayOfWeek" select="day/date"/>
1010               <a href="{$setViewPeriod}&amp;viewType=weekView&amp;date={$firstDayOfWeek}">
1011                 <xsl:value-of select="value"/>
1012               </a>
1013             </td>
1014             <xsl:for-each select="day">
1015               <xsl:choose>
1016                 <xsl:when test="filler='true'">
1017                   <td class="filler">&#160;</td>
1018                 </xsl:when>
1019                 <xsl:otherwise>
1020                   <td>
1021                     <xsl:variable name="dayDate" select="date"/>
1022                     <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$dayDate}">
1023                       <xsl:value-of select="value"/>
1024                     </a>
1025                   </td>
1026                 </xsl:otherwise>
1027               </xsl:choose>
1028             </xsl:for-each>
1029           </tr>
1030         </xsl:for-each>
1031       </table>
1032     </td>
1033   </xsl:template>
1034
1035   <!--==== CALENDARS PAGE ====-->
1036   <xsl:template match="calendars">
1037     <xsl:variable name="topLevelCalCount" select="count(calendar/calendar)"/>
1038     <table id="calPageTable" border="0" cellpadding="0" cellspacing="0">
1039       <tr>
1040         <th colspan="2">
1041           All Calendars
1042         </th>
1043       </tr>
1044       <tr>
1045         <td colspan="2" class="infoCell">
1046           Select a calendar from the list below to see only that calendar's events.
1047         </td>
1048       </tr>
1049       <tr>
1050         <td class="leftCell">
1051           <ul class="calendarTree">
1052             <xsl:apply-templates select="calendar/calendar[position() &lt;= ceiling($topLevelCalCount div 2)]" mode="calTree"/>
1053           </ul>
1054         </td>
1055         <td>
1056           <ul class="calendarTree">
1057             <xsl:apply-templates select="calendar/calendar[position() &gt; ceiling($topLevelCalCount div 2)]" mode="calTree"/>
1058           </ul>
1059         </td>
1060       </tr>
1061     </table>
1062   </xsl:template>
1063
1064   <xsl:template match="calendar" mode="calTree">
1065     <xsl:variable name="itemClass">
1066       <xsl:choose>
1067         <xsl:when test="calendarCollection='false'">folder</xsl:when>
1068         <xsl:otherwise>calendar</xsl:otherwise>
1069       </xsl:choose>
1070     </xsl:variable>
1071     <xsl:variable name="url" select="path"/>
1072     <li class="{$itemClass}">
1073       <a href="{$setSelection}&amp;calUrl={$url}"><xsl:value-of select="name"/></a>
1074       <xsl:if test="calendar">
1075         <ul>
1076           <xsl:apply-templates select="calendar" mode="calTree"/>
1077         </ul>
1078       </xsl:if>
1079     </li>
1080   </xsl:template>
1081
1082   <!--+++++++++++++++ System Stats ++++++++++++++++++++-->
1083   <xsl:template name="stats">
1084     <div id="stats">
1085       <h2>System Statistics</h2>
1086
1087       <p>
1088         Stats collection:
1089       </p>
1090       <ul>
1091         <li>
1092           <a href="{$stats}&amp;enable=yes">enable</a> |
1093           <a href="{$stats}&amp;disable=yes">disable</a>
1094         </li>
1095         <li><a href="{$stats}&amp;fetch=yes">fetch statistics</a></li>
1096         <li><a href="{$stats}&amp;dump=yes">dump stats to log</a></li>
1097       </ul>
1098       <table id="statsTable" cellpadding="0">
1099         <xsl:for-each select="/bedework/sysStats/*">
1100           <xsl:choose>
1101             <xsl:when test="name(.) = 'header'">
1102               <tr>
1103                 <th colspan="2">
1104                   <xsl:value-of select="."/>
1105                 </th>
1106               </tr>
1107             </xsl:when>
1108             <xsl:otherwise>
1109               <tr>
1110                 <td class="label">
1111                   <xsl:value-of select="label"/>
1112                 </td>
1113                 <td class="value">
1114                   <xsl:value-of select="value"/>
1115                 </td>
1116               </tr>
1117             </xsl:otherwise>
1118           </xsl:choose>
1119         </xsl:for-each>
1120       </table>
1121     </div>
1122   </xsl:template>
1123
1124   <!--==== UTILITY TEMPLATES ====-->
1125
1126   <!-- search and replace template taken from
1127        http://www.biglist.com/lists/xsl-list/archives/200211/msg00337.html -->
1128   <xsl:template name="replace">
1129     <xsl:param name="string" select="''"/>
1130     <xsl:param name="pattern" select="''"/>
1131     <xsl:param name="replacement" select="''"/>
1132     <xsl:choose>
1133       <xsl:when test="$pattern != '' and $string != '' and contains($string, $pattern)">
1134         <xsl:value-of select="substring-before($string, $pattern)"/>
1135         <xsl:copy-of select="$replacement"/>
1136         <xsl:call-template name="replace">
1137           <xsl:with-param name="string" select="substring-after($string, $pattern)"/>
1138           <xsl:with-param name="pattern" select="$pattern"/>
1139           <xsl:with-param name="replacement" select="$replacement"/>
1140         </xsl:call-template>
1141       </xsl:when>
1142       <xsl:otherwise>
1143         <xsl:value-of select="$string"/>
1144       </xsl:otherwise>
1145     </xsl:choose>
1146   </xsl:template>
1147
1148   <!--==== FOOTER ====-->
1149
1150   <xsl:template name="footer">
1151     <div id="footer">
1152       Demonstration calendar; place footer information here.
1153     </div>
1154     <div id="subFoot">
1155       Based on the <a href="http://www.bedework.org/">Bedework Calendar</a> |
1156       <a href="?noxslt=yes">show XML</a> |
1157       <a href="?refreshXslt=yes">refresh XSLT</a>
1158     </div>
1159   </xsl:template>
1160 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.