- }, this, {single:true});
- 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);
- d.show(opt.animEl);
- }
- return this;
- },
-
- <div id="method-Ext.MessageBox-setIcon"></div>/**
- * 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. 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(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;
- },
-
- <div id="method-Ext.MessageBox-progress"></div>/**
- * 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;
- },
-
- <div id="method-Ext.MessageBox-wait"></div>/**
- * 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({
+ me.reconfigure(cfg);
+ me.addCls(cfg.cls);
+ if (cfg.animateTarget) {
+ me.doAutoSize(false);
+ me.callParent();
+ } else {
+ me.callParent();
+ me.doAutoSize(true);
+ }
+ return me;
+ },
+
+ afterShow: function(){
+ if (this.animateTarget) {
+ this.center();
+ }
+ this.callParent(arguments);
+ },
+
+ doAutoSize: function(center) {
+ var me = this,
+ icon = me.iconComponent,
+ iconHeight = me.iconHeight;
+
+ if (!Ext.isDefined(me.frameWidth)) {
+ me.frameWidth = me.el.getWidth() - me.body.getWidth();
+ }
+
+ // reset to the original dimensions
+ icon.setHeight(iconHeight);
+
+ // Allow per-invocation override of minWidth
+ me.minWidth = me.cfg.minWidth || Ext.getClass(this).prototype.minWidth;
+
+ // Set best possible size based upon allowing the text to wrap in the maximized Window, and
+ // then constraining it to within the max with. Then adding up constituent element heights.
+ me.topContainer.doLayout();
+ if (Ext.isIE6 || Ext.isIEQuirks) {
+ // In IE quirks, the initial full width of the prompt fields will prevent the container element
+ // from collapsing once sized down, so temporarily force them to a small width. They'll get
+ // layed out to their final width later when setting the final window size.
+ me.textField.setCalculatedSize(9);
+ me.textArea.setCalculatedSize(9);
+ }
+ var width = me.cfg.width || me.msg.getWidth() + icon.getWidth() + 25, /* topContainer's layout padding */
+ height = (me.header.rendered ? me.header.getHeight() : 0) +
+ Math.max(me.promptContainer.getHeight(), icon.getHeight()) +
+ me.progressBar.getHeight() +
+ (me.bottomTb.rendered ? me.bottomTb.getHeight() : 0) + 20 ;/* topContainer's layout padding */
+
+ // Update to the size of the content, this way the text won't wrap under the icon.
+ icon.setHeight(Math.max(iconHeight, me.msg.getHeight()));
+ me.setSize(width + me.frameWidth, height + me.frameWidth);
+ if (center) {
+ me.center();
+ }
+ return me;
+ },
+
+ updateText: function(text) {
+ this.msg.update(text);
+ return this.doAutoSize(true);
+ },
+
+<span id='Ext-window-MessageBox-method-setIcon'> /**
+</span> * 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.window.MessageBox.INFO
+Ext.window.MessageBox.WARNING
+Ext.window.MessageBox.QUESTION
+Ext.window.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.window.MessageBox} this
+ */
+ setIcon : function(icon) {
+ var me = this;
+ me.iconComponent.removeCls(me.iconCls);
+ if (icon) {
+ me.iconComponent.show();
+ me.iconComponent.addCls(Ext.baseCSSPrefix + 'dlg-icon');
+ me.iconComponent.addCls(me.iconCls = icon);
+ } else {
+ me.iconComponent.removeCls(Ext.baseCSSPrefix + 'dlg-icon');
+ me.iconComponent.hide();
+ }
+ return me;
+ },
+
+<span id='Ext-window-MessageBox-method-updateProgress'> /**
+</span> * Updates a progress-style message box's text and progress bar. Only relevant on message boxes
+ * initiated via {@link Ext.window.MessageBox#progress} or {@link Ext.window.MessageBox#wait},
+ * or by calling {@link Ext.window.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.window.MessageBox} this
+ */
+ updateProgress : function(value, progressText, msg){
+ this.progressBar.updateProgress(value, progressText);
+ if (msg){
+ this.updateText(msg);
+ }
+ return this;
+ },
+
+ onEsc: function() {
+ if (this.closable !== false) {
+ this.callParent(arguments);
+ }
+ },
+
+<span id='Ext-window-MessageBox-method-confirm'> /**
+</span> * 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.window.MessageBox} this
+ */
+ confirm: function(cfg, msg, fn, scope) {
+ if (Ext.isString(cfg)) {
+ cfg = {
+ title: cfg,
+ icon: 'ext-mb-question',
+ msg: msg,
+ buttons: this.YESNO,
+ callback: fn,
+ scope: scope
+ };
+ }
+ return this.show(cfg);
+ },
+
+<span id='Ext-window-MessageBox-method-prompt'> /**
+</span> * 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.window.MessageBox} this
+ */
+ prompt : function(cfg, msg, fn, scope, multiline, value){
+ if (Ext.isString(cfg)) {
+ cfg = {
+ prompt: true,
+ title: cfg,
+ minWidth: this.minPromptWidth,
+ msg: msg,
+ buttons: this.OKCANCEL,
+ callback: fn,
+ scope: scope,
+ multiline: multiline,
+ value: value
+ };
+ }
+ return this.show(cfg);
+ },
+
+<span id='Ext-window-MessageBox-method-wait'> /**
+</span> * 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.window.MessageBox} this
+ */
+ wait : function(cfg, title, config){
+ if (Ext.isString(cfg)) {
+ cfg = {