[Mapbender-commits] r8440 - in branches/2.7/http: classes plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 9 01:35:49 PDT 2012


Author: verenadiewald
Date: 2012-07-09 01:35:49 -0700 (Mon, 09 Jul 2012)
New Revision: 8440

Modified:
   branches/2.7/http/classes/class_map.php
   branches/2.7/http/plugins/mb_overview.js
Log:
check if overview element var overview_wms is set to a valid value to avoid Apache 500 error while loading application

Modified: branches/2.7/http/classes/class_map.php
===================================================================
--- branches/2.7/http/classes/class_map.php	2012-07-06 13:18:56 UTC (rev 8439)
+++ branches/2.7/http/classes/class_map.php	2012-07-09 08:35:49 UTC (rev 8440)
@@ -727,7 +727,23 @@
 				if (!isset($ovIndex)) {
 					$ovIndex = 0;
 				}
-				$wmsArray = array($wmsArray[$ovIndex]);	
+				$wmsArray = array($wmsArray[$ovIndex]);
+
+			    $sql = "SELECT * from gui_wms JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON ";
+                $sql .= "gui_wms.fkey_wms_id = wms.wms_id AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_id = $1 ORDER BY gui_wms_position";
+                $v = array ($appId);
+                $t = array ('s');
+                $res = db_prep_query($sql, $v, $t);
+                $count_wms = -1;
+
+			    while ($row = db_fetch_array($res)) {
+	                $count_wms++;
+                }
+                
+                if($ovIndex > $count_wms) {
+                    $e = new mb_exception("class_map.php: selectByApplication : OverviewIndex (set in overview element var 'overview_wms')does not exist!");
+                    return null;
+                }
 //				$e = new mb_notice("WMS in this map (corrected): " . implode(",", $wmsArray));
 			}
 			else {

Modified: branches/2.7/http/plugins/mb_overview.js
===================================================================
--- branches/2.7/http/plugins/mb_overview.js	2012-07-06 13:18:56 UTC (rev 8439)
+++ branches/2.7/http/plugins/mb_overview.js	2012-07-09 08:35:49 UTC (rev 8440)
@@ -75,6 +75,11 @@
         try {document.createEvent("TouchEvent"); isTouchable = true; } catch(e){}
 	$this.data("isMap", true);
 
+	cntWms = Mapbender.modules['mapframe1'].wms.length;
+	if(parseInt(cntWms,10)-1 < options.overview_wms) {
+		alert("Overview index wms error. Please check element var 'overview_wms' of application element overview.");
+	}
+	
 	$this.mapbender(new Mapbender.Map({
 		id: options.id,
 		width: options.width,



More information about the Mapbender_commits mailing list