root/trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/tofreshen/jsToday.xsl

Revision 2448 (checked in by johnsa, 4 years ago)

public client: full restructuring in preparation for new default skin

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3   <xsl:output method="html" omit-xml-declaration="yes" indent="no" media-type="text/javascript" standalone="yes"/>
4   <!-- Javascript feed of the day's events,
5        Bedework v3.0, Arlen Johnson
6
7        Usage: call the javascript feed from an html file by embedding the
8        following script tag:
9        <script src="http://yourservername/cal/setViewPeriod.do?viewType=todayView&skinName=jsToday&contentType=text/javascript&contentName=bedework.js" type="text/javascript"></script>
10
11        e.g.
12        <script src="http://localhost:8080/cal/setViewPeriod.do?viewType=todayView&skinName=jsToday&contentType=text/javascript&contentName=bedework.js" type="text/javascript"></script>
13
14        You should uncomment the code below that reads "Today's Events" and throw
15        away the following line.  You should modify this stylesheet if you intend
16        to display more than a single day's events.
17   -->
18
19   <!-- **********************************************************************
20     Copyright 2006 Rensselaer Polytechnic Institute. All worldwide rights reserved.
21
22     Redistribution and use of this distribution in source and binary forms,
23     with or without modification, are permitted provided that:
24        The above copyright notice and this permission notice appear in all
25         copies and supporting documentation;
26
27         The name, identifiers, and trademarks of Rensselaer Polytechnic
28         Institute are not used in advertising or publicity without the
29         express prior written permission of Rensselaer Polytechnic Institute;
30
31     DISCLAIMER: The software is distributed" AS IS" without any express or
32     implied warranty, including but not limited to, any implied warranties
33     of merchantability or fitness for a particular purpose or any warrant)'
34     of non-infringement of any current or pending patent rights. The authors
35     of the software make no representations about the suitability of this
36     software for any particular purpose. The entire risk as to the quality
37     and performance of the software is with the user. Should the software
38     prove defective, the user assumes the cost of all necessary servicing,
39     repair or correction. In particular, neither Rensselaer Polytechnic
40     Institute, nor the authors of the software are liable for any indirect,
41     special, consequential, or incidental damages related to the software,
42     to the maximum extent the law permits. -->
43
44   <xsl:variable name="urlprefix" select="/bedework/urlprefix"/>
45   <xsl:template match="/">
46     <xsl:text disable-output-escaping="yes">document.writeln('&lt;h3&gt;');</xsl:text>
47       <!--<xsl:text disable-output-escaping="yes">document.writeln("Today's Events");</xsl:text>-->
48       <xsl:text disable-output-escaping="yes">document.writeln("Today's Events");</xsl:text>
49     <xsl:text disable-output-escaping="yes">document.writeln('&lt;/h3&gt;');</xsl:text>
50     <xsl:text disable-output-escaping="yes">document.writeln('&lt;ul class="eventFeed"&gt;');</xsl:text>
51     <xsl:choose>
52       <xsl:when test="/bedework/eventscalendar/year/month/week/day/event">
53         <xsl:apply-templates select="/bedework/eventscalendar/year/month/week/day/event"/>
54       </xsl:when>
55       <xsl:otherwise>
56         <xsl:text disable-output-escaping="yes">document.writeln('&lt;li&gt;');</xsl:text>
57         <xsl:text disable-output-escaping="yes">document.writeln('There are no events posted today');</xsl:text>
58         <xsl:text disable-output-escaping="yes">document.writeln('&lt;/li&gt;');</xsl:text>
59       </xsl:otherwise>
60     </xsl:choose>
61     <xsl:text disable-output-escaping="yes">document.writeln('&lt;/ul&gt;');</xsl:text>
62   </xsl:template>
63   <xsl:template match="event">
64     <!-- first, escape apostrophes -->
65     <xsl:variable name="aposStrippedSummary">
66       <xsl:call-template name="replace">
67         <xsl:with-param name="string" select="summary"/>
68         <xsl:with-param name="pattern" select='"&apos;"'/>
69         <xsl:with-param name="replacement" select='"\&apos;"'/>
70       </xsl:call-template>
71     </xsl:variable>
72     <!-- second, strip line breaks -->
73     <xsl:variable name="strippedSummary" select='translate($aposStrippedSummary,"&#xA;"," ")'/>
74     <!-- finally, produce the javascript -->
75     <xsl:text disable-output-escaping="yes">document.writeln('&lt;li&gt;');</xsl:text>
76     <xsl:text disable-output-escaping="yes">document.writeln('    &lt;a href="</xsl:text><xsl:value-of select="$urlprefix"/><xsl:text disable-output-escaping="yes">/event/eventView.do?guid=</xsl:text><xsl:value-of select="guid"/><xsl:text disable-output-escaping="yes">&amp;recurrenceId=</xsl:text><xsl:value-of select="recurrenceId"/><xsl:text disable-output-escaping="yes">&amp;calPath=</xsl:text><xsl:value-of select="calendar/encodedPath"/><xsl:text disable-output-escaping="yes">&amp;skinName=default" target="_top"</xsl:text><xsl:if test="status = 'CANCELLED'"> class="cancelled" </xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text><xsl:if test="status = 'CANCELLED'">CANCELED: </xsl:if><xsl:value-of select="$strippedSummary" disable-output-escaping="yes"/><xsl:text disable-output-escaping="yes">&lt;/a&gt;');</xsl:text>
77     <xsl:text disable-output-escaping="yes">document.writeln('&lt;/li&gt;');</xsl:text>
78   </xsl:template>
79
80   <xsl:template name="replace">
81     <xsl:param name="string" select="''"/>
82     <xsl:param name="pattern" select="''"/>
83     <xsl:param name="replacement" select="''"/>
84     <xsl:choose>
85       <xsl:when test="$pattern != '' and $string != '' and contains($string, $pattern)">
86         <xsl:value-of select="substring-before($string, $pattern)"/>
87         <xsl:copy-of select="$replacement"/>
88         <xsl:call-template name="replace">
89           <xsl:with-param name="string" select="substring-after($string, $pattern)"/>
90           <xsl:with-param name="pattern" select="$pattern"/>
91           <xsl:with-param name="replacement" select="$replacement"/>
92         </xsl:call-template>
93       </xsl:when>
94       <xsl:otherwise>
95         <xsl:value-of select="$string"/>
96       </xsl:otherwise>
97     </xsl:choose>
98   </xsl:template>
99 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.