[fusion-commits] r1666 - in branches/fusion-1.1/MapServer: . php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Nov 14 10:45:43 EST 2008


Author: madair
Date: 2008-11-14 10:45:43 -0500 (Fri, 14 Nov 2008)
New Revision: 1666

Modified:
   branches/fusion-1.1/MapServer/MapServer.js
   branches/fusion-1.1/MapServer/php/SetLayers.php
Log:
re #169: fix error in SetLayers response and build the aLayers array correctly for Mapserver

Modified: branches/fusion-1.1/MapServer/MapServer.js
===================================================================
--- branches/fusion-1.1/MapServer/MapServer.js	2008-11-12 21:46:54 UTC (rev 1665)
+++ branches/fusion-1.1/MapServer/MapServer.js	2008-11-14 15:45:43 UTC (rev 1666)
@@ -44,8 +44,8 @@
     bDisplayInLegend: true,   //TODO: set this in AppDef?
     bExpandInLegend: true,   //TODO: set this in AppDef?
     oSelection: null,
-    bMapLoaded : false,
-    bIsMapWidgetLayer : true,  //Setthis to false for overview map layers
+    bMapLoaded: false,
+    bIsMapWidgetLayer: true,  //Setthis to false for overview map layers
     bLayersReversed: true,     //MS returns layers bottom-most layer first, we treat layer order in reverse sense
     mapMetadataKeys: null,
     layerMetadataKeys: null,
@@ -258,18 +258,18 @@
       				singleTile: true,
       				ratio: this.ratio,
               units: this.units,
-      				maxExtent : this._oMaxExtent,
-              maxResolution : 'auto',
-      				minScale : maxScale,	//OL interpretation of min/max scale is reversed from Fusion
-      				maxScale : minScale
+      				maxExtent: this._oMaxExtent,
+              maxResolution: 'auto',
+      				minScale: maxScale,	//OL interpretation of min/max scale is reversed from Fusion
+      				maxScale: minScale
       			};
 
             //create the OL layer for this Map layer
             var params = {
               layers: this.aVisibleLayers.join(' '),
-              session : this.getSessionID(),
-              map : this._sMapFile,
-              map_imagetype : this._sImageType
+              session: this.getSessionID(),
+              map: this._sMapFile,
+              map_imagetype: this._sImageType
             };
 
             //remove this layer if it was already loaded
@@ -379,11 +379,16 @@
         eval('o='+r.responseText);
   			if (o.success) {
   				var layerCopy = this.aLayers.clone();
+          var nLayers = layerCopy.length -1;
+          
+          //Mapserver has list of layers reversed from MapGuide
+          aLayerIndex.reverse();
+    
   				this.aLayers = [];
   				this.aVisibleLayers = [];
 
           for (var i=0; i<aLayerIndex.length; ++i) {
-            this.aLayers.push( layerCopy[ aLayerIndex[i] ] );
+            this.aLayers.push( layerCopy[ nLayers - aLayerIndex[i] ] );
             if (this.aLayers[i].visible) {
                 this.aVisibleLayers.push(this.aLayers[i].layerName);
             }

Modified: branches/fusion-1.1/MapServer/php/SetLayers.php
===================================================================
--- branches/fusion-1.1/MapServer/php/SetLayers.php	2008-11-12 21:46:54 UTC (rev 1665)
+++ branches/fusion-1.1/MapServer/php/SetLayers.php	2008-11-14 15:45:43 UTC (rev 1666)
@@ -70,9 +70,10 @@
 }
 
 if ($res) {
-	$oMap->save($_SESSION['maps'][$mapName]);
-	$currentLayers = $oMap->getlayersdrawingorder();
-    echo "{success: true, layerindex: [".implode(",",$currentLayers)."]}";
+    $oMap->save($_SESSION['maps'][$mapName]);
+    $oMap = ms_newMapObj($_SESSION['maps'][$mapName]);
+    $newLayers = $oMap->getlayersdrawingorder();
+    echo "{success: true, layerindex: [".implode(",",$newLayers)."]}";
 } else {
     echo "{success: false, layerindex: [".$_REQUEST['layerindex']."]}";
 }



More information about the fusion-commits mailing list