[fusion-commits] r2386 - in trunk/layers/MapServer: . php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri May 27 15:11:57 EDT 2011


Author: madair
Date: 2011-05-27 12:11:57 -0700 (Fri, 27 May 2011)
New Revision: 2386

Modified:
   trunk/layers/MapServer/MapServer.js
   trunk/layers/MapServer/php/LoadMap.php
Log:
re #452: only clear the session selection_array on LoadMap, not reloadMap

Modified: trunk/layers/MapServer/MapServer.js
===================================================================
--- trunk/layers/MapServer/MapServer.js	2011-05-27 10:57:43 UTC (rev 2385)
+++ trunk/layers/MapServer/MapServer.js	2011-05-27 19:11:57 UTC (rev 2386)
@@ -165,13 +165,18 @@
     },
 
     restoreStateCB: function(oResponse){
-        if(oResponse.error){
+        if(oResponse.error) {
             Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING, "Error Restoring Map State - "+oResponse.error));
+        } else {
+            this.oRestoredState = oResponse;
+            var a = this.oRestoredState.extents.split(',');
+            this.mapWidget.mapGroup.initialView = {
+              minX: parseFloat(a[0]),
+              minY: parseFloat(a[1]),
+              maxX: parseFloat(a[2]),
+              maxY: parseFloat(a[3])
+            }
         }
-        else
-        {
-        this.oRestoredState = oResponse;
-        }
         // done with session create, fire the event.
         this.triggerEvent(Fusion.Event.MAP_SESSION_CREATED);
     },
@@ -353,7 +358,8 @@
 
         var params = {
             'mapname': this._sMapname,
-            'session': this.getSessionID()
+            'session': this.getSessionID(),
+            'reload': true
         };
         if (this.mapMetadataKeys) {
             params.map_metadata = this.mapMetadataKeys;

Modified: trunk/layers/MapServer/php/LoadMap.php
===================================================================
--- trunk/layers/MapServer/php/LoadMap.php	2011-05-27 10:57:43 UTC (rev 2385)
+++ trunk/layers/MapServer/php/LoadMap.php	2011-05-27 19:11:57 UTC (rev 2386)
@@ -41,7 +41,9 @@
 $moveToSession = true;
 $modifyPaths = false;
 
-unset($_SESSION['selection_array']);
+if (!isset($_REQUEST['reload'])) {
+  unset($_SESSION['selection_array']);
+}
 
 /**
    TODO make it possible to specify only a relative path
@@ -434,6 +436,8 @@
         
         //allow for nested groups using a "parentGroup" piece of metadata
         //nesting of groups is accomplished by using the | as a separator
+        //this value becomes the groups uniqueId because groups with the 
+        //same name can have diffferent parents. 
         $parentStr = $layer->getMetaData('parentGroup');
         $nestedParents = array();
         if (strlen($parentStr)>0) {
@@ -443,13 +447,10 @@
           array_push($nestedParents, $layer->group);
           $layerObj->parentGroup = implode("|",$nestedParents);
         }
-        //echo "/*";
-        //print_r($nestedParents);
         while (count($nestedParents)>0) {
             $alreadyListed = false;
             $parentId = implode("|",$nestedParents);
             $parent = array_pop($nestedParents);
-            //echo "-testing:".$parent." from:".$parentId."\n";
             foreach($mapObj->groups as $pGroup) {
                 if ($pGroup->uniqueId == $parentId) {
                   $alreadyListed = true;
@@ -460,21 +461,9 @@
               array_push($mapObj->groups, getGroupObject($layer, $parentId));
             }
         }
-        //echo "*/";
         array_push($mapObj->layers, $layerObj);
 
     }
-    /*
-    $aGroups = $oMap->getAllGroupNames();
-    if (is_array($aGroups)) {
-      foreach($aGroups as $groupName) {
-          $aLayerIndexes = $oMap->getLayersIndexByGroup($groupName);
-          if (count($aLayerIndexes) > 0) {
-              array_push($mapObj->groups, getGroupObject($oMap->getLayer($aLayerIndexes[0])));
-          }
-      }
-    }
-    */
     echo var2json($mapObj);
 }
 
@@ -504,28 +493,6 @@
     return $group;
 }
 
-function getParentGroupObject($layer,$groupName,$parent) {
-    $parentGroup = $layer->getMetaData('parentGroup');
-    $group = NULL;
-    $group->groupName = $groupName;
-    $ll = $layer->getMetaData('parentGroupLegendLabel');
-    $group->legendLabel = $ll != '' ? $ll : $group->groupName;
-    $group->uniqueId = $group->groupName;
-    $b = $layer->getMetaData('groupDisplayInLegend');
-    $group->displayInLegend = ($b == 'false') ? false : true;
-    $b = $layer->getMetaData('groupExpandInLegend');
-    $group->expandInLegend = ($b == 'false') ? false : true;
-    $group->layerGroupType = '';
-    /* maybe do some parsing of the metadata to get parents of paretns? */
-    $group->parentUniqueId = $parentGroup;
-    $group->parent = $parent;
-    $b = $layer->getMetaData('groupVisible');
-    $group->visible = ($b == 'false') ? false : true;
-    $group->actuallyVisible = $layer->isVisible();
-
-    return $group;
-}
-
 function GetMetersPerUnit($unit)
 {
     if ($unit == MS_INCHES)



More information about the fusion-commits mailing list