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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 20 11:01:35 EST 2010


Author: christoph
Date: 2010-01-20 11:01:35 -0500 (Wed, 20 Jan 2010)
New Revision: 5383

Modified:
   trunk/mapbender/http/javascripts/mod_legend.php
   trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
   trunk/mapbender/http/javascripts/mod_zoomCoords.php
Log:
refactoring: el vars

Modified: trunk/mapbender/http/javascripts/mod_legend.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_legend.php	2010-01-20 16:01:09 UTC (rev 5382)
+++ trunk/mapbender/http/javascripts/mod_legend.php	2010-01-20 16:01:35 UTC (rev 5383)
@@ -65,19 +65,9 @@
 mod_legend_offsetLeft = 25;
 mod_legend_offsetTop = -10;
 
-try{
-	if (checkbox_on_off){}
-}
-catch(e){
-	checkbox_on_off = 'false';
-}
+var checkbox_on_off = typeof checkbox_on_off === "undefined" ? 'false' : checkbox_on_off;
+var stickylegend = typeof stickylegend === "undefined" ? "false" : stickylegend;
 
-try{
-	if (stickylegend){}
-}
-catch(e){
-	stickylegend = 'false';
-}
 // Todo: return-value may change in the next version....
 parent.eventAfterMapRequest.register(function (obj) {
 	mod_legend_pos(obj.map.elementName)

Modified: trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2010-01-20 16:01:09 UTC (rev 5382)
+++ trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2010-01-20 16:01:35 UTC (rev 5383)
@@ -32,12 +32,7 @@
 echo "var mod_wfs_spatialRequest_target = '".$e_target[0]."';\n";
 ?>
 //element var openLinkFromSearch for opening attribute link directly onclick of searchResult entry
-try{
-	if (openLinkFromSearch){}
-}
-catch(e){
-	openLinkFromSearch =0;
-}
+var openLinkFromSearch = typeof openLinkFromSearch === "undefined" ? 0 : openLinkFromSearch;
 
 var wfsAreaType_point = "point";
 var wfsAreaType_polygon = "polygon";
@@ -91,26 +86,11 @@
  */
 var geomArray;
 
-try {if(mod_digitize_elName){}}catch(e) {mod_digitize_elName = "digitize";}
+var mod_digitize_elName = typeof mod_digitize_elName === "undefined" ? "digitize" : mod_digitize_elName;
+var wfsResultToPopupDiv = typeof wfsResultToPopupDiv === "undefined" ? 0 : wfsResultToPopupDiv;
+var buttonWfs_toDigitize_on = typeof buttonWfs_toDigitize_on === "undefined" ? 0 : buttonWfs_toDigitize_on;
+var displaySrsWarning = typeof displaySrsWarning === "undefined" ? false : displaySrsWarning;
 
-try{
-	if (wfsResultToPopupDiv){}
-}
-catch(e){
-	wfsResultToPopupDiv = 0;
-}
-try{
-	if (buttonWfs_toDigitize_on){}
-}
-catch(e){
-	buttonWfs_toDigitize_on = 0;
-}
-try{
-	if (displaySrsWarning){}
-}
-catch(e){
-	displaySrsWarning = false;
-}
 if (wfsResultToPopupDiv == 1) {
 	mb_registerWfsReadSubFunctions(function (geom) {
 		displayPopup(geom);

Modified: trunk/mapbender/http/javascripts/mod_zoomCoords.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_zoomCoords.php	2010-01-20 16:01:09 UTC (rev 5382)
+++ trunk/mapbender/http/javascripts/mod_zoomCoords.php	2010-01-20 16:01:35 UTC (rev 5383)
@@ -20,13 +20,11 @@
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 ?>
 var mod_zoomCoords_target = options.target;
-try{
-	if (options.zoomCoords_permanentHighlight){}
-}
-catch(e){
-	options.zoomCoords_permanentHighlight = 'false';
-}
+options.zoomCoords_permanentHighlight = 
+	typeof options.zoomCoords_permanentHighlight === "undefined" ?
+	"false" : options.zoomCoords_permanentHighlight;
 
+
 function zoomCoordinate (x,y) {
    x=x.replace(",",".");
    y=y.replace(",",".");



More information about the Mapbender_commits mailing list