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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Apr 28 09:40:44 EDT 2010


Author: christoph
Date: 2010-04-28 09:40:42 -0400 (Wed, 28 Apr 2010)
New Revision: 6034

Added:
   trunk/mapbender/http/plugins/mb_metadata_layer.html
   trunk/mapbender/http/plugins/mb_metadata_layer.js
   trunk/mapbender/http/plugins/mb_metadata_linkage.html
   trunk/mapbender/http/plugins/mb_metadata_linkage.js
Modified:
   trunk/mapbender/http/plugins/mb_metadata_controller.js
   trunk/mapbender/http/plugins/mb_metadata_edit.js
   trunk/mapbender/http/plugins/mb_metadata_server.php
Log:


Modified: trunk/mapbender/http/plugins/mb_metadata_controller.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_controller.js	2010-04-27 09:46:38 UTC (rev 6033)
+++ trunk/mapbender/http/plugins/mb_metadata_controller.js	2010-04-28 13:40:42 UTC (rev 6034)
@@ -6,17 +6,21 @@
 	var tabsIndex = 0;
 	var selectIndex = 1;
 	var editIndex = 2;
+	var layerIndex = 3;
 
 	var $tabs = options.$target.eq(tabsIndex);
 	var $select = options.$target.eq(selectIndex);
 	var $edit = options.$target.eq(editIndex);
+	var $layer = options.$target.eq(layerIndex);
 	var select = $select.mapbender();
 	var edit = $edit.mapbender();
+	var layer = $layer.mapbender();
 	
 	select.events.selected.register(function (obj) {
 		$select.fadeOut(function () {
 			$tabs.tabs("select", editIndex-1);
 			edit.edit(obj);
+			layer.edit(obj);
 			$select.show();
 		});		
 	});

Modified: trunk/mapbender/http/plugins/mb_metadata_edit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_edit.js	2010-04-27 09:46:38 UTC (rev 6033)
+++ trunk/mapbender/http/plugins/mb_metadata_edit.js	2010-04-28 13:40:42 UTC (rev 6034)
@@ -20,68 +20,46 @@
  */
 
 var $metadataEdit = $(this);
-var $metadataForm = $("<form></form>").appendTo($metadataEdit);
+var $metadataForm = $("<form>No WMS selected.</form>").appendTo($metadataEdit);
 
 var MetadataEditApi = function (o) {
 	var that = this;
 	var validator;
-	var originalMessages = $.extend({}, jQuery.validator.messages);
 	
-	var setLanguage = function (languageCode) {
-		var url = "../extensions/jquery-validate/localization/messages_" + languageCode + ".js";
-		if (!Mapbender.phpjs.file_exists(url)) {
-			jQuery.extend(jQuery.validator.messages, originalMessages);
-			that.valid();
-			return;
-		}
-		$.get(url , function (js) {
-			if (js) {
-				eval(js);
-				that.valid();
-			}
-		});		
-	};
-
 	this.valid = function () {
 		if (validator && validator.numberOfInvalids() > 0) {
 			$metadataForm.valid();
 		}
 	};
 
-	this.init = function () {
+	this.edit = function (obj) {
 		$metadataForm.load("../plugins/mb_metadata_edit.html", function () {
 			validator = $metadataForm.validate();
-		});
-	};
-	
-	this.edit = function (obj) {
-		// empty form
 
-		// get metadata from server
-		var req = new Mapbender.Ajax.Request({
-			url: "../plugins/mb_metadata_server.php",
-			method: "getWmsMetadata",
-			parameters: {
-				"id": obj.wmsId
-			},
-			callback: function (obj, result, message) {
-				if (!result) {
-					return;
+			// get metadata from server
+			var req = new Mapbender.Ajax.Request({
+				url: "../plugins/mb_metadata_server.php",
+				method: "getWmsMetadata",
+				parameters: {
+					"id": obj.wmsId
+				},
+				callback: function (obj, result, message) {
+					if (!result) {
+						return;
+					}
+					$metadataForm.easyform("reset");
+					$metadataForm.easyform("fill", obj);
 				}
-				$metadataForm.easyform("reset");
-				$metadataForm.easyform("fill", obj);
-			}
+			});
+			req.send();		
 		});
-		req.send();		
 	};
 	
-	this.init();
-	
 	Mapbender.events.localize.register(function () {
-		setLanguage(Mapbender.locale.substr(0, 2));
+		that.valid();
 	});
 	Mapbender.events.init.register(function () {
-		setLanguage(Mapbender.locale.substr(0, 2));
+		that.valid();
 	});
 };
 

Added: trunk/mapbender/http/plugins/mb_metadata_layer.html
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.html	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.html	2010-04-28 13:40:42 UTC (rev 6034)
@@ -0,0 +1,125 @@
+<style type="text/css">
+	* {
+		font-family: Verdana;
+		font-size: 96%;
+	}
+
+	label {
+		width: 250px;
+		height: 40px;
+		float: left;
+	}
+
+	p {
+		clear: both;
+	}
+
+	input, textarea {
+		font-weight: bold;
+		vertical-align: top;
+		width: 250px;
+	}
+
+
+	div#choose {
+		float: left;
+		width: 25em;
+	}
+	div#layer {
+		margin-left: 25em;
+	}
+	div#map {
+		float: left;
+		width: 45em;
+	}
+	div#classification {
+		margin-left: 45em;
+	}
+	div#save {
+		margin-left: 45em;
+	}
+</style>
+
+<h1>Layer Level Metadata:</h1>
+
+<div id="choose">
+	choose layer
+</div>
+
+<div id="layer">
+	<fieldset class="">
+		<p>
+			<label for="wms_id">Number of Layer (Registry):</label>
+			<input name="wms_id" id="wms_id"/>
+			?
+		</p>
+		<p>
+		    	<label for="wms_title">Layer Title (WMS):</label>
+			<img src="../img/misc/inspire_eu_klein.png"></img>
+		    	<input name="wms_title" id="wms_title"/>
+		    	<img src=""></img>
+		</p>
+		<p>
+		    	<label for="wms_abstract">Layer Abstract (WMS):</label>
+			<img src="../img/misc/inspire_eu_klein.png"></img>
+		    	<input name="wms_abstract" id="wms_abstract"/>
+		    	<img src=""></img>
+		</p>
+		<p>
+		    	<label for="">Layer Keywords (WMS):</label>
+		    	<input name="" id=""/>
+		    	<img src=""></img>
+			?
+		</p>
+		<p>
+		    	<label for="wms_getcapabilities">Metadata Linkage:</label>
+			<img src=""></img>
+			<img src="../img/misc/inspire_eu_klein.png"></img>
+			<textarea id="wms_getcapabilities" name="wms_getcapabilities"></textarea>
+		    	<img src=""></img>
+			?
+		</p>
+	</fieldset>
+</div>
+
+<div id="map">
+	map
+</div>
+
+<div id="classification">
+	<fieldset class="">
+		<p>
+		    	<label>Classification</label>
+		</p>
+		<p>
+		    	<label for="">ISO Topic Category:</label>
+			<img src="../img/misc/inspire_eu_klein.png"></img>
+		    	<textarea id="" name=""></textarea>
+			?
+		</p>
+		<p>
+		    	<label for="">INSPIRE Category:</label>
+			<img src="../img/misc/inspire_eu_klein.png"></img>
+		    	<textarea id="" name=""></textarea>
+			?
+		</p>
+		<p>
+		    	<label for="">Custom Category:</label>
+		    	<textarea id="" name=""></textarea>
+			?
+		</p>
+	</fieldset>
+</div>
+
+<div id="save">
+	<fieldset class="">
+		<p>
+			<label>Preview Metadata</label>
+			<input class="submit" type="submit" value="Submit"/>
+		</p>
+		<p>
+			<label>Save Metadata</label>
+			<input class="submit" type="submit" value="Submit"/>
+		</p>
+	</fieldset>
+</div>

Added: trunk/mapbender/http/plugins/mb_metadata_layer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.js	2010-04-28 13:40:42 UTC (rev 6034)
@@ -0,0 +1,65 @@
+/**
+ * Package: mb_metadata_edit
+ *
+ * Description:
+ *
+ * Files:
+ *
+ * SQL:
+ * 
+ * Help:
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Christoph_Baudson
+ *
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License
+ * and Simplified BSD license.
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+
+var $metadataLayer = $(this);
+var $metadataForm = $("<form>No WMS selected.</form>").appendTo($metadataLayer);
+
+var MetadataLayerApi = function (o) {
+	var that = this;
+	var validator;
+
+	this.valid = function () {
+		if (validator && validator.numberOfInvalids() > 0) {
+			$metadataForm.valid();
+		}
+	};
+		
+	this.edit = function (obj) {
+		$metadataForm.load("../plugins/mb_metadata_layer.html", function () {
+			validator = $metadataForm.validate();
+
+			// get layer from server
+			var req = new Mapbender.Ajax.Request({
+				url: "../plugins/mb_metadata_server.php",
+				method: "getLayerByWms",
+				parameters: {
+					"id": obj.wmsId
+				},
+				callback: function (obj, result, message) {
+					if (!result) {
+						return;
+					}
+					console.log(obj);
+				}
+			});
+//			req.send();		
+		});
+	};
+	
+	Mapbender.events.localize.register(function () {
+		that.valid();
+	});
+	Mapbender.events.init.register(function () {
+		that.valid();
+	});
+};
+
+$metadataLayer.mapbender(new MetadataLayerApi(options));

Added: trunk/mapbender/http/plugins/mb_metadata_linkage.html
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_linkage.html	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadata_linkage.html	2010-04-28 13:40:42 UTC (rev 6034)
@@ -0,0 +1,48 @@
+<style type="text/css">
+	* {
+		font-family: Verdana;
+		font-size: 96%;
+	}
+	select {
+		height: 130px;
+		width: 400px;
+	}
+	input {
+		height: 25px;
+		width: 230px;
+		display: block;
+		margin-left: auto;
+    		margin-right: auto;
+	}
+	
+	div#buttons {
+		float: left;
+		width: 25em;
+	}
+	div#selectbox {
+		margin-left: 26em;
+		padding-top: 1em;
+	}
+</style>
+
+<div id="buttons">
+	<h1>Add Information about the underlying data</h1>
+	<p>
+		<input class="" type="submit" value="Add new Metadata Record"/>
+	</p>
+	<p>
+		<input class="" type="submit" value="Edit Metadata Linkage"/>
+	</p>
+	<p>
+		<input class="" type="submit" value="Delete Metadata Linkage"/>
+	</p>
+	<p></p>
+</div>
+
+<div id="selectbox">
+	<select size="2">
+		<option>test</option>
+		<option>test</option>
+		<option>test</option>
+	</select>
+</div>

Added: trunk/mapbender/http/plugins/mb_metadata_linkage.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_linkage.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_metadata_linkage.js	2010-04-28 13:40:42 UTC (rev 6034)
@@ -0,0 +1,65 @@
+/**
+ * Package: mb_metadata_edit
+ *
+ * Description:
+ *
+ * Files:
+ *
+ * SQL:
+ * 
+ * Help:
+ *
+ * Maintainer:
+ * http://www.mapbender.org/User:Christoph_Baudson
+ *
+ * License:
+ * Copyright (c) 2009, Open Source Geospatial Foundation
+ * This program is dual licensed under the GNU General Public License
+ * and Simplified BSD license.
+ * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+ */
+/*
+var $metadataLayer = $(this);
+var $metadataForm = $("<form>No WMS selected.</form>").appendTo($metadataLayer);
+
+var MetadataLayerApi = function (o) {
+	var that = this;
+	var validator;
+
+	this.valid = function () {
+		if (validator && validator.numberOfInvalids() > 0) {
+			$metadataForm.valid();
+		}
+	};
+		
+	this.edit = function (obj) {
+		$metadataForm.load("../plugins/mb_metadata_layer.html", function () {
+			validator = $metadataForm.validate();
+
+			// get layer from server
+			var req = new Mapbender.Ajax.Request({
+				url: "../plugins/mb_metadata_server.php",
+				method: "getLayer",
+				parameters: {
+					"id": obj.wmsId
+				},
+				callback: function (obj, result, message) {
+					if (!result) {
+						return;
+					}
+				}
+			});
+//			req.send();		
+		});
+	};
+	
+	Mapbender.events.localize.register(function () {
+		that.valid();
+	});
+	Mapbender.events.init.register(function () {
+		that.valid();
+	});
+};
+
+$metadataLayer.mapbender(new MetadataLayerApi(options));
+*/
\ No newline at end of file

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2010-04-27 09:46:38 UTC (rev 6033)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2010-04-28 13:40:42 UTC (rev 6034)
@@ -78,6 +78,71 @@
 		
 
 		break;
+	case "getLayerByWms" :
+		$wmsId = $ajaxResponse->getParameter("id");
+		getWms($wmsId);
+
+		$sql = <<<SQL
+	
+SELECT layer_id, layer_pos, layer_parent, layer_name, layer_title, layer_abstract 
+FROM layer WHERE fkey_wms_id = $wmsId ORDER BY layer_pos;
+
+SQL;
+		$res = db_query($sql);
+
+		$rows = array();
+		while ($row = db_fetch_assoc($res)) {
+			$rows[] = $row;
+		}
+		$resultObj = array();
+		$previousParent = null;
+		$left = 1;
+		$resultObj[]= array(
+			"left" => $left,
+			"right" => 2*(count($rows) + 1),
+			"wms" => ""
+		);
+
+		function addSubTree ($rows, $i, $left) {
+			$currentRow = $rows[$i];
+			$layer_parent = $currentRow["layer_parent"];
+			$layer_pos = $currentRow["layer_pos"];
+			
+			$node = array(
+				"left" => $left,
+				"right" => null,
+				"wms" => $rows["layer_id"]
+			);
+
+			$previousParent = is_numeric($layer_parent) ? $layer_parent : null;
+			for ($j = $i+1; $j < count($rows); $j++) {
+				$row = $rows[$j];
+				$parent = $row["layer_parent"];
+				$pos = $row["layer_pos"];
+				if (!is_null($previousParent) && $previousParent > $parent) {
+					break;
+				}
+				if (is_null($previousParent)) {
+					
+				}
+				if ($previousParent < $parent) {
+					
+				}
+				if ($previousParent < $parent) {
+					
+				}
+			}
+
+			return $subTree;
+		}
+
+		addSubTree($rows, 0, 0, $left);
+		
+		$ajaxResponse->setResult($resultObj);
+		$ajaxResponse->setSuccess(true);
+		
+
+		break;
 	default: 
 		$ajaxResponse->setSuccess(false);
 		$ajaxResponse->setMessage(_mb("An unknown error occured."));



More information about the Mapbender_commits mailing list