root/greenstone3/trunk/web/interfaces/gs2/transform/style.xsl @ 18391

Revision 18391, 10.1 KB (checked in by kjdon, 11 years ago)

icon templates moved to icons.xsl, in default interface. classic stylesheet names changed

  • Property svn:keywords set to Author Date Id Revision
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  extension-element-prefixes="java util"
7  exclude-result-prefixes="java util">
8 
9  <xsl:include href="icons.xsl"/>
10
11  <!-- some global parameters - these are set by whoever is invoking the transformation -->
12  <xsl:param name="interface_name"/>
13  <xsl:param name="library_name"/>
14
15  <!-- any global style stuff should go in here -->
16  <xsl:template name="globalStyle">
17    <link rel="stylesheet" href="interfaces/gs2/style/gs2-style.css" type="text/css"/>
18    <link rel="stylesheet" href="interfaces/gs2/style/gs2-style2.css" type="text/css"/>
19  </xsl:template>
20 
21  <xsl:template name="genericPageBanner">
22    <xsl:param name='text'/>
23    <xsl:variable name="lang" select="/page/@lang"/>
24    <center>
25      <table width="100%">
26    <tr><td align="left"></td>
27      <td align="right">
28        <table>
29          <tr><td class="gsbutton">
30          <a class="gsbutton" href="{$library_name}?a=p&amp;sa=home">
31            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
32          </a>
33        </td></tr></table>
34      </td>
35    </tr>
36      </table>
37    </center>
38    <xsl:call-template name="dividerBar"><xsl:with-param name='text' select="$text"/></xsl:call-template>
39  </xsl:template>
40 
41  <xsl:template name="standardPageBanner">
42    <xsl:param name="collName"/>
43    <xsl:param name="pageType"/>
44    <xsl:param name="clTop"/>
45    <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
46    <div id="bannar">
47      <div class="pageinfo">
48    <xsl:call-template name="top-buttons">
49      <xsl:with-param name="collName" select="$collName"/>
50      <xsl:with-param name="pageType" select="$pageType"/>
51    </xsl:call-template>
52    <xsl:if test="not(/page/pageRequest/@action='d')">
53      <xsl:variable name="text">
54        <xsl:choose>
55          <xsl:when test="$pageType='browse'">
56        <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier[@name=$clTop]/displayItem[@name='name']"/>
57          </xsl:when>
58          <xsl:otherwise>
59        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, concat($pageType, '_t'))"/>
60          </xsl:otherwise>
61        </xsl:choose>
62      </xsl:variable>
63      <xsl:if test="$text != '__t_'">
64        <p class="bannertitle"><xsl:value-of select="$text"/></p>
65      </xsl:if>
66    </xsl:if>
67      </div>
68
69      <div class="collectimage">
70    <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
71      <xsl:choose>
72        <xsl:when test="$this-element/displayItem[@name='icon']">
73          <img border="0">
74        <xsl:attribute name="src">
75          <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
76        </xsl:attribute>   
77        <xsl:attribute name="alt">
78          <xsl:value-of select="$this-element/displayItem[@name='name']"/>
79        </xsl:attribute>
80        <xsl:attribute name="title">
81          <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
82        </xsl:attribute>
83          </img>
84        </xsl:when>
85        <xsl:otherwise>
86          <b><xsl:value-of select="$this-element/displayItem[@name='name']"/></b>
87        </xsl:otherwise>
88      </xsl:choose>
89    </a>
90      </div>
91    </div>
92    <div class="bannerextra"></div>
93  </xsl:template>
94 
95  <xsl:template name="top-buttons">
96    <xsl:param name="collName"/>
97    <xsl:param name="pageType"/>
98    <p class="bannerlinks">
99      <a class="navlink" href="{$library_name}?a=p&amp;sa=home"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
100    <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
101      </a>
102      <!--<xsl:choose>
103        <xsl:when test="$pageType='help'">
104      <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
105    </xsl:when>
106    <xsl:otherwise>
107      <a class="navlink" href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
108        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
109      </a>
110    </xsl:otherwise>
111      </xsl:choose> -->
112      <xsl:choose>
113    <xsl:when test="$pageType='pref'">
114      <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
115    </xsl:when>
116    <xsl:otherwise>
117      <a class="navlink" href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
118        <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
119      </a>
120    </xsl:otherwise>
121      </xsl:choose>     
122    </p>
123  </xsl:template>
124 
125  <xsl:template name="navigationBar">
126    <xsl:param name="collName"/>
127    <xsl:param name="clTop"/>
128    <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
129    <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
130    <xsl:variable name="classifiers" select="$this-element/serviceList/service[@name='ClassifierBrowse']/classifierList[1]"/>
131
132    <!-- display order, for Arabic etc. languages, display right to left -->
133    <xsl:variable name="dir"><xsl:call-template name="direction"/></xsl:variable>
134    <xsl:variable name="sort_order"><xsl:choose><xsl:when test="$dir='rtl'">descending</xsl:when><xsl:otherwise>ascending</xsl:otherwise></xsl:choose></xsl:variable>       
135
136    <div class="navbar">
137      <p class="navbar">
138    <xsl:choose>
139      <xsl:when test="not($dir='rtl')">
140        <xsl:if test="$this-element/serviceList/service[@type='query']">
141          <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
142        </xsl:if>
143      </xsl:when>
144      <xsl:otherwise>
145        <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
146          <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
147        </xsl:if>
148      </xsl:otherwise>
149    </xsl:choose>
150
151    <xsl:for-each select="$classifiers/classifier">
152      <xsl:sort order="{$sort_order}" select="position()" />
153      <xsl:apply-templates select="." mode="navbar">
154        <xsl:with-param name="collName" select="$collName"/>
155        <xsl:with-param name="clTop" select="$clTop"/>
156      </xsl:apply-templates>
157    </xsl:for-each>
158   
159    <xsl:choose>   
160      <xsl:when test="$dir='rtl'">
161        <xsl:if test="$this-element/serviceList/service[@type='query']">
162          <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
163        </xsl:if>
164      </xsl:when>
165      <xsl:otherwise>
166        <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
167          <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
168        </xsl:if>
169      </xsl:otherwise>
170    </xsl:choose>
171      </p>
172    </div>
173  </xsl:template>
174
175  <xsl:template name="navbar-search">
176    <xsl:param name="collName"/>
177    <xsl:choose>
178      <xsl:when test="/page/pageRequest/@action='q'">     
179    <span class="narspace">search</span>
180      </xsl:when>
181      <xsl:otherwise>
182    <xsl:variable name="service">
183      <xsl:choose>
184        <xsl:when  test="not(/page/pageRequest/paramList/param[@name='ct'])">TextQuery</xsl:when>
185        <xsl:when test="/page/pageRequest/paramList/param[@name='ct']/@value='0'">TextQuery</xsl:when>
186        <xsl:when test="/page/pageRequest/paramList/param[@name='qt']/@value='1'"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='qfm']/@value='1'">AdvancedFieldQuery</xsl:when><xsl:otherwise>FieldQuery</xsl:otherwise></xsl:choose></xsl:when>
187        <xsl:otherwise>TextQuery</xsl:otherwise>
188      </xsl:choose>
189    </xsl:variable>
190    <a class="navlink" href="{$library_name}?a=q&amp;rt=d&amp;s={$service}&amp;c={$collName}"><xsl:attribute name='title'><xsl:value-of select="/page/pageResponse/collection/service[@name=$service]/displayItem[@name='description']"/></xsl:attribute>search</a>
191      </xsl:otherwise>
192    </xsl:choose>
193  </xsl:template>
194 
195  <xsl:template name="navbar-phind">
196    <xsl:param name="collName"/>
197    <xsl:choose>
198      <xsl:when test="/page/pageRequest/paramList/param[@name='s']/@value='PhindApplet'">
199    <span class="narspace">phrases</span>
200      </xsl:when>
201      <xsl:otherwise>
202    <a class="navlink" href="{$library_name}?a=a&amp;rt=d&amp;s=PhindApplet&amp;c={$collName}"><xsl:if test="/page/pageResponse/collection/service[@name='PhindApplet']/displayItem[@name='description']"><xsl:attribute name='title'><xsl:value-of select="/page/pageResponse/collection/service[@name='PhindApplet']/displayItem[@name='description']"/></xsl:attribute></xsl:if>phrases</a>
203      </xsl:otherwise>
204    </xsl:choose>
205  </xsl:template>
206
207  <xsl:template match="classifier" mode="navbar">
208    <xsl:param name="collName"/>
209    <xsl:param name="clTop"/>
210    <xsl:choose>
211      <xsl:when test="/page/pageRequest/@action='b' and $clTop=@name">
212    <span class="narspace"><xsl:value-of select="displayItem[@name='name']"/></span>
213      </xsl:when>
214      <xsl:otherwise>
215    <a class="navlink" href="{$library_name}?a=b&amp;rt=r&amp;s=ClassifierBrowse&amp;c={$collName}&amp;cl={@name}"><xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute><xsl:value-of select="displayItem[@name='name']"/></a>
216      </xsl:otherwise>
217    </xsl:choose>
218  </xsl:template>
219
220  <xsl:template name="dividerBar">   
221    <xsl:param name='text'/>
222    <xsl:choose>
223      <xsl:when test="$text">
224    <div class="divbar"><p class="navbar"><xsl:value-of select="$text"/></p></div>
225      </xsl:when>
226      <xsl:otherwise>
227    <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
228      </xsl:otherwise>
229    </xsl:choose>
230  </xsl:template>
231 
232  <xsl:template name="greenstoneFooter">
233    <div class="divbar"><p class="navbar">powered by greenstone3</p>
234    </div>
235  </xsl:template> 
236
237  <xsl:template name="direction">
238    <xsl:if test="/page/@lang='ar' or /page/@lang='fa' or /page/@lang='he' or /page/@lang='ur' or /page/@lang='ps' or /page/@lang='prs'">rtl</xsl:if>
239  </xsl:template>
240
241</xsl:stylesheet> 
Note: See TracBrowser for help on using the browser.