[Mapbender-commits] r7793 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 4 12:39:57 EDT 2011


Author: armin11
Date: 2011-05-04 09:39:57 -0700 (Wed, 04 May 2011)
New Revision: 7793

Modified:
   trunk/mapbender/http/plugins/mb_metadata_addon.php
   trunk/mapbender/http/plugins/mb_metadata_server.php
   trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
Log:
Some fixes for metadataurl handling and new option to decide if metadatalink should be harvested.

Modified: trunk/mapbender/http/plugins/mb_metadata_addon.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_addon.php	2011-05-04 07:32:07 UTC (rev 7792)
+++ trunk/mapbender/http/plugins/mb_metadata_addon.php	2011-05-04 16:39:57 UTC (rev 7793)
@@ -5,15 +5,20 @@
 	<fieldset id="addonChooser" name="addonChooser" style="display: none">
 		<legend><?php echo _mb("Choose kind of coupled metadata");?></legend>
 		<p>
-			<input class="typeRadio" type="radio" name="kindOfMetadataAddOn" id="kindOfMetadataAddOn_link" value="link" ><?php echo _mb("Add URL to existing Metadataset");?><br>
-			<input class="typeRadio" type="radio" name="kindOfMetadataAddOn" id="kindOfMetadataAddOn_metadataset" value="metadataset" ><?php echo _mb("Add a simple metadata record which is mostly generated from given layer information");?><br>
+			<table><tr><td><img src='../img/osgeo_graphics/geosilk/link.png' title='linkage' onclick='$("#addonChooser").css("display","none");$("#link_editor").css("display","block");' /></td><td><?php echo _mb("Add URL to existing Metadataset");?></td></tr>
+			<tr><td><img src='../img/gnome/edit-select-all.png' title='metadata'  onclick='$("#addonChooser").css("display","none");$("#simple_metadata_editor").css("display","block");' /></td><td><?php echo _mb("Add a simple metadata record which is mostly generated from given layer information");?></td></tr>
+			</table>
 		</p>
 	</fieldset>
 	<!--fieldset for save link form-->
 	<fieldset id="link_editor" name="link_editor" type="hidden" style="display: none">
 		<legend><?php echo _mb("Link Editor");?></legend>
-		<input disabled="disabled" name="link" id="link" />
-		<img class="save_link" src="../img/book.png" alt="" />
+		<input name="link" id="link" />
+		<p>
+			<label for="export2csw"><?php echo _mb("Harvest link target and export to CSW");?></label>
+      			<input name="export2csw" id="export2csw" type="checkbox" checked="checked"/>
+		</p>
+		
 	</fieldset>
 	<!--fieldset for metadata form-->
 	<fieldset id="simple_metadata_editor" name="simple_metadata_editor" type="hidden"  style="display: none">

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2011-05-04 07:32:07 UTC (rev 7792)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2011-05-04 16:39:57 UTC (rev 7793)
@@ -576,7 +576,20 @@
 			$resultObj["title"] = $row["title"];
 			$resultObj["abstract"] = $row["abstract"];
 			$resultObj["format"] = $row["format"];
-			$resultObj["ref_system"] = $row["ref_system"];	
+			$resultObj["ref_system"] = $row["ref_system"];			
+			$export2csw = $row["export2csw"];
+			$e = new mb_exception($export2csw);
+			switch ($export2csw) {
+				case "t" :
+					$resultObj["export2csw"] = true;
+					break;
+				case "f" :
+					$resultObj["export2csw"] = false;
+					break;
+				default:
+				break;	
+			}					
+			
 		}
 		$ajaxResponse->setResult($resultObj);
 		$ajaxResponse->setSuccess(true);
@@ -585,13 +598,23 @@
 		$layerId = $ajaxResponse->getParameter("layerId");
 		$metadataId = $ajaxResponse->getParameter("metadataId");
 		$data = $ajaxResponse->getParameter("data");
+		if ($data->export2csw) {
+			$data->export2csw = 't';
+		} else {
+			$data->export2csw = 'f';
+		}
+		//$e = new mb_exception("update: ":$data->export2csw);	
+
+
+
+
 		$sql = <<<SQL
 
-UPDATE mb_metadata SET link = $2, title = $3, abstract = $4, format = $5, ref_system = $6 WHERE metadata_id = $1
+UPDATE mb_metadata SET link = $2, title = $3, abstract = $4, format = $5, ref_system = $6, export2csw = $7 WHERE metadata_id = $1
 
 SQL;
-		$v = array($metadataId, $data->link, $data->title, $data->abstract, $data->format, $data->ref_system);
-		$t = array('i','s','s','s','s','s');
+		$v = array($metadataId, $data->link, $data->title, $data->abstract, $data->format, $data->ref_system, $data->export2csw);
+		$t = array('i','s','s','s','s','s','b');
 		try {
 			$res = db_prep_query($sql,$v,$t);
 		}
@@ -618,6 +641,13 @@
 		} else {
 			$origin = 'metador';
 		}
+		//export
+		if ($data->export2csw == "on") {
+			$data->export2csw = 't';
+		} else {
+			$data->export2csw = 'f';
+		}
+
 		//generate a uuid for the record:
 		$uuid = new Uuid();
 
@@ -627,11 +657,15 @@
 		$abstract = '';
 		$format = '';	
 		$ref_system = '';
+		$export2csw = false;
 
 		//read out json objects 
 		if (isset($data->link)) {
 			$link = $data->link;
 		}
+		if (isset($data->export2csw)) {
+			$export2csw= $data->export2csw;
+		}
 		if (isset($data->title)) {
 			$title = $data->title;
 		}
@@ -646,11 +680,11 @@
 		}
 		$sql = <<<SQL
 
-INSERT INTO mb_metadata (link, uuid, origin, title, abstract, format, ref_system) VALUES ($1, $2, $3, $4, $5, $6, $7)
+INSERT INTO mb_metadata (link, uuid, origin, title, abstract, format, ref_system, export2csw) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
 
 SQL;
-		$v = array($link, $uuid, $origin, $title, $abstract, $format, $ref_system);
-		$t = array('s','s','s','s','s','s','s');
+		$v = array($link, $uuid, $origin, $title, $abstract, $format, $ref_system, $export2csw);
+		$t = array('s','s','s','s','s','s','s','b');
 		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-05-04 07:32:07 UTC (rev 7792)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js	2011-05-04 16:39:57 UTC (rev 7793)
@@ -183,11 +183,9 @@
 				}
 			},
 			close: function() {
-				//$(".differentFromOriginal").removeClass("differentFromOriginal");
 			}
 		});
 		$metadataAddonPopup.dialog("open");
-		
 	};
 	
 	this.init = function (metadataId, layerId, isNew) {
@@ -196,45 +194,19 @@
 			//first get json
 			if (!isNew) {
 				that.getAddedMetadata(metadataId, layerId);
+			
 			} else {
-				//show empty form
-				
 				//show chooser
-				$("#link").removeAttr("disabled");
 				$("#metadataUrlEditor").css("display","block"); 
 				$("#addonChooser").css("display","block");
-				
-				$(":input[@name='kindOfMetadataAddOn']").click(function(){
-    					if ($(":input[@name='kindOfMetadataAddOn']:checked").val() == 'link') {
-        					$("#addonChooser").css("display","none");
-						$("#link_editor").css("display","block");
-					}
-    					else if ($(":input[@name='kindOfMetadataAddOn']:checked").val() == 'metadataset') {
-        					$("#addonChooser").css("display","none");
-						$("#simple_metadata_editor").css("display","block");	
-					}
-					else {}
-						//do nothing
-				});
-
-
-				//bind function onchange on select radio button
-				//$("#metadataUrlEditor").css("display","block");
-				//$("#link_editor").css("display","block");
 			}
 			that.showForm(metadataId, layerId, isNew);
-			//$("#metadataUrlEditor").css("display","block"); 
-			//$("#link_editor").css("display","block");
-			//get layerId, metadataId - from call!
-			//getAddedMetadata(layerId, metadataId);
 		});
 	}
 	initMetadataAddon = function(metadataId, layerId, isNew) {
 		//close old window and load form
 		that.init(metadataId, layerId, isNew);	
 		//fill form
-		
-		
 	}
 };
 



More information about the Mapbender_commits mailing list