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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Dec 8 07:38:32 EST 2009


Author: kmq
Date: 2009-12-08 07:38:32 -0500 (Tue, 08 Dec 2009)
New Revision: 5081

Added:
   trunk/mapbender/http/javascripts/mod_ResultList_SaveAsFile.js
Modified:
   trunk/mapbender/http/javascripts/mod_ResultList.js
Log:


Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-08 12:33:54 UTC (rev 5080)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-08 12:38:32 UTC (rev 5081)
@@ -47,10 +47,22 @@
 	
 
 	this.addRowButton = function(buttondef){
+	// buttondef format:
+	//  title:
+	//  src:
+	//  callback = function(feature) {}
+	//  index: ( 0=> in front, 1, after first, -1 end, -2 second to last...
+	//  modify buttoncolumns
+	// and reinitialize
+		me.buttoncolumns.push(buttondef);
+		me.reinitialize();
 
 	};
 	
 	this.addPopupButton = function(buttondef){
+	// buttondef format:
+	//  title:
+	//  callback = function(feature) {}
 		popupButtons.push(buttondef);
 	}
 	
@@ -63,17 +75,14 @@
 		$("tr",table).click(function(){
 			var i = $(this).data("modelindex");
 			var name = me.model.getFeatureProperty(i,"firstname");
+			var feature = me.model.getFeature(i);
 
 			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);
+					popupButtons[c].callback.call(this,feature);
 				}
 				var button = $("<li>"+popupButtons[c].title+"</li>").click(callback)	
 				button.css("display","inline");

Added: trunk/mapbender/http/javascripts/mod_ResultList_SaveAsFile.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList_SaveAsFile.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_ResultList_SaveAsFile.js	2009-12-08 12:38:32 UTC (rev 5081)
@@ -0,0 +1,22 @@
+var WFSSaveAsFile = function(data){
+	var req = new parent.Mapbender.Ajax.Request({
+		url: "../php/mod_echo.php",
+		method:"createFile",
+		parameters: {
+			data: data.geoJSON
+		},
+		callback : function(result, success, message){
+			if(success){
+				parent.document.location.href= result.url;
+			}else{
+
+			}
+
+		}
+			
+	});
+	req.send();
+
+}
+
+parent.Mapbender.modules[options.target[0]].addGlobalButton({"title":"Save as File", "callback": WFSSaveAsFile});



More information about the Mapbender_commits mailing list