[Mapbender-commits] r9575 - in trunk/mapbender/http: classes geoportal/metadata_templates php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Sep 5 07:24:32 PDT 2016


Author: pschmidt
Date: 2016-09-05 07:24:31 -0700 (Mon, 05 Sep 2016)
New Revision: 9575

Added:
   trunk/mapbender/http/classes/class_XmlBuilder.php
   trunk/mapbender/http/classes/class_XpathWalker.php
   trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire_orig.xml
   trunk/mapbender/http/php/mod_featuretypeISOMetadata.php
Modified:
   trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml
   trunk/mapbender/http/php/mod_showMetadata.php
   trunk/mapbender/http/php/wfs.php
Log:
add inspire support for wfs

Added: trunk/mapbender/http/classes/class_XmlBuilder.php
===================================================================
--- trunk/mapbender/http/classes/class_XmlBuilder.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_XmlBuilder.php	2016-09-05 14:24:31 UTC (rev 9575)
@@ -0,0 +1,171 @@
+<?php
+# License:
+# Copyright (c) 2009, Open Source Geospatial Foundation
+# This program is dual licensed under the GNU General Public License 
+# and Simplified BSD license.  
+# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+
+require_once dirname(__FILE__)."/class_XpathWalker.php";
+
+class XmlBuilder
+{
+    const BR_ST  = "[";
+    const BR_END = "]";
+    const DP     = ":";
+    const DP_2   = "::";
+    const AT     = "@";
+    const SLASH  = '/';
+    const TEXT   = 'text()';
+
+    protected $doc;
+    protected $xpath;
+    protected $namespaces;
+
+    public function __construct(DOMDocument $doc, $namespaces = array())
+    {
+        $this->doc        = $doc;
+        $this->xpath      = new DOMXpath($this->doc);
+        $this->xpath->registerNamespace("xs", "http://www.w3.org/2001/XMLSchema");
+        $this->namespaces = array("xs" => "http://www.w3.org/2001/XMLSchema");
+        $namespaceList    = $this->xpath->query("//namespace::*");
+        foreach ($namespaceList as $namespaceNode) {
+            $namespaces[$namespaceNode->localName] = $namespaceNode->nodeValue;
+        }
+        foreach ($namespaces as $prefix => $uri) {
+            $this->namespaces[$prefix] = $uri;
+            $this->xpath->registerNamespace($prefix, $uri);
+        }
+    }
+
+    public function getDoc()
+    {
+        return $this->doc;
+    }
+
+    public function addValue(DOMNode $context, $xpathStr, $value)
+    {
+        $walker = new XpathWalker($xpathStr);
+        // find a first existing node
+        $node   = $this->findNode($context, $walker);
+        if ($node === null) {
+            return false;
+        } elseif ($walker->isLastNode()) {
+            return $this->setValue($node, $value);
+        }
+        $node = $this->createNode($context, $walker, $node, $value);
+        // $walker->isLastNode() -> is only a last node
+        if (!$walker->isAdded()) {
+            return $this->setValue($node, $value);
+        } else {
+            return $walker->isAdded();
+        }
+    }
+
+    private function findNode(DOMNode $context, XpathWalker $walker)
+    {
+        $node = null;
+        while (!($node = $this->xpath->query($walker->getCurrent(), $context)->item(0))) {
+            if (!$walker->toRoot()) {
+                break;
+            }
+        }
+        return $node;
+    }
+
+    private function createNode(DOMNode $context, XpathWalker $walker, DOMNode $node, $value)
+    {
+        while (!$walker->isLastNode()) {
+            $this->addNode($context, $node, $walker, $value);
+            $node = $this->xpath->query($walker->getCurrent(), $context)->item(0);
+        }
+        return $node;
+    }
+
+    private function setValue(DOMNode $node, $value)
+    {
+        if ($node->nodeType == XML_ATTRIBUTE_NODE) {
+            $node->value = $this->getString($value); // TODO validate $value: is $value is not null...
+        } else if ($node->nodeType == XML_TEXT_NODE) {
+            $node->parentNode->nodeValue = $this->getString($value);
+        } else if ($node->nodeType == XML_ELEMENT_NODE) {
+            if (is_string($value)) {
+                $node->nodeValue = $this->getString($value);
+            } elseif ($value instanceof DOMAttr) {
+                $node->setAttributeNode($this->doc->importNode($value, true));
+            } elseif ($value instanceof DOMElement) {
+                $node->appendChild($this->doc->importNode($value, true));
+            } elseif ($value instanceof DOMNodeList) {
+                foreach ($value as $element) {
+                    if ($element instanceof DOMElement) {
+                        $this->setValue($node, $element);
+                    }
+                }
+            } else {
+                throw new Exception('A value type is not implemented yet');
+            }
+        } else if ($node->nodeType == XML_CDATA_SECTION_NODE) {
+            $node->parentNode->nodeValue = $value;
+        } else {
+            return false;
+        }
+        return true;
+    }
+
+    private function addNode(DOMNode $context, DOMElement $node, XpathWalker $walker, $value)
+    {
+        $nextChunk = $walker->getNext();
+        if ($nextChunk === self::TEXT) { // text(), only last chunk
+            $node->nodeValue = $this->getString($value);
+            $walker->setAdded()->fromRoot();
+        } elseif (strpos($nextChunk, self::AT) === 0) { // @, only last chunk
+            $this->setAttribute($node, $walker, $nextChunk, $value);
+            $walker->setAdded()->fromRoot();
+        } elseif (strpos($nextChunk, self::BR_ST) !== false) { // [num] or [expression], break by expression
+            $help = explode(self::BR_ST, $nextChunk);
+            $int  = substr($help[1], 0, strpos($help[1], self::BR_END));
+            if (ctype_digit($int)) {
+                $num   = intval($int);
+                $xpath = $walker->getCurrent();
+                $i     = $num;
+                for (; $i > 0; $i--) {
+                    if ($this->xpath->query($xpath . self::BR_ST . $i . self::BR_END, $context)->item(0)) {
+                        break;
+                    }
+                }
+                for (; $i < $num + 1; $i++) {
+                    $this->addElement($node, $help[0]);
+                }
+                $walker->fromRoot();
+            }
+        } elseif (strpos($nextChunk, self::DP_2) !== false) { // ::
+            throw new Exception('A "next" "::" is not implemented yet');
+        } elseif (strpos($nextChunk, self::DP) !== false) { // :, element
+            $this->addElement($node, $nextChunk);
+            $walker->fromRoot();
+        } else {
+            throw new Exception('A "next" type is not implemented yet');
+        }
+    }
+
+    private function addElement(DOMElement $node, $xpathChunk)//, $value)
+    {
+        $help = explode(self::DP, $xpathChunk);
+        $node->appendChild(new DOMElement($xpathChunk, '', $this->namespaces[$help[0]]));
+    }
+
+    private function setAttribute(DOMElement $node, XpathWalker $walker, $xpathChunk, $value)
+    {
+        $qualified = substr($xpathChunk, 1);
+        $help      = explode(self::DP, $qualified);
+        if (count($help) === 2) { // with prefix
+            $node->setAttributeNS($this->namespaces[$help[0]], $qualified, $this->getString($value));
+        } else {
+            $node->setAttribute($qualified, $this->getString($value));
+        }
+    }
+
+    private function getString($value)
+    {
+        return htmlspecialchars($value ? $value : '');
+    }
+}
\ No newline at end of file

Added: trunk/mapbender/http/classes/class_XpathWalker.php
===================================================================
--- trunk/mapbender/http/classes/class_XpathWalker.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_XpathWalker.php	2016-09-05 14:24:31 UTC (rev 9575)
@@ -0,0 +1,71 @@
+<?php
+# License:
+# Copyright (c) 2009, Open Source Geospatial Foundation
+# This program is dual licensed under the GNU General Public License 
+# and Simplified BSD license.  
+# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+
+class XpathWalker
+{
+    protected $xpath;
+    protected $pointer;
+    protected $created;
+
+    public function __construct($xpath)
+    {
+        $this->xpath   = explode(XmlBuilder::SLASH, $xpath);
+        $this->pointer = count($this->xpath) - 1;
+        $this->added   = false;
+    }
+
+    public function getCurrent()
+    {
+        return implode(XmlBuilder::SLASH, array_slice($this->xpath, 0, $this->pointer + 1));
+    }
+
+    public function toRoot()
+    {
+        if ($this->pointer === 0) {
+            return false;
+        } else {
+            $this->pointer--;
+            return true;
+        }
+    }
+
+    public function fromRoot()
+    {
+        if ($this->pointer === count($this->xpath) - 1) {
+            return false;
+        } else {
+            $this->pointer++;
+            return true;
+        }
+    }
+
+    public function isLastNode()
+    {
+        return count($this->xpath) - 1 === $this->pointer;
+    }
+
+    public function getNext()
+    {
+        return !$this->isLastNode() ? $this->xpath[$this->pointer + 1] : null;
+    }
+
+    public function isNextLast()
+    {
+        return count($this->xpath) - 1 === $this->pointer + 1;
+    }
+
+    public function setAdded()
+    {
+        $this->added = true;
+        return $this;
+    }
+
+    public function isAdded()
+    {
+        $this->added;
+    }
+}
\ No newline at end of file

Modified: trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml	2016-09-05 14:24:24 UTC (rev 9574)
+++ trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire.xml	2016-09-05 14:24:31 UTC (rev 9575)
@@ -1,481 +1,241 @@
 <?xml version="1.0" encoding="UTF-8"?>
-  <gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
+<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
     <gmd:fileIdentifier>
-      <!-- Identifier of service metadata record (featuretype_uuid) -->
-      <gco:CharacterString>metadata_identifier_uuid</gco:CharacterString>
+        <!-- Identifier of service metadata record (featuretype_uuid) -->
+        <gco:CharacterString>metadata_identifier_uuid</gco:CharacterString>
     </gmd:fileIdentifier>
     <gmd:language>
-      <gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2" codeListValue="ger">Deutsch</gmd:LanguageCode>
+        <gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2" codeListValue="ger">Deutsch</gmd:LanguageCode>
     </gmd:language>
     <gmd:characterSet>
-      <gmd:MD_CharacterSetCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CharacterSetCode" codeListValue="utf8">utf8</gmd:MD_CharacterSetCode>
+        <gmd:MD_CharacterSetCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CharacterSetCode" codeListValue="utf8">utf8</gmd:MD_CharacterSetCode>
     </gmd:characterSet>
     <gmd:hierarchyLevel>
-      <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="service">service</gmd:MD_ScopeCode>
+        <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="service">service</gmd:MD_ScopeCode>
     </gmd:hierarchyLevel>
     <gmd:hierarchyLevelName>
-      <gco:CharacterString>Downloadservice</gco:CharacterString>
+        <gco:CharacterString>Downloadservice</gco:CharacterString>
     </gmd:hierarchyLevelName>
     <gmd:contact>
-      <gmd:CI_ResponsibleParty>
-        <gmd:individualName>
-          <gco:CharacterString>Name of responsible person</gco:CharacterString>
-        </gmd:individualName>
-        <gmd:organisationName>
-          <gco:CharacterString>Name of responsible organization</gco:CharacterString>
-        </gmd:organisationName>
-        <gmd:contactInfo>
-          <gmd:CI_Contact>
-            <gmd:address>
-              <gmd:CI_Address>
-                <gmd:deliveryPoint>
-                  <gco:CharacterString>Musterstraße 10</gco:CharacterString>
-                </gmd:deliveryPoint>
-                <gmd:city>
-                  <gco:CharacterString>Musterstadt</gco:CharacterString>
-                </gmd:city>
-                <gmd:postalCode>
-                  <gco:CharacterString>11111</gco:CharacterString>
-                </gmd:postalCode>
-                <gmd:country>
-                  <gco:CharacterString>Deutschland</gco:CharacterString>
-                </gmd:country>
-                <gmd:electronicMailAddress>
-                  <gco:CharacterString>test at test.de</gco:CharacterString>
-                </gmd:electronicMailAddress>
-              </gmd:CI_Address>
-            </gmd:address>
-            <gmd:onlineResource>
-              <gmd:CI_OnlineResource>
-                <gmd:linkage>
-                  <gmd:URL>Url to homepage of responsible organization</gmd:URL>
-                </gmd:linkage>
-              </gmd:CI_OnlineResource>
-            </gmd:onlineResource>
-          </gmd:CI_Contact>
-        </gmd:contactInfo>
-        <gmd:role>
-          <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
-        </gmd:role>
-      </gmd:CI_ResponsibleParty>
+        <gmd:CI_ResponsibleParty>
+            <gmd:individualName>
+                <gco:CharacterString>Name of responsible person</gco:CharacterString>
+            </gmd:individualName>
+            <gmd:organisationName>
+                <gco:CharacterString>Name of responsible organization</gco:CharacterString>
+            </gmd:organisationName>
+            <gmd:contactInfo>
+                <gmd:CI_Contact>
+                    <gmd:address>
+                        <gmd:CI_Address>
+                            <gmd:deliveryPoint>
+                                <gco:CharacterString>Musterstraße 10</gco:CharacterString>
+                            </gmd:deliveryPoint>
+                            <gmd:city>
+                                <gco:CharacterString>Musterstadt</gco:CharacterString>
+                            </gmd:city>
+                            <gmd:postalCode>
+                                <gco:CharacterString>11111</gco:CharacterString>
+                            </gmd:postalCode>
+                            <gmd:country>
+                                <gco:CharacterString>Deutschland</gco:CharacterString>
+                            </gmd:country>
+                            <gmd:electronicMailAddress>
+                                <gco:CharacterString>test at test.de</gco:CharacterString>
+                            </gmd:electronicMailAddress>
+                        </gmd:CI_Address>
+                    </gmd:address>
+                    <gmd:onlineResource>
+                        <gmd:CI_OnlineResource>
+                            <gmd:linkage>
+                                <gmd:URL>Url to homepage of responsible organization</gmd:URL>
+                            </gmd:linkage>
+                        </gmd:CI_OnlineResource>
+                    </gmd:onlineResource>
+                </gmd:CI_Contact>
+            </gmd:contactInfo>
+            <gmd:role>
+                <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
+            </gmd:role>
+        </gmd:CI_ResponsibleParty>
     </gmd:contact>
     <gmd:dateStamp>
-      <!-- Date of metadata record - last changed -->
-      <gco:Date>2000-01-01</gco:Date>
+        <!-- Date of metadata record - last changed -->
+        <gco:Date>2000-01-01</gco:Date>
     </gmd:dateStamp>
     <gmd:metadataStandardName>
-      <gco:CharacterString>ISO 19115 - Geographic Information - Metadata; Metadatenprofil der GDI Bayern</gco:CharacterString>
+        <gco:CharacterString>ISO 19115 - Geographic Information - Metadata</gco:CharacterString>
     </gmd:metadataStandardName>
     <gmd:metadataStandardVersion>
-      <gco:CharacterString>ISO 19115:2003/Cor. 1:2006; ISO 19119:2005/Amd 1:2008</gco:CharacterString>
+        <gco:CharacterString>ISO 19115:2003/Cor. 1:2006; ISO 19119:2005/Amd 1:2008</gco:CharacterString>
     </gmd:metadataStandardVersion>
     <!-- List of supported CRS for featuretype - maybe more than one -->
-    <gmd:referenceSystemInfo>
-      <gmd:MD_ReferenceSystem>
-        <gmd:referenceSystemIdentifier>
-          <gmd:RS_Identifier>
-            <gmd:code>
-              <gco:CharacterString>31466</gco:CharacterString>
-            </gmd:code>
-            <gmd:codeSpace>
-              <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
-            </gmd:codeSpace>
-            <gmd:version>
-              <gco:CharacterString>7.8</gco:CharacterString>
-            </gmd:version>
-          </gmd:RS_Identifier>
-        </gmd:referenceSystemIdentifier>
-      </gmd:MD_ReferenceSystem>
+    <!--gmd:referenceSystemInfo>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>31466</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
     </gmd:referenceSystemInfo>
     <gmd:referenceSystemInfo>
-      <gmd:MD_ReferenceSystem>
-        <gmd:referenceSystemIdentifier>
-          <gmd:RS_Identifier>
-            <gmd:code>
-              <gco:CharacterString>25832</gco:CharacterString>
-            </gmd:code>
-            <gmd:codeSpace>
-              <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
-            </gmd:codeSpace>
-            <gmd:version>
-              <gco:CharacterString>7.8</gco:CharacterString>
-            </gmd:version>
-          </gmd:RS_Identifier>
-        </gmd:referenceSystemIdentifier>
-      </gmd:MD_ReferenceSystem>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>25832</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
     </gmd:referenceSystemInfo>
     <gmd:referenceSystemInfo>
-      <gmd:MD_ReferenceSystem>
-        <gmd:referenceSystemIdentifier>
-          <gmd:RS_Identifier>
-            <gmd:code>
-              <gco:CharacterString>4326</gco:CharacterString>
-            </gmd:code>
-            <gmd:codeSpace>
-              <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
-            </gmd:codeSpace>
-            <gmd:version>
-              <gco:CharacterString>7.8</gco:CharacterString>
-            </gmd:version>
-          </gmd:RS_Identifier>
-        </gmd:referenceSystemIdentifier>
-      </gmd:MD_ReferenceSystem>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>4326</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
     </gmd:referenceSystemInfo>
     <gmd:referenceSystemInfo>
-      <gmd:MD_ReferenceSystem>
-        <gmd:referenceSystemIdentifier>
-          <gmd:RS_Identifier>
-            <gmd:code>
-              <gco:CharacterString>4258</gco:CharacterString>
-            </gmd:code>
-            <gmd:codeSpace>
-              <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
-            </gmd:codeSpace>
-            <gmd:version>
-              <gco:CharacterString>7.8</gco:CharacterString>
-            </gmd:version>
-          </gmd:RS_Identifier>
-        </gmd:referenceSystemIdentifier>
-      </gmd:MD_ReferenceSystem>
-    </gmd:referenceSystemInfo>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>4258</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
+    </gmd:referenceSystemInfo-->
     <gmd:identificationInfo>
-      <!-- featuretype uuid as attribute -->
-      <srv:SV_ServiceIdentification uuid="eea97fc0-b6bf-11e1-afa6-0800200c9a66">
-        <gmd:citation>
-          <gmd:CI_Citation>
-            <gmd:title>
-	      <!-- WFS server title -->
-              <gco:CharacterString>WFS Server title</gco:CharacterString>
-            </gmd:title>
-            <gmd:date>
-              <gmd:CI_Date>
-                <gmd:date>
-                  <!-- WFS server timestamp -->
-                  <gco:Date>2001-01-01</gco:Date>
-                </gmd:date>
-                <gmd:dateType>
-                  <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
-                </gmd:dateType>
-              </gmd:CI_Date>
-            </gmd:date>
-            <gmd:identifier>
-              <gmd:MD_Identifier>
-                <gmd:code>
-		  <!-- featuretype uuid -->
-                  <gco:CharacterString>http://ww.geoportal.rlp.de/featuretype/eea97fc0-b6bf-11e1-afa6-0800200c9a66</gco:CharacterString>
-                </gmd:code>
-              </gmd:MD_Identifier>
-            </gmd:identifier>
-          </gmd:CI_Citation>
-        </gmd:citation>
-        <gmd:abstract>
-	  <!-- WFS server abstract + wfs_featuretype.abstract -->
-          <gco:CharacterString>WFS abstract</gco:CharacterString>
-        </gmd:abstract>
-        <gmd:pointOfContact>
-          <gmd:CI_ResponsibleParty>
-            <gmd:individualName>
-	      <!-- WFS contact information-->
-              <gco:CharacterString>Responsible party person for wfs</gco:CharacterString>
-            </gmd:individualName>
-            <gmd:organisationName>
-              <gco:CharacterString>Responsible party for wfs</gco:CharacterString>
-            </gmd:organisationName>
-            <gmd:contactInfo>
-              <gmd:CI_Contact>
-                <gmd:address>
-                  <gmd:CI_Address>
-                    <gmd:deliveryPoint>
-                      <gco:CharacterString>Address</gco:CharacterString>
-                    </gmd:deliveryPoint>
-                    <gmd:city>
-                      <gco:CharacterString>city</gco:CharacterString>
-                    </gmd:city>
-                    <gmd:administrativeArea>
-                      <gco:CharacterString>stateorprovince</gco:CharacterString>
-                    </gmd:administrativeArea>
-                    <gmd:postalCode>
-                      <gco:CharacterString>postcode</gco:CharacterString>
-                    </gmd:postalCode>
-                    <gmd:country>
-                      <gco:CharacterString>country</gco:CharacterString>
-                    </gmd:country>
-                    <gmd:electronicMailAddress>
-                      <gco:CharacterString>email</gco:CharacterString>
-                    </gmd:electronicMailAddress>
-                  </gmd:CI_Address>
-                </gmd:address>
-                <gmd:onlineResource>
-                  <gmd:CI_OnlineResource>
-                    <gmd:linkage>
-                      <gmd:URL>online resource</gmd:URL>
-                    </gmd:linkage>
-                  </gmd:CI_OnlineResource>
-                </gmd:onlineResource>
-              </gmd:CI_Contact>
-            </gmd:contactInfo>
-            <gmd:role>
-              <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
-            </gmd:role>
-          </gmd:CI_ResponsibleParty>
-        </gmd:pointOfContact>
-        <gmd:resourceMaintenance>
-          <gmd:MD_MaintenanceInformation>
-            <gmd:maintenanceAndUpdateFrequency>
-              <gmd:MD_MaintenanceFrequencyCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
-            </gmd:maintenanceAndUpdateFrequency>
-          </gmd:MD_MaintenanceInformation>
-        </gmd:resourceMaintenance>
-        <!--<gmd:graphicOverview>
-          <gmd:MD_BrowseGraphic>
-            <gmd:fileName>
-              <gco:CharacterString>not for wfs</gco:CharacterString>
-            </gmd:fileName>
-            <gmd:fileDescription>
-              <gco:CharacterString>Vorschaubild</gco:CharacterString>
-            </gmd:fileDescription>
-          </gmd:MD_BrowseGraphic>
-        </gmd:graphicOverview>-->
-        <gmd:descriptiveKeywords>
-          <gmd:MD_Keywords>
-            <gmd:keyword>
-              <gco:CharacterString>infoFeatureAccessService</gco:CharacterString>
-            </gmd:keyword>
-            <gmd:keyword>
-              <gco:CharacterString>keywords from featuretype and wfs ...</gco:CharacterString>
-            </gmd:keyword>
-          </gmd:MD_Keywords>
-        </gmd:descriptiveKeywords>        
-	<!-- TODO later also for wms from termsof use relation ######################################################################## -->
-        <gmd:resourceConstraints>
-          <gmd:MD_LegalConstraints>
-            <gmd:accessConstraints>
-              <gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="copyright">copyright</gmd:MD_RestrictionCode>
-            </gmd:accessConstraints>
-          </gmd:MD_LegalConstraints>
-        </gmd:resourceConstraints>
-        <gmd:resourceConstraints>
-          <gmd:MD_LegalConstraints>
-            <gmd:useLimitation>
-              <gco:CharacterString>Nutzungsbedingungen: Der Datensatz/Dienst steht unter der folgender Lizenz: Creative Commons Namensnennung (CC BY). Die Namensnennung hat in folgender Weise zu erfolgen: "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de".</gco:CharacterString>
-            </gmd:useLimitation>
-            <gmd:useConstraints>
-              <gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="license">license</gmd:MD_RestrictionCode>
-            </gmd:useConstraints>
-            <gmd:useConstraints>
-              <gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="otherRestrictions">otherRestrictions</gmd:MD_RestrictionCode>
-            </gmd:useConstraints>
-            <gmd:otherConstraints>
-              <gco:CharacterString>Nutzungsbedingungen: Der Datensatz/Dienst steht unter der folgender Lizenz: Creative Commons Namensnennung (CC BY). Die Namensnennung hat in folgender Weise zu erfolgen: "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de".</gco:CharacterString>
-            </gmd:otherConstraints>
-            <gmd:otherConstraints>
-              <gco:CharacterString>{ "id": "cc-by", "name": "Creative Commons Namensnennung (CC BY)", "quelle": "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de", "url": "http://creativecommons.org/licenses/by/3.0/deed.de" }</gco:CharacterString>
-            </gmd:otherConstraints>
-          </gmd:MD_LegalConstraints>
-        </gmd:resourceConstraints>
-        <gmd:resourceConstraints>
-          <gmd:MD_SecurityConstraints>
-            <gmd:classification>
-              <gmd:MD_ClassificationCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ClassificationCode" codeListValue="unclassified">unclassified</gmd:MD_ClassificationCode>
-            </gmd:classification>
-          </gmd:MD_SecurityConstraints>
-        </gmd:resourceConstraints>
-        <!-- ######################################################################## -->
-        <srv:serviceType>
-          <gco:LocalName>download</gco:LocalName>
-        </srv:serviceType>
-        <srv:serviceTypeVersion>
-          <gco:CharacterString>OGC:WFS X.X</gco:CharacterString>
-        </srv:serviceTypeVersion>
-        <srv:extent>
-          <gmd:EX_Extent>
-            <!--<gmd:description>
-              <gco:CharacterString>Bayern</gco:CharacterString>
-            </gmd:description>-->
-	    <!-- featuretype latlon bounding box -->
-            <gmd:geographicElement>
-              <gmd:EX_GeographicBoundingBox>
-                <gmd:westBoundLongitude>
-                  <gco:Decimal>-180.0</gco:Decimal>
-                </gmd:westBoundLongitude>
-                <gmd:eastBoundLongitude>
-                  <gco:Decimal>180.0</gco:Decimal>
-                </gmd:eastBoundLongitude>
-                <gmd:southBoundLatitude>
-                  <gco:Decimal>-90.0</gco:Decimal>
-                </gmd:southBoundLatitude>
-                <gmd:northBoundLatitude>
-                  <gco:Decimal>90.0</gco:Decimal>
-                </gmd:northBoundLatitude>
-              </gmd:EX_GeographicBoundingBox>
-            </gmd:geographicElement>
-          </gmd:EX_Extent>
-        </srv:extent>
-        <srv:couplingType>
-          <srv:SV_CouplingType codeList="./resources/codelist/gmxCodelists.xml#SV_CouplingType" codeListValue="tight">tight</srv:SV_CouplingType>
-        </srv:couplingType>
-        <srv:containsOperations>
-          <srv:SV_OperationMetadata>
-            <srv:operationName>
-              <gco:CharacterString>GetCapabilities</gco:CharacterString>
-            </srv:operationName>
-            <srv:DCP>
-              <srv:DCPList codeList="./resources/codelist/gmxCodelists.xml#DCPList" codeListValue="WebServices"/>
-            </srv:DCP>
-            <srv:connectPoint>
-              <gmd:CI_OnlineResource>
-                <gmd:linkage>
-	          <!-- proxy url to geoportal capabilities -->
-                  <gmd:URL>http://www.geoportal.rlp.de/registry/featuretype/id</gmd:URL>
-                </gmd:linkage>
-              </gmd:CI_OnlineResource>
-            </srv:connectPoint>
-          </srv:SV_OperationMetadata>
-        </srv:containsOperations>
-        <srv:operatesOn/>
-      </srv:SV_ServiceIdentification>
-      <!-- ######################################################################## -->
-    </gmd:identificationInfo>
-    <gmd:distributionInfo>
-      <gmd:MD_Distribution>
-        <gmd:distributionFormat>
-          <gmd:MD_Format>
-            <gmd:name gco:nilReason="missing"/>
-            <gmd:version gco:nilReason="missing"/>
-          </gmd:MD_Format>
-        </gmd:distributionFormat>
-	<!-- Contact information of service as done before -->
-        <gmd:distributor>
-          <gmd:MD_Distributor>
-            <gmd:distributorContact>
-              <gmd:CI_ResponsibleParty>
-                <gmd:individualName>
-                  <gco:CharacterString>Contact personal name</gco:CharacterString>
-                </gmd:individualName>
-                <gmd:organisationName>
-                  <gco:CharacterString>Contact organization name</gco:CharacterString>
-                </gmd:organisationName>
-                <gmd:contactInfo>
-                  <gmd:CI_Contact>
-                    <gmd:address>
-                      <gmd:CI_Address>
-                        <gmd:deliveryPoint>
-                          <gco:CharacterString>Address</gco:CharacterString>
-                        </gmd:deliveryPoint>
-                        <gmd:city>
-                          <gco:CharacterString>city</gco:CharacterString>
-                        </gmd:city>
-                        <gmd:administrativeArea>
-                          <gco:CharacterString>stateorprovince</gco:CharacterString>
-                        </gmd:administrativeArea>
-                        <gmd:postalCode>
-                          <gco:CharacterString>postcode</gco:CharacterString>
-                        </gmd:postalCode>
-                        <gmd:country>
-                          <gco:CharacterString>country</gco:CharacterString>
-                        </gmd:country>
-                        <gmd:electronicMailAddress>
-                          <gco:CharacterString>contactemail</gco:CharacterString>
-                        </gmd:electronicMailAddress>
-                      </gmd:CI_Address>
-                    </gmd:address>
-                    <gmd:onlineResource>
-                      <gmd:CI_OnlineResource>
-                        <gmd:linkage>
-                          <gmd:URL>onlineresource</gmd:URL>
-                        </gmd:linkage>
-                      </gmd:CI_OnlineResource>
-                    </gmd:onlineResource>
-                  </gmd:CI_Contact>
-                </gmd:contactInfo>
-                <gmd:role>
-                  <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
-                </gmd:role>
-              </gmd:CI_ResponsibleParty>
-            </gmd:distributorContact>
-<!--            <gmd:distributionOrderProcess>
-              <gmd:MD_StandardOrderProcess>
-                <gmd:fees>
-                  <gco:CharacterString>geldleistungsfrei</gco:CharacterString>
-                </gmd:fees>
-              </gmd:MD_StandardOrderProcess>
-            </gmd:distributionOrderProcess> -->
-          </gmd:MD_Distributor>
-        </gmd:distributor>
-        <gmd:transferOptions>
-          <gmd:MD_DigitalTransferOptions>
-            <gmd:onLine>
-              <gmd:CI_OnlineResource>
-                <gmd:linkage>
-                  <!-- proxy url to geoportal capabilities -->
-                  <gmd:URL>http://www.geoportal.rlp.de/registry/featuretype/id</gmd:URL>
-                </gmd:linkage>
-                <!--<gmd:applicationProfile>
-                  <gco:CharacterString>WFS-URL</gco:CharacterString>
-                </gmd:applicationProfile>
-                <gmd:name>
-                  <gco:CharacterString>URL des Dienstes</gco:CharacterString>
-                </gmd:name>
-                <gmd:description>
-                  <gco:CharacterString>URL des Dienstes</gco:CharacterString>
-                </gmd:description>-->
-                <gmd:function>
-                  <gmd:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
-                </gmd:function>
-              </gmd:CI_OnlineResource>
-            </gmd:onLine>
-          </gmd:MD_DigitalTransferOptions>
-        </gmd:transferOptions>
-      </gmd:MD_Distribution>
-    </gmd:distributionInfo>
-    <gmd:dataQualityInfo>
-      <gmd:DQ_DataQuality>
-        <gmd:scope>
-          <gmd:DQ_Scope>
-            <gmd:level>
-              <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="service">service</gmd:MD_ScopeCode>
-            </gmd:level>
-          </gmd:DQ_Scope>
-        </gmd:scope>
-	<!-- put in ref to ogc spec -->
-        <gmd:report>
-          <gmd:DQ_DomainConsistency>
-            <gmd:result>
-              <gmd:DQ_ConformanceResult>
-                <gmd:specification>
-                  <gmd:CI_Citation>
+        <!-- featuretype uuid as attribute -->
+        <srv:SV_ServiceIdentification uuid="">
+            <gmd:citation>
+                <gmd:CI_Citation>
                     <gmd:title>
-                      <gco:CharacterString>OpenGIS Web Feature Service 2.0 Interface Standard (OGC 09-025r1 and ISO/DIS 19142)</gco:CharacterString>
+                        <gco:CharacterString></gco:CharacterString>
                     </gmd:title>
-                    <gmd:date>
-                      <gmd:CI_Date>
-                        <gmd:date>
-                          <gco:Date>2010-11-02</gco:Date>
-                        </gmd:date>
-                        <gmd:dateType>
-                          <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
-                        </gmd:dateType>
-                      </gmd:CI_Date>
-                    </gmd:date>
-                  </gmd:CI_Citation>
-                </gmd:specification>
-                <!--<gmd:explanation>
-                  <gco:CharacterString>Der Dienst ist konform zum WFS 2.0 Standard (nicht zertifiziert).</gco:CharacterString>
-                </gmd:explanation>-->
-                <gmd:pass>
-                  <gco:Boolean>true</gco:Boolean>
-                </gmd:pass>
-              </gmd:DQ_ConformanceResult>
-            </gmd:result>
-          </gmd:DQ_DomainConsistency>
-        </gmd:report>
-        <gmd:lineage>
-          <gmd:LI_Lineage>
-            <gmd:statement>
-              <gco:CharacterString>WFS lineage</gco:CharacterString>
-            </gmd:statement>
-          </gmd:LI_Lineage>
-        </gmd:lineage>
-      </gmd:DQ_DataQuality>
-    </gmd:dataQualityInfo>
-  </gmd:MD_Metadata>
+                </gmd:CI_Citation>
+            </gmd:citation>
+            <gmd:abstract>
+                <!-- WFS server abstract + wfs_featuretype.abstract -->
+                <gco:CharacterString>WFS abstract</gco:CharacterString>
+            </gmd:abstract>
+            <gmd:pointOfContact>
+                <gmd:CI_ResponsibleParty>
+                    <gmd:individualName>
+                        <!-- WFS contact information-->
+                        <gco:CharacterString>Responsible party person for wfs</gco:CharacterString>
+                    </gmd:individualName>
+                    <gmd:organisationName>
+                        <gco:CharacterString>Responsible party for wfs</gco:CharacterString>
+                    </gmd:organisationName>
+                    <gmd:contactInfo>
+                        <gmd:CI_Contact>
+                            <gmd:address>
+                                <gmd:CI_Address>
+                                    <gmd:deliveryPoint>
+                                        <gco:CharacterString>Address</gco:CharacterString>
+                                    </gmd:deliveryPoint>
+                                    <gmd:city>
+                                        <gco:CharacterString>city</gco:CharacterString>
+                                    </gmd:city>
+                                    <gmd:administrativeArea>
+                                        <gco:CharacterString>stateorprovince</gco:CharacterString>
+                                    </gmd:administrativeArea>
+                                    <gmd:postalCode>
+                                        <gco:CharacterString>postcode</gco:CharacterString>
+                                    </gmd:postalCode>
+                                    <gmd:country>
+                                        <gco:CharacterString>country</gco:CharacterString>
+                                    </gmd:country>
+                                    <gmd:electronicMailAddress>
+                                        <gco:CharacterString>email</gco:CharacterString>
+                                    </gmd:electronicMailAddress>
+                                </gmd:CI_Address>
+                            </gmd:address>
+                            <gmd:onlineResource>
+                                <gmd:CI_OnlineResource>
+                                    <gmd:linkage>
+                                        <gmd:URL>online resource</gmd:URL>
+                                    </gmd:linkage>
+                                </gmd:CI_OnlineResource>
+                            </gmd:onlineResource>
+                        </gmd:CI_Contact>
+                    </gmd:contactInfo>
+                    <gmd:role>
+                        <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="publisher">publisher</gmd:CI_RoleCode>
+                    </gmd:role>
+                </gmd:CI_ResponsibleParty>
+            </gmd:pointOfContact>
+            <gmd:resourceMaintenance>
+                <gmd:MD_MaintenanceInformation>
+                    <gmd:maintenanceAndUpdateFrequency>
+                        <gmd:MD_MaintenanceFrequencyCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
+                    </gmd:maintenanceAndUpdateFrequency>
+                </gmd:MD_MaintenanceInformation>
+            </gmd:resourceMaintenance>
+            <!--<gmd:graphicOverview>
+              <gmd:MD_BrowseGraphic>
+                <gmd:fileName>
+                  <gco:CharacterString>not for wfs</gco:CharacterString>
+                </gmd:fileName>
+                <gmd:fileDescription>
+                  <gco:CharacterString>Vorschaubild</gco:CharacterString>
+                </gmd:fileDescription>
+              </gmd:MD_BrowseGraphic>
+            </gmd:graphicOverview>-->
+            <gmd:descriptiveKeywords>
+                <gmd:MD_Keywords>
+                    <gmd:keyword>
+                        <gco:CharacterString>infoFeatureAccessService</gco:CharacterString>
+                    </gmd:keyword>
+                </gmd:MD_Keywords>
+            </gmd:descriptiveKeywords>        
+            <gmd:resourceConstraints>
+                <gmd:MD_SecurityConstraints>
+                    <gmd:classification>
+                        <gmd:MD_ClassificationCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ClassificationCode" codeListValue="unclassified">unclassified</gmd:MD_ClassificationCode>
+                    </gmd:classification>
+                </gmd:MD_SecurityConstraints>
+            </gmd:resourceConstraints>
+
+
+
+
+        </srv:SV_ServiceIdentification>
+        <!-- ######################################################################## -->
+    </gmd:identificationInfo>
+    
+</gmd:MD_Metadata>

Added: trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire_orig.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire_orig.xml	                        (rev 0)
+++ trunk/mapbender/http/geoportal/metadata_templates/srv_wfs_inspire_orig.xml	2016-09-05 14:24:31 UTC (rev 9575)
@@ -0,0 +1,481 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
+    <gmd:fileIdentifier>
+        <!-- Identifier of service metadata record (featuretype_uuid) -->
+        <gco:CharacterString>metadata_identifier_uuid</gco:CharacterString>
+    </gmd:fileIdentifier>
+    <gmd:language>
+        <gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2" codeListValue="ger">Deutsch</gmd:LanguageCode>
+    </gmd:language>
+    <gmd:characterSet>
+        <gmd:MD_CharacterSetCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CharacterSetCode" codeListValue="utf8">utf8</gmd:MD_CharacterSetCode>
+    </gmd:characterSet>
+    <gmd:hierarchyLevel>
+        <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="service">service</gmd:MD_ScopeCode>
+    </gmd:hierarchyLevel>
+    <gmd:hierarchyLevelName>
+        <gco:CharacterString>Downloadservice</gco:CharacterString>
+    </gmd:hierarchyLevelName>
+    <gmd:contact>
+        <gmd:CI_ResponsibleParty>
+            <gmd:individualName>
+                <gco:CharacterString>Name of responsible person</gco:CharacterString>
+            </gmd:individualName>
+            <gmd:organisationName>
+                <gco:CharacterString>Name of responsible organization</gco:CharacterString>
+            </gmd:organisationName>
+            <gmd:contactInfo>
+                <gmd:CI_Contact>
+                    <gmd:address>
+                        <gmd:CI_Address>
+                            <gmd:deliveryPoint>
+                                <gco:CharacterString>Musterstraße 10</gco:CharacterString>
+                            </gmd:deliveryPoint>
+                            <gmd:city>
+                                <gco:CharacterString>Musterstadt</gco:CharacterString>
+                            </gmd:city>
+                            <gmd:postalCode>
+                                <gco:CharacterString>11111</gco:CharacterString>
+                            </gmd:postalCode>
+                            <gmd:country>
+                                <gco:CharacterString>Deutschland</gco:CharacterString>
+                            </gmd:country>
+                            <gmd:electronicMailAddress>
+                                <gco:CharacterString>test at test.de</gco:CharacterString>
+                            </gmd:electronicMailAddress>
+                        </gmd:CI_Address>
+                    </gmd:address>
+                    <gmd:onlineResource>
+                        <gmd:CI_OnlineResource>
+                            <gmd:linkage>
+                                <gmd:URL>Url to homepage of responsible organization</gmd:URL>
+                            </gmd:linkage>
+                        </gmd:CI_OnlineResource>
+                    </gmd:onlineResource>
+                </gmd:CI_Contact>
+            </gmd:contactInfo>
+            <gmd:role>
+                <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
+            </gmd:role>
+        </gmd:CI_ResponsibleParty>
+    </gmd:contact>
+    <gmd:dateStamp>
+        <!-- Date of metadata record - last changed -->
+        <gco:Date>2000-01-01</gco:Date>
+    </gmd:dateStamp>
+    <gmd:metadataStandardName>
+        <gco:CharacterString>ISO 19115 - Geographic Information - Metadata; Metadatenprofil der GDI Bayern</gco:CharacterString>
+    </gmd:metadataStandardName>
+    <gmd:metadataStandardVersion>
+        <gco:CharacterString>ISO 19115:2003/Cor. 1:2006; ISO 19119:2005/Amd 1:2008</gco:CharacterString>
+    </gmd:metadataStandardVersion>
+    <!-- List of supported CRS for featuretype - maybe more than one -->
+    <gmd:referenceSystemInfo>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>31466</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
+    </gmd:referenceSystemInfo>
+    <gmd:referenceSystemInfo>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>25832</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
+    </gmd:referenceSystemInfo>
+    <gmd:referenceSystemInfo>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>4326</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
+    </gmd:referenceSystemInfo>
+    <gmd:referenceSystemInfo>
+        <gmd:MD_ReferenceSystem>
+            <gmd:referenceSystemIdentifier>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>4258</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>EPSG geodesy parameters</gco:CharacterString>
+                    </gmd:codeSpace>
+                    <gmd:version>
+                        <gco:CharacterString>7.8</gco:CharacterString>
+                    </gmd:version>
+                </gmd:RS_Identifier>
+            </gmd:referenceSystemIdentifier>
+        </gmd:MD_ReferenceSystem>
+    </gmd:referenceSystemInfo>
+    <gmd:identificationInfo>
+        <!-- featuretype uuid as attribute -->
+        <srv:SV_ServiceIdentification uuid="eea97fc0-b6bf-11e1-afa6-0800200c9a66">
+            <gmd:citation>
+                <gmd:CI_Citation>
+                    <gmd:title>
+                        <!-- WFS server title -->
+                        <gco:CharacterString>WFS Server title</gco:CharacterString>
+                    </gmd:title>
+                    <gmd:date>
+                        <gmd:CI_Date>
+                            <gmd:date>
+                                <!-- WFS server timestamp -->
+                                <gco:Date>2001-01-01</gco:Date>
+                            </gmd:date>
+                            <gmd:dateType>
+                                <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
+                            </gmd:dateType>
+                        </gmd:CI_Date>
+                    </gmd:date>
+                    <gmd:identifier>
+                        <gmd:MD_Identifier>
+                            <gmd:code>
+                                <!-- featuretype uuid -->
+                                <gco:CharacterString>http://ww.geoportal.rlp.de/featuretype/eea97fc0-b6bf-11e1-afa6-0800200c9a66</gco:CharacterString>
+                            </gmd:code>
+                        </gmd:MD_Identifier>
+                    </gmd:identifier>
+                </gmd:CI_Citation>
+            </gmd:citation>
+            <gmd:abstract>
+                <!-- WFS server abstract + wfs_featuretype.abstract -->
+                <gco:CharacterString>WFS abstract</gco:CharacterString>
+            </gmd:abstract>
+            <gmd:pointOfContact>
+                <gmd:CI_ResponsibleParty>
+                    <gmd:individualName>
+                        <!-- WFS contact information-->
+                        <gco:CharacterString>Responsible party person for wfs</gco:CharacterString>
+                    </gmd:individualName>
+                    <gmd:organisationName>
+                        <gco:CharacterString>Responsible party for wfs</gco:CharacterString>
+                    </gmd:organisationName>
+                    <gmd:contactInfo>
+                        <gmd:CI_Contact>
+                            <gmd:address>
+                                <gmd:CI_Address>
+                                    <gmd:deliveryPoint>
+                                        <gco:CharacterString>Address</gco:CharacterString>
+                                    </gmd:deliveryPoint>
+                                    <gmd:city>
+                                        <gco:CharacterString>city</gco:CharacterString>
+                                    </gmd:city>
+                                    <gmd:administrativeArea>
+                                        <gco:CharacterString>stateorprovince</gco:CharacterString>
+                                    </gmd:administrativeArea>
+                                    <gmd:postalCode>
+                                        <gco:CharacterString>postcode</gco:CharacterString>
+                                    </gmd:postalCode>
+                                    <gmd:country>
+                                        <gco:CharacterString>country</gco:CharacterString>
+                                    </gmd:country>
+                                    <gmd:electronicMailAddress>
+                                        <gco:CharacterString>email</gco:CharacterString>
+                                    </gmd:electronicMailAddress>
+                                </gmd:CI_Address>
+                            </gmd:address>
+                            <gmd:onlineResource>
+                                <gmd:CI_OnlineResource>
+                                    <gmd:linkage>
+                                        <gmd:URL>online resource</gmd:URL>
+                                    </gmd:linkage>
+                                </gmd:CI_OnlineResource>
+                            </gmd:onlineResource>
+                        </gmd:CI_Contact>
+                    </gmd:contactInfo>
+                    <gmd:role>
+                        <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
+                    </gmd:role>
+                </gmd:CI_ResponsibleParty>
+            </gmd:pointOfContact>
+            <gmd:resourceMaintenance>
+                <gmd:MD_MaintenanceInformation>
+                    <gmd:maintenanceAndUpdateFrequency>
+                        <gmd:MD_MaintenanceFrequencyCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">asNeeded</gmd:MD_MaintenanceFrequencyCode>
+                    </gmd:maintenanceAndUpdateFrequency>
+                </gmd:MD_MaintenanceInformation>
+            </gmd:resourceMaintenance>
+            <!--<gmd:graphicOverview>
+              <gmd:MD_BrowseGraphic>
+                <gmd:fileName>
+                  <gco:CharacterString>not for wfs</gco:CharacterString>
+                </gmd:fileName>
+                <gmd:fileDescription>
+                  <gco:CharacterString>Vorschaubild</gco:CharacterString>
+                </gmd:fileDescription>
+              </gmd:MD_BrowseGraphic>
+            </gmd:graphicOverview>-->
+            <gmd:descriptiveKeywords>
+                <gmd:MD_Keywords>
+                    <gmd:keyword>
+                        <gco:CharacterString>infoFeatureAccessService</gco:CharacterString>
+                    </gmd:keyword>
+                    <gmd:keyword>
+                        <gco:CharacterString>keywords from featuretype and wfs ...</gco:CharacterString>
+                    </gmd:keyword>
+                </gmd:MD_Keywords>
+            </gmd:descriptiveKeywords>        
+            <!-- TODO later also for wms from termsof use relation ######################################################################## -->
+            <gmd:resourceConstraints>
+                <gmd:MD_LegalConstraints>
+                    <gmd:accessConstraints>
+                        <gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="copyright">copyright</gmd:MD_RestrictionCode>
+                    </gmd:accessConstraints>
+                </gmd:MD_LegalConstraints>
+            </gmd:resourceConstraints>
+            <gmd:resourceConstraints>
+                <gmd:MD_LegalConstraints>
+                    <gmd:useLimitation>
+                        <gco:CharacterString>Nutzungsbedingungen: Der Datensatz/Dienst steht unter der folgender Lizenz: Creative Commons Namensnennung (CC BY). Die Namensnennung hat in folgender Weise zu erfolgen: "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de".</gco:CharacterString>
+                    </gmd:useLimitation>
+                    <gmd:useConstraints>
+                        <gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="license">license</gmd:MD_RestrictionCode>
+                    </gmd:useConstraints>
+                    <gmd:useConstraints>
+                        <gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="otherRestrictions">otherRestrictions</gmd:MD_RestrictionCode>
+                    </gmd:useConstraints>
+                    <gmd:otherConstraints>
+                        <gco:CharacterString>Nutzungsbedingungen: Der Datensatz/Dienst steht unter der folgender Lizenz: Creative Commons Namensnennung (CC BY). Die Namensnennung hat in folgender Weise zu erfolgen: "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de".</gco:CharacterString>
+                    </gmd:otherConstraints>
+                    <gmd:otherConstraints>
+                        <gco:CharacterString>{ "id": "cc-by", "name": "Creative Commons Namensnennung (CC BY)", "quelle": "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de", "url": "http://creativecommons.org/licenses/by/3.0/deed.de" }</gco:CharacterString>
+                    </gmd:otherConstraints>
+                </gmd:MD_LegalConstraints>
+            </gmd:resourceConstraints>
+            <gmd:resourceConstraints>
+                <gmd:MD_SecurityConstraints>
+                    <gmd:classification>
+                        <gmd:MD_ClassificationCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ClassificationCode" codeListValue="unclassified">unclassified</gmd:MD_ClassificationCode>
+                    </gmd:classification>
+                </gmd:MD_SecurityConstraints>
+            </gmd:resourceConstraints>
+            <!-- ######################################################################## -->
+            <srv:serviceType>
+                <gco:LocalName>download</gco:LocalName>
+            </srv:serviceType>
+            <srv:serviceTypeVersion>
+                <gco:CharacterString>OGC:WFS X.X</gco:CharacterString>
+            </srv:serviceTypeVersion>
+            <srv:extent>
+                <gmd:EX_Extent>
+                    <!--<gmd:description>
+                      <gco:CharacterString>Bayern</gco:CharacterString>
+                    </gmd:description>-->
+                    <!-- featuretype latlon bounding box -->
+                    <gmd:geographicElement>
+                        <gmd:EX_GeographicBoundingBox>
+                            <gmd:westBoundLongitude>
+                                <gco:Decimal>-180.0</gco:Decimal>
+                            </gmd:westBoundLongitude>
+                            <gmd:eastBoundLongitude>
+                                <gco:Decimal>180.0</gco:Decimal>
+                            </gmd:eastBoundLongitude>
+                            <gmd:southBoundLatitude>
+                                <gco:Decimal>-90.0</gco:Decimal>
+                            </gmd:southBoundLatitude>
+                            <gmd:northBoundLatitude>
+                                <gco:Decimal>90.0</gco:Decimal>
+                            </gmd:northBoundLatitude>
+                        </gmd:EX_GeographicBoundingBox>
+                    </gmd:geographicElement>
+                </gmd:EX_Extent>
+            </srv:extent>
+            <srv:couplingType>
+                <srv:SV_CouplingType codeList="./resources/codelist/gmxCodelists.xml#SV_CouplingType" codeListValue="tight">tight</srv:SV_CouplingType>
+            </srv:couplingType>
+            <srv:containsOperations>
+                <srv:SV_OperationMetadata>
+                    <srv:operationName>
+                        <gco:CharacterString>GetCapabilities</gco:CharacterString>
+                    </srv:operationName>
+                    <srv:DCP>
+                        <srv:DCPList codeList="./resources/codelist/gmxCodelists.xml#DCPList" codeListValue="WebServices"/>
+                    </srv:DCP>
+                    <srv:connectPoint>
+                        <gmd:CI_OnlineResource>
+                            <gmd:linkage>
+                                <!-- proxy url to geoportal capabilities -->
+                                <gmd:URL>http://www.geoportal.rlp.de/registry/featuretype/id</gmd:URL>
+                            </gmd:linkage>
+                        </gmd:CI_OnlineResource>
+                    </srv:connectPoint>
+                </srv:SV_OperationMetadata>
+            </srv:containsOperations>
+            <srv:operatesOn/>
+        </srv:SV_ServiceIdentification>
+        <!-- ######################################################################## -->
+    </gmd:identificationInfo>
+    <gmd:distributionInfo>
+        <gmd:MD_Distribution>
+            <gmd:distributionFormat>
+                <gmd:MD_Format>
+                    <gmd:name gco:nilReason="missing"/>
+                    <gmd:version gco:nilReason="missing"/>
+                </gmd:MD_Format>
+            </gmd:distributionFormat>
+            <!-- Contact information of service as done before -->
+            <gmd:distributor>
+                <gmd:MD_Distributor>
+                    <gmd:distributorContact>
+                        <gmd:CI_ResponsibleParty>
+                            <gmd:individualName>
+                                <gco:CharacterString>Contact personal name</gco:CharacterString>
+                            </gmd:individualName>
+                            <gmd:organisationName>
+                                <gco:CharacterString>Contact organization name</gco:CharacterString>
+                            </gmd:organisationName>
+                            <gmd:contactInfo>
+                                <gmd:CI_Contact>
+                                    <gmd:address>
+                                        <gmd:CI_Address>
+                                            <gmd:deliveryPoint>
+                                                <gco:CharacterString>Address</gco:CharacterString>
+                                            </gmd:deliveryPoint>
+                                            <gmd:city>
+                                                <gco:CharacterString>city</gco:CharacterString>
+                                            </gmd:city>
+                                            <gmd:administrativeArea>
+                                                <gco:CharacterString>stateorprovince</gco:CharacterString>
+                                            </gmd:administrativeArea>
+                                            <gmd:postalCode>
+                                                <gco:CharacterString>postcode</gco:CharacterString>
+                                            </gmd:postalCode>
+                                            <gmd:country>
+                                                <gco:CharacterString>country</gco:CharacterString>
+                                            </gmd:country>
+                                            <gmd:electronicMailAddress>
+                                                <gco:CharacterString>contactemail</gco:CharacterString>
+                                            </gmd:electronicMailAddress>
+                                        </gmd:CI_Address>
+                                    </gmd:address>
+                                    <gmd:onlineResource>
+                                        <gmd:CI_OnlineResource>
+                                            <gmd:linkage>
+                                                <gmd:URL>onlineresource</gmd:URL>
+                                            </gmd:linkage>
+                                        </gmd:CI_OnlineResource>
+                                    </gmd:onlineResource>
+                                </gmd:CI_Contact>
+                            </gmd:contactInfo>
+                            <gmd:role>
+                                <gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
+                            </gmd:role>
+                        </gmd:CI_ResponsibleParty>
+                    </gmd:distributorContact>
+                    <!--            <gmd:distributionOrderProcess>
+                      <gmd:MD_StandardOrderProcess>
+                        <gmd:fees>
+                          <gco:CharacterString>geldleistungsfrei</gco:CharacterString>
+                        </gmd:fees>
+                      </gmd:MD_StandardOrderProcess>
+                    </gmd:distributionOrderProcess> -->
+                </gmd:MD_Distributor>
+            </gmd:distributor>
+            <gmd:transferOptions>
+                <gmd:MD_DigitalTransferOptions>
+                    <gmd:onLine>
+                        <gmd:CI_OnlineResource>
+                            <gmd:linkage>
+                                <!-- proxy url to geoportal capabilities -->
+                                <gmd:URL>http://www.geoportal.rlp.de/registry/featuretype/id</gmd:URL>
+                            </gmd:linkage>
+                            <!--<gmd:applicationProfile>
+                              <gco:CharacterString>WFS-URL</gco:CharacterString>
+                            </gmd:applicationProfile>
+                            <gmd:name>
+                              <gco:CharacterString>URL des Dienstes</gco:CharacterString>
+                            </gmd:name>
+                            <gmd:description>
+                              <gco:CharacterString>URL des Dienstes</gco:CharacterString>
+                            </gmd:description>-->
+                            <gmd:function>
+                                <gmd:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
+                            </gmd:function>
+                        </gmd:CI_OnlineResource>
+                    </gmd:onLine>
+                </gmd:MD_DigitalTransferOptions>
+            </gmd:transferOptions>
+        </gmd:MD_Distribution>
+    </gmd:distributionInfo>
+    <gmd:dataQualityInfo>
+        <gmd:DQ_DataQuality>
+            <gmd:scope>
+                <gmd:DQ_Scope>
+                    <gmd:level>
+                        <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode" codeListValue="service">service</gmd:MD_ScopeCode>
+                    </gmd:level>
+                </gmd:DQ_Scope>
+            </gmd:scope>
+            <!-- put in ref to ogc spec -->
+            <gmd:report>
+                <gmd:DQ_DomainConsistency>
+                    <gmd:result>
+                        <gmd:DQ_ConformanceResult>
+                            <gmd:specification>
+                                <gmd:CI_Citation>
+                                    <gmd:title>
+                                        <gco:CharacterString>OpenGIS Web Feature Service 2.0 Interface Standard (OGC 09-025r1 and ISO/DIS 19142)</gco:CharacterString>
+                                    </gmd:title>
+                                    <gmd:date>
+                                        <gmd:CI_Date>
+                                            <gmd:date>
+                                                <gco:Date>2010-11-02</gco:Date>
+                                            </gmd:date>
+                                            <gmd:dateType>
+                                                <gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="publication">publication</gmd:CI_DateTypeCode>
+                                            </gmd:dateType>
+                                        </gmd:CI_Date>
+                                    </gmd:date>
+                                </gmd:CI_Citation>
+                            </gmd:specification>
+                            <!--<gmd:explanation>
+                              <gco:CharacterString>Der Dienst ist konform zum WFS 2.0 Standard (nicht zertifiziert).</gco:CharacterString>
+                            </gmd:explanation>-->
+                            <gmd:pass>
+                                <gco:Boolean>true</gco:Boolean>
+                            </gmd:pass>
+                        </gmd:DQ_ConformanceResult>
+                    </gmd:result>
+                </gmd:DQ_DomainConsistency>
+            </gmd:report>
+            <gmd:lineage>
+                <gmd:LI_Lineage>
+                    <gmd:statement>
+                        <gco:CharacterString>WFS lineage</gco:CharacterString>
+                    </gmd:statement>
+                </gmd:LI_Lineage>
+            </gmd:lineage>
+        </gmd:DQ_DataQuality>
+    </gmd:dataQualityInfo>
+</gmd:MD_Metadata>

Added: trunk/mapbender/http/php/mod_featuretypeISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_featuretypeISOMetadata.php	                        (rev 0)
+++ trunk/mapbender/http/php/mod_featuretypeISOMetadata.php	2016-09-05 14:24:31 UTC (rev 9575)
@@ -0,0 +1,609 @@
+<?php
+//http://www.geoportal.rlp.de/mapbender/php/mod_featuretypeISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=24356
+// $Id: mod_layerISOMetadata.php 235
+// http://www.mapbender.org/index.php/Inspire_Metadata_Editor
+// 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+//Script to generate a conformant ISO19139 service metadata record for a wms layer which is registrated in the mapbender database. It works as a webservice
+//The record will be fulfill the demands of the INSPIRE metadata regulation from 03.12.2008 and the iso19139
+require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
+require_once(dirname(__FILE__) . "/../classes/class_connector.php");
+require_once(dirname(__FILE__) . "/../classes/class_administration.php");
+require_once(dirname(__FILE__) . "/../php/mod_validateInspire.php");
+require_once(dirname(__FILE__) . "/../classes/class_iso19139.php");
+require_once(dirname(__FILE__) . "/../classes/class_XmlBuilder.php");
+
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$admin = new administration();
+
+//define the view or table to use as input for metadata generation if this is wished. If not, the data will be directly read from the database tables
+$wmsView = "search_wfs_view";
+$wmsView = '';
+//parse request parameter
+//make all parameters available as upper case
+foreach($_REQUEST as $key => $val) {
+	$_REQUEST[strtoupper($key)] = $val;
+}
+//validate request params
+if (isset($_REQUEST['ID']) & $_REQUEST['ID'] != "") {
+	//validate integer
+	$testMatch = $_REQUEST["ID"];
+	$pattern = '/^[\d]*$/';		
+ 	if (!preg_match($pattern,$testMatch)){
+		// echo 'Id: <b>'.$testMatch.'</b> is not valid.<br/>'; 
+		echo 'Id is not valid (integer).<br/>'; 
+		die(); 		
+ 	}
+	$recordId = $testMatch;
+	$testMatch = NULL;
+}
+
+if ($_REQUEST['OUTPUTFORMAT'] == "iso19139" || $_REQUEST['OUTPUTFORMAT'] == "rdf" || $_REQUEST['OUTPUTFORMAT'] == 'html') {
+	//Initialize XML document
+	$iso19139Doc = new DOMDocument('1.0');
+	$iso19139Doc->encoding = 'UTF-8';
+	$iso19139Doc->preserveWhiteSpace = false;
+	$iso19139Doc->formatOutput = true;
+	$outputFormat = $_REQUEST['OUTPUTFORMAT'];
+    if (!@$iso19139Doc->load(
+            dirname(__FILE__) . "/../geoportal/metadata_templates/srv_wfs_inspire.xml",
+            LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NOENT | LIBXML_XINCLUDE)) {
+        echo 'A xml template is not found.<br/>'; 
+        die();
+    }
+    $xmlBuilder = new XmlBuilder($iso19139Doc);
+} else {
+	//echo 'outputFormat: <b>'.$_REQUEST['OUTPUTFORMAT'].'</b> is not set or valid.<br/>'; 
+	echo 'Parameter outputFormat is not set or valid (iso19139 | rdf | html).<br/>'; 
+	die();
+}
+
+if (!($_REQUEST['CN'] == "false")) {
+	//overwrite outputFormat for special headers:
+	switch ($_SERVER["HTTP_ACCEPT"]) {
+		case "application/rdf+xml":
+			$outputFormat="rdf";
+		break;
+		case "text/html":
+			$outputFormat="html";
+		break;
+		default:
+			$outputFormat="iso19139";
+		break;
+	}
+}
+
+//if validation is requested
+//
+if (isset($_REQUEST['VALIDATE']) and $_REQUEST['VALIDATE'] != "true") {
+	//echo 'validate: <b>'.$_REQUEST['VALIDATE'].'</b> is not valid.<br/>'; 
+	echo 'Parameter <b>validate</b> is not valid (true).<br/>'; 
+	die();
+}
+//some needfull functions to pull metadata out of the database!
+function fillISO19139(XmlBuilder $xmlBuilder, $recordId) {
+    global $wmsView;
+	global $admin;
+	//read out relevant information from mapbender database:
+	if ($wmsView != '') {
+		$sql = "SELECT * ";
+		$sql .= "FROM ".$wmsView." WHERE layer_id = $1";
+	}
+	else {
+		$sql = "SELECT"
+                . " ft.featuretype_id,ft.featuretype_name,ft.featuretype_title,ft.featuretype_abstract,ft.uuid"
+                . ",ft.featuretype_latlon_bbox as bbox"
+//                . ",ft.layer_pos,ft.layer_parent,ft.layer_minscale,ft.layer_maxscale"                                   ########## ft.layer_pos latlon_bbox ??
+//                
+                . ",wfs.uuid as wfs_uuid,wfs.wfs_title,wfs.wfs_abstract,wfs.wfs_id,wfs.fees,wfs.accessconstraints"
+                . ",wfs.individualname,wfs.positionname,wfs.providername,wfs.deliverypoint,wfs.city,wfs.wfs_timestamp"
+                . ",wfs.wfs_timestamp_create,wfs.wfs_owner,wfs.administrativearea,wfs.postalcode,wfs.voice"
+                . ",wfs.facsimile,wfs.wfs_owsproxy,wfs.electronicmailaddress,wfs.country,wfs.fkey_mb_group_id"
+                . ",wfs.wfs_version"
+                
+//                . ",ft_epsg.minx || ',' || ft_epsg.miny || ',' || ft_epsg.maxx || ',' || ft_epsg.maxy  as bbox"         ########## latlon_bbox
+                . " FROM"
+                . " wfs"
+                . ",wfs_featuretype ft"
+//                . ",wfs_featuretype_epsg ft_epsg"
+                . " WHERE featuretype_id = $1"
+                . " AND ft.fkey_wfs_id = wfs.wfs_id";
+	}
+	$v = array((integer)$recordId);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	$mbMeta = db_fetch_array($res);
+
+	//infos about the registrating department, check first if a special metadata point of contact is defined in the service table - function from mod_showMetadata - TODO: should be defined in admin class
+	if (!isset($mbMeta['fkey_mb_group_id']) || is_null($mbMeta['fkey_mb_group_id']) || $mbMeta['fkey_mb_group_id'] == 0){
+		$e = new mb_notice("mod_featuretypeISOMetadata.php: fkey_mb_group_id not found!");
+		//Get information about owning user of the relation mb_user_mb_group - alternatively the defined fkey_mb_group_id from the service must be used!
+		$sqlDep = "SELECT mb_group_name, mb_group_title, mb_group_id, mb_group_logo_path, mb_group_address, mb_group_email, mb_group_postcode, mb_group_city, mb_group_voicetelephone, mb_group_facsimiletelephone FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND c.mb_user_mb_group_type=2 LIMIT 1";
+		$vDep = array($mbMeta['wfs_owner']);
+		$tDep = array('i');
+		$resDep = db_prep_query($sqlDep, $vDep, $tDep);
+		$departmentMetadata = db_fetch_array($resDep);
+	} else {
+		$e = new mb_notice("mod_featuretypeISOMetadata.php: fkey_mb_group_id found!");
+		$sqlDep = "SELECT mb_group_name , mb_group_title, mb_group_id, mb_group_logo_path , mb_group_address, mb_group_email, mb_group_postcode, mb_group_city, mb_group_voicetelephone, mb_group_facsimiletelephone FROM mb_group WHERE mb_group_id = $1 LIMIT 1";
+		$vDep = array($mbMeta['fkey_mb_group_id']);
+		$tDep = array('i');
+		$resDep = db_prep_query($sqlDep, $vDep, $tDep);
+		$departmentMetadata = db_fetch_array($resDep);
+	}
+
+	//infos about the owner of the service - he is the man who administrate the metadata - register the service
+	$sql = "SELECT mb_user_email ";
+	$sql .= "FROM mb_user WHERE mb_user_id = $1";
+	$v = array((integer)$mapbenderMetadata['wfs_owner']);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	$userMetadata = db_fetch_array($res);
+
+	//check if resource is freely available to anonymous user - which are all users who search thru metadata catalogues:
+	$hasPermission=$admin->getLayerPermission($mapbenderMetadata['wfs_id'],$mapbenderMetadata['layer_name'],PUBLIC_USER); ##################
+
+    
+    $iso19139 = $xmlBuilder->getDoc();
+    $MD_Metadata = $iso19139->documentElement;
+        
+    $xmlBuilder->addValue($MD_Metadata, './gmd:fileIdentifier/gco:CharacterString', isset($mbMeta['uuid']) ? $mbMeta['uuid']: "no id found");
+    
+    $xmlBuilder->addValue($MD_Metadata, './gmd:language/gmd:LanguageCode',
+            isset($mbMeta['metadata_language']) ? $mbMeta['metadata_language'] : 'ger');
+//    $xmlBuilder->addValue($MD_Metadata, './gmd:language/gmd:LanguageCode/@codeList',
+//            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#LanguageCode");
+    $xmlBuilder->addValue($MD_Metadata, './gmd:language/gmd:LanguageCode/@codeListValue',
+            isset($mbMeta['metadata_language']) ? $iso19139->createTextNode($mbMeta['metadata_language']) : 'ger');
+
+    $xmlBuilder->addValue($MD_Metadata, './gmd:characterSet/gmd:MD_CharacterSetCode',
+            isset($mbMeta['metadata_language']) ? $mbMeta['metadata_language'] : 'utf8');
+//    $xmlBuilder->addValue($MD_Metadata, './gmd:characterSet/gmd:MD_CharacterSetCode/@codeList',
+//            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_CharacterSetCode");
+    $xmlBuilder->addValue($MD_Metadata, './gmd:characterSet/gmd:MD_CharacterSetCode/@codeListValue',
+            isset($mbMeta['metadata_language']) ? $iso19139->createTextNode($mbMeta['metadata_language']) : 'utf8');
+
+    $xmlBuilder->addValue($MD_Metadata, './gmd:hierarchyLevel/gmd:MD_ScopeCode',
+            isset($mbMeta['hierarchy_level']) ? $mbMeta['hierarchy_level'] : 'service');
+    $xmlBuilder->addValue($MD_Metadata, './gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue',
+            isset($mbMeta['hierarchy_level']) ? $mbMeta['hierarchy_level'] : 'service');
+
+    $xmlBuilder->addValue($MD_Metadata, './gmd:contact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString',
+            isset($departmentMetadata['mb_group_name']) ? $departmentMetadata['mb_group_name'] : 'department not known');
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint/gco:CharacterString',
+            isset($mbMeta['deliverypoint']) ? $mbMeta['deliverypoint'] : 'delivery point not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city/gco:CharacterString',
+            isset($mbMeta['city']) ? $mbMeta['city'] : 'city not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:postalCode/gco:CharacterString',
+            isset($mbMeta['postalcode']) ? $mbMeta['postalcode'] : 'postalcode not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:country/gco:CharacterString',
+            isset($mbMeta['country']) ? $mbMeta['country'] : 'country not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString',
+            isset($mbMeta['electronicmailaddress']) ? $mbMeta['electronicmailaddress'] : 'electronicmailaddress not known');
+
+    $xmlBuilder->addValue($MD_Metadata, './gmd:dateStamp/gco:Date',
+            isset($mbMeta['wfs_timestamp']) ? date("Y-m-d",$mbMeta['wfs_timestamp']) : "2000-01-01");
+
+    $xmlBuilder->addValue($MD_Metadata, './gmd:metadataStandardVersion/gco:CharacterString', "2005/PDAM 1");
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/@uuid',
+            isset($mbMeta['wfs_uuid']) ? $mbMeta['wfs_uuid'] : "wfs uuid not given");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString',
+            isset($mbMeta['wfs_title']) ? $mbMeta['wfs_title']." - ".$mbMeta['layer_title'] : "title not given");
+
+    $pos = 0;
+	//Create date elements B5.2-5.4 - format will be only a date - no dateTime given
+	//Do things for B 5.2 date of publication
+	if (isset($mbMeta['wfs_timestamp_create'])) {
+        $pos++;
+        $chunk = './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:date[' . $pos . ']';
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:date/gco:Date', date('Y-m-d',$mbMeta['wfs_timestamp_create']));
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode', "publication");
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue', "publication");
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeList',
+            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode");
+	}
+    
+	//Do things for B 5.3 date of revision
+	if (isset($mbMeta['wfs_timestamp'])) {
+        $pos++;
+        $chunk = './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:date[' . $pos . ']';
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:date/gco:Date', date('Y-m-d',$mbMeta['wfs_timestamp']));
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode', "revision");
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue', "revision");
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeList',
+            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode");
+	}
+
+	//Do things for B 5.4 date of creation
+	if (isset($mbMeta['wfs_timestamp_creation'])) {
+        $pos++;
+        $chunk = './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:date[' . $pos . ']';
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:date/gco:Date', date('Y-m-d',$mbMeta['wfs_timestamp']));
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode', "creation");
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue', "creation");
+        $xmlBuilder->addValue($MD_Metadata, $chunk . '/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode/@codeList',
+            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode");
+	}
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString',
+            isset($mbMeta['uuid']) ? "http://ww.geoportal.rlp.de/featuretype/" . $mbMeta['uuid']: "no id found");
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:abstract/gco:CharacterString',
+            isset($mbMeta['wfs_abstract']) || isset($mbMeta['featuretype_abstract']) ? $mbMeta['wfs_abstract'].":".$mbMeta['featuretype_abstract'] : "not yet defined");
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:individualName/gco:CharacterString',
+            $mbMeta['individualname']);
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString',
+            isset($departmentMetadata['mb_group_name']) ? $departmentMetadata['mb_group_name'] : 'department not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint/gco:CharacterString',
+            isset($mbMeta['deliverypoint']) ? $mbMeta['deliverypoint'] : 'delivery point not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city/gco:CharacterString',
+            isset($mbMeta['city']) ? $mbMeta['city'] : 'city not known');
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:postalCode/gco:CharacterString',
+            isset($mbMeta['postalcode']) ? $mbMeta['postalcode'] : 'postalcode not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:country/gco:CharacterString',
+            isset($mbMeta['country']) ? $mbMeta['country'] : 'country not known');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString',
+            isset($mbMeta['electronicmailaddress']) ? $mbMeta['electronicmailaddress'] : "kontakt at geoportal.rlp.de");
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL',
+            "not yet defined");
+
+	//generate keyword part - for services the inspire themes are not applicable!!!
+	//read keywords for resource out of the database:
+	$sql = "SELECT keyword.keyword FROM keyword, wfs_featuretype_keyword ftk WHERE ftk.fkey_featuretype_id=$1 AND ftk.fkey_keyword_id=keyword.keyword_id";
+	$v = array((integer)$recordId);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+    $pos = 1;
+	//a special keyword for service type wfs as INSPIRE likes it ;-)
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword['.$pos.']/gco:CharacterString',
+            "infoFeatureAccessService");
+	while ($row = db_fetch_array($res)) {
+        $pos++;
+        $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword['.$pos.']/gco:CharacterString',
+            $row['keyword']);
+	}
+
+	//pull special keywords from custom categories:	
+	$sql = "SELECT custom_category.custom_category_key FROM custom_category, wfs_featuretype_custom_category ftcc WHERE ftcc.fkey_featuretype_id = $1 AND ftcc.fkey_custom_category_id =  custom_category.custom_category_id AND custom_category_hidden = 0";
+	$v = array((integer)$recordId);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	$e = new mb_notice("look for custom categories: ");
+	while ($row = db_fetch_array($res)) {
+        $pos++;
+        $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword['.$pos.']/gco:CharacterString',
+            $row['keyword']);
+	}
+
+	//Part B 3 INSPIRE Category
+	//do this only if an INSPIRE keyword (Annex I-III) is set
+	//Resource Constraints B 8
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints[1]/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/@codeList',
+            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints[1]/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode/@codeListValue',
+            "otherRestrictions");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints[1]/gmd:MD_LegalConstraints/gmd:accessConstraints/gmd:MD_RestrictionCode',
+            "otherRestrictions");
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints[2]/gmd:MD_LegalConstraints/gmd:useLimitation/gco:CharacterString',
+            isset($mbMeta['accessconstraints']) ? $mbMeta['accessconstraints'] : "no conditions apply");
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:resourceConstraints[2]/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString',
+            isset($mbMeta['accessconstraints']) & strtoupper($mbMeta['accessconstraints']) != 'NONE' ? $mbMeta['accessconstraints'] : "no constraints");
+
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:serviceType/gco:LocalName',
+            'download');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:serviceTypeVersion/gco:CharacterString',
+            "1.1.1");
+     
+	//Geographical Extent
+	$bbox = array(-180, -90, 180, 90);
+	if (isset($mbMeta['bbox']) && $mbMeta['bbox'] != '') {
+		$bbox = explode(',',$mbMeta['bbox']);
+	}
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal',
+            $bbox[0]);
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal',
+            $bbox[2]);
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal',
+            $bbox[1]);
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal',
+            $bbox[3]);
+
+	//read all metadata entries:
+	$i=0;
+	$sql = <<<SQL
+
+SELECT metadata_id, uuid, link, linktype, md_format, origin, datasetid FROM mb_metadata 
+INNER JOIN (SELECT * from ows_relation_metadata 
+WHERE fkey_featuretype_id = $recordId ) as relation ON 
+mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin IN ('capabilities','external','metador')
+
+SQL;
+	$res_metadataurl = db_query($sql);
+	if ($res_metadataurl != false) {
+        $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:couplingType/srv:SV_CouplingType/@codeList',
+            "./resources/codelist/gmxCodelists.xml#SV_CouplingType");
+        $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:couplingType/srv:SV_CouplingType/@codeListValue',
+            "tight");
+        $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:couplingType/srv:SV_CouplingType',
+            "tight");
+	}
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:operationName/gco:CharacterString',
+            "GetCapabilities");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:DCP/srv:DCPList/@codeListValue',
+            "WebServices");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:DCP/srv:DCPList/@codeList',
+            "./resources/codelist/gmxCodelists.xml#DCPList");
+
+	//connectPoint **********************************
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:containsOperations/srv:SV_OperationMetadata/srv:connectPoint/gmd:CI_OnlineResource/gmd:linkage/gmd:URL',
+            "http://".$_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?inspire=1&featuretype_id=".$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS");
+
+	//fill in operatesOn fields with datasetid if given
+	/*INSPIRE example: <srv:operatesOn xlink:href="http://image2000.jrc.it#image2000_1_nl2_multi"/>*/
+	/*INSPIRE demands a href for the metadata record!*/
+	/*TODO: Exchange HTTP_HOST with other baseurl*/
+    $pos = 0;
+	while ($row_metadata = db_fetch_array($res_metadataurl)) {
+        switch ($row_metadata['origin']) {
+            case 'capabilities':
+                $pos++;
+                $xmlBuilder->addValue($MD_Metadata,
+                        './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn['.$pos.']/@xlink:href',
+                        "http://" . $_SERVER['HTTP_HOST'] . "/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=" . $row_metadata['uuid']);
+                $xmlBuilder->addValue($MD_Metadata,
+                        './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn['.$pos.']/@uuidref',
+                        $row_metadata['datasetid']);
+                break;
+            case 'metador':
+                $pos++;
+                $xmlBuilder->addValue($MD_Metadata,
+                        './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn['.$pos.']/@xlink:href',
+                        "http://" . $_SERVER['HTTP_HOST'] . "/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=" . $row_metadata['uuid']);
+                $xmlBuilder->addValue($MD_Metadata,
+                        './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn['.$pos.']/@uuidref',
+                        defined('METADATA_DEFAULT_CODESPACE') ? METADATA_DEFAULT_CODESPACE . "#" . $row_metadata['uuid'] : "http://www.mapbender.org#" . $row_metadata['uuid']);
+                break;
+            case 'external':
+                $pos++;
+                $xmlBuilder->addValue($MD_Metadata,
+                        './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn['.$pos.']/@xlink:href',
+                        "http://" . $_SERVER['HTTP_HOST'] . "/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=" . $row_metadata['uuid']);
+                $xmlBuilder->addValue($MD_Metadata,
+                        './gmd:identificationInfo/srv:SV_ServiceIdentification/srv:operatesOn['.$pos.']/@uuidref',
+                        $row_metadata['uuid']);
+                break;
+            default:
+                break;
+        }
+    }
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name/@gco:nilReason',
+            'missing');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:version/@gco:nilReason',
+            'missing');
+    
+	//Check if anonymous user has rights to access this featyretype - if not ? which resource should be advertised? TODO
+    $url = '';
+	if ($hasPermission) {
+		$url = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/wfs.php?inspire=1&layer_id=".$mbMeta['featuretype_id']."&REQUEST=GetCapabilities&SERVICE=WFS";
+	} else {
+		$url = "https://".$_SERVER['HTTP_HOST']."/http_auth/".$mbMeta['featuretype_id']."?REQUEST=GetCapabilities&SERVICE=WFS";
+	}
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL',
+            $url);
+
+//	//append things which geonetwork needs to invoke service/layer or what else? - Here the name of the layer and the protocol seems to be needed?
+//	//a problem will occur, if the link to get map is not the same as the link to get caps? So how can we handle this? It seems to be very silly! 
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:protocol/gco:CharacterString',
+            "OGC:WFS-".$mbMeta['wfs_version']."-http-get-feature");
+ 
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:name/gco:CharacterString',
+            $mbMeta['featuretype_name']);   
+
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:description/gco:CharacterString',
+            $mbMeta['featuretype_abstract']);    
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:scope/gmd:DQ_Scope/gmd:level/gmd:MD_ScopeCode/@codeList',
+            'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:scope/gmd:DQ_Scope/gmd:level/gmd:MD_ScopeCode/@codeListValue',
+            'service');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:scope/gmd:DQ_Scope/gmd:level/gmd:MD_ScopeCode',
+            'service');
+
+     //TODO put in the inspire test suites from mb database!
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString',
+            'OpenGIS Web Feature Service 2.0 Interface Standard (OGC 09-025r1 and ISO/DIS 19142)');
+    //TODO put in the info from database 
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:Date',
+            date('Y-m-d',$mbMeta['wfs_timestamp']));
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:dateType/gmd:CI_DateTypeCode/@codeList',
+            "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#CI_DateTypeCode");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:dateType/gmd:CI_DateTypeCode/@codeListValue',
+            "publication");
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:specification/gmd:CI_Citation/gmd:dateType/gmd:CI_DateTypeCode',
+            "publication");
+    
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:explanation/gco:CharacterString',
+            'No explanation available'); # Der Dienst ist konform zum WFS 2.0 Standard (nicht zertifiziert). ?
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult/gmd:pass/gco:Boolean',
+            'true');
+    $xmlBuilder->addValue($MD_Metadata,
+            './gmd:identificationInfo/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:lineage/gmd:LI_Lineage/gmd:statement/gco:CharacterString',
+            'WFS lineage');
+    
+    return $xmlBuilder->getDoc()->saveXML();
+}
+
+//function to give away the xml data
+function pushISO19139(XmlBuilder $xmlBuilder, $recordId, $outputFormat) {
+	$xml = fillISO19139($xmlBuilder, $recordId);
+	proxyFile($xml, $outputFormat);
+	die();
+}
+
+function xml2rdf($iso19139xml) {
+	$iso19139 = new Iso19139();
+	$iso19139->createMapbenderMetadataFromXML($iso19139xml);
+	return $iso19139->transformToRdf();
+}
+
+function xml2html($iso19139xml) {
+	$iso19139 = new Iso19139();
+	$iso19139->createMapbenderMetadataFromXML($iso19139xml);
+	return $iso19139->transformToHtml();
+}
+
+function proxyFile($iso19139str,$outputFormat) {
+	switch ($outputFormat) {
+		case "rdf":
+			header("Content-type: application/rdf+xml; charset=UTF-8");
+			echo xml2rdf($iso19139str);
+		break;
+		case "html":
+			header("Content-type: text/html; charset=UTF-8");
+			echo xml2html($iso19139str);
+		break;
+		default:
+			header("Content-type: text/xml; charset=UTF-8");
+			echo $iso19139str;
+		break;
+	}
+	
+}
+
+function getEpsgByLayerId ($layer_id) { // from merge_layer.php
+	$epsg_list = "";
+	$sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = $1";
+	$v = array($layer_id);
+	$t = array('i');
+	$res = db_prep_query($sql, $v, $t);
+	while($row = db_fetch_array($res)){
+		$epsg_list .= $row['epsg'] . " ";
+	}
+	return trim($epsg_list);
+}
+function getEpsgArrayByLayerId ($layer_id) { // from merge_layer.php
+	//$epsg_list = "";
+	$epsg_array=array();
+	$sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = $1";
+	$v = array($layer_id);
+	$t = array('i');
+	$res = db_prep_query($sql, $v, $t);
+	$cnt=0;
+	while($row = db_fetch_array($res)){
+		$epsg_array[$cnt] = $row['epsg'];
+		$cnt++;
+	}
+	return $epsg_array;
+}
+
+function guid(){
+    if (function_exists('com_create_guid')){
+        return com_create_guid();
+    }else{
+        mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
+        $charid = strtoupper(md5(uniqid(rand(), true)));
+        $hyphen = chr(45);// "-"
+        $uuid = chr(123)// "{"
+                .substr($charid, 0, 8).$hyphen
+                .substr($charid, 8, 4).$hyphen
+                .substr($charid,12, 4).$hyphen
+                .substr($charid,16, 4).$hyphen
+                .substr($charid,20,12)
+                .chr(125);// "}"
+        return $uuid;
+    }
+}
+
+//do all the other things which had to be done ;-)
+if ($_REQUEST['VALIDATE'] == "true"){
+	$xml = fillISO19139($xmlBuilder, $recordId);
+	validateInspire($xml);
+} else {
+	pushISO19139($xmlBuilder, $recordId, $outputFormat); //throw it out to world!
+}
+
+?>

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2016-09-05 14:24:24 UTC (rev 9574)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2016-09-05 14:24:31 UTC (rev 9575)
@@ -1349,9 +1349,6 @@
 	}
 	
 }
-if ($resource == 'wfs') {
-}
-
 if ($resource == 'wms' or $resource == 'layer'){
 	
 	$html .= $t_a;
@@ -1363,13 +1360,12 @@
 	$html .= $t_a.$translation['mapbenderCapabilitiesWithSubLayer'].$t_b."<a href = '../php/wms.php?layer_id=".$layerId."&PHPSESSID=".session_id()."&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$mapbenderBaseUrl.$_SERVER['PHP_SELF']."/../wms.php?layer_id=".$layerId."&PHPSESSID=".session_id()."&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1"."\",\"".$translation['mapbenderCapabilitiesWithSubLayer']."\");'>".$t_c;
 	$html .= "</table>";
 	$html .= $t_c;
-$capUrl = $resourceMetadata['wms_getcapabilities'].getConjunctionCharacter($resourceMetadata['wms_getcapabilities']).'REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS';
+    $capUrl = $resourceMetadata['wms_getcapabilities'].getConjunctionCharacter($resourceMetadata['wms_getcapabilities']).'REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS';
 
 	//show only original url if the resource is not secured!
 	if (!$resourceSecured) {	
 		$html .= $t_a.$translation['originalCapabilities'].$t_b."<a href = '".$capUrl."' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$capUrl."\",\"".$translation['mapbenderCapabilities']."\");'>".$t_c;
 
-		
 	}
 
 	$html .= $t_a.$translation['inspireCapabilities'].$t_b."<a href = '../php/wms.php?layer_id=".$layerId."&PHPSESSID=".session_id()."&INSPIRE=1&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$mapbenderBaseUrl.$_SERVER['PHP_SELF']."/../wms.php?layer_id=".$layerId."&PHPSESSID=".session_id()."&INSPIRE=1&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS"."\",\"".$translation['inspireCapabilities']."\");'>".$t_c;
@@ -1390,10 +1386,30 @@
 
 if ($resource == 'wfs' or $resource == 'featuretype' or $resource == 'wfs-conf') {
 	$html .= $t_a;
-	$html .= $translation['originalCapabilities'];
+	$html .= $translation['mapbenderCapabilities'];
 	$html .= $t_b;
-	$html .= "<a href = '".$wfsGetCapabilitiesUrl."&SERVICE=WFS&VERSION=".$resourceMetadata['serviceversion']."&REQUEST=GetCapabilities"."' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$wfsGetCapabilitiesUrl."&SERVICE=WFS&VERSION=".$resourceMetadata['serviceversion']."&REQUEST=GetCapabilities"."\",\"".$translation['capabilities']."\");'>";
+	$html .= "<table>";
+    $gcWfsParams = "REQUEST=GetCapabilities&VERSION=".$resourceMetadata['serviceversion']."&SERVICE=WFS";
+    $wfsuri = "wfs.php?FEATURETYPE_ID=".$featuretypeId."&PHPSESSID=".session_id()."&".$gcWfsParams;
+	$html .= $t_a.$translation['mapbenderCapabilitiesSingleLayer'].$t_b.'<a href ="../php/'.$wfsuri.'" target="_blank">'.$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$mapbenderBaseUrl.$_SERVER['PHP_SELF'].'/../'.$wfsuri."\",\"".$translation['mapbenderCapabilitiesSingleLayer']."\");'>".$t_c;
+
+//	$html .= $t_a.$translation['mapbenderCapabilitiesWithSubLayer'].$t_b."<a href = '../php/wfs.php?layer_id=".$layerId."&PHPSESSID=".session_id()."&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$mapbenderBaseUrl.$_SERVER['PHP_SELF']."/../wms.php?layer_id=".$layerId."&PHPSESSID=".session_id()."&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1"."\",\"".$translation['mapbenderCapabilitiesWithSubLayer']."\");'>".$t_c;
+	$html .= "</table>";
 	$html .= $t_c;
+    $capUrl = $resourceMetadata['wfs_getcapabilities'].getConjunctionCharacter($resourceMetadata['wfs_getcapabilities']).$gcWfsParams;
+
+	//show only original url if the resource is not secured!
+	if (!$resourceSecured) {	
+		$html .= $t_a.$translation['originalCapabilities'].$t_b."<a href = '".$capUrl."' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$capUrl."\",\"".$translation['mapbenderCapabilities']."\");'>".$t_c;
+	}
+	$html .= $t_a.$translation['inspireCapabilities'].$t_b.'<a href ="../php/'.$wfsuri.'&INSPIRE=1" target="_blank">'.$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$mapbenderBaseUrl.$_SERVER['PHP_SELF']."/../".$wfsuri."\",\"".$translation['inspireCapabilities']."\");'>".$t_c;
+	$html .= $t_a.$translation['inspireMetadata'].$t_b."<a href='../php/mod_featuretypeISOMetadata.php?SERVICE=WFS&outputFormat=iso19139&Id=".$featuretypeId."' target=_blank ><img style='border: none;' src='../img/inspire_tr_36.png' title='".$translation['inspireMetadata']."' style='width:34px;height:34px' alt='' /></a>"."<a href='../php/mod_featuretypeISOMetadata.php?SERVICE=WFS&CN=false&outputFormat=rdf&Id=".$featuretypeId."' target=_blank ><img style='border: none;' src='../img/rdf_w3c_icon.48.gif' title='".$translation['inspireMetadata']." - RDF/XML (BETA)"."' style='width:34px;height:34px' alt='' /></a>".$t_c;
+	$html .= $t_a.$translation['inspireMetadataValidation'].$t_b."<a href='../php/mod_featuretypeISOMetadata.php?SERVICE=WFS&outputFormat=iso19139&Id=".$featuretypeId."&validate=true' target=_blank title='".$translation['inspireMetadataValidation']."'>".$translation['showInspireMetadataValidation']."</a>".$t_c;
+	//if service is secured and http_auth is adjusted show secured url
+	if ($resourceSecured) {
+		$securedLink = HTTP_AUTH_PROXY."/".$featuretypeId."?".$gcWfsParams;
+		$html .= $t_a.$translation['securedCapabilities'].$t_b."<a href = '".$securedLink."' target=_blank>".$translation['capabilities']."</a> <img src='../img/osgeo_graphics/geosilk/link.png' onclick='showCapabilitiesUrl(\"".$securedLink."\",\"".$translation['securedCapabilities']."\");'>".$t_c;
+	}
 }
 
 

Modified: trunk/mapbender/http/php/wfs.php
===================================================================
--- trunk/mapbender/http/php/wfs.php	2016-09-05 14:24:24 UTC (rev 9574)
+++ trunk/mapbender/http/php/wfs.php	2016-09-05 14:24:31 UTC (rev 9575)
@@ -49,19 +49,16 @@
 	$inspire = true;
 }
 
-$mapbenderMetadaUrl = $_SERVER['HTTP_HOST']."/mapbender/php/mod_showMetadata.php?resource=featuretype&id=";
-$inspireServiceMetadataUrl =  $_SERVER['HTTP_HOST']."/mapbender/php/mod_layerISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=";
-$mapbenderMetadataUrlUrl = $_SERVER['HTTP_HOST']."/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=";
-
 if (isset($_SERVER["HTTPS"])){
 	$urlPrefix = "https://";
 } else {
 	$urlPrefix = "http://";
 }
-$mapbenderMetadataUrl = $urlPrefix.$mapbenderMetadataUrl;
-$inspireServiceMetadataUrl = $urlPrefix.$inspireServiceMetadataUrl;
-$mapbenderMetadataUrlUrl = $urlPrefix.$mapbenderMetadataUrlUrl;
 
+$mapbenderMetadaUrl = $urlPrefix.$_SERVER['HTTP_HOST']."/mapbender/php/mod_showMetadata.php?resource=featuretype&id=";
+$inspireServiceMetadataUrl =  $urlPrefix.$_SERVER['HTTP_HOST']."/mapbender/php/mod_featuretypeISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=";
+$mapbenderMetadataUrlUrl = $urlPrefix.$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=";
+
 $con = db_connect(DBSERVER,OWNER,PW);
 db_select_db(DB,$con);
 
@@ -113,7 +110,7 @@
 //
 // check if version param is set
 //
-if (!isset($version) || $version === "" || ($service == "WFS" && $version != "1.0.0")) {
+if (!isset($version) || $version === "" || ($service == "WFS" && !($version == "1.0.0" || $version == "1.1.0" || strpos($version, '2.0') == 0))) {
 	// optional parameter, set to 1.0.0 if not set
 	$version = "1.0.0";
 }
@@ -188,17 +185,21 @@
 $doc->standalone = false;
 
 #Load existing XML from database
-$xml_sql = "SELECT wfs_getcapabilities_doc FROM wfs AS w, wfs_featuretype AS f " .
+$xml_sql = "SELECT w.wfs_getcapabilities_doc as doc,f.featuretype_name as fname FROM wfs AS w, wfs_featuretype AS f " .
 		"WHERE f.featuretype_id = $1 AND f.fkey_wfs_id = w.wfs_id;";
 $v = array($featuretypeId);
 $t = array("i");
 $res_xml_sql = db_prep_query($xml_sql, $v, $t);
 $xml_row = db_fetch_array($res_xml_sql);
 
-$doc->loadXML($xml_row["wfs_getcapabilities_doc"]);
+$doc->loadXML($xml_row["doc"]);
 $xpath = new DOMXPath($doc);
 
-$xpath->registerNamespace("wfs", "http://www.opengis.net/wfs");
+if(strpos($version, '2.0') === 0) {
+    $xpath->registerNamespace("wfs", "http://www.opengis.net/wfs/2.0");
+} else {
+    $xpath->registerNamespace("wfs", "http://www.opengis.net/wfs");
+}
 $xpath->registerNamespace("ows", "http://www.opengis.net/ows");
 $xpath->registerNamespace("gml", "http://www.opengis.net/gml");
 $xpath->registerNamespace("ogc", "http://www.opengis.net/ogc");
@@ -217,6 +218,13 @@
 	}
 }
 
+if($featuretypeId && ($featureTypeList = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList')[0])){
+    $itemsToRemove = $xpath->query('./wfs:FeatureType[./wfs:Name/text()!="'.$xml_row["fname"].'"]', $featureTypeList);
+    foreach ($itemsToRemove as $itemToRemove) {
+        $featureTypeList->removeChild($itemToRemove);
+    }
+}
+
 # switch URLs for OWSPROXY
 //check if resource is freely available to anonymous user - which are all users who search thru metadata catalogues:
 //for the inspire use case:
@@ -334,7 +342,7 @@
 	$inspire_common_URL = $doc->createElement("inspire_common:URL");
 	$inspire_common_URL->setAttribute("xmlns:inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
 
-	$inspire_common_URLText = $doc->createTextNode($inspireServiceMetadataUrl.$layerId);
+	$inspire_common_URLText = $doc->createTextNode($inspireServiceMetadataUrl.$featuretypeId);
 	$inspire_common_URL->appendChild($inspire_common_URLText);
 	$inspire_common_URL = $inspire_common_MetadataUrl->appendChild($inspire_common_URL);
 	#MediaType



More information about the Mapbender_commits mailing list