[Mapbender-commits] r3097 - branches/nimix_dev/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Oct 2 11:27:36 EDT 2008


Author: nimix
Date: 2008-10-02 11:27:36 -0400 (Thu, 02 Oct 2008)
New Revision: 3097

Modified:
   branches/nimix_dev/http/javascripts/popup.js
Log:
implement modal state dialogues

Modified: branches/nimix_dev/http/javascripts/popup.js
===================================================================
--- branches/nimix_dev/http/javascripts/popup.js	2008-10-02 15:26:18 UTC (rev 3096)
+++ branches/nimix_dev/http/javascripts/popup.js	2008-10-02 15:27:36 UTC (rev 3097)
@@ -37,6 +37,7 @@
  *  resizeable: allow user to change the size default:true
  *  dragable: allow user to move the window default:true
  *  balloon: balloon popup from top, left (disables resizeable and dragable)
+ *  modal: create modal popup default:false
  * 
  * @param {String} html the "body" of the popup, can also be "url:http://foo.de" to display a website
  * @param {Number} width width of the popup
@@ -115,6 +116,7 @@
 mb_popup.prototype.hide = function(){	
 	$("#"+this.id).hide();
 	$("#balloon_"+this.id).hide();
+	$("#modal_mouse_catcher").remove();
 }
 
 /**
@@ -123,6 +125,7 @@
 mb_popup.prototype.destroy = function(){	
 	$("#"+this.id).remove();
 	$("#balloon_"+this.id).remove();
+	$("#modal_mouse_catcher").remove();
 }
 
 /**
@@ -326,7 +329,7 @@
 			minTop:"document",minLeft:"document",
 			maxRight:false,maxBottom:false,
 			dragable:true,resizeable:true,balloon:false,
-			style:null,destroy:true,
+			style:null,destroy:true,modal:false,
 			closeCallback:null
 		};
 		//override defaults
@@ -353,7 +356,7 @@
 		//set balloon arm position
 		if(settings.balloon){
 			$("#balloon_"+settings.id).attr("class", "balloon"+(pos.position>=2?"B":"T")+(pos.position%2?"R":"L"))
-				.css({"z-index":(popup_top++),visibility:"visible",left:pos.bX,top:pos.bY});
+				.css({"z-index":(popup_top),visibility:"visible",left:pos.bX,top:pos.bY});
 			settings.left = pos.pX;
 			settings.top = pos.pY;
 		}
@@ -383,7 +386,7 @@
 		var data = {El:this,fY:settings.minTop,fX:settings.minLeft,tX:settings.maxRight,tY:settings.maxBottom,
 			fW:settings.minWidth,tW:settings.maxWidth,fH:settings.minHeight,tH:settings.maxHeight,
 			destroy:settings.destroy,opacity:settings.opacity,moveOpacity:settings.moveOpacity,close:settings.closeCallback}
-
+		
 		//Make window Dragable
 		if(settings.dragable)
 			$(".Drag", this).bind('mousedown',data,function(event){
@@ -419,9 +422,10 @@
 			});
 		
 		//closeButton
-		$(".Close", this).bind('click',data, function(event){
+		this.closePopup = function(event){
 			if(event.data.close)
 				event.data.close();
+			$("#modal_mouse_catcher").remove();
 			if(event.data.destroy){
 				event.data.El.slideUp('slow', function(){$(this).remove();});
 				$("#balloon_"+event.data.El.attr("id")).remove();
@@ -430,8 +434,15 @@
 				event.data.El.slideUp('slow');
 				$("#balloon_"+event.data.El.attr("id")).fadeOut();
 			}
-		});
+		};
+		$(".Close", this).bind('click',data, this.closePopup);
 		
+		//create div to make window modal
+		if(settings.modal){
+			$("body").append("<div style=\"position:absolute;top:0px;left:0px;width:"+$().width()+"px;height:"+$().height()+"px;z-index:"+(popup_top-1)+($.browser.msie?";background:url(../img/transparent.gif)":"")+"\" id=\"modal_mouse_catcher\"></div>");
+			$("#modal_mouse_catcher").bind('click',data, this.closePopup);
+		}
+
 		//raise on click
 		this.click(function(){this.style.zIndex=popup_top++;$("#balloon_"+this.id).css("z-index", popup_top++);});
 		$("#balloon_"+settings.id).click(function(){$("#"+this.id.substr(8)).css("z-index", popup_top++);this.style.zIndex=popup_top++;});



More information about the Mapbender_commits mailing list