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

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

added messages and errors to personal client

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   <!--  Rensselaer PERSONAL CALENDAR STYLESHEET  -->
13   <!-- ========================================= -->
14
15   <!-- DEFINE INCLUDES -->
16   <xsl:include href="errors.xsl"/>
17   <xsl:include href="messages.xsl"/>
18
19   <!-- DEFINE GLOBAL CONSTANTS -->
20   <!-- URL of html resources (images, css, other html); by default this is
21        set to the application root, but for the personal calendar
22        this should be changed to point to a
23        web server over https to avoid mixed content errors, e.g.,
24   <xsl:variable name="resourcesRoot" select="'https://mywebserver.edu/myresourcesdir'"/>
25     -->
26   <xsl:variable name="resourcesRoot" select="/bedework/approot"/>
27
28   <!-- URL of the XSL template directory -->
29   <!-- The approot is an appropriate place to put
30        included stylesheets and xml fragments. These are generally
31        referenced relatively (like errors.xsl and messages.xsl above);
32        this variable is here for your convenience if you choose to
33        reference it explicitly.  It is not used in this stylesheet, however,
34        and can be safely removed if you so choose. -->
35   <xsl:variable name="appRoot" select="/bedework/approot"/>
36
37   <!-- Properly encoded prefixes to the application actions; use these to build
38        urls; allows the application to be used without cookies or within a portal. -->
39   <xsl:variable name="setup" select="/bedework/urlPrefixes/setup"/>
40   <xsl:variable name="setSelection" select="/bedework/urlPrefixes/setSelection"/>
41   <xsl:variable name="setViewPeriod" select="/bedework/urlPrefixes/setViewPeriod"/>
42   <xsl:variable name="eventView" select="/bedework/urlPrefixes/eventView"/>
43   <xsl:variable name="initEvent" select="/bedework/urlPrefixes/initEvent"/>
44   <xsl:variable name="addEvent" select="/bedework/urlPrefixes/addEvent"/>
45   <xsl:variable name="addEventUsingPage" select="/bedework/urlPrefixes/addEventUsingPage"/>
46   <xsl:variable name="event-addEventRefComplete" select="/bedework/urlPrefixes/event/addEventRefComplete/a/@href"/>
47   <xsl:variable name="event-setAccess" select="/bedework/urlPrefixes/event/setAccess/a/@href"/>
48   <xsl:variable name="event-selectCalForEvent" select="/bedework/urlPrefixes/event/selectCalForEvent/a/@href"/>
49   <xsl:variable name="editEvent" select="/bedework/urlPrefixes/editEvent"/>
50   <xsl:variable name="delEvent" select="/bedework/urlPrefixes/delEvent"/>
51   <xsl:variable name="addEventRef" select="/bedework/urlPrefixes/addEventRef"/>
52   <xsl:variable name="export" select="/bedework/urlPrefixes/export"/>
53   <xsl:variable name="mailEvent" select="/bedework/urlPrefixes/mailEvent"/>
54   <xsl:variable name="showPage" select="/bedework/urlPrefixes/showPage"/>
55   <xsl:variable name="manageLocations" select="/bedework/urlPrefixes/manageLocations"/>
56   <xsl:variable name="addLocation" select="/bedework/urlPrefixes/addLocation"/>
57   <xsl:variable name="editLocation" select="/bedework/urlPrefixes/editLocation"/>
58   <xsl:variable name="delLocation" select="/bedework/urlPrefixes/delLocation"/>
59   <xsl:variable name="initEventAlarm" select="/bedework/urlPrefixes/initEventAlarm"/>
60   <xsl:variable name="setAlarm" select="/bedework/urlPrefixes/setAlarm"/>
61   <xsl:variable name="initUpload" select="/bedework/urlPrefixes/initUpload"/>
62   <xsl:variable name="upload" select="/bedework/urlPrefixes/upload"/>
63   <xsl:variable name="freeBusy-fetch" select="/bedework/urlPrefixes/freeBusy/fetch/a/@href"/>
64   <xsl:variable name="freeBusy-setAccess" select="/bedework/urlPrefixes/freeBusy/setAccess/a/@href"/>
65   <!-- calendars -->
66   <xsl:variable name="fetchPublicCalendars" select="/bedework/urlPrefixes/fetchPublicCalendars"/>
67   <xsl:variable name="calendar-fetch" select="/bedework/urlPrefixes/calendar/fetch/a/@href"/><!-- used -->
68   <xsl:variable name="calendar-fetchDescriptions" select="/bedework/urlPrefixes/calendar/fetchDescriptions/a/@href"/><!-- used -->
69   <xsl:variable name="calendar-initAdd" select="/bedework/urlPrefixes/calendar/initAdd/a/@href"/><!-- used -->
70   <xsl:variable name="calendar-delete" select="/bedework/urlPrefixes/calendar/delete/a/@href"/>
71   <xsl:variable name="calendar-fetchForDisplay" select="/bedework/urlPrefixes/calendar/fetchForDisplay/a/@href"/>
72   <xsl:variable name="calendar-fetchForUpdate" select="/bedework/urlPrefixes/calendar/fetchForUpdate/a/@href"/><!-- used -->
73   <xsl:variable name="calendar-update" select="/bedework/urlPrefixes/calendar/update/a/@href"/><!-- used -->
74   <xsl:variable name="calendar-setAccess" select="/bedework/urlPrefixes/calendar/setAccess/a/@href"/>
75   <!-- subscriptions -->
76   <xsl:variable name="subscriptions-fetch" select="/bedework/urlPrefixes/subscriptions/fetch/a/@href"/>
77   <xsl:variable name="subscriptions-fetchForUpdate" select="/bedework/urlPrefixes/subscriptions/fetchForUpdate/a/@href"/>
78   <xsl:variable name="subscriptions-initAdd" select="/bedework/urlPrefixes/subscriptions/initAdd/a/@href"/>
79   <xsl:variable name="subscriptions-subscribe" select="/bedework/urlPrefixes/subscriptions/subscribe/a/@href"/>
80   <!-- preferences -->
81   <xsl:variable name="prefs-fetchForUpdate" select="/bedework/urlPrefixes/prefs/fetchForUpdate/a/@href"/>
82   <xsl:variable name="prefs-update" select="/bedework/urlPrefixes/prefs/update/a/@href"/>
83
84   <!-- URL of the web application - includes web context
85   <xsl:variable name="urlPrefix" select="/bedework/urlprefix"/> -->
86
87   <!-- Other generally useful global variables -->
88   <xsl:variable name="confId" select="/bedework/confirmationid"/>
89   <xsl:variable name="prevdate" select="/bedework/previousdate"/>
90   <xsl:variable name="nextdate" select="/bedework/nextdate"/>
91   <xsl:variable name="curdate" select="/bedework/currentdate/date"/>
92   <xsl:variable name="skin">default</xsl:variable>
93   <xsl:variable name="publicCal">/cal</xsl:variable>
94
95  <!-- BEGIN MAIN TEMPLATE -->
96   <xsl:template match="/">
97     <html lang="en">
98       <head>
99         <xsl:call-template name="headSection"/>
100       </head>
101       <body>
102       <xsl:choose>
103         <xsl:when test="/bedework/page='selectCalForEvent'">
104           <xsl:call-template name="selectCalForEvent"/>
105         </xsl:when>
106         <xsl:otherwise>
107             <xsl:call-template name="headBar"/>
108             <xsl:if test="/bedework/message">
109               <div id="messages">
110                 <xsl:apply-templates select="/bedework/message"/>
111               </div>
112             </xsl:if>
113             <xsl:if test="/bedework/error">
114               <div id="errors">
115                 <xsl:apply-templates select="/bedework/error"/>
116               </div>
117             </xsl:if>
118             <table id="bodyBlock" cellspacing="0">
119               <tr>
120                 <xsl:choose>
121                   <xsl:when test="/bedework/appvar[key='sidebar']/value='closed'">
122                     <td id="sideBarClosed">
123                       <img src="{$resourcesRoot}/resources/spacer.gif" width="1" height="1" border="0" alt="*"/>
124                     </td>
125                   </xsl:when>
126                   <xsl:otherwise>
127                     <td id="sideBar">
128                       <xsl:call-template name="sideBar"/>
129                     </td>
130                   </xsl:otherwise>
131                 </xsl:choose>
132                 <td id="bodyContent">
133                   <xsl:call-template name="tabs"/>
134                   <xsl:call-template name="navigation"/>
135                   <xsl:choose>
136                     <xsl:when test="/bedework/page='event'">
137                       <!-- show an event -->
138                       <xsl:apply-templates select="/bedework/event"/>
139                     </xsl:when>
140                     <xsl:when test="/bedework/page='addEvent'">
141                       <xsl:call-template name="addEvent"/>
142                     </xsl:when>
143                     <xsl:when test="/bedework/page='addEventRef'">
144                       <xsl:apply-templates select="/bedework/event" mode="addEventRef"/>
145                     </xsl:when>
146                     <xsl:when test="/bedework/page='editEvent'">
147                       <!-- edit an event -->
148                       <xsl:apply-templates select="/bedework/formElements" mode="editEvent"/>
149                     </xsl:when>
150                     <xsl:when test="/bedework/page='alarmOptions'">
151                       <xsl:call-template name="alarmOptions" />
152                     </xsl:when>
153                     <xsl:when test="/bedework/page='upload'">
154                       <xsl:call-template name="upload" />
155                     </xsl:when>
156                     <xsl:when test="/bedework/page='manageLocations'">
157                       <xsl:call-template name="manageLocations" />
158                     </xsl:when>
159                     <xsl:when test="/bedework/page='editLocation'">
160                       <!-- edit an event -->
161                       <xsl:apply-templates select="/bedework/formElements" mode="editLocation"/>
162                     </xsl:when>
163                     <xsl:when test="/bedework/page='subscriptions' or /bedework/page='modSubscription'">
164                       <xsl:apply-templates select="/bedework/subscriptions"/>
165                     </xsl:when>
166                     <xsl:when test="/bedework/page='calendarList' or
167                                     /bedework/page='calendarDescriptions' or
168                                     /bedework/page='displayCalendar' or
169                                     /bedework/page='modCalendar' or
170                                     /bedework/page='deleteCalendarConfirm' or
171                                     /bedework/page='calendarReferenced'">
172                       <xsl:apply-templates select="/bedework/calendars"/>
173                     </xsl:when>
174                     <xsl:when test="/bedework/page='freeBusy'">
175                       <xsl:call-template name="utilBar"/>
176                       <xsl:apply-templates select="/bedework/freebusy"/>
177                     </xsl:when>
178                     <xsl:when test="/bedework/page='modPrefs'">
179                       <!-- show an arbitrary page -->
180                       <xsl:apply-templates select="/bedework/prefs"/>
181                     </xsl:when>
182                     <xsl:when test="/bedework/page='other'">
183                       <!-- show an arbitrary page -->
184                       <xsl:call-template name="selectPage"/>
185                     </xsl:when>
186                     <xsl:otherwise>
187                       <!-- otherwise, show the eventsCalendar -->
188                       <xsl:call-template name="utilBar"/>
189                       <!-- main eventCalendar content -->
190                       <xsl:choose>
191                         <xsl:when test="/bedework/periodname='Day'">
192                           <xsl:call-template name="listView"/>
193                         </xsl:when>
194                         <xsl:when test="/bedework/periodname='Week' or /bedework/periodname=''">
195                           <xsl:choose>
196                             <xsl:when test="/bedework/appvar[key='weekViewMode']/value='list'">
197                               <xsl:call-template name="listView"/>
198                             </xsl:when>
199                             <xsl:otherwise>
200                               <xsl:call-template name="weekView"/>
201                             </xsl:otherwise>
202                           </xsl:choose>
203                         </xsl:when>
204                         <xsl:when test="/bedework/periodname='Month'">
205                           <xsl:choose>
206                             <xsl:when test="/bedework/appvar[key='monthViewMode']/value='list'">
207                               <xsl:call-template name="listView"/>
208                             </xsl:when>
209                             <xsl:otherwise>
210                               <xsl:call-template name="monthView"/>
211                             </xsl:otherwise>
212                           </xsl:choose>
213                         </xsl:when>
214                         <xsl:otherwise>
215                           <xsl:call-template name="yearView"/>
216                         </xsl:otherwise>
217                       </xsl:choose>
218                     </xsl:otherwise>
219                   </xsl:choose>
220                 </td>
221               </tr>
222             </table>
223             <!-- footer -->
224             <xsl:call-template name="footer"/>
225           </xsl:otherwise>
226         </xsl:choose>
227       </body>
228     </html>
229   </xsl:template>
230
231   <!--==== HEAD SECTION  ====-->
232
233   <xsl:template name="headSection">
234     <title>Bedework: Personal Calendar Client</title>
235     <meta name="robots" content="noindex,nofollow"/>
236     <link rel="stylesheet" href="{$resourcesRoot}/default/default/default.css"/>
237     <link rel="stylesheet" type="text/css" media="print" href="{$resourcesRoot}/default/default/print.css" />
238     <link rel="icon" type="image/ico" href="{$resourcesRoot}/resources/bedework.ico" />
239     <xsl:if test="/bedework/page='addEvent' or
240                   /bedework/page='addEventRef' or
241                   /bedework/page='editEvent' or
242                   /bedework/page='selectCalForEvent' or
243                   /bedework/page='upload' or
244                   /bedework/page='modPrefs'">
245       <script type="text/javascript" src="{$resourcesRoot}/resources/includes.js"></script>
246     </xsl:if>
247     <xsl:if test="/bedework/page='addEvent' or
248                   /bedework/page='editEvent'">
249       <script type="text/javascript" src="{$resourcesRoot}/resources/bwClock.js"></script>
250       <link rel="stylesheet" href="{$resourcesRoot}/resources/bwClock.css"/>
251       <script type="text/javascript" src="{$resourcesRoot}/resources/dynCalendarWidget.js"></script>
252       <link rel="stylesheet" href="{$resourcesRoot}/resources/dynCalendarWidget.css"/>
253       <script type="text/javascript" src="{$resourcesRoot}/resources/browserSniffer.js"></script>
254     </xsl:if>
255   </xsl:template>
256
257   <!--==== HEADER TEMPLATES and NAVIGATION  ====-->
258
259   <xsl:template name="headBar">
260     <table width="100%" border="0" cellpadding="0" cellspacing="0" id="logoTable">
261       <tr>
262         <td colspan="3" id="logoCell"><a href="http://www.bedework.org/"><img src="{$resourcesRoot}/resources/bedeworkLogo.gif" width="292" height="75" border="0" alt="Bedework"/></a></td>
263         <td colspan="2" id="schoolLinksCell">
264           <h2>Personal Calendar</h2>
265           <a href="{$publicCal}">Public Calendar</a> |
266           <a href="http://www.yourschoolhere.edu">School Home</a> |
267           <a href="http://www.bedework.org/">Other Link</a> |
268           <a href="http://helpdesk.rpi.edu/update.do?catcenterkey=51">
269             Example Calendar Help
270           </a>
271         </td>
272       </tr>
273     </table>
274     <table id="curDateRangeTable"  cellspacing="0">
275       <td class="sideBarOpenCloseIcon">
276         <xsl:choose>
277           <xsl:when test="/bedework/appvar[key='sidebar']/value='closed'">
278             <a href="?setappvar=sidebar(opened)">
279               <img alt="open sidebar" src="{$resourcesRoot}/resources/sideBarArrowOpen.gif" width="21" height="16" border="0" align="left"/>
280             </a>
281           </xsl:when>
282           <xsl:otherwise>
283             <a href="?setappvar=sidebar(closed)">
284               <img alt="close sidebar" src="{$resourcesRoot}/resources/sideBarArrowClose.gif" width="21" height="16" border="0" align="left"/>
285             </a>
286           </xsl:otherwise>
287         </xsl:choose>
288       </td>
289       <td class="date">
290         <xsl:value-of select="/bedework/firstday/longdate"/>
291         <xsl:if test="/bedework/periodname!='Day'">
292           -
293           <xsl:value-of select="/bedework/lastday/longdate"/>
294         </xsl:if>
295       </td>
296       <td class="rssPrint">
297         <a href="javascript:window.print()" title="print this view">
298           <img alt="print this view" src="{$resourcesRoot}/resources/std-print-icon.gif" width="20" height="14" border="0"/> print
299         </a>
300         <a class="rss" href="{$setSelection}?setappvar=summaryMode(details)&amp;skinName=rss" title="RSS feed">RSS</a>
301       </td>
302     </table>
303   </xsl:template>
304
305   <xsl:template name="sideBar">
306     <h3>
307       <img alt="manage views" src="{$resourcesRoot}/resources/glassFill-icon-menuButton.gif" width="12" height="11" border="0"/> views
308     </h3>
309     <ul id="myViews">
310       <xsl:choose>
311         <xsl:when test="/bedework/views/view">
312           <xsl:for-each select="/bedework/views/view">
313             <xsl:variable name="viewName" select="name"/>
314             <xsl:choose>
315               <xsl:when test="/bedework/selectionState/selectionType = 'view'
316                               and name=/bedework/selectionState/view/name">
317                 <li class="selected"><a href="{$setSelection}?viewName={$viewName}"><xsl:value-of select="name"/></a></li>
318               </xsl:when>
319               <xsl:otherwise>
320                 <li><a href="{$setSelection}?viewName={$viewName}"><xsl:value-of select="name"/></a></li>
321               </xsl:otherwise>
322             </xsl:choose>
323           </xsl:for-each>
324         </xsl:when>
325         <xsl:otherwise>
326           <li class="none">no views</li>
327         </xsl:otherwise>
328       </xsl:choose>
329     </ul>
330
331     <h3>
332       <a href="{$calendar-fetch}">
333         <img alt="manage calendars" src="{$resourcesRoot}/resources/glassFill-icon-menuButton.gif" width="12" height="11" border="0"/> calendars
334       </a>
335     </h3>
336     <ul class="calendarTree">
337       <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar" mode="myCalendars"/>
338     </ul>
339
340     <h3>
341       <a href="{$subscriptions-fetch}" title="manage subscriptions">
342         <img alt="manage subscriptions" src="{$resourcesRoot}/resources/glassFill-icon-menuButton.gif" width="12" height="11" border="0"/>
343         subscriptions
344       </a>
345     </h3>
346     <ul class="calendarTree">
347       <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/></xsl:variable>
348       <xsl:choose>
349         <xsl:when test="/bedework/mySubscriptions/subscription[not(contains(uri,$userPath))]">
350           <xsl:apply-templates select="/bedework/mySubscriptions/subscription[not(contains(uri,$userPath))]" mode="mySubscriptions"/>
351         </xsl:when>
352         <xsl:otherwise>
353           <li class="none">no subscriptions</li>
354         </xsl:otherwise>
355       </xsl:choose>
356     </ul>
357
358     <h3>options</h3>
359     <ul id="sideBarMenu">
360       <li><a href="{$manageLocations}">Manage Locations</a></li>
361       <li><a href="{$prefs-fetchForUpdate}">Preferences</a></li>
362     </ul>
363   </xsl:template>
364
365   <xsl:template name="tabs">
366     <xsl:choose>
367       <xsl:when test="/bedework/page='eventscalendar' or /bedework/page='freeBusy'">
368         <xsl:variable name="navAction">
369           <xsl:choose>
370             <xsl:when test="/bedework/page='freeBusy'"><xsl:value-of select="$freeBusy-fetch"/></xsl:when>
371             <xsl:otherwise><xsl:value-of select="$setViewPeriod"/>?b=de</xsl:otherwise>
372           </xsl:choose>
373         </xsl:variable>
374         <table border="0" cellpadding="0" cellspacing="0" id="tabsTable">
375           <tr>
376             <td>
377               <xsl:choose>
378                 <xsl:when test="/bedework/periodname='Day'">
379                   <a href="{$navAction}&amp;viewType=dayView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-day-on.gif" width="91" height="20" border="0" alt="DAY"/></a>
380                 </xsl:when>
381                 <xsl:otherwise>
382                   <a href="{$navAction}&amp;viewType=dayView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-day-off.gif" width="91" height="20" border="0" alt="DAY"/></a>
383                 </xsl:otherwise>
384               </xsl:choose>
385             </td>
386             <td>
387               <xsl:choose>
388                 <xsl:when test="/bedework/periodname='Week' or /bedework/periodname=''">
389                   <a href="{$navAction}&amp;viewType=weekView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-week-on.gif" width="92" height="20" border="0" alt="WEEK"/></a>
390                  </xsl:when>
391                 <xsl:otherwise>
392                   <a href="{$navAction}&amp;viewType=weekView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-week-off.gif" width="92" height="20" border="0" alt="WEEK"/></a>
393                  </xsl:otherwise>
394               </xsl:choose>
395             </td>
396             <td>
397               <xsl:choose>
398                 <xsl:when test="/bedework/periodname='Month'">
399                   <a href="{$navAction}&amp;viewType=monthView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-month-on.gif" width="90" height="20" border="0" alt="MONTH"/></a>
400                 </xsl:when>
401                 <xsl:otherwise>
402                   <a href="{$navAction}&amp;viewType=monthView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-month-off.gif" width="90" height="20" border="0" alt="MONTH"/></a>
403                 </xsl:otherwise>
404               </xsl:choose>
405             </td>
406             <td>
407               <xsl:choose>
408                 <!-- don't allow switching to year for free busy view, so only use setViewPeriod action -->
409                 <xsl:when test="/bedework/periodname='Year'">
410                   <a href="{$setViewPeriod}?viewType=yearView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-year-on.gif" width="92" height="20" border="0" alt="YEAR"/></a>
411                 </xsl:when>
412                 <xsl:otherwise>
413                   <a href="{$setViewPeriod}?viewType=yearView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-year-off.gif" width="92" height="20" border="0" alt="YEAR"/></a>
414                 </xsl:otherwise>
415               </xsl:choose>
416             </td>
417             <td class="rightCell">
418               logged in as
419               <xsl:text> </xsl:text>
420               <strong><xsl:value-of select="/bedework/userid"/></strong>
421               <xsl:text> </xsl:text>
422               <span class="logout"><a href="{$setup}?logout=true">logout</a></span>
423             </td>
424           </tr>
425         </table>
426       </xsl:when>
427       <xsl:otherwise>
428         <table border="0" cellpadding="0" cellspacing="0" id="tabsTable">
429           <tr>
430             <td>
431               <a href="{$setViewPeriod}?viewType=dayView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-day-off.gif" width="91" height="20" border="0" alt="DAY"/></a>
432             </td>
433             <td>
434               <a href="{$setViewPeriod}?viewType=weekView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-week-off.gif" width="92" height="20" border="0" alt="WEEK"/></a>
435             </td>
436             <td>
437               <a href="{$setViewPeriod}?viewType=monthView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-month-off.gif" width="90" height="20" border="0" alt="MONTH"/></a>
438             </td>
439             <td>
440               <a href="{$setViewPeriod}?viewType=yearView&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-tab-year-off.gif" width="92" height="20" border="0" alt="YEAR"/></a>
441             </td>
442             <td class="rightCell">
443               logged in as
444               <xsl:text> </xsl:text>
445               <strong><xsl:value-of select="/bedework/userid"/></strong>
446               <xsl:text> </xsl:text>
447               <span class="logout"><a href="{$setup}?logout=true">logout</a></span>
448             </td>
449           </tr>
450         </table>
451       </xsl:otherwise>
452     </xsl:choose>
453   </xsl:template>
454
455   <xsl:template name="navigation">
456     <xsl:variable name="navAction">
457       <xsl:choose>
458         <xsl:when test="/bedework/page='freeBusy'"><xsl:value-of select="$freeBusy-fetch"/></xsl:when>
459         <xsl:otherwise><xsl:value-of select="$setViewPeriod"/>?b=de</xsl:otherwise>
460       </xsl:choose>
461     </xsl:variable>
462     <table border="0" cellpadding="0" cellspacing="0" id="navigationBarTable">
463       <tr>
464         <td class="leftCell">
465           <a href="{$navAction}&amp;date={$prevdate}"><img src="{$resourcesRoot}/resources/std-arrow-left.gif" alt="previous" width="13" height="16" class="prevImg" border="0"/></a>
466           <a href="{$navAction}&amp;date={$nextdate}"><img src="{$resourcesRoot}/resources/std-arrow-right.gif" alt="next" width="13" height="16" class="nextImg" border="0"/></a>
467           <xsl:choose>
468             <xsl:when test="/bedework/periodname='Year'">
469               <xsl:value-of select="substring(/bedework/firstday/date,1,4)"/>
470             </xsl:when>
471             <xsl:when test="/bedework/periodname='Month'">
472               <xsl:value-of select="/bedework/firstday/monthname"/>, <xsl:value-of select="substring(/bedework/firstday/date,1,4)"/>
473             </xsl:when>
474             <xsl:when test="/bedework/periodname='Week'">
475               Week of <xsl:value-of select="substring-after(/bedework/firstday/longdate,', ')"/>
476             </xsl:when>
477             <xsl:otherwise>
478               <xsl:value-of select="/bedework/firstday/longdate"/>
479             </xsl:otherwise>
480           </xsl:choose>
481         </td>
482         <td class="todayButton">
483           <a href="{$navAction}&amp;viewType=todayView&amp;date={$curdate}">
484             <img src="{$resourcesRoot}/resources/std-button-today-off.gif" width="54" height="22" border="0" alt="Go to Today" align="left"/>
485           </a>
486         </td>
487         <td align="right" class="gotoForm">
488           <form name="calForm" method="get" action="{$navAction}">
489              <table border="0" cellpadding="0" cellspacing="0">
490               <tr>
491                 <xsl:if test="/bedework/periodname!='Year'">
492                   <td>
493                     <select name="viewStartDate.month">
494                       <xsl:for-each select="/bedework/monthvalues/val">
495                         <xsl:variable name="temp" select="."/>
496                         <xsl:variable name="pos" select="position()"/>
497                         <xsl:choose>
498                           <xsl:when test="/bedework/monthvalues[start=$temp]">
499                             <option value="{$temp}" selected="selected">
500                               <xsl:value-of select="/bedework/monthlabels/val[position()=$pos]"/>
501                             </option>
502                           </xsl:when>
503                           <xsl:otherwise>
504                             <option value="{$temp}">
505                               <xsl:value-of select="/bedework/monthlabels/val[position()=$pos]"/>
506                             </option>
507                           </xsl:otherwise>
508                         </xsl:choose>
509                       </xsl:for-each>
510                     </select>
511                   </td>
512                   <xsl:if test="/bedework/periodname!='Month'">
513                     <td>
514                       <select name="viewStartDate.day">
515                         <xsl:for-each select="/bedework/dayvalues/val">
516                           <xsl:variable name="temp" select="."/>
517                           <xsl:variable name="pos" select="position()"/>
518                           <xsl:choose>
519                             <xsl:when test="/bedework/dayvalues[start=$temp]">
520                               <option value="{$temp}" selected="selected">
521                                 <xsl:value-of select="/bedework/daylabels/val[position()=$pos]"/>
522                               </option>
523                             </xsl:when>
524                             <xsl:otherwise>
525                               <option value="{$temp}">
526                                 <xsl:value-of select="/bedework/daylabels/val[position()=$pos]"/>
527                               </option>
528                             </xsl:otherwise>
529                           </xsl:choose>
530                         </xsl:for-each>
531                       </select>
532                     </td>
533                   </xsl:if>
534                 </xsl:if>
535                 <td>
536                   <xsl:variable name="temp" select="/bedework/yearvalues/start"/>
537                   <input type="text" name="viewStartDate.year" maxlength="4" size="4" value="{$temp}"/>
538                 </td>
539                 <td>
540                   <input name="submit" type="submit" value="go"/>
541                 </td>
542               </tr>
543             </table>
544           </form>
545         </td>
546       </tr>
547     </table>
548   </xsl:template>
549
550   <xsl:template name="utilBar">
551     <table width="100%" border="0" cellpadding="0" cellspacing="0" id="utilBarTable">
552        <tr>
553          <td class="leftCell">
554            <xsl:choose>
555              <xsl:when test="/bedework/periodname = 'day'">
556                <xsl:variable name="date" select="/bedework/firstday/date"/>
557                <a href="{$initEvent}?startdate={$date}" title="add event">
558                   <img src="{$resourcesRoot}/resources/add2mycal-icon-small.gif" width="12" height="16" border="0" alt="add event"/>
559                   add event
560                </a>
561              </xsl:when>
562              <xsl:otherwise>
563                <a href="{$initEvent}" title="add event">
564                   <img src="{$resourcesRoot}/resources/add2mycal-icon-small.gif" width="12" height="16" border="0" alt="add event"/>
565                   add event
566                </a>
567              </xsl:otherwise>
568            </xsl:choose>
569            <a href="{$initUpload}" title="upload event">
570               <img src="{$resourcesRoot}/resources/std-icalUpload-icon-small.gif" width="12" height="16" border="0" alt="upload event"/>
571               upload
572            </a>
573          </td>
574          <td class="rightCell">
575
576            <!-- show free / busy -->
577            <xsl:choose>
578              <xsl:when test="/bedework/periodname!='Year'">
579                <xsl:choose>
580                  <xsl:when test="/bedework/page='freeBusy'">
581                    <a href="{$setViewPeriod}?date={$curdate}"><img src="{$resourcesRoot}/resources/std-button-events.gif" width="70" height="21" border="0" alt="show events"/></a>
582                  </xsl:when>
583                  <xsl:otherwise>
584                    <a href="{$freeBusy-fetch}&amp;date={$curdate}"><img src="{$resourcesRoot}/resources/std-button-freebusy.gif" width="70" height="21" border="0" alt="show free/busy"/></a>
585                  </xsl:otherwise>
586                </xsl:choose>
587              </xsl:when>
588              <xsl:otherwise>
589                <img src="{$resourcesRoot}/resources/std-button-freebusy-off.gif" width="70" height="21" border="0" alt="show free/busy"/>
590              </xsl:otherwise>
591            </xsl:choose>
592
593            <!-- toggle list / calendar view -->
594            <xsl:choose>
595              <xsl:when test="/bedework/periodname='Day'">
596                <img src="{$resourcesRoot}/resources/std-button-listview-off.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
597              </xsl:when>
598              <xsl:when test="/bedework/periodname='Year'">
599                <img src="{$resourcesRoot}/resources/std-button-calview-off.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
600              </xsl:when>
601              <xsl:when test="/bedework/periodname='Month'">
602                <xsl:choose>
603                  <xsl:when test="/bedework/appvar[key='monthViewMode']/value='list'">
604                    <a href="{$setup}?setappvar=monthViewMode(cal)" title="toggle list/calendar view">
605                      <img src="{$resourcesRoot}/resources/std-button-calview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
606                    </a>
607                  </xsl:when>
608                  <xsl:otherwise>
609                    <a href="{$setup}?setappvar=monthViewMode(list)" title="toggle list/calendar view">
610                      <img src="{$resourcesRoot}/resources/std-button-listview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
611                    </a>
612                  </xsl:otherwise>
613                </xsl:choose>
614              </xsl:when>
615              <xsl:otherwise>
616                <xsl:choose>
617                  <xsl:when test="/bedework/appvar[key='weekViewMode']/value='list'">
618                    <a href="{$setup}?setappvar=weekViewMode(cal)" title="toggle list/calendar view">
619                      <img src="{$resourcesRoot}/resources/std-button-calview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
620                    </a>
621                  </xsl:when>
622                  <xsl:otherwise>
623                    <a href="{$setup}?setappvar=weekViewMode(list)" title="toggle list/calendar view">
624                      <img src="{$resourcesRoot}/resources/std-button-listview.gif" width="46" height="21" border="0" alt="toggle list/calendar view"/>
625                    </a>
626                  </xsl:otherwise>
627                </xsl:choose>
628              </xsl:otherwise>
629            </xsl:choose>
630
631            <!-- summary / detailed mode toggle -->
632            <xsl:choose>
633              <xsl:when test="/bedework/periodname='Year' or
634                               (/bedework/periodname='Month' and
635                               (/bedework/appvar[key='monthViewMode']/value='cal' or
636                                not(/bedework/appvar[key='monthViewMode']))) or
637                               (/bedework/periodname='Week' and
638                               (/bedework/appvar[key='weekViewMode']/value='cal' or
639                                not(/bedework/appvar[key='weekViewMode'])))">
640                <xsl:choose>
641                  <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
642                    <img src="{$resourcesRoot}/resources/std-button-summary-off.gif" width="62" height="21" border="0" alt="only summaries of events supported in this view"/>
643                  </xsl:when>
644                  <xsl:otherwise>
645                    <img src="{$resourcesRoot}/resources/std-button-details-off.gif" width="62" height="21" border="0" alt="only summaries of events supported in this view"/>
646                  </xsl:otherwise>
647                </xsl:choose>
648              </xsl:when>
649              <xsl:otherwise>
650                <xsl:choose>
651                  <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
652                    <a href="{$setup}?setappvar=summaryMode(summary)" title="toggle summary/detailed view">
653                      <img src="{$resourcesRoot}/resources/std-button-summary.gif" width="62" height="21" border="0" alt="toggle summary/detailed view"/>
654                    </a>
655                  </xsl:when>
656                  <xsl:otherwise>
657                    <a href="{$setup}?setappvar=summaryMode(details)" title="toggle summary/detailed view">
658                      <img src="{$resourcesRoot}/resources/std-button-details.gif" width="62" height="21" border="0" alt="toggle summary/detailed view"/>
659                    </a>
660                  </xsl:otherwise>
661                </xsl:choose>
662              </xsl:otherwise>
663            </xsl:choose>
664
665            <!-- refresh button -->
666            <a href="setup.do"><img src="{$resourcesRoot}/resources/std-button-refresh.gif" width="70" height="21" border="0" alt="refresh view"/></a>
667          </td>
668        </tr>
669     </table>
670   </xsl:template>
671
672   <!--==== LIST VIEW  (for day, week, and month) ====-->
673   <xsl:template name="listView">
674     <table id="listTable" border="0" cellpadding="0" cellspacing="0">
675       <xsl:choose>
676         <xsl:when test="not(/bedework/eventscalendar/year/month/week/day/event)">
677           <tr>
678             <td class="noEventsCell">
679               No events to display.
680             </td>
681           </tr>
682         </xsl:when>
683         <xsl:otherwise>
684           <xsl:for-each select="/bedework/eventscalendar/year/month/week/day[event]">
685             <xsl:if test="/bedework/periodname='Week' or /bedework/periodname='Month' or /bedework/periodname=''">
686               <tr>
687                 <td colspan="6" class="dateRow">
688                    <xsl:variable name="date" select="date"/>
689                    <a href="{$initEvent}?startdate={$date}" class="listAdd">
690                      add event
691                    </a>
692                    <a href="{$setViewPeriod}?viewType=dayView&amp;date={$date}">
693                      <xsl:value-of select="name"/>, <xsl:value-of select="longdate"/>
694                    </a>
695                  </td>
696               </tr>
697             </xsl:if>
698             <xsl:for-each select="event">
699               <xsl:variable name="id" select="id"/>
700               <xsl:variable name="subscriptionId" select="subscription/id"/>
701               <xsl:variable name="calPath" select="calendar/encodedPath"/>
702               <xsl:variable name="guid" select="guid"/>
703               <xsl:variable name="recurrenceId" select="recurrenceId"/>
704               <tr>
705                 <xsl:variable name="dateRangeStyle">
706                   <xsl:choose>
707                     <xsl:when test="start/shortdate = parent::day/shortdate">
708                       <xsl:choose>
709                         <xsl:when test="start/allday = 'true'">dateRangeCrossDay</xsl:when>
710                         <xsl:when test="start/hour24 &lt; 6">dateRangeEarlyMorning</xsl:when>
711                         <xsl:when test="start/hour24 &lt; 12">dateRangeMorning</xsl:when>
712                         <xsl:when test="start/hour24 &lt; 18">dateRangeAfternoon</xsl:when>
713                         <xsl:otherwise>dateRangeEvening</xsl:otherwise>
714                       </xsl:choose>
715                     </xsl:when>
716                     <xsl:otherwise>dateRangeCrossDay</xsl:otherwise>
717                   </xsl:choose>
718                 </xsl:variable>
719                 <xsl:choose>
720                   <xsl:when test="start/allday = 'true' and
721                                   start/shortdate = end/shortdate">
722                     <td class="{$dateRangeStyle} center" colspan="3">
723                       all day
724                     </td>
725                   </xsl:when>
726                   <xsl:otherwise>
727                     <td class="{$dateRangeStyle} right">
728                       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
729                       <xsl:choose>
730                         <xsl:when test="start/allday = 'true' and
731                                         parent::day/shortdate = start/shortdate">
732                           today
733                         </xsl:when>
734                         <xsl:when test="parent::day/shortdate != start/shortdate">
735                           <span class="littleArrow">&#171;</span>&#160;
736                           <xsl:value-of select="start/month"/>/<xsl:value-of select="start/day"/>
737                         </xsl:when>
738                         <xsl:otherwise>
739                           <xsl:value-of select="start/time"/>
740                         </xsl:otherwise>
741                       </xsl:choose>
742                       </a>
743                     </td>
744                     <td class="{$dateRangeStyle} center">
745                       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">-</a>
746                     </td>
747                     <td class="{$dateRangeStyle} left">
748                       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
749                       <xsl:choose>
750                         <xsl:when test="end/allday = 'true' and
751                                         parent::day/shortdate = end/shortdate">
752                           today
753                         </xsl:when>
754                         <xsl:when test="parent::day/shortdate != end/shortdate">
755                           <xsl:value-of select="end/month"/>/<xsl:value-of select="end/day"/>
756                           &#160;<span class="littleArrow">&#187;</span>
757                         </xsl:when>
758                         <xsl:otherwise>
759                           <xsl:value-of select="end/time"/>
760                         </xsl:otherwise>
761                       </xsl:choose>
762                       </a>
763                     </td>
764                   </xsl:otherwise>
765                 </xsl:choose>
766                 <xsl:variable name="descriptionClass">
767                   <xsl:choose>
768                     <xsl:when test="priority='cancelled'">description cancelled</xsl:when>
769                     <xsl:otherwise>description</xsl:otherwise>
770                   </xsl:choose>
771                 </xsl:variable>
772                 <td class="{$descriptionClass}">
773                   <xsl:choose>
774                     <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
775                       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
776                         <strong><xsl:value-of select="summary"/>: </strong>
777                         <xsl:value-of select="description"/>&#160;
778                         <em>
779                           <xsl:value-of select="location/address"/>
780                           <xsl:if test="location/subaddress != ''">
781                             , <xsl:value-of select="location/subaddress"/>
782                           </xsl:if>.&#160;
783                           <xsl:if test="cost!=''">
784                             <xsl:value-of select="cost"/>.&#160;
785                           </xsl:if>
786                           <xsl:if test="sponsor/name!='none'">
787                             Contact: <xsl:value-of select="sponsor/name"/>
788                           </xsl:if>
789                         </em>
790                       </a>
791                       <xsl:if test="link != ''">
792                         <xsl:variable name="link" select="link"/>
793                         <a href="{$link}" class="moreLink"><xsl:value-of select="link"/></a>
794                       </xsl:if>
795                     </xsl:when>
796                     <xsl:otherwise>
797                       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
798                         <xsl:value-of select="summary"/>
799                         <xsl:if test="location/address != ''">, <xsl:value-of select="location/address"/></xsl:if>
800                       </a>
801                     </xsl:otherwise>
802                   </xsl:choose>
803                 </td>
804                 <td class="eventLinks">
805                   <xsl:call-template name="eventLinks"/>
806                 </td>
807                 <td class="smallIcon">
808                   <xsl:variable name="eventIcalName" select="concat($guid,'.ics')"/>
809                   <a href="{$export}?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">
810                     <img src="{$resourcesRoot}/resources/std-ical_icon_small.gif" width="12" height="16" border="0" alt="Download event as ical - for Outlook, PDAs, iCal, and other desktop calendars"/>
811                   </a>
812                 </td>
813               </tr>
814             </xsl:for-each>
815           </xsl:for-each>
816         </xsl:otherwise>
817       </xsl:choose>
818     </table>
819   </xsl:template>
820
821   <xsl:template name="eventLinks">
822     <xsl:variable name="subscriptionId" select="subscription/id"/>
823     <xsl:variable name="calPath" select="calendar/encodedPath"/>
824     <xsl:variable name="guid" select="guid"/>
825     <xsl:variable name="recurrenceId" select="recurrenceId"/>
826     <xsl:choose>
827       <xsl:when test="isAnnotation">
828         <xsl:choose>
829           <xsl:when test="recurring=true">
830             <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;confirmationid={$confId}">Remove All</a>
831           </xsl:when>
832           <xsl:otherwise>
833             <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">Remove</a>
834           </xsl:otherwise>
835         </xsl:choose>
836       </xsl:when>
837       <xsl:when test="calendar/owner = /bedework/userid">
838         <a href="{$editEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">Edit</a> |
839         <xsl:choose>
840           <xsl:when test="recurring=true">
841             <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">Delete All</a>
842           </xsl:when>
843           <xsl:otherwise>
844             <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">Delete</a>
845           </xsl:otherwise>
846         </xsl:choose>
847       </xsl:when>
848       <xsl:otherwise>
849         <a href="{$subscriptions-fetch}">Subscription</a>
850       </xsl:otherwise>
851     </xsl:choose>
852   </xsl:template>
853
854   <!--==== WEEK CALENDAR VIEW ====-->
855   <xsl:template name="weekView">
856     <table id="monthCalendarTable" border="0" cellpadding="0" cellspacing="0">
857       <tr>
858         <xsl:for-each select="/bedework/daynames/val">
859           <th class="dayHeading"><xsl:value-of select="."/></th>
860         </xsl:for-each>
861       </tr>
862       <tr>
863         <xsl:for-each select="/bedework/eventscalendar/year/month/week/day">
864           <xsl:variable name="dayPos" select="position()"/>
865           <xsl:if test="filler='false'">
866             <td>
867               <xsl:variable name="dayDate" select="date"/>
868               <a href="{$initEvent}?startdate={$dayDate}" class="gridAdd" title="add event">
869                 <img src="{$resourcesRoot}/resources/addEvent-forGrid-icon.gif" width="10" height="10" border="0" alt="add event"/>
870               </a>
871               <a href="{$setViewPeriod}?viewType=dayView&amp;date={$dayDate}" class="dayLink" title="go to day">
872                 <xsl:value-of select="value"/>
873               </a>
874               <ul>
875                 <xsl:apply-templates select="event" mode="calendarLayout">
876                   <xsl:with-param name="dayPos" select="$dayPos"/>
877                 </xsl:apply-templates>
878               </ul>
879             </td>
880           </xsl:if>
881         </xsl:for-each>
882       </tr>
883     </table>
884   </xsl:template>
885
886   <!--==== MONTH CALENDAR VIEW ====-->
887   <xsl:template name="monthView">
888     <table id="monthCalendarTable" border="0" cellpadding="0" cellspacing="0">
889       <tr>
890         <xsl:for-each select="/bedework/daynames/val">
891           <th class="dayHeading"><xsl:value-of select="."/></th>
892         </xsl:for-each>
893       </tr>
894       <xsl:for-each select="/bedework/eventscalendar/year/month/week">
895         <tr>
896           <xsl:for-each select="day">
897             <xsl:variable name="dayPos" select="position()"/>
898             <xsl:choose>
899               <xsl:when test="filler='true'">
900                 <td class="filler">&#160;</td>
901               </xsl:when>
902               <xsl:otherwise>
903                 <td>
904                   <xsl:variable name="dayDate" select="date"/>
905                   <a href="{$initEvent}?startdate={$dayDate}" class="gridAdd" title="add event">
906                     <img src="{$resourcesRoot}/resources/addEvent-forGrid-icon.gif" width="10" height="10" border="0" alt="add event"/>
907                   </a>
908                   <a href="{$setViewPeriod}?viewType=dayView&amp;date={$dayDate}" class="dayLink" title="go to day">
909                     <xsl:value-of select="value"/>
910                   </a>
911                   <ul>
912                     <xsl:apply-templates select="event" mode="calendarLayout">
913                       <xsl:with-param name="dayPos" select="$dayPos"/>
914                     </xsl:apply-templates>
915                   </ul>
916                 </td>
917               </xsl:otherwise>
918             </xsl:choose>
919           </xsl:for-each>
920         </tr>
921       </xsl:for-each>
922     </table>
923   </xsl:template>
924
925   <xsl:template match="event" mode="calendarLayout">
926     <xsl:param name="dayPos"/>
927     <xsl:variable name="subscriptionId" select="subscription/id"/>
928     <xsl:variable name="calPath" select="calendar/encodedPath"/>
929     <xsl:variable name="guid" select="guid"/>
930     <xsl:variable name="recurrenceId" select="recurrenceId"/>
931     <xsl:variable name="eventClass">
932       <xsl:choose>
933         <!-- Special styles for the month grid -->
934         <xsl:when test="status='cancelled'">eventCancelled</xsl:when>
935         <xsl:when test="calendar/name='Holidays'">holiday</xsl:when>
936         <!-- Alternating colors for all standard events -->
937         <xsl:when test="position() mod 2 = 1">eventLinkA</xsl:when>
938         <xsl:otherwise>eventLinkB</xsl:otherwise>
939       </xsl:choose>
940     </xsl:variable>
941     <li>
942       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" class="{$eventClass}">
943         <xsl:value-of select="summary"/>
944         <xsl:variable name="eventTipClass">
945           <xsl:choose>
946             <xsl:when test="$dayPos &gt; 5">eventTipReverse</xsl:when>
947             <xsl:otherwise>eventTip</xsl:otherwise>
948           </xsl:choose>
949         </xsl:variable>
950         <span class="{$eventTipClass}">
951           <strong><xsl:value-of select="summary"/></strong><br/>
952           Time:
953           <xsl:choose>
954             <xsl:when test="start/allday = 'false'">
955               <xsl:value-of select="start/time"/>
956                - <xsl:value-of select="end/time"/>
957             </xsl:when>
958             <xsl:otherwise>
959               all day
960             </xsl:otherwise>
961           </xsl:choose><br/>
962           <xsl:if test="location/address">
963             Location: <xsl:value-of select="location/address"/><br/>
964           </xsl:if>
965           Calendar:
966             <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
967             <xsl:choose>
968               <xsl:when test="contains(calendar/path,$userPath)">
969                 <xsl:value-of select="substring-after(calendar/path,$userPath)"/>
970               </xsl:when>
971               <xsl:otherwise>
972                 <xsl:value-of select="calendar/path"/>
973               </xsl:otherwise>
974             </xsl:choose><br/>
975           Type:
976           <xsl:choose>
977             <xsl:when test="isAnnotation">
978               public event
979             </xsl:when>
980             <xsl:when test="calendar/owner = /bedework/userid">
981               personal event, editable
982             </xsl:when>
983             <xsl:otherwise>
984               subscription
985             </xsl:otherwise>
986           </xsl:choose>
987         </span>
988       </a>
989     </li>
990   </xsl:template>
991
992   <!--==== YEAR VIEW ====-->
993   <xsl:template name="yearView">
994     <table id="yearCalendarTable" border="0" cellpadding="0" cellspacing="0">
995       <tr>
996         <xsl:apply-templates select="/bedework/eventscalendar/year/month[position() &lt;= 3]"/>
997       </tr>
998       <tr>
999         <xsl:apply-templates select="/bedework/eventscalendar/year/month[(position() &gt; 3) and (position() &lt;= 6)]"/>
1000       </tr>
1001       <tr>
1002         <xsl:apply-templates select="/bedework/eventscalendar/year/month[(position() &gt; 6) and (position() &lt;= 9)]"/>
1003       </tr>
1004       <tr>
1005         <xsl:apply-templates select="/bedework/eventscalendar/year/month[position() &gt; 9]"/>
1006       </tr>
1007     </table>
1008   </xsl:template>
1009
1010   <!-- year view month tables -->
1011   <xsl:template match="month">
1012     <td>
1013       <table class="yearViewMonthTable" border="0" cellpadding="0" cellspacing="0">
1014         <tr>
1015           <td colspan="8" class="monthName">
1016             <xsl:variable name="firstDayOfMonth" select="week/day/date"/>
1017             <a href="{$setViewPeriod}?viewType=monthView&amp;date={$firstDayOfMonth}">
1018               <xsl:value-of select="longname"/>
1019             </a>
1020           </td>
1021         </tr>
1022         <tr>
1023           <th>&#160;</th>
1024           <xsl:for-each select="/bedework/shortdaynames/val">
1025             <th><xsl:value-of select="."/></th>
1026           </xsl:for-each>
1027         </tr>
1028         <xsl:for-each select="week">
1029           <tr>
1030             <td class="weekCell">
1031               <xsl:variable name="firstDayOfWeek" select="day/date"/>
1032               <a href="{$setViewPeriod}?viewType=weekView&amp;date={$firstDayOfWeek}">
1033                 <xsl:value-of select="value"/>
1034               </a>
1035             </td>
1036             <xsl:for-each select="day">
1037               <xsl:choose>
1038                 <xsl:when test="filler='true'">
1039                   <td class="filler">&#160;</td>
1040                 </xsl:when>
1041                 <xsl:otherwise>
1042                   <td>
1043                     <xsl:variable name="dayDate" select="date"/>
1044                     <a href="{$setViewPeriod}?viewType=dayView&amp;date={$dayDate}">
1045                       <xsl:value-of select="value"/>
1046                     </a>
1047                   </td>
1048                 </xsl:otherwise>
1049               </xsl:choose>
1050             </xsl:for-each>
1051           </tr>
1052         </xsl:for-each>
1053       </table>
1054     </td>
1055   </xsl:template>
1056
1057   <!--==== SINGLE EVENT ====-->
1058   <xsl:template match="event">
1059     <xsl:variable name="subscriptionId" select="subscription/id"/>
1060     <xsl:variable name="calPath" select="calendar/encodedPath"/>
1061     <xsl:variable name="guid" select="guid"/>
1062     <xsl:variable name="recurrenceId" select="recurrenceId"/>
1063     <h2>
1064       <xsl:choose>
1065         <xsl:when test="link != ''">
1066           <xsl:variable name="link" select="link"/>
1067           <a href="{$link}">
1068             <xsl:value-of select="summary"/>
1069           </a>
1070         </xsl:when>
1071         <xsl:otherwise>
1072           <xsl:value-of select="summary"/>
1073         </xsl:otherwise>
1074       </xsl:choose>
1075     </h2>
1076     <table class="common" cellspacing="0">
1077       <tr>
1078         <th colspan="2" class="commonHeader">
1079           <div id="eventActions">
1080             <xsl:variable name="eventIcalName" select="concat($guid,'.ics')"/>
1081             <a href="{$export}?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">
1082               <img src="{$resourcesRoot}/resources/std-ical_iconDkGray.gif" width="12" height="13" border="0" alt="Download event as ical - for Outlook, PDAs, iCal, and other desktop calendars"/>
1083               Download
1084             </a> |
1085             <xsl:choose>
1086               <xsl:when test="isAnnotation">
1087                 <xsl:choose>
1088                   <xsl:when test="recurring=true">
1089                     <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;confirmationid={$confId}">
1090                       <img src="{$resourcesRoot}/resources/trashIcon.gif" width="13" height="13" border="0" alt="delete"/>
1091                       Remove All (recurring)
1092                     </a>
1093                   </xsl:when>
1094                   <xsl:otherwise>
1095                     <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1096                       <img src="{$resourcesRoot}/resources/trashIcon.gif" width="13" height="13" border="0" alt="delete"/>
1097                       Remove
1098                     </a>
1099                   </xsl:otherwise>
1100                 </xsl:choose>
1101               </xsl:when>
1102               <xsl:when test="calendar/owner = /bedework/userid">
1103                 <a href="{$editEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1104                   <img src="{$resourcesRoot}/resources/std-ical_iconEditDkGray.gif" width="12" height="13" border="0" alt="edit"/>
1105                   Edit
1106                 </a> |
1107                 <xsl:choose>
1108                   <xsl:when test="recurring=true">
1109                     <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;confirmationid={$confId}">
1110                       <img src="{$resourcesRoot}/resources/trashIcon.gif" width="13" height="13" border="0" alt="delete"/>
1111                       Delete All (recurring)
1112                     </a>
1113                   </xsl:when>
1114                   <xsl:otherwise>
1115                     <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1116                       <img src="{$resourcesRoot}/resources/trashIcon.gif" width="13" height="13" border="0" alt="delete"/>
1117                       Delete
1118                     </a>
1119                   </xsl:otherwise>
1120                 </xsl:choose>
1121               </xsl:when>
1122               <xsl:otherwise>
1123                 <a href="{$subscriptions-fetch}">
1124                   <img src="{$resourcesRoot}/resources/std-ical_iconSubsDkGray.gif" width="12" height="13" border="0" alt="edit"/>
1125                   Manage Subscriptions
1126                 </a>
1127               </xsl:otherwise>
1128             </xsl:choose>
1129           </div>
1130           <xsl:choose>
1131             <xsl:when test="isAnnotation">
1132               Public Event
1133             </xsl:when>
1134             <xsl:when test="calendar/owner = /bedework/userid">
1135               Personal Event
1136             </xsl:when>
1137             <xsl:otherwise>
1138               Public Event from Subscription
1139             </xsl:otherwise>
1140           </xsl:choose>
1141         </th>
1142       </tr>
1143       <tr>
1144         <td class="fieldname">When:</td>
1145         <td class="fieldval">
1146           <!-- was using abbrev dayname: substring(start/dayname,1,3) -->
1147           <xsl:value-of select="start/dayname"/>, <xsl:value-of select="start/longdate"/><xsl:text> </xsl:text>
1148           <span class="time"><xsl:value-of select="start/time"/></span>
1149           <xsl:if test="end/time != '' or end/longdate != start/longdate"> - </xsl:if>
1150           <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>
1151           <xsl:if test="end/time != ''"><span class="time"><xsl:value-of select="end/time"/></span></xsl:if>
1152         </td>
1153         <!--<th class="icon" rowspan="2">
1154           <xsl:variable name="eventIcalName" select="concat($guid,'.ics')"/>
1155           <a href="{$export}?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">
1156             <img src="{$resourcesRoot}/resources/std-ical-icon.gif" width="20" height="26" border="0" align="left" alt="Download this event"/>
1157           </a>
1158         </th>-->
1159       </tr>
1160       <tr>
1161         <td class="fieldname">Where:</td>
1162         <td class="fieldval">
1163           <xsl:choose>
1164             <xsl:when test="location/link=''">
1165               <xsl:value-of select="location/address"/>
1166             </xsl:when>
1167             <xsl:otherwise>
1168               <xsl:variable name="locationLink" select="location/link"/>
1169               <a href="{$locationLink}">
1170                 <xsl:value-of select="location/address"/>
1171               </a>
1172             </xsl:otherwise>
1173           </xsl:choose>
1174           <xsl:if test="location/subaddress!=''">
1175             <br/><xsl:value-of select="location/subaddress"/>
1176           </xsl:if>
1177         </td>
1178       </tr>
1179       <tr>
1180         <td class="fieldname">Description:</td>
1181         <td class="fieldval">
1182           <xsl:call-template name="replace">
1183             <xsl:with-param name="string" select="description"/>
1184             <xsl:with-param name="pattern" select="'&#xA;'"/>
1185             <xsl:with-param name="replacement"><br/></xsl:with-param>
1186           </xsl:call-template>
1187         </td>
1188       </tr>
1189       <xsl:if test="organizer">
1190         <tr>
1191           <td class="fieldname">Organizer:</td>
1192           <xsl:variable name="organizerUri" select="organizer/organizerUri"/>
1193           <td class="fieldval">
1194             <strong>
1195               <a href="{$organizerUri}">
1196                 <xsl:value-of select="organizer/cn"/>
1197               </a>
1198             </strong>
1199           </td>
1200         </tr>
1201       </xsl:if>
1202       <xsl:if test="attendee">
1203         <tr>
1204           <td class="fieldname">Attendees:</td>
1205           <td class="fieldval">
1206             <table id="attendees" cellspacing="0">
1207               <tr>
1208                 <th>role</th>
1209                 <th>status</th>
1210                 <th>attendee</th>
1211               </tr>
1212               <xsl:for-each select="attendee">
1213                 <xsl:sort select="cn" order="ascending" case-order="upper-first"/>
1214                 <tr>
1215                   <td class="role">
1216                     <xsl:value-of select="role"/>
1217                   </td>
1218                   <td class="status">
1219                     <xsl:value-of select="partstat"/>
1220                   </td>
1221                   <td>
1222                     <xsl:variable name="attendeeUri" select="attendeeUri"/>
1223                     <a href="{$attendeeUri}"><xsl:value-of select="cn"/></a>
1224                   </td>
1225                 </tr>
1226               </xsl:for-each>
1227             </table>
1228           </td>
1229         </tr>
1230       </xsl:if>
1231       <xsl:if test="cost!=''">
1232         <tr>
1233           <td class="fieldname">Cost:</td>
1234           <td class="fieldval"><xsl:value-of select="cost"/></td>
1235         </tr>
1236       </xsl:if>
1237       <xsl:if test="link != ''">
1238         <tr>
1239           <td class="fieldname">See:</td>
1240           <td class="fieldval">
1241             <xsl:variable name="link" select="link"/>
1242             <a href="{$link}"><xsl:value-of select="link"/></a>
1243           </td>
1244         </tr>
1245       </xsl:if>
1246       <xsl:if test="sponsor/name!='none'">
1247         <tr>
1248           <td class="fieldname">Contact:</td>
1249           <td class="fieldval">
1250             <xsl:choose>
1251               <xsl:when test="sponsor/link=''">
1252                 <xsl:value-of select="sponsor/name"/>
1253               </xsl:when>
1254               <xsl:otherwise>
1255                 <xsl:variable name="sponsorLink" select="sponsor/link"/>
1256                 <a href="{$sponsorLink}">
1257                   <xsl:value-of select="sponsor/name"/>
1258                 </a>
1259               </xsl:otherwise>
1260             </xsl:choose>
1261             <xsl:if test="sponsor/phone!=''">
1262               <br /><xsl:value-of select="sponsor/phone"/>
1263             </xsl:if>
1264             <xsl:if test="sponsor/email!=''">
1265               <br />
1266               <xsl:variable name="email" select="sponsor/email"/>
1267               <xsl:variable name="subject" select="summary"/>
1268               <a href="mailto:{$email}?subject={$subject}">
1269                 <xsl:value-of select="sponsor/email"/>
1270               </a>
1271             </xsl:if>
1272           </td>
1273         </tr>
1274       </xsl:if>
1275       <xsl:if test="calendar/path!=''">
1276         <tr>
1277           <td class="fieldname">Calendar:</td>
1278           <td class="fieldval">
1279             <xsl:variable name="calUrl" select="calendar/encodedPath"/>
1280             <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
1281             <a href="{$setSelection}?calUrl={$calUrl}">
1282               <xsl:choose>
1283                 <xsl:when test="contains(calendar/path,$userPath)">
1284                   <xsl:value-of select="substring-after(calendar/path,$userPath)"/>
1285                 </xsl:when>
1286                 <xsl:otherwise>
1287                   <xsl:value-of select="calendar/path"/>
1288                 </xsl:otherwise>
1289               </xsl:choose>
1290             </a>
1291           </td>
1292         </tr>
1293       </xsl:if>
1294       <tr>
1295         <td class="fieldname filler">&#160;</td>
1296         <td class="fieldval">&#160;</td>
1297       </tr>
1298     </table>
1299   </xsl:template>
1300
1301  <!--==== ADD EVENT ====-->
1302   <xsl:template name="addEvent">
1303   <!-- The name "eventForm" is referenced by several javascript functions. Do not
1304     change it without modifying includes.js -->
1305     <form name="eventForm" method="post" action="{$addEventUsingPage}" id="standardForm">
1306       <input type="hidden" name="confirmationid" value="{$confId}"/>
1307       <input type="hidden" name="endType" value="date"/>
1308       <h2>Add Event</h2>
1309       <table class="common" cellspacing="0">
1310         <tr>
1311           <td class="fieldname">
1312             Title:
1313           </td>
1314           <td class="fieldval">
1315             <xsl:variable name="title" select="/bedework/formElements/form/title/input/@value"/>
1316             <input type="text" name="newEvent.summary" size="80" value="{$title}"/>
1317           </td>
1318         </tr>
1319         <tr>
1320           <td class="fieldname">
1321             Calendar:
1322           </td>
1323           <td class="fieldval">
1324             <xsl:variable name="newCalPath" select="/bedework/formElements/form/calendar/path"/>
1325             <input type="hidden" name="newCalPath" value="{$newCalPath}"/>
1326             <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
1327             <span id="bwEventCalDisplay">
1328               <xsl:choose>
1329                 <xsl:when test="contains(/bedework/formElements/form/calendar/path,$userPath)">
1330                   <xsl:value-of select="substring-after(/bedework/formElements/form/calendar/path,$userPath)"/>
1331                 </xsl:when>
1332                 <xsl:otherwise>
1333                   <xsl:value-of select="/bedework/formElements/form/calendar/path"/>
1334                 </xsl:otherwise>
1335               </xsl:choose>
1336             </span>
1337             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
1338           </td>
1339         </tr>
1340         <tr>
1341           <td class="fieldname">
1342             Date &amp; Time:
1343           </td>
1344           <td class="fieldval">
1345             <!-- Set the timefields class for the first load of the page;
1346                  subsequent changes will take place using javascript without a
1347                  page reload. -->
1348             <xsl:variable name="timeFieldsClass">
1349               <xsl:choose>
1350                 <xsl:when test="/bedework/formElements/form/allDay/input/@checked='checked'">invisible</xsl:when>
1351                 <xsl:otherwise>timeFields</xsl:otherwise>
1352               </xsl:choose>
1353             </xsl:variable>
1354             <xsl:choose>
1355               <xsl:when test="/bedework/formElements/form/allDay/input/@checked='checked'">
1356                 <input type="checkbox" name="allDayFlag" onclick="swapAllDayEvent(this)" value="on" checked="checked"/>
1357                 <input type="hidden" name="eventStartDate.dateOnly" value="on" id="allDayStartDateField"/>
1358                 <input type="hidden" name="eventEndDate.dateOnly" value="on" id="allDayEndDateField"/>
1359               </xsl:when>
1360               <xsl:otherwise>
1361                 <input type="checkbox" name="allDayFlag" onclick="swapAllDayEvent(this)" value="off"/>
1362                 <input type="hidden" name="eventStartDate.dateOnly" value="off" id="allDayStartDateField"/>
1363                 <input type="hidden" name="eventEndDate.dateOnly" value="off" id="allDayEndDateField"/>
1364               </xsl:otherwise>
1365             </xsl:choose>
1366             all day event<br/>
1367             <div class="dateStartEndBox">
1368               <strong>Start:</strong>
1369               <div class="dateFields">
1370                 <span class="startDateLabel">Date </span>
1371                 <xsl:copy-of select="/bedework/formElements/form/start/month/*"/>
1372                 <xsl:copy-of select="/bedework/formElements/form/start/day/*"/>
1373                 <xsl:choose>
1374                   <xsl:when test="/bedework/creating = 'true'">
1375                     <xsl:copy-of select="/bedework/formElements/form/start/year/*"/>
1376                   </xsl:when>
1377                   <xsl:otherwise>
1378                     <xsl:copy-of select="/bedework/formElements/form/start/yearText/*"/>
1379                   </xsl:otherwise>
1380                 </xsl:choose>
1381               </div>
1382               <script language="JavaScript" type="text/javascript">
1383               <xsl:comment>
1384                 startDateDynCalWidget = new dynCalendar('startDateDynCalWidget', <xsl:value-of select="number(/bedework/formElements/form/start/yearText/input/@value)"/>, <xsl:value-of select="number(/bedework/formElements/form/start/month/select/option[@selected='selected']/@value)-1"/>, <xsl:value-of select="number(/bedework/formElements/form/start/day/select/option[@selected='selected']/@value)"/>, 'startDateCalWidgetCallback');
1385               </xsl:comment>
1386               </script>
1387               <!--<img src="{$resourcesRoot}/resources/calIcon.gif" width="16" height="15" border="0"/>-->
1388               <div class="{$timeFieldsClass}" id="startTimeFields">
1389                 <span id="calWidgetStartTimeHider" class="show">
1390                   <xsl:copy-of select="/bedework/formElements/form/start/hour/*"/>
1391                   <xsl:copy-of select="/bedework/formElements/form/start/minute/*"/>
1392                   <xsl:if test="/bedework/formElements/form/start/ampm">
1393                     <xsl:copy-of select="/bedework/formElements/form/start/ampm/*"/>
1394                   </xsl:if>
1395                   <xsl:text> </xsl:text>
1396                   <a href="javascript:bwClockLaunch('eventStartDate');"><img src="{$resourcesRoot}/resources/clockIcon.gif" width="16" height="15" border="0"/></a>
1397                 </span>
1398               </div>
1399             </div>
1400             <div class="dateStartEndBox">
1401               <strong>End:</strong>
1402               <xsl:choose>
1403                 <xsl:when test="/bedework/formElements/form/end/type='E'">
1404                   <input type="radio" name="eventEndType" value="E" checked="checked" onClick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/>
1405                 </xsl:when>
1406                 <xsl:otherwise>
1407                   <input type="radio" name="eventEndType" value="E" onClick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/>
1408                 </xsl:otherwise>
1409               </xsl:choose>
1410               Date
1411               <xsl:variable name="endDateTimeClass">
1412                 <xsl:choose>
1413                   <xsl:when test="/bedework/formElements/form/end/type='E'">shown</xsl:when>
1414                   <xsl:otherwise>invisible</xsl:otherwise>
1415                 </xsl:choose>
1416               </xsl:variable>
1417               <div class="{$endDateTimeClass}" id="endDateTime">
1418                 <div class="dateFields">
1419                   <xsl:copy-of select="/bedework/formElements/form/end/dateTime/month/*"/>
1420                   <xsl:copy-of select="/bedework/formElements/form/end/dateTime/day/*"/>
1421                   <xsl:choose>
1422                     <xsl:when test="/bedework/creating = 'true'">
1423                       <xsl:copy-of select="/bedework/formElements/form/end/dateTime/year/*"/>
1424                     </xsl:when>
1425                     <xsl:otherwise>
1426                       <xsl:copy-of select="/bedework/formElements/form/end/dateTime/yearText/*"/>
1427                     </xsl:otherwise>
1428                   </xsl:choose>
1429                 </div>
1430                 <script language="JavaScript" type="text/javascript">
1431                 <xsl:comment>
1432                   endDateDynCalWidget = new dynCalendar('endDateDynCalWidget', <xsl:value-of select="number(/bedework/formElements/form/start/yearText/input/@value)"/>, <xsl:value-of select="number(/bedework/formElements/form/start/month/select/option[@selected='selected']/@value)-1"/>, <xsl:value-of select="number(/bedework/formElements/form/start/day/select/option[@selected='selected']/@value)"/>, 'endDateCalWidgetCallback');
1433                 </xsl:comment>
1434                 </script>
1435                 <!--<img src="{$resourcesRoot}/resources/calIcon.gif" width="16" height="15" border="0"/>-->
1436                 <div class="{$timeFieldsClass}" id="endTimeFields">
1437                   <span id="calWidgetEndTimeHider" class="show">
1438                     <xsl:copy-of select="/bedework/formElements/form/end/dateTime/hour/*"/>
1439                     <xsl:copy-of select="/bedework/formElements/form/end/dateTime/minute/*"/>
1440                     <xsl:if test="/bedework/formElements/form/end/dateTime/ampm">
1441                       <xsl:copy-of select="/bedework/formElements/form/end/dateTime/ampm/*"/>
1442                     </xsl:if>
1443                     <xsl:text> </xsl:text>
1444                     <a href="javascript:bwClockLaunch('eventEndDate');"><img src="{$resourcesRoot}/resources/clockIcon.gif" width="16" height="15" border="0"/></a>
1445                   </span>
1446                 </div>
1447               </div><br/>
1448               <div id="clock" class="invisible">
1449                 <xsl:call-template name="clock"/>
1450               </div>
1451               <div class="dateFields">
1452                 <xsl:choose>
1453                   <xsl:when test="/bedework/formElements/form/end/type='D'">
1454                     <input type="radio" name="eventEndType" value="D" checked="checked" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/>
1455                   </xsl:when>
1456                   <xsl:otherwise>
1457                     <input type="radio" name="eventEndType" value="D" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/>
1458                   </xsl:otherwise>
1459                 </xsl:choose>
1460                 Duration
1461                 <xsl:variable name="endDurationClass">
1462                   <xsl:choose>
1463                     <xsl:when test="/bedework/formElements/form/end/type='D'">shown</xsl:when>
1464                     <xsl:otherwise>invisible</xsl:otherwise>
1465                   </xsl:choose>
1466                 </xsl:variable>
1467                 <xsl:variable name="durationHrMinClass">
1468                   <xsl:choose>
1469                     <xsl:when test="/bedework/formElements/form/allDay/input/@checked='checked'">invisible</xsl:when>
1470                     <xsl:otherwise>shown</xsl:otherwise>
1471                   </xsl:choose>
1472                 </xsl:variable>
1473                 <div class="{$endDurationClass}" id="endDuration">
1474                   <xsl:choose>
1475                     <xsl:when test="/bedework/formElements/form/end/duration/weeks/input/@value = '0'">
1476                     <!-- we are using day, hour, minute format -->
1477                     <!-- must send either no week value or week value of 0 (zero) -->
1478                       <div class="durationBox">
1479                         <input type="radio" name="eventDuration.type" value="daytime" onclick="swapDurationType('daytime')" checked="checked"/>
1480                         <xsl:variable name="daysStr" select="/bedework/formElements/form/end/duration/days/input/@value"/>
1481                         <input type="text" name="eventDuration.daysStr" size="2" value="{$daysStr}" id="durationDays"/>days
1482                         <span id="durationHrMin" class="{$durationHrMinClass}">
1483                           <xsl:variable name="hoursStr" select="/bedework/formElements/form/end/duration/hours/input/@value"/>
1484                           <input type="text" name="eventDuration.hoursStr" size="2" value="{$hoursStr}" id="durationHours"/>hours
1485                           <xsl:variable name="minutesStr" select="/bedework/formElements/form/end/duration/minutes/input/@value"/>
1486                           <input type="text" name="eventDuration.minutesStr" size="2" value="{$minutesStr}" id="durationMinutes"/>minutes
1487                         </span>
1488                       </div>
1489                       <span class="durationSpacerText">or</span>
1490                       <div class="durationBox">
1491                         <input type="radio" name="eventDuration.type" value="weeks" onclick="swapDurationType('week')"/>
1492                         <xsl:variable name="weeksStr" select="/bedework/formElements/form/end/duration/weeks/input/@value"/>
1493                         <input type="text" name="eventDuration.weeksStr" size="2" value="{$weeksStr}" id="durationWeeks" disabled="true"/>weeks
1494                       </div>
1495                     </xsl:when>
1496                     <xsl:otherwise>
1497                       <!-- we are using week format -->
1498                       <div class="durationBox">
1499                         <input type="radio" name="eventDuration.type" value="daytime" onclick="swapDurationType('daytime')"/>
1500                         <xsl:variable name="daysStr" select="/bedework/formElements/form/end/duration/days/input/@value"/>
1501                         <input type="text" name="eventDuration.daysStr" size="2" value="{$daysStr}" id="durationDays" disabled="true"/>days
1502                         <span id="durationHrMin" class="{$durationHrMinClass}">
1503                           <xsl:variable name="hoursStr" select="/bedework/formElements/form/end/duration/hours/input/@value"/>
1504                           <input type="text" name="eventDuration.hoursStr" size="2" value="{$hoursStr}" id="durationHours" disabled="true"/>hours
1505                           <xsl:variable name="minutesStr" select="/bedework/formElements/form/end/duration/minutes/input/@value"/>
1506                           <input type="text" name="eventDuration.minutesStr" size="2" value="{$minutesStr}" id="durationMinutes" disabled="true"/>minutes
1507                         </span>
1508                       </div>
1509                       <span class="durationSpacerText">or</span>
1510                       <div class="durationBox">
1511                         <input type="radio" name="eventDuration.type" value="weeks" onclick="swapDurationType('week')" checked="checked"/>
1512                         <xsl:variable name="weeksStr" select="/bedework/formElements/form/end/duration/weeks/input/@value"/>
1513                         <input type="text" name="eventDuration.weeksStr" size="2" value="{$weeksStr}" id="durationWeeks"/>weeks
1514                       </div>
1515                     </xsl:otherwise>
1516                   </xsl:choose>
1517                 </div>
1518               </div><br/>
1519               <div class="dateFields" id="noDuration">
1520                 <xsl:choose>
1521                   <xsl:when test="/bedework/formElements/form/end/type='N'">
1522                     <input type="radio" name="eventEndType" value="N" checked="checked" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/>
1523                   </xsl:when>
1524                   <xsl:otherwise>
1525                     <input type="radio" name="eventEndType" value="N" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/>
1526                   </xsl:otherwise>
1527                 </xsl:choose>
1528                 This event has no duration / end date
1529               </div>
1530             </div>
1531           </td>
1532         </tr>
1533         <!--  Status  -->
1534         <tr>
1535           <td class="fieldname">
1536             Status:
1537           </td>
1538           <td class="fieldval">
1539             <xsl:choose>
1540               <xsl:when test="/bedework/formElements/form/status = 'TENTATIVE'">
1541                 <input type="radio" name="event.status" value="CONFIRMED"/>confirmed <input type="radio" name="event.status" value="TENTATIVE" checked="checked"/>tentative <input type="radio" name="event.status" value="CANCELLED"/>cancelled
1542               </xsl:when>
1543               <xsl:when test="/bedework/formElements/form/status = 'CANCELLED'">
1544                 <input type="radio" name="event.status" value="CONFIRMED"/>confirmed <input type="radio" name="event.status" value="TENTATIVE"/>tentative <input type="radio" name="event.status" value="CANCELLED" checked="checked"/>cancelled
1545               </xsl:when>
1546               <xsl:otherwise>
1547                 <input type="radio" name="event.status" value="CONFIRMED" checked="checked"/>confirmed <input type="radio" name="event.status" value="TENTATIVE"/>tentative <input type="radio" name="event.status" value="CANCELLED"/>cancelled
1548               </xsl:otherwise>
1549             </xsl:choose>
1550           </td>
1551         </tr>
1552         <!--  Transparency  -->
1553         <tr>
1554           <td class="fieldname">
1555             Effects free/busy:
1556           </td>
1557           <td class="fieldval">
1558             <input type="radio" name="editEvent.transparency" value="OPAQUE" checked="checked"/>yes <input type="radio" name="editEvent.transparency" value="TRANSPARENT"/>no
1559           </td>
1560         </tr>
1561         <!--  Description  -->
1562         <tr>
1563           <td class="fieldname">Description:</td>
1564           <td class="fieldval">
1565             <textarea name="newEvent.description" cols="60" rows="4">
1566               <xsl:value-of select="/bedework/formElements/form/desc/textarea"/>
1567             </textarea>
1568           </td>
1569         </tr>
1570         <tr>
1571           <td class="fieldname">Location:</td>
1572           <td class="fieldval" align="left">
1573             <span class="std-text">choose: </span>
1574             <span id="eventFormLocationList">
1575               <select name="locationId">
1576                 <option value="-1">select...</option>
1577                 <xsl:copy-of select="/bedework/formElements/form/location/locationmenu/select/*"/>
1578               </select>
1579             </span>
1580             <span class="std-text"> or add new: </span>
1581             <input type="text" name="newLocation.address" value="" />
1582           </td>
1583         </tr>
1584         <tr>
1585           <td class="fieldname">Event Link:</td>
1586           <td class="fieldval">
1587             <xsl:variable name="link" select="/bedework/formElements/form/link/input/@value"/>
1588             <input type="text" name="newEvent.link" size="80" value="{$link}"/>
1589           </td>
1590         </tr>
1591         <tr>
1592           <td class="fieldname">&#160;</td>
1593           <td class="fieldval">
1594             <input name="submit" type="submit" value="Submit Event"/>&#160;
1595             <input name="cancelled" type="submit" value="Cancel"/>
1596           </td>
1597         </tr>
1598       </table>
1599     </form>
1600   </xsl:template>
1601
1602   <xsl:template name="clock">
1603     <div id="bwClock">
1604       <!-- Bedework 24-Hour Clock time selection widget
1605            used with resources/bwClock.js and resources/bwClock.css -->
1606       <div id="bwClockClock">
1607         <img id="clockMap" src="{$resourcesRoot}/resources/clockMap.gif" width="368" height="368" border="0" alt="" usemap="#bwClockMap" />
1608       </div>
1609       <div id="bwClockCover">
1610         <!-- this is a special effect div used simply to cover the pixelated edge
1611              where the clock meets the clock box title -->
1612       </div>
1613       <div id="bwClockBox">
1614         <h2>
1615           Bedework 24-Hour Clock
1616         </h2>
1617         <div id="bwClockDateTypeIndicator">
1618           type
1619         </div>
1620         <div id="bwClockTime">
1621           select time
1622         </div>
1623         <div id="bwClockCloseText">
1624           close
1625         </div>
1626         <div id="bwClockCloseButton">
1627           <a href="javascript:bwClockClose();">X</a>
1628         </div>
1629       </div>
1630       <map name="bwClockMap" id="bwClockMap">
1631         <area shape="rect" alt="close clock" title="close clock" coords="160,167, 200,200" href="javascript:bwClockClose()"/>
1632         <area shape="poly" alt="minute 00:55" title="minute 00:55" coords="156,164, 169,155, 156,107, 123,128" href="javascript:bwClockUpdateDateTimeForm('minute','55')" />
1633         <area shape="poly" alt="minute 00:50" title="minute 00:50" coords="150,175, 156,164, 123,128, 103,161" href="javascript:bwClockUpdateDateTimeForm('minute','50')" />
1634         <area shape="poly" alt="minute 00:45" title="minute 00:45" coords="150,191, 150,175, 103,161, 103,206" href="javascript:bwClockUpdateDateTimeForm('minute','45')" />
1635         <area shape="poly" alt="minute 00:40" title="minute 00:40" coords="158,208, 150,191, 105,206, 123,237" href="javascript:bwClockUpdateDateTimeForm('minute','40')" />
1636         <area shape="poly" alt="minute 00:35" title="minute 00:35" coords="171,218, 158,208, 123,238, 158,261" href="javascript:bwClockUpdateDateTimeForm('minute','35')" />
1637         <area shape="poly" alt="minute 00:30" title="minute 00:30" coords="193,218, 172,218, 158,263, 209,263" href="javascript:bwClockUpdateDateTimeForm('minute','30')" />
1638         <area shape="poly" alt="minute 00:25" title="minute 00:25" coords="209,210, 193,218, 209,261, 241,240" href="javascript:bwClockUpdateDateTimeForm('minute','25')" />
1639         <area shape="poly" alt="minute 00:20" title="minute 00:20" coords="216,196, 209,210, 241,240, 261,206" href="javascript:bwClockUpdateDateTimeForm('minute','20')" />
1640         <area shape="poly" alt="minute 00:15" title="minute 00:15" coords="216,178, 216,196, 261,206, 261,159" href="javascript:bwClockUpdateDateTimeForm('minute','15')" />
1641         <area shape="poly" alt="minute 00:10" title="minute 00:10" coords="209,164, 216,178, 261,159, 240,126" href="javascript:bwClockUpdateDateTimeForm('minute','10')" />
1642         <area shape="poly" alt="minute 00:05" title="minute 00:05" coords="196,155, 209,164, 238,126, 206,107" href="javascript:bwClockUpdateDateTimeForm('minute','05')" />
1643         <area shape="poly" alt="minute 00:00" title="minute 00:00" coords="169,155, 196,155, 206,105, 156,105" href="javascript:bwClockUpdateDateTimeForm('minute','00')" />
1644         <area shape="poly" alt="11 PM, 2300 hour" title="11 PM, 2300 hour" coords="150,102, 172,96, 158,1, 114,14" href="javascript:bwClockUpdateDateTimeForm('hour','23')" />
1645         <area shape="poly" alt="10 PM, 2200 hour" title="10 PM, 2200 hour" coords="131,114, 150,102, 114,14, 74,36" href="javascript:bwClockUpdateDateTimeForm('hour','22')" />
1646         <area shape="poly" alt="9 PM, 2100 hour" title="9 PM, 2100 hour" coords="111,132, 131,114, 74,36, 40,69" href="javascript:bwClockUpdateDateTimeForm('hour','21')" />
1647         <area shape="poly" alt="8 PM, 2000 hour" title="8 PM, 2000 hour" coords="101,149, 111,132, 40,69, 15,113" href="javascript:bwClockUpdateDateTimeForm('hour','20')" />
1648         <area shape="poly" alt="7 PM, 1900 hour" title="7 PM, 1900 hour" coords="95,170, 101,149, 15,113, 1,159" href="javascript:bwClockUpdateDateTimeForm('hour','19')" />
1649         <area shape="poly" alt="6 PM, 1800 hour" title="6 PM, 1800 hour" coords="95,196, 95,170, 0,159, 0,204" href="javascript:bwClockUpdateDateTimeForm('hour','18')" />
1650         <area shape="poly" alt="5 PM, 1700 hour" title="5 PM, 1700 hour" coords="103,225, 95,196, 1,205, 16,256" href="javascript:bwClockUpdateDateTimeForm('hour','17')" />
1651         <area shape="poly" alt="4 PM, 1600 hour" title="4 PM, 1600 hour" coords="116,245, 103,225, 16,256, 41,298" href="javascript:bwClockUpdateDateTimeForm('hour','16')" />
1652         <area shape="poly" alt="3 PM, 1500 hour" title="3 PM, 1500 hour" coords="134,259, 117,245, 41,298, 76,332" href="javascript:bwClockUpdateDateTimeForm('hour','15')" />
1653         <area shape="poly" alt="2 PM, 1400 hour" title="2 PM, 1400 hour" coords="150,268, 134,259, 76,333, 121,355" href="javascript:bwClockUpdateDateTimeForm('hour','14')" />
1654         <area shape="poly" alt="1 PM, 1300 hour" title="1 PM, 1300 hour" coords="169,273, 150,268, 120,356, 165,365" href="javascript:bwClockUpdateDateTimeForm('hour','13')" />
1655         <area shape="poly" alt="Noon, 1200 hour" title="Noon, 1200 hour" coords="193,273, 169,273, 165,365, 210,364" href="javascript:bwClockUpdateDateTimeForm('hour','12')" />
1656         <area shape="poly" alt="11 AM, 1100 hour" title="11 AM, 1100 hour" coords="214,270, 193,273, 210,363, 252,352" href="javascript:bwClockUpdateDateTimeForm('hour','11')" />
1657         <area shape="poly" alt="10 AM, 1000 hour" title="10 AM, 1000 hour" coords="232,259, 214,270, 252,352, 291,330" href="javascript:bwClockUpdateDateTimeForm('hour','10')" />
1658         <area shape="poly" alt="9 AM, 0900 hour" title="9 AM, 0900 hour" coords="251,240, 232,258, 291,330, 323,301" href="javascript:bwClockUpdateDateTimeForm('hour','09')" />
1659         <area shape="poly" alt="8 AM, 0800 hour" title="8 AM, 0800 hour" coords="263,219, 251,239, 323,301, 349,261" href="javascript:bwClockUpdateDateTimeForm('hour','08')" />
1660         <area shape="poly" alt="7 AM, 0700 hour" title="7 AM, 0700 hour" coords="269,194, 263,219, 349,261, 363,212" href="javascript:bwClockUpdateDateTimeForm('hour','07')" />
1661         <area shape="poly" alt="6 AM, 0600 hour" title="6 AM, 0600 hour" coords="269,172, 269,193, 363,212, 363,155" href="javascript:bwClockUpdateDateTimeForm('hour','06')" />
1662         <area shape="poly" alt="5 AM, 0500 hour" title="5 AM, 0500 hour" coords="263,150, 269,172, 363,155, 351,109" href="javascript:bwClockUpdateDateTimeForm('hour','05')" />
1663         <area shape="poly" alt="4 AM, 0400 hour" title="4 AM, 0400 hour" coords="251,130, 263,150, 351,109, 325,68" href="javascript:bwClockUpdateDateTimeForm('hour','04')" />
1664         <area shape="poly" alt="3 AM, 0300 hour" title="3 AM, 0300 hour" coords="234,112, 251,130, 325,67, 295,37" href="javascript:bwClockUpdateDateTimeForm('hour','03')" />
1665         <area shape="poly" alt="2 AM, 0200 hour" title="2 AM, 0200 hour" coords="221,102, 234,112, 295,37, 247,11" href="javascript:bwClockUpdateDateTimeForm('hour','02')" />
1666         <area shape="poly" alt="1 AM, 0100 hour" title="1 AM, 0100 hour" coords="196,96, 221,102, 247,10, 209,-1, 201,61, 206,64, 205,74, 199,75" href="javascript:bwClockUpdateDateTimeForm('hour','01')" />
1667         <area shape="poly" alt="Midnight, 0000 hour" title="Midnight, 0000 hour" coords="172,96, 169,74, 161,73, 161,65, 168,63, 158,-1, 209,-1, 201,61, 200,62, 206,64, 205,74, 198,75, 196,96, 183,95" href="javascript:bwClockUpdateDateTimeForm('hour','00')" />
1668       </map>
1669     </div>
1670   </xsl:template>
1671
1672   <!--==== EDIT EVENT ====-->
1673   <xsl:template match="formElements" mode="editEvent">
1674     <xsl:variable name="subscriptionId" select="subscriptionId"/>
1675     <xsl:variable name="calPathEncoded" select="form/calendar/encodedPath"/>
1676     <xsl:variable name="calPath" select="form/calendar/path"/>
1677     <xsl:variable name="guid" select="guid"/>
1678     <xsl:variable name="recurrenceId" select="recurrenceId"/>
1679     <!-- The name "eventForm" is referenced by several javascript functions. Do not
1680     change it without modifying includes.js -->
1681     <form name="eventForm" method="post" action="{$editEvent}" id="standardForm">
1682       <input type="hidden" name="updateEvent" value="true"/>
1683       <input type="hidden" name="confirmationid" value="{$confId}"/>
1684       <input type="hidden" name="endType" value="date"/>
1685       <h2>Edit Event</h2>
1686       <table class="common" cellspacing="0">
1687         <tr>
1688           <th colspan="2" class="commonHeader">
1689             <div id="eventActions">
1690               <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1691                 View
1692               </a> |
1693               <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPathEncoded}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1694                 Delete
1695               </a>
1696             </div>
1697             Personal Event
1698           </th>
1699         </tr>
1700         <tr>
1701           <td class="fieldname">
1702             Title:
1703           </td>
1704           <td class="fieldval">
1705             <xsl:variable name="title" select="form/title/input/@value"/>
1706             <input type="text" name="editEvent.summary" size="80" value="{$title}"/>
1707           </td>
1708         </tr>
1709         <tr>
1710           <td class="fieldname">
1711             Calendar:
1712           </td>
1713           <td class="fieldval">
1714             <xsl:variable name="newCalPath" select="/bedework/formElements/form/calendar/path"/>
1715             <input type="hidden" name="newCalPath" value="{$newCalPath}"/>
1716             <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
1717             <span id="bwEventCalDisplay">
1718               <xsl:choose>
1719                 <xsl:when test="contains(/bedework/formElements/form/calendar/path,$userPath)">
1720                   <xsl:value-of select="substring-after(/bedework/formElements/form/calendar/path,$userPath)"/>
1721                 </xsl:when>
1722                 <xsl:otherwise>
1723                   <xsl:value-of select="/bedework/formElements/form/calendar/path"/>
1724                 </xsl:otherwise>
1725               </xsl:choose>
1726             </span>
1727             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
1728           </td>
1729         </tr>
1730         <tr>
1731           <td class="fieldname">
1732             Date &amp; Time:
1733           </td>
1734           <td class="fieldval">
1735             <!-- Set the timefields class for the first load of the page;
1736                  subsequent changes will take place using javascript without a
1737                  page reload. -->
1738             <xsl:variable name="timeFieldsClass">
1739               <xsl:choose>
1740                 <xsl:when test="form/allDay/input/@checked='checked'">invisible</xsl:when>
1741                 <xsl:otherwise>timeFields</xsl:otherwise>
1742               </xsl:choose>
1743             </xsl:variable>
1744             <xsl:choose>
1745               <xsl:when test="form/allDay/input/@checked='checked'">
1746                 <input type="checkbox" name="allDayFlag" onclick="swapAllDayEvent(this)" value="on" checked="checked"/>
1747                 <input type="hidden" name="eventStartDate.dateOnly" value="on" id="allDayStartDateField"/>
1748                 <input type="hidden" name="eventEndDate.dateOnly" value="on" id="allDayEndDateField"/>
1749               </xsl:when>
1750               <xsl:otherwise>
1751                 <input type="checkbox" name="allDayFlag" onclick="swapAllDayEvent(this)" value="off"/>
1752                 <input type="hidden" name="eventStartDate.dateOnly" value="off" id="allDayStartDateField"/>
1753                 <input type="hidden" name="eventEndDate.dateOnly" value="off" id="allDayEndDateField"/>
1754               </xsl:otherwise>
1755             </xsl:choose>
1756             all day event<br/>
1757             <div class="dateStartEndBox">
1758               <strong>Start:</strong>
1759               <div class="dateFields">
1760                 <span class="startDateLabel">Date </span>
1761                 <xsl:copy-of select="form/start/month/*"/>
1762                 <xsl:copy-of select="form/start/day/*"/>
1763                 <xsl:choose>
1764                   <xsl:when test="/bedework/creating = 'true'">
1765                     <xsl:copy-of select="form/start/year/*"/>
1766                   </xsl:when>
1767                   <xsl:otherwise>
1768                     <xsl:copy-of select="form/start/yearText/*"/>
1769                   </xsl:otherwise>
1770                 </xsl:choose>
1771               </div>
1772               <script language="JavaScript" type="text/javascript">
1773               <xsl:comment>
1774                 startDateDynCalWidget = new dynCalendar('startDateDynCalWidget', <xsl:value-of select="number(/bedework/formElements/form/start/yearText/input/@value)"/>, <xsl:value-of select="number(/bedework/formElements/form/start/month/select/option[@selected='selected']/@value)-1"/>, <xsl:value-of select="number(/bedework/formElements/form/start/day/select/option[@selected='selected']/@value)"/>, 'startDateCalWidgetCallback');
1775               </xsl:comment>
1776               </script>
1777               <!--<img src="{$resourcesRoot}/resources/calIcon.gif" width="16" height="15" border="0"/>-->
1778               <div class="{$timeFieldsClass}" id="startTimeFields">
1779                 <span id="calWidgetStartTimeHider" class="show">
1780                   <xsl:copy-of select="form/start/hour/*"/>
1781                   <xsl:copy-of select="form/start/minute/*"/>
1782                   <xsl:if test="form/start/ampm">
1783                     <xsl:copy-of select="form/start/ampm/*"/>
1784                   </xsl:if>
1785                   <xsl:text> </xsl:text>
1786                   <a href="javascript:bwClockLaunch('eventStartDate');"><img src="{$resourcesRoot}/resources/clockIcon.gif" width="16" height="15" border="0"/></a>
1787                 </span>
1788               </div>
1789             </div>
1790             <div class="dateStartEndBox">
1791               <strong>End:</strong>
1792               <xsl:choose>
1793                 <xsl:when test="form/end/type='E'">
1794                   <input type="radio" name="eventEndType" value="E" checked="checked" onClick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/>
1795                 </xsl:when>
1796                 <xsl:otherwise>
1797                   <input type="radio" name="eventEndType" value="E" onClick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/>
1798                 </xsl:otherwise>
1799               </xsl:choose>
1800               Date
1801               <xsl:variable name="endDateTimeClass">
1802                 <xsl:choose>
1803                   <xsl:when test="form/end/type='E'">shown</xsl:when>
1804                   <xsl:otherwise>invisible</xsl:otherwise>
1805                 </xsl:choose>
1806               </xsl:variable>
1807               <div class="{$endDateTimeClass}" id="endDateTime">
1808                 <div class="dateFields">
1809                   <xsl:copy-of select="form/end/dateTime/month/*"/>
1810                   <xsl:copy-of select="form/end/dateTime/day/*"/>
1811                   <xsl:choose>
1812                     <xsl:when test="/bedework/creating = 'true'">
1813                       <xsl:copy-of select="form/end/dateTime/year/*"/>
1814                     </xsl:when>
1815                     <xsl:otherwise>
1816                       <xsl:copy-of select="form/end/dateTime/yearText/*"/>
1817                     </xsl:otherwise>
1818                   </xsl:choose>
1819                 </div>
1820                 <script language="JavaScript" type="text/javascript">
1821                 <xsl:comment>
1822                   endDateDynCalWidget = new dynCalendar('endDateDynCalWidget', <xsl:value-of select="number(/bedework/formElements/form/start/yearText/input/@value)"/>, <xsl:value-of select="number(/bedework/formElements/form/start/month/select/option[@selected='selected']/@value)-1"/>, <xsl:value-of select="number(/bedework/formElements/form/start/day/select/option[@selected='selected']/@value)"/>, 'endDateCalWidgetCallback');
1823                 </xsl:comment>
1824                 </script>
1825                 <!--<img src="{$resourcesRoot}/resources/calIcon.gif" width="16" height="15" border="0"/>-->
1826                 <div class="{$timeFieldsClass}" id="endTimeFields">
1827                   <span id="calWidgetEndTimeHider" class="show">
1828                     <xsl:copy-of select="form/end/dateTime/hour/*"/>
1829                     <xsl:copy-of select="form/end/dateTime/minute/*"/>
1830                     <xsl:if test="form/end/dateTime/ampm">
1831                       <xsl:copy-of select="form/end/dateTime/ampm/*"/>
1832                     </xsl:if>
1833                     <xsl:text> </xsl:text>
1834                     <a href="javascript:bwClockLaunch('eventEndDate');"><img src="{$resourcesRoot}/resources/clockIcon.gif" width="16" height="15" border="0"/></a>
1835                   </span>
1836                 </div>
1837               </div><br/>
1838               <div id="clock" class="invisible">
1839                 <xsl:call-template name="clock"/>
1840               </div>
1841               <div class="dateFields">
1842                 <xsl:choose>
1843                   <xsl:when test="form/end/type='D'">
1844                     <input type="radio" name="eventEndType" value="D" checked="checked" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/>
1845                   </xsl:when>
1846                   <xsl:otherwise>
1847                     <input type="radio" name="eventEndType" value="D" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/>
1848                   </xsl:otherwise>
1849                 </xsl:choose>
1850                 Duration
1851                 <xsl:variable name="endDurationClass">
1852                   <xsl:choose>
1853                     <xsl:when test="form/end/type='D'">shown</xsl:when>
1854                     <xsl:otherwise>invisible</xsl:otherwise>
1855                   </xsl:choose>
1856                 </xsl:variable>
1857                 <xsl:variable name="durationHrMinClass">
1858                   <xsl:choose>
1859                     <xsl:when test="form/allDay/input/@checked='checked'">invisible</xsl:when>
1860                     <xsl:otherwise>shown</xsl:otherwise>
1861                   </xsl:choose>
1862                 </xsl:variable>
1863                 <div class="{$endDurationClass}" id="endDuration">
1864                   <xsl:choose>
1865                     <xsl:when test="form/end/duration/weeks/input/@value = '0'">
1866                     <!-- we are using day, hour, minute format -->
1867                     <!-- must send either no week value or week value of 0 (zero) -->
1868                       <div class="durationBox">
1869                         <input type="radio" name="eventDuration.type" value="daytime" onclick="swapDurationType('daytime')" checked="checked"/>
1870                         <xsl:variable name="daysStr" select="form/end/duration/days/input/@value"/>
1871                         <input type="text" name="eventDuration.daysStr" size="2" value="{$daysStr}" id="durationDays"/>days
1872                         <span id="durationHrMin" class="{$durationHrMinClass}">
1873                           <xsl:variable name="hoursStr" select="form/end/duration/hours/input/@value"/>
1874                           <input type="text" name="eventDuration.hoursStr" size="2" value="{$hoursStr}" id="durationHours"/>hours
1875                           <xsl:variable name="minutesStr" select="form/end/duration/minutes/input/@value"/>
1876                           <input type="text" name="eventDuration.minutesStr" size="2" value="{$minutesStr}" id="durationMinutes"/>minutes
1877                         </span>
1878                       </div>
1879                       <span class="durationSpacerText">or</span>
1880                       <div class="durationBox">
1881                         <input type="radio" name="eventDuration.type" value="weeks" onclick="swapDurationType('week')"/>
1882                         <xsl:variable name="weeksStr" select="form/end/duration/weeks/input/@value"/>
1883                         <input type="text" name="eventDuration.weeksStr" size="2" value="{$weeksStr}" id="durationWeeks" disabled="true"/>weeks
1884                       </div>
1885                     </xsl:when>
1886                     <xsl:otherwise>
1887                       <!-- we are using week format -->
1888                       <div class="durationBox">
1889                         <input type="radio" name="eventDuration.type" value="daytime" onclick="swapDurationType('daytime')"/>
1890                         <xsl:variable name="daysStr" select="form/end/duration/days/input/@value"/>
1891                         <input type="text" name="eventDuration.daysStr" size="2" value="{$daysStr}" id="durationDays" disabled="true"/>days
1892                         <span id="durationHrMin" class="{$durationHrMinClass}">
1893                           <xsl:variable name="hoursStr" select="form/end/duration/hours/input/@value"/>
1894                           <input type="text" name="eventDuration.hoursStr" size="2" value="{$hoursStr}" id="durationHours" disabled="true"/>hours
1895                           <xsl:variable name="minutesStr" select="form/end/duration/minutes/input/@value"/>
1896                           <input type="text" name="eventDuration.minutesStr" size="2" value="{$minutesStr}" id="durationMinutes" disabled="true"/>minutes
1897                         </span>
1898                       </div>
1899                       <span class="durationSpacerText">or</span>
1900                       <div class="durationBox">
1901                         <input type="radio" name="eventDuration.type" value="weeks" onclick="swapDurationType('week')" checked="checked"/>
1902                         <xsl:variable name="weeksStr" select="form/end/duration/weeks/input/@value"/>
1903                         <input type="text" name="eventDuration.weeksStr" size="2" value="{$weeksStr}" id="durationWeeks"/>weeks
1904                       </div>
1905                     </xsl:otherwise>
1906                   </xsl:choose>
1907                 </div>
1908               </div><br/>
1909               <div class="dateFields" id="noDuration">
1910                 <xsl:choose>
1911                   <xsl:when test="form/end/type='N'">
1912                     <input type="radio" name="eventEndType" value="N" checked="checked" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/>
1913                   </xsl:when>
1914                   <xsl:otherwise>
1915                     <input type="radio" name="eventEndType" value="N" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/>
1916                   </xsl:otherwise>
1917                 </xsl:choose>
1918                 This event has no duration / end date
1919               </div>
1920             </div>
1921           </td>
1922         </tr>
1923         <!--  Status  -->
1924         <tr>
1925           <td class="fieldname">
1926             Status:
1927           </td>
1928           <td class="fieldval">
1929             <xsl:choose>
1930               <xsl:when test="form/status = 'TENTATIVE'">
1931                 <input type="radio" name="editEvent.status" value="CONFIRMED"/>confirmed <input type="radio" name="editEvent.status" value="TENTATIVE" checked="checked"/>tentative <input type="radio" name="editEvent.status" value="CANCELLED"/>cancelled
1932               </xsl:when>
1933               <xsl:when test="form/status = 'CANCELLED'">
1934                 <input type="radio" name="editEvent.status" value="CONFIRMED"/>confirmed <input type="radio" name="editEvent.status" value="TENTATIVE"/>tentative <input type="radio" name="editEvent.status" value="CANCELLED" checked="checked"/>cancelled
1935               </xsl:when>
1936               <xsl:otherwise>
1937                 <input type="radio" name="editEvent.status" value="CONFIRMED" checked="checked"/>confirmed <input type="radio" name="editEvent.status" value="TENTATIVE"/>tentative <input type="radio" name="editEvent.status" value="CANCELLED"/>cancelled
1938               </xsl:otherwise>
1939             </xsl:choose>
1940           </td>
1941         </tr>
1942         <!--  Transparency  -->
1943         <tr>
1944           <td class="fieldname">
1945             Effects free/busy:
1946           </td>
1947           <td class="fieldval">
1948             <xsl:choose>
1949               <xsl:when test="form/transparency = 'TRANSPARENT'">
1950                 <input type="radio" name="editEvent.transparency" value="OPAQUE"/>yes <input type="radio" name="editEvent.transparency" value="TRANSPARENT" checked="checked"/>no
1951               </xsl:when>
1952               <xsl:otherwise>
1953                 <input type="radio" name="editEvent.transparency" value="OPAQUE" checked="checked"/>yes <input type="radio" name="editEvent.transparency" value="TRANSPARENT"/>no
1954               </xsl:otherwise>
1955             </xsl:choose>
1956           </td>
1957         </tr>
1958         <!--  Description  -->
1959         <tr>
1960           <td class="fieldname">Description:</td>
1961           <td class="fieldval">
1962             <textarea name="editEvent.description" cols="60" rows="4">
1963               <xsl:value-of select="/bedework/formElements/form/desc/textarea"/>
1964             </textarea>
1965           </td>
1966         </tr>
1967         <tr>
1968           <td class="fieldname">Location:</td>
1969           <td class="fieldval" align="left">
1970             <span class="std-text">choose: </span>
1971             <span id="eventFormLocationList">
1972               <select name="locationId">
1973                 <option value="-1">select...</option>
1974                 <xsl:copy-of select="/bedework/formElements/form/location/locationmenu/select/*"/>
1975               </select>
1976             </span>
1977             <span class="std-text"> or add new: </span>
1978             <input type="text" name="laddress" value="" />
1979           </td>
1980         </tr>
1981         <tr>
1982           <td class="fieldname">Event Link:</td>
1983           <td class="fieldval">
1984             <xsl:variable name="link" select="form/link/input/@value"/>
1985             <input type="text" name="editEvent.link" size="80" value="{$link}"/>
1986           </td>
1987         </tr>
1988         <tr>
1989           <td class="fieldname">&#160;</td>
1990           <td class="fieldval">
1991             <input name="submit" type="submit" value="Submit Event"/>&#160;
1992             <input name="cancelled" type="submit" value="Cancel"/>
1993           </td>
1994         </tr>
1995       </table>
1996     </form>
1997
1998     <div id="sharingBox">
1999       <h3>Sharing</h3>
2000       <table class="common">
2001         <tr>
2002           <th class="commonHeader" colspan="2">Current access:</th>
2003         </tr>
2004         <tr>
2005           <th>Owner:</th>
2006           <!-- NOTE: we are currently getting the acl information from the
2007                calendar listing NOT from the current calendar (which does not
2008                have the means of producing it out of the action form just now.
2009                We'll fix this soon. -->
2010           <td class="fieldval">
2011             <xsl:value-of select="name(acl/ace[principal/property/owner]/grant/*)"/>
2012           </td>
2013         </tr>
2014         <xsl:if test="acl/ace/principal/href">
2015           <tr>
2016             <th>Users:</th>
2017             <td>
2018               <xsl:for-each select="acl/ace[principal/href]">
2019                 <xsl:value-of select="principal/href"/> (<xsl:value-of select="name(grant/*)"/>)<br/>
2020               </xsl:for-each>
2021             </td>
2022           </tr>
2023         </xsl:if>
2024       </table>
2025       <form name="eventShareForm" action="{$event-setAccess}" id="shareForm">
2026         <input type="hidden" name="calPath" value="{$calPath}"/>
2027         <input type="hidden" name="guid" value="{$guid}"/>
2028         <input type="hidden" name="recurid" value="{$recurrenceId}"/>
2029         <p>
2030           Share this event with:<br/>
2031           <input type="text" name="who" size="20"/>
2032           <input type="radio" value="user" name="whoType" checked="checked"/> user
2033           <input type="radio" value="group" name="whoType"/> group
2034         </p>
2035         <p>
2036           Access rights:<br/>
2037           <input type="radio" value="R" name="how" checked="checked"/> read<br/>
2038           <input type="radio" value="Rc" name="how"/> read/write<br/>
2039           <input type="radio" value="f" name="how"/> read free/busy only<br/>
2040           <input type="radio" value="d" name="how"/> default (reset access)
2041         </p>
2042         <input type="submit" name="submit" value="Submit"/>
2043       </form>
2044     </div>
2045   </xsl:template>
2046
2047   <xsl:template match="event" mode="addEventRef">
2048   <!-- The name "eventForm" is referenced by several javascript functions. Do not
2049     change it without modifying includes.js -->
2050     <form name="eventForm" method="post" action="{$event-addEventRefComplete}" id="standardForm"  enctype="multipart/form-data">
2051       <xsl:variable name="subscriptionId" select="subscription/id"/>
2052       <xsl:variable name="calPath" select="calendar/path"/>
2053       <xsl:variable name="guid" select="guid"/>
2054       <xsl:variable name="recurrenceId" select="recurrenceId"/>
2055       <input type="hidden" name="subid" value="{$subscriptionId}"/>
2056       <input type="hidden" name="calPath" value="{$calPath}"/>
2057       <input type="hidden" name="guid" value="{$guid}"/>
2058       <input type="hidden" name="recurrenceId" value="{$recurrenceId}"/>
2059       <!-- newCalPath is the path to the calendar in which the reference
2060            should be placed.  If no value, then default calendar. -->
2061       <input type="hidden" name="newCalPath" value=""/>
2062
2063       <h2>Add Event Reference</h2>
2064       <table class="common" cellspacing="0">
2065         <tr>
2066           <td class="fieldname">
2067             Event:
2068           </td>
2069           <td>
2070             <xsl:value-of select="summary"/>
2071           </td>
2072         </tr>
2073         <tr>
2074           <td class="fieldname">
2075             Into calendar:
2076           </td>
2077           <td align="left">
2078             <span id="bwEventCalDisplay">
2079               <em>default calendar</em>
2080             </span>
2081             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
2082           </td>
2083         </tr>
2084         <tr>
2085           <td class="fieldname">
2086             Affects Free/busy:
2087           </td>
2088           <td align="left">
2089             <input type="radio" value="OPAQUE" name="transparency"/> yes
2090             <input type="radio" value="TRANSPARENT" name="transparency" checked="checked"/> no
2091           </td>
2092         </tr>
2093       </table>
2094       <table border="0" id="submitTable">
2095         <tr>
2096           <td>
2097             <input name="submit" type="submit" value="Continue"/>
2098             <input name="cancelled" type="submit" value="Cancel"/>
2099           </td>
2100         </tr>
2101       </table>
2102     </form>
2103   </xsl:template>
2104
2105   <!--+++++++++++++++ Free / Busy ++++++++++++++++++++-->
2106   <xsl:template match="freebusy">
2107     <h2>Free / Busy</h2>
2108     <div id="freeBusyWho">for <xsl:value-of select="day/who"/></div>
2109     <table id="freeBusy">
2110       <tr>
2111         <td>&#160;</td>
2112         <xsl:for-each select="day[position()=1]/period">
2113           <th>
2114             <xsl:choose>
2115               <xsl:when test="number(start) mod 200 = 0">
2116                 <xsl:apply-templates select="start" mode="timeDisplay"/>
2117               </xsl:when>
2118               <xsl:otherwise>
2119                 &#160;
2120               </xsl:otherwise>
2121             </xsl:choose>
2122           </th>
2123         </xsl:for-each>
2124       </tr>
2125       <xsl:for-each select="day">
2126         <tr>
2127           <th>
2128             <xsl:value-of select="substring(start,1,4)"/>-<xsl:value-of select="substring(start,5,2)"/>-<xsl:value-of select="substring(start,7,2)"/>
2129           </th>
2130           <xsl:for-each select="period">
2131             <xsl:variable name="startTime"><xsl:apply-templates  select="start" mode="timeDisplay"/></xsl:variable>
2132             <!-- the start date for the add event link is a concat of the day's date plus the period's time (+ seconds)-->
2133             <xsl:variable name="startDate"><xsl:value-of select="substring(../start,1,8)"/>T<xsl:value-of select="start"/>00</xsl:variable>
2134             <xsl:variable name="minutes" select="length"/>
2135             <xsl:choose>
2136               <xsl:when test="fbtype = '0'">
2137                 <td class="busy">
2138                   <a href="{$initEvent}?startdate={$startDate}&amp;minutes={$minutes}" title="{$startTime}">*</a>
2139                 </td>
2140               </xsl:when>
2141               <xsl:otherwise>
2142                 <td class="free">
2143                   <a href="{$initEvent}?startdate={$startDate}&amp;minutes={$minutes}" title="{$startTime}">*</a>
2144                 </td>
2145               </xsl:otherwise>
2146             </xsl:choose>
2147           </xsl:for-each>
2148         </tr>
2149       </xsl:for-each>
2150     </table>
2151
2152     <table id="freeBusyKey">
2153       <tr>
2154         <td class="free">*</td>
2155         <td>free</td>
2156         <td>&#160;</td>
2157         <td class="busy">*</td>
2158         <td>busy</td>
2159         <td>&#160;</td>
2160         <td>
2161           <form name="calendarShareForm" action="{$freeBusy-fetch}">
2162             View user's free/busy:<br/>
2163             <input type="text" name="userid" size="20"/>
2164             <input type="submit" name="submit" value="Submit"/>
2165           </form>
2166         </td>
2167       </tr>
2168     </table>
2169
2170     <div id="sharingBox">
2171       <h3>Sharing</h3>
2172       <table class="common">
2173         <tr>
2174           <th class="commonHeader" colspan="2">Current access:</th>
2175         </tr>
2176         <tr>
2177           <th>Users:</th>
2178           <td>
2179             <xsl:choose>
2180               <xsl:when test="/bedework/myCalendars/calendars/calendar/acl/ace/principal/href">
2181                 <xsl:for-each select="/bedework/myCalendars/calendars/calendar/acl/ace[principal/href]">
2182                   <xsl:value-of select="principal/href"/> (<xsl:value-of select="name(grant/*)"/>)<br/>
2183                 </xsl:for-each>
2184               </xsl:when>
2185               <xsl:otherwise>
2186                 free/busy not shared
2187               </xsl:otherwise>
2188             </xsl:choose>
2189           </td>
2190         </tr>
2191       </table>
2192       <form name="calendarShareForm" action="{$freeBusy-setAccess}" id="shareForm">
2193         <xsl:variable name="calPath" select="/bedework/myCalendars/calendars/calendar/path"/>
2194         <input type="hidden" name="calPath" value="{$calPath}"/>
2195         <p>
2196           Share my free/busy with:<br/>
2197           <input type="text" name="who" size="20"/>
2198           <input type="radio" value="user" name="whoType" checked="checked"/> user
2199           <input type="radio" value="group" name="whoType"/> group
2200         </p>
2201         <p>
2202           Access rights:<br/>
2203           <input type="radio" value="f" name="how" checked="checked"/> view my free/busy<br/>
2204           <input type="radio" value="d" name="how"/> default (reset access)
2205         </p>
2206         <input type="submit" name="submit" value="Submit"/>
2207       </form>
2208     </div>
2209   </xsl:template>
2210
2211   <xsl:template match="start" mode="timeDisplay">
2212     <xsl:choose>
2213       <xsl:when test="node()=0000">12am</xsl:when>
2214       <xsl:when test="node()=0100">1am</xsl:when>
2215       <xsl:when test="node()=0200">2am</xsl:when>
2216       <xsl:when test="node()=0300">3am</xsl:when>
2217       <xsl:when test="node()=0400">4am</xsl:when>
2218       <xsl:when test="node()=0500">5am</xsl:when>
2219       <xsl:when test="node()=0600">6am</xsl:when>
2220       <xsl:when test="node()=0700">7am</xsl:when>
2221       <xsl:when test="node()=0800">8am</xsl:when>
2222       <xsl:when test="node()=0900">9am</xsl:when>
2223       <xsl:when test="node()=1000">10am</xsl:when>
2224       <xsl:when test="node()=1100">11am</xsl:when>
2225       <xsl:when test="node()=1200">NOON</xsl:when>
2226       <xsl:when test="node()=1300">1pm</xsl:when>
2227       <xsl:when test="node()=1400">2pm</xsl:when>
2228       <xsl:when test="node()=1500">3pm</xsl:when>
2229       <xsl:when test="node()=1600">4pm</xsl:when>
2230       <xsl:when test="node()=1700">5pm</xsl:when>
2231       <xsl:when test="node()=1800">6pm</xsl:when>
2232       <xsl:when test="node()=1900">7pm</xsl:when>
2233       <xsl:when test="node()=2000">8pm</xsl:when>
2234       <xsl:when test="node()=2100">9pm</xsl:when>
2235       <xsl:when test="node()=2200">10pm</xsl:when>
2236       <xsl:when test="node()=2300">11pm</xsl:when>
2237       <xsl:when test="node()=2400">12am</xsl:when>
2238       <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2239     </xsl:choose>
2240   </xsl:template>
2241
2242   <!--+++++++++++++++ Calendars ++++++++++++++++++++-->
2243   <xsl:template match="calendars">
2244     <h2>Manage Calendars</h2>
2245     <table id="calendarTable">
2246       <tr>
2247         <td class="cals">
2248           <h3>Calendars</h3>
2249           <ul class="calendarTree">
2250             <xsl:choose>
2251               <xsl:when test="/bedework/page='calendarDescriptions' or
2252                               /bedework/page='displayCalendar'">
2253                 <xsl:apply-templates select="calendar" mode="listForDisplay"/>
2254               </xsl:when>
2255               <xsl:otherwise>
2256                 <xsl:apply-templates select="calendar" mode="listForUpdate"/>
2257               </xsl:otherwise>
2258             </xsl:choose>
2259           </ul>
2260         </td>
2261         <td class="calendarContent">
2262           <xsl:choose>
2263             <xsl:when test="/bedework/page='calendarList' or
2264                             /bedework/page='calendarReferenced'">
2265               <xsl:call-template name="calendarList"/>
2266             </xsl:when>
2267             <xsl:when test="/bedework/page='calendarDescriptions'">
2268               <xsl:call-template name="calendarDescriptions"/>
2269             </xsl:when>
2270             <xsl:when test="/bedework/page='displayCalendar'">
2271               <xsl:apply-templates select="/bedework/currentCalendar" mode="displayCalendar"/>
2272             </xsl:when>
2273             <xsl:when test="/bedework/page='deleteCalendarConfirm'">
2274               <xsl:apply-templates select="/bedework/currentCalendar" mode="deleteCalendarConfirm"/>
2275             </xsl:when>
2276             <xsl:when test="/bedework/creating='true'">
2277               <xsl:apply-templates select="/bedework/currentCalendar" mode="addCalendar"/>
2278             </xsl:when>
2279             <xsl:otherwise>
2280               <xsl:apply-templates select="/bedework/currentCalendar" mode="modCalendar"/>
2281             </xsl:otherwise>
2282           </xsl:choose>
2283         </td>
2284       </tr>
2285     </table>
2286   </xsl:template>
2287
2288   <xsl:template match="calendar" mode="myCalendars">
2289     <!-- supress Inbox and Outbox for the moment -->
2290     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2291       <xsl:variable name="id" select="id"/>
2292       <xsl:variable name="itemClass">
2293         <xsl:choose>
2294           <xsl:when test="/bedework/selectionState/selectionType = 'calendar'
2295                           and path = /bedework/selectionState/subscriptions/subscription/calendar/path">selected</xsl:when>
2296           <xsl:when test="name='Trash'">trash</xsl:when>
2297           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2298           <xsl:otherwise>calendar</xsl:otherwise>
2299         </xsl:choose>
2300       </xsl:variable>
2301       <li class="{$itemClass}">
2302         <xsl:variable name="calPath" select="path"/>
2303         <a href="{$setSelection}?calUrl={$calPath}">
2304           <xsl:value-of select="name"/>
2305         </a>
2306         <xsl:if test="calendar">
2307           <ul>
2308             <xsl:apply-templates select="calendar" mode="myCalendars"/>
2309           </ul>
2310         </xsl:if>
2311         <xsl:if test="calendarCollection='true'">
2312           <!-- set the start date for adding an event to the first day of the
2313                given period, the hour of "now", and give a duration of 60 minutes -->
2314           <xsl:variable name="startDate"><xsl:value-of select="/bedework/firstday/date"/>T<xsl:value-of select="substring(/bedework/now/time,1,2)"/>0000</xsl:variable>
2315           <a href="{$initEvent}?startdate={$startDate}&amp;calPath={$calPath}&amp;minutes=60" class="calendarAdd" title="add event">
2316             <img src="{$resourcesRoot}/resources/addEvent-forCals-icon.gif" width="9" height="12" border="0" alt="add event"/>
2317           </a>
2318         </xsl:if>
2319       </li>
2320     </xsl:if>
2321   </xsl:template>
2322
2323   <xsl:template match="calendar" mode="listForUpdate">
2324     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2325       <xsl:variable name="calPath" select="encodedPath"/>
2326       <xsl:variable name="itemClass">
2327         <xsl:choose>
2328           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2329           <xsl:otherwise>calendar</xsl:otherwise>
2330         </xsl:choose>
2331       </xsl:variable>
2332       <li class="{$itemClass}">
2333         <a href="{$calendar-fetchForUpdate}&amp;calPath={$calPath}" title="update">
2334           <xsl:value-of select="name"/>
2335         </a>
2336         <xsl:if test="calendarCollection='false'">
2337           <xsl:text> </xsl:text>
2338           <a href="{$calendar-initAdd}&amp;calPath={$calPath}" title="add a calendar or folder">
2339             <img src="{$resourcesRoot}/resources/calAddIcon.gif" width="13" height="13" alt="add a calendar or folder" border="0"/>
2340           </a>
2341         </xsl:if>
2342         <xsl:if test="calendar">
2343           <ul>
2344             <xsl:apply-templates select="calendar" mode="listForUpdate">
2345               <!--<xsl:sort select="title" order="ascending" case-order="upper-first"/>-->
2346             </xsl:apply-templates>
2347           </ul>
2348         </xsl:if>
2349       </li>
2350     </xsl:if>
2351   </xsl:template>
2352
2353   <xsl:template match="calendar" mode="listForDisplay">
2354     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2355       <xsl:variable name="calPath" select="encodedPath"/>
2356       <xsl:variable name="itemClass">
2357         <xsl:choose>
2358           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2359           <xsl:otherwise>calendar</xsl:otherwise>
2360         </xsl:choose>
2361       </xsl:variable>
2362       <li class="{$itemClass}">
2363         <a href="{$calendar-fetchForDisplay}&amp;calPath={$calPath}" title="display">
2364           <xsl:value-of select="name"/>
2365         </a>
2366         <xsl:if test="calendar">
2367           <ul>
2368             <xsl:apply-templates select="calendar" mode="listForDisplay">
2369               <!--<xsl:sort select="title" order="ascending" case-order="upper-first"/>-->
2370             </xsl:apply-templates>
2371           </ul>
2372         </xsl:if>
2373       </li>
2374     </xsl:if>
2375   </xsl:template>
2376
2377   <!-- the selectCalForEvent listing creates a calendar tree in a pop-up window
2378        from myCalendars and mySubscriptions -->
2379   <xsl:template name="selectCalForEvent">
2380     <h2>Select a calendar</h2>
2381     <form name="toggleCals" action="{$event-selectCalForEvent}">
2382       <xsl:choose>
2383         <xsl:when test="/bedework/appvar[key='showAllCalsForEvent']/value = 'true'">
2384           <input type="radio" name="setappvar" value="showAllCalsForEvent(false)" onchange="submit()"/>
2385           show only writable calendars
2386           <input type="radio" name="setappvar" value="showAllCalsForEvent(true)" checked="checked" onchange="submit()"/>
2387           show all calendars
2388         </xsl:when>
2389         <xsl:otherwise>
2390           <input type="radio" name="setappvar" value="showAllCalsForEvent(false)" checked="checked" onchange="submit()"/>
2391           show only writable calendars
2392           <input type="radio" name="setappvar" value="showAllCalsForEvent(true)" onchange="submit()"/>
2393           show all calendars
2394         </xsl:otherwise>
2395       </xsl:choose>
2396     </form>
2397     <h4>My Calendars</h4>
2398     <ul class="calendarTree">
2399       <xsl:choose>
2400         <xsl:when test="/bedework/appvar[key='showAllCalsForEvent']/value = 'true'">
2401           <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar" mode="selectCalForEventCalTree"/>
2402         </xsl:when>
2403         <xsl:otherwise>
2404           <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar[currentAccess/current-user-privilege-set/privilege/write-content]" mode="selectCalForEventCalTree"/>
2405         </xsl:otherwise>
2406       </xsl:choose>
2407     </ul>
2408     <h4>Subscribed Calendars</h4>
2409     <ul class="calendarTree">
2410       <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/></xsl:variable>
2411       <xsl:choose>
2412         <xsl:when test="/bedework/appvar[key='showAllCalsForEvent']/value = 'true'">
2413           <xsl:apply-templates select="/bedework/mySubscriptions/subscription[not(contains(uri,$userPath))]/calendars/calendar" mode="selectCalForEventCalTree"/>
2414         </xsl:when>
2415         <xsl:otherwise>
2416           <xsl:apply-templates select="/bedework/mySubscriptions/subscription[not(contains(uri,$userPath))]/calendars/calendar[currentAccess/current-user-privilege-set/privilege/write-content]" mode="selectCalForEventCalTree"/>
2417         </xsl:otherwise>
2418       </xsl:choose>
2419     </ul>
2420   </xsl:template>
2421
2422   <xsl:template match="calendar" mode="selectCalForEventCalTree">
2423   <!-- supress Inbox and Outbox for the moment -->
2424     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2425       <xsl:variable name="id" select="id"/>
2426       <xsl:variable name="itemClass">
2427         <xsl:choose>
2428           <xsl:when test="/bedework/selectionState/selectionType = 'calendar'
2429                           and name = /bedework/selectionState/subscriptions/subscription/calendar/name">selected</xsl:when>
2430           <xsl:when test="name='Trash'">trash</xsl:when>
2431           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2432           <xsl:otherwise>calendar</xsl:otherwise>
2433         </xsl:choose>
2434       </xsl:variable>
2435       <li class="{$itemClass}">
2436         <xsl:variable name="calPath" select="path"/>
2437         <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
2438         <xsl:variable name="calDisplay">
2439           <xsl:choose>
2440             <xsl:when test="contains(path,$userPath)">
2441               <xsl:value-of select="substring-after(path,$userPath)"/>
2442             </xsl:when>
2443             <xsl:otherwise>
2444               <xsl:value-of select="path"/>
2445             </xsl:otherwise>
2446           </xsl:choose>
2447         </xsl:variable>
2448         <xsl:choose>
2449           <xsl:when test="currentAccess/current-user-privilege-set/privilege/write-content and (calendarCollection = 'true')">
2450             <a href="javascript:updateEventFormCalendar('{$calPath}','{$calDisplay}')">
2451               <strong><xsl:value-of select="name"/></strong>
2452             </a>
2453           </xsl:when>
2454           <xsl:otherwise>
2455             <xsl:value-of select="name"/>
2456           </xsl:otherwise>
2457         </xsl:choose>
2458         <xsl:if test="calendar">
2459           <ul>
2460             <xsl:apply-templates select="calendar" mode="selectCalForEventCalTree"/>
2461           </ul>
2462         </xsl:if>
2463       </li>
2464     </xsl:if>
2465   </xsl:template>
2466
2467   <xsl:template match="currentCalendar" mode="addCalendar">
2468     <h3>Add Calendar / Folder</h3>
2469     <form name="addCalForm" action="{$calendar-update}">
2470       <table class="common">
2471         <tr>
2472           <th>Name:</th>
2473           <td>
2474             <xsl:variable name="curCalName" select="name"/>
2475             <input name="calendar.name" value="{$curCalName}" size="40"/>
2476           </td>
2477         </tr>
2478         <tr>
2479           <th>Summary:</th>
2480           <td>
2481             <xsl:variable name="curCalSummary" select="summary"/>
2482             <input type="text" name="calendar.summary" value="{$curCalSummary}" size="40"/>
2483           </td>
2484         </tr>
2485         <tr>
2486           <th>Description:</th>
2487           <td>
2488             <textarea name="calendar.description" cols="40" rows="4">
2489               <xsl:value-of select="desc"/>
2490             </textarea>
2491           </td>
2492         </tr>
2493         <tr>
2494           <th>Calendar/Folder:</th>
2495           <td>
2496             <xsl:choose>
2497               <xsl:when test="calendarCollection='true'">
2498                 <input type="radio" value="true" name="calendarCollection" checked="checked"/> Calendar
2499                 <input type="radio" value="false" name="calendarCollection"/> Folder
2500               </xsl:when>
2501               <xsl:otherwise>
2502                 <input type="radio" value="true" name="calendarCollection"/> Calendar
2503                 <input type="radio" value="false" name="calendarCollection" checked="checked"/> Folder
2504               </xsl:otherwise>
2505             </xsl:choose>
2506           </td>
2507         </tr>
2508       </table>
2509
2510       <table border="0" id="submitTable">
2511         <tr>
2512           <td>
2513             <input type="submit" name="addCalendar" value="Add Calendar/Folder"/>
2514             <input type="submit" name="cancelled" value="Cancel"/>
2515             <input type="reset" value="Clear"/>
2516           </td>
2517         </tr>
2518       </table>
2519     </form>
2520
2521     <div id="sharingBox">
2522       <h3>Sharing</h3>
2523       Sharing may be added to a calendar once created.
2524     </div>
2525
2526   </xsl:template>
2527
2528   <xsl:template match="currentCalendar" mode="modCalendar">
2529     <xsl:choose>
2530       <xsl:when test="calendarCollection='true'">
2531         <h3>Modify Calendar</h3>
2532       </xsl:when>
2533       <xsl:otherwise>
2534         <h3>Modify Folder</h3>
2535       </xsl:otherwise>
2536     </xsl:choose>
2537     <xsl:variable name="calPath" select="path"/>
2538     <form name="modCalForm" action="{$calendar-update}">
2539       <table class="common">
2540         <tr>
2541           <th class="commonHeader" colspan="2">
2542             <xsl:value-of select="path"/>
2543           </th>
2544         </tr>
2545         <tr>
2546           <th>Name:</th>
2547           <td>
2548             <xsl:value-of select="name"/>
2549           </td>
2550         </tr>
2551         <tr>
2552           <th>Mailing List ID:</th>
2553           <td>
2554             <xsl:value-of select="mailListId"/>
2555           </td>
2556         </tr>
2557         <tr>
2558           <th>Summary:</th>
2559           <td>
2560             <xsl:variable name="curCalSummary" select="summary"/>
2561             <input type="text" name="calendar.summary" value="{$curCalSummary}" size="40"/>
2562           </td>
2563         </tr>
2564         <tr>
2565           <th>Description:</th>
2566           <td>
2567             <textarea name="calendar.description" cols="40" rows="4">
2568               <xsl:value-of select="desc"/>
2569             </textarea>
2570           </td>
2571         </tr>
2572         <tr>
2573           <th>Calendar/Folder:</th>
2574           <td>
2575             <xsl:choose>
2576               <xsl:when test="calendarCollection='true'">
2577                 <input type="radio" value="true" name="calendarCollection" checked="checked"/> Calendar
2578                 <input type="radio" value="false" name="calendarCollection"/> Folder
2579               </xsl:when>
2580               <xsl:otherwise>
2581                 <input type="radio" value="true" name="calendarCollection"/> Calendar
2582                 <input type="radio" value="false" name="calendarCollection" checked="checked"/> Folder
2583               </xsl:otherwise>
2584             </xsl:choose>
2585           </td>
2586         </tr>
2587       </table>
2588
2589       <table border="0" id="submitTable">
2590         <tr>
2591           <td>
2592             <xsl:choose>
2593               <xsl:when test="calendarCollection='true'">
2594                 <input type="submit" name="updateCalendar" value="Update Calendar"/>
2595               </xsl:when>
2596               <xsl:otherwise>
2597                 <input type="submit" name="updateCalendar" value="Update Folder"/>
2598               </xsl:otherwise>
2599             </xsl:choose>
2600             <input type="submit" name="cancelled" value="Cancel"/>
2601             <input type="reset" value="Reset"/>
2602           </td>
2603           <td align="right">
2604             <xsl:choose>
2605               <xsl:when test="calendarCollection='true'">
2606                 <input type="submit" name="delete" value="Delete Calendar"/>
2607               </xsl:when>
2608               <xsl:otherwise>
2609                 <input type="submit" name="delete" value="Delete Folder"/>
2610               </xsl:otherwise>
2611             </xsl:choose>
2612           </td>
2613         </tr>
2614       </table>
2615     </form>
2616     <div id="sharingBox">
2617       <h3>Sharing</h3>
2618       <table class="common">
2619         <tr>
2620           <th class="commonHeader" colspan="2">Current access:</th>
2621         </tr>
2622         <tr>
2623           <th>Owner:</th>
2624           <!-- NOTE: we are currently getting the acl information from the
2625                calendar listing NOT from the current calendar (which does not
2626                have the means of producing it out of the action form just now.
2627                We'll fix this soon. -->
2628           <td>
2629             <xsl:value-of select="name(/bedework/calendars//calendar[path=$calPath]/acl/ace[principal/property/owner]/grant/*)"/>
2630           </td>
2631         </tr>
2632         <xsl:if test="/bedework/calendars//calendar[path=$calPath]/acl/ace/principal/href">
2633           <tr>
2634             <th>Users:</th>
2635             <td>
2636               <xsl:for-each select="/bedework/calendars//calendar[path=$calPath]/acl/ace[principal/href]">
2637                 <xsl:value-of select="principal/href"/> (<xsl:value-of select="name(grant/*)"/>)<br/>
2638               </xsl:for-each>
2639             </td>
2640           </tr>
2641         </xsl:if>
2642       </table>
2643       <form name="calendarShareForm" action="{$calendar-setAccess}" id="shareForm">
2644         <input type="hidden" name="calPath" value="{$calPath}"/>
2645         <p>
2646           Share this calendar with:<br/>
2647           <input type="text" name="who" size="20"/>
2648           <input type="radio" value="user" name="whoType" checked="checked"/> user
2649           <input type="radio" value="group" name="whoType"/> group
2650         </p>
2651         <p>
2652           Access rights:<br/>
2653           <input type="radio" value="R" name="how" checked="checked"/> read<br/>
2654           <input type="radio" value="Rc" name="how"/> read/write<br/>
2655           <input type="radio" value="f" name="how"/> read free/busy only<br/>
2656           <input type="radio" value="d" name="how"/> default (reset access)
2657         </p>
2658         <input type="submit" name="submit" value="Submit"/>
2659       </form>
2660     </div>
2661   </xsl:template>
2662
2663   <xsl:template name="calendarList">
2664     <h3>Managing Calendars</h3>
2665     <ul>
2666       <li>Select an item from the calendar list on the left to modify
2667       a calendar or folder.</li>
2668       <li>Select the
2669       <img src="{$resourcesRoot}/resources/calAddIcon.gif" width="13" height="13" alt="true" border="0"/>
2670       icon to add a new calendar or folder to the tree.
2671         <ul>
2672           <li>Folders may only contain calendars and subfolders.</li>
2673           <li>Calendars may only contain events (and other calendar items).</li>
2674           <li>
2675             If a calendar is empty, it may be converted to a folder and vice
2676             versa.  If a calendar or folder are not empty, it may not be
2677             converted.
2678           </li>
2679         </ul>
2680       </li>
2681     </ul>
2682   </xsl:template>
2683
2684   <xsl:template name="calendarDescriptions">
2685     <h2>Calendar Information</h2>
2686     <ul>
2687       <li>Select an item from the calendar tree on the left to view all information
2688       about that calendar or folder.  The tree on the left represents the calendar
2689       heirarchy.</li>
2690     </ul>
2691
2692     <p><strong>All Calendar Descriptions:</strong></p>
2693     <table id="flatCalendarDescriptions" cellspacing="0">
2694       <tr>
2695         <th>Name</th>
2696         <th>Description</th>
2697       </tr>
2698       <xsl:for-each select="//calendar">
2699         <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2700           <xsl:variable name="descClass">
2701             <xsl:choose>
2702               <xsl:when test="position() mod 2 = 0">even</xsl:when>
2703               <xsl:otherwise>odd</xsl:otherwise>
2704             </xsl:choose>
2705           </xsl:variable>
2706           <tr class="{$descClass}">
2707             <td>
2708               <xsl:value-of select="name"/>
2709             </td>
2710             <td>
2711               <xsl:value-of select="desc"/>
2712             </td>
2713           </tr>
2714         </xsl:if>
2715       </xsl:for-each>
2716     </table>
2717   </xsl:template>
2718
2719   <xsl:template match="currentCalendar" mode="displayCalendar">
2720     <h2>Calendar Information</h2>
2721     <table class="common">
2722       <tr>
2723         <th>Name:</th>
2724         <td>
2725           <xsl:value-of select="name"/>
2726         </td>
2727       </tr>
2728       <tr>
2729         <th>Path:</th>
2730         <td>
2731           <xsl:value-of select="path"/>
2732         </td>
2733       </tr>
2734       <tr>
2735         <th>Summary:</th>
2736         <td>
2737           <xsl:value-of select="summary"/>
2738         </td>
2739       </tr>
2740       <tr>
2741         <th>Description:</th>
2742         <td>
2743           <xsl:value-of select="desc"/>
2744         </td>
2745       </tr>
2746     </table>
2747   </xsl:template>
2748
2749   <xsl:template match="currentCalendar" mode="deleteCalendarConfirm">
2750     <xsl:choose>
2751       <xsl:when test="calendarCollection='true'">
2752         <h3>Delete Calendar</h3>
2753         <p>
2754           The following calendar will be deleted.  Continue?
2755         </p>
2756       </xsl:when>
2757       <xsl:otherwise>
2758         <h3>Delete Folder</h3>
2759         <p>
2760           The following folder <em>and all its contents</em> will be deleted.
2761           Continue?
2762         </p>
2763       </xsl:otherwise>
2764     </xsl:choose>
2765
2766     <form name="delCalForm" action="{$calendar-delete}">
2767       <table class="common">
2768         <tr>
2769           <th>Path:</th>
2770           <td>
2771             <xsl:value-of select="path"/>
2772           </td>
2773         </tr>
2774         <tr>
2775           <th>Name:</th>
2776           <td>
2777             <xsl:value-of select="name"/>
2778           </td>
2779         </tr>
2780         <tr>
2781           <th>Summary:</th>
2782           <td>
2783             <xsl:value-of select="summary"/>
2784           </td>
2785         </tr>
2786         <tr>
2787           <th>Description:</th>
2788           <td>
2789             <xsl:value-of select="desc"/>
2790           </td>
2791         </tr>
2792       </table>
2793
2794       <table border="0" id="submitTable">
2795         <tr>
2796           <td>
2797             <input type="submit" name="cancelled" value="Cancel"/>
2798           </td>
2799           <td align="right">
2800             <xsl:choose>
2801               <xsl:when test="calendarCollection='true'">
2802                 <input type="submit" name="delete" value="Yes: Delete Calendar!"/>
2803               </xsl:when>
2804               <xsl:otherwise>
2805                 <input type="submit" name="delete" value="Yes: Delete Folder!"/>
2806               </xsl:otherwise>
2807             </xsl:choose>
2808           </td>
2809         </tr>
2810       </table>
2811     </form>
2812
2813   </xsl:template>
2814
2815   <!--+++++++++++++++ Subscriptions ++++++++++++++++++++-->
2816   <xsl:template match="subscriptions">
2817     <h2>Manage Subscriptions</h2>
2818     <table id="subsTable">
2819       <tr>
2820         <td class="cals">
2821           <p class="smaller">
2822             Select a calendar below to add a <em><strong>new</strong></em>
2823             internal subscription. <!-- or
2824             <a href="{$subscriptions-initAdd}&amp;calUri=please enter a calendar uri">
2825             subscribe to an external calendar</a>.-->
2826           </p>
2827           <h3>My calendars</h3>
2828           <ul class="calendarTree">
2829             <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar" mode="subscribe"/>
2830           </ul>
2831           <h3>Public calendars</h3>
2832           <ul class="calendarTree">
2833             <xsl:apply-templates select="/bedework/subscriptions/subscribe/calendars/calendar" mode="subscribe"/>
2834           </ul>
2835         </td>
2836         <td class="subs">
2837           <xsl:choose>
2838             <xsl:when test="/bedework/page='subscriptions'">
2839               <xsl:call-template name="subscriptionList"/>
2840             </xsl:when>
2841             <xsl:when test="/bedework/creating='true'">
2842               <xsl:apply-templates select="subscription" mode="addSubscription"/>
2843             </xsl:when>
2844             <xsl:otherwise>
2845               <xsl:apply-templates select="subscription" mode="modSubscription"/>
2846             </xsl:otherwise>
2847           </xsl:choose>
2848         </td>
2849       </tr>
2850     </table>
2851   </xsl:template>
2852
2853   <xsl:template match="calendar" mode="subscribe">
2854     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2855       <xsl:variable name="calPath" select="encodedPath"/>
2856       <xsl:variable name="itemClass">
2857         <xsl:choose>
2858           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2859           <xsl:otherwise>calendar</xsl:otherwise>
2860         </xsl:choose>
2861       </xsl:variable>
2862       <li class="{$itemClass}">
2863         <a href="{$subscriptions-initAdd}&amp;calPath={$calPath}">
2864           <xsl:value-of select="name"/>
2865         </a>
2866         <xsl:if test="calendar">
2867           <ul>
2868             <xsl:apply-templates select="calendar" mode="subscribe">
2869               <!--<xsl:sort select="title" order="ascending" case-order="upper-first"/>-->
2870             </xsl:apply-templates>
2871           </ul>
2872         </xsl:if>
2873       </li>
2874     </xsl:if>
2875   </xsl:template>
2876
2877   <xsl:template match="subscription" mode="addSubscription">
2878     <h3>Add New Subscription</h3>
2879     <p class="note">*the subsciption name must be unique</p>
2880     <form name="subscribeForm" action="{$subscriptions-subscribe}" method="post">
2881       <table class="common" cellspacing="0">
2882         <tr>
2883           <td class="fieldname">Name:</td>
2884           <td>
2885             <xsl:variable name="subName" select="name"/>
2886             <input type="text" value="{$subName}" name="subscription.name" size="60"/>
2887           </td>
2888         </tr>
2889         <xsl:if test="internal='false'">
2890           <tr>
2891             <td class="fieldname">Uri:</td>
2892             <td>
2893               <xsl:variable name="subUri" select="uri"/>
2894               <input type="text" value="{$subUri}" name="subscription.uri" size="60"/>
2895             </td>
2896           </tr>
2897         </xsl:if>
2898         <tr>
2899           <td class="fieldname">Display:</td>
2900           <td>
2901             <input type="radio" value="true" name="subscription.display" checked="checked"/> yes
2902             <input type="radio" value="false" name="subscription.display"/> no
2903           </td>
2904         </tr>
2905         <tr>
2906           <td class="fieldname">Affects Free/Busy:</td>
2907           <td>
2908             <input type="radio" value="true" name="subscription.affectsFreeBusy" checked="checked"/> yes
2909             <input type="radio" value="false" name="subscription.affectsFreeBusy"/> no
2910           </td>
2911         </tr>
2912         <tr>
2913           <td class="fieldname">Style:</td>
2914           <td>
2915             <xsl:variable name="subStyle" select="style"/>
2916             <input type="text" value="{$subStyle}" name="subscription.style" size="60"/>
2917           </td>
2918         </tr>
2919         <!--<tr>
2920           <td class="fieldname">Unremovable:</td>
2921           <td>
2922             <input type="radio" value="true" name="unremoveable" size="60"/> true
2923             <input type="radio" value="false" name="unremoveable" size="60" checked="checked"/> false
2924           </td>
2925         </tr>-->
2926       </table>
2927       <table border="0" id="submitTable">
2928         <tr>
2929           <td>
2930             <input type="submit" name="addSubscription" value="Add Subscription"/>
2931             <input type="submit" name="cancelled" value="Cancel"/>
2932             <input type="reset" value="Clear"/>
2933           </td>
2934         </tr>
2935       </table>
2936     </form>
2937   </xsl:template>
2938
2939   <xsl:template match="subscription" mode="modSubscription">
2940     <h3>Modify Subscription</h3>
2941     <form name="subscribeForm" action="{$subscriptions-subscribe}" method="post">
2942       <table class="common" cellspacing="0">
2943         <tr>
2944           <td class="fieldname">Name:</td>
2945           <td>
2946             <xsl:value-of select="name"/>
2947             <xsl:variable name="subName" select="name"/>
2948             <input type="hidden" value="{$subName}" name="name"/>
2949           </td>
2950         </tr>
2951         <xsl:choose>
2952           <xsl:when test="internal='false'">
2953             <tr>
2954               <td class="fieldname">Uri:</td>
2955               <td>
2956                 <xsl:variable name="subUri" select="uri"/>
2957                 <input type="text" value="{$subUri}" name="subscription.uri" size="60"/>
2958               </td>
2959             </tr>
2960           </xsl:when>
2961           <xsl:otherwise>
2962             <tr>
2963               <td class="fieldname">Uri:</td>
2964               <td>
2965                 <xsl:value-of select="uri"/>
2966               </td>
2967             </tr>
2968           </xsl:otherwise>
2969         </xsl:choose>
2970         <tr>
2971           <td class="fieldname">Display:</td>
2972           <td>
2973             <xsl:choose>
2974               <xsl:when test="display='true'">
2975                 <input type="radio" value="true" name="subscription.display" checked="checked"/> yes
2976                 <input type="radio" value="false" name="subscription.display"/> no
2977               </xsl:when>
2978               <xsl:otherwise>
2979                 <input type="radio" value="true" name="subscription.display"/> yes
2980                 <input type="radio" value="false" name="subscription.display" checked="checked"/> no
2981               </xsl:otherwise>
2982             </xsl:choose>
2983           </td>
2984         </tr>
2985         <tr>
2986           <td class="fieldname">Affects Free/Busy:</td>
2987           <td>
2988             <xsl:choose>
2989               <xsl:when test="affectsFreeBusy='true'">
2990                 <input type="radio" value="true" name="subscription.affectsFreeBusy" checked="checked"/> yes
2991                 <input type="radio" value="false" name="subscription.affectsFreeBusy"/> no
2992               </xsl:when>
2993               <xsl:otherwise>
2994                 <input type="radio" value="true" name="subscription.affectsFreeBusy"/> yes
2995                 <input type="radio" value="false" name="subscription.affectsFreeBusy" checked="checked"/> no
2996               </xsl:otherwise>
2997             </xsl:choose>
2998           </td>
2999         </tr>
3000         <tr>
3001           <td class="fieldname">Style:</td>
3002           <td>
3003             <xsl:variable name="subStyle" select="style"/>
3004             <input type="text" value="{$subStyle}" name="subscription.style" size="60"/>
3005           </td>
3006         </tr>
3007         <!--<tr>
3008           <td class="fieldname">Unremovable:</td>
3009           <td>
3010             <xsl:choose>
3011               <xsl:when test="unremoveable='true'">
3012                 <input type="radio" value="true" name="unremoveable" size="60" checked="checked"/> true
3013                 <input type="radio" value="false" name="unremoveable" size="60"/> false
3014               </xsl:when>
3015               <xsl:otherwise>
3016                 <input type="radio" value="true" name="unremoveable" size="60"/> true
3017                 <input type="radio" value="false" name="unremoveable" size="60" checked="checked"/> false
3018               </xsl:otherwise>
3019             </xsl:choose>
3020           </td>
3021         </tr>-->
3022       </table>
3023       <table border="0" id="submitTable">
3024         <tr>
3025           <td>
3026             <input type="submit" name="updateSubscription" value="Update Subscription"/>
3027             <input type="submit" name="cancelled" value="Cancel"/>
3028             <input type="reset" value="Reset"/>
3029           </td>
3030           <td align="right">
3031             <input type="submit" name="delete" value="Delete Subscription"/>
3032           </td>
3033         </tr>
3034       </table>
3035     </form>
3036   </xsl:template>
3037
3038   <xsl:template name="subscriptionList">
3039     <h3>Current subscriptions</h3>
3040     <table class="common" cellspacing="0">
3041       <tr>
3042         <th>Name</th>
3043         <th>URI</th>
3044         <th>Style</th>
3045         <th>Display</th>
3046         <th>Free/Busy</th>
3047         <!--<th>Unremovable</th>
3048         <th>External</th>
3049         <th>Deleted?</th>-->
3050       </tr>
3051       <xsl:for-each select="subscription">
3052         <!--<xsl:sort select="name" order="ascending" case-order="upper-first"/>-->
3053         <tr>
3054           <td>
3055             <xsl:variable name="subname" select="name"/>
3056             <a href="{$subscriptions-fetchForUpdate}&amp;subname={$subname}">
3057               <xsl:value-of select="name"/>
3058             </a>
3059           </td>
3060           <td>
3061             <xsl:value-of select="uri"/>
3062           </td>
3063           <td>
3064             <xsl:value-of select="style"/>
3065           </td>
3066           <td class="center">
3067             <xsl:if test="display='true'">
3068               <img src="{$resourcesRoot}/resources/greenCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3069             </xsl:if>
3070           </td>
3071           <td class="center">
3072             <xsl:if test="affectsFreeBusy='true'">
3073               <img src="{$resourcesRoot}/resources/greenCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3074             </xsl:if>
3075           </td>
3076           <!--<td class="center">
3077             <xsl:if test="unremoveable='true'">
3078               <img src="{$resourcesRoot}/resources/redCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3079             </xsl:if>
3080           </td>
3081           <td class="center">
3082             <xsl:if test="internal='false'">
3083               <img src="{$resourcesRoot}/resources/greenCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3084             </xsl:if>
3085           </td>
3086           <td class="center">
3087             <xsl:if test="calendarDeleted='true'">
3088               <img src="{$resourcesRoot}/resources/redCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3089             </xsl:if>
3090           </td>-->
3091         </tr>
3092       </xsl:for-each>
3093     </table>
3094     <h4><a href="{$subscriptions-initAdd}&amp;calUri=please enter a calendar uri">Subscribe to a calendar</a> (by URI)</h4>
3095   </xsl:template>
3096
3097   <xsl:template match="subscription" mode="mySubscriptions">
3098     <xsl:variable name="itemClass">
3099       <xsl:choose>
3100         <xsl:when test="/bedework/selectionState/selectionType = 'calendar'
3101                         and name = /bedework/selectionState/subscriptions/subscription/calendar/name">selected</xsl:when>
3102         <xsl:otherwise>calendar</xsl:otherwise>
3103       </xsl:choose>
3104     </xsl:variable>
3105     <li class="{$itemClass}">
3106       <xsl:variable name="subUri" select="uri"/>
3107       <a href="{$setSelection}?calUrl={$subUri}">
3108         <xsl:value-of select="name"/>
3109       </a>
3110     </li>
3111   </xsl:template>
3112
3113   <!--==== ALARM OPTIONS ====-->
3114   <xsl:template name="alarmOptions">
3115     <form method="get" action="{$setAlarm}" id="standardForm">
3116       <input type="hidden" name="updateAlarmOptions" value="true"/>
3117       <table class="common" cellspacing="0">
3118         <tr>
3119           <th colspan="2" class="commonHeader">Alarm options</th>
3120         </tr>
3121         <tr>
3122           <td class="fieldname">
3123             Alarm Date/Time:
3124             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmTriggerSelectorDate/*"/>
3125           </td>
3126           <td class="fieldval">
3127             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmdate/*"/>
3128             <span class="std-text">at  </span>
3129             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmtime/*"/>
3130           </td>
3131         </tr>
3132         <tr>
3133           <td class="fieldname">
3134             or Before/After event:
3135             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmTriggerSelectorDuration/*"/>
3136           </td>
3137           <td align="left">
3138             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/days/*"/>
3139             days
3140             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/hours/*"/>
3141             hours
3142             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/minutes/*"/>
3143             minutes
3144             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/seconds/*"/>
3145             seconds OR:
3146             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/weeks/*"/>
3147             weeks
3148             &#160;
3149             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationBefore/*"/>
3150             before
3151             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationAfter/*"/>
3152             after
3153             &#160;
3154             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationRelStart/*"/>
3155             start
3156             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationRelEnd/*"/>
3157             end
3158           </td>
3159         </tr>
3160         <tr>
3161           <td>
3162             Email Address:
3163           </td>
3164           <td align="left">
3165             <xsl:copy-of select="/bedework/alarmoptionsform/form/email/*"/>
3166           </td>
3167         </tr>
3168         <tr>
3169           <td>
3170             Subject:
3171           </td>
3172           <td align="left">
3173             <xsl:copy-of select="/bedework/alarmoptionsform/form/subject/*"/>
3174           </td>
3175         </tr>
3176         <tr>
3177           <td>&#160;</td>
3178           <td>
3179             <input name="submit" type="submit" value="Continue"/>&#160;
3180             <input name="cancelled" type="submit" value="Cancel"/>
3181           </td>
3182         </tr>
3183       </table>
3184     </form>
3185   </xsl:template>
3186
3187   <!--==== UPLOAD ====-->
3188   <xsl:template name="upload">
3189   <!-- The name "eventForm" is referenced by several javascript functions. Do not
3190     change it without modifying includes.js -->
3191     <form name="eventForm" method="post" action="{$upload}" id="standardForm"  enctype="multipart/form-data">
3192       <h2>Upload iCAL File</h2>
3193       <table class="common" cellspacing="0">
3194         <tr>
3195           <td class="fieldname">
3196             Filename:
3197           </td>
3198           <td align="left">
3199             <input type="file" name="uploadFile" size="80" />
3200           </td>
3201         </tr>
3202         <tr>
3203           <td class="fieldname">
3204             Into calendar:
3205           </td>
3206           <td align="left">
3207             <input type="hidden" name="newCalPath" value=""/>
3208             <span id="bwEventCalDisplay">
3209               <em>default calendar</em>
3210             </span>
3211             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
3212           </td>
3213         </tr>
3214         <tr>
3215           <td class="fieldname">
3216             Affects Free/busy:
3217           </td>
3218           <td align="left">
3219             <input type="radio" value="true" name="affectsFreeBusy"/> yes
3220             <input type="radio" value="false" name="affectsFreeBusy" checked="checked"/> no
3221           </td>
3222         </tr>
3223       </table>
3224       <table border="0" id="submitTable">
3225         <tr>
3226           <td>
3227             <input name="submit" type="submit" value="Continue"/>
3228             <input name="cancelled" type="submit" value="Cancel"/>
3229           </td>
3230         </tr>
3231       </table>
3232     </form>
3233   </xsl:template>
3234
3235   <!--==== EMAIL OPTIONS ====-->
3236   <xsl:template name="emailOptions">
3237     <form method="get" action="{$mailEvent}" id="standardForm">
3238       <input type="hidden" name="updateEmailOptions" value="true"/>
3239       <table class="common" cellspacing="0">
3240         <tr>
3241           <th colspan="2" class="commonHeader">Update email options</th>
3242         </tr>
3243         <tr>
3244           <td>
3245
3246             Email Address:
3247           </td>
3248           <td align="left">
3249             <xsl:copy-of select="/bedework/emailoptionsform/form/email/*"/>
3250           </td>
3251         </tr>
3252         <tr>
3253           <td>
3254             Subject:
3255           </td>
3256           <td align="left">
3257             <xsl:copy-of select="/bedework/emailoptionsform/form/subject/*"/>
3258           </td>
3259         </tr>
3260         <tr>
3261           <td>&#160;</td>
3262           <td>
3263             <input name="submit" type="submit" value="Continue"/>&#160;
3264             <input name="cancelled" type="submit" value="Cancel"/>
3265           </td>
3266         </tr>
3267       </table>
3268     </form>
3269   </xsl:template>
3270
3271   <!--==== MANAGE LOCATIONS ====-->
3272   <xsl:template name="manageLocations">
3273     <form name="addLocationForm" method="post" action="{$addLocation}" id="standardForm">
3274       <input type="hidden" name="confirmationid" value="{$confId}"/>
3275       <h2>Manage Locations</h2>
3276       <table class="common" cellspacing="0">
3277         <tr>
3278           <th class="commonHeader" colspan="2">Add Location</th>
3279         </tr>
3280         <tr>
3281           <td class="fieldname">
3282             Main Address:
3283           </td>
3284           <td>
3285             <input size="60" name="newLocation.address" type="text"/>
3286           </td>
3287         </tr>
3288         <tr>
3289           <td class="fieldname">
3290             Subaddress:
3291           </td>
3292           <td>
3293             <input size="60" name="newLocation.subaddress" type="text"/>
3294           </td>
3295         </tr>
3296         <tr>
3297           <td class="fieldname">
3298             Location Link:
3299           </td>
3300           <td>
3301             <input size="60" name="newLocation.link" type="text"/>
3302           </td>
3303         </tr>
3304         <tr>
3305           <td></td>
3306           <td class="padMe">
3307             <input name="submit" type="submit" value="Submit Location"/>&#160;
3308             <input name="cancelled" type="submit" value="Cancel"/>
3309           </td>
3310         </tr>
3311         <tr>
3312           <th class="commonHeader" colspan="2">Edit/Delete Locations</th>
3313         </tr>
3314         <td colspan="2" class="plain">
3315           <ul>
3316             <xsl:for-each select="/bedework/formElements/form/location/locationmenu/select/option[@value>'3']">
3317               <xsl:sort select="."/>
3318               <li>
3319                 <xsl:variable name="locationId" select="@value"/>
3320                 <a href="{$editLocation}?locationId={$locationId}"><xsl:value-of select="."/></a>
3321               </li>
3322             </xsl:for-each>
3323           </ul>
3324         </td>
3325       </table>
3326     </form>
3327   </xsl:template>
3328
3329   <!--==== EDIT LOCATION ====-->
3330   <xsl:template match="formElements" mode="editLocation">
3331     <form name="editLocationForm" method="post" action="{$editLocation}" id="standardForm">
3332       <input type="hidden" name="updateLocation" value="true"/>
3333       <input type="hidden" name="confirmationid" value="{$confId}"/>
3334       <h2>Manage Locations</h2>
3335       <table class="common" cellspacing="0">
3336         <tr>
3337           <th colspan="2" class="commonHeader">
3338             <!--<xsl:variable name="locId" select="form/id"/>
3339             <div id="eventActions">
3340               <a href="{$delLocation}?locationId={$locId}">Delete Location</a>
3341             </div>-->
3342             Edit Location
3343           </th>
3344         </tr>
3345         <tr>
3346           <td class="fieldname">
3347             Address:
3348           </td>
3349           <td align="left">
3350             <xsl:copy-of select="form/address/*"/>
3351           </td>
3352         </tr>
3353         <tr>
3354           <td class="fieldname">
3355             Subaddress:
3356           </td>
3357           <td align="left">
3358             <xsl:copy-of select="form/subaddress/*"/>
3359           </td>
3360         </tr>
3361         <tr>
3362           <td class="fieldname">
3363             Location's URL:
3364           </td>
3365           <td>
3366             <xsl:copy-of select="form/link/*"/>
3367           </td>
3368         </tr>
3369       </table>
3370       <table border="0" id="submitTable">
3371         <tr>
3372           <td>
3373             <input name="submit" type="submit" value="Submit Location"/>
3374             <input name="cancelled" type="submit" value="Cancel"/>
3375             <input type="reset" value="Reset"/>
3376           </td>
3377           <td align="right">
3378             <xsl:variable name="locId" select="form/id"/>
3379             <a href="{$delLocation}?locationId={$locId}">
3380               <input type="button" name="delete" value="Delete Location"/>
3381             </a>
3382           </td>
3383         </tr>
3384       </table>
3385     </form>
3386   </xsl:template>
3387
3388   <!--==== PREFERENCES ====-->
3389   <xsl:template match="prefs">
3390     <h2>Manage Preferences</h2>
3391     <!-- The name "eventForm" is referenced by several javascript functions. Do not
3392     change it without modifying includes.js -->
3393     <form name="eventForm" method="post" action="{$prefs-update}" onSubmit="setWorkDays(this)">
3394       <table class="common">
3395         <tr><td colspan="2" class="fill">User settings:</td></tr>
3396         <tr>
3397           <td class="fieldname">
3398             User:
3399           </td>
3400           <td>
3401             <xsl:value-of select="user"/>
3402             <xsl:variable name="user" select="user"/>
3403             <input type="hidden" name="user" value="{$user}"/>
3404           </td>
3405         </tr>
3406         <tr>
3407           <td class="fieldname">
3408             Email address:
3409           </td>
3410           <td>
3411             <xsl:variable name="email" select="email"/>
3412             <input type="text" name="email" value="{$email}" size="40"/>
3413           </td>
3414         </tr>
3415         <tr><td colspan="2">&#160;</td></tr>
3416         <tr><td colspan="2" class="fill">Adding events:</td></tr>
3417         <!-- hide if only one calendar to select -->
3418         <xsl:if test="count(/bedework/myCalendars/calendars//calendar[currentAccess/current-user-privilege-set/privilege/write-content and calType = '1']) &gt; 1">
3419           <tr>
3420             <td class="fieldname">
3421               Default calendar:
3422             </td>
3423             <td>
3424               <xsl:variable name="newCalPath" select="defaultCalendar/path"/>
3425               <input type="hidden" name="newCalPath" value="{$newCalPath}"/>
3426               <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
3427               <span id="bwEventCalDisplay">
3428                 <xsl:choose>
3429                   <xsl:when test="contains(defaultCalendar,$userPath)">
3430                     <xsl:value-of select="substring-after(defaultCalendar,$userPath)"/>
3431                   </xsl:when>
3432                   <xsl:otherwise>
3433                     <xsl:value-of select="defaultCalendar"/>
3434                   </xsl:otherwise>
3435                 </xsl:choose>
3436               </span>
3437               <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
3438             </td>
3439           </tr>
3440         </xsl:if>
3441         <tr>
3442           <td class="fieldname">
3443             Preferred end date/time type:
3444           </td>
3445           <td>
3446             <select name="preferredEndType">
3447               <xsl:choose>
3448                 <xsl:when test="preferredEndType = 'duration'">
3449                   <option value="duration" selected="selected">duration</option>
3450                 </xsl:when>
3451                 <xsl:otherwise>
3452                   <option value="duration">duration</option>
3453                 </xsl:otherwise>
3454               </xsl:choose>
3455               <xsl:choose>
3456                 <xsl:when test="preferredEndType = 'date'">
3457                   <option value="date" selected="selected">date/time</option>
3458                 </xsl:when>
3459                 <xsl:otherwise>
3460                   <option value="date">date/time</option>
3461                 </xsl:otherwise>
3462               </xsl:choose>
3463             </select>
3464           </td>
3465         </tr>
3466         <tr><td colspan="2">&#160;</td></tr>
3467         <tr><td colspan="2" class="fill">Workday settings:</td></tr>
3468         <tr>
3469           <td class="fieldname">
3470             Workdays:
3471           </td>
3472           <td>
3473             <xsl:variable name="workDays" select="workDays"/>
3474             <input type="hidden" name="workDays" value="{$workDays}"/>
3475             <xsl:choose>
3476               <xsl:when test="substring(workDays,1,1) = 'W'">
3477                 <input type="checkbox" name="workDayIndex" value="0" checked="checked"/>Sun
3478               </xsl:when>
3479               <xsl:otherwise>
3480                 <input type="checkbox" name="workDayIndex" value="0"/>Sun
3481               </xsl:otherwise>
3482             </xsl:choose>
3483             <xsl:choose>
3484               <xsl:when test="substring(workDays,2,1) = 'W'">
3485                 <input type="checkbox" name="workDayIndex" value="1" checked="checked"/>Mon
3486               </xsl:when>
3487               <xsl:otherwise>
3488                 <input type="checkbox" name="workDayIndex" value="1"/>Mon
3489               </xsl:otherwise>
3490             </xsl:choose>
3491             <xsl:choose>
3492               <xsl:when test="substring(workDays,3,1) = 'W'">
3493                 <input type="checkbox" name="workDayIndex" value="2" checked="checked"/>Tue
3494               </xsl:when>
3495               <xsl:otherwise>
3496                 <input type="checkbox" name="workDayIndex" value="2"/>Tue
3497               </xsl:otherwise>
3498             </xsl:choose>
3499             <xsl:choose>
3500               <xsl:when test="substring(workDays,4,1) = 'W'">
3501                 <input type="checkbox" name="workDayIndex" value="3" checked="checked"/>Wed
3502               </xsl:when>
3503               <xsl:otherwise>
3504                 <input type="checkbox" name="workDayIndex" value="3"/>Wed
3505               </xsl:otherwise>
3506             </xsl:choose>
3507             <xsl:choose>
3508               <xsl:when test="substring(workDays,5,1) = 'W'">
3509                 <input type="checkbox" name="workDayIndex" value="4" checked="checked"/>Thu
3510               </xsl:when>
3511               <xsl:otherwise>
3512                 <input type="checkbox" name="workDayIndex" value="4"/>Thu
3513               </xsl:otherwise>
3514             </xsl:choose>
3515             <xsl:choose>
3516               <xsl:when test="substring(workDays,6,1) = 'W'">
3517                 <input type="checkbox" name="workDayIndex" value="5" checked="checked"/>Fri
3518               </xsl:when>
3519               <xsl:otherwise>
3520                 <input type="checkbox" name="workDayIndex" value="5"/>Fri
3521               </xsl:otherwise>
3522             </xsl:choose>
3523             <xsl:choose>
3524               <xsl:when test="substring(workDays,7,1) = 'W'">
3525                 <input type="checkbox" name="workDayIndex" value="6" checked="checked"/>Sat
3526               </xsl:when>
3527               <xsl:otherwise>
3528                 <input type="checkbox" name="workDayIndex" value="6"/>Sat
3529               </xsl:otherwise>
3530             </xsl:choose>
3531           </td>
3532         </tr>
3533         <tr>
3534           <td class="fieldname">
3535             Workday start:
3536           </td>
3537           <td>
3538             <select name="workDayStart">
3539               <xsl:call-template name="buildWorkdayOptionsList">
3540                 <xsl:with-param name="selectedVal" select="workDayStart"/>
3541               </xsl:call-template>
3542             </select>
3543           </td>
3544         </tr>
3545         <tr>
3546           <td class="fieldname">
3547             Workday end:
3548           </td>
3549           <td>
3550             <xsl:variable name="workDayEnd" select="workDayEnd"/>
3551             <select name="workDayEnd">
3552               <xsl:call-template name="buildWorkdayOptionsList">
3553                 <xsl:with-param name="selectedVal" select="workDayEnd"/>
3554               </xsl:call-template>
3555             </select>
3556           </td>
3557         </tr>
3558         <tr><td colspan="2">&#160;</td></tr>
3559         <tr><td colspan="2" class="fill">Display options:</td></tr>
3560         <xsl:if test="/bedework/views/view[position()=2]">
3561           <!-- only display if there is more than one to select -->
3562           <tr>
3563             <td class="fieldname">
3564               Preferred view:
3565             </td>
3566             <td>
3567               <xsl:variable name="preferredView" select="preferredView"/>
3568               <select name="preferredView">
3569                 <xsl:for-each select="/bedework/views/view">
3570                   <xsl:variable name="viewName" select="name"/>
3571                   <xsl:choose>
3572                     <xsl:when test="viewName = $preferredView">
3573                       <option value="{$viewName}" selected="selected"><xsl:value-of select="name"/></option>
3574                     </xsl:when>
3575                     <xsl:otherwise>
3576                       <option value="{$viewName}"><xsl:value-of select="name"/></option>
3577                     </xsl:otherwise>
3578                   </xsl:choose>
3579                 </xsl:for-each>
3580               </select>
3581             </td>
3582           </tr>
3583         </xsl:if>
3584         <tr>
3585           <td class="fieldname">
3586             Preferred view period:
3587           </td>
3588           <td>
3589             <select name="viewPeriod">
3590               <!-- picking the selected item could be done with javascript. for
3591                    now, this will do.  -->
3592               <xsl:choose>
3593                 <xsl:when test="preferredViewPeriod = 'dayView'">
3594                   <option value="dayView" selected="selected">day</option>
3595                 </xsl:when>
3596                 <xsl:otherwise>
3597                   <option value="dayView">day</option>
3598                 </xsl:otherwise>
3599               </xsl:choose>
3600               <xsl:choose>
3601                 <xsl:when test="preferredViewPeriod = 'todayView'">
3602                   <option value="todayView" selected="selected">today</option>
3603                 </xsl:when>
3604                 <xsl:otherwise>
3605                   <option value="todayView">today</option>
3606                 </xsl:otherwise>
3607               </xsl:choose>
3608               <xsl:choose>
3609                 <xsl:when test="preferredViewPeriod = 'weekView'">
3610                   <option value="weekView" selected="selected">week</option>
3611                 </xsl:when>
3612                 <xsl:otherwise>
3613                   <option value="weekView">week</option>
3614                 </xsl:otherwise>
3615               </xsl:choose>
3616               <xsl:choose>
3617                 <xsl:when test="preferredViewPeriod = 'monthView'">
3618                   <option value="monthView" selected="selected">month</option>
3619                 </xsl:when>
3620                 <xsl:otherwise>
3621                   <option value="monthView">month</option>
3622                 </xsl:otherwise>
3623               </xsl:choose>
3624               <xsl:choose>
3625                 <xsl:when test="preferredViewPeriod = 'yearView'">
3626                   <option value="yearView" selected="selected">year</option>
3627                 </xsl:when>
3628                 <xsl:otherwise>
3629                   <option value="yearView">year</option>
3630                 </xsl:otherwise>
3631               </xsl:choose>
3632             </select>
3633           </td>
3634         </tr>
3635         <!-- as you add skins, update this list and set the selected flag
3636                  as required; hide if not in use -->
3637         <!--<tr>
3638           <td class="fieldname">
3639             Skin name:
3640           </td>
3641           <td>
3642             <xsl:variable name="skinName" select="skinName"/>
3643             <select name="skin">
3644               <option value="default">default</option>
3645             </select>
3646           </td>
3647         </tr> -->
3648         <!-- if you have skin styles, update this list and set the selected flag
3649                  as required; hide if not in use -->
3650         <!--
3651         <tr>
3652           <td class="fieldname">
3653             Skin style:
3654           </td>
3655           <td>
3656             <xsl:variable name="skinStyle" select="skinStyle"/>
3657             <select name="skinStyle">
3658               <option value="default">default</option>
3659             </select>
3660           </td>
3661         </tr> -->
3662         <!-- hide if not in use: -->
3663         <!--<tr>
3664           <td class="fieldname">
3665             Interface mode:
3666           </td>
3667           <td>
3668             <xsl:variable name="userMode" select="userMode"/>
3669             <select name="userMode">
3670               <xsl:choose>
3671                 <xsl:when test="userMode = 0">
3672                   <option value="0" selected="selected">basic</option>
3673                 </xsl:when>
3674                 <xsl:otherwise>
3675                   <option value="0">basic</option>
3676                 </xsl:otherwise>
3677               </xsl:choose>
3678               <xsl:choose>
3679                 <xsl:when test="userMode = 1">
3680                   <option value="1" selected="selected">simple</option>
3681                 </xsl:when>
3682                 <xsl:otherwise>
3683                   <option value="1">simple</option>
3684                 </xsl:otherwise>
3685               </xsl:choose>
3686               <xsl:choose>
3687                 <xsl:when test="userMode = 3">
3688                   <option value="3" selected="selected">advanced</option>
3689                 </xsl:when>
3690                 <xsl:otherwise>
3691                   <option value="3">advanced</option>
3692                 </xsl:otherwise>
3693               </xsl:choose>
3694             </select>
3695           </td>
3696         </tr>-->
3697       </table>
3698       <br />
3699
3700       <input type="submit" name="modPrefs" value="Update"/>
3701       <input type="reset" value="Reset"/>
3702       <input type="submit" name="cancelled" value="Cancel"/>
3703     </form>
3704   </xsl:template>
3705
3706   <!-- construct the workDay times options listings from minute 0 to less than
3707        minute 1440 (midnight inclusive); initialize the template with the currently
3708        selected value. Change the default value for "increment" here. minTime
3709        and maxTime are constants. -->
3710   <xsl:template name="buildWorkdayOptionsList">
3711     <xsl:param name="selectedVal"/>
3712     <xsl:param name="increment" select="number(30)"/>
3713     <xsl:param name="currentTime" select="number(0)"/>
3714     <xsl:variable name="minTime" select="number(0)"/>
3715     <xsl:variable name="maxTime" select="number(1440)"/>
3716     <xsl:if test="$currentTime &lt; $maxTime">
3717       <xsl:choose>
3718         <xsl:when test="$currentTime = $selectedVal">
3719           <option value="{$currentTime}" selected="selected">
3720             <xsl:if test="ceiling($currentTime div 60) &lt; 10">0</xsl:if><xsl:value-of select="ceiling($currentTime div 60)"/>:<xsl:if test="string-length($currentTime mod 60)=1">0</xsl:if><xsl:value-of select="$currentTime mod 60"/>
3721           </option>
3722         </xsl:when>
3723         <xsl:otherwise>
3724           <option value="{$currentTime}">
3725             <xsl:if test="ceiling($currentTime div 60) &lt; 10">0</xsl:if><xsl:value-of select="ceiling($currentTime div 60)"/>:<xsl:if test="string-length($currentTime mod 60)=1">0</xsl:if><xsl:value-of select="$currentTime mod 60"/>
3726           </option>
3727         </xsl:otherwise>
3728       </xsl:choose>
3729       <xsl:call-template name="buildWorkdayOptionsList">
3730         <xsl:with-param name="selectedVal" select="$selectedVal"/>
3731         <xsl:with-param name="currentTime" select="$currentTime + $increment"/>
3732       </xsl:call-template>
3733     </xsl:if>
3734   </xsl:template>
3735
3736   <!--==== SIDE CALENDAR MENU ====-->
3737   <xsl:template match="calendar" mode="sideList">
3738     <xsl:variable name="calPath" select="encodedPath"/>
3739     <div class="std-text">
3740       <a href="{$setSelection}?calPath={$calPath}"><xsl:value-of select="title"/></a>
3741     </div>
3742   </xsl:template>
3743
3744   <!--==== STAND-ALONE PAGES ====-->
3745   <!-- not currently in use -->
3746   <xsl:template name="selectPage">
3747     <!-- <xsl:choose>
3748       <xsl:when test="/bedework/appvar[key='page']">
3749         <xsl:choose>
3750           <xsl:otherwise>
3751             <xsl:call-template name="noPage"/>
3752           </xsl:otherwise>
3753         </xsl:choose>
3754       </xsl:when>
3755       <xsl:otherwise> -->
3756         <xsl:call-template name="noPage"/>
3757       <!--</xsl:otherwise>
3758     </xsl:choose>-->
3759   </xsl:template>
3760
3761   <xsl:template name="noPage">
3762     <p>
3763       Error: there is no page with that name.  Please select a navigational
3764       link to continue.
3765     </p>
3766   </xsl:template>
3767
3768   <!--==== UTILITY TEMPLATES ====-->
3769
3770   <!-- search and replace template taken from
3771        http://www.biglist.com/lists/xsl-list/archives/200211/msg00337.html -->
3772   <xsl:template name="replace">
3773     <xsl:param name="string" select="''"/>
3774     <xsl:param name="pattern" select="''"/>
3775     <xsl:param name="replacement" select="''"/>
3776     <xsl:choose>
3777       <xsl:when test="$pattern != '' and $string != '' and contains($string, $pattern)">
3778         <xsl:value-of select="substring-before($string, $pattern)"/>
3779         <xsl:copy-of select="$replacement"/>
3780         <xsl:call-template name="replace">
3781           <xsl:with-param name="string" select="substring-after($string, $pattern)"/>
3782           <xsl:with-param name="pattern" select="$pattern"/>
3783           <xsl:with-param name="replacement" select="$replacement"/>
3784         </xsl:call-template>
3785       </xsl:when>
3786       <xsl:otherwise>
3787         <xsl:value-of select="$string"/>
3788       </xsl:otherwise>
3789     </xsl:choose>
3790   </xsl:template>
3791
3792   <!--==== FOOTER ====-->
3793   <xsl:template name="footer">
3794     <div id="footer">
3795       Demonstration calendar; place footer information here.
3796     </div>
3797     <table id="skinSelectorTable" border="0" cellpadding="0" cellspacing="0">
3798       <tr>
3799         <td class="leftCell">
3800           <a href="http://www.bedework.org/">Bedework Calendar</a> |
3801           <a href="?noxslt=yes">show XML</a> |
3802           <a href="?refreshXslt=yes">refresh XSLT</a>
3803         </td>
3804         <td class="rightCell">
3805           <!--<form name="skinSelectForm" method="get" action="{$setup}">
3806             skin selector:
3807             <select name="skinNameSticky" onChange="submit()">
3808               <option>select a skin</option>
3809               <option value="default">Demo Calendar</option>
3810               <option value="rensselaer">Rensselaer</option>
3811               <option value="washington">Washington</option>
3812             </select>
3813           </form>-->
3814         </td>
3815       </tr>
3816     </table>
3817   </xsl:template>
3818 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.