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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 8 03:18:22 PDT 2014


Author: armin11
Date: 2014-08-08 03:18:21 -0700 (Fri, 08 Aug 2014)
New Revision: 9037

Modified:
   trunk/mapbender/http/plugins/mb_metadata_addon.php
   trunk/mapbender/http/plugins/mb_metadata_gml_import.js
   trunk/mapbender/http/plugins/mb_metadata_server.php
   trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
Log:
Possibility to delete polygon in mb_metadata via metadata editor

Modified: trunk/mapbender/http/plugins/mb_metadata_addon.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_addon.php	2014-08-07 13:06:08 UTC (rev 9036)
+++ trunk/mapbender/http/plugins/mb_metadata_addon.php	2014-08-08 10:18:21 UTC (rev 9037)
@@ -230,7 +230,7 @@
 		</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="" /></td></tr></table>
+			<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="alert('test');" 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>

Modified: trunk/mapbender/http/plugins/mb_metadata_gml_import.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_gml_import.js	2014-08-07 13:06:08 UTC (rev 9036)
+++ trunk/mapbender/http/plugins/mb_metadata_gml_import.js	2014-08-08 10:18:21 UTC (rev 9037)
@@ -35,7 +35,7 @@
 				alert(message);
 				$gmlImport.dialog("close");
 				//alter the url to the overview image to force reload!
-				alert($("#extent_preview").attr('src'));
+				//alert($("#extent_preview").attr('src'));
 				$("#extent_preview").attr('src',$("#extent_preview").attr('src')+"&imagetime="+ new Date().getTime());
 				//invoke external script from mb_metadata_showMetadataAddon.js
 				//that.fillLayerForm(layerId);

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2014-08-07 13:06:08 UTC (rev 9036)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2014-08-08 10:18:21 UTC (rev 9037)
@@ -799,6 +799,13 @@
 			$resultObj["overview_url"] = $mbMetadata->getExtentGraphic($mbMetadata->wgs84Bbox);
 			$export2csw = $mbMetadata->export2Csw; //boolean
 			$resultObj["update_frequency"] = $mbMetadata->updateFrequency; //text
+			//check for existing polygon
+			if (count($mbMetadata->polygonalExtentExterior) > 2) {	
+				$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;
@@ -1231,14 +1238,15 @@
 		//push multipolygon into database
 		
 	break;
-	case "deleteSurroundingGeom" :
+	case "deleteGmlPolygon" :
 		$metadataId = $ajaxResponse->getParameter("metadataId");
+		$e = new mb_exception("metadataId: ".$metadataId);
 		$sql = <<<SQL
 UPDATE mb_metadata SET bounding_geom = NULL WHERE metadata_id = $1			
 SQL;
 		$v = array($metadataId);
 		//$e = new mb_exception($metadataId);
-		$t = array('i','POLYGON');
+		$t = array('i');
 		$res = db_prep_query($sql,$v,$t);
 		if (!$res) {
 			abort(_mb("Problem while deleting geometry from database!"));

Modified: trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js	2014-08-07 13:06:08 UTC (rev 9036)
+++ trunk/mapbender/http/plugins/mb_metadata_showMetadataAddon.js	2014-08-08 10:18:21 UTC (rev 9037)
@@ -132,6 +132,12 @@
 				$(".cyclic_selectbox").val(obj.update_frequency);
 				$("#extent_preview").attr('src',obj.overview_url+"&time="+ new Date().getTime());
 				$(".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"); 
+				}
+				
 
 			}
 		});
@@ -227,7 +233,7 @@
 				//fill MetadataURLs into metadata_selectbox_id
 				//update layer form to show edited data
 				that.fillLayerForm(layerId);
-				//alert(wmsId);
+				
 				$("<div></div>").text(message).dialog({
 					modal: true
 				});
@@ -235,7 +241,7 @@
 		});
 		req.send();	
 	}		
-
+	
 	deleteInternalMetadataLinkage = function(metadataId, layerId){
 		// push metadata from server
 		var req = new Mapbender.Ajax.Request({
@@ -255,7 +261,6 @@
 				//fill MetadataURLs into metadata_selectbox_id
 				//update layer form to show edited data
 				that.fillLayerForm(layerId);
-				//alert(wmsId);
 				$("<div></div>").text(message).dialog({
 					modal: true
 				});
@@ -328,6 +333,30 @@
 		//that.fillLayerForm(layerId);
 	}
 
+	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
+				$("#extent_preview").attr('src',obj.overview_url+"&time="+ new Date().getTime());
+				$("<div></div>").text(message).dialog({
+					modal: true
+				});
+			}
+		});
+		req.send();	
+	}			
+
 	this.init = function (metadataId, layerId, isNew) {
 		$metadataAddonPopup.dialog("close");
 		$metadataAddonForm.load("../plugins/mb_metadata_addon.php", function () {
@@ -355,6 +384,9 @@
 			$("#uploadgmlimage").click(function () {
 				initUploadGmlForm(metadataId);
 			});
+			$("#delete_existing_polygon").click(function () {
+				deleteGmlPolygon(metadataId);
+			});
 			//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 });



More information about the Mapbender_commits mailing list