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

Revision 3087 (checked in by johnsa, 2 years ago)

public web client: prefix featured event images that need it

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   <xsl:template name="featuredEvents">
25     <xsl:if test="$featuredEventsAlwaysOn = 'true' or
26                  ($featuredEventsForEventDisplay = 'true' and /bedework/page = 'event') or
27                  ($featuredEventsForCalList = 'true' and /bedework/page = 'calendarList') or
28                  (/bedework/page = 'eventscalendar' and (
29                    ($featuredEventsForDay = 'true' and /bedework/periodname = 'Day') or
30                    ($featuredEventsForWeek = 'true' and /bedework/periodname = 'Week') or
31                    ($featuredEventsForMonth = 'true' and /bedework/periodname = 'Month') or
32                    ($featuredEventsForYear = 'true' and /bedework/periodname = 'Year')))">
33       <div id="feature">
34         <!-- grab the root of the FeaturedEvent.xml document (/image[position() &lt; 4])-->
35         <xsl:apply-templates select="document('../../themes/bedeworkTheme/featured/FeaturedEvent.xml')/featuredEvents"/>
36       </div>
37     </xsl:if>
38   </xsl:template>
39
40   <xsl:template match="featuredEvents">
41     <xsl:choose>
42       <xsl:when test="featuresOn = 'true'">
43         <xsl:choose>
44           <xsl:when test="singleMode = 'false'"><!-- triptych -->
45             <xsl:apply-templates select="features/group/image"/>
46           </xsl:when>
47           <xsl:otherwise><!-- single pane -->
48             <xsl:apply-templates select="features/single/image">
49               <xsl:with-param name="singleMode">true</xsl:with-param>
50             </xsl:apply-templates>
51           </xsl:otherwise>
52         </xsl:choose>
53       </xsl:when>
54       <xsl:otherwise><!-- use generic defaults -->
55         <xsl:apply-templates select="generics/group/image"/>
56       </xsl:otherwise>
57     </xsl:choose>
58   </xsl:template>
59
60   <xsl:template match="image">
61     <xsl:param name="singleMode">false</xsl:param>
62     <xsl:variable name="imgPrefix"><xsl:choose><xsl:when test="not(starts-with(name,'http') or starts-with(name,'/'))"><xsl:value-of select="$resourcesRoot"/>/featured/</xsl:when></xsl:choose></xsl:variable>
63     <xsl:choose>
64       <xsl:when test="link = ''">
65         <img width="241" height="189">
66           <xsl:attribute name="src"><xsl:value-of select="$imgPrefix"/><xsl:value-of select="name"/></xsl:attribute>
67           <xsl:attribute name="alt"><xsl:value-of select="toolTip"/></xsl:attribute>
68           <xsl:if test="$singleMode = 'true'">
69             <xsl:attribute name="width">725</xsl:attribute>
70           </xsl:if>
71         </img>
72       </xsl:when>
73       <xsl:otherwise>
74         <a>
75           <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
76           <img width="241" height="189">
77             <xsl:attribute name="src"><xsl:value-of select="$imgPrefix"/><xsl:value-of select="name"/></xsl:attribute>
78             <xsl:attribute name="alt"><xsl:value-of select="toolTip"/></xsl:attribute>
79             <xsl:if test="$singleMode = 'true'">
80                     <xsl:attribute name="width">725</xsl:attribute>
81                   </xsl:if>
82           </img>
83         </a>
84       </xsl:otherwise>
85     </xsl:choose>
86   </xsl:template>
87
88 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.