[Mapbender-commits] r9626 - in trunk/mapbender/http: classes geoportal/metadata_templates php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Nov 11 03:05:08 PST 2016
Author: armin11
Date: 2016-11-11 03:05:08 -0800 (Fri, 11 Nov 2016)
New Revision: 9626
Added:
trunk/mapbender/http/geoportal/metadata_templates/mb_group_contact.xml
trunk/mapbender/http/php/mod_showOrganizationInfo.php
Modified:
trunk/mapbender/http/classes/class_group.php
trunk/mapbender/http/classes/class_owsConstraints.php
trunk/mapbender/http/php/mod_dataISOMetadata.php
trunk/mapbender/http/php/wms.php
Log:
New functions for metadata proxy and organization export
Modified: trunk/mapbender/http/classes/class_group.php
===================================================================
--- trunk/mapbender/http/classes/class_group.php 2016-11-09 13:11:27 UTC (rev 9625)
+++ trunk/mapbender/http/classes/class_group.php 2016-11-11 11:05:08 UTC (rev 9626)
@@ -44,18 +44,27 @@
var $email;
var $logo_path;
var $homepage;
+ var $uuid;
+ var $timestamp;
+ var $adminCode;
- static $displayName = "Group";
- static $internalName = "group";
+ static $displayName = "Group";
+ static $internalName = "group";
/**
* Constructor
- * @param groupId Integer the ID of the group that is represented by
- * this object. If null, create an empty object
+ * @param groupId Integer the ID of the group that is represented by
+ * this object. If null, create an empty object
*/
public function __construct ($groupId) {
- if (!is_numeric($groupId)) {
- return;
+ //check if id is uuid or integer
+ $uuid = new Uuid();
+ if ($uuid->isValid($groupId)) {
+ $this->uuid = $groupId;
+ } else {
+ if (!is_numeric($groupId)) {
+ return;
+ }
}
$this->id = $groupId;
try{
@@ -88,16 +97,17 @@
"owner" => $this->owner,
"description" => $this->description,
"title" => $this->title,
- "address" => $this->address,
- "postcode" => $this->postcode,
- "city" => $this->city,
- "stateorprovince" => $this->stateorprovince,
- "country" => $this->country,
- "voicetelephone" => $this->voicetelephone,
- "facsimiletelephone" => $this->facsimiletelephone,
- "email" => $this->email,
- "logo_path" => $this->logo_path,
- "homepage" => $this->homepage
+ "address" => $this->address,
+ "postcode" => $this->postcode,
+ "city" => $this->city,
+ "stateorprovince" => $this->stateorprovince,
+ "country" => $this->country,
+ "voicetelephone" => $this->voicetelephone,
+ "facsimiletelephone" => $this->facsimiletelephone,
+ "email" => $this->email,
+ "logo_path" => $this->logo_path,
+ "homepage" => $this->homepage,
+ "uuid" => $this->uuid
);
}
@@ -185,7 +195,6 @@
"mb_group_homepage = $14 ".
"WHERE mb_group_id = $15";
-
$v = array(
$this->name,
$this->owner,
@@ -233,7 +242,7 @@
return true;
}
- public function exists () {
+ public function exists() {
$sql_group = "SELECT group_id from mb_group WHERE mb_group_id = $1; ";
$v = array($this->id);
$t = array("i");
@@ -245,37 +254,220 @@
}
public function load() {
- $sql_group = "SELECT * from mb_group WHERE mb_group_id = $1; ";
- $v = array($this->id);
- $t = array("i");
- $res_group = db_prep_query($sql_group,$v,$t);
- if($row = db_fetch_array($res_group)){
+ //check if uuid or id is given, give id preference
+ if (isset($this->id) || isset($this->uuid)) {
+ if (isset($this->id) && is_numeric($this->id)) {
+ $sql_group = "SELECT * from mb_group WHERE mb_group_id = $1; ";
+ $v = array($this->id);
+ $t = array("i");
+ } else {
+ $sql_group = "SELECT * from mb_group WHERE uuid = $1; ";
+ $v = array($this->uuid);
+ $t = array("s");
+ }
+ $res_group = db_prep_query($sql_group,$v,$t);
+ if($row = db_fetch_array($res_group)){
- $this->name = $row['mb_group_name'];
+ $this->name = $row['mb_group_name'];
- //FIXME: needs checking
- $this->owner = $row['mb_group_owner'];
- $this->description = $row['mb_group_description'];
- $this->title = $row["mb_group_title"];
- $this->address = $row["mb_group_address"];
- $this->postcode = $row["mb_group_postcode"];
- $this->city = $row["mb_group_city"];
- $this->stateorprovince = $row["mb_group_stateorprovince"];
- $this->country = $row["mb_group_country"];
- $this->voicetelephone = $row["mb_group_voicetelephone"];
- $this->facsimiletelephone = $row["mb_group_facsimiletelephone"];
- $this->email = $row["mb_group_email"];
- $this->logo_path = $row["mb_group_logo_path"];
- $this->homepage = $row["mb_group_homepage"];
+ //FIXME: needs checking
+ $this->owner = $row['mb_group_owner'];
+ $this->description = $row['mb_group_description'];
+ $this->title = $row["mb_group_title"];
+ $this->address = $row["mb_group_address"];
+ $this->postcode = $row["mb_group_postcode"];
+ $this->city = $row["mb_group_city"];
+ $this->stateorprovince = $row["mb_group_stateorprovince"];
+ $this->country = $row["mb_group_country"];
+ $this->voicetelephone = $row["mb_group_voicetelephone"];
+ $this->facsimiletelephone = $row["mb_group_facsimiletelephone"];
+ $this->email = $row["mb_group_email"];
+ $this->logo_path = $row["mb_group_logo_path"];
+ $this->homepage = $row["mb_group_homepage"];
+ $this->uuid = $row["uuid"];
+ $this->adminCode = $row["mb_group_admin_code"];
+ $this->timestamp = $row["timestamp"];
+
+ } else {
+ throw new Exception("Group with ID " . $this->id . " does not exist.");
+ return false;
+ }
+ return true;
+ } else {
+ throw new Exception("Neither id nor uuid is given to select group.");
}
- else{
- throw new Exception("Group with ID " . $this->id . " does not exist.");
- return false;
- }
- return true;
}
/*
+ * @return transform group into other representation
+ * @param outputFormat string "iso19139", "rdf", "ckan"
+ */
+ function export($outputFormat, $givenRole = false) {
+ $mappingHash = array(
+ //name
+ array( groupAttribute => "name",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString",
+ deleteElementPath => false,
+ ckanName => "name"
+ ),
+ //email
+ array( groupAttribute => "email",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress",
+ ckanName => false
+ ),
+ //deliveryPoint
+ array( groupAttribute => "address",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint/gco:CharacterString",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint",
+ ckanName => false
+ ),
+ //administrativeArea
+ array( groupAttribute => "adminCode",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:administrativeArea/gmd:Country",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:administrativeArea",
+ ckanName => false
+ ),
+ //postalCode
+ array( groupAttribute => "postalCode",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:postalCode/gco:CharacterString",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:postalCode",
+ ckanName => false
+ ),
+ //country
+ array( groupAttribute => "country",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:country/gmd:Country",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:country",
+ ckanName => false
+ ),
+ //city
+ array( groupAttribute => "city",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city/gco:CharacterString",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city",
+ ckanName => false
+ ),
+ //voicetelephone
+ array( groupAttribute => "voicetelephone",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice",
+ ckanName => false
+ ),
+ //facsimiletelephone
+ array( groupAttribute => "facsimiletelephone",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:facsimile",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:facsimile",
+ ckanName => false
+ ),
+ //onlineResource
+ array( groupAttribute => "homepage",
+ iso19139Path => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource/gmd:CI_OnlineResource/gmd:linkage/gmd:URL",
+ deleteElementPath => "/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:onlineResource",
+ ckanName => false
+ ),
+ //created
+ array( groupAttribute => "timestamp",
+ iso19139Path => false,
+ deleteElementPath => false,
+ ckanName => "created"
+ ),
+ //description
+ array( groupAttribute => "description",
+ iso19139Path => false,
+ deleteElementPath => false,
+ ckanName => "description"
+ ),
+ //title
+ array( groupAttribute => "title",
+ iso19139Path => false,
+ deleteElementPath => false,
+ ckanName => "title"
+ ),
+ //uuid
+ array( groupAttribute => "uuid",
+ iso19139Path => false,
+ deleteElementPath => false,
+ ckanName => "id"
+ ),
+ //logo
+ array( groupAttribute => "logo_path",
+ iso19139Path => false,
+ deleteElementPath => false,
+ ckanName => "image_display_url"
+ )
+ );
+ switch ($outputFormat) {
+ case "iso19139":
+ $e = new mb_exception("try to export group: ".$this->name);
+ //build xml snippet via dom!
+ //read template
+ //load xml from constraint generator
+ $contactDomObject = new DOMDocument();
+ $contactDomObject->load(dirname(__FILE__) . "/../geoportal/metadata_templates/mb_group_contact.xml");
+ $xpathContact = new DOMXpath($contactDomObject);
+ //$rootNamespace = $contactDomObject->lookupNamespaceUri($contactDomObject->namespaceURI);
+ $xpathContact->registerNamespace("mb", "http://www.mapbender.org/metadata/groupcontact");
+
+ $xpathContact->registerNamespace("gco", "http://www.isotc211.org/2005/gco");
+ $xpathContact->registerNamespace("gmd", "http://www.isotc211.org/2005/gmd");
+
+
+ for($a = 0; $a < count($mappingHash); $a++) {
+ if (isset($this->{$mappingHash[$a]['groupAttribute']}) && $this->{$mappingHash[$a]['groupAttribute']} !== "" && $mappingHash[$a]['iso19139Path'] !== false) {
+ $xpathContact->query($mappingHash[$a]['iso19139Path'])->item(0)->nodeValue = $this->{$mappingHash[$a]['groupAttribute']};
+ } else {
+ if ($mappingHash[$a]['deleteElementPath'] !== false) {
+ //delete default element from xml!
+ $temp = $xpathContact->query($mappingHash[$a]['deleteElementPath'])->item(0);
+ $temp->parentNode->removeChild($temp);
+ }
+ }
+ }
+ //if neither voice nor fax is given, delete the complete phone object!
+ if ((!isset($this->facsimiletelephone) && !isset($this->voicetelephone)) || ($this->voicetelephone == '' && $this->facsimiletelephone == '')) {
+ $temp = $xpathContact->query('/mb:groupcontact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:phone')->item(0);
+ $temp->parentNode->removeChild($temp);
+ }
+ $XML = $contactDomObject->saveXML();
+ return $XML;
+ break;
+ case "rdf":
+ break;
+ case "ckan":
+ /*
+ {"users": [{"email_hash": "da6f68f26df3d76063a9ef78b90208a1", "about": null, "capacity": "admin", "name": "admin", "created": "2016-05-21T18:47:35.299335", "openid": null, "sysadmin": false, "activity_streams_email_notifications": false, "state": "active", "number_of_edits": 2, "display_name": "test", "fullname": "test", "id": "f78e4baf-ce48-4aa7-bee9-ae4069262e24", "number_created_packages": 0}, {"email_hash": "ac3c638a25dcdff84c0b6b6ac2a44164", "about": null, "capacity": "admin", "name": "lepin2001", "created": "2016-06-01T08:16:32.508740", "openid": null, "sysadmin": false, "activity_streams_email_notifications": false, "state": "active", "number_of_edits": 153, "display_name": "lepin2001", "fullname": "", "id": "04eb8d47-e167-4285-9456-1febe291be89", "number_created_packages": 1}], "display_name": "\u6843\u5712\u5e02\u653f\u5e9c\u5e02\u9577\u5ba4", "description": "", "image_display_url": "", "package_count": 0, "created": "2016-06-03T08:12:16.804838", "name": "000001", "is_or
ganization": true, "state": "active", "extras": [], "image_url": "", "groups": [], "type": "organization", "title": "\u6843\u5712\u5e02\u653f\u5e9c\u5e02\u9577\u5ba4", "revision_id": "9a847865-477d-46ee-b3ef-407b547623f7", "num_followers": 0, "id": "000001", "tags": [], "approval_status": "approved"}}
+ */
+ $jsonOutput = new stdClass();
+ //display_name
+ //description
+ //image_display_url
+ //created
+ //name
+ //is_organization
+ //state
+ //image_url
+ //type
+ //title
+ //id
+ //approval_status
+ for($a = 0; $a < count($mappingHash); $a++) {
+ if (isset($this->{$mappingHash[$a]['groupAttribute']}) && $this->{$mappingHash[$a]['groupAttribute']} !== "" && $mappingHash[$a]['ckanName'] !== false) {
+ $jsonOutput->{$mappingHash[$a]['ckanName']} = $this->{$mappingHash[$a]['groupAttribute']};
+ //$xpathContact->query($mappingHash[$a]['iso19139Path'])->item(0)->nodeValue = $this->{$mappingHash[$a]['groupAttribute']};
+ }
+ }
+
+ $jsonOutput->is_organization = true;
+ $jsonOutput->type = "organization";
+ $json = json_encode($jsonOutput);
+ return $json;
+ break;
+ default:
+ return false;
+ break;
+ }
+ }
+
+ /*
* @return Array of Groups
* @param $filter UNUSED! AssocArray, valid keys "id","name". Use SQL's % and _ to perform simple matching
*/
Modified: trunk/mapbender/http/classes/class_owsConstraints.php
===================================================================
--- trunk/mapbender/http/classes/class_owsConstraints.php 2016-11-09 13:11:27 UTC (rev 9625)
+++ trunk/mapbender/http/classes/class_owsConstraints.php 2016-11-11 11:05:08 UTC (rev 9626)
@@ -585,7 +585,7 @@
$constraints->appendChild($iso19139Doc->createComment("security constraints - not needed - maybe there for declaring a simple classification system"));
//TODO: not now!
//$resourceConstraintsSec = $constraints->appendChild($resourceConstraintsSec);
- $iso19193 = $iso19139Doc->appendChild($constraints);
+ $iso19139 = $iso19139Doc->appendChild($constraints);
$XML = $iso19139Doc->saveXML();
if (!$this->returnDirect) {
return $XML;
Added: trunk/mapbender/http/geoportal/metadata_templates/mb_group_contact.xml
===================================================================
--- trunk/mapbender/http/geoportal/metadata_templates/mb_group_contact.xml (rev 0)
+++ trunk/mapbender/http/geoportal/metadata_templates/mb_group_contact.xml 2016-11-11 11:05:08 UTC (rev 9626)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mb:groupcontact xmlns:mb="http://www.mapbender.org/metadata/groupcontact" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco">
+ <gmd:CI_ResponsibleParty>
+ <gmd:organisationName>
+ <gco:CharacterString>mapbender_release</gco:CharacterString>
+ </gmd:organisationName>
+ <gmd:contactInfo>
+ <gmd:CI_Contact>
+ <gmd:phone>
+ <gmd:CI_Telephone>
+ <gmd:voice></gmd:voice>
+ <gmd:facsimile></gmd:facsimile>
+ </gmd:CI_Telephone>
+ </gmd:phone>
+ <gmd:address>
+ <gmd:CI_Address>
+ <gmd:deliveryPoint>
+ <gco:CharacterString>Musterstraße 1</gco:CharacterString>
+ </gmd:deliveryPoint>
+ <gmd:city>
+ <gco:CharacterString>Musterstadt</gco:CharacterString>
+ </gmd:city>
+ <gmd:administrativeArea>
+ <!--<gco:CharacterString>LAU1</gco:CharacterString>-->
+ <gmd:Country codeList="http://ec.europa.eu/eurostat/web/nuts/national-structures-eu" codeListValue="LAU 1">Verbandsgemeinde</gmd:Country>
+ </gmd:administrativeArea>
+ <gmd:postalCode>
+ <gco:CharacterString>66666</gco:CharacterString>
+ </gmd:postalCode>
+ <gmd:country>
+ <!--<gco:CharacterString>DE</gco:CharacterString>-->
+ <gmd:Country codeList="https://en.wikipedia.org/wiki/ISO_3166-1" codeListValue="DE">Deutschland</gmd:Country>
+ </gmd:country>
+ <gmd:electronicMailAddress>
+ <gco:CharacterString>kontakt at geoportal.rlp.de</gco:CharacterString>
+ </gmd:electronicMailAddress>
+ </gmd:CI_Address>
+ </gmd:address>
+ <gmd:onlineResource>
+ <gmd:CI_OnlineResource>
+ <gmd:linkage>
+ <gmd:URL></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>
+</mb:groupcontact>
Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php 2016-11-09 13:11:27 UTC (rev 9625)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php 2016-11-11 11:05:08 UTC (rev 9626)
@@ -311,7 +311,7 @@
for ($i = ($licenseNodeList->length)-1; $i >= 0; $i--) {
$resourceConstraintsNodeList->item(0)->parentNode->insertBefore($metadataDomObject->importNode($licenseNodeList->item($i), true), $resourceConstraintsNodeList->item(0));
}
- //delete all resorourceConstraints from original xml document
+ //delete all resourceConstraints from original xml document
for ($i = 0; $i < $resourceConstraintsNodeList->length; $i++) {
$temp = $resourceConstraintsNodeList->item($i); //avoid calling a function twice
$temp->parentNode->removeChild($temp);
Added: trunk/mapbender/http/php/mod_showOrganizationInfo.php
===================================================================
--- trunk/mapbender/http/php/mod_showOrganizationInfo.php (rev 0)
+++ trunk/mapbender/http/php/mod_showOrganizationInfo.php 2016-11-11 11:05:08 UTC (rev 9626)
@@ -0,0 +1,67 @@
+<?php
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_group.php");
+require_once(dirname(__FILE__)."/../classes/class_Uuid.php");
+
+$uuid = false;
+$id = false;
+$outputFormat='iso19139';
+
+if (isset($_REQUEST["id"]) & $_REQUEST["id"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["id"];
+ $pattern = '/^[\d,]*$/';
+ if (!preg_match($pattern,$testMatch)){
+ //echo 'id: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'Parameter <b>id</b> is not valid (integer or cs integer list).<br/>';
+ die();
+ }
+ $id = $testMatch;
+ $testMatch = NULL;
+}
+
+if (isset($_REQUEST["uuid"]) & $_REQUEST["uuid"] != "") {
+ $uuidClass = new Uuid();
+ if ($uuidClass->isValid($_REQUEST["uuid"])) {
+ $uuid = $_REQUEST["uuid"];
+ } else {
+ echo 'Parameter <b>id</b> is not valid (integer or cs integer list).<br/>';
+ die();
+ }
+}
+
+if (isset($_REQUEST["outputFormat"]) & $_REQUEST["outputFormat"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["outputFormat"];
+ if (!($testMatch == 'iso19139' or $testMatch == 'ckan')){
+ //echo 'outputFormat: <b>'.$testMatch.'</b> is not valid.<br/>';
+ echo 'Parameter <b>outputFormat</b> is not valid (iso19139,ckan).<br/>';
+ die();
+ }
+ $outputFormat = $testMatch;
+ $testMatch = NULL;
+}
+
+if ($uuid !== false) {
+ $group = new Group($uuid);
+} else {
+ if ($id !== false) {
+ $group = new Group($id);
+ } else {
+ echo 'Neither id nor uuid for requesting an organization was given!<br/>';
+ die();
+ }
+}
+
+switch ($outputFormat) {
+ case "ckan":
+ header("Content-Type: application/json");
+ echo $group->export('ckan');
+ break;
+ case "iso19139":
+ header("Content-type: application/xhtml+xml; charset=UTF-8");
+ echo $group->export('iso19139');
+ break;
+}
+
+?>
Modified: trunk/mapbender/http/php/wms.php
===================================================================
--- trunk/mapbender/http/php/wms.php 2016-11-09 13:11:27 UTC (rev 9625)
+++ trunk/mapbender/http/php/wms.php 2016-11-11 11:05:08 UTC (rev 9626)
@@ -35,8 +35,20 @@
$layerId = $_GET["LAYER_ID"];
$updateSequence = intval($_GET["UPDATESEQUENCE"]);
$inspire = $_GET["INSPIRE"];
+$validateSchema = true;
+if (isset($_GET["VALIDATESCHEMA"]) && $_GET["VALIDATESCHEMA"] == 0) {
+ $validateSchema = false;
+}
+
$withChilds = false;
+//default url prefix
+$urlPrefix = "http://";
+//switch prefix from request
+if (isset($_SERVER["HTTPS"])){
+ $urlPrefix = "https://";
+}
+
if (isset($_REQUEST["withChilds"]) && $_REQUEST["withChilds"] === "1") {
$withChilds = true;
}
@@ -56,11 +68,6 @@
$mapbenderMetadaUrl = $_SERVER['HTTP_HOST']."/mapbender/php/mod_showMetadata.php?resource=layer&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;
@@ -229,11 +236,13 @@
// (return most recent Capabilities XML)
//
// ---------------------------------------------------------------------------
-$imp = new DOMImplementation;
-$dtd = $imp->createDocumentType('WMT_MS_Capabilities', '', 'http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd');
-$doc = $imp->createDocument("", "", $dtd);
-
-//$doc = new DOMDocument('1.0');
+if ($validateSchema == true) {
+ $imp = new DOMImplementation;
+ $dtd = $imp->createDocumentType('WMT_MS_Capabilities', '', 'http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd');
+ $doc = $imp->createDocument("", "", $dtd);
+} else {
+ $doc = new DOMDocument('1.0');
+}
$doc->encoding = 'UTF-8';
$doc->standalone = false;
More information about the Mapbender_commits
mailing list