root/greenstone3/trunk/web/interfaces/oran/transform/util.xsl @ 18617

Revision 18617, 8.3 KB (checked in by oranfry, 11 years ago)

a sample skin in progress

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4    xmlns:gslib="http://www.greenstone.org/XSL/Library"
5    xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil"
6    exclude-result-prefixes="util gslib gsf xslt">
7
8    <!-- some global parameters - these are set by whoever is invoking the transformation -->
9  <xsl:param name="interface_name"/>
10  <xsl:param name="library_name"/>
11 
12  <!-- every pages ....................................................................... -->
13 
14    <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/>     </xsl:variable>
15    <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
16   
17   
18    <xsl:template name="textDirectionAttribute">
19    <xsl:attribute name="dir"><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></xsl:attribute>
20    </xsl:template>
21 
22 
23    <xsl:template name="defaultDividerBar">
24   <xsl:param name='text'/>
25      <xsl:choose>
26      <xsl:when test="$text">
27     <div class="divbar"><xsl:value-of select="$text"/></div>
28      </xsl:when>
29      <xsl:otherwise>
30     <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
31      </xsl:otherwise>
32    </xsl:choose>
33  </xsl:template>
34 
35 
36    <xsl:template match="error">
37    Error: <xsl:value-of select="."/>
38  </xsl:template>
39 
40 
41<xsl:template name="displayErrorsIfAny">
42      <xsl:if test="descendant::error">
43      <script language="Javascript">
44    <xsl:text disable-output-escaping="yes">
45      function removeAllChildren(node) {
46        while (node.hasChildNodes()) {
47          node.removeChild(node.firstChild);
48        }
49      }
50
51      function toggleHideError(obj) {
52        if (obj.style.display == "none") {
53          obj.style.display = "";
54          hide_link = document.getElementById("hide");
55          removeAllChildren(hide_link);
56          hide_link.appendChild(document.createTextNode("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/><xsl:text disable-output-escaping="yes">"));
57        } else {
58          obj.style.display = "none";
59          hide_link = document.getElementById("hide");
60          removeAllChildren(hide_link);
61          hide_link.appendChild(document.createTextNode("</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/><xsl:text disable-output-escaping="yes">"));
62        }
63      }
64    </xsl:text>
65      </script>
66      <p align='right'><a id="hide" href="javascript:toggleHideError(error);"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/></a></p>
67      <div id="error" style="display: none;">
68    <xsl:apply-templates select="descendant::error"/>
69      </div>
70    </xsl:if>
71</xsl:template>
72
73
74    <xsl:template name="noTextBar">
75        <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
76    </xsl:template>
77   
78   
79    <xsl:template name="poweredByGS3TextBar">
80            <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
81  </xsl:template>
82 
83 
84    <!-- site home ....................................................................... -->
85
86<xsl:template name="homePageTitle">
87 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
88<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/><xsl:text> </xsl:text>
89</xsl:template>
90
91
92    <xsl:template name="selectACollectionTextBar">
93     <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
94  </xsl:template>
95 
96 
97    <xsl:template name="crossCollectionQuickSearchForm">
98        <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
99    </xsl:template>
100   
101    <xsl:template match="service[@name='TextQuery']">
102        <form name="QuickSearch" method="get" action="{$library_name}">
103            <input type="hidden" name="a" value="q"/>
104            <input type="hidden" name="rt" value="rd"/>
105            <input type="hidden" name="s" value="{@name}"/>
106            <input type="hidden" name="s1.collection" value="all"/>
107            <input type="text" name="s1.query" size="20"/>
108            <input type="submit"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/></xsl:attribute></input>
109        </form>
110    </xsl:template>
111
112    <xsl:template name="collectionLinkWithImage">
113        <xsl:choose>
114            <xsl:when test="displayItem[@name='icon']">
115                <!-- <a href="{$library_name}/{@name}"> -->
116                <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
117                    <xsl:attribute name="style">background-image: url('<xsl:value-of select="metadataList/metadata[@name='httpPath']"/>/images/icon-160x120.gif');</xsl:attribute>
118                    <b><xsl:value-of select="displayItem[@name='name']"/></b>
119                </a>
120            </xsl:when>
121            <xsl:otherwise>
122                <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"> 
123                    <xsl:value-of select="displayItem[@name='name']"/>
124                </a>
125            </xsl:otherwise>
126        </xsl:choose>
127    </xsl:template>
128
129
130    <xsl:template name="serviceClusterList">
131        <xsl:apply-templates select="serviceClusterList"/>
132    </xsl:template>
133   
134      <xsl:template match="serviceClusterList">
135        <xsl:for-each select="serviceCluster">
136          <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}"><xsl:value-of select='@name'/><xsl:value-of select="displayItem[@name='name']"/></a>
137        </xsl:for-each>
138      </xsl:template>
139
140     
141      <xsl:template name="serviceLink">
142      <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/>
143      </xsl:template>
144
145     
146   <xsl:template name="authenticationLink">
147   <xsl:for-each select="serviceList/service[@type='authen']">
148      <li><a href="{$library_name}?a=g&amp;rt=r&amp;sa=authen&amp;s={@name}&amp;s1.aup=Login&amp;s1.un=&amp;s1.asn="><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li></xsl:for-each>
149  </xsl:template>
150 
151 
152   <xsl:template name="libraryInterfaceLink">
153   <li><a href="{$library_name}?a=p&amp;sa=gli4gs3"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/></a></li>
154  </xsl:template>
155 
156 
157<xsl:template name="greenstoneLogoAlternateText">
158<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
159</xsl:template>
160
161<!-- about page - collection home ....................................................................... -->
162
163
164
165<!-- classifier page ............................................................................ -->
166<xsl:template name="collectionName">
167    <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
168</xsl:template>
169
170<xsl:template name="navigationTab">
171
172    <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
173
174    <xsl:variable name="action"><xsl:choose>
175        <xsl:when test="@type='query'">q</xsl:when>
176        <xsl:when test="@type='browse'">b</xsl:when>
177        <xsl:when test="@type='process'">pr</xsl:when>
178        <xsl:when test="@type='applet'">a</xsl:when>
179        <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
180    </xsl:choose></xsl:variable>
181
182    <xsl:if test="$action!='DO_NOT_DISPLAY'">
183        <li>
184            <xsl:if test="$isCurrent">
185                <xsl:attribute name="class">current</xsl:attribute>
186            </xsl:if>
187            <a>
188                <xsl:if test="displayItem[@name='description']">
189                    <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>
190                </xsl:if>
191                <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=<xsl:value-of select="$action"/>&amp;rt=d&amp;s=<xsl:value-of select="@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>
192                <xsl:value-of select="displayItem[@name='name']"/>
193            </a>
194        </li>
195    </xsl:if>
196
197</xsl:template>
198
199
200<xsl:template name="classifierLink">
201    <xsl:if test="@name=/page/pageResponse/classifier/@name"><xsl:attribute name="class">current</xsl:attribute></xsl:if>
202    <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
203        <xsl:value-of select="displayItem[@name='description']"/>
204    </a>
205</xsl:template>
206
207<xsl:template name="berryBasket">
208    <div id="berrybasket" class="hide" >
209        <div id="baskethandle"><span></span></div>
210        <div id ="berries"><span></span></div>
211    </div>
212</xsl:template>
213
214</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.