[Mapbender-commits] r10285 - in trunk/mapbender: http/classes http/geoportal http/php http/plugins resources/db/pgsql/UTF-8/update tools
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Oct 16 23:34:49 PDT 2019
Author: armin11
Date: 2019-10-16 23:34:49 -0700 (Wed, 16 Oct 2019)
New Revision: 10285
Added:
trunk/mapbender/http/plugins/mb_metadataApplication.php
trunk/mapbender/http/plugins/mb_metadata_preview_import.js
trunk/mapbender/http/plugins/mb_metadata_showMetadata.js
Modified:
trunk/mapbender/http/classes/class_administration.php
trunk/mapbender/http/classes/class_iso19139.php
trunk/mapbender/http/classes/class_metadata.php
trunk/mapbender/http/classes/class_user.php
trunk/mapbender/http/geoportal/mod_showPreview.php
trunk/mapbender/http/php/mod_dataISOMetadata.php
trunk/mapbender/http/plugins/mb_metadata_manager_select.js
trunk/mapbender/http/plugins/mb_metadata_manager_server.php
trunk/mapbender/http/plugins/mb_metadata_server.php
trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
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.8_pgsql_UTF-8.sql
trunk/mapbender/tools/exportMetadata.sh
Log:
New option to support the management of application metadata - also internal applications are covered - internal: combination of gui/wmc/mapviewertype - is handled as an 'application'. TBD: include the metadata in the catalogue interface.
Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/classes/class_administration.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -2374,6 +2374,84 @@
}
return $uniqueResourceIdentifierCodespace;
}
+
+ /**
+ * selects the mapviewer types (different mapviewer apis) from database
+ *
+ * @param none
+ * @return json object with database information
+ */
+ function listMapviewerTypes() {
+ $sql = "SELECT * FROM mapviewer_types";
+ $res = db_query($sql);
+ $jsonResult = new stdClass();
+ $jsonResult->mapviewer_types = array();
+ $i = 0;
+ while($row = db_fetch_array($res)){
+ $jsonResult->mapviewer_types[$i]->id = $row["mapviewer_id"];
+ $jsonResult->mapviewer_types[$i]->name = $row["mapviewer_name"];
+ $jsonResult->mapviewer_types[$i]->description = $row["mapviewer_description"];
+ $jsonResult->mapviewer_types[$i]->api = json_decode(stripslashes($row["mapviewer_api_json"]));
+ $i++;
+ }
+ return json_encode($jsonResult->mapviewer_types);
+ }
+
+ function getMapviewerInvokeUrl($mapviewerTypeId, $guiId = false, $wmcId = false) {
+ //get mapviewerType json
+ $sql = "SELECT * FROM mapviewer_types WHERE mapviewer_id = $1";
+ $v = array($mapviewerTypeId);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $row = db_fetch_array($res);
+ $api = json_decode(stripslashes($row["mapviewer_api_json"]));
+ if ($api == false) {
+ $e = new mb_exception("An error occured while decoding mapviewer_api_json field!");
+ }
+ /* example
+ {"protocol":"http","server_port":"$_SERVER['HTTP_PORT']","server_name":"$_SERVER['HTTP_NAME']","server_path":"mapbender\/frames","server_script":"index.php","gui_param":"gui_id","wmc_param":"WMC"}
+ */
+ if ($api->server_name == "\$_SERVER['HTTP_HOST']"){
+ $api->server_name = $_SERVER['HTTP_HOST'];
+ }
+ if (isset($api->server_port) && $api->server_port != '' && $api->server_port != '80') {
+ if ($api->server_port != "\$_SERVER['HTTP_PORT']") {
+ $api->server_name = $api->server_name.":".$api->server_port;
+ } else {
+ if ($_SERVER['HTTP_PORT'] != '80' && $_SERVER['HTTP_PORT'] != '' && $_SERVER['HTTP_PORT'] != '443') {
+ $api->server_name = $api->server_name.":".$_SERVER['HTTP_PORT'];
+ }
+ }
+ }
+ $paramters = array();
+ if ($guiId && $api->gui_param != null) {
+ $paramters[$api->gui_param] = $guiId;
+ }
+ if ($wmcId && $api->wmc_param != null) {
+ $paramters[$api->wmc_param] = $wmcId;
+ }
+ $query = http_build_query($paramters);
+ return $api->protocol."://".$api->server_name."/".$api->server_path."/".$api->server_script."?".$query;
+ }
+
+ function getMetadataPreviewUrl($metadataId) {
+ //get mapviewerType json
+ $sql = "SELECT preview_image FROM mb_metadata WHERE metadata_id = $1";
+ $v = array($metadataId);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $row = db_fetch_array($res);
+ $previewUrl = $row["preview_image"];
+ if ($row["preview_image"] == '{localstorage}') {
+ if (defined('MAPBENDER_PATH') && MAPBENDER_PATH != '') {
+ return MAPBENDER_PATH."/geoportal/mod_showPreview.php?resource=metadata&id=".$metadataId;
+ } else {
+ return "http://".$_SERVER["HTTP_HOST"]."/mapbender/geoportal/mod_showPreview.php?resource=metadata&id=".$metadataId;
+ }
+ } else {
+ return $row["preview_image"];
+ }
+ }
/**
* selects the gui_categories
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/classes/class_iso19139.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -85,6 +85,10 @@
var $resourceContactEmail; //char
var $codeListUpdateFrequencyArray;
var $searchable;
+ //Following attributes are only for application metadata editor and they are used for managing/publishing metadata for internal applications !
+ var $fkeyGuiId;
+ var $fkeyWmcSerialId;
+ var $fkeyMapviewerId;
function __construct() {
//initialize empty iso19139 object
@@ -152,6 +156,9 @@
$this->inspireRegulations = $this->getRelevantInspireRegulations();
//default the searchability in the mapbender catalogue to true
$this->searchable = 't';
+ $this->fkeyGuiId = null;
+ $this->fkeyWmcSerialId = null;
+ $this->fkeyMapviewerId = null;
}
//TODO: Following function is only needed til php 5.5 - after upgrade to debian 8 it is obsolet - see also class_syncCkan.php!
@@ -342,6 +349,9 @@
$e = new mb_exception("class_iso19139.php: No datasetId found in metadata record!");
}
}
+ //try another approach - if datasetId == undefined
+ //swiss model
+
//abstract
$this->abstract = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo/'.$identifikationXPath.'/gmd:abstract/gco:CharacterString');
$this->abstract = $this->abstract[0];
@@ -1451,6 +1461,9 @@
$this->resourceResponsibleParty = $row['responsible_party_name'];
$this->resourceContactEmail = $row['responsible_party_email'];
$this->previewImage = $row['preview_image'];
+ $this->fkeyGuiId = $row['fkey_gui_id'];
+ $this->fkeyWmcSerialId = $row['fkey_wmc_serial_id'];
+ $this->fkeyMapviewerId = $row['fkey_mapviewer_id'];
//get relations from other tables:
//get categories and keywords
//get isoCategories
@@ -2240,7 +2253,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, md_proxy, inspire_interoperability, searchable) 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, $45, $46)
+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, inspire_interoperability, searchable, fkey_gui_id, fkey_wmc_serial_id, fkey_mapviewer_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, $44, $45, $46, $47, $48, $49)
SQL;
$v = array(
$this->href,
@@ -2288,13 +2301,16 @@
$this->fkey_mb_group_id,
$this->mdProxy,
$this->inspireInteroperability,
- $this->searchable
+ $this->searchable,
+ $this->fkeyGuiId,
+ $this->fkeyWmcSerialId,
+ $this->fkeyMapviewerId
);
//$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','b','b','b');
+ $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','b','b','i','i','i');
$res = db_prep_query($sql,$v,$t);
return $res;
}
@@ -2354,7 +2370,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, md_proxy = $44, inspire_interoperability = $45, searchable = $46 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, inspire_interoperability = $45, searchable = $46, fkey_gui_id = $47, fkey_wmc_serial_id = $48, fkey_mapviewer_id = $49 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(
@@ -2404,10 +2420,13 @@
$this->fkey_mb_group_id,
$this->mdProxy,
$this->inspireInteroperability,
- $this->searchable
+ $this->searchable,
+ $this->fkeyGuiId,
+ $this->fkeyWmcSerialId,
+ $this->fkeyMapviewerId
);
//$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','b','b','b');
+ $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','b','b','i','i','i');
$res = db_prep_query($sql,$v,$t);
} else { //do the update without changing owner and fkey_mb_group_id!
$sql = "UPDATE mb_metadata SET link = $1, origin = $18, md_format = $2, data = $3, ";
@@ -2414,7 +2433,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, md_proxy = $43, inspire_interoperability = $44, searchable = $45 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, md_proxy = $43, inspire_interoperability = $44, searchable = $45, fkey_gui_id = $46, fkey_wmc_serial_id = $47, fkey_mapviewer_id = $48 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(
@@ -2463,10 +2482,13 @@
$this->previewImage,
$this->mdProxy,
$this->inspireInteroperability,
- $this->searchable
+ $this->searchable,
+ $this->fkeyGuiId,
+ $this->fkeyWmcSerialId,
+ $this->fkeyMapviewerId
);
//$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','b','b','b');
+ $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','b','b','b','i','i','i');
$res = db_prep_query($sql,$v,$t);
}
return $res;
@@ -2766,17 +2788,19 @@
if ($resourceType !== 'metadata') {
/*************************************/
//check if current relation already exists in case of upload
- if ($this->checkMetadataRelation($resourceType, $resourceId, $metadataId,$this->origin)) {
- $e = new mb_notice("class_Iso19139:"._mb("Relation already exists - it will not be generated twice!"));
- $result['value'] = true;
- $result['message'] = "Relation already exists - it will not be generated twice!";
- return $result;
+ if ($resourceType != 'application') {
+ if ($this->checkMetadataRelation($resourceType, $resourceId, $metadataId,$this->origin)) {
+ $e = new mb_notice("class_Iso19139:"._mb("Relation already exists - it will not be generated twice!"));
+ $result['value'] = true;
+ $result['message'] = "Relation already exists - it will not be generated twice!";
+ return $result;
+ }
+ //insert relation to layer/featuretype
+ $sql = "INSERT INTO ows_relation_metadata (fkey_".$resourceType."_id, fkey_metadata_id, relation_type) values ($1, $2, $3);";
+ $v = array($resourceId, $metadataId, $this->origin);
+ $t = array('i','i','s');
+ $res = db_prep_query($sql,$v,$t);
}
- //insert relation to layer/featuretype
- $sql = "INSERT INTO ows_relation_metadata (fkey_".$resourceType."_id, fkey_metadata_id, relation_type) values ($1, $2, $3);";
- $v = array($resourceId, $metadataId, $this->origin);
- $t = array('i','i','s');
- $res = db_prep_query($sql,$v,$t);
} else {
$res = true;
}
Modified: trunk/mapbender/http/classes/class_metadata.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/classes/class_metadata.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -197,7 +197,7 @@
$this->resourceCategories[4]['name'] = 'DATASET';
switch($this->languageCode){
case 'de':
- $this->resourceCategories[0]['name2show'] = 'Darstellungsdienste';
+ $this->resourceCategories[0]['name2show'] = 'Kartenebenen';
$this->resourceCategories[1]['name2show'] = 'Such- und Download- und Erfassungsmodule';
$this->resourceCategories[2]['name2show'] = 'Kartenzusammenstellungen';
$this->resourceCategories[3]['name2show'] = 'KML/Newsfeeds';
@@ -205,7 +205,7 @@
$this->keywordTitle = 'Schlagwortliste';
break;
case 'en':
- $this->resourceCategories[0]['name2show'] = 'Viewingservices';
+ $this->resourceCategories[0]['name2show'] = 'Maplayers';
$this->resourceCategories[1]['name2show'] = 'Search- and Downloadservices';
$this->resourceCategories[2]['name2show'] = 'Combined Maps';
$this->resourceCategories[3]['name2show'] = 'KML/Newsfeeds';
@@ -221,7 +221,7 @@
$this->keywordTitle = 'Keywordlist';
break;
default:
- $this->resourceCategories[0]['name2show'] = 'Darstellungsdienste';
+ $this->resourceCategories[0]['name2show'] = 'Kartenebenen';
$this->resourceCategories[1]['name2show'] = 'Such- und Download- und Erfassungsmodule';
$this->resourceCategories[2]['name2show'] = 'Kartenzusammenstellungen';
$this->resourceCategories[3]['name2show'] = 'KML/Newsfeeds';
Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/classes/class_user.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -48,10 +48,9 @@
var $lastName = "";
var $academicTitle = "";
var $activationKey = "";
-
-var $isActive = 'f';
-var $createDigest = 'f';
-var $preferredGui = '';
+ var $isActive = 'f';
+ var $createDigest = 'f';
+ var $preferredGui = '';
static $displayName = "User";
static $internalName = "user";
@@ -945,6 +944,13 @@
return $arrayGuis;
}
+ public function filterApplicationsForWmcApi ($guiArray) {
+ $sql = "SELECT gui_id, gui_public FROM gui INNER JOIN gui_element WHERE gui_id in (";
+ //TODO - if needed for application metadata editor!
+ $sql .= ");";
+
+ }
+
public function getOwnedWfs () {
$sql = "SELECT wfs_id FROM wfs WHERE wfs_owner = $1";
$res = db_prep_query($sql, array($this->id), array("i"));
@@ -1133,6 +1139,31 @@
}
return $wmcArray;
}
+
+ /**
+ * Returns all WMCs with some further information that this user owns
+ *
+ * @return obj an array of WMC information; ids, titles, abstracts from table mb_user_wmc
+ */
+ public function getWmcInfoByOwner ($ignorePublic = false) {
+ $sql = "SELECT wmc_serial_id, wmc_title, abstract FROM mb_user_wmc ";
+ $sql .= "WHERE fkey_user_id = $1 GROUP BY wmc_serial_id";
+ if ($ignorePublic == true) {
+ $sql .= " AND wmc_public = 1";
+ }
+ $v = array($this->id);
+ $t = array("i");
+ $res_wmc = db_prep_query($sql, $v, $t);
+ $wmcArray = array();
+ while($row = db_fetch_array($res_wmc)){
+ $wmcObj = new stdClass();
+ $wmcObj->wmc_serial_id = $row["wmc_serial_id"];
+ $wmcObj->wmc_title = $row["wmc_title"];
+ $wmcObj->abstract = $row["abstract"];
+ array_push($wmcArray, $wmcObj);
+ }
+ return $wmcArray;
+ }
public function isLayerAccessible ($layerId) {
$array_guis = $this->getApplicationsByPermission();
@@ -1221,8 +1252,12 @@
return ($row = db_fetch_array($res)) ? true : false;
}
- public function getOwnedMetadata () {
+ public function getOwnedMetadata ($type = false) {
+ if ($type == 'application') {
+$sql = "SELECT metadata_id FROM mb_metadata WHERE type = 'application' AND fkey_mb_user_id = $1";
+} else {
$sql = "SELECT metadata_id FROM mb_metadata WHERE fkey_mb_user_id = $1";
+}
$res = db_prep_query($sql, array($this->id), array("i"));
$metadataIdArray = array();
while ($row = db_fetch_array($res)) {
Modified: trunk/mapbender/http/geoportal/mod_showPreview.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_showPreview.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/geoportal/mod_showPreview.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -6,7 +6,7 @@
if (isset($_REQUEST["resource"]) & $_REQUEST["resource"] != "") {
//validate to csv integer list
$testMatch = $_REQUEST["resource"];
- if (!($testMatch == 'layer' or $testMatch == 'wmc' or $testMatch == 'layerlegend')){
+ if (!($testMatch == 'layer' or $testMatch == 'wmc' or $testMatch == 'layerlegend' or $testMatch == 'metadata')){
echo 'resource: <b>'.$testMatch.'</b> is not valid.<br/>';
die();
}
@@ -104,6 +104,35 @@
}
}
-} else die();
+}
+elseif ($resource == 'metadata') {
+ if (file_exists(PREVIEW_DIR."/".$id."_metadata_preview.jpg")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/jpeg');
+ readfile(PREVIEW_DIR."/".$id."_metadata_preview.jpg");
+ } else if (file_exists(PREVIEW_DIR."/".$id."_metadata_preview.png")){
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/jpeg');
+ readfile(PREVIEW_DIR."/".$id."_metadata_preview.png");
+
+ }else {
+ if (file_exists(PREVIEW_DIR."/"."keinevorschau.jpg")) {
+ header("Expires: -1");
+ header("Cache-Control: no-cache; must-revalidate");
+ header("Pragma: no-cache");
+ header('Content-Type: image/jpeg');
+ readfile(PREVIEW_DIR."/"."keinevorschau.jpg");
+ } else {
+ echo "No preview dummy found!";
+ }
+ }
+
+}
+ else die();
+
?>
Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -1047,7 +1047,8 @@
$MD_BrowseGraphic = $iso19139->createElement("gmd:MD_BrowseGraphic");
$fileName = $iso19139->createElement("gmd:fileName");
$fileNameCs = $iso19139->createElement("gco:CharacterString");
- $previewUrl = $iso19139->createTextNode($mb_metadata['preview_image']);
+ $previewPath = $admin->getMetadataPreviewUrl($mb_metadata['metadata_id']);
+ $previewUrl = $iso19139->createTextNode($previewPath);
$fileNameCs->appendChild($previewUrl);
$fileName->appendChild($fileNameCs);
$MD_BrowseGraphic->appendChild($fileName);
@@ -1605,7 +1606,10 @@
$gmd_distributionFormat=$iso19139->createElement("gmd:distributionFormat");
$MD_Format=$iso19139->createElement("gmd:MD_Format");
$gmd_name=$iso19139->createElement("gmd:name");
- $MD_FormatName_cs=$iso19139->createElement("gco:CharacterString");
+ $MD_FormatName_cs=$iso19139->createElement("gco:CharacterString");
+
+//TODO - set format to some other for application 2019-10-17 !!!!
+
$MD_FormatNameText=$iso19139->createTextNode($mb_metadata['format']);
$gmd_version=$iso19139->createElement("gmd:version");
@@ -1643,12 +1647,15 @@
//use downloadurl if given
$downloadUrls = json_decode($mb_metadata['datalinks']);
$downloadUrl = $downloadUrls->downloadLinks[0]->{0};
- //
- if ($downloadUrl == "" || !isset($downloadUrl)) {
+ if ($mb_metadata['type'] == 'application') {
+ $applicationUrl = $admin->getMapviewerInvokeUrl($mb_metadata['fkey_mapviewer_id'], $mb_metadata['fkey_gui_id'], $mb_metadata['fkey_wmc_serial_id']);
+ $gmd_URLText=$iso19139->createTextNode($applicationUrl);
+ } else {
+ if ($downloadUrl == "" || !isset($downloadUrl)) {
$gmd_URLText=$iso19139->createTextNode("https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol");
- }
- else {
+ } else {
$gmd_URLText=$iso19139->createTextNode($downloadUrl);
+ }
}
$gmd_URL->appendChild($gmd_URLText);
$gmd_linkage->appendChild($gmd_URL);
Added: trunk/mapbender/http/plugins/mb_metadataApplication.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadataApplication.php (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadataApplication.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -0,0 +1,337 @@
+<?php
+require_once dirname(__FILE__) . "/../../core/globalSettings.php";
+require_once(dirname(__FILE__) . "/../../conf/mimetype.conf");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_administration.php");
+
+$admin = new administration();
+$mapviewers = $admin->listMapviewerTypes();
+$e = new mb_exception("mapviewer json: ".$mapviewers);
+//$admin->getMapviewerInvokeUrl(3);
+//$e = new mb_exception("mapviewer json: ".$mapviewers);
+
+$mapbenderUrl = $admin->getMapviewerInvokeUrl(3);
+
+
+$e = new mb_exception($admin->getMapviewerInvokeUrl(3, 'GUI1'));
+$e = new mb_exception($admin->getMapviewerInvokeUrl(3, 'GUI1', 4));
+$e = new mb_exception($admin->getMapviewerInvokeUrl(4, 'GUI1', 3));
+
+
+
+function displayCategories ($sql) {
+ if (Mapbender::session()->get("mb_lang") === "de") {
+ $sql = str_replace("category_code_en", "category_code_de", $sql);
+ }
+ $str = "";
+ $res = db_query($sql);
+ while ($row = db_fetch_assoc($res)) {
+ $str .= "<option value='" . $row["id"] . "'>" .
+ htmlentities($row["name"], ENT_QUOTES, CHARSET) .
+ "</option>";
+ }
+ return $str;
+}
+?>
+
+<script type="text/javascript">
+$(function() {
+ $("#tabs").tabs({ active: 1 })
+});
+//var mapbenderUrl = "<?php echo $mapbenderUrl;?>";
+</script>
+<div class="demo" id="mainDiv" mapbender_url="<?php echo $mapbenderUrl;?>">
+ <!--fieldset for metadata form-->
+ <fieldset id="simple_metadata_editor" name="simple_metadata_editor" type="hidden">
+ <div id="tabs">
+ <ul>
+ <li><a href="#tabs-1"><?php echo _mb("Identification");?></a></li>
+ <li><a href="#tabs-2"><?php echo _mb("Reference / Address");?></a></li>
+ <li><a href="#tabs-3"><?php echo _mb("Classification");?></a></li>
+ <!-- Relevant for applications? -->
+ <li><a href="#tabs-4"><?php echo _mb("Temporal extent");?></a></li>
+ <!--<li><a href="#tabs-5"><?php echo _mb("Further information");?></a></li>-->
+ <li><a href="#tabs-5"><?php echo _mb("Spatial Extent");?></a></li>
+ <!-- for applications with user authorization some special metadata is needed -->
+ <li><a href="#tabs-6"><?php echo _mb("Terms of Use / Constraints");?></a></li>
+ <li><a href="#tabs-7"><?php echo _mb("Responsible Party");?></a></li>
+ <li><a href="#tabs-8"><?php echo _mb("Preview");?></a></li>
+ <li><a href="#tabs-9"><?php echo _mb("Others");?></a></li>
+ </ul>
+ <div id="tabs-1">
+ <fieldset>
+ <legend><?php echo _mb("Resource title");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("This a characteristic, and often unique, name by which the resource is known.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input class="required" name="title" id="title"/>
+ </fieldset>
+ <!-- Radio button for type of application -->
+ <fieldset id="fieldset_application_type">
+ <legend><?php echo _mb("Application type");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Choose the type of the application. If the application is external, a link to the application should be given. If it is an internal GUI, you can choose if the GUI istself or a GUI in combination with a own WMC should build that application. More can be configured in the Reference / Address tab.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input type="radio" id="app_type_external" name="application_type" value="app_type_external" checked="checked"><label for="app_type_external"><?php echo _mb("External application");?></label><br>
+ <input type="radio" id="app_type_gui" name="application_type" value="app_type_gui"><label for="app_type_gui"><?php echo _mb("Mapbender GUI");?></label><br>
+ <input type="radio" id="app_type_gui_wmc" name="application_type" value="app_type_gui_wmc"><label for="app_type_gui_wmc"><?php echo _mb("Mapbender GUI/WMC");?></label><br>
+ </fieldset>
+ <fieldset>
+ <legend><?php echo _mb("Resource abstract");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("This is a brief narrative summary of the content of the resource."); echo " "._mb("HTML encoding may be used!");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input class="required" name="abstract" id="abstract"/>
+ </fieldset>
+
+ <fieldset id="referencesystem">
+ <legend><?php echo _mb("Coordinate Reference System");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Description of the coordinate reference system which is used by default in the application.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <?php
+ if (defined('SRS_ARRAY')) {
+ $srs_array = explode(",", SRS_ARRAY);
+ echo '<select class="required ref_system_selectbox" name="ref_system" id="ref_system">';
+ foreach ($srs_array as $epsg) {
+ echo "<option value='" . "EPSG:" .$epsg . "'>" . _mb("EPSG:".$epsg) . "</option>";
+ }
+ echo "</select>";
+
+ } else {
+ echo '<input name="ref_system" id="ref_system"/>';
+ }
+ ?>
+ </fieldset>
+ </div>
+ <div id="tabs-2">
+ <?php $user = new User();?>
+ <?php $guis = $user->getApplicationsByPermission($ignorePublic = false, 2);?>
+ <fieldset id="gui_select_fieldset">
+ <legend><?php echo _mb("GUI ID");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("ID of mapbenders internal GUI which should be used to build the application metadata.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <select class="gui_selectbox" id='fkey_gui_id' name='fkey_gui_id'>
+ <!--List of own and accessable guis -->
+ <?php $str = "";
+ $str .= "<option value=''>"._mb('...')."</option>";
+ foreach ($guis as $gui) {
+ $str .= "<option value='" . $gui . "'>".$gui."</option>";
+ }
+ echo $str;
+ ?>
+ </select>
+ </fieldset>
+ <?php $wmcs = $user->getWmcInfoByOwner($ignorePublic = false);?>
+ <fieldset id="wmc_select_fieldset">
+ <legend><?php echo _mb("My public WebMapContext documents");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("ID of my WMC that should be loaded in the GUI above to define an special application.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <select class="wmc_selectbox" id='fkey_wmc_serial_id' name='fkey_wmc_serial_id'>
+ <!--List of own wmc -->
+ <?php $str = "";
+ $str .= "<option value=''>"._mb('...')."</option>";
+ foreach ($wmcs as $wmc) {
+ $str .= "<option value='" . $wmc->wmc_serial_id . "' title='".$wmc->abstract."'>".$wmc->wmc_title." (".$wmc->wmc_serial_id.")"."</option>";
+ }
+ echo $str;
+ ?>
+ </select>
+ </fieldset>
+ <!-- -->
+ <fieldset id="default_viewer_fieldset">
+ <legend><?php echo _mb("Default Viewer component");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Please choose a default viewer component, that will be used to generate the link to the internal application.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <select class="default_viewer_selectbox" id='fkey_mapviewer_id' name='fkey_mapviewer_id'>
+ <!--List of own wmc -->
+ <?php $str = "";
+ //$str .= "<option value=''>"._mb('...')."</option>";
+ $mapviewers = json_decode($mapviewers);
+ foreach ($mapviewers as $mapviewer) {
+ $str .= "<option value='" . $mapviewer->id . "' title='".$mapviewer->description."'>".$mapviewer->name." (".$mapviewer->id.")"."</option>";
+ }
+ echo $str;
+ ?>
+ </select>
+ </fieldset>
+ <fieldset id="address_link_fieldset">
+ <legend><?php echo _mb("Linkage");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Link to the application");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input name="link" id="link" type="text"/>
+ </fieldset>
+ <fieldset id="preview_link_fieldset">
+ <legend><?php echo _mb("Application preview");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Open application in new tab.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <a id="preview_link" target="_blank">currently not set</a>
+ </fieldset>
+ <fieldset>
+ <legend><?php echo _mb("Lineage");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("This is a statement on process history and/or overall quality of the spatial data set. Where appropriate it may include a statement whether the data set has been validated or quality assured, whether it is the official version (if multiple versions exist), and whether it has legal validity. The value domain of this metadata element is free text.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input class="required" name="lineage" id="lineage"/>
+ </fieldset>
+ </div>
+ <div id="tabs-3">
+ <fieldset id="md_classification">
+ <legend><?php echo _mb("Classification");?></legend>
+ <fieldset id="keywords_fieldset">
+ <legend><?php echo _mb("Keywords");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Define a list of comma separated keywords which helps to classify the dataset.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input class="" name="keywords" id="keywords"/>
+ </fieldset>
+ <fieldset id="topic_categories_fieldset">
+ <label for="md_md_topic_category_id" class="label_classification"><?php echo _mb("ISO Topic Category");?>:</label>
+ <img class="metadata_img" title="<?php echo _mb("Inspire");?>" src="../img/misc/inspire_eu_klein.png" alt="" />
+ <select class="metadata_selectbox" id="md_md_topic_category_id" name="md_md_topic_category_id" size="2" multiple="multiple">
+ <?php
+ $sql = "SELECT md_topic_category_id AS id, md_topic_category_code_en AS name FROM md_topic_category";
+ echo displayCategories($sql);
+ ?>
+ </select>
+ <img id="resetIsoTopicCatsMd" title="<?php echo _mb("Reset selection");?>" src="../img/cross.png" style="cursor:pointer;"/>
+ </fieldset>
+ <fieldset id="inspire_categories_fieldset">
+ <label for="md_inspire_category_id" class="label_classification"><?php echo _mb("INSPIRE Category");?>:</label>
+ <img class="metadata_img" title="<?php echo _mb("Inspire");?>" src="../img/misc/inspire_eu_klein.png" alt="" />
+ <select class="metadata_selectbox" id="md_inspire_category_id" name="md_inspire_category_id" size="2" multiple="multiple">
+<?php
+ $sql = "SELECT inspire_category_id AS id, inspire_category_code_en AS name FROM inspire_category";
+ echo displayCategories($sql);
+?>
+ </select>
+ <img id="resetInspireCatsMd" title="<?php echo _mb("Reset selection");?>" src="../img/cross.png" style="cursor:pointer;"/>
+ </fieldset>
+ <fieldset id="custom_categories_fieldset">
+ <label for="md_custom_category_id" class="label_classification"><?php echo _mb("Custom Category");?>:</label>
+ <span class="metadata_span"></span>
+ <select class="metadata_selectbox" id="md_custom_category_id" name="md_custom_category_id" size="2" multiple="multiple">
+ <?php
+ $sql = "SELECT custom_category_id AS id, custom_category_code_en AS name FROM custom_category";
+ echo displayCategories($sql);
+ ?>
+ </select>
+ <img id="resetCustomCatsMd" title="<?php echo _mb("Reset selection");?>" src="../img/cross.png" style="cursor:pointer;"/>
+ </fieldset>
+ </fieldset>
+ </div>
+ <div id="tabs-4">
+ <fieldset id="tempref" name="tempref">
+ <legend><?php echo _mb("TEMPORAL REFERENCE");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("This metadata element addresses the requirement to have information on the temporal dimension of the data as referred to in Article 8(2)(d) of Directive 2007/2/EC. At least one of the metadata elements referred to in points 5.1 to 5.4 shall be provided. The value domain of the metadata elements referred to in points 5.1 to 5.4 is a set of dates. Each date shall refer to a temporal reference system and shall be expressed in a form compatible with that system. The default reference system shall be the Gregorian calendar, with dates expressed in accordance with ISO 8601.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <fieldset id="timespan" name="timespan">
+ <legend><?php echo _mb("Temporal extent");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("The temporal extent defines the time period covered by the content of the resource. This time period may be expressed as any of the following: - an individual date, - an interval of dates expressed through the starting date and end date of the interval, - a mix of individual dates and intervals of dates.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <p><?php echo _mb("from");?>:</p><input class="required hasdatepicker" name="tmp_reference_1" id="tmp_reference_1"/><br>
+ <p><?php echo _mb("to");?>:</p><input class="required hasdatepicker" name="tmp_reference_2" id="tmp_reference_2"/>
+ </fieldset>
+ <fieldset id="cyclicupdate" name="cyclicupdate">
+ <legend><?php echo _mb("Maintenance and update frequency");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Frequency with which changes and additions are made to the resource after the initial resource is completed. Notice: This value may change the value of the end date of temporal extent. The end date will be computed automatically from the current timestamp if a cyclic update is defined!");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <select class="required cyclic_selectbox" id='update_frequency' name='update_frequency'>
+ <!-- B.5.18 MD_MaintenanceFrequencyCode <<CodeList>> of ISO19115 -->
+ <option value="continual"><?php echo _mb("continual");?></option>
+ <option value="daily"><?php echo _mb("daily");?></option>
+ <option value="weekly"><?php echo _mb("weekly");?></option>
+ <option value="fortnightly"><?php echo _mb("fortnightly");?></option>
+ <option value="monthly"><?php echo _mb("monthly");?></option>
+ <option value="quarterly"><?php echo _mb("quarterly");?></option>
+ <option value="biannually"><?php echo _mb("biannually");?></option>
+ <option value="annually"><?php echo _mb("annually");?></option>
+ <option value="asNeeded"><?php echo _mb("as needed");?></option>
+ <option value="irregular"><?php echo _mb("irregular");?></option>
+ <option value="notPlanned"><?php echo _mb("not planned");?></option>
+ <option value="unknown"><?php echo _mb("unknown");?></option>
+ </select>
+ </fieldset>
+ </fieldset>
+ </div>
+ <div id="tabs-5">
+ <fieldset>
+ <legend><?php echo _mb("Bounding Box");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("This is the bounding box of the dataset given in geographic coordinates in WGS84 (EPSG:4326). The bounding box may be inherited by the calling service contents bounding box (layer/featuretype) or defined by the registrating person later on.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <label for="west">
+ <?php echo _mb("West [decimal degrees]");?>
+ <input class="required" name="west" id="west"/>
+ </label><br />
+ <label for="south">
+ <?php echo _mb("South [decimal degrees]");?>
+ <input class="required" name="south" id="south"/>
+ </label><br />
+ <label for="east">
+ <?php echo _mb("East [decimal degrees]");?>
+ <input class="required" name="east" id="east"/>
+ </label><br />
+ <label for="north">
+ <?php echo _mb("North [decimal degrees]");?>
+ <input class="required" name="north" id="north"/>
+ </label>
+ </fieldset>
+ <fieldset>
+ <legend><?php echo _mb("User defined region");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("You can define your own bounding box or region if you upload an gml geometry object. Only bbox and polygons are accepted at the moment!");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <table id='geometryuploadtable' name='geometryuploadtable'><tr><td><img id="uploadgmlimage" name= "uploadgmlimage" onclick='initUploadGmlForm();' src='../img/button_blue_red/up.png' id='uploadImage' title='upload' /></td><td><?php echo _mb("Upload a surronding geometry for this dataset");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Help for geometry upload possibility");?>'}" src="../img/questionmark.png" alt="" /><img class="delete_polygon" id="delete_existing_polygon" onclick="" name="delete_existing_polygon" src='../img/cross.png' type="hidden" style="display: none" title="<?php echo _mb("Delete actual polygon");?>"/></td></tr></table>
+ </fieldset>
+ <fieldset>
+ <legend><?php echo _mb("Extent on map");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Here you can see the extent and a possibly given surrounding polygon on an overview map.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <img id="extent_preview" src="" title="<?php echo _mb("Preview for Extent - if available");?>" alt="<?php echo _mb("Preview for Extent - if available");?>"/>
+ </fieldset>
+ </div>
+ <div id="tabs-6">
+ <p>
+ <label for="fees_md"><?php echo _mb("Conditions applying to access and use");?>:</label>
+ <input name="fees_md" id="fees_md"/><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("INSPIRE 8.1: conditions applying to access and use");?>'}" src="../img/questionmark.png" alt="" />
+ </p>
+ <p>
+ <label for="accessconstraints_md"><?php echo _mb("Limitations on public access");?>:</label>
+ <input name="accessconstraints_md" id="accessconstraints_md"/><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("INSPIRE 8.2: limitations on public access");?>'}" src="../img/questionmark.png" alt="" />
+ </p>
+ <?php
+ $sql = "SELECT termsofuse_id, name FROM termsofuse";
+ $res = db_query($sql);
+ $termsofuse = array();
+ while ($row = db_fetch_assoc($res)) {
+ $termsofuse[$row["termsofuse_id"]] = $row["name"];
+ }
+ ?>
+ <p>
+ <label for="md_termsofuse"><?php echo _mb("MD predefined license");?>:</label>
+ <select class="termsofuse_selectbox" name="md_termsofuse" id="md_termsofuse" onChange="var chosenoption=this.options[this.selectedIndex];$('#mb_md_showMetadataAddon').mapbender().fillLicence(chosenoption.value);">
+ <option value='0'>...</option>
+ <?php
+ foreach ($termsofuse as $key => $value) {
+ echo "<option value='" . $key . "'>" . htmlentities($value, ENT_QUOTES, CHARSET) . "</option>";
+ }
+ ?>
+ </select>
+ <img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Selection of predefined licences.");?>'}" src="../img/questionmark.png" alt="" />
+ </p>
+ <p id="license_info_md">
+ <img id="licence_symbol_md"> <a id='licence_descriptionlink_md' target='_blank'><a/> <img id="open_symbol_md">
+ </p>
+ <p id="license_source_md">
+ <label for="md_license_source_note"><?php echo _mb("Source note if license require it");?>:</label>
+ <input name="md_license_source_note" id="md_license_source_note" type="text"/>
+ <img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Source note that should be mentioned if such an information is required by the license.");?>'}" src="../img/questionmark.png" alt="" />
+ </p>
+ <p>
+ </div>
+ <div id="tabs-7">
+ <label for="check_overwrite_responsible_party"><?php echo _mb("Overwrite responsible party information");?>:</label>
+ <input name="check_overwrite_responsible_party" id="check_overwrite_responsible_party" type="checkbox"/><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("INSPIRE 9.1: Information about the responsible party (name, email). This is normally pulled directly from the mapbender registry on the fly. If you want to give other information, you can do it here!");?>'}" src="../img/questionmark.png" alt="" />
+ <p>
+ <label id="label_responsible_party_name" for="responsible_party_name"><?php echo _mb("Responsible party name");?>:</label>
+ <input name="responsible_party_name" id="responsible_party_name" type="text"/>
+ </p>
+ <p>
+ <label id="label_responsible_party_email" for="responsible_party_email"><?php echo _mb("Responsible party email");?>:</label>
+ <input name="responsible_party_email" id="responsible_party_email" type="text"/>
+ </p>
+ </div>
+ <div id="tabs-8">
+ <!-- Radio button for type of application -->
+ <fieldset id="fieldset_preview_type">
+ <legend><?php echo _mb("Preview type");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Choose the type of preview. It maybe an url to an external image or you can upload an image to the mapbender registry.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input type="radio" id="preview_type_external" name="preview_type" value="preview_type_external" checked="checked"><label for="preview_type_external"><?php echo _mb("Link to external image");?></label><br>
+ <input type="radio" id="preview_type_upload" name="preview_type" value="preview_type_upload"><label for="preview_type_upload"><?php echo _mb("Upload local image");?></label><br>
+ </fieldset>
+ <fieldset id="preview_image_fieldset">
+ <!-- TODO alternative give the option to upload an image -->
+<fieldset id="preview_image_fieldset_url">
+ <input name="preview_image" id="preview_image" type="text"/><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Here you can give a url to an image that should be shown");?>'}" src="../img/questionmark.png" alt="" />
+</fieldset>
+<fieldset id="preview_image_fieldset_upload">
+ <table id='preview_upload_table' name='preview_upload_table'><tr><td><img id="uploadPreviewImg" name="uploadPreviewImg" onclick='initUploadPreviewForm();' src='../img/button_blue_red/up.png' title='upload' /></td><td><?php echo _mb("Upload a preview image for the dataset/application");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Help for uploading a preview image");?>'}" src="../img/questionmark.png" alt="" /><img class="delete_preview" id="delete_existing_preview" onclick="" name="delete_existing_preview" src='../img/cross.png' type="hidden" style="display: none" title="<?php echo _mb("Delete actual preview");?>"/></td></tr></table>
+</fieldset>
+ </fieldset>
+ <fieldset id="preview_fieldset">
+ <legend><?php echo _mb("Preview image");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Image for the preview.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <img id="image_preview" src="" title="<?php echo _mb("Image for the preview.");?>" alt="<?php echo _mb("Image for the preview.");?>"/>
+ </fieldset>
+ </div>
+ <div id="tabs-9">
+ <fieldset>
+ <legend><?php echo _mb("Searchability");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Here you can define, if the metadata should be searchable in the geoportal catalogue.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input name="searchable" id="searchable" type="checkbox"/>
+ </fieldset>
+ <fieldset>
+ <legend><?php echo _mb("Metadata export");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Harvest link target and export to CSW");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input name="export2csw" id="export2csw" type="checkbox"/>
+ </fieldset>
+ </div>
+ </div><!--tabs-->
+ </fieldset>
+</div><!--demo-->
+
Modified: trunk/mapbender/http/plugins/mb_metadata_manager_select.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_manager_select.js 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/plugins/mb_metadata_manager_select.js 2019-10-17 06:34:49 UTC (rev 10285)
@@ -19,6 +19,12 @@
* http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
*/
+if (typeof options.hierarchyLevel === "undefined") {
+ options.hierarchyLevel = 'dataset';
+}
+
+var hierarchyLevel = options.hierarchyLevel;
+
var $metadataManagerSelect = $(this);
var MetadataManagerSelectApi = function (o) {
@@ -145,6 +151,8 @@
this.initTable = function() {
//initialize table object with jquery from ajax call to serverside script with translated headers!
+
+
mainDivContainer = $("#mb_metadata_manager_select");
//get attribute from object?
mainDivContainer.empty();
@@ -153,7 +161,11 @@
tableHeaderRowContainer = $(document.createElement('tr'));
tableContainer.attr({'id':'metadataTable'});
//add button to add new entry to metadata table
- $("<img class='metadataEntry clickable' title='new' src='../img/add.png' onclick='initMetadataAddon(null, null, \"metadata\", true);return false;'/>").appendTo($("#mb_metadata_manager_select"));
+ if (hierarchyLevel == 'application') {
+ $("<img class='metadataEntry clickable' title='new' src='../img/add.png' onclick='initMetadata(null, null, \"application\", true);return false;'/>").appendTo($("#mb_metadata_manager_select"));
+ } else {
+ $("<img class='metadataEntry clickable' title='new' src='../img/add.png' onclick='initMetadataAddon(null, null, \"metadata\", true);return false;'/>").appendTo($("#mb_metadata_manager_select"));
+ }
mainDivContainer.append(tableContainer);
//alert("created");
//call translations
@@ -162,7 +174,8 @@
method: "getHeader",
async: false,
parameters: {
- "lang": "de"
+ "lang": "de",
+ "hierarchyLevel": hierarchyLevel
},
callback: function (obj, result, message) {
if (result) {
@@ -204,9 +217,11 @@
} else {
params[aoData[i].name] = aoData[i].value;
}
- }
+ }
+ params["hierarchyLevel"] = hierarchyLevel;
aoData.push( { "name": "method", "value": "loadTableIncremental"} );
aoData.push( { "name": "id", "value": ReqId} );
+ aoData.push( { "name": "hierarchyLevel", "value": hierarchyLevel} );
//not nice but usefull for mapbenders ajax handler
aoData.push( { "name": "params", "value": JSON.stringify(params)} );
},
Modified: trunk/mapbender/http/plugins/mb_metadata_manager_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_manager_server.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/plugins/mb_metadata_manager_server.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -2,9 +2,14 @@
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_user.php";
require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
-
+global $hierarchyLevel;
$ajaxResponse = new AjaxResponse($_POST);
-
+//get hierarchyLevel filter from ajax call
+$hierarchyLevel = $ajaxResponse->getParameter("hierarchyLevel");
+//$e = new mb_exception("plugins/metadata_manager_server.php: ".$hierarchyLevel);
+if ($hierarchyLevel != 'application') {
+ $hierarchyLevel = 'metadata';
+}
function abort ($message) {
global $ajaxResponse;
$ajaxResponse->setSuccess(false);
@@ -45,6 +50,7 @@
//parse row (array) from database to new array - change some of the values and add some further
function parseMetadataRow($row, $withOutFirstColumn = false) {
+ global $hierarchyLevel;
//convert NULL to '', NULL values cause datatables to crash
$walk = array_walk($row, create_function('&$s', '$s=strval($s);'));
//preview with uuid
@@ -93,7 +99,11 @@
//add column for deleting metadata
$row[] = "<img style='cursor:pointer;' class='deleteImg' title='"._mb("Delete")."' src='../img/cross.png' />";
if ($row[7] == 'metador' || $row[7] == 'upload' || $row[7] == 'external') {
- $row[] = "<img class='clickable' title='edit' src='../img/pencil.png' onclick='initMetadataAddon(".$row[0].",null,\"metadata\",false);return false;'/>";
+ if ($hierarchyLevel == 'application') {
+ $row[] = "<img class='clickable' title='edit' src='../img/pencil.png' onclick='initMetadata(".$row[0].",null,\"".$hierarchyLevel."\",false);return false;'/>";
+ } else {
+ $row[] = "<img class='clickable' title='edit' src='../img/pencil.png' onclick='initMetadataAddon(".$row[0].",null,\"".$hierarchyLevel."\",false);return false;'/>";
+ }
} else {
$row[] = "";
}
@@ -101,12 +111,21 @@
$newRow = array($row[1],$row[2],$row[3],$row[4],$row[5],$row[6],$row[7],$row[8],$row[9],$row[10],$row[11]);
$row = $newRow;
}
+ /*if ($hierachyLevel == 'application') {
+ $newRow = array($row[0],$row[1],$row[2],$row[5],$row[6],$row[7],$row[8],$row[9],$row[10]);
+ $row = $newRow;
+ }*/
return $row;
}
function getMetadata ($metadataId = null) {
+ global $hierarchyLevel;
$user = new User(Mapbender::session()->get("mb_user_id"));
- $metadataIdArray = $user->getOwnedMetadata();
+ if ($hierarchyLevel == 'application') {
+ $metadataIdArray = $user->getOwnedMetadata($hierarchyLevel);
+ } else {
+ $metadataIdArray = $user->getOwnedMetadata();
+ }
if (!is_null($metadataId) && !in_array($metadataId, $metadataIdArray)) {
abort(_mb("You are not allowed to access this metadata."));
}
@@ -118,6 +137,7 @@
$user = new User(Mapbender::session()->get("mb_user_id"));
//$e = new mb_exception("method param: ".$ajaxResponse->getMethod());
+
switch ($ajaxResponse->getMethod()) {
case "toggleSearchability" :
$id = $ajaxResponse->getParameter("id");
@@ -272,19 +292,38 @@
$ajaxResponse->setSuccess(true);
break;
case "getHeader" :
- $header = array(
- _mb("ID"),
- _mb("UUID"),
- _mb("Title"),
- _mb("Last changed"),
- _mb("Layers"),
- _mb("Featuretypes"),
- _mb("Origin"),
- _mb("Searchability"),
- _mb("Catalogue export"),
- _mb("Delete"),
- _mb("Edit")
- );
+ //$hierarchyLevel = $ajaxResponse->getParameter("hierarchyLevel");
+ switch ($hierarchyLevel) {
+ case "application_test":
+ $header = array(
+ _mb("ID"),
+ _mb("UUID"),
+ _mb("Title"),
+ _mb("Last changed"),
+ _mb("Origin"),
+ _mb("Searchability"),
+ _mb("Catalogue export"),
+ _mb("Delete"),
+ _mb("Edit")
+ );
+ break;
+ default:
+ $header = array(
+ _mb("ID"),
+ _mb("UUID"),
+ _mb("Title"),
+ _mb("Last changed"),
+ _mb("Layers"),
+ _mb("Featuretypes"),
+ _mb("Origin"),
+ _mb("Searchability"),
+ _mb("Catalogue export"),
+ _mb("Delete"),
+ _mb("Edit")
+ );
+ break;
+
+ }
$translation = array(
"confirmSearchabilityMessage" => _mb('Do you really want to change the searchability?'),
"confirmExportMessage" => _mb('Do you really want to change the export handling for this metadata?'),
@@ -300,9 +339,10 @@
//defaults to server side handling
//use datatables serverside api: http://legacy.datatables.net/usage/server-side (version <= 1.9!!!)
//parse relevant ajax variables (they also available in params var - cause mapbenders ajax class demand this):
- $ajaxVariables = array("sEcho","iDisplayLength","iDisplayStart","iColumns","sSearch","sSearch_1","bSortable_1","iSortingCols","iSortCol_1","sSortDir_1","sEcho");
+ $ajaxVariables = array("sEcho","iDisplayLength","iDisplayStart","iColumns","sSearch","sSearch_1","bSortable_1","iSortingCols","iSortCol_1","sSortDir_1","sEcho","hierarchyLevel");
foreach($ajaxVariables as $variable) {
//validate type
+ //$e = new mb_exception("var:".$variable." - value: ".$ajaxResponse->getParameter($variable));
if (validateType($variable, $ajaxResponse->getParameter($variable)) == true) {
${$variable} = $ajaxResponse->getParameter($variable);
}
@@ -320,17 +360,36 @@
$vCount = array();
$tCount = array();
$numberOfVariables = 0;
+
+//$e = new mb_exception("loadTableIncremental: " . $hierarchyLevel);
+
+if ($hierarchyLevel == 'application') {
$sqlCount = <<<SQL
- SELECT count(metadata_id) FROM mb_metadata WHERE (mb_metadata.metadata_id IN ($metadataList)
+ SELECT count(metadata_id) FROM mb_metadata WHERE (mb_metadata.type = 'application' AND mb_metadata.metadata_id IN ($metadataList)
SQL;
+} else {
+$sqlCount = <<<SQL
+ SELECT count(metadata_id) FROM mb_metadata WHERE (mb_metadata.type = 'dataset' AND mb_metadata.metadata_id IN ($metadataList)
+
+SQL;
+}
+
+if ($hierarchyLevel == 'application') {
$sqlAll = <<<SQL
- SELECT metadata_id as metadata_id, metadata_id as id, uuid, title, lastchanged, f_get_coupled_resources(metadata_id), origin, searchable, export2csw FROM mb_metadata WHERE (mb_metadata.metadata_id IN ($metadataList)
+ SELECT metadata_id as metadata_id, metadata_id as id, uuid, title, lastchanged, f_get_coupled_resources(metadata_id), origin, searchable, export2csw FROM mb_metadata WHERE (mb_metadata.type = 'application' AND mb_metadata.metadata_id IN ($metadataList)
SQL;
+} else {
+$sqlAll = <<<SQL
+
+ SELECT metadata_id as metadata_id, metadata_id as id, uuid, title, lastchanged, f_get_coupled_resources(metadata_id), origin, searchable, export2csw FROM mb_metadata WHERE (mb_metadata.type = 'dataset' AND mb_metadata.metadata_id IN ($metadataList)
+
+SQL;
+}
if (isset($sSearch)) {
$sSearch = "%".$sSearch."%";
$numberOfVariables++;
Added: trunk/mapbender/http/plugins/mb_metadata_preview_import.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_preview_import.js (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadata_preview_import.js 2019-10-17 06:34:49 UTC (rev 10285)
@@ -0,0 +1,88 @@
+var $previewImport = $(this);
+var importPreviewMetadataId;
+
+var PreviewImportApi = function () {
+ var that = this;
+ var type;
+
+ this.events = {
+ "uploadComplete" : new Mapbender.Event()
+ };
+
+ this.events.uploadComplete.register(function () {
+ $previewImport.dialog("close");
+ });
+
+ var importUploadedFile = function(filename, metadataId, callback){
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "importPreview",
+ parameters: {
+ filename: filename,
+ "metadataId": metadataId
+ },
+ callback: function (obj, result, message, errorCode) {
+ if (!result) {
+ switch (errorCode) {
+ case -1002:
+ alert("file: "+filename+"has problems: "+message);
+ break;
+ default:
+ alert(message);
+ return;
+ }
+ }
+ alert(message);
+ $previewImport.dialog("close");
+ //show delete button
+ $("#delete_existing_preview").css("display","block");
+ getPreviewUrl(metadataId); //will also activate preview image in editor
+ if ($.isFunction(callback)) {
+ callback(obj.id);
+ }
+ }
+ });
+ req.send();
+ };
+
+ $previewImport.upload({
+ size: 10,
+ timeout: 20000,
+ url: "../plugins/jq_upload.php",
+ callback: function(result,stat,msg){
+ if(!result){
+ alert(msg);
+ return;
+ }
+ var uploadResultName = result.filename;
+ var uploadResultOrigName = result.origFilename;
+
+ importUploadedFile(result.filename, that.importPreviewMetadataId, function (id) {
+ that.events.uploadComplete.trigger({
+ "type": type,
+ "id": id
+ });
+ });
+ }
+ }).dialog({
+ title: 'Preview import',
+ autoOpen: false,
+ modal: false,
+ width: 580
+ });
+
+
+ this.init = function (obj) {
+ type = obj.type;
+ $previewImport.dialog("open");
+ };
+
+ initPreviewImport = function (metadataId) {
+ that.importPreviewMetadataId = metadataId;
+ $previewImport.dialog("open");
+ return true;
+ };
+
+};
+
+$previewImport.mapbender(new PreviewImportApi());
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2019-10-17 06:34:49 UTC (rev 10285)
@@ -4,6 +4,7 @@
require_once dirname(__FILE__) . "/../classes/class_wms.php";//already includes iso19139!
require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
require_once dirname(__FILE__) . "/../classes/class_wfs.php";
+require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
require_once dirname(__FILE__) . "/../../tools/wms_extent/extent_service.conf";
@@ -215,6 +216,21 @@
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(true);
break;
+ case "getMapviewerUrl" :
+ $mapviewer_id = $ajaxResponse->getParameter("mapviewerId");
+ $gui_id = $ajaxResponse->getParameter("guiId");
+ $wmc_id = $ajaxResponse->getParameter("wmcId");
+ //default gui_id and wmc_id to false! - string or boolean?
+ $admin = new administration();
+ $resultObj['mapviewer_url'] = $admin->getMapviewerInvokeUrl($mapviewer_id, $gui_id, $wmc_id);
+ if ($resultObj['mapviewer_url'] == false) {
+ $ajaxResponse->setMessage(_mb("An unknown error occured when trying to generate mapviewer url!"));
+ $ajaxResponse->setSuccess(false);
+ } else {
+ $ajaxResponse->setResult($resultObj);
+ $ajaxResponse->setSuccess(true);
+ }
+ break;
case "getWmsMetadata" :
$wmsId = $ajaxResponse->getParameter("id");
getWms($wmsId);
@@ -1127,6 +1143,140 @@
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(true);
break;
+ case "getMetadata" :
+ //TODO - only for application at this time!
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ $mbMetadata = new Iso19139();
+ $result = $mbMetadata->createFromDBInternalId($metadataId);
+ if ($result) {
+ //map metadata object to json return object
+ $resultObj["metadata_id"]= $metadataId; //is not part of the object TODO!
+ $resultObj["uuid"] = $mbMetadata->fileIdentifier; //char
+ $resultObj["origin"] = $mbMetadata->origin; //char
+ $resultObj["link"] = $mbMetadata->href; //char
+ //$resultObj["linktype"] = $mbMetadata->type; //char
+ $resultObj["title"] = $mbMetadata->title; //char -- prefill from layer/ft
+ $resultObj["abstract"] = $mbMetadata->abstract; //char - prefill from layer/ft
+ //$resultObj["format"] = $mbMetadata->dataFormat; //char
+ $resultObj["ref_system"] = $mbMetadata->refSystem; //char
+ /*$resultObj["spatial_res_type"] = $mbMetadata->spatialResType; //integer
+ $resultObj["spatial_res_value"] = $mbMetadata->spatialResValue; //char
+ $resultObj["inspire_charset"] = $mbMetadata->inspireCharset; //char*/
+ $resultObj["lineage"] = $mbMetadata->lineage; //text
+ $resultObj["tmp_reference_1"] = $mbMetadata->tmpExtentBegin; //text
+ $resultObj["tmp_reference_2"] = $mbMetadata->tmpExtentEnd; //text
+ $resultObj["west"] = $mbMetadata->wgs84Bbox[0];
+ $resultObj["south"] = $mbMetadata->wgs84Bbox[1];
+ $resultObj["east"] = $mbMetadata->wgs84Bbox[2];
+ $resultObj["north"] = $mbMetadata->wgs84Bbox[3];
+ /*$resultObj["downloadlink"] = $mbMetadata->downloadLinks[0]; //only the first link!
+ $resultObj["inspire_whole_area"] = $mbMetadata->inspireWholeArea;
+ $resultObj["inspire_actual_coverage"] = $mbMetadata->inspireActualCoverage;*/
+ $resultObj["preview_image"] = $mbMetadata->previewImage;
+ $resultObj["overview_url"] = $mbMetadata->getExtentGraphic($mbMetadata->wgs84Bbox);
+ $export2csw = $mbMetadata->export2Csw; //boolean
+ $resultObj["update_frequency"] = $mbMetadata->updateFrequency; //text
+ //check for existing polygon
+ //$e = new mb_exception("mb_metadata_server.php: count of polygon points ".count($mbMetadata->polygonalExtentExterior));
+ if (count($mbMetadata->polygonalExtentExterior) >= 1) {
+ $e = new mb_notice("mb_metadata_server.php: count of polygon points ".count($mbMetadata->polygonalExtentExterior));
+ $resultObj["has_polygon"] = true;
+ } else {
+ $resultObj["has_polygon"] = false;
+ }
+ switch ($export2csw) {
+ case "t" :
+ $resultObj["export2csw"] = true;
+ $resultObj["export2csw2"] = true;
+ break;
+ case "f" :
+ $resultObj["export2csw"] = false;
+ $resultObj["export2csw2"] = false;
+ break;
+ default:
+ break;
+ }
+ /*$inspire_top_consistence = $mbMetadata->inspireTopConsistence; //boolean
+ switch ($inspire_top_consistence) {
+ case "t" :
+ $resultObj["inspire_top_consistence"] = true;
+ break;
+ case "f" :
+ $resultObj["inspire_top_consistence"] = false;
+ break;
+ default:
+ break;
+ }
+ $inspire_interoperability = $mbMetadata->inspireInteroperability; //boolean
+ switch ($inspire_interoperability) {
+ case "t" :
+ $resultObj["inspire_interoperability"] = true;
+ break;
+ case "f" :
+ $resultObj["inspire_interoperability"] = false;
+ break;
+ default:
+ break;
+ }*/
+ $searchable = $mbMetadata->searchable; //boolean
+ switch ($searchable) {
+ case "t" :
+ $resultObj["searchable"] = true;
+ break;
+ case "f" :
+ $resultObj["searchable"] = false;
+ break;
+ default:
+ break;
+ }
+ /*switch ($mbMetadata->inspireDownload) {
+ case 0 :
+ $resultObj["inspire_download"] = false;
+ break;
+ case 1 :
+ $resultObj["inspire_download"] = true;
+ break;
+ default:
+ break;
+ }*/
+ //things about licences
+ $resultObj["fees_md"] = $mbMetadata->fees;
+ $resultObj["accessconstraints_md"] = $mbMetadata->accessConstraints;
+ $resultObj["md_termsofuse"] = $mbMetadata->termsOfUseRef;
+ if ($resultObj["md_termsofuse"] == null || !isset($resultObj["md_termsofuse"])) {
+ $resultObj["md_termsofuse"] == '0';
+ }
+ $resultObj["md_license_source_note"] = $mbMetadata->licenseSourceNote;
+ //categories and keywords
+ $resultObj["md_md_topic_category_id"] = $mbMetadata->isoCategories;
+ $resultObj["md_custom_category_id"] = $mbMetadata->customCategories;
+ $resultObj["md_inspire_category_id"] = $mbMetadata->inspireCategories;
+ //only pull keywords without a thesaurus name!!
+ for ($i = 0; $i < count($mbMetadata->keywords); $i++) {
+ if ($mbMetadata->keywordsThesaurusName[$i] == "" or $mbMetadata->keywordsThesaurusName[$i] == "none") {
+ $resultObj["keywords"][] = $mbMetadata->keywords[$i];
+ }
+ }
+ $resultObj["keywords"] = implode(",",$resultObj["keywords"]);
+ //responsible party information
+ $resultObj["responsible_party_name"] = $mbMetadata->resourceResponsibleParty;
+ $resultObj["responsible_party_email"] = $mbMetadata->resourceContactEmail;
+ if ($resultObj["responsible_party_name"] != null || $resultObj["responsible_party_email"] != null ) {
+ $resultObj["check_overwrite_responsible_party"] = true;
+ }
+ $resultObj["fkey_gui_id"] = $mbMetadata->fkeyGuiId;
+ $resultObj["fkey_wmc_serial_id"] = $mbMetadata->fkeyWmcSerialId;
+ $resultObj["fkey_mapviewer_id"] = $mbMetadata->fkeyMapviewerId;
+ //give back result:
+ $ajaxResponse->setResult($resultObj);
+ $ajaxResponse->setSuccess(true);
+ break;
+ } else {
+ //could not read metadata from db
+ $ajaxResponse->setMessage(_mb("Could not get metadata object from database!"));
+ $ajaxResponse->setSuccess(false);
+ break;
+ }
case "getMetadataAddon" :
$metadataId = $ajaxResponse->getParameter("metadataId");
$mbMetadata = new Iso19139();
@@ -1506,6 +1656,23 @@
$ajaxResponse->setResult($resultObj);
$ajaxResponse->setSuccess(true);
break;
+ case "getOwnedApplicationMetadata" :
+ $user = new User(Mapbender::session()->get("mb_user_id"));
+ $sql = "SELECT metadata_id, title FROM mb_metadata WHERE fkey_mb_user_id = $1 & type = 'application' ORDER BY metadata_id DESC";
+ $v = array($user->id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $row = array();
+ $resultObj = array();
+ $i = 0;
+ while ($row = db_fetch_assoc($res)) {
+ $resultObj[$i]->metadataId = $row['metadata_id']; //integer
+ $resultObj[$i]->metadataTitle = $row["title"]; //char
+ $i++;
+ }
+ $ajaxResponse->setResult($resultObj);
+ $ajaxResponse->setSuccess(true);
+ break;
case "insertMetadataAddon" :
$resourceId = $ajaxResponse->getParameter("resourceId");
$resourceType = $ajaxResponse->getParameter("resourceType");
@@ -1794,6 +1961,179 @@
//push multipolygon into database
break;
+ case "importPreview":
+ $filename = $ajaxResponse->getParameter("filename");
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ $preview = file_get_contents($filename); // store file with random file name in tmp folder
+ if (!$preview){
+ abort(_mb("Reading file ".$filename." from mapbenders tmp folder failed!"));
+ }
+ //store image to preview folder
+ if (defined('PREVIEW_DIR') && PREVIEW_DIR != '') {
+ $new_name = $metadataId."_metadata_preview.jpg";
+ // get the file informations
+ $info = pathinfo($filename);
+ // get the extension of the file
+ $ext = $info['extension'];
+ $new_image = dirname(__FILE__)."/".PREVIEW_DIR."/".$new_name;
+ // get the ímage
+ $image = $filename;
+ //resize the image to 200px * 200px
+ // get image size
+ $size = Getimagesize($filename);
+ $images_orig;
+ //create an gd-image-object from the source file
+ switch (strtolower($ext)) {
+ case 'jpg':
+ $images_orig = ImageCreateFromJPEG($image);
+ break;
+ case 'jpeg':
+ $images_orig = ImageCreateFromJPEG($image);
+ break;
+ case 'png':
+ $images_orig = ImageCreateFrompng($image);
+ break;
+ case 'gif':
+ $images_orig = ImageCreateFromgif($image);
+ break;
+ default:
+ return;
+ break;
+ }
+ //create image and resample it
+ if ($size[0] >= 200 || $size[1] >= 200) {
+ // width of the origin image
+ $photoW = ImagesX($images_orig);
+ // height of the origin image
+ $photoH = ImagesY($images_orig);
+ // create new image with the calculated size
+ $images_target = ImageCreateTrueColor(200, 200);
+ //fill the new image with transparency background
+ $color = imagecolorallocatealpha($images_target, 255, 255, 255, 0); //fill white background
+ imagefill($images_target, 0, 0, $color);
+ imagealphablending( $images_target, false );
+ imagesavealpha($images_target, true);
+ //set the new image width and height
+ if ($size[0] > $size[1] || $size[0] == $size[1]) {
+ $width = 200;
+ $height = round($width*$size[1]/$size[0]);
+ // calculate the height of the src_image in the target_image
+ $startHeight = round((200-$height)/2);
+ // resize the image:
+ ImageCopyResampled($images_target, $images_orig, 0, $startHeight, 0, 0, $width, $height, $photoW, $photoH);
+ } else {
+ $height = 200;
+ $width = round($height*$size[0]/$size[1]);
+ $startWidth = round((200-$width)/2);
+ ImageCopyResampled($images_target, $images_orig, $startWidth, 0, 0, 0, $width, $height, $photoW, $photoH);
+ }
+ // move File to the new target directory --> always save as png
+ imagejpeg($images_target,$new_image);
+ // free space
+ ImageDestroy($images_orig);
+ ImageDestroy($images_target);
+ // if image-width and height are to small
+ } else if($size[0] < 200 && $size[1] < 200) {
+ //set the new image width
+ $width = $size[0];
+ // scale the height
+ $height = $size[1];
+ // width of the origin image
+ $photoW = ImagesX($images_orig);
+ // height of the origin image
+ $photoH = ImagesY($images_orig);
+ // create new image with the calculated size
+ $images_target = ImageCreateTrueColor(200, 200);
+ //fill the new image with transparency background
+ $color = imagecolorallocatealpha($images_target, 255, 255, 255, 0); //fill white background
+ imagefill($images_target, 0, 0, $color);
+ imagealphablending( $images_target, false );
+ imagesavealpha($images_target, true);
+ // calculate the height of the src_image in the target_image
+ $startHeight = round((200-$height)/2);
+ $startWidth = round((200-$width)/2);
+ // resize the image
+ ImageCopyResampled($images_target, $images_orig, $startWidth, $startHeight, 0, 0, $width, $height, $photoW, $photoH);
+ // move File to the new target directory --> always save as png
+ imagejpeg($images_target,$new_image);
+ // free space
+ ImageDestroy($images_orig);
+ ImageDestroy($images_target);
+ }
+ }
+ if (!file_get_contents($new_image)) {
+ $ajaxResponse->setMessage("The preview image could not be stored - some error occured!");
+ $ajaxResponse->setSuccess(false);
+ } else {
+ $sql = "UPDATE mb_metadata SET preview_image = '{localstorage}' WHERE metadata_id = $1";
+ $v = array($metadataId);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ if (!$res) {
+ $ajaxResponse->setMessage("The preview image has been stored under ".$new_image.", but the database record could not be updated!");
+ $ajaxResponse->setSuccess(false);
+ } else {
+ $ajaxResponse->setMessage("The preview image has been stored under ".$new_image." and the preview_image column of the database record has been set to '{localstorage}'");
+ $ajaxResponse->setSuccess(true);
+ }
+ }
+ //save {localstorage} to database field if image stored successfull
+
+ /*if ($wktPolygon) {
+ //insert polygon into database
+ $sql = <<<SQL
+UPDATE mb_metadata SET bounding_geom = $2 WHERE metadata_id = $1
+SQL;
+ $v = array($metadataId, $wktPolygon);
+ //$e = new mb_exception($metadataId);
+ $t = array('i','POLYGON');
+ $res = db_prep_query($sql,$v,$t);
+ if (!$res) {
+ abort(_mb("Problem while storing geometry into database!"));
+ } else {
+ //build new preview url if possible and give it back in ajax response
+
+ $ajaxResponse->setMessage("Stored successfully geometry into database!");
+ $ajaxResponse->setSuccess(true);
+ }
+ } else {
+ abort(_mb("Converting GML to WKT failed!"));
+ }*/
+ //parse gml and extract multipolygon to wkt representation
+ //push multipolygon into database
+ break;
+ case "deletePreview":
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ if (defined('PREVIEW_DIR') && PREVIEW_DIR != '') {
+ $previewName = $metadataId."_metadata_preview.jpg";
+ $previewPath = dirname(__FILE__)."/".PREVIEW_DIR."/".$previewName;
+ if (file_exists($previewPath)) {
+ unlink($previewPath);
+ //delete {localstorage} from mb_metadata.preview_image
+ $sql = "UPDATE mb_metadata SET preview_image = '' WHERE metadata_id = $1";
+ $v = array($metadataId);
+ $t = array('i');
+ db_prep_query($sql,$v,$t);
+ $ajaxResponse->setMessage("Preview for metadata with id ".$metadataId." successfully deleted!");
+ $ajaxResponse->setSuccess(true);
+ } else {
+ $ajaxResponse->setMessage("Preview file does not exists in folder!");
+ $ajaxResponse->setSuccess(false);
+ }
+ } else {
+ $ajaxResponse->setMessage("No PREVIEW_DIR defined - cannot delete preview!");
+ $ajaxResponse->setSuccess(false);
+ }
+ break;
+ case "getPreviewUrl":
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ $admin = new administration();
+ $url = $admin->getMetadataPreviewUrl($metadataId);
+ $resultObj['preview_url'] = $url;
+ $ajaxResponse->setMessage("Preview url found: ".$url);
+ $ajaxResponse->setSuccess(true);
+ $ajaxResponse->setResult($resultObj);
+ break;
case "deleteGmlPolygon" :
$metadataId = $ajaxResponse->getParameter("metadataId");
$e = new mb_notice("metadataId: ".$metadataId);
@@ -1801,7 +2141,6 @@
UPDATE mb_metadata SET bounding_geom = NULL WHERE metadata_id = $1
SQL;
$v = array($metadataId);
- //$e = new mb_exception($metadataId);
$t = array('i');
$res = db_prep_query($sql,$v,$t);
if (!$res) {
@@ -1811,6 +2150,296 @@
$ajaxResponse->setSuccess(true);
}
break;
+ case "insertMetadata" :
+ //$resourceId = $ajaxResponse->getParameter("resourceId");
+//TODO - this function is defined for application metadata first - have to be extended to be used for other types dataset/series ...2019-10-07
+ $resourceType = $ajaxResponse->getParameter("resourceType");
+ $data = $ajaxResponse->getParameter("data");
+ if ($data->export2csw2 == "on") {
+ $data->export2csw = 't';
+ } else {
+ $data->export2csw = 'f';
+ }
+ $origin = 'metador';
+ //searchable
+ if ($data->searchable == "on") {
+ $data->searchable = 't';
+ } else {
+ $data->searchable = 'f';
+ }
+ //generate a uuid for the record:
+ $uuid = new Uuid();
+ //initialize database objects
+ //are initialized from class_iso19139
+ $mbMetadata = new Iso19139();
+ $randomid = new Uuid();
+$mbMetadata->hierarchyLevel = $resourceType;
+ //read out json objects
+ if (isset($data->link)) {
+ $mbMetadata->href = $data->link;
+ }
+ if (isset($data->export2csw)) {
+ $mbMetadata->export2Csw = $data->export2csw;
+ } else {
+ $mbMetadata->export2Csw = 'f';
+ }
+
+ if (isset($data->title)) {
+ $mbMetadata->title = $data->title;
+ }
+ if (isset($data->abstract)) {
+ $mbMetadata->abstract = $data->abstract;
+ }
+ if (isset($data->ref_system)) {
+ $mbMetadata->refSystem = $data->ref_system;
+ }
+ if (isset($data->searchable)) {
+ $mbMetadata->searchable = $data->searchable;
+ } else {
+ $mbMetadata->searchable = "f";
+ }
+ if (isset($data->tmp_reference_1)) {
+ $mbMetadata->tmpExtentBegin = $data->tmp_reference_1;
+ }
+ if (isset($data->tmp_reference_2)) {
+ $mbMetadata->tmpExtentEnd = $data->tmp_reference_2;
+ }
+ if (isset($data->lineage)) {
+ $mbMetadata->lineage = $data->lineage;
+ }
+ if (isset($data->update_frequency)) {
+ $mbMetadata->updateFrequency = $data->update_frequency;
+ }
+ if (isset($data->update_frequency)) {
+ $mbMetadata->downloadLinks = array($data->downloadlink);
+ }
+ //new for keywords and classifications:
+ if (isset($data->keywords) && $data->keywords != "") {
+ $mbMetadata->keywords = array_map('trim',explode(',',$data->keywords));
+ //for all those keywords don't set a special thesaurus name
+ foreach ($mbMetadata->keywords as $keyword) {
+ $mbMetadata->keywordsThesaurusName[] = "none";
+ }
+ }
+ if (isset($data->md_md_topic_category_id)) {
+ $mbMetadata->isoCategories = $data->md_md_topic_category_id;
+ }
+ if (isset($data->md_inspire_category_id)) {
+ $mbMetadata->inspireCategories = $data->md_inspire_category_id;
+ }
+ if (isset($data->md_custom_category_id)) {
+ $mbMetadata->customCategories = $data->md_custom_category_id;
+ }
+ //use information from bbox!
+ if (isset($data->west)) {
+ $mbMetadata->wgs84Bbox[0] = $data->west;
+ }
+ if (isset($data->east)) {
+ $mbMetadata->wgs84Bbox[2] = $data->east;
+ }
+ if (isset($data->north)) {
+ $mbMetadata->wgs84Bbox[3] = $data->north;
+ }
+ if (isset($data->south)) {
+ $mbMetadata->wgs84Bbox[1] = $data->south;
+ }
+ if (isset($data->fees_md)) {
+ $mbMetadata->fees = $data->fees_md;
+ }
+ if (isset($data->accessconstraints_md)) {
+ $mbMetadata->accessConstraints = $data->accessconstraints_md;
+ }
+ if (isset($data->md_termsofuse) && $data->md_termsofuse !=='0') {
+ $mbMetadata->termsOfUseRef = $data->md_termsofuse;
+ }
+ if (isset($data->preview_image) && $data->preview_image !=='' ) {
+ $mbMetadata->previewImage = $data->preview_image;
+ }
+ //overwrite responsible party info if wished
+ if ($data->check_overwrite_responsible_party) {
+ if ($data->responsible_party_name !== "") {
+ $mbMetadata->resourceResponsibleParty = $data->responsible_party_name;
+ } else {
+ $mbMetadata->resourceResponsibleParty = "Empty value for responsible party name!";
+ }
+ if ($data->responsible_party_email !== "") {
+ $mbMetadata->resourceContactEmail = $data->responsible_party_email;
+ } else {
+ $mbMetadata->resourceContactEmail = "Empty value for responsible party email!";
+ }
+ } else {
+ $mbMetadata->resourceResponsibleParty = null;
+ $mbMetadata->resourceContactEmail = null;
+ }
+ //for foreign keys - how to invoke application
+ if (isset($data->fkey_gui_id) && $data->fkey_gui_id != '') {
+ $mbMetadata->fkeyGuiId = $data->fkey_gui_id;
+ }
+ if (isset($data->fkey_wmc_serial_id) && $data->fkey_wmc_serial_id != '') {
+ $mbMetadata->fkeyWmcSerialId = $data->fkey_wmc_serial_id;
+ }
+ if (isset($data->fkey_mapviewer_id) && $data->fkey_mapviewer_id != '') {
+ $mbMetadata->fkeyMapviewerId = $data->fkey_mapviewer_id;
+ }
+ //fill thru metador
+ $mdOwner = Mapbender::session()->get("mb_user_id");
+ $mbMetadata->owner = $mdOwner;
+ $mbMetadata->origin = "metador";
+ $mbMetadata->fileIdentifier = $uuid;
+ $mbMetadata->randomId = $randomid;
+ $result = $mbMetadata->insertToDB($resourceType,$resourceId);
+ $e = new mb_exception("test to metadata insert/update via metador!");
+ if ($result['value'] == false) {
+ $e = new mb_exception("Problem while storing metadata from editor to mb_metadata table!");
+ $e = new mb_exception($result['message']);
+ abort($result['message']);
+ } else {
+ $e = new mb_notice("Metadata with id ".$randomid." stored from editor to db!");
+ $ajaxResponse->setMessage("Metadata with id ".$randomid." stored from editor to db!");
+ $ajaxResponse->setSuccess(true);
+ }
+ break;
+ case "updateMetadata" :
+ //TODO - only for application metadata at the time 2019-10-07
+ $metadataId = $ajaxResponse->getParameter("metadataId");
+ $resourceType = $ajaxResponse->getParameter("resourceType");
+ //get json data from ajax call
+ $data = $ajaxResponse->getParameter("data");
+ //initialize actual metadata object from db!
+ $mbMetadata = new Iso19139();
+ $result = $mbMetadata->createFromDBInternalId($metadataId);
+ if ($result) {
+ if ($data->export2csw) {
+ $mbMetadata->export2Csw = 't';
+ } else {
+ $mbMetadata->export2Csw = 'f';
+ }
+ if ($data->searchable) {
+ $mbMetadata->searchable = 't';
+ } else {
+ $mbMetadata->searchable = 'f';
+ }
+ if ($data->inspire_download) {
+ $mbMetadata->inspireDownload = 1;
+ } else {
+ $mbMetadata->inspireDownload = 0;
+ }
+ $mbMetadata->href = $data->link;
+ $mbMetadata->title = $data->title;
+ $mbMetadata->abstract = $data->abstract;
+ $mbMetadata->refSystem = $data->ref_system;
+ $mbMetadata->tmpExtentBegin = $data->tmp_reference_1;
+ $mbMetadata->tmpExtentEnd = $data->tmp_reference_2;
+ $mbMetadata->lineage = $data->lineage;
+ $mbMetadata->origin = 'metador';
+ $mbMetadata->hierarchyLevel = $resourceType;
+ $mbMetadata->inspireCharset = $data->inspire_charset;
+ $mbMetadata->updateFrequency = $data->update_frequency;
+ //categories ...
+ //new for keywords and classifications:
+ if (isset($data->keywords) && $data->keywords != "") {
+ $mbMetadata->keywords = array_map('trim',explode(',',$data->keywords));
+ //for all those keywords don't set a special thesaurus name
+ foreach ($mbMetadata->keywords as $keyword) {
+ $mbMetadata->keywordsThesaurusName[] = "none";
+ }
+ }
+ if (isset($data->md_md_topic_category_id)) {
+ $mbMetadata->isoCategories = $data->md_md_topic_category_id;
+ } else {
+ $mbMetadata->isoCategories = array();
+ }
+ if (isset($data->md_inspire_category_id)) {
+ $mbMetadata->inspireCategories = $data->md_inspire_category_id;
+ } else {
+ $mbMetadata->inspireCategories = array();
+ }
+ if (isset($data->md_custom_category_id)) {
+ $mbMetadata->customCategories = $data->md_custom_category_id;
+ } else {
+ $mbMetadata->customCategories = array();
+ }
+ //use information from bbox!
+ if (isset($data->west)) {
+ $mbMetadata->wgs84Bbox[0] = $data->west;
+ }
+ if (isset($data->east)) {
+ $mbMetadata->wgs84Bbox[2] = $data->east;
+ }
+ if (isset($data->north)) {
+ $mbMetadata->wgs84Bbox[3] = $data->north;
+ }
+ if (isset($data->south)) {
+ $mbMetadata->wgs84Bbox[1] = $data->south;
+ }
+ if (isset($data->fees_md)) {
+ $mbMetadata->fees = $data->fees_md;
+ }
+ if (isset($data->accessconstraints_md)) {
+ $mbMetadata->accessConstraints = $data->accessconstraints_md;
+ }
+ //$e = new mb_exception($data->md_termsofuse);
+ if (isset($data->md_termsofuse) && $data->md_termsofuse !=='0' && $data->md_termsofuse !== 0) {
+ $mbMetadata->termsOfUseRef = $data->md_termsofuse;
+ } else {
+ $mbMetadata->termsOfUseRef = null;
+ }
+ if (isset($data->md_license_source_note)) {
+ $mbMetadata->licenseSourceNote = $data->md_license_source_note;
+ }
+ if (isset($data->preview_image) && $data->preview_image !=='' ) {
+ $mbMetadata->previewImage = $data->preview_image;
+ }
+ //overwrite responsible party info if wished
+ if ($data->check_overwrite_responsible_party) {
+ if ($data->responsible_party_name !== "") {
+ $mbMetadata->resourceResponsibleParty = $data->responsible_party_name;
+ } else {
+ $mbMetadata->resourceResponsibleParty = "Empty value for responsible party name!";
+ }
+ if ($data->responsible_party_email !== "") {
+ $mbMetadata->resourceContactEmail = $data->responsible_party_email;
+ } else {
+ $mbMetadata->resourceContactEmail = "Empty value for responsible party email!";
+ }
+ } else {
+ $mbMetadata->resourceResponsibleParty = null;
+ $mbMetadata->resourceContactEmail = null;
+ }
+ //for foreign keys - how to invoke application
+ if (isset($data->fkey_gui_id) && $data->fkey_gui_id != '') {
+ $mbMetadata->fkeyGuiId = $data->fkey_gui_id;
+ } else {
+$mbMetadata->fkeyGuiId = null;
+ }
+ if (isset($data->fkey_wmc_serial_id) && $data->fkey_wmc_serial_id != '') {
+ $mbMetadata->fkeyWmcSerialId = $data->fkey_wmc_serial_id;
+ } else {
+$mbMetadata->fkeyWmcSerialId = null;
+ }
+ if (isset($data->fkey_mapviewer_id) && $data->fkey_mapviewer_id != '') {
+ $mbMetadata->fkeyMapviewerId = $data->fkey_mapviewer_id;
+ } else {
+$mbMetadata->fkeyMapviewerId = null;
+ }
+ //try to update metadata object (only mb_metadata)
+ $res = $mbMetadata->updateMetadataById($metadataId);
+ if (!$res) {
+ //could not update metadata in db
+ $ajaxResponse->setMessage(_mb("Could not update metadata object in database!"));
+ $ajaxResponse->setSuccess(false);
+ } else {
+ //update relations for keywords and categories
+ $mbMetadata->insertKeywordsAndCategoriesIntoDB($metadataId,$resourceType,$resourceId);
+ $ajaxResponse->setMessage(_mb("Edited metadata was updated in the mapbender database!"));
+ $ajaxResponse->setSuccess(true);
+ }
+ } else {
+ //could not read metadata from db
+ $ajaxResponse->setMessage(_mb("Could not get metadata object from database!"));
+ $ajaxResponse->setSuccess(false);
+ }
+ break;
case "importXmlAddon" :
//this case is similar to insert the metadata from external link, but came from internal file from tmp folder which has been uploaded before
$resourceId = $ajaxResponse->getParameter("resourceId");
Added: trunk/mapbender/http/plugins/mb_metadata_showMetadata.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadata.js (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadata.js 2019-10-17 06:34:49 UTC (rev 10285)
@@ -0,0 +1,869 @@
+var $showMetadataDiv = $(this);
+var $metadataForm = $("<form></form>").appendTo($showMetadataDiv);
+var $metadataPopup = $("<div></div>");
+var $metadataUploadPopup = $("<div></div>");
+
+var ShowMetadataApi = function() {
+ var that = this;
+ var resourceId;
+ var resourceType;
+ var metadataId;
+
+ //Function, which pulls the metadata out off the mapbender registry and give a possibility to edit the record or link
+ this.valid = function () {
+ if (validator && validator.numberOfInvalids() > 0) {
+ $metadataForm.valid();
+ return false;
+ }
+ return true;
+ };
+
+ this.getInitialResourceMetadata = function(metadataId, resourceId, resourceType){
+ // get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getInitialResourceMetadata",
+ parameters: {
+ "resourceId": resourceId,
+ "metadataId": metadataId,
+ "resourceType": resourceType,
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ $metadataForm.easyform("reset");
+ $metadataForm.easyform("fill", obj);
+ $('#license_source_md').css("display","none");
+ if (obj.md_termsofuse !== "0") {
+ //alert(JSON.stringify(obj));
+ that.fillLicence(obj.md_termsofuse);
+ }
+
+ }
+ });
+ req.send();
+ }
+
+ getOwnedMetadata = function (){
+ // get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getOwnedApplicationMetadata",
+ parameters: {
+ //"layerId": Mapbender.modules.mb_md_layer.getLayerId()
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //fill options for of internal linkages
+ $("#internal_relation").empty();
+ var emptyOption = '<option value="">---</option>';
+ $("#internal_relation").append(emptyOption);
+ for ( var i=0 ; i<obj.length ; i++ ) {
+ var optionVal = obj[i].metadataId;
+ var optionName = obj[i].metadataId + " : " + obj[i].metadataTitle;
+ var optionHtml = "<option value='" + optionVal + "'>" + optionName + "</option>";
+ $("#internal_relation").append(optionHtml);
+ }
+
+ }
+ });
+ req.send();
+ }
+
+ this.getAddedMetadata = function(metadataId){
+ // get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getMetadata",
+ parameters: {
+ "metadataId": metadataId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ $metadataForm.easyform("reset");
+ $metadataForm.easyform("fill", obj);
+ //enable link element to edit link!
+ $("#link").removeAttr("disabled");
+ switch (obj.origin) {
+ case "external":
+ $("#metadataUrlEditor").css("display","block");
+ $("#link_editor").css("display","block");
+ break;
+ case "metador":
+ $("#metadataUrlEditor").css("display","block");
+ $("#simple_metadata_editor").css("display","block");
+ break;
+ case "capabilities":
+ $("#metadataUrlEditor").css("display","block");
+ $("#simple_metadata_editor").css("display","block");
+ break;
+ //new - uploaded metadata maybe edited - but some information will be lost :-(
+ case "upload":
+ $("#metadataUrlEditor").css("display","block");
+ $("#simple_metadata_editor").css("display","block");
+ break;
+ default:
+ break;
+ }
+ //select the right list entries:
+ $(".format_selectbox").val(obj.format);
+ $(".charset_selectbox").val(obj.inspire_charset);
+ $(".ref_system_selectbox").val(obj.ref_system);
+ $(".cyclic_selectbox").val(obj.update_frequency);
+ //new for applications
+ if (obj.fkey_gui_id != null) {
+ $(".gui_selectbox").val(obj.fkey_gui_id);
+ }
+ if (obj.fkey_wmc_serial_id != null) {
+ $(".wmc_selectbox").val(obj.fkey_wmc_serial_id);
+ }
+ if (obj.fkey_mapviewer_id != null) {
+ $(".default_viewer_selectbox").val(obj.fkey_mapviewer_id);
+ }
+ /*<input type="radio" id="app_type_external" name="application_type" value="app_type_external"checked="checked"><label for="app_type_external"><?php echo _mb("External application");?></label><br>
+ <input type="radio" id="app_type_gui" name="application_type" value="app_type_gui"><label for="app_type_gui"><?php echo _mb("Mapbender GUI");?></label><br>
+ <input type="radio" id="app_type_gui_wmc"*/
+ if (obj.fkey_gui_id != null) {
+ if (obj.fkey_wmc_serial_id != null) {
+ //generate link
+ $("#app_type_gui_wmc").attr('checked', true);
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+ //hide other forms
+ $('#gui_select_fieldset').css('display', 'block');
+ $('#wmc_select_fieldset').css('display', 'block');
+ $('#default_viewer_fieldset').css('display', 'block');
+ $('#address_link_fieldset').css('display', 'none');
+ $('#link').removeClass("required");
+ $('#fkey_wmc_serial_id').addClass("required");
+ $('#fkey_gui_id').addClass("required");
+ } else {
+ $("#app_type_gui").attr('checked', true);
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), false);
+ //hide other forms
+ $('#gui_select_fieldset').css('display', 'block');
+ $('#default_viewer_fieldset').css('display', 'block');
+ $('#wmc_select_fieldset').css('display', 'none');
+ $('#address_link_fieldset').css('display', 'none');
+ $('#link').removeClass("required");
+ $('#fkey_wmc_serial_id').removeClass("required");
+ $('#fkey_gui_id').addClass("required");
+ }
+ } else {
+ $("#app_type_external").attr('checked', true);
+ $('#gui_select_fieldset').css('display', 'none');
+ $('#wmc_select_fieldset').css('display', 'none');
+ $('#address_link_fieldset').css('display', 'block');
+ //if (obj.link != '') {
+ $("#link").val(obj.link);
+ //} else {
+ // $("#link").attr('');
+ //}
+ if (isURL($("#link").val())) {
+ $("#preview_link").text($("#link").val());
+ $("#preview_link").attr("href",$("#link").val());
+ } else {
+ $("#preview_link").text('currently not set');
+ $("#preview_link").removeAttr("href");
+ }
+ //fill preview
+ //hide other forms
+ }
+ if (obj.preview_image == '{localstorage}') {
+ $("#preview_type_upload").attr('checked', true);
+ $("#preview_image_fieldset_url").css('display', 'none');
+ $("#preview_image_fieldset_upload").css('display', 'block');
+ //exchange im src attr with preview image generator script
+ getPreviewUrl(metadataId);
+ $("#delete_existing_preview").css("display","block");
+ }
+ urlstring = obj.overview_url+"&time="+ new Date().getTime();
+ $("#extent_preview").attr('src',urlstring);
+ $(".radioRes").filter('[value='+obj.spatial_res_type+']').attr('checked', true);
+ if (obj.has_polygon) {
+ $("#delete_existing_polygon").css("display","block");
+ } else {
+ $("#delete_existing_polygon").css("display","none");
+ }
+ $(".termsofuse_selectbox").val(obj.md_termsofuse);
+ //show symbol and link for predefined termsofuse
+ if (obj.md_termsofuse !== "0") {
+ //alert(JSON.stringify(obj));
+ that.fillLicence(obj.md_termsofuse);
+ }
+ if ($("#check_overwrite_responsible_party").is(":checked")) {
+ $('#label_responsible_party_name').css('display', 'block');
+ $('#responsible_party_name').css('display', 'block');
+ $('#label_responsible_party_email').css('display', 'block');
+ $('#responsible_party_email').css('display', 'block');
+ }
+ }
+ });
+ req.send();
+ }
+
+ this.fillMapviewerPreviewUrl = function(mapviewerId, guiId=false, wmcId=false) {
+ //alert('fillMapviewerPreviewUrl');
+ //get mapviewer preview from server
+ if (mapviewerId == '' || mapviewerId == null || $("#app_type_external").is(":checked")) {
+ alert('No mapviewerId set - set url empty!');
+ $("#preview_link").text("No api url defined til now!");
+ $("#preview_link").attr("href",'');
+ } else {
+ //alert('Get url from class_administration!');
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getMapviewerUrl",
+ parameters: {
+ "mapviewerId": mapviewerId,
+ "guiId": guiId,
+ "wmcId": wmcId,
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ if (obj.mapviewer_url) {
+ $("#preview_link").text(obj.mapviewer_url);
+ $("#preview_link").attr("href",obj.mapviewer_url);
+ }
+ }
+ });
+ req.send();
+ }
+ }
+
+ //Show more information about the licences of the metadata
+ this.fillLicence = function(obj) {
+ // get licence information from server per termsofuse_id
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getLicenceInformation",
+ parameters: {
+ "id": obj
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ if (obj.termsofuse_id) {
+ //alert(JSON.stringify(obj));
+ $('#licence_symbol_md').attr('src', obj.symbollink);
+ $('#licence_descriptionlink_md').text(obj.description);
+ $('#licence_descriptionlink_md').attr('href', obj.descriptionlink);
+ if (obj.isopen == 1) {
+ $('#open_symbol_md').attr('src', '../img/od_80x15_blue.png');
+ $('#open_symbol_md').css("display","block");
+ } else {
+ $('#open_symbol_md').attr('src', '');
+ $('#open_symbol_md').css("display","none");
+ }
+ if (obj.source_required == 1) {
+ $('#license_source_md').css("display","block");
+ } else {
+ $('#license_source_md').css("display","none");
+ }
+ $('#license_info_md').css('display', 'block');
+ } else {
+ $('#licence_symbol_md').attr('src', '');
+ $('#licence_descriptionlink_md').attr('href', '');
+ $('#licence_descriptionlink_md').text('');
+ $('#open_symbol_md').attr('src', '');
+ $('#license_info_md').css('display', 'none');
+ }
+ }
+ });
+ req.send();
+ }
+
+ this.insertAddedMetadata = function(resourceId, resourceType, data){
+ // push metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "insertMetadata",
+ parameters: {
+ "resourceId": resourceId,
+ "resourceType": resourceType,
+ "data": data
+ },
+ callback: function (obj, result, message) {
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ if (resourceType !== 'metadata') {
+ //update resource form to show edited data
+ that.fillResourceForm(resourceId, resourceType);
+ } else {
+ Mapbender.modules.mb_metadata_manager_select.initTable();
+ }
+ }
+ });
+ req.send();
+ }
+
+ this.updateAddedMetadata = function(metadataId, resourceId, resourceType, data){
+ // push metadata to server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "updateMetadata",
+ parameters: {
+ "metadataId": metadataId,
+ "resourceId": resourceId,
+ "resourceType": resourceType,
+ "data": data
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ if (resourceType !== 'metadata') {
+ //update resource form to show edited data
+ that.fillResourceForm(resourceId, resourceType);
+ } else {
+ Mapbender.modules.mb_metadata_manager_select.initTable();
+ }
+ }
+ });
+ req.send();
+ }
+
+ //function to fill resource form with changed metadata entries TODO: this function is defined in mb_metadata_layer[featuretype].js before but it cannot be called - maybe s.th. have to be changed
+ this.fillResourceForm = function (resourceId, resourceType) {
+ //get metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getResourceMetadata",
+ parameters: {
+ "resourceId": resourceId,
+ "resourceType": resourceType
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //delete metadataURL entries
+ $('.metadataEntry').remove();
+ //fill MetadataURLs into metadata_selectbox_id - notice: the name of the module is fix!
+ switch (resourceType) {
+ case "layer":
+ Mapbender.modules.mb_md_layer.fillMetadataURLs(obj);
+ //reload layer tree for showing symbols
+ Mapbender.modules.mb_md_layer_tree.init(Mapbender.modules.mb_md_layer.getWmsId());
+ break;
+ case "featuretype":
+ //TODO
+ //fill MetadataURLs into metadata_selectbox_id - notice: the name of the module is fix!
+ Mapbender.modules.mb_md_featuretype.fillMetadataURLs(obj);
+ //reload featuretype tree for showing symbols
+ Mapbender.modules.mb_md_featuretype_tree.init(Mapbender.modules.mb_md_featuretype.getWfsId());
+ break;
+ }
+ }
+ });
+ req.send();
+ };
+
+ deleteAddedMetadata = function(metadataId, resourceId, resourceType){
+ // push metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "deleteMetadata",
+ parameters: {
+ "metadataId": metadataId,
+ "resourceId": resourceId,
+ "resourceType": resourceType
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //delete metadataURL entries
+ $('.metadataEntry').remove();
+ //fill MetadataURLs into metadata_selectbox_id
+ //update resource form to show edited data
+ that.fillResourceForm(resourceId, resourceType);
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ }
+ });
+ req.send();
+ }
+
+ deleteInternalMetadataLinkage = function(metadataId, resourceId, resourceType){
+ // push metadata from server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "deleteInternalMetadataLinkage",
+ parameters: {
+ "metadataId": metadataId,
+ "resourceType": resourceType,
+ "resourceId": resourceId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //delete metadataURL entries
+ $('.metadataEntry').remove();
+ //fill MetadataURLs into metadata_selectbox_id
+ //update resource form to show edited data
+ that.fillResourceForm(resourceId, resourceType);
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ }
+ });
+ req.send();
+ }
+
+ this.showForm = function (metadataId, resourceId, resourceType, isNew) {
+ $metadataPopup.append($metadataForm);
+ $metadataPopup.dialog({
+ title : "Metadata Editor for "+resourceType,
+ autoOpen : false,
+ draggable : true,
+ modal : true,
+ width : 700,
+ position : [600, 75],
+ buttons: {
+ "close": function() {
+ $(this).dialog('close');
+ },
+ "save": function() {
+ //get data from form
+ //supress validation for the link only way
+ //example $("#myform").validate().element( "#myselect" );
+ //$("#myform").validate({
+ // ignore: ".ignore"
+ //})
+ if ($("#addonChooser").css("display") == "block") {
+ //don't allow saving but do something else
+ return;
+
+ }
+ if ($("#simple_metadata_editor").css("display") == "block") {
+ //validate form before send it!
+ if ($metadataForm.valid() != true) {
+ alert("Form not valid - please check your input!"); //TODO use translations and make a php file from this
+ return;
+ }
+ }
+ var formData = $metadataForm.easyform("serialize");
+ if (!isNew) {
+ that.updateAddedMetadata(metadataId, resourceId, resourceType, formData);
+ } else {
+ that.insertAddedMetadata(resourceId, resourceType, formData);
+ }
+ //$('#mb_md_layer_tree').refresh;
+ $(this).dialog('close');
+ }
+ },
+ close: function() {
+ //what to do when the dialog is closed
+ }
+ });
+ $metadataPopup.dialog("open");
+ };
+
+ initUploadForm = function (resourceId, resourceType) {
+ $metadataPopup.dialog("close");
+ //TODO: problem - when invoking it first - mb_metadata.php - there is no information about the resourceType and its id. Some error occurs - but hidden ;-)
+ initXmlImport(resourceId, resourceType);
+ that.fillResourceForm(resourceId, resourceType);
+ }
+ initUploadPreviewForm = function (metadataId) {
+ initPreviewImport(metadataId);
+ }
+
+ getPreviewUrl = function (metadataId){
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "getPreviewUrl",
+ parameters: {
+ "metadataId": metadataId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ alert(message);
+ return;
+ }
+ //alert(obj.preview_url);
+ //set src of preview image to preview url
+ $("#image_preview").attr('src',obj.preview_url);
+ urlstring = $("#image_preview").attr('src')+"&time="+ new Date().getTime();
+ $("#image_preview").attr('src',urlstring);
+ $("#image_preview").css("display","block");
+ }
+ });
+ req.send();
+ }
+
+ enableResetButtonMd = function() {
+ $("#resetIsoTopicCatsMd").click(function() {
+ $("#md_md_topic_category_id option").removeAttr("selected");
+ });
+ $("#resetCustomCatsMd").click(function() {
+ $("#md_custom_category_id option").removeAttr("selected");
+ });
+ $("#resetInspireCatsMd").click(function() {
+ $("#md_inspire_category_id option").removeAttr("selected");
+ });
+ }
+
+ isURL = function (str) {
+ var pattern = new RegExp('^((ft|htt)ps?:\\/\\/)?'+ // protocol
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name and extension
+ '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
+ '(\\:\\d+)?'+ // port
+ '(\\/[-a-z\\d%@_.~+&:]*)*'+ // path
+ '(\\?[;&a-z\\d%@_.,~+&:=-]*)?'+ // query string
+ '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
+ return pattern.test(str);
+ }
+
+ initUploadGmlForm = function (metadataId) {
+ //don't show possibility if metadata was not created before - only afterwards!
+ initGmlImport(metadataId);
+ }
+
+ deletePreview = function (metadataId) {
+ //invoke server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "deletePreview",
+ parameters: {
+ "metadataId": metadataId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //hide delete image
+ $("#delete_existing_preview").css("display","none");
+ $("#image_preview").attr('src','');
+ $("#image_preview").css("display","none");
+ //update preview
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ }
+ });
+ req.send();
+ }
+
+ deleteGmlPolygon = function (metadataId) {
+ //invoke server
+ var req = new Mapbender.Ajax.Request({
+ url: "../plugins/mb_metadata_server.php",
+ method: "deleteGmlPolygon",
+ parameters: {
+ "metadataId": metadataId
+ },
+ callback: function (obj, result, message) {
+ if (!result) {
+ return;
+ }
+ //hide delete image
+ $("#delete_existing_polygon").css("display","none");
+ //update preview
+ urlstring = $("#extent_preview").attr('src')+"&time="+ new Date().getTime();
+ $("#extent_preview").attr('src',urlstring);
+ $("<div></div>").text(message).dialog({
+ modal: true
+ });
+ }
+ });
+ req.send();
+ }
+
+ this.init = function (metadataId, resourceId, resourceType, isNew) {
+ $metadataPopup.dialog("close");
+ if (resourceType == 'application') {
+ $metadataForm.load("../plugins/mb_metadataApplication.php", function () {
+ //push infos to help dialogs
+ $metadataForm.find(".help-dialog").helpDialog();
+ //initialize datepicker
+ $('.hasdatepicker').datepicker({dateFormat:'yy-mm-dd', yearRange: '1900:2050', buttonImageOnly: true, changeYear: true,
+ constraintInput: true});
+ //first get json
+ if (!isNew) {
+ that.getAddedMetadata(metadataId);
+ } else {
+ //show chooser
+ $("#metadataUrlEditor").css("display","block");
+ $("#addonChooser").css("display","block");
+ //get initial values (title/abstract)
+ that.getInitialResourceMetadata(metadataId, resourceId, resourceType);
+ }
+ that.showForm(metadataId, resourceId, resourceType, isNew);
+ //disable options which are not needed
+ $('#inspire_categories_fieldset').css('display', 'none');
+
+
+ if ($("#app_type_external").is(":checked")) {
+ $('#gui_select_fieldset').css('display', 'none');
+ $('#wmc_select_fieldset').css('display', 'none');
+ $('#default_viewer_fieldset').css('display', 'none');
+ $('#link').addClass("required");
+ $('#fkey_gui_id').removeClass("required");
+ $('#fkey_wmc_serial_id').removeClass("required");
+ }
+ if ($("#app_type_gui").is(":checked")) {
+ $('#wmc_select_fieldset').css('display', 'none');
+ $('#address_link_fieldset').css('display', 'none');
+ $('#link').removeClass("required");
+ $('#fkey_wmc_serial_id').removeClass("required");
+ $('#fkey_gui_id').addClass("required");
+ }
+ if ($("#app_type_gui_wmc").is(":checked")) {
+ $('#address_link_fieldset').css('display', 'none');
+ $('#link').removeClass("required");
+ $('#fkey_gui_id').addClass("required");
+ $('#fkey_wmc_serial_id').addClass("required");
+ }
+
+ if ($("#preview_type_external").is(":checked")) {
+ $('#preview_image_fieldset_upload').css('display', 'none');
+ $('#preview_image_fieldset_url').css('display', 'block');
+ }
+ if ($("#preview_type_upload").is(":checked")) {
+ $('#preview_image_fieldset_upload').css('display', 'block');
+ $('#preview_image_fieldset_url').css('display', 'none');
+ }
+
+ $("#uploadImage").click(function () {
+ initUploadForm(resourceId, resourceType);
+ //initUploadForm(layerId);
+ });
+ $("#uploadPreviewImg").click(function () {
+ initUploadPreviewForm(metadataId);
+ });
+ $("#delete_existing_preview").click(function () {
+ deletePreview(metadataId);
+ });
+ $("#uploadgmlimage").click(function () {
+ initUploadGmlForm(metadataId);
+ });
+ $("#delete_existing_polygon").click(function () {
+ deleteGmlPolygon(metadataId);
+ });
+ $('#label_responsible_party_name').css('display', 'none');
+ $('#responsible_party_name').css('display', 'none');
+ $('#label_responsible_party_email').css('display', 'none');
+ $('#responsible_party_email').css('display', 'none');
+
+ if ($('#preview_image').val() == '{localstorage}') {
+ $('#preview_type_upload').attr('checked', 'checked');
+ }
+
+ $('#fkey_wmc_serial_id').change(function () {
+ //build url
+ //check if gui_id already set before - else alert
+ if ($('#fkey_gui_id').val() !== '') {
+ //internalAppUrl = $('#mainDiv').attr('mapbender_url') + 'gui_id=' + $('#fkey_gui_id').val() + '&WMC=' + $('#fkey_wmc_serial_id').val();
+ //$("#preview_link").text(internalAppUrl);
+ //$("#preview_link").attr("href",internalAppUrl);
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+ } else {
+ alert('Before you can select a WMC, you first have to select a GUI from the list above!');
+ //unset wmc again ;-)
+ $('#fkey_wmc_serial_id option[value=""]').attr('selected', 'selected');
+ }
+ //generate linkage
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+ });
+ $('#fkey_gui_id').change(function () {
+ if ($('#fkey_gui_id').val() !== '') {
+ //internalAppUrl = $('#mainDiv').attr('mapbender_url') + 'gui_id=' + $('#fkey_gui_id').val();
+ //$("#preview_link").text(internalAppUrl);
+ //$("#preview_link").attr("href",internalAppUrl);
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+ } else {
+ $("#preview_link").text("currently not set");
+ $("#preview_link").removeAttr("href");
+ }
+
+ });
+ $('#fkey_mapviewer_id').change(function () {
+ if ($('#fkey_mapviewer_id').val() !== '') {
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+ } else {
+ $("#preview_link").text("currently not set");
+ $("#preview_link").removeAttr("href");
+ }
+
+ });
+ $("[name='preview_type']").change(function () {
+ if ($("#preview_type_external").is(":checked")) {
+ $('#preview_image_fieldset_upload').css('display', 'none');
+ $('#preview_image_fieldset_url').css('display', 'block');
+ }
+ if ($("#preview_type_upload").is(":checked")) {
+ $('#preview_image_fieldset_upload').css('display', 'block');
+ $('#preview_image_fieldset_url').css('display', 'none');
+ }
+ });
+
+ $("#check_overwrite_responsible_party").change(function () {
+ if ($("#check_overwrite_responsible_party").is(":checked")) {
+ $('#label_responsible_party_name').css('display', 'block');
+ $('#responsible_party_name').css('display', 'block');
+ $('#label_responsible_party_email').css('display', 'block');
+ $('#responsible_party_email').css('display', 'block');
+ } else {
+ $('#label_responsible_party_name').css('display', 'none');
+ $('#responsible_party_name').css('display', 'none');
+ $('#label_responsible_party_email').css('display', 'none');
+ $('#responsible_party_email').css('display', 'none');
+ }
+ });
+ //change of application type
+ $("[name='application_type']").change(function () {
+ if ($("#app_type_external").is(":checked")) {
+ $('#gui_select_fieldset').css('display', 'none');
+ $('#wmc_select_fieldset').css('display', 'none');
+ $('#default_viewer_fieldset').css('display', 'none');
+ $('#address_link_fieldset').css('display', 'block');
+ if (isURL($("#link").val())) {
+ $("#preview_link").text($("#link").val());
+ $("#preview_link").attr("href",$("#link").val());
+ } else {
+ $("#preview_link").text('currently not set');
+ $("#preview_link").removeAttr("href");
+ }
+ //set values of other fields to null
+ $('#fkey_wmc_serial_id').val("");
+ $('#fkey_gui_id').val("");
+ $('#link').addClass("required");
+ $('#fkey_gui_id').removeClass("required");
+ $('#fkey_wmc_serial_id').removeClass("required");
+
+ }
+ if ($("#app_type_gui").is(":checked")) {
+ $('#gui_select_fieldset').css('display', 'block');
+$('#default_viewer_fieldset').css('display', 'block');
+ $('#wmc_select_fieldset').css('display', 'none');
+ $('#address_link_fieldset').css('display', 'none');
+ $('#fkey_wmc_serial_id').val("");
+ $('#link').val("");
+ $('#link').removeClass("required");
+ $('#fkey_wmc_serial_id').removeClass("required");
+ $('#fkey_gui_id').addClass("required");
+ //$("#preview_link").text('currently not set');
+ //$("#preview_link").removeAttr("href","");
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+
+ }
+ if ($("#app_type_gui_wmc").is(":checked")) {
+ $('#gui_select_fieldset').css('display', 'block');
+ $('#wmc_select_fieldset').css('display', 'block');
+$('#default_viewer_fieldset').css('display', 'block');
+ $('#address_link_fieldset').css('display', 'none');
+ $('#link').val("");
+ $('#link').removeClass("required");
+ $('#fkey_gui_id').addClass("required");
+ $('#fkey_wmc_serial_id').addClass("required");
+ //$("#preview_link").text('currently not set');
+ //$("#preview_link").removeAttr("href","");
+ that.fillMapviewerPreviewUrl($('#fkey_mapviewer_id').val(), $('#fkey_gui_id').val(), $('#fkey_wmc_serial_id').val());
+ }
+ });
+ //change of url - when write it to field - make link, if link is found by expr
+ //
+ //$("#link").onclick(alert('test'));
+ $("#link")[0].oninput = function(){
+ if (isURL($("#link").val())) {
+ $("#preview_link").text($("#link").val());
+ $("#preview_link").attr("href",$("#link").val());
+ } else {
+ $("#preview_link").text('currently not set');
+ $("#preview_link").removeAttr("href");
+ }
+ };
+ /*$("#link").on('input',function(e) {
+ //alert($("#link").val());
+ $("#preview_link").text( $(e.target).val() );
+ //alert($("#link").val());
+ //$("#preview_link").text($("#link").val());
+ //$("#preview_link").attr("href",$("#link").val());
+ });*/
+ //$("#link").trigger("input");
+ //enable reset buttons for categories
+ enableResetButtonMd();
+ //alert($("#uploadImage").attr('onclick')); //there has been a bigger problem when setting an onclick attribut with jquery :-(
+ //TODO: make the fields resizable
+ //$( "#abstract" ).resizable({ minWidth: 75 });
+ });
+ } else {
+ $metadataForm.load("../plugins/mb_metadataAddon.php", function () {
+ //push infos to help dialogs
+ $metadataForm.find(".help-dialog").helpDialog();
+ //initialize datepicker
+ $('.hasdatepicker').datepicker({dateFormat:'yy-mm-dd', yearRange: '1900:2050', buttonImageOnly: true, changeYear: true,
+ constraintInput: true});
+ //first get json
+ if (!isNew) {
+ that.getAddedMetadata(metadataId);
+ } else {
+ //show chooser
+ $("#metadataUrlEditor").css("display","block");
+ $("#addonChooser").css("display","block");
+ //get initial values (title/abstract)
+ that.getInitialResourceMetadata(metadataId, resourceId, resourceType);
+ }
+ that.showForm(metadataId, resourceId, resourceType, isNew);
+ //if add only dataset metadata, the reference to other datasets is not possible!
+ if (resourceType == 'metadata') {
+ $("#internalLinkage").css("display","none")
+ }
+ $("#uploadImage").click(function () {
+ initUploadForm(resourceId, resourceType);
+ //initUploadForm(layerId);
+ });
+ $("#uploadgmlimage").click(function () {
+ initUploadGmlForm(metadataId);
+ });
+ $("#delete_existing_polygon").click(function () {
+ deleteGmlPolygon(metadataId);
+ });
+ $('#label_responsible_party_name').css('display', 'none');
+ $('#responsible_party_name').css('display', 'none');
+ $('#label_responsible_party_email').css('display', 'none');
+ $('#responsible_party_email').css('display', 'none');
+ $("#check_overwrite_responsible_party").change(function () {
+ if ($("#check_overwrite_responsible_party").is(":checked")) {
+ $('#label_responsible_party_name').css('display', 'block');
+ $('#responsible_party_name').css('display', 'block');
+ $('#label_responsible_party_email').css('display', 'block');
+ $('#responsible_party_email').css('display', 'block');
+ } else {
+ $('#label_responsible_party_name').css('display', 'none');
+ $('#responsible_party_name').css('display', 'none');
+ $('#label_responsible_party_email').css('display', 'none');
+ $('#responsible_party_email').css('display', 'none');
+ }
+ });
+ //enable reset buttons for categories
+ enableResetButtonMd();
+ //alert($("#uploadImage").attr('onclick')); //there has been a bigger problem when setting an onclick attribut with jquery :-(
+ //TODO: make the fields resizable
+ //$( "#abstract" ).resizable({ minWidth: 75 });
+ });
+ }
+
+ }
+ initMetadata = function(metadataId, resourceId, resourceType, isNew) {
+ //close old window and load form
+ that.init(metadataId, resourceId, resourceType, isNew);
+ }
+};
+
+$showMetadataDiv.mapbender(new ShowMetadataApi());
Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js 2019-10-17 06:34:49 UTC (rev 10285)
@@ -332,7 +332,7 @@
this.showForm = function (metadataId, resourceId, resourceType, isNew) {
$metadataAddonPopup.append($metadataAddonForm);
$metadataAddonPopup.dialog({
- title : "Metadata Addon Editor",
+ title : "Metadata Editor",
autoOpen : false,
draggable : true,
modal : true,
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 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.4_to_2.8_pgsql_UTF-8.sql 2019-10-17 06:34:49 UTC (rev 10285)
@@ -2764,3 +2764,69 @@
ALTER TABLE md_topic_category ADD COLUMN md_topic_category_description_de text default 'TODO: Beschreibung einfügen';
+-- Things which are needed for application metadata editor
+-- Column: fkey_gui_id
+
+-- ALTER TABLE mb_metadata DROP COLUMN fkey_gui_id;
+
+ALTER TABLE mb_metadata ADD COLUMN fkey_gui_id text;
+
+-- Foreign Key: mb_metadata_ibfk_1
+
+-- ALTER TABLE mb_metadata DROP CONSTRAINT mb_metadata_ibfk_1;
+
+ALTER TABLE mb_metadata
+ ADD CONSTRAINT mb_metadata_ibfk_1 FOREIGN KEY (fkey_gui_id)
+ REFERENCES gui (gui_id) MATCH SIMPLE
+ ON UPDATE CASCADE ON DELETE RESTRICT;
+
+-- Column: fkey_wmc_serial_id
+
+-- ALTER TABLE mb_metadata DROP COLUMN fkey_wmc_serial_id;
+
+ALTER TABLE mb_metadata ADD COLUMN fkey_wmc_serial_id integer;
+
+-- Foreign Key: mb_metadata_ibfk_2
+
+-- ALTER TABLE mb_metadata DROP CONSTRAINT mb_metadata_ibfk_2;
+
+ALTER TABLE mb_metadata
+ ADD CONSTRAINT mb_metadata_ibfk_2 FOREIGN KEY (fkey_wmc_serial_id)
+ REFERENCES mb_user_wmc (wmc_serial_id) MATCH SIMPLE
+ ON UPDATE CASCADE ON DELETE RESTRICT;
+
+
+-- Table: mapviewer_types
+
+-- DROP TABLE mapviewer_types;
+
+CREATE TABLE mapviewer_types
+(
+ mapviewer_id SERIAL PRIMARY KEY,
+ mapviewer_name varchar(50) NOT NULL,
+ mapviewer_description text,
+ mapviewer_api_json varchar(512)
+)
+WITH (
+ OIDS=TRUE
+);
+ALTER TABLE mapviewer_types
+ OWNER TO postgres;
+
+-- Column: fkey_mapviewer_id
+
+-- ALTER TABLE mb_metadata DROP COLUMN fkey_mapviewer_id;
+
+ALTER TABLE mb_metadata ADD COLUMN fkey_mapviewer_id integer;
+
+-- Foreign Key: mb_metadata_ibfk_3
+
+-- ALTER TABLE mb_metadata DROP CONSTRAINT mb_metadata_ibfk_3;
+
+ALTER TABLE mb_metadata
+ ADD CONSTRAINT mb_metadata_ibfk_3 FOREIGN KEY (fkey_mapviewer_id)
+ REFERENCES mapviewer_types (mapviewer_id) MATCH SIMPLE
+ ON UPDATE CASCADE ON DELETE RESTRICT;
+
+
+
Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql 2019-10-17 06:34:49 UTC (rev 10285)
@@ -134,7 +134,8 @@
-- 2019-09-13 - update css to have a nicer default gui!
update gui_element set e_width=null, e_height=null where e_id = 'body' AND fkey_gui_id IN ( 'Administration_DE', 'PortalAdmin_DE', 'admin1');
-
+--update gui_element set e_width=null, e_height=null where e_id = 'body' AND fkey_gui_id IN ( 'BPlan-ID-Vergabe-Verbände','FPlan-ID-Vergabe');
+--TODO: admin_wmc_metadata, admin_dataset_metadata, admin_wms_metadata, ...
-- 2019-0-17 - add option to have a preferred gui defined for a user account
-- Column: fkey_preferred_gui_id
@@ -150,4 +151,4 @@
ADD CONSTRAINT fkey_preferred_gui_id_fkey FOREIGN KEY (fkey_preferred_gui_id)
REFERENCES gui (gui_id) MATCH SIMPLE
ON UPDATE CASCADE;
-
+--todo sql body element e_width=null ... e_styles: overflow:scroll; ....
Modified: trunk/mapbender/tools/exportMetadata.sh
===================================================================
--- trunk/mapbender/tools/exportMetadata.sh 2019-10-14 09:02:13 UTC (rev 10284)
+++ trunk/mapbender/tools/exportMetadata.sh 2019-10-17 06:34:49 UTC (rev 10285)
@@ -1,3 +1,3 @@
. /etc/profile
-cd /data/mapbender/http/php/
-php5 /data/mapbender/http/php/mod_exportISOMetadata.php ALL > /dev/null
+cd ../http/php/
+php7.0 mod_exportISOMetadata.php ALL > /dev/null
More information about the Mapbender_commits
mailing list