- Timestamp:
- 2009-06-24T12:39:37+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/web/interfaces/default/transform/util.xsl
r18595 r19895 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <xsl:stylesheet version="1.0" 3 4 5 6 7 8 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 9 <xsl:param name="interface_name"/> 10 10 <xsl:param name="library_name"/> 11 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"> 20 <xsl:choose> 21 <xsl:when 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:when> 22 <xsl:otherwise>ltr</xsl:otherwise> 23 </xsl:choose> 24 </xsl:attribute> 25 </xsl:template> 26 27 28 <xsl:template name="defaultDividerBar"> 29 <xsl:param name='text'/> 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"> 30 20 <xsl:choose> 21 <xsl:when 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:when> 22 <xsl:otherwise>ltr</xsl:otherwise> 23 </xsl:choose> 24 </xsl:attribute> 25 </xsl:template> 26 27 28 <xsl:template name="defaultDividerBar"> 29 <xsl:param name='text'/> 30 <xsl:choose> 31 31 <xsl:when test="$text"> 32 33 </xsl:when> 34 <xsl:otherwise> 35 32 <div class="divbar"><xsl:value-of select="$text"/></div> 33 </xsl:when> 34 <xsl:otherwise> 35 <div class="divbar"><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></div> 36 36 </xsl:otherwise> 37 37 </xsl:choose> 38 </xsl:template>39 40 41 <xsl:template match="error">38 </xsl:template> 39 40 41 <xsl:template match="error"> 42 42 Error: <xsl:value-of select="."/> 43 </xsl:template>44 45 46 <xsl:template name="displayErrorsIfAny">47 43 </xsl:template> 44 45 46 <xsl:template name="displayErrorsIfAny"> 47 <xsl:if test="descendant::error"> 48 48 <script language="Javascript"> 49 49 <xsl:text disable-output-escaping="yes"> 50 50 function removeAllChildren(node) { 51 while (node.hasChildNodes()) { 52 node.removeChild(node.firstChild); 53 } 51 while (node.hasChildNodes()) { 52 node.removeChild(node.firstChild); 54 53 } 54 } 55 55 56 56 function toggleHideError(obj) { 57 58 59 60 61 62 63 64 65 66 67 57 if (obj.style.display == "none") { 58 obj.style.display = ""; 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, 'hide_error')"/><xsl:text disable-output-escaping="yes">")); 62 } else { 63 obj.style.display = "none"; 64 hide_link = document.getElementById("hide"); 65 removeAllChildren(hide_link); 66 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">")); 67 } 68 68 } 69 69 </xsl:text> … … 74 74 </div> 75 75 </xsl:if> 76 </xsl:template>77 78 79 80 81 82 83 84 85 86 </xsl:template> 87 88 89 <!-- site home ....................................................................... -->90 91 <xsl:template name="siteHomePageTitle">92 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->93 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/><xsl:text> </xsl:text>94 </xsl:template>95 96 97 98 99 </xsl:template> 100 101 102 103 104 105 76 </xsl:template> 77 78 79 <xsl:template name="noTextBar"> 80 <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> 81 </xsl:template> 82 83 84 <xsl:template name="poweredByGS3TextBar"> 85 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/> 86 </xsl:template> 87 88 89 <!-- site home ...................................................... --> 90 91 <xsl:template name="siteHomePageTitle"> 92 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title--> 93 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/><xsl:text> </xsl:text> 94 </xsl:template> 95 96 97 <xsl:template name="selectACollectionTextBar"> 98 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/> 99 </xsl:template> 100 101 102 <xsl:template name="crossCollectionQuickSearchForm"> 103 <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/> 104 </xsl:template> 105 106 106 <xsl:template match="service[@name='TextQuery']"> 107 108 109 110 111 112 113 114 115 </xsl:template> 116 117 118 <xsl:template name="collectionLinkWithImage">119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 </xsl:template>139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 <xsl:for-each select="serviceList/service[@type='authen']">107 <form name="QuickSearch" method="get" action="{$library_name}"> 108 <input type="hidden" name="a" value="q"/> 109 <input type="hidden" name="rt" value="rd"/> 110 <input type="hidden" name="s" value="{@name}"/> 111 <input type="hidden" name="s1.collection" value="all"/> 112 <input type="text" name="s1.query" size="20"/> 113 <input type="submit"><xsl:attribute name="value"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/></xsl:attribute></input> 114 </form> 115 </xsl:template> 116 117 118 <xsl:template name="collectionLinkWithImage"> 119 <xsl:choose> 120 <xsl:when test="displayItem[@name='icon']"> 121 <a href="{$library_name}?a=p&sa=about&c={@name}"> 122 <img> 123 <xsl:attribute name="src"> 124 <xsl:value-of select="metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="displayItem[@name='icon']"/> 125 </xsl:attribute> 126 <xsl:attribute name="alt"> 127 <xsl:value-of select="displayItem[@name='name']"/> 128 </xsl:attribute> 129 </img> 130 </a> 131 </xsl:when> 132 <xsl:otherwise> 133 <a class="noimage" href="{$library_name}?a=p&sa=about&c={@name}"> 134 <xsl:value-of select="displayItem[@name='name']"/> 135 </a> 136 </xsl:otherwise> 137 </xsl:choose> 138 </xsl:template> 139 140 141 <xsl:template name="serviceClusterList"> 142 <xsl:apply-templates select="serviceClusterList"/> 143 </xsl:template> 144 145 <xsl:template match="serviceClusterList"> 146 <xsl:for-each select="serviceCluster"> 147 <a href="{$library_name}?a=p&sa=about&c={@name}"><xsl:value-of select='@name'/><xsl:value-of select="displayItem[@name='name']"/></a> 148 </xsl:for-each> 149 </xsl:template> 150 151 152 <xsl:template name="serviceLink"> 153 <a href="{$library_name}?a=q&rt=d&s={@name}"><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/> 154 </xsl:template> 155 156 157 <xsl:template name="authenticationLink"> 158 <xsl:for-each select="serviceList/service[@type='authen']"> 159 159 <li><a href="{$library_name}?a=g&rt=r&sa=authen&s={@name}&s1.aup=Login&s1.un=&s1.asn="><xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li></xsl:for-each> 160 160 </xsl:template> 161 161 162 162 163 164 <li><a href="{$library_name}?a=p&sa=gli4gs3"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/></a></li>163 <xsl:template name="libraryInterfaceLink"> 164 <li><a href="{$library_name}?a=p&sa=gli4gs3"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/></a></li> 165 165 </xsl:template> 166 166 167 167 168 <xsl:template name="greenstoneLogoAlternateText"> 169 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/> 170 </xsl:template> 171 172 <!-- about page - collection home ....................................................................... --> 173 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/> 174 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/> 175 <xsl:param name="pageType"/> 176 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/> 177 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/> 178 179 180 <xsl:template name="aboutCollectionPageTitle"> 181 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title--> 182 <xsl:value-of select="/page/pageResponse/*/displayItem[@name='name']"/><xsl:text> </xsl:text> 183 </xsl:template> 184 185 186 <xsl:template name="collectionHomeLinkWithLogoIfAvailable"> 187 <a href="{$library_name}?a=p&sa=about&c={$collName}"> 188 <xsl:choose> 189 <xsl:when test="$this-element/displayItem[@name='icon']"> 190 <img border="0"> 191 <xsl:attribute name="src"> 192 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/> 193 </xsl:attribute> 194 <xsl:attribute name="alt"> 195 <xsl:value-of select="$this-element/displayItem[@name='name']"/> 196 </xsl:attribute> 197 <xsl:attribute name="title"> 198 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/> 199 </xsl:attribute> 200 </img> 201 </xsl:when> 202 <xsl:otherwise> 168 <xsl:template name="greenstoneLogoAlternateText"> 169 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/> 170 </xsl:template> 171 172 <!-- about page - collection home ......................... --> 173 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/> 174 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/> 175 <xsl:param name="pageType"/> 176 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/> 177 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/> 178 179 180 <xsl:template name="aboutCollectionPageTitle"> 181 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title--> 182 <xsl:value-of select="/page/pageResponse/*/displayItem[@name='name']"/><xsl:text> </xsl:text> 183 </xsl:template> 184 185 186 <xsl:template name="collectionHomeLinkWithLogoIfAvailable"> 187 <a href="{$library_name}?a=p&sa=about&c={$collName}"> 188 <xsl:choose> 189 <xsl:when test="$this-element/displayItem[@name='icon']"> 190 <img border="0"> 191 <xsl:attribute name="src"> 192 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/> 193 </xsl:attribute> 194 <xsl:attribute name="alt"> 203 195 <xsl:value-of select="$this-element/displayItem[@name='name']"/> 204 </xsl:otherwise> 205 </xsl:choose> 206 </a> 207 </xsl:template> 208 209 210 <xsl:template name="homeButtonTop"> 211 <a href="{$library_name}?a=p&sa=home"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute> 212 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/></a> 213 </xsl:template> 214 215 216 <xsl:template name="helpButtonTop"> 196 </xsl:attribute> 197 <xsl:attribute name="title"> 198 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/> 199 </xsl:attribute> 200 </img> 201 </xsl:when> 202 <xsl:otherwise> 203 <xsl:value-of select="$this-element/displayItem[@name='name']"/> 204 </xsl:otherwise> 205 </xsl:choose> 206 </a> 207 </xsl:template> 208 209 210 <xsl:template name="homeButtonTop"> 211 <a href="{$library_name}?a=p&sa=home"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute> 212 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/></a> 213 </xsl:template> 214 215 216 <xsl:template name="helpButtonTop"> 217 217 <xsl:choose> 218 218 <xsl:when test="$pageType='help'"> … … 225 225 </xsl:otherwise> 226 226 </xsl:choose> 227 </xsl:template>228 229 230 <xsl:template name="preferencesButtonTop">227 </xsl:template> 228 229 230 <xsl:template name="preferencesButtonTop"> 231 231 <xsl:choose> 232 232 <xsl:when test="$pageType='pref'"> … … 239 239 </xsl:otherwise> 240 240 </xsl:choose> 241 </xsl:template>242 243 <xsl:template name="servicesNavigationBar">244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 </xsl:template>263 264 265 <xsl:template name="collectionDescriptionTextAndServicesLinks">266 267 </xsl:template>268 269 <xsl:template match="collection|serviceCluster">270 271 272 273 274 275 </xsl:template>276 277 278 <xsl:template match="serviceList">241 </xsl:template> 242 243 <xsl:template name="servicesNavigationBar"> 244 <xsl:for-each select="$this-element/serviceList/service"> 245 <xsl:variable name="action"><xsl:choose> 246 <xsl:when test="@name=$this-service">CURRENT</xsl:when> 247 <xsl:when test="@type='query'">q</xsl:when> 248 <xsl:when test="@type='browse'">b</xsl:when> 249 <xsl:when test="@type='process'">pr</xsl:when> 250 <xsl:when test="@type='applet'">a</xsl:when> 251 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise> 252 </xsl:choose></xsl:variable> 253 <xsl:choose> 254 <xsl:when test="$action='CURRENT'"> 255 <li><a><xsl:value-of select="displayItem[@name='name']"/></a></li> 256 </xsl:when> 257 <xsl:when test="$action !='DO_NOT_DISPLAY'"> 258 <li><a href="{$library_name}?a={$action}&rt=d&s={@name}&c={$collName}"><xsl:if test="displayItem[@name='description']"><xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></a></li> 259 </xsl:when> 260 </xsl:choose> 261 </xsl:for-each> 262 </xsl:template> 263 264 265 <xsl:template name="collectionDescriptionTextAndServicesLinks"> 266 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/> 267 </xsl:template> 268 269 <xsl:template match="collection|serviceCluster"> 270 <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/> 271 272 <xsl:apply-templates select="serviceList"> 273 <xsl:with-param name="collName" select="$collName"/> 274 </xsl:apply-templates> 275 </xsl:template> 276 277 278 <xsl:template match="serviceList"> 279 279 <xsl:param name="collName"/> 280 280 <h3><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/></h3> … … 288 288 </xsl:choose> 289 289 290 290 291 291 <xsl:if test="service"> 292 292 <ul id="servicelist"> … … 307 307 </xsl:template> 308 308 309 310 311 309 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.