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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Feb 9 09:13:54 EST 2007


Author: christoph
Date: 2007-02-09 09:13:54 -0500 (Fri, 09 Feb 2007)
New Revision: 1111

Modified:
   trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:
changed error detection for wfs-t

Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php	2007-02-09 14:13:18 UTC (rev 1110)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php	2007-02-09 14:13:54 UTC (rev 1111)
@@ -1027,6 +1027,7 @@
 	}
 	else {
 		var fid = false;
+		var errorMessage = "";
 		if (typeof(wfsWindow) != 'undefined' && !wfsWindow.closed) {
 			var myform = wfsWindow.document.getElementById(featureTypeElementFormId);
 		
@@ -1036,11 +1037,21 @@
 					d.get(m).e.setElement('fid', fid);
 				}
 				else if (myform.elements[i].type == 'text' ){
-					d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].value);
+					if (myform.elements[i].id) {
+						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].value);
+					}
+					else {
+						errorMessage = messageErrorFormEvaluation[selectedLanguage];
+					}
 				}
 				// selectbox
 				else if (typeof(myform.elements[i].selectedIndex) == 'number') {
-					d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].options[myform.elements[i].selectedIndex].value);
+					if (myform.elements[i].id) {
+						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].options[myform.elements[i].selectedIndex].value);
+					}
+					else {
+						errorMessage = messageErrorFormEvaluation[selectedLanguage];
+					}
 				}
 			}
 		}
@@ -1049,24 +1060,13 @@
 		}
 
 		str = parent.get_wfs_str(myconf, d, m, type, fid);
-//		prompt('', str);
-		parent.mb_ajax_post("../extensions/geom2wfst.php", {'filter':str,'url':myconf['wfs_transaction']}, function(xml,status){
-//			var serializer = new XMLSerializer();
-//			var xml_string = serializer.serializeToString(xml);
-			var xml_string = "";
-//			prompt('', xml_string);
-//			alert(xml_string);
-			wfsSubWrite(m, type, status, xml_string);
+		parent.mb_ajax_post("../extensions/geom2wfst.php", {'filter':str,'url':myconf['wfs_transaction']}, function(response,status){
+			wfsSubWrite(m, type, status, response);
 		});
 	}
 }
 
-// TO DO
-function wfsWriteSucceeded (xmlString) {
-	return true;
-}
-
-function wfsSubWrite(m, type, status, xml_string) {
+function wfsSubWrite(m, type, status, response) {
 	parent.mb_execWfsWriteSubFunctions();
 
 	if (type == 'delete') {
@@ -1075,14 +1075,14 @@
 	}
 	executeDigitizeSubFunctions();
 	
-	if (status == "success" && wfsWriteSucceeded(xml_string)) {
+	if (status == "success" && response == "success") {
 		var wfsWriteMessage = messageSuccessWfsWrite[selectedLanguage];
 	}
 	else {
-		var wfsWriteMessage = messageErrorWfsWrite[selectedLanguage] + "\n" + xml_string;
+		var wfsWriteMessage = messageErrorWfsWrite[selectedLanguage];
 	} 
+	wfsWindow.alert(wfsWriteMessage);
 	wfsWindow.close();
-	alert(wfsWriteMessage);
 }
 // --- wfs window (begin) -----------------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------------------------------



More information about the Mapbender_commits mailing list