Changeset 38964
- Timestamp:
- 2024-04-30T18:49:50+12:00 (7 weeks ago)
- Location:
- main/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/buildConfigxml.pm
r38951 r38964 793 793 my $hfilename = ''; 794 794 my $metadataname = ''; 795 my %options = (); 796 795 797 if ($classname eq "DateList") { 796 798 $content = "Date"; 797 } else { 799 } 800 else { 798 801 for (my $j=0; $j<scalar(@$cl); $j++) { 799 802 my $arg = @$cl[$j]; … … 809 812 } 810 813 } 814 if ($classname eq "Collage") 815 { 816 # Need to copy some collConfig Collage classifier options from collCfg to buildCfg 817 # so that the Collage applet HTML element can have these configuration options 818 # set to the customised values. 819 # Then GS3 runtime AbstractBrowse.addAnySavedOptions() will push these options 820 # into the pageResponse (without hyphen prefix to the option name). 821 if ($arg =~ m/-(geometry|verbosity|maxDepth|maxDisplay|imageType|bgcolor|refreshDelay|isJava2|imageMustNotHave)/) 822 { 823 $options{$arg} = @$cl[$j+1]; #$options{$1} is $options{$arg} without the hyphen 824 } 825 } 811 826 if ($arg eq "-buttonname"){ 812 827 $content = @$cl[$j+1]; 813 last ;828 last unless ($classname eq "Collage"); 814 829 } elsif ($arg eq "-metadata") { 815 830 $content = @$cl[$j+1]; … … 821 836 { 822 837 &write_line('COLCFG', ["<classifier name=\"", $name, "\" content=\"", $content, "\" metadata=\"", $metadataname, "\" hfile=\"", $hfilename, "\" />"]); 823 } else 824 { 838 } elsif ($classname eq "Collage") { 839 &write_line('COLCFG', ["<classifier name=\"", $name, "\" content=\"", $content, "\">"]); 840 while(my ($key, $value) = each(%options)) { 841 # do something with $key and $value 842 &write_line('COLCFG', ["<option name=\"", $key, "\" value=\"", $value, "\" />"]); 843 } 844 &write_line('COLCFG', ["</classifier>"]); 845 } else { 825 846 &write_line('COLCFG', ["<classifier name=\"", $name, "\" content=\"", $content, "\" />"]); 826 } 847 } 827 848 } 828 849 if ($started_classifiers) { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java
r38181 r38964 21 21 // Greenstone classes 22 22 import java.util.ArrayList; 23 import java.util.Map; 24 import java.util.HashMap; 23 25 24 26 import org.apache.log4j.Logger; … … 275 277 new_cl.appendChild(cl_desc); 276 278 279 280 // For a collage classifier, option elements were added in 281 // to config_info 282 // NodeList options = cl.getElementsByTagName(GSXML.PARAM_OPTION_ELEM); 283 // for (int j = 0; j < options.getLength(); j++) { 284 // Element option = (Element) doc.importNode(options.item(j), true); 285 // String optionName = option.getAttribute(GSXML.NAME_ATT); 286 // // remove hyphen at start 287 // if(optionName.startsWith("-")) { 288 // optionName = optionName.substring(1); 289 // } 290 // option.setAttribute(GSXML.NAME_ATT, optionName); 291 // new_cl.appendChild(option); 292 // } 293 277 294 } 278 295 return cb_service; … … 361 378 cl.appendChild(owner.importNode(format, true)); 362 379 } 380 381 /* 382 // If a Collage classifier, add in the classifier's option subelements 383 String classifierName = node_extra.getAttribute(GSXML.NAME_ATT); 384 logger.error("*** classifierName: " + classifierName); 385 386 if(classifierName.equals("Collage")) { 387 logger.error("*** collage classifier: " + XMLConverter.getPrettyString(node_extra)); 388 389 NodeList options = node_extra.getElementsByTagName(GSXML.PARAM_OPTION_ELEM); 390 if (options != null) { 391 //Element option = owner.createElement(GSXML.PARAM_OPTION_ELEM); 392 for (int j = 0; j < options.getLength(); j++) { 393 //Element e = (Element) options.item(j); 394 //cl.appendChild(owner.importNode(e, true)); 395 Element option = (Element) owner.importNode(options.item(j), true); 396 String optionName = option.getAttribute(GSXML.NAME_ATT); 397 // remove hyphen at start of classifier configuration option 398 if(optionName.startsWith("-")) { 399 optionName = optionName.substring(1); 400 } 401 option.setAttribute(GSXML.NAME_ATT, optionName); 402 cl.appendChild(option); 403 // Collage classifier option elements are actually added 404 // to info=this.config_info 405 } 406 } 407 } 408 */ 409 363 410 } // for each classifier 364 411 … … 514 561 // Add the requested structure information 515 562 Element base_node = createClassifierNode(result_doc, node_id); //, false, false); 516 563 addAnyClassifierOptions(result_doc, base_node, node_id); 564 //logger.error("*** base_node: " + XMLConverter.getPrettyString(base_node)); 517 565 //Ancestors: continually add parent nodes until the root is reached 518 566 Element top_node = base_node; // the top node so far … … 674 722 } 675 723 724 protected void addAnyClassifierOptions(Document doc, Element node, String node_id) { 725 // e.g for a collage classifier, option elements would be present in config_info 726 // which we'd like to copy into the node parameter that goes out into the pageResponse 727 Element class_list = (Element) GSXML.getChildByTagName(this.config_info, GSXML.CLASSIFIER_ELEM + GSXML.LIST_MODIFIER); 728 NodeList classifiers = GSXML.getNamedElements(class_list, GSXML.CLASSIFIER_ELEM, GSXML.NAME_ATT, node_id); 729 730 if(classifiers.getLength() > 0) { 731 Element cl = (Element)classifiers.item(0); 732 733 NodeList options = cl.getElementsByTagName(GSXML.PARAM_OPTION_ELEM); 734 for (int j = 0; j < options.getLength(); j++) { 735 Element option = (Element) doc.importNode(options.item(j), true); 736 737 // remove hyphen at start of option names 738 String optionName = option.getAttribute(GSXML.NAME_ATT); 739 if(optionName.startsWith("-")) { 740 optionName = optionName.substring(1); 741 } 742 option.setAttribute(GSXML.NAME_ATT, optionName); 743 744 node.appendChild(option); 745 } 746 747 //if(options.getLength() > 0) { 748 //logger.info("node after adding any classifier options: " + XMLConverter.getPrettyString(node)); 749 //} 750 } 751 } 752 676 753 /** Creates a classifier node */ 677 754 protected Element createClassifierNode(Document doc, String node_id) -
main/trunk/greenstone3/web/interfaces/default/transform/layouts/webswing-collage.xsl
r38956 r38964 164 164 webswingParams["height"] = stripUnitOffAttribute("px", h); 165 165 166 166 // Webswing only uses the width and height set on the webswing-collage element 167 // Override this with any dimensions set on any applet element, as that is user-controlled 168 // from GLI. style.setProperty failed without the important parameter to force the setting. 169 // https://stackoverflow.com/questions/5191478/changing-element-style-attribute-dynamically-using-javascript 170 document.getElementById("webswing-collage").style.setProperty("width", webswingParams["width"] + "px", "important"); 171 document.getElementById("webswing-collage").style.setProperty("height", webswingParams["height"] + "px", "important"); 172 167 173 // Having collected all the webswingParams, we can finally build up the single webswing customArgs string 168 174 var _args = ""; -
main/trunk/greenstone3/web/interfaces/default/transform/pages/classifier.xsl
r38950 r38964 151 151 <xsl:template name="collage-applet-shim"> 152 152 <!--<xsl:text>TODO: Here is the collage applet</xsl:text>--> 153 153 154 <!-- Copied from GS2.88's about.dm (document.dm has more applet params). 154 155 … … 173 174 id="collage-applet-element" 174 175 code="org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet.class" 175 archive="GsdlCollageApplet.jar, webswing-api.jar" 176 width="800" 177 height="400"> 176 archive="GsdlCollageApplet.jar, webswing-api.jar"> 178 177 <xsl:attribute name="codebase">/<xsl:value-of select="$servlet_context"/>/applet</xsl:attribute> 179 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 180 189 <!-- declaring some local variables --> 181 190 <xsl:variable name="coll_name"> … … 183 192 </xsl:variable> 184 193 <xsl:variable name="classifier"> 185 194 <xsl:value-of select="/page/pageRequest/paramList/param[@name='cl']/@value"/> 186 195 </xsl:variable> 187 196 <xsl:variable name="fullURL"> 188 197 <xsl:value-of select="/page/pageRequest/@fullURL"/> 189 198 </xsl:variable> 190 199 <xsl:variable name="url_protocol_prefix"> 191 192 </xsl:variable> 193 200 <xsl:value-of select="substring-before (/page/pageRequest/@fullURL,'/')"/> 201 </xsl:variable> 202 194 203 <!-- setting the applet parameters: first the dynamic ones --> 195 204 … … 218 227 219 228 <!-- applet parameters that can be manually adjusted --> 220 <param name="imageType" value=".jpg%.png" /> 229 <!-- 230 <param name="imageType" value=".jpg%.png" /> 221 231 <param name="verbosity" value="3" /> 222 232 <param name="maxDepth" value="500"/> … … 225 235 <param name="isJava2" value="auto"/> 226 236 <param name="bgcolor" value="#96c29a" /> 227 The Collage Applet. 228 237 --> 238 <!--<param name="imageType" value="{option[@name='imageType']/@value}" />--> 239 <xsl:call-template name="add-applet-param"> 240 <xsl:with-param name="paramName">imageType</xsl:with-param> 241 <xsl:with-param name="paramDefaultValue">.jpg%.png</xsl:with-param> 242 </xsl:call-template> 243 <xsl:call-template name="add-applet-param"> 244 <xsl:with-param name="paramName">verbosity</xsl:with-param> 245 <xsl:with-param name="paramDefaultValue">3</xsl:with-param> 246 </xsl:call-template> 247 <xsl:call-template name="add-applet-param"> 248 <xsl:with-param name="paramName">maxDepth</xsl:with-param> 249 <xsl:with-param name="paramDefaultValue">500</xsl:with-param> 250 </xsl:call-template> 251 <xsl:call-template name="add-applet-param"> 252 <xsl:with-param name="paramName">maxDisplay</xsl:with-param> 253 <xsl:with-param name="paramDefaultValue">25</xsl:with-param> 254 </xsl:call-template> 255 <xsl:call-template name="add-applet-param"> 256 <xsl:with-param name="paramName">refreshDelay</xsl:with-param> 257 <xsl:with-param name="paramDefaultValue">1500</xsl:with-param> 258 </xsl:call-template> 259 <xsl:call-template name="add-applet-param"> 260 <xsl:with-param name="paramName">isJava2</xsl:with-param> 261 <xsl:with-param name="paramDefaultValue">auto</xsl:with-param> 262 </xsl:call-template> 263 <xsl:call-template name="add-applet-param"> 264 <xsl:with-param name="paramName">bgcolor</xsl:with-param> 265 <xsl:with-param name="paramDefaultValue">#96c29a</xsl:with-param> 266 </xsl:call-template> 267 The Collage Applet. 229 268 </applet> 230 269 </xsl:template> 231 270 271 <!-- https://our.umbraco.com/forum/developers/xslt/9274-Return-Value-from-a-Template --> 272 <xsl:template name="add-applet-param"> 273 <xsl:param name = "paramName" /> 274 <xsl:param name = "paramDefaultValue" /> 275 <param name="{$paramName}"> 276 <xsl:attribute name="value"> 277 <xsl:choose> 278 <xsl:when test="option[@name=$paramName]/@value"> 279 <xsl:value-of select="option[@name=$paramName]/@value"/> 280 </xsl:when> 281 <xsl:otherwise> 282 <xsl:value-of select="$paramDefaultValue"/> 283 </xsl:otherwise> 284 </xsl:choose> 285 </xsl:attribute> 286 </param> 287 </xsl:template> 288 289 232 290 <xsl:template name="Collage_javascript_deprecated"> 233 291 <script type="text/javascript" src="interfaces/{$interface_name}/js/collage_scripts.js"><xsl:text> </xsl:text></script> … … 348 406 <xsl:when test="@childType = 'Collage'"> 349 407 <xsl:choose> 350 <xsl:when test="not(*)"> 408 <!--test of not(*) means has no children, not(classNode) has no subelements classNode--> 409 <xsl:when test="not(classifierNode)"> 351 410 <!-- the order of calling these templates now matters since the collage applet now 352 411 serves as a shim in the javascript that gets loaded in the 2nd template call:
Note:
See TracChangeset
for help on using the changeset viewer.