[Mapbender-commits] r5074 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Dec 4 10:21:22 EST 2009


Author: kmq
Date: 2009-12-04 10:21:21 -0500 (Fri, 04 Dec 2009)
New Revision: 5074

Added:
   trunk/mapbender/http/javascripts/mod_ResultList.js
Log:
Added result List element

Added: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-04 15:21:21 UTC (rev 5074)
@@ -0,0 +1,111 @@
+//check element vars
+var display_popup = display_popup || true;
+
+var ResultGeometryList = function(){
+	//store a callback for the function to call when a row is clicke
+	var row_callback = function(){};
+	var popupButtons = [];
+	me = this;
+
+	this.addRowcallback = function(callback){
+		//disaabled
+		// the signature of the callback function (columns)
+		// where columns is an object containiing pairs of column:value
+		//row_callback = callback;
+		
+	};
+
+	this.row_click_callback = function(){
+		// Fixme get from row
+		// If we were dynamic, this is what we would do
+		//row_callback.call(null,{"firstname":"gonzales"});	
+		//but for now we just open a popup with infos abotut the table
+		// we have:
+		// DOMTableRow
+		// DOMTableRow.data("modelindex")
+		// model.getFeatureProperty(modelIndex) - but we need all of them :-(
+		//alert($(this).data("modelindex"));
+		
+	}
+
+	this.addGlobalButton = function(buttondef){
+		//buttondef format:
+		//{"title":<if no image is given then this is displayed>, callback: <function( ))
+		//
+		// this is the domelement
+		var result = function(){
+			var  args =  { 
+				WFSConf: me.WFSConf,
+				geoJSON: me.model.toString()
+			};
+			buttondef.callback.call(this,args);
+		};
+		var button = $("<span>"+buttondef.title+"</span>").click(result);
+		$('#'+options.id).append(button);
+	};
+
+	
+
+	this.addRowButton = function(buttondef){
+
+	};
+	
+	this.addPopupButton = function(buttondef){
+		popupButtons.push(buttondef);
+	}
+	
+	this.show = function(){
+		if(display_popup){
+			$('#'+options.id).dialog("open");
+		}else{
+			$('#'+options.id).css("display","block");
+		}
+		$("tr",table).click(function(){
+			var i = $(this).data("modelindex");
+			var name = me.model.getFeatureProperty(i,"firstname");
+
+			var infoPopup = $("<div> </div>")
+			infoPopup.append(name);
+			buttonList = $("<ul></ul>").css("list-style-type","none");
+			for (c in popupButtons){
+				var  args =  { 
+					WFSConf: me.WFSConf,
+					geoJSON: me.model.toString()
+				};
+				var callback = function() {
+					popupButtons[c].callback.call(this,args);
+				}
+				var button = $("<li>"+popupButtons[c].title+"</li>").click(callback)	
+				button.css("display","inline");
+				buttonList.append(button);
+			}
+			infoPopup.append(buttonList);
+			infoPopup.dialog({autoOpen:true })
+			})
+
+	};
+
+	this.hide = function(){
+		if(display_popup){
+			$('#'+options.id).dialog("hide");
+		}else{
+			$('#'+options.id).css("display","none");
+		}
+	}
+
+	if(display_popup){
+		$('#'+options.id).dialog({autoOpen: false , width:600, draggable: true});
+	}else{
+		$('#'+options.id).css("display","none");
+	}
+	
+}
+
+
+var table = $('<table id="'+ options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
+$('#'+options.id).append(table);
+
+ResultGeometryList.prototype = new ResultGeometryListController(table);
+ResultGeometryList.prototype.constructor = ResultGeometryList;
+
+Mapbender.modules[options.id] = $.extend(new ResultGeometryList(), Mapbender.modules[options.id]);



More information about the Mapbender_commits mailing list