[Mapbender-commits] r6639 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 26 07:25:32 EDT 2010


Author: kmq
Date: 2010-07-26 11:25:32 +0000 (Mon, 26 Jul 2010)
New Revision: 6639

Modified:
   trunk/mapbender/lib/mb.ui.displayFeatures.js
Log:
clickhandler for georss honors all feeds

Modified: trunk/mapbender/lib/mb.ui.displayFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayFeatures.js	2010-07-26 10:26:03 UTC (rev 6638)
+++ trunk/mapbender/lib/mb.ui.displayFeatures.js	2010-07-26 11:25:32 UTC (rev 6639)
@@ -35,9 +35,8 @@
 	_feeds: {},
 	_popup : null,
 	
-	_init: function(){
+	_create: function(){
 		var that = this, o = this.options;
-		this._popup = $('<div></div>').dialog({autoOpen : false, height: 500, width: 500});
 		this.element.click( function(e){
 			var map = that.element.mapbender();
 			var pos = map.getMousePosition(e);		
@@ -50,6 +49,8 @@
 			// after that's finished the results are merged and displayed in a box
 			var pointGeometries = {};	
 			var g,h,nodes = null;
+			$("*",that._popup).remove();
+			var $tabs = $("<ul></ul>");
 			for (var i in that._feeds){
 				feed = that._feeds[i] ;
 				requestGeometries = [];
@@ -68,7 +69,6 @@
 							// theywill be merged with the ones coming from the
 							// server
 							pointGeometries[j] = true;
-				//			console.log(nodes[0]);
 						}
 						
 					}else{
@@ -94,12 +94,9 @@
 					}
 
 					
-					$("*",that._popup).remove();
-					var $tabs = $("<ul></ul>");
 					// this iterates over an object where the keys are _not_ the incremential
-					// basically a sparse array. therefore I cannot be used to count the entries in the object
+					// basically a sparse array. therefore It cannot be used to count the entries in the object
 					// this is why j is used
-					var j = 0;
 					for(i in result.geometries){
 						var g = geomArray.get(i);
 						title = g.e.getElementValueByName("title");
@@ -119,33 +116,34 @@
 						description = g.e.getElementValueByName("description");
 						$tabs.append('<li><a href="#rsspopup_'+ i +'">'+ title + '</a></li>');
 						that._popup.append('<div id="rsspopup_'+ i +'"><h1>'+ title +'</h1><p>'+ description +'</p></h1>');
-						j++;
+						if($tabs.children().size() > 1){
+							var $tabcontainer = $("<div><div>");
+							$tabcontainer.append($tabs);
+							$tabcontainer.append($('div',that._popup));	
+							that._popup.append($tabcontainer);
+							$tabcontainer.tabs();
+						}
+						that._popup.dialog('open');
 					}
-					if(j > 1){
-						var $tabcontainer = $("<div><div>");
-						$tabcontainer.append($tabs);
-						$tabcontainer.append($('div',that._popup));	
-						that._popup.append($tabcontainer);
-						$tabcontainer.tabs();
-					}
-					that._popup.dialog('open');
 				
 
-						};
-					}
-				)(feed.geomArray, pointGeometries)
+				};})(feed.geomArray, pointGeometries)
 				});
 				req.send();
 				requestGeometries = [];
 				pointGeometries = {};
 			}
 		});
+
+
+	},
+	_init: function(){
+		var that = this, o = this.options;
+		this._popup = $('<div></div>').dialog({autoOpen : false, height: 500, width: 500});
 		if(o.url){
 			that._load(o.url);
 		}
 	},
-	_create: function(){
-	},
 
 	_load : function(url){
 		var that = this, o = this.options;
@@ -164,7 +162,7 @@
 					loadError(data.errorMessage);
 					return;
 				}
-				that._display(data);
+				that._display(data,url);
 			},
 			error: function(XMLHttpRequest, textStatus, errorThrown){
 				loadError("could not load "+o.url);
@@ -173,7 +171,7 @@
 
 	},
 
-	_display : function(geoJSON){
+	_display : function(geoJSON,url){
 	
 		var that = this, o = this.options;
 		var $map = $(that.element).mapbender();



More information about the Mapbender_commits mailing list