source: main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl@ 24397

Last change on this file since 24397 was 24397, checked in by davidb, 13 years ago

Minor adjustment to use in forming URL as a more stable way to control links. Without this change, when running Greenstone3 through a Proxy/ReverseProxy through www.nzdl.org it was loosing the name of the servlet on the text-search links in the breadcrumb area, and the form submit would revert back to trying to use puka.cs.waikato.ac.nz as the domain name instead of www.nzdl.org

  • Property svn:executable set to *
File size: 10.8 KB
Line 
1<xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:java="http://xml.apache.org/xslt/java"
4 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
5 xmlns:gslib="http://www.greenstone.org/skinning"
6 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <xsl:include href="../query-common.xsl"/>
10
11 <!-- If the c parameter is empty then use the p.c parameter for the collection name-->
12 <xsl:variable name="collNameChecked">
13 <xsl:choose>
14 <xsl:when test="$collName = '' and /page/pageRequest/paramList/param[@name='p.c']/@value">
15 <xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/>
16 </xsl:when>
17 <xsl:otherwise>
18 <xsl:value-of select="$collName"/>
19 </xsl:otherwise>
20 </xsl:choose>
21 </xsl:variable>
22
23 <!-- Creates a header for the html page -->
24 <xsl:template name="create-html-header">
25 <title><xsl:call-template name="pageTitle"/> :: <xsl:call-template name="siteName"/></title>
26 <link rel="stylesheet" href="interfaces/{$interface_name}/style/core.css" type="text/css"/>
27 <link rel="shortcut icon" href="favicon.ico"/>
28 <!--<script type="text/javascript" src="interfaces/oran/js/jquery-1.4.2.js"><xsl:text> </xsl:text></script>
29 <script type="text/javascript" src="interfaces/oran/js/jquery-ui-1.8rc1/ui/jquery-ui.js"><xsl:text> </xsl:text></script>
30 <script type="text/javascript" src="interfaces/oran/js/jquery.selectboxes.js"><xsl:text> </xsl:text></script>-->
31 </xsl:template>
32
33 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->
34 <xsl:template name="create-banner">
35 <div id="breadcrumbs"><xsl:call-template name="breadcrumbs"/><xsl:text> </xsl:text></div>
36 <table id="titlesearchcontainer">
37 <tr>
38 <xsl:call-template name="page-title-area"/>
39 <xsl:call-template name="quick-search-area"/>
40 </tr>
41 </table>
42 <xsl:call-template name="home-help-preferences"/>
43 <xsl:call-template name="browsing-tabs"/>
44 </xsl:template>
45
46 <!-- ***** BROWSING TABS ***** -->
47 <xsl:template name="browsing-tabs">
48 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service">
49 <ul id="nav">
50 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->
51 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">
52 <!-- Loop through each classifier -->
53 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">
54 <xsl:element name="li">
55 <!-- If this tab is selected then colour it differently (right part) -->
56 <xsl:if test="@name = /page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value">
57 <xsl:attribute name='style'>background: transparent url('interfaces/oran/images/tab-right-selected.png') scroll no-repeat 100% -100px;</xsl:attribute>
58 </xsl:if>
59
60 <xsl:element name="a">
61 <!-- If this tab is selected then colour it differently (left part) -->
62 <xsl:if test="@name = /page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value">
63 <xsl:attribute name='style'>background: transparent url('interfaces/oran/images/tab-left-selected.png') no-repeat scroll 0 -100px;</xsl:attribute>
64 </xsl:if>
65
66 <!-- Add a title element to the <a> tag if a description exists for this classifier -->
67 <xsl:if test="displayItem[@name='description']">
68 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
69 </xsl:if>
70
71 <!-- Add the href element to the <a> tag -->
72 <xsl:choose>
73 <xsl:when test="@name">
74 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=b&amp;rt=s&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>&amp;cl=<xsl:value-of select="@name"/></xsl:attribute>
75 </xsl:when>
76 <xsl:otherwise>
77 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=b&amp;rt=d&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/></xsl:attribute>
78 </xsl:otherwise>
79 </xsl:choose>
80
81 <!-- Add the actual text of the <a> tag -->
82 <xsl:value-of select="displayItem[@name='name']"/>
83 </xsl:element>
84 </xsl:element>
85 </xsl:for-each>
86 </xsl:if>
87
88 <!-- all other services -->
89 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse')]">
90 <xsl:call-template name="navigationTab"/>
91 </xsl:for-each>
92 </ul>
93 </xsl:if>
94 </xsl:template>
95
96 <!-- ***** HOME HELP PREFERENCES ***** -->
97 <xsl:template name="home-help-preferences">
98 <xsl:if test="/page/pageResponse/collection">
99 <ul id="bannerLinks">
100
101 <!-- preferences -->
102 <li>
103 <a href="{$library_name}?a=p&amp;amp;sa=pref&amp;amp;c={$collNameChecked}">
104 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
105 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
106 </a>
107 </li>
108
109 <!-- help -->
110 <li>
111 <a href="{$library_name}?a=p&amp;amp;sa=help&amp;amp;c={$collNameChecked}">
112 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
113 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
114 </a>
115 </li>
116
117 <!-- home -->
118 <li>
119 <a href="{$library_name}?a=p&amp;amp;sa=home">
120 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
121 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
122 </a>
123 </li>
124 </ul>
125 </xsl:if>
126 </xsl:template>
127
128 <!-- ***** PAGE TITLE ***** -->
129 <xsl:template name="page-title-area">
130 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>
131 <td id="titlearea">
132 <h2>
133 <!-- Resize the title based on how long it is -->
134 <xsl:attribute name="style">
135 <xsl:choose>
136 <xsl:when test="string-length($pageTitleVar) &lt; 20">
137 <xsl:text>font-size: 1.5em; line-height: 1.5em;</xsl:text>
138 </xsl:when>
139 <xsl:when test="string-length($pageTitleVar) &lt; 30">
140 <xsl:text>font-size: 1.4em; line-height: 1.4em;</xsl:text>
141 </xsl:when>
142 <xsl:when test="string-length($pageTitleVar) &lt; 40">
143 <xsl:text>font-size: 1.3em; line-height: 1.3em;</xsl:text>
144 </xsl:when>
145 <xsl:when test="string-length($pageTitleVar) &lt; 50">
146 <xsl:text>font-size: 1.2em; line-height: 1.2em;</xsl:text>
147 </xsl:when>
148 <xsl:when test="string-length($pageTitleVar) &lt; 60">
149 <xsl:text>font-size: 1.1em; line-height: 1.2em;</xsl:text>
150 </xsl:when>
151 <xsl:when test="string-length($pageTitleVar) &lt; 70">
152 <xsl:text>font-size: 1em; line-height: 1.1em;</xsl:text>
153 </xsl:when>
154 <xsl:when test="string-length($pageTitleVar) &lt; 80">
155 <xsl:text>font-size: 0.9em; line-height: 1em;</xsl:text>
156 </xsl:when>
157 <xsl:when test="string-length($pageTitleVar) &lt; 90">
158 <xsl:text>font-size: 0.8em; line-height: 0.9em;</xsl:text>
159 </xsl:when>
160 <xsl:otherwise>
161 <xsl:text>font-size: 0.7em; line-height: 0.9em;</xsl:text>
162 </xsl:otherwise>
163 </xsl:choose>
164 </xsl:attribute>
165 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->
166 <xsl:value-of select="$pageTitleVar" />
167 </h2>
168 </td>
169 </xsl:template>
170
171
172 <!-- ***** QUICK SEARCH AREA ***** -->
173 <xsl:template name="quick-search-area">
174 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">
175 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
176 <td id="quicksearcharea">
177 <form action="{$library_name}">
178 <input type="hidden" name="a" value="q"/>
179 <input type="hidden" name="sa" value="{$subaction}"/>
180 <input type="hidden" name="rt" value="rd"/>
181 <input type="hidden" name="s" value="TextQuery"/>
182 <input type="hidden" name="c" value="{$collNameChecked}"/>
183 <input type="hidden" name="startPage" value="1"/>
184 <!-- The query text box -->
185 <span class="querybox">
186 <xsl:variable name="qs">
187 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>
188 </xsl:variable>
189 <nobr>
190 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">
191 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs)"/>
192 </xsl:apply-templates>
193 </nobr>
194 </span>
195 <!-- The index selection list -->
196 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">
197 <span class="textselect">
198 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">
199 <xsl:with-param name="default">
200 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>
201 </xsl:with-param>
202 </xsl:apply-templates>
203 </span>
204 </xsl:if>
205 <!-- The submit button -->
206 <input type="submit">
207 <xsl:attribute name="value">
208 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>
209 </xsl:attribute>
210 </input>
211 <br/>
212 <!-- The list of other search types -->
213 <table>
214 <tr>
215 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">
216 <td>
217 <a>
218 <xsl:attribute name="href">
219 <xsl:value-of select="$library_name"/>?a=q&amp;rt=d&amp;c=<xsl:value-of select="$collNameChecked"/>&amp;s=<xsl:value-of select="@name"/>
220 </xsl:attribute>
221 <xsl:value-of select="displayItem[@name='name']"/>
222 </a>
223 </td>
224 </xsl:for-each>
225 </tr>
226 </table>
227 </form>
228 </td>
229 </xsl:if>
230 </xsl:template>
231</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.