[Mapbender-commits] r6426 - in trunk/mapbender: http/plugins lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jun 25 03:32:16 EDT 2010


Author: christoph
Date: 2010-06-25 07:32:16 +0000 (Fri, 25 Jun 2010)
New Revision: 6426

Added:
   trunk/mapbender/http/plugins/mb_wfsGazetteer.js
   trunk/mapbender/lib/mb.ui.wfsGazetteer.js
Log:


Added: trunk/mapbender/http/plugins/mb_wfsGazetteer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_wfsGazetteer.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_wfsGazetteer.js	2010-06-25 07:32:16 UTC (rev 6426)
@@ -0,0 +1,12 @@
+var $gazetteer = $(this);
+
+$.get("../php/mod_wfs_gazetteer_server.php", {
+	command:"getWfsConf",
+	wfsConfIdString:options.wfsConf
+}, function(json, status) {
+	var wfsConf = $.parseJSON(json);
+	$gazetteer.wfsGazetteer({
+		wfsConf: wfsConf[options.wfsConf]
+	});
+});
+

Added: trunk/mapbender/lib/mb.ui.wfsGazetteer.js
===================================================================
--- trunk/mapbender/lib/mb.ui.wfsGazetteer.js	                        (rev 0)
+++ trunk/mapbender/lib/mb.ui.wfsGazetteer.js	2010-06-25 07:32:16 UTC (rev 6426)
@@ -0,0 +1,59 @@
+var JQUERY_PATH = "../extensions/jquery-ui-1.8.1-custom/";
+
+$.widget("mb.wfsGazetteer", {
+	options: {
+		
+	},
+	_create: function () {
+		if (typeof this.options.wfsConf !== "object" && 
+			this.options.wfsConf !== null
+		) {
+			this.destroy();
+			return;
+		}
+		var c = this.options.wfsConf;
+		for (var i = c.element.length - 1; i >= 0; i--) {
+			var el = c.element[i];
+			if (parseInt(el.f_search, 10) !== 1) {
+				continue;
+			}
+			var id = this.element.id + "_" + el.element_name;
+			
+			var $formElement;
+			if (el.f_form_element_html.match(/\<select/)) {
+				$formElement = $(el.f_form_element_html).attr("id",  id);
+			}
+			else if (el.f_form_element_html.match(/checkbox/)) {
+				$formElement = $(el.f_form_element_html).attr("id",  id);
+			}
+			else if (el.f_form_element_html.match(/datepicker/)) {
+				$formElement = $("<input />", {
+					type: "text",
+					id: id,
+					readonly: "readonly"
+				}).datepicker({
+					showOn: "button",
+					buttonImage: JQUERY_PATH + 
+						"development-bundle/demos/datepicker/images/calendar.gif",
+					buttonImageOnly: true
+				});
+			}
+			else {
+				$formElement = $("<input />", {
+					type: "text",
+					id: id
+				});
+			}
+
+			var $label = $("<label />", {
+				"for": id
+			}).text(el.f_label).append($formElement);
+
+			$(".mb-wfsGazetteer-form", this.element).prepend($label);
+		}
+
+	},
+	destroy: function () {
+		console.log("destroy");
+	}
+});



More information about the Mapbender_commits mailing list