root/trunk/deployment/webpublic/webapp/resources/demoskins/MainCampus/themes/bedeworkTheme/event.xsl

Revision 3614 (checked in by douglm, 10 months ago)

New addEventSub stuff added to stylesheets (NOT es yet).

Only enabled for single event display for testing. Also needs some work to allow specification of sharing collection name

Line 
1 <!--
2     Licensed to Jasig under one or more contributor license
3     agreements. See the NOTICE file distributed with this work
4     for additional information regarding copyright ownership.
5     Jasig licenses this file to you under the Apache License,
6     Version 2.0 (the "License"); you may not use this file
7     except in compliance with the License. You may obtain a
8     copy of the License at:
9    
10     http://www.apache.org/licenses/LICENSE-2.0
11    
12     Unless required by applicable law or agreed to in writing,
13     software distributed under the License is distributed on
14     an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15     KIND, either express or implied. See the License for the
16     specific language governing permissions and limitations
17     under the License.
18 -->
19 <xsl:stylesheet
20   version="1.0"
21   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22   xmlns="http://www.w3.org/1999/xhtml">
23
24   <!--==== SINGLE EVENT ====-->
25   <xsl:template match="event" mode="singleEvent">
26     <xsl:variable name="calPath" select="calendar/encodedPath"/>
27     <xsl:variable name="guid" select="guid"/>
28     <xsl:variable name="name" select="name"/>
29     <xsl:variable name="guidEsc" select="translate(guid, '.', '_')" />
30     <xsl:variable name="recurrenceId" select="recurrenceId"/>
31     <xsl:variable name="statusClass">
32       <xsl:choose>
33         <xsl:when test="status='CANCELLED'">bwStatusCancelled</xsl:when>
34         <xsl:when test="status='TENTATIVE'">bwStatusTentative</xsl:when>
35         <xsl:otherwise>bwStatusConfirmed</xsl:otherwise>
36       </xsl:choose>
37     </xsl:variable>
38
39     <div class="secondaryColHeader">
40       <a class="linkBack" href="{$setup}"><xsl:copy-of select="$bwStr-HdBr-BackLink"/></a>
41       <h3>
42         <xsl:copy-of select="$bwStr-HdBr-EventInformation"/>
43       </h3>
44     </div>
45
46     <div class="singleEvent">
47
48       <div id="eventIcons">
49         <xsl:variable name="gStartdate" select="start/utcdate" />
50         <xsl:variable name="gLocation" select="location/address" />
51         <xsl:variable name="gEnddate" select="end/utcdate" />
52         <xsl:variable name="gText" select="summary" />
53         <xsl:variable name="gDetails" select="summary" />
54        
55         <xsl:if test="$eventIconShareThis = 'true'">
56           <a class="eventIcons" href="https://wiki.jasig.org/pages/viewpage.action?pageId=50860497">
57             <img title="{$bwStr-SgEv-ShareThis}" src="{$resourcesRoot}/images/share-icon-16x16.png" alt="{$bwStr-SgEv-ShareThis}"/>
58           </a>
59         </xsl:if>
60         <xsl:if test="$eventIconGoogleCal = 'true'">
61           <a class="eventIcons" href="http://www.google.com/calendar/event?action=TEMPLATE&amp;dates={$gStartdate}/{$gEnddate}&amp;text={$gText}&amp;details={$gDetails}&amp;location={$gLocation}" title="{$bwStr-SgEv-AddToGoogleCalendar}">
62             <img title="{$bwStr-SgEv-AddToGoogleCalendar}" src="{$resourcesRoot}/images/gcal.gif" alt="{$bwStr-SgEv-AddToGoogleCalendar}" />
63           </a>
64         </xsl:if>
65         <xsl:if test="$eventIconFacebook = 'true'">
66           <xsl:choose>
67             <xsl:when test="string-length($recurrenceId)">
68               <a class="eventIcons" 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}">
69                 <img title="{$bwStr-SgEv-AddToFacebook}" src="{$resourcesRoot}/images/Facebook_Badge.gif" alt="{$bwStr-SgEv-AddToFacebook}" />
70               </a>
71             </xsl:when>
72             <xsl:otherwise>
73               <a class="eventIcons" 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}">
74                 <img title="{$bwStr-SgEv-AddToFacebook}" src="{$resourcesRoot}/images/Facebook_Badge.gif" alt="{$bwStr-SgEv-AddToFacebook}" />
75               </a>
76             </xsl:otherwise>
77           </xsl:choose>
78         </xsl:if>
79         <xsl:if test="$eventIconAddToMyCal = 'true'">
80           <!--
81           <a class="eventIcons" href="{$privateCal}/event/addEventRef.do?calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}" title="{$bwStr-SgEv-AddEventToMyCalendar}" target="myCalendar">
82             <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon.gif" alt="{$bwStr-SgEv-AddEventToMyCalendar}"/>
83           </a>
84            -->
85           <a class="eventIcons" href="{$privateCal}/event/addEventSub.do?calPath={$calPath}&amp;eventName={$name}&amp;recurrenceId={$recurrenceId}" title="{$bwStr-SgEv-AddEventToMyCalendar}" target="myCalendar">
86             <img class="addref" src="{$resourcesRoot}/images/add2mycal-icon.gif" alt="{$bwStr-SgEv-AddEventToMyCalendar}"/>
87           </a>
88         </xsl:if>
89         <xsl:if test="$eventIconDownloadIcs = 'true'">
90           <xsl:variable name="eventIcalName" select="concat($guid,'.ics')" />
91           <a class="eventIcons" href="{$export}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}&amp;nocache=no&amp;contentName={$eventIcalName}" title="{$bwStr-SgEv-DownloadEvent}">
92             <img src="{$resourcesRoot}/images/std-ical_icon.gif" alt="{$bwStr-SgEv-Download}"/>
93           </a>
94         </xsl:if>
95       </div>
96
97       <h2 class="{$statusClass} eventTitle">
98         <xsl:if test="status='CANCELLED'"><xsl:copy-of select="$bwStr-SgEv-Canceled"/><xsl:text> </xsl:text></xsl:if>
99         <xsl:value-of select="summary" />
100         <xsl:if test="summary = ''">
101           <xsl:copy-of select="$bwStr-SgEv-NoTitle" />
102         </xsl:if>
103       </h2>
104      
105       <xsl:if test="$eventRegEnabled and xproperties/node()[name()='X-BEDEWORK-REGISTRATION-START']">
106         <div id="bwRegistrationBox">
107           <xsl:variable name="eventName"><xsl:value-of select="name"/></xsl:variable>
108           <iframe src="{$eventReg}?href={$calPath}%2F{$eventName}" width="300" height="175">
109                   <p>
110                                 <xsl:copy-of select="$bwStr-Error-IframeUnsupported"/>
111                               </p>
112                       </iframe>
113         </div>
114       </xsl:if>
115
116       <div class="eventWhen">
117         <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-When"/><xsl:text> </xsl:text></span>
118         <xsl:value-of select="start/dayname" />,
119         <xsl:value-of select="start/longdate" />
120         <xsl:text> </xsl:text>
121         <xsl:if test="start/allday = 'false'">
122           <span class="time">
123             <xsl:value-of select="start/time" />
124           </span>
125         </xsl:if>
126         <xsl:if
127           test="(end/longdate != start/longdate) or
128                 ((end/longdate = start/longdate) and (end/time != start/time))">
129           -
130         </xsl:if>
131         <xsl:if test="end/longdate != start/longdate">
132           <xsl:value-of select="substring(end/dayname,1,3)" />
133           ,
134           <xsl:value-of select="end/longdate" />
135           <xsl:text> </xsl:text>
136         </xsl:if>
137         <xsl:choose>
138           <xsl:when test="start/allday = 'true'">
139             <span class="time">
140               <em><xsl:copy-of select="$bwStr-SgEv-AllDay"/></em>
141             </span>
142           </xsl:when>
143           <xsl:when test="end/longdate != start/longdate">
144             <span class="time">
145               <xsl:value-of select="end/time" />
146             </span>
147           </xsl:when>
148           <xsl:when test="end/time != start/time">
149             <span class="time">
150               <xsl:value-of select="end/time" />
151             </span>
152           </xsl:when>
153         </xsl:choose>
154         <!-- if timezones are not local, or if floating add labels: -->
155         <xsl:if test="start/timezone/islocal = 'false' or end/timezone/islocal = 'false'">
156           <xsl:text> </xsl:text>
157           --
158           <strong>
159             <xsl:choose>
160               <xsl:when test="start/floating = 'true'">
161                 <xsl:copy-of select="$bwStr-SgEv-FloatingTime"/>
162               </xsl:when>
163               <xsl:otherwise>
164                 <xsl:copy-of select="$bwStr-SgEv-LocalTime"/>
165               </xsl:otherwise>
166             </xsl:choose>
167           </strong>
168           <br/>
169         </xsl:if>
170         <!-- display in timezone if not local or floating time) -->
171         <xsl:if test="(start/timezone/islocal = 'false' or end/timezone/islocal = 'false') and start/floating = 'false'">
172           <xsl:choose>
173             <xsl:when test="start/timezone/id != end/timezone/id">
174               <!-- need to display both timezones if they differ from start to end -->
175               <div class="tzdates">
176                 <em><xsl:copy-of select="$bwStr-SgEv-Start"/><xsl:text> </xsl:text></em>
177                 <xsl:choose>
178                   <xsl:when test="start/timezone/islocal='true'">
179                     <xsl:value-of select="start/dayname"/>,
180                     <xsl:value-of select="start/longdate"/>
181                     <xsl:text> </xsl:text>
182                     <span class="time"><xsl:value-of select="start/time"/></span>
183                   </xsl:when>
184                   <xsl:otherwise>
185                     <xsl:value-of select="start/timezone/dayname"/>,
186                     <xsl:value-of select="start/timezone/longdate"/>
187                     <xsl:text> </xsl:text>
188                     <span class="time"><xsl:value-of select="start/timezone/time"/></span>
189                   </xsl:otherwise>
190                 </xsl:choose>
191                 --
192                 <strong><xsl:value-of select="start/timezone/id"/></strong>
193                 <br/>
194                 <em><xsl:copy-of select="$bwStr-SgEv-End"/><xsl:text> </xsl:text></em>
195                 <xsl:choose>
196                   <xsl:when test="end/timezone/islocal='true'">
197                     <xsl:value-of select="end/dayname"/>,
198                     <xsl:value-of select="end/longdate"/>
199                     <xsl:text> </xsl:text>
200                     <span class="time"><xsl:value-of select="end/time"/></span>
201                   </xsl:when>
202                   <xsl:otherwise>
203                     <xsl:value-of select="end/timezone/dayname"/>,
204                     <xsl:value-of select="end/timezone/longdate"/>
205                     <xsl:text> </xsl:text>
206                     <span class="time"><xsl:value-of select="end/timezone/time"/></span>
207                   </xsl:otherwise>
208                 </xsl:choose>
209                 --
210                 <strong><xsl:value-of select="end/timezone/id"/></strong>
211               </div>
212             </xsl:when>
213             <xsl:otherwise>
214               <!-- otherwise, timezones are the same: display as a single line  -->
215               <xsl:value-of select="start/timezone/dayname"/>, <xsl:value-of select="start/timezone/longdate"/><xsl:text> </xsl:text>
216               <xsl:if test="start/allday = 'false'">
217                 <span class="time"><xsl:value-of select="start/timezone/time"/></span>
218               </xsl:if>
219               <xsl:if test="(end/timezone/longdate != start/timezone/longdate) or
220                             ((end/timezone/longdate = start/timezone/longdate) and (end/timezone/time != start/timezone/time))"> - </xsl:if>
221               <xsl:if test="end/timezone/longdate != start/timezone/longdate">
222                 <xsl:value-of select="substring(end/timezone/dayname,1,3)"/>, <xsl:value-of select="end/timezone/longdate"/><xsl:text> </xsl:text>
223               </xsl:if>
224               <xsl:choose>
225                 <xsl:when test="start/allday = 'true'">
226                   <span class="time"><em> <xsl:copy-of select="$bwStr-SgEv-AllDay"/></em></span>
227                 </xsl:when>
228                 <xsl:when test="end/timezone/longdate != start/timezone/longdate">
229                   <span class="time"><xsl:value-of select="end/timezone/time"/></span>
230                 </xsl:when>
231                 <xsl:when test="end/timezone/time != start/timezone/time">
232                   <span class="time"><xsl:value-of select="end/timezone/time"/></span>
233                 </xsl:when>
234               </xsl:choose>
235               <xsl:text> </xsl:text>
236               --
237               <strong><xsl:value-of select="start/timezone/id"/></strong>
238             </xsl:otherwise>
239           </xsl:choose>
240         </xsl:if>
241       </div>
242
243       <div class="eventWhere">
244         <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-Where"/><xsl:text> </xsl:text></span>
245         <xsl:choose>
246           <xsl:when test="location/link=''">
247             <xsl:value-of select="location/address" />
248             <xsl:text> </xsl:text>
249             <xsl:if test="location/subaddress!=''">
250               <xsl:text> </xsl:text>
251               <xsl:value-of select="location/subaddress" />
252             </xsl:if>
253           </xsl:when>
254           <xsl:otherwise>
255             <a>
256               <xsl:attribute name="href"><xsl:value-of select="location/link"/></xsl:attribute>
257               <xsl:value-of select="location/address"/>
258               <xsl:if test="location/subaddress!=''">
259                 <xsl:text> </xsl:text>
260                 <xsl:value-of select="location/subaddress" />
261               </xsl:if>
262             </a>
263           </xsl:otherwise>
264         </xsl:choose>
265       </div>
266
267       <xsl:if test="cost!=''">
268         <div class="eventCost">
269           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-Cost"/><xsl:text> </xsl:text></span>
270           <xsl:value-of select="cost" />
271         </div>
272       </xsl:if>
273
274       <xsl:if test="link != ''">
275         <div class="eventLink">
276           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-See"/><xsl:text> </xsl:text></span>
277             <a>
278               <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
279               <xsl:value-of select="link"/>
280             </a>
281         </div>
282       </xsl:if>
283
284       <xsl:if test="xproperties/node()[name()='X-BEDEWORK-IMAGE']">
285         <xsl:variable name="imgPrefix">
286           <xsl:choose>
287             <xsl:when test="starts-with(xproperties/X-BEDEWORK-IMAGE/values/text,'http')"></xsl:when>
288             <xsl:otherwise><xsl:value-of select="$bwEventImagePrefix"/></xsl:otherwise>
289           </xsl:choose>
290         </xsl:variable>
291         <img class="bwEventImage">
292           <xsl:attribute name="src"><xsl:value-of select="$imgPrefix"/><xsl:value-of select="xproperties/node()[name()='X-BEDEWORK-IMAGE']/values/text" /></xsl:attribute>
293         </img>
294       </xsl:if>
295
296       <div class="eventDescription">
297         <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-Description"/><xsl:text> </xsl:text></span>
298         <!-- to preserve line breaks in descriptions, set <br/> as the replacement string
299              in this replace template call: -->
300         <xsl:call-template name="replace">
301           <xsl:with-param name="string" select="description" />
302           <xsl:with-param name="pattern" select="'&#xA;'" />
303           <xsl:with-param name="replacement"><br/></xsl:with-param>
304         </xsl:call-template>
305       </div>
306
307       <!--   <div class="eventListingCal">
308         <xsl:if test="calendar/path!=''">
309         Calendar:
310         <xsl:variable name="calUrl" select="calendar/encodedPath"/>
311         <a href="{$setSelection}&amp;calUrl={$calUrl}">
312         <xsl:value-of select="calendar/name"/>
313         </a>
314         </xsl:if>
315         </div>-->
316
317       <xsl:if test="status !='' and status != 'CONFIRMED'">
318         <div class="eventStatus">
319           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-STATUS"/><xsl:text> </xsl:text></span>
320           <xsl:value-of select="status" />
321         </div>
322       </xsl:if>
323
324       <xsl:if test="contact/name!='None'">
325         <div class="eventContact">
326           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-Contact"/><xsl:text> </xsl:text></span>
327           <xsl:choose>
328             <xsl:when test="contact/link=''">
329               <xsl:value-of select="contact/name" />
330             </xsl:when>
331             <xsl:otherwise>
332               <a>
333                 <xsl:attribute name="href"><xsl:value-of select="contact/link" /></xsl:attribute>
334                 <xsl:value-of select="contact/name" />
335               </a>
336             </xsl:otherwise>
337           </xsl:choose>
338           <xsl:if test="contact/phone!=''">
339             <xsl:text> </xsl:text>
340             <xsl:value-of select="contact/phone" />
341           </xsl:if>
342           <xsl:if test="contact/link!=''">
343             <xsl:text> </xsl:text>
344             <xsl:variable name="contactLink"
345               select="contact/link" />
346             <a href="{$contactLink}">
347               <xsl:value-of select="$contactLink" />
348             </a>
349           </xsl:if>
350         </div>
351       </xsl:if>
352
353       <xsl:if test="xproperties/X-BEDEWORK-ALIAS">
354         <div class="eventAliases">
355           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-TopicalArea"/><xsl:text> </xsl:text></span>
356           <xsl:for-each select="xproperties/X-BEDEWORK-ALIAS">
357             <xsl:variable name="calUrl" select="values/text"/>
358             <xsl:choose>
359               <xsl:when test="parameters/X-BEDEWORK-PARAM-DISPLAYNAME">
360                 <xsl:variable name="displayName" select="parameters/X-BEDEWORK-PARAM-DISPLAYNAME"/>
361                 <a href="{$setSelection}&amp;virtualPath={$calUrl}&amp;setappvar=curCollection({$displayName})">
362                   <xsl:value-of select="parameters/X-BEDEWORK-PARAM-DISPLAYNAME"/>
363                 </a>
364               </xsl:when>
365               <xsl:otherwise>
366                 <!-- this is required for backwards compatibility with old events (possibly with imported events;
367                      here we use the alias path value for display (as of 3.7 we use the display name (summary)) -->
368                             <a href="{$setSelection}&amp;virtualPath={$calUrl}&amp;setappvar=curCollection({$calUrl})">
369                               <xsl:call-template name="substring-afterLastInstanceOf">
370                                 <xsl:with-param name="string" select="values/text"/>
371                                 <xsl:with-param name="char">/</xsl:with-param>
372                               </xsl:call-template>
373                             </a>
374                           </xsl:otherwise>
375             </xsl:choose>
376             <xsl:if test="position()!=last()">, </xsl:if>
377           </xsl:for-each>
378         </div>
379       </xsl:if>
380
381       <xsl:if test="categories[1]/category">
382         <div class="eventCategories">
383           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-Categories"/><xsl:text> </xsl:text></span>
384           <xsl:for-each select="categories/category">
385             <xsl:value-of select="value"/><xsl:if test="position() != last()">, </xsl:if>
386           </xsl:for-each>
387         </div>
388       </xsl:if>
389
390       <xsl:if test="comments/comment">
391         <div class="eventComments">
392           <span class="infoTitle"><xsl:copy-of select="$bwStr-SgEv-Comments"/><xsl:text> </xsl:text></span>
393           <xsl:for-each select="comments/comment">
394             <p>
395               <xsl:value-of select="value" />
396             </p>
397           </xsl:for-each>
398         </div>
399       </xsl:if>
400     </div>
401
402   </xsl:template>
403
404 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.