ext-all-debug.js
上传用户:chliyg
上传日期:2016-05-15
资源大小:3196k
文件大小:951k
源码类别:

Jsp/Servlet

开发平台:

Java

  1.          update : function(date, forceRefresh){
  2.         var vd = this.activeDate;
  3.         this.activeDate = date;
  4.         if(!forceRefresh && vd && this.el){
  5.             var t = date.getTime();
  6.             if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){
  7.                 this.cells.removeClass("x-date-selected");
  8.                 this.cells.each(function(c){
  9.                    if(c.dom.firstChild.dateValue == t){
  10.                        c.addClass("x-date-selected");
  11.                        setTimeout(function(){
  12.                             try{c.dom.firstChild.focus();}catch(e){}
  13.                        }, 50);
  14.                        return false;
  15.                    }
  16.                 });
  17.                 return;
  18.             }
  19.         }
  20.         var days = date.getDaysInMonth();
  21.         var firstOfMonth = date.getFirstDateOfMonth();
  22.         var startingPos = firstOfMonth.getDay()-this.startDay;
  23.         if(startingPos <= this.startDay){
  24.             startingPos += 7;
  25.         }
  26.         var pm = date.add("mo", -1);
  27.         var prevStart = pm.getDaysInMonth()-startingPos;
  28.         var cells = this.cells.elements;
  29.         var textEls = this.textNodes;
  30.         days += startingPos;
  31.                  var day = 86400000;
  32.         var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();
  33.         var today = new Date().clearTime().getTime();
  34.         var sel = date.clearTime().getTime();
  35.         var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;
  36.         var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;
  37.         var ddMatch = this.disabledDatesRE;
  38.         var ddText = this.disabledDatesText;
  39.         var ddays = this.disabledDays ? this.disabledDays.join("") : false;
  40.         var ddaysText = this.disabledDaysText;
  41.         var format = this.format;
  42.         
  43.         if(this.showToday){
  44.             var td = new Date().clearTime();
  45.             var disable = (td < min || td > max || 
  46.                 (ddMatch && format && ddMatch.test(td.dateFormat(format))) || 
  47.                 (ddays && ddays.indexOf(td.getDay()) != -1));
  48.                         
  49.             this.todayBtn.setDisabled(disable);
  50.             this.todayKeyListener[disable ? 'disable' : 'enable']();
  51.         }
  52.         var setCellClass = function(cal, cell){
  53.             cell.title = "";
  54.             var t = d.getTime();
  55.             cell.firstChild.dateValue = t;
  56.             if(t == today){
  57.                 cell.className += " x-date-today";
  58.                 cell.title = cal.todayText;
  59.             }
  60.             if(t == sel){
  61.                 cell.className += " x-date-selected";
  62.                 setTimeout(function(){
  63.                     try{cell.firstChild.focus();}catch(e){}
  64.                 }, 50);
  65.             }
  66.                          if(t < min) {
  67.                 cell.className = " x-date-disabled";
  68.                 cell.title = cal.minText;
  69.                 return;
  70.             }
  71.             if(t > max) {
  72.                 cell.className = " x-date-disabled";
  73.                 cell.title = cal.maxText;
  74.                 return;
  75.             }
  76.             if(ddays){
  77.                 if(ddays.indexOf(d.getDay()) != -1){
  78.                     cell.title = ddaysText;
  79.                     cell.className = " x-date-disabled";
  80.                 }
  81.             }
  82.             if(ddMatch && format){
  83.                 var fvalue = d.dateFormat(format);
  84.                 if(ddMatch.test(fvalue)){
  85.                     cell.title = ddText.replace("%0", fvalue);
  86.                     cell.className = " x-date-disabled";
  87.                 }
  88.             }
  89.         };
  90.         var i = 0;
  91.         for(; i < startingPos; i++) {
  92.             textEls[i].innerHTML = (++prevStart);
  93.             d.setDate(d.getDate()+1);
  94.             cells[i].className = "x-date-prevday";
  95.             setCellClass(this, cells[i]);
  96.         }
  97.         for(; i < days; i++){
  98.             intDay = i - startingPos + 1;
  99.             textEls[i].innerHTML = (intDay);
  100.             d.setDate(d.getDate()+1);
  101.             cells[i].className = "x-date-active";
  102.             setCellClass(this, cells[i]);
  103.         }
  104.         var extraDays = 0;
  105.         for(; i < 42; i++) {
  106.              textEls[i].innerHTML = (++extraDays);
  107.              d.setDate(d.getDate()+1);
  108.              cells[i].className = "x-date-nextday";
  109.              setCellClass(this, cells[i]);
  110.         }
  111.         this.mbtn.setText(this.monthNames[date.getMonth()] + " " + date.getFullYear());
  112.         if(!this.internalRender){
  113.             var main = this.el.dom.firstChild;
  114.             var w = main.offsetWidth;
  115.             this.el.setWidth(w + this.el.getBorderWidth("lr"));
  116.             Ext.fly(main).setWidth(w);
  117.             this.internalRender = true;
  118.                                                    if(Ext.isOpera && !this.secondPass){
  119.                 main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px";
  120.                 this.secondPass = true;
  121.                 this.update.defer(10, this, [date]);
  122.             }
  123.         }
  124.     },
  125.          beforeDestroy : function() {
  126.         if(this.rendered){
  127.             Ext.destroy(this.mbtn, this.todayBtn);
  128.         }
  129.     }
  130.     
  131. });
  132. Ext.reg('datepicker', Ext.DatePicker); Ext.TabPanel = Ext.extend(Ext.Panel,  {               monitorResize : true,          deferredRender : true,          tabWidth: 120,          minTabWidth: 30,          resizeTabs:false,          enableTabScroll: false,          scrollIncrement : 0,          scrollRepeatInterval : 400,          scrollDuration : .35,          animScroll : true,          tabPosition: 'top',          baseCls: 'x-tab-panel',          autoTabs : false,          autoTabSelector:'div.x-tab',          activeTab : null,          tabMargin : 2,          plain: false,          wheelIncrement : 20,          idDelimiter : '__',         itemCls : 'x-tab-item',         elements: 'body',     headerAsText: false,     frame: false,     hideBorders:true,         initComponent : function(){         this.frame = false;         Ext.TabPanel.superclass.initComponent.call(this);         this.addEvents(                          'beforetabchange',                          'tabchange',                          'contextmenu'         );         this.setLayout(new Ext.layout.CardLayout({             deferredRender: this.deferredRender         }));         if(this.tabPosition == 'top'){             this.elements += ',header';             this.stripTarget = 'header';         }else {             this.elements += ',footer';             this.stripTarget = 'footer';         }         if(!this.stack){             this.stack = Ext.TabPanel.AccessStack();         }         this.initItems();     },         render : function(){         Ext.TabPanel.superclass.render.apply(this, arguments);         if(this.activeTab !== undefined){             var item = this.activeTab;             delete this.activeTab;             this.setActiveTab(item);         }     },         onRender : function(ct, position){         Ext.TabPanel.superclass.onRender.call(this, ct, position);         if(this.plain){             var pos = this.tabPosition == 'top' ? 'header' : 'footer';             this[pos].addClass('x-tab-panel-'+pos+'-plain');         }         var st = this[this.stripTarget];         this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{             tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});         var beforeEl = (this.tabPosition=='bottom' ? this.stripWrap : null);         this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'}, beforeEl);         this.strip = new Ext.Element(this.stripWrap.dom.firstChild);                  this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'});         this.strip.createChild({cls:'x-clear'});         this.body.addClass('x-tab-panel-body-'+this.tabPosition);         if(!this.itemTpl){             var tt = new Ext.Template(                  '<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',                  '<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',                  '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',                  '</em></a></li>'             );             tt.disableFormats = true;             tt.compile();             Ext.TabPanel.prototype.itemTpl = tt;         }         this.items.each(this.initTab, this);     },         afterRender : function(){         Ext.TabPanel.superclass.afterRender.call(this);         if(this.autoTabs){             this.readTabs(false);         }     },         initEvents : function(){         Ext.TabPanel.superclass.initEvents.call(this);         this.on('add', this.onAdd, this);         this.on('remove', this.onRemove, this);         this.strip.on('mousedown', this.onStripMouseDown, this);         this.strip.on('contextmenu', this.onStripContextMenu, this);         if(this.enableTabScroll){             this.strip.on('mousewheel', this.onWheel, this);         }     },         findTargets : function(e){         var item = null;         var itemEl = e.getTarget('li', this.strip);         if(itemEl){             item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);             if(item.disabled){                 return {                     close : null,                     item : null,                     el : null                 };             }         }         return {             close : e.getTarget('.x-tab-strip-close', this.strip),             item : item,             el : itemEl         };     },         onStripMouseDown : function(e){         if(e.button != 0){             return;         }         e.preventDefault();         var t = this.findTargets(e);         if(t.close){             this.remove(t.item);             return;         }         if(t.item && t.item != this.activeTab){             this.setActiveTab(t.item);         }     },         onStripContextMenu : function(e){         e.preventDefault();         var t = this.findTargets(e);         if(t.item){             this.fireEvent('contextmenu', this, t.item, e);         }     },          readTabs : function(removeExisting){         if(removeExisting === true){             this.items.each(function(item){                 this.remove(item);             }, this);         }         var tabs = this.el.query(this.autoTabSelector);         for(var i = 0, len = tabs.length; i < len; i++){             var tab = tabs[i];             var title = tab.getAttribute('title');             tab.removeAttribute('title');             this.add({                 title: title,                 el: tab             });         }     },         initTab : function(item, index){         var before = this.strip.dom.childNodes[index];         var cls = item.closable ? 'x-tab-strip-closable' : '';         if(item.disabled){             cls += ' x-item-disabled';         }         if(item.iconCls){             cls += ' x-tab-with-icon';         }         if(item.tabCls){             cls += ' ' + item.tabCls;         }                  var p = {             id: this.id + this.idDelimiter + item.getItemId(),             text: item.title,             cls: cls,             iconCls: item.iconCls || ''         };         var el = before ?                  this.itemTpl.insertBefore(before, p) :                  this.itemTpl.append(this.strip, p);         Ext.fly(el).addClassOnOver('x-tab-strip-over');         if(item.tabTip){             Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip;         }         item.on('disable', this.onItemDisabled, this);         item.on('enable', this.onItemEnabled, this);         item.on('titlechange', this.onItemTitleChanged, this);         item.on('beforeshow', this.onBeforeShowItem, this);     },         onAdd : function(tp, item, index){         this.initTab(item, index);         if(this.items.getCount() == 1){             this.syncSize();         }         this.delegateUpdates();     },         onBeforeAdd : function(item){         var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);         if(existing){             this.setActiveTab(item);             return false;         }         Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);         var es = item.elements;         item.elements = es ? es.replace(',header', '') : es;         item.border = (item.border === true);     },         onRemove : function(tp, item){         Ext.removeNode(this.getTabEl(item));         this.stack.remove(item);         item.un('disable', this.onItemDisabled, this);         item.un('enable', this.onItemEnabled, this);         item.un('titlechange', this.onItemTitleChanged, this);         item.un('beforeshow', this.onBeforeShowItem, this);         if(item == this.activeTab){             var next = this.stack.next();             if(next){                 this.setActiveTab(next);             }else{                 this.setActiveTab(0);             }         }         this.delegateUpdates();     },         onBeforeShowItem : function(item){         if(item != this.activeTab){             this.setActiveTab(item);             return false;         }     },         onItemDisabled : function(item){         var el = this.getTabEl(item);         if(el){             Ext.fly(el).addClass('x-item-disabled');         }         this.stack.remove(item);     },         onItemEnabled : function(item){         var el = this.getTabEl(item);         if(el){             Ext.fly(el).removeClass('x-item-disabled');         }     },         onItemTitleChanged : function(item){         var el = this.getTabEl(item);         if(el){             Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;         }     },          getTabEl : function(item){         var itemId = (typeof item === 'number')?this.items.items[item].getItemId() : item.getItemId();         return document.getElementById(this.id+this.idDelimiter+itemId);     },         onResize : function(){         Ext.TabPanel.superclass.onResize.apply(this, arguments);         this.delegateUpdates();     },          beginUpdate : function(){         this.suspendUpdates = true;     },          endUpdate : function(){         this.suspendUpdates = false;         this.delegateUpdates();     },          hideTabStripItem : function(item){         item = this.getComponent(item);         var el = this.getTabEl(item);         if(el){             el.style.display = 'none';             this.delegateUpdates();         }         this.stack.remove(item);     },          unhideTabStripItem : function(item){         item = this.getComponent(item);         var el = this.getTabEl(item);         if(el){             el.style.display = '';             this.delegateUpdates();         }     },         delegateUpdates : function(){         if(this.suspendUpdates){             return;         }         if(this.resizeTabs && this.rendered){             this.autoSizeTabs();         }         if(this.enableTabScroll && this.rendered){             this.autoScrollTabs();         }     },         autoSizeTabs : function(){         var count = this.items.length;         var ce = this.tabPosition != 'bottom' ? 'header' : 'footer';         var ow = this[ce].dom.offsetWidth;         var aw = this[ce].dom.clientWidth;         if(!this.resizeTabs || count < 1 || !aw){             return;         }         var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth);         this.lastTabWidth = each;         var lis = this.stripWrap.dom.getElementsByTagName('li');         for(var i = 0, len = lis.length-1; i < len; i++) {             var li = lis[i];             var inner = li.childNodes[1].firstChild.firstChild;             var tw = li.offsetWidth;             var iw = inner.offsetWidth;             inner.style.width = (each - (tw-iw)) + 'px';         }     },         adjustBodyWidth : function(w){         if(this.header){             this.header.setWidth(w);         }         if(this.footer){             this.footer.setWidth(w);         }         return w;     },          setActiveTab : function(item){         item = this.getComponent(item);         if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){             return;         }         if(!this.rendered){             this.activeTab = item;             return;         }         if(this.activeTab != item){             if(this.activeTab){                 var oldEl = this.getTabEl(this.activeTab);                 if(oldEl){                     Ext.fly(oldEl).removeClass('x-tab-strip-active');                 }                 this.activeTab.fireEvent('deactivate', this.activeTab);             }             var el = this.getTabEl(item);             Ext.fly(el).addClass('x-tab-strip-active');             this.activeTab = item;             this.stack.add(item);             this.layout.setActiveItem(item);             if(this.layoutOnTabChange && item.doLayout){                 item.doLayout();             }             if(this.scrolling){                 this.scrollToTab(item, this.animScroll);             }             item.fireEvent('activate', item);             this.fireEvent('tabchange', this, item);         }     },          getActiveTab : function(){         return this.activeTab || null;     },          getItem : function(item){         return this.getComponent(item);     },         autoScrollTabs : function(){         var count = this.items.length;         var ow = this.header.dom.offsetWidth;         var tw = this.header.dom.clientWidth;         var wrap = this.stripWrap;         var wd = wrap.dom;         var cw = wd.offsetWidth;         var pos = this.getScrollPos();         var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;         if(!this.enableTabScroll || count < 1 || cw < 20){             return;         }         if(l <= tw){             wd.scrollLeft = 0;             wrap.setWidth(tw);             if(this.scrolling){                 this.scrolling = false;                 this.header.removeClass('x-tab-scrolling');                 this.scrollLeft.hide();                 this.scrollRight.hide();                 if(Ext.isAir){                     wd.style.marginLeft = '';                     wd.style.marginRight = '';                 }             }         }else{             if(!this.scrolling){                 this.header.addClass('x-tab-scrolling');                 if(Ext.isAir){                     wd.style.marginLeft = '18px';                     wd.style.marginRight = '18px';                 }             }             tw -= wrap.getMargins('lr');             wrap.setWidth(tw > 20 ? tw : 20);             if(!this.scrolling){                 if(!this.scrollLeft){                     this.createScrollers();                 }else{                     this.scrollLeft.show();                     this.scrollRight.show();                 }             }             this.scrolling = true;             if(pos > (l-tw)){                 wd.scrollLeft = l-tw;             }else{                 this.scrollToTab(this.activeTab, false);             }             this.updateScrollButtons();         }     },         createScrollers : function(){         var h = this.stripWrap.dom.offsetHeight;                 var sl = this.header.insertFirst({             cls:'x-tab-scroller-left'         });         sl.setHeight(h);         sl.addClassOnOver('x-tab-scroller-left-over');         this.leftRepeater = new Ext.util.ClickRepeater(sl, {             interval : this.scrollRepeatInterval,             handler: this.onScrollLeft,             scope: this         });         this.scrollLeft = sl;                 var sr = this.header.insertFirst({             cls:'x-tab-scroller-right'         });         sr.setHeight(h);         sr.addClassOnOver('x-tab-scroller-right-over');         this.rightRepeater = new Ext.util.ClickRepeater(sr, {             interval : this.scrollRepeatInterval,             handler: this.onScrollRight,             scope: this         });         this.scrollRight = sr;     },         getScrollWidth : function(){         return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();     },         getScrollPos : function(){         return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;     },         getScrollArea : function(){         return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;     },         getScrollAnim : function(){         return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};     },         getScrollIncrement : function(){         return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);     },          scrollToTab : function(item, animate){         if(!item){ return; }         var el = this.getTabEl(item);         var pos = this.getScrollPos(), area = this.getScrollArea();         var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;         var right = left + el.offsetWidth;         if(left < pos){             this.scrollTo(left, animate);         }else if(right > (pos + area)){             this.scrollTo(right - area, animate);         }     },         scrollTo : function(pos, animate){         this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);         if(!animate){             this.updateScrollButtons();         }     },     onWheel : function(e){         var d = e.getWheelDelta()*this.wheelIncrement*-1;         e.stopEvent();         var pos = this.getScrollPos();         var newpos = pos + d;         var sw = this.getScrollWidth()-this.getScrollArea();         var s = Math.max(0, Math.min(sw, newpos));         if(s != pos){             this.scrollTo(s, false);         }     },         onScrollRight : function(){         var sw = this.getScrollWidth()-this.getScrollArea();         var pos = this.getScrollPos();         var s = Math.min(sw, pos + this.getScrollIncrement());         if(s != pos){             this.scrollTo(s, this.animScroll);         }     },         onScrollLeft : function(){         var pos = this.getScrollPos();         var s = Math.max(0, pos - this.getScrollIncrement());         if(s != pos){             this.scrollTo(s, this.animScroll);         }     },         updateScrollButtons : function(){         var pos = this.getScrollPos();         this.scrollLeft[pos == 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');         this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');     }                                                        }); Ext.reg('tabpanel', Ext.TabPanel); Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab; Ext.TabPanel.AccessStack = function(){     var items = [];     return {         add : function(item){             items.push(item);             if(items.length > 10){                 items.shift();             }         },         remove : function(item){             var s = [];             for(var i = 0, len = items.length; i < len; i++) {                 if(items[i] != item){                     s.push(items[i]);                 }             }             items = s;         },         next : function(){             return items.pop();         }     }; }; Ext.Button = Ext.extend(Ext.Component, {          hidden : false,          disabled : false,          pressed : false,                         enableToggle: false,                    menuAlign : "tl-bl?",               type : 'button',         menuClassTarget: 'tr',          clickEvent : 'click',          handleMouseEvents : true,          tooltipType : 'qtip',     buttonSelector : "button:first",               initComponent : function(){         Ext.Button.superclass.initComponent.call(this);         this.addEvents(                          "click",                          "toggle",                          'mouseover',                          'mouseout',                          'menushow',                          'menuhide',                          'menutriggerover',                          'menutriggerout'         );         if(this.menu){             this.menu = Ext.menu.MenuMgr.get(this.menu);         }         if(typeof this.toggleGroup === 'string'){             this.enableToggle = true;         }     },         onRender : function(ct, position){         if(!this.template){             if(!Ext.Button.buttonTemplate){                                 Ext.Button.buttonTemplate = new Ext.Template(                     '<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',                     '<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',                     "</tr></tbody></table>");             }             this.template = Ext.Button.buttonTemplate;         }         var btn, targs = [this.text || '&#160;', this.type];         if(position){             btn = this.template.insertBefore(position, targs, true);         }else{             btn = this.template.append(ct, targs, true);         }         var btnEl = btn.child(this.buttonSelector);         btnEl.on('focus', this.onFocus, this);         btnEl.on('blur', this.onBlur, this);         this.initButtonEl(btn, btnEl);         if(this.menu){             this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");         }         Ext.ButtonToggleMgr.register(this);     },         initButtonEl : function(btn, btnEl){         this.el = btn;         btn.addClass("x-btn");         if(this.icon){             btnEl.setStyle('background-image', 'url(' +this.icon +')');         }         if(this.iconCls){             btnEl.addClass(this.iconCls);             if(!this.cls){                 btn.addClass(this.text ? 'x-btn-text-icon' : 'x-btn-icon');             }         }         if(this.tabIndex !== undefined){             btnEl.dom.tabIndex = this.tabIndex;         }         if(this.tooltip){             if(typeof this.tooltip == 'object'){                 Ext.QuickTips.register(Ext.apply({                       target: btnEl.id                 }, this.tooltip));             } else {                 btnEl.dom[this.tooltipType] = this.tooltip;             }         }         if(this.pressed){             this.el.addClass("x-btn-pressed");         }         if(this.handleMouseEvents){             btn.on("mouseover", this.onMouseOver, this);                                     btn.on("mousedown", this.onMouseDown, this);         }         if(this.menu){             this.menu.on("show", this.onMenuShow, this);             this.menu.on("hide", this.onMenuHide, this);         }         if(this.id){             this.el.dom.id = this.el.id = this.id;         }         if(this.repeat){             var repeater = new Ext.util.ClickRepeater(btn,                 typeof this.repeat == "object" ? this.repeat : {}             );             repeater.on("click", this.onClick,  this);         }         btn.on(this.clickEvent, this.onClick, this);     },         afterRender : function(){         Ext.Button.superclass.afterRender.call(this);         if(Ext.isIE6){             this.autoWidth.defer(1, this);         }else{             this.autoWidth();         }     },          setIconClass : function(cls){         if(this.el){             this.el.child(this.buttonSelector).replaceClass(this.iconCls, cls);         }         this.iconCls = cls;     },         beforeDestroy: function(){      if(this.rendered){         var btn = this.el.child(this.buttonSelector);         if(btn){             btn.removeAllListeners();         }     }         if(this.menu){             Ext.destroy(this.menu);         }     },         onDestroy : function(){         if(this.rendered){             Ext.ButtonToggleMgr.unregister(this);         }     },         autoWidth : function(){         if(this.el){             this.el.setWidth("auto");             if(Ext.isIE7 && Ext.isStrict){                 var ib = this.el.child(this.buttonSelector);                 if(ib && ib.getWidth() > 20){                     ib.clip();                     ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));                 }             }             if(this.minWidth){                 if(this.el.getWidth() < this.minWidth){                     this.el.setWidth(this.minWidth);                 }             }         }     },          setHandler : function(handler, scope){         this.handler = handler;         this.scope = scope;     },          setText : function(text){         this.text = text;         if(this.el){             this.el.child("td.x-btn-center " + this.buttonSelector).update(text);         }         this.autoWidth();     },          getText : function(){         return this.text;     },          toggle : function(state){         state = state === undefined ? !this.pressed : state;         if(state != this.pressed){             if(state){                 this.el.addClass("x-btn-pressed");                 this.pressed = true;                 this.fireEvent("toggle", this, true);             }else{                 this.el.removeClass("x-btn-pressed");                 this.pressed = false;                 this.fireEvent("toggle", this, false);             }             if(this.toggleHandler){                 this.toggleHandler.call(this.scope || this, this, state);             }         }     },          focus : function(){         this.el.child(this.buttonSelector).focus();     },         onDisable : function(){         if(this.el){             if(!Ext.isIE6 || !this.text){                 this.el.addClass(this.disabledClass);             }             this.el.dom.disabled = true;         }         this.disabled = true;     },         onEnable : function(){         if(this.el){             if(!Ext.isIE6 || !this.text){                 this.el.removeClass(this.disabledClass);             }             this.el.dom.disabled = false;         }         this.disabled = false;     },          showMenu : function(){         if(this.menu){             this.menu.show(this.el, this.menuAlign);         }         return this;     },          hideMenu : function(){         if(this.menu){             this.menu.hide();         }         return this;     },          hasVisibleMenu : function(){         return this.menu && this.menu.isVisible();     },         onClick : function(e){         if(e){             e.preventDefault();         }         if(e.button != 0){             return;         }         if(!this.disabled){             if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){                 this.toggle();             }             if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){                 this.showMenu();             }             this.fireEvent("click", this, e);             if(this.handler){                                 this.handler.call(this.scope || this, this, e);             }         }     },         isMenuTriggerOver : function(e, internal){         return this.menu && !internal;     },         isMenuTriggerOut : function(e, internal){         return this.menu && !internal;     },         onMouseOver : function(e){         if(!this.disabled){             var internal = e.within(this.el,  true);             if(!internal){                 this.el.addClass("x-btn-over");                 if(!this.monitoringMouseOver){                     Ext.getDoc().on('mouseover', this.monitorMouseOver, this);                     this.monitoringMouseOver = true;                 }                 this.fireEvent('mouseover', this, e);             }             if(this.isMenuTriggerOver(e, internal)){                 this.fireEvent('menutriggerover', this, this.menu, e);             }         }     },         monitorMouseOver : function(e){         if(e.target != this.el.dom && !e.within(this.el)){             if(this.monitoringMouseOver){                 Ext.getDoc().un('mouseover', this.monitorMouseOver, this);                 this.monitoringMouseOver = false;             }             this.onMouseOut(e);         }     },         onMouseOut : function(e){         var internal = e.within(this.el) && e.target != this.el.dom;         this.el.removeClass("x-btn-over");         this.fireEvent('mouseout', this, e);         if(this.isMenuTriggerOut(e, internal)){             this.fireEvent('menutriggerout', this, this.menu, e);         }     },         onFocus : function(e){         if(!this.disabled){             this.el.addClass("x-btn-focus");         }     },         onBlur : function(e){         this.el.removeClass("x-btn-focus");     },         getClickEl : function(e, isUp){        return this.el;     },         onMouseDown : function(e){         if(!this.disabled && e.button == 0){             this.getClickEl(e).addClass("x-btn-click");             Ext.getDoc().on('mouseup', this.onMouseUp, this);         }     },         onMouseUp : function(e){         if(e.button == 0){             this.getClickEl(e, true).removeClass("x-btn-click");             Ext.getDoc().un('mouseup', this.onMouseUp, this);         }     },         onMenuShow : function(e){         this.ignoreNextClick = 0;         this.el.addClass("x-btn-menu-active");         this.fireEvent('menushow', this, this.menu);     },         onMenuHide : function(e){         this.el.removeClass("x-btn-menu-active");         this.ignoreNextClick = this.restoreClick.defer(250, this);         this.fireEvent('menuhide', this, this.menu);     },         restoreClick : function(){         this.ignoreNextClick = 0;     }      }); Ext.reg('button', Ext.Button); Ext.ButtonToggleMgr = function(){    var groups = {};    function toggleGroup(btn, state){        if(state){            var g = groups[btn.toggleGroup];            for(var i = 0, l = g.length; i < l; i++){                if(g[i] != btn){                    g[i].toggle(false);                }            }        }    }    return {        register : function(btn){            if(!btn.toggleGroup){                return;            }            var g = groups[btn.toggleGroup];            if(!g){                g = groups[btn.toggleGroup] = [];            }            g.push(btn);            btn.on("toggle", toggleGroup);        },        unregister : function(btn){            if(!btn.toggleGroup){                return;            }            var g = groups[btn.toggleGroup];            if(g){                g.remove(btn);                btn.un("toggle", toggleGroup);            }        }    }; }();
  133. Ext.SplitButton = Ext.extend(Ext.Button, {
  134.     arrowSelector : 'button:last',
  135.          initComponent : function(){
  136.         Ext.SplitButton.superclass.initComponent.call(this);
  137.         
  138.         this.addEvents("arrowclick");
  139.     },
  140.          onRender : function(ct, position){
  141.                  var tpl = new Ext.Template(
  142.             '<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>',
  143.             '<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>',
  144.             '<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',
  145.             "</tbody></table></td><td>",
  146.             '<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>',
  147.             '<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',
  148.             "</tbody></table></td></tr></table>"
  149.         );
  150.         var btn, targs = [this.text || '&#160;', this.type];
  151.         if(position){
  152.             btn = tpl.insertBefore(position, targs, true);
  153.         }else{
  154.             btn = tpl.append(ct, targs, true);
  155.         }
  156.         var btnEl = btn.child(this.buttonSelector);
  157.         this.initButtonEl(btn, btnEl);
  158.         this.arrowBtnTable = btn.child("table:last");
  159.         if(this.arrowTooltip){
  160.             btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;
  161.         }
  162.     },
  163.          autoWidth : function(){
  164.         if(this.el){
  165.             var tbl = this.el.child("table:first");
  166.             var tbl2 = this.el.child("table:last");
  167.             this.el.setWidth("auto");
  168.             tbl.setWidth("auto");
  169.             if(Ext.isIE7 && Ext.isStrict){
  170.                 var ib = this.el.child(this.buttonSelector);
  171.                 if(ib && ib.getWidth() > 20){
  172.                     ib.clip();
  173.                     ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
  174.                 }
  175.             }
  176.             if(this.minWidth){
  177.                 if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){
  178.                     tbl.setWidth(this.minWidth-tbl2.getWidth());
  179.                 }
  180.             }
  181.             this.el.setWidth(tbl.getWidth()+tbl2.getWidth());
  182.         } 
  183.     },
  184.     
  185.     setArrowHandler : function(handler, scope){
  186.         this.arrowHandler = handler;
  187.         this.scope = scope;  
  188.     },
  189.          onClick : function(e){
  190.         e.preventDefault();
  191.         if(!this.disabled){
  192.             if(e.getTarget(".x-btn-menu-arrow-wrap")){
  193.                 if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
  194.                     this.showMenu();
  195.                 }
  196.                 this.fireEvent("arrowclick", this, e);
  197.                 if(this.arrowHandler){
  198.                     this.arrowHandler.call(this.scope || this, this, e);
  199.                 }
  200.             }else{
  201.                 if(this.enableToggle){
  202.                     this.toggle();
  203.                 }
  204.                 this.fireEvent("click", this, e);
  205.                 if(this.handler){
  206.                     this.handler.call(this.scope || this, this, e);
  207.                 }
  208.             }
  209.         }
  210.     },
  211.          getClickEl : function(e, isUp){
  212.         if(!isUp){
  213.             return (this.lastClickEl = e.getTarget("table", 10, true));
  214.         }
  215.         return this.lastClickEl;
  216.     },
  217.          onDisable : function(){
  218.         if(this.el){
  219.             if(!Ext.isIE6){
  220.                 this.el.addClass("x-item-disabled");
  221.             }
  222.             this.el.child(this.buttonSelector).dom.disabled = true;
  223.             this.el.child(this.arrowSelector).dom.disabled = true;
  224.         }
  225.         this.disabled = true;
  226.     },
  227.          onEnable : function(){
  228.         if(this.el){
  229.             if(!Ext.isIE6){
  230.                 this.el.removeClass("x-item-disabled");
  231.             }
  232.             this.el.child(this.buttonSelector).dom.disabled = false;
  233.             this.el.child(this.arrowSelector).dom.disabled = false;
  234.         }
  235.         this.disabled = false;
  236.     },
  237.          isMenuTriggerOver : function(e){
  238.         return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true);
  239.     },
  240.          isMenuTriggerOut : function(e, internal){
  241.         return this.menu && !e.within(this.arrowBtnTable);
  242.     },
  243.          onDestroy : function(){
  244.         Ext.destroy(this.arrowBtnTable);
  245.         Ext.SplitButton.superclass.onDestroy.call(this);
  246.     }
  247. });
  248. Ext.MenuButton = Ext.SplitButton;
  249. Ext.reg('splitbutton', Ext.SplitButton);
  250. Ext.CycleButton = Ext.extend(Ext.SplitButton, {
  251.     
  252.     
  253.     
  254.     
  255.          getItemText : function(item){
  256.         if(item && this.showText === true){
  257.             var text = '';
  258.             if(this.prependText){
  259.                 text += this.prependText;
  260.             }
  261.             text += item.text;
  262.             return text;
  263.         }
  264.         return undefined;
  265.     },
  266.     
  267.     setActiveItem : function(item, suppressEvent){
  268.         if(typeof item != 'object'){
  269.             item = this.menu.items.get(item);
  270.         }
  271.         if(item){
  272.             if(!this.rendered){
  273.                 this.text = this.getItemText(item);
  274.                 this.iconCls = item.iconCls;
  275.             }else{
  276.                 var t = this.getItemText(item);
  277.                 if(t){
  278.                     this.setText(t);
  279.                 }
  280.                 this.setIconClass(item.iconCls);
  281.             }
  282.             this.activeItem = item;
  283.             if(!item.checked){
  284.                 item.setChecked(true, true);
  285.             }
  286.             if(this.forceIcon){
  287.                 this.setIconClass(this.forceIcon);
  288.             }
  289.             if(!suppressEvent){
  290.                 this.fireEvent('change', this, item);
  291.             }
  292.         }
  293.     },
  294.     
  295.     getActiveItem : function(){
  296.         return this.activeItem;
  297.     },
  298.          initComponent : function(){
  299.         this.addEvents(
  300.             
  301.             "change"
  302.         );
  303.         if(this.changeHandler){
  304.             this.on('change', this.changeHandler, this.scope||this);
  305.             delete this.changeHandler;
  306.         }
  307.         this.itemCount = this.items.length;
  308.         this.menu = {cls:'x-cycle-menu', items:[]};
  309.         var checked;
  310.         for(var i = 0, len = this.itemCount; i < len; i++){
  311.             var item = this.items[i];
  312.             item.group = item.group || this.id;
  313.             item.itemIndex = i;
  314.             item.checkHandler = this.checkHandler;
  315.             item.scope = this;
  316.             item.checked = item.checked || false;
  317.             this.menu.items.push(item);
  318.             if(item.checked){
  319.                 checked = item;
  320.             }
  321.         }
  322.         this.setActiveItem(checked, true);
  323.         Ext.CycleButton.superclass.initComponent.call(this);
  324.         this.on('click', this.toggleSelected, this);
  325.     },
  326.          checkHandler : function(item, pressed){
  327.         if(pressed){
  328.             this.setActiveItem(item);
  329.         }
  330.     },
  331.     
  332.     toggleSelected : function(){
  333.         this.menu.render();
  334. var nextIdx, checkItem;
  335. for (var i = 1; i < this.itemCount; i++) {
  336. nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;
  337. checkItem = this.menu.items.itemAt(nextIdx);
  338. if (!checkItem.disabled) {
  339. checkItem.setChecked(true);
  340. break;
  341. }
  342. }
  343.     }
  344. });
  345. Ext.reg('cycle', Ext.CycleButton);  
  346.  Ext.Toolbar = function(config){
  347.     if(Ext.isArray(config)){
  348.         config = {buttons:config};
  349.     }
  350.     Ext.Toolbar.superclass.constructor.call(this, config);
  351. };
  352. (function(){
  353. var T = Ext.Toolbar;
  354. Ext.extend(T, Ext.BoxComponent, {
  355.     trackMenus : true,
  356.          initComponent : function(){
  357.         T.superclass.initComponent.call(this);
  358.         if(this.items){
  359.             this.buttons = this.items;
  360.         }
  361.         
  362.         this.items = new Ext.util.MixedCollection(false, function(o){
  363.             return o.itemId || o.id || Ext.id();
  364.         });
  365.     },
  366.          autoCreate: {
  367.         cls:'x-toolbar x-small-editor',
  368.         html:'<table cellspacing="0"><tr></tr></table>'
  369.     },
  370.          onRender : function(ct, position){
  371.         this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
  372.         this.tr = this.el.child("tr", true);
  373.     },
  374.          afterRender : function(){
  375.         T.superclass.afterRender.call(this);
  376.         if(this.buttons){
  377.             this.add.apply(this, this.buttons);
  378.             delete this.buttons;
  379.         }
  380.     },
  381.     
  382.     add : function(){
  383.         var a = arguments, l = a.length;
  384.         for(var i = 0; i < l; i++){
  385.             var el = a[i];
  386.             if(el.isFormField){                  this.addField(el);
  387.             }else if(el.render){                  this.addItem(el);
  388.             }else if(typeof el == "string"){                  if(el == "separator" || el == "-"){
  389.                     this.addSeparator();
  390.                 }else if(el == " "){
  391.                     this.addSpacer();
  392.                 }else if(el == "->"){
  393.                     this.addFill();
  394.                 }else{
  395.                     this.addText(el);
  396.                 }
  397.             }else if(el.tagName){                  this.addElement(el);
  398.             }else if(typeof el == "object"){                  if(el.xtype){
  399.                     this.addField(Ext.ComponentMgr.create(el, 'button'));
  400.                 }else{
  401.                     this.addButton(el);
  402.                 }
  403.             }
  404.         }
  405.     },
  406.     
  407.     
  408.     addSeparator : function(){
  409.         return this.addItem(new T.Separator());
  410.     },
  411.     
  412.     addSpacer : function(){
  413.         return this.addItem(new T.Spacer());
  414.     },
  415.     
  416.     addFill : function(){
  417.         return this.addItem(new T.Fill());
  418.     },
  419.     
  420.     addElement : function(el){
  421.         return this.addItem(new T.Item(el));
  422.     },
  423.     
  424.     
  425.     addItem : function(item){
  426.         var td = this.nextBlock();
  427.         this.initMenuTracking(item);
  428.         item.render(td);
  429.         this.items.add(item);
  430.         return item;
  431.     },
  432.     
  433.     
  434.     addButton : function(config){
  435.         if(Ext.isArray(config)){
  436.             var buttons = [];
  437.             for(var i = 0, len = config.length; i < len; i++) {
  438.                 buttons.push(this.addButton(config[i]));
  439.             }
  440.             return buttons;
  441.         }
  442.         var b = config;
  443.         if(!(config instanceof T.Button)){
  444.             b = config.split ? 
  445.                 new T.SplitButton(config) :
  446.                 new T.Button(config);
  447.         }
  448.         var td = this.nextBlock();
  449.         this.initMenuTracking(b);
  450.         b.render(td);
  451.         this.items.add(b);
  452.         return b;
  453.     },
  454.          initMenuTracking : function(item){
  455.         if(this.trackMenus && item.menu){
  456.             item.on({
  457.                 'menutriggerover' : this.onButtonTriggerOver,
  458.                 'menushow' : this.onButtonMenuShow,
  459.                 'menuhide' : this.onButtonMenuHide,
  460.                 scope: this
  461.             })
  462.         }
  463.     },
  464.     
  465.     addText : function(text){
  466.         return this.addItem(new T.TextItem(text));
  467.     },
  468.     
  469.     
  470.     insertButton : function(index, item){
  471.         if(Ext.isArray(item)){
  472.             var buttons = [];
  473.             for(var i = 0, len = item.length; i < len; i++) {
  474.                buttons.push(this.insertButton(index + i, item[i]));
  475.             }
  476.             return buttons;
  477.         }
  478.         if (!(item instanceof T.Button)){
  479.            item = new T.Button(item);
  480.         }
  481.         var td = document.createElement("td");
  482.         this.tr.insertBefore(td, this.tr.childNodes[index]);
  483.         this.initMenuTracking(item);
  484.         item.render(td);
  485.         this.items.insert(index, item);
  486.         return item;
  487.     },
  488.     
  489.     
  490.     addDom : function(config, returnEl){
  491.         var td = this.nextBlock();
  492.         Ext.DomHelper.overwrite(td, config);
  493.         var ti = new T.Item(td.firstChild);
  494.         ti.render(td);
  495.         this.items.add(ti);
  496.         return ti;
  497.     },
  498.     
  499.     addField : function(field){
  500.         var td = this.nextBlock();
  501.         field.render(td);
  502.         var ti = new T.Item(td.firstChild);
  503.         ti.render(td);
  504.         this.items.add(field);
  505.         return ti;
  506.     },
  507.          nextBlock : function(){
  508.         var td = document.createElement("td");
  509.         this.tr.appendChild(td);
  510.         return td;
  511.     },
  512.          onDestroy : function(){
  513.         Ext.Toolbar.superclass.onDestroy.call(this);
  514.         if(this.rendered){
  515.             if(this.items){                  Ext.destroy.apply(Ext, this.items.items);
  516.             }
  517.             Ext.Element.uncache(this.tr);
  518.         }
  519.     },
  520.          onDisable : function(){
  521.         this.items.each(function(item){
  522.              if(item.disable){
  523.                  item.disable();
  524.              }
  525.         });
  526.     },
  527.          onEnable : function(){
  528.         this.items.each(function(item){
  529.              if(item.enable){
  530.                  item.enable();
  531.              }
  532.         });
  533.     },
  534.          onButtonTriggerOver : function(btn){
  535.         if(this.activeMenuBtn && this.activeMenuBtn != btn){
  536.             this.activeMenuBtn.hideMenu();
  537.             btn.showMenu();
  538.             this.activeMenuBtn = btn;
  539.         }
  540.     },
  541.          onButtonMenuShow : function(btn){
  542.         this.activeMenuBtn = btn;
  543.     },
  544.          onButtonMenuHide : function(btn){
  545.         delete this.activeMenuBtn;
  546.     }
  547.     
  548. });
  549. Ext.reg('toolbar', Ext.Toolbar);
  550. T.Item = function(el){
  551.     this.el = Ext.getDom(el);
  552.     this.id = Ext.id(this.el);
  553.     this.hidden = false;
  554. };
  555. T.Item.prototype = {
  556.     
  557.     
  558.     getEl : function(){
  559.        return this.el;  
  560.     },
  561.          render : function(td){
  562.         this.td = td;
  563.         td.appendChild(this.el);
  564.     },
  565.     
  566.     
  567.     destroy : function(){
  568.         if(this.td && this.td.parentNode){
  569.             this.td.parentNode.removeChild(this.td);
  570.         }
  571.     },
  572.     
  573.     
  574.     show: function(){
  575.         this.hidden = false;
  576.         this.td.style.display = "";
  577.     },
  578.     
  579.     
  580.     hide: function(){
  581.         this.hidden = true;
  582.         this.td.style.display = "none";
  583.     },
  584.     
  585.     
  586.     setVisible: function(visible){
  587.         if(visible) {
  588.             this.show();
  589.         }else{
  590.             this.hide();
  591.         }
  592.     },
  593.     
  594.     
  595.     focus : function(){
  596.         Ext.fly(this.el).focus();
  597.     },
  598.     
  599.     
  600.     disable : function(){
  601.         Ext.fly(this.td).addClass("x-item-disabled");
  602.         this.disabled = true;
  603.         this.el.disabled = true;
  604.     },
  605.     
  606.     
  607.     enable : function(){
  608.         Ext.fly(this.td).removeClass("x-item-disabled");
  609.         this.disabled = false;
  610.         this.el.disabled = false;
  611.     }
  612. };
  613. Ext.reg('tbitem', T.Item);
  614. T.Separator = function(){
  615.     var s = document.createElement("span");
  616.     s.className = "ytb-sep";
  617.     T.Separator.superclass.constructor.call(this, s);
  618. };
  619. Ext.extend(T.Separator, T.Item, {
  620.     enable:Ext.emptyFn,
  621.     disable:Ext.emptyFn,
  622.     focus:Ext.emptyFn
  623. });
  624. Ext.reg('tbseparator', T.Separator);
  625. T.Spacer = function(){
  626.     var s = document.createElement("div");
  627.     s.className = "ytb-spacer";
  628.     T.Spacer.superclass.constructor.call(this, s);
  629. };
  630. Ext.extend(T.Spacer, T.Item, {
  631.     enable:Ext.emptyFn,
  632.     disable:Ext.emptyFn,
  633.     focus:Ext.emptyFn
  634. });
  635. Ext.reg('tbspacer', T.Spacer);
  636. T.Fill = Ext.extend(T.Spacer, {
  637.          render : function(td){
  638.         td.style.width = '100%';
  639.         T.Fill.superclass.render.call(this, td);
  640.     }
  641. });
  642. Ext.reg('tbfill', T.Fill);
  643. T.TextItem = function(t){
  644.     var s = document.createElement("span");
  645.     s.className = "ytb-text";
  646.     s.innerHTML = t.text ? t.text : t;
  647.     T.TextItem.superclass.constructor.call(this, s);
  648. };
  649. Ext.extend(T.TextItem, T.Item, {
  650.     enable:Ext.emptyFn,
  651.     disable:Ext.emptyFn,
  652.     focus:Ext.emptyFn
  653. });
  654. Ext.reg('tbtext', T.TextItem);
  655. T.Button = Ext.extend(Ext.Button, {
  656.     hideParent : true,
  657.     onDestroy : function(){
  658.         T.Button.superclass.onDestroy.call(this);
  659.         if(this.container){
  660.             this.container.remove();
  661.         }
  662.     }
  663. });
  664. Ext.reg('tbbutton', T.Button);
  665. T.SplitButton = Ext.extend(Ext.SplitButton, {
  666.     hideParent : true,
  667.     onDestroy : function(){
  668.         T.SplitButton.superclass.onDestroy.call(this);
  669.         if(this.container){
  670.             this.container.remove();
  671.         }
  672.     }
  673. });
  674. Ext.reg('tbsplit', T.SplitButton);
  675. T.MenuButton = T.SplitButton;
  676. })();
  677. Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {                    pageSize: 20,          displayMsg : 'Displaying {0} - {1} of {2}',          emptyMsg : 'No data to display',          beforePageText : "Page",          afterPageText : "of {0}",          firstText : "First Page",          prevText : "Previous Page",          nextText : "Next Page",          lastText : "Last Page",          refreshText : "Refresh",          paramNames : {start: 'start', limit: 'limit'},     initComponent : function(){         this.addEvents('change', 'beforechange');         Ext.PagingToolbar.superclass.initComponent.call(this);         this.cursor = 0;         this.bind(this.store);     },         onRender : function(ct, position){         Ext.PagingToolbar.superclass.onRender.call(this, ct, position);         this.first = this.addButton({             tooltip: this.firstText,             iconCls: "x-tbar-page-first",             disabled: true,             handler: this.onClick.createDelegate(this, ["first"])         });         this.prev = this.addButton({             tooltip: this.prevText,             iconCls: "x-tbar-page-prev",             disabled: true,             handler: this.onClick.createDelegate(this, ["prev"])         });         this.addSeparator();         this.add(this.beforePageText);         this.field = Ext.get(this.addDom({            tag: "input",            type: "text",            size: "3",            value: "1",            cls: "x-tbar-page-number"         }).el);         this.field.on("keydown", this.onPagingKeydown, this);         this.field.on("focus", function(){this.dom.select();});         this.afterTextEl = this.addText(String.format(this.afterPageText, 1));         this.field.setHeight(18);         this.addSeparator();         this.next = this.addButton({             tooltip: this.nextText,             iconCls: "x-tbar-page-next",             disabled: true,             handler: this.onClick.createDelegate(this, ["next"])         });         this.last = this.addButton({             tooltip: this.lastText,             iconCls: "x-tbar-page-last",             disabled: true,             handler: this.onClick.createDelegate(this, ["last"])         });         this.addSeparator();         this.loading = this.addButton({             tooltip: this.refreshText,             iconCls: "x-tbar-loading",             handler: this.onClick.createDelegate(this, ["refresh"])         });         if(this.displayInfo){             this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});         }         if(this.dsLoaded){             this.onLoad.apply(this, this.dsLoaded);         }     },         updateInfo : function(){         if(this.displayEl){             var count = this.store.getCount();             var msg = count == 0 ?                 this.emptyMsg :                 String.format(                     this.displayMsg,                     this.cursor+1, this.cursor+count, this.store.getTotalCount()                 );             this.displayEl.update(msg);         }     },         onLoad : function(store, r, o){         if(!this.rendered){             this.dsLoaded = [store, r, o];             return;         }        this.cursor = o.params ? o.params[this.paramNames.start] : 0;        var d = this.getPageData(), ap = d.activePage, ps = d.pages;         this.afterTextEl.el.innerHTML = String.format(this.afterPageText, d.pages);         this.field.dom.value = ap;         this.first.setDisabled(ap == 1);         this.prev.setDisabled(ap == 1);         this.next.setDisabled(ap == ps);         this.last.setDisabled(ap == ps);         this.loading.enable();         this.updateInfo();         this.fireEvent('change', this, d);     },         getPageData : function(){         var total = this.store.getTotalCount();         return {             total : total,             activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),             pages :  total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)         };     },         onLoadError : function(){         if(!this.rendered){             return;         }         this.loading.enable();     },     readPage : function(d){         var v = this.field.dom.value, pageNum;         if (!v || isNaN(pageNum = parseInt(v, 10))) {             this.field.dom.value = d.activePage;             return false;         }         return pageNum;     },         onPagingKeydown : function(e){         var k = e.getKey(), d = this.getPageData(), pageNum;         if (k == e.RETURN) {             e.stopEvent();             pageNum = this.readPage(d);             if(pageNum !== false){                 pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;                 this.doLoad(pageNum * this.pageSize);             }         }else if (k == e.HOME || k == e.END){             e.stopEvent();             pageNum = k == e.HOME ? 1 : d.pages;             this.field.dom.value = pageNum;         }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){             e.stopEvent();             if(pageNum = this.readPage(d)){                 var increment = e.shiftKey ? 10 : 1;                 if(k == e.DOWN || k == e.PAGEDOWN){                     increment *= -1;                 }                 pageNum += increment;                 if(pageNum >= 1 & pageNum <= d.pages){                     this.field.dom.value = pageNum;                 }             }         }     },         beforeLoad : function(){         if(this.rendered && this.loading){             this.loading.disable();         }     },     doLoad : function(start){         var o = {}, pn = this.paramNames;         o[pn.start] = start;         o[pn.limit] = this.pageSize;         if(this.fireEvent('beforechange', this, o) !== false){             this.store.load({params:o});         }     },          changePage: function(page){         this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount()));       },         onClick : function(which){         var store = this.store;         switch(which){             case "first":                 this.doLoad(0);             break;             case "prev":                 this.doLoad(Math.max(0, this.cursor-this.pageSize));             break;             case "next":                 this.doLoad(this.cursor+this.pageSize);             break;             case "last":                 var total = store.getTotalCount();                 var extra = total % this.pageSize;                 var lastStart = extra ? (total - extra) : total-this.pageSize;                 this.doLoad(lastStart);             break;             case "refresh":                 this.doLoad(this.cursor);             break;         }     },          unbind : function(store){         store = Ext.StoreMgr.lookup(store);         store.un("beforeload", this.beforeLoad, this);         store.un("load", this.onLoad, this);         store.un("loadexception", this.onLoadError, this);         this.store = undefined;     },          bind : function(store){         store = Ext.StoreMgr.lookup(store);         store.on("beforeload", this.beforeLoad, this);         store.on("load", this.onLoad, this);         store.on("loadexception", this.onLoadError, this);         this.store = store;     } }); Ext.reg('paging', Ext.PagingToolbar);
  678. Ext.Resizable = function(el, config){
  679.     this.el = Ext.get(el);
  680.     
  681.     if(config && config.wrap){
  682.         config.resizeChild = this.el;
  683.         this.el = this.el.wrap(typeof config.wrap == "object" ? config.wrap : {cls:"xresizable-wrap"});
  684.         this.el.id = this.el.dom.id = config.resizeChild.id + "-rzwrap";
  685.         this.el.setStyle("overflow", "hidden");
  686.         this.el.setPositioning(config.resizeChild.getPositioning());
  687.         config.resizeChild.clearPositioning();
  688.         if(!config.width || !config.height){
  689.             var csize = config.resizeChild.getSize();
  690.             this.el.setSize(csize.width, csize.height);
  691.         }
  692.         if(config.pinned && !config.adjustments){
  693.             config.adjustments = "auto";
  694.         }
  695.     }
  696.     
  697.     this.proxy = this.el.createProxy({tag: "div", cls: "x-resizable-proxy", id: this.el.id + "-rzproxy"}, Ext.getBody());
  698.     this.proxy.unselectable();
  699.     this.proxy.enableDisplayMode('block');
  700.     Ext.apply(this, config);
  701.     
  702.     if(this.pinned){
  703.         this.disableTrackOver = true;
  704.         this.el.addClass("x-resizable-pinned");
  705.     }
  706.          var position = this.el.getStyle("position");
  707.     if(position != "absolute" && position != "fixed"){
  708.         this.el.setStyle("position", "relative");
  709.     }
  710.     if(!this.handles){          this.handles = 's,e,se';
  711.         if(this.multiDirectional){
  712.             this.handles += ',n,w';
  713.         }
  714.     }
  715.     if(this.handles == "all"){
  716.         this.handles = "n s e w ne nw se sw";
  717.     }
  718.     var hs = this.handles.split(/s*?[,;]s*?| /);
  719.     var ps = Ext.Resizable.positions;
  720.     for(var i = 0, len = hs.length; i < len; i++){
  721.         if(hs[i] && ps[hs[i]]){
  722.             var pos = ps[hs[i]];
  723.             this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent);
  724.         }
  725.     }
  726.          this.corner = this.southeast;
  727.     
  728.     if(this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1){
  729.         this.updateBox = true;
  730.     }   
  731.    
  732.     this.activeHandle = null;
  733.     
  734.     if(this.resizeChild){
  735.         if(typeof this.resizeChild == "boolean"){
  736.             this.resizeChild = Ext.get(this.el.dom.firstChild, true);
  737.         }else{
  738.             this.resizeChild = Ext.get(this.resizeChild, true);
  739.         }
  740.     }
  741.     
  742.     if(this.adjustments == "auto"){
  743.         var rc = this.resizeChild;
  744.         var hw = this.west, he = this.east, hn = this.north, hs = this.south;
  745.         if(rc && (hw || hn)){
  746.             rc.position("relative");
  747.             rc.setLeft(hw ? hw.el.getWidth() : 0);
  748.             rc.setTop(hn ? hn.el.getHeight() : 0);
  749.         }
  750.         this.adjustments = [
  751.             (he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0),
  752.             (hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1 
  753.         ];
  754.     }
  755.     
  756.     if(this.draggable){
  757.         this.dd = this.dynamic ? 
  758.             this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
  759.         this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
  760.     }
  761.     
  762.          this.addEvents(
  763.         "beforeresize",
  764.         "resize"
  765.     );
  766.     
  767.     if(this.width !== null && this.height !== null){
  768.         this.resizeTo(this.width, this.height);
  769.     }else{
  770.         this.updateChildSize();
  771.     }
  772.     if(Ext.isIE){
  773.         this.el.dom.style.zoom = 1;
  774.     }
  775.     Ext.Resizable.superclass.constructor.call(this);
  776. };
  777. Ext.extend(Ext.Resizable, Ext.util.Observable, {
  778.         resizeChild : false,
  779.         adjustments : [0, 0],
  780.         minWidth : 5,
  781.         minHeight : 5,
  782.         maxWidth : 10000,
  783.         maxHeight : 10000,
  784.         enabled : true,
  785.         animate : false,
  786.         duration : .35,
  787.         dynamic : false,
  788.         handles : false,
  789.         multiDirectional : false,
  790.         disableTrackOver : false,
  791.         easing : 'easeOutStrong',
  792.         widthIncrement : 0,
  793.         heightIncrement : 0,
  794.         pinned : false,
  795.         width : null,
  796.         height : null,
  797.         preserveRatio : false,
  798.         transparent: false,
  799.         minX: 0,
  800.         minY: 0,
  801.         draggable: false,
  802.         
  803.         
  804.         
  805.         
  806.     
  807.     
  808.     resizeTo : function(width, height){
  809.         this.el.setSize(width, height);
  810.         this.updateChildSize();
  811.         this.fireEvent("resize", this, width, height, null);
  812.     },
  813.          startSizing : function(e, handle){
  814.         this.fireEvent("beforeresize", this, e);
  815.         if(this.enabled){ 
  816.             if(!this.overlay){
  817.                 this.overlay = this.el.createProxy({tag: "div", cls: "x-resizable-overlay", html: "&#160;"}, Ext.getBody());
  818.                 this.overlay.unselectable();
  819.                 this.overlay.enableDisplayMode("block");
  820.                 this.overlay.on("mousemove", this.onMouseMove, this);
  821.                 this.overlay.on("mouseup", this.onMouseUp, this);
  822.             }
  823.             this.overlay.setStyle("cursor", handle.el.getStyle("cursor"));
  824.             this.resizing = true;
  825.             this.startBox = this.el.getBox();
  826.             this.startPoint = e.getXY();
  827.             this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0],
  828.                             (this.startBox.y + this.startBox.height) - this.startPoint[1]];
  829.             this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
  830.             this.overlay.show();
  831.             if(this.constrainTo) {
  832.                 var ct = Ext.get(this.constrainTo);
  833.                 this.resizeRegion = ct.getRegion().adjust(
  834.                     ct.getFrameWidth('t'),
  835.                     ct.getFrameWidth('l'),
  836.                     -ct.getFrameWidth('b'),
  837.                     -ct.getFrameWidth('r')
  838.                 );
  839.             }
  840.             this.proxy.setStyle('visibility', 'hidden');              this.proxy.show();
  841.             this.proxy.setBox(this.startBox);
  842.             if(!this.dynamic){
  843.                 this.proxy.setStyle('visibility', 'visible');
  844.             }
  845.         }
  846.     },
  847.          onMouseDown : function(handle, e){
  848.         if(this.enabled){
  849.             e.stopEvent();
  850.             this.activeHandle = handle;
  851.             this.startSizing(e, handle);
  852.         }          
  853.     },
  854.          onMouseUp : function(e){
  855.         var size = this.resizeElement();
  856.         this.resizing = false;
  857.         this.handleOut();
  858.         this.overlay.hide();
  859.         this.proxy.hide();
  860.         this.fireEvent("resize", this, size.width, size.height, e);
  861.     },
  862.          updateChildSize : function(){
  863.         if(this.resizeChild){
  864.             var el = this.el;
  865.             var child = this.resizeChild;
  866.             var adj = this.adjustments;
  867.             if(el.dom.offsetWidth){
  868.                 var b = el.getSize(true);
  869.                 child.setSize(b.width+adj[0], b.height+adj[1]);
  870.             }
  871.                                                                 if(Ext.isIE){
  872.                 setTimeout(function(){
  873.                     if(el.dom.offsetWidth){
  874.                         var b = el.getSize(true);
  875.                         child.setSize(b.width+adj[0], b.height+adj[1]);
  876.                     }
  877.                 }, 10);
  878.             }
  879.         }
  880.     },
  881.          snap : function(value, inc, min){
  882.         if(!inc || !value) return value;
  883.         var newValue = value;
  884.         var m = value % inc;
  885.         if(m > 0){
  886.             if(m > (inc/2)){
  887.                 newValue = value + (inc-m);
  888.             }else{
  889.                 newValue = value - m;
  890.             }
  891.         }
  892.         return Math.max(min, newValue);
  893.     },
  894.     
  895.     resizeElement : function(){
  896.         var box = this.proxy.getBox();
  897.         if(this.updateBox){
  898.             this.el.setBox(box, false, this.animate, this.duration, null, this.easing);
  899.         }else{
  900.             this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);
  901.         }
  902.         this.updateChildSize();
  903.         if(!this.dynamic){
  904.             this.proxy.hide();
  905.         }
  906.         return box;
  907.     },
  908.          constrain : function(v, diff, m, mx){
  909.         if(v - diff < m){
  910.             diff = v - m;    
  911.         }else if(v - diff > mx){
  912.             diff = mx - v; 
  913.         }
  914.         return diff;                
  915.     },
  916.          onMouseMove : function(e){
  917.         if(this.enabled){
  918.             try{
  919.             if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {
  920.                 return;
  921.             }
  922.                          var curSize = this.curSize || this.startBox;
  923.             var x = this.startBox.x, y = this.startBox.y;
  924.             var ox = x, oy = y;
  925.             var w = curSize.width, h = curSize.height;
  926.             var ow = w, oh = h;
  927.             var mw = this.minWidth, mh = this.minHeight;
  928.             var mxw = this.maxWidth, mxh = this.maxHeight;
  929.             var wi = this.widthIncrement;
  930.             var hi = this.heightIncrement;
  931.             
  932.             var eventXY = e.getXY();
  933.             var diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0]));
  934.             var diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1]));
  935.             
  936.             var pos = this.activeHandle.position;
  937.             
  938.             switch(pos){
  939.                 case "east":
  940.                     w += diffX; 
  941.                     w = Math.min(Math.max(mw, w), mxw);
  942.                     break;
  943.                 case "south":
  944.                     h += diffY;
  945.                     h = Math.min(Math.max(mh, h), mxh);
  946.                     break;
  947.                 case "southeast":
  948.                     w += diffX; 
  949.                     h += diffY;
  950.                     w = Math.min(Math.max(mw, w), mxw);
  951.                     h = Math.min(Math.max(mh, h), mxh);
  952.                     break;
  953.                 case "north":
  954.                     diffY = this.constrain(h, diffY, mh, mxh);
  955.                     y += diffY;
  956.                     h -= diffY;
  957.                     break;
  958.                 case "west":
  959.                     diffX = this.constrain(w, diffX, mw, mxw);
  960.                     x += diffX;
  961.                     w -= diffX;
  962.                     break;
  963.                 case "northeast":
  964.                     w += diffX; 
  965.                     w = Math.min(Math.max(mw, w), mxw);
  966.                     diffY = this.constrain(h, diffY, mh, mxh);
  967.                     y += diffY;
  968.                     h -= diffY;
  969.                     break;
  970.                 case "northwest":
  971.                     diffX = this.constrain(w, diffX, mw, mxw);
  972.                     diffY = this.constrain(h, diffY, mh, mxh);
  973.                     y += diffY;
  974.                     h -= diffY;
  975.                     x += diffX;
  976.                     w -= diffX;
  977.                     break;
  978.                case "southwest":
  979.                     diffX = this.constrain(w, diffX, mw, mxw);
  980.                     h += diffY;
  981.                     h = Math.min(Math.max(mh, h), mxh);
  982.                     x += diffX;
  983.                     w -= diffX;
  984.                     break;
  985.             }
  986.             
  987.             var sw = this.snap(w, wi, mw);
  988.             var sh = this.snap(h, hi, mh);
  989.             if(sw != w || sh != h){
  990.                 switch(pos){
  991.                     case "northeast":
  992.                         y -= sh - h;
  993.                     break;
  994.                     case "north":
  995.                         y -= sh - h;
  996.                         break;
  997.                     case "southwest":
  998.                         x -= sw - w;
  999.                     break;
  1000.                     case "west":
  1001.                         x -= sw - w;
  1002.                         break;
  1003.                     case "northwest":
  1004.                         x -= sw - w;
  1005.                         y -= sh - h;
  1006.                     break;
  1007.                 }
  1008.                 w = sw;
  1009.                 h = sh;
  1010.             }
  1011.             
  1012.             if(this.preserveRatio){
  1013.                 switch(pos){
  1014.                     case "southeast":
  1015.                     case "east":
  1016.                         h = oh * (w/ow);
  1017.                         h = Math.min(Math.max(mh, h), mxh);
  1018.                         w = ow * (h/oh);
  1019.                        break;
  1020.                     case "south":
  1021.                         w = ow * (h/oh);
  1022.                         w = Math.min(Math.max(mw, w), mxw);
  1023.                         h = oh * (w/ow);
  1024.                         break;
  1025.                     case "northeast":
  1026.                         w = ow * (h/oh);
  1027.                         w = Math.min(Math.max(mw, w), mxw);
  1028.                         h = oh * (w/ow);
  1029.                     break;
  1030.                     case "north":
  1031.                         var tw = w;
  1032.                         w = ow * (h/oh);
  1033.                         w = Math.min(Math.max(mw, w), mxw);
  1034.                         h = oh * (w/ow);
  1035.                         x += (tw - w) / 2;
  1036.                         break;
  1037.                     case "southwest":
  1038.                         h = oh * (w/ow);
  1039.                         h = Math.min(Math.max(mh, h), mxh);
  1040.                         var tw = w;
  1041.                         w = ow * (h/oh);
  1042.                         x += tw - w;
  1043.                         break;
  1044.                     case "west":
  1045.                         var th = h;
  1046.                         h = oh * (w/ow);
  1047.                         h = Math.min(Math.max(mh, h), mxh);
  1048.                         y += (th - h) / 2;
  1049.                         var tw = w;
  1050.                         w = ow * (h/oh);
  1051.                         x += tw - w;
  1052.                        break;
  1053.                     case "northwest":
  1054.                         var tw = w;
  1055.                         var th = h;
  1056.                         h = oh * (w/ow);
  1057.                         h = Math.min(Math.max(mh, h), mxh);
  1058.                         w = ow * (h/oh);
  1059.                         y += th - h;
  1060.                          x += tw - w;
  1061.                        break;
  1062.                         
  1063.                 }
  1064.             }
  1065.             this.proxy.setBounds(x, y, w, h);
  1066.             if(this.dynamic){
  1067.                 this.resizeElement();
  1068.             }
  1069.             }catch(e){}
  1070.         }
  1071.     },
  1072.          handleOver : function(){
  1073.         if(this.enabled){
  1074.             this.el.addClass("x-resizable-over");
  1075.         }
  1076.     },
  1077.          handleOut : function(){
  1078.         if(!this.resizing){
  1079.             this.el.removeClass("x-resizable-over");
  1080.         }
  1081.     },
  1082.     
  1083.     
  1084.     getEl : function(){
  1085.         return this.el;
  1086.     },
  1087.     
  1088.     
  1089.     getResizeChild : function(){
  1090.         return this.resizeChild;
  1091.     },
  1092.     
  1093.     
  1094.     destroy : function(removeEl){
  1095.         this.proxy.remove();
  1096.         if(this.overlay){
  1097.             this.overlay.removeAllListeners();
  1098.             this.overlay.remove();
  1099.         }
  1100.         var ps = Ext.Resizable.positions;
  1101.         for(var k in ps){
  1102.             if(typeof ps[k] != "function" && this[ps[k]]){
  1103.                 var h = this[ps[k]];
  1104.                 h.el.removeAllListeners();
  1105.                 h.el.remove();
  1106.             }
  1107.         }
  1108.         if(removeEl){
  1109.             this.el.update("");
  1110.             this.el.remove();
  1111.         }
  1112.     },
  1113.     syncHandleHeight : function(){
  1114.         var h = this.el.getHeight(true);
  1115.         if(this.west){
  1116.             this.west.el.setHeight(h);
  1117.         }
  1118.         if(this.east){
  1119.             this.east.el.setHeight(h);
  1120.         }
  1121.     }
  1122. });
  1123. Ext.Resizable.positions = {
  1124.     n: "north", s: "south", e: "east", w: "west", se: "southeast", sw: "southwest", nw: "northwest", ne: "northeast"
  1125. };
  1126. Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){
  1127.     if(!this.tpl){
  1128.                  var tpl = Ext.DomHelper.createTemplate(
  1129.             {tag: "div", cls: "x-resizable-handle x-resizable-handle-{0}"}
  1130.         );
  1131.         tpl.compile();
  1132.         Ext.Resizable.Handle.prototype.tpl = tpl;
  1133.     }
  1134.     this.position = pos;
  1135.     this.rz = rz;
  1136.     this.el = this.tpl.append(rz.el.dom, [this.position], true);
  1137.     this.el.unselectable();
  1138.     if(transparent){
  1139.         this.el.setOpacity(0);
  1140.     }
  1141.     this.el.on("mousedown", this.onMouseDown, this);
  1142.     if(!disableTrackOver){
  1143.         this.el.on("mouseover", this.onMouseOver, this);
  1144.         this.el.on("mouseout", this.onMouseOut, this);
  1145.     }
  1146. };
  1147. Ext.Resizable.Handle.prototype = {
  1148.     afterResize : function(rz){
  1149.              },
  1150.          onMouseDown : function(e){
  1151.         this.rz.onMouseDown(this, e);
  1152.     },
  1153.          onMouseOver : function(e){
  1154.         this.rz.handleOver(this, e);
  1155.     },
  1156.          onMouseOut : function(e){
  1157.         this.rz.handleOut(this, e);
  1158.     }  
  1159. };
  1160. Ext.Editor = function(field, config){     this.field = field;     Ext.Editor.superclass.constructor.call(this, config); }; Ext.extend(Ext.Editor, Ext.Component, {                              value : "",          alignment: "c-c?",          shadow : "frame",          constrain : false,          swallowKeys : true,          completeOnEnter : false,          cancelOnEsc : false,          updateEl : false,     initComponent : function(){         Ext.Editor.superclass.initComponent.call(this);         this.addEvents(                          "beforestartedit",                          "startedit",                          "beforecomplete",                          "complete",                          "canceledit",                          "specialkey"         );     },         onRender : function(ct, position){         this.el = new Ext.Layer({             shadow: this.shadow,             cls: "x-editor",             parentEl : ct,             shim : this.shim,             shadowOffset:4,             id: this.id,             constrain: this.constrain         });         this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");         if(this.field.msgTarget != 'title'){             this.field.msgTarget = 'qtip';         }         this.field.inEditor = true;         this.field.render(this.el);         if(Ext.isGecko){             this.field.el.dom.setAttribute('autocomplete', 'off');         }         this.field.on("specialkey", this.onSpecialKey, this);         if(this.swallowKeys){             this.field.el.swallowEvent(['keydown','keypress']);         }         this.field.show();         this.field.on("blur", this.onBlur, this);         if(this.field.grow){             this.field.on("autosize", this.el.sync,  this.el, {delay:1});         }     },         onSpecialKey : function(field, e){         var key = e.getKey();         if(this.completeOnEnter && key == e.ENTER){             e.stopEvent();             this.completeEdit();         }else if(this.cancelOnEsc && key == e.ESC){             this.cancelEdit();         }else{             this.fireEvent('specialkey', field, e);         }         if(this.field.triggerBlur && (key == e.ENTER || key == e.ESC || key == e.TAB)){             this.field.triggerBlur();         }     },          startEdit : function(el, value){         if(this.editing){             this.completeEdit();         }         this.boundEl = Ext.get(el);         var v = value !== undefined ? value : this.boundEl.dom.innerHTML;         if(!this.rendered){             this.render(this.parentEl || document.body);         }         if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){             return;         }         this.startValue = v;         this.field.setValue(v);         this.doAutoSize();         this.el.alignTo(this.boundEl, this.alignment);         this.editing = true;         this.show();     },         doAutoSize : function(){         if(this.autoSize){             var sz = this.boundEl.getSize();             switch(this.autoSize){                 case "width":                     this.setSize(sz.width,  "");                 break;                 case "height":                     this.setSize("",  sz.height);                 break;                 default:                     this.setSize(sz.width,  sz.height);             }         }     },          setSize : function(w, h){         delete this.field.lastSize;         this.field.setSize(w, h);         if(this.el){         if(Ext.isGecko2 || Ext.isOpera){                          this.el.setSize(w, h);         }             this.el.sync();         }     },          realign : function(){         this.el.alignTo(this.boundEl, this.alignment);     },          completeEdit : function(remainVisible){         if(!this.editing){             return;         }         var v = this.getValue();         if(this.revertInvalid !== false && !this.field.isValid()){             v = this.startValue;             this.cancelEdit(true);         }         if(String(v) === String(this.startValue) && this.ignoreNoChange){             this.editing = false;             this.hide();             return;         }         if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){             this.editing = false;             if(this.updateEl && this.boundEl){                 this.boundEl.update(v);             }             if(remainVisible !== true){                 this.hide();             }             this.fireEvent("complete", this, v, this.startValue);         }     },         onShow : function(){         this.el.show();         if(this.hideEl !== false){             this.boundEl.hide();         }         this.field.show();         if(Ext.isIE && !this.fixIEFocus){             this.fixIEFocus = true;             this.deferredFocus.defer(50, this);         }else{             this.field.focus();         }         this.fireEvent("startedit", this.boundEl, this.startValue);     },     deferredFocus : function(){         if(this.editing){             this.field.focus();         }     },          cancelEdit : function(remainVisible){         if(this.editing){             var v = this.getValue();             this.setValue(this.startValue);             if(remainVisible !== true){                 this.hide();             }             this.fireEvent("canceledit", this, v, this.startValue);         }     },         onBlur : function(){         if(this.allowBlur !== true && this.editing){             this.completeEdit();         }     },         onHide : function(){         if(this.editing){             this.completeEdit();             return;         }         this.field.blur();         if(this.field.collapse){             this.field.collapse();         }         this.el.hide();         if(this.hideEl !== false){             this.boundEl.show();         }     },          setValue : function(v){         this.field.setValue(v);     },          getValue : function(){         return this.field.getValue();     },     beforeDestroy : function(){         this.field.destroy();         this.field = null;     } }); Ext.reg('editor', Ext.Editor); Ext.MessageBox = function(){     var dlg, opt, mask, waitTimer;     var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;     var buttons, activeTextEl, bwidth, iconCls = '';         var handleButton = function(button){         if(dlg.isVisible()){             dlg.hide();             Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value], 1);         }     };         var handleHide = function(){         if(opt && opt.cls){             dlg.el.removeClass(opt.cls);         }         progressBar.reset();     };         var handleEsc = function(d, k, e){         if(opt && opt.closable !== false){             dlg.hide();         }         if(e){             e.stopEvent();         }     };         var updateButtons = function(b){         var width = 0;         if(!b){             buttons["ok"].hide();             buttons["cancel"].hide();             buttons["yes"].hide();             buttons["no"].hide();             return width;         }         dlg.footer.dom.style.display = '';         for(var k in buttons){             if(typeof buttons[k] != "function"){                 if(b[k]){                     buttons[k].show();                     buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);                     width += buttons[k].el.getWidth()+15;                 }else{                     buttons[k].hide();                 }             }         }         return width;     };     return {                  getDialog : function(titleText){            if(!dlg){                 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");                         }                     }                 });                 buttons = {};                 var bt = this.buttonText;                                 buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));                 buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));                 buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));                 buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));                 buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';                 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;         },                  updateText : function(text){             if(!dlg.isVisible() && !opt.width){                 dlg.setSize(this.maxWidth, 100);             }             msgEl.update(text || '&#160;');             var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;             var mw = msgEl.getWidth() + msgEl.getMargins('lr');             var fw = dlg.getFrameWidth('lr');             var bw = dlg.body.getFrameWidth('lr');             if (Ext.isIE && iw > 0){                                                 iw += 3;             }             var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, 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);             }             dlg.setSize(w, 'auto').center();             return this;         },                  updateProgress : function(value, progressText, msg){             progressBar.updateProgress(value, progressText);             if(msg){                 this.updateText(msg);             }             return this;         },                  isVisible : function(){             return dlg && dlg.isVisible();         },                  hide : function(){             if(this.isVisible()){                 dlg.hide();                 handleHide();             }             return 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(typeof opt.multiline == "number" ?                         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(opt.icon);             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()){                                 document.body.appendChild(dlg.el.dom);                 d.setAnimateTarget(opt.animEl);                 d.show(opt.animEl);             }                         d.on('show', function(){                 if(allowClose === true){                     d.keyMap.enable();                 }else{                     d.keyMap.disable();                 }             }, this, {single:true});             if(opt.wait === true){                 progressBar.wait(opt.waitConfig);             }             return this;         },                  setIcon : function(icon){             if(icon && icon != ''){                 iconEl.removeClass('x-hidden');                 iconEl.replaceClass(iconCls, icon);                 iconCls = icon;             }else{                 iconEl.replaceClass(iconCls, 'x-hidden');                 iconCls = '';             }             return 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;         },                  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;         },                  alert : function(title, msg, fn, scope){             this.show({                 title : title,                 msg : msg,                 buttons: this.OK,                 fn: fn,                 scope : scope             });             return this;         },                  confirm : function(title, msg, fn, scope){             this.show({                 title : title,                 msg : msg,                 buttons: this.YESNO,                 fn: fn,                 scope : scope,                 icon: this.QUESTION             });             return this;         },                  prompt : function(title, msg, fn, scope, multiline, value){             this.show({                 title : title,                 msg : msg,                 buttons: this.OKCANCEL,                 fn: fn,                 minWidth:250,                 scope : scope,                 prompt:true,                 multiline: multiline,                 value: value             });             return this;         },                  OK : {ok:true},                  CANCEL : {cancel:true},                  OKCANCEL : {ok:true, cancel:true},                  YESNO : {yes:true, no:true},                  YESNOCANCEL : {yes:true, no:true, cancel:true},                  INFO : 'ext-mb-info',                  WARNING : 'ext-mb-warning',                  QUESTION : 'ext-mb-question',                  ERROR : 'ext-mb-error',                  defaultTextHeight : 75,                  maxWidth : 600,                  minWidth : 100,                  minProgressWidth : 250,                  buttonText : {             ok : "OK",             cancel : "Cancel",             yes : "Yes",             no : "No"         }     }; }(); Ext.Msg = Ext.MessageBox;
  1161. Ext.Tip = Ext.extend(Ext.Panel, {
  1162.     
  1163.     
  1164.     
  1165.     minWidth : 40,
  1166.     
  1167.     maxWidth : 300,
  1168.     
  1169.     shadow : "sides",
  1170.     
  1171.     defaultAlign : "tl-bl?",
  1172.     autoRender: true,
  1173.     quickShowInterval : 250,
  1174.          frame:true,
  1175.     hidden:true,
  1176.     baseCls: 'x-tip',
  1177.     floating:{shadow:true,shim:true,useDisplay:true,constrain:false},
  1178.     autoHeight:true,
  1179.          initComponent : function(){
  1180.         Ext.Tip.superclass.initComponent.call(this);
  1181.         if(this.closable && !this.title){
  1182.             this.elements += ',header';
  1183.         }
  1184.     },
  1185.          afterRender : function(){
  1186.         Ext.Tip.superclass.afterRender.call(this);
  1187.         if(this.closable){
  1188.             this.addTool({
  1189.                 id: 'close',
  1190.                 handler: this.hide,
  1191.                 scope: this
  1192.             });
  1193.         }
  1194.     },
  1195.     
  1196.     showAt : function(xy){
  1197.         Ext.Tip.superclass.show.call(this);
  1198.         if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){
  1199.             this.doAutoWidth();
  1200.         }
  1201.         if(this.constrainPosition){
  1202.             xy = this.el.adjustForConstraints(xy);
  1203.         }
  1204.         this.setPagePosition(xy[0], xy[1]);
  1205.     },
  1206.          doAutoWidth : function(){
  1207.         var bw = this.body.getTextWidth();
  1208.         if(this.title){
  1209.             bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));
  1210.         }
  1211.         bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
  1212.         this.setWidth(bw.constrain(this.minWidth, this.maxWidth));
  1213.         
  1214.                  if(Ext.isIE7 && !this.repainted){
  1215.             this.el.repaint();
  1216.             this.repainted = true;
  1217.         }
  1218.     },
  1219.     
  1220.     showBy : function(el, pos){
  1221.         if(!this.rendered){
  1222.             this.render(Ext.getBody());
  1223.         }
  1224.         this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));
  1225.     },
  1226.     initDraggable : function(){
  1227.         this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
  1228.         this.header.addClass('x-tip-draggable');
  1229.     }
  1230. });
  1231. Ext.Tip.DD = function(tip, config){
  1232.     Ext.apply(this, config);
  1233.     this.tip = tip;
  1234.     Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);
  1235.     this.setHandleElId(tip.header.id);
  1236.     this.scroll = false;
  1237. };
  1238. Ext.extend(Ext.Tip.DD, Ext.dd.DD, {
  1239.     moveOnly:true,
  1240.     scroll:false,
  1241.     headerOffsets:[100, 25],
  1242.     startDrag : function(){
  1243.         this.tip.el.disableShadow();
  1244.     },
  1245.     endDrag : function(e){
  1246.         this.tip.el.enableShadow(true);
  1247.     }
  1248. });
  1249. Ext.ToolTip = Ext.extend(Ext.Tip, {
  1250.     
  1251.     
  1252.     
  1253.     showDelay: 500,
  1254.     
  1255.     hideDelay: 200,
  1256.     
  1257.     dismissDelay: 5000,
  1258.     
  1259.     mouseOffset: [15,18],
  1260.     
  1261.     trackMouse : false,
  1262.     constrainPosition: true,
  1263.          initComponent: function(){
  1264.         Ext.ToolTip.superclass.initComponent.call(this);
  1265.         this.lastActive = new Date();
  1266.         this.initTarget();
  1267.     },
  1268.          initTarget : function(){
  1269.         if(this.target){
  1270.             this.target = Ext.get(this.target);
  1271.             this.target.on('mouseover', this.onTargetOver, this);
  1272.             this.target.on('mouseout', this.onTargetOut, this);
  1273.             this.target.on('mousemove', this.onMouseMove, this);
  1274.         }
  1275.     },
  1276.          onMouseMove : function(e){
  1277.         this.targetXY = e.getXY();
  1278.         if(!this.hidden && this.trackMouse){
  1279.             this.setPagePosition(this.getTargetXY());
  1280.         }
  1281.     },
  1282.          getTargetXY : function(){
  1283.         return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]];
  1284.     },
  1285.          onTargetOver : function(e){
  1286.         if(this.disabled || e.within(this.target.dom, true)){
  1287.             return;
  1288.         }
  1289.         this.clearTimer('hide');
  1290.         this.targetXY = e.getXY();
  1291.         this.delayShow();
  1292.     },
  1293.          delayShow : function(){
  1294.         if(this.hidden && !this.showTimer){
  1295.             if(this.lastActive.getElapsed() < this.quickShowInterval){
  1296.                 this.show();
  1297.             }else{
  1298.                 this.showTimer = this.show.defer(this.showDelay, this);
  1299.             }
  1300.         }else if(!this.hidden && this.autoHide !== false){
  1301.             this.show();
  1302.         }
  1303.     },
  1304.          onTargetOut : function(e){
  1305.         if(this.disabled || e.within(this.target.dom, true)){
  1306.             return;
  1307.         }
  1308.         this.clearTimer('show');
  1309.         if(this.autoHide !== false){
  1310.             this.delayHide();
  1311.         }
  1312.     },
  1313.          delayHide : function(){
  1314.         if(!this.hidden && !this.hideTimer){
  1315.             this.hideTimer = this.hide.defer(this.hideDelay, this);
  1316.         }
  1317.     },
  1318.     
  1319.     hide: function(){
  1320.         this.clearTimer('dismiss');
  1321.         this.lastActive = new Date();
  1322.         Ext.ToolTip.superclass.hide.call(this);
  1323.     },
  1324.     
  1325.     show : function(){
  1326.         this.showAt(this.getTargetXY());
  1327.     },
  1328.          showAt : function(xy){
  1329.         this.lastActive = new Date();
  1330.         this.clearTimers();
  1331.         Ext.ToolTip.superclass.showAt.call(this, xy);
  1332.         if(this.dismissDelay && this.autoHide !== false){
  1333.             this.dismissTimer = this.hide.defer(this.dismissDelay, this);
  1334.         }
  1335.     },
  1336.          clearTimer : function(name){
  1337.         name = name + 'Timer';
  1338.         clearTimeout(this[name]);
  1339.         delete this[name];
  1340.     },
  1341.          clearTimers : function(){
  1342.         this.clearTimer('show');
  1343.         this.clearTimer('dismiss');
  1344.         this.clearTimer('hide');
  1345.     },
  1346.          onShow : function(){
  1347.         Ext.ToolTip.superclass.onShow.call(this);
  1348.         Ext.getDoc().on('mousedown', this.onDocMouseDown, this);
  1349.     },
  1350.          onHide : function(){
  1351.         Ext.ToolTip.superclass.onHide.call(this);
  1352.         Ext.getDoc().un('mousedown', this.onDocMouseDown, this);
  1353.     },
  1354.          onDocMouseDown : function(e){
  1355.         if(this.autoHide !== false && !e.within(this.el.dom)){
  1356.             this.disable();
  1357.             this.enable.defer(100, this);
  1358.         }
  1359.     },
  1360.          onDisable : function(){
  1361.         this.clearTimers();
  1362.         this.hide();
  1363.     },
  1364.          adjustPosition : function(x, y){
  1365.                  var ay = this.targetXY[1], h = this.getSize().height;
  1366.         if(this.constrainPosition && y <= ay && (y+h) >= ay){
  1367.             y = ay-h-5;
  1368.         }
  1369.         return {x : x, y: y};
  1370.     },
  1371.          onDestroy : function(){
  1372.         Ext.ToolTip.superclass.onDestroy.call(this);
  1373.         if(this.target){
  1374.             this.target.un('mouseover', this.onTargetOver, this);
  1375.             this.target.un('mouseout', this.onTargetOut, this);
  1376.             this.target.un('mousemove', this.onMouseMove, this);
  1377.         }
  1378.     }
  1379. });
  1380. Ext.QuickTip = Ext.extend(Ext.ToolTip, {
  1381.     
  1382.     
  1383.     interceptTitles : false,
  1384.          tagConfig : {
  1385.         namespace : "ext",
  1386.         attribute : "qtip",
  1387.         width : "qwidth",
  1388.         target : "target",
  1389.         title : "qtitle",
  1390.         hide : "hide",
  1391.         cls : "qclass",
  1392.         align : "qalign"
  1393.     },
  1394.          initComponent : function(){
  1395.         this.target = this.target || Ext.getDoc();
  1396.         this.targets = this.targets || {};
  1397.         Ext.QuickTip.superclass.initComponent.call(this);
  1398.     },
  1399.     
  1400.     register : function(config){
  1401.         var cs = Ext.isArray(config) ? config : arguments;
  1402.         for(var i = 0, len = cs.length; i < len; i++){
  1403.             var c = cs[i];
  1404.             var target = c.target;
  1405.             if(target){
  1406.                 if(Ext.isArray(target)){
  1407.                     for(var j = 0, jlen = target.length; j < jlen; j++){
  1408.                         this.targets[Ext.id(target[j])] = c;
  1409.                     }
  1410.                 } else{
  1411.                     this.targets[Ext.id(target)] = c;
  1412.                 }
  1413.             }
  1414.         }
  1415.     },
  1416.     
  1417.     unregister : function(el){
  1418.         delete this.targets[Ext.id(el)];
  1419.     },
  1420.          onTargetOver : function(e){
  1421.         if(this.disabled){
  1422.             return;
  1423.         }
  1424.         this.targetXY = e.getXY();
  1425.         var t = e.getTarget();
  1426.         if(!t || t.nodeType !== 1 || t == document || t == document.body){
  1427.             return;
  1428.         }
  1429.         if(this.activeTarget && t == this.activeTarget.el){
  1430.             this.clearTimer('hide');
  1431.             this.show();
  1432.             return;
  1433.         }
  1434.         if(t && this.targets[t.id]){
  1435.             this.activeTarget = this.targets[t.id];
  1436.             this.activeTarget.el = t;
  1437.             this.delayShow();
  1438.             return;
  1439.         }
  1440.         var ttp, et = Ext.fly(t), cfg = this.tagConfig;
  1441.         var ns = cfg.namespace;
  1442.         if(this.interceptTitles && t.title){
  1443.             ttp = t.title;
  1444.             t.qtip = ttp;
  1445.             t.removeAttribute("title");
  1446.             e.preventDefault();
  1447.         } else{
  1448.             ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute);
  1449.         }
  1450.         if(ttp){
  1451.             var autoHide = et.getAttributeNS(ns, cfg.hide);
  1452.             this.activeTarget = {
  1453.                 el: t,
  1454.                 text: ttp,
  1455.                 width: et.getAttributeNS(ns, cfg.width),
  1456.                 autoHide: autoHide != "user" && autoHide !== 'false',
  1457.                 title: et.getAttributeNS(ns, cfg.title),
  1458.                 cls: et.getAttributeNS(ns, cfg.cls),
  1459.                 align: et.getAttributeNS(ns, cfg.align)
  1460.             };
  1461.             this.delayShow();
  1462.         }
  1463.     },
  1464.          onTargetOut : function(e){
  1465.         this.clearTimer('show');
  1466.         if(this.autoHide !== false){
  1467.             this.delayHide();
  1468.         }
  1469.     },
  1470.          showAt : function(xy){
  1471.         var t = this.activeTarget;
  1472.         if(t){
  1473.             if(!this.rendered){
  1474.                 this.render(Ext.getBody());
  1475.                 this.activeTarget = t;
  1476.             }
  1477.             if(t.width){
  1478.                 this.setWidth(t.width);
  1479.                 this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));
  1480.                 this.measureWidth = false;
  1481.             } else{
  1482.                 this.measureWidth = true;
  1483.             }
  1484.             this.setTitle(t.title || '');
  1485.             this.body.update(t.text);
  1486.             this.autoHide = t.autoHide;
  1487.             this.dismissDelay = t.dismissDelay || this.dismissDelay;
  1488.             if(this.lastCls){
  1489.                 this.el.removeClass(this.lastCls);
  1490.                 delete this.lastCls;
  1491.             }
  1492.             if(t.cls){
  1493.                 this.el.addClass(t.cls);
  1494.                 this.lastCls = t.cls;
  1495.             }
  1496.             if(t.align){                  xy = this.el.getAlignToXY(t.el, t.align);
  1497.                 this.constrainPosition = false;
  1498.             } else{
  1499.                 this.constrainPosition = true;
  1500.             }
  1501.         }
  1502.         Ext.QuickTip.superclass.showAt.call(this, xy);
  1503.     },
  1504.          hide: function(){
  1505.         delete this.activeTarget;
  1506.         Ext.QuickTip.superclass.hide.call(this);
  1507.     }
  1508. });
  1509. Ext.QuickTips = function(){
  1510.     var tip, locks = [];
  1511.     return {
  1512.         
  1513.         init : function(autoRender){
  1514.     if(!tip){
  1515.         if(!Ext.isReady){
  1516.             Ext.onReady(function(){
  1517.                 Ext.QuickTips.init(autoRender);
  1518.             });
  1519.             return;
  1520.         }
  1521.         tip = new Ext.QuickTip({elements:'header,body'});
  1522.         if(autoRender !== false){
  1523.             tip.render(Ext.getBody());
  1524.         }
  1525.     }
  1526.         },
  1527.         
  1528.         enable : function(){
  1529.             if(tip){
  1530.                 locks.pop();
  1531.                 if(locks.length < 1){
  1532.                     tip.enable();
  1533.                 }
  1534.             }
  1535.         },
  1536.