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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Mar 10 12:40:45 EDT 2009


Author: christoph
Date: 2009-03-10 12:40:45 -0400 (Tue, 10 Mar 2009)
New Revision: 3664

Modified:
   trunk/mapbender/http/classes/class_ows.php
   trunk/mapbender/http/classes/class_wfsToDb.php
   trunk/mapbender/http/classes/class_wfs_1_0_factory.php
   trunk/mapbender/http/classes/class_wfs_1_1_factory.php
   trunk/mapbender/http/classes/class_wfs_factory.php
   trunk/mapbender/http/php/mod_loadwfs.php
Log:
http://trac.osgeo.org/mapbender/ticket/393#comment:1

Modified: trunk/mapbender/http/classes/class_ows.php
===================================================================
--- trunk/mapbender/http/classes/class_ows.php	2009-03-10 16:10:58 UTC (rev 3663)
+++ trunk/mapbender/http/classes/class_ows.php	2009-03-10 16:40:45 UTC (rev 3664)
@@ -84,7 +84,7 @@
 	 * @param String $url
 	 * @return String the character "&", "?", or ""
 	 */
-	final protected function getConjunctionCharacter ($url) {
+	final public function getConjunctionCharacter ($url) {
 		// does the URL contain "?"
 		$pos = strpos($url, "?");
 

Modified: trunk/mapbender/http/classes/class_wfsToDb.php
===================================================================
--- trunk/mapbender/http/classes/class_wfsToDb.php	2009-03-10 16:10:58 UTC (rev 3663)
+++ trunk/mapbender/http/classes/class_wfsToDb.php	2009-03-10 16:40:45 UTC (rev 3664)
@@ -237,7 +237,6 @@
 			$aWfsFeatureTypeNamespace->value
 		);
 		$t = array("s", "s", "s", "s");
-		$e = new mb_exception($sql . " " . print_r($v, true));
 		$res = db_prep_query($sql, $v, $t);
 
 		if (!$res) {

Modified: trunk/mapbender/http/classes/class_wfs_1_0_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_0_factory.php	2009-03-10 16:10:58 UTC (rev 3663)
+++ trunk/mapbender/http/classes/class_wfs_1_0_factory.php	2009-03-10 16:40:45 UTC (rev 3664)
@@ -31,6 +31,16 @@
  */
 class Wfs_1_0_Factory extends WfsFactory {
 
+	protected function createFeatureTypeFromUrl ($aWfs, $featureTypeName) {
+		$url = $aWfs->describeFeatureType . 
+			$aWfs->getConjunctionCharacter($aWfs->describeFeatureType) . 
+			"&SERVICE=WFS&VERSION=" . $aWfs->getVersion() . 
+			"&REQUEST=DescribeFeatureType&TYPENAME=" . $featureTypeName;
+		
+		$xml = $this->get($url);
+		return $this->createFeatureTypeFromXml ($xml, $aWfs);
+	}
+		
 	protected function createFeatureTypeFromXml ($xml, $myWfs) {
 		$newFeatureType = new WfsFeatureType($myWfs);
 
@@ -150,7 +160,6 @@
 				}
 				if($tag == "FEATURETYPE" && $element[type] == "open"){
 					$section = "featuretype";
-					$featureTypeNsArray = $element[attributes];
 				}
 				if($section == "featuretype" && $tag == "NAME"){
 					$featuretype_name = $element[value];

Modified: trunk/mapbender/http/classes/class_wfs_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2009-03-10 16:10:58 UTC (rev 3663)
+++ trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2009-03-10 16:40:45 UTC (rev 3664)
@@ -31,6 +31,22 @@
  */
 class Wfs_1_1_Factory extends WfsFactory {
 
+	protected function createFeatureTypeFromUrl ($aWfs, $featureTypeName, $featureTypeNsArray) {
+		$postData = "<?xml version=\"1.0\"?>\n".
+				"<DescribeFeatureType version=\"" . $aWfs->getVersion() . "\" " . 
+				"service=\"WFS\" xmlns=\"http://www.opengis.net/wfs\" ";
+				
+		if ($featuretype_name != $this->sepNameSpace($featureTypeName)) {
+			$key = "xmlns:" . $this->getNameSpace($featureTypeName);
+			$postData .= $key . "=\"" . $featureTypeNsArray[$key] . "\" ";
+		}
+		$postData .= "><TypeName>" . $featureTypeName . "</TypeName>" . 
+				"</DescribeFeatureType>";
+
+		$xml = $this->post($aWfs->describeFeatureType, $postData);
+		return $this->createFeatureTypeFromXml ($xml, $aWfs);
+	}
+		
 	protected function createFeatureTypeFromXml ($xml, $myWfs) {
 		$newFeatureType = new WfsFeatureType($myWfs);
 

Modified: trunk/mapbender/http/classes/class_wfs_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_factory.php	2009-03-10 16:10:58 UTC (rev 3663)
+++ trunk/mapbender/http/classes/class_wfs_factory.php	2009-03-10 16:40:45 UTC (rev 3664)
@@ -49,20 +49,7 @@
 		throw new Exception("WFS version could not be determined from XML.");
 	}
 
-	protected function createFeatureTypeFromUrl ($aWfs, $featureTypeName, $featureTypeNsArray) {
-		$postData = "<?xml version=\"1.0\"?>\n".
-				"<DescribeFeatureType version=\"" . $aWfs->getVersion() . "\" " . 
-				"service=\"WFS\" xmlns=\"http://www.opengis.net/wfs\" ";
-				
-		if ($featuretype_name != $this->sepNameSpace($featureTypeName)) {
-			$key = "xmlns:" . $this->getNameSpace($featureTypeName);
-			$postData .= $key . "=\"" . $featureTypeNsArray[$key] . "\" ";
-		}
-		$postData .= "><TypeName>" . $featureTypeName . "</TypeName>" . 
-				"</DescribeFeatureType>";
-
-		$xml = $this->post($aWfs->describeFeatureType, $postData);
-		return $this->createFeatureTypeFromXml ($xml, $aWfs);
+	protected function createFeatureTypeFromUrl () {
 	}
 		
 	/**

Modified: trunk/mapbender/http/php/mod_loadwfs.php
===================================================================
--- trunk/mapbender/http/php/mod_loadwfs.php	2009-03-10 16:10:58 UTC (rev 3663)
+++ trunk/mapbender/http/php/mod_loadwfs.php	2009-03-10 16:40:45 UTC (rev 3664)
@@ -28,12 +28,12 @@
 $guiList = mb_validateInput($_REQUEST["guiList"]);
 $url = mb_validateInput($_REQUEST["xml_file"]);
 
-
 $myWfsFactory = new UniversalWfsFactory();
 $myWfs = $myWfsFactory->createFromUrl($url);      
 
 if (is_null($myWfs)) {
 	echo "WFS could not be uploaded.";
+	die;
 }
 $myWfs->insertOrUpdate();
 



More information about the Mapbender_commits mailing list