svn commit: r433 - trunk/mapbender/http: javascripts php
christoph at osgeo.org
christoph at osgeo.org
Tue Jun 13 09:53:06 EDT 2006
Author: christoph
Date: 2006-06-13 13:53:06+0000
New Revision: 433
Modified:
trunk/mapbender/http/javascripts/mod_digitize_tab.php
trunk/mapbender/http/php/mod_wfs_result.php
Log:
improvement: now using geoserver fid instead of manual gid
Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_digitize_tab.php?view=diff&rev=433&p1=trunk/mapbender/http/javascripts/mod_digitize_tab.php&p2=trunk/mapbender/http/javascripts/mod_digitize_tab.php&r1=432&r2=433
==============================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php (original)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php 2006-06-13 13:53:06+0000
@@ -665,13 +665,14 @@
if (parseInt(d.get(memberIndex).wfs_conf) != parseInt(wfsConfIndex)) {memberIndex=-1;}
var str = "";
- var gid = false;
var geom = false;
var wfs = wfs_conf[wfsConfIndex];
var memEl;
+ var fid = false;
if (parseInt(memberIndex) != -1) {
- memEl = d.get(memberIndex).e;
+ memEl = d.get(memberIndex).e;
+ fid = memEl.getElementValueByName('fid');
}
// search attribute 'element' in wfsConfArray
@@ -685,39 +686,31 @@
var wfsElementName = c['element_name'];
if (parseInt(c['f_geom']) != 1) {
-
- if (parseInt(wfs['element'][i]['f_gid']) == 1) {
- gid = wfsElementName;
- }
str += "\t\t<tr>\n\t\t\t<td>\n";
str += "\t\t\t\t" + wfsElementName + "\n\t\t\t</td>\n\t\t\t<td colspan = 2>\n";
str += "\t\t\t\t<input name='" + wfsElementName + "' type='text' size=20 ";
if (parseInt(memberIndex) != -1) {
-
for (var j = 0 ; j < memEl.count() ; j ++) {
- currentElementName = memEl.getName(j);
- if (currentElementName == wfsElementName) {
+ if (memEl.getName(j) == wfsElementName) {
str += "value = '" + memEl.getValue(j) + "' ";
}
}
}
str += ">\n\t\t\t</td>\n\t\t</tr>\n";
-
}
else geom = wfsElementName;
}
if (wfs['wfs_transaction']) {
str += "\t\t<tr>\n";
-
var colspan = 0;
if (geom) {
str += "\t\t\t<td><input type='button' name='saveButton' value='Save' onclick=\"window.opener.dbGeom('save', "+selMember+")\" /></td>\n";
}
else colspan++;
- if (parseInt(memberIndex) != -1 && gid) {
+ if (parseInt(memberIndex) != -1 && fid) {
if (geom) {
str += "\t\t\t<td><input type='button' name='updateButton' value='Update' onclick=\"window.opener.dbGeom('update', "+selMember+")\"/></td>\n";
}
@@ -732,7 +725,7 @@
str += "\t\t</tr>";
}
str += "\t</table>\n";
-// str += "<input type='text' name='mb_geom'>";
+ str += "<input type='hidden' name='fid' value='"+fid+"'>";
// str += "<input type='text' name='mb_wfs_conf'>";
str += "</form>\n";
}
@@ -789,6 +782,7 @@
var myconf = wfs_conf[d.get(m).wfs_conf];
var mapObjInd = parent.getMapObjIndexByName(mod_digitize_target);
+ var fid = false;
if (myconf['featuretype_srs'] != parent.mb_mapObj[mapObjInd].epsg) {
alert("fatal error: EPSG mismatch. "+ parent.mb_mapObj[mapObjInd].epsg + " / "+ myconf['featuretype_srs']);
@@ -797,7 +791,10 @@
var myform = wfsWindow.document.forms[1];
for (var i=0; i<myform.length; i++){
- if(myform.elements[i].type == 'text'){
+ if (myform.elements[i].name == "fid") {
+ fid = myform.elements[i].value;
+ }
+ else if (myform.elements[i].type == 'text' ){
d.get(m).e.setElement(myform.elements[i].name, myform.elements[i].value);
}
}
@@ -889,7 +886,8 @@
}
}
str += '<' + el_geom + '>';
- if(d.get(m).geomtype == geomTypePolygon){
+ str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
+ if(d.get(m).geomtype == geomTypePoint){
str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '"><gml:coordinates>';
str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
str += '</gml:coordinates></gml:Point>';
@@ -905,7 +903,6 @@
str += '</gml:MultiLineString>';
}
if(d.get(m).geomtype == geomTypePolygon){
- str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
for(var k=0; k<d.getGeometry(m,0).count(); k++){
@@ -913,13 +910,10 @@
str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
}
str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>';
- str += '</wfs:Value></wfs:Property>';
}
+ str += '</wfs:Value></wfs:Property>';
str += '</' + el_geom + '>';
- str += '<ogc:Filter><ogc:PropertyIsEqualTo>';
- str += '<ogc:PropertyName>gid</ogc:PropertyName>';
- str += '<ogc:Literal>'+d.get(m).e.getElementValueByName('gid')+'</ogc:Literal>';
- str += '</ogc:PropertyIsEqualTo></ogc:Filter>';
+ str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
str += '</wfs:Update>';
}
//
@@ -932,10 +926,7 @@
var el_geom = myconf['element'][j]['element_name'];
}
}
- str += '<ogc:Filter><ogc:PropertyIsEqualTo>';
- str += '<ogc:PropertyName>gid</ogc:PropertyName>';
- str += '<ogc:Literal>'+d.get(m).e.getElementValueByName('gid')+'</ogc:Literal>';
- str += '</ogc:PropertyIsEqualTo></ogc:Filter>';
+ str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
str += '</wfs:Delete>';
}
Modified: trunk/mapbender/http/php/mod_wfs_result.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_wfs_result.php?view=diff&rev=433&p1=trunk/mapbender/http/php/mod_wfs_result.php&p2=trunk/mapbender/http/php/mod_wfs_result.php&r1=432&r2=433
==============================================================================
--- trunk/mapbender/http/php/mod_wfs_result.php (original)
+++ trunk/mapbender/http/php/mod_wfs_result.php 2006-06-13 13:53:06+0000
@@ -19,6 +19,7 @@
$req = urldecode($_REQUEST["url"]).urlencode(stripslashes($_REQUEST["filter"]));
require_once("../../conf/mapbender.conf");
+require_once("../classes/class_stripRequest.php");
function sepNameSpace($s){
$c = strpos($s,":");
@@ -49,12 +50,15 @@
$str = array();
$geomtype = array();
$el = -1;
+ $fid = -1;
echo "<html><head>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=".CHARSET."'>\n";
echo "<script language='JavaScript' type='text/javascript'>\n<!--\n";
require_once("../javascripts/mod_geometryArray.js");
-
+
+ $sr = new stripRequest($_REQUEST["url"]);
+ $typename = $sr->get("typename");
$element_str = "";
$geom_str = "";
$geom_str .= "var geom = new GeometryArray();\n";
@@ -65,6 +69,9 @@
$section = true;
$cnt_geom = 0;
}
+ else if(strtoupper($element[tag]) == strtoupper($typename) && $element[type] == "open") {
+ $fid = $element[attributes][fid];
+ }
else if(in_array(sepNameSpace($element[tag]),$geometries) && $element[type] == "open" && $section == true){
$geom = true;
if (sepNameSpace($element[tag]) == "MultiLineString") {
@@ -86,6 +93,7 @@
else {
$geom_str .= "alert('unknown geomtype ".sepNameSpace($element[tag])."');";
}
+ $element_str .= "geom.get(" . $member . ").e.setElement('fid', '".$fid."');\n";
}
else if(strtoupper($element[tag]) == strtoupper("gml:coordinates") && $geom == true){
$tmp = str_replace(",,","",str_replace(" ",",",trim($element[value])));
More information about the Mapbender_commits
mailing list