(function(){Ext.override(Ext.ux.grid.CheckColumn,{onMouseDown:function(a,b){if(Ext.fly(b).hasClass(this.createId())){a.stopEvent();var c=this.grid.store.getAt(this.grid.getView().findRowIndex(b));c.set(this.dataIndex,!c.data[this.dataIndex]);c.save()}}})})();
(function(){Ext.override(Ext.ux.Spinner,{initSpinner:function(){this.field.addEvents({spin:true,spinup:true,spindown:true});this.keyNav=new Ext.KeyNav(this.el,{up:function(a){a.preventDefault();this.onSpinUp()},down:function(a){a.preventDefault();this.onSpinDown()},pageUp:function(a){a.preventDefault();this.onSpinUpAlternate()},pageDown:function(a){a.preventDefault();this.onSpinDownAlternate()},scope:this});this.field.mon(this.trigger,"click",this.onTriggerClick,this,{preventDefault:true});this.field.mon(this.trigger,
{mouseover:this.onMouseOver,mouseout:this.onMouseOut,mousemove:this.onMouseMove,mousedown:this.onMouseDown,mouseup:this.onMouseUp,scope:this,preventDefault:true});this.field.mon(this.wrap,"mousewheel",this.handleMouseWheel,this);this.dd.setXConstraint(0,0,10);this.dd.setYConstraint(1500,1500,10);this.dd.endDrag=this.endDrag.createDelegate(this);this.dd.startDrag=this.startDrag.createDelegate(this);this.dd.onDrag=this.onDrag.createDelegate(this)}})})();
(function(){Ext.apply(Ext.util.Format,{fileSize:function(a){Ext.isNumber(a)||(a=0);if(a<1024)return String.format(ngettext("{0} byte","{0} bytes",a),a);a=parseFloat((a/1024).toFixed(1));if(a<1024)return String.format(ngettext("{0} KB","{0} KB",a),a);a=parseFloat((a/1024).toFixed(1));if(a<1024)return String.format(ngettext("{0} MB","{0} MB",a),a);a=parseFloat((a/1024).toFixed(1));if(a<1024)return String.format(ngettext("{0} GB","{0} GB",a),a);a=parseFloat((a/1024).toFixed(1));return String.format(ngettext("{0} TB",
"{0} TB",a),a)},percentage:function(a,b){Ext.isDefined(b)||(b=2);return(a*100).toFixed(b)+"%"},duration:function(a,b){b=Ext.isDefined(b)?b:0;if(a<60)return String.format(ngettext("{0} minute","{0} minutes",a),a);a=parseFloat((a/60).toFixed(b));if(a<24)return String.format(ngettext("{0} hour","{0} hours",a),a);a=parseFloat((a/24).toFixed(b));if(a<7)return String.format(ngettext("{0} day","{0} days",a),a);a=parseFloat((a/7).toFixed(b));return String.format(ngettext("{0} week","{0} weeks",a),a)},indent:function(a,
b){for(var c=(Ext.isDefined(a)?a:1)*(Ext.isDefined(b)?b:4),d="",e=0;e<c;e++)d+="&nbsp;";return d},elide:function(a,b,c){b=b||0;c=Ext.isDefined(c)?c:b;if(b===0&&c===0)return a;if(a&&a.length>b+c)return a.substr(0,b)+"..."+a.substr(a.length-c);return a},htmlEncodeUndef:function(){return this.htmlEncode(this.undef.apply(this,arguments))},defaultValue:function(a,b){return Ext.value(a,b)},htmlEncodeDefaultValue:function(){return this.htmlEncode(this.defaultValue.apply(this,arguments))},htmlEncodeElide:function(){return this.htmlEncode(this.elide.apply(this,
arguments))},htmlEncodeEllipsis:function(){return this.htmlEncode(this.ellipsis.apply(this,arguments))},sensitivityString:function(a){return Zarafa.core.mapi.Sensitivity.getDisplayName(a)},importanceString:function(a){return Zarafa.core.mapi.Importance.getDisplayName(a)},meetingStatusString:function(a){return Zarafa.core.mapi.MeetingStatus.getDisplayName(a)},responseStatusString:function(a){return Zarafa.core.mapi.ResponseStatus.getDisplayName(a)},taskStatusString:function(a){return Zarafa.core.mapi.TaskStatus.getDisplayName(a)}})})();
(function(){Ext.override(Ext.tree.TreeSorter,{doSort:function(a){a.childNodes&&a.sort(this.sortFn)}})})();(function(){var a=Ext.tree.TreeEditor.prototype.bindScroll,b=Ext.tree.TreeEditor.prototype.fitToTree;Ext.override(Ext.tree.TreeEditor,{fitToTree:function(){this.tree&&this.tree.isDestroyed!==true&&b.apply(this,arguments)},bindScroll:function(){this.tree&&this.tree.isDestroyed!==true&&a.apply(this,arguments)}})})();
(function(){Ext.apply(Ext.state.Manager,{components:new Ext.util.MixedCollection(false,function(a){return a.getStateId()}),register:function(a){this.components.add(a)},unregister:function(a){this.components.remove(a)},getComponent:function(a){return this.components.get(a)}})})();(function(){var a=Ext.layout.boxOverflow.Menu.prototype.addComponentToMenu;Ext.override(Ext.layout.boxOverflow.Menu,{addComponentToMenu:function(b,c){if(c.xtbHidden===true||c.hidden!==true)a.apply(this,arguments)}})})();
(function(){var a=Ext.layout.ToolbarLayout.prototype.onLayout,b=Ext.layout.ToolbarLayout.prototype.addComponentToMenu;Ext.override(Ext.layout.ToolbarLayout,{triggerWidth:41,onLayout:function(c){a.apply(this,arguments);c.items.each(function(d){Ext.isFunction(d.doLayout)&&d.doLayout()},this)},addComponentToMenu:function(c,d){if(d.xtbHidden===true||d.hidden!==true)b.apply(this,arguments)}})})();
(function(){var a=Ext.layout.BorderLayout.Region.prototype.beforeCollapse,b=Ext.layout.BorderLayout.Region.prototype.onExpand;Ext.override(Ext.layout.BorderLayout.Region,{beforeCollapse:function(){this.splitEl&&this.splitEl.addClass("x-hide-display");a.apply(this,arguments)},onExpand:function(){this.splitEl&&this.splitEl.removeClass("x-hide-display");b.apply(this,arguments)}})})();
(function(){if(Ext.isIE6||Ext.isIE7||Ext.isAir)Ext.BLANK_IMAGE_URL="client/resources/images/s.gif";var a=Ext.encode;Ext.encode=Ext.util.JSON.encode=function(b){if(Ext.isDefined(b))return a(b)}})();(function(){Ext.override(Ext.grid.GridView,{getColumnWidth:function(a){a=this.cm.getColumnWidth(a);var b=this.borderWidth;return Ext.isNumber(a)?Ext.isBorderBox?a+"px":Math.max(a-b,0)+"px":a}})})();
(function(){var a=Ext.grid.GridPanel.prototype.onClick;Ext.override(Ext.grid.GridPanel,{onClick:function(){a.apply(this,arguments);this.view.focusEl.focus()}})})();(function(){var a=Ext.form.Label.prototype.onRender;Ext.override(Ext.form.Label,{cls:"x-form-item-label",onRender:function(){a.apply(this,arguments);this.positionEl=this.el.wrap({cls:"x-form-item"});this.el.unselectable()}})})();
(function(){Ext.override(Ext.form.HtmlEditor,{onFirstFocus:function(){this.activated=true;this.disableItems(this.readOnly);this.fireEvent("activate",this)},fixKeys:function(){if(Ext.isIE)return function(a){var b=a.getKey(),c=this.getDoc();if(b==a.TAB){a.stopEvent();if(b=c.selection.createRange()){b.collapse(true);b.pasteHTML("&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}}else if(b==a.ENTER)if(b=c.selection.createRange()){c=b.parentElement();if(!c||c.tagName.toLowerCase()!="li"){a.stopEvent();b.pasteHTML("<br />");
b.collapse(false);b.select()}}};else if(Ext.isOpera)return function(a){if(a.getKey()==a.TAB){a.stopEvent();this.win.focus();this.execCmd("InsertHTML","&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}};else if(Ext.isWebKit)return function(a){if(a.getKey()==a.TAB){a.stopEvent();this.execCmd("InsertText","\t");this.deferFocus()}}}()})})();(function(){Ext.override(Ext.form.FormPanel,{labelAlign:"right"})})();(function(){Ext.override(Ext.form.DisplayField,{cls:"x-form-item"})})();
(function(){var a=Ext.form.ComboBox.prototype.initList;Ext.override(Ext.form.ComboBox,{initList:function(){if(!this.tpl)this.tpl='<tpl for="."><div class="x-combo-list-item">{'+this.displayField+":htmlEncode}</div></tpl>";a.apply(this,arguments)}})})();
(function(){var a=Ext.form.Checkbox.prototype.onRender;Ext.override(Ext.form.Checkbox,{onRender:function(){a.apply(this,arguments);this.wrap.addClass("x-form-item");if(this.boxLabel&&this.el){var b=Ext.query(".x-form-cb-label",this.el.parent().dom)[0];b&&Ext.get(b).unselectable()}}})})();
(function(){Ext.override(Ext.form.BasicForm,{updateRecord:function(a){a.beginEdit();var b,c;a.fields.each(function(d){if(b=this.findField(d.name)){c=b.getValue();if(Ext.type(c)!==false&&c.getGroupValue)c=c.getGroupValue();else if(b.isSingleValued!==true&&b.eachItem){c=[];b.eachItem(function(e){c.push(e.getValue())})}a.set(d.name,c)}},this);a.endEdit();return this},setValues:function(a){if(Ext.isArray(a))for(var b=0,c=a.length;b<c;b++){var d=a[b],e=this.findField(d.id);if(e)if(!e.hasFocus||e.originalValue==
e.el.dom.value){e.setValue(d.value);if(this.trackResetOnLoad)e.originalValue=e.getValue()}}else for(c in a)if(!Ext.isFunction(a[c])&&(b=this.findField(c)))if(!b.hasFocus||b.originalValue==b.el.dom.value){b.setValue(a[c]);if(this.trackResetOnLoad)b.originalValue=b.getValue()}return this}})})();
(function(){var a=Ext.dd.DragSource.prototype.onDragOver,b=Ext.dd.DragSource.prototype.onDragOut,c=Ext.dd.DragSource.prototype.onDragDrop;Ext.override(Ext.dd.DragSource,{onDragEnter:function(d,e){this.cachedTarget&&this.onDragOut(d,this.cachedTarget.id);var f;if((this.cachedTarget=f=this.ddGroup?Ext.dd.DragDropMgr.getGroupDDById(this.ddGroup,e):Ext.dd.DragDropMgr.getDDById(e))&&this.beforeDragEnter(f,d,e)!==false){f.isNotifyTarget?this.proxy.setStatus(f.notifyEnter(this,d,this.dragData)):this.proxy.setStatus(this.dropAllowed);
this.afterDragEnter&&this.afterDragEnter(f,d,e)}},onDragOver:function(d,e){this.cachedTarget||this.onDragEnter(d,e);this.cachedTarget=this.cachedTarget||Ext.dd.DragDropMgr.getGroupDDById(this.ddGroup,e);return a.apply(this,arguments)},onDragOut:function(){if(this.cachedTarget)return b.apply(this,arguments)},onDragDrop:function(){if(this.cachedTarget)return c.apply(this,arguments)}})})();
(function(){Ext.apply(Ext.dd.DragDropMgr,{getGroupDDById:function(a,b){if(this.ids[a]&&this.ids[a][b])return this.ids[a][b];return null}})})();(function(){var a=Ext.data.Node.prototype.appendChild,b=Ext.data.Node.prototype.removeChild;Ext.override(Ext.data.Node,{appendChild:function(){this.leaf=false;return a.apply(this,arguments)},removeChild:function(){var c=b.apply(this,arguments);if(!this.hasChildNodes())this.leaf=true;return c}})})();
(function(){var a=Ext.Toolbar.TextItem.prototype.onRender;Ext.override(Ext.Toolbar.TextItem,{onRender:function(){a.apply(this,arguments);this.el&&this.el.unselectable()}})})();(function(){var a=Ext.TabPanel.prototype.onStripMouseDown;Ext.override(Ext.TabPanel,{onStripMouseDown:function(b){b=new Ext.EventObjectImpl(b);var c=b.getTarget("a.x-tab-right");c&&c.focus();a.call(this,b)}})})();
(function(){Ext.apply(Ext.EventObjectImpl.prototype,{SEMI_COLON:186,EQUAL_SIGN:187,COMMA:188,DASH:189,PERIOD:190,FORWARD_SLASH:191,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRACKET:221,SINGLE_QUOTE:222})})();
(function(){Ext.Element.addMethods({addUnits:function(a){if(Ext.isEmpty(a)||a=="auto")a=a||"";else if(isNaN(a))a="";else/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i.test(a)||(a+=this.defaultUnit||"px");return a},swallowEvent:function(a,b){var c=this,d=b===true?this.swallowEventHandlerPreventDefault:this.swallowEventHandler;if(Ext.isArray(a)){Ext.each(a,function(e){c.on(e,d,this)});return c}c.on(a,d,this);return c},swallowEventHandler:function(a){a.stopPropagation()},swallowEventHandlerPreventDefault:function(a){a.stopPropagation();
a.preventDefault()},spitOutEvent:function(a,b){var c=this,d=b===true?this.swallowEventHandlerPreventDefault:this.swallowEventHandler;if(Ext.isArray(a)){Ext.each(a,function(e){c.un(e,d,this)});return c}c.un(a,d,this);return c},selectable:function(){this.dom.unselectable="off";return this.spitOutEvent("selectstart",true).applyStyles("-moz-user-select:text;-khtml-user-select:text;").removeClass("x-unselectable")},clearClass:function(){this.dom.className=""}})})();
(function(){Ext.override(Ext.Container,{bufferResize:false})})();
(function(){var a=Ext.Component.prototype.initComponent,b=Ext.Component.prototype.destroy;Ext.override(Ext.Component,{stateful:false,statefulRelativeDimensions:true,statefulName:undefined,initComponent:function(){if(this.stateful!==false){if(!this.stateId)this.stateId=Ext.id(null,"state-");Ext.state.Manager.register(this)}a.apply(this,arguments)},getStateName:function(){var c=this.statefulName;c||(c=this.xtype.match(/(?:zarafa\.)?(.*)/)[1]);return c},destroy:function(){if(this.plugins)for(var c in this.plugins){var d=
this.plugins[c];d instanceof Ext.util.Observable&&d.purgeListeners()}this.stateful!==false&&Ext.state.Manager.unregister(this);b.apply(this,arguments)}})})();(function(){var a=Ext.Button.prototype.onClick;Ext.override(Ext.Button,{onClick:function(b){b=new Ext.EventObjectImpl(b);this.focus();a.call(this,b);this.isDestroyed||this.blur()},template:new Ext.Template('<div id="{4}" class="x-btn {3}"><div class="{1}">','<em class="{2}" unselectable="on"><button type="{0}"></button></em>',"</div></div>")})})();
(function(){var a=Ext.DatePicker.prototype.onRender,b=Ext.DatePicker.prototype.initComponent;Ext.override(Ext.DatePicker,{width:"auto",initComponent:function(){this.startDay=Ext.isDefined(this.initialConfig.startDay)?this.startDay:container.getSettingsModel().get("zarafa/v1/main/week_start");b.apply(this,arguments)},onRender:function(){a.apply(this,arguments);this.getEl().down("table").applyStyles({width:this.width})}})})();
