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

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

removing count() tests from xslt in favor of more efficient tag existence checks.

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