[Mapbender-commits] r2577 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jul 2 08:15:20 EDT 2008


Author: christoph
Date: 2008-07-02 08:15:20 -0400 (Wed, 02 Jul 2008)
New Revision: 2577

Modified:
   trunk/mapbender/http/javascripts/map.php
Log:
check if extension files are found; if not display error message and halt

Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php	2008-07-02 12:14:05 UTC (rev 2576)
+++ trunk/mapbender/http/javascripts/map.php	2008-07-02 12:15:20 UTC (rev 2577)
@@ -74,28 +74,47 @@
 //
 // Load external JavaScript libraries
 //
-require_once(dirname(__FILE__) . "/../extensions/jquery-1.2.6.min.js");
-require_once(dirname(__FILE__) . "/../extensions/jqjson.js");
-require_once(dirname(__FILE__) . "/../extensions/jquery.mousewheel.min.js");
+$extPath = dirname(__FILE__) . "/../../ext/";
+$extFileArray = array(  "jquery-1.2.6.min.js", 
+						"jqjson.js", 
+						"jquery.mousewheel.min.js");
+
+for ($i = 0; $i < count($extFileArray); $i++) {
+	$currentFile = $extPath . $extFileArray[$i];
+	if (file_exists($currentFile)) {
+		require_once($currentFile);
+	}
+	else {
+		$e = new mb_exception("Extension not found: " . $currentFile);
+		echo "var e = new Mb_exception('Library not found: " . $currentFile . "');";
+		die;
+	}
+}
+
 //
 // Load internal JavaScript libraries
 //
-require_once(dirname(__FILE__) . "/../../lib/exception.js");
-require_once(dirname(__FILE__) . "/../../lib/ajax.js");
-require_once(dirname(__FILE__) . "/../../lib/basic.js");
-require_once(dirname(__FILE__) . "/../../lib/div.js");
-require_once(dirname(__FILE__) . "/../../lib/list.js");
-require_once(dirname(__FILE__) . "/../../lib/point.js");
-require_once(dirname(__FILE__) . "/../../lib/style.js");
-require_once(dirname(__FILE__) . "/../../lib/button.js");
+$libPath = dirname(__FILE__) . "/../../lib/";
+$libFileArray = array(  "exception.js", 
+						"ajax.js", 
+						"basic.js",
+						"div.js",
+						"list.js",
+						"point.js",
+						"style.js",
+						"button.js");
 
-//
-// map obj
-//
-#require_once(dirname(__FILE__) . "/../../lib/map_obj.js");
-#require_once(dirname(__FILE__) . "/../../lib/map.js");
-#require_once(dirname(__FILE__) . "/../../lib/wms.js");
-#require_once(dirname(__FILE__) . "/../../lib/wfs_obj.js");
+for ($i = 0; $i < count($libFileArray); $i++) {
+	$currentFile = $libPath . $libFileArray[$i];
+	if (file_exists($currentFile)) {
+		require_once($currentFile);
+	}
+	else {
+		$e = new mb_exception("Library not found: " . $currentFile);
+		echo "var e = new Mb_exception('Library not found: " . $currentFile . "');";
+		die;
+	}
+}
 
 //
 // Load JavaScript modules of GUI elements
@@ -114,6 +133,8 @@
 			}
 			else {
 				$e = new mb_exception("Javascript module not found: " . $currentFile);
+				echo "var e = new Mb_exception('Javascript module not found: " . $currentFile . "');";
+				die;
 			}
 		}
 	}
@@ -142,6 +163,8 @@
 			}
 			else {
 				$e = new mb_exception("Javascript not found: " . $currentFile);
+				echo "var e = new Mb_exception('Javascript not found: " . $currentFile . "');";
+				die;
 			}
 		}
 	}



More information about the Mapbender_commits mailing list