[fusion-commits] r1953 - in trunk: layers/MapGuide/php widgets/BufferPanel widgets/FeatureInfo widgets/Measure widgets/Print widgets/Query widgets/Search widgets/SelectWithin widgets/Theme

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Oct 26 12:17:49 EDT 2009


Author: chrisclaydon
Date: 2009-10-26 12:17:47 -0400 (Mon, 26 Oct 2009)
New Revision: 1953

Modified:
   trunk/layers/MapGuide/php/Buffer.php
   trunk/layers/MapGuide/php/ClearSelection.php
   trunk/layers/MapGuide/php/ColorPicker.php
   trunk/layers/MapGuide/php/Common.php
   trunk/layers/MapGuide/php/CreateSession.php
   trunk/layers/MapGuide/php/GetSelectionProperties.php
   trunk/layers/MapGuide/php/LayerInfo.php
   trunk/layers/MapGuide/php/Legend.php
   trunk/layers/MapGuide/php/LoadMap.php
   trunk/layers/MapGuide/php/LoadScaleRanges.php
   trunk/layers/MapGuide/php/MapMenu.php
   trunk/layers/MapGuide/php/Measure.php
   trunk/layers/MapGuide/php/Query.php
   trunk/layers/MapGuide/php/SaveMap.php
   trunk/layers/MapGuide/php/SaveMapFrame.php
   trunk/layers/MapGuide/php/SaveSelection.php
   trunk/layers/MapGuide/php/Selection.php
   trunk/layers/MapGuide/php/SetLayers.php
   trunk/widgets/BufferPanel/Buffer.php
   trunk/widgets/BufferPanel/BufferPanel.php
   trunk/widgets/BufferPanel/ColorPicker.php
   trunk/widgets/FeatureInfo/featureinfocontroller.php
   trunk/widgets/FeatureInfo/featureinfomain.php
   trunk/widgets/Measure/Measure.php
   trunk/widgets/Print/printablepage.php
   trunk/widgets/Query/querycontroller.php
   trunk/widgets/Query/querymain.php
   trunk/widgets/Search/Search.php
   trunk/widgets/Search/SearchPrompt.php
   trunk/widgets/SelectWithin/SelectWithin.php
   trunk/widgets/SelectWithin/SelectWithinPanel.php
   trunk/widgets/Theme/themecontroller.php
   trunk/widgets/Theme/thememain.php
Log:
Fix #282 - Update exception handling in common.php to allow more control over error display handling.


Modified: trunk/layers/MapGuide/php/Buffer.php
===================================================================
--- trunk/layers/MapGuide/php/Buffer.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/Buffer.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,6 +29,12 @@
  *****************************************************************************/
 
 include ('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
+
 include ('Utilities.php');
 
 try {

Modified: trunk/layers/MapGuide/php/ClearSelection.php
===================================================================
--- trunk/layers/MapGuide/php/ClearSelection.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/ClearSelection.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,19 +29,24 @@
  *****************************************************************************/
 
 include "Common.php";
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 
 try
 {
     $resourceSrvc = $siteConnection->CreateService(MgServiceType::ResourceService);
-         
+
     $map = new MgMap();
     $map->Open($resourceSrvc, $mapName);
-        
+
     $sel = new MgSelection($map);
 
     $sel->Save($resourceSrvc, $mapName);
-} 
-catch(MgException $e) 
+}
+catch(MgException $e)
 {
     echo "ERROR: " . $e->GetMessage() . "\n";
     echo $e->GetDetails() . "\n";

Modified: trunk/layers/MapGuide/php/ColorPicker.php
===================================================================
--- trunk/layers/MapGuide/php/ColorPicker.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/ColorPicker.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -27,6 +27,12 @@
     $fusionMGpath = '../../../layers/MapGuide/php/';
     include $fusionMGpath . 'Common.php';
 
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
+
     $locale = GetDefaultLocale();
     $clr = "000000";
     $allowTransparency = 0;

Modified: trunk/layers/MapGuide/php/Common.php
===================================================================
--- trunk/layers/MapGuide/php/Common.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/Common.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -38,6 +38,10 @@
 
 $defaultExtensionDir = dirname(__FILE__)."/../../../../";
 $defaultInstallDir = realpath($defaultExtensionDir)."/../../";
+$initializationErrorOccurred = false;
+$initializationErrorMessage = null;
+$initializationErrorStackTrace = null;
+$initializationErrorDetail = null;
 
 /**
  * Developer's notes:
@@ -64,8 +68,10 @@
 include dirname(__FILE__)."/Constants.php";
 // Initialize
 
-MgInitializeWebTier($extensionDir. "/webconfig.ini");
-try {
+try
+{
+    MgInitializeWebTier($extensionDir. "/webconfig.ini");
+
     /* If no session has been established yet, then we use the credentials passed
      * to this script to connect to the site server.  By default, we use the
      * Anonymous user.
@@ -115,48 +121,63 @@
         }
         //echo "<current user: >".$_SESSION['username']. '</current>';
     }
-} catch (MgAuthenticationFailedException $afe) {
-    header('Content-type: text/xml');
-    echo "<Exception>";
-    echo "<Type>Authentication Failed</Type>";
-    echo "<Message>" . $afe->GetMessage() . "</Message>";
-    echo "<Details>" . $afe->GetDetails() . "</Details>";
-    echo "</Exception>";
-    exit;
-} catch (MgUserNotFoundException $unfe) {
-    header('Content-type: text/xml');
-    echo "<Exception>";
-    echo "<Type>User Not Found</Type>";
-    echo "<Message>" . $unfe->GetMessage() . "</Message>";
-    echo "<Details>" . $unfe->GetDetails() . "</Details>";
-    echo "</Exception>";
-    exit;
-} catch (MgSessionExpiredException $see) {
-    header('Content-type: text/xml');
-    echo "<Exception>";
-    echo "<Type>Session Expired</Type>";
-    echo "<Message>" . $see->GetMessage() . "</Message>";
-    echo "<Details>" . $see->GetDetails() . "</Details>";
-    echo "</Exception>";
-    exit;
-} catch (MgException $e) {
-    header('Content-type: text/xml');
-    echo "<Exception>";
-    echo "<Type>Exception</Type>";
-    echo "<Message>" . $e->GetMessage() . "</Message>";
-    echo "<Details>" . $e->GetDetails() . "</Details>";
-    echo "</Exception>";
-    exit;
+
+    //common resource service to be used by all scripts
+    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
+
+    if (isset($_REQUEST['mapname'])) {
+        $mapName = $_REQUEST['mapname'];
+        $mapResourceID = new MgResourceIdentifier( 'Session:'.$sessionID.'//'.$mapName.'.MapDefinition');
+        $mapStateID = new MgResourceIdentifier('Session:'.$sessionID.'//'.$mapName.'.'.MgResourceType::Map);
+    }
+
 }
+catch (MgException $e)
+{
+    $initializationErrorMessage = $e->GetMessage();
+    $initializationErrorDetail = $e->GetDetails();
+    $initializationErrorStackTrace = $e->GetStackTrace();
+    $initializationErrorOccurred = true;
+}
 
+function InitializationErrorOccurred()
+{
+    global $initializationErrorOccurred;
+    return $initializationErrorOccurred;
+}
 
-//common resource service to be used by all scripts
-$resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
+function DisplayInitializationErrorHTML()
+{
+    global $initializationErrorMessage, $initializationErrorDetail;
+    echo "<table class=\"RegText\" border=\"0\" cellspacing=\"0\" width=\"100%%\">";
+    echo "<tr><td class=\"Title\">Error<hr></td></tr>";
+    if($initializationErrorMessage != null)
+    {
+        $message = $initializationErrorMessage;
+        while(strpos($message, '\n'))
+        {
+            $message = str_replace('\n', '<br/>', $message);
+        }
+        echo "<tr><td>" . $message . "</td></tr>";
+    }
+    if ($initializationErrorDetail != null && (strlen($initializationErrorDetail) - strlen($initializationErrorMessage) > 4))
+    {
+        $detail = $initializationErrorDetail;
+        while(strpos($detail, '\n'))
+        {
+            $detail = str_replace('\n', '<br/>', $detail);
+        }
+        echo "<tr><td>" . $detail . "</td></tr>";
+    }
+    echo "</table>";
+}
 
-if (isset($_REQUEST['mapname'])) {
-    $mapName = $_REQUEST['mapname'];
-    $mapResourceID = new MgResourceIdentifier( 'Session:'.$sessionID.'//'.$mapName.'.MapDefinition');
-    $mapStateID = new MgResourceIdentifier('Session:'.$sessionID.'//'.$mapName.'.'.MgResourceType::Map);
+function DisplayInitializationErrorText()
+{
+    global $initializationErrorMessage, $initializationErrorDetail, $initializationErrorStackTrace;
+    echo "ERROR: " . $initializationErrorMessage . "\n";
+    echo $initializationErrorDetail . "\n";
+    echo $initializationErrorStackTrace . "\n";
 }
 
 function GetDefaultLocale()

Modified: trunk/layers/MapGuide/php/CreateSession.php
===================================================================
--- trunk/layers/MapGuide/php/CreateSession.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/CreateSession.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,6 +29,11 @@
  *****************************************************************************/
 
 include('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('Utilities.php');
 include('../../../common/php/Utilities.php');
 

Modified: trunk/layers/MapGuide/php/GetSelectionProperties.php
===================================================================
--- trunk/layers/MapGuide/php/GetSelectionProperties.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/GetSelectionProperties.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -25,6 +25,11 @@
  */
 
 include('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('../../../common/php/Utilities.php');
 include('Utilities.php');
 

Modified: trunk/layers/MapGuide/php/LayerInfo.php
===================================================================
--- trunk/layers/MapGuide/php/LayerInfo.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/LayerInfo.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,6 +29,11 @@
  *****************************************************************************/
 
 include ("Common.php");
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include ("Utilities.php");
 
 $featureService = $siteConnection->CreateService(MgServiceType::FeatureService);

Modified: trunk/layers/MapGuide/php/Legend.php
===================================================================
--- trunk/layers/MapGuide/php/Legend.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/Legend.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,6 +29,11 @@
  *****************************************************************************/
 
 include ("Common.php");
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 
 // Converts a boolean to "yes" or "no"
 // --from MG Web Tier API Reference
@@ -56,11 +61,11 @@
 //TODO: make the temp location configurable
 $tempImgPath = "c:/Program Files/Apache Group/Apache2/htdocs/ms_tmp/";
 
-for($i=0;$i<$layers->GetCount();$i++) 
-{ 
+for($i=0;$i<$layers->GetCount();$i++)
+{
     $layer=$layers->GetItem($i);
     $layerDefinition = $layer->GetLayerDefinition();
-    
+
     echo '<layer>';
     echo '<uniqueid>'.$layer->GetObjectId().'</uniqueid>';
     echo '<layername>'.htmlentities($layer->GetName()).'</layername>';
@@ -77,14 +82,14 @@
     echo '<actuallyvisible>'.BooleanToString($layer->isVisible()).'</actuallyvisible>';
     buildScaleRanges($layer);
     echo '</layer>';
-} 
-echo "</layercollection>"; 
+}
+echo "</layercollection>";
 
 //Get layer groups as xml
 $groups = $map->GetLayerGroups();
-echo "<groupcollection>"; 
-for($i=0;$i<$groups->GetCount();$i++) 
-{ 
+echo "<groupcollection>";
+for($i=0;$i<$groups->GetCount();$i++)
+{
     $group=$groups->GetItem($i);
     $layerDefinition = $layer->GetLayerDefinition();
     echo '<group>';
@@ -102,8 +107,8 @@
     echo '<visible>'.BooleanToString($group->GetVisible()).'</visible>';
     echo '<actuallyvisible>'.BooleanToString($group->isVisible()).'</actuallyvisible>';
     echo '</group>';
-} 
-echo"</groupcollection>"; 
+}
+echo"</groupcollection>";
 
 echo "</legend>";
 
@@ -141,13 +146,13 @@
             $minScale = $minElt->item(0)->nodeValue;
         if($maxElt->length > 0)
             $maxScale = $maxElt->item(0)->nodeValue;
-        
+
         if($type != 0)
             break;
         $output .= '<scalerange>';
         $output .= '<minscale>'.$minScale.'</minscale>';
         $output .= '<maxscale>'.$maxScale.'</maxscale>';
-    
+
         $styleIndex = 0;
         for($ts=0, $count = count($typeStyles); $ts < $count; $ts++)
         {
@@ -191,4 +196,4 @@
 
     return $buffer;
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/layers/MapGuide/php/LoadMap.php
===================================================================
--- trunk/layers/MapGuide/php/LoadMap.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/LoadMap.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -30,6 +30,11 @@
 
 include(dirname(__FILE__).'/../../../common/php/Utilities.php');
 include('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('Utilities.php');
 
 
@@ -82,8 +87,8 @@
       } catch (MgException $e) {
         //just catch the exception and set epsgCode to empty string
       }
-      
 
+
       //  $unitsType = $cs->GetUnits();
     }
     else
@@ -111,15 +116,15 @@
     $mapObj->extent = array($oMin->GetX(), $oMin->GetY(), $oMax->GetX(), $oMax->GetY());
 
     $layers=$map->GetLayers();
-    
+
     //layers
     $mapObj->layers = array();
 
 
     $mapObj->layers = array();
-    for($i=0;$i<$layers->GetCount();$i++) 
-    { 
-        //only output layers that are part of the 'Normal Group' and 
+    for($i=0;$i<$layers->GetCount();$i++)
+    {
+        //only output layers that are part of the 'Normal Group' and
         //not the base map group used for tile maps.  (Where is the test for that Y.A.???)
 
         $layer=$layers->GetItem($i);
@@ -137,7 +142,7 @@
 
         $layerObj->resourceId = $layerDefinition->ToString();
         $layerObj->parentGroup = $layer->GetGroup() ? $layer->GetGroup()->GetObjectId() : '';
-        
+
         $layerObj->selectable = $layer->GetSelectable();
         $layerObj->visible = $layer->GetVisible();
         $layerObj->actuallyVisible = $layer->isVisible();
@@ -161,25 +166,25 @@
             $layerObj->maxScale = max($layerObj->maxScale, $oScaleRanges[$j]->maxScale);
         }
 
-        
+
         array_push($mapObj->layers, $layerObj);
-        
-    } 
 
+    }
+
     //Get layer groups as xml
     $groups = $map->GetLayerGroups();
     $mapObj->groups = array();
-    for($i=0;$i<$groups->GetCount();$i++) 
-    { 
+    for($i=0;$i<$groups->GetCount();$i++)
+    {
         $group=$groups->GetItem($i);
         array_push($mapObj->groups, OutputGroupInfo($group));
-    } 
+    }
 
     $mapObj->FiniteDisplayScales = array();
-    //FiniteDisplayScales for tiled maps    
+    //FiniteDisplayScales for tiled maps
     for ($i=0; $i<$map->GetFiniteDisplayScaleCount(); $i++)
     {
-    
+
         array_push($mapObj->FiniteDisplayScales, $map->GetFiniteDisplayScaleAt($i));
     }
     echo var2json($mapObj);
@@ -203,20 +208,20 @@
 /************************************************************************/
 function GetLayerTypesFromResourceContent($layer)
 {
-    $aLayerTypes = array();						
+    $aLayerTypes = array();
     global $resourceService;
 
     try
     {
         $dataSourceId = new MgResourceIdentifier($layer->GetFeatureSourceId());
         if($dataSourceId->GetResourceType() == MgResourceType::DrawingSource)
-          array_push($aLayerTypes, '5');// DWF 
+          array_push($aLayerTypes, '5');// DWF
         else
         {
             $resID = $layer->GetLayerDefinition();
             $layerContent = $resourceService->GetResourceContent($resID);
             $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerContent));
-    
+
             $gridlayers = $xmldoc->getElementsByTagName('GridLayerDefinition');
             if ($gridlayers->length > 0)
               array_push($aLayerTypes, '4');// raster
@@ -260,7 +265,7 @@
     }
 }
 
-function buildScaleRanges($layer) 
+function buildScaleRanges($layer)
 {
     $aScaleRanges = array();
     global $resourceService;
@@ -297,31 +302,31 @@
             $minScale = $minElt->item(0)->nodeValue;
         if($maxElt->length > 0)
             $maxScale = $maxElt->item(0)->nodeValue;
-           
+
         $scaleRangeObj->minScale = $minScale;
         $scaleRangeObj->maxScale = $maxScale;
 
-        
+
         if($type != 0) {
             array_push($aScaleRanges, $scaleRangeObj);
             break;
         }
-            
-        
+
+
         $styleIndex = 0;
         for($ts=0, $count = count($typeStyles); $ts < $count; $ts++)
         {
             $typeStyle = $scaleRange->getElementsByTagName($typeStyles[$ts]);
             $catIndex = 0;
             for($st = 0; $st < $typeStyle->length; $st++) {
-                
+
                 $styleObj = NULL;
                 // We will check if this typestyle is going to be shown in the legend
                 $showInLegend = $typeStyle->item($st)->getElementsByTagName("ShowInLegend");
                 if($showInLegend->length > 0)
                     if($showInLegend->item(0)->nodeValue == "false")
                         continue;   // This typestyle does not need to be shown in the legend
-                        
+
                 $rules = $typeStyle->item(0)->getElementsByTagName($ruleNames[$ts]);
                 for($r = 0; $r < $rules->length; $r++) {
                     $rule = $rules->item($r);
@@ -340,7 +345,7 @@
             }
         }
         array_push($aScaleRanges, $scaleRangeObj);
-        
+
     }
     return $aScaleRanges;
 }
@@ -370,7 +375,7 @@
     $groupObj->parentUniqueId = $parent != null ? $parent->GetObjectId() : '';
     $groupObj->visible = $group->GetVisible();
     $groupObj->actuallyVisible = $group->isVisible();
-    
+
     return $groupObj;
 }
 

Modified: trunk/layers/MapGuide/php/LoadScaleRanges.php
===================================================================
--- trunk/layers/MapGuide/php/LoadScaleRanges.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/LoadScaleRanges.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -27,11 +27,16 @@
  * Utility function to load scale ranges for the layers. Initially
  * scale ranges were returned as part of in LoadMap.php. This allows
  * to reduce the size of information that is returned by LoadMap, by putting
- * elements that are unnessary to the map draw her.  
+ * elements that are unnessary to the map draw her.
  *****************************************************************************/
 
 
 include ("Common.php");
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('../../../common/php/Utilities.php');
 include('Utilities.php');
 
@@ -43,10 +48,10 @@
 $scaleObj = NULL;
 $scaleObj->layers = array();
 
-for($i=0;$i<$layers->GetCount();$i++) 
-{    
+for($i=0;$i<$layers->GetCount();$i++)
+{
     $layer=$layers->GetItem($i);
-    if (isset($_SESSION['scale_ranges']) && 
+    if (isset($_SESSION['scale_ranges']) &&
         isset($_SESSION['scale_ranges'][$layer->GetObjectId()]))
     {
         $scaleranges = $_SESSION['scale_ranges'][$layer->GetObjectId()];

Modified: trunk/layers/MapGuide/php/MapMenu.php
===================================================================
--- trunk/layers/MapGuide/php/MapMenu.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/MapMenu.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,6 +29,11 @@
  *****************************************************************************/
 
 include ("Common.php");
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('../../../common/php/Utilities.php');
 
 //Get the folder to search within
@@ -48,7 +53,7 @@
 $result = NULL;
 
 $result->maps = array();
-for ( $i=0; $i < $aMapIds->length; $i++ ) { 
+for ( $i=0; $i < $aMapIds->length; $i++ ) {
     $mapId = new MgResourceIdentifier($aMapIds->item($i)->nodeValue);
     $md = NULL;
     $md->path = $aMapIds->item($i)->nodeValue;

Modified: trunk/layers/MapGuide/php/Measure.php
===================================================================
--- trunk/layers/MapGuide/php/Measure.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/Measure.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,14 +29,19 @@
  *****************************************************************************/
 
 include ('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include ('Utilities.php');
 
 try {
-    if (!isset($_REQUEST['session']) || 
+    if (!isset($_REQUEST['session']) ||
         !isset($_REQUEST['mapname']) ||
-        !isset($_REQUEST['x1']) || 
-        !isset($_REQUEST['y1']) || 
-        !isset($_REQUEST['x2']) || 
+        !isset($_REQUEST['x1']) ||
+        !isset($_REQUEST['y1']) ||
+        !isset($_REQUEST['x2']) ||
         !isset($_REQUEST['y2'])) {
         echo "<Error>Arguments missing </Error>";
         exit;
@@ -56,7 +61,7 @@
     } else {
         $distance = $srsMap->MeasureEuclideanDistance($x1, $y1, $x2, $y2);
     }
-    $distance = $srsMap->ConvertCoordinateSystemUnitsToMeters($distance);   
+    $distance = $srsMap->ConvertCoordinateSystemUnitsToMeters($distance);
     header('Content-type: application/json');
     header('X-JSON: true');
     echo "{distance:$distance}";
@@ -67,4 +72,4 @@
     echo $e->GetDetails() . "\n";
     echo $e->GetStackTrace() . "\n";
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/layers/MapGuide/php/Query.php
===================================================================
--- trunk/layers/MapGuide/php/Query.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/Query.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -32,6 +32,11 @@
 try {
     /* set up the session */
     include ("Common.php");
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorText();
+        exit;
+    }
     include('../../../common/php/Utilities.php');
     include('Utilities.php');
 

Modified: trunk/layers/MapGuide/php/SaveMap.php
===================================================================
--- trunk/layers/MapGuide/php/SaveMap.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/SaveMap.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -28,6 +28,11 @@
  * Purpose: get map initial information
  *****************************************************************************/
 include('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 $format     = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'PNG';
 $layout     = isset($_REQUEST['layout']) ? $_REQUEST['layout'] : null;
 $scale      = isset($_REQUEST['scale']) ? $_REQUEST['scale'] : null;
@@ -42,10 +47,10 @@
     $renderingService = $siteConnection->CreateService(MgServiceType::RenderingService);
     $map = new MgMap();
     $map->Open($resourceService, $mapName);
-    
+
     $selection = new MgSelection($map);
     $selection->Open($resourceService, $mapName);
-    
+
     //get current center as a coordinate
     $center = $map->GetViewCenter()->GetCoordinate();
 
@@ -65,9 +70,9 @@
                                             $aMargins[2],
                                             $aMargins[3]
                                             );
-        
+
         $dwfVersion = new MgDwfVersion('6.01','1.2');
-        
+
         $oImg = $mappingService->GeneratePlot($map,
                                           $center,
                                           $scale,

Modified: trunk/layers/MapGuide/php/SaveMapFrame.php
===================================================================
--- trunk/layers/MapGuide/php/SaveMapFrame.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/SaveMapFrame.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -25,7 +25,7 @@
  */
 
 /*****************************************************************************
- * Purpose: 
+ * Purpose:
  *****************************************************************************/
 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
@@ -44,7 +44,11 @@
 <H4>Preparing Image for download...</H4>
 <?php
 include('Common.php');
-
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorHTML();
+    exit;
+}
 $szLayout="";
 if (isset($_REQUEST['layout']) &&  $_REQUEST['layout'] != "") {
   $szLayout = "&layout=".$_REQUEST['layout'];

Modified: trunk/layers/MapGuide/php/SaveSelection.php
===================================================================
--- trunk/layers/MapGuide/php/SaveSelection.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/SaveSelection.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -25,6 +25,11 @@
  */
 
 include('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('../../../common/php/Utilities.php');
 include('Utilities.php');
 

Modified: trunk/layers/MapGuide/php/Selection.php
===================================================================
--- trunk/layers/MapGuide/php/Selection.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/Selection.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -25,11 +25,16 @@
  */
 
 /*****************************************************************************
- * Purpose: Get all attribute informations for elements in the 
+ * Purpose: Get all attribute informations for elements in the
  * current selection
  *****************************************************************************/
 
 include('Common.php');
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorText();
+    exit;
+}
 include('../../../common/php/Utilities.php');
 include('Utilities.php');
 
@@ -45,7 +50,7 @@
       $aLayers = split(",", $_REQUEST['layers']);
       $bAllLayers = 0;
     }
-    
+
     $aStartCount = array();
     if (isset($_REQUEST['startcount']) && $_REQUEST['startcount'] !='')
     {
@@ -58,7 +63,7 @@
         echo "error : number of layers and number of startcount should be the same";
         exit;
     }
-    
+
     $properties = $_SESSION['selection_array'];
 
     $aSelectedLayers = $properties->layers;
@@ -73,7 +78,7 @@
         for ($i=0; $i<count($aSelectedLayers); $i++)
         {
             $layerName =  $aSelectedLayers[$i];
-            if (($bAllLayers || in_array($layerName, $aLayers)) && 
+            if (($bAllLayers || in_array($layerName, $aLayers)) &&
                 isset($properties->$layerName) &&
                 $properties->$layerName->numelements > 0)
             {
@@ -82,10 +87,10 @@
                 $result->$layerName->propertyvalues = $properties->$layerName->propertyvalues;
                 $result->$layerName->propertytypes = $properties->$layerName->propertytypes;
                 $result->$layerName->metadatanames = $properties->$layerName->metadatanames;
-                
+
                 /*if start and count are given, validate them. If valid return the valid elements.
                   if not return all elements. */
-                 
+
                 $start = -1;
                 $count = -1;
                 if (count($aStartCount) > 0)
@@ -105,7 +110,7 @@
                     }
 
                     /*invalid entries*/
-                    if ($start < 0 || $count <=0 || 
+                    if ($start < 0 || $count <=0 ||
                         $start >= $properties->$layerName->numelements ||
                         $count > $properties->$layerName->numelements ||
                         ($start + $count) > $properties->$layerName->numelements)
@@ -123,7 +128,7 @@
                 }
                 //print_r($properties->$layerName);
                 $result->$layerName->numelements = $count;
-        
+
                 $result->$layerName->values = array();
                 $result->$layerName->metadata = array();
                 $iIndice = 0;

Modified: trunk/layers/MapGuide/php/SetLayers.php
===================================================================
--- trunk/layers/MapGuide/php/SetLayers.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/layers/MapGuide/php/SetLayers.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -37,62 +37,67 @@
 try {
     /* set up the session */
     include ("Common.php");
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorText();
+        exit;
+    }
     include('../../../common/php/Utilities.php');
     include('Utilities.php');
 
-	/* the name of the layer in the map to query */
-	if ($_REQUEST['layerindex'] != '') {
-		$layers = explode(',',$_REQUEST['layerindex']);
-	} else {
-		$layers = array();
-	}
+    /* the name of the layer in the map to query */
+    if ($_REQUEST['layerindex'] != '') {
+        $layers = explode(',',$_REQUEST['layerindex']);
+    } else {
+        $layers = array();
+    }
 
     /* open the map from the session using the provided map name.  The map was
        previously created by calling LoadMap. */
     $map = new MgMap();
     $map->Open($resourceService, $mapName);
-	$mapLayers = $map->GetLayers();
-	
-	
-	$nIndex = count($layers);
-	$nLayers = $mapLayers->GetCount();
+    $mapLayers = $map->GetLayers();
+
+
+    $nIndex = count($layers);
+    $nLayers = $mapLayers->GetCount();
     for ($i=0; $i<$nLayers; $i++) {
-		if ($layers[$i] == $i) {
-			continue;
-		}
-		$found = -1;
-		for ($j=$i+1; $j<$nIndex; ++$j) {
-			if ($layers[$j] == $i) {
-				$found = $j;
-				break;
-			}
-		}
-		if ($found >= 0) {
-			$layerToMove = $mapLayers->GetItem($i);
-			//$layerDef = $layerToMove->GetLayerDefinition();
-			//$mapLayers->Insert($found, new MgLayerBase($layerDef,$resourceService));
-			$mapLayers->RemoveAt($i);
-			$mapLayers->Insert($found, $layerToMove);
-		} else {
-			$mapLayers->RemoveAt($i);
-		}
-		break;
-	}
-	/*
-	$nLayers = count($layers);
-	$layerDefs = array();
+        if ($layers[$i] == $i) {
+            continue;
+        }
+        $found = -1;
+        for ($j=$i+1; $j<$nIndex; ++$j) {
+            if ($layers[$j] == $i) {
+                $found = $j;
+                break;
+            }
+        }
+        if ($found >= 0) {
+            $layerToMove = $mapLayers->GetItem($i);
+            //$layerDef = $layerToMove->GetLayerDefinition();
+            //$mapLayers->Insert($found, new MgLayerBase($layerDef,$resourceService));
+            $mapLayers->RemoveAt($i);
+            $mapLayers->Insert($found, $layerToMove);
+        } else {
+            $mapLayers->RemoveAt($i);
+        }
+        break;
+    }
+    /*
+    $nLayers = count($layers);
+    $layerDefs = array();
     for ($i=0; $i<$nLayers; $i++) {
-		$layer = $mapLayers->GetItem($layers[$i]);
-		array_push($layerDefs, $layer->GetLayerDefinition() );
-	}
-	$mapLayers->Clear();
-	
-	$nLayers = count($layerDefs);
+        $layer = $mapLayers->GetItem($layers[$i]);
+        array_push($layerDefs, $layer->GetLayerDefinition() );
+    }
+    $mapLayers->Clear();
+
+    $nLayers = count($layerDefs);
     for ($i=0; $i<$nLayers; $i++) {
-		$layer = new MgLayer(new MgResourceIdentifier($layerDefs[$i]), $resourceService);
-		$mapLayers->Add($layer);
-	}
-	*/
+        $layer = new MgLayer(new MgResourceIdentifier($layerDefs[$i]), $resourceService);
+        $mapLayers->Add($layer);
+    }
+    */
 
     $map->Save($resourceService);
     echo "success: true";

Modified: trunk/widgets/BufferPanel/Buffer.php
===================================================================
--- trunk/widgets/BufferPanel/Buffer.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/BufferPanel/Buffer.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -25,7 +25,13 @@
  */
 
     $fusionMGpath = '../../layers/MapGuide/php/';
+
     include $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
 
     $locale = GetDefaultLocale();
     $mapName = "";

Modified: trunk/widgets/BufferPanel/BufferPanel.php
===================================================================
--- trunk/widgets/BufferPanel/BufferPanel.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/BufferPanel/BufferPanel.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -26,7 +26,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     include $fusionMGpath . 'Common.php';
-
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     $locale = GetDefaultLocale();
     $popup = 0;
     $mapName = "";

Modified: trunk/widgets/BufferPanel/ColorPicker.php
===================================================================
--- trunk/widgets/BufferPanel/ColorPicker.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/BufferPanel/ColorPicker.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -26,7 +26,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     include $fusionMGpath . 'Common.php';
-
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     $locale = GetDefaultLocale();
     $clr = "000000";
     $allowTransparency = 0;

Modified: trunk/widgets/FeatureInfo/featureinfocontroller.php
===================================================================
--- trunk/widgets/FeatureInfo/featureinfocontroller.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/FeatureInfo/featureinfocontroller.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -19,19 +19,24 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     require_once $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorText();
+        exit;
+    }
     require_once $fusionMGpath . 'Utilities.php';
     require_once $fusionMGpath . 'JSON.php';
     require_once 'classes/featureinfo.php';
 
     $args = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET;
-    
+
     try {
         $responseType = 'text/plain';
         $response = '';
-        
+
         $site = new MgSiteConnection();
         $site->Open(new MgUserInformation($args['SESSION']));
-        
+
         $resourceService = $site->CreateService(MgServiceType::ResourceService);
         $featureService =
             $site->CreateService(MgServiceType::FeatureService);
@@ -46,9 +51,9 @@
 
         $selection = new MgSelection($map);
         $selection->Open($resourceService, $mapName);
-        
+
         $properties = NULL;
-        
+
         if ($selection->Contains($layer, $className)) {
             $featureReader = $selection->GetSelectedFeatures($layer, $className, new MgStringCollection());
 
@@ -91,15 +96,15 @@
               $properties = BuildSelectionArray($featureReader, $layerName, $properties, true, $srsLayer, $bNeedsTransform, $layer);
 
         }
-  
-        $response = json_encode($properties);          
 
+        $response = json_encode($properties);
+
     } catch (MgException $e) {
         echo "ERROR: " . $e->GetMessage() . "\n";
         echo $e->GetDetails() . "\n";
         echo $e->GetStackTrace() . "\n";
     }
-    
+
     header('Content-Type: ' . $responseType);
     echo trim($response);
-?>
\ No newline at end of file
+?>

Modified: trunk/widgets/FeatureInfo/featureinfomain.php
===================================================================
--- trunk/widgets/FeatureInfo/featureinfomain.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/FeatureInfo/featureinfomain.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -19,6 +19,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     require_once $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     require_once $fusionMGpath . 'Utilities.php';
     require_once $fusionMGpath . '/JSON.php';
     require_once 'classes/featureinfo.php';
@@ -68,7 +73,7 @@
 
         var properties = null;
         var results;
-        
+
         var reqHandler;
 
         function OnLayerChange() {
@@ -89,7 +94,7 @@
             var map = GetFusionMapWidget();
             map.clearSelection();
         }
-        
+
         function OnDigitizePoint() {
             DigitizePoint(OnPointDigitized);
         }
@@ -99,7 +104,7 @@
             var min = {x:point.X-tolerance,y:point.Y-tolerance};
             var max = {x:point.X+tolerance,y:point.Y+tolerance};
             var geom = 'POLYGON(('+ min.x + ' ' +  min.y + ', ' +  max.x + ' ' +  min.y + ', ' + max.x + ' ' +  max.y + ', ' + min.x + ' ' +  max.y + ', ' + min.x + ' ' +  min.y + '))';
-          
+
             SetSpatialFilter(geom);
         }
         function OnDigitizeRectangle() {
@@ -110,7 +115,7 @@
           var min = rectangle.Point1;
           var max = rectangle.Point2;
           var geom = 'POLYGON(('+ min.X + ' ' +  min.Y + ', ' +  max.X + ' ' +  min.Y + ', ' + max.X + ' ' +  max.Y + ', ' + min.X + ' ' +  max.Y + ', ' + min.X + ' ' +  min.Y + '))';
-        
+
           SetSpatialFilter(geom);
         }
 
@@ -138,13 +143,13 @@
 
             GetFusionMapWidget().query(options);
         }
-        
+
         function SelectionOn() {
             var layerSelect = document.getElementById("layerSelect");
             var reqParams = "SESSION=" + encodeURIComponent(session);
             reqParams += "&MAPNAME=" + encodeURIComponent(mapName);
             reqParams += "&LAYERNAME=" + encodeURIComponent(layerSelect.value);
-            
+
             if (msie)
                 reqHandler = new ActiveXObject("Microsoft.XMLHTTP");
             else
@@ -153,7 +158,7 @@
             reqHandler.onreadystatechange = OnReadyStateChange;
             reqHandler.open("POST", "featureinfocontroller.php", true);
             reqHandler.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
-            
+
             document.getElementById('totalFeatures').innerHTML = 'fetching feature info ...';
             document.getElementById('totalArea').innerHTML = ''
             document.getElementById("layerSelect").disabled = true;
@@ -161,10 +166,10 @@
             document.getElementById("rectButton").disabled = true;
             document.getElementById("polyButtton").disabled = true;
             document.getElementById("busyImg").src = BUSY_IMAGE;
-            
+
             reqHandler.send(reqParams);
         }
-        
+
         function OnReadyStateChange()
         {
             var ready = reqHandler.readyState;
@@ -174,7 +179,7 @@
                 var results = reqHandler.responseText.parseJSON();
                 if (results) {
                     var layerSelect = document.getElementById('layerSelect');
-                
+
                     var layerInfo = results[layerSelect.value];
                     if (layerInfo) {
                         var areaIdx;
@@ -198,12 +203,12 @@
                         }
                     } else {
                         document.getElementById('totalArea').innerHTML = 'no layer info';
-                    }                  
+                    }
                 } else {
                   document.getElementById('totalFeatures').innerHTML = 'no features in selected layer.';
                 }
-                
-                
+
+
                 document.getElementById("layerSelect").disabled = false;
                 document.getElementById("pointButton").disabled = false;
                 document.getElementById("rectButton").disabled = false;
@@ -228,7 +233,7 @@
             }
             OnLayerChange();
         }
-        
+
         function OnUnload() {
           var map = GetFusionMapWidget();
           map.deregisterForEvent(Fusion.Event.MAP_SELECTION_ON, SelectionOn);

Modified: trunk/widgets/Measure/Measure.php
===================================================================
--- trunk/widgets/Measure/Measure.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Measure/Measure.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -23,16 +23,21 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
- 
+
   $fusionMGpath = '../../layers/MapGuide/php/';
   include $fusionMGpath . 'Common.php';
+  if(InitializationErrorOccurred())
+  {
+      DisplayInitializationErrorHTML();
+      exit;
+  }
   SetLocalizedFilesPath(GetLocalizationPath());
   if(isset($_REQUEST['locale'])) {
     $locale = $_REQUEST['locale'];
   } else {
     $locale = GetDefaultLocale();
   }
-  
+
   $type = $_REQUEST['type'];
   switch ($type) {
       case 1:

Modified: trunk/widgets/Print/printablepage.php
===================================================================
--- trunk/widgets/Print/printablepage.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Print/printablepage.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -19,6 +19,11 @@
 
 $fusionMGpath = '../../layers/MapGuide/php/';
 include $fusionMGpath . 'Common.php';
+if(InitializationErrorOccurred())
+{
+    DisplayInitializationErrorHTML();
+    exit;
+}
 
     $locale = "en";
     $mapName = "";

Modified: trunk/widgets/Query/querycontroller.php
===================================================================
--- trunk/widgets/Query/querycontroller.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Query/querycontroller.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -19,6 +19,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     require_once $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     require_once $fusionMGpath . 'Utilities.php';
     require_once $fusionMGpath . 'JSON.php';
     require_once 'classes/query.php';
@@ -26,7 +31,7 @@
     $args = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET;
 
     // MgInitializeWebTier($configFilePath);
-    
+
     try {
 
       $query = new Query($args);
@@ -79,4 +84,4 @@
     <tr><td class="Title">Error<hr></td></tr>
     <tr><td><?= $errorMsg ?></td></tr>
     <tr><td><?= $errorDetail ?></td></tr>
-</table>
\ No newline at end of file
+</table>

Modified: trunk/widgets/Query/querymain.php
===================================================================
--- trunk/widgets/Query/querymain.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Query/querymain.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -19,6 +19,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     require_once $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     require_once $fusionMGpath . 'Utilities.php';
     require_once $fusionMGpath . '/JSON.php';
     require_once 'classes/query.php';

Modified: trunk/widgets/Search/Search.php
===================================================================
--- trunk/widgets/Search/Search.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Search/Search.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -29,6 +29,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     include $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
 
     //$logHandle = fopen("debug.log","at");
 

Modified: trunk/widgets/Search/SearchPrompt.php
===================================================================
--- trunk/widgets/Search/SearchPrompt.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Search/SearchPrompt.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -26,6 +26,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     include $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
 
     $locale = GetDefaultLocale();
     $popup = 0;

Modified: trunk/widgets/SelectWithin/SelectWithin.php
===================================================================
--- trunk/widgets/SelectWithin/SelectWithin.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/SelectWithin/SelectWithin.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -26,6 +26,11 @@
 
   $fusionMGpath = '../../layers/MapGuide/php/';
   include $fusionMGpath . 'Common.php';
+  if(InitializationErrorOccurred())
+  {
+      DisplayInitializationErrorText();
+      exit;
+  }
   include $fusionMGpath . 'Utilities.php';
   include('../../common/php/Utilities.php');
 
@@ -43,7 +48,7 @@
     //load the map runtime state
     $map = new MgMap();
     $map->Open($resourceService, $mapName);
-    
+
     //object to hold response
     $result = NULL;
     $result->hasSelection = false;
@@ -59,7 +64,7 @@
       for ($i = 0; $i < count($layers); $i++) {
         $layerNames->Add($layers[$i]);
       }
-      
+
       // create a multi-polygon or a multi-geometry containing the input selected features
       $inputGeom = MultiGeometryFromSelection($featureSrvc, $resourceService, $map, $mapName);
       if ($inputGeom) {
@@ -69,15 +74,15 @@
           $resultSel = $fi->GetSelection();
           if( $resultSel) {
             $resultSel->Save($resourceService, $mapName);
-            
+
             //this needs to be re-opened for some reason
             $resultSel = new MgSelection($map);
             $resultSel->Open($resourceService, $mapName);
-	  
+
             $layers = $resultSel->GetLayers();
             if ($layers && $layers->GetCount() >= 0) {
               $result->hasSelection = true;
-              
+
               //set the extents for the selection object
               $oExtents = $resultSel->GetExtents($featureSrvc);
               if ($oExtents) {
@@ -96,7 +101,7 @@
                 $properties->extents->maxx = $oMax->GetX();
                 $properties->extents->maxy = $oMax->GetY();
               } else { echo "/* no extents */"; }
-              
+
               //get properties for individual features
               $result->layers = array();
               for ($i=0; $i<$layers->GetCount(); $i++) {
@@ -116,13 +121,13 @@
               }
 
               /*save selection in the session*/
-              $_SESSION['selection_array'] = $properties; 
+              $_SESSION['selection_array'] = $properties;
             } else { echo "/* layers false or 0 */"; }
           } else { echo "/* no resultsel */"; }
         } else { echo "/* no fi */"; }
       } else { echo "/*no multi geom*/"; }
     } else { echo "/* no layers */"; }
-    
+
     header('Content-type: application/json');
     header('X-JSON: true');
     echo var2json($result);

Modified: trunk/widgets/SelectWithin/SelectWithinPanel.php
===================================================================
--- trunk/widgets/SelectWithin/SelectWithinPanel.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/SelectWithin/SelectWithinPanel.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -26,6 +26,11 @@
 
     $fusionMGpath = '../../layers/MapGuide/php/';
     include $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
 
     $locale = GetDefaultLocale();
     $popup = "";

Modified: trunk/widgets/Theme/themecontroller.php
===================================================================
--- trunk/widgets/Theme/themecontroller.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Theme/themecontroller.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -18,6 +18,11 @@
 //
     $fusionMGpath = '../../layers/MapGuide/php/';
     require_once $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     require_once $fusionMGpath . 'Utilities.php';
     require_once $fusionMGpath . 'JSON.php';
     require_once 'classes/theme.php';
@@ -55,7 +60,7 @@
         header('Content-Type: ' . $responseType);
         echo $response;
         exit;
-      }     
+      }
       catch (MgException $mge)
       {
           $errorMsg = $mge->GetMessage();
@@ -70,4 +75,4 @@
     <tr><td class="Title">Error<hr></td></tr>
     <tr><td><?= $errorMsg ?></td></tr>
     <tr><td><?= $errorDetail ?></td></tr>
-</table>
\ No newline at end of file
+</table>

Modified: trunk/widgets/Theme/thememain.php
===================================================================
--- trunk/widgets/Theme/thememain.php	2009-10-26 15:48:18 UTC (rev 1952)
+++ trunk/widgets/Theme/thememain.php	2009-10-26 16:17:47 UTC (rev 1953)
@@ -18,6 +18,11 @@
 //
     $fusionMGpath = '../../layers/MapGuide/php/';
     require_once $fusionMGpath . 'Common.php';
+    if(InitializationErrorOccurred())
+    {
+        DisplayInitializationErrorHTML();
+        exit;
+    }
     require_once $fusionMGpath . 'Utilities.php';
     require_once $fusionMGpath . 'JSON.php';
     require_once 'classes/theme.php';
@@ -443,7 +448,7 @@
     <tr><td colspan="2" align="right"><input class="Ctrl" type="button" value="Apply" style="width: 60px;" onClick="ApplyTheme()"></td></tr>
 </table>
 
-<?php } else if ($errorDetail == null || (strlen($errorDetail) - strlen($errorMsg) < 5)) { ?> 
+<?php } else if ($errorDetail == null || (strlen($errorDetail) - strlen($errorMsg) < 5)) { ?>
 
 <table class="RegText" border="0" cellspacing="0" width="100%%">
     <tr><td class="Title">Error<hr></td></tr>



More information about the fusion-commits mailing list