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

Last change on this file since 38256 was 38256, checked in by anupama, 8 months ago

Untested. Committing changes for bypassing webswing authentication when already logged in to greenstone.

File size: 6.4 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 if(gs.userInformation.uid) {
135 webswingInstance0.options.args = " -username " + gs.userInformation.username;
136 webswingInstance0.options.args = " -groups " + gs.userInformation.groups.replace(/\s/g, '');
137 webswingInstance0.options.args = " -uid " + gs.userInformation.uid;
138 }
139 function getParam(name) {
140 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
141 var results = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)").exec(location.href);
142 return results == null ? null : decodeURIComponent(results[1]);
143 }
144 </gsf:script>
145
146
147 <script data-webswing-global-var="webswing">
148 <xsl:text disable-output-escaping="yes">
149 (function (window, document) {
150 var loader = function () {
151 var baseUrl = '/webswing-server/gli';
152 baseUrl = baseUrl.indexOf("/", baseUrl.length - 1) !== -1 ? baseUrl : (baseUrl + "/");
153 var xmlhttp = new XMLHttpRequest();
154 xmlhttp.onreadystatechange = function () {
155 if (xmlhttp.readyState == XMLHttpRequest.DONE) {
156 var version = xmlhttp.status == 200 ? xmlhttp.responseText : "undefined";
157 var script = document.createElement("script"),
158 tag = document.getElementsByTagName("script")[0];
159 script.src = baseUrl + "javascript/webswing-embed.js?version=" + version;
160 tag.parentNode.insertBefore(script, tag);
161 }
162 };
163 xmlhttp.open("GET", baseUrl + "rest/version", true);
164 xmlhttp.send();
165 };
166 window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
167 })(window, document);
168 </xsl:text>
169 </script>
170
171
172
173 </xsl:template>
174
175</xsl:stylesheet>
176
Note: See TracBrowser for help on using the repository browser.