[Mapbender-commits] r6073 - in trunk/mapbender/http: extensions/jsTree.v.0.9.9a2 plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 4 07:51:11 EDT 2010


Author: christoph
Date: 2010-05-04 07:51:10 -0400 (Tue, 04 May 2010)
New Revision: 6073

Modified:
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js
   trunk/mapbender/http/plugins/mb_metadata_layer.js
   trunk/mapbender/http/plugins/mb_metadata_layerTree.js
   trunk/mapbender/http/plugins/mb_metadata_select.js
   trunk/mapbender/http/plugins/mb_metadata_server.php
Log:


Modified: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js	2010-05-04 11:39:59 UTC (rev 6072)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js	2010-05-04 11:51:10 UTC (rev 6073)
@@ -1971,7 +1971,7 @@
 								str += "' ";
 								cls = true;
 							}
-							else str += " " + i + "='" + data.attributes[i] + "' ";
+							else str += " " + i + "='" + data.attributes[i].replace(/[']/g, ''') + "' ";
 						}
 					}
 					if(!cls && (data.state == "closed" || data.state == "open")) str += " class='" + data.state + "' ";

Modified: trunk/mapbender/http/plugins/mb_metadata_layer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layer.js	2010-05-04 11:39:59 UTC (rev 6072)
+++ trunk/mapbender/http/plugins/mb_metadata_layer.js	2010-05-04 11:51:10 UTC (rev 6073)
@@ -50,7 +50,52 @@
 		});
 		that.events.initialized.done = true;
 	};
+	
+	this.fillForm = function (obj) {
+		// layer data
+		console.log(obj);
 
+		for (var i in obj) {
+			$("#" + i).val(obj[i]);
+		}
+		// layer keywords
+		var req = new Mapbender.Ajax.Request({
+			url: "../plugins/mb_metadata_server.php",
+			method: "getCategories",
+			parameters: {
+				"id": obj
+			},
+			callback: function(o, r, m) {
+				if (!r) {
+					return;
+				}
+				initialized($.extend({
+					wmsId: obj
+				}, o));
+			}
+		});
+		req.send();			
+		
+		// layer categories
+		var req = new Mapbender.Ajax.Request({
+			url: "../plugins/mb_metadata_server.php",
+			method: "getCategories",
+			parameters: {
+				"id": obj
+			},
+			callback: function(o, r, m) {
+				if (!r) {
+					return;
+				}
+				initialized($.extend({
+					wmsId: obj
+				}, o));
+			}
+		});
+		req.send();	
+	};
+	
+
 	this.init = function (obj) {
 		if (!that.events.initialized.done) {
 			$metadataForm.load("../plugins/mb_metadata_layer.html", function () {

Modified: trunk/mapbender/http/plugins/mb_metadata_layerTree.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layerTree.js	2010-05-04 11:39:59 UTC (rev 6072)
+++ trunk/mapbender/http/plugins/mb_metadata_layerTree.js	2010-05-04 11:51:10 UTC (rev 6073)
@@ -31,7 +31,7 @@
 			attributes: {
 				data: $.toJSON(set.attr)
 			},
-			data: set.attr.title,
+			data: set.attr.layer_title,
 			state: "closed",
 			children: []
 		};
@@ -43,7 +43,7 @@
 				data: $.toJSON(set.attr)
 			},
 			data: {
-				title: set.attr.title
+				title: set.attr.layer_title
 			}
 		};
 	};
@@ -116,7 +116,9 @@
 						type: "attr",
 						name: "data"
 					});
-					that.events.selected.trigger(data);
+					that.events.selected.trigger({
+						"layer": data
+					});
 				}
 			}
 		});

Modified: trunk/mapbender/http/plugins/mb_metadata_select.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_select.js	2010-05-04 11:39:59 UTC (rev 6072)
+++ trunk/mapbender/http/plugins/mb_metadata_select.js	2010-05-04 11:51:10 UTC (rev 6073)
@@ -20,6 +20,7 @@
  */
 
 var $metadataSelect = $(this);
+$metadataSelect.prepend("<img src='../img/indicator_wheel.gif'>");
 
 var MetadataSelectApi = function (o) {
 	var table = null;
@@ -47,6 +48,8 @@
 				if (!result) {
 					return;
 				}
+				$metadataSelect.find("img").remove();
+				
 				var aoColumns = [];
 				for (var i in obj.header) {
 					if (obj.header[i] === "WMS ID") {

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2010-05-04 11:39:59 UTC (rev 6072)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2010-05-04 11:51:10 UTC (rev 6073)
@@ -98,11 +98,18 @@
 	case "getCategories":
 		$resultObj = array(
 			"categories" => array(
+				"fkey_md_topic_category_id" => array(),
 				"fkey_inspire_category_id" => array(),
 				"fkey_custom_category_id" => array()
 			)
 		);
 
+		$sql = "SELECT md_topic_category_id, md_topic_category_code_en FROM md_topic_category";
+		$res = db_query($sql);
+		while ($row = db_fetch_row($res)) {
+			$resultObj["categories"]["fkey_md_topic_category_id"][]= $row;
+		}
+
 		$sql = "SELECT inspire_category_id, inspire_category_code_en FROM inspire_category";
 		$res = db_query($sql);
 		while ($row = db_fetch_row($res)) {
@@ -160,6 +167,49 @@
 		$ajaxResponse->setResult($resultObj);
 		$ajaxResponse->setSuccess(true);
 		break;
+
+	case "getLayerCategories" :
+		$layerId = $ajaxResponse->getParameter("id");
+		getLayer($layerId);
+
+		$resultObj = array(
+			"fkey_md_topic_category_id" => array(),
+			"fkey_inspire_category_id" => array(),
+			"fkey_custom_category_id" => array(),
+		);
+		$sql = <<<SQL
+SELECT fkey_md_topic_category_id 
+FROM layer_md_topic_category 
+WHERE fkey_layer_id = $layerId
+SQL;
+		$res = db_query($sql);
+		while ($row = db_fetch_assoc($res)) {
+			$resultObj["fkey_md_topic_category_id"][]= $row;
+		}
+
+		$sql = <<<SQL
+SELECT fkey_inspire_category_id 
+FROM layer_inspire_category 
+WHERE fkey_layer_id = $layerId
+SQL;
+		$res = db_query($sql);
+		while ($row = db_fetch_assoc($res)) {
+			$resultObj["fkey_inspire_category_id"][]= $row;
+		}
+
+		$sql = <<<SQL
+SELECT fkey_custom_category_id 
+FROM layer_custom_category 
+WHERE fkey_layer_id = $layerId
+SQL;
+		$res = db_query($sql);
+		while ($row = db_fetch_assoc($res)) {
+			$resultObj["fkey_custom_category_id"][]= $row;
+		}
+
+		$ajaxResponse->setResult($resultObj);
+		$ajaxResponse->setSuccess(true);
+		break;
 	case "getLayerByWms" :
 		$wmsId = $ajaxResponse->getParameter("id");
 //		getWms($wmsId);
@@ -185,9 +235,10 @@
 				"parent" => $row["layer_parent"] !== "" ? intval($row["layer_parent"]) : null,
 				"pos" => intval($row["layer_pos"]),
 				"attr" => array (
-					"id" => intval($row["layer_id"]),
-					"name" => $row["layer_name"],
-					"title" => $row["layer_title"]
+					"layer_id" => intval($row["layer_id"]),
+					"layer_name" => $row["layer_name"],
+					"layer_title" => $row["layer_title"],
+					"layer_abstract" => $row["layer_abstract"]
 				)
 			);
 		}



More information about the Mapbender_commits mailing list