[mapguide-commits] r6181 - trunk/MgDev/Web/src/mapadmin

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Oct 21 04:34:10 EDT 2011


Author: liuar
Date: 2011-10-21 01:34:10 -0700 (Fri, 21 Oct 2011)
New Revision: 6181

Modified:
   trunk/MgDev/Web/src/mapadmin/performanceReport.php
   trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.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 fixed some UI defects:[[BR]]
1. The alphabetical order of Map resource name should  make the lower case prior to uppercase [[BR]]
2. use "Infinity" to replace the '1000000000000' when display the scale range  [[BR]]
3. correct the the error message as "is no longer..." [[BR]]
4. when user reset the setting from the mapviewer if should display warning as the setting changed [[BR]]
5. correct the recent setting time format [[BR]]
6. when the layer detailed information contains special chars the layer detailed info will not be displayed[[BR]]
7. adjust the render time graph style[[BR]]
8. add the initial sorting to the layer information table




Modified: trunk/MgDev/Web/src/mapadmin/performanceReport.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport.php	2011-10-21 07:21:08 UTC (rev 6180)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport.php	2011-10-21 08:34:10 UTC (rev 6181)
@@ -39,10 +39,81 @@
     $errorMsg = "";
     $mapProfileResult=new MapProfileResult();
     $mapResources;
-    $mapResourceShortNames;
     $displayManager = new DisplayProfileResultManager();
     $recentSettings = new RecentSettings();
 
+    //this user-defined sort function is according to the design
+    function CompareMapName($a, $b)
+    {
+        $strA = $a["ShortNames"];
+        $strB = $b["ShortNames"];
+
+        $strALength = strlen($strA);
+        $strBLength = strlen($strB);
+        $length = 0;
+
+        if($strALength >= $strBLength)
+        {
+            $length = $strBLength;
+        }
+        else
+        {
+            $length = $strALength;
+        }
+
+        if(0 == $strALength)
+        {
+            return 0;
+        }
+
+        for($i = 0; $i < $length; $i++)
+        {
+            $strALower = strtolower($strA[$i]);
+            $strBLower = strtolower($strB[$i]);
+
+            if($strALower == $strBLower)
+            {
+                if($strA[$i] == $strB[$i])
+                {
+                    continue;
+                }
+
+                if(strtoupper($strA[$i]) == $strB[$i])
+                {
+                    return -1;
+                }
+
+                if(strtolower($strA[$i]) == $strB[$i])
+                {
+                    return 1;
+                }
+            }
+            else if($strALower < $strBLower)
+            {
+                return -1;
+            }
+            else
+            {
+                return 1;
+            }
+        }
+
+        if($strALength == $strBLength)
+        {
+            return 0;
+        }
+
+        if($strALength > $strBLength)
+        {
+            return 1;
+        }
+
+        if($strALength < $strBLength)
+        {
+            return -1;
+        }
+    }
+
     function GetAllMapResources()
     {
         try
@@ -50,7 +121,6 @@
             global $site;
             global $userInfo;
             global $mapResources;
-            global $mapResourceShortNames;
             $mapResourcesXml = "";
 
             // Enumerates all maps in the library
@@ -79,13 +149,11 @@
                 $mapResourceID = $resourceIdNodeList->item($i)->nodeValue;
                 $shortMapName = strrchr($mapResourceID, '/');
                 $shortMapName = substr($shortMapName, 1, strlen($shortMapName) - 15);
-                $mapResources[$i] = $mapResourceID;
-                $mapResourceShortNames[$i] = $shortMapName;
+                $mapResources[$i]["FullNames"] = $mapResourceID;
+                $mapResources[$i]["ShortNames"] = $shortMapName;
             }
 
-            //Case insensitive sorting
-            $mapResourceShortNames_Lower = array_map("strtolower", $mapResourceShortNames);
-            array_multisort($mapResourceShortNames_Lower, SORT_ASC, SORT_STRING,$mapResources,$mapResourceShortNames);
+            usort($mapResources, "CompareMapName");
         }
         catch (Exception $exc)
         {
@@ -994,6 +1062,9 @@
 
                     var scaleSaved = document.getElementById("mapViewerLastOpenScale");
                     scaleSaved.value = scale;
+
+                    //when the user set the new value from the mapviewer, the warning info should be shown
+                    ShowReportWarningMsg();
                 }
 
                 function makeMessageShorter(mapFrame)
@@ -1350,7 +1421,7 @@
 
                         if(Trim(result) == "mapNotExist")
                         {
-                            alert("The selected map resource is longer available. Select a different map resource to continue.");
+                            alert("The selected map resource is no longer available. Select a different map resource to continue.");
                             btnClear.style.display = "inline";
                             loadingImg.style.display = "none";
                             SetRunButtonState(true);
@@ -1372,6 +1443,10 @@
                         SetRecentSettingsContent();
 
                         SaveLastRunSettings();
+
+                        //make the layer table default sorting
+                        var layerTableHeader = document.getElementById("layerHeaderTable");
+                        SortLayers.sortByColumn(layerTableHeader.tHead.rows[0].children[0]);
                     }
                 }
 
@@ -1886,7 +1961,7 @@
                         }
                         else
                         {
-                            alert("The selected map resource is longer available. Select a different map resource to continue.");
+                            alert("The selected map resource is no longer available. Select a different map resource to continue.");
                             return;
                         }
 
@@ -1966,10 +2041,10 @@
                                                                        //<option value="Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition">Sheboygan</option>
                                                                        for ($i = 0; $i < count($mapResources); $i++)
                                                                        {
-                                                                            echo "<option value=";
-                                                                            echo "'$mapResources[$i]'";
-                                                                            echo ">";
-                                                                            echo $mapResourceShortNames[$i];
+                                                                            echo "<option value='";
+                                                                            echo $mapResources[$i]["FullNames"];
+                                                                            echo "'>";
+                                                                            echo $mapResources[$i]["ShortNames"];
                                                                             echo "</option>";
                                                                        }
                                                                    ?>

Modified: trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php	2011-10-21 07:21:08 UTC (rev 6180)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php	2011-10-21 08:34:10 UTC (rev 6181)
@@ -405,7 +405,7 @@
     <tr>
         <td colspan="2">
             <div>
-                <table style="width:100%; padding: 0px; text-align: center;" cellspacing="0" cellpadding="0">
+                <table style="width:100%; padding: 0px; text-align: center; table-layout: fixed;" cellspacing="0" cellpadding="0">
                     <?php
                         $displayManager->OutputMapRenderTimeGraph();
                     ?>

Modified: trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php	2011-10-21 07:21:08 UTC (rev 6180)
+++ trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php	2011-10-21 08:34:10 UTC (rev 6181)
@@ -2235,6 +2235,9 @@
                 $replace = "<br/>";
                 $newFilters = str_replace($order, $replace, $str);
 
+                //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."'; ";
@@ -2251,35 +2254,45 @@
         {
             echo "<tr style='height: 25px;'>","\n";
             
-            echo '<td style="width:'.$this->mapProfileResult->MapProfileData->GetLayerRenderPercent() .'%; background-color: #E4C7AE;font-size:80%;">',"\n";
-            echo number_format($this->mapProfileResult->MapProfileData->TotalLayerRenderTime,2)."&nbsp;ms&nbsp;";
-            echo "(" . $this->mapProfileResult->MapProfileData->GetLayerRenderPercent() . "%)","\n";
-            echo '</td>',"\n";
+            $this->OutputMapRenderTimeGraphItem($this->mapProfileResult->MapProfileData->GetLayerRenderPercent(),$this->mapProfileResult->MapProfileData->TotalLayerRenderTime,"#E4C7AE");
+            $this->OutputMapRenderTimeGraphItem($this->mapProfileResult->MapProfileData->GetLabelRenderPercent(),$this->mapProfileResult->MapProfileData->TotalLabelRenderTime,"#AECBE4");
+            $this->OutputMapRenderTimeGraphItem($this->mapProfileResult->MapProfileData->GetWartermarkRenderPercent(),$this->mapProfileResult->MapProfileData->TotalWatermarkRenderTime,"#E79661");
+            $this->OutputMapRenderTimeGraphItem($this->mapProfileResult->MapProfileData->GetImageRenderPercent(),$this->mapProfileResult->MapProfileData->TotalImageRenderTime,"BE76EE");
+            $this->OutputMapRenderTimeGraphItem($this->mapProfileResult->MapProfileData->GetOthersRenderPercent(),$this->mapProfileResult->MapProfileData->GetOtherRenderTime(),"#999999");
 
-            echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetLabelRenderPercent().'%; background-color: #AECBE4;font-size:80%;">',"\n";
-            echo number_format($this->mapProfileResult->MapProfileData->TotalLabelRenderTime,2)."&nbsp;ms&nbsp;";
-            echo "(".$this->mapProfileResult->MapProfileData->GetLabelRenderPercent()."%)","\n";
-            echo "</td>","\n";
+            echo "</tr>","\n";
+        }
 
-            echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetWartermarkRenderPercent().'%; background-color: #E79661;font-size:80%;">',"\n";
-            echo number_format($this->mapProfileResult->MapProfileData->TotalWatermarkRenderTime,2)."&nbsp;ms&nbsp;";
-            echo "(".$this->mapProfileResult->MapProfileData->GetWartermarkRenderPercent()."%)","\n";
-            echo "</td>","\n";
+        public function OutputMapRenderTimeGraphItem($percent,$TotalTime,$bgColor)
+        {
+            $tipDivId = "timeGraphTipDiv".rand(0, 99);
 
-            echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetImageRenderPercent().'%; background-color: #BE76EE;font-size:80%;">',"\n";
-            echo number_format($this->mapProfileResult->MapProfileData->TotalImageRenderTime,2)."&nbsp;ms&nbsp;";
-            echo "(".$this->mapProfileResult->MapProfileData->GetImageRenderPercent()."%)","\n";
-            echo "</td>","\n";
+            //if the percent if too small, then column will not big enough to show text, so we need the tip, also we should set the minmun width as 20px
+            if(0.01<= $percent && $percent <= 2.29)
+            {
+                echo '<td style="width:20px; background-color: '.$bgColor.';font-size:80%; overflow:hidden;text-overflow:ellipsis; cursor:default;"';
+                echo ' onmouseout="HideToolTop(\''.$tipDivId.'\');" onmousemove="ShowToopTip(this,\''.$tipDivId.'\',event);" onmouseover="ShowToopTip(this,\''.$tipDivId.'\',event);"';
+                echo '>',"\n";
+            }
+            else
+            {
+                echo '<td style="width:'.$percent.'%; background-color: '.$bgColor.';font-size:80%; overflow:hidden;text-overflow:ellipsis; cursor:default;"';
+                echo ' onmouseout="HideToolTop(\''.$tipDivId.'\');" onmousemove="ShowToopTip(this,\''.$tipDivId.'\',event);" onmouseover="ShowToopTip(this,\''.$tipDivId.'\',event);"';
+                echo '>',"\n";
+            }
 
-            echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetOthersRenderPercent().'%; background-color: #999999;font-size:80%;">',"\n";
-            //for "Other" we don't need the text, because the width of the td is always too small for the text
-            //echo $this->mapProfileResult->MapProfileData->GetOtherRenderTime()."&nbsp;ms&nbsp;";
-            //echo "(".$this->mapProfileResult->MapProfileData->GetOthersRenderPercent()."%)","\n";
-            echo "</td>","\n";
+            echo '<div id="'.$tipDivId.'" class="hideTooltip">',"\n";
+            echo $TotalTime."&nbsp;ms&nbsp;";
+            echo "(" . $percent . "%)","\n";
+            echo '</div>',"\n";
 
-            echo "</tr>","\n";
+            echo number_format($TotalTime,2)."&nbsp;ms&nbsp;";
+            echo "(" . $percent . "%)","\n";
+
+            echo '</td>',"\n";
         }
 
+
         public function OutputMapResourceNameWithToolTip($mapResourceID,$IsSetting)
         {
             $mapResourceID = trim($mapResourceID);
@@ -2354,10 +2367,10 @@
                 $this->OutputMapResourceNameWithToolTip($currentSetting->MapResourceId,true);
                 echo "</td></tr><tr>","\n";
                 echo "<td style='width:50%;text-align: left;'>","\n";
-                echo $dTime->format("M d,Y");
+                echo $dTime->format("F d,Y");
                 echo "</td>","\n";
                 echo "<td style='width:50%;text-align: right;'>","\n";
-                echo $dTime->format("h:m:s A");
+                echo $dTime->format("h:i:s A");
                 echo "</td>","\n";
                 echo "</tr></table></td></tr></table>","\n";
             }

Modified: trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php	2011-10-21 07:21:08 UTC (rev 6180)
+++ trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php	2011-10-21 08:34:10 UTC (rev 6181)
@@ -2395,7 +2395,7 @@
                 else
                 {
                     //if existed, update the modify time
-                    $settingElement->getElementsByTagName("modifyTime")->item(0)->nodeValue = date(DATE_W3C);
+                    $settingElement->getElementsByTagName("modifyTime")->item(0)->nodeValue = date("F d ,Y h:i:s A");
                 }
             }
             else
@@ -2470,7 +2470,7 @@
             $scaleElement = $recentSettingsDoc->createElement("scale", $scale);
             $newSettingElement->appendChild($scaleElement);
 
-            $createDate = date(DATE_W3C);
+            $createDate = date("F d ,Y h:i:s A");
             $createTimeElement = $recentSettingsDoc->createElement("modifyTime", $createDate);
             $newSettingElement->appendChild($createTimeElement);
 
@@ -2771,6 +2771,10 @@
                                 case "ScaleRange":
                                     $minScale = $node->getElementsByTagName("MinScale")->item(0)->nodeValue;
                                     $maxScale = $node->getElementsByTagName("MaxScale")->item(0)->nodeValue;
+                                    if($maxScale === "1000000000000")
+                                    {
+                                        $maxScale = "Infinity";
+                                    }
                                     $tempLayerProfileData->ScaleRange= $minScale." - ".$maxScale;
                                     break;
                                 case "Filter":



More information about the mapguide-commits mailing list