[mapguide-commits] r6787 - branches/2.4/MgDev/Web/src/mapviewerphp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 18 07:42:58 PDT 2012


Author: jng
Date: 2012-06-18 07:42:57 -0700 (Mon, 18 Jun 2012)
New Revision: 6787

Modified:
   branches/2.4/MgDev/Web/src/mapviewerphp/mainframe.php
   branches/2.4/MgDev/Web/src/mapviewerphp/taskframe.php
Log:
#1684: Pass MAPNAME to the task pane frame. This ensures that on initial load and on the click of the home button the frame will always at a minimum have the parameters of: SESSION, MAPNAME and LOCALE. This fix is for the PHP viewer.

Modified: branches/2.4/MgDev/Web/src/mapviewerphp/mainframe.php
===================================================================
--- branches/2.4/MgDev/Web/src/mapviewerphp/mainframe.php	2012-06-18 14:40:52 UTC (rev 6786)
+++ branches/2.4/MgDev/Web/src/mapviewerphp/mainframe.php	2012-06-18 14:42:57 UTC (rev 6787)
@@ -22,6 +22,7 @@
 include 'product.php';
 
 $webLayoutDefinition = '';
+$mapName = '';
 $locale = '';
 $sessionId = '';
 $orgSessionId = '';
@@ -34,6 +35,7 @@
 {
     global $debug, $webLayoutDefinition, $cmds, $locale;
     global $sessionId, $username, $password, $orgSessionId;
+    global $mapName;
     global $product;
 
     SetLocalizedFilesPath(GetLocalizationPath());
@@ -143,6 +145,15 @@
             $defHome = true;
         }
         $mapDefinitionUrl = urlencode($mapDef);
+        
+        // NOTE:
+        //
+        // We don't open a MgMap because it is being created by mapframe.php that is also probably running
+        // as this script is running. However the naming convention is fixed enough that we can figure out
+        // what to pass to the Task Pane
+        $resId = new MgResourceIdentifier($mapDef);
+        $mapName = $resId->GetName();
+        
         $title = $webLayout->GetTitle();
         $enablePingServer = $webLayout->GetEnablePingServer();
 
@@ -170,7 +181,7 @@
         //
         $srcToolbar = $showToolbar? ('src="' . $vpath . 'toolbar.php?LOCALE=' . $locale . '"'): '';
         $srcStatusbar = $showStatusbar? ('src="' . $vpath . 'statusbar.php?LOCALE=' . $locale . '"') : "";
-        $srcTaskFrame = $showTaskPane? ('src="' . $vpath . 'taskframe.php?WEBLAYOUT=' . urlencode($webLayoutDefinition) . '&DWF=' . ($forDwf? "1": "0") . '&SESSION=' . ($sessionId != ""? $sessionId: "") . '&LOCALE=' . $locale . '"') : '';
+        $srcTaskFrame = $showTaskPane? ('src="' . $vpath . 'taskframe.php?MAPNAME=' . $mapName . '&WEBLAYOUT=' . urlencode($webLayoutDefinition) . '&DWF=' . ($forDwf? "1": "0") . '&SESSION=' . ($sessionId != ""? $sessionId: "") . '&LOCALE=' . $locale . '"') : '';
         $srcTaskBar = 'src="' . $vpath . 'taskbar.php?LOCALE=' . $locale . '"';
 
         //view center
@@ -580,7 +591,7 @@
 
 function GetParameters($params)
 {
-    global $debug, $webLayoutDefinition;
+    global $debug, $webLayoutDefinition, $mapName;
     global $sessionId, $username, $password, $orgSessionId, $locale;
 
     $sessionId = ValidateSessionId(GetParameter($params, 'SESSION'));

Modified: branches/2.4/MgDev/Web/src/mapviewerphp/taskframe.php
===================================================================
--- branches/2.4/MgDev/Web/src/mapviewerphp/taskframe.php	2012-06-18 14:40:52 UTC (rev 6786)
+++ branches/2.4/MgDev/Web/src/mapviewerphp/taskframe.php	2012-06-18 14:42:57 UTC (rev 6787)
@@ -24,6 +24,7 @@
 $webLayoutId = "";
 $dwf = 0;
 $locale = "";
+$mapName = "";
 
 GetRequestParameters();
 SetLocalizedFilesPath(GetLocalizationPath());
@@ -71,9 +72,9 @@
     
     //If there is a query component to the initial url, append it to the end of the full url string
     if (strlen($query) == 0)
-        $url = sprintf("%s?SESSION=%s&WEBLAYOUT=%s&DWF=%s&LOCALE=%s", $baseUrl, $sessionId, urlencode($webLayoutId), $dwf, $locale);
+        $url = sprintf("%s?SESSION=%s&MAPNAME=%s&WEBLAYOUT=%s&DWF=%s&LOCALE=%s", $baseUrl, $sessionId, $mapName, urlencode($webLayoutId), $dwf, $locale);
     else
-        $url = sprintf("%s?SESSION=%s&WEBLAYOUT=%s&DWF=%s&LOCALE=%s&%s", $baseUrl, $sessionId, urlencode($webLayoutId), $dwf, $locale, $query);
+        $url = sprintf("%s?SESSION=%s&MAPNAME=%s&WEBLAYOUT=%s&DWF=%s&LOCALE=%s&%s", $baseUrl, $sessionId, $mapName, urlencode($webLayoutId), $dwf, $locale, $query);
 
     $templ = file_get_contents("../viewerfiles/taskframe.templ");
     print sprintf($templ, $vpath ."tasklist.php", $locale, $url);
@@ -91,12 +92,13 @@
 
 function GetParameters($params)
 {
-    global $taskPane, $sessionId, $webLayoutId, $dwf, $locale;
+    global $taskPane, $sessionId, $webLayoutId, $dwf, $locale, $mapName;
 
     $sessionId = ValidateSessionId(GetParameter($params, 'SESSION'));
     $locale = ValidateLocaleString(GetParameter($params, 'LOCALE'));
     $webLayoutId = ValidateResourceId(GetParameter($params, 'WEBLAYOUT'));
     $dwf = GetIntParameter($params, 'DWF');
+    $mapName = ValidateMapName(GetParameter($params, 'MAPNAME'));
 }
 
 function GetRequestParameters()



More information about the mapguide-commits mailing list