[Mapbender-commits] r2456 - branches/2.5/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu May 15 15:45:18 EDT 2008


Author: astrid_emde
Date: 2008-05-15 15:45:18 -0400 (Thu, 15 May 2008)
New Revision: 2456

Modified:
   branches/2.5/http/javascripts/wfs.js
Log:
The schemaLocation-definition got zwo more values
* namespacelocation
* describefeaturetype 

to define wfs_describefeaturetype in the schemaLocation-definition for the Transaction some rows are added

see also changes in /php/mod_wfs.php

And have a look at the track at the ticket 222 (here you get further information about GeoServer behavior and how to get Transaction running):
http://trac.osgeo.org/mapbender/ticket/222

Modified: branches/2.5/http/javascripts/wfs.js
===================================================================
--- branches/2.5/http/javascripts/wfs.js	2008-05-15 19:42:07 UTC (rev 2455)
+++ branches/2.5/http/javascripts/wfs.js	2008-05-15 19:45:18 UTC (rev 2456)
@@ -1,7 +1,7 @@
 <?php
 #$Id$
 #$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_wfs_spatialRequest.php,v 1.4 2006/03/08 15:26:26 c_baudson Exp $
-# Copyright (C) 2002 CCGIS 
+# Copyright (C) 2002 CCGIS
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@
 	mb_registerSubFunctions('mod_usemap("")');
 }
 
-if (useCheckboxForHighlighting) { 
+if (useCheckboxForHighlighting) {
 	mb_registerSubFunctions('highlight.paint()');
 }
 
@@ -84,14 +84,14 @@
 		var ind = getMapObjIndexByName(mb_wfs_targets[0]);
 		var pos_a = makeClickPos2RealWorldPos(mb_wfs_targets[0],0,0);
 		var pos_b = makeClickPos2RealWorldPos(mb_wfs_targets[0],mb_mapObj[ind].width,mb_mapObj[ind].height);
-	
+
 		var x = [];
 		var y = [];
 		x[0] = pos_a[0];
 		x[1] = pos_b[0];
 		y[0] = pos_a[1];
 		y[1] = pos_b[1];
-		
+
 		mb_setwfsrequest(mb_wfs_targets[0],'rectangle',x,y);
 	}
 }
@@ -131,7 +131,7 @@
 function mb_wfs_reset(){
 	mb_wfs_fetch = new parent.GeometryArray();
 	usemap = "";
-	
+
 	if(mb_wfs_objwin == null){
 		var iframe=document.createElement('div');
 		iframe.setAttribute("style","position:absolute;left:"+mb_wfs_objwin_left+"px;top:"+mb_wfs_objwin_top+"px;width:"+mb_wfs_objwin_width+"px;height:"+mb_wfs_objwin_height+"px");
@@ -181,7 +181,7 @@
 		highlight.del(m, '#ff0000');
 		highlight.paint();
 	}
-	else 
+	else
 		if (type == 'click') {
 			var tmp = m.getBBox();
 			if (m.geomType == geomType.point) {
@@ -203,17 +203,17 @@
 
 function get_wfs_str(myconf, d, m, type, fid) {
 
-	<!-- Getting the Namspace for the FeautureType -->	
+	<!-- Getting the Namspace for the FeautureType -->
 	var featureTypeArray = myconf['featuretype_name'].split(':')
 	var featureNS = featureTypeArray[0];
 
 	var str = '<wfs:Transaction version="1.0.0" service="WFS" ';
 
 	var ns_gml = false;	var ns_ogc = false;	var ns_xsi = false;	var ns_wfs = false;	var ns_featureNS = false;
-	
+
 	for (var q = 0 ; q < myconf['namespaces'].length ; q++) {
-	
-		if (myconf['namespaces'][q]['name'] == "gml"){		
+
+		if (myconf['namespaces'][q]['name'] == "gml"){
 			 ns_gml = true;
 			 str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
 		} else if (myconf['namespaces'][q]['name'] == "ogc") {
@@ -227,19 +227,25 @@
 			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
 		} else if (myconf['namespaces'][q]['name'] == featureNS) {
 			ns_featureNS = true;
-			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
-		}		
+			str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" '
+			strForSchemaLocation = myconf['namespaces'][q]['location'];
+		}
 	}
-	
+
 	if (ns_gml == false) str += 'xmlns:gml="http://www.opengis.net/gml" ';
 	if (ns_ogc == false) str += 'xmlns:ogc="http://www.opengis.net/ogc" ';
 	if (ns_xsi == false) str += 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
 	if (ns_featureNS == false) str += 'xmlns:"+featureNS+"="http://www.someserver.com/"+featureNS+"" ';
 	if (ns_wfs == false) str += 'xmlns:wfs="http://www.opengis.net/wfs" ';
-	
-	str += 'xsi:schemaLocation="http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">';
 
-	
+	str += 'xsi:schemaLocation="http://www.opengis.net/wfs';
+	str += ' http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd';
+	str += ' ' + strForSchemaLocation;
+	str += ' '+ myconf['wfs_describefeaturetype'];
+	str += mb_getConjunctionCharacter(myconf['wfs_describefeaturetype']);
+	str += 'typename=' + myconf['featuretype_name'];
+	str += '">';
+
 	//
 	// ---------------------------------------- SAVE -------------------------------------------------
 	//
@@ -253,24 +259,24 @@
 		}
 		for(var j=0; j<myconf['element'].length; j++){
 			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];	
+				var el_geom = myconf['element'][j]['element_name'];
 			}
 		}
-		str += '<' + el_geom + '>';	
+		str += '<' + el_geom + '>';
 		if(d.get(m).geomType == geomType.point){
 			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:coordinates>';
-			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y; 
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
 			str += '</gml:coordinates>';
-			str += '</gml:Point>';		
+			str += '</gml:Point>';
 		}
 		if(d.get(m).geomType == geomType.line){
 			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			} 
+			}
 			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
 			str += '</gml:MultiLineString>';
 		}
@@ -279,12 +285,12 @@
 			str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
 
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				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 += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';		
+		str += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';
 	}
 	//
 	// --------------------------------------- UPDATE ------------------------------------------------
@@ -301,22 +307,22 @@
 		}
 		for(var j=0; j<myconf['element'].length; j++){
 			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];	
+				var el_geom = myconf['element'][j]['element_name'];
 			}
 		}
 		str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
 		if(d.get(m).geomType == geomType.point){
 			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>';		
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
+			str += '</gml:coordinates></gml:Point>';
 		}
 		if(d.get(m).geomType == geomType.line){
 			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			} 
+			}
 			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
 			str += '</gml:MultiLineString>';
 		}
@@ -324,9 +330,9 @@
 			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++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				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>';
@@ -340,13 +346,13 @@
 		str += '<wfs:Delete typeName="'+ myconf['featuretype_name']+'">';
 		for(var j=0; j<myconf['element'].length; j++){
 			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];	
+				var el_geom = myconf['element'][j]['element_name'];
 			}
 		}
 		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
 		str += '</wfs:Delete>';
 	}
-	
+
 	str += '</wfs:Transaction>';
 	return str;
-}
+}
\ No newline at end of file



More information about the Mapbender_commits mailing list