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

Last change on this file since 37343 was 37343, checked in by davidb, 14 months ago

Improved text/links display in banner area for webswing-gli

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 //args: 'foo',
107 //recording: getParam('recording'),
108 //debugPort: getParam('debugPort'),
109 connectionUrl:'/webswing-server/gli',
110
111
112 customization: function(injector) {
113 injector.services.base.handleActionEvent = function(actionName, data, binaryData) {
114 console.log("WebSwing actionEvent callback handler: called with actionName = " + actionName);
115 if (actionName == "previewURL") {
116 var url = data;
117 window.open(url, '_blank');
118 }
119 else if (actionName == "downloadURL") {
120 // currently the same as 'previewURL' but separate name gives this some future proofing
121 var url = data;
122 window.open(url, '_blank');
123 }
124 else if (actionName == "setCursor") {
125 var cursor_type = data;
126 $('#webswing-gli').css("cursor",cursor_type);
127 }
128 }
129 }
130
131
132 }
133 }
134
135 function getParam(name) {
136 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
137 var results = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)").exec(location.href);
138 return results == null ? null : decodeURIComponent(results[1]);
139 }
140 </gsf:script>
141
142
143 <script data-webswing-global-var="webswing">
144 <xsl:text disable-output-escaping="yes">
145 (function (window, document) {
146 var loader = function () {
147 var baseUrl = '/webswing-server/gli';
148 baseUrl = baseUrl.indexOf("/", baseUrl.length - 1) !== -1 ? baseUrl : (baseUrl + "/");
149 var xmlhttp = new XMLHttpRequest();
150 xmlhttp.onreadystatechange = function () {
151 if (xmlhttp.readyState == XMLHttpRequest.DONE) {
152 var version = xmlhttp.status == 200 ? xmlhttp.responseText : "undefined";
153 var script = document.createElement("script"),
154 tag = document.getElementsByTagName("script")[0];
155 script.src = baseUrl + "javascript/webswing-embed.js?version=" + version;
156 tag.parentNode.insertBefore(script, tag);
157 }
158 };
159 xmlhttp.open("GET", baseUrl + "rest/version", true);
160 xmlhttp.send();
161 };
162 window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
163 })(window, document);
164 </xsl:text>
165 </script>
166
167
168
169 </xsl:template>
170
171</xsl:stylesheet>
172
Note: See TracBrowser for help on using the repository browser.