[fusion-commits] r2357 - trunk/layers/MapServer/php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Apr 1 11:55:13 EDT 2011


Author: pdeschamps
Date: 2011-04-01 08:55:13 -0700 (Fri, 01 Apr 2011)
New Revision: 2357

Modified:
   trunk/layers/MapServer/php/LoadMap.php
Log:
added workflow for publishedMaps to be loaded

Modified: trunk/layers/MapServer/php/LoadMap.php
===================================================================
--- trunk/layers/MapServer/php/LoadMap.php	2011-03-31 17:54:22 UTC (rev 2356)
+++ trunk/layers/MapServer/php/LoadMap.php	2011-04-01 15:55:13 UTC (rev 2357)
@@ -84,14 +84,39 @@
         $platformContext = new PlatformContext($platformDefaultConfig);
         $platformContext->RestoreSession(session_id());
 
-        $mapGen = new Map($platformContext, substr($szMapFile, 10));
-        if ($mapGen->Exists()) {
-            $result = $mapGen->Save();
-            if ($result->IsOk()) {
-                $sMapFileContents = $result->Get('MAPDATA');
+        $mapResource = new Resource($platformContext, substr($szMapFile, 10));
+
+        $sType = $mapResource->GetStoredType();
+        if(strtolower($sType) == "publishedmap"){
+            $szPlatformMapfile = $mapResource->GetResourceContent("content")->get("content");
+            if(file_exists($szPlatformMapfile)){
+                $modifyPaths = true;
+                $oMap = ms_newMapObj($szPlatformMapfile);
+                $szMapFile = $szPlatformMapfile;
             }
         }
-        $oMap = ms_newMapObjFromString($sMapFileContents);
+        else
+        {
+            $mapGen = new Map($platformContext, substr($szMapFile, 10));
+            if ($mapGen->Exists()) {
+                $result = $mapGen->Save();
+                if ($result->IsOk()) {
+                    $sMapFileContents = $result->Get('MAPDATA');
+                }
+                else
+                {
+                    echo var2json($result);
+                    die();
+                }
+                $oMap = ms_newMapObjFromString($sMapFileContents);
+            }
+        }
+        
+        
+        /*
+
+        */
+        
     } else if (file_exists($szMapFile)) {
         $modifyPaths = true;
         $oMap = ms_newMapObj($szMapFile);
@@ -168,8 +193,8 @@
 if ($oMap) {
     $mapName = $oMap->name;
     
-    header('Content-type: application/json');
-    header('X-JSON: true');
+    //header('Content-type: application/json');
+    //header('X-JSON: true');
     $mapObj->sessionId = $sessionID;
     $mapObj->mapId = $mapId;
 



More information about the fusion-commits mailing list