/*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
*/
fieldClass : 'x-form-field',
/**
- * @cfg {String} msgTarget<p>The location where the message text set through {@link #markInvalid} should display.
+ * @cfg {String} msgTarget<p>The location where the message text set through {@link #markInvalid} should display.
* Must be one of the following values:</p>
* <div class="mdetail-params"><ul>
* <li><code>qtip</code> Display a quick tip containing the message when the user hovers over the field. This is the default.
}
return String(this.getValue()) !== String(this.originalValue);
},
-
+
/**
* Sets the read only state of this field.
* @param {Boolean} readOnly Whether the field should be read only.
validateValue : function(value){
return true;
},
-
+
/**
* Gets the active error message for this field.
* @return {String} Returns the active error message on the field, if there is no error, an empty string is returned.
*/
getActiveError : function(){
- return this.activeError || '';
+ return this.activeError || '';
},
/**
this.el.findParent('.x-form-field-wrap', 5, true); // else direct field wrap
},
- // private
+ // Alignment for 'under' target
+ alignErrorEl : function(){
+ this.errorEl.setWidth(this.getErrorCt().getWidth(true) - 20);
+ },
+
+ // Alignment for 'side' target
alignErrorIcon : function(){
this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]);
},
return;
}
field.errorEl = elp.createChild({cls:'x-form-invalid-msg'});
- field.errorEl.setWidth(elp.getWidth(true)-20);
+ field.on('resize', field.alignErrorEl, field);
+ field.on('destroy', function(){
+ Ext.destroy(this.errorEl);
+ }, field);
}
+ field.alignErrorEl();
field.errorEl.update(msg);
Ext.form.Field.msgFx[field.msgFx].show(field.errorEl, field);
},
return;
}
field.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
+ field.on('resize', field.alignErrorIcon, field);
+ field.on('destroy', function(){
+ Ext.destroy(this.errorIcon);
+ }, field);
}
field.alignErrorIcon();
field.errorIcon.dom.qtip = msg;
field.errorIcon.dom.qclass = 'x-form-invalid-tip';
field.errorIcon.show();
- field.on('resize', field.alignErrorIcon, field);
},
clear: function(field){
field.el.removeClass(field.invalidClass);
if(field.errorIcon){
field.errorIcon.dom.qtip = '';
field.errorIcon.hide();
- field.un('resize', field.alignErrorIcon, field);
}else{
field.el.dom.title = '';
}
actionMode: 'wrap',
- removeMode: 'container',
-
defaultTriggerWidth: 17,
// private
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
}
this.resizeEl = this.positionEl = this.wrap;
- this.updateEditState();
},
updateEditState: function(){
afterRender : function(){
Ext.form.TriggerField.superclass.afterRender.call(this);
+ this.updateEditState();
},
// private
*/
shadow : 'sides',
/**
- * @cfg {String} listAlign A valid anchor position value. See <tt>{@link Ext.Element#alignTo}</tt> for details
- * on supported anchor positions (defaults to <tt>'tl-bl?'</tt>)
+ * @cfg {String/Array} listAlign A valid anchor position value. See <tt>{@link Ext.Element#alignTo}</tt> for details
+ * on supported anchor positions and offsets. To specify x/y offsets as well, this value
+ * may be specified as an Array of <tt>{@link Ext.Element#alignTo}</tt> method arguments.</p>
+ * <pre><code>[ 'tl-bl?', [6,0] ]</code></pre>(defaults to <tt>'tl-bl?'</tt>)
*/
listAlign : 'tl-bl?',
/**
* <tt>{@link Ext.form.TriggerField#editable editable} = false</tt>).
*/
minChars : 4,
+ /**
+ * @cfg {Boolean} autoSelect <tt>true</tt> to select the first result gathered by the data store (defaults
+ * to <tt>true</tt>). A false value would require a manual selection from the dropdown list to set the components value
+ * unless the value of ({@link #typeAheadDelay}) were true.
+ */
+ autoSelect : true,
/**
* @cfg {Boolean} typeAhead <tt>true</tt> to populate and autoselect the remainder of the text being
* typed after a configurable delay ({@link #typeAheadDelay}) if it matches a known value (defaults
* @param {Ext.form.ComboBox} combo This combo box
*/
'collapse',
+
/**
* @event beforeselect
* Fires before a list item is selected. Return false to cancel the selection.
Ext.form.ComboBox.superclass.initValue.call(this);
if(this.hiddenField){
this.hiddenField.value =
- Ext.isDefined(this.hiddenValue) ? this.hiddenValue :
- Ext.isDefined(this.value) ? this.value : '';
+ Ext.value(Ext.isDefined(this.hiddenValue) ? this.hiddenValue : this.value, '');
}
},
// private
initList : function(){
if(!this.list){
- var cls = 'x-combo-list';
+ var cls = 'x-combo-list',
+ listParent = Ext.getDom(this.getListParent() || Ext.getBody()),
+ zindex = parseInt(Ext.fly(listParent).getStyle('z-index') ,10);
+
+ if (this.ownerCt && !zindex){
+ this.findParentBy(function(ct){
+ zindex = parseInt(ct.getPositionEl().getStyle('z-index'), 10);
+ return !!zindex;
+ });
+ }
this.list = new Ext.Layer({
- parentEl: this.getListParent(),
+ parentEl: listParent,
shadow: this.shadow,
cls: [cls, this.listClass].join(' '),
constrain:false,
- zindex: 12000
+ zindex: (zindex || 12000) + 5
});
var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
singleSelect: true,
selectedClass: this.selectedClass,
itemSelector: this.itemSelector || '.' + cls + '-item',
- emptyText: this.listEmptyText
+ emptyText: this.listEmptyText,
+ deferEmptyText: false
});
- this.mon(this.view, 'click', this.onViewClick, this);
+ this.mon(this.view, {
+ containerclick : this.onViewClick,
+ click : this.onViewClick,
+ scope :this
+ });
this.bindStore(this.store, true);
initEvents : function(){
Ext.form.ComboBox.superclass.initEvents.call(this);
+
this.keyNav = new Ext.KeyNav(this.el, {
"up" : function(e){
this.inKeyMode = true;
},
"tab" : function(e){
- this.onViewClick(false);
+ this.collapse();
return true;
},
}
},
+
// private
onDestroy : function(){
if (this.dqTask){
if(this.editable){
this.el.dom.select();
}
- if(!this.selectByValue(this.value, true)){
+
+ if(this.autoSelect !== false && !this.selectByValue(this.value, true)){
this.select(0, true);
}
}else{
- this.selectNext();
+ if(this.autoSelect !== false){
+ this.selectNext();
+ }
if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
this.taTask.delay(this.typeAheadDelay);
}
}
}else{
- this.onEmptyResults();
+ this.collapse();
}
- //this.el.focus();
+
},
// private
}
},
+ // private
+ assertValue : function(){
+
+ var val = this.getRawValue(),
+ rec = this.findRecord(this.displayField, val);
+
+ if(!rec && this.forceSelection){
+ if(val.length > 0 && val != this.emptyText){
+ this.el.dom.value = Ext.value(this.lastSelectionText, '');
+ this.applyEmptyText();
+ }else{
+ this.clearValue();
+ }
+ }else{
+ if(rec){
+ val = rec.get(this.valueField || this.displayField);
+ }
+ this.setValue(val);
+ }
+
+ },
+
// private
onSelect : function(record, index){
if(this.fireEvent('beforeselect', this, record, index) !== false){
}
this.lastSelectionText = text;
if(this.hiddenField){
- this.hiddenField.value = v;
+ this.hiddenField.value = Ext.value(v, '');
}
Ext.form.ComboBox.superclass.setValue.call(this, text);
this.value = v;
r = s.getAt(index);
if(r){
this.onSelect(r, index);
- }else if(s.getCount() === 0){
- this.onEmptyResults();
+ }else {
+ this.collapse();
}
if(doFocus !== false){
this.el.focus();
}
},
+
// private
restrictHeight : function(){
this.innerList.dom.style.height = '';
this.innerList.setHeight(h);
this.list.beginUpdate();
this.list.setHeight(h+pad);
- this.list.alignTo(this.wrap, this.listAlign);
+ this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign));
this.list.endUpdate();
},
- // private
- onEmptyResults : function(){
- this.collapse();
- },
-
/**
* Returns true if the dropdown list is expanded, else false.
*/
this.innerList.scrollChildIntoView(el, false);
}
}
+
},
// private
onKeyUp : function(e){
var k = e.getKey();
if(this.editable !== false && this.readOnly !== true && (k == e.BACKSPACE || !e.isSpecialKey())){
+
this.lastKey = k;
this.dqTask.delay(this.queryDelay);
}
// private
beforeBlur : function(){
- var val = this.getRawValue(),
- rec = this.findRecord(this.displayField, val);
- if(!rec && this.forceSelection){
- if(val.length > 0 && val != this.emptyText){
- this.el.dom.value = Ext.isEmpty(this.lastSelectionText) ? '' : this.lastSelectionText;
- this.applyEmptyText();
- }else{
- this.clearValue();
- }
- }else{
- if(rec){
- val = rec.get(this.valueField || this.displayField);
- }
- this.setValue(val);
- }
+ this.assertValue();
+ },
+
+ // private
+ postBlur : function(){
+ Ext.form.ComboBox.superclass.postBlur.call(this);
+ this.collapse();
+ this.inKeyMode = false;
},
/**
this.doResize(this.bufferSize);
delete this.bufferSize;
}
- this.list.alignTo(this.wrap, this.listAlign);
+ this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign));
this.list.show();
if(Ext.isGecko2){
this.innerList.setOverflow('auto'); // necessary for FF 2.0/Mac
setValue : function(v){
if (typeof v == 'boolean') {
Ext.form.Radio.superclass.setValue.call(this, v);
- } else {
+ } else if (this.rendered) {
var r = this.getCheckEl().child('input[name=' + this.el.dom.name + '][value=' + v + ']', true);
if(r){
Ext.getCmp(r.id).setValue(true);
}
return this;
},
-
+
// private
getCheckEl: function(){
if(this.inGroup){
* @param {Mixed} el The form element or its id
* @param {Object} config Configuration options
*/
-Ext.form.BasicForm = function(el, config){
- Ext.apply(this, config);
- if(Ext.isString(this.paramOrder)){
- this.paramOrder = this.paramOrder.split(/[\s,|]/);
- }
- /**
- * A {@link Ext.util.MixedCollection MixedCollection} containing all the Ext.form.Fields in this form.
- * @type MixedCollection
- * @property items
- */
- this.items = new Ext.util.MixedCollection(false, function(o){
- return o.getItemId();
- });
- this.addEvents(
- /**
- * @event beforeaction
- * Fires before any action is performed. Return false to cancel the action.
- * @param {Form} this
- * @param {Action} action The {@link Ext.form.Action} to be performed
- */
- 'beforeaction',
- /**
- * @event actionfailed
- * Fires when an action fails.
- * @param {Form} this
- * @param {Action} action The {@link Ext.form.Action} that failed
- */
- 'actionfailed',
+Ext.form.BasicForm = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(el, config){
+ Ext.apply(this, config);
+ if(Ext.isString(this.paramOrder)){
+ this.paramOrder = this.paramOrder.split(/[\s,|]/);
+ }
/**
- * @event actioncomplete
- * Fires when an action is completed.
- * @param {Form} this
- * @param {Action} action The {@link Ext.form.Action} that completed
+ * A {@link Ext.util.MixedCollection MixedCollection} containing all the Ext.form.Fields in this form.
+ * @type MixedCollection
+ * @property items
*/
- 'actioncomplete'
- );
-
- if(el){
- this.initEl(el);
- }
- Ext.form.BasicForm.superclass.constructor.call(this);
-};
+ this.items = new Ext.util.MixedCollection(false, function(o){
+ return o.getItemId();
+ });
+ this.addEvents(
+ /**
+ * @event beforeaction
+ * Fires before any action is performed. Return false to cancel the action.
+ * @param {Form} this
+ * @param {Action} action The {@link Ext.form.Action} to be performed
+ */
+ 'beforeaction',
+ /**
+ * @event actionfailed
+ * Fires when an action fails.
+ * @param {Form} this
+ * @param {Action} action The {@link Ext.form.Action} that failed
+ */
+ 'actionfailed',
+ /**
+ * @event actioncomplete
+ * Fires when an action is completed.
+ * @param {Form} this
+ * @param {Action} action The {@link Ext.form.Action} that completed
+ */
+ 'actioncomplete'
+ );
-Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {
+ if(el){
+ this.initEl(el);
+ }
+ Ext.form.BasicForm.superclass.constructor.call(this);
+ },
+
/**
* @cfg {String} method
* The request method to use (GET or POST) for form actions if one isn't supplied in the action options.
this.el = document.createElement('fieldset');\r
this.el.id = this.id;\r
if (this.title || this.header || this.checkboxToggle) {\r
- this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';\r
+ this.el.appendChild(document.createElement('legend')).className = this.baseCls + '-header';\r
}\r
}\r
\r
createToolbar : function(editor){
var items = [];
var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled();\r
-
+
function btn(id, toggle, handler){
return {
html: this.createFontOptions()\r
}\r
});
-
+
items.push(
fontSelectItem,
'-'
);
}
}\r
- \r
+\r
// build the toolbar\r
var tb = new Ext.Toolbar({\r
renderTo: this.wrap.dom.firstChild,\r
items: items\r
});\r
- \r
+\r
if (fontSelectItem) {\r
this.fontSelect = fontSelectItem.el;\r
- \r
+\r
this.mon(this.fontSelect, 'change', function(){\r
var font = this.fontSelect.dom.value;\r
this.relayCmd('fontname', font);\r
this.mon(tb.el, 'click', function(e){\r
e.preventDefault();\r
});\r
- \r
- \r
-
+
this.tb = tb;
},
},
setReadOnly: function(readOnly){
- if(this.initialized){
- var newDM = readOnly ? 'off' : 'on',
- doc = this.getDoc();
- if(String(doc.designMode).toLowerCase() != newDM){
- doc.designMode = newDM;
- }
- this.disableItems(!readOnly);
- }
+
Ext.form.HtmlEditor.superclass.setReadOnly.call(this, readOnly);
+ if(this.initialized){\r
+ this.setDesignMode(!readOnly);\r
+ var bd = this.getEditorBody();\r
+ if(bd){\r
+ bd.style.cursor = this.readOnly ? 'default' : 'text';\r
+ }\r
+ this.disableItems(readOnly);\r
+ }\r
},
/**
* Protected method that will not generally be called directly. It
* is called when the editor initializes the iframe with HTML contents. Override this method if you
* want to change the initialization markup of the iframe (e.g. to add stylesheets).
+ *\r
+ * Note: IE8-Standards has unwanted scroller behavior, so the default meta tag forces IE7 compatibility\r
*/
getDocMarkup : function(){
- return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';
+ return '<html><head><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';
},
// private
this.createToolbar(this);
this.disableItems(true);
- // is this needed?
- // this.tb.doLayout();
+
+ this.tb.doLayout();
this.createIFrame();
var iframe = document.createElement('iframe');
iframe.name = Ext.id();
iframe.frameBorder = '0';
- iframe.src = Ext.SSL_SECURE_URL;
- this.wrap.dom.appendChild(iframe);
+ iframe.style.overflow = 'auto';\r
+ this.wrap.dom.appendChild(iframe);
this.iframe = iframe;
this.monitorTask = Ext.TaskMgr.start({
var doc = this.getDoc();
if(doc.body || doc.readyState == 'complete'){
Ext.TaskMgr.stop(task);
- doc.designMode="on";
+ this.setDesignMode(true);
this.initEditor.defer(10, this);
}
},
if(!doc){
return;
}
- if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){
+ if(!doc.editorInitialized || this.getDesignMode() != 'on'){
this.initFrame();
}
}
},
-
+\r
+ /* private\r
+ * set current design mode. To enable, mode can be true or 'on', off otherwise\r
+ */\r
+ setDesignMode : function(mode){\r
+ var doc ;\r
+ if(doc = this.getDoc()){\r
+ if(this.readOnly){\r
+ mode = false;\r
+ }\r
+ doc.designMode = (/on|true/i).test(String(mode).toLowerCase()) ?'on':'off';\r
+ }\r
+\r
+ },\r
+\r
+ // private\r
+ getDesignMode : function(){
+ var doc = this.getDoc();\r
+ if(!doc){ return ''; }\r
+ return String(doc.designMode).toLowerCase();\r
+\r
+ },\r
+\r
disableItems: function(disabled){
if(this.fontSelect){
this.fontSelect.dom.disabled = disabled;
}
this.sourceEditMode = sourceEditMode === true;
var btn = this.tb.getComponent('sourceedit');
-
+
if(btn.pressed !== this.sourceEditMode){
btn.toggle(this.sourceEditMode);
if(!btn.xtbHidden){
this.el.dom.removeAttribute('tabIndex');
this.el.focus();
}else{
- if(this.initialized && !this.readOnly){
- this.disableItems(false);
+ if(this.initialized){
+ this.disableItems(this.readOnly);
}
this.pushValue();
this.iframe.className = '';
this.getEditorBody().innerHTML = v;
if(Ext.isGecko){
// Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8
- var d = this.getDoc(),
- mode = d.designMode.toLowerCase();
-
- d.designMode = mode.toggle('on', 'off');
- d.designMode = mode;
+ this.setDesignMode(false); //toggle off first\r
+\r
}
+ this.setDesignMode(true);\r
this.fireEvent('push', this, v);
}
+\r
}
},
ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat'),
doc,
fn;
-
+
ss['background-attachment'] = 'fixed'; // w3c
dbody.bgProperties = 'fixed'; // ie
Ext.DomHelper.applyStyles(dbody, ss);
-
+
doc = this.getDoc();
if(doc){
this.wrap.remove();
}
}
-
+
if(this.el){
this.el.removeAllListeners();
this.el.remove();
// private
onFirstFocus : function(){
this.activated = true;
- this.disableItems(false);
+ this.disableItems(this.readOnly);
if(Ext.isGecko){ // prevent silly gecko errors
this.win.focus();
var s = this.win.getSelection();
return;
}
- var btns = this.tb.items.map,
+ var btns = this.tb.items.map,
doc = this.getDoc();
if(this.enableFont && !Ext.isSafari2){
fixKeys : function(){ // load time branching for fastest keydown performance
if(Ext.isIE){
return function(e){
- var k = e.getKey(),
+ var k = e.getKey(),
doc = this.getDoc(),
r;
if(k == e.TAB){