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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Apr 21 10:31:57 EDT 2010


Author: verenadiewald
Date: 2010-04-21 10:31:57 -0400 (Wed, 21 Apr 2010)
New Revision: 5995

Modified:
   trunk/mapbender/http/javascripts/mod_ResultList.js
   trunk/mapbender/http/plugins/mb_resultList_transferToDigitize.js
   trunk/mapbender/lib/resultGeometryListController.js
Log:
check for transactional wfsConf in module resultList_transferToDigitize

Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js	2010-04-21 10:37:37 UTC (rev 5994)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js	2010-04-21 14:31:57 UTC (rev 5995)
@@ -64,6 +64,9 @@
 	me.rowclick = new Mapbender.Event();
 	me.rowmouseover = new Mapbender.Event();
 	me.rowmouseout = new Mapbender.Event();
+	me.events = {
+			wfsConfSet : new Mapbender.Event()
+	};
 	
 	/*
 	 * Method: addGlobalButton
@@ -103,18 +106,21 @@
 				$('#'+options.id+'buttonrow').css("clear","both");
 			}
 		
-			if (bd.type == "button")
-			{
+			if (bd.type == "button") {
 				var button = $('<span><button type="button" class="ui-state-default ui-corner-all '+ bd.classes  +'">'+buttondef.title+'</button></span>').click(result);
 				$('#'+options.id +'buttonrow').append(button);
-			}else if (bd.type == "select"){
+				return button.find("button");
+			}
+			else if (bd.type == "select"){
 				var select_options = "";
 				for (c in bd.selectoptions){	
 					select_options += '<option value="'+ bd.selectoptions[c].value +'">'+bd.selectoptions[c].label +'</options>';
 				}	
 				var selectbox = '<select class="'+ bd.classes  + '">'+ select_options  +'</select>';
-				$('#'+options.id +'buttonrow').append(selectbox);
-			}else{
+				var rowSelect = $('#'+options.id +'buttonrow').append(selectbox);
+				return rowSelect.find("select");
+			}
+			else {
 				alert("invalid buttondefintion");
 			}
 		};

Modified: trunk/mapbender/http/plugins/mb_resultList_transferToDigitize.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_transferToDigitize.js	2010-04-21 10:37:37 UTC (rev 5994)
+++ trunk/mapbender/http/plugins/mb_resultList_transferToDigitize.js	2010-04-21 14:31:57 UTC (rev 5995)
@@ -46,12 +46,13 @@
 });
 
 Mapbender.events.init.register(function () {
-	Mapbender.modules[options.target[0]].addGlobalButton({
+	var editButton = Mapbender.modules[options.target[0]].addGlobalButton({
 		title: translatedI18nObject.labelButton, 
 		classes: 'buttonMargin',
 		callback: function (data) {
 			tab_open(options.digitizeId);
 
+
 			var digitizeArray = new GeometryArray();
 
 			var wfsConf = get_complete_wfs_conf();
@@ -74,4 +75,13 @@
 			tab_open(options.digitizeId);
 		}
 	});	
-});
\ No newline at end of file
+	Mapbender.modules[options.target[0]].events.wfsConfSet.register(function (obj) {
+		var isTransactionalGeom = obj.wfsConf.wfs_transaction != "";
+		if (!isTransactionalGeom) {
+			editButton.hide();
+		}
+		else {
+			editButton.show();			
+		}
+	});
+});

Modified: trunk/mapbender/lib/resultGeometryListController.js
===================================================================
--- trunk/mapbender/lib/resultGeometryListController.js	2010-04-21 10:37:37 UTC (rev 5994)
+++ trunk/mapbender/lib/resultGeometryListController.js	2010-04-21 14:31:57 UTC (rev 5995)
@@ -21,12 +21,12 @@
 	this.detailColumns = [];
 
 	// array of buttondef objects
-	this.rowbuttons = [];
+	this.buttoncolumns = []
 
 	this.options = options;
 
 
-	/**
+	/*
 	 * Method: addFeature
 	 * Description: adds a Feature to the Model
 	 * Parameters:
@@ -40,7 +40,7 @@
 		var result = me.model.addFeature(feature);
 	};
 
-	/**
+	/*
 	 * Method: addFeatureCollection
 	 * Description: adds a FeatureCollection to the Model
 	 * Parameters:
@@ -50,7 +50,7 @@
 		var result = me.model.addFeatureCollection(geoJSON);
 	};
 
-	/**
+	/*
 	 * Method: addFeatureCollection_callback
 	 * Description: The callback received from the Model upon successfully adding a Feature
 	 * Parameters:
@@ -75,12 +75,6 @@
 				rowData.push(cellContent);
 			}
 
-			for(bId in me.rowbuttons){
-				var callback  = me.rowbuttons[bId].callback;
-				var buttonClass = "rowbutton_" +  me.rowbuttons[bId].title.replace(' ','_');
-				rowData.push('<input type="button" class="'+ buttonClass +'" value="'+ me.rowbuttons[bId].title +'"  />');
-			}
-
 			// fnAddData returns an array of indices
 			var index = me.datatable.fnAddData(rowData);
 			
@@ -110,6 +104,9 @@
 		if(WFSConf != this.WFSConf){
 			this.WFSConf = WFSConf;
 			this.reinitialize();
+			this.events.wfsConfSet.trigger({
+				wfsConf : WFSConf
+			});
 		}
 	};
 
@@ -174,17 +171,6 @@
 		}
 	};
 
-
-	/*
-	 * Method: addRowButton
-	 * Description: adds a Button to each row
-	 * Parameters:
-	 * buttondef: {Object} an object with  properties: "title" and  "callback", a function that gets the  feature that corresponds to the popup as it's argument
-  */
-	this.addRowButton = function(buttondef){
-		this.rowbuttons.push(buttondef);
-	}
-
 	this.reinitialize = function(){
 		
 		//create theads, and variable "labels" according to wfsConf
@@ -194,27 +180,23 @@
 		me.detailColumns = getDetailColumns(this.WFSConf);
 		
 		//var buttonrow = $('#'+me.options.id +"buttonrow")
-		$('#' + me.options.id +"_table_wrapper").remove();
+		$('#' + me.options.id +"_table_wrapper").remove()
 
-		if (me.table != null) {
-			me.table.remove();
-		}
-		me.table = $('<table class="display" id="' + me.options.id + 
-			'_table"><thead><tr></tr></thead><tbody></tbody></table>');
+		if(me.table != null){me.table.remove() }
+		me.table = $('<table class="display" id="'+ me.options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
 		$('#' + me.options.id).prepend(me.table);
-
 		//apply columns to table
 		//$("thead tr th",table).remove();
 		theads = "";
 		for(i in me.columns){
 			theads += "<th>"+ me.columns[i].label +"</th>";
+			
 		}
-
-    
-		for (i in this.rowbuttons){ 
-			theads += "<th></th>";
+		/*
+		for (i in me.buttoncolumns){ 
+			theads += "<th>BUTTONCOLUMN</th>";
 		}
-
+		*/
 		$("thead tr",me.table).append(theads);
 
 		//
@@ -226,9 +208,7 @@
 		//}
 		//table.append(heads);
 		//table.append($("<tbody></tbody>"));
-		if (me.datatable != null){ 
-			me.datatable.remove();
-		}
+		if (me.datatable != null){ me.datatable.remove();}
 
 		// and clear all out everythuing wtf why is there
 		me.datatable = me.table.dataTable({  
@@ -238,7 +218,11 @@
 		});
 		$(".resultdatatable").css("clear","both");
 		$(".resultdatatable table").css("width","95%");
+
+
+
 	};
+	
 
 	// initialize new
 	me.model = new ResultGeometryListModel();
@@ -246,4 +230,6 @@
 	me.model.events.deleted.register();
 	me.model.events.updated.register();
 	me.model.events.cleared.register(clear_callback);
+
+	
 };



More information about the Mapbender_commits mailing list