From f57e4aca8fb0fa43f7788f65844509f7ffce4761 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Fri, 30 Jul 2010 13:52:15 -0500 Subject: [PATCH] add method to open modal dialog --- www/extras/admin/admin.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 5fa0334b0..39b5b9b41 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -418,6 +418,35 @@ WebGUI.Admin.prototype.requestHelper var ajax = YAHOO.util.Connect.asyncRequest( 'GET', url, callback ); }; +/** + * openModalDialog( url, width, height ) + * Open a modal dialog with an iframe containing the given URL. + * The page inside the iframe must eventually close the dialog using: + * window.parent.admin.closeModalDialog(); + */ +WebGUI.Admin.prototype.openModalDialog += function ( url, width, height ) { + if ( this.modalDialog ) { + return; // Can't have more than one open + } + + var dialog = YAHOO.widget.Panel( 'adminModalDialog', { + "width" : width, + "height" : height, + fixedcenter : true, + constraintoviewport : true, + underlay : "shadow", + modal : true, + close : false, + visible : true, + draggable : false + } ); + dialog.setBody( '' ); + dialog.render( document.body ); + + this.modalDialog = dialog; +}; + /**************************************************************************** * WebGUI.Admin.LocationBar */