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

Last change on this file since 38806 was 38806, checked in by anupama, 3 months ago

First attempt (2 *hardcoded* config params) of webswing version of Jphind JApplet. With hardcoding the library and collection in the webswing.config.in file, I can get the applet to work, so it tells me that if I can get every param right, the applet will appear. But without hardcoding these 2 params in the webswing.config.in file, and using the now commented-out code in the new webswing-phind.xsl to set the additional parameters, with further change of adding the customArgs property at the very end of the final parameter *value* (*before* end of this value's doublequote), I can get the tomcat/bin/logs/webswing.log to show me that all the custom parameters are as I want, and it attempts to launch the app, but then fails with errors indicating collection is null. So the collection parameter (and probably library param too) are not getting through after all. I was anyway not happy with how I had to add in the customArgs in the webswing.config for applet params nor how I had to set it in the webswing-phind.xsl file. I tried several alternate ways that I felt intuitively may or ought to work, but which didn't work at all, so I settled on the one version where the right values got through into the tomcat/bin/logs/webswing.log file, but even that ultimately ended up with a null collection as I just explained.

File size: 6.8 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">WebSwing Phind<!--<gslib:collectionName/><xsl:value-of select="/page/pageResponse/service/applet"/>--></xsl:template>
26
27
28 <!-- set page breadcrumbs -->
29 <xsl:template name="breadcrumbs">
30 <xsl:choose>
31 <xsl:when test="/page/pageRequest/paramList/param[@name='c']/@value != ''">
32 <gslib:siteLink/>
33 <gslib:rightArrow/>
34 <xsl:if test="$groupPath != ''">
35 <gslib:groupLinks/>
36 <gslib:rightArrow/>
37 </xsl:if>
38 <a href="{$library_name}/collection/{$collName}/page/about">
39 <gslib:collectionName/>
40 </a>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:choose>
44 <xsl:when test="$groupPath != ''">
45 <a>
46 <xsl:attribute name="href"><gslib:groupHref path="{$groupPath}"/></xsl:attribute>
47 <xsl:attribute name="title"><gslib:groupName path="{$groupPath}"/></xsl:attribute>
48 <gslib:groupName path="{$groupPath}"/>
49 </a>
50 </xsl:when>
51 <xsl:otherwise>
52 <gslib:siteLink/>
53 </xsl:otherwise>
54 </xsl:choose>
55
56 </xsl:otherwise>
57 </xsl:choose>
58 </xsl:template>
59
60
61 <!-- the page content -->
62 <xsl:template match="/page">
63
64 <xsl:choose>
65 <xsl:when test="$this-element/displayItemList/displayItem[@name='icon']">
66 <img border="0">
67 <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>
68 <xsl:attribute name="alt">
69 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
70 </xsl:attribute>
71 <xsl:attribute name="title">
72 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'webswing_glipage')"/>
73 </xsl:attribute>
74 </img>
75 </xsl:when>
76 </xsl:choose>
77
78 <!--Display the description text of the current collection,
79 and if some services are available then create a list
80 of links for each service within a <ul id="servicelist"> element.-->
81 <xsl:call-template name="webswing-embed-phind"/>
82 </xsl:template>
83
84 <xsl:template name="webswing-embed-phind">
85 <link rel="stylesheet" href="/webswing-server/css/style.css" />
86
87 <div id="webswing-phind" class="webswing-element" data-webswing-instance="webswingInstance0" style="width: 500px; height: 500px;">
88 <div id="loading" class="ws-modal-container">
89 <div class="ws-login">
90 <div class="ws-login-content">
91 <div class="ws-spinner">
92 <div class="ws-spinner-dot-1"><xsl:comment>filler</xsl:comment></div>
93 <div class="ws-spinner-dot-2"><xsl:comment>filler</xsl:comment></div>
94 </div>
95 </div>
96 </div>
97 </div>
98 </div>
99
100 <gsf:script>
101
102 var webswingInstance0 = {
103 options: {
104 autoStart: true,
105
106 connectionUrl:'/webswing-server/phind',
107
108 customization: function(injector) {
109 injector.services.base.handleActionEvent = function(actionName, data, binaryData) {
110 console.log("WebSwing actionEvent callback handler: called with actionName = " + actionName);
111 /*
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-phind').css("cursor",cursor_type);
124 }
125 else if (actionName == "javaToWebswingJSConsoleLog") {
126 console.log("Got message from java:\n" + data);
127 }
128 */
129
130 }
131 }
132
133
134 }
135 };
136 // Not yet working. Stick ${customArgs} at end of final param Value (BEFORE the value's closing double quote) in webswing.config.in
137 // The applet jar files can just remain in web/applet where they are compiled up
138 /*if(!webswingInstance0.options.args) {
139 webswingInstance0.options.args="";
140 }
141 if (gs.cgiParams.c) {
142 webswingInstance0.options.args += ", -Dwebswing.appletParam_collection=" + gs.cgiParams.c;
143 }
144 webswingInstance0.options.args += ", -Dwebswing.appletParam_library=";
145 webswingInstance0.options.args+=(gs.xsltParams.library_name)?gs.xsltParams.library_name:"library";
146 */
147 function getParam(name) {
148 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
149 var results = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)").exec(location.href);
150 return results == null ? null : decodeURIComponent(results[1]);
151 }
152 </gsf:script>
153
154
155 <script data-webswing-global-var="webswing">
156 <xsl:text disable-output-escaping="yes">
157 (function (window, document) {
158 var loader = function () {
159 var baseUrl = '/webswing-server/phind';
160 baseUrl = baseUrl.indexOf("/", baseUrl.length - 1) !== -1 ? baseUrl : (baseUrl + "/");
161 var xmlhttp = new XMLHttpRequest();
162 xmlhttp.onreadystatechange = function () {
163 if (xmlhttp.readyState == XMLHttpRequest.DONE) {
164 var version = xmlhttp.status == 200 ? xmlhttp.responseText : "undefined";
165 var script = document.createElement("script"),
166 tag = document.getElementsByTagName("script")[0];
167 script.src = baseUrl + "javascript/webswing-embed.js?version=" + version;
168 tag.parentNode.insertBefore(script, tag);
169 }
170 };
171 xmlhttp.open("GET", baseUrl + "rest/version", true);
172 xmlhttp.send();
173 };
174 window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
175 })(window, document);
176 </xsl:text>
177 </script>
178
179
180
181 </xsl:template>
182
183</xsl:stylesheet>
184
Note: See TracBrowser for help on using the repository browser.