[Mapbender-commits] r7690 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Mar 4 03:52:47 EST 2011
Author: arsgeografica
Date: 2011-03-04 00:52:47 -0800 (Fri, 04 Mar 2011)
New Revision: 7690
Modified:
trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:
#794 - Only WFSConfs of same geometry type are shown in feature edit dialog. Update/Save is handled.
Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php 2011-03-04 07:47:50 UTC (rev 7689)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php 2011-03-04 08:52:47 UTC (rev 7690)
@@ -2087,7 +2087,7 @@
// --- wfs window form check (end) -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------
-function getAvailableWfsForGeom(geom, wfsConf) {
+function getAvailableWfsForGeom(geom, wfsConf) {
var wfsConfIndices = [];
for (var attr in wfsConf) {
@@ -2095,13 +2095,14 @@
if (!isTrans) {
continue;
}
+ /*
if (isValidWfsConfIndex(wfsConf, parseInt(geom.wfs_conf))) {
-
-// if (parseInt(geom.wfs_conf) == parseInt(attr)) {
+ if (parseInt(geom.wfs_conf) == parseInt(attr)) {
wfsConfIndices.push(attr);
-// }
+ }
}
else {
+ */
for (var elementIndex = 0; elementIndex < wfsConf[attr]['element'].length ; elementIndex++) {
var isGeomColumn = (parseInt(wfsConf[attr]['element'][elementIndex]['f_geom']) == 1);
if (isGeomColumn) {
@@ -2148,7 +2149,7 @@
}
}
}
- }
+ //}
}
return wfsConfIndices;
}
@@ -2334,13 +2335,13 @@
var selected = false;
// set the current wfs_conf as the selected
// if wfs_conf is not yet set (for example when creating a new feature, just select the first one)
- var selectedIndex = d.get(geometryIndex).wfs_conf || 0;
+ var selectedIndex = d.get(geometryIndex).wfs_conf || wfsConfIndices[0];
for (var i = 0; i < wfsConfIndices.length ; i++) {
for (var j in wfsConf[i].element){
}
str += "<option value='" + wfsConfIndices[i] + "'";
- if (i == selectedIndex ) {
+ if (wfsConfIndices[i] == selectedIndex ) {
str += " selected";
selected = true;
defaultIndex = parseInt(wfsConfIndices[i]);
@@ -2882,7 +2883,34 @@
return;
}
}
-
+
+ // Extract the current, possibly new WfsConf
+ var newWfsConfId = parseInt(wfsWindow.document.getElementById('wfs').wfs.value);
+ var newWfsConf = wfsConf[newWfsConfId];
+ newWfsConfId = newWfsConf['wfs_conf_id'];
+
+ // Check each feature attribute if it is part of the WfsConf element type. If not, delete.
+ var e = d.get(m).e;
+ var elementsToDelete = [];
+ for(var i in e.name) {
+ var validElement = false;
+ for(var j in newWfsConf.element) {
+ if(e.name[i] == newWfsConf.element[j]['element_name']) {
+ validElement = true;
+ break;
+ }
+ }
+ if(!validElement) {
+ elementsToDelete.push(i);
+ }
+ }
+
+ // Delete. As the arrays shrink, the indices into the arrays are shrunk, too
+ for(var i in elementsToDelete) {
+ e.name.splice(elementsToDelete[i] - i, 1);
+ e.value.splice(elementsToDelete[i] - i, 1);
+ }
+
var geoJson = d.featureToString(m);
parent.mb_ajax_post(
@@ -2890,7 +2918,7 @@
{
'geoJson' : geoJson,
'method' : type,
- 'wfs_conf_id' : wfsConf[d.get(m).wfs_conf]['wfs_conf_id']
+ 'wfs_conf_id' : newWfsConfId
},
function(json,status){
var result = typeof(json) == 'object' ? json : eval('('+json+')');
More information about the Mapbender_commits
mailing list