root/releases/bedework-3.6/deployment/webpublic/webapp/resources/demoskins/MainCampus/themes/bedeworkTheme/eventList.xsl

Revision 2682 (checked in by johnsa, 3 years ago)

public client: fix ticket:528 - ics download names in event list built from guid

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4   xmlns="http://www.w3.org/1999/xhtml">
5
6
7   <!--======== list events ==========-->
8   <!-- This formats a list of events from /bedework/eventscalendar, the default
9        day, week, and month views.  Look to eventListDiscrete.xsl for the listing
10        produced by the listEvents.do action -->
11
12
13   <xsl:template name="eventList">
14
15     <table class="eventList">
16
17       <!-- display information about the current selection state if not default -->
18       <xsl:choose>
19         <xsl:when test="/bedework/selectionState/selectionType = 'collections'">
20           <tr>
21             <td class="eventFilterInfo" colspan="3">
22               <xsl:copy-of select="$bwStr-LsVw-DispEventsForCal"/>
23               <xsl:text> </xsl:text>
24               <span class="displayFilterName">
25                 <xsl:call-template name="substring-afterLastInstanceOf">
26                   <xsl:with-param name="string" select="/bedework/selectionState/collection/virtualpath"/>
27                   <xsl:with-param name="char">/</xsl:with-param>
28                 </xsl:call-template>
29               </span><xsl:text> </xsl:text>
30               <a id="allView" href="{$setSelection}"><xsl:copy-of select="$bwStr-LsVw-ShowAll"/></a></td>
31           </tr>
32         </xsl:when>
33         <xsl:when test="/bedework/selectionState/view/name != 'All'">
34           <tr>
35             <td class="eventFilterInfo" colspan="3">
36               <xsl:copy-of select="$bwStr-LsVw-DispEventsForView"/>
37               <xsl:text> </xsl:text>
38               <span class="displayFilterName">
39                 <xsl:value-of select="/bedework/selectionState/view/name"/>
40               </span><xsl:text> </xsl:text>
41             <a id="allView" href="{$setSelection}"><xsl:copy-of select="$bwStr-LsVw-ShowAll"/></a></td>
42           </tr>
43         </xsl:when>
44       </xsl:choose>
45
46       <!-- produce the list of events -->
47       <xsl:choose>
48         <xsl:when test="not(/bedework/eventscalendar/year/month/week/day/event)">
49           <tr>
50             <td class="noEventsCell">
51               <xsl:copy-of select="$bwStr-LsVw-NoEventsToDisplay"/>
52             </td>
53           </tr>
54         </xsl:when>
55         <xsl:when test="$ongoingEventsEnabled = 'true'
56                and ($ongoingEventsShowForCollection = 'true' and not(/bedework/selectionState/selectionType = 'collections'))
57                and not(/bedework/eventscalendar/year/month/week/day/event[not(categories/category/uid = $ongoingEventsCatUid)])">
58             <tr>
59               <td class="noEventsCell">
60                 <xsl:copy-of select="$bwStr-LsVw-NoEventsToDisplayWithOngoing"/>
61               </td>
62             </tr>
63         </xsl:when>
64         <xsl:otherwise>
65           <xsl:choose>
66             <xsl:when test="$ongoingEventsEnabled = 'true'
67                    and ($ongoingEventsShowForCollection = 'true' and not(/bedework/selectionState/selectionType = 'collections'))">
68               <xsl:apply-templates select="/bedework/eventscalendar/year/month/week/day[event[not(categories/category/uid = $ongoingEventsCatUid)]]" mode="dayInList"/>
69             </xsl:when>
70             <xsl:otherwise>
71               <xsl:apply-templates select="/bedework/eventscalendar/year/month/week/day[event]" mode="dayInList"/>
72             </xsl:otherwise>
73           </xsl:choose>
74         </xsl:otherwise>
75       </xsl:choose>
76     </table>
77   </xsl:template>
78
79   <xsl:template match="day" mode="dayInList">
80      <tr>
81        <td colspan="2" class="dateRow">
82           <xsl:variable name="date" select="date"/>
83           <a href="{$setViewPeriod}&amp;viewType=dayView&amp;date={$date}">
84             <xsl:value-of select="name"/>, <xsl:value-of select="longdate"/>
85           </a>
86        </td>
87      </tr>
88       <xsl:choose>
89        <xsl:when test="$ongoingEventsEnabled = 'true'
90                   and ($ongoingEventsShowForCollection = 'true' and not(/bedework/selectionState/selectionType = 'collections'))">
91          <xsl:apply-templates select="event[not(categories/category/uid = $ongoingEventsCatUid)]" mode="eventInList"/>
92        </xsl:when>
93        <xsl:otherwise>
94          <xsl:apply-templates select="event" mode="eventInList"/>
95        </xsl:otherwise>
96      </xsl:choose>
97    </xsl:template>
98
99    <xsl:template match="event" mode="eventInList">
100     <xsl:variable name="id" select="id"/>
101     <xsl:variable name="calPath" select="calendar/encodedPath"/>
102     <xsl:variable name="guid" select="guid"/>
103     <xsl:variable name="guidEsc" select="translate(guid, '.', '_')"/>
104     <xsl:variable name="recurrenceId" select="recurrenceId"/>
105     <tr>
106       <xsl:variable name="dateRangeStyle">
107         <xsl:choose>
108           <xsl:when test="start/shortdate = parent::day/shortdate">
109             <xsl:choose>
110               <xsl:when test="start/allday = 'true'">dateRangeCrossDay</xsl:when>
111               <xsl:when test="start/hour24 &lt; 6">dateRangeEarlyMorning</xsl:when>
112               <xsl:when test="start/hour24 &lt; 12">dateRangeMorning</xsl:when>
113               <xsl:when test="start/hour24 &lt; 18">dateRangeAfternoon</xsl:when>
114               <xsl:otherwise>dateRangeEvening</xsl:otherwise>
115             </xsl:choose>
116           </xsl:when>
117           <xsl:otherwise>dateRangeCrossDay</xsl:otherwise>
118         </xsl:choose>
119       </xsl:variable>
120
121       <!-- Event Date / Time Column  -->
122       <td class="time {$dateRangeStyle}">
123        <xsl:choose>
124         <xsl:when test="start/allday = 'true' and start/shortdate = end/shortdate">
125             <xsl:copy-of select="$bwStr-LsVw-AllDay"/>
126         </xsl:when>
127         <xsl:when test="start/shortdate = end/shortdate and start/time = end/time">
128           <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
129             <xsl:value-of select="start/time"/>
130           </a>
131         </xsl:when>
132         <xsl:otherwise>
133           <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
134             <xsl:choose>
135               <xsl:when test="start/allday = 'true' and
136                               parent::day/shortdate = start/shortdate">
137                 <xsl:copy-of select="$bwStr-LsVw-Today"/>
138               </xsl:when>
139               <xsl:when test="parent::day/shortdate != start/shortdate">
140                 <span class="littleArrow">&#171;</span>&#160;
141                 <xsl:value-of select="start/month"/>/<xsl:value-of select="start/day"/>
142               </xsl:when>
143               <xsl:otherwise>
144                 <xsl:value-of select="start/time"/>
145               </xsl:otherwise>
146             </xsl:choose>
147             -
148            <xsl:choose>
149              <xsl:when test="end/allday = 'true' and
150                              parent::day/shortdate = end/shortdate">
151                <xsl:copy-of select="$bwStr-LsVw-Today"/>
152              </xsl:when>
153              <xsl:when test="parent::day/shortdate != end/shortdate">
154                <xsl:value-of select="end/month"/>/<xsl:value-of select="end/day"/>
155                &#160;<span class="littleArrow">&#187;</span>
156              </xsl:when>
157              <xsl:otherwise>
158                <xsl:value-of select="end/time"/>
159              </xsl:otherwise>
160            </xsl:choose>
161           </a>
162        </xsl:otherwise>
163      </xsl:choose>
164     </td>
165
166
167     <!-- Event Description Column -->
168
169     <td>
170       <xsl:attribute name="class">
171         <xsl:choose>
172           <xsl:when test="status='CANCELLED'">description bwStatusCancelled</xsl:when>
173           <xsl:when test="status='TENTATIVE'">description bwStatusTentative</xsl:when>
174           <xsl:otherwise><xsl:copy-of select="$bwStr-LsVw-Description"/></xsl:otherwise>
175         </xsl:choose>
176       </xsl:attribute>
177
178       <ul>
179         <li class="titleEvent">
180
181           <!-- event icons -->
182           <span class="icons">
183             <xsl:variable name="gStartdate" select="start/utcdate"/>
184             <xsl:variable name="gLocation" select="location/address"/>
185             <xsl:variable name="gEnddate" select="end/utcdate"/>
186             <xsl:variable name="gText" select="summary"/>
187             <xsl:variable name="gDetails" select="summary"/>
188
189             <xsl:if test="$eventIconDownloadIcs = 'true'">
190               <xsl:variable name="eventIcalName" select="concat($guid,'.ics')"/>
191               <a href="{$export}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;contentName={$eventIcalName}" title="{$bwStr-SgEv-Download}">
192                 <img src="{$resourcesRoot}/images/std-ical_icon_small.gif" alt="{$bwStr-SgEv-Download}"/>
193               </a>
194             </xsl:if>
195             <xsl:if test="$eventIconAddToMyCal = 'true'">
196               <a href="{$privateCal}/event/addEventRef.do?calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="{$bwStr-LsVw-AddEventToMyCalendar}" target="myCalendar">
197                 <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon-small.gif" width="12" height="16" border="0" alt="{$bwStr-LsVw-AddEventToMyCalendar}"/>
198               </a>
199             </xsl:if>
200             <xsl:if test="$eventIconFacebook = 'true'">
201               <xsl:choose>
202                 <xsl:when test="string-length($recurrenceId)">
203                   <a href="http://www.facebook.com/share.php?u={$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;t={$gText}" title="{$bwStr-SgEv-AddToFacebook}">
204                     <img title="Add to Facebook" src="{$resourcesRoot}/images/Facebook_Badge_small.gif" alt="{$bwStr-SgEv-AddToFacebook}"/>
205                   </a>
206                 </xsl:when>
207                 <xsl:otherwise>
208                   <a href="http://www.facebook.com/share.php?u={$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;t={$gText}" title="{$bwStr-SgEv-AddToFacebook}">
209                     <img title="Add to Facebook" src="{$resourcesRoot}/images/Facebook_Badge_small.gif" alt="{$bwStr-SgEv-AddToFacebook}"/>
210                   </a>
211                 </xsl:otherwise>
212               </xsl:choose>
213             </xsl:if>
214             <xsl:if test="$eventIconGoogleCal = 'true'">
215               <a href="http://www.google.com/calendar/event?action=TEMPLATE&amp;dates={$gStartdate}/{$gEnddate}&amp;text={$gText}&amp;details={$gDetails}&amp;location={$gLocation}">
216                 <img title="{$bwStr-SgEv-AddToGoogleCalendar}" src="{$resourcesRoot}/images/gcal_small.gif" alt="{$bwStr-SgEv-AddToGoogleCalendar}"/>
217               </a>
218             </xsl:if>
219             <xsl:if test="$eventIconShareThis = 'true'">
220               <a href="http://www.bedework.org/trac/bedework/wiki/BedeworkManual/v3.6/ShareThis">
221                 <img title="{$bwStr-SgEv-ShareThis}" src="{$resourcesRoot}/images/share-icon-16x16.png" alt="{$bwStr-SgEv-ShareThis}"/>
222               </a>
223             </xsl:if>
224           </span>
225
226           <!-- event title -->
227           <xsl:if test="status='CANCELLED'"><strong><xsl:copy-of select="$bwStr-LsVw-Canceled"/><xsl:text> </xsl:text></strong></xsl:if>
228           <xsl:if test="status='TENTATIVE'"><strong><xsl:copy-of select="$bwStr-LsEv-Tentative"/><xsl:text> </xsl:text></strong></xsl:if>
229           <a href="{$eventView}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
230             <xsl:value-of select="summary"/>
231             <xsl:if test="summary = ''">
232               <xsl:copy-of select="$bwStr-SgEv-NoTitle" />
233             </xsl:if>
234           </a>
235         </li>
236
237         <xsl:choose>
238           <xsl:when test="/bedework/appvar[key='summaryMode']/value='details'">
239             <xsl:if test="location/address != ''">
240               <li>
241                 <xsl:copy-of select="$bwStr-LsVw-Location"/><xsl:text> </xsl:text>
242                 <xsl:value-of select="location/address"/>
243                 <xsl:if test="location/subaddress != ''">
244                   , <xsl:value-of select="location/subaddress"/>
245                 </xsl:if>
246               </li>
247             </xsl:if>
248
249             <xsl:if test="cost!=''">
250               <li>
251                 <xsl:copy-of select="$bwStr-LsVw-Cost"/><xsl:text> </xsl:text>
252                 <xsl:value-of select="cost"/>
253               </li>
254             </xsl:if>
255
256             <xsl:if test="contact/name!='none'">
257               <li>
258                 <xsl:copy-of select="$bwStr-LsVw-Contact"/><xsl:text> </xsl:text>
259                 <xsl:value-of select="contact/name"/>
260               </li>
261             </xsl:if>
262
263             <li>
264               <xsl:copy-of select="$bwStr-LsVw-Description"/><xsl:text> </xsl:text>
265               <xsl:value-of select="description"/>
266             </li>
267
268             <xsl:if test="link != ''">
269               <li>
270                 <xsl:copy-of select="$bwStr-LsVw-Link"/><xsl:text> </xsl:text>
271                 <a>
272                   <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
273                   <xsl:value-of select="link"/>
274                 </a>
275               </li>
276             </xsl:if>
277
278             <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
279               <li>
280                 <xsl:copy-of select="$bwStr-LsVw-TopicalArea"/><xsl:text> </xsl:text>
281                 <span class="eventSubscription">
282                   <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
283                     <xsl:call-template name="substring-afterLastInstanceOf">
284                       <xsl:with-param name="string" select="values/text"/>
285                       <xsl:with-param name="char">/</xsl:with-param>
286                     </xsl:call-template>
287                     <xsl:if test="position()!=last()">, </xsl:if>
288                   </xsl:for-each>
289                 </span>
290               </li>
291             </xsl:if>
292
293           </xsl:when>
294           <xsl:otherwise>
295
296             <li>
297               <xsl:copy-of select="$bwStr-LsVw-Location"/><xsl:text> </xsl:text>
298               <xsl:value-of select="location/address" />
299             </li>
300
301             <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
302               <li>
303                 <xsl:copy-of select="$bwStr-LsVw-TopicalArea"/><xsl:text> </xsl:text>
304                 <span class="eventSubscription">
305                   <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
306                     <xsl:call-template name="substring-afterLastInstanceOf">
307                       <xsl:with-param name="string" select="values/text"/>
308                       <xsl:with-param name="char">/</xsl:with-param>
309                     </xsl:call-template>
310                     <xsl:if test="position()!=last()">, </xsl:if>
311                   </xsl:for-each>
312                 </span>
313               </li>
314             </xsl:if>
315
316           </xsl:otherwise>
317         </xsl:choose>
318       </ul>
319     </td>
320     <!-- td class="icons">
321         keep and place icons here if spacing is an issue
322         (but change the day cell to colspan=3)
323       </td-->
324     </tr>
325   </xsl:template>
326
327 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.