[Mapbender-commits] r9622 - in trunk/mapbender: http/classes http/php http/plugins resources/db/pgsql/UTF-8/update resources/locale/de_DE/LC_MESSAGES
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Nov 8 01:28:39 PST 2016
Author: armin11
Date: 2016-11-08 01:28:39 -0800 (Tue, 08 Nov 2016)
New Revision: 9622
Modified:
trunk/mapbender/http/classes/class_iso19139.php
trunk/mapbender/http/classes/class_owsConstraints.php
trunk/mapbender/http/classes/class_wms.php
trunk/mapbender/http/php/mod_dataISOMetadata.php
trunk/mapbender/http/php/mod_layerISOMetadata.php
trunk/mapbender/http/php/wms.php
trunk/mapbender/http/plugins/mb_metadata_edit.php
trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql
trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
Log:
New possibility for distributed dataset metadata to inherit license and contact information from coupled services (wms). With this option it much mor easy to sync the mapbender metadata catalogue with open data portals based on ckan.
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/classes/class_iso19139.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -59,6 +59,7 @@
var $spatialResType;
var $spatialResValue;
var $export2Csw; //db bool, 't' or 'f'
+ var $mdProxy; //db boolean
var $updateFrequency;
var $dataFormat;
var $inspireCharset;
@@ -118,6 +119,7 @@
$this->spatialResType = "";
$this->spatialResValue = "";
$this->export2Csw = "t";
+ $this->mdProxy = "f";
$this->updateFrequency = "";
$this->dataFormat = "";
$this->inspireCharset = "";
@@ -1428,10 +1430,10 @@
//get info from coupled service
switch ($resourceType) {
case "layer":
- $sql = "SELECT fkey_mb_group_id, wms.wms_id as service_id, fkey_termsofuse_id FROM wms LEFT JOIN wms_termsofuse ON wms.wms_id = wms_termsofuse.fkey_wms_id WHERE wms_id = (SELECT fkey_wms_id FROM layer WHERE layer_id = $resourceId)";
+ $sql = "SELECT fkey_mb_group_id, wms.wms_id as service_id, fkey_termsofuse_id, wms_license_source_note as service_source_note FROM wms LEFT JOIN wms_termsofuse ON wms.wms_id = wms_termsofuse.fkey_wms_id WHERE wms_id = (SELECT fkey_wms_id FROM layer WHERE layer_id = $resourceId)";
break;
case "featuretype":
- $sql = "SELECT fkey_mb_group_id, wfs.wfs_id as service_id, fkey_termsofuse_id FROM wfs LEFT JOIN wfs_termsofuse ON wfs.wfs_id = wfs_termsofuse.fkey_wfs_id WHERE wfs_id = (SELECT fkey_wfs_id FROM wfs_featuretype WHERE featuretype_id = $resourceId)";
+ $sql = "SELECT fkey_mb_group_id, wfs.wfs_id as service_id, fkey_termsofuse_id, wfs_license_source_note as service_source_note FROM wfs LEFT JOIN wfs_termsofuse ON wfs.wfs_id = wfs_termsofuse.fkey_wfs_id WHERE wfs_id = (SELECT fkey_wfs_id FROM wfs_featuretype WHERE featuretype_id = $resourceId)";
break;
}
$res = db_query($sql);
@@ -1439,23 +1441,29 @@
$fkey_mb_group_id = $row['fkey_mb_group_id'];
$service_id = $row['service_id'];
$fkey_termsofuse_id = $row['fkey_termsofuse_id'];
+ $service_source_note = $row['service_source_note'];
}
//regexpr for strings which represents integer
$regExprInt = "/^[0-9]+$/";
}
if ($inheritContactInfo == true && preg_match($regExprInt,$fkey_mb_group_id)) {
- $sqlInheritContact = "UPDATE mb_metadata set fkey_mb_group_id = $fkey_mb_group_id WHERE metadata_id = $metadataId";
+ $sqlInheritContact = "UPDATE mb_metadata SET fkey_mb_group_id = $fkey_mb_group_id WHERE metadata_id = $metadataId";
$res = db_query($sqlInheritContact);
//$e = new mb_exception("Metadata with id ".$metadataId." inherits contact information from ".$resourceType." with resourceId ".$resourceId);
}
if ($inheritLicenceInfo == true && preg_match($regExprInt,$fkey_termsofuse_id)) {
try {
//delete own termsofuse if exists
- $sqlDeleteTouRelation = "DELETE from md_termsofuse WHERE fkey_metadata_id = $metadataId";
+ $sqlDeleteTouRelation = "DELETE FROM md_termsofuse WHERE fkey_metadata_id = $metadataId";
$res = db_query($sqlDeleteTouRelation);
//insert service termsofuse relation
$sqlInsertTouRelation = "INSERT INTO md_termsofuse (fkey_termsofuse_id, fkey_metadata_id) VALUES ($fkey_termsofuse_id,$metadataId)";
$res = db_query($sqlInsertTouRelation);
+ //fill in source note from service
+ $sqlUpdateSourceNote = "UPDATE mb_metadata SET md_license_source_note = $1 WHERE metadata_id = $2";
+ $t = array('s', 'i');
+ $v = array($service_source_note, $metadataId);
+ $res = db_prep_query($sqlUpdateSourceNote);
//$e = new mb_exception("Metadata with id ".$metadataId." inherits licence information from ".$resourceType." with resourceId ".$resourceId);
}
catch (Exception $e) {
@@ -1854,7 +1862,7 @@
//insert an instance for iso19139 into mapbenders database
$e = new mb_notice("class_iso19139.php: insert metadata with title: ".$this->title);
$sql = <<<SQL
-INSERT INTO mb_metadata (lastchanged, link, origin, md_format, data, linktype, uuid, title, createdate, changedate, abstract, searchtext, type, tmp_reference_1, tmp_reference_2, export2csw, datasetid, datasetid_codespace, randomid, fkey_mb_user_id, harvestresult, harvestexception, lineage, inspire_top_consistence, spatial_res_type, spatial_res_value, update_frequency, format, inspire_charset, ref_system, the_geom, datalinks, inspire_whole_area, inspire_actual_coverage, inspire_download, bounding_geom, transfer_size, fees, md_license_source_note, constraints, responsible_party_name, responsible_party_email, preview_image, fkey_mb_group_id) VALUES(now(), $1, $18, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43)
+INSERT INTO mb_metadata (lastchanged, link, origin, md_format, data, linktype, uuid, title, createdate, changedate, abstract, searchtext, type, tmp_reference_1, tmp_reference_2, export2csw, datasetid, datasetid_codespace, randomid, fkey_mb_user_id, harvestresult, harvestexception, lineage, inspire_top_consistence, spatial_res_type, spatial_res_value, update_frequency, format, inspire_charset, ref_system, the_geom, datalinks, inspire_whole_area, inspire_actual_coverage, inspire_download, bounding_geom, transfer_size, fees, md_license_source_note, constraints, responsible_party_name, responsible_party_email, preview_image, fkey_mb_group_id, md_proxy) VALUES(now(), $1, $18, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44)
SQL;
$v = array(
$this->href,
@@ -1899,13 +1907,14 @@
$this->resourceResponsibleParty,
$this->resourceContactEmail,
$this->previewImage,
- $this->fkey_mb_group_id
+ $this->fkey_mb_group_id,
+ $this->mdProxy
);
//$e = new mb_exception($this->tmpExtentBegin);
//$e = new mb_exception($this->tmpExtentEnd);
//$e = new mb_exception($this->createDate);
//$e = new mb_exception($this->changeDate);
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i');
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b');
$res = db_prep_query($sql,$v,$t);
return $res;
}
@@ -1964,7 +1973,7 @@
$sql .= "linktype = $4, uuid = $5, title = $6, createdate = $7, changedate = $8, lastchanged = now(), ";
$sql .= "abstract = $9, searchtext = $10, type = $11, tmp_reference_1 = $12, tmp_reference_2 = $13, export2csw = $14, datasetid = $15, ";
$sql .= "datasetid_codespace = $16, randomid = $17, harvestresult = $20, harvestexception = $21, lineage = $22, inspire_top_consistence = $23, ";
- $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, fkey_mb_group_id = $43 WHERE metadata_id = $19";
+ $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, fkey_mb_group_id = $43, md_proxy = $44 WHERE metadata_id = $19";
//$e= new mb_exception("class_iso19139.php: downloadLinks json".$this->jsonEncodeDownloadLinks($this->downloadLinks));
//$e= new mb_exception("class_iso19139.php: downloadLinks[0]".$this->downloadLinks[0]);
$v = array(
@@ -2011,10 +2020,11 @@
$this->resourceResponsibleParty,
$this->resourceContactEmail,
$this->previewImage,
- $this->fkey_mb_group_id
+ $this->fkey_mb_group_id,
+ $this->mdProxy
);
//$e = new mb_exception("class_iso19139: ".$this->createWktBboxFromArray($this->wgs84Bbox));
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i');
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b');
$res = db_prep_query($sql,$v,$t);
return $res;
}
@@ -2241,13 +2251,15 @@
//check if metadata record already exists, if not create a new one, else insert relation only and update the metadata itself!
$metadataId = $this->isFileIdentifierAlreadyInDB();
//$e = new mb_exception("found metadata_id: ".$metadataId);
-
+ //check if some things should be inherited from service metadata
+ if ($inheritContactInfo == true || $inheritLicenceInfo == true) {
+ $this->mdProxy = "t";
+ }
if ($metadataId != false) {
//update the metadata - new random id set therefor there is no problem when setting the relation afterwards
$e = new mb_notice("existing metadata fileIdentifier found at metadata with id: ".$metadataId." - update will be performed");
//TODO: Check if the timestamp of an existing metadata element is not newer than the timestamp of the current metadata object!!!!
//for uploaded metadata the harvesting was ok otherwise the function returned before
-
$res = $this->updateMetadataById($metadataId);
$this->insertKeywordsAndCategoriesIntoDB($metadataId,$resourceType,$resourceId);
Modified: trunk/mapbender/http/classes/class_owsConstraints.php
===================================================================
--- trunk/mapbender/http/classes/class_owsConstraints.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/classes/class_owsConstraints.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -37,7 +37,7 @@
if (isset($_REQUEST["type"]) & $_REQUEST["type"] != "") {
//validate to wms, wfs
$testMatch = $_REQUEST["type"];
- if (!($testMatch == 'wms' or $testMatch == 'wfs')){
+ if (!($testMatch == 'wms' or $testMatch == 'wfs' or $testMatch == 'metadata')){
$returnObject['success'] = false;
$returnObject['message'] = "Parameter type was not wms or wfs!";
return $returnObject;
@@ -132,35 +132,44 @@
Mapbender::session()->set("mb_lang",$this->languageCode);
if ($this->type == "wms") {
- $sql = "SELECT wms_id, wms.accessconstraints, wms.fees, wms.wms_network_access , wms.wms_pricevolume, wms.wms_proxylog, termsofuse.name,";
- $sql .= " termsofuse.termsofuse_id, termsofuse.symbollink, termsofuse.description,termsofuse.descriptionlink, termsofuse.isopen from wms LEFT OUTER JOIN";
+ $sql = "SELECT wms_id, wms_id as resource_id, wms.accessconstraints, wms.fees, wms.wms_network_access, wms.wms_pricevolume, wms_license_source_note as source_note, wms.wms_proxylog, termsofuse.name,";
+ $sql .= " termsofuse.termsofuse_id, termsofuse.symbollink, termsofuse.description,termsofuse.descriptionlink, termsofuse.isopen, source_required from wms LEFT OUTER JOIN";
$sql .= " wms_termsofuse ON (wms.wms_id = wms_termsofuse.fkey_wms_id) LEFT OUTER JOIN termsofuse ON";
$sql .= " (wms_termsofuse.fkey_termsofuse_id=termsofuse.termsofuse_id) where wms.wms_id = $1";
}
if ($this->type == "wfs") {
- $sql = "SELECT wfs_id, accessconstraints, fees, wfs_network_access , termsofuse.name,";
- $sql .= " termsofuse.termsofuse_id ,termsofuse.symbollink, termsofuse.description,termsofuse.descriptionlink, termsofuse.isopen from wfs LEFT OUTER JOIN";
+ $sql = "SELECT wfs_id, wfs_id as resource_id, accessconstraints, fees, wfs_network_access, wfs_license_source_note as source_note, termsofuse.name,";
+ $sql .= " termsofuse.termsofuse_id ,termsofuse.symbollink, termsofuse.description,termsofuse.descriptionlink, termsofuse.isopen, source_required from wfs LEFT OUTER JOIN";
$sql .= " wfs_termsofuse ON (wfs.wfs_id = wfs_termsofuse.fkey_wfs_id) LEFT OUTER JOIN termsofuse ON";
$sql .= " (wfs_termsofuse.fkey_termsofuse_id=termsofuse.termsofuse_id) where wfs.wfs_id = $1";
}
+ if ($this->type == "metadata") {
+ $sql = "SELECT metadata_id, metadata_id as resource_id, constraints as accessconstraints, md_license_source_note as source_note, fees, termsofuse.name,";
+ $sql .= " termsofuse.termsofuse_id ,termsofuse.symbollink, termsofuse.description,termsofuse.descriptionlink, termsofuse.isopen, source_required from mb_metadata LEFT OUTER JOIN";
+ $sql .= " md_termsofuse ON (mb_metadata.metadata_id = md_termsofuse.fkey_metadata_id) LEFT OUTER JOIN termsofuse ON";
+ $sql .= " (md_termsofuse.fkey_termsofuse_id=termsofuse.termsofuse_id) where mb_metadata.metadata_id = $1";
+ }
$v = array();
$t = array();
array_push($t, "i");
array_push($v, $this->id);
$res = db_prep_query($sql,$v,$t);
$row = db_fetch_array($res);
- if (!isset($row['wms_id'])) {
+ if (!isset($row['resource_id'])) {
$resultObject['success'] = false;
- $resultObject['message'] = $this->type."-service with this id is not known!";
+ $resultObject['message'] = $this->type."-resource with this id is not known!";
return $resultObject;
}
- //get email adress of responsible person for service:
+ //get email adress of responsible person for resource:
if ($this->type == "wms") {
$sql = "SELECT mb_user_email FROM wms LEFT OUTER JOIN mb_user ON (wms_owner = mb_user.mb_user_id) WHERE wms_id=$1";
}
if ($this->type == "wfs") {
$sql = "SELECT mb_user_email FROM wfs LEFT OUTER JOIN mb_user ON (wfs_owner = mb_user.mb_user_id) WHERE wfs_id=$1";
}
+ if ($this->type == "metadata") {
+ $sql = "SELECT mb_user_email FROM mb_metadata LEFT OUTER JOIN mb_user ON (fkey_mb_user_id = mb_user.mb_user_id) WHERE metadata_id=$1";
+ }
$v = array();
$t = array();
array_push($t, "i");
@@ -168,11 +177,11 @@
$res = db_prep_query($sql,$v,$t);
$rowOwner = db_fetch_array($res);
//define conditions for generating disclaimer based on service information
- //if logged,
+ //if logged - only services,
//if accessconstraints exists,
//if fees exists,
//if licences are defined,
- //if network access is restricted
+ //if network access is restricted - only services
if ((isset($row[$this->type.'_proxylog']) & $row[$this->type.'_proxylog'] != 0) or strtoupper($row['accessconstraints']) != "NONE" or strtoupper($row['fees']) != "NONE" or isset($row['termsofuse_id']) or (isset($row[$this->type.'_network_access']) & $row[$this->type.'_network_access'] != 0)) {
$html = "";
//generate text for json object if restrictions exists
@@ -213,6 +222,9 @@
$fees .= "<br><img src='../img/od_80x15_blue.png' /><br>";
}
$fees .= $row['description']."<br>";
+ if ($row['source_note'] !== "" && isset($row['source_note'])) {
+ $fees .= _mb("Source note").": ".$row['source_note']."<br>";
+ }
$feesPart .= $fees;
} else {
if (isset($row['fees']) & ((strtoupper($row['fees']) != 'NONE') or ($row['fees'] != ''))) {
@@ -267,6 +279,9 @@
$fees .= "<br><img src='http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png' alt='opendata symbol'/><br>";
}
$fees .= $row['description']."<br>";
+ if ($row['source_note'] !== "" && isset($row['source_note'])) {
+ $fees .= _mb("Source note").": ".$row['source_note']."<br>";
+ }
} else {
if (isset($row['fees']) & ((strtoupper($row['fees']) != 'NONE') or ($row['fees'] != ''))) {
$fees .= $this->display_text($row['fees']);
@@ -289,12 +304,28 @@
}
} else {
$constraints = $discPrivacy.$accessConstraints;
- $this->generateXmlOutput($fees,$constraints);
+ //$this->generateXmlOutput($fees,$constraints);
+ $XML = $this->generateXmlOutputGdiDe($row['fees'], $row['accessconstraints'], $row['source_note'], $row['name'], $row['descriptionlink'], $row['symbollink'], $row['description'], $row['source_required']);
+ if (!$this->returnDirect) {
+ return $XML;
+ } else {
+ header("Content-type: application/xhtml+xml; charset=UTF-8");
+ echo $XML;
+ die();
+ }
}
}
} else {
if ($this->outputFormat == "iso19139") {
- $this->generateXmlOutput(false,false);
+ //$this->generateXmlOutput(false,false);
+ $XML = $this->generateXmlOutputGdiDe(false,false,false,false,false,false,false,false);
+ if (!$this->returnDirect) {
+ return $XML;
+ } else {
+ header("Content-type: application/xhtml+xml; charset=UTF-8");
+ echo $XML;
+ die();
+ }
} else {
if ($this->returnDirect) {
echo "free";
@@ -306,6 +337,153 @@
}
}
+ function generateXmlOutputGdiDe($fees, $accessConstraints, $sourceNote, $licenseName, $licenseUrl, $licenseSymbolUrl, $licenseDescription, $licenseRequireSource) {
+ $predefinedLicenseFound = false;
+
+ if (isset($licenseName) && $licenseName !== "" && $licenseName !== false) {
+ $predefinedLicenseFound = true;
+ $license_id = $licenseName;
+ $license_name = $licenseDescription;
+ $license_link = $licenseUrl;
+ $license_require_source = $licenseRequireSource;
+ if ($license_require_source == 't') {
+ if (isset($sourceNote) && $sourceNote !== "") {
+ $license_source = $sourceNote;
+ } else {
+ $license_source = "Source note required by license, but not given!";
+ }
+ } else {
+ $license_source = false;
+ }
+ }
+ $predefinedLicenseText = "";
+ if ($predefinedLicenseFound == true) {
+ //generate json string (id, name , url, quelle) - see german standard gdi-de
+ $jsonLicense = new stdClass();
+ $jsonLicense->id = $license_id;
+ $jsonLicense->name = $license_name;
+ $jsonLicense->link = $license_link;
+ $predefinedLicenseText = _mb('License').": ".$license_id." - ".$license_name." - ".$license_link;
+ if ($license_source !== false) {
+ $jsonLicense->quelle = $license_source;
+ $predefinedLicenseText .= " - "._mb("Source note").": ".$license_source;
+ }
+ }
+ //build xml snippet via dom!
+ $iso19139 = new DOMDocument('1.0');
+ $iso19139->encoding = 'UTF-8';
+ $iso19139->preserveWhiteSpace = false;
+ $iso19139->formatOutput = true;
+ //generate own constraints object for collecting resourceConstraints
+ $constraints = $iso19139->createElementNS('http://www.mapbender.org/metadata/constraints','mb:constraints');
+ //define namespaces for possible elements in resourceConstraints
+ $constraints->setAttribute("xmlns:gmd", "http://www.isotc211.org/2005/gmd");
+ $constraints->setAttribute("xmlns:gco", "http://www.isotc211.org/2005/gco");
+ //define resourceConstraints field
+ $resourceConstraints=$iso19139->createElement("gmd:resourceConstraints");
+ $MD_LegalConstraints=$iso19139->createElement("gmd:MD_LegalConstraints");
+ $useLimitation=$iso19139->createElement("gmd:useLimitation");
+ $useLimitation_cs=$iso19139->createElement("gco:CharacterString");
+ //check if useLimitations are stored at mb_metadata table level (maybe they are inherited from services)
+ //for more information see http://www.geoportal.de/SharedDocs/Downloads/DE/GDI-DE/Dokumente/Architektur_GDI_DE_Konventionen_Metadaten_v1_1_1.pdf?__blob=publicationFile - part 3
+ //if so, give them (fees from capabilities should be included in useLimitations, accessconstraints from capabilities should be included in a separate accessConstraints element!
+ //if some fees are given and a predefined license is selected, give a combination of both!
+
+ if (isset($fees) && $fees !== '' && $fees !== false && strtoupper($fees) !== "NONE") {
+ $useLimitationTextString = $predefinedLicenseText." - ".$fees;
+ } else {
+ $useLimitationTextString = $predefinedLicenseText;
+ }
+ if ($useLimitationTextString == "") {
+ $useLimitationTextString = "no conditions apply"; //INSPIRE
+ //$useLimitationTextString = "Es gelten keine Bedingungen"; //GDI-DE
+ //$useLimitationTextString = "Bedingungen unbekannt"; //GDI-DE
+ }
+ $useLimitationText = $iso19139->createTextNode($useLimitationTextString);
+ //TODO: Mapping of constraints between OWS/registry and INSPIRE
+ $useLimitation_cs->appendChild($useLimitationText);
+ $useLimitation->appendChild($useLimitation_cs);
+ $MD_LegalConstraints->appendChild($useLimitation);
+ $resourceConstraints->appendChild($MD_LegalConstraints);
+ $constraints->appendChild($resourceConstraints);
+
+ //Also add useConstraints field with same content for compatibility with ISO19115 and GDI-DE
+ if ($predefinedLicenseFound == true) {
+ //TODO useConstraints for license/otherConstraints
+
+ $resourceConstraints=$iso19139->createElement("gmd:resourceConstraints");
+ $MD_LegalConstraints=$iso19139->createElement("gmd:MD_LegalConstraints");
+
+ $useConstraints=$iso19139->createElement("gmd:useConstraints");
+ $MD_RestrictionCode=$iso19139->createElement("gmd:MD_RestrictionCode");
+ $MD_RestrictionCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#MD_RestrictionCode");
+ $MD_RestrictionCode->setAttribute("codeListValue", "license");
+ $useConstraints->appendChild($MD_RestrictionCode);
+ $MD_LegalConstraints->appendChild($useConstraints);
+
+ //and otherConstraints for text
+ $useConstraints=$iso19139->createElement("gmd:useConstraints");
+ $MD_RestrictionCode=$iso19139->createElement("gmd:MD_RestrictionCode");
+ $MD_RestrictionCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#MD_RestrictionCode");
+ $MD_RestrictionCode->setAttribute("codeListValue", "otherConstraints");
+ $useConstraints->appendChild($MD_RestrictionCode);
+ $MD_LegalConstraints->appendChild($useConstraints);
+
+ //text element
+ $otherConstraints=$iso19139->createElement("gmd:otherConstraints");
+ $otherConstraints_cs=$iso19139->createElement("gco:CharacterString");
+ //copy from above
+ $otherConstraintsText = $iso19139->createTextNode($useLimitationTextString);
+ $otherConstraints_cs->appendChild($otherConstraintsText);
+ $otherConstraints->appendChild($otherConstraints_cs);
+ $MD_LegalConstraints->appendChild($otherConstraints);
+ //json representation
+ $otherConstraints=$iso19139->createElement("gmd:otherConstraints");
+ $otherConstraints_cs=$iso19139->createElement("gco:CharacterString");
+ //copy from above
+ $otherConstraintsText = $iso19139->createTextNode(json_encode($jsonLicense));
+ $otherConstraints_cs->appendChild($otherConstraintsText);
+ $otherConstraints->appendChild($otherConstraints_cs);
+ $MD_LegalConstraints->appendChild($otherConstraints);
+ }
+ $resourceConstraints->appendChild($MD_LegalConstraints);
+ $constraints->appendChild($resourceConstraints);
+
+ $resourceConstraints=$iso19139->createElement("gmd:resourceConstraints");
+ $MD_LegalConstraints=$iso19139->createElement("gmd:MD_LegalConstraints");
+ $accessConstraintsXml=$iso19139->createElement("gmd:accessConstraints");
+ $MD_RestrictionCode=$iso19139->createElement("gmd:MD_RestrictionCode");
+ $MD_RestrictionCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RestrictionCode");
+ $MD_RestrictionCode->setAttribute("codeListValue", "otherRestrictions");
+ $MD_RestrictionCodeText=$iso19139->createTextNode("otherRestrictions");
+ $otherConstraints=$iso19139->createElement("gmd:otherConstraints");
+ $otherConstraints_cs=$iso19139->createElement("gco:CharacterString");
+ if (isset($accessConstraints) && $accessConstraints !== '' && strtoupper($accessConstraints) !== 'NONE' && $accessConstraints !== false) {
+ $otherConstraintsText=$iso19139->createTextNode($accessConstraints);
+ //$e = new mb_exception(gettype($accessConstraints));
+ } else {
+ $otherConstraintsTextString = "no constraints"; //INSPIRE
+ //$otherConstraintsTextString = "Es gelten keine Bedingungen"; //GDI-DE
+ //$otherConstraintsTextString = "Bedingungen unbekannt"; //GDI-DE
+ $otherConstraintsText=$iso19139->createTextNode($otherConstraintsTextString);
+ }
+ $otherConstraints_cs->appendChild($otherConstraintsText);
+ $otherConstraints->appendChild($otherConstraints_cs);
+
+ $MD_RestrictionCode->appendChild($MD_RestrictionCodeText);
+ $accessConstraintsXml->appendChild($MD_RestrictionCode);
+
+ $MD_LegalConstraints->appendChild($accessConstraintsXml);
+ $MD_LegalConstraints->appendChild($otherConstraints);
+ $resourceConstraints->appendChild($MD_LegalConstraints);
+ $constraints->appendChild($resourceConstraints);
+ $test = $iso19139->appendChild($constraints);
+ $XML = $iso19139->saveXML();
+ return $XML;
+
+
+ }
+
function generateXmlOutput($fees,$serviceconstraints) {
//example from INSPIRE Metadata TG 29.10.2013 if no accessconstraints exists:
/*
Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/classes/class_wms.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -2821,7 +2821,7 @@
//they don't come from the capabilities!
if (!$updateMetadataOnly) {
//read network_access from database
- $sql = "SELECT wms_network_access, fkey_mb_group_id, wms_max_imagesize, inspire_annual_requests, wms_license_source_note from wms WHERE wms_id = $1 ";
+ $sql = "SELECT wms_network_access, fkey_mb_group_id, wms_max_imagesize, inspire_annual_requests, wms_license_source_note, wms_bequeath_licence_info, wms_bequeath_contact_info from wms WHERE wms_id = $1 ";
$v = array($myWMS);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
@@ -2834,6 +2834,7 @@
$this->wms_bequeath_contact_info = $row["wms_bequeath_contact_info"];
$this->fkey_mb_group_id = $row["fkey_mb_group_id"];
}
+ $e = new mb_exception('bequeath_licence: '.$this->wms_bequeath_licence_info);
//if network access is either stored in database nor given thru object, set it too a default value 0
if (!isset($this->wms_network_access) || ($this->wms_network_access == '')) {
$this->wms_network_access = intval('0');
@@ -3493,6 +3494,7 @@
$this->contactelectronicmailaddress = $row2["contactelectronicmailaddress"];
$this->wms_max_imagesize = $row2["wms_max_imagesize"];
$this->inspire_annual_requests = $row2["inspire_annual_requests"];
+ $this->wms_license_source_note = $row2["wms_license_source_note"];
$this->wms_bequeath_licence_info = $row2["wms_bequeath_licence_information"];
$this->wms_bequeath_contact_info = $row2["wms_bequeath_contact_information"];
$count_wms++;
@@ -3721,6 +3723,7 @@
$this->uuid = $row2["uuid"];
$this->wms_max_imagesize = $row2["wms_max_imagesize"];
$this->inspire_annual_requests = $row2["inspire_annual_requests"];
+ $this->wms_license_source_note = $row2["wms_license_source_note"];
$this->wms_bequeath_licence_info = $row2["wms_bequeath_licence_info"];
$this->wms_bequeath_contact_info = $row2["wms_bequeath_contact_info"];
//some default values
Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -31,9 +31,8 @@
require_once(dirname(__FILE__) . "/../classes/class_Uuid.php");
require_once(dirname(__FILE__) . "/../php/mod_validateInspire.php");
require_once(dirname(__FILE__) . "/../classes/class_iso19139.php");
+require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php");
-
-
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
@@ -135,7 +134,7 @@
proxyFile($mb_metadata['data'],$outputFormat);
die();
} else {
- validateInspire($row['data']);
+ validateInspire($mb_metadata['data']);
die();
}
} else {
@@ -149,6 +148,12 @@
//load metadata, from url and send it to requesting client
$metadataUrlObject = new connector($mb_metadata['link']);
$metadataXml = $metadataUrlObject->file;
+ //TODO: exchange contact and licence information if metadata proxy is activated!
+
+ if ($mb_metadata['md_proxy'] == true || $mb_metadata['md_proxy'] == 't') {
+ //$metadataXml1 = exchangeLicenceAndContact($metadataXml, $mb_metadata['metadata_id'], $mb_metadata['fkey_mb_group_id'], $mb_metadata['md_license_source_note']);
+ $metadataXml = exchangeLicenceAndContact($metadataXml, $mb_metadata['metadata_id'], $mb_metadata['fkey_mb_group_id'], $mb_metadata['md_license_source_note']);
+ }
if ($_REQUEST['VALIDATE'] != "true") {
proxyFile($metadataXml,$outputFormat);
die();
@@ -178,7 +183,11 @@
break;
case 'capabilities':
//do the same as for the external case but all from caps should be harvested
- if ($mb_metadata['harvestresult'] == 1) {
+ if ($mb_metadata['harvestresult'] == 1 || $mb_metadata['harvestresult'] == '1') {
+ if ($mb_metadata['md_proxy'] == true || $mb_metadata['md_proxy'] == 't') {
+ //$metadataXml1 = exchangeLicenceAndContact($mb_metadata['data'], $mb_metadata['metadata_id'], $mb_metadata['fkey_mb_group_id'], $mb_metadata['md_license_source_note']);
+ $mb_metadata['data'] = exchangeLicenceAndContact($mb_metadata['data'], $mb_metadata['metadata_id'], $mb_metadata['fkey_mb_group_id'], $mb_metadata['md_license_source_note']);
+ }
if ($_REQUEST['VALIDATE'] != "true") {
proxyFile($mb_metadata['data'],$outputFormat);
die();
@@ -216,6 +225,103 @@
return $iso19139->transformToHtml();
}
+function exchangeLicenceAndContact($metadataXml, $metadata_id, $fkeyGroupId, $licenseSourceNote) {
+ //parse XML part
+ //echo $metadataXml;
+ //die();
+ //do parsing with dom, cause we want to alter the xml which have been parsed afterwards
+ $metadataDomObject = new DOMDocument();
+ libxml_use_internal_errors(true);
+ try {
+ $metadataDomObject->loadXML($metadataXml);
+ if ($metadataDomObject === false) {
+ foreach(libxml_get_errors() as $error) {
+ $err = new mb_exception("php/mod_dataISOMetadata.php:".$error->message);
+ }
+ throw new Exception("php/mod_dataISOMetadata.php:".'Cannot parse metadata with dom!');
+ }
+ }
+ catch (Exception $e) {
+ $err = new mb_exception("php/mod_dataISOMetadata.php:".$e->getMessage());
+ }
+ if ($metadataDomObject !== false) {
+ //importing namespaces
+ $xpath = new DOMXPath($metadataDomObject);
+ $rootNamespace = $metadataDomObject->lookupNamespaceUri($metadataDomObject->namespaceURI);
+ $xpath->registerNamespace('defaultns', $rootNamespace);
+ //$xpath->registerNamespace('georss','http://www.georss.org/georss');
+ $xpath->registerNamespace("csw", "http://www.opengis.net/cat/csw/2.0.2");
+ $xpath->registerNamespace("gml", "http://www.opengis.net/gml");
+ $xpath->registerNamespace("gco", "http://www.isotc211.org/2005/gco");
+ $xpath->registerNamespace("gmd", "http://www.isotc211.org/2005/gmd");
+ $xpath->registerNamespace("gts", "http://www.isotc211.org/2005/gts");
+ //$xpath->registerNamespace("srv", "http://www.isotc211.org/2005/srv");
+ $xpath->registerNamespace("xlink", "http://www.w3.org/1999/xlink");
+ //
+ if (isset($fkeyGroupId) && (integer)$fkeyGroupId > 0) {
+ //$e = new mb_exception("group id found");
+ //select group information
+ $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($fkeyGroupId);
+ $tDep = array('i');
+ $resDep = db_prep_query($sqlDep, $vDep, $tDep);
+ $departmentMetadata = db_fetch_array($resDep);
+ //exchange contact information
+ $inputXml = '<?xml version="1.0" encoding="UTF-8"?><gmd:contact xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gmd:CI_ResponsibleParty><gmd:organisationName><gco:CharacterString>'.$departmentMetadata['mb_group_title'].'</gco:CharacterString></gmd:organisationName><gmd:contactInfo><gmd:CI_Contact><gmd:address><gmd:CI_Address><gmd:electronicMailAddress><gco:CharacterString>'.$departmentMetadata['mb_group_email'].'</gco:CharacterString></gmd:electronicMailAddress></gmd:CI_Address></gmd:address></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>';
+ $contactDomObject = new DOMDocument();
+ $contactDomObject->loadXML($inputXml);
+ $xpathInput = new DOMXpath($contactDomObject);
+ $inputNodeList = $xpathInput->query('/gmd:contact');
+ //$inputNode = $inputNodeList->item(0)->firstChild; responsible party
+ $inputNode = $inputNodeList->item(0);
+ //get contact node or node list
+ $contactNodeList = $xpath->query('/gmd:MD_Metadata/gmd:contact');
+ //test to delete all contact nodes more than one
+ for ($i = 0; $i < $contactNodeList->length; $i++) {
+ if ($i == 0) {
+ $temp = $contactNodeList->item($i);
+ $temp->parentNode->replaceChild($metadataDomObject->importNode($inputNode, true), $temp);
+ }
+ if ($i > 0) {
+ $temp = $contactNodeList->item($i); //avoid calling a function twice
+ $temp->parentNode->removeChild($temp);
+ }
+ }
+ }
+ // licenses
+ //pull licence information
+ $constraints = new OwsConstraints();
+ $constraints->languageCode = "de";
+ $constraints->asTable = false;
+ $constraints->id = $metadata_id;
+ $constraints->type = "metadata";
+ $constraints->returnDirect = false;
+ $constraints->outputFormat='iso19139';
+ $tou = $constraints->getDisclaimer();
+ //constraints - after descriptive keywords
+ if (isset($tou) && $tou !== '' && $tou !== false) {
+ //count old resourceConstraints elements
+ $resourceConstraintsNodeList = $xpath->query('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints');
+ //load xml from constraint generator
+ $licenseDomObject = new DOMDocument();
+ $licenseDomObject->loadXML($tou);
+ $xpathLicense = new DOMXpath($licenseDomObject);
+ $licenseNodeList = $xpathLicense->query('/mb:constraints/gmd:resourceConstraints');
+ //insert new constraints before first old constraints node
+ 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
+ for ($i = 0; $i < $resourceConstraintsNodeList->length; $i++) {
+ $temp = $resourceConstraintsNodeList->item($i); //avoid calling a function twice
+ $temp->parentNode->removeChild($temp);
+ }
+ }
+ //test http://localhost/mb_trunk/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=0da11651-aa61-d75a-446c-ea4ea073bc48
+ }
+ return $metadataDomObject->saveXML();
+}
+
function proxyFile($iso19139str,$outputFormat) {
switch ($outputFormat) {
case "rdf":
@@ -233,6 +339,7 @@
}
}
+
//some needfull functions to pull metadata out of the database!
function fillISO19139($iso19139, $recordId) {
global $admin;
@@ -268,7 +375,7 @@
SQL;
//TODO: Problem - the metadata may be used for more than one service - not often but sometimes - does one get the right contact data?
//TODO: Problem - this is also the fact if the data is provided by a wfs featuretype! There maybe other contact infos - maybe the info should be integrated more than once and identical info should be identified
- $e = new mb_exception("used metadata id: ".$mb_metadata['metadata_id']);
+ //$e = new mb_exception("used metadata id: ".$mb_metadata['metadata_id']);
$v = array($mb_metadata['metadata_id']);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
@@ -327,7 +434,7 @@
$mapbenderMetadata = 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($mapbenderMetadata['fkey_mb_group_id']) or is_null($mapbenderMetadata['fkey_mb_group_id']) or $mapbenderMetadata['fkey_mb_group_id'] == 0){
- $e = new mb_exception("mod_dataISOMetadata.php: fkey_mb_group_id not found!");
+ $e = new mb_notice("mod_dataISOMetadata.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($mapbenderMetadata['wms_owner']);
@@ -335,7 +442,7 @@
$resDep = db_prep_query($sqlDep, $vDep, $tDep);
$departmentMetadata = db_fetch_array($resDep);
} else {
- $e = new mb_exception("mod_dataISOMetadata.php: fkey_mb_group_id found!");
+ $e = new mb_notice("mod_dataISOMetadata.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($mapbenderMetadata['fkey_mb_group_id']);
$tDep = array('i');
@@ -1108,7 +1215,6 @@
} else {
$license_source = false;
}
-
}
}
$predefinedLicenseText = "";
@@ -1124,7 +1230,6 @@
$predefinedLicenseText .= _mb("Source note: ").$license_source;
}
}
-
$resourceConstraints=$iso19139->createElement("gmd:resourceConstraints");
$MD_LegalConstraints=$iso19139->createElement("gmd:MD_LegalConstraints");
$useLimitation=$iso19139->createElement("gmd:useLimitation");
@@ -1309,7 +1414,7 @@
$e = new mb_notice("look for topic: ");
$countTopic = 0;
while ($row = db_fetch_array($res)) {
- $e = new mb_exception("topic cat found!");
+ $e = new mb_notice("topic cat found!");
$topicCategory=$iso19139->createElement("gmd:topicCategory");
$MD_TopicCategoryCode=$iso19139->createElement("gmd:MD_TopicCategoryCode");
$MD_TopicCategoryText=$iso19139->createTextNode($row['md_topic_category_code_en']);
@@ -1318,9 +1423,9 @@
$MD_DataIdentification->appendChild($topicCategory);
$countTopic++;
}
- $e = new mb_exception("count topic: ".$countTopic);
+ $e = new mb_notice("count topic: ".$countTopic);
if ($countTopic == 0) {
- $e = new mb_exception("no topic cat found!");
+ $e = new mb_notice("no topic cat found!");
$topicCategory=$iso19139->createElement("gmd:topicCategory");
$MD_TopicCategoryCode=$iso19139->createElement("gmd:MD_TopicCategoryCode");
$MD_TopicCategoryText=$iso19139->createTextNode("no category defined till now!");
Modified: trunk/mapbender/http/php/mod_layerISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_layerISOMetadata.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/php/mod_layerISOMetadata.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -25,6 +25,7 @@
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_owsConstraints.php");
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
@@ -565,52 +566,28 @@
//Part B 3 INSPIRE Category
//do this only if an INSPIRE keyword (Annex I-III) is set
- //Resource Constraints B 8
- $resourceConstraints=$iso19139->createElement("gmd:resourceConstraints");
- $MD_LegalConstraints=$iso19139->createElement("gmd:MD_Constraints");
- $useLimitation=$iso19139->createElement("gmd:useLimitation");
- $useLimitation_cs=$iso19139->createElement("gco:CharacterString");
- if(isset($mapbenderMetadata['accessconstraints'])){
- $useLimitationText=$iso19139->createTextNode($mapbenderMetadata['accessconstraints']);
- }
- else
- {
- $useLimitationText=$iso19139->createTextNode("no conditions apply");
- }
- //TODO: Mapping of constraints between OWS/registry and INSPIRE see View Service Guidance
- $useLimitation_cs->appendChild($useLimitationText);
- $useLimitation->appendChild($useLimitation_cs);
- $MD_LegalConstraints->appendChild($useLimitation);
- $resourceConstraints->appendChild($MD_LegalConstraints);
- $SV_ServiceIdentification->appendChild($resourceConstraints);
- $resourceConstraints=$iso19139->createElement("gmd:resourceConstraints");
- $MD_LegalConstraints=$iso19139->createElement("gmd:MD_LegalConstraints");
- $accessConstraints=$iso19139->createElement("gmd:accessConstraints");
- $MD_RestrictionCode=$iso19139->createElement("gmd:MD_RestrictionCode");
- $MD_RestrictionCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_RetrictionCode");
- $MD_RestrictionCode->setAttribute("codeListValue", "otherRestrictions");
- $MD_RestrictionCodeText=$iso19139->createTextNode("otherRestrictions");
- $otherConstraints=$iso19139->createElement("gmd:otherConstraints");
- $otherConstraints_cs=$iso19139->createElement("gco:CharacterString");
- if (isset($mapbenderMetadata['accessconstraints']) & strtoupper($mapbenderMetadata['accessconstraints']) != 'NONE'){
- $otherConstraintsText=$iso19139->createTextNode($mapbenderMetadata['accessconstraints']);
+ //Resource Constraints B 8 - to be handled with xml snippets from constraints class
+ //pull licence information
+ $constraints = new OwsConstraints();
+ $constraints->languageCode = "de";
+ $constraints->asTable = false;
+ $constraints->id = $mapbenderMetadata['wms_id'];
+ $constraints->type = "wms";
+ $constraints->returnDirect = false;
+ $constraints->outputFormat='iso19139';
+ $tou = $constraints->getDisclaimer();
+ //constraints - after descriptive keywords
+ if (isset($tou) && $tou !== '' && $tou !== false) {
+ //load xml from constraint generator
+ $licenseDomObject = new DOMDocument();
+ $licenseDomObject->loadXML($tou);
+ $xpathLicense = new DOMXpath($licenseDomObject);
+ $licenseNodeList = $xpathLicense->query('/mb:constraints/gmd:resourceConstraints');
+ for ($i = ($licenseNodeList->length)-1; $i >= 0; $i--) {
+ $SV_ServiceIdentification->appendChild($iso19139->importNode($licenseNodeList->item($i), true));
+ }
}
- else {
- $otherConstraintsText=$iso19139->createTextNode("no constraints");
- }
- $otherConstraints_cs->appendChild($otherConstraintsText);
- $otherConstraints->appendChild($otherConstraints_cs);
-
- $MD_RestrictionCode->appendChild($MD_RestrictionCodeText);
- $accessConstraints->appendChild($MD_RestrictionCode);
-
- $MD_LegalConstraints->appendChild($accessConstraints);
- $MD_LegalConstraints->appendChild($otherConstraints);
- $resourceConstraints->appendChild($MD_LegalConstraints);
-
- $SV_ServiceIdentification->appendChild($resourceConstraints);
-
/* example
<srv:serviceType>
<gco:LocalName>view</gco:LocalName>
Modified: trunk/mapbender/http/php/wms.php
===================================================================
--- trunk/mapbender/http/php/wms.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/php/wms.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -48,21 +48,26 @@
if (isset($inspire) && $inspire === 1 ) {
$inspire = true;
}
-
-$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=";
-
-//http://www.geoportal.rlp.de/mapbender/php/mod_layerISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=24615
-if (isset($_SERVER["HTTPS"])){
- $urlPrefix = "https://";
+if (DEFINED("MAPBENDER_PATH") && MAPBENDER_PATH !== "") {
+ $mapbenderMetadaUrl = MAPBENDER_PATH."/php/mod_showMetadata.php?resource=layer&id=";
+ $inspireServiceMetadataUrl = MAPBENDER_PATH."/php/mod_layerISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=";
+ $mapbenderMetadataUrlUrl = MAPBENDER_PATH."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=";
} else {
- $urlPrefix = "http://";
+ $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;
}
-$mapbenderMetadataUrl = $urlPrefix.$mapbenderMetadataUrl;
-$inspireServiceMetadataUrl = $urlPrefix.$inspireServiceMetadataUrl;
-$mapbenderMetadataUrlUrl = $urlPrefix.$mapbenderMetadataUrlUrl;
+//http://www.geoportal.rlp.de/mapbender/php/mod_layerISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=24615
+
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
@@ -1154,7 +1159,7 @@
$subLayerId = $layerRow['layer_id'];
$sql = <<<SQL
-SELECT metadata_id, uuid, link, linktype, md_format, origin, datasetid FROM mb_metadata
+SELECT metadata_id, uuid, link, linktype, md_format, origin, datasetid, md_proxy FROM mb_metadata
INNER JOIN (SELECT * from ows_relation_metadata
WHERE fkey_layer_id = $subLayerId ) as relation ON
mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin IN ('capabilities','external','metador','upload')
@@ -1201,7 +1206,12 @@
$onlineResource = $doc->createElement("OnlineResource");
$onlineResource = $metadataUrl->appendChild($onlineResource);
$onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
- $onlineResource->setAttribute("xlink:href", $row_metadata['link']);
+ //check if md_proxy is set
+ if ($row_metadata['md_proxy'] == 't' || $row_metadata['md_proxy'] == true) {
+ $onlineResource->setAttribute("xlink:href", $mapbenderMetadataUrlUrl.$row_metadata['uuid']);
+ } else {
+ $onlineResource->setAttribute("xlink:href", $row_metadata['link']);
+ }
break;
case 'external':
$metadataUrl = $doc->createElement("MetadataURL");
@@ -1214,8 +1224,12 @@
$onlineResource = $doc->createElement("OnlineResource");
$onlineResource = $metadataUrl->appendChild($onlineResource);
$onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
- $onlineResource->setAttribute("xlink:href", $row_metadata['link']);
- $onlineResource->setAttribute("xlink:href", $mapbenderMetadataUrlUrl.$row_metadata['uuid']);
+ //check if md_proxy is set
+ if ($row_metadata['md_proxy'] == 't' || $row_metadata['md_proxy'] == true) {
+ $onlineResource->setAttribute("xlink:href", $mapbenderMetadataUrlUrl.$row_metadata['uuid']);
+ } else {
+ $onlineResource->setAttribute("xlink:href", $row_metadata['link']);
+ }
break;
case 'upload':
$metadataUrl = $doc->createElement("MetadataURL");
Modified: trunk/mapbender/http/plugins/mb_metadata_edit.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.php 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.php 2016-11-08 09:28:39 UTC (rev 9622)
@@ -84,12 +84,12 @@
<p>
<label for="wms_bequeath_licence_info"><?php echo _mb("Bequeath licence info from service to coupled dataset metadata (Registry)");?>:</label>
<input name="wms_bequeath_licence_info" id="wms_bequeath_licence_info" type="checkbox"/>
- <img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Bequeath licence information from this service to all coupled dataset metadata. This function activates the dataset metadata proxy and the url of the original metadata will be exchanged with a geoportal proxy url. Check this to have licences of service and dataset in sync. This maybe usefull for a better exchange of geo-metadata with open data catalogues/portals.");?>'}" src="../img/questionmark.png" alt="" />
+ <img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Bequeath licence information from this service to all coupled dataset metadata. This function activates the dataset metadata proxy and the url of the original metadata will be exchanged with a geoportal proxy url. Check this to have licences of service and dataset in sync. This maybe usefull for a better exchange of geo-metadata with open data catalogues/portals. <b>Important:</b> The service have to be updated after changing this flag!");?>'}" src="../img/questionmark.png" alt="" />
</p>
<p>
<label for="wms_bequeath_contact_info"><?php echo _mb("Bequeath contact info from service to coupled dataset metadata (Registry)");?>:</label>
<input name="wms_bequeath_contact_info" id="wms_bequeath_contact_info" type="checkbox"/>
- <img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Bequeath contact information from this service to all coupled dataset metadata. This function activates the dataset metadata proxy and the url of the original metadata will be exchanged with a geoportal proxy url. Check this to have the contact information of service and dataset in sync. It will use the contact information of the geoportal organization role system instead of the contact information which originates from the dataset metadata. This maybe usefull for a better exchange of geo-metadata with open data catalogues/portals.");?>'}" src="../img/questionmark.png" alt="" />
+ <img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Bequeath contact information from this service to all coupled dataset metadata. This function activates the dataset metadata proxy and the url of the original metadata will be exchanged with a geoportal proxy url. Check this to have the contact information of service and dataset in sync. It will use the contact information of the geoportal organization role system instead of the contact information which originates from the dataset metadata. This maybe usefull for a better exchange of geo-metadata with open data catalogues/portals. <b>Important:</b> The service have to be updated after changing this flag!");?>'}" src="../img/questionmark.png" alt="" />
</p>
</fieldset>
<fieldset>
Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql 2016-11-08 09:28:39 UTC (rev 9622)
@@ -1288,4 +1288,5 @@
OWNER TO postgres;
ALTER TABLE wms ADD COLUMN wms_bequeath_licence_info INTEGER;
ALTER TABLE wms ADD COLUMN wms_bequeath_contact_info INTEGER;
-
+-- New column for metadata proxy - if some information from service should be inherited!
+ALTER TABLE mb_metadata ADD COLUMN md_proxy BOOLEAN;
Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po 2016-10-25 15:36:21 UTC (rev 9621)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po 2016-11-08 09:28:39 UTC (rev 9622)
@@ -4152,3 +4152,18 @@
msgid "Please select a value for TIME. One single element can be dragged on timeline after selection. Scale may be altered by scrolling."
msgstr "Bitte wählen sie einen Wert für TIME. Ein einzelnes Element kann nach Auswahl auf der Zeitachse verschoben werden. Der Maßstab lässt sich ggf. durch Scrollen anpassen."
+msgid "Source note"
+msgstr "Quellenvermerk"
+
+msgid "Bequeath licence info from service to coupled dataset metadata (Registry)"
+msgstr "Vererbe Lizenzinformation des Dienstes auf alle gekoppelten Datensatz-Metadaten (Registry)"
+
+msgid "Bequeath licence information from this service to all coupled dataset metadata. This function activates the dataset metadata proxy and the url of the original metadata will be exchanged with a geoportal proxy url. Check this to have licences of service and dataset in sync. This maybe usefull for a better exchange of geo-metadata with open data catalogues/portals. <b>Important:</b> The service have to be updated after changing this flag!"
+msgstr "Vererbung der Lizenzinformationen auf die gekoppelten Datensatz-Metadaten. Diese Funktion aktiviert den Metadatenproxy und die URL des originären Metadatensatzes wird durch eine URL auf die Registry ersetzt. Bei Auslieferung des Metadatensatzes erfolgt der Austausch der Informationen bezüglich der Lizenzbedingungen und Zugriffsbeschränkungen 'on the fly'. Mit dieser Option können die Lizenzinformationen zwischen den Diensten und den Datensätzen synchron gehalten werden und ein Austausch von Metadaten mit externen Portalen/Katalogen (z.B. OpenData Portalen) wird stark vereinfacht. <b>Wichtig:</b> der Dienst muss nach Änderung dieser Einstellung aktualisiert werden!"
+
+msgid "Bequeath contact info from service to coupled dataset metadata (Registry)"
+msgstr "Vererbe Metadatenkontaktinformationen des Dienstes auf alle gekoppelten Datensatz-Metadaten (Registry)"
+
+msgid "Bequeath contact information from this service to all coupled dataset metadata. This function activates the dataset metadata proxy and the url of the original metadata will be exchanged with a geoportal proxy url. Check this to have the contact information of service and dataset in sync. It will use the contact information of the geoportal organization role system instead of the contact information which originates from the dataset metadata. This maybe usefull for a better exchange of geo-metadata with open data catalogues/portals. <b>Important:</b> The service have to be updated after changing this flag!"
+msgstr "Vererbung der Metadatenkontaktinformationen auf die gekoppelten Datensatz-Metadaten. Diese Funktion aktiviert den Metadatenproxy und die URL des originären Metadatensatzes wird durch eine URL auf die Registry ersetzt. Bei Auslieferung des Metadatensatzes erfolgt der Austausch der Informationen zum Metadatenkontakt 'on the fly'. Mit dieser Option können diese Informationen zwischen den Diensten und den Datensätzen synchron gehalten werden und ein Austausch von Metadaten mit externen Portalen/Katalogen (z.B. OpenData Portalen) wird stark vereinfacht. <b>Wichtig:</b> der Dienst muss nach Änderung dieser Einstellung aktualisiert werden!"
+
More information about the Mapbender_commits
mailing list