/************************************************************************************************************ * DHTML modal dialog box * Created: August, 26th, 2006 * @class Purpose of class: Display a modal dialog box on the screen. ************************************************************************************************************/ /** * @constructor */ DHTML_modalMessage = function() { this.url = ''; // Default url is blank this.htmlOfModalMessage = ''; // Default message is blank this.height = 200; // Default height of modal message this.width = 400; // Default width of modal message this.shadowDivVisible = true; // Shadow div is visible by default this.shadowOffset = 5; // Default shadow offset. this.popMsg=false; // indicates that there is no (error)-message displayed yet this.msgCanResize=true; // when showing (error)-messages the dialog can be resized } DHTML_modalMessage.prototype = { /** * Set source of the modal dialog box * * @public */ setSource : function(urlOfSource) { this.url = urlOfSource; } , /** * Setting static HTML content for the modal dialog box. * * @param String newHtmlContent = Static HTML content of box * * @public */ setHtmlContent : function(newHtmlContent) { this.htmlOfModalMessage = newHtmlContent; if(this.divs_content) { this.__resizeDivs(); } } , /** * Set the size of the modal dialog box * * @param int width = width of box * @param int height = height of box * * @public */ setSize : function(width,height) { if(width)this.width = width; if(height)this.height = height; } , /** * Specify the size of shadow * * @param Int newShadowOffset = Offset of shadow div(in pixels from message box - x and y) * * @public */ setShadowOffset : function(newShadowOffset) { this.shadowOffset = newShadowOffset } , /** * Display the modal dialog box * * @public */ display : function(fast) { this.__createDivs(); // Redisplaying divs if(fast) { $("modalDialog_transparentDivs").display='block'; } else { fadeIn("modalDialog_transparentDivs",0,0.5); } if(this.shadowDivVisible) { this.divs_shadow.style.display='block'; } if(runningInIE()) { this.iframe.style.display='block'; } this.__resizeDivs(); /* Call the __resizeDivs method twice in case the css file has changed. The first execution of this method may not catch these changes */ window.refToThisModalBoxObj = this; setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150); this.__insertContent(); // Calling method which inserts content into the message div. } , /** * Display the modal dialog box * * @public */ setShadowDivVisible : function(visible) { this.shadowDivVisible = visible; } , /** * Close the modal dialog box * @param fast - optional, if true no fading is applied * @public */ close : function(fast) { //document.documentElement.style.overflow = ''; // Setting the CSS overflow attribute of the tag back to default. /* Hiding divs */ if(runningInIE() || (typeof fast != "undefined" && fast==true)) { secureRemove(this.divs_transparentDiv); } else { fadeOut("modalDialog_transparentDivs",0.5,0); setTimeout("secureRemove('modalDialog_transparentDivs')",600); } secureRemove(this.divs_content); secureRemove(this.divs_shadow); secureRemove(this.iframe); secureRemove("popup_msg_div"); secureRemove("dialogWrapperDiv"); } , /** * Add event * * @private */ addEvent : function(whichObject,eventType,functionName,suffix) { if(!suffix)suffix = ''; if(whichObject.attachEvent){ whichObject['e'+eventType+functionName+suffix] = functionName; whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); } else whichObject.addEventListener(eventType,functionName,false); } , /** * Create the divs for the modal dialog box * * @private */ __createDivs : function() { // Creating transparent div this.divs_transparentDiv = document.createElement('DIV'); this.divs_transparentDiv.className='modalDialog_transparentDivs'; this.divs_transparentDiv.id='modalDialog_transparentDivs'; this.divs_transparentDiv.style.left = '0px'; this.divs_transparentDiv.style.top = '0px'; document.body.appendChild(this.divs_transparentDiv); // Creating content div this.divs_content = document.createElement('DIV'); this.divs_content.className = 'modalDialog_contentDiv'; this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv'; this.divs_content.style.zIndex = 900; if(runningInIE()){ this.iframe = document.createElement('