- Timestamp:
- 2024-05-03T19:54:54+12:00 (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl
r38989 r38991 148 148 </xsl:template> 149 149 150 151 <xsl:template name="collage-applet-shim"> 152 <!--<xsl:text>The Collage Applet</xsl:text>--> 150 <xsl:template name="get-collage-settings"> 151 <!-- Creates gsf variables (which sets XSL and JavaScript vars) for any user configured 152 Collage Classifier options coming through collectionConfig and then buildConfig, 153 so that JavaScript can pass them to the webswing instance on starting it up. --> 154 <xsl:choose> 155 <xsl:when test="option[@name='geometry']/@value"> 156 <gsf:variable name="collagewidth"> 157 <xsl:value-of select="substring-before(option[@name='geometry']/@value, 'x')" /> 158 </gsf:variable> 159 <gsf:variable name="collageheight"> 160 <xsl:value-of select="substring-after(option[@name='geometry']/@value, 'x')" /> 161 </gsf:variable> 162 </xsl:when> 163 </xsl:choose> 153 164 154 <!-- Copied from GS2.88's about.dm (document.dm has more applet params). 155 156 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. 157 And made all param XML elements self-closing. 158 --> 159 <!-- When run in the browser or as an application, it's enough to specify "applet" for codebase 160 as the relative folder where to find the jars (we seem to be in the "web" dir then, 161 so can directly look in web's "applet" subdirectory for the jar). But for running 162 this applet with the appletviewer, we need the "full URL path" to the applet folder, 163 which is off /greenstone3 (the servlet_context). Though once the collage applet is run 164 in the appletviewer, a securityexception is thrown as it appears to run in a sandbox 165 that has no permission to download URLs or follow external links or something. That's 166 as far as the Java appletviewer executable can run Greenstone's collage applet program. 167 But being able to run it through the appletviewer this far gives us some confidence that 168 the collage applet actually successfully starts running as an applet. 169 170 TODO: double-quotes for attributes. 171 --> 172 <applet 173 style="display:none" 174 id="collage-applet-element" 175 code="org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet.class" 176 archive="GsdlCollageApplet.jar, webswing-api.jar"> 177 <xsl:attribute name="codebase">/<xsl:value-of select="$servlet_context"/>/applet</xsl:attribute> 178 <xsl:choose> 179 <xsl:when test="option[@name='geometry']/@value"> 180 <xsl:attribute name="width"> 181 <xsl:value-of select="substring-before(option[@name='geometry']/@value, 'x')" /> 182 </xsl:attribute> 183 <xsl:attribute name="height"> 184 <xsl:value-of select="substring-after(option[@name='geometry']/@value, 'x')" /> 185 </xsl:attribute> 186 </xsl:when> 187 </xsl:choose> 188 189 <!-- declaring some local variables --> 190 <xsl:variable name="coll_name"> 191 <xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/> 192 </xsl:variable> 193 <xsl:variable name="classifier"> 194 <xsl:value-of select="/page/pageRequest/paramList/param[@name='cl']/@value"/> 195 </xsl:variable> 196 <xsl:variable name="fullURL"> 197 <xsl:value-of select="/page/pageRequest/@fullURL"/> 198 </xsl:variable> 199 <xsl:variable name="url_protocol_prefix"> 200 <xsl:value-of select="substring-before (/page/pageRequest/@fullURL,'/')"/> 201 </xsl:variable> 202 203 <!-- setting the applet parameters: first the dynamic ones --> 204 205 <!-- pageRequest attribute "baseURL" lacks protocol prefix and looks like 206 e.g "//localhost:8383/greenstone3/", but we want to set xsl:variable "baseurl" 207 to all of e.g "http://localhost:8383/greenstone3/" --> 208 <param name="baseurl"> 209 <xsl:attribute name="value"> 210 <xsl:value-of select="$url_protocol_prefix"/><xsl:value-of select="/page/pageRequest/@baseURL"/> 211 </xsl:attribute> 212 </param> 213 214 <param name="library" value="{$library_name}" /> 215 <param name="collection" value="{$coll_name}" /> 216 <param name="classifier" value="{$classifier}.1" /><!-- e.g. "CL3.1". 217 The first level subclassifier (.1) contains the hidden classifier structure 218 that the collage app starts exploring from for images --> 219 220 <param name="documentroot" value="{$servlet_context}" /> <!-- e.g. "greenstone3" --> 221 222 <param name="hrefMustHave"> 223 <xsl:attribute name="value"> 224 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$coll_name"/>/browse/<xsl:value-of select="$classifier"/> 225 </xsl:attribute> 226 </param><!-- e.g. "library/collection/smallbea/browse/CL3" --> 227 228 <!-- applet parameters that are fixed for GS3 or we probably don't want to modify --> 229 <param name="gsdlversion" value="3" /> 230 231 <!-- Applet parameters that try to get their values from any user customisations 232 made to the Collage classifier coming through collectionConfig and then buildConfig. 233 Parameter defaults to fall back on when there is no user customisation 234 can be manually adjusted here. --> 235 <!--<param name="imageType" value="{option[@name='imageType']/@value}" />--> 236 <xsl:call-template name="add-applet-param"> 237 <xsl:with-param name="paramName">imageMustNotHave</xsl:with-param> 238 <xsl:with-param name="paramDefaultValue">interfaces/</xsl:with-param> 239 </xsl:call-template> 240 <xsl:call-template name="add-applet-param"> 241 <xsl:with-param name="paramName">imageType</xsl:with-param> 242 <xsl:with-param name="paramDefaultValue">.jpg%.png</xsl:with-param> 243 </xsl:call-template> 244 <xsl:call-template name="add-applet-param"> 245 <xsl:with-param name="paramName">verbosity</xsl:with-param> 246 <xsl:with-param name="paramDefaultValue">3</xsl:with-param> 247 </xsl:call-template> 248 <xsl:call-template name="add-applet-param"> 249 <xsl:with-param name="paramName">maxDepth</xsl:with-param> 250 <xsl:with-param name="paramDefaultValue">500</xsl:with-param> 251 </xsl:call-template> 252 <xsl:call-template name="add-applet-param"> 253 <xsl:with-param name="paramName">maxDisplay</xsl:with-param> 254 <xsl:with-param name="paramDefaultValue">25</xsl:with-param> 255 </xsl:call-template> 256 <xsl:call-template name="add-applet-param"> 257 <xsl:with-param name="paramName">refreshDelay</xsl:with-param> 258 <xsl:with-param name="paramDefaultValue">1500</xsl:with-param> 259 </xsl:call-template> 260 <xsl:call-template name="add-applet-param"> 261 <xsl:with-param name="paramName">isJava2</xsl:with-param> 262 <xsl:with-param name="paramDefaultValue">auto</xsl:with-param> 263 </xsl:call-template> 264 <xsl:call-template name="add-applet-param"> 265 <xsl:with-param name="paramName">bgcolor</xsl:with-param> 266 <xsl:with-param name="paramDefaultValue">#96c29a</xsl:with-param> 267 </xsl:call-template> 268 The Collage Applet 269 </applet> 165 <xsl:choose> 166 <xsl:when test="option[@name='verbosity']/@value"> 167 <gsf:variable name="verbosity"> 168 <xsl:value-of select="option[@name='verbosity']/@value"/> 169 </gsf:variable> 170 </xsl:when> 171 </xsl:choose> 172 <xsl:choose> 173 <xsl:when test="option[@name='imageMustNotHave']/@value"> 174 <gsf:variable name="imageMustNotHave"> 175 <xsl:value-of select="option[@name='imageMustNotHave']/@value"/> 176 </gsf:variable> 177 </xsl:when> 178 </xsl:choose> 179 <xsl:choose> 180 <xsl:when test="option[@name='imageType']/@value"> 181 <gsf:variable name="imageType"> 182 <xsl:value-of select="option[@name='imageType']/@value"/> 183 </gsf:variable> 184 </xsl:when> 185 </xsl:choose> 186 <xsl:choose> 187 <xsl:when test="option[@name='maxDepth']/@value"> 188 <gsf:variable name="maxDepth"> 189 <xsl:value-of select="option[@name='maxDepth']/@value"/> 190 </gsf:variable> 191 </xsl:when> 192 </xsl:choose> 193 <xsl:choose> 194 <xsl:when test="option[@name='maxDisplay']/@value"> 195 <gsf:variable name="maxDisplay"> 196 <xsl:value-of select="option[@name='maxDisplay']/@value"/> 197 </gsf:variable> 198 </xsl:when> 199 </xsl:choose> 200 <xsl:choose> 201 <xsl:when test="option[@name='refreshDelay']/@value"> 202 <gsf:variable name="refreshDelay"> 203 <xsl:value-of select="option[@name='refreshDelay']/@value"/> 204 </gsf:variable> 205 </xsl:when> 206 </xsl:choose> 207 <xsl:choose> 208 <xsl:when test="option[@name='isJava2']/@value"> 209 <gsf:variable name="isJava2"> 210 <xsl:value-of select="option[@name='isJava2']/@value"/> 211 </gsf:variable> 212 </xsl:when> 213 </xsl:choose> 214 <xsl:choose> 215 <xsl:when test="option[@name='bgcolor']/@value"> 216 <gsf:variable name="bgcolor"> 217 <xsl:value-of select="option[@name='bgcolor']/@value"/> 218 </gsf:variable> 219 </xsl:when> 220 </xsl:choose> 221 222 <!-- 223 Defaults to fall back on when there is no user customisation 224 can be manually adjusted here. --> 225 <!-- 226 <xsl:call-template name="set-collage-gsfvar-if-exists"> 227 <xsl:with-param name="varName">imageMustNotHave</xsl:with-param> 228 </xsl:call-template> 229 <xsl:call-template name="set-collage-gsfvar-if-exists"> 230 <xsl:with-param name="varName">imageType</xsl:with-param> 231 </xsl:call-template> 232 <xsl:call-template name="set-collage-gsfvar-if-exists"> 233 <xsl:with-param name="varName">verbosity</xsl:with-param> 234 </xsl:call-template> 235 <xsl:call-template name="set-collage-gsfvar-if-exists"> 236 <xsl:with-param name="varName">maxDepth</xsl:with-param> 237 </xsl:call-template> 238 <xsl:call-template name="set-collage-gsfvar-if-exists"> 239 <xsl:with-param name="varName">maxDisplay</xsl:with-param> 240 </xsl:call-template> 241 <xsl:call-template name="set-collage-gsfvar-if-exists"> 242 <xsl:with-param name="varName">refreshDelay</xsl:with-param> 243 </xsl:call-template> 244 <xsl:call-template name="set-collage-gsfvar-if-exists"> 245 <xsl:with-param name="varName">isJava2</xsl:with-param> 246 </xsl:call-template> 247 <xsl:call-template name="set-collage-gsfvar-if-exists"> 248 <xsl:with-param name="varName">bgcolor</xsl:with-param> 249 </xsl:call-template> 250 --> 270 251 </xsl:template> 271 252 272 253 <!-- https://our.umbraco.com/forum/developers/xslt/9274-Return-Value-from-a-Template --> 273 <xsl:template name="add-applet-param"> 274 <xsl:param name = "paramName" /> 275 <xsl:param name = "paramDefaultValue" /> 276 <param name="{$paramName}"> 277 <xsl:attribute name="value"> 278 <xsl:choose> 279 <xsl:when test="option[@name=$paramName]/@value"> 280 <xsl:value-of select="option[@name=$paramName]/@value"/> 281 </xsl:when> 282 <xsl:otherwise> 283 <xsl:value-of select="$paramDefaultValue"/> 284 </xsl:otherwise> 285 </xsl:choose> 286 </xsl:attribute> 287 </param> 288 </xsl:template> 289 254 <xsl:template name="set-collage-gsfvar-if-exists"> 255 <xsl:param name="varName" /> 256 <!--<xsl:value-of select="$varName"/>--> 257 <xsl:choose> 258 <xsl:when test="option[@name=$varName]/@value"> 259 <gsf:variable name="$varName"> 260 <!--<xsl:attribute name="name"><xsl:value-of select="$varName" /></xsl:attribute>--> 261 <xsl:value-of select="option[@name=$varName]/@value"/> 262 </gsf:variable> 263 </xsl:when> 264 </xsl:choose> 265 </xsl:template> 290 266 291 267 <xsl:template name="Collage_javascript_deprecated"> … … 418 394 than learn/remember how to set webswing params or use javascript. 419 395 --> 420 <xsl:call-template name="collage-applet-shim" /> 396 <xsl:call-template name="get-collage-settings" /> 397 <div id="collage-displaying-info" style="display:none">The Collage Java App</div> 421 398 <xsl:call-template name="webswing-embed-collage"/> 422 399 </xsl:when>
Note:
See TracChangeset
for help on using the changeset viewer.