[Mapbender-commits] r7848 - in trunk/mapbender: http/php http/plugins resources/db/pgsql/UTF-8/update resources/locale/de_DE/LC_MESSAGES

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jun 9 06:47:08 EDT 2011


Author: armin11
Date: 2011-06-09 03:47:08 -0700 (Thu, 09 Jun 2011)
New Revision: 7848

Modified:
   trunk/mapbender/http/php/mod_dataISOMetadata.php
   trunk/mapbender/http/plugins/mb_metadata_addon.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.1_to_2.7.2_pgsql_UTF-8.sql
   trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
Log:
Extension for the wms metadata editor to allow the defintion of cyclic updates for the underlying datasets. The end time for the temporal extent is calculated dynamically.

Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php	2011-06-09 07:52:31 UTC (rev 7847)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php	2011-06-09 10:47:08 UTC (rev 7848)
@@ -407,8 +407,8 @@
 	$CI_Citation->appendChild($title);
 
 	#Create date elements B5.2-5.4
-	#Do things for B 5.2 date of publication
-	if (isset($mapbenderMetadata['wms_timestamp_create'])) {
+	#Do things for B 5.2 date of publication - maybe the date when the first metadata was generated or it should not be available at all
+	if (isset($mb_metadata['createdate'])) {
 		$date1=$iso19139->createElement("gmd:date");
 		$CI_Date=$iso19139->createElement("gmd:CI_Date");
 		$date2=$iso19139->createElement("gmd:date");
@@ -418,7 +418,7 @@
 		$dateTypeCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#CI_DateTypeCode");
 		$dateTypeCode->setAttribute("codeListValue", "publication");
 		$dateTypeCodeText=$iso19139->createTextNode('publication');
-		$dateText= $iso19139->createTextNode($mapbenderMetadata['wms_timestamp_create']);
+		$dateText= $iso19139->createTextNode($mb_metadata['createdate']);
 		$dateTypeCode->appendChild($dateTypeCodeText);
 		$dateType->appendChild($dateTypeCode);
 		$gcoDate->appendChild($dateText);
@@ -429,7 +429,59 @@
 		$CI_Citation->appendChild($date1);
 	}
 	#Do things for B 5.3 date of revision
-	if (isset($mb_metadata['createdate'])) {
+	//this should be created from the information of maintenance if available
+	//some initialization for the temporal extent:
+	$beginPositionValue = $mb_metadata['tmp_reference_1'];
+	$endPositionValue = $mb_metadata['tmp_reference_2'];
+	$dateOfLastRevision = date('c');
+
+	if (isset($mb_metadata['update_frequency']) && $mb_metadata['update_frequency'] != "") {
+		switch ($mb_metadata['update_frequency']) {
+			case ('continual'):
+				//set value to now
+				$endPositionValue = $letztermonat  = date('c',time());
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('daily'):
+				//set value to now - one day
+				$endPositionValue = date('c', mktime(0, 0, 0, date("m"), date("d")-1,   date("Y")));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('weekly'):
+				//set value to now - one week
+				$endPositionValue = date('Y-m-d h:i:s', mktime(0, 0, 0, date("m"), date("d")-7,   date("Y")));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('fortnightly'):
+				//set value to now - two weeks
+				$endPositionValue = date('c', mktime(0, 0, 0, date("m"), date("d")-14,   date("Y")));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('monthly'):
+				//set value to now - one month
+				$endPositionValue =  date('c', mktime(0, 0, 0, date("m")-1, date("d"),   date("Y")));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('quarterly'):
+				//set value to now - 3 months
+				$endPositionValue = date('c', mktime(0, 0, 0, date("m")-3, date("d"),   date("Y")));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('biannually'):
+				//set value to now - half a year
+				$endPositionValue = date('c', mktime(0, 0, 0, date("m")-6, date("d"),   date("Y")));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			case ('annually'):
+				//set value to now - one year
+				$endPositionValue = date('c', mktime(0, 0, 0, date("m"), date("d"),   date("Y")-1));
+				$dateOfLastRevision = $endPositionValue;
+			break;
+			default:
+			break;
+		}
+	
+
 		$date1=$iso19139->createElement("gmd:date");
 		$CI_Date=$iso19139->createElement("gmd:CI_Date");
 		$date2=$iso19139->createElement("gmd:date");
@@ -439,7 +491,7 @@
 		$dateTypeCode->setAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#CI_DateTypeCode");
 		$dateTypeCode->setAttribute("codeListValue", "revision");
 		$dateTypeCodeText=$iso19139->createTextNode('revision');
-		$dateText= $iso19139->createTextNode($mb_metadata['createdate']);
+		$dateText= $iso19139->createTextNode($dateOfLastRevision);
 		$dateTypeCode->appendChild($dateTypeCodeText);
 		$dateType->appendChild($dateTypeCode);
 		$gcoDate->appendChild($dateText);
@@ -449,7 +501,8 @@
 		$date1->appendChild($CI_Date);
 		$CI_Citation->appendChild($date1);
 	}
-	#Do things for B 5.4 date of creation
+
+/*	#Do things for B 5.4 date of creation not applicable cause it cannot be edited
 	if (isset($mb_metadata['changedate']) || isset($mb_metadata['lastchanged'])) {
 		$date1=$iso19139->createElement("gmd:date");
 		$CI_Date=$iso19139->createElement("gmd:CI_Date");
@@ -474,6 +527,7 @@
 		$date1->appendChild($CI_Date);
 		$CI_Citation->appendChild($date1);
 	}
+*/
 	#Do things for B 1.5 Resource unique identifier NOTE: not applicable for services
 //example from INSPIRE Guidance Metadata 
 //The main problem will be, that this entry is the identifier for the service data coupling 
@@ -564,7 +618,29 @@
 	$CI_ResponsibleParty->appendChild($role);
 	$pointOfContact->appendChild($CI_ResponsibleParty);
 	$MD_DataIdentification->appendChild($pointOfContact);
-
+	//Part for maintenance if given
+	/* example
+<gmd:resourceMaintenance>
+	<gmd:MD_MaintenanceInformation>
+		<gmd:maintenanceAndUpdateFrequency>
+			<gmd:MD_MaintenanceFrequencyCode codeListValue="asNeeded" codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_MaintenanceFrequencyCode"/>
+		</gmd:maintenanceAndUpdateFrequency>
+	</gmd:MD_MaintenanceInformation>
+</gmd:resourceMaintenance>
+*/
+	if (isset($mb_metadata['update_frequency']) && $mb_metadata['update_frequency'] != "") {
+		$resourceMaintenance=$iso19139->createElement("gmd:resourceMaintenance");
+		$MD_MaintenanceInformation=$iso19139->createElement("gmd:MD_MaintenanceInformation");
+		$maintenanceAndUpdateFrequency=$iso19139->createElement("gmd:maintenanceAndUpdateFrequency");
+		$MD_MaintenanceFrequencyCode=$iso19139->createElement("gmd:MD_MaintenanceFrequencyCode");
+		$MD_MaintenanceFrequencyCode->setAttribute("codeListValue", $mb_metadata['update_frequency']);
+		$MD_MaintenanceFrequencyCode->setAttribute("codeList", "http://www.isotc211.org/2005/resources/codeList.xml#MD_MaintenanceFrequencyCode");
+		$maintenanceAndUpdateFrequency->appendChild($MD_MaintenanceFrequencyCode);
+		$MD_MaintenanceInformation->appendChild($maintenanceAndUpdateFrequency);
+		$resourceMaintenance->appendChild($MD_MaintenanceInformation);
+		$MD_DataIdentification->appendChild($resourceMaintenance);
+		
+	}
 	//generate keyword part - for services the inspire themes are not applicable!!!**********
 	//read keywords for resource out of the database:
 	$sql = "SELECT keyword.keyword FROM keyword, layer_keyword WHERE layer_keyword.fkey_layer_id=$1 AND layer_keyword.fkey_keyword_id=keyword.keyword_id";
@@ -854,7 +930,52 @@
 	$extent->appendChild($EX_Extent);
 
 	$MD_DataIdentification->appendChild($extent);
+	//generate temporal extent from begin and end positions
+	/*
+<gmd:extent>
+<gmd:EX_Extent>
+<gmd:temporalElement>
+<gmd:EX_TemporalExtent>
+<gmd:extent>
+<gml:TimePeriod gml:id="extent">
+<gml:beginPosition>1977-03-
+10T11:45:30</gml:beginPosition>
+<gml:endPosition>2005-01-
+15T09:10:00</gml:endPosition>
+</gml:TimePeriod>
+</gmd:extent>
+</gmd:EX_TemporalExtent>
+</gmd:temporalElement>
+</gmd:EX_Extent>
+</gmd:extent>
+*/
+	//check if maintenance is set and adopt the last time - both times are always set, cause the editor demands this!!!!
 
+	$extent=$iso19139->createElement("gmd:extent");
+	$EX_Extent=$iso19139->createElement("gmd:EX_Extent");
+	$temporalElement=$iso19139->createElement("gmd:temporalElement");
+	$EX_TemporalExtent=$iso19139->createElement("gmd:EX_TemporalExtent");
+	$extent2=$iso19139->createElement("gmd:extent");
+	$TimePeriod=$iso19139->createElement("gml:TimePeriod");
+	$TimePeriod->setAttribute("gml:id", "temporalextent"); //maybe exchange thru uuid?
+	$beginPosition=$iso19139->createElement("gml:beginPosition");
+	$beginPositionText=$iso19139->createTextNode($beginPositionValue);
+	$endPosition=$iso19139->createElement("gml:endPosition");
+	$endPositionText=$iso19139->createTextNode($endPositionValue);
+	//generate xml
+
+	$endPosition->appendChild($endPositionText);
+	$beginPosition->appendChild($beginPositionText);
+	$TimePeriod->appendChild($beginPosition);
+	$TimePeriod->appendChild($endPosition);
+	$extent2->appendChild($TimePeriod);
+	$EX_TemporalExtent->appendChild($extent2);
+	$temporalElement->appendChild($EX_TemporalExtent);
+	$EX_Extent->appendChild($temporalElement);
+	$extent->appendChild($EX_Extent);
+	$MD_DataIdentification->appendChild($extent);
+
+
 	$identificationInfo->appendChild($MD_DataIdentification);
 
 //distributionInfo

Modified: trunk/mapbender/http/plugins/mb_metadata_addon.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_addon.php	2011-06-09 07:52:31 UTC (rev 7847)
+++ trunk/mapbender/http/plugins/mb_metadata_addon.php	2011-06-09 10:47:08 UTC (rev 7848)
@@ -51,20 +51,24 @@
 				<label for=""><?php echo _mb("to");?>:</label>
 				<input class="required hasdatepicker" name="tmp_reference_2" id="tmp_reference_2"/>
 		</fieldset>
-		<fieldset id="cyclicupdate" name="cyclicupdate" style="display: none">
-			<p>
-				<label></label>
-				<input type="checkbox" name="" value=""> <?php echo _mb("Cycling Update");?>
-			</p>
-			<p>	
-				<label></label>
-				<select class="metadata_selectbox" size="2" multiple>
-					<option><?php echo _mb("directly");?></option>
-					<option><?php echo _mb("daily");?></option>
-					<option><?php echo _mb("weekly");?></option>
-					<option><?php echo _mb("yearly");?></option>
+		<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="cyclic_selectbox" id='update_frequency' name='update_frequency' size="2">
+<!-- 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>
-			</p>
 		</fieldset>
 	</fieldset>
 	<fieldset id="spatialres">

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2011-06-09 07:52:31 UTC (rev 7847)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2011-06-09 10:47:08 UTC (rev 7848)
@@ -584,6 +584,7 @@
 			$resultObj["tmp_reference_1"] = $row["tmp_reference_1"]; //text
 			$resultObj["tmp_reference_2"] = $row["tmp_reference_2"]; //text
 			$export2csw = $row["export2csw"]; //boolean
+			$resultObj["update_frequency"] = $row["update_frequency"]; //text
 			switch ($export2csw) {
 				case "t" :
 					$resultObj["export2csw"] = true;
@@ -626,11 +627,11 @@
 		}
 		$sql = <<<SQL
 
-UPDATE mb_metadata SET link = $2, title = $3, abstract = $4, format = $5, ref_system = $6, export2csw = $7, inspire_top_consistence = $8, tmp_reference_1 = $9, tmp_reference_2 = $10, lineage = $11, spatial_res_type = $12, spatial_res_value = $13, inspire_charset = $14, changedate = now() WHERE metadata_id = $1
+UPDATE mb_metadata SET link = $2, title = $3, abstract = $4, format = $5, ref_system = $6, export2csw = $7, inspire_top_consistence = $8, tmp_reference_1 = $9, tmp_reference_2 = $10, lineage = $11, spatial_res_type = $12, spatial_res_value = $13, inspire_charset = $14, changedate = now(), update_frequency = $15 WHERE metadata_id = $1
 
 SQL;
-		$v = array($metadataId, $data->link, $data->title, $data->abstract, $data->format, $data->ref_system, $data->export2csw, $data->inspire_top_consistence, $data->tmp_reference_1, $data->tmp_reference_2, $data->lineage, $data->spatial_res_type, $data->spatial_res_value, $data->inspire_charset);
-		$t = array('i','s','s','s','s','s','b','b','s','s','s','s','s','s');
+		$v = array($metadataId, $data->link, $data->title, $data->abstract, $data->format, $data->ref_system, $data->export2csw, $data->inspire_top_consistence, $data->tmp_reference_1, $data->tmp_reference_2, $data->lineage, $data->spatial_res_type, $data->spatial_res_value, $data->inspire_charset, $data->update_frequency);
+		$t = array('i','s','s','s','s','s','b','b','s','s','s','s','s','s','s');
 		try {
 			$res = db_prep_query($sql,$v,$t);
 		}
@@ -685,6 +686,7 @@
 		$spatial_res_type = '';
 		$spatial_res_value = '';
 		$inspire_charset = '';
+		$update_frequency = '';
 		//read out json objects 
 		if (isset($data->link)) {
 			$link = $data->link;
@@ -733,6 +735,9 @@
 		if (isset($data->inspire_charset)) {
 			$inspire_charset = $data->inspire_charset;
 		}
+		if (isset($data->update_frequency)) {
+			$update_frequency = $data->update_frequency;
+		}
 		$randomid = new Uuid();
 		//Check if origin is external and export2csw is activated!
 		if ($origin == 'external' && $export2csw == 't' ) {
@@ -818,14 +823,14 @@
 			} else {
 				//give back error message - cause parsing has problems
 			}
-		} else { //fill only links into db do not ry to load data
+		} else { //fill only links into db - do not try to load data
 			$sql = <<<SQL
 
-INSERT INTO mb_metadata (link, uuid, origin, title, abstract, format, ref_system, export2csw, inspire_top_consistence, tmp_reference_1, tmp_reference_2, lineage, spatial_res_type, spatial_res_value, inspire_charset, createdate, randomid) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, now(), $16)
+INSERT INTO mb_metadata (link, uuid, origin, title, abstract, format, ref_system, export2csw, inspire_top_consistence, tmp_reference_1, tmp_reference_2, lineage, spatial_res_type, spatial_res_value, inspire_charset, createdate, randomid, update_frequency) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, now(), $16, $17)
 
 SQL;
-			$v = array($link, $uuid, $origin, $title, $abstract, $format, $ref_system, $export2csw,$inspire_top_consistence,$tmp_reference_1,$tmp_reference_2,$lineage,$spatial_res_type,$spatial_res_value,$inspire_charset, $randomid);
-			$t = array('s','s','s','s','s','s','s','b','b','s','s','s','s','s','s','s');
+			$v = array($link, $uuid, $origin, $title, $abstract, $format, $ref_system, $export2csw,$inspire_top_consistence,$tmp_reference_1,$tmp_reference_2,$lineage,$spatial_res_type,$spatial_res_value,$inspire_charset, $randomid, $update_frequency);
+			$t = array('s','s','s','s','s','s','s','b','b','s','s','s','s','s','s','s','s');
 		
 			try {
 				$res = db_prep_query($sql,$v,$t);

Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js	2011-06-09 07:52:31 UTC (rev 7847)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js	2011-06-09 10:47:08 UTC (rev 7848)
@@ -56,6 +56,7 @@
 				//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);
 				$(".radioRes").filter('[value='+obj.spatial_res_type+']').attr('checked', true);
 
 			}

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql	2011-06-09 07:52:31 UTC (rev 7847)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql	2011-06-09 10:47:08 UTC (rev 7848)
@@ -22,3 +22,9 @@
 -- replace too many ' in definition
 UPDATE gui_element set e_attributes = replace(e_attributes,'''"','"') where e_id IN ('updateWMSs','owsproxy','editGUI_WMS');
 
+--add possibility to edit cyclic update in inspire metadata addon editor (admin_wms_metadata):
+-- Column: update_frequency
+
+-- ALTER TABLE mb_metadata DROP COLUMN update_frequency;
+
+ALTER TABLE mb_metadata ADD COLUMN update_frequency character varying(100);

Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-06-09 07:52:31 UTC (rev 7847)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-06-09 10:47:08 UTC (rev 7848)
@@ -2439,3 +2439,48 @@
 msgid "to"
 msgstr "bis"
 
+msgid "Maintenance and update frequency"
+msgstr ""
+
+msgid "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!"
+msgstr "Intervall in dem Änderungen und Anpassungen an der Ressource erfolgen nach dem diese erstmalig erstellt wurde. Hinweis: Eine Auswahl eines regelmäßigen Aktualisierungsintervalls ändert den Endzeitpunkt der zeitlichen Ausdehnung. Der Endzeitpunkt wird dann immer anhand des aktuellen Datums berechnet. Da die Metadaten dynamisch erzeugt werden, muss man sie nicht mehr händisch anpassen."
+
+msgid "continual"
+msgstr "kontinuierlich"
+
+msgid "daily"
+msgstr "täglich"
+
+msgid "weekly"
+msgstr "wöchentlich"
+
+msgid "fortnightly"
+msgstr "zweiwöchentlich"
+
+msgid "monthly"
+msgstr "monatlich"
+
+msgid "quarterly"
+msgstr "vierteljährlich"
+
+
+msgid "biannually"
+msgstr "halbjährlich"
+
+msgid "annually"
+msgstr "jährlich"
+
+
+msgid "as needed"
+msgstr "nach Bedarf"
+
+msgid "irregular"
+msgstr "unregelmäßig"
+
+
+msgid "not planned"
+msgstr "nicht geplant"
+
+msgid "unknown"
+msgstr "unbekannt"
+



More information about the Mapbender_commits mailing list