[mapguide-commits] r6231 - in trunk/MgDev/Web/src/mapadmin: . images

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Nov 17 01:31:01 EST 2011


Author: liuar
Date: 2011-11-16 22:31:01 -0800 (Wed, 16 Nov 2011)
New Revision: 6231

Modified:
   trunk/MgDev/Web/src/mapadmin/images/warning.png
   trunk/MgDev/Web/src/mapadmin/performanceReport.php
   trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php
   trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
   trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php
   trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php
   trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php
Log:
On behalf of Ted Yang.
fix the ticket 1768: http://trac.osgeo.org/mapguide/ticket/1768
	
The submission is mainly add error handling for performance report and fixed some UI defects:
1. While profing the map, there will be errors if something wrong, so we must display the error message
2. fix the problem that Apache+Jave will fail to open the "select setting" dialogue 
3. fix the problem that error message will not disapper when user click the "Recent Settings" to enter correct values
4. fix the problem when export the profing data, the format of scale will be recognized as time

Modified: trunk/MgDev/Web/src/mapadmin/images/warning.png
===================================================================
(Binary files differ)

Modified: trunk/MgDev/Web/src/mapadmin/performanceReport.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport.php	2011-11-17 05:47:09 UTC (rev 6230)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport.php	2011-11-17 06:31:01 UTC (rev 6231)
@@ -300,7 +300,7 @@
             padding-right: 20px;
             cursor:default;
         }
-
+        
         .warnMsgStyle
         {
             border-color: red;
@@ -348,7 +348,7 @@
             top: 400px;
             left: 400px;
         }
-
+        
         #ResultNotMatchWrn
         {
             border: 2px solid #CCCCCC;
@@ -358,6 +358,26 @@
             display: none;
             width: auto;
         }
+
+        .errorMessage
+        {
+            border: 2px solid #CCCCCC;
+            background: #FFFEBB url('images/warning.png') no-repeat 1px 1px;
+            margin-top: 20px;
+            padding: 4px 5px 5px 32px;
+            width: auto;
+        }
+
+        .wrnMessage
+        {
+            padding:5px 15px 5px 15px;
+            display:none;
+            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#EEEEEE\', endColorstr=\'#BBBBBB\');
+            background: #CCCCCC;
+            background: -moz-linear-gradient(top, #EEEEEE, #BBBBBB);
+            background: -webkit-gradient(linear, left top, left bottom, from(#EEEEEE), to(#BBBBBB));
+        }
+
     </style>
     </div>
     <script type="text/javascript">
@@ -851,7 +871,6 @@
         //we set the width and height as 0, and border as none,
         //it works well in IE9 and firefox, but in chrome and safari,
         //if the border set as none, this event will not be fired.
-        //TODO:Multiple Browsers:Safari and Chrome not work,So this event handler is not registered
         function MapViewerKeyUp(event)
         {
             if(event.keyCode == 13)
@@ -1442,7 +1461,8 @@
 
                     //make the layer table default sorting
                     var layerTableHeader = document.getElementById("layerHeaderTable");
-                    SortLayers.sortByColumn(layerTableHeader.tHead.rows[0].children[0]);
+                    SortLayers.sortByColumn(layerTableHeader.tHead.rows[0].children[1]);
+                    SortLayers.sortByColumn(layerTableHeader.tHead.rows[0].children[1]);
                 }
             }
         }
@@ -1594,11 +1614,23 @@
             }
             
             var j = 0;
-            for (;j < tableRow.cells.length; j++)
+            var errorStatus = tableRow.getAttribute("errorstatus");
+            if(errorStatus == "0")
             {
-                var obj = tableRow.cells[j];
-                obj.style.backgroundColor = "#b4c6de";
+                for (;j < tableRow.cells.length; j++)
+                {
+                    var obj = tableRow.cells[j];
+                    obj.style.backgroundColor = "#b4c6de";
+                }
             }
+            else
+            {
+                for (;j < tableRow.cells.length; j++)
+                {
+                    var obj = tableRow.cells[j];
+                    obj.style.backgroundColor = "red";
+                }
+            }
 
             var layersTable = document.getElementById("layerResultsTable");
             var allRows = layersTable.tBodies[0].rows;
@@ -1617,11 +1649,23 @@
                     }
                     
                     var m = 0;
-                    for (;m < lastSelectedRow.cells.length; m++)
+                    var errorStatus = lastSelectedRow.getAttribute("errorstatus");
+                    if(errorStatus == "0")
                     {
-                        var obj = lastSelectedRow.cells[m];
-                        obj.style.backgroundColor = "";
+                        for (;m < lastSelectedRow.cells.length; m++)
+                        {
+                            var obj = lastSelectedRow.cells[m];
+                            obj.style.backgroundColor = "";
+                        }
                     }
+                    else
+                    {
+                        for (;m < lastSelectedRow.cells.length; m++)
+                        {
+                            var obj = lastSelectedRow.cells[m];
+                            obj.style.backgroundColor = "#FFFEBB";
+                        }
+                    }
                     
                     lastSelectedRow.setAttribute("rowselected","false");
                 }
@@ -1640,12 +1684,22 @@
         //2) add "var" before the varibale name, var layerInfoDetail =document.getElementById("layerInfoDetail");
         function DisplayLayerDetail(layerDetail)
         {                    
-            var layerDetailContent='<div style="padding-bottom: 8px; padding-top: 7px; width: 80%;">' + layerDetail[0] + '</div>'+ "\n";
-            layerDetailContent+='<div style=" border: 1px solid #cccccc; width: 80%">';
-            layerDetailContent+='<div style="padding: 10px;">';
-            layerDetailContent+="<b>Filter</b>";
-            layerDetailContent+="<br/><br/>";
+            var layerDetailContent = '<div style="padding-bottom: 8px; padding-top: 7px; width: 80%;">' + layerDetail[0] + '</div>'+ "\n";
+            layerDetailContent += '<div style=" border: 1px solid #cccccc; width: 80%">';
 
+            if( "" != Trim(layerDetail[3]) )
+            {
+                layerDetailContent += '<div style="padding: 10px; background-color:#FFFEBB;">';
+                layerDetailContent += "<span style='font-weight:bold;'>Details</span>";
+                layerDetailContent += "<br/><br/>";
+                layerDetailContent += layerDetail[3];
+                layerDetailContent += "</div>";
+            }
+
+            layerDetailContent += '<div style="padding: 10px;">';
+            layerDetailContent += "<span style='font-weight:bold;'>Filter</span>";
+            layerDetailContent += "<br/><br/>";
+
             //If no filter was applied, then "No filter was applied to this layer." is displayed.
             if( "" == Trim(layerDetail[1]) )
             {
@@ -1656,13 +1710,13 @@
                 layerDetailContent += layerDetail[1];
             }
 
-            layerDetailContent+="</div>";
-            layerDetailContent+='<div style=" background-color: #EEEEEE;padding: 10px;">';
-            layerDetailContent+="<b>Scale Range</b>";
-            layerDetailContent+="<br/><br/>";
-            layerDetailContent+=layerDetail[2];
-            layerDetailContent+="</div>"+ "\n";
-            layerDetailContent+="</div>"+"\n";
+            layerDetailContent += "</div>";
+            layerDetailContent += '<div style=" background-color: #EEEEEE;padding: 10px;">';
+            layerDetailContent += "<span style='font-weight:bold;'>Scale Range</span>";
+            layerDetailContent += "<br/><br/>";
+            layerDetailContent += layerDetail[2];
+            layerDetailContent += "</div>" + "\n";
+            layerDetailContent += "</div>" + "\n";
 
             //remove the layer detail info if it already exist
             var layerInfo = document.getElementById("layerDetailContentDiv");
@@ -2010,9 +2064,11 @@
 
                 var centerPoint = document.getElementById("txtCenterPoint");
                 centerPoint.value = selectSetting[2];
+                ValidateCenterPoint(false);
 
                 var scaleInput = document.getElementById("txtScale");
                 scaleInput.value = FormatNumber(selectSetting[3],4);
+                ValidateScale(false);
 
                 var tipDiv = document.getElementById("mapResourceNameTip");
                 tipDiv.innerHTML = mapDefinitonSelector.value;
@@ -2070,6 +2126,8 @@
                     echo "</span>";
                 }
             ?>
+        <div>
+        </div>
             <div id="settingsContent">
                 <table style="width:100%;">
                     <tr>

Modified: trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php	2011-11-17 05:47:09 UTC (rev 6230)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php	2011-11-17 06:31:01 UTC (rev 6231)
@@ -14,7 +14,8 @@
 
     function ReplaceCSVSpecialChar($value)
     {
-        $newValue = str_replace("\"", "\"\"", $value);
+        $newValue = trim($value);
+        $newValue = str_replace("\"", "\"\"", $newValue);
         return "\"".$newValue."\"";
     }
 
@@ -47,8 +48,17 @@
         exit(0);
     }
 
+    //construct a readable file name
+    $tempMapName = strrchr($mapProfileResult->MapProfileData->MapResourceId, '/');
+    $tempMapName = substr($tempMapName, 1, strlen($tempMapName) - 15);
+    $Date = date("Y-m-d_His");
+    $Filename = $Date."_".$tempMapName.".csv";
+
+    header("Content-type:application/vnd.ms-excel");
+    header("Content-Disposition:filename=".$Filename);
+
     //add one line gap
-    echo "\n";
+    $outSCVContent = "\n";
 
     //output the basic information of the map resource
     //get the extent display string
@@ -56,70 +66,87 @@
     $extents= '"MinX:' . $x1 . '    MinY:' . $y1.'    MaxX:' . $x2 . '    MaxY:' . $y2.'"';
 
     //get the scale display string
-    $scale= "1:" . number_format($mapProfileResult->MapProfileData->Scale,4,"."," ");
+    $scale= "[1: " .number_format($mapProfileResult->MapProfileData->Scale,4,"."," ")."]";
 
     //get the center point display string
     list($centerPointX, $centerPointY) = explode("*", $_REQUEST["centerPoint"]);
     $centerPoint= '"X:'.trim($centerPointX).'    Y:'.trim($centerPointY).'"';
 
     //export the map information
-    echo '"Resource Name",'.$mapProfileResult->MapProfileData->MapResourceId;
-    echo ',"Data Extents",'.$extents,"\n";
-    echo '"Base Layers",'.$mapProfileResult->MapProfileData->BaseLayerCount.',"Image Format",';
-    echo $mapProfileResult->MapProfileData->ImageFormat,"\n";
-    echo '"Center Point",'.$centerPoint.',Layers,';
-    echo $mapProfileResult->MapProfileData->LayerCount,"\n";
-    echo '"Coordinate System",'.ReplaceCSVSpecialChar($mapProfileResult->MapProfileData->CoordinateSystem);
-    echo ',"Render Type",'.$mapProfileResult->MapProfileData->RenderType,"\n";
-    echo 'Scale,'.$scale,"\n";
+    $outSCVContent .=  '"Resource Name",'.$mapProfileResult->MapProfileData->MapResourceId;
+    $outSCVContent .= ',"Data Extents",'.$extents."\n";
+    $outSCVContent .= '"Base Layers",'.$mapProfileResult->MapProfileData->BaseLayerCount.',"Image Format",';
+    $outSCVContent .= $mapProfileResult->MapProfileData->ImageFormat."\n";
+    $outSCVContent .= '"Center Point",'.$centerPoint.',Layers,';
+    $outSCVContent .= $mapProfileResult->MapProfileData->LayerCount."\n";
+    $outSCVContent .= '"Coordinate System",'.ReplaceCSVSpecialChar($mapProfileResult->MapProfileData->CoordinateSystem);
+    $outSCVContent .= ',"Render Type",'.$mapProfileResult->MapProfileData->RenderType."\n";
+    $outSCVContent .= 'Scale,'.$scale."\n";
 
     //add two lines gap to divide the information into different sections
-    echo "\n";
-    echo "\n";
+    $outSCVContent .= "\n";
+    $outSCVContent .= "\n";
 
     //output the render time information
-    echo '"Total Generation Time:","'.$mapProfileResult->MapProfileData->TotalMapRenderTime . ' ms"',"\n";
+    $outSCVContent .= '"Total Generation Time:","'.$mapProfileResult->MapProfileData->TotalMapRenderTime . ' ms"'."\n";
 
-    echo '"Layers ","'.$mapProfileResult->MapProfileData->TotalLayerRenderTime . ' ms",';
-    echo $mapProfileResult->MapProfileData->GetLayerRenderPercent() .'%',"\n";
+    $outSCVContent .= '"Layers ","'.$mapProfileResult->MapProfileData->TotalLayerRenderTime . ' ms",';
+    $outSCVContent .= $mapProfileResult->MapProfileData->GetLayerRenderPercent() .'%'."\n";
 
-    echo '"Labels ","'.$mapProfileResult->MapProfileData->TotalLabelRenderTime . ' ms",';
-    echo $mapProfileResult->MapProfileData->GetLabelRenderPercent() .'%',"\n";
+    $outSCVContent .= '"Labels ","'.$mapProfileResult->MapProfileData->TotalLabelRenderTime . ' ms",';
+    $outSCVContent .= $mapProfileResult->MapProfileData->GetLabelRenderPercent() .'%'."\n";
 
-    echo '"Watermarks ","'.$mapProfileResult->MapProfileData->TotalWatermarkRenderTime . ' ms",';
-    echo $mapProfileResult->MapProfileData->GetWartermarkRenderPercent() .'%',"\n";
+    $outSCVContent .= '"Watermarks ","'.$mapProfileResult->MapProfileData->TotalWatermarkRenderTime . ' ms",';
+    $outSCVContent .= $mapProfileResult->MapProfileData->GetWartermarkRenderPercent() .'%'."\n";
 
-    echo '"Images ","'.$mapProfileResult->MapProfileData->TotalImageRenderTime . ' ms",';
-    echo $mapProfileResult->MapProfileData->GetImageRenderPercent() .'%',"\n";
+    $outSCVContent .= '"Images ","'.$mapProfileResult->MapProfileData->TotalImageRenderTime . ' ms",';
+    $outSCVContent .= $mapProfileResult->MapProfileData->GetImageRenderPercent() .'%'."\n";
 
-    echo '"Other ","'.$mapProfileResult->MapProfileData->GetOtherRenderTime() . ' ms",';
-    echo $mapProfileResult->MapProfileData->GetOthersRenderPercent() .'%',"\n";
-    
+    $outSCVContent .= '"Other ","'.$mapProfileResult->MapProfileData->GetOtherRenderTime() . ' ms",';
+    $outSCVContent .= $mapProfileResult->MapProfileData->GetOthersRenderPercent() .'%'."\n";
+
     //add two lines gap to divide the information into different sections
-    echo "\n";
-    echo "\n";
+    $outSCVContent .= "\n";
+    $outSCVContent .= "\n";
 
+    if(isset($mapProfileResult->MapProfileData->MapErrorMessage))
+    {
+        $outSCVContent .= "\"Errors occurred while rendering the map:\",";
+        $outSCVContent .= ReplaceCSVSpecialChar($mapProfileResult->MapProfileData->MapErrorMessage)."\n";
+    }
+
+    if(isset($mapProfileResult->MapProfileData->WatermarksErrorMessage))
+    {
+        $outSCVContent .= "\"Errors occurred while rendering watermarks:\",";
+
+        $outSCVContent .= ReplaceCSVSpecialChar(trim($mapProfileResult->MapProfileData->WatermarksErrorMessage,'\n'))."\n";
+    }
+
+    if(isset($mapProfileResult->MapProfileData->LabelsErrorMessage))
+    {
+        $outSCVContent .= "\"Errors occurred while rendering Labels:\",";
+        $outSCVContent .= ReplaceCSVSpecialChar($mapProfileResult->MapProfileData->LabelsErrorMessage)."\n";
+    }
+
+    //add two lines gap to divide the information into different sections
+    $outSCVContent .= "\n";
+    $outSCVContent .= "\n";
+
     //output the detailed information of each layer
-    echo 'Layer,"Render Time","Feature Class","Coordinate System",Type,Filter,"Scale Range"',"\n";
+    $outSCVContent .= 'Layer,"Render Time","Feature Class","Coordinate System",Type,Filter,"Scale Range","Inner Exception Message"'."\n";
 
     foreach ($mapProfileResult->LayerProfileData->LayerProfileDataCollection as $layerProfileData)
     {
-        echo '"'.$layerProfileData->LayerName.'",' ;
-        echo '"'.$layerProfileData->TotalRenderTime.' ms",' ;
-        echo ReplaceCSVSpecialChar($layerProfileData->FeatureClass) .',';
-        echo ReplaceCSVSpecialChar($layerProfileData->CoordinateSystem) .',';
-        echo '"'.$layerProfileData->LayerType.'",' ;
-        echo ReplaceCSVSpecialChar($layerProfileData->Filters).',' ;
-        echo '"'.$layerProfileData->ScaleRange.'"' ;
-        echo "\n";
+        $outSCVContent .= '"'.$layerProfileData->LayerName.'",' ;
+        $outSCVContent .= '"'.$layerProfileData->TotalRenderTime.' ms",' ;
+        $outSCVContent .= ReplaceCSVSpecialChar($layerProfileData->FeatureClass) .',';
+        $outSCVContent .= ReplaceCSVSpecialChar($layerProfileData->CoordinateSystem) .',';
+        $outSCVContent .= '"'.$layerProfileData->LayerType.'",' ;
+        $outSCVContent .= ReplaceCSVSpecialChar($layerProfileData->Filters).',' ;
+        $outSCVContent .= '"'.$layerProfileData->ScaleRange.'",' ;
+        $outSCVContent .= ReplaceCSVSpecialChar($layerProfileData->ErrorMessage) ;
+        $outSCVContent .= "\n";
     }
 
-    //construct a readable file name
-    $tempMapName = strrchr($mapProfileResult->MapProfileData->MapResourceId, '/');
-    $tempMapName = substr($tempMapName, 1, strlen($tempMapName) - 15);
-    $Date = date("Y-m-d_His");
-    $Filename = $Date."_".$tempMapName.".csv";
-
-    header("Content-type:application/vnd.ms-excel");
-    header("Content-Disposition:filename=".$Filename);
+    print $outSCVContent;
 ?>
\ No newline at end of file

Modified: trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php	2011-11-17 05:47:09 UTC (rev 6230)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php	2011-11-17 06:31:01 UTC (rev 6231)
@@ -397,6 +397,14 @@
         </td>
     </tr>
     <tr>
+        <td colspan="2">
+            <?php
+                $displayManager->OutputErrorMessage();
+            ?>
+            
+        </td>
+    </tr>
+    <tr>
         <td colspan="2" style="padding-top:20px; padding-left: 15px;">
             <?php
                 echo "<span>";
@@ -444,7 +452,7 @@
 <div id="LayersResult">
     <table style=" width:100%;">
         <tr>
-            <td style="width:70%; padding-top: 15px;">
+            <td style="width:70%; padding-top: 15px; vertical-align: top;">
                 <div id="layerHeader" class="layerResultsHeaderStyle" style="margin:0px; padding: 0px;">
                     <table id="layerHeaderTable">
                         <thead>
@@ -452,10 +460,10 @@
                             <!--Also, the table head columns are set with some customer attribute to help to sort the table data from the client site-->
                             <tr>
                                 <th style="width:20%;border-left:1px solid #CCCCCC;" columnIndex="1" onClick="SortLayers.sortByColumn(this);">Layer</th>
-                                <th style="width:15%;" columnIndex="2" onClick="SortLayers.sortByColumn(this);">Render Time</th>
+                                <th style="width:17%;" columnIndex="2" onClick="SortLayers.sortByColumn(this);">Render Time</th>
                                 <th style="width:30%;" columnIndex="3" onClick="SortLayers.sortByColumn(this);">Feature Class</th>
-                                <th style="width:22%;" columnIndex="4" onClick="SortLayers.sortByColumn(this);">Coordinate System</th>
-                                <th style="width:13%;border-right:1px solid #CCCCCC;" columnIndex="5" onClick="SortLayers.sortByColumn(this);">Type</th>
+                                <th style="width:21%;" columnIndex="4" onClick="SortLayers.sortByColumn(this);">Coordinate System</th>
+                                <th style="width:12%;border-right:1px solid #CCCCCC;" columnIndex="5" onClick="SortLayers.sortByColumn(this);">Type</th>
                             </tr>
                         </thead>
                     </table>

Modified: trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php	2011-11-17 05:47:09 UTC (rev 6230)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php	2011-11-17 06:31:01 UTC (rev 6231)
@@ -40,8 +40,14 @@
     //pass the seesion ID with the url, so when the map viewer is opened, there is no need to re-enter the password
     $ajaxViewerFolder = "mapviewerajax/?";
 
-    //uncomment this line for Java API.
-    //$ajaxViewerFolder = "mapviewerjava/ajaxviewer.jsp?";
+    //when user installed the ajax java viewer, the apache will add a redict
+    //from mapviewerajax to mapviewerjava, and change the relative path to absolute path
+    //which casues the cross-domain problem
+    //now we check if we install the ajax java, then use the "mapviewerjava/ajaxviewer.jsp?" directly to avoid this problem
+    if(file_exists("../mapviewerjava/ajaxviewer.jsp"))
+    {
+        $ajaxViewerFolder = "mapviewerjava/ajaxviewer.jsp?";
+    }
     
     $webLayoutUrl="../".$ajaxViewerFolder."WEBLAYOUT=".urlencode($webLayoutName)."&LOCALE=en&SESSION=".$site->GetCurrentSession();
 

Modified: trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php	2011-11-17 05:47:09 UTC (rev 6230)
+++ trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php	2011-11-17 06:31:01 UTC (rev 6231)
@@ -2181,29 +2181,43 @@
             $sumofRenderTime = $this->mapProfileResult->LayerProfileData->GetSumOfLayerRenderTime();
             foreach ($this->mapProfileResult->LayerProfileData->LayerProfileDataCollection as $layerProfileData)
             {
-                //TODO:workaround for FDO read layer Exception
-                if(trim($layerProfileData->LayerName) == "")
-                    continue;
+                $backgroundColor="";
 
                 //set different colors for alternate rows and when mouse move over the row it will change color
                 if(0 == $rowNumber%2)
                 {
-                    echo '<tr class="even" rowselected="false" onclick="LayerDataTableRowClicked(\''.$layerProfileData->LayerName.'\',this);">',"\n";
+                    if(trim($layerProfileData->ErrorMessage) != "")
+                    {
+                       echo '<tr rowselected="false"  errorstatus="1"  onclick="LayerDataTableRowClicked(\''.$layerProfileData->LayerName.'\',this);">',"\n";
+                       $backgroundColor = "background-color:#FFFEBB;";
+                    }
+                    else
+                    {
+                        echo '<tr class="even" rowselected="false"  errorstatus="0"  onclick="LayerDataTableRowClicked(\''.$layerProfileData->LayerName.'\',this);">',"\n";
+                    }
                 }
                 else
                 {
-                    echo '<tr class="odd" rowselected="false" onclick="LayerDataTableRowClicked(\''.$layerProfileData->LayerName.'\',this);">',"\n";
+                    if(trim($layerProfileData->ErrorMessage) != "")
+                    {
+                        echo '<tr rowselected="false" errorstatus="1" onclick="LayerDataTableRowClicked(\''.$layerProfileData->LayerName.'\',this);">',"\n";
+                        $backgroundColor = "background-color:#FFFEBB;";
+                    }
+                    else
+                    {
+                        echo '<tr class="odd" rowselected="false"  errorstatus="0"  onclick="LayerDataTableRowClicked(\''.$layerProfileData->LayerName.'\',this);">',"\n";
+                    }
                 }
 
                 //output the layer profiling information by each column,
                 //for the render time column, we set the sort key as the original number, which will be used as client sort
-                echo "<td style='width:20%;'>".$layerProfileData->LayerName."</td>","\n";
-                echo "<td style='width:15%;' sortKey='".number_format($layerProfileData->TotalRenderTime,2)."'>".
+                echo "<td style='width:20%;$backgroundColor'>".$layerProfileData->LayerName."</td>","\n";
+                echo "<td style='width:17%;$backgroundColor' sortKey='".number_format($layerProfileData->TotalRenderTime,2)."'>".
                         number_format($layerProfileData->TotalRenderTime,2)."&nbsp;ms&nbsp;(".
                         $layerProfileData->GetRenderTimePercentage($sumofRenderTime)."%)&nbsp;</td>","\n";
-                echo "<td style='width:30%;'>".$layerProfileData->FeatureClass."</td>","\n";
-                echo "<td style='width:22%;'>".$layerProfileData->CoordinateSystem."</td>","\n";
-                echo "<td style='width:13%;'>".$layerProfileData->LayerType."</td>","\n";
+                echo "<td style='width:30%;$backgroundColor'>".$layerProfileData->FeatureClass."</td>","\n";
+                echo "<td style='width:21%;$backgroundColor'>".$layerProfileData->CoordinateSystem."</td>","\n";
+                echo "<td style='width:12%;$backgroundColor'>".$layerProfileData->LayerType."</td>","\n";
                 echo "</tr>","\n";
 
                 $rowNumber++;
@@ -2242,11 +2256,19 @@
                 //the js script should not contain special char will will break the code
                 $newFilters = str_replace("'", "\'", $newFilters);
 
-                $script = $script." layerDetailValues[".$i."]=new Array(3); ";
-                $script = $script." layerDetailValues[".$i."][0]='".$value->LayerName."'; ";
-                $script = $script." layerDetailValues[".$i."][1]='".$newFilters."'; ";
-                $script = $script." layerDetailValues[".$i."][2]='".$value->ScaleRange."'; ";
-               
+                $newErrorMessage = "";
+                if($value->ErrorMessage != null)
+                {
+                    $str = trim($value->ErrorMessage);
+                    $newErrorMessage = str_replace($order, $replace, $str);
+                    $newErrorMessage = str_replace("'", "\'", $newErrorMessage);
+                }
+
+                $script .= " layerDetailValues[$i]=new Array(3); ";
+                $script .= " layerDetailValues[$i][0]='$value->LayerName'; ";
+                $script .= " layerDetailValues[$i][1]='$newFilters'; ";
+                $script .= " layerDetailValues[$i][2]='$value->ScaleRange'; ";
+                $script .= " layerDetailValues[$i][3]='$newErrorMessage'; ";
                 $i++;
             }
 
@@ -2296,7 +2318,6 @@
             echo '</td>',"\n";
         }
 
-
         public function OutputMapResourceNameWithToolTip($mapResourceID,$IsSetting)
         {
             $mapResourceID = trim($mapResourceID);
@@ -2379,6 +2400,74 @@
                 echo "</tr></table></td></tr></table>","\n";
             }
         }
+
+        public function OutputErrorMessage()
+        {
+            $hasError = false;
+            $onlyLayerError = true;
+            $errorMessage;
+            $errorDetail;
+
+            if(isset($this->mapProfileResult->MapProfileData->MapErrorMessage))
+            {
+                $hasError = true;
+                $onlyLayerError = false;
+                $errorMessage.="Errors occurred while rendering the map.<br/>";
+                $errorDetail.= "Map:".$this->mapProfileResult->MapProfileData->MapErrorMessage."<br/>";
+            }
+
+            if(isset($this->mapProfileResult->MapProfileData->WatermarksErrorMessage))
+            {
+                $hasError = true;
+                $onlyLayerError = false;
+                $errorMessage.="Errors occurred while rendering watermarks.<br/>";
+                $errorDetail.= "Watermarks:".$this->mapProfileResult->MapProfileData->WatermarksErrorMessage."<br/>";
+            }
+
+            if(isset($this->mapProfileResult->MapProfileData->LabelsErrorMessage))
+            {
+                $hasError = true;
+                $onlyLayerError = false;
+                $errorMessage.="Errors occurred while rendering labels.<br/>";
+                $errorDetail.= "Labels:".$this->mapProfileResult->MapProfileData->LabelsErrorMessage."<br/>";
+            }
+
+            if($this->mapProfileResult->LayerProfileData->HasErrors > 0)
+            {
+                $hasError = true;
+                $errorMessage.= 'Errors occurred while rendering layers. The layers that failed are highlighted in the table below.<br/>';
+            }
+            
+            if($hasError)
+            {
+               echo '<div class="errorMessage">';
+               echo '<span style="font-size:10pt; font-weight: bold;">';
+               echo $errorMessage."Check the details in the server log.<br/>";
+               echo '</span>';
+               
+               if(!$onlyLayerError)
+               {
+                   echo '<div id="errorMessageCaption">';
+                   echo '<table>';
+                   echo '<tr>';
+                   echo '<td style=" width: 8px;">';
+                   echo '<img src="images/arrow_left.png" alt="left" style="cursor:pointer;"';
+                   echo 'id="errors_CollapseImage_ID" onclick="CollapsibleTabClick(\'errors_CollapseImage_ID\',\'errorsContent\')"/>';
+                   echo '</td>';
+                   echo '<td style="font-size:10pt; font-weight:bold; color:#000000; text-align: left;"  >';
+                   echo '<span style="cursor:pointer;" onclick="CollapsibleTabClick(\'errors_CollapseImage_ID\',\'errorsContent\')">Details</span>';
+                   echo '</td>';
+                   echo  '</tr>';
+                   echo '</table>';
+                   echo '</div>';
+                   echo '<div id="errorsContent" class="wrnMessage">';
+                   echo $errorDetail;
+                   echo '</div>';
+               }
+
+               echo '</div>';
+            }
+        }
     }
     
 ?>

Modified: trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php	2011-11-17 05:47:09 UTC (rev 6230)
+++ trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php	2011-11-17 06:31:01 UTC (rev 6231)
@@ -2552,6 +2552,9 @@
         public $LayerType;
         public $Filters;
         public $ScaleRange;
+        //if exception happened when profiling layer, the error mesage will be saved here,
+        //if the $ErrorMessage is empty or null, it means no error happened
+        public $ErrorMessage;
 
         public function GetRenderTimePercentage($sumofRenderTime)
         {
@@ -2572,6 +2575,8 @@
         // which consist the profiling map layers info
         public $LayerProfileDataCollection;
 
+        public $HasErrors;
+
         //get the sum of each layer render time
         //note that this sum can be different with the $TotalLayerRenderTime
         public function GetSumOfLayerRenderTime()
@@ -2605,6 +2610,10 @@
         public $Scale;
         public $RenderType;
 
+        public $LabelsErrorMessage;
+        public $WatermarksErrorMessage;
+        public $MapErrorMessage;
+
         public function GetTotalRenderTime()
         {
             return $this->TotalLayerRenderTime+$this->TotalLabelRenderTime
@@ -2652,6 +2661,11 @@
         public function ReadFromXML($resultSource)
         {
             $this->MapProfileData = new MapDefinitionProfileData();
+
+            $this->MapProfileData->MapErrorMessage = null;
+            $this->MapProfileData->LabelsErrorMessage = null;
+            $this->MapProfileData->WatermarksErrorMessage = null;
+
             $mapResultList = $resultSource->documentElement->getElementsByTagName("ProfileRenderMapResult");
             $profileRenderMap = $mapResultList->item(0);
 
@@ -2709,6 +2723,11 @@
                                     {
                                         $this->MapProfileData->TotalLabelRenderTime = $labelNode->nodeValue;
                                     }
+                                    //if profiling labels has exception, save the error message here
+                                    if ($labelNode->nodeType == 1 && $labelNode->nodeName == "Error")
+                                    {
+                                        $this->MapProfileData->LabelsErrorMessage = $labelNode->nodeValue;
+                                    }
                                 }
                                 break;
                             case "ProfileRenderLayersResult":
@@ -2728,8 +2747,19 @@
                                     {
                                         $this->MapProfileData->TotalWatermarkRenderTime = $watermarkNode->nodeValue;
                                     }
+                                    if (1 == $watermarkNode->nodeType && "ProfileRenderWatermarkResult" == $watermarkNode->nodeName)
+                                    {
+                                        foreach ($watermarkNode->childNodes as $watermarkItemNode) {
+                                            if (1 == $watermarkItemNode->nodeType && "Error" == $watermarkItemNode->nodeName) {
+                                                 $this->MapProfileData->WatermarksErrorMessage.= $watermarkItemNode->nodeValue . "\n";
+                                            }
+                                        }
+                                    }
                                 }
                                 break;
+                            case "Error":
+                                $this->MapProfileData->MapErrorMessage = $node->nodeValue;
+                                break;
                             default: break;
                         }
                     }
@@ -2741,11 +2771,13 @@
         {
             $this->LayerProfileData = new LayerDefinitionProfileResults();
             $this->LayerProfileData->LayerProfileDataCollection = array();
+            $this->LayerProfileData->HasErrors = 0;
 
             foreach ($LayerNodeList->childNodes as $layerNode) {
                 if (1 == $layerNode->nodeType && "ProfileRenderLayerResult" == $layerNode->nodeName) {
 
                     $tempLayerProfileData = new LayerDefinitionProfileData();
+                    $tempLayerProfileData->ErrorMessage = null;
 
                     foreach ($layerNode->childNodes as $node) {
                         if (1 == $node->nodeType) {
@@ -2780,15 +2812,14 @@
                                 case "Filter":
                                     $tempLayerProfileData->Filters= $node->nodeValue;
                                     break;
+                                case "Error":
+                                    $this->LayerProfileData->HasErrors++;
+                                    $tempLayerProfileData->ErrorMessage = $node->nodeValue;
+                                    break;
                                 default:break;
                             }
                         }
                     }
-
-                    //TODO:workaround for FDO read layer Exception
-                    if(trim($tempLayerProfileData->LayerName) === "")
-                        continue;
-
                     $this->LayerProfileData->LayerProfileDataCollection[$tempLayerProfileData->LayerName] = $tempLayerProfileData;
                 }
             }



More information about the mapguide-commits mailing list