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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 12 06:03:57 EDT 2010


Author: christoph
Date: 2010-05-12 06:03:53 -0400 (Wed, 12 May 2010)
New Revision: 6194

Modified:
   trunk/mapbender/http/plugins/mb_metadata_edit.js
   trunk/mapbender/http/plugins/mb_metadata_edit.php
   trunk/mapbender/http/plugins/mb_metadata_layer.js
   trunk/mapbender/http/plugins/mb_metadata_layer.php
   trunk/mapbender/http/plugins/mb_metadata_layerPreview.js
   trunk/mapbender/http/plugins/mb_metadata_server.php
Log:


Modified: trunk/mapbender/http/plugins/mb_metadata_edit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.js	2010-05-12 09:48:02 UTC (rev 6193)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.js	2010-05-12 10:03:53 UTC (rev 6194)
@@ -96,10 +96,6 @@
 		});
 	};
 	
-	var validate = function () {
-		return false;
-	};
-	
 	this.init = function (obj) {
 	
 		wmsId = obj;
@@ -112,7 +108,11 @@
 				$metadataForm.find(".original-metadata-wms").bind("click", function() {
 					showOriginalMetadata();
 				});				
-				validator = $metadataForm.validate();
+				validator = $metadataForm.validate({
+					submitHandler: function () {
+						return false;
+					}
+				});
 				if (formData !== undefined) {
 					fillForm(obj, formData);
 				}
@@ -126,8 +126,6 @@
 		fillForm(obj);
 	};
 	
-	$metadataForm.bind("submit", validate);
-
 	Mapbender.events.localize.register(function () {
 		that.valid();
 		var formData = $metadataForm.easyform("serialize");

Modified: trunk/mapbender/http/plugins/mb_metadata_edit.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.php	2010-05-12 09:48:02 UTC (rev 6193)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.php	2010-05-12 10:03:53 UTC (rev 6194)
@@ -72,7 +72,7 @@
     	<input name="contactvoicetelephone" id="contactvoicetelephone"/>
 	</p>
 	<p>
-		<label for="contactfacsimiletelephone"><?php echo _mb("");?>Contact Phone Fax (OWS):</label>
+		<label for="contactfacsimiletelephone"><?php echo _mb("Contact Phone Fax (OWS)");?>:</label>
     	<input name="contactfacsimiletelephone" id="contactfacsimiletelephone"/>
 	</p>
 	<p>

Modified: trunk/mapbender/http/plugins/mb_metadata_layer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.js	2010-05-12 09:48:02 UTC (rev 6193)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.js	2010-05-12 10:03:53 UTC (rev 6194)
@@ -28,10 +28,20 @@
 	var formReady = false;
 	var wmsId;
 	var layerId;
+	
+	var disabledFields = [
+		"layer_custom_category_id", 
+		"layer_inspire_category_id", 
+		"layer_md_topic_category_id", 
+		"layer_keyword", 
+		"layer_abstract", 
+		"layer_title"
+	];
 
 	this.events = {
 		initialized: new Mapbender.Event(),
-		submit: new Mapbender.Event()
+		submit: new Mapbender.Event(),
+		showOriginalLayerMetadata : new Mapbender.Event()
 	};
 		
 	this.valid = function () {
@@ -57,7 +67,13 @@
 	};
 
 	this.fillForm = function (obj) {
+		$(disabledFields).each(function () {
+			$("#" + this).removeAttr("disabled");
+		});
+
 		layerId = obj.layer_id;
+
+		$metadataForm.easyform("reset");
 		
 		// get metadata from server
 		var req = new Mapbender.Ajax.Request({
@@ -70,7 +86,6 @@
 				if (!result) {
 					return;
 				}
-				$metadataForm.easyform("reset");
 				$metadataForm.easyform("fill", obj);
 				that.valid();
 			}
@@ -78,11 +93,22 @@
 		req.send();		
 	};
 	
-	var validate = function () {
-		return false;
+	this.fill = function (obj) {
+		$metadataForm.easyform("fill", obj);
 	};
 	
+	var showOriginalLayerMetadata = function () {
+		that.events.showOriginalLayerMetadata.trigger({
+			data : {
+				wmsId : wmsId,
+				layerData : $metadataForm.easyform("serialize")
+			}
+		});
+	};
+	
+
 	this.init = function (obj) {
+		delete layerId;
 		$metadataForm.easyform("reset");
 
 		wmsId = obj;
@@ -91,8 +117,18 @@
 
 		if (!formReady) {
 			$metadataForm.load("../plugins/mb_metadata_layer.php", function () {
-				validator = $metadataForm.validate();
+				$metadataForm.find(".help-dialog").helpDialog();
 
+				$metadataForm.find(".original-metadata-layer").bind("click", function() {
+					showOriginalLayerMetadata();
+				});	
+
+				validator = $metadataForm.validate({
+					submitHandler: function () {
+						return false;
+					}
+				});
+
 				that.events.initialized.trigger({
 					wmsId: wmsId
 				});
@@ -104,13 +140,14 @@
 			});
 			return;
 		}
+		$(disabledFields).each(function () {
+			$("#" + this).attr("disabled", "disabled");
+		});
 		that.events.initialized.trigger({
 			wmsId: wmsId
 		});
 	};
 	
-	$metadataForm.bind("submit", validate);
-
 	Mapbender.events.localize.register(function () {
 		that.valid();
 		var formData = $metadataForm.easyform("serialize");

Modified: trunk/mapbender/http/plugins/mb_metadata_layer.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.php	2010-05-12 09:48:02 UTC (rev 6193)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.php	2010-05-12 10:03:53 UTC (rev 6194)
@@ -43,17 +43,17 @@
 		<p>
 	    	<label for="layer_title"><?php echo _mb("Layer Title (WMS)");?>:</label>
 			<img class="metadata_img" title="<?php echo _mb("Inspire");?>" src="../img/misc/inspire_eu_klein.png"></img>
-	    	<input name="layer_title" id="layer_title" class="required" />
+	    	<input disabled="disabled" name="layer_title" id="layer_title" class="required" />
 		</p>
 		<p>
 	    	<label for="layer_abstract"><?php echo _mb("Layer Abstract (WMS)");?>:</label>
 			<img class="metadata_img" title="<?php echo _mb("Inspire");?>" src="../img/misc/inspire_eu_klein.png"></img>
-	    	<input name="layer_abstract" id="layer_abstract"/>
+	    	<input disabled="disabled" name="layer_abstract" id="layer_abstract"/>
 		</p>
 		<p>
 	    	<label for="layer_keyword"><?php echo _mb("Layer Keywords (WMS)");?>:</label>
 			<span class="metadata_span"></span>
-		   	<input name="layer_keyword" id="layer_keyword"/>
+		   	<input disabled="disabled" name="layer_keyword" id="layer_keyword"/>
 		</p>
 		<p>
 		    <div id="buttons">
@@ -95,7 +95,7 @@
 		<p>
 		    <label for="layer_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"></img>
-			<select class="metadata_selectbox" id="layer_md_topic_category_id" name="layer_md_topic_category_id" size="2" multiple="multiple">
+			<select disabled="disabled" class="metadata_selectbox" id="layer_md_topic_category_id" name="layer_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);
@@ -105,7 +105,7 @@
 		<p>
 		    <label for="layer_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"></img>
-			<select class="metadata_selectbox" id="layer_inspire_category_id" name="layer_inspire_category_id" size="2" multiple="multiple">
+			<select disabled="disabled" class="metadata_selectbox" id="layer_inspire_category_id" name="layer_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);
@@ -115,7 +115,7 @@
 		<p>
 		    <label for="layer_custom_category_id" class="label_classification"><?php echo _mb("Custom Category");?>:</label>
 			<span class="metadata_span"></span>
-			<select class="metadata_selectbox" id="layer_custom_category_id" name="layer_custom_category_id" size="2" multiple="multiple">
+			<select disabled="disabled" class="metadata_selectbox" id="layer_custom_category_id" name="layer_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);

Modified: trunk/mapbender/http/plugins/mb_metadata_layerPreview.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layerPreview.js	2010-05-12 09:48:02 UTC (rev 6193)
+++ trunk/mapbender/http/plugins/mb_metadata_layerPreview.js	2010-05-12 10:03:53 UTC (rev 6194)
@@ -16,7 +16,6 @@
 		var len = layer.layer_epsg.length;
 		if (len === 0) {
 			// could not zoom to extent
-//			console.log("Could not zoom to extent");
 			return;
 		}
 		for (var j = 0;  j < len; j++) {
@@ -29,7 +28,6 @@
 					currentEpsg.maxy
 				);
 				map.calculateExtent(newExtent);
-//				console.log("Zooming to " + newExtent.toString());
 				return;
 			}
 		}
@@ -45,7 +43,6 @@
 			srs: newEpsg.epsg,
 			extent: newExtent
 		});
-//		console.log("Changing SRS to " + newEpsg.epsg + " and zooming to " + newExtent.toString());
 	};
 
 	// enable layer,. disabling all others

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2010-05-12 09:48:02 UTC (rev 6193)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2010-05-12 10:03:53 UTC (rev 6194)
@@ -362,7 +362,6 @@
 					) {
 						if (!is_array($value)) {
 							$layer->$c = array($value);
-							$firephp->log($layer->$c);
 						}
 						else {
 							$layer->$c = $value;
@@ -374,7 +373,6 @@
 						}
 					}
 				}
-				$firephp->log($layer);
 			}
 		}
 



More information about the Mapbender_commits mailing list