root/trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/grid-html.xsl

Revision 2498 (checked in by bleibson, 3 years ago)

o Fix download and "copy to my calendar" links. Fixes http://www.bedework.org/trac/bedework/ticket/490.

  • Property svn:mime-type set to text/plain
Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet
3   version="1.0"
4   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5   xmlns="http://www.w3.org/1999/xhtml">
6
7 <!-- **********************************************************************
8     Copyright 2009 Rensselaer Polytechnic Institute. All worldwide rights reserved.
9
10     Redistribution and use of this distribution in source and binary forms,
11     with or without modification, are permitted provided that:
12        The above copyright notice and this permission notice appear in all
13         copies and supporting documentation;
14
15         The name, identifiers, and trademarks of Rensselaer Polytechnic
16         Institute are not used in advertising or publicity without the
17         express prior written permission of Rensselaer Polytechnic Institute;
18
19     DISCLAIMER: The software is distributed" AS IS" without any express or
20     implied warranty, including but not limited to, any implied warranties
21     of merchantability or fitness for a particular purpose or any warrant)'
22     of non-infringement of any current or pending patent rights. The authors
23     of the software make no representations about the suitability of this
24     software for any particular purpose. The entire risk as to the quality
25     and performance of the software is with the user. Should the software
26     prove defective, the user assumes the cost of all necessary servicing,
27     repair or correction. In particular, neither Rensselaer Polytechnic
28     Institute, nor the authors of the software are liable for any indirect,
29     special, consequential, or incidental damages related to the software,
30     to the maximum extent the law permits. -->
31
32   <!-- URL of resources common to all bedework apps (javascript, images) -->
33   <xsl:variable name="resourceCommons">../../../bedework-common</xsl:variable>
34
35   <!-- DEFINE INCLUDES -->
36   <!-- cannot use the resourceCommons variable in xsl:include paths -->
37   <xsl:include href="../../../bedework-common/default/default/errors.xsl"/>
38   <xsl:include href="../../../bedework-common/default/default/messages.xsl"/>
39   <xsl:include href="../../../bedework-common/default/default/util.xsl"/>
40   <xsl:include href="./config.xsl"/>
41   <xsl:include href="./strings.xsl"/>
42
43   <!-- DEFINE GLOBAL CONSTANTS -->
44
45   <!-- URL of html resources (images, css, other html); by default this is
46        set to the application root -->
47   <xsl:variable name="resourcesRoot" select="/bedework/approot"/>
48
49   <!-- URL of the XSL template directory -->
50   <!-- The approot is an appropriate place to put
51        included stylesheets and xml fragments. These are generally
52        referenced relatively (like errors.xsl and messages.xsl above);
53        this variable is here for your convenience if you choose to
54        reference it explicitly.  It is not used in this stylesheet, however,
55        and can be safely removed if you so choose. -->
56   <xsl:variable name="appRoot" select="/bedework/approot"/>
57
58   <!-- Properly encoded prefixes to the application actions; use these to build
59        urls; allows the application to be used without cookies or within a portal.
60        These urls are rewritten in header.jsp and simply passed through for use
61        here. Every url includes a query string (either ?b=de or a real query
62        string) so that all links constructed in this stylesheet may begin the
63        query string with an ampersand. -->
64   <xsl:variable name="setup" select="/bedework/urlPrefixes/setup"/>
65   <xsl:variable name="setSelection" select="/bedework/urlPrefixes/main/setSelection"/>
66   <xsl:variable name="fetchPublicCalendars" select="/bedework/urlPrefixes/calendar/fetchPublicCalendars"/>
67   <xsl:variable name="setViewPeriod" select="/bedework/urlPrefixes/main/setViewPeriod"/>
68   <xsl:variable name="listEvents" select="/bedework/urlPrefixes/main/listEvents"/>
69   <xsl:variable name="eventView" select="/bedework/urlPrefixes/event/eventView"/>
70   <xsl:variable name="addEventRef" select="/bedework/urlPrefixes/event/addEventRef"/>
71   <xsl:variable name="export" select="/bedework/urlPrefixes/misc/export"/>
72   <xsl:variable name="search" select="/bedework/urlPrefixes/search/search"/>
73   <xsl:variable name="search-next" select="/bedework/urlPrefixes/search/next"/>
74   <xsl:variable name="calendar-fetchForExport" select="/bedework/urlPrefixes/calendar/fetchForExport"/>
75   <xsl:variable name="mailEvent" select="/bedework/urlPrefixes/mail/mailEvent"/>
76  
77  <xsl:variable name="stats" select="/bedework/urlPrefixes/stats/stats"/>
78
79   <!-- URL of the web application - includes web context -->
80   <xsl:variable name="urlPrefix" select="/bedework/urlprefix"/>
81
82   <!-- Other generally useful global variables -->
83   <xsl:variable name="privateCal" select="concat($bwCalendarHostURL,'/ucal')"/>
84   <xsl:variable name="prevdate" select="/bedework/previousdate"/>
85   <xsl:variable name="nextdate" select="/bedework/nextdate"/>
86   <xsl:variable name="curdate" select="/bedework/currentdate/date"/>
87
88
89   <!-- MAIN TEMPLATE -->
90   <xsl:template match="/">
91     <html lang="en">
92       <head>
93         <title><xsl:copy-of select="$bwStr-Root-PageTitle"/></title>
94         <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
95         <!-- load css -->
96         <link rel="stylesheet" href="{$resourcesRoot}/default/default/blue.css"/>
97         <link rel="stylesheet" href="../../../bedework-common/default/default/subColors.css"/>
98         <link rel="stylesheet" type="text/css" media="print" href="{$resourcesRoot}/default/default/print.css" />
99         <!-- load javascript -->
100         <xsl:if test="/bedework/page='event' or /bedework/page='displayCalendarForExport'">
101           <script type="text/javascript" src="../../../bedework-common/javascript/jquery/jquery-1.3.2.min.js">&#160;</script>
102           <script type="text/javascript" src="../../../bedework-common/javascript/jquery/jquery-ui-1.7.1.custom.min.js">&#160;</script>
103           <link rel="stylesheet" href="../../../bedework-common/javascript/jquery/css/custom-theme/jquery-ui-1.7.1.custom.css"/>
104           <link rel="stylesheet" href="../../../bedework-common/javascript/jquery/css/custom-theme/bedeworkJquery.css"/>
105           <script type="text/javascript" src="{$resourcesRoot}/resources/javascript/bedework.js">&#160;</script>
106           <xsl:if test="/bedework/page='displayCalendarForExport'">
107             <script type="text/javascript">
108               <xsl:comment>
109               $.datepicker.setDefaults({
110                 constrainInput: true,
111                 dateFormat: "yy-mm-dd",
112                 showOn: "both",
113                 buttonImage: "<xsl:value-of select='$resourcesRoot'/>/images/calIcon.gif",
114                 buttonImageOnly: true,
115                 gotoCurrent: true,
116                 duration: ""
117               });
118               $(document).ready(function() {
119                 $("#bwExportCalendarWidgetStartDate").datepicker({
120                 }).attr("readonly", "readonly");
121                 $("#bwExportCalendarWidgetEndDate").datepicker({
122                 }).attr("readonly", "readonly");
123               });
124               </xsl:comment>
125             </script>
126           </xsl:if>
127         </xsl:if>
128         <!-- address bar icon -->
129         <link rel="icon" type="image/ico" href="{$resourcesRoot}/images/bedework.ico" />
130       </head>
131       <body>
132         <xsl:if test="/bedework/error">
133           <div id="errors">
134             <xsl:apply-templates select="/bedework/error"/>
135           </div>
136         </xsl:if>
137         <xsl:choose>
138               <xsl:when test="/bedework/periodname='Day'">
139                 <xsl:call-template name="listView"/>
140               </xsl:when>
141               <xsl:when test="/bedework/periodname='Week' or /bedework/periodname=''">
142                 <xsl:choose>
143                   <xsl:when test="/bedework/appvar[key='weekViewMode']/value='list'">
144                     <xsl:call-template name="listView"/>
145                   </xsl:when>
146                   <xsl:otherwise>
147                     <xsl:call-template name="weekView"/>
148                   </xsl:otherwise>
149                 </xsl:choose>
150               </xsl:when>
151               <xsl:when test="/bedework/periodname='Month'">
152                 <xsl:choose>
153                   <xsl:when test="/bedework/appvar[key='monthViewMode']/value='list'">
154                     <xsl:call-template name="listView"/>
155                   </xsl:when>
156                   <xsl:otherwise>
157                     <xsl:call-template name="monthView"/>
158                   </xsl:otherwise>
159                 </xsl:choose>
160               </xsl:when>
161               <xsl:otherwise>
162                 <xsl:call-template name="yearView"/>
163               </xsl:otherwise>
164         </xsl:choose>
165       </body>
166     </html>
167   </xsl:template>
168  
169   <!--==== SINGLE EVENT ====-->
170   <xsl:template match="event">
171     <xsl:variable name="calPath" select="calendar/encodedPath"/>
172     <xsl:variable name="guid" select="guid"/>
173     <xsl:variable name="recurrenceId" select="recurrenceId"/>
174     <xsl:variable name="statusClass">
175       <xsl:choose>
176         <xsl:when test="status='CANCELLED'">bwStatusCancelled</xsl:when>
177         <xsl:when test="status='TENTATIVE'">bwStatusTentative</xsl:when>
178         <xsl:otherwise>bwStatusConfirmed</xsl:otherwise>
179       </xsl:choose>
180     </xsl:variable>
181     <h2 class="{$statusClass}">
182       <a id="linkToEvent" href="javascript:showLink('{$urlPrefix}/event/eventView.do?calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}')" title="{$bwStr-SgEv-GenerateLinkToThisEvent}">
183        <xsl:copy-of select="$bwStr-SgEv-LinkToThisEvent"/>
184      </a>
185       <xsl:if test="status='CANCELLED'"><xsl:copy-of select="$bwStr-SgEv-Canceled"/><xsl:text> </xsl:text></xsl:if>
186       <xsl:choose>
187         <xsl:when test="link != ''">
188           <xsl:variable name="link" select="link"/>
189           <a href="{$link}">
190             <xsl:value-of select="summary"/>
191           </a>
192         </xsl:when>
193         <xsl:otherwise>
194           <xsl:value-of select="summary"/>
195         </xsl:otherwise>
196       </xsl:choose>
197     </h2>
198     <table id="eventTable" cellpadding="0" cellspacing="0">
199       <tr>
200         <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-When"/></td>
201         <td class="fieldval">
202           <!-- always display local time -->
203           <xsl:value-of select="start/dayname"/>, <xsl:value-of select="start/longdate"/><xsl:text> </xsl:text>
204           <xsl:if test="start/allday = 'false'">
205             <span class="time"><xsl:value-of select="start/time"/></span>
206           </xsl:if>
207           <xsl:if test="(end/longdate != start/longdate) or
208                         ((end/longdate = start/longdate) and (end/time != start/time))"> - </xsl:if>
209           <xsl:if test="end/longdate != start/longdate">
210             <xsl:value-of select="substring(end/dayname,1,3)"/>, <xsl:value-of select="end/longdate"/><xsl:text> </xsl:text>
211           </xsl:if>
212           <xsl:choose>
213             <xsl:when test="start/allday = 'true'">
214               <span class="time"><em><xsl:copy-of select="$bwStr-SgEv-AllDay"/></em></span>
215             </xsl:when>
216             <xsl:when test="end/longdate != start/longdate">
217               <span class="time"><xsl:value-of select="end/time"/></span>
218             </xsl:when>
219             <xsl:when test="end/time != start/time">
220               <span class="time"><xsl:value-of select="end/time"/></span>
221             </xsl:when>
222           </xsl:choose>
223           <!-- if timezones are not local, or if floating add labels: -->
224           <xsl:if test="start/timezone/islocal = 'false' or end/timezone/islocal = 'false'">
225             <xsl:text> </xsl:text>
226             --
227             <strong>
228               <xsl:choose>
229                 <xsl:when test="start/floating = 'true'">
230                   <xsl:copy-of select="$bwStr-SgEv-FloatingTime"/>
231                 </xsl:when>
232                 <xsl:otherwise>
233                   <xsl:copy-of select="$bwStr-SgEv-LocalTime"/>
234                 </xsl:otherwise>
235               </xsl:choose>
236             </strong>
237             <br/>
238           </xsl:if>
239           <!-- display in timezone if not local or floating time) -->
240           <xsl:if test="(start/timezone/islocal = 'false' or end/timezone/islocal = 'false') and start/floating = 'false'">
241             <xsl:choose>
242               <xsl:when test="start/timezone/id != end/timezone/id">
243                 <!-- need to display both timezones if they differ from start to end -->
244                 <table border="0" cellspacing="0" id="tztable">
245                   <tr>
246                     <td>
247                       <strong><xsl:copy-of select="$bwStr-SgEv-Start"/></strong>
248                     </td>
249                     <td>
250                       <xsl:choose>
251                         <xsl:when test="start/timezone/islocal='true'">
252                           <xsl:value-of select="start/dayname"/>,
253                           <xsl:value-of select="start/longdate"/>
254                           <xsl:text> </xsl:text>
255                           <span class="time"><xsl:value-of select="start/time"/></span>
256                         </xsl:when>
257                         <xsl:otherwise>
258                           <xsl:value-of select="start/timezone/dayname"/>,
259                           <xsl:value-of select="start/timezone/longdate"/>
260                           <xsl:text> </xsl:text>
261                           <span class="time"><xsl:value-of select="start/timezone/time"/></span>
262                         </xsl:otherwise>
263                       </xsl:choose>
264                     </td>
265                     <td>
266                       --
267                       <strong><xsl:value-of select="start/timezone/id"/></strong>
268                     </td>
269                   </tr>
270                   <tr>
271                     <td>
272                       <strong><xsl:copy-of select="$bwStr-SgEv-End"/></strong>
273                     </td>
274                     <td>
275                       <xsl:choose>
276                         <xsl:when test="end/timezone/islocal='true'">
277                           <xsl:value-of select="end/dayname"/>,
278                           <xsl:value-of select="end/longdate"/>
279                           <xsl:text> </xsl:text>
280                           <span class="time"><xsl:value-of select="end/time"/></span>
281                         </xsl:when>
282                         <xsl:otherwise>
283                           <xsl:value-of select="end/timezone/dayname"/>,
284                           <xsl:value-of select="end/timezone/longdate"/>
285                           <xsl:text> </xsl:text>
286                           <span class="time"><xsl:value-of select="end/timezone/time"/></span>
287                         </xsl:otherwise>
288                       </xsl:choose>
289                     </td>
290                     <td>
291                       --
292                       <strong><xsl:value-of select="end/timezone/id"/></strong>
293                     </td>
294                   </tr>
295                 </table>
296               </xsl:when>
297               <xsl:otherwise>
298                 <!-- otherwise, timezones are the same: display as a single line  -->
299                 <xsl:value-of select="start/timezone/dayname"/>, <xsl:value-of select="start/timezone/longdate"/><xsl:text> </xsl:text>
300                 <xsl:if test="start/allday = 'false'">
301                   <span class="time"><xsl:value-of select="start/timezone/time"/></span>
302                 </xsl:if>
303                 <xsl:if test="(end/timezone/longdate != start/timezone/longdate) or
304                               ((end/timezone/longdate = start/timezone/longdate) and (end/timezone/time != start/timezone/time))"> - </xsl:if>
305                 <xsl:if test="end/timezone/longdate != start/timezone/longdate">
306                   <xsl:value-of select="substring(end/timezone/dayname,1,3)"/>, <xsl:value-of select="end/timezone/longdate"/><xsl:text> </xsl:text>
307                 </xsl:if>
308                 <xsl:choose>
309                   <xsl:when test="start/allday = 'true'">
310                     <span class="time"><em> <xsl:copy-of select="$bwStr-SgEv-AllDay"/></em></span>
311                   </xsl:when>
312                   <xsl:when test="end/timezone/longdate != start/timezone/longdate">
313                     <span class="time"><xsl:value-of select="end/timezone/time"/></span>
314                   </xsl:when>
315                   <xsl:when test="end/timezone/time != start/timezone/time">
316                     <span class="time"><xsl:value-of select="end/timezone/time"/></span>
317                   </xsl:when>
318                 </xsl:choose>
319                 <xsl:text> </xsl:text>
320                 --
321                 <strong><xsl:value-of select="start/timezone/id"/></strong>
322               </xsl:otherwise>
323             </xsl:choose>
324           </xsl:if>
325         </td>
326         <th class="icalIcon" rowspan="2">
327           <div id="eventIcons">
328             <a href="{$privateCal}/event/addEventRef.do?calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="{$bwStr-SgEv-AddEventToMyCalendar}" target="myCalendar">
329               <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon.gif" width="20" height="26" border="0" alt="Add event to MyCalendar"/>
330               <xsl:copy-of select="$bwStr-SgEv-AddToMyCalendar"/>
331             </a>
332             <xsl:variable name="eventIcalName" select="concat($guid,'.ics')"/>
333             <a href="{$export}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;contentName={$eventIcalName}" title="{$bwStr-SgEv-DownloadEvent}">
334               <img src="{$resourcesRoot}/images/std-ical_icon.gif" width="20" height="26" border="0" alt="Download this event"/>
335              <xsl:copy-of select="$bwStr-SgEv-Download"/></a>
336           </div>
337         </th>
338       </tr>
339       <tr>
340         <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-Where"/></td>
341         <td class="fieldval">
342           <xsl:choose>
343             <xsl:when test="location/link=''">
344               <xsl:value-of select="location/address"/>
345             </xsl:when>
346             <xsl:otherwise>
347               <xsl:variable name="locationLink" select="location/link"/>
348               <a href="{$locationLink}">
349                 <xsl:value-of select="location/address"/>
350               </a>
351             </xsl:otherwise>
352           </xsl:choose>
353           <xsl:if test="location/subaddress!=''">
354             <br/><xsl:value-of select="location/subaddress"/>
355           </xsl:if>
356         </td>
357       </tr>
358       <tr>
359         <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-Description"/></td>
360         <td colspan="2" class="fieldval description">
361           <xsl:if test="xproperties/node()[name()='X-BEDEWORK-IMAGE']">
362             <xsl:variable name="bwImage"><xsl:value-of select="xproperties/node()[name()='X-BEDEWORK-IMAGE']/values/text"/></xsl:variable>
363             <img src="{$bwImage}" class="bwEventImage"/>
364           </xsl:if>
365           <xsl:call-template name="replace">
366             <xsl:with-param name="string" select="description"/>
367             <xsl:with-param name="pattern" select="'&#xA;'"/>
368             <xsl:with-param name="replacement"><br/></xsl:with-param>
369           </xsl:call-template>
370         </td>
371       </tr>
372       <xsl:if test="status !='' and status != 'CONFIRMED'">
373         <tr>
374           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-STATUS"/></td>
375           <td class="fieldval">
376             <xsl:value-of select="status"/>
377           </td>
378         </tr>
379       </xsl:if>
380       <xsl:if test="cost!=''">
381         <tr>
382           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-Cost"/></td>
383           <td colspan="2" class="fieldval"><xsl:value-of select="cost"/></td>
384         </tr>
385       </xsl:if>
386       <xsl:if test="link != ''">
387         <tr>
388           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-See"/></td>
389           <td colspan="2" class="fieldval">
390             <xsl:variable name="link" select="link"/>
391             <a href="{$link}"><xsl:value-of select="link"/></a>
392           </td>
393         </tr>
394       </xsl:if>
395       <xsl:if test="contact/name!='none'">
396         <tr>
397           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-Contact"/></td>
398           <td colspan="2" class="fieldval">
399             <xsl:choose>
400               <xsl:when test="contact/link=''">
401                 <xsl:value-of select="contact/name"/>
402               </xsl:when>
403               <xsl:otherwise>
404                 <xsl:variable name="sponsorLink" select="contact/link"/>
405                 <a href="{$sponsorLink}">
406                   <xsl:value-of select="contact/name"/>
407                 </a>
408               </xsl:otherwise>
409             </xsl:choose>
410             <xsl:if test="contact/phone!=''">
411               <br /><xsl:value-of select="contact/phone"/>
412             </xsl:if>
413             <!-- If you want to display email addresses, uncomment the
414                  following 8 lines. -->
415             <!-- <xsl:if test="contact/email!=''">
416               <br />
417               <xsl:variable name="email" select="contact/email"/>
418               <xsl:variable name="subject" select="summary"/>
419               <a href="mailto:{$email}&amp;subject={$subject}">
420                 <xsl:value-of select="contact/email"/>
421               </a>
422             </xsl:if> -->
423           </td>
424         </tr>
425       </xsl:if>
426       <xsl:if test="comments/comment">
427         <tr>
428           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-Comments"/></td>
429           <td class="fieldval comments">
430             <xsl:for-each select="comments/comment">
431               <p><xsl:value-of select="value"/></p>
432             </xsl:for-each>
433           </td>
434         </tr>
435       </xsl:if>
436       <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
437         <tr>
438           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-TopicalArea"/></td>
439           <td class="fieldval">
440             <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
441               <xsl:variable name="calUrl" select="values/text"/>
442               <a href="{$setSelection}&amp;virtualPath={$calUrl}&amp;setappvar=curCollection({$calUrl})">
443                 <xsl:call-template name="substring-afterLastInstanceOf">
444                   <xsl:with-param name="string" select="values/text"/>
445                   <xsl:with-param name="char">/</xsl:with-param>
446                 </xsl:call-template>
447               </a><xsl:if test="position()!=last()">, </xsl:if>
448             </xsl:for-each>
449           </td>
450         </tr>
451       </xsl:if>
452       <xsl:if test="categories/category">
453         <tr>
454           <td class="fieldname"><xsl:copy-of select="$bwStr-SgEv-Categories"/></td>
455           <td class="fieldval">
456             <xsl:for-each select="categories/category">
457               <xsl:value-of select="word"/><xsl:if test="position() != last()">, </xsl:if>
458             </xsl:for-each>
459           </td>
460         </tr>
461       </xsl:if>
462       <!--  xsl:if test="calendar/path!=''">
463         <tr>
464           <td class="fieldname">Calendar:</td>
465           <td class="fieldval">
466             <xsl:variable name="calUrl" select="calendar/encodedPath"/>
467             <a href="{$setSelection}&amp;calUrl={$calUrl}">
468               <xsl:value-of select="calendar/name"/>
469             </a>
470           </td>
471         </tr>
472       </xsl:if-->
473     </table>
474   </xsl:template>
475
476   <!--==== LIST VIEW  (for day, week, and month) ====-->
477   <xsl:template name="listView">
478     <table id="listTable" border="0" cellpadding="0" cellspacing="0">
479       <xsl:choose>
480         <xsl:when test="not(/bedework/eventscalendar/year/month/week/day/event)">
481           <tr>
482             <td class="noEventsCell">
483               <xsl:copy-of select="$bwStr-LsVw-NoEventsToDisplay"/>
484             </td>
485           </tr>
486         </xsl:when>
487         <xsl:otherwise>
488           <xsl:for-each select="/bedework/eventscalendar/year/month/week/day[event]">
489             <xsl:if test="/bedework/periodname='Week' or /bedework/periodname='Month' or /bedework/periodname=''">
490               <tr>
491                 <td colspan="5" class="dateRow">
492                    <xsl:variable name="date" select="date"/>
493                    <!-- <a href="{$listEvents}&amp;startDate={$date}&amp;endDate={$date}"> -->
494                  
495                        <xsl:choose>
496                             <xsl:when test="/bedework/appvar/key = 'filter'">
497                               <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/>
498                               <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/>
499                               <!-- Define filters here: -->
500                               <xsl:choose>
501                                 <xsl:when test="$filterName = 'grpAndCats'">
502                                       <xsl:variable name="group" select="substring-before($filterVal, '~')" />
503                                               <xsl:variable name="cats" select="substring-after($filterVal, '~')" />
504                                                   <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$date}/grid-html/{$group}/{$cats}">
505                                         <xsl:value-of select="name"/>, <xsl:value-of select="longdate"/>
506                                       </a>
507                                 </xsl:when>
508                                 <xsl:otherwise>
509                                   <!-- Filter name not defined? Turn off filtering. -->
510                                   <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$date}/grid-html/all/all">
511                                         <xsl:value-of select="name"/>, <xsl:value-of select="longdate"/>
512                                       </a>
513                                 </xsl:otherwise>
514                               </xsl:choose>
515                             </xsl:when>
516                             <xsl:otherwise>
517                               <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$date}/grid-html/all/all">
518                                     <xsl:value-of select="name"/>, <xsl:value-of select="longdate"/>
519                           </a>
520                             </xsl:otherwise>
521                            </xsl:choose>
522                    
523                 </td>
524               </tr>
525             </xsl:if>
526             <xsl:for-each select="event">
527                      
528               <xsl:variable name="id" select="id"/>
529               <xsl:variable name="calPath" select="calendar/encodedPath"/>
530               <xsl:variable name="guid" select="guid"/>
531               <xsl:variable name="recurrenceId" select="recurrenceId"/>
532               <tr>
533                 <xsl:variable name="dateRangeStyle">
534                   <xsl:choose>
535                     <xsl:when test="start/shortdate = parent::day/shortdate">
536                       <xsl:choose>
537                         <xsl:when test="start/allday = 'true'">dateRangeCrossDay</xsl:when>
538                         <xsl:when test="start/hour24 &lt; 6">dateRangeEarlyMorning</xsl:when>
539                         <xsl:when test="start/hour24 &lt; 12">dateRangeMorning</xsl:when>
540                         <xsl:when test="start/hour24 &lt; 18">dateRangeAfternoon</xsl:when>
541                         <xsl:otherwise>dateRangeEvening</xsl:otherwise>
542                       </xsl:choose>
543                     </xsl:when>
544                     <xsl:otherwise>dateRangeCrossDay</xsl:otherwise>
545                   </xsl:choose>
546                 </xsl:variable>
547                 <xsl:choose>
548                   <xsl:when test="start/allday = 'true' and
549                                   start/shortdate = end/shortdate">
550                     <td class="{$dateRangeStyle} center" colspan="3">
551                       <xsl:copy-of select="$bwStr-LsVw-AllDay"/>
552                     </td>
553                   </xsl:when>
554                   <xsl:when test="start/shortdate = end/shortdate and
555                                   start/time = end/time">
556                     <td class="{$dateRangeStyle} center" colspan="3">
557                       <!--<a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
558                         <xsl:value-of select="start/time"/> -->
559                       <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}">
560                       </a>
561                     </td>
562                   </xsl:when>
563                   <xsl:otherwise>
564                     <td class="{$dateRangeStyle} right">
565                       <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
566                       <xsl:choose>
567                         <xsl:when test="start/allday = 'true' and
568                                         parent::day/shortdate = start/shortdate">
569                           <xsl:copy-of select="$bwStr-LsVw-Today"/>
570                         </xsl:when>
571                         <xsl:when test="parent::day/shortdate != start/shortdate">
572                           <span class="littleArrow">&#171;</span>&#160;
573                           <xsl:value-of select="start/month"/>/<xsl:value-of select="start/day"/>
574                         </xsl:when>
575                         <xsl:otherwise>
576                           <xsl:value-of select="start/time"/>
577                         </xsl:otherwise>
578                       </xsl:choose>
579                       </a>
580                     </td>
581                     <td class="{$dateRangeStyle} center">
582                           <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}"></a>
583                       <!-- <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">-</a> -->
584                     </td>
585                     <td class="{$dateRangeStyle} left">
586                           <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}">
587                       <!-- <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}"> -->
588                       <xsl:choose>
589                         <xsl:when test="end/allday = 'true' and
590                                         parent::day/shortdate = end/shortdate">
591                           <xsl:copy-of select="$bwStr-LsVw-Today"/>
592                         </xsl:when>
593                         <xsl:when test="parent::day/shortdate != end/shortdate">
594                           <xsl:value-of select="end/month"/>/<xsl:value-of select="end/day"/>
595                           &#160;<span class="littleArrow">&#187;</span>
596                         </xsl:when>
597                         <xsl:otherwise>
598                           <xsl:value-of select="end/time"/>
599                         </xsl:otherwise>
600                       </xsl:choose>
601                       </a>
602                     </td>
603                   </xsl:otherwise>
604                 </xsl:choose>
605                 <xsl:variable name="descriptionClass">
606                   <xsl:choose>
607                     <xsl:when test="status='CANCELLED'">description bwStatusCancelled</xsl:when>
608                     <xsl:when test="status='TENTATIVE'">description bwStatusTentative</xsl:when>
609                     <xsl:otherwise><xsl:copy-of select="$bwStr-LsVw-Description"/></xsl:otherwise>
610                   </xsl:choose>
611                 </xsl:variable>
612                 <!-- Subscription styles.
613                      These are set in the add/modify subscription forms in the admin client;
614                      if present, these override the background-color set by eventClass. The
615                      subscription styles should not be used for canceled events (tentative is ok). -->
616                 <xsl:variable name="subscriptionClass">
617                   <xsl:if test="status != 'CANCELLED'">
618                     <xsl:apply-templates select="categories" mode="customEventColor"/>
619                   </xsl:if>
620                 </xsl:variable>
621                 <td class="{$descriptionClass} {$subscriptionClass}">
622                   <xsl:if test="status='CANCELLED'"><strong><xsl:copy-of select="$bwStr-LsVw-Canceled"/><xsl:text> </xsl:text></strong></xsl:if>
623                   <xsl:choose>
624                     <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
625                           <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}">
626                       <!-- ><a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}"> -->
627                         <strong>
628                           <xsl:value-of select="summary"/>:
629                         </strong>
630                         <xsl:value-of select="description"/>&#160;
631                         <em>
632                           <xsl:value-of select="location/address"/>
633                           <xsl:if test="location/subaddress != ''">
634                             , <xsl:value-of select="location/subaddress"/>
635                           </xsl:if>.&#160;
636                           <xsl:if test="cost!=''">
637                             <xsl:value-of select="cost"/>.&#160;
638                           </xsl:if>
639                           <xsl:if test="contact/name!='none'">
640                             <xsl:copy-of select="$bwStr-LsVw-Contact"/><xsl:text> </xsl:text><xsl:value-of select="contact/name"/>
641                           </xsl:if>
642                         </em>
643                         -
644                         <span class="eventSubscription">
645                           <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
646                             <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
647                               <xsl:call-template name="substring-afterLastInstanceOf">
648                                 <xsl:with-param name="string" select="values/text"/>
649                                 <xsl:with-param name="char">/</xsl:with-param>
650                               </xsl:call-template>
651                               <xsl:if test="position()!=last()">, </xsl:if>
652                             </xsl:for-each>
653                           </xsl:if>
654                         </span>
655                       </a>
656                       <xsl:if test="link != ''">
657                         <xsl:variable name="link" select="link"/>
658                         <a href="{$link}" class="moreLink"><xsl:value-of select="link"/></a>
659                       </xsl:if>
660                     </xsl:when>
661                     <xsl:otherwise>
662                       <!-- ><a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}"> -->
663                           <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}">
664                         <xsl:value-of select="summary"/>
665                         <xsl:if test="location/address != ''">, <xsl:value-of select="location/address"/></xsl:if>
666                          -
667                         <span class="eventSubscription">
668                           <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
669                             <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
670                               <xsl:call-template name="substring-afterLastInstanceOf">
671                                 <xsl:with-param name="string" select="values/text"/>
672                                 <xsl:with-param name="char">/</xsl:with-param>
673                               </xsl:call-template>
674                               <xsl:if test="position()!=last()">, </xsl:if>
675                             </xsl:for-each>
676                           </xsl:if>
677                         </span>
678                       </a>
679                     </xsl:otherwise>
680                   </xsl:choose>
681                 </td>
682                 <td class="icons">
683                   <a href="{$privateCal}/event/addEventRef.do?calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="{$bwStr-LsVw-AddEventToMyCalendar}" target="myCalendar">
684                     <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon-small.gif" width="12" height="16" border="0" alt="{$bwStr-LsVw-AddEventToMyCalendar}"/>
685                   </a>
686                   <xsl:variable name="eventIcalName" select="concat($id,'.ics')"/>
687                   <a href="{$export}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;contentName={$eventIcalName}" title="{$bwStr-LsVw-DownloadEvent}">
688                     <img src="{$resourcesRoot}/images/std-ical_icon_small.gif" width="12" height="16" border="0" alt="{$bwStr-LsVw-DownloadEvent}"/>
689                   </a>
690                 </td>
691               </tr>
692             </xsl:for-each>
693           </xsl:for-each>
694         </xsl:otherwise>
695       </xsl:choose>
696     </table>
697   </xsl:template>
698
699   <!--==== LIST EVENTS - for listing discrete events ====-->
700   <xsl:template match="events" mode="eventList">
701     <h2 class="bwStatusConfirmed">
702       <!-- <form name="bwListEventsForm" action="{$listEvents}" method="post">
703         <input type="hidden" name="setappvar"/>-->
704         <xsl:copy-of select="$bwStr-LsEv-Next7Days"/>
705         <!--
706         <span id="bwListEventsFormControls">
707           <select name="catuid" onchange="this.form.submit();">
708             <option value="">filter by category...</option>
709             <xsl:for-each select="/bedework/categories/category">
710               <option>
711                 <xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute>
712                 <xsl:value-of select="keyword"/>
713               </option>
714             </xsl:for-each>
715           </select>
716           <select name="days" onchange="this.form.submit();">
717             <xsl:call-template name="buildListEventsDaysOptions">
718               <xsl:with-param name="i">1</xsl:with-param>
719               <xsl:with-param name="total">31</xsl:with-param>
720             </xsl:call-template>
721           </select>
722         </span>
723       </form>-->
724     </h2>
725
726     <div id="listEvents">
727       <ul>
728         <xsl:choose>
729           <xsl:when test="not(event)">
730             <li><xsl:copy-of select="$bwStr-LsEv-NoEventsToDisplay"/></li>
731           </xsl:when>
732           <xsl:otherwise>
733             <xsl:for-each select="event">
734               <xsl:variable name="id" select="id"/>
735               <xsl:variable name="calPath" select="calendar/encodedPath"/>
736               <xsl:variable name="guid" select="guid"/>
737               <xsl:variable name="recurrenceId" select="recurrenceId"/>
738               <li>
739                 <xsl:attribute name="class">
740                   <xsl:choose>
741                     <xsl:when test="status='CANCELLED'">bwStatusCancelled</xsl:when>
742                     <xsl:when test="status='TENTATIVE'">bwStatusTentative</xsl:when>
743                   </xsl:choose>
744                 </xsl:attribute>
745
746                 <xsl:if test="status='CANCELLED'"><strong><xsl:copy-of select="$bwStr-LsEv-Canceled"/><xsl:text> </xsl:text></strong></xsl:if>
747                 <xsl:if test="status='TENTATIVE'"><em><xsl:copy-of select="$bwStr-LsEv-Tentative"/><xsl:text> </xsl:text></em></xsl:if>
748                 <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}">
749                 <!-- <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">  -->
750                   <xsl:value-of select="summary"/>
751                 </a><xsl:if test="location/address != ''">, <xsl:value-of select="location/address"/></xsl:if>
752                 <xsl:if test="/bedework/appvar[key='listEventsSummaryMode']/value='details'">
753                   <xsl:if test="location/subaddress != ''">
754                     , <xsl:value-of select="location/subaddress"/>
755                   </xsl:if>
756                 </xsl:if>
757
758                 <xsl:text> </xsl:text>
759                 <a href="{$privateCal}/event/addEventRef.do?calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="{$bwStr-LsVw-AddEventToMyCalendar}" target="myCalendar">
760                   <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon-small.gif" width="12" height="16" border="0" alt="{$bwStr-LsVw-AddEventToMyCalendar}"/>
761                 </a>
762                 <xsl:text> </xsl:text>
763                 <xsl:variable name="eventIcalName" select="concat($id,'.ics')"/>
764                 <a href="{$export}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;contentName={$eventIcalName}" title="{$bwStr-LsEv-DownloadEvent}">
765                   <img src="{$resourcesRoot}/images/std-ical_icon_small.gif" width="12" height="16" border="0" alt="{$bwStr-LsEv-DownloadEvent}"/>
766                 </a>
767
768                 <br/>
769
770                 <xsl:value-of select="substring(start/dayname,1,3)"/>,
771                 <xsl:value-of select="start/longdate"/>
772                 <xsl:text> </xsl:text>
773                 <xsl:if test="start/allday != 'true'">
774                   <xsl:value-of select="start/time"/>
775                 </xsl:if>
776                 <xsl:choose>
777                   <xsl:when test="start/shortdate != end/shortdate">
778                     -
779                     <xsl:value-of select="substring(end/dayname,1,3)"/>,
780                     <xsl:value-of select="end/longdate"/>
781                     <xsl:text> </xsl:text>
782                     <xsl:if test="start/allday != 'true'">
783                       <xsl:value-of select="end/time"/>
784                     </xsl:if>
785                   </xsl:when>
786                   <xsl:otherwise>
787                     <xsl:if test="start/time != end/time">
788                       -
789                       <xsl:value-of select="end/time"/>
790                     </xsl:if>
791                   </xsl:otherwise>
792                 </xsl:choose>
793
794                 <xsl:if test="/bedework/appvar[key='listEventsSummaryMode']/value='details'">
795                   <br/>
796                   <xsl:value-of select="description"/>
797                   <xsl:if test="link != ''">
798                     <br/>
799                     <xsl:variable name="link" select="link"/>
800                     <a href="{$link}" class="moreLink"><xsl:value-of select="link"/></a>
801                   </xsl:if>
802                   <xsl:if test="categories/category">
803                     <br/>
804                     <xsl:copy-of select="$bwStr-LsEv-Categories"/>
805                     <xsl:for-each select="categories/category">
806                       <xsl:value-of select="word"/><xsl:if test="position() != last()">, </xsl:if>
807                     </xsl:for-each>
808                   </xsl:if>
809                   <br/>
810                   <em>
811                     <xsl:if test="cost!=''">
812                       <xsl:value-of select="cost"/>.&#160;
813                     </xsl:if>
814                     <xsl:if test="contact/name!='none'">
815                       <xsl:copy-of select="$bwStr-LsEv-Contact"/><xsl:text> </xsl:text><xsl:value-of select="contact/name"/>
816                     </xsl:if>
817                   </em>
818                 </xsl:if>
819
820               </li>
821             </xsl:for-each>
822           </xsl:otherwise>
823         </xsl:choose>
824       </ul>
825     </div>
826   </xsl:template>
827
828   <xsl:template name="buildListEventsDaysOptions">
829     <xsl:param name="i">1</xsl:param>
830     <xsl:param name="total">31</xsl:param>
831     <xsl:param name="default">7</xsl:param>
832     <xsl:variable name="selected"><xsl:value-of select="/bedework/appvar[key='listEventsDays']/value"/></xsl:variable>
833
834     <option onclick="this.form.setappvar.value='listEventsDay({$i})'">
835       <xsl:attribute name="value"><xsl:value-of select="$i"/></xsl:attribute>
836       <xsl:if test="($selected != '' and $i = $selected) or ($selected = '' and $i = $default)"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
837       <xsl:value-of select="$i"/>
838     </option>
839
840     <xsl:if test="$i &lt; $total">
841       <xsl:call-template name="buildListEventsDaysOptions">
842         <xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param>
843         <xsl:with-param name="total"><xsl:value-of select="$total"/></xsl:with-param>
844         <xsl:with-param name="default"><xsl:value-of select="$default"/></xsl:with-param>
845       </xsl:call-template>
846     </xsl:if>
847
848   </xsl:template>
849
850   <!--==== WEEK CALENDAR VIEW ====-->
851   <xsl:template name="weekView">
852     <table id="monthCalendarTable" border="0" cellpadding="0" cellspacing="0">
853       <tr>
854         <xsl:for-each select="/bedework/daynames/val">
855           <th class="dayHeading"><xsl:value-of select="."/></th>
856         </xsl:for-each>
857       </tr>
858       <tr>
859         <xsl:for-each select="/bedework/eventscalendar/year/month/week/day">
860           <xsl:variable name="dayPos" select="position()"/>
861           <xsl:if test="filler='false'">
862             <td>
863               <xsl:if test="/bedework/now/date = date">
864                 <xsl:attribute name="class">today</xsl:attribute>
865               </xsl:if>
866               <xsl:variable name="dayDate" select="date"/>
867               <!-- ><a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$dayDate}" class="dayLink">  -->
868                     <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$dayDate}/grid-html/all/all" class="dayLink">
869                 <xsl:value-of select="value"/>
870               </a>
871               <xsl:if test="event">
872                 <ul>
873                       <xsl:choose>
874                                     <xsl:when test="/bedework/appvar/key = 'filter'">
875                                       <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/>
876                                       <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/>
877                                       <!-- Define filters here: -->
878                                       <xsl:choose>
879                                         <xsl:when test="$filterName = 'grpAndCats'">
880                                               <xsl:call-template name="processGrpAndCats">
881                                                 <xsl:with-param name="list" select="$filterVal"/>
882                                                 <xsl:with-param name="dayPos" select="$dayPos"/>
883                                               </xsl:call-template>
884                                         </xsl:when>
885                                         <xsl:otherwise>
886                                           <!-- Filter name not defined? Turn off filtering. -->
887                                           <xsl:apply-templates select="event" mode="calendarLayout">
888                                                 <xsl:with-param name="dayPos" select="$dayPos"/>
889                                           </xsl:apply-templates>
890                                         </xsl:otherwise>
891                                       </xsl:choose>
892                                     </xsl:when>
893                                     <xsl:otherwise>
894                                       <xsl:apply-templates select="event" mode="calendarLayout">
895                                             <xsl:with-param name="dayPos" select="$dayPos"/>
896                                       </xsl:apply-templates>
897                                     </xsl:otherwise>
898                               </xsl:choose>
899                 </ul>
900               </xsl:if>
901             </td>
902           </xsl:if>
903         </xsl:for-each>
904       </tr>
905     </table>
906   </xsl:template>
907
908   <!--==== MONTH CALENDAR VIEW ====-->
909   <xsl:template name="monthView">
910     <table id="monthCalendarTable" border="0" cellpadding="0" cellspacing="0">
911       <tr>
912         <xsl:for-each select="/bedework/daynames/val">
913           <th class="dayHeading"><xsl:value-of select="."/></th>
914         </xsl:for-each>
915       </tr>
916       <xsl:for-each select="/bedework/eventscalendar/year/month/week">
917         <tr>
918           <xsl:for-each select="day">
919             <xsl:variable name="dayPos" select="position()"/>
920             <xsl:choose>
921               <xsl:when test="filler='true'">
922                 <td class="filler">&#160;</td>
923               </xsl:when>
924               <xsl:otherwise>
925                 <td>
926                   <xsl:if test="/bedework/now/date = date">
927                     <xsl:attribute name="class">today</xsl:attribute>
928                   </xsl:if>
929                   <xsl:variable name="dayDate" select="date"/>
930                   <xsl:choose>
931                                     <xsl:when test="/bedework/appvar/key = 'filter'">
932                               <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/>
933                               <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/>
934                               <!-- Define filters here: -->
935                               <xsl:choose>
936                                 <xsl:when test="$filterName = 'grpAndCats'">
937                                       <xsl:variable name="group" select="substring-before($filterVal, '~')" />
938                                               <xsl:variable name="cats" select="substring-after($filterVal, '~')" />
939                                                   <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$dayDate}/grid-html/{$group}/{$cats}">
940                                         <xsl:value-of select="value"/>
941                                       </a>
942                                 </xsl:when>
943                                 <xsl:otherwise>
944                                   <!-- Filter name not defined? Turn off filtering. -->
945                                   <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$dayDate}/grid-html/all/all">
946                                         <xsl:value-of select="value"/>
947                                       </a>
948                                 </xsl:otherwise>
949                               </xsl:choose>
950                             </xsl:when>
951                             <xsl:otherwise>
952                               <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$dayDate}/grid-html/all/all">
953                                     <xsl:value-of select="value"/>
954                           </a>
955                             </xsl:otherwise>
956                           </xsl:choose>
957                   <xsl:if test="event">
958                     <ul>
959                           <xsl:choose>
960                                     <xsl:when test="/bedework/appvar/key = 'filter'">
961                                       <xsl:variable name="filterName" select="substring-before(/bedework/appvar[key='filter']/value,':')"/>
962                                       <xsl:variable name="filterVal" select="substring-after(/bedework/appvar[key='filter']/value,':')"/>
963                                       <!-- Define filters here: -->
964                                       <xsl:choose>
965                                         <xsl:when test="$filterName = 'grpAndCats'">
966                                               <xsl:call-template name="processGrpAndCats">
967                                                 <xsl:with-param name="list" select="$filterVal"/>
968                                                 <xsl:with-param name="dayPos" select="$dayPos"/>
969                                               </xsl:call-template>
970                                         </xsl:when>
971                                         <xsl:otherwise>
972                                           <!-- Filter name not defined? Turn off filtering. -->
973                                           <xsl:apply-templates select="event" mode="calendarLayout">
974                                                 <xsl:with-param name="dayPos" select="$dayPos"/>
975                                           </xsl:apply-templates>
976                                         </xsl:otherwise>
977                                       </xsl:choose>
978                                     </xsl:when>
979                                     <xsl:otherwise>
980                                       <xsl:apply-templates select="event" mode="calendarLayout">
981                                             <xsl:with-param name="dayPos" select="$dayPos"/>
982                                       </xsl:apply-templates>
983                                     </xsl:otherwise>
984                                   </xsl:choose>
985                     </ul>
986                   </xsl:if>
987                 </td>
988               </xsl:otherwise>
989             </xsl:choose>
990           </xsl:for-each>
991         </tr>
992       </xsl:for-each>
993     </table>
994   </xsl:template>
995
996   <!--== EVENTS IN THE CALENDAR GRID ==-->
997   <xsl:template match="event" mode="calendarLayout">
998     <xsl:param name="dayPos"/>
999     <xsl:variable name="calPath" select="calendar/encodedPath"/>
1000     <xsl:variable name="guid" select="guid"/>
1001     <xsl:variable name="recurrenceId" select="recurrenceId"/>
1002     <xsl:variable name="eventClass">
1003       <xsl:choose>
1004         <!-- Special styles for the month grid -->
1005         <xsl:when test="status='CANCELLED'">eventCancelled</xsl:when>
1006         <xsl:when test="status='TENTATIVE'">eventTentative</xsl:when>
1007         <!-- Default alternating colors for all standard events -->
1008         <xsl:when test="position() mod 2 = 1">eventLinkA</xsl:when>
1009         <xsl:otherwise>eventLinkB</xsl:otherwise>
1010       </xsl:choose>
1011     </xsl:variable>
1012     <!-- Subscription styles.
1013          These are set in the add/modify subscription forms in the admin client;
1014          if present, these override the background-color set by eventClass. The
1015          subscription styles should not be used for canceled events (tentative is ok). -->
1016     <xsl:variable name="subscriptionClass">
1017       <xsl:if test="status != 'CANCELLED'">
1018         <xsl:apply-templates select="categories" mode="customEventColor"/>
1019       </xsl:if>
1020     </xsl:variable>
1021     <li>
1022       <!-- <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" class="{$eventClass} {$subscriptionClass}"> -->
1023           <a href="{$bwCacheHostUrl}/v1.0/event/list-html/{$recurrenceId}/{$guid}" class="{$eventClass} {$subscriptionClass}">
1024       <xsl:if test="status='CANCELLED'"><xsl:copy-of select="$bwStr-EvCG-CanceledColon"/><xsl:text> </xsl:text></xsl:if>
1025       <xsl:choose>
1026         <xsl:when test="start/shortdate != ../shortdate">
1027           <xsl:copy-of select="$bwStr-EvCG-Cont"/>
1028         </xsl:when>
1029         <xsl:when test="start/allday = 'false'">
1030           <xsl:value-of select="start/time"/>:
1031         </xsl:when>
1032         <xsl:otherwise>
1033           <xsl:copy-of select="$bwStr-EvCG-AllDayColon"/>
1034         </xsl:otherwise>
1035       </xsl:choose>
1036       <xsl:value-of select="summary"/>
1037       <xsl:variable name="eventTipClass">
1038         <xsl:choose>
1039           <xsl:when test="$dayPos &gt; 5">
1040                 eventTipReverse
1041               </xsl:when>
1042           <xsl:otherwise>
1043                 eventTip
1044               </xsl:otherwise>
1045         </xsl:choose>
1046       </xsl:variable>
1047         <span class="{$eventTipClass}">
1048           <xsl:if test="status='CANCELLED'"><span class="eventTipStatusCancelled"><xsl:copy-of select="$bwStr-EvCG-CanceledColon"/></span></xsl:if>
1049           <xsl:if test="status='TENTATIVE'"><span class="eventTipStatusTentative"><xsl:copy-of select="$bwStr-EvCG-Tentative"/></span></xsl:if>
1050           <strong><xsl:value-of select="summary"/></strong><br/>
1051           <xsl:copy-of select="$bwStr-EvCG-Time"/>
1052           <xsl:choose>
1053             <xsl:when test="start/allday = 'true'">
1054               <xsl:copy-of select="$bwStr-EvCG-AllDay"/>
1055             </xsl:when>
1056             <xsl:otherwise>
1057               <xsl:if test="start/shortdate != ../shortdate">
1058                 <xsl:value-of select="start/month"/>/<xsl:value-of select="start/day"/>
1059                 <xsl:text> </xsl:text>
1060               </xsl:if>
1061               <xsl:value-of select="start/time"/>
1062               <xsl:if test="(start/time != end/time) or (start/shortdate != end/shortdate)">
1063                 -
1064                 <xsl:if test="end/shortdate != ../shortdate">
1065                   <xsl:value-of select="end/month"/>/<xsl:value-of select="end/day"/>
1066                   <xsl:text> </xsl:text>
1067                 </xsl:if>
1068                 <xsl:value-of select="end/time"/>
1069               </xsl:if>
1070             </xsl:otherwise>
1071           </xsl:choose>
1072           <br/>
1073           <xsl:if test="location/address">
1074             <xsl:copy-of select="$bwStr-EvCG-Location"/><xsl:text> </xsl:text><xsl:value-of select="location/address"/><br/>
1075           </xsl:if>
1076           <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
1077             <xsl:copy-of select="$bwStr-EvCG-TopicalArea"/>
1078               <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
1079                 <xsl:call-template name="substring-afterLastInstanceOf">
1080                   <xsl:with-param name="string" select="values/text"/>
1081                   <xsl:with-param name="char">/</xsl:with-param>
1082                 </xsl:call-template>
1083                 <xsl:if test="position()!=last()">, </xsl:if>
1084               </xsl:for-each>
1085           </xsl:if>
1086         </span>
1087       </a>
1088     </li>
1089   </xsl:template>
1090
1091   <xsl:template match="categories" mode="customEventColor">
1092     <!-- Set custom color schemes here.
1093          This template looks at the categories found in the event and
1094          returns a color class for use with the "subscriptionClass" variable.
1095          The classes suggested below come from bwColors.css found in the bedework-common directory. -->
1096     <xsl:choose>
1097        <!--
1098        <xsl:when test="category/value = 'Athletics'">bwltpurple</xsl:when>
1099        <xsl:when test="category/value = 'Arts'">bwltsalmon</xsl:when>
1100        -->
1101        <xsl:otherwise></xsl:otherwise> <!-- do nothing -->
1102     </xsl:choose>
1103   </xsl:template>
1104
1105   <!--==== YEAR VIEW ====-->
1106   <xsl:template name="yearView">
1107     <table id="yearCalendarTable" border="0" cellpadding="0" cellspacing="0">
1108       <tr>
1109         <xsl:apply-templates select="/bedework/eventscalendar/year/month[position() &lt;= 3]"/>
1110       </tr>
1111       <tr>
1112         <xsl:apply-templates select="/bedework/eventscalendar/year/month[(position() &gt; 3) and (position() &lt;= 6)]"/>
1113       </tr>
1114       <tr>
1115         <xsl:apply-templates select="/bedework/eventscalendar/year/month[(position() &gt; 6) and (position() &lt;= 9)]"/>
1116       </tr>
1117       <tr>
1118         <xsl:apply-templates select="/bedework/eventscalendar/year/month[position() &gt; 9]"/>
1119       </tr>
1120     </table>
1121   </xsl:template>
1122
1123   <!-- year view month tables -->
1124   <xsl:template match="month">
1125     <td>
1126       <table class="yearViewMonthTable" border="0" cellpadding="0" cellspacing="0">
1127         <tr>
1128           <td colspan="8" class="monthName">
1129             <xsl:variable name="firstDayOfMonth" select="week/day/date"/>
1130             <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/month/{$firstDayOfMonth}/grid-html/all/all">
1131             <!-- <a href="{$setViewPeriod}&amp;viewType=monthView&amp;date={$firstDayOfMonth}">  -->
1132               <xsl:value-of select="longname"/>
1133             </a>
1134           </td>
1135         </tr>
1136         <tr>
1137           <th>&#160;</th>
1138           <xsl:for-each select="/bedework/shortdaynames/val">
1139             <th><xsl:value-of select="."/></th>
1140           </xsl:for-each>
1141         </tr>
1142         <xsl:for-each select="week">
1143           <tr>
1144             <td class="weekCell">
1145               <xsl:variable name="firstDayOfWeek" select="day/date"/>
1146               <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/week/{$firstDayOfWeek}/grid-html/all/all">
1147               <!-- <a href="{$setViewPeriod}&amp;viewType=weekView&amp;date={$firstDayOfWeek}"> -->
1148                 <xsl:value-of select="value"/>
1149               </a>
1150             </td>
1151             <xsl:for-each select="day">
1152               <xsl:choose>
1153                 <xsl:when test="filler='true'">
1154                   <td class="filler">&#160;</td>
1155                 </xsl:when>
1156                 <xsl:otherwise>
1157                   <td>
1158                     <xsl:if test="/bedework/now/date = date">
1159                       <xsl:attribute name="class">today</xsl:attribute>
1160                     </xsl:if>
1161                     <xsl:variable name="dayDate" select="date"/>
1162                     <a href="{$bwCacheHostUrl}/v1.0/genFeedPeriod/day/{$dayDate}/grid-html/all/all">
1163                     <!-- <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$dayDate}"> -->
1164                       <xsl:attribute name="class">today</xsl:attribute>
1165                       <xsl:value-of select="value"/>
1166                     </a>
1167                   </td>
1168                 </xsl:otherwise>
1169               </xsl:choose>
1170             </xsl:for-each>
1171           </tr>
1172         </xsl:for-each>
1173       </table>
1174     </td>
1175   </xsl:template>
1176
1177   <!--==== CALENDARS ====--> 
1178
1179   <!-- calendar export page -->
1180   <xsl:template match="currentCalendar" mode="export">
1181     <h2 class="bwStatusConfirmed"><xsl:copy-of select="$bwStr-Cals-ExportCals"/></h2>
1182     <div id="export">
1183       <p>
1184         <strong><xsl:copy-of select="$bwStr-Cals-CalendarToExport"/></strong>
1185       </p>
1186       <div class="indent">
1187         <xsl:copy-of select="$bwStr-Cals-Name"/><xsl:text> </xsl:text><strong><em><xsl:value-of select="name"/></em></strong><br/>
1188         <xsl:copy-of select="$bwStr-Cals-Path"/><xsl:text> </xsl:text><xsl:value-of select="path"/>
1189       </div>
1190       <p>
1191         <strong><xsl:copy-of select="$bwStr-Cals-EventDateLimits"/></strong>
1192       </p>
1193       <form name="exportCalendarForm" id="exportCalendarForm" action="{$export}" method="post">
1194         <input type="hidden" name="calPath">
1195           <xsl:attribute name="value"><xsl:value-of select="path"/></xsl:attribute>
1196         </input>
1197         <!-- fill these on submit -->
1198         <input type="hidden" name="eventStartDate.year" value=""/>
1199         <input type="hidden" name="eventStartDate.month" value=""/>
1200         <input type="hidden" name="eventStartDate.day" value=""/>
1201         <input type="hidden" name="eventEndDate.year" value=""/>
1202         <input type="hidden" name="eventEndDate.month" value=""/>
1203         <input type="hidden" name="eventEndDate.day" value=""/>
1204         <!-- static fields -->
1205         <input type="hidden" name="nocache" value="no"/>
1206         <input type="hidden" name="contentName">
1207           <xsl:attribute name="value"><xsl:value-of select="name"/>.ics</xsl:attribute>
1208         </input>
1209         <!-- visible fields -->
1210         <input type="radio" name="dateLimits" value="active" checked="checked" onclick="changeClass('exportDateRange','invisible')"/><xsl:text> </xsl:text><xsl:copy-of select="$bwStr-Cals-TodayForward"/>
1211         <input type="radio" name="dateLimits" value="none" onclick="changeClass('exportDateRange','invisible')"/><xsl:text> </xsl:text><xsl:copy-of select="$bwStr-Cals-AllDates"/>
1212         <input type="radio" name="dateLimits" value="limited" onclick="changeClass('exportDateRange','visible')"/><xsl:text> </xsl:text><xsl:copy-of select="$bwStr-Cals-DateRange"/>
1213         <div id="exportDateRange" class="invisible">
1214           <xsl:copy-of select="$bwStr-Cals-Start"/><xsl:text> </xsl:text><input type="text" name="bwExportCalendarWidgetStartDate" id="bwExportCalendarWidgetStartDate" size="10"/>
1215           <span id="bwExportEndField">E<xsl:copy-of select="$bwStr-Cals-End"/><xsl:text> </xsl:text><input type="text" name="bwExportCalendarWidgetEndDate" id="bwExportCalendarWidgetEndDate" size="10"/></span>
1216         </div>
1217         <p><input type="submit" value="{$bwStr-Cals-Export}" class="bwWidgetSubmit" onclick="fillExportFields(this.form)"/></p>
1218       </form>
1219     </div>
1220   </xsl:template>
1221
1222   <xsl:template name="processGrpAndCats">
1223     <xsl:param name="list" />
1224     <xsl:param name="dayPos" />
1225     <xsl:variable name="group" select="substring-before($list, '~')" />
1226     <xsl:variable name="remaining" select="substring-after($list, '~')" />
1227     <xsl:call-template name="processCategories">
1228           <xsl:with-param name="group" select="$group" />
1229       <xsl:with-param name="list" select="$remaining" />
1230       <xsl:with-param name="dayPos" select="$dayPos" />
1231     </xsl:call-template>
1232   </xsl:template>
1233
1234   <xsl:template name="processCategories">
1235         <xsl:param name="group" />
1236     <xsl:param name="list" />
1237     <xsl:param name="dayPos" />
1238     <xsl:choose>
1239           <xsl:when test="contains($list, '~')">
1240                 <!-- Grab the first off the list and process -->
1241                 <xsl:variable name="catid" select="substring-before($list, '~')" />
1242             <xsl:variable name="remaining" select="substring-after($list, '~')" />
1243             <xsl:choose>
1244                   <xsl:when test="$group = 'all'">
1245 >               <xsl:apply-templates select="event[categories/category/id = $catid]" mode="calendarLayout"> 
1246                   <xsl:with-param name="dayPos" select="$dayPos"/>
1247                 </xsl:apply-templates>
1248               </xsl:when>
1249               <xsl:otherwise>
1250                 <xsl:apply-templates select="event[categories/category/id = $catid]" mode="calendarLayout">
1251                   <xsl:with-param name="dayPos" select="$dayPos"/>
1252                 </xsl:apply-templates>
1253               </xsl:otherwise>
1254             </xsl:choose>
1255
1256                 <!-- now use recursion to process the remaining categories -->
1257             <xsl:call-template name="processCategories">
1258               <xsl:with-param name="group" select="$group" />             
1259               <xsl:with-param name="list" select="$remaining" />
1260               <xsl:with-param name="dayPos" select="$dayPos" />
1261             </xsl:call-template>
1262           </xsl:when>
1263           <xsl:otherwise>
1264             <!-- No more tildes, so this is the last category.  Process it -->
1265                 <xsl:choose>
1266                   <xsl:when test="$group = 'all'">
1267                         <xsl:choose>
1268                           <xsl:when test="$list = 'all'">
1269                     <xsl:apply-templates select="event" mode="calendarLayout">
1270                           <xsl:with-param name="dayPos" select="$dayPos"/>
1271                         </xsl:apply-templates>
1272                   </xsl:when>
1273                   <xsl:otherwise>
1274                         <xsl:apply-templates select="event[categories/category/id = $list]" mode="calendarLayout">
1275                               <xsl:with-param name="dayPos" select="$dayPos"/>
1276                         </xsl:apply-templates>
1277                       </xsl:otherwise>
1278                 </xsl:choose>
1279               </xsl:when>
1280               <xsl:otherwise>
1281                     <xsl:choose>
1282                           <xsl:when test="$list = 'all'">
1283                     <xsl:apply-templates select="event[creator = $group]" />
1284                   </xsl:when>
1285                   <xsl:otherwise>
1286                         <xsl:choose>
1287                           <xsl:when test="event/creator = $group">
1288                                 <xsl:apply-templates select="event[categories/category/id = $list]" mode="calendarLayout">
1289                                       <xsl:with-param name="dayPos" select="$dayPos"/>
1290                                 </xsl:apply-templates>
1291                           </xsl:when>
1292                         </xsl:choose>
1293                       </xsl:otherwise>
1294                         </xsl:choose>
1295               </xsl:otherwise>
1296             </xsl:choose>
1297           </xsl:otherwise>
1298         </xsl:choose>
1299   </xsl:template>
1300
1301 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.