Changeset 38933
- Timestamp:
- 2024-04-17T14:41:57+12:00 (2 weeks ago)
- Location:
- main/trunk/greenstone3/web/interfaces/default/transform
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/javascript-global-setup.xsl
r38895 r38933 50 50 <xsl:text disable-output-escaping="yes">gs.xsltParams.interface_name = "</xsl:text><xsl:value-of select="$interface_name"/><xsl:text disable-output-escaping="yes">";</xsl:text> 51 51 <xsl:text disable-output-escaping="yes">gs.xsltParams.site_name = "</xsl:text><xsl:value-of select="$site_name"/><xsl:text disable-output-escaping="yes">";</xsl:text> 52 <!-- servlet_context isn't part of the xsltparams element list when 53 viewing o=xml, but I need it set and gs.xsltParams setup is using it 54 for setting gs.xsltParams.cookie_path already anyway --> 55 <xsl:text disable-output-escaping="yes">gs.xsltParams.servlet_context = "</xsl:text><xsl:value-of select="$servlet_context"/><xsl:text disable-output-escaping="yes">";</xsl:text> 52 56 <xsl:text disable-output-escaping="yes">gs.xsltParams.use_client_side_xslt = "</xsl:text><xsl:value-of select="$use_client_side_xslt"/><xsl:text disable-output-escaping="yes">";</xsl:text> 53 57 <xsl:text disable-output-escaping="yes">gs.xsltParams.filepath = "</xsl:text><xsl:value-of select="$filepath"/><xsl:text disable-output-escaping="yes">";</xsl:text> … … 146 150 <xsl:text disable-output-escaping="yes"> 147 151 gs.requestInformation.fullURL = "</xsl:text><xsl:value-of select="/page/pageRequest/@fullURL"/><xsl:text disable-output-escaping="yes">"; 152 gs.requestInformation.baseURL = "</xsl:text><xsl:value-of select="/page/pageRequest/@baseURL"/><xsl:text disable-output-escaping="yes">"; 148 153 </xsl:text> 149 154 </script> -
main/trunk/greenstone3/web/interfaces/default/transform/layouts/webswing-collage.xsl
r38932 r38933 78 78 79 79 //https://stackoverflow.com/questions/25203124/how-to-get-base-url-with-jquery-or-javascript 80 var baseURL = window.location.origin+window.location.pathname; 81 // webswingInstance0.options.args += "\"" + baseURL+ "?a=a&rt=d&s=GsdlCollageApplet&c=smallbea\""; 82 var servlet_index = baseURL.indexOf("/"+gs.xsltParams.library_name); 83 if(servlet_index > 0) { 84 baseURL = baseURL.substring(0, servlet_index+1); 85 } 86 var baseClassifier = "CL3"; 80 var baseURL; 81 if(gs.requestInformation.baseURL) { 82 baseURL = window.location.protocol + gs.requestInformation.baseURL; // contains servlet 83 } else { // will this else block ever need to be used? 84 baseURL = window.location.origin+window.location.pathname; 85 // webswingInstance0.options.args += "\"" + baseURL+ "?a=a&rt=d&s=GsdlCollageApplet&c=smallbea\""; 86 var servlet_index = baseURL.indexOf("/"+gs.xsltParams.library_name); 87 if(servlet_index > 0) { 88 baseURL = baseURL.substring(0, servlet_index+1); 89 } 90 } 91 87 92 //var gs3CollImgPath = gs.xsltParams.library_name + "/sites/" + gs.xsltParams.site_name + "/collect/" + gs.cgiParams.c; 88 var gs3CollBrowsePath = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/browse/" + baseClassifier; 93 var gs3CollBrowsePath = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/browse/" + gs.cgiParams.cl; // cl is classifier, e.g "CL3" 94 89 95 90 96 webswingInstance0.options.args += "--baseurl \"" + baseURL + "\""; … … 92 98 webswingInstance0.options.args += " --collection " + gs.cgiParams.c; 93 99 webswingInstance0.options.args += " --library " + gs.xsltParams.library_name; 94 webswingInstance0.options.args += " --documentroot greenstone3";100 webswingInstance0.options.args += " --documentroot " + gs.xsltParams.servlet_context; 95 101 webswingInstance0.options.args += " --hrefMustHave " + gs3CollBrowsePath; 96 102 webswingInstance0.options.args += " --imageMustNotHave \"interfaces/\""; 97 103 webswingInstance0.options.args += " --verbosity " + 3; 98 104 webswingInstance0.options.args += " --imageType " + "\".jpg%.png\""; 99 webswingInstance0.options.args += " --classifier \"" + baseClassifier+ ".1\""; // "CL3.1"105 webswingInstance0.options.args += " --classifier \"" + gs.cgiParams.cl + ".1\""; // "CL3.1" 100 106 webswingInstance0.options.args += " --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --bgcolor \"#96c29a\""; 101 107 -
main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl
r38932 r38933 148 148 </xsl:template> 149 149 150 150 151 <xsl:template name="Collage"> 151 152 152 <xsl:text>TODO: Here is the collage applet</xsl:text> 153 <!-- Copied from GS2.88's about.dm (document.dm has amore applet params).153 <!-- Copied from GS2.88's about.dm (document.dm has more applet params). 154 154 155 155 Modified params: codebase, GsdlCollageApplet class' package, gwcgi, collection, classifier value="CL2.3", hrefMustHave value="cl=CL3.1". Param isJava2's value changed from auto to true. 156 156 And made all param XML elements self-closing. 157 157 --> 158 <!-- When run in the browser or as an application, it's enough to specify applet as 159 the relative folder for where to find the jars (we seem to be in the web dir then, 160 so can directly look in web's applet subdirectory for the jar). But for running with 161 this applet with the appletviewer we need the "full URL path" to the applet folder, 162 which is off /greenstone3. Though once the collage applet is run in the appletviewer, 163 a securityexception is thrown as appears it's in a sandbox and has no permission to 164 download URLs or follow external links or something. 158 <!-- When run in the browser or as an application, it's enough to specify "applet" for codebase 159 as the relative folder where to find the jars (we seem to be in the "web" dir then, 160 so can directly look in web's "applet" subdirectory for the jar). But for running 161 this applet with the appletviewer, we need the "full URL path" to the applet folder, 162 which is off /greenstone3 (the servlet_context). Though once the collage applet is run 163 in the appletviewer, a securityexception is thrown as it appears to run in a sandbox 164 that has no permission to download URLs or follow external links or something. That's 165 as far as the Java appletviewer executable can run Greenstone's collage applet program. 166 But being able to run it through the appletviewer this far gives us some confidence that 167 the collage applet actually successfully starts running as an applet. 165 168 --> 166 <applet codebase="/greenstone3/applet"169 <applet 167 170 code="org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet.class" 168 171 archive="GsdlCollageApplet.jar, webswing-api.jar" 169 172 width="600" 170 173 height="300"> 174 <xsl:attribute name="codebase">/<xsl:value-of select="$servlet_context"/>/applet</xsl:attribute> 175 176 <!-- declaring some local variables --> 177 <xsl:variable name="coll_name"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable> 178 <xsl:variable name="classifier"><xsl:value-of select="/page/pageRequest/paramList/param[@name='cl']/@value"/></xsl:variable> 179 <xsl:variable name="fullURL"><xsl:value-of select="/page/pageRequest/@fullURL"/></xsl:variable> 180 <xsl:variable name="url_protocol_prefix"><xsl:value-of select="substring-before (/page/pageRequest/@fullURL,'/')"/></xsl:variable> 181 182 <!-- setting the applet parameters: first the dynamic ones --> 171 183 184 <!-- pageRequest attribute "baseURL" lacks protocol prefix and looks like 185 e.g "//localhost:8383/greenstone3/", but we want to set xsl:variable "baseurl" 186 to all of e.g "http://localhost:8383/greenstone3/" --> 187 <param name="baseurl"><xsl:attribute name="value"><xsl:value-of select="$url_protocol_prefix"/><xsl:value-of select="/page/pageRequest/@baseURL"/></xsl:attribute></param> 188 189 <param name='library'><xsl:attribute name="value"><xsl:value-of select="$library_name"/></xsl:attribute></param> 190 <param name='collection'><xsl:attribute name="value"><xsl:value-of select="$coll_name"/></xsl:attribute></param> 191 <param name='classifier'><xsl:attribute name="value"><xsl:value-of select="$classifier"/>.1</xsl:attribute></param><!-- 192 e.g. "CL3.1". The first level subclassifier (.1) contains the hidden classifier structure 193 that the collage app starts exploring from for images --> 194 195 <param name='documentroot'><xsl:attribute name="value"><xsl:value-of select="$servlet_context"/></xsl:attribute></param> <!-- e.g. "greenstone3" --> 196 197 <param name="hrefMustHave"><xsl:attribute name="value"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$coll_name"/>/browse/<xsl:value-of select="$classifier"/></xsl:attribute></param><!-- e.g. "library/collection/smallbea/browse/CL3" --> 198 199 <!-- applet parameters that are fixed for GS3 or we probably don't want to modify --> 172 200 <param name='gsdlversion' value='3' /> 173 <param name='baseurl' value='http://localhost:8383/greenstone3/' /> 174 <!--<param name='sitename' value='localsite' />--> 175 <param name='library' value='library'/> 176 <param name="collection" value="smallbea"/> 177 <param name="classifier" value="CL3.1"/> 178 179 <param name='documentroot' value='greenstone3'/> 180 <!--<param name="documentroot" value="/greenstone/web/images"/> for GS2--> 201 <param name='imageMustNotHave' value='interfaces/' /> 181 202 203 <!-- applet parameters that can be manually adjusted --> 182 204 <param name='imageType' value='.jpg%.png' /> 183 205 <param name='verbosity' value='3' /> 184 <!--<param name="hrefMustHave" value="CL3"/>-->185 <param name="hrefMustHave" value="library/collection/smallbea/browse/CL3"/>186 <param name='imageMustNotHave' value='interfaces/' />187 206 <param name="maxDepth" value="500"/> 188 207 <param name='maxDisplay' value='25' /> … … 194 213 </applet> 195 214 </xsl:template> 196 215 197 216 <xsl:template name="Collage_javascript_deprecated"> 198 217 <script type="text/javascript" src="interfaces/{$interface_name}/js/collage_scripts.js"><xsl:text> </xsl:text></script>
Note:
See TracChangeset
for help on using the changeset viewer.