[Mapbender-commits] r4395 - in trunk/mapbender/http: classes javascripts php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 20 09:36:47 EDT 2009


Author: christoph
Date: 2009-07-20 09:36:46 -0400 (Mon, 20 Jul 2009)
New Revision: 4395

Modified:
   trunk/mapbender/http/classes/class_wfs.php
   trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
   trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
   trunk/mapbender/http/php/mod_wfs_result.php
Log:
http://trac.osgeo.org/mapbender/ticket/443

Modified: trunk/mapbender/http/classes/class_wfs.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs.php	2009-07-20 13:18:50 UTC (rev 4394)
+++ trunk/mapbender/http/classes/class_wfs.php	2009-07-20 13:36:46 UTC (rev 4395)
@@ -102,10 +102,16 @@
 	}
 	
 	public function getFeature ($featureTypeName, $filter) {
-		if (strpos($this->getFeature, "?") === false) {
+
+// FOR NOW, WE ONLY DO POST REQUESTS!
+// THE FILTERS ARE CONSTRUCTED ON THE CLIENT SIDE,
+// SO CHANGING THEM HERE ACCORDING TO GET/POST
+// WOULD BE TOO MUCH FOR NOW
+//
+//		if (strpos($this->getFeature, "?") === false) {
 			return $this->getFeaturePost($featureTypeName, $filter);
-		}
-		return $this->getFeatureGet($featureTypeName, $filter);
+//		}
+//		return $this->getFeatureGet($featureTypeName, $filter);
 	}
 	
 	/**
@@ -149,13 +155,13 @@
 
 		switch (strtolower($method)) {
 			case "delete":
-				$requestData = $this->transactionDelete($feature, $featureTypeName, $authWfsConfElement);
+				$requestData = $this->transactionDelete($feature, $featureType, $authWfsConfElement);
 				break;
 			case "update":
-				$requestData = $this->transactionUpdate($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName);
+				$requestData = $this->transactionUpdate($feature, $featureType, $authWfsConfElement, $gml, $geomColumnName);
 				break;
 			case "insert":
-				$requestData = $this->transactionInsert($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName);
+				$requestData = $this->transactionInsert($feature, $featureType, $authWfsConfElement, $gml, $geomColumnName);
 				break;
 			default:
 				$e = new mb_exception("Invalid transaction method: " . $method);
@@ -166,37 +172,44 @@
 		return $this->post($this->transaction, $postData);
 	}
 	
-	protected function transactionInsert ($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName) {
+	protected function transactionInsert ($feature, $featureType, $authWfsConfElement, $gml, $geomColumnName) {
+		$featureTypeName = $featureType->name;
+		$ns = $this->getNamespace($featureTypeName);
+		
 		// authentication
 		$authSegment = "";
 		if (!is_null($authWfsConfElement)) {
 			$user = eval("return " . $authWfsConfElement->authVarname . ";");
-			$authSegment = "<$authWfsConfElement->name>$user</$authWfsConfElement->name>";
+			$authSegment = "<$ns:{$authWfsConfElement->name}>$user</$ns:{$authWfsConfElement->name}>";
 		}
 
 		// add properties
 		$propertiesSegment = "";
 		foreach ($feature->properties as $key => $value) {
 			if (isset($value)) {
-				$propertiesSegment .= "<$key><![CDATA[$value]]></$key>";
+				$propertiesSegment .= "<$ns:$key><![CDATA[$value]]></$ns:$key>";
 			}
 		}
 
 		// add spatial data
-		$geomSegment = "<$geomColumnName>" . $gml . "</$geomColumnName>";
+		$geomSegment = "<$ns:$geomColumnName>" . $gml . "</$ns:$geomColumnName>";
 
 		return "<wfs:Insert><$featureTypeName>" . $authSegment . 
 				$propertiesSegment . $geomSegment . 
 				"</$featureTypeName></wfs:Insert>";
 	}
 	
-	protected function transactionUpdate ($feature, $featureTypeName, $authWfsConfElement, $gml, $geomColumnName) {
+	protected function transactionUpdate ($feature, $featureType, $authWfsConfElement, $gml, $geomColumnName) {
+		$featureTypeName = $featureType->name;
+		$featureNS = $this->getNameSpace($featureType->name);
+
 		// authentication
 		$authSegment = "";
 		if (!is_null($authWfsConfElement)) {
 			$user = eval("return " . $authWfsConfElement->authVarname . ";");
 			$authSegment = "<ogc:PropertyIsEqualTo><ogc:PropertyName>" . 
-				$authWfsConfElement->name . "</ogc:PropertyName><ogc:Literal>" . 
+				$featureNS . ":" . $authWfsConfElement->name . 
+				"</ogc:PropertyName><ogc:Literal>" . 
 				$user . "</ogc:Literal></ogc:PropertyIsEqualTo>";
 
 		}
@@ -205,7 +218,7 @@
 		$propertiesSegment = "";
 		foreach ($feature->properties as $key => $value) {
 			if (isset($value)) {
-				$propertiesSegment .= "<wfs:Property><wfs:Name>$key</wfs:Name>" . 
+				$propertiesSegment .= "<wfs:Property><wfs:Name>$featureNS:$key</wfs:Name>" . 
 					"<wfs:Value><![CDATA[$value]]></wfs:Value></wfs:Property>";
 			}
 		}
@@ -222,7 +235,7 @@
 		$filterSegment = "<ogc:Filter>" . $condition . "</ogc:Filter>";
 
 		// add geometry
-		$geomSegment = "<wfs:Property><wfs:Name>$geomColumnName</wfs:Name>" . 
+		$geomSegment = "<wfs:Property><wfs:Name>$featureNS:$geomColumnName</wfs:Name>" . 
 			"<wfs:Value>" . $gml . "</wfs:Value></wfs:Property>";
 					
 
@@ -236,13 +249,17 @@
 	protected function getFeatureIdFilter ($fid) {
 	}
 	
-	protected function transactionDelete ($feature, $featureTypeName, $authWfsConfElement) {
+	protected function transactionDelete ($feature, $featureType, $authWfsConfElement) {
+		$featureTypeName = $featureType->name;
+		$featureNS = $this->getNameSpace($featureType->name);
+		
 		// authentication
 		$authSegment = "";
 		if (!is_null($authWfsConfElement)) {
 			$user = eval("return " . $authWfsConfElement->authVarname . ";");
 			$authSegment = "<ogc:PropertyIsEqualTo><ogc:PropertyName>" . 
-				$authWfsConfElement->name . "</ogc:PropertyName><ogc:Literal>" . 
+				$featureNS . ":" . $authWfsConfElement->name . 
+				"</ogc:PropertyName><ogc:Literal>" . 
 				$user . "</ogc:Literal></ogc:PropertyIsEqualTo>";
 
 		}

Modified: trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2009-07-20 13:18:50 UTC (rev 4394)
+++ trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2009-07-20 13:36:46 UTC (rev 4395)
@@ -418,13 +418,19 @@
 // The coordinates come from the current client (?)
 //			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
 			var srs = mod_wfs_spatialRequest_epsg;
-			var filter = "<ogc:Filter xmlns:ogc=\"http://ogc.org\" xmlns:gml=\"http://www.opengis.net/gml\">";
+			var filter = "<ogc:Filter>";
 
+			var ftName = wfs_config[js_wfs_conf_id[i]]['featuretype_name'];
+			var pattern = /:[a-zA-Z_]+/;
+			var ftns = "";
+			if (ftName.match(pattern)) {
+				ftns = ftName.replace(pattern, ":");
+			}
 			if(buttonPolygon.filteroption=='within'){
 				filter += "<Within><ogc:PropertyName>";
 				for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 					if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
-						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+						filter += ftns + wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
 				filter += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
@@ -440,7 +446,7 @@
 				filter += "<Intersects><ogc:PropertyName>";
 				for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 					if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
-						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+						filter += ftns + wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
 				filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'>";
@@ -464,13 +470,20 @@
 // The coordinates come from the current client (?)
 //			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
 			var srs = mod_wfs_spatialRequest_epsg;
-			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
+			var filter = "<ogc:Filter>";
 
+			var ftName = wfs_config[js_wfs_conf_id[i]]['featuretype_name'];
+			var pattern = /:[a-zA-Z_]+/;
+			var ftns = "";
+			if (ftName.match(pattern)) {
+				ftns = ftName.replace(pattern, ":");
+			}
+
 			if(buttonRectangle.filteroption=='within'){
 				filter += "<Within><ogc:PropertyName>";
 				for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 					if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
-						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+						filter += ftns + wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
 				filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'>";
@@ -491,7 +504,7 @@
 				filter += "<Intersects><ogc:PropertyName>";
 				for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 					if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
-						filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+						filter += ftns + wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 					}
 				}
 				filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'>";
@@ -525,16 +538,25 @@
 		var realWorld2 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
 		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
 		var realWorld4 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
+		
+		
 		for(var i=0; i<js_wfs_conf_id.length; i++){
+
 // I guess we should use the SRS of the map client, not the WFS? 
 // The coordinates come from the current client (?)
 //			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
+			var ftName = wfs_config[js_wfs_conf_id[i]]['featuretype_name'];
+			var pattern = /:[a-zA-Z_]+/;
+			var ftns = "";
+			if (ftName.match(pattern)) {
+				ftns = ftName.replace(pattern, ":");
+			}
 			var srs = mod_wfs_spatialRequest_epsg;
-			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
+			var filter = "<ogc:Filter>";
 			filter += "<Intersects><ogc:PropertyName>";
 			for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
 				if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
-					filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+					filter += ftns + wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
 				}
 			}
 			filter += "</ogc:PropertyName><gml:Polygon srsName='"+srs+"'><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
@@ -705,9 +727,9 @@
 		for (var i = 0 ; i < geomArray.count(); i ++) {
 			if (geomArray.get(i).get(-1).isComplete()) {
 				listOfGeom += "\t<tr>\n\t\t<td style = 'color:blue;font-size:12px;cursor:pointer;'\n";
-				listOfGeom += "\t\t\t onmouseover='mb_wfs_perform(\"over\",geomArray.get("+i+"),resultHighlightColour);' ";
-				listOfGeom += " onmouseout='mb_wfs_perform(\"out\",geomArray.get("+i+"),resultHighlightColour)' ";
-				listOfGeom += " onclick='mb_wfs_perform(\"click\",geomArray.get("+i+"),resultHighlightColour); showWfs("+i+");' ";
+				listOfGeom += "\t\t\t onmouseover='mb_wfs_perform(\"over\",geomArray.get("+i+"), resultHighlightColour);' ";
+				listOfGeom += " onmouseout='mb_wfs_perform(\"out\",geomArray.get("+i+"), resultHighlightColour)' ";
+				listOfGeom += " onclick='mb_wfs_perform(\"click\",geomArray.get("+i+"), resultHighlightColour); showWfs("+i+");' ";
 				var geomName = getListTitle(geomArray.get(i));
 				//if (geomArray.get(i).geomType == geomType.polygon) {geomName += "(polygon)";}
 				//else if (geomArray.get(i).geomType == geomType.line) {geomName += "(line)";}
@@ -783,4 +805,4 @@
 		wfsPopup = new mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
 	}
 	wfsPopup.show();
-}
\ No newline at end of file
+}

Modified: trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php	2009-07-20 13:18:50 UTC (rev 4394)
+++ trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php	2009-07-20 13:36:46 UTC (rev 4395)
@@ -740,7 +740,14 @@
 			
 			var el = global_wfsConfObj[global_selectedWfsConfId].element;
 			var srs = global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
-		
+			var ftName = global_wfsConfObj[global_selectedWfsConfId].featuretype_name;
+
+			var pattern = /:[a-zA-Z_]+/;
+			var ftns = "";
+			if (ftName.match(pattern)) {
+				ftns = ftName.replace(pattern, ":");
+			}
+
 			for (var i = 0; i < el.length; i++) {
 				if (el[i]['f_search'] == 1){
 					if(el[i]['f_form_element_html'].match(/\<select/)){
@@ -768,7 +775,7 @@
 					for (var j=0; j < a.length; j++) {
 						if(el[i]['f_operator']=='bothside'){
 							orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>*";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -781,7 +788,7 @@
 					}
 						else if(el[i]['f_operator']=='rightside'){
 							orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -794,7 +801,7 @@
 						}
 						else if(el[i]['f_operator']=='greater_than'){
 							orConditions += "<ogc:PropertyIsGreaterThan>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -807,7 +814,7 @@
 						}
 						else if(el[i]['f_operator']=='less_than'){
 							orConditions += "<ogc:PropertyIsLessThan>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -820,7 +827,7 @@
 						}
 						else if(el[i]['f_operator']=='less_equal_than'){
 							orConditions += "<ogc:PropertyIsLessThanOrEqualTo>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -833,7 +840,7 @@
 						}
 						else if(el[i]['f_operator']=='greater_equal_than'){
 							orConditions += "<ogc:PropertyIsGreaterThanOrEqualTo>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -846,7 +853,7 @@
 						}
 						else if(el[i]['f_operator']=='equal'){
 							orConditions += "<ogc:PropertyIsEqualTo>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -859,7 +866,7 @@
 						}
 						else{
 							orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
-							orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+							orConditions += "<ogc:PropertyName>" + ftns + el[i]['element_name'] + "</ogc:PropertyName>";
 							orConditions += "<ogc:Literal>*";
 							if(el[i]['f_toupper'] == 1){
 								orConditions += a[j].toUpperCase();
@@ -887,8 +894,7 @@
 						currentAndCondition = "<Within><ogc:PropertyName>";
 						for (var j=0; j < el.length; j++) {
 							if(el[j]['f_geom']==1){
-								var elementName = el[j]['element_name'];
-								currentAndCondition += el[j]['element_name'];
+								currentAndCondition += ftns + el[j]['element_name'];								var elementName = el[j]['element_name'];
 							}
 						}
 						currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
@@ -904,8 +910,7 @@
 						currentAndCondition = "<Intersects><ogc:PropertyName>";
 						for (var j=0; j < el.length; j++) {
 							if(el[j]['f_geom']==1){
-								var elementName = el[j]['element_name'];
-								currentAndCondition += el[j]['element_name'];
+								currentAndCondition += ftns + el[j]['element_name'];								var elementName = el[j]['element_name'];
 							}
 						}
 						currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
@@ -926,8 +931,7 @@
 						currentAndCondition = "<Within><ogc:PropertyName>";
 						for (var j=0; j < el.length; j++) {
 							if(el[j]['f_geom']==1){
-								var elementName = el[j]['element_name'];
-								currentAndCondition += el[j]['element_name'];
+								currentAndCondition += ftns + el[j]['element_name'];								var elementName = el[j]['element_name'];
 							}
 						}
 						currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
@@ -948,8 +952,7 @@
 						currentAndCondition = "<Intersects><ogc:PropertyName>";
 						for (var j=0; j < el.length; j++) {
 							if(el[j]['f_geom']==1){
-								var elementName = el[j]['element_name'];
-								currentAndCondition += el[j]['element_name'];
+								currentAndCondition += ftns + el[j]['element_name'];								var elementName = el[j]['element_name'];
 							}
 						}
 						currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
@@ -982,8 +985,7 @@
 					currentAndCondition = "<Intersects><ogc:PropertyName>";
 					for (var j=0; j < el.length; j++) {
 						if(el[j]['f_geom']==1){
-							var elementName = el[j]['element_name'];
-							currentAndCondition += el[j]['element_name'];
+							currentAndCondition += ftns + el[j]['element_name'];
 						}
 					}
 					currentAndCondition += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";	
@@ -991,9 +993,6 @@
 					currentAndCondition += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1]; 
 					currentAndCondition += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects>";
 				}
-				//andConditions += "<ogc:Not><ogc:PropertyIsNull>";
-	            //andConditions += "<ogc:PropertyName>" + elementName + "</ogc:PropertyName>";
-	       		//andConditions += "</ogc:PropertyIsNull></ogc:Not>";
 				if (currentAndCondition !== "") {
 					andConditions.push(currentAndCondition);
 				}
@@ -1005,7 +1004,7 @@
 				andConditionString = "<And>" + andConditionString + "</And>";
 			}
 	
-			var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>"+andConditionString+"</ogc:Filter>";
+			var filter = "<ogc:Filter>"+andConditionString+"</ogc:Filter>";
 	
 			document.getElementById("res").innerHTML = "<table><tr><td><img src='"+progressIndicatorImg+"'></td><td>"+progressIndicatorText+"</td></tr></table>";
 			var parameters = {

Modified: trunk/mapbender/http/php/mod_wfs_result.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs_result.php	2009-07-20 13:18:50 UTC (rev 4394)
+++ trunk/mapbender/http/php/mod_wfs_result.php	2009-07-20 13:36:46 UTC (rev 4395)
@@ -46,6 +46,26 @@
  */
 function checkAccessConstraint($filter, $wfs_conf_id) {
 	/* wfs_conf_element */
+	$sql = "SELECT f.featuretype_name AS name FROM " . 
+		"wfs_featuretype AS f, wfs_conf AS c " . 
+		"WHERE c.wfs_conf_id = $1 AND " . 
+		"c.fkey_featuretype_id = f.featuretype_id";
+	$v = array($wfs_conf_id);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	$row = db_fetch_array($res);
+	if ($row) {
+		$ns = substr($row["name"], 0, strpos($row["name"], ":")) . ":";
+	}
+	else {
+		$ns = "";
+	}
+	
+	unset($sql);
+	unset($v);
+	unset($t);
+	unset($res);
+			
 	$sql = "SELECT * FROM wfs_conf_element ";
 	$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
 	$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
@@ -67,7 +87,9 @@
 		if (isValidVarName($auth_varname)) {
 			$user = eval("return " . $auth_varname . ";");
 			$pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)";
-			$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
+			$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . 
+				$ns . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . 
+				"</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3"; 
 			$filter = eregi_replace($pattern, $replacement, $filter);
 		}
 	}



More information about the Mapbender_commits mailing list