source: main/trunk/model-interfaces-dev/wmtb/transform/pages/home.xsl@ 34275

Last change on this file since 34275 was 34275, checked in by ak19, 4 years ago

Bugfixes to whakatohea interface: 1. Overflow from coll or group description into footer area fixed. Strangely, a self closing divider was ending up with its following siblings as its children instead. Added a hack in home.xsl to fix this. 2. GS3 collection title on banner now. It was expanding the banner section. 2. Corrected Environment pou link name in navbar to Taiao. 4. Some spacing corrections in 2nd column of footer. 5. Tidied up some unused xsl.

File size: 8.6 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util">
9
10 <xsl:variable name="groupPath"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/></xsl:variable>
11
12 <!-- use the 'main' layout -->
13 <!--<xsl:include href="layouts/main.xsl"/>-->
14
15 <!-- set page title -->
16 <xsl:template name="pageTitle"><xsl:choose><xsl:when test="$groupPath != ''"><gslib:groupName path="{$groupPath}"/></xsl:when><xsl:otherwise><gslib:siteName/></xsl:otherwise></xsl:choose></xsl:template>
17
18 <!-- set page breadcrumbs -->
19 <xsl:template name="breadcrumbs">
20 <xsl:if test="$groupPath != ''">
21 <gslib:siteLink/>
22 <xsl:for-each select="/page/pageResponse/pathList/group">
23 <xsl:sort data-type="number" select="@position"/>
24 <gslib:rightArrow/>
25 <xsl:if test="position() != last()">
26 <!-- don't want the current group in the breadcrumbs -->
27 <a>
28 <xsl:attribute name="href"><gslib:groupHref path="{@path}"/></xsl:attribute>
29 <xsl:attribute name="title"><gslib:groupName path="{@path}"/></xsl:attribute>
30 <gslib:groupName path="{@path}"/>
31 </a>
32 </xsl:if>
33 </xsl:for-each>
34 </xsl:if>
35 </xsl:template>
36
37 <!-- the page content -->
38 <xsl:template match="/page/pageResponse">
39 <div class="main-wrap">
40 <div id="wsite-content" class="wsite-elements wsite-not-footer">
41 <div class="wsite-section-wrap">
42 <div class="wsite-section wsite-body-section wsite-background-14" >
43 <div class="wsite-section-content">
44 <div class="container">
45 <div class="wsite-section-elements">
46 <!-- forced to add nbsp (which in XSL is &#160;) in div.wsite-spacer
47 because otherwise text overflows from the main page into footer
48 caused by html rendering of div.wsite-spacer's subsequent sibling
49 divs as *children* of div.wsite-spacer instead.
50 Beware that XSL errors ensue if &nbsp; is used as it's not a defined
51 entity in XSL, only in HTML. Must use &#160; for nbsp in XSL, see
52 https://stackoverflow.com/questions/1461649/how-to-insert-nbsp-in-xslt
53 -->
54 <div class="wsite-spacer" style="height:50px;">
55 &#160; &#160; &#160;
56 </div>
57 <div><div class="wsite-multicol"><div class="wsite-multicol-table-wrap" style="margin:0 -15px;">
58 <table class="wsite-multicol-table">
59 <tbody class="wsite-multicol-tbody">
60 <tr class="wsite-multicol-tr">
61 <xsl:call-template name="collectionAndGroupLinks"/>
62 </tr>
63 </tbody>
64 </table>
65 </div></div></div>
66 </div>
67 </div>
68 </div>
69
70 </div>
71 </div>
72
73 </div>
74 </div><!-- end class main-wrap-->
75 </xsl:template>
76
77 <xsl:template name="additionalHeaderContent">
78 <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.easing.1.3.js"><xsl:text> </xsl:text></script>
79 <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.timers.1.2.js"><xsl:text> </xsl:text></script>
80 <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.galleryview.2.1.1.min.js"><xsl:text> </xsl:text></script>
81 <script type="text/javascript" src="interfaces/{$interface_name}/scripts/jquery.galleryview.setup.js"><xsl:text> </xsl:text></script>
82 </xsl:template>
83
84 <xsl:template name="collectionsList">
85 <!-- for every collection in the library -->
86 <xsl:for-each select="./collectionList/collection">
87 <xsl:call-template name="collDescription"/>
88 </xsl:for-each>
89 </xsl:template>
90
91 <xsl:template name="collDescription">
92 <xsl:variable name="collectionFolder" select="@name"/>
93 <xsl:variable name="collectionName" select="displayItemList/displayItem[@name='name']"/>
94 <xsl:variable name="aboutImage" select="displayItemList/displayItem[@name='icon']"/>
95 <xsl:variable name="homeImage" select="displayItemList/displayItem[@name='smallicon']"/>
96 <xsl:variable name="collDesc" select="displayItemList/displayItem[@name='description']"/>
97 <xsl:variable name="numDocs" select="metadataList/metadata[@name='numDocs']"/>
98 <!-- creates a header that links to the collection's about page -->
99
100 <!-- if there is an About page image for the collection, this is displayed -->
101 <xsl:if test="$homeImage">
102 <div><div class="wsite-image wsite-image-border-thin " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center">
103 <img src="sites/{$site_name}/collect/{$collectionFolder}/images/{$homeImage}" alt="{$collectionName}" title="{$collectionName}" style="max-width:100%" />
104 </div></div>
105 <div style="display:block;font-size:90%"></div>
106 </xsl:if>
107
108 <!-- don't centre collection description (div class=paragraph)
109 with style="text-align:center;
110 since the collection description may be HTML in its own right -->
111 <div class="paragraph">
112 <a href="{$library_name}/collection/{$collectionFolder}/page/about" title="{$collectionName}" alt="{$collectionName}"><xsl:value-of select="$collectionName"/></a>
113 <br />
114 <xsl:choose>
115 <!-- has a description - display it -->
116 <xsl:when test="$collDesc">
117
118 <!--<xsl:value-of select="$collDesc" disable-output-escaping="yes"/>--><xsl:apply-templates select="displayItemList/displayItem[@name='description']"/>
119 </xsl:when>
120 <!-- no description - a generic sentence -->
121 <xsl:otherwise>
122 <p class="justify">Welcome to the <xsl:value-of select="$collectionName"/> collection. This collection contains <xsl:value-of select="$numDocs"/> documents.</p>
123 </xsl:otherwise>
124 </xsl:choose>
125 </div>
126 </xsl:template>
127
128 <xsl:template name="collectionAndGroupLinks">
129 <xsl:for-each select="collectionList/collection|groupList/group">
130 <xsl:sort data-type="number" select="@position"/>
131 <td class="wsite-multicol-col" style="width:33.333333333333%; padding:0 15px;">
132 <xsl:if test="name() = 'collection'">
133 <xsl:call-template name="collDescription"/>
134 </xsl:if>
135 <xsl:if test="name() = 'group'">
136 <xsl:call-template name="customGroupDescription"/>
137 </xsl:if>
138 </td>
139 </xsl:for-each>
140
141 </xsl:template>
142 <xsl:template match="/page/xsltparams">
143 <!-- suppress xsltparam block in page -->
144 </xsl:template>
145
146 <!-- Modified version of <gslib:groupLinkWithImage/>-->
147 <xsl:template name="customGroupDescription">
148 <xsl:variable name="short"><xsl:value-of select="shortDescription"/></xsl:variable>
149 <xsl:variable name="desc"><xsl:value-of select="description"/></xsl:variable>
150 <xsl:variable name="group_href"><xsl:value-of select="$library_name"/>/group/<xsl:if test="/page/pageRequest/paramList/param[@name='group']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/>/</xsl:if><xsl:value-of select="@name"/></xsl:variable>
151
152
153 <!-- if there is an image for this group, this is displayed -->
154 <xsl:if test="util:checkFileExistence($site_name, backgroundImage)">
155 <div><div class="wsite-image wsite-image-border-thin " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center">
156 <img class="groupLinkImage">
157 <xsl:attribute name="alt"><xsl:value-of select="@name"/></xsl:attribute>
158 <xsl:attribute name="title"><xsl:value-of select="@name"/></xsl:attribute>
159 <xsl:attribute name="style"><xsl:text>max-width:100%</xsl:text></xsl:attribute>
160 <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/<xsl:value-of select="backgroundImage"/></xsl:attribute>
161 </img>
162 </div></div>
163 <div style="display:block;font-size:90%"></div>
164 </xsl:if>
165
166 <!-- some text for the group -->
167 <div class="paragraph" style="text-align:center;">
168 <!-- group title links to the collection's about page -->
169 <a href="{$group_href}" title="{$short}" alt="{$short}">
170 <xsl:choose>
171 <xsl:when test="boolean(title)">
172 <xsl:value-of select="title"/>
173 </xsl:when>
174 <xsl:otherwise>
175 <xsl:value-of select="@name"/>
176 </xsl:otherwise>
177 </xsl:choose>
178 </a>
179 <br />
180 <xsl:choose>
181 <!-- If the group has a description - display it -->
182 <xsl:when test="$desc">
183 <xsl:value-of select="$desc" disable-output-escaping="yes"/>
184 </xsl:when>
185 <!-- If no group description - repeat group name -->
186 <xsl:otherwise>
187 Collection group: <xsl:value-of select="@name" disable-output-escaping="yes"/>
188 </xsl:otherwise>
189 </xsl:choose>
190 </div>
191
192 </xsl:template>
193
194</xsl:stylesheet>
195
196
Note: See TracBrowser for help on using the repository browser.