Changeset 38258
- Timestamp:
- 2023-09-30T21:32:17+13:00 (9 months ago)
- Location:
- main/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r38256 r38258 250 250 } 251 251 else if (isWebswing) { 252 253 252 254 Configuration.template_config_xml = Configuration.TEMPLATE_CONFIG_PREFIX + Configuration.CONFIG_WEBSWING_XML; 253 255 Configuration.config_xml = Configuration.CONFIG_WEBSWING_XML; 254 256 257 String webswing_msg = "username: " + go.username + 258 "\ngroups: " + go.usergroups + 259 "\nuid: " + go.userJSessionID; 255 260 256 if(go.userJSessionID != null) { 261 JOptionPane.showMessageDialog(null, webswing_msg, "webswing info", JOptionPane.INFORMATION_MESSAGE); 262 /* 263 try { 264 Thread.sleep(5000); 265 } catch(Exception e) { 266 System.err.println("Couldn't sleep for 5000 ms"); 267 }*/ 268 269 if(go.username != null && !go.username.equals("") 270 && go.userJSessionID != null && !go.userJSessionID.equals("")) { 271 272 257 273 webswingAuthenticator = new WebswingAuthenticator(go.username, go.usergroups, go.userJSessionID); 274 } else { //if(webswingAuthenticator != null) { 275 WebswingAuthenticator.clear(); 276 if(webswingAuthenticator != null) { 277 webswingAuthenticator = null; 278 } 258 279 } 280 259 281 } 260 282 else { … … 2121 2143 extends GAuthenticator 2122 2144 { 2123 static protected String username ;2145 static protected String username = null; 2124 2146 static protected HashSet<String> groups; 2125 2147 static protected String userJSessionID; 2126 2148 static protected String rawgroups; 2149 2150 static public void clear() { 2151 username = null; 2152 groups = null; 2153 userJSessionID = null; 2154 rawgroups = null; 2155 } 2127 2156 2128 2157 protected void displayError(String error_message) { … … 2148 2177 2149 2178 public boolean authenticate(String library_url_string) { 2150 if(username == null) { 2179 String result; 2180 if(username == null) { 2151 2181 PasswordAuthentication pa = getPasswordAuthentication(); 2152 2182 if (pa == null) { … … 2160 2190 2161 2191 String password = new String(pa.getPassword()); 2162 String result; 2192 2163 2193 try { 2164 2194 String new_url = library_url_string+"?a=s&sa=authenticated-ping&excerptid=gs_content&un="+username+"&pw="+password; -
main/trunk/gli/src/org/greenstone/gatherer/GathererProg.java
r37677 r38258 31 31 import javax.swing.*; 32 32 import org.greenstone.gatherer.util.Utility; 33 import org.webswing.toolkit.api.WebswingUtil; 34 import java.util.Arrays; 33 35 34 36 /** … … 67 69 String gli_user_directory_path = null; 68 70 if (go.webswing) { 71 WebswingUtil.getWebswingApi().sendActionEvent("jsConsoleLog", "args are: " + Arrays.toString(args), null); 72 69 73 if (go.gsdl3_src_path != null) { 70 74 // above is a (albeit a crude) test at this early stage of running, -
main/trunk/greenstone3/web/interfaces/default/transform/javascript-global-setup.xsl
r38256 r38258 167 167 if (typeof gs.userInformation === "undefined") { 168 168 gs.userInformation={}; 169 gs.userInformation.username = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@username"/><xsl:text disable-output-escaping="yes">";170 gs.userInformation.groups = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@groups"/><xsl:text disable-output-escaping="yes">";171 169 } 170 gs.userInformation.username = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@username"/><xsl:text disable-output-escaping="yes">"; 171 gs.userInformation.groups = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@groups"/><xsl:text disable-output-escaping="yes">"; 172 172 173 gs.userInformation.uid = "</xsl:text><xsl:value-of select="/page/pageRequest/userContext/@uid"/><xsl:text disable-output-escaping="yes">"; 173 174 </xsl:text> -
main/trunk/greenstone3/web/interfaces/default/transform/pages/webswing-gli.xsl
r38256 r38258 100 100 </div> 101 101 102 <gsf:script> 102 <gsf:script> 103 console.log("username " + gs.userInformation.username); 104 console.log("groups " + gs.userInformation.groups); 105 console.log("uid " + gs.userInformation.uid); 106 103 107 var webswingInstance0 = { 104 108 options: { … … 123 127 $('#webswing-gli').css("cursor",cursor_type); 124 128 } 129 else if (actionName == "jsConsoleLog") { 130 console.log("Got message from java:\n" + data); 131 } 125 132 } 126 133 } … … 132 139 webswingInstance0.options.args = "-load " + gs.cgiParams.c + "/gli.col"; 133 140 } 134 if(gs.userInformation.uid) { 135 webswingInstance0.options.args = " -username " + gs.userInformation.username; 136 webswingInstance0.options.args = " -groups " + gs.userInformation.groups.replace(/\s/g, ''); 137 webswingInstance0.options.args = " -uid " + gs.userInformation.uid; 141 if(gs.userInformation.username && gs.userInformation.uid) { // true if defined and not empty string etc 142 // doing "args +=" adds "undefined" parameter iff it's first argument attached to webswing customArgs 143 // This then has the effect of switching of the previous argument, -webswing 144 if (gs.cgiParams.c) { 145 webswingInstance0.options.args += " -username " + gs.userInformation.username; 146 } else { 147 webswingInstance0.options.args = "-username " + gs.userInformation.username; 148 } 149 webswingInstance0.options.args += " -groups " + gs.userInformation.groups.replace(/\s/g, ''); 150 webswingInstance0.options.args += " -uid " + gs.userInformation.uid; 138 151 } 139 152 function getParam(name) {
Note:
See TracChangeset
for help on using the changeset viewer.