source: main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-gli.xsl@ 37476

Last change on this file since 37476 was 37417, checked in by kjdon, 15 months ago

we only want to pass in the -load arg if we are in a collection, i.e. c arg is set

File size: 6.1 KB
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:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 xmlns:gslib="http://www.greenstone.org/skinning"
7 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util">
10
11 <!-- This page, structurally speaking, is a hybrid of home.xsl and about.xsl -->
12 <!-- If no collection argument is explicitly given, then produces a general
13 embedded GLI, however if a collection is specified, then it produced
14 a page with a navigation area akin to an about this page, only with
15 GLI embedd in it, rather than about this collection txt -->
16
17 <!-- use the 'main' layout -->
18 <xsl:import href="layouts/main.xsl"/>
19
20 <!-- what is this used for??? Can it be deleted? -->
21 <xsl:variable name="groupPath"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/></xsl:variable>
22
23 <!-- set page title -->
24
25 <xsl:template name="pageTitle">
26 WebSwing GLI
27 </xsl:template>
28
29
30 <!-- set page breadcrumbs -->
31 <xsl:template name="breadcrumbs">
32 <xsl:choose>
33 <xsl:when test="/page/pageRequest/paramList/param[@name='c']/@value != ''">
34 <gslib:siteLink/>
35 <gslib:rightArrow/>
36 <xsl:if test="$groupPath != ''">
37 <gslib:groupLinks/>
38 <gslib:rightArrow/>
39 </xsl:if>
40 <a href="{$library_name}/collection/{$collName}/page/about">
41 <gslib:collectionName/>
42 </a>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:choose>
46 <xsl:when test="$groupPath != ''">
47 <a>
48 <xsl:attribute name="href"><gslib:groupHref path="{$groupPath}"/></xsl:attribute>
49 <xsl:attribute name="title"><gslib:groupName path="{$groupPath}"/></xsl:attribute>
50 <gslib:groupName path="{$groupPath}"/>
51 </a>
52 </xsl:when>
53 <xsl:otherwise>
54 <gslib:siteLink/>
55 </xsl:otherwise>
56 </xsl:choose>
57
58 </xsl:otherwise>
59 </xsl:choose>
60 </xsl:template>
61
62
63 <!-- the page content -->
64 <xsl:template match="/page">
65
66 <xsl:choose>
67 <xsl:when test="$this-element/displayItemList/displayItem[@name='icon']">
68 <img border="0">
69 <xsl:attribute name="src"><xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItemList/displayItem[@name='icon']"/></xsl:attribute>
70 <xsl:attribute name="alt">
71 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
72 </xsl:attribute>
73 <xsl:attribute name="title">
74 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'webswing_glipage')"/>
75 </xsl:attribute>
76 </img>
77 </xsl:when>
78 </xsl:choose>
79
80 <!--Display the description text of the current collection,
81 and if some services are available then create a list
82 of links for each service within a <ul id="servicelist"> element.-->
83 <xsl:call-template name="webswing-embed-gli"/>
84 </xsl:template>
85
86 <xsl:template name="webswing-embed-gli">
87 <link rel="stylesheet" href="/webswing-server/css/style.css" />
88
89 <div id="webswing-gli" class="webswing-element" data-webswing-instance="webswingInstance0" style="height: 600px;">
90 <div id="loading" class="ws-modal-container">
91 <div class="ws-login">
92 <div class="ws-login-content">
93 <div class="ws-spinner">
94 <div class="ws-spinner-dot-1"><xsl:comment>filler</xsl:comment></div>
95 <div class="ws-spinner-dot-2"><xsl:comment>filler</xsl:comment></div>
96 </div>
97 </div>
98 </div>
99 </div>
100 </div>
101
102 <gsf:script>
103 var webswingInstance0 = {
104 options: {
105 autoStart: true,
106
107 connectionUrl:'/webswing-server/gli',
108
109 customization: function(injector) {
110 injector.services.base.handleActionEvent = function(actionName, data, binaryData) {
111 console.log("WebSwing actionEvent callback handler: called with actionName = " + actionName);
112 if (actionName == "previewURL") {
113 var url = data;
114 window.open(url, '_blank');
115 }
116 else if (actionName == "downloadURL") {
117 // currently the same as 'previewURL' but separate name gives this some future proofing
118 var url = data;
119 window.open(url, '_blank');
120 }
121 else if (actionName == "setCursor") {
122 var cursor_type = data;
123 $('#webswing-gli').css("cursor",cursor_type);
124 }
125 }
126 }
127
128
129 }
130 };
131 if (gs.cgiParams.c) {
132 webswingInstance0.options.args = "-load " + gs.cgiParams.c + "/gli.col";
133 }
134 function getParam(name) {
135 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
136 var results = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)").exec(location.href);
137 return results == null ? null : decodeURIComponent(results[1]);
138 }
139 </gsf:script>
140
141
142 <script data-webswing-global-var="webswing">
143 <xsl:text disable-output-escaping="yes">
144 (function (window, document) {
145 var loader = function () {
146 var baseUrl = '/webswing-server/gli';
147 baseUrl = baseUrl.indexOf("/", baseUrl.length - 1) !== -1 ? baseUrl : (baseUrl + "/");
148 var xmlhttp = new XMLHttpRequest();
149 xmlhttp.onreadystatechange = function () {
150 if (xmlhttp.readyState == XMLHttpRequest.DONE) {
151 var version = xmlhttp.status == 200 ? xmlhttp.responseText : "undefined";
152 var script = document.createElement("script"),
153 tag = document.getElementsByTagName("script")[0];
154 script.src = baseUrl + "javascript/webswing-embed.js?version=" + version;
155 tag.parentNode.insertBefore(script, tag);
156 }
157 };
158 xmlhttp.open("GET", baseUrl + "rest/version", true);
159 xmlhttp.send();
160 };
161 window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
162 })(window, document);
163 </xsl:text>
164 </script>
165
166
167
168 </xsl:template>
169
170</xsl:stylesheet>
171
Note: See TracBrowser for help on using the repository browser.