[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mapbender-commits
Subject:    [Mapbender-commits] r10359 - in trunk/mapbender/http: classes plugins
From:       svn_mapbender () osgeo ! org
Date:       2019-11-28 14:02:35
Message-ID: 20191128140236.7ED5913B26D () trac ! osgeo ! org
[Download RAW message or body]

Author: armin11
Date: 2019-11-28 06:02:34 -0800 (Thu, 28 Nov 2019)
New Revision: 10359

Modified:
   trunk/mapbender/http/classes/class_administration.php
   trunk/mapbender/http/classes/class_iso19139.php
   trunk/mapbender/http/plugins/mb_metadataApplication.php
   trunk/mapbender/http/plugins/mb_metadata_server.php
   trunk/mapbender/http/plugins/mb_metadata_showMetadata.js
Log:
Add possibility to choose between different organizations for application metadata - \
publish them for some other organization than the primary one of the metadata owner.

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2019-11-28 09:44:24 UTC \
                (rev 10358)
+++ trunk/mapbender/http/classes/class_administration.php	2019-11-28 14:02:34 UTC \
(rev 10359) @@ -2460,6 +2460,16 @@
 	    return $row["preview_image"];
 	}
     }
+
+    function getCombinedApplicationMetadata($guiId, $wmcId) {
+	//GET first! metadata record for this combination - maybe better GET last 
+	$sql = "SELECT uuid FROM mb_metadata WHERE fkey_gui_id = $1 AND fkey_wmc_serial_id \
= $2 ORDER BY lastchanged DESC LIMIT 1"; +	$v = array($guiId, $wmcId);
+	$t = array('s', 'i');
+        $res = db_prep_query($sql,$v,$t);
+	$row = db_fetch_array($res);
+	return $row["uuid"];
+    }
 	 
     /**
      * selects the gui_categories 

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2019-11-28 09:44:24 UTC (rev \
                10358)
+++ trunk/mapbender/http/classes/class_iso19139.php	2019-11-28 14:02:34 UTC (rev \
10359) @@ -323,10 +323,13 @@
 				//from 2017-03-02 - the MD_Identifier - see C.2.5 Unique resource identifier - \
it is separated with a slash - the codespace should be everything after the last \
                slash 
 				//now try to check if a single slash is available and if the md_identifier is a \
url  $parsedUrl = parse_url($code[0]);
+
 				if (($parsedUrl['scheme'] == 'http' || $parsedUrl['scheme'] == 'https') && \
strpos($parsedUrl['path'],'/') !== false) {  $explodedUrl = explode('/', $code[0]);
 					$this->datasetId = $explodedUrl[count($explodedUrl) - 1];
 					$this->datasetIdCodeSpace = rtrim($code[0], $this->datasetId);	
+
+//$e = new mb_exception("datasetId: ".$this->datasetId." - datasetIdCodeSpace: \
".$this->datasetIdCodeSpace);  } else {
 					if (($parsedUrl['scheme'] == 'http' || $parsedUrl['scheme'] == 'https') && \
strpos($code[0],'#') !== false) {  //$e = new mb_exception($code[0]);
@@ -1441,6 +1444,7 @@
 			$this->tmpExtentEnd = $row['tmp_reference_2'];//"1900-01-01";
 			$this->randomId =  $row['randomid'];
 			$this->owner = $row['fkey_mb_user_id']; //dummy entry for metadata owner - in \
case of metadataURL entries the owner of the corresponding service +                  \
$this->fkey_mb_group_id = $row['fkey_mb_group_id']; //entry for organization for \
which this metadata should be published - overwrites metadata point of contact - in \
case of inheritance by metadata proxy!  $this->href = $row['link'];// "";
 			$this->format = $row['md_format'];//"";
 			$this->type = $row['linktype'];//"";
@@ -2143,7 +2147,7 @@
 	}
 
 	public function deleteCategoriesFromCoupledResource($metadataId,$resourceType,$resourceId) \
                {
-		if ($resourceType == 'inspire_dls_atom' || $resourceType == \
'inspire_dls_atom_dataset' || $resourceType == 'metadata') { +		if ($resourceType == \
'inspire_dls_atom' || $resourceType == 'inspire_dls_atom_dataset' || $resourceType == \
'metadata' || $resourceType == 'application') {  return false;
 		}
 		//delete inherited categories from coupled resources: layer/featuretype

Modified: trunk/mapbender/http/plugins/mb_metadataApplication.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadataApplication.php	2019-11-28 09:44:24 UTC \
                (rev 10358)
+++ trunk/mapbender/http/plugins/mb_metadataApplication.php	2019-11-28 14:02:34 UTC \
(rev 10359) @@ -135,10 +135,10 @@
 		<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>
+	    <!--<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>
+	    </fieldset>-->
 	</div>
 	<div id="tabs-3">
 	    <fieldset id="md_classification">
@@ -185,11 +185,11 @@
 	<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">
+	        <!--<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>-->
 	        <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'> @@ -289,6 +289,36 @@
 	        <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>
+	    <!-- add option to define other organization than the editors primary group -->
+	    <fieldset>
+		<legend><?php echo _mb("Metadata Point of contact (registry)");?>: <img \
class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo \
_mb("Information about the organization which is responsible for contributing the \
metadata. The information will be automaticcaly generated from the mapbender database \
mb_group object. The information came from the primary group of the service owner or \
from a group which has authorized the owner to publish metadata in their \
name.");?>'}" src="../img/questionmark.png" alt="" /></legend> +
+<?php
+//selectbox for organizations which allows the publishing of metadatasets for the \
specific user +		$sql = "SELECT fkey_mb_group_id, mb_group_name FROM (SELECT \
fkey_mb_group_id FROM mb_user_mb_group WHERE fkey_mb_user_id = $1 AND \
(mb_user_mb_group_type = 3 OR mb_user_mb_group_type = 2)) AS a LEFT JOIN mb_group ON \
a.fkey_mb_group_id = mb_group.mb_group_id"; +		$user = new User();
+		$userId = $user->id;
+		$v = array($userId);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+		$metadataGroup = array();
+		while ($row = db_fetch_assoc($res)) {
+			$metadataGroup[$row["fkey_mb_group_id"]] = $row["mb_group_name"];
+		}
+		?>
+		<p>
+		    <label for="mb_group_name"><?php echo _mb("Organization responsible for \
metadata");?>:</label> +    		    <select name="fkey_mb_group_id" \
id="fkey_mb_group_id"> +			<option value="">...</option>
+<?php
+	foreach ($metadataGroup 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 different organizations which authorized \
you to publish metadata in their name.");?>'}" src="../img/questionmark.png" alt="" \
/> +	       </p>
+	    </fieldset><!-- end of selection for the different organizations -->
 	</div>
 	<div id="tabs-8">
 	    <!-- Radio button for type of application -->

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2019-11-28 09:44:24 UTC (rev \
                10358)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2019-11-28 14:02:34 UTC (rev \
10359) @@ -1267,7 +1267,9 @@
 			$resultObj["fkey_gui_id"] = $mbMetadata->fkeyGuiId;
 			$resultObj["fkey_wmc_serial_id"] = $mbMetadata->fkeyWmcSerialId;
 			$resultObj["fkey_mapviewer_id"] = $mbMetadata->fkeyMapviewerId;
+			$resultObj["fkey_mb_group_id"] = $mbMetadata->fkey_mb_group_id;
 			//give back result:
+
 			$ajaxResponse->setResult($resultObj);
 			$ajaxResponse->setSuccess(true);
 			break;
@@ -2285,6 +2287,12 @@
 		//fill thru metador
 		$mdOwner = Mapbender::session()->get("mb_user_id");
 		$mbMetadata->owner = $mdOwner;
+		//fkey_mb_group_id
+                if (isset($data->fkey_mb_group_id) && $data->fkey_mb_group_id != '') \
{ +                	$mbMetadata->fkey_mb_group_id = $data->fkey_mb_group_id;
+                } else {
+			$mbMetadata->fkey_mb_group_id = null;
+		}
 		$mbMetadata->origin = "metador";
 		$mbMetadata->fileIdentifier = $uuid;
 		$mbMetadata->randomId = $randomid;
@@ -2411,18 +2419,24 @@
 			if (isset($data->fkey_gui_id) && $data->fkey_gui_id != '') {
 				$mbMetadata->fkeyGuiId = $data->fkey_gui_id;
 			} else {
-$mbMetadata->fkeyGuiId = null;
+				$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;
+				$mbMetadata->fkeyWmcSerialId = null;
 			}
 			if (isset($data->fkey_mapviewer_id) && $data->fkey_mapviewer_id != '') {
 				$mbMetadata->fkeyMapviewerId = $data->fkey_mapviewer_id;
 			} else {
-$mbMetadata->fkeyMapviewerId = null;
+				$mbMetadata->fkeyMapviewerId = null;
 			}
+                        if (isset($data->fkey_mb_group_id) && \
$data->fkey_mb_group_id != '' && $data->fkey_mb_group_id != 0  && \
$data->fkey_mb_group_id != '0') { +                	    $mbMetadata->fkey_mb_group_id \
= $data->fkey_mb_group_id; +                        } else {
+			    $mbMetadata->fkey_mb_group_id = null;
+			}
+
 			//try to update metadata object (only mb_metadata)
 			$res = $mbMetadata->updateMetadataById($metadataId);
 			if (!$res) {

Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadata.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadata.js	2019-11-28 09:44:24 UTC \
                (rev 10358)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadata.js	2019-11-28 14:02:34 UTC \
(rev 10359) @@ -195,6 +195,10 @@
 					//alert(JSON.stringify(obj));
 					that.fillLicence(obj.md_termsofuse);
 				}
+				if (obj.fkey_mb_group_id !== "0") {
+					//alert(JSON.stringify(obj));
+					that.fillSelectGroup(obj.fkey_mb_group_id);
+				}
 				if ($("#check_overwrite_responsible_party").is(":checked")) {
 					$('#label_responsible_party_name').css('display', 'block');
 					$('#responsible_party_name').css('display', 'block');
@@ -236,7 +240,10 @@
             req.send();
 	}
 	}	
+        this.fillSelectGroup = function(obj) {
 
+            $('#fkey_mb_group_id option[value="'+obj+'"]').attr('selected', \
'selected'); +        }
 	//Show more information about the licences of the metadata 
 	this.fillLicence = function(obj) {
 		// get licence information from server per termsofuse_id

_______________________________________________
Mapbender_commits mailing list
Mapbender_commits@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapbender_commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic