Explorar o código

added p5:web_link for se table in wfs DescribeFeatureTypeAdvanced

Piotr Labudda %!s(int64=9) %!d(string=hai) anos
pai
achega
285e3ca3b2
Modificáronse 1 ficheiros con 27 adicións e 12 borrados
  1. 27 12
      SE/se-lib/Api/WfsServerBase.php

+ 27 - 12
SE/se-lib/Api/WfsServerBase.php

@@ -65,18 +65,12 @@ class Api_WfsServerBase {
 	*/
 	public function getAclFromTypeName($typeName) {
 		$typeEx = explode(':', $typeName);
-		if (2 != count($typeEx)) {
-			throw new Api_WfsException("Could not get acl for '{$typeName}' - syntax error");
-		}
-		if ('p5_' != substr($typeEx[0], 0, 3)) {
-			throw new Api_WfsException("Could not get acl for '{$typeName}' - prefix error");
-		}
+		if (2 != count($typeEx)) throw new Api_WfsException("Could not get acl for '{$typeName}' - syntax error");
+		if ('p5_' != substr($typeEx[0], 0, 3)) throw new Api_WfsException("Could not get acl for '{$typeName}' - prefix error");
 		$sourceName = substr($typeEx[0], 3);
 		$objName = $typeEx[1];
 		$acl = $this->_usrAcl->getObjectAcl($sourceName, $objName);
-		if (!$acl) {
-			throw new Api_WfsException("Could not get acl for '{$typeName}'");
-		}
+		if (!$acl) throw new Api_WfsException("Could not get acl for '{$typeName}'");
 		$forceTblAclInit = 0;//('1' == V::get('_force', '', $_GET));
 		$acl->init($forceTblAclInit);
 		return $acl;
@@ -379,9 +373,10 @@ class Api_WfsServerBase {
 
 	public function _getXmlNamespaceList() {
 		$baseNsUri = $this->getBaseNamespaceUri();
-		$ns = 'p5_default_db';
-		$uri = "{$baseNsUri}/default_db";
-		return 'xmlns:' . $ns . '="' . $uri . '"';
+		$listNs = array();
+		$listNs[] = 'xmlns:p5_default_db="' . $baseNsUri . '/default_db"';
+		// $listNs[] = 'xmlns:p5_objects="' . $baseNsUri . '/objects"';
+		return implode("\n", $listNs);
 	}
 
 	public function _getXmlNamespaceList__OLD() {
@@ -547,6 +542,22 @@ class Api_WfsServerBase {
 			$featureType['LatLongBoundingBox']['maxy'] = "41.31378404137082";
 			$featureTypes[$tblName] = $featureType;
 		}
+
+		if(0){// add p5_objects:File
+			Lib::loadClass('FileStorage');
+			$featureType = array();
+			$featureType['ns'] = "p5_objects";
+			$featureType['Title'] = "Pliki";
+			$featureType['Abstract'] = "Pliki";
+			$featureType['Keywords'] = "Pliki";
+			$featureType['SRS'] = "EPSG:4326";
+			// $featureType['LatLongBoundingBox'] = array();// TODO: feature LatLongBoundingBox
+			// $featureType['LatLongBoundingBox']['minx'] = "8.12328509871721";
+			// $featureType['LatLongBoundingBox']['miny'] = "38.8575126897477";
+			// $featureType['LatLongBoundingBox']['maxx'] = "9.838674658246807";
+			// $featureType['LatLongBoundingBox']['maxy'] = "41.31378404137082";
+			$featureTypes['File'] = $featureType;
+		}
 		/*
 			<FeatureType>
 				<Name>ppr06:AMBITIPAESAGGIO</Name>
@@ -1435,6 +1446,10 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 			$cTypeNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:complexType');
 			$rootNode->appendChild($cTypeNode);
 			$cTypeNode->setAttribute('name', $typeName);
+			if (!$simple) {
+				$idZasob = $acl->getID();
+				$cTypeNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:web_link", Request::getPathUri() . "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$idZasob}");
+			}
 
 			$cConNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:complexContent');
 			$cTypeNode->appendChild($cConNode);