[Mapbender-commits] r5766 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Mar 14 11:37:33 EDT 2010


Author: verenadiewald
Date: 2010-03-14 11:37:33 -0400 (Sun, 14 Mar 2010)
New Revision: 5766

Modified:
   trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js
   trunk/mapbender/http/plugins/mb_resultList_Highlight.js
Log:
Mapbender.events.init.register

Modified: trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js	2010-03-14 15:31:12 UTC (rev 5765)
+++ trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js	2010-03-14 15:37:33 UTC (rev 5766)
@@ -51,51 +51,53 @@
 // see http://docs.jquery.com/UI/Dialog for possible values
 options.position = options.position || 'center';
 
-Mapbender.modules[options.target[0]].rowclick.register(function(row){
-	var me = Mapbender.modules[options.target[0]];
-	var modelIndex = $(row).data("modelindex");
-	var feature = me.model.getFeature(modelIndex);
-	
-	//close old dialog before opening new one
-	$('.infoPopup').dialog('close');
-	
-	if(me.detailColumns.length > 0) {
-		var infoPopupHtml = "<table>";
-		for (var columnIndex in me.detailColumns) {
-			infoPopupHtml += "<tr>";
-			infoPopupHtml += "<td>" + me.detailColumns[columnIndex].label + "</td>";
-			infoPopupHtml += "<td>" + me.model.getFeatureProperty(modelIndex, me.detailColumns[columnIndex].name)+ "</td>";
-			infoPopupHtml += "</tr>";
-		}
-		infoPopupHtml += "</table>";
+Mapbender.events.init.register(function(){
+	Mapbender.modules[options.target[0]].rowclick.register(function(row){
+		var me = Mapbender.modules[options.target[0]];
+		var modelIndex = $(row).data("modelindex");
+		var feature = me.model.getFeature(modelIndex);
 		
-		var infoPopup = $('<div class="infoPopup"></div>');
-		infoPopup.append(infoPopupHtml);
+		//close old dialog before opening new one
+		$('.infoPopup').dialog('close');
 		
-		buttonList = $("<ul></ul>").css("list-style-type","none");
-		for (var c in me.popupButtons){
-			var callback = function() {
-				var  args =  { 
-					WFSConf: me.WFSConf,
-					geoJSON: feature,
-					selectedRows: me.getSelected()
+		if(me.detailColumns.length > 0) {
+			var infoPopupHtml = "<table>";
+			for (var columnIndex in me.detailColumns) {
+				infoPopupHtml += "<tr>";
+				infoPopupHtml += "<td>" + me.detailColumns[columnIndex].label + "</td>";
+				infoPopupHtml += "<td>" + me.model.getFeatureProperty(modelIndex, me.detailColumns[columnIndex].name)+ "</td>";
+				infoPopupHtml += "</tr>";
+			}
+			infoPopupHtml += "</table>";
+			
+			var infoPopup = $('<div class="infoPopup"></div>');
+			infoPopup.append(infoPopupHtml);
+			
+			buttonList = $("<ul></ul>").css("list-style-type","none");
+			for (var c in me.popupButtons){
+				var callback = function() {
+					var  args =  { 
+						WFSConf: me.WFSConf,
+						geoJSON: feature,
+						selectedRows: me.getSelected()
+					};
+					me.popupButtons[c].callback.call(this,args);
 				};
-				me.popupButtons[c].callback.call(this,args);
-			};
-			var button = $("<li><button type='button' class='ui-state-default ui-corner-all'>"+popupButtons[c].title+"</button></li>").click(callback);
-			button.css("display","inline");
-			buttonList.append(button);
+				var button = $("<li><button type='button' class='ui-state-default ui-corner-all'>"+popupButtons[c].title+"</button></li>").click(callback);
+				button.css("display","inline");
+				buttonList.append(button);
+			}
+			infoPopup.append(buttonList);
+			infoPopup.dialog({
+				title : options.detailPopupTitle, 
+				autoOpen : false, 
+				draggable : true,
+				width : options.detailPopupWidth,
+				height : options.detailPopupHeight,
+				position : options.position
+			});
+			infoPopup.dialog("open");
 		}
-		infoPopup.append(buttonList);
-		infoPopup.dialog({
-			title : options.detailPopupTitle, 
-			autoOpen : false, 
-			draggable : true,
-			width : options.detailPopupWidth,
-			height : options.detailPopupHeight,
-			position : options.position
-		});
-		infoPopup.dialog("open");
-	}
-	return false;
+		return false;
+	});
 });

Modified: trunk/mapbender/http/plugins/mb_resultList_Highlight.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_Highlight.js	2010-03-14 15:31:12 UTC (rev 5765)
+++ trunk/mapbender/http/plugins/mb_resultList_Highlight.js	2010-03-14 15:37:33 UTC (rev 5766)
@@ -50,42 +50,43 @@
 options.resultHighlightLineWidth  = options.resultHighlightLineWidth || 2;
 options.resultHighlightZIndex  = options.resultHighlightZIndex || 100;
 
-Mapbender.modules[options.target[0]].rowmouseover.register(function(row){
-	var me = Mapbender.modules[options.target[0]];
-	var modelIndex = $(row).data("modelindex");
-	var feature = me.model.getFeature(modelIndex);
-
-	if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
-		feature = feature.getBBox4();
-	}
+Mapbender.events.init.register(function(){
+	Mapbender.modules[options.target[0]].rowmouseover.register(function(row){
+		var me = Mapbender.modules[options.target[0]];
+		var modelIndex = $(row).data("modelindex");
+		var feature = me.model.getFeature(modelIndex);
 	
-	me.resultHighlight = new Highlight(
-			[options.target[1],options.target[2]],
-			"resultListHighlight", 
-			{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex}, 
-			options.resultHighlightLineWidth);
-
-	me.resultHighlight.add(feature, options.resultHighlightColor);
-	me.resultHighlight.paint();
-});
-
-Mapbender.modules[options.target[0]].rowmouseout.register(function(row){
-	var me = Mapbender.modules[options.target[0]];
-	var modelIndex = $(row).data("modelindex");
-	var feature = me.model.getFeature(modelIndex);
+		if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
+			feature = feature.getBBox4();
+		}
+		
+		me.resultHighlight = new Highlight(
+				[options.target[1],options.target[2]],
+				"resultListHighlight", 
+				{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex}, 
+				options.resultHighlightLineWidth);
 	
-	if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
-		feature = feature.getBBox4();
-	}
-
-	me.resultHighlight = new Highlight(
-			[options.target[1],options.target[2]], 
-			"resultListHighlight", 
-			{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex}, 
-			options.resultHighlightLineWidth);
+		me.resultHighlight.add(feature, options.resultHighlightColor);
+		me.resultHighlight.paint();
+	});
 	
-	me.resultHighlight.del(feature, options.resultHighlightColor);
-	me.resultHighlight.paint();
+	Mapbender.modules[options.target[0]].rowmouseout.register(function(row){
+		var me = Mapbender.modules[options.target[0]];
+		var modelIndex = $(row).data("modelindex");
+		var feature = me.model.getFeature(modelIndex);
+		
+		if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
+			feature = feature.getBBox4();
+		}
+	
+		me.resultHighlight = new Highlight(
+				[options.target[1],options.target[2]], 
+				"resultListHighlight", 
+				{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex}, 
+				options.resultHighlightLineWidth);
+		
+		me.resultHighlight.del(feature, options.resultHighlightColor);
+		me.resultHighlight.paint();
+	});
 });
 
-



More information about the Mapbender_commits mailing list