Upgrade to ExtJS 3.2.0 - Released 03/30/2010
[extjs.git] / pkgs / window-debug.js
index b8a3085..e1cbf3a 100644 (file)
@@ -1,6 +1,6 @@
 /*!
- * Ext JS Library 3.1.1
- * Copyright(c) 2006-2010 Ext JS, LLC
+ * Ext JS Library 3.2.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
@@ -331,8 +331,12 @@ Ext.Window = Ext.extend(Ext.Panel, {
 
     initDraggable : function(){
         /**
-         * If this Window is configured {@link #draggable}, this property will contain
-         * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.
+         * <p>If this Window is configured {@link #draggable}, this property will contain
+         * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.</p>
+         * <p>This has implementations of <code>startDrag</code>, <code>onDrag</code> and <code>endDrag</code>
+         * which perform the dragging action. If extra logic is needed at these points, use
+         * {@link Function#createInterceptor createInterceptor} or {@link Function#createSequence createSequence} to
+         * augment the existing implementations.</p>
          * @type Ext.dd.DD
          * @property dd
          */
@@ -347,12 +351,9 @@ Ext.Window = Ext.extend(Ext.Panel, {
 
     // private
     beforeDestroy : function(){
-        if (this.rendered){
+        if(this.rendered){
             this.hide();
-          if(this.doAnchor){
-                Ext.EventManager.removeResizeListener(this.doAnchor, this);
-              Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
-            }
+            this.clearAnchor();
             Ext.destroy(
                 this.focusEl,
                 this.resizer,
@@ -429,11 +430,13 @@ Ext.Window = Ext.extend(Ext.Panel, {
             this.updateBox(box);
         }else{
             this.setSize(box);
+            if (Ext.isIE6 && Ext.isStrict) {
+                this.doLayout();
+            }
         }
         this.focus();
         this.updateHandles();
         this.saveState();
-        this.doLayout();
     },
 
     /**
@@ -441,7 +444,11 @@ Ext.Window = Ext.extend(Ext.Panel, {
      * window itself will receive focus.
      */
     focus : function(){
-        var f = this.focusEl, db = this.defaultButton, t = typeof db;
+        var f = this.focusEl,
+            db = this.defaultButton,
+            t = typeof db,
+            el,
+            ct;
         if(Ext.isDefined(db)){
             if(Ext.isNumber(db) && this.fbar){
                 f = this.fbar.items.get(db);
@@ -450,6 +457,13 @@ Ext.Window = Ext.extend(Ext.Panel, {
             }else{
                 f = db;
             }
+            el = f.getEl();
+            ct = Ext.getDom(this.container);
+            if (el && ct) {
+                if (!Ext.lib.Region.getRegion(ct).contains(Ext.lib.Region.getRegion(el.dom))){
+                    return;
+                }
+            }
         }
         f = f || this.focusEl;
         f.focus.defer(10, f);
@@ -700,7 +714,7 @@ Ext.Window = Ext.extend(Ext.Panel, {
         }
         if(show !== false){
             this.el.show();
-            this.focus();
+            this.focus.defer(10, this);
             if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
                 this.cascade(this.setAutoScroll);
             }
@@ -874,21 +888,44 @@ Ext.Window = Ext.extend(Ext.Panel, {
      * @return {Ext.Window} this
      */
     anchorTo : function(el, alignment, offsets, monitorScroll){
-      if(this.doAnchor){
-          Ext.EventManager.removeResizeListener(this.doAnchor, this);
-          Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
-      }
-      this.doAnchor = function(){
-          this.alignTo(el, alignment, offsets);
-      };
-      Ext.EventManager.onWindowResize(this.doAnchor, this);
-
-      var tm = typeof monitorScroll;
-      if(tm != 'undefined'){
-          Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
-              {buffer: tm == 'number' ? monitorScroll : 50});
-      }
-      return this;
+        this.clearAnchor();
+        this.anchorTarget = {
+            el: el,
+            alignment: alignment,
+            offsets: offsets
+        };
+
+        Ext.EventManager.onWindowResize(this.doAnchor, this);
+        var tm = typeof monitorScroll;
+        if(tm != 'undefined'){
+            Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
+                {buffer: tm == 'number' ? monitorScroll : 50});
+        }
+        return this.doAnchor();
+    },
+
+    /**
+     * Performs the anchor, using the saved anchorTarget property.
+     * @return {Ext.Window} this
+     * @private
+     */
+    doAnchor : function(){
+        var o = this.anchorTarget;
+        this.alignTo(o.el, o.alignment, o.offsets);
+        return this;
+    },
+
+    /**
+     * Removes any existing anchor from this window. See {@link #anchorTo}.
+     * @return {Ext.Window} this
+     */
+    clearAnchor : function(){
+        if(this.anchorTarget){
+            Ext.EventManager.removeResizeListener(this.doAnchor, this);
+            Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
+            delete this.anchorTarget;
+        }
+        return this;
     },
 
     /**
@@ -1183,791 +1220,791 @@ MyDesktop.getDesktop().getManager().register(msgWin);
  * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
  * @singleton
  */
-Ext.WindowMgr = new Ext.WindowGroup();/**\r
- * @class Ext.MessageBox\r
- * <p>Utility class for generating different styles of message boxes.  The alias Ext.Msg can also be used.<p/>\r
- * <p>Note that the MessageBox is asynchronous.  Unlike a regular JavaScript <code>alert</code> (which will halt\r
- * browser execution), showing a MessageBox will not cause the code to stop.  For this reason, if you have code\r
- * that should only run <em>after</em> some user feedback from the MessageBox, you must use a callback function\r
- * (see the <code>function</code> parameter for {@link #show} for more details).</p>\r
- * <p>Example usage:</p>\r
- *<pre><code>\r
-// Basic alert:\r
-Ext.Msg.alert('Status', 'Changes saved successfully.');\r
-\r
-// Prompt for user data and process the result using a callback:\r
-Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){\r
-    if (btn == 'ok'){\r
-        // process text value and close...\r
-    }\r
-});\r
-\r
-// Show a dialog using config options:\r
-Ext.Msg.show({\r
-   title:'Save Changes?',\r
-   msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',\r
-   buttons: Ext.Msg.YESNOCANCEL,\r
-   fn: processResult,\r
-   animEl: 'elId',\r
-   icon: Ext.MessageBox.QUESTION\r
-});\r
-</code></pre>\r
- * @singleton\r
- */\r
-Ext.MessageBox = function(){\r
-    var dlg, opt, mask, waitTimer,\r
-        bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl,\r
-        buttons, activeTextEl, bwidth, bufferIcon = '', iconCls = '',\r
-        buttonNames = ['ok', 'yes', 'no', 'cancel'];\r
-\r
-    // private\r
-    var handleButton = function(button){\r
-        buttons[button].blur();\r
-        if(dlg.isVisible()){\r
-            dlg.hide();\r
-            handleHide();\r
-            Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1);\r
-        }\r
-    };\r
-\r
-    // private\r
-    var handleHide = function(){\r
-        if(opt && opt.cls){\r
-            dlg.el.removeClass(opt.cls);\r
-        }\r
-        progressBar.reset();        \r
-    };\r
-\r
-    // private\r
-    var handleEsc = function(d, k, e){\r
-        if(opt && opt.closable !== false){\r
-            dlg.hide();\r
-            handleHide();\r
-        }\r
-        if(e){\r
-            e.stopEvent();\r
-        }\r
-    };\r
-\r
-    // private\r
-    var updateButtons = function(b){\r
-        var width = 0,\r
-            cfg;\r
-        if(!b){\r
-            Ext.each(buttonNames, function(name){\r
-                buttons[name].hide();\r
-            });\r
-            return width;\r
-        }\r
-        dlg.footer.dom.style.display = '';\r
-        Ext.iterate(buttons, function(name, btn){\r
-            cfg = b[name];\r
-            if(cfg){\r
-                btn.show();\r
-                btn.setText(Ext.isString(cfg) ? cfg : Ext.MessageBox.buttonText[name]);\r
-                width += btn.getEl().getWidth() + 15;\r
-            }else{\r
-                btn.hide();\r
-            }\r
-        });\r
-        return width;\r
-    };\r
-\r
-    return {\r
-        /**\r
-         * Returns a reference to the underlying {@link Ext.Window} element\r
-         * @return {Ext.Window} The window\r
-         */\r
-        getDialog : function(titleText){\r
-           if(!dlg){\r
-                var btns = [];\r
-                \r
-                buttons = {};\r
-                Ext.each(buttonNames, function(name){\r
-                    btns.push(buttons[name] = new Ext.Button({\r
-                        text: this.buttonText[name],\r
-                        handler: handleButton.createCallback(name),\r
-                        hideMode: 'offsets'\r
-                    }));\r
-                }, this);\r
-                dlg = new Ext.Window({\r
-                    autoCreate : true,\r
-                    title:titleText,\r
-                    resizable:false,\r
-                    constrain:true,\r
-                    constrainHeader:true,\r
-                    minimizable : false,\r
-                    maximizable : false,\r
-                    stateful: false,\r
-                    modal: true,\r
-                    shim:true,\r
-                    buttonAlign:"center",\r
-                    width:400,\r
-                    height:100,\r
-                    minHeight: 80,\r
-                    plain:true,\r
-                    footer:true,\r
-                    closable:true,\r
-                    close : function(){\r
-                        if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){\r
-                            handleButton("no");\r
-                        }else{\r
-                            handleButton("cancel");\r
-                        }\r
-                    },\r
-                    fbar: new Ext.Toolbar({\r
-                        items: btns,\r
-                        enableOverflow: false\r
-                    })\r
-                });\r
-                dlg.render(document.body);\r
-                dlg.getEl().addClass('x-window-dlg');\r
-                mask = dlg.mask;\r
-                bodyEl = dlg.body.createChild({\r
-                    html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'\r
-                });\r
-                iconEl = Ext.get(bodyEl.dom.firstChild);\r
-                var contentEl = bodyEl.dom.childNodes[1];\r
-                msgEl = Ext.get(contentEl.firstChild);\r
-                textboxEl = Ext.get(contentEl.childNodes[2].firstChild);\r
-                textboxEl.enableDisplayMode();\r
-                textboxEl.addKeyListener([10,13], function(){\r
-                    if(dlg.isVisible() && opt && opt.buttons){\r
-                        if(opt.buttons.ok){\r
-                            handleButton("ok");\r
-                        }else if(opt.buttons.yes){\r
-                            handleButton("yes");\r
-                        }\r
-                    }\r
-                });\r
-                textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);\r
-                textareaEl.enableDisplayMode();\r
-                progressBar = new Ext.ProgressBar({\r
-                    renderTo:bodyEl\r
-                });\r
-               bodyEl.createChild({cls:'x-clear'});\r
-            }\r
-            return dlg;\r
-        },\r
-\r
-        /**\r
-         * Updates the message box body text\r
-         * @param {String} text (optional) Replaces the message box element's innerHTML with the specified string (defaults to\r
-         * the XHTML-compliant non-breaking space character '&amp;#160;')\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        updateText : function(text){\r
-            if(!dlg.isVisible() && !opt.width){\r
-                dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows\r
-            }\r
-            msgEl.update(text || '&#160;');\r
-\r
-            var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0,\r
-                mw = msgEl.getWidth() + msgEl.getMargins('lr'),\r
-                fw = dlg.getFrameWidth('lr'),\r
-                bw = dlg.body.getFrameWidth('lr'),\r
-                w;\r
-                \r
-            if (Ext.isIE && iw > 0){\r
-                //3 pixels get subtracted in the icon CSS for an IE margin issue,\r
-                //so we have to add it back here for the overall width to be consistent\r
-                iw += 3;\r
-            }\r
-            w = Math.max(Math.min(opt.width || iw+mw+fw+bw, opt.maxWidth || this.maxWidth),\r
-                    Math.max(opt.minWidth || this.minWidth, bwidth || 0));\r
-\r
-            if(opt.prompt === true){\r
-                activeTextEl.setWidth(w-iw-fw-bw);\r
-            }\r
-            if(opt.progress === true || opt.wait === true){\r
-                progressBar.setSize(w-iw-fw-bw);\r
-            }\r
-            if(Ext.isIE && w == bwidth){\r
-                w += 4; //Add offset when the content width is smaller than the buttons.    \r
-            }\r
-            dlg.setSize(w, 'auto').center();\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Updates a progress-style message box's text and progress bar. Only relevant on message boxes\r
-         * initiated via {@link Ext.MessageBox#progress} or {@link Ext.MessageBox#wait},\r
-         * or by calling {@link Ext.MessageBox#show} with progress: true.\r
-         * @param {Number} value Any number between 0 and 1 (e.g., .5, defaults to 0)\r
-         * @param {String} progressText The progress text to display inside the progress bar (defaults to '')\r
-         * @param {String} msg The message box's body text is replaced with the specified string (defaults to undefined\r
-         * so that any existing body text will not get overwritten by default unless a new value is passed in)\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        updateProgress : function(value, progressText, msg){\r
-            progressBar.updateProgress(value, progressText);\r
-            if(msg){\r
-                this.updateText(msg);\r
-            }\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Returns true if the message box is currently displayed\r
-         * @return {Boolean} True if the message box is visible, else false\r
-         */\r
-        isVisible : function(){\r
-            return dlg && dlg.isVisible();\r
-        },\r
-\r
-        /**\r
-         * Hides the message box if it is displayed\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        hide : function(){\r
-            var proxy = dlg ? dlg.activeGhost : null;\r
-            if(this.isVisible() || proxy){\r
-                dlg.hide();\r
-                handleHide();\r
-                if (proxy){\r
-                    // unghost is a private function, but i saw no better solution\r
-                    // to fix the locking problem when dragging while it closes\r
-                    dlg.unghost(false, false);\r
-                } \r
-            }\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Displays a new message box, or reinitializes an existing message box, based on the config options\r
-         * passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,\r
-         * although those calls are basic shortcuts and do not support all of the config options allowed here.\r
-         * @param {Object} config The following config options are supported: <ul>\r
-         * <li><b>animEl</b> : String/Element<div class="sub-desc">An id or Element from which the message box should animate as it\r
-         * opens and closes (defaults to undefined)</div></li>\r
-         * <li><b>buttons</b> : Object/Boolean<div class="sub-desc">A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',\r
-         * cancel:'Bar'}), or false to not show any buttons (defaults to false)</div></li>\r
-         * <li><b>closable</b> : Boolean<div class="sub-desc">False to hide the top-right close button (defaults to true). Note that\r
-         * progress and wait dialogs will ignore this property and always hide the close button as they can only\r
-         * be closed programmatically.</div></li>\r
-         * <li><b>cls</b> : String<div class="sub-desc">A custom CSS class to apply to the message box's container element</div></li>\r
-         * <li><b>defaultTextHeight</b> : Number<div class="sub-desc">The default height in pixels of the message box's multiline textarea\r
-         * if displayed (defaults to 75)</div></li>\r
-         * <li><b>fn</b> : Function<div class="sub-desc">A callback function which is called when the dialog is dismissed either\r
-         * by clicking on the configured buttons, or on the dialog close button, or by pressing\r
-         * the return button to enter input.\r
-         * <p>Progress and wait dialogs will ignore this option since they do not respond to user\r
-         * actions and can only be closed programmatically, so any required function should be called\r
-         * by the same code after it closes the dialog. Parameters passed:<ul>\r
-         * <li><b>buttonId</b> : String<div class="sub-desc">The ID of the button pressed, one of:<div class="sub-desc"><ul>\r
-         * <li><tt>ok</tt></li>\r
-         * <li><tt>yes</tt></li>\r
-         * <li><tt>no</tt></li>\r
-         * <li><tt>cancel</tt></li>\r
-         * </ul></div></div></li>\r
-         * <li><b>text</b> : String<div class="sub-desc">Value of the input field if either <tt><a href="#show-option-prompt" ext:member="show-option-prompt" ext:cls="Ext.MessageBox">prompt</a></tt>\r
-         * or <tt><a href="#show-option-multiline" ext:member="show-option-multiline" ext:cls="Ext.MessageBox">multiline</a></tt> is true</div></li>\r
-         * <li><b>opt</b> : Object<div class="sub-desc">The config object passed to show.</div></li>\r
-         * </ul></p></div></li>\r
-         * <li><b>scope</b> : Object<div class="sub-desc">The scope of the callback function</div></li>\r
-         * <li><b>icon</b> : String<div class="sub-desc">A CSS class that provides a background image to be used as the body icon for the\r
-         * dialog (e.g. Ext.MessageBox.WARNING or 'custom-class') (defaults to '')</div></li>\r
-         * <li><b>iconCls</b> : String<div class="sub-desc">The standard {@link Ext.Window#iconCls} to\r
-         * add an optional header icon (defaults to '')</div></li>\r
-         * <li><b>maxWidth</b> : Number<div class="sub-desc">The maximum width in pixels of the message box (defaults to 600)</div></li>\r
-         * <li><b>minWidth</b> : Number<div class="sub-desc">The minimum width in pixels of the message box (defaults to 100)</div></li>\r
-         * <li><b>modal</b> : Boolean<div class="sub-desc">False to allow user interaction with the page while the message box is\r
-         * displayed (defaults to true)</div></li>\r
-         * <li><b>msg</b> : String<div class="sub-desc">A string that will replace the existing message box body text (defaults to the\r
-         * XHTML-compliant non-breaking space character '&amp;#160;')</div></li>\r
-         * <li><a id="show-option-multiline"></a><b>multiline</b> : Boolean<div class="sub-desc">\r
-         * True to prompt the user to enter multi-line text (defaults to false)</div></li>\r
-         * <li><b>progress</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>\r
-         * <li><b>progressText</b> : String<div class="sub-desc">The text to display inside the progress bar if progress = true (defaults to '')</div></li>\r
-         * <li><a id="show-option-prompt"></a><b>prompt</b> : Boolean<div class="sub-desc">True to prompt the user to enter single-line text (defaults to false)</div></li>\r
-         * <li><b>proxyDrag</b> : Boolean<div class="sub-desc">True to display a lightweight proxy while dragging (defaults to false)</div></li>\r
-         * <li><b>title</b> : String<div class="sub-desc">The title text</div></li>\r
-         * <li><b>value</b> : String<div class="sub-desc">The string value to set into the active textbox element if displayed</div></li>\r
-         * <li><b>wait</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>\r
-         * <li><b>waitConfig</b> : Object<div class="sub-desc">A {@link Ext.ProgressBar#waitConfig} object (applies only if wait = true)</div></li>\r
-         * <li><b>width</b> : Number<div class="sub-desc">The width of the dialog in pixels</div></li>\r
-         * </ul>\r
-         * Example usage:\r
-         * <pre><code>\r
-Ext.Msg.show({\r
-   title: 'Address',\r
-   msg: 'Please enter your address:',\r
-   width: 300,\r
-   buttons: Ext.MessageBox.OKCANCEL,\r
-   multiline: true,\r
-   fn: saveAddress,\r
-   animEl: 'addAddressBtn',\r
-   icon: Ext.MessageBox.INFO\r
-});\r
-</code></pre>\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        show : function(options){\r
-            if(this.isVisible()){\r
-                this.hide();\r
-            }\r
-            opt = options;\r
-            var d = this.getDialog(opt.title || "&#160;");\r
-\r
-            d.setTitle(opt.title || "&#160;");\r
-            var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);\r
-            d.tools.close.setDisplayed(allowClose);\r
-            activeTextEl = textboxEl;\r
-            opt.prompt = opt.prompt || (opt.multiline ? true : false);\r
-            if(opt.prompt){\r
-                if(opt.multiline){\r
-                    textboxEl.hide();\r
-                    textareaEl.show();\r
-                    textareaEl.setHeight(Ext.isNumber(opt.multiline) ? opt.multiline : this.defaultTextHeight);\r
-                    activeTextEl = textareaEl;\r
-                }else{\r
-                    textboxEl.show();\r
-                    textareaEl.hide();\r
-                }\r
-            }else{\r
-                textboxEl.hide();\r
-                textareaEl.hide();\r
-            }\r
-            activeTextEl.dom.value = opt.value || "";\r
-            if(opt.prompt){\r
-                d.focusEl = activeTextEl;\r
-            }else{\r
-                var bs = opt.buttons;\r
-                var db = null;\r
-                if(bs && bs.ok){\r
-                    db = buttons["ok"];\r
-                }else if(bs && bs.yes){\r
-                    db = buttons["yes"];\r
-                }\r
-                if (db){\r
-                    d.focusEl = db;\r
-                }\r
-            }\r
-            if(opt.iconCls){\r
-              d.setIconClass(opt.iconCls);\r
-            }\r
-            this.setIcon(Ext.isDefined(opt.icon) ? opt.icon : bufferIcon);\r
-            bwidth = updateButtons(opt.buttons);\r
-            progressBar.setVisible(opt.progress === true || opt.wait === true);\r
-            this.updateProgress(0, opt.progressText);\r
-            this.updateText(opt.msg);\r
-            if(opt.cls){\r
-                d.el.addClass(opt.cls);\r
-            }\r
-            d.proxyDrag = opt.proxyDrag === true;\r
-            d.modal = opt.modal !== false;\r
-            d.mask = opt.modal !== false ? mask : false;\r
-            if(!d.isVisible()){\r
-                // force it to the end of the z-index stack so it gets a cursor in FF\r
-                document.body.appendChild(dlg.el.dom);\r
-                d.setAnimateTarget(opt.animEl);\r
-                //workaround for window internally enabling keymap in afterShow\r
-                d.on('show', function(){\r
-                    if(allowClose === true){\r
-                        d.keyMap.enable();\r
-                    }else{\r
-                        d.keyMap.disable();\r
-                    }\r
-                }, this, {single:true});\r
-                d.show(opt.animEl);\r
-            }\r
-            if(opt.wait === true){\r
-                progressBar.wait(opt.waitConfig);\r
-            }\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Adds the specified icon to the dialog.  By default, the class 'ext-mb-icon' is applied for default\r
-         * styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')\r
-         * to clear any existing icon. This method must be called before the MessageBox is shown.\r
-         * The following built-in icon classes are supported, but you can also pass in a custom class name:\r
-         * <pre>\r
-Ext.MessageBox.INFO\r
-Ext.MessageBox.WARNING\r
-Ext.MessageBox.QUESTION\r
-Ext.MessageBox.ERROR\r
-         *</pre>\r
-         * @param {String} icon A CSS classname specifying the icon's background image url, or empty string to clear the icon\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        setIcon : function(icon){\r
-            if(!dlg){\r
-                bufferIcon = icon;\r
-                return;\r
-            }\r
-            bufferIcon = undefined;\r
-            if(icon && icon != ''){\r
-                iconEl.removeClass('x-hidden');\r
-                iconEl.replaceClass(iconCls, icon);\r
-                bodyEl.addClass('x-dlg-icon');\r
-                iconCls = icon;\r
-            }else{\r
-                iconEl.replaceClass(iconCls, 'x-hidden');\r
-                bodyEl.removeClass('x-dlg-icon');\r
-                iconCls = '';\r
-            }\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Displays a message box with a progress bar.  This message box has no buttons and is not closeable by\r
-         * the user.  You are responsible for updating the progress bar as needed via {@link Ext.MessageBox#updateProgress}\r
-         * and closing the message box when the process is complete.\r
-         * @param {String} title The title bar text\r
-         * @param {String} msg The message box body text\r
-         * @param {String} progressText (optional) The text to display inside the progress bar (defaults to '')\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        progress : function(title, msg, progressText){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: false,\r
-                progress:true,\r
-                closable:false,\r
-                minWidth: this.minProgressWidth,\r
-                progressText: progressText\r
-            });\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Displays a message box with an infinitely auto-updating progress bar.  This can be used to block user\r
-         * interaction while waiting for a long-running process to complete that does not have defined intervals.\r
-         * You are responsible for closing the message box when the process is complete.\r
-         * @param {String} msg The message box body text\r
-         * @param {String} title (optional) The title bar text\r
-         * @param {Object} config (optional) A {@link Ext.ProgressBar#waitConfig} object\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        wait : function(msg, title, config){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: false,\r
-                closable:false,\r
-                wait:true,\r
-                modal:true,\r
-                minWidth: this.minProgressWidth,\r
-                waitConfig: config\r
-            });\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).\r
-         * If a callback function is passed it will be called after the user clicks the button, and the\r
-         * id of the button that was clicked will be passed as the only parameter to the callback\r
-         * (could also be the top-right close button).\r
-         * @param {String} title The title bar text\r
-         * @param {String} msg The message box body text\r
-         * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
-         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        alert : function(title, msg, fn, scope){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: this.OK,\r
-                fn: fn,\r
-                scope : scope,\r
-                minWidth: this.minWidth\r
-            });\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).\r
-         * If a callback function is passed it will be called after the user clicks either button,\r
-         * and the id of the button that was clicked will be passed as the only parameter to the callback\r
-         * (could also be the top-right close button).\r
-         * @param {String} title The title bar text\r
-         * @param {String} msg The message box body text\r
-         * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
-         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        confirm : function(title, msg, fn, scope){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: this.YESNO,\r
-                fn: fn,\r
-                scope : scope,\r
-                icon: this.QUESTION,\r
-                minWidth: this.minWidth\r
-            });\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).\r
-         * The prompt can be a single-line or multi-line textbox.  If a callback function is passed it will be called after the user\r
-         * clicks either button, and the id of the button that was clicked (could also be the top-right\r
-         * close button) and the text that was entered will be passed as the two parameters to the callback.\r
-         * @param {String} title The title bar text\r
-         * @param {String} msg The message box body text\r
-         * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
-         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.\r
-         * @param {Boolean/Number} multiline (optional) True to create a multiline textbox using the defaultTextHeight\r
-         * property, or the height in pixels to create the textbox (defaults to false / single-line)\r
-         * @param {String} value (optional) Default value of the text input element (defaults to '')\r
-         * @return {Ext.MessageBox} this\r
-         */\r
-        prompt : function(title, msg, fn, scope, multiline, value){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: this.OKCANCEL,\r
-                fn: fn,\r
-                minWidth: this.minPromptWidth,\r
-                scope : scope,\r
-                prompt:true,\r
-                multiline: multiline,\r
-                value: value\r
-            });\r
-            return this;\r
-        },\r
-\r
-        /**\r
-         * Button config that displays a single OK button\r
-         * @type Object\r
-         */\r
-        OK : {ok:true},\r
-        /**\r
-         * Button config that displays a single Cancel button\r
-         * @type Object\r
-         */\r
-        CANCEL : {cancel:true},\r
-        /**\r
-         * Button config that displays OK and Cancel buttons\r
-         * @type Object\r
-         */\r
-        OKCANCEL : {ok:true, cancel:true},\r
-        /**\r
-         * Button config that displays Yes and No buttons\r
-         * @type Object\r
-         */\r
-        YESNO : {yes:true, no:true},\r
-        /**\r
-         * Button config that displays Yes, No and Cancel buttons\r
-         * @type Object\r
-         */\r
-        YESNOCANCEL : {yes:true, no:true, cancel:true},\r
-        /**\r
-         * The CSS class that provides the INFO icon image\r
-         * @type String\r
-         */\r
-        INFO : 'ext-mb-info',\r
-        /**\r
-         * The CSS class that provides the WARNING icon image\r
-         * @type String\r
-         */\r
-        WARNING : 'ext-mb-warning',\r
-        /**\r
-         * The CSS class that provides the QUESTION icon image\r
-         * @type String\r
-         */\r
-        QUESTION : 'ext-mb-question',\r
-        /**\r
-         * The CSS class that provides the ERROR icon image\r
-         * @type String\r
-         */\r
-        ERROR : 'ext-mb-error',\r
-\r
-        /**\r
-         * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)\r
-         * @type Number\r
-         */\r
-        defaultTextHeight : 75,\r
-        /**\r
-         * The maximum width in pixels of the message box (defaults to 600)\r
-         * @type Number\r
-         */\r
-        maxWidth : 600,\r
-        /**\r
-         * The minimum width in pixels of the message box (defaults to 100)\r
-         * @type Number\r
-         */\r
-        minWidth : 100,\r
-        /**\r
-         * The minimum width in pixels of the message box if it is a progress-style dialog.  This is useful\r
-         * for setting a different minimum width than text-only dialogs may need (defaults to 250).\r
-         * @type Number\r
-         */\r
-        minProgressWidth : 250,\r
-        /**\r
-         * The minimum width in pixels of the message box if it is a prompt dialog.  This is useful\r
-         * for setting a different minimum width than text-only dialogs may need (defaults to 250).\r
-         * @type Number\r
-         */\r
-        minPromptWidth: 250,\r
-        /**\r
-         * An object containing the default button text strings that can be overriden for localized language support.\r
-         * Supported properties are: ok, cancel, yes and no.  Generally you should include a locale-specific\r
-         * resource file for handling language support across the framework.\r
-         * Customize the default text like so: Ext.MessageBox.buttonText.yes = "oui"; //french\r
-         * @type Object\r
-         */\r
-        buttonText : {\r
-            ok : "OK",\r
-            cancel : "Cancel",\r
-            yes : "Yes",\r
-            no : "No"\r
-        }\r
-    };\r
-}();\r
-\r
-/**\r
- * Shorthand for {@link Ext.MessageBox}\r
- */\r
-Ext.Msg = Ext.MessageBox;/**\r
- * @class Ext.dd.PanelProxy\r
- * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally\r
- * for the Panel's drag drop implementation, and should never need to be created directly.\r
- * @constructor\r
- * @param panel The {@link Ext.Panel} to proxy for\r
- * @param config Configuration options\r
- */\r
-Ext.dd.PanelProxy = function(panel, config){\r
-    this.panel = panel;\r
-    this.id = this.panel.id +'-ddproxy';\r
-    Ext.apply(this, config);\r
-};\r
-\r
-Ext.dd.PanelProxy.prototype = {\r
-    /**\r
-     * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,\r
-     * false to drag with no proxy (defaults to true).\r
-     */\r
-    insertProxy : true,\r
-\r
-    // private overrides\r
-    setStatus : Ext.emptyFn,\r
-    reset : Ext.emptyFn,\r
-    update : Ext.emptyFn,\r
-    stop : Ext.emptyFn,\r
-    sync: Ext.emptyFn,\r
-\r
-    /**\r
-     * Gets the proxy's element\r
-     * @return {Element} The proxy's element\r
-     */\r
-    getEl : function(){\r
-        return this.ghost;\r
-    },\r
-\r
-    /**\r
-     * Gets the proxy's ghost element\r
-     * @return {Element} The proxy's ghost element\r
-     */\r
-    getGhost : function(){\r
-        return this.ghost;\r
-    },\r
-\r
-    /**\r
-     * Gets the proxy's element\r
-     * @return {Element} The proxy's element\r
-     */\r
-    getProxy : function(){\r
-        return this.proxy;\r
-    },\r
-\r
-    /**\r
-     * Hides the proxy\r
-     */\r
-    hide : function(){\r
-        if(this.ghost){\r
-            if(this.proxy){\r
-                this.proxy.remove();\r
-                delete this.proxy;\r
-            }\r
-            this.panel.el.dom.style.display = '';\r
-            this.ghost.remove();\r
-            delete this.ghost;\r
-        }\r
-    },\r
-\r
-    /**\r
-     * Shows the proxy\r
-     */\r
-    show : function(){\r
-        if(!this.ghost){\r
-            this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());\r
-            this.ghost.setXY(this.panel.el.getXY())\r
-            if(this.insertProxy){\r
-                this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});\r
-                this.proxy.setSize(this.panel.getSize());\r
-            }\r
-            this.panel.el.dom.style.display = 'none';\r
-        }\r
-    },\r
-\r
-    // private\r
-    repair : function(xy, callback, scope){\r
-        this.hide();\r
-        if(typeof callback == "function"){\r
-            callback.call(scope || this);\r
-        }\r
-    },\r
-\r
-    /**\r
-     * Moves the proxy to a different position in the DOM.  This is typically called while dragging the Panel\r
-     * to keep the proxy sync'd to the Panel's location.\r
-     * @param {HTMLElement} parentNode The proxy's parent DOM node\r
-     * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults\r
-     * to the parent's last child if not specified)\r
-     */\r
-    moveProxy : function(parentNode, before){\r
-        if(this.proxy){\r
-            parentNode.insertBefore(this.proxy.dom, before);\r
-        }\r
-    }\r
-};\r
-\r
-// private - DD implementation for Panels\r
-Ext.Panel.DD = function(panel, cfg){\r
-    this.panel = panel;\r
-    this.dragData = {panel: panel};\r
-    this.proxy = new Ext.dd.PanelProxy(panel, cfg);\r
-    Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);\r
-    var h = panel.header;\r
-    if(h){\r
-        this.setHandleElId(h.id);\r
-    }\r
-    (h ? h : this.panel.body).setStyle('cursor', 'move');\r
-    this.scroll = false;\r
-};\r
-\r
-Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {\r
-    showFrame: Ext.emptyFn,\r
-    startDrag: Ext.emptyFn,\r
-    b4StartDrag: function(x, y) {\r
-        this.proxy.show();\r
-    },\r
-    b4MouseDown: function(e) {\r
-        var x = e.getPageX();\r
-        var y = e.getPageY();\r
-        this.autoOffset(x, y);\r
-    },\r
-    onInitDrag : function(x, y){\r
-        this.onStartDrag(x, y);\r
-        return true;\r
-    },\r
-    createFrame : Ext.emptyFn,\r
-    getDragEl : function(e){\r
-        return this.proxy.ghost.dom;\r
-    },\r
-    endDrag : function(e){\r
-        this.proxy.hide();\r
-        this.panel.saveState();\r
-    },\r
-\r
-    autoOffset : function(x, y) {\r
-        x -= this.startPageX;\r
-        y -= this.startPageY;\r
-        this.setDelta(x, y);\r
-    }\r
+Ext.WindowMgr = new Ext.WindowGroup();/**
+ * @class Ext.MessageBox
+ * <p>Utility class for generating different styles of message boxes.  The alias Ext.Msg can also be used.<p/>
+ * <p>Note that the MessageBox is asynchronous.  Unlike a regular JavaScript <code>alert</code> (which will halt
+ * browser execution), showing a MessageBox will not cause the code to stop.  For this reason, if you have code
+ * that should only run <em>after</em> some user feedback from the MessageBox, you must use a callback function
+ * (see the <code>function</code> parameter for {@link #show} for more details).</p>
+ * <p>Example usage:</p>
+ *<pre><code>
+// Basic alert:
+Ext.Msg.alert('Status', 'Changes saved successfully.');
+
+// Prompt for user data and process the result using a callback:
+Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
+    if (btn == 'ok'){
+        // process text value and close...
+    }
+});
+
+// Show a dialog using config options:
+Ext.Msg.show({
+   title:'Save Changes?',
+   msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
+   buttons: Ext.Msg.YESNOCANCEL,
+   fn: processResult,
+   animEl: 'elId',
+   icon: Ext.MessageBox.QUESTION
+});
+</code></pre>
+ * @singleton
+ */
+Ext.MessageBox = function(){
+    var dlg, opt, mask, waitTimer,
+        bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl,
+        buttons, activeTextEl, bwidth, bufferIcon = '', iconCls = '',
+        buttonNames = ['ok', 'yes', 'no', 'cancel'];
+
+    // private
+    var handleButton = function(button){
+        buttons[button].blur();
+        if(dlg.isVisible()){
+            dlg.hide();
+            handleHide();
+            Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1);
+        }
+    };
+
+    // private
+    var handleHide = function(){
+        if(opt && opt.cls){
+            dlg.el.removeClass(opt.cls);
+        }
+        progressBar.reset();        
+    };
+
+    // private
+    var handleEsc = function(d, k, e){
+        if(opt && opt.closable !== false){
+            dlg.hide();
+            handleHide();
+        }
+        if(e){
+            e.stopEvent();
+        }
+    };
+
+    // private
+    var updateButtons = function(b){
+        var width = 0,
+            cfg;
+        if(!b){
+            Ext.each(buttonNames, function(name){
+                buttons[name].hide();
+            });
+            return width;
+        }
+        dlg.footer.dom.style.display = '';
+        Ext.iterate(buttons, function(name, btn){
+            cfg = b[name];
+            if(cfg){
+                btn.show();
+                btn.setText(Ext.isString(cfg) ? cfg : Ext.MessageBox.buttonText[name]);
+                width += btn.getEl().getWidth() + 15;
+            }else{
+                btn.hide();
+            }
+        });
+        return width;
+    };
+
+    return {
+        /**
+         * Returns a reference to the underlying {@link Ext.Window} element
+         * @return {Ext.Window} The window
+         */
+        getDialog : function(titleText){
+           if(!dlg){
+                var btns = [];
+                
+                buttons = {};
+                Ext.each(buttonNames, function(name){
+                    btns.push(buttons[name] = new Ext.Button({
+                        text: this.buttonText[name],
+                        handler: handleButton.createCallback(name),
+                        hideMode: 'offsets'
+                    }));
+                }, this);
+                dlg = new Ext.Window({
+                    autoCreate : true,
+                    title:titleText,
+                    resizable:false,
+                    constrain:true,
+                    constrainHeader:true,
+                    minimizable : false,
+                    maximizable : false,
+                    stateful: false,
+                    modal: true,
+                    shim:true,
+                    buttonAlign:"center",
+                    width:400,
+                    height:100,
+                    minHeight: 80,
+                    plain:true,
+                    footer:true,
+                    closable:true,
+                    close : function(){
+                        if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){
+                            handleButton("no");
+                        }else{
+                            handleButton("cancel");
+                        }
+                    },
+                    fbar: new Ext.Toolbar({
+                        items: btns,
+                        enableOverflow: false
+                    })
+                });
+                dlg.render(document.body);
+                dlg.getEl().addClass('x-window-dlg');
+                mask = dlg.mask;
+                bodyEl = dlg.body.createChild({
+                    html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'
+                });
+                iconEl = Ext.get(bodyEl.dom.firstChild);
+                var contentEl = bodyEl.dom.childNodes[1];
+                msgEl = Ext.get(contentEl.firstChild);
+                textboxEl = Ext.get(contentEl.childNodes[2].firstChild);
+                textboxEl.enableDisplayMode();
+                textboxEl.addKeyListener([10,13], function(){
+                    if(dlg.isVisible() && opt && opt.buttons){
+                        if(opt.buttons.ok){
+                            handleButton("ok");
+                        }else if(opt.buttons.yes){
+                            handleButton("yes");
+                        }
+                    }
+                });
+                textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);
+                textareaEl.enableDisplayMode();
+                progressBar = new Ext.ProgressBar({
+                    renderTo:bodyEl
+                });
+               bodyEl.createChild({cls:'x-clear'});
+            }
+            return dlg;
+        },
+
+        /**
+         * Updates the message box body text
+         * @param {String} text (optional) Replaces the message box element's innerHTML with the specified string (defaults to
+         * the XHTML-compliant non-breaking space character '&amp;#160;')
+         * @return {Ext.MessageBox} this
+         */
+        updateText : function(text){
+            if(!dlg.isVisible() && !opt.width){
+                dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows
+            }
+            msgEl.update(text || '&#160;');
+
+            var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0,
+                mw = msgEl.getWidth() + msgEl.getMargins('lr'),
+                fw = dlg.getFrameWidth('lr'),
+                bw = dlg.body.getFrameWidth('lr'),
+                w;
+                
+            if (Ext.isIE && iw > 0){
+                //3 pixels get subtracted in the icon CSS for an IE margin issue,
+                //so we have to add it back here for the overall width to be consistent
+                iw += 3;
+            }
+            w = Math.max(Math.min(opt.width || iw+mw+fw+bw, opt.maxWidth || this.maxWidth),
+                    Math.max(opt.minWidth || this.minWidth, bwidth || 0));
+
+            if(opt.prompt === true){
+                activeTextEl.setWidth(w-iw-fw-bw);
+            }
+            if(opt.progress === true || opt.wait === true){
+                progressBar.setSize(w-iw-fw-bw);
+            }
+            if(Ext.isIE && w == bwidth){
+                w += 4; //Add offset when the content width is smaller than the buttons.    
+            }
+            dlg.setSize(w, 'auto').center();
+            return this;
+        },
+
+        /**
+         * Updates a progress-style message box's text and progress bar. Only relevant on message boxes
+         * initiated via {@link Ext.MessageBox#progress} or {@link Ext.MessageBox#wait},
+         * or by calling {@link Ext.MessageBox#show} with progress: true.
+         * @param {Number} value Any number between 0 and 1 (e.g., .5, defaults to 0)
+         * @param {String} progressText The progress text to display inside the progress bar (defaults to '')
+         * @param {String} msg The message box's body text is replaced with the specified string (defaults to undefined
+         * so that any existing body text will not get overwritten by default unless a new value is passed in)
+         * @return {Ext.MessageBox} this
+         */
+        updateProgress : function(value, progressText, msg){
+            progressBar.updateProgress(value, progressText);
+            if(msg){
+                this.updateText(msg);
+            }
+            return this;
+        },
+
+        /**
+         * Returns true if the message box is currently displayed
+         * @return {Boolean} True if the message box is visible, else false
+         */
+        isVisible : function(){
+            return dlg && dlg.isVisible();
+        },
+
+        /**
+         * Hides the message box if it is displayed
+         * @return {Ext.MessageBox} this
+         */
+        hide : function(){
+            var proxy = dlg ? dlg.activeGhost : null;
+            if(this.isVisible() || proxy){
+                dlg.hide();
+                handleHide();
+                if (proxy){
+                    // unghost is a private function, but i saw no better solution
+                    // to fix the locking problem when dragging while it closes
+                    dlg.unghost(false, false);
+                } 
+            }
+            return this;
+        },
+
+        /**
+         * Displays a new message box, or reinitializes an existing message box, based on the config options
+         * passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,
+         * although those calls are basic shortcuts and do not support all of the config options allowed here.
+         * @param {Object} config The following config options are supported: <ul>
+         * <li><b>animEl</b> : String/Element<div class="sub-desc">An id or Element from which the message box should animate as it
+         * opens and closes (defaults to undefined)</div></li>
+         * <li><b>buttons</b> : Object/Boolean<div class="sub-desc">A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',
+         * cancel:'Bar'}), or false to not show any buttons (defaults to false)</div></li>
+         * <li><b>closable</b> : Boolean<div class="sub-desc">False to hide the top-right close button (defaults to true). Note that
+         * progress and wait dialogs will ignore this property and always hide the close button as they can only
+         * be closed programmatically.</div></li>
+         * <li><b>cls</b> : String<div class="sub-desc">A custom CSS class to apply to the message box's container element</div></li>
+         * <li><b>defaultTextHeight</b> : Number<div class="sub-desc">The default height in pixels of the message box's multiline textarea
+         * if displayed (defaults to 75)</div></li>
+         * <li><b>fn</b> : Function<div class="sub-desc">A callback function which is called when the dialog is dismissed either
+         * by clicking on the configured buttons, or on the dialog close button, or by pressing
+         * the return button to enter input.
+         * <p>Progress and wait dialogs will ignore this option since they do not respond to user
+         * actions and can only be closed programmatically, so any required function should be called
+         * by the same code after it closes the dialog. Parameters passed:<ul>
+         * <li><b>buttonId</b> : String<div class="sub-desc">The ID of the button pressed, one of:<div class="sub-desc"><ul>
+         * <li><tt>ok</tt></li>
+         * <li><tt>yes</tt></li>
+         * <li><tt>no</tt></li>
+         * <li><tt>cancel</tt></li>
+         * </ul></div></div></li>
+         * <li><b>text</b> : String<div class="sub-desc">Value of the input field if either <tt><a href="#show-option-prompt" ext:member="show-option-prompt" ext:cls="Ext.MessageBox">prompt</a></tt>
+         * or <tt><a href="#show-option-multiline" ext:member="show-option-multiline" ext:cls="Ext.MessageBox">multiline</a></tt> is true</div></li>
+         * <li><b>opt</b> : Object<div class="sub-desc">The config object passed to show.</div></li>
+         * </ul></p></div></li>
+         * <li><b>scope</b> : Object<div class="sub-desc">The scope of the callback function</div></li>
+         * <li><b>icon</b> : String<div class="sub-desc">A CSS class that provides a background image to be used as the body icon for the
+         * dialog (e.g. Ext.MessageBox.WARNING or 'custom-class') (defaults to '')</div></li>
+         * <li><b>iconCls</b> : String<div class="sub-desc">The standard {@link Ext.Window#iconCls} to
+         * add an optional header icon (defaults to '')</div></li>
+         * <li><b>maxWidth</b> : Number<div class="sub-desc">The maximum width in pixels of the message box (defaults to 600)</div></li>
+         * <li><b>minWidth</b> : Number<div class="sub-desc">The minimum width in pixels of the message box (defaults to 100)</div></li>
+         * <li><b>modal</b> : Boolean<div class="sub-desc">False to allow user interaction with the page while the message box is
+         * displayed (defaults to true)</div></li>
+         * <li><b>msg</b> : String<div class="sub-desc">A string that will replace the existing message box body text (defaults to the
+         * XHTML-compliant non-breaking space character '&amp;#160;')</div></li>
+         * <li><a id="show-option-multiline"></a><b>multiline</b> : Boolean<div class="sub-desc">
+         * True to prompt the user to enter multi-line text (defaults to false)</div></li>
+         * <li><b>progress</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>
+         * <li><b>progressText</b> : String<div class="sub-desc">The text to display inside the progress bar if progress = true (defaults to '')</div></li>
+         * <li><a id="show-option-prompt"></a><b>prompt</b> : Boolean<div class="sub-desc">True to prompt the user to enter single-line text (defaults to false)</div></li>
+         * <li><b>proxyDrag</b> : Boolean<div class="sub-desc">True to display a lightweight proxy while dragging (defaults to false)</div></li>
+         * <li><b>title</b> : String<div class="sub-desc">The title text</div></li>
+         * <li><b>value</b> : String<div class="sub-desc">The string value to set into the active textbox element if displayed</div></li>
+         * <li><b>wait</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>
+         * <li><b>waitConfig</b> : Object<div class="sub-desc">A {@link Ext.ProgressBar#waitConfig} object (applies only if wait = true)</div></li>
+         * <li><b>width</b> : Number<div class="sub-desc">The width of the dialog in pixels</div></li>
+         * </ul>
+         * Example usage:
+         * <pre><code>
+Ext.Msg.show({
+   title: 'Address',
+   msg: 'Please enter your address:',
+   width: 300,
+   buttons: Ext.MessageBox.OKCANCEL,
+   multiline: true,
+   fn: saveAddress,
+   animEl: 'addAddressBtn',
+   icon: Ext.MessageBox.INFO
+});
+</code></pre>
+         * @return {Ext.MessageBox} this
+         */
+        show : function(options){
+            if(this.isVisible()){
+                this.hide();
+            }
+            opt = options;
+            var d = this.getDialog(opt.title || "&#160;");
+
+            d.setTitle(opt.title || "&#160;");
+            var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);
+            d.tools.close.setDisplayed(allowClose);
+            activeTextEl = textboxEl;
+            opt.prompt = opt.prompt || (opt.multiline ? true : false);
+            if(opt.prompt){
+                if(opt.multiline){
+                    textboxEl.hide();
+                    textareaEl.show();
+                    textareaEl.setHeight(Ext.isNumber(opt.multiline) ? opt.multiline : this.defaultTextHeight);
+                    activeTextEl = textareaEl;
+                }else{
+                    textboxEl.show();
+                    textareaEl.hide();
+                }
+            }else{
+                textboxEl.hide();
+                textareaEl.hide();
+            }
+            activeTextEl.dom.value = opt.value || "";
+            if(opt.prompt){
+                d.focusEl = activeTextEl;
+            }else{
+                var bs = opt.buttons;
+                var db = null;
+                if(bs && bs.ok){
+                    db = buttons["ok"];
+                }else if(bs && bs.yes){
+                    db = buttons["yes"];
+                }
+                if (db){
+                    d.focusEl = db;
+                }
+            }
+            if(opt.iconCls){
+              d.setIconClass(opt.iconCls);
+            }
+            this.setIcon(Ext.isDefined(opt.icon) ? opt.icon : bufferIcon);
+            bwidth = updateButtons(opt.buttons);
+            progressBar.setVisible(opt.progress === true || opt.wait === true);
+            this.updateProgress(0, opt.progressText);
+            this.updateText(opt.msg);
+            if(opt.cls){
+                d.el.addClass(opt.cls);
+            }
+            d.proxyDrag = opt.proxyDrag === true;
+            d.modal = opt.modal !== false;
+            d.mask = opt.modal !== false ? mask : false;
+            if(!d.isVisible()){
+                // force it to the end of the z-index stack so it gets a cursor in FF
+                document.body.appendChild(dlg.el.dom);
+                d.setAnimateTarget(opt.animEl);
+                //workaround for window internally enabling keymap in afterShow
+                d.on('show', function(){
+                    if(allowClose === true){
+                        d.keyMap.enable();
+                    }else{
+                        d.keyMap.disable();
+                    }
+                }, this, {single:true});
+                d.show(opt.animEl);
+            }
+            if(opt.wait === true){
+                progressBar.wait(opt.waitConfig);
+            }
+            return this;
+        },
+
+        /**
+         * Adds the specified icon to the dialog.  By default, the class 'ext-mb-icon' is applied for default
+         * styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')
+         * to clear any existing icon. This method must be called before the MessageBox is shown.
+         * The following built-in icon classes are supported, but you can also pass in a custom class name:
+         * <pre>
+Ext.MessageBox.INFO
+Ext.MessageBox.WARNING
+Ext.MessageBox.QUESTION
+Ext.MessageBox.ERROR
+         *</pre>
+         * @param {String} icon A CSS classname specifying the icon's background image url, or empty string to clear the icon
+         * @return {Ext.MessageBox} this
+         */
+        setIcon : function(icon){
+            if(!dlg){
+                bufferIcon = icon;
+                return;
+            }
+            bufferIcon = undefined;
+            if(icon && icon != ''){
+                iconEl.removeClass('x-hidden');
+                iconEl.replaceClass(iconCls, icon);
+                bodyEl.addClass('x-dlg-icon');
+                iconCls = icon;
+            }else{
+                iconEl.replaceClass(iconCls, 'x-hidden');
+                bodyEl.removeClass('x-dlg-icon');
+                iconCls = '';
+            }
+            return this;
+        },
+
+        /**
+         * Displays a message box with a progress bar.  This message box has no buttons and is not closeable by
+         * the user.  You are responsible for updating the progress bar as needed via {@link Ext.MessageBox#updateProgress}
+         * and closing the message box when the process is complete.
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {String} progressText (optional) The text to display inside the progress bar (defaults to '')
+         * @return {Ext.MessageBox} this
+         */
+        progress : function(title, msg, progressText){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: false,
+                progress:true,
+                closable:false,
+                minWidth: this.minProgressWidth,
+                progressText: progressText
+            });
+            return this;
+        },
+
+        /**
+         * Displays a message box with an infinitely auto-updating progress bar.  This can be used to block user
+         * interaction while waiting for a long-running process to complete that does not have defined intervals.
+         * You are responsible for closing the message box when the process is complete.
+         * @param {String} msg The message box body text
+         * @param {String} title (optional) The title bar text
+         * @param {Object} config (optional) A {@link Ext.ProgressBar#waitConfig} object
+         * @return {Ext.MessageBox} this
+         */
+        wait : function(msg, title, config){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: false,
+                closable:false,
+                wait:true,
+                modal:true,
+                minWidth: this.minProgressWidth,
+                waitConfig: config
+            });
+            return this;
+        },
+
+        /**
+         * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).
+         * If a callback function is passed it will be called after the user clicks the button, and the
+         * id of the button that was clicked will be passed as the only parameter to the callback
+         * (could also be the top-right close button).
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {Function} fn (optional) The callback function invoked after the message box is closed
+         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.
+         * @return {Ext.MessageBox} this
+         */
+        alert : function(title, msg, fn, scope){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: this.OK,
+                fn: fn,
+                scope : scope,
+                minWidth: this.minWidth
+            });
+            return this;
+        },
+
+        /**
+         * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).
+         * If a callback function is passed it will be called after the user clicks either button,
+         * and the id of the button that was clicked will be passed as the only parameter to the callback
+         * (could also be the top-right close button).
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {Function} fn (optional) The callback function invoked after the message box is closed
+         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.
+         * @return {Ext.MessageBox} this
+         */
+        confirm : function(title, msg, fn, scope){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: this.YESNO,
+                fn: fn,
+                scope : scope,
+                icon: this.QUESTION,
+                minWidth: this.minWidth
+            });
+            return this;
+        },
+
+        /**
+         * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).
+         * The prompt can be a single-line or multi-line textbox.  If a callback function is passed it will be called after the user
+         * clicks either button, and the id of the button that was clicked (could also be the top-right
+         * close button) and the text that was entered will be passed as the two parameters to the callback.
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {Function} fn (optional) The callback function invoked after the message box is closed
+         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.
+         * @param {Boolean/Number} multiline (optional) True to create a multiline textbox using the defaultTextHeight
+         * property, or the height in pixels to create the textbox (defaults to false / single-line)
+         * @param {String} value (optional) Default value of the text input element (defaults to '')
+         * @return {Ext.MessageBox} this
+         */
+        prompt : function(title, msg, fn, scope, multiline, value){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: this.OKCANCEL,
+                fn: fn,
+                minWidth: this.minPromptWidth,
+                scope : scope,
+                prompt:true,
+                multiline: multiline,
+                value: value
+            });
+            return this;
+        },
+
+        /**
+         * Button config that displays a single OK button
+         * @type Object
+         */
+        OK : {ok:true},
+        /**
+         * Button config that displays a single Cancel button
+         * @type Object
+         */
+        CANCEL : {cancel:true},
+        /**
+         * Button config that displays OK and Cancel buttons
+         * @type Object
+         */
+        OKCANCEL : {ok:true, cancel:true},
+        /**
+         * Button config that displays Yes and No buttons
+         * @type Object
+         */
+        YESNO : {yes:true, no:true},
+        /**
+         * Button config that displays Yes, No and Cancel buttons
+         * @type Object
+         */
+        YESNOCANCEL : {yes:true, no:true, cancel:true},
+        /**
+         * The CSS class that provides the INFO icon image
+         * @type String
+         */
+        INFO : 'ext-mb-info',
+        /**
+         * The CSS class that provides the WARNING icon image
+         * @type String
+         */
+        WARNING : 'ext-mb-warning',
+        /**
+         * The CSS class that provides the QUESTION icon image
+         * @type String
+         */
+        QUESTION : 'ext-mb-question',
+        /**
+         * The CSS class that provides the ERROR icon image
+         * @type String
+         */
+        ERROR : 'ext-mb-error',
+
+        /**
+         * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)
+         * @type Number
+         */
+        defaultTextHeight : 75,
+        /**
+         * The maximum width in pixels of the message box (defaults to 600)
+         * @type Number
+         */
+        maxWidth : 600,
+        /**
+         * The minimum width in pixels of the message box (defaults to 100)
+         * @type Number
+         */
+        minWidth : 100,
+        /**
+         * The minimum width in pixels of the message box if it is a progress-style dialog.  This is useful
+         * for setting a different minimum width than text-only dialogs may need (defaults to 250).
+         * @type Number
+         */
+        minProgressWidth : 250,
+        /**
+         * The minimum width in pixels of the message box if it is a prompt dialog.  This is useful
+         * for setting a different minimum width than text-only dialogs may need (defaults to 250).
+         * @type Number
+         */
+        minPromptWidth: 250,
+        /**
+         * An object containing the default button text strings that can be overriden for localized language support.
+         * Supported properties are: ok, cancel, yes and no.  Generally you should include a locale-specific
+         * resource file for handling language support across the framework.
+         * Customize the default text like so: Ext.MessageBox.buttonText.yes = "oui"; //french
+         * @type Object
+         */
+        buttonText : {
+            ok : "OK",
+            cancel : "Cancel",
+            yes : "Yes",
+            no : "No"
+        }
+    };
+}();
+
+/**
+ * Shorthand for {@link Ext.MessageBox}
+ */
+Ext.Msg = Ext.MessageBox;/**
+ * @class Ext.dd.PanelProxy
+ * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally
+ * for the Panel's drag drop implementation, and should never need to be created directly.
+ * @constructor
+ * @param panel The {@link Ext.Panel} to proxy for
+ * @param config Configuration options
+ */
+Ext.dd.PanelProxy = function(panel, config){
+    this.panel = panel;
+    this.id = this.panel.id +'-ddproxy';
+    Ext.apply(this, config);
+};
+
+Ext.dd.PanelProxy.prototype = {
+    /**
+     * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,
+     * false to drag with no proxy (defaults to true).
+     */
+    insertProxy : true,
+
+    // private overrides
+    setStatus : Ext.emptyFn,
+    reset : Ext.emptyFn,
+    update : Ext.emptyFn,
+    stop : Ext.emptyFn,
+    sync: Ext.emptyFn,
+
+    /**
+     * Gets the proxy's element
+     * @return {Element} The proxy's element
+     */
+    getEl : function(){
+        return this.ghost;
+    },
+
+    /**
+     * Gets the proxy's ghost element
+     * @return {Element} The proxy's ghost element
+     */
+    getGhost : function(){
+        return this.ghost;
+    },
+
+    /**
+     * Gets the proxy's element
+     * @return {Element} The proxy's element
+     */
+    getProxy : function(){
+        return this.proxy;
+    },
+
+    /**
+     * Hides the proxy
+     */
+    hide : function(){
+        if(this.ghost){
+            if(this.proxy){
+                this.proxy.remove();
+                delete this.proxy;
+            }
+            this.panel.el.dom.style.display = '';
+            this.ghost.remove();
+            delete this.ghost;
+        }
+    },
+
+    /**
+     * Shows the proxy
+     */
+    show : function(){
+        if(!this.ghost){
+            this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
+            this.ghost.setXY(this.panel.el.getXY());
+            if(this.insertProxy){
+                this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
+                this.proxy.setSize(this.panel.getSize());
+            }
+            this.panel.el.dom.style.display = 'none';
+        }
+    },
+
+    // private
+    repair : function(xy, callback, scope){
+        this.hide();
+        if(typeof callback == "function"){
+            callback.call(scope || this);
+        }
+    },
+
+    /**
+     * Moves the proxy to a different position in the DOM.  This is typically called while dragging the Panel
+     * to keep the proxy sync'd to the Panel's location.
+     * @param {HTMLElement} parentNode The proxy's parent DOM node
+     * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults
+     * to the parent's last child if not specified)
+     */
+    moveProxy : function(parentNode, before){
+        if(this.proxy){
+            parentNode.insertBefore(this.proxy.dom, before);
+        }
+    }
+};
+
+// private - DD implementation for Panels
+Ext.Panel.DD = function(panel, cfg){
+    this.panel = panel;
+    this.dragData = {panel: panel};
+    this.proxy = new Ext.dd.PanelProxy(panel, cfg);
+    Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
+    var h = panel.header;
+    if(h){
+        this.setHandleElId(h.id);
+    }
+    (h ? h : this.panel.body).setStyle('cursor', 'move');
+    this.scroll = false;
+};
+
+Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
+    showFrame: Ext.emptyFn,
+    startDrag: Ext.emptyFn,
+    b4StartDrag: function(x, y) {
+        this.proxy.show();
+    },
+    b4MouseDown: function(e) {
+        var x = e.getPageX();
+        var y = e.getPageY();
+        this.autoOffset(x, y);
+    },
+    onInitDrag : function(x, y){
+        this.onStartDrag(x, y);
+        return true;
+    },
+    createFrame : Ext.emptyFn,
+    getDragEl : function(e){
+        return this.proxy.ghost.dom;
+    },
+    endDrag : function(e){
+        this.proxy.hide();
+        this.panel.saveState();
+    },
+
+    autoOffset : function(x, y) {
+        x -= this.startPageX;
+        y -= this.startPageY;
+        this.setDelta(x, y);
+    }
 });
\ No newline at end of file