[Mapbender-commits] r5818 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Mar 19 11:35:50 EDT 2010


Author: verenadiewald
Date: 2010-03-19 11:35:50 -0400 (Fri, 19 Mar 2010)
New Revision: 5818

Modified:
   trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php
Log:
a progressWheel for featureInfo

Modified: trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php	2010-03-19 15:33:27 UTC (rev 5817)
+++ trunk/mapbender/http/javascripts/mod_featureInfoTunnel.php	2010-03-19 15:35:50 UTC (rev 5818)
@@ -28,7 +28,9 @@
 if(typeof(featureInfoPopupWidth)==='undefined')
 	var featureInfoPopupWidth = '270';
 if(typeof(featureInfoPopupPosition)==='undefined')
-	var featureInfoPopupPosition = 'center';	
+	var featureInfoPopupPosition = 'center';
+if(typeof(featureInfoNoResultPopup)==='undefined')
+	var featureInfoNoResultPopup = 'false';		
 
 var mod_featureInfoTunnel_elName = "featureInfoTunnel";
 var mod_featureInfoTunnel_frameName = "";
@@ -61,9 +63,25 @@
 	mod_featureInfoTunnel_map.getDomElement().onclick = null;
 	mod_featureInfoTunnel_map.getDomElement().style.cursor = "default";
 }
+
+function removeProgressWheel () {
+	$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").empty();
+	$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").css("visibility","hidden");
+}
+
 function mod_featureInfoTunnel_event(e){
+	//mod_featureInfoTunnel_map.getDomElement().ownerDocument.getElementById('permanent').style.left;
 	eventBeforeFeatureInfo.trigger({"fName":mod_featureInfoTunnel_target});
+	
+	//create progress wheel element
+	var map_el = mod_featureInfoTunnel_map.getDomElement();
+	if (!map_el.ownerDocument.getElementById(mod_featureInfoTunnel_map.elementName + "_progressWheel")) {
+		//create progress wheel element
 
+		var $div = $("<div id='" + mod_featureInfoTunnel_map.elementName + "_progressWheel'></div>");
+		map_el.appendChild($div.get(0));
+	}
+
 	var point = mod_featureInfoTunnel_map.getMousePos(e);
 	var path = '../extensions/ext_featureInfoTunnel.php';
 	
@@ -82,32 +100,56 @@
 		if(urls){
 			for(var i=0;i<urls.length;i++){
 				(function () {
+					var currentMapObjWidth = point.x;   
+					var currentMapObjHeight = point.y;  
+					$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").html("<img src='../img/indicator_wheel.gif'/>");
+					$("#" + mod_featureInfoTunnel_map.elementName + "_progressWheel").css({
+						position: "absolute",
+						top: currentMapObjHeight,
+						left: currentMapObjWidth,
+						visibility: "visible",
+						zIndex: 100
+					});
+					window.setTimeout("removeProgressWheel()", 10000);
 					var currentRequest = urls[i];
 					var cnt = i;
+					$(".fiResultFrame").remove();
 					mb_ajax_post(path, {'url':currentRequest},function(js_code,status){
 						if(js_code){
 							if(featureInfoLayerPopup == 'true') {
-								$("<iframe id='featureInfo_"+ i + "' title='<?php echo _mb("Information");?>' src='" + path + "?url=" + encodeURIComponent(currentRequest) + "'></iframe>").dialog({
+								$("<iframe class='fiResultFrame' id='featureInfo_"+ i + "' title='<?php echo _mb("Information");?>' src='" + path + "?url=" + encodeURIComponent(currentRequest) + "'></iframe>").dialog({
 									bgiframe: true,
 									autoOpen: true,
 									modal: false,
 									width:parseInt(featureInfoPopupWidth, 10),
 									height:parseInt(featureInfoPopupHeight, 10),
 									position:featureInfoPopupPosition,
-									buttons: {
-										"Ok": function(){
-											$(this).dialog('close').remove();
-										}
+									close: function() {
+										$(this).remove();
 									}
 								});
+								$(".noResultFound").dialog("close");
 							}
-							else {
-								window.open(path+"?url="+encodeURIComponent(currentRequest), "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+							else{
+								window.open(path+"?url=" + encodeURIComponent(currentRequest), "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
 							}
 						}
-						else{
-                            var e = new Mb_exception("No featureInfo results.");
-                         }
+						
+						if(featureInfoNoResultPopup == 'true' && featureInfoLayerPopup == 'true') {
+							if($(".fiResultFrame").size() === 0) {
+								$(".noResultFound").dialog("close");
+								$("<div class='noResultFound'><?php echo _mb("No result");?></div>").dialog({
+									bgiframe: true,
+									title: "<?php echo _mb("Information");?>",
+									autoOpen: true,
+									modal: false,
+									width:300,
+									height:200,
+									position:[600,200]
+								});
+							}
+						}	
+						removeProgressWheel();
 					});
 				}());
 			}



More information about the Mapbender_commits mailing list