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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Feb 18 12:39:07 EST 2009


Author: christoph
Date: 2009-02-18 12:39:07 -0500 (Wed, 18 Feb 2009)
New Revision: 3575

Modified:
   trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:
changed interface to geom2wfst.php

changed "save" to "insert"

add current SRS to new geometries

Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php	2009-02-18 17:37:14 UTC (rev 3574)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php	2009-02-18 17:39:07 UTC (rev 3575)
@@ -248,6 +248,9 @@
 	else {
 		// set the calculated real world position as point of the geometry
 		d.getGeometry(-1,-1).addPoint(realWorldPos);
+		var mapIndex = parent.getMapObjIndexByName(mod_digitize_target);
+
+		d.getGeometry(-1,-1).setEpsg(parent.mb_mapObj[mapIndex].epsg);
 		
 		if(d.get(-1).geomType == parent.geomType.point){
 			d.close();
@@ -1630,7 +1633,7 @@
 		if (isTransactional) {
 			str += "\t\t<tr>\n";
 
-			var options = ["save", "update", "delete", "abort"];
+			var options = ["insert", "update", "delete", "abort"];
 			for (var i = 0 ; i < options.length ; i++) {
 				var onClickText = "this.disabled=true;var result = window.opener.formCorrect(document, '"+featureTypeElementFormId+"');";
 				onClickText += 	"if (result.isCorrect) {";
@@ -1641,7 +1644,7 @@
 				onClickText += 		"alert(result.errorMessage);this.disabled=false;"
 				onClickText += 	"}";
 				
-				if (options[i] == "save" && hasGeometryColumn && (!fid || showSaveButtonForExistingGeometries)) {
+				if (options[i] == "insert" && hasGeometryColumn && (!fid || showSaveButtonForExistingGeometries)) {
 					str += "\t\t\t<td><input type='button' name='saveButton' value='"+msgObj.buttonLabelSaveGeometry+"' onclick=\""+onClickText+"\" /></td>\n";
 				}
 				
@@ -1725,20 +1728,30 @@
 		else {
 			fid = d.get(m).e.getElementValueByName('fid');
 		}
-		str = parent.get_wfs_str(myconf, d, m, type, fid);
+//		str = parent.get_wfs_str(myconf, d, m, type, fid);
 		
-		parent.mb_ajax_post("../extensions/geom2wfst.php", {'filter':str,'url':myconf['wfs_transaction'],'featuretype_name':myconf['featuretype_name'],'wfs_conf_id':wfsConf[d.get(m).wfs_conf]['wfs_conf_id']}, function(json,status){
-			var result = eval('('+json+')');
-			var response = result.response;
-			var fid = result.fid;
-			wfsSubWrite(m, type, status, response, fid);
-		});
+		var geoJson = d.featureToString(m);
+		
+		parent.mb_ajax_post(
+			"../extensions/geom2wfst.php", 
+			{
+				'geoJson' : geoJson,
+				'method' : type,
+				'wfs_conf_id' : wfsConf[d.get(m).wfs_conf]['wfs_conf_id']
+			}, 
+			function(json,status){
+				var result = eval('('+json+')');
+				var response = result.response;
+				var fid = result.fid;
+				wfsSubWrite(m, type, status, response, fid);
+			}
+		);
 	}
 }
 
 function wfsSubWrite(m, type, status, response, fid) {
 	if (status == "success" && response == "success") {
-		if (type == 'save' && fid) {
+		if (type == 'insert' && fid) {
 			d.get(m).e.setElement("fid", fid);
 		}
 		if (type == 'delete') {



More information about the Mapbender_commits mailing list