[fusion-commits] r2705 - in sandbox/createruntimemap/layers/MapGuide: . php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Sat May 18 02:44:19 PDT 2013


Author: jng
Date: 2013-05-18 02:44:19 -0700 (Sat, 18 May 2013)
New Revision: 2705

Modified:
   sandbox/createruntimemap/layers/MapGuide/MapGuide.js
   sandbox/createruntimemap/layers/MapGuide/php/CreateSession.php
   sandbox/createruntimemap/layers/MapGuide/php/LoadMap.php
Log:
Move site version to the result of CreateSession.php, this is so we have access to the site version before LoadMap.php, thus allowing us to do a version check to see if we can use the CREATERUNTIMEMAP path if it is available to us.

Modified: sandbox/createruntimemap/layers/MapGuide/MapGuide.js
===================================================================
--- sandbox/createruntimemap/layers/MapGuide/MapGuide.js	2013-05-17 13:55:23 UTC (rev 2704)
+++ sandbox/createruntimemap/layers/MapGuide/MapGuide.js	2013-05-18 09:44:19 UTC (rev 2705)
@@ -50,6 +50,7 @@
         1155581.153, 2311162.307, 4622324.614, 9244649.227, 18489298.45, 
         36978596.91, 73957193.82, 147914387.6, 295828775.3, 591657550.5
     ],
+    bUseNativeServices: false,
     selectionAsOverlay: true,
     useAsyncOverlay: false,
     defaultFormat: 'PNG',
@@ -123,9 +124,6 @@
         this.noCache = true;
         this.oLayersOLTile = [];
         
-        //NOTE: This may cause a slight (but not too much) delay in any requests to PHP scripts that use layer property mappings as they will be
-        //lazy loaded due to us not calling LoadMap.php, which would've pre-cached such information.
-        this.bUseNativeServices = true;
         var sid = Fusion.sessionId;
         if (sid) {
             this.session[0] = sid;
@@ -158,6 +156,28 @@
             if (o.success === false) {
                 Fusion.reportError(o.message);
             } else {
+                var version = o.siteVersion;
+                var bits = version.split('.');
+                this.siteVersion = new Array(parseInt(bits[0]),
+                                             parseInt(bits[1]),
+                                             parseInt(bits[2]),
+                                             parseInt(bits[3])
+                );
+                //NOTE: Using native services may cause a slight (but not too much) delay in any requests to PHP scripts 
+                //that use layer property mappings as they will be lazy loaded due to us not calling LoadMap.php, which 
+                //would've pre-cached such information. but we get 
+                this.bUseNativeServices = false;
+                var vMajor = this.siteVersion[0];
+                var vMinor = this.siteVersion[1];
+                if (vMajor > 2) { // 3.0 or higher
+                    this.bUseNativeServices = true;
+                } else {
+                    if (vMajor == 2) { // 2.x
+                        if (vMinor >= 6) { // >= 2.6
+                            this.bUseNativeServices = true;
+                        }
+                    }
+                }
                 this.session[0] = o.sessionId;
                 var acceptLang = o.acceptLanguage.split(',');
                 //IE - en-ca,en-us;q=0.8,fr;q=0.5,fr-ca;q=0.3
@@ -426,15 +446,6 @@
             this.mapWidget.setBackgroundColor(o.backgroundColor);
         }
 
-        var version = o.siteVersion;
-        var bits = version.split('.');
-        this.siteVersion = new Array(parseInt(bits[0]),
-                                      parseInt(bits[1]),
-                                      parseInt(bits[2]),
-                                      parseInt(bits[3])
-        );
-
-
         this.mapTag.layerOptions.maxExtent = OpenLayers.Bounds.fromArray(o.extent);
 
         this.layerRoot.clear();

Modified: sandbox/createruntimemap/layers/MapGuide/php/CreateSession.php
===================================================================
--- sandbox/createruntimemap/layers/MapGuide/php/CreateSession.php	2013-05-17 13:55:23 UTC (rev 2704)
+++ sandbox/createruntimemap/layers/MapGuide/php/CreateSession.php	2013-05-18 09:44:19 UTC (rev 2705)
@@ -48,6 +48,7 @@
     $result = null;
     $result->sessionId = $sessionId;
     $result->userName = $username;
+    $result->siteVersion = GetSiteVersion();
     $result->acceptLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     echo var2json($result);
 

Modified: sandbox/createruntimemap/layers/MapGuide/php/LoadMap.php
===================================================================
--- sandbox/createruntimemap/layers/MapGuide/php/LoadMap.php	2013-05-17 13:55:23 UTC (rev 2704)
+++ sandbox/createruntimemap/layers/MapGuide/php/LoadMap.php	2013-05-18 09:44:19 UTC (rev 2705)
@@ -114,7 +114,6 @@
     $mapObj->metersPerUnit = $metersPerUnit;
     $mapObj->wkt = $srs;
     $mapObj->epsg = $epsgCode;
-    $mapObj->siteVersion = GetSiteVersion();
 
     $mapObj->mapTitle=addslashes($mapTitle);
 



More information about the fusion-commits mailing list