Changeset 28556
- Timestamp:
- 2013-10-30T13:13:54+13:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/trunk/tutorial_sample_files/interfaces/aybara/header.xsl
r28516 r28556 8 8 extension-element-prefixes="java util" 9 9 exclude-result-prefixes="java util gsf"> 10 11 <xsl:include href="../query-common.xsl"/> 12 <xsl:include href="../javascript-global-setup.xsl"/> 13 14 <!-- If the c parameter is empty then use the p.c parameter for the collection name--> 15 <xsl:variable name="collNameChecked"> 16 <xsl:choose> 17 <xsl:when test="$collName = '' and /page/pageRequest/paramList/param[@name='p.c']/@value"> 18 <xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/> 19 </xsl:when> 20 <xsl:otherwise> 21 <xsl:value-of select="$collName"/> 22 </xsl:otherwise> 23 </xsl:choose> 24 </xsl:variable> 25 10 26 11 <!-- Creates a header for the html page --> 27 12 <xsl:template name="create-html-header"> … … 105 90 </xsl:template> 106 91 107 <xsl:template name="additionalHeaderContent">108 <!-- This template should be overridden in the collectionConfig.xml file if you want to add extra header content -->109 </xsl:template>110 111 <xsl:template name="init-direct-edit">112 <script type="text/javascript">113 <xsl:text disable-output-escaping="yes">114 de.onready(function()115 {116 try117 {118 de.init();119 }120 catch (err)121 {122 alert("Seaweed failed to initialise: " + err.message);123 }124 });125 </xsl:text>126 </script>127 </xsl:template>128 129 <!-- ***** HEADER LAYOUT TEMPLATE ***** -->130 <xsl:template name="create-banner">131 <div id="gs_banner" class="ui-widget-header ui-corner-bottom">132 <div id="titlesearchcontainer">133 <xsl:call-template name="page-title-area"/>134 <xsl:call-template name="quick-search-area"/>135 <div style="clear:both;"><xsl:text> </xsl:text></div>136 </div>137 <xsl:call-template name="browsing-tabs"/>138 </div>139 </xsl:template>140 141 <!-- ***** BROWSING TABS ***** -->142 <xsl:template name="browsing-tabs">143 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service">144 <ul id="gs-nav">145 <!-- If this collection has a ClassifierBrowse service then add a tab for each classifier-->146 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='browse' and @name='ClassifierBrowse']">147 <!-- Loop through each classifier -->148 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier">149 <li>150 <xsl:choose>151 <!-- If this tab is selected then colour it differently -->152 <xsl:when test="util:contains(/page/pageRequest/paramList/param[@name = 'cl' and /page/pageRequest/@action = 'b']/@value, @name)">153 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>154 </xsl:when>155 <xsl:otherwise>156 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>157 </xsl:otherwise>158 </xsl:choose>159 160 <a>161 <!-- Add a title element to the <a> tag if a description exists for this classifier -->162 <xsl:if test="displayItem[@name='description']">163 <xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute>164 </xsl:if>165 166 <!-- Add the href element to the <a> tag -->167 <xsl:choose>168 <xsl:when test="@name">169 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/browse/<xsl:value-of select="@name"/></xsl:attribute>170 </xsl:when>171 <xsl:otherwise>172 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/@name"/>/browse/1</xsl:attribute>173 </xsl:otherwise>174 </xsl:choose>175 176 <!-- Add the actual text of the <a> tag -->177 <xsl:value-of select="displayItem[@name='name']"/>178 </a>179 </li>180 </xsl:for-each>181 </xsl:if>182 183 <!-- PhindApplet. Need something similar for the Collage applet too, probably -->184 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='PhindApplet']">185 <li>186 <xsl:choose>187 <!-- If this tab is selected then colour it differently -->188 <xsl:when test="/page/pageRequest[@action='a']">189 <xsl:attribute name='class'>ui-state-default ui-corner-top ui-tabs-selected ui-state-active</xsl:attribute>190 </xsl:when>191 <xsl:otherwise>192 <xsl:attribute name='class'>ui-state-default ui-corner-top</xsl:attribute>193 </xsl:otherwise>194 </xsl:choose>195 196 <a>197 <xsl:if test="displayItem[@name='description']">198 <xsl:attribute name="title">199 <xsl:value-of select="displayItem[@name='description']"/>200 </xsl:attribute>201 </xsl:if>202 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=a&rt=d&s=<xsl:value-of select="@name"/>&c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>203 <xsl:value-of select="displayItem[@name='name']"/>204 </a>205 </li>206 </xsl:for-each>207 208 <!-- all other services -->209 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[not(@type='query') and not(@type='browse') and not (@name='PhindApplet')]">210 <xsl:call-template name="navigationTab"/>211 </xsl:for-each>212 </ul>213 <div style="clear:both;"><xsl:text> </xsl:text></div>214 </xsl:if>215 </xsl:template>216 217 <!-- ***** HOME HELP PREFERENCES LOGIN ***** -->218 <xsl:template name="home-help-preferences">219 <ul id="bannerLinks">220 221 <!-- RSS feed link can appear in a global format statement (where it has no type attribute)222 or in section specific format statements, such as browse, search, display.223 If it's present in any format statement, display the RSS link in the bannerlinks section. -->224 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search' or not(@type)]/gsf:option[@name='RSS']/@value = 'true'">225 <li><gsf:link type="rss"><gsf:icon file="rssicon.png"/></gsf:link></li>226 </xsl:if>227 228 <!-- preferences -->229 <li>230 <a href="{$library_name}/collection/{$collNameChecked}/page/pref">231 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>232 <span id="preferencesButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/></span>233 <script type="text/javascript">234 <xsl:text disable-output-escaping="yes">235 $("#preferencesButton").button({icons:{primary:"ui-icon-wrench"}});236 $("#preferencesButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});237 </xsl:text>238 </script>239 </a>240 </li>241 242 <!-- help -->243 <li>244 <a href="{$library_name}/collection/{$collNameChecked}/page/help">245 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>246 <span id="helpButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/></span>247 <script type="text/javascript">248 <xsl:text disable-output-escaping="yes">249 $("#helpButton").button({icons:{primary:"ui-icon-help"}});250 $("#helpButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});251 </xsl:text>252 </script>253 </a>254 </li>255 256 <!-- login/logout -->257 <li id="userMenuButton">258 <xsl:choose>259 <xsl:when test="/page/pageRequest/userInformation/@username">260 <a>261 <xsl:attribute name="href">javascript:toggleUserMenu();</xsl:attribute>262 <script type="text/javascript">263 <xsl:text disable-output-escaping="yes">264 function toggleUserMenu()265 {266 var button = $("#userMenuButton");267 var menu;268 269 if(button.data("userMenu"))270 {271 menu = button.data("userMenu");272 if(menu.css("display") == "block")273 {274 menu.hide();275 }276 else277 {278 menu.show();279 }280 }281 else282 {283 menu = $("<UL>")284 .css("position", "absolute")285 .css("display", "block")286 .css("z-index", "100")287 .css("list-style", "none outside none")288 .css("margin", "0px")289 .css("padding", "0px")290 .css("font-size", "90%");291 292 menu.attr("id", "userMenu");293 294 button.data("userMenu", menu);295 296 var settingsLink = $("<a>")297 .attr("href", gs.xsltParams.library_name + "/admin/AccountSettings?s1.username=</xsl:text><xsl:value-of select="/page/pageRequest/userInformation/@username"/><xsl:text disable-output-escaping="yes">");298 var settingsButton = $("<LI>")299 .css("padding", "3px")300 .html("Account settings")301 .addClass("ui-state-default");302 settingsLink.append(settingsButton);303 304 var editingLink = $("<a>")305 .attr("href", "javascript:;");306 var editingButton = $("<LI>")307 .css("padding", "3px")308 .html((gs.userInformation.editEnabled == "true") ? "Disable edit mode" : "Enable edit mode")309 .addClass("ui-state-default")310 .click(function()311 {312 var url = gs.xsltParams.library_name + "?a=g&rt=ro&s=ChangeUserEditMode&s1.username=" + gs.userInformation.username + "&s1.enabled=" + ((gs.userInformation.editEnabled == "true") ? "false" : "true");313 $.ajax(url)314 .success(function(response)315 {316 location.reload();317 });318 });319 editingLink.append(editingButton);320 321 var url = document.URL;322 var hasQueryString = (url.indexOf("?") != -1);323 var hashIndex = url.indexOf("#");324 325 var hashPart;326 if(hashIndex != -1)327 {328 hashPart = url.substring(hashIndex);329 url = url.substring(0, hashIndex);330 }331 332 var logoutLink = $("<a>")333 .attr("href", url + (hasQueryString ? "&" : "?") + "logout=" + (hashPart ? hashPart : ""));334 var logoutButton = $("<LI>")335 .css("padding", "3px")336 .html("Logout")337 .addClass("ui-state-default");338 logoutLink.append(logoutButton);339 340 menu.append(settingsLink);341 menu.append(editingLink);342 menu.append(logoutLink);343 344 var buttonLeft = button.offset().left;345 var buttonTop = button.offset().top;346 347 var buttonHeight = button.height();348 349 menu.offset({top: buttonTop + buttonHeight + 4, left: buttonLeft});350 $("#topArea").append(menu);351 }352 }353 </xsl:text>354 </script>355 <span id="loginButton"><xsl:value-of select="/page/pageRequest/userInformation/@username"/></span>356 <script type="text/javascript">357 <xsl:text disable-output-escaping="yes">358 $("#loginButton").button({icons:{primary:"ui-icon-unlocked"}});359 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});360 </xsl:text>361 </script>362 </a>363 </xsl:when>364 <xsl:otherwise>365 <a>366 <xsl:attribute name="href">367 <xsl:value-of select="$library_name"/>368 <xsl:text>?a=p&sa=login&redirectURL=</xsl:text>369 <xsl:value-of select="$library_name"/>370 <xsl:text>%3F</xsl:text>371 <xsl:if test="/page/pageRequest/@action">372 <xsl:text>a=</xsl:text>373 <xsl:value-of select="/page/pageRequest/@action"/>374 </xsl:if>375 <xsl:if test="/page/pageRequest/@subaction">376 <xsl:text>%26sa=</xsl:text>377 <xsl:value-of select="/page/pageRequest/@subaction"/>378 </xsl:if>379 <xsl:for-each select="/page/pageRequest/paramList/param">380 <xsl:if test="@name != 'password' and @name != 's1.password' and @name != 's1.newPassword' and @name != 's1.oldPassword'">381 <xsl:text>%26</xsl:text>382 <xsl:value-of select="@name"/>383 <xsl:text>=</xsl:text>384 <xsl:value-of select="@value"/>385 </xsl:if>386 </xsl:for-each>387 </xsl:attribute>388 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_tip')"/></xsl:attribute>389 <span id="loginButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'login_b')"/></span>390 <script type="text/javascript">391 <xsl:text disable-output-escaping="yes">392 $("#loginButton").button({icons:{primary:"ui-icon-locked"}});393 $("#loginButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});394 </xsl:text>395 </script>396 </a>397 </xsl:otherwise>398 </xsl:choose>399 </li>400 <!-- debuginfo (doesn't use class="ui-state-error" since the text is not legible due to inherited text-colour) -->401 <xsl:if test="/page/pageRequest/paramList/param[(@name='debug') and (@value='on' or @value='true' or @value='1')]">402 <li>403 <a href="{$library_name}/collection/{$collNameChecked}/page/debug">404 <xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_tip')"/></xsl:attribute>405 <span id="debugButton"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'debuginfo_b')"/></span>406 <script type="text/javascript">407 <xsl:text disable-output-escaping="yes">408 $("#debugButton").button({icons:{primary:"ui-icon-info"}});409 $("#debugButton .ui-button-text").css({"padding-top":"0px", "padding-bottom":"3px"});410 </xsl:text>411 </script>412 </a>413 </li>414 </xsl:if>415 </ul>416 </xsl:template>417 418 <!-- ***** PAGE TITLE ***** -->419 <xsl:template name="page-title-area">420 <xsl:variable name="pageTitleVar"><xsl:call-template name="pageTitle"/></xsl:variable>421 <div id="titlearea">422 <h2>423 <!-- Resize the title based on how long it is (There's probably a better way to do this) -->424 <xsl:attribute name="style">425 <xsl:choose>426 <xsl:when test="string-length($pageTitleVar) < 20">427 <xsl:text>font-size: 1.5em;</xsl:text>428 </xsl:when>429 <xsl:when test="string-length($pageTitleVar) < 30">430 <xsl:text>font-size: 1.4em;</xsl:text>431 </xsl:when>432 <xsl:when test="string-length($pageTitleVar) < 40">433 <xsl:text>font-size: 1.3em;</xsl:text>434 </xsl:when>435 <xsl:when test="string-length($pageTitleVar) < 50">436 <xsl:text>font-size: 1.2em;</xsl:text>437 </xsl:when>438 <xsl:when test="string-length($pageTitleVar) < 60">439 <xsl:text>font-size: 1.1em;</xsl:text>440 </xsl:when>441 <xsl:when test="string-length($pageTitleVar) < 70">442 <xsl:text>font-size: 1em;</xsl:text>443 </xsl:when>444 <xsl:when test="string-length($pageTitleVar) < 80">445 <xsl:text>font-size: 0.9em;</xsl:text>446 </xsl:when>447 <xsl:when test="string-length($pageTitleVar) < 90">448 <xsl:text>font-size: 0.8em;</xsl:text>449 </xsl:when>450 <xsl:otherwise>451 <xsl:text>font-size: 0.7em;</xsl:text>452 </xsl:otherwise>453 </xsl:choose>454 </xsl:attribute>455 <!--<xsl:value-of select="string-length($pageTitleVar)" />-->456 <xsl:value-of select="$pageTitleVar" />457 </h2><xsl:text> </xsl:text>458 </div>459 </xsl:template>460 461 <!-- ***** QUICK SEARCH AREA ***** -->462 <!-- Search form should only appear if there's a search (query) service AND it has an index.463 By default, all collections end up with some query service (default is MGPP) even when they have464 no search indexes, which is why the extra test for the presence of an index/fq-something is necessary. -->465 <xsl:template name="quick-search-area">466 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">467 <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>468 <div id="quicksearcharea">469 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">470 <form action="{$library_name}/collection/{$collNameChecked}/search/TextQuery">471 <!-- This parameter says that we have come from the quick search area -->472 <input type="hidden" name="qs" value="1"/>473 <input type="hidden" name="rt" value="rd"/>474 <input type="hidden" name="s1.level">475 <xsl:attribute name="value">476 <xsl:choose>477 <xsl:when test="/page/pageRequest/paramList/param[@name = 's1.level']">478 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.level']/@value"/>479 </xsl:when>480 <xsl:otherwise>481 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='TextQuery']/paramList/param[@name = 'level']/@default"/>482 </xsl:otherwise>483 </xsl:choose>484 </xsl:attribute>485 </input>486 <xsl:choose>487 <xsl:when test="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'startPage']">488 <input type="hidden" name="s1.startPage" value="1"/>489 </xsl:when>490 <xsl:otherwise>491 <input type="hidden" name="startPage" value="1"/>492 </xsl:otherwise>493 </xsl:choose>494 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.hitsPerPage'])">495 <input type="hidden" name="s1.hitsPerPage" value="20"/>496 </xsl:if>497 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 's1.maxDocs'])">498 <input type="hidden" name="s1.maxDocs" value="100"/>499 </xsl:if>500 <!-- The query text box -->501 <span class="querybox">502 <xsl:variable name="qs">503 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']" mode="calculate-default"/>504 </xsl:variable>505 <nobr>506 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='query']">507 <xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.tidyWhitespace($qs, /page/@lang)"/>508 </xsl:apply-templates>509 </nobr>510 </span>511 <!-- The index selection list -->512 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']/@type = 'enum_single'">513 <span class="textselect">514 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']">515 <xsl:with-param name="default">516 <xsl:apply-templates select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/paramList/param[@name='index']" mode="calculate-default"/>517 </xsl:with-param>518 <xsl:with-param name="hideSingle">true</xsl:with-param>519 </xsl:apply-templates>520 </span>521 </xsl:if>522 <!-- The submit button (for TextQuery) -->523 <xsl:if test="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']">524 <input type="submit" id="quickSearchSubmitButton">525 <xsl:attribute name="value">526 <xsl:value-of select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@name='TextQuery']/displayItem[@name='submit']"/>527 </xsl:attribute>528 </input>529 <br/>530 </xsl:if>531 </form>532 </xsl:if>533 <!-- The list of other search types -->534 <ul>535 <xsl:for-each select="/page/pageResponse/collection[@name=$collNameChecked]/serviceList/service[@type='query']">536 <li class="ui-state-default ui-corner-all">537 <a>538 <xsl:attribute name="href">539 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collNameChecked"/>/search/<xsl:value-of select="@name"/>540 </xsl:attribute>541 <xsl:value-of select="displayItem[@name='name']"/>542 </a>543 </li>544 </xsl:for-each>545 </ul>546 </div>547 </xsl:if>548 </xsl:template>549 550 <xsl:template name="map-scripts">551 <meta content="initial-scale=1.0, user-scalable=no" name="viewport"/>552 <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"><xsl:text> </xsl:text></script>553 <script src="interfaces/{$interface_name}/js/map-scripts.js" type="text/javascript"><xsl:text> </xsl:text></script>554 <script type="text/javascript">$(window).load(initializeMapScripts);</script>555 </xsl:template>556 557 <xsl:template name="openlayers-map-scripts">558 <script src="interfaces/{interface_name}/js/OpenLayers.js" type="text/javascript"><xsl:text> </xsl:text></script>559 </xsl:template>560 561 <xsl:template name="panoramaViewer-scripts">562 <script src="interfaces/{$interface_name}/js/three45.min.js" type="text/javascript"><xsl:text> </xsl:text></script>563 <script src="interfaces/{$interface_name}/js/Tween.js" type="text/javascript"><xsl:text> </xsl:text></script>564 <script src="interfaces/{$interface_name}/js/Detector.js" type="text/javascript"><xsl:text> </xsl:text></script>565 <script src="interfaces/{$interface_name}/js/RequestAnimationFrame.js" type="text/javascript"><xsl:text> </xsl:text></script>566 <script src="interfaces/{$interface_name}/js/panoramaMarker.js" type="text/javascript"><xsl:text> </xsl:text></script>567 <script src="interfaces/{$interface_name}/js/panoramaViewer.js" type="text/javascript"><xsl:text> </xsl:text></script>568 <script type="text/javascript">$(window).load(initPanoramaViewer);$(window).load(_animate);</script>569 </xsl:template>570 571 92 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.