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

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

personal client stylesheet and front-end actions now use request parameter "newCalPath" for setting the calendar in which to place an event ("calPath" is used as the source calendar). Now can set the destination calendar for both an imported iCal file and an event reference.

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="calPath" select="calendar/encodedPath"/>
1676     <xsl:variable name="guid" select="guid"/>
1677     <xsl:variable name="recurrenceId" select="recurrenceId"/>
1678     <!-- The name "eventForm" is referenced by several javascript functions. Do not
1679     change it without modifying includes.js -->
1680     <form name="eventForm" method="post" action="{$editEvent}" id="standardForm">
1681       <input type="hidden" name="updateEvent" value="true"/>
1682       <input type="hidden" name="confirmationid" value="{$confId}"/>
1683       <input type="hidden" name="endType" value="date"/>
1684       <h2>Edit Event</h2>
1685       <table class="common" cellspacing="0">
1686         <tr>
1687           <th colspan="2" class="commonHeader">
1688             <div id="eventActions">
1689               <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1690                 View
1691               </a> |
1692               <a href="{$delEvent}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;confirmationid={$confId}">
1693                 Delete
1694               </a>
1695             </div>
1696             Personal Event
1697           </th>
1698         </tr>
1699         <tr>
1700           <td class="fieldname">
1701             Title:
1702           </td>
1703           <td class="fieldval">
1704             <xsl:variable name="title" select="form/title/input/@value"/>
1705             <input type="text" name="editEvent.summary" size="80" value="{$title}"/>
1706           </td>
1707         </tr>
1708         <tr>
1709           <td class="fieldname">
1710             Calendar:
1711           </td>
1712           <td class="fieldval">
1713             <xsl:variable name="newCalPath" select="/bedework/formElements/form/calendar/path"/>
1714             <input type="hidden" name="newCalPath" value="{$newCalPath}"/>
1715             <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
1716             <span id="bwEventCalDisplay">
1717               <xsl:choose>
1718                 <xsl:when test="contains(/bedework/formElements/form/calendar/path,$userPath)">
1719                   <xsl:value-of select="substring-after(/bedework/formElements/form/calendar/path,$userPath)"/>
1720                 </xsl:when>
1721                 <xsl:otherwise>
1722                   <xsl:value-of select="/bedework/formElements/form/calendar/path"/>
1723                 </xsl:otherwise>
1724               </xsl:choose>
1725             </span>
1726             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
1727           </td>
1728         </tr>
1729         <tr>
1730           <td class="fieldname">
1731             Date &amp; Time:
1732           </td>
1733           <td class="fieldval">
1734             <!-- Set the timefields class for the first load of the page;
1735                  subsequent changes will take place using javascript without a
1736                  page reload. -->
1737             <xsl:variable name="timeFieldsClass">
1738               <xsl:choose>
1739                 <xsl:when test="form/allDay/input/@checked='checked'">invisible</xsl:when>
1740                 <xsl:otherwise>timeFields</xsl:otherwise>
1741               </xsl:choose>
1742             </xsl:variable>
1743             <xsl:choose>
1744               <xsl:when test="form/allDay/input/@checked='checked'">
1745                 <input type="checkbox" name="allDayFlag" onclick="swapAllDayEvent(this)" value="on" checked="checked"/>
1746                 <input type="hidden" name="eventStartDate.dateOnly" value="on" id="allDayStartDateField"/>
1747                 <input type="hidden" name="eventEndDate.dateOnly" value="on" id="allDayEndDateField"/>
1748               </xsl:when>
1749               <xsl:otherwise>
1750                 <input type="checkbox" name="allDayFlag" onclick="swapAllDayEvent(this)" value="off"/>
1751                 <input type="hidden" name="eventStartDate.dateOnly" value="off" id="allDayStartDateField"/>
1752                 <input type="hidden" name="eventEndDate.dateOnly" value="off" id="allDayEndDateField"/>
1753               </xsl:otherwise>
1754             </xsl:choose>
1755             all day event<br/>
1756             <div class="dateStartEndBox">
1757               <strong>Start:</strong>
1758               <div class="dateFields">
1759                 <span class="startDateLabel">Date </span>
1760                 <xsl:copy-of select="form/start/month/*"/>
1761                 <xsl:copy-of select="form/start/day/*"/>
1762                 <xsl:choose>
1763                   <xsl:when test="/bedework/creating = 'true'">
1764                     <xsl:copy-of select="form/start/year/*"/>
1765                   </xsl:when>
1766                   <xsl:otherwise>
1767                     <xsl:copy-of select="form/start/yearText/*"/>
1768                   </xsl:otherwise>
1769                 </xsl:choose>
1770               </div>
1771               <script language="JavaScript" type="text/javascript">
1772               <xsl:comment>
1773                 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');
1774               </xsl:comment>
1775               </script>
1776               <!--<img src="{$resourcesRoot}/resources/calIcon.gif" width="16" height="15" border="0"/>-->
1777               <div class="{$timeFieldsClass}" id="startTimeFields">
1778                 <span id="calWidgetStartTimeHider" class="show">
1779                   <xsl:copy-of select="form/start/hour/*"/>
1780                   <xsl:copy-of select="form/start/minute/*"/>
1781                   <xsl:if test="form/start/ampm">
1782                     <xsl:copy-of select="form/start/ampm/*"/>
1783                   </xsl:if>
1784                   <xsl:text> </xsl:text>
1785                   <a href="javascript:bwClockLaunch('eventStartDate');"><img src="{$resourcesRoot}/resources/clockIcon.gif" width="16" height="15" border="0"/></a>
1786                 </span>
1787               </div>
1788             </div>
1789             <div class="dateStartEndBox">
1790               <strong>End:</strong>
1791               <xsl:choose>
1792                 <xsl:when test="form/end/type='E'">
1793                   <input type="radio" name="eventEndType" value="E" checked="checked" onClick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/>
1794                 </xsl:when>
1795                 <xsl:otherwise>
1796                   <input type="radio" name="eventEndType" value="E" onClick="changeClass('endDateTime','shown');changeClass('endDuration','invisible');"/>
1797                 </xsl:otherwise>
1798               </xsl:choose>
1799               Date
1800               <xsl:variable name="endDateTimeClass">
1801                 <xsl:choose>
1802                   <xsl:when test="form/end/type='E'">shown</xsl:when>
1803                   <xsl:otherwise>invisible</xsl:otherwise>
1804                 </xsl:choose>
1805               </xsl:variable>
1806               <div class="{$endDateTimeClass}" id="endDateTime">
1807                 <div class="dateFields">
1808                   <xsl:copy-of select="form/end/dateTime/month/*"/>
1809                   <xsl:copy-of select="form/end/dateTime/day/*"/>
1810                   <xsl:choose>
1811                     <xsl:when test="/bedework/creating = 'true'">
1812                       <xsl:copy-of select="form/end/dateTime/year/*"/>
1813                     </xsl:when>
1814                     <xsl:otherwise>
1815                       <xsl:copy-of select="form/end/dateTime/yearText/*"/>
1816                     </xsl:otherwise>
1817                   </xsl:choose>
1818                 </div>
1819                 <script language="JavaScript" type="text/javascript">
1820                 <xsl:comment>
1821                   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');
1822                 </xsl:comment>
1823                 </script>
1824                 <!--<img src="{$resourcesRoot}/resources/calIcon.gif" width="16" height="15" border="0"/>-->
1825                 <div class="{$timeFieldsClass}" id="endTimeFields">
1826                   <span id="calWidgetEndTimeHider" class="show">
1827                     <xsl:copy-of select="form/end/dateTime/hour/*"/>
1828                     <xsl:copy-of select="form/end/dateTime/minute/*"/>
1829                     <xsl:if test="form/end/dateTime/ampm">
1830                       <xsl:copy-of select="form/end/dateTime/ampm/*"/>
1831                     </xsl:if>
1832                     <xsl:text> </xsl:text>
1833                     <a href="javascript:bwClockLaunch('eventEndDate');"><img src="{$resourcesRoot}/resources/clockIcon.gif" width="16" height="15" border="0"/></a>
1834                   </span>
1835                 </div>
1836               </div><br/>
1837               <div id="clock" class="invisible">
1838                 <xsl:call-template name="clock"/>
1839               </div>
1840               <div class="dateFields">
1841                 <xsl:choose>
1842                   <xsl:when test="form/end/type='D'">
1843                     <input type="radio" name="eventEndType" value="D" checked="checked" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/>
1844                   </xsl:when>
1845                   <xsl:otherwise>
1846                     <input type="radio" name="eventEndType" value="D" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','shown');"/>
1847                   </xsl:otherwise>
1848                 </xsl:choose>
1849                 Duration
1850                 <xsl:variable name="endDurationClass">
1851                   <xsl:choose>
1852                     <xsl:when test="form/end/type='D'">shown</xsl:when>
1853                     <xsl:otherwise>invisible</xsl:otherwise>
1854                   </xsl:choose>
1855                 </xsl:variable>
1856                 <xsl:variable name="durationHrMinClass">
1857                   <xsl:choose>
1858                     <xsl:when test="form/allDay/input/@checked='checked'">invisible</xsl:when>
1859                     <xsl:otherwise>shown</xsl:otherwise>
1860                   </xsl:choose>
1861                 </xsl:variable>
1862                 <div class="{$endDurationClass}" id="endDuration">
1863                   <xsl:choose>
1864                     <xsl:when test="form/end/duration/weeks/input/@value = '0'">
1865                     <!-- we are using day, hour, minute format -->
1866                     <!-- must send either no week value or week value of 0 (zero) -->
1867                       <div class="durationBox">
1868                         <input type="radio" name="eventDuration.type" value="daytime" onclick="swapDurationType('daytime')" checked="checked"/>
1869                         <xsl:variable name="daysStr" select="form/end/duration/days/input/@value"/>
1870                         <input type="text" name="eventDuration.daysStr" size="2" value="{$daysStr}" id="durationDays"/>days
1871                         <span id="durationHrMin" class="{$durationHrMinClass}">
1872                           <xsl:variable name="hoursStr" select="form/end/duration/hours/input/@value"/>
1873                           <input type="text" name="eventDuration.hoursStr" size="2" value="{$hoursStr}" id="durationHours"/>hours
1874                           <xsl:variable name="minutesStr" select="form/end/duration/minutes/input/@value"/>
1875                           <input type="text" name="eventDuration.minutesStr" size="2" value="{$minutesStr}" id="durationMinutes"/>minutes
1876                         </span>
1877                       </div>
1878                       <span class="durationSpacerText">or</span>
1879                       <div class="durationBox">
1880                         <input type="radio" name="eventDuration.type" value="weeks" onclick="swapDurationType('week')"/>
1881                         <xsl:variable name="weeksStr" select="form/end/duration/weeks/input/@value"/>
1882                         <input type="text" name="eventDuration.weeksStr" size="2" value="{$weeksStr}" id="durationWeeks" disabled="true"/>weeks
1883                       </div>
1884                     </xsl:when>
1885                     <xsl:otherwise>
1886                       <!-- we are using week format -->
1887                       <div class="durationBox">
1888                         <input type="radio" name="eventDuration.type" value="daytime" onclick="swapDurationType('daytime')"/>
1889                         <xsl:variable name="daysStr" select="form/end/duration/days/input/@value"/>
1890                         <input type="text" name="eventDuration.daysStr" size="2" value="{$daysStr}" id="durationDays" disabled="true"/>days
1891                         <span id="durationHrMin" class="{$durationHrMinClass}">
1892                           <xsl:variable name="hoursStr" select="form/end/duration/hours/input/@value"/>
1893                           <input type="text" name="eventDuration.hoursStr" size="2" value="{$hoursStr}" id="durationHours" disabled="true"/>hours
1894                           <xsl:variable name="minutesStr" select="form/end/duration/minutes/input/@value"/>
1895                           <input type="text" name="eventDuration.minutesStr" size="2" value="{$minutesStr}" id="durationMinutes" disabled="true"/>minutes
1896                         </span>
1897                       </div>
1898                       <span class="durationSpacerText">or</span>
1899                       <div class="durationBox">
1900                         <input type="radio" name="eventDuration.type" value="weeks" onclick="swapDurationType('week')" checked="checked"/>
1901                         <xsl:variable name="weeksStr" select="form/end/duration/weeks/input/@value"/>
1902                         <input type="text" name="eventDuration.weeksStr" size="2" value="{$weeksStr}" id="durationWeeks"/>weeks
1903                       </div>
1904                     </xsl:otherwise>
1905                   </xsl:choose>
1906                 </div>
1907               </div><br/>
1908               <div class="dateFields" id="noDuration">
1909                 <xsl:choose>
1910                   <xsl:when test="form/end/type='N'">
1911                     <input type="radio" name="eventEndType" value="N" checked="checked" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/>
1912                   </xsl:when>
1913                   <xsl:otherwise>
1914                     <input type="radio" name="eventEndType" value="N" onClick="changeClass('endDateTime','invisible');changeClass('endDuration','invisible');"/>
1915                   </xsl:otherwise>
1916                 </xsl:choose>
1917                 This event has no duration / end date
1918               </div>
1919             </div>
1920           </td>
1921         </tr>
1922         <!--  Status  -->
1923         <tr>
1924           <td class="fieldname">
1925             Status:
1926           </td>
1927           <td class="fieldval">
1928             <xsl:choose>
1929               <xsl:when test="form/status = 'TENTATIVE'">
1930                 <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
1931               </xsl:when>
1932               <xsl:when test="form/status = 'CANCELLED'">
1933                 <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
1934               </xsl:when>
1935               <xsl:otherwise>
1936                 <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
1937               </xsl:otherwise>
1938             </xsl:choose>
1939           </td>
1940         </tr>
1941         <!--  Transparency  -->
1942         <tr>
1943           <td class="fieldname">
1944             Effects free/busy:
1945           </td>
1946           <td class="fieldval">
1947             <xsl:choose>
1948               <xsl:when test="form/transparency = 'TRANSPARENT'">
1949                 <input type="radio" name="editEvent.transparency" value="OPAQUE"/>yes <input type="radio" name="editEvent.transparency" value="TRANSPARENT" checked="checked"/>no
1950               </xsl:when>
1951               <xsl:otherwise>
1952                 <input type="radio" name="editEvent.transparency" value="OPAQUE" checked="checked"/>yes <input type="radio" name="editEvent.transparency" value="TRANSPARENT"/>no
1953               </xsl:otherwise>
1954             </xsl:choose>
1955           </td>
1956         </tr>
1957         <!--  Description  -->
1958         <tr>
1959           <td class="fieldname">Description:</td>
1960           <td class="fieldval">
1961             <textarea name="editEvent.description" cols="60" rows="4">
1962               <xsl:value-of select="/bedework/formElements/form/desc/textarea"/>
1963             </textarea>
1964           </td>
1965         </tr>
1966         <tr>
1967           <td class="fieldname">Location:</td>
1968           <td class="fieldval" align="left">
1969             <span class="std-text">choose: </span>
1970             <span id="eventFormLocationList">
1971               <select name="locationId">
1972                 <option value="-1">select...</option>
1973                 <xsl:copy-of select="/bedework/formElements/form/location/locationmenu/select/*"/>
1974               </select>
1975             </span>
1976             <span class="std-text"> or add new: </span>
1977             <input type="text" name="laddress" value="" />
1978           </td>
1979         </tr>
1980         <tr>
1981           <td class="fieldname">Event Link:</td>
1982           <td class="fieldval">
1983             <xsl:variable name="link" select="form/link/input/@value"/>
1984             <input type="text" name="editEvent.link" size="80" value="{$link}"/>
1985           </td>
1986         </tr>
1987         <tr>
1988           <td class="fieldname">&#160;</td>
1989           <td class="fieldval">
1990             <input name="submit" type="submit" value="Submit Event"/>&#160;
1991             <input name="cancelled" type="submit" value="Cancel"/>
1992           </td>
1993         </tr>
1994       </table>
1995     </form>
1996
1997     <div id="sharingBox">
1998       <h3>Sharing</h3>
1999       <table class="common">
2000         <tr>
2001           <th class="commonHeader" colspan="2">Current access:</th>
2002         </tr>
2003         <tr>
2004           <th>Owner:</th>
2005           <!-- NOTE: we are currently getting the acl information from the
2006                calendar listing NOT from the current calendar (which does not
2007                have the means of producing it out of the action form just now.
2008                We'll fix this soon. -->
2009           <td class="fieldval">
2010             <xsl:value-of select="name(acl/ace[principal/property/owner]/grant/*)"/>
2011           </td>
2012         </tr>
2013         <xsl:if test="acl/ace/principal/href">
2014           <tr>
2015             <th>Users:</th>
2016             <td>
2017               <xsl:for-each select="acl/ace[principal/href]">
2018                 <xsl:value-of select="principal/href"/> (<xsl:value-of select="name(grant/*)"/>)<br/>
2019               </xsl:for-each>
2020             </td>
2021           </tr>
2022         </xsl:if>
2023       </table>
2024       <form name="eventShareForm" action="{$event-setAccess}" id="shareForm">
2025         <input type="hidden" name="calPath" value="{$calPath}"/>
2026         <input type="hidden" name="guid" value="{$guid}"/>
2027         <input type="hidden" name="recurid" value="{$recurrenceId}"/>
2028         <p>
2029           Share this event with:<br/>
2030           <input type="text" name="who" size="20"/>
2031           <input type="radio" value="user" name="whoType" checked="checked"/> user
2032           <input type="radio" value="group" name="whoType"/> group
2033         </p>
2034         <p>
2035           Access rights:<br/>
2036           <input type="radio" value="R" name="how" checked="checked"/> read<br/>
2037           <input type="radio" value="Rc" name="how"/> read/write<br/>
2038           <input type="radio" value="f" name="how"/> read free/busy only<br/>
2039           <input type="radio" value="d" name="how"/> default (reset access)
2040         </p>
2041         <input type="submit" name="submit" value="Submit"/>
2042       </form>
2043     </div>
2044   </xsl:template>
2045
2046   <xsl:template match="event" mode="addEventRef">
2047   <!-- The name "eventForm" is referenced by several javascript functions. Do not
2048     change it without modifying includes.js -->
2049     <form name="eventForm" method="post" action="{$event-addEventRefComplete}" id="standardForm"  enctype="multipart/form-data">
2050       <xsl:variable name="subscriptionId" select="subscription/id"/>
2051       <xsl:variable name="calPath" select="calendar/path"/>
2052       <xsl:variable name="guid" select="guid"/>
2053       <xsl:variable name="recurrenceId" select="recurrenceId"/>
2054       <input type="hidden" name="subid" value="{$subscriptionId}"/>
2055       <input type="hidden" name="calPath" value="{$calPath}"/>
2056       <input type="hidden" name="guid" value="{$guid}"/>
2057       <input type="hidden" name="recurrenceId" value="{$recurrenceId}"/>
2058       <!-- newCalPath is the path to the calendar in which the reference
2059            should be placed.  If no value, then default calendar. -->
2060       <input type="hidden" name="newCalPath" value=""/>
2061
2062       <h2>Add Event Reference</h2>
2063       <table class="common" cellspacing="0">
2064         <tr>
2065           <td class="fieldname">
2066             Event:
2067           </td>
2068           <td>
2069             <xsl:value-of select="summary"/>
2070           </td>
2071         </tr>
2072         <tr>
2073           <td class="fieldname">
2074             Into calendar:
2075           </td>
2076           <td align="left">
2077             <span id="bwEventCalDisplay">
2078               <em>default calendar</em>
2079             </span>
2080             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
2081           </td>
2082         </tr>
2083         <tr>
2084           <td class="fieldname">
2085             Affects Free/busy:
2086           </td>
2087           <td align="left">
2088             <input type="radio" value="true" name="transparency"/> yes
2089             <input type="radio" value="false" name="transparency" checked="checked"/> no
2090           </td>
2091         </tr>
2092       </table>
2093       <table border="0" id="submitTable">
2094         <tr>
2095           <td>
2096             <input name="submit" type="submit" value="Continue"/>
2097             <input name="cancelled" type="submit" value="Cancel"/>
2098           </td>
2099         </tr>
2100       </table>
2101     </form>
2102   </xsl:template>
2103
2104   <!--+++++++++++++++ Free / Busy ++++++++++++++++++++-->
2105   <xsl:template match="freebusy">
2106     <h2>Free / Busy</h2>
2107     <div id="freeBusyWho">for <xsl:value-of select="day/who"/></div>
2108     <table id="freeBusy">
2109       <tr>
2110         <td>&#160;</td>
2111         <xsl:for-each select="day[position()=1]/period">
2112           <th>
2113             <xsl:choose>
2114               <xsl:when test="number(start) mod 200 = 0">
2115                 <xsl:apply-templates select="start" mode="timeDisplay"/>
2116               </xsl:when>
2117               <xsl:otherwise>
2118                 &#160;
2119               </xsl:otherwise>
2120             </xsl:choose>
2121           </th>
2122         </xsl:for-each>
2123       </tr>
2124       <xsl:for-each select="day">
2125         <tr>
2126           <th>
2127             <xsl:value-of select="substring(start,1,4)"/>-<xsl:value-of select="substring(start,5,2)"/>-<xsl:value-of select="substring(start,7,2)"/>
2128           </th>
2129           <xsl:for-each select="period">
2130             <xsl:variable name="startTime"><xsl:apply-templates  select="start" mode="timeDisplay"/></xsl:variable>
2131             <!-- the start date for the add event link is a concat of the day's date plus the period's time (+ seconds)-->
2132             <xsl:variable name="startDate"><xsl:value-of select="substring(../start,1,8)"/>T<xsl:value-of select="start"/>00</xsl:variable>
2133             <xsl:variable name="minutes" select="length"/>
2134             <xsl:choose>
2135               <xsl:when test="fbtype = '0'">
2136                 <td class="busy">
2137                   <a href="{$initEvent}?startdate={$startDate}&amp;minutes={$minutes}" title="{$startTime}">*</a>
2138                 </td>
2139               </xsl:when>
2140               <xsl:otherwise>
2141                 <td class="free">
2142                   <a href="{$initEvent}?startdate={$startDate}&amp;minutes={$minutes}" title="{$startTime}">*</a>
2143                 </td>
2144               </xsl:otherwise>
2145             </xsl:choose>
2146           </xsl:for-each>
2147         </tr>
2148       </xsl:for-each>
2149     </table>
2150
2151     <table id="freeBusyKey">
2152       <tr>
2153         <td class="free">*</td>
2154         <td>free</td>
2155         <td>&#160;</td>
2156         <td class="busy">*</td>
2157         <td>busy</td>
2158         <td>&#160;</td>
2159         <td>
2160           <form name="calendarShareForm" action="{$freeBusy-fetch}">
2161             View user's free/busy:<br/>
2162             <input type="text" name="userid" size="20"/>
2163             <input type="submit" name="submit" value="Submit"/>
2164           </form>
2165         </td>
2166       </tr>
2167     </table>
2168
2169     <div id="sharingBox">
2170       <h3>Sharing</h3>
2171       <table class="common">
2172         <tr>
2173           <th class="commonHeader" colspan="2">Current access:</th>
2174         </tr>
2175         <tr>
2176           <th>Users:</th>
2177           <td>
2178             <xsl:choose>
2179               <xsl:when test="/bedework/myCalendars/calendars/calendar/acl/ace/principal/href">
2180                 <xsl:for-each select="/bedework/myCalendars/calendars/calendar/acl/ace[principal/href]">
2181                   <xsl:value-of select="principal/href"/> (<xsl:value-of select="name(grant/*)"/>)<br/>
2182                 </xsl:for-each>
2183               </xsl:when>
2184               <xsl:otherwise>
2185                 free/busy not shared
2186               </xsl:otherwise>
2187             </xsl:choose>
2188           </td>
2189         </tr>
2190       </table>
2191       <form name="calendarShareForm" action="{$freeBusy-setAccess}" id="shareForm">
2192         <xsl:variable name="calPath" select="/bedework/myCalendars/calendars/calendar/path"/>
2193         <input type="hidden" name="calPath" value="{$calPath}"/>
2194         <p>
2195           Share my free/busy with:<br/>
2196           <input type="text" name="who" size="20"/>
2197           <input type="radio" value="user" name="whoType" checked="checked"/> user
2198           <input type="radio" value="group" name="whoType"/> group
2199         </p>
2200         <p>
2201           Access rights:<br/>
2202           <input type="radio" value="f" name="how" checked="checked"/> view my free/busy<br/>
2203           <input type="radio" value="d" name="how"/> default (reset access)
2204         </p>
2205         <input type="submit" name="submit" value="Submit"/>
2206       </form>
2207     </div>
2208   </xsl:template>
2209
2210   <xsl:template match="start" mode="timeDisplay">
2211     <xsl:choose>
2212       <xsl:when test="node()=0000">12am</xsl:when>
2213       <xsl:when test="node()=0100">1am</xsl:when>
2214       <xsl:when test="node()=0200">2am</xsl:when>
2215       <xsl:when test="node()=0300">3am</xsl:when>
2216       <xsl:when test="node()=0400">4am</xsl:when>
2217       <xsl:when test="node()=0500">5am</xsl:when>
2218       <xsl:when test="node()=0600">6am</xsl:when>
2219       <xsl:when test="node()=0700">7am</xsl:when>
2220       <xsl:when test="node()=0800">8am</xsl:when>
2221       <xsl:when test="node()=0900">9am</xsl:when>
2222       <xsl:when test="node()=1000">10am</xsl:when>
2223       <xsl:when test="node()=1100">11am</xsl:when>
2224       <xsl:when test="node()=1200">NOON</xsl:when>
2225       <xsl:when test="node()=1300">1pm</xsl:when>
2226       <xsl:when test="node()=1400">2pm</xsl:when>
2227       <xsl:when test="node()=1500">3pm</xsl:when>
2228       <xsl:when test="node()=1600">4pm</xsl:when>
2229       <xsl:when test="node()=1700">5pm</xsl:when>
2230       <xsl:when test="node()=1800">6pm</xsl:when>
2231       <xsl:when test="node()=1900">7pm</xsl:when>
2232       <xsl:when test="node()=2000">8pm</xsl:when>
2233       <xsl:when test="node()=2100">9pm</xsl:when>
2234       <xsl:when test="node()=2200">10pm</xsl:when>
2235       <xsl:when test="node()=2300">11pm</xsl:when>
2236       <xsl:when test="node()=2400">12am</xsl:when>
2237       <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2238     </xsl:choose>
2239   </xsl:template>
2240
2241   <!--+++++++++++++++ Calendars ++++++++++++++++++++-->
2242   <xsl:template match="calendars">
2243     <h2>Manage Calendars</h2>
2244     <table id="calendarTable">
2245       <tr>
2246         <td class="cals">
2247           <h3>Calendars</h3>
2248           <ul class="calendarTree">
2249             <xsl:choose>
2250               <xsl:when test="/bedework/page='calendarDescriptions' or
2251                               /bedework/page='displayCalendar'">
2252                 <xsl:apply-templates select="calendar" mode="listForDisplay"/>
2253               </xsl:when>
2254               <xsl:otherwise>
2255                 <xsl:apply-templates select="calendar" mode="listForUpdate"/>
2256               </xsl:otherwise>
2257             </xsl:choose>
2258           </ul>
2259         </td>
2260         <td class="calendarContent">
2261           <xsl:choose>
2262             <xsl:when test="/bedework/page='calendarList' or
2263                             /bedework/page='calendarReferenced'">
2264               <xsl:call-template name="calendarList"/>
2265             </xsl:when>
2266             <xsl:when test="/bedework/page='calendarDescriptions'">
2267               <xsl:call-template name="calendarDescriptions"/>
2268             </xsl:when>
2269             <xsl:when test="/bedework/page='displayCalendar'">
2270               <xsl:apply-templates select="/bedework/currentCalendar" mode="displayCalendar"/>
2271             </xsl:when>
2272             <xsl:when test="/bedework/page='deleteCalendarConfirm'">
2273               <xsl:apply-templates select="/bedework/currentCalendar" mode="deleteCalendarConfirm"/>
2274             </xsl:when>
2275             <xsl:when test="/bedework/creating='true'">
2276               <xsl:apply-templates select="/bedework/currentCalendar" mode="addCalendar"/>
2277             </xsl:when>
2278             <xsl:otherwise>
2279               <xsl:apply-templates select="/bedework/currentCalendar" mode="modCalendar"/>
2280             </xsl:otherwise>
2281           </xsl:choose>
2282         </td>
2283       </tr>
2284     </table>
2285   </xsl:template>
2286
2287   <xsl:template match="calendar" mode="myCalendars">
2288     <!-- supress Inbox and Outbox for the moment -->
2289     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2290       <xsl:variable name="id" select="id"/>
2291       <xsl:variable name="itemClass">
2292         <xsl:choose>
2293           <xsl:when test="/bedework/selectionState/selectionType = 'calendar'
2294                           and path = /bedework/selectionState/subscriptions/subscription/calendar/path">selected</xsl:when>
2295           <xsl:when test="name='Trash'">trash</xsl:when>
2296           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2297           <xsl:otherwise>calendar</xsl:otherwise>
2298         </xsl:choose>
2299       </xsl:variable>
2300       <li class="{$itemClass}">
2301         <xsl:variable name="calPath" select="path"/>
2302         <a href="{$setSelection}?calUrl={$calPath}">
2303           <xsl:value-of select="name"/>
2304         </a>
2305         <xsl:if test="calendar">
2306           <ul>
2307             <xsl:apply-templates select="calendar" mode="myCalendars"/>
2308           </ul>
2309         </xsl:if>
2310         <xsl:if test="calendarCollection='true'">
2311           <!-- set the start date for adding an event to the first day of the
2312                given period, the hour of "now", and give a duration of 60 minutes -->
2313           <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>
2314           <a href="{$initEvent}?startdate={$startDate}&amp;calPath={$calPath}&amp;minutes=60" class="calendarAdd" title="add event">
2315             <img src="{$resourcesRoot}/resources/addEvent-forCals-icon.gif" width="9" height="12" border="0" alt="add event"/>
2316           </a>
2317         </xsl:if>
2318       </li>
2319     </xsl:if>
2320   </xsl:template>
2321
2322   <xsl:template match="calendar" mode="listForUpdate">
2323     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2324       <xsl:variable name="calPath" select="encodedPath"/>
2325       <xsl:variable name="itemClass">
2326         <xsl:choose>
2327           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2328           <xsl:otherwise>calendar</xsl:otherwise>
2329         </xsl:choose>
2330       </xsl:variable>
2331       <li class="{$itemClass}">
2332         <a href="{$calendar-fetchForUpdate}&amp;calPath={$calPath}" title="update">
2333           <xsl:value-of select="name"/>
2334         </a>
2335         <xsl:if test="calendarCollection='false'">
2336           <xsl:text> </xsl:text>
2337           <a href="{$calendar-initAdd}&amp;calPath={$calPath}" title="add a calendar or folder">
2338             <img src="{$resourcesRoot}/resources/calAddIcon.gif" width="13" height="13" alt="add a calendar or folder" border="0"/>
2339           </a>
2340         </xsl:if>
2341         <xsl:if test="calendar">
2342           <ul>
2343             <xsl:apply-templates select="calendar" mode="listForUpdate">
2344               <!--<xsl:sort select="title" order="ascending" case-order="upper-first"/>-->
2345             </xsl:apply-templates>
2346           </ul>
2347         </xsl:if>
2348       </li>
2349     </xsl:if>
2350   </xsl:template>
2351
2352   <xsl:template match="calendar" mode="listForDisplay">
2353     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2354       <xsl:variable name="calPath" select="encodedPath"/>
2355       <xsl:variable name="itemClass">
2356         <xsl:choose>
2357           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2358           <xsl:otherwise>calendar</xsl:otherwise>
2359         </xsl:choose>
2360       </xsl:variable>
2361       <li class="{$itemClass}">
2362         <a href="{$calendar-fetchForDisplay}&amp;calPath={$calPath}" title="display">
2363           <xsl:value-of select="name"/>
2364         </a>
2365         <xsl:if test="calendar">
2366           <ul>
2367             <xsl:apply-templates select="calendar" mode="listForDisplay">
2368               <!--<xsl:sort select="title" order="ascending" case-order="upper-first"/>-->
2369             </xsl:apply-templates>
2370           </ul>
2371         </xsl:if>
2372       </li>
2373     </xsl:if>
2374   </xsl:template>
2375
2376   <!-- the selectCalForEvent listing creates a calendar tree in a pop-up window
2377        from myCalendars and mySubscriptions -->
2378   <xsl:template name="selectCalForEvent">
2379     <h2>Select a calendar</h2>
2380     <form name="toggleCals" action="{$event-selectCalForEvent}">
2381       <xsl:choose>
2382         <xsl:when test="/bedework/appvar[key='showAllCalsForEvent']/value = 'true'">
2383           <input type="radio" name="setappvar" value="showAllCalsForEvent(false)" onchange="submit()"/>
2384           show only writable calendars
2385           <input type="radio" name="setappvar" value="showAllCalsForEvent(true)" checked="checked" onchange="submit()"/>
2386           show all calendars
2387         </xsl:when>
2388         <xsl:otherwise>
2389           <input type="radio" name="setappvar" value="showAllCalsForEvent(false)" checked="checked" onchange="submit()"/>
2390           show only writable calendars
2391           <input type="radio" name="setappvar" value="showAllCalsForEvent(true)" onchange="submit()"/>
2392           show all calendars
2393         </xsl:otherwise>
2394       </xsl:choose>
2395     </form>
2396     <h4>My Calendars</h4>
2397     <ul class="calendarTree">
2398       <xsl:choose>
2399         <xsl:when test="/bedework/appvar[key='showAllCalsForEvent']/value = 'true'">
2400           <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar" mode="selectCalForEventCalTree"/>
2401         </xsl:when>
2402         <xsl:otherwise>
2403           <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar[currentAccess/current-user-privilege-set/privilege/write-content]" mode="selectCalForEventCalTree"/>
2404         </xsl:otherwise>
2405       </xsl:choose>
2406     </ul>
2407     <h4>Subscribed Calendars</h4>
2408     <ul class="calendarTree">
2409       <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/></xsl:variable>
2410       <xsl:choose>
2411         <xsl:when test="/bedework/appvar[key='showAllCalsForEvent']/value = 'true'">
2412           <xsl:apply-templates select="/bedework/mySubscriptions/subscription[not(contains(uri,$userPath))]/calendars/calendar" mode="selectCalForEventCalTree"/>
2413         </xsl:when>
2414         <xsl:otherwise>
2415           <xsl:apply-templates select="/bedework/mySubscriptions/subscription[not(contains(uri,$userPath))]/calendars/calendar[currentAccess/current-user-privilege-set/privilege/write-content]" mode="selectCalForEventCalTree"/>
2416         </xsl:otherwise>
2417       </xsl:choose>
2418     </ul>
2419   </xsl:template>
2420
2421   <xsl:template match="calendar" mode="selectCalForEventCalTree">
2422   <!-- supress Inbox and Outbox for the moment -->
2423     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2424       <xsl:variable name="id" select="id"/>
2425       <xsl:variable name="itemClass">
2426         <xsl:choose>
2427           <xsl:when test="/bedework/selectionState/selectionType = 'calendar'
2428                           and name = /bedework/selectionState/subscriptions/subscription/calendar/name">selected</xsl:when>
2429           <xsl:when test="name='Trash'">trash</xsl:when>
2430           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2431           <xsl:otherwise>calendar</xsl:otherwise>
2432         </xsl:choose>
2433       </xsl:variable>
2434       <li class="{$itemClass}">
2435         <xsl:variable name="calPath" select="path"/>
2436         <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
2437         <xsl:variable name="calDisplay">
2438           <xsl:choose>
2439             <xsl:when test="contains(path,$userPath)">
2440               <xsl:value-of select="substring-after(path,$userPath)"/>
2441             </xsl:when>
2442             <xsl:otherwise>
2443               <xsl:value-of select="path"/>
2444             </xsl:otherwise>
2445           </xsl:choose>
2446         </xsl:variable>
2447         <xsl:choose>
2448           <xsl:when test="currentAccess/current-user-privilege-set/privilege/write-content and (calendarCollection = 'true')">
2449             <a href="javascript:updateEventFormCalendar('{$calPath}','{$calDisplay}')">
2450               <strong><xsl:value-of select="name"/></strong>
2451             </a>
2452           </xsl:when>
2453           <xsl:otherwise>
2454             <xsl:value-of select="name"/>
2455           </xsl:otherwise>
2456         </xsl:choose>
2457         <xsl:if test="calendar">
2458           <ul>
2459             <xsl:apply-templates select="calendar" mode="selectCalForEventCalTree"/>
2460           </ul>
2461         </xsl:if>
2462       </li>
2463     </xsl:if>
2464   </xsl:template>
2465
2466   <xsl:template match="currentCalendar" mode="addCalendar">
2467     <h3>Add Calendar / Folder</h3>
2468     <form name="addCalForm" action="{$calendar-update}">
2469       <table class="common">
2470         <tr>
2471           <th>Name:</th>
2472           <td>
2473             <xsl:variable name="curCalName" select="name"/>
2474             <input name="calendar.name" value="{$curCalName}" size="40"/>
2475           </td>
2476         </tr>
2477         <tr>
2478           <th>Summary:</th>
2479           <td>
2480             <xsl:variable name="curCalSummary" select="summary"/>
2481             <input type="text" name="calendar.summary" value="{$curCalSummary}" size="40"/>
2482           </td>
2483         </tr>
2484         <tr>
2485           <th>Description:</th>
2486           <td>
2487             <textarea name="calendar.description" cols="40" rows="4">
2488               <xsl:value-of select="desc"/>
2489             </textarea>
2490           </td>
2491         </tr>
2492         <tr>
2493           <th>Calendar/Folder:</th>
2494           <td>
2495             <xsl:choose>
2496               <xsl:when test="calendarCollection='true'">
2497                 <input type="radio" value="true" name="calendarCollection" checked="checked"/> Calendar
2498                 <input type="radio" value="false" name="calendarCollection"/> Folder
2499               </xsl:when>
2500               <xsl:otherwise>
2501                 <input type="radio" value="true" name="calendarCollection"/> Calendar
2502                 <input type="radio" value="false" name="calendarCollection" checked="checked"/> Folder
2503               </xsl:otherwise>
2504             </xsl:choose>
2505           </td>
2506         </tr>
2507       </table>
2508
2509       <table border="0" id="submitTable">
2510         <tr>
2511           <td>
2512             <input type="submit" name="addCalendar" value="Add Calendar/Folder"/>
2513             <input type="submit" name="cancelled" value="Cancel"/>
2514             <input type="reset" value="Clear"/>
2515           </td>
2516         </tr>
2517       </table>
2518     </form>
2519
2520     <div id="sharingBox">
2521       <h3>Sharing</h3>
2522       Sharing may be added to a calendar once created.
2523     </div>
2524
2525   </xsl:template>
2526
2527   <xsl:template match="currentCalendar" mode="modCalendar">
2528     <xsl:choose>
2529       <xsl:when test="calendarCollection='true'">
2530         <h3>Modify Calendar</h3>
2531       </xsl:when>
2532       <xsl:otherwise>
2533         <h3>Modify Folder</h3>
2534       </xsl:otherwise>
2535     </xsl:choose>
2536     <xsl:variable name="calPath" select="path"/>
2537     <form name="modCalForm" action="{$calendar-update}">
2538       <table class="common">
2539         <tr>
2540           <th class="commonHeader" colspan="2">
2541             <xsl:value-of select="path"/>
2542           </th>
2543         </tr>
2544         <tr>
2545           <th>Name:</th>
2546           <td>
2547             <xsl:value-of select="name"/>
2548           </td>
2549         </tr>
2550         <tr>
2551           <th>Mailing List ID:</th>
2552           <td>
2553             <xsl:value-of select="mailListId"/>
2554           </td>
2555         </tr>
2556         <tr>
2557           <th>Summary:</th>
2558           <td>
2559             <xsl:variable name="curCalSummary" select="summary"/>
2560             <input type="text" name="calendar.summary" value="{$curCalSummary}" size="40"/>
2561           </td>
2562         </tr>
2563         <tr>
2564           <th>Description:</th>
2565           <td>
2566             <textarea name="calendar.description" cols="40" rows="4">
2567               <xsl:value-of select="desc"/>
2568             </textarea>
2569           </td>
2570         </tr>
2571         <tr>
2572           <th>Calendar/Folder:</th>
2573           <td>
2574             <xsl:choose>
2575               <xsl:when test="calendarCollection='true'">
2576                 <input type="radio" value="true" name="calendarCollection" checked="checked"/> Calendar
2577                 <input type="radio" value="false" name="calendarCollection"/> Folder
2578               </xsl:when>
2579               <xsl:otherwise>
2580                 <input type="radio" value="true" name="calendarCollection"/> Calendar
2581                 <input type="radio" value="false" name="calendarCollection" checked="checked"/> Folder
2582               </xsl:otherwise>
2583             </xsl:choose>
2584           </td>
2585         </tr>
2586       </table>
2587
2588       <table border="0" id="submitTable">
2589         <tr>
2590           <td>
2591             <xsl:choose>
2592               <xsl:when test="calendarCollection='true'">
2593                 <input type="submit" name="updateCalendar" value="Update Calendar"/>
2594               </xsl:when>
2595               <xsl:otherwise>
2596                 <input type="submit" name="updateCalendar" value="Update Folder"/>
2597               </xsl:otherwise>
2598             </xsl:choose>
2599             <input type="submit" name="cancelled" value="Cancel"/>
2600             <input type="reset" value="Reset"/>
2601           </td>
2602           <td align="right">
2603             <xsl:choose>
2604               <xsl:when test="calendarCollection='true'">
2605                 <input type="submit" name="delete" value="Delete Calendar"/>
2606               </xsl:when>
2607               <xsl:otherwise>
2608                 <input type="submit" name="delete" value="Delete Folder"/>
2609               </xsl:otherwise>
2610             </xsl:choose>
2611           </td>
2612         </tr>
2613       </table>
2614     </form>
2615     <div id="sharingBox">
2616       <h3>Sharing</h3>
2617       <table class="common">
2618         <tr>
2619           <th class="commonHeader" colspan="2">Current access:</th>
2620         </tr>
2621         <tr>
2622           <th>Owner:</th>
2623           <!-- NOTE: we are currently getting the acl information from the
2624                calendar listing NOT from the current calendar (which does not
2625                have the means of producing it out of the action form just now.
2626                We'll fix this soon. -->
2627           <td>
2628             <xsl:value-of select="name(/bedework/calendars//calendar[path=$calPath]/acl/ace[principal/property/owner]/grant/*)"/>
2629           </td>
2630         </tr>
2631         <xsl:if test="/bedework/calendars//calendar[path=$calPath]/acl/ace/principal/href">
2632           <tr>
2633             <th>Users:</th>
2634             <td>
2635               <xsl:for-each select="/bedework/calendars//calendar[path=$calPath]/acl/ace[principal/href]">
2636                 <xsl:value-of select="principal/href"/> (<xsl:value-of select="name(grant/*)"/>)<br/>
2637               </xsl:for-each>
2638             </td>
2639           </tr>
2640         </xsl:if>
2641       </table>
2642       <form name="calendarShareForm" action="{$calendar-setAccess}" id="shareForm">
2643         <input type="hidden" name="calPath" value="{$calPath}"/>
2644         <p>
2645           Share this calendar with:<br/>
2646           <input type="text" name="who" size="20"/>
2647           <input type="radio" value="user" name="whoType" checked="checked"/> user
2648           <input type="radio" value="group" name="whoType"/> group
2649         </p>
2650         <p>
2651           Access rights:<br/>
2652           <input type="radio" value="R" name="how" checked="checked"/> read<br/>
2653           <input type="radio" value="Rc" name="how"/> read/write<br/>
2654           <input type="radio" value="f" name="how"/> read free/busy only<br/>
2655           <input type="radio" value="d" name="how"/> default (reset access)
2656         </p>
2657         <input type="submit" name="submit" value="Submit"/>
2658       </form>
2659     </div>
2660   </xsl:template>
2661
2662   <xsl:template name="calendarList">
2663     <h3>Managing Calendars</h3>
2664     <ul>
2665       <li>Select an item from the calendar list on the left to modify
2666       a calendar or folder.</li>
2667       <li>Select the
2668       <img src="{$resourcesRoot}/resources/calAddIcon.gif" width="13" height="13" alt="true" border="0"/>
2669       icon to add a new calendar or folder to the tree.
2670         <ul>
2671           <li>Folders may only contain calendars and subfolders.</li>
2672           <li>Calendars may only contain events (and other calendar items).</li>
2673           <li>
2674             If a calendar is empty, it may be converted to a folder and vice
2675             versa.  If a calendar or folder are not empty, it may not be
2676             converted.
2677           </li>
2678         </ul>
2679       </li>
2680     </ul>
2681   </xsl:template>
2682
2683   <xsl:template name="calendarDescriptions">
2684     <h2>Calendar Information</h2>
2685     <ul>
2686       <li>Select an item from the calendar tree on the left to view all information
2687       about that calendar or folder.  The tree on the left represents the calendar
2688       heirarchy.</li>
2689     </ul>
2690
2691     <p><strong>All Calendar Descriptions:</strong></p>
2692     <table id="flatCalendarDescriptions" cellspacing="0">
2693       <tr>
2694         <th>Name</th>
2695         <th>Description</th>
2696       </tr>
2697       <xsl:for-each select="//calendar">
2698         <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2699           <xsl:variable name="descClass">
2700             <xsl:choose>
2701               <xsl:when test="position() mod 2 = 0">even</xsl:when>
2702               <xsl:otherwise>odd</xsl:otherwise>
2703             </xsl:choose>
2704           </xsl:variable>
2705           <tr class="{$descClass}">
2706             <td>
2707               <xsl:value-of select="name"/>
2708             </td>
2709             <td>
2710               <xsl:value-of select="desc"/>
2711             </td>
2712           </tr>
2713         </xsl:if>
2714       </xsl:for-each>
2715     </table>
2716   </xsl:template>
2717
2718   <xsl:template match="currentCalendar" mode="displayCalendar">
2719     <h2>Calendar Information</h2>
2720     <table class="common">
2721       <tr>
2722         <th>Name:</th>
2723         <td>
2724           <xsl:value-of select="name"/>
2725         </td>
2726       </tr>
2727       <tr>
2728         <th>Path:</th>
2729         <td>
2730           <xsl:value-of select="path"/>
2731         </td>
2732       </tr>
2733       <tr>
2734         <th>Summary:</th>
2735         <td>
2736           <xsl:value-of select="summary"/>
2737         </td>
2738       </tr>
2739       <tr>
2740         <th>Description:</th>
2741         <td>
2742           <xsl:value-of select="desc"/>
2743         </td>
2744       </tr>
2745     </table>
2746   </xsl:template>
2747
2748   <xsl:template match="currentCalendar" mode="deleteCalendarConfirm">
2749     <xsl:choose>
2750       <xsl:when test="calendarCollection='true'">
2751         <h3>Delete Calendar</h3>
2752         <p>
2753           The following calendar will be deleted.  Continue?
2754         </p>
2755       </xsl:when>
2756       <xsl:otherwise>
2757         <h3>Delete Folder</h3>
2758         <p>
2759           The following folder <em>and all its contents</em> will be deleted.
2760           Continue?
2761         </p>
2762       </xsl:otherwise>
2763     </xsl:choose>
2764
2765     <form name="delCalForm" action="{$calendar-delete}">
2766       <table class="common">
2767         <tr>
2768           <th>Path:</th>
2769           <td>
2770             <xsl:value-of select="path"/>
2771           </td>
2772         </tr>
2773         <tr>
2774           <th>Name:</th>
2775           <td>
2776             <xsl:value-of select="name"/>
2777           </td>
2778         </tr>
2779         <tr>
2780           <th>Summary:</th>
2781           <td>
2782             <xsl:value-of select="summary"/>
2783           </td>
2784         </tr>
2785         <tr>
2786           <th>Description:</th>
2787           <td>
2788             <xsl:value-of select="desc"/>
2789           </td>
2790         </tr>
2791       </table>
2792
2793       <table border="0" id="submitTable">
2794         <tr>
2795           <td>
2796             <input type="submit" name="cancelled" value="Cancel"/>
2797           </td>
2798           <td align="right">
2799             <xsl:choose>
2800               <xsl:when test="calendarCollection='true'">
2801                 <input type="submit" name="delete" value="Yes: Delete Calendar!"/>
2802               </xsl:when>
2803               <xsl:otherwise>
2804                 <input type="submit" name="delete" value="Yes: Delete Folder!"/>
2805               </xsl:otherwise>
2806             </xsl:choose>
2807           </td>
2808         </tr>
2809       </table>
2810     </form>
2811
2812   </xsl:template>
2813
2814   <!--+++++++++++++++ Subscriptions ++++++++++++++++++++-->
2815   <xsl:template match="subscriptions">
2816     <h2>Manage Subscriptions</h2>
2817     <table id="subsTable">
2818       <tr>
2819         <td class="cals">
2820           <p class="smaller">
2821             Select a calendar below to add a <em><strong>new</strong></em>
2822             internal subscription. <!-- or
2823             <a href="{$subscriptions-initAdd}&amp;calUri=please enter a calendar uri">
2824             subscribe to an external calendar</a>.-->
2825           </p>
2826           <h3>My calendars</h3>
2827           <ul class="calendarTree">
2828             <xsl:apply-templates select="/bedework/myCalendars/calendars/calendar" mode="subscribe"/>
2829           </ul>
2830           <h3>Public calendars</h3>
2831           <ul class="calendarTree">
2832             <xsl:apply-templates select="/bedework/subscriptions/subscribe/calendars/calendar" mode="subscribe"/>
2833           </ul>
2834         </td>
2835         <td class="subs">
2836           <xsl:choose>
2837             <xsl:when test="/bedework/page='subscriptions'">
2838               <xsl:call-template name="subscriptionList"/>
2839             </xsl:when>
2840             <xsl:when test="/bedework/creating='true'">
2841               <xsl:apply-templates select="subscription" mode="addSubscription"/>
2842             </xsl:when>
2843             <xsl:otherwise>
2844               <xsl:apply-templates select="subscription" mode="modSubscription"/>
2845             </xsl:otherwise>
2846           </xsl:choose>
2847         </td>
2848       </tr>
2849     </table>
2850   </xsl:template>
2851
2852   <xsl:template match="calendar" mode="subscribe">
2853     <xsl:if test="(name != 'Inbox') and (name != 'Outbox') and (name != 'Deleted')">
2854       <xsl:variable name="calPath" select="encodedPath"/>
2855       <xsl:variable name="itemClass">
2856         <xsl:choose>
2857           <xsl:when test="calendarCollection='false'">folder</xsl:when>
2858           <xsl:otherwise>calendar</xsl:otherwise>
2859         </xsl:choose>
2860       </xsl:variable>
2861       <li class="{$itemClass}">
2862         <a href="{$subscriptions-initAdd}&amp;calPath={$calPath}">
2863           <xsl:value-of select="name"/>
2864         </a>
2865         <xsl:if test="calendar">
2866           <ul>
2867             <xsl:apply-templates select="calendar" mode="subscribe">
2868               <!--<xsl:sort select="title" order="ascending" case-order="upper-first"/>-->
2869             </xsl:apply-templates>
2870           </ul>
2871         </xsl:if>
2872       </li>
2873     </xsl:if>
2874   </xsl:template>
2875
2876   <xsl:template match="subscription" mode="addSubscription">
2877     <h3>Add New Subscription</h3>
2878     <p class="note">*the subsciption name must be unique</p>
2879     <form name="subscribeForm" action="{$subscriptions-subscribe}" method="post">
2880       <table class="common" cellspacing="0">
2881         <tr>
2882           <td class="fieldname">Name:</td>
2883           <td>
2884             <xsl:variable name="subName" select="name"/>
2885             <input type="text" value="{$subName}" name="subscription.name" size="60"/>
2886           </td>
2887         </tr>
2888         <xsl:if test="internal='false'">
2889           <tr>
2890             <td class="fieldname">Uri:</td>
2891             <td>
2892               <xsl:variable name="subUri" select="uri"/>
2893               <input type="text" value="{$subUri}" name="subscription.uri" size="60"/>
2894             </td>
2895           </tr>
2896         </xsl:if>
2897         <tr>
2898           <td class="fieldname">Display:</td>
2899           <td>
2900             <input type="radio" value="true" name="subscription.display" checked="checked"/> yes
2901             <input type="radio" value="false" name="subscription.display"/> no
2902           </td>
2903         </tr>
2904         <tr>
2905           <td class="fieldname">Affects Free/Busy:</td>
2906           <td>
2907             <input type="radio" value="true" name="subscription.affectsFreeBusy" checked="checked"/> yes
2908             <input type="radio" value="false" name="subscription.affectsFreeBusy"/> no
2909           </td>
2910         </tr>
2911         <tr>
2912           <td class="fieldname">Style:</td>
2913           <td>
2914             <xsl:variable name="subStyle" select="style"/>
2915             <input type="text" value="{$subStyle}" name="subscription.style" size="60"/>
2916           </td>
2917         </tr>
2918         <!--<tr>
2919           <td class="fieldname">Unremovable:</td>
2920           <td>
2921             <input type="radio" value="true" name="unremoveable" size="60"/> true
2922             <input type="radio" value="false" name="unremoveable" size="60" checked="checked"/> false
2923           </td>
2924         </tr>-->
2925       </table>
2926       <table border="0" id="submitTable">
2927         <tr>
2928           <td>
2929             <input type="submit" name="addSubscription" value="Add Subscription"/>
2930             <input type="submit" name="cancelled" value="Cancel"/>
2931             <input type="reset" value="Clear"/>
2932           </td>
2933         </tr>
2934       </table>
2935     </form>
2936   </xsl:template>
2937
2938   <xsl:template match="subscription" mode="modSubscription">
2939     <h3>Modify Subscription</h3>
2940     <form name="subscribeForm" action="{$subscriptions-subscribe}" method="post">
2941       <table class="common" cellspacing="0">
2942         <tr>
2943           <td class="fieldname">Name:</td>
2944           <td>
2945             <xsl:value-of select="name"/>
2946             <xsl:variable name="subName" select="name"/>
2947             <input type="hidden" value="{$subName}" name="name"/>
2948           </td>
2949         </tr>
2950         <xsl:choose>
2951           <xsl:when test="internal='false'">
2952             <tr>
2953               <td class="fieldname">Uri:</td>
2954               <td>
2955                 <xsl:variable name="subUri" select="uri"/>
2956                 <input type="text" value="{$subUri}" name="subscription.uri" size="60"/>
2957               </td>
2958             </tr>
2959           </xsl:when>
2960           <xsl:otherwise>
2961             <tr>
2962               <td class="fieldname">Uri:</td>
2963               <td>
2964                 <xsl:value-of select="uri"/>
2965               </td>
2966             </tr>
2967           </xsl:otherwise>
2968         </xsl:choose>
2969         <tr>
2970           <td class="fieldname">Display:</td>
2971           <td>
2972             <xsl:choose>
2973               <xsl:when test="display='true'">
2974                 <input type="radio" value="true" name="subscription.display" checked="checked"/> yes
2975                 <input type="radio" value="false" name="subscription.display"/> no
2976               </xsl:when>
2977               <xsl:otherwise>
2978                 <input type="radio" value="true" name="subscription.display"/> yes
2979                 <input type="radio" value="false" name="subscription.display" checked="checked"/> no
2980               </xsl:otherwise>
2981             </xsl:choose>
2982           </td>
2983         </tr>
2984         <tr>
2985           <td class="fieldname">Affects Free/Busy:</td>
2986           <td>
2987             <xsl:choose>
2988               <xsl:when test="affectsFreeBusy='true'">
2989                 <input type="radio" value="true" name="subscription.affectsFreeBusy" checked="checked"/> yes
2990                 <input type="radio" value="false" name="subscription.affectsFreeBusy"/> no
2991               </xsl:when>
2992               <xsl:otherwise>
2993                 <input type="radio" value="true" name="subscription.affectsFreeBusy"/> yes
2994                 <input type="radio" value="false" name="subscription.affectsFreeBusy" checked="checked"/> no
2995               </xsl:otherwise>
2996             </xsl:choose>
2997           </td>
2998         </tr>
2999         <tr>
3000           <td class="fieldname">Style:</td>
3001           <td>
3002             <xsl:variable name="subStyle" select="style"/>
3003             <input type="text" value="{$subStyle}" name="subscription.style" size="60"/>
3004           </td>
3005         </tr>
3006         <!--<tr>
3007           <td class="fieldname">Unremovable:</td>
3008           <td>
3009             <xsl:choose>
3010               <xsl:when test="unremoveable='true'">
3011                 <input type="radio" value="true" name="unremoveable" size="60" checked="checked"/> true
3012                 <input type="radio" value="false" name="unremoveable" size="60"/> false
3013               </xsl:when>
3014               <xsl:otherwise>
3015                 <input type="radio" value="true" name="unremoveable" size="60"/> true
3016                 <input type="radio" value="false" name="unremoveable" size="60" checked="checked"/> false
3017               </xsl:otherwise>
3018             </xsl:choose>
3019           </td>
3020         </tr>-->
3021       </table>
3022       <table border="0" id="submitTable">
3023         <tr>
3024           <td>
3025             <input type="submit" name="updateSubscription" value="Update Subscription"/>
3026             <input type="submit" name="cancelled" value="Cancel"/>
3027             <input type="reset" value="Reset"/>
3028           </td>
3029           <td align="right">
3030             <input type="submit" name="delete" value="Delete Subscription"/>
3031           </td>
3032         </tr>
3033       </table>
3034     </form>
3035   </xsl:template>
3036
3037   <xsl:template name="subscriptionList">
3038     <h3>Current subscriptions</h3>
3039     <table class="common" cellspacing="0">
3040       <tr>
3041         <th>Name</th>
3042         <th>URI</th>
3043         <th>Style</th>
3044         <th>Display</th>
3045         <th>Free/Busy</th>
3046         <!--<th>Unremovable</th>
3047         <th>External</th>
3048         <th>Deleted?</th>-->
3049       </tr>
3050       <xsl:for-each select="subscription">
3051         <!--<xsl:sort select="name" order="ascending" case-order="upper-first"/>-->
3052         <tr>
3053           <td>
3054             <xsl:variable name="subname" select="name"/>
3055             <a href="{$subscriptions-fetchForUpdate}&amp;subname={$subname}">
3056               <xsl:value-of select="name"/>
3057             </a>
3058           </td>
3059           <td>
3060             <xsl:value-of select="uri"/>
3061           </td>
3062           <td>
3063             <xsl:value-of select="style"/>
3064           </td>
3065           <td class="center">
3066             <xsl:if test="display='true'">
3067               <img src="{$resourcesRoot}/resources/greenCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3068             </xsl:if>
3069           </td>
3070           <td class="center">
3071             <xsl:if test="affectsFreeBusy='true'">
3072               <img src="{$resourcesRoot}/resources/greenCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3073             </xsl:if>
3074           </td>
3075           <!--<td class="center">
3076             <xsl:if test="unremoveable='true'">
3077               <img src="{$resourcesRoot}/resources/redCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3078             </xsl:if>
3079           </td>
3080           <td class="center">
3081             <xsl:if test="internal='false'">
3082               <img src="{$resourcesRoot}/resources/greenCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3083             </xsl:if>
3084           </td>
3085           <td class="center">
3086             <xsl:if test="calendarDeleted='true'">
3087               <img src="{$resourcesRoot}/resources/redCheckIcon.gif" width="13" height="13" alt="true" border="0"/>
3088             </xsl:if>
3089           </td>-->
3090         </tr>
3091       </xsl:for-each>
3092     </table>
3093     <h4><a href="{$subscriptions-initAdd}&amp;calUri=please enter a calendar uri">Subscribe to a calendar</a> (by URI)</h4>
3094   </xsl:template>
3095
3096   <xsl:template match="subscription" mode="mySubscriptions">
3097     <xsl:variable name="itemClass">
3098       <xsl:choose>
3099         <xsl:when test="/bedework/selectionState/selectionType = 'calendar'
3100                         and name = /bedework/selectionState/subscriptions/subscription/calendar/name">selected</xsl:when>
3101         <xsl:otherwise>calendar</xsl:otherwise>
3102       </xsl:choose>
3103     </xsl:variable>
3104     <li class="{$itemClass}">
3105       <xsl:variable name="subUri" select="uri"/>
3106       <a href="{$setSelection}?calUrl={$subUri}">
3107         <xsl:value-of select="name"/>
3108       </a>
3109     </li>
3110   </xsl:template>
3111
3112   <!--==== ALARM OPTIONS ====-->
3113   <xsl:template name="alarmOptions">
3114     <form method="get" action="{$setAlarm}" id="standardForm">
3115       <input type="hidden" name="updateAlarmOptions" value="true"/>
3116       <table class="common" cellspacing="0">
3117         <tr>
3118           <th colspan="2" class="commonHeader">Alarm options</th>
3119         </tr>
3120         <tr>
3121           <td class="fieldname">
3122             Alarm Date/Time:
3123             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmTriggerSelectorDate/*"/>
3124           </td>
3125           <td class="fieldval">
3126             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmdate/*"/>
3127             <span class="std-text">at  </span>
3128             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmtime/*"/>
3129           </td>
3130         </tr>
3131         <tr>
3132           <td class="fieldname">
3133             or Before/After event:
3134             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmTriggerSelectorDuration/*"/>
3135           </td>
3136           <td align="left">
3137             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/days/*"/>
3138             days
3139             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/hours/*"/>
3140             hours
3141             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/minutes/*"/>
3142             minutes
3143             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/seconds/*"/>
3144             seconds OR:
3145             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmduration/weeks/*"/>
3146             weeks
3147             &#160;
3148             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationBefore/*"/>
3149             before
3150             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationAfter/*"/>
3151             after
3152             &#160;
3153             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationRelStart/*"/>
3154             start
3155             <xsl:copy-of select="/bedework/alarmoptionsform/form/alarmDurationRelEnd/*"/>
3156             end
3157           </td>
3158         </tr>
3159         <tr>
3160           <td>
3161             Email Address:
3162           </td>
3163           <td align="left">
3164             <xsl:copy-of select="/bedework/alarmoptionsform/form/email/*"/>
3165           </td>
3166         </tr>
3167         <tr>
3168           <td>
3169             Subject:
3170           </td>
3171           <td align="left">
3172             <xsl:copy-of select="/bedework/alarmoptionsform/form/subject/*"/>
3173           </td>
3174         </tr>
3175         <tr>
3176           <td>&#160;</td>
3177           <td>
3178             <input name="submit" type="submit" value="Continue"/>&#160;
3179             <input name="cancelled" type="submit" value="Cancel"/>
3180           </td>
3181         </tr>
3182       </table>
3183     </form>
3184   </xsl:template>
3185
3186   <!--==== UPLOAD ====-->
3187   <xsl:template name="upload">
3188   <!-- The name "eventForm" is referenced by several javascript functions. Do not
3189     change it without modifying includes.js -->
3190     <form name="eventForm" method="post" action="{$upload}" id="standardForm"  enctype="multipart/form-data">
3191       <h2>Upload iCAL File</h2>
3192       <table class="common" cellspacing="0">
3193         <tr>
3194           <td class="fieldname">
3195             Filename:
3196           </td>
3197           <td align="left">
3198             <input type="file" name="uploadFile" size="80" />
3199           </td>
3200         </tr>
3201         <tr>
3202           <td class="fieldname">
3203             Into calendar:
3204           </td>
3205           <td align="left">
3206             <input type="hidden" name="newCalPath" value=""/>
3207             <span id="bwEventCalDisplay">
3208               <em>default calendar</em>
3209             </span>
3210             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
3211           </td>
3212         </tr>
3213         <tr>
3214           <td class="fieldname">
3215             Affects Free/busy:
3216           </td>
3217           <td align="left">
3218             <input type="radio" value="true" name="affectsFreeBusy"/> yes
3219             <input type="radio" value="false" name="affectsFreeBusy" checked="checked"/> no
3220           </td>
3221         </tr>
3222       </table>
3223       <table border="0" id="submitTable">
3224         <tr>
3225           <td>
3226             <input name="submit" type="submit" value="Continue"/>
3227             <input name="cancelled" type="submit" value="Cancel"/>
3228           </td>
3229         </tr>
3230       </table>
3231     </form>
3232   </xsl:template>
3233
3234   <!--==== EMAIL OPTIONS ====-->
3235   <xsl:template name="emailOptions">
3236     <form method="get" action="{$mailEvent}" id="standardForm">
3237       <input type="hidden" name="updateEmailOptions" value="true"/>
3238       <table class="common" cellspacing="0">
3239         <tr>
3240           <th colspan="2" class="commonHeader">Update email options</th>
3241         </tr>
3242         <tr>
3243           <td>
3244
3245             Email Address:
3246           </td>
3247           <td align="left">
3248             <xsl:copy-of select="/bedework/emailoptionsform/form/email/*"/>
3249           </td>
3250         </tr>
3251         <tr>
3252           <td>
3253             Subject:
3254           </td>
3255           <td align="left">
3256             <xsl:copy-of select="/bedework/emailoptionsform/form/subject/*"/>
3257           </td>
3258         </tr>
3259         <tr>
3260           <td>&#160;</td>
3261           <td>
3262             <input name="submit" type="submit" value="Continue"/>&#160;
3263             <input name="cancelled" type="submit" value="Cancel"/>
3264           </td>
3265         </tr>
3266       </table>
3267     </form>
3268   </xsl:template>
3269
3270   <!--==== MANAGE LOCATIONS ====-->
3271   <xsl:template name="manageLocations">
3272     <form name="addLocationForm" method="post" action="{$addLocation}" id="standardForm">
3273       <input type="hidden" name="confirmationid" value="{$confId}"/>
3274       <h2>Manage Locations</h2>
3275       <table class="common" cellspacing="0">
3276         <tr>
3277           <th class="commonHeader" colspan="2">Add Location</th>
3278         </tr>
3279         <tr>
3280           <td class="fieldname">
3281             Main Address:
3282           </td>
3283           <td>
3284             <input size="60" name="newLocation.address" type="text"/>
3285           </td>
3286         </tr>
3287         <tr>
3288           <td class="fieldname">
3289             Subaddress:
3290           </td>
3291           <td>
3292             <input size="60" name="newLocation.subaddress" type="text"/>
3293           </td>
3294         </tr>
3295         <tr>
3296           <td class="fieldname">
3297             Location Link:
3298           </td>
3299           <td>
3300             <input size="60" name="newLocation.link" type="text"/>
3301           </td>
3302         </tr>
3303         <tr>
3304           <td></td>
3305           <td class="padMe">
3306             <input name="submit" type="submit" value="Submit Location"/>&#160;
3307             <input name="cancelled" type="submit" value="Cancel"/>
3308           </td>
3309         </tr>
3310         <tr>
3311           <th class="commonHeader" colspan="2">Edit/Delete Locations</th>
3312         </tr>
3313         <td colspan="2" class="plain">
3314           <ul>
3315             <xsl:for-each select="/bedework/formElements/form/location/locationmenu/select/option[@value>'3']">
3316               <xsl:sort select="."/>
3317               <li>
3318                 <xsl:variable name="locationId" select="@value"/>
3319                 <a href="{$editLocation}?locationId={$locationId}"><xsl:value-of select="."/></a>
3320               </li>
3321             </xsl:for-each>
3322           </ul>
3323         </td>
3324       </table>
3325     </form>
3326   </xsl:template>
3327
3328   <!--==== EDIT LOCATION ====-->
3329   <xsl:template match="formElements" mode="editLocation">
3330     <form name="editLocationForm" method="post" action="{$editLocation}" id="standardForm">
3331       <input type="hidden" name="updateLocation" value="true"/>
3332       <input type="hidden" name="confirmationid" value="{$confId}"/>
3333       <h2>Manage Locations</h2>
3334       <table class="common" cellspacing="0">
3335         <tr>
3336           <th colspan="2" class="commonHeader">
3337             <!--<xsl:variable name="locId" select="form/id"/>
3338             <div id="eventActions">
3339               <a href="{$delLocation}?locationId={$locId}">Delete Location</a>
3340             </div>-->
3341             Edit Location
3342           </th>
3343         </tr>
3344         <tr>
3345           <td class="fieldname">
3346             Address:
3347           </td>
3348           <td align="left">
3349             <xsl:copy-of select="form/address/*"/>
3350           </td>
3351         </tr>
3352         <tr>
3353           <td class="fieldname">
3354             Subaddress:
3355           </td>
3356           <td align="left">
3357             <xsl:copy-of select="form/subaddress/*"/>
3358           </td>
3359         </tr>
3360         <tr>
3361           <td class="fieldname">
3362             Location's URL:
3363           </td>
3364           <td>
3365             <xsl:copy-of select="form/link/*"/>
3366           </td>
3367         </tr>
3368       </table>
3369       <table border="0" id="submitTable">
3370         <tr>
3371           <td>
3372             <input name="submit" type="submit" value="Submit Location"/>
3373             <input name="cancelled" type="submit" value="Cancel"/>
3374             <input type="reset" value="Reset"/>
3375           </td>
3376           <td align="right">
3377             <xsl:variable name="locId" select="form/id"/>
3378             <a href="{$delLocation}?locationId={$locId}">
3379               <input type="button" name="delete" value="Delete Location"/>
3380             </a>
3381           </td>
3382         </tr>
3383       </table>
3384     </form>
3385   </xsl:template>
3386
3387   <!--==== PREFERENCES ====-->
3388   <xsl:template match="prefs">
3389     <h2>Manage Preferences</h2>
3390     <!-- The name "eventForm" is referenced by several javascript functions. Do not
3391     change it without modifying includes.js -->
3392     <form name="eventForm" method="post" action="{$prefs-update}">
3393       <table class="common">
3394         <tr><td colspan="2" class="fill">User settings:</td></tr>
3395         <tr>
3396           <td class="fieldname">
3397             User:
3398           </td>
3399           <td>
3400             <xsl:value-of select="user"/>
3401             <xsl:variable name="user" select="user"/>
3402             <input type="hidden" name="user" value="{$user}"/>
3403           </td>
3404         </tr>
3405         <tr>
3406           <td class="fieldname">
3407             Email address:
3408           </td>
3409           <td>
3410             <xsl:variable name="email" select="email"/>
3411             <input type="text" name="email" value="{$email}" size="40"/>
3412           </td>
3413         </tr>
3414         <tr><td colspan="2">&#160;</td></tr>
3415         <tr><td colspan="2" class="fill">Adding events:</td></tr>
3416         <tr>
3417           <td class="fieldname">
3418             Default calendar:
3419           </td>
3420           <td>
3421             <xsl:variable name="newCalPath" select="defaultCalendar"/>
3422             <input type="hidden" name="newCalPath" value="{$newCalPath}"/>
3423             <xsl:variable name="userPath">user/<xsl:value-of select="/bedework/userid"/>/</xsl:variable>
3424             <span id="bwEventCalDisplay">
3425               <xsl:choose>
3426                 <xsl:when test="contains(defaultCalendar,$userPath)">
3427                   <xsl:value-of select="substring-after(defaultCalendar,$userPath)"/>
3428                 </xsl:when>
3429                 <xsl:otherwise>
3430                   <xsl:value-of select="defaultCalendar"/>
3431                 </xsl:otherwise>
3432               </xsl:choose>
3433             </span>
3434             <a href="javascript:launchCalSelectWindow('{$event-selectCalForEvent}')" class="small">[change]</a>
3435           </td>
3436         </tr>
3437         <tr>
3438           <td class="fieldname">
3439             Preferred end date/time type:
3440           </td>
3441           <td>
3442             <select name="preferredEndType">
3443               <xsl:choose>
3444                 <xsl:when test="preferredEndType = 'duration'">
3445                   <option value="duration" selected="selected">duration</option>
3446                 </xsl:when>
3447                 <xsl:otherwise>
3448                   <option value="duration">duration</option>
3449                 </xsl:otherwise>
3450               </xsl:choose>
3451               <xsl:choose>
3452                 <xsl:when test="preferredEndType = 'date'">
3453                   <option value="date" selected="selected">date/time</option>
3454                 </xsl:when>
3455                 <xsl:otherwise>
3456                   <option value="date">date/time</option>
3457                 </xsl:otherwise>
3458               </xsl:choose>
3459             </select>
3460           </td>
3461         </tr>
3462         <tr><td colspan="2">&#160;</td></tr>
3463         <tr><td colspan="2" class="fill">Workday settings:</td></tr>
3464         <tr>
3465           <td class="fieldname">
3466             Workdays:
3467           </td>
3468           <td>
3469             <xsl:variable name="workDays" select="workDays"/>
3470             <input type="hidden" name="workDays" value="{$workDays}"/>
3471             <input type="checkbox" name="workDayIndex" value="0"/>Sun
3472             <input type="checkbox" name="workDayIndex" value="1"/>Mon
3473             <input type="checkbox" name="workDayIndex" value="2"/>Tue
3474             <input type="checkbox" name="workDayIndex" value="3"/>Wed
3475             <input type="checkbox" name="workDayIndex" value="4"/>Thu
3476             <input type="checkbox" name="workDayIndex" value="5"/>Fri
3477             <input type="checkbox" name="workDayIndex" value="6"/>Sat
3478           </td>
3479         </tr>
3480         <tr>
3481           <td class="fieldname">
3482             Workday start:
3483           </td>
3484           <td>
3485             <xsl:variable name="workDayStart" select="workDayStart"/>
3486             <select name="workDayStart">
3487               <option value="0">00:00</option>
3488               <option value="30">00:30</option>
3489               <option value="60">01:00</option>
3490               <option value="90">01:30</option>
3491               <option value="120">02:00</option>
3492               <option value="150">02:30</option>
3493               <option value="180">03:00</option>
3494               <option value="210">03:30</option>
3495               <option value="240">04:00</option>
3496               <option value="270">04:30</option>
3497               <option value="300">05:00</option>
3498               <option value="330">05:30</option>
3499               <option value="360">06:00</option>
3500               <option value="390">06:30</option>
3501               <option value="420">07:00</option>
3502               <option value="450">07:30</option>
3503               <option value="480">08:00</option>
3504               <option value="510">08:30</option>
3505               <option value="540">09:00</option>
3506               <option value="570">09:30</option>
3507               <option value="600">10:00</option>
3508               <option value="630">10:30</option>
3509               <option value="660">11:00</option>
3510               <option value="690">11:30</option>
3511               <option value="720">12:00</option>
3512               <option value="750">12:30</option>
3513               <option value="780">13:00</option>
3514               <option value="810">13:30</option>
3515               <option value="840">14:00</option>
3516               <option value="870">14:30</option>
3517               <option value="900">15:00</option>
3518               <option value="930">15:30</option>
3519               <option value="960">16:00</option>
3520               <option value="990">16:30</option>
3521               <option value="1020">17:00</option>
3522               <option value="1050">17:30</option>
3523               <option value="1080">18:00</option>
3524               <option value="1110">18:30</option>
3525               <option value="1140">19:00</option>
3526               <option value="1170">19:30</option>
3527               <option value="1200">20:00</option>
3528               <option value="1230">20:30</option>
3529               <option value="1260">21:00</option>
3530               <option value="1290">21:30</option>
3531               <option value="1320">22:00</option>
3532               <option value="1350">22:30</option>
3533               <option value="1380">23:00</option>
3534               <option value="1410">23:30</option>
3535             </select>
3536           </td>
3537         </tr>
3538         <tr>
3539           <td class="fieldname">
3540             Workday end:
3541           </td>
3542           <td>
3543             <xsl:variable name="workDayEnd" select="workDayEnd"/>
3544             <select name="workDayEnd">
3545               <option value="0">00:00</option>
3546               <option value="30">00:30</option>
3547               <option value="60">01:00</option>
3548               <option value="90">01:30</option>
3549               <option value="120">02:00</option>
3550               <option value="150">02:30</option>
3551               <option value="180">03:00</option>
3552               <option value="210">03:30</option>
3553               <option value="240">04:00</option>
3554               <option value="270">04:30</option>
3555               <option value="300">05:00</option>
3556               <option value="330">05:30</option>
3557               <option value="360">06:00</option>
3558               <option value="390">06:30</option>
3559               <option value="420">07:00</option>
3560               <option value="450">07:30</option>
3561               <option value="480">08:00</option>
3562               <option value="510">08:30</option>
3563               <option value="540">09:00</option>
3564               <option value="570">09:30</option>
3565               <option value="600">10:00</option>
3566               <option value="630">10:30</option>
3567               <option value="660">11:00</option>
3568               <option value="690">11:30</option>
3569               <option value="720">12:00</option>
3570               <option value="750">12:30</option>
3571               <option value="780">13:00</option>
3572               <option value="810">13:30</option>
3573               <option value="840">14:00</option>
3574               <option value="870">14:30</option>
3575               <option value="900">15:00</option>
3576               <option value="930">15:30</option>
3577               <option value="960">16:00</option>
3578               <option value="990">16:30</option>
3579               <option value="1020">17:00</option>
3580               <option value="1050">17:30</option>
3581               <option value="1080">18:00</option>
3582               <option value="1110">18:30</option>
3583               <option value="1140">19:00</option>
3584               <option value="1170">19:30</option>
3585               <option value="1200">20:00</option>
3586               <option value="1230">20:30</option>
3587               <option value="1260">21:00</option>
3588               <option value="1290">21:30</option>
3589               <option value="1320">22:00</option>
3590               <option value="1350">22:30</option>
3591               <option value="1380">23:00</option>
3592               <option value="1410">23:30</option>
3593             </select>
3594           </td>
3595         </tr>
3596         <tr><td colspan="2">&#160;</td></tr>
3597         <tr><td colspan="2" class="fill">Display options:</td></tr>
3598         <tr>
3599           <td class="fieldname">
3600             Preferred view:
3601           </td>
3602           <td>
3603             <xsl:variable name="preferredView" select="preferredView"/>
3604             <select name="preferredView">
3605               <xsl:for-each select="/bedework/views/view">
3606                 <xsl:variable name="viewName" select="name"/>
3607                 <xsl:choose>
3608                   <xsl:when test="viewName = $preferredView">
3609                     <option value="{$viewName}" selected="selected"><xsl:value-of select="name"/></option>
3610                   </xsl:when>
3611                   <xsl:otherwise>
3612                     <option value="{$viewName}"><xsl:value-of select="name"/></option>
3613                   </xsl:otherwise>
3614                 </xsl:choose>
3615               </xsl:for-each>
3616             </select>
3617           </td>
3618         </tr>
3619         <tr>
3620           <td class="fieldname">
3621             Preferred view period:
3622           </td>
3623           <td>
3624             <select name="viewPeriod">
3625               <!-- picking the selected item could be done with javascript. for
3626                    now, this will do.  -->
3627               <xsl:choose>
3628                 <xsl:when test="preferredViewPeriod = 'dayView'">
3629                   <option value="dayView" selected="selected">day</option>
3630                 </xsl:when>
3631                 <xsl:otherwise>
3632                   <option value="dayView">day</option>
3633                 </xsl:otherwise>
3634               </xsl:choose>
3635               <xsl:choose>
3636                 <xsl:when test="preferredViewPeriod = 'todayView'">
3637                   <option value="todayView" selected="selected">today</option>
3638                 </xsl:when>
3639                 <xsl:otherwise>
3640                   <option value="todayView">today</option>
3641                 </xsl:otherwise>
3642               </xsl:choose>
3643               <xsl:choose>
3644                 <xsl:when test="preferredViewPeriod = 'weekView'">
3645                   <option value="weekView" selected="selected">week</option>
3646                 </xsl:when>
3647                 <xsl:otherwise>
3648                   <option value="weekView">week</option>
3649                 </xsl:otherwise>
3650               </xsl:choose>
3651               <xsl:choose>
3652                 <xsl:when test="preferredViewPeriod = 'monthView'">
3653                   <option value="monthView" selected="selected">month</option>
3654                 </xsl:when>
3655                 <xsl:otherwise>
3656                   <option value="monthView">month</option>
3657                 </xsl:otherwise>
3658               </xsl:choose>
3659               <xsl:choose>
3660                 <xsl:when test="preferredViewPeriod = 'yearView'">
3661                   <option value="yearView" selected="selected">year</option>
3662                 </xsl:when>
3663                 <xsl:otherwise>
3664                   <option value="yearView">year</option>
3665                 </xsl:otherwise>
3666               </xsl:choose>
3667             </select>
3668           </td>
3669         </tr>
3670         <tr>
3671           <td class="fieldname">
3672             Skin name:
3673           </td>
3674           <td>
3675             <!-- as you add skins, update this list and set the selected flag
3676                  as required (use an xsl:choose) -->
3677             <xsl:variable name="skinName" select="skinName"/>
3678             <select name="skin">
3679               <option value="default">default</option>
3680             </select>
3681           </td>
3682         </tr>
3683         <tr>
3684           <td class="fieldname">
3685             Skin style:
3686           </td>
3687           <td>
3688             <!-- if you have skin styles, update this list and set the selected flag
3689                  as required (use an xsl:choose) -->
3690             <xsl:variable name="skinStyle" select="skinStyle"/>
3691             <select name="skinStyle">
3692               <option value="default">default</option>
3693             </select>
3694           </td>
3695         </tr>
3696         <tr>
3697           <td class="fieldname">
3698             Interface mode:
3699           </td>
3700           <td>
3701             <xsl:variable name="userMode" select="userMode"/>
3702             <select name="userMode">
3703               <xsl:choose>
3704                 <xsl:when test="userMode = 0">
3705                   <option value="0" selected="selected">basic</option>
3706                 </xsl:when>
3707                 <xsl:otherwise>
3708                   <option value="0">basic</option>
3709                 </xsl:otherwise>
3710               </xsl:choose>
3711               <xsl:choose>
3712                 <xsl:when test="userMode = 1">
3713                   <option value="1" selected="selected">simple</option>
3714                 </xsl:when>
3715                 <xsl:otherwise>
3716                   <option value="1">simple</option>
3717                 </xsl:otherwise>
3718               </xsl:choose>
3719               <xsl:choose>
3720                 <xsl:when test="userMode = 3">
3721                   <option value="3" selected="selected">advanced</option>
3722                 </xsl:when>
3723                 <xsl:otherwise>
3724                   <option value="3">advanced</option>
3725                 </xsl:otherwise>
3726               </xsl:choose>
3727             </select>
3728           </td>
3729         </tr>
3730       </table>
3731       <br />
3732
3733       <input type="submit" name="modPrefs" value="Update"/>
3734       <input type="reset" value="Reset"/>
3735       <input type="submit" name="cancelled" value="Cancel"/>
3736     </form>
3737   </xsl:template>
3738
3739
3740   <!--==== SIDE CALENDAR MENU ====-->
3741   <xsl:template match="calendar" mode="sideList">
3742     <xsl:variable name="calPath" select="encodedPath"/>
3743     <div class="std-text">
3744       <a href="{$setSelection}?calPath={$calPath}"><xsl:value-of select="title"/></a>
3745     </div>
3746   </xsl:template>
3747
3748   <!--==== STAND-ALONE PAGES ====-->
3749   <!-- not currently in use -->
3750   <xsl:template name="selectPage">
3751     <!-- <xsl:choose>
3752       <xsl:when test="/bedework/appvar[key='page']">
3753         <xsl:choose>
3754           <xsl:otherwise>
3755             <xsl:call-template name="noPage"/>
3756           </xsl:otherwise>
3757         </xsl:choose>
3758       </xsl:when>
3759       <xsl:otherwise> -->
3760         <xsl:call-template name="noPage"/>
3761       <!--</xsl:otherwise>
3762     </xsl:choose>-->
3763   </xsl:template>
3764
3765   <xsl:template name="noPage">
3766     <p>
3767       Error: there is no page with that name.  Please select a navigational
3768       link to continue.
3769     </p>
3770   </xsl:template>
3771
3772   <!--==== UTILITY TEMPLATES ====-->
3773
3774   <!-- search and replace template taken from
3775        http://www.biglist.com/lists/xsl-list/archives/200211/msg00337.html -->
3776   <xsl:template name="replace">
3777     <xsl:param name="string" select="''"/>
3778     <xsl:param name="pattern" select="''"/>
3779     <xsl:param name="replacement" select="''"/>
3780     <xsl:choose>
3781       <xsl:when test="$pattern != '' and $string != '' and contains($string, $pattern)">
3782         <xsl:value-of select="substring-before($string, $pattern)"/>
3783         <xsl:copy-of select="$replacement"/>
3784         <xsl:call-template name="replace">
3785           <xsl:with-param name="string" select="substring-after($string, $pattern)"/>
3786           <xsl:with-param name="pattern" select="$pattern"/>
3787           <xsl:with-param name="replacement" select="$replacement"/>
3788         </xsl:call-template>
3789       </xsl:when>
3790       <xsl:otherwise>
3791         <xsl:value-of select="$string"/>
3792       </xsl:otherwise>
3793     </xsl:choose>
3794   </xsl:template>
3795
3796   <!--==== FOOTER ====-->
3797   <xsl:template name="footer">
3798     <div id="footer">
3799       Demonstration calendar; place footer information here.
3800     </div>
3801     <table id="skinSelectorTable" border="0" cellpadding="0" cellspacing="0">
3802       <tr>
3803         <td class="leftCell">
3804           <a href="http://www.bedework.org/">Bedework Calendar</a> |
3805           <a href="?noxslt=yes">show XML</a> |
3806           <a href="?refreshXslt=yes">refresh XSLT</a>
3807         </td>
3808         <td class="rightCell">
3809           <!--<form name="skinSelectForm" method="get" action="{$setup}">
3810             skin selector:
3811             <select name="skinNameSticky" onChange="submit()">
3812               <option>select a skin</option>
3813               <option value="default">Demo Calendar</option>
3814               <option value="rensselaer">Rensselaer</option>
3815               <option value="washington">Washington</option>
3816             </select>
3817           </form>-->
3818         </td>
3819       </tr>
3820     </table>
3821   </xsl:template>
3822 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.