[fusion-commits] r2082 - sandbox/adsk/2.2gp/lib trunk/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Feb 19 15:14:05 EST 2010


Author: chrisclaydon
Date: 2010-02-19 15:14:05 -0500 (Fri, 19 Feb 2010)
New Revision: 2082

Modified:
   sandbox/adsk/2.2gp/lib/fusion.js
   trunk/lib/fusion.js
Log:
Fixes #361 - Commercial layer support doesn't work for Fusion application definitions stored in session repository

Modified: sandbox/adsk/2.2gp/lib/fusion.js
===================================================================
--- sandbox/adsk/2.2gp/lib/fusion.js	2010-02-19 18:31:17 UTC (rev 2081)
+++ sandbox/adsk/2.2gp/lib/fusion.js	2010-02-19 20:14:05 UTC (rev 2082)
@@ -1467,50 +1467,55 @@
         document.writeln('<script src="' + src + '"><\/script>'); 
     }
 
-	var getXmlHttpRequest = function(){	
+    var getXmlHttpRequest = function(){	
         try { return new XMLHttpRequest(); }
-		catch (e) { try { return new ActiveXObject('Msxml2.XMLHTTP'); } 
-		catch (e) { try { return new ActiveXObject('Microsoft.XMLHTTP'); }
-		catch (e) { return  null; }}}
-	}
-	
-	/**
-	 * Function: createSessionId
-	 *
-	 * Pre-create a session to avoid the 401 Unauthorized dialog
-	 *
-	 */
-	var createSessionId = function(){
-		var xhr = getXmlHttpRequest();
-		xhr.open("GET", Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php",false);
-		xhr.send(null); 
-		var o;
-		eval('o='+xhr.responseText);
-		Fusion.sessionId = o.sessionId;
-	}
-	
-	var appDefUrl = Fusion.getQueryParam('ApplicationDefinition'); 
-	if(appDefUrl && (
-	    appDefUrl.indexOf('Library') == 0 ||
-	    appDefUrl.indexOf('Session') == 0)){
-    	createSessionId();	
-		var xhr = new getXmlHttpRequest(); 
-		var mapAgentUrl = getAgentUrl(); 
-		xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ Fusion.sessionId, false); 
-		xhr.send(null); 
-		var appDefXML = xhr.responseXML.documentElement; 
-		
-		if(appDefXML){
-			var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
-			var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
-			var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0]; 
+        catch (e) { try { return new ActiveXObject('Msxml2.XMLHTTP'); } 
+        catch (e) { try { return new ActiveXObject('Microsoft.XMLHTTP'); }
+        catch (e) { return  null; }}}
+    }
 
-			addElement(googleElement); 
-			addElement(yahooElement); 
-			addElement(veElement);
-		}
-	}
-	
+    /**
+     * Function: createSessionId
+     *
+     * Pre-create a session to avoid the 401 Unauthorized dialog
+     *
+     */
+    var createSessionId = function(){
+        var xhr = getXmlHttpRequest();
+        xhr.open("GET", Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php",false);
+        xhr.send(null); 
+        var o;
+        eval('o='+xhr.responseText);
+        Fusion.sessionId = o.sessionId;
+    }
+
+    var appDefUrl = Fusion.getQueryParam('ApplicationDefinition'); 
+    if(appDefUrl && (
+        appDefUrl.indexOf('Library') == 0 ||
+        appDefUrl.indexOf('Session') == 0)){
+        var passedSessionId = Fusion.getQueryParam('Session'); 
+        if(passedSessionId == null){
+            createSessionId();
+        }else{
+            Fusion.sessionId = passedSessionId;
+        }
+        var xhr = new getXmlHttpRequest(); 
+        var mapAgentUrl = getAgentUrl(); 
+        xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ Fusion.sessionId, false); 
+        xhr.send(null); 
+        var appDefXML = xhr.responseXML.documentElement; 
+
+        if(appDefXML){
+            var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
+            var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
+            var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0]; 
+
+            addElement(googleElement); 
+            addElement(yahooElement); 
+            addElement(veElement);
+        }
+    }
+
     
 })();
 

Modified: trunk/lib/fusion.js
===================================================================
--- trunk/lib/fusion.js	2010-02-19 18:31:17 UTC (rev 2081)
+++ trunk/lib/fusion.js	2010-02-19 20:14:05 UTC (rev 2082)
@@ -1467,50 +1467,54 @@
         document.writeln('<script src="' + src + '"><\/script>'); 
     }
 
-	var getXmlHttpRequest = function(){	
+    var getXmlHttpRequest = function(){ 
         try { return new XMLHttpRequest(); }
-		catch (e) { try { return new ActiveXObject('Msxml2.XMLHTTP'); } 
-		catch (e) { try { return new ActiveXObject('Microsoft.XMLHTTP'); }
-		catch (e) { return  null; }}}
-	}
-	
-	/**
-	 * Function: createSessionId
-	 *
-	 * Pre-create a session to avoid the 401 Unauthorized dialog
-	 *
-	 */
-	var createSessionId = function(){
-		var xhr = getXmlHttpRequest();
-		xhr.open("GET", Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php",false);
-		xhr.send(null); 
-		var o;
-		eval('o='+xhr.responseText);
-		Fusion.sessionId = o.sessionId;
-	}
-	
-	var appDefUrl = Fusion.getQueryParam('ApplicationDefinition'); 
-	if(appDefUrl && (
-	    appDefUrl.indexOf('Library') == 0 ||
-	    appDefUrl.indexOf('Session') == 0)){
-    	createSessionId();	
-		var xhr = new getXmlHttpRequest(); 
-		var mapAgentUrl = getAgentUrl(); 
-		xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ Fusion.sessionId, false); 
-		xhr.send(null); 
-		var appDefXML = xhr.responseXML.documentElement; 
-		
-		if(appDefXML){
-			var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
-			var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
-			var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0]; 
+        catch (e) { try { return new ActiveXObject('Msxml2.XMLHTTP'); } 
+        catch (e) { try { return new ActiveXObject('Microsoft.XMLHTTP'); }
+        catch (e) { return  null; }}}
+    }
 
-			addElement(googleElement); 
-			addElement(yahooElement); 
-			addElement(veElement);
-		}
-	}
-	
+    /**
+     * Function: createSessionId
+     *
+     * Pre-create a session to avoid the 401 Unauthorized dialog
+     *
+     */
+    var createSessionId = function(){
+        var xhr = getXmlHttpRequest();
+        xhr.open("GET", Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php",false);
+        xhr.send(null); 
+        var o;
+        eval('o='+xhr.responseText);
+        Fusion.sessionId = o.sessionId;
+    }
+
+    var appDefUrl = Fusion.getQueryParam('ApplicationDefinition'); 
+    if(appDefUrl && (
+        appDefUrl.indexOf('Library') == 0 ||
+        appDefUrl.indexOf('Session') == 0)){
+        var passedSessionId = Fusion.getQueryParam('Session'); 
+        if(passedSessionId == null){
+            createSessionId();
+        }else{
+            Fusion.sessionId = passedSessionId;
+        }
+        var xhr = new getXmlHttpRequest(); 
+        var mapAgentUrl = getAgentUrl(); 
+        xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ Fusion.sessionId, false); 
+        xhr.send(null); 
+        var appDefXML = xhr.responseXML.documentElement; 
+
+        if(appDefXML){
+            var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
+            var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
+            var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0]; 
+
+            addElement(googleElement); 
+            addElement(yahooElement); 
+            addElement(veElement);
+        }
+    }
     
 })();
 



More information about the fusion-commits mailing list