- Timestamp:
- 2024-03-03T20:31:57+13:00 (2 months ago)
- Location:
- main/trunk/greenstone3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/applet/phind/JPhind.java
r38813 r38817 732 732 // What is this collection called? 733 733 collection = parameterValue("collection"); 734 735 String docBase = getDocumentBase().toString(); 736 int index = -1; 737 // Fallback for webswing, as customising applet param "collection" didn't work 738 // and the ideally-customisable collection and library applet params remain null 739 // This assumes webswing running the applet has a docBase URL of the form: 740 //docBase = "http://localhost:8383/greenstone3/library/collection/tudor/page/phind"; 741 if(collection == null) { 742 //System.err.println("*** docBase: " + docBase); 743 index = docBase.indexOf("collection/"); 744 if(index != -1) { 745 index += "collection/".length(); 746 int endIndex = docBase.indexOf("/", index); 747 collection = docBase.substring(index, endIndex); 748 //System.err.println("*** collection: " + docBase.substring(index, endIndex) ); 749 } 750 } 751 734 752 System.out.println("Phind collection: " + collection); 735 753 … … 740 758 // Where is the Greenstone library 741 759 library_address = parameterValue("library"); 760 761 // Fallback for webswing, as customising applet param "library" didn't work 762 if(library_address == null) { 763 index = docBase.indexOf("/collection"); 764 if(index != -1) { 765 String docBasePrefix = docBase.substring(0, index); 766 index = docBasePrefix.lastIndexOf("/"); 767 if(index != -1) { 768 769 library_address = docBasePrefix.substring(index+1); 770 //System.err.println("*** library: " + docBasePrefix.substring(index+1) ); 771 } 772 } 773 } 742 774 library_address = tidy_URL(library_address, true); 743 775 System.out.println("Phind library: " + library_address); -
main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-phind.xsl
r38813 r38817 99 99 100 100 <gsf:script> 101 101 // https://www.webswing.org/docs/23.2/configure/applet.html 102 // https://www.webswing.org/docs/23.2/configure/swing.html 103 // https://www.webswing.org/docs/23.2/integrate/javascript-api?_h=customArgs%2Cargs#usage-with-customization-and-options 104 // https://www.webswing.org/docs/23.2/integrate/embed.html 105 // https://www.webswing.org/docs/20.1/integrate/urlparams.html 106 // https://www.webswing.org/docs/23.2/integrate/urlparams.html 107 // https://www.webswing.org/docs/20.1/integrate/customize.html 108 // https://www.webswing.org/docs/2.7/integrate/embed.html 109 102 110 var webswingInstance0 = { 103 111 options: { 104 autoStart: true, 105 112 autoStart: true, 113 //appletParams: getParam('appletParams'), 114 //appletParams: {"collection":"tudor", "library":"library"}, 106 115 connectionUrl:'/webswing-server/phind', 107 116 108 117 customization: function(injector) { 109 118 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 119 console.log("WebSwing actionEvent callback handler: called with actionName = " + actionName); 130 120 } 131 121 } … … 134 124 } 135 125 }; 126 /* 136 127 // Not yet working. Stick ${customArgs} at end of final param Value (BEFORE the value's closing double quote) in webswing.config.in 137 128 // The applet jar files can just remain in web/applet where they are compiled up 138 /*if(!webswingInstance0.options.args) {129 if(!webswingInstance0.options.args) { 139 130 webswingInstance0.options.args=""; 140 131 } … … 144 135 webswingInstance0.options.args += ", -Dwebswing.appletParam_library="; 145 136 webswingInstance0.options.args+=(gs.xsltParams.library_name)?gs.xsltParams.library_name:"library"; 137 138 console.log("args: " + webswingInstance0.options.args); 146 139 */ 140 141 /* 142 if(!webswingInstance0.options.appletParams) { 143 webswingInstance0.options.appletParams={}; 144 } 145 if (gs.cgiParams.c) { 146 webswingInstance0.options.appletParams["collection"] = gs.cgiParams.c; 147 } 148 webswingInstance0.options.appletParams["library"] = (gs.xsltParams.library_name) ? gs.xsltParams.library_name : "library"; 149 */ 150 /* 151 if(!webswingInstance0.options.appletParams) { 152 webswingInstance0.options.appletParams=""; 153 } 154 webswingInstance0.options.appletParams += "&collection=tudor&library=library"; 155 console.log("Custom Args: " + JSON.stringify(webswingInstance0.options.appletParams)); 156 */ 157 147 158 function getParam(name) { 148 159 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
Note:
See TracChangeset
for help on using the changeset viewer.