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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Apr 6 09:02:06 EDT 2010


Author: christoph
Date: 2010-04-06 09:02:05 -0400 (Tue, 06 Apr 2010)
New Revision: 5869

Modified:
   trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:


Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php	2010-04-06 12:59:21 UTC (rev 5868)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php	2010-04-06 13:02:05 UTC (rev 5869)
@@ -2017,6 +2017,36 @@
 	wfsKmlWindow.document.getElementById("elementForm").innerHTML = str;
 }
 
+
+function stripslashes (str) {
+    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+    // +   improved by: Ates Goral (http://magnetiq.com)
+    // +      fixed by: Mick at el
+    // +   improved by: marrtins    
+	// +   bugfixed by: Onno Marsman
+    // +   improved by: rezna
+    // +   input by: Rick Waldron
+    // +   reimplemented by: Brett Zamir (http://brett-zamir.me)
+    // +   input by: Brant Messenger (http://www.brantmessenger.com/)    
+	// +   bugfixed by: Brett Zamir (http://brett-zamir.me)
+    // *     example 1: stripslashes('Kevin\'s code');
+    // *     returns 1: "Kevin's code"
+    // *     example 2: stripslashes('Kevin\\\'s code');
+    // *     returns 2: "Kevin\'s code"    
+	return (str+'').replace(/\\(.?)/g, function (s, n1) {
+        switch (n1) {
+            case '\\':
+                return '\\';
+            case '0':                
+				return '\u0000';
+            case '':
+                return '';
+            default:
+                return n1;        
+		}
+    });
+}
+
 function deleteFeature (geometryIndex) {
 	var res = true;	
 	res = parent.Mapbender.modules[mod_digitize_elName].events.clickDelete.trigger({
@@ -2073,12 +2103,12 @@
 	onChangeText += "window.opener.setWfsWindowStyle(this.value);";
 
 	var datePickerText = "$('.hasdatepicker').each(function () { " + 
-	"var data = $.parseJSON(window.opener.stripslashes($(this).attr('data'), true));" +
-	"var defaults = {};" +
-	"var settings = $.extend({}, defaults, data);" + 
-	"$(this).datepicker(settings);" + 
-	"});";
-
+		"var data = $.parseJSON(window.opener.stripslashes($(this).attr('data'), true));" +
+		"var defaults = {};" +
+		"var settings = $.extend({}, defaults, data);" + 
+		"$(this).datepicker(settings);" + 
+		"});";
+	
 	onChangeText += datePickerText;
 	onChangeText += "$('.uploader').upload({callback: function(result,stat,msg){if(stat !== true){alert(msg);}}});";
 	
@@ -2119,7 +2149,7 @@
 		headStr += 'a img { vertical-align: middle;border: 0; }';
 		headStr += '.mandatory { border:1px solid red; }';
 		headStr += '</style>';
-		headStr += '</head><body onload="window.opener.toggleTabs(\''+initialTab+'\'); var $dp = $(\'.hasdatepicker\');$dp.datepicker(); var $uploader = $(\'.uploader\');$uploader.upload({callback: function(result,stat,msg){if(stat !== true){alert(msg);}}});">';
+		headStr += '</head><body onload="window.opener.toggleTabs(\''+initialTab+'\'); ' + datePickerText + var $uploader = $(\'.uploader\');$uploader.upload({callback: function(result,stat,msg){if(stat !== true){alert(msg);}}});">';
 		wfsWindow.document.write(headStr);
 	}
 	else {
@@ -2130,6 +2160,7 @@
 	str += "<script type='text/javascript' src='../extensions/jquery-ui-1.7.2.custom/js/jquery-1.3.2.min.js'><\/script>";
 	str += "<script type='text/javascript' src='../extensions/jquery-ui-1.7.1.w.o.effects.min.js'><\/script>";
 	str += "<script type='text/javascript' src='../plugins/jq_upload.js'><\/script>";
+	str += "<script type='text/javascript' src='../extensions/jqjson.js'><\/script>";
 	str += "</body></html>";
 	wfsWindow.document.write(str);
 	wfsWindow.document.close();
@@ -2192,7 +2223,7 @@
 		// set border if mandatory
 		classString += " mandatory";
 	}
-	classString = (classString !== "") ? " class='"+classString+"' " : " ";
+	classString = (classString !== "") ? " class='"+classString+" hasdatepicker' " : " ";
 	formElementHtml = formElementHtml.replace(pattern, patternString + classString);
 
 	// set name of select box to elementlabel



More information about the Mapbender_commits mailing list