[Mapbender-commits] r3107 - branches/noframes/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Oct 3 09:13:10 EDT 2008


Author: nimix
Date: 2008-10-03 09:13:09 -0400 (Fri, 03 Oct 2008)
New Revision: 3107

Modified:
   branches/noframes/http/javascripts/mod_featureInfo.php
Log:
noframe compartibility

Modified: branches/noframes/http/javascripts/mod_featureInfo.php
===================================================================
--- branches/noframes/http/javascripts/mod_featureInfo.php	2008-10-03 12:53:08 UTC (rev 3106)
+++ branches/noframes/http/javascripts/mod_featureInfo.php	2008-10-03 13:13:09 UTC (rev 3107)
@@ -18,16 +18,29 @@
 # 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 +52,44 @@
 	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



More information about the Mapbender_commits mailing list