[Mapbender-commits] r3224 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Nov 12 03:50:12 EST 2008
Author: christoph
Date: 2008-11-12 03:50:12 -0500 (Wed, 12 Nov 2008)
New Revision: 3224
Modified:
trunk/mapbender/http/javascripts/mod_featureInfo.php
trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php
Log:
merged from noframes branch.
I assume this functionality has been moved from map.js to here
Modified: trunk/mapbender/http/javascripts/mod_featureInfo.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfo.php 2008-11-12 08:48:37 UTC (rev 3223)
+++ trunk/mapbender/http/javascripts/mod_featureInfo.php 2008-11-12 08:50:12 UTC (rev 3224)
@@ -18,16 +18,28 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+//defaults for element vars
?>
+if(typeof(featureInfoLayerPopup)==='undefined')
+ var featureInfoLayerPopup = 'false';
+if(typeof(featureInfoPopupHeight)==='undefined')
+ var featureInfoPopupHeight = '200';
+if(typeof(featureInfoPopupWidth)==='undefined')
+ var featureInfoPopupWidth = '270';
+
var mod_featureInfo_elName = "featureInfo1";
var mod_featureInfo_frameName = "";
var mod_featureInfo_target = "<?php echo $e_target[0]; ?>";
+var mod_featureInfo_mapObj = null;
var mod_featureInfo_img_on = new Image(); mod_featureInfo_img_on.src = "<?php echo preg_replace("/_off/","_on",$e_src); ?>";
var mod_featureInfo_img_off = new Image(); mod_featureInfo_img_off.src ="<?php echo $e_src; ?>";
var mod_featureInfo_img_over = new Image(); mod_featureInfo_img_over.src = "<?php echo preg_replace("/_off/","_over",$e_src); ?>";
function init_featureInfo1(ind){
+ mod_featureInfo_mapObj = getMapObjByName(mod_featureInfo_target);
+
mb_button[ind] = document.getElementById(mod_featureInfo_elName);
mb_button[ind].img_over = mod_featureInfo_img_over.src;
mb_button[ind].img_on = mod_featureInfo_img_on.src;
@@ -39,19 +51,45 @@
mb_button[ind].stop = new Function ("mod_featureInfo_disable()");
}
function mod_featureInfo_click(){
- window.frames[mod_featureInfo_target].document.onclick = mod_featureInfo_event;
+ mod_featureInfo_mapObj.getDomElement().onclick = mod_featureInfo_event;
}
function mod_featureInfo_disable(){
- window.frames[mod_featureInfo_target].document.onclick = null;
+ mod_featureInfo_mapObj.getDomElement().onclick = null;
}
function mod_featureInfo_event(e){
- if(ie){
- clickX = window.frames[mod_featureInfo_target].event.clientX;
- clickY = window.frames[mod_featureInfo_target].event.clientY;
+ var point = mod_featureInfo_mapObj.getMousePos(e);
+
+ eventBeforeFeatureInfo.trigger({"fName":mod_featureInfo_target});
+
+//TODO that code should go to featureInfo Redirect module
+ if(document.getElementById("FeatureInfoRedirect")){
+ //fill the frames
+ for(var i=0; i<mod_featureInfo_mapObj.wms.length; i++){
+ var req = mod_featureInfo_mapObj.wms[i].getFeatureInfoRequest(mod_featureInfo_mapObj, point);
+ if(req)
+ window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfo_mapObj.wms[i].wms_id).src = req;
+ }
}
else{
- clickX = e.pageX;
- clickY = e.pageY;
+ urls = mod_featureInfo_mapObj.getFeatureInfoRequests(point);
+ if(urls){
+ for(var i=0;i<urls.length;i++){
+ if(featureInfoLayerPopup == 'true'){
+ var p = new mb_popup({
+ title:<?php echo _mb("Informations");?>,
+ url:urls[i],
+ width:parseInt(featureInfoPopupWidth, 10),
+ height:parseInt(featureInfoPopupHeight, 10),
+ top:200,
+ left:600
+ });
+ }
+ else
+ window.open(urls[i], "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+ }
+ }
+ else
+ alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
}
setFeatureInfoRequest(mod_featureInfo_target,clickX,clickY);
-}
\ No newline at end of file
+}
Modified: trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php 2008-11-12 08:48:37 UTC (rev 3223)
+++ trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php 2008-11-12 08:50:12 UTC (rev 3224)
@@ -18,7 +18,16 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+include '../include/dyn_js.php';
+//defaults for element vars
?>
+if(typeof(featureInfoLayerPopup)==='undefined')
+ var featureInfoLayerPopup = 'false';
+if(typeof(featureInfoPopupHeight)==='undefined')
+ var featureInfoPopupHeight = '200';
+if(typeof(featureInfoPopupWidth)==='undefined')
+ var featureInfoPopupWidth = '270';
+
var mod_featureInfoTunnel_elName = "featureInfoTunnel";
var mod_featureInfoTunnel_frameName = "";
var mod_featureInfoTunnel_target = "<?php echo $e_target[0]; ?>";
@@ -54,5 +63,41 @@
clickX = e.pageX;
clickY = e.pageY;
}
- setFeatureInfoRequest(mod_featureInfoTunnel_target,clickX,clickY, '../extensions/ext_featureInfoTunnel.php');
-}
\ No newline at end of file
+ eventBeforeFeatureInfo.trigger({"fName":mod_featureInfoTunnel_target});
+
+ var ind = getMapObjIndexByName(mod_featureInfoTunnel_target);
+ var point = new Point(clickX,clickY);
+ var path = '../extensions/ext_featureInfoTunnel.php';
+
+//TODO that code should go to featureInfo Redirect module
+ if(document.getElementById("FeatureInfoRedirect")){
+ //fill the frames
+ for(var i=0; i<mb_mapObj[ind].wms.length; i++){
+ var req = mb_mapObj[ind].wms[i].getFeatureInfoRequest(mb_mapObj[ind], point);
+ if(req)
+ window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[ind].wms[i].wms_id).src = path+"?url="+escape(req);
+ }
+ }
+ else{
+ urls = mb_mapObj[ind].getFeatureInfoRequests(point);
+ if(urls){
+ for(var i=0;i<urls.length;i++){
+ if(featureInfoLayerPopup == 'true'){
+ var p = new mb_popup({
+ title:<?php echo _mb("Informations");?>,
+ url:path+"?url="+escape(urls[i]),
+ width:parseInt(featureInfoPopupWidth, 10),
+ height:parseInt(featureInfoPopupHeight, 10),
+ top:200,
+ left:600
+ });
+ }
+ else
+ window.open(path+"?url="+escape(urls[i]), "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+ }
+ }
+ else
+ alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
+ }
+// setFeatureInfoRequest(mod_featureInfoTunnel_target,clickX,clickY, '../extensions/ext_featureInfoTunnel.php');
+}
More information about the Mapbender_commits
mailing list