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

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

fixup search results in public client - restore persistent search bar. Still need to handle multi-page searches.

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