[Mapbender-commits] r5603 - in trunk/mapbender/http: javascripts
plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Feb 23 07:55:35 EST 2010
Author: kmq
Date: 2010-02-23 07:55:34 -0500 (Tue, 23 Feb 2010)
New Revision: 5603
Added:
trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js
Modified:
trunk/mapbender/http/javascripts/mod_ResultList.js
Log:
moved what happens when a row in the result list is clicked into it's own function
Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js 2010-02-23 12:54:15 UTC (rev 5602)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js 2010-02-23 12:55:34 UTC (rev 5603)
@@ -51,6 +51,9 @@
var popupButtons = [];
var me = this;
+ me.options = options;
+ me.rowclick = new Mapbender.Event();
+
this.addRowcallback = function(callback){
//disaabled
// the signature of the callback function (columns)
@@ -171,7 +174,7 @@
this.show = function(){
- var resultHighlight = new Highlight(
+ me.resultHighlight = new Highlight(
options.target,
"resultListHighlight",
{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex},
@@ -183,10 +186,9 @@
$('#'+options.id).css("display","block");
}
- $('.infoPopup').dialog('close');
- var resultHighlight = new Highlight(
+ me.resultHighlight = new Highlight(
options.target,
"resultListHighlight",
{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex},
@@ -197,74 +199,7 @@
(function() {
var row = rowNodes[rowNodeIndex];
$(".wfsFproperty", row).click(function(){
-
-// make thhis call a callback...
-//////////////////////
- // go up to the row, which has the "modelindex" set
- var modelIndex = $(row).data("modelindex");
- var feature = me.model.getFeature(modelIndex);
-
- 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 popupButtons){
- var callback = function() {
- var args = {
- WFSConf: me.WFSConf,
- geoJSON: feature,
- selectedRows: me.getSelected()
- };
- 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);
- }
- infoPopup.append(buttonList);
- infoPopup.dialog({
- title : "Details",
- autoOpen : false,
- draggable : true,
- width : options.infoPopupWidth,
- height : options.infoPopupHeight
- });
- infoPopup.dialog("open");
- }
-
- if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
- feature = feature.getBBox4();
- }
-
- resultHighlight.del(feature, options.resultHighlightColor);
- var bbox = feature.getBBox();
- var bufferFloat = parseFloat(me.WFSConf.g_buffer);
- var buffer = new Point(bufferFloat,bufferFloat);
- bbox[0] = bbox[0].minus(buffer);
- bbox[1] = bbox[1].plus(buffer);
- //mb_calculateExtent(targetArray[0], bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
- //zoom(targetArray[0], 'true', 1.0);
- var map = Mapbender.modules[options.target[0]];
- map.calculateExtent(
- new Mapbender.Extent(bbox[0], bbox[1])
- );
- map.setMapRequest();
-
- resultHighlight.add(feature, options.resultHighlightColor);
- resultHighlight.paint();
-
- return false;
-///////////////////////////////
+ me.rowclick.trigger((function(){return row;})());
})
@@ -276,8 +211,8 @@
feature = feature.getBBox4();
}
- resultHighlight.add(feature, options.resultHighlightColor);
- resultHighlight.paint();
+ me.resultHighlight.add(feature, options.resultHighlightColor);
+ me.resultHighlight.paint();
}).mouseout(function () {
var i = $(this).data("modelindex");
var feature = me.model.getFeature(i);
@@ -286,8 +221,8 @@
feature = feature.getBBox4();
}
- resultHighlight.del(feature, options.resultHighlightColor);
- resultHighlight.paint();
+ me.resultHighlight.del(feature, options.resultHighlightColor);
+ me.resultHighlight.paint();
});
// make rows selectable only when there are Global Buttons that could actually do womething with that selection
@@ -304,9 +239,7 @@
}
// set style of cursor to pointer for the result table
- $(".wfsFproperty", row).css("cursor","pointer");
-
-
+ if(me.rowclick.getProperties().count > 0) {$(".wfsFproperty", row).css("cursor","pointer")};
})();
}
@@ -338,6 +271,8 @@
ResultGeometryList.prototype = new ResultGeometryListController(options);
ResultGeometryList.prototype.constructor = ResultGeometryList;
+
+
Mapbender.modules[options.id] = $.extend(
new ResultGeometryList(), Mapbender.modules[options.id]
);
Added: trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js (rev 0)
+++ trunk/mapbender/http/plugins/mb_resultList_DetailPopup.js 2010-02-23 12:55:34 UTC (rev 5603)
@@ -0,0 +1,69 @@
+
+Mapbender.modules[options.target].rowclick.register(function(row){
+ var me = Mapbender.modules[options.target];
+ var modelIndex = $(row).data("modelindex");
+ var feature = me.model.getFeature(modelIndex);
+
+ $('.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>";
+
+ 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);
+ };
+ 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 : "Details",
+ autoOpen : false,
+ draggable : true,
+ width : options.infoPopupWidth,
+ height : options.infoPopupHeight
+ });
+ infoPopup.dialog("open");
+ }
+
+ if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
+ feature = feature.getBBox4();
+ }
+
+ me.resultHighlight.del(feature, options.resultHighlightColor);
+ var bbox = feature.getBBox();
+ var bufferFloat = parseFloat(me.WFSConf.g_buffer);
+ var buffer = new Point(bufferFloat,bufferFloat);
+ bbox[0] = bbox[0].minus(buffer);
+ bbox[1] = bbox[1].plus(buffer);
+
+ var map = Mapbender.modules[me.options.target[0]];
+
+ map.calculateExtent(
+ new Mapbender.Extent(bbox[0], bbox[1])
+ );
+ map.setMapRequest();
+
+ me.resultHighlight.add(feature, options.resultHighlightColor);
+ me.resultHighlight.paint();
+
+return false;
+
+});
More information about the Mapbender_commits
mailing list