tvheadend/vendor/ext-3.4.1/docs/source/MessageBox.html
Adam Sutton bafcfff42d webui: restructure webui/extjs source files
I want to keep the 3rd-party packages away from the main source
where possible.
2013-06-03 17:11:01 +01:00

657 lines
32 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-MessageBox'>/**
</span> * @class Ext.MessageBox
* &lt;p&gt;Utility class for generating different styles of message boxes. The alias Ext.Msg can also be used.&lt;p/&gt;
* &lt;p&gt;Note that the MessageBox is asynchronous. Unlike a regular JavaScript &lt;code&gt;alert&lt;/code&gt; (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 &lt;em&gt;after&lt;/em&gt; some user feedback from the MessageBox, you must use a callback function
* (see the &lt;code&gt;function&lt;/code&gt; parameter for {@link #show} for more details).&lt;/p&gt;
* &lt;p&gt;Example usage:&lt;/p&gt;
*&lt;pre&gt;&lt;code&gt;
// 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
});
&lt;/code&gt;&lt;/pre&gt;
* @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 &amp;&amp; opt.cls){
dlg.el.removeClass(opt.cls);
}
progressBar.reset();
};
// private
var handleEsc = function(d, k, e){
if(opt &amp;&amp; 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 {
<span id='Ext-MessageBox-method-getDialog'> /**
</span> * 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:&quot;center&quot;,
width:400,
height:100,
minHeight: 80,
plain:true,
footer:true,
closable:true,
close : function(){
if(opt &amp;&amp; opt.buttons &amp;&amp; opt.buttons.no &amp;&amp; !opt.buttons.cancel){
handleButton(&quot;no&quot;);
}else{
handleButton(&quot;cancel&quot;);
}
},
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:'&lt;div class=&quot;ext-mb-icon&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ext-mb-content&quot;&gt;&lt;span class=&quot;ext-mb-text&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;ext-mb-fix-cursor&quot;&gt;&lt;input type=&quot;text&quot; class=&quot;ext-mb-input&quot; /&gt;&lt;textarea class=&quot;ext-mb-textarea&quot;&gt;&lt;/textarea&gt;&lt;/div&gt;&lt;/div&gt;'
});
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() &amp;&amp; opt &amp;&amp; opt.buttons){
if(opt.buttons.ok){
handleButton(&quot;ok&quot;);
}else if(opt.buttons.yes){
handleButton(&quot;yes&quot;);
}
}
});
textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);
textareaEl.enableDisplayMode();
progressBar = new Ext.ProgressBar({
renderTo:bodyEl
});
bodyEl.createChild({cls:'x-clear'});
}
return dlg;
},
<span id='Ext-MessageBox-method-updateText'> /**
</span> * 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;amp;#160;')
* @return {Ext.MessageBox} this
*/
updateText : function(text){
if(!dlg.isVisible() &amp;&amp; !opt.width){
dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows
}
// Append a space here for sizing. In IE, for some reason, it wraps text incorrectly without one in some cases
msgEl.update(text ? text + ' ' : '&amp;#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;
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.isIE9m &amp;&amp; w == bwidth){
w += 4; //Add offset when the content width is smaller than the buttons.
}
msgEl.update(text || '&amp;#160;');
dlg.setSize(w, 'auto').center();
return this;
},
<span id='Ext-MessageBox-method-updateProgress'> /**
</span> * 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;
},
<span id='Ext-MessageBox-method-isVisible'> /**
</span> * Returns true if the message box is currently displayed
* @return {Boolean} True if the message box is visible, else false
*/
isVisible : function(){
return dlg &amp;&amp; dlg.isVisible();
},
<span id='Ext-MessageBox-method-hide'> /**
</span> * 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;
},
<span id='Ext-MessageBox-method-show'> /**
</span> * 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: &lt;ul&gt;
* &lt;li&gt;&lt;b&gt;animEl&lt;/b&gt; : String/Element&lt;div class=&quot;sub-desc&quot;&gt;An id or Element from which the message box should animate as it
* opens and closes (defaults to undefined)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;buttons&lt;/b&gt; : Object/Boolean&lt;div class=&quot;sub-desc&quot;&gt;A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',
* cancel:'Bar'}), or false to not show any buttons (defaults to false)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;closable&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;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.&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;cls&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;A custom CSS class to apply to the message box's container element&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;defaultTextHeight&lt;/b&gt; : Number&lt;div class=&quot;sub-desc&quot;&gt;The default height in pixels of the message box's multiline textarea
* if displayed (defaults to 75)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;fn&lt;/b&gt; : Function&lt;div class=&quot;sub-desc&quot;&gt;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.
* &lt;p&gt;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:&lt;ul&gt;
* &lt;li&gt;&lt;b&gt;buttonId&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The ID of the button pressed, one of:&lt;div class=&quot;sub-desc&quot;&gt;&lt;ul&gt;
* &lt;li&gt;&lt;tt&gt;ok&lt;/tt&gt;&lt;/li&gt;
* &lt;li&gt;&lt;tt&gt;yes&lt;/tt&gt;&lt;/li&gt;
* &lt;li&gt;&lt;tt&gt;no&lt;/tt&gt;&lt;/li&gt;
* &lt;li&gt;&lt;tt&gt;cancel&lt;/tt&gt;&lt;/li&gt;
* &lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;text&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;Value of the input field if either &lt;tt&gt;&lt;a href=&quot;#show-option-prompt&quot; ext:member=&quot;show-option-prompt&quot; ext:cls=&quot;Ext.MessageBox&quot;&gt;prompt&lt;/a&gt;&lt;/tt&gt;
* or &lt;tt&gt;&lt;a href=&quot;#show-option-multiline&quot; ext:member=&quot;show-option-multiline&quot; ext:cls=&quot;Ext.MessageBox&quot;&gt;multiline&lt;/a&gt;&lt;/tt&gt; is true&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;opt&lt;/b&gt; : Object&lt;div class=&quot;sub-desc&quot;&gt;The config object passed to show.&lt;/div&gt;&lt;/li&gt;
* &lt;/ul&gt;&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;scope&lt;/b&gt; : Object&lt;div class=&quot;sub-desc&quot;&gt;The scope of the callback function&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;icon&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;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 '')&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;iconCls&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The standard {@link Ext.Window#iconCls} to
* add an optional header icon (defaults to '')&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;maxWidth&lt;/b&gt; : Number&lt;div class=&quot;sub-desc&quot;&gt;The maximum width in pixels of the message box (defaults to 600)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;minWidth&lt;/b&gt; : Number&lt;div class=&quot;sub-desc&quot;&gt;The minimum width in pixels of the message box (defaults to 100)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;modal&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;False to allow user interaction with the page while the message box is
* displayed (defaults to true)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;msg&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;A string that will replace the existing message box body text (defaults to the
* XHTML-compliant non-breaking space character '&amp;amp;#160;')&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;a id=&quot;show-option-multiline&quot;&gt;&lt;/a&gt;&lt;b&gt;multiline&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;
* True to prompt the user to enter multi-line text (defaults to false)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;progress&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to display a progress bar (defaults to false)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;progressText&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The text to display inside the progress bar if progress = true (defaults to '')&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;a id=&quot;show-option-prompt&quot;&gt;&lt;/a&gt;&lt;b&gt;prompt&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to prompt the user to enter single-line text (defaults to false)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;proxyDrag&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to display a lightweight proxy while dragging (defaults to false)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;title&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The title text&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;value&lt;/b&gt; : String&lt;div class=&quot;sub-desc&quot;&gt;The string value to set into the active textbox element if displayed&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;wait&lt;/b&gt; : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to display a progress bar (defaults to false)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;waitConfig&lt;/b&gt; : Object&lt;div class=&quot;sub-desc&quot;&gt;A {@link Ext.ProgressBar#waitConfig} object (applies only if wait = true)&lt;/div&gt;&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;width&lt;/b&gt; : Number&lt;div class=&quot;sub-desc&quot;&gt;The width of the dialog in pixels&lt;/div&gt;&lt;/li&gt;
* &lt;/ul&gt;
* Example usage:
* &lt;pre&gt;&lt;code&gt;
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
});
&lt;/code&gt;&lt;/pre&gt;
* @return {Ext.MessageBox} this
*/
show : function(options){
if(this.isVisible()){
this.hide();
}
opt = options;
var d = this.getDialog(opt.title || &quot;&amp;#160;&quot;);
d.setTitle(opt.title || &quot;&amp;#160;&quot;);
var allowClose = (opt.closable !== false &amp;&amp; opt.progress !== true &amp;&amp; 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 || &quot;&quot;;
if(opt.prompt){
d.focusEl = activeTextEl;
}else{
var bs = opt.buttons;
var db = null;
if(bs &amp;&amp; bs.ok){
db = buttons[&quot;ok&quot;];
}else if(bs &amp;&amp; bs.yes){
db = buttons[&quot;yes&quot;];
}
if (db){
d.focusEl = db;
}
}
if(Ext.isDefined(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;
},
<span id='Ext-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:
* &lt;pre&gt;
Ext.MessageBox.INFO
Ext.MessageBox.WARNING
Ext.MessageBox.QUESTION
Ext.MessageBox.ERROR
*&lt;/pre&gt;
* @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 &amp;&amp; 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;
},
<span id='Ext-MessageBox-method-progress'> /**
</span> * 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;
},
<span id='Ext-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.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;
},
<span id='Ext-MessageBox-method-alert'> /**
</span> * 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 (&lt;code&gt;this&lt;/code&gt; 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;
},
<span id='Ext-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 (&lt;code&gt;this&lt;/code&gt; 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;
},
<span id='Ext-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 (&lt;code&gt;this&lt;/code&gt; 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;
},
<span id='Ext-MessageBox-property-OK'> /**
</span> * Button config that displays a single OK button
* @type Object
*/
OK : {ok:true},
<span id='Ext-MessageBox-property-CANCEL'> /**
</span> * Button config that displays a single Cancel button
* @type Object
*/
CANCEL : {cancel:true},
<span id='Ext-MessageBox-property-OKCANCEL'> /**
</span> * Button config that displays OK and Cancel buttons
* @type Object
*/
OKCANCEL : {ok:true, cancel:true},
<span id='Ext-MessageBox-property-YESNO'> /**
</span> * Button config that displays Yes and No buttons
* @type Object
*/
YESNO : {yes:true, no:true},
<span id='Ext-MessageBox-property-YESNOCANCEL'> /**
</span> * Button config that displays Yes, No and Cancel buttons
* @type Object
*/
YESNOCANCEL : {yes:true, no:true, cancel:true},
<span id='Ext-MessageBox-property-INFO'> /**
</span> * The CSS class that provides the INFO icon image
* @type String
*/
INFO : 'ext-mb-info',
<span id='Ext-MessageBox-property-WARNING'> /**
</span> * The CSS class that provides the WARNING icon image
* @type String
*/
WARNING : 'ext-mb-warning',
<span id='Ext-MessageBox-property-QUESTION'> /**
</span> * The CSS class that provides the QUESTION icon image
* @type String
*/
QUESTION : 'ext-mb-question',
<span id='Ext-MessageBox-property-ERROR'> /**
</span> * The CSS class that provides the ERROR icon image
* @type String
*/
ERROR : 'ext-mb-error',
<span id='Ext-MessageBox-property-defaultTextHeight'> /**
</span> * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)
* @type Number
*/
defaultTextHeight : 75,
<span id='Ext-MessageBox-property-maxWidth'> /**
</span> * The maximum width in pixels of the message box (defaults to 600)
* @type Number
*/
maxWidth : 600,
<span id='Ext-MessageBox-property-minWidth'> /**
</span> * The minimum width in pixels of the message box (defaults to 100)
* @type Number
*/
minWidth : 100,
<span id='Ext-MessageBox-property-minProgressWidth'> /**
</span> * 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,
<span id='Ext-MessageBox-property-minPromptWidth'> /**
</span> * 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,
<span id='Ext-MessageBox-property-buttonText'> /**
</span> * 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 = &quot;oui&quot;; //french
* @type Object
*/
buttonText : {
ok : &quot;OK&quot;,
cancel : &quot;Cancel&quot;,
yes : &quot;Yes&quot;,
no : &quot;No&quot;
}
};
}();
<span id='Ext-Msg'>/**
</span> * Shorthand for {@link Ext.MessageBox}
*/
Ext.Msg = Ext.MessageBox;</pre>
</body>
</html>