var $jscomp={scope:{},checkStringArgs:function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""}};
$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var b=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var d="";a;)if(a&1&&(d+=b),a>>>=1)b+=b;return d}},"es6-impl","es3");$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6-impl","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(a){return $jscomp.SYMBOL_PREFIX+(a||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var b=0;return $jscomp.iteratorPrototype(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(a,b){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var c=0,d={next:function(){if(c<a.length){var e=c++;return{value:b(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};
$jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a){return a})}},"es6-impl","es3");$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}},"es6-impl","es3");
$jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(a,c){var b=$jscomp.checkStringArgs(this,a,"startsWith");a+="";for(var e=b.length,f=a.length,g=Math.max(0,Math.min(c|0,b.length)),h=0;h<f&&g<e;)if(b[g++]!=a[h++])return!1;return h>=f}},"es6-impl","es3");Ext.apply(Array.prototype,{clone:function(){return this.slice(0)},equals:function(a){return this===a?!0:this.length!==a.length?!1:this.every(function(b,c){return b===a[c]})}});
Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(a,b){if(null===this)throw new TypeError('"this" is null or not defined');var c=Object(this),d=c.length>>>0;if("function"!==typeof a)throw new TypeError("predicate must be a function");for(var e=0;e<d;){var f=c[e];if(a.call(b,f,e,c))return f;e++}}});
document.createElement("canvas").getContext&&(CanvasRenderingContext2D.prototype.circle=function(a,b,c){this.beginPath();this.arc(a,b,c,0,2*Math.PI,!0);this.closePath()},CanvasRenderingContext2D.prototype.strokeLine=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(c,d);this.stroke()},CanvasRenderingContext2D.prototype.getFontSize=function(){return parseInt(/([0-9]*)p[tx]/.exec(this.font)[1],10)},CanvasRenderingContext2D.prototype.drawText=function(a,b,c,d){d?this.fillText(a,b,c,d):
this.fillText(a,b,c)},CanvasRenderingContext2D.prototype.drawWrappedText=function(a,b,c,d,e,f,g,h){for(;"\n"===a[a.length-1];)a=a.substr(0,a.length-1);var k=a.split("\n");if(1<k.length){var l=0;for(a=0;a<k.length;a++){var m=this.drawWrappedText(k[a],b,c,d,e,f,g,h);c+=m;l+=m;f-=m}return l}k=a.split(" ");l=this.textWidth(" ");g=g||0;h=h||0;var m=b+g,n=c;a=0;for(var p=k.length;a<p;a++){var r=k[a],q=this.textWidth(r);if(m-b+q>=d&&m!==b){var t=!0;q>=d&&m-b+q/2<d&&(t=!1);if(t&&(n+=e,n>h&&(g=0),m=b+g,n-
c>f))break}this.drawText(r,m,n);m+=q+l}return n-c+e},CanvasRenderingContext2D.prototype.textHeight=function(a,b,c){for(;"\n"===a[a.length-1];)a=a.substr(0,a.length-1);var d=a.split("\n");if(1<d.length){var e=0;for(a=0;a<d.length;a++)var f=this.textHeight(d[a],b,c),e=e+f;return e}var d=a.split(" "),e=this.textWidth(" "),g=f=0;a=0;for(var h=d.length;a<h;a++){var k=this.textWidth(d[a]);if(f+k>=b&&0!==f){var l=!0;k>=b&&f+k/2<b&&(l=!1);l&&(f=0,g+=c)}f+=k+e}return g+c},CanvasRenderingContext2D.prototype.textWidth=
function(a){return this.measureText(a).width},CanvasRenderingContext2D.prototype.convertHexRgbToDecRgba=function(a,b){if(Ext.isString(a)&&0===a.search(/#?[A-F0-9]{6}/i)){Ext.isNumber(b)||(b=1);var c=[];a=a.replace("#","");c[0]=parseInt(a.substr(0,2),16);c[1]=parseInt(a.substr(2,2),16);c[2]=parseInt(a.substr(4,2),16);return"rgba("+c[0]+","+c[1]+","+c[2]+","+b+")"}return"rgba(0,0,0,0)"});
Ext.apply(Date.prototype,{add:function(a,b){var c=this.clone();if(!a||0===b)return c;switch(a.toLowerCase()){case Date.HOUR:b*=60;case Date.MINUTE:b*=60;case Date.SECOND:b*=1E3;case Date.MILLI:c=new Date(c.getTime()+b);break;case Date.DAY:c.setDate(this.getDate()+b);break;case Date.MONTH:var d=this.getDate();28<d&&(d=Math.min(d,this.getFirstDateOfMonth().add(Date.MONTH,b).getLastDateOfMonth().getDate()));c.setDate(d);c.setMonth(this.getMonth()+b);break;case Date.YEAR:c.setFullYear(this.getFullYear()+
b)}return c},toUTC:function(){var a=new Date(this.getTime()+6E4*this.getTimezoneOffset());a.setMilliseconds(a.getMilliseconds()+Date.getDSTDiff(a,this));return a},fromUTC:function(){return new Date(this.getTime()-6E4*this.getTimezoneOffset())},getNextWeekDay:function(a){var b=this.getDay();return Ext.isDefined(a)?a<b?this.add(Date.DAY,7-(b-a)):this.add(Date.DAY,a-b):this.add(Date.DAY,1)},getPreviousWeekDay:function(a){var b=this.getDay();return Ext.isDefined(a)?a<=b?this.add(Date.DAY,a-b):this.add(Date.DAY,
-7+(a-b)):this.add(Date.DAY,-1)},getNextWorkWeekDay:function(a){a=a||new Date;a=a.getNextWeekDay();var b=container.getSettingsModel().get("zarafa/v1/main/working_days");return Ext.isEmpty(b)?!1:-1!==b.indexOf(a.getDay())?a:this.getNextWorkWeekDay(a)},clearSeconds:function(a){if(a)return this.clone().clearSeconds();this.setSeconds(0);this.setMilliseconds(0);return this},setToNoon:function(){this.clearTime().setHours(12);return this},inSameWeekAs:function(a){var b=this.clone().setToNoon(),b=b.add(Date.DAY,
-1*b.getDay());a.setToNoon();a=a.add(Date.DAY,-1*a.getDay());return b.getTime()===a.getTime()},inNextWeek:function(a){return this.add(Date.DAY,7).inSameWeekAs(a)},round:function(a,b){var c;switch(a){case Date.MILLI:c=this.getMilliseconds();0<c%b&&this.setMilliseconds(c-c%b+(c%b>=b/2)*b);break;case Date.SECOND:c=this.getSeconds();0<c%b&&this.setSeconds(c-c%b+(c%b>=b/2)*b);this.setMilliseconds(0);break;case Date.MINUTE:c=this.getMinutes();0<c%b&&this.setMinutes(c-c%b+(c%b>=b/2)*b);this.setSeconds(0);
this.setMilliseconds(0);break;case Date.HOUR:c=this.getHours(),0<c%b&&this.setHours(c-c%b+(c%b>=b/2)*b),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0)}return this},ceil:function(a,b){var c;switch(a){case Date.MILLI:c=this.getMilliseconds();0<c%b&&this.setMilliseconds(c-c%b+b);break;case Date.SECOND:c=this.getSeconds();0<c%b&&this.setSeconds(c-c%b+b);this.setMilliseconds(0);break;case Date.MINUTE:c=this.getMinutes();0<c%b&&this.setMinutes(c-c%b+b);this.setSeconds(0);this.setMilliseconds(0);
break;case Date.HOUR:c=this.getHours(),0<c%b&&this.setHours(c-c%b+b),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0)}return this},floor:function(a,b){var c;switch(a){case Date.MILLI:c=this.getMilliseconds();0<c%b&&this.setMilliseconds(c-c%b);break;case Date.SECOND:c=this.getSeconds();0<c%b&&this.setSeconds(c-c%b);this.setMilliseconds(0);break;case Date.MINUTE:c=this.getMinutes();0<c%b&&this.setMinutes(c-c%b);this.setSeconds(0);this.setMilliseconds(0);break;case Date.HOUR:c=this.getHours(),
0<c%b&&this.setHours(c-c%b),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0)}return this},getWeekOfMonth:function(){var a=this.getWeekOfYear(),b=this.add(Date.DAY,-(this.getDate()-1)).getWeekOfYear();return a-b+1},getNiceFormat:function(a){a=!1!==a;var b=this.clearTime(!0),c=(new Date).clearTime();return b.getTime()===c.getTime()?a?this.format(_("G:i")):_("Today"):b.add(Date.DAY,-1).getTime()===c.getTime()?a?_("Tomorrow")+" "+this.format(_("G:i")):_("Tomorrow"):b>c?this.format(_("d-m-Y")):
b.add(Date.DAY,6)>=c?a?this.format(_("D G:i")):this.format(_("D d-m")):b.add(Date.DAY,14)>=c?this.format(_("D d-m")):this.format(_("d-m-Y"))}});
Ext.apply(Date,{dayInMillis:864E5,getDSTDiff:function(a,b){return 6E4*(a.getTimezoneOffset()-b.getTimezoneOffset())},diff:function(a,b,c){var d=b.getTime(),e=c.getTime(),d=d-e;switch(a){case Date.DAY:d-=Date.getDSTDiff(b,c),d/=24;case Date.HOUR:d/=60;case Date.MINUTE:d/=60;case Date.SECOND:d/=1E3}return d},getTimezoneStruct:function(){var a=[],b=0,c=new Date,d={};c.setMonth(0);c.setDate(1);c.setMinutes(0);c.setSeconds(0);c.setMilliseconds(0);c=c.getNextWeekDay(0);c.setHours(5);for(var e=c.getTimezoneOffset(),
f=0;52>f;f++){if(c.getTimezoneOffset()!=e){a[b]={switchweek:c.getWeekOfMonth(),switchmonth:c.getMonth(),offset:c.getTimezoneOffset()};b++;if(2==b)break;e=c.getTimezoneOffset()}c=c.add(Date.DAY,7)}0===b?d={timezone:c.getTimezoneOffset(),timezonedst:0,dststartday:0,dststartweek:0,dststartmonth:0,dststarthour:0,dstendday:0,dstendweek:0,dstendmonth:0,dstendhour:0}:1!=b&&2==b&&(d=a[0].offset<a[1].offset?{timezone:a[1].offset,timezonedst:a[0].offset-a[1].offset,dststartday:0,dststartweek:4==a[0].switchweek?
5:a[0].switchweek,dststartmonth:a[0].switchmonth+1,dststarthour:2,dstendday:0,dstendweek:4==a[1].switchweek?5:a[1].switchweek,dstendmonth:a[1].switchmonth+1,dstendhour:3}:{timezone:a[0].offset,timezonedst:a[1].offset-a[0].offset,dststartday:0,dststartweek:4==a[1].switchweek?5:a[1].switchweek,dststartmonth:a[1].switchmonth+1,dststarthour:2,dstendday:0,dstendweek:4==a[0].switchweek?5:a[0].switchweek,dstendmonth:a[0].switchmonth+1,dstendhour:3});return d}});
String.prototype.padEnd||(String.prototype.padEnd=function(a,b){a>>=0;b=String(b||" ");if(this.length>a)return String(this);a-=this.length;a>b.length&&(b+=b.repeat(a/b.length));return String(this)+b.slice(0,a)});String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(a,b){return this.substr(b||0,a.length)===a}});
String.prototype.padStart||(String.prototype.padStart=function(a,b){a>>=0;b=String(b||" ");if(this.length>a)return String(this);a-=this.length;a>b.length&&(b+=b.repeat(a/b.length));return b.slice(0,a)+String(this)});Ext.namespace("Zarafa");
Ext.apply(Zarafa,{isReady:!1,readyEvent:new Ext.util.Event,uiReady:!1,uiReadyEvent:new Ext.util.Event,idleTime:0,wingdingsInstalled:!1,isDeskApp:Ext.isDefined(window.nw),onReady:function(a,b,c){this.readyEvent.addListener(a,b,c);this.isReady&&this.fireReady()},fireReady:function(){this.isReady=!0;this.readyEvent.fire();this.readyEvent.clearListeners()},onUIReady:function(a,b,c){c=c||{};c.single=!0;this.uiReadyEvent.addListener(a,b,c);this.uiReady&&this.fireUIReady()},fireUIReady:function(){this.uiReady=
!0;this.uiReadyEvent.fire();this.uiReadyEvent.clearListeners()},initializeGlobals:function(){Ext.USE_NATIVE_JSON=!0;Zarafa.core.Util.enableLeaveRequester();window.onunload=function(){1<Zarafa.core.BrowserWindowMgr.browserWindows.length&&Zarafa.core.BrowserWindowMgr.closeAllBrowserWindow();container.getRequest().paralyze(Zarafa.core.data.ParalyzeReason.BROWSER_RELOADING)};container=new Zarafa.core.Container;container.setServerConfig(serverconfig);delete serverconfig;container.getSettingsModel().initialize(settings);
delete settings;Ext.isDefined(window.persistentsettings)&&(container.getPersistentSettingsModel().initialize(window.persistentsettings),delete window.persistentsettings);container.setUser(user);delete user;container.setVersion(version);delete version;container.setLanguages(languages);delete languages},initializeEnvironment:function(){Ext.state.Manager.setProvider(new Zarafa.core.data.SettingsStateProvider);Ext.getBody().on("contextmenu",this.onBodyContextMenu,this);Ext.EventManager.on(window,"dragover",
this.onWindowDragDrop,this);Ext.EventManager.on(window,"drop",this.onWindowDragDrop,this);container.getRequest().on("connectionparalyzed",this.onConnectionParalyze,this);container.getRequest().on("connectioninterrupted",this.onConnectionLoss,this);container.getRequest().on("connectionrestored",this.onConnectionRestore,this);container.getResponseRouter().on("receiveexception",this.onReceiveException,this);Ext.data.DataProxy.on("exception",this.onException,this);Ext.QuickTips.init()},onBodyContextMenu:function(a,
b){b=Ext.get(b);if(!b.hasClass("zarafa-contextmenu-enabled")){if("INPUT"===b.dom.tagName.toUpperCase()){var c=b.getAttribute("type")||"",d=!Ext.isEmpty(b.dom.attributes.readonly);if("TEXT"===c.toUpperCase()&&!d)return}a.preventDefault()}},onWindowDragDrop:function(a){a.stopPropagation();a.preventDefault();return!1},onException:function(a,b,c,d,e,f){if("response"===b)if(Ext.isDefined(f)&&f.error instanceof Error)a=f.error.toString();else{this.onReceiveException(d,e);return}else if(e&&e.error)switch(e.error.type){case Zarafa.core.ErrorType.MAPI:case Zarafa.core.ErrorType.ZARAFA:case Zarafa.core.ErrorType.GENERAL:a=
e.error.info.display_message;break;default:a=_("The server reported an unknown error on your request.")}else a=_("The server reported an unspecified error on your request.");Ext.get("loading")?this.setErrorLoadingMask(_("Error"),a):container.getNotifier().notify("error.proxy",_("Error"),a)},onConnectionParalyze:function(a,b){var c,d;switch(b){default:return;case Zarafa.core.data.ParalyzeReason.SESSION_EXPIRED:c=_("The session has expired, reauthentication is required.");d=container.logout.createDelegate(container,
[!0],!1);break;case Zarafa.core.data.ParalyzeReason.SESSION_INVALID:c=_("The session in the current browser window has been closed from another browser window or tab."),d=container.logout.createDelegate(container,[!0,!0],!1)}Ext.get("loading")?this.setErrorLoadingMask(_("Error"),c):Ext.MessageBox.show({title:_("Kopano WebApp"),msg:c+"<br>"+_("Do you wish to be redirected to the logon page?"),icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.YESNO,fn:this.onConnectionParalyzeConfirmation,scope:this,
logoutFn:d})},onConnectionParalyzeConfirmation:function(a,b,c){"yes"===a?c.logoutFn.call(this):container.getNotifier().notify("error.connection",_("Session expired"),_("Reauthentication required, click here to go to back to logon page."),{persistent:!0,listeners:{click:c.logoutFn}})},onConnectionTimeupdate:function(a,b,c){var d=container.getRequest();d.isInterrupted()&&!d.isParalyzed()&&(this.connEl=container.getNotifier().notify("error.connection",_("Connection problem"),String.format(_("Could not connect to server, retrying in {0} second(s)"),
c/1E3)+"<br />"+_("Click to retry now"),{persistent:!0,update:!!this.connEl,reference:this.connEl,listeners:{click:a.retry,scope:a}}),1E3<c&&this.connElTask.delay(1E3,this.onConnectionTimeupdate,this,[a,b,c-1E3]))},onConnectionRetry:function(a,b,c){this.connElTask.cancel();this.onConnectionTimeupdate(a,b,c)},onConnectionLoss:function(a,b){this.connElTask=new Ext.util.DelayedTask(this.onConnectionTimeupdate,this);b.on("retry",this.onConnectionRetry,this)},onConnectionRestore:function(a){this.connElTask&&
(this.connElTask.cancel(),delete this.connElTask);this.connEl&&(container.getNotifier().notify("error.connection",null,null,{destroy:!0,reference:this.connEl}),container.getNotifier().notify("info.connection.restore",_("Connection restored"),_("Connection with server has been restored")),delete this.connEl)},onReceiveException:function(a,b){var c=Ext.get("loading"),d,e;200!==b.status?(d=String.format(_("HTTP {0}"),b.status),e=b.statusText):(d=_("Error"),e=_("Invalid data received from the server"));
c?this.setErrorLoadingMask(d,e):container.getNotifier().notify("error.json",d,e)},hideLoadingMask:function(a){var b=Ext.get("loading-mask");b&&b.fadeOut({duration:1,remove:!0,callback:Ext.isFunction(a)?a:Ext.EmptyFn})},setErrorLoadingMask:function(a,b){var c=new Ext.Template("<div><b>{title}</b><br />{msg}</div>",{compiled:!0,disableFormats:!0}),d=Ext.get("loading-message");d&&(d.dom.className="loading-error",c.overwrite(d,{title:a,msg:b}))},validateHierarchy:function(a){if(a.getDefaultStore()){for(var b=
[{type:"inbox",name:pgettext("hierarchy.foldername","Inbox")},{type:"outbox",name:pgettext("hierarchy.foldername","Outbox")},{type:"sent",name:pgettext("hierarchy.foldername","Sent Items")},{type:"wastebasket",name:pgettext("hierarchy.foldername","Deleted items")},{type:"calendar",name:pgettext("hierarchy.foldername","Calendar")},{type:"contact",name:pgettext("hierarchy.foldername","Contacts")},{type:"drafts",name:pgettext("hierarchy.foldername","Drafts")},{type:"journal",name:pgettext("hierarchy.foldername",
"Journal")},{type:"note",name:pgettext("hierarchy.foldername","Notes")},{type:"task",name:pgettext("hierarchy.foldername","Tasks")},{type:"junk",name:pgettext("hierarchy.foldername","Junk E-mail")}],c=[],d=0,e=b.length;d<e;d++){var f=b[d];a.getDefaultFolder(f.type)||c.push(f.name)}Ext.isEmpty(c)||(a="<ul><li>"+c.join("</li><li>")+"</li></ul>",container.getNotifier().notify("error.hierarchy.defaultfolder",_("Missing folders"),String.format(ngettext("The following required folder is missing in the hierarchy: {0}",
"The following required folders are missing in the hierarchy: {0}",c.length),a)+_("Not all functionality of WebApp might be working properly because of this."),{persistent:!0,listeners:{click:this.onHierarchyNotifierClick,scope:this}}))}else container.getNotifier().notify("error.hierarchy.defaultfolder",_("Missing store"),_("The default store is missing from the hierarchy.")+"<br>"+_("Not all functionality of WebApp might be working properly because of this."),{persistent:!0,listeners:{click:this.onHierarchyNotifierClick,
scope:this}})},onHierarchyNotifierClick:function(a,b){container.getNotifier().notify("error.hierarchy.defaultfolder",null,null,{reference:a,destroy:!0})},onHierarchyLoad:function(a,b,c){Ext.isEmpty(b)?this.setErrorLoadingMask(_("Error"),_("Loading model from server failed")):(container.getMainPanel(),this.validateHierarchy(a),this.hideLoadingMask(function(){container.fireEvent("webapploaded");Zarafa.fireUIReady()}),window.removeEventListener("resize",resizeLoginBox),this.registerMailto(),Zarafa.core.URLActionMgr.execute(urlActionData),
delete urlActionData,a.startKeepAlive())},registerMailto:function(){var a=window.navigator;if(Ext.isFunction(a.registerProtocolHandler)){var b=container.getBaseURL()+"?action=mailto&to=%s",c=!0;Ext.isFunction(a.isProtocolHandlerRegistered)&&(c=!a.isProtocolHandlerRegistered("mailto",b));c&&a.registerProtocolHandler("mailto",b,"Kopano WebApp")}},loadWebclient:function(){Zarafa.initializeGlobals();Zarafa.initializeEnvironment();Zarafa.fireReady();Zarafa.whatsnew.Actions.openWhatsNewDialog();this.checkOof();
this.initContext();container.getReminderStore().initializeReminderInterval();var a=container.getHierarchyStore();a.on("load",this.onHierarchyLoad,this,{single:!0});a.load();(a=container.getServerConfig().getClientTimeout())&&this.startIdleTimeChecker(a);this.wingdingsInstalled=window.checkfont.exists("Wingdings")},startIdleTimeChecker:function(a){if(document.addEventListener){var b=this;document.addEventListener("click",function(){b.idleTime=0},!0);document.addEventListener("mousemove",function(){b.idleTime=
0},!0);document.addEventListener("keydown",function(){b.idleTime=0},!0);var c=container.getHierarchyStore();Ext.TaskMgr.start.createDelegate(this,[{run:function(){this.idleTime+=5;this.idleTime>a&&c.sendDestroySession()},scope:this,interval:5E3}]).defer(5E3);var d=1E3*(a-5);5E3>d&&(d=5E3);Ext.TaskMgr.start.createDelegate(this,[{run:function(){c.sendKeepAlive()},scope:this,interval:d}]).defer(d)}},initContext:function(){var a=container.getSettingsModel().get("zarafa/v1/main/default_context");(a=container.getContextByName(a))||
(a=container.getContextByName("today"));container.switchContext(a)},checkOof:function(){var a=!1;if(!0===container.getSettingsModel().get("zarafa/v1/contexts/mail/outofoffice/set")){var b=container.getSettingsModel().get("zarafa/v1/contexts/mail/outofoffice/from"),c=container.getSettingsModel().get("zarafa/v1/contexts/mail/outofoffice/until"),d=(new Date).getTime()/1E3;b<=d&&(0===c||c>d?a=!0:container.getSettingsModel().set("zarafa/v1/contexts/mail/outofoffice/set",!1))}a&&Ext.MessageBox.confirm(_("Kopano WebApp"),
_("Out of Office currently on. Would you like to turn it off?"),this.onOofConfirm,this)},onOofConfirm:function(a){"yes"===a&&(container.getSettingsModel().set("zarafa/v1/contexts/mail/outofoffice/set",!1),container.getNotifier().notify("info.saved",_("Out of office off"),_("Out of office has been turned off")))},loadWelcome:function(){this.initializeGlobals();this.initializeEnvironment();this.fireReady();container.getWelcomePanel();this.hideLoadingMask()},resizeCanvas:function(a,b,c){a.setWidth(a.dom.width=
b);a.setHeight(a.dom.height=c)},generateId:function(a){for(var b="",c=0;c<a;c++)b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return b},supportsPopOut:function(){return!(Ext.isIE||Ext.isEdge)}});Ext.namespace("Zarafa.core");
Zarafa.core.Actions={list:"list",globaladdressbook:"globaladdressbook",hierarchy:"hierarchy",open:"open",item:"item",update:"update",save:"save",copy:"copy","delete":"delete",folder:"folder",set:"set",get:"get",reset:"reset",_delete:"delete",search:"search",updatesearch:"updatesearch",updatelist:"updatelist",stopsearch:"stopsearch",contacts:"contacts",keepalive:"keepalive",destroysession:"destroysession",newmail:"newmail",addFolder:"add",modifyFolder:"modify",deleteFolder:"delete",emptyFolder:"emptyfolder",
readAllMsgs:"readflags",folderProps:"folderprops",checknames:"checknames",expand:"expand",upload:"upload","import":"import"};Ext.namespace("Zarafa.core");
Zarafa.core.BrowserWindowMgr=Ext.extend(Ext.util.Observable,{browserWindows:void 0,activeBrowserWindow:void 0,browserWindowComponents:void 0,isPopupsBlocked:!1,blockedPopupsContent:[],constructor:function(){this.browserWindows=new Ext.util.MixedCollection;window.name="mainBrowserWindow";this.register(window);window.addEventListener("focus",function(a){Zarafa.core.BrowserWindowMgr.setActive("mainBrowserWindow")},!1);this.browserWindowComponents=new Ext.util.MixedCollection;this.addEvents("separatewindowresize")},
initComponent:function(a,b,c){this.browserWindowComponents.add(a,{component:b,config:c})},initEvents:function(a,b,c){this.initExtCss(a);b.on("close",this.onSeparateWindowClose.createDelegate(this,[a]));b.on("userupdaterecord",this.onComponentUserupdateRecord.createDelegate(this,[b],!0));Ext.EventManager.on(a,"resize",this.onSeparateWindowResize.createDelegate(this,[a,c]),a);Ext.dd.DragDropMgr.initEvents(a);a.addEventListener("focus",this.onSeparateWindowFocus.createDelegate(this,[a.name]));a.addEventListener("unload",
this.onSeparateWindowUnload.createDelegate(this,[a,b,c]));Ext.getBody().on("contextmenu",this.onBodyContextMenu,this);Ext.isFunction(b.onBeforeUnload)&&(a.onbeforeunload=b.onBeforeUnload.createDelegate(b))},onComponentUserupdateRecord:function(a,b,c,d){d.isRecordChangeByUser&&(a.recordComponentPlugin.isChangedByUser=d.isRecordChangeByUser);b.phantom||(a=this.getOwnerWindow(d).name,a=this.browserWindows.get(a),Ext.isEmpty(a.entryid)&&(a.entryid=b.get("entryid")))},register:function(a,b,c){var d=a.name;
"mainBrowserWindow"!=d&&(this.initComponent(d,b,c),b=this.getEntryId(c.record),Ext.isEmpty(b)||(a.entryid=b));this.browserWindows.add(d,a);this.setActive(d)},unRegister:function(a){this.browserWindows.removeKey(a);Ext.MessageBox.removeBrowserWindowMessageBox(a);this.activeBrowserWindow===a&&(this.activeBrowserWindow=void 0)},createUI:function(a){Ext.QuickTips.init();var b=a.name,c;this.browserWindowComponents.containsKey(b)?c=this.browserWindowComponents.get(b):Ext.isEmpty(this.blockedPopupsContent)||
(c=this.blockedPopupsContent.pop(),this.register(a,c.component,c.config),c=this.browserWindowComponents.get(b),this.isPopupsBlocked=!1);var d=c.component,b={plugins:["zarafa.contentlayerplugin"],confirmClose:!1},b=Ext.applyIf(b,c.config);c=new d(b);d=Ext.create({xtype:"panel",height:a.innerHeight,width:a.innerWidth,renderTo:Ext.get(a.document.body),layout:"fit",items:[c]});b.isRecordChangeByUser&&(c.recordComponentPlugin.isChangedByUser=b.isRecordChangeByUser);this.initEvents(a,c,d);(new Ext.util.DelayedTask(Zarafa.core.BrowserWindowMgr.displayBlockedPopupWarning.createDelegate(this,
[a],this))).delay(200)},getActive:function(){return this.browserWindows.get(this.activeBrowserWindow)||this.browserWindows.get("mainBrowserWindow")},setActive:function(a){this.activeBrowserWindow=a;if(Ext.QuickTips&&Ext.QuickTips.tip){var b=Ext.QuickTips.browserQuickTips.get(a);Ext.isDefined(b)&&(Ext.QuickTips.tip=b)}Ext.MessageBox.setActiveWindowMessageBox(a)},isMainWindowActive:function(){return"mainBrowserWindow"===this.activeBrowserWindow},isOwnedByMainWindow:function(a){return(a=this.getOwnerWindow(a))?
"mainBrowserWindow"===a.name:!1},getOwnerWindow:function(a){if(Ext.isDefined(a))return Ext.isFunction(a.getEl)&&(a=a.getEl()),(a=(a=(a=a.dom?a.dom:a)?a.ownerDocument:void 0)?a.defaultView:void 0)?a:this.browserWindows.get("mainBrowserWindow")},onSeparateWindowFocus:function(a){this.setActive(a)},onSeparateWindowUnload:function(a,b,c){Ext.defer(this.onWindowRefreshOrClose,50,this,[a,b,a.name]);c.destroy()},onWindowRefreshOrClose:function(a,b,c){var d=!1;b=b.record;try{if(a&&a.innerWidth){var e=this.browserWindowComponents.get(a.name).config,
f=container.getCurrentContext().getModel(),g;Ext.isDefined(e.recordComponentPluginConfig)&&Ext.isDefined(e.recordComponentPluginConfig.useShadowStore)&&(e.recordComponentPluginConfig.useShadowStore=!0);if(b.phantom)g=f.createRecord();else{var h={store_entryid:b.get("store_entryid"),parent_entryid:b.get("parent_entryid"),entryid:b.get("entryid")};g=Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Note",h,b.get("entryid"))}Ext.isDefined(e.isRecordChangeByUser)&&(e.isRecordChangeByUser=
void 0);a.onbeforeunload=void 0;e.record=g}else d=!0}catch(k){d=!0}container.getShadowStore().remove(b,!0);d&&(this.browserWindowComponents.removeKey(c),this.unRegister(c))},onSeparateWindowClose:function(a){a.close()},onSeparateWindowResize:function(a,b){(new Ext.util.DelayedTask(this.doSeparateWindowResize,this,[a,b])).delay(100)},doSeparateWindowResize:function(a,b){var c=a.innerWidth||Ext.lib.Dom.getViewWidth(),d=a.innerHeight||Ext.lib.Dom.getViewHeight();b.setSize(c,d);this.fireEvent("separatewindowresize",
a,c.height)},onBodyContextMenu:function(a,b){Ext.get(b).hasClass("zarafa-contextmenu-enabled")||a.preventDefault()},closeAllBrowserWindow:function(){Ext.each(Zarafa.core.BrowserWindowMgr.browserWindows.items,function(a){"mainBrowserWindow"!==a.name&&a.close()})},initExtCss:function(a){a=a.document.body||a.document.getElementsByTagName("body")[0];if(!a)return!1;Ext.fly(a.parentElement).addClass("x-viewport");var b=[];Ext.isIE&&(Ext.isIE10p||b.push("ext-ie"),Ext.isIE6?b.push("ext-ie6"):Ext.isIE7?b.push("ext-ie7",
"ext-ie7m"):Ext.isIE8?b.push("ext-ie8","ext-ie8m"):Ext.isIE9?b.push("ext-ie9","ext-ie9m"):Ext.isIE10&&b.push("ext-ie10"));Ext.isGecko&&(Ext.isGecko2?b.push("ext-gecko2"):b.push("ext-gecko3"));Ext.isOpera&&b.push("ext-opera");Ext.isWebKit&&b.push("ext-webkit");Ext.isSafari?b.push("ext-safari "+(Ext.isSafari2?"ext-safari2":Ext.isSafari3?"ext-safari3":"ext-safari4")):Ext.isChrome&&b.push("ext-chrome");Ext.isMac&&b.push("ext-mac");Ext.isLinux&&b.push("ext-linux");if(Ext.isStrict||Ext.isBorderBox){var c=
a.parentNode;c&&(Ext.isStrict||(Ext.fly(c,"_internal").addClass("x-quirks"),Ext.isIE9m&&!Ext.isStrict&&(Ext.isIEQuirks=!0)),Ext.fly(c,"_internal").addClass(Ext.isStrict&&Ext.isIE||!Ext.enableForcedBoxModel&&!Ext.isIE?" ext-strict":" ext-border-box"))}Ext.enableForcedBoxModel&&!Ext.isIE&&(Ext.isForcedBorderBox=!0,b.push("ext-forced-border-box"));Ext.fly(a,"_internal").addClass(b);return!0},displayBlockedPopupWarning:function(){Zarafa.core.BrowserWindowMgr.isPopupsBlocked&&(Ext.MessageBox.show({title:_("Open in new browser window"),
msg:_("Your browser seems to have blocked one or more pop-ups. Please change your browser's settings to always allow pop-ups from WebApp."),buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING}),Zarafa.core.BrowserWindowMgr.isPopupsBlocked=!1)},switchFocusToMainWindow:function(a){var b=this.getActive();Ext.isDefined(a)&&!this.isOwnedByMainWindow(a)&&(b=this.getOwnerWindow(a));b.setFocusOnMainWindow()},getOpenedWindow:function(a){return this.browserWindows.find(function(b){var c=this.getEntryId(a);return Zarafa.core.EntryId.compareEntryIds(b.entryid,
c)},this)},getEntryId:function(a){return Array.isArray(a.get("attach_num"))?a.id:a.get("entryid")}});Zarafa.core.BrowserWindowMgr=new Zarafa.core.BrowserWindowMgr;Ext.namespace("Zarafa.core");
Zarafa.core.ColorSchemes={fields:[{name:"base",weight:1}],colorSchemes:[],addField:function(a){var b;if(Array.isArray(a))for(b=0;b<a.length;b++)this.addField(a[b]);else for(this.fields.push(a),b=0;b<this.colorSchemes.length;b++)Ext.isDefined(this.colorSchemes[b][a.name])||(Ext.isDefined(a.color)?this.colorSchemes[b][a.name]=a.color:Ext.isDefined(a.weight)&&(this.colorSchemes[b][a.name]=this.createColor(this.colorSchemes[b].base,a.weight)))},hexToRgb:function(a){return{red:parseInt(a.substring(1,3),
16),green:parseInt(a.substring(3,5),16),blue:parseInt(a.substring(5,7),16)}},rgbToHex:function(a){var b=function(a){a=parseInt(a,10);if(isNaN(a))return"00";a=Math.max(0,Math.min(a,255));return"0123456789ABCDEF".charAt((a-a%16)/16)+"0123456789ABCDEF".charAt(a%16)};return"#"+b(a.red)+b(a.green)+b(a.blue)},createDarkColor:function(a,b){var c=this.hexToRgb(a);return this.rgbToHex({red:c.red*b,green:c.green*b,blue:c.blue*b})},createLightColor:function(a,b){var c=this.hexToRgb(a);return this.rgbToHex({red:255-
(255-c.red)*(255-128*b)/127,green:255-(255-c.green)*(255-128*b)/127,blue:255-(255-c.blue)*(255-128*b)/127})},createColor:function(a,b){var c=this.hexToRgb(a);return 127<Math.max(c.red,c.green,c.blue)?this.createLightColor(a,b):this.createDarkColor(a,b)},createColorScheme:function(a,b,c){if(Array.isArray(a))for(b=0;b<a.length;b++)this.createColorScheme(a[b]);else{Ext.isObject(a)&&(b=a.displayName,c=a.baseColor||a.base,a=a.name);var d={name:a,displayName:b,base:c};for(b=0;b<this.fields.length;b++)"base"!==
this.fields[b].name&&(Ext.isDefined(this.fields[b].color)?d[this.fields[b].name]=this.fields[b].color:d[this.fields[b].name]=this.createColor(c,this.fields[b].weight));Ext.isDefined(this.getColorScheme(a))||this.colorSchemes.push(d)}},addColorScheme:function(a){if(Ext.isDefined(a.name)&&Ext.isDefined(a.displayName)&&Ext.isDefined(a.base)){for(var b=0;b<this.fields.length;b++)Ext.isDefined(a[this.fields[b].name])||(Ext.isDefined(this.fields[b].color)?a[this.fields[b].name]=this.fields[b].color:a[this.fields[b].name]=
this.createColor(a.base,this.fields[b].weight));this.colorSchemes.push(a)}},addColorSchemesFromConfig:function(){var a,b=container.getServerConfig().getColorSchemes();if(b&&Array.isArray(b))for(a=0;a<b.length;a++)this.addColorScheme(b[a]);if((b=container.getServerConfig().getAdditionalColorSchemes())&&Array.isArray(b))for(a=0;a<b.length;a++)this.addColorScheme(b[a])},getColorScheme:function(a){for(var b=0;b<this.colorSchemes.length;b++)if(this.colorSchemes[b].name===a)return this.colorSchemes[b]},
getColorSchemes:function(){return this.colorSchemes},rgbToHsl:function(a,b,c){if(1===arguments.length&&"#"===a.substr(0,1)){var d=this.hexToRgb(a);a=d.red;b=d.green;c=d.blue}a/=255;b/=255;c/=255;var d=Math.max(a,b,c),e=Math.min(a,b,c),f,g=(d+e)/2;if(d===e)f=e=0;else{var h=d-e,e=.5<g?h/(2-d-e):h/(d+e);switch(d){case a:f=(b-c)/h+(b<c?6:0);break;case b:f=(c-a)/h+2;break;case c:f=(a-b)/h+4}f/=6}return[f,e,g]},getLuma:function(a,b,c){if(1===arguments.length&&"#"===a.substr(0,1)){var d=this.hexToRgb(a);
a=d.red;b=d.green;c=d.blue}return.2126*a+.7152*b+.0722*c}};Zarafa.onReady(function(){Zarafa.core.ColorSchemes.addColorSchemesFromConfig()});
Zarafa.core.Container=Ext.extend(Ext.util.Observable,{contexts:void 0,contextsMetaData:void 0,plugins:void 0,pluginsMetaData:void 0,widgetsMetaData:void 0,constructor:function(){this.addEvents("beforecontextswitch contextswitch aftercontextswitch folderselect webapploaded beforewebappreload beforelogout logout".split(" "));Zarafa.core.Container.superclass.constructor.call(this);this.plugins=[];this.pluginsMetaData=[];this.contexts=[];this.contextsMetaData=[];this.widgetsMetaData=[]},logout:function(a,
b){!1!==this.fireEvent("beforelogout")&&(this.fireEvent("logout"),this.doLogout(a,b))},doLogout:function(a,b){var c=!0===a?"&user="+this.getUser().getUserName():"";Zarafa.core.Util.disableLeaveRequester();window.location=!0!==b?"index.php?logout"+c:"index.php?load=logon"+c},getServerConfig:function(){return this.serverConfigRecord},setServerConfig:function(a){this.serverConfigRecord=new Zarafa.core.data.ServerConfig(a)},getUser:function(){return this.userRecord},setUser:function(a){this.userRecord=
new Zarafa.core.data.User(a)},getVersion:function(){return this.versionRecord},setVersion:function(a){this.versionRecord=new Zarafa.core.data.Version(a)},getLanguages:function(){return this.languages},setLanguages:function(a){this.languages=a},getCurrentContext:function(){return this.currentContext||this.getContextByName("default")},getRequest:function(){return this.request||(this.request=new Zarafa.core.Request({url:"kopano.php"}))},getResponseRouter:function(){return this.responseRouter||(this.responseRouter=
new Zarafa.core.ResponseRouter)},getNotificationResolver:function(){return this.notificationResolver||(this.notificationResolver=new Zarafa.core.data.NotificationResolver)},getHierarchyStore:function(){return this.hierarchyStore||(this.hierarchyStore=new Zarafa.hierarchy.data.HierarchyStore)},getSettingsModel:function(){return this.settingsModel||(this.settingsModel=new Zarafa.settings.SettingsModel)},getPersistentSettingsModel:function(){return this.persistentSettingsModel||(this.persistentSettingsModel=
new Zarafa.settings.PersistentSettingsModel)},getShadowStore:function(){return this.shadowStore||(this.shadowStore=new Zarafa.core.data.ShadowStore)},getNotifier:function(){return this.notifier||(this.notifier=new Zarafa.core.ui.notifier.Notifier)},getMainPanel:function(){return this.mainPanel||(this.mainPanel=new Zarafa.core.ui.MainViewport)},getMainToolbar:function(){return this.getMainPanel().mainToolbar},getWelcomePanel:function(){return this.welcomePanel||(this.welcomePanel=new Zarafa.core.ui.WelcomeViewport)},
getTabPanel:function(){return this.getMainPanel().getContentPanel()},getContentPanel:function(){return this.getTabPanel().get(0).getActiveItem()},getNavigationBar:function(){return this.getMainPanel().getNavigationPanel()},getWidgetSideBar:function(){return this.getMainPanel().getWidgetPanel()},getPlugins:function(){return this.plugins},getPluginsMetaData:function(){return this.pluginsMetaData},getContexts:function(){return this.contexts},getContextsMetaData:function(){return this.contextsMetaData},
getWidgetsMetaData:function(){return this.widgetsMetaData},getContextByName:function(a){for(var b=this.getContexts(),c=0,d=b.length;c<d;c++)if(b[c].getName()===a)return b[c]},getContextMetaDataByName:function(a){for(var b=this.getContextsMetaData(),c=0,d=b.length;c<d;c++)if(b[c].getName()===a)return b[c]},getPluginByName:function(a){for(var b=this.getPlugins(),c=0,d=b.length;c<d;c++)if(b[c].getName()===a)return b[c]},getPluginMetaDataByName:function(a){for(var b=this.getPluginsMetaData(),c=0,d=b.length;c<
d;c++)if(b[c].getName()===a)return b[c]},getWidgetMetaDataByName:function(a){for(var b=this.getWidgetsMetaData(),c=0,d=b.length;c<d;c++)if(b[c].getName()===a)return b[c]},populateInsertionPoint:function(a){for(var b=this.getPlugins(),c=[],d=Ext.toArray(arguments),e=0,f=b.length;e<f;e++){var g=b[e],h=g.getComponents.apply(g,d);Ext.each(h,function(a){a.plugin=g;c.push(a)})}return Ext.flatten(c)},registerContext:function(a){this.getContextsMetaData().push(a);a.isEnabled()&&this.getContexts().push(a.getInstance());
this.registerPlugin(a)},registerPlugin:function(a){0<=this.getServerConfig().getAlwaysEnabledPluginsList().split(";").indexOf(a.name)&&(a.allowUserDisable=!1,a.enable=!0);this.getPluginsMetaData().push(a);a.isEnabled()&&this.getPlugins().push(a.getInstance())},registerWidget:function(a){this.getWidgetsMetaData().push(a)},switchContext:function(a,b,c){var d=this.getCurrentContext();if(d!==a&&!1!==this.fireEvent("beforecontextswitch",b,d,a)){if(d){d.disable();var e=d.getModel();e&&e.un("folderchange",
this.onContextFolderChange,this)}a.enable(b,c);if(c=a.getModel())c.on("folderchange",this.onContextFolderChange,this);this.currentContext=a;this.fireEvent("folderselect",b);this.fireEvent("contextswitch",b,d,a);this.fireEvent("aftercontextswitch",b,d,a)}},getContextByFolder:function(a){var b,c,d=this.getContexts();if(d)for(var e=0,f=d.length;e<f;e++){var g=d[e],h=g.bid(a);if(void 0===c||h>c)c=h,b=g}return b},selectFolder:function(a){var b=this.getContextByFolder(a);this.getCurrentContext()!==b?this.switchContext(b,
a):(b=b.getModel())&&b.setFolders(a)},reloadContext:function(a){var b=this.getCurrentContext(),c=b.getModel();Ext.isDefined(c)&&(a=c.getFolder(a.get("entryid")),Ext.isDefined(a)&&(a=c.getFolders(),b.disable(),b.enable(a)))},onContextFolderChange:function(a,b){this.fireEvent("folderselect",b)},getSharedComponent:function(a,b){var c,d,e=container.getPlugins(),f;if(a){for(var g=0,h=e.length;g<h;g++){var k=e[g],l=k.bidSharedComponent(a,b);if(void 0===d||l>d)d=l,c=k}c&&0<=d&&(f=c.getSharedComponent(a,
b))}return f},getReminderStore:function(){return this.reminderStore||(this.reminderStore=new Zarafa.common.reminder.data.ReminderStore)},getBaseURL:function(){var a=window.location,a=a.protocol+"//"+a.host+a.pathname;-1===a.indexOf("index.php")&&(a+="index.php");return a},getBasePath:function(){var a=container.getBaseURL();return a.substring(0,a.lastIndexOf("index.php"))}});Ext.namespace("Zarafa.core");
Zarafa.core.DateRange=Ext.extend(Ext.util.Observable,{startDate:null,dueDate:null,allowBlank:!1,constructor:function(a){a=a||{};Ext.applyIf(a,{allowBlank:this.allowBlank});a.allowBlank?Ext.applyIf(a,{startDate:null,dueDate:a.startDate?a.startDate.clone():null}):Ext.applyIf(a,{startDate:new Date,dueDate:a.startDate?a.startDate.clone():new Date});Ext.apply(this,a);if(Ext.isDate(this.startDate)&&Ext.isDate(this.dueDate)&&this.getStartTime()>this.getDueTime())throw"Invalid date range, start date is after due date";
this.addEvents("update");Zarafa.core.DateRange.superclass.constructor.call(this)},getStartDate:function(){return this.startDate},getDueDate:function(){return this.dueDate},setStartDate:function(a,b,c){var d=null;a=Ext.isDate(a)?a:null;if(!this.allowBlank&&!Ext.isDate(a))throw"Cannot set DateRange start to undefined";if(Ext.isDate(this.dueDate)&&Ext.isDate(a)&&a.getTime()>this.getDueTime()&&!b)throw"Cannot set DateRange start date to after its due date";(c=c||Ext.isDate(this.startDate)&&Ext.isDate(a)&&
this.getStartTime()==a.getTime())||(d=this.clone());this.startDate=a;c||this.fireEvent("update",this,d);return this},setDueDate:function(a,b,c){var d=null;a=Ext.isDate(a)?a:null;if(!this.allowBlank&&!Ext.isDate(a))throw"Cannot set DateRange due date to undefined";if(Ext.isDate(this.startDate)&&Ext.isDate(a)&&a.getTime()<this.getStartTime()&&!b)throw"Cannot set DateRange due date to before its start date";(c=c||Ext.isDate(this.dueDate)&&Ext.isDate(a)&&this.getDueTime()==a.getTime())||(d=this.clone());
this.dueDate=a;c||this.fireEvent("update",this,d);return this},set:function(a,b,c,d){var e=null;a=Ext.isDate(a)?a:null;b=Ext.isDate(b)?b:null;if(!this.allowBlank&&!Ext.isDate(a))throw"Cannot set DateRange start to undefined";if(!this.allowBlank&&!Ext.isDate(b))throw"Cannot set DateRange due date to undefined";if(Ext.isDate(a)&&Ext.isDate(b)&&a.getTime()>b.getTime()&&!c)throw"Invalid date range, start date is after due date";(d=d||Ext.isDate(a)&&Ext.isDate(b)&&a.getTime()==this.getStartTime()&&b.getTime()==
this.getDueTime())||(e=this.clone());this.setStartDate(a,!0,!0);this.setDueDate(b,!0,!0);d||this.fireEvent("update",this,e);return this},getStartTime:function(){return Ext.isDate(this.startDate)&&this.startDate.getTime()||this.startDate},getDueTime:function(){return Ext.isDate(this.dueDate)&&this.dueDate.getTime()||this.dueDate},setStartTime:function(a,b,c){var d=null;if(!this.allowBlank&&!a)throw"Cannot set DateRange start to undefined";if(Ext.isDate(this.dueDate)&&a>this.dueDate.getTime()&&!b)throw"Cannot set DateRange start date to after its due date";
(c=c||this.getStartTime()==a)||(d=this.clone());Ext.isEmpty(a)?this.startDate=null:this.startDate=new Date(a);c||this.fireEvent("update",this,d);return this},setDueTime:function(a,b,c){var d=null;if(!this.allowBlank&&!a)throw"Cannot set DateRange due date to undefined";if(Ext.isDate(this.startDate)&&a<this.startDate.getTime()&&!b)throw"Cannot set DateRange due date to before its start date";(c=c||this.getDueTime()==a)||(d=this.clone());Ext.isEmpty(a)?this.dueDate=null:this.dueDate=new Date(a);c||
this.fireEvent("update",this,d);return this},setTime:function(a,b,c,d){var e=null;if(!a||!b){if(!this.allowBlank&&!a)throw"Cannot set DateRange start to undefined";if(!this.allowBlank&&!b)throw"Cannot set DateRange due date to undefined";}else if(a>b&&!c)throw"Invalid date range, start date is after due date";(d=d||a==this.getStartTime()&&b==this.getDueTime())||(e=this.clone());this.setStartTime(a,!0,!0);this.setDueTime(b,!0,!0);d||this.fireEvent("update",this,e);return this},getDuration:function(a){return Ext.isDate(this.dueDate)&&
Ext.isDate(this.startDate)?Date.diff(a||Date.MILLI,this.dueDate,this.startDate):0},setDuration:function(a,b){var c=null;if(!Ext.isDate(this.startDate))throw"Cannot set duration when start date is not specified";(b=b||this.getDuration()==a)||(c=this.clone());this.dueDate=new Date(this.getStartTime()+a);b||this.fireEvent("update",this,c);return this},getNumDays:function(){var a=this.getDuration(Date.DAY);return Ext.isDefined(a)?Math.round(a):0},expand:function(a){var b=this.clone();Ext.isDate(this.startDate)&&
(this.startDate=new Date(this.getStartTime()-this.getStartTime()%a));Ext.isDate(this.dueDate)&&(this.dueDate=new Date(this.getDueTime()+a-this.getDueTime()%a));(Ext.isDate(this.startDate)||Ext.isDate(this.dueDate))&&this.fireEvent("update",this,b);return this},clone:function(){return new Zarafa.core.DateRange({startDate:Ext.isDate(this.startDate)?new Date(this.getStartTime()):void 0,dueDate:Ext.isDate(this.dueDate)?new Date(this.getDueTime()):void 0,allowBlank:this.allowBlank})},equals:function(a){return a&&
this.getStartTime()===a.getStartTime()&&this.getDueTime()===a.getDueTime()?!0:!1},compare:function(a){var b=this.getStartTime()||0,c=a.getStartTime()||0;if(b!==c)return b>c?1:-1;b=this.getDueTime()||0;a=a.getDueTime()||0;return b!==a?b>a?1:-1:0},isAllDay:function(){return Ext.isDate(this.startDate)&&Ext.isDate(this.dueDate)&&!this.isZeroMinuteRange()?this.startDate.clearTime(!0).getTime()===this.getStartTime()&&this.dueDate.clearTime(!0).getTime()===this.getDueTime():!1},isZeroMinuteRange:function(){return this.dueDate.getTime()===
this.startDate.getTime()},overlaps:function(a){var b=this.getStartTime(),c=this.getDueTime(),d=a.getStartTime();a=a.getDueTime();return b>=d&&b<a||d>=b&&d<c},inside:function(a){return this.getStartTime()&&a.getStartTime()&&this.getDueTime()&&a.getDueTime()?this.getStartTime()>=a.getStartTime()&&this.getDueTime()<=a.getDueTime():!1},containsDate:function(a){return this.getStartTime()<=a.getTime()&&this.getDueTime()>a.getTime()},format:function(){var a=this.startDate,b=this.dueDate;if(!Ext.isDate(a)||
!Ext.isDate(b))return"";b.getTime()===b.clearTime(!0).getTime()&&(b=b.clone(),b.setHours(12),b=b.add(Date.DAY,-1),b.getTime()<a.getTime()&&(b=a));return a.getYear()!=b.getYear()?String.format("{0} - {1}",a.format(_("jS F Y")),b.format(_("jS F Y"))):a.getMonth()!=b.getMonth()?String.format("{0} - {1} {2}",a.format(_("jS F")),b.format(_("jS F")),a.format(_("Y"))):a.getDate()!=b.getDate()?String.format("{0} - {1} {2}",a.format(_("jS")),b.format(_("jS")),a.format(_("F Y"))):a.format(_("jS F Y"))}});Ext.namespace("Zarafa.core");
Zarafa.core.EntryId=function(){var a=Ext.extend(Object,{entryId:"",length:0,constructor:function(a){a&&(this.entryId=a.toUpperCase(),this.length=a.length,this.decomposeEntryId(this.entryId))},getPadding:function(a){for(var b="",c=0,d=4;0<d;d--)if("00"===a.substring(a.length-(c+2),a.length-c))b+="00",c+=2;else break;return b}}),b=Ext.extend(a,{abFlags:"",guid:"",version:"",type:"",uniqueId:"",server:"",padding:"",MIN_LENGTH:88,name:"EID",decomposeEntryId:function(a){var b=0;this.padding=this.getPadding(a);
a=a.substring(0,a.length-this.padding.length);this.abFlags=a.substr(b,8);b=8;this.guid=a.substr(b,32);b+=32;this.version=a.substr(b,8);b+=8;this.type=a.substr(b,8);b+=8;this.uniqueId=a.substr(b,32);this.server=a.substr(b+32)}}),c=Ext.extend(a,{abFlags:"",guid:"",version:"",type:"",id:"",server:"",padding:"",MIN_LENGTH:64,name:"EID_V0",decomposeEntryId:function(a){var b=0;this.padding=this.getPadding(a);a=a.substring(0,a.length-this.padding.length);this.abFlags=a.substr(b,8);b=8;this.guid=a.substr(b,
32);b+=32;this.version=a.substr(b,8);b+=8;this.type=a.substr(b,8);b+=8;this.id=a.substr(b,8);this.server=a.substr(b+8)}}),d=Ext.extend(a,{flags:"",providerUID:"",version:"",type:"",DLLFileName:"",terminationChar:"",unWrappedEntryId:"",name:"WrappedSEID",decomposeEntryId:function(a){var b=0;this.flags=a.substr(b,8);b+=8;this.providerUID=a.substr(b,32);b+=32;this.version=a.substr(b,2);b+=2;this.type=a.substr(b,2);var b=b+2,c=a.slice(b).indexOf("00");this.DLLFileName=a.substr(b,c);b+=c;this.terminationChar=
a.substr(b,2);this.unWrappedEntryId=a.substr(b+2);this.unWrappedEntryId=Zarafa.core.EntryId.createEntryIdObj(this.unWrappedEntryId)}}),e=Ext.extend(a,{abFlags:"",guid:"",version:"",type:"",id:"",extid:"",padding:"",MIN_LENGTH:64,name:"ABEID",decomposeEntryId:function(a){var b=0;this.padding=this.getPadding(a);a=a.substring(0,a.length-this.padding.length);this.abFlags=a.substr(b,8);b=8;this.guid=a.substr(b,32);b+=32;this.version=a.substr(b,8);b+=8;this.type=a.substr(b,8);b+=8;this.id=a.substr(b,8);
this.extid=a.substr(b+8)}}),f=Ext.extend(a,{ulVersion:"",muid:"",ulObjType:"",ulOffset:"",unWrappedEntryId:"",name:"WrappedABEID",decomposeEntryId:function(a){var b=0;this.ulVersion=a.substr(b,8);b+=8;this.muid=a.substr(b,32);b+=32;this.ulObjType=a.substr(b,8);b+=8;this.ulOffset=a.substr(b,8);this.unWrappedEntryId=a.substr(b+8);this.unWrappedEntryId=Zarafa.core.EntryId.createEntryIdObj(this.unWrappedEntryId)}});f.wrapABEID=function(a,b){b=b.toString(16);b=b.padStart(2,"0");b=b.padEnd(8,"0");return"00000000727F0430E3924FDAB86AE52A7FE46571"+
b+"00000000"+a};f.unwrapABEID=function(a){return a.substring(56)};return{createABEntryIdObj:function(a){return new e(a)},compareABEntryIds:function(a,b){if(!Ext.isString(a)||!Ext.isString(b))return!1;if(a===b)return!0;var c=Zarafa.core.EntryId.createABEntryIdObj(a),d=Zarafa.core.EntryId.createABEntryIdObj(b);return c.length!==d.length||c.abFlags!==d.abFlags||c.version!==d.version||c.type!==d.type||c.length<c.MIN_LENGTH||c.extid!==d.extid?!1:!0},createEntryIdObj:function(a){return"00000000"===a.substr(40,
8)?new c(a):new b(a)},compareEntryIds:function(a,b){if(!Ext.isString(a)||!Ext.isString(b))return!1;if(a===b)return!0;var c=Zarafa.core.EntryId.createEntryIdObj(a),d=Zarafa.core.EntryId.createEntryIdObj(b);if(c.length!==d.length||c.abFlags!==d.abFlags||c.version!==d.version||c.type!==d.type)return!1;if("EID_V0"===c.name){if(c.length<c.MIN_LENGTH||c.id!==d.id)return!1}else if(c.length<c.MIN_LENGTH||c.uniqueId!==d.uniqueId)return!1;return!0},createStoreEntryIdObj:function(a){return new d(a)},compareStoreEntryIds:function(a,
b){if(!Ext.isString(a)||!Ext.isString(b))return!1;if(a===b)return!0;var c=Zarafa.core.EntryId.createStoreEntryIdObj(a),d=Zarafa.core.EntryId.createStoreEntryIdObj(b),c=c.unWrappedEntryId,d=d.unWrappedEntryId;if(c===d)return!0;if(c.length<c.MIN_LENGTH||d.length<d.MIN_LENGTH||c.guid!==d.guid||c.version!==d.version||c.type!==d.type)return!1;if("EID_V0"===c.name){if(c.length<c.MIN_LENGTH||c.id!==d.id)return!1}else if(c.length<c.MIN_LENGTH||c.uniqueId!==d.uniqueId)return!1;return!0},unwrapContactProviderEntryId:function(a){return f.unwrapABEID(a)},
wrapContactProviderEntryId:function(a,b){return f.wrapABEID(a,b)},createOneOffEntryId:function(a,b,c){return"00000000812B1FA4BEA310199D6E00DD010F540200000080"+Zarafa.core.Util.encode_utf16(a)+"0000"+Zarafa.core.Util.encode_utf16(b)+"0000"+Zarafa.core.Util.encode_utf16(c)+"0000"},isFavoriteFolder:function(a){return"01"===Zarafa.core.EntryId.createEntryIdObj(a).abFlags.substr(6,8)},isOneOffEntryId:function(a){return"812B1FA4BEA310199D6E00DD010F5402"===Zarafa.core.EntryId.createEntryIdObj(a).guid},isFavoriteRootFolder:function(a){return"00000000000000000000000000000002"===
Zarafa.core.EntryId.createEntryIdObj(a).uniqueId},isPublicRootFolder:function(a){return"00000000000000000000000000000003"===Zarafa.core.EntryId.createEntryIdObj(a).uniqueId},isPublicSubtreeFolder:function(a){return"00000000000000000000000000000001"===Zarafa.core.EntryId.createEntryIdObj(a).uniqueId},hasContactProviderGUID:function(a){return"727F0430E3924FDAB86AE52A7FE46571"===Zarafa.core.EntryId.createEntryIdObj(a).guid},hasAddressBookGUID:function(a){return"AC21A95040D3EE48B319FBA753304425"===Zarafa.core.EntryId.createABEntryIdObj(a).guid},
isGlobalAddressbookContainer:function(a){if(!1===Zarafa.core.EntryId.hasAddressBookGUID(a))return!1;a=Zarafa.core.EntryId.createABEntryIdObj(a);return"04000000"===a.type&&"01000000"===a.id}}}();Ext.namespace("Zarafa.core");
Zarafa.core.Enum=Ext.extend(Object,{get:function(a){a=parseInt(a,10);for(var b in this)if(this[b]==a)return this[b]},getName:function(a){a=parseInt(a,10);for(var b in this)if(this[b]==a)return b},getValue:function(a){a=this[a];if(Ext.isNumber(a))return a},addProperty:function(a){var b=0,c;for(c in this)if("number"==typeof this[c]){if(c==a)return this[c];b<this[c]&&(b=this[c])}b++;return this[a]=b}});Zarafa.core.Enum.create=function(a){return new (Ext.extend(Zarafa.core.Enum,a))};Ext.namespace("Zarafa.core");
Zarafa.core.Events={listeners:{},registerListener:function(a,b,c){(b=Zarafa.core.Events.listeners[a.id])?b.push(c):Zarafa.core.Events.listeners[a.id]=[c]},unregisterListener:function(a,b){var c=Zarafa.core.Events.listeners[a.id];if(c)for(var d=0,e=c.length;d<e;d++)c[d].el===b&&(c.splice(d,1),0===c.length&&delete Zarafa.core.Events.listeners[a.id])},getListener:function(a,b){var c=Zarafa.core.Events.listeners[a.id];if(c)for(var d=0,e=c.length;d<e;d++){var f=c[d];if(f.el===b)return f}},addPasteEventHandler:function(a,
b,c,d,e){var f=Zarafa.core.Events.getListener(a,b);if(!Ext.isDefined(f)){var g=!Ext.isFunction(b.on),f=new Ext.util.Observable;f.field=a;f.el=b;f.hasFocus=a.hasFocus;f.originalValue=a.getValue();f.addEvents("paste");g?b.addEventListener("paste",this.onPaste.createDelegate(f)):a.mon(b,"paste",this.onPaste,f);g?b.addEventListener("mouseover",this.onPasteMouseOver.createDelegate(f)):a.mon(b,"mouseover",this.onPasteMouseOver,f);a.on("blur",this.onPasteBlur,f);Zarafa.core.Events.registerListener(a,b,f)}f.addListener("paste",
c,d,e)},removePasteEventHandler:function(a,b,c,d){var e=Zarafa.core.Events.getListener(a,b);Ext.isDefined(e)&&(e.removeListener("paste",c,d),e.hasListener("paste")||Zarafa.core.Events.unregisterListener(a,b))},onPasteKeyUp:function(a,b){!0===a.ctrlKey&&a.keyCode===Ext.EventObject.V&&this.fireEvent("paste")},onPaste:function(){Zarafa.core.Events.onPastePoll.call(this,this.field,this.field.getValue(),5)},onPastePoll:function(a,b,c){0!==c&&(a.getValue()===b?Zarafa.core.Events.onPastePoll.defer(1,this,
[a,b,--c]):(this.fireEvent("paste"),this.originalValue=this.field.getValue()))},onPasteMouseOver:function(){!1===this.hasFocus&&(this.originalValue!==this.field.getValue()&&(this.field.focus(),this.fireEvent("paste"),this.originalValue=this.field.getValue()),this.hasFocus=!0)},onPasteBlur:function(){this.hasFocus=!1;this.originalValue=this.field.getValue()}};Ext.namespace("Zarafa.core");
Zarafa.core.HTMLParser=function(){var a=/<style[^>]*>[\s\S]*?<\/style[^>]*>/gim,b=/<script[^>]*>[\s\S]*?<\/script[^>]*>/gim,c=/<br\s*?\/*?>/gim,d=/\r\n|\n|\r/gim,e=/(src\s*=\s*[\"\']?)cid:([^ \"\']*)([\"\']?)/igm,f=/(src\s*=\s*[\"\']?)\S*attachCid=([^ &\"\']*)[^ \"\']*([\"\']?)/igm;return{stripStyles:function(b){return b?String(b).replace(a,""):b},stripScripts:function(a){return a?String(a).replace(b,""):a},br2nl:function(a){return Ext.isEmpty(a)?"":a.replace(c,"\n")},nl2br:function(a){return Ext.isEmpty(a)?
"":a.replace(d,"<br>")},rlnl2nl:function(a){return Ext.isEmpty(a)?"":a.replace(/\r\n|\r/gim,"\n")},convertPlainToHTML:function(a){if(Ext.isEmpty(a))return a;a=Zarafa.core.HTMLParser.entityEncode(a,"ENT_NOQUOTES");return a=Zarafa.core.HTMLParser.nl2br('<div><pre wrap style="white-space: pre-wrap; word-wrap: break-word;">'+a+"</pre></div>")},convertHTMLToPlain:function(a){if(Ext.isEmpty(a))return a;a=a.replace(/<[\/]?(?:select)[^>]*>/gim,"\n");a=a.replace(/<[\/]?(?:option)[^>]*>/gim,"\t");a=a.replace(/<(?:hr)[^>]*>/gim,
"\n-----------\n");a=a.replace(/<[\/]?(?:h[123456]|div|p|pre|title)[^>]*>/gim,"\n\n");a=a.replace(/<[\/]?(?:ul|ol|dl|dt|textarea|img)[^>]*>/gim,"\n");a=a.replace(/<[\/]?(?:dd|li)[^>]*>/gim,"\t");a=a.replace(/<[\/]?(?:table)[^>]*>/gim,"\n\n");a=a.replace(/<[\/]?(?:caption|tr)[^>]*>/gim,"\n");a=a.replace(/<[^\/]?(?:th|td)[^>]*>/gim,"<br />");a=a.replace(/<a[^>]* href=[\'\"]?([^\s\'\">]*)[^>]*>([\s\S]*?)<\/a[^>]*>/gim,"$2 &lt;$1&gt;");a=Zarafa.core.HTMLParser.stripStyles(a);a=Zarafa.core.HTMLParser.stripScripts(a);
a=a.replace(/\x3c!--[\s\S]*?--\x3e/gim,"");a=Zarafa.core.HTMLParser.stripUnwantedTags(a,["br"]);a=Zarafa.core.HTMLParser.entityDecode(a);a=a.replace(/^\s*$/gm,"");a=a.replace(/(.*[^<>\n]$)/gm,"$1<br />");a=a.replace(/\n/gm,"");a=Zarafa.core.HTMLParser.br2nl(a);a=a.replace(/[&][#0-9a-z]*[;]/gim,"");return a=a.replace(/\n(?!\n)$/gm,"")},stripUnwantedTags:function(a,b){var c=a.match(/(<\/?[^>]+>)/gi),d,e,f,g;b||(b=[]);if(c&&0<c.length)for(var h=0,q=c.length;h<q;h++){d=c[h].toString();g=!1;for(var t=
0,u=b.length;t<u;t++)if(e=b[t].toLowerCase(),f=-1,0!==f&&(f=d.toLowerCase().indexOf("<"+e+">")),0!==f&&(f=d.toLowerCase().indexOf("<"+e+" ")),0!==f&&(f=d.toLowerCase().indexOf("</"+e)),0===f){g=!0;break}!0!==g&&(a=a.split(d).join(""))}return a},hasExternalContent:function(a){return Ext.isEmpty(a)?!1:-1!==a.search(/(src|background)\s*=\s*([\'\"])*?\s*(https*:[^ \'\"]*)([\'\"])*/igm)||-1!==a.search(/(style)\s*=(\S*)(url)\(([\'\"]*?)\s*(https*:.*[^\'\"])([\'\"]*?)\)/igm)?!0:!1},blockExternalContent:function(a){if(Ext.isEmpty(a)||
!Zarafa.core.HTMLParser.hasExternalContent(a))return a;a=a.replace(/(src|background)\s*=\s*([\'\"])*?\s*(https*:[^ \'\"]*)\s*([\'\"])*/igm,"$1=$2$4");return a=a.replace(/(style)\s*=(\S*)(url)\(([\'\"]*?)\s*(https*:.*[^\'\"])([\'\"]*?)\)/igm,"$1=$2$3($4$6)")},getHTMLTranslationTable:function(a,b){a||(a="HTML_SPECIALCHARS");b||(b="ENT_COMPAT");var c={38:"&amp;"};"HTML_ENTITIES"===a&&(c["94"]="&circ;",c["126"]="&tilde;",c["130"]="&sbquo;",c["131"]="&fnof;",c["132"]="&bdquo;",c["133"]="&hellip;",c["134"]=
"&dagger;",c["135"]="&Dagger;",c["136"]="&circ;",c["137"]="&permil;",c["138"]="&Scaron;",c["139"]="&lsaquo;",c["140"]="&OElig;",c["145"]="&lsquo;",c["146"]="&rsquo;",c["147"]="&ldquo;",c["148"]="&rdquo;",c["149"]="&bull;",c["150"]="&ndash;",c["151"]="&mdash;",c["152"]="&tilde;",c["153"]="&trade;",c["154"]="&scaron;",c["155"]="&rsaquo;",c["156"]="&oelig;",c["159"]="&Yuml;",c["160"]="&nbsp;",c["161"]="&iexcl;",c["162"]="&cent;",c["163"]="&pound;",c["164"]="&curren;",c["165"]="&yen;",c["166"]="&brvbar;",
c["167"]="&sect;",c["168"]="&uml;",c["169"]="&copy;",c["170"]="&ordf;",c["171"]="&laquo;",c["172"]="&not;",c["173"]="&shy;",c["174"]="&reg;",c["175"]="&macr;",c["176"]="&deg;",c["177"]="&plusmn;",c["178"]="&sup2;",c["179"]="&sup3;",c["180"]="&acute;",c["181"]="&micro;",c["182"]="&para;",c["183"]="&middot;",c["184"]="&cedil;",c["185"]="&sup1;",c["186"]="&ordm;",c["187"]="&raquo;",c["188"]="&frac14;",c["189"]="&frac12;",c["190"]="&frac34;",c["191"]="&iquest;",c["192"]="&Agrave;",c["193"]="&Aacute;",
c["194"]="&Acirc;",c["195"]="&Atilde;",c["196"]="&Auml;",c["197"]="&Aring;",c["198"]="&AElig;",c["199"]="&Ccedil;",c["200"]="&Egrave;",c["201"]="&Eacute;",c["202"]="&Ecirc;",c["203"]="&Euml;",c["204"]="&Igrave;",c["205"]="&Iacute;",c["206"]="&Icirc;",c["207"]="&Iuml;",c["208"]="&ETH;",c["209"]="&Ntilde;",c["210"]="&Ograve;",c["211"]="&Oacute;",c["212"]="&Ocirc;",c["213"]="&Otilde;",c["214"]="&Ouml;",c["215"]="&times;",c["216"]="&Oslash;",c["217"]="&Ugrave;",c["218"]="&Uacute;",c["219"]="&Ucirc;",
c["220"]="&Uuml;",c["221"]="&Yacute;",c["222"]="&THORN;",c["223"]="&szlig;",c["224"]="&agrave;",c["225"]="&aacute;",c["226"]="&acirc;",c["227"]="&atilde;",c["228"]="&auml;",c["229"]="&aring;",c["230"]="&aelig;",c["231"]="&ccedil;",c["232"]="&egrave;",c["233"]="&eacute;",c["234"]="&ecirc;",c["235"]="&euml;",c["236"]="&igrave;",c["237"]="&iacute;",c["238"]="&icirc;",c["239"]="&iuml;",c["240"]="&eth;",c["241"]="&ntilde;",c["242"]="&ograve;",c["243"]="&oacute;",c["244"]="&ocirc;",c["245"]="&otilde;",
c["246"]="&ouml;",c["247"]="&divide;",c["248"]="&oslash;",c["249"]="&ugrave;",c["250"]="&uacute;",c["251"]="&ucirc;",c["252"]="&uuml;",c["253"]="&yacute;",c["254"]="&thorn;",c["255"]="&yuml;",c["264"]="&#264;",c["265"]="&#265;",c["338"]="&OElig;",c["339"]="&oelig;",c["352"]="&Scaron;",c["353"]="&scaron;",c["372"]="&#372;",c["373"]="&#373;",c["374"]="&#374;",c["375"]="&#375;",c["376"]="&Yuml;",c["402"]="&fnof;",c["710"]="&circ;",c["732"]="&tilde;",c["913"]="&Alpha;",c["914"]="&Beta;",c["915"]="&Gamma;",
c["916"]="&Delta;",c["917"]="&Epsilon;",c["918"]="&Zeta;",c["919"]="&Eta;",c["920"]="&Theta;",c["921"]="&Iota;",c["922"]="&Kappa;",c["923"]="&Lambda;",c["924"]="&Mu;",c["925"]="&Nu;",c["926"]="&Xi;",c["927"]="&Omicron;",c["928"]="&Pi;",c["929"]="&Rho;",c["931"]="&Sigma;",c["932"]="&Tau;",c["933"]="&Upsilon;",c["934"]="&Phi;",c["935"]="&Chi;",c["936"]="&Psi;",c["937"]="&Omega;",c["945"]="&alpha;",c["946"]="&beta;",c["947"]="&gamma;",c["948"]="&delta;",c["949"]="&epsilon;",c["950"]="&zeta;",c["951"]=
"&eta;",c["952"]="&theta;",c["953"]="&iota;",c["954"]="&kappa;",c["955"]="&lambda;",c["956"]="&mu;",c["957"]="&nu;",c["958"]="&xi;",c["959"]="&omicron;",c["960"]="&pi;",c["961"]="&rho;",c["962"]="&sigmaf;",c["963"]="&sigma;",c["964"]="&tau;",c["965"]="&upsilon;",c["966"]="&phi;",c["967"]="&chi;",c["968"]="&psi;",c["969"]="&omega;",c["977"]="&thetasym;",c["978"]="&upsih;",c["982"]="&piv;",c["8194"]="&ensp;",c["8195"]="&emsp;",c["8201"]="&thinsp;",c["8204"]="&zwnj;",c["8205"]="&zwj;",c["8206"]="&lrm;",
c["8207"]="&rlm;",c["8211"]="&ndash;",c["8212"]="&mdash;",c["8216"]="&lsquo;",c["8217"]="&rsquo;",c["8218"]="&sbquo;",c["8220"]="&ldquo;",c["8221"]="&rdquo;",c["8222"]="&bdquo;",c["8224"]="&dagger;",c["8225"]="&Dagger;",c["8226"]="&bull;",c["8230"]="&hellip;",c["8240"]="&permil;",c["8242"]="&prime;",c["8243"]="&Prime;",c["8249"]="&lsaquo;",c["8250"]="&rsaquo;",c["8254"]="&oline;",c["8260"]="&frasl;",c["8364"]="&euro;",c["8472"]="&weierp;",c["8465"]="&image;",c["8476"]="&real;",c["8482"]="&trade;",
c["8501"]="&alefsym;",c["8592"]="&larr;",c["8593"]="&uarr;",c["8594"]="&rarr;",c["8595"]="&darr;",c["8596"]="&harr;",c["8629"]="&crarr;",c["8656"]="&lArr;",c["8657"]="&uArr;",c["8658"]="&rArr;",c["8659"]="&dArr;",c["8660"]="&hArr;",c["8704"]="&forall;",c["8706"]="&part;",c["8707"]="&exist;",c["8709"]="&empty;",c["8711"]="&nabla;",c["8712"]="&isin;",c["8713"]="&notin;",c["8715"]="&ni;",c["8719"]="&prod;",c["8721"]="&sum;",c["8722"]="&minus;",c["8727"]="&lowast;",c["8729"]="&#8729;",c["8730"]="&radic;",
c["8733"]="&prop;",c["8734"]="&infin;",c["8736"]="&ang;",c["8743"]="&and;",c["8744"]="&or;",c["8745"]="&cap;",c["8746"]="&cup;",c["8747"]="&int;",c["8756"]="&there4;",c["8764"]="&sim;",c["8773"]="&cong;",c["8776"]="&asymp;",c["8800"]="&ne;",c["8801"]="&equiv;",c["8804"]="&le;",c["8805"]="&ge;",c["8834"]="&sub;",c["8835"]="&sup;",c["8836"]="&nsub;",c["8838"]="&sube;",c["8839"]="&supe;",c["8853"]="&oplus;",c["8855"]="&otimes;",c["8869"]="&perp;",c["8901"]="&sdot;",c["8968"]="&lceil;",c["8969"]="&rceil;",
c["8970"]="&lfloor;",c["8971"]="&rfloor;",c["9001"]="&lang;",c["9002"]="&rang;",c["9642"]="&#9642;",c["9643"]="&#9643;",c["9674"]="&loz;",c["9702"]="&#9702;",c["9824"]="&spades;",c["9827"]="&clubs;",c["9829"]="&hearts;",c["9830"]="&diams;");"ENT_NOQUOTES"!==b&&(c["34"]="&quot;");"ENT_QUOTES"===b&&(c["39"]="&#39;");c["60"]="&lt;";c["62"]="&gt;";var d,e={};for(d in c)e[String.fromCharCode(d)]=c[d];return e},entityDecode:function(a,b){var c=Zarafa.core.HTMLParser.getHTMLTranslationTable("HTML_ENTITIES",
b),d="",e;for(d in c)e=c[d],a=a.split(e).join(d);return a=a.split("&#039;").join("'")},entityEncode:function(a,b){var c=Zarafa.core.HTMLParser.getHTMLTranslationTable("HTML_ENTITIES",b),d="",e;for(d in c)e=c[d],a=a.split(d).join(e);return a=a.split("'").join("&#039;")},inlineImgOutlookToZarafa:function(a,b,c,d){return a.replace(e,function(a,e,f,g,h,k){if(f){a=container.getBaseURL();a=Ext.urlAppend(a,"load=download_attachment");a=Ext.urlAppend(a,"attachCid="+f);a=Ext.urlAppend(a,"store="+b);a=Ext.urlAppend(a,
"entryid="+c);a=Ext.urlAppend(a,"contentDispositionType=inline");if(!Ext.isEmpty(d))for(f=0;f<d.length;f++)a=Ext.urlAppend(a,"attachNum[]="+d[f]);return e+a+g}return a})},inlineImgZarafaToOutlook:function(a){if(Ext.isDefined(a))return a.replace(f,function(a,b,c,d,e,f){return c?b+"cid:"+c+d:a})}}}();Ext.namespace("Zarafa.core");
Zarafa.core.KeyMap=Ext.extend(Ext.KeyMap,{component:void 0,constructor:function(a,b,c,d){a&&(this.component=a);c||(c=a.getEl());c=Ext.get(c);Zarafa.core.KeyMap.superclass.constructor.call(this,c,b,d)},addBinding:function(a){if(Array.isArray(a))Ext.each(a,function(a){this.addBinding(a)},this);else{var b=a.key,c=a.fn||a.handler,d=a.scope,e=a.stopEvent;Ext.isDefined(e)||(e=this.stopEvent);if("string"==typeof b){for(var f=[],g=b.toUpperCase(),h=0,k=g.length;h<k;h++)f.push(g.charCodeAt(h));b=f}var l=Array.isArray(b);
this.bindings.push(function(f){if(this.checkModifiers(a,f)){var g=f.getKey();if(l)for(var h=0,k=b.length;h<k;h++){if(b[h]==g){e&&f.stopEvent();c.call(d||window,g,f,this.component);break}}else g==b&&(e&&f.stopEvent(),c.call(d||window,g,f,this.component))}})}}});Ext.namespace("Zarafa.core");
Zarafa.core.KeyMapMgr=Ext.extend(Object,{keyMaps:void 0,keys:void 0,constructor:function(){this.keyMaps=new Ext.util.MixedCollection;this.keys={}},register:function(a,b){this.keys[a]||(this.keys[a]=[]);Array.isArray(b)||(b=[b]);this.keys[a]=this.keys[a].concat(b);this.preventBrowserDefaults(a,b)},preventBrowserDefaults:function(a,b){if("global"!==a&&"globaldisable"!==a)for(var c=0,d=b.length;c<d;c++){var e=b[c];if(!0!==e.enableGlobally){var f={handler:Ext.emptyFn,stopEvent:!0};Ext.applyIf(f,e);this.register("globaldisable",
f)}else!0===e.ctrl&&(f=e.key,Ext.isString(f)&&(f=f.toUpperCase().charCodeAt(0)),f===Ext.EventObject.A&&(f={handler:this.disableTextSelection,stopEvent:!1},Ext.applyIf(f,e),this.register("globaldisable",f)))}},disableTextSelection:function(a,b,c){a=b.getTarget().nodeName.toLowerCase();"textarea"!==a&&"input"!==a&&b.stopEvent()},activate:function(a,b,c){c||(c=a.getEl());c=Ext.get(c);var d=c.id;if(!Ext.isEmpty(d)){b=this.getKeyBindings(b);var e=container.getSettingsModel().get("zarafa/v1/main/keycontrols");
e===Zarafa.settings.data.KeyboardSettings.BASIC_KEYBOARD_SHORTCUTS?b=b.filter(function(a){return Ext.isDefined(a.basic)}):e===Zarafa.settings.data.KeyboardSettings.NO_KEYBOARD_SHORTCUTS&&(b=[]);if(!Ext.isEmpty(b))if(e=this.getActive(c))e.addBinding(b);else{if(a instanceof Ext.Component)a.on("beforedestroy",this.onComponentDestroy,this);this.keyMaps.add(d,new Zarafa.core.KeyMap(a,b,c))}}},getKeyBindings:function(a){for(var b=[];!Ext.isEmpty(a);)this.keys[a]&&(b=b.concat(this.keys[a])),a=a.substr(0,
a.lastIndexOf("."));return b},onComponentDestroy:function(a){this.deactivate(a.getEl())},deactivate:function(a){a=Ext.get(a);if(a=this.keyMaps.get(a.id))a.disable(),this.keyMaps.remove(a)},getActive:function(a){a=Ext.get(a);return this.keyMaps.get(a.id)},enableKeyMap:function(a){a=Ext.get(a);if(a=this.keyMaps.get(a.id))this.isGloballyEnabled()?a.enable():a.originallyEnabled=!0},disableKeyMap:function(a){a=Ext.get(a);if(a=this.keyMaps.get(a.id))a.disable(),this.isGloballyEnabled()||(a.originallyEnabled=
!1)},enableAllKeymaps:function(){this.keyMaps.each(function(a){!0===a.originallyEnabled&&a.enable();delete a.originallyEnabled},this)},disableAllKeymaps:function(){this.keyMaps.each(function(a){a.originallyEnabled=a.isEnabled();a.disable()},this)},isEnabled:function(a){return(a=this.getActive(a))&&a.isEnabled()},isGloballyEnabled:function(){return container.getSettingsModel().get("zarafa/v1/main/keycontrols")!==Zarafa.settings.data.KeyboardSettings.NO_KEYBOARD_SHORTCUTS}});Zarafa.core.KeyMapMgr=new Zarafa.core.KeyMapMgr;
Ext.namespace("Zarafa.core");
Zarafa.core.MessageClass={isClass:function(a,b,c){if(Ext.isEmpty(a))return!1;a=a.toUpperCase();if(Array.isArray(b)){for(var d=0,e=b.length;d<e;d++)if(this.isClass(a,b[d],c))return!0;return!1}if(b.length>a.length)return!1;!0===c&&(a=a.substring(0,b.length));return a==b.toUpperCase()},isContainerClassCompatible:function(a,b){a=a.toUpperCase();b=b.toUpperCase();if(Ext.isEmpty(b))return!0;switch(a){case "IPM.APPOINTMENT":case "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}":return Zarafa.core.ContainerClass.isClass(b,"IPF.Appointment",
!0);case "IPM.STICKYNOTE":return Zarafa.core.ContainerClass.isClass(b,"IPF.StickyNote",!0);case "IPM.CONTACT":case "IPM.DISTLIST":return Zarafa.core.ContainerClass.isClass(b,"IPF.Contact",!0);case "IPM.TASK":return Zarafa.core.ContainerClass.isClass(b,"IPF.Task",!0);case "IPM.NOTE":case "REPORT.IPM":case "IPM.SCHEDULE":case "IPM.TASKREQUEST":return this.isClass(b,"IPF.Note",!0)&&!this.isClass(b,"IPF.Note.OutlookHomepage",!0)}var c=a.lastIndexOf(".");return 0<c?(a=a.substr(0,c),this.isContainerClassCompatible(a,
b)):!1},getDefaultFolderTypeFromMessageClass:function(a){a=a.toUpperCase();switch(a){case "IPM.APPOINTMENT":case "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}":return"calendar";case "IPM.STICKYNOTE":return"note";case "IPM.CONTACT":case "IPM.DISTLIST":return"contact";case "IPM.TASK":return"task";case "IPM.NOTE":case "REPORT.IPM":case "IPM.SCHEDULE":case "IPM.TASKREQUEST":return"inbox"}var b=a.lastIndexOf(".");return 0<b?(a=a.substr(0,b),this.getDefaultFolderTypeFromMessageClass(a)):""}};Ext.namespace("Zarafa.core");
Zarafa.core.ModuleNames={ADDRESSBOOK:{list:"addressbooklistmodule",item:"addressbookitemmodule"},"IPM.APPOINTMENT":{list:"appointmentlistmodule",item:"appointmentitemmodule"},"IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}":{list:"appointmentlistmodule",item:"appointmentitemmodule"},"IPM.TASK":{list:"tasklistmodule",item:"taskitemmodule"},"IPM.TASKREQUEST":{list:"tasklistmodule",item:"taskitemmodule"},"IPM.CONTACT":{list:"contactlistmodule",item:"contactitemmodule"},"IPM.DISTLIST":{list:"contactlistmodule",
item:"contactitemmodule"},HIERARCHY:{list:"hierarchymodule",item:"hierarchymodule"},SETTINGS:{list:"settingsmodule"},"IPM.NOTE":{list:"maillistmodule",item:"createmailitemmodule"},"IPM.STICKYNOTE":{list:"stickynotelistmodule",item:"stickynoteitemmodule"},FREEBUSY:{list:"freebusymodule"},BUSYTIME:{list:"busytimelistmodule"},SUGGESTEMAILADDRESS:{list:"suggestemailaddressmodule",item:"suggestemailaddressmodule"},REMINDER:{list:"reminderlistmodule",item:"reminderitemmodule"},DELEGATES:{list:"delegatesmodule",
item:"delegatesmodule"},RULES:{list:"rulesmodule",item:"rulesmodule"},RESTOREITEMS:{list:"restoreitemslistmodule",item:"restoreitemslistmodule"},"IPM.SEARCH":{list:"advancedsearchlistmodule",item:"createmailitemmodule"},getModule:function(a,b){a=a.toUpperCase();var c=this[a];if(!c&&!0===b){var d=a.lastIndexOf(".");0<d&&(a=a.substr(0,d),c=this.getModule(a,b))}return c},getItemName:function(a,b){var c=this.getModule(a,b);if(c)return c.item},getListName:function(a,b){var c=this.getModule(a,b);if(c)return c.list}};
Ext.namespace("Zarafa.core");
Zarafa.core.PingService=Ext.extend(Ext.util.Observable,{url:"kopano.php",cmd:"ping",headers:void 0,timeout:1E3,maxTimeout:3E5,pingTask:void 0,currentTimeout:void 0,pingPending:!1,constructor:function(a){a=a||{};Ext.apply(a,{headers:{"Content-Type":"application/json; charset=utf-8;"}});Ext.apply(this,a);this.addEvents("start","stop","send","retry","restored");Zarafa.core.PingService.superclass.constructor.call(this,a);this.pingTask=new Ext.util.DelayedTask(this.sendPing,this)},start:function(){delete this.currentTimeout;
var a=this.getNextTimeout();this.fireEvent("start",this,a);this.pingTask.delay(a)},stop:function(){this.pingTask.cancel();this.fireEvent("stop",this)},retry:function(){this.pingTask.cancel();this.sendPing()},getNextTimeout:function(){this.currentTimeout=this.currentTimeout?2*this.currentTimeout:this.timeout;return this.currentTimeout=Math.min(this.maxTimeout,this.currentTimeout)},sendPing:function(){if(!this.pingPending){var a=new XMLHttpRequest,b=this.url,b=Ext.urlAppend(b,this.cmd);a.open("GET",
b,!0);for(var c in this.headers)a.setRequestHeader(c,this.headers[c]);a.onreadystatechange=this.onStateChange.createDelegate(this,[a]);this.pingPending=!0;a.send();this.fireEvent("send",this,a)}},onStateChange:function(a){4==a.readyState&&(this.pingPending=!1,200!==a.status?this.failure():a.responseText?(a=Ext.decode(a.responseText),a.success?this.restored(a):this.failure(a)):this.failure())},restored:function(a){this.fireEvent("restored",this,a)},failure:function(a){var b=this.getNextTimeout();this.fireEvent("retry",
this,a,b);this.pingTask.delay(b)}});Ext.namespace("Zarafa.core");
Zarafa.core.PluginMetaData=Ext.extend(Object,{name:"",displayName:"",settingsName:"",iconCls:"",about:void 0,allowUserDisable:!0,allowUserVisible:!0,pluginConstructor:void 0,instance:void 0,constructor:function(a){a=a||{};Ext.apply(this,a);Zarafa.core.PluginMetaData.superclass.constructor.call(this,a);Ext.isEmpty(this.displayName)&&(this.displayName=this.name);Ext.isEmpty(this.settingsName)&&(this.settingsName=this.name)},isEnabled:function(){return this.allowUserDisable?!0===container.getSettingsModel().get(this.getSettingsBase()+
"/enable"):!0},isPrivate:function(){return!1===this.allowUserVisible},getName:function(){return this.name},getDisplayName:function(){return this.displayName},getIconCls:function(){return this.iconCls},getAbout:function(){return this.about},getSettingsBase:function(){return"zarafa/v1/plugins/"+this.settingsName},getInstance:function(){this.instance||(this.instance=new this.pluginConstructor({info:this}));return this.instance}});Ext.namespace("Zarafa.core");
Zarafa.core.PresenceManager=Ext.extend(Ext.util.Observable,{registeredStores:[],requestQueue:[],pollingInterval:2E4,constructor:function(){var a=this;Zarafa.onReady(function(){setInterval(function(){a.pollForUpdates()},a.pollingInterval)})},getPresencePlugins:function(){return container.getPlugins().filter(function(a){return a instanceof Zarafa.core.PresencePlugin})},getPresenceStatusForUsers:function(a){a=[].concat(a);if(0===a.length)return[];var b=a.map(function(){return{}}),c=this.getPresencePlugins();
if(0===c.length)return b;Ext.each(c,function(c){var d=c.getName(),f=c.getPresenceStatuses(a);Ext.each(a,function(a,c){b[c][d]=f[c]})});return b},getPresenceStatusForUser:function(a){if(Ext.isEmpty(a))return Zarafa.core.data.PresenceStatus.UNKNOWN;var b=this.getPresenceStatusForUsers([a])[0],c=Zarafa.core.data.PresenceStatus.UNKNOWN;Ext.iterate(b,function(a){b[a]>c&&(c=b[a])});return c},queuePresenceRequest:function(a){var b=!1;Ext.each(this.requestQueue,function(c){if(a.equals(c))return b=!0,!1},
this);b||(this.requestQueue.push(a),this.task=this.task||new Ext.util.DelayedTask(this.doQueuedRequests,this),this.task.delay(500))},doQueuedRequests:function(){var a=this.getPresenceStatusForUsers(this.requestQueue),b=this.rearangeStatuses(this.requestQueue,a);Ext.iterate(b,function(a){this.updateStatuses(a,b[a])},this);this.requestQueue=[]},rearangeStatuses:function(a,b){var c={};Ext.each(b,function(b,e){Ext.iterate(b,function(d){Ext.isDefined(c[d])||(c[d]=[]);c[d].push({user:a[e],status:b[d]})},
this)},this);return c},registerStore:function(a){if(0!==this.getPresencePlugins().length){var b=Ext.each(this.registeredStores,function(b){if(b.store===a)return!1},this);Ext.isDefined(b)||(this.registeredStores.push({store:a}),this.onStoreLoad(a,a.getRange(),null),a.on("load",this.onStoreLoad,this))}},unregisterStore:function(a){for(var b=0;b<this.registeredStores.length;b++)if(this.registeredStores[b].store===a){this.registeredStores.splice(b,1);break}},onStoreLoad:function(a,b,c){a=Zarafa.core.data.UserIdObjectFactory.createFromStore(a);
Ext.each(a,function(a){Ext.isDefined(Zarafa.core.data.PresenceCache.getUser(a))||this.queuePresenceRequest(a)},this)},updateStatuses:function(a,b){Array.isArray(b)||(b=[b]);var c=[];Ext.each(b,function(b){var d=Zarafa.core.data.PresenceCache.getStatusForUser(b.user);Zarafa.core.data.PresenceCache.addStatusForUser(a,b.user,b.status);Zarafa.core.data.PresenceCache.getStatusForUser(b.user)!==d&&c.push(b)});Ext.each(this.registeredStores,function(a){var b=a.store.getRange(),d=[];Ext.each(b,function(a){if(!(0<=
d.indexOf(a))){var b=Ext.each(c,function(b){var c=Zarafa.core.data.UserIdObjectFactory.createFromRecord(a);if(c&&c.equals(b.user))return d.push(a),!1},this);if(Ext.isDefined(b))return!1}},this);d.length&&(Ext.each(d,function(b){a.store.fireEvent("update",a.store,b,Ext.data.Record.COMMIT)}),a.store instanceof Zarafa.core.data.IPMRecipientStore&&a.store.fireEvent("datachanged",a.store))},this)},pollForUpdates:function(){var a=Zarafa.core.data.PresenceCache.getUserInfoList(),b=this.getPresenceStatusForUsers(a),
c=this.rearangeStatuses(a,b);Ext.iterate(c,function(a){this.updateStatuses(a,c[a])},this)}});Zarafa.core.PresenceManager=new Zarafa.core.PresenceManager;Ext.namespace("Zarafa.core");
Zarafa.core.Request=Ext.extend(Ext.util.Observable,function(){var a=!1,b=!1,c=0,d,e=!1,f=!1,g=[],h={},k=[],l;return{defaultUrl:"kopano.php",defaultHeaders:void 0,subSystemPrefix:"webapp",requestHeaders:void 0,constructor:function(a){a=a||{};Ext.apply(a,{defaultHeaders:{"Content-Type":"application/json; charset=utf-8;"},requestHeaders:{}});Ext.apply(this,a);this.addEvents("connectionparalyzed","connectioninterrupted","connectionrestored","beforesend","aftersend");Zarafa.core.Request.superclass.constructor.call(this,
a);this.initialize()},initialize:function(){b=a=!1;c=0;d=void 0;f=e=!1;g=[];h={};k=[];l=this.subSystemPrefix+"_"+(new Date).getTime()},paralyze:function(b){this.isParalyzed()||(a=!0,this.fireEvent("connectionparalyzed",this,b))},isParalyzed:function(){return a},interrupt:function(){if(!this.isInterrupted()&&!this.isParalyzed()){b=!0;var a=new Zarafa.core.PingService({url:this.defaultUrl,headers:this.defaultHeaders});a.on("restored",this.restore,this);this.on("connectionparalyzed",a.stop,a);this.on("connectionrestored",
a.stop,a,{delay:1});this.fireEvent("connectioninterrupted",this,a);a.start()}},restore:function(a,c){this.isInterrupted()&&(c&&!1===c.active?this.paralyze(Zarafa.core.data.ParalyzeReason.SESSION_EXPIRED):(b=!1,this.fireEvent("connectionrestored",this),this.hasQueuedHttpRequests()&&this.dequeueHttpRequest()))},isInterrupted:function(){return b},setRequestHeader:function(a,b){this.requestHeaders[a]=b},getRequestId:function(a){return(a||"z-gen")+ ++c},cancelActiveRequest:function(a){var b=container.getResponseRouter();
if(0<=g.indexOf(a))1===g.length?(this.reset(),b.removeRequestResponseHandler(a)):b.addRequestResponseHandler(a,new Zarafa.core.data.DummyResponseHandler);else if(this.hasQueuedHttpRequests()){for(var c=0;c<k.length;c++){var d=k[c];if(0<=d.queuedRequests.indexOf(a)){if(1===d.queuedRequests.length){k.splice(c,1);b.removeRequestResponseHandler(a);return}break}}b.addRequestResponseHandler(a,new Zarafa.core.data.DummyResponseHandler)}else d=h[a],Ext.isDefined(d)&&(1===d.queuedRequests.length&&(d.preventRetry=
!0),b.addRequestResponseHandler(a,new Zarafa.core.data.DummyResponseHandler))},queueRequest:function(a){g.push(a)},dequeueRequests:function(){var a=g;g=[];return a},activateRequests:function(a,b){for(var c=0;c<a.length;c++)h[a[c]]=b},completeRequests:function(a){for(var b=0,c=a.length;b<c;b++)delete h[a[b]]},prepareHttpRequest:function(a,b,c,d){var e=new XMLHttpRequest;c||(c=this.defaultUrl,c=Ext.urlAppend(c,"subsystem="+l));e.open("POST",c,!0);e.requestUrl=c;d=Ext.apply({},this.requestHeaders,d||
this.defaultHeaders);for(var f in d)e.setRequestHeader(f,d[f]);e.requestHeaders=d;e.requestData=a;e.requestDataEncoded=b;e.queuedRequests=this.dequeueRequests();return e},cloneRequest:function(a){var b=new XMLHttpRequest;b.open("POST",a.requestUrl,!0);b.requestUrl=a.requestUrl;var c=a.requestHeaders,d;for(d in c)b.setRequestHeader(d,c[d]);b.requestHeaders=c;b.requestData=a.requestData;b.requestDataEncoded=a.requestDataEncoded;b.queuedRequests=a.queuedRequests;return b},sendHttpRequest:function(a){var b=
a.requestData,c=a.queuedRequests;this.isParalyzed()||!1===this.fireEvent("beforesend",this,a)||(a.onreadystatechange=this.stateChange.createDelegate(this,[a]),this.activateRequests(c,a),a.send(b),this.fireEvent("aftersend",this,a))},queueHttpRequest:function(a){k.push(a)},hasQueuedHttpRequests:function(){return!Ext.isEmpty(k)},dequeueHttpRequest:function(){var a=k.shift();a&&this.sendHttpRequest(a)},stateChange:function(a){var b=a.queuedRequests,c=container.getResponseRouter();if(!this.isParalyzed()&&
4==a.readyState){this.completeRequests(b);switch(a.status){case 401:"MAPI_E_INVALID_WORKSTATION_ACCOUNT"===a.getResponseHeader("X-Zarafa-Hresult")?this.paralyze(Zarafa.core.data.ParalyzeReason.SESSION_INVALID):this.paralyze(Zarafa.core.data.ParalyzeReason.SESSION_EXPIRED);return;case 500:this.hasQueuedHttpRequests()&&this.dequeueHttpRequest();this.receiveFailure(a);return;case 200:this.hasQueuedHttpRequests()&&this.dequeueHttpRequest();break;default:this.interrupt();!0!==a.preventRetry&&(a=this.cloneRequest(a),
this.queueHttpRequest(a));return}a.responseText?(b=Ext.decode(a.responseText),Ext.isEmpty(b)||Ext.isEmpty(b.zarafa)?this.receiveFailure(a):c.receive(b)):this.receiveFailure(a)}},receiveFailure:function(a){var b=container.getResponseRouter(),c=a.requestData;a.requestDataEncoded&&(c=Ext.decode(c));b.receiveFailure(c,a)},reset:function(){g=[];d={zarafa:{}};f=e=!1},addRequest:function(a,b,c,g){if(Ext.isEmpty(d))throw"Request object not initialised. Call reset() first";if(f)throw"Request object initialized with RAW data";
var h=this.getRequestId(a);this.queueRequest(h);Ext.isDefined(g)&&container.getResponseRouter().addRequestResponseHandler(h,g);c=Ext.value(c,{});Ext.isDefined(d.zarafa[a])||(d.zarafa[a]={});Ext.isDefined(d.zarafa[a][h])||(d.zarafa[a][h]={});d.zarafa[a][h][b]=c;e=!0;return h},addDataRequest:function(a,b,c,g){if(Ext.isEmpty(d))throw"Request object not initialised. Call reset() first";if(e)throw"Request object intitialized with JSON data";if(f)throw"Request object already contains RAW data";a=this.getRequestId(a);
this.queueRequest(a);Ext.isDefined(g)&&container.getResponseRouter().addRequestResponseHandler(a,g);d=c;f=!0;return a},send:function(a,b){if(Ext.isEmpty(d))throw"Request object not initialised. Call reset() first";if(Ext.isEmpty(g))throw"No requests have been added. Use addRequest()";if(!this.isParalyzed()){var c=this.prepareHttpRequest(e?Ext.encode(d):d,e,a,b);this.isInterrupted()||this.hasQueuedHttpRequests()?this.queueHttpRequest(c):this.sendHttpRequest(c)}d=void 0;f=e=!1},singleRequest:function(a,
b,c,d){this.reset();a=this.addRequest(a,b,c,d);this.send();return a}}}());Ext.namespace("Zarafa.core");
Zarafa.core.ResponseRouter=Ext.extend(Ext.util.Observable,{responseHandlers:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{responseHandlers:{}});this.addEvents("beforereceive","afterreceive","receiveexception","response");Ext.apply(this,a);Zarafa.core.ResponseRouter.superclass.constructor.call(this,a)},addRequestResponseHandler:function(a,b){this.responseHandlers[a]=b},getRequestResponseHandler:function(a){var b=this.responseHandlers[a];this.removeRequestResponseHandler(a);return b},removeRequestResponseHandler:function(a){delete this.responseHandlers[a]},
getNotificationResponseHandler:function(a,b){return container.getNotificationResolver().getHandlerForResponse(a,b)},receive:function(a){this.fireEvent("beforereceive",a);this.processResponse(a);this.fireEvent("afterreceive",a)},receiveFailure:function(a,b){this.fireEvent("receiveexception",a,b);Ext.isObject(a)&&Ext.iterate(a.zarafa,function(a,d){Ext.iterate(d,function(a,c){var d=this.getRequestResponseHandler(a);Ext.isEmpty(d)||d.responseFailure(b)},this)},this)},resolveResponseHandlers:function(a){var b=
[],c=[];Ext.iterate(a,function(a,e){Ext.iterate(e,function(d,e){var f={moduleName:a,moduleId:d,moduleData:e};f.handler=this.getRequestResponseHandler(d);Ext.isEmpty(f.handler)?(f.handler=this.getNotificationResponseHandler(a,e),Ext.isEmpty(f.handler)||c.push(f)):b.push(f)},this)},this);return b.concat(c)},handleResponse:function(a,b,c,d,e){var f=!0;!1!==a.start(b,c,d,e)&&(Ext.isObject(d)&&Ext.iterate(d,function(b,c){!1===a.handle(b,c)&&(f=!1)},this),a.done(f))},processResponse:function(a){if(Ext.isEmpty(a.zarafa.error)){var b=
(new Date).getTime();a=this.resolveResponseHandlers(a.zarafa);for(var c=0,d=a.length;c<d;c++){var e=a[c],f=e.moduleName,g=e.moduleId,h=e.moduleData,e=e.handler;!1!==this.fireEvent("response",f,g,h,b)&&this.handleResponse(e,f,g,h,b)}}else Ext.data.DataProxy.fireEvent("exception",Ext.data.DataProxy,"remote",null,null,a.zarafa,null)}});Ext.namespace("Zarafa.core");
Zarafa.core.URLActionMgr=Ext.extend(Ext.util.Observable,{mappings:void 0,constructor:function(){this.mappings={}},register:function(a,b){this.mappings[a]||(this.mappings[a]=[]);this.mappings[a]=this.mappings[a].concat(b)},execute:function(a){Ext.iterate(a,function(a,c){var b=this.mappings[a];b&&Ext.each(b,function(b){b.handler.call(b.scope||this,a,c,b)})},this)}});Zarafa.core.URLActionMgr=new Zarafa.core.URLActionMgr;Ext.namespace("Zarafa.core");
Zarafa.core.Util={skipRequester:!1,sortArray:function(a,b,c){var d=new Ext.util.MixedCollection;d.addAll(a);a=Ext.isFunction(c)?c:Ext.isString(c)?function(a,b){return Zarafa.core.Util.numericComparison(a[c],b[c])}:this.numericComparison;d.sort(b,a);return d.getRange()},numericComparison:function(a,b){return a-b},caseSensitiveComparison:function(a,b){return a>b?1:a<b?-1:0},caseInsensitiveComparison:function(a,b){var c=String(a).toUpperCase(),d=String(b).toUpperCase();return Zarafa.core.Util.caseSensitiveComparison(c,
d)},uniqueArray:function(a,b){var c=new Ext.util.MixedCollection;Ext.each(a,function(a){var d=b?a[b]:a;c.containsKey(d)||c.add(d,a)},this);return c.getRange()},trimStringArray:function(a){var b=a;a=[];for(var c=0,d=b.length;c<d;c++)Array.isArray(b[c])?a.push(Zarafa.core.Util.trimStringArray(b[c])):Ext.isString(b[c])&&!Ext.isEmpty(b[c].trim())&&a.push(b[c].trim());return a},inArray:function(a,b,c,d){for(var e=0,f=a.length;e<f;e++)if(Array.isArray(a[e])){if(Zarafa.core.Util.inArray(a[e],b,c,d))return!0}else if(b)if(d)if(c){if(-1!=
a[e].indexOf(b.toLowerCase())||-1!=b.indexOf(a[e].toLowerCase()))return!0}else{if(-1!=a[e].indexOf(b))return!0}else if(c){if(a[e].toLowerCase()===b.toLowerCase())return!0}else if(a[e]===b)return!0;return!1},applyRecursive:function(a,b,c){c&&(a=Zarafa.core.Util.applyRecursive(a,c));if(a&&b&&(Ext.isObject(b)||Array.isArray(b)))for(var d in b)Ext.isDefined(a[d])&&Ext.isObject(a[d])?a[d]=Zarafa.core.Util.applyRecursive(a[d],b[d]):Ext.isObject(b[d])?a[d]=Zarafa.core.Util.applyRecursive({},b[d]):a[d]=b[d];
return a},applyIfRecursive:function(a,b,c){c&&(a=Zarafa.core.Util.applyIfRecursive(a,c));if(a&&b&&(Ext.isObject(b)||Array.isArray(b)))for(var d in b)Ext.isDefined(a[d])&&Ext.isObject(a[d])?a[d]=Zarafa.core.Util.applyIfRecursive(a[d],b[d]):Ext.isObject(b[d])?a[d]=Zarafa.core.Util.applyIfRecursive({},b[d]):Ext.isDefined(a[d])||(a[d]=b[d]);return a},flattenObject:function(a,b,c){var d={},e="";Ext.isEmpty(c)?c="":e=b;if(Ext.isObject(a))for(var f in a)Ext.apply(d,Zarafa.core.Util.flattenObject(a[f],b,
c+e+f));else d[c]=a;return d},objectKeysToLowerCase:function(a){for(var b,c=Object.keys(a),d={},e=0;e<c.length;e++)b=c[e],d[b.toLowerCase()]=a[b];return d},splitStringByPattern:function(a,b){for(var c=[0],d;null!==(d=b.exec(a));)0!==d.index&&c.push(d.index),b.lastIndex<a.length&&c.push(b.lastIndex);d=[];if(1<c.length)for(var e=0;e<c.length;e++)Ext.isDefined(c[e+1])?d.push(a.slice(c[e],c[e+1])):d.push(a.slice(c[e]));else d=[a];return d},inside:function(a,b,c){return b>=a.x&&b<a.x+a.width&&c>=a.y&&
c<a.y+a.height},restrictBox:function(a,b){b=Ext.apply({},b);b.x=Math.max(a.x,b.x);b.y=Math.max(a.y,b.y);b.x>a.x&&(b.x-=Math.max(0,b.x+b.width-(a.x+a.width)));b.y>a.y&&(b.y-=Math.max(0,b.y+b.height-(a.y+a.height)));b.x=Math.max(a.x,b.x);b.y=Math.max(a.y,b.y);return b},getSelectionRange:function(a){a=a.dom||a;if(a.selectionStart||"0"==a.selectionStart)return{start:a.selectionStart,end:a.selectionEnd}},setCaretPosition:function(a,b){Zarafa.core.Util.setSelectionRange(a,b,b)},setSelectionRange:function(a,
b,c){(a=a.dom||a)&&"object"==typeof a&&a.setSelectionRange&&(a.focus(),a.setSelectionRange(b,c))},validateEmailAddress:function(a){var b=new RegExp(/^([^<]*<){0,1}(([a-z0-9\.\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,5})+)>{0,1}$|^\[[^\]]+\]$/i);return Ext.isString(a)&&0<a.length?b.test(a):!1},mergeListeners:function(a,b,c){a=Ext.value(a,{});var d=b.scope||a.scope,e;for(e in b)if("scope"!==e){var f=b[e].createDelegate(d);Ext.isDefined(a[e])?a[e]=!1!==c?a[e].createInterceptor(f):
a[e].createSequence(f):a[e]=f}return a},encode_utf16:function(a){var b,c,d="";Ext.isString(a)||(a=String(a));for(var e=0,f=a.length;e<f;e++)c=(a.charCodeAt(e)>>8).toString(16),b=(a.charCodeAt(e)&255).toString(16),d+=String.leftPad(String(b),2,"0"),d+=String.leftPad(String(c),2,"0");return d},stringToHex:function(a){a=a.toUpperCase();for(var b="",c=0;c<a.length;c++)b+=""+a.charCodeAt(c).toString(16);return b},hexToString:function(a){a=a.toString();for(var b="",c=0;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,
2),16));return b.toLowerCase()},reloadWebapp:function(){!1!==container.fireEvent("beforewebappreload")&&(this.disableLeaveRequester(),window.location.reload())},enableLeaveRequester:function(){window.onbeforeunload=this.onBeforeUnload.createDelegate(this)},disableLeaveRequester:function(){window.onbeforeunload=null},onBeforeUnload:function(){if(this.skipRequester)this.skipRequester=!1;else return _("Your changes will be lost if you leave this page now.")},copyToClipboard:function(a){var b=document.createElement("textarea");
b.setAttribute("id","copyTextArea");document.body.appendChild(b);b.innerText=a;b.select();document.execCommand("copy");document.body.removeChild(b)}};Ext.namespace("Zarafa.core.data");Zarafa.core.data.AbstractResponseHandler=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a)},responseFailure:Ext.emptyFn,start:Ext.emptyFn,handle:function(a,b){var c=this["do"+Ext.util.Format.capitalize(a)];if(Ext.isFunction(c))return c.call(this,b)},done:Ext.emptyFn});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.CallbackQueue=Ext.extend(Ext.util.Observable,{queue:void 0,running:!1,currentTask:0,completionFn:void 0,completionScope:void 0,constructor:function(a){a=a||{};a.queue=[];this.addEvents("startqueue","completequeue","starttask","completetask");Ext.apply(this,a);Zarafa.core.data.CallbackQueue.superclass.constructor.call(this,a)},add:function(a,b){this.queue.push({fn:a,scope:b})},remove:function(a,b){for(var c=this.queue,d=0;d<c.length;d++){var e=c[d];if(e.fn===a&&e.scope===b){this.queue.splice(d,
1);break}}},run:function(a,b){this.running=!0;this.currentTask=0;this.completionFn=a;this.completionScope=b;this.fireEvent("startqueue",this);this.doTask(this.currentTask)},isRunning:function(){return this.running},doTask:function(a){a=this.queue[a];this.fireEvent("starttask",this,a.fn,a.scope);a.fn.call(a.scope,this.onCompleteTask.createDelegate(this,[a],1))},onCompleteTask:function(a,b){a=!1!==a;this.fireEvent("completetask",this,b.fn,b.scope,a);a&&this.currentTask<this.queue.length-1?(this.currentTask++,
this.doTask(this.currentTask)):(this.completionFn&&(this.completionFn.call(this.completionScope,a),this.completionScope=this.completionFn=void 0),this.fireEvent("completequeue",this,a),this.running=!1)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ContentPanelMgr=Ext.extend(Ext.util.Observable,{contentPanels:void 0,constructor:function(){this.contentPanels=new Ext.util.MixedCollection;this.addEvents(["createcontentpanel","destroycontentpanel"]);Zarafa.core.data.ContentPanelMgr.superclass.constructor.call(this)},register:function(a){a.on("show",this.onContentPanelShow,this);a.on("close",this.onContentPanelHide,this);a.on("hide",this.onContentPanelHide,this);this.contentPanels.add(a)},unregister:function(a){a.un("show",this.onContentPanelShow,
this);a.un("close",this.onContentPanelHide,this);a.un("hide",this.onContentPanelHide,this);this.contentPanels.remove(a)},onContentPanelShow:function(a){this.fireEvent("createcontentpanel",a)},onContentPanelHide:function(a){this.fireEvent("destroycontentpanel",a)},getContentPanelInstances:function(a){return this.contentPanels.filterBy(function(b){return b instanceof a})}});Zarafa.core.data.ContentPanelMgr=new Zarafa.core.data.ContentPanelMgr;Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPFStoreMgr=Ext.extend(Ext.util.Observable,{IPFStores:void 0,constructor:function(){this.IPFStores=new Ext.util.MixedCollection;this.addEvents("storeexception beforerecordsave afterrecordsave afterrecordupdate recordremove afterrecordwrite".split(" "));Zarafa.core.data.IPFStoreMgr.superclass.constructor.call(this)},register:function(a,b){b||(a.on("beforesave",this.onBeforeSave,this),a.on("save",this.onSave,this),a.on("update",this.onUpdate,this),a.on("remove",this.onRemove,this));
a.on("write",this.onWrite,this);a.on("exception",this.onException,this);this.IPFStores.add(a)},unregister:function(a,b){b||(a.un("beforesave",this.onBeforeSave,this),a.un("save",this.onSave,this),a.un("update",this.onUpdate,this),a.un("remove",this.onRemove,this));a.un("write",this.onWrite,this);a.un("exception",this.onException,this);this.IPFStores.remove(a)},getPropagatableRecords:function(a){var b=[];Array.isArray(a)||(a=[a]);for(var c=0,d=a.length;c<d;c++){var e=a[c];e instanceof Zarafa.core.data.IPFRecord&&
e.hasEventPropagation()&&b.push(e)}return b},onBeforeSave:function(a,b){var c={},d;for(d in b){var e=this.getPropagatableRecords(b[d]);Ext.isEmpty(c)||(c[d]=e)}this.fireEvent("beforerecordsave",a,c)},onSave:function(a,b,c){this.fireEvent("afterrecordsave",a,c)},onUpdate:function(a,b,c){b.hasEventPropagation()&&this.fireEvent("afterrecordupdate",a,b,c)},onRemove:function(a,b,c){b.hasEventPropagation()&&this.fireEvent("recordremove",a,b)},onWrite:function(a,b,c,d,e){e=this.getPropagatableRecords(e);
Ext.isEmpty(e)||this.fireEvent("afterrecordwrite",a,b,c,d,e)},onException:function(a,b,c,d,e,f){var g=Ext.pluck(this.IPFStores.items,"proxy");Ext.isEmpty(g)||(g=g.indexOf(a),this.fireEvent("storeexception",this.IPFStores.get(g),a,b,c,d,e,f))},each:function(a,b){this.IPFStores.each.apply(this,arguments)},getStoresForStores:function(a){var b=[];Array.isArray(a)||(a=[a]);a[0]instanceof Zarafa.core.data.IPFRecord&&(a=Ext.pluck(a,"id"));this.IPFStores.each(function(c){c.containsStoreInLastLoad(a)&&b.push(c)},
this);return b}});Zarafa.core.data.IPFStoreMgr=new Zarafa.core.data.IPFStoreMgr;Ext.namespace("Zarafa.core.data");Zarafa.core.data.IPMRecipientResolveRecordFields=[{name:"user_name"},{name:"display_name"},{name:"address_type"},{name:"smtp_address"},{name:"email_address"},{name:"entryid"},{name:"search_key"},{name:"object_type",type:"int"},{name:"display_type",type:"int"},{name:"display_type_ex",type:"int"}];Zarafa.core.data.IPMRecipientResolveRecord=Ext.data.Record.create(Zarafa.core.data.IPMRecipientResolveRecordFields);
Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMStoreMgr=Ext.extend(Ext.util.Observable,{IPMStores:void 0,constructor:function(){this.IPMStores=new Ext.util.MixedCollection;this.addEvents("storeexception beforerecordsave afterrecordsave afterrecordupdate recordremove afterrecordwrite".split(" "));Zarafa.core.data.IPMStoreMgr.superclass.constructor.call(this)},register:function(a,b){b||(a.on("beforesave",this.onBeforeSave,this),a.on("save",this.onSave,this),a.on("update",this.onUpdate,this),a.on("remove",this.onRemove,this));
a.on("write",this.onWrite,this);a.on("exception",this.onException,this);this.IPMStores.add(a)},unregister:function(a,b){b||(a.un("beforesave",this.onBeforeSave,this),a.un("save",this.onSave,this),a.un("update",this.onUpdate,this),a.un("remove",this.onRemove,this));a.un("write",this.onWrite,this);a.un("exception",this.onException,this);this.IPMStores.remove(a)},getPropagatableRecords:function(a){var b=[];Array.isArray(a)||(a=[a]);for(var c=0,d=a.length;c<d;c++){var e=a[c];e instanceof Zarafa.core.data.IPMRecord&&
e.hasEventPropagation()&&b.push(e)}return b},onBeforeSave:function(a,b){var c={},d;for(d in b){var e=this.getPropagatableRecords(b[d]);Ext.isEmpty(c)||(c[d]=e)}this.fireEvent("beforerecordsave",a,c)},onSave:function(a,b,c){this.fireEvent("afterrecordsave",a,c)},onUpdate:function(a,b,c){b.hasEventPropagation()&&this.fireEvent("afterrecordupdate",a,b,c)},onRemove:function(a,b,c){b.hasEventPropagation()&&this.fireEvent("recordremove",a,b)},onWrite:function(a,b,c,d,e){e=this.getPropagatableRecords(e);
Ext.isEmpty(e)||this.fireEvent("afterrecordwrite",a,b,c,d,e)},onException:function(a,b,c,d,e,f){var g=Ext.pluck(this.IPMStores.items,"proxy");Ext.isEmpty(g)||(g=g.indexOf(a),this.fireEvent("storeexception",this.IPMStores.get(g),a,b,c,d,e,f))},each:function(a,b){this.IPMStores.each.apply(this,arguments)},getStoresForFolders:function(a){var b=[];Array.isArray(a)||(a=[a]);a[0]instanceof Zarafa.core.data.IPFRecord&&(a=Ext.pluck(a,"id"));this.IPMStores.each(function(c){c.containsFolderInLastLoad(a)&&b.push(c)},
this);return b}});Zarafa.core.data.IPMStoreMgr=new Zarafa.core.data.IPMStoreMgr;Ext.namespace("Zarafa.core.data");
Zarafa.core.data.JsonReader=Ext.extend(Ext.data.JsonReader,{efCache:void 0,dynamicRecord:!0,constructor:function(a,b){a=Ext.applyIf(a||{},{totalProperty:"count",root:"item",id:"entryid",idProperty:"entryid"});var c=Ext.isDefined(a.successProperty);Ext.isDefined(b)||(b=Zarafa.core.data.RecordFactory.getRecordClassByMessageClass("IPM"));Ext.isDefined(a.dynamicRecord)&&(this.dynamicRecord=a.dynamicRecord);!1!==this.dynamicRecord&&(this.efCache={});Zarafa.core.data.JsonReader.superclass.constructor.call(this,
a,b);c||(this.getSuccess=function(a){return!0})},buildExtractors:function(){var a=this.meta;Zarafa.core.data.JsonReader.superclass.buildExtractors.call(this);if(a.id||a.idProperty){var b=this.getId;this.getId=function(a){if(a.props){var c=b(a.props);if(!Ext.isEmpty(c))return c}return b(a)}}},getEfMapping:function(a,b,c){Ext.isString(a)&&(a=a.toUpperCase());var d=this.efCache[a];if(!Ext.isDefined(d)){for(var d=[],e=0;e<c;e++){var f=b[e],f=Ext.isEmpty(f.mapping)?f.name:f.mapping;d.push(this.createAccessor.call(this,
f))}this.efCache[a]=d}return d},extractValues:function(a,b,c){var d={};if(Ext.isDefined(a.props))return d=Ext.apply({},a),d.props=this.extractValues(a.props,b,c),d;!0===this.dynamicRecord&&(c=Zarafa.core.data.RecordFactory.getRecordClassByRecordData(a),Ext.isDefined(c)||(c=this.recordType),b=c.prototype.fields.items,c=c.prototype.fields.length,this.ef=this.getEfMapping(a.message_class||a.object_type,b,c));for(var e=0;e<c;e++){var f=b[e],g=this.ef[e](a);Ext.isDefined(g)&&(d[f.name]=f.convert(g,a))}return d},
extractData:function(a,b){var c=this instanceof Ext.data.JsonReader?"json":"node",d=[];!this.isData(a)||this instanceof Ext.data.XmlReader||(a=[a]);if(!0===b)for(var e=0;e<a.length;e++){var f=a[e],g=void 0,h=this.getId(f),k=f.props||f,k={message_class:k.message_class,object_type:k.object_type};!0===this.dynamicRecord&&(g=Zarafa.core.data.RecordFactory.createRecordObjectByRecordData(k,h));g||(g=new this.recordType({},h));this.moveIdProperties(f,g.baseIdProperties);k=g.fields;h=k.items;k=k.length;this.update(g,
this.extractValues(f,h,k));g[c]=f;d.push(g)}else for(e=0;e<a.length;e++)f=a[e],c=void 0,!0===this.dynamicRecord&&(c=Zarafa.core.data.RecordFactory.getRecordClassByRecordData(f.props||f)),c||(c=this.recordType),this.moveIdProperties(f,c.prototype.baseIdProperties),k=c.prototype.fields,h=k.items,k=k.length,k=this.extractValues(f,h,k),k[this.meta.idProperty]=this.getId(f.props||f),d.push(k);return d},moveIdProperties:function(a,b){if(!a)return a;a.props||(a.props={});var c=this.meta.idProperty;if(c){var d=
a[c];Ext.isDefined(d)&&(a.props[c]=d,delete a[c])}if(Ext.isString(b))d=a[b],Ext.isDefined(d)&&(a.props[b]=d,delete a[b]);else if(b)for(var c=0,e=b.length;c<e;c++){var f=b[c],d=a[f];Ext.isDefined(d)&&(a.props[f]=d,delete a[f])}return a},realize:function(a,b){if(Array.isArray(a))for(var c=a.length-1;0<=c;c--)Array.isArray(b)?this.realize(a.splice(c,1).shift(),b.splice(c,1).shift()):this.realize(a.splice(c,1).shift(),b);else{Array.isArray(b)&&(b=b.shift());if(!this.isData(b))throw new Ext.data.DataReader.Error("realize",
a);a.phantom=!1;a._phid=a.id;a.id=this.getId(b);this.update(a,b);a.store&&a.store.reMap(a)}},update:function(a,b){if(Array.isArray(a))for(var c=0;c<a.length;c++)Array.isArray(b)?this.update(a[c],b[c]):this.update(a[c],b);else Array.isArray(b)&&(b=b.shift()),this.isData(b)&&(b=this.moveIdProperties(b,a.baseIdProperties),a.data=Ext.apply(a.data,b.props||b),delete b.props,b.action_response&&(a.action_response=b.action_response,delete b.action_response),Ext.iterate(b,function(c,e){if(Array.isArray(e)||
Ext.isObject(e)){var d;a.supportsSubStore(c)&&((d=a.getSubStore(c))?d.removeAll(!0):d=a.createSubStore(c),Ext.isEmpty(e)||(d.loadData(e),delete b[c]))}},this)),a.commit()}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.JsonWriter=Ext.extend(Ext.data.JsonWriter,{constructor:function(a){a=a||{};Ext.applyIf(a,{writeAllFields:!1,encode:!1});Zarafa.core.data.JsonWriter.superclass.constructor.call(this,a)},renderData:function(a){if(Array.isArray(a))for(var b=0,c=a.length;b<c;b++)this.renderData(a[b]);else Ext.iterate(a,function(b,c){Ext.isDate(c)&&(a[b]=Math.floor(c.getTime()/1E3));Ext.isObject(c)&&this.renderData(c)},this)},render:function(a,b,c){Ext.apply(c,b,a);this.renderData(c);Zarafa.core.data.JsonWriter.superclass.render.call(this,
a,b,c)},openRecord:function(a){return this.toIdHash(a)},createRecord:function(a){return this.toPropHash(a)},updateRecord:function(a){return this.toPropHash(a)},destroyRecord:function(a){return this.toIdHash(a)},toIdHash:function(a,b){var c={};Ext.each(a.getIdProps(),function(d){var e=a.get(d);if(b||Ext.isDefined(e))c[d]=e},this);this.addMessageActionsHash(c,a);return c},toPropHash:function(a){var b=this.toIdHash(a,!1);b.props=this.toHash.call(this,a);this.removeIdHashFromProps(b,a);for(var c in a.subStores)if(!0===
a.supportsSubStore(c)){var d=a.subStores[c];d&&d.writer&&Ext.apply(b,d.writer.toPropHash(a))}this.addMessageActionsHash(b,a);return b},removeIdHashFromProps:function(a,b){Ext.each(b.getIdProps(),function(b){Ext.isDefined(a.props)&&Ext.isDefined(a.props[b])&&delete a.props[b]},this)},addMessageActionsHash:function(a,b){var c=b.getMessageActions(),d={};if(Ext.isDefined(c)){for(var e in c)Ext.isDefined(c[e])&&(d[e]=c[e]);a.message_action=d}}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.MAPIProxy=Ext.extend(Ext.data.DataProxy,{listModuleName:void 0,itemModuleName:void 0,activeRequestMapping:void 0,lastResponseTime:void 0,constructor:function(a){Ext.apply(this,a);Zarafa.core.data.MAPIProxy.superclass.constructor.call(this,a);this.activeRequestMapping={};this.lastResponseTime={}},isExecuting:function(a){return Ext.isEmpty(a)?!Ext.isEmpty(Object.keys(this.activeRequestMapping)):!Ext.isEmpty(this.activeRequestMapping[a])},addRequestId:function(a,b){Ext.isDefined(this.activeRequestMapping[a])?
this.activeRequestMapping[a].push(b):this.activeRequestMapping[a]=[b]},deleteRequestId:function(a){for(var b in this.activeRequestMapping)Array.isArray(this.activeRequestMapping[b])&&(this.activeRequestMapping[b].remove(a),Ext.isEmpty(this.activeRequestMapping[b])&&delete this.activeRequestMapping[b])},cancelRequests:function(a){if(this.activeRequestMapping[a]){for(var b=this.activeRequestMapping[a],c=0,d=b.length;c<d;c++)container.getRequest().cancelActiveRequest(b[c]);delete this.activeRequestMapping[a]}},
updateExecutionTimestamp:function(a,b){this.lastResponseTime[a]=b},lastExecutionTime:function(a){return this.lastResponseTime[a]||0},getListModuleName:function(a){return this.listModuleName},getItemModuleName:function(a){return this.itemModuleName},getResponseHandlerForRequest:Ext.emptyFn,request:function(a,b,c,d,e,f,g){switch(a){case "update":case "create":this.createUpdateAction(a,b,c,d,e,f,g);break;case "destroy":this.destroyAction(a,b,c,d,e,f,g);break;case "read":this.readAction(a,b,c,d,e,f,g);
break;case "open":this.openAction(a,b,c,d,e,f,g);break;case "import":this.importAction(a,b,c,d,e,f,g)}},createUpdateAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||Zarafa.core.Actions.save,a,b,c,d,e,f,g)},destroyAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||Zarafa.core.Actions["delete"],a,b,c,d,e,f,g)},openAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||Zarafa.core.Actions.open,a,b,c,d,e,f,g)},importAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||
Zarafa.core.Actions["import"],a,b,c,d,e,f,g)},readAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||Zarafa.core.Actions.list,a,b,c,d,e,f,g)},doRequests:function(a,b,c,d,e,f,g,h){!0===h.cancelPreviousRequest&&this.cancelRequests(a);container.getRequest().reset();if(c&&!0!==h.listRequest){var k=d.jsonData[e.meta.root];Array.isArray(c)||(c=[c]);Array.isArray(k)||(k=[k]);for(var l=0;l<c.length;l++){var m=c[l],n=k[l],p=this.getItemModuleName(m),m=this.getResponseHandlerForRequest(p,a,b,m,d,
e,f,g,h),n=container.getRequest().addRequest(p,a,n,m);this.addRequestId(a,n)}}else p=this.getListModuleName(c),m=this.getResponseHandlerForRequest(p,a,b,c,d,e,f,g,h),n=container.getRequest().addRequest(p,a,d,m),this.addRequestId(a,n);container.getRequest().send()}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.MAPIRecord=Ext.extend(Ext.data.Record,{baseIdProperties:["entryid","store_entryid","parent_entryid"],idProperties:void 0,subStores:void 0,subStoresTypes:void 0,eventPropagation:!0,trackUpdateModifications:!1,updateModifications:void 0,updateSubStoreModifications:void 0,editingCount:0,actions:void 0,isModalDialogRecord:!1,constructor:function(a,b,c){Zarafa.core.data.MAPIRecord.superclass.constructor.call(this,a,b);this.idProperties=this.baseIdProperties.clone();this.actions={};this.subStores=
{};this.subStoresTypes={};c&&(this.subStoresTypes=c.getSubStores())},copy:function(a){a=Zarafa.core.data.RecordFactory.createRecordObjectByRecordData(this.data,a||this.id);a.idProperties=this.idProperties.clone();a.phantom=this.phantom;return a.applyData(this,!0)},applyData:function(a,b){this.beginEdit();this.trackUpdateModifications=a.trackUpdateModifications;var c=a.isModalDialogRecord?a.modified:a.data,d;for(d in c)"message_class"!==d&&(Ext.isDate(a.data[d])?this.set(d,a.data[d].clone()):this.set(d,
a.data[d]));this.actions=Ext.apply({},a.actions);this.idProperties.equals(a.idProperties)&&(this.createSubStores(),this.mergeSubStores(a.subStores,b),a.isOpened()&&!this.isOpened()&&this.afterOpen());this.endEdit();return this},save:function(){this.getStore().save(this)},equals:Ext.emptyFn,setEventPropagation:function(a){this.eventPropagation=a},hasEventPropagation:function(){return this.eventPropagation},setUpdateModificationsTracking:function(a){this.trackUpdateModifications=a},getUpdateModificationsTracking:function(){return this.trackUpdateModifications},
getStore:function(){return this.store},open:function(a){(!this.isOpened()||a&&!0===a.forceLoad)&&this.store.open(this,a)},afterOpen:function(){this.opened=!0;this.createSubStores();delete this.updateModifications;delete this.updateSubStoreModifications},isOpened:function(){return!0===this.opened},set:function(a,b,c){Ext.isDefined(c)||(c=this.fields.get(a),c=Ext.isDefined(c)?c.forceProtocol:!1);if(!0===this.trackUpdateModifications){var d=Ext.isPrimitive(b)?String:Ext.encode;if(d(this.data[a])!==d(b))this.updateModifications||
(this.updateModifications={}),void 0===this.updateModifications[a]&&(this.updateModifications[a]=this.data[a]);else if(!0!==c)return}Zarafa.core.data.MAPIRecord.superclass.set.call(this,a,b);this.modified=this.modified||{};!0===c&&void 0===this.modified[a]&&(this.modified[a]=this.data[a])},afterEdit:function(){Zarafa.core.data.MAPIRecord.superclass.afterEdit.call(this);delete this.updateModifications;delete this.updateSubStoreModifications},afterReject:function(){Zarafa.core.data.MAPIRecord.superclass.afterReject.call(this);
delete this.updateModifications;delete this.updateSubStoreModifications},beginEdit:function(){this.editingCount++;1>this.editingCount&&(this.editingCount=1);1===this.editingCount&&(Zarafa.core.data.MAPIRecord.superclass.beginEdit.call(this),this.updateModifications=this.updateModifications||{},this.updateSubStoreModifications=this.updateSubStoreModifications||{})},cancelEdit:function(){this.editingCount--;0>this.editingCount&&(this.editingCount=0);0===this.editingCount&&(Zarafa.core.data.MAPIRecord.superclass.cancelEdit.call(this),
delete this.updateModifications,delete this.updateSubStoreModifications)},endEdit:function(){this.editingCount--;0>this.editingCount&&(this.editingCount=0);0===this.editingCount&&Zarafa.core.data.MAPIRecord.superclass.endEdit.call(this)},commit:function(a){delete this.updateModifications;delete this.updateSubStoreModifications;for(var b in this.subStores)this.subStores[b].commitChanges();Zarafa.core.data.MAPIRecord.superclass.commit.call(this,a)},isModifiedSinceLastUpdate:function(a){return!0===this.trackUpdateModifications?
!(!this.updateModifications||!this.updateModifications.hasOwnProperty(a)):this.isModified(a)},isSubStoreModifiedSincelastUpdate:function(a){if(!0===this.trackUpdateModifications)return!(!this.updateSubStoreModifications||!this.updateSubStoreModifications.hasOwnProperty(a));a=this.getSubStore(a);return!Ext.isEmpty(a.modified)||!Ext.isEmpty(a.removed)},getSubStoreChangesSinceLastUpdate:function(a){if(!0===this.trackUpdateModifications){if(this.updateSubStoreModifications&&this.updateSubStoreModifications[a])return this.updateSubStoreModifications[a].changes}else return a=
this.getSubStore(a),[].concat(a.modified,a.removed)},getMessageActions:function(){return this.actions},getMessageAction:function(a){return this.actions[a]?this.actions[a]:!1},addMessageAction:function(a,b){this.actions[a]=b;Ext.isDefined(this.store)&&-1==this.store.modified.indexOf(this)&&this.store.modified.push(this)},deleteMessageAction:function(a){delete this.actions[a]},hasMessageAction:function(a){return Ext.isDefined(this.actions[a])},clearMessageActions:function(){this.actions={}},clearActionResponse:function(){delete this.action_response},
getActionResponse:function(a){if(this.action_response)return this.action_response[a]},copyTo:function(a){this.addMessageAction("action_type","copy");this.addMessageAction("destination_parent_entryid",a.get("entryid"));this.addMessageAction("destination_store_entryid",a.get("store_entryid"))},moveTo:function(a){this.addMessageAction("action_type","move");this.addMessageAction("destination_parent_entryid",a.get("entryid"));this.addMessageAction("destination_store_entryid",a.get("store_entryid"))},supportsSubStore:function(a){return Ext.isFunction(this.subStoresTypes[a])},
createSubStore:function(a){if(this.supportsSubStore(a)){var b=this.getSubStore(a);Ext.isDefined(b)||(b=this.setSubStore(a,new this.subStoresTypes[a]),b.on("update",this.onSubStoreUpdate,this),b.on("add",this.onSubStoreChange,this),b.on("remove",this.onSubStoreChange,this));return b}},createSubStores:function(){for(var a in this.subStoresTypes)this.getSubStore(a)||this.createSubStore(a)},getSubStore:function(a){if(null!==this.subStores)return this.subStores[a]},setSubStore:function(a,b){null===this.subStores?
this.subStores={name:b}:this.subStores[a]=b;b.setParentRecord(this);return b},mergeSubStore:function(a,b,c){var d=this.getSubStore(a);if(d&&b)if(!0!==c){var e="attachments"===a?"attach_id":"entryid";d.each(function(a){0>b.findBy(function(b){return this.idComparison(a.get(e),b.get(e))},this)&&d.remove(a)},this);b.each(function(a){0>d.findBy(function(b){return this.idComparison(a.get(e),b.get(e))},this)&&d.add(a.copy())},this)}else d.removeAll(!0),d.add(b.getRange(),!0),d.fireEvent("datachanged",d)},
idComparison:function(a,b){a=Zarafa.core.EntryId.hasContactProviderGUID(a)?Zarafa.core.EntryId.unwrapContactProviderEntryId(a):a;b=Zarafa.core.EntryId.hasContactProviderGUID(b)?Zarafa.core.EntryId.unwrapContactProviderEntryId(b):b;return Zarafa.core.EntryId.compareEntryIds(a,b)},mergeSubStores:function(a,b){for(var c in a)this.supportsSubStore(c)&&this.mergeSubStore(c,a[c],b)},onSubStoreChange:function(a,b){for(var c in this.subStores)if(this.subStores[c]===a){if(!0===this.trackUpdateModifications){this.updateSubStoreModifications||
(this.updateSubStoreModifications={});Ext.isDefined(b)||(b=a.getRange());var d=this.updateSubStoreModifications[c];d?d.changes=d.changes.concat(b):(d={store:a,changes:[].concat(b)},this.updateSubStoreModifications[c]=d)}this.dirty=!0;this.modified=this.modified||{};this.editing||this.afterEdit();break}},onSubStoreUpdate:function(a,b,c){if(c!==Ext.data.Record.COMMIT)this.onSubStoreChange(a,b)},addIdProp:function(a){this.hasIdProp(a)||this.idProperties.push(a)},hasIdProp:function(a){return-1<this.idProperties.indexOf(a)},
removeIdProp:function(a){this.hasIdProp(a)&&this.idProperties.splice(this.idProperties.indexOf(a),1)},getIdProps:function(){return this.idProperties},getDisplayType:function(){var a=this.get("display_type"),b=this.get("display_type_ex");switch(a){case Zarafa.core.mapi.DisplayType.DT_MAILUSER:case Zarafa.core.mapi.DisplayType.DT_DISTLIST:a=b&~Zarafa.core.mapi.DisplayTypeEx.DTE_FLAG_ACL_CAPABLE}return a},destroy:function(){for(var a in this.subStores)this.subStores[a].destroy();this.subStores=null}});
Ext.namespace("Zarafa.core.data");Ext.data.Api.actions.open="open";
Zarafa.core.data.MAPIStore=Ext.extend(Ext.data.GroupingStore,{persistentFilter:!0,filterFn:void 0,filterScope:void 0,isSaving:!1,constructor:function(a){a=a||{};Ext.applyIf(a,{autoSave:!1,batch:!0});this.addEvents("open");Zarafa.core.data.MAPIStore.superclass.constructor.call(this,a);this.data.getKey=this.getRecordKey;this.initEvents()},initEvents:function(){this.on("beforeload",this.onBeforeLoad,this);this.on("add",this.onAdd,this);this.on("remove",this.onRemove,this);this.on("write",this.onWrite,
this);this.on("beforesave",function(){this.isSaving=!0},this);this.on("save",function(){this.isSaving=!1},this)},getRecordKey:Ext.util.MixedCollection.prototype.getKey,isExecuting:function(a){return this.proxy.isExecuting(a)},cancelLoadRequests:function(){this.isExecuting("list")&&this.proxy.cancelRequests("list");this.isExecuting("open")&&this.proxy.cancelRequests("open")},lastExecutionTime:function(a){return this.proxy.lastExecutionTime(a)},reload:function(a){a=Ext.applyIf(a||{},{reload:!0});Zarafa.core.data.MAPIStore.superclass.reload.call(this,
a)},save:function(a){if(!Ext.isDefined(a))return Zarafa.core.data.MAPIStore.superclass.save.call(this);Array.isArray(a)||(a=[a]);if(!this.writer)throw new Ext.data.Store.Error("writer-undefined");for(var b=[],c=[],d=[],e=[],f={},g=0,h=a.length;g<h;g++){var k=a[g];0<=this.removed.indexOf(k)?b.push(k):0<=this.modified.indexOf(k)&&k.isValid()&&(k.phantom?c.push(k):d.push(k))}0<b.length&&e.push(["destroy",b]);0<c.length&&e.push(["create",c]);0<d.length&&e.push(["update",d]);if(h=e.length){b=++this.batchCounter;
for(g=0;g<h;++g)a=e[g],f[a[0]]=a[1];if(!1!==this.fireEvent("beforesave",this,f)){for(g=0;g<h;++g)a=e[g],this.doTransaction(a[0],a[1],b);return b}}return-1},onBeforeLoad:function(){this.isExecuting("open")&&this.proxy.cancelRequests("open")},onAdd:function(a,b,c){this.setRecordsStore(a,b)},onRemove:function(a,b,c){this.setRecordsStore(void 0,b)},onWrite:function(a,b,c,d,e){Array.isArray(e)||(e=[e]);a=0;for(b=e.length;a<b;a++)e[a].clearMessageActions(),e[a].clearActionResponse()},setRecordsStore:function(a,
b){b=Array.isArray(b)?b:[b];Ext.each(b,function(b){b.join(a)},this)},open:function(a,b){try{return this.execute("open",a,b)}catch(c){return this.handleException(c),!1}},onOpenRecords:function(a,b,c){if(!0===a&&-1<this.indexOf(b))try{this.reader.update(b,c),b.afterOpen(),this.fireEvent("open",this,b,b)}catch(d){if(this.handleException(d),Array.isArray(b))this.onOpenRecords(a,b,c)}},getById:function(a){var b=Zarafa.core.data.MAPIStore.superclass.getById.call(this,a);if(!b){var c=this.findBy(function(b){return this.idComparison(a,
b.id)},this);0<=c&&(b=this.getAt(c))}return b},idComparison:function(a,b){return a===b},filterBy:function(a,b){this.filterFn=a;this.filterScope=b;Zarafa.core.data.MAPIStore.superclass.filterBy.apply(this,arguments)},clearFilter:function(){delete this.filterFn;delete this.filterScope;Zarafa.core.data.MAPIStore.superclass.clearFilter.apply(this,arguments)},loadRecords:function(a,b,c){Zarafa.core.data.MAPIStore.superclass.loadRecords.apply(this,arguments);!0!==this.persistentFilter||this.isDestroyed||
b&&!0===b.add||this.filterFn&&this.filterBy(this.filterFn,this.filterScope)},clearData:function(){this.data.each(function(a){a.destroy()});Zarafa.core.data.MAPIStore.superclass.clearData.apply(this,arguments)},sortBy:function(a,b){this.data.sort(a,b);this.snapshot&&this.snapshot!=this.data&&this.snapshot.sort(a,b);this.fireEvent("datachanged",this)},clearGrouping:function(){this.groupField&&Zarafa.core.data.MAPIStore.superclass.clearGrouping.apply(this,arguments)},destroy:function(){this.isDestroyed||
this.cancelLoadRequests();Zarafa.core.data.MAPIStore.superclass.destroy.apply(this,arguments)}});Ext.reg("zarafa.mapistore",Zarafa.core.data.MAPIStore);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.NoSyncStore=Ext.extend(Ext.util.Observable,{recordType:void 0,fields:void 0,hasMultiSort:!1,sortToggle:void 0,sortField:void 0,sortDir:"ASC",sortInfo:void 0,constructor:function(a){a=a||{};Ext.apply(this,a);this.recordType&&(this.fields=this.recordType.prototype.fields);this.addEvents("add","remove","update","clear");this.sortToggle={};this.sortField?this.setDefaultSort(this.sortField,this.sortDir):this.sortInfo&&this.setDefaultSort(this.sortInfo.field,this.sortInfo.direction);Zarafa.core.data.NoSyncStore.superclass.constructor.call(this,
a);this.initEvents();this.initData()},initData:function(){this.data=new Ext.util.MixedCollection(!1);this.data.getKey=function(a){return a.id};this.removed=[];this.modified=[]},initEvents:function(){this.on({scope:this,add:this.createRecords,remove:this.destroyRecord,clear:this.onClear})},destroy:function(){this.isDestroyed||(this.clearData(),this.data=null,this.purgeListeners(),this.isDestroyed=!0)},add:function(a,b){a=[].concat(a);if(!(1>a.length)){for(var c=0,d=a.length;c<d;c++)a[c].join(this);
c=this.data.length;this.data.addAll(a);this.snapshot&&this.snapshot.addAll(a);!0!==b&&this.fireEvent("add",this,a,c)}},remove:function(a,b){Array.isArray(a)&&Ext.each(a,function(a){this.remove(a,b)},this);var c=this.data.indexOf(a);this.snapshot&&this.snapshot.remove(a);-1<c&&(a.join(null),this.data.removeAt(c),this.modified.remove(a),!0!==b&&this.fireEvent("remove",this,a,c))},removeAt:function(a,b){this.remove(this.getAt(a),b)},removeAll:function(a){var b=[];this.each(function(a){b.push(a)});this.clearData();
this.snapshot&&this.snapshot.clear();this.modified=[];this.removed=[];!0!==a&&this.fireEvent("clear",this,b)},removeIf:function(a,b){this.each(function(c){a.call(b||this,c)&&this.remove(c)},this)},insert:function(a,b){b=[].concat(b);for(var c=0,d=b.length;c<d;c++)this.data.insert(a,b[c]),b[c].join(this);this.snapshot&&this.snapshot.addAll(b);this.fireEvent("add",this,b,a)},indexOf:function(a){return this.data.indexOf(a)},indexOfId:function(a){return this.data.indexOfKey(a)},getAt:function(a){return this.data.itemAt(a)},
getRange:function(a,b){return this.data.getRange(a,b)},getCount:function(){return this.data.length},getTotalCount:function(){return this.getCount()},each:function(a,b){this.data.each(a,b)},getModifiedRecords:function(){return this.modified},getRemovedRecords:function(){return this.removed},afterEdit:function(a){-1===this.modified.indexOf(a)&&this.modified.push(a);this.fireEvent("update",this,a,Ext.data.Record.EDIT)},afterReject:function(a){this.modified.remove(a);this.fireEvent("update",this,a,Ext.data.Record.REJECT)},
afterCommit:function(a){this.modified.remove(a);this.fireEvent("update",this,a,Ext.data.Record.COMMIT)},commitChanges:function(){for(var a=this.modified.slice(0),b=0,c=a.length;b<c;b++){var d=a[b];d.phantom=!1;d.commit()}this.modified=[];this.removed=[]},clearData:function(){this.data.clear()},createRecords:function(a,b,c){a=0;for(c=b.length;a<c;a++)b[a].phantom&&b[a].isValid()&&(b[a].markDirty(),this.modified.push(b[a]))},destroyRecord:function(a,b,c){-1!==this.modified.indexOf(b)&&this.modified.remove(b);
b.phantom||this.removed.push(b)},onClear:function(a,b){Ext.each(b,function(a,b){this.destroyRecord(this,a,b)},this)},getSortState:Ext.data.Store.prototype.getSortState,applySort:Ext.data.Store.prototype.applySort,sortData:Ext.data.Store.prototype.sortData,createSortFunction:Ext.data.Store.prototype.createSortFunction,setDefaultSort:Ext.data.Store.prototype.setDefaultSort,sort:Ext.data.Store.prototype.sort,singleSort:Ext.data.Store.prototype.singleSort,multiSort:Ext.data.Store.prototype.multiSort,
sum:Ext.data.Store.prototype.sum,createFilterFn:Ext.data.Store.prototype.createFilterFn,filter:Ext.data.Store.prototype.filter,filterBy:Ext.data.Store.prototype.filterBy,query:Ext.data.Store.prototype.query,queryBy:Ext.data.Store.prototype.queryBy,find:Ext.data.Store.prototype.find,findExact:Ext.data.Store.prototype.findExact,findBy:Ext.data.Store.prototype.findBy,getById:Ext.data.Store.prototype.getById,clearFilter:Ext.data.Store.prototype.clearFilter,isFiltered:Ext.data.Store.prototype.isFiltered,
collect:Ext.data.Store.prototype.collect,onMetaChange:Ext.data.Store.prototype.onMetaChange});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.NotificationResolver=Ext.extend(Ext.util.Observable,{constructor:function(a){a=a||{};Ext.apply(this,a);Zarafa.core.data.NotificationResolver.superclass.constructor.call(this,a)},getHandlerForResponse:function(a,b){var c;if(!Ext.isObject(b))return null;c="hierarchynotifier"==a||"newmailnotifier"==a||"addressbooknotifier"==a||"newtodotasknotifier"==a?this.getHandlersForIPFResponse(b):this.getHandlersForIPMResponse(b);return Array.isArray(c)?1<c.length?new Zarafa.core.data.CompositeResponseHandler({handlers:c}):
c[0]:c},getHandlersForIPFResponse:function(a){var b=[];if(a.folders||a.newmail){var c=a.folders;Ext.isDefined(c)&&!Ext.isEmpty(c.item)&&(b=b.concat(Ext.pluck(c.item,"store_entryid")));b=Zarafa.core.data.IPFStoreMgr.getStoresForStores(b);Ext.isDefined(a.newmail)&&b.push(container.getHierarchyStore());if(Array.isArray(b)){a=[];for(var c=0,d=b.length;c<d;c++)a.push(new Zarafa.hierarchy.data.HierarchyNotificationResponseHandler({store:b[c],reader:b[c].reader,notifyObject:b[c]}));return a}}else{if(a.stores)return b=
container.getHierarchyStore(),new Zarafa.hierarchy.data.HierarchyNotificationResponseHandler({store:b,reader:b.reader,notifyObject:b});if(a.addressbook)return b=Zarafa.addressbook.AddressBookHierarchyStore,new Zarafa.addressbook.AddressBookHierarchyNotificationResponseHandler({store:b,notifyObject:b});if(a.newtodotask)return b=container.getContextByName("task").getModel().getStore(),new Zarafa.task.data.TodoTaskListNotificationResponseHandler({store:b,notifyObject:b})}},getHandlersForIPMResponse:function(a){var b=
[],c=a.newobject;Ext.isDefined(c)&&Array.isArray(c.item)&&(b=b.concat(Ext.pluck(c.item,"entryid")));c=a.update;Ext.isDefined(c)&&Array.isArray(c.item)&&(b=b.concat(Ext.pluck(c.item,"parent_entryid")));a=a["delete"];Ext.isDefined(a)&&Array.isArray(a.item)&&(b=b.concat(Ext.pluck(a.item,"parent_entryid")));b=Zarafa.core.data.IPMStoreMgr.getStoresForFolders(b);if(Array.isArray(b)){a=[];for(var c=0,d=b.length;c<d;c++)a.push(new Zarafa.core.data.IPMNotificationResponseHandler({store:b[c],reader:b[c].reader,
notifyObject:b[c]}));return a}return new Zarafa.core.data.IPMNotificationResponseHandler({store:b,reader:b.reader,notifyObject:b})}});Ext.namespace("Zarafa.core.data");Zarafa.core.data.Notifications={newMail:"newMail",objectCreated:"objectCreated",objectDeleted:"objectDeleted",objectModified:"objectModified"};Ext.namespace("Zarafa.core.data");
Zarafa.core.data.PresenceCache=Ext.extend(Object,{cache:{},getUser:function(a,b){if(a.hasOwnProperty("entryid")&&a.entryid in this.cache)return!0!==b&&this.syncUsers([a]),this.cache[a.entryid]},syncUsers:function(a){Ext.each(a,function(b,c){var d=this.getUser(b,!0);Ext.isDefined(d)?this.cache[b.entryid].user.syncWithUser(b):this.cache[b.entryid]={user:b,statusByPlugin:{},status:Zarafa.core.data.PresenceStatus.UNKNOWN};d=this.cache[b.entryid].user;a[c]=d},this);return a},getStatusForUser:function(a){return a?
(a=this.getUser(a))&&a.status:Zarafa.core.data.PresenceStatus.UNKNOWN},addStatusForUser:function(a,b,c){var d=this.getUser(b);Ext.isDefined(d)?d.statusByPlugin[a]=c:(d={},d[a]=c,this.cache[b.entryid]={user:b,statusByPlugin:d});var e=this.cache[b.entryid];e.status=Zarafa.core.data.PresenceStatus.UNKNOWN;Ext.iterate(e.statusByPlugin,function(a){e.statusByPlugin[a]>e.status&&(e.status=e.statusByPlugin[a])},this)},getUserInfoList:function(){return Object.keys(this).map(function(a){return this.cache[a].user},
this)}});Zarafa.core.data.PresenceCache=new Zarafa.core.data.PresenceCache;Ext.namespace("Zarafa.core.data");Zarafa.core.data.Record={create:function(a,b){var c=Ext.extend(b||Ext.data.Record,{}),d=c.prototype;d.fields=new Ext.util.MixedCollection(!1,function(a){return a.name});this.addFields(d,a||[]);c.getField=function(a){return d.fields.get(a)};return c},addFields:function(a,b){for(var c=0,d=b.length;c<d;c++)Array.isArray(b[c])?this.addFields(a,b[c]):a.fields.add(new Ext.data.Field(b[c]))}};Ext.namespace("Zarafa.core.data");
Zarafa.core.data.RecordDefinition=Ext.extend(Ext.util.Observable,{parent:void 0,type:void 0,cfg:void 0,base:void 0,subStores:void 0,fields:void 0,defaults:void 0,createDefaults:void 0,constructor:function(a){this.addEvents(["createphantom","createrecord"]);this.parent=a.parent;delete a.parent;this.cfg=Ext.apply({},a);Zarafa.core.data.RecordDefinition.superclass.constructor.call(this,a)},createRecord:function(a,b){var c=this.getType(),d={};Ext.apply(d,this.getFieldDefaultValues());Ext.isDefined(b)||
Ext.apply(d,this.getDefaultValues());a&&Ext.apply(d,a);c=new c(d,b,this);c.phantom?this.fireEvent("createphantom",c,a):this.fireEvent("createrecord",c,a);c.commit();return c},getType:function(){if(!Ext.isDefined(this.type)){var a=this.getBaseClass(),b=this.getFields();this.type=Zarafa.core.data.Record.create(b,a)}return this.type},setBaseClass:function(a){this.cfg.base=a},getBaseClass:function(){Ext.isDefined(this.base)||(this.cfg.base?this.base=this.cfg.base:Ext.isDefined(this.parent)?this.base=
this.parent.getBaseClass():this.base=Ext.data.Record);return this.base},setSubStore:function(a,b){this.cfg.subStores=Ext.value(this.cfg.subStores,{});this.cfg.subStores[a]=b},getSubStores:function(){this.subStores||(this.subStores={},Ext.isDefined(this.parent)&&Ext.apply(this.subStores,this.parent.getSubStores()),Ext.apply(this.subStores,this.cfg.subStores));return Ext.apply({},this.subStores)},addField:function(a){this.cfg.fields=Ext.value(this.cfg.fields,[]);Array.isArray(a)?this.cfg.fields=this.cfg.fields.concat(a):
this.cfg.fields.push(a)},getFields:function(){this.fields||(this.fields=[],Ext.isDefined(this.parent)&&(this.fields=this.fields.concat(this.parent.getFields())),this.cfg.fields&&(this.fields=this.fields.concat(this.cfg.fields)));return this.fields},addDefaultValue:function(a,b){this.cfg.defaults=Ext.value(this.cfg.defaults,{});var c=Ext.isString(a)?a:a.name;this.cfg.defaults[c]=b},getDefaultValues:function(){this.defaults||(this.defaults={},Ext.isDefined(this.parent)&&Ext.apply(this.defaults,this.parent.getDefaultValues()),
this.cfg.defaults&&Ext.apply(this.defaults,this.cfg.defaults));return this.defaults},getFieldDefaultValues:function(){if(!this.fieldDefaults){var a=this.getFields();this.fieldDefaults={};for(var b=0,c=a.length;b<c;b++){var d=a[b],e=d.defaultValue;Ext.isDefined(e)||(e=Ext.data.Field.prototype.defaultValue);this.fieldDefaults[d.name]=e}Ext.apply(this.fieldDefaults,this.cfg.createDefaults)}return this.fieldDefaults},fireEvent:function(){Ext.isDefined(this.parent)&&this.parent.fireEvent.apply(this.parent,
arguments);Zarafa.core.data.RecordDefinition.superclass.fireEvent.apply(this,arguments)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.RecordFactory={definitions:{},getMessageClassParent:function(a){var b=a.lastIndexOf(".");if(0<b)return a.substr(0,b)},getMessageClassParentDefinition:function(a){a=this.getMessageClassParent(a);if(Ext.isDefined(a))return this.getRecordDefinitionByMessageClass(a)},createRecordDefinition:function(a,b,c){b=new Zarafa.core.data.RecordDefinition({base:void 0,parent:b,createDefaults:c});return this.definitions[a]=b},getRecordDefinitionByCustomType:function(a){var b=this.definitions[a];
return Ext.isDefined(b)?b:this.createRecordDefinition(a,void 0)},getRecordDefinitionByObjectType:function(a){var b=this.definitions[a];return Ext.isDefined(b)?b:this.createRecordDefinition(a,void 0,{object_type:a})},getRecordDefinitionByMessageClass:function(a){var b=a.toUpperCase(),c=this.definitions[b];if(Ext.isDefined(c))return c;c=this.getMessageClassParentDefinition(b);Ext.isDefined(c)||(c=this.definitions.IPM);return this.createRecordDefinition(b,c,{message_class:a})},createRecordObjectByCustomType:function(a,
b,c){return this.getRecordDefinitionByCustomType(a).createRecord(b,c)},createRecordObjectByObjectType:function(a,b,c){return this.getRecordDefinitionByObjectType(a).createRecord(b,c)},createRecordObjectByMessageClass:function(a,b,c){return this.getRecordDefinitionByMessageClass(a).createRecord(b,c)},createRecordObjectByRecordData:function(a,b){if(!Ext.isEmpty(a.message_class))return this.createRecordObjectByMessageClass(a.message_class,a,b);if(!Ext.isEmpty(a.object_type))return this.createRecordObjectByObjectType(a.object_type,
a,b)},getRecordClassByCustomType:function(a){return this.getRecordDefinitionByCustomType(a).getType()},getRecordClassByObjectType:function(a){return this.getRecordDefinitionByObjectType(a).getType()},getRecordClassByMessageClass:function(a){return this.getRecordDefinitionByMessageClass(a).getType()},getRecordClassByRecordData:function(a){if(Ext.isDefined(a.message_class))return this.getRecordClassByMessageClass(a.message_class);if(Ext.isDefined(a.object_type))return this.getRecordClassByObjectType(a.object_type)},
setBaseClassToCustomType:function(a,b){this.getRecordDefinitionByCustomType(a).setBaseClass(b)},setBaseClassToObjectType:function(a,b){this.getRecordDefinitionByObjectType(a).setBaseClass(b)},setBaseClassToMessageClass:function(a,b){this.getRecordDefinitionByMessageClass(a).setBaseClass(b)},setSubStoreToCustomType:function(a,b,c){this.getRecordDefinitionByCustomType(a).setSubStore(b,c)},setSubStoreToObjectType:function(a,b,c){this.getRecordDefinitionByObjectType(a).setSubStore(b,c)},setSubStoreToMessageClass:function(a,
b,c){this.getRecordDefinitionByMessageClass(a).setSubStore(b,c)},addFieldToCustomType:function(a,b){this.getRecordDefinitionByCustomType(a).addField(b)},addFieldToObjectType:function(a,b){this.getRecordDefinitionByObjectType(a).addField(b)},addFieldToMessageClass:function(a,b){this.getRecordDefinitionByMessageClass(a).addField(b)},addDefaultValueToCustomType:function(a,b,c){this.getRecordDefinitionByCustomType(a).addDefaultValue(b,c)},addDefaultValueToObjectType:function(a,b,c){this.getRecordDefinitionByObjectType(a).addDefaultValue(b,
c)},addDefaultValueToMessageClass:function(a,b,c){this.getRecordDefinitionByMessageClass(a).addDefaultValue(b,c)},addListenerToCustomType:function(a,b,c,d,e){this.getRecordDefinitionByCustomType(a).on(b,c,d,e)},addListenerToObjectType:function(a,b,c,d,e){this.getRecordDefinitionByObjectType(a).on(b,c,d,e)},addListenerToMessageClass:function(a,b,c,d,e){this.getRecordDefinitionByMessageClass(a).on(b,c,d,e)}};Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ServerConfig=Ext.extend(Object,{meta:void 0,constructor:function(a){this.meta=a},getBaseUrl:function(){return this.meta.base_url},getWebappTitle:function(){return this.meta.webapp_title},isFullGabDisabled:function(){return!0===this.meta.disable_full_gab},isSharedRulesEnabled:function(){return!0===this.meta.enable_shared_rules},usingSSO:function(){return this.meta.using_sso},isPluginsEnabled:function(){return this.meta.enable_plugins},getAlwaysEnabledPluginsList:function(){return this.meta.always_enabled_plugins||
""},isAdvancedSettingsEnabled:function(){return this.meta.enable_advanced_settings},getMaxAttachments:function(){return this.meta.max_attachments},getMaxFileUploads:function(){return this.meta.max_file_uploads},getMaxPostRequestSize:function(){return this.meta.post_max_size},getMaxAttachmentSize:function(){return this.meta.max_attachment_size},getMaxAttachmentTotalSize:function(){return this.meta.max_attachment_total_size},getFreebusyLoadStartOffset:function(){return this.meta.freebusy_load_start_offset},
getFreebusyLoadEndOffset:function(){return this.meta.freebusy_load_end_offset},getMaxEmlFilesInZIP:function(){return this.meta.maximum_eml_files_in_zip},getClientTimeout:function(){return this.meta.client_timeout},getActiveTheme:function(){return this.meta.active_theme},getPluginsVersion:function(){return this.meta.version_info},isImportSupported:function(){return this.meta.is_vcfimport_supported},getColorSchemes:function(){return this.meta.color_schemes},getAdditionalColorSchemes:function(){return this.meta.additional_color_schemes},
getDefaultCategories:function(){return this.meta.default_categories},getAdditionalDefaultCategories:function(){return this.meta.additional_default_categories},getContactPrefix:function(){return this.meta.contact_prefix},getContactSuffix:function(){return this.meta.contact_suffix},getPowerpasteConfig:function(){return this.meta.powerpaste}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.SettingsStateProvider=Ext.extend(Ext.state.Provider,{basePath:"zarafa/v1/state",constructor:function(a){Ext.apply(this,a);Zarafa.core.data.SettingsStateProvider.superclass.constructor.call(this,a)},getStatePath:function(a){return this.basePath+"/"+a.getStateName()},encodeValue:function(a,b,c){if(Array.isArray(a))for(var d=0,e=a.length;d<e;d++)a[d]=this.encodeValue(a[d],b,c);else if(Ext.isObject(a))for(d in a)a[d]=this.encodeValue(a[d],d,c);else"height"!==b&&"width"!==b||!0!==c.statefulRelativeDimensions||
(a=this.scaleSizeToPercentage(c,a,b));return a},decodeValue:function(a,b,c){if(Array.isArray(a))for(var d=0,e=a.length;d<e;d++)a[d]=this.decodeValue(a[d],b,c);else if(Ext.isObject(a))for(d in a)a[d]=this.decodeValue(a[d],d,c);else("height"===b||"width"===b)&&1>=a&&(a=this.scaleSizeToBody(c,a,b));return a},scaleSizeToPercentage:function(a,b,c){c=Ext.util.Format.capitalize(c);b=parseFloat((b/window["inner"+c]).toFixed(2));return Math.min(b,1)},scaleSizeToBody:function(a,b,c){c=Ext.util.Format.capitalize(c);
var d=Zarafa.core.BrowserWindowMgr.getActive()["inner"+c],e=a["min"+c];c=a["max"+c];b=Math.round(b*d);if(a.minSize||a.maxSize)b=Math.min(Math.max(b,a.minSize||0),a.maxSize||b);else if(e||c)b=Math.min(Math.max(b,e||0),c||b);return b},set:function(a,b){var c=Ext.state.Manager.getComponent(a);container.getSettingsModel().set(this.getStatePath(c),this.encodeValue(b,void 0,c));this.fireEvent("statechange",this,a,b)},get:function(a,b){var c=Ext.state.Manager.getComponent(a),d=container.getSettingsModel().get(this.getStatePath(c),
!0);Ext.isObject(b)&&(d=Ext.apply(b,d));return this.decodeValue(d,void 0,c)},clear:function(a){var b=Ext.state.Manager.getComponent(a);container.getSettingsModel().restore(this.getStatePath(b));this.fireEvent("statechange",this,a,null)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.StatefulObservable=Ext.extend(Ext.util.Observable,{stateful:!1,stateId:void 0,stateEvents:void 0,statefulName:void 0,constructor:function(a){Ext.apply(this,a);Zarafa.core.data.StatefulObservable.superclass.constructor.call(this,a);!1!==this.stateful&&(this.stateId||(this.stateId=Ext.id(null,"state-")),Ext.state.Manager.register(this),this.initStateEvents())},getStateName:function(){return this.statefulName},getStateId:function(){return this.stateId||this.id},initStateEvents:function(){if(this.stateEvents)for(var a=
0,b;b=this.stateEvents[a];a++)this.on(b,this.saveState,this,{delay:100})},initState:function(){if(Ext.state.Manager){var a=this.getStateId();a&&(a=Ext.state.Manager.get(a))&&!1!==this.fireEvent("beforestaterestore",this,a)&&(this.applyState(Ext.apply({},a)),this.fireEvent("staterestore",this,a))}},applyState:function(a){a&&Ext.apply(this,a)},getState:function(){return null},saveState:function(){if(Ext.state.Manager&&!1!==this.stateful){var a=this.getStateId();if(a){var b=this.getState();!1!==this.fireEvent("beforestatesave",
this,b)&&(Ext.state.Manager.set(a,b),this.fireEvent("statesave",this,b))}}}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.UIFactory={layers:[],registerLayer:function(a){var b=a.index||0;if(0<this.layers.length)for(var c=0,d=this.layers.length;c<d;c++)if(this.layers[c].index>b){this.layers.splice(c,0,a);return}this.layers.push(a)},getPreferredLayer:function(a,b){var c=this.layers,d=0;if(a){if(a.manager)for(var e=0,f=c.length;e<f;e++)if(a.manager===c[e].manager){d=e;break}if(!0===a.modal)for(e=d,f=c.length;e<f;e++)!0===c[e].allowModal&&(d=e)}var g;a&&a.layerType?g=a.layerType:Ext.isDefined(b)&&null!==
b&&Ext.isFunction(b.isMessageClass)&&b.isMessageClass(["IPM.Note","IPM.Schedule.Meeting","REPORT.IPM","REPORT.IPM.Note"],!0)&&(g=container.getSettingsModel().get("zarafa/v1/main/base_content_layer"));if(!(!Zarafa.supportsPopOut()||Ext.isEmpty(g)||0!==d||a&&a.searchText))for(e=0,f=c.length;e<f;e++)if(c[e].type===g){d=e;break}return c[d]},openLayerComponent:function(a,b,c){if(a=container.getSharedComponent(a,b))if(a.prototype instanceof Ext.Component){var d=this.getPreferredLayer(c,b);c=Ext.applyIf(c||
{},{record:b,closable:!0,plugins:[]});c.plugins=c.plugins.concat(d.plugins);d.create(a,c)}else a.doOpen(b)},openViewRecord:function(a,b){this.openLayerComponent(Zarafa.core.data.SharedComponentType["common.view"],a,b)},openCreateRecord:function(a,b){this.openLayerComponent(Zarafa.core.data.SharedComponentType["common.create"],a,b)},openDefaultContextMenu:function(a,b){this.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu"],a,b)},openContextMenu:function(a,b,c){(a=container.getSharedComponent(a,
b))&&(new a(Ext.applyIf(c||{},{records:b}))).showAt(c.position)}};Ext.namespace("Zarafa.core.data");Zarafa.core.data.UIFactoryLayer=Ext.extend(Object,{type:"",index:void 0,plugins:void 0,allowModal:!1,manager:void 0,constructor:function(a){Ext.apply(this,a)},create:Ext.emptyFn});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.User=Ext.extend(Object,{meta:void 0,constructor:function(a){this.meta=a},getEntryId:function(){return this.meta.entryid},getSearchKey:function(){return this.meta.search_key},getDisplayName:function(){return this.meta.fullname||this.meta.username},getFullName:function(){return this.meta.fullname},getUserName:function(){return this.meta.username},getEmailAddress:function(){return this.meta.email_address},getSMTPAddress:function(){return this.meta.smtp_address},getSessionId:function(){return""},
getFirstName:function(){return this.meta.given_name},getInitials:function(){return this.meta.initials},getLastName:function(){return this.meta.surname},getAddress:function(){return this.meta.street_address},getCity:function(){return this.meta.locality},getState:function(){return this.meta.state_or_province},getZipCode:function(){return this.meta.postal_code},getCountry:function(){return this.meta.country},getTitle:function(){return this.meta.title},getCompany:function(){return this.meta.company_name},
getDepartment:function(){return this.meta.department_name},getOffice:function(){return this.meta.office_location},getAssistant:function(){return this.meta.assistant},getPhone:function(){return this.getPhoneBusiness()},getPhoneBusiness:function(){return this.meta.business_telephone_number||this.meta.office_telephone_number},getPhoneBusiness2:function(){return this.meta.business2_telephone_number},getFax:function(){return this.meta.primary_fax_number},getPhoneAssistant:function(){return this.meta.assistant_telephone_number},
getPhoneHome:function(){return this.meta.home_telephone_number},getPhoneHome2:function(){return this.meta.home2_telephone_number},getPhoneMobile:function(){return this.meta.mobile_telephone_number},getPhonePager:function(){return this.meta.pager_telephone_number}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.UserIdObject=Ext.extend(Object,{type:"",display_name:"",email_address:"",username:"",entryid:"",constructor:function(a){a.type&&(this.type=a.type);a.display_name&&(this.display_name=a.display_name);a.email_address&&(this.email_address=a.email_address);a.username&&(this.username=a.username);a.entryid&&(this.entryid=a.entryid)},equals:function(a){return Ext.isEmpty(this.entryid)||Ext.isEmpty(a.entryid)?!Ext.isEmpty(this.username)&&this.username===a.username||!Ext.isEmpty(this.email_address)&&
this.email_address===a.email_address||!Ext.isEmpty(this.username)&&this.username===a.email_address||!Ext.isEmpty(this.email_address)&&this.email_address===a.username?!0:!1:Zarafa.core.EntryId.compareEntryIds(this.entryid,a.entryid)},syncWithUser:function(a){"ZARAFA"===a.type&&("ZARAFA"!==this.type&&(this.type=a.type,this.display_name=a.display_name,this.username=a.username,this.entryid=a.entryid),Ext.isEmpty(this.email_address)&&(this.email_address=0<=a.username.indexOf("@")?a.username:a.smtp_address))}});
Ext.namespace("Zarafa.core.data");
Zarafa.core.data.UserIdObjectFactory={createFromRecord:function(a){if(!Ext.isFunction(a.get)||!Ext.isEmpty(a.get("object_type"))&&a.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_DISTLIST)return null;var b={};b.display_name=a.get("display_name");b.type=a.get("address_type");if("ZARAFA"===b.type){var c=a.get("entryid"),d=a.get("username"),e=a.get("email_address");a=a.get("smtp_address");b.entryid=c;Ext.isString(d)&&-1==d.indexOf("@")?b.username=d:Ext.isString(e)&&-1==e.indexOf("@")&&(b.username=
e);Ext.isString(e)&&0<e.indexOf("@")?b.email_address=e:Ext.isString(a)&&0<a.indexOf("@")?b.email_address=a:Ext.isString(d)&&0<d.indexOf("@")&&(b.email_address=d)}else{if(Ext.isEmpty(b.type))return null;b.email_address=a.get("email_address")||a.get("smtp_address");b.entryid=a.get("entryid")}b=new Zarafa.core.data.UserIdObject(b);return Zarafa.core.data.PresenceCache.syncUsers([b])[0]},createFromStore:function(a){if(!a.data)return[];var b=[];a=a.getRange();Ext.each(a,function(a){(a=Zarafa.core.data.UserIdObjectFactory.createFromRecord(a))&&
b.push(a)},this);return b}};Ext.namespace("Zarafa.core.data");
Zarafa.core.data.Version=Ext.extend(Object,{meta:void 0,constructor:function(a){this.meta=a},getWebApp:function(){return this.meta.webapp},getZCP:function(){return this.meta.zcp},getGit:function(){return this.meta.git},versionCompare:function(a,b){-1<a.indexOf("-")&&(a=a.split("-")[0]);-1<b.indexOf("-")&&(b=b.split("-")[0]);a=a.split(".");b=b.split(".");3<a.length&&(a=a.splice(0,3));3<b.length&&(b=b.splice(0,3));for(var c=0;c<a.length;c++){if(!Ext.isDefined(b[c]))return 1;var d=parseInt(a[c],10),
e=parseInt(b[c],10);if(d<e)return-1;if(d>e)return 1}return b[a.length]?-1:0}});Ext.namespace("Zarafa.core.data");Zarafa.core.data.ZarafaCustomEventDispatcher=Ext.extend(Ext.util.Observable,{constructor:function(a){Zarafa.core.data.ZarafaCustomEventDispatcher.superclass.constructor.call(this,a)}});Zarafa.core.data.ZarafaCustomEventDispatcher=new Zarafa.core.data.ZarafaCustomEventDispatcher;Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.AutoSaveMessagePlugin=Ext.extend(Object,{field:void 0,record:void 0,messageAutoSaveTimer:void 0,constructor:function(a){Ext.apply(this,a)},init:function(a){this.field=a;a.messageAutoSavePlugin=this;this.field.on("render",this.onRender,this)},onRender:function(){this.field.on({setrecord:this.onSetRecord,userupdaterecord:this.onUserUpdateRecord,saverecord:this.onSaveRecord,close:this.onDestroy,destroy:this.onDestroy,scope:this});var a=this.field.find("enableKeyEvents",!0);Ext.each(a,
function(a){this.field.mon(a,{keypress:this.onFieldKeyPress,scope:this})},this)},onSetRecord:function(a,b,c){this.record=b instanceof Zarafa.core.data.IPMRecord?b:void 0},onUserUpdateRecord:function(a,b,c){c&&this.startMessageAutoSaveTimer()},onFieldKeyPress:function(a,b,c){this.startMessageAutoSaveTimer()},startMessageAutoSaveTimer:function(){if(!this.messageAutoSaveTimer&&this.record&&this.record.isUnsent()){var a=1E3*container.getSettingsModel().get("zarafa/v1/contexts/mail/autosave_time");this.messageAutoSaveTimer=
this.messageAutoSave.defer(a,this)}},resetMessageAutoSaveTimer:function(){this.messageAutoSaveTimer&&(window.clearTimeout(this.messageAutoSaveTimer),this.messageAutoSaveTimer=null)},messageAutoSave:function(){if(this.record){var a=!1;this.record.getSubStore("recipients").each(function(b){b.resolveAttemptAmbiguous&&(a=!0)});a?(this.resetMessageAutoSaveTimer(),this.startMessageAutoSaveTimer()):this.field.saveRecord()}},onSaveRecord:function(a,b){this.resetMessageAutoSaveTimer()},onDestroy:function(){this.resetMessageAutoSaveTimer();
this.record=void 0}});Ext.preg("zarafa.autosavemessageplugin",Zarafa.core.plugins.AutoSaveMessagePlugin);Ext.ns("Zarafa.core.plugins");
Zarafa.core.plugins.ComboAutoWidth=Ext.extend(Ext.util.Observable,{init:function(a){this.container=a;a.mon(a.store,"load",this.resizeToFitContent,this);a.on("render",this.resizeToFitContent,this)},resizeToFitContent:function(){var a=this.container,b=a.getStore(),c=0,d=Ext.util.TextMetrics.createInstance(a.el);b.each(function(b){b=d.getWidth(b.get(a.displayField));b>c&&(c=b)});0<c&&(c=Math.max(a.minListWidth,c),c+=a.getTriggerWidth(),a.getWidth()<c&&(a.list?a.list.setWidth(c):a.listWidth=c))}});
Ext.preg("zarafa.comboautowidth",Zarafa.core.plugins.ComboAutoWidth);Ext.namespace("Zarafa.core.plugins");Zarafa.core.plugins.ComponentTooltipPlugin=Ext.extend(Object,{constructor:function(a){a=a||{};Ext.apply(this,a)},init:function(a){this.field=a}});Ext.preg("zarafa.componenttooltipplugin",Zarafa.core.plugins.ComponentTooltipPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.ContentLayerPlugin=Ext.extend(Object,{field:void 0,constructor:function(a){Ext.apply(this,a)},init:function(a){this.field=a;this.field.on("added",this.onAdded,this,{single:!0})},initPlugin:function(){this.focus();this.field.on("titlechange",this.onTitleChange,this);this.field.on("iconchange",this.onIconChange,this);this.field.on("hide",this.onHide,this);this.field.on("close",this.onClose,this)},onAdded:function(a,b){b.on("add",this.onContainerAdd,this)},onContainerAdd:function(a,
b){this.field===b&&(a.un("add",this.onContainerAdd,this),this.initPlugin())},onTitleChange:function(a,b,c){this.setTitle(b)},onIconChange:function(a,b,c){this.setIconClass(b)},onHide:function(){this.hide()},onClose:function(){this.close()},setTitle:Ext.emptyFn,setIconClass:Ext.emptyFn,hide:Ext.emptyFn,close:Ext.emptyFn,focus:Ext.emptyFn});Ext.preg("zarafa.contentlayerplugin",Zarafa.core.plugins.ContentLayerPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.EnableFocusPlugin=Ext.extend(Object,{focusEl:void 0,constructor:function(a){Ext.apply(this,a)},init:function(a){this.field=a;a.enableFocusPlugin=this;this.field.focus=this.field.focus.createInterceptor(this.focus,this);this.field.on("render",this.onRender,this)},focus:function(){if(this.field.rendered&&!this.field.isDestroyed&&this.focusEl){var a=this.field.getEl().dom.ownerDocument.getSelection(),b=[];if(a&&!1===a.isCollapsed&&a.getRangeAt&&a.addRange)for(var c=0;c<a.rangeCount;c++)b.push(a.getRangeAt(c));
this.focusEl.focus();Ext.each(b,function(b){a.addRange(b)});return!1}return!0},onRender:function(){if(this.field){var a=this.field.getEl();this.focusEl=a.createChild({tag:"a",href:"#",tabindex:-1,style:"position: absolute; left:-10000px; top:-10000px;"});this.focusEl.swallowEvent("click",!0);this.field.mon(a,{click:this.onFieldClick,scope:this})}},onFieldClick:function(a,b,c){a=Ext.get(document.activeElement);b=Ext.get(b);a!=b&&(this.field.getEl().contains(a)||this.focus())}});
Ext.preg("zarafa.enablefocusplugin",Zarafa.core.plugins.EnableFocusPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.InputAutoFocusPlugin=Ext.extend(Object,{autoFocus:void 0,field:void 0,beginFocusEl:void 0,endFocusEl:void 0,constructor:function(a){Ext.apply(this,a)},init:function(a){this.field=a;a.inputAutoFocusPlugin=this;this.field.on("afterrender",this.onAfterRender,this);this.field.on("afterlayout",this.onAfterFirstLayout,this,{single:!0});this.field.on("destroy",this.onDestroy,this)},onAfterRender:function(){this.beginFocusEl=Ext.DomHelper.insertBefore(this.field.el,{tag:"a",href:"#",style:"position: absolute; text-decoration: none; font-height: 1px; width: 1px; height: 1px; left:-10000px; top:-10000px;"},
!0);this.beginFocusEl.dom.innerHTML="&nbsp;";this.beginFocusEl.on("focus",this.onLimitFocussed,this);this.endFocusEl=Ext.DomHelper.insertAfter(this.field.el,{tag:"a",href:"#",style:"position: absolute; text-decoration: none; font-height: 1px; width: 1px; height: 1px; left:-10000px; top:-10000px;"},!0);this.endFocusEl.dom.innerHTML="&nbsp;";this.endFocusEl.on("focus",this.onLimitFocussed,this);var a=this.field.findParentByType("window");if(a&&a.focusEl)a.focusEl.on("focus",this.onDialogFocussed,this)},
onAfterFirstLayout:function(){if(Ext.isDefined(this.field.tabEl))this.field.on("activate",this.onActivate,this);else{var a=this.field.findBy(function(a){return Ext.isDefined(a.tabEl)});if(!Ext.isEmpty(a))for(var b=0,c=a.length;b<c;b++)this.field.mon(a[b],"activate",this.onActivate,this)}},onActivate:function(){this.doAutoFocus.defer(1,this)},onLimitFocussed:function(a,b){this.doCyclicFocus(this.beginFocusEl.dom===b)},onDestroy:function(){Ext.destroy(this.beginFocusEl);Ext.destroy(this.endFocusEl)},
setAutoFocus:function(a){this.autoFocus=a;this.doAutoFocus()},doAutoFocus:function(){var a;if(this.autoFocus)if(Ext.isString(this.autoFocus)){a=this.field[this.autoFocus];if(!a){var b=this.field.findByType(this.autoFocus);Ext.isEmpty(b)||(a=b[0])}a||(a=Ext.get(this.autoFocus))}else{if(Ext.isElement(this.autoFocus)||Ext.isFunction(this.autoFocus.focus))a=this.autoFocus}else(a=this.findFocusElement(this.field))||(a=this.findFocusElement(this.field,!1,!0));a&&(a.focus.defer(1,a),a.events.setAutoFocusCursor&&
a.fireEvent("setAutoFocusCursor",a.getEditor()))},doCyclicFocus:function(a){(a=this.findFocusElement(this.field,a,!0))&&a.focus.defer(1,a)},findFocusElement:function(a,b,c){var d=[];a.topToolbar&&(d=d.concat(a.topToolbar.items.items));a.items&&(d=d.concat(a.items.items));a.buttons&&(d=d.concat(a.buttons));b&&d.reverse();a=0;for(var e=d.length;a<e;a++){var f=d[a],g;this.isContainer(f)?f.isVisible()&&(g=this.findFocusElement(f,b,c)):this.isFocusElement(f,c)&&(g=f);if(g)return g}},isContainer:function(a){return a instanceof
Ext.Container||a instanceof Ext.form.CompositeField},isFocusElement:function(a,b){var c=a.btnEl||a.el;if(!c)return!1;var d=!0===b?/submit|reset|hidden/i:/button|submit|reset|hidden/i,e=!0===b?/button|input|textarea|select/i:/input|textarea|select/i;return"0px"!==c.dom.style.height&&"0px"!==c.dom.style.width&&"none"!==c.dom.style.display&&"hidden"!==c.dom.style.visibility&&!c.dom.disabled&&!c.dom.getAttribute("readonly")&&!d.test(c.dom.type)&&e.test(c.dom.tagName)},onDialogFocussed:function(){this.doAutoFocus()}});
Ext.preg("zarafa.inputautofocusplugin",Zarafa.core.plugins.InputAutoFocusPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.MarkAsReadPlugin=Ext.extend(Object,{field:void 0,record:void 0,readFlagTimer:void 0,ignoreReadFlagTimer:void 0,constructor:function(a){Ext.apply(this,a)},init:function(a){this.field=a;a.markAsReadPlugin=this;this.field.on("render",this.onRender,this);a.addInternalAction&&a.addInternalAction("send_read_receipt")},onRender:function(){this.field.on({setrecord:this.onSetRecord,beforesetrecord:this.onBeforeSetRecord,loadrecord:this.onLoadRecord,close:this.onDestroy,destroy:this.onDestroy,
scope:this})},onSetRecord:function(a,b,c){if(!(b&&c&&b.equals(c))&&(this.resetReadFlagTimer(),b&&b.isOpened()))this.onLoadRecord(this.field,this.record)},onBeforeSetRecord:function(a,b,c){this.resetReadFlagTimer();b instanceof Zarafa.core.data.IPMRecord?(this.record=b,a=this.record.getStore(),Ext.isDefined(a)&&(this.field.mon(a,"load",this.onStoreLoad,this),this.field.mon(a,"remove",this.onStoreRemove,this))):this.record=void 0},onStoreLoad:function(a,b,c){this.resetReadFlagTimer()},onStoreRemove:function(a,
b){this.record===b&&this.resetReadFlagTimer()},onLoadRecord:function(a,b){!b||b.phantom||b.isRead()||(this.ignoreReadFlagTimer?this.markAsRead():this.startReadFlagTimer())},startReadFlagTimer:function(){if(!this.readFlagTimer){var a=1E3*container.getSettingsModel().get("zarafa/v1/contexts/mail/readflag_time");this.readFlagTimer=this.markAsRead.defer(a,this)}},resetReadFlagTimer:function(){this.readFlagTimer&&(window.clearTimeout(this.readFlagTimer),delete this.readFlagTimer)},markAsRead:function(){this.record&&
Zarafa.common.Actions.markAsRead(this.record);delete this.readFlagTimer},onDestroy:function(){this.resetReadFlagTimer();this.record=void 0}});Ext.preg("zarafa.markasreadplugin",Zarafa.core.plugins.MarkAsReadPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.MenuItemTooltipPlugin=Ext.extend(Zarafa.core.plugins.ComponentTooltipPlugin,{constructor:function(a){a=a||{};Ext.apply(this,a);Zarafa.core.plugins.MenuItemTooltipPlugin.superclass.constructor.call(this,a)},init:function(a){Zarafa.core.plugins.MenuItemTooltipPlugin.superclass.init.apply(this,arguments);this.field.on("activate",this.applyTooltip,this)},applyTooltip:function(a){Ext.isDefined(a.tooltip)&&(Ext.QuickTips.unregister(a.getEl()),Ext.isObject(a.tooltip)?Ext.QuickTips.register(Ext.apply({target:a.getEl().id},
a.tooltip)):a.getEl().dom.qtip=a.tooltip)}});Ext.preg("zarafa.menuitemtooltipplugin",Zarafa.core.plugins.MenuItemTooltipPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.RecordComponentPlugin=Ext.extend(Object,{field:void 0,ignoreUpdates:!1,allowWrite:!1,isLayoutCalled:!1,record:void 0,cheapCopy:void 0,useShadowStore:!1,isChangedByUser:!1,loadTasks:void 0,enableOpenLoadTask:!0,autoOpenLoadTaskDefer:0,scheduledTasks:void 0,pendingTasks:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.useShadowStore)||(!0===a.allowWrite&&(a.useShadowStore=!0),!0===a.ignoreUpdates&&(a.useShadowStore=!0));Ext.apply(this,a)},init:function(a){this.field=a;a.recordComponentPlugin=
this;this.field.addEvents("beforesetrecord","setrecord","beforeloadrecord","loadrecord","updaterecord","userupdaterecord","exceptionrecord","writerecord");this.field.on("afterlayout",this.onAfterFirstLayout,this,{single:!0});this.field.on("close",this.onClose,this)},startShadowRecordEdit:function(a){this.useShadowStore&&container.getShadowStore().add(a)},endShadowRecordEdit:function(a){this.useShadowStore&&container.getShadowStore().remove(a,!0)},isRecordInContainer:function(a){return!0===this.allowWrite&&
!1===this.useShadowStore?this.record&&this.record===a:this.record&&this.record.equals(a)},setRecord:function(a,b){var c=this.record;this.record!==a&&(this.scheduledTasks&&(Ext.each(this.scheduledTasks,function(a){a.cancel()}),this.scheduledTasks=[]),this.pendingTasks&&(this.pendingTasks=[]),!1===this.isLayoutCalled?(this.record=a,this.cheapCopy=b):!1!==this.field.fireEvent("beforesetrecord",this,a,c)&&(c&&(c.setUpdateModificationsTracking(!1),!0!==this.ignoreUpdates&&(this.field.mun(c.getStore(),
"update",this.onUpdateRecord,this),this.field.mun(c.getStore(),"write",this.onWrite,this),this.field.mun(c.getStore(),"exception",this.onExceptionRecord,this)),!0===this.useShadowStore&&this.endShadowRecordEdit(c)),a?(this.useShadowStore&&(!0!==a.phantom&&!0!==b&&(a=a.copy()),this.startShadowRecordEdit(a)),this.record=a,this.record.isModalDialogRecord&&delete this.record.modified,this.record.setUpdateModificationsTracking(!0),this.field.fireEvent("setrecord",this,a,c),!0!==this.ignoreUpdates&&this.field.mon(a.getStore(),
"exception",this.onExceptionRecord,this),c=this.loadTasks?this.loadTasks.clone():[],!a.isOpened()&&this.enableOpenLoadTask&&c.push({fn:this.openTaskHandler,scope:this,defer:this.autoOpenLoadTaskDefer}),this.doLoadRecord(a,c)):(this.record=a,this.field.fireEvent("setrecord",this,a,c))))},openTaskHandler:function(a,b,c,d){var e=function(a,b){this.isRecordInContainer(b)&&(this.field.mun(a,"open",e,this),this.record!==b&&this.record.applyData(b),d())};this.field.mon(b.getStore(),"open",e,this);b.open()},
getActiveRecord:function(){if(!0===this.isLayoutCalled)return this.record},onAfterFirstLayout:function(a,b){this.isLayoutCalled=!0;if(this.record){var c=this.record;this.record=void 0;this.setRecord(c,this.cheapCopy)}},doLoadRecord:function(a,b){this.pendingTasks=[];this.scheduledTasks=[];Ext.isEmpty(b)?this.afterLoadRecord(a):!1!==this.field.fireEvent("beforeloadrecord",this.field,a)&&Ext.each(b,function(b){this.pendingTasks.push(b);if(b.defer&&0<b.defer){var c=new Ext.util.DelayedTask(this.doTask,
this,[a,b]);this.scheduledTasks.push(c);c.delay(b.defer)}else this.doTask(a,b)},this)},doTask:function(a,b){this.isRecordInContainer(a)&&b.fn.call(b.scope||b,this.field,a,b,this.doLoadRecordCallback.createDelegate(this,[b]))},doLoadRecordCallback:function(a){var b=this.record;this.pendingTasks.remove(a);0===this.pendingTasks.length&&(this.scheduledTasks=[],this.field.fireEvent("loadrecord",this.field,b),this.afterLoadRecord(b))},resetUserChangeTracker:function(){this.isChangedByUser=!1;this.field.fireEvent("userupdaterecord",
this.field,this.record,this.isChangedByUser)},registerUserChange:function(){!0!==this.isChangedByUser&&(this.isChangedByUser=!0,this.field.fireEvent("userupdaterecord",this.field,this.record,this.isChangedByUser))},checkForUserChanges:function(a){var b=a.updateModifications;a=a.updateSubStoreModifications;(b&&0<Object.keys(b).length||a&&0<Object.keys(a).length)&&this.registerUserChange()},afterLoadRecord:function(a){!0!==this.ignoreUpdates&&(this.resetUserChangeTracker(),a=this.record.getStore(),
this.field.mon(a,{update:this.onUpdateRecord,write:this.onWrite,scope:this}))},onUpdateRecord:function(a,b,c){if(this.isRecordInContainer(b)){if(this.record!==b){if(c!==Ext.data.Record.COMMIT)return;this.record.applyData(b)}!0!==this.ignoreUpdates&&(c===Ext.data.Record.COMMIT?this.resetUserChangeTracker():this.checkForUserChanges(b));this.field.fireEvent("updaterecord",this.field,c,this.record)}},onExceptionRecord:function(a,b,c,d,e,f){a=f.sendRecords;Array.isArray(a)&&1==a.length&&(a=a[0]);a instanceof
Zarafa.core.data.MAPIRecord&&this.isRecordInContainer(a)&&this.field.fireEvent("exceptionrecord",b,c,d,e,a,f.error||void 0)},onWrite:function(a,b,c,d,e){e=[].concat(e);for(var f=0,g=e.length;f<g;f++)if(this.record===e[f]){b==Ext.data.Api.actions.destroy&&this.resetUserChangeTracker();this.field.fireEvent("writerecord",a,b,c,d,e[f]);break}},onClose:function(a){this.record&&this.endShadowRecordEdit(this.record)}});Ext.preg("zarafa.recordcomponentplugin",Zarafa.core.plugins.RecordComponentPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.RecordComponentUpdaterPlugin=Ext.extend(Object,{rootContainer:void 0,field:void 0,isReady:!1,record:void 0,constructor:function(a){Ext.apply(this,a)},init:function(a){this.field=a;a.recordComponentUpdaterPlugin=this;if(this.rootContainer)this.hookToRootContainer(this.rootContainer);else if(a.rootContainer)this.hookToRootContainer(a.rootContainer);else this.field.on("beforerender",this.onFirstBeforeRender,this,{single:!0});if(Ext.isDefined(this.field.layout))this.field.on("afterlayout",
this.onReadyComponent,this,{single:!0});else if(!0!==this.field.rendered)this.field.on("afterrender",this.onReadyComponent,this,{single:!0});else this.onReadyComponent(this.field)},hookToRootContainer:function(a){this.rootContainer=a;this.record=a.recordComponentPlugin.getActiveRecord();this.field.mon(a,{activate:this.onActivateRoot,setrecord:this.onSetRecord,loadrecord:this.onLoadRecord,updaterecord:this.onUpdateRecord,exceptionrecord:this.onExceptionRecord,beforesaverecord:this.onBeforeSaveRecord,
beforesendrecord:this.onBeforeSendRecord,beforeclose:this.onBeforeClose,deactivate:this.onDeactivate,scope:this})},onFirstBeforeRender:function(){for(var a=this.field;!(a.recordComponentPlugin instanceof Zarafa.core.plugins.RecordComponentPlugin)&&(a=a.ownerCt,Ext.isDefined(a)););a&&this.hookToRootContainer(a)},onReadyComponent:function(a){this.record&&this.field.update(this.record,!0);this.isReady=!0},onActivateRoot:function(a){this.record&&!0===this.isReady&&!0!==this.field.isDestroyed&&this.field.update(this.record,
!0)},onSetRecord:function(a,b,c){this.record=b;!0===this.isReady&&this.field.update(b,!0)},onLoadRecord:function(a,b){!0===this.isReady&&!0!==this.field.isDestroyed&&this.field.update(b,!0)},onUpdateRecord:function(a,b,c){!0===this.isReady&&!0!==this.field.isDestroyed&&this.field.update(c,!1)},onExceptionRecord:function(a,b,c,d,e,f){!0===this.isReady&&!0!==this.field.isDestroyed&&Ext.isFunction(this.field.doException)&&this.field.doException(a,b,c,d,e,f)},onBeforeSaveRecord:function(a,b){return!0===
this.isReady&&!0!==this.field.isDestroyed&&Ext.isFunction(this.field.updateRecord)?this.field.updateRecord(b):!0},onBeforeSendRecord:function(a,b){return!0===this.isReady&&!0!==this.field.isDestroyed&&Ext.isFunction(this.field.updateRecord)?this.field.updateRecord(b):!0},onBeforeClose:function(a){return!0===this.isReady&&!0!==this.field.isDestroyed&&this.record&&Ext.isFunction(this.field.updateRecord)?this.field.updateRecord(this.record):!0},onDeactivate:function(a){return!0===this.isReady&&!0!==
this.field.isDestroyed&&this.record&&Ext.isFunction(this.field.updateRecord)?this.field.updateRecord(this.record):!0}});Ext.preg("zarafa.recordcomponentupdaterplugin",Zarafa.core.plugins.RecordComponentUpdaterPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.TabCloseMenuPlugin=Ext.extend(Ext.ux.TabCloseMenu,{createMenu:function(){if(!this.menu){var a=[{itemId:"close",text:this.closeTabText,scope:this,handler:this.onClose}];this.showCloseAll&&a.push("-");a.push({itemId:"closeothers",text:this.closeOtherTabsText,scope:this,handler:this.onCloseOthers});this.showCloseAll&&a.push({itemId:"closeall",text:this.closeAllTabsText,scope:this,handler:this.onCloseAll});var b=container.populateInsertionPoint("main.content.tabpanel.tabclosemenu");
this.menu=new Ext.menu.Menu({items:a.concat(b)})}return this.menu},onClose:function(){this.active.close()},doClose:function(a){this.tabs.items.each(function(b){b.closable&&(a&&b==this.active||b.close())},this)}});Ext.preg("zarafa.tabclosemenuplugin",Zarafa.core.plugins.TabCloseMenuPlugin);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.ButtonGroup=Ext.extend(Ext.ButtonGroup,{constructor:function(a){Ext.apply(this,a,{xtype:"zarafa.buttongroup"});Zarafa.core.ui.ButtonGroup.superclass.constructor.call(this,a)},hasVisibleButtons:function(){var a=this.items.getRange();if(!Ext.isEmpty(a))for(var b=0;b<a.length;b++)if(!1===a[b].hidden)return!0;return!1}});Ext.reg("zarafa.buttongroup",Zarafa.core.ui.ButtonGroup);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.ContentPanel=Ext.extend(Ext.Container,{title:void 0,closeAction:"closeWrap",standalone:!1,width:800,height:550,iconCls:void 0,useInputAutoFocusPlugin:!0,constructor:function(a){a=a||{};!1!==a.useInputAutoFocusPlugin&&(a.plugins=Ext.value(a.plugins,[]),a.plugins.push({ptype:"zarafa.inputautofocusplugin"}));Ext.applyIf(a,{xtype:"zarafa.contentpanel",stateful:!0});Zarafa.core.ui.ContentPanel.superclass.constructor.call(this,a);this.initializeChildComponent(this);Ext.isDefined(this.title)&&
this.setTitle(this.title);this.standalone||Zarafa.core.data.ContentPanelMgr.register(this)},afterRender:function(){Zarafa.core.ui.ContentPanel.superclass.afterRender.apply(this,arguments);var a=this.getXTypes(),a=a.replace("component/box/container/zarafa.contentpanel",""),a=a.replace(/\/zarafa\./g,"."),a="contentpanel"+a.replace(/contentpanel/g,"");Zarafa.core.KeyMapMgr.activate(this,a)},initializeChildComponent:function(a){if(!Ext.isEmpty(a)){var b=function(a){this.initializeChildComponent(a)};Array.isArray(a)?
Ext.each(a,b,this):a instanceof Ext.util.MixedCollection?a.each(b,this):a.isXType("container")&&(a.dialog=this,Ext.isEmpty(a.toolbars)||this.initializeChildComponent(a.toolbars),Ext.isEmpty(a.items)||this.initializeChildComponent(a.items))}},close:function(){!1!==this.fireEvent("beforeclose",this)&&this.doClose()},doClose:function(){this.fireEvent("close",this);Zarafa.core.data.ContentPanelMgr.unregister(this)},closeWrap:function(){this.close()},setTitle:function(a){this.title=a;this.fireEvent("titlechange",
this,a)},setIcon:function(a){var b=this.iconCls;this.iconCls=a;this.fireEvent("iconchange",this,a,b)},isModal:function(){return this.modal},getStateName:function(){return"dialogs/"+Zarafa.core.ui.ContentPanel.superclass.getStateName.call(this)},getState:function(){var a=Zarafa.core.ui.ContentPanel.superclass.getState.call(this)||{};return Ext.apply(a,this.getSize())}});Ext.reg("zarafa.contentpanel",Zarafa.core.ui.ContentPanel);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.ContextNavigationPanel=Ext.extend(Ext.Panel,{context:null,constructor:function(a){a=a||{};Ext.applyIf(a,{border:!1,layout:"fit",defaults:{border:!1,autoScroll:!1,defaults:{cls:"zarafa-context-navigation-item-body"}}});Zarafa.core.ui.ContextNavigationPanel.superclass.constructor.call(this,a)},getContext:function(){return this.context||!1}});Ext.reg("zarafa.contextnavigation",Zarafa.core.ui.ContextNavigationPanel);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MainContentTabPanel=Ext.extend(Ext.TabPanel,{openedTabs:new Ext.util.MixedCollection,onItemTitleChanged:function(a,b,c){if(a=this.getTabEl(a))a=Ext.get(a).child(".x-tab-strip-text",!0),a.qtip=b,a.innerHTML=Ext.util.Format.htmlEncodeElide(b,20,0)},onItemIconChanged:function(a,b,c){a=this.getTabEl(a);Ext.isEmpty(a)||(c&&(c=c.split(" ")),a=Ext.get(a).child(".x-tab-strip-text"),b?(a.addClass("x-tab-strip-icon"),a.replaceClass(c,b)):(a.removeClass("x-tab-strip-icon"),a.removeClass(c)))},
onItemUserUpdateRecord:function(a,b,c){var d=this.getTabEl(a);d&&(d=Ext.get(d).child(".x-tab-strip-text"),b.phantom||c?d.addClass("zarafa-tab-edited"):d.removeClass("zarafa-tab-edited"));b.phantom||this.getOpenedTab(b)||this.registeredOpenTab(b,a.getId())},initTab:function(a,b){var c=a.title;Ext.isEmpty(c)||(a.tabTip=c,a.title=Ext.util.Format.htmlEncodeElide(c,20,0));Zarafa.core.ui.MainContentTabPanel.superclass.initTab.call(this,a,b);a.on({scope:this,render:this.applyTooltip,iconchange:this.onItemIconChanged,
userupdaterecord:this.onItemUserUpdateRecord,close:this.onTabClose})},applyTooltip:function(a){if(a=Ext.get(a.tabEl).child(".x-tab-strip-close",!0))a.qtip=_("Close")+" (Ctrl + Alt + W)"},onTabClose:function(a){!1!==this.fireEvent("beforeclose",a)&&(this.remove(a),this.openedTabs=this.openedTabs.filterBy(function(b){return b!==a.getId()}),this.fireEvent("close",a))},onTabAddClick:function(a,b,c){if(a=container.getCurrentContext().getModel())a.createRecord===Ext.emptyFn&&(a=container.getMainPanel().mainToolbar.newButton,
a=a.scope.model),(a=a.createRecord())?Zarafa.core.data.UIFactory.openCreateRecord(a,{layerType:"tab"}):(a=container.getMainPanel().mainToolbar.newButton,a.handler.call(a.scope))},onRender:function(a,b){Zarafa.core.ui.MainContentTabPanel.superclass.onRender.call(this,a,b);var c=this.edge.update("<span id=\"zarafa-mainpanel-addtabbutton\" class='x-tab-add'></span>");this.mon(c,"click",this.onTabAddClick,this);c.child(".x-tab-add",!0).qtip=_("New item")+" (Ctrl + Alt + N)"},onStripMouseDown:function(a){0===
a.button&&(a=this.findTargets(a),a.close?a.item.close():a.item&&a.item!=this.activeTab&&this.setActiveTab(a.item))},getScrollWidth:function(){return this.edge.getOffsetsTo(this.stripWrap)[0]+this.getScrollPos()+this.edge.getWidth()},onBeforeAdd:function(a){if("main.content"!==a.name&&a.dialog){var b=a.dialog.record;if(!Ext.isEmpty(b)&&!Ext.isEmpty(b.get("entryid"))){var c=this.getOpenedTab(b);if(c)return container.getTabPanel().setActiveTab(c),!1;this.registeredOpenTab(b,a.getId())}}},registeredOpenTab:function(a,
b){var c=a.get("entryid");Array.isArray(a.get("attach_num"))?c=a.id:Ext.isEmpty(a.get("basedate"))||(c+="_"+a.get("basedate").getTime());this.openedTabs.add(c,b)},getOpenedTab:function(a){return this.openedTabs.find(function(b,c){Ext.isEmpty(a.get("basedate"))||(c=-1<c.indexOf(a.get("basedate").getTime())?c.split("_")[0]:!1);var d=a.get("entryid");Array.isArray(a.get("attach_num"))&&(d=a.id);if(Zarafa.core.EntryId.compareEntryIds(c,d))return!0})}});Ext.reg("zarafa.maincontenttabpanel",Zarafa.core.ui.MainContentTabPanel);
Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MainTab=Ext.extend(Ext.Button,{context:null,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.maintab",cls:"zarafa-maintab",buttonActiveCls:"zarafa-maintabbar-maintab-active",handler:this.selectContext});Zarafa.core.ui.MainTab.superclass.constructor.call(this,a);this.mon(container,"contextswitch",this.onContextSwitch,this);this.on("render",this.onRenderButton,this)},onContextSwitch:function(a,b,c){this.setContextActivityState(c)},onRenderButton:function(){this.setContextActivityState(container.getCurrentContext())},setContextActivityState:function(a){this.context==
a.getName()?this.addClass(this.buttonActiveCls):this.removeClass(this.buttonActiveCls)},selectContext:function(){var a=container.getContextByName(this.context);if(a&&a!==container.getCurrentContext()){var b=a.getModel(),c;b&&(c=b.getFolders(),Ext.isEmpty(c)&&(c=b.getDefaultFolder()));container.switchContext(a,c)}}});Ext.reg("zarafa.maintab",Zarafa.core.ui.MainTab);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MainTabBar=Ext.extend(Ext.Toolbar,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.maintabbar",id:"zarafa-mainmenu",cls:"zarafa-maintabbar",defaultType:"zarafa.maintab"});Zarafa.core.ui.MainTabBar.superclass.constructor.call(this,a);this.initBar()},initBar:function(){var a=container.populateInsertionPoint("main.maintabbar.left",this)||[],b=container.populateInsertionPoint("main.maintabbar.right",this)||[],a=Zarafa.core.Util.sortArray(a,"ASC","tabOrderIndex"),b=Zarafa.core.Util.sortArray(b,
"DESC","tabOrderIndex");this.addTooltip(a,b);var c={xtype:"tbtext",width:"auto",cls:"zarafa-maintabbar-logintext",text:container.getUser().getDisplayName(),id:"mainmenu-logintext"};this.add(a,{xtype:"tbfill"},c,b);if(!container.getServerConfig().usingSSO()||Zarafa.isDeskApp)a={text:_("Logout"),handler:this.onLogoutButton,id:"mainmenu-button-logout"},this.add(a)},addTooltip:function(a,b){var c=[],c=c.concat(a,b);Ext.each(c,function(a,b){a.tooltip=a.text+" (Ctrl + "+b+")"})},onLogoutButton:function(){container.logout()}});
Ext.reg("zarafa.maintabbar",Zarafa.core.ui.MainTabBar);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MainViewSidebar=Ext.extend(Ext.Panel,{collapseQuickTip:void 0,expandQuickTip:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);Ext.applyIf(a,{cls:"zarafa-context-mainpanel",border:!1,collapsible:!0,collapsed:!1,split:!0,width:242,minSize:150});Zarafa.core.ui.MainViewSidebar.superclass.constructor.call(this,a)},initEvents:function(){this.on("afterlayout",this.onAfterLayoutPanel,this,{single:!0});this.on("collapse",this.onBeforeCollapsePanel,this,{single:!0})},
onAfterLayoutPanel:function(){this.collapseQuickTip&&Ext.QuickTips.register({target:this.tools.toggle,text:this.collapseQuickTip})},onBeforeCollapsePanel:function(){this.expandQuickTip&&Ext.QuickTips.register({target:Ext.get(this.id+"-xcollapsed").first(),text:this.expandQuickTip})},getStateName:function(){return"sidebars/"+Zarafa.core.ui.MainViewSidebar.superclass.getStateName.call(this)}});Ext.reg("mainviewsidebar",Zarafa.core.ui.MainViewSidebar);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MainViewport=Ext.extend(Ext.Viewport,{navigationPanel:void 0,widgetPanel:void 0,contentPanel:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:"fit",items:[{xtype:"container",id:"zarafa-mainview",layout:"border",cls:"zarafa-panel-body",border:!1,items:[this.createTopbarContainer(),this.createNavigationPanel(),this.createTodayPanel(),this.createContentContainer()]}]});Zarafa.core.ui.MainViewport.superclass.constructor.call(this,a);Zarafa.core.KeyMapMgr.activate(null,"global",
Ext.getBody());Zarafa.core.KeyMapMgr.activate(null,"globaldisable",Ext.getBody())},createNavigationPanel:function(){return this.navigationPanel=new Zarafa.core.ui.NavigationPanel({region:"west",stateful:!0,statefulName:"hierarchybar",statefulRelativeDimensions:!1})},getNavigationPanel:function(){return this.navigationPanel},createTodayPanel:function(){return this.widgetPanel=new Zarafa.core.ui.widget.WidgetPanel({region:"east",title:_("Kopano"),numColumns:1,stateful:!0,statefulName:"todaybar",statefulRelativeDimensions:!1,
settingsPath:"zarafa/v1/contexts/today/sidebar",collapsed:!0})},getWidgetPanel:function(){return this.widgetPanel},createContentContainer:function(){var a=new Zarafa.core.ui.ContextContainer({name:"main.content",id:"zarafa-mainpanel-content"}),b=container.populateInsertionPoint("main.content.tabpanel",this);return this.contentPanel=new Zarafa.core.ui.MainContentTabPanel({id:"zarafa-mainpanel",activeTab:0,region:"center",enableTabScroll:!0,layoutOnTabChange:!0,items:[a].concat(b),plugins:["zarafa.tabclosemenuplugin"],
cls:"zarafa-body-tabbar"})},getContentPanel:function(){return this.contentPanel},createTopbarContainer:function(){return new Ext.Container({name:"main.topbar",region:"north",layout:"border",height:90,items:[new Zarafa.core.ui.MainTabBar({name:"main.maintabbar",region:"center",height:36,boxMinHeight:36,boxMaxHeight:36,ref:"../../mainTabBar"}),new Zarafa.core.ui.MainToolbar({name:"main.toolbar",region:"south",height:54,boxMinHeight:54,boxMaxHeight:54,ref:"../../mainToolbar"})]})}});Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.PreviewPanel=Ext.extend(Ext.Panel,{model:void 0,recordComponentPlugin:void 0,recordComponentPluginConfig:void 0,record:void 0,isLoadMaskShown:!1,loadMask:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:"fit",stateful:!0,minWidth:200,minHeight:200,xtype:"zarafa.previewpanel"});a.tbar=Ext.applyIf(a.tbar||{},{cls:"zarafa-previewpanel-toolbar",xtype:"zarafa.toolbar",hidden:!0,items:[]});var b=[container.populateInsertionPoint("previewpanel.toolbar.left",this,a.model),{xtype:"tbfill"},
container.populateInsertionPoint("previewpanel.toolbar.right.first",{scope:this,model:a.model}),a.tbar.items,container.populateInsertionPoint("previewpanel.toolbar.right",{scope:this,model:a.model})];a.tbar.items=Ext.flatten(b);a.plugins=Ext.value(a.plugins,[]);a.plugins.push(Ext.applyIf(a.recordComponentPluginConfig||{},{ptype:"zarafa.recordcomponentplugin",useShadowStore:!0,allowWrite:!1}));a.plugins.push({ptype:"zarafa.recordcomponentupdaterplugin"},{ptype:"zarafa.enablefocusplugin"});!0===container.getSettingsModel().get("zarafa/v1/contexts/mail/readflag_time_enable")&&
a.plugins.push({ptype:"zarafa.markasreadplugin"});Zarafa.core.ui.PreviewPanel.superclass.constructor.call(this,a);this.model&&this.mon(this.model,"previewrecordchange",this.onPreviewRecordChange,this);this.on({beforeloadrecord:this.onBeforeLoadRecord,loadrecord:this.onLoadRecord,exceptionrecord:this.onExceptionRecord,show:this.onPreviewPanelShow,expand:this.onPreviewPanelShow,scope:this})},afterRender:function(){Zarafa.core.ui.PreviewPanel.superclass.afterRender.apply(this,arguments);var a=this.getXTypes(),
a=a.replace("component/box/container/panel/zarafa.previewpanel",""),a=a.replace(/\/zarafa\./g,"."),a="previewpanel"+a.replace(/previewpanel/g,"");Zarafa.core.KeyMapMgr.activate(this,a)},setRecord:function(a){for(var b=0;b<this.toolbars.length;b++)this.toolbars[b].setVisible(!!a);this.recordComponentPlugin&&this.recordComponentPlugin.setRecord(a);this.record&&this.record.store&&this.record.store.un("update",this.updatePreviewPanel,this);if(a&&a.store)a.store.on("update",this.updatePreviewPanel,this)},
updatePreviewPanel:function(a,b){this.record&&b.equals(this.record)&&(this.record.set("categories",b.get("categories")),this.doLayout())},update:function(a,b){this.record=a},showRecordInPanel:function(a){var b;if(this.record!==a&&!(this.record&&a&&this.record.equals(a))){if(Ext.isDefined(a)&&(b=container.getSharedComponent(Zarafa.core.data.SharedComponentType["common.preview"],a))&&this.get(0)instanceof b){this.isLoadMaskShown&&this.hideLoadMask();this.setRecord(a);return}this.removeAll();b&&this.add(new b);
this.setRecord(a);this.doLayout();this.hideLoadMask()}},removeAll:function(a){var b=[];this.getTopToolbar()&&b.concat(this.getTopToolbar().removeAll.apply(this,arguments));this.getBottomToolbar()&&b.concat(this.getBottomToolbar().removeAll.apply(this,arguments));b.concat(Zarafa.core.ui.PreviewPanel.superclass.removeAll.apply(this,arguments));return b},onPreviewRecordChange:function(a,b){this.isVisible()&&this.showRecordInPanel(b)},showLoadMask:function(a){!0!==this.isLoadMaskShown&&(this.loadMask||
(this.loadMask=new Zarafa.common.ui.LoadMask(this.el)),a?this.loadMask.showError():(this.loadMask.show(),this.isLoadMaskShown=!0))},hideLoadMask:function(){!1!==this.isLoadMaskShown&&this.loadMask&&(this.loadMask.hide(),this.isLoadMaskShown=!1)},onBeforeLoadRecord:function(a,b){this.showLoadMask()},onLoadRecord:function(a,b){this.hideLoadMask()},onExceptionRecord:function(a,b,c,d,e){this.showLoadMask(!0)},onPreviewPanelShow:function(){if(Ext.isDefined(this.model)){var a=this.model.getPreviewRecord();
Ext.isDefined(a)&&this.showRecordInPanel(a)}},getStateName:function(){return"preview/"+Zarafa.core.ui.PreviewPanel.superclass.getStateName.call(this)}});Ext.reg("zarafa.previewpanel",Zarafa.core.ui.PreviewPanel);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.SwitchViewContentContainer=Ext.extend(Ext.Container,{lazyItems:void 0,autoClean:!0,constructor:function(a){a=a||{};Ext.isEmpty(a.items)&&!Ext.isEmpty(a.lazyItems)&&(a.items=[a.lazyItems[0]]);Ext.isEmpty(a.activeItem)&&(a.activeItem=a.items[0].id);Ext.applyIf(a,{autoDestroy:!0});this.addEvents("switchview");Zarafa.core.ui.SwitchViewContentContainer.superclass.constructor.call(this,a)},onLayout:function(){Zarafa.core.ui.SwitchViewContentContainer.superclass.onLayout.apply(this,arguments);
var a=this.getActiveItem();Ext.isFunction(a.doLayout)&&a.doLayout()},switchView:function(a){var b=this.getActiveItem(),c=this.findById(a);if(Ext.isDefined(c)&&b!=c){var d=this.getLayout();Ext.isFunction(d.setActiveItem)?d.setActiveItem(a):this.activeItem=a;this.fireEvent("switchview",this,c,b);!0===this.autoClean&&b&&b!=this.getActiveItem()&&(this.remove(b),delete b)}},getActiveItem:function(){var a=this.getLayout();return Ext.isFunction(a.setActiveItem)?a.activeItem:this.activeItem},findById:function(a){var b=
Zarafa.core.ui.SwitchViewContentContainer.superclass.findById.call(this,a);b||(b=this.findBy(function(b){return b.id===a}),Ext.isEmpty(b)||(b=b[0]));return b},findBy:function(a,b){var c=Zarafa.core.ui.SwitchViewContentContainer.superclass.findBy.apply(this,arguments);if(Ext.isDefined(this.lazyItems))for(var d=0;d<this.lazyItems.length;d++){var e=this.lazyItems[d];!0===a.call(b||e,e,this)&&(e=Ext.create(Ext.apply({},e)),this.add(e),c.push(e))}return c}});
Ext.reg("zarafa.switchviewcontentcontainer",Zarafa.core.ui.SwitchViewContentContainer);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.Toolbar=Ext.extend(Ext.Toolbar,{initialSizeCorrectionDone:!1,constructor:function(a){Ext.apply(this,a,{xtype:"zarafa.toolbar",enableOverflow:!0});Zarafa.core.ui.Toolbar.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterLayout,this)},addItems:function(a,b){var c=[];Ext.isDefined(a)&&(Ext.isEmpty(a)||(c=c.concat(a)));if(Ext.isString(b)){var d=container.populateInsertionPoint(b);Ext.isEmpty(d)||(c=c.concat(d))}c=Ext.flatten(c);this.add(c)},onAfterLayout:function(){if(!this.initialSizeCorrectionDone&&
0<this.el.getHeight()){var a=[],b=0;this.items.each(function(c){c.isXType("buttongroup")&&(c=c.body,b=Math.max(b,c.getHeight()),a.push(c))});0<b&&(Ext.each(a,function(a){a.setHeight(b)},this),this.initialSizeCorrectionDone=!0)}},onAddItem:function(a,b,c){b.isXType("menuitem")&&Ext.isDefined(b.recordComponentUpdaterPlugin)&&(a=b.itemTpl.apply({id:b.id,cls:b.cls,href:"#",hrefTarget:"",iconCls:b.iconCls,text:b.overflowText}),c=new Ext.Element(document.createElement("div")),c.dom.outerHTML=a,a=c.dom.innerHTML,
b.getEl().dom.innerHtml=a)}});Ext.reg("zarafa.toolbar",Zarafa.core.ui.Toolbar);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.ToolbarButton=Ext.extend(Ext.Button,{emptySelectOnly:!1,nonEmptySelectOnly:!1,singleSelectOnly:!1,multiSelectOnly:!1,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.toolbarbutton"});Ext.apply(this,a);Zarafa.core.ui.ToolbarButton.superclass.constructor.call(this,a);a=this.model||container.getCurrentContext().getModel();Ext.isDefined(a)&&(this.onRecordSelectionChange(a,a.getSelectedRecords()),this.mon(a,"recordselectionchange",this.onRecordSelectionChange,this))},onRecordSelectionChange:function(a,
b){this.emptySelectOnly?Ext.isDefined(b)&&(!Array.isArray(b)||0<b.length)?this.setDisabled(!0):this.setDisabled(!1):this.nonEmptySelectOnly?!Ext.isDefined(b)||Array.isArray(b)&&0===b.length?this.setDisabled(!0):this.setDisabled(!1):this.singleSelectOnly?!Ext.isDefined(b)||Array.isArray(b)&&1!==b.length?this.setDisabled(!0):this.setDisabled(!1):this.multiSelectOnly&&(Ext.isDefined(b)&&Array.isArray(b)&&1!==b.length?this.setDisabled(!1):this.setDisabled(!0))}});Ext.reg("zarafa.toolbarbutton",Zarafa.core.ui.ToolbarButton);
Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.View=Ext.extend(Ext.util.Observable,{baseCls:void 0,itemCls:void 0,themeCls:void 0,parentView:void 0,container:void 0,children:void 0,elements:void 0,rendered:!1,isDestroyed:!1,constructor:function(a){Ext.apply(this,a);this.addEvents("beforedestroy","destroy");Zarafa.core.ui.View.superclass.constructor.call(this,a);this.init()},init:function(){this.children=[];this.elements=[];Ext.isDefined(this.parentView)&&this.parentView.addChildView(this)},getBaseClassName:function(){return this.itemCls?this.baseCls+
"-"+this.itemCls:this.baseCls},getClassName:function(a,b,c){var d=this.getBaseClassName(),e=this.baseCls;Ext.isEmpty(this.themeCls)||(e+=" "+this.baseCls+"-"+this.themeCls);e+=" "+d+"-"+a;Ext.isDefined(b)&&!Array.isArray(b)&&(b=[b]);if(!Ext.isEmpty(b))for(var f=0,g=b.length;f<g;f++)e+=" "+d+"-"+a+"-"+b[f];Ext.isDefined(c)&&!Array.isArray(c)&&(c=[c]);if(!Ext.isEmpty(c))for(f=0,g=c.length;f<g;f++)e+=" "+d+"-"+c[f];return e},createDiv:function(a,b,c){return this.create("div",a,b,c)},create:function(a,
b,c,d){a=Ext.isObject(a)?a:{tag:a};Ext.applyIf(a,{cls:d||this.baseCls});b=Ext.get(b).createChild(a);this[c]?Array.isArray(this[c])?this[c].push(b):this[c]=[this[c],b]:this[c]=b;this.elements.push(b);return b},remove:function(a){a=Ext.get(a);this.elements.remove(a);a.remove()},getContainer:function(){return this.container},renderChildren:function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].render(a||this.container)},render:function(a){this.container=a;this.rendered=!0},layoutChildren:function(){for(var a=
0,b=this.children.length;a<b;a++)this.children[a].layout()},onBeforeLayout:Ext.emptyFn,onLayout:Ext.emptyFn,onAfterLayout:Ext.emptyFn,layout:function(){this.onBeforeLayout();this.onLayout();this.onAfterLayout()},destroyChildren:function(){for(var a=0,b=this.children.length;a<b;a++)this.children[a].destroy()},destroy:function(){if(!this.isDestroyed){if(!1!==this.fireEvent("beforedestroy",this)){for(var a=0,b=this.elements.length;a<b;a++)this.elements[a].remove();this.destroyChildren();this.onDestroy();
this.fireEvent("destroy",this);this.purgeListeners()}this.isDestroyed=!0}},setParentView:function(a){this.parentView=a},addChildView:function(a){a.setParentView(this);this.children.push(a);return a},removeChildView:function(a,b){this.children.remove(a);a.setParentView(void 0);b&&a.destroy()},purgeListeners:Ext.Container.prototype.purgeListeners,clearMons:Ext.Container.prototype.clearMons,createMons:Ext.Container.prototype.createMons,mon:Ext.Container.prototype.mon,mun:Ext.Container.prototype.mun,
onDestroy:Ext.emptyFn});Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.WelcomeViewport=Ext.extend(Ext.Viewport,{savingEl:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:{type:"vbox",align:"stretch"},items:[{xtype:"container",flex:.5},{layout:{type:"hbox"},xtype:"container",items:[{xtype:"container",flex:.5},{xtype:"panel",cls:"zarafa-welcome-body",border:!1,items:[{xtype:"displayfield",cls:"zarafa-welcome-title",value:_("Welcome to Kopano WebApp")},{xtype:"displayfield",cls:"zarafa-welcome-message",value:_("This is the first time you are using WebApp. <br />Please check the following settings before continuing.")},
{xtype:"zarafa.settingswelcomecategory",ref:"../../settingsCategory"}],buttonAlign:"right",buttons:[{cls:"zarafa-action",text:_("Continue"),handler:this.onContinueButton,scope:this}]},{xtype:"container",flex:.5}]},{xtype:"container",flex:.5}]});Zarafa.core.ui.WelcomeViewport.superclass.constructor.call(this,a);this.settingsCategory.update(container.getSettingsModel());container.getSettingsModel().autoSave=!1},onContinueButton:function(){var a=container.getSettingsModel();a.beginEdit();this.settingsCategory.updateSettings(a);
a.set("zarafa/v1/main/show_welcome",!1);a.set("zarafa/v1/main/keycontrols","basic");a.endEdit();this.mon(a,"save",this.onSettingsSave,this,{single:!0});this.mon(a,"exception",this.onSettingsException,this,{single:!0});this.savingEl=container.getNotifier().notify("info.saving","",_("Saving")+"...",{container:this.getEl(),persistent:!0});a.save()},onSettingsSave:function(a,b){container.getNotifier().notify("info.saving",null,null,{container:this.getEl(),destroy:!0,reference:this.savingEl});Zarafa.core.Util.disableLeaveRequester();
window.location.reload()},onSettingsException:function(){container.getNotifier().notify("info.saving",null,null,{container:this.getEl(),destroy:!0,reference:this.savingEl})}});Ext.namespace("Zarafa.core.ui.menu");
Zarafa.core.ui.menu.ConditionalItem=Ext.extend(Ext.menu.Item,{hideOnDisabled:!0,emptySelectOnly:!1,nonEmptySelectOnly:!1,singleSelectOnly:!1,multiSelectOnly:!1,itemTpl:new Ext.XTemplate('<a id="{id}" class="{cls} x-unselectable" hidefocus="true" unselectable="on" href="{href}"','<tpl if="hrefTarget">',' target="{hrefTarget}"',"</tpl>",">",'<img alt="{altText}" src="{icon}" class="x-menu-item-icon {iconCls}" {iconStyle}/>','<span class="x-menu-item-text">{text}</span>',"</a>"),getTemplateArgs:function(){var a=
Zarafa.core.ui.menu.ConditionalItem.superclass.getTemplateArgs.call(this);a.iconStyle=this.iconBG?'style="background-color:'+this.iconBG+';"':"";return a},constructor:function(a){Ext.applyIf(a,{xtype:"zarafa.conditionalitem"});Ext.applyIf(this,a);Zarafa.core.ui.menu.ConditionalItem.superclass.constructor.call(this,a)},initComponent:function(){Zarafa.core.ui.menu.ConditionalItem.superclass.initComponent.apply(this,arguments);this.hideOnDisabled&&(this.enable=this.show,this.disable=this.hide)},applySelectionFilter:function(){var a=
this.getRecords();this.emptySelectOnly&&(Ext.isDefined(a)&&(!Array.isArray(a)||0<a.length)?this.setDisabled(!0):this.setDisabled(!1));this.nonEmptySelectOnly&&(Ext.isDefined(a)&&Array.isArray(a)&&0===a.length?this.setDisabled(!0):this.setDisabled(!1));this.singleSelectOnly&&(!Ext.isDefined(a)||Array.isArray(a)&&1!==a.length?this.setDisabled(!0):this.setDisabled(!1));this.multiSelectOnly&&(Ext.isDefined(a)&&Array.isArray(a)&&1!==a.length?this.setDisabled(!1):this.setDisabled(!0))},beforeShow:function(a,
b){a.applySelectionFilter()},getRecords:function(){return this.getRootMenu().records},getRootMenu:function(){var a=this.parentMenu;!a&&this.ownerCt instanceof Ext.menu.Menu&&(a=this.ownerCt);for(;a&&(Ext.isDefined(a.parentMenu)||a.ownerCt instanceof Ext.menu.Menu);)a=a.parentMenu||a.ownerCt;return a}});Ext.reg("zarafa.conditionalitem",Zarafa.core.ui.menu.ConditionalItem);Ext.namespace("Zarafa.core.ui.menu");
Zarafa.core.ui.menu.ConditionalMenu=Ext.extend(Ext.menu.Menu,{records:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.conditionalmenu",shadow:!1});Zarafa.core.ui.menu.ConditionalMenu.superclass.constructor.call(this,a);this.on("beforeshow",this.onMenuBeforeShow,this)},onMenuBeforeShow:function(a){var b=this.records,c=!1,d=-1;a.items.each(function(a,e){if(a.isXType("zarafa.conditionalitem")&&(Ext.isFunction(a.beforeShow)&&a.beforeShow.call(a.scope||a,a,b),Ext.isDefined(a.menu)))this.onMenuBeforeShow(a.menu);
a.isXType("menuseparator")?(a.setVisible(!0===c),c=!1):!1===a.hidden&&(c=!0,d=e)},this);if(-1===d)return!1;for(var e=d,f=a.items.getCount();e<f;e++){var g=a.items.items[e];g.isXType("menuseparator")&&g.setVisible(!1)}if(-1===d)return!1}});Ext.reg("zarafa.conditionalmenu",Zarafa.core.ui.menu.ConditionalMenu);Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.Notifier=Ext.extend(Object,{availablePlugins:void 0,constructor:function(a){Ext.apply(this,a);this.availablePlugins={}},registerPlugin:function(a,b){Ext.isDefined(this.availablePlugins[a])||(this.availablePlugins[a]=b)},getPlugin:function(a){var b="zarafa/v1/main/notifier/"+a.replace(/\./g,"/")+("default"!=a?"/value":""),b=container.getSettingsModel().get(b),b=this.availablePlugins[b];b||"default"==a||(b=a.lastIndexOf("."),a=0<b?a.substr(0,b):"default",b=this.getPlugin(a));
return b},notify:function(a,b,c,d){a=a.toLowerCase();var e=this.getPlugin(a);if(e)return e.notify(a,b,c,d)}});Ext.namespace("Zarafa.core.ui.notifier");Zarafa.core.ui.notifier.NotifyPlugin=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a)},notify:Ext.emptyFn});Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.SliderContainer=Ext.extend(Object,{parentContainer:void 0,containerCls:"zarafa-notifier-container",itemCls:"zarafa-notifier-container-item",containerPosition:"t",slideinDirection:"t",slideoutDirection:"t",animatedContainerResize:!1,container:void 0,pendingMessages:void 0,stackedMessages:void 0,animating:!1,constructor:function(a){Ext.apply(this,a);this.container=this.getContainer();this.pendingMessages=[];this.stackedMessages=[];Ext.isDefined(a.animatedContainerResize)||(this.animatedContainerResize=
"t"!==this.slideinDirection)},createMessage:function(a,b){var c=Ext.DomHelper.append(this.container,{html:a,cls:this.itemCls,style:"visibility: hidden;"},!0);this.pendingMessages.push(c);c.timeout=b;c.slider=this;this.showNextMessage();return c},updateMessage:function(a,b){a.dom.innerHTML=b;return a},removeMessage:function(a){this.animating=!0;0<=this.stackedMessages.indexOf(a)&&a.ghost(this.slideoutDirection,{remove:!0,stopFx:!0,callback:this.onRemoveComplete.createDelegate(this,[a]),scope:this})},
showNextMessage:function(){var a=this.pendingMessages[0],b=a.getHeight(),c=this.container.getHeight(),d=this.parentContainer.getHeight();0===d&&"BODY"===this.parentContainer.dom.tagName&&(d=document.height);this.animating||c+b>d||(this.animating=!0,this.updateContainer(c+b,this.animatedContainerResize),a.height=b,this.pendingMessages.remove(a),this.stackedMessages.push(a),this.animMessage(a))},animMessage:function(a){a=a.slideIn(this.slideinDirection,{callback:this.onShowComplete,scope:this});Ext.isNumber(a.timeout)&&
a.pause(a.timeout,{callback:this.onPauseComplete,scope:this}).ghost(this.slideoutDirection,{remove:!0,callback:this.onRemoveComplete.createDelegate(this,[a]),scope:this})},onShowComplete:function(){this.animating=!1;!Ext.isEmpty(this.pendingMessages)&&this.parentContainer.dom&&this.showNextMessage()},onPauseComplete:function(){this.animating=!0},onRemoveComplete:function(a){var b=this.container.getHeight()-a.height;a=this.stackedMessages.indexOf(a);0>a||(this.stackedMessages.splice(a,1),this.animating=
!1,0>b&&(b=0),this.parentContainer.dom&&(this.updateContainer(b,!1),Ext.isEmpty(this.pendingMessages)||this.showNextMessage()))},getContainer:function(){var a=this.containerCls+" "+this.containerCls+"-"+this.containerPosition,b=this.parentContainer.id+"-"+this.containerCls+"-"+this.containerPosition,c=Ext.DomQuery.select("#"+b).shift();c?c=Ext.get(c):(c=Ext.DomHelper.insertFirst(this.parentContainer,{id:b,cls:a},!0),c.setHeight(0),c.alignTo(this.parentContainer,this.containerPosition));return c},
updateContainer:function(a,b){var c=this.containerPosition+"-"+this.containerPosition;this.container.setHeight(a);this.container.alignTo(this.parentContainer,c,void 0,b)}});Ext.namespace("Zarafa.core.ui.widget");
Zarafa.core.ui.widget.Widget=Ext.extend(Ext.ux.Portlet,{info:void 0,guid:void 0,hasConfig:!1,about:void 0,widgetPanel:void 0,constructor:function(a){a=a||{};var b=a.tools||[];!0===a.hasConfig&&b.push({id:"gear",handler:this.config,scope:this});b.push({id:"close",scope:this,handler:this.close});Ext.applyIf(a,{title:a.info.getDisplayName(),anchor:"100%",frame:!0,collapsible:!0,draggable:{ddGroup:"dd.widget"},tools:b});Zarafa.core.ui.widget.Widget.superclass.constructor.call(this,a);this.initWidget()},
initWidget:function(){Ext.isEmpty(this.about)||this.registerAboutText(this.title,this.about)},registerAboutText:function(a,b){this.tools.splice(this.tools.length-1,0,{id:"help",handler:this.showAbout,scope:this,title:a,text:b})},isWidgetVisible:function(){return this.isVisible()&&!this.widgetPanel.collapsed},onRender:function(){Zarafa.core.ui.widget.Widget.superclass.onRender.apply(this,arguments);this.widgetPanel=this.findParentByType("zarafa.widgetpanel")},get:function(a){return container.getSettingsModel().get(Zarafa.core.ui.widget.Widget.settingsPath(this.guid,
a))},set:function(a,b){container.getSettingsModel().set(Zarafa.core.ui.widget.Widget.settingsPath(this.guid,a),b)},close:function(a,b,c){this.widgetPanel.destroyWidget(this)},config:Ext.emptyFn,showAbout:function(a,b,c,d){(new Ext.Window({title:d.title,width:320,height:200,padding:5,autoScroll:!0,items:[{xtype:"panel",layout:"form",border:!1,items:[{xtype:"displayfield",value:d.text,hideLabel:!0,htmlEncode:!1}]}]})).show(this)}});Ext.reg("zarafa.widget",Zarafa.core.ui.widget.Widget);
Zarafa.core.ui.widget.Widget.settingsPath=function(a,b){return("zarafa/v1/widgets/"+a+"/"+b).replace(/(\/)+/,"/")};Ext.namespace("Zarafa.core.ui.widget");
Zarafa.core.ui.widget.WidgetMetaData=Ext.extend(Object,{name:"",displayName:"",iconCls:"",iconPath:"",about:void 0,widgetConstructor:void 0,constructor:function(a){a=a||{};Ext.apply(this,a);Zarafa.core.ui.widget.WidgetMetaData.superclass.constructor.call(this,a);Ext.isEmpty(this.displayName)&&(this.displayName=this.name)},getName:function(){return this.name},getDisplayName:function(){return this.displayName},getIconCls:function(){return this.iconCls},getIconPath:function(){return this.iconPath},getAbout:function(){return this.about},
getInstance:function(a){return new this.widgetConstructor(Ext.apply({info:this},a))}});Ext.namespace("Zarafa.common");
Zarafa.common.Actions={downloadFrame:void 0,openCopyMoveContent:function(a,b){b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.dialog.copymoverecords"],a,b)},openRecurrenceContent:function(a,b){Array.isArray(a)&&!Ext.isEmpty(a)&&(a=a[0]);b=Ext.applyIf(b||{},{autoSave:!0,modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.dialog.recurrence"],a,b)},openCategoriesMenu:function(a,
b){Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.categories"],a,{position:b})},openFlagsMenu:function(a,b,c){Ext.isArray(a)||(a=[a]);Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.flags"],a,{position:b,shadowEdit:c,store:a[0].getStore()})},openCustomFlagContent:function(a,b){b=Ext.applyIf(b||{},{modal:!0,resizable:!1});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.flags.dialogs.customflag"],
a,b)},openCategoriesContent:function(a,b){Array.isArray(a)||(a=[a]);b=Ext.applyIf(b||{},{autoSave:!0,modal:!0});var c=a[0].getStore();Ext.isFunction(c.isAdvanceSearchStore)&&c.isAdvanceSearchStore()&&(b.callback=function(){Ext.each(a,function(a){var b=this.record.find(function(b){return b.get("entryid")===a.get("entryid")});a.applyData(b)},this)});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.dialog.categories"],a,b)},openNewCategoryContent:function(a){a=
Ext.applyIf(a||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.categories.dialogs.newcategory"],void 0,a)},openRenameCategoryContent:function(a){a=Ext.applyIf(a||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.categories.dialogs.renamecategory"],void 0,a)},openAttachItemSelectionContent:function(a,b){b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem"],
a,b)},openWidgetsContent:function(a){Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.dialog.widgets"],void 0,a)},openViewRecipientContent:function(a,b){a.isResolved()&&(a.isPersonalContact()?(a=a.convertToContactRecord(),container.getShadowStore().add(a)):a.isPersonalDistList()?(a=a.convertToDistListRecord(),container.getShadowStore().add(a)):a.isOneOff()||(a=a.convertToABRecord(),container.getShadowStore().add(a)),b=Ext.applyIf(b||{},{manager:Ext.WindowMgr}),
Zarafa.core.data.UIFactory.openViewRecord(a,b))},openDelegatePermissionContent:function(a,b){a&&(b=b||{},Ext.apply(b,{modal:!0}),Zarafa.core.data.UIFactory.openCreateRecord(a,b))},openSendAsRecipientContent:function(a,b){if(a){var c=Zarafa.core.data.SharedComponentType["common.sendas.dialog.sendaseditcontentpanel"];b=b||{};Ext.apply(b,{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)}},openRulesEditContent:function(a,b){a&&(b=Ext.apply(b||{},{modal:!0}),Zarafa.core.data.UIFactory.openCreateRecord(a,
b))},openSaveEmlDialog:function(a,b){a=[].concat(a);var c;if(b)c=new Zarafa.common.attachment.ui.AttachmentDownloader,c.downloadMessageAsZip(a);else for(var d=0;d<a.length;d++){var e=a[d];c=new Zarafa.common.attachment.ui.AttachmentDownloader;c.downloadItem(e.getDownloadMessageUrl(!1))}},openPrintDialog:function(a,b){if(!Ext.isEmpty(a)){if(Array.isArray(a)){if(1<a.length){Ext.MessageBox.alert(_("Print"),_("Printing of multiple items has not been implemented."));return}a=a[0]}var c=function(a,b){if(a){if(this!==
b)return;a.un("open",c,b)}var d=container.getSharedComponent(Zarafa.core.data.SharedComponentType["common.printer.renderer"],b);d?(new d).print(b):b instanceof Zarafa.core.data.MAPIRecord?Ext.MessageBox.alert(_("Print"),_("Printing of this item is not yet available")+"\n"+_("Item type: ")+b.get("message_class")):Ext.MessageBox.alert(_("Print"),_("Printing of this view is not yet available"))};a instanceof Zarafa.core.data.MAPIRecord&&!a.isOpened()?(a.getStore().on("open",c,a),a.open()):c(void 0,a)}},
openCheckNamesContent:function(a,b,c){var d=Zarafa.core.data.SharedComponentType["common.dialog.checknames"];c=Ext.applyIf(c||{},{checkNamesData:a,modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(d,b,c)},openReminderContent:function(a,b){var c=Zarafa.core.data.SharedComponentType["common.dialog.reminder"],d=container.getSharedComponent(c,a);b=Ext.applyIf(b||{},{modal:!1,manager:Ext.WindowMgr});d=Zarafa.core.data.ContentPanelMgr.getContentPanelInstances(d);0===d.getCount()?0<a.length&&Zarafa.core.data.UIFactory.openLayerComponent(c,
a,b):1===d.getCount()&&(c=d.first(),0<a.length?c.focus():c.close())},openReminderRecord:function(a,b){b=b||{};Array.isArray(a)?Ext.each(a,this.openReminderRecord,this):(a=a.convertToIPMRecord(),Ext.applyIf(b,{manager:Ext.WindowMgr,modal:!0,showModalWithoutParent:!0}),a&&Zarafa.core.data.UIFactory.openViewRecord(a,b))},openRecurringSelectionContent:function(a,b,c){var d=_("Recurring Message"),e=_("This is a recurring message. Do you want to open only this occurrence or the series?");a.isMessageClass("IPM.Appointment",
!0)?a.get("meeting")==Zarafa.core.mapi.MeetingStatus.NONMEETING?(d=_("Recurring Appointment"),e=_("This is a recurring appointment. Do you want to open only this occurrence or the series?")):(d=_("Recurring Meeting Request"),e=_("This is a recurring meeting request. Do you want to open only this occurrence or the series?")):a.isMessageClass("IPM.TaskRequest",!0)&&(d=_("Recurring Task Request"),e=_("This is a recurring task request. Do you want to open only this occurrence or the series?"));Zarafa.common.dialogs.MessageBox.select(d,
e,b,c,[{boxLabel:_("Open this occurrence"),id:"recurrence_occurence",name:"select",checked:!0},{boxLabel:_("Open the series"),id:"recurrence_series",name:"select"}])},copyRecurringSelectionContent:function(a,b,c){var d=_("Paste Recurring {0}"),e=_("This is a recurring {0}. Do you want to paste only this occurrence or the series?"),f=_("message");a.isMessageClass("IPM.Appointment",!0)&&(f=a.isMeeting()?_("meeting request"):_("appointment"));d=String.format(d,Ext.util.Format.capitalize(f));e=String.format(e,
f);Zarafa.common.dialogs.MessageBox.select(d,e,b,c,[{boxLabel:_("Paste this occurrence only"),id:"recurrence_occurence",name:"select",checked:!0,showButtonText:"ok",hideButtonText:"next"},{boxLabel:_("Paste the series..."),id:"recurrence_series",name:"select",showButtonText:"next",hideButtonText:"ok"}],void 0,[{text:_("Ok"),name:"ok"},{text:_("Cancel"),name:"cancel"}])},deleteRecurringSelectionContent:function(a,b,c){var d=_("Recurring Message"),e=_("This is a recurring message. Do you want to delete only this occurrence or the series?");
a.isMessageClass("IPM.Appointment",!0)?a.get("meeting")==Zarafa.core.mapi.MeetingStatus.NONMEETING?(d=_("Recurring Appointment"),e=_("This is a recurring appointment. Do you want to delete only this occurrence or the series?")):(d=_("Recurring Meeting Request"),e=_("This is a recurring meeting request. Do you want to delete only this occurrence or the series?")):a.isMessageClass("IPM.TaskRequest",!0)&&(d=_("Recurring Task Request"),e=_("This is a recurring task request. Do you want to delete only this occurrence or the series?"));
Zarafa.common.dialogs.MessageBox.select(d,e,b,c,[{boxLabel:_("Delete this occurrence"),id:"recurrence_occurence",name:"select",checked:!0},{boxLabel:_("Delete the series"),id:"recurrence_series",name:"select"}])},deleteMeetingRequestConfirmationContent:function(a,b,c){var d=_("Confirm Delete"),e=_('This "{0}" meeting was already accepted.'),f=_('You have not responded to the meeting request "{0}".');a=a.get("responsestatus")==Zarafa.core.mapi.ResponseStatus.RESPONSE_NOT_RESPONDED?String.format(f,
a.get("subject")):String.format(e,a.get("subject"));Zarafa.common.dialogs.MessageBox.select(d,a,b,c,[{boxLabel:_("Delete and send a response to the meeting organizer"),id:"sendResponseOnDelete",name:"select",checked:!0},{boxLabel:_("Delete without sending"),id:"noResponseOnDelete",name:"select"}])},deleteRecords:function(a,b,c){if(!Ext.isEmpty(a)){Array.isArray(a)||(a=[a]);var d=a[0].getStore().entryId;(d=container.getHierarchyStore().getFolder(d))&&d.isTodoListFolder()?Zarafa.task.Actions.deleteRecordsFromTodoList(a):
this.doDeleteRecords(a,b,c)}},doDeleteRecords:function(a,b,c){for(var d,e=[],f=0,g=a.length;f<g;f++){var h=a[f];d=h.getStore();var k=Ext.isFunction(h.isRecurringOccurence)&&h.isRecurringOccurence()&&!1!==b,l=h.get("message_class");if(Zarafa.core.MessageClass.isClass(l,"IPM.Schedule.Meeting",!0)||Zarafa.core.MessageClass.isClass(l,"IPM.TaskRequest",!0))k=!1;k?this.deleteRecurringItem(h):Ext.isFunction(h.isMeeting)&&h.isMeeting()&&!h.isAppointmentInPast()&&!h.isMeetingCanceled()?h.isMeetingSent()?Ext.MessageBox.show({title:_("Kopano WebApp"),
msg:_("A cancellation message will be sent to all recipients, do you wish to continue?"),icon:Ext.MessageBox.WARNING,fn:this.cancelInvitation,scope:h,buttons:Ext.MessageBox.YESNO}):h.isMeetingResponseRequired()&&!h.isCopied()?this.deleteMeetingRequestConfirmationContent(h,this.declineInvitation,h):(d.remove(h),e.push(h)):h.isMessageClass("IPM.TaskRequest")||Ext.isFunction(h.isTaskReceived)&&h.isTaskReceived()?h.get("complete")?(d.remove(h),e.push(h)):this.deleteAssignedTaskConfirmationContent(h,this.declineTask,
h):(d.remove(h),e.push(h))}Ext.isEmpty(e)||(!0===c&&Ext.each(e,function(a){a.addMessageAction("soft_delete",!0)},this),d.save(e));d.totalLoadedRecord&&a.length===d.totalLoadedRecord&&d.showLoadMask()},declineTask:function(a,b){"ok"===a&&this.deleteIncompleteTask(b.id)},deleteAssignedTaskConfirmationContent:function(a,b,c){var d=_("Delete Incomplete Task"),e=_('The task "{0}" has not been completed. What do you want to do?'),e=String.format(e,a.get("subject"));Zarafa.common.dialogs.MessageBox.select(d,
e,b,c,[{boxLabel:_("Decline and delete"),id:"declineAndDelete",name:"select",checked:!0},{boxLabel:_("Mark complete and delete"),id:"completeAndDelete",name:"select"},{boxLabel:_("Delete"),id:"delete",name:"select"}])},deleteRecurringItem:function(a){Zarafa.common.Actions.deleteRecurringSelectionContent(a,function(b,c){"ok"==b&&(a="recurrence_series"!=c.id?a.convertToOccurenceRecord():a.convertToSeriesRecord(),container.getShadowStore().add(a),Zarafa.common.Actions.deleteRecords(a,!1))},this)},cancelInvitation:function(a,
b){"yes"==a&&this.cancelInvitation()},declineInvitation:function(a,b){"ok"==a&&this.declineMeeting("sendResponseOnDelete"==b.id?!0:!1)},openRestoreContent:function(a,b){var c=Zarafa.core.data.SharedComponentType["common.dialog.restoreitems"];b=Ext.applyIf(b||{},{folder:a});Zarafa.core.data.UIFactory.openLayerComponent(c,void 0,b)},openABUserSelectionContent:function(a){var b=Zarafa.core.data.SharedComponentType["addressbook.dialog.abuserselection"];a=Ext.applyIf(a||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(b,
void 0,a)},openABUserMultiSelectionContent:function(a){a=a||{};Ext.applyIf(a,{modal:!0,convert:function(a){return a}});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["addressbook.dialog.abmultiuserselection"],void 0,a)},markAsRead:function(a,b){a=Array.isArray(a)?a:[a];b=Ext.isDefined(b)?b:!0;for(var c=[],d={},e=0,f=a.length;e<f;d={store:d.store},e++){var g=a[e];if(b!==g.isRead())if(!0===b&&g.needsReadReceipt())switch(container.getSettingsModel().get("zarafa/v1/contexts/mail/readreceipt_handling")){case "never":g.setReadFlags(b);
g.addMessageAction("send_read_receipt",!1);c.push(g);break;case "always":g.setReadFlags(b);g.addMessageAction("send_read_receipt",!0);c.push(g);break;default:d.store=g.getStore(),Ext.MessageBox.confirm(_("Kopano WebApp"),_("The sender of this message has asked to be notified when you read this message. Do you wish to notify the sender?"),function(a){return function(c){var d=this;d.getStore()||(d=a.store.getById(d.id));d.setReadFlags(b);d.addMessageAction("send_read_receipt","no"!==c);d.save()}}(d),
g)}else g.setReadFlags(b),c.push(g)}Ext.isEmpty(c)||c[0].store.save(c)},downloadAttachment:function(a,b){this.downloadFrame||(this.downloadFrame=new Zarafa.common.attachment.ui.AttachmentDownloader);this.downloadFrame.checkForEmbeddedAttachments(a,b)},openRulesWordsEditContent:function(a){Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.rules.dialog.ruleswordsedit"],void 0,a)},openAttachmentRecord:function(a,b){a.isEmbeddedMessage()&&(a=a.convertToIPMRecord());
a&&Zarafa.core.data.UIFactory.openViewRecord(a,b)},importToFolder:function(a,b){b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.attachment.dialog.importtofolder"],a,b)},openMessageContent:function(a,b){Ext.each(a,function(a){a.isUnsent()&&!a.isFaultyMessage()?Zarafa.core.data.UIFactory.openCreateRecord(a,b):(a.isMessageClass("IPM.TaskRequest",!0)&&(a=Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Task",
{entryid:a.get("entryid"),store_entryid:a.get("store_entryid"),parent_entryid:a.get("parent_entryid"),task_goid:a.get("task_goid")},a.get("entryid")),a.addMessageAction("open_task",!0)),Zarafa.core.data.UIFactory.openViewRecord(a,b))})},copyEmailAddress:function(a){a=a.get("smtp_address")||a.get("email_address");Ext.isEmpty(a)||Zarafa.core.Util.copyToClipboard(a)}};Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.AttachItemBaseRenderer=Ext.extend(Object,{labels:void 0,htmlTemplate:void 0,plainTemplate:void 0,constructor:function(a){this.labels=Ext.apply({},{subject:_("Subject"),display_to:_("To"),display_cc:_("Cc"),display_bcc:_("Bcc"),from:_("From"),categories:_("Categories"),sensitivity:_("Sensitivity"),importance:_("Importance"),attachment_names:_("Attachments")})},generateText:function(a,b){var c;b?(this.htmlTemplate||(this.htmlTemplate=new Ext.XTemplate(this.cleanTemplate(this.generateHTMLTemplate()))),
c=this.htmlTemplate):(this.plainTemplate||(this.plainTemplate=new Ext.XTemplate(this.generatePlainTemplate())),c=this.plainTemplate);c=c.apply(this.prepareData(a,b));!Ext.isEmpty(c.trim())&&b&&(c=c.replace(/(<hr width=\'100%\'>)*$/gi,""),c="<blockquote style='border-left: 2px solid #325FBA; padding-left: 5px; margin-left: 10px; margin-top: 10px;'>"+c+"</blockquote><br>");return c},addPlainRowGroup:function(a){var b="";Ext.iterate(a,function(a,d){Ext.isObject(d)?(b+='<tpl if="!Ext.isEmpty(values.'+
a+')">',b+=this.addPlainRowGroup(d),b+="</tpl>"):b+=this.addPlainRow(a,d)},this);return b+=this.addPlainSeperator(a)},addPlainRow:function(a,b){var c;c=""+('<tpl if="!Ext.isEmpty(values.'+a+')">')+(this.getLabel(a)+" : \t"+b+"\n");return c+"</tpl>"},addPlainSeperator:function(a){if(a){var b="",c=!1;Ext.iterate(a,function(a,e){if(Ext.isObject(e))return c=!0,!1;b+=(Ext.isEmpty(b)?"":" || ")+"!Ext.isEmpty(values."+a+")"});a="";!0!==c&&(a=a+('<tpl if="'+b+'">')+"\n</tpl>");return a}return"\n"},addHTMLRowGroup:function(a){var b=
"";Ext.iterate(a,function(a,d){Ext.isObject(d)?(b+='<tpl if="!Ext.isEmpty(values.'+a+')">',b+=this.addHTMLRowGroup(d),b+="</tpl>"):b+=this.addHTMLRow(a,d)},this);return b+=this.addHTMLSeperator(a)},addHTMLRow:function(a,b){var c;c=""+('<tpl if="!Ext.isEmpty(values.'+a+')">')+("<div width='100%'><div style=\"display: inline-block; width: 20%;\"><strong>"+this.getLabel(a)+' :</strong></div><div style="display: inline-block; width: 80%">'+b+"</div></div>");return c+"</tpl>"},addHTMLSeperator:function(a){if(a){var b=
"",c=!1;Ext.iterate(a,function(a,e){if(Ext.isObject(e))return c=!0,!1;b+=(Ext.isEmpty(b)?"":" || ")+"!Ext.isEmpty(values."+a+")"});a="";!0!==c&&(a=a+('<tpl if="'+b+'">')+"<hr width='100%'></tpl>");return a}return"<hr width='100%'>"},cleanTemplate:function(a){return a.replace(/\r/g,"").replace(/\\/g,"\\\\")},generateHTMLTemplate:Ext.emptyFn,generatePlainTemplate:Ext.emptyFn,getLabel:function(a){return this.labels[a]},prepareData:function(a,b){var c=Ext.apply({},a.data);c.sensitivity===Zarafa.core.mapi.Sensitivity.NONE&&
delete c.sensitivity;c.importance===Zarafa.core.mapi.Importance.NORMAL&&delete c.importance;c.from=a.getSenderString();c.attachment_names=a.getAttachmentNames();c.body=a.getBody(b);return c}});Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.AttachItemPanel=Ext.extend(Ext.Panel,{record:void 0,editor:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{layout:{type:"vbox",align:"stretch",pack:"start",padding:10},items:[{xtype:"displayfield",value:_("Look in:"),hideLabel:!0,height:20},{xtype:"container",flex:1,layout:{type:"hbox",align:"stretch",pack:"start"},items:[{xtype:"zarafa.hierarchytree",flex:1,border:!0,enableDD:!1,treeSorter:!0,ref:"../hierarchyTree",listeners:{load:this.onTreeNodeLoad,scope:this}},
{xtype:"container",width:150,defaults:{style:{margin:"0px 0px 10px 5px"}},style:{padding:"0px 0px 0px 10px"},items:[{xtype:"button",text:_("Ok"),disabled:!0,cls:"zarafa-action",ref:"../../okButton",handler:this.onOK,scope:this},{xtype:"button",text:_("Cancel"),ref:"../../cancelButton",handler:this.onCancel,scope:this},{xtype:"fieldset",title:_("Insert as"),padding:"0px 5px 5px 5px",layout:{type:"fit"},items:[{xtype:"radiogroup",vertical:!0,columns:1,ref:"../../../attachTypeRadioGroup",defaults:{style:{margin:"5px 0px 0px 5px"}},
items:[{xtype:"radio",boxLabel:_("Text only"),inputValue:"text_only",name:"attach_item"},{xtype:"radio",boxLabel:_("Attachment"),inputValue:"attachment",name:"attach_item"}],listeners:{afterrender:this.onRadioGroupAfterRender,change:this.onRadioSelectionChange,scope:this}}]}]}]},{xtype:"zarafa.attachitemgrid",flex:1,ref:"attachItemGrid"}]});Zarafa.common.attachment.dialogs.AttachItemPanel.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.common.attachment.dialogs.AttachItemPanel.superclass.initEvents.apply(this,
arguments);var a=this.hierarchyTree.getSelectionModel();this.mon(a,"selectionchange",this.onTreeSelectionChange,this);this.mon(this.attachItemGrid.getSelectionModel(),"selectionchange",this.onGridSelectionChange,this)},onOK:function(){this.attachItem()},onCancel:function(){this.dialog.close()},onTreeNodeLoad:function(a){a=this.dialog.getSelectedFolder();this.hierarchyTree.selectFolderInTree(a)&&this.mun(this.hierarchyTree,"load",this.onTreeNodeLoad,this)},onRadioGroupAfterRender:function(a){var b=
this.dialog.getSelectedRadioItem();a.setValue(b)},onRadioSelectionChange:function(a,b){this.dialog.setRadioItemInState(b)},onTreeSelectionChange:function(a,b){var c=b.getFolder(),d=this.dialog.getStoreByFolder(c),e=this.dialog.getColumnModelByFolder(c);this.attachItemGrid.reconfigure(d,e);d.load();this.dialog.setFolderInState(c)},onGridSelectionChange:function(a){a=a.getCount();this.okButton.setDisabled(0===a)},attachItem:function(a){a=this.attachItemGrid.getSelectionModel().getSelected();var b=this.attachTypeRadioGroup.getValue().inputValue;
Ext.isEmpty(a)?Ext.MessageBox.alert(_("Attach Item"),_("No message selected")):"text_only"===b?this.attachItemAsText(a):this.attachItemAsAttachment(a)},attachItemAsAttachment:function(a){this.record.getAttachmentStore().addEmbeddedAttachment(a);this.dialog.close()},attachItemAsText:function(a){if(a.isOpened()){var b=this.dialog.getRendererByMessage(a);this.dialog.editor.insertAtCursor(b.generateText(a,this.record.get("isHTML")));this.dialog.close()}else this.openRecord(a,this.attachItemAsText)},openRecord:function(a,
b){this.dialog.showLoadMask();var c=a.getStore(),d=function(f,g){a===g&&(c.un("open",d,this),c.un("exception",e,this),this.dialog.hideLoadMask(),b.call(this,a))},e=function(a,b,h,k,l,m){h===Ext.data.Api.actions.open&&(c.un("open",d,this),c.un("exception",e,this),this.dialog.hideLoadMask())};c.on("open",d,this);c.on("exception",e,this);a.open()}});Ext.reg("zarafa.attachitempanel",Zarafa.common.attachment.dialogs.AttachItemPanel);Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.MixAttachItemPanel=Ext.extend(Ext.Panel,{records:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.mixattachitempanel",border:!1,items:[{xtype:"fieldset",layout:"form",anchor:"100% 30%",header:!0,iconCls:"mixattach-message-box-icon",border:!1,items:this.getMixAttachComponents()}]});Zarafa.common.categories.dialogs.CategoriesPanel.superclass.constructor.call(this,a)},getMixAttachComponents:function(){return[{xtype:"displayfield",value:_("These attachments have an unsupported file type and can not be added to the ZIP file:"),
hideLabel:!0,htmlEncode:!0},{xtype:"textarea",hideLabel:!0,anchor:"100%",style:"padding-left: 5px;",readOnly:!0,listeners:{afterrender:this.onAfterRenderTextArea,scope:this}},{xtype:"displayfield",value:_("Would you like to continue downloading without adding these files?"),hideLabel:!0,htmlEncode:!0},{xtype:"checkbox",ref:"../../dontShowCheckBox",boxLabel:_("Always continue download of ZIP files without adding unsupported file types."),hideLabel:!0,scope:this}]},onAfterRenderTextArea:function(a){var b=
"";Ext.each(this.records,function(a){a.isEmbeddedMessage()&&(b+=a.get("name")+"\n")});a.setValue(b)}});Ext.reg("zarafa.mixattachitempanel",Zarafa.common.attachment.dialogs.MixAttachItemPanel);Ext.namespace("Zarafa.common.attachment.ui");
Zarafa.common.attachment.ui.AttachmentButton=Ext.extend(Ext.SplitButton,{constructor:function(a){a=a||{};Ext.applyIf(a,{menu:{items:[{text:_("File upload"),handler:this.onFileUpload,scope:this,iconCls:"icon_attachment"},{text:_("Attach item"),handler:this.onFileAttach,scope:this,iconCls:"icon_embedded_attachment"},container.populateInsertionPoint("main.attachment.method",this)]},handler:this.onFileUpload,scope:this});Zarafa.common.attachment.ui.AttachmentButton.superclass.constructor.call(this,a)},
onFileUpload:function(a,b){(new Zarafa.common.attachment.ui.UploadAttachmentComponent({callback:this.uploadAttachmentCallback,multiple:!0,scope:this})).openAttachmentDialog()},uploadAttachmentCallback:function(a,b){this.record.getSubStore("attachments").uploadFiles(a,b)},onFileAttach:function(a,b){var c=this.findParentByType("zarafa.recordcontentpanel").findByType("zarafa.editorfield");Ext.isEmpty(c)||(c=c[0]);Zarafa.common.Actions.openAttachItemSelectionContent(this.record,{editor:c})},bindRecord:function(a){this.record=
a},update:function(a,b){a&&a instanceof Zarafa.core.data.MAPIRecord?b&&this.bindRecord(a):Zarafa.common.attachment.ui.AttachmentButton.superclass.update.apply(this,arguments)}});Ext.reg("zarafa.attachmentbutton",Zarafa.common.attachment.ui.AttachmentButton);Ext.namespace("Zarafa.common.attachment.ui");
Zarafa.common.attachment.ui.AttachmentDownloader=Ext.extend(Ext.Component,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.attachmentdownloader",renderTo:Ext.getBody(),hidden:!0,autoEl:{tag:"iframe",src:Ext.SSL_SECURE_URL}});Zarafa.common.attachment.ui.AttachmentDownloader.superclass.constructor.call(this,a);Ext.EventManager.on(this.getEl(),"load",this.onIframeLoad,this)},downloadItem:function(a){Ext.getDom(this.getEl()).src=a},downloadMessageAsZip:function(a){var b=0;Ext.each(a,function(a){b+=
a.get("message_size")},this);if(31457280>b){for(var c=a[0].getDownloadMessageUrl(!0),d=Ext.getDom(this.getEl()).contentDocument.body,c=Ext.DomHelper.append(d||Ext.getBody(),{tag:"form",action:c,method:"POST"},!0),d=0;d<a.length;d++)Ext.DomHelper.append(c,{tag:"input",type:"hidden",name:"entryids[]",value:a[d].get("entryid")});c.dom.submit()}else container.getNotifier().notify("error.attachment",_("Attachment error"),_("Cannot create ZIP, The allowed maximum size is 30 MB."))},onIframeLoad:function(){var a,
b;a=this.getEl().dom.contentDocument;Ext.isEmpty(a)||(b=a.body.textContent);Ext.isEmpty(b)||(a=Ext.util.JSON.decode(b),this.displaySaveEmailException(a))},checkForEmbeddedAttachments:function(a,b){var c=!1,d=a.store;b&&!container.getSettingsModel().get("zarafa/v1/state/dialogs/mixattachitemcontentpanel/dontshowagain")&&1<d.getCount()&&d.each(function(a){if(a.isEmbeddedMessage())return c=!0,!1});c?this.openMixAttachmentsDialog(d.getRange(),{allAsZip:b}):this.downloadItem(a.getAttachmentUrl(b))},openMixAttachmentsDialog:function(a,
b){Array.isArray(a)||(a=[a]);b=Ext.applyIf(b||{},{modal:!0,downloadItem:this.downloadItem.createDelegate(this,[a[0].getAttachmentUrl(b.allAsZip)],1)});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.attachment.dialog.mixattachitem"],a,b)},displaySaveEmailException:function(a){Ext.MessageBox.show({title:_("Kopano WebApp"),msg:a.zarafa.error.info.display_message,icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK})}});
Ext.reg("zarafa.attachmentdownloader",Zarafa.common.attachment.ui.AttachmentDownloader);Ext.namespace("Zarafa.common.attachment.ui");
Zarafa.common.attachment.ui.UploadAttachmentComponent=Ext.extend(Ext.Component,{callback:Ext.emptyFn,scope:void 0,multiple:!1,accept:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.uploadattachmentcomponent"});Zarafa.common.attachment.ui.UploadAttachmentComponent.superclass.constructor.call(this,a)},openAttachmentDialog:function(){var a=this.getAttachmentEl();a.on("change",this.onFileInputChange,this);a.dom.click()},getAttachmentEl:function(){var a=Ext.DomHelper.append(Ext.getBody(),
{cls:"x-hidden",tag:"input",type:"file"});Ext.isDefined(this.multiple)&&this.multiple&&(a.multiple=this.multiple);Ext.isDefined(this.accept)&&(a.accept=this.accept);return a=Ext.get(a)},onFileInputChange:function(a){var b=a.browserEvent;a=Ext.get(b.target);b=(b=b.dataTransfer)?b.files:void 0;b=a.dom.files||b;this.scope.record.getAttachmentStore().canUploadFiles(b)&&("image/*"===this.accept?this.isSupportedImage(b[0].type)?this.callback.call(this.scope,b):this.showAttachmentError():this.callback.call(this.scope,
b));a.remove()},showAttachmentError:function(){var a=_("Picture format is not supported. "),a=a+_("Supported format for contact pictures are"),a=a+"<br/>JPEG, GIF, PNG, BMP";Ext.MessageBox.show({title:_("Attachment Error"),msg:a,icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK})},isSupportedImage:function(a){return 0<=["image/bmp","image/jpg","image/jpeg","image/gif","image/png"].indexOf(a.toLowerCase())}});Ext.reg("zarafa.uploadattachmentcomponent",Zarafa.common.attachment.ui.AttachmentButton);
Ext.namespace("Zarafa.common.categories");
Zarafa.common.categories.Util={categoriesStore:null,defaultCategoryColor:"#BDC3C7",categoriesHtmlTemplate:'<tpl if="!Ext.isEmpty(values)"><tpl for="."><span class="k-category-block {colorClass}" <tpl if="!Ext.isEmpty(values.backgroundColor)">style="background-color:{backgroundColor};"</tpl>>{name}</span></tpl></tpl>',loadCategoriesStore:function(){this.categoriesStore=new Zarafa.common.categories.data.CategoriesStore},getCategories:function(a){var b=[];Ext.isEmpty(a.get("categories"))||(b=a.get("categories").replace(/;?\s*$/,
"").split("; "));if(a.get("flag_status")===Zarafa.core.mapi.FlagStatus.flagged&&"Follow up"!==a.get("flag_request")){var c=a.get("flag_icon"),c=this.getCategoryNameByFlagColor(c);-1===b.indexOf(c)&&b.push(c)}a.get("label")&&(a=Zarafa.core.mapi.AppointmentLabels.getName(a.get("label")),a=a.replace("_"," "),c=b.indexOf(a),-1<c&&b.splice(c,1),b.push(a));this.categoriesStore||this.loadCategoriesStore();return b=b.map(function(a){var b=this.categoriesStore.findExactCaseInsensitive("category",a);return 0<=
b?this.categoriesStore.getAt(b).get("category"):a},this)},setCategories:function(a,b,c){c=!0===c;var d=[];b=0<b.length?b.join("; ")+";":"";Ext.each(a,function(a){a.set("categories",b);c&&a.store&&-1===d.indexOf(a.store)&&d.push(a.store)},this);c&&Ext.each(d,function(a){a.save()})},addCategory:function(a,b,c,d){c=!0===c;Ext.each(a,function(a){Ext.isEmpty(a.getStore())&&Ext.isDefined(d)&&(a=d.getById(a.get("entryid")));var e=this.getCategories(a);-1===e.indexOf(b)&&(a.get("label")&&a.set("label",0),
e.push(b),this.setCategories(a,e,!1),c&&a.save())},this)},getCommonCategories:function(a){if(Ext.isEmpty(a))return[];Ext.isArray(a)||(a=[a]);var b=Zarafa.common.categories.Util.getCategories(a[0]);Ext.each(a,function(a,d){if(0!==d){var c=Zarafa.common.categories.Util.getCategories(a),f=[];Ext.each(b,function(a){-1===c.indexOf(a)&&f.push(a)},this);Ext.each(f,function(a){b.splice(b.indexOf(a),1)})}},this);return b},getAllCategories:function(a){Ext.isArray(a)||(a=[a]);var b=[];Ext.each(a,function(a){b=
b.concat(this.getCategories(a))},this);return Ext.unique(b)},removeCategory:function(a,b,c,d){Ext.isArray(a)||(a=[a]);c=!0===c;Ext.each(a,function(a){Ext.isEmpty(a.getStore())&&Ext.isDefined(d)&&(a=d.getById(a.get("entryid")));var e=this.getCategories(a),g=e.indexOf(b),h=a.get("label")?Zarafa.core.mapi.AppointmentLabels.getDisplayName(a.get("label")):"";-1<g&&(e.splice(g,1),this.setCategories(a,e,!1));if(a.get("flag_status")===Zarafa.core.mapi.FlagStatus.flagged&&"Follow up"!==a.get("flag_request")&&
(e=a.get("flag_icon"),this.getCategoryNameByFlagColor(e)===b)){e=Zarafa.common.flags.Util.getFlagBaseProperties();Ext.apply(e,Zarafa.common.flags.Util.getFlagPropertiesNoDate());a.beginEdit();for(var k in e)a.set(k,e[k]);a.endEdit()}h===b&&a.set("label",0);(a.isModified("categories")||a.isModified("label")||a.isModified("flag_request"))&&c&&a.save()},this)},getCategoryNameByFlagColor:function(a){var b=container.getPersistentSettingsModel(),c=b.get("kopano/main/categories",!0),d="";Ext.iterate(c,function(b){if(b.standardIndex===
a)return d=b.name,!0});Ext.isEmpty(a)||(b=b.get("kopano/main/merged_categories/"+a,!0))&&(d=b);return d},getCategoryColor:function(a){this.categoriesStore||this.loadCategoriesStore();a=this.categoriesStore.findExactCaseInsensitive("category",a);return-1<a?this.categoriesStore.getAt(a).get("color"):Zarafa.common.categories.Util.defaultCategoryColor},getCategoryFromHtmlEncoded:function(a,b){var c=this.getAllCategories(b),d=a;Ext.each(c,function(b){if(Ext.util.Format.htmlEncode(b)===a)return d=b,!0},
this);return d},getCategoriesHtml:function(a){Ext.isString(this.categoriesHtmlTemplate)&&(this.categoriesHtmlTemplate=new Ext.XTemplate(this.categoriesHtmlTemplate,{compiled:!0}));a=a.map(function(a){a={name:Ext.util.Format.htmlEncode(a),backgroundColor:this.getCategoryColor(a)};a.backgroundColor&&(a.colorClass=200>Zarafa.core.ColorSchemes.getLuma(a.backgroundColor)?"zarafa-dark":"");return a},this);return this.categoriesHtmlTemplate.apply(a)},getCategoryIconSVG:function(a){return'<svg width="13" height="13"><g transform="translate(-333.71338,-339.93452)"><path style="color:'+
a+';fill:currentColor;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="m 333.71339,346.76581 6.16871,6.16871 6.83128,-6.83128 -0.0914,-6.07732 -6.07732,-0.0914 -6.83128,6.83128 z m 8.86467,-5.02636 c 0.64351,-0.64352 1.68689,-0.64352 2.3304,0 0.64352,0.64351 0.64352,1.68689 0,2.3304 -0.64351,0.64352 -1.68689,0.64352 -2.3304,0 -0.64352,-0.64351 -0.64352,-1.68689 0,-2.3304 z" /></g></svg>'},updateStoresAfterCategoryUpdate:function(){Zarafa.core.data.IPMStoreMgr.IPMStores.each(function(a){a.each(function(b){(!Ext.isEmpty(b.get("categories"))||
b.get("flag_status")===Zarafa.core.mapi.FlagStatus.flagged&&"Follow up"!==b.get("flag_request"))&&a.fireEvent("update",a,b,Ext.data.Record.COMMIT)},this)},this)}};Ext.namespace("Zarafa.common.categories.data");
Zarafa.common.categories.data.CategoriesStore=Ext.extend(Ext.data.ArrayStore,{settingsKey:"kopano/main/categories",constructor:function(a){a=a||{};var b=[],b=b.concat(container.getPersistentSettingsModel().get(this.settingsKey)),b=b.concat(container.populateInsertionPoint("main.categories")),b=b.filter(function(a){return Ext.isObject(a)}).map(function(a){return[a.name,a.color,a.standardIndex,!0===a.quickAccess,Ext.isDefined(a.sortIndex)?a.sortIndex:1E5,!0,a.used]});Ext.applyIf(a,{fields:"category color standardIndex quickAccess sortIndex stored used".split(" "),
data:b});Ext.apply(this,a);Zarafa.common.categories.data.CategoriesStore.superclass.constructor.call(this,a)},addCategoriesFromMapiRecords:function(a){Zarafa.common.categories.Util.getAllCategories(a).forEach(function(a){-1===this.findExactCaseInsensitive("category",a)&&this.add(new this.recordType({category:a,color:Zarafa.common.categories.Util.defaultCategoryColor,sortIndex:1E5,stored:!1}))},this)},addCategory:function(a,b,c){this.add(new this.recordType({category:a,color:b?"#"+b:Zarafa.common.categories.Util.defaultCategoryColor,
quickAccess:!!c,stored:!0}))},save:function(){var a=this.getRange().filter(function(a){return a.get("stored")||a.get("quickAccess")||a.get("color")!==Zarafa.common.categories.Util.defaultCategoryColor}).map(function(a){return{name:a.get("category"),color:a.get("color"),standardIndex:a.get("standardIndex"),quickAccess:a.get("quickAccess"),sortIndex:a.get("sortIndex"),used:a.get("used")}});container.getPersistentSettingsModel().set(this.settingsKey,a)},findExactCaseInsensitive:function(a,b){return this.findBy(function(c,
d){return c.get(a).toLowerCase()===b.toLowerCase()},this)}});Ext.reg("zarafa.categoriesstore",Zarafa.common.categories.data.CategoriesStore);Ext.namespace("Zarafa.common.categories.dialogs");
Zarafa.common.categories.dialogs.CategoriesPanel=Ext.extend(Ext.Panel,{record:void 0,categorySeparator:";",constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.categoriespanel",layout:"fit",border:!1,items:[this.createCategoriesGrid(a.record)]});Zarafa.common.categories.dialogs.CategoriesPanel.superclass.constructor.call(this,a)},createCategoriesGrid:function(a){var b=new Zarafa.common.categories.data.CategoriesStore;b.addCategoriesFromMapiRecords(a);b.sort([{field:"quickAccess",direction:"DESC"},
{field:"sortIndex",direction:"ASC"},{field:"category",direction:"ASC"}]);a=this.createSelectionModel();var c=this.createColumnModel(a);return{xtype:"editorgrid",trackMouseOver:!0,enableHdMenu:!1,deferRowRender:!1,autoExpandColumn:"category",ref:"categoriesGrid",cls:"k-no-column-headers k-categories-grid",viewConfig:{forceFit:!0,markDirty:!1},store:b,sm:a,colModel:c,listeners:{scope:this,afterrender:this.onAfterRender,cellclick:this.onCellClick,rowclick:this.onRowClick,validateedit:this.onValidateEdit,
afteredit:this.onAfterEdit},onCellDblClick:Ext.emptyFn}},createSelectionModel:function(){return new Ext.grid.CheckboxSelectionModel({checkOnly:!0,moveEditorOnEnter:!1})},createColumnModel:function(a){return new Ext.grid.ColumnModel({columns:[a,{id:"color",dataIndex:"color",sortable:!1,width:25,fixed:!0,renderer:this.categoryColorRenderer},{dataIndex:"category",editor:new Ext.form.TextField({allowBlank:!1,enableKeyEvents:!0,listeners:{scope:this,keydown:function(a,c){var b=c.browserEvent.key;";"!==
b&&","!==b||c.preventDefault()}}}),sortable:!1,renderer:this.categoryNameRenderer}]})},categoryColorRenderer:function(a,b,c){b=Zarafa.common.categories.Util.getCategoryIconSVG(a);c=Ext.isNumber(c.get("standardIndex"))?" k-category-fixed":"";return b+('<div class="k-colorpicker-ct'+c+'" style="background-color:'+a+';"></div>')},categoryNameRenderer:function(a,b,c){b=c.get("quickAccess")?" zarafa-pinned":"";b+=Ext.isNumber(c.get("standardIndex"))?" k-category-fixed":"";return Ext.util.Format.htmlEncode(a)+
'<div class="zarafa-grid-button-container'+b+'"><div class="zarafa-grid-button k-grid-button-edit"></div><div class="zarafa-grid-button k-grid-button-delete"></div><div class="zarafa-grid-button k-grid-button-pin"></div></div>'},onAfterRender:function(a){a.getSelectionModel().suspendEvents(!1);var b=this.getAvailableCategories();Ext.isEmpty(b)||a.getSelectionModel().selectRecords(b);a.getSelectionModel().resumeEvents();b=a.getView();this.addColorPickers(b);this.mon(a.store,"add",function(){a.store.sort([{field:"quickAccess",
direction:"DESC"},{field:"sortIndex",direction:"ASC"},{field:"category",direction:"ASC"}])});this.mon(b,"refresh",this.addColorPickers,this);this.mon(b,"rowupdated",this.onRowUpdated,this)},addColorPickers:function(a){this.categoriesGrid.store.each(function(b,c){var d=Ext.get(a.getCell(c,1).querySelector(".k-colorpicker-ct")),e=(b.get("color")||"")+"",d=new Zarafa.common.ui.ColorPicker({renderTo:d.dom,value:e.replace("#","")});d.on("show",this.onColorPickerShowMenu.createDelegate(this,[d],!0));d.on("hide",
this.onColorPickerHideMenu.createDelegate(this,[d],!0));d.on("select",this.onSelectColor.createDelegate(this,[b],!0));b.colorPicker=d},this)},onRowUpdated:function(a,b,c){c.colorPicker&&(a=Ext.get(a.getCell(b,1).querySelector(".k-colorpicker-ct")),c.colorPicker.renderTo=a.dom,c.colorPicker.rendered=!1,c.colorPicker.el=void 0,c.colorPicker.render(a))},onColorPickerShowMenu:function(a,b){b.el.up("div").up("div").addClass("k-menu-visible")},onColorPickerHideMenu:function(a,b){b.el.up("div").up("div").removeClass("k-menu-visible")},
onSelectColor:function(a,b,c){c.set("color","#"+b)},onCellClick:function(a,b,c,d){d=Ext.get(d.target);2===c&&d.hasClass("x-grid3-col-category")&&(a=a.getSelectionModel(),a.isSelected(b)?a.deselectRow(b):a.selectRow(b,!0))},onRowClick:function(a,b,c){a.getView().focusRow(b);c=Ext.get(c.target);c.hasClass("k-grid-button-pin")&&!c.up("div").hasClass("zarafa-pin-fixed")?this.toggleCategoryPin(b):c.hasClass("k-grid-button-edit")?this.editCategoryName(b):c.hasClass("k-grid-button-delete")?this.deleteCategory(b):
c.hasClass("x-grid3-row-checker")&&a.getColumnModel().getColumnById("checker").isSelected(b)&&(b=a.getStore().getAt(b),c=b.get("standardIndex"),Ext.isEmpty(c)||!1===b.get("used")&&Zarafa.common.Actions.openRenameCategoryContent({store:a.getStore(),isCategoryGrid:!0,categoryName:b.get("category"),color:b.get("color")}))},toggleCategoryPin:function(a){a=this.categoriesGrid.getStore().getAt(a);a.set("quickAccess",!a.get("quickAccess"))},editCategoryName:function(a){this.categoriesGrid.startEditing(a,
2)},deleteCategory:function(a){var b=this.categoriesGrid.getStore().getAt(a),b=Ext.util.Format.htmlEncode(b.get("category"));Zarafa.common.dialogs.MessageBox.addCustomButtons({width:400,title:_("Delete Category"),msg:String.format(_('Are you sure you want to delete the category "{0}"? Items already assigned this category won\'t be affected.'),b),icon:Ext.MessageBox.QUESTION,fn:function(b){"delete"===b&&this.categoriesGrid.getStore().removeAt(a)},customButton:[{name:"delete",text:_("Delete")},{name:"cancel",
text:_("Cancel")}],scope:this})},onValidateEdit:function(a){var b=!1;a.grid.getStore().each(function(c){if(c!==a.record&&c.get("category").toLowerCase()===a.value.toLowerCase())return b=!0,!1},this);b&&(Zarafa.common.dialogs.MessageBox.alert(_("Rename Category"),_('A category named "'+Ext.util.Format.htmlEncode(a.value)+'" already exists. Please enter a different category name.'),function(){this.categoriesGrid.startEditing(a.row,2)},this),a.cancel=!0)},onAfterEdit:function(a){a.value!==a.originalValue&&
a.record.set("stored",!0)},getAvailableCategories:function(){for(var a=[],b=this.categoriesGrid,c=Zarafa.common.categories.Util.getAllCategories(this.record),d=0;d<c.length;d++)for(var e=0;e<b.getStore().getCount();e++)if(c[d]==b.getStore().getAt(e).get("category")){a.push(b.getStore().getAt(e));break}return a},getSelectedCategories:function(){return this.categoriesGrid.getSelectionModel().getSelections().map(function(a){return a.get("category")},this)}});Ext.reg("zarafa.categoriespanel",Zarafa.common.categories.dialogs.CategoriesPanel);
Ext.namespace("Zarafa.common.categories.ui");
Zarafa.common.categories.ui.CategoriesContextMenu=Ext.extend(Ext.menu.Menu,{records:[],store:void 0,constructor:function(a){a=a||{};Array.isArray(a.records)?this.records=a.records:this.records=[a.records];this.store=this.records[0].getStore();Ext.applyIf(a,{xtype:"zarafa.categoriescontextmenu",cls:"k-categories",items:[this.createCategoryItems(),{xtype:"menuseparator"},{text:_("Manage Categories"),cls:"k-manage-categories",handler:function(){Zarafa.common.Actions.openCategoriesContent(this.records)},scope:this}],
listeners:{afterrender:this.onAfterRenderCategoriesMenu,scope:this}});Zarafa.common.categories.ui.CategoriesContextMenu.superclass.constructor.call(this,a)},createCategoryItems:function(){var a=new Zarafa.common.categories.data.CategoriesStore;a.addCategoriesFromMapiRecords(this.records);var b=Zarafa.common.categories.Util.getAllCategories(this.records);a.filterBy(function(a){return a.get("quickAccess")||-1<b.indexOf(a.get("category"))});return a.getRange().map(function(a){return{text:'<span class="k-category-in-menu">'+
Ext.util.Format.htmlEncode(a.get("category"))+"</span>",plainText:a.get("category"),color:a.get("color"),handler:this.onCategoryMenuItemClick,listeners:{beforerender:this.onBeforeRenderCategoriesMenuItem,afterrender:this.onAfterRenderCategoriesMenuItem,scope:this},scope:this}}.bind(this))},onAfterRenderCategoriesMenu:function(a){new Zarafa.common.categories.ui.Tooltip({target:a.el,delegate:".k-category-in-menu"})},onBeforeRenderCategoriesMenuItem:function(a){-1<Zarafa.common.categories.Util.getCommonCategories(this.records).indexOf(a.plainText)?
(a.cls="x-menu-item-selected",a.selected=!0):(a.cls="",a.selected=!1)},onAfterRenderCategoriesMenuItem:function(a){var b=a.el.down("img");a=Zarafa.common.categories.Util.getCategoryIconSVG(a.color);Ext.DomHelper.insertHtml("beforeBegin",b.dom,a)},onCategoryMenuItemClick:function(a){if(a.selected)Zarafa.common.categories.Util.removeCategory(this.records,a.plainText,!0);else{var b=container.getPersistentSettingsModel().get("kopano/main/categories").find(function(b){if(!Ext.isEmpty(b.standardIndex)&&
b.name===a.plainText)return b});Ext.isDefined(b)&&!b.used?Zarafa.common.Actions.openRenameCategoryContent({categoryName:b.name,records:this.records,color:a.color,recordStore:this.store}):Zarafa.common.categories.Util.addCategory(this.records,a.plainText,!0,this.store)}}});Ext.reg("zarafa.categoriescontextmenu",Zarafa.common.categories.ui.CategoriesContextMenu);Ext.namespace("Zarafa.common.categories.ui");
Zarafa.common.categories.ui.CategoryContextMenu=Ext.extend(Ext.menu.Menu,{records:[],category:"",store:void 0,constructor:function(a){a=a||{};this.store=a.records[0].getStore();Ext.applyIf(a,{xtype:"zarafa.categorycontextmenu",cls:"zarafa-category-menu",items:[{text:_("Remove")+' "<span class="k-category-in-menu">'+Ext.util.Format.htmlEncode(a.category)+'</span>"',category:a.category,iconCls:"icon_remove",handler:this.onRemoveCategory,scope:this,listeners:{afterrender:this.onAfterRenderRemoveCategoryItem,
scope:this}},{cls:"k-unclickable",text:_("Categories"),iconCls:"icon_categories",hideOnClick:!1,menu:{xtype:"zarafa.categoriescontextmenu",records:a.records}}]});Zarafa.common.categories.ui.CategoriesContextMenu.superclass.constructor.call(this,a)},onRemoveCategory:function(a){a=Zarafa.common.categories.Util.getCategoryFromHtmlEncoded(a.category,this.records);Zarafa.common.categories.Util.removeCategory(this.records,a,!0,this.store)},onAfterRenderRemoveCategoryItem:function(a){new Zarafa.common.categories.ui.Tooltip({target:a.el,
delegate:".x-menu-item"})}});Ext.reg("zarafa.categorycontextmenu",Zarafa.common.categories.ui.CategoryContextMenu);Ext.namespace("Zarafa.common.categories.ui");
Zarafa.common.categories.ui.Tooltip=Ext.extend(Ext.ToolTip,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.categoriestooltip",target:Ext.get(document.body),delegate:".k-category-block",dismissDelay:0,trackMouse:!0,renderTo:Ext.getBody(),listeners:{beforeshow:this.onBeforeshow,scope:this}});Zarafa.common.categories.ui.Tooltip.superclass.constructor.call(this,a)},onBeforeshow:function(a){if(!this.isCategoryNameTruncated(a.triggerElement))return!1;a.body.dom.innerHTML=Ext.util.Format.htmlEncode(a.triggerElement.textContent)},
isCategoryNameTruncated:function(a){return a.offsetWidth<a.scrollWidth}});Ext.reg("zarafa.categoriestooltip",Zarafa.common.categories.ui.Tooltip);Ext.namespace("Zarafa.common.checknames.dialogs");
Zarafa.common.checknames.dialogs.CheckNamesPanel=Ext.extend(Ext.Panel,{checkNamesList:void 0,store:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Ext.data.JsonStore({autoDestroy:!0,idProperty:"smtp_address",fields:Zarafa.core.data.IPMRecipientResolveRecord,data:[]}));Ext.applyIf(a,{xtype:"zarafa.checknamespanel",layout:{type:"vbox",align:"stretch"},border:!1,header:!0,items:[{xtype:"displayfield",value:_("Select an address to use")+":",hideLabel:!0},{xtype:"grid",ref:"checkNamesList",
flex:1,store:a.store,viewConfig:{forceFit:!0},columns:[{dataIndex:"display_name",header:_("Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"smtp_address",header:_("Email"),renderer:Ext.util.Format.htmlEncode}],listeners:{scope:this,viewready:this.onViewReady,dblclick:this.onDblClick},selModel:new Ext.grid.RowSelectionModel({singleSelect:!0}),cls:"zarafa-checknames-dialog-filelist"}]});Zarafa.common.checknames.dialogs.CheckNamesPanel.superclass.constructor.call(this,a)},update:function(a,b){this.setTitle(String.format(_("More than one '{0}' found."),
Ext.util.Format.htmlEncode(a.get("display_name"))));this.store.add(b||[])},onViewReady:function(){this.checkNamesList.getSelectionModel().selectFirstRow()},updateRecord:function(a){var b=this.checkNamesList.getSelectionModel().getSelected();if(Ext.isEmpty(b))return Ext.Msg.alert(_("Alert"),_("Please select a recipient")),!1;a.applyResolveRecord(b)},onDblClick:function(){this.dialog.onOk()}});Ext.reg("zarafa.checknamespanel",Zarafa.common.checknames.dialogs.CheckNamesPanel);Ext.namespace("Zarafa.common.delegates.dialogs");
Zarafa.common.delegates.dialogs.DelegatePermissionPanel=Ext.extend(Ext.form.FormPanel,{folderTypes:"calendar tasks inbox contacts notes journal".split(" "),constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.delegatepermissionpanel",labelAlign:"left",items:this.createPanelItems()});Zarafa.common.delegates.dialogs.DelegatePermissionPanel.superclass.constructor.call(this,a)},createPanelItems:function(){return[{xtype:"fieldset",
style:{margin:"10px",padding:"10px"},title:_("This delegate has the following permissions"),autoHeight:!0,autoWidth:!0,cls:"zarafa-fieldset",labelAlign:"left",items:this.createFieldItems(this.folderTypes)},{xtype:"checkbox",boxLabel:_("Delegate can see my private items."),style:"margin-left : 10px;",ref:"delegatePrivateCheck",name:"can_see_private",hideLabel:!0,checked:!1,listeners:{check:this.onPrivateCheck,scope:this}}]},createDelegateMeetingRuleCheck:function(){return{xtype:"checkbox",boxLabel:_("Delegate receives copies of meeting-related messages sent to me."),
ref:"../delegateMeetingRuleCheck",name:"has_meeting_rule",hideLabel:!0,checked:!1,listeners:{check:this.onDelegateRuleCheck,scope:this}}},createFieldItems:function(a){for(var b=[],c=0;c<a.length;c++){var d={xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.delegates.data.DelegatePermissionProfiles},d={xtype:"combo",name:"rights_"+a[c],boxMinWidth:200,anchor:"100%",fieldLabel:Ext.util.Format.capitalize(a[c]),store:d,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",
lazyInit:!1,valueNotFoundText:_("Other"),forceSelection:!0,editable:!1,value:Zarafa.core.mapi.Rights.RIGHTS_NONE,listeners:{select:this.onProfileSelect,scope:this}};b.push(d);"calendar"===a[c]&&b.push(this.createDelegateMeetingRuleCheck())}return b},update:function(a,b){this.record=a;this.getForm().loadRecord(a);this.updateUI(a,b)},updateUI:function(a,b){if(b||a.isModifiedSinceLastUpdate("rights_calendar")){var c=a.get("rights_calendar");c&&c!==Zarafa.core.mapi.Rights.RIGHTS_NONE&&c!==Zarafa.core.mapi.Rights.RIGHTS_READONLY?
this.delegateMeetingRuleCheck.setDisabled(!1):this.delegateMeetingRuleCheck.setDisabled(!0)}},updateRecord:function(a){this.getForm().updateRecord(a)},onProfileSelect:function(a,b,c){c=a.name;this.record.beginEdit();this.record.set(c,b.get(a.valueField));"rights_calendar"===c&&((a=this.record.get(c))&&a!==Zarafa.core.mapi.Rights.RIGHTS_NONE&&a!==Zarafa.core.mapi.Rights.RIGHTS_READONLY||this.record.set("has_meeting_rule",!1),this.updateUI(this.record,!1));this.record.endEdit()},onDelegateRuleCheck:function(a,
b){this.record.set("has_meeting_rule",b)},onPrivateCheck:function(a,b){this.record.set("can_see_private",b)}});Ext.reg("zarafa.delegatepermissionpanel",Zarafa.common.delegates.dialogs.DelegatePermissionPanel);Ext.namespace("Zarafa.common.delegates.ui");
Zarafa.common.delegates.ui.DelegatesGrid=Ext.extend(Ext.grid.GridPanel,{constructor:function(a){a=a||{};a.store||(a.store=new Zarafa.common.delegates.data.DelegateStore);Ext.applyIf(a,{xtype:"zarafa.delegatesgrid",border:!0,store:a.store,viewConfig:{forceFit:!0,emptyText:"<div class='emptytext'>"+_("No delegate exists")+"</div>"},loadMask:this.initLoadMask(),columns:this.initColumnModel(),selModel:this.initSelectionModel(),listeners:{viewready:this.onViewReady,rowdblclick:this.onRowDblClick,scope:this}});
Zarafa.common.delegates.ui.DelegatesGrid.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.common.delegates.ui.DelegatesGrid.superclass.initEvents.call(this);this.mon(this.store,"load",this.onViewReady,this,{single:!0})},initColumnModel:function(){return[{dataIndex:"display_name",header:_("Name"),renderer:Zarafa.common.ui.grid.Renderers.text}]},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!0})},initLoadMask:function(){return{msg:_("Loading delegates")+
"..."}},onViewReady:function(){this.getSelectionModel().selectFirstRow()},onRowDblClick:function(a,b){this.openDelegatePermissions(a.getStore().getAt(b))},openDelegatePermissions:function(a,b){b=b||{};(a=a||this.getSelectionModel().getSelected())?(Ext.apply(b,{recordComponentPluginConfig:{enableOpenLoadTask:!1}}),Zarafa.common.Actions.openDelegatePermissionContent(a,b)):Ext.Msg.alert(_("Alert"),_("Please select a delegate."))},removeDelegate:function(){var a=this.getSelectionModel(),b=a.getSelected();
b?(a.hasNext()?a.selectNext():a.hasPrevious()&&a.selectPrevious(),this.store.remove(b)):Ext.Msg.alert(_("Alert"),_("Please select a delegate."))}});Ext.reg("zarafa.delegatesgrid",Zarafa.common.delegates.ui.DelegatesGrid);Ext.namespace("Zarafa.common.delegates.ui");
Zarafa.common.delegates.ui.DelegatesPanel=Ext.extend(Ext.Panel,{store:void 0,loadMask:void 0,constructor:function(a){a=a||{};a.store||(a.store=new Zarafa.common.delegates.data.DelegateStore);Ext.applyIf(a,{xtype:"zarafa.delegatespanel",border:!1,layout:{type:"vbox",align:"stretch",pack:"start"},items:this.createPanelItems(a.store)});Zarafa.common.delegates.ui.DelegatesPanel.superclass.constructor.call(this,a)},createPanelItems:function(a){return[{xtype:"displayfield",value:_("Delegates can send items on your behalf. To grant permission to others to access your folders without also giving them send-on-behalf-of privileges, go to properties for each folder and change the options on the Permissions Tab."),
fieldClass:"x-form-display-field zarafa-settings-widget-extrainfo"},{xtype:"container",flex:1,layout:{type:"hbox",align:"stretch",pack:"start"},items:[{xtype:"zarafa.delegatesgrid",ref:"../delegatesGrid",store:a,flex:1},{xtype:"container",width:160,layout:{type:"vbox",align:"center",pack:"start"},items:[{xtype:"button",text:_("Add")+"...",handler:this.onDelegateAdd,ref:"../../addButton",scope:this},{xtype:"spacer",height:20},{xtype:"button",text:_("Remove")+"...",disabled:!0,ref:"../../removeButton",
handler:this.onDelegateRemove,scope:this},{xtype:"spacer",height:20},{xtype:"button",text:_("Permission")+"...",disabled:!0,ref:"../../permissionButton",handler:this.onDelegatePermission,scope:this}]}]}]},initEvents:function(){Zarafa.common.delegates.ui.DelegatesPanel.superclass.initEvents.call(this);this.mon(this.store,"add",this.afterDelegateAdd,this);this.mon(this.delegatesGrid.getSelectionModel(),"selectionchange",this.onGridSelectionChange,this)},showLoadMask:function(){this.loadMask||(this.loadMask=
new Zarafa.common.ui.LoadMask(this.el));this.loadMask.show()},hideLoadMask:function(){this.loadMask&&this.loadMask.hide()},onDelegateAdd:function(){Zarafa.common.Actions.openABUserSelectionContent({callback:this.abCallBack,scope:this,hideContactsFolders:!0,listRestriction:{hide_users:"contact system non_security room equipment non_active".split(" "),hide_groups:["non_security"],hide_companies:!0}})},abCallBack:function(a){a=a.convertToDelegate();this.store.getById(a.get("entryid"))?Ext.Msg.alert(_("Alert"),
_("Delegate already exists in the list.")):this.store.add(a)},afterDelegateAdd:function(a,b,c){if(Array.isArray(b)){c=0;for(var d=b.length;c<d;c++)this.afterDelegateAdd(a,b[c],c)}else b.phantom&&this.openDelegatePermissions(b,!0)},openDelegatePermissions:function(a){a.isOpened()?this.delegatesGrid.openDelegatePermissions(a,{removeRecordOnCancel:!0}):this.openDelegateRecord(a,this.openDelegatePermissions)},openDelegateRecord:function(a,b){this.showLoadMask();var c=a.getStore(),d=function(f,g){a===
g&&(c.un("open",d,this),c.un("exception",e,this),this.hideLoadMask(),b.call(this,a))},e=function(a,b,h,k,l,m){h===Ext.data.Api.actions.open&&(c.un("open",d,this),c.un("exception",e,this),this.hideLoadMask())};c.on("open",d,this);c.on("exception",e,this);a.open()},onGridSelectionChange:function(a){a=!1===a.hasSelection();this.removeButton.setDisabled(a);this.permissionButton.setDisabled(a)},onDelegateRemove:function(){this.delegatesGrid.removeDelegate()},onDelegatePermission:function(){this.delegatesGrid.openDelegatePermissions()},
discardChanges:function(){this.store.load()},saveChanges:function(){this.store.save()}});Ext.reg("zarafa.delegatespanel",Zarafa.common.delegates.ui.DelegatesPanel);Ext.namespace("Zarafa.common.dialogs");
Zarafa.common.dialogs.CopyMovePanel=Ext.extend(Ext.Panel,{record:void 0,objectType:void 0,store:void 0,constructor:function(a){a=a||{};a.record&&(Array.isArray(a.record)?this.store=a.record[0].getStore():(a.record=[a.record],this.store=a.record.getStore()),a.objectType||(a.objectType=a.record[0].get("object_type")));Ext.applyIf(a,{xtype:"zarafa.copymovepanel",layout:{type:"vbox",align:"stretch"},border:!1,header:!0,items:[this.createTreePanel(Ext.isDefined(a.record)?a.record[0]:void 0)],buttonAlign:"left",
buttons:[{text:_("Move"),handler:this.onMove,scope:this,ref:"../moveButton",disabled:!0},{text:_("Copy"),handler:this.onCopy,scope:this,ref:"../copyButton",disabled:!0},{text:_("New folder"),handler:this.onCreateFolder,scope:this,ref:"../createFolderButton",disabled:!0},"->",{text:_("Cancel"),handler:this.onCancel,cls:"zarafa-normal",scope:this}],listeners:{render:function(){var a=this.findParentByType("window");if(a&&a.focusEl)a.focusEl.on("focus",this.onDialogFocussed,this);Zarafa.core.KeyMapMgr.activate(this,
"Zarafa.common.dialogs.CopyMovePanel")}}});Zarafa.common.dialogs.CopyMovePanel.superclass.constructor.call(this,a)},onDialogFocussed:function(){var a=this.dialog.getSelectedFolder();a&&(a=this.hierarchyTree.ensureFolderVisible(a))&&a.select()},createTreePanel:function(a){return{xtype:"panel",layout:"vbox",border:!1,flex:1,layoutConfig:{align:"stretch"},cls:"copymove-tree-panel",bodyStyle:"background-color: inherit;",items:[{xtype:"container",ref:"displayfieldContainer",items:[{xtype:"displayfield",
value:_("Destination folder")+":",hideLabel:!0,cls:"tree-header",ref:"../displayfield"}],autoheight:!0},{xtype:"zarafa.hierarchytree",flex:1,border:!0,treeSorter:!0,hideTodoList:!0,enableDD:!1,permissionFilter:Zarafa.core.mapi.Rights.RIGHTS_CREATE,IPMFilter:this.getIPMFilter(a),anchor:"100% 90%",ref:"../hierarchyTree"}],listeners:{afterlayout:function(){this.displayfieldContainer.setHeight(this.displayfield.getHeight())}}}},getIPMFilter:Ext.emptyFn,onRender:function(a,b){Zarafa.common.dialogs.CopyMovePanel.superclass.onRender.call(this,
a,b);this.objectType==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?this.setTitle(String.format(ngettext("There is {0} message selected.","There are {0} messages selected.",this.record.length),this.record.length)):this.objectType==Zarafa.core.mapi.ObjectType.MAPI_FOLDER&&this.setTitle(String.format(_("Folder '{0}' selected."),Ext.util.Format.htmlEncode(this.record[0].getDisplayName())))},initEvents:function(){Zarafa.common.dialogs.CopyMovePanel.superclass.initEvents.apply(this,arguments);this.dialog.getSelectedFolder()&&
this.mon(this.hierarchyTree,"load",this.onTreeNodeLoad,this);this.mon(this.hierarchyTree.getSelectionModel(),"selectionchange",this.onSelectionChange,this)},onTreeNodeLoad:function(){var a=this.dialog.getSelectedFolder();this.hierarchyTree.selectFolderInTree(a)&&this.mun(this.hierarchyTree,"load",this.onTreeNodeLoad,this)},onSelectionChange:function(a,b){!Ext.isDefined(b)||b.getFolder().isIPMSubTree()&&this.objectType==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?(this.copyButton.disable(),this.moveButton.disable(),
this.createFolderButton.disable()):(this.copyButton.enable(),this.moveButton.enable(),this.createFolderButton.enable())},onCreateFolder:function(){var a=this.hierarchyTree.getSelectionModel().getSelectedNode().getFolder();Zarafa.hierarchy.Actions.openCreateFolderContent(a);this.mon(this.hierarchyTree,"append",this.onTreeAppend,this,{delay:10})},onTreeAppend:function(a,b,c){c.parentNode||(c=a.getNodeById(c.id));a.selectPath(c.getPath());this.mun(this.hierarchyTree,"append",this.onTreeAppend,this)},
onCopy:function(){var a=this.hierarchyTree.getSelectionModel().getSelectedNode().getFolder(),b=this.record;Ext.isDefined(a)&&!Ext.isEmpty(this.record)&&(Ext.each(b,function(c,d){this.objectType!==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE||c.getStore()||(c=b[d]=this.store.getById(c.id));c.copyTo(a)},this),this.dialog.selectFolder(a),this.store.save(b),this.dialog.close())},onMove:function(){var a=this.hierarchyTree.getSelectionModel().getSelectedNode().getFolder(),b=this.record;Ext.isDefined(a)&&!Ext.isEmpty(this.record)&&
(Ext.each(b,function(c,d){this.objectType!==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE||c.getStore()||(c=b[d]=this.store.getById(c.id));c.moveTo(a)},this),this.dialog.selectFolder(a),this.store.save(b),this.dialog.close())},onCancel:function(){this.dialog.close()}});Ext.reg("zarafa.copymovepanel",Zarafa.common.dialogs.CopyMovePanel);Ext.namespace("Zarafa.common.dialogs");
Zarafa.common.dialogs.MessageBox=Ext.apply({},{customButton:void 0,initDialog:function(a){var b=this.getDialog();this.dlgItemContainer||(this.dlgItemContainer=this.dlgItemContainer||new Ext.Container({border:!1,cls:"my-cont"}),this.dlgItemContainer.render(b.body));b.on("hide",function(a){this.dlgItemContainer.removeAll()},this,{single:!0});b.on("destroy",function(a){this.dlgItemContainer.removeAll()},this,{single:!0});b.on("show",function(b){this.dlgItemContainer.add(a);this.dlgItemContainer.doLayout()},
this,{single:!0})},show:function(a){a.title=a.title||_("Kopano WebApp");if(!0!==a.checkbox)return Ext.MessageBox.show.call(this,a);var b=!!a.checkboxState,c={xtype:"container",cls:"k-cb-dontshowagain",items:[{xtype:"checkbox",ctCls:"k-cb-dontshowagain",boxLabel:a.checkboxLabel||_("Do not show this message again."),checked:b,listeners:{check:function(a,c){b=c}},scope:this}]};this.initDialog([c]);if(Ext.isFunction(a.fn)){var d=a.fn;a.fn=function(a,c,g){d.call(this,a,c,b,g)}.bind(a.scope||null)}return Ext.MessageBox.show.call(this,
a)},select:function(a,b,c,d,e,f,g){var h=Ext.create({xtype:"radiogroup",hideLabel:!0,style:"padding-left: 50px;",columns:1,items:e,value:f,listeners:{change:this.onChange,scope:this}});this.initDialog([{xtype:"container",anchor:"100% 100%",items:[h]}]);Ext.isEmpty(g)?this.show({title:a,msg:b+"<br />",buttons:Ext.MessageBox.OKCANCEL,fn:function(a){Ext.callback(c,d||window,[a,h.getValue()],1)},minWidth:this.minPromptWidth,maxWidth:250,scope:d,prompt:!1,value:f}):(e={},Ext.apply(e,{title:a,msg:b+"<br />",
minWidth:this.minPromptWidth,maxWidth:250,scope:d,fn:c,prompt:!1,value:f,customButton:g,radioGroup:h}),this.addCustomButtons(e));return this},onChange:function(a,b){if(b.hideButtonText){var c=this.getDialog().getFooterToolbar().find("name",b.hideButtonText)[0];Ext.isDefined(c)&&(c.setText(Ext.util.Format.capitalize(b.showButtonText)),c.name=b.showButtonText)}},addCustomButtons:function(a){var b=this.getDialog();this.customButton=b.getFooterToolbar().add(a.customButton);this.show(a);Ext.isEmpty(this.customButton)||
Ext.each(this.customButton,function(c){var d=[];d.push(a.fn);Ext.isDefined(a.radioGroup)&&d.push(a.radioGroup);b.mon(c,"click",Ext.createDelegate(this.onButtonClick,a.scope,d,!0),this)},this);b.on("hide",this.onDestroy,this,{single:!0});b.on("destroy",this.onDestroy,this,{single:!0})},onButtonClick:function(a,b,c,d){a=a.name||"cancel";Zarafa.common.dialogs.MessageBox.hide();d?c.call(this,a,d.getValue()):c.call(this,a)},onDestroy:function(a){if(!Ext.isEmpty(this.customButton)){for(var b=0;b<this.customButton.length;b++)a.getFooterToolbar().remove(this.customButton[b]);
this.customButton=[]}}},Ext.MessageBox);Ext.namespace("Zarafa.common.flags");
Zarafa.common.flags.Util={lastWorkingDay:void 0,firstWorkingDay:void 0,startWorkingHour:void 0,getFlagBaseProperties:function(){return{flag_icon:Zarafa.core.mapi.FlagIcon.red,flag_request:"Follow up",flag_status:Zarafa.core.mapi.FlagStatus.flagged,flag_complete_time:null,reminder:!0}},getFlagPropertiesNoDate:function(){return{startdate:null,duedate:null,reminder:!1,reminder_time:null,flag_due_by:null}},getFlagPropertiesToday:function(){var a=new Date,b=a.clone().setToNoon(),c=a.clone().add(Date.HOUR,
1);c.getDay()!==a.getDay()&&(c=a,c.setHours(23),c.setMinutes(59),c.setSeconds(59));return{startdate:b,duedate:b,reminder_time:c,flag_due_by:c}},getFlagPropertiesTomorrow:function(){var a=(new Date).add(Date.DAY,1).setToNoon(),b=this.getReminderTimeForDate(a);return{startdate:a,duedate:a,reminder_time:b,flag_due_by:b}},getFlagPropertiesThisWeek:function(){this.retrieveWorkingDays();var a=(new Date).setToNoon(),b;b=a.getDay()<this.firstWorkingDay?a.clone().add(Date.DAY,this.firstWorkingDay-a.getDay()):
a;var a=this.lastWorkingDay>a.getDay()?a.clone().add(Date.DAY,this.lastWorkingDay-a.getDay()):a,c=this.getReminderTimeForDate(a),d=new Date,e=d.add(Date.HOUR,1);c<e&&(c=e,c.getDay()!==d.getDay()&&(c=d,c.setHours(23),c.setMinutes(59),c.setSeconds(59)));return{startdate:b,duedate:a,reminder_time:c,flag_due_by:c}},getFlagPropertiesNextWeek:function(){this.retrieveWorkingDays();var a=(new Date).setToNoon(),a=a.add(Date.DAY,7+this.firstWorkingDay-a.getDay()),b=a.add(Date.DAY,this.lastWorkingDay-this.firstWorkingDay),
c=this.getReminderTimeForDate(b);return{startdate:a,duedate:b,reminder_time:c,flag_due_by:c}},getFlagPropertiesComplete:function(){return{flag_icon:Zarafa.core.mapi.FlagIcon.clear,flag_complete_time:new Date,complete:!0,flag_request:"",flag_status:Zarafa.core.mapi.FlagStatus.completed,reminder:!1}},getFlagPropertiesRemoveFlag:function(){return{flag_icon:Zarafa.core.mapi.FlagIcon.clear,flag_request:"",flag_status:Zarafa.core.mapi.FlagStatus.cleared,reminder:!1,startdate:null,duedate:null,reminder_time:null,
flag_due_by:null}},retrieveWorkingDays:function(){if(!this.firstWorkingDay){var a=container.getSettingsModel().get("zarafa/v1/main/working_days")||[1,5];a.sort();this.firstWorkingDay=a[0];this.lastWorkingDay=a[a.length-1]}},getReminderTimeForDate:function(a){a=a.clone();var b=parseInt(container.getSettingsModel().get("zarafa/v1/main/start_working_hour"),10);a.setHours(parseInt(b/60,10));a.setMinutes(b%60);a.clearSeconds();return a},getConfiguredFlag:function(a){var b="";if(a.get("flag_status")!==
Zarafa.core.mapi.FlagStatus.flagged)return!1;var c=a.get("startdate");a=a.get("duedate");var d=(new Date).clone().setToNoon(),e=(new Date).add(Date.DAY,1).setToNoon();if(null===c||null===a)return"no_date";c=c.getTime();a=a.getTime();c===d.getTime()&&a===d.getTime()?b=_("today"):c===e.getTime()&&a===e.getTime()?b=_("tomorrow"):(d=this.getFlagPropertiesThisWeek(),c===d.startdate.getTime()&&a===d.duedate.getTime()?b=_("this week"):(d=this.getFlagPropertiesNextWeek(),c===d.startdate.getTime()&&a===d.duedate.getTime()&&
(b=_("next week"))));return b},updateCategories:function(a){Array.isArray(a)||(a=[a]);a.forEach(function(a){var b=a.get("flag_status"),d=a.get("flag_request");b===Zarafa.core.mapi.FlagStatus.flagged&&"Follow up"!==d&&(b=Zarafa.common.categories.Util.getCategories(a),Zarafa.common.categories.Util.setCategories(a,b))})}};Ext.namespace("Zarafa.common.flags.dialogs");
Zarafa.common.flags.dialogs.CustomFlagPanel=Ext.extend(Ext.form.FormPanel,{reminderTime:null,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.customflagpanel",cls:"k-custom-flag-panel",layout:{type:"vbox",align:"stretch"},border:!1,labelAlign:"left",items:[this.createDatePanel(),this.createReminderPanel()]});Zarafa.common.flags.dialogs.CustomFlagPanel.superclass.constructor.call(this,a)},createDatePanel:function(){return{xtype:"panel",cls:"k-custom-date-panel",autoHeight:!0,items:[{xtype:"zarafa.dateperiodfield",
ref:"../dateField",allowBlank:!0,defaultPeriod:container.getSettingsModel().get("zarafa/v1/contexts/task/default_task_period"),listeners:{change:this.onDateRangeFieldChange,scope:this},startFieldConfig:{fieldLabel:_("Start date"),labelWidth:84,cls:"from-field",width:121},endFieldConfig:{fieldLabel:_("End date"),labelWidth:84,cls:"to-field",width:121}}]}},createReminderPanel:function(){return{xtype:"panel",cls:"k-custom-reminder-panel",autoHeight:!0,items:[{xtype:"zarafa.compositefield",autoHeight:!0,
items:[{xtype:"checkbox",name:"reminder",ref:"../../reminderCheckbox",width:100,boxLabel:_("Reminder")+":",handler:this.onToggleReminder,scope:this},{xtype:"zarafa.datetimefield",name:"reminder_time",width:220,timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/task/reminder_time_stepping"),listeners:{change:this.onReminderFieldChange,scope:this},dateFieldConfig:{flex:0}}]}]}},onRender:function(){Zarafa.common.flags.dialogs.CustomFlagPanel.superclass.onRender.apply(this,arguments);
if(1===this.records.length){var a=this.records[0];this.reminderTime=a.get("reminder_time");var b=a.get("startdate"),c=a.get("duedate");this.dateField.getValue().set(b,c);this.getForm().loadRecord(a)}},onDateRangeFieldChange:function(a,b,c){var d=b.getStartDate(),e=b.getDueDate();this.records.forEach(function(a){a.beginEdit();Ext.isDate(d)?a.set("startdate",d.clone().setToNoon()):a.set("startdate",null);Ext.isDate(e)?a.set("duedate",e.clone().setToNoon()):a.set("duedate",null);a.endEdit()},this)},
onReminderFieldChange:function(a,b,c){this.records.forEach(function(c){c.set(a.getName(),b)},this);this.getForm().loadRecord(this.records[0])},onToggleReminder:function(a,b){this.records.forEach(function(a){a.beginEdit();a.set("reminder",b);if(b){var c=this.reminderTime;if(!Ext.isDate(c)){var c=a.get("duedate"),e=container.getSettingsModel().get("zarafa/v1/contexts/task/default_reminder_time");Ext.isDate(c)||(c=(new Date).add(Date.DAY,1));c=c.clearTime(!0).add(Date.MINUTE,e)}a.set("reminder_time",
c);a.set("flag_due_by",c)}else a.set("reminder_time",null),a.set("flag_due_by",null);a.endEdit()},this);this.getForm().loadRecord(this.records[0])}});Ext.reg("zarafa.customflagpanel",Zarafa.common.flags.dialogs.CustomFlagPanel);Ext.namespace("Zarafa.common.form");
Zarafa.common.form.TextArea=Ext.extend(Ext.form.TextArea,{enableSystemContextMenu:!1,onRender:function(a,b){Zarafa.common.form.TextArea.superclass.onRender.apply(this,arguments);this.enableSystemContextMenu&&this.el.addClass("zarafa-contextmenu-enabled")},insertAtCursor:function(a){var b=this.el.dom.selectionEnd;this.el.dom.value=this.el.dom.value.substring(0,this.el.dom.selectionStart)+a+this.el.dom.value.substring(b,this.el.dom.value.length);this.el.focus();this.el.dom.setSelectionRange(b+a.length,
b+a.length)},setCursorLocation:function(){var a=this.getEl().dom,b=a.textLength,c=a.selectionEnd;a.selectionStart===b&&c===b&&a.setSelectionRange(0,0)}});Ext.reg("zarafa.textarea",Zarafa.common.form.TextArea);Ext.namespace("Zarafa.common.freebusy.data");
Zarafa.common.freebusy.data.FreebusyModel=Ext.extend(Ext.util.Observable,{nonWorkingHoursHidden:!0,daterange:null,selectorRange:null,suggestionRange:null,userStore:null,blockStore:null,sumBlockStore:null,freeBlockStore:null,suggestionBlockStore:null,updatingSelectorRangeExternally:!1,constructor:function(a){a=a||{};var b=new Date;b.setHours(12);var c=container.getServerConfig(),d=c.getFreebusyLoadStartOffset(),d=b.add(Date.DAY,-d).clearTime(),c=c.getFreebusyLoadEndOffset(),b=b.add(Date.DAY,c).clearTime(),
e;a.selectorRange?(c=a.selectorRange.getStartDate(),e=a.selectorRange.getDueDate()):(c=(new Date).ceil(Date.MINUTE,30),e=c.add(Date.MINUTE,30));Ext.applyIf(a,{userStore:a.userStore||new Zarafa.core.data.IPMRecipientStore,daterange:a.daterange||new Zarafa.core.DateRange({startDate:d,dueDate:b}),selectorRange:new Zarafa.core.DateRange({startDate:c,dueDate:e}),blockStore:a.blockStore||new Zarafa.common.freebusy.data.FreebusyBlockStore,sumBlockStore:a.sumBlockStore||new Zarafa.common.freebusy.data.FreebusyBlockStore({remoteSort:!1}),
suggestionBlockStore:a.suggestionBlockStore||new Zarafa.common.freebusy.data.FreebusyBlockStore({remoteSort:!1})});Ext.apply(this,a);this.addEvents("showworkinghourschange","userstorechange","blockstorechange","sumblockstorechange","suggestionblockstorechange","daterangechange","selectorrangeupdate");Zarafa.common.freebusy.data.FreebusyModel.superclass.constructor.call(this,a);this.initEvents();this.setDateRange(a.daterange,!0);this.setUserStore(a.userStore,!0);this.setSelectorRange(a.selectorRange,
!0);this.setBlockStore(a.blockStore,!0);this.setSumBlockStore(a.sumBlockStore,!0);this.setSuggestionBlockStore(a.suggestionBlockStore,!0);this.createFreeBlockStore();this.createSuggestionRange()},initEvents:function(){this.on("showworkinghourschange",this.onShowWorkingHoursChange,this);this.on("userstorechange",this.onUserStoreChange,this)},createFreeBlockStore:function(){this.freeBlockStore||(this.freeBlockStore=new Zarafa.common.freebusy.data.FreebusyBlockStore({remoteSort:!1}));return this.freeBlockStore},
createSuggestionRange:function(){this.suggestionRange||(this.suggestionRange=new Zarafa.core.DateRange,this.setSuggestionDate(this.selectorRange.getStartDate()),this.suggestionRange.on("update",this.onSuggestionRangeUpdate,this,{buffer:5}));return this.suggestionRange},showOnlyWorkingHours:function(){return this.nonWorkingHoursHidden},hideNonWorkingHours:function(a){var b=this.nonWorkingHoursHidden;this.nonWorkingHoursHidden=a;b!=this.nonWorkingHoursHidden&&this.fireEvent("showworkinghourschange",
this.nonWorkingHoursHidden);return this.nonWorkingHoursHidden},getUserStore:function(){return this.userStore},setUserStore:function(a,b){if(!0===b||this.userStore!==a){var c=this.userStore;this.userStore&&(this.userStore.un("resolved",this.onUserResolved,this),this.userStore.un("load",this.onUserLoad,this),this.userStore.un("add",this.onUserAdd,this),this.userStore.un("remove",this.onUserRemove,this),this.userStore.un("clear",this.onUserClear,this));if(this.userStore=Ext.StoreMgr.lookup(a))this.userStore.on({scope:this,
resolved:this.onUserResolved,load:this.onUserLoad,add:this.onUserAdd,remove:this.onUserRemove,clear:this.onUserClear});this.fireEvent("userstorechange",this.userStore,c);this.userStore!==c&&c&&c.autoDestroy&&c.destroy();return this.userStore}},getBlockStore:function(){return this.blockStore},setBlockStore:function(a,b){if(!0===b||this.blockStore!==a){var c=this.blockStore;this.blockStore&&(this.blockStore.un("load",this.onBlockLoad,this),this.blockStore.un("remove",this.onBlockRemove,this,{buffer:100}),
this.blockStore.un("clear",this.onBlockRemove,this));if(this.blockStore=Ext.StoreMgr.lookup(a))this.blockStore.on("load",this.onBlockLoad,this),this.blockStore.on("remove",this.onBlockRemove,this,{buffer:100}),this.blockStore.on("clear",this.onBlockRemove,this);this.fireEvent("blockstorechange",this.blockStore,c);this.blockStore!==c&&c&&c.autoDestroy&&c.destroy();return this.blockStore}},getSumBlockStore:function(){return this.sumBlockStore},setSumBlockStore:function(a,b){if(!0===b||this.sumBlockStore!==
a){var c=this.sumBlockStore;this.sumBlockStore&&this.sumBlockStore.un("load",this.onSumBlockLoad,this,{buffer:5});if(this.sumBlockStore=Ext.StoreMgr.lookup(a))this.sumBlockStore.on("load",this.onSumBlockLoad,this,{buffer:5});this.fireEvent("sumblockstorechange",this.sumBlockStore,c);this.sumBlockStore!==c&&c&&c.autoDestroy&&c.destroy();return this.sumBlockStore}},getSuggestionBlockStore:function(){return this.suggestionBlockStore},setSuggestionBlockStore:function(a,b){if(!0===b||this.suggestionBlockStore!==
a){var c=this.suggestionBlockStore;this.suggestionBlockStore=Ext.StoreMgr.lookup(a);this.fireEvent("suggestionblockstorechange",this.suggestionBlockStore,c);this.suggestionBlockStore!==c&&c&&c.autoDestroy&&c.destroy();return this.suggestionBlockStore}},getUserCount:function(){return this.userStore.getCount()},addUser:function(a,b){b=Ext.isNumber(b)?b:Zarafa.core.mapi.RecipientType.MAPI_TO;var c=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
{display_name:a,recipient_type:b});this.userStore.add(c);return c},getDateRange:function(){return this.daterange},setDateRange:function(a,b){if(!0===b||this.daterange!==a){var c=this.daterange;this.daterange=a;this.fireEvent("daterangechange",this.daterange,c);return this.daterange}},getSelectorRange:function(){return this.selectorRange},setSelectorRange:function(a,b){if(!0===b||this.selectorRange!==a){this.selectorRange&&this.selectorRange.un("update",this.onSelectorRangeUpdate,this,{buffer:5});
if(this.selectorRange=a)this.selectorRange.on("update",this.onSelectorRangeUpdate,this,{buffer:5});return this.selectorRange}},selectRange:function(a,b){this.selectorRange.equals(new Zarafa.core.DateRange({startDate:a,dueDate:b}))||(this.updatingSelectorRangeExternally=!0);this.selectorRange.set(a,b)},getSuggestionRange:function(){return this.suggestionRange},setSuggestionDate:function(a,b){var c=a.clone().clearTime(),d=a.clone().clearTime();this.nonWorkingHoursHidden?(c=c.add(Date.MINUTE,container.getSettingsModel().get("zarafa/v1/main/start_working_hour")),
d=d.add(Date.MINUTE,container.getSettingsModel().get("zarafa/v1/main/end_working_hour"))):(d.setHours(12),d=d.add(Date.DAY,1).clearTime());this.suggestionRange.getStartTime()!==c.getTime()?this.suggestionRange.set(c,d):Ext.isDefined(b)&&this.suggestionRange.fireEvent("update",this.suggestionRange)},loadFreebusyData:function(a){var b=this.getDateRange(),c={add:!0,actionType:Zarafa.core.Actions.list,params:{users:[],start:b.getStartTime()/1E3,end:b.getDueTime()/1E3}};Array.isArray(a)||(a=[a]);Ext.each(a,
function(a){a.isResolved()&&c.params.users.push({userid:a.id,entryid:a.get("entryid")})});Ext.isEmpty(c.params.users)||this.blockStore.load(c)},onUserResolved:function(a,b){this.loadFreebusyData(b)},onUserLoad:function(a,b){this.loadFreebusyData(b)},onUserAdd:function(a,b,c){this.loadFreebusyData(b)},onUserRemove:function(a,b,c){Ext.each(b,function(a){var b=this.blockStore.getRange();Ext.each(b,function(b){b.get("userid")==a.id&&this.blockStore.remove(b)},this)},this)},onUserClear:function(a,b){this.blockStore.removeAll()},
createSumBlock:function(a){return new Zarafa.common.freebusy.data.FreebusyBlockRecord({start:a.get("start"),end:a.get("end"),status:a.get("status")})},createSuggestionBlocks:function(a,b,c,d){var e=[];for(b-=c;a<=b;a+=d)e.push(new Zarafa.common.freebusy.data.FreebusyBlockRecord({start:a,end:a+c}));return e},mergeRecordIntoSumBlock:function(a,b){if(a.get("status")!==b.get("status"))return!1;var c=a.get("start"),d=a.get("end"),e=b.get("start"),f=b.get("end");return d<e||f<c?!1:e<=c&&d<=f?!0:c<e&&f<
d?(b.set("start",c),b.set("end",d),!0):c<e?(b.set("start",c),!0):f<d?(b.set("end",d),!0):!1},mergeBlocksToSumBlockStore:function(a,b,c){var d={};a.sort(function(a,b){return a.get("start")-b.get("start")});Ext.each(a,function(a){var e=a.get("status");if(e===Zarafa.core.mapi.BusyStatus.UNKNOWN||e===Zarafa.core.mapi.BusyStatus.FREE)return!0;!1===c&&(e=Zarafa.core.mapi.BusyStatus.BUSY);if(0===b.getCount())return b.add(this.createSumBlock(a)),!0;var g=d[e];Ext.isDefined(g)&&!0===this.mergeRecordIntoSumBlock(a,
g)||(a=this.createSumBlock(a),b.add(a),d[e]=a)},this)},mergeSumBlocks:function(a){var b={};a.sort("start","ASC");a.each(function(c){var d=b[c.get("status")];if(Ext.isDefined(d)&&d.get("end")>=c.get("start"))return d.set("end",c.get("end")),a.remove(c),!0;b[c.get("status")]=c},this)},onBlockLoad:function(a,b,c){this.sumBlockStore.removeAll();1==this.getUserStore().getCount()?this.blockStore.each(function(a){var b=a.get("status");b!==Zarafa.core.mapi.BusyStatus.UNKNOWN&&b!==Zarafa.core.mapi.BusyStatus.FREE&&
this.sumBlockStore.add(this.createSumBlock(a))},this):this.mergeBlocksToSumBlockStore(this.blockStore.getRange(),this.sumBlockStore);this.sumBlockStore.sort("status","ASC");this.sumBlockStore.fireEvent("load",this.sumBlockStore,this.sumBlockStore.getRange(),{})},onBlockRemove:function(a,b,c){this.onBlockLoad(a,a.getRange(),{})},onSumBlockLoad:function(a,b,c){this.freeBlockStore.removeAll();0<a.getCount()&&this.mergeBlocksToSumBlockStore(b,this.freeBlockStore,!1);this.loadSuggestionBlocks()},onShowWorkingHoursChange:function(a){this.setSuggestionDate(this.suggestionRange.getStartDate())},
onUserStoreChange:function(a,b){a.fireEvent("load",a,a.getRange())},onSelectorRangeUpdate:function(a,b){this.updatingSelectorRangeExternally||this.fireEvent("selectorrangeupdate",a,b);this.updatingSelectorRangeExternally=!1;this.setSuggestionDate(a.getStartDate(),a.getDuration())},onSuggestionRangeUpdate:function(a,b){this.loadSuggestionBlocks()},loadSuggestionBlocks:function(){this.suggestionBlockStore.removeAll();if(0<this.freeBlockStore.getCount()){var a=this.suggestionRange.getStartTime()/1E3,
b=this.suggestionRange.getDueTime()/1E3,c=this.selectorRange.getDuration(Date.SECOND),d=Ext.min([c,1800]);0>=d&&(d=1800);this.freeBlockStore.each(function(e){var f=e.get("start");e=e.get("end");if(!(e<a||f>b)){if(f>b)return!1;f<=a||this.suggestionBlockStore.add(this.createSuggestionBlocks(a,Ext.min([f,b]),c,d));a=e}},this);a<b&&this.suggestionBlockStore.add(this.createSuggestionBlocks(a,b,c,d))}this.suggestionBlockStore.fireEvent("load",this.suggestionBlockStore,this.suggestionBlockStore.getRange(),
{})},checkAttendeesBusyStatus:function(a,b,c){var d=this.getUserStore();if(!d)return!1;for(var d=d.getRange(),e=0,f=d.length;e<f;e++){var g=d[e];if((!0!==c||!0===g.phantom)&&!g.isMeetingOrganizer()&&this.checkAttendeeBusyStatus(g.id,a,b))return!0}return!1},checkAttendeeBusyStatus:function(a,b,c){var d=this.getBlockStore();if(!d)return!1;d.filter("userid",a,!1,!0,!0);d.sort("start","ASC");b=b.getTime()/1E3;c=c.getTime()/1E3;a=!1;for(var e=0,f=d.getCount();e<f;e++){var g=d.getAt(e);if(g.get("end")>
b&&g.get("status")!==Zarafa.core.mapi.BusyStatus.FREE&&g.get("status")!==Zarafa.core.mapi.BusyStatus.UNKNOWN){g.get("start")<c&&(a=!0);break}}d.clearFilter();return a}});Ext.namespace("Zarafa.common.freebusy.data");
Zarafa.common.freebusy.data.TimelineSelector=Ext.extend(Ext.util.Observable,{MOUSE_ON_EDGE_LEFT:1,MOUSE_ON_CENTER:2,MOUSE_ON_EDGE_RIGHT:3,selecting:!1,selectionStart:null,selectionEnd:null,selectorRange:null,dragSelectionEdgeArea:10,constructor:function(a){Ext.apply(this,a||{});Zarafa.common.freebusy.data.TimelineSelector.superclass.constructor.call(this,a)},init:function(a){this.parent=a;this.masterTpl=new Ext.XTemplate('<div class="x-freebusy-selector">',"</div>",{disableFormats:!0});this.parent.on("rendertimeline",
this.onParentRenderTimeline,this);this.parent.on("timelinemousedown",this.onParentTimelineMouseDown,this);this.parent.on("timelinemousemove",this.onParentTimelineMouseMove,this);this.parent.on("timelinemouseup",this.onParentTimelineMouseUp,this);this.bindSelectorRange(this.parent.model.getSelectorRange(),!0)},bindSelectorRange:function(a,b){this.selectorRange&&!b&&this.selectorRange.un("update",this.onSelectorRangeUpdate,this);if(this.selectorRange=a)this.selectorRange.on({scope:this,update:this.onSelectorRangeUpdate})},
render:function(){var a=this.parent.getSelectorContainer();this.masterTpl.overwrite(a);this.selectorElem=Ext.get(a.dom.firstChild);this.selectorElem.setVisibilityMode(Ext.Element.DISPLAY);this.selectorElem.on("mousemove",this.onMouseMoveSelector,this);this.positionSelector(this.selectorRange)},positionSelector:function(a){if(this.parent.model.getDateRange().overlaps(a)){var b=a.getStartDate().getTime()/1E3;a=a.getDueDate().getTime()/1E3;b=this.parent.findBlockPixelOffset(b,!0);this.selectorElem.setLeft(b);
a=this.parent.findBlockPixelOffset(a,!1);this.selectorElem.setWidth(a-b);this.selectorElem.setVisible(!0)}else this.selectorElem.setVisible(!1)},scrollTimelineToSelection:function(){this.parent.scrollDateIntoView(this.selectorRange)},onSelectorRangeUpdate:function(a){this.positionSelector(a);this.selecting||this.scrollTimelineToSelection()},onParentRenderTimeline:function(a){this.render()},onParentTimelineMouseDown:function(a,b,c){if(this.isMouseEventOnScrollbar(a,b))return!0;this.selecting=!0;b=
this.parent.bodyElem;c=a.getPageX()-b.getLeft()+b.getScroll().left;b=this.getMousePosition(a.getPageX());c=this.parent.findTimestampByTimelineXCoord(c);switch(b){case this.MOUSE_ON_EDGE_LEFT:c=this.selectorRange.getDueDate();this.selectionStart=c.getTime()/1E3;break;case this.MOUSE_ON_EDGE_RIGHT:b=this.selectorRange.getStartDate();this.selectionStart=b.getTime()/1E3;break;default:b=new Date(1E3*c),b.round(Date.MINUTE,30),this.selectionStart=b.getTime()/1E3,c=b.add(Date.MINUTE,30),this.selectorRange.set(b,
c)}a.preventDefault()},onParentTimelineMouseMove:function(a,b,c){if(this.selecting){b=this.parent.bodyElem;b=a.getPageX()-b.getLeft()+b.getScroll().left;this.selectionEnd=this.parent.findTimestampByTimelineXCoord(b);c=new Date(1E3*this.selectionEnd);c.round(Date.MINUTE,30);this.selectionEnd=c.getTime()/1E3;if(this.selectionStart!==this.selectionEnd){this.selectionStart<=this.selectionEnd?b=new Date(1E3*this.selectionStart):(b=c,c=new Date(1E3*this.selectionStart));var d=this.selectorRange.getStartDate().getTime()!==
b.getTime(),e=this.selectorRange.getDueDate().getTime()!==c.getTime();(d||e)&&this.selectorRange.set(b,c)}a.preventDefault()}},onParentTimelineMouseUp:function(a,b,c){this.selecting&&(this.selecting=!1,a.preventDefault())},onMouseMoveSelector:function(a,b,c){if(!this.selecting)switch(this.getMousePosition(a.getPageX())){case this.MOUSE_ON_EDGE_LEFT:case this.MOUSE_ON_EDGE_RIGHT:this.selectorElem.setStyle("cursor","w-resize");break;default:this.selectorElem.setStyle("cursor","")}},getMousePosition:function(a){var b=
this.selectorElem.getXY()[0],c=b+this.selectorElem.getWidth();return Math.abs(a-b)<this.dragSelectionEdgeArea?this.MOUSE_ON_EDGE_LEFT:Math.abs(c-a)<this.dragSelectionEdgeArea?this.MOUSE_ON_EDGE_RIGHT:this.MOUSE_ON_EDGE_CENTER},isMouseEventOnScrollbar:function(a,b){var c=this.parent.bodyElem.dom;if(a&&a.browserEvent&&c){var d=Ext.get(c).getXY();if(a.browserEvent.clientX-d[0]>c.clientWidth||a.browserEvent.clientY-d[1]>c.clientHeight)return!0}return!1}});Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.FreebusyPanel=Ext.extend(Ext.Panel,{blockStore:null,userStore:null,model:null,userlistConfig:null,timelineConfig:null,suggestionConfig:null,legendaConfig:null,showUserList:!0,showSuggestionList:!0,editable:!0,showLegenda:!0,inputfieldHeight:20,initialScrollToCurrentDay:!0,initialScrollDone:!1,constructor:function(a){a=a||{};var b=a.modelConfig||{};Ext.applyIf(b,{userStore:a.userStore,blockStore:a.blockStore});b=new Zarafa.common.freebusy.data.FreebusyModel(b);Ext.applyIf(a,
{layout:"border",border:!0,blockStore:b.getBlockStore(),userStore:b.getUserStore(),model:b,userlistConfig:{},timelineConfig:{},suggestionConfig:{},legendaConfig:{}});Zarafa.common.freebusy.ui.FreebusyPanel.superclass.constructor.call(this,a);this.add([this.createUserListView(),this.createSuggestionView(),this.createTimelineView(),this.createLegendaView()]);this.initFreebusyEvents()},createUserListView:function(){return{xtype:"panel",ref:"userListView",region:"west",layout:"fit",title:_("Select attendees"),
hidden:!this.showUserList,cls:"x-freebusy-userlist",footer:!0,footerCfg:{tag:"div",cls:"x-panel-footer"},border:!0,width:200,collapsible:!0,split:!0,items:[Ext.applyIf(this.userlistConfig,{xtype:"zarafa.freebusyuserlistview",model:this.model,inputFieldHeight:this.editable?this.inputfieldHeight:0,editable:this.editable})]}},createSuggestionView:function(){return{xtype:"panel",ref:"suggestionListView",region:"east",layout:"fit",title:_("Suggested Times"),hidden:!this.showSuggestionList,cls:"zarafa-freebusy-suggestionlist",
footer:!0,footerCfg:{tag:"div",cls:"x-panel-footer"},border:!0,width:200,collapsible:!0,split:!0,items:[Ext.applyIf(this.suggestionConfig,{xtype:"zarafa.freebusysuggestionlistpanel",model:this.model,listeners:{select:this.onSelectSuggestion,dateselect:this.onSuggestionDateSelect,scope:this}})]}},createTimelineView:function(){return Ext.applyIf(this.timelineConfig,{xtype:"zarafa.freebusytimelineview",ref:"timelineView",region:"center",blockStore:this.blockStore,model:this.model,selector:new Zarafa.common.freebusy.data.TimelineSelector,
extraBodyHeight:this.editable?this.inputfieldHeight:0,hideNonWorkingHours:!0,listeners:{bodyscroll:this.onTimelineScroll,scope:this}})},createLegendaView:function(){return Ext.applyIf(this.legendaConfig,{xtype:"container",region:"south",border:!1,layout:"hbox",hidden:!this.showLegenda,autoHeight:!0,cls:"x-freebusy-timeline-container x-freebusy-legenda",items:[{xtype:"container",cls:"x-freebusy-timeline-block-busy",width:24,height:24},{xtype:"displayfield",value:_("Busy"),hideLabel:!0,autoWidth:!0},
{xtype:"container",cls:"x-freebusy-timeline-block-tentative",width:24,height:24},{xtype:"displayfield",value:_("Tentative"),hideLabel:!0,autoWidth:!0},{xtype:"container",cls:"x-freebusy-timeline-block-outofoffice",width:24,height:24},{xtype:"displayfield",value:_("Out of Office"),hideLabel:!0,autoWidth:!0},{xtype:"container",cls:"x-freebusy-timeline-block-blur",width:24,height:24},{xtype:"displayfield",value:_("No Information"),hideLabel:!0,autoWidth:!0}]})},initFreebusyEvents:function(){this.on("afterlayout",
this.onAfterLayout,this)},getModel:function(){return this.model},setEditable:function(a){this.editable!==a&&(this.editable=a,this.userListView.get(0).setEditable(a))},onAfterLayout:function(a){this.userListView&&(a=this.headerHeight,a-=this.userListView.header.getMargins("tb"),a-=this.userListView.header.getBorderWidth("tb"),a-=this.userListView.header.getPadding("tb"),this.userListView.header.setStyle("height",a+"px"),this.userListView.footer.setStyle("height",Ext.getScrollBarWidth()-2+"px"));this.suggestionListView&&
(a=this.headerHeight,a-=this.userListView.header.getMargins("tb"),a-=this.userListView.header.getBorderWidth("tb"),a-=this.userListView.header.getPadding("tb"),this.suggestionListView.header.setStyle("height",a+"px"),this.suggestionListView.footer.setStyle("height",Ext.getScrollBarWidth()-2+"px"));this.initialScrollToCurrentDay&&(Ext.isIE||!this.initialScrollDone&&0!==this.timelineView.getWidth())&&(this.initialScrollDone=!0,this.scrollTimelineToSelection())},scrollTimelineToSelection:function(){this.timelineView.selector?
this.timelineView.selector.scrollTimelineToSelection():this.timelineView.scrollDateIntoView(new Date)},scrollTimelineToDate:function(a){this.timelineView.scrollDateIntoView(a)},onTimelineScroll:function(a){this.userListView.body.scrollTo("top",a.top)},onSelectSuggestion:function(a,b){var c=1E3*b.get("start"),d=1E3*b.get("end");this.getModel().getSelectorRange().setTime(c,d)},onSuggestionDateSelect:function(a,b){this.scrollTimelineToDate(b)}});Ext.reg("zarafa.freebusypanel",Zarafa.common.freebusy.ui.FreebusyPanel);
Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.SuggestionListPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:{type:"vbox",align:"stretch"},border:!1,items:[{xtype:"panel",border:!0,autoHeight:!0,items:[{xtype:"container",border:!1,height:168,width:175,layout:"fit",items:[{xtype:"datepicker",ref:"../../suggestionDate",showToday:!1,minDate:a.model?a.model.getDateRange().getStartDate():null,minText:_("No freebusy information available for this date"),maxDate:a.model?a.model.getDateRange().getDueDate():
null,maxText:_("No freebusy information available for this date"),style:"border : none",listeners:{select:this.onDateSelect,scope:this}}]}]},{xtype:"panel",flex:1,layout:"fit",cls:"suggestionlist",border:!1,items:[{xtype:"zarafa.freebusysuggestionlistview",autoScroll:!0,model:a.model,listeners:{click:this.onSuggestionClick,scope:this}}]}]});this.addEvents(["dateselect","select"]);Zarafa.common.freebusy.ui.SuggestionListPanel.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.common.freebusy.ui.SuggestionListPanel.superclass.initEvents.call(this);
this.mon(this.model.getDateRange(),"update",this.onDateRangeUpdate,this);this.mon(this.model.getSuggestionRange(),"update",this.onSuggestionRangeUpdate,this)},onSuggestionClick:function(a,b,c,d){a=a.getStore().getAt(b);this.fireEvent("select",this,a)},onDateSelect:function(a,b){this.model.setSuggestionDate(b);this.fireEvent("dateselect",this,b)},onDateRangeUpdate:function(a,b){this.suggestionDate.setMinDate(a.getStartDate());this.suggestionDate.setmaxDate(a.getDueDate())},onSuggestionRangeUpdate:function(a,
b){this.suggestionDate.setValue(a.getStartDate())}});Ext.reg("zarafa.freebusysuggestionlistpanel",Zarafa.common.freebusy.ui.SuggestionListPanel);Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.SuggestionListView=Ext.extend(Ext.DataView,{constructor:function(a){a=a||{};var b=a.model?a.model.getSuggestionBlockStore():void 0;Ext.applyIf(a,{deferEmptyText:!1,emptyText:'<div class="zarafa-freebusy-suggestionrow emptytext">'+_("No suggestions available")+"</div>",tpl:new Ext.XTemplate('<tpl for=".">','<div class="x-btn zarafa-freebusy-suggestionrow" id="zarafa-freebusy-suggestionrow-{[xindex]}">','<div class="x-btn-small x-btn-icon-small-left">','<em class="" class="x-unselectable" unselectable="on">',
'<button type="button" class=" x-btn-text">','<img class="x-freebusy-suggestionrow-icon" src="'+Ext.BLANK_IMAGE_URL+'" />',"{[this.formatTime(values.start)]} - {[this.formatTime(values.end)]}","</button>","</em>","</div>","</div>","</tpl>",{formatTime:function(a){return(new Date(1E3*a)).format(_("G:i"))}}),store:b,itemSelector:"div.zarafa-freebusy-suggestionrow"});Zarafa.common.freebusy.ui.SuggestionListView.superclass.constructor.call(this,a);this.mon(this.model,"suggestionblockstorechange",this.onSuggestionBlockStoreChange,
this)},onSuggestionBlockStoreChange:function(a){this.bindStore(a)}});Ext.reg("zarafa.freebusysuggestionlistview",Zarafa.common.freebusy.ui.SuggestionListView);Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.TimelineView=Ext.extend(Ext.BoxComponent,{model:null,selector:null,headerHeight:64,defaultHourCellWidth:60,bufferTimesViewportWidth:5,daysMap:null,hoursEachDayMap:null,daySpacing:3,borderSpacing:0,blockRowHeight:30,sumBlockRowHeight:12,extraBodyHeight:0,workingHoursStart:0,workingHoursEnd:24,workDays:void 0,blockSelector:"div.x-freebusy-timeline-block",headerDayHeight:0,headerHoursHeight:24,headerSumRowHeight:10,slotDuration:null,dayWidth:null,hourWidth:null,timelineWidth:null,
all:null,userStore:null,blockStore:null,sumBlockStore:null,uniqueBlockId:null,constructor:function(a){a=a||{};a=Ext.applyIf(a,{workingHoursStart:container.getSettingsModel().get("zarafa/v1/main/start_working_hour"),workingHoursEnd:container.getSettingsModel().get("zarafa/v1/main/end_working_hour"),workDays:container.getSettingsModel().get("zarafa/v1/main/working_days")});Ext.isEmpty(a.workDays)&&(a.workDays=[0,1,2,3,4,5,6]);this.addEvents("bodyscroll","timelinemousedown","timelinemouseup","timelinemousemove",
"rendertimeline","beforerefreshtimeline","afterrefreshtimeline");Zarafa.common.freebusy.ui.TimelineView.superclass.constructor.call(this,a);this.daterange=this.model.getDateRange();this.mon(this.model,{userstorechange:this.onUserStoreChange,blockstorechange:this.onBlockStoreChange,sumblockstorechange:this.onSumBlockStoreChange,showworkinghourschange:this.onShowWorkingHoursChange,scope:this})},initComponent:function(){this.masterTpl=new Ext.XTemplate('<div class="x-freebusy-header">','<div class="x-freebusy-header-body"></div>',
'<div class="x-freebusy-sumblockcontainer"></div>',"</div>",'<div class="x-freebusy-body">','<div class="x-freebusy-background"></div>','<div class="x-freebusy-blockcontainer"></div>','<div class="x-freebusy-selectorcontainer"></div>',"</div>",{disableFormats:!0});this.headerTemplate=new Ext.XTemplate('<table class="x-freebusy-timeline-day-header" cellpadding="0" cellspacing="0" style="width: {dayWidth}px">','<tr class="x-freebusy-timeline-day">','<td colspan="{numHours}" style="height:{headerDayHeight}px;">',
"{dayLabel}","</td>","</tr>",'<tr class="x-freebusy-timeline-hour">','<tpl for="hours">','<td style="width: {parent.hourWidth}px; height:{parent.headerHoursHeight}px;">{label}</td>',"</tpl>","</tr>","</table>",{disableFormats:!0});this.headerSumTemplate=new Ext.XTemplate('<table class="x-freebusy-timeline-day-sum" cellpadding="0" cellspacing="0" style="width: {dayWidth}px">','<tr class="x-freebusy-timeline-hour x-freebusy-timeline-sum">','<tpl for="hours">','<td style="width: {parent.hourWidth}px; height:{parent.headerSumRowHeight}px;"></td>',
"</tpl>","</tr>","</table>",{disableFormats:!0});this.bodyBGTemplate=new Ext.XTemplate('<table class="x-freebusy-timeline-day-body" cellpadding="0" cellspacing="0" style="width: {dayWidth}px">','<tr class="x-freebusy-timeline-hour">','<tpl for="hours">','<td style="width: {parent.hourWidth}px">&nbsp;</td>',"</tpl>","</tr>","</table>",{disableFormats:!0});this.blockTemplate=new Ext.XTemplate('<tpl for=".">','<div class="x-freebusy-timeline-block x-freebusy-timeline-block-{busyStatusName}" id="{blockId}" style="width: {blockWidth}px; left: {blockLeft}px; top:{blockTop}px; height: {blockHeight}px;"></div>',
"</tpl>",{disableFormats:!0});this.sumBlockTemplate=new Ext.XTemplate('<tpl for=".">','<div class="x-freebusy-timeline-sumblock x-freebusy-timeline-block-{busyStatusName}" style="width: {blockWidth}px; left: {blockLeft}px; height: {blockHeight}px;"></div>',"</tpl>",{disableFormats:!0});this.uniqueBlockId=Ext.id();this.all=new Ext.CompositeElementLite;Zarafa.common.freebusy.ui.TimelineView.superclass.initComponent.call(this);this.selector&&this.selector.init(this)},onRender:function(){this.autoEl=
{cls:"x-freebusy-timeline-container"};Zarafa.common.freebusy.ui.TimelineView.superclass.onRender.apply(this,arguments);this.buildDayMapping();this.renderTimeline()},refreshTimeline:function(){this.fireEvent("beforerefreshtimeline",this);var a=this.captureViewportSnapshot();this.buildDayMapping();this.renderTimeline();this.syncSize();this.restoreViewportSnapshot(a);this.refresh();this.fireEvent("afterrefreshtimeline",this)},captureViewportSnapshot:function(){var a={selectionInView:!1,focusDateRange:null,
diffOffset:null},b=this.model.getSelectorRange();a.selectionInView=this.getViewedDateRange().overlaps(b);if(a.selectionInView){var b=b.getStartDate(),b=this.findBlockPixelOffset(b.getTime()/1E3),c=this.bodyElem.getScroll().left,d=Ext.get(this.bodyElem).getViewSize();a.diffOffset=b-(c+d.width/2)}else a.focusDateRange=this.getFocusDateRange();return a},restoreViewportSnapshot:function(a){if(a.selectionInView){var b=this.model.getSelectorRange().getStartDate();a=this.findBlockPixelOffset(b.getTime()/
1E3)-a.diffOffset;a=this.findTimestampByTimelineXCoord(a);a=new Zarafa.core.DateRange({startDate:new Date(1E3*a),dueDate:new Date(1E3*a)})}else a=a.focusDateRange;this.scrollDateIntoView(a)},getFocusDateRange:function(){var a=this.bodyElem.getScroll().left,b=Ext.get(this.bodyElem).getViewSize(),a=(a+b.width/2)/(this.dayWidth+this.daySpacing),b=a%1,a=Math.floor(a),a=this.daysMap[a].timestamp+this.hoursEachDayMap[Math.floor(this.hoursEachDayMap.length*b)].startDayOffset;return new Zarafa.core.DateRange({startDate:new Date(1E3*
a),dueDate:new Date(1E3*(a+this.slotDuration))})},getViewedDateRange:function(){var a=this.bodyElem.getScroll().left,b=Ext.get(this.bodyElem).getViewSize(),b=a+b.width,a=this.findTimestampByTimelineXCoord(a),b=this.findTimestampByTimelineXCoord(b);return new Zarafa.core.DateRange({startDate:new Date(1E3*a),dueDate:new Date(1E3*b)})},renderTimeline:function(){this.bodyElem&&this.mun(this.bodyElem,{scope:this,scroll:this.onBodyScroll,mousedown:this.onBodyMouseDown,mousemove:this.onBodyMouseMove,mouseup:this.onBodyMouseUp,
contextmenu:this.onBodyContextMenu});this.headerElem&&this.mun(this.headerElem,{scope:this,contextmenu:this.onHeaderContextMenu});this.masterTpl.overwrite(this.el);this.containerElem=Ext.get(this.el.dom);this.headerElem=Ext.get(this.containerElem.dom.firstChild);this.headerBodyElem=Ext.get(this.headerElem.dom.firstChild);this.headerSumContainer=Ext.get(this.headerElem.dom.childNodes[1]);this.bodyElem=Ext.get(this.containerElem.dom.childNodes[1]);this.bodyBackgroundElem=Ext.get(this.bodyElem.dom.firstChild);
this.bodyBlockContainer=Ext.get(this.bodyElem.dom.childNodes[1]);this.bodySelectorContainer=Ext.get(this.bodyElem.dom.childNodes[2]);this.mon(this.bodyElem,{scope:this,scroll:this.onBodyScroll,mousedown:this.onBodyMouseDown,mousemove:this.onBodyMouseMove,mouseup:this.onBodyMouseUp,contextmenu:this.onBodyContextMenu});this.mon(this.headerElem,{scope:this,contextmenu:this.onHeaderContextMenu});this.layoutTimelineElements();this.fireEvent("rendertimeline",this)},layoutTimelineElements:function(){this.headerBodyElem.setWidth(this.timelineWidth);
this.bodyBackgroundElem.setWidth(this.timelineWidth);this.bodyBlockContainer.setWidth(this.timelineWidth);this.headerDayHeight=this.headerHeight-(this.headerSumRowHeight+2*this.borderSpacing)-this.headerHoursHeight;this.headerSumContainer.setTop(this.headerHeight-(this.headerSumRowHeight+this.borderSpacing))},afterRender:function(){Zarafa.common.freebusy.ui.TimelineView.superclass.afterRender.apply(this,arguments);this.model.getBlockStore()&&this.bindBlockStore(this.model.getBlockStore(),!0);this.model.getSumBlockStore()&&
this.bindSumBlockStore(this.model.getSumBlockStore(),!0);this.model.getUserStore()&&this.bindUserStore(this.model.getUserStore(),!0)},getBlockTemplateTarget:function(){return this.bodyBlockContainer},getBGTemplateTarget:function(){return this.bodyBackgroundElem},getSelectorContainer:function(){return this.bodySelectorContainer},onResize:function(a,b,c,d){this.headerElem.setHeight(this.headerHeight);this.bodyElem.setTop(this.headerHeight);this.bodyElem.setHeight(b-this.headerHeight);this.sizeTimelineBackground();
this.repaintTimeline()},onBodyScroll:function(){this.repaintTimeline();this.fireEvent("bodyscroll",this.bodyElem.getScroll())},onBodyMouseDown:function(a,b,c){this.fireEvent("timelinemousedown",a,b,c)},onBodyMouseMove:function(a,b,c){this.fireEvent("timelinemousemove",a,b,c)},onBodyMouseUp:function(a,b,c){this.fireEvent("timelinemouseup",a,b,c)},onBodyContextMenu:function(a,b,c){Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy.timelinebody"],
void 0,{position:a.getXY(),model:this.model})},onHeaderContextMenu:function(a,b,c){Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy.timelineheader"],void 0,{position:a.getXY(),model:this.model})},restyleBodyBackground:function(){for(var a="url(data:image/gif;base64,R0lGODlhAQABAIABAObm5v///yH+EUNyZWF0ZWQgd2l0aCBHSU1QACwAAAAAAQABAAACAkQBADs=) repeat-x left top",b=0;b<=this.userStore.getCount();b++)a+=", url(data:image/gif;base64,R0lGODlhAQABAIABAObm5v///yH+EUNyZWF0ZWQgd2l0aCBHSU1QACwAAAAAAQABAAACAkQBADs=) repeat-x left "+
this.blockRowHeight*(b+1)+"px";for(var c=this.bodyBackgroundElem.query(".x-freebusy-timeline-day"),b=0;b<c.length;b++)Ext.get(c[b]).setStyle("background",a)},sizeTimelineBackground:function(){if(!(0>=this.bodyElem.dom.clientHeight)){var a=this.userStore.getCount()*this.blockRowHeight+this.extraBodyHeight;this.bodyBackgroundElem.setHeight(Math.max(this.bodyElem.dom.clientHeight,a));this.bodySelectorContainer.setHeight(Math.max(this.bodyElem.dom.clientHeight,a));this.bodyElem.scrollTo("top",this.bodyElem.dom.scrollHeight);
this.restyleBodyBackground()}},repaintTimeline:function(){for(var a=Ext.get(this.bodyElem).getViewSize(),b=this.bodyElem.getScroll(),c=(this.bufferTimesViewportWidth-1)*a.width,d=Math.floor((b.left-c/2)/this.dayWidth),a=Math.ceil((b.left+a.width+c/2)/this.dayWidth),d=0>d?0:d,a=a<this.daysMap.length?a:this.daysMap.length-1,b=[],c=[],e=0;e<this.daysMap.length;e++)e>=d&&e<=a?this.daysMap[e].displayNodeBody||(b[b.length]=e):this.daysMap[e].displayNodeBody&&(c[c.length]=e);this.renderTimelineDays(b);this.headerElem.scrollTo("left",
this.bodyElem.getScroll().left);this.cleanUpTimelineDays(c);this.restyleBodyBackground()},renderTimelineDays:function(a){for(var b=Ext.get(this.headerBodyElem),c=Ext.get(this.bodyBackgroundElem),d=0;d<a.length;d++){var e=a[d],f="";this.daysMap[e].currentDay&&(f=" x-freebusy-timeline-day-current");var g=c.createChild({cls:"x-freebusy-timeline-day"+f});g.dom.style.left=this.daysMap[e].leftPos+"px";this.bodyBGTemplate.overwrite(g,{dayLabel:this.daysMap[e].label,hours:this.hoursEachDayMap,hourWidth:this.hourWidth,
numHours:this.hoursEachDayMap.length,dayWidth:this.dayWidth});f=b.createChild({cls:"x-freebusy-timeline-day"+f});f.dom.style.left=this.daysMap[e].leftPos+"px";this.headerTemplate.overwrite(f,{dayLabel:this.daysMap[e].label,hours:this.hoursEachDayMap,hourWidth:this.hourWidth,numHours:this.hoursEachDayMap.length,dayWidth:this.dayWidth,headerDayHeight:this.headerDayHeight,headerHoursHeight:this.headerHoursHeight,borderSpacing:this.borderSpacing});this.headerSumTemplate.append(f,{hours:this.hoursEachDayMap,
hourWidth:this.hourWidth,numHours:this.hoursEachDayMap.length,dayWidth:this.dayWidth,headerSumRowHeight:this.headerSumRowHeight,borderSpacing:this.borderSpacing});this.daysMap[e].displayNodeHeader=f;this.daysMap[e].displayNodeBody=g}},cleanUpTimelineDays:function(a){for(var b,c=0;c<a.length;c++){var d=a[c];b=this.daysMap[d].displayNodeHeader;Ext.removeNode(b.dom);b=this.daysMap[d].displayNodeBody;Ext.removeNode(b.dom);this.daysMap[d].displayNodeHeader=!1;this.daysMap[d].displayNodeBody=!1}},scrollDateIntoView:function(a){if(a instanceof
Date)a=Math.ceil(a.getTime()/1E3);else if(a instanceof Zarafa.core.DateRange){var b=a.getStartDate().getTime()/1E3;a=a.getDueDate().getTime()/1E3;a=b+(a-b)/2}var b=Ext.get(this.bodyElem),c=Ext.get(this.bodyElem).getViewSize();a=this.findBlockPixelOffset(a,!0);a-=c.width/2;b.scrollTo("left",a)},buildDayMapping:function(){var a=(new Date).clearTime();this.daysMap=[];this.hoursEachDayMap=[];this.slotDuration=3600;for(var b=86400/this.slotDuration,c=0;c<b;c++){var d=Math.floor(this.workingHoursStart/
60),e=Math.ceil(this.workingHoursEnd/60);if(!this.model.showOnlyWorkingHours()||c>=d&&c<e)this.hoursEachDayMap[this.hoursEachDayMap.length]={label:Date.parseDate(c,"G").format(_("G:i")),startDayOffset:c*this.slotDuration,workingHour:c>=d&&c<e?!0:!1}}c=this.hoursEachDayMap.length;this.hourWidth=this.defaultHourCellWidth;this.dayWidth=(this.hourWidth+this.borderSpacing)*c+this.borderSpacing;b=this.daterange.getStartDate().clearTime(!0);b.setHours(12);for(c=0;c<this.daterange.getNumDays();c++){for(var d=
b.add(Date.DAY,c).clearTime(),e=a.getTime()==d.getTime(),f=!1,g=0,h=this.workDays.length;g<h;g++)if(this.workDays[g]==d.getDay()){f=!0;break}this.model.showOnlyWorkingHours()&&!f||this.daysMap.push({label:d.format(_("l jS F Y")),currentDay:e,timestamp:d.getTime()/1E3,displayNodeHeaderBody:!1,displayNodeBody:!1,leftPos:this.daysMap.length*(this.dayWidth+this.daySpacing)})}this.timelineWidth=(this.dayWidth+this.daySpacing)*this.daysMap.length-this.daySpacing},bindBlockStore:function(a,b){this.blockStore&&
this.mun(this.blockStore,"load",this.onBlockLoad,this);if(this.blockStore=Ext.StoreMgr.lookup(a))this.mon(this.blockStore,{scope:this,load:this.onBlockLoad}),this.refresh()},bindSumBlockStore:function(a,b){this.sumBlockStore&&this.mun(this.sumBlockStore,"load",this.onSumBlocksLoad,this);if(this.sumBlockStore=Ext.StoreMgr.lookup(a))this.mon(this.sumBlockStore,{scope:this,load:this.onSumBlocksLoad}),this.refresh()},onBlockLoad:function(a,b,c){0===this.all.getCount()?this.refresh():(a=this.filterRecords(b),
a=this.bufferBlockRender(a),this.all.last().insertSibling(a,"after",!0),this.all.elements.push.apply(this.all.elements,a))},onSumBlocksLoad:function(a,b,c){0===a.getCount()?this.sumBlockTemplate.overwrite(this.headerSumContainer.dom,[]):this.sumBlockTemplate.overwrite(this.headerSumContainer.dom,this.collectData(b,0,!0))},onRemove:function(a,b,c){this.all.removeElement(this.uniqueBlockId+"-"+b.id,!0);0===this.blockStore.getCount()&&this.refresh()},refresh:function(){this.bodyBlockContainer.update("");
this.all.clear();if(this.blockStore){var a=this.blockStore.getRange();0<a.length&&(a=this.filterRecords(a),this.blockTemplate.overwrite(this.bodyBlockContainer.dom,this.collectData(a)),a=Ext.query(this.blockSelector,this.bodyBlockContainer.dom),this.all.fill(a))}this.sumBlockStore&&(a=this.sumBlockStore.getRange(),0<a.length&&(a=this.filterRecords(a),this.sumBlockTemplate.overwrite(this.headerSumContainer.dom,this.collectData(a))))},bufferBlockRender:function(a){var b=document.createElement("div");
this.blockTemplate.overwrite(b,this.collectData(a));return Ext.query(this.blockSelector,b)},collectData:function(a,b,c){for(var d=[],e=0,f=a.length;e<f;e++)d[d.length]=this.prepareData(a[e].data,b+e,a[e],c);return d},prepareData:function(a,b,c,d){a=Ext.apply({},a);a.blockId=this.uniqueBlockId+"-"+c.id;a.status!=Zarafa.core.mapi.BusyStatus.UNKNOWN?(a.busyStatusName=Zarafa.core.mapi.BusyStatus.getName(a.status)||"busy",a.busyStatusName=a.busyStatusName.toLowerCase()):(a.busyStatusName="blur",this.model.showOnlyWorkingHours()&&
(b=(new Date(1E3*a.start)).getDay(),6===b?a.start=(new Date(1E3*a.start)).add(Date.DAY,2).getTime()/1E3:0===b&&(a.start=(new Date(1E3*a.start)).add(Date.DAY,1).getTime()/1E3)),b=this.findDayIndexByTimestamp(a.start,!0),a.start=this.daysMap[b].timestamp);b=1;!0===d?d=this.sumBlockRowHeight:(d=this.blockRowHeight,c=this.userStore.indexOfId(c.get("userid")),0<=c&&(b+=c*d));a.blockTop=b;var e=this.daterange.getStartDate().getTime()/1E3;c=this.daterange.getDueDate().getTime()/1E3;var f=parseInt(a.start,
10);b=parseInt(a.end,10);f<c&&b>e&&(a.blockHeight=d-2,f<e?a.blockLeft=0:(d=this.findBlockPixelOffset(f,!0),a.blockLeft=d),b>c?a.blockWidth=this.bodyBackgroundElem.getWidth()-a.blockLeft:(d=this.findBlockPixelOffset(b,!1),a.blockWidth=d-a.blockLeft));return a},filterRecords:function(a){for(var b=[],c=this.daterange.getStartDate().getTime()/1E3,d=this.daterange.getDueDate().getTime()/1E3,e=0;e<a.length;e++){var f=parseInt(a[e].get("start"),10),g=parseInt(a[e].get("end"),10);this.filterBlockData(f,g,
c,d)&&b.push(a[e])}return b},filterBlockData:function(a,b,c,d){if(a<d&&b>c)if(this.model.showOnlyWorkingHours())if(b-a<=60*(this.workingHoursStart+(1440-this.workingHoursEnd))){if(c=60*this.workingHoursStart,d=60*this.workingHoursEnd,a=new Date(1E3*a),b=new Date(1E3*b),a=3600*a.getHours()+60*a.getMinutes()+a.getSeconds(),b=3600*b.getHours()+60*b.getMinutes()+b.getSeconds(),a>=c&&a<d||b>c&&b<=d||a<c&&b>d)return!0}else return!0;else return!0;return!1},findBlockPixelOffset:function(a,b){var c=this.findDayIndexByTimestamp(a,
b);if(86400<=a-this.daysMap[c].timestamp)return this.daysMap[c].leftPos+this.dayWidth;var d=new Date(1E3*a),e=d.getHours(),d=d.getMinutes(),e=0!==e||0!==d||b?this.findPixelOffsetStartOfDayBySecs(60*(60*e+d)):this.dayWidth;-1==e&&(e=this.dayWidth+(c<this.daysMap.length-1?this.daySpacing:0));return this.daysMap[c].leftPos+e},findPixelOffsetStartOfDayBySecs:function(a){var b=this.hoursEachDayMap[0].startDayOffset;if(this.hoursEachDayMap[this.hoursEachDayMap.length-1].startDayOffset+this.slotDuration<
a)return-1;if(b>=a)return 0;a=(a-b)/(this.slotDuration*this.hoursEachDayMap.length)*this.dayWidth;return a=Math.round(a)},findDayIndexByTimestamp:function(a,b){Ext.isDefined(b)||(b=!0);for(var c=0,d=0;d<this.daysMap.length;d++)if(b&&this.daysMap[d].timestamp<=a)c=d;else if(!b&&this.daysMap[d].timestamp<a)c=d;else break;return c},findTimestampByTimelineXCoord:function(a){var b=a/(this.dayWidth+this.daySpacing);a=b%1*(this.dayWidth+this.daySpacing)/this.dayWidth;a=1>a?a*this.slotDuration*this.hoursEachDayMap.length+
this.hoursEachDayMap[0].startDayOffset:this.hoursEachDayMap[this.hoursEachDayMap.length-1].startDayOffset+this.slotDuration;var b=new Date(1E3*this.daysMap[Math.floor(b)].timestamp),c=Math.floor(a%3600/60);b.setHours(Math.floor(a/3600));b.setMinutes(c);return Math.floor(b.getTime()/1E3)},bindUserStore:function(a,b){this.userStore&&this.mun(this.userStore,{datachanged:this.onUserRefresh,add:this.onUserAdd,remove:this.onUserRemove,clear:this.onUserRefresh,scope:this});if(this.userStore=Ext.StoreMgr.lookup(a))this.mon(this.userStore,
{datachanged:this.onUserRefresh,add:this.onUserAdd,remove:this.onUserRemove,clear:this.onUserRefresh,scope:this}),b||this.sizeTimelineBackground()},onUserStoreChange:function(a){this.bindUserStore(a);this.refresh();this.sizeTimelineBackground()},onBlockStoreChange:function(a){this.bindBlockStore(a)},onSumBlockStoreChange:function(a){this.bindSumBlockStore(a)},onShowWorkingHoursChange:function(a){this.refreshTimeline()},onUserRefresh:function(){this.refresh();this.sizeTimelineBackground()},onUserAdd:function(){this.sizeTimelineBackground()},
onUserRemove:function(a,b,c){this.refresh();this.sizeTimelineBackground()}});Ext.reg("zarafa.freebusytimelineview",Zarafa.common.freebusy.ui.TimelineView);Ext.ns("Zarafa.common.plugins");
Zarafa.common.plugins.FieldLabeler=Ext.extend(Ext.util.Observable,{init:function(a){a.onRender=a.onRender.createSequence(this.onRender);a.onResize=this.onResize;a.adjustPosition=this.adjustPosition;a.onDestroy=a.onDestroy.createSequence(this.onDestroy)},onRender:function(){if(!(this.ownerCt&&this.ownerCt.layout instanceof Ext.layout.FormLayout)){var a=function(a){for(var b=this.ownerCt;b;b=b.ownerCt)if(b[a])return b[a]};this.resizeEl=(this.wrap||this.el).wrap({cls:"x-form-element"});this.positionEl=
this.itemCt=this.resizeEl.wrap({cls:"x-form-item "});this.nextSibling()&&(this.margins={top:0,right:0,bottom:this.positionEl.getMargins("b"),left:0});this.actionMode="itemCt";Ext.isDefined(this.hideLabels)||(this.hideLabels=a.call(this,"hideLabels"));this.hideLabels?this.resizeEl.setStyle("padding-left","0px"):(Ext.isDefined(this.labelSeparator)||(this.labelSeparator=a.call(this,"labelSeparator")),Ext.isDefined(this.labelPad)||(this.labelPad=a.call(this,"labelPad")),Ext.isDefined(this.labelAlign)||
(this.labelAlign=a.call(this,"labelAlign")||"left"),this.itemCt.addClass("x-form-label-"+this.labelAlign),"top"==this.labelAlign?(this.labelWidth||(this.labelWidth="auto"),this.resizeEl.setStyle("padding-left","0px")):(Ext.isDefined(this.labelWidth)||(this.labelWidth=a.call(this,"labelWidth")||100),this.resizeEl.setStyle("padding-left",this.labelWidth+(this.labelPad||5)+"px"),this.labelWidth+="px"),this.label=this.itemCt.insertFirst({tag:"label",cls:"x-form-item-label",style:{width:this.labelWidth},
html:this.fieldLabel+(this.labelSeparator||":")}))}},onResize:function(a,b,c,d){var e=a,f;f=a;var g=b;this.layout instanceof Ext.layout.FormLayout||(Ext.isEmpty(this.flex)&&Ext.isEmpty(this.columnWidth)?f+=this.resizeEl.getPadding("l"):e-=this.resizeEl.getPadding("l"));this.innerCt&&this.innerCt.setSize(e,g);Ext.form.Field.prototype.onResize.apply(this,arguments);this.resizeEl&&this.resizeEl.setWidth(g);this.itemCt&&this.itemCt.setWidth(f);this.getTriggerWidth?(this.wrap.setWidth(e),this.el.setWidth(e-
this.getTriggerWidth())):this.el.setWidth(e);"textarea"==this.el.dom.tagName.toLowerCase()&&(f=this.resizeEl.getHeight(!0),this.hideLabels||"top"!=this.labelAlign||(f-=this.label.getHeight()),this.el.setHeight(f));this instanceof Ext.form.ComboBox&&(!isNaN(e)&&this.isVisible()&&this.list?this.doResize(e):this.bufferSize=e)},adjustPosition:function(a,b){this.ownerCt.layout instanceof Ext.layout.HBoxLayout&&(a=0,this.ownerCt.items.each(function(b){if(b===this)return!1;a+=b.getActionEl().getWidth()},
this));return{x:a,y:b}},onDestroy:function(){this.ownerCt&&(Ext.destroy(this.ownerCt),this.ownerCt.remove())}});Ext.preg("zarafa.fieldlabeler",Zarafa.common.plugins.FieldLabeler);Ext.namespace("Zarafa.common.plugins");
Zarafa.common.plugins.IconDragSelectorPlugin=Ext.extend(Object,{view:void 0,itemRegions:void 0,bodyRegion:void 0,proxy:void 0,tracker:void 0,dragRegion:void 0,constructor:function(a){Ext.apply(this,a);Zarafa.common.plugins.IconDragSelectorPlugin.superclass.constructor.call(this,a)},init:function(a){this.view=a;this.view.on("render",this.onRender,this)},fillRegions:function(){this.itemRegions=[];this.view.all.each(function(a){this.itemRegions.push(a.getRegion())},this);this.bodyRegion=this.view.el.getRegion()},
cancelClick:function(){return!1},onBeforeStart:function(a){return this.view.getEl().contains(a.target)&&!Ext.dd.DragDropMgr.dragCurrent},onStart:function(a){this.view.on("containerclick",this.cancelClick,this,{single:!0});this.proxy?(this.proxy.dom.parentNode!==this.view.el.dom&&this.view.el.dom.appendChild(this.proxy.dom),this.proxy.setDisplayed("block")):this.proxy=this.view.el.createChild({cls:"x-view-selector"});this.fillRegions();this.view.clearSelections()},onDrag:function(a){var b=this.tracker.startXY,
c=this.tracker.getXY();a=Math.min(b[0],c[0]);var d=Math.min(b[1],c[1]),e=Math.abs(b[0]-c[0]),b=Math.abs(b[1]-c[1]);this.dragRegion.left=a;this.dragRegion.top=d;this.dragRegion.right=a+e;this.dragRegion.bottom=d+b;this.dragRegion.constrainTo(this.bodyRegion);this.proxy.setRegion(this.dragRegion);a=0;for(d=this.itemRegions.length;a<d;a++)e=this.itemRegions[a],(b=this.dragRegion.intersect(e))&&!e.selected?(e.selected=!0,this.view.select(a,!0)):!b&&e.selected&&(e.selected=!1,this.view.deselect(a))},onEnd:function(a){Ext.isIE||
this.view.un("containerclick",this.cancelClick,this,{single:!0});this.proxy&&this.proxy.setDisplayed(!1)},onRender:function(a){this.dragRegion=new Ext.lib.Region(0,0,0,0);this.tracker=new Ext.dd.DragTracker({onBeforeStart:this.onBeforeStart.createDelegate(this),onStart:this.onStart.createDelegate(this),onDrag:this.onDrag.createDelegate(this),onEnd:this.onEnd.createDelegate(this)});this.tracker.initEl(this.view.getEl())}});Ext.preg("zarafa.icondragselectorplugin",Zarafa.common.plugins.IconDragSelectorPlugin);
Ext.ns("Zarafa.common.plugins");
Zarafa.common.plugins.SpinnerPlugin=Ext.extend(Ext.ux.Spinner,{doRender:function(a,b){Zarafa.common.plugins.SpinnerPlugin.superclass.doRender.call(this,a,b);this.field.trigger=this.trigger;Ext.isDefined(this.field.getTriggerWidth)||(this.field.getTriggerWidth=Ext.form.TriggerField.prototype.getTriggerWidth)},onTriggerClick:function(a){if(!this.disabled&&!this.el.dom.readOnly){var b=this.getMiddle();a=a.getPageY()<b?"Up":"Down";this.el.focus();this["onSpin"+a]()}},isSpinnable:function(){return this.disabled||this.rendered&&
this.el.dom.readOnly||!Ext.isDefined(this.field.getValue())?(Ext.EventObject.preventDefault(),!1):!0}});Ext.ns("Zarafa.common.plugins");
Zarafa.common.plugins.SplitFieldLabeler=Ext.extend(Ext.util.Observable,{labelCfg:{style:"text-align: left; padding: 3px 3px 3px 3px"},firstLabelCfg:{style:"text-align: left; padding: 3px 3px 3px 0px"},lastLabelCfg:{style:"text-align: left; padding: 3px 3px 3px 3px"},constructor:function(a){Ext.apply(this,a)},init:function(a){if(Ext.isDefined(a.items)&&Ext.isDefined(a.fieldLabel)&&!0!==a.hideLabel){var b=this.createLabelDistribution(a.items,a.fieldLabel),b=this.applyLabelDistribution(a.items,b);this.applyLabelWidths(a.labelWidth,
b);Array.isArray(a.items)?a.items=b:(a.items.clear(),a.items.addAll(b),a.innerCt.items.clear(),a.innerCt.items.addAll(b));a.hideLabel=!0;delete a.fieldLabel}},createLabelDistribution:function(a,b){var c=[],d=function(a){Ext.isDefined(a.labelSplitter)&&c.push(a.labelSplitter)};Array.isArray(a)?Ext.each(a,d,this):a.each(d,this);return Zarafa.util.Translations.MultiSplitTranslation(b,c)},applyLabelDistribution:function(a,b){for(var c=[],d=0;d<b.length;d++){var e=void 0,f=b[d],g=function(a){if(a.labelSplitter===
b[d])return e=a,!1};Array.isArray(a)?Ext.each(a,g,this):a.each(g,this);Ext.isDefined(e)?c.push(e):c.push(Ext.apply({},this.labelCfg,{xtype:"displayfield",value:f}))}"displayfield"==c[0].xtype&&Ext.apply(c[0],this.firstLabelCfg);"displayfield"==c[c.length-1].xtype&&Ext.apply(c[c.length-1],this.lastLabelCfg);for(d=0;d<c.length;d++)c[d]=Ext.create(c[d]);return c},applyLabelWidths:function(a,b){if(Ext.isNumber(a)){for(var c=0,d=0;d<b.length;d++){var e=b[d];"displayfield"==e.xtype&&(Ext.isDefined(e.width)&&
0!==e.width||Ext.isEmpty(e.text)?a-=e.width:c+=e.text.length)}for(d=0;d<b.length;d++)e=b[d],"displayfield"!=e.xtype||Ext.isDefined(e.width)&&0!==e.width||Ext.isEmpty(e.text)||(e.width=Math.round(e.text.length/c*a))}}});Ext.preg("zarafa.splitfieldlabeler",Zarafa.common.plugins.SplitFieldLabeler);Ext.namespace("Zarafa.common.printer.renderers");
Zarafa.common.printer.renderers.BaseRenderer=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a)},print:function(a){var b=a&&a.getXType?String.format("print_{0}_{1}",a.getXType(),a.id.replace(/-/g,"_")):"print";if(b=window.open("",b))b.document.write(this.generateHTML(a)),b.document.close(),this.postRender(window.document,b.document,a),this.doPrintOnStylesheetLoad.defer(10,this,[b])},doPrintOnStylesheetLoad:function(a){if(a){for(var b=a.document.getElementsByTagName("img"),c=0,d=b.length;c<
d;c++){var e=b[c];if(!0!==e.complete||e.src&&0===e.width+e.height){this.doPrintOnStylesheetLoad.defer(10,this,[a]);return}}b=a.document.getElementById("csscheck");"none"!==(b.currentStyle||a.getComputedStyle(b,null)).display?this.doPrintOnStylesheetLoad.defer(10,this,[a]):(a.print(),a.close())}},generateHTML:function(a){return(new Ext.XTemplate(this.cleanTemplate('<html>\n<head>\n<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />\n'+this.generateHeadTemplate(a)+"<title>"+this.getTitle(a)+
'</title>\n</head>\n<body>\n<div id="csscheck"></div>\n<div id="pagemargin">\n'+this.generateBodyTemplate(a)+"</div>\n</body>\n</html>"),{disableFormats:!0})).apply(this.prepareData(a))},cleanTemplate:function(a){return a.replace(/\r/g,"").replace(/\\/g,"\\\\")},generateHeadTemplate:function(a){if(!Ext.isEmpty(this.customStylesheetPath)){if(Array.isArray(this.customStylesheetPath)){a="";for(var b=0,c=this.customStylesheetPath.length;b<c;b++)a+='<link href="'+this.customStylesheetPath[b]+"?"+(new Date).getTime()+
'" rel="stylesheet" type="text/css" media="screen,print" />\n';return a}return'<link href="'+this.customStylesheetPath+"?"+(new Date).getTime()+'" rel="stylesheet" type="text/css" media="screen,print" />'}return""},generateBodyTemplate:Ext.emptyFn,prepareData:function(a){a=Ext.apply({},a.data);a.fullname=container.getUser().getDisplayName();for(var b in a)Ext.isString(a[b])&&(a[b]=Ext.util.Format.htmlEncode(a[b]));return a},postRender:Ext.emptyFn,getTitle:function(a){return"function"==typeof a.getTitle?
a.getTitle():a.title||"Printing"}});Ext.namespace("Zarafa.common.recipientfield.data");Zarafa.common.recipientfield.data.SuggestionListJsonWriter=Ext.extend(Ext.data.JsonWriter,{constructor:function(a){a=a||{};Ext.applyIf(a,{writeAllFields:!0,encode:!1});Zarafa.core.data.JsonWriter.superclass.constructor.call(this,a)},destroyRecord:function(a){return this.toHash(a)}});Ext.namespace("Zarafa.common.recipientfield.data");
Zarafa.common.recipientfield.data.SuggestionListStore=Ext.extend(Ext.data.Store,{actionType:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{batch:!0,autoSave:!0,remoteSort:!1,actionType:Zarafa.core.Actions.list,proxy:new Zarafa.common.recipientfield.data.SuggestionListProxy,writer:new Zarafa.common.recipientfield.data.SuggestionListJsonWriter,reader:new Ext.data.JsonReader({root:"result",id:"id"},Zarafa.common.recipientfield.data.SuggestionListRecord)});Zarafa.common.recipientfield.data.SuggestionListStore.superclass.constructor.call(this,
a);this.sort([{field:"display_name",direction:"ASC"},{field:"smtp_address",direction:"ASC"},{field:"email_address",direction:"ASC"}])},load:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isDefined(a.cancelPreviousRequest)||(a.cancelPreviousRequest=!0);Ext.isDefined(a.actionType)||(a.actionType=this.actionType);Zarafa.common.recipientfield.data.SuggestionListStore.superclass.load.call(this,a)}});Ext.reg("zarafa.suggestionliststore",Zarafa.common.recipientfield.data.SuggestionListStore);
Ext.namespace("Zarafa.common.recurrence.data");Zarafa.common.recurrence.data.DayData=[{name:_("Day"),value:127},{name:_("Weekday"),value:62},{name:_("Weekend Day"),value:65},{name:null,value:0},{name:null,value:0},{name:null,value:0},{name:null,value:0},{name:null,value:0},{name:null,value:0},{name:null,value:0}];
Zarafa.onReady(function(){for(var a=container.getSettingsModel().get("zarafa/v1/main/week_start"),b=3;b<Zarafa.common.recurrence.data.DayData.length;b++){var c=(a+(b-3))%7;Zarafa.common.recurrence.data.DayData[b].name=Date.dayNames[c];Zarafa.common.recurrence.data.DayData[b].value=Math.pow(2,c)}},void 0,{single:!0});Ext.namespace("Zarafa.common.recurrence.data");
Zarafa.common.recurrence.data.DayRankData=[{name:_("1st"),value:1},{name:_("2nd"),value:2},{name:_("3rd"),value:3},{name:_("4th"),value:4},{name:_("last"),value:5}];Ext.namespace("Zarafa.common.recurrence.data");
Zarafa.common.recurrence.data.MonthData=[{name:Date.monthNames[0],value:0},{name:Date.monthNames[1],value:44640},{name:Date.monthNames[2],value:84960},{name:Date.monthNames[3],value:129600},{name:Date.monthNames[4],value:172800},{name:Date.monthNames[5],value:217440},{name:Date.monthNames[6],value:260640},{name:Date.monthNames[7],value:305280},{name:Date.monthNames[8],value:349920},{name:Date.monthNames[9],value:393120},{name:Date.monthNames[10],value:437760},{name:Date.monthNames[11],value:480960}];
Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.RecurrencePanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.recurrencepanel",layout:"form",border:!1,defaults:{border:!1,bodyStyle:"padding: 10px;"},items:[this.createTimePanel(),this.createRecurrencePanel(),this.createRangePanel()]});Zarafa.common.recurrence.dialogs.RecurrencePanel.superclass.constructor.call(this,a)},createTimePanel:function(){return{xtype:"panel",
title:_("Time"),layout:{type:"vbox",align:"stretch"},anchor:"100%",height:100,items:[{xtype:"displayfield",ref:"../timeperiodLabel",htmlEncode:!0,hideLabel:!0,height:20},{xtype:"panel",layout:"hbox",anchor:"100% 100%",border:!1,bodyStyle:"background-color: inherit;",items:[{xtype:"zarafa.timeperiodfield",ref:"../../timeperiodField",layout:"hbox",defaultPeriod:30,defaultPeriodType:Date.MINUTE,flex:.7,spacerConfig:{width:5},listeners:{change:this.onDurationChange,scope:this}},{xtype:"spacer",width:5},
{xtype:"container",flex:.3,border:!1,style:"background-color: inherit;",items:[{xtype:"checkbox",ref:"../../../alldayCheckbox",name:"alldayevent",boxLabel:_("All Day Event"),handler:this.onToggleAllDay,scope:this}]}]}]}},createRecurrencePanel:function(){return{xtype:"panel",layout:{type:"hbox",align:"stretch"},title:_("Recurrence pattern"),anchor:"100%",height:150,items:[{xtype:"radiogroup",ref:"../recurrencePatternSelect",width:100,border:!1,columns:1,items:[{boxLabel:_("Daily"),name:"pattern",targetId:"card-daily",
patternValue:Zarafa.common.recurrence.data.RecurrenceType.DAILY,handler:this.onSwitchRecurrenceView,scope:this},{boxLabel:_("Weekly"),name:"pattern",targetId:"card-weekly",patternValue:Zarafa.common.recurrence.data.RecurrenceType.WEEKLY,handler:this.onSwitchRecurrenceView,scope:this},{boxLabel:_("Monthly"),name:"pattern",targetId:"card-monthly",patternValue:Zarafa.common.recurrence.data.RecurrenceType.MONTHLY,handler:this.onSwitchRecurrenceView,scope:this},{boxLabel:_("Yearly"),name:"pattern",targetId:"card-yearly",
patternValue:Zarafa.common.recurrence.data.RecurrenceType.YEARLY,handler:this.onSwitchRecurrenceView,scope:this}]},{xtype:"panel",ref:"../recurrencePattern",layout:"card",flex:1,border:!0,bodyStyle:"background-color: inherit; border-style: none none none solid; padding: 0px 10px 0px 10px",defaults:{border:!1,bodyStyle:"background-color: inherit;",autoHeight:!0},items:[{xtype:"zarafa.recurrencedailypanel",id:"card-daily"},{xtype:"zarafa.recurrenceweeklypanel",id:"card-weekly"},{xtype:"zarafa.recurrencemonthlypanel",
id:"card-monthly"},{xtype:"zarafa.recurrenceyearlypanel",id:"card-yearly"}]}]}},createRangePanel:function(){return{xtype:"panel",layout:"column",title:_("Range of recurrence"),anchor:"100%",items:[{xtype:"panel",layout:"form",columnWidth:.5,border:!1,items:[{xtype:"datefield",ref:"../../startDateField",name:"recurrence_start",fieldLabel:_("Start"),format:_("d/m/Y"),listeners:{select:this.onUTCFieldChange,change:this.onUTCFieldChange,scope:this}}]},{xtype:"panel",layout:"form",ref:"../endPatternPanel",
columnWidth:.5,border:!1,bodyStyle:"background-color: inherit;",defaults:{anchor:"100%",border:!1,bodyStyle:"background-color: inherit;",defaults:{height:25,labelWidth:75}},items:[{xtype:"panel",layout:"hbox",items:[{xtype:"radio",name:"recurrence_term",endTerm:Zarafa.common.recurrence.data.RecurrenceEnd.NEVER,hideLabel:!0,width:25,listeners:{check:this.onSwitchRecurrenceTerm,scope:this}},{xtype:"displayfield",value:_("No end date"),hideLabel:!0}]},{xtype:"panel",layout:"column",items:[{xtype:"radio",
name:"recurrence_term",endTerm:Zarafa.common.recurrence.data.RecurrenceEnd.N_OCCURENCES,hideLabel:!0,width:25,listeners:{check:this.onSwitchRecurrenceTerm,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("End after {A} occurrences"),labelWidth:160,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../../../endOccurencesSpinner",name:"recurrence_numoccur",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onFieldChange,
scope:this}}]}]},{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"recurrence_term",endTerm:Zarafa.common.recurrence.data.RecurrenceEnd.ON_DATE,hideLabel:!0,width:25,listeners:{check:this.onSwitchRecurrenceTerm,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("End by {A}"),labelWidth:80,combineErrors:!1,items:[{xtype:"datefield",ref:"../../../../endOnDateField",name:"recurrence_end",width:120,labelSplitter:"{A}",format:_("d/m/Y"),listeners:{select:this.onUTCFieldChange,
change:this.onUTCFieldChange,scope:this}}]}]}]}]}},updateDurationLabel:function(){if(this.record){var a=Math.floor(this.timeperiodField.getValue().getDuration(Date.MINUTE)),b=Math.floor(a/1440),a=a%1440,c=Math.floor(a/60),a=Math.floor(a%60),d=_("Occurrence duration: {D} {H} {M}"),d=0<b?d.replace("{D}",String.format(ngettext("{0} day","{0} days",b),b)):d.replace("{D} ",""),d=0<c?d.replace("{H}",String.format(ngettext("{0} hour","{0} hours",c),c)):d.replace("{H} ",""),d=0<a?d.replace("{M}",String.format(ngettext("{0} minute",
"{0} minutes",a),a)):d.replace("{M}","");this.timeperiodLabel.setValue(d)}},onFieldChange:function(a,b,c){this.record.set(a.getName(),b)},onUTCFieldChange:function(a,b,c){this.record.set(a.getName(),b.fromUTC())},onDurationChange:function(a,b,c){a=60*b.getStartDate().getHours()+b.getStartDate().getMinutes();b=a+b.getDuration(Date.MINUTE);this.record.beginEdit();this.record.set("recurrence_startocc",a);this.record.set("recurrence_endocc",b);this.record.endEdit()},onSwitchRecurrenceTerm:function(a,
b){b&&this.record.set("recurrence_term",a.endTerm)},onSwitchRecurrenceView:function(a,b){b&&(this.record.set("recurrence_type",a.patternValue),this.recurrencePattern.getLayout().setActiveItem(a.targetId),this.recurrencePattern.doLayout())},onToggleAllDay:function(a,b){var c=Math.ceil(this.timeperiodField.getValue().getDuration(Date.MINUTE)/1440);this.record.beginEdit();this.record.set("alldayevent",b);this.record.set("recurrence_startocc",0);this.record.set("recurrence_endocc",1440*c);this.record.endEdit()},
updateUI:function(a,b){var c=!1;if(!0===b||a.isModifiedSinceLastUpdate("alldayevent"))a.get("alldayevent")?this.timeperiodField.disable():this.timeperiodField.enable();if(!0===b||a.isModifiedSinceLastUpdate("message_class"))a.isMessageClass("IPM.TaskRequest",!0)?this.alldayCheckbox.hide():this.alldayCheckbox.show(),c=!0;c&&this.doLayout()},update:function(a,b){this.record=a;this.updateUI(a,b);var c=a.get("recurrence_type");this.recurrencePatternSelect.items.each(function(a){a.setValue(a.patternValue==
c)});var d=a.get("recurrence_start"),d=d?d.toUTC():(new Date).clearTime(),e=a.get("recurrence_end"),e=e?e.toUTC():d.clone(),f=a.get("recurrence_startocc"),g=a.get("recurrence_endocc"),h=(new Date).clearTime();h.setDate(1);h.setMonth(0);h.setHours(f/60);h.setMinutes(f%60);f=(new Date).clearTime();f.setDate(1);f.setMonth(0);f.setHours(g/60);f.setMinutes(g%60);this.startDateField.setValue(d);this.timeperiodField.getValue().set(h,f);(!0===b||a.isModifiedSinceLastUpdate("recurrence_startocc")||a.isModifiedSinceLastUpdate("recurrence_endocc"))&&
this.updateDurationLabel();var k=a.get("recurrence_term");Ext.each(this.endPatternPanel.findByType("radio"),function(a){a.setValue(a.endTerm==k)});switch(k){case Zarafa.common.recurrence.data.RecurrenceEnd.NEVER:!0===b&&this.endOccurencesSpinner.setValue(10);(!0===b||a.isModifiedSinceLastUpdate("recurrence_start")&&d>this.endOnDateField.getValue())&&this.endOnDateField.setValue(d.clearTime(!0));break;case Zarafa.common.recurrence.data.RecurrenceEnd.N_OCCURENCES:(!0===b||a.isModifiedSinceLastUpdate("recurrence_numoccur"))&&
this.endOccurencesSpinner.setValue(a.get("recurrence_numoccur"));!0===b&&this.endOnDateField.setValue(d.clearTime(!0));break;case Zarafa.common.recurrence.data.RecurrenceEnd.ON_DATE:!0===b&&this.endOccurencesSpinner.setValue(10),(!0===b||a.isModifiedSinceLastUpdate("recurrence_end"))&&this.endOnDateField.setValue(e.clearTime(!0))}this.alldayCheckbox.setValue(a.get("alldayevent"))},updateRecord:function(a){a.beginEdit();var b=this.recurrencePatternSelect.getValue();b?a.set("recurrence_type",b.patternValue):
a.set("recurrence_type",Zarafa.common.recurrence.data.RecurrenceType.NONE);a.set("recurrence_start",this.startDateField.getValue().fromUTC());Ext.each(this.endPatternPanel.findByType("radio"),function(b){if(b.getValue())return a.set("recurrence_term",b.endTerm),!1});switch(a.get("recurrence_term")){case Zarafa.common.recurrence.data.RecurrenceEnd.NEVER:a.set("recurrence_numoccur",void 0);a.set("recurrence_end",(new Date("Jan 01 4501")).fromUTC());break;case Zarafa.common.recurrence.data.RecurrenceEnd.N_OCCURENCES:a.set("recurrence_numoccur",
this.endOccurencesSpinner.getValue());a.set("recurrence_end",(new Date("Jan 01 4501")).fromUTC());break;case Zarafa.common.recurrence.data.RecurrenceEnd.ON_DATE:a.set("recurrence_numoccur",void 0),a.set("recurrence_end",this.endOnDateField.getValue().fromUTC())}a.set("alldayevent",this.alldayCheckbox.getValue());var c=this.timeperiodField.getValue(),b=60*c.getStartDate().getHours()+c.getStartDate().getMinutes(),c=b+c.getDuration(Date.MINUTE);a.set("recurrence_startocc",b);a.set("recurrence_endocc",
c);var d=this.startDateField.getValue(),e=d.clone();if(a.get("alldayevent")&&d.clearTime(!0).getTime()===d.getTime())var f=60*d.getHours(),b=b-f,c=c-f;d=d.add(Date.MINUTE,b);a.set("startdate",d);a.set("commonstart",d);e=e.add(Date.MINUTE,c);a.set("duedate",e);a.set("commonend",e);a.endEdit()}});Ext.reg("zarafa.recurrencepanel",Zarafa.common.recurrence.dialogs.RecurrencePanel);Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.RecurrenceSubPanel=Ext.extend(Ext.Panel,{record:void 0,recurrenceType:void 0,recurrenceSubtypes:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Zarafa.common.recurrence.dialogs.RecurrenceSubPanel.superclass.constructor.call(this,a)},isSubtype:function(a,b){return a.type===b.type&&a.regen===b.regen},isRecordSubtype:function(a,b){return a.get("recurrence_subtype")===b.type&&a.get("recurrence_regen")===
b.regen},onSubtypeChange:function(a,b){b&&(this.isRecordSubtype(this.record,a.patternValue)||this.updateRecord(this.record))},onSubtypePropertyChange:function(a,b,c){this.isRecordSubtype(this.record,a)&&this.record.set(b.name,c)},updateUI:Ext.emptyFn,updateSubtype:Ext.emptyFn,update:function(a,b){this.record=a;this.updateUI(a,b);if(b){var c=this.findByType("radio");if(a.get("recurrence_type")!==this.recurrenceType){c[0].setValue(!0);for(var d in this.recurrenceSubtypes)c=this.recurrenceSubtypes[d],
this.updateSubtype(a,c,!0)}else for(d in Ext.each(c,function(b){b.setValue(this.isRecordSubtype(a,b.patternValue))},this),this.recurrenceSubtypes)c=this.recurrenceSubtypes[d],this.updateSubtype(a,c,!this.isRecordSubtype(a,c))}},updateRecordSubType:Ext.emptyFn,updateRecord:function(a){a.get("recurrence_type")===this.recurrenceType&&Ext.each(this.findByType("radio"),function(b){if(b.getValue())return b=b.patternValue,a.beginEdit(),a.set("recurrence_subtype",b.type),a.set("recurrence_regen",b.regen),
this.updateRecordSubType(a,b),a.endEdit(),!1},this)}});Ext.reg("zarafa.recurrencesubpanel",Zarafa.common.recurrence.dialogs.RecurrenceSubPanel);Ext.namespace("Zarafa.common.reminder.dialogs");
Zarafa.common.reminder.dialogs.ReminderPanel=Ext.extend(Ext.Panel,{store:void 0,activeReminderTemplate:'<tpl><div><span class="zarafa-reminder-dialog-active-reminder-icon {[Zarafa.common.ui.IconClass.getIconClassFromMessageClass(false, values.message_class, values)]}"></span><span class="zarafa-reminder-dialog-active-reminder-subject"><tpl if="!Ext.isEmpty(values.subject)">{values.subject:htmlEncodeEllipsis(60)}</tpl><tpl if="Ext.isEmpty(values.subject)">&nbsp;</tpl></span></div><div><span><tpl if="Zarafa.core.ContainerClass.isClass(values.message_class, &quot;IPM.Task&quot;, true)"><tpl if="Ext.isDefined(values.task_duedate)">'+_("Due")+
': {values.task_duedate:date("'+_("l jS F Y")+'")}</tpl><tpl if="Ext.isDefined(values.reminder_time) && !Ext.isDefined(values.task_duedate)">'+_("Reminder time")+': {values.reminder_time:date("'+_("l jS F Y G:i")+'")}</tpl></tpl><tpl if="!Zarafa.core.ContainerClass.isClass(values.message_class, &quot;IPM.Task&quot;, true)"><tpl if="Ext.isDefined(values.reminder_time)">'+_("Start time")+': {values.reminder_time:date("'+_("l jS F Y G:i")+'")}</tpl></tpl></span></div></tpl>',constructor:function(a){a=
a||{};Ext.applyIf(a,{xtype:"zarafa.reminderpanel",layout:{type:"vbox",align:"stretch",pack:"start"},header:!1,border:!1,defaults:{border:!1},items:[this.activeReminderPanel(),this.reminderGrid(a.store),this.reminderAction(),this.reminderSnooze()]});Zarafa.common.reminder.dialogs.ReminderPanel.superclass.constructor.call(this,a);Ext.isString(this.activeReminderTemplate)&&(this.activeReminderTemplate=new Ext.XTemplate(this.activeReminderTemplate,{compiled:!0}))},activeReminderPanel:function(){return{xtype:"panel",
cls:"zarafa-reminder-dialog-active-reminder",layout:"fit",ref:"activeReminder",height:40}},reminderGrid:function(a){return{xtype:"zarafa.remindergrid",ref:"reminderGridView",store:a,border:!0,flex:2}},reminderAction:function(){return{xtype:"panel",layout:"fit",height:40,ref:"reminderAction",minButtonWidth:90,buttons:[{text:_("Dismiss All"),handler:this.onDismissAll,ref:"../../dismissAllButton",scope:this},{text:_("Open Item"),handler:this.onOpenItem,ref:"../../openButton",scope:this},{text:_("Dismiss"),
handler:this.onDismiss,ref:"../../dismissButton",scope:this}]}},reminderSnooze:function(){var a={xtype:"jsonstore",fields:["name","value"],data:Zarafa.calendar.data.ReminderPeriods.slice(1)};return{xtype:"panel",cls:"zarafa-reminder-dialog-snooze",layout:{type:"vbox",align:"stretch",pack:"start"},height:80,ref:"reminderAction",items:[{xtype:"displayfield",value:_("Click Snooze to be reminded again in")+": ",hideLabel:!0,height:25,ref:"../snoozeInfoText"},{xtype:"panel",layout:"hbox",border:!1,flex:1,
items:[{xtype:"combo",ref:"../../snoozeTimeCombo",name:"snooze",flex:1,store:a,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",value:container.getSettingsModel().get("zarafa/v1/main/reminder/default_snooze_time"),lazyInit:!1,forceSelection:!0,editable:!1},{xtype:"spacer",width:10},{xtype:"button",width:90,text:_("Snooze"),handler:this.onSnooze,ref:"../../snoozeButton",scope:this}]}]}},initEvents:function(){Zarafa.common.reminder.dialogs.ReminderPanel.superclass.initEvents.call(this);
this.mon(this.reminderGridView,"viewready",this.onViewReady,this);this.mon(this.reminderGridView.getSelectionModel(),"selectionchange",this.onSelectionChange,this);this.mon(this.reminderGridView.getSelectionModel(),"selectionchange",this.toggleFields,this)},onViewReady:function(){this.reminderGridView.getSelectionModel().selectFirstRow()},onSelectionChange:function(){var a=this.reminderGridView.getSelectionModel().getSelections(),b=this.activeReminder.getEl();Ext.isDefined(b.dom)&&(b.dom.innerHTML=
"");1==a.length?(a=a[0].data,a.reminderRecord=!0,this.activeReminderTemplate.overwrite(b.dom,a)):b.createChild({tag:"div",html:String.format(npgettext("reminder.dialog","{0} reminder is selected.","{0} reminders are selected.",a.length),a.length)});this.doLayout()},toggleFields:function(){var a=this.reminderGridView.getStore().getCount(),b=!1;0<a&&(b=this.reminderGridView.getSelectionModel().hasSelection());this.dismissButton.setDisabled(!b);this.openButton.setDisabled(!b);this.snoozeTimeCombo.setDisabled(!b);
this.snoozeButton.setDisabled(!b);this.snoozeInfoText.setDisabled(!b);this.dismissAllButton.setDisabled(0>=a)},onDismissAll:function(){this.store.dismissReminders(this.store.getRange());this.dialog.close()},onOpenItem:function(){var a=this.reminderGridView.getSelectionModel().getSelected();a&&Zarafa.common.Actions.openReminderRecord(a)},onDismiss:function(){var a=this.reminderGridView.getSelectionModel().getSelections();this.store.dismissReminders(a);0===this.store.getCount()&&this.dialog.close()},
onSnooze:function(){var a=this.reminderGridView.getSelectionModel().getSelections();this.store.snoozeReminders(a,this.snoozeTimeCombo.getValue())}});Ext.reg("zarafa.reminderpanel",Zarafa.common.reminder.dialogs.ReminderPanel);Ext.namespace("Zarafa.common.restoreitem.dialogs");
Zarafa.common.restoreitem.dialogs.RestoreItemPanel=Ext.extend(Ext.grid.GridPanel,{folder:void 0,itemType:"message",constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.restoreitempanel",border:!1,store:new Zarafa.common.restoreitem.data.RestoreItemStore({autoLoad:{folder:a.folder}}),loadMask:!0,viewConfig:{forceFit:!0,emptyText:'<div class="emptytext">'+_("There are no items to show in this list")+"</div>",getRowClass:this.viewConfigGetRowClass},tbar:{xtype:"zarafa.contentpaneltoolbar",insertionPointBase:"common.restoreitemcontentpanel",
actionItems:this.createActionButtons()},bbar:[{xtype:"tbfill"},{xtype:"displayfield",height:15,ref:"../statusMessage"}],colModel:this.initMessageColumnModel(),sm:new Ext.grid.RowSelectionModel});Zarafa.common.restoreitem.dialogs.RestoreItemPanel.superclass.constructor.call(this,a);this.mon(this.store,"load",this.onStoreLoad,this);this.mon(this.store,"load",this.disableToolbarButton,this);this.mon(this.store,"load",this.setStatusMessage,this);this.mon(this.store,"remove",this.setStatusMessage,this);
this.mon(this.store,"remove",this.disableToolbarButton,this);this.mon(this.getSelectionModel(),"selectionchange",this.onSelectionChange,this)},viewConfigGetRowClass:function(a,b,c,d){return a.isRead()?"mail_read":"mail_unread"},createActionButtons:function(){var a=Ext.id(null,"restoreitem-");return[{xtype:"button",overflowText:_("Restore"),text:_("Restore"),iconCls:"icon_restore",handler:this.onRestore,disabled:!0,ref:"../restoreButton",scope:this},{xtype:"button",overflowText:_("Restore All"),text:_("Restore All"),
iconCls:"icon_restore",handler:this.onRestoreAll,disabled:!0,ref:"../restoreAllButton",scope:this},{xtype:"button",overflowText:_("Permanent Delete"),text:_("Permanent Delete"),iconCls:"icon_delete",handler:this.onPermanentDelete,disabled:!0,ref:"../permanentDeleteButton",scope:this},{xtype:"button",overflowText:_("Delete All"),text:_("Delete All"),iconCls:"icon_delete",handler:this.onDeleteAll,disabled:!0,ref:"../deleteAllButton",scope:this},{xtype:"tbfill"},{xtype:"radio",width:90,boxLabel:_("Messages"),
name:a,inputValue:"message",checked:!0,listeners:{check:this.onRadioChecked,scope:this}},{xtype:"radio",width:70,boxLabel:_("Folders"),name:a,inputValue:"folder",listeners:{check:this.onRadioChecked,scope:this}}]},onRadioChecked:function(a,b){!0===b&&(this.itemType=a.inputValue,this.store.load({params:{itemType:this.itemType}}))},onPermanentDelete:function(a,b){var c=this.getSelectionModel().getSelections();this.doPermanentDelete(c)},onDeleteAll:function(a,b){var c=this.store.getRange();Ext.MessageBox.confirm(_("Kopano WebApp"),
_("Are you sure you want to Permanently Delete all items?"),function(a){"yes"==a&&this.doPermanentDelete(c)},this)},doPermanentDelete:function(a){var b=[];if(!Ext.isEmpty(a)){for(var c=0,d=a.length;c<d;c++){var e=a[c];e.addMessageAction("action_type","delete"+this.itemType);this.store.remove(e);b.push(e)}this.store.save(b)}},onRestore:function(a,b){var c=this.getSelectionModel().getSelections();this.doRestore(c)},onRestoreAll:function(a,b){var c=this.store.getRange();Ext.MessageBox.confirm(_("Kopano WebApp"),
_("Are you sure you want to Restore all items?"),function(a){"yes"==a&&this.doRestore(c)},this)},doRestore:function(a){var b=[];if(!Ext.isEmpty(a)){for(var c=0,d=a.length;c<d;c++){var e=a[c];e.addMessageAction("action_type","restore"+this.itemType);this.store.remove(e);b.push(e)}this.store.save(b)}},onStoreLoad:function(a,b,c){Ext.isDefined(c.params.itemType)&&"folder"==c.params.itemType?this.reconfigure(a,this.initFolderColumnModel()):this.reconfigure(a,this.initMessageColumnModel());this.getSelectionModel().selectFirstRow()},
onSelectionChange:function(a){a=!1===a.hasSelection();this.restoreButton.setDisabled(a);this.permanentDeleteButton.setDisabled(a)},setStatusMessage:function(a,b,c){this.statusMessage.setValue(String.format(ngettext("Total {0} recoverable item","Total {0} recoverable items",a.getCount()),a.getCount()))},disableToolbarButton:function(a,b,c){a=0===a.getCount();this.deleteAllButton.setDisabled(a);this.restoreAllButton.setDisabled(a)},initFolderColumnModel:function(){return new Ext.grid.ColumnModel([{dataIndex:"icon_index",
headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',tooltip:_("Sort by: Icon"),width:24,sortable:!0,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"display_name",header:_("Name"),tooltip:_("Sort by: Name"),sortable:!0,renderer:Ext.util.Format.htmlEncode},{dataIndex:"deleted_on",header:_("Deleted On"),tooltip:_("Sort by: Deleted On"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.datetime},{dataIndex:"content_count",header:_("Item Count"),tooltip:_("Sort by: Item Count"),
sortable:!0,renderer:Ext.util.Format.htmlEncode}])},initMessageColumnModel:function(){return new Ext.grid.ColumnModel([{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',tooltip:_("Sort by: Icon"),width:24,sortable:!0,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"hasattach",headerCls:"zarafa-icon-column",header:"<p class='icon_attachment'>&nbsp;</p>",tooltip:_("Sort by: Attachment"),width:24,sortable:!0,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.attachment},
{dataIndex:"sender_name",header:_("From"),tooltip:_("Sort by: From"),sortable:!0,renderer:Ext.util.Format.htmlEncode},{dataIndex:"subject",header:_("Subject"),tooltip:_("Sort by: Subject"),sortable:!0,renderer:Ext.util.Format.htmlEncode},{dataIndex:"deleted_on",header:_("Deleted On"),tooltip:_("Sort by: Deleted On"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.datetime},{dataIndex:"message_delivery_time",header:_("Received"),tooltip:_("Sort by: Received"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.datetime},
{dataIndex:"message_size",header:_("Size"),tooltip:_("Sort by: Size"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.size}])}});Ext.reg("zarafa.restoreitempanel",Zarafa.common.restoreitem.dialogs.RestoreItemPanel);Ext.namespace("Zarafa.common.rules.dialogs");Zarafa.common.rules.dialogs.BaseLink=Ext.extend(Ext.Container,{conditionFlag:void 0,condition:void 0,isModified:!1,setCondition:function(a,b){this.conditionFlag=a;this.condition=b;this.isModified=!Ext.isDefined(b)}});
Ext.reg("zarafa.baselink",Zarafa.common.rules.dialogs.BaseLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.FolderSelectionLink=Ext.extend(Ext.BoxComponent,{emptyText:_("Select one..."),folder:void 0,actionFlag:void 0,action:void 0,isModified:!1,isValid:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.folderselectionlink",border:!1,autoScroll:!0,anchor:"100%",tpl:new Ext.XTemplate('<div class="zarafa-folder-link"><tpl if="!Ext.isEmpty(values.display_name)">&quot;{display_name:htmlEncode}&quot;</tpl><tpl if="Ext.isEmpty(values.display_name)">&quot;'+_("Unnamed folder")+
"&quot;</tpl></div>",{compiled:!0})});Zarafa.common.rules.dialogs.FolderSelectionLink.superclass.constructor.call(this,a)},afterRender:function(){Zarafa.common.rules.dialogs.FolderSelectionLink.superclass.afterRender.apply(this,arguments);this.mon(this.getActionEl(),"click",this.onClick,this)},onClick:function(a,b,c,d){Zarafa.hierarchy.Actions.openFolderSelectionContent({folder:this.folder,hideTodoList:!0,callback:function(a){this.folder=a;this.isModified=!0;this.update(a)},scope:this,modal:!0})},
setAction:function(a,b){this.folder=void 0;this.isValid=!1;if(b){var c=container.getHierarchyStore().getById(b.storeentryid);c&&(this.folder=c.getSubStore("folders").getById(b.folderentryid),Ext.isDefined(this.folder)&&(this.isValid=!0))}this.actionFlag=a;this.action=b;this.isModified=!Ext.isDefined(b);this.update(this.folder)},getAction:function(){if(!0!==this.isModified&&!0===this.isValid)return this.action;var a={};if(!this.folder)return!1;a.folderentryid=this.folder.get("entryid");a.storeentryid=
this.folder.get("store_entryid");switch(this.actionFlag){case Zarafa.common.rules.data.ActionFlags.MOVE:a.action=Zarafa.core.mapi.RuleActions.OP_MOVE;a.flags=0;a.flavor=0;break;case Zarafa.common.rules.data.ActionFlags.COPY:a.action=Zarafa.core.mapi.RuleActions.OP_COPY;a.flags=0;a.flavor=0;break;default:return!1}return a},update:function(a){Zarafa.common.rules.dialogs.FolderSelectionLink.superclass.update.call(this,this.tpl.apply(a?a.data:{display_name:this.emptyText}))}});
Ext.reg("zarafa.folderselectionlink",Zarafa.common.rules.dialogs.FolderSelectionLink);Ext.namespace("Zarafa.common.rules.dialogs");Zarafa.common.rules.dialogs.NoneLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{getCondition:function(){return!0!==this.isModified?this.condition:this.conditionFlag!==Zarafa.common.rules.data.ConditionFlags.NONE?!1:Zarafa.core.data.RestrictionFactory.dataResExist("PR_MESSAGE_CLASS")}});Ext.reg("zarafa.nonelink",Zarafa.common.rules.dialogs.NoneLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.RulesActionsContainer=Ext.extend(Ext.Container,{actionCount:0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{layout:"form",autoHeight:!0,items:[{xtype:"zarafa.compositefield",hideLabel:!0,items:[{xtype:"button",ref:"../addActionBtn",text:_("Add action"),handler:this.addActionBox,scope:this},{xtype:"button",ref:"../removeActionBtn",text:_("Remove action"),handler:this.removeActionBox,
scope:this}]}]});Zarafa.common.rules.dialogs.RulesActionsContainer.superclass.constructor.call(this,a)},createActionBox:function(a){a="rule-action-"+String(a);return{xtype:"container",id:a,flex:1,height:25,layout:{type:"hbox",align:"stretch",defaultMargins:"0 5 0 0"},items:[{xtype:"combo",width:300,store:{xtype:"jsonstore",fields:[{name:"name"},{name:"value",type:"int"}],data:Zarafa.common.rules.data.ActionProfiles},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,
forceSelection:!0,editable:!1,value:_("Select one..."),listeners:{select:this.onActionComboSelect,scope:this}},{xtype:"container",flex:1,layout:"card",activeItem:0,items:this.createActionContentPanels(a)}]}},createActionContentPanels:function(a){return[{xtype:"container",id:a+"-empty"},{xtype:"zarafa.folderselectionlink",id:a+"-folder"},{xtype:"zarafa.deletelink",id:a+"-delete",storeEntryId:this.storeEntryId},{xtype:"zarafa.userselectionlink",id:a+"-to"}]},addActionBox:function(){this.actionCount++;
var a=this.createActionBox(this.actionCount),a=this.insert(this.items.getCount()-1,a);this.removeActionBtn.setDisabled(1>=this.actionCount);this.doLayout();return a},removeActionBox:function(){1<this.actionCount&&(this.remove(this.get(this.items.getCount()-2)),this.actionCount--,this.removeActionBtn.setDisabled(1>=this.actionCount),this.doLayout())},setActionBoxCount:function(a){for(;a<this.actionCount;)this.removeActionBox();for(;a>this.actionCount;)this.addActionBox()},update:function(a,b){this.record=
a;if(b||a.isModifiedSinceLastUpdate("rule_actions")){var c=a.get("rule_actions");if(Ext.isEmpty(c))this.setActionBoxCount(1);else{c=[].concat(c);this.setActionBoxCount(Math.max(1,c.length));for(var d=0,e=c.length;d<e;d++)c[d]&&this.applyAction(this.get(d),c[d])}}},updateRecord:function(a){for(var b=[],c=!0,d=0;d<this.actionCount;d++){var e=this.get(d),f=e.get(1).layout.activeItem,g=null;Ext.isFunction(f.getAction)&&(g=f.getAction());g||(e.get(0).markInvalid(),c=!1);b.push(g)}a.set("rule_actions",
b);a.setActionsValid(c)},applyAction:function(a,b){var c=this.getActionFlagFromAction(b),d=a.get(0),e=a.get(1),f=d.store,g=f.findExact(d.valueField,c);0<=g?(f=f.getAt(g),d.setValue(c),this.onActionComboSelect(d,f,g)):(c=Zarafa.common.rules.data.ActionFlags.UNKNOWN,d.setValue(_("Unknown action")),d.markInvalid(_("This action for the current rule is unknown")));d=e.getLayout();switch(c){case Zarafa.common.rules.data.ActionFlags.MOVE:case Zarafa.common.rules.data.ActionFlags.COPY:case Zarafa.common.rules.data.ActionFlags.DELETE:case Zarafa.common.rules.data.ActionFlags.REDIRECT:case Zarafa.common.rules.data.ActionFlags.FORWARD:case Zarafa.common.rules.data.ActionFlags.FORWARD_ATTACH:d.activeItem.setAction(c,
b)}},getActionFlagFromAction:function(a){switch(a.action){case Zarafa.core.mapi.RuleActions.OP_MOVE:var b=Zarafa.core.mapi.RuleStates;return(this.record.get("rule_state")&b.ST_EXIT_LEVEL)===b.ST_EXIT_LEVEL&&(b=container.getHierarchyStore().getDefaultFolder("wastebasket"))&&Zarafa.core.EntryId.compareEntryIds(b.get("entryid"),a.folderentryid)?Zarafa.common.rules.data.ActionFlags.DELETE:Zarafa.common.rules.data.ActionFlags.MOVE;case Zarafa.core.mapi.RuleActions.OP_COPY:return Zarafa.common.rules.data.ActionFlags.COPY;
case Zarafa.core.mapi.RuleActions.OP_FORWARD:switch(b=Zarafa.core.mapi.FlavorFlags,a.flavor){case 0:return Zarafa.common.rules.data.ActionFlags.FORWARD;case b.FWD_PRESERVE_SENDER|b.FWD_DO_NOT_MUNGE_MSG:return Zarafa.common.rules.data.ActionFlags.REDIRECT;case b.FWD_AS_ATTACHMENT:return Zarafa.common.rules.data.ActionFlags.FORWARD_ATTACH;default:return Zarafa.common.rules.data.ActionFlags.UNKNOWN}default:return Zarafa.common.rules.data.ActionFlags.UNKNOWN}},onActionComboSelect:function(a,b,c){c=a.ownerCt;
var d=c.get(1).getLayout();a=b.get(a.valueField);switch(a){default:d.setActiveItem(c.id+"-empty");break;case Zarafa.common.rules.data.ActionFlags.MOVE:case Zarafa.common.rules.data.ActionFlags.COPY:d.setActiveItem(c.id+"-folder");d.activeItem.setAction(a);break;case Zarafa.common.rules.data.ActionFlags.DELETE:d.setActiveItem(c.id+"-delete");d.activeItem.setAction(a);this.record.set("rule_state",this.record.get("rule_state")|Zarafa.core.mapi.RuleStates.ST_EXIT_LEVEL);break;case Zarafa.common.rules.data.ActionFlags.REDIRECT:case Zarafa.common.rules.data.ActionFlags.FORWARD:case Zarafa.common.rules.data.ActionFlags.FORWARD_ATTACH:d.setActiveItem(c.id+
"-to"),d.activeItem.setAction(a)}}});Ext.reg("zarafa.rulesactionscontainer",Zarafa.common.rules.dialogs.RulesActionsContainer);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.RulesConditionContainer=Ext.extend(Ext.Container,{conditionCount:0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{layout:"form",autoHeight:!0,items:[{xtype:"zarafa.compositefield",hideLabel:!0,items:[{xtype:"button",ref:"../addConditionBtn",text:_("Add condition"),handler:this.addConditionBox,scope:this},{xtype:"button",ref:"../removeConditionBtn",text:_("Remove condition"),handler:this.removeConditionBox,
scope:this}]}]});Zarafa.common.rules.dialogs.RulesConditionContainer.superclass.constructor.call(this,a)},createConditionBox:function(a){a="rule-condition-"+String(a);return{xtype:"container",id:a,flex:1,height:25,layout:{type:"hbox",align:"stretch",defaultMargins:"0 5 0 0"},items:[{xtype:"combo",width:300,store:{xtype:"jsonstore",fields:[{name:"name"},{name:"value",type:"int"}],data:Zarafa.common.rules.data.ConditionProfiles},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",
lazyInit:!1,forceSelection:!0,editable:!1,value:_("Select one..."),listeners:{select:this.onConditionComboSelect,scope:this}},{xtype:"container",flex:1,layout:"card",activeItem:0,items:this.createConditionContentPanels(a)}]}},createConditionContentPanels:function(a){return[{xtype:"container",id:a+"-empty"},{xtype:"zarafa.userselectionlink",id:a+"-from"},{xtype:"zarafa.wordselectionlink",id:a+"-senderwords"},{xtype:"zarafa.wordselectionlink",id:a+"-words"},{xtype:"zarafa.wordselectionlink",id:a+"-bodywords"},
{xtype:"zarafa.wordselectionlink",id:a+"-headerwords"},{xtype:"zarafa.importancelink",id:a+"-importance"},{xtype:"zarafa.userselectionlink",id:a+"-to"},{xtype:"zarafa.senttomelink",id:a+"-to-me-only"},{xtype:"zarafa.senttolink",id:a+"-to-me"},{xtype:"zarafa.attachmentlink",id:a+"-attachment"},{xtype:"zarafa.sentccmelink",id:a+"-cc-me"},{xtype:"zarafa.nametocclink",id:a+"-name-to-cc"},{xtype:"zarafa.sensitivitylink",id:a+"-sensitivity"},{xtype:"zarafa.receivedafterlink",id:a+"-received-after"},{xtype:"zarafa.receivedbeforelink",
id:a+"-received-before"},{xtype:"zarafa.nonelink",id:a+"-no-condition"}]},addConditionBox:function(){this.conditionCount++;var a=this.createConditionBox(this.conditionCount),a=this.insert(this.items.getCount()-1,a);this.removeConditionBtn.setDisabled(1>=this.conditionCount);this.doLayout();return a},removeConditionBox:function(){1<this.conditionCount&&(this.remove(this.get(this.items.getCount()-2)),this.conditionCount--,this.removeConditionBtn.setDisabled(1>=this.conditionCount),this.doLayout())},
setConditionBoxCount:function(a){for(;a<this.conditionCount;)this.removeConditionBox();for(;a>this.conditionCount;)this.addConditionBox()},update:function(a,b){this.record=a;if(b||a.isModifiedSinceLastUpdate("rule_condition")){var c=a.get("rule_condition");if(Ext.isEmpty(c))this.setConditionBoxCount(1);else{c=this.getConditionsArray(c);this.setConditionBoxCount(Math.max(1,c.length));for(var d=0,e=c.length;d<e;d++)c[d]&&this.applyCondition(this.get(d),c[d])}}},updateRecord:function(a){for(var b=[],
c=!0,d=0;d<this.conditionCount;d++){var e=this.get(d),f=e.get(0),e=e.get(1).layout.activeItem,g=null;Ext.isFunction(e.getCondition)&&(g=e.getCondition());g||(f.markInvalid(),c=!1);b.push(g)}b&&(b=1<b.length?Zarafa.core.data.RestrictionFactory.createResAnd(b):b[0]);a.set("rule_condition",b);a.setConditionsValid(c)},getConditionsArray:function(a){if(a[0]===Zarafa.core.mapi.Restrictions.RES_AND){var b=!1,c=a[1].length;if(3<=c)for(var d=0,e=0;e<c;e++){var f=a[1][e];if(f){if(f[0]===Zarafa.core.mapi.Restrictions.RES_PROPERTY){var f=
f[1][Zarafa.core.mapi.Restrictions.ULPROPTAG],g="PR_MESSAGE_CC_ME"===f,h="PR_MESSAGE_RECIP_ME"===f,k="PR_DISPLAY_CC"===f;("PR_MESSAGE_TO_ME"===f||g||h||k)&&d++}else f[0]===Zarafa.core.mapi.Restrictions.RES_NOT&&(f=f[1],"PR_DISPLAY_TO"===f[1][Zarafa.core.mapi.Restrictions.ULPROPTAG]&&d++);if(3===d){b=!0;break}}}a=b?[a]:a[1]}else a=[a];return a},applyCondition:function(a,b){var c=this.getConditionFlagFromCondition(b),d=a.get(0),e=a.get(1),f=d.store,g=f.findExact(d.valueField,c);0<=g?(f=f.getAt(g),d.setValue(c),
this.onConditionComboSelect(d,f,g)):(c=Zarafa.common.rules.data.ConditionFlags.UNKNOWN,d.setValue(_("Unknown condition")),d.markInvalid(_("This condition for the current rule is unknown")));d=e.getLayout();switch(c){case Zarafa.common.rules.data.ConditionFlags.SUBJECT_WORDS:case Zarafa.common.rules.data.ConditionFlags.BODY_WORDS:case Zarafa.common.rules.data.ConditionFlags.TRANSPORTHEADER_WORDS:case Zarafa.common.rules.data.ConditionFlags.IMPORTANCE:case Zarafa.common.rules.data.ConditionFlags.RECEIVED_AFTER:case Zarafa.common.rules.data.ConditionFlags.RECEIVED_BEFORE:case Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM:case Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS:case Zarafa.common.rules.data.ConditionFlags.SENSITIVITY:case Zarafa.common.rules.data.ConditionFlags.SENT_TO:case Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME:case Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME_ONLY:case Zarafa.common.rules.data.ConditionFlags.SENT_CC_ME:case Zarafa.common.rules.data.ConditionFlags.NONE:d.activeItem.setCondition(c,
b)}},getConditionFlagFromCondition:function(a){var b=Zarafa.core.mapi.Restrictions;switch(a[0]){case b.RES_COMMENT:switch(a[1][b.RESTRICTION][1][b.ULPROPTAG]){case "PR_SENDER_SEARCH_KEY":return Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM;default:return Zarafa.common.rules.data.ConditionFlags.UNKNOWN}case b.RES_CONTENT:case b.RES_PROPERTY:case b.RES_SUBRESTRICTION:case b.RES_BITMASK:switch(a[1][b.ULPROPTAG]){case "PR_BODY":return Zarafa.common.rules.data.ConditionFlags.BODY_WORDS;case "PR_TRANSPORT_MESSAGE_HEADERS":return Zarafa.common.rules.data.ConditionFlags.TRANSPORTHEADER_WORDS;
case "PR_SUBJECT":return Zarafa.common.rules.data.ConditionFlags.SUBJECT_WORDS;case "PR_IMPORTANCE":return Zarafa.common.rules.data.ConditionFlags.IMPORTANCE;case "PR_MESSAGE_RECIPIENTS":return Zarafa.common.rules.data.ConditionFlags.SENT_TO;case "PR_MESSAGE_TO_ME":return Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME;case "PR_SENDER_SEARCH_KEY":return Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS;case "PR_MESSAGE_FLAGS":return Zarafa.common.rules.data.ConditionFlags.ATTACHMENT;case "PR_MESSAGE_RECIP_ME":return Zarafa.common.rules.data.ConditionFlags.NAME_TO_CC;
case "PR_SENSITIVITY":return Zarafa.common.rules.data.ConditionFlags.SENSITIVITY;case "PR_MESSAGE_DELIVERY_TIME":if(a[1][1]===b.RELOP_LT)return Zarafa.common.rules.data.ConditionFlags.RECEIVED_BEFORE;if(a[1][1]===b.RELOP_GT)return Zarafa.common.rules.data.ConditionFlags.RECEIVED_AFTER;default:return Zarafa.common.rules.data.ConditionFlags.UNKNOWN}case b.RES_AND:for(var c=0,d=a[1].length;c<d;c++){var e=a[1][c];if(e[0]===b.RES_PROPERTY&&"PR_MESSAGE_CC_ME"===e[1][b.ULPROPTAG])return Zarafa.common.rules.data.ConditionFlags.SENT_CC_ME;
if(e[0]===b.RES_PROPERTY&&"PR_MESSAGE_TO_ME"===e[1][b.ULPROPTAG])return Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME_ONLY}return Zarafa.common.rules.data.ConditionFlags.UNKNOWN;case b.RES_OR:c=0;for(d=a[1].length;c<d;c++)if(e=a[1][c],b=this.getConditionFlagFromCondition(e),b!==Zarafa.common.rules.data.ConditionFlags.UNKNOWN)return b;return Zarafa.common.rules.data.ConditionFlags.UNKNOWN;case b.RES_EXIST:return Zarafa.common.rules.data.ConditionFlags.NONE;default:return Zarafa.common.rules.data.ConditionFlags.UNKNOWN}},
onConditionComboSelect:function(a,b,c){c=a.ownerCt;var d=c.get(1).getLayout();a=b.get(a.valueField);switch(a){default:d.setActiveItem(c.id+"-empty");break;case Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM:d.setActiveItem(c.id+"-from");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS:d.setActiveItem(c.id+"-senderwords");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.SUBJECT_WORDS:d.setActiveItem(c.id+"-words");d.activeItem.setCondition(a);
break;case Zarafa.common.rules.data.ConditionFlags.BODY_WORDS:d.setActiveItem(c.id+"-bodywords");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.TRANSPORTHEADER_WORDS:d.setActiveItem(c.id+"-headerwords");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.IMPORTANCE:d.setActiveItem(c.id+"-importance");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.SENT_TO:d.setActiveItem(c.id+"-to");d.activeItem.setCondition(a);
break;case Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME_ONLY:d.setActiveItem(c.id+"-to-me-only");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME:d.setActiveItem(c.id+"-to-me");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.ATTACHMENT:d.setActiveItem(c.id+"-attachment");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.SENSITIVITY:d.setActiveItem(c.id+"-sensitivity");d.activeItem.setCondition(a);
break;case Zarafa.common.rules.data.ConditionFlags.SENT_CC_ME:d.setActiveItem(c.id+"-cc-me");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.NAME_TO_CC:d.setActiveItem(c.id+"-name-to-cc");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.RECEIVED_AFTER:d.setActiveItem(c.id+"-received-after");d.activeItem.setCondition(a);break;case Zarafa.common.rules.data.ConditionFlags.RECEIVED_BEFORE:d.setActiveItem(c.id+"-received-before");d.activeItem.setCondition(a);
break;case Zarafa.common.rules.data.ConditionFlags.NONE:d.setActiveItem(c.id+"-no-condition"),d.activeItem.setCondition(a)}}});Ext.reg("zarafa.rulesconditioncontainer",Zarafa.common.rules.dialogs.RulesConditionContainer);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.RulesEditPanel=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.ruleseditpanel",layout:"anchor",autoScroll:!0,items:this.createPanelItems(a)});Zarafa.common.rules.dialogs.RulesEditPanel.superclass.constructor.call(this,a)},createPanelItems:function(a){return[{xtype:"displayfield",value:_("Rule name"),height:20},{xtype:"textfield",name:"rule_name",
width:250,listeners:{change:this.onChange,scope:this}},{xtype:"spacer",height:15},{xtype:"displayfield",value:_("When the message")+"...",height:20},{xtype:"zarafa.rulesconditioncontainer",anchor:"100%"},{xtype:"spacer",height:15},{xtype:"displayfield",value:_("Do the following")+"...",height:20},{xtype:"zarafa.rulesactionscontainer",anchor:"100%",storeEntryId:a.storeEntryId},{xtype:"spacer",height:15},{xtype:"checkbox",ref:"stopProcessingCheckbox",boxLabel:_("Stop processing more rules"),handler:this.onToggleStopProcessing,
scope:this}]},onChange:function(a,b){this.record.set(a.name,b)},onToggleStopProcessing:function(a,b){var c=this.record.get("rule_state"),c=b?c|Zarafa.core.mapi.RuleStates.ST_EXIT_LEVEL:c&~Zarafa.core.mapi.RuleStates.ST_EXIT_LEVEL;this.record.set("rule_state",c)},update:function(a,b){this.record=a;this.getForm().loadRecord(a);var c=Zarafa.core.mapi.RuleStates,d=a.get("rule_state");this.stopProcessingCheckbox.setValue((d&c.ST_EXIT_LEVEL)===c.ST_EXIT_LEVEL)},updateRecord:function(a){a.beginEdit();this.getForm().updateRecord(a);
var b=this.record.get("rule_state"),b=this.stopProcessingCheckbox.getValue()?b|Zarafa.core.mapi.RuleStates.ST_EXIT_LEVEL:b&~Zarafa.core.mapi.RuleStates.ST_EXIT_LEVEL;this.record.set("rule_state",b);a.endEdit()}});Ext.reg("zarafa.ruleseditpanel",Zarafa.common.rules.dialogs.RulesEditPanel);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.RulesWordsEditPanel=Ext.extend(Ext.form.FormPanel,{store:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.ruleswordseditpanel",layout:{type:"vbox",align:"stretch"},padding:5,items:[{xtype:"zarafa.compositefield",items:[{xtype:"button",ref:"../editWordBtn",text:_("Edit"),width:70,disabled:!0,handler:this.onWordEdit,scope:this},{xtype:"spacer",width:5},{xtype:"button",ref:"../deleteWordBtn",text:_("Delete"),width:70,disabled:!0,handler:this.onWordDelete,
scope:this}]},{xtype:"spacer",height:5},{xtype:"zarafa.compositefield",items:[{xtype:"textfield",ref:"../wordField",hideLabel:!0,flex:1,listeners:{specialkey:this.onInputSpecialKey,scope:this}},{xtype:"button",autoWidth:!0,iconCls:"zarafa-rules-add",handler:this.onWordAdd,scope:this}]},{xtype:"spacer",height:5},{xtype:"grid",ref:"gridPanel",flex:1,border:!0,enableHdMenu:!1,enableColumnMove:!1,store:a.store,viewConfig:{headersDisabled:!0,forceFit:!0,autoExpandColumn:!0,markDirty:!1,scrollOffset:0},
colModel:new Ext.grid.ColumnModel({columns:[{dataIndex:"words",sortable:!1,renderer:Ext.util.Format.htmlEncode}]}),sm:new Ext.grid.RowSelectionModel({singleSelect:!0,listeners:{selectionchange:this.onSelectionChange,scope:this}})}]});Zarafa.common.rules.dialogs.RulesWordsEditPanel.superclass.constructor.call(this,a)},onInputSpecialKey:function(a,b){if(b.getKey()==b.ENTER)this.onWordAdd()},onWordAdd:function(){var a=this.wordField.getValue().trim();Ext.isEmpty(a)||(this.store.add(new Ext.data.Record({words:a})),
this.wordField.reset());this.wordField.focus()},onWordEdit:function(){var a=this.gridPanel.getSelectionModel().getSelected();a&&(this.store.remove(a),this.wordField.setValue(a.get("words")),this.wordField.focus())},onWordDelete:function(){var a=this.gridPanel.getSelectionModel().getSelected();a&&this.store.remove(a)},onSelectionChange:function(a){a=a.hasSelection();this.editWordBtn.setDisabled(!a);this.deleteWordBtn.setDisabled(!a)}});Ext.reg("zarafa.ruleswordseditpanel",Zarafa.common.rules.dialogs.RulesWordsEditPanel);
Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.UserSelectionLink=Ext.extend(Ext.BoxComponent,{emptyText:_("Select one..."),userStringSeparator:_("and"),store:void 0,actionFlag:void 0,action:void 0,conditionFlag:void 0,condition:void 0,isModified:!1,isValid:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.userselectionlink",border:!1,autoScroll:!0,anchor:"100%",multiSelect:!1,store:new Zarafa.core.data.IPMRecipientStore,tpl:new Ext.XTemplate('<div class="zarafa-user-link"><tpl for="list"><tpl if="!Ext.isEmpty(values.display_name)">&quot;{display_name:htmlEncode}&quot;</tpl><tpl if="Ext.isEmpty(values.display_name) && !Ext.isEmpty(values.smtp_address)">&quot;{smtp_address:htmlEncode}&quot;</tpl><tpl if="xcount &gt; 0 && xindex != xcount"><span>&nbsp;{parent.seperator}&nbsp;</span></tpl></tpl></div>',{compiled:!0})});
Zarafa.common.rules.dialogs.UserSelectionLink.superclass.constructor.call(this,a)},afterRender:function(){Zarafa.common.rules.dialogs.UserSelectionLink.superclass.initComponent.apply(this,arguments);this.mon(this.getActionEl(),"click",this.onClick,this);this.mon(this.store,"update",this.onRecipientUpdate,this);this.mon(this.store,"add",this.onRecipientAdd,this);this.mon(this.store,"resolved",this.onRecipientAdd,this)},onRecipientUpdate:function(a,b,c){c!==Ext.data.Record.COMMIT&&this.update(this.store)},
onRecipientAdd:function(a,b){var c=b[0];c.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&"MAPIPDL"===c.get("address_type")&&Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Distribution lists are not supported in rules, would you like to replace the distribution list with its members?"),buttons:Ext.MessageBox.YESNO,fn:this.onExpandDistList.createDelegate(this,[c],1),scope:this})},onExpandDistList:function(a,b){"yes"===a&&this.store.expand(b,!0);this.store.remove(b)},onClick:function(a,
b,c,d){a=[];this.conditionFlag===Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM&&a.push("distribution_list");b=this.conditionFlag===Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM?_("From"):_("To");Zarafa.common.Actions.openABUserMultiSelectionContent({listRestriction:{hide_groups:a},callback:function(a){this.isModified=!0;this.update(this.store)},convert:function(a){return a.convertToRecipient()},scope:this,store:this.store,modal:!0,selectionCfg:[{xtype:"zarafa.recipientfield",fieldLabel:b+
":",height:50,boxStore:this.store,flex:1}]})},setCondition:function(a,b){this.store.removeAll();this.isValid=!1;if(b){var c=Zarafa.core.mapi.Restrictions,d;switch(a){case Zarafa.common.rules.data.ConditionFlags.SENT_TO:d=b[0]===c.RES_OR?b[1]:[b];for(var e=0,f=d.length;e<f;e++){var g=d[e][1][c.RESTRICTION];if(g[1]&&g[1][c.PROPS]&&g[1][c.PROPS]["0x0001001E"]){var h=this.store.parseRecipient(g[1][c.PROPS]["0x0001001E"]);h.set("display_type",g[1][c.PROPS].PR_DISPLAY_TYPE);h.set("search_key",g[1][c.RESTRICTION][1][c.VALUE]["0x00010102"]);
this.store.add(h);this.isValid=!0}}break;case Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM:for(d=b[0]===c.RES_OR?b[1]:[b],e=0,f=d.length;e<f;e++)g=d[e][1],g[c.PROPS]&&g[c.PROPS]["0x0001001E"]&&(h=this.store.parseRecipient(g[c.PROPS]["0x0001001E"]),h.set("display_type",g[c.PROPS].PR_DISPLAY_TYPE),h.set("search_key",g[c.RESTRICTION][1][c.VALUE]["0x00010102"]),this.store.add(h),this.isValid=!0)}}this.conditionFlag=a;this.condition=b;this.userStringSeparator=_("or");this.isModified=!Ext.isDefined(b);
this.update(this.store)},getCondition:function(){if(!0!==this.isModified&&!0===this.isValid)return this.condition;var a=[];if(0===this.store.getCount())return!1;switch(this.conditionFlag){case Zarafa.common.rules.data.ConditionFlags.SENT_TO:this.store.each(function(b){b.isResolved()&&a.push(this.createToRestriction(b))},this);break;case Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM:this.store.each(function(b){b.isResolved()&&a.push(this.createFromRestriction(b))},this);break;default:return!1}return 1===
a.length?a[0]:1<a.length?Zarafa.core.data.RestrictionFactory.createResOr(a):!1},createToRestriction:function(a){var b=Zarafa.core.data.RestrictionFactory;return b.createResSubRestriction("PR_MESSAGE_RECIPIENTS",b.dataResComment(b.dataResProperty("PR_SEARCH_KEY",Zarafa.core.mapi.Restrictions.RELOP_EQ,a.get("search_key"),"0x00010102"),{"0x60000003":Zarafa.core.mapi.RecipientType.MAPI_TO,"0x00010102":a.get("search_key"),"0x0001001E":a.get("display_name")+" <"+a.get("smtp_address")+">",PR_DISPLAY_TYPE:a.get("display_type")}))},
createFromRestriction:function(a){var b=Zarafa.core.data.RestrictionFactory;return b.dataResComment(b.dataResProperty("PR_SENDER_SEARCH_KEY",Zarafa.core.mapi.Restrictions.RELOP_EQ,a.get("search_key"),"0x00010102"),{"0x60000003":Zarafa.core.mapi.RecipientType.MAPI_TO,"0x00010102":a.get("search_key"),"0x0001001E":a.get("display_name")+" <"+a.get("smtp_address")+">",PR_DISPLAY_TYPE:a.get("display_type")})},setAction:function(a,b){this.store.removeAll();this.isValid=!1;if(b)for(var c=Zarafa.core.data.RecordFactory,
d=Zarafa.core.data.RecordCustomObjectType,e=0,f=b.adrlist.length;e<f;e++){var g=b.adrlist[e];this.isValid=!0;g=c.createRecordObjectByCustomType(d.ZARAFA_RECIPIENT,{entryid:g.PR_ENTRYID,object_type:g.PR_OBJECT_TYPE,display_name:g.PR_DISPLAY_NAME,display_type:g.PR_DISPLAY_TYPE,email_address:g.PR_EMAIL_ADDRESS,smtp_address:g.PR_SMTP_ADDRESS,address_type:g.PR_ADDRTYPE,recipient_type:g.PR_RECIPIENT_TYPE,search_key:g.PR_SEARCH_KEY});this.store.add(g)}this.actionFlag=a;this.action=b;this.userStringSeparator=
_("and");this.isModified=!Ext.isDefined(b);this.update(this.store)},getAction:function(){if(!0!==this.isModified&&!0===this.isValid)return this.action;var a={};if(0===this.store.getCount())return!1;a.adrlist=[];this.store.each(function(b){a.adrlist.push({PR_ENTRYID:b.get("entryid"),PR_OBJECT_TYPE:b.get("object_type"),PR_DISPLAY_NAME:b.get("display_name"),PR_DISPLAY_TYPE:b.get("display_type"),PR_EMAIL_ADDRESS:b.get("email_address")||b.get("smtp_address"),PR_SMTP_ADDRESS:b.get("smtp_address"),PR_ADDRTYPE:b.get("address_type"),
PR_RECIPIENT_TYPE:b.get("recipient_type"),PR_SEARCH_KEY:b.get("search_key")})},this);var b=Zarafa.common.rules.data.ActionFlags,c=Zarafa.core.mapi.RuleActions,d=Zarafa.core.mapi.FlavorFlags;switch(this.actionFlag){case b.REDIRECT:a.action=c.OP_FORWARD;a.flags=0;a.flavor=d.FWD_PRESERVE_SENDER|d.FWD_DO_NOT_MUNGE_MSG;break;case b.FORWARD:a.action=c.OP_FORWARD;a.flags=0;a.flavor=0;break;case b.FORWARD_ATTACH:a.action=c.OP_FORWARD;a.flags=0;a.flavor=d.FWD_AS_ATTACHMENT;break;default:return!1}return a},
update:function(a){a={seperator:this.userStringSeparator,list:Ext.pluck(a.getRange(),"data")};Ext.isEmpty(a.list)&&(a.list=[{display_name:this.emptyText}]);Zarafa.common.rules.dialogs.UserSelectionLink.superclass.update.call(this,this.tpl.apply(a))}});Ext.reg("zarafa.userselectionlink",Zarafa.common.rules.dialogs.UserSelectionLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.WordSelectionLink=Ext.extend(Ext.BoxComponent,{emptyText:_("Select one..."),wordStringSeparator:_("or"),store:void 0,conditionFlag:void 0,condition:void 0,isModified:!1,isValid:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.wordselectionlink",border:!1,autoScroll:!0,anchor:"100%",multiSelect:!1,store:new Ext.data.Store({fields:["words"]}),tpl:new Ext.XTemplate('<div class="zarafa-word-link"><tpl for="."><tpl if="!Ext.isEmpty(values.words)">&quot;{words:htmlEncode}&quot;</tpl><tpl if="xcount &gt; 0 && xindex != xcount"><span>&nbsp;'+
this.wordStringSeparator+"&nbsp;</span></tpl></tpl></div>",{compiled:!0,wordStringSeparator:a.wordStringSeparator||this.wordStringSeparator})});Zarafa.common.rules.dialogs.WordSelectionLink.superclass.constructor.call(this,a)},afterRender:function(){Zarafa.common.rules.dialogs.WordSelectionLink.superclass.initComponent.apply(this,arguments);this.mon(this.getActionEl(),"click",this.onClick,this)},onClick:function(a,b,c,d){a=new Ext.data.Store({fields:["words"]});a.add(this.store.getRange());Zarafa.common.Actions.openRulesWordsEditContent({store:a,
callback:this.rulesWordsEditDialogCallback,scope:this,modal:!0})},rulesWordsEditDialogCallback:function(a){this.store.removeAll();this.store.add(a.getRange());this.isModified=!0;this.update(this.store)},setCondition:function(a,b){this.store.removeAll();this.isValid=!1;if(b){var c=Zarafa.core.mapi.Restrictions;switch(a){case Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS:var d;d=b[0]==c.RES_OR?b[1]:[b];for(var e=0,f=d.length;e<f;e++){var g=d[e][1][c.VALUE];Ext.iterate(g,function(b,c){Ext.isEmpty(c)||
(this.isValid=!0,a===Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS&&(c=Zarafa.core.Util.hexToString(c)),this.store.add(new Ext.data.Record({words:c})))},this)}break;default:for(d=b[0]==c.RES_OR?b[1]:[b],e=0,f=d.length;e<f;e++)g=d[e][1][c.VALUE],Ext.iterate(g,function(a,b){Ext.isEmpty(b)||(this.isValid=!0,this.store.add(new Ext.data.Record({words:b})))},this)}}this.conditionFlag=a;this.condition=b;this.isModified=!Ext.isDefined(b);this.update(this.store)},getCondition:function(){if(!0!==this.isModified&&
!0===this.isValid)return this.condition;if(0===this.store.getCount())return!1;var a=[],b=Zarafa.core.data.RestrictionFactory,c=Zarafa.core.mapi.Restrictions;switch(this.conditionFlag){case Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS:this.store.each(function(d){d=Zarafa.core.Util.stringToHex(d.get("words"));a.push(b.dataResContent("PR_SENDER_SEARCH_KEY",c.FL_SUBSTRING,d))},this);break;case Zarafa.common.rules.data.ConditionFlags.SUBJECT_WORDS:this.store.each(function(d){a.push(b.dataResContent("PR_SUBJECT",
c.FL_SUBSTRING|c.FL_IGNORECASE,d.get("words")))},this);break;case Zarafa.common.rules.data.ConditionFlags.BODY_WORDS:this.store.each(function(d){a.push(b.dataResContent("PR_BODY",c.FL_SUBSTRING|c.FL_IGNORECASE,d.get("words")))},this);break;case Zarafa.common.rules.data.ConditionFlags.TRANSPORTHEADER_WORDS:this.store.each(function(d){a.push(b.dataResContent("PR_TRANSPORT_MESSAGE_HEADERS",c.FL_SUBSTRING|c.FL_IGNORECASE,d.get("words")))},this);break;default:return!1}return 1===a.length?a[0]:Zarafa.core.data.RestrictionFactory.createResOr(a)},
update:function(a){a=Ext.pluck(a.getRange(),"data");Ext.isEmpty(a)&&(a=[{words:this.emptyText}]);Zarafa.common.rules.dialogs.WordSelectionLink.superclass.update.call(this,this.tpl.apply(a))}});Ext.reg("zarafa.wordselectionlink",Zarafa.common.rules.dialogs.WordSelectionLink);Ext.namespace("Zarafa.common.rules.ui");
Zarafa.common.rules.ui.RulesPanel=Ext.extend(Ext.Container,{store:void 0,constructor:function(a){a=a||{};Ext.isEmpty(a.store)&&(a.store=new Zarafa.common.rules.data.RulesStore({storeEntryId:container.getHierarchyStore().getDefaultStore().get("store_entryid")}));Ext.applyIf(a,{xtype:"zarafa.rulespanel",border:!1,layout:"fit",items:this.createPanelItems(a)});Zarafa.common.rules.ui.RulesPanel.superclass.constructor.call(this,a)},createComboboxStore:function(){var a=container.getHierarchyStore(),b=[{name:_("myself"),
value:a.getDefaultStore().get("store_entryid")}],c=container.getSettingsModel().get("zarafa/v1/contexts/hierarchy/shared_stores",!0),d;for(d in c)c[d].hasOwnProperty("all")&&a.getStores().forEach(function(a){if(a.get("user_name")===d){var c=a.getSubtreeFolder(),e=a.getDefaultFolder("inbox");(c.get("rights")&Zarafa.core.mapi.Rights.RIGHTS_OWNER)===Zarafa.core.mapi.Rights.RIGHTS_OWNER&&e&&e.get("rights")&Zarafa.core.mapi.Rights.RIGHTS_FOLDER_ACCESS&&(b=b.concat({name:a.get("mailbox_owner_name"),value:a.get("store_entryid")}))}});
return{xtype:"jsonstore",fields:["name","value"],data:b}},createPanelItems:function(a){var b=this.createComboboxStore(),c=[];container.getServerConfig().isSharedRulesEnabled()&&c.push({xtype:"container",cls:"k-store-picker",border:!1,layout:"form",labelWidth:"-",items:{xtype:"combo",mode:"local",store:b,fieldLabel:_("Update rules for"),triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,value:b.data[0].value,editable:!1,listeners:{beforeselect:this.onBeforeUserSelect,
select:this.onUserSelect,scope:this}}});c.push({xtype:"zarafa.rulesgrid",ref:"../rulesGrid",flex:1,store:a.store});return[{xtype:"container",layout:{type:"vbox",align:"stretch",pack:"start"},items:c}]},onBeforeUserSelect:function(a,b,c){c=container.getContextByName("settings").getModel();if(c.dirty)return Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Do you wish to apply the changes?"),icon:Ext.MessageBox.QUESTION,fn:this.applyChanges.createDelegate(this,[c,a,b],1),buttons:Ext.MessageBox.YESNOCANCEL}),
!1},onUserSelect:function(a){this.loadUserStore(a.getValue())},applyChanges:function(a,b,c,d){"cancel"!==a&&("yes"===a?b.applyChanges():b.discardChanges(),c.setValue(d.get("value")),this.loadUserStore(c.getValue()))},loadUserStore:function(a){this.store.storeEntryId=a;this.store.load()},discardChanges:function(){this.store.load()},saveChanges:function(){this.store.save()}});Ext.reg("zarafa.rulespanel",Zarafa.common.rules.ui.RulesPanel);Ext.ns("Zarafa.common.searchfield.ui");
Zarafa.common.searchfield.ui.SearchFieldContainer=Ext.extend(Ext.Container,{constructor:function(a){Ext.apply(a,{xtype:"zarafa.searchfieldcontainer",cls:"search_container",items:[{xtype:"zarafa.searchtextfield",searchContainer:this},{xtype:"zarafa.searchfoldercombo",model:a.model,searchFieldContainer:this},{xtype:"button",ref:"searchBtn",iconCls:"icon_search",scope:this}]});Zarafa.common.searchfield.ui.SearchFieldContainer.superclass.constructor.call(this,a);this.searchTextField.mon(this.searchBtn,
"click",this.searchTextField.onTriggerClick,this.searchTextField)}});Ext.reg("zarafa.searchfieldcontainer",Zarafa.common.searchfield.ui.SearchFieldContainer);Ext.ns("Zarafa.common.searchfield.ui");
Zarafa.common.searchfield.ui.SearchFolderCombo=Ext.extend(Ext.form.ComboBox,{model:void 0,minListWidth:150,ellipsisStringStartLength:15,constructor:function(a){this.model=a.model;var b=container.getHierarchyStore().getDefaultStore(),c=0,d="",e="",f="";b&&(d=b.getSubtreeFolder().get("entryid"),b=this.model.getDefaultFolder())&&(e=b.getDisplayName(),f=b.get("entryid"),"inbox"!==b.getDefaultFolderKey()||b.getMAPIStore().isSharedStore())&&(c=1);this.tpl||(this.tpl=new Ext.XTemplate('<tpl for="."><tpl if="Ext.isEmpty(values.flag)"><div class="k-search-combobox-menu-sep-parent"><span class="x-menu-sep k-search-combobox-menu-sep"></span></div></tpl><div class="x-combo-list-item" ext:qtip="{[this.getQtip(values)]}" ext:qwidth="100%"><tpl if="this.isOtherStoreFolder(values.value)"><span>{name:htmlEncodeElide('+
this.ellipsisStringStartLength+', 0, true)}</span><span class="k-search-node-owner"> - {this.ownerName:htmlEncodeElide('+this.ellipsisStringStartLength+', 0, true)}</span></tpl><tpl if="!this.isOtherStoreFolder(values.value)"><span>{name:htmlEncodeElide('+this.ellipsisStringStartLength+", 0, true)}</span></tpl></div></tpl>",{ownerName:"",compiled:!0,ellipsisStringLength:this.ellipsisStringStartLength,isOtherStoreFolder:function(a){var b=container.getHierarchyStore();if(a=b.getFolder(a))if(b=b.getById(a.get("store_entryid")),
b.isSharedStore())return this.ownerName=b.get("mailbox_owner_name"),!0;return!1},getQtip:function(a){var b,c;a.name.length>this.ellipsisStringLength&&(b=a.name);this.isOtherStoreFolder(a.value)&&this.ownerName.length>this.ellipsisStringLength&&(c=this.ownerName);return b||c?b&&c?b+" - "+c:b?b:c:""}}));d=new Ext.data.JsonStore({idIndex:0,idProperty:"value",fields:["name","value","flag","include_subfolder"],data:[{name:_("All folders"),value:d,include_subfolder:!0,flag:Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.ALL_FOLDERS},
{name:Ext.util.Format.htmlEncode(e),value:f,include_subfolder:!1,flag:Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.CURRENT_SELECTED_FOLDER},{name:_("Other..."),value:"other"}],autoDestroy:!0});Ext.apply(a,{xtype:"zarafa.searchfoldercombo",mode:"local",ref:"searchFolderCombo",valueField:"value",displayField:"name",store:d,triggerAction:"all",value:d.getAt(c).get("value"),editable:!1,width:100,listWidth:150,listeners:{expand:this.onExpandComboBox,scope:this}});Zarafa.common.searchfield.ui.SearchFolderCombo.superclass.constructor.call(this,
a)},initEvents:function(){Zarafa.common.searchfield.ui.SearchFolderCombo.superclass.initEvents.apply(this,arguments);this.on("beforeselect",this.onBeforeSelectSearchFolder,this);this.on("select",this.onSelectSearchFolder,this);this.mon(this.model,"folderchange",this.onFolderChange,this);this.mon(this.model,"activate",this.onActiveFolder,this);this.mon(container,"aftercontextswitch",this.onAfterContextSwitch,this)},onBeforeSelectSearchFolder:function(a,b,c){if("other"===b.get("value"))return a.collapse(),
Zarafa.advancesearch.Actions.openSelectSearchFolderDialog({searchFolderCombo:a,model:this.model}),!1;container.getHierarchyStore().getFolder(a.getValue())||(a=this.findRecord("value",a.getValue()),this.getStore().remove(a));return!0},onActiveFolder:function(a){this.setFolder(a,!0)},onFolderChange:function(a,b){var c=a.getDefaultFolder();this.setFolder(c,!0)},onAfterContextSwitch:function(a,b,c){a=c.getModel().getDefaultFolder();this.setFolder(a,!1)},setFolder:function(a,b){if(!this.findParentByType("zarafa.searchpaneltoolbar")&&
Ext.isDefined(a)){Ext.isArray(a)&&(a=a[0]);var c=this.getStore();b&&this.doChangeCurrentFolder(c,a);this.getStore().each(function(a){var b=a.get("value");if("other"!==b&&!container.getHierarchyStore().getFolder(b))return this.getStore().remove(a),!1},this);"inbox"!==a.getDefaultFolderKey()||a.getMAPIStore().isSharedStore()?this.setValue(a.get("entryid")):(c=c.getAt(c.find("flag",Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.ALL_FOLDERS)),this.setValue(c.get("value")))}},doChangeCurrentFolder:function(a,
b){var c=a.getAt(a.find("flag",Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.CURRENT_SELECTED_FOLDER));c.beginEdit();c.set("name",b.getDisplayName());c.set("value",b.get("entryid"));c.set("include_subfolder",!1);c.id=b.get("entryid");c.endEdit();c.commit()},onExpandComboBox:function(){var a=this.store,b=0,c=Ext.util.TextMetrics.createInstance(this.view.el);a.each(function(a){var d=Ext.util.Format.htmlEncodeElide(a.get("name"),this.ellipsisStringStartLength,0,!0),f=container.getHierarchyStore();
if(a=f.getFolder(a.get("value")))f=f.getById(a.get("store_entryid")),f.isSharedStore()&&(d+=" - "+Ext.util.Format.htmlEncodeElide(f.get("mailbox_owner_name"),this.ellipsisStringStartLength,0,!0));d=c.getWidth(d);d>b&&(b=d)},this);0<b&&(b=Math.max(this.minListWidth,b+25),this.list.setWidth(b),this.innerList.setWidth(b-this.list.getFrameWidth("lr")))},onSelectSearchFolder:function(){var a=this.searchFieldContainer.searchTextField;if(a.searchPanelRendered)a.onTriggerClick()}});
Ext.reg("zarafa.searchfoldercombo",Zarafa.common.searchfield.ui.SearchFolderCombo);Ext.ns("Zarafa.common.searchfield.ui");
Zarafa.common.searchfield.ui.SearchTextField=Ext.extend(Ext.form.TextField,{searchIndicatorClass:"zarafa-tbar-loading",searchPanelRendered:!1,constructor:function(a){Ext.apply(a,{validationEvent:!1,validateOnBlur:!1,cls:"zarafa-searchfield",boxMaxWidth:450,ref:"searchTextField",listeners:{afterrender:function(a){a.getEl().set({placeholder:_("Search in..")})},scope:this}});this.addEvents("beforestart","start","beforestop","stop");Zarafa.common.searchfield.ui.SearchTextField.superclass.constructor.call(this,
a)},initComponent:function(){Zarafa.common.searchfield.ui.SearchTextField.superclass.initComponent.call(this);this.on("specialkey",this.onTriggerSpecialKey,this)},onTriggerSpecialKey:function(a,b){if(b.getKey()==b.ENTER){var c=this.getValue();if(Ext.isEmpty(c))this.stopSearch();else this.onTriggerClick()}},stopSearch:function(){!1!==this.fireEvent("beforestop",this)&&(this.hideMask(),this.fireEvent("stop",this))},onTriggerClick:function(){if(!1!==this.fireEvent("beforestart",this)){if(Ext.isEmpty(this.getValue()))return this.focus(),
!1;var a=this.searchContainer.searchFolderCombo.getValue();if(!container.getHierarchyStore().getFolder(a))return Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("The folder you are searching through no longer exists. Please select another folder"),icon:Ext.MessageBox.WARNING,buttons:Ext.MessageBox.OK}),!1;this.searchPanelRendered||Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.search"],[],{searchText:this.getValue(),parentSearchField:this,parentSearchFolderCombo:this.searchContainer.searchFolderCombo});
this.el.addClass(this.searchIndicatorClass);this.fireEvent("start",this)}},hideMask:function(){this.el.removeClass([this.searchIndicatorClass])}});Ext.reg("zarafa.searchtextfield",Zarafa.common.searchfield.ui.SearchTextField);Ext.namespace("Zarafa.common.sendas.ui");
Zarafa.common.sendas.ui.SendAsGrid=Ext.extend(Ext.grid.GridPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.sendasgrid",border:!0,viewConfig:{forceFit:!0,deferEmptyText:!1,emptyText:"<div class='emptytext'>"+_("No from addresses configured")+"</div>"},loadMask:{msg:_("Loading from addresses")+"..."},columns:this.initColumnModel(),selModel:new Zarafa.common.ui.grid.RowSelectionModel({singleSelect:!0}),listeners:{viewready:this.onViewReady,rowdblclick:this.onRowDblClick,scope:this}});
Zarafa.common.sendas.ui.SendAsGrid.superclass.constructor.call(this,a)},initColumnModel:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"display_name",header:_("Name"),renderer:Zarafa.common.ui.grid.Renderers.text},{dataIndex:"smtp_address",header:_("Email Address"),renderer:Zarafa.common.ui.grid.Renderers.text}]},onViewReady:function(){this.getSelectionModel().selectFirstRow()},
removeSendAs:function(){var a=this.getSelectionModel(),b=this.getSelectionModel().getSelected();b?(a.hasNext()?a.selectNext():a.hasPrevious()&&a.selectPrevious(),this.store.remove(b)):Ext.Msg.alert(_("Alert"),_("Please select a from address record."))},onRowDblClick:function(a,b){var c=a.getStore().getAt(b);c.isOneOff()?this.editSendAsRecipient(c,!1):this.viewSendAsRecipient(c)},editSendAsRecipient:function(a,b){Zarafa.common.Actions.openSendAsRecipientContent(a,{removeOnCancel:b})},viewSendAsRecipient:function(a){Zarafa.common.Actions.openViewRecipientContent(a)}});
Ext.reg("zarafa.sendasgrid",Zarafa.common.sendas.ui.SendAsGrid);Ext.namespace("Zarafa.common.sendas.ui");
Zarafa.common.sendas.ui.SendAsPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.sendaspanel",border:!1,layout:{type:"vbox",align:"stretch",pack:"start"},items:this.createPanelItems(a.store)});Zarafa.common.sendas.ui.SendAsPanel.superclass.constructor.call(this,a)},createPanelItems:function(a){return[{xtype:"displayfield",value:_("Here you can setup your alias email addresses."),fieldClass:"x-form-display-field zarafa-settings-widget-extrainfo"},{xtype:"container",
flex:1,layout:{type:"hbox",align:"stretch",pack:"start"},items:[{xtype:"zarafa.sendasgrid",ref:"../sendasGrid",store:a,flex:1},{xtype:"container",width:160,layout:{type:"vbox",align:"center",pack:"start"},items:[{xtype:"button",text:_("Address Book")+"...",handler:this.onSendAsAddressBook,scope:this},{xtype:"spacer",height:20},{xtype:"button",text:_("Add")+"...",handler:this.onSendAsAdd,scope:this},{xtype:"spacer",height:20},{xtype:"button",text:_("Edit")+"...",disabled:!0,ref:"../../editButton",
handler:this.onSendAsEdit,scope:this},{xtype:"spacer",height:20},{xtype:"button",text:_("View")+"...",disabled:!0,ref:"../../viewButton",handler:this.onSendAsView,scope:this},{xtype:"spacer",height:20},{xtype:"button",text:_("Remove")+"...",disabled:!0,ref:"../../removeButton",handler:this.onSendAsRemove,scope:this}]}]}]},initEvents:function(){Zarafa.common.sendas.ui.SendAsPanel.superclass.initEvents.call(this);this.mon(this.sendasGrid.getSelectionModel(),"selectionchange",this.onGridSelectionChange,
this)},onSendAsAdd:function(){var a=Ext.pluck(this.store.getRange(),"data"),a=Ext.max(Ext.pluck(a,"rowid"))||0,a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{rowid:a+1,display_type:Zarafa.core.mapi.DisplayType.DT_REMOTE_MAILUSER});this.store.add(a);this.sendasGrid.editSendAsRecipient(a,!0)},onGridSelectionChange:function(a){var b=a.getSelected(),b=b&&b.isOneOff();a=a.hasSelection();this.editButton.setDisabled(!a||!b);this.viewButton.setDisabled(!a||
b);this.removeButton.setDisabled(!a)},onSendAsRemove:function(){this.sendasGrid.removeSendAs()},getSendAsRecord:function(){var a=this.sendasGrid.getSelectionModel().getSelected();if(a)return a;Ext.Msg.alert(_("Alert"),_("Please select a sendas record."))},onSendAsEdit:function(){var a=this.getSendAsRecord();this.sendasGrid.editSendAsRecipient(a,!1)},onSendAsView:function(){var a=this.getSendAsRecord();this.sendasGrid.viewSendAsRecipient(a)},onSendAsAddressBook:function(){Zarafa.common.Actions.openABUserSelectionContent({callback:this.abCallBack,
scope:this,singleSelect:!1,listRestriction:{hide_users:["system","everyone"],hide_companies:!0}})},abCallBack:function(a){for(var b=Ext.pluck(this.store.getRange(),"data"),b=Ext.max(Ext.pluck(b,"rowid"))||0,c=0;c<a.length;c++){var d=a[c],d=d.convertToRecipient();d.set("rowid",++b);this.store.add(d)}}});Ext.reg("zarafa.sendaspanel",Zarafa.common.sendas.ui.SendAsPanel);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.Box=Ext.extend(Ext.BoxComponent,{record:void 0,parent:void 0,iconEl:void 0,textEl:void 0,delBtnEl:void 0,editable:!0,enableButtons:!0,enableIcons:!0,hoverCls:"x-zarafa-boxfield-item-hover",focusCls:"x-zarafa-boxfield-item-focus",textCls:"x-zarafa-boxfield-item-text",iconCls:"x-zarafa-boxfield-item-icon",btnCls:"x-zarafa-boxfield-item-close",btnHoverCls:"x-zarafa-boxfield-item-close-hover",textTpl:void 0,isAnimDestroying:!1,enableTextSelection:!1,ellipsisStringStartLength:30,ellipsisStringEndLength:30,
constructor:function(a){a=a||{};Ext.applyIf(a,{autoEl:{tag:"li",cls:"x-zarafa-boxfield-item"}});Zarafa.common.ui.Box.superclass.constructor.call(this,a);Ext.isString(this.textTpl)&&(this.textTpl=new Ext.XTemplate(this.textTpl,{compiled:!0,ellipsisStringStartLength:this.ellipsisStringStartLength,ellipsisStringEndLength:this.ellipsisStringEndLength}))},onRender:function(a,b){Zarafa.common.ui.Box.superclass.onRender.call(this,a,b);!0!==this.enableTextSelection&&this.el.unselectable();!0===this.enableIcons&&
this.renderIcons();this.renderBox();!0===this.enableButtons&&this.renderButtons();Ext.isDefined(this.record)&&this.update(this.record);this.el.addClassOnOver(this.hoverCls);this.mon(this.el,"click",this.onClick,this);this.mon(this.el,"contextmenu",this.onContextMenu,this);this.mon(this.el,"dblclick",this.onDblClick,this)},afterRender:function(a){Zarafa.common.ui.Box.superclass.afterRender.call(this,a);this.delBtnEl.setVisible(this.editable)},setEditable:function(a){this.editable!==a&&(this.editable=
a,this.delBtnEl.setVisible(this.editable))},renderIcons:function(){this.iconEl=this.el.createChild({tag:"span",cls:this.iconCls})},renderBox:function(){this.textEl=this.el.createChild({tag:"span",cls:this.textCls})},renderButtons:function(){this.renderRemoveButton()},renderRemoveButton:function(){this.delBtnEl=this.el.createChild({tag:"span",cls:this.btnCls});this.delBtnEl.addClassOnOver(this.btnHoverCls);this.mon(this.delBtnEl,"click",this.onClickRemove,this)},focus:function(){Zarafa.common.ui.Box.superclass.focus.call(this);
this.el.addClass(this.focusCls);this.parent.doBoxFocus(this)},blur:function(){Zarafa.common.ui.Box.superclass.blur.call(this);this.el.removeClass(this.focusCls);this.parent.doBoxBlur(this)},hasFocus:function(){return this.el.hasClass(this.focusCls)},onClickRemove:function(){this.isAnimDestroying||this.isDestroying||(this.parent.focus(),this.parent.doBoxRemove(this))},onClick:function(a){a.stopEvent();this.isAnimDestroying||this.isDestroying||this.parent.doBoxClick(this)},onContextMenu:function(a){a.stopEvent();
this.isAnimDestroying||this.isDestroying||this.parent.doBoxContextMenu(this)},onDblClick:function(a){a.stopEvent();this.isAnimDestroying||this.isDestroying||this.parent.doBoxDblClick(this)},prepareData:function(a){return a.data},prepareIcon:function(a){return Zarafa.common.ui.IconClass.getIconClass(a)},update:function(a){this.textTpl.overwrite(this.textEl,this.prepareData(a));!0===this.enableIcons&&(a=this.prepareIcon(a),Ext.isEmpty(a)||this.iconEl.addClass(a));this.parent.sizeContainer()},onResize:function(a,
b,c,d){Ext.isNumber(c)&&(Ext.isNumber(a)||(a=c),a-=this.el.getMargins("lr")+this.iconEl.getWidth()+this.iconEl.getFrameWidth("lr")+this.iconEl.getMargins("lr")+this.delBtnEl.getWidth()+this.delBtnEl.getFrameWidth("lr")+this.delBtnEl.getMargins("lr")+this.getResizeEl().getFrameWidth("lr")+this.getResizeEl().getMargins("lr"),Ext.isDefined(this.expandBtnEl)&&(a-=this.expandBtnEl.getWidth()+this.expandBtnEl.getFrameWidth("lr")+this.expandBtnEl.getMargins("lr")),this.textEl.setWidth(a))},doDestroy:function(a){!0===
a?(this.isAnimDestroying=!0,this.getEl().hide({duration:.2,callback:function(){this.destroy();this.parent.sizeContainer()},scope:this})):(this.destroy(),this.parent.sizeContainer())}});Ext.reg("zarafa.box",Zarafa.common.ui.Box);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.BoxField=Ext.extend(Ext.form.ComboBox,{boxType:"zarafa.box",boxStore:void 0,boxConfig:void 0,items:void 0,handleInputKey:";",enableComboBox:!0,currentFocus:!1,boxFocusEl:void 0,wrapBoxesEl:void 0,inputEl:void 0,boxKeyMap:void 0,inputKeyMap:void 0,specialInputKeyMap:void 0,listKeyMap:void 0,minInputFieldWidth:25,inputFieldHeight:20,enableAnim:!0,wrapCls:"x-form-text x-zarafa-boxfield",listTextMetric:void 0,inputTextMetric:void 0,listMode:!1,boxLimit:void 0,extraItemSelector:void 0,
constructor:function(a){a=a||{};!0===a.readOnly&&(a.editable=!1);Ext.applyIf(a,{xtype:"zarafa.boxfield",cls:"x-zarafa-boxfield-input",hideTrigger:!0,autoHeight:!0,autoScroll:!0,monitorTab:!1});a.wrapCls=a.wrapCls?a.wrapCls+" "+this.wrapCls:this.wrapCls;this.addEvents("boxfocus","boxblur","boxclick","boxdblclick","boxcontextmenu","boxadd","boxremove");Zarafa.common.ui.BoxField.superclass.constructor.call(this,a);this.on("boxremove",this.onBoxRemove,this);this.on("boxadd",this.onBoxAdd,this)},initComponent:function(){Zarafa.common.ui.BoxField.superclass.initComponent.call(this);
this.items=new Ext.util.MixedCollection;Ext.isString(this.handleInputKey)&&(this.handleInputKey=this.handleInputKey.charCodeAt(0));this.previousHeight=this.height},initEvents:function(){this.mon(this.el,{keydown:this.onKeyDownHandler,scope:this});this.mon(this.getContentTarget(),"click",this.onContainerClick,this);!1!==this.editable&&(this.boxKeyMap=this.createBoxKeyMap(this.boxFocusEl),this.specialInputKeyMap=this.createSpecialInputKeyMap(this.el),this.inputKeyMap=this.createInputKeyMap(this.el),
!0===this.enableComboBox&&(this.listKeyMap=this.createListKeyMap(this.el)),Zarafa.core.Events.addPasteEventHandler(this,this.el,this.onPaste,this));!0===this.listMode&&this.mon(this.ownerCt,"afterlayout",this.onParentLayout,this);this.on("select",this.onSelect,this);Zarafa.common.ui.BoxField.superclass.initEvents.call(this)},initList:function(){Zarafa.common.ui.BoxField.superclass.initList.call(this);Ext.isDefined(this.extraItemSelector)&&(this.view.extraItemSelector=this.extraItemSelector,this.view.on("extraitemclick",
this.onExtraItemClick,this))},setBoxStore:function(a,b){if(this.boxStore!==a||!0===b)if(this.boxStore&&(this.mun(this.boxStore,{datachanged:this.onBoxStoreDataChanged,add:this.onBoxStoreAdd,remove:this.onBoxStoreRemove,update:this.onBoxStoreUpdate,clear:this.onBoxStoreClear,scope:this}),this.clearBoxes()),this.boxStore=Ext.StoreMgr.lookup(a))this.loadBoxes(this.boxStore),this.mon(this.boxStore,{datachanged:this.onBoxStoreDataChanged,add:this.onBoxStoreAdd,remove:this.onBoxStoreRemove,update:this.onBoxStoreUpdate,
clear:this.onBoxStoreClear,scope:this})},getBoxStore:function(){return this.boxStore},getListTextMetric:function(){this.listTextMetric||(this.listTextMetric=Ext.util.TextMetrics.createInstance(this.innerList));return this.listTextMetric},getInputTextMetric:function(){this.inputTextMetric||(this.inputTextMetric=Ext.util.TextMetrics.createInstance(this.el));return this.inputTextMetric},onTriggerClick:function(){!0===this.enableComboBox&&Zarafa.common.ui.BoxField.superclass.onTriggerClick.apply(this,
arguments)},doQuery:function(){!0===this.enableComboBox&&Zarafa.common.ui.BoxField.superclass.doQuery.apply(this,arguments)},assertValue:function(){!0===this.enableComboBox&&Zarafa.common.ui.BoxField.superclass.assertValue.apply(this,arguments)},onSelect:function(a){this.hideSuggestionList();this.handleSelection(a);this.lastQuery=""},hideSuggestionList:function(){this.isExpanded()&&(this.collapse(),this.el.dom.value="",this.sizeInputfield(),this.store.removeAll(!0))},getDesiredListWidth:function(){var a=
this.getListTextMetric(),b=0;if(0<this.innerList.dom.children.length)for(var c=0,d=this.innerList.dom.children.length;c<d;c++){var e=Ext.fly(this.innerList.dom.children[c]),e=e.getPadding("lr")+a.getWidth(e.dom.innerHTML);e>b&&(b=e)}else b=a.getWidth(this.innerList.dom.innerHTML);return b},onBeforeLoad:function(){Zarafa.common.ui.BoxField.superclass.onBeforeLoad.apply(this,arguments);var a=this.getDesiredListWidth();this.restrictWidth(a)},onLoad:function(a,b,c){if(this.hasFocus&&(0<this.store.getCount()||
this.listEmptyText)){var d=this.getDesiredListWidth(),d=d+this.list.getFrameWidth("lr"),d=d+Ext.getScrollBarWidth();this.restrictWidth(d)}Zarafa.common.ui.BoxField.superclass.onLoad.apply(this,arguments)},restrictWidth:function(a){var b=this.getEl(),c=this.getResizeEl(),d=b.getOffsetsTo(c),e=c.getWidth(),f=0,b=b.getFrameWidth("b");this.minListWidth>a?a=this.minListWidth:e<a&&"zarafa.userlistbox"!==this.boxType&&(a=e);c=c.getWidth()-d[0];c<a&&"zarafa.userlistbox"!==this.boxType&&(f=c-a);f>d[0]&&(a-=
f-d[0],f=-d[0]);this.list.setWidth(a);this.innerList.setWidth(a-this.list.getFrameWidth("lr"));this.listAlign=["tl-bl",[f,b]]},onRender:function(a,b){Zarafa.common.ui.BoxField.superclass.onRender.call(this,a,b);Ext.isEmpty(this.wrapCls)||this.wrap.addClass(this.wrapCls);!1===this.autoHeight?Ext.isDefined(this.height)&&this.wrap.setHeight(this.height):this.wrap.applyStyles("height: auto;");this.boxFocusEl=this.wrap.createChild({tag:"a",href:"#",tabindex:-1,style:"position: absolute; left:-10000px; top:-10000px;"});
this.wrapBoxesEl=this.el.wrap({tag:"ul"});this.inputEl=this.el.wrap({tag:"li",cls:"x-zarafa-boxfield-input-item"});!1===this.border&&this.el.addClass("x-zarafa-boxfield-input-noborder");Ext.isDefined(this.boxStore)&&this.setBoxStore(this.boxStore,!0)},updateEditState:function(){Zarafa.common.ui.BoxField.superclass.updateEditState.apply(this,arguments);this.inputEl.setVisible(this.editable);this.items.each(function(a){a.setEditable(this.editable)})},getContentTarget:function(){return this.wrap},onResize:function(a,
b,c,d){Zarafa.common.ui.BoxField.superclass.onResize.call(this,a,b,c,d);this.sizeInputfield();this.sizeContainer()},sizeContainer:function(){if(!this.rendered||!1===this.autoHeight)return!1;var a=this.getResizeEl();if(Ext.isDefined(a)&&Ext.isDefined(a.dom)){var b=a.getHeight(),c=a.dom.scrollHeight,d=!1;this.previousOuterHeight!==b&&(d=!0);b>this.boxMaxHeight?(a.setHeight(this.boxMaxHeight),!1!==this.initialConfig.autoScroll&&(this.setAutoScroll(!0),a.scrollTo("top",b)),d=!0):b===this.boxMaxHeight&&
c!==this.previousInnerHeight&&c<=b-2&&(a.setHeight("auto"),!1!==this.initialConfig.autoScroll&&this.setAutoScroll(!1),d=!0);this.previousOuterHeight=b;this.previousInnerHeight=c;!0===d&&this.fireEvent("resizeheight")}},onParentLayout:function(){var a=this.getDesiredBoxWidth();Ext.isDefined(a)&&this.items.each(function(b){b.setWidth(a)})},getDesiredBoxWidth:function(){if(!0===this.listMode){var a=this.getResizeEl();return a.getWidth()-a.getFrameWidth("lr")-this.el.getFrameWidth("lr")}},sizeInputfield:function(){if(!this.rendered)return!1;
var a=this.getResizeEl(),b;if(!0===this.listMode)b=a.getWidth()-a.getFrameWidth("lr")-this.el.getFrameWidth("lr");else{var c=this.getInputTextMetric();b=Ext.util.Format.htmlEncode(this.el.dom.value);b=c.getWidth(b);b+=this.minInputFieldWidth;b=Math.min(b,a.getWidth())}c=a.getHeight();this.el.setSize(b,this.inputFieldHeight-this.el.getBorderWidth("tb"));b=a.getHeight();!0!==this.listMode&&c===b||this.sizeContainer();a.scrollTo("top",b)},handleInput:Ext.emptyFn,handleSelection:Ext.emptyFn,convertInputToBox:function(){var a=
this.el.getValue();Ext.isEmpty(a)||(this.el.dom.value="",this.sizeInputfield(),this.store.removeAll(!0),this.handleInput(a))},filterRecords:function(a,b){for(var c=[],d=0,e=b.length;d<e;d++){var f=b[d];this.filterRecord(f)&&c.push(f)}return c},filterRecord:function(a){return!0},getBoxForRecord:function(a){return this.items.find(function(b){return b.record===a})},beforeBlur:function(){Zarafa.common.ui.BoxField.superclass.beforeBlur.apply(this,arguments);this.convertInputToBox();this.boxBlur()},boxFocus:function(a){this.currentFocus&&
this.currentFocus.blur();(this.currentFocus=a)&&this.currentFocus.focus()},boxBlur:function(){this.currentFocus&&this.currentFocus.blur();this.currentFocus=!1},focus:function(a,b){if(b)this.focusTask=new Ext.util.DelayedTask(this.focus,this,[a,!1]),this.focusTask.delay(Ext.isNumber(b)?b:10);else return this.rendered&&!this.isDestroyed&&this.inputFocus(void 0,a),this},inputFocus:function(a,b){this.boxBlur();this.el.focus();Ext.isEmpty(a)||Zarafa.core.Util.setCaretPosition(this.el,a);!0===b&&this.el.dom.select()},
inputBlur:function(){this.el.blur()},onContainerClick:function(a,b){this.collapse();this.editable?b===this.el.dom?this.inputFocus():this.el.isVisible()&&(a.stopEvent(),this.inputFocus(this.el.dom.value.length)):this.currentFocus||this.boxFocus(this.items.last())},createBoxKeyMap:function(a){for(var b=[{key:[Ext.EventObject.ENTER],handler:this.onBoxKeyEnter,scope:this},{key:[Ext.EventObject.UP,Ext.EventObject.PAGE_UP],handler:this.onBoxKeyUp,scope:this},{key:[Ext.EventObject.DOWN,Ext.EventObject.PAGE_DOWN],
handler:this.onBoxKeyDown,scope:this},{key:[Ext.EventObject.LEFT],handler:this.onBoxKeyLeft,scope:this},{key:[Ext.EventObject.RIGHT],handler:this.onBoxKeyRight,scope:this},{key:[Ext.EventObject.HOME],handler:this.onBoxKeyHome,scope:this},{key:[Ext.EventObject.END],handler:this.onBoxKeyEnd,scope:this},{key:[Ext.EventObject.BACKSPACE],handler:this.onBoxKeyBackspace,scope:this},{key:[Ext.EventObject.DELETE],handler:this.onBoxKeyDelete,scope:this},{key:[Ext.EventObject.C],ctrl:!0,handler:this.onBoxKeyCopy,
scope:this}],c=0,d=b.length;c<d;c++)Ext.applyIf(b[c],{shift:!1,alt:!1,ctrl:!1});return new Ext.KeyMap(a,b)},onBoxKeyCopy:function(){Zarafa.common.Actions.copyEmailAddress(this.currentFocus.record)},onBoxKeyEnter:function(a,b){b.stopEvent();this.doBoxDblClick(this.currentFocus)},onBoxKeyUp:function(a,b){this.onBoxKeyLeft(a,b)},onBoxKeyDown:function(a,b){this.onBoxKeyRight(a,b)},onBoxKeyLeft:function(a,b){b.stopEvent();var c=this.items.indexOf(this.currentFocus);0!==c&&this.boxFocus(this.items.itemAt(c-
1))},onBoxKeyRight:function(a,b){b.stopEvent();var c=this.items.indexOf(this.currentFocus);c!==this.items.getCount()-1?this.boxFocus(this.items.itemAt(c+1)):this.editable&&this.inputFocus(0)},onBoxKeyHome:function(a,b){b.stopEvent();var c=this.items.first();c.hasFocus()||this.boxFocus(c)},onBoxKeyEnd:function(a,b){b.stopEvent();var c=this.items.last();c.hasFocus()?this.editable&&this.inputFocus(this.el.dom.value.length):this.boxFocus(c)},onBoxKeyBackspace:function(a,b){b.stopEvent();if(!1!==this.editable){var c=
this.items.indexOf(this.currentFocus);this.doBoxRemove(this.currentFocus);0<c?this.boxFocus(this.items.itemAt(c-1)):0<this.items.getCount()?this.boxFocus(this.items.itemAt(0)):this.inputFocus()}},onBoxKeyDelete:function(a,b){b.stopEvent();if(!1!==this.editable){var c=this.items.indexOf(this.currentFocus);this.doBoxRemove(this.currentFocus);c<this.items.getCount()?this.boxFocus(this.items.itemAt(c)):this.inputFocus(0)}},createInputKeyMap:function(a){return new Ext.KeyMap(a,[{key:[this.handleInputKey],
shift:!1,alt:!1,ctrl:!1,handler:this.onInputKey,scope:this}],"keypress")},createListKeyMap:function(a){return new Ext.KeyMap(a,{key:[Ext.EventObject.DELETE],handler:this.onListKeyDelete,scope:this,shift:!1,alt:!1,ctrl:!1})},createSpecialInputKeyMap:function(a){for(var b=[{key:[Ext.EventObject.ENTER],handler:this.onInputKeyEnter,scope:this},{key:[Ext.EventObject.TAB],handler:this.onInputKeyTab,scope:this},{key:[Ext.EventObject.UP,Ext.EventObject.PAGE_UP],handler:this.onInputKeyUp,scope:this},{key:[Ext.EventObject.LEFT],
handler:this.onInputKeyLeft,scope:this},{key:[Ext.EventObject.HOME],handler:this.onInputKeyHome,scope:this},{key:[Ext.EventObject.BACKSPACE],handler:this.onInputKeyBackspace,scope:this}],c=0,d=b.length;c<d;c++)Ext.apply(b[c],{shift:!1,alt:!1,ctrl:!1});b.push({key:[Ext.EventObject.TAB],shift:!0,alt:!1,ctrl:!1,handler:this.onInputKeyTab,scope:this});return new Ext.KeyMap(a,b)},onKeyDownHandler:function(a){a.isSpecialKey()||(this.collapse(),this.sizeInputfield())},onInputKey:function(a,b){b.stopEvent();
this.convertInputToBox()},onInputKeyEnter:function(a,b){this.isExpanded()&&0<this.store.getCount()||(b.stopEvent(),this.convertInputToBox())},onInputKeyTab:function(a,b){Ext.isEmpty(this.getValue())?this.triggerBlur():(b.stopEvent(),this.isExpanded()&&0<this.store.getCount()||this.convertInputToBox())},onInputKeyUp:function(a,b){this.onInputKeyLeft(a,b)},onInputKeyLeft:function(a,b){var c=Zarafa.core.Util.getSelectionRange(this.el);0===c.start&&0===c.end&&0<this.items.getCount()&&(b.stopEvent(),this.boxFocus(this.items.last()))},
onInputKeyHome:function(a,b){var c=Zarafa.core.Util.getSelectionRange(this.el);0===c.start&&0===c.end&&0<this.items.getCount()&&(b.stopEvent(),this.boxFocus(this.items.first()))},onInputKeyBackspace:function(a,b){var c=Zarafa.core.Util.getSelectionRange(this.el);0===c.start&&0===c.end&&0<this.items.getCount()&&(b.stopEvent(),this.boxFocus(this.items.last()))},onListKeyDelete:function(a,b){var c=this.getStore();0!==c.getCount()&&(b.stopEvent(),c.removeAt(this.selectedIndex),c.getCount()==this.selectedIndex?
this.selectPrev():this.select(this.selectedIndex),this.restrictHeight())},onExtraItemClick:function(a,b,c,d){this.onListKeyDelete(!1,d)},onPaste:function(){this.sizeInputfield()},onBoxStoreDataChanged:function(a){this.clearBoxes();this.loadBoxes(a)},onBoxStoreClear:function(){this.clearBoxes()},onBoxStoreAdd:function(a,b,c){Array.isArray(b)||(b=[b]);b=this.filterRecords(a,b);for(a=0;a<b.length;a++)this.addBox(b[a])},onBoxStoreRemove:function(a,b,c){this.removeBox(b)},onBoxStoreUpdate:function(a,b){if(this.filterRecord(b)){var c=
this.getBoxForRecord(b);c?c.update(b):this.addBox(b)}else this.removeBox(b)},doBoxClick:function(a){this.boxFocus(a);this.fireEvent("boxclick",this,a,a.record)},doBoxDblClick:function(a){this.fireEvent("boxdblclick",this,a,a.record)},doBoxContextMenu:function(a){this.boxFocus(a);this.fireEvent("boxcontextmenu",this,a,a.record)},doBoxFocus:function(a){if(!0!==this.hasFocus)this.onFocus();this.boxFocusEl.focus();a.getPositionEl().scrollIntoView(this.getContentTarget());this.fireEvent("boxfocus",this,
a,a.record)},doBoxBlur:function(a){this.boxFocusEl.blur();this.fireEvent("boxblur",this,a,a.record)},doBoxRemove:function(a){this.fireEvent("boxremove",this,a,a.record)},onBoxRemove:function(a,b,c){this.boxStore.remove(c);this.boxStore.getCount()<this.boxLimit&&!0!==this.initialConfig.readOnly&&(this.setReadOnly(!1),this.inputFocus())},onBoxAdd:function(a,b,c){this.boxStore.getCount()>=this.boxLimit&&this.setReadOnly(!0)},addBox:function(a){var b={};Ext.apply(b,{xtype:this.boxType,parent:this,record:a,
editable:this.editable,width:this.getDesiredBoxWidth()},this.boxConfig);b=Ext.create(b);b.render(this.wrapBoxesEl,this.items.length);this.items.add(b);this.sizeContainer();this.fireEvent("boxadd",this,b,a)},removeBox:function(a){if(a=this.getBoxForRecord(a)){var b=this.items.indexOf(a);a.doDestroy(this.enableAnim);this.items.remove(a);this.items.getCount()<this.boxLimit&&!0!==this.initialConfig.readOnly&&this.setReadOnly(!1);this.currentFocus&&this.currentFocus!==a||(this.items.getCount()>b?this.boxFocus(this.items.itemAt(b)):
this.inputFocus())}},loadBoxes:function(a){a=this.filterRecords(a,a.getRange());for(var b=0;b<a.length;b++)this.addBox(a[b])},clearBoxes:function(){this.items.each(function(a){a.destroy()});this.items.clear()},onDestroy:function(){Zarafa.common.ui.BoxField.superclass.onDestroy.apply(this,arguments);!1!==this.editable&&Zarafa.core.Events.removePasteEventHandler(this,this.el,this.onPaste,this)}});Ext.reg("zarafa.boxfield",Zarafa.common.ui.BoxField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.BoxFieldDragZone=Ext.extend(Ext.dd.DragZone,{field:void 0,getDragData:function(a){if(a=a.getTarget(".x-zarafa-boxfield-item")){for(var b=Ext.DomHelper.createDom({tag:"div",html:a.innerHTML,id:Ext.id(),cls:a.className,style:"display : inline-block"}),c=0;c<b.childNodes.length;c++)b.childNodes[c].id&&(b.childNodes[c].id=Ext.id());return{ddel:b,sourceEl:a,repairXY:Ext.fly(a).getXY(),draggedRecord:this.field.items.get(a.id).record}}},getRepairXY:function(){return this.dragData.repairXY}});
Ext.reg("zarafa.boxfielddragzone",Zarafa.common.ui.BoxFieldDragZone);Ext.namespace("Zarafa.common.ui");Zarafa.common.ui.BoxFieldDropZone=Ext.extend(Ext.dd.DropZone,{field:void 0,getTargetFromEvent:function(a){return a.getTarget(".x-zarafa-boxfield")},onNodeEnter:function(a,b,c,d){Ext.get(a).addClass(this.wrapFocusClass)},onNodeOut:function(a,b,c,d){Ext.get(a).removeClass(this.wrapFocusClass)},onNodeOver:function(a,b,c,d){return Ext.dd.DropZone.prototype.dropAllowed}});
Ext.reg("zarafa.boxfielddropzone",Zarafa.common.ui.BoxFieldDropZone);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.CharacterStrip=Ext.extend(Ext.Container,{characterData:"... 123 a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" "),selectedChar:null,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.characterstrip",layout:{type:"vbox",align:"stretchmax"},border:!1,autoWidth:!0});this.addEvents("selectionchanged","selectioncleared");Zarafa.common.ui.CharacterStrip.superclass.constructor.call(this,a)},initComponent:function(){this.items=[];Ext.each(this.characterData,function(a){this.items.push(new Ext.Button({text:a,
enableToggle:!0,scale:"small",toggleGroup:"chargroup",handler:this.onButtonClick,scope:this,flex:1,pressed:this.selectedChar==a,allowDepress:!1,ref:"char_"+a}))},this);Zarafa.common.ui.CharacterStrip.superclass.initComponent.call(this,arguments)},onButtonClick:function(a,b){a.pressed&&(this.selectedChar=a.getText(),this.fireEvent("selectionchanged",this,this.selectedChar))},clearSelection:function(){this["char_"+this.selectedChar].toggle(!1);this.selectedChar=null;this.fireEvent("selectioncleared",
this)}});Ext.reg("zarafa.characterstrip",Zarafa.common.ui.CharacterStrip);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.ColorPicker=Ext.extend(Ext.form.Field,{value:"BDC3C7",border:!0,fieldClass:"x-form-field k-colorpicker",colors:"E30022 F89406 F7CA18 F7B884 5AB557 1FA480 88D8C0 D3E28B 912787 9A8BBC FF0099 F17DAA 0F70BD 00B3F0 86CFF5 BDC3C7".split(" "),box:null,menu:null,constructor:function(a){this.addEvents("show","hide","select");a=a||{};Ext.applyIf(a,{defaultAutoCreate:!0});Zarafa.common.ui.ColorPicker.superclass.constructor.call(this,a)},onRender:function(){if(!this.el){var a=this.getAutoCreate();
a.name||(a.name=this.name||this.id);this.autoEl=a}Zarafa.common.ui.ColorPicker.superclass.onRender.apply(this,arguments);this.border&&(this.cls=(this.cls||"")+" zarafa-border");this.el.addClass([this.fieldClass,this.cls]);this.box=Ext.get(Ext.DomHelper.createDom({tag:"div",cls:"k-colorpicker-box"}));this.el.appendChild(this.box);this.createMenu()},createMenu:function(){this.menu=new Ext.menu.ColorMenu({cls:"k-colorpicker-menu",handler:function(a,b){this.setValue(b);this.fireEvent("select",this,b)},
scope:this});this.menu.palette.colors=this.colors;this.relayEvents(this.menu,["show","hide"])},initEvents:function(){Zarafa.common.ui.ColorPicker.superclass.initEvents.call(this);this.mon(this.box,"click",this.onClick,this)},setValue:function(a){Ext.isEmpty(a)||(this.value=a.startsWith("#")?a.replace("#",""):a);this.rendered&&this.box.setStyle("background-color","#"+this.value);return this},getValue:function(){return this.value},onClick:function(a){this.menu.showAt(a.getXY());a=this.value.toUpperCase();
-1<this.colors.indexOf(a)&&this.menu.palette.select(a,!0)}});Ext.reg("zarafa.colorpicker",Zarafa.common.ui.ColorPicker);Ext.namespace("Zarafa.common");
Zarafa.common.CommonViewButtons=Ext.extend(Ext.menu.Menu,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:this.createMainToolbarViewButton(a.context)});Zarafa.common.CommonViewButtons.superclass.constructor.call(this,a)},createMainToolbarViewButton:function(a){var b=a.getName(),c=container.populateInsertionPoint("main.maintoolbar.view."+b,this)||[];return[{id:"zarafa-maintoolbar-view-"+b+"-nopreview",overflowText:_("No preview"),iconCls:"icon_previewpanel_off",text:_("No preview"),valueView:Zarafa.common.data.Views.LIST,
valueViewMode:Zarafa.common.data.ViewModes.NO_PREVIEW,valueDataMode:Zarafa.common.data.DataModes.ALL,handler:a.onContextSelectView,scope:a},{id:"zarafa-maintoolbar-view-"+b+"-previewright",overflowText:_("Right preview"),iconCls:"icon_previewpanel_right",text:_("Right preview"),valueView:Zarafa.common.data.Views.LIST,valueViewMode:Zarafa.common.data.ViewModes.RIGHT_PREVIEW,valueDataMode:Zarafa.common.data.DataModes.ALL,handler:a.onContextSelectView,scope:a},{id:"zarafa-maintoolbar-view-"+b+"-previewbottom",
overflowText:_("Bottom preview"),iconCls:"icon_previewpanel_bottom",text:_("Bottom preview"),valueView:Zarafa.common.data.Views.LIST,valueViewMode:Zarafa.common.data.ViewModes.BOTTOM_PREVIEW,valueDataMode:Zarafa.common.data.DataModes.ALL,handler:a.onContextSelectView,scope:a}].concat(c)}});Ext.reg("zarafa.commonviewbuttons",Zarafa.common.CommonViewButtons);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.CompositeField=Ext.extend(Ext.form.CompositeField,{isSingleValued:!1,focusClass:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.compositefield",defaultMargins:"0 6 0 0"});a.cls=a.cls?a.cls+" zarafa-compositefield":"zarafa-compositefield";Ext.apply(this,a);Zarafa.common.ui.CompositeField.superclass.constructor.call(this,a)},initComponent:function(){Zarafa.common.ui.CompositeField.superclass.initComponent.call(this);var a=this.innerCt.findBy(function(a){return a.isXType("box")},
this);this.items.addAll(a);this.innerCt.ownerCt=this},cascade:function(a,b,c){if(!1!==a.apply(b||this,c||[this])&&this.items)for(var d=this.items instanceof Ext.util.MixedCollection?this.items.items:this.items,e=0,f=d.length;e<f;e++)d[e].cascade?d[e].cascade(a,b,c):a.apply(b||d[e],c||[d[e]]);return this},validateValue:function(a,b){var c=!0;this.eachItem(function(a){a.isXType("field")&&!a.isValid(b)&&(c=!1)});return c},find:Ext.Container.prototype.find,findBy:Ext.Container.prototype.findBy,findByType:Ext.Container.prototype.findByType});
Ext.reg("zarafa.compositefield",Zarafa.common.ui.CompositeField);Ext.namespace("Zarafa.common.ui");Zarafa.common.ui.ContextMainPanel=Ext.extend(Ext.Panel,{context:void 0,model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());Ext.applyIf(a,{xtype:"zarafa.contextmainpanel",border:!1,cls:"zarafa-panel"});Zarafa.common.ui.ContextMainPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.contextmainpanel",Zarafa.common.ui.ContextMainPanel);
Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.ContextMainPanelToolbar=Ext.extend(Ext.Toolbar,{context:void 0,model:void 0,paging:void 0,defaultTitle:_("Kopano WebApp"),constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());var b=[],b=b.concat({xtype:"zarafa.searchfieldcontainer",boxMinWidth:100,ref:"searchFieldContainer",model:a.model});Ext.isEmpty(a.paging)||(b=b.concat(a.paging));b.push({xtype:"zarafa.paging",style:"border-style : none",ref:"pagesToolbar",pageSize:container.getSettingsModel().get("zarafa/v1/main/page_size"),
store:a.model?a.model.getStore():void 0});b=b.concat(["->",{xtype:"zarafa.toolbarbutton",overflowText:_("Copy/Move"),tooltip:_("Copy/Move")+" (Ctrl + M)",iconCls:"icon_copy",ref:"copyButton",nonEmptySelectOnly:!0,handler:this.onCopyMove,model:a.model,scope:this},{xtype:"zarafa.toolbarbutton",overflowText:_("Delete"),tooltip:_("Delete")+" (DELETE)",ref:"deleteButton",iconCls:"icon_delete",nonEmptySelectOnly:!0,handler:this.onDelete,model:a.model,scope:this}]);Ext.isEmpty(a.items)||(b=b.concat(a.items));
delete a.items;Ext.applyIf(a,{xtype:"zarafa.contextmainpaneltoolbar",ref:"contextMainPanelToolbar",items:b,enableOverflow:!0});Zarafa.common.ui.ContextMainPanelToolbar.superclass.constructor.call(this,a);this.initEvent()},initEvent:function(){this.on("afterlayout",this.onAfterLayout,this,{delay:2})},onAfterLayout:function(a,b){var c=this.getWidth(),d=0;Ext.each(a.items.items,function(a,b,c){!a.isXType("zarafa.searchfieldcontainer")&&a.rendered&&(a.isVisible()?d+=a.getWidth():Ext.isDefined(a.xtbHidden)&&
a.xtbHidden&&(d+=a.xtbWidth))},this);c>d&&Ext.each(a.items.items,function(a,c,d){!a.isVisible()&&Ext.isDefined(a.xtbHidden)&&a.xtbHidden&&b.unhideItem(a)},this);a.searchFieldContainer.searchTextField.setWidth(c-d)},onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.model.getSelectedRecords())},onDelete:function(){Zarafa.common.Actions.deleteRecords(this.model.getSelectedRecords())},onPrint:function(){Zarafa.common.Actions.openPrintDialog(this.model.getSelectedRecords())}});
Ext.reg("zarafa.contextmainpaneltoolbar",Zarafa.common.ui.ContextMainPanelToolbar);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.DataDragZone=Ext.extend(Ext.dd.DragZone,{view:void 0,ddel:void 0,constructor:function(a,b){b=b||{};this.view=a;Ext.applyIf(b,{ddGroup:"DataDD"});Zarafa.common.ui.DataDragZone.superclass.constructor.call(this,a.getEl(),b);this.ddel=document.createElement("div");this.ddel.className="x-data-dd-wrap"},getDragData:function(a){var b=this.view.findItemFromChild(Ext.lib.Event.getTarget(a));if(b)return b=this.view.indexOf(b),0<=b?(a=new Ext.EventObjectImpl(a),{view:this.view,ddel:this.ddel,
index:b,selections:this.view.getSelectedRecords(),origEvent:a}):!1},onInitDrag:function(a,b){if(this.dragData&&this.dragData.origEvent){var c=this.dragData.index,d=this.view.getNode(c);this.view.isSelected(c)||(this.view.onItemClick(d,c,this.dragData.origEvent),this.dragData.selections=this.view.getSelectedRecords());delete this.dragData.origEvent}this.ddel.innerHTML=this.view.getDragDropText();this.proxy.update(this.ddel)},afterRepair:function(){this.dragging=!1},getRepairXY:function(a,b){return!1},
onEndDrag:function(a,b){},onValidDrop:function(a,b,c){this.hideProxy()},beforeInvalidDrop:function(a,b){}});Ext.ns("Zarafa.common.ui");
Zarafa.common.ui.DateRangeField=Ext.extend(Ext.Container,{startFieldConfig:{},endFieldConfig:{},spacerConfig:void 0,defaultValue:void 0,defaultPeriod:void 0,defaultPeriodType:Date.MINUTE,allowEqualValue:!1,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.daterangefield",border:!1,bodyStyle:"background-color: inherit;",layout:"form"});this.addEvents("change");if(Ext.isDefined(a.defaultValue))Ext.isDefined(a.defaultPeriod)||(a.defaultPeriodType=Date.MINUTE,a.defaultPeriod=a.defaultValue.getDuration(Date.MINUTE));
else if(Ext.isDefined(a.defaultPeriod)){var b=new Date,c=b.clone().add(a.defaultPeriodType,a.defaultPeriod);a.defaultValue=new Zarafa.core.DateRange({startDate:b,dueDate:c})}Zarafa.common.ui.DateRangeField.superclass.constructor.call(this,a);this.addFieldItems();this.bindDateRange(this.defaultValue)},addFieldItems:function(){Ext.isDefined(this.startFieldConfig)&&("form"!==this.layout&&(this.startFieldConfig.plugins=Ext.value(this.startFieldConfig.plugins,[]).concat("zarafa.fieldlabeler")),this.startFieldConfig.listeners=
Zarafa.core.Util.mergeListeners(this.startFieldConfig.listeners,{change:this.onStartChange,scope:this}),this.add(Ext.applyIf(this.startFieldConfig,{ref:"startField",flex:.5,defaultValue:this.defaultValue?this.defaultValue.getStartDate():void 0,value:this.defaultValue?this.defaultValue.getStartDate():void 0})));Ext.isDefined(this.spacerConfig)&&this.add(Ext.applyIf(this.spacerConfig,{xtype:"spacer",height:5,width:5}));Ext.isDefined(this.endFieldConfig)&&("form"!==this.layout&&(this.endFieldConfig.plugins=
Ext.value(this.endFieldConfig.plugins,[]).concat("zarafa.fieldlabeler")),this.endFieldConfig.listeners=Zarafa.core.Util.mergeListeners(this.endFieldConfig.listeners,{change:this.onEndChange,scope:this}),this.add(Ext.applyIf(this.endFieldConfig,{ref:"endField",flex:.5,defaultValue:this.defaultValue?this.defaultValue.getDueDate():void 0,value:this.defaultValue?this.defaultValue.getDueDate():void 0})))},bindDateRange:function(a){this.defaultValue&&this.mun(this.defaulValue,"update",this.onDateRangeUpdate,
this);var b=this.defaultValue;(this.defaultValue=a)&&this.mon(this.defaultValue,"update",this.onDateRangeUpdate,this);this.onDateRangeUpdate(a,b)},onStartChange:function(a,b,c){a=this.defaultValue;c=this.defaultValue.clone();if(a.getStartDate()!=b){var d=a.getDuration(),e=a.getDueDate().clone(),d=b.add(Date.MILLI,d);d<b&&(d=d.add(Date.HOUR,2));this.endField.maxValue&&d>this.endField.maxValue&&(d=this.endField.maxValue);a.set(b.clone(),d.clone());d!=e&&this.endField.setValue(d);this.fireEvent("change",
this,a.clone(),c)}},onEndChange:function(a,b,c){a=this.defaultValue;c=this.defaultValue.clone();if(a.getDueDate()!=b){var d=b.getTime(),e=a.getStartTime();d<e||!1===this.allowEqualValue&&d===e?(d=a.getStartDate().clone(),e=b.add(this.defaultPeriodType,-this.defaultPeriod),this.startField.minValue&&e<this.startField.minValue&&(e=this.startField.minValue),a.set(e.clone(),b.clone()),e!=d&&this.startField.setValue(e)):a.setDueDate(b.clone());this.fireEvent("change",this,a.clone(),c)}},setValue:function(a){this.bindDateRange(a)},
setRawValue:function(a){this.bindDateRange(a)},getValue:function(){return this.defaultValue},getRawValue:function(){return this.defaultValue},enable:function(){Zarafa.common.ui.DateRangeField.superclass.enable.call(this);this.startField.enable();this.endField.enable()},disable:function(){Zarafa.common.ui.DateRangeField.superclass.disable.call(this);this.startField.disable();this.endField.disable()},onDateRangeUpdate:function(a,b){a&&(this.rendered?(this.startField.setValue(a.getStartDate()),this.endField.setValue(a.getDueDate())):
(this.items.get(0).defaultValue=a.getStartDate(),this.items.get(1).defaultValue=a.getDueDate(),this.items.get(0).value=a.getStartDate(),this.items.get(1).value=a.getDueDate()))}});Ext.reg("zarafa.daterangefield",Zarafa.common.ui.DateRangeField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.DisplayField=Ext.extend(Ext.form.DisplayField,{renderer:function(a){return a},rawValue:void 0,setRawValue:function(a){this.rawValue=a;return Zarafa.common.ui.DisplayField.superclass.setRawValue.call(this,this.renderer(a))},getRawValue:function(){return this.rawValue}});Ext.reg("zarafa.displayfield",Zarafa.common.ui.DisplayField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.DraggableDataView=Ext.extend(Ext.DataView,{ddGroup:void 0,enableDragDrop:!1,enableDrop:!1,dropZone:void 0,dropConfig:void 0,enableDrag:!1,dragZone:void 0,dragConfig:void 0,templateEl:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push({ptype:"zarafa.enablefocusplugin"});Zarafa.common.ui.DraggableDataView.superclass.constructor.call(this,a)},onRender:function(){Zarafa.common.ui.DraggableDataView.superclass.onRender.apply(this,arguments);this.templateEl=
this.getEl().createChild({tag:this.autoEl});!this.enableDragDrop&&!this.enableDrop||this.dropZone||(this.dropZone=new Ext.dd.DropZone(this.getEl(),this.dropConfig||{ddGroup:this.ddGroup||"DataDD"}));!this.enableDragDrop&&!this.enableDrag||this.dragZone||(this.dragZone=new Zarafa.common.ui.DataDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"DataDD"}))},afterRender:function(){Zarafa.common.ui.DraggableDataView.superclass.afterRender.apply(this,arguments);Zarafa.core.KeyMapMgr.activate(this,"view.mapimessage")},
getTemplateTarget:function(){return this.templateEl?this.templateEl:Zarafa.common.ui.DraggableDataView.superclass.getTemplateTarget.apply(this)},getDragDropText:function(){var a=this.getSelectionCount();return String.format(ngettext("{0} selected item","{0} selected items",a),a)}});Ext.reg("zarafa.draggabledataview",Zarafa.common.ui.DraggableDataView);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.DurationField=Ext.extend(Ext.form.NumberField,{stripCharsRe:/[^0-9]+/,allowDecimals:!1,allowNegative:!1,processValue:function(a){return Ext.isString(a)&&this.stripCharsRe?a.replace(this.stripCharsRe,""):a},setValue:function(a){a=this.parseValue(a);a=String.format(ngettext("{0} hour","{0} hours",a),a);Ext.form.NumberField.superclass.setValue.call(this,a)}});Ext.reg("zarafa.durationfield",Zarafa.common.ui.DurationField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.EditorField=Ext.extend(Ext.Container,{useHtml:!0,htmlXtype:"zarafa.htmleditor",plaintextXtype:"zarafa.textarea",htmlName:"",plaintextName:"",componentConfig:void 0,relayedEvents:["change","valuecorrection","keypress","initialized"],enableSystemContextMenu:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.editorfield",layout:"card",items:this.getEditors(a)});Ext.apply(this,a);a.activeItem=this.useHtml?0:1;this.addEvents.apply(this,this.relayedEvents);this.addEvents("setAutoFocusCursor");
Zarafa.common.ui.EditorField.superclass.constructor.call(this,a);this.on("beforerender",this.onBeforeRender,this);this.on("setAutoFocusCursor",this.onSetAutoFocusCursor,this)},getEditors:function(a){var b=a.componentConfig;Ext.isDefined(b)||(b=Ext.apply({},a),delete b.xtype,delete b.layout,delete b.layoutConfig,delete b.useHtml,delete b.htmlXtype,delete b.plaintextXtype,delete b.relayedEvents,delete b.listeners,delete b.ownerCt,delete b.ref);Ext.applyIf(b,{hideMode:"display",ownerCt:this,enableSystemContextMenu:this.enableSystemContextMenu});
return[Ext.apply({},{xtype:a.htmlXtype||this.htmlXtype,name:a.htmlName||this.htmlName,enableKeyEvents:a.enableKeyEvents||!1},b),Ext.apply({},{xtype:a.plaintextXtype||this.plaintextXtype,name:a.plaintextName||this.plaintextName,enableKeyEvents:a.enableKeyEvents||!1},b)]},onBeforeRender:function(a){Ext.isEmpty(this.relayedEvents)||this.items.each(function(a){this.relayEvents(a,this.relayedEvents)},this)},setRawValue:function(a){return this.getLayout().activeItem.setRawValue(a)},setValue:function(a){return this.getLayout().activeItem.setValue(a)},
getRawValue:function(){return this.getLayout().activeItem.getRawValue()},getValue:function(){return this.getLayout().activeItem.getValue()},focus:function(a,b){this.getLayout().activeItem.focus(a,b)},reset:function(){this.getLayout().activeItem.reset()},enable:function(){this.items.each(function(a){a.enable()})},disable:function(){this.items.each(function(a){a.disable()})},getEditor:function(){return this.getLayout().activeItem},getName:function(){return this.getLayout().activeItem.getName()},setHtmlEditor:function(a,
b){if(this.useHtml!==a){var c=this.getLayout(),d=c.activeItem.getValue();this.useHtml=a;c.setActiveItem(a?0:1);if(!1!==b&&!Ext.isEmpty(d)){var e;e=a?Zarafa.core.HTMLParser.convertPlainToHTML(d):Zarafa.core.HTMLParser.convertHTMLToPlain(d);this.fireEvent("change",this,e,d);c.activeItem.setValue(e)}}},isHtmlEditor:function(){return this.useHtml},onSetAutoFocusCursor:function(){this.getLayout().activeItem.setCursorLocation()},insertAtCursor:function(a){this.getLayout().activeItem.insertAtCursor(a)},
bindRecord:function(a){this.isHtmlEditor()&&this.getLayout().activeItem.bindRecord(a)}});Ext.reg("zarafa.editorfield",Zarafa.common.ui.EditorField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.IconClass={getIconClass:function(a){var b=a.get("icon_index"),c=a.get("object_type"),d="";Ext.isEmpty(b)||(b===Zarafa.core.mapi.IconIndex.appt_recurring||b===Zarafa.core.mapi.IconIndex.appt_appointment)&&Zarafa.core.MessageClass.isClass(a.get("message_class"),["IPM.Schedule.Meeting"],!0)||(d=Zarafa.core.mapi.IconIndex.getClassName(b,"icon"));!Ext.isEmpty(d)&&c===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&Ext.isFunction(a.isMessageClass)&&a.isMessageClass("IPM.Task")&&a.isTaskOrganized()&&
"icon_task_assignee"===d&&(a.isTaskDeclined()?d="icon_task_declined":a.isTaskAccepted()&&(d="icon_task_assigner"));if(Ext.isEmpty(d))switch(c){case Zarafa.core.mapi.ObjectType.MAPI_STORE:case Zarafa.core.mapi.ObjectType.MAPI_FOLDER:d=this.getIconClassFromContainerClass(a);break;case Zarafa.core.mapi.ObjectType.MAPI_MESSAGE:d=this.getIconClassFromMessageClass(a);break;case Zarafa.core.mapi.ObjectType.MAPI_MAILUSER:case Zarafa.core.mapi.ObjectType.MAPI_DISTLIST:case Zarafa.core.mapi.ObjectType.MAPI_ABCONT:d=
this.getIconClassFromDisplayType(a);break;case Zarafa.core.mapi.ObjectType.MAPI_ATTACH:d=this.getIconClassFromAttachMethod(a);break;default:b=a.get("distlist_type"),Ext.isDefined(b)&&(d=this.getIconClassFromDistlistType(a))}c===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&(d=Ext.isFunction(a.isRead)&&!a.isRead()?d+" icon_message_unread":d+" icon_message_read",Ext.isFunction(a.isRecurring)&&a.isRecurring()&&(d+=" icon_message_recurring"));return d},getIconClassFromContainerClass:function(a,b){if(a){if(Ext.isFunction(a.isFavoritesFolder)&&
a.isFavoritesFolder())return a.isSearchFolder()?"icon_magnifier":"icon_folder_note";if(a.isIPMSubTree()){var c=a.getMAPIStore();return c.isSharedStore()?(c=c.get("folder_type"),"all"===c?"icon_folder_shared_store":"icon_folder_shared_"+c):c.isPublicStore()?"icon_folder_public_store":"icon_folder_store"}if(Ext.isFunction(a.isFavoritesFolder)&&a.isFavoritesRootFolder())return"icon_folder_favorites";if(c=a.getDefaultFolderKey())return"icon_folder_default_"+c.toLowerCase();b=b||a.get("container_class")}return Zarafa.core.ContainerClass.isClass(b,
"IPF.Note.OutlookHomepage",!0)?"icon_folder_rss":Zarafa.core.ContainerClass.isClass(b,"IPF",!0)?"icon_folder_"+b.toLowerCase().split(".")[1]:"icon_folder_note"},getIconClassFromMessageClass:function(a,b,c){var d=!1,e=!1,f=!1;if(a){if(a.get("stubbed"))return"icon_mail_stubbed";d=Ext.isFunction(a.isRecurring)&&a.isRecurring();e=a.get("counter_proposal");(b=b||a.get("message_class"))&&"IPM.TASK"===b.toUpperCase()&&!Ext.isEmpty(a.get("icon_index"))&&(f=a.isTaskOrganized()&&a.isTaskDeclined())}else if(Ext.isObject(c)){b=
b.toUpperCase();if("IPM.TASK"===b&&(a=Zarafa.core.mapi.IconIndex.getClassName(c.icon_index),!Ext.isEmpty(a)))return a;if("IPM.NOTE"===b&&Ext.isDefined(c.reminderRecord))return"icon_mail_read"}if(b){b=b.toUpperCase();c={"IPM.APPOINTMENT":"icon_appt_appointment","IPM.TASK":f?"icon_task_declined":"icon_task_normal","IPM.TASKREQUEST":"icon_task_request","IPM.TASKREQUEST.DECLINE":"icon_task_declined","IPM.TASKREQUEST.ACCEPT":"icon_task_accepted","IPM.STICKYNOTE":"icon_note_yellow","IPM.CONTACT":"icon_contact_user",
"IPM.DISTLIST":"icon_contact_distlist","IPM.DISTLIST.ORGANIZATION":"icon_contact_distlist_organization","IPM.SCHEDULE.MEETING.REQUEST":d?"icon_appt_meeting_recurring":"icon_appt_meeting_single","IPM.SCHEDULE.MEETING.RESP.POS":"icon_appt_meeting_accept","IPM.SCHEDULE.MEETING.RESP.TENT":e?"icon_appt_meeting_newtime":"icon_appt_meeting_tentative","IPM.SCHEDULE.MEETING.RESP.NEG":"icon_appt_meeting_decline","IPM.SCHEDULE.MEETING.CANCELED":"icon_appt_meeting_cancel","IPM.NOTE":"icon_mail","REPORT.IPM.NOTE.IPNRN":"icon_mail_read_receipt",
"REPORT.IPM.NOTE.IPNNRN":"icon_mail_nonread_receipt","REPORT.IPM.NOTE.DR":"icon_mail_delivery_receipt","REPORT.IPM.NOTE.NDR":"icon_mail_nondelivery_receipt","IPM.NOTE.STORAGEQUOTAWARNING":"icon_mail icon_message_unread"};do{d=c[b];if(!Ext.isEmpty(d))return d;d=b.lastIndexOf(".");if(0>=d)break;b=b.substr(0,d)}while(1)}return"icon_message"},getIconClassFromDistlistType:function(a,b){a&&(b=b||a.get("distlist_type"));switch(b){case Zarafa.core.mapi.DistlistType.DL_DIST:case Zarafa.core.mapi.DistlistType.DL_DIST_AB:return"icon_contact_distlist";
default:return"icon_contact_user"}},getIconClassFromDisplayType:function(a,b){a&&(Ext.isDefined(b)||(b=a.getDisplayType()));switch(b){case Zarafa.core.mapi.DisplayType.DT_ORGANIZATION:return"icon_contact_company";case Zarafa.core.mapi.DisplayType.DT_DISTLIST:case Zarafa.core.mapi.DisplayType.DT_PRIVATE_DISTLIST:case Zarafa.core.mapi.DisplayType.DT_AGENT:case Zarafa.core.mapi.DisplayTypeEx.DT_SEC_DISTLIST:return"icon_contact_distlist";case Zarafa.core.mapi.DisplayType.DT_REMOTE_MAILUSER:return"icon_contact_gab_user";
case Zarafa.core.mapi.DisplayTypeEx.DT_ROOM:return"icon_contact_room";case Zarafa.core.mapi.DisplayTypeEx.DT_EQUIPMENT:return"icon_contact_equipment";default:return"icon_contact_user"}},getIconClassFromAttachMethod:function(a){return a.isEmbeddedMessage()?"icon_embed_attachment":"icon_attachment"}};
Zarafa.common.ui.LoadMask=Ext.extend(Ext.LoadMask,{msg:_("Loading..."),isLoading:!1,failureMsg:_("Failed"),failureMsgCls:"x-mask-error",onLoad:function(a,b,c){(!c||c.actionType!==Zarafa.core.Actions.updatesearch&&c.actionType!==Zarafa.core.Actions.updatelist)&&Zarafa.common.ui.LoadMask.superclass.onLoad.apply(this,arguments)},onBeforeLoad:function(a,b){(!b||b.actionType!==Zarafa.core.Actions.updatesearch&&b.actionType!==Zarafa.core.Actions.updatelist)&&Zarafa.common.ui.LoadMask.superclass.onBeforeLoad.apply(this,
arguments)},showError:function(){this.el.unmask(!1);this.el.mask(this.failureMsg,this.failureMsgCls)}});Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.PagingToolbar=Ext.extend(Ext.PagingToolbar,{displayRefresh:!1,displayInfo:!1,initComponent:function(){this.cls="zarafa-paging-toolbar";var a=[this.first=new Ext.Toolbar.Button({tooltip:this.firstText,overflowText:this.firstText,iconCls:"x-tbar-page-first",disabled:!0,handler:this.moveFirst,scope:this}),this.prev=new Ext.Toolbar.Button({tooltip:this.prevText,overflowText:this.prevText,iconCls:"x-tbar-page-prev",disabled:!0,handler:this.movePrevious,scope:this}),this.beforePageText,
this.inputItem=new Ext.form.NumberField({cls:"x-tbar-page-number",allowDecimals:!1,allowNegative:!1,enableKeyEvents:!0,selectOnFocus:!0,submitValue:!1,listeners:{scope:this,keydown:this.onPagingKeyDown,blur:this.onPagingBlur}}),this.afterTextItem=new Ext.Toolbar.TextItem({text:String.format(this.afterPageText,1)}),this.next=new Ext.Toolbar.Button({tooltip:this.nextText,overflowText:this.nextText,cls:"x-btn-page-next",iconCls:"x-tbar-page-next",disabled:!0,handler:this.moveNext,scope:this}),this.last=
new Ext.Toolbar.Button({tooltip:this.lastText,overflowText:this.lastText,iconCls:"x-tbar-page-last",disabled:!0,handler:this.moveLast,scope:this})],b=this.items||this.buttons||[];this.items=this.prependButtons?b.concat(a):a.concat(b);delete this.buttons;this.displayRefresh&&(this.items.push("-"),this.items.push(this.refresh=new Ext.Toolbar.Button({tooltip:this.refreshText,overflowText:this.refreshText,iconCls:"x-tbar-loading",handler:this.doRefresh,scope:this})));this.displayInfo&&(this.items.push("->"),
this.items.push(this.displayItem=new Ext.Toolbar.TextItem({})));Ext.PagingToolbar.superclass.initComponent.call(this);this.addEvents("change","beforechange");this.on("afterlayout",this.onFirstLayout,this,{single:!0});this.cursor=0;this.bindStore(this.store,!0)},bindStore:function(a,b){Zarafa.common.ui.PagingToolbar.superclass.bindStore.apply(this,arguments);this.store?(this.mon(this.store,"search",function(){this.pageSize=container.getSettingsModel().get("zarafa/v1/main/page_size")},this),this.mon(this.store,
"beforeupdatesearch",this.updateInfo,this)):this.mun(this.store,"beforeupdatesearch",this.updateInfo,this)},updateInfo:function(){if(this.displayItem){var a=this.store.getCount(),a=0===a?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+a,this.store.getTotalCount());this.displayItem.setText(a)}},onLoad:function(a,b,c){this.rendered?(a=this.getParams(),this.cursor=c.params&&c.params.restriction&&c.params.restriction[a.restriction.start]?c.params.restriction[a.restriction.start]:
0,c=this.getPageData(),a=c.activePage,b=c.pages,this.afterTextItem.setText(String.format(this.afterPageText,c.pages)),this.inputItem.setValue(a),this.first.setDisabled(1==a),this.prev.setDisabled(1==a),this.next.setDisabled(a==b),this.last.setDisabled(a==b),this.refresh&&this.refresh.enable(),this.updateInfo(),this.fireEvent("change",this,c)):this.dsLoaded=[a,b,c]},onLoadError:function(){this.rendered&&this.refresh&&this.refresh.enable()},getParams:function(){var a=this.paramNames||this.store.paramNames;
Ext.isDefined(a.start)&&(a.restriction=a.restriction||{},a.restriction.start=a.start,delete a.start);Ext.isDefined(a.limit)&&(a.restriction=a.restriction||{},a.restriction.limit=a.limit,delete a.limit);return a},doLoad:function(a){var b={restriction:{}},c=this.getParams();b.restriction[c.restriction.start]=a;b.restriction[c.restriction.limit]=this.pageSize;!1!==this.fireEvent("beforechange",this,b)&&this.store.load({folder:this.store.lastOptions.folder,params:b})}});Ext.reg("zarafa.paging",Zarafa.common.ui.PagingToolbar);
Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.PreviewPanelToolbarButtons=Ext.extend(Object,{model:void 0,constructor:function(a){Ext.apply(this,a)},getToolbarButtons:function(a,b){var c=this.model;Ext.isDefined(b.model)&&b.model instanceof Zarafa.core.ContextModel&&(c=b.model);var d=[],d=[{xtype:"zarafa.toolbarbutton",tooltip:_("Delete")+" (DELETE)",overflowText:_("Delete"),iconCls:"icon_delete",nonEmptySelectOnly:!0,handler:this.onDelete,model:c},{xtype:"splitbutton",cls:"zarafa-more-options-btn",tooltip:_("More options"),overflowText:_("More options"),
iconCls:"icon_more",nonEmptySelectOnly:!0,model:c,splitOnMoreMenu:!0,menu:this.moreMenuButtons(c),handler:function(){this.showMenu()}}];Zarafa.supportsPopOut()&&d.push({xtype:"zarafa.toolbarbutton",tooltip:_("Open in new browser window"),overflowText:_("Pop-Out"),iconCls:"icon_popout",ref:"popoutBtn",nonEmptySelectOnly:!0,handler:this.onPopout,model:c});return d},moreMenuButtons:function(a){return{xtype:"zarafa.conditionalmenu",model:a,autoDestroy:!1,items:[{xtype:"zarafa.conditionalitem",text:_("Mark Read"),
iconCls:"icon_mail icon_message_read",model:a,readState:!1,beforeShow:this.onReadFlagItemBeforeShow,ref:"markRead",handler:this.onReadFlagMenuItemClicked},{xtype:"zarafa.conditionalitem",text:_("Mark Unread"),iconCls:"icon_mail icon_message_unread",model:a,readState:!0,ref:"markUnread",beforeShow:this.onReadFlagItemBeforeShow,handler:this.onReadFlagMenuItemClicked},{text:_("Copy/Move"),iconCls:"icon_copy",model:a,handler:this.onCopyMove},{text:_("Print"),iconCls:"icon_print",model:a,handler:this.onPrintButton},
{text:_("Edit as New Message"),iconCls:"icon_editAsNewEmail",ref:"editAsNew",model:a,handler:this.onEditAsNewMessage},{text:_("Download"),iconCls:"icon_saveaseml",ref:"download",model:a,handler:this.onDownloadMail}],listeners:{beforeshow:this.onBeforeShowMoreMenu,scope:this}}},onBeforeShowMoreMenu:function(a){var b=a.model.getPreviewRecord(),b=Zarafa.core.MessageClass.getDefaultFolderTypeFromMessageClass(b.get("message_class"));a.editAsNew.setVisible("inbox"===b);a.download.setVisible("inbox"===b)},
onReadFlagItemBeforeShow:function(a){var b=a.model.getPreviewRecord(),c=Zarafa.core.MessageClass.getDefaultFolderTypeFromMessageClass(b.get("message_class")),b=b.isRead()===a.readState;a.setVisible("inbox"===c&&b)},onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.model.getSelectedRecords())},onDelete:function(){Zarafa.common.Actions.deleteRecords(this.model.getSelectedRecords())},onPopout:function(){var a=this.model.getPreviewRecord(),b=container.getTabPanel(),c=b.getOpenedTab(a);
c&&b.getItem(c).close();Zarafa.common.Actions.openMessageContent(a,{layerType:"separateWindows"})},onEditAsNewMessage:function(){Zarafa.mail.Actions.openCreateMailResponseContent(this.model.getSelectedRecords(),this.model,Zarafa.mail.data.ActionTypes.EDIT_AS_NEW)},onDownloadMail:function(){Zarafa.common.Actions.openSaveEmlDialog(this.model.getPreviewRecord())},onPrintButton:function(){Zarafa.common.Actions.openPrintDialog(this.model.getPreviewRecord())},onReadFlagMenuItemClicked:function(a){var b=
this.model.getPreviewRecord();Zarafa.common.Actions.markAsRead(b,!a.readState);a.isXType("zarafa.conditionalitem")||a.parentMenu.hide(!0)}});Ext.ns("Zarafa.common.ui");
Zarafa.common.ui.SpinnerField=Ext.extend(Ext.form.TextField,{actionMode:"wrap",deferHeight:!0,autoSize:Ext.emptyFn,boxLabel:"",onBlur:function(){this.beforeBlur();this.focusClass&&this.el.removeClass(this.focusClass);this.hasFocus=!1;!1===this.validationEvent||!this.validateOnBlur&&"blur"!=this.validationEvent||(Ext.isDefined(this.plugins)?Ext.each(this.plugins,function(a){Ext.isFunction(a.validate)&&a.validate()},this):this.validate());var a=this.getValue();String(a)!==String(this.startValue)&&this.fireEvent("change",
this,a,this.startValue);this.fireEvent("blur",this);this.postBlur()},adjustSize:Ext.BoxComponent.prototype.adjustSize,defaultValue:void 0,minValue:void 0,maxValue:void 0,incrementValue:1,alternateIncrementValue:10,getResizeEl:function(){return this.resizeEl||this.wrap},getPositionEl:function(){return this.positionEl||this.wrap},alignErrorIcon:function(){this.wrap&&this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0])},validateBlur:function(){return!0}});Ext.reg("zarafa.spinnerfield",Zarafa.common.ui.SpinnerField);
Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.TreeGrid=Ext.extend(Ext.ux.tree.TreeGrid,{autoFill:!1,forceFit:!1,unselectable:!0,initComponent:function(){!0===this.rootVisible&&(this.root?(this.root.attributes.uiProvider=Ext.ux.tree.TreeGridNodeUI,this.root.ui=new this.root.attributes.uiProvider(this.root)):this.root=new Ext.tree.AsyncTreeNode({text:_("Root"),uiProvider:Ext.ux.tree.TreeGridNodeUI}));Zarafa.common.ui.TreeGrid.superclass.initComponent.call(this)},onRender:function(){Zarafa.common.ui.TreeGrid.superclass.onRender.apply(this,arguments);
(this.autoFill||this.forceFit)&&this.autoFitColumns(!0);this.unselectable&&this.getEl().unselectable()},getScrollOffset:function(){return Ext.num(this.scrollOffset,Ext.getScrollBarWidth())},autoFitColumns:function(a,b){for(var c=this.innerBody.getWidth()-this.getScrollOffset(),d=[],e=0,f=this.columns.length;e<f;e++){var g=this.columns[e];g.hidden||(c-=g.width,g.fixed||e===b||a&&g.width||d.push(g))}c=Math.floor(c/d.length);e=0;for(f=d.length;e<f;e++)d[e].width+=c},updateColumnWidths:function(){this.forceFit&&
this.autoFitColumns(!1,this.colResizer.hdIndex);Zarafa.common.ui.TreeGrid.superclass.updateColumnWidths.call(this)}});Ext.reg("zarafa.treegrid",Zarafa.common.ui.TreeGrid);Ext.namespace("Zarafa.common.ui.appointmentpanel");
Zarafa.common.ui.appointmentpanel.AppointmentBody=Ext.extend(Ext.form.FormPanel,{headerTemplate:'<div class="preview-header-titlebox"><tpl if="!Ext.isEmpty(values.subject)"><span class="preview-title">{subject:htmlEncode}</span></tpl></div>',constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.appointmentbody",border:!1,header:!0,autoScroll:!0,unstyled:!0,autoWidth:!0,headerCfg:{cls:"preview-header-title"},
items:[{xtype:"fieldset",title:_("Appointment"),defaults:{xtype:"displayfield"},items:[{fieldLabel:_("Subject"),name:"subject"},{fieldLabel:_("Location"),name:"location"},{fieldLabel:_("Label"),ref:"../labelPreview"},{fieldLabel:_("Start Date"),ref:"../startDate"},{fieldLabel:_("End Date"),ref:"../endDate"},{fieldLabel:_("All Day Event"),name:"alldayevent"}]}]});Zarafa.common.ui.appointmentpanel.AppointmentBody.superclass.constructor.call(this,a);Ext.isString(this.headerTemplate)&&(this.headerTemplate=
new Ext.XTemplate(this.headerTemplate,{compiled:!0}))},update:function(a){this.record=a;this.getForm().loadRecord(a);Ext.isDefined(a)?this.headerTemplate.overwrite(this.header.dom,a.data):this.header.dom.innerHTML="";this.labelPreview.setValue(Zarafa.core.mapi.AppointmentLabels.getDisplayName(a.get("label")));var b=a.get("startdate");Ext.isDate(b)&&(b=b.toUTC(),this.startDate.setValue(b));a=a.get("duedate");Ext.isDate(a)&&(a=a.toUTC(),this.endDate.setValue(a))}});
Ext.reg("zarafa.appointmentbody",Zarafa.common.ui.appointmentpanel.AppointmentBody);Ext.namespace("Zarafa.common.ui.contactpanel");
Zarafa.common.ui.contactpanel.ContactBody=Ext.extend(Ext.form.FormPanel,{headerTemplate:'<div class="preview-header-titlebox"><tpl if="!Ext.isEmpty(values.subject)"><span class="preview-title">{subject:htmlEncode}</span></tpl></div>',constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.contactbody",border:!1,header:!0,autoScroll:!0,unstyled:!0,autoWidth:!0,headerCfg:{cls:"preview-header-title"},items:[{xtype:"fieldset",
title:_("Name"),defaults:{xtype:"displayfield"},items:[{fieldLabel:_("Full name"),name:"display_name"},{fieldLabel:_("Company"),name:"company_name"},{fieldLabel:_("Job Title"),name:"title"},{fieldLabel:_("File as"),name:"fileas"}]},{xtype:"fieldset",title:_("Phone Numbers"),defaults:{xtype:"displayfield"},items:[{fieldLabel:_("Business"),name:"business_telephone_number"},{fieldLabel:_("Home"),name:"home_telephone_number"},{fieldLabel:_("Business Fax"),name:"business_fax_number"},{fieldLabel:_("Mobile"),
name:"cellular_telephone_number"}]},{xtype:"fieldset",title:_("Email"),defaults:{xtype:"displayfield"},items:[{fieldLabel:_("Email"),name:"email_address_1"},{fieldLabel:_("Display name"),name:"email_address_display_name_1"},{fieldLabel:_("Webpage"),name:"webpage"},{fieldLabel:_("IM Address"),name:"im"}]},{xtype:"fieldset",title:_("Address"),defaults:{xtype:"displayfield"},items:[{fieldLabel:_("Business"),name:"business_address"}]}]});Zarafa.common.ui.contactpanel.ContactBody.superclass.constructor.call(this,
a);Ext.isString(this.headerTemplate)&&(this.headerTemplate=new Ext.XTemplate(this.headerTemplate,{compiled:!0}))},update:function(a){this.record=a;this.getForm().loadRecord(a);Ext.isDefined(a)?this.headerTemplate.overwrite(this.header.dom,a.data):this.header.dom.innerHTML=""}});Ext.reg("zarafa.contactbody",Zarafa.common.ui.contactpanel.ContactBody);Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.ColumnModel=Ext.extend(Ext.grid.ColumnModel,{name:"default",constructor:function(a){a=a||{};this.addEvents("beforeconfigchange");Ext.apply(this,a);Zarafa.common.ui.grid.ColumnModel.superclass.constructor.call(this,a)},setConfig:function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)c.push(Ext.apply({},a[d]));!1!==this.fireEvent("beforeconfigchange",this,c)&&Zarafa.common.ui.grid.ColumnModel.superclass.setConfig.call(this,c,b)},setState:function(a,b){var c=this.getColumnAt(a);!0===
c.fixed&&(b.width=c.width);Zarafa.common.ui.grid.ColumnModel.superclass.setState.apply(this,arguments);this.totalWidth=null}});Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.DateTooltip=Ext.extend(Ext.ToolTip,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.griddatetooltip",cls:"k-griddatetooltip",delegate:".k-date-nice",dismissDelay:0,trackMouse:!0,renderTo:Ext.getBody(),listeners:{beforeshow:this.onBeforeshow,scope:this}});Zarafa.common.ui.grid.DateTooltip.superclass.constructor.call(this,a)},onBeforeshow:function(a){var b;a.anchorTarget.classList.forEach(function(a){"k-ts-"===a.substr(0,5)&&(b=parseInt(a.substr(5)))});var c=(new Date(b)).format(_("D, d-m-Y, G:i"));
a.body.dom.innerHTML=Ext.util.Format.htmlEncode(c)}});Ext.reg("zarafa.griddatetooltip",Zarafa.common.ui.grid.DateTooltip);Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.GridDragZone=Ext.extend(Ext.grid.GridDragZone,{getDragData:function(a){var b=Ext.lib.Event.getTarget(a),b=this.view.findRowIndex(b);if(!1!==b){var c=this.grid.selModel;a=new Ext.EventObjectImpl(a);return{grid:this.grid,ddel:this.ddel,rowIndex:b,selections:c.getSelections(),origEvent:a}}return!1},onInitDrag:function(a,b){var c=this.dragData;if(c&&c.origEvent){var d=this.grid.selModel;d.isSelected(c.rowIndex)||(d.handleMouseDown(this.grid,c.rowIndex,c.origEvent),c.selections=d.getSelections());
delete this.dragData.origEvent}Zarafa.common.ui.grid.GridDragZone.superclass.onInitDrag.apply(this,arguments)},onMouseUp:function(a){var b=this.dragData;b&&b.origEvent&&(b.grid.selModel.handleMouseDown(b.grid,b.rowIndex,b.origEvent),delete b.origEvent);Zarafa.common.ui.grid.GridDragZone.superclass.onMouseUp.apply(this,arguments)}});Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.GridPanel=Ext.extend(Ext.grid.GridPanel,{currentEntryId:void 0,currentStoreEntryId:void 0,dateTooltip:null,constructor:function(a){a=a||{};Ext.applyIf(a,{deferRowRender:!1});Ext.isEmpty(a.view)&&(a.viewConfig=Ext.applyIf(a.viewConfig||{},{autoFill:!0,markDirty:!1}),Ext.applyIf(a,{view:new Zarafa.common.ui.grid.GridView(a.viewConfig)}));Zarafa.common.ui.grid.GridPanel.superclass.constructor.call(this,a)},afterRender:function(){Zarafa.common.ui.grid.GridPanel.superclass.afterRender.apply(this,
arguments);var a=this.getXTypes(),a=a.replace("component/box/container/panel/grid/zarafa.gridpanel",""),a=a.replace(/\/zarafa\./g,"."),a="grid"+a.replace(/grid/g,"");Zarafa.core.KeyMapMgr.activate(this,a);this.dateTooltip=new Zarafa.common.ui.grid.DateTooltip({target:this.getEl().dom})},onDestroy:function(){Zarafa.common.ui.grid.GridPanel.superclass.onDestroy.apply(this,arguments);this.dateTooltip&&this.dateTooltip.destroy()},initEvents:function(){this.bindColumnModel(this.getColumnModel(),!0);this.bindStore(this.getStore(),
!0);Zarafa.common.ui.grid.GridPanel.superclass.initEvents.call(this);this.loadMask&&(this.loadMask.destroy(),this.loadMask=new Zarafa.common.ui.LoadMask(this.bwrap,Ext.apply({store:this.store},this.initialConfig.loadMask)));this.store.on("write",this.onWriteRecord,this);this.on("viewready",this.onViewReady,this);this.model&&this.model.statefulRecordSelection&&this.mon(this.model,"recordselectionchange",this.onRecordSelectionChange,this);this.mon(this.getSelectionModel(),"selectionchange",this.onGridSelectionChange,
this)},onRecordSelectionChange:function(a,b){if(!this.getSelectionModel().hasSelection()&&!Ext.isEmpty(b)){var c=a.getStore().indexOf(b[0]);this.getSelectionModel().selectRecords(b);this.getView().focusRow(c)}},onWriteRecord:function(a,b,c,d,e){"destroy"!==b||a.syncStore||(b=this.getView().scroller,Ext.isDefined(b)&&!b.isScrollable()&&a.totalLoadedRecord<a.totalLength&&(b={add:!0,actionType:Zarafa.core.Actions.list},Ext.applyIf(b,a.lastOptions),c=container.getSettingsModel().get("zarafa/v1/main/page_size"),
b.params.restriction.limit=c-a.getCount(),b.params.restriction.start=a.getCount(),a.syncStore=!0,a.loadMask&&(a.loadMask.hide(),a.loadMask=void 0),a.load(b)))},reconfigure:function(a,b){this.bindColumnModel(b);this.bindStore(a);Zarafa.common.ui.grid.GridPanel.superclass.reconfigure.call(this,a,b)},bindColumnModel:function(a,b){var c=this.getColumnModel();if(!0===b||c!==a)c&&(this.mun(c,"beforeconfigchange",this.onBeforeConfigChange,this),this.mun(c,"configchange",this.onConfigChange,this)),a&&(this.mon(a,
"beforeconfigchange",this.onBeforeConfigChange,this),this.mon(a,"configchange",this.onConfigChange,this))},bindStore:function(a,b){var c=this.getStore();if(!0===b||c!==a)if(c&&(this.mun(c,"beforeload",this.onStoreBeforeLoad,this),this.mun(c,"load",this.onStoreLoad,this)),a&&(this.mon(a,"beforeload",this.onStoreBeforeLoad,this),this.mon(a,"load",this.onStoreLoad,this),a.lastOptions))this.onStoreBeforeLoad(a,a.lastOptions)},onViewReady:function(){var a=this.store&&(!0===this.store.isExecuting(Zarafa.core.Actions.list)||
!0===this.store.isExecuting(Zarafa.core.Actions.search));this.loadMask&&a&&this.loadMask.show()},onStoreBeforeLoad:function(a,b){if(b&&b.actionType===Zarafa.core.Actions.updatelist)this.isLoading||(this.getView().showGridRowLoadMask(this.loadMask.msg),this.isLoading=!0);else if(Ext.isEmpty(a)||!0!==a.hasSearchResults){var c=this.getColumnModel(),d=b.folder,e,f;Ext.isEmpty(d)||(Array.isArray(d)?(e=d[0].get("entryid"),f=d[0].get("store_entryid")):(e=d.get("entryid"),f=d.get("store_entryid")));this.currentEntryId!==
e&&(this.currentEntryId=e,this.currentStoreEntryId=f,c.setConfig(c.columns,!1))}},onStoreLoad:function(a,b,c){c&&c.actionType===Zarafa.core.Actions.updatelist&&this.isLoading&&(this.getView().removeGridRowLoadMask(),this.isLoading=!1)},onBeforeConfigChange:Ext.emptyFn,onConfigChange:Ext.emptyFn,onGridSelectionChange:function(a){for(var b=this.getView(),c=this.getStore(),d=0;d<c.getCount();d++)b.removeRowClass(d,"zarafa-multiselection");a=a.getSelections();1<a.length&&Ext.each(a,function(a){b.addRowClass(c.indexOf(a),
"zarafa-multiselection")},this)},getDragDropText:function(){var a=this.selModel.getCount();return String.format(ngettext("{0} selected row","{0} selected rows",a),a)},getStateName:function(){var a=this.store.lastOptions,b;a&&a.folder&&(b=a.folder,Array.isArray(b)&&(b=b[0]));return container.getHierarchyStore().getStateName(b,"list")},getState:function(){var a=Zarafa.common.ui.grid.GridPanel.superclass.getState.call(this),b={sort:a.sort};delete a.sort;b[this.getColumnModel().name]=a;return b},applyState:function(a){if(a){var b=
{sort:a.sort};delete a.sort;Ext.apply(b,a[this.getColumnModel().name]);Zarafa.common.ui.grid.GridPanel.superclass.applyState.call(this,b)}}});Ext.reg("zarafa.gridpanel",Zarafa.common.ui.grid.GridPanel);Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.GridView=Ext.extend(Ext.grid.GroupingView,{disableScrollToTop:void 0,isBuffering:!1,enableGrouping:!1,constructor:function(a){Ext.applyIf(a,{enableGroupingMenu:!1,groupTextTpl:"{text:htmlEncode}",disableScrollToTop:!1,deferEmptyText:!0,emptyText:'<div class="emptytext">'+_("There are no items to show in this list")+"</div>",forceFit:!0,autoFill:!0,showGroupName:!1});this.addEvents("beforelivescrollstart","livescrollstart","beforesort");Zarafa.common.ui.grid.GridView.superclass.constructor.call(this,
a);this.initEvents()},initEvents:function(){Zarafa.common.ui.grid.GridView.superclass.initEvents.call(this);this.on("rowremoved",this.onRowRemoved,this)},initData:function(a,b){this.ds&&this.ds.un("exception",this.onException,this);Zarafa.common.ui.grid.GridView.superclass.initData.apply(this,arguments);if(this.ds)this.ds.on("exception",this.onException,this)},onException:function(a,b,c,d,e,f){d&&"list"===d.actionType&&this.mainBody.update('<div class="x-grid-empty"><div class="emptytext">'+e.error.info.display_message+
"</div></div>")},onLoad:function(a,b,c){!Ext.isDefined(c.reload)&&!0!==this.disableScrollToTop&&Ext.isDefined(this.scroller.dom)&&"list"==c.actionType&&Zarafa.common.ui.grid.GridView.superclass.onLoad.apply(this,arguments)},onDataChange:function(){Zarafa.common.ui.grid.GridView.superclass.onDataChange.apply(this,arguments);this.applyEmptyText()},applyEmptyText:function(){this.grid.store.isExecuting(Zarafa.core.Actions.list)||Zarafa.common.ui.grid.GridView.superclass.applyEmptyText.call(this)},afterRenderUI:function(){Ext.grid.GroupingView.superclass.afterRenderUI.call(this);
this.enableGroupingMenu&&this.hmenu&&(this.enableNoGroups&&this.hmenu.add({itemId:"sortSepOne",xtype:"menuseparator"},{itemId:"showGroups",text:this.showGroupsText,checked:!0,cls:"showGroups",iconCls:this.enableGrouping?"":"k-hide-img",checkHandler:this.onShowGroupsClick,scope:this}),this.hmenu.on("beforeshow",this.beforeMenuShow,this));this.dragZone&&(this.dragZone.destroy(),this.dragZone=new Zarafa.common.ui.grid.GridDragZone(this.grid,{ddGroup:this.grid.ddGroup||"GridDD"}))},onScroll:function(a,
b,c){!1!==this.fireEvent("beforelivescrollstart",this,b)&&.9*(Ext.isDefined(b.scrollTopMax)?b.scrollTopMax:b.scrollHeight-b.offsetHeight)<b.scrollTop&&!this.isBuffering&&(a=this.ds.getCount(),a!==this.ds.totalLength&&this.fireEvent("livescrollstart",a))},resetScroll:function(){0<this.getScrollState().top&&(this.scrollToTop(),this.focusRow(1))},afterRender:function(){Zarafa.common.ui.grid.GridView.superclass.afterRender.apply(this,arguments);var a=this.grid.store;!1===this.deferEmptyText&&a&&(a.lastOptions&&
Ext.isEmpty(Object.keys(a.lastOptions))||this.applyEmptyText());this.scroller.on("scroll",this.onScroll,this)},onRowRemoved:function(a,b,c){a=this.grid.getSelectionModel();c=this.grid.store.getCount();0<c?b<c?a.selectRow(b):a.selectRow(b-1):(a.clearSelections(),a.fireEvent("selectionchange",a))},onHeaderClick:function(a,b){var c=a.getStore();if(this.enableGrouping){this.hdCtxIndex=b;var d=a.colModel.getColumnAt(b).dataIndex;this.isAllowGrouping(d)?(c.remoteGroup=!1,c.remoteSort=!1,this.applyGrouping(),
c.remoteGroup=!0,c.remoteSort=!0):this.clearGrouping()}!1!==this.fireEvent("beforesort",this)&&Zarafa.common.ui.grid.GridView.superclass.onHeaderClick.apply(this,arguments)},isAllowGrouping:function(a){var b=["message_size"];return this.grid.getStore().defaultSortInfo.field!=a&&-1===b.indexOf(a)?!1:!0},handleHdMenuClick:function(a){!1!==this.fireEvent("beforesort",this)&&Zarafa.common.ui.grid.GridView.superclass.handleHdMenuClick.apply(this,arguments)},showGridRowLoadMask:function(a){this.isBuffering=
!0;var b=this.getRow(1).offsetHeight,b={styles:"width :"+this.getTotalWidth()+"px; height :"+b+"px"},b=(new Ext.Template('<div  id="dummy-row" style = "{styles}"> </div>')).apply(b),b=Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,b);Ext.get(b).mask(a,"x-mask-loading x-mask-loading-row");Ext.get(b).child(".ext-el-mask",!0).className+="x-mask-row"},removeGridRowLoadMask:function(){var a=Ext.query("div#dummy-row",this.mainBody.dom)[0];Ext.isDefined(a)&&Ext.get(a).remove();this.isBuffering=!1},
onShowGroupsClick:function(a,b){if(!this.isAllowGrouping(this.cm.getDataIndex(this.hdCtxIndex)))return!0;b&&this.enableGrouping&&(b=!1);Zarafa.common.ui.grid.GridView.superclass.onShowGroupsClick.apply(this,arguments);var c=a.el.child("img");b?(c.addClass("x-menu-item-icon"),c.removeClass("k-hide-img")):c.removeClass("x-menu-item-icon");container.getSettingsModel().set("zarafa/v1/contexts/mail/enable_grouping",b)},onGroupByClick:function(){this.applyGrouping();this.beforeMenuShow()},applyGrouping:function(){var a=
this.grid;this.enableGrouping=!0;var b=a.getStore(),c=this.cm.getDataIndex(this.hdCtxIndex),c=this.isAllowGrouping(c)?c:b.defaultSortInfo.field;b.sortInfo.field=c;var d=b.sortToggle[c];b.sortInfo.direction=Ext.isDefined(d)?d:"DESC";b.groupField=c;b.applyGrouping();a.fireEvent("groupchange",a,b.getGroupState());this.refresh()},clearGrouping:function(){var a=this.grid.getStore();a.remoteGroup=!1;a.remoteSort=!1;a.clearGrouping();a.remoteGroup=!0;a.remoteSort=!0;this.grid.fireEvent("groupchange",this,
null)},toggleGroup:Ext.emptyFn});Ext.reg("zarafa.gridview",Zarafa.common.ui.grid.GridView);Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.Renderers={importance:function(a,b,c){0<=a&&(b.css=Zarafa.core.mapi.Importance.getClassName(a));b.css+=" zarafa-grid-empty-cell";return""},icon:function(a,b,c){b.css=Zarafa.common.ui.IconClass.getIconClass(c);b.css+=" zarafa-grid-empty-cell";return""},attachment:function(a,b,c){if(Ext.isDefined(c)&&!0===c.get("hide_attachments"))return"";b.css=!0===a?"icon_attachment":"icon_noattachment";b.css+=" zarafa-grid-empty-cell";return""},recurrence:function(a,b,c){b.css=a?"icon_recurring":
"zarafa-grid-empty-cell";return""},reminder:function(a,b,c){b.css=a?"icon_reminder":"zarafa-grid-empty-cell";Ext.isDefined(c)&&!Ext.isEmpty(c.get("reminder_time"))&&(a=c.get("reminder_time"),a=String.format(_("Reminder is set on: {0}, {1}"),a.format(_("d-m-Y")),a.format(_("G:i"))),b.attr='ext:qtip="'+Ext.util.Format.htmlEncode(a)+'"');return""},categories:function(a,b,c){a=Zarafa.common.categories.Util.getCategories(c);return Zarafa.common.categories.Util.getCategoriesHtml(a)},name:function(a,b,c){b.css=
"mail_from";Ext.isEmpty(a)&&(b.css+=" zarafa-grid-empty-cell");return Ext.util.Format.htmlEncode(a)},displayName:function(a,b,c){a=Zarafa.common.ui.grid.Renderers.name(a,b,c);return Zarafa.common.ui.grid.Renderers.presenceStatus(a,b,c)},sender:function(a,b,c){var d=!1;a=c.get("sent_representing_name");Ext.isEmpty(a)&&Ext.isFunction(Ext.isFunction(c.getSender))?(a=c.get("sender_name"),d=c.getSender()):Ext.isFunction(c.getSentRepresenting)&&(d=c.getSentRepresenting());a=Zarafa.common.ui.grid.Renderers.name(a,
b,c);return Zarafa.common.ui.grid.Renderers.presenceStatus(a,b,d)},organizer:function(a,b,c){if(Ext.isDefined(c.isMeeting)&&c.isMeeting())return Zarafa.common.ui.grid.Renderers.sender(a,b,c);b.css+=" zarafa-grid-empty-cell";return""},subject:function(a,b,c){b.css="mail_subject";Ext.isEmpty(a)&&(b.css+=" zarafa-grid-empty-cell");return Ext.util.Format.htmlEncode(a)},text:function(a,b,c){Ext.isEmpty(a)&&(b.css="zarafa-grid-empty-cell");return Ext.util.Format.htmlEncode(a)},to:function(a,b,c){b.css=
"mail_to";Ext.isEmpty(a)&&(b.css+=" zarafa-grid-empty-cell");return Ext.util.Format.htmlEncode(a)},size:function(a,b,c){b.css="mail_size";Ext.isEmpty(a)&&(b.css+=" zarafa-grid-empty-cell");return Ext.util.Format.fileSize(a)},percentage:function(a,b,c){b.css="task_percentage";return isNaN(a)?c.get("flag_status")===Zarafa.core.mapi.FlagStatus.completed?Ext.util.Format.percentage(1):"":Ext.util.Format.percentage(a)},date:function(a,b){b.css="mail_date";return Ext.isDate(a)?"short"===container.getSettingsModel().get("zarafa/v1/main/datetime_display_format")?
a.getNiceFormat(!1):a.format(_("l d/m/Y")):_("None")},utcdate:function(a,b){Ext.isDate(a)&&(a=a.toUTC());return this.date(a,b)},datetime:function(a,b,c,d,e,f,g){b.css="mail_date";g&&g.css&&(b.css+=" "+g.css);return Ext.isDate(a)?"short"===container.getSettingsModel().get("zarafa/v1/main/datetime_display_format")?(b.css+=" k-date-nice k-ts-"+a.getTime(),a.getNiceFormat()):a.format(_("l d/m/Y G:i")):_("None")},dateWithTime:function(a,b){b.css="";return Ext.isDate(a)?"short"===container.getSettingsModel().get("zarafa/v1/main/datetime_display_format")?
(b.css+=" k-date-nice k-ts-"+a.getTime(),a.format(_("d-m-Y G:i"))):a.format(_("l d/m/Y G:i")):_("None")},duration:function(a,b,c){b.css="mail_duration";return a?Ext.util.Format.duration(a,1):""},durationHours:function(a,b,c){b.css="mail_duration";return Ext.isDefined(a)?String.format(ngettext("{0} hour","{0} hours",a),a):""},folder:function(a,b,c){return(a=container.getHierarchyStore().getFolder(a))?a.get("display_name"):_("Unknown")},busystatus:function(a,b,c){return Zarafa.core.mapi.BusyStatus.getDisplayName(a)},
label:function(a,b,c){return Zarafa.core.mapi.AppointmentLabels.getDisplayName(a)},sensitivity:function(a,b,c){return Zarafa.core.mapi.Sensitivity.getDisplayName(a)},meetingstatus:function(a,b,c){return Zarafa.core.mapi.MeetingStatus.getDisplayName(a)},recipienttype:function(a,b,c){switch(a){case Zarafa.core.mapi.RecipientType.MAPI_TO:case Zarafa.core.mapi.RecipientType.MAPI_ORIG:return c.isMeetingOrganizer()?_("Meeting Organizer"):_("Required Attendee");case Zarafa.core.mapi.RecipientType.MAPI_BCC:return _("Resource");
default:return _("Optional Attendee")}},responsestatus:function(a,b,c){return Zarafa.core.mapi.ResponseStatus.getDisplayName(a)},flag:function(a,b,c){a=c.get("flag_status");b.css+="zarafa-grid-empty-cell";if(a===Zarafa.core.mapi.FlagStatus.completed)return b.css+=" icon_flag_complete","";if(!c.isMessageClass("IPM.Task")&&a!==Zarafa.core.mapi.FlagStatus.flagged)return b.css+=" icon_flag",'<div class="k-followup-flag"></div>';c=c.get("duedate");if(!c)return b.css+=" icon_flag_red","";c.setToNoon();
a=c.getTime();var d=(new Date).setToNoon(),e=d.getTime();if(a<=e)return b.css+=" icon_flag_red","";if(864E5===a-e)return b.css+=" icon_flag_orange_dark","";if(c.inSameWeekAs(d))return b.css+=" icon_flag_orange","";if(d.inNextWeek(c))return b.css+=" icon_flag_yellow","";b.css+=" icon_flag_red";return""},dueBy:function(a,b,c){b="";Zarafa.core.MessageClass.isClass(c.get("message_class"),"IPM.Task",!0)&&(a=c.get("task_duedate"));if(!Ext.isDate(a))return b;a=a.getTime();c=(new Date).getTime();b=Math.floor(Math.abs(a-
c)/6E4);if(0===b)return _("Now");b=Ext.util.Format.duration(b);return 0>a-c?String.format(_("{0} overdue"),b):b},taskstatus:function(a,b,c){return Zarafa.core.mapi.TaskStatus.getDisplayName(a)},colorTextValue:function(a,b,c){return Zarafa.core.mapi.NoteColor.getColorText(a)},presenceStatus:function(a,b,c){b=Zarafa.core.data.PresenceStatus.UNKNOWN;!1!==c&&(c=Zarafa.core.data.UserIdObjectFactory.createFromRecord(c),b=Zarafa.core.PresenceManager.getPresenceStatusForUser(c));return'<span class="zarafa-presence-status '+
Zarafa.core.data.PresenceStatus.getCssClass(b)+'"><span class="zarafa-presence-status-icon"></span>'+Ext.util.Format.htmlEncode(a)+"</span>"}};Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.RowSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{constructor:function(a){Zarafa.common.ui.grid.RowSelectionModel.superclass.constructor.call(this,a);this.selections=new Ext.util.MixedCollection(!1,function(a){var b=a.store;return b&&Ext.isFunction(b.getRecordKey)?b.getRecordKey(a):a.id})},clearSelections:function(a){if(!this.isLocked()){if(!0!==a){var b=this.grid.getStore();a=this.selections;a.each(function(a){a=Ext.isFunction(b.getRecordKey)&&b.getRecordKey(a)||a.id;
this.deselectRow(b.indexOfId(a))},this);a.clear()}else this.selections.clear();this.last=!1}},isSelected:function(a){var b=this.grid.getStore();a=Ext.isNumber(a)?b.getAt(a):a;b=Ext.isFunction(b.getRecordKey)&&b.getRecordKey(a)||a.id;return a&&this.selections.key(b)?!0:!1}});Ext.namespace("Zarafa.common.ui.htmleditor");
Zarafa.common.ui.htmleditor.Fonts=function(){return{getFonts:function(){return{1:8,"1.1":9,2:10,"2.1":11,3:12,4:14,5:18,6:24,7:36}},getFontSizeString:function(){var a=this.getFonts(),b=Object.keys(a).sort(),c="";Ext.each(b,function(b){c+=a[b]+"pt "});return c.trim()},getFontFamilies:function(){return"Arial=arial,helvetica,sans-serif;Courier New=courier new,courier;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times;Verdana=verdana,geneva"},getDefaultFontSize:function(){var a=
this.getFonts(),b=container.getSettingsModel().get("zarafa/v1/main/default_font_size");return a[b]+"pt"}}}();Ext.namespace("Zarafa.common.ui.htmleditor");
Zarafa.common.ui.htmleditor.LanguageMap={fileMapping:{bg_BG:"bg_BG",cs_CZ:"cs_CZ",da_DK:"da",de_DE:"de",el_GR:"el",en_GB:"en_GB",en_US:"",es_CA:"ca",et_EE:"et",fa_IR:"fa_IR",fi_FI:"fi",fr_FR:"fr_FR",he_IL:"he_IL",hr_HR:"hr",hu_HU:"hu_HU",it_IT:"it",ja_JP:"ja",ko_KR:"ko_KR",lt_LT:"lt",nb_NO:"nb_NO",nl_NL:"nl",pl_PL:"pl",pt_BR:"pt_BR",pt_PT:"pt_PT",ru_RU:"ru_RU",sl_SL:"sl_SL",sv_SE:"sv_SE",tr_TR:"tr_TR",uk_UA:"uk_UA",zh_CN:"zh_CN",zh_TW:"zh_TW"},getTinyLanguageCode:function(a){0<=a.indexOf(".UTF-8")&&
(a=a.replace(".UTF-8",""));return this.fileMapping[a]?this.fileMapping[a]:"en_GB"}};Ext.namespace("Zarafa.common.ui.layout");
Zarafa.common.ui.layout.CollapsibleLayout=Ext.extend(Ext.layout.FitLayout,{resizeItem:void 0,configureItem:function(a){var b=this.container.items.indexOf(a);2>b&&(a.collapsible?(this.activeItem=a,a.on("collapse",this.onCollapseState,this),a.on("expand",this.onCollapseState,this)):this.resizeItem=a);Zarafa.common.ui.layout.CollapsibleLayout.superclass.configureItem.call(this,a,b)},onRemove:function(a){a.collapsible&&(a.un("collapse",this.onCollapseState,this),a.un("expand",this.onCollapseState,this));
a===this.activeItem&&delete this.activeItem;a===this.resizeItem&&delete this.resizeItem;Zarafa.common.ui.layout.CollapsibleLayout.superclass.onRemove.call(this,a)},doResizeItem:function(){if(this.resizeItem&&this.activeItem){var a=this.container.getInnerHeight?this.container.getInnerHeight():this.container.getHeight(),b=this.activeItem.getHeight();this.resizeItem.setHeight(a-b)}},onCollapseState:function(a){this.doResizeItem()},onLayout:function(a,b){Zarafa.common.ui.layout.CollapsibleLayout.superclass.onLayout.call(this,
a,b);this.doResizeItem()}});Ext.Container.LAYOUTS["zarafa.collapsible"]=Zarafa.common.ui.layout.CollapsibleLayout;Ext.namespace("Zarafa.common.ui.layout");
Zarafa.common.ui.layout.SwitchBorderLayout=Ext.extend(Ext.layout.BorderLayout,{horizontalRegion:void 0,verticalRegion:void 0,switchMap:{north:"west",west:"north",south:"east",east:"south"},orientation:void 0,onLayout:function(a,b){if(this.rendered)Zarafa.common.ui.layout.SwitchBorderLayout.superclass.onLayout.apply(this,arguments);else{var c=[],d,e,f,g=a.items.items,h=g.length;for(d=0;d<h;d++)if(e=g[d],f=e.region,e.collapsed&&c.push(e),e.collapsed=!1,e.rendered||(e.render(b,d),e.getPositionEl().addClass("x-border-panel")),
this[f]="center"!=f&&e.split?new Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion(this,e.initialConfig,f):new Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion(this,e.initialConfig,f),this[f].render(b,e),"center"!=f){var k=this.switchMap[f];this[k]=this[f].split?new Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion(this,e.initialConfig,k):new Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion(this,e.initialConfig,k);this[k].render(b,e,!0);"north"===f||"south"===f?
(this.horizontalRegion=k,this.verticalRegion=f):(this.horizontalRegion=f,this.verticalRegion=k)}this.rendered=!0;c=this.orientation;delete this.orientation;this.setOrientation(c)}},setOrientation:function(a){if(this.orientation!==a&&(this.orientation=a,this.rendered)){var b=this[this.horizontalRegion],c=this[this.verticalRegion];switch(a){case Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.OFF:b.split&&b.splitEl.setVisible(!1);c.split&&c.splitEl.setVisible(!1);b.setVisible(!1);c.setVisible(!1);
b.panel.collapse(!1);break;default:c.panel.expand(!1);b.setVisible(!0);c.setVisible(!1);b.split&&b.splitEl.setVisible(!0);c.split&&c.splitEl.setVisible(!1);break;case Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.VERTICAL:b.panel.expand(!1),b.setVisible(!1),c.setVisible(!0),b.split&&b.splitEl.setVisible(!1),c.split&&c.splitEl.setVisible(!0)}this.container.doLayout()}}});Ext.Container.LAYOUTS["zarafa.switchborder"]=Zarafa.common.ui.layout.SwitchBorderLayout;Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.AttachmentLinks=Ext.extend(Ext.DataView,{ellipsisStringStartLength:20,ellipsisStringEndLength:20,maxHeight:50,fieldLabel:pgettext("mail.previewpanel","Attachments"),constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.attachmentlinks",plugins:["zarafa.recordcomponentupdaterplugin"],border:!1,autoScroll:!0,anchor:"100%",cls:"preview-header-attachments",multiSelect:!1,overClass:"zarafa-attachment-link-over",itemSelector:"span.zarafa-attachment-link",tpl:new Ext.XTemplate('<div class="preview-header-attachmentbox"><div class="preview-attachment-title">{this.fieldLabel}:</div><div class="preview-attachment-data" style="max-height: {this.maxHeight}px"><tpl for="."><span class="zarafa-attachment-link x-zarafa-boxfield-item" viewIndex="{viewIndex}">{values.name:htmlEncodeElide(this.ellipsisStringStartLength, this.ellipsisStringEndLength)} <tpl if="!Ext.isEmpty(values.size) && values.size &gt; 0">({values.size:fileSize})</tpl></span> </tpl></div></div>',
{compiled:!0,fieldLabel:a.fieldLabel||this.fieldLabel,maxHeight:a.maxHeight||this.maxHeight,ellipsisStringStartLength:a.ellipsisStringStartLength||this.ellipsisStringStartLength,ellipsisStringEndLength:a.ellipsisStringEndLength||this.ellipsisStringEndLength})});this.fieldLabel=a.fieldLabel||this.fieldLabel;delete a.fieldLabel;Zarafa.common.ui.messagepanel.AttachmentLinks.superclass.constructor.call(this,a)},initComponent:function(){Zarafa.common.ui.messagepanel.AttachmentLinks.superclass.initComponent.call(this);
this.on({contextmenu:this.onNodeContextMenu,click:this.onAttachmentClicked,scope:this})},collectData:function(a,b){for(var c=[],d=0,e=a.length;d<e;d++){var f=a[d];!0!==f.get("hidden")&&(c[c.length]=this.prepareData(f.data,f.get("attach_num"),f))}return c},setRecord:function(a){a&&a.get("hasattach")&&a.hasVisibleAttachments()?a.isOpened()&&(this.bindStore(a.getAttachmentStore()),this.setVisible(!0)):(this.bindStore(null),this.setVisible(!1))},updateIndexes:function(a,b){var c=this.all.elements;b=b||
(0===b?0:c.length-1);for(var d=a||0;d<=b;d++)c[d].viewIndex=c[d].getAttribute("viewIndex")},prepareData:function(a,b,c){return Ext.apply({viewIndex:b},a)},getRecords:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b[b.length]=this.getRecord(a[c]);return b},getRecord:function(a){return this.store.getAt(this.store.findExact("attach_num",parseInt(a.viewIndex,10)))},update:function(a,b){a&&a instanceof Zarafa.core.data.MAPIRecord?b&&a.isOpened()&&this.setRecord(a):Zarafa.common.ui.messagepanel.AttachmentLinks.superclass.update.apply(this,
arguments)},onAttachmentClicked:function(a,b,c,d){this.store&&(a=a.getRecord(c),Zarafa.common.Actions.openAttachmentRecord(a))},onNodeContextMenu:function(a,b,c,d){Zarafa.core.data.UIFactory.openDefaultContextMenu(a.getRecord(c),{position:d.getXY(),model:this.model})}});Ext.reg("zarafa.attachmentlinks",Zarafa.common.ui.messagepanel.AttachmentLinks);Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.CategoryLinks=Ext.extend(Ext.Container,{record:void 0,tooltip:null,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.categorylinks",border:!1,anchor:"100%",cls:"k-preview-header-categories",listeners:{render:this.onRenderCategoryLinks,scope:this}});Zarafa.common.ui.messagepanel.CategoryLinks.superclass.constructor.call(this,a)},onRenderCategoryLinks:function(){this.tooltip=
new Zarafa.common.categories.ui.Tooltip({target:this.el});this.mon(this.el,"contextmenu",this.onContextMenu,this)},onContextMenu:function(a,b){b=Ext.get(b);b.hasClass("k-category-block")&&Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.category"],[this.record],{category:b.dom.textContent,position:a.getXY()})},update:function(a){this.record=a;this.el&&(a=Zarafa.common.categories.Util.getCategories(a),a=Zarafa.common.categories.Util.getCategoriesHtml(a),
this.el.dom.innerHTML=a)}});Ext.reg("zarafa.categorylinks",Zarafa.common.ui.messagepanel.CategoryLinks);Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.ExtraInfoLinks=Ext.extend(Ext.Container,{record:void 0,importantInfoString:pgettext("mail.previewpanel","This message was sent with {0} importance."),sensitivityInfoString:pgettext("mail.previewpanel","Please treat this as {0}."),blockStatusInfoString:pgettext("mail.previewpanel","Click here to download pictures. To help protect your privacy, WebApp prevented automatic download of some pictures in this message."),faultyMessageInfoString:pgettext("mail.previewpanel","This message is corrupt and will not be displayed correctly, Click here to fix it."),
acceptInfoString:pgettext("mail.previewpanel","{0} has accepted."),acceptDelegateInfoString:pgettext("mail.previewpanel","{0} has accepted on behalf of {1}."),tentativeInfoString:pgettext("mail.previewpanel","{0} has tentatively accepted."),tentativeDelegateInfoString:pgettext("mail.previewpanel","{0} has tentatively accepted on behalf of {1}."),declineInfoString:pgettext("mail.previewpanel","{0} has declined."),declineDelegateInfoString:pgettext("mail.previewpanel","{0} has declined on behalf of {1}."),
counterProposalTentativeAcceptedString:pgettext("mail.previewpanel","{0} tentatively accepted and proposed a new time for this meeting."),counterProposalTentativeAcceptedDelegateString:pgettext("mail.previewpanel","{0} tentatively accepted on behalf of {1} and proposed a new time for this meeting."),counterProposalDeclinedString:pgettext("mail.previewpanel","{0} declined and proposed a new time for this meeting."),counterProposalDeclinedDelegateString:pgettext("mail.previewpanel","{0} declined on behalf of {1} and proposed a new time for this meeting."),
meetingNotFoundInfoString:pgettext("mail.previewpanel","This meeting is not in the Calendar; it may have been moved or deleted."),meetingOutDatedInfoString:pgettext("mail.previewpanel","This meeting request was updated after this message was sent. You should open the latest update or open the item from the calendar."),organizerAsAttendeeInfoString:pgettext("mail.previewpanel","As the meeting organizer, you do not need to respond to the meeting"),meetingUpdatedInfoString:pgettext("mail.previewpanel",
"The meeting was updated after the attendee sent this response"),elapsedTimeInfoString:pgettext("mail.previewpanel","This appointment occurs in the past."),responseRequiredString:pgettext("mail.previewpanel","Please respond."),meetingUpdatedString:pgettext("mail.previewpanel","This is an update of a previously sent meeting request."),delegatorInfoString:pgettext("mail.previewpanel","Received for {0}."),repliedString:pgettext("mail.previewpanel","You replied to this message."),forwardString:pgettext("mail.previewpanel",
"You forwarded this message."),repliedStringTime:pgettext("mail.previewpanel","You replied to this message on {0}."),forwardStringTime:pgettext("mail.previewpanel","You forwarded this message on {0}."),receivedTaskRequest:_("Assigned by {0} on {1}."),sentTaskRequest:_("Waiting for response from recipient"),acceptedTaskRequest:_("Accepted by {0} on {1}."),acceptDelegateTaskRequestInfoString:_("{0} has accepted on behalf of {1} {2}."),declineAssignerTaskRequest:_("Declined by {0} on {1}."),declineDelegateTaskRequestInfoString:_("{0} has declined on behalf of {1} {2}."),
updateTaskRequest:_("Last update sent on {0}."),updateDelegateTaskRequestInfoString:_("{0} has updated on behalf of {1} {2}."),itemCls:"preview-header-extrainfobox-item",constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.extrainfolinks",cls:"preview-header-extrainfobox"});Zarafa.common.ui.messagepanel.ExtraInfoLinks.superclass.constructor.call(this,a)},update:function(a){var b=this.getEl();Ext.isDefined(b.dom)&&
(b.dom.innerHTML="");if(Ext.isDefined(a)){this.record=a;var c=!1,d=a.get("sensitivity"),e=a.get("importance"),f=a.get("last_verb_executed"),g=a.get("last_verb_execution_time");if(104===f)c=g?String.format(this.forwardStringTime,g.format("j-m-Y H:i")):this.forwardString,b.createChild({tag:"div",html:c,cls:this.itemCls}),c=!0;else if(102===f||103==f)c=g?String.format(this.repliedStringTime,g.format("j-m-Y H:i")):this.repliedString,b.createChild({tag:"div",html:c,cls:this.itemCls}),c=!0;Ext.isDefined(d)&&
d!=Zarafa.core.mapi.Sensitivity.NONE&&this.isShowExtraInfo()&&(c=String.format(this.sensitivityInfoString,Zarafa.core.mapi.Sensitivity.getDisplayName(d)),b.createChild({tag:"div",html:c,cls:this.itemCls}),c=!0);Ext.isDefined(e)&&e!=Zarafa.core.mapi.Importance.NORMAL&&this.isShowExtraInfo()&&(c=String.format(this.importantInfoString,Zarafa.core.mapi.Importance.getDisplayName(e)),b.createChild({tag:"div",html:c,cls:this.itemCls}),c=!0);a.isFaultyMessage()&&(d=b.createChild({tag:"div",html:this.faultyMessageInfoString,
cls:this.itemCls}),this.mon(d,"click",this.onExtraInfoFaultyClick,this),d.addClassOnOver("preview-header-extrainfobox-item-over"),c=!0);this.record instanceof Zarafa.core.data.MessageRecord&&(a.isExternalContentBlocked()&&(a=b.createChild({tag:"div",html:this.blockStatusInfoString,cls:this.itemCls}),this.mon(a,"click",this.onExtraInfoBlockClick,this),a.addClassOnOver("preview-header-extrainfobox-item-over"),c=!0),this.record instanceof Zarafa.calendar.MeetingRequestRecord?c=!0===this.setMeetingInfo(b)?
!0:c:this.record instanceof Zarafa.task.TaskRecord&&(c=!0===this.setTaskRequestInfo(b)?!0:c));this.setVisible(c);c&&((b=this.findParentByType("zarafa.taskgeneraltab"))?b.doLayout():this.doLayout())}else this.setVisible(!1)},isShowExtraInfo:function(){return this.record.isMessageClass("IPM.Task")?this.record.isTaskOrganized()||this.record.isTaskReceived()&&!this.record.isTaskAccepted()&&!this.record.isTaskUpdated():!0},onExtraInfoBlockClick:function(a){Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.previewpanel.extrainfo"],
this.record,{position:a.getXY()})},onExtraInfoFaultyClick:function(a){Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("We are going to try to fix a corrupted mail message, do you wish to continue?"),icon:Ext.MessageBox.WARNING,fn:this.onFixFaultyMessage,scope:this,buttons:Ext.MessageBox.YESNO})},onFixFaultyMessage:function(a){"yes"==a&&(this.dialog&&(this.dialog.closeOnSave=!0),this.record.fixFaultyMessage())},setTaskRequestInfo:function(a){var b,c=this.record.get("taskhistory"),d="",e=this.record.get("tasklastuser"),
f=!1,g=this.record.get("sender_entryid"),h=this.record.get("sent_representing_entryid"),k="";h&&!Zarafa.core.EntryId.compareABEntryIds(g,h)&&(f=!0,k=this.record.get("sent_representing_name")||this.record.get("sent_representing_email_address"));switch(c){case Zarafa.core.mapi.TaskHistory.ASSIGNED:d=this.record.isTaskReceived()?String.format(this.receivedTaskRequest,this.record.get("tasklastuser"),this.record.get("task_assigned_time").format(_("d-m-Y g:i a"))):this.sentTaskRequest;b=!0;break;case Zarafa.core.mapi.TaskHistory.ACCEPTED:d=
f?String.format(this.acceptDelegateTaskRequestInfoString,e,k,this.record.get("task_assigned_time").format(_("d-m-Y g:i a"))):String.format(this.acceptedTaskRequest,e,this.record.get("task_assigned_time").format(_("d-m-Y g:i a")));b=!0;break;case Zarafa.core.mapi.TaskHistory.DECLINED:d=f?String.format(this.declineDelegateTaskRequestInfoString,e,k,this.record.get("task_assigned_time").format(_("d-m-Y g:i a"))):String.format(this.declineAssignerTaskRequest,e,this.record.get("task_assigned_time").format(_("d-m-Y g:i a")));
b=!0;break;case Zarafa.core.mapi.TaskHistory.UPDATED:d=f?String.format(this.updateDelegateTaskRequestInfoString,e,k,this.record.get("task_assigned_time").format(_("d-m-Y g:i a"))):String.format(this.updateTaskRequest,this.record.get("task_assigned_time").format(_("d-m-Y g:i a"))),b=!0}b&&(this.record.get("task_not_found")&&a.createChild({tag:"div",html:_("The matching task was not found in your task list."),cls:this.itemCls}),a.createChild({tag:"div",html:d,cls:this.itemCls}));return b},setMeetingInfo:function(a){var b=
this.setMeetingNotFoundInfo(a),b=!0===this.setDelegatorInfo(a)?!0:b;this.record.isMeetingRequest()&&(b=!0===this.setMeetingRequestInfo(a)?!0:b,this.record.isRecurringException()&&(b=!0===this.setRecurringMeetingRequestInfo(a)?!0:b));this.record.isMeetingRequestResponse()&&(b=!0===this.setMeetingResponseInfo(a)?!0:b);return b},setDelegatorInfo:function(a){var b=!1;this.record.get("delegated_by_rule")&&(b=this.record.get("received_representing_name")||this.record.get("received_representing_email_address"),
a.createChild({tag:"div",html:String.format(this.delegatorInfoString,b),cls:this.itemCls}),b=!0);return b},setMeetingRequestInfo:function(a){var b=this.record.get("conflictinfo"),c=this.record.isMeetingOutOfDate(),d=this.record.senderIsReceiver(),e=this.record.get("appointment_not_found"),f=!1;if(this.record.senderIsUser())return f;c?(a.createChild({tag:"div",html:this.meetingOutDatedInfoString,cls:this.itemCls}),f=!0):(d?(a.createChild({tag:"div",html:this.organizerAsAttendeeInfoString,cls:this.itemCls}),
f=!0):(this.record.isAppointmentInPast()?(a.createChild({tag:"div",html:this.elapsedTimeInfoString,cls:this.itemCls}),f=!0):!0!==e&&(a.createChild({tag:"div",html:this.responseRequiredString,cls:this.itemCls}),f=!0),Ext.isEmpty(b)||(a.createChild({tag:"div",html:b,cls:this.itemCls}),f=!0)),0<this.record.get("updatecounter")&&(a.createChild({tag:"div",html:this.meetingUpdatedString,cls:this.itemCls}),f=!0));return f},setMeetingResponseInfo:function(a){var b=!1,c=this.record.get("counter_proposal"),
d=this.record.get("sender_entryid"),e=this.record.get("sent_representing_entryid"),f=this.record.get("sent_representing_name")||this.record.get("sent_representing_email_address"),g="";e&&!Zarafa.core.EntryId.compareABEntryIds(d,e)&&(g=this.record.get("sender_name")||this.record.get("sender_email_address"));Ext.isEmpty(f)||(this.record.get("meeting_updated")&&(a.createChild({tag:"div",html:this.meetingUpdatedInfoString,cls:this.itemCls}),b=!0),c?(c="",Ext.isEmpty(g)?this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Tent")?
c=String.format(this.counterProposalTentativeAcceptedString,f):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Neg")&&(c=String.format(this.counterProposalDeclinedString,f)):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Tent")?c=String.format(this.counterProposalTentativeAcceptedDelegateString,g,f):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Neg")&&(c=String.format(this.counterProposalDeclinedDelegateString,g,f))):(c="",Ext.isEmpty(g)?this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Pos")?
c=String.format(this.acceptInfoString,f):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Tent")?c=String.format(this.tentativeInfoString,f):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Neg")&&(c=String.format(this.declineInfoString,f)):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Pos")?c=String.format(this.acceptDelegateInfoString,g,f):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Tent")?c=String.format(this.tentativeDelegateInfoString,g,f):this.record.isMessageClass("IPM.Schedule.Meeting.Resp.Neg")&&
(c=String.format(this.declineDelegateInfoString,g,f))),Ext.isEmpty(c)||(a.createChild({tag:"div",html:c,cls:this.itemCls}),b=!0));return b},setMeetingNotFoundInfo:function(a){var b=!1;this.record.get("appointment_not_found")&&(a.createChild({tag:"div",html:this.meetingNotFoundInfoString,cls:this.itemCls}),b=!0);return b},setRecurringMeetingRequestInfo:function(a){var b=this.record.get("recurring_pattern"),c=!1;b&&(a.createChild({tag:"div",html:Ext.util.Format.htmlEncode(b),cls:this.itemCls}),c=!0);
return c}});Ext.reg("zarafa.extrainfolinks",Zarafa.common.ui.messagepanel.ExtraInfoLinks);Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.MessageBody=Ext.extend(Ext.Container,{plaintextTemplate:"<html><body><pre>{body}</pre></body></html>",emailPattern:/((mailto:)[\w-@,;.?=&%:///+ ]+)|([\w-\._\+%]+@(?:[\w-]+\.)+[\w]*)/gi,linkPattern:/((?:http|ftp)s?:\/\/|www.)([\w\.\-]+)\.(\w{2,6})([\w\/\-\_\+\.\,\?\=\&\!\:\;\%\#\|]+)*/gi,scrollPos:null,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.messagebody",autoScroll:!0,
anchor:"100%",layout:"fit",autoEl:{tag:"iframe",cls:"preview-iframe",frameborder:0,src:Ext.SSL_SECURE_URL},border:!1,listeners:{scope:this,render:this.onRenderMessageBody}});Zarafa.common.ui.messagepanel.MessageBody.superclass.constructor.call(this,a);Ext.isString(this.plaintextTemplate)&&(this.plaintextTemplate=new Ext.Template(this.plaintextTemplate,{compiled:!0}))},onRenderMessageBody:function(){var a=this.findParentByType("tabpanel");a&&this.mon(a,"beforetabchange",this.onBeforeTabChange,this)},
onBeforeTabChange:function(a,b,c){c===this.ownerCt.ownerCt&&(a=this.getEl().dom.contentWindow,this.scrollPos={x:a.pageXOffset,y:a.pageYOffset})},setRelayEventListeners:function(){var a=this.getEl().dom.contentWindow.document,b=["mousedown"];Zarafa.isDeskApp&&b.push("wheel","keydown");this.relayIframeEvent(a,b)},relayIframeEvent:function(a,b){b.forEach(function(b){a.addEventListener(b,this.relayEventHandlers.createDelegate(this),!0)},this)},relayEventHandlers:function(a){Ext.getDoc().fireEvent(a.type,
a)},setIdleTimeEventListeners:function(){var a=this.getEl().dom.contentWindow.document;a.addEventListener&&(a.addEventListener("click",function(){Zarafa.idleTime=0},!0),a.addEventListener("mousemove",function(){Zarafa.idleTime=0},!0),a.addEventListener("keydown",function(){Zarafa.idleTime=0},!0))},update:function(a){var b=this.getEl().dom.contentWindow,c=b.document,d=new Ext.Element(c),e="",f;Ext.isEmpty(c.body)||Zarafa.core.KeyMapMgr.deactivate(d);Ext.isDefined(a)&&(f=a.get("isHTML"),(e=a.getBody(f))?
!1===f&&(e=this.plaintextTemplate.applyTemplate({body:Ext.util.Format.htmlEncode(e)})):e="");Ext.isGecko&&(c.open(),c.close());c.getElementsByTagName("body")[0].innerHTML=e;this.scrollPos&&(b.scrollTo(0,0),b.scrollTo(this.scrollPos.x,this.scrollPos.y),this.scrollPos=null);Ext.EventManager.on(b,"dragover",Zarafa.onWindowDragDrop);Ext.EventManager.on(b,"drop",Zarafa.onWindowDragDrop);this.addCSSText(c);this.setImageClickHandler(c);this.scanDOMForLinks(c);this.handleMailToLinks(d);if(a=this.recordComponentUpdaterPlugin.rootContainer)Zarafa.core.KeyMapMgr.activate(a,
"global",d),Zarafa.core.KeyMapMgr.activate(a,"contentpanel.record.message.showmail",d)},scanDOMForLinks:function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];1==c.nodeType?"A"!=c.nodeName&&this.scanDOMForLinks(c):3==c.nodeType&&0<c.nodeValue.trim().length&&(-1==c.nodeValue.search(this.emailPattern)&&-1==c.nodeValue.search(this.linkPattern)||this.linkifyDOMNode(c,a))}},linkifyDOMNode:function(a,b){for(var c=Zarafa.core.Util.splitStringByPattern(a.nodeValue,this.linkPattern),d=[],
e=0;e<c.length;e++)if(-1==c[e].search(this.linkPattern)){var f=Zarafa.core.Util.splitStringByPattern(c[e],this.emailPattern);d.push.apply(d,f)}else d.push(c[e]);c=Ext.DomHelper.createDom({tag:"span"});for(e=0;e<d.length;e++)if(-1!=d[e].search(this.linkPattern)){var f=Ext.DomHelper.append(c,{tag:"a",html:d[e]}),g=d[e];0!==g.search(/(http|ftp)(s)?:\/\//gi)&&(g="http://"+g);f.setAttribute("href",g);f.setAttribute("target","_blank")}else-1!=d[e].search(this.emailPattern)?(f=Ext.DomHelper.append(c,{tag:"a",
html:d[e]}),g=d[e],0!==g.indexOf("mailto:")&&(g="mailto:"+g),f.setAttribute("href",g)):Ext.DomHelper.append(c,Ext.util.Format.htmlEncode(d[e]));e=0;for(d=c.childNodes.length;e<d;e++)b.insertBefore(c.childNodes.item(0),a);b.removeChild(a)},handleMailToLinks:function(a){a=a.query('a[href^="mailto:"]');if(!Ext.isEmpty(a))for(var b=0;b<a.length;b++)Ext.EventManager.on(a[b],"click",this.onMailtoClick)},onMailtoClick:function(a,b){a.preventDefault();Zarafa.core.URLActionMgr.execute({mailto:this.href||b.href})},
addCSSText:function(a){var b=a.getElementsByTagName("head")[0];a=a.createElement("style");a.setAttribute("type","text/css");a.appendChild(document.createTextNode("body { margin: 0; padding: 9px; } blockquote { margin-right: 0px; }pre { white-space: pre-wrap; margin: 0; font-family:monospace; }p > span > img, div > img, p > img { max-width: 100%; height: auto !important; }@media screen and (max-width: 250px) { p > span > img, div > img, p > img { max-width: 250px; } }.k-original, table img { max-width: none !important; }"));
if(Ext.isGecko&&!Ext.isIE&&!Ext.isEdge||!Zarafa.wingdingsInstalled){var c=container.getServerConfig().getBaseUrl();a.appendChild(document.createTextNode("@font-face {font-family: 'Wingdings';src: url('"+c+"client/resources/fonts/kopanowebappdings.eot');src: url('"+c+"client/resources/fonts/kopanowebappdings.eot?#iefix') format('embedded-opentype'),url('"+c+"client/resources/fonts/kopanowebappdings.woff2') format('woff2'),url('"+c+"client/resources/fonts/kopanowebappdings.woff') format('woff'),url('"+
c+"client/resources/fonts/kopanowebappdings.ttf') format('truetype');font-weight: normal;font-style: normal;}"))}b.appendChild(a)},setImageClickHandler:function(a){a=a.body.querySelectorAll("img");for(var b=0;b<a.length;b++)a[b].removeEventListener("click",this.onImageClick),a[b].addEventListener("click",this.onImageClick)},onImageClick:function(a){a.target.classList.toggle("k-original")},onRender:function(a,b){Zarafa.common.ui.messagepanel.MessageBody.superclass.onRender.call(this,a,b);if(container.getServerConfig().getClientTimeout())this.getEl().on("load",
this.setIdleTimeEventListeners,this);this.getEl().on("load",this.setRelayEventListeners,this);this.resizeEl=this.positionEl=this.wrap=this.el.wrap({cls:"preview-body"})}});Ext.reg("zarafa.messagebody",Zarafa.common.ui.messagepanel.MessageBody);Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.MessageHeader=Ext.extend(Ext.Panel,{headerTemplate:'<div class="preview-header-titlebox"><img src="'+Ext.BLANK_IMAGE_URL+'" class="preview-header-collapse preview-header-collapse-minus"/><tpl if="!Ext.isEmpty(values.subject)"><span class="preview-title zarafa-contextmenu-enabled">{subject:htmlEncode}</span></tpl></div>',collapseElement:void 0,sliding:!1,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");
a=Ext.applyIf(a,{xtype:"zarafa.messageheader",autoScroll:!0,anchor:"100%",cls:"preview-header",border:!1,autoHeight:!0,collapsible:!0,hideCollapseTool:!0,header:!0,headerCfg:{cls:"preview-header-title"},items:this.createHeaderInfo(a)});Zarafa.common.ui.messagepanel.MessageHeader.superclass.constructor.call(this,a);this.on("collapse",this.onAfterSlide,this);this.on("expand",this.onAfterSlide,this);Ext.isString(this.headerTemplate)&&(this.headerTemplate=new Ext.XTemplate(this.headerTemplate,{compiled:!0}))},
createHeaderInfo:function(a){var b=[{xtype:"zarafa.extrainfolinks"}];a.ownerCt.isXType("zarafa.taskpreviewpanel")?b.push({xtype:"zarafa.taskinfo"}):b.push({xtype:"zarafa.sentinfolinks"},{xtype:"zarafa.recipientlinks",plugins:["zarafa.recordcomponentupdaterplugin"],fieldLabel:pgettext("mail.previewpanel","To"),recipientType:Zarafa.core.mapi.RecipientType.MAPI_TO},{xtype:"zarafa.recipientlinks",plugins:["zarafa.recordcomponentupdaterplugin"],fieldLabel:pgettext("mail.previewpanel","Cc"),recipientType:Zarafa.core.mapi.RecipientType.MAPI_CC},
{xtype:"zarafa.recipientlinks",plugins:["zarafa.recordcomponentupdaterplugin"],fieldLabel:pgettext("mail.previewpanel","Bcc"),recipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC});b.push({xtype:"zarafa.attachmentlinks",plugins:["zarafa.recordcomponentupdaterplugin"],fieldLabel:pgettext("mail.previewpanel","Attachments")},{xtype:"zarafa.categorylinks",plugins:["zarafa.recordcomponentupdaterplugin"],fieldLabel:pgettext("mail.previewpanel","Categories")},container.populateInsertionPoint("previewpanel.toolbar.detaillinks",
this));return b},onRender:function(){Zarafa.common.ui.messagepanel.MessageHeader.superclass.onRender.apply(this,arguments);this.header&&this.header.selectable()},update:function(a,b){if(Ext.isDefined(this.header)){if(!0===b&&this.collapseElement&&(!0===this.collapsed||!0===this.sliding)){if(!0===this.sliding){this.update.defer(10,this,[a,b]);return}this.collapseElement.removeClass("preview-header-collapse-plus");this.expand(!1);this.collapseElement.addClass("preview-header-collapse-minus")}this.collapseElement&&
this.mun(this.collapseElement,"click",this.onCollapseClick,this);Ext.isDefined(a)?(this.headerTemplate.overwrite(this.header.dom,a.data),(this.collapseElement=this.header.child(".preview-header-collapse"))&&this.mon(this.collapseElement,"click",this.onCollapseClick,this)):this.header.dom.innerHTML=""}},onCollapseClick:function(a){this.collapseElement&&a.target.id==this.collapseElement.id&&!1===this.sliding&&(this.sliding=!0,this.collapseElement.hasClass("preview-header-collapse-minus")?(this.collapseElement.removeClass("preview-header-collapse-minus"),
this.collapse(),this.collapseElement.addClass("preview-header-collapse-plus")):(this.collapseElement.removeClass("preview-header-collapse-plus"),this.expand(),this.collapseElement.addClass("preview-header-collapse-minus")))},onAfterSlide:function(){this.sliding=!1}});Ext.reg("zarafa.messageheader",Zarafa.common.ui.messagepanel.MessageHeader);Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.RecipientLinks=Ext.extend(Ext.DataView,{ellipsisStringStartLength:30,ellipsisStringEndLength:30,maxHeight:50,fieldLabel:pgettext("mail.previewpanel","Recipients"),recipientType:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.recipientlinks",border:!1,autoScroll:!0,anchor:"100%",cls:"preview-header-recipients",multiSelect:!1,overClass:"zarafa-recipient-link-over",itemSelector:"span.zarafa-recipient-link",tpl:new Ext.XTemplate('<tpl if="values.length &gt; 0"><div class="preview-header-recipientbox"><div class="preview-recipient-title">{this.fieldLabel}:</div><div class="preview-recipient-data" style="max-height: {this.maxHeight}px"><tpl for="."><span viewIndex="{viewIndex}" class="zarafa-emailaddress-link zarafa-recipient-link"><span class="zarafa-presence-status {[Zarafa.core.data.PresenceStatus.getCssClass(values.presence_status)]}"><span class="zarafa-presence-status-icon"></span><tpl if="!Ext.isEmpty(values.display_name)">{display_name:htmlEncodeElide(this.ellipsisStringStartLength, this.ellipsisStringEndLength)} </tpl><tpl if="!Ext.isEmpty(values.smtp_address)">&lt;{smtp_address:htmlEncode}&gt;</tpl><tpl if="Ext.isEmpty(values.smtp_address) && !Ext.isEmpty(values.email_address)">&lt;{email_address:htmlEncode}&gt;</tpl></span></span><tpl if="xindex &gt; 0 && xindex != xcount"><span>; </span></tpl></tpl></div></div></tpl>',
{compiled:!0,fieldLabel:a.fieldLabel||this.fieldLabel,maxHeight:a.maxHeight||this.maxHeight,ellipsisStringStartLength:a.ellipsisStringStartLength||this.ellipsisStringStartLength,ellipsisStringEndLength:a.ellipsisStringEndLength||this.ellipsisStringEndLength})});this.fieldLabel=a.fieldLabel||this.fieldLabel;delete a.fieldLabel;Zarafa.common.ui.messagepanel.RecipientLinks.superclass.constructor.call(this,a)},initComponent:function(){Zarafa.common.ui.messagepanel.RecipientLinks.superclass.initComponent.call(this);
container.populateInsertionPoint("previewpanel.toolbar.recipientlinks",this);this.on("contextmenu",this.onRecipientContextMenu,this);this.on("dblclick",this.onRecipientDoubleClick,this)},setRecord:function(a){a?a.isOpened()&&this.bindStore(a.getRecipientStore()):this.bindStore(null)},updateIndexes:function(a,b){var c=this.all.elements;b=b||(0===b?0:c.length-1);for(var d=a||0;d<=b;d++)c[d].viewIndex=c[d].getAttribute("viewIndex")},collectData:function(a,b){for(var c=[],d=0,e=a.length;d<e;d++){var f=
a[d];Ext.isDefined(this.recipientType)&&this.recipientType!==f.get("recipient_type")||(c[c.length]=this.prepareData(f.data,f.get("rowid"),f))}return c},prepareData:function(a,b,c){return Ext.apply({viewIndex:b},a)},getRecords:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b[b.length]=this.store.getAt(this.store.findExact("rowid",parseInt(a[c].viewIndex)));return b},getRecord:function(a){return this.store.getAt(this.store.findExact("rowid",parseInt(a.viewIndex,10)))},update:function(a,b){a&&a instanceof
Zarafa.core.data.MAPIRecord?b&&a.isOpened()&&this.setRecord(a):Zarafa.common.ui.messagepanel.RecipientLinks.superclass.update.apply(this,arguments)},onUpdate:function(a,b){if(b.get("recipient_type")===this.recipientType){var c=this.store.indexOf(b),d=-1;Ext.each(this.store.getRange(),function(a){a.get("recipient_type")===this.recipientType&&d++},this);if(-1<c){var e=this.isSelected(d),f=this.all.elements[d],c=this.bufferRender([b],c)[0];this.all.replaceElement(d,c,!0);e&&(this.selected.replaceElement(f,
c),this.all.item(d).addClass(this.selectedClass));this.updateIndexes(d,d)}}},refresh:function(){this.clearSelections(!1,!0);var a=this.getTemplateTarget(),b=this.store.getRange();a.update("");if(1>b.length)this.deferEmptyText&&!this.hasSkippedEmptyText||a.update(this.emptyText),this.all.clear(),this.setVisible(!1);else{var c=this.collectData(b,0);Ext.each(c,function(a,b){var d=Zarafa.core.data.UserIdObjectFactory.createFromRecord(new Ext.data.Record(a));c[b].presence_status=Zarafa.core.PresenceManager.getPresenceStatusForUser(d)});
this.tpl.overwrite(a,c);this.all.fill(Ext.query(this.itemSelector,a.dom));this.updateIndexes(0);1>c.length?this.setVisible(!1):this.setVisible(!0)}this.hasSkippedEmptyText=!0},onRecipientContextMenu:function(a,b,c,d){Zarafa.core.data.UIFactory.openDefaultContextMenu(this.createRecipientFromNode(c),{position:d.getXY()})},onRecipientDoubleClick:function(a,b,c,d){a=a.getRecord(c);Zarafa.common.Actions.openViewRecipientContent(a)},createRecipientFromNode:function(a){a=this.getRecord(a);a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
a.data);a.set("rowid","");a.set("recipient_trackstatus","");a.set("recipient_trackstatus_time","");return a}});Ext.reg("zarafa.recipientlinks",Zarafa.common.ui.messagepanel.RecipientLinks);Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.SentInfoLinks=Ext.extend(Ext.Container,{senderCls:"preview-header-senderbox",ellipsisStringStartLength:30,ellipsisStringEndLength:30,record:void 0,senderTemplate:'<tpl if="!Ext.isEmpty(values.sender_entryid) && !Ext.isEmpty(values.sent_representing_entryid) && !Zarafa.core.EntryId.compareABEntryIds(values.sent_representing_entryid, values.sender_entryid)"><span class="preview-from"><span class="zarafa-emailaddress-link zarafa-sentinfo-link"> <span class="zarafa-presence-status {[Zarafa.core.data.PresenceStatus.getCssClass(values.sender_presence_status)]}"><span class="zarafa-presence-status-icon"></span>{sender_name:htmlEncode} &lt;{sender_email_address:htmlEncode}&gt; </span></span><span>&nbsp;'+pgettext("mail.previewpanel",
"on behalf of")+'&nbsp;</span><span class="zarafa-emailaddress-link zarafa-sentinfo-on-behalf"><span class="zarafa-presence-status {[Zarafa.core.data.PresenceStatus.getCssClass(values.sent_representing_presence_status)]}"><span class="zarafa-presence-status-icon"></span>{sent_representing_name:htmlEncodeElide(this.ellipsisStringStartLength, this.ellipsisStringEndLength)}&nbsp;<tpl if="!Ext.isEmpty(values.sent_representing_email_address)">&lt;{sent_representing_email_address:htmlEncode}&gt;</tpl></span></span></span></tpl><tpl if="Ext.isEmpty(values.sender_entryid) || Ext.isEmpty(values.sent_representing_entryid) || Zarafa.core.EntryId.compareABEntryIds(values.sent_representing_entryid, values.sender_entryid)"><span class="preview-from zarafa-presence-status {[Zarafa.core.data.PresenceStatus.getCssClass(values.sender_presence_status)]}"><span class="zarafa-presence-status-icon"></span><span class="zarafa-emailaddress-link zarafa-sentinfo-link">{sender_name:htmlEncodeElide(this.ellipsisStringStartLength, this.ellipsisStringEndLength)}&nbsp;<tpl if="!Ext.isEmpty(values.sender_email_address)">&lt;{sender_email_address:htmlEncode}&gt;</tpl></span></span></tpl><tpl if="!this.isMeeting(values.message_class)"><span class="preview-timestamp"></tpl><tpl if="this.isMeeting(values.message_class)"><span class="preview-timestamp preview-meetingrequest"></tpl><tpl><span class="preview-timestamp-title">'+
pgettext("mail.previewpanel","Sent")+':</span><tpl if="Ext.isDate(values.message_delivery_time)">{message_delivery_time:date(_("l jS F Y G:i"))}</tpl><tpl if="!Ext.isDate(values.message_delivery_time)">'+pgettext("mail.previewpanel","None")+"</tpl></span></tpl>",constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.sentinfolinks",border:!1,autoScroll:!0,anchor:"100%",cls:"preview-header-sentinfo"});Zarafa.common.ui.messagepanel.SentInfoLinks.superclass.constructor.call(this,
a);Ext.isString(this.senderTemplate)&&(this.senderTemplate=new Ext.XTemplate(this.senderTemplate,{compiled:!0,ellipsisStringStartLength:this.ellipsisStringStartLength,ellipsisStringEndLength:this.ellipsisStringEndLength,isMeeting:function(a){return Zarafa.core.MessageClass.isClass(a,"ipm.schedule.meeting",!0)}}))},onRender:function(){Zarafa.common.ui.messagepanel.SentInfoLinks.superclass.onRender.apply(this,arguments);this.senderElem=Ext.DomHelper.append(this.el.dom,{tag:"div",cls:this.senderCls})},
update:function(a){if(this.senderElem){var b=Ext.get(this.senderElem);if(Ext.isDefined(a)){var c;Ext.isFunction(a.getSender)&&(c=Zarafa.core.data.UserIdObjectFactory.createFromRecord(a.getSender()),a.data.sender_presence_status=Zarafa.core.PresenceManager.getPresenceStatusForUser(c));Ext.isFunction(a.getSentRepresenting)&&(c=Zarafa.core.data.UserIdObjectFactory.createFromRecord(a.getSentRepresenting()),a.data.sent_representing_presence_status=Zarafa.core.PresenceManager.getPresenceStatusForUser(c));
this.senderTemplate.overwrite(b,a.data);this.mon(b.select(".zarafa-sentinfo-link"),"contextmenu",this.onSenderContextMenu,this);this.mon(b.select(".zarafa-sentinfo-on-behalf"),"contextmenu",this.onSenderContextMenu,this);this.mon(b.select(".zarafa-sentinfo-link"),"dblclick",this.onDoubleClick,this);this.mon(b.select(".zarafa-sentinfo-on-behalf"),"dblclick",this.onDoubleClick,this)}else this.mun(b.select(".zarafa-sentinfo-link"),"contextmenu",this.onSenderContextMenu,this),this.mun(b.select(".zarafa-sentinfo-on-behalf"),
"contextmenu",this.onSenderContextMenu,this),this.mun(b.select(".zarafa-sentinfo-link"),"dblclick",this.onDoubleClick,this),this.mun(b.select(".zarafa-sentinfo-on-behalf"),"dblclick",this.onDoubleClick,this),this.senderElem.innerHTML=""}this.record=a},onSenderContextMenu:function(a,b,c){b=this.convertSenderToRecord(b);Zarafa.core.data.UIFactory.openDefaultContextMenu(b,{position:a.getXY()})},onDoubleClick:function(a,b,c){a=this.convertSenderToRecord(b);Zarafa.common.Actions.openViewRecipientContent(a)},
convertSenderToRecord:function(a){var b;Ext.get(a).hasClass("zarafa-sentinfo-link")?b=this.record.getSender():Ext.get(a).hasClass("zarafa-sentinfo-on-behalf")&&(b=this.record.getSentRepresenting());return b}});Ext.reg("zarafa.sentinfolinks",Zarafa.common.ui.messagepanel.SentInfoLinks);Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.Actions={openAddressBook:function(a){a=Ext.applyIf(a||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["addressbook.dialog.addressbook"],void 0,a)},openDetailsContent:function(a,b){Array.isArray(a)&&!Ext.isEmpty(a)&&(a=a[0]);a.isPersonalContact()?(a=a.convertToContactRecord(),container.getShadowStore().add(a)):a.isPersonalDistList()&&(a=a.convertToDistListRecord(),container.getShadowStore().add(a));b=Ext.applyIf(b||{},{modal:!0});
Zarafa.core.data.UIFactory.openViewRecord(a,b)}};Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABEmailAddressTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.abemailaddresstab",title:_("E-mail Addresses"),layout:{type:"vbox",pack:"start",align:"stretch"},items:[{xtype:"displayfield",value:_("E-mail addresses")+":",hideLabel:!0},{xtype:"panel",flex:1,items:[{xtype:"listview",store:new Ext.data.Store,ref:"../emailList",hideHeaders:!0,
singleSelect:!1,anchor:"100% 100%",columns:[{dataIndex:"address",tpl:"{address:htmlEncode}"}]}]}]});Zarafa.addressbook.dialogs.ABEmailAddressTab.superclass.constructor.call(this,a)},update:function(a,b){this.getForm().loadRecord(a);var c=a.getSubStore("ems_ab_proxy_addresses");c&&this.emailList.getStore()!==c&&this.emailList.bindStore(c)}});Ext.reg("zarafa.abemailaddresstab",Zarafa.addressbook.dialogs.ABEmailAddressTab);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABGroupDetailPanel=Ext.extend(Ext.TabPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.abgroupdetailpanel",border:!1,activeTab:0,items:[{xtype:"zarafa.abgroupgeneraltab"},{xtype:"zarafa.abmemberoftab"},{xtype:"zarafa.abemailaddresstab"},container.populateInsertionPoint("context.addressbook.abgroupdetailcontentpanel.tabs",this)]});Zarafa.addressbook.dialogs.ABGroupDetailPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.abgroupdetailpanel",Zarafa.addressbook.dialogs.ABGroupDetailPanel);
Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABGroupGeneralTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.abgroupgeneraltab",title:_("General"),layout:"column",autoScroll:!0,items:[this.createNameFieldset(),this.createMembersFieldset()]});Zarafa.addressbook.dialogs.ABGroupGeneralTab.superclass.constructor.call(this,a)},createNameFieldset:function(){return{xtype:"fieldset",columnWidth:.5,
border:!1,cls:"zarafa-fieldset",autoHeight:!0,items:[{xtype:"textfield",fieldLabel:_("Display Name"),name:"display_name",anchor:"100%",border:!1,readOnly:!0},{xtype:"textfield",fieldLabel:_("Alias"),name:"account",anchor:"100%",border:!1,readOnly:!0},{xtype:"displayfield",value:_("Owner")+":",hideLabel:!0},{xtype:"zarafa.abitemgrid",ref:"../ownerList",anchor:"100%",bwrapStyle:"width: 100%",autoHeight:!0,border:!1},{xtype:"displayfield",value:_("Notes")+":",hideLabel:!0},{xtype:"textarea",hideLabel:!0,
name:"comment",flex:1,anchor:"100%",border:!1,readOnly:!0}]}},createMembersFieldset:function(){return{xtype:"fieldset",columnWidth:.5,border:!0,title:_("Members"),cls:"zarafa-fieldset",autoHeight:!0,items:[{xtype:"zarafa.abitemgrid",autoWidth:!0,border:!0,height:225,ref:"../groupMembersList",flex:1,readOnly:!0}]}},update:function(a,b){this.getForm().loadRecord(a);var c=a.getSubStore("members");c&&this.groupMembersList.getStore()!==c&&this.groupMembersList.reconfigure(c,this.groupMembersList.getColumnModel());
(c=a.getSubStore("ems_ab_owner"))&&this.ownerList.getStore()!==c&&this.ownerList.reconfigure(c,this.ownerList.getColumnModel())}});Ext.reg("zarafa.abgroupgeneraltab",Zarafa.addressbook.dialogs.ABGroupGeneralTab);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABItemGrid=Ext.extend(Ext.grid.GridPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{viewConfig:{forceFit:!0},store:new Zarafa.addressbook.AddressBookSubStore,colModel:new Ext.grid.ColumnModel({columns:[{dataIndex:"display_type",header:'<p class="icon_index">&nbsp;</p>',headerCls:"zarafa-icon-column icon",width:25,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{header:_("Display Name"),dataIndex:"display_name",renderer:Ext.util.Format.htmlEncode,sortable:!1},
{header:_("Email Address"),dataIndex:"smtp_address",renderer:Ext.util.Format.htmlEncode,sortable:!1},{header:_("Account"),dataIndex:"account",renderer:Ext.util.Format.htmlEncode,sortable:!1}]})});Zarafa.addressbook.dialogs.ABItemGrid.superclass.constructor.call(this,a);this.on("rowdblclick",this.onRowDblClick,this)},onRowDblClick:function(a,b,c){(a=this.getStore().getAt(b))&&Zarafa.core.data.UIFactory.openViewRecord(a)}});Ext.reg("zarafa.abitemgrid",Zarafa.addressbook.dialogs.ABItemGrid);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABMemberOfTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.abmemberoftab",title:_("Member Of"),layout:{type:"vbox",align:"stretch"},items:[{xtype:"displayfield",value:_("Group Membership")+":",hideLabel:!0},{xtype:"zarafa.abitemgrid",ref:"memberOfList",flex:1}]});Zarafa.addressbook.dialogs.ABMemberOfTab.superclass.constructor.call(this,a)},
update:function(a,b){this.getForm().loadRecord(a);var c=a.getSubStore("ems_ab_is_member_of_dl");c&&this.memberOfList.getStore()!==c&&this.memberOfList.reconfigure(c,this.memberOfList.getColumnModel())}});Ext.reg("zarafa.abmemberoftab",Zarafa.addressbook.dialogs.ABMemberOfTab);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABUserDetailPanel=Ext.extend(Ext.TabPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.abuserdetailpanel",border:!1,activeTab:0,items:[{xtype:"zarafa.abusergeneraltab"},{xtype:"zarafa.abuserorganizationtab"},{xtype:"zarafa.abuserphonetab"},{xtype:"zarafa.abmemberoftab"},{xtype:"zarafa.abemailaddresstab"},container.populateInsertionPoint("context.addressbook.abuserdetailcontentpanel.tabs",this)]});Zarafa.addressbook.dialogs.ABUserDetailPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.abuserdetailpanel",Zarafa.addressbook.dialogs.ABUserDetailPanel);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABUserGeneralTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.abusergeneraltab",title:_("General"),layout:"column",autoScroll:!0,items:[this.createNameFieldset(),this.createAddressFieldset(),this.createOfficeFieldset()]});Zarafa.addressbook.dialogs.ABUserGeneralTab.superclass.constructor.call(this,a)},createNameFieldset:function(){return{xtype:"fieldset",
columnWidth:1,border:!0,cls:"zarafa-fieldset",title:_("Name"),layout:"column",anchor:"100%",items:[{xtype:"container",layout:"form",columnWidth:.5,border:!1,items:[{xtype:"container",layout:"column",anchor:"100%",border:!1,defaults:{anchor:"100%",readOnly:!0},items:[{columnWidth:.7,xtype:"textfield",fieldLabel:_("First"),name:"given_name",plugins:[{ptype:"zarafa.fieldlabeler"}]},{xtype:"spacer",width:6,height:3},{xtype:"textfield",columnWidth:.3,labelWidth:50,fieldLabel:_("Initial"),name:"initials",
plugins:[{ptype:"zarafa.fieldlabeler"}]}]},{xtype:"container",layout:"column",anchor:"100%",border:!1,items:[{xtype:"textfield",columnWidth:.7,readOnly:!0,style:"margin-top: 3px;",fieldLabel:_("Display"),plugins:[{ptype:"zarafa.fieldlabeler"}],name:"display_name"},{xtype:"spacer",width:6,height:3}]}]},{xtype:"container",layout:"form",cls:"zarafa-fieldset-second",columnWidth:.5,border:!1,defaults:{anchor:"100%",readOnly:!0},items:[{xtype:"textfield",fieldLabel:_("Last"),name:"surname"},{xtype:"textfield",
fieldLabel:_("Alias"),name:"account"}]}]}},createAddressFieldset:function(){return{xtype:"fieldset",cls:"zarafa-fieldset",defaultType:"textfield",border:!1,columnWidth:.5,defaults:{anchor:"100%",readOnly:!0},items:[{xtype:"textarea",fieldLabel:_("Address"),name:"street_address",height:"40px"},{fieldLabel:_("City"),name:"locality"},{fieldLabel:_("State"),name:"state_or_province"},{fieldLabel:_("Zip Code"),name:"postal_code"},{fieldLabel:_("Country"),name:"country"}]}},createOfficeFieldset:function(){return{xtype:"fieldset",
cls:"zarafa-fieldset-second",defaultType:"textfield",border:!1,columnWidth:.5,defaults:{anchor:"100%",readOnly:!0},items:[{fieldLabel:_("Title"),name:"title"},{fieldLabel:_("Company"),name:"company_name"},{fieldLabel:_("Department"),name:"department_name"},{fieldLabel:_("Office"),name:"office_location"},{fieldLabel:_("Assistant"),name:"assistant"},{fieldLabel:_("Phone"),name:"business_telephone_number"}]}},update:function(a,b){Ext.isEmpty(a)||this.getForm().loadRecord(a)}});
Ext.reg("zarafa.abusergeneraltab",Zarafa.addressbook.dialogs.ABUserGeneralTab);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABUserOrganizationTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.abuserorganizationtab",title:_("Organization"),selModel:this.initSelectionModel(),layout:{type:"vbox",align:"stretch"},autoScroll:!0,items:[this.createManagerFieldset(),this.createDirectReportFieldset()]});Zarafa.addressbook.dialogs.ABUserOrganizationTab.superclass.constructor.call(this,
a)},createManagerFieldset:function(){return[{xtype:"displayfield",value:_("Manager")+":",hideLabel:!0},{xtype:"zarafa.abitemgrid",ref:"managerList",autoHeight:!0}]},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!1})},createDirectReportFieldset:function(){return[{xtype:"displayfield",value:_("Direct reports")+":",hideLabel:!0},{xtype:"zarafa.abitemgrid",ref:"reportList",flex:1}]},update:function(a,b){this.getForm().loadRecord(a);var c=a.getSubStore("ems_ab_manager");
c&&this.managerList.getStore()!==c&&this.managerList.reconfigure(c,this.managerList.getColumnModel());(c=a.getSubStore("ems_ab_reports"))&&this.reportList.getStore()!==c&&this.reportList.reconfigure(c,this.reportList.getColumnModel())}});Ext.reg("zarafa.abuserorganizationtab",Zarafa.addressbook.dialogs.ABUserOrganizationTab);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABUserPhoneTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.abuserphonetab",title:_("Phone"),layout:{type:"vbox",align:"stretch"},autoScroll:!0,items:[this.createPhonenumberFieldset(),this.createNoteFieldset()]});Zarafa.addressbook.dialogs.ABUserPhoneTab.superclass.constructor.call(this,a)},createPhonenumberFieldset:function(){return{xtype:"fieldset",
title:_("Phone numbers"),border:!0,cls:"zarafa-fieldset",layout:"column",columnWidth:1,autoHeight:!0,anchor:"100%",items:[{xtype:"container",layout:"form",columnWidth:.5,border:!1,defaults:{anchor:"100%",editable:!1,readOnly:!0},items:[{xtype:"textfield",fieldLabel:_("Business"),name:"business_telephone_number"},{xtype:"combo",mode:"local",fieldLabel:_("Business2"),store:new Zarafa.addressbook.AddressBookTelephoneNumberSubStore,autoSelect:!0,forceSelection:!0,lazyInit:!1,editable:!1,readOnly:!1,triggerAction:"all",
displayField:"number",valueField:"number",ref:"../../business2PhoneCombo"},{xtype:"textfield",fieldLabel:_("Fax"),name:"primary_fax_number"},{xtype:"textfield",fieldLabel:_("Assistant"),name:"assistant"}]},{xtype:"container",layout:"form",columnWidth:.5,border:!1,defaults:{anchor:"100%",editable:!1,readOnly:!0},items:[{xtype:"textfield",fieldLabel:_("Home"),name:"home_telephone_number"},{xtype:"combo",mode:"local",fieldLabel:_("Home2"),store:new Zarafa.addressbook.AddressBookTelephoneNumberSubStore,
forceSelection:!0,lazyInit:!1,editable:!1,readOnly:!1,triggerAction:"all",displayField:"number",valueField:"number",ref:"../../home2PhoneCombo"},{xtype:"textfield",fieldLabel:_("Mobile"),name:"mobile_telephone_number"},{xtype:"textfield",fieldLabel:_("Pager"),name:"pager_telephone_number"}]}]}},createNoteFieldset:function(){return[{xtype:"displayfield",value:_("Notes")+":",hideLabel:!0},{xtype:"textarea",hideLabel:!0,name:"comment",readOnly:!0,columnWidth:1,flex:1}]},update:function(a,b){this.getForm().loadRecord(a);
var c=a.getSubStore("business2_telephone_numbers");c&&this.business2PhoneCombo.getStore()!==c&&(this.business2PhoneCombo.bindStore(c),(c=c.getAt(0))&&this.business2PhoneCombo.setValue(c.get(this.business2PhoneCombo.valueField)));(c=a.getSubStore("home2_telephone_numbers"))&&this.home2PhoneCombo.getStore()!==c&&(this.home2PhoneCombo.bindStore(c),(c=c.getAt(0))&&this.home2PhoneCombo.setValue(c.get(this.home2PhoneCombo.valueField)))}});Ext.reg("zarafa.abuserphonetab",Zarafa.addressbook.dialogs.ABUserPhoneTab);
Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.ABMultiUserSelectionPanel=Ext.extend(Ext.Panel,{callback:Ext.emptyFn,convert:Ext.emptyFn,scope:void 0,store:void 0,selectionCfg:void 0,constructor:function(a){a=a||{};var b=[{xtype:"zarafa.addressbookmainpanel",ref:"abPanel",flex:1,hideContactsFolders:a.hideContactsFolders,listRestriction:a.listRestriction}];Ext.each(a.selectionCfg,function(a){b.push({xtype:"zarafa.resizablecompositefield",cls:"zarafa-addressbook-dialog-compositefield",hideLabel:!0,anchor:"100%",autoHeight:!1,
items:[{xtype:"button",text:a.fieldLabel,autoHeight:!0,handler:this.onSelectionBtnClick,scope:this},a]})},this);Ext.applyIf(a,{xtype:"zarafa.abmultiuserselectionpanel",cls:"k-abmultiuserselectionpanel",layout:{type:"vbox",align:"stretch"},items:b,buttons:[{text:_("Ok"),handler:this.onSubmit,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]});Zarafa.addressbook.ui.ABMultiUserSelectionPanel.superclass.constructor.call(this,a)},doCallBack:function(){var a=this.abPanel.getGridPanel().getSelectionModel().getSelections();
Ext.isEmpty(a)||Ext.each(a,function(a){this.store.add(this.convert(a))},this)},initEvents:function(){Zarafa.addressbook.ui.ABMultiUserSelectionPanel.superclass.initEvents.apply(this,arguments);this.mon(this.abPanel.getGridPanel(),"rowdblclick",this.onAddressBookRowDblClick,this);this.mon(this.abPanel.getGridPanel(),"rowcontextmenu",this.onAddressBookRowContextMenu,this)},onAddressBookRowDblClick:function(){this.onSelectionBtnClick()},onAddressBookRowContextMenu:function(a,b,c){a=a.getSelectionModel();
a.hasSelection()?a.isSelected(b)||(a.clearSelections(),a.selectRow(b)):a.selectRow(b);Zarafa.core.data.UIFactory.openDefaultContextMenu(a.getSelections(),{position:c.getXY(),dialog:this.dialog})},onSelectionBtnClick:function(a){var b=a?a.ownerCt.get(1):void 0;a=this.abPanel.getGridPanel().getSelectionModel().getSelections();Ext.isFunction(this.convert)&&!Ext.isEmpty(a)&&Ext.each(a,function(a){(a=this.convert.call(this.scope||this,a,b))&&this.store.add(a)},this)},onSubmit:function(){Ext.isFunction(this.callback)&&
(!1!==this.callback.call(this.scope||this)?this.dialog.close():Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("You must select one or more users."),buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.INFO}))},onCancel:function(){this.dialog.close()}});Ext.reg("zarafa.abmultiuserselectionpanel",Zarafa.addressbook.ui.ABMultiUserSelectionPanel);Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.AddressBookMainPanel=Ext.extend(Ext.Panel,{addressBookStore:void 0,hideContactsFolders:!1,listRestriction:void 0,singleSelect:!1,emptyGridText:_("Use the search bar to get results"),noResultsGridText:_("There are no items to show in this list"),constructor:function(a){var b=container.getSettingsModel(),c=b.get("zarafa/v1/contexts/addressbook/stateUpdated");Ext.isEmpty(c)&&(b.remove("zarafa/v1/state/dialogs/addressbookcontentpanel"),b.remove("zarafa/v1/state/dialogs/abuserselectioncontentpanel"),
b.remove("zarafa/v1/state/gab/contacts"),b.remove("zarafa/v1/state/gab/globaladdressbook"),b.set("zarafa/v1/contexts/addressbook/stateUpdated",1));a=a||{};Ext.isDefined(a.addressBookStore)||(a.addressBookStore=new Zarafa.addressbook.AddressBookStore);b=a.items||[];a.items=[this.createHeaderPanel(a.hideContactsFolders),this.createViewPanel(a.addressBookStore,{singleSelect:Ext.isDefined(a.singleSelect)?a.singleSelect:this.singleSelect})].concat(b);Ext.applyIf(a,{xtype:"zarafa.addressbookmainpanel",
border:!1,cls:"k-addressbookmainpanel",layout:{type:"vbox",align:"stretch"}});Zarafa.addressbook.ui.AddressBookMainPanel.superclass.constructor.call(this,a);this.initDialog();this.on("destroy",this.addressBookStore.destroy,this.addressBookStore)},createHeaderPanel:function(a){var b=new Ext.XTemplate('<tpl for=".">','<div class="x-combo-list-item<tpl if="group_header"> k-combo-list-item-header</tpl>">',"{depth:indent}{display_name:htmlEncode}","</div>","</tpl>",{compiled:!0});return{xtype:"panel",
cls:"k-addressbookmainpanel-header",border:!1,layout:"hbox",items:[{xtype:"trigger",ref:"../searchText",flex:1,hideFieldLabel:!0,enableKeyEvents:!0,triggerClass:"icon_search",triggerScope:this,onTriggerClick:this.onSearchButtonClick.createDelegate(this),wrapFocusClass:"",listeners:{scope:this,render:this.onRenderSearchField,keyup:this.onSearchTextFiledKeyUp}},{xtype:"spacer",width:30,height:10},{xtype:"container",width:355,items:[{xtype:"combo",width:200,plugins:["zarafa.fieldlabeler","zarafa.comboautowidth"],
fieldLabel:_("Show Names from the"),labelWidth:150,editable:!1,mode:"local",triggerAction:"all",store:Zarafa.addressbook.AddressBookHierarchyStore,displayField:"display_name",valueField:"entryid",ref:"../../addressBookSelectionCB",tpl:b,autoSelect:!0,minListWidth:150,listeners:{beforeselect:this.onBeforeSelectAddressBook,select:this.onAddressBookChange,scope:this},onLoad:this.onAddressBookComboLoad.createDelegate(this,[a])}]}]}},createViewPanel:function(a,b){return Ext.apply(b,{xtype:"zarafa.addressbookgrid",
hideLabel:!0,name:"viewpanel",cls:"k-addressbookmainpanel-grid",viewConfig:{emptyText:this.emptyGridText,deferEmptyText:!1},store:a,border:!1,ref:"viewPanel",flex:1})},getGridPanel:function(){return this.viewPanel},onRenderSearchField:function(a){a.getEl().set({placeholder:_("Search...")})},onBeforeSelectAddressBook:function(a,b,c){return!b.get("group_header")},onAddressBookChange:function(a,b,c){this.onSearchButtonClick()},onAddressBookComboLoad:function(a){!0===a?Zarafa.addressbook.AddressBookHierarchyStore.filter("type",
"gab"):Zarafa.addressbook.AddressBookHierarchyStore.clearFilter();Ext.form.ComboBox.prototype.onLoad.call(this.addressBookSelectionCB)},initDialog:function(){var a;if(Ext.isDefined(this.addressBookSelectionCB)&&0!==Zarafa.addressbook.AddressBookHierarchyStore.getCount()){var b=container.getSettingsModel().get("zarafa/v1/main/default_addressbook");Ext.isEmpty(b)||(a=Zarafa.addressbook.AddressBookHierarchyStore.getById(b));Ext.isEmpty(a)&&(a=Zarafa.addressbook.AddressBookHierarchyStore.getAt(0));a=
a.get("entryid");Ext.isDefined(a)&&(this.addressBookSelectionCB.setValue(a),this.viewPanel.on("render",this.onSearchButtonClick,this))}},onSearchButtonClick:function(){var a=this.getSelectedFolderRecord();if(Ext.isDefined(a)){var b=a.get("type"),c=container.getServerConfig().isFullGabDisabled(),d=(this.searchText.getValue()||"").trim();"gab"===b&&c&&Ext.isEmpty(d)?(this.viewPanel.getView().emptyText='<div class="emptytext">'+this.emptyGridText+"</div>",this.addressBookStore.removeAll()):(this.viewPanel.getView().emptyText=
'<div class="emptytext">'+this.noResultsGridText+"</div>",this.addressBookStore.load({actionType:Zarafa.core.Actions.list,params:{subActionType:Zarafa.core.Actions.globaladdressbook,entryid:a.get("entryid"),store_entryid:a.get("store_entryid"),restriction:Ext.applyIf({searchstring:d},this.listRestriction),folderType:b}}))}},getSelectedFolderRecord:function(){var a=this.addressBookSelectionCB.getValue(),a=Zarafa.addressbook.AddressBookHierarchyStore.find("entryid",a);return Zarafa.addressbook.AddressBookHierarchyStore.getAt(a)},
onSearchTextFiledKeyUp:function(a,b){if(b.getKey()===b.ENTER)this.onSearchButtonClick()}});Ext.reg("zarafa.addressbookmainpanel",Zarafa.addressbook.ui.AddressBookMainPanel);Ext.namespace("Zarafa.advancesearch");
Zarafa.advancesearch.Actions={openSelectSearchFolderDialog:function(a){a=Ext.applyIf(a||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["search.dialog.selectfolder"],[],a)},openCreateSearchFolderContentPanel:function(a,b){b=Ext.apply(b||{},{modal:!0,manager:Ext.WindowMgr,iconCls:"icon_favorites",closable:!1,resizable:!1,showModalWithoutParent:!0});var c=a.createSearchFolderRecord(b.searchText);Zarafa.core.data.UIFactory.openCreateRecord(c,b)}};Ext.namespace("Zarafa.advancesearch.data");
Zarafa.advancesearch.data.DateRangeFields=[{name:_("Any date"),value:"all_dates"},{name:_("Past week"),value:"past_week"},{name:_("Past 2 weeks"),value:"past_two_weeks"},{name:_("Past month"),value:"past_month"},{name:_("Past 6 month"),value:"past_six_month"},{name:_("Past year"),value:"past_year"},{name:_("Custom date"),value:"custom_date"}];Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.CreateSearchFolderPanel=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"k-create-search-folder-panel",items:[{xtype:"displayfield",value:_("Add a folder to favorites based on your search query"),hideLabel:!0,margins:"0 0 9 0",anchor:"100%"},{xtype:"container",layout:"form",labelAlign:"top",items:[{xtype:"textfield",ref:"../../searchFolderTextField",fieldLabel:_("Folder name"),labelSeparator:"",anchor:"100%"}]}]});Zarafa.advancesearch.dialogs.CreateSearchFolderPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.createsearchfolderpanel",Zarafa.advancesearch.dialogs.CreateSearchFolderPanel);Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SearchCenterPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.searchContext)&&(a.model=a.searchContext.getModel());Ext.applyIf(a,{xtype:"zarafa.searchcenterpanel",cls:"k-searchcenterpanel",region:"center",layout:"fit",ref:"centerRegion",unstyled:!0,items:[{xtype:"panel",layout:"zarafa.switchborder",ref:"switchBorder",border:!1,unstyled:!0,items:[{layout:"fit",cls:"zarafa-context-mainpanel",collapsible:!1,region:"center",
items:[{xtype:"zarafa.switchviewcontentcontainer",ref:"../viewPanel",layout:"card",activeItem:0,items:[{xtype:"zarafa.searchgrid",flex:1,id:"search-grid"+ ++Ext.Component.AUTO_ID,searchTabId:a.searchTabId,anchor:"100%",searchContext:a.searchContext,ref:"../../searchGrid",searchCenterPanel:this}]}]},{region:"south",xtype:"zarafa.searchresultpreviewpanel",ref:"../searchResultPreviewPanel",split:!0,width:400,height:400,searchContext:a.searchContext}]}]});Zarafa.advancesearch.dialogs.SearchCenterPanel.superclass.constructor.call(this,
a)},initEvents:function(){Ext.isDefined(this.searchContext)&&(this.switchBorder.mon(this.searchContext,{viewchange:this.onViewChange,viewmodechange:this.onViewModeChange,scope:this}),this.switchBorder.on("afterlayout",this.onAfterLayout,this,{single:!0}))},getSearchResultPreviewPanel:function(){return this.searchResultPreviewPanel},onAfterLayout:function(){this.onViewModeChange(this.searchContext,this.searchContext.getCurrentViewMode())},onViewChange:function(a,b,c){b===Zarafa.common.data.Views.LIST&&
(a=this.switchBorder.searchGrid.getId(),this.switchBorder.viewPanel.switchView(a))},onViewModeChange:function(a,b,c){var d;switch(b){case Zarafa.common.data.ViewModes.NO_PREVIEW:d=Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.OFF;break;case Zarafa.common.data.ViewModes.RIGHT_PREVIEW:d=Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.HORIZONTAL;this.getSearchResultPreviewPanel().getTopToolbar().onHide();break;case Zarafa.common.data.ViewModes.BOTTOM_PREVIEW:d=Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.VERTICAL;
a=this.model.getPreviewRecord();if(Ext.isDefined(a))this.getSearchResultPreviewPanel().getTopToolbar().onShow();break;case Zarafa.common.data.ViewModes.SEARCH:case Zarafa.common.data.ViewModes.LIVESCROLL:return}a=this.switchBorder.getLayout();Ext.isFunction(a.setOrientation)?a.setOrientation(d):Ext.isString(a)?this.layoutConfig=Ext.apply(this.layoutConfig||{},{orientation:d}):this.layout.orientation=d}});Ext.reg("zarafa.searchcenterpanel",Zarafa.advancesearch.dialogs.SearchCenterPanel);Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SearchPanel=Ext.extend(Ext.Panel,{searchContentPanel:void 0,constructor:function(a){a=a||{};var b=container.getContextByName("advancesearch");if(!Ext.isDefined(a.model)&&Ext.isDefined(b)){a.model=b.getModel();Ext.isDefined(a.searchFolder)&&(a.model.store.searchFolder[a.searchTabId]=a.searchFolder);var c=container.getCurrentContext().getModel();b.enable(c.getDefaultFolder(),!0)}Ext.applyIf(a,{xtype:"zarafa.searchpanel",layout:"border",border:!1,items:[{xtype:"zarafa.searchtoolboxpanel",
searchContext:b,searchTabId:a.searchTabId,collapsed:Ext.isDefined(a.searchFolder),region:"west",scope:this},{xtype:"zarafa.searchcenterpanel",searchContext:b,searchTabId:a.searchTabId,region:"center",searchPanel:this,scope:this},{xtype:"zarafa.searchtoolbarpanel",searchContext:b,searchText:a.searchText,region:"north",scope:this}]});Zarafa.advancesearch.dialogs.SearchPanel.superclass.constructor.call(this,a)},initEvents:function(){this.mon(this.centerRegion.getSearchResultPreviewPanel(),{afterupdatesearchpreviewpanel:this.onAfterUpdateSearchPreviewPanel,
scope:this});this.mon(this.searchContentPanel,{beforeclose:this.onBeforeCloseContentPanel,scope:this});this.mon(this.centerRegion.switchBorder.searchGrid,{resize:this.onSearchGridResize,scope:this});this.mon(this.searchToolBox,{afterupdaterestriction:this.onAfterUpdateRestriction,scope:this});this.mon(this.searchToolBox,"afterlayout",this.onAfterRenderSearchToolBox,this,{single:!0});this.mon(this.model,{searchfinished:this.onModelSearchFinished,searchexception:this.onModelSearchException,scope:this});
this.mon(this.searchToolBox.includeSubFolderFieldSet,{beforerender:this.onBeforeRenderSubFolderFieldSet,scope:this});this.mon(this.searchToolBox.includeSubFolder,{check:this.onCheckIncludeSubFolder,render:this.onRenderSubFolderCheckbox,scope:this});this.searchToolbar.mon(this.searchToolbar.getAdvanceSearchField(),{render:this.onRenderSearchTextField,valid:this.onValidSearchTextField,change:this.onChangeSearchTextField,start:this.onSearchStart,stop:this.onSearchStop,scope:this});this.searchToolbar.mon(this.searchToolbar.getSearchFolderCombo(),
{render:this.onRenderSearchFolderCombo,select:this.onSelectSearchFolderComboValue,beforeselect:this.onBeforeSelectSearchFolder,scope:this});this.mon(container,{aftercontextswitch:this.onAfterContextSwitch,scope:this});this.mon(container.getHierarchyStore(),"addFolder",this.onHierarchyAddFolder,this);this.mon(container.getHierarchyStore(),"removeFolder",this.onHierarchyRemoveFolder,this)},onHierarchyAddFolder:function(a,b,c){if(Ext.isArray(c))c.forEach(function(c){this.onHierarchyAddFolder(a,b,c)},
this);else{var d=this.model.getActiveStore(),e=d.searchStoreUniqueId,f=this.searchToolBox;if(c.isSearchFolder()&&e===f.searchTabId){d.searchFolder[d.searchStoreUniqueId]=c;this.suspendEvents();var g={},d=f.searchInCheckboxGroup.getValue(),e=f.messageTypeCheckboxGroup.getValue(),h=f.filterCheckBoxGroup.getValue(),k=f.dateRangeCombo;g.searchInCheckBoxGroup={};g.messageTypeCheckBoxGroup={};g.filterCheckBoxGroup={};g.search_text=this.searchText;g.search_folder_combo={};d.forEach(function(a){g.searchInCheckBoxGroup[a.itemId]=
!0},this);e.forEach(function(a){g.messageTypeCheckBoxGroup[a.name]=!0},this);h.forEach(function(a){g.filterCheckBoxGroup[a.name]=!0},this);"custom_date"===k.getValue()?(g.date_range={},Ext.apply(g.date_range,{start:f.dateField.getValue().getStartDate().getTime(),due:f.dateField.getValue().getDueDate().getTime()})):g.date_range=k.getValue();f=this.searchToolbar.getSearchFolderCombo();f=f.getStore().getAt(f.getStore().find("value",f.getValue()));f.get("flag")===Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.ALL_FOLDERS?
g.search_folder_combo.folder_type=f.get("flag"):(g.search_folder_combo.folder_entryid=f.get("value"),g.search_folder_combo.folder_name=f.get("name"),g.search_folder_combo.folder_type=f.get("flag"),g.search_folder_combo.include_subfolder=f.get("include_subfolder"));container.getSettingsModel().set("zarafa/v1/contexts/search/search_criteria/"+c.get("entryid"),g);this.resumeEvents()}}},onHierarchyRemoveFolder:function(a,b,c){(a=this.model.getActiveStore().searchFolder[this.searchToolBox.searchTabId])&&
Zarafa.core.EntryId.compareEntryIds(a.get("entryid"),c.get("entryid"))&&c.addMessageAction("keepSearchFolder",!0)},onAfterContextSwitch:function(a,b,c){a=container.getTabPanel().getActiveTab().getActiveItem().getTopToolbar();var d;Ext.isDefined(a)&&Ext.isDefined(d=a.searchTextfield)?this.searchContentPanel.setParentSearchField(d):this.searchContentPanel.setParentSearchField(void 0)},onBeforeCloseContentPanel:function(a){this.resetParentSearchField();var b=this.searchContentPanel.getParentSearchField();
b&&(b.searchPanelRendered=!1);var b=!1,c=this.model;c.getActiveStore().getSearchStoreUniqueId()!==a.name&&(b=this.model.store,c.setActiveStore(c.stores[a.name]));this.onSearchStop();Ext.isDefined(c.getSelectedRecords())&&c.setSelectedRecords(void 0);c.discardStore(a.name);!1!==b&&c.setActiveStore(b)},onModelSearchFinished:function(a){this.resetParentSearchField();this.searchToolbar.getAdvanceSearchField().hideMask()},resetParentSearchField:function(){var a=this.searchContentPanel.getParentSearchField();
Ext.isDefined(a)&&(a.reset(),a.hideMask())},onModelSearchException:function(a,b,c,d,e,f,g){a=this.searchToolbar.getAdvanceSearchField();a.hideMask();a.focus()},onSearchStart:function(a){a=a.getValue();this.searchContentPanel.searchText=a;var b=this.searchToolbar.getAdvanceSearchField();this.searchContentPanel.setTitle(a);b.getValue()!==a&&b.setValue(a);a=this.searchToolBox.createRestriction(a);var c=this.searchToolbar.getSearchFolderCombo(),b=container.getHierarchyStore().getFolder(c.getValue()),
c=c.findRecord("value",c.getValue()).get("include_subfolder");this.model.startSearch(a,c,{folder:b});container.getTabPanel().setActiveTab(this.searchContentPanel)},onSearchStop:function(){var a=this.model.getActiveStore();Ext.isDefined(a.searchFolder[a.searchStoreUniqueId])?(-1===container.getHierarchyStore().getDefaultStore().getFavoritesStore().findExact("entryid",a.searchFolderEntryId)&&this.model.stopSearch(),delete a.searchFolder[a.searchStoreUniqueId]):this.model.stopSearch();Ext.isDefined(this.searchToolbar)&&
this.searchToolbar.getAdvanceSearchField().focus()},onAfterRenderSearchToolBox:function(){var a=this.searchToolbar.getAdvanceSearchField();a.searchPanelRendered=this.rendered;var b=this.model.getActiveStore();if(Ext.isDefined(b.searchFolder[b.searchStoreUniqueId]))a=Ext.applyIf({},{folder:b.searchFolder[b.searchStoreUniqueId]}),b.load(a),b.hasSearchResults=!0;else a.onTriggerClick()},onAfterUpdateRestriction:function(){this.searchToolbar.getAdvanceSearchField().onTriggerClick()},onRenderSearchTextField:function(a){var b=
this.searchToolBox.getSearchFolderSettings();b?a.setValue(b.search_text):a.setValue(this.searchText)},onValidSearchTextField:function(a){this.searchText=a.getValue()},onChangeSearchTextField:function(a,b,c){this.searchText=b},onRenderSearchFolderCombo:function(a){var b=this.searchToolBox.getSearchFolderSettings();if(b){var b=b.search_folder_combo,c=a.getStore();if(b.folder_type===Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.ALL_FOLDERS)var d=c.getAt(c.find("flag",b.folder_type)),b=d.get("value");
else{var e=0;b.folder_type===Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.CURRENT_SELECTED_FOLDER?(e=1,c.removeAt(e)):c.getAt(0).get("flag")===Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.IMPORTED_FOLDER&&c.removeAt(e);d=new Ext.data.Record({name:b.folder_name,value:b.folder_entryid,flag:b.folder_type,include_subfolder:b.include_subfolder});c.insert(e,d);b=b.folder_entryid}}else a.store.clearData(),b=this.searchContentPanel.getParentSearchFolderCombo(),b.store.getRange().forEach(function(b){a.store.add(b.copy())}),
b=b.getValue();a.setValue(b)},onSelectSearchFolderComboValue:function(a,b,c){a=this.searchToolBox.includeSubFolder;a.setValue(b.get("include_subfolder"));this.onRenderSubFolderCheckbox(a)},onBeforeRenderSubFolderFieldSet:function(a){var b=this.searchToolbar.getSearchFolderCombo(),b=container.getHierarchyStore().getFolder(b.getValue());a.hidden=!this.model.supportsSearchFolder(b)},onCheckIncludeSubFolder:function(a,b){var c=this.searchToolbar.getSearchFolderCombo(),c=c.findRecord("value",c.getValue());
b!==c.get("include_subfolder")&&(c.set("include_subfolder",b),c.commit(),this.searchToolBox.afterUpdateRestriction())},onRenderSubFolderCheckbox:function(a){var b=this.searchToolbar.getSearchFolderCombo(),b=b.findRecord("value",b.getValue()),c=b.get("flag")===Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.ALL_FOLDERS;a.setDisabled(c);a.setValue(b.get("include_subfolder"));a.rendered&&(c?a.wrap.dom.qtip=_("All folders are selected"):delete a.wrap.dom.qtip)},onBeforeSelectSearchFolder:function(a,
b,c){if("other"===b.get("value"))return a.collapse(),Zarafa.advancesearch.Actions.openSelectSearchFolderDialog({searchFolderCombo:a,model:this.model}),!1;a=container.getHierarchyStore().getFolder(b.get("value"));this.searchToolBox.includeSubFolderFieldSet.setVisible(this.model.supportsSearchFolder(a));this.doLayout();return!0},onSearchGridResize:function(a,b,c,d,e){a=this.searchToolbar.contextMainPanelToolbar;c=this.searchToolbar.getRightSearchToolbar();d=this.getLayout().west;e=d.getMargins();e=
e.left+e.right;a.setWidth(d.getSize().width+e+b);c.setWidth(this.centerRegion.switchBorder.getLayout().south.getSize().width);c.setPosition(a.getWidth())},onAfterUpdateSearchPreviewPanel:function(a,b,c){c=this.searchToolbar.getRightSearchToolbar();c.setVisible(!!b);if(b){var d=b.isFaultyMessage(),e=Zarafa.core.MessageClass.isClass(b.get("message_class"),["IPM.NOTE","REPORT.IPM","IPM.SCHEDULE","IPM.APPOINTMENT"]);e&&Zarafa.core.MessageClass.isClass(b.get("message_class"),["IPM.APPOINTMENT"])&&(b.isMeeting()||
(e=!1));c.replyBtn.setVisible(!d&&e);c.replyAllBtn.setVisible(!d&&e);c.forwardBtn.setVisible(!d&&e);if(Zarafa.supportsPopOut()){var f=Zarafa.core.MessageClass.isClass(b.get("message_class"),["IPM.NOTE","REPORT.IPM.Note","IPM.Schedule.Meeting"],!0);c.popoutBtn.setVisible(f)}a=a.model.getDefaultFolder();c.editAsNewBtn.setVisible("sent"===a.getDefaultFolderKey()&&!d&&e);this.searchToolbar.recordComponentPlugin.setRecord(b)}}});Ext.reg("zarafa.searchpanel",Zarafa.advancesearch.dialogs.SearchPanel);Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SearchToolBoxPanel=Ext.extend(Ext.Panel,{model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.searchContext)&&(a.model=a.searchContext.getModel());var b={},c={},d={},e=this.getSearchFolderSettings(a.model,a.searchTabId);e&&(b=e.messageTypeCheckBoxGroup||{},c=e.filterCheckBoxGroup||{},d=e.searchInCheckBoxGroup||{});a.messageClasses={};a.folder=void 0;a.searchFields={};a.searchCriteria={};a.searchCriteria.date_range={};a.searchCriteria.date_range.start=
0;a.searchCriteria.date_range.end=0;e={xtype:"jsonstore",autoDestroy:!0,fields:["name","value"],autoLoad:!0,data:Zarafa.advancesearch.data.DateRangeFields};Ext.applyIf(a,{xtype:"zarafa.searchtoolboxpanel",title:_("Search tools"),width:175,iconCls:"advance_search",cls:"zarafa-search-toolbox",plugins:[{ptype:"zarafa.recordcomponentplugin"},{ptype:"zarafa.recordcomponentupdaterplugin"}],collapsible:!0,layout:"fit",unstyled:!0,ref:"searchToolBox",items:[{xtype:"container",autoScroll:!0,items:[this.createFoldersFieldset(),
this.createMessageTypeFieldset(b),this.createFilterFieldset(c),this.createDateRangeFieldset(e),this.createSearchInFieldset(d),this.createFavoritesContainer(a)]}]});this.addEvents("afterupdaterestriction");Zarafa.advancesearch.dialogs.SearchToolBoxPanel.superclass.constructor.call(this,a)},createFoldersFieldset:function(){return{layout:"form",xtype:"fieldset",width:156,border:!1,title:_("Folders"),ref:"../includeSubFolderFieldSet",items:[{xtype:"checkbox",hideLabel:!0,ref:"../../includeSubFolder",
boxLabel:_("Include subfolders")}]}},createMessageTypeFieldset:function(a){return{layout:"form",xtype:"fieldset",width:156,border:!1,title:_("Show.."),items:[{xtype:"checkboxgroup",ref:"../../messageTypeCheckboxGroup",columns:1,name:"messageTypeCheckboxGroup",hideLabel:!0,listeners:{change:this.onMessageTypeCheckboxChange,scope:this},items:[{name:"mail",boxLabel:_("Mails"),checked:Ext.isDefined(a.mail)},{name:"calendar",boxLabel:_("Appointments"),checked:Ext.isDefined(a.calendar)},{name:"contact",
boxLabel:_("Contacts"),checked:Ext.isDefined(a.contact)},{name:"task",boxLabel:_("Tasks"),checked:Ext.isDefined(a.task)},{name:"note",boxLabel:_("Notes"),checked:Ext.isDefined(a.note)}]}]}},createFilterFieldset:function(a){return{layout:"form",xtype:"fieldset",width:156,border:!1,title:_("Filter.."),items:[{xtype:"checkboxgroup",columns:1,ref:"../../filterCheckBoxGroup",hideLabel:!0,name:"filterCheckBoxGroup",listeners:{change:this.onFilterCheckBoxGroup,render:this.onRenderCheckboxGroup,scope:this},
items:[{name:"message_flags",boxLabel:_("Unread"),checked:Ext.isDefined(a.message_flags)},{name:"hasattach",boxLabel:_("Attachments"),checked:Ext.isDefined(a.hasattach)}]}]}},createDateRangeFieldset:function(a){return{layout:"form",xtype:"fieldset",border:!1,title:_("Date"),items:[{xtype:"combo",displayField:"name",editable:!1,hideLabel:!0,ref:"../../dateRangeCombo",store:a,valueField:"value",value:a.data[0].value,mode:"local",triggerAction:"all",width:146,listeners:{select:this.onSelectCombo,beforerender:this.onBeforeRenderDateRangeCombo,
scope:this}},{xtype:"zarafa.dateperiodfield",ref:"../../dateField",hidden:!0,allowBlank:!1,defaultValue:new Zarafa.core.DateRange({allowBlank:!1,startDate:(new Date).add(Date.MONTH,-1),dueDate:new Date}),startFieldConfig:{labelSeparator:"",fieldLabel:_("From"),labelStyle:"width : 35px",itemCls:"zarafa-dateperiodfield-itemsCls",labelWidth:50,width:110},endFieldConfig:{labelSeparator:"",fieldLabel:_("To"),labelStyle:"width : 35px",itemCls:"zarafa-dateperiodfield-itemsCls",labelWidth:50,width:110}}]}},
createSearchInFieldset:function(a){return{layout:"form",xtype:"fieldset",width:160,border:!1,title:_("Search.."),items:[{xtype:"checkboxgroup",columns:1,ref:"../../searchInCheckboxGroup",name:"searchInCheckboxGroup",hideLabel:!0,listeners:{change:this.onSearchInCheckboxChange,render:this.onRenderCheckboxGroup,scope:this},items:[{name:["sender_name","sender_email_address"],itemId:"sender",boxLabel:_("Sender"),checked:Ext.isDefined(a.sender)},{name:["display_to","display_cc","display_bcc"],itemId:"recipients",
boxLabel:_("Recipients"),checked:Ext.isDefined(a.recipients)},{name:"subject",itemId:"subject",boxLabel:_("Subject"),checked:Ext.isDefined(a.subject)},{name:"body",itemId:"body",boxLabel:_("Body & Attachments"),checked:Ext.isDefined(a.body)}]}]}},createFavoritesContainer:function(){return{xtype:"container",cls:"zarafa-search-toolbox-favoritesbutton-container",layout:"fit",items:[{cls:"search-toolbox-favorites-button",xtype:"button",text:"<span>"+_("Favorites")+"</span>",handler:this.onClickFavorites,
tooltip:{text:_("Add a folder to favorites based on this search query"),width:350},scope:this}]}},initEvents:function(){this.mon(this.messageTypeCheckboxGroup,{render:this.onRenderCheckboxGroup,scope:this});this.mon(this.dateRangeCombo,{enable:this.onEnableCombo,scope:this});this.mon(this.dateField,{change:this.onChangeDateField,scope:this});this.dateField.mon(this.dateField.startField,"specialkey",this.onSpecialKey,this);this.dateField.mon(this.dateField.endField,"specialkey",this.onSpecialKey,this)},
onBeforeRenderDateRangeCombo:function(a){var b=this.getSearchFolderSettings();if(b){var b=b.date_range,c=a.findRecord(a.valueField,b);this.setDateRangeRestriction(a,c);Ext.isObject(b)?(a.setValue("custom_date"),this.dateField.hidden=!1,a=new Date(b.due),this.dateField.startField.setValue(new Date(b.start)),this.dateField.endField.setValue(a)):a.setValue(b)}},getSearchFolderSettings:function(a,b){var c=(Ext.isDefined(a)?a:this.model).store;b=Ext.isDefined(b)?b:c.searchStoreUniqueId;return Ext.isDefined(c.searchFolder[b])?
(c=c.searchFolder[b],container.getSettingsModel().getSettingsObject("zarafa/v1/contexts/search/search_criteria/"+c.get("entryid"))):!1},onSpecialKey:function(a,b){b.getKey()===b.ENTER&&a.triggerBlur()},setDateRangeRestriction:function(a,b){var c=b.get("value"),d=new Date;this.searchCriteria.date_range.end=d.add(Date.DAY,1).getTime()/1E3;"custom_date"!==c&&this.dateField.isVisible()&&(this.dateField.hide(),this.doLayout());switch(c){case "past_week":this.searchCriteria.date_range.start=d.add(Date.DAY,
-7).getTime()/1E3;break;case "past_two_weeks":this.searchCriteria.date_range.start=d.add(Date.DAY,-14).getTime()/1E3;break;case "past_month":this.searchCriteria.date_range.start=d.add(Date.MONTH,-1).getTime()/1E3;break;case "past_six_month":this.searchCriteria.date_range.start=d.add(Date.MONTH,-6).getTime()/1E3;break;case "past_year":this.searchCriteria.date_range.start=d.add(Date.YEAR,-1).getTime()/1E3;break;case "custom_date":this.dateField.show();this.doLayout();this.searchCriteria.date_range.start=
this.dateField.startField.getValue().getTime()/1E3;this.searchCriteria.date_range.end=this.dateField.endField.getValue().add(Date.DAY,1).getTime()/1E3;break;default:this.searchCriteria.date_range.start=0,this.searchCriteria.date_range.end=0}},onSelectCombo:function(a,b){this.setDateRangeRestriction(a,b);this.afterUpdateRestriction()},onFilterCheckBoxGroup:function(a,b){this.setFilterRestriction(a,b);this.afterUpdateRestriction()},onMessageTypeCheckboxChange:function(a,b){this.setMessageClassRestriction(a,
b);this.afterUpdateRestriction()},onSearchInCheckboxChange:function(a,b){this.setSearchInRestriction(a,b);this.afterUpdateRestriction()},setSearchInRestriction:function(a,b){if(Ext.isEmpty(b))this.setMessageClassRestriction(this.messageTypeCheckboxGroup,this.messageTypeCheckboxGroup.getValue());else{var c=[];b.forEach(function(a){c=c.concat(a.name)});this.searchCriteria.search_fields=c}},afterUpdateRestriction:function(){this.fireEvent("afterupdaterestriction",this)},onRenderCheckboxGroup:function(a){switch(a.name){case "filterCheckBoxGroup":this.setFilterRestriction(a,
a.getValue());break;case "searchInCheckboxGroup":this.setSearchInRestriction(a,a.getValue());break;default:this.setMessageClassRestriction(a,a.getValue())}},setFilterRestriction:function(a,b){this.searchCriteria.extra_fields=b.map(function(a){return a.name})},setMessageClassRestriction:function(a,b){var c=function(a,b,c){return c.indexOf(a)===b},d=[],e=[];Ext.isEmpty(b)&&(b=a.items.items);var f=this.searchInCheckboxGroup.getValue(),g=[];Ext.isEmpty(f)||f.forEach(function(a){g=g.concat(a.name)},this);
b.forEach(function(a){d=d.concat(this.getMessageClass(a.name));Ext.isEmpty(g)&&(e=e.concat(Zarafa[a.name].data.SearchFields[0].value.split(" ")))},this);Ext.isEmpty(g)||(e=g);this.searchCriteria.message_class=d.filter(c);this.searchCriteria.search_fields=e.filter(c)},getMessageClass:function(a){switch(a){case "mail":return["IPM.Note"];case "calendar":return["IPM.Appointment","IPM.Schedule"];case "contact":return["IPM.Contact","IPM.DistList"];case "task":return["IPM.Task"];case "note":return["IPM.StickyNote"]}},
onChangeDateField:function(a,b,c){a=b.startDate.getTime()/1E3;var d=b.dueDate.add(Date.DAY,1).getTime()/1E3;this.searchCriteria.date_range.start=a;this.searchCriteria.date_range.end=d;0!==b.compare(c)&&this.afterUpdateRestriction()},onEnableCombo:function(a){var b=a.getStore().find("value",a.getValue()),b=a.getStore().getAt(b);this.onSelectCombo(a,b)},onClickFavorites:function(){var a={searchText:this.dialog.searchText,searchStoreEntryId:this.model.getStore().searchStoreEntryId,includeSubFolder:this.includeSubFolder.getValue(),
searchFolderEntryId:this.model.store.searchFolderEntryId};Zarafa.advancesearch.Actions.openCreateSearchFolderContentPanel(this.model,a)},createRestriction:function(a){if(Ext.isEmpty(a))return[];var b=[],c=[],d=[],e=[],f=[],g=[];Ext.iterate(this.searchCriteria,function(b,c){"search_fields"===b&&Ext.each(c,function(b){e.push(Zarafa.core.data.RestrictionFactory.dataResContent(b,Zarafa.core.mapi.Restrictions.FL_SUBSTRING|Zarafa.core.mapi.Restrictions.FL_IGNORECASE,a))},this);"extra_fields"===b&&Ext.each(c,
function(a){"hasattach"===a&&g.push(Zarafa.core.data.RestrictionFactory.dataResProperty(a,Zarafa.core.mapi.Restrictions.RELOP_EQ,!0));"message_flags"===a&&g.push(Zarafa.core.data.RestrictionFactory.dataResBitmask(a,Zarafa.core.mapi.Restrictions.BMR_EQZ,Zarafa.core.mapi.MessageFlags.MSGFLAG_READ))});"date_range"===b&&0!==c.start&&0!==c.end&&(d=Zarafa.core.data.RestrictionFactory.createResOr([Zarafa.core.data.RestrictionFactory.createResAnd([Zarafa.core.data.RestrictionFactory.createResNot(Zarafa.core.data.RestrictionFactory.dataResExist("PR_MESSAGE_DELIVERY_TIME")),
Zarafa.core.data.RestrictionFactory.dataResProperty("last_modification_time",Zarafa.core.mapi.Restrictions.RELOP_GE,c.start),Zarafa.core.data.RestrictionFactory.dataResProperty("last_modification_time",Zarafa.core.mapi.Restrictions.RELOP_LT,c.end)]),Zarafa.core.data.RestrictionFactory.createResAnd([Zarafa.core.data.RestrictionFactory.dataResExist("PR_MESSAGE_DELIVERY_TIME"),Zarafa.core.data.RestrictionFactory.dataResProperty("message_delivery_time",Zarafa.core.mapi.Restrictions.RELOP_GE,c.start),
Zarafa.core.data.RestrictionFactory.dataResProperty("message_delivery_time",Zarafa.core.mapi.Restrictions.RELOP_LT,c.end)])]));"message_class"!==b||Ext.isEmpty(c)||Ext.each(c,function(a){f.push(Zarafa.core.data.RestrictionFactory.dataResContent(b,Zarafa.core.mapi.Restrictions.FL_PREFIX|Zarafa.core.mapi.Restrictions.FL_IGNORECASE,a))},this)},this);if(Ext.isEmpty(d))c.push(Zarafa.core.data.RestrictionFactory.createResOr(e));else{var h=[];h.push(d);h.push(Zarafa.core.data.RestrictionFactory.createResOr(e));
c.push(Zarafa.core.data.RestrictionFactory.createResAnd(h))}c.push(Zarafa.core.data.RestrictionFactory.createResOr(f));Ext.isEmpty(g)||c.push(Zarafa.core.data.RestrictionFactory.createResAnd(g));Ext.isEmpty(c)||(b=Zarafa.core.data.RestrictionFactory.createResAnd(c));return b}});Ext.reg("zarafa.searchtoolboxpanel",Zarafa.advancesearch.dialogs.SearchToolBoxPanel);Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SearchToolbarPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.searchContext)&&(a.model=a.searchContext.getModel());Ext.applyIf(a,{xtype:"zarafa.searchtoolbarpanel",layout:"hbox",ref:"searchToolbar",cls:"k-search-toolbar-panel",border:!1,plugins:[{ptype:"zarafa.recordcomponentplugin",enableOpenLoadTask:!0,autoOpenLoadTaskDefer:250},{ptype:"zarafa.recordcomponentupdaterplugin"}],height:35,items:[{xtype:"zarafa.searchpaneltoolbar",
style:"border-style : none",searchText:a.searchText,context:a.searchContext},{xtype:"zarafa.toolbar",style:"border-style : none; margin-left:5px;",cls:"zarafa-previewpanel-toolbar zarafa-search-previewpanel-toolbar zarafa-context-mainpanel",ref:"rightSearchToolbar",hidden:!0,items:[container.populateInsertionPoint("previewpanel.toolbar.left",{scope:this,model:a.model}),{xtype:"tbfill"},container.populateInsertionPoint("previewpanel.toolbar.right.first",{scope:this,model:a.model}),{xtype:"button",
tooltip:_("Reply")+" (Ctrl + R)",overflowText:_("Reply"),iconCls:"icon_replyEmail",ref:"replyBtn",responseMode:Zarafa.mail.data.ActionTypes.REPLY,handler:this.onResponse,scope:this},{xtype:"button",tooltip:_("Reply All")+" (Ctrl + Alt + R)",overflowText:_("Reply All"),iconCls:"icon_replyAllEmail",ref:"replyAllBtn",responseMode:Zarafa.mail.data.ActionTypes.REPLYALL,handler:this.onResponse,scope:this},{xtype:"button",tooltip:_("Forward")+" (Ctrl + F)",overflowText:_("Forward"),iconCls:"icon_forwardEmail",
ref:"forwardBtn",responseMode:Zarafa.mail.data.ActionTypes.FORWARD,handler:this.onResponse,scope:this},{xtype:"button",tooltip:_("Edit as New Message")+" (Ctrl + E)",overflowText:_("Edit as New Message"),iconCls:"icon_editAsNewEmail",ref:"editAsNewBtn",responseMode:Zarafa.mail.data.ActionTypes.EDIT_AS_NEW,handler:this.onResponse,scope:this},container.populateInsertionPoint("previewpanel.toolbar.right",{scope:this,model:a.model})]}]});Zarafa.advancesearch.dialogs.SearchToolbarPanel.superclass.constructor.call(this,
a)},getSearchFieldContainer:function(){return this.contextMainPanelToolbar.searchFieldContainer},getAdvanceSearchField:function(){return this.getSearchFieldContainer().searchTextField},getSearchFolderCombo:function(){return this.getSearchFieldContainer().searchFolderCombo},update:function(a,b){this.record=a},getRightSearchToolbar:function(){return this.rightSearchToolbar},onResponse:function(a){var b=container.getContextByName("mail").getModel();Zarafa.mail.Actions.openCreateMailResponseContent(this.record,
b,a.responseMode)}});Ext.reg("zarafa.searchtoolbarpanel",Zarafa.advancesearch.dialogs.SearchToolbarPanel);Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SelectFolderPanel=Ext.extend(Ext.Panel,{searchFolderCombo:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.selectfolderpanel",layout:{type:"fit",align:"stretch"},border:!1,searchFolderCombo:a.searchFolderCombo,header:!1,items:[this.createTreePanel()],buttonAlign:"right",buttons:[{text:_("Ok"),handler:this.onOk,disabled:!0,ref:"../okButton",cls:"zarafa-action",scope:this},{text:_("Cancel"),disabled:!0,ref:"../cancelButton",handler:this.onCancel,scope:this}]});
Zarafa.advancesearch.dialogs.SelectFolderPanel.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.advancesearch.dialogs.SelectFolderPanel.superclass.initEvents.apply(this,arguments);this.mon(this.hierarchyTree,"load",this.onTreeNodeLoad,this);this.mon(this.hierarchyTree.getSelectionModel(),"selectionchange",this.onSelectionChange,this)},createTreePanel:function(){return{xtype:"panel",layout:{type:"vbox",align:"stretch"},defaults:{margins:"0 0 5 0"},border:!1,flex:1,bodyStyle:"background-color: inherit;",
items:[{xtype:"zarafa.hierarchytree",flex:1,border:!0,treeSorter:!0,hideFavorites:!0,enableDD:!1,anchor:"100% 90%",ref:"../hierarchyTree"},{xtype:"checkbox",hideLabel:!0,ref:"../includeSubFolder",boxLabel:_("Include subfolders")}]}},onSelectionChange:function(a,b){!Ext.isDefined(b)||b.getFolder().isIPMSubTree()&&this.objectType==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?(this.okButton.disable(),this.cancelButton.disable()):(this.okButton.enable(),this.cancelButton.enable(),this.updateIncludeSubFolderCheckBox(b))},
updateIncludeSubFolderCheckBox:function(a){var b=this.model.supportsSearchFolder(a.getFolder());this.includeSubFolder.setVisible(b);if(b){var c=this.searchFolderCombo.findRecord("value",a.getFolder().get("entryid")),b=a=!1;Ext.isDefined(c)&&(a=c.get("include_subfolder"),b=c.get("flag")===Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.ALL_FOLDERS);c=this.includeSubFolder;c.setValue(a);c.setDisabled(b);c.rendered&&(b?c.wrap.dom.qtip=_("All folders are selected"):delete c.wrap.dom.qtip)}},onTreeNodeLoad:function(){var a=
container.getHierarchyStore().getFolder(this.searchFolderCombo.getValue());this.hierarchyTree.selectFolderInTree(a)&&this.mun(this.hierarchyTree,"load",this.onTreeNodeLoad,this)},onOk:function(){var a=this.hierarchyTree.getSelectionModel().getSelectedNode().getFolder();if(Ext.isDefined(a)){var b=this.includeSubFolder.checked,c=this.searchFolderCombo.getStore(),d=c.getAt(c.findExact("value",a.get("entryid")));Ext.isDefined(d)?d.set("include_subfolder",b):(d=Zarafa.advancesearch.data.SearchComboBoxFieldsFlags.IMPORTED_FOLDER,
c.getAt(0).get("flag")===d&&c.removeAt(0),d=new Ext.data.Record({name:a.get("display_name"),value:a.get("entryid"),flag:d,include_subfolder:b}),c.insert(0,d));this.searchFolderCombo.setValue(d.get("value"));this.searchFolderCombo.onSelect(d,0);this.dialog.close()}},onCancel:function(){this.dialog.close()}});Ext.reg("zarafa.selectfolderpanel",Zarafa.advancesearch.dialogs.SelectFolderPanel);Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.AdvanceSearchRowSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{handleMouseDown:function(a,b,c){var d=!1;-1!==c.target.className.indexOf("icon")&&(d=!0);!0!==d&&Zarafa.advancesearch.ui.AdvanceSearchRowSelectionModel.superclass.handleMouseDown.call(this,a,b,c)}});Ext.reg("zarafa.advancesearchrowselectionmodel",Zarafa.advancesearch.ui.AdvanceSearchRowSelectionModel);Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.SearchGridRenderers={subjectWithBodyColumn:function(a,b,c){b.css="search-data";Ext.isEmpty(a)&&(b.css+=" zarafa-grid-empty-cell");b=a="";switch(c.get("message_class")){case "IPM.Contact":a=Zarafa.advancesearch.ui.SearchGridRenderers.phoneNumber(c.get("home_telephone_number"),{},c);b=Ext.util.Format.htmlEncode(c.get("email_address_1"));break;case "IPM.Task":b=Ext.util.Format.htmlEncode(c.get("body"));break;case "IPM.StickyNote":a=Ext.util.Format.htmlEncode(c.get("body"));break;
default:a=Ext.util.Format.htmlEncode(c.get("subject")),b=Ext.util.Format.htmlEncode(c.get("body"))}return"<div>"+(a?'<span class="subject">'+a+"</span>":"")+(b?'<span class="body">'+b+"</span>":"")+"</div>"},nameColumn:function(a,b,c){var d=c.get("message_class"),e=!1,f=Ext.isFunction(c.senderIsReceiver)?!c.senderIsReceiver()&&c.senderIsUser():!1;a=f&&!Ext.isEmpty(c.get("display_to"))?c.get("display_to"):c.get("sent_representing_name");Ext.isEmpty(a)&&Ext.isFunction(c.getSender)?(a=c.get("sender_name"),
e=c.getSender()):Ext.isFunction(c.getSentRepresenting)&&(e=c.getSentRepresenting());switch(d){case "IPM.Contact":return Ext.util.Format.htmlEncode(c.get("display_name"));case "IPM.StickyNote":return Ext.util.Format.htmlEncode(c.get("subject"));case "IPM.Schedule.Meeting.Request":a=_("With")+": "+a;break;case "IPM.TaskRequest":f||(a=c.get("display_to"));break;case "IPM.Note":f&&(a=_("To")+": "+a)}a=Ext.util.Format.htmlEncode(a);return Zarafa.common.ui.grid.Renderers.presenceStatus(a,b,e)},dateColumn:function(a,
b,c){b.css="search-date";var d="";Ext.isDate(a)?"short"===container.getSettingsModel().get("zarafa/v1/main/datetime_display_format")?(b.css+=" k-date-nice k-ts-"+a.getTime(),d=a.getNiceFormat()):d=a.format(_("d/m/Y")):c.isMessageClass("IPM.Task")&&(d=_("No date"));return'<table cellpadding=0 cellspacing=0 style="width:100%"><tr><td class="date"><div>'+d+"</div></td></tr></table>"},phoneNumber:function(a,b,c){b.css="";a=["business_telephone_number","home_telephone_number","business_fax_number","cellular_telephone_number"];
b=a.find(function(a){if(!Ext.isEmpty(c.get(a)))return!0});return a?Ext.util.Format.htmlEncode(c.get(b)):""}};Ext.namespace("Zarafa.calendar");
Zarafa.calendar.Actions={openAppointmentContent:function(a,b){Ext.each(a,function(a){Ext.isDefined(a.isRecurringOccurence)&&a.isRecurringOccurence()?Zarafa.common.Actions.openRecurringSelectionContent(a,function(c,e){"ok"==c&&(Ext.isEmpty(a.getStore())&&(a=this.getById(a.get("entryid"))),a="recurrence_series"!==e.id?a.convertToOccurenceRecord():a.convertToSeriesRecord(),Zarafa.core.data.UIFactory.openViewRecord(a,b))},a.getStore()):Zarafa.core.data.UIFactory.openViewRecord(a,b)},this)},openCreateAppointmentContent:function(a,
b){var c=a.createRecord();Zarafa.core.data.UIFactory.openCreateRecord(c,b)},openMeetingRequestContent:function(a,b){Zarafa.calendar.Actions.openAppointmentContent(a,b)},openCreateMeetingRequestContent:function(a,b){var c=a.createRecord();c.convertToMeeting();Zarafa.core.data.UIFactory.openCreateRecord(c,b)},openAppointmentContentToAcceptProposal:function(a,b){Array.isArray(a)&&(a=a[0]);var c=a.convertToAppointmentRecord(!1);Ext.isDefined(c)?(b=Ext.applyIf(b||{},{useShadowStore:!0,activeTab:0,newAppointmentProps:{startdate:a.get("proposed_start_date"),
duedate:a.get("proposed_end_date"),commonstart:a.get("proposed_start_date"),commonend:a.get("proposed_end_date"),duration:a.get("proposed_duration"),counter_proposal:!1}}),Zarafa.core.data.UIFactory.openCreateRecord(c,b)):container.getNotifier().notify("error.proposal",_("Error"),_("Could not accept proposal as this meeting is not available in calendar; It may have been moved or deleted."))},openAppointmentContentToViewAllProposals:function(a,b){Array.isArray(a)&&(a=a[0]);var c=a.convertToAppointmentRecord();
Ext.isDefined(c)?(b=Ext.applyIf(b||{},{useShadowStore:!0,activeTab:1}),Zarafa.core.data.UIFactory.openCreateRecord(c,b)):container.getNotifier().notify("error.proposal",_("Error"),_("Could not view proposal as this meeting is not available in calendar; It may have been moved or deleted."))},openProposeNewTimeContent:function(a,b){b=Ext.applyIf(b||{},{autoSave:!1,modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["calendar.dialogs.proposenewtimecontentpanel"],
a,b)},openRecipientSelectionContent:function(a,b){Array.isArray(a)&&!Ext.isEmpty(a)&&(a=a[0]);var c=a.copy(),d=c.getSubStore("recipients");Zarafa.common.Actions.openABUserMultiSelectionContent({callback:function(){a.applyData(c)},convert:function(a,c){return a.convertToRecipient(c?c.defaultRecipientType:b.defaultRecipientType)},store:d,selectionCfg:[{xtype:"zarafa.recipientfield",fieldLabel:_("Required")+":",height:50,boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,
flex:1},{xtype:"zarafa.recipientfield",fieldLabel:_("Optional")+":",height:50,boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC,flex:1},{xtype:"zarafa.recipientfield",fieldLabel:_("Resource")+":",height:50,boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC,flex:1}]})},openSendConfirmationContent:function(a,b){b=Ext.applyIf(b||{},{record:a,
modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["calendar.dialogs.sendmeetingrequestconfirmation"],a,b)},openSendCancellationContent:function(a,b){b=Ext.applyIf(b||{},{record:a,modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["calendar.dialogs.sendmeetingrequestcancellation"],a,b)},showMeetingInCalendar:function(a,b){var c,d,e=a.get("appointment_store_entryid");e&&(c=container.getHierarchyStore().getById(e));
if(!c&&(c=a.get("received_representing_entryid")||a.get("received_by_entryid")||a.get("sent_representing_entryid")||a.get("sender_entryid"),c=container.getHierarchyStore().getStoreByOwnerEntryId(c),!Ext.isDefined(c))){container.getNotifier().notify("error",_("Error"),_("Could not open store."));return}(e=a.get("appointment_parent_entryid"))&&(d=c.getFolder(e));if(!d&&(d=c.getDefaultFolder("calendar"),!Ext.isDefined(d))){container.getNotifier().notify("error",_("Error"),_("Could not open default calendar folder."));
return}e=container.getContextByFolder(d);c=e.getModel();var f=c.getFolders(),g=d.get("entryid"),h=f.indexOf(d);-1===h&&f.push(d);if(c.default_merge_state&&-1!==h)for(var k in c.groupings)-1<c.groupings[k].folders.indexOf(g)&&(c.active_group=k,c.groupings[k].active=g);else c.active_group=Ext.id(null,"group-"),c.groupings[c.active_group]={folders:[g],active:g};container.switchContext(e,f,!0);e.switchView(Zarafa.calendar.data.Views.BLOCKS,Zarafa.calendar.data.ViewModes.DAYS);d=a.get("appointment_startdate")||
a.get("appointment_basedate");c.setDataMode(Zarafa.calendar.data.DataModes.DAY);c.setDate(d);c.setSelectedRecords([a.convertToAppointmentRecord()]);c.resumeLoading()},copyRecurringItemContent:function(a,b){Zarafa.common.Actions.copyRecurringSelectionContent(a,function(c,d){if("cancel"!==c){var e,f=!1;"recurrence_series"===d.id?(e=a.convertToSeriesRecord(),f=!a.get("recurring")):e=a.convertToOccurenceRecord();!a.isOpened()||f?this.openRecord(b.component,e):b.component.doPaste(e)}},b.scope)}};Ext.namespace("Zarafa.calendar.data");
Zarafa.calendar.data.AppointmentBounds=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a)},left:0,right:0,top:0,bottom:0,firstBox:!1,lastBox:!1});Ext.namespace("Zarafa.calendar.data");Zarafa.calendar.data.DayBoxConfiguration=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a)},left:0,right:0,top:0,bottom:0,date:void 0,today:!1,workingDay:!1,busyStatus:void 0,overflow:!1,active:!1});Ext.namespace("Zarafa.calendar.data");
Zarafa.calendar.data.DayLayoutPosition=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a)},left:0,right:0,date:void 0,today:!1,workingDay:!1});Ext.namespace("Zarafa.calendar.data");
Zarafa.calendar.data.ReminderPeriods=[{value:0,name:Ext.util.Format.duration(0)},{value:5,name:Ext.util.Format.duration(5)},{value:10,name:Ext.util.Format.duration(10)},{value:15,name:Ext.util.Format.duration(15)},{value:30,name:Ext.util.Format.duration(30)},{value:60,name:Ext.util.Format.duration(60)},{value:120,name:Ext.util.Format.duration(120)},{value:240,name:Ext.util.Format.duration(240)},{value:480,name:Ext.util.Format.duration(480)},{value:720,name:Ext.util.Format.duration(720)},{value:1080,
name:Ext.util.Format.duration(1080)},{value:1440,name:Ext.util.Format.duration(1440)},{value:2880,name:Ext.util.Format.duration(2880)},{value:4320,name:Ext.util.Format.duration(4320)},{value:5760,name:Ext.util.Format.duration(5760)},{value:7200,name:Ext.util.Format.duration(7200)},{value:10080,name:Ext.util.Format.duration(10080)},{value:20160,name:Ext.util.Format.duration(20160)},{value:40320,name:Ext.util.Format.duration(40320)}];Ext.namespace("Zarafa.calendar.data");
Zarafa.calendar.data.SearchFields=[{name:_("All text fields"),value:"subject sender_name categories sender_email_address sent_representing_name sent_representing_email_address body display_to display_cc location"},{name:_("Subject"),value:"subject"},{name:_("Sender"),value:"sender_name sender_email_address sent_representing_name sent_representing_email_address"},{name:_("Body"),value:"body"},{name:_("Subject or Sender"),value:"subject sender_name sender_email_address sent_representing_name sent_representing_email_address"},
{name:_("To or cc"),value:"display_to display_cc"},{name:_("Location"),value:"location"}];Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.AppointmentPanel=Ext.extend(Ext.Panel,{activeTab:void 0,enableNotifier:!0,constructor:function(a){a=a||{};Ext.isDefined(a.activeTab)&&(this.activeTab=a.activeTab);a=Ext.applyIf(a,{xtype:"zarafa.appointmentpanel",border:!1,layout:"fit",items:this.createTabPanel(this.activeTab)});Zarafa.calendar.dialogs.AppointmentPanel.superclass.constructor.call(this,a)},createTabPanel:function(a){return[{xtype:"tabpanel",ref:"tabPanel",activeTab:a||0,border:!1,layoutOnTabChange:!0,plugins:["zarafa.recordcomponentupdaterplugin"],
update:this.onTabPanelUpdate.createDelegate(this),listeners:{render:this.onTabPanelRender,tabchange:this.onTabPanelChange,scope:this},items:[{xtype:"zarafa.appointmenttab",title:_("Appointment"),ref:"../appointmentTab"},{xtype:"zarafa.freebusytab",title:_("Scheduling"),ref:"../schedulingTab"},{xtype:"zarafa.trackingtab",title:_("Tracking"),ref:"../trackingTab"},container.populateInsertionPoint("context.calendar.appointmentcontentpanel.tabs",this)]}]},onTabPanelUpdate:function(a,b){!b&&a.isModifiedSinceLastUpdate("meeting")&&
a.get("meeting")==Zarafa.core.mapi.MeetingStatus.NONMEETING&&(this.tabPanel.activeTab!=this.schedulingTab&&this.tabPanel.activeTab!=this.trackingTab||this.tabPanel.setActiveTab(this.appointmentTab));a.isMeetingSent()&&this.tabPanel.unhideTabStripItem(this.trackingTab)},onTabPanelRender:function(a){this.tabPanel.hideTabStripItem(this.trackingTab)},onTabPanelChange:function(a,b){if(b&&b.record){var c=b.record.getRecipientStore();if(c&&0<c.getCount()&&(this.mon(c,"update",this.onRecipientsChange,this),
this.mon(c,"add",this.onRecipientsChange,this),this.mon(c,"remove",this.onRecipientsChange,this),this.mon(c,"datachanged",this.onRecipientsChange,this),this.enableNotifier)){var d=c.getUnresolvedRecipients(),c=c.getInvalidRecipients();Ext.isEmpty(c)&&Ext.isEmpty(d)||(container.getNotifier().notify("info.unresolved_recipients","",pgettext("calendar.dialog","Not all attendees could be resolved."),{container:this.getEl(),persistent:!0}),this.enableNotifier=!1)}}},onRecipientsChange:function(){this.enableNotifier=
!0}});Ext.reg("zarafa.appointmentpanel",Zarafa.calendar.dialogs.AppointmentPanel);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.AppointmentTab=Ext.extend(Ext.form.FormPanel,{trackingInfoString:pgettext("calendar.dialog","{0} attendees accepted, {1} tentatively accepted, {2} declined."),proposedTimeInfoString:pgettext("calendar.dialog","{0} attendees proposed a new time for this meeting. Click the Scheduling tab for details."),proposeNewTimeInfoString:pgettext("calendar.dialog","You proposed a new time for this meeting on {0}"),proposeNewTimeDelegateInfoString:pgettext("calendar.dialog","{0} proposed a new time for this meeting on {1}"),
acceptedInfoString:pgettext("calendar.dialog","Accepted on {0}"),acceptedDelegateInfoString:pgettext("calendar.dialog","Accepted by {0} on {1}"),tentativeInfoString:pgettext("calendar.dialog","Tentatively Accepted on {0}"),tentativeDelegateInfoString:pgettext("calendar.dialog","Tentatively Accepted by {0} on {1}"),elapsedTimeInfoString:pgettext("calendar.dialog","This appointment occurs in the past."),responseRequiredString:pgettext("calendar.dialog","Please respond."),noResponseReceivedString:pgettext("calendar.dialog",
"No responses have been received for this meeting."),meetingCanceledString:pgettext("calendar.dialog","Meeting has been canceled."),meetingUnsentString:pgettext("calendar.dialog","Invitations have not been sent for this meeting."),meetingOverwrittenString:pgettext("calendar.dialog","Please note that any changes you make will be overwritten when this meeting request is updated by the organizer"),hasUserSetLocation:!1,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");
Ext.applyIf(a,{xtype:"zarafa.appointmenttab",cls:"k-appointmentcreatetab",layout:{type:"vbox",align:"stretch"},border:!1,labelPad:0,items:[this.createExtraInfoPanel(),this.createMeetingOrganizerPanel(),this.createRecipientPanel(),this.createSubjectPanel(),this.createLocationPanel(),this.createDateTimePanel(),this.createinPanel(),this.createAttachmentsPanel(),this.createBodyPanel()]});Zarafa.calendar.dialogs.AppointmentTab.superclass.constructor.call(this,a)},createExtraInfoPanel:function(){return{xtype:"container",
cls:"zarafa-calendar-appointment-extrainfo",ref:"extraInfoPanel",autoHeight:!0,hidden:!0}},createMeetingOrganizerPanel:function(){return{xtype:"panel",ref:"meetingOrganizerPanel",layout:"form",autoHeight:!0,border:!1,items:[{xtype:"displayfield",ref:"../meetingOrganizerField",fieldLabel:_("Organizer"),htmlEncode:!0,flex:1}],hidden:!0}},createRecipientPanel:function(){return{xtype:"zarafa.resizablecompositefield",cls:"k-field-to",ref:"recipientPanel",anchor:"100%",autoHeight:!1,items:[{xtype:"button",
autoHeight:!0,text:_("To")+":",handler:this.showRecipientContent,scope:this},{xtype:"zarafa.recipientfield",plugins:["zarafa.recordcomponentupdaterplugin"],flex:1}]}},createSubjectPanel:function(){return{xtype:"panel",cls:"k-subject-panel",layout:"form",labelWidth:85,labelAlign:"left",autoHeight:!0,border:!1,items:[{xtype:"textfield",name:"subject",fieldLabel:_("Subject"),anchor:"100%",listeners:{change:this.onFieldChange,scope:this}}]}},createLocationPanel:function(){return{xtype:"panel",cls:"k-location-panel",
layout:"form",labelWidth:85,labelAlign:"left",autoHeight:!0,border:!1,items:[{xtype:"textfield",name:"location",fieldLabel:_("Location"),anchor:"100%",enableKeyEvents:!0,listeners:{change:this.onFieldChange,keypress:this.onLocationKeyPress,scope:this}}]}},createDateTimePanel:function(){return{xtype:"panel",cls:"k-datetime-panel",border:!1,autoHeight:!0,layout:{type:"table",columns:2},items:[{xtype:"panel",border:!1,items:[this.createDatePanel(),this.createRecurrencePanel()]},this.createBusyStatusPanel(),
this.createReminderPanel(),{xtype:"container",cls:"filler"}]}},createinPanel:function(){var a={xtype:"jsonstore",fields:["entryid","store_entryid","displayString","iconColor","sortOrder"],data:this.getSortedCreateInData(),sortInfo:{field:"sortOrder",direction:"ASC"}};return{xtype:"panel",cls:"k-createin-panel",hidden:2>a.data.length,layout:"form",labelWidth:85,labelAlign:"left",autoHeight:!0,border:!1,items:[{xtype:"combo",tpl:'<tpl for="."><div class="x-combo-list-item">{[Zarafa.calendar.ui.IconCache.getCalendarSvgStructure(values.iconColor)]}{displayString}</div></tpl>',
fieldLabel:_("Create in"),ref:"../comboCreateIn",store:a,cls:"k-createin-combo",listClass:"k-createin-combo-list-svg",mode:"local",triggerAction:"all",displayField:"displayString",valueField:"entryid",lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:this.onCreateInSelect,beforeexpand:this.onCreateInBeforeExpand,collapse:this.setCursorPosition,expand:this.setCursorPosition,scope:this}}]}},createDatePanel:function(){return{xtype:"panel",cls:"k-date-panel",layout:{type:"table",columns:3},
ref:"../../datePanel",autoHeight:!0,autoWidth:!0,border:!1,items:[{xtype:"zarafa.datetimeperiodfield",ref:"../../../datetimePeriod",defaultPeriod:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),defaultPeriodType:Date.MINUTE,timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),width:585,allowEqualValue:!0,layout:"hbox",listeners:{change:this.onDateRangeFieldChange,scope:this},startFieldConfig:{fieldLabel:_("Time"),
labelWidth:84,cls:"from-field"},endFieldConfig:{fieldLabel:_("until"),labelWidth:84,cls:"to-field"}},{xtype:"spacer",width:10},{xtype:"panel",border:!1,items:[{xtype:"checkbox",name:"alldayevent",boxLabel:_("All Day Event"),handler:this.onToggleAllDay,scope:this}]}]}},createRecurrencePanel:function(){return{xtype:"panel",cls:"k-recurrence-panel",ref:"../../recurrencePanel",layout:"form",autoHeight:!0,border:!1,items:[{xtype:"displayfield",ref:"../../../recurrencePatternField",fieldLabel:_("Recurrence"),
htmlEncode:!0}]}},createReminderPanel:function(){var a={xtype:"jsonstore",fields:["name","value"],data:Zarafa.calendar.data.ReminderPeriods};return{xtype:"panel",cls:"k-reminder-panel",autoHeight:!0,border:!1,items:[{xtype:"zarafa.compositefield",autoHeight:!0,items:[{xtype:"checkbox",name:"reminder",boxLabel:_("Reminder")+":",width:79,handler:this.onToggleReminder,scope:this},{xtype:"combo",ref:"../../../comboReminder",name:"reminder_minutes",store:a,mode:"local",triggerAction:"all",displayField:"name",
valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}}]}]}},createBusyStatusPanel:function(){var a={xtype:"jsonstore",fields:["name","value"],data:Zarafa.calendar.data.BusyStatus};return{xtype:"panel",cls:"k-busystatus-panel",layout:"form",autoHeight:!0,border:!1,labelAlign:"left",items:[{xtype:"combo",ref:"../../comboBusyStatus",name:"busystatus",fieldLabel:_("Show as"),store:a,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",
lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}}]}},createAttachmentsPanel:function(){return{xtype:"zarafa.resizablecompositefield",hideLabel:!0,anchor:"100%",cls:"k-field-attachments",autoHeight:!0,items:[{xtype:"button",ref:"../occurenceAttachmentsButton",text:_("Attachments")+":",width:100,handler:function(){Ext.MessageBox.show({title:_("Warning"),msg:_("Attachments cannot be modified for a single occurence"),buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING})}},
{xtype:"zarafa.attachmentbutton",ref:"../normalAttachmentsButton",plugins:["zarafa.recordcomponentupdaterplugin"],text:_("Attachments")+":",autoHeight:!0,width:100},{xtype:"spacer",width:5},{xtype:"zarafa.attachmentfield",plugins:["zarafa.recordcomponentupdaterplugin"],ref:"../attachField",flex:1,hideLabel:!0}]}},createBodyPanel:function(){return{xtype:"panel",cls:"k-body-panel",layout:"fit",border:!1,flex:1,autoHeight:!1,items:[{xtype:"zarafa.editorfield",ref:"../editorField",hideLabel:!0,flex:1,
useHtml:!1,listeners:{afterrender:function(){this.editorField.getEditor().getEl().set({placeholder:_("Type your message here...")})},change:this.onBodyChange,scope:this}}]}},onLocationKeyPress:function(a,b){this.hasUserSetLocation=!0},updateUI:function(a,b){var c=!1;if(!0===b||a.isModifiedSinceLastUpdate("meeting")){switch(a.get("meeting")){default:this.dialog.closeOnSave=!0;this.dialog.closeOnSend=!1;this.recipientPanel.setVisible(!1);break;case Zarafa.core.mapi.MeetingStatus.MEETING:this.dialog.closeOnSave=
!1;this.dialog.closeOnSend=!0;this.recipientPanel.setVisible(!0);break;case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED:case Zarafa.core.mapi.MeetingStatus.MEETING_CANCELED:case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED_AND_CANCELED:if(a.get("responsestatus")!=Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE||a.get("responsestatus")!=Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED)this.meetingOrganizerPanel.setVisible(!0),this.recipientPanel.setVisible(!1)}c=!0}if(!0===b||a.isModifiedSinceLastUpdate("alldayevent"))a.get("alldayevent")?
(this.datetimePeriod.setEnabledTimeSelection(!1),this.datetimePeriod.defaultPeriod=1,this.datetimePeriod.defaultPeriodType=Date.DAY):(this.datetimePeriod.setEnabledTimeSelection(!0),this.datetimePeriod.defaultPeriod=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),this.datetimePeriod.defaultPeriodType=Date.MINUTE);if(!0===b||a.isModifiedSinceLastUpdate("reminder"))a.get("reminder")?this.comboReminder.enable():this.comboReminder.disable();if(!0===b||a.isModifiedSinceLastUpdate("recurring"))a.get("recurring")&&
Ext.isEmpty(a.get("basedate"))?(this.datePanel.setVisible(!1),this.recurrencePanel.setVisible(!0)):(this.datePanel.setVisible(!0),this.recurrencePanel.setVisible(!1),this.recurrencePatternField.setValue("")),c=!0;!0===b&&(a.isRecurringOccurence()?(this.occurenceAttachmentsButton.setVisible(!0),this.normalAttachmentsButton.setVisible(!1),this.attachField.setEditable(!1)):(this.occurenceAttachmentsButton.setVisible(!1),this.normalAttachmentsButton.setVisible(!0),this.attachField.setEditable(!0)),c=
!0);if(!0===b||a.isModifiedSinceLastUpdate("reminder"))a.get("alldayevent")?(this.comboReminder.setValue(container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_allday_reminder_time")),this.comboBusyStatus.setValue(Zarafa.core.mapi.BusyStatus.FREE)):(this.comboReminder.setValue(container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_reminder_time")),this.comboBusyStatus.setValue(Zarafa.core.mapi.BusyStatus.BUSY));c&&this.doLayout()},update:function(a,b){this.record=a;this.updateUI(a,
b);this.getForm().loadRecord(a);var c=a.get("startdate"),d=!1;Ext.isDate(c)&&(c=c.clone(),d=b||a.isModifiedSinceLastUpdate("startdate"));var e=a.get("duedate"),f=!1;Ext.isDate(e)&&(e=e.clone(),f=b||a.isModifiedSinceLastUpdate("duedate"));a.get("alldayevent")&&(c.clearTime(),e.setHours(12),e=e.add(Date.DAY,-1).clearTime());(d||f)&&this.datetimePeriod.getValue().set(c,e);b&&a.isOpened()&&this.editorField.setValue(a.getBody(this.editorField.isHtmlEditor()));b&&this.comboCreateIn.isVisible()&&(c=container.getContextByName("calendar").getModel(),
d=c.getFolder(a.get("parent_entryid")),c=!Ext.isDefined(d)||!d.isInDeletedItems()&&d.get("rights")&Zarafa.core.mapi.Rights.RIGHTS_CREATE?a.get("parent_entryid"):c.defaultFolder.get("entryid"),this.comboCreateIn.setValue(c),c=this.getFolderColor(c),this.comboCreateIn.el.setStyle("background-image","url('"+Zarafa.calendar.ui.IconCache.getCalendarSvgIcon(c)+"')"));this.updateExtraInfoPanel();(!0===b||a.isModifiedSinceLastUpdate("recurring_pattern"))&&this.recurrencePatternField.setValue(a.get("recurring_pattern"));
if(!0===a.get("reminder")&&(!a.get("flagdueby")||a.isModifiedSinceLastUpdate("reminder_minutes")||a.get("reminder_time")!==a.get("startdate"))){var g;if(a.isRecurring()||a.isRecurringOccurence())g=a.get("startdate_recurring");g||(g=a.get("startdate"));Ext.isDate(g)&&(a.set("reminder_time",g.clone()),a.set("flagdueby",g.add(Date.MINUTE,-a.get("reminder_minutes"))))}if(a.isOpened()&&a.isSubStoreModifiedSincelastUpdate("recipients")&&(g=a.updateSubStoreModifications.recipients)&&g.changes){g=g.changes;
c=!1;for(d=0;d<g.length;d++)if(g[d].get("display_type_ex")===Zarafa.core.mapi.DisplayTypeEx.DT_ROOM){c=!0;break}c&&this.updateLocation()}},updateLocation:function(){var a=[];this.record.getSubStore("recipients").each(function(b){b.get("display_type_ex")===Zarafa.core.mapi.DisplayTypeEx.DT_ROOM&&(b=b.get("display_name"),Ext.isEmpty(b)||a.push(b))});var b=a.join("; "),c=this.record.get("location");c!=b&&(!1===this.hasUserSetLocation||Ext.isEmpty(c)||c.toUpperCase()==b.toUpperCase()?this.doSetLocation(b):
Ext.MessageBox.show({title:_("Kopano WebApp"),msg:String.format(_('Do you want to update the location "{0}" with the new location "{1}"?'),Ext.util.Format.htmlEncode(c),Ext.util.Format.htmlEncode(b)),buttons:Ext.Msg.YESNO,icon:Ext.MessageBox.WARNING,fn:this.setLocation,locationSuggestion:b,scope:this}))},setLocation:function(a,b,c){"yes"==a&&this.doSetLocation(c.locationSuggestion)},doSetLocation:function(a){this.record.set("location",a);this.hasUserSetLocation=!1},updateRecord:function(a){a.beginEdit();
this.getForm().updateRecord(a);this.updateStartDueDate(a,this.datetimePeriod.getValue());if(!0===a.get("reminder")&&(!a.get("flagdueby")||a.isModifiedSinceLastUpdate("reminder_minutes")||a.isModifiedSinceLastUpdate("startdate"))){var b;if(a.isRecurring()||a.isRecurringOccurence())b=a.get("startdate_recurring");b||(b=a.get("startdate"));Ext.isDate(b)&&(a.set("reminder_time",b.clone()),a.set("flagdueby",b.add(Date.MINUTE,-a.get("reminder_minutes"))))}a.hasMessageAction("send")&&a.isCopied()&&a.set("auxiliary_flags",
0);this.onBodyChange(this.editorField.getEditor(),this.editorField.getValue());a.endEdit()},onFieldChange:function(a,b,c){this.record.set(a.getName(),b)},onBodyChange:function(a,b,c){c=this.record;a=a instanceof Ext.form.HtmlEditor;c.beginEdit();c.setBody(b,a);c.endEdit()},onFieldSelect:function(a,b,c){this.record.set(a.getName(),b.get(a.valueField))},onCreateInSelect:function(a,b,c){this.record.phantom?(this.record.set("parent_entryid",b.get("entryid")),this.record.set("store_entryid",b.get("store_entryid"))):
this.record.moveTo(b);a.el.setStyle("background-image","url('"+Zarafa.calendar.ui.IconCache.getCalendarSvgIcon(b.get("iconColor"))+"')")},setCursorPosition:function(a){a.el.dom.setSelectionRange(0,0)},getFolderColor:function(a){return container.getContextByName("calendar").getModel().getColorScheme(a).base},getSortedCreateInData:function(){var a=container.getHierarchyStore().getByContainerClass("IPF.Appointment"),b=container.getContextByName("calendar").getModel().getGroupings(),c=[];a.forEach(function(a){if(a.get("rights")&
Zarafa.core.mapi.Rights.RIGHTS_CREATE){var d=a.get("display_name"),f=a.getParentFolder().getMAPIStore();f.isSharedStore()&&(d+=" - "+f.get("mailbox_owner_name"));var g=this.isActiveFolder(b,a),d={entryid:a.get("entryid"),store_entryid:a.get("store_entryid"),displayString:d,iconColor:this.getFolderColor(a.get("entryid"))};a.getMAPIStore().isPublicStore()?d.sortOrder=g?"3":"6":f.isSharedStore()?d.sortOrder=g?"2":"5":d.sortOrder=g?"1":"4";c.push(d)}},this);return c},isActiveFolder:function(a,b){var c=
!1,d;for(d in a)b.get("entryid")===a[d].active&&(c=!0);return c},onCreateInBeforeExpand:function(a){var b=a.store,c=b.reader.readRecords(this.getSortedCreateInData());b.removeAll();b.add(c.records);b.applySort();a.view.bindStore(b)},onDateRangeFieldChange:function(a,b,c){this.updateStartDueDate(this.record,b)},updateStartDueDate:function(a,b){var c=b.getStartDate().clone(),d=b.getDueDate().clone();!0===a.get("alldayevent")&&(c=c.clearTime(),d.setHours(12),d=d.add(Date.DAY,1).clearTime());a.beginEdit();
a.set("startdate",c);a.set("duedate",d);a.set("commonstart",c);a.set("commonend",d);a.set("duration",(d-c)/6E4);a.endEdit()},onToggleReminder:function(a,b){this.record.set("reminder",b)},onToggleAllDay:function(a,b){if(this.record.get("alldayevent")!==b){this.record.beginEdit();this.record.set("alldayevent",b);if(b)this.updateStartDueDate(this.record,this.datetimePeriod.getValue()),this.record.set("reminder_minutes",container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_allday_reminder_time")),
this.record.set("busystatus",Zarafa.core.mapi.BusyStatus.FREE);else{var c=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),d=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),e=new Date;this.record.get("startdate")&&(e=this.record.get("startdate").clearTime(!0));e=e.ceil(Date.MINUTE,c);c=e.add(Date.MINUTE,d);this.record.set("reminder_minutes",container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_reminder_time"));
this.record.set("busystatus",Zarafa.core.mapi.BusyStatus.BUSY);this.record.set("startdate",e);this.record.set("duedate",c);this.record.set("commonstart",e);this.record.set("commonend",c);this.record.set("duration",(c-e)/6E4)}this.record.endEdit()}},showRecipientContent:function(){Zarafa.calendar.Actions.openRecipientSelectionContent(this.record,{defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO})},updateExtraInfoPanel:function(){var a=this.extraInfoPanel.getEl();Ext.isDefined(a.dom)&&(a.dom.innerHTML=
"");var b=this.setOldAppointmentInfo(a);this.record.isRecurringOccurence()&&(b=!0===this.setRecurrencePatternInfo(a)?!0:b);if(this.record.isMeeting()&&!this.record.phantom)if(this.record.isMeetingOrganized())b=this.record.isMeetingSent()?!0===this.setMeetingResponseInfo(a)?!0:b:!0===this.setMeetingUnsentInfo(a)?!0:b;else{var c=this.record.get("responsestatus");c!==Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE&&(this.setOrganizerInfo(),b=!0===this.setMeetingOverwrittenInfo(a)?!0:b);this.record.isMeetingCanceled()?
b=!0===this.setMeetingCanceledInfo(a)?!0:b:this.record.isMeetingResponseRequired()&&(b=!0===this.setReplyTimeInfo(c,a)?!0:b)}this.extraInfoPanel.setVisible(b);this.doLayout()},setMeetingResponseInfo:function(a){if(this.record.isMeetingSent())return!1;var b=0,c=0,d=0,e=0;this.record.getRecipientStore().each(function(a){switch(a.get("recipient_trackstatus")){case Zarafa.core.mapi.RecipientTrackStatus.RECIPIENT_TRACKSTATUS_TENTATIVE:c++;break;case Zarafa.core.mapi.RecipientTrackStatus.RECIPIENT_TRACKSTATUS_ACCEPTED:b++;
break;case Zarafa.core.mapi.RecipientTrackStatus.RECIPIENT_TRACKSTATUS_DECLINED:d++}a.get("proposednewtime")&&e++},this);if(0!==b||0!==c||0!==d){var f=String.format(this.trackingInfoString,b,c,d);a.createChild({tag:"div",html:f});this.record.get("counter_proposal")&&0!==e&&(f=String.format(this.proposedTimeInfoString,e),a.createChild({tag:"div",html:f}))}else a.createChild({tag:"div",html:this.noResponseReceivedString});return!0},setReplyTimeInfo:function(a,b){var c="",d=this.record.get("reply_time"),
e=this.record.get("reply_name"),f=this.record.get("duedate");if(a!==Zarafa.core.mapi.ResponseStatus.RESPONSE_NOT_RESPONDED)if(d=Ext.isDate(d)?d.format(_("jS F Y G:i")):_("None"),this.record.get("counter_proposal"))c=Ext.isEmpty(e)?String.format(this.proposeNewTimeInfoString,d):String.format(this.proposeNewTimeDelegateInfoString,e,d);else switch(a){case Zarafa.core.mapi.ResponseStatus.RESPONSE_ACCEPTED:c=Ext.isEmpty(e)?String.format(this.acceptedInfoString,d):String.format(this.acceptedDelegateInfoString,
e,d);break;case Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE:c=Ext.isEmpty(e)?String.format(this.tentativeInfoString,d):String.format(this.tentativeDelegateInfoString,e,d)}else Ext.isDate(f)&&f.getTime()>=(new Date).getTime()&&(c=this.responseRequiredString);return Ext.isEmpty(c)?!1:(b.createChild({tag:"div",html:c}),!0)},setOldAppointmentInfo:function(a){return this.record.isAppointmentInPast()?(a.createChild({tag:"div",html:this.elapsedTimeInfoString}),!0):!1},setOrganizerInfo:function(){this.meetingOrganizerField.setValue(this.record.getSenderString())},
setMeetingCanceledInfo:function(a){a.createChild({tag:"div",html:this.meetingCanceledString});return!0},setMeetingUnsentInfo:function(a){a.createChild({tag:"div",html:this.meetingUnsentString});return!0},setMeetingOverwrittenInfo:function(a){a.createChild({tag:"div",html:this.meetingOverwrittenString});return!0},setRecurrencePatternInfo:function(a){a.createChild({tag:"div",html:Ext.util.Format.htmlEncode(this.record.get("recurring_pattern"))});return!0}});Ext.reg("zarafa.appointmenttab",Zarafa.calendar.dialogs.AppointmentTab);
Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.CounterProposalGrid=Ext.extend(Ext.grid.GridPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.counterproposalgrid",store:new Ext.data.JsonStore({root:"proposals",fields:["startdate","duedate","duration","display_name"]}),autoHeight:!0,maxHeight:300,viewConfig:{forceFit:!0},columns:this.initColumnModel(),selModel:this.initSelectionModel()});Zarafa.calendar.dialogs.CounterProposalGrid.superclass.constructor.call(this,
a)},initColumnModel:function(){return[{dataIndex:"startdate",header:_("Proposed Date and Time"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.datetime},{dataIndex:"duration",header:_("Duration"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.duration},{dataIndex:"display_name",header:_("Proposed By"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.text}]},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!0})},initEvents:function(){Zarafa.calendar.dialogs.CounterProposalGrid.superclass.initEvents.call(this);
this.mon(this.getSelectionModel(),"selectionchange",this.onSelectionChange,this);this.on("viewready",this.onViewReady,this)},update:function(a,b){if(a.isOpened()&&this.record!==a&&(this.record=a,a.isMeetingOrganized()&&a.get("counter_proposal"))){for(var c=a.getSubStore("recipients"),d={proposals:[]},e=0,f=c.getCount();e<f;e++){var g=c.getAt(e);if(g.isMeetingOrganizer()){var h=a.get("duration")?a.get("duration"):Date.diff(Date.MINUTE,a.get("duedate"),a.get("startdate")),g={display_name:_("Current Meeting Time"),
startdate:a.get("startdate"),duedate:a.get("duedate"),duration:h};d.proposals.push(g)}else!0===g.get("proposednewtime")&&(h=Date.diff(Date.MINUTE,g.get("proposednewtime_end"),g.get("proposednewtime_start")),g={display_name:g.get("display_name"),startdate:g.get("proposednewtime_start"),duedate:g.get("proposednewtime_end"),duration:h},d.proposals.push(g))}this.store.loadData(d);b&&this.getSelectionModel().selectFirstRow();this.setVisible(!0)}},onViewReady:function(){this.getSelectionModel().selectFirstRow()},
onSelectionChange:function(a){var b=a.getSelections();if(!Ext.isEmpty(b)&&1==b.length){this.record.beginEdit();var c=b[0].get("startdate"),b=b[0].get("duedate");this.record.set("startdate",c);this.record.set("duedate",b);this.record.set("commonstart",c);this.record.set("commonend",b);this.record.set("duration",(b-c)/6E4);this.record.set("counter_proposal",a.isSelected(0));this.record.endEdit()}}});Ext.reg("zarafa.counterproposalgrid",Zarafa.calendar.dialogs.CounterProposalGrid);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.FreebusyTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.freebusytab",layout:{type:"vbox",align:"stretch"},border:!1,defaults:{border:!1},items:[this.createCounterProposalPanel(),this.createFreebusyPanel()]});Zarafa.calendar.dialogs.FreebusyTab.superclass.constructor.call(this,a);this.on("activate",this.onActivate,this)},createCounterProposalPanel:function(){return{xtype:"zarafa.counterproposalgrid",
ref:"counterproposalpanel",hidden:!0,listeners:{scope:this,show:this.onProposalGridVisible}}},createFreebusyPanel:function(){return{xtype:"zarafa.freebusypanel",cls:"zarafa-freebusy-panel",ref:"freebusyPanel",flex:1,modelConfig:{listeners:{selectorrangeupdate:this.onSelectorRangeUpdate,scope:this}},items:[this.createOptionsPanel()]}},createOptionsPanel:function(){return{xtype:"panel",region:"north",layout:"column",cls:"zarafa-freebusy-datetime-toolbar",border:!1,autoHeight:!0,items:[{xtype:"zarafa.datetimeperiodfield",
ref:"../../datetimePeriod",defaultPeriod:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),defaultPeriodType:Date.MINUTE,timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),allowEqualValue:!0,layout:"hbox",listeners:{change:this.onDateRangeFieldChange,afterrender:this.onDateRangeFieldAfterRender,scope:this},startFieldConfig:{fieldLabel:_("Time"),labelConfig:{cls:"label-startfield"}},endFieldConfig:{fieldLabel:_("until")},
spacerConfig:{width:10}},{xtype:"checkbox",ref:"../../workingHoursCheckbox",boxLabel:_("Show only working hours"),handler:this.onOnlyWorkingHours,scope:this}]}},onProposalGridVisible:function(a){this.doLayout()},onRender:function(a,b){Zarafa.calendar.dialogs.FreebusyTab.superclass.onRender.call(this,a,b);var c=this.freebusyPanel.getModel();this.workingHoursCheckbox.setValue(c.showOnlyWorkingHours());this.mon(c,"showworkinghourschange",this.onShowWorkingHoursChange,this)},onActivate:function(a){this.record&&
!this.record.isMeeting()&&this.record.get("responsestatus")===Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE&&this.record.convertToMeeting();this.freebusyPanel.scrollTimelineToSelection()},updateUI:function(a,b){if(!0===b||a.isModifiedSinceLastUpdate("alldayevent"))a.get("alldayevent")?(this.datetimePeriod.setEnabledTimeSelection(!1),this.datetimePeriod.defaultPeriod=1,this.datetimePeriod.defaultPeriodType=Date.DAY):(this.datetimePeriod.setEnabledTimeSelection(!0),this.datetimePeriod.defaultPeriod=
container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),this.datetimePeriod.defaultPeriodType=Date.MINUTE)},update:function(a,b){this.record=a;this.updateUI(a,b);this.getForm().loadRecord(a);var c=a.get("startdate"),d=!1;Ext.isDate(c)&&(c=c.clone(),d=b||a.isModifiedSinceLastUpdate("startdate"));var e=a.get("duedate"),f=!1;Ext.isDate(e)&&(e=e.clone(),f=b||a.isModifiedSinceLastUpdate("duedate"));a.get("alldayevent")&&(c.clearTime(),e.setHours(12),e=e.add(Date.DAY,
-1).clearTime());!0===b&&this.freebusyPanel.setEditable(!a.isMeetingReceived());(d||f)&&this.datetimePeriod.getValue().set(c,e);a.isOpened()&&((!0===b||d||f)&&this.freebusyPanel.getModel().selectRange(a.get("startdate"),a.get("duedate")),!0===b&&this.freebusyPanel.getModel().setUserStore(a.getRecipientStore()))},updateRecord:function(a){a.beginEdit();this.getForm().updateRecord(a);this.updateStartDueDate(a,this.datetimePeriod.getValue());a.endEdit()},onSelectorRangeUpdate:function(a,b){this.record.beginEdit();
!0!==this.record.get("alldayevent")||a.isAllDay()||this.record.set("alldayevent",!1);this.updateRecurringInfo(this.record,a);this.updateStartDueDate(this.record,a);this.record.endEdit()},updateRecurringInfo:function(a,b){var c=b.getStartDate().clone();!0===a.get("alldayevent")&&(c=c.clearTime());if(a.isRecurring()&&a.isMeeting()){a.updateTimezoneInformation();var d=60*c.getHours()+c.getMinutes(),e=d+b.getDuration(Date.MINUTE);a.beginEdit();a.set("recurring_reset",!0);a.set("recurrence_startocc",d);
a.set("recurrence_endocc",e);a.set("recurrence_start",c.clearTime(!0).fromUTC());a.set("recurring_pattern",a.generateRecurringPattern());a.endEdit()}},onDateRangeFieldChange:function(a,b,c){this.updateRecurringInfo(this.record,b);this.updateStartDueDate(this.record,b)},onDateRangeFieldAfterRender:function(a){a.setWidth(550)},updateStartDueDate:function(a,b){var c=b.getStartDate().clone(),d=b.getDueDate().clone();!0===a.get("alldayevent")&&(c=c.clearTime(),d.setHours(12),d=d.add(Date.DAY,1).clearTime());
a.beginEdit();a.set("startdate",c);a.set("duedate",d);a.set("commonstart",c);a.set("commonend",d);a.set("duration",(d-c)/6E4);a.endEdit()},onShowWorkingHoursChange:function(a){this.workingHoursCheckbox.setValue(a)},onOnlyWorkingHours:function(a,b){this.freebusyPanel.getModel().hideNonWorkingHours(b)}});Ext.reg("zarafa.freebusytab",Zarafa.calendar.dialogs.FreebusyTab);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.SendMeetingRequestCancellationPanel=Ext.extend(Ext.form.FormPanel,{cancellationInfoString:_("This meeting will be cancelled. Do you want to include comments with your cancellation?"),constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.sendmeetingrequestcancellationpanel",layout:{type:"vbox",align:"stretch"},border:!1,hideLabels:!0,items:[{xtype:"displayfield",value:this.cancellationInfoString,autoHeight:!0,style:"padding-bottom: 10px;"},{xtype:"radio",boxLabel:_("Edit the cancellation before Sending."),
name:"sendmrcancellation",autoHeight:!0,listeners:{check:this.onEditCancellationChecked,scope:this}},{xtype:"textarea",name:"cancellationText",ref:"cancellationTextField",disabled:!0,flex:1},{xtype:"radio",boxLabel:_("Send the cancellation now."),checked:!0,name:"sendmrcancellation",autoHeight:!0}]});Zarafa.calendar.dialogs.SendMeetingRequestCancellationPanel.superclass.constructor.call(this,a)},onEditCancellationChecked:function(a,b){this.cancellationTextField.setDisabled(!b)},updateRecord:function(a){var b=
this.getForm().getFieldValues();a.cancelInvitation(b.cancellationText)},onResize:function(){Zarafa.calendar.dialogs.SendMeetingRequestCancellationPanel.superclass.onResize.apply(this,arguments);this.doLayout()}});Ext.reg("zarafa.sendmeetingrequestcancellationpanel",Zarafa.calendar.dialogs.SendMeetingRequestCancellationPanel);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.SendMeetingRequestConfirmationPanel=Ext.extend(Ext.form.FormPanel,{responseType:void 0,acceptInfoString:_("This meeting has been accepted and will be moved to your Calendar. Do you want to include comments with your response?"),tentativeAcceptInfoString:_("This meeting has been tentatively accepted and will be moved to your Calendar. Do you want to include comments with your response?"),declineInfoString:_("This meeting has been declined and will be moved to the Deleted Items folder. Do you want to include comments with your response?"),
constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.sendmeetingrequestconfirmpanel",layout:{type:"vbox",align:"stretch"},border:!1,hideLabels:!0,items:[{xtype:"displayfield",value:this.getDisplayText(a.responseType),autoHeight:!0,style:"padding-bottom: 10px;"},{xtype:"radio",boxLabel:_("Edit the response before Sending."),name:"sendmrconfirmation",autoHeight:!0,listeners:{check:this.onEditResponseChecked,scope:this}},{xtype:"textarea",name:"responseText",ref:"responseTextField",disabled:!0,
flex:1},{xtype:"radio",boxLabel:_("Send the response now."),checked:!0,name:"sendmrconfirmation",autoHeight:!0},{xtype:"radio",boxLabel:_("Don't send a response."),name:"sendmrconfirmation",autoHeight:!0}]});Zarafa.calendar.dialogs.SendMeetingRequestConfirmationPanel.superclass.constructor.call(this,a)},getDisplayText:function(a){switch(a){case Zarafa.core.mapi.ResponseStatus.RESPONSE_ACCEPTED:return this.acceptInfoString;case Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE:return this.tentativeAcceptInfoString;
case Zarafa.core.mapi.ResponseStatus.RESPONSE_DECLINED:return this.declineInfoString}return""},onEditResponseChecked:function(a,b){this.responseTextField.setDisabled(!b)},updateRecord:function(a){var b=this.getForm().getFieldValues();a.respondToMeetingRequest(this.responseType,b.responseText,!0!==b.sendmrconfirmation[2])},onResize:function(){Zarafa.calendar.dialogs.SendMeetingRequestConfirmationPanel.superclass.onResize.apply(this,arguments);this.doLayout()}});
Ext.reg("zarafa.sendmeetingrequestconfirmpanel",Zarafa.calendar.dialogs.SendMeetingRequestConfirmationPanel);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.TrackingTab=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.trackingtab",layout:{type:"vbox",align:"stretch"},cls:"k-trackingtab",border:!1,items:[{xtype:"displayfield",height:36,value:_("The following responses for this meeting have been received")+":",hideLabel:!0},{xtype:"grid",ref:"responseTrackList",flex:1,store:new Zarafa.core.data.IPMRecipientStore,
viewConfig:{forceFit:!0},columns:[{dataIndex:"display_name",header:_("Name"),renderer:Ext.util.Format.htmlEncode,sortable:!0},{dataIndex:"recipient_type",header:_("Attendance"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.recipienttype},{dataIndex:"recipient_trackstatus",header:_("Response"),sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.responsestatus}]}]});Zarafa.calendar.dialogs.TrackingTab.superclass.constructor.call(this,a)},update:function(a,b){var c=a.getSubStore("recipients");
c&&this.responseTrackList.getStore()!==c&&this.responseTrackList.reconfigure(c,this.responseTrackList.getColumnModel())}});Ext.reg("zarafa.trackingtab",Zarafa.calendar.dialogs.TrackingTab);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AppointmentPreviewPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.appointmentpreviewpanel",border:!1,bodyCfg:{cls:"preview-body"},layout:"fit",items:[{xtype:"zarafa.appointmentbody"}]});Zarafa.calendar.ui.AppointmentPreviewPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.appointmentpreviewpanel",Zarafa.calendar.ui.AppointmentPreviewPanel);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AppointmentSelectionModel=Ext.extend(Ext.grid.AbstractSelectionModel,{singleSelect:!0,selections:void 0,constructor:function(a){this.selections=new Ext.util.MixedCollection(!1,function(a){var b=a.id;Ext.isDate(a.data.basedate)&&(b+=a.data.basedate.getTime());return b});this.addEvents("appointmentselect","appointmentdeselect","selectionclear","selectionchange");Zarafa.calendar.ui.AppointmentSelectionModel.superclass.constructor.call(this,a)},clearSelections:function(){this.isLocked()||
0===this.selections.getCount()||(this.selections.clear(),this.fireEvent("selectionclear",this),this.fireEvent("selectionchange",this,this.getSelections()))},getCount:function(){return this.selections.getCount()},getSelections:function(){return[].concat(this.selections.items)},getSelected:function(){return this.selections.itemAt(0)},hasSelection:function(){return 0<this.selections.length},isSelected:function(a){return a&&this.selections.key(this.selections.getKey(a))?!0:!1},selectRecord:function(a,
b){this.isLocked()||!Ext.isDefined(a)||b&&this.isSelected(a)||0===a.get("access")||(b&&!this.singleSelect||this.clearSelections(),this.selections.add(a),this.fireEvent("appointmentselect",this,a),this.fireEvent("selectionchange",this,this.getSelections()))},deselectRecord:function(a){!this.isLocked()&&Ext.isDefined(a)&&(this.selections.remove(a),this.fireEvent("appointmentdeselect",this,a),this.fireEvent("selectionchange",this,this.getSelections()))}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarBlockPanel=Ext.extend(Ext.Panel,{context:void 0,model:void 0,selectionModel:void 0,rangeSelectionModel:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());Ext.isDefined(a.selectionModel)||(a.selectionModel=new Zarafa.calendar.ui.AppointmentSelectionModel);Ext.isDefined(a.rangeSelectionModel)||(a.rangeSelectionModel=new Zarafa.calendar.ui.DateRangeSelectionModel);Ext.applyIf(a,{border:!1,layout:"fit",deferredRender:!1,
items:[{xtype:"zarafa.calendarpanel",ref:"calendarPanel",context:a.context,selectionModel:a.selectionModel,rangeSelectionModel:a.rangeSelectionModel,listeners:{scope:this,contextmenu:this.onContextMenu,dblclick:this.onDblClick,dayclick:this.onDayClick,calendarclose:this.onCalendarClose}}]});Zarafa.calendar.ui.CalendarBlockPanel.superclass.constructor.call(this,a);this.mon(this.selectionModel,"selectionchange",this.onSelectionChange,this);(a=a.model.getStore())&&this.mon(a,"remove",this.onStoreRemove,
this)},onStoreRemove:function(a,b,c){this.selectionModel.deselectRecord(b)},getCalendarPanel:function(){return this.calendarPanel},onContextMenu:function(a,b){var c={position:a.getXY(),calendarPanel:this.getCalendarPanel()};Zarafa.core.data.UIFactory.openDefaultContextMenu(b,c)},onDblClick:function(a,b){Zarafa.calendar.Actions.openAppointmentContent(b)},onSelectionChange:function(a){this.model.setSelectedRecords(a.getSelections())},onDayClick:function(a,b){this.selectionModel.clearSelections();this.rangeSelectionModel.clearSelections();
this.context.switchView(Zarafa.calendar.data.Views.BLOCKS,Zarafa.calendar.data.ViewModes.DAYS);this.model.setModeAndDate(Zarafa.calendar.data.DataModes.DAY,b)},onCalendarClose:function(a){this.model.removeFolder(a)},onAdded:function(a,b){Zarafa.calendar.ui.CalendarBlockPanel.superclass.onAdded.call(this,a,b);this.mon(this.ownerCt,"switchview",this.onSwitchView,this)},onRemoved:function(){this.mun(this.ownerCt,"switchview",this.onSwitchView,this);Zarafa.calendar.ui.CalendarBlockPanel.superclass.onRemoved.call(this)},
onSwitchView:function(a,b,c){this==b?this.getCalendarPanel().bindStore(this.model.getStore()):this==c&&this.getCalendarPanel().releaseStore(this.model.getStore())}});Ext.reg("zarafa.calendarblockpanel",Zarafa.calendar.ui.CalendarBlockPanel);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarPanel=Ext.extend(Ext.Panel,{context:void 0,model:void 0,store:void 0,clipBoardData:void 0,loadMaskText:_("Loading")+"...",selectionModel:void 0,rangeSelectionModel:void 0,viewConfig:void 0,view:void 0,showTooltip:!0,tooltipTitleTpl:new Ext.XTemplate('<tpl if="!Ext.isEmpty(values.subject)">',"{values.subject:htmlEncode}","</tpl>",{compiled:!0}),tooltipTextTpl:new Ext.XTemplate('<tpl if="values.meeting !== Zarafa.core.mapi.MeetingStatus.NONMEETING && !Ext.isEmpty(this.formatOrganizer(values))">',
_("Organizer")+": {[this.formatOrganizer(values)]}<br>","</tpl>",'<tpl if="values.alldayevent != true">',_("Time")+": {[this.formatTime(values.startdate, values.duedate)]}<br>","</tpl>",'<tpl if="values.alldayevent == true">',_("Date")+": {[this.formatDate(values.startdate, values.duedate)]}<br>","</tpl>",'<tpl if="!Ext.isEmpty(values.location)">',_("Location")+": {values.location:htmlEncode}<br>","</tpl>",'<tpl if="!Ext.isEmpty(values.recurring_pattern)">',_("Recurrence")+": {values.recurring_pattern:htmlEncode}<br>",
"</tpl>",{compiled:!0,formatOrganizer:function(a){var b=a.sent_representing_name;Ext.isEmpty(b)&&(b=a.sender_name);return Ext.util.Format.htmlEncode(b)},formatTime:function(a,b){return a.clearTime(!0).getTime()==b.clearTime(!0).getTime()?a.format(_("G:i"))+" - "+b.format(_("G:i")):a.format(_("jS F G:i"))+" - "+b.format(_("jS F G:i"))},formatDate:function(a,b){b=b.add(Date.HOUR,-1);return 1>=Date.diff(Date.DAY,b,a)?a.format(_("jS F Y")):a.format(_("jS F Y"))+" - "+b.format(_("jS F Y"))}}),constructor:function(a){a=
a||{};Ext.apply(this,a,{xtype:"zarafa.calendarpanel",border:!1});this.addEvents("beforeappointmentcalendardrop","appointmentcalendardrop","appointmentmouseover","appointmentmouseout","beforeappointmentmove","beforeappointmentresize","beforeappointmentcreate","appointmentmove","appointmentresize","appointmentcreate","contextmenu","dblclick","dayclick","calendarclose");Zarafa.calendar.ui.CalendarPanel.superclass.constructor.call(this,a)},initComponent:function(){Zarafa.calendar.ui.CalendarPanel.superclass.initComponent.apply(this,
arguments);!Ext.isDefined(this.model)&&Ext.isDefined(this.context)&&(this.model=this.context.getModel());!Ext.isDefined(this.store)&&Ext.isDefined(this.model)&&(this.store=this.model.getStore());Ext.isDefined(this.selectionModel)||(this.store&&this.mon(this.store,"remove",this.onStoreRemove,this),this.selectionModel=new Zarafa.calendar.ui.AppointmentSelectionModel);Ext.isDefined(this.rangeSelectionModel)||(this.rangeSelectionModel=new Zarafa.calendar.ui.DateRangeSelectionModel);this.viewConfig=this.viewConfig||
{};Ext.apply(this.viewConfig,{context:this.context,selectionModel:this.selectionModel,rangeSelectionModel:this.rangeSelectionModel});this.view=new Zarafa.calendar.ui.CalendarMultiView(this.viewConfig);this.mon(this.view,{appointmentcalendardrop:this.onAppointmentCalendarDrop,appointmentmouseover:this.onAppointmentMouseOver,appointmentmouseout:this.onAppointmentMouseOut,appointmentmove:this.onAppointmentMove,appointmentresize:this.onAppointmentResize,appointmentcreate:this.onAppointmentCreate,appointmentinitdrag:this.onAppointmentInitDrag,
appointmentenddrag:this.onAppointmentEndDrag,contextmenu:this.onViewContextMenu,dblclick:this.onDoubleClick,dayclick:this.onDayClick,calendarclose:this.onCalendarClose,scope:this});this.store&&this.bindStore(this.store)},onStoreRemove:function(a,b,c){this.selectionModel.deselectRecord(b)},onViewContextMenu:function(a,b){this.fireEvent("contextmenu",a,b);a.stopEvent()},onDoubleClick:function(a,b){this.fireEvent("dblclick",a,b)},onDayClick:function(a,b){this.fireEvent("dayclick",a,b)},onCalendarClose:function(a){this.fireEvent("calendarclose",
a)},onAppointmentCalendarDrop:function(a,b,c,d,e,f){if(!1!==this.fireEvent("beforeappointmentcalendardrop",this,b,c,d,e)){a=b.copy();this.doAppointmentChange(a,e);var g={},h;for(h in a.modified)g[h]=a.get(h);b.addMessageAction("dropmodifications",g);f.ctrlKey?b.copyTo(d):b.moveTo(d);b.save();this.fireEvent("appointmentcalendardrop",this,b,c,d,e)}},onAppointmentMouseOver:function(a,b,c){if(!0===this.showTooltip&&(a=this.view.getTooltipInstance())){Ext.isDefined(a.targetXY)||(a.targetXY=c.getXY());
var d=b.store.data.getKey(b),e=this.tooltipTitleTpl.apply(b.data),f=this.tooltipTextTpl.apply(b.data),g=Zarafa.common.categories.Util.getCategories(b);a.show(d,{title:e,text:f,categories:g},c)}this.fireEvent("appointmentmouseover",this,b,c)},onAppointmentMouseOut:function(a,b,c){!0===this.showTooltip&&(a=this.view.getTooltipInstance())&&a.hide(c);this.fireEvent("appointmentmouseout",this,b,c)},onAppointmentMove:function(a,b,c,d){b.isMeetingSent()&&!b.isAppointmentInPast()&&!0!==b.getMessageAction("send")?
this.doAppointmentChangeConfirmation(b,c,this.doAppointmentMove):this.doAppointmentMove(b,c)},doAppointmentMove:function(a,b){!1!==this.fireEvent("beforeappointmentmove",this,a,b)&&(this.doAppointmentChange(a,b),a.isMeetingSent()&&!a.isAppointmentInPast()&&a.addMessageAction("send",!0),a.save(),this.fireEvent("appointmentmove",this,a,b))},onAppointmentResize:function(a,b,c,d){b.isMeetingSent()&&!b.isAppointmentInPast()&&!0!==b.getMessageAction("send")?this.doAppointmentChangeConfirmation(b,c,this.doAppointmentResize):
this.doAppointmentResize(b,c)},doAppointmentResize:function(a,b){!1!==this.fireEvent("beforeappointmentresize",this,a,b)&&(this.doAppointmentChange(a,b),a.isMeetingSent()&&!a.isAppointmentInPast()&&a.addMessageAction("send",!0),a.save(),this.fireEvent("appointmentresize",this,a,b))},doAppointmentChangeConfirmation:function(a,b,c){Zarafa.common.dialogs.MessageBox.select(_("Kopano WebApp"),_("The time of the meeting has changed. Choose one of the following:"),function(d,e){if("ok"==d)if("review_changes"==
e.id){var f=[];f.push({fn:function(a,c,d,e){var f=b.clone();if(c.isOpened())this.doAppointmentChange(c,f),e();else{var g=function(a,b){b===c&&(a.un("open",g,d),this.doAppointmentChange(c,f),e())};c.getStore().on("open",g,this,{delay:1})}},scope:this});Zarafa.calendar.Actions.openMeetingRequestContent(a,{recordComponentPluginConfig:{loadTasks:f}})}else c.call(this,a,b)},this,[{boxLabel:_("Save changes and send an update to all recipients"),id:"send_update",name:"select",checked:!0},{boxLabel:_("Open meeting request with changes"),
id:"review_changes",name:"select"}])},doAppointmentChange:function(a,b){a.beginEdit();var c=b.getStartDate(),d=b.getDueDate();a.set("alldayevent",b.isAllDay());a.set("startdate",c,!0);a.set("duedate",d,!0);a.set("commonstart",c);a.set("commonend",d);a.set("duration",b.getDuration(Date.MINUTE));!0===a.get("reminder")&&(a.set("reminder_time",c),a.set("flagdueby",c.add(Date.MINUTE,-a.get("reminder_minutes"))));a.userIsStoreOwner()||(c=container.getHierarchyStore().getById(a.get("store_entryid")))&&a.setDelegatorInfo(c,
!0);a.endEdit()},onAppointmentCreate:function(a,b,c,d){!1!==this.fireEvent("beforeappointmentcreate",this,b,c,d)&&(a=this.model.createRecord(b,c),a.set("subject",d),this.store.add(a),a.save(),this.fireEvent("appointmentcreate",this,b,a))},onAppointmentInitDrag:function(a,b,c){!0===this.showTooltip&&(a=a.getTooltipInstance())&&a.hide()},onAppointmentEndDrag:Ext.emptyFn,onRender:function(a){Zarafa.calendar.ui.CalendarPanel.superclass.onRender.apply(this,arguments);this.view.render(this.body)},onResize:function(){Zarafa.calendar.ui.CalendarPanel.superclass.onResize.apply(this,
arguments);this.rendered&&this.view.layout()},afterRender:function(){Zarafa.calendar.ui.CalendarPanel.superclass.afterRender.apply(this,arguments);this.loadMask=new Zarafa.common.ui.LoadMask(this.body,{msg:this.loadMaskText});this.view.layout();Zarafa.core.KeyMapMgr.activate(this,"view.mapimessage")},getView:function(){return this.view},getSelectionModel:function(){return this.selectionModel},getRangeSelectionModel:function(){return this.rangeSelectionModel},bindStore:function(a){this.store=a;Ext.isDefined(a)&&
this.mon(a,{beforeload:this.onBeforeLoad,load:this.onLoad,exception:this.onLoadException,notify:this.onStoreNotify,scope:this});this.view.bindStore(a)},releaseStore:function(a){Ext.isDefined(a)||this.mun(a,{beforeload:this.onBeforeLoad,load:this.onLoad,exception:this.onLoadException,notify:this.onStoreNotify,scope:this});this.view.releaseStore(a);this.store=void 0},onBeforeLoad:function(){this.loadMask&&this.loadMask.show()},onLoad:function(){this.loadMask&&this.loadMask.hide()},onLoadException:function(){this.loadMask&&
this.loadMask.hide()},onStoreNotify:function(a,b,c,d,e,f){a=this.getRangeSelectionModel();!Ext.isEmpty(c)&&a.isActive()&&b===Zarafa.core.data.Notifications.objectCreated&&(b=a.getDateRange(),c=c[0],b.getStartTime()===c.get("startdate").getTime()&&b.getDueTime()===c.get("duedate").getTime()&&a.clearSelections())},doPaste:function(a){var b=this.createRecordCopy(a);b.addMessageAction("source_entryid",a.get("entryid"));b.addMessageAction("source_store_entryid",a.get("store_entryid"));b.addMessageAction("paste",
!0);a=this.model.store;b.get("recurring")?Zarafa.common.Actions.openRecurrenceContent(b,{store:a,pasteItem:!0}):(a.add(b),a.save(b))},getNewDateRange:function(a){var b=this.getView(),c=this.model.getCurrentDataMode(),b=b.getCalendarViewByFolder(this.model.getDefaultFolder()).selectionView.getDateRange(),d=a.get("startdate"),e=a.get("duedate");c===Zarafa.calendar.data.DataModes.MONTH?1===b.getNumDays()&&(c=b.getStartDate(),c=c.add(Date.HOUR,d.getHours()),c=c.add(Date.MINUTE,d.getMinutes()),d=Date.diff(Date.MILLI,
e,d),a=c.getTime()/1E3+d/1E3,b.set(c,new Date(1E3*a),!0,!0)):Ext.isDefined(b)?b.isAllDay()||(c=b.getStartDate(),d=Date.diff(Date.MILLI,e,d),a.get("alldayevent")?(c.clearTime(),b.setDueDate(c.add(Date.HOUR,24))):d!==Date.dayInMillis&&(a=c.getTime()/1E3+d/1E3,b.setDueDate(new Date(1E3*a),!0,!0))):(b=new Zarafa.core.DateRange,b.set(d,e,!0,!0));return b},createRecordCopy:function(a){var b=this.model.createRecord(void 0,this.getNewDateRange(a)),c=a.get("reminder"),d=Zarafa.core.mapi.AppointmentAuxiliaryFlags.auxApptFlagCopied|
136;Ext.apply(b.data,{subject:a.isCopied()?a.get("subject"):_("Copy")+":"+a.get("subject"),body:a.get("body"),location:a.get("location"),importance:a.get("importance"),label:a.get("label"),"private":a.get("private"),busystatus:a.get("busystatus"),reminder:c,categories:a.get("categories"),auxiliary_flags:d});c&&Ext.apply(b.data,{reminder_minutes:a.get("reminder_minutes"),reminder_time:a.get("reminder_time")});var e=b.getAttachmentStore();a.getAttachmentStore().each(function(a){e.add(a.copy())},this);
a.isMeeting()&&this.copyMeetingProps(b,a);a.get("recurring")&&this.copyRecurringProps(b,a);return b},copyRecurringProps:function(a,b){b.get("alldayevent")&&a.get("startdate").setHours(12);var c=a.get("startdate"),d=0;a.get("alldayevent")||(d=60*c.getHours()+c.getMinutes());Ext.apply(a.data,{recurring:!0,recurrence_start:c,recurrence_end:c,recurrence_endocc:d+a.get("duration"),recurrence_startocc:d,recurrence_subtype:b.get("recurrence_subtype"),recurrence_term:b.get("recurrence_term"),recurrence_type:b.get("recurrence_type"),
recurrence_weekdays:b.get("recurrence_weekdays"),recurrence_regen:b.get("recurrence_regen"),recurrence_numoccur:b.get("recurrence_numoccur"),recurrence_numexceptmod:b.get("recurrence_numexceptmod"),recurrence_numexcept:b.get("recurrence_numexcept"),recurrence_everyn:b.get("recurrence_everyn"),recurrence_month:b.get("recurrence_month"),recurrence_monthday:parseInt(c.format("d"),10),recurrence_nday:b.get("recurrence_nday")});a.set("recurring_pattern",a.generateRecurringPattern());a.updateTimezoneInformation()},
copyMeetingProps:function(a,b){if(b.isMeetingOrganized()){var c=a.getRecipientStore();b.getRecipientStore().each(function(a){c.add(a.copy())},this);Ext.apply(a.data,{meeting:b.get("meeting"),responsestatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED,sender_address_type:b.get("sender_address_type"),sender_email_address:b.get("sender_email_address"),sender_entryid:b.get("sender_entryid"),sender_name:b.get("sender_name"),sender_presence_status:b.get("sender_presence_status"),sender_search_key:b.get("sender_search_key"),
sender_username:b.get("sender_username"),sent_representing_address_type:b.get("sent_representing_address_type"),sent_representing_email_address:b.get("sent_representing_email_address"),sent_representing_entryid:b.get("sent_representing_entryid"),sent_representing_name:b.get("sent_representing_name"),sent_representing_presence_status:b.get("sent_representing_presence_status"),sent_representing_search_key:b.get("sent_representing_search_key"),sent_representing_username:b.get("sent_representing_username"),
reply_name:b.get("reply_name")})}else b.isMeetingReceived()&&Ext.apply(a.data,{meeting:Zarafa.core.mapi.MeetingStatus.MEETING,responsestatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED,sensitivity:b.get("sensitivity")})},destroy:function(){this.view.destroy();Zarafa.calendar.ui.CalendarPanel.superclass.destroy.apply(this,arguments)}});Ext.reg("zarafa.calendarpanel",Zarafa.calendar.ui.CalendarPanel);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarViewDragZone=Ext.extend(Ext.dd.DragZone,{calendar:void 0,ddel:void 0,headerMode:!1,constructor:function(a,b){b=b||{};this.calendar=a;var c=this.calendar.body;!0===b.headerMode&&(c=this.calendar.header);Ext.applyIf(b,{ddGroup:"AppointmentDD"});Zarafa.calendar.ui.CalendarViewDragZone.superclass.constructor.call(this,c,b);this.ddel=document.createElement("div");this.ddel.className="x-data-dd-wrap"},getDragData:function(a){var b=this.calendar.selectionModel,c=new Ext.EventObjectImpl(a),
d=this.getAppointmentFromEvent(a);a=this.getDragStateFromEvent(a,d);return{calendar:this.calendar,ddel:this.ddel,selections:b.getSelections(),target:d,state:a,origEvent:c}},onBeforeDrag:function(a,b){var c=a.target;return c&&0===c.getRecord().get("access")?!1:Zarafa.calendar.ui.CalendarViewDragZone.superclass.onBeforeDrag.apply(this,arguments)},b4StartDrag:function(a,b){Zarafa.calendar.ui.CalendarViewDragZone.superclass.b4StartDrag.apply(this,arguments);(this.calendar.enableDD||this.calendar.enableDrop)&&
this.proxy.hide()},startDrag:function(a,b){Zarafa.calendar.ui.CalendarViewDragZone.superclass.startDrag.apply(this,arguments);(this.calendar.enableDD||this.calendar.enableDrop)&&this.proxy.hide()},onInitDrag:function(a,b){var c=this.dragData;if(c&&c.origEvent){var d=c.target,e=this.calendar.selectionModel;if(d)this.calendar.onInitDrag(c.origEvent,d);d&&e.isSelected(d.getRecord())||(this.calendar.onMouseDown(c.origEvent,d),c.selections=e.getSelections());delete c.origEvent}this.ddel.innerHTML=this.calendar.getDragDropText();
this.proxy.update(this.ddel)},beforeDragOut:function(a,b,c){return this.dragData.state!==Zarafa.calendar.data.DragStates.SELECTING},onMouseUp:function(a){var b=this.dragData;b&&b.origEvent&&(this.calendar.onMouseDown(b.origEvent,b.target),delete b.origEvent);this.hideProxy();Zarafa.calendar.ui.CalendarViewDragZone.superclass.onMouseUp.apply(this,arguments)},afterRepair:function(){this.dragging=!1},getRepairXY:function(a,b){return!1},onEndDrag:function(a,b){var c=a.target;this.calendar.onEndDrag(b,
c);this.calendar.onMouseUp(b,c)},onValidDrop:function(a,b,c){this.hideProxy()},beforeInvalidDrop:function(a,b){},getAppointmentFromEvent:function(a){for(var b=this.calendar.appointments,c=0,d=b.length;c<d;c++){var e=b[c];if(!0!==this.headerMode){if(e.eventOverBody(a))return e}else if(e.eventOverHeader(a))return e}},getDragStateFromEvent:function(a,b){if(!0!==this.headerMode){if(Ext.isDefined(b))return b.eventOverBodyStartHandle(a)?Zarafa.calendar.data.DragStates.RESIZING_START:b.eventOverBodyDueHandle(a)?
Zarafa.calendar.data.DragStates.RESIZING_DUE:Zarafa.calendar.data.DragStates.DRAGGING}else if(Ext.isDefined(b))return b.eventOverHeaderStartHandle(a)?Zarafa.calendar.data.DragStates.RESIZING_START:b.eventOverHeaderDueHandle(a)?Zarafa.calendar.data.DragStates.RESIZING_DUE:Zarafa.calendar.data.DragStates.DRAGGING;return Zarafa.calendar.data.DragStates.SELECTING}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.DatePicker=Ext.extend(Ext.DatePicker,{store:void 0,monthStart:void 0,monthEnd:void 0,constructor:function(a){a=a||{};a.store||(a.store=new Zarafa.calendar.data.busytime.BusyTimeStore);Zarafa.calendar.ui.DatePicker.superclass.constructor.call(this,a);this.on("destroy",this.store.destroy,this.store);this.setNextDayTimer()},afterRender:function(){Zarafa.calendar.ui.DatePicker.superclass.afterRender.call(this);this.mon(this.store,"load",this.onLoad,this)},onLoad:function(a,b,c){this.clearCells();
if(!this.settingIsSet())return!1;a=0;for(c=this.cells.elements.length;a<c;a++){for(var d=Ext.get(this.cells.elements[a]),e=d.dom.firstChild.dateValue,f=!1,g=0,h=b.length;g<h;g++){var k=b[g],l=k.get("startdate").clearTime(!0).getTime();if(e==l&&k.get("busystatus")!=Zarafa.core.mapi.BusyStatus.FREE){f=!0;break}}f?d.addClass("x-date-busy"):d.removeClass("x-date-busy")}},onShow:function(){this.reloadStore(this.cells.first().dom.firstChild.dateValue,this.cells.last().dom.firstChild.dateValue);Zarafa.calendar.ui.DatePicker.superclass.onShow.apply(this,
arguments)},onHide:function(){this.store.cancelLoadRequests();Zarafa.calendar.ui.DatePicker.superclass.onHide.apply(this,arguments)},reloadStore:function(a,b){var c=container.getHierarchyStore().getDefaultFolder("calendar");c&&(this.monthStart=this.value.clone(),this.monthStart.setDate(1),this.monthEnd=this.monthStart.add(Date.MONTH,1),this.store.load({actionType:Zarafa.core.Actions.list,params:{entryid:c.get("entryid"),store_entryid:c.get("store_entryid"),restriction:{startdate:a/1E3,duedate:b/1E3}}}))},
update:function(a,b){Zarafa.calendar.ui.DatePicker.superclass.update.call(this,a,b);!this.hidden&&this.dateIsChanged(a)&&this.reloadStore(this.cells.first().dom.firstChild.dateValue,this.cells.last().dom.firstChild.dateValue)},dateIsChanged:function(a){a=a.getTime();return!this.monthStart||!this.monthEnd||a<this.monthStart.getTime()||this.monthEnd.getTime()<=a},settingIsSet:function(){return container.getSettingsModel().get("zarafa/v1/contexts/calendar/datepicker_show_busy")},clearCells:function(){this.cells.each(function(a){a.removeClass("x-date-busy")})},
setNextDayTimer:function(){var a=Date.diff(Date.MILLISECONDS,(new Date).clearTime().add(Date.DAY,1),new Date);Ext.defer(function(){if(this.activeDate.getTime()!==(new Date).clearTime().getTime()){this.activeDate=void 0;var a=this.navigationContext.model,c=(new Date).dateFormat(this.format);this.todayBtn.setTooltip(String.format(this.todayTip,c));a.setDate(new Date);a.load()}this.setNextDayTimer()},a,this)}});Ext.reg("zarafa.datepicker",Zarafa.calendar.ui.DatePicker);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.DateRangeSelectionModel=Ext.extend(Ext.util.Observable,{dateRange:void 0,calendarView:void 0,active:!1,constructor:function(a){this.addEvents("selectionclear","selectionset","selectionchange");Zarafa.calendar.ui.DateRangeSelectionModel.superclass.constructor.call(this,a)},clearSelections:function(){var a=this.dateRange,b=this.calendarView;this.calendarView=this.dateRange=void 0;this.active=!1;this.fireEvent("selectionclear",this,a,b);this.fireEvent("selectionchange",this,this.dateRange,
this.calendarView,this.active)},set:function(a,b){this.dateRange=a;this.calendarView=b;this.active=!0;this.fireEvent("selectionset",this,this.dateRange,this.calendarView);this.fireEvent("selectionchange",this,this.dateRange,this.calendarView,this.active)},getDateRange:function(){return this.dateRange},getCalendarView:function(){return this.calendarView},isActive:function(){return this.active}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.IconCache={getDashedImage:function(){var a=new Image;a.src="data:image/gif;base64,R0lGODlhCAAIAIABAP///wAAACH5BAEKAAEALAAAAAAIAAgAAAIPhIN2qRgKHIwPslZxpq8AADs=";return function(){return a}}(),getPrivateIcon:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADaSURBVCiRfZE9SkNRFIS/GbMBW0uthKQVBCEbMNroBrIE95BtBMGfgJDKFYQUWgQEwR1Y2VgYbQxMCl/kRd/NwMA9l++eM5xLEpoMnEt6kvQhaQb0klCCjyWl5kdJn8CJKmBNtp+BzqpOsi1pCixa/+gf7dQLSe/Vce7Cg7fC/UtT/v6f/CsvgO7aBEm7tveBe+ALGAMPkm6TtJNM6p1PJcX2je1roNu4wQq+kPRq+8r2CDja8D+cSZravrR9BxyW4CRQxRhKGgMHm+AkbAHfwF6SQZJZYZ2/WgIY6MDMF1W9zwAAAABJRU5ErkJggg==";
return function(){return a}}(),getPrivateIconActive:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADDSURBVCiRhZExakJREEWPNtbiDtIJsRJSCX8DUQnoBlyCZZaRBaRRYyUWtjaioIUgCNlBKrEzSfXhpPnKN7ynFwZmhjszd2ZQiVhX3akndas2VWLkZ6+xUX/UVkElgD1Qy8VlYAmksYIjUAnkv4shNnCI5D9D+nuGkarJ/wkPQBWYAb/ABFgDH8AjsMh3bmedRupQTUIXPDt99UsdqGO1EftPEegAL8AcKAFvwCqyNGQy3tWJ+nTj8xdJr+pUrd8jq/wBj4Qn+tCooUUAAAAASUVORK5CYII=";
return function(){return a}}(),getRecurringIcon:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAC8SURBVBiVjdAxSoNhEITh5wsBK0EkeIUUVqaytAsWKTyBjW1IpaAewsbCI1h4gBQeQ8EiB7ASjIkQElmbTfj4IeLCwMK+DDsjItTCHlq5X+MgItTACG8ILPCCJR7yruAJn7jEEU4SDKxwCOf4QrdyP05orTG84qr5a1MF+5hGxMofU9aPbgVK6WDxH/ARO3CLKWaYY1iFOsMPerCL90z3gQFOcZ/V3GwKx0WCE3yn8zP6G/cEW7ir9naznl/h/Yxfc66Y/AAAAABJRU5ErkJggg==";
return function(){return a}}(),getRecurringIconActive:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAC+SURBVBiVjdA9SoNRFITh+ULAShARt2BhpZWlnVhYZAU2tmKloC7CJoVLsHABFi7DQIosIJVg/IFg5LHwfnATJGRg4MB5Gc6ZIAveQKfM19hGauACQ3+a4gXfuG/BBo94wyX2cFhAmGE3OMU7dqr0A/N6Cga4+ufWOTfYTDJJMssSNVi2T5KtJNNVwIcka8EtJvjAJ86r23r4wX6wjnH57hUnOEa/VHNTF35WwBG+SvIzjtr0Fuzgrpq7i/X8AnV2PLeO7j8sAAAAAElFTkSuQmCC";
return function(){return a}}(),getExceptionIcon:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADlSURBVCiRfdG9LsRBFMbhZ3wUQmk7dFuQyMqWmyAhEbRb2HtwAUTpClBpJFpXoBGVXkMh8dFJkG0QiUJG4SxT/NdJTjFzzm/yvu/APmZyzqoa25gszjp4RAObOMcb7nCKT5z8AkFtxOAKa6hhGpfI0Ys5ZwN+qh7L4+jmnF8wgTl/dZBSGoQR3GAK63hCq6+nkDRUmFrBc09CJVCRzFJAy70HMdwXiKWFgFaxhcNS0hle8Y4PtOO+hW7M6mVKOxjDKB5wnVJqYh4pYp2FUsIRvnCBe9ziOP6jGel1SqCG3X88NbD3DfGjzICsYsYEAAAAAElFTkSuQmCC";
return function(){return a}}(),getExceptionIconActive:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADsSURBVCiRfdHNKsRRHMbxJy+zMSuZjYWNUuyU15IkUmY1WbsA5QJkaa/kDiyVS+AOrGdjITWi7OQlpI/FHPzNwlNP53ee0/fX+Z0THGMKqXgEA6Xew9j3WdBCB7M4xLWu3tEu61kVCLbxgXvsYg5NXPnVWhU4LZ3vMFOydX/VxmAwjjfMYxW3WOiZ6cffxWglXC7Q0n9ArxcLtFL2dTT+A1JerVOGPcJlFTjHI57wgq2ST+MBn9hA+tLVfpJ6kqEkd0kekzST7CQZTvKcpJbkz5VOSqfr8lmvuMAmJnGDVhVo4KDU/aj1zDSB4y/Ev7tGkhQziQAAAABJRU5ErkJggg==";
return function(){return a}}(),getMeetingIcon:function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAHRSURBVCiRnZNNa1pBFIafuc4dGxdSibaIgg2kKZSCItKNuHRhf4H9WInLLov5Af4GweX9A125cRPINhREIUWK2Un01uIm4tfccKeL4BdtF83AYQ7nzHvOe17OCGMMjz3WxnEcZ+U4zpP9pOM4f1Tej4kPn78agLPodwbT1xgjtg9fxa758evNAXg/JgGOw6csFt94FjlDqSOUrZBSMv95xcsXb7n37tGeRmvNfH7FcfiU6d3NjvZSvscSNpawsCyLQCDA0+QXAoEAwhII8WBL+XHLQgJM724eJZj89O6ITCbz38But/vQGWA8HmPbNp7nYds26/UaKSVa6+29yadSqR1tACkl0WiU0WhEvV4HwPf9f5oxZgdeLpfc3t6yWq0Ih8Pkcjm01lSrVUKhEABaa5rNJovFgk6ns1NbKUUikUApRTAYpFKpkE6nqdVq9Pt9XNfl/PycZDJJsVhEKbXrbIxhMpmwWVfbtsnn8wghaDQaeJ5HqVQim80SiUQOZ47H4wdqGmPo9XoMh0PK5TKz2YzBYEA8Ht+CRbvddn3ff74PbLVaFAoFTk5OyGazGGO2Il1eXuK6LhcXF4i//apyuWxisdiB4psCvu/jeR6TyYTf1e/eakeXUAkAAAAASUVORK5CYII=";
return function(){return a}}(),getReminderIcon:function(){var a=new Image;a.src="data:image/gif;base64,R0lGODlhEgAMAPcAAAQCBPz+/AAAQQAAfk8AAB4A8AAA/QAAf5i/bB495AA/EgB3AABzWgC0iBVBQQB+fg4gLADj5AASEgAAAAAsKgIAiAAAQQAAfgAADAEAAACFAACBAIi+2OKU1BJBewB+AOkt7OW01IFBe3x+AABEFAADAAEIAAAAAFYgAQAAAAAAAAAAAJC+AOEDABI9AAAAAHMSAAAAAAAAAAACALAAEOIAABIAAAAAABieAO4CAJAAAHwAAHABAAUAAJEAAHwAAP/YAP/xAP8SAP8AAG0QAAX3AJFFAHwAAIUgAecAAIEAAHwAAABONQBvNhV0MgAgNWBhIAMgJQBmIABpAIBsEOll6RsAEgAAAJAMV2UABBUARAAAfgAAMAAAiAAAQQAAfn5g/wBj/wBQ/8AA/wABKgAAiAAAQQAAfv9gm/9juP9QQf8Afv+QAP/jAP8SAP8AAACYoADVnABBRQB+AABEjgADAwAIQAAAAAAgDAAAABUAAAAAAPK+YGsDngA9gAAAfMASUOIA1RIAFQACAJ8BAOsAAIEAAHwAAErYB+PjAIESAHwAAMBFAHbVAFBBAAB+AJBEAGUD0AEIFQAAAGwgAAAAAAAAAAAAAPzyAOFrABIAAAAAADTYAADjAAASAMAAAPiFAPcrABKDAAB8ABgAaO4AnpAAgHwAfHAA/wUA/5EA/3wA//8AYP8Anv8AgP8AfG0APgUBAJEAAHwAAErpPvQrAICDAHx8AAD8SADj6xUSEgAAAADE/wAr/wCD/wB8/5AAAGUAABUAAAAAAABQBAHV5QAVEgAAAAA0vgBkOwCDTAB8AFf/5PT/5ID/Enz/AOgAd+PlEBISTwAAAJBtGGVk5RWDEgB8AOMMNOoUZJBPg3wAfOzUxuIy5RJPEgAAADgAwAAB/wAA/wAAfzj8iADj5QASEgAAAAIAUAAB1QAAFQAAAAGINABkZACDgwB8fMwBUAUA1U4AFZ8AADAA8gAAawAAAAAAAACgAACcAABFAAAAANhs6dTkznsSRwAAACH5BAEAAAEALAAAAAASAAwABwg9AAMIHEiwYEEABxEeJKhQIICGDg0qfPhwIMSFFg0GoLhR4saKGBlq7HiRJMaSEzN21JjSIsWJL0c65GgwIAA7";
return function(){return a}}(),getCalendarSvgIcon:function(a){return"data:image/svg+xml;charset=utf8,"+encodeURIComponent(this.getCalendarSvgStructure(a))},getCalendarSvgStructure:function(a){return'<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="15" height="13" viewBox="0 0 15 13" style="color:'+a+';"><g><g class="icbg" style="fill:currentColor;stroke:none"><rect width="15" height="12" x="0" y="1" /><rect width="1" height="1" x="2" y="0" /><rect width="1" height="1" x="7" y="0" /><rect width="1" height="1" x="12" y="0" /></g><path class="icgr" d="M 2.5,6.5 h 10 v 4 h -10 v -4.5 M 4.5,6.5 v 4 M 6.5,6.5 v 4 M 8.5,6.5 v 4 M 10.5,6.5 v 4 M 2.5,8.5 h 9.5" style="fill:currentColor;stroke:#ffffff;stroke-width:1;stroke-linejoin=miter" /></g></svg>'}};
Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.MeetingInfo=Ext.extend(Ext.Container,{record:void 0,meetingInfoTemplate:'<hr class="preview-title-hr"><table><tpl if="values.counter_proposal"><tr class="preview-proposed"><td class="preview-proposed-title">'+pgettext("mail.previewpanel","Proposed")+':</td><td><tpl if="!Ext.isEmpty(values.proposed_start_date)">{proposed_start_date:date(_("l jS F Y G:i"))}<span>&nbsp;-&nbsp;</span></tpl><tpl if="!Ext.isEmpty(values.proposed_end_date)">{proposed_end_date:date(_("l jS F Y G:i"))}</tpl></td></tr></tpl><tr class="preview-when"><td class="preview-when-title">'+pgettext("mail.previewpanel",
"When")+':</td><td><tpl if="values.appointment_recurring === true">{appointment_recurring_pattern}</tpl><tpl if="values.appointment_recurring !== true"><tpl if="!Ext.isEmpty(values.appointment_startdate)">{appointment_startdate:date(_("l jS F Y G:i"))}<span>&nbsp;-&nbsp;</span></tpl><tpl if="!Ext.isEmpty(values.appointment_duedate)">{appointment_duedate:date(_("l jS F Y G:i"))}</tpl></tpl></td></tr><tpl if="!Ext.isEmpty(values.appointment_location)"><tr class="preview-location"><td class="preview-location-title">'+
pgettext("mail.previewpanel","Location")+":</td><td>{appointment_location:htmlEncode}</td></tr></tpl></table>",constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.meetinginfo",cls:"preview-header-meeting",hidden:!0,forceLayout:!0});Zarafa.calendar.ui.MeetingInfo.superclass.constructor.call(this,a);Ext.isString(this.meetingInfoTemplate)&&(this.meetingInfoTemplate=new Ext.XTemplate(this.meetingInfoTemplate,
{compiled:!0}))},update:function(a){a instanceof Zarafa.calendar.MeetingRequestRecord?(this.meetingInfoTemplate.overwrite(Ext.get(this.el.dom),a.data),this.setVisible(!0)):(this.el.dom.innerHTML="",this.setVisible(!1))}});Ext.reg("zarafa.meetinginfo",Zarafa.calendar.ui.MeetingInfo);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.MeetingRequestButtons=Ext.extend(Ext.ButtonGroup,{record:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{hidden:!0,forceLayout:!0,cls:"zarafa-mr-buttons",items:[this.getRemoveFromCalendarButton(),this.getNotCurrentButton(),this.getNoResponseRequiredButton(),this.getAcceptButton(),this.getTentativeButton(),this.getDeclineButton(),this.getProposeNewTimeButton(),this.getViewAllProposalsButton(),
this.getAcceptProposalButton(),this.getCalendarButton()]});Zarafa.calendar.ui.MeetingRequestButtons.superclass.constructor.call(this,a)},update:function(a,b){if(a instanceof Zarafa.calendar.AppointmentRecord){this.record=a;var c=!1,d=!1,e=!1,f=!1,g=!1,h=!1,k=!1,l=!1,m=!1,n=a.isSubMessage(),p=a.senderIsReceiver(),r=a.get("appointment_not_found"),q=a.senderIsStoreOwner(),t=a.isMeetingReceived();a instanceof Zarafa.calendar.MeetingRequestRecord?(d=c=a.isMeetingRequest(),f=(e=a.isMeetingRequestResponse())&&
a.get("counter_proposal"),g=a.get("appointment_recurring"),k=a.get("meeting_updated"),l=a.isMeetingRequestCanceled(),m=a.isMeetingOutOfDate()):(c=a.isMeeting(),l=a.isMeetingCanceled(),g=a.get("recurring"),m=(h=a.hasIdProp("basedate"))&&a.get("duedate")<new Date);this.removeFromCalendarButton.setVisible(l&&!n&&!r);this.nonCurrentButton.setVisible(d&&!n&&m);this.noResponseButton.setVisible(d&&!n&&p&&!m);var u=c&&!n&&!p&&!m&&!l&&!q&&t;this.acceptButton.setVisible(u);this.tentativeButton.setVisible(u);
this.declineButton.setVisible(u);this.proposeNewTimeButton.setVisible(c&&!n&&(!g||h)&&!p&&!m&&!l&&!q&&t);this.viewProposalsButton.setVisible(f&&!n&&!k&&!q);this.acceptProposalButton.setVisible(f&&!n&&!k&&!q);this.calendarButton.setVisible((d||e)&&!n&&!r);this.acceptButton.isVisible()?this.calendarButton.getEl().removeClass("zarafa-action"):this.nonCurrentButton.isVisible()?this.calendarButton.getEl().removeClass("zarafa-action"):this.calendarButton.isVisible()&&this.calendarButton.getEl().addClass("zarafa-action");
var v=!1;this.items.each(function(a){if(!0!==a.hidden)return v=!0,!1});this.setVisible(v)}else this.setVisible(!1)},getRemoveFromCalendarButton:function(){return{xtype:"button",ref:"removeFromCalendarButton",text:_("Remove From Calendar"),tooltip:{title:_("Remove From Calendar"),text:_("Remove From Calendar")},cls:"tb-calendar-btn-remove zarafa-action",handler:this.onRemoveFromCalendar,scope:this}},getNotCurrentButton:function(){return{xtype:"button",ref:"nonCurrentButton",text:_("Not Current"),tooltip:{title:_("Not Current"),
text:_("Meeting Request is out of date")},cls:"tb-calendar-btn-not-current zarafa-action",handler:this.onNotCurrent,scope:this}},getNoResponseRequiredButton:function(){return{xtype:"button",ref:"noResponseButton",text:_("No Response Required"),tooltip:{title:_("No Response Required"),text:_("No Response Required")},cls:"tb-calendar-btn-no-response-required",iconCls:"icon_no_response_required",handler:this.onNoResponseRequired,scope:this}},getAcceptButton:function(){return{xtype:"button",ref:"acceptButton",
text:_("Accept"),tooltip:{title:_("Accept"),text:_("Accept Meeting Request")},cls:"zarafa-action",iconCls:"icon_calendar_appt_accept",responseStatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_ACCEPTED,handler:this.openSendConfirmationContent,scope:this}},getTentativeButton:function(){return{xtype:"button",ref:"tentativeButton",text:_("Tentative"),tooltip:{title:_("Tentative"),text:_("Tentatively Accept Meeting Request")},iconCls:"icon_appt_meeting_tentative",responseStatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE,
handler:this.openSendConfirmationContent,scope:this}},getDeclineButton:function(){return{xtype:"button",ref:"declineButton",text:_("Decline"),tooltip:{title:_("Decline"),text:_("Decline Meeting Request")},iconCls:"icon_calendar_appt_cancelled",responseStatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_DECLINED,handler:this.openSendConfirmationContent,scope:this}},getProposeNewTimeButton:function(){return{xtype:"button",ref:"proposeNewTimeButton",text:_("Propose New Time"),tooltip:{title:_("Propose New Time"),
text:_("Propose New Time for Meeting Request")},iconCls:"icon_calendar_appt_newtime",handler:this.openProposeNewTimeContent,scope:this}},getViewAllProposalsButton:function(){return{xtype:"button",ref:"viewProposalsButton",text:_("View All Proposals"),tooltip:{title:_("View All Proposals"),text:_("View All Proposals")},iconCls:"icon_calendar_appt_proposals",handler:this.viewAllProposals,scope:this}},getAcceptProposalButton:function(){return{xtype:"button",ref:"acceptProposalButton",text:_("Accept Proposal"),
tooltip:{title:_("Accept Proposal"),text:_("Accept Proposed Time")},iconCls:"icon_calendar_appt_accept",handler:this.acceptProposal,scope:this}},getCalendarButton:function(){return{xtype:"button",ref:"calendarButton",text:_("View in calendar"),tooltip:{title:_("View in calendar"),text:_("View in calendar")},cls:"tb-calendar-btn-calendar zarafa-action",iconCls:"icon_calendar_view",handler:this.showMeetingInCalendar,scope:this}},onNotCurrent:function(a,b){Ext.MessageBox.show({title:_("Kopano WebApp"),
msg:_("This meeting request is out-of-date and will now be deleted."),icon:Ext.MessageBox.WARNING,record:this.record,fn:this.removeRecordOnOk,scope:this,buttons:Ext.MessageBox.OKCANCEL})},onNoResponseRequired:function(a,b){Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Your calendar has been updated automatically. This meeting request will now be deleted."),icon:Ext.MessageBox.WARNING,record:this.record,fn:this.removeRecordOnOk,scope:this,buttons:Ext.MessageBox.OKCANCEL})},removeRecordOnOk:function(a,
b){if("ok"==a){var c=this.record.getStore();c.remove(this.record);c.save(this.record)}},onRemoveFromCalendar:function(a,b){this.record.addMessageAction("action_type","removeFromCalendar");var c=this.record.getStore();c.remove(this.record);c.save(this.record)},openProposeNewTimeContent:function(a,b){this.record.get("appointment_not_found")?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("This appointment has been moved or deleted, do you want to continue?"),icon:Ext.MessageBox.WARNING,record:this.record,
fn:this.onProposeNewTimeAppointmentNotFoundConfirmation,scope:this,buttons:Ext.MessageBox.YESNO}):Zarafa.calendar.Actions.openProposeNewTimeContent(this.record)},onProposeNewTimeAppointmentNotFoundConfirmation:function(a){"yes"===a&&Zarafa.calendar.Actions.openProposeNewTimeContent(this.record)},openSendConfirmationContent:function(a,b){this.record.get("appointment_not_found")?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("This appointment has been moved or deleted, do you want to continue?"),
icon:Ext.MessageBox.WARNING,record:this.record,fn:this.onRespondAppointmentNotFoundConfirmation.createDelegate(this,[a.responseStatus],1),scope:this,buttons:Ext.MessageBox.YESNO}):Zarafa.calendar.Actions.openSendConfirmationContent(this.record,{responseType:a.responseStatus})},onRespondAppointmentNotFoundConfirmation:function(a,b){"yes"===a&&Zarafa.calendar.Actions.openSendConfirmationContent(this.record,{responseType:b})},acceptProposal:function(a,b){Zarafa.core.BrowserWindowMgr.isOwnedByMainWindow(a)||
Zarafa.core.BrowserWindowMgr.switchFocusToMainWindow();Zarafa.calendar.Actions.openAppointmentContentToAcceptProposal(this.record)},showMeetingInCalendar:function(a,b){Zarafa.core.BrowserWindowMgr.isOwnedByMainWindow(a)||Zarafa.core.BrowserWindowMgr.switchFocusToMainWindow();Zarafa.calendar.Actions.showMeetingInCalendar(this.record)},viewAllProposals:function(a,b){Zarafa.core.BrowserWindowMgr.isOwnedByMainWindow(a)||Zarafa.core.BrowserWindowMgr.switchFocusToMainWindow();Zarafa.calendar.Actions.openAppointmentContentToViewAllProposals(this.record)}});
Ext.reg("zarafa.meetingrequestbuttons",Zarafa.calendar.ui.MeetingRequestButtons);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.ToolTip=Ext.extend(Ext.ToolTip,{view:void 0,appointmentId:void 0,hideTask:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"zarafa-appointment-tooltip",width:250,target:Ext.get(document.body),autoHide:!0,dismissDelay:0,renderTo:Ext.getBody(),listeners:{afterrender:this.onAfterRender,scope:this}});Zarafa.calendar.ui.ToolTip.superclass.constructor.call(this,a)},show:function(a,b,c){if(Ext.isObject(b)&&(Ext.isDefined(this.hideTask)&&this.hideTask.cancel(),a!==this.appointmentId||
!this.isVisible())){this.appointmentId=a;a="";Ext.isEmpty(b.title)||(a+="<h2>"+b.title+"</h2>");Ext.isEmpty(b.text)||(a+="<p>"+b.text.replace("\n","<br>")+"</p>");Ext.isEmpty(b.categories)||(a+=Zarafa.common.categories.Util.getCategoriesHtml(b.categories));this.body.dom.innerHTML=a;Zarafa.calendar.ui.ToolTip.superclass.show.call(this);a=Ext.getBody();b=a.getHeight();a=a.getWidth();c=this.getHeight();var d=this.getWidth(),e=this.getPosition(),f=e.slice();e[0]+d>a&&(f[0]=a-d);e[1]+c>b&&(f[1]=b-c);this.setPosition(f[0],
f[1])}},hide:function(a){Ext.isDefined(this.hideTask)||(this.hideTask=new Ext.util.DelayedTask(function(){Zarafa.calendar.ui.ToolTip.superclass.hide.call(this)},this));a=Ext.isDefined(a)?a:500;this.hideTask.delay(a)},onAfterRender:function(){this.el.on("mouseover",function(){Ext.isDefined(this.hideTask)&&this.hideTask.cancel()},this);this.el.on("mouseout",function(){Ext.each(this.view.calendars,function(a){a.appointmentOver=null},this);this.hide()},this)}});Ext.namespace("Zarafa.contact");
Zarafa.contact.Actions={openDialog:function(a,b){if(Array.isArray(a))for(var c=0,d=a.length;c<d;c++)Zarafa.contact.Actions.openDialog(a[c],b);else a.isMessageClass("IPM.Contact",!0)?this.openContactContent(a,b):a.isMessageClass("IPM.DistList",!0)&&this.openDistlistContent(a,b)},openContactContent:function(a,b){if(Array.isArray(a))for(var c=0,d=a.length;c<d;c++)Zarafa.contact.Actions.openContactContent(a[c],b);else Ext.isEmpty(a)||Zarafa.core.data.UIFactory.openCreateRecord(a,b)},openCreateContactContent:function(a,
b){var c=a.createRecord(void 0,!1);Zarafa.contact.Actions.openContactContent(c,b)},openDistlistContent:function(a,b){if(Array.isArray(a))for(var c=0,d=a.length;c<d;c++)Zarafa.contact.Actions.openDistlistContent(a[c],b);else Ext.isEmpty(a)||Zarafa.core.data.UIFactory.openCreateRecord(a,b)},openRecipientContactContent:function(a,b){Zarafa.core.BrowserWindowMgr.isOwnedByMainWindow(a)||Zarafa.core.BrowserWindowMgr.switchFocusToMainWindow(a);var c=this.getModel().createRecord(),d=a.getRecords();Zarafa.core.data.UIFactory.openCreateRecord(c);
c.beginEdit();c.set("display_name",d.get("display_name"));c.set("email_address_1",d.get("smtp_address"));c.set("email_address_type_1",d.get("address_type"));c.updateAddressbookProps();d=(new Zarafa.contact.data.ContactDetailsParser).parseNameInfo(d.get("display_name"));c.set("given_name",d.given_name);c.set("surname",d.surname);c.endEdit()},openCreateDistlistContent:function(a,b){var c=a.createRecord(void 0,!0);Zarafa.contact.Actions.openDistlistContent(c,b)},openDetailedNameContent:function(a,b){if(!Ext.isEmpty(a)){var c=
Zarafa.core.data.SharedComponentType["contact.dialog.contact.namedetails"];b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)}},openDetailedAddressContent:function(a,b){if(!Ext.isEmpty(a)){var c=Zarafa.core.data.SharedComponentType["contact.dialog.contact.addressdetails"];b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)}},openDetailedPhoneContent:function(a,b){if(!Ext.isEmpty(a)){var c=Zarafa.core.data.SharedComponentType["contact.dialog.contact.phonedetails"];
b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)}},openMembersSelectionContent:function(a,b){if(Array.isArray(a))for(var c=0,d=a.length;c<d;c++)Zarafa.contact.Actions.openMembersSelectionContent(a[c],b);else{var e=a.copy(),c=e.getSubStore("members");Zarafa.common.Actions.openABUserMultiSelectionContent({callback:function(){a.applyData(e)},convert:function(a){return a.convertToDistlistMember()},store:c,selectionCfg:[{xtype:"zarafa.memberboxfield",fieldLabel:_("Members")+
":",height:50,boxStore:c,flex:1}]})}},openDistlistExternalMemberContent:function(a,b){var c=Zarafa.core.data.SharedComponentType["contact.dialog.distlist.externalmember"];b=Ext.applyIf(b||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)},openDistlistMember:function(a,b){if(a){var c;switch(a.get("distlist_type")){case Zarafa.core.mapi.DistlistType.DL_USER:case Zarafa.core.mapi.DistlistType.DL_USER2:case Zarafa.core.mapi.DistlistType.DL_USER3:case Zarafa.core.mapi.DistlistType.DL_DIST:c=
a.convertToContactRecord();break;case Zarafa.core.mapi.DistlistType.DL_USER_AB:case Zarafa.core.mapi.DistlistType.DL_DIST_AB:c=a.convertToAddressBookRecord();break;default:Zarafa.contact.Actions.openDistlistExternalMemberContent(a,{parentRecord:b})}c&&(container.getShadowStore().add(c),Zarafa.core.data.UIFactory.openViewRecord(c))}}};Ext.namespace("Zarafa.contact.data");
Zarafa.contact.data.config={Prefix:[[""],[_("Dr.")],[_("Miss")],[_("Mr.")],[_("Mrs.")],[_("Ms.")],[_("Prof.")]],Suffix:[[""],["I"],["II"],["III"],[_("Jr.")],[_("Sr.")]],CR:"\r",LF:"\n",CRLF:"\r\n",SP:" ",NBSP:"\u00a0"};Ext.namespace("Zarafa.contact.data");
Zarafa.contact.data.SearchFields=[{name:_("All text fields"),value:"display_name display_name_prefix categories generation fileas company_name email_address_1 email_address_2 email_address_3 home_address other_address business_address home_telephone_number cellular_telephone_number business_telephone_number business_fax_number assistant_telephone_number business2_telephone_number callback_telephone_number car_telephone_number company_telephone_number home2_telephone_number home_fax_number other_telephone_number pager_telephone_number primary_fax_number primary_telephone_number radio_telephone_number telex_telephone_number ttytdd_telephone_number"},{name:_("Name"),
value:"display_name display_name_prefix generation"},{name:_("File as"),value:"fileas"},{name:_("Company"),value:"company_name"},{name:_("Email address"),value:"email_address_1 email_address_2 email_address_3"},{name:_("Phone number"),value:"home_telephone_number cellular_telephone_number business_telephone_number business_fax_number assistant_telephone_number business2_telephone_number callback_telephone_number car_telephone_number company_telephone_number home2_telephone_number home_fax_number other_telephone_number pager_telephone_number primary_fax_number primary_telephone_number radio_telephone_number telex_telephone_number ttytdd_telephone_number"},
{name:_("Address"),value:"home_address other_address business_address"}];Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactAddressPanel=Ext.extend(Ext.form.FormPanel,{parser:null,property:"",parsedData:null,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.contactaddresspanel",border:!1,frame:!0,padding:5,items:this.createFormItems(a.property)});Zarafa.contact.dialogs.ContactAddressPanel.superclass.constructor.call(this,a)},createFormItems:function(a){return[{xtype:"textarea",anchor:"100%",
fieldLabel:_("Street"),name:a+"_street"},{xtype:"textfield",anchor:"100%",fieldLabel:_("City"),name:a+"_city"},{xtype:"textfield",anchor:"100%",fieldLabel:_("State/Province"),name:a+"_state"},{xtype:"textfield",anchor:"100%",fieldLabel:_("Zip/Postal code"),name:a+"_postal_code"},{xtype:"textfield",anchor:"100%",fieldLabel:_("Country/Region"),name:a+"_country"},{xtype:"checkbox",boxLabel:_("Show this again when address is incomplete or unclear."),ref:"settingCheckField",hideLabel:!0,checked:container.getSettingsModel().get("zarafa/v1/contexts/contact/show_address_dialog")}]},
update:function(a,b){if(Ext.isDefined(a)){var c=!0;if(Ext.isEmpty(this.parsedData)){var d=this.getForm().getValues(),e;for(e in d)if(!Ext.isEmpty(a.get(e))){this.parsedData=Ext.apply(this.parsedData||{},a.data);c=!1;break}c&&!Ext.isEmpty(a.get(this.property))&&(d=this.parser.parseInfo("address",a.get(this.property)),this.parsedData=Ext.apply(this.parsedData||{},d))}c&&Ext.iterate(this.parsedData,function(a,b){this.parsedData[this.property+"_"+a]=b;delete this.parsedData[a]},this);this.getForm().setValues(this.parsedData);
this.parsedData=null}},updateRecord:function(a){var b=this.getForm();this.settingCheckField.isDirty()&&container.getSettingsModel().set("zarafa/v1/contexts/contact/show_address_dialog",this.settingCheckField.getValue());a.beginEdit();if(Ext.isDefined(this.parser)){var c=b.getValues();Ext.iterate(c,function(a,b){c[a.substr(this.property.length+1)]=b;delete c[a]},this);a.set(this.property,this.parser.combineInfo("address",c))}b.updateRecord(a);a.endEdit()}});Ext.reg("zarafa.contactaddresspanel",Zarafa.contact.dialogs.ContactAddressPanel);
Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactDetailTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.contactdetailtab",cls:"zarafa-contactdetailtab",title:_("Details"),autoScroll:!0,labelWidth:120,labelAlign:"left",defaults:{columnWidth:.5,height:120,border:!1,header:!1,xtype:"fieldset"},items:[this.createOfficeFieldset(),this.createOfficeFieldset2(),this.createNameFieldset(),this.createDateFieldset()]});
Zarafa.contact.dialogs.ContactDetailTab.superclass.constructor.call(this,a)},createOfficeFieldset:function(){return{defaultType:"textfield",defaults:{anchor:"100%"},items:[{fieldLabel:_("Department"),name:"department_name",listeners:{scope:this,change:this.onFieldChange}},{fieldLabel:_("Office location"),name:"office_location",listeners:{scope:this,change:this.onFieldChange}},{fieldLabel:_("Profession"),name:"profession",listeners:{scope:this,change:this.onFieldChange}}]}},createOfficeFieldset2:function(){return{defaultType:"textfield",
defaults:{anchor:"100%"},items:[{fieldLabel:_("Manager's name"),name:"manager_name",listeners:{scope:this,change:this.onFieldChange}},{fieldLabel:_("Assistant's name"),name:"assistant",listeners:{scope:this,change:this.onFieldChange}}]}},createNameFieldset:function(){return{defaultType:"textfield",defaults:{anchor:"100%"},items:[{fieldLabel:_("Nickname"),name:"nickname",listeners:{scope:this,change:this.onFieldChange}},{xtype:"combo",fieldLabel:_("Title"),editable:!1,name:"display_name_prefix",mode:"local",
triggerAction:"all",store:{xtype:"arraystore",fields:["displayText"],data:Zarafa.contact.data.config.Prefix},tpl:new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">{displayText:htmlEncodeDefaultValue(Zarafa.contact.data.config.NBSP)}</div></tpl>',{compiled:!0}),displayField:"displayText",valueField:"displayText",listeners:{scope:this,change:this.onNameChange}},{xtype:"combo",fieldLabel:_("Suffix"),editable:!1,name:"generation",mode:"local",triggerAction:"all",store:{xtype:"arraystore",
fields:["displayText"],data:Zarafa.contact.data.config.Suffix},tpl:new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">{displayText:htmlEncodeDefaultValue(Zarafa.contact.data.config.NBSP)}</div></tpl>',{compiled:!0}),displayField:"displayText",valueField:"displayText",listeners:{scope:this,change:this.onNameChange}}]}},createDateFieldset:function(){return{defaultType:"textfield",defaults:{anchor:"100%"},items:[{fieldLabel:_("Spouse/Partner"),name:"spouse_name",listeners:{scope:this,change:this.onFieldChange}},
{xtype:"datefield",fieldLabel:_("Birthday"),ref:"../birthdayField",name:"birthday",format:"d/m/Y",listeners:{scope:this,change:this.onDateChange}},{xtype:"datefield",fieldLabel:_("Anniversary"),ref:"../anniversaryField",name:"wedding_anniversary",format:"d/m/Y",listeners:{scope:this,change:this.onDateChange}}]}},update:function(a,b){Ext.isEmpty(a)||(this.record=a,this.getForm().loadRecord(a))},updateRecord:function(a){a.beginEdit();var b=this.birthdayField.getValue(),c=a.get(this.birthdayField.getName());
if(Ext.isDate(b)!==Ext.isDate(c)||Ext.isDate(b)&&b!==c)this.onDateChange(this.birthdayField,b,c);b=this.anniversaryField.getValue();c=a.get(this.anniversaryField.getName());if(Ext.isDate(b)!==Ext.isDate(c)||Ext.isDate(b)&&b!==c)this.onDateChange(this.anniversaryField,b,c);this.getForm().updateRecord(a);(a.isModifiedSinceLastUpdate("display_name_prefix")||a.isModifiedSinceLastUpdate("given_name")||a.isModifiedSinceLastUpdate("middle_name")||a.isModifiedSinceLastUpdate("surname")||a.isModifiedSinceLastUpdate("generation"))&&
this.generateDisplayName();a.endEdit()},onFieldChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.beginEdit(),this.record.set(a.getName(),b),this.record.endEdit())},onNameChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.beginEdit(),this.record.set(a.getName(),b),this.generateDisplayName(),this.record.endEdit())},onDateChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.beginEdit(),Ext.isEmpty(b)?this.record.set(a.getName(),null):this.record.set(a.getName(),
b),"birthday"==a.getName()?this.record.set("birthday_eventid",this.record.get("birthday_eventid"),!0):this.record.set("anniversary_eventid",this.record.get("anniversary_eventid"),!0),this.record.set("subject",this.record.get("subject"),!0),this.record.updateTimezoneInformation(),this.record.endEdit())},generateDisplayName:function(){var a=this.record,b={display_name_prefix:a.get("display_name_prefix"),given_name:a.get("given_name"),middle_name:a.get("middle_name"),surname:a.get("surname"),generation:a.get("generation")};
a.set("display_name",this.getContactParser().combineInfo("name",b))},getContactParser:function(){return this.dialog.contactParser}});Ext.reg("zarafa.contactdetailtab",Zarafa.contact.dialogs.ContactDetailTab);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactNamePanel=Ext.extend(Ext.form.FormPanel,{parser:null,parsedData:null,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.contactnamepanel",border:!1,frame:!0,padding:5,items:this.createFormItems()});Zarafa.contact.dialogs.ContactNamePanel.superclass.constructor.call(this,a)},createFormItems:function(){return[{xtype:"combo",fieldLabel:_("Title"),editable:!1,name:"display_name_prefix",
mode:"local",triggerAction:"all",store:{xtype:"arraystore",fields:["displayText"],data:Zarafa.contact.data.config.Prefix},tpl:new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">{displayText:htmlEncodeDefaultValue(Zarafa.contact.data.config.NBSP)}</div></tpl>',{compiled:!0}),displayField:"displayText",valueField:"displayText"},{xtype:"textfield",anchor:"100%",fieldLabel:_("First"),name:"given_name"},{xtype:"textfield",anchor:"100%",fieldLabel:_("Middle"),name:"middle_name"},{xtype:"textfield",
anchor:"100%",fieldLabel:_("Last"),name:"surname"},{xtype:"combo",fieldLabel:_("Suffix"),editable:!1,name:"generation",mode:"local",triggerAction:"all",store:{xtype:"arraystore",fields:["displayText"],data:Zarafa.contact.data.config.Suffix},tpl:new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">{displayText:htmlEncodeDefaultValue(Zarafa.contact.data.config.NBSP)}</div></tpl>',{compiled:!0}),displayField:"displayText",valueField:"displayText"},{xtype:"checkbox",boxLabel:_("Show this again when name is incomplete or unclear."),
ref:"settingCheckField",hideLabel:!0,checked:container.getSettingsModel().get("zarafa/v1/contexts/contact/show_name_dialog")}]},update:function(a,b){if(Ext.isDefined(a)){if(Ext.isEmpty(this.parsedData)){var c=this.getForm().getValues(),d;for(d in c)if(!Ext.isEmpty(a.get(d))){this.parsedData=Ext.apply(this.parsedData||{},a.data);break}Ext.isEmpty(this.parsedData)&&!Ext.isEmpty(a.get("display_name"))&&(c=this.parser.parseInfo("name",a.get("display_name")),this.parsedData=Ext.apply(this.parsedData||
{},c))}this.getForm().setValues(this.parsedData);this.parsedData=null}},updateRecord:function(a){var b=this.getForm();this.settingCheckField.isDirty()&&container.getSettingsModel().set("zarafa/v1/contexts/contact/show_name_dialog",this.settingCheckField.getValue());a.beginEdit();Ext.isDefined(this.parser)&&a.set("display_name",this.parser.combineInfo("name",b.getValues()));b.updateRecord(a);a.endEdit()}});Ext.reg("zarafa.contactnamepanel",Zarafa.contact.dialogs.ContactNamePanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactPhonePanel=Ext.extend(Ext.form.FormPanel,{parser:null,parsedData:null,property:null,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.contactphonepanel",border:!1,frame:!0,padding:5,items:this.createFormItems()});Zarafa.contact.dialogs.ContactPhonePanel.superclass.constructor.call(this,a)},createFormItems:function(){return[{xtype:"textfield",anchor:"100%",fieldLabel:_("Country/Region code"),
name:"country_code"},{xtype:"textfield",anchor:"100%",fieldLabel:_("City/Area code"),name:"city_code"},{xtype:"textfield",anchor:"100%",fieldLabel:_("Local number"),name:"local_number"},{xtype:"textfield",anchor:"100%",fieldLabel:_("Extension"),name:"extension"}]},update:function(a,b){if(Ext.isDefined(a)){if(Ext.isEmpty(this.parsedData)&&!Ext.isEmpty(a.get(this.property))){var c=this.parser.parseInfo("phone",a.get(this.property));this.parsedData=Ext.apply(this.parsedData||{},c)}this.getForm().setValues(this.parsedData);
this.parsedData=null}},updateRecord:function(a){var b=this.getForm();a.beginEdit();Ext.isDefined(this.parser)&&a.set(this.property,this.parser.combineInfo("phone",b.getValues()));b.updateRecord(a);a.endEdit()}});Ext.reg("zarafa.contactphonepanel",Zarafa.contact.dialogs.ContactPhonePanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistNotesTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.distlistnotestab",title:_("Notes"),layout:"fit",items:[{xtype:"zarafa.editorfield",useHtml:!1,ref:"editorField",plaintextName:"body",listeners:{afterlayout:function(){this.editorField.getEditor().getEl().set({placeholder:_("Type your note here...")})},change:this.onPropertyChange,
scope:this}}]});Zarafa.contact.dialogs.DistlistNotesTab.superclass.constructor.call(this,a)},update:function(a,b){Ext.isEmpty(a)||(this.record=a,this.getForm().loadRecord(this.record))},updateRecord:function(a){this.getForm().updateRecord(a)},onPropertyChange:function(a,b,c){this.record.set(a.getName(),b)}});Ext.reg("zarafa.distlistnotestab",Zarafa.contact.dialogs.DistlistNotesTab);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.distlistpanel",border:!1,layout:"fit",items:this.createFormPanel()});Zarafa.contact.dialogs.DistlistPanel.superclass.constructor.call(this,a)},createFormPanel:function(){return[{xtype:"tabpanel",activeTab:0,border:!1,defaults:{autoHeight:!1,frame:!0},items:[{xtype:"zarafa.distlistmemberstab"},{xtype:"zarafa.distlistnotestab",autoScroll:!1},container.populateInsertionPoint("context.contact.distlistcontentpanel.tabs",
this)]}]}});Ext.reg("zarafa.distlistpanel",Zarafa.contact.dialogs.DistlistPanel);Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactPhotoContextMenu=Ext.extend(Ext.menu.Menu,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactphotocontextmenu",items:[{text:_("Change Picture")+"...",iconCls:"icon_change_picture",handler:this.onChangePicture,scope:this},{text:_("Remove Picture"),iconCls:"icon_delete",handler:this.onRemovePicture,scope:this}]});Zarafa.contact.ui.ContactPhotoContextMenu.superclass.constructor.call(this,a)},onChangePicture:function(){this.parent.uploadContactPhoto()},onRemovePicture:function(){this.parent.clearContactPhoto(this.records.store,
this.records)}});Ext.reg("zarafa.contactphotocontextmenu",Zarafa.contact.ui.ContactPhotoContextMenu);Ext.namespace("Zarafa.contact.ui");Zarafa.contact.ui.ContactPreviewPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactpreviewpanel",border:!1,bodyCfg:{cls:"preview-body"},layout:"fit",items:[{xtype:"zarafa.contactbody"}]});Zarafa.contact.ui.ContactPreviewPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.contactpreviewpanel",Zarafa.contact.ui.ContactPreviewPanel);
Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ExportContactContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{records:[],constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.exportcontactcontextmenu",cls:"k-categories",items:[{xtype:"zarafa.conditionalitem",text:_("VCF file(s)"),iconCls:"icon_saveaseml",hideOnDisabled:!1,beforeShow:this.onExportMenuBeforeShow,handler:this.onContextItemVcf,scope:this}]});Zarafa.contact.ui.ExportContactContextMenu.superclass.constructor.call(this,a)},onContextItemVcf:function(){Zarafa.common.Actions.openSaveEmlDialog(this.records)},
onExportMenuBeforeShow:function(a,b){Ext.each(b,function(b){if(!b.isMessageClass("IPM.Contact"))return a.setDisabled(!0),!1},this)}});Ext.reg("zarafa.exportcontactcontextmenu",Zarafa.contact.ui.ExportContactContextMenu);Ext.namespace("Zarafa.hierarchy");
Zarafa.hierarchy.Actions={openFolder:function(a){0!==a.get("access")?a.isSearchFolder()?Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["common.search"],[],{searchFolder:a,title:a.get("display_name")}):container.selectFolder(a):a.isIPMSubTree()||a.isSharedFolder()?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:a.isIPMSubTree()?_("Not enough permissions to open this store, do you want to remove it from the hierarchy?"):_("Not enough permissions to open this folder, do you want to remove it from the hierarchy?"),
icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.YESNO,fn:this.onFolderPermissionBox,scope:a}):Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Not enough permissions to open this folder."),icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK})},onFolderPermissionBox:function(a){if("yes"===a)if(this.isIPMSubTree()){a=container.getHierarchyStore();var b=this.getMAPIStore();a.remove(b);a.save(b)}else a=this.store,a.remove(this),a.save(this)},openCreateFolderContent:function(a,b){Ext.isDefined(a)||
(a=container.getHierarchyStore().getDefaultFolder(container.getCurrentContext().getName()),Ext.isDefined(a)||(a=container.getHierarchyStore().getDefaultFolder("inbox")));var c=Zarafa.core.data.RecordFactory.createRecordObjectByObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,{parent_entryid:a.get("entryid"),store_entryid:a.get("store_entryid")});b=Ext.applyIf(b||{},{parentFolder:a,manager:Ext.WindowMgr});Zarafa.core.data.UIFactory.openCreateRecord(c,b)},openFolderPropertiesContent:function(a,b){var c=
Zarafa.core.data.SharedComponentType["hierarchy.dialog.folderproperties"];b=Ext.applyIf(b||{},{manager:Ext.WindowMgr});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)},openFolderSizeContent:function(a,b){var c=Zarafa.core.data.SharedComponentType["hierarchy.dialog.foldersize"];b=Ext.applyIf(b||{},{manager:Ext.WindowMgr});Zarafa.core.data.UIFactory.openLayerComponent(c,a,b)},openSharedFolderContent:function(a,b){var c=Zarafa.core.data.SharedComponentType["hierarchy.dialog.opensharedfolder"];b=
Ext.applyIf(b||{},{defaultSelectedFolderType:a,modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(c,void 0,b)},openFolderSelectionContent:function(a){var b=Zarafa.core.data.SharedComponentType["hierarchy.dialog.folderselection"];a=Ext.applyIf(a||{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(b,void 0,a)}};Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.HierarchyTreeLoader=Ext.extend(Ext.tree.TreeLoader,{tree:void 0,store:void 0,nodeConfig:void 0,deferredLoading:!1,deferredLoadingActiveParent:void 0,isDeferred:!1,constructor:function(a){a=a||{};a.directFn||(a.directFn=this.directFn.createDelegate(this));Zarafa.hierarchy.data.HierarchyTreeLoader.superclass.constructor.call(this,a);if(this.tree.rendered)this.onTreeAfterRender();else this.tree.on("afterrender",this.onTreeAfterRender,this,{single:!0})},onTreeAfterRender:function(){this.bindStore(this.store,
!0);!0===this.deferredLoading&&(this.isParentCardLayout(this.tree)?this.deferredLoadingActiveParent=this.tree:(this.deferredLoadingActiveParent=this.tree.findParentBy(this.isParentCardLayout,this),this.deferredLoadingActiveParent||(this.deferredLoading=!1)))},isParentCardLayout:function(a){return a.ownerCt&&a.ownerCt.layout&&"card"===a.ownerCt.layout.type},bindStore:function(a,b){if(!0===b||this.store!==a)if(this.store&&(this.store.un("load",this.onHierarchyLoad,this),this.store.un("remove",this.onHierarchyStoreRemove,
this),this.store.un("addFolder",this.onHierarchyAddFolder,this),this.store.un("updateFolder",this.onHierarchyUpdateFolder,this),this.store.un("removeFolder",this.onHierarchyRemoveFolder,this)),this.store=a)this.store.on({load:this.onHierarchyLoad,remove:this.onHierarchyStoreRemove,addFolder:this.onHierarchyAddFolder,updateFolder:this.onHierarchyUpdateFolder,removeFolder:this.onHierarchyRemoveFolder,scope:this})},onHierarchyLoad:function(a,b,c){!0!==c.add&&this.tree.getRootNode().removeAll(!0);a=this.deferredLoadingActiveParent;
!0!==this.deferredLoading||a===a.ownerCt.layout.activeItem?this.doHierarchyLoad():(this.isDeferred=!0,this.deferredLoadingActiveParent.on("activate",this.doHierarchyLoad,this,{single:!0}))},doHierarchyLoad:function(){var a=this.tree.getRootNode();!1!==this.fireEvent("beforeload",this,a,this.directFn)&&this.directFn(a.id,this.doHierarchyLoadCallback.createDelegate(this));this.isDeferred=!1},doHierarchyLoadCallback:function(a,b){for(var c=this.tree.getRootNode(),d=0,e=a.length;d<e;d++){var f=a[d],g=
f.folder,h=c.findChildByEntryId(g.get("entryid"));h?h.attributes.folder!==g?(h.attributes.folder=g,h.reload()):g.isFavoritesRootFolder()&&(f=g.getMAPIStore().getFavoritesStore(),h.childNodes.length!==f.getCount()&&h.reload()):(h=this.createNode(f),c.appendChild(h))}c.childNodes.length!==a.length&&c.reload();this.fireEvent("load",this,c,b)},onHierarchyStoreRemove:function(a,b){if(!0!==this.isDeferred){var c=this.tree.getRootNode().findChildStoreByEntryId(b.get("store_entryid"));if(c&&(c.remove(!0),
!0===this.deferredLoading))this.deferredLoadingActiveParent.on("activate",this.doHierarchyLoad,this,{single:!0})}},onHierarchyAddFolder:function(a,b,c){if(!0!==this.isDeferred)if(Array.isArray(c))for(var d=0,e=c.length;d<e;d++)this.onHierarchyAddFolder(a,b,c[d]);else!0===c.phantom||!this.tree.nodeFilter(c)||(!c.isFavoritesFolder()||!c.isContainerClass("IPF.Note")&&this.tree.hasFilter()?this.tree.getNodeById(c.get("entryid")):this.tree.getNodeById("favorites-"+c.get("entryid")))||(a=this.getFilteredParentNode(c),
b="folder",a||(a=this.tree.getRootNode(),b="rootfolder"),c=this.createNode(Ext.apply({nodeType:b,folder:c},this.nodeConfig)),a.appendChild(c),a.expand())},onHierarchyUpdateFolder:function(a,b,c){if(!0!==this.isDeferred){var d=this.tree.getTreeNode(c);if(d)if(this.tree.nodeFilter(c))a=d.parentNode,(b=this.getFilteredParentNode(c))||(b=this.tree.getRootNode()),a!==b?b.appendChild(d):(d.updateUI(c),!c.isFavoriteFolder()&&c.existsInFavorites()&&(d=c.getFavoritesFolder(),a=d.get("content_unread"),b=c.get("content_unread"),
a!==b&&d.set("content_unread",b,!1),d=this.tree.getTreeNode(d),Ext.isDefined(d)&&d.updateUI(c)));else this.onHierarchyRemoveFolder(a,b,c);else if(d=this.getFilteredParentNode(c),!Ext.isDefined(d)||d&&d.isExpanded())this.onHierarchyAddFolder(a,b,c)}},onHierarchyRemoveFolder:function(a,b,c){!0!==this.isDeferred&&((a=this.tree.getTreeNode(c))&&a.remove(!0),c.existsInFavorites()&&(a=this.tree.getTreeNode(c.getFavoritesFolder()))&&a.remove(!0))},directFn:function(a,b){var c=this.tree.getNodeById(a),d=
[];if(c.isRoot){for(var e=this.store.getRange(),f=0,g=e.length;f<g;f++){var h=e[f],k=h.getSubtreeFolder();k&&(this.tree.hasFilter()&&h.isSharedStore()&&!k.isSharedFolder()||!this.tree.nodeFilter(k)?d=d.concat(this.getFilteredChildNodes(k,"rootfolder")):d.push(Ext.apply({nodeType:"rootfolder",folder:k},this.nodeConfig)));k=h.getFavoritesRootFolder();h.isDefaultStore()&&Ext.isDefined(k)&&this.tree.nodeFilter(k)&&d.push(Ext.apply({nodeType:"rootfolder",folder:k},this.nodeConfig))}b(d,{status:!0})}else(function(a,
b){d=this.getFilteredChildNodes(c.getFolder(),"folder");b(d,{status:!0})}).defer(1,this,[a,b])},getFilteredChildNodes:function(a,b){for(var c=a.getChildren(),d=[],e=0,f=c.length;e<f;e++){var g=c[e];this.tree.nodeFilter(g)?d.push(Ext.apply({nodeType:b,folder:g},this.nodeConfig)):g.get("has_subfolder")&&(d=d.concat(this.getFilteredChildNodes(g,b)))}return d},getFilteredParentNode:function(a,b){var c;c=a.isFavoritesFolder()?a.getFavoritesRootFolder():a.getParentFolder();var d=!1;c&&(d=c===b?b:this.tree.nodeFilter(c)?
this.tree.getNodeById(c.get("entryid")):this.getFilteredParentNode(c));return d},createNode:function(a){var b=a.folder;b&&("rootfolder"===a.nodeType&&(a.extendedDisplayName=this.tree.hasFilter()),a.id=b.isFavoritesFolder()?"favorites-"+b.get("entryid"):b.get("entryid"),b.isFavoritesRootFolder()?a.leaf=0===b.get("assoc_content_count"):a.leaf=!b.get("has_subfolder"),a.uiProvider=Zarafa.hierarchy.ui.FolderNodeUI,a.expanded=this.tree.isFolderOpened(b),a.allowDrag=!b.isDefaultFolder()&&!b.isSearchFolder());
return Zarafa.hierarchy.data.HierarchyTreeLoader.superclass.createNode.apply(this,arguments)},destroy:function(){this.bindStore(null);Zarafa.hierarchy.data.HierarchyTreeLoader.superclass.destroy.apply(this,arguments)}});Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.CreateFolderPanel=Ext.extend(Ext.Panel,{parentFolder:void 0,preferredContainerClass:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{layout:{type:"vbox",align:"stretch"},border:!1,items:[this.createPanel()],buttons:[{text:_("Ok"),handler:this.onSubmit,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]});Zarafa.hierarchy.dialogs.CreateFolderPanel.superclass.constructor.call(this,
a)},createPanel:function(){return{xtype:"panel",layout:"form",border:!1,flex:1,bodyStyle:"background-color: inherit;",defaults:{anchor:"100%",style:"margin-bottom: 10px;"},labelAlign:"top",items:[{xtype:"textfield",fieldLabel:_("Name"),cls:"form-field-name",ref:"../newNameField",listeners:{scope:this,specialkey:function(a,b){if(b.getKey()==b.ENTER)this.onSubmit()}}},{xtype:"combo",fieldLabel:_("Folder contains"),cls:"form-field-folder-contains",typeAhead:!0,triggerAction:"all",lazyRender:!0,mode:"local",
store:new Ext.data.ArrayStore({fields:["value","displayText"],data:[["IPF.Appointment",_("Calendar Items")],["IPF.Note",_("Mail and Post Items")],["IPF.Contact",_("Contacts Items")],["IPF.StickyNote",_("Note Items")],["IPF.Task",_("Task Items")]]}),editable:!1,valueField:"value",displayField:"displayText",ref:"../folderListCombo"},{xtype:"zarafa.hierarchytree",fieldLabel:_("Select where to place the folder"),cls:"form-field-hierarchy",border:!0,forceLayout:!0,anchor:"100% 65%",ref:"../hierarchyTree",
treeSorter:!0,hideTodoList:!0}]}},initEvents:function(){Zarafa.hierarchy.dialogs.CreateFolderPanel.superclass.initEvents.apply(this,arguments);this.parentFolder&&this.mon(this.hierarchyTree,"load",this.onTreeNodeLoad,this);this.mon(this.hierarchyTree.getSelectionModel(),"selectionchange",this.onHierarchyNodeSelect,this)},onTreeNodeLoad:function(){this.hierarchyTree.selectFolderInTree(this.parentFolder)&&(this.mun(this.hierarchyTree,"load",this.onTreeNodeLoad,this),this.newNameField.focus())},update:function(a,
b){this.record=a},onHierarchyNodeSelect:function(a){if(a=a.getSelectedNode())(a=a.getFolder())?this.folderListCombo.findRecord("value",a.get("container_class"))?this.folderListCombo.setValue(a.get("container_class")):this.preferredContainerClass?this.folderListCombo.setValue(this.preferredContainerClass):this.folderListCombo.setValue(a.get("container_class")):this.preferredContainerClass&&this.folderListCombo.setValue(this.preferredContainerClass)},onSubmit:function(){if(0===this.newNameField.getValue().trim().length)Ext.MessageBox.show({title:_("Kopano WebApp"),
msg:_("You must specify a name."),buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.INFO});else{var a=this.hierarchyTree.getSelectionModel().getSelectedNode();a?(a=a.getFolder(),this.record.beginEdit(),this.record.set("parent_entryid",a.get("entryid")),this.record.set("store_entryid",a.get("store_entryid")),this.record.set("display_name",this.newNameField.getValue()),this.record.set("container_class",this.folderListCombo.getValue()),this.record.endEdit(),this.dialog.saveRecord()):Ext.MessageBox.show({title:_("Kopano WebApp"),
msg:_("You must select a destination folder."),buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.INFO})}},onCancel:function(){this.dialog.close()}});Ext.reg("zarafa.createfolderpanel",Zarafa.hierarchy.dialogs.CreateFolderPanel);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderPropertiesGeneralTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.folderpropertiesgeneraltab",cls:"tab-general",border:!1,bodyStyle:"background-color: inherit;",labelAlign:"left",defaults:{border:!1,xtype:"panel",layout:"form"},items:[this.createNameInfoPanel(),this.createDescriptionInfoPanel(),this.createContentInfoPanel()]});Zarafa.hierarchy.dialogs.FolderPropertiesGeneralTab.superclass.constructor.call(this,
a)},createNameInfoPanel:function(){return{style:{borderBottomWidth:"1px",borderBottomStyle:"solid"},items:[{xtype:"displayfield",cls:"display-name",name:"display_name",htmlEncode:!0,ref:"displayField",hideLabel:!0}],ref:"nameInfoPanel"}},createDescriptionInfoPanel:function(){return{cls:"description-panel",style:{borderBottomWidth:"1px",borderBottomStyle:"solid"},defaults:{anchor:"100%"},items:[{xtype:"displayfield",fieldLabel:_("Type"),htmlEncode:!0,ref:"folderTypeField"},{xtype:"displayfield",fieldLabel:_("Location"),
ref:"locationField",htmlEncode:!0},{xtype:"textarea",fieldLabel:_("Description"),height:72,name:"comment",listeners:{change:this.onFieldChange,scope:this}}],ref:"descriptionPanel"}},createContentInfoPanel:function(){return{cls:"content-info-panel",border:!1,items:[{xtype:"displayfield",fieldLabel:_("Items"),htmlEncode:!0,name:"content_count"},{xtype:"displayfield",fieldLabel:_("Unread"),htmlEncode:!0,name:"content_unread"},{xtype:"zarafa.displayfield",fieldLabel:_("Size"),renderer:Ext.util.Format.fileSize,
name:"message_size"}],buttonAlign:"left",buttons:[{xtype:"button",cls:"zarafa-normal",text:_("Folder size")+"...",handler:this.onFolderSize,scope:this}]}},updateUI:function(a,b){var c=!1;if(!0===b){var c=a.get("container_class").substr(4).replace(/\./,"").toLowerCase(),d=Zarafa.common.ui.IconClass.getIconClass(a);"appointment"===c?(c=container.getContextByName("calendar").getModel().getColorScheme(a.get("entryid")),this.nameInfoPanel.displayField.getEl().setStyle("background-image",'url(\'data:image/svg+xml;utf8,<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="15" height="13" viewBox="0 0 15 13" style="color:'+
c.base+';"><g><g class="icbg" style="fill:currentColor;stroke:none"><rect width="15" height="12" x="0" y="1" /><rect width="1" height="1" x="2" y="0" /><rect width="1" height="1" x="7" y="0" /><rect width="1" height="1" x="12" y="0" /></g><path class="icgr" d="M 2.5,6.5 h 10 v 4 h -10 v -4.5 M 4.5,6.5 v 4 M 6.5,6.5 v 4 M 8.5,6.5 v 4 M 10.5,6.5 v 4 M 2.5,8.5 h 9.5" style="fill:currentColor;stroke:#ffffff;stroke-width:1;stroke-linejoin=miter" /></g></svg>\')')):this.nameInfoPanel.displayField.addClass(String.format("folder-dialog-icon "+
d));c=String.format(_("Folder containing {0} Items"),Zarafa.common.data.FolderContentTypes.getContentName(a.get("container_class")));this.descriptionPanel.folderTypeField.setValue(c);c=!0;this.descriptionPanel.locationField.setValue(a.getPath())}c&&this.doLayout()},update:function(a,b){this.record=a;this.updateUI(a,b);this.getForm().loadRecord(a)},updateRecord:function(a){this.getForm().updateRecord(a)},onFieldChange:function(a,b,c){this.record.set(a.getName(),b)},onFolderSize:function(a){Zarafa.hierarchy.Actions.openFolderSizeContent(this.record)}});
Ext.reg("zarafa.folderpropertiesgeneraltab",Zarafa.hierarchy.dialogs.FolderPropertiesGeneralTab);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderPropertiesPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.folderpropertiespanel",cls:"zarafa-folderproperties tabpanel-container",border:!1,layout:"fit",deferredRender:!1,items:[{xtype:"tabpanel",border:!1,activeTab:0,deferredRender:!1,layoutOnTabChange:!0,items:[{xtype:"zarafa.folderpropertiesgeneraltab",title:_("General")},{xtype:"zarafa.folderpropertiespermissiontab",title:_("Permissions")},container.populateInsertionPoint("folderpropertiescontentpanel.tabs",
this)]}]});Zarafa.hierarchy.dialogs.FolderPropertiesPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.folderpropertiespanel",Zarafa.hierarchy.dialogs.FolderPropertiesPanel);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderPropertiesPermissionTab=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.folderpropertiespermissiontab",cls:"tab-permissions",layout:{type:"vbox",align:"stretch"},border:!1,items:[this.createUserListPanel(),this.createProfilePanel(),this.createPermissionPanel()]});Zarafa.hierarchy.dialogs.FolderPropertiesPermissionTab.superclass.constructor.call(this,
a)},createUserListPanel:function(){return{xtype:"panel",cls:"userlist-panel",layout:"fit",flex:1,border:!1,items:[{xtype:"grid",ref:"../userView",store:new Zarafa.hierarchy.data.MAPIFolderPermissionsSubStore,hideHeaders:!0,enableHdMenu:!1,border:!0,viewConfig:{forceFit:!0,deferEmptyText:!1,emptyText:'<div class="emptytext">'+_("No permissions granted")+"</div>"},sm:new Ext.grid.RowSelectionModel({singleSelect:!0,listeners:{selectionchange:this.onUserSelectionChange,scope:this}}),columns:[{dataIndex:"display_name",
header:"&#160;",renderer:Ext.util.Format.htmlEncode}],listeners:{viewready:this.onViewReady,scope:this}}],buttons:[{cls:"zarafa-normal",text:_("Add"),ref:"../../addUserBtn",handler:this.onUserAdd,scope:this,autoWidth:!1},{text:_("Remove"),ref:"../../removeUserBtn",handler:this.onUserRemove,scope:this,autoWidth:!1}]}},createProfilePanel:function(){var a={xtype:"jsonstore",fields:["name","value"],data:Zarafa.hierarchy.data.PermissionProfiles};return{xtype:"panel",layout:"fit",cls:"profile-panel",autoHeight:!0,
border:!1,items:{xtype:"container",autoHeight:!0,items:[{xtype:"form",layout:{type:"table",columns:2},border:!1,ref:"../profileForm",items:[{xtype:"label",autoWidth:!0,autoHeight:!0,forId:"profile-combo",hideLabel:!1,text:_("Profile")+":",ref:"../../profileLabel"},{xtype:"combo",ref:"../../../profileCombo",width:122,flex:1,id:"profile-combo",fieldLabel:_("Profile"),labelWidth:void 0,labelStyle:"width: auto",hideLabel:!0,autoHeight:!0,store:a,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",
lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,defaultValue:Zarafa.core.mapi.Rights.RIGHTS_NO_RIGHTS,listeners:{select:this.onProfileSelect,scope:this}}]}]}}},createPermissionPanel:function(){return{xtype:"form",layout:"fit",cls:"permissions-panel",autoHeight:!0,border:!1,ref:"permissionsForm",items:[{xtype:"fieldset",autoHeight:!0,autoWidth:!0,cls:"zarafa-fieldset",items:[{xtype:"container",layout:"column",items:[{xtype:"checkboxgroup",columnWidth:.5,style:"margin-right: 2px;",hideLabel:!0,
columns:1,items:[{xtype:"checkbox",boxLabel:_("Create items"),rightsValue:Zarafa.core.mapi.Rights.RIGHTS_CREATE},{xtype:"checkbox",boxLabel:_("Read items"),rightsValue:Zarafa.core.mapi.Rights.RIGHTS_READ_ANY},{xtype:"checkbox",boxLabel:_("Create subfolders"),rightsValue:Zarafa.core.mapi.Rights.RIGHTS_CREATE_SUBFOLDER}],listeners:{change:this.onPermissionChecked,scope:this}},{xtype:"checkboxgroup",columnWidth:.5,style:"margin-left: 2px;",hideLabel:!0,columns:1,items:[{xtype:"checkbox",boxLabel:_("Folder permissions"),
rightsValue:Zarafa.core.mapi.Rights.RIGHTS_FOLDER_ACCESS},{xtype:"checkbox",boxLabel:_("Folder visible"),rightsValue:Zarafa.core.mapi.Rights.RIGHTS_FOLDER_VISIBLE}],listeners:{change:this.onPermissionChecked,scope:this}}]},{xtype:"container",layout:"column",items:[{xtype:"fieldset",columnWidth:.5,cls:"zarafa-fieldset",title:_("Edit items"),items:[{xtype:"radiogroup",columns:1,hideLabel:!0,items:[{name:"allowedit",boxLabel:_("None"),hideLabel:!0,rightsValue:Zarafa.core.mapi.Rights.RIGHTS_NONE},{name:"allowedit",
boxLabel:_("Own"),hideLabel:!0,rightsValue:Zarafa.core.mapi.Rights.RIGHTS_EDIT_OWNED},{name:"allowedit",boxLabel:_("All"),hideLabel:!0,rightsValue:Zarafa.core.mapi.Rights.RIGHTS_EDIT_ANY|Zarafa.core.mapi.Rights.RIGHTS_EDIT_OWNED}],listeners:{change:this.onPermissionChecked,scope:this}}]},{xtype:"fieldset",columnWidth:.5,cls:"zarafa-fieldset",title:_("Delete items"),items:[{xtype:"radiogroup",columns:1,hideLabel:!0,items:[{name:"allowdelete",boxLabel:_("None"),hideLabel:!0,rightsValue:Zarafa.core.mapi.Rights.RIGHTS_NONE},
{name:"allowdelete",boxLabel:_("Own"),hideLabel:!0,rightsValue:Zarafa.core.mapi.Rights.RIGHTS_DELETE_OWNED},{name:"allowdelete",boxLabel:_("All"),hideLabel:!0,rightsValue:Zarafa.core.mapi.Rights.RIGHTS_DELETE_ANY|Zarafa.core.mapi.Rights.RIGHTS_DELETE_OWNED}],listeners:{change:this.onPermissionChecked,scope:this}}]}]}]}]}},onUserAdd:function(){Zarafa.common.Actions.openABUserSelectionContent({callback:this.onUserSelected,scope:this,hideContactsFolders:!0,listRestriction:{hide_users:["non_security"],
hide_groups:["non_security"],hide_companies:["non_security"]}})},onUserSelected:function(a){var b=this.userView.getStore();a=a.convertToUserPermission();0>b.findExact("entryid",a.get("entryid"))?(b.add(a),this.userView.getSelectionModel().selectRecords([a])):(b=a.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MAILUSER?_("User already exists"):_("Group already exists"),container.getNotifier().notify("error.permissions",_("Error"),b,{container:this.getEl()}))},onUserRemove:function(){var a=this.userView.getStore(),
b=this.userView.getSelectionModel().getSelected();this.selectedUser===b&&this.clearPermissionsForm();a.remove(b)},updateProfileCombo:function(a){0<=this.profileCombo.store.findExact("value",a)?this.profileCombo.setValue(a):this.profileCombo.setValue(null)},loadPermissionToGroup:function(a,b){var c=a.items;a.suspendEvents(!1);if(a instanceof Ext.form.RadioGroup){var d=c.get(0),e=c.get(1),c=c.get(2);(b&c.rightsValue)===c.rightsValue?(d.setValue(!1),e.setValue(!1),c.setValue(!0)):(b&e.rightsValue)===
e.rightsValue?(d.setValue(!1),c.setValue(!1),e.setValue(!0)):(e.setValue(!1),c.setValue(!1),d.setValue(!0))}else for(d=0,e=c.getCount();d<e;d++){var f=c.get(d);Ext.isDefined(f.rightsValue)&&f.setValue((b&f.rightsValue)===f.rightsValue)}a.resumeEvents()},updatePermissionFromGroup:function(a,b){var c=0,d=0;a.items.each(function(a){Ext.isDefined(a.rightsValue)&&(c|=a.rightsValue,a.checked&&(d|=a.rightsValue))});return b&~c|d},loadPermissionValue:function(a){this.updateProfileCombo(a);this.permissionsForm.cascade(function(b){b instanceof
Ext.form.CheckboxGroup&&this.loadPermissionToGroup(b,a)},this)},updatePermissionValue:function(){var a=0;this.permissionsForm.cascade(function(b){b instanceof Ext.form.CheckboxGroup&&(a=this.updatePermissionFromGroup(b,a))},this);return a},loadPermissionsForm:function(a){this.selectedUser=a;this.removeUserBtn.enable();this.permissionsForm.getForm().items.each(function(a){a.enable()});this.loadPermissionValue(a.get("rights"))},clearPermissionsForm:function(){this.selectedUser=void 0;this.loadPermissionValue(this.profileCombo.defaultValue);
this.removeUserBtn.disable();this.permissionsForm.getForm().items.each(function(a){a.disable()})},onViewReady:function(){this.record&&this.record.isOpened()&&0<this.record.getSubStore("permissions").getCount()&&this.userView.getSelectionModel().selectFirstRow()},onUserSelectionChange:function(a){a=a.getSelected();Ext.isEmpty(a)?this.clearPermissionsForm():this.loadPermissionsForm(a)},onProfileSelect:function(a,b,c){a=b.get("value");null!==a&&(this.loadPermissionValue(a),this.selectedUser&&this.selectedUser.set("rights",
a))},onPermissionChecked:function(a,b){var c;this.selectedUser?(c=this.selectedUser.get("rights"),c=this.updatePermissionFromGroup(a,c),this.selectedUser.set("rights",c)):c=this.updatePermissionValue();this.updateProfileCombo(c)},update:function(a,b){this.record=a;if(b&&a.isOpened()){var c=a.getSubStore("permissions");this.userView.reconfigure(c,this.userView.getColumnModel());0<c.getCount()?this.userView.getSelectionModel().selectFirstRow():this.clearPermissionsForm()}},updateRecord:function(a){this.selectedUser&&
(a=this.updatePermissionValue(),this.selectedUser.set("rights",a))}});Ext.reg("zarafa.folderpropertiespermissiontab",Zarafa.hierarchy.dialogs.FolderPropertiesPermissionTab);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderSelectionPanel=Ext.extend(Ext.Panel,{hideTodoList:!1,folder:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:"fit",border:!1,items:[{xtype:"zarafa.hierarchytree",ref:"hierarchyTree",border:!0,forceLayout:!0,treeSorter:!0,hideTodoList:!!a.hideTodoList}]});Zarafa.hierarchy.dialogs.FolderSelectionPanel.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.hierarchy.dialogs.FolderSelectionPanel.superclass.initEvents.apply(this,arguments);this.folder&&
this.mon(this.hierarchyTree,"load",this.onTreeNodeLoad,this)},onTreeNodeLoad:function(){this.hierarchyTree.selectFolderInTree(this.folder)&&this.mun(this.hierarchyTree,"load",this.onTreeNodeLoad,this)},getFolder:function(){return this.hierarchyTree.getSelectionModel().getSelectedNode().getFolder()}});Ext.reg("zarafa.folderselectionpanel",Zarafa.hierarchy.dialogs.FolderSelectionPanel);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderSizePanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.foldersizepanel",layout:{type:"vbox",align:"stretch"},border:!1,items:[this.createFolderSizePanel(),this.createSubfolderSizePanel()]});Zarafa.hierarchy.dialogs.FolderSizePanel.superclass.constructor.call(this,a)},createFolderSizePanel:function(){return{xtype:"form",ref:"folderPanel",autoHeight:!0,
border:!1,labelWidth:200,items:[{xtype:"zarafa.displayfield",fieldLabel:_("Folder Name"),htmlEncode:!0,name:"display_name"},{xtype:"zarafa.displayfield",fieldLabel:_("Size (without subfolders)"),renderer:Ext.util.Format.fileSize,name:"message_size"},{xtype:"zarafa.displayfield",fieldLabel:_("Total size (including subfolders)"),renderer:Ext.util.Format.fileSize,name:"total_message_size"}]}},createSubfolderSizePanel:function(){return{xtype:"grid",ref:"subfolderView",flex:1,store:new Zarafa.hierarchy.data.IPFSubStore,
enableColumnHide:!1,border:!0,loadMask:{msg:_("Loading subfolder sizes")+"..."},viewConfig:{forceFit:!0,deferEmptyText:!1,emptyText:'<div class="emptytext">'+_("No subfolders present")+"</div>"},sm:new Ext.grid.RowSelectionModel({singleSelect:!0}),columns:[{header:_("Subfolder"),sortable:!0,dataIndex:"folder_pathname",renderer:Ext.util.Format.htmlEncode,tooltip:_("Sort by: Name of the subfolder")},{header:_("Size"),sortable:!0,dataIndex:"message_size",renderer:Ext.util.Format.fileSize,width:50,tooltip:_("Sort by: Size (without subfolders)")},
{header:_("Total size"),sortable:!0,dataIndex:"total_message_size",renderer:Ext.util.Format.fileSize,width:50,tooltip:_("Sort by: Total size (including subfolders)")}]}},update:function(a,b){if(b&&this.record!==a){this.record=a;this.subfolderView.loadMask.show();var c=a.getStore();this.mon(c,"open",this.onOpenFolderSize,this);a.open({actionType:"foldersize",forceLoad:!0})}},onOpenFolderSize:function(a,b){if(this.record===b){this.folderPanel.getForm().loadRecord(b);var c=b.getSubStore("folders"),d=
this.subfolderView.getColumnModel();this.subfolderView.reconfigure(c,d);c.sort(d.getDataIndex(0),"ASC");this.mun(a,"open",this.onOpenFolderSize,this);this.subfolderView.loadMask.hide()}}});Ext.reg("zarafa.foldersizepanel",Zarafa.hierarchy.dialogs.FolderSizePanel);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.FolderNode=Ext.extend(Ext.tree.AsyncTreeNode,{folder:void 0,isNodeSelected:!1,tpl:new Ext.XTemplate("{text:htmlEncode}",{compiled:!0}),constructor:function(a){a=a||{};var b=a.folder;Ext.isDefined(b)&&Ext.applyIf(a,{id:b.get("entryid")});Ext.applyIf(a,{containerCls:"zarafa-tree-container",cls:"zarafa-tree-node"});Zarafa.hierarchy.ui.FolderNode.superclass.constructor.call(this,a);Ext.isString(this.tpl)&&(this.tpl=new Ext.XTemplate(this.tpl,{compiled:!0}));b&&this.updateUI(b)},getFolder:function(){return this.attributes.folder},
setChecked:function(a){this.rendered&&this.getUI().toggleCheck(a)},isChecked:function(){var a=this.getUI();return a.checkbox&&a.checkbox.checked},updateUI:function(a){this.attributes.folder=a;this.updateCounterNode(a);this.setText(this.getTextFromFolder(a));this.ui.getIconEl()&&"svg"===this.ui.getIconEl().tagName||(this.setIcon(this.getIconFromFolder(a)),this.setContainerCls(this.attributes.containerCls));a.get("has_subfolder")||a.isFavoritesRootFolder()||this.removeAll(!0)},setIcon:function(a){var b=
this.iconCls;this.iconCls=this.attributes.iconCls=a;if(this.rendered)this.getUI().onIconChange(this,a,b)},setContainerCls:function(a){var b=this.containerCls;this.containerCls=this.attributes.containerCls=a;if(this.rendered)this.getUI().onContainerClsChange(this,a,b)},updateCounterNode:function(a){!0===this.rendered&&this.getUI().updateCounter(this)},getIconFromFolder:function(a){return Zarafa.common.ui.IconClass.getIconClass(a)},getTextFromFolder:function(a){return a.getDisplayName()},update:function(a){var b;
this.ownerTree&&this.ownerTree.model&&(b=this.ownerTree.model.getFolder(this.getFolder().get("entryid")));Ext.isDefined(b)?this.setChecked(!0):this.setChecked(!1);if(a){b=0;for(var c=this.childNodes.length;b<c;b++)this.childNodes[b].update(a)}}});Ext.tree.TreePanel.nodeTypes.folder=Zarafa.hierarchy.ui.FolderNode;Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.FolderNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{currentCounterType:void 0,renderElements:function(a,b,c,d){this.indentMarkup=a.parentNode?a.parentNode.ui.getChildIndent():"";var e,f=Ext.isBoolean(b.checked),g=b.folder.isCalendarFolder(),h="";g&&(e=a.getOwnerTree().model,e||(e=container.getContextByName("calendar").getModel(),a.getOwnerTree().model=e),(e=e.getColorScheme(b.folder.get("entryid")))&&e.base&&(h='<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="15" height="13" viewBox="0 0 15 13" style="color:'+
e.base+'; position:relative; top:2px;"><g><g class="icbg" style="fill:currentColor;stroke:none"><rect width="15" height="12" x="0" y="1" /><rect width="1" height="1" x="2" y="0" /><rect width="1" height="1" x="7" y="0" /><rect width="1" height="1" x="12" y="0" /></g><path class="icgr" d="M 2.5,6.5 h 10 v 4 h -10 v -4.5 M 4.5,6.5 v 4 M 6.5,6.5 v 4 M 8.5,6.5 v 4 M 10.5,6.5 v 4 M 2.5,8.5 h 9.5" style="fill:currentColor;stroke:#ffffff;stroke-width:1;stroke-linejoin=miter" /></g></svg>'));e='<img src="'+
(b.icon||this.emptyIcon)+'" class="x-tree-node-icon" unselectable="on" />';var k,h='<li class="x-tree-node"><div ext:tree-node-id="'+a.id+'" class="x-tree-node-el x-tree-node-leaf x-unselectable zarafa-hierarchy-node" unselectable="on"><span class="x-tree-node-indent">'+this.indentMarkup+'</span><img src="'+this.emptyIcon+'" class="x-tree-ec-icon x-tree-elbow" />'+(f?'<input class="x-tree-node-cb zarafa-hierarchy-node-cb" type="checkbox" '+(b.checked?'checked="checked" />':"/>"):"")+(g?h:e)+'<a hidefocus="on" class="x-tree-node-anchor zarafa-hierarchy-node-anchor" href="'+
(b.href?b.href:Ext.isGecko?"":"#")+'" tabIndex="1" '+(b.hrefTarget?' target="'+b.hrefTarget+'"':"")+'><span unselectable="on">'+(a.tpl?a.tpl.apply(b):a.text)+'</span><span class="zarafa-hierarchy-node-counter" unselectable="on"></span><span class="zarafa-hierarchy-node-owner" unselectable="on"></span></a></div><ul class="x-tree-node-ct" style="display:none;"></ul></li>';!0!==d&&a.nextSibling&&(k=a.nextSibling.ui.getEl())?this.wrap=Ext.DomHelper.insertHtml("beforeBegin",k,h):this.wrap=Ext.DomHelper.insertHtml("beforeEnd",
c,h);this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];c=this.elNode.childNodes;this.indentNode=c[0];this.ecNode=c[1];this.iconNode=c[2];d=3;f&&(this.checkbox=c[2],this.iconNode=c[3],f=this.iconNode.childNodes[0],this.calendarSVGIconChilds=[f.childNodes[0].childNodes[0],f.childNodes[1]],d++);this.anchor=c[d];this.textNode=c[d].firstChild;this.counterNode=c[d].firstChild.nextSibling;this.folderOwnerNode=this.counterNode.nextSibling;f=Ext.get(this.elNode);c=Ext.get(this.iconNode);
d=Ext.get(this.wrap);k=Ext.get(this.textNode);g&&k.addClass("zarafa-hierarchy-node-color");Ext.isEmpty(b.cls)||f.addClass(b.cls);b.icon&&c.addClass("x-tree-node-inline-icon");b.iconCls&&c.addClass(b.iconCls);Ext.isEmpty(b.containerCls)||d.addClass(b.containerCls);this.updateCounter(a);this.showFolderOwner(a)},showFolderOwner:function(a){var b=a.getFolder();if(Ext.isDefined(b)&&b.isFavoritesFolder()&&!b.isIPMSubTree()&&!b.isFavoritesRootFolder()){a=Ext.get(this.folderOwnerNode);var b=container.getHierarchyStore().getById(b.get("store_entryid")),
c="";b.isPublicStore()?c=" - "+b.get("display_name"):b.get("mailbox_owner_name")!==container.getUser().getDisplayName()&&(c=" - "+b.get("mailbox_owner_name"));a.update(c);a.repaint()}},updateCounter:function(a){a=a.getFolder();if(!a.isTodoListFolder()){var b=Ext.get(this.elNode),c=Ext.get(this.counterNode);if(Ext.isDefined(a)){var d=this.currentCounterType,e=a.getCounterType();switch(e){case Zarafa.hierarchy.data.CounterTypes.TOTAL:Ext.isDefined(d)?d!==e&&(b.replaceClass("zarafa-hierarchy-node-unread-count",
"zarafa-hierarchy-node-total-count"),b.addClass("zarafa-hierarchy-node-withcounter")):b.addClass(["zarafa-hierarchy-node-total-count","zarafa-hierarchy-node-withcounter"]);c.update("("+a.getCounterValue()+")");c.repaint();break;case Zarafa.hierarchy.data.CounterTypes.UNREAD:Ext.isDefined(d)?d!==e&&(b.replaceClass("zarafa-hierarchy-node-total-count","zarafa-hierarchy-node-unread-count"),b.addClass("zarafa-hierarchy-node-withcounter")):b.addClass(["zarafa-hierarchy-node-unread-count","zarafa-hierarchy-node-withcounter"]);
c.update("("+a.getCounterValue()+")");c.repaint();break;default:Ext.isDefined(d)&&d!==e&&(b.removeClass(["zarafa-hierarchy-node-total-count","zarafa-hierarchy-node-unread-count"]),b.removeClass("zarafa-hierarchy-node-withcounter")),c.update(""),c.repaint()}this.currentCounterType=e}}},onTextChange:function(a,b,c){this.rendered&&(this.textNode.innerHTML=a.tpl?a.tpl.apply(a.attributes):b)},onIconChange:function(a,b,c){this.rendered&&(a=Ext.get(this.iconNode),Ext.isEmpty(c)?a.addClass(b):a.replaceClass(c,
b))},onContainerClsChange:function(a,b,c){this.rendered&&(a=Ext.get(this.wrap),Ext.isEmpty(c)?a.addClass(b):a.replaceClass(c,b))},getDDHandles:function(){var a=[this.iconNode,this.textNode,this.counterNode,this.elNode];Ext.isDefined(this.calendarSVGIconChilds)&&(a=a.concat(this.calendarSVGIconChilds));return a}});Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.HierarchyRootNode=Ext.extend(Ext.tree.AsyncTreeNode,{constructor:function(a){a=a||{};Ext.applyIf(a,{text:"root",leaf:!1,expanded:!0,uiProvider:Ext.tree.RootTreeNodeUI});Zarafa.hierarchy.ui.HierarchyRootNode.superclass.constructor.call(this,a)},findChildByEntryId:function(a){return this.findChildBy(function(b){return Zarafa.core.EntryId.compareEntryIds(b.attributes.folder.get("entryid"),a)})},findChildStoreByEntryId:function(a){return this.findChildBy(function(b){return Zarafa.core.EntryId.compareStoreEntryIds(b.attributes.folder.get("store_entryid"),
a)})}});Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.HierarchyTreeBottomBar=Ext.extend(Ext.Container,{defaultSelectedSharedFolderType:null,buttonText:_("Open Shared Folders"),constructor:function(a){a=a||{};var b=Ext.util.Format.htmlEncode(a.buttonText||this.buttonText);Ext.applyIf(a,{cls:"zarafa-hierarchy-treepanel-bottombar",layout:"table",defaultSelectedSharedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.ALL,items:[{cls:"zarafa-hierarchy-treepanel-footer-opensharedfolder",xtype:"button",tooltip:b+" (Alt + S)",text:b+" + ",
handler:this.openSharedFolder.createDelegate(this)}]});Zarafa.hierarchy.ui.HierarchyTreeBottomBar.superclass.constructor.call(this,a)},openSharedFolder:function(a,b){Zarafa.hierarchy.Actions.openSharedFolderContent(this.defaultSelectedSharedFolderType)}});Ext.reg("zarafa.hierarchytreebottombar",Zarafa.hierarchy.ui.HierarchyTreeBottomBar);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.HierarchyTreeDropZone=Ext.extend(Ext.tree.TreeDropZone,{dropAllowedAdd:"x-dd-drop-ok-add",onNodeEnter:function(a,b,c,d){this.onDragKeyDown=Zarafa.hierarchy.ui.HierarchyTreeDropZone.prototype.onDragKeyDown.createDelegate({dd:b,dz:this});this.onDragKeyUp=Zarafa.hierarchy.ui.HierarchyTreeDropZone.prototype.onDragKeyUp.createDelegate({dd:b,dz:this});Ext.EventManager.on(Ext.getDoc(),"keydown",this.onDragKeyDown,this);Ext.EventManager.on(Ext.getDoc(),"keyup",this.onDragKeyUp,this);return Zarafa.hierarchy.ui.HierarchyTreeDropZone.superclass.onNodeEnter.apply(this,
arguments)},onContainerOver:function(a,b,c){var d=Zarafa.hierarchy.ui.HierarchyTreeDropZone.superclass.onContainerOver.apply(this,arguments);d===this.dropAllowed&&b.ctrlKey&&(d=this.dropAllowedAdd);return d},onNodeOver:function(a,b,c,d){var e=Zarafa.hierarchy.ui.HierarchyTreeDropZone.superclass.onNodeOver.apply(this,arguments);c.ctrlKey&&("x-tree-drop-ok-append"===e?e="x-tree-drop-ok-append-add":"x-tree-drop-ok-above"===e?e="x-tree-drop-ok-above-add":"x-tree-drop-ok-between"===e?e="x-tree-drop-ok-between-add":
"x-tree-drop-ok-below"===e&&(e="x-tree-drop-ok-below-add"));a.node.getFolder().isFavoritesRootFolder()&&(e=void 0);return e},onNodeOut:function(a,b,c,d){Ext.EventManager.un(Ext.getDoc(),"keydown",this.onDragKeyDown,this);Ext.EventManager.un(Ext.getDoc(),"keyup",this.onDragKeyUp,this);return Zarafa.hierarchy.ui.HierarchyTreeDropZone.superclass.onNodeOut.apply(this,arguments)},onDragKeyDown:function(a){if(a.ctrlKey||a.keyCode===Ext.EventObject.CONTROL)this.dd.proxy.dropStatus===this.dz.dropAllowed?
this.dd.proxy.setStatus(this.dz.dropAllowedAdd):"x-tree-drop-ok-append"===this.dd.proxy.dropStatus?this.dd.proxy.setStatus("x-tree-drop-ok-append-add"):"x-tree-drop-ok-above"===this.dd.proxy.dropStatus?this.dd.proxy.setStatus("x-tree-drop-ok-above-add"):"x-tree-drop-ok-between"===this.dd.proxy.dropStatus?this.dd.proxy.setStatus("x-tree-drop-ok-between-add"):"x-tree-drop-ok-below"===this.dd.proxy.dropStatus&&this.dd.proxy.setStatus("x-tree-drop-ok-below-add")},onDragKeyUp:function(a){if(a.ctrlKey||
a.keyCode===Ext.EventObject.CONTROL)this.dd.proxy.dropStatus===this.dz.dropAllowedAdd?this.dd.proxy.setStatus(this.dz.dropAllowed):"x-tree-drop-ok-append-add"===this.dd.proxy.dropStatus?this.dd.proxy.setStatus("x-tree-drop-ok-append"):"x-tree-drop-ok-above-add"===this.dd.proxy.dropStatus?this.dd.proxy.setStatus("x-tree-drop-ok-above"):"x-tree-drop-ok-between-add"===this.dd.proxy.dropStatus?this.dd.proxy.setStatus("x-tree-drop-ok-between"):"x-tree-drop-ok-below-add"===this.dd.proxy.dropStatus&&this.dd.proxy.setStatus("x-tree-drop-ok-below")}});
Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.Tree=Ext.extend(Ext.tree.TreePanel,{model:void 0,store:void 0,IPMFilter:void 0,permissionFilter:void 0,hideDeletedFolders:!1,hideTodoList:!1,hideFavorites:!1,nodeConfig:void 0,deferredLoading:!1,treeEditor:void 0,loadMask:!1,treeSorter:!1,ddAutoScrollContainer:!1,ddScrollContainer:void 0,defaultOpen:!1,constructor:function(a){a=a||{};a.store||(a.store=container.getHierarchyStore());Ext.applyIf(a,{rootVisible:!1,autoScroll:!0,animate:!1,border:!1,root:new Zarafa.hierarchy.ui.HierarchyRootNode});
Zarafa.hierarchy.ui.Tree.superclass.constructor.call(this,a);!this.treeSorter||this.treeSorter instanceof Ext.tree.TreeSorter||(this.treeSorter=new Zarafa.hierarchy.ui.TreeSorter(this,Ext.apply({},this.treeSorter)))},initComponent:function(){this.loader||(this.loader=new Zarafa.hierarchy.data.HierarchyTreeLoader({tree:this,store:this.store,nodeConfig:this.nodeConfig,deferredLoading:this.deferredLoading}));Zarafa.hierarchy.ui.Tree.superclass.initComponent.apply(this,arguments);if(!0===this.enableDD)if(!0===
this.ddAutoScrollContainer)this.on("load",this.autodetectScrollContainer,this);else this.ddScrollContainer&&(this.ddScrollContainer=Ext.Element(this.ddScrollContainer)?this.ddScrollContainer:this.ddScrollContainer.el,this.registerScrollContainer(this.ddScrollContainer));if(this.loadMask)this.on("render",this.createLoadMask,this)},autodetectScrollContainer:function(){for(var a=this.ownerCt;a&&!0!==a.autoScroll;)a=a.ownerCt;a&&this.registerScrollContainer(a.body||a.el)},registerScrollContainer:function(a){a.ddScrollConfig=
{vthresh:50,hthresh:-1,frequency:100,increment:25};Ext.dd.ScrollManager.register(a)},createLoadMask:function(){this.loadMask=new Zarafa.common.ui.LoadMask(this.getEl(),Ext.apply({store:this.store},this.loadMask))},hasFilter:function(){return!Ext.isEmpty(this.IPMFilter)},nodeFilter:function(a){var b=!1;Ext.isDefined(this.IPMFilter)&&(b=!a.isContainerClass(this.IPMFilter,!1));!b&&Ext.isDefined(this.permissionFilter)&&(b=!(a.get("rights")&this.permissionFilter));!b&&this.hideDeletedFolders&&(b=a.isInDeletedItems());
!b&&this.hideTodoList&&(b=a.isTodoListFolder());!b&&this.hideFavorites&&(b=a.isFavoritesRootFolder());return!b},getAllNodes:function(){return this.getRootNode().childNodes},selectFolderInTree:function(a,b){var c;return(c=!1!==b?this.ensureFolderVisible(a):this.getTreeNode(a))?(this.getSelectionModel().select(c,void 0,b),!0):!1},ensureFolderVisible:function(a){var b=this.getTreeNode(a);if(!b){b=a.getParentFolder();if(!b)return!1;b=this.ensureFolderVisible(b);if(!b)return!1;b.expand();b=this.getTreeNode(a)}return b?
(b.ensureVisible(),b=this.getTreeNode(a),b.update(!0),b):!1},isFolderOpened:function(a){return a.isIPMSubTree()||a.isFavoritesRootFolder()||this.defaultOpen},updateAll:function(){for(var a=this.getAllNodes(),b=0;b<a.length;b++)a[b].update(!0)},beforeDestroy:function(){this.rendered&&this.loadMask&&(Ext.destroy(this.loadMask),this.loadMask=!1);this.treeSorter&&(Ext.destroy(this.treeSorter),this.treeSorter=!1);Zarafa.hierarchy.ui.Tree.superclass.beforeDestroy.call(this)},getTreeNode:function(a){var b=
a.get("entryid");a.isFavoritesFolder()&&(b="favorites-"+b);return this.getNodeById(b)}});Ext.reg("zarafa.hierarchytree",Zarafa.hierarchy.ui.Tree);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.TreeEditor=Ext.extend(Ext.tree.TreeEditor,{enableEdit:void 0,constructor:function(a,b,c){b=b||{};c=c||{};b=Ext.applyIf(b,{ignoreNoChange:!0});c=Ext.applyIf(c,{cancelOnEsc:!0,completeOnEnter:!0});Zarafa.hierarchy.ui.TreeEditor.superclass.constructor.call(this,a,b,c);this.on({beforenodeclick:this.onBeforeNodeClick,beforestartedit:this.onBeforeStartEdit,canceledit:this.onEditCancel,complete:this.onEditComplete,scope:this})},onBeforeNodeClick:function(){return!0},onBeforeStartEdit:function(){if(!this.enableEdit)return!1},
onEditCancel:function(){this.enableEdit=!1},onEditComplete:function(a,b,c){this.enableEdit=!1;a=a.editNode.getFolder();a.set("display_name",b);a.save()},startEditingNode:function(a){this.enableEdit=!0;this.triggerEdit(a)}});Ext.reg("zarafa.foldertreeeditor",Zarafa.hierarchy.ui.TreeEditor);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.TreeSorter=Ext.extend(Ext.tree.TreeSorter,{folderProperty:"display_name",storeProperty:"mailbox_owner_name",folderOrder:"inbox drafts outbox sent IPF.Note wastebasket junk calendar IPF.Appointment contact IPF.Contact todolist task IPF.Task note IPF.StickyNote journal IPF.Journal IPF.Note.OutlookHomepage".split(" "),constructor:function(a,b){Zarafa.hierarchy.ui.TreeSorter.superclass.constructor.apply(this,arguments);this.sortFn=this.hierarchySort.createDelegate(this)},hierarchySort:function(a,
b){var c=a.attributes.folder,d=b.attributes.folder,e=c.getMAPIStore(),f=d.getMAPIStore(),g=this.dir&&"desc"==this.dir.toLowerCase(),h=!0===this.caseSensitive;if(c.isFavoritesRootFolder())return g?1:-1;if(d.isFavoritesRootFolder())return g?-1:1;if(c.isIPMSubTree()){if(e.isDefaultStore())return g?1:-1;if(e.isPublicStore())return g?-1:1}if(d.isIPMSubTree()){if(f.isDefaultStore())return g?-1:1;if(f.isPublicStore())return g?1:-1}return c.isIPMSubTree()&&d.isIPMSubTree()&&(e=this.compareRecordProp(e,f,
this.storeProperty,g,h),0!==e)?e:this.compareRecordProp(c,d,this.folderProperty,g,h)},compareRecordProp:function(a,b,c,d,e){var f=a.getDefaultFolderKey(),g=b.getDefaultFolderKey();f||(f=a.get("container_class"));g||(g=b.get("container_class"));f=this.folderOrder.indexOf(f);g=this.folderOrder.indexOf(g);if(-1<f){if(-1===g||f<g)return d?1:-1;if(f>g)return d?-1:1}else if(-1<g)return d?-1:1;a=a.get(c);b=b.get(c);e||(a=Ext.isEmpty(a)?a:a.toLowerCase(),b=Ext.isEmpty(b)?b:b.toLowerCase());return a<b?d?1:
-1:a>b?d?-1:1:0}});Ext.namespace("Zarafa.mail");
Zarafa.mail.Actions={openCreateMailContent:function(a,b){var c=a.createRecord();Zarafa.core.data.UIFactory.openCreateRecord(c,b)},openCreateMailContentForContacts:function(a,b,c){a=a.createRecord();var d=a.getRecipientStore(),e=[];b=Array.isArray(b)?b:[b];for(var f=0,g=b.length;f<g;f++){var h=b[f];if(h.isOpened()){var k=h.convertToRecipient(Zarafa.core.mapi.RecipientType.MAPI_TO,!0);d.add(k)}else e.push({fn:function(){var a=h;return function(b,c,e,f){var g=function(b,c){if(c===a){b.un("open",g,e);
var h=a.convertToRecipient(Zarafa.core.mapi.RecipientType.MAPI_TO,!0);d.add(h);f()}};a.getStore().on("open",g,e);a.open()}}()})}c=Ext.applyIf(c||{},{recordComponentPluginConfig:{loadTasks:e}});Zarafa.core.data.UIFactory.openCreateRecord(a,c)},openCreateMailResponseContent:function(a,b,c,d){Array.isArray(a)||(a=[a]);for(var e,f=0;f<a.length;f++){var g=a[f];if(!g.isFaultyMessage())if(c===Zarafa.mail.data.ActionTypes.FORWARD_ATTACH)e=b.createResponseRecord(g,c,e);else{var h=function(a,f){this===f&&(c===
Zarafa.mail.data.ActionTypes.FORWARD_ATTACH?e=b.createResponseRecord(f,c,e):(e=b.createResponseRecord(f,c),Zarafa.core.data.UIFactory.openCreateRecord(e,d),a.un("open",h,f)))};g.isOpened()?(e=b.createResponseRecord(g,c),Zarafa.core.data.UIFactory.openCreateRecord(e,d)):(g.getStore().on("open",h,g),g.open())}}c===Zarafa.mail.data.ActionTypes.FORWARD_ATTACH&&Zarafa.core.data.UIFactory.openCreateRecord(e,d)},openMailOptionsContent:function(a,b){Array.isArray(a)&&!Ext.isEmpty(a)&&(a=a[0]);b=Ext.applyIf(b||
{},{modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["mail.dialog.options"],a,b)},openRecipientSelectionContent:function(a,b){Array.isArray(a)&&!Ext.isEmpty(a)&&(a=a[0]);var c=a.copy(),d=c.getSubStore("recipients");c.isModalDialogRecord=!0;Zarafa.common.Actions.openABUserMultiSelectionContent({callback:function(){a.applyData(c)},convert:function(a,c){return a.convertToRecipient(c?c.defaultRecipientType:b.defaultRecipientType)},store:d,selectionCfg:[{xtype:"zarafa.recipientfield",
fieldLabel:_("To")+":",boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,flex:1},{xtype:"zarafa.recipientfield",fieldLabel:_("CC")+":",boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC,flex:1},{xtype:"zarafa.recipientfield",fieldLabel:_("BCC")+":",boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC,
flex:1}]})},popoutMailContent:function(a,b){var c;c=Zarafa.core.data.RecordFactory.createRecordObjectByRecordData(a.data,a.id);c.idProperties=a.idProperties.clone();c.phantom=a.phantom;c.dirty=a.dirty;c.modified=a.modified;c.applyData(a,!1);var d=a.getAttachmentStore().getId();c.getAttachmentStore().setId(d);d={layerType:"separateWindows",isRecordChangeByUser:b.recordComponentPlugin.isChangedByUser};a.phantom||(container.getShadowStore().add(c),d.recordComponentPluginConfig={useShadowStore:!1});b.fireEvent("close",
b);Zarafa.core.data.ContentPanelMgr.unregister(b);Zarafa.common.Actions.openMessageContent(c,d)},openDelayedDeliveryContent:function(a,b){Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["mail.dialog.delayeddelivery"],a,{manager:Ext.WindowMgr,modal:!0,mailPanel:b,resizable:!1,scope:this})}};Ext.namespace("Zarafa.mail.data");
Zarafa.mail.data.ActionTypes={REPLY:"reply",REPLYALL:"replyall",FORWARD:"forward",FORWARD_ATTACH:"forward_attach",EDIT_AS_NEW:"edit_as_new",isSendOrForward:function(a){return a===this.REPLY||a===this.REPLYALL||a===this.FORWARD||a===this.FORWARD_ATTACH}};Ext.namespace("Zarafa.mail.data");
Zarafa.mail.data.SearchFields=[{name:_("All text fields"),value:"subject sender_name categories sender_email_address sent_representing_name sent_representing_email_address body display_to display_cc"},{name:_("Subject"),value:"subject"},{name:_("Sender"),value:"sender_name sender_email_address sent_representing_name sent_representing_email_address"},{name:_("Body"),value:"body"},{name:_("Subject or Sender"),value:"subject sender_name sender_email_address sent_representing_name sent_representing_email_address"},
{name:_("To or cc"),value:"display_to display_cc"}];Ext.namespace("Zarafa.mail.data");
Zarafa.mail.data.Templates={plaintextQuotedTemplate:'<tpl if="Ext.isEmpty(values.signatureData)">\n\n</tpl><tpl if="!Ext.isEmpty(values.signatureData)">{signatureData}\n\n\n</tpl>-----'+_("Original message")+'-----\n<tpl if="!Ext.isEmpty(values.sent_representing_name)">> '+_("From")+':{sent_representing_name:htmlEncode} <tpl if="!Ext.isEmpty(values.sent_representing_email_address)"><{sent_representing_email_address:htmlEncode}></tpl>\n</tpl><tpl if="Ext.isDate(values.message_delivery_time)">> '+_("Sent")+
': {message_delivery_time:date(_("l jS F Y G:i"))}\n</tpl><tpl if="!Ext.isEmpty(values.display_to)">> '+_("To")+': {display_to}\n</tpl><tpl if="!Ext.isEmpty(values.display_cc)">> '+_("Cc")+": {display_cc}\n</tpl>> "+_("Subject")+": {subject:htmlEncode}\n> \n{body}",htmlQuotedTemplate:"{signatureData}<blockquote style='border-left: 2px solid #325FBA; padding-left: 5px; margin: 0px 5px;'><span style=\"font-family:tahoma,arial,helvetica,sans-serif; font-size: 10pt;\">-----"+_("Original message")+'-----<br /><tpl if="!Ext.isEmpty(values.sent_representing_name)"><span><strong>'+
_("From")+':</strong> {sent_representing_name:htmlEncode}&nbsp;<tpl if="!Ext.isEmpty(values.sent_representing_email_address)">&lt;{sent_representing_email_address:htmlEncode}&gt;</tpl></span><br /></tpl><tpl if="Ext.isDate(values.message_delivery_time)"><span><strong>'+_("Sent")+':</strong> {message_delivery_time:date(_("l jS F Y G:i"))}</span><br /></tpl><tpl if="!Ext.isEmpty(values.display_to)"><span><strong>'+_("To")+':</strong> {display_to:htmlEncode}</span><br /></tpl><tpl if="!Ext.isEmpty(values.display_cc)"><span><strong>'+
_("Cc")+":</strong> {display_cc:htmlEncode}</span><br /></tpl><span><strong>"+_("Subject")+":</strong> {subject:htmlEncode}</span><br /><br /></span>{body}</blockquote>"};Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.DelayedDeliveryPanel=Ext.extend(Ext.Panel,{scheduledMailDateTime:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.delayeddeliverypanel",border:!1,cls:"zarafa-delayeddeliverypanel",items:[{xtype:"zarafa.radiospinnerfield",cls:"zarafa-delayeddeliverypanel-radiospinnerfield",type:"hours",value:_("hour(s)"),listeners:{focus:this.onFieldFocus,change:this.onFieldChange,scope:this}},{xtype:"zarafa.radiospinnerfield",type:"days",cls:"zarafa-delayeddeliverypanel-radiospinnerfield",
value:_("day(s)"),listeners:{focus:this.onFieldFocus,change:this.onFieldChange,scope:this}},{xtype:"zarafa.radiospinnerfield",type:"months",cls:"zarafa-delayeddeliverypanel-radiospinnerfield",value:_("month(s)"),listeners:{focus:this.onFieldFocus,change:this.onFieldChange,scope:this}},{xtype:"displayfield",value:_("at a specific time"),cls:"zarafa-delayeddeliverypanel-displayfield"},{xtype:"zarafa.radiodatetimefield",ref:"delayedDeliveryDateTimeField",cls:"zarafa-delayeddeliverypanel-radiodatetimefield",
listeners:{focus:this.onFieldFocus,change:this.onFieldChange,scope:this}},{xtype:"displayfield",cls:"zarafa-delayeddeliverypanel-fields",ref:"timeInfofield"}],listeners:{afterrender:this.setDefaultValue}});Zarafa.mail.dialogs.DelayedDeliveryPanel.superclass.constructor.call(this,a)},onFieldFocus:function(a){this.createMessage(a.getDateTime())},onFieldChange:function(a,b){this.createMessage(b)},createMessage:function(a){this.scheduledMailDateTime=a=new Date(a);a=this.getMessageDate(a);this.showMessage(a)},
getMessageDate:function(a){var b="";this.ownerCt.setDisabled(!0);isNaN(a.getTime())||(this.isPastDate(a)?(b=_("The time you entered is in the past. Please reschedule your mail."),this.delayedDeliveryDateTimeField.addClass("zarafa-delayeddelivery-invalid-date")):(b=a.format("H:i"),a=this.isTodayDate(a)?_("today  at "):this.isTomorrowDate(a)?_("tomorrow  at "):this.isDayInCurrentWeek(a)?String.format(_("{0} at "),a.format("l ")):String.format(_("at {0}"),a.format("F jS Y, ")),b=String.format(_("Your email will be sent {0}{1}"),
a,b),this.ownerCt.setDisabled(!1),this.delayedDeliveryDateTimeField.removeClass("zarafa-delayeddelivery-invalid-date")));return b},isPastDate:function(a){var b=(new Date).getTime();return a.getTime()<b-3E3},isTodayDate:function(a){var b=(new Date).clearTime(!0);a=(new Date(a)).clearTime(!0);return b.getTime()===a.getTime()},isTomorrowDate:function(a){var b=(new Date).clearTime(!0);a=(new Date(a)).clearTime(!0);return(new Date(b.add(Date.DAY,1))).getTime()===a.getTime()},isDayInCurrentWeek:function(a){var b=
new Date,c=b.getDate()-b.getDay(),b=new Date(b.setDate(c)),c=b.add(Date.DAY,6);return(new Date(a)).clearTime(!0).between(b,c)},showMessage:function(a){this.timeInfofield.setValue(a)},setDefaultValue:function(){var a=this.ownerCt.record.get("deferred_send_time");Ext.isEmpty(a)?this.delayedDeliveryDateTimeField.setValue(new Date):this.delayedDeliveryDateTimeField.setValue(a);a=this.delayedDeliveryDateTimeField.getDateTime();this.createMessage(a)},getMailDateTime:function(){return this.scheduledMailDateTime}});
Ext.reg("zarafa.delayeddeliverypanel",Zarafa.mail.dialogs.DelayedDeliveryPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailCreateOptionsPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.mailcreateoptionspanel",layout:{type:"vbox",align:"stretch"},border:!1,defaults:{bodyStyle:"padding-top: 5px; padding-left: 6px; padding-right: 5px; background-color: inherit;",border:!1},items:[{xtype:"zarafa.mailoptionssettingspanel"},{xtype:"zarafa.mailoptionstrackingpanel"}]});Ext.apply(this,a);Zarafa.mail.dialogs.MailCreateOptionsPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.mailcreateoptionspanel",Zarafa.mail.dialogs.MailCreateOptionsPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailCreatePanel=Ext.extend(Ext.form.FormPanel,{use_html_editor:!1,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.mailcreatepanel",layout:{type:"vbox",align:"stretch"},border:!1,cls:"zarafa-mailcreatepanel",bodyStyle:"background-color: inherit;",defaults:{border:!1},items:[this.initMessageFormPanel(a)]});Zarafa.mail.dialogs.MailCreatePanel.superclass.constructor.call(this,a)},
onRender:function(){Zarafa.mail.dialogs.MailCreatePanel.superclass.onRender.apply(this,arguments);this.dialog&&(this.mon(this.dialog,"bcctoggle",this.onDialogBccToggle,this),this.mon(this.dialog,"fromtoggle",this.onDialogFromToggle,this))},initSendAsList:function(){var a=container.getSettingsModel().get("zarafa/v1/contexts/mail/sendas",!0),b=[];if(Ext.isEmpty(a))return b.push({text:_("No from addresses configured!")}),b;Ext.each(a,function(a){a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
a);a={text:a.formatRecipient(!0),handler:this.onSelectSendAsRecipient,scope:this,record:a};b.push(a)},this);return b},initMessageFormPanel:function(a){return[{xtype:"container",cls:"zarafa-mailcreatepanel-extrainfo",ref:"extraInfoPanel",autoHeight:!0,hidden:!0},{xtype:"zarafa.compositefield",hideLabel:!0,ref:"fromField",cls:"zarafa-mailcreatepanel-field-from",anchor:"100%",autoHeight:!0,items:[{xtype:"splitbutton",autoHeight:!0,text:_("From")+":",handler:this.onSelectUser,menu:new Ext.menu.Menu({showSeparator:!1,
items:this.initSendAsList()}),scope:this},{xtype:"zarafa.addressbookboxfield",enableKeyEvents:!0,ref:"../fromRecipientField",boxType:"zarafa.recipientbox",boxStore:new Zarafa.core.data.IPMRecipientStore({listeners:{add:this.onFromRecipientChanged,resolved:this.onFromRecipientChanged,remove:this.onFromRecipientChanged,scope:this}}),flex:1,boxLimit:1}]},{xtype:"zarafa.resizablecompositefield",hideLabel:!0,cls:"zarafa-mailcreatepanel-field-to",anchor:"100%",autoHeight:!1,items:[{xtype:"button",text:_("To")+
":",autoHeight:!0,handler:function(){Zarafa.mail.Actions.openRecipientSelectionContent(this.record,{defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO})},scope:this},{xtype:"zarafa.recipientfield",ref:"../toRecipientField",enableKeyEvents:!0,plugins:["zarafa.recordcomponentupdaterplugin"],flex:1,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO}]},{xtype:"zarafa.resizablecompositefield",hideLabel:!0,cls:"zarafa-mailcreatepanel-field-cc",
anchor:"100%",autoHeight:!1,items:[{xtype:"button",autoHeight:!0,text:_("Cc")+":",handler:function(){Zarafa.mail.Actions.openRecipientSelectionContent(this.record,{defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC})},scope:this},{xtype:"zarafa.recipientfield",enableKeyEvents:!0,plugins:["zarafa.recordcomponentupdaterplugin"],flex:1,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_CC}]},{xtype:"zarafa.resizablecompositefield",
ref:"bccField",hideLabel:!0,cls:"zarafa-mailcreatepanel-field-bcc",anchor:"100%",autoHeight:!1,items:[{xtype:"button",autoHeight:!0,text:_("Bcc")+":",handler:function(){Zarafa.mail.Actions.openRecipientSelectionContent(this.record,{defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC})},scope:this},{xtype:"zarafa.recipientfield",enableKeyEvents:!0,plugins:["zarafa.recordcomponentupdaterplugin"],flex:1,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC}]},
{xtype:"textfield",cls:"zarafa-mailcreatepanel-field-subject",name:"subject",enableKeyEvents:!0,value:void 0,height:36,emptyText:_("Subject")+":",listeners:{change:this.onChange,scope:this}},{xtype:"zarafa.resizablecompositefield",hideLabel:!0,cls:"zarafa-mailcreatepanel-field-attachments",anchor:"100%",autoHeight:!0,items:[{xtype:"zarafa.attachmentbutton",autoHeight:!0,plugins:["zarafa.recordcomponentupdaterplugin"],text:_("Attachments")+":"},{xtype:"zarafa.attachmentfield",enableKeyEvents:!0,plugins:["zarafa.recordcomponentupdaterplugin"],
flex:1,tabIndex:-1,hideLabel:!0,value:void 0}]},{xtype:"zarafa.editorfield",cls:"zarafa-mailcreatepanel-field-editor",enableKeyEvents:!0,ref:"editorField",hideLabel:!0,flex:1,listeners:{change:this.onBodyChange,initialized:this.onEditorInitialized,valuecorrection:this.onBodyValueCorrection,scope:this}}]},update:function(a,b){this.record=a;this.getForm().loadRecord(a);a.isOpened()&&b&&(this.editorField.setHtmlEditor(this.use_html_editor,!1),this.editorField.bindRecord(a),this.editorField.setValue(a.getBody(this.editorField.isHtmlEditor())));
this.updateExtraInfoPanel()},updateExtraInfoPanel:function(){var a=this.extraInfoPanel.getEl();Ext.isDefined(a.dom)&&(a.dom.innerHTML="");var b=this.getExtraInfoMessage();b&&a.createChild({tag:"div",html:pgettext("calendar.dialog",b)});this.extraInfoPanel.setVisible(!1!==b);this.doLayout()},getExtraInfoMessage:function(){if(this.record.get("flag_status")!==Zarafa.core.mapi.FlagStatus.flagged)return!1;var a=Zarafa.common.flags.Util.getConfiguredFlag(this.record);return"no_date"===a?_("This message will be flagged for follow up when it is sent."):
String.format("This message will be flagged for follow up {0} when it is sent.",a)},onBodyValueCorrection:function(a,b,c){a=this.record;this.editorField.isHtmlEditor()?a.data.html_body=a.inlineImgZarafaToOutlook(b):a.data.body=b;this.record.store.on("open",this.onRecordOpen,this)},onRecordOpen:function(a,b){if(this.editorField){var c=this.editorField.getValue(),d=!1;Ext.isFunction(b.getBody)&&(d=b.getBody(this.editorField.isHtmlEditor()));if(c!==d)this.onBodyValueCorrection(this.editorField,c)}},
updateRecord:function(a){a.beginEdit();this.getForm().updateRecord(a);a.setBody(this.editorField.getValue(),this.editorField.isHtmlEditor());a.endEdit()},onChange:function(a,b){this.record.set(a.name,b)},onBodyChange:function(a,b,c){a=this.record;a.beginEdit();a.setBody(this.editorField.getValue(),this.editorField.isHtmlEditor());a.endEdit()},onEditorInitialized:function(a,b){var c=new Ext.Element(b.getDoc());Zarafa.core.KeyMapMgr.activate(this.dialog,"global",c);Zarafa.core.KeyMapMgr.activate(this.dialog,
"contentpanel.record.message",c)},onDialogBccToggle:function(a,b){this.bccField.setVisible(b);this.doLayout()},onDialogFromToggle:function(a,b){this.fromField.setVisible(b);this.doLayout()},setSignatureInEditor:function(a){a=this.dialog.getContextModel().getSignatureData(this.editorField.isHtmlEditor(),a);Ext.isEmpty(a)||this.editorField.insertAtCursor(a)},onFromRecipientChanged:function(){var a=this.fromRecipientField.getBoxStore(),b=this.record;b.beginEdit();(a=a.getAt(0))?(this.getTopToolbar().showFrom.disable(),
b.set("sent_representing_name",a.get("display_name")),b.set("sent_representing_email_address",a.get("email_address")),b.set("sent_representing_address_type",a.get("address_type")),b.set("sent_representing_entryid",a.get("entryid")),b.set("sent_representing_search_key",a.get("search_key"))):(this.getTopToolbar().showFrom.enable(),b.set("sent_representing_name",""),b.set("sent_representing_email_address",""),b.set("sent_representing_address_type",""),b.set("sent_representing_entryid",""),b.set("sent_representing_search_key",
""));b.endEdit()},onSelectUser:function(){Zarafa.common.Actions.openABUserSelectionContent({callback:this.abCallBack,scope:this,hideContactsFolders:!0,listRestriction:{hide_users:["system","everyone"],hide_companies:!0}})},onSelectSendAsRecipient:function(a){if(a.record){var b=this.fromRecipientField.getBoxStore();b.removeAll();b.add(a.record)}},abCallBack:function(a){var b=this.fromRecipientField.getBoxStore();b.removeAll();b.add(a.convertToRecipient())}});Ext.reg("zarafa.mailcreatepanel",Zarafa.mail.dialogs.MailCreatePanel);
Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailFlagsPanel=Ext.extend(Ext.Panel,{disableFlagColor:!1,disableCompleted:!1,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.isBoolean(a.disableFlagColor)||(a.disableFlagColor=this.disableFlagColor);Ext.isBoolean(a.disableCompleted)||(a.disableCompleted=this.disableCompleted);a=Ext.applyIf(a,{xtype:"zarafa.mailflagspanel",layout:"form",border:!1,items:[this.createFlagColorPanel(a.disableFlagColor),this.createFlagExpirationPanel(),
this.createFlagCompletePanel(a.disableCompleted)]});Zarafa.mail.dialogs.MailFlagsPanel.superclass.constructor.call(this,a)},createFlagColorPanel:function(a){var b={xtype:"jsonstore",fields:["name","flagColor"],data:[].concat(Zarafa.mail.data.MailFlags.state[1],Zarafa.mail.data.MailFlags.colors)};return{xtype:"combo",ref:"flagColorCombo",fieldLabel:_("Color of Flag"),anchor:"100%",store:b,mode:"local",triggerAction:"all",displayField:"name",valueField:"flagColor",lazyInit:!1,forceSelection:!0,editable:!1,
disabled:a,listeners:{select:this.onColorSelect,scope:this}}},createFlagExpirationPanel:function(){return{xtype:"zarafa.datetimefield",anchor:"100%",ref:"datetimeField",fieldLabel:_("End date"),listeners:{change:this.onDateChange,scope:this}}},createFlagCompletePanel:function(a){return{xtype:"checkbox",ref:"completeCheckbox",fieldLabel:_("Complete"),handler:this.onToggleComplete,scope:this,disabled:a}},update:function(a,b){if(this.record=a){var c=this.record.get("flag_status")==Zarafa.core.mapi.FlagStatus.completed,
d=this.record.get("flag_icon");Ext.isEmpty(d)&&(d=Zarafa.core.mapi.FlagIcon.clear);this.flagColorCombo.setValue(d);d="flag_due_by";c&&(d="flag_complete_time");d=this.record.get(d);Ext.isDate(d)||(d=new Date);this.datetimeField.setValue(d);this.completeCheckbox.setValue(c)}},updateRecord:function(a){var b=this.flagColorCombo.getValue(),c=this.completeCheckbox.getValue();a.beginEdit();a.set("flag_icon",b);var d=this.datetimeField.getValue();c?a.set("flag_complete_time",d):a.set("flag_due_by",d);c?a.set("flag_status",
Zarafa.core.mapi.FlagStatus.completed):b==Zarafa.core.mapi.FlagIcon.clear?a.set("flag_status",Zarafa.core.mapi.FlagStatus.cleared):a.set("flag_status",Zarafa.core.mapi.FlagStatus.flagged);a.endEdit()},onDateChange:function(a,b,c){this.completeCheckbox.getValue()?this.record.set("flag_complete_time",b):this.record.set("flag_due_by",b)},onColorSelect:function(a,b,c){a=this.flagColorCombo.getValue();this.record.set("flag_icon",a);a==Zarafa.core.mapi.FlagIcon.clear?this.record.set("flag_status",Zarafa.core.mapi.FlagStatus.cleared):
this.record.set("flag_status",Zarafa.core.mapi.FlagStatus.flagged)},onToggleComplete:function(a,b){var c=this.datetimeField.getValue(),d=this.flagColorCombo.getValue();this.flagColorCombo.setDisabled(b);b?(this.record.set("flag_status",Zarafa.core.mapi.FlagStatus.completed),this.record.set("flag_complete_time",c),this.record.set("flag_due_by",null),this.record.set("flag_icon",void 0)):d==Zarafa.core.mapi.FlagIcon.clear?(this.record.set("flag_status",Zarafa.core.mapi.FlagStatus.cleared),this.record.set("flag_due_by",
c),this.record.set("flag_complete_time",null),this.record.set("flag_icon",void 0)):(this.record.set("flag_status",Zarafa.core.mapi.FlagStatus.flagged),this.record.set("flag_due_by",c),this.record.set("flag_complete_time",null))}});Ext.reg("zarafa.mailflagspanel",Zarafa.mail.dialogs.MailFlagsPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailOptionsMiscPanel=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.mailoptionsmiscpanel",title:_("Miscellaneous Options"),layout:"form",items:[{xtype:"textarea",fieldLabel:_("Internet Headers"),name:"transport_message_headers",readOnly:!0,anchor:"0 -32",autoScroll:!0,border:!1,style:"word-wrap: normal",ref:"headersTextArea"}]});Zarafa.mail.dialogs.MailOptionsMiscPanel.superclass.constructor.call(this,
a)},update:function(a,b){(this.record=a)?this.getForm().loadRecord(a):this.headersTextArea.setValue("")},updateRecord:function(a){this.getForm().updateRecord(a)}});Ext.reg("zarafa.mailoptionsmiscpanel",Zarafa.mail.dialogs.MailOptionsMiscPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailOptionsTrackingPanel=Ext.extend(Ext.form.FormPanel,{record:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a=Ext.applyIf(a,{xtype:"zarafa.mailoptionstrackingpanel",title:_("Tracking Options"),layout:"form",items:[{xtype:"checkbox",hideLabel:!0,ref:"readReceiptCheckbox",boxLabel:_("Request a read receipt for this message."),name:"read_receipt_requested",handler:this.onFieldToggle,scope:this}]});Zarafa.mail.dialogs.MailOptionsTrackingPanel.superclass.constructor.call(this,
a)},onFieldToggle:function(a,b){this.record.set(a.getName(),b)},update:function(a,b){(this.record=a)?(this.getForm().loadRecord(a),a.phantom||a.isUnsent()?this.readReceiptCheckbox.enable():this.readReceiptCheckbox.disable()):this.readReceiptCheckbox.setValue(!1)},updateRecord:function(a){this.getForm().updateRecord(a)}});Ext.reg("zarafa.mailoptionstrackingpanel",Zarafa.mail.dialogs.MailOptionsTrackingPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailViewOptionsPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.mailviewoptionspanel",layout:{type:"vbox",align:"stretch"},border:!1,defaults:{bodyStyle:"padding-top: 5px; padding-left: 6px; padding-right: 5px; background-color: inherit;",border:!1},items:[{xtype:"zarafa.mailoptionssettingspanel"},{xtype:"zarafa.mailoptionstrackingpanel"},{xtype:"zarafa.mailoptionsmiscpanel",flex:1}]});Ext.apply(this,a);Zarafa.mail.dialogs.MailViewOptionsPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.mailviewoptionspanel",Zarafa.mail.dialogs.MailViewOptionsPanel);Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailRowSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{handleMouseDown:function(a,b,c){var d=a.getColumnModel(),e=a.getView().findCellIndex(c.getTarget()),f=!1;Ext.get(c.target).hasClass("icon_flag")?f=!0:!1!==e&&0<=e?f=d.config[e].preventRowSelection:!1===e&&Ext.get(c.target).hasClass("k-category-add")&&(f=!0);!0!==f?Zarafa.mail.ui.MailRowSelectionModel.superclass.handleMouseDown.call(this,a,b,c):a.getView().focusRow(b)}});Ext.reg("zarafa.mailrowselectionmodel",Zarafa.mail.ui.MailRowSelectionModel);
Ext.namespace("Zarafa.mail.ui");Zarafa.mail.ui.MailViewPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.mailviewpanel",border:!1,cls:"zarafa-mailviewpanel",layout:"zarafa.collapsible",items:[{xtype:"zarafa.messageheader"},{xtype:"zarafa.messagebody"}]});Zarafa.mail.ui.MailViewPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.mailviewpanel",Zarafa.mail.ui.MailViewPanel);Ext.namespace("Zarafa.note");
Zarafa.note.Actions={openNoteContent:function(a,b){Ext.each(a,function(a){Zarafa.core.data.UIFactory.openViewRecord(a,b)})},openCreateNoteContent:function(a,b){var c=a.createRecord();Zarafa.core.data.UIFactory.openCreateRecord(c,b)}};Ext.namespace("Zarafa.note.data");Zarafa.note.data.SearchFields=[{name:_("All text fields"),value:"body categories"},{name:_("Categories"),value:"categories"}];Ext.namespace("Zarafa.note.dialogs");
Zarafa.note.dialogs.NoteEditPanel=Ext.extend(Ext.FormPanel,{currentColorCss:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.noteeditpanel",layout:"fit",border:!1,items:[{xtype:"zarafa.editorfield",useHtml:!1,ref:"noteText",plaintextName:"body",listeners:{change:this.onTextareaChange,scope:this}}]});Zarafa.note.dialogs.NoteEditPanel.superclass.constructor.call(this,a)},onTextareaChange:function(a){a=
a.getValue();this.record.beginEdit();this.record.set("body",a);this.record.generateSubject();this.record.endEdit()},getTextAreaColor:function(a){switch(parseInt(a,10)){case Zarafa.core.mapi.IconIndex.note_blue:a="stickynote_dialog_blue";break;case Zarafa.core.mapi.IconIndex.note_green:a="stickynote_dialog_green";break;case Zarafa.core.mapi.IconIndex.note_pink:a="stickynote_dialog_pink";break;default:a="stickynote_dialog_yellow";break;case Zarafa.core.mapi.IconIndex.note_white:a="stickynote_dialog_white"}return a},
update:function(a,b){var c=this.noteText.getEditor();if(a){if(this.record=a,(b||a.isModifiedSinceLastUpdate("body"))&&this.noteText.setValue(a.get("body")||""),b||a.isModifiedSinceLastUpdate("icon_index")){c.removeClass(this.currentColorCss);var d=this.getTextAreaColor(a.get("icon_index"));this.currentColorCss=d;c.addClass(d)}}else this.noteText.setValue(""),c.removeClass(this.currentColorCss)},updateRecord:function(a){a=this.noteText.getValue();this.record.beginEdit();this.record.set("body",a);this.record.generateSubject();
this.record.endEdit()}});Ext.reg("zarafa.noteeditpanel",Zarafa.note.dialogs.NoteEditPanel);Ext.namespace("Zarafa.settings");
Zarafa.settings.SettingsModel=Ext.extend(Ext.util.Observable,{pathSeparator:"/",autoSave:!0,defaults:void 0,settings:void 0,editing:!1,editingCount:0,modified:void 0,restored:void 0,deleted:void 0,resetSettings:void 0,requiresReload:!1,constructor:function(a){a=a||{};this.addEvents("set","remove","exception","beforesave","save");Ext.isObject(a.defaults)||(a.defaults=Zarafa.settings.data.SettingsDefaultValue.getDefaultValues());Ext.apply(this,a);Zarafa.settings.SettingsModel.superclass.constructor.call(this,
a);this.settings={};this.modified=[];this.restored=[];this.deleted=[];this.resetSettings=[];Ext.data.DataProxy.relayEvents(this,["exception"])},initialize:function(a){this.settings=Zarafa.core.Util.applyRecursive({},a,this.defaults)},beginEdit:function(){this.editingCount++;1>this.editingCount&&(this.editingCount=1);1===this.editingCount&&(this.editing=!0,this.modified=this.modified||[],this.restored=this.restored||[],this.deleted=this.deleted||[])},endEdit:function(){this.editingCount--;0>this.editingCount&&
(this.editingCount=0);0===this.editingCount&&(this.editing=!1,Ext.isEmpty(this.modified)&&Ext.isEmpty(this.deleted)||this.afterEdit())},afterEdit:function(){var a=!1;Ext.isEmpty(this.restored)||this.fireEvent("set",this,this.restored);this.restored=[];Ext.isEmpty(this.modified)||(this.fireEvent("set",this,this.modified),a=!0);Ext.isEmpty(this.deleted)||(this.fireEvent("remove",this,this.deleted),a=!0);!0===a&&!1!==this.autoSave&&this.save()},filterDuplicates:function(a,b){for(var c=0,d=b.length;c<
d;c++){var e=b[c],f=a,g;for(Ext.isObject(a[0])&&(f=Ext.pluck(a,"path"));0<=(g=f.indexOf(e));)a.splice(g,1),a!==f&&f.splice(g,1)}},removeSettings:function(a){Array.isArray(a)||(a=[a]);a=Zarafa.core.Util.uniqueArray(a);this.filterDuplicates(this.modified,a);this.filterDuplicates(this.restored,a);this.filterDuplicates(this.deleted,a);this.deleted=this.deleted.concat(a)},restoreSettings:function(a){Array.isArray(a)||(a=[a]);a=Zarafa.core.Util.uniqueArray(a,"path");var b=Ext.pluck(a,"path");this.filterDuplicates(this.modified,
b);this.filterDuplicates(this.restored,b);this.filterDuplicates(this.deleted,b);this.restored=this.restored.concat(a)},setSettings:function(a){Array.isArray(a)||(a=[a]);a=Zarafa.core.Util.uniqueArray(a,"path");var b=Ext.pluck(a,"path");this.filterDuplicates(this.modified,b);this.filterDuplicates(this.restored,b);this.filterDuplicates(this.deleted,b);this.modified=this.modified.concat(a)},save:function(){Ext.isEmpty(this.deleted)||this.execute(Zarafa.core.Actions["delete"],this.deleted);Ext.isEmpty(this.modified)||
this.execute(Zarafa.core.Actions.set,this.modified);Ext.isEmpty(this.resetSettings)||this.execute(Zarafa.core.Actions.reset,this.resetSettings)},execute:function(a,b){!1!==this.fireEvent("beforesave",this,{action:b})&&container.getRequest().singleRequest(Zarafa.core.ModuleNames.getListName("settings"),a,{setting:b},new Zarafa.core.data.ProxyResponseHandler({proxy:this,action:Ext.data.Api.actions.update,options:{action:a,parameters:b,requiresReload:this.requiresReload},callback:this.onExecuteComplete,
scope:this}))},onExecuteComplete:function(a,b,c){c&&(this.fireEvent("save",this,b),this.commit())},commit:function(){this.deleted=[];this.modified=[];this.resetSettings=[];this.requiresReload=!1},getSettingsObject:function(a,b){for(var c=a.split(this.pathSeparator),d=b||this.settings,e=0,f=c.length;e<f&&!Ext.isEmpty(c[e])&&(d=d[c[e]],!Ext.isEmpty(d));e++);return d},removeSettingsObject:function(a,b){var c=a.lastIndexOf(this.pathSeparator),d=a.substring(0,c),c=a.substring(c+1),d=this.getSettingsObject(d,
b),e=[];if(d){var f=d[c];if(Ext.isObject(f)&&!Ext.isDate(f)&&!Array.isArray(f))for(var g in f)f=this.removeSettingsObject(a+this.pathSeparator+g,b),e=e.concat(f);e.push(a);delete d[c]}return e},applySettingsObject:function(a,b,c){var d=[];if(Ext.isObject(b)){d.push({path:a});for(var e in b)d=d.concat(this.applySettingsObject(a+this.pathSeparator+e,b[e],c))}else{e=a.lastIndexOf(this.pathSeparator);var f=a.substring(0,e);e=a.substring(e+1);c=c||this.settings;if(!Ext.isEmpty(f))for(var f=f.split(this.pathSeparator),
g="",h=0,k=f.length;h<k;h++){var l=f[h],g=g+((Ext.isEmpty(g)?"":this.pathSeparator)+l);Ext.isEmpty(c[l])&&(c[l]={});c=c[l]}Array.isArray(b)||Ext.isDate(b)?c[e]=b.clone():c[e]=b;d.push({path:a,value:b})}return d},getPath:function(a){return Ext.isString(a)?a.replace(/^\/*|\/*$/g,""):""},set:function(a,b){a=this.getPath(a);if(JSON.stringify(this.get(a,!0))!==JSON.stringify(b)){var c=this.removeSettingsObject(a,this.settings),d=this.applySettingsObject(a,b,this.settings);Ext.isEmpty(c)||this.removeSettings(c);
Ext.isEmpty(d)||this.setSettings(d);!1===this.editing&&this.afterEdit()}},remove:function(a){a=this.getPath(a);a=this.removeSettingsObject(a,this.settings);Ext.isEmpty(a)||this.removeSettings(a);!1===this.editing&&this.afterEdit()},reset:function(a){Array.isArray(a)||(a=[a]);this.resetSettings=this.resetSettings.concat(a)},restore:function(a){a=this.getPath(a);var b=this.removeSettingsObject(a,this.settings),c=this.getSettingsObject(a,this.defaults);a=this.applySettingsObject(a,c,this.settings);Ext.isEmpty(b)||
this.removeSettings(b);Ext.isEmpty(a)||this.restoreSettings(a);!1===this.editing&&this.afterEdit()},get:function(a,b,c){a=this.getPath(a);a=c?this.getSettingsObject(a,this.defaults):this.getSettingsObject(a,this.settings);if(Ext.isObject(a)){if(!0===b)return Zarafa.core.Util.applyRecursive({},a)}else return Array.isArray(a)||Ext.isDate(a)?a.clone():a}});Ext.namespace("Zarafa.settings.data");
Zarafa.settings.data.PersistentSettingsDefaultValue=function(){return{getDefaultValues:function(){var a=container.getServerConfig().getDefaultCategories(),b=container.getServerConfig().getAdditionalDefaultCategories();Array.isArray(b)&&(a=a.concat(b));return{kopano:{main:{merged_categories:{},categories:a}}}}}}();Ext.namespace("Zarafa.settings.data");
Zarafa.settings.data.SettingsDefaultValue=function(){return{getDefaultValues:function(){return{zarafa:{v1:{main:{default_context:"mail",language:"en_GB",base_content_layer:"tabs",confirm_close_dialog:!0,week_start:1,working_days:[1,2,3,4,5],start_working_hour:540,end_working_hour:1020,datetime_display_format:"short",default_font:"tahoma,arial,helvetica,sans-serif",default_font_size:2,keycontrols:Zarafa.settings.data.KeyboardSettings.BASIC_KEYBOARD_SHORTCUTS,page_size:50,notifier:{"default":"messagebox",
error:{value:"messagebox",connection:{value:"dropdown"},hierarchy:{defaultfolder:{value:"dropdown"}}},warning:{value:"messagebox"},info:{value:"popup",reminder:{value:"none"},newmail:{value:"popup"},"import":{value:"dropdown"},sent:{value:"dropdown"},saved:{value:"dropdown"},mailsaved:{value:"toolbarnotifierplugin"},sending:{value:"dropdown"},saving:{value:"dropdown"},mailsaving:{value:"toolbarnotifierplugin"},unresolved_recipients:{value:"dropdown"},meeting:{value:"messagebox"}}},reminder:{polling_interval:30,
default_snooze_time:5},new_features_dialog:{show:!0,last_version:{webapp:"0"}}},contexts:{hierarchy:{polling_interval:300},search:{updatesearch_timeout:500,search_criteria:{}},calendar:{default_merge_state:!1,default_zoom_level:30,default_appointment_period:30,default_reminder:!0,default_reminder_time:15,default_allday_reminder_time:1080,datepicker_show_busy:!0,free_busy_range:2},contact:{show_name_dialog:!0,show_address_dialog:!0},mail:{enable_live_scroll:!0,readreceipt_handling:"ask",always_request_readreceipt:!1,
autosave_enable:!0,autosave_time:60,readflag_time_enable:!0,readflag_time:0,from_address_list:[],block_external_content:!0,safe_senders_list:[],close_on_respond:!0,enable_grouping:!1,outofoffice:{message:"",set:!1,subject:"",from:"",until:""},signatures:{all:{},new_message:void 0,replyforward_message:void 0},dialogs:{mailcreate:{use_html_editor:!0}}},task:{default_task_period:0,default_reminder:!1,default_reminder_time:540,reminder_time_stepping:30},today:{num_columns:3}}}}}}}}();Ext.namespace("Zarafa.settings.data");
Zarafa.settings.data.SettingsTreeLoader=Ext.extend(Ext.ux.tree.TreeGridLoader,{autoExpandLevel:0,autoExpandFilter:void 0,model:void 0,constructor:function(a){a=a||{};a.directFn||(a.directFn=this.directFn.createDelegate(this));Zarafa.settings.data.SettingsTreeLoader.superclass.constructor.call(this,a)},bindModel:function(a,b){if(b||this.model!==a)this.model=a},directFn:function(a,b){var c=this.model.getPath(a),d=this.model.get(c,!0),e=[],f;for(f in d){var g=!Ext.isObject(d[f])||Array.isArray(d[f]),
h=(Ext.isEmpty(c)?"":c+"/")+f,k=!1;this.autoExpandFilter&&this.autoExpandFilter.test(h)&&(k=h.split("/").length<this.autoExpandLevel);e.push({nodeType:"setting",text:f,id:h,leaf:g,expanded:!g&&k,value:g?d[f]:void 0,uiProvider:Zarafa.settings.ui.SettingsTreeNodeUI})}b(e,{status:!0})}});Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.QuotaBar=Ext.extend(Ext.BoxComponent,{userStore:void 0,quotaTemplate:'<div class="zarafa-quotabar"><div class="zarafa-quotabar-normal"></div><div class="zarafa-quotabar-warn"></div><div class="zarafa-quotabar-soft"></div><div class="zarafa-quotabar-hard"></div></div>',constructor:function(a){a=a||{};Zarafa.settings.ui.QuotaBar.superclass.constructor.call(this,a);this.quotaTemplate=new Ext.XTemplate(this.quotaTemplate,{compiled:!0});this.on("afterrender",this.onQuotaBarRender,this);
this.userStore&&this.mon(this.userStore.getStore(),"update",this.onUpdateHierarchyStore,this)},onQuotaBarRender:function(){this.quotaTemplate.overwrite(Ext.get(this.el));this.updateQuotaBar()},updateQuotaBar:function(){if(this.userStore&&this.el&&this.el.child("div.zarafa-quotabar")){var a=this.userStore.get("store_size"),b=this.userStore.get("quota_soft"),c=this.userStore.get("quota_hard"),d=this.userStore.get("quota_warning");if(b||c||d){var e=[];d&&(!b||d<b)&&(!c||d<c)&&e.push({size:d,element:"div.zarafa-quotabar-warn"});
b&&(!c||b<c)&&e.push({size:b,element:"div.zarafa-quotabar-soft"});c&&e.push({size:c,element:"div.zarafa-quotabar-hard"});c=c||b||d;a>c&&(c=a,e.push({size:a}));for(var b=this.el.child("div.zarafa-quotabar").getWidth(!0),c=b/c,f,d=0,g="div.zarafa-quotabar-normal",h=0;h<e.length;h++)f=e[h].size,a<=f&&(f=a,a=0),f-=d,d+=f,g&&(f=Math.round(f*c),f=Math.max(f,0),b<f&&(f=b),this.el.child(g).setWidth(f),b-=f),(g=e[h].element)&&this.el.child(g).setWidth(0)}}},onUpdateHierarchyStore:function(a,b,c){b.isDefaultStore()&&
this.updateQuotaBar()}});Ext.reg("zarafa.quotabar",Zarafa.settings.ui.QuotaBar);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsCategory=Ext.extend(Ext.Container,{items:void 0,settingsContext:void 0,title:"",categoryIndex:100,savingEl:void 0,savingElCounter:0,constructor:function(a){a=a||{};Ext.applyIf(a,{autoScroll:!0});Zarafa.settings.ui.SettingsCategory.superclass.constructor.call(this,a)},onShow:function(){Zarafa.settings.ui.SettingsCategory.superclass.onShow.apply(this,arguments);this.mon(container.getCurrentContext().getModel(),"beforesavesettings",this.onBeforeSaveSettingsModel,this)},onHide:function(){Zarafa.settings.ui.SettingsCategory.superclass.onHide.apply(this,
arguments);this.mun(container.getCurrentContext().getModel(),"beforesavesettings",this.onBeforeSaveSettingsModel,this);this.mun(container.getSettingsModel(),"beforesave",this.onBeforeSettingsSave,this)},onBeforeSaveSettingsModel:function(){var a=container.getSettingsModel();this.mon(a,"beforesave",this.onBeforeSettingsSave,this,{single:!0});this.savingElCounter=0},onBeforeSettingsSave:function(a){this.displaySavingMask();this.mun(a,"beforesave",this.onBeforeSettingsSave,this);this.mon(a,"save",this.onSettingsSave,
this);this.mon(a,"exception",this.onSettingsException,this)},onSettingsSave:function(a){this.mun(a,"save",this.onSettingsSave,this);this.mun(a,"exception",this.onSettingsException,this);this.hideSavingMask(!0)},onSettingsException:function(a){this.mun(a,"save",this.onSettingsSave,this);this.mun(a,"exception",this.onSettingsException,this);this.hideSavingMask(!1)},displaySavingMask:function(){this.savingElCounter++;this.savingEl||(this.savingEl=container.getNotifier().notify("info.saving","",_("Saving")+
"...",{container:container.getContentPanel().getEl(),persistent:!0}))},hideSavingMask:function(a){var b=container.getContentPanel().getEl();this.savingElCounter--;0!==this.savingElCounter&&a||!this.savingEl||(container.getNotifier().notify("info.saving",null,null,{container:b,destroy:!0,reference:this.savingEl}),delete this.savingEl,a&&container.getNotifier().notify("info.saved",_("Saved"),_("Saved successfully"),{container:b}))},update:function(a){for(var b=this.findByType("zarafa.settingswidget"),
c=0,d=b.length;c<d;c++)b[c].update.apply(b[c],arguments)},updateSettings:function(a){for(var b=this.findByType("zarafa.settingswidget"),c=0,d=b.length;c<d;c++)b[c].updateSettings.apply(b[c],arguments)}});Ext.reg("zarafa.settingscategory",Zarafa.settings.ui.SettingsCategory);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsCategoryPanel=Ext.extend(Ext.Container,{context:void 0,activeTab:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"zarafa-settings-category-panel"});Zarafa.settings.ui.SettingsCategoryPanel.superclass.constructor.call(this,a);this.context&&this.mon(this.context,"viewchange",this.onViewChange,this)},onViewChange:function(a,b,c){a=this.findBy(function(a){return a.isTabForId(b)});this.activeTab&&(this.activeTab.setActive(!1),delete this.activeTab);Ext.isEmpty(a)||
(this.activeTab=a[0],this.activeTab.setActive(!0))}});Ext.reg("zarafa.settingscategorypanel",Zarafa.settings.ui.SettingsCategoryPanel);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsCategoryTab=Ext.extend(Ext.Container,{context:void 0,title:"",categoryIndex:100,category:void 0,iconCls:"zarafa-settings-category-tab-icon",activeCls:"zarafa-settings-category-tab-active",constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"zarafa-settings-category-tab",html:a.title||this.title});Zarafa.settings.ui.SettingsCategoryTab.superclass.constructor.call(this,a)},isTabForId:function(a){return this.category&&this.category.getId()===a},setActive:function(a){!1!==a?
this.getEl().addClass(this.activeCls):this.getEl().removeClass(this.activeCls)},onRender:function(){Zarafa.settings.ui.SettingsCategoryTab.superclass.onRender.apply(this,arguments);var a=this.getEl();Ext.isEmpty(this.iconCls)||a.addClass(this.iconCls);Ext.isEmpty(this.cls)||(a.addClassOnClick(this.cls+"-click"),a.addClassOnFocus(this.cls+"-focus"),a.addClassOnOver(this.cls+"-over"));this.mon(a,"click",this.onClick,this)},onClick:function(){this.context&&this.category&&this.context.setView(this.category.id)}});
Ext.reg("zarafa.settingscategorytab",Zarafa.settings.ui.SettingsCategoryTab);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsCategoryWidgetPanel=Ext.extend(Ext.Container,{context:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{layout:"card",cls:"zarafa-settings-category-widget-panel"});Zarafa.settings.ui.SettingsCategoryWidgetPanel.superclass.constructor.call(this,a);this.context&&(a=this.context.getModel(),this.mon(this.context,{viewchange:this.onViewChange,viewmodechange:this.onViewModeChange,scope:this}),this.mon(a,{beforesavesettings:this.onBeforeSaveSettings,savesettings:this.onSaveSettings,
discardsettings:this.onDiscardSettings,scope:this}));this.on("afterlayout",this.onAfterFirstLayout,this,{single:!0})},onAfterFirstLayout:function(){var a=this.get(0);this.context.setView(a.id)},onViewChange:function(a,b,c){c=this.getLayout();c.setActiveItem(b);c.activeItem.doLayout();c.activeItem.update(a.getModel().getEditableSettingsModel())},onViewModeChange:function(a,b,c){(a=this.getLayout().activeItem)&&(b=a.get(b))&&a.el.scrollChildIntoView(b.el)},onBeforeSaveSettings:function(a,b){this.getLayout().activeItem.updateSettings(b)},
onSaveSettings:function(a,b){this.getLayout().activeItem.update(b)},onDiscardSettings:function(a,b){this.getLayout().activeItem.update(b)}});Ext.reg("zarafa.settingscategorywidgetpanel",Zarafa.settings.ui.SettingsCategoryWidgetPanel);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsTreeNode=Ext.extend(Ext.tree.AsyncTreeNode,{constructor:function(a){this.addEvents("valuechange");Zarafa.settings.ui.SettingsTreeNode.superclass.constructor.call(this,a)},startEdit:function(){this.ownerTree.startEdit(this,1)},isEditable:function(){return this.leaf&&!Array.isArray(this.attributes.value)},setValue:function(a){var b=this.attributes.value;this.attributes.value=a;if(this.rendered)this.ui.onValueChange(this,a,b);this.fireEvent("valuechange",this,a,b)}});
Ext.tree.TreePanel.nodeTypes.setting=Zarafa.settings.ui.SettingsTreeNode;Ext.namespace("Zarafa.settings.ui");Zarafa.settings.ui.SettingsTreeNodeUI=Ext.extend(Ext.ux.tree.TreeGridNodeUI,{textNode:void 0,valueNode:void 0,renderElements:function(){Zarafa.settings.ui.SettingsTreeNodeUI.superclass.renderElements.apply(this,arguments);this.valueNode=this.elNode.childNodes[1].childNodes[0]},onValueChange:function(a,b,c){this.rendered&&(this.valueNode.innerHTML=Ext.util.Format.htmlEncode(b))}});Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsWidget=Ext.extend(Ext.Panel,{settingsContext:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"zarafa-settings-widget",layout:"form",labelWidth:200});Zarafa.settings.ui.SettingsWidget.superclass.constructor.call(this,a)},update:Ext.emptyFn,updateSettings:Ext.emptyFn});Ext.reg("zarafa.settingswidget",Zarafa.settings.ui.SettingsWidget);Ext.namespace("Zarafa.task");
Zarafa.task.Actions={openCreateTaskContent:function(a,b){var c=a.createRecord();Zarafa.core.data.UIFactory.openCreateRecord(c,b)},openCreateTaskRequestContent:function(a,b){var c=a.createRecord();c.convertToTaskRequest();Zarafa.core.data.UIFactory.openCreateRecord(c,b)},createTaskFromMail:function(a,b){var c;Array.isArray(a)&&!Ext.isEmpty(a)&&(c=a[0],c.isOpened()?(c=c.convertToTask(b.getDefaultFolder()),Zarafa.core.data.UIFactory.openCreateRecord(c)):(c.getStore().on("open",this.openHandler.createDelegate(this,
[b],2),this,{single:!0}),c.open()))},openHandler:function(a,b,c){a=b.convertToTask(c.getDefaultFolder());Zarafa.core.data.UIFactory.openCreateRecord(a)},openSendConfirmationContent:function(a,b){b=Ext.applyIf(b||{},{record:a,modal:!0});Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType["task.dialogs.sendtaskrequestconfirmation"],a,b)},openRecipientSelectionContent:function(a,b){Ext.isArray(a)&&!Ext.isEmpty(a)&&(a=a[0]);var c=a.copy(),d=c.getSubStore("recipients");Zarafa.common.Actions.openABUserMultiSelectionContent({callback:function(){a.applyData(c)},
convert:function(a,c){return a.convertToRecipient(c?c.defaultRecipientType:b.defaultRecipientType)},store:d,selectionCfg:[{xtype:"zarafa.recipientfield",fieldLabel:_("To")+":",boxStore:d,filterRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,flex:1}]})},deleteRecordsFromTodoList:function(a){!0===container.getSettingsModel().get("zarafa/v1/contexts/task/todolist/dialogs/delete_item_confirmation/disabled")?Zarafa.common.Actions.doDeleteRecords(a):
Zarafa.common.dialogs.MessageBox.addCustomButtons({title:_("Delete confirmation"),minWidth:351,customButton:[{text:_("Delete"),name:"delete"},{text:_("Cancel"),name:"cancel"}],checkbox:!0,fn:function(b,c,d){"delete"===b&&(container.getSettingsModel().set("zarafa/v1/contexts/task/todolist/dialogs/delete_item_confirmation/disabled",d),Zarafa.common.Actions.doDeleteRecords(a))},msg:_("Deleting the item(s) will also delete the original item(s).")+"<br />"+_("Do you want to delete the item(s)?")})},openFlagsMenu:function(a,
b){Ext.isArray(a)||(a=[a]);Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["task.contextmenu.flags"],a,b)}};Ext.namespace("Zarafa.task.data");
Zarafa.task.data.SearchFields=[{name:_("All text fields"),value:"subject body categories owner companies"},{name:_("Subject"),value:"subject"},{name:_("Categories"),value:"categories"},{name:_("Body"),value:"body"},{name:_("Owner"),value:"owner"},{name:_("Companies"),value:"companies"},{name:_("Due Date"),value:"duedate"},{name:_("Start Date"),value:"startdate"}];Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.SendTaskRequestConfirmationPanel=Ext.extend(Ext.form.FormPanel,{responseType:void 0,acceptInfoString:_("This task will be accepted and moved into the Tasks folder. Do you want to edit the response before sending it?"),declineInfoString:_("This task will be declined and moved into the Deleted Items folder. Do you want to edit the response before sending it?"),constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.sendtaskrequestconfirmationpanel",cls:"k-send-taskrequest-confirmation-panel",
layout:{type:"vbox",align:"stretch"},border:!1,hideLabels:!0,items:[{xtype:"displayfield",value:this.getDisplayText(a.responseType),autoHeight:!0},{xtype:"radio",boxLabel:_("Edit the response before Sending."),name:"sendtaskconfirmation",autoHeight:!0,listeners:{check:this.onEditResponseChecked,scope:this}},{xtype:"textarea",name:"responseText",ref:"responseTextField",disabled:!0,flex:1},{xtype:"radio",boxLabel:_("Send the response now"),name:"sendtaskconfirmation",checked:!0,autoHeight:!0}]});Zarafa.task.dialogs.SendTaskRequestConfirmationPanel.superclass.constructor.call(this,
a)},getDisplayText:function(a){switch(a){case Zarafa.core.mapi.TaskMode.ACCEPT:return this.acceptInfoString;case Zarafa.core.mapi.TaskMode.DECLINE:return this.declineInfoString}},onEditResponseChecked:function(a,b){this.responseTextField.setDisabled(!b)},updateRecord:function(a){var b=this.getForm().getFieldValues();this.editResponse=!0!==b.sendtaskconfirmation[1];a.respondToTaskRequest(this.responseType,b.responseText,this.editResponse)}});Ext.reg("zarafa.sendtaskrequestconfirmationpanel",Zarafa.task.dialogs.SendTaskRequestConfirmationPanel);
Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.TaskDetailTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.taskdetailtab",cls:"k-taskdetailtab",title:_("Details"),border:!1,labelAlign:"left",defaults:{border:!1,xtype:"panel"},items:[this.createTaskInfoPanel(),this.createDatePanel(),this.createWorkPanel(),this.createCompanyPanel(),this.createUpdateListPanel()]});Zarafa.task.dialogs.TaskDetailTab.superclass.constructor.call(this,
a)},createTaskInfoPanel:function(){return{xtype:"zarafa.taskinfo",ref:"taskInfoPanel",hidden:!0}},createDatePanel:function(){return{layout:"form",ref:"datePanel",cls:"k-datepanel",items:[{xtype:"datefield",format:"d/m/Y",fieldLabel:_("Date Complete"),anchor:"35%",name:"date_completed",listeners:{change:this.onCompleteDateChange,scope:this}}]}},createWorkPanel:function(){return{layout:"column",ref:"workPanel",cls:"k-workpanel",defaults:{layout:"form",border:!1,xtype:"panel"},items:[{columnWidth:.35,
cls:"k-col0",defaults:{anchor:"100%"},items:[{xtype:"zarafa.durationfield",fieldLabel:_("Total Work"),name:"totalwork",listeners:{change:this.onPropertyChange,scope:this}},{xtype:"zarafa.durationfield",fieldLabel:_("Actual Work"),name:"actualwork",listeners:{change:this.onPropertyChange,scope:this}}]},{columnWidth:.65,cls:"k-col1",labelWidth:150,defaults:{anchor:"100%"},items:[{xtype:"textfield",fieldLabel:_("Mileage"),name:"mileage",listeners:{change:this.onPropertyChange,scope:this}},{xtype:"textfield",
fieldLabel:_("Billing Information"),name:"billing_information",listeners:{change:this.onPropertyChange,scope:this}}]}]}},createCompanyPanel:function(){return{layout:"form",ref:"companyPanel",cls:"k-companypanel",items:[{xtype:"textfield",fieldLabel:_("Companies"),anchor:"100%",name:"companies",listeners:{change:this.onPropertyChange,scope:this}}]}},createUpdateListPanel:function(){return{layout:"form",cls:"k-updatelistpanel",border:!1,items:[{xtype:"textfield",fieldLabel:_("Update List"),labelAlign:"left",
ref:"../updateList",anchor:"100%",readOnly:!0,name:"updatelist"},{xtype:"button",width:150,ref:"../createUnassignedCopy",handler:this.onCreateUnassignedCopy,text:_("Create Unassigned Copy"),name:"create_unassigned_copy",scope:this}]}},updateUI:function(a,b){var c=a.get("taskhistory")===Zarafa.core.mapi.TaskHistory.DECLINED||a.isTaskAssigned()||a.isTaskOrganized();this.taskInfoPanel.setVisible(c);this.datePanel.setVisible(!c);this.workPanel.setVisible(!c);this.companyPanel.setVisible(!c);this.updateList.setVisible(!c);
if(!0===b||a.isModified("taskstate")){switch(a.get("taskstate")){case Zarafa.core.mapi.TaskState.ACCEPT:this.createUnassignedCopy.setDisabled(!a.get("taskupdates")||a.isTaskDeclined());break;default:this.createUnassignedCopy.setDisabled(!0)}this.doLayout()}},update:function(a,b){this.record=a;this.updateUI(a,b);this.getForm().loadRecord(a)},updateRecord:function(a){this.getForm().updateRecord(a)},onCreateUnassignedCopy:function(a){a=container.getHierarchyStore().getFolder(this.record.get("parent_entryid"));
a=this.record.convertToTask(a);a.setUpdateModificationsTracking(!0);a.beginEdit();a.set("subject",this.record.get("conversation_topic")+" ("+_("copy")+")");a.set("taskstate",Zarafa.core.mapi.TaskState.OWNER_NEW);a.set("taskmode",Zarafa.core.mapi.TaskMode.NOTHING);a.set("taskhistory",Zarafa.core.mapi.TaskHistory.NONE);a.set("ownership",Zarafa.core.mapi.TaskOwnership.NEWTASK);a.set("task_acceptance_state",Zarafa.core.mapi.TaskAcceptanceState.NOT_DELEGATED);a.set("date_completed",null);a.set("updatecount",
1);a.set("icon_index",Zarafa.core.mapi.IconIndex.task_normal);a.set("taskfcreator",!0);a.set("tasklastdelegate","");a.set("task_goid","");a.set("entryid","");var b=container.getHierarchyStore().getById(a.get("store_entryid"));b&&a.set("owner",b.get("display_name"));Zarafa.core.data.UIFactory.openCreateRecord(a);a.endEdit();this.dialog.close()},onCompleteDateChange:function(a,b,c){this.record.beginEdit();Ext.isDate(b)?(this.record.set("status",Zarafa.core.mapi.TaskStatus.COMPLETE),this.record.set("complete",
!0),this.record.set("percent_complete",1),this.record.set("date_completed",b)):(this.record.set("status",Zarafa.core.mapi.TaskStatus.NOT_STARTED),this.record.set("complete",!1),this.record.set("percent_complete",0),this.record.set("date_completed",null));this.record.endEdit()},onPropertyChange:function(a,b,c){!Ext.isEmpty(a.name)&&a.validateValue(a.processValue(b))&&this.record.set(a.name,b)}});Ext.reg("zarafa.taskdetailtab",Zarafa.task.dialogs.TaskDetailTab);Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.TaskGeneralTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.taskgeneraltab",cls:"k-taskgeneraltab",title:_("Task"),layout:{type:"vbox",align:"stretch"},border:!1,items:[this.createExtraInfoPanel(),this.createTaskInfoPanel(),this.createAttachmentInfoPanel(),this.createRecipientPanel(),this.createSubjectPanel(),this.createDateTimePanel(),this.createTaskRequestSettingPanel(),
this.createAttachmentPanel(),this.createBodyPanel()]});Zarafa.task.dialogs.TaskGeneralTab.superclass.constructor.call(this,a)},createExtraInfoPanel:function(){return{xtype:"container",cls:"k-extrainfopanel",hidden:!0,ref:"taskExtraInfo",autoHeight:!0,items:[{xtype:"zarafa.extrainfolinks"}]}},createTaskInfoPanel:function(){return{xtype:"zarafa.taskinfo",cls:"k-taskinfopanel",ref:"taskInfoPanel",autoHeight:!0,hidden:!0}},createAttachmentInfoPanel:function(){return{xtype:"panel",autoScroll:!0,cls:"k-task-attachment-info-panel",
anchor:"100%",border:!1,hidden:!0,autoHeight:!0,ref:"taskAttachInfo",items:[{xtype:"zarafa.attachmentlinks"}]}},createRecipientPanel:function(){return{xtype:"zarafa.resizablecompositefield",cls:"k-field-to",ref:"recipientPanel",anchor:"100%",autoHeight:!1,items:[{xtype:"button",autoHeight:!0,text:_("To")+":",handler:function(){Zarafa.task.Actions.openRecipientSelectionContent(this.record,{defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO})},scope:this},{xtype:"zarafa.recipientfield",plugins:["zarafa.recordcomponentupdaterplugin"],
flex:1}]}},createSubjectPanel:function(){return{xtype:"panel",cls:"k-subject-panel",layout:"form",ref:"subjectPanel",labelWidth:85,labelAlign:"left",border:!1,items:[{xtype:"textfield",fieldLabel:_("Subject"),anchor:"100%",name:"subject",listeners:{change:this.onPropertyChange,scope:this}}]}},createDateTimePanel:function(){return{xtype:"panel",cls:"k-datetime-panel",ref:"datetimePanel",border:!1,autoHeight:!0,layout:{type:"table",columns:2},items:[this.createDatePanel(),this.createStatusPanel(),this.createReminderPanel(),
this.createPriorityCompletePanel()]}},createDatePanel:function(){return{xtype:"panel",cls:"k-date-panel",ref:"../datePanel",autoHeight:!0,autoWidth:!0,border:!1,items:[{xtype:"zarafa.dateperiodfield",ref:"../../dateField",allowBlank:!0,defaultPeriod:container.getSettingsModel().get("zarafa/v1/contexts/task/default_task_period"),width:450,layout:"hbox",listeners:{change:this.onDateRangeFieldChange,scope:this},startFieldConfig:{fieldLabel:_("Start date"),labelWidth:79,labelAlign:"left",cls:"from-field",
width:200},endFieldConfig:{fieldLabel:_("Due date"),labelWidth:84,cls:"to-field",width:200}}]}},createStatusPanel:function(){var a={xtype:"jsonstore",fields:["name","value"],data:Zarafa.task.data.TaskStatus.status};return{xtype:"panel",cls:"k-status-panel",layout:"form",autoHeight:!0,border:!1,labelAlign:"left",items:[{xtype:"combo",width:285,fieldLabel:_("Status"),editable:!1,mode:"local",triggerAction:"all",autoSelect:!0,store:a,displayField:"name",valueField:"value",value:a.data[0].value,lazyInit:!1,
name:"status",listeners:{scope:this,select:this.onStatusSelect}}]}},createPriorityCompletePanel:function(){var a={xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.data.ImportanceFlags.flags};return{xtype:"panel",cls:"k-priority-complete-panel",layout:"hbox",anchor:"100%",border:!1,items:[{xtype:"combo",plugins:["zarafa.fieldlabeler"],fieldLabel:_("Priority"),labelAlign:"left",width:100,editable:!1,mode:"local",triggerAction:"all",autoSelect:!0,store:a,displayField:"name",valueField:"value",
value:a.data[1].value,name:"importance",listeners:{select:this.onImportanceSelect,scope:this}},{xtype:"spacer",width:10},{xtype:"zarafa.spinnerfield",plugins:["zarafa.fieldlabeler","zarafa.percentspinner"],fieldLabel:_("% Complete"),labelWidth:100,name:"percent_complete",width:70,minValue:0,defaultValue:0,incrementValue:.25,maxValue:1,listeners:{spin:this.onCompleteSpin,scope:this}}]}},createReminderPanel:function(){return{xtype:"panel",cls:"k-reminder-panel",ref:"../reminderPanel",autoHeight:!0,
border:!1,items:[{xtype:"zarafa.compositefield",autoHeight:!0,items:[{xtype:"checkbox",name:"reminder",width:79,boxLabel:_("Reminder")+":",handler:this.onToggleReminder,scope:this},{xtype:"zarafa.datetimefield",name:"reminder_time",width:217,timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/task/reminder_time_stepping"),listeners:{change:this.onPropertyChange,scope:this},dateFieldConfig:{flex:0}}]}]}},createTaskRequestSettingPanel:function(){return{xtype:"panel",layout:"hbox",border:!1,
ref:"taskRequestSettingPanel",cls:"k-taskrequestsettings",autoHeight:!0,items:[{xtype:"checkbox",boxLabel:_("Track progress"),tooltip:_("Keep updated copy of task and receive automated status reports"),plugins:"zarafa.formfieldtooltipplugin",name:"taskupdates",width:125,listeners:{change:this.onPropertyChange,scope:this}},{hideLabel:!0,xtype:"textfield",cls:"k-ownerfield",ref:"../ownerField",plugins:["zarafa.fieldlabeler"],fieldLabel:_("Owner"),labelWidth:78,autoWidth:!0,readOnly:!0,flex:1,name:"owner",
listeners:{change:this.onPropertyChange,scope:this}}]}},createAttachmentPanel:function(){return{xtype:"zarafa.resizablecompositefield",hideLabel:!0,anchor:"100%",cls:"k-field-attachments",autoHeight:!0,ref:"attachmentPanel",items:[{xtype:"zarafa.attachmentbutton",plugins:["zarafa.recordcomponentupdaterplugin"],width:100,text:_("Attachments")+":",autoHeight:!0},{xtype:"zarafa.attachmentfield",plugins:["zarafa.recordcomponentupdaterplugin"],flex:1,hideLabel:!0}]}},createBodyPanel:function(){return{xtype:"panel",
cls:"k-body-panel",layout:"fit",border:!1,flex:1,items:[{xtype:"zarafa.editorfield",ref:"../editorField",hideLabel:!0,flex:1,useHtml:!1,listeners:{change:this.onBodyChange,scope:this}}]}},updateUI:function(a,b){var c=a.get("taskhistory"),d=a.get("taskstate"),e=a.get("taskmode"),f=!1;this.taskExtraInfo.setVisible(c!==Zarafa.core.mapi.TaskHistory.NONE);if((c===Zarafa.core.mapi.TaskHistory.ASSIGNED||c===Zarafa.core.mapi.TaskHistory.DECLINED||e===Zarafa.core.mapi.TaskMode.DECLINE||a.isTaskOrganized())&&
b&&a.isOpened())this.taskInfoPanel.setVisible(!0),this.taskAttachInfo.setVisible(a.get("hasattach")),this.editorField.getEditor().setReadOnly(e!==Zarafa.core.mapi.TaskMode.DECLINE),this.recipientPanel.setVisible(!1),this.taskRequestSettingPanel.setVisible(!1),this.attachmentPanel.setVisible(!1),this.datetimePanel.setVisible(!1),this.subjectPanel.setVisible(!1),f=!0;else{d!==Zarafa.core.mapi.TaskState.OWNER_NEW||a.isTaskRequest()||(this.taskExtraInfo.setVisible(!1),this.taskInfoPanel.setVisible(!1),
this.taskAttachInfo.setVisible(!1),this.taskRequestSettingPanel.setVisible(!1),this.recipientPanel.setVisible(!1),this.editorField.getEditor().setReadOnly(!1),this.attachmentPanel.setVisible(!0),this.datetimePanel.setVisible(!0),this.subjectPanel.setVisible(!0),f=!0);c=a.get("startdate");d=b||a.isModifiedSinceLastUpdate("startdate")||a.isModifiedSinceLastUpdate("taskhistor");Ext.isDate(c)&&(c=c.toUTC());var e=a.get("duedate"),g=b||a.isModifiedSinceLastUpdate("duedate")||a.isModifiedSinceLastUpdate("taskhistory");
Ext.isDate(e)&&(e=e.toUTC());(d||g)&&this.dateField.getValue().set(c,e);if(!0===b||a.isModified("taskmode")){switch(a.get("taskmode")){case Zarafa.core.mapi.TaskMode.REQUEST:this.recipientPanel.setVisible(!0);this.taskRequestSettingPanel.setVisible(!0);break;default:this.recipientPanel.setVisible(!1),this.taskRequestSettingPanel.setVisible(!1),this.reminderPanel.setVisible(!0)}f=!0}!0===b&&(c=container.getHierarchyStore().getById(a.get("store_entryid")))&&this.ownerField.setReadOnly(!c.isPublicStore())}this.editorField.getEditor().readOnly?
this.editorField.getEditor().getEl().set({placeholder:""}):this.editorField.getEditor().getEl().set({placeholder:_("Type your message here...")});f&&this.doLayout()},update:function(a,b){this.record=a;this.updateUI(a,b);b&&a.isOpened()&&this.editorField.setValue(a.getBody(this.editorField.isHtmlEditor()));(b||a.isModifiedSinceLastUpdate("reminder_time"))&&a.set("flag_due_by",a.get("reminder_time"));this.getForm().loadRecord(a)},updateRecord:function(a){var b=a.get("taskhistory");b===Zarafa.core.mapi.TaskHistory.ASSIGNED||
b===Zarafa.core.mapi.TaskHistory.DECLINED||a.isTaskOrganized()||(a.beginEdit(),this.getForm().updateRecord(a),this.updateStartDueDate(a,this.dateField.getValue()),this.onBodyChange(this.editorField.getEditor(),this.editorField.getValue()),a.dirty&&a.isTaskOwner()&&(a.isTaskAccepted()||a.isTaskUpdated())&&a.addMessageAction("response_type",Zarafa.core.mapi.TaskMode.UPDATE),!a.phantom&&a.isModified("subject")&&a.set("conversation_topic",a.get("subject")),a.endEdit())},onPropertyChange:function(a,b,
c){!Ext.isEmpty(a.name)&&a.validateValue(a.processValue(b))&&this.record.set(a.name,b)},onImportanceSelect:function(a,b,c){b=b.get(a.valueField);!Ext.isEmpty(a.name)&&a.validateValue(a.processValue(b))&&this.record.set(a.name,b)},onBodyChange:function(a,b,c){a=this.record;a.beginEdit();a.setBody(this.editorField.getValue(),this.editorField.isHtmlEditor());a.endEdit()},onToggleReminder:function(a,b){this.record.beginEdit();this.record.set("reminder",b);if(b){if(!Ext.isDate(this.record.get("reminder_time"))){var c=
this.record.get("duedate"),d=container.getSettingsModel().get("zarafa/v1/contexts/task/default_reminder_time");Ext.isDate(c)||(c=(new Date).add(Date.DAY,1));this.record.set("reminder_time",c.clearTime(!0).add(Date.MINUTE,d))}}else this.record.set("reminder_time",null);this.record.endEdit()},onStatusSelect:function(a,b,c){b=b.get(a.valueField);this.record.beginEdit();this.record.set(a.name,b);(a=b===Zarafa.core.mapi.TaskStatus.COMPLETE)?(this.record.set("complete",!0),this.record.set("percent_complete",
1),this.record.set("date_completed",new Date)):(b===Zarafa.core.mapi.TaskStatus.NOT_STARTED?(this.record.set("complete",!1),this.record.set("percent_complete",0)):(this.record.set("complete",!1),b=this.record.get("percent_complete"),0===b?this.record.set("percent_complete",.25):1===b&&this.record.set("percent_complete",.75)),this.record.set("date_completed",null));this.setFlagsProperties(a);this.record.endEdit()},onCompleteSpin:function(a){a=a.getValue();this.record.beginEdit();0<=a&&.1>a?(this.record.set("status",
Zarafa.core.mapi.TaskStatus.NOT_STARTED),this.record.set("complete",!1),this.record.set("percent_complete",a),this.record.set("date_completed",null)):.1<=a&&1>a?(this.record.set("status",Zarafa.core.mapi.TaskStatus.IN_PROGRESS),this.record.set("complete",!1),this.record.set("percent_complete",a),this.record.set("date_completed",null)):1===a&&(this.record.set("status",Zarafa.core.mapi.TaskStatus.COMPLETE),this.record.set("complete",!0),this.record.set("percent_complete",a),this.record.set("date_completed",
new Date));this.setFlagsProperties(1===a);this.record.endEdit()},setFlagsProperties:function(a){this.record.set("flag_icon",a?Zarafa.core.mapi.FlagIcon.clear:Zarafa.core.mapi.FlagIcon.red);this.record.set("flag_complete_time",a?new Date:null);this.record.set("flag_request",a?"":"Follow up");this.record.set("flag_status",a?Zarafa.core.mapi.FlagStatus.completed:Zarafa.core.mapi.FlagStatus.flagged)},onDateRangeFieldChange:function(a,b,c){this.updateStartDueDate(this.record,b)},updateStartDueDate:function(a,
b){var c=b.getStartDate(),d=b.getDueDate();a.beginEdit();Ext.isDate(c)?(a.set("startdate",c.fromUTC()),a.set("commonstart",c.clone())):(a.set("startdate",null),a.set("commonstart",null));Ext.isDate(d)?(a.set("duedate",d.fromUTC()),a.set("commonend",d.clone())):(a.set("duedate",null),a.set("commonend",null));a.endEdit()}});Ext.reg("zarafa.taskgeneraltab",Zarafa.task.dialogs.TaskGeneralTab);Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.TaskPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.taskpanel",bodyStyle:"background-color: inherit;",border:!1,layout:"fit",items:this.createTabPanel()});Zarafa.task.dialogs.TaskPanel.superclass.constructor.call(this,a)},createTabPanel:function(){return[{xtype:"tabpanel",activeTab:0,layoutOnTabChange:!0,border:!1,items:[{xtype:"zarafa.taskgeneraltab"},{xtype:"zarafa.taskdetailtab"},container.populateInsertionPoint("context.task.taskcontentpanel.tabs",
this)]}]}});Ext.reg("zarafa.taskpanel",Zarafa.task.dialogs.TaskPanel);Ext.namespace("Zarafa.task.ui");
Zarafa.task.ui.TaskInfo=Ext.extend(Ext.DataView,{taskInfoCls:"preview-header-task",taskInfoElem:void 0,taskGeneralTabTpl:'<table class="preview-from"><tr><td class="table-label">'+_("Subject")+':</td><td colspan="100%"><tpl if="!Ext.isEmpty(values.conversation_topic)">{conversation_topic:htmlEncode}</tpl><tpl if="Ext.isEmpty(values.conversation_topic)">{subject:htmlEncode}</tpl></td></tr><tr><td class="table-label">'+_("Start date")+':</td><td class="minwidth120"><tpl if="Ext.isDate(values.startdate)">{startdate:date(_("d-m-Y"))}</tpl><tpl if=" !Ext.isDate(values.startdate)">'+
_("None")+'</tpl></td><td class="table-label minwidth50">'+_("Due date")+':</td><td><tpl if="Ext.isDate(values.duedate)">{duedate:date(_("d-m-Y"))}</tpl><tpl if="!Ext.isDate(values.duedate)">'+_("None")+'</tpl></td></tr><tr><td class="table-label">'+_("Status")+':</td><td class="minwidth120">{status:this.getStatus}</td><td class="table-label minwidth50">'+_("Priority")+':</td><td>{importance:this.getPriority}</td><td class="table-label">'+_("% Complete")+':</td><td>{percent_complete:this.getPercentComplete}</td></tr><tr><td class="table-label">'+
_("Owner")+':</td><td colspan="100%">{owner:htmlEncode}</td></tr></table>',taskDetailsTabTpl:'<table class="preview-from"><tr><td class="table-label minwidth120">'+_("Date completed")+':</td><td colspan="100%">{date_completed:this.getFormatedDate}</td></tr><tr><td class="table-label minwidth120">'+_("Total work")+':</td><td colspan="100%">{totalwork:htmlEncode} '+_("hours")+'</td><td class="table-label minwidth50">'+_("Mileage")+':</td><td>{mileage:htmlEncode}</td></tr><tr><td class="table-label minwidth120">'+
_("Actual work")+':</td><td colspan="100%">{actualwork:htmlEncode} '+_("hours")+'</td><td class="table-label minwidth50">'+_("Billing information")+':</td><td>{billing_information:htmlEncode}</td></tr><tr><td class="table-label minwidth120">'+_("Company")+':</td><td colspan="100%">{companies:htmlEncode}</td></tr><tr><td class="table-label minwidth120">'+_("Update list")+':</td><td colspan="100%">{tasklastuser:htmlEncode}</td></tr></table>',constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,
[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.taskinfo",border:!1,autoScroll:!0,anchor:"100%"});Zarafa.task.ui.TaskInfo.superclass.constructor.call(this,a);Ext.isString(this.taskGeneralTabTpl)&&Ext.isString(this.taskDetailsTabTpl)&&(this.taskGeneralTabTpl=new Ext.XTemplate(this.taskGeneralTabTpl,{compiled:!0,getStatus:function(a){return Zarafa.core.mapi.TaskStatus.getDisplayName(a)},getPriority:function(a){return Zarafa.core.mapi.Importance.getDisplayName(a)},
getPercentComplete:function(a){return 100*a+"%"}}),this.taskDetailsTabTpl=new Ext.XTemplate(this.taskDetailsTabTpl,{compiled:!0,getFormatedDate:function(a){return Ext.isDate(a)?a.format(_("D d-m-Y")):_("None")}}))},onRender:function(){Zarafa.task.ui.TaskInfo.superclass.onRender.apply(this,arguments);this.taskInfoElem=Ext.DomHelper.append(this.el.dom,{tag:"div",cls:this.taskInfoCls})},update:function(a){if(this.taskInfoElem){var b=Ext.get(this.taskInfoElem);if(Ext.isDefined(a)){var c=this.ownerCt;
c.isXType("zarafa.taskgeneraltab")||c.isXType("zarafa.messageheader")?this.taskGeneralTabTpl.overwrite(b,a.data):c.isXType("zarafa.taskdetailtab")&&this.taskDetailsTabTpl.overwrite(b,a.data)}else this.taskInfoElem.innerHTML=""}this.record=a}});Ext.reg("zarafa.taskinfo",Zarafa.task.ui.TaskInfo);Ext.namespace("Zarafa.task.ui");
Zarafa.task.ui.TaskPreviewPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.taskpreviewpanel",border:!1,layout:"zarafa.collapsible",items:[{xtype:"zarafa.messageheader"},{xtype:"zarafa.messagebody"}]});Zarafa.task.ui.TaskPreviewPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.taskpreviewpanel",Zarafa.task.ui.TaskPreviewPanel);Ext.namespace("Zarafa.calendar.ui");
Zarafa.task.ui.TaskRequestButtons=Ext.extend(Ext.ButtonGroup,{record:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{hidden:!0,forceLayout:!0,cls:"k-tr-buttons",ref:"taskRequestButtons",items:[this.createAcceptButton(),this.createDeclineButton()]});Zarafa.task.ui.TaskRequestButtons.superclass.constructor.call(this,a)},update:function(a,b){if(a instanceof Zarafa.task.TaskRecord){this.record=a;var c=a.isSubMessage(),
d=!1,e=!1;if(b){var f=Zarafa.core.MessageClass.isClass(a.get("message_class"),["IPM.TaskRequest.Accept","IPM.TaskRequest.Update","IPM.TaskRequest.Decline","IPM.TaskRequest.Complete"]),g=!1,h=!1;a instanceof Zarafa.task.TaskRequestRecord&&a.isMessageClass("IPM.TaskRequest")?(d=(g=a.isReceivedTaskRequestFromAssigner())&&!c,e=g&&!c):f||(e=a.isTaskOwner(),f=a.isTaskAssigned(),g=a.isTaskReceived(),h=a.isTaskAccepted(),d=g&&f&&e&&!h&&!c,e=!c&&g&&e&&(f||h||a.isTaskUpdated()));this.acceptButton.setVisible(d);
this.declineButton.setVisible(e)}!b&&a.isModifiedSinceLastUpdate("taskmode")&&(this.acceptButton.setVisible(d),this.declineButton.setVisible(e));this.acceptButton.isVisible()&&this.acceptButton.getEl().addClass("zarafa-action");var k=!1;this.items.each(function(a){if(!0!==a.hidden)return k=!0,!1});this.setVisible(k)}else this.setVisible(!1)},createAcceptButton:function(){return{xtype:"button",ref:"acceptButton",text:_("Accept"),iconCls:"icon_calendar_appt_accept",responseStatus:Zarafa.core.mapi.TaskMode.ACCEPT,
handler:this.openSendConfirmationContent,scope:this}},createDeclineButton:function(){return{xtype:"button",ref:"declineButton",text:_("Decline"),iconCls:"icon_calendar_appt_cancelled",responseStatus:Zarafa.core.mapi.TaskMode.DECLINE,handler:this.openSendConfirmationContent,scope:this}},openSendConfirmationContent:function(a,b){this.record.isTaskOwner()&&Zarafa.task.Actions.openSendConfirmationContent(this.record,{responseType:a.responseStatus})}});Ext.reg("zarafa.taskrequestbuttons",Zarafa.task.ui.TaskRequestButtons);
Ext.namespace("Zarafa.whatsnew");
Zarafa.whatsnew.Actions={openWhatsNewDialog:function(){if(!1!==container.getSettingsModel().get("zarafa/v1/main/new_features_dialog/show")){var a=this.getNewWebAppFeatures(),a=a.concat(this.getNewPluginsFeatures());Ext.isEmpty(a)||(new Zarafa.whatsnew.ui.WhatsNewWindow({features:a})).show()}},getNewWebAppFeatures:function(){var a=container.getSettingsModel(),b=container.getVersion().getWebApp();if(!this.validateWhatsNewData("webapp-core",b))return[];a.set("zarafa/v1/main/new_features_dialog/last_version/webapp",b);
return Zarafa.whatsnew.Features.features},getNewPluginsFeatures:function(){var a=[],b=container.getSettingsModel();Ext.each(container.getPlugins(),function(c){var d=container.getServerConfig().getPluginsVersion()[c.getName()]||"0";this.validateWhatsNewData(c.getName(),d)&&(Ext.each(c.whatsNew.features,function(a){var b=container.getServerConfig().getBaseUrl()+"plugins/"+c.getName()+"/";Ext.isEmpty(a.image_url)||(a.image_url=b+a.image_url);Ext.isEmpty(a.icon_url)||(a.icon_url=b+a.icon_url)}),a.push({name:c.getName(),
features:c.whatsNew.features}),b.set("zarafa/v1/main/new_features_dialog/last_version/plugins/"+c.getName(),d))},this);return this.sortPluginFeatures(a)},validateWhatsNewData:function(a,b){this.whatsNewSettings||(this.whatsNewSettings=container.getSettingsModel().get("zarafa/v1/main/new_features_dialog",!0));var c,d;"webapp-core"===a?(c=Zarafa.whatsnew.Features,b=container.getVersion().getWebApp(),d=this.whatsNewSettings.last_version.webapp):(c=container.getPluginByName(a).whatsNew,b=container.getServerConfig().getPluginsVersion()[a],
this.whatsNewSettings.last_version.plugins&&(d=this.whatsNewSettings.last_version.plugins[a]));return!Ext.isDefined(c)||0!==container.getVersion().versionCompare(c.version,b)||0<=container.getVersion().versionCompare(d||"0",b)||!Array.isArray(c.features)?!1:!0},sortPluginFeatures:function(a){var b=[],c=["spreedwebrtc","files","smime"];a=a.sort(function(a,b){var d=c.indexOf(a.name),e=c.indexOf(b.name);return-1==d&&-1<e||-1<d&&1==e?e-d:d-e});Ext.each(a,function(a,c){b=b.concat(a.features)});return b}};
Ext.namespace("Zarafa.whatsnew.ui");
Zarafa.whatsnew.ui.WhatsNewWindow=Ext.extend(Ext.Window,{features:[],activeItem:0,constructor:function(a){a=a||{};Array.isArray(a.features)&&(this.features=a.features);Ext.apply(a,{modal:!0,id:"k-whatsnew-window",width:650,height:397,resizable:!1,title:_("What's new"),layout:"vbox",layoutConfig:{align:"stretch"},tools:[{id:"close",handler:this.onSkip,scope:this}],bbar:this.createBottomBar(),items:[this.createFeaturePanels(),this.createNavigationPanel()]});Zarafa.whatsnew.ui.WhatsNewWindow.superclass.constructor.call(this,a)},
createBottomBar:function(){return[{xtype:"checkbox",boxLabel:_("Don't show me new features again."),ctCls:"k-whatsnew-checkbox",ref:"../dontShowCheckbox"},"->",{cls:"zarafa-normal",id:"k-whatsnew-skip",text:_("Skip"),handler:this.onSkip,scope:this}]},onSkip:function(a){this.dontShowCheckbox.getValue()&&container.getSettingsModel().set("zarafa/v1/main/new_features_dialog/show",!1);this.close()},createFeaturePanels:function(){return{xtype:"container",ref:"featureContainer",layout:"card",activeItem:0,
autoHeight:!0,defaults:{border:!1},items:this.features.map(function(a){var b='<h2 class="k-whatsnew-text-title">'+Ext.util.Format.htmlEncode(a.title)+'</h2><div class="k-whatsnew-text-description">'+a.description+"</p>";Ext.isEmpty(a.icon_url)||(b='<img class="k-whatsnew-feature-icon" src="'+a.icon_url+'">'+b);return{layout:"column",items:[{xtype:"container",cls:"k-whatsnew-feature-text",width:216,autoScroll:!0,height:287,html:b},{xtype:"container",cls:"k-whatsnew-feature-image",width:432,height:287,
html:'<img src="'+a.image_url+'">'}]}})}},createNavigationPanel:function(){return{xtype:"toolbar",cls:"k-whatsnew-navbar",buttonAlign:"center",items:[{xtype:"zarafa.toolbarbutton",iconCls:"arrow_left_l",id:"k-whatsnew-prev",tooltip:_("Previous"),disabled:1<this.features.length?!1:!0,handler:this.onNavigate.createDelegate(this,[-1])},{xtype:"tbtext",ref:"../featureNumber",cls:"k-whatsnew-feature-number",text:"1/"+this.features.length},{xtype:"zarafa.toolbarbutton",id:" k-whatsnew-next",iconCls:"arrow_right_l",
tooltip:_("Next"),disabled:1<this.features.length?!1:!0,handler:this.onNavigate.createDelegate(this,[1])}]}},onNavigate:function(a){this.activeItem+=a;this.activeItem>=this.features.length?this.activeItem=0:0>this.activeItem&&(this.activeItem=this.features.length-1);this.featureContainer.layout.setActiveItem(this.activeItem);this.featureNumber.setText(this.activeItem+1+"/"+this.features.length)}});
Ext.apply(Ext.EventObjectImpl.prototype,{getKeyCharCode:function(){var a=this.getCharCode();a>=this.NUM_ZERO&&a<=this.NUM_NINE&&(a-=48);return String.fromCharCode(a)}});
Zarafa.core.ColorSchemes.addField([{name:"header",weight:1},{name:"border",weight:1.8},{name:"borderInner",weight:1.42},{name:"startcolorappointment",weight:1},{name:"endcolorappointment",weight:1},{name:"startcolorappointmentbox",weight:1.29},{name:"endcolorappointmentbox",weight:1.29},{name:"stripnormal",weight:1.86},{name:"stripworking",color:"#ffffff"},{name:"linenormal",weight:1.73},{name:"hourline",weight:1.33}]);Ext.namespace("Zarafa.common.freebusy.data");
Zarafa.common.freebusy.data.FreebusyBlockRecord=Ext.data.Record.create([{name:"userid"},{name:"start",type:"int"},{name:"end",type:"int"},{name:"status",type:"int"}]);Ext.namespace("Zarafa.core");
Zarafa.core.ContainerClass={isClass:Zarafa.core.MessageClass.isClass,isMessageClassCompatible:function(a,b){return Zarafa.core.MessageClass.isContainerClassCompatible(b,a)},getDefaultFolderTypeFromContainerClass:function(a){a=a.toUpperCase();switch(a){case "IPF.APPOINTMENT":return"calendar";case "IPF.STICKYNOTE":return"note";case "IPF.CONTACT":return"contact";case "IPF.TASK":return"task";case "IPF.NOTE":return"inbox"}var b=a.lastIndexOf(".");return 0<b?(a=a.substr(0,b),this.getDefaultFolderTypeFromContainerClass(a)):
""}};Ext.namespace("Zarafa.core");Zarafa.core.ContextMetaData=Ext.extend(Zarafa.core.PluginMetaData,{constructor:function(a){a=a||{};Ext.applyIf(a,{allowUserDisable:!1});Zarafa.core.ContextMetaData.superclass.constructor.call(this,a)}});Ext.namespace("Zarafa.core");
Zarafa.core.ContextModel=Ext.extend(Zarafa.core.data.StatefulObservable,{current_data_mode:void 0,store:void 0,folders:void 0,last_used_folders:void 0,selectedRecords:void 0,defaultFolder:void 0,statefulRecordSelection:!1,lastPreviewedRecord:{},lastSelectedRecord:{},isBusyScrolling:!1,enabled:!1,suspended:!1,suspendLoad:!1,suspendData:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{stateful:!0});this.addEvents("previewrecordchange","recordselectionchange","folderchange","datamodechange","beforelivescrollstart",
"livescrollstart","beforelivescrollstop","livescrollstop","beforesearchstart","searchstart","searchupdate","beforesearchstop","searchstop","searchfinish","searchexception");Zarafa.core.ContextModel.superclass.constructor.call(this,a);!0===this.statefulRecordSelection&&(this.store.on("beforeload",this.onBeforeLoad,this),this.store.on("load",this.onLoad,this));this.stateful&&this.initState();a=container.getHierarchyStore();a.on("load",this.onHierarchyLoad,this);this.onHierarchyLoad(a);Zarafa.core.data.IPFStoreMgr.on("afterrecordupdate",
this.afterRecordUpdate,this)},enable:function(a,b){this.enabled=!0;this.suspendLoading(!0);a&&this.setFolders(a);this.setDataMode(this.getCurrentDataMode(),!0);!0!==b&&this.resumeLoading()},disable:function(){this.enabled=!1;this.stopLiveScroll();this.store.cancelLoadRequests();this.store.removeAll(!0)},onBeforeLoad:function(a,b){(!b||b.actionType!==Zarafa.core.Actions.updatesearch&&b.actionType!==Zarafa.core.Actions.updatelist)&&!0!==b.reload&&this.setPreviewRecord(void 0,!1)},onLoad:function(a,
b,c){if(!c||c.actionType!==Zarafa.core.Actions.updatesearch){var d,e=[];if(!Ext.isEmpty(b)){if(c&&c.params&&((b=this.lastPreviewedRecord[c.params.entryid])&&(d=a.getById(b)),c=this.lastSelectedRecord[c.params.entryid])){b=0;for(var f=c.length;b<f;b++){var g=a.getById(c[b]);g&&e.push(g)}}Ext.isEmpty(e)||this.setSelectedRecords(e,!1);Ext.isDefined(d)&&this.setPreviewRecord(d,!1)}}},onHierarchyLoad:function(a){if(0!==a.getCount()&&!Ext.isEmpty(this.store)&&!Ext.isEmpty(this.store.preferredMessageClass)&&
Ext.isEmpty(this.folders)){var b=Zarafa.core.MessageClass.getDefaultFolderTypeFromMessageClass(this.store.preferredMessageClass);this.defaultFolder=a.getDefaultFolder(b);b=[];if(!Ext.isEmpty(this.last_used_folders))for(var c in this.last_used_folders){var d=a.getById(c);if(d)for(var d=d.getSubStore("folders"),e=this.last_used_folders[c],f=0;f<e.length;f++){var g=d.getById(e[f]);g&&b.push(g)}}Ext.isEmpty(b)&&this.defaultFolder&&b.push(this.defaultFolder);this.setFolders(b)}},afterRecordUpdate:function(a,
b,c){if(this.enabled&&(a=b.getMessageAction("action_type"),"commit"==c&&Ext.isString(a)))switch(a.toLowerCase()){case "emptyfolder":case "readflags":Ext.each(this.getFolders(),function(a){if(b.equals(a))return this.reload(),!1},this)}},getStore:function(){return this.store},addFolder:function(a){var b=this.getFolder(a.get("entryid"));if(!Ext.isDefined(b))return this.folders.push(a),this.onFolderChange(this,this.folders),this.fireEvent("folderchange",this,this.folders),this.load(),a},removeFolder:function(a){a=
this.getFolder(a.get("entryid"));if(Ext.isDefined(a))return this.folders.remove(a),Ext.isEmpty(this.folders)&&this.folders.push(this.defaultFolder),this.onFolderChange(this,this.folders),this.fireEvent("folderchange",this,this.folders),this.load(),a},setFolders:function(a){var b=!0;if(this.folders==a||void 0===this.folders)b=!1;Array.isArray(a)?this.folders=a.clone():Ext.isDefined(a)?this.folders=[a]:this.folders=[];this.onFolderChange(this,this.folders);this.fireEvent("folderchange",this,this.folders,
b);this.load()},onFolderChange:function(a,b){this.stopLiveScroll();if(this.stateful&&!Ext.isEmpty(b)){var c=b[0],c=container.getHierarchyStore().getState(c,"list"),d=this.store.defaultSortInfo;c&&c.sort&&(d=c.sort);d&&this.store.setDefaultSort(d.field,d.direction)}},getFolders:function(){return this.folders||[]},getDefaultFolder:function(){if(this.enabled){var a=this.getFolders();if(!Ext.isEmpty(a))return a[0]}return this.defaultFolder},getFolder:function(a){var b;Ext.each(this.getFolders(),function(c){if(Zarafa.core.EntryId.compareEntryIds(c.get("entryid"),
a))return b=c,!1});return b},hasFolder:function(a){a instanceof Zarafa.core.data.MAPIRecord&&(a=a.get("entryid"));return Ext.isDefined(this.getFolder(a))},createRecord:Ext.emptyFn,setSelectedRecords:function(a,b){this.selectedRecords&&a&&this.selectedRecords.equals(a)||(this.selectedRecords=a,!0!==this.statefulRecordSelection||!1===b||Ext.isEmpty(a)||(this.lastSelectedRecord[a[0].get("parent_entryid")]=Ext.pluck(a,"id")),this.fireEvent("recordselectionchange",this,a))},getSelectedRecords:function(){return this.selectedRecords},
suspendLoading:function(){this.suspended=!0},resumeLoading:function(a){!0===this.suspended&&(this.suspended=!1,!1!==a&&!0===this.suspendLoad&&this.load(this.suspendData),delete this.suspendData)},load:function(a){this.enabled&&(this.suspended?(this.suspendLoad=!0,this.suspendData=a):Ext.isEmpty(this.folders)?(this.setPreviewRecord(void 0,!1),this.store.removeAll(!0)):(a=Ext.applyIf(a||{},{folder:this.folders}),this.store.load(a)))},reload:function(){var a=this.store.lastOptions;!this.isSearching()&&
this.isBusyScrolling&&this.stopLiveScroll();this.suspended?(this.suspendLoad=!0,this.suspendData=a):this.store.reload()},setPreviewRecord:function(a,b){this.previewRecord!==a&&(this.previewRecord=a,!0===this.statefulRecordSelection&&!1!==b&&Ext.isDefined(a)&&(this.lastPreviewedRecord[a.get("parent_entryid")]=a.get("entryid")),this.fireEvent("previewrecordchange",this,a))},getPreviewRecord:function(){return this.previewRecord},setDataMode:function(a,b){if(!0===b||this.current_data_mode!==a){var c=
this.current_data_mode;this.current_data_mode=a;this.onDataModeChange(this,this.current_data_mode,c);this.fireEvent("datamodechange",this,this.current_data_mode,c)}},onDataModeChange:Ext.emptyFn,getCurrentDataMode:function(){return this.current_data_mode},clearGrouping:function(){Ext.isEmpty(this.store.groupField)||this.store.clearGrouping()},groupBy:function(a){this.store.groupBy(a)},isSearching:function(){return Ext.isDefined(this.getStore())&&Ext.isDefined(this.getStore().isBusySearching)&&this.getStore().isBusySearching?
!0:!1},supportsSearchFolder:function(a){a=a||this.getDefaultFolder();return Ext.isEmpty(a)?!1:(a=a.getMAPIStore())?a.hasSearchSupport():!1},isLiveScrolling:function(){return this.isBusyScrolling},startLiveScroll:function(a){if(container.getSettingsModel().get("zarafa/v1/contexts/mail/enable_live_scroll")&&!1!==this.fireEvent("beforelivescrollstart",this,a)&&(this.isBusyScrolling=!0,this.store.on("exception",this.onLiveScrollException,this),!1!==this.fireEvent("livescrollstart",this,a))){var b={restriction:{}};
b.restriction.start=a;b.restriction.limit=container.getSettingsModel().get("zarafa/v1/main/page_size");this.store.liveScroll({folder:[this.getDefaultFolder()],params:b,add:!0})}},stopLiveScroll:function(){this.isBusyScrolling&&!1!==this.fireEvent("beforelivescrollstop",this)&&(this.store.stopLiveScroll(),this.store.un("exception",this.onLiveScrollException,this),this.isBusyScrolling=!1,this.fireEvent("livescrollstop",this))},onLiveScrollException:function(a,b,c,d,e,f){this.store.un("exception",this.onLiveScrollException,
this);this.stopLiveScroll()},startSearch:function(a,b,c){var d=this.supportsSearchFolder(c.folder);d||(b=!1);if(!1!==this.fireEvent("beforesearchstart",this,a,b)){this.store.isBusySearching=!0;this.fireEvent("searchstart",this,a,b);this.store.on("exception",this.onSearchException,this);if(d)this.store.on("beforeupdatesearch",this.onSearchUpdate,this);else this.store.on("load",function(){this.fireEvent("searchfinished",this)},this,{single:!0});var e=this.getActiveStore(),f=!1;Ext.isDefined(e.searchFolder[e.searchStoreUniqueId])&&
(f=e.searchFolder[e.searchStoreUniqueId].get("entryid"),f=Zarafa.core.EntryId.compareEntryIds(f,e.searchFolderEntryId));this.store.search({folder:c.folder,forceCreateSearchFolder:f,useSearchFolder:d,subfolders:b,searchRestriction:a})}},stopSearch:function(){this.isSearching()&&!1!==this.fireEvent("beforesearchstop",this)&&(this.store.stopSearch({}),this.store.un("exception",this.onSearchException,this),this.store.un("beforeupdatesearch",this.onSearchUpdate,this),this.isBusyScrolling=this.store.isBusySearching=
!1,this.fireEvent("searchstop",this))},onSearchUpdate:function(a,b){this.fireEvent("searchupdate",this,a,b);Zarafa.core.mapi.Search.isSearchRunning(b.searchState)||(a.un("exception",this.onSearchException,this),a.un("beforeupdatesearch",this.onSearchUpdate,this),this.fireEvent("searchfinished",this))},onSearchException:function(a,b,c,d,e,f){this.store.un("exception",this.onSearchException,this);this.store.un("beforeupdatesearch",this.onSearchUpdate,this);this.stopSearch();this.fireEvent("searchexception",
this,a,b,c,d,e,f)},getStateName:function(){var a=this.statefulName;a||this.store&&(a=this.store.preferredMessageClass.match(/(?:IPM\.)?(.*)/)[1].toLowerCase());return"models/"+a},initStateEvents:function(){Zarafa.core.ContextModel.superclass.initStateEvents.call(this);this.on("datamodechange",this.saveDataModeState,this,{delay:100});this.on("folderchange",this.saveFolderChangeState,this,{delay:100})},saveFolderChangeState:function(a,b,c){!1!==c&&this.saveState()},saveDataModeState:function(a,b,c){b!=
c&&this.saveState()},getState:function(){var a=Zarafa.core.ContextModel.superclass.getState.call(this)||{},b=this.isSearching();if(this.folders){this.last_used_folders={};for(var c=0,d=this.folders.length;c<d;c++){var e=this.folders[c],f=e.get("store_entryid"),e=e.get("entryid");Ext.isDefined(this.last_used_folders[f])||(this.last_used_folders[f]=[]);this.last_used_folders[f].push(e)}}return Ext.apply(a,b?{}:{current_data_mode:this.current_data_mode,last_used_folders:this.last_used_folders})},applyState:function(a){this instanceof
Zarafa.core.MultiFolderContextModel||Ext.isDefined(a.last_used_folders)&&(1<Object.keys(a.last_used_folders).length?delete a.last_used_folders:Ext.iterate(a.last_used_folders,function(a,c,d){Array.isArray(c)&&1<c.length&&delete d[a]},this));Zarafa.core.ContextModel.superclass.applyState.call(this,a)}});Ext.namespace("Zarafa.core");Zarafa.core.ErrorType=Zarafa.core.Enum.create({MAPI:1,ZARAFA:2,GENERAL:3});Ext.namespace("Zarafa.core");
Zarafa.core.Plugin=Ext.extend(Zarafa.core.data.StatefulObservable,{info:void 0,constructor:function(a){Zarafa.core.Plugin.superclass.constructor.call(this,a);this.initPlugin()},initPlugin:function(){var a=this.info.getAbout();Ext.isEmpty(a)||this.registerAboutText(this.getDisplayName(),a)},getName:function(){return this.info.getName()},getDisplayName:function(){return this.info.getDisplayName()},getIconCls:function(){return this.info.getIconCls()},getSettingsBase:function(){return this.info.getSettingsBase()},
registerAboutText:function(a,b){this.registerInsertionPoint("context.settings.category.copyright",function(){return{xtype:"zarafa.settingscopyrightwidget",title:a,about:b}})},registerInsertionPoint:function(a,b,c){this.insertionPoints||(this.insertionPoints=[]);c||(c=this);this.insertionPoints.push({match:a,createFunction:b,scope:c})},getComponents:function(a){var b=[],c=Ext.toArray(arguments);Ext.each(this.insertionPoints,function(d){if("string"==typeof d.match&&d.match==a||d.match.constructor&&
d.match.constructor==RegExp&&d.match.test(a)){d=d.createFunction.apply(d.scope,c);if(void 0===d||null===d)d=[];Array.isArray(d)||(d=[d]);b.push.apply(b,d)}},this);return b},bidSharedComponent:function(a,b){return-1},getSharedComponent:function(a,b){}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.AbstractNotificationResponseHandler=Ext.extend(Zarafa.core.data.AbstractResponseHandler,{store:void 0,reader:void 0,notifyObject:void 0,notifications:void 0,receivedTime:void 0,start:function(a,b,c,d){if(!Ext.isObject(c)||Ext.isEmpty(this.notifyObject)||!Ext.isFunction(this.notifyObject.onNotify))return!1;this.notifications={};this.receivedTime=d},done:function(a){Ext.iterate(this.notifications,function(b,c){Ext.each(c,function(c){this.notifyObject.onNotify(b,c.records,c.data,this.receivedTime,
a)},this)},this)},addNotification:function(a,b,c){b={records:b,data:c};Ext.isDefined(this.notifications[a])?Array.isArray(this.notifications[a])?this.notifications[a].push(b):this.notifications[a]=[this.notifications[a],b]:this.notifications[a]=[b]}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.CompositeResponseHandler=Ext.extend(Zarafa.core.data.AbstractResponseHandler,{handlers:void 0,activeHandlers:void 0,start:function(a,b,c,d){this.activeHandlers=[];for(var e=0,f=this.handlers.length;e<f;e++){var g=this.handlers[e];!1!==g.start(a,b,c,d)&&this.activeHandlers.push({handler:g,success:!0})}return 0<this.activeHandlers.length},handle:function(a,b){for(var c=0,d=this.activeHandlers.length;c<d;c++){var e=this.activeHandlers[c];e.success=e.handler.handle(a,b)}},done:function(a){a=
0;for(var b=this.activeHandlers.length;a<b;a++){var c=this.activeHandlers[a];c.handler.done(c.success)}}});Ext.namespace("Zarafa.core.data");Zarafa.core.data.IPFRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{equals:function(a){return this===a?!0:this.phantom!==a.phantom?!1:this.phantom?this.id==a.id:Zarafa.core.EntryId.compareEntryIds(this.get("entryid"),a.get("entryid"))},isContainerClass:function(a,b){return Zarafa.core.ContainerClass.isClass(this.get("container_class"),a,b)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPFStore=Ext.extend(Zarafa.core.data.MAPIStore,{standalone:!1,serveronly:!1,constructor:function(a){a=a||{};this.addEvents("beforenotify","notify");Zarafa.core.data.IPFStore.superclass.constructor.call(this,a);this.standalone||Zarafa.core.data.IPFStoreMgr.register(this,this.serveronly)},initEvents:function(){Zarafa.core.data.IPFStore.superclass.initEvents.call(this);if(!this.standalone){if(!this.serveronly)Zarafa.core.data.IPFStoreMgr.on("beforerecordsave",this.onExternalSave,this);
Zarafa.core.data.IPFStoreMgr.on("afterrecordwrite",this.onExternalWrite,this)}},getRecordsForUpdateData:function(a,b){var c={records:[],updatedRecords:[]};if(Ext.isDefined(a)){Array.isArray(a)||(a=[a]);var d=this instanceof Zarafa.common.favorites.data.MAPIFavoritesSubStore;if(b===Ext.data.Api.actions.create)for(var e=0,f=a.length;e<f;e++){var g=a[e],h=this.containsStoreInLastLoad(g.get("store_entryid"));g.isFavoritesFolder()?d&&(c.records.push(g.copy()),c.updatedRecords.push(g)):g.store!==this&&
h&&!d&&(c.records.push(g.copy()),c.updatedRecords.push(g))}else for(e=0,f=a.length;e<f;e++)g=a[e],h=this.getById(g.get("entryid")),h===this||!h||g.isFavoritesFolder()||d||(c.records.push(h),c.updatedRecords.push(g))}return c},onExternalSave:function(a,b){var c;if(a!==this){c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.open],Ext.data.Api.actions.open);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectModified,c.records,c.updatedRecords);c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.update],
Ext.data.Api.actions.update);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectModified,c.records,c.updatedRecords);c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.create],Ext.data.Api.actions.create);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectCreated,c.records,c.updatedRecords);c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.destroy],Ext.data.Api.actions.destroy);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectDeleted,
c.records,c.updatedRecords)}},onExternalWrite:function(a,b,c,d,e){a!==this&&(c={},Array.isArray(e)?c[b]=e:c[b]=[e],this.onExternalSave(a,c))},containsStoreInLastLoad:function(a){return!1},onNotify:function(a,b,c,d,e){if(!1!==this.fireEvent("beforenotify",this,a,b,c,d,e)){var f=this["onNotify"+Ext.util.Format.capitalize(a)];Ext.isFunction(f)&&f.call(this,a,b,c,d,e);this.fireEvent("notify",this,a,b,c,d,e)}},destroy:function(){this.standalone||(Zarafa.core.data.IPFStoreMgr.unregister(this,this.serveronly),
Zarafa.core.data.IPFStoreMgr.un("beforerecordsave",this.onExternalSave,this),Zarafa.core.data.IPFStoreMgr.un("afterrecordwrite",this.onExternalWrite,this));Zarafa.core.data.IPFStore.superclass.destroy.call(this)}});Ext.reg("zarafa.ipfstore",Zarafa.core.data.IPFStore);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMAttachmentProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.core.data.IPMAttachmentResponseHandler({proxy:this,action:c,reader:f,sendRecords:d,options:k,callback:g,scope:h})},createUpdateAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||Zarafa.core.Actions.upload,a,b,c,d,e,f,g)},destroyAction:function(a,b,c,d,e,f,g){this.doRequests(g.actionType||Zarafa.core.Actions["delete"],a,b,c,d,e,f,g)},doRequests:function(a,
b,c,d,e,f,g,h){var k=container.getRequest(),l=c;Array.isArray(c)&&(l=c[0]);l=this.getItemModuleName(l);b=this.getResponseHandlerForRequest(l,a,b,c,d,e,f,g,h);c=new FormData;for(var m in d)if(e=d[m],Array.isArray(e)||e instanceof FileList)for(f=0,g=e.length;f<g;f++)c.append(m+"[]",e[f]);else c.append(m,e);k.reset();a=k.addDataRequest(l,a,c,b);h=h.requestUrl;h=Ext.urlAppend(h,"module="+l);h=Ext.urlAppend(h,"moduleid="+a);k.send(h,{})}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMExpandDistlistProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{listModuleName:"expanddistlistmodule",getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.core.data.IPMExpandDistlistResponseHandler({proxy:this,action:Ext.data.Api.actions.read,reader:f,sendRecords:d,options:k,callback:g,scope:h})},request:function(a,b,c,d,e,f,g){switch(a){case Zarafa.core.Actions.expand:this.readAction(a,b,c,d,e,f,g)}}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.core.data.IPMResponseHandler({proxy:this,action:c,reader:f,sendRecords:d,options:k,callback:g,scope:h})},readAction:function(a,b,c,d,e,f,g){Ext.isDefined(c.start)&&(c.restriction=c.restriction||{},c.restriction.start=c.start,delete c.start);Ext.isDefined(c.limit)&&(c.restriction=c.restriction||{},c.restriction.limit=c.limit,delete c.limit);Ext.isDefined(c.sort)&&
!Array.isArray(c.sort)&&(c.sort=[{field:c.sort,direction:c.dir}],delete c.dir);Zarafa.core.data.IPMProxy.superclass.readAction.call(this,a,b,c,d,e,f,g)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMRecipientResolveProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{listModuleName:"resolvenamesmodule",getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.core.data.IPMRecipientResolveResponseHandler({proxy:this,action:Ext.data.Api.actions.read,reader:f,sendRecords:d,options:k,callback:g,scope:h})},request:function(a,b,c,d,e,f,g){switch(a){case Zarafa.core.Actions.checknames:this.readAction(a,b,c,d,e,f,g)}}});Ext.namespace("Zarafa.core.data");
Ext.data.Api.actions.open="open";
Zarafa.core.data.IPMStore=Ext.extend(Zarafa.core.data.MAPIStore,{standalone:!1,serveronly:!1,constructor:function(a){a=a||{};Ext.applyIf(a,{remoteGroup:!0});this.addEvents("beforenotify","notify");Zarafa.core.data.IPMStore.superclass.constructor.call(this,a);this.standalone||Zarafa.core.data.IPMStoreMgr.register(this,this.serveronly)},initEvents:function(){Zarafa.core.data.IPMStore.superclass.initEvents.call(this);if(!this.standalone){if(!this.serveronly)Zarafa.core.data.IPMStoreMgr.on("beforerecordsave",this.onExternalSave,
this);Zarafa.core.data.IPMStoreMgr.on("afterrecordwrite",this.onExternalWrite,this)}},getRecordsForUpdateData:function(a,b){var c={records:[],updatedRecords:[]};if(Ext.isDefined(a))if(Array.isArray(a)||(a=[a]),b===Ext.data.Api.actions.create)for(var d=0,e=a.length;d<e;d++){var f=a[d],g=this.containsFolderInLastLoad(f.get("parent_entryid"));f.store!==this&&g&&(c.records.push(f.copy()),c.updatedRecords.push(f))}else for(d=0,e=a.length;d<e;d++)f=a[d],g=this.findBy(function(a,b){if(f.equals(a))return!0}),
0>g||(g=this.getAt(g),f.store!==this&&g&&(c.records.push(g),c.updatedRecords.push(f)));return c},onExternalSave:function(a,b){var c;if(a!==this){c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.open],Ext.data.Api.actions.open);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectModified,c.records,c.updatedRecords);c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.update],Ext.data.Api.actions.update);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectModified,
c.records,c.updatedRecords);c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.create],Ext.data.Api.actions.create);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectCreated,c.records,c.updatedRecords);c=this.getRecordsForUpdateData(b[Ext.data.Api.actions.destroy],Ext.data.Api.actions.destroy);if(!Ext.isEmpty(c.records))this.onNotify(Zarafa.core.data.Notifications.objectDeleted,c.records,c.updatedRecords)}},onExternalWrite:function(a,b,c,d,e){a!==this&&(c={},Array.isArray(e)?
c[b]=e:c[b]=[e],this.onExternalSave(a,c))},containsFolderInLastLoad:function(a){if(!this.lastOptions)return!1;Array.isArray(a)||(a=[a]);var b=this.lastOptions.folder;if(Ext.isDefined(b)){Array.isArray(b)||(b=[b]);for(var c=0,d=b.length;c<d;c++)for(var e=0,f=a.length;e<f;e++)if(Zarafa.core.EntryId.compareEntryIds(b[c].get("entryid"),a[e]))return!0}return!1},onNotify:function(a,b,c,d,e){if(!1!==this.fireEvent("beforenotify",this,a,b,c,d,e)){var f=this["onNotify"+Ext.util.Format.capitalize(a)];Ext.isFunction(f)&&
f.call(this,a,b,c,d,e);!Ext.isEmpty(b)&&b[0]instanceof Ext.data.Record&&this.fireEvent("notify",this,a,b,c,d,e)}},onNotifyObjectdeleted:function(a,b,c,d,e){Array.isArray(b)||(b=[b]);a=0;for(c=b.length;a<c;a++)b[a].setEventPropagation(!1),b[a].phantom=!0;this.remove(b)},onNotifyObjectmodified:function(a,b,c,d,e){a=!1;Array.isArray(b)||(b=[b]);d=0;for(e=b.length;d<e;d++){var f=b[d],g=Array.isArray(c)?c[d]:c;f.setEventPropagation(!1);var h=f.get("message_class");if(g instanceof Ext.data.Record)h!==g.get("message_class")&&
0!==h.indexOf(g.get("message_class"))&&(a=!0),f.applyData(g),f.commit();else if(0!==Object.keys(g).length){var k=g.message_class||g.props.message_class;h!==k&&0!==h.indexOf(k)&&(a=!0);this.reader.update(f,g)}f.setEventPropagation(!0)}a&&this.reload()},onNotifyObjectcreated:function(a,b,c,d,e){(!d||this.lastExecutionTime(Zarafa.core.Actions.list)<d)&&this.reload()},destroy:function(){this.standalone||(Zarafa.core.data.IPMStoreMgr.un("afterrecordwrite",this.onExternalWrite,this),this.serveronly||Zarafa.core.data.IPMStoreMgr.un("beforerecordsave",
this.onExternalSave,this),Zarafa.core.data.IPMStoreMgr.unregister(this,this.serveronly));Zarafa.core.data.IPMStore.superclass.destroy.call(this)}});Ext.reg("zarafa.ipmstore",Zarafa.core.data.IPMStore);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.JsonAttachmentReader=Ext.extend(Zarafa.core.data.JsonReader,{constructor:function(a,b){a=Ext.applyIf(a||{},{id:"attach_id",idProperty:"attach_id"});Ext.isDefined(b)||(b=Zarafa.core.data.RecordFactory.getRecordClassByObjectType(Zarafa.core.mapi.ObjectType.MAPI_ATTACH));Zarafa.core.data.JsonAttachmentReader.superclass.constructor.call(this,a,b)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.JsonAttachmentWriter=Ext.extend(Zarafa.core.data.JsonWriter,{toPropHash:function(a){var b=a.getAttachmentStore(),c={};if(!Ext.isDefined(b))return c;c.attachments={};c.attachments.dialog_attachments=b.getId();a=b.getModifiedRecords();b=b.getRemovedRecords();Ext.each(a,function(a){a.isInline()&&(Ext.isDefined(c.attachments.add)||(c.attachments.add=[]),c.attachments.add.push(a.data))},this);Ext.each(b,function(a){a.isInline()&&(Ext.isDefined(c.attachments.remove)||(c.attachments.remove=
[]),c.attachments.remove.push(a.data))},this);return c}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.JsonRecipientWriter=Ext.extend(Zarafa.core.data.JsonWriter,{toPropHash:function(a){var b=a.getRecipientStore();a={};if(!Ext.isDefined(b))return a;var c=b.getModifiedRecords(),b=b.getRemovedRecords();if(0<c.length||0<b.length){a.recipients={};for(var d=0;d<c.length;d++){var e=c[d],f=e.data;e.isMeetingOrganizer()||(Ext.isEmpty(e.get("rowid"))?(Ext.isDefined(a.recipients.add)||(a.recipients.add=[]),a.recipients.add.push(f)):(Ext.isDefined(a.recipients.modify)||(a.recipients.modify=[]),
a.recipients.modify.push(f)))}for(d=0;d<b.length;d++)e=b[d],f=e.data,e.isMeetingOrganizer()||(Ext.isDefined(a.recipients.remove)||(a.recipients.remove=[]),a.recipients.remove.push(f))}return a}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.MAPISubStore=Ext.extend(Zarafa.core.data.NoSyncStore,{parentRecord:null,reader:void 0,writer:void 0,persistentFilter:!0,filterFn:void 0,filterScope:void 0,constructor:function(a){a=a||{};a.reader&&!a.recordType&&(a.recordType=a.reader.recordType);this.addEvents("load","datachanged");Zarafa.core.data.MAPISubStore.superclass.constructor.call(this,a)},createRecords:function(a,b,c){var d=this.getParentRecord();d&&d.afterEdit();Zarafa.core.data.MAPISubStore.superclass.createRecords.call(this,
a,b,c)},getParentRecord:function(){return this.parentRecord},setParentRecord:function(a){this.parentRecord=a},getById:function(a){var b=Zarafa.core.data.MAPISubStore.superclass.getById.call(this,a);if(!b){var c=-1;"entryid"===this.reader.meta.idProperty?c=this.findBy(function(b){return Zarafa.core.EntryId.compareEntryIds(a,b.id)}):"store_entryid"===this.reader.meta.idProperty&&(c=this.findBy(function(b){return Zarafa.core.EntryId.compareStoreEntryIds(a,b.id)}));0<=c&&(b=this.getAt(c))}return b},filterBy:Zarafa.core.data.MAPIStore.prototype.filterBy,
clearFilter:Zarafa.core.data.MAPIStore.prototype.clearFilter,loadData:function(a,b){if(Ext.isDefined(this.reader)){var c=this.reader.readRecords(a);this.loadRecords(c,{add:b},!0)}},loadRecords:function(a,b,c){if(!0!==this.isDestroyed)if(a&&!1!==c){c=a.records;a=a.totalRecords||c.length;if(b&&!0===b.add)this.totalLength=Math.max(a,this.data.length+c.length),this.add(c);else{for(var d=0,e=c.length;d<e;d++)c[d].join(this);this.snapshot&&(this.data=this.snapshot,delete this.snapshot);this.clearData();
this.data.addAll(c);this.totalLength=a;this.fireEvent("datachanged",this)}this.fireEvent("load",this,c,b);!0===this.persistentFilter&&this.filterFn&&this.filterBy(this.filterFn,this.filterScope)}else!1!==c&&this.fireEvent("load",this,[],b)},sortBy:function(a,b){this.data.sort(a,b);this.snapshot&&this.snapshot!=this.data&&this.snapshot.sort(a,b);this.fireEvent("datachanged",this)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ParalyzeReason=Zarafa.core.Enum.create({BROWSER_RELOADING:0,SESSION_EXPIRED:1,SESSION_INVALID:2});Ext.namespace("Zarafa.core.data");Zarafa.core.data.PresenceStatus=Zarafa.core.Enum.create({UNKNOWN:0,OFFLINE:1,ONLINE:2,getCssClass:function(a){a=(a=this.getName(a))?a.toLowerCase():"unknown";return"zarafa-presence-status-"+a}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ProxyResponseHandler=Ext.extend(Zarafa.core.data.AbstractResponseHandler,{proxy:void 0,reader:void 0,action:void 0,callback:void 0,scope:void 0,options:void 0,sendRecords:void 0,receivedRecords:void 0,receivedTime:void 0,metaData:void 0,responseFailure:function(a,b){Ext.isDefined(this.proxy)&&(b={error:b,sendRecords:this.sendRecords},this.proxy.fireEvent("exception",this.proxy,"response",this.action,this.options,a,b))},start:function(a,b,c,d){if(!Ext.isDefined(this.proxy))return!1;
Ext.isFunction(this.proxy.deleteRequestId)&&this.proxy.deleteRequestId(b);this.receivedRecords=[];this.receivedTime=d;Ext.isEmpty(this.sendRecords)||Array.isArray(this.sendRecords)||(this.sendRecords=[this.sendRecords]);this.metaData={}},handle:function(a,b){var c;try{c=Zarafa.core.data.ProxyResponseHandler.superclass.handle.call(this,a,b)}catch(d){this.proxy.fireEvent("exception",this.proxy,"response",this.action,this.options,b,{error:d,sendRecords:this.sendRecords}),c=!1}!1!==c&&this.proxy&&Ext.isFunction(this.proxy.updateExecutionTimestamp)&&
this.proxy.updateExecutionTimestamp(a,this.receivedTime);return c},doError:function(a){var b={sendRecords:this.sendRecords};a={error:a};this.proxy.fireEvent("exception",this.proxy,"remote",this.action,this.options,a,b);return!1},done:function(a){Ext.isFunction(this.callback)&&this.callback.call(this.scope,this.receivedRecords,this.options,a,this.metaData)},correlateRecordFromResponse:function(a){a=this.reader.readResponse(Ext.data.Api.actions.read,a);var b=this.sendRecords.clone(),c=[];if(!Ext.isEmpty(a.data)&&
!Ext.isEmpty(b))for(var d=0,e=a.data.length;d<e;d++)for(var f=0,g=b.length;f<g;f++)if(this.compareResponseDataToRecord(a.data[d],b[f])){c.push(a.data[d]);b.splice(f,1);break}return c},compareResponseDataToRecord:function(a,b){return b.phantom||Zarafa.core.EntryId.compareEntryIds(a.entryid,b.get("entryid"))},readRecordsFromResponse:function(a,b){var c=a[b]||[];Array.isArray(c)||(c=[c]);var d={count:a.page?a.page.totalrowcount:c.length};d[b]=c;return this.reader.readRecords(d)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.RecordCustomObjectType=Zarafa.core.Enum.create({BASE_TYPE:1E3});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ShadowProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{constructor:function(a){a=a||{};Ext.applyIf(a,{listModuleName:Zarafa.core.ModuleNames.getListName("IPM.Note",!0),itemModuleName:Zarafa.core.ModuleNames.getItemName("IPM.Note",!0)});Zarafa.core.data.ShadowProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){switch(Array.isArray(d)?d[0].get("object_type"):d.get("object_type")){case Zarafa.core.mapi.ObjectType.MAPI_ABCONT:case Zarafa.core.mapi.ObjectType.MAPI_MAILUSER:case Zarafa.core.mapi.ObjectType.MAPI_DISTLIST:a=
Zarafa.addressbook.AddressBookResponseHandler;break;case Zarafa.core.mapi.ObjectType.MAPI_STORE:case Zarafa.core.mapi.ObjectType.MAPI_FOLDER:a=Zarafa.hierarchy.data.HierarchyResponseHandler;break;default:a=Zarafa.core.data.IPMResponseHandler}return new a({proxy:this,action:c,reader:f,sendRecords:d,options:k,callback:g,scope:h})},getListModuleName:function(a){var b;switch(a.get("object_type")){case Zarafa.core.mapi.ObjectType.MAPI_ABCONT:case Zarafa.core.mapi.ObjectType.MAPI_MAILUSER:case Zarafa.core.mapi.ObjectType.MAPI_DISTLIST:b=
Zarafa.core.ModuleNames.getListName("addressbook");break;case Zarafa.core.mapi.ObjectType.MAPI_STORE:case Zarafa.core.mapi.ObjectType.MAPI_FOLDER:b=Zarafa.core.ModuleNames.getListName("hierarchy");break;default:a=a.get("message_class"),Ext.isEmpty(a)||(b=Zarafa.core.ModuleNames.getListName(a,!0))}return b||this.listModuleName},getItemModuleName:function(a){var b;switch(a.get("object_type")){case Zarafa.core.mapi.ObjectType.MAPI_ABCONT:case Zarafa.core.mapi.ObjectType.MAPI_MAILUSER:case Zarafa.core.mapi.ObjectType.MAPI_DISTLIST:b=
Zarafa.core.ModuleNames.getItemName("addressbook");break;case Zarafa.core.mapi.ObjectType.MAPI_STORE:case Zarafa.core.mapi.ObjectType.MAPI_FOLDER:b=Zarafa.core.ModuleNames.getListName("hierarchy");break;default:a=a.get("message_class"),Ext.isEmpty(a)||(b=Zarafa.core.ModuleNames.getItemName(a,!0))}return b||this.itemModuleName}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ShadowStore=Ext.extend(Zarafa.core.data.MAPIStore,{standalone:!1,serveronly:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{batch:!1,proxy:new Zarafa.core.data.ShadowProxy,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.core.data.JsonReader});Zarafa.core.data.ShadowStore.superclass.constructor.call(this,a);this.standalone||(Zarafa.core.data.IPMStoreMgr.register(this,this.serveronly),Zarafa.core.data.IPFStoreMgr.register(this,this.serveronly))},getRecordKey:function(a){var b;
this.eachKey(function(c,d){if(d===a)return b=c,!1});return b||[Ext.data.Record.PREFIX,"-",Ext.data.Record.AUTO_ID++].join("")},reMap:function(a){if(Array.isArray(a))for(var b=0,c=a.length;b<c;b++)this.reMap(a[b]);else delete a._phid},remove:function(a,b){if(Array.isArray(a))Ext.each(a,function(a){this.remove(a,b)},this);else{var c=this.data.indexOf(a);-1<c&&(a.join(null),this.data.removeAt(c));this.pruneModifiedRecords&&this.modified.remove(a);this.snapshot&&this.snapshot.remove(a);-1<c&&!0!==b&&
this.fireEvent("remove",this,a,c)}},removeAt:function(a,b){this.remove(this.getAt(a),b)},containsFolderInLastLoad:function(a){return!1},containsStoreInLastLoad:function(a){return!1},destroy:function(){this.standalone||(Zarafa.core.data.IPMStoreMgr.unregister(this,this.serveronly),Zarafa.core.data.IPFStoreMgr.unregister(this,this.serveronly));Zarafa.core.data.IPMStore.superclass.destroy.call(this)}});Ext.reg("zarafa.shadowstore",Zarafa.core.data.ShadowStore);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.SharedComponentType=Zarafa.core.Enum.create({"common.create":1,"common.view":2,"common.preview":3,"common.contextmenu":4,"common.search":5});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.UIFactoryBrowserWindowLayer=Ext.extend(Zarafa.core.data.UIFactoryLayer,{constructor:function(a){a=a||{};Ext.applyIf(a,{type:"separateWindows",index:20,plugins:["zarafa.contentlayerplugin"]});Zarafa.core.data.UIFactoryBrowserWindowLayer.superclass.constructor.call(this,a)},create:function(a,b){var c=Ext.id(null,"WebApp"+(new Date).getTime()),d=container.getBaseURL(),d=Ext.urlAppend(d,"load=separate_window");if(Ext.isDefined(window.deskappOpenWindow)){var e=this;window.deskappOpenWindow(d,
function(d){d&&(d.window.name=c,d.window.deskappWindow=d,e.registerNewlyCreatedWindow(d.window,a,b))})}else{var f=Zarafa.core.BrowserWindowMgr.getOpenedWindow(b.record);f?f.focus():(d=window.open(d,c,this.getBrowserWindowPosition()),this.registerNewlyCreatedWindow(d,a,b))}},registerNewlyCreatedWindow:function(a,b,c){a?Zarafa.core.BrowserWindowMgr.register(a,b,c):(Zarafa.core.BrowserWindowMgr.isPopupsBlocked=!0,Zarafa.core.BrowserWindowMgr.blockedPopupsContent.push({component:b,config:c}))},getBrowserWindowPosition:function(){var a=
Zarafa.core.BrowserWindowMgr.browserWindows,b,c;Ext.isDefined(a)&&(1===a.getCount()?(b=screen.width/2-475,c=screen.height/2-300):(a=a.last(),b=a.screenX,c=a.screenY,b+=30,c+=30));return"toolbar=no, location=no, status=1, menubar=no, scrollbars=0, resizable=1, width="+("950, height=600, top="+c+", left="+b)}});Zarafa.core.data.UIFactory.registerLayer(new Zarafa.core.data.UIFactoryBrowserWindowLayer);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.UIFactoryTabLayer=Ext.extend(Zarafa.core.data.UIFactoryLayer,{constructor:function(a){a=a||{};Ext.applyIf(a,{type:"tabs",index:1,allowModal:!1,plugins:["zarafa.contenttablayerplugin"]});Zarafa.core.data.UIFactoryTabLayer.superclass.constructor.call(this,a)},create:function(a,b){b=b||{};b.plugins=Ext.value(b.plugins,[]);b.plugins.push("zarafa.enablefocusplugin");var c=new a(b);container.getTabPanel().add(c)}});Zarafa.core.data.UIFactory.registerLayer(new Zarafa.core.data.UIFactoryTabLayer);
Ext.namespace("Zarafa.core.data");
Zarafa.core.data.UIFactoryWindowLayer=Ext.extend(Zarafa.core.data.UIFactoryLayer,{constructor:function(a){a=a||{};Ext.applyIf(a,{type:"dialogs",index:10,allowModal:!0,manager:Ext.WindowMgr,plugins:["zarafa.contentwindowlayerplugin"]});Zarafa.core.data.UIFactoryWindowLayer.superclass.constructor.call(this,a)},create:function(a,b){Ext.applyIf(b,{statefulRelativeDimensions:!1});var c=new a(b),d=container.getSettingsModel(),e=d.get("zarafa/v1/state/"+c.getStateName()+"/width");e&&1>e&&(d.remove("zarafa/v1/state/"+
c.getStateName()+"/width"),d.remove("zarafa/v1/state/"+c.getStateName()+"/height"),c=new a(b));d={modal:c.modal,manager:c.manager,iconCls:Ext.isDefined(b.iconCls)?b.iconCls:"",constrainHeader:!0,resizable:Ext.isDefined(c.resizable)?c.resizable:!0,minimizable:Ext.isDefined(c.minimizable)?c.minimizable:!1,closable:b.closable,headerCfg:{tag:"div",cls:"zarafa-window-header x-window-header x-unselectable x-window-draggable"},layout:"fit",items:[c],title:c.title,listeners:{afterrender:function(a){Ext.isDefined(a.header)&&
Ext.isElement(a.header.dom)&&Ext.DomHelper.append(a.header.dom,"<span class='fade'>&nbsp;</span>")}}};Ext.applyIf(d.listeners,b.listeners);c.closeAction&&(d.closeAction=c.closeAction,d[c.closeAction]=c[c.closeAction].createDelegate(c));c=document.activeElement;d=new Ext.Window(d);d.on("close",this.onWindowClose.createDelegate(this,[c]));d.show()},onWindowClose:function(a){a&&a.focus()}});Zarafa.core.data.UIFactory.registerLayer(new Zarafa.core.data.UIFactoryWindowLayer);Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.Access=Zarafa.core.Enum.create({ACCESS_MODIFY:1,ACCESS_READ:2,ACCESS_DELETE:4,ACCESS_CREATE_HIERARCHY:8,ACCESS_CREATE_CONTENTS:16,ACCESS_CREATE_ASSOCIATED:32});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.AppointmentAuxiliaryFlags=Zarafa.core.Enum.create({auxApptFlagCopied:1,auxApptFlagForceMtgResponse:2,auxApptFlagForwarded:4});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.AppointmentLabels=Zarafa.core.Enum.create({NONE:0,IMPORTANT:1,WORK:2,PERSONAL:3,HOLIDAY:4,REQUIRED:5,TRAVEL_REQUIRED:6,PREPARATION_REQUIRED:7,BIRTHDAY:8,SPECIAL_DATE:9,PHONE_INTERVIEW:10,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.AppointmentLabels.NONE:return _("None");case Zarafa.core.mapi.AppointmentLabels.IMPORTANT:return _("Important");case Zarafa.core.mapi.AppointmentLabels.WORK:return _("Work");case Zarafa.core.mapi.AppointmentLabels.PERSONAL:return _("Personal");
case Zarafa.core.mapi.AppointmentLabels.HOLIDAY:return _("Holiday");case Zarafa.core.mapi.AppointmentLabels.REQUIRED:return _("Required");case Zarafa.core.mapi.AppointmentLabels.TRAVEL_REQUIRED:return _("Travel Required");case Zarafa.core.mapi.AppointmentLabels.PREPARATION_REQUIRED:return _("Preparation Required");case Zarafa.core.mapi.AppointmentLabels.BIRTHDAY:return _("Birthday");case Zarafa.core.mapi.AppointmentLabels.SPECIAL_DATE:return _("Special Date");case Zarafa.core.mapi.AppointmentLabels.PHONE_INTERVIEW:return _("Phone Interview")}}});
Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.AttachMethod=Zarafa.core.Enum.create({NO_ATTACHMENT:0,ATTACH_BY_VALUE:1,ATTACH_BY_REFERENCE:2,ATTACH_BY_REF_RESOLVE:3,ATTACH_BY_REF_ONLY:4,ATTACH_EMBEDDED_MSG:5,ATTACH_OLE:6});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.BusyStatus=Zarafa.core.Enum.create({UNKNOWN:-1,FREE:0,TENTATIVE:1,BUSY:2,OUTOFOFFICE:3,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.BusyStatus.UNKNOWN:return _("Unknown");case Zarafa.core.mapi.BusyStatus.FREE:return _("Free");case Zarafa.core.mapi.BusyStatus.TENTATIVE:return _("Tentative");case Zarafa.core.mapi.BusyStatus.BUSY:return _("Busy");case Zarafa.core.mapi.BusyStatus.OUTOFOFFICE:return _("Out of Office")}}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.DisplayType=Zarafa.core.Enum.create({DT_MAILUSER:0,DT_DISTLIST:1,DT_FORUM:2,DT_AGENT:3,DT_ORGANIZATION:4,DT_PRIVATE_DISTLIST:5,DT_REMOTE_MAILUSER:6,DT_FOLDER:16777216,DT_FOLDER_LINK:33554432,DT_FOLDER_SPECIAL:67108864,DT_MODIFIABLE:65536,DT_GLOBAL:131072,DT_LOCAL:196608,DT_WAN:262144,DT_NOT_SPECIFIC:327680});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.DisplayTypeEx=Zarafa.core.Enum.create({DTE_FLAG_REMOTE_VALID:2147483648,DTE_FLAG_ACL_CAPABLE:1073741824,DTE_MASK_REMOTE:65280,DTE_MASK_LOCAL:255,DT_ROOM:7,DT_EQUIPMENT:8,DT_SEC_DISTLIST:9,DTE_IS_REMOTE_VALID:function(a){return Ext.isNumber(a)?!!(a&Zarafa.core.mapi.DisplayTypeEx.DTE_FLAG_REMOTE_VALID):!1},DTE_IS_ACL_CAPABLE:function(a){return Ext.isNumber(a)?!!(a&Zarafa.core.mapi.DisplayTypeEx.DTE_FLAG_ACL_CAPABLE):!1},DTE_REMOTE:function(a){return Ext.isNumber(a)?(a&Zarafa.core.mapi.DisplayTypeEx.DTE_MASK_REMOTE)>>
8:a},DTE_LOCAL:function(a){return Ext.isNumber(a)?a&Zarafa.core.mapi.DisplayTypeEx.DTE_MASK_LOCAL:a}});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.DistlistType=Zarafa.core.Enum.create({DL_USER:195,DL_USER2:211,DL_USER3:227,DL_EXTERNAL_MEMBER:0,DL_DIST:180,DL_USER_AB:181,DL_DIST_AB:182});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.FlagStatus=Zarafa.core.Enum.create({cleared:0,completed:1,flagged:2});
Zarafa.core.mapi.FlagIcon=Zarafa.core.Enum.create({clear:0,purple:1,orange:2,green:3,yellow:4,blue:5,red:6});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.FlavorFlags=Zarafa.core.Enum.create({FWD_PRESERVE_SENDER:1,FWD_DO_NOT_MUNGE_MSG:2,FWD_AS_ATTACHMENT:4});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.FolderExtendedFlags=Zarafa.core.Enum.create({DEFAULT:0,USE_UNREAD_COUNT:1,USE_TOTAL_COUNT:3});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.IconIndex=Zarafa.core.Enum.create({mail_stubbed:2,mail_read:256,mail_unread:257,mail_submitted:258,mail_unsent:259,mail_receipt:260,mail_replied:261,mail_forwarded:262,mail_remote:263,mail_delivery_receipt:264,mail_read_receipt:265,mail_nondelivery_receipt:266,mail_nonread_receipt:267,mail_recall_s:268,mail_recall_f:269,mail_tracking:270,mail_oof:283,mail_recall:284,mail_tracked:304,contact_user:512,contact_distlist:514,note_blue:768,note_green:769,note_pink:770,note_yellow:771,note_white:772,
appt_appointment:1024,appt_recurring:1025,appt_meeting_single:1026,appt_meeting_recurring:1027,appt_meeting_request:1028,appt_meeting_accept:1029,appt_meeting_decline:1030,appt_meeting_tentative:1031,appt_meeting_cancel:1032,appt_meeting_outofdate:1033,appt_meeting_forward:1035,task_normal:1280,task_recurring:1281,task_assignee:1282,task_assigner:1283,task_declined:1286,journal_conversation:1537,journal_document:1554,journal_email:1538,journal_fax:1545,journal_letter:1548,journal_meeting:1555,journal_meeting_cancel:1556,
journal_meeting_request:1539,journal_meeting_response:1540,journal_access:1552,journal_excel:1550,journal_powerpoint:1551,journal_word:1549,journal_note:1544,journal_phone_call:1546,journal_remote_session:1557,journal_task:1547,journal_task_request:1542,journal_task_response:1543,journal_other:3,getClassName:function(a,b){Ext.isEmpty(b)&&(b="icon");Ext.isNumber(a)||(a=parseInt(a,10));if(!Ext.isNumber(a))return"";var c=this.getName(a);return Ext.isEmpty(c)?"":b+"_"+c}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.Importance=Zarafa.core.Enum.create({NONURGENT:0,NORMAL:1,URGENT:2,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.Importance.NONURGENT:return _("Low");case Zarafa.core.mapi.Importance.NORMAL:return _("Normal");case Zarafa.core.mapi.Importance.URGENT:return _("High")}return""},getClassName:function(a,b){Ext.isEmpty(b)&&(b="icon_importance");Ext.isNumber(a)||(a=parseInt(a,10));if(!Ext.isNumber(a))return b+"_normal";var c=this.getName(a).toLowerCase();return Ext.isEmpty(c)?
b+"_normal":b+"_"+c}});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.MAPIFolderType=Zarafa.core.Enum.create({FOLDER_ROOT:0,FOLDER_GENERIC:1,FOLDER_SEARCH:2});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.MDBProvider=Zarafa.core.Enum.create({ZARAFA_SERVICE_GUID:"ca3d253c27d23c4494fe425fab958c19",ZARAFA_STORE_PUBLIC_GUID:"094a7fd4bdd33c49b2fc3c90bbcb48d4",ZARAFA_STORE_DELEGATE_GUID:"85107c7c6dbc534e9dab8a53f8def808",ZARAFA_STORE_ARCHIVER_GUID:"ad5389bc3f2e72419404896ff459870f"});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.MeetingStatus=Zarafa.core.Enum.create({NONMEETING:0,MEETING:1,MEETING_RECEIVED:3,MEETING_CANCELED:5,MEETING_RECEIVED_AND_CANCELED:7,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.MeetingStatus.MEETING:return _("Meeting");case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED:return _("Received");case Zarafa.core.mapi.MeetingStatus.MEETING_CANCELED:case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED_AND_CANCELED:return _("Canceled")}return""}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.MeetingType=Zarafa.core.Enum.create({MEETING_NONE:0,MEETING_REQUEST:1,MEETING_FULL_UPDATE:65536,MEETING_INFO_UPDATE:131072,MEETING_OUT_OF_DATE:524288,MEETING_DELEGATED:1048576});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.MessageFlags=Zarafa.core.Enum.create({MSGFLAG_READ:1,MSGFLAG_UNMODIFIED:2,MSGFLAG_SUBMIT:4,MSGFLAG_UNSENT:8,MSGFLAG_HASATTACH:16,MSGFLAG_FROMME:32,MSGFLAG_ASSOCIATED:64,MSGFLAG_RESEND:128,MSGFLAG_RN_PENDING:256,MSGFLAG_NRN_PENDING:512});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.NoteColor=Zarafa.core.Enum.create({note_blue:0,note_green:1,note_pink:2,note_yellow:3,note_white:4,getColorText:function(a){switch(parseInt(a,10)){case this.note_blue:a=_("Blue");break;case this.note_green:a=_("Green");break;case this.note_pink:a=_("Pink");break;case this.note_white:a=_("White");break;default:a=_("Yellow")}return a},getColorValue:function(a){return this[Zarafa.core.mapi.IconIndex.getName(a)]}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.ObjectType=Zarafa.core.Enum.create({MAPI_STORE:1,MAPI_ADDRBOOK:2,MAPI_FOLDER:3,MAPI_ABCONT:4,MAPI_MESSAGE:5,MAPI_MAILUSER:6,MAPI_ATTACH:7,MAPI_DISTLIST:8,MAPI_PROFSECT:9,MAPI_STATUS:10,MAPI_SESSION:11,MAPI_FORMINFO:12});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.RecipientFlags=Zarafa.core.Enum.create({recipSendable:1,recipOrganizer:2,recipExceptionalResponse:16,recipExceptionalDeleted:32,recipOriginal:256,recipReserved:512});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.RecipientTrackStatus=Zarafa.core.Enum.create({RECIPIENT_TRACKSTATUS_NONE:0,RECIPIENT_TRACKSTATUS_TENTATIVE:2,RECIPIENT_TRACKSTATUS_ACCEPTED:3,RECIPIENT_TRACKSTATUS_DECLINED:4});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.RecipientType=Zarafa.core.Enum.create({MAPI_ORIG:0,MAPI_TO:1,MAPI_CC:2,MAPI_BCC:3});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.ResponseStatus=Zarafa.core.Enum.create({RESPONSE_NONE:0,RESPONSE_ORGANIZED:1,RESPONSE_TENTATIVE:2,RESPONSE_ACCEPTED:3,RESPONSE_DECLINED:4,RESPONSE_NOT_RESPONDED:5,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED:return _("Organizer");case Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE:return _("No response");case Zarafa.core.mapi.ResponseStatus.RESPONSE_NOT_RESPONDED:return _("Not responded");case Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE:return _("Tentative");
case Zarafa.core.mapi.ResponseStatus.RESPONSE_ACCEPTED:return _("Accepted");case Zarafa.core.mapi.ResponseStatus.RESPONSE_DECLINED:return _("Declined")}return""}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.Restrictions=Zarafa.core.Enum.create({RES_AND:0,RES_OR:1,RES_NOT:2,RES_CONTENT:3,RES_PROPERTY:4,RES_COMPAREPROPS:5,RES_BITMASK:6,RES_SIZE:7,RES_EXIST:8,RES_SUBRESTRICTION:9,RES_COMMENT:10,FL_FULLSTRING:0,FL_SUBSTRING:1,FL_PREFIX:2,FL_IGNORECASE:65536,FL_IGNORENONSPACE:131072,FL_LOOSE:262144,RELOP_LT:0,RELOP_LE:1,RELOP_GT:2,RELOP_GE:3,RELOP_EQ:4,RELOP_NE:5,RELOP_RE:6,BMR_EQZ:0,BMR_NEZ:1,VALUE:0,RELOP:1,FUZZYLEVEL:2,CB:3,ULTYPE:4,ULMASK:5,ULPROPTAG:6,ULPROPTAG1:7,ULPROPTAG2:8,PROPS:9,
RESTRICTION:10});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.Rights=Zarafa.core.Enum.create({RIGHTS_NONE:0,RIGHTS_READ_ANY:1,RIGHTS_CREATE:2,RIGHTS_EDIT_OWNED:8,RIGHTS_DELETE_OWNED:16,RIGHTS_EDIT_ANY:32,RIGHTS_DELETE_ANY:64,RIGHTS_CREATE_SUBFOLDER:128,RIGHTS_FOLDER_ACCESS:256,RIGHTS_FOLDER_VISIBLE:1024});Zarafa.core.mapi.Rights.RIGHTS_NO_RIGHTS=Zarafa.core.mapi.Rights.RIGHTS_FOLDER_VISIBLE;Zarafa.core.mapi.Rights.RIGHTS_READONLY=Zarafa.core.mapi.Rights.RIGHTS_NO_RIGHTS|Zarafa.core.mapi.Rights.RIGHTS_READ_ANY;
Zarafa.core.mapi.Rights.RIGHTS_SECRETARY=Zarafa.core.mapi.Rights.RIGHTS_READONLY|Zarafa.core.mapi.Rights.RIGHTS_CREATE|Zarafa.core.mapi.Rights.RIGHTS_EDIT_OWNED|Zarafa.core.mapi.Rights.RIGHTS_DELETE_OWNED|Zarafa.core.mapi.Rights.RIGHTS_EDIT_ANY|Zarafa.core.mapi.Rights.RIGHTS_DELETE_ANY;Zarafa.core.mapi.Rights.RIGHTS_FULL_CONTROL=Zarafa.core.mapi.Rights.RIGHTS_SECRETARY|Zarafa.core.mapi.Rights.RIGHTS_CREATE_SUBFOLDER;
Zarafa.core.mapi.Rights.RIGHTS_OWNER=Zarafa.core.mapi.Rights.RIGHTS_FULL_CONTROL|Zarafa.core.mapi.Rights.RIGHTS_FOLDER_ACCESS;Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.RuleActions=Zarafa.core.Enum.create({OP_MOVE:1,OP_COPY:2,OP_REPLY:3,OP_OOF_REPLY:4,OP_DEFER_ACTION:5,OP_BOUNCE:6,OP_FORWARD:7,OP_DELEGATE:8,OP_TAG:9,OP_DELETE:10,OP_MARK_AS_READ:11});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.RuleStates=Zarafa.core.Enum.create({ST_DISABLED:0,ST_ENABLED:1,ST_ERROR:2,ST_ONLY_WHEN_OOF:4,ST_KEEP_OOF_HIST:8,ST_EXIT_LEVEL:16,ST_SKIP_IF_SCL_IS_SAFE:32,ST_RULE_PARSE_ERROR:64,ST_CLEAR_OOF_HIST:2147483648});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.Search=Zarafa.core.Enum.create({SEARCH_RUNNING:1,SEARCH_REBUILD:2,SEARCH_RECURSIVE:4,SEARCH_FOREGROUND:8,STOP_SEARCH:1,RESTART_SEARCH:2,RECURSIVE_SEARCH:4,SHALLOW_SEARCH:8,FOREGROUND_SEARCH:16,BACKGROUND_SEARCH:32,isSearchActive:function(a){Ext.isNumber(a)||(a=parseInt(a,10));return Ext.isNumber(a)?a&this.SEARCH_RUNNING?!0:!1:!1},isSearchRunning:function(a){Ext.isNumber(a)||(a=parseInt(a,10));return Ext.isNumber(a)?a&this.SEARCH_REBUILD&&a&this.SEARCH_RUNNING?!0:!1:!1}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.Sensitivity=Zarafa.core.Enum.create({NONE:0,PERSONAL:1,PRIVATE:2,COMPANY_CONFIDENTIAL:3,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.Sensitivity.NONE:return _("None");case Zarafa.core.mapi.Sensitivity.PERSONAL:return _("Personal");case Zarafa.core.mapi.Sensitivity.PRIVATE:return _("Private");case Zarafa.core.mapi.Sensitivity.COMPANY_CONFIDENTIAL:return _("Confidential")}return""}});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.StoreSupportMask=Zarafa.core.Enum.create({STORE_ANSI_OK:131072,STORE_ATTACH_OK:32,STORE_CATEGORIZE_OK:1024,STORE_CREATE_OK:16,STORE_ENTRYID_UNIQUE:1,STORE_HTML_OK:65536,STORE_LOCALSTORE:524288,STORE_MODIFY_OK:8,STORE_MV_PROPS_OK:512,STORE_NOTIFY_OK:256,STORE_OLE_OK:64,STORE_PUBLIC_FOLDERS:16384,STORE_READONLY:2,STORE_RESTRICTION_OK:4096,STORE_RTF_OK:2048,STORE_SEARCH_OK:4,STORE_SORT_OK:8192,STORE_SUBMIT_OK:128,STORE_UNCOMPRESSED_RTF:32768,STORE_UNICODE_OK:262144,hasSearchSupport:function(a){Ext.isNumber(a)||
(a=parseInt(a,10));return Ext.isNumber(a)?a&this.STORE_SEARCH_OK?!0:!1:!1}});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.TaskAcceptanceState=Zarafa.core.Enum.create({NOT_DELEGATED:0,DELEGATION_UNKNOWN:1,DELEGATION_ACCEPTED:2,DELEGATION_DECLINED:3});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.TaskHistory=Zarafa.core.Enum.create({NONE:0,ACCEPTED:1,DECLINED:2,UPDATED:3,DUEDATECHANGED:4,ASSIGNED:5});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.TaskMode=Zarafa.core.Enum.create({NOTHING:0,REQUEST:1,ACCEPT:2,DECLINE:3,UPDATE:4,SELF:5});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.TaskOwnership=Zarafa.core.Enum.create({NEWTASK:0,DELEGATEDTASK:1,OWNTASK:2});Ext.namespace("Zarafa.core.mapi");Zarafa.core.mapi.TaskState=Zarafa.core.Enum.create({NORMAL:0,OWNER_NEW:1,OWNER:2,ACCEPT:3,DECLINE:4});Ext.namespace("Zarafa.core.mapi");
Zarafa.core.mapi.TaskStatus=Zarafa.core.Enum.create({NOT_STARTED:0,IN_PROGRESS:1,COMPLETE:2,WAIT_FOR_OTHER_PERSON:3,DEFERRED:4,getDisplayName:function(a){switch(a){case Zarafa.core.mapi.TaskStatus.NOT_STARTED:return _("Not Started");case Zarafa.core.mapi.TaskStatus.IN_PROGRESS:return _("In Progress");case Zarafa.core.mapi.TaskStatus.COMPLETE:return _("Complete");case Zarafa.core.mapi.TaskStatus.WAIT_FOR_OTHER_PERSON:return _("Wait for other person");case Zarafa.core.mapi.TaskStatus.DEFERRED:return _("Deferred")}return""}});
Ext.namespace("Zarafa.core.plugins");Zarafa.core.plugins.ContentTabLayerPlugin=Ext.extend(Zarafa.core.plugins.ContentLayerPlugin,{focus:function(){container.getTabPanel().setActiveTab(this.field)}});Ext.preg("zarafa.contenttablayerplugin",Zarafa.core.plugins.ContentTabLayerPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.ContentWindowLayerPlugin=Ext.extend(Zarafa.core.plugins.ContentLayerPlugin,{win:void 0,windowRelays:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{windowRelays:["beforeshow","show","beforehide","hide"]});Zarafa.core.plugins.ContentWindowLayerPlugin.superclass.constructor.call(this,a)},initPlugin:function(){this.win=this.field.findParentByType("window");this.win.saveState=function(){this.field.saveState()}.createDelegate(this);this.field.relayEvents(this.win,this.windowRelays);
Zarafa.core.plugins.ContentWindowLayerPlugin.superclass.initPlugin.apply(this,arguments);this.win.on("render",this.applyTooltip)},applyTooltip:function(){var a=Ext.get(this.el).child(".x-tool-close",!0);a&&(a.qtip=_("Close")+" (Ctrl + Alt + W)")},setTitle:function(a){this.win.setTitle(Ext.util.Format.htmlEncode(a))},hide:function(){this.win.hide()},close:function(){this.win.close()},focus:function(){(this.win.manager||Ext.WindowMgr).bringToFront(this.win)}});
Ext.preg("zarafa.contentwindowlayerplugin",Zarafa.core.plugins.ContentWindowLayerPlugin);Ext.namespace("Zarafa.core.plugins");
Zarafa.core.plugins.FormFieldTooltipPlugin=Ext.extend(Zarafa.core.plugins.ComponentTooltipPlugin,{constructor:function(a){a=a||{};Ext.apply(this,a);Zarafa.core.plugins.FormFieldTooltipPlugin.superclass.constructor.call(this,a)},init:function(a){Zarafa.core.plugins.FormFieldTooltipPlugin.superclass.init.apply(this,arguments);this.field.on("render",this.onRenderApplyTooltip,this)},onRenderApplyTooltip:function(a){Ext.isDefined(a.tooltip)&&Ext.each(a.wrap.dom.children,function(b){b.qtip=a.tooltip})}});
Ext.preg("zarafa.formfieldtooltipplugin",Zarafa.core.plugins.FormFieldTooltipPlugin);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.ContentPanelToolbar=Ext.extend(Zarafa.core.ui.Toolbar,{insertionPointBase:void 0,actionItems:[],optionItems:[],rightAlignedItems:[],constructor:function(a){Ext.apply(this,a,{xtype:"zarafa.contentpaneltoolbar",cls:"zarafa-dialogtoolbar"});this.addEvents("window_before_pop");Zarafa.core.ui.ContentPanelToolbar.superclass.constructor.call(this,a);this.initButtonGroups()},initButtonGroups:function(){var a=this.insertionPointBase+".toolbar";this.addItems(this.actionItems,a+".actions");this.addItems(this.optionItems,
a+".options");Ext.isEmpty(this.rightAlignedItems)||(this.rightAlignedItems=["->"].concat(this.rightAlignedItems),this.addItems(this.rightAlignedItems,a+".options.right"))}});Ext.reg("zarafa.contentpaneltoolbar",Zarafa.core.ui.ContentPanelToolbar);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.ContextContainer=Ext.extend(Zarafa.core.ui.SwitchViewContentContainer,{name:void 0,title:void 0,constructor:function(a){a.name&&(this.name=a.name);var b=[],c=container.populateInsertionPoint(this.name,a.scope),d=container.getCurrentContext();Ext.each(c,function(a){var c=a.context.getName();d&&c===d.getName()&&b.push(a)},this);Ext.applyIf(a,{autoDestroy:!0,layout:"card",deferredRender:"false",hideMode:"offsets",size:"auto",border:!1,lazyItems:c,items:b,activeItem:0,forceLayout:!0});
this.addEvents("titlechange","iconchange");Zarafa.core.ui.ContextContainer.superclass.constructor.call(this,a);this.init()},init:function(){this.mon(container,"contextswitch",this.onContextSwitch,this);this.mon(container,"folderselect",this.onFolderSelect,this);var a=container.getCurrentContext().getModel(),b,c;if(a){if(a=a.getDefaultFolder())b=a.getFullyQualifiedDisplayName(),c=Zarafa.common.ui.IconClass.getIconClass(a)}else b=container.getCurrentContext().getDisplayName();this.setTitle(b);this.setIcon(c)},
setTitle:function(a){var b=this.title;this.title=a;this.fireEvent("titlechange",this,a,b)},setIcon:function(a){var b=this.iconCls;this.iconCls=a;this.fireEvent("iconchange",this,a,b)},onContextSwitch:function(a,b,c){b=this.getActiveItem();a=this.findBy(function(a){return a.context===c});var d=!0;Ext.isEmpty(a)?d=!1:(a=a[0],this.layout.setActiveItem(a.id));this.isVisible()!=d&&this.setVisible(d);!0===this.autoClean&&b&&b!=a&&(this.remove(b),delete b);b=c.getModel();var e;b&&(e=b.getDefaultFolder());
e?(b=e.getFullyQualifiedDisplayName(),e=Zarafa.common.ui.IconClass.getIconClass(e)):(b=a.title,e=a.iconCls);this.setTitle(b);this.setIcon(e)},onFolderSelect:function(a){var b;a?(b=Array.isArray(a)?a[0]:a,a=b.getFullyQualifiedDisplayName(),b=Zarafa.common.ui.IconClass.getIconClass(b)):a=container.getCurrentContext().getDisplayName();this.setTitle(a);this.setIcon(b);this.ownerCt.setActiveTab(0)}});Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MainToolbar=Ext.extend(Zarafa.core.ui.Toolbar,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.maintoolbar",id:"zarafa-maintoolbar",cls:"zarafa-maintoolbar"});Zarafa.core.ui.MainToolbar.superclass.constructor.call(this,a);this.initButtonGroups()},initButtonGroups:function(){this.addItems([],"main.toolbar.actions.first");this.addNewItems();this.addActionItems();this.addPrintButton();this.addViewItems();this.addItems([],"main.toolbar.actions.last")},addNewItems:function(){var a=
[],b=container.populateInsertionPoint("main.maintoolbar.new.item",this)||[],b=Zarafa.core.Util.sortArray(b,"ASC","newMenuIndex"),b=Zarafa.core.Util.uniqueArray(b,"text");0!==b.length&&(b[0].hidden=!0,b[0].ref="defaultButton",a.push({xtype:"menuitem",id:"zarafa-maintoolbar-newitem-defaultbutton",tooltip:b[0].tooltip,plugins:"zarafa.menuitemtooltipplugin",iconCls:b[0].iconCls,text:b[0].text,handler:b[0].handler,scope:b[0].scope},"-"));0!==b.length&&(a=a.concat(b));this.addItems({xtype:"splitbutton",
id:"zarafa-maintoolbar-newitem",cls:"zarafa-action",scale:"large",ref:"newButton",rowspan:2,menu:a,listeners:{render:this.onRenderNewButton,scope:this},iconCls:b[0]?b[0].iconCls:void 0,handler:b[0]?b[0].handler:void 0,scope:b[0]?b[0].scope:void 0})},onRenderNewButton:function(a){a.mon(container,"contextswitch",this.onNewButtonContextSwitch,this);this.onNewButtonContextSwitch(null,container.getCurrentContext(),container.getCurrentContext())},onNewButtonContextSwitch:function(a,b,c){a=this.newButton.menu;
b=a.items.itemAt(0);var d=a.defaultButton,e=a.items.indexOf(d),f=!1;if(0<=e)for(var g=a.items.length;e<g;e++){var h=a.items.itemAt(e);!1===f&&h.context==c.getName()?(f=h,h.setVisible(!1)):h.setVisible(!0)}!1===f&&d&&(f=d,d.setVisible(!1));!1!==f&&(this.newButton.setIconClass(f.iconCls),this.newButton.setHandler(f.handler,f.scope),b.tooltip=f.tooltip,b.setText(f.text),b.setIconClass(f.iconCls),b.setHandler(f.handler,f.scope))},addViewItems:function(){for(var a,b=[],c=container.getContexts(),d=0,e=
c.length;d<e;d++){var f=c[d];a=f.getMainToolbarViewButtons();if(Array.isArray(a)&&a.length)if(f.groupViewBtns)b.push({xtype:"splitbutton",id:"zarafa-maintoolbar-view-"+f.getName(),scale:"large",iconCls:"view_icon",tooltip:_("Switch view")+" (Ctrl + Alt + 1..9)",hidden:!0,contextName:f.getName(),menu:Zarafa.core.Util.uniqueArray(a,"text"),listeners:{render:this.onRenderViewButton,menuhide:this.onSwitchViewMenuHide,menushow:this.onSwitchViewMenuShow.createDelegate(this,[f],!0),scope:this}});else for(var g=
0,h=a.length;g<h;g++){var k=Ext.apply({},a[g],{xtype:"button",scale:"large",hidden:!0,contextName:f.getName()});k.tooltip=k.text+" (Ctrl + Alt + "+(g+1)+")";delete k.text;k.listeners=Zarafa.core.Util.mergeListeners(k.listeners,{render:this.onRenderViewButton});b.push(k)}}this.addItems(b)},onSwitchViewMenuHide:function(a,b){b.find().forEach(function(a){a.getEl().hasClass("x-menu-item-selected")&&a.getEl().removeClass("x-menu-item-selected")},this)},onSwitchViewMenuShow:function(a,b,c){if("note"!==
c.getName())c=b.find("valueViewMode",c.getCurrentViewMode())[0],Ext.isDefined(c)&&c.addClass("x-menu-item-selected");else{a=b.find("valueView",c.getCurrentView());var d=c.getModel().getCurrentDataMode();a.forEach(function(a){a.valueDataMode===d&&a.addClass("x-menu-item-selected")},this)}},onRenderViewButton:function(a){a.mon(container,"contextswitch",function(a,c,d){this.setVisible(this.contextName==d.getName())},a);a.setVisible(a.contextName===container.getCurrentContext().getName());if("splitbutton"===
a.xtype)a.btnEl.on("mousedown",function(){a.hasVisibleMenu()?a.hideMenu():a.showMenu()})},addPrintButton:function(){for(var a,b=[],c=container.getContexts(),d=0,e=c.length;d<e;d++){var f=c[d];a=f.getMainToolbarPrintButtons();Array.isArray(a)&&a.length&&b.push({xtype:"splitbutton",id:"zarafa-maintoolbar-print-"+f.getName(),scale:"large",iconCls:"icon_print",tooltip:_("Print")+" (Ctrl + P)",handler:a[0].handler,scope:a[0].scope,hidden:!0,contextName:f.getName(),menu:{xtype:"zarafa.conditionalmenu",
defaults:{context:f,getRecords:function(){return this.context.getModel().getSelectedRecords()}},items:Zarafa.core.Util.uniqueArray(a,"text"),onMenuHide:Ext.emptyFn},listeners:{render:this.onRenderPrintButton}})}this.addItems(b)},onRenderPrintButton:function(a){a.mon(container,"contextswitch",function(a,c,d){this.setVisible(this.contextName==d.getName())},a);a.setVisible(a.contextName===container.getCurrentContext().getName())},addActionItems:function(){var a=[{xtype:"button",id:"zarafa-maintoolbar-addressbook",
scale:"large",overflowText:_("Address Book"),tooltip:_("Address Book"),iconCls:"icon_addressbook",handler:this.onAddressBook,scope:this},{xtype:"button",id:"zarafa-maintoolbar-refresh",scale:"large",title:_("Refresh"),overflowText:_("Refresh"),tooltip:_("Refresh")+" (F5)",iconCls:"x-tbar-loading",handler:this.onRefresh,ref:"refreshButton",scope:this,listeners:{render:this.onRenderRefreshButton,scope:this}}];this.addItems(a,"main.toolbar.actions")},onAddressBook:function(){Zarafa.addressbook.Actions.openAddressBook()},
onRefresh:function(){var a=container.getCurrentContext().getModel();a&&a.reload()},onPrint:function(){var a=container.getCurrentContext();a&&Zarafa.common.Actions.openPrintDialog(a)},onRenderRefreshButton:function(a){var b=container.getCurrentContext();a.mon(container,"contextswitch",function(a,b,e){a=e.getModel().getStore();this.setVisible(Ext.isDefined(a))},a);b=b.getModel();a.setVisible(Ext.isDefined(b)&&Ext.isDefined(b.getStore()))}});Ext.reg("zarafa.maintoolbar",Zarafa.core.ui.MainToolbar);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.NavigationPanel=Ext.extend(Zarafa.core.ui.MainViewSidebar,{centerPanel:null,showFolderList:!1,constructor:function(a){this.addEvents(["toggleshowallfolders"]);a=a||{};for(var b=container.populateInsertionPoint("navigation.north",this),c=container.populateInsertionPoint("navigation.center",this),d=container.populateInsertionPoint("navigation.south",this),e=0,f=b.length;e<f;e++)b[e]=Ext.create(b[e]);e=0;for(f=c.length;e<f;e++)c[e]=Ext.create(c[e]);c.unshift(this.getAllFoldersPanel());
e=0;for(f=d.length;e<f;e++)d[e]=Ext.create(d[e]);var g=[];g.push.apply(g,b);g.push({xtype:"container",ref:"centerPanel",cls:"zarafa-navigationpanel-centerpanel",flex:1,layout:{type:"card",deferredRender:!0},activeItem:0,items:c});g.push.apply(g,d);e=0;for(f=g.length;e<f;e++)Ext.isEmpty(g[e].cls)?g[e].cls="zarafa-navigationpanel-item":g[e].cls+=" zarafa-navigationpanel-item";Ext.applyIf(a,{border:!1,layout:{type:"vbox",align:"stretch"},id:"zarafa-navigationpanel",cls:"zarafa-navigation zarafa-panel zarafa-context-mainpanel",
north:b,center:c,south:d,items:g,collapseQuickTip:_("Collapse hierarchy"),expandQuickTip:_("Expand hierarchy"),headerCfg:{cls:"zarafa-main-header x-panel-header"}});Zarafa.core.ui.NavigationPanel.superclass.constructor.call(this,a);this.showFolderList=container.getSettingsModel().get("zarafa/v1/state/sidebars/hierarchytree/showallcheckbox")||!1},getAllFoldersPanel:function(){return{xtype:"zarafa.contextnavigation",ownerTitle:_("Folders List"),cls:"zarafa-navigationpanel-centerpanel-allfolders",ref:"allFoldersPanel",
items:[{layout:"fit",cls:"zarafa-context-navigation-block",items:this.getFolderListPanel()}]}},getFolderListPanel:function(){return{xtype:"zarafa.hierarchytreepanel",enableDD:!0,ref:"../allFoldersHierarchyTree",enableItemDrop:!0,showAllFoldersDefaultValue:!0,deferredLoading:!0}},onContextSwitch:function(a,b,c){this.activeContext=c;this.toggleVisibilityNavigationComponents();this.doLayout();a=c.getDisplayName()||_("Folders List");this.setTitle(a)},toggleVisibilityNavigationComponents:function(){for(var a=
0,b=this.items.length;a<b;a++){var c=this.items.itemAt(a);c!==this.centerPanel&&(c.navigationContext&&c.navigationContext!=this.activeContext?c.setVisible(!1):c.setVisible(!0))}var d=this.centerPanel,e=d.getLayout(),f=!1;if(!this.showFolderList)for(a=0,b=d.items.length;a<b;a++)if(c=d.items.itemAt(a),c.getContext()==this.activeContext){Ext.isFunction(e.setActiveItem)?e.setActiveItem(a):d.activeItem=a;f=!0;break}f||(Ext.isFunction(e.setActiveItem)?e.setActiveItem(0):d.activeItem=0)},setShowFolderList:function(a){this.showFolderList!==
a&&(this.showFolderList=a,this.toggleVisibilityNavigationComponents(),this.doLayout(),this.fireEvent("toggleshowallfolders",this.showFolderList))},initEvents:function(){this.activeContext=container.getCurrentContext();this.mon(container,"contextswitch",this.onContextSwitch,this);this.onContextSwitch(null,this.activeContext,this.activeContext);this.on("resize",this.onResizePanel,this);Zarafa.core.ui.NavigationPanel.superclass.initEvents.apply(this,arguments)},onResizePanel:function(a,b,c,d){this.doLayout()},
saveState:function(){"settings"!==container.getCurrentContext().getName()&&Zarafa.core.ui.NavigationPanel.superclass.saveState.apply(this)}});Ext.reg("zarafa.navigationpanel",Zarafa.core.ui.NavigationPanel);Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.RecordContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{autoSave:!0,recordComponentPluginConfig:void 0,record:void 0,modalRecord:void 0,recordComponentPlugin:void 0,showLoadMask:!0,loadMask:void 0,showInfoMask:!0,savingText:{msg:_("Saving")+"..."},savingDoneText:{title:_("Saved"),msg:_("Saved successfully")},internalActions:void 0,isSaving:!1,savingEl:void 0,closeOnSave:!1,confirmClose:!1,removeRecordOnCancel:!1,showLoadMaskOnStart:!1,showModalWithoutParent:!1,unSaveWarningMessage:_("You are going to lose all unsaved changes. Are you sure you want to close this window?"),
constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Kopano Content Panel")});a.recordComponentPluginConfig&&a.recordComponentPluginConfig.allowWrite&&a.modal&&(a.recordComponentPluginConfig.useShadowStore=!0);a.confirmClose&&!container.getSettingsModel().get("zarafa/v1/main/confirm_close_dialog")&&delete a.confirmClose;a.plugins=Ext.value(a.plugins,[]);a.plugins.push(Ext.applyIf(a.recordComponentPluginConfig||{},{ptype:"zarafa.recordcomponentplugin"}));a.plugins.push({ptype:"zarafa.recordcomponentupdaterplugin"});
this.addEvents("beforesaverecord","saverecord","aftersaverecord");this.internalActions=[];Zarafa.core.ui.RecordContentPanel.superclass.constructor.call(this,a);Ext.isString(this.savingText)&&(this.savingText={title:"",msg:this.savingText});Ext.isString(this.savingDoneText)&&(this.savingDoneText={title:"",msg:this.savingDoneText});this.initEvents();this.record&&this.setRecord(this.record)},initEvents:function(){this.mon(this,{setrecord:this.onSetRecord,beforeloadrecord:this.onBeforeLoadRecord,loadrecord:this.onLoadRecord,
updaterecord:this.onUpdateRecord,writerecord:this.onWriteRecord,exceptionrecord:this.onExceptionRecord,afterlayout:this.onAfterLayout,scope:this})},displayLoadMask:function(a){!1!==this.showLoadMask&&(this.loadMask||(this.loadMask=new Zarafa.common.ui.LoadMask(this.el)),a?this.loadMask.showError():this.loadMask.show())},hideLoadMask:function(){!1!==this.showLoadMask&&this.loadMask&&this.loadMask.hide()},displayInfoMask:function(){if(!1!==this.showInfoMask){var a=this.record.modified,a=a&&1===Object.keys(a).length&&
Ext.isDefined(a.message_flags),b=this.record.getStore()===container.getShadowStore();a&&b||(this.savingEl=container.getNotifier().notify("info.saving",this.savingText.title,this.savingText.msg,{container:this.getEl()}))}},hideInfoMask:function(a){!1!==this.showInfoMask&&this.savingEl&&(container.getNotifier().notify("info.saving",null,null,{container:this.getEl(),destroy:!0,reference:this.savingEl}),delete this.savingEl,!1!==a&&container.getNotifier().notify("info.saved",this.savingDoneText.title,
this.savingDoneText.msg))},setRecord:function(a){var b;if(this.recordComponentPlugin){if(!0===this.recordComponentPlugin.allowWrite){if(!0===a.phantom&&Ext.isDefined(a.store)&&a.store.isSaving){this.el?this.displayLoadMask():this.showLoadMaskOnStart=!0;a.store.on("save",Ext.createDelegate(this.onStoreSave,this,[a]),this,{single:!0});return}this.isModal()&&!this.showModalWithoutParent&&(this.modalRecord=a,a=a.copy("modal-"+a.id),b=a.isModalDialogRecord=!0)}this.recordComponentPlugin.setRecord(a,b)}},
onStoreSave:function(a){this.showLoadMaskOnStart=!1;this.el&&this.hideLoadMask();this.setRecord(a)},saveRecord:function(a){if(!1===this.recordComponentPlugin.allowWrite||!0===this.isSaving||!1===this.fireEvent("beforesaverecord",this,this.record)||!this.record.isValid())return!1;this.fireEvent("saverecord",this,this.record);Ext.isDefined(this.modalRecord)&&this.modalRecord.applyData(this.record);!1!==a&&(a=this.modalRecord||this.record,0>a.getStore().modified.indexOf(a)?!0===this.closeOnSave&&this.close():
(a.isModified("html_body")&&a.set("isHTML",a.get("isHTML"),!0),a.save()))},deleteRecord:function(){!1!==this.recordComponentPlugin.allowWrite&&(!0===this.recordComponentPlugin.isChangedByUser?Ext.MessageBox.confirm(_("Kopano WebApp"),_("This item has been changed. Are you sure you want to delete it?"),this.onConfirmDelete,this):Zarafa.common.Actions.deleteRecords(this.modalRecord||this.record))},onConfirmDelete:function(a){"yes"===a&&Zarafa.common.Actions.deleteRecords(this.modalRecord||this.record)},
onAfterLayout:function(){!0===this.showLoadMaskOnStart&&this.displayLoadMask()},onSetRecord:function(a,b,c){b&&(this.record=b,this.mon(this.record.getStore(),"beforesave",this.onBeforeSaveRecord,this))},onBeforeLoadRecord:function(a,b){this.displayLoadMask()},onLoadRecord:function(a,b){this.hideLoadMask()},onBeforeSaveRecord:function(a,b){b&&(b.update&&0<=b.update.indexOf(this.record)||b.create&&0<=b.create.indexOf(this.record))&&(this.isSaving=!0,this.hasInternalAction()||this.displayInfoMask())},
onUpdateRecord:function(a,b,c){if(!0===this.isSaving&&b==Ext.data.Record.COMMIT&&(this.hasInternalAction()||this.hideInfoMask(!0),this.isSaving=!1,this.fireEvent("aftersaverecord",this,this.record),this.closeOnSave))return this.close(),!1},onExceptionRecord:function(a,b,c,d,e,f){this.hasInternalAction()||("open"===b?this.displayLoadMask(!0):(this.hideInfoMask(!1),this.isSaving=!1))},onOk:function(){!1!==this.saveRecord(this.autoSave)&&!0!==this.closeOnSave&&this.close()},onCancel:function(){this.removePhantomRecord();
this.close()},closeWrap:function(){this.removePhantomRecord();Zarafa.core.ui.RecordContentPanel.superclass.closeWrap.apply(this,arguments)},removePhantomRecord:function(){if(!this.removeRecordOnCancel)return!1;var a=this.modalRecord;if(a){var b=a.getStore();b&&b.remove(a)}},onWriteRecord:function(a,b,c,d,e){if(b==Ext.data.Api.actions.destroy)return this.close(),!1},doClose:function(){this.confirmClose&&!0===this.recordComponentPlugin.isChangedByUser?Ext.MessageBox.confirm(_("Kopano WebApp"),this.unSaveWarningMessage,
this.onConfirmClose,this):Zarafa.core.ui.RecordContentPanel.superclass.doClose.call(this)},onConfirmClose:function(a){"yes"===a&&(this.record.reject(),Zarafa.core.ui.RecordContentPanel.superclass.doClose.call(this))},update:Ext.emptyFn,addInternalAction:function(a){this.internalActions.push(a)},deleteInternalAction:function(a){this.internalActions.splice(this.internalActions.indexOf(a),1)},getInternalActions:function(){return this.internalActions},hasInternalAction:function(){var a=!1,b=this.record.getMessageActions(),
c=this.getInternalActions();Ext.iterate(b,function(b,e){if(-1<c.indexOf(b))return a=!0,!1},this);return a},onBeforeUnload:function(){if(!1!==this.fireEvent("beforeclose",this)&&this.recordComponentPlugin.isChangedByUser&&this.record.dirty)return this.unSaveWarningMessage}});Ext.reg("zarafa.recordcontentpanel",Zarafa.core.ui.RecordContentPanel);Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.ConsolePlugin=Ext.extend(Zarafa.core.ui.notifier.NotifyPlugin,{notify:function(a,b,c,d){console&&(b=b+": "+c,0===a.indexOf("info")?console.info(b):0===a.indexOf("warning")?console.warn(b):0===a.indexOf("error")?console.error(b):console.log(b))}});Zarafa.onReady(function(){container.getNotifier().registerPlugin("console",new Zarafa.core.ui.notifier.ConsolePlugin)});Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.MessageBoxPlugin=Ext.extend(Zarafa.core.ui.notifier.NotifyPlugin,{notify:function(a,b,c){var d;0===a.indexOf("info")?d=Ext.MessageBox.INFO:0===a.indexOf("warning")?d=Ext.MessageBox.WARNING:0===a.indexOf("error")&&(d=Ext.MessageBox.ERROR);return Ext.MessageBox.show({title:b,msg:c,icon:d,buttons:Ext.MessageBox.OK})}});Zarafa.onReady(function(){container.getNotifier().registerPlugin("messagebox",new Zarafa.core.ui.notifier.MessageBoxPlugin)});Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.NonePlugin=Ext.extend(Zarafa.core.ui.notifier.NotifyPlugin,{});Zarafa.onReady(function(){container.getNotifier().registerPlugin("none",new Zarafa.core.ui.notifier.NonePlugin)});Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.SliderNotifierPlugin=Ext.extend(Zarafa.core.ui.notifier.NotifyPlugin,{msgTemplate:new Ext.XTemplate('<div class="{categorycls} {basecls}"><div class="left"><div class="icon" ></div></div><div class="right"><h2 class="{basecls}-title">{title}</h2><div class={basecls}-message">{message}</div></div></div>'),itemCls:"zarafa-slide-notifier",categoryCls:"zarafa-slide-notifier",msgLifetime:5,sliderContainerPosition:"t",constructor:function(a){Zarafa.core.ui.notifier.SliderNotifierPlugin.superclass.constructor.call(this,
a);Ext.isString(this.msgTemplate)&&(this.msgTemplate=new Ext.XTemplate(this.msgTemplate,{compiled:!0}))},getSliderContainer:function(a,b){a=a||Ext.getBody();var c=a.id+"-"+b,d=Zarafa.core.ui.notifier.SliderNotifierPlugin.sliderContainers;d[c]&&Ext.get(d[c].container.id)?d[c].parentContainer=a:d[c]=new Zarafa.core.ui.notifier.SliderContainer({parentContainer:a,containerPosition:b,slideinDirection:b[0],slideoutDirection:b[0]});return d[c]},notify:function(a,b,c,d){d=d||{};var e=this.itemCls,f=this.categoryCls+
"-"+a.split(".")[0]+" "+this.categoryCls+"-"+a.replace(/\./g,"-");c=this.msgTemplate.apply({title:b,message:c,basecls:e,categorycls:f});e=this.getSliderContainer(d.container,this.sliderContainerPosition);if(d.reference)if(d.destroy)e.removeMessage(d.reference);else{if(d.update)return e.updateMessage(d.reference,c)}else return b=d.persistent?!1:this.msgLifetime,c=e.createMessage(c,b),!1===b||Ext.isDefined(d.listeners)&&Ext.isDefined(d.listeners.click)||(d.listeners={click:this.onNotifierClick.createDelegate(this,
[a],1),scope:this}),d.listeners&&this.addMessageListeners(c,d.listeners),c},onNotifierClick:function(a,b,c){container.getNotifier().notify(b,null,null,{container:a.slider.parentContainer,destroy:!0,reference:a})},addMessageListeners:function(a,b){for(var c in b){var d=b[c];if("scope"!==c&&Ext.isFunction(d))a.on(c,function(a,b,c){c.call(this,b,a)}.createDelegate(b.scope||a,[a,d],1))}}});Zarafa.core.ui.notifier.SliderNotifierPlugin.sliderContainers={};Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.ToolbarNotifierPlugin=Ext.extend(Zarafa.core.ui.notifier.NotifyPlugin,{notify:function(a,b,c){"info.mailsaving"!=a&&"info.mailsaved"!=a||!c.toolbar||(c.toolbar.saveMessageText||(c.toolbar.add([{xtype:"tbfill"},{xtype:"tbtext",autoWidth:!0,ref:"saveMessageText"}]),c.toolbar.doLayout()),c.toolbar.saveMessageText.setText(b));Zarafa.core.ui.notifier.ToolbarNotifierPlugin.superclass.notify.apply(this,arguments)}});
Zarafa.onReady(function(){container.getNotifier().registerPlugin("toolbarnotifierplugin",new Zarafa.core.ui.notifier.ToolbarNotifierPlugin)});Ext.namespace("Zarafa.core.ui.widget");
Zarafa.core.ui.widget.WidgetContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{widgetPanel:void 0,constructor:function(a){a=a||{};var b=new Ext.XTemplate('<tpl for=".">','<div class="zarafa-widget-item" id="{name}">','<div class="thumb-wrap">','<img src="{icon}">',"</div>","<span>{display_name}</span>","</div>","</tpl>",'<div class="x-clear"></div>'),c=[],d=container.getWidgetsMetaData();Ext.each(d,function(a){c.push({name:a.getName(),display_name:a.getDisplayName(),icon:a.getIconPath()})},this);
d={xtype:"jsonstore",fields:["name","display_name","icon"],data:c,sortInfo:{field:"display_name",direction:"ASC"}};Ext.applyIf(a,{layout:"fit",border:!1,width:400,height:300,title:_("Add widgets"),items:[{xtype:"dataview",store:d,tpl:b,autoScroll:!0,singleSelect:!0,multiSelect:!1,selectedClass:"zarafa-widgets-selectedwidget",overClass:"zarafa-widgets-hoverwidget",itemSelector:"div.zarafa-widget-item",deferEmptyText:!1,emptyText:_("No widgets installed."),listeners:{dblclick:this.onWidgetDblClick,
scope:this}}]});Zarafa.core.ui.widget.WidgetContentPanel.superclass.constructor.call(this,a)},onWidgetDblClick:function(a,b,c,d){this.widgetPanel&&this.widgetPanel.createWidget(a.getRecord(c).get("name"))}});Ext.reg("zarafa.widgetcontentpanel",Zarafa.core.ui.widget.WidgetContentPanel);Ext.namespace("Zarafa.core.ui.widget");
Zarafa.core.ui.widget.WidgetPanel=Ext.extend(Zarafa.core.ui.MainViewSidebar,{settingsPath:"",showDefaultWidgets:void 0,numColumns:3,portal:void 0,constructor:function(a){a=a||{};for(var b=[],c=a.numColumns||this.numColumns,d=0;d<c;d++)b.push(new Ext.ux.PortalColumn({columnWidth:1/c,style:"padding:10px 10px 10px 10px"}));c=[{id:"plus",scope:this,handler:function(){Zarafa.common.Actions.openWidgetsContent({widgetPanel:this,manager:Ext.WindowMgr})}}];this.portal=new Ext.ux.Portal({items:b,border:!1,
dropConfig:{ddGroup:"dd.widget"}});Ext.applyIf(a,{cls:"zarafa-widgetpanel",headerCfg:{cls:"zarafa-main-header x-panel-header"},layout:"fit",tools:c,items:[this.portal],collapseQuickTip:_("Collapse widget panel"),expandQuickTip:_("Expand widget panel")});Zarafa.core.ui.widget.WidgetPanel.superclass.constructor.call(this,a);this.loadWidgets();this.mon(this.portal,{drop:this.onDrop,scope:this})},onDrop:function(a){var b=a.panel;b.widgetPanel!=this&&(b.widgetPanel.removeGuid(b.guid),this.addGuid(b.guid),
b.widgetPanel=this);a.source.proxy.hide();b.doLayout(!0);b.columnIndex!=a.columnIndex&&b.set("columnIndex",a.columnIndex)},loadWidgets:function(){var a=container.getSettingsModel(),b=a.get(this.settingsPath+"/guids"),c=[];if(Ext.isDefined(b))Ext.isEmpty(b)||(Ext.each(b.split(/\W+/),function(b){if(!Ext.isEmpty(b)){var d=a.get(Zarafa.core.ui.widget.Widget.settingsPath(b,"__name"));if(d=container.getWidgetMetaDataByName(d)){var d=d.getInstance({widgetPanel:this,guid:b}),f=(d.get("columnIndex")||0)%this.numColumns;
this.portal.get(f).add(d);c.push(b)}else a.remove(Zarafa.core.ui.widget.Widget.settingsPath(b,""))}},this),a.set(this.settingsPath+"/guids",c.join(" ")));else if(Array.isArray(this.showDefaultWidgets))for(b=0;b<this.showDefaultWidgets.length;b++)this.createWidget(this.showDefaultWidgets[b],b%3)},addGuid:function(a){var b=container.getSettingsModel(),c=b.get(this.settingsPath+"/guids")||"";b.set(this.settingsPath+"/guids",c+((""===c?"":" ")+a))},removeGuid:function(a){var b=container.getSettingsModel(),
c=b.get(this.settingsPath+"/guids"),c=c.replace(a,""),c=c.replace(/\W+/," ");b.set(this.settingsPath+"/guids",c)},createWidget:function(a,b){var c=container.getWidgetMetaDataByName(a);Ext.isDefined(b)||(b=0);if(c){var d=Zarafa.generateId(32);this.addGuid(d);c=c.getInstance({widgetPanel:this,guid:d});c.set("__name",a);this.portal.get(b).add(c);this.doLayout()}},destroyWidget:function(a){this.removeGuid(a.guid);container.getSettingsModel().remove(Zarafa.core.ui.widget.Widget.settingsPath(a.guid,""));
a.ownerCt.remove(a,!0)}});Ext.reg("zarafa.widgetpanel",Zarafa.core.ui.widget.WidgetPanel);Ext.namespace("Zarafa.common");
Zarafa.common.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[Ext.EventObject.ZERO,Ext.EventObject.ONE,Ext.EventObject.TWO,Ext.EventObject.THREE,Ext.EventObject.FOUR,Ext.EventObject.FIVE,Ext.EventObject.SIX,Ext.EventObject.SEVEN,Ext.EventObject.EIGHT,Ext.EventObject.NINE,Ext.EventObject.NUM_ZERO,Ext.EventObject.NUM_ONE,Ext.EventObject.NUM_TWO,Ext.EventObject.NUM_THREE,Ext.EventObject.NUM_FOUR,Ext.EventObject.NUM_FIVE,Ext.EventObject.NUM_SIX,Ext.EventObject.NUM_SEVEN,Ext.EventObject.NUM_EIGHT,
Ext.EventObject.NUM_NINE],b=[{key:a,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onSwitchContexts,scope:this,settingsCfg:{description:_("Switch between different contexts e.g. inbox, calendar, etc."),category:_("Basic navigation")}}],a=[{key:a,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onSwitchViews,scope:this,settingsCfg:{description:_("Switch between different views"),category:_("Basic navigation")}},{key:Ext.EventObject.N,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewItem,
scope:this,settingsCfg:{description:_("New item"),category:_("Creating an item")}},{key:Ext.EventObject.F5,ctrl:!1,alt:!1,shift:!1,stopEvent:!0,handler:this.onRefresh,scope:this,settingsCfg:{description:_("Refresh"),category:_("All views")},basic:!0}],c=[{key:Ext.EventObject.W,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onCloseCurrentMainContentTab,scope:this,settingsCfg:{description:_("Close tab"),category:_("Basic navigation")}}],d=[{key:Ext.EventObject.P,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,
handler:this.onPrintItem,scope:this,settingsCfg:{description:_("Print item"),category:_("Items")},basic:!0}],e=[{key:Ext.EventObject.S,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onSaveTabItem,scope:this,settingsCfg:{description:_("Save an item e.g. mail, contact, etc."),category:_("Items")},basic:!0}],f=[{key:Ext.EventObject.ENTER,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onSendTabItem,scope:this,settingsCfg:{description:_("Send an item e.g. mail, meeting request, etc."),category:_("Items")},
basic:!0}],g=[{key:Ext.EventObject.A,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,enableGlobally:!0,handler:this.onSelectAll,scope:this,settingsCfg:{description:_("Select all items"),category:_("All views")},basic:!0},{key:Ext.EventObject.HOME,ctrl:!1,alt:!1,shift:!0,handler:this.onSelectUpDown,scope:this,settingsCfg:{description:_("Extend the selection to the first item in the list"),category:_("All views")}},{key:Ext.EventObject.END,ctrl:!1,alt:!1,shift:!0,handler:this.onSelectUpDown,scope:this,settingsCfg:{description:_("Extend the selection to the last item in the list"),
category:_("All views")}}],h=[{key:Ext.EventObject.ENTER,ctrl:!1,alt:!1,shift:!1,stopEvent:!0,enableGlobally:!0,handler:this.onOpenItem,scope:this,settingsCfg:{description:_("Open selected item"),category:_("All views")},basic:!0},{key:Ext.EventObject.G,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onCategorize,scope:this,settingsCfg:{description:_("Open dialog to categorize selected item"),category:_("All views")}},{key:Ext.EventObject.P,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onPrintList,
scope:this,settingsCfg:{description:_("Print list"),category:_("All views")}},{key:Ext.EventObject.P,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onPrintListItem,scope:this,settingsCfg:{description:_("Print selected item"),category:_("All views")},basic:!0},{key:Ext.EventObject.M,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onMoveItem,scope:this,settingsCfg:{description:_("Open copy/move dialog"),category:_("All views")}},{key:Ext.EventObject.DELETE,ctrl:!1,alt:!1,shift:!1,stopEvent:!0,
enableGlobally:!0,handler:this.onDeleteItem,scope:this,settingsCfg:{description:_("Delete selected item"),category:_("All views")},basic:!0},{key:Ext.EventObject.DELETE,ctrl:!1,alt:!1,shift:!0,stopEvent:!0,enableGlobally:!0,handler:this.onSoftDeleteItem,scope:this,settingsCfg:{description:_("Delete selected item without moving it to the Deleted Items folder. The deleted item can still be restored."),category:_("All views")},basic:!0}],k=[{key:Ext.EventObject.ENTER,ctrl:!1,alt:!1,shift:!1,stopEvent:!0,
enableGlobally:!0,handler:this.onOpenReminder,scope:this}];Zarafa.core.KeyMapMgr.register("global",b);Zarafa.core.KeyMapMgr.register("global",a);Zarafa.core.KeyMapMgr.register("grid",g);Zarafa.core.KeyMapMgr.register("view.mapimessage",g);Zarafa.core.KeyMapMgr.register("grid.mapimessage",h);Zarafa.core.KeyMapMgr.register("view.mapimessage",h);Zarafa.core.KeyMapMgr.register("grid.reminder",k);Zarafa.core.KeyMapMgr.register("contentpanel",c);Zarafa.core.KeyMapMgr.register("contentpanel.record",d);Zarafa.core.KeyMapMgr.register("contentpanel.record",
e);Zarafa.core.KeyMapMgr.register("contentpanel.record.message",f);Zarafa.core.KeyMapMgr.register("previewpanel.mail",d)},onNewItem:function(a,b,c){a=container.getMainPanel().mainToolbar.newButton;a.handler.call(a.scope)},onRefresh:function(a,b,c){a=container.getMainPanel().mainToolbar.refreshButton;a.isVisible()&&a.handler.call(a.scope)},onSwitchContexts:function(a,b,c){b=parseInt(b.getKeyCharCode(),10);a=container.getMainPanel().mainTabBar;(b=a.find("type","button")[b])&&b.handler&&b.handler!==
a.onLogoutButton&&b.handler.call(b.scope||b)},onSwitchViews:function(a,b,c){a=parseInt(b.getKeyCharCode(),10)-1;(a=container.getCurrentContext().getMainToolbarViewButtons()[a])&&a.handler&&a.handler.call(a.scope||a,a)},onCloseCurrentMainContentTab:function(a,b,c){if(c.closable)c[c.closeAction]()},onSendTabItem:function(a,b,c){Ext.isFunction(c.sendRecord)&&c.sendRecord()},onSaveTabItem:function(a,b,c){Ext.isFunction(c.saveRecord)&&c.saveRecord()},onPrintItem:function(a,b,c){c.record&&Zarafa.common.Actions.openPrintDialog(c.record)},
onPrintList:function(a,b,c){c.context&&Zarafa.common.Actions.openPrintDialog(c.context)},getSelectedRecords:function(a){return Ext.isFunction(a.getSelectedRecords)?a.getSelectedRecords():Ext.isFunction(a.getSelectionModel)?a.getSelectionModel().getSelections():[]},onPrintListItem:function(a,b,c){a=this.getSelectedRecords(c);Ext.isEmpty(a)||Zarafa.common.Actions.openPrintDialog(a)},onMoveItem:function(a,b,c){a=this.getSelectedRecords(c);Ext.isEmpty(a)||Zarafa.common.Actions.openCopyMoveContent(a)},
onDeleteItem:function(a,b,c){a=this.getSelectedRecords(c);Ext.isEmpty(a)||Zarafa.common.Actions.deleteRecords(a)},onSoftDeleteItem:function(a,b,c){a=this.getSelectedRecords(c);Ext.isEmpty(a)||Zarafa.common.Actions.deleteRecords(a,!1,!0)},onCategorize:function(a,b,c){a=this.getSelectedRecords(c);Ext.isEmpty(a)||Zarafa.common.Actions.openCategoriesContent(a)},onOpenItem:function(a,b,c){a=this.getSelectedRecords(c);if(!Ext.isEmpty(a))for(b=0,c=a.length;b<c;b++)a[b].isUnsent()&&!a[b].isFaultyMessage()?
Zarafa.core.data.UIFactory.openCreateRecord(a[b]):Zarafa.core.data.UIFactory.openViewRecord(a[b])},onOpenReminder:function(a,b,c){a=this.getSelectedRecords(c);if(!Ext.isEmpty(a))for(b=0,c=a.length;b<c;b++)Zarafa.common.Actions.openReminderRecord(a[b])},onSelectUpDown:function(a,b,c){var d=c.getStore();b=null;a===Ext.EventObject.HOME?b=0:a===Ext.EventObject.END&&(b=d.getCount());Ext.isFunction(c.selectRange)?(a=c.getSelectedRecords(),Ext.isEmpty(a)||c.selectRange(d.indexOf(a[0]),b)):Ext.isFunction(c.getSelectionModel)&&
(c=c.getSelectionModel(),(a=c.getSelected())&&!c.singleSelect&&(d=d.indexOf(a),c.selectRange(d,b)))},onSelectAll:function(a,b,c){Ext.isFunction(c.selectRange)?c.selectRange():Ext.isFunction(c.getSelectionModel)&&(a=c.getSelectionModel(),a.singleSelect||a.selectAll())}});Zarafa.common.KeyMapping=new Zarafa.common.KeyMapping;Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.AttachItemContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{last_selected_folder:void 0,last_selected_radio:void 0,record:void 0,editor:void 0,loadMask:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Insert item"),layout:"fit",items:[{xtype:"zarafa.attachitempanel",record:a.record,editor:a.editor}]});Zarafa.common.attachment.dialogs.AttachItemContentPanel.superclass.constructor.call(this,a)},getSelectedFolder:function(){this.last_selected_folder||
(this.last_selected_folder=container.getHierarchyStore().getDefaultFolder("inbox"));return this.last_selected_folder},getSelectedRadioItem:function(){this.last_selected_radio||(this.last_selected_radio="attachment");return this.last_selected_radio},setFolderInState:function(a){this.last_selected_folder=a;!1!==this.stateful&&this.saveState()},setRadioItemInState:function(a){this.last_selected_radio=a.inputValue;!1!==this.stateful&&this.saveState()},getState:function(){var a=Zarafa.common.attachment.dialogs.AttachItemContentPanel.superclass.getState.call(this);
this.last_selected_folder&&(a.last_selected_folder=this.last_selected_folder.get("entryid"));this.last_selected_radio&&(a.last_selected_radio=this.last_selected_radio);return a},applyState:function(a){a&&a.last_selected_folder&&(this.last_selected_folder=container.getHierarchyStore().getFolder(a.last_selected_folder),delete a.last_selected_folder);delete a.last_selected_radio;Zarafa.common.attachment.dialogs.AttachItemContentPanel.superclass.applyState.call(this,a)},showLoadMask:function(){this.loadMask||
(this.loadMask=new Zarafa.common.ui.LoadMask(this.el));this.loadMask.show()},hideLoadMask:function(){this.loadMask&&this.loadMask.hide()},getStoreByFolder:function(a){var b=container.getContextByFolder(a).getModel().getStore();b||(b=new Zarafa.mail.MailStore);return b=new b.constructor({standalone:!0,folder:a,autoDestroy:!0})},getColumnModelByFolder:function(a){return new (container.getSharedComponent(Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"],a))},getRendererByMessage:function(a){return new (container.getSharedComponent(Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"],
a))}});Ext.reg("zarafa.attachitemcontentpanel",Zarafa.common.attachment.dialogs.AttachItemContentPanel);Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.AttachItemGrid=Ext.extend(Zarafa.common.ui.grid.GridPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.attachitemgrid",border:!0,colModel:this.initColumnModel(),selModel:this.initSelectionModel(),store:new Zarafa.core.data.ListModuleStore,loadMask:!0,tbar:[{xtype:"displayfield",value:_("Items:"),hideLabel:!0},"->",{xtype:"zarafa.paging",pageSize:50,store:new Zarafa.core.data.ListModuleStore}],listeners:{reconfigure:this.onGridReconfigure,rowdblclick:this.onRowDblClick,
scope:this}});Zarafa.common.attachment.dialogs.AttachItemGrid.superclass.constructor.call(this,a)},initColumnModel:function(){return new Zarafa.common.ui.grid.ColumnModel},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!0})},onStoreLoad:function(){this.getSelectionModel().selectFirstRow()},onGridReconfigure:function(a,b,c){this.getTopToolbar().findByType("zarafa.paging")[0].bindStore(b);this.mon(b,"load",this.onStoreLoad,this)},onRowDblClick:function(a,b,c){this.ownerCt.attachItem()}});
Ext.reg("zarafa.attachitemgrid",Zarafa.common.attachment.dialogs.AttachItemGrid);Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.ImportToFolderPanel=Ext.extend(Zarafa.common.dialogs.CopyMovePanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.importtofolderpanel",buttons:[{text:_("Import"),handler:this.onImport,scope:this,ref:"../importButton",disabled:!0},{text:_("New folder"),handler:this.onCreateFolder,scope:this,ref:"../createFolderButton",disabled:!0},"->",{text:_("Cancel"),handler:this.onCancel,cls:"zarafa-normal",scope:this}]});Zarafa.common.attachment.dialogs.ImportToFolderPanel.superclass.constructor.call(this,
a)},onSelectionChange:function(a,b){!Ext.isDefined(b)||b.getFolder().isIPMSubTree()&&this.objectType==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?(this.importButton.disable(),this.createFolderButton.disable()):(this.importButton.enable(),this.createFolderButton.enable())},onImport:function(){var a=this.hierarchyTree.getSelectionModel().getSelectedNode().getFolder(),b=this.record;Ext.isDefined(a)&&!Ext.isEmpty(this.record)&&(Ext.each(b,function(b,d){b.store.importRecord(b,b.store.parentRecord,a)},this),
this.dialog.selectFolder(a),this.dialog.close())},getIPMFilter:function(a){switch(a.get("extension")){case "eml":return Zarafa.common.data.FolderContentTypes.mail;case "vcf":return Zarafa.common.data.FolderContentTypes.contact}}});Ext.reg("zarafa.importtofolderpanel",Zarafa.common.attachment.dialogs.ImportToFolderPanel);Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.MixAttachItemContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.mixattachitemcontentpanel",layout:"fit",title:_("Download as ZIP"),width:400,height:250,items:[{xtype:"zarafa.mixattachitempanel",records:a.record,ref:"mixAttachItemPanel",buttons:[{text:_("Continue"),handler:this.onContinue.createDelegate(this,[a.downloadItem],1),scope:this},{text:_("Cancel"),ref:"../../dialogCancelButton",handler:this.onCancel,
scope:this}]}]});Zarafa.common.attachment.dialogs.MixAttachItemContentPanel.superclass.constructor.call(this,a);this.mon(this.dontShowCheckBox,"check",this.onDontShowCheck,this)},onContinue:function(a,b){Ext.isEmpty(this.record)||(this.saveState(),b.call());this.close()},onCancel:function(){this.close()},onDontShowCheck:function(a,b){this.dialogCancelButton.setDisabled(b)},getState:function(){var a=Zarafa.common.attachment.dialogs.MixAttachItemContentPanel.superclass.getState.call(this)||{},b=this.dontShowCheckBox.getValue();
return Ext.apply(a,{dontshowagain:b})}});Ext.reg("zarafa.mixattachitemcontentpanel",Zarafa.common.attachment.dialogs.MixAttachItemContentPanel);Ext.namespace("Zarafa.common.attachment.ui");
Zarafa.common.attachment.ui.AttachmentBox=Ext.extend(Zarafa.common.ui.Box,{validCls:"x-zarafa-boxfield-attachment-item-uploaded",invalidCls:"x-zarafa-boxfield-attachment-item-invalid",uploadingCls:"x-zarafa-boxfield-attachment-item-uploading",constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"x-zarafa-boxfield-attachment-item",ellipsisStringStartLength:20,ellipsisStringEndLength:20,textTpl:'<tpl if="!Ext.isEmpty(values.name)">{name:htmlEncodeElide(this.ellipsisStringStartLength, this.ellipsisStringEndLength)}</tpl><tpl if="!Ext.isEmpty(values.size) && values.size &gt; 0">&nbsp;({values.size:fileSize})</tpl>'});
Zarafa.common.attachment.ui.AttachmentBox.superclass.constructor.call(this,a)},isValidRecord:function(a){return a.isUploaded()},update:function(a){Zarafa.common.attachment.ui.AttachmentBox.superclass.update.apply(this,arguments);this.isValidRecord(a)?(this.el.removeClass(this.uploadingCls),this.el.removeClass(this.invalidCls),this.el.addClass(this.validCls)):(a.attemptedToUpload()?(this.el.removeClass(this.uploadingCls),this.el.addClass(this.invalidCls)):(this.el.addClass(this.uploadingCls),this.el.removeClass(this.invalidCls)),
this.el.removeClass(this.validCls))}});Ext.reg("zarafa.attachmentbox",Zarafa.common.attachment.ui.AttachmentBox);Ext.namespace("Zarafa.common.attachment.ui");
Zarafa.common.attachment.ui.AttachmentContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());Ext.applyIf(a,{items:[this.createContextActionItems(a.records),container.populateInsertionPoint("common.contextmenu.attachment.actions",this),{xtype:"menuseparator"},container.populateInsertionPoint("common.contextmenu.attachment.options",this)],defaults:{xtype:"zarafa.conditionalitem",hideOnDisabled:!1}});
Zarafa.common.attachment.ui.AttachmentContextMenu.superclass.constructor.call(this,a)},createContextActionItems:function(a){return[{text:_("Preview"),iconCls:"icon_attachment_preview",scope:this,handler:this.onPreviewItem,beforeShow:this.onPreviewBeforeShow},{text:_("Download"),iconCls:"icon_saveaseml",scope:this,handler:this.onDownloadItem,beforeShow:this.onDownloadBeforeShow},{text:_("Download all as ZIP"),iconCls:"icon_saveemlaszip",scope:this,handler:this.onDownloadAllAsZip,beforeShow:this.onDownloadZipBeforeShow},
{text:_("Import to folder"),iconCls:"icon_import_attachment",handler:this.onImportToFolder,beforeShow:this.onImportToFolderBeforeShow,afterRender:this.onImportToFolderAfterRender,scope:this}]},onPreviewBeforeShow:function(a,b){var c=container.getSharedComponent(Zarafa.core.data.SharedComponentType["common.view"],b),c=(c=!c||c instanceof Zarafa.common.CommonContext)||b.isEmbeddedMessage();a.setDisabled(c)},onDownloadBeforeShow:function(a,b){a.setDisabled(b.isEmbeddedMessage())},onDownloadZipBeforeShow:function(a,
b){var c=0;1<b.store.getCount()&&b.store.each(function(a){a.get("hidden")||c++});a.setDisabled(b.isEmbeddedMessage()||1>=c)},onImportToFolderBeforeShow:function(a,b){a.setDisabled(b.isEmbeddedMessage()||!b.canBeImported())},onImportToFolderAfterRender:function(a){container.getServerConfig().isImportSupported()||(a=this.getEl(),a.dom.setAttribute("ext:qtip",_("In order to use the vCard import feature, upgrade your Kopano Core to version 8.3+")),a.dom.setAttribute("ext:qwidth",'ext:qwidth="100%"'))},
onPreviewItem:function(){Zarafa.core.data.UIFactory.openViewRecord(this.records)},onDownloadItem:function(){Zarafa.common.Actions.downloadAttachment(this.records)},onDownloadAllAsZip:function(){Zarafa.common.Actions.downloadAttachment(this.records,!0)},onImportToFolder:function(){Zarafa.common.Actions.importToFolder(this.records)}});Ext.reg("zarafa.attachmentcontextmenu",Zarafa.common.attachment.ui.AttachmentContextMenu);Ext.namespace("Zarafa.common.attachment.ui");
Zarafa.common.attachment.ui.AttachmentField=Ext.extend(Zarafa.common.ui.BoxField,{constructor:function(a){a=a||{};Ext.applyIf(a,{boxType:"zarafa.attachmentbox",enableComboBox:!1,height:25,boxMinHeight:25,boxMaxHeight:75});a.wrapCls=a.wrapCls?a.wrapCls+" zarafa-attachmentfield":"zarafa-attachmentfield";Zarafa.common.attachment.ui.AttachmentField.superclass.constructor.call(this,a);this.on("boxdblclick",this.onBoxDblClick,this);this.on("boxcontextmenu",this.onBoxContextMenu,this)},onRender:function(a,
b){Zarafa.common.attachment.ui.AttachmentField.superclass.onRender.apply(this,arguments);this.el.addClass("x-hidden");this.wrap.on("dragover",this.onBrowserDragOver,this);this.wrap.on("dragleave",this.onBrowserDragLeave,this);this.wrap.on("drop",this.onBrowserDrop,this)},onBrowserDragOver:function(a){this.editable&&(a.stopPropagation(),a.preventDefault(),this.wrap.addClass(this.wrapFocusClass))},onBrowserDragLeave:function(a){this.editable&&(a.stopPropagation(),a.preventDefault(),this.wrap.removeClass(this.wrapFocusClass))},
onBrowserDrop:function(a){this.editable&&(a.stopPropagation(),a.preventDefault(),this.wrap.removeClass(this.wrapFocusClass),a=a.browserEvent.target.files||a.browserEvent.dataTransfer.files,this.boxStore.canUploadFiles(a,{container:this.recordComponentUpdaterPlugin.rootContainer.getEl()})&&this.boxStore.uploadFiles(a))},setAttachmentStore:function(a){return this.setBoxStore.apply(this,arguments)},getAttachmentStore:function(){return this.getBoxStore()},update:function(a,b){a&&a instanceof Zarafa.core.data.MAPIRecord?
b&&a.isOpened()&&this.setAttachmentStore(a.getAttachmentStore()):Zarafa.common.attachment.ui.AttachmentField.superclass.update.apply(this,arguments)},filterRecord:function(a){return!0!==a.get("hidden")},onBoxDblClick:function(a,b,c){Zarafa.common.Actions.openAttachmentRecord(c)},onBoxContextMenu:function(a,b,c){Zarafa.core.data.UIFactory.openDefaultContextMenu(c,{position:b.getEl().getXY()})}});Ext.reg("zarafa.attachmentfield",Zarafa.common.attachment.ui.AttachmentField);Ext.namespace("Zarafa.common.categories.dialogs");
Zarafa.common.categories.dialogs.CategoriesContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,autoSave:!0,recordsCopied:!1,callback:Ext.emptyFn,constructor:function(a){a=a||{};Ext.isDefined(a.record)&&(Array.isArray(a.record)||(a.record=[a.record]),a.record[0].getStore()!==container.getShadowStore()&&(a.record=a.record.map(function(a){a=a.copy();container.getShadowStore().add(a);return a}),this.recordsCopied=!0));a=Ext.applyIf(a,{xtype:"zarafa.categoriescontentpanel",layout:"fit",
title:_("Manage Categories"),width:400,height:400,items:[{xtype:"zarafa.categoriespanel",record:a.record,ref:"categoriesPanel",buttons:[{text:_("Apply"),handler:this.onApply,scope:this},{text:_("New"),handler:this.onNew,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}],listeners:{destroy:this.onDestroyPanel,scope:this}});Zarafa.common.categories.dialogs.CategoriesContentPanel.superclass.constructor.call(this,a)},onApply:function(){var a=this.categoriesPanel.getSelectedCategories(),
b=a.join("; ");if(!Ext.isEmpty(this.record)){Ext.each(this.record,function(a){a.set("categories",b);a.get("label")&&a.set("label",0)},this);this.autoSave&&this.record[0].getStore().save(this.record);var c=this.categoriesPanel.categoriesGrid.getStore();a.forEach(function(a){a=c.findExactCaseInsensitive("category",a);a=c.getAt(a);Ext.isEmpty(a.get("standardIndex"))||a.get("used")||a.set("used",!0)},this);c.save();Zarafa.common.categories.Util.loadCategoriesStore();this.autoSave&&Zarafa.common.categories.Util.updateStoresAfterCategoryUpdate();
Ext.isFunction(this.callback)&&this.callback.call(this.scope||this)}this.close()},onCancel:function(){this.close()},onNew:function(){Zarafa.common.Actions.openNewCategoryContent({store:this.categoriesPanel.categoriesGrid.getStore(),grid:this.categoriesPanel.categoriesGrid})},onDestroyPanel:function(){if(this.recordsCopied){var a=container.getShadowStore();a.suspendEvents();a.remove(this.record);a.resumeEvents()}}});Ext.reg("zarafa.categoriescontentpanel",Zarafa.common.categories.dialogs.CategoriesContentPanel);
Ext.namespace("Zarafa.common.categories.dialogs");
Zarafa.common.categories.dialogs.NewCategoryPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{store:null,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.newcategorypanel",title:_("Create New Category"),cls:"k-newcategorypanel",width:250,height:120,layout:"fit",items:[{xtype:"form",border:!1,ref:"formPanel",items:[{xtype:"zarafa.compositefield",hideLabel:!0,items:[{xtype:"zarafa.colorpicker",hideLabel:!0,name:"color",ref:"../color",border:!1},{xtype:"textfield",name:"name",ref:"../name",hideLabel:!0,
anchor:"100%",flex:1,enableKeyEvents:!0,listeners:{specialkey:this.onSpecialKey,keydown:this.onKeyDown,scope:this}}]},{xtype:"checkbox",name:"pin",ref:"pin",ctCls:"k-pin-check",hideLabel:!0,boxLabel:_("Pin to quick access")}],buttons:[{text:_("Create"),handler:this.onCreate,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.common.categories.dialogs.NewCategoryPanel.superclass.constructor.call(this,a)},onSpecialKey:function(a,b){b.getKey()===b.ENTER&&(b.preventDefault(),this.onCreate())},
onKeyDown:function(a,b){var c=b.browserEvent.key;";"!==c&&","!==c||b.preventDefault()},onCreate:function(){var a=this.formPanel.name.getValue().trim();if(!Ext.isEmpty(a)&&this.canCreateNewCategory(a)){var b=new Zarafa.common.categories.data.CategoriesStore,c=this.formPanel.color.getValue(),d=this.formPanel.pin.getValue();b.addCategory(a,c,d);b.save();Ext.isDefined(this.store)&&(this.store.addCategory(a,c,d),a=this.store.findExact("category",a),this.grid.getView().focusRow(a),this.grid.getSelectionModel().selectRow(a,
!0));Zarafa.common.categories.Util.loadCategoriesStore();this.close()}},onCancel:function(){this.close()},canCreateNewCategory:function(a){var b=new Zarafa.common.categories.data.CategoriesStore,c=b.findExactCaseInsensitive("category",a);a=this.store.findExactCaseInsensitive("category",a);var d;-1!==c?-1===a?d=_("You must apply the changes you have made to the categories before you can create this category."):(b=b.getAt(c),d=String.format(_("You already have a category named '{0}'. Please use another name."),
Ext.util.Format.htmlEncode(b.get("category")))):-1!==a&&(b=this.store.getAt(a),d=String.format(_("You already have a category named '{0}' in your pending changes. Please use another name."),Ext.util.Format.htmlEncode(b.get("category"))));return Ext.isEmpty(d)?!0:(this.showErrorMessage(d),!1)},showErrorMessage:function(a){var b=Zarafa.common.dialogs.MessageBox.maxWidth;Zarafa.common.dialogs.MessageBox.maxWidth=350;Zarafa.common.dialogs.MessageBox.alert(_("Rename Category"),a,function(){Zarafa.common.dialogs.MessageBox.maxWidth=
b;this.formPanel.name.focus()},this)}});Ext.reg("zarafa.newcategorypanel",Zarafa.common.categories.dialogs.NewCategoryPanel);Ext.namespace("Zarafa.common.categories.dialogs");
Zarafa.common.categories.dialogs.RenameCategoryPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{store:null,isCategoryGrid:!1,color:void 0,categoryName:void 0,recordStore:void 0,constructor:function(a){a=a||{};Ext.isEmpty(a.store)&&(a.store=new Zarafa.common.categories.data.CategoriesStore);Ext.applyIf(a,{xtype:"zarafa.renamecategorypanel",title:_("Rename Category"),cls:"k-renamecategorypanel",width:369,height:120,layout:"fit",items:[{xtype:"form",border:!1,ref:"formPanel",items:[{xtype:"displayfield",
html:this.getDisplayText(a.categoryName),htmlEncode:!0,hideLabel:!0},{xtype:"zarafa.compositefield",hideLabel:!0,items:[{xtype:"zarafa.colorpicker",hideLabel:!0,name:"color",ref:"../color",border:!1,value:a.color},{xtype:"textfield",name:"name",ref:"../name",hideLabel:!0,anchor:"100%",selectOnFocus:!0,flex:1,value:a.categoryName,enableKeyEvents:!0,listeners:{specialkey:this.onSpecialKey,keydown:this.onKeyDown,scope:this}}]}],buttons:[{text:_("Rename"),handler:this.onRename,scope:this},{text:_("No"),
handler:this.onClickNo,scope:this}]}]});Zarafa.common.categories.dialogs.RenameCategoryPanel.superclass.constructor.call(this,a)},getDisplayText:function(a){a=String.format(_('This is the first time you have used "{0}" category.'),a);return a=a+"<BR/>"+_("Do you want to rename it?")},onSpecialKey:function(a,b){b.getKey()===b.ENTER&&(b.preventDefault(),this.onRename())},onKeyDown:function(a,b){var c=b.browserEvent.key;";"!==c&&","!==c||b.preventDefault()},findCategory:function(a){a=this.store.findExactCaseInsensitive("category",
a);return this.store.getAt(a)},onRename:function(){var a=this.formPanel.name.getValue().trim();if(!Ext.isEmpty(a)){var b=this.findCategory(a);this.formPanel.name.isDirty()&&void 0!==b?(a=String.format(_('The category "{0}" already exists. Do you want to merge the "{1}" and "{2}" categories?'),b.get("category"),this.categoryName,b.get("category")),this.showWarningMessage(a)):(b=this.findCategory(this.categoryName),this.doRenameCategory(b,a),this.close())}},onClickNo:function(){var a=this.findCategory(this.categoryName);
a.set("used",!0);a.commit();this.store.save();Zarafa.common.categories.Util.addCategory(this.records,this.categoryName,!0,this.recordStore);this.close()},showWarningMessage:function(a){Zarafa.common.dialogs.MessageBox.addCustomButtons({title:_("Categories"),msg:a,icon:Ext.MessageBox.QUESTION,fn:function(a){if("merge"===a)this.onMergeCategory();else this.formPanel.name.focus()},customButton:[{text:_("Merge"),name:"merge"},{text:_("No"),name:"no"}],scope:this})},onMergeCategory:function(){var a=this.formPanel.name.getValue().trim(),
a=this.findCategory(a);this.store.remove(a);Ext.isEmpty(a.get("standardIndex"))||container.getPersistentSettingsModel().set("kopano/main/merged_categories/"+a.get("standardIndex"),a.get("category"));var b=this.findCategory(this.categoryName);this.doRenameCategory(b,a.get("category"));this.close()},doRenameCategory:function(a,b){a.set("category",b);a.set("used",!0);this.formPanel.color.isDirty()&&a.set("color","#"+this.formPanel.color.getValue());a.commit();this.store.save();Zarafa.common.categories.Util.loadCategoriesStore();
this.isCategoryGrid||Zarafa.common.categories.Util.addCategory(this.records,b,!0,this.recordStore);Zarafa.common.categories.Util.updateStoresAfterCategoryUpdate()}});Ext.reg("zarafa.renamecategorypanel",Zarafa.common.categories.dialogs.RenameCategoryPanel);Ext.namespace("Zarafa.common.checknames.dialogs");
Zarafa.common.checknames.dialogs.CheckNamesContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{checkNamesData:void 0,record:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.checknamescontentpanel",layout:"fit",title:_("Check Names"),border:!1,width:320,height:300,items:[{xtype:"zarafa.checknamespanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.common.checknames.dialogs.CheckNamesContentPanel.superclass.constructor.call(this,
a)},onRender:function(){Zarafa.common.checknames.dialogs.CheckNamesContentPanel.superclass.onRender.apply(this,arguments);this.get(0).update(this.record,this.checkNamesData)},onOk:function(){!1!==this.get(0).updateRecord(this.record)&&this.dialog.close()},onCancel:function(){this.dialog.close()}});Ext.reg("zarafa.checknamescontentpanel",Zarafa.common.checknames.dialogs.CheckNamesContentPanel);Ext.namespace("Zarafa.common.data");Zarafa.common.data.DataModes=Zarafa.core.Enum.create({ALL:0,SEARCH:1});
Ext.namespace("Zarafa.common.data");
Zarafa.common.data.FolderContentTypes=Zarafa.core.Enum.create({mail:"IPF.NOTE",appointment:"IPF.APPOINTMENT",contact:"IPF.CONTACT",journal:"IPF.JOURNAL",note:"IPF.STICKYNOTE",task:"IPF.TASK",ipmsubtree:"IPM.SUBTREE",getContentName:function(a){switch(a.toUpperCase()){case Zarafa.common.data.FolderContentTypes.mail:return _("Mail and Post");case Zarafa.common.data.FolderContentTypes.appointment:return _("Calendar");case Zarafa.common.data.FolderContentTypes.contact:return _("Contact");case Zarafa.common.data.FolderContentTypes.journal:return _("Journal");
case Zarafa.common.data.FolderContentTypes.note:return _("Note");case Zarafa.common.data.FolderContentTypes.task:return _("Task");default:return a}},getFolderName:function(a){switch(a.toUpperCase()){case Zarafa.common.data.FolderContentTypes.mail:return _("Inbox");case Zarafa.common.data.FolderContentTypes.appointment:return _("Calendar");case Zarafa.common.data.FolderContentTypes.contact:return _("Contact");case Zarafa.common.data.FolderContentTypes.note:return _("Notes");case Zarafa.common.data.FolderContentTypes.task:return _("Task");
case Zarafa.common.data.FolderContentTypes.ipmsubtree:return _("Entire Inbox");default:return a}}});Ext.namespace("Zarafa.common.data");Zarafa.common.data.ViewModes=Zarafa.core.Enum.create({NO_PREVIEW:0,RIGHT_PREVIEW:1,BOTTOM_PREVIEW:2,SEARCH:3,LIVESCROLL:4,isMainViewMode:function(a){return a===this.NO_PREVIEW||a===this.RIGHT_PREVIEW||a===this.BOTTOM_PREVIEW}});Ext.namespace("Zarafa.common.data");Zarafa.common.data.Views=Zarafa.core.Enum.create({LIST:0,SEARCH:1,LIVESCROLL:2});Ext.namespace("Zarafa.common.delegates.data");
Zarafa.common.delegates.data.DelegateStore=Ext.extend(Zarafa.core.data.MAPIStore,{actionType:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{autoLoad:!0,batch:!1,actionType:Zarafa.core.Actions.list,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.common.delegates.data.JsonDelegateReader,proxy:new Zarafa.core.data.IPMProxy({listModuleName:Zarafa.core.ModuleNames.getListName("DELEGATES"),itemModuleName:Zarafa.core.ModuleNames.getItemName("DELEGATES")})});Zarafa.common.delegates.data.DelegateStore.superclass.constructor.call(this,
a)},load:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isDefined(a.cancelPreviousRequest)||(a.cancelPreviousRequest=!0);Ext.applyIf(a,{actionType:this.actionType});return Zarafa.common.delegates.data.DelegateStore.superclass.load.call(this,a)}});Ext.namespace("Zarafa.common.delegates.data");
Zarafa.common.delegates.data.JsonDelegateReader=Ext.extend(Zarafa.core.data.JsonReader,{constructor:function(a,b){a=a||{};Ext.applyIf(a,{id:"entryid",idProperty:"entryid",dynamicRecord:!1});Ext.isDefined(b)||(b=Zarafa.core.data.RecordFactory.getRecordClassByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DELEGATE));Zarafa.common.delegates.data.JsonDelegateReader.superclass.constructor.call(this,a,b)}});Ext.namespace("Zarafa.common.dialogs");
Zarafa.common.dialogs.CopyMoveContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,last_selected_folder:void 0,constructor:function(a){a=a||{};var b,c;if(a.record)switch(Array.isArray(a.record)||(a.record=[a.record]),c=a.record[0].get("object_type"),c){case Zarafa.core.mapi.ObjectType.MAPI_FOLDER:b=_("Copy/Move Folder");break;default:b=_("Copy/Move Messages")}Ext.applyIf(a,{xtype:"zarafa.copymovecontentpanel",useInputAutoFocusPlugin:!1,layout:"fit",title:b,width:400,height:350,cls:"copymove-panel",
items:[{xtype:"zarafa.copymovepanel",record:a.record,objectType:c}]});Zarafa.common.dialogs.CopyMoveContentPanel.superclass.constructor.call(this,a)},getSelectedFolder:function(){if(!this.last_selected_folder&&!Ext.isEmpty(this.record)){var a=container.getHierarchyStore(),b=this.record[0];b.get("container_class")?this.last_selected_folder=a.getDefaultFolderFromContainerClass(b.get("container_class")):b.get("message_class")&&(this.last_selected_folder=a.getDefaultFolderFromMessageClass(b.get("message_class")))}return this.last_selected_folder},
selectFolder:function(a){this.last_selected_folder=a;!1!==this.stateful&&this.saveState()},getState:function(){var a=Zarafa.common.dialogs.CopyMoveContentPanel.superclass.getState.call(this);this.last_selected_folder&&(a.last_selected_folder=this.last_selected_folder.get("entryid"));return a},applyState:function(a){a&&a.last_selected_folder&&(this.last_selected_folder=container.getHierarchyStore().getFolder(a.last_selected_folder),delete a.last_selected_folder);Zarafa.common.dialogs.CopyMoveContentPanel.superclass.applyState.call(this,
a)}});Ext.reg("zarafa.copymovecontentpanel",Zarafa.common.dialogs.CopyMoveContentPanel);Ext.namespace("Zarafa.common.dialogs");Zarafa.common.dialogs.CopyMovePanelKeyMapping=Ext.extend(Object,{constructor:function(){Zarafa.core.KeyMapMgr.register("Zarafa.common.dialogs.CopyMovePanel",[{key:Ext.EventObject.ENTER,ctrl:!1,alt:!1,shift:!1,stopEvent:!0,handler:this.onMoveItems,enableGlobally:!0,scope:this,basic:!0}])},onMoveItems:function(a,b,c){c.onMove()}});
Zarafa.common.dialogs.CopyMovePanelKeyMapping=new Zarafa.common.dialogs.CopyMovePanelKeyMapping;Ext.namespace("Zarafa.common.flags.dialogs");
Zarafa.common.flags.dialogs.CustomFlagContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{setFocusOnReminder:!1,constructor:function(a){a=a||{};var b=container.getShadowStore();a.record=a.record.map(function(a){a=a.copy();b.add(a);return a});a=Ext.applyIf(a,{xtype:"zarafa.customflagcontentpanel",layout:"fit",title:_("Set custom flag"),width:350,height:160,items:[{xtype:"zarafa.customflagpanel",ref:"customFlagPanel",records:a.record,buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),
handler:this.close,scope:this}]}],listeners:{afterrender:function(){this.setFocusOnReminder&&this.inputAutoFocusPlugin.setAutoFocus(this.customFlagPanel.reminderCheckbox)},scope:this}});Zarafa.common.flags.dialogs.CustomFlagContentPanel.superclass.constructor.call(this,a)},onOk:function(){var a=Zarafa.common.flags.Util.getFlagBaseProperties();delete a.reminder;var b=this.customFlagPanel.dateField.getValue();Ext.isDate(b.getStartDate())&&Ext.isDate(b.getDueDate())||(Ext.apply(a,{startdate:null,duedate:null}),
this.record[0].get("reminder")||Ext.apply(a,{reminder:!1,reminder_time:null,flag_due_by:null}));this.record.forEach(function(b){b.beginEdit();for(var c in a)b.set(c,a[c]);b.endEdit();b.save()},this);this.close()},onDestroy:function(){container.getShadowStore().remove(this.record)}});Ext.reg("zarafa.customflagcontentpanel",Zarafa.common.flags.dialogs.CustomFlagContentPanel);Ext.namespace("Zarafa.common.flags.ui");
Zarafa.common.flags.ui.FlagsMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{records:[],shadowEdit:!0,store:null,constructor:function(a){a=a||{};Array.isArray(a.records)||(a.records=[a.records]);if(!1!==a.shadowEdit){var b=container.getShadowStore();a.records=a.records.map(function(a){a=a.copy();b.add(a);return a})}Ext.applyIf(a,{xtype:"zarafa.flagsmenu",cls:"k-flags-menu",items:this.createMenuItems(),listeners:{scope:this,destroy:this.onDestroy}});Zarafa.common.flags.ui.FlagsMenu.superclass.constructor.call(this,
a)},createMenuItems:function(){return[{text:_("Today"),iconCls:"icon_mail_flag_red",action:"today",handler:this.setFlag,scope:this},{text:_("Tomorrow"),iconCls:"icon_mail_flag_orange_dark",action:"tomorrow",handler:this.setFlag,scope:this},{text:_("This week"),iconCls:"icon_mail_flag_orange",action:"this_week",handler:this.setFlag,scope:this},{text:_("Next week"),iconCls:"icon_mail_flag_yellow",action:"next_week",handler:this.setFlag,scope:this},{text:_("No date"),iconCls:"icon_mail_flag_red",action:"no_date",
handler:this.setFlag,scope:this},{xtype:"zarafa.conditionalitem",text:_("Custom"),iconCls:"icon_mail_flag_red",beforeShow:this.onFollowUpItemBeforeShow,action:"custom",handler:this.onSetCustomFlag,scope:this},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",text:_("Set reminder"),iconCls:"icon_flag_Reminder",action:"set_reminder",beforeShow:this.onFollowUpItemBeforeShow,handler:this.onSetCustomFlag,scope:this},{text:_("Complete"),iconCls:"icon_flag_complete",action:"complete",handler:this.setFlag,
scope:this},{xtype:"zarafa.conditionalitem",text:_("None"),action:"none",beforeShow:this.onFollowUpItemBeforeShow,iconCls:"icon_mail_flag",handler:this.setFlag,scope:this}]},onFollowUpItemBeforeShow:function(a,b){Array.isArray(b)||(b=[b]);var c=b.some(function(a){return a.isMessageClass("IPM.Task")});a.setDisabled(c)},onDestroy:function(){!1!==this.shadowEdit&&container.getShadowStore().remove(this.record)},onSetCustomFlag:function(a){Zarafa.common.Actions.openCustomFlagContent(this.records,{setFocusOnReminder:"set_reminder"===
a.action})},setFlag:function(a){Zarafa.common.flags.Util.updateCategories(this.records);var b=Zarafa.common.flags.Util.getFlagBaseProperties();switch(a.action){case "no_date":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesNoDate());break;case "today":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesToday());break;case "tomorrow":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesTomorrow());break;case "this_week":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesThisWeek());break;
case "next_week":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesNextWeek());break;case "complete":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesComplete());break;case "none":Ext.apply(b,Zarafa.common.flags.Util.getFlagPropertiesRemoveFlag())}this.setFlagProperties(this.records,b)},setFlagProperties:function(a,b){a.forEach(function(a){a.beginEdit();for(var c in b)a.set(c,b[c]);a.endEdit();a.save()},this)}});Ext.reg("zarafa.flagsmenu",Zarafa.common.flags.ui.FlagsMenu);Ext.namespace("Zarafa.common.freebusy.data");
Zarafa.common.freebusy.data.FreebusyBlockStore=Ext.extend(Ext.data.Store,{constructor:function(a){a=a||{};Ext.applyIf(a,{batch:!0,autoSave:!1,writer:new Ext.data.JsonWriter,remoteSort:!0,proxy:new Zarafa.common.freebusy.data.FreebusyProxy,reader:new Ext.data.JsonReader({root:"item"},Zarafa.common.freebusy.data.FreebusyBlockRecord)});Zarafa.common.freebusy.data.FreebusyBlockStore.superclass.constructor.call(this,a)}});Ext.reg("zarafa.freebusyblockstore",Zarafa.common.freebusy.data.FreebusyBlockStore);
Ext.namespace("Zarafa.common.freebusy.data");Zarafa.common.freebusy.data.FreebusyProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{constructor:function(a){a=a||{};Ext.applyIf(a,{listModuleName:Zarafa.core.ModuleNames.getListName("freebusy")});Zarafa.common.freebusy.data.FreebusyProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.common.freebusy.data.FreebusyResponseHandler({proxy:this,action:c,reader:f,options:k,callback:g,scope:h})}});
Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.FreebusyContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{editable:!0,constructor:function(a){a=a||{};var b=Ext.isDefined(a.editable)?a.editable:this.editable,c=!1,d=!1;a.records&&(Array.isArray(a.records)&&(a.records=a.records[0]),c=a.records.isMeetingOrganizer(),d=a.records.isResolved());Ext.applyIf(a,{items:[{xtype:"zarafa.conditionalitem",text:_("Edit recipient"),hidden:!b||d,handler:this.onContextMenuEditRecipientClick,scope:this},{xtype:"zarafa.conditionalitem",
text:_("Show Details"),hidden:!d,handler:this.openDetailsContent,scope:this},"-",{xtype:"zarafa.conditionalitem",text:_("Required Attendee"),iconCls:"x-freebusy-userlist-recipienttype-required",hidden:!b||c,recipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,handler:this.onRecipientTypeChange,scope:this},{xtype:"zarafa.conditionalitem",text:_("Optional Attendee"),iconCls:"x-freebusy-userlist-recipienttype-optional",hidden:!b||c,recipientType:Zarafa.core.mapi.RecipientType.MAPI_CC,handler:this.onRecipientTypeChange,
scope:this},{xtype:"zarafa.conditionalitem",text:_("Resource"),iconCls:"x-freebusy-userlist-recipienttype-resource",hidden:!b||c,recipientType:Zarafa.core.mapi.RecipientType.MAPI_BCC,handler:this.onRecipientTypeChange,scope:this},container.populateInsertionPoint("context.freebusy.userlist.contextmenu",this)]});Zarafa.common.freebusy.ui.FreebusyContextMenu.superclass.constructor.call(this,a)},onContextMenuEditRecipientClick:function(a){Zarafa.core.data.UIFactory.openCreateRecord(this.records)},openDetailsContent:function(){Zarafa.common.Actions.openViewRecipientContent(this.records)},
onRecipientTypeChange:function(a){this.records.set("recipient_type",a.recipientType)}});Ext.reg("zarafa.freebusycontextmenu",Zarafa.common.freebusy.ui.FreebusyContextMenu);Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.FreebusyTimelineBodyContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{model:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{items:container.populateInsertionPoint("context.freebusy.timelinebody.contextmenu",this)});Zarafa.common.freebusy.ui.FreebusyTimelineBodyContextMenu.superclass.constructor.call(this,a)}});Ext.reg("zarafa.freebusytimelinebodycontextmenu",Zarafa.common.freebusy.ui.FreebusyTimelineBodyContextMenu);Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.FreebusyTimelineHeaderContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{model:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{items:[{xtype:"zarafa.conditionalitem",text:_("Show non-working hours"),showNonWorkingHours:!0,hidden:a.model?!1===a.model.showOnlyWorkingHours():!1,handler:this.onHeaderContextMenuToggleNonWorkingHours,scope:this},{xtype:"zarafa.conditionalitem",text:_("Hide non-working hours"),showNonWorkingHours:!1,hidden:a.model?!0===a.model.showOnlyWorkingHours():
!1,handler:this.onHeaderContextMenuToggleNonWorkingHours,scope:this},container.populateInsertionPoint("context.freebusy.timelineheader.contextmenu",this)]});Zarafa.common.freebusy.ui.FreebusyTimelineHeaderContextMenu.superclass.constructor.call(this,a)},onHeaderContextMenuToggleNonWorkingHours:function(a){this.model.hideNonWorkingHours(!a.showNonWorkingHours)}});Ext.reg("zarafa.freebusytimelineheadercontextmenu",Zarafa.common.freebusy.ui.FreebusyTimelineHeaderContextMenu);Ext.ns("Zarafa.common.plugins");
Zarafa.common.plugins.NumberSpinner=Ext.extend(Zarafa.common.plugins.SpinnerPlugin,{allowDecimals:!0,decimalSeparator:".",decimalPrecision:2,allowNegative:!0,constructor:function(a){Ext.applyIf(this,a);Zarafa.common.plugins.NumberSpinner.superclass.constructor.call(this,a)},init:function(a){Zarafa.common.plugins.NumberSpinner.superclass.init.call(this,a);Ext.isDefined(a.defaultValue)&&Ext.isString(a.defaultValue)&&(a.defaultValue=parseFloat(a.defaultValue));Ext.isDefined(a.minValue)?Ext.isString(a.minValue)&&
(a.minValue=parseFloat(a.minValue)):a.minValue=Ext.form.NumberField.minValue;Ext.isDefined(a.maxValue)?Ext.isString(a.maxValue)&&(a.maxValue=parseFloat(a.maxValue)):a.maxValue=Ext.form.NumberField.maxValue;Ext.isDefined(a.allowDecimals)||(a.allowDecimals=this.allowDecimals);Ext.isDefined(a.decimalSeparator)||(a.decimalSeparator=this.decimalSeparator);Ext.isDefined(a.decimalPrecision)||(a.decimalPrecision=this.decimalPrecision);Ext.isDefined(a.allowNegative)||(a.allowNegative=this.allowNegative);var b=
"0123456789";a.allowDecimals&&(b+=a.decimalSeparator);a.allowNegative&&(b+="-");a.maskRe=new RegExp("["+Ext.escapeRe(b)+"]");a.value=this.floatToString(a.defaultValue);this.setStringValue=a.setValue.createDelegate(a);this.getStringValue=a.getValue.createDelegate(a);a.setValue=this.setValue.createDelegate(this);a.getValue=this.getValue.createDelegate(this)},setStringValue:Ext.emptyFn,getStringValue:Ext.emptyFn,stringToFloat:function(a){return parseFloat(a)},floatToString:function(a){if(Ext.isDefined(a))return a.toString()},
setValue:function(a){this.setStringValue(this.floatToString(this.fixBoundries(a)))},getValue:function(){var a=this.getStringValue();if(!Ext.isEmpty(a))return this.stringToFloat(a)},spin:function(a,b){if(this.field.rendered)this.field.onFocus();var c=this.field.getValue(),c=c+(a?-1:1)*(!0===b?this.field.alternateIncrementValue:this.field.incrementValue),c=isNaN(c)?this.defaultValue:c,c=this.fixBoundries(c);this.field.setValue(c)}});Ext.preg("zarafa.numberspinner",Zarafa.common.plugins.NumberSpinner);
Ext.ns("Zarafa.common.plugins");
Zarafa.common.plugins.TimeSpinner=Ext.extend(Zarafa.common.plugins.SpinnerPlugin,{format:_("G:i"),alternateIncrementField:Date.HOUR,incrementField:Date.MINUTE,constructor:function(a){Ext.applyIf(this,a);Zarafa.common.plugins.TimeSpinner.superclass.constructor.call(this,a)},init:function(a){Zarafa.common.plugins.TimeSpinner.superclass.init.call(this,a);Ext.isDefined(a.defaultValue)&&!Ext.isDate(a.defaultValue)&&(a.defaultValue=Date.parseDate(a.defaultValue,this.format));Ext.isDefined(a.minValue)&&
!Ext.isDate(a.minValue)&&(a.minValue=Date.parseDate(a.minValue,this.format));Ext.isDefined(a.maxValue)&&!Ext.isDate(a.maxValue)&&(a.maxValue=Date.parseDate(a.maxValue,this.format));this.dateValue=a.defaultValue;Ext.isDate(this.dateValue)&&(a.value=this.dateValue.format(this.format));this.setStringValue=a.setValue.createDelegate(a);this.getStringValue=a.getValue.createDelegate(a);a.setValue=this.setValue.createDelegate(this);a.getValue=this.getValue.createDelegate(this);a.isValidTimeString=this.isValidTimeString.createDelegate(this)},
setStringValue:Ext.emptyFn,getStringValue:Ext.emptyFn,setValue:function(a){if(!Ext.isDefined(a)||Ext.isEmpty(a))this.dateValue=null,this.setStringValue("");else if(Ext.isDate(a))this.dateValue=a.clone(),this.setStringValue(a.format(this.format));else if(Ext.isDate(this.dateValue)){var b=Date.parseDate(a,this.format);a=this.dateValue.clone();a.setHours(b.getHours());a.setMinutes(b.getMinutes());this.dateValue=a;this.setStringValue(a.format(this.format))}else this.dateValue=Date.parseDate(a,this.format),
this.setStringValue(a)},getValue:function(){var a=this.isValidTimeString()?this.getStringValue():this.field.value;if(Ext.isEmpty(a)||Ext.isEmpty(this.dateValue))return null;a=Date.parseDate(a,this.format);this.dateValue.setHours(a.getHours());this.dateValue.setMinutes(a.getMinutes());return this.dateValue.clone()},spin:function(a,b){var c;if(this.field.rendered)this.field.onFocus();var d=this.field.getValue(),e=!0===b?this.field.alternateIncrementValue:this.field.incrementValue,f=!0===b?this.alternateIncrementField:
this.incrementField;(c=d)&&(d=d.add(f,a?-1*e:e));!a&&d&&d<=c&&(d=d.add(Date.HOUR,2));d=Ext.isDate(d)?d:this.field.defaultValue;d=this.fixBoundries(d);this.field.setValue(d)},fixPrecision:function(a){return a},isValidTimeString:function(){return/^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$/.test(this.getStringValue())}});Ext.preg("zarafa.timespinner",Zarafa.common.plugins.TimeSpinner);Ext.namespace("Zarafa.common.printer.renderers");
Zarafa.common.printer.renderers.RecordRenderer=Ext.extend(Zarafa.common.printer.renderers.BaseRenderer,{addRow:function(a,b){var c=Ext.toArray(arguments),d;d="<tr>"+('<th valign="top">'+a+(Ext.isEmpty(a)?"":":")+"</th>");for(var e=1,f=c.length;e<f;e++)d+='<td valign="top">'+c[e]+"</td>";return d+"</tr>\n"},optionalRow:function(a,b,c){a=""+('<tpl if="!Ext.isEmpty(values.'+b+')">')+this.addRow(a,c);return a+"</tpl>"},prepareData:function(a){var b=Zarafa.common.printer.renderers.RecordRenderer.superclass.prepareData(a),
c;c=a.get("sensitivity");Ext.isEmpty(c)||0!==c||delete b.sensitivity;c=a.get("importance");Ext.isEmpty(c)||1!=c||delete b.importance;b.attachment_names=Ext.util.Format.htmlEncode(a.getAttachmentNames());return b},customStylesheetPath:"client/resources/css/external/print.record.css"});Ext.namespace("Zarafa.common.recipientfield.data");
Zarafa.common.recipientfield.data.SuggestionListProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{constructor:function(a){a=a||{};var b=Zarafa.core.ModuleNames.getModule("suggestemailaddress");Ext.applyIf(a,{listModuleName:b.list,itemModuleName:b.item});Zarafa.common.recipientfield.data.SuggestionListProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.common.recipientfield.data.SuggestionListResponseHandler({proxy:this,action:c,reader:f,
options:k,callback:g,scope:h})}});Ext.namespace("Zarafa.common.recipientfield.ui");
Zarafa.common.recipientfield.ui.EditRecipientContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,formPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Edit recipient"),layout:"fit",width:350,height:100,items:[{xtype:"form",layout:"form",border:!1,ref:"formPanel",items:[{xtype:"textfield",fieldLabel:_("Display name"),name:"display_name",anchor:"100%"},{xtype:"textfield",fieldLabel:_("E-mail address"),allowBlank:!1,vtype:"email",name:"smtp_address",anchor:"100%"}],
buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.common.recipientfield.ui.EditRecipientContentPanel.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterFirstLayout,this,{single:!0})},onAfterFirstLayout:function(){this.formPanel.getForm().loadRecord(this.record)},onOk:function(){this.formPanel.getForm().updateRecord(this.record);this.close()},onCancel:function(){this.close()}});
Ext.reg("zarafa.editrecipientcontentpanel",Zarafa.common.recipientfield.ui.EditRecipientContentPanel);Ext.namespace("Zarafa.common.recipientfield.ui");
Zarafa.common.recipientfield.ui.RecipientBox=Ext.extend(Zarafa.common.ui.Box,{validCls:"x-zarafa-boxfield-recipient-item-resolved",ambiguousCls:"x-zarafa-boxfield-recipient-item-ambiguous",pendingCls:"x-zarafa-boxfield-recipient-item-pending",invalidCls:"x-zarafa-boxfield-recipient-item-invalid",expandBtnEl:void 0,expandBtnCls:"x-zarafa-boxfield-item-expand",expandBtnHoverCls:"x-zarafa-boxfield-item-expand-hover",constructor:function(a){a=a||{};Ext.applyIf(a,{cls:"x-zarafa-boxfield-recipient-item",
textTpl:'<tpl if="!Ext.isEmpty(values.display_name)">{display_name:htmlEncodeElide(this.ellipsisStringStartLength, this.ellipsisStringEndLength)}</tpl>'});Zarafa.common.recipientfield.ui.RecipientBox.superclass.constructor.call(this,a)},renderButtons:function(){Zarafa.common.recipientfield.ui.RecipientBox.superclass.renderButtons.apply(this,arguments);this.record.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&this.renderExpandButton()},afterRender:function(a){Zarafa.common.recipientfield.ui.RecipientBox.superclass.afterRender.call(this,
a);Ext.isDefined(this.expandBtnEl)&&this.expandBtnEl.setVisible(this.editable)},setEditable:function(a){Zarafa.common.recipientfield.ui.RecipientBox.superclass.setEditable.call(this,a);Ext.isDefined(this.expandBtnEl)&&this.expandBtnEl.setVisible(this.editable)},renderExpandButton:function(){this.expandBtnEl=this.el.insertFirst({tag:"span",cls:this.expandBtnCls});this.expandBtnEl.addClassOnOver(this.expandBtnHoverCls);this.mon(this.expandBtnEl,"click",this.onClickExpand,this)},onClickExpand:function(){Ext.MessageBox.show({title:_("Kopano WebApp"),
msg:_("Distribution list will be replaced with its members. You will not be able to collapse it again."),icon:Ext.MessageBox.WARNING,record:this.record,fn:this.doExpand,scope:this,buttons:Ext.MessageBox.OKCANCEL})},doExpand:function(a,b){"ok"==a&&(this.parent.getBoxStore().expand(this.record),Zarafa.common.recipientfield.ui.RecipientBox.superclass.onClickRemove.apply(this,arguments))},prepareData:function(a){var b={};b.display_name=a.get("display_name");b.smtp_address=a.get("smtp_address")||a.get("email_address");
b.object_type=a.get("object_type");b.entryid=a.get("entryid");return b},prepareIcon:function(a){if(a.isResolved()||a.attemptedToResolve()&&a.isValidSMTP())return Zarafa.common.recipientfield.ui.RecipientBox.superclass.prepareIcon.apply(this,arguments)},isValidRecord:function(a){return a.isResolved()||a.attemptedToResolve()&&a.isValidSMTP()},update:function(a){Zarafa.common.recipientfield.ui.RecipientBox.superclass.update.apply(this,arguments);this.isValidRecord(a)?(this.el.removeClass(this.invalidCls),
this.el.removeClass(this.pendingCls),this.el.removeClass(this.ambiguousCls),this.el.addClass(this.validCls)):(a.isAmbiguous()?(this.el.removeClass(this.invalidCls),this.el.removeClass(this.pendingCls),this.el.addClass(this.ambiguousCls)):(a.isResolved()||a.attemptedToResolve()||!a.dirty?(this.el.addClass(this.invalidCls),this.el.removeClass(this.pendingCls)):(this.el.removeClass(this.invalidCls),this.el.addClass(this.pendingCls)),this.el.removeClass(this.ambiguousCls)),this.el.removeClass(this.validCls));
this.record.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&(!0!==this.enableButtons||Ext.isDefined(this.expandBtnEl)||this.renderExpandButton())}});Ext.reg("zarafa.recipientbox",Zarafa.common.recipientfield.ui.RecipientBox);Ext.namespace("Zarafa.common.recipientfield.ui");
Zarafa.common.recipientfield.ui.RecipientContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{editable:!0,constructor:function(a){a=a||{};var b=Ext.isDefined(a.editable)?a.editable:this.editable,c=!1;a.records&&(Array.isArray(a.records)&&(a.records=a.records[0]),c=a.records.isResolved());Ext.applyIf(a,{items:[{xtype:"zarafa.conditionalitem",text:_("Edit Recipient"),iconCls:"icon_edit_recipient",hidden:!b||c,handler:this.editRecipient,scope:this},{xtype:"zarafa.conditionalitem",text:_("Show Details"),
iconCls:"icon_contact",hidden:!c,handler:this.openDetailsContent,scope:this},{xtype:"zarafa.conditionalitem",text:_("Copy e-mail address"),iconCls:"icon_copy",hidden:!c,handler:this.copyEmail,scope:this},{xtype:"zarafa.conditionalitem",text:_("Send e-mail"),iconCls:"icon_send_email_to_recipient",handler:this.emailRecipient,scope:this},container.populateInsertionPoint("context.common.recipientfield.contextmenu.actions",this),{xtype:"menuseparator"}]});Zarafa.common.recipientfield.ui.RecipientContextMenu.superclass.constructor.call(this,
a)},editRecipient:function(){Zarafa.core.data.UIFactory.openCreateRecord(this.records,{manager:Ext.WindowMgr})},openDetailsContent:function(){Zarafa.common.Actions.openViewRecipientContent(this.records)},copyEmail:function(){Zarafa.common.Actions.copyEmailAddress(this.records)},emailRecipient:function(){var a=container.getHierarchyStore().getDefaultFolder("drafts"),a=container.getContextByFolder(a).getModel().createRecord(a),b=a.getRecipientStore(),c=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
this.records.data);c.set("recipient_type",Zarafa.core.mapi.RecipientType.MAPI_TO);b.add(c);Zarafa.core.data.UIFactory.openCreateRecord(a)}});Ext.reg("zarafa.recipientcontextmenu",Zarafa.common.recipientfield.ui.RecipientContextMenu);Ext.namespace("Zarafa.common.recipientfield.ui");
Zarafa.common.recipientfield.ui.RecipientDropZone=Ext.extend(Zarafa.common.ui.BoxFieldDropZone,{onNodeDrop:function(a,b,c,d){if(!this.isValidDropPoint(a,b,c,d))return!1;if(b.field.boxStore!==this.field.boxStore)b.field.boxStore.remove(d.draggedRecord),this.field.defaultRecipientType&&d.draggedRecord.set("recipient_type",this.field.defaultRecipientType),this.field.boxStore.add(d.draggedRecord);else{if(d.draggedRecord.get("recipient_type")===this.field.defaultRecipientType)return!1;d.draggedRecord.set("recipient_type",
this.field.defaultRecipientType)}return!0},onNodeOver:function(a,b,c,d){return this.isValidDropPoint(a,b,c,d)?Ext.dd.DropZone.prototype.dropAllowed:Ext.dd.DropZone.prototype.dropNotAllowed},isValidDropPoint:function(a,b,c,d){return!this.field.boxLimit||this.field.items.getCount()<this.field.boxLimit}});Ext.reg("zarafa.recipientdropzone",Zarafa.common.recipientfield.ui.RecipientDropZone);Ext.namespace("Zarafa.common.recipientfield.ui");
Zarafa.common.recipientfield.ui.ViewRecipientContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,formPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("View recipient"),layout:"fit",width:350,height:100,items:[{xtype:"form",layout:"form",border:!1,bodyStyle:"padding: 5px; background-color: inherit;",ref:"formPanel",items:[{xtype:"textfield",fieldLabel:_("Display name"),name:"display_name",anchor:"100%",readOnly:!0},{xtype:"textfield",fieldLabel:_("E-mail address"),
name:"smtp_address",anchor:"100%",readOnly:!0}],buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.common.recipientfield.ui.ViewRecipientContentPanel.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterFirstLayout,this,{single:!0})},onAfterFirstLayout:function(){this.formPanel.getForm().loadRecord(this.record)},onOk:function(){this.close()},onCancel:function(){this.close()}});
Ext.reg("zarafa.viewrecipientcontentpanel",Zarafa.common.recipientfield.ui.ViewRecipientContentPanel);Ext.namespace("Zarafa.common.recurrence.data");Zarafa.common.recurrence.data.RecurrenceEnd=Zarafa.core.Enum.create({NEVER:35,N_OCCURENCES:34,ON_DATE:33});Ext.namespace("Zarafa.common.recurrence.data");
Zarafa.common.recurrence.data.RecurrenceSubtype=Zarafa.core.Enum.create({DAILY_EVERY_N_DAYS:{type:0,regen:0},DAILY_WEEKDAYS:{type:1,regen:0},DAILY_REGENERATE:{type:0,regen:1},WEEKLY_REGENERATE:{type:0,regen:1},WEEKLY:{type:1,regen:0},MONTHLY_N_DAY_OF_MONTH:{type:2,regen:0},MONTHLY_N_WEEKDAY_OF_MONTH:{type:3,regen:0},MONTHLY_REGENERATE:{type:2,regen:1},YEARLY_MONTH:{type:2,regen:0},YEARLY_N_WEEKDAY:{type:3,regen:0},YEARLY_REGENERATE:{type:2,regen:1}});Ext.namespace("Zarafa.common.recurrence.data");
Zarafa.common.recurrence.data.RecurrenceType=Zarafa.core.Enum.create({NONE:0,DAILY:10,WEEKLY:11,MONTHLY:12,YEARLY:13});Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.DailyPanel=Ext.extend(Zarafa.common.recurrence.dialogs.RecurrenceSubPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.recurrencedailypanel",recurrenceType:Zarafa.common.recurrence.data.RecurrenceType.DAILY,recurrenceSubtypes:[Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_EVERY_N_DAYS,Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_WEEKDAYS,Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_REGENERATE],defaults:{border:!1,bodyStyle:"background-color: inherit;",
height:25},items:[this.createEveryNDaysPanel(),this.createEveryWeekdayPanel(),this.createRegeneratePanel()]});Zarafa.common.recurrence.dialogs.DailyPanel.superclass.constructor.call(this,a)},createEveryNDaysPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"daily_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_EVERY_N_DAYS,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],
fieldLabel:_("Every {A} day(s)"),labelWidth:100,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../everyNDaysSpinner",name:"recurrence_everyn",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onEveryNDaysChange,scope:this}}]}]}},createEveryWeekdayPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"daily_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_WEEKDAYS,hideLabel:!0,
width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"displayfield",value:_("Every weekday"),hideLabel:!0}]}},createRegeneratePanel:function(){return{xtype:"panel",layout:"column",ref:"regeneratePanel",items:[{xtype:"radio",name:"daily_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_REGENERATE,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Regenerate new task {A} day(s) after each task is completed"),
labelWidth:400,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../regenNDaysSpinner",name:"recurrence_everyn",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onDailyRegenerateChange,scope:this}}]}]}},onEveryNDaysChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_EVERY_N_DAYS,a,1440*b)},onDailyRegenerateChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.DAILY_REGENERATE,
a,1440*b)},updateEveryNDaysValues:function(a,b){var c=b?1:Math.floor(a.get("recurrence_everyn")/1440);this.everyNDaysSpinner.setValue(c)},updateRegenerateValues:function(a,b){var c=b?1:Math.floor(a.get("recurrence_everyn")/1440);this.regenNDaysSpinner.setValue(c)},updateUI:function(a,b){var c=!1;if(!0===b||a.isModifiedSinceLastUpdate("message_class"))a.isMessageClass("IPM.TaskRequest",!0)?this.regeneratePanel.show():this.regeneratePanel.hide(),c=!0;c&&this.doLayout()},updateSubtype:function(a,b,c){var d=
Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(d.DAILY_EVERY_N_DAYS,b)?this.updateEveryNDaysValues(a,c):this.isSubtype(d.DAILY_REGENERATE,b)&&this.updateRegenerateValues(a,c)},updateRecordSubType:function(a,b){var c=Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(c.DAILY_EVERY_N_DAYS,b)?a.set("recurrence_everyn",1440*this.everyNDaysSpinner.getValue()):this.isSubtype(c.DAILY_WEEKDAYS,b)?a.set("recurrence_everyn",1):this.isSubtype(c.DAILY_REGENERATE,b)&&a.set("recurrence_everyn",
1440*this.regenNDaysSpinner.getValue());a.set("recurrence_weekdays",void 0);a.set("recurrence_month",void 0);a.set("recurrence_monthday",void 0);a.set("recurrence_nday",void 0)}});Ext.reg("zarafa.recurrencedailypanel",Zarafa.common.recurrence.dialogs.DailyPanel);Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.MonthlyPanel=Ext.extend(Zarafa.common.recurrence.dialogs.RecurrenceSubPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.recurrencemonthlypanel",recurrenceType:Zarafa.common.recurrence.data.RecurrenceType.MONTHLY,recurrenceSubtypes:[Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_N_DAY_OF_MONTH,Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_N_WEEKDAY_OF_MONTH,Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_REGENERATE],defaults:{border:!1,
bodyStyle:"background-color: inherit;",height:25},items:[this.createEveryNDayOfMonthPanel(),this.createEveryNWeekDayOfMonthPanel(),this.createRegeneratePanel()]});Zarafa.common.recurrence.dialogs.MonthlyPanel.superclass.constructor.call(this,a)},createEveryNDayOfMonthPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"monthly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_N_DAY_OF_MONTH,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,
scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Day {A} of every {B} month(s)"),labelWidth:250,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../nthDaySpinner",name:"recurrence_monthday",labelSplitter:"{A}",allowNegative:!1,minValue:1,maxValue:31,width:50,listeners:{change:this.onMonthlyNDayOfMonthChange,scope:this}},{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../everyNMonthsSpinner",
name:"recurrence_everyn",labelSplitter:"{B}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onMonthlyNDayOfMonthChange,scope:this}}]}]}},createEveryNWeekDayOfMonthPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"monthly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_N_WEEKDAY_OF_MONTH,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],
fieldLabel:_("The {A} {B} of every {C} month(s)"),labelWidth:200,columnWidth:1,items:[{xtype:"combo",ref:"../../weekdayRankCombo",name:"recurrence_nday",labelSplitter:"{A}",width:80,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.recurrence.data.DayRankData},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{change:this.onMonthlyNWeekdayOfMonthChange,scope:this}},{xtype:"combo",ref:"../../weekdayCombo",
name:"recurrence_weekdays",labelSplitter:"{B}",width:100,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.recurrence.data.DayData},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{change:this.onMonthlyNWeekdayOfMonthChange,scope:this}},{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../weekdayEveryNMonthsSpinner",name:"recurrence_everyn",labelSplitter:"{C}",allowNegative:!1,
minValue:1,width:50,listeners:{change:this.onMonthlyNWeekdayOfMonthChange,scope:this}}]}]}},createRegeneratePanel:function(){return{xtype:"panel",layout:"column",ref:"regeneratePanel",items:[{xtype:"radio",name:"monthly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_REGENERATE,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Regenerate new task {A} month(s) after each task is completed"),
labelWidth:400,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../regenNMonthsSpinner",name:"recurrence_everyn",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onMonthlyRegenerateChange,scope:this}}]}]}},onMonthlyNDayOfMonthChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_N_DAY_OF_MONTH,a,b)},onMonthlyNWeekdayOfMonthChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_N_WEEKDAY_OF_MONTH,
a,b)},onMonthlyRegenerateChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.MONTHLY_REGENERATE,a,b)},updateEveryNDayOfMonthValues:function(a,b){var c=a.get("startdate")||new Date,c=b?c.getDate():a.get("recurrence_monthday"),d=b?1:a.get("recurrence_everyn");this.nthDaySpinner.setValue(c);this.everyNMonthsSpinner.setValue(d)},updateEveryNWeekDayOfMonthValues:function(a,b){var c,d,e;b?(d=a.get("startdate")||new Date,c=Math.ceil(d.getDate()/7),d=Math.pow(2,
d.getDay()),e=1):(c=a.get("recurrence_nday"),d=a.get("recurrence_weekdays"),e=a.get("recurrence_everyn"));this.weekdayRankCombo.setValue(c);this.weekdayCombo.setValue(d);this.weekdayEveryNMonthsSpinner.setValue(e)},updateRegenerateValues:function(a,b){var c=b?1:a.get("recurrence_everyn");this.regenNMonthsSpinner.setValue(c)},updateUI:function(a,b){var c=!1;if(!0===b||a.isModifiedSinceLastUpdate("message_class"))a.isMessageClass("IPM.TaskRequest",!0)?this.regeneratePanel.show():this.regeneratePanel.hide(),
c=!0;c&&this.doLayout()},updateSubtype:function(a,b,c){var d=Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(d.MONTHLY_N_DAY_OF_MONTH,b)?this.updateEveryNDayOfMonthValues(a,c):this.isSubtype(d.MONTHLY_N_WEEKDAY_OF_MONTH,b)?this.updateEveryNWeekDayOfMonthValues(a,c):this.isSubtype(d.MONTHLY_REGENERATE,b)&&this.updateRegenerateValues(a,c)},updateRecordSubType:function(a,b){var c=Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(c.MONTHLY_N_DAY_OF_MONTH,b)?(a.set("recurrence_monthday",
this.nthDaySpinner.getValue()),a.set("recurrence_nday",void 0),a.set("recurrence_weekdays",void 0),a.set("recurrence_everyn",this.everyNMonthsSpinner.getValue())):this.isSubtype(c.MONTHLY_N_WEEKDAY_OF_MONTH,b)?(a.set("recurrence_monthday",void 0),a.set("recurrence_nday",this.weekdayRankCombo.getValue()),a.set("recurrence_weekdays",this.weekdayCombo.getValue()),a.set("recurrence_everyn",this.weekdayEveryNMonthsSpinner.getValue())):this.isSubtype(c.MONTHLY_REGENERATE,b)&&(a.set("recurrence_monthday",
1),a.set("recurrence_nday",void 0),a.set("recurrence_weekdays",void 0),a.set("recurrence_everyn",this.regenNMonthsSpinner.getValue()));a.set("recurrence_month",void 0)}});Ext.reg("zarafa.recurrencemonthlypanel",Zarafa.common.recurrence.dialogs.MonthlyPanel);Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.WeeklyPanel=Ext.extend(Zarafa.common.recurrence.dialogs.RecurrenceSubPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.recurrenceweeklypanel",recurrenceType:Zarafa.common.recurrence.data.RecurrenceType.WEEKLY,recurrenceSubtypes:[Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY_REGENERATE,Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY],defaults:{border:!1,bodyStyle:"background-color: inherit;",height:25},items:[this.createEveryNWeeksPanel(),
this.createDaySelectionPanel(),this.createRegeneratePanel()]});Zarafa.common.recurrence.dialogs.WeeklyPanel.superclass.constructor.call(this,a)},createEveryNWeeksPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"weekly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Every {A} week(s) on")+
":",labelWidth:140,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../everyNWeeksSpinner",name:"recurrence_everyn",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onWeeklyChange,scope:this}}]}]}},createDaySelectionPanel:function(){var a=container.getSettingsModel().get("zarafa/v1/main/week_start");return{xtype:"checkboxgroup",ref:"weeklyDaySelect",name:"recurrence_weekdays",columns:3,style:"padding-left: 25px",anchor:"100% 100%",
height:"auto",items:[{xtype:"checkbox",boxLabel:Date.dayNames[(a+0)%7],dayValue:Math.pow(2,(a+0)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}},{xtype:"checkbox",boxLabel:Date.dayNames[(a+1)%7],dayValue:Math.pow(2,(a+1)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}},{xtype:"checkbox",boxLabel:Date.dayNames[(a+2)%7],dayValue:Math.pow(2,(a+2)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}},{xtype:"checkbox",boxLabel:Date.dayNames[(a+3)%7],dayValue:Math.pow(2,
(a+3)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}},{xtype:"checkbox",boxLabel:Date.dayNames[(a+4)%7],dayValue:Math.pow(2,(a+4)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}},{xtype:"checkbox",boxLabel:Date.dayNames[(a+5)%7],dayValue:Math.pow(2,(a+5)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}},{xtype:"checkbox",boxLabel:Date.dayNames[(a+6)%7],dayValue:Math.pow(2,(a+6)%7),width:250,listeners:{change:this.onWeeklyDayChange,scope:this}}]}},
createRegeneratePanel:function(){return{xtype:"panel",layout:"column",ref:"regeneratePanel",items:[{xtype:"radio",name:"weekly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY_REGENERATE,hideLabel:!0,width:25,listeners:{check:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Regenerate new task {A} week(s) after each task is completed"),labelWidth:400,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],
ref:"../../regenNWeeksSpinner",name:"recurrence_everyn",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onWeeklyRegenerateChange,scope:this}}]}]}},onWeeklyChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY,a,b)},onWeeklyDayChange:function(a,b){var c=this.record.get(a.name),c=b?c|a.dayValue:c&~a.dayValue;this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY,a,c)},onWeeklyRegenerateChange:function(a,
b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY_REGENERATE,a,10080*b)},updateEveryNWeeksValues:function(a,b){var c=b?1:a.get("recurrence_everyn");this.everyNWeeksSpinner.setValue(c)},updateDaySelectionValues:function(a,b){var c=a.get("startdate")||new Date,d=b?Math.pow(2,c.getDay()):a.get("recurrence_weekdays");this.weeklyDaySelect.items.each(function(a){a.setValue(!!(a.dayValue&d))})},updateRegenerateValues:function(a,b){var c=b?1:Math.floor(a.get("recurrence_everyn")/
10080);this.regenNWeeksSpinner.setValue(c)},updateUI:function(a,b){var c=!1;if(!0===b||a.isModifiedSinceLastUpdate("message_class"))a.isMessageClass("IPM.TaskRequest",!0)?this.regeneratePanel.show():this.regeneratePanel.hide(),c=!0;c&&this.doLayout()},updateSubtype:function(a,b,c){var d=Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(d.WEEKLY,b)?(this.updateEveryNWeeksValues(a,c),this.updateDaySelectionValues(a,c)):this.isSubtype(d.WEEKLY_REGENERATE,b)&&this.updateRegenerateValues(a,
c)},updateRecordSubType:function(a,b){var c=Zarafa.common.recurrence.data.RecurrenceSubtype;if(this.isSubtype(c.WEEKLY,b)){a.set("recurrence_everyn",this.everyNWeeksSpinner.getValue());var d=0;Ext.each(this.weeklyDaySelect.getValue(),function(a){d|=a.dayValue});a.set("recurrence_weekdays",d)}else this.isSubtype(c.WEEKLY_REGENERATE,b)&&a.set("recurrence_everyn",10080*this.regenNWeeksSpinner.getValue());a.set("recurrence_month",void 0);a.set("recurrence_monthday",void 0);a.set("recurrence_nday",void 0)}});
Ext.reg("zarafa.recurrenceweeklypanel",Zarafa.common.recurrence.dialogs.WeeklyPanel);Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.YearlyPanel=Ext.extend(Zarafa.common.recurrence.dialogs.RecurrenceSubPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.recurrenceyearlypanel",recurrenceType:Zarafa.common.recurrence.data.RecurrenceType.YEARLY,recurrenceSubtypes:[Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_MONTH,Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_N_WEEKDAY,Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_REGENERATE],defaults:{border:!1,bodyStyle:"background-color: inherit;",
height:25},items:[this.createEveryNWeekdayPanel(),this.createEveryMonthPanel(),this.createRegeneratePanel()]});Zarafa.common.recurrence.dialogs.YearlyPanel.superclass.constructor.call(this,a)},createEveryNWeekdayPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"yearly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_MONTH,hideLabel:!0,width:25,listeners:{change:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],
fieldLabel:_("Every {A} {B}"),labelWidth:50,columnWidth:1,items:[{xtype:"combo",ref:"../../monthCombo",name:"recurrence_month",labelSplitter:"{A}",width:100,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.recurrence.data.MonthData},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{change:this.onYearlyMonthChange,select:this.onEveryNWeekdayMonthSelect,scope:this}},{xtype:"zarafa.spinnerfield",
plugins:["zarafa.numberspinner"],ref:"../../monthDaySpinner",name:"recurrence_monthday",labelSplitter:"{B}",allowNegative:!1,minValue:1,maxValue:31,width:50,listeners:{change:this.onYearlyMonthChange,scope:this}}]}]}},createEveryMonthPanel:function(){return{xtype:"panel",layout:"column",items:[{xtype:"radio",name:"yearly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_N_WEEKDAY,hideLabel:!0,width:25,listeners:{change:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",
plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("The {A} {B} of {C}"),labelWidth:75,columnWidth:1,items:[{xtype:"combo",ref:"../../dayRankCombo",name:"recurrence_nday",labelSplitter:"{A}",width:80,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.recurrence.data.DayRankData},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{change:this.onYearlyNWeekdayChange,scope:this}},{xtype:"combo",ref:"../../weekdayCombo",
name:"recurrence_weekdays",labelSplitter:"{B}",width:100,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.recurrence.data.DayData},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{change:this.onYearlyNWeekdayChange,scope:this}},{xtype:"combo",ref:"../../monthWeekdayCombo",name:"recurrence_month",labelSplitter:"{C}",width:100,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.recurrence.data.MonthData},
mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{change:this.onYearlyNWeekdayChange,scope:this}}]}]}},createRegeneratePanel:function(){return{xtype:"panel",layout:"column",ref:"regeneratePanel",items:[{xtype:"radio",name:"yearly_pattern",patternValue:Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_REGENERATE,hideLabel:!0,width:25,listeners:{change:this.onSubtypeChange,scope:this}},{xtype:"zarafa.compositefield",
plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Regenerate new task {A} year(s) after each task is completed"),labelWidth:400,columnWidth:1,items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../../regenNYearsSpinner",name:"recurrence_everyn",labelSplitter:"{A}",allowNegative:!1,minValue:1,width:50,listeners:{change:this.onYearlyRegenerateChange,scope:this}}]}]}},onYearlyMonthChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_MONTH,
a,b)},onYearlyNWeekdayChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_N_WEEKDAY,a,b)},onYearlyRegenerateChange:function(a,b){this.onSubtypePropertyChange(Zarafa.common.recurrence.data.RecurrenceSubtype.YEARLY_REGENERATE,a,b)},onEveryNWeekdayMonthSelect:function(a,b,c){a=[31,29,31,30,31,30,31,31,30,31,30,31][c];this.monthDaySpinner.getValue()>a&&this.monthDaySpinner.setValue(a);this.monthDaySpinner.maxValue=a},updateEveryNWeekdayValues:function(a,
b){var c,d;b?(d=a.get("startdate")||new Date,c=this.monthCombo.getStore().getAt(d.getMonth()).get("value"),d=d.getDate()):(c=a.get("recurrence_month"),d=a.get("recurrence_monthday"));this.monthCombo.setValue(c);this.monthDaySpinner.setValue(d)},updateEveryMonthValues:function(a,b){var c,d,e;b?(e=a.get("startdate")||new Date,c=Math.ceil(e.getDate()/7),d=Math.pow(2,e.getDay()),e=this.monthWeekdayCombo.getStore().getAt(e.getMonth()).get("value")):(c=a.get("recurrence_nday"),d=a.get("recurrence_weekdays"),
e=a.get("recurrence_month"));this.dayRankCombo.setValue(c);this.weekdayCombo.setValue(d);this.monthWeekdayCombo.setValue(e)},updateRegenerateValues:function(a,b){this.regenNYearsSpinner.setValue(1)},updateUI:function(a,b){var c=!1;if(!0===b||a.isModifiedSinceLastUpdate("message_class"))a.isMessageClass("IPM.TaskRequest",!0)?this.regeneratePanel.show():this.regeneratePanel.hide(),c=!0;c&&this.doLayout()},updateSubtype:function(a,b,c){var d=Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(d.YEARLY_MONTH,
b)?this.updateEveryNWeekdayValues(a,c):this.isSubtype(d.YEARLY_N_WEEKDAY,b)?this.updateEveryMonthValues(a,c):this.isSubtype(d.YEARLY_REGENERATE,b)&&this.updateRegenerateValues(a,c)},updateRecordSubType:function(a,b){var c=Zarafa.common.recurrence.data.RecurrenceSubtype;this.isSubtype(c.YEARLY_MONTH,b)?(a.set("recurrence_everyn",12),a.set("recurrence_nday",void 0),a.set("recurrence_weekdays",void 0),a.set("recurrence_month",this.monthCombo.getValue()),a.set("recurrence_monthday",this.monthDaySpinner.getValue())):
this.isSubtype(c.YEARLY_N_WEEKDAY,b)?(a.set("recurrence_everyn",12),a.set("recurrence_nday",this.dayRankCombo.getValue()),a.set("recurrence_weekdays",this.weekdayCombo.getValue()),a.set("recurrence_month",this.monthWeekdayCombo.getValue()),a.set("recurrence_monthday",void 0)):this.isSubtype(c.YEARLY_REGENERATE,b)&&(a.set("recurrence_everyn",this.regenNYearsSpinner.getValue()),a.set("recurrence_nday",void 0),a.set("recurrence_weekdays",void 0),a.set("recurrence_month",void 0),a.set("recurrence_monthday",
1))}});Ext.reg("zarafa.recurrenceyearlypanel",Zarafa.common.recurrence.dialogs.YearlyPanel);Ext.namespace("Zarafa.common.reminder.data");
Zarafa.common.reminder.data.ReminderProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{constructor:function(a){a=a||{};var b=Zarafa.core.ModuleNames.getModule("reminder");Ext.applyIf(a,{listModuleName:b.list,itemModuleName:b.item});Zarafa.common.reminder.data.ReminderProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.core.data.IPMResponseHandler({proxy:this,action:c,reader:f,options:k,callback:g,scope:h})}});Ext.namespace("Zarafa.common.reminder.dialogs");
Zarafa.common.reminder.dialogs.ReminderContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{store:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=container.getReminderStore());a=Ext.applyIf(a,{xtype:"zarafa.remindercontentpanel",layout:"fit",title:_("Reminders"),border:!1,width:350,minWidth:350,maxWidth:350,height:300,items:[{xtype:"zarafa.reminderpanel",store:a.store}]});Zarafa.common.reminder.dialogs.ReminderContentPanel.superclass.constructor.call(this,a)}});
Ext.reg("zarafa.remindercontentpanel",Zarafa.common.reminder.dialogs.ReminderContentPanel);Ext.namespace("Zarafa.common.reminder.dialogs");
Zarafa.common.reminder.dialogs.ReminderGrid=Ext.extend(Zarafa.common.ui.grid.GridPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.remindergrid",border:!0,columns:this.initColumnModel(),selModel:this.initSelectionModel()});Zarafa.common.reminder.dialogs.ReminderGrid.superclass.constructor.call(this,a);this.on("rowdblclick",this.onRowDblClick,this);this.on("rowcontextmenu",this.onRowContextMenu,this)},initColumnModel:function(){return[{header:'<p class="icon_index">&nbsp;</p>',headerCls:"zarafa-icon-column",
dataIndex:"icon_index",width:24,renderer:Zarafa.common.ui.grid.Renderers.icon,fixed:!0,menuDisabled:!0},{dataIndex:"subject",renderer:Zarafa.common.ui.grid.Renderers.subject,header:_("Subject"),menuDisabled:!0},{dataIndex:"reminder_time",width:150,header:_("Due In"),renderer:Zarafa.common.ui.grid.Renderers.dueBy,menuDisabled:!0}]},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({multiSelect:!0})},onRowDblClick:function(a,b,c){(a=this.store.getAt(b))&&Zarafa.common.Actions.openReminderRecord(a)},
onRowContextMenu:function(a,b,c){a=this.getSelectionModel();a.hasSelection()?a.isSelected(b)||(a.clearSelections(),a.selectRow(b)):a.selectRow(b);(b=a.getSelections())&&Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.reminder.remindergrid"],b,{position:c.getXY()})}});Ext.reg("zarafa.remindergrid",Zarafa.common.reminder.dialogs.ReminderGrid);Ext.namespace("Zarafa.common.reminder.dialogs");
Zarafa.common.reminder.dialogs.ReminderGridContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:[this.createContextActionItems(),{xtype:"menuseparator"},container.populateInsertionPoint("context.common.reminder.contentpanel.contextmenu.actions",this),{xtype:"menuseparator"},container.populateInsertionPoint("context.common.reminder.contentpanel.contextmenu.options",this)]});Zarafa.common.reminder.dialogs.ReminderGridContextMenu.superclass.constructor.call(this,
a)},createContextActionItems:function(){return[{xtype:"zarafa.conditionalitem",text:_("Open"),iconCls:"icon_open",singleSelectOnly:!0,handler:this.onContextItemOpen,scope:this}]},onContextItemOpen:function(){Zarafa.common.Actions.openReminderRecord(this.records)}});Ext.reg("zarafa.remindergridcontextmenu",Zarafa.common.reminder.dialogs.ReminderGridContextMenu);Ext.namespace("Zarafa.common.restoreitem.data");
Zarafa.common.restoreitem.data.RestoreItemStore=Ext.extend(Zarafa.core.data.MAPIStore,{entryId:void 0,storeEntryId:void 0,constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByObjectType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RESTOREITEM);Ext.applyIf(a,{remoteSort:!0,sortInfo:{field:"deleted_on",direction:"DESC"},actionType:Zarafa.core.Actions.list,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.core.data.JsonReader({dynamicRecord:!1},b),proxy:new Zarafa.core.data.IPMProxy({listModuleName:Zarafa.core.ModuleNames.getListName("RESTOREITEMS"),
itemModuleName:Zarafa.core.ModuleNames.getItemName("RESTOREITEMS")})});Zarafa.common.restoreitem.data.RestoreItemStore.superclass.constructor.call(this,a)},load:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isEmpty(a.folder)||(this.entryId=a.folder.get("entryid"),this.storeEntryId=a.folder.get("store_entryid"));Ext.apply(a.params,{entryid:this.entryId,store_entryid:this.storeEntryId});return Zarafa.common.restoreitem.data.RestoreItemStore.superclass.load.call(this,
a)}});Ext.reg("zarafa.restoreitemstore",Zarafa.common.restoreitem.data.RestoreItemStore);Ext.namespace("Zarafa.common.rules.data");Zarafa.common.rules.data.ActionFlags=Zarafa.core.Enum.create({UNKNOWN:-1,MOVE:1,COPY:2,DELETE:3,REDIRECT:4,FORWARD:5,FORWARD_ATTACH:6});Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.ConditionFlags=Zarafa.core.Enum.create({UNKNOWN:-1,RECEIVED_FROM:1,SENT_TO:2,SUBJECT_WORDS:3,BODY_WORDS:4,SENDER_WORDS:5,NAME_TO_CC:6,IMPORTANCE:7,SENT_TO_ME_ONLY:8,ATTACHMENT:9,SENSITIVITY:10,SENT_TO_ME:11,SENT_CC_ME:12,RECEIVED_BEFORE:13,RECEIVED_AFTER:14,NONE:15,TRANSPORTHEADER_WORDS:16});Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.JsonRulesReader=Ext.extend(Zarafa.core.data.JsonReader,{constructor:function(a,b){a=a||{};Ext.applyIf(a,{id:"rule_id",idProperty:"rule_id",dynamicRecord:!1});Ext.isDefined(b)||(b=Zarafa.core.data.RecordFactory.getRecordClassByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RULE));Zarafa.common.rules.data.JsonRulesReader.superclass.constructor.call(this,a,b)}});Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.RulesStore=Ext.extend(Zarafa.core.data.MAPIStore,{actionType:void 0,storeEntryId:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{autoLoad:!0,batch:!0,actionType:Zarafa.core.Actions.list,writer:new Zarafa.core.data.JsonWriter({writeAllFields:!0}),reader:new Zarafa.common.rules.data.JsonRulesReader,proxy:new Zarafa.common.rules.data.RulesProxy({listModuleName:Zarafa.core.ModuleNames.getListName("RULES"),itemModuleName:Zarafa.core.ModuleNames.getItemName("RULES")})});Zarafa.common.rules.data.RulesStore.superclass.constructor.call(this,
a)},createRecords:function(a,b,c){for(var d=0,e=b.length;d<e;d++){var f=b[d];if(f.phantom){var g=10;a.each(function(a){a=a.get("rule_sequence");Ext.isEmpty(a)||(g=Math.max(g,a))},this);f.data.rule_sequence=g+1}}Zarafa.common.rules.data.RulesStore.superclass.createRecords.apply(this,arguments)},save:function(){if(!this.writer)throw new Ext.data.Store.Error("writer-undefined");var a=[],b,c,d,e={},f;b=this.getModifiedRecords();if(0===b.length&&0===this.removed.length)this.baseParams.store=this.storeEntryId;
else{b=this.getRange().filter(function(a){return a.isValid()});b.forEach(function(a){a.addMessageAction("store",this.storeEntryId)},this);a.push(["create",b]);if(b=a.length){d=++this.batchCounter;for(f=0;f<b;++f)c=a[f],e[c[0]]=c[1];if(!1!==this.fireEvent("beforesave",this,e)){for(f=0;f<b;++f)c=a[f],this.doTransaction(c[0],c[1],d);return d}}return-1}},load:function(a){Ext.isObject(a)||(a={});this.baseParams.store=this.storeEntryId;Ext.isObject(a.params)?a.params.store=this.storeEntryId:a.params={store:this.storeEntryId};
Ext.isDefined(a.cancelPreviousRequest)||(a.cancelPreviousRequest=!0);Ext.applyIf(a,{actionType:this.actionType});return Zarafa.common.rules.data.RulesStore.superclass.load.call(this,a)}});Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.AttachmentLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{getCondition:function(){return!0!==this.isModified?this.condition:this.conditionFlag!==Zarafa.common.rules.data.ConditionFlags.ATTACHMENT?!1:Zarafa.core.data.RestrictionFactory.dataResBitmask("PR_MESSAGE_FLAGS",Zarafa.core.mapi.Restrictions.BMR_NEZ,Zarafa.core.mapi.MessageFlags.MSGFLAG_HASATTACH)}});Ext.reg("zarafa.attachmentlink",Zarafa.common.rules.dialogs.AttachmentLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.DeleteLink=Ext.extend(Zarafa.common.rules.dialogs.FolderSelectionLink,{onClick:function(a,b,c,d){},setAction:function(a,b){this.actionFlag=Zarafa.common.rules.data.ActionFlags.MOVE;this.action=b;this.isModified=!Ext.isDefined(b);var c=container.getHierarchyStore(),d=c.findExact("store_entryid",this.storeEntryId);this.folder=c.getAt(d).getDefaultFolder("wastebasket")},update:function(a){}});Ext.reg("zarafa.deletelink",Zarafa.common.rules.dialogs.DeleteLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.ImportanceLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:[{xtype:"combo",ref:"importanceCombo",width:100,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.data.ImportanceFlags.flags},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:function(){this.isModified=!0},scope:this}}]});Zarafa.common.rules.dialogs.ImportanceLink.superclass.constructor.call(this,
a)},setCondition:function(a,b){var c=Zarafa.core.mapi.Importance.NORMAL;b&&(c=b[1][Zarafa.core.mapi.Restrictions.VALUE].PR_IMPORTANCE);this.importanceCombo.setValue(c);Zarafa.common.rules.dialogs.ImportanceLink.superclass.setCondition.call(this,arguments)},getCondition:function(){if(!0!==this.isModified)return this.condition;var a=Zarafa.core.data.RestrictionFactory,b=Zarafa.core.mapi.Restrictions,c=this.importanceCombo.getValue();return a.dataResProperty("PR_IMPORTANCE",b.RELOP_EQ,c)}});
Ext.reg("zarafa.importancelink",Zarafa.common.rules.dialogs.ImportanceLink);Ext.namespace("Zarafa.common.rules.dialogs");Zarafa.common.rules.dialogs.NameToCcLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{getCondition:function(){return!0!==this.isModified?this.condition:this.conditionFlag!==Zarafa.common.rules.data.ConditionFlags.NAME_TO_CC?!1:Zarafa.core.data.RestrictionFactory.dataResProperty("PR_MESSAGE_RECIP_ME",Zarafa.core.mapi.Restrictions.RELOP_EQ,!0,"0x0059000B")}});
Ext.reg("zarafa.nametocclink",Zarafa.common.rules.dialogs.NameToCcLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.ReceivedAfterLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:[{xtype:"datefield",width:120,ref:"receivedDate",listeners:{select:function(){this.isModified=!0},scope:this}}]});Zarafa.common.rules.dialogs.ReceivedAfterLink.superclass.constructor.call(this,a)},setCondition:function(a,b){b?this.receivedDate.setValue(new Date(1E3*b[1][Zarafa.core.mapi.Restrictions.VALUE].PR_MESSAGE_DELIVERY_TIME)):this.receivedDate.setValue(new Date);
Zarafa.common.rules.dialogs.ReceivedAfterLink.superclass.setCondition.call(this,arguments)},getCondition:function(){if(!0!==this.isModified)return this.condition;var a=Zarafa.core.data.RestrictionFactory,b=Zarafa.core.mapi.Restrictions,c=this.receivedDate.getValue();c.setHours(23);c.setMinutes(59);c.setSeconds(59);c=c.getTime()/1E3;return a.dataResProperty("PR_MESSAGE_DELIVERY_TIME",b.RELOP_GT,c)}});Ext.reg("zarafa.receivedafterlink",Zarafa.common.rules.dialogs.ReceivedAfterLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.RulesWordsEditContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{store:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.ruleswordseditcontentpanel",layout:"fit",width:500,height:300,title:_("Specify Words or Phrases"),items:[{xtype:"zarafa.ruleswordseditpanel",ref:"rulesWordsEditPanel",store:a.store,buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.common.rules.dialogs.RulesWordsEditContentPanel.superclass.constructor.call(this,
a)},onOk:function(){!1!==this.rulesWordsEditPanel.onWordAdd()&&(Ext.isFunction(this.callback)&&this.callback.call(this.scope||this,this.store),this.close())},onCancel:function(){this.close()}});Ext.reg("zarafa.ruleswordseditcontentpanel",Zarafa.common.rules.dialogs.RulesWordsEditContentPanel);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.SensitivityLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:[{xtype:"combo",ref:"sensitivityCombo",width:100,store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.common.data.SensitivityFlags.flags},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:function(){this.isModified=!0},scope:this}}]});Zarafa.common.rules.dialogs.SensitivityLink.superclass.constructor.call(this,
a)},setCondition:function(a,b){var c=Zarafa.core.mapi.Sensitivity.NONE;b&&(c=b[1][Zarafa.core.mapi.Restrictions.VALUE].PR_SENSITIVITY);this.sensitivityCombo.setValue(c);Zarafa.common.rules.dialogs.SensitivityLink.superclass.setCondition.call(this,arguments)},getCondition:function(){if(!0!==this.isModified)return this.condition;var a=Zarafa.core.data.RestrictionFactory,b=Zarafa.core.mapi.Restrictions,c=this.sensitivityCombo.getValue();return a.dataResProperty("PR_SENSITIVITY",b.RELOP_EQ,c)}});
Ext.reg("zarafa.sensitivitylink",Zarafa.common.rules.dialogs.SensitivityLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.SentCcMeLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{getCondition:function(){if(!0!==this.isModified)return this.condition;var a=Zarafa.core.data.RestrictionFactory,b=Zarafa.core.mapi.Restrictions;return this.conditionFlag!==Zarafa.common.rules.data.ConditionFlags.SENT_CC_ME?!1:a.createResAnd([a.dataResProperty("PR_MESSAGE_CC_ME",b.RELOP_EQ,!0,"0x0059000B"),a.dataResProperty("PR_MESSAGE_RECIP_ME",b.RELOP_EQ,!0,"0x0058000B"),a.dataResProperty("PR_MESSAGE_TO_ME",
b.RELOP_EQ,!1,"0x0057000B")])}});Ext.reg("zarafa.sentccmelink",Zarafa.common.rules.dialogs.SentCcMeLink);Ext.namespace("Zarafa.common.rules.dialogs");Zarafa.common.rules.dialogs.SentToLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{getCondition:function(){return!0!==this.isModified?this.condition:this.conditionFlag!==Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME?!1:Zarafa.core.data.RestrictionFactory.dataResProperty("PR_MESSAGE_TO_ME",Zarafa.core.mapi.Restrictions.RELOP_EQ,!0,"0x0057000B")}});
Ext.reg("zarafa.senttolink",Zarafa.common.rules.dialogs.SentToLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.SentToMeLink=Ext.extend(Zarafa.common.rules.dialogs.BaseLink,{getCondition:function(){if(!0!==this.isModified)return this.condition;var a=Zarafa.core.data.RestrictionFactory,b=Zarafa.core.mapi.Restrictions;return this.conditionFlag!==Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME_ONLY?!1:a.createResAnd([a.dataResProperty("PR_MESSAGE_TO_ME",b.RELOP_EQ,!0,"0x0057000B"),a.createResNot(a.dataResContent("PR_DISPLAY_TO",b.FL_SUBSTRING,";","0x0E04001E")),a.dataResProperty("PR_DISPLAY_CC",
b.RELOP_EQ,"","0x00E03001E")])}});Ext.reg("zarafa.senttomelink",Zarafa.common.rules.dialogs.SentToMeLink);Ext.namespace("Zarafa.common.rules.ui");
Zarafa.common.rules.ui.RulesGrid=Ext.extend(Zarafa.common.ui.grid.GridPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.rulesgrid",cls:"k-rulesgrid",border:!1,enableHdMenu:!1,viewConfig:{forceFit:!0,emptyText:"<div class='emptytext'>"+_("No rule exists")+"</div>"},loadMask:this.initLoadMask(),sm:new Ext.grid.RowSelectionModel({singleSelect:!0}),columns:this.initColumnModel(),listeners:{rowdblclick:this.onRowDblClick,scope:this},tbar:this.initToolbar()});Zarafa.common.rules.ui.RulesGrid.superclass.constructor.call(this,
a)},initEvents:function(){Zarafa.common.rules.ui.RulesGrid.superclass.initEvents.call(this);this.mon(this.getSelectionModel(),"selectionchange",this.onGridSelectionChange,this)},initToolbar:function(){return[{xtype:"button",text:_("New"),handler:this.onRuleAdd,ref:"../addButton",scope:this},{xtype:"button",text:_("Delete"),disabled:!0,ref:"../removeButton",handler:this.onRuleRemove,scope:this},{xtype:"button",text:_("Edit"),disabled:!0,ref:"../editButton",handler:this.onRuleEdit,scope:this},{xtype:"button",
iconCls:"zarafa-rules-sequence-up",disabled:!0,ref:"../upButton",handler:this.onRuleSequenceUp,scope:this},{xtype:"button",iconCls:"zarafa-rules-sequence-down",disabled:!0,ref:"../downButton",handler:this.onRuleSequenceDown,scope:this}]},initColumnModel:function(){return[{xtype:"checkcolumn",dataIndex:"rule_state",header:_("Active"),fixed:!0,width:60,sortable:!1,renderer:this.ruleStateRenderer.createDelegate(this),processEvent:this.onRuleStateColumnProcessEvent.createDelegate(this)},{dataIndex:"rule_name",
header:_("Rule"),sortable:!1,renderer:Zarafa.common.ui.grid.Renderers.text}]},ruleStateRenderer:function(a,b,c){a=(a&Zarafa.core.mapi.RuleStates.ST_ENABLED)===Zarafa.core.mapi.RuleStates.ST_ENABLED;return Ext.ux.grid.CheckColumn.prototype.renderer.apply(this,arguments)},onRuleStateColumnProcessEvent:function(a,b,c,d,e){"mousedown"===a&&(a=c.getStore().getAt(d),b=a.get("rule_state"),(b&Zarafa.core.mapi.RuleStates.ST_ENABLED)===Zarafa.core.mapi.RuleStates.ST_ENABLED?a.set("rule_state",b&~Zarafa.core.mapi.RuleStates.ST_ENABLED):
a.set("rule_state",b|Zarafa.core.mapi.RuleStates.ST_ENABLED))},initLoadMask:function(){return{msg:_("Loading rules")+"..."}},onViewReady:function(){Zarafa.common.rules.ui.RulesGrid.superclass.onViewReady.apply(this,arguments);this.getSelectionModel().selectFirstRow()},onStoreLoad:function(a,b,c){Zarafa.common.rules.ui.RulesGrid.superclass.onStoreLoad.apply(this,arguments);this.getSelectionModel().hasSelection()||this.getSelectionModel().selectFirstRow()},onRowDblClick:function(a,b){Zarafa.common.Actions.openRulesEditContent(a.getStore().getAt(b))},
onGridSelectionChange:function(a){var b=!1===a.hasSelection();this.removeButton.setDisabled(b);this.editButton.setDisabled(b);this.upButton.setDisabled(!a.hasPrevious());this.downButton.setDisabled(!a.hasNext())},onRuleAdd:function(){var a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RULE);this.getStore().add(a);Zarafa.common.Actions.openRulesEditContent(a,{removeRecordOnCancel:!0})},onRuleRemove:function(){var a=this.getStore(),b=this.getSelectionModel().getSelected();
b?a.remove(b):container.getNotifier().notify("error.rules",_("Error"),_("Please select a rule."))},onRuleEdit:function(){var a=this.getSelectionModel().getSelected();a?Zarafa.common.Actions.openRulesEditContent(a):container.getNotifier().notify("error.rules",_("Error"),_("Please select a rule."))},onRuleSequenceUp:function(){var a=this.getStore(),b=this.getSelectionModel(),c=b.getSelected();if(c)if(b.hasPrevious()){var d;a.each(function(a){c.get("rule_sequence")>a.get("rule_sequence")&&(!d||a.get("rule_sequence")>
d.get("rule_sequence"))&&(d=a)},this);this.swapRules(c,d)}else container.getNotifier().notify("error.rules",_("Error"),_("Rule already has highest priority."));else container.getNotifier().notify("error.rules",_("Error"),_("Please select a rule."))},onRuleSequenceDown:function(){var a=this.getStore(),b=this.getSelectionModel(),c=b.getSelected();if(c)if(b.hasNext()){var d;a.each(function(a){c.get("rule_sequence")<a.get("rule_sequence")&&(!d||a.get("rule_sequence")<d.get("rule_sequence"))&&(d=a)},this);
this.swapRules(c,d)}else container.getNotifier().notify("error.rules",_("Error"),_("Rule already has lowest priority."));else container.getNotifier().notify("error.rules",_("Error"),_("Please select a rule."))},swapRules:function(a,b){var c=a.get("rule_sequence"),d=b.get("rule_sequence");a.set("rule_sequence",d);b.set("rule_sequence",c);this.getStore().sort("rule_sequence","ASC");c=this.getSelectionModel();this.upButton.setDisabled(!c.hasPrevious());this.downButton.setDisabled(!c.hasNext())}});
Ext.reg("zarafa.rulesgrid",Zarafa.common.rules.ui.RulesGrid);Ext.namespace("Zarafa.common.settings");
Zarafa.common.settings.SettingsDelegateCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Delegates"),categoryIndex:5,xtype:"zarafa.settingsdelegatecategory",iconCls:"zarafa-settings-category-delegate",items:[{xtype:"zarafa.settingsdelegatewidget",settingsContext:a.settingsContext},container.populateInsertionPoint("context.settings.category.delegate",this)]});Zarafa.common.settings.SettingsDelegateCategory.superclass.constructor.call(this,
a)},onHide:function(){Zarafa.common.settings.SettingsDelegateCategory.superclass.onHide.apply(this,arguments);var a=this.get(0).getDelegateStore();this.mun(a,"beforesave",this.onBeforeSaveDelegate,this)},onBeforeSaveSettingsModel:function(){Zarafa.common.settings.SettingsDelegateCategory.superclass.onBeforeSaveSettingsModel.apply(this,arguments);var a=this.get(0).getDelegateStore();this.mon(a,"beforesave",this.onBeforeSaveDelegate,this,{single:!0})},onBeforeSaveDelegate:function(){this.displaySavingMask();
var a=this.get(0).getDelegateStore();this.mon(a,"save",this.onDelegateSave,this);this.mon(a,"exception",this.onDelegateException,this)},onDelegateSave:function(){this.hideSavingMask(!0);var a=this.get(0).getDelegateStore();this.mun(a,"save",this.onDelegateSave,this);this.mun(a,"exception",this.onDelegateException,this)},onDelegateException:function(){this.hideSavingMask(!1);var a=this.get(0).getDelegateStore();this.mun(a,"save",this.onDelegateSave,this);this.mun(a,"exception",this.onDelegateException,
this)}});Ext.reg("zarafa.settingsdelegatecategory",Zarafa.common.settings.SettingsDelegateCategory);Ext.namespace("Zarafa.common.settings");
Zarafa.common.settings.SettingsDelegateWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{height:400,title:_("Delegate settings"),xtype:"zarafa.settingsdelegatewidget",layout:{type:"fit"},items:[{xtype:"zarafa.delegatespanel",ref:"delegatesPanel"}]});Zarafa.common.settings.SettingsDelegateWidget.superclass.constructor.call(this,a)},getDelegateStore:function(){return this.delegatesPanel.store},initEvents:function(){Zarafa.common.settings.SettingsDelegateWidget.superclass.initEvents.call(this);
var a=this.settingsContext.getModel();this.mon(a,"savesettings",this.onSaveSettings,this);this.mon(a,"discardsettings",this.onDiscardSettings,this);this.mon(this.getDelegateStore(),{remove:this.doStoreRemove,update:this.doStoreUpdate,scope:this})},doStoreRemove:function(a,b){b.phantom||this.settingsContext.getModel().setDirty()},doStoreUpdate:function(a,b,c){c!==Ext.data.Record.COMMIT&&this.settingsContext.getModel().setDirty()},onSaveSettings:function(){this.delegatesPanel.saveChanges()},onDiscardSettings:function(){this.delegatesPanel.discardChanges()}});
Ext.reg("zarafa.settingsdelegatewidget",Zarafa.common.settings.SettingsDelegateWidget);Ext.namespace("Zarafa.common.settings");
Zarafa.common.settings.SettingsRuleCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Rules"),categoryIndex:3,xtype:"zarafa.settingsrulecategory",iconCls:"zarafa-settings-category-rules",layout:"fit",items:[{xtype:"zarafa.settingsrulewidget",settingsContext:a.settingsContext},container.populateInsertionPoint("context.settings.category.rules",this)]});Zarafa.common.settings.SettingsRuleCategory.superclass.constructor.call(this,a)},onHide:function(){Zarafa.common.settings.SettingsRuleCategory.superclass.onHide.apply(this,
arguments);var a=this.get(0).getRulesStore();this.mun(a,"beforesave",this.onBeforeSaveRules,this)},onBeforeSaveSettingsModel:function(){var a=this.get(0).getRulesStore();this.mon(a,"beforesave",this.onBeforeSaveRules,this,{single:!0})},onBeforeSaveRules:function(){this.displaySavingMask();var a=this.get(0).getRulesStore();this.mon(a,"save",this.onRulesSave,this);this.mon(a,"exception",this.onRulesException,this)},onRulesSave:function(){this.hideSavingMask(!0);var a=this.get(0).getRulesStore();this.mun(a,
"save",this.onRulesSave,this);this.mun(a,"exception",this.onRulesException,this)},onRulesException:function(){this.hideSavingMask(!1);var a=this.get(0).getRulesStore();this.mun(a,"save",this.onRulesSave,this);this.mun(a,"exception",this.onRulesException,this)}});Ext.reg("zarafa.settingsrulecategory",Zarafa.common.settings.SettingsRuleCategory);Ext.namespace("Zarafa.common.settings");
Zarafa.common.settings.SettingsRuleWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Rules"),xtype:"zarafa.settingsrulewidget",cls:"zarafa-settings-widget k-rules-widget",layout:{type:"fit"},items:[{xtype:"zarafa.rulespanel",ref:"rulesPanel"}]});Zarafa.common.settings.SettingsRuleWidget.superclass.constructor.call(this,a)},getRulesStore:function(){return this.rulesPanel.store},initEvents:function(){Zarafa.common.settings.SettingsRuleWidget.superclass.initEvents.call(this);
var a=this.settingsContext.getModel();this.mon(a,"savesettings",this.onSaveSettings,this);this.mon(a,"discardsettings",this.onDiscardSettings,this);this.mon(this.getRulesStore(),{remove:this.doStoreRemove,update:this.doStoreUpdate,scope:this})},doStoreRemove:function(a,b){!0!==b.phantom&&this.settingsContext.getModel().setDirty()},doStoreUpdate:function(a,b,c){c!==Ext.data.Record.COMMIT&&this.settingsContext.getModel().setDirty()},onSaveSettings:function(){this.rulesPanel.saveChanges()},onDiscardSettings:function(){this.rulesPanel.discardChanges()}});
Ext.reg("zarafa.settingsrulewidget",Zarafa.common.settings.SettingsRuleWidget);Ext.namespace("Zarafa.common.settings");
Zarafa.common.settings.SettingsSendAsCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("From Addresses"),categoryIndex:6,xtype:"zarafa.settingssendascategory",iconCls:"zarafa-settings-category-sendas",items:[{xtype:"zarafa.settingssendaswidget",settingsContext:a.settingsContext},container.populateInsertionPoint("context.settings.category.sendas",this)]});Zarafa.common.settings.SettingsSendAsCategory.superclass.constructor.call(this,a)}});
Ext.reg("zarafa.settingssendascategory",Zarafa.common.settings.SettingsSendAsCategory);Ext.namespace("Zarafa.common.settings");
Zarafa.common.settings.SettingsSendAsWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b=new Zarafa.core.data.IPMRecipientStore({autoResolve:!1,autoDestroy:!0});Ext.applyIf(a,{height:400,title:_("From Addresses settings"),xtype:"zarafa.settingssendaswidget",layout:{type:"fit"},items:[{xtype:"zarafa.sendaspanel",store:b,ref:"sendasPanel"}]});Zarafa.common.settings.SettingsSendAsWidget.superclass.constructor.call(this,a)},getStore:function(){return this.sendasPanel.store},
initEvents:function(){Zarafa.common.settings.SettingsSendAsWidget.superclass.initEvents.call(this);this.mon(this.getStore(),{remove:this.doStoreRemove,update:this.doStoreUpdate,add:this.doStoreAdd,scope:this})},update:function(a){this.model=a;a=a.get("zarafa/v1/contexts/mail/sendas",!0);var b={item:[]};Ext.each(a,function(a,d){b.item.push({props:a})});this.getStore().loadData(b)},updateSettings:function(a){for(var b=this.getStore().getRange(),b=Ext.pluck(b,"data"),c=0;c<b.length;c++){var d=b[c];delete d.proposednewtime;
delete d.proposednewtime_end;delete d.proposednewtime_start;delete d.recipient_flags;delete d.recipient_trackstatus;delete d.recipient_trackstatus_time}a.set("zarafa/v1/contexts/mail/sendas",b)},doStoreRemove:function(a,b,c){b.phantom||this.settingsContext.getModel().setDirty()},doStoreAdd:function(a,b,c){Ext.isEmpty(b[0].get("entryid"))||this.settingsContext.getModel().setDirty()},doStoreUpdate:function(a,b,c){c!==Ext.data.Record.COMMIT&&this.settingsContext.getModel().setDirty()}});
Ext.reg("zarafa.settingssendaswidget",Zarafa.common.settings.SettingsSendAsWidget);Ext.ns("Zarafa.common.ui");
Zarafa.common.ui.DatePeriodField=Ext.extend(Zarafa.common.ui.DateRangeField,{dateFormat:_("d/m/Y"),allowBlank:!1,constructor:function(a){a=a||{};a.startFieldConfig=a.startFieldConfig||{};a.startFieldConfig.listeners=Zarafa.core.Util.mergeListeners(a.startFieldConfig.listeners,{select:this.onStartSelect,scope:this});a.startFieldConfig=Ext.applyIf(a.startFieldConfig,{xtype:"datefield",fieldLabel:_("Start date"),labelWidth:this.labelWidth,emptyText:_("None"),format:this.dateFormat,allowBlank:a.allowBlank||
this.allowBlank});a.endFieldConfig=a.endFieldConfig||{};a.endFieldConfig.listeners=Zarafa.core.Util.mergeListeners(a.endFieldConfig.listeners,{select:this.onEndSelect,scope:this});a.endFieldConfig=Ext.applyIf(a.endFieldConfig||{},{xtype:"datefield",fieldLabel:_("End date"),labelWidth:this.labelWidth,emptyText:_("None"),format:this.dateFormat,allowBlank:a.allowBlank||this.allowBlank});a.allowBlank&&!Ext.isDefined(a.defaultValue)&&Ext.applyIf(a,{defaultValue:new Zarafa.core.DateRange({allowBlank:!0}),
defaultPeriod:30});Zarafa.common.ui.DatePeriodField.superclass.constructor.call(this,a)},onStartSelect:function(a,b){this.onStartChange(a,b,a.startValue)},onEndSelect:function(a,b){this.onEndChange(a,b,a.startValue)},onStartChange:function(a,b,c){a=this.defaultValue;c=this.defaultValue.clone();if(a.getStartDate()!=b){if(Ext.isEmpty(b))a.setStartDate(null);else{var d=a.getDueTime();b=b.clearTime(!0);if(d){var e=a.getDuration();0!==e?(d=b.add(Date.MILLI,e),a.set(b,d)):b.getTime()>d?a.set(b,b.clone()):
a.setStartDate(b)}else a.set(b,b.clone())}this.fireEvent("change",this,a.clone(),c)}},onEndChange:function(a,b,c){a=this.defaultValue;c=this.defaultValue.clone();if(a.getDueDate()!=b){if(Ext.isEmpty(b))a.set(null,null);else{var d=a.getStartTime(),e=a.getDuration();b=b.clearTime(!0);d&&0!==e&&b.getTime()<d?(d=b.add(Date.MILLI,-e),a.set(d,b)):a.setDueDate(b)}this.fireEvent("change",this,a.clone(),c)}}});Ext.reg("zarafa.dateperiodfield",Zarafa.common.ui.DatePeriodField);Ext.ns("Zarafa.common.ui");
Zarafa.common.ui.DateTimeField=Ext.extend(Zarafa.common.ui.CompositeField,{enableTimeSelection:!0,defaultValue:void 0,minValue:void 0,maxValue:void 0,dateFormat:_("d/m/Y"),timeFormat:_("G:i"),timeIncrement:15,dateFieldConfig:{},timeFieldConfig:{},constructor:function(a){a=a||{};Ext.apply(this,a);Ext.isDefined(this.defaultValue)&&!Ext.isDate(this.defaultValue)&&(this.defaultValue=Date.parseDate(this.defaultValue,this.dateFormat+" "+this.timeFormat));Ext.isDefined(this.minValue)&&!Ext.isDate(this.minValue)&&
(this.minValue=Date.parseDate(this.minValue,this.dateFormat+" "+this.timeFormat));Ext.isDefined(this.maxValue)&&!Ext.isDate(this.maxValue)&&(this.maxValue=Date.parseDate(this.maxValue,this.dateFormat+" "+this.timeFormat));a.hideLabels=!0;var b=[];if(!a.hideLabel&&a.fieldLabel&&"form"!==this.ownerCt.layout){var c=a.labelConfig||{},c=Ext.applyIf(c,{xtype:"label",text:a.fieldLabel+(a.labelSeparator||":")||""});a.labelWidth?c.width=a.labelWidth:c.autoWidth=!0;b.push(c)}b=b.concat([Ext.apply({xtype:"datefield",
ref:"dateField",flex:1,format:this.dateFormat,value:this.defaultValue,minValue:this.minValue,maxValue:this.maxValue,listeners:{change:this.onDateChange,select:this.onDateSelect,scope:this},hideLabel:!0,hideLabels:!0},this.dateFieldConfig),Ext.apply({xtype:"zarafa.spinnerfield",ref:"timeField",width:85,defaultValue:this.defaultValue,minValue:this.minValue,maxValue:this.maxValue,incrementValue:this.timeIncrement,alternateIncrementValue:1,plugins:[{ptype:"zarafa.timespinner",format:this.timeFormat}],
listeners:{change:this.onTimeChange,spin:this.onTimeSpin,scope:this}},this.timeFieldConfig)]);a=Ext.applyIf(a,{isSingleValued:!0,hideLabels:!0,items:b});Ext.apply(this,a);Zarafa.common.ui.DateTimeField.superclass.constructor.call(this,a)},doDateChange:function(a,b){var c,d;this.enableTimeSelection?(d=this.timeField.getValue(),c=this.combineDateAndTime(b,d),d=this.combineDateAndTime(a,d)):(c=b,d=a);Ext.isDefined(d)&&(d>this.maxValue?d=this.maxValue:d<this.minValue&&(d=this.minValue),this.timeField.setValue(d),
this.fireEvent("change",this,d,c))},doTimeChange:function(a,b){this.dateField.setValue(a);this.fireEvent("change",this,a,b)},onDateChange:function(a,b,c){this.doDateChange(b,c)},onDateSelect:function(a,b){this.doDateChange(b,a.startValue)},onTimeChange:function(a,b,c){this.doTimeChange(b,c)},onTimeSpin:function(a){var b=a.field.startValue;a=a.field.getValue();this.doTimeChange(a,b)},setValue:function(a){this.dateField.setValue(a);this.enableTimeSelection&&this.timeField.setValue(a)},setRawValue:function(a){this.dateField.setRawValue(a);
this.enableTimeSelection&&this.timeField.setRawValue(a)},getValue:function(){return this.enableTimeSelection?this.timeField.getValue():this.dateField.getValue()},getRawValue:function(){return this.enableTimeSelection?this.timeField.getRawValue():this.dateField.getRawValue()},combineDateAndTime:function(a,b){Ext.isDate(a)&&(a=a.format(this.dateFormat));Ext.isDate(b)&&(b=b.format(this.timeFormat));if(Ext.isDefined(a)&&Ext.isDefined(b))return Date.parseDate(a+" "+b,this.dateFormat+" "+this.timeFormat)},
setEnabledTimeSelection:function(a){this.enableTimeSelection=a;this.rendered&&(this.timeField.setVisible(a),this.doLayout())},addClass:function(a){this.timeField.addClass(a);this.dateField.addClass(a)},removeClass:function(a){this.timeField.removeClass(a);this.dateField.removeClass(a)}});Ext.reg("zarafa.datetimefield",Zarafa.common.ui.DateTimeField);Ext.ns("Zarafa.common.ui");
Zarafa.common.ui.DateTimePeriodField=Ext.extend(Zarafa.common.ui.DateRangeField,{enableTimeSelection:!0,dateFormat:_("d/m/Y"),timeFormat:_("G:i"),timeIncrement:30,constructor:function(a){a=a||{};a.hideLabels=!0;Ext.apply(this,a);a.startFieldConfig=Ext.applyIf(a.startFieldConfig||{},{xtype:"zarafa.datetimefield",fieldLabel:_("Start date"),enableTimeSelection:this.enableTimeSelection,dateFormat:this.dateFormat,timeFormat:this.timeFormat,timeIncrement:this.timeIncrement});a.endFieldConfig=Ext.applyIf(a.endFieldConfig||
{},{xtype:"zarafa.datetimefield",fieldLabel:_("End date"),enableTimeSelection:this.enableTimeSelection,dateFormat:this.dateFormat,timeFormat:this.timeFormat,timeIncrement:this.timeIncrement});Zarafa.common.ui.DateTimePeriodField.superclass.constructor.call(this,a)},setEnabledTimeSelection:function(a){this.enableTimeSelection=a;this.rendered?(this.startField.setEnabledTimeSelection(a),this.endField.setEnabledTimeSelection(a)):(this.get(0).setEnabledTimeSelection(a),this.get(1).setEnabledTimeSelection(a))}});
Ext.reg("zarafa.datetimeperiodfield",Zarafa.common.ui.DateTimePeriodField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.EditorTreeGrid=Ext.extend(Zarafa.common.ui.TreeGrid,{clicksToEdit:2,activeEditor:void 0,editing:!1,autoEncode:!1,constructor:function(a){this.addEvents("beforeedit","afteredit","validateedit");Zarafa.common.ui.EditorTreeGrid.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.common.ui.EditorTreeGrid.superclass.initEvents.call(this);this.mon(this.colResizer.tracker,"dragstart",this.stopEdit,this,[!0]);if(1==this.clicksToEdit)this.on("click",this.onClickEdit,this);else this.on("dblclick",
this.onClickEdit,this)},onClickEdit:function(a,b){if(a.leaf){var c=Ext.get(b.target);"TD"!==c.dom.nodeName&&(c=c.parent("td"));var d=c.parent("tr"),c=[].slice.call(d.dom.childNodes).indexOf(c.dom);this.startEdit(a,c)}},startEdit:function(a,b){this.stopEdit();if(this.isCellEditable(a,b)&&!1!==this.fireEvent("beforeedit",this,a,b)){this.editing=!0;var c=this.getCellEditor(a,b);if(c){c.rendered||this.mon(c,{render:this.onEditRender,complete:this.onEditComplete,canceledit:this.stopEdit.createDelegate(this,
[!0]),scope:this});Ext.apply(c,{node:a,column:b});this.activeEditor=c;var d=this.preEditValue(a,b);c.startEdit(this.getCell(a,b),d)}}},onEditRender:function(a){a.field.focus();this.mon(a.field.el,"mousedown",function(){a.selectSameEditor=!0;(function(){delete a.selectSameEditor;a.field.focus()}).defer(50)})},stopEdit:function(a){if(!0===this.editing){var b=this.activeEditor;if(b)b[!0===a?"cancelEdit":"completeEdit"]();this.activeEditor=null}this.editing=!1},onEditComplete:function(a,b,c){var d=a.node;
a=a.column;this.editing=!1;this.activeEditor=null;b=this.postEditValue(d,a,b,c);if(String(b)!==String(c)&&!1!==this.fireEvent("validateedit",this,d,a,b)){c=this.getColumn(a);d.attributes[c.dataIndex]=b;if(c.tpl){var e={};e[c.dataIndex]=b;this.getCell(d,a).innerHTML=c.tpl.apply(e)}else this.getCell(d,a).innerHTML=b;this.fireEvent("afteredit",this,d,a,b)}},preEditValue:function(a,b){var c=a.attributes[this.getColumn(b).dataIndex];return this.autoEncode&&Ext.isString(c)?Ext.util.Format.htmlDecode(c):
c},postEditValue:function(a,b,c,d){return this.autoEncode&&Ext.isString(c)?Ext.util.Format.htmlEncode(c):c},isCellEditable:function(a,b){return!0===this.getColumn(b).editable},getColumn:function(a){return this.columns[a]},getCell:function(a,b){return a.ui.elNode.childNodes[b].firstChild},getEditor:function(a,b){return this.columns[b].editor},getCellEditor:function(a,b){var c=this.getEditor(a,b);c&&!c.startEdit&&(c.gridEditor||(c.gridEditor=new Ext.grid.GridEditor(c,{cls:"x-grid-editor"})),c=c.gridEditor);
return c}});Ext.reg("zarafa.editortreegrid",Zarafa.common.ui.EditorTreeGrid);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.HtmlEditor=Ext.extend(Ext.ux.form.TinyMCETextArea,{defaultFontFamily:void 0,defaultFontSize:void 0,constructor:function(a){a=a||{};var b=Zarafa.common.ui.htmleditor.Fonts.getFontSizeString(),c=Zarafa.common.ui.htmleditor.Fonts.getFontFamilies(),d=container.getServerConfig().getPowerpasteConfig(),e=container.getServerConfig().getBaseUrl(),f="";if(Ext.isGecko&&!Ext.isIE&&!Ext.isEdge||!Zarafa.wingdingsInstalled)f="@font-face {font-family: 'Wingdings';src: url('"+e+"client/resources/fonts/kopanowebappdings.eot');src: url('"+
e+"client/resources/fonts/kopanowebappdings.eot?#iefix') format('embedded-opentype'),url('"+e+"client/resources/fonts/kopanowebappdings.woff2') format('woff2'),url('"+e+"client/resources/fonts/kopanowebappdings.woff') format('woff'),url('"+e+"client/resources/fonts/kopanowebappdings.ttf') format('truetype');font-weight: normal;font-style: normal;}";a=Ext.applyIf(a,{xtype:"zarafa.tinymcetextarea",hideLabel:!0,hideMode:"offsets",readOnly:!1,tinyMCEConfig:{delta_height:1,plugins:["advlist emoticons directionality lists image charmap searchreplace textcolor table"],
external_plugins:{link:"../tinymce-plugins/link/plugin.js",powerpaste:"../tinymce-plugins/powerpaste/plugin.min.js"},powerpaste_word_import:d.powerpaste_word_import,powerpaste_html_import:d.powerpaste_html_import,powerpaste_allow_local_images:d.powerpaste_allow_local_images,toolbar1:"fontselect fontsizeselect | bold italic underline strikethrough | subscript superscript | forecolor backcolor | alignleft aligncenter alignright alignjustify | outdent indent | ltr rtl | bullist numlist | table | searchreplace | link unlink | undo redo | charmap emoticons image hr removeformat",
extended_valid_elements:"a[name|href|target|title|onclick|dir],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style],table[style|dir|class|border=1|cellspacing|cellpadding|bgcolor|id],colgroup,col[style|dir|width],tbody,tr[style|dir|class],td[style|dir|class|colspan|rowspan|width|height],hr[class|width|size|noshade],font[face|size|color|style|dir],span[class|align|style|dir|br],p[class|style|dir|span|br]",paste_data_images:!0,automatic_uploads:!1,remove_trailing_brs:!1,
valid_children:"+body[style]",font_formats:c,fontsize_formats:b,browser_spellcheck:!0,menubar:!1,statusbar:!1,skin:"white",visual_anchor_class:"zarafa_tinymce_anchor",relative_urls:!1,remove_script_host:!1,forced_root_block:"P",forced_root_block_attrs:{style:"padding: 0; margin: 0;"},content_style:f+"body{ word-wrap: break-word;}p,blockquote{font-family : initial;font-size : medium;}td, th, p{font-family : inherit !important;font-size : inherit !important;}",table_default_styles:{width:"10%",borderSpacing:0}},
defaultFontFamily:container.getSettingsModel().get("zarafa/v1/main/default_font"),defaultFontSize:Zarafa.common.ui.htmleditor.Fonts.getDefaultFontSize()});b=container.getSettingsModel().get("zarafa/v1/main/language",!0);b=Zarafa.common.ui.htmleditor.LanguageMap.getTinyLanguageCode(b);Ext.isEmpty(b)||(a.tinyMCEConfig.language=b,a.tinyMCEConfig.language_url=e+"client/tinymce-languages/"+b+".js");container.populateInsertionPoint("common.htmleditor.tinymceconfig",{scope:this,config:a.tinyMCEConfig});
this.addEvents("valuecorrection");Zarafa.common.ui.HtmlEditor.superclass.constructor.call(this,a);this.on("initialized",this.onEditorInitialized,this);this.on("beforedestroy",this.onBeforeDestroy,this)},onEditorInitialized:function(a,b){container.getServerConfig().getClientTimeout()&&this.setIdleTimeEventListeners();b.on("keydown",this.onKeyDown.createDelegate(this),this);b.on("paste",this.onPaste.createDelegate(this),this);b.on("mousedown",this.relayIframeEvent.createDelegate(this),this);Ext.each(b.buttons.table.menu,
function(a,c){"Cell"===a.text&&delete b.buttons.table.menu[c]},this);Zarafa.isDeskApp&&this.getEditor().iframeElement.contentWindow.addEventListener("wheel",this.relayIframeEvent.createDelegate(this),!0);if(Ext.isGecko&&(b.on("dblclick",this.onDBLClick.createDelegate(this)),container.mainPanel)){var c=container.getTabPanel();this.mon(c,"beforetabchange",this.onBeforeTabChange,this)}c={blur:this.onBlur,focus:this.onFocus,scope:this};Ext.EventManager.on(this.getEditor().getWin(),c);b._hasCaretEvents=
!0;b.on("focus",this.onFocus.createDelegate(this),this);b.on("blur",this.onBlur.createDelegate(this),this);var c=b.theme.panel.find(".toolbar-grp")[0].items()[0].items(),d=c[1];c[0].on("select",this.onFontFamilyChange.createDelegate(this),this);d.on("select",this.onFontSizeChange.createDelegate(this),this);this.applyFontStyles();(new Ext.util.DelayedTask(this.applyEmptyLines,this,[b])).delay(5)},setIdleTimeEventListeners:function(){var a=this.getEditorDocument();a.addEventListener&&(a.addEventListener("click",
function(){Zarafa.idleTime=0},!0),a.addEventListener("mousemove",function(){Zarafa.idleTime=0},!0),a.addEventListener("keydown",function(){Zarafa.idleTime=0},!0))},onBeforeDestroy:function(){var a=this.getEditor();a&&a.remove()},onPaste:function(a){var b=this.getEditor();if(b.editorManager.Env.webkit&&a.clipboardData&&a.clipboardData.types){var c=a.clipboardData.getData("text/html");if(Ext.isEmpty(c)){var d=a.clipboardData.getData("text");if(d&&0<d.length)b.once("BeforePastePreProcess",function(a){var b=
d.replace(/\n/g,"<br/>").replace(/\s/g,"&nbsp;");a.content=b;return a})}}if(Ext.isIE){var e=this.defaultFontFamily,f=this.defaultFontSize;b.once("BeforePastePreProcess",function(a){var c=a.content.replace(/<p>|<P>/g,'<p style="margin: 0px; padding: 0px; data-mce-style="margin: 0px; padding: 0px;">'+('<span style="font-family:'+e+"; font-size:"+f+'; data-mce-style="font-family:'+e+"; font-size:"+f+";>")).replace(/<\/p>|<\/P>/g,'<br data-mce-bogus="1"></span></p>');a.content=c;b.once("NodeChange",function(a){a=
b.selection.getNode();(a=b.dom.getParent(a,"p"))&&a.nextSibling&&b.selection.setCursorLocation(a.nextSibling.firstChild,0)});return a})}},onFontFamilyChange:function(a){this.defaultFontFamily=a.control.settings.value},onFontSizeChange:function(a){this.defaultFontSize=a.control.settings.value},addEmptyLineBeforeContent:function(){var a=this.getEditor(),b=a.getBody().firstChild,c=a.dom.create("p",a.settings.forced_root_block_attrs,'<br data-mce-bogus="1" />');a.getBody().insertBefore(c,b);a.selection.setCursorLocation(a.getBody().firstChild,
0);this.composeDefaultFormatting(a)},applyEmptyLines:function(a){if(!this.isDisabled()&&this.record&&this.record.phantom){var b=Ext.isDefined(this.record.getMessageAction)?this.record.getMessageAction("action_type"):!1;if(Zarafa.mail.data.ActionTypes.isSendOrForward(b))this.addEmptyLineBeforeContent(),this.addEmptyLineBeforeContent();else if(Ext.isEmpty(a.getContent())||b===Zarafa.mail.data.ActionTypes.EDIT_AS_NEW){var c=document.activeElement;a.selection.setCursorLocation(a.getBody().firstChild,
0);this.composeDefaultFormatting(a);Ext.isIE11&&Ext.defer(function(){c.focus()},1,this)}else this.addEmptyLineBeforeContent();this.checkValueCorrection(this,"");a.undoManager.clear()}},composeDefaultFormatting:function(a){a.execCommand("FontSize",!1,this.defaultFontSize,{skip_focus:!0});a.execCommand("FontName",!1,this.defaultFontFamily,{skip_focus:!0});this.repositionBrTag(a)},repositionBrTag:function(a){var b=a.selection.getNode();a.dom.add(b,"br");var c=a.dom.getParent(b,"p");c&&"BR"===c.lastChild.nodeName&&
c.removeChild(c.lastChild);Ext.isIE11&&a.selection.setCursorLocation(b,0)},setValue:function(a){var b=this;this.withEd(function(){var c=b.getEditor();c&&c.getContent()===a||(Zarafa.common.ui.HtmlEditor.superclass.setValue.call(this,a),b.rendered&&b.checkValueCorrection(this,a))})},enable:function(){if(this.disabled){Zarafa.common.ui.HtmlEditor.superclass.enable.apply(this,arguments);var a=this.getEditor();a.selection.lastFocusBookmark=null;Ext.isEmpty(a.getContent())&&this.applyEmptyLines(a)}},checkValueCorrection:function(a,
b){var c=a.getValue();b!==c&&a.fireEvent("valuecorrection",a,c,b)},onDBLClick:function(){var a=this.getEditor(),b=a.selection.getStart(),c=""===a.selection.getContent({format:"text"});b===a.getBody().firstChild&&c&&a.selection.setCursorLocation(b.firstChild.firstChild,0)},relayIframeEvent:function(a){Ext.getDoc().fireEvent(a.type,a)},onKeyDown:function(a){var b=this.getEditor();if(a.keyCode===Ext.EventObject.BACKSPACE||a.keyCode===Ext.EventObject.DELETE){if(Ext.isIE11||Ext.isEdge){var c=b.selection.getRng(),
d=b.getBody();c.startContainer===d&&(c=b.dom.createRng(),c.selectNodeContents(d),b.selection.setRng(c))}(function(){var a=b.getContent({format:"text"});if(Ext.isEmpty(a)||"\n"===a||" &#13;"===a)b.setContent(""),this.applyFontStyles(),b.selection.setCursorLocation(b.getBody().firstChild,0),this.composeDefaultFormatting(b);else if(a=b.selection.getNode(),"P"===a.nodeName)a.hasChildNodes()&&"BR"!==a.firstChild.nodeName||(this.composeDefaultFormatting(b),this.getEditorDocument().execCommand("Delete",
!1,null));else if("SPAN"===a.nodeName&&a.hasChildNodes()&&"BR"===a.firstChild.nodeName){var c=this.getEditorDocument().createTextNode("");a.insertBefore(c,a.firstChild)}}).createDelegate(this).defer(1)}if(a.keyCode===Ext.EventObject.ENTER){if(a.ctrlKey||Ext.isMac&&a.metaKey)return a.preventDefault(),!1;if(this.inBlockquote(b))return a.preventDefault(),this.handleEnterInBlockquote(),!1;(function(){var a=b.selection.getNode();"P"===a.nodeName?a.hasChildNodes()&&"BR"!==a.firstChild.nodeName||this.composeDefaultFormatting(b):
"SPAN"===a.nodeName&&a.hasChildNodes()&&"BR"===a.firstChild.nodeName?a.firstChild.removeAttribute("data-mce-bogus"):(a=b.dom.getParent(a,"p"),(a=b.dom.getPrev(a,"p"))&&a.hasChildNodes()&&"SPAN"===a.firstChild.nodeName&&a.firstChild.hasChildNodes()&&"BR"===a.firstChild.firstChild.nodeName&&a.firstChild.firstChild.removeAttribute("data-mce-bogus"))}).createDelegate(this).defer(1)}if(a.keyCode!==Ext.EventObject.TAB||a.shiftKey)this.fireEvent("keypress",this,Ext.EventObject);else if(!b.dom.getParent(b.selection.getStart(),
"LI,DT,DD"))for(b.dom.events.cancel(a),a=0;3>=a;a++)b.execCommand("mceInsertContent",!1,"&nbsp;")},inBlockquote:function(a){var b=a.selection.getNode();a="BLOCKQUOTE"===b.nodeName?b:a.dom.getParent(b,"BLOCKQUOTE",a.getBody());return null!==a?a:!1},splitBlockquote:function(a,b){a.selection.setContent('<span id="zarafa-splitter"></span>');var c=a.dom.get("zarafa-splitter");a.dom.split(b,c);var d=a.dom.getPrev(c,"blockquote"),e=a.dom.getNext(c,"blockquote");d&&a.dom.setStyle(d,"margin-bottom","1em");
e&&(a.dom.setStyle(e,"margin-top","1em"),d=e.firstChild)&&("DIV"===d.nodeName&&a.dom.hasClass(d,"bodyclass")&&(d=d.firstChild),d&&d.firstChild&&"BR"===d.firstChild.nodeName&&(a.dom.remove(d.firstChild),"SPAN"===d.nodeName&&a.dom.isEmpty(d)&&a.dom.remove(d)));d=a.dom.create("p",a.settings.forced_root_block_attrs,'<br data-mce-bogus="1" />');a.dom.replace(d,c);a.selection.select(d)},handleEnterInBlockquote:function(){var a=this.getEditor(),b=this.inBlockquote(a);a.undoManager.add();a.undoManager.transact(function(){for(;b;)this.splitBlockquote(a,
b),b=this.inBlockquote(a);var c=a.selection.getNode();a.selection.setCursorLocation(c)}.createDelegate(this))},onBlur:function(){if(!0!==this.isDestroyed&&!this.getEditor().removed){if(!0===this.hasFocus){var a=this.getRawValue();a.length===this.originalValue.length&&a===this.originalValue||this.fireEvent("change",this,a,this.originalValue)}this.hasFocus=!1;this.fireEvent("blur",this)}},onFocus:function(){!0!==this.hasFocus&&(this.originalValue=this.getRawValue(),this.hasFocus=!0,this.fireEvent("focus",
this),this.isTabChanged&&(this.getEditor().selection.setCursorLocation(),this.isTabChanged=!1))},setCursorLocation:function(){var a=this.getEditor();if(a)this.withEd(function(){a.fire("focusin",{})});else this.on("initialized",function(){var a=this.ownerCt;a.focus.defer(1,a);a.fireEvent("setAutoFocusCursor",a.getEditor())},this)},getEditorDocument:function(){return this.getEditor().getDoc()},getEditorBody:function(){return this.getEditor().getBody()},bindRecord:function(a){this.record=a},onBeforeTabChange:function(){this.isTabChanged=
!0;this.hasFocus&&this.getEditor().fire("blur",this)},applyFontStyles:function(){var a=Ext.get(this.getEditorBody());a.setStyle("font-family",this.defaultFontFamily);a.setStyle("font-size",this.defaultFontSize)}});Ext.reg("zarafa.htmleditor",Zarafa.common.ui.HtmlEditor);
Zarafa.onReady(function(){var a=Ext.getBody();a.hasClass("zarafa-webclient")&&(a=a.createChild({id:"tiny-prefetch",style:{width:"10px",height:"10px","z-index":-10,top:"-10000px",left:"-10000px",visibility:"hidden",position:"absolute"}}),new Ext.Panel({xtype:"panel",applyTo:a,layout:"fit",border:!1,flex:1,autoHeight:!1,items:[{xtype:"zarafa.editorfield",ref:"../editorField",flex:1,useHtml:!0}]}))});Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.ImportanceButton=Ext.extend(Zarafa.core.ui.menu.ConditionalItem,{importanceValue:1,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.importancebutton",handler:function(){this.applyFlag(this.getRecords())},scope:this});Zarafa.common.ui.ImportanceButton.superclass.constructor.call(this,a)},applyFlag:function(a){if(!Ext.isEmpty(a)){var b;Ext.each(a,function(a){b=a.getStore();a.set("importance",this.importanceValue)},this);b.save(a)}}});Ext.reg("zarafa.importancebutton",Zarafa.common.ui.ImportanceButton);
Ext.namespace("Zarafa.common.ui");Zarafa.common.ui.ImportanceMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:this.createContextImportanceItems()});Zarafa.common.ui.ImportanceMenu.superclass.constructor.call(this,a)},createContextImportanceItems:function(){var a=[];Ext.each(Zarafa.common.data.ImportanceFlags.flags,function(b){a.push({xtype:"zarafa.importancebutton",text:b.name,importanceValue:b.value,iconCls:b.iconCls})},this);return a}});
Ext.reg("zarafa.importancemenu",Zarafa.common.ui.ImportanceMenu);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.RadioDateTimeField=Ext.extend(Zarafa.common.ui.CompositeField,{constructor:function(a){a=a||{};Ext.apply(this,a);a=Ext.applyIf(a,{items:[{xtype:"radio",boxLabel:" ",ref:"radioField",name:"radioField",listeners:{check:this.onRadioCheck,scope:this}},{xtype:"zarafa.datetimefield",ref:"dateTimeField",cls:"zarafa-radiodatetime-datetimefield",minValue:new Date,width:200,listeners:{change:this.onDateTimeChange,afterrender:this.initEvent,scope:this}}]});Zarafa.common.ui.RadioDateTimeField.superclass.constructor.call(this,
a)},onKeyUp:function(a){var b=Ext.EventObject.keyCode;if(b>=Ext.EventObject.ZERO&&b<=Ext.EventObject.NINE||b>=Ext.EventObject.NUM_ZERO&&b<=Ext.EventObject.NUM_NINE)if(b=a.startValue,a===this.dateTimeField.dateField||Ext.isDefined(a.isValidTimeString)&&a.isValidTimeString())a=a.getValue(),this.dateTimeField.doDateChange(a,b)},onRadioCheck:function(a,b){!0===b&&this.fireEvent("focus",this)},onDateTimeFocus:function(a){this.radioField.setValue(!0);this.fireEvent("focus",this)},onDateTimeChange:function(a,
b,c){a=this.getDateTime();this.fireEvent("change",this,a)},initEvent:function(){var a=this.dateTimeField.timeField,b=this.dateTimeField.dateField;a.enableKeyEvents=!0;b.enableKeyEvents=!0;a.initEvents();b.initEvents();a.on("keyup",this.onKeyUp,this);b.on("keyup",this.onKeyUp,this);a.on("focus",this.onDateTimeFocus,this);b.on("focus",this.onDateTimeFocus,this);a.un("change",this.dateTimeField.onTimeChange,this.dateTimeField);b.un("change",this.dateTimeField.onDateChange,this.dateTimeField)},getDateTime:function(){return this.dateTimeField.getValue()},
setValue:function(a){this.radioField.setValue(!0);this.dateTimeField.setValue(a)},addClass:function(a){this.dateTimeField.addClass(a)},removeClass:function(a){this.dateTimeField.removeClass(a)}});Ext.reg("zarafa.radiodatetimefield",Zarafa.common.ui.RadioDateTimeField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.RadioSpinnerField=Ext.extend(Zarafa.common.ui.CompositeField,{type:void 0,value:void 0,constructor:function(a){a=a||{};Ext.apply(this,a);a=Ext.applyIf(a,{items:[{xtype:"radio",boxLabel:_("in"),ref:"radioField",name:"radioField",inputValue:this.value,listeners:{check:this.onRadioCheck,scope:this}},{xtype:"zarafa.spinnerfield",ref:"spinnerField",defaultValue:1,minValue:1,maxValue:999,incrementValue:1,enableKeyEvents:!0,width:45,plugins:["zarafa.numberspinner"],listeners:{spin:this.onValueChange,
keyup:this.onValueChange,focus:this.onFocus,scope:this}},{xtype:"displayfield",value:this.value}]});Zarafa.common.ui.RadioSpinnerField.superclass.constructor.call(this,a)},onRadioCheck:function(a,b){!0===b&&this.fireEvent("focus",this)},onFocus:function(a){this.radioField.setValue(!0);this.fireEvent("focus",this)},onValueChange:function(a){a=this.getDateTime();this.fireEvent("change",this,a)},getDateTime:function(){var a=this.spinnerField.getValue(),b=new Date;switch(this.type){case "days":return b.add(Date.DAY,
a);case "months":return b.add(Date.MONTH,a);default:return b.add(Date.HOUR,a)}}});Ext.reg("zarafa.radiospinnerfield",Zarafa.common.ui.RadioSpinnerField);Ext.namespace("Zarafa.common.ui");
Zarafa.common.ui.ResizableCompositeField=Ext.extend(Zarafa.common.ui.CompositeField,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.resizablecompositefield"});a.cls=a.cls?a.cls+" zarafa-resizable-compositefield":"zarafa-resizable-compositefield";Ext.apply(this,a);Zarafa.common.ui.ResizableCompositeField.superclass.constructor.call(this,a)},initComponent:function(){for(var a=[],b=this.items,c,d=0,e=b.length;d<e;d++)c=b[d],Ext.isEmpty(c.ref)||(c.ref="../"+c.ref),a.push(c.fieldLabel),Ext.applyIf(c,
this.defaults),d==e-1&&this.skipLastItemMargin||Ext.applyIf(c,{margins:this.defaultMargins});this.fieldLabel=this.fieldLabel||this.buildLabel(a);this.fieldErrors=new Ext.util.MixedCollection(!0,function(a){return a.field});this.fieldErrors.on({scope:this,add:this.updateInvalidMark,remove:this.updateInvalidMark,replace:this.updateInvalidMark});Ext.form.Field.prototype.initComponent.apply(this);this.innerCt=new Ext.Container({layout:"hbox",layoutConfig:{pack:"start",align:"stretch"},items:this.items,
cls:"x-form-composite",defaultMargins:"0 3 0 0",ownerCt:this});delete this.innerCt.ownerCt;a=this.innerCt.findBy(function(a){return a.isFormField},this);this.items=new Ext.util.MixedCollection;this.items.addAll(a);a=this.innerCt.findBy(function(a){return a.isXType("box")},this);this.items.addAll(a);this.innerCt.ownerCt=this;Ext.each(this.items.items,function(a){a.isXType("zarafa.boxfield")&&a.mon(a,"resizeheight",function(){this.onResize();this.ownerCt.doLayout(!1)},this,{delay:0})},this)},onResize:function(a,
b,c,d){Ext.isDefined(this.padding)||(this.padding=this.getEl().getPadding("tb"));var e=this.innerCt,f=0,g=e.items;g.items&&(g=g.items);Ext.each(g,function(a){var b=0,c=0;a.getResizeEl&&a.getResizeEl()&&(b=a.getResizeEl().getHeight(),c=a.getResizeEl().getPadding("tb"));b+c>f&&(f=b+c)},this);f+=this.padding;f!==b&&(b=f);this.rendered&&e.rendered&&e.setSize(a,b);Zarafa.common.ui.ResizableCompositeField.superclass.onResize.apply(this,[a,b,c,d])}});Ext.reg("zarafa.resizablecompositefield",Zarafa.common.ui.ResizableCompositeField);
Ext.ns("Zarafa.common.ui");
Zarafa.common.ui.TimePeriodField=Ext.extend(Zarafa.common.ui.DateRangeField,{timeFormat:_("G:i"),timeIncrement:30,pluginCfg:void 0,constructor:function(a){a=a||{};a.startFieldConfig=a.startFieldConfig||{};a.startFieldConfig.plugins=Ext.value(a.startFieldConfig.plugins,[]);a.startFieldConfig.plugins.push(Ext.applyIf(a.pluginCfg||{},{ptype:"zarafa.timespinner",format:a.timeFormat||this.timeFormat}));a.startFieldConfig.listeners=Ext.value(a.startFieldConfig.listeners,{});a.startFieldConfig.listeners.spin=a.startFieldConfig.listeners.spin?
a.startFieldConfig.listeners.spin.createInterceptor(this.onStartSpin,this):this.onStartSpin.createDelegate(this);Ext.applyIf(a.startFieldConfig,{xtype:"zarafa.spinnerfield",fieldLabel:_("Start time"),width:190,minValue:a.minValue||this.minValue,maxValue:a.maxValue||this.maxValue,incrementValue:a.timeIncrement||this.timeIncrement,alternateIncrementValue:1});a.endFieldConfig=a.endFieldConfig||{};a.endFieldConfig.plugins=Ext.value(a.endFieldConfig.plugins,[]);a.endFieldConfig.plugins.push(Ext.applyIf(a.pluginCfg||
{},{ptype:"zarafa.timespinner",format:a.timeFormat||this.timeFormat}));a.endFieldConfig.listeners=Ext.value(a.endFieldConfig.listeners,{});a.endFieldConfig.listeners.spin=a.endFieldConfig.listeners.spin?a.endFieldConfig.listeners.spin.createInterceptor(this.onEndSpin,this):this.onEndSpin.createDelegate(this);a.endFieldConfig=Ext.applyIf(a.endFieldConfig||{},{xtype:"zarafa.spinnerfield",fieldLabel:_("End time"),width:190,minValue:a.minValue||this.minValue,maxValue:a.maxValue||this.maxValue,incrementValue:a.timeIncrement||
this.timeIncrement,alternateIncrementValue:1});Zarafa.common.ui.TimePeriodField.superclass.constructor.call(this,a)},onStartSpin:function(a){this.onStartChange(a.field,a.field.getValue(),a.field.startValue)},onEndSpin:function(a){this.onEndChange(a.field,a.field.getValue(),a.field.startValue)}});Ext.reg("zarafa.timeperiodfield",Zarafa.common.ui.TimePeriodField);Ext.namespace("Zarafa.common.ui.grid");
Zarafa.common.ui.grid.MapiMessageGrid=Ext.extend(Zarafa.common.ui.grid.GridPanel,{categoryTooltip:null,supportLiveScroll:!1,timer:void 0,sliderDuration:5E3,sliderDirection:"b",constructor:function(a){a=a||{};Ext.applyIf(a,{view:new Zarafa.common.ui.grid.GridView(a.viewConfig)});Zarafa.common.ui.grid.MapiMessageGrid.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.common.ui.grid.MapiMessageGrid.superclass.initEvents.call(this);this.mon(this.getView().scroller,"scroll",this.onScroll,
this);this.on({afterrender:this.onRenderGrid,cellcontextmenu:this.onCellContextMenu,scope:this});0<=this.getColumnModel().getIndexById("categories")&&(this.on({viewready:this.resizeCategoryLabels,resize:this.resizeCategoryLabels,columnresize:this.resizeCategoryLabels,scope:this}),this.mon(this.store,"load",this.resizeCategoryLabels,this))},onRenderGrid:function(a){this.categoryTooltip=new Zarafa.common.categories.ui.Tooltip({target:a.getView().mainBody})},onCellContextMenu:function(a,b,c,d){a=this.getSelectionModel();
var e=this.getColumnModel();a.isSelected(b)||a.selectRow(b);b=0<=c?e.getDataIndex(c):void 0;c=a.getSelections();switch(b){case "importance":Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.importance"],c,{position:d.getXY()});break;default:b=Ext.get(d.target),b.hasClass("k-category-block")?Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.category"],c,{category:b.dom.textContent,position:d.getXY()}):
Zarafa.core.data.UIFactory.openDefaultContextMenu(c,{position:d.getXY(),context:this.context,actsOnTodoListFolder:this.model.getDefaultFolder().isTodoListFolder()})}},resizeCategoryLabels:function(){var a=this.getColumnModel(),b=a.findColumnIndex("categories");if(-1!==b&&!a.isHidden(b)){var c=a.getColumnWidth(b)-16,a=this.getView().getRows();Ext.each(a,function(a){var b=a.querySelectorAll(".k-category-block");Ext.isEmpty(b[0])||this.resizeCategoryLabelsInRow(a,b,c)},this)}},resizeCategoryLabelsInRow:function(a,
b,c){a=b.length;this.labelMarginRight=this.labelMarginRight||parseFloat(window.getComputedStyle(b[0]).marginRight);this.labelPaddingLeftRight=this.labelPaddingLeftRight||parseFloat(window.getComputedStyle(b[0]).paddingLeft)+parseFloat(window.getComputedStyle(b[0]).paddingRight);var d=(c+this.labelMarginRight)/a-this.labelMarginRight-this.labelPaddingLeftRight,e=0,f=[];Ext.each(b,function(a,b){var c=a.style.maxWidth;a.style.maxWidth="none";var g=parseFloat(window.getComputedStyle(a).width);g<d&&(f.push(b),
e+=d-g);a.style.maxWidth=c},this);d+=e/(a-f.length);Ext.each(b,function(a,b){-1<f.indexOf(b)?a.style.maxWidth="":a.style.maxWidth=d+"px"},this)},onScroll:function(){container.getSettingsModel().get("zarafa/v1/contexts/mail/enable_live_scroll")&&this.supportLiveScroll&&(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(a){a.ghost("b",{remove:!0})},this.sliderDuration,this.getSlider()))},getSlider:function(){var a=this.getStore(),a=String.format(_("Loaded {0} of {1}"),a.getRange().length,
a.getTotalCount()),a=String.format("<div>{0}</div>",a),b=this.getSliderEl();if(b)b.dom.innerHTML=a;else{var b=this.id+"-k-slider",c=this.getEl(),b=Ext.DomHelper.insertFirst(c,{id:b,cls:"k-slider",html:a},!0);b.alignTo(c,this.sliderDirection+"-"+this.sliderDirection,[-8,0]);b=b.slideIn(this.sliderDirection)}return b},getSliderEl:function(){var a=Ext.DomQuery.select("#"+(this.id+"-k-slider")).shift();return Ext.get(a)},onResize:function(){Zarafa.common.ui.grid.MapiMessageGrid.superclass.onResize.apply(this,
arguments);var a=this.getSliderEl();a&&a.alignTo(this.getEl(),this.sliderDirection+"-"+this.sliderDirection,[-8,0])}});Ext.reg("zarafa.mapimessagegrid",Zarafa.common.ui.grid.MapiMessageGrid);Ext.namespace("Zarafa.common.ui.layout");Zarafa.common.ui.layout.SwitchBorderLayout.Orientation=Zarafa.core.Enum.create({OFF:"off",VERTICAL:"vertical",HORIZONTAL:"horizontal"});Ext.namespace("Zarafa.common.ui.layout");
Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion=Ext.extend(Ext.layout.BorderLayout.Region,{hidden:void 0,oldSize:void 0,setVisible:function(a){var b=this.hidden;this.hidden=!1===a;b!==this.hidden&&(this.hidden?this.oldSize="north"===this.position||"south"===this.position?this.panel.getHeight():this.panel.getWidth():(this.panel.region=this.position,"north"===this.position||"south"===this.position?this.panel.setHeight(this.oldSize||this.panel.height):this.panel.setWidth(this.oldSize||this.panel.width)))},
isVisible:function(){return Ext.isDefined(this.hidden)?!this.hidden:!this.panel.hidden},getSize:function(){var a=Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion.superclass.getSize.call(this);return this.restrictSize(a)},restrictSize:function(a){var b=this.panel,c=this.layout.center.panel,d=this.targetEl,e=this.splitEl;"north"===this.position||"south"===this.position?a.height>=d.getHeight()&&(a.height=b.height?b.height:Math.min(b.maxHeight||0,d.getHeight()-(c.minHeight||c.height)),a.height-=
e.dom.offsetHeight):a.width>=d.getWidth()&&(a.width=b.width?b.width:Math.min(b.maxWidth||0,d.getWidth()-(c.minWidth||c.width)),a.width-=e.dom.offsetWidth);return a}});Ext.namespace("Zarafa.common.ui.messagepanel");
Zarafa.common.ui.messagepanel.ExtraInfoContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{constructor:function(a){a=a||{};a.records&&Array.isArray(a.records)&&(a.records=a.records[0]);Ext.applyIf(a,{items:[{xtype:"zarafa.conditionalitem",text:_("Download Pictures"),handler:this.showPictures,scope:this},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",text:_("Add Sender to Safe Senders List"),handler:this.addSenderToSafeList,scope:this},{xtype:"zarafa.conditionalitem",text:_("Add Domain to Safe Senders List"),
handler:this.addDomainToSafeList,scope:this}]});Zarafa.common.ui.messagepanel.ExtraInfoContextMenu.superclass.constructor.call(this,a)},showPictures:function(){var a=this.records.calculateBlockStatus();a&&(this.records.set("block_status",a),this.records.save())},addSenderToSafeList:function(){var a=this.records.get("sent_representing_email_address")||this.records.get("sender_email_address");if(!Ext.isEmpty(a)){var b=container.getSettingsModel().get("zarafa/v1/contexts/mail/safe_senders_list",!0);
Ext.isEmpty(b)?b=[a]:b.push(a);container.getSettingsModel().set("zarafa/v1/contexts/mail/safe_senders_list",b);this.records.afterEdit()}},addDomainToSafeList:function(){var a=this.records.get("sent_representing_email_address")||this.records.get("sender_email_address"),a=a.substr(a.indexOf("@")+1);if(!Ext.isEmpty(a)){var b=container.getSettingsModel().get("zarafa/v1/contexts/mail/safe_senders_list",!0);Ext.isEmpty(b)?b=[a]:b.push(a);container.getSettingsModel().set("zarafa/v1/contexts/mail/safe_senders_list",
b);this.records.afterEdit()}}});Ext.reg("zarafa.extrainfocontextmenu",Zarafa.common.ui.messagepanel.ExtraInfoContextMenu);Ext.namespace("Zarafa");Zarafa.ABOUT='<p>Copyright (C) 2005 - 2016 Zarafa B.V. &lt;info@zarafa.com&gt; and its licensors<br>Copyright (C) 2016 Kopano and its licensors</p><p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p><p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.</p><p>You should have received a copy of the GNU Affero General Public License along with this program.  If not, see <a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a>.</p><hr /><p>WebApp contains the following third-party components:</p><h1>Ext JS</h1><p>Copyright (C) Sencha, Inc.  Ext JS is distributed under the terms of the GNU General Public License: <a href="http://www.gnu.org/copyleft/gpl.html" target="_blank">http://www.gnu.org/copyleft/gpl.html</a></p><h1>Printer rendering</h1><p>Copyright (C) 2010 Ed Spencer</p><p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p><p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p><p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p><h1>TinyMCE</h1><p>Copyright, Moxiecode Systems AB. Released under LGPL License: <a href="http://www.tinymce.com/license" target="_blank">http://www.tinymce.com/license</a></p><h1>TinyMCE PowerPaste</h1><p>Copyright (C) 2015 Ephox Corporation</p><p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p><p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.</p>You should have received a copy of the GNU Affero General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a>.</p>';
Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABMultiUserSelectionContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{callback:void 0,convert:void 0,scope:void 0,store:void 0,hideContactsFolders:!1,listRestriction:void 0,selectionCfg:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.abmultiuserselectioncontentpanel",layout:"fit",title:_("Address Book"),items:[{xtype:"zarafa.abmultiuserselectionpanel",hideContactsFolders:a.hideContactsFolders,listRestriction:a.listRestriction,selectionCfg:a.selectionCfg,
callback:a.callback,convert:a.convert,scope:a.scope,store:a.store}]});Zarafa.addressbook.dialogs.ABMultiUserSelectionContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.abmultiuserselectioncontentpanel",Zarafa.addressbook.dialogs.ABMultiUserSelectionContentPanel);Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.ABUserSelectionPanel=Ext.extend(Zarafa.addressbook.ui.AddressBookMainPanel,{callback:Ext.emptyFn,singleSelect:!0,scope:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.abuserselectionpanel",cls:"k-abuserselectionpanel",buttons:[{text:_("Ok"),handler:this.onSubmit,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]});Zarafa.addressbook.ui.ABUserSelectionPanel.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterLayout,this,{single:!0})},
doCallBack:function(){var a=this.getGridPanel();if(a.getSelectionModel().hasSelection())return a=a.getSelectionModel().getSelections(),this.singleSelect?this.callback.call(this.scope||this,a[0]):this.callback.call(this.scope||this,a),!0},onAfterLayout:function(){this.mon(this.getGridPanel(),"rowdblclick",this.onAddressBookRowDblClick,this);this.mon(this.getGridPanel(),"rowcontextmenu",this.onAddressBookRowContextMenu,this)},onAddressBookRowDblClick:function(){!0===this.doCallBack()&&this.dialog.close()},
onAddressBookRowContextMenu:function(a,b,c){a=a.getSelectionModel();a.hasSelection()?a.isSelected(b)||(a.clearSelections(),a.selectRow(b)):a.selectRow(b);Zarafa.core.data.UIFactory.openDefaultContextMenu(a.getSelections(),{position:c.getXY(),dialog:this.dialog})},onSubmit:function(){!0===this.doCallBack()?this.dialog.close():Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("You must select a user."),buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.INFO})},onCancel:function(){this.dialog.close()}});
Ext.reg("zarafa.abuserselectionpanel",Zarafa.addressbook.ui.ABUserSelectionPanel);Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.AddressBookContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{enableSelect:!1,selectHandler:void 0,selectScope:void 0,dialog:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{items:[{xtype:"zarafa.conditionalitem",text:_("Select"),beforeShow:function(a,c){a.setDisabled(!this.enableSelect)},handler:this.onSelect,scope:this},{xtype:"zarafa.conditionalitem",text:_("Show Details"),iconCls:"icon_contact",singleSelectOnly:!0,handler:this.onOpenDetails,scope:this},{xtype:"menuseparator"},
container.populateInsertionPoint("context.addressbook.contextmenu.actions",this)]});Zarafa.addressbook.ui.AddressBookContextMenu.superclass.constructor.call(this,a)},onSelect:function(){Ext.isFunction(this.selectHandler)&&this.selectHandler.call(this.selectScope||this,this.records)},onOpenDetails:function(){Zarafa.addressbook.Actions.openDetailsContent(this.records)}});Ext.reg("zarafa.addressbookcontextmenu",Zarafa.addressbook.ui.AddressBookContextMenu);Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.AddressBookGrid=Ext.extend(Zarafa.common.ui.grid.GridPanel,{singleSelect:!1,constructor:function(a){a=a||{};var b=a.viewConfig||{};Ext.applyIf(b,{scrollDelay:!1,rowHeight:31,borderHeight:1});Ext.applyIf(a,{autoExpandColumn:"full_name",autoExpandMin:100,loadMask:!0,stateful:!0,statefulRelativeDimensions:!1,sm:this.createSelectionModel(a),cm:new Zarafa.addressbook.ui.GABColumnModel,view:new Ext.ux.grid.BufferView(b)});Zarafa.addressbook.ui.AddressBookGrid.superclass.constructor.call(this,
a);this.mon(this.getStore(),"load",this.onStoreLoad,this);this.mon(this,"beforerender",function(){Zarafa.core.PresenceManager.registerStore(this.getStore())},this);this.mon(this,"beforedestroy",function(){Zarafa.core.PresenceManager.unregisterStore(this.getStore())},this)},onRender:function(){Zarafa.addressbook.ui.AddressBookGrid.superclass.onRender.apply(this,arguments);var a=this.view.el.down("div").down("div"),a=window.getComputedStyle(a.dom)["border-bottom-width"];this.view.borderHeight=parseFloat(a)},
onStoreLoad:function(a,b,c){b=c&&c.params&&"gab"===c.params.folderType?new Zarafa.addressbook.ui.GABColumnModel:new Zarafa.addressbook.ui.GABPersonalColumnModel;this.colModel.name!==b.name&&this.reconfigure(a,b)},createSelectionModel:function(a){return new Zarafa.common.ui.grid.RowSelectionModel({singleSelect:a.singleSelect})},getSelectedItems:function(){return this.getSelectionModel().getSelections()},getStateName:function(){var a=this.store.lastOptions,b="globaladdressbook";a&&a.params&&a.params.entryid&&
Zarafa.core.EntryId.hasContactProviderGUID(a.params.entryid)&&(b="contacts");return"gab/"+b+"/list"},getState:function(){var a=Zarafa.addressbook.ui.AddressBookGrid.superclass.getState.call(this),b={sort:a.sort};delete a.sort;Ext.apply(b,a[this.getColumnModel().name]);return b},applyState:function(a){if(a){var b={sort:a.sort};delete a.sort;b[this.getColumnModel().name]=a;Zarafa.addressbook.ui.AddressBookGrid.superclass.applyState.call(this,b)}}});Ext.reg("zarafa.addressbookgrid",Zarafa.addressbook.ui.AddressBookGrid);
Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.AddressBookPanel=Ext.extend(Zarafa.addressbook.ui.AddressBookMainPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.addressbookpanel",cls:"k-addressbookpanel"});Zarafa.addressbook.ui.AddressBookPanel.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterLayout,this,{single:!0})},onAfterLayout:function(){this.mon(this.getGridPanel(),"rowdblclick",this.onAddressBookRowDblClick,this);this.mon(this.getGridPanel(),"rowcontextmenu",this.onAddressBookRowContextMenu,
this)},onAddressBookRowDblClick:function(a,b,c){a=a.getStore().getAt(b);Zarafa.addressbook.Actions.openDetailsContent(a)},onAddressBookRowContextMenu:function(a,b,c){a=a.getSelectionModel();a.hasSelection()?a.isSelected(b)||(a.clearSelections(),a.selectRow(b)):a.selectRow(b);Zarafa.core.data.UIFactory.openDefaultContextMenu(a.getSelections(),{position:c.getXY(),dialog:this.dialog})}});Ext.reg("zarafa.addressbookpanel",Zarafa.addressbook.ui.AddressBookPanel);Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.GABColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{name:"globaladdressbook",columns:this.getColumns()});Zarafa.addressbook.ui.GABColumnModel.superclass.constructor.call(this,a)},getColumns:function(){var a=container.populateInsertionPoint("context.addressbook.gridpanel",this),b=[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',sortable:!0,tooltip:_("Sort by: Icon"),width:25,
fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"full_name",id:"full_name",header:_("Name"),sortable:!0,tooltip:_("Sort by: Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"display_name",header:_("Display Name"),sortable:!0,tooltip:_("Sort by: Display Name"),renderer:Zarafa.common.ui.grid.Renderers.displayName,width:250},{dataIndex:"fileas",header:_("File as"),hidden:!0,sortable:!0,tooltip:_("Sort by: File As"),renderer:Ext.util.Format.htmlEncode,width:250},{dataIndex:"given_name",
header:_("First Name"),sortable:!0,hidden:!0,tooltip:_("Sort by: First Name"),renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"surname",header:_("Last Name"),sortable:!0,hidden:!0,tooltip:_("Sort by: Last Name"),renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"smtp_address",header:_("Email Address"),sortable:!0,tooltip:_("Sort by: Email Address"),renderer:Ext.util.Format.htmlEncode,width:250},{dataIndex:"department_name",header:_("Department"),sortable:!0,hidden:!0,tooltip:_("Sort by: Department"),
renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"office_telephone_number",header:_("Office Phone"),sortable:!0,tooltip:_("Sort by: Office Phone"),renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"mobile_telephone_number",header:_("Mobile"),sortable:!0,hidden:!0,tooltip:_("Sort by: Mobile"),renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"home_telephone_number",header:_("Home Phone"),sortable:!0,hidden:!0,tooltip:_("Sort by: Home Phone"),renderer:Ext.util.Format.htmlEncode,
width:150},{dataIndex:"pager_telephone_number",header:_("Pager"),sortable:!0,hidden:!0,tooltip:_("Sort by: Pager"),renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"office_location",header:_("Location"),sortable:!0,hidden:!0,tooltip:_("Sort by: Location"),renderer:Ext.util.Format.htmlEncode,width:150},{dataIndex:"primary_fax_number",header:_("Fax"),sortable:!0,hidden:!0,tooltip:_("Sort by: Fax"),renderer:Ext.util.Format.htmlEncode,width:150}];if(Array.isArray(a)){var c=1;a.forEach(function(d){Ext.isObject(a[0])&&
(b.splice(c,0,d),c+=1)})}return b}});Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.GABPersonalColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{name:"personal_contacts",columns:[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',sortable:!0,tooltip:_("Sort by: Icon"),width:25,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"full_name",id:"full_name",header:_("Name"),sortable:!0,tooltip:_("Sort by: Name"),renderer:Ext.util.Format.htmlEncode},
{dataIndex:"display_name",header:_("Display Name"),sortable:!0,tooltip:_("Sort by: Display Name"),renderer:Ext.util.Format.htmlEncode,width:250},{dataIndex:"fileas",header:_("File as"),sortable:!0,hidden:!0,tooltip:_("Sort by: File As"),renderer:Ext.util.Format.htmlEncode,width:250},{dataIndex:"email_address",header:_("Email Address"),sortable:!0,hidden:!1,tooltip:_("Sort by: Email Address"),renderer:Ext.util.Format.htmlEncode,width:400}]});Zarafa.addressbook.ui.GABPersonalColumnModel.superclass.constructor.call(this,
a)}});Ext.namespace("Zarafa.advancesearch.data");Zarafa.advancesearch.data.SearchComboBoxFieldsFlags=Zarafa.core.Enum.create({ALL_FOLDERS:0,CURRENT_SELECTED_FOLDER:1,IMPORTED_FOLDER:2});Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SearchContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{constructor:function(a){a=a||{};var b="advancesearchtab-"+ ++Ext.Component.AUTO_ID;Ext.applyIf(a,{xtype:"zarafa.searchcontentpanel",layout:"fit",name:b,title:a.searchText,iconCls:"advance_search",border:!1,parentSearchField:a.parentSearchField,parentSearchFolderCombo:a.parentSearchFolderCombo,items:[{xtype:"zarafa.searchpanel",ref:"searchPanel",searchTabId:b,searchFolder:a.searchFolder,searchText:a.searchText,
searchContentPanel:this}]});Zarafa.advancesearch.dialogs.SearchContentPanel.superclass.constructor.call(this,a);this.initEvents()},initEvents:function(){var a=container.getTabPanel();this.mon(a,"tabchange",this.onTabChange,this)},onTabChange:function(a,b){var c=container.getMainToolbar(),d=b.isXType("zarafa.searchcontentpanel");c.searchView.setVisible(d);var e=container.getCurrentContext().getName();switch(e){case "calendar":Ext.each(["Day","Workweek","Week","Month","List"],function(a,b,e){c["calendar"+
a].setVisible(!d)},this);break;default:e=c.get("zarafa-maintoolbar-view-"+e),Ext.isDefined(e)&&e.setVisible(!d)}var f=b.searchPanel;if(Ext.isDefined(f)){var g=f.model,e=g.stores[b.name];Ext.isDefined(e)&&(f=f.centerRegion.switchBorder.searchGrid.getSelectionModel().getSelections(),g.setSelectedRecords(f,!1),g.setActiveStore(e),g=e.searchFolder[b.name],Ext.isDefined(g)&&e.setSearchEntryId(g.get("entryid")))}},setParentSearchField:function(a){this.parentSearchField=a},getParentSearchField:function(){return this.parentSearchField},
getParentSearchFolderCombo:function(){return this.parentSearchFolderCombo}});Ext.reg("zarafa.searchcontentpanel",Zarafa.advancesearch.dialogs.SearchContentPanel);Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.SelectFolderContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.selectfoldercontentpanel",layout:"fit",title:_("Select Folder"),width:300,height:350,items:[{xtype:"zarafa.selectfolderpanel",model:a.model,searchFolderCombo:a.searchFolderCombo}]});Zarafa.advancesearch.dialogs.SelectFolderContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.selectfoldercontentpanel",Zarafa.advancesearch.dialogs.SelectFolderContentPanel);
Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.SearchFolderContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{constructor:function(a){a=a||{};Ext.applyIf(a,{items:[{xtype:"zarafa.conditionalitem",text:_("Delete search folder"),iconCls:"icon_folder_delete",handler:this.onContextItemDeleteFolder,scope:this}]});Zarafa.advancesearch.ui.SearchFolderContextMenu.superclass.constructor.call(this,a)},onContextItemDeleteFolder:function(){var a=this.records,b=a.getStore();b.remove(a);a.removeFromFavorites();b.save(a)}});
Ext.reg("zarafa.searchfoldercontextmenu",Zarafa.advancesearch.ui.SearchFolderContextMenu);Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.SearchGridColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{useCompactView:!1,constructor:function(a){a=a||{};this.defaultColumns=this.createDefaultColumns(a);this.compactColumns=this.createCompactColumns(a);Ext.applyIf(a,{columns:this.defaultColumns});!0===a.useCompactView&&(a.columns=this.compactColumns);Zarafa.advancesearch.ui.SearchGridColumnModel.superclass.constructor.call(this,a)},createDefaultColumns:function(a){a=a.grid;return[{id:"column_icon",dataIndex:"icon_index",
fixed:!0,width:28,renderer:Zarafa.common.ui.grid.Renderers.icon,preventRowSelection:!0},{id:"name",sortable:!1,hideable:!1,width:125,fixed:!0,renderer:Zarafa.advancesearch.ui.SearchGridRenderers.nameColumn},{id:a.getId()+"-col0",sortable:!1,hideable:!1,renderer:Zarafa.advancesearch.ui.SearchGridRenderers.subjectWithBodyColumn},{dataIndex:"hasattach",width:24,renderer:Zarafa.common.ui.grid.Renderers.attachment,fixed:!0},{id:a.getId()+"-col1",dataIndex:"searchdate",header:_("Date"),width:110,fixed:!0,
resizable:!1,sortable:!0,tooltip:_("Sort by: Date"),hideable:!1,renderer:Zarafa.advancesearch.ui.SearchGridRenderers.dateColumn,css:"padding: 0; margin:0;"}]},createCompactColumns:function(a){return[{id:"column_icon",dataIndex:"icon_index",fixed:!0,width:28,renderer:Zarafa.common.ui.grid.Renderers.icon,preventRowSelection:!0},{id:"name",sortable:!1,hideable:!1,renderer:Zarafa.advancesearch.ui.SearchGridRenderers.nameColumn},{dataIndex:"hasattach",width:24,renderer:Zarafa.common.ui.grid.Renderers.attachment,
fixed:!0},{id:a.grid.getId()+"-col1",dataIndex:"searchdate",header:_("Date"),width:110,fixed:!0,resizable:!1,sortable:!0,tooltip:_("Sort by: Date"),hideable:!1,renderer:Zarafa.advancesearch.ui.SearchGridRenderers.dateColumn,css:"padding: 0; margin:0;"},{dataIndex:"flag_due_by",width:24,renderer:Zarafa.common.ui.grid.Renderers.flag,fixed:!0}]},setCompactView:function(a){this.useCompactView!==a&&((this.useCompactView=a)?(this.defaultColumns=this.config,this.columns=this.compactColumns):(this.compactColumns=
this.config,this.columns=this.defaultColumns),this.setConfig(this.columns,!1))}});Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.SearchResultPreviewPanel=Ext.extend(Zarafa.core.ui.PreviewPanel,{constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.searchContext)&&(a.model=a.searchContext.getModel());Ext.applyIf(a,{xtype:"zarafa.searchresultpreviewpanel",cls:"zarafa-previewpanel zarafa-context-mainpanel",recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{enableOpenLoadTask:!0,autoOpenLoadTaskDefer:250}),width:600,height:400,tbar:{height:33,items:[{xtype:"button",
tooltip:_("Reply")+" (Ctrl + R)",overflowText:_("Reply"),iconCls:"icon_replyEmail",ref:"replyBtn",responseMode:Zarafa.mail.data.ActionTypes.REPLY,handler:this.onResponse,scope:this},{xtype:"button",tooltip:_("Reply All")+" (Ctrl + Alt + R)",overflowText:_("Reply All"),iconCls:"icon_replyAllEmail",ref:"replyAllBtn",responseMode:Zarafa.mail.data.ActionTypes.REPLYALL,handler:this.onResponse,scope:this},{xtype:"button",tooltip:_("Forward")+" (Ctrl + F)",overflowText:_("Forward"),iconCls:"icon_forwardEmail",
ref:"forwardBtn",responseMode:Zarafa.mail.data.ActionTypes.FORWARD,handler:this.onResponse,scope:this},{xtype:"button",tooltip:_("Edit as New Message")+" (Ctrl + E)",overflowText:_("Edit as New Message"),iconCls:"icon_editAsNewEmail",ref:"editAsNewBtn",responseMode:Zarafa.mail.data.ActionTypes.EDIT_AS_NEW,handler:this.onResponse,scope:this}]}});this.addEvents(["afterupdatesearchpreviewpanel"]);Zarafa.advancesearch.ui.SearchResultPreviewPanel.superclass.constructor.call(this,a)},update:function(a,
b){Zarafa.advancesearch.ui.SearchResultPreviewPanel.superclass.update.apply(this,arguments);this.fireEvent("afterupdatesearchpreviewpanel",this,a,b);if(a){var c=a.isFaultyMessage(),d=Zarafa.core.MessageClass.isClass(a.get("message_class"),["IPM.NOTE","REPORT.IPM","IPM.SCHEDULE","IPM.APPOINTMENT"]);d&&Zarafa.core.MessageClass.isClass(a.get("message_class"),["IPM.APPOINTMENT"])&&(a.isMeeting()||(d=!1));var e=this.getTopToolbar();e.replyBtn.setVisible(!c&&d);e.replyAllBtn.setVisible(!c&&d);e.forwardBtn.setVisible(!c&&
d);if(Zarafa.supportsPopOut()){var f=Zarafa.core.MessageClass.isClass(a.get("message_class"),["IPM.NOTE","REPORT.IPM.Note","IPM.Schedule.Meeting"],!0);e.popoutBtn.setVisible(f)}f=this.model.getDefaultFolder();e.editAsNewBtn.setVisible("sent"===f.getDefaultFolderKey()&&!c&&d)}},setRecord:function(a){for(var b=0;b<this.toolbars.length;b++)this.searchContext.getCurrentViewMode()===Zarafa.common.data.ViewModes.RIGHT_PREVIEW?this.toolbars[b].setVisible(!1):this.toolbars[b].setVisible(!!a);this.recordComponentPlugin&&
this.recordComponentPlugin.setRecord(a)},showRecordInPanel:function(a){this.model.store.getSearchStoreUniqueId()===this.dialog.name&&Zarafa.advancesearch.ui.SearchResultPreviewPanel.superclass.showRecordInPanel.call(this,a)},onResponse:function(a){var b=container.getContextByName("mail").getModel();Zarafa.mail.Actions.openCreateMailResponseContent(this.record,b,a.responseMode)}});Ext.reg("zarafa.searchresultpreviewpanel",Zarafa.advancesearch.ui.SearchResultPreviewPanel);Ext.namespace("Zarafa.calendar");
Zarafa.calendar.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[{key:Ext.EventObject.A,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewAppointment,scope:this,settingsCfg:{description:_("New appointment"),category:_("Creating an item")}},{key:Ext.EventObject.V,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewMeetingRequest,scope:this,settingsCfg:{description:_("New meeting request"),category:_("Creating an item")}},{key:[Ext.EventObject.LEFT,Ext.EventObject.RIGHT],ctrl:!1,
alt:!0,shift:!1,stopEvent:!0,handler:this.onSwitchRange,scope:this,settingsCfg:{description:_("Switch calendar range back and forth"),category:_("Calendar")}}],b=[{key:Ext.EventObject.C,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,enableGlobally:!0,settingsCfg:{description:_("Copy selected item"),category:_("Calendar")},handler:this.onCopyItem,scope:this,basic:!0},{key:Ext.EventObject.V,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,enableGlobally:!0,settingsCfg:{description:_("Paste selected item"),category:_("Calendar")},
handler:this.onPaste,scope:this,basic:!0}];Zarafa.core.KeyMapMgr.register("global",a);Zarafa.core.KeyMapMgr.register("view.mapimessage",b)},onNewAppointment:function(a,b,c){Zarafa.calendar.Actions.openCreateAppointmentContent(container.getContextByName("calendar").getModel())},onNewMeetingRequest:function(a,b,c){Zarafa.calendar.Actions.openCreateMeetingRequestContent(container.getContextByName("calendar").getModel())},onSwitchRange:function(a,b,c){a===Ext.EventObject.LEFT?container.getContextByName("calendar").getModel().previousDate():
container.getContextByName("calendar").getModel().nextDate()},onCopyItem:function(a,b,c){a=Zarafa.common.KeyMapping.getSelectedRecords(c);Ext.isEmpty(a)||(c.clipBoardData=a[0].copy(),c.isClipBoardDataRecurring=!Ext.isEmpty(a[0].get("basedate")))},openRecord:function(a,b){var c=container.getShadowStore();c.add(b);var d=function(b,c){b.remove(c,!0);b.un("open",d,this);a.doPaste(c)};c.on("open",d,this);b.open()},onPaste:function(a,b,c){Ext.isEmpty(c.clipBoardData)||(a=c.clipBoardData.copy(),c.isClipBoardDataRecurring?
Zarafa.calendar.Actions.copyRecurringItemContent(a,{component:c,scope:this}):a.isOpened()?c.doPaste(a):this.openRecord(c,a))}});Zarafa.calendar.KeyMapping=new Zarafa.calendar.KeyMapping;Ext.namespace("Zarafa.calendar.attachitem");
Zarafa.calendar.attachitem.AttachCalendarColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.getColumns(),defaults:{sortable:!0}});Zarafa.calendar.attachitem.AttachCalendarColumnModel.superclass.constructor.call(this,a)},getColumns:function(){return[{header:"<p class='icon_index'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"icon_index",tooltip:_("Sort by: Icon"),width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},
{header:"<p class='icon_attachment'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"hasattach",width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.attachment,tooltip:_("Sort by: Attachment")},{header:"<p class='icon_recurring'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"recurring",tooltip:_("Sort by: Recurring"),width:24,renderer:Zarafa.common.ui.grid.Renderers.recurrence,fixed:!0},{header:_("Subject"),dataIndex:"subject",tooltip:_("Sort by: Subject"),renderer:Zarafa.common.ui.grid.Renderers.subject},
{header:_("Startdate"),dataIndex:"startdate",tooltip:_("Sort by: Startdate"),width:180,renderer:Zarafa.common.ui.grid.Renderers.datetime},{header:_("Enddate"),dataIndex:"duedate",tooltip:_("Sort by: Enddate"),width:180,renderer:Zarafa.common.ui.grid.Renderers.datetime}]}});Ext.namespace("Zarafa.calendar.attachitem");
Zarafa.calendar.attachitem.AttachCalendarRenderer=Ext.extend(Zarafa.common.attachment.dialogs.AttachItemBaseRenderer,{constructor:function(a){Zarafa.calendar.attachitem.AttachCalendarRenderer.superclass.constructor.call(this,a);Ext.apply(this.labels,{from:_("Organizer"),location:_("Where"),display_to:_("Required Attendee"),display_cc:_("Optional Attendee"),display_bcc:_("Resource"),busystatus:_("Show Time As"),startdate:_("Start Date"),duedate:_("End Date"),recurring_pattern:_("Recurrence pattern"),
alldayevent:_("All Day Event")})},generateHTMLTemplate:function(){var a;a=""+this.addHTMLRowGroup({subject:"{subject:htmlEncode}",location:"{location:htmlEncode}"});a+=this.addHTMLRowGroup({startdate:'{startdate:date("'+_("l jS F Y G:i")+'")}',duedate:'{duedate:date("'+_("l jS F Y G:i")+'")}',busystatus:"{busystatus:busyStatusString}",alldayevent:"{alldayevent}"});a+=this.addHTMLRowGroup({from:"{from:htmlEncode}"});a+=this.addHTMLRowGroup({meeting:{display_to:"{display_to:htmlEncode}",display_cc:"{display_cc:htmlEncode}",
display_bcc:"{display_bcc:htmlEncode}"}});a+=this.addHTMLRowGroup({recurring:{recurring_pattern:"{recurring_pattern:htmlEncode}"}});a+=this.addHTMLRowGroup({categories:"{categories:htmlEncode}",sensitivity:"{sensitivity:sensitivityString}",importance:"{importance:importanceString}"});a+=this.addHTMLRow("attachment_names","{attachment_names:htmlEncode}");return a+"{body}"},generatePlainTemplate:function(){var a;a=""+this.addPlainRowGroup({subject:"{subject}",location:"{location}"});a+=this.addPlainRowGroup({startdate:'{startdate:date("'+
_("l jS F Y G:i")+'")}',duedate:'{duedate:date("'+_("l jS F Y G:i")+'")}',busystatus:"{busystatus:busyStatusString}",alldayevent:"{alldayevent}"});a+=this.addPlainRowGroup({from:"{from}"});a+=this.addPlainRowGroup({meeting:{display_to:"{display_to}",display_cc:"{display_cc}",display_bcc:"{display_bcc}"}});a+=this.addPlainRowGroup({recurring:{recurring_pattern:"{recurring_pattern}"}});a+=this.addPlainRowGroup({categories:"{categories}",sensitivity:"{sensitivity:sensitivityString}",importance:"{importance:importanceString}"});
a+=this.addPlainRow("attachment_names","{attachment_names}");return a+"{body}"},prepareData:function(a){var b=Zarafa.calendar.attachitem.AttachCalendarRenderer.superclass.prepareData.apply(this,arguments);a.isMeeting()||delete b.meeting;a.get("recurring")||delete b.recurring;a.get("alldayevent")||delete b.alldayevent;a.get("busystatus")===Zarafa.core.mapi.BusyStatus.BUSY&&delete b.busystatus;if(a.isMessageClass("IPM.Schedule.Meeting",!0)){var c=a.get("appointment_startdate");Ext.isDate(c)&&(b.startdate=
c);c=a.get("appointment_duedate");Ext.isDate(c)&&(b.duedate=c);c=a.get("appointment_recurring");c||(b.recurring=c,b.recurring_pattern=a.get("appointment_recurring_pattern"))}return b}});Ext.namespace("Zarafa.calendar.data");Zarafa.calendar.data.DataModes=Zarafa.core.Enum.create({DAY:0,WORKWEEK:1,WEEK:2,MONTH:3,ALL:4,SEARCH:5});Ext.namespace("Zarafa.calendar.data");Zarafa.calendar.data.DragStates=Zarafa.core.Enum.create({NONE:0,DRAGGING:1,SELECTING:2,RESIZING_START:3,RESIZING_DUE:4});Ext.namespace("Zarafa.calendar.data");
Zarafa.calendar.data.SnapModes=Zarafa.core.Enum.create({NONE:1,DAY:2,ZOOMLEVEL:3});Ext.namespace("Zarafa.calendar.data");Zarafa.calendar.data.ViewModes=Zarafa.core.Enum.create({DAYS:0,BOX:1,LIST:2,SEARCH:3});Ext.namespace("Zarafa.calendar.data");Zarafa.calendar.data.Views=Zarafa.core.Enum.create({BLOCKS:0,LIST:1,SEARCH:2});Ext.namespace("Zarafa.calendar.data.busytime");
Zarafa.calendar.data.busytime.BusyTimeProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{constructor:function(a){a=a||{};Ext.applyIf(a,{listModuleName:Zarafa.core.ModuleNames.getListName("busytime")});Zarafa.calendar.data.busytime.BusyTimeProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.calendar.data.busytime.BusyTimeResponseHandler({proxy:this,action:c,reader:f,options:k,callback:g,scope:h})}});Ext.namespace("Zarafa.calendar.data.busytime");
Zarafa.calendar.data.busytime.BusyTimeStore=Ext.extend(Zarafa.core.data.MAPIStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{batch:!0,autoSave:!1,remoteSort:!1,proxy:new Zarafa.calendar.data.busytime.BusyTimeProxy,reader:new Ext.data.JsonReader({root:"item"},Zarafa.calendar.data.busytime.BusyTimeRecord)});Zarafa.calendar.data.busytime.BusyTimeStore.superclass.constructor.call(this,a)},clearData:function(){Zarafa.core.data.MAPIStore.superclass.clearData.apply(this,arguments)}});
Ext.reg("zarafa.busytimestore",Zarafa.calendar.data.busytime.BusyTimeStore);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.ProposeNewTimeContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.proposenewtimecontentpanel",layout:"fit",title:_("Propose New Time"),width:375,height:200,recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),items:[{xtype:"zarafa.proposenewtimepanel",record:a.record,ref:"proposeNewTimePanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),
handler:this.onCancel,scope:this}]}]});Zarafa.calendar.dialogs.ProposeNewTimeContentPanel.superclass.constructor.call(this,a)},onOk:function(){this.proposeNewTimePanel.updateRecord(this.record);this.close()},onCancel:function(){this.close()}});Ext.reg("zarafa.proposenewtimecontentpanel",Zarafa.calendar.dialogs.ProposeNewTimeContentPanel);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.SendMeetingRequestCancellationContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.sendmeetingrequestcancellationcontentpanel",layout:"fit",title:_("Send Meeting Request Cancellation"),modal:!0,width:350,height:250,items:[{xtype:"zarafa.sendmeetingrequestcancellationpanel",record:a.record,ref:"sendMRCancellationPanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,
scope:this}]}]});Zarafa.calendar.dialogs.SendMeetingRequestCancellationContentPanel.superclass.constructor.call(this,a)},onOk:function(){this.sendMRCancellationPanel.updateRecord(this.record);this.close()},onCancel:function(){this.close()}});Ext.reg("zarafa.sendmeetingrequestcancellationcontentpanel",Zarafa.calendar.dialogs.SendMeetingRequestCancellationContentPanel);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.SendMeetingRequestConfirmationContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,responseType:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.sendmeetingrequestconfirmcontentpanel",layout:"fit",title:_("Send Meeting Request Confirmation"),modal:!0,width:350,height:250,items:[{xtype:"zarafa.sendmeetingrequestconfirmpanel",record:a.record,responseType:a.responseType,ref:"sendMRConfirmationPanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},
{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.calendar.dialogs.SendMeetingRequestConfirmationContentPanel.superclass.constructor.call(this,a)},onOk:function(){this.record.isRecurringOccurence()&&Ext.isDefined(this.buttonName)&&"recurring"===this.buttonName&&(this.record.removeIdProp("basedate"),this.record.set("basedate",""));this.sendMRConfirmationPanel.updateRecord(this.record);this.close()},onCancel:function(){this.close()}});
Ext.reg("zarafa.sendmeetingrequestconfirmcontentpanel",Zarafa.calendar.dialogs.SendMeetingRequestConfirmationContentPanel);Ext.namespace("Zarafa.calendar.printer");
Zarafa.calendar.printer.DaysViewRenderer=Ext.extend(Zarafa.common.printer.renderers.BaseRenderer,{customStylesheetPath:"client/resources/css/external/print.calendar.css",timeStyle:"",prepareData:function(a){var b=Zarafa.calendar.printer.DaysViewRenderer.superclass.prepareData.apply(this,arguments),c=a.getModel(),d=c.dateRange,e=d.getDuration(Date.DAY),f=d.getStartDate().clone(),d=d.getDueDate().clone();f.setHours(12);d.setHours(12);b.currenttime=new Date;b.startdate=f.clearTime();b.duedate=d.add(Date.DAY,
-1).clearTime();for(var g=0,h=e;g<h;g++){var k="date"+(g+1);b[k]=f.add(Date.DAY,g).clearTime();b[k+"_table_data"]=""}c=c.getStore().getRange();k=f.getDay();g=0;for(h=c.length;g<h;g++){var l=c[g].get("commonstart"),m=c[g].get("commonend");if(Ext.isDate(l)&&Ext.isDate(m)){var n=l;l<f&&(n=f.clone());var p=m;m>d&&(p=d.clone());var r=c[g].get("subject");Ext.isString(r)||(r="");var q,t=l.getDayOfYear()!==m.getDayOfYear()||l.getYear()!==m.getYear();q=t?_("jS F Y G:i"):_("G:i");var u=Math.floor(Date.diff(Date.DAY,
p,n)),v=c[g].get("alldayevent");v&&p===m&&u--;p='<tr class="calendar-'+(v?"allday":"normal")+'">';v||(p+='<td class="nowrap" style="'+this.timeStyle+'">'+l.format(q)+" - "+(t?"<br>":"")+m.format(q)+"</td>");p+='<td class="calendar-item" colspan='+(v?"2":"1")+">"+Ext.util.Format.htmlEncode(r)+"</td></tr>";l=n.getDay();l<k&&(l+=7);l-=k-1;for(m=0;m<=u&&m<e;m++)b["date"+(l+m)+"_table_data"]+=p}}return b},postRender:function(a,b,c){c=c.getModel().dateRange;a=c.getStartDate().clone();c=c.getDueDate().clone();
c.setMonth(c.getMonth()+1);if(Ext.isIE11){a=new Ext.DatePicker({renderTo:Ext.getBody(),hidden:!0,width:"200px",value:a,showToday:!1});c=new Ext.DatePicker({renderTo:Ext.getBody(),hidden:!0,width:"200px",value:c,showToday:!1});var d=b.getElementById("datepicker_left");d&&(d.innerHTML=a.el.dom.innerHTML);if(b=b.getElementById("datepicker_right"))b.innerHTML=c.el.dom.innerHTML;a.destroy();c.destroy()}else new Ext.DatePicker({renderTo:b.getElementById("datepicker_left"),value:a,showToday:!1}),new Ext.DatePicker({renderTo:b.getElementById("datepicker_right"),
value:c,showToday:!1})},generateBodyTemplate:function(){var a;a='<table class="print-calendar" cellpadding=0 cellspacing=0>\n<tr style="height:10%;"><td><table id="top">\n'+('<tr><td align="left">'+container.getServerConfig().getWebappTitle()+'</td><td align="center" valign="top" width="20%" rowspan=3><div id="datepicker_left"></div></td></tr><tr><td align="left">'+_("Calendar")+" : {fullname:htmlEncode} </td></tr>\n");a+='<tr><td align="left" width="80%">{startdate:date("'+_("l jS F Y")+'")}</td></tr>\n';
a=a+"</table></td></tr>\n"+('<tr style="height:30px;">  <th class="date-header-center">{date1:date("'+_("l jS F")+'")}</th></tr><tr style="height:90%;">  <td valign="top"><table id="date1">{date1_table_data}</table></td></tr></table>\n');return a+='<table id="bottom"><tr><td class="nowrap" align="left">{fullname:htmlEncode}</td><td class="nowrap" align="right">{currenttime:date("'+_("l jS F Y G:i")+'")}</td></tr></table>\n'}});Ext.namespace("Zarafa.calendar.settings");
Zarafa.calendar.settings.SettingsCalendarCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Calendar"),categoryIndex:4,iconCls:"zarafa-settings-category-calendar",items:[{xtype:"zarafa.settingscalendarwidget"},{xtype:"zarafa.settingsfreebusywidget"},{xtype:"zarafa.settingsoverlaywidget"},{xtype:"zarafa.settingsreminderwidget"},container.populateInsertionPoint("context.settings.category.calendar",this)]});Zarafa.calendar.settings.SettingsCalendarCategory.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.settingscalendarcategory",Zarafa.calendar.settings.SettingsCalendarCategory);Ext.namespace("Zarafa.calendar.settings");
Zarafa.calendar.settings.SettingsCalendarWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};for(var b=[],c=0,d=Date.dayNames.length;c<d;c++)b.push({name:Date.dayNames[c],value:c});b={xtype:"jsonstore",fields:["name","value"],data:b};c={xtype:"jsonstore",fields:["name","value"],data:[{value:5,name:Ext.util.Format.duration(5)},{value:6,name:Ext.util.Format.duration(6)},{value:10,name:Ext.util.Format.duration(10)},{value:15,name:Ext.util.Format.duration(15)},{value:30,
name:Ext.util.Format.duration(30)},{value:60,name:Ext.util.Format.duration(60)}]};Ext.applyIf(a,{title:_("General calendar settings"),layout:"form",items:[{xtype:"combo",ref:"weekStartCombo",fieldLabel:_("First day of the week"),name:"zarafa/v1/main/week_start",store:b,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}},{xtype:"zarafa.timeperiodfield",ref:"workingHourPeriod",
defaultValue:new Zarafa.core.DateRange,defaultPeriod:1,defaultPeriodType:Date.HOUR,labelWidth:200,startFieldConfig:{fieldLabel:_("Start of workday"),name:"zarafa/v1/main/start_working_hour",incrementValue:30,alternateIncrementValue:1,minValue:(new Date).clearTime(),maxValue:(new Date).clearTime().add(Date.HOUR,23)},endFieldConfig:{fieldLabel:_("End of workday"),name:"zarafa/v1/main/end_working_hour",incrementValue:30,alternateIncrementValue:1,minValue:(new Date).clearTime().add(Date.HOUR,1),maxValue:(new Date).clearTime().add(Date.HOUR,
24)},listeners:{change:this.onWorkTimeChange,scope:this}},{xtype:"combo",ref:"zoomLevelCombo",fieldLabel:_("Calendar resolution"),name:"zarafa/v1/contexts/calendar/default_zoom_level",store:c,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}},{xtype:"zarafa.compositefield",plugins:[{ptype:"zarafa.splitfieldlabeler",firstLabelCfg:{style:"text-align: left; padding: 3px 3px 3px 0px",
width:205}}],combineErrors:!1,fieldLabel:_("Default appointment duration {A} minutes"),items:[{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"],ref:"../durationSpinner",name:"zarafa/v1/contexts/calendar/default_appointment_period",labelSplitter:"{A}",allowBlank:!1,allowDecimals:!1,allowNegative:!1,defaultValue:30,minValue:1,maxValue:120,width:50,validator:function(a){return 1<=a&&120>=a?!0:_("Duration must be between 1 and 120 minutes.")},listeners:{change:this.onDurationChange,scope:this}}]},
{xtype:"checkboxgroup",ref:"workingDays",fieldLabel:_("Working days"),name:"zarafa/v1/main/working_days",width:225,columns:4,items:[{boxLabel:_("Mon"),name:"day-col-1",inputValue:1},{boxLabel:_("Tue"),name:"day-col-2",inputValue:2},{boxLabel:_("Wed"),name:"day-col-3",inputValue:3},{boxLabel:_("Thu"),name:"day-col-4",inputValue:4},{boxLabel:_("Fri"),name:"day-col-5",inputValue:5},{boxLabel:_("Sat"),name:"day-col-6",inputValue:6},{boxLabel:_("Sun"),name:"day-col-0",inputValue:0}]},{xtype:"checkbox",
ref:"boldCheck",boxLabel:_("Show busy dates as bold in the date picker"),hideLabel:!0,name:"zarafa/v1/contexts/calendar/datepicker_show_busy",listeners:{check:this.onBoldCheck,scope:this}}]});Zarafa.calendar.settings.SettingsCalendarWidget.superclass.constructor.call(this,a)},update:function(a){this.model=a;var b=(new Date).clearTime(),b=b.add(Date.MINUTE,a.get(this.workingHourPeriod.startField.name)),c=(new Date).clearTime(),c=c.add(Date.MINUTE,a.get(this.workingHourPeriod.endField.name));this.workingHourPeriod.getValue().set(b,
c);this.weekStartCombo.setValue(a.get(this.weekStartCombo.name));this.zoomLevelCombo.setValue(a.get(this.zoomLevelCombo.name));this.boldCheck.setValue(a.get(this.boldCheck.name));this.durationSpinner.setValue(a.get(this.durationSpinner.name));a=this.model.get(this.workingDays.name);b={};for(c=0;6>=c;c++)-1<a.indexOf(c)?b["day-col-"+c]=!0:b["day-col-"+c]=!1;this.workingDays.setValue(b);this.mon(this.workingDays,"change",this.onWorkingDaysChange,this,{single:!0})},updateSettings:function(a){var b=this.durationSpinner.getValue();
this.durationSpinner.isValid()||(b=Ext.isEmpty(b)||0===b?a.get(this.durationSpinner.name,!1,!0):this.durationSpinner.maxValue);a.beginEdit();this.onWorkTimeChange(this.workingHourPeriod,this.workingHourPeriod.getValue());a.set(this.weekStartCombo.name,this.weekStartCombo.getValue());a.set(this.zoomLevelCombo.name,this.zoomLevelCombo.getValue());a.set(this.boldCheck.name,this.boldCheck.getValue());a.set(this.durationSpinner.name,b);a.set(this.workingDays.name,Ext.pluck(this.workingDays.getValue(),
"inputValue"));a.endEdit()},onDurationChange:function(a,b){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b)},onFieldSelect:function(a,b){if(this.model){var c=b.get(a.valueField);this.model.get(a.name)!==c&&this.model.set(a.name,c)}},onWorkTimeChange:function(a,b,c){this.model&&(a=b.getStartDate(),a=60*a.getHours()+a.getMinutes(),b=b.getDueDate(),b=60*b.getHours()+b.getMinutes(),b<a&&(b=a+60*this.workingHourPeriod.defaultPeriod),this.model.set(this.workingHourPeriod.startField.name,
a),this.model.set(this.workingHourPeriod.endField.name,b))},onBoldCheck:function(a,b){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b)},onWorkingDaysChange:function(a,b){this.model&&this.model.set(this.workingDays.name,Ext.pluck(this.workingDays.getValue(),"inputValue"))}});Ext.reg("zarafa.settingscalendarwidget",Zarafa.calendar.settings.SettingsCalendarWidget);Ext.namespace("Zarafa.calendar.settings");
Zarafa.calendar.settings.SettingsFreeBusyWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b=_("Free/busy information is used by people sending meeting requests, to determine when you are available for meetings.");Ext.applyIf(a,{title:_("Free/Busy permission"),items:[{xtype:"displayfield",hideLabel:!0,value:b},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("Publish {A} month(s) of Calendar free/busy information on the server."),
items:[{xtype:"numberfield",cls:"k-centeredtext",width:30,name:"zarafa/v1/contexts/calendar/free_busy_range",labelSplitter:"{A}",ref:"../freeBusyMonth",minValue:1,maxValue:36,allowBlank:!1,allowDecimals:!1,allowNegative:!1,listeners:{change:this.onFieldChange,scope:this}}]},{xtype:"displayfield",hideLabel:!0,value:_("You can only publish a free/busy period from 1 to 36 months.")}]});Zarafa.calendar.settings.SettingsFreeBusyWidget.superclass.constructor.call(this,a)},update:function(a){this.model=
a;a=a.get(this.freeBusyMonth.name);this.freeBusyMonth.setValue(a)},updateSettings:function(a){var b=this.freeBusyMonth.isValid()?this.freeBusyMonth.getValue():a.get(this.freeBusyMonth.name,!1,!0);a.beginEdit();a.set(this.freeBusyMonth.name,b);a.endEdit()},onFieldChange:function(a,b,c){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b)}});Ext.reg("zarafa.settingsfreebusywidget",Zarafa.calendar.settings.SettingsFreeBusyWidget);Ext.namespace("Zarafa.calendar.settings");
Zarafa.calendar.settings.SettingsOverlayWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b={xtype:"jsonstore",fields:["name","value"],data:[{name:_("Side-by-side mode"),value:"separate"},{name:_("Overlay mode"),value:"merge"}]};Ext.applyIf(a,{title:_("Calendar view settings"),layout:"form",items:[{xtype:"combo",ref:"overlayCombo",fieldLabel:_("View multiple calendars in"),name:"zarafa/v1/contexts/calendar/default_merge_state",store:b,mode:"local",triggerAction:"all",
displayField:"name",valueField:"value",lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,listeners:{select:this.onOpenMethodSelect,scope:this}}]});Zarafa.calendar.settings.SettingsCalendarWidget.superclass.constructor.call(this,a)},update:function(a){this.model=a;a=a.get(this.overlayCombo.name);this.overlayCombo.setValue(a?"merge":"separate")},updateSettings:function(a){a.set(this.overlayCombo.name,"merge"===this.overlayCombo.getValue())},onOpenMethodSelect:function(a,b){if(this.model){var c=
b.get(a.valueField);this.model.get(a.name)!==c&&this.model.set(a.name,"merge"===c)}}});Ext.reg("zarafa.settingsoverlaywidget",Zarafa.calendar.settings.SettingsOverlayWidget);Ext.namespace("Zarafa.calendar.settings");
Zarafa.calendar.settings.SettingsReminderWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Reminder settings"),layout:"form",items:[{xtype:"checkbox",ref:"reminderCheck",boxLabel:_("Enable reminder for new appointments"),hideLabel:!0,name:"zarafa/v1/contexts/calendar/default_reminder",listeners:{check:this.onReminderCheck,scope:this}},{xtype:"combo",ref:"timeCombo",fieldLabel:_("Default reminder time"),name:"zarafa/v1/contexts/calendar/default_reminder_time",
store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.calendar.data.ReminderPeriods},mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}},{xtype:"combo",ref:"alldayTimeCombo",fieldLabel:_("Default all-day appointment reminder time"),name:"zarafa/v1/contexts/calendar/default_allday_reminder_time",store:{xtype:"jsonstore",fields:["name","value"],data:Zarafa.calendar.data.ReminderPeriods},
mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}}]});Zarafa.calendar.settings.SettingsReminderWidget.superclass.constructor.call(this,a)},update:function(a){this.model=a;var b=a.get(this.reminderCheck.name);this.reminderCheck.setValue(b);this.timeCombo.setValue(a.get(this.timeCombo.name));this.alldayTimeCombo.setValue(a.get(this.alldayTimeCombo.name));this.timeCombo.setDisabled(!b);
this.alldayTimeCombo.setDisabled(!b)},updateSettings:function(a){a.beginEdit();a.set(this.reminderCheck.name,this.reminderCheck.getValue());a.set(this.timeCombo.name,this.timeCombo.getValue());a.set(this.alldayTimeCombo.name,this.alldayTimeCombo.getValue());a.endEdit()},onReminderCheck:function(a,b){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b);this.timeCombo.setDisabled(!b);this.alldayTimeCombo.setDisabled(!b)},onFieldSelect:function(a,b){if(this.model){var c=b.get(a.valueField);
this.model.get(a.name)!==c&&this.model.set(a.name,c)}}});Ext.reg("zarafa.settingsreminderwidget",Zarafa.calendar.settings.SettingsReminderWidget);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AbstractCalendarView=Ext.extend(Zarafa.core.ui.View,{rangeSelectionModel:void 0,selectionModel:void 0,contextModel:void 0,folders:void 0,selectedFolder:void 0,tabs:void 0,selectionView:void 0,textEditView:void 0,appointments:void 0,leftOffset:0,width:0,appointmentBodyLeftMargin:0,appointmentBodyRightMargin:0,appointmentHeaderLeftMargin:6,appointmentHeaderRightMargin:6,body:void 0,header:void 0,headerBorderLeft:void 0,headerBorderRight:void 0,borderLeft:void 0,borderRight:void 0,
borderBottom:void 0,tabArea:void 0,enableDD:!1,enableBodyDD:!1,enableHeaderDD:!1,enableBodyDrag:!1,enableHeaderDrag:!1,enableBodyDrop:!1,enableHeaderDrop:!1,ddGroup:"AppointmentDD",bodyDragZone:void 0,bodyDragConfig:void 0,bodyDropZone:void 0,bodyDropConfig:void 0,headerDragZone:void 0,headerDragConfig:void 0,headerDropZone:void 0,headerDropConfig:void 0,groupId:void 0,active:!1,activeTabStroke:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar"});this.addEvents("appointmentcalendardrop",
"appointmentmouseover","appointmentmouseout","appointmentmove","appointmentresize","appointmentcreate","appointmentinitdrag","appointmentenddrag","contextmenu","dblclick","dayclick","activate","merge","separate","close");Zarafa.calendar.ui.AbstractCalendarView.superclass.constructor.call(this,a)},init:function(){Zarafa.calendar.ui.AbstractCalendarView.superclass.init.call(this);this.folders=[];this.tabs={};this.appointments=[];this.selectionView=this.createAppointmentProxy();this.selectionView.setVisible(!1);
this.addChildView(this.selectionView);this.textEditView=new Zarafa.calendar.ui.TextEditView;this.mon(this.textEditView,"textentered",this.onTextEntered,this);this.addChildView(this.textEditView);this.mon(this.selectionModel,"appointmentselect",this.onAppointmentSelect,this);this.mon(this.selectionModel,"appointmentdeselect",this.onAppointmentDeselect,this);this.mon(this.selectionModel,"selectionclear",this.onAppointmentSelectionClear,this);this.mon(this.rangeSelectionModel,"selectionchange",this.onRangeSelectionChange,
this)},addFolder:function(a){this.folders.push(a);var b=new Zarafa.calendar.ui.CalendarTabView({parentView:this,folder:a});this.mon(b,"merge",this.onTabMerge,this);this.mon(b,"separate",this.onTabSeparate,this);this.mon(b,"close",this.onTabClose,this);this.mon(b,"click",this.onTabClick,this);this.rendered&&b.render(this.container);this.tabs[a.get("entryid")]=b;this.setSelectedFolder(a)},removeFolder:function(a){return this.removeFolderById(a.get("entryid"))},removeFolderById:function(a){this.folders.remove(this.getFolderById(a));
var b=this.tabs[a];this.mun(b,"merge",this.onTabMerge,this);this.mun(b,"separate",this.onTabSeparate,this);this.mun(b,"close",this.onTabClose,this);this.mun(b,"click",this.onTabClick,this);this.removeChildView(b,!0);delete this.tabs[a]},getFolderIds:function(){for(var a=[],b=0,c;c=this.folders[b];b++)a[b]=c.get("entryid");return a},getFolderById:function(a){for(var b=0,c;c=this.folders[b];b++)if(Zarafa.core.EntryId.compareEntryIds(c.get("entryid"),a))return c},getFolders:function(){return this.folders},
setSelectedFolder:function(a){this.selectedFolder=a;this.rendered&&this.layout()},getSelectedFolder:function(){0>this.folders.indexOf(this.selectedFolder)&&this.setSelectedFolder(this.folders[0]);return this.selectedFolder},containsFolder:function(a){return this.containsFolderId(a.get("entryid"))},containsFolderId:function(a){return Ext.isDefined(this.getFolderById(a))},sortFolders:function(a){for(var b=[],c=0,d;d=a[c];c++)this.containsFolderId(d.get("entryid"))&&b.push(d);this.folders=b},getDateRange:function(){return this.parentView.getDateRange()},
getStartDate:function(){return this.getDateRange().getStartDate()},getDueDate:function(){return this.getDateRange().getDueDate()},getDesiredHeaderHeight:function(){return 0},getTabHeight:function(){return this.parentView.getTabHeight()},findAppointment:function(a){for(var b=0,c;c=this.appointments[b];b++)if(c.getRecord().equals(a))return c},containsAppointment:function(a){return Ext.isDefined(this.findAppointment(a))},createAppointment:Ext.emptyFn,createAppointmentProxy:Ext.emptyFn,addAppointment:function(a,
b){if("calendar"!==Zarafa.core.MessageClass.getDefaultFolderTypeFromMessageClass(a.get("message_class")))return!1;var c=this.createAppointment(a);c.render(this.container);this.appointments.push(c);!1!==b&&this.layout();return!0},removeAppointment:function(a,b){var c;return(c=this.findAppointment(a))?(this.appointments.remove(c),this.removeChildView(c,!0),!1!==b&&this.layout(),!0):!1},clearAppointments:function(a,b){for(var c=0,d;d=this.appointments[c];c++)this.removeChildView(d,a);c=this.appointments;
this.appointments=[];!1!==b&&this.layout();return c},getAppointmentRecords:function(){for(var a=[],b=0,c;c=this.appointments[b];b++)a.push(c.getRecord());return a},dateRangeToBodyBounds:function(a,b,c,d){return[]},dateRangeToHeaderBounds:function(a,b,c,d){return{left:0,right:0,top:0,bottom:0}},isHeaderRange:function(a){return!1},setLeftMargin:function(a){this.leftOffset=a},setWidth:function(a){this.width=a},setCanMerge:function(a){this.canMerge=a},setCanClose:function(a){this.canClose=a},screenLocationToDate:Ext.emptyFn,
screenLocationToDateRange:Ext.emptyFn,getBorderWidth:function(){return this.parentView.getBorderWidth()},getZoomLevel:function(){return this.parentView.zoomLevel},getCalendarBody:function(){return this.body},getCalendarHeader:function(){return this.header},appointmentCompare:function(a,b){var c=a.getDateRange().compare(b.getDateRange());return 0===c?a.getRecord().get("entryid")>b.getRecord().get("entryid")?1:-1:c},doGreedyColoring:function(a,b){a.sort(this.appointmentCompare);var c=[];b?Ext.each(a,
function(a){var b=this.getDateRange().getStartTime();c.push({appointment:a,start:Math.floor((a.getDateRange().getStartTime()-b)/Date.dayInMillis),due:Math.ceil((a.getDateRange().getDueTime()-b)/Date.dayInMillis)})},this):Ext.each(a,function(a){c.push({appointment:a,start:a.getAdjustedDateRange().getStartTime(),due:a.getAdjustedDateRange().getDueTime()})});for(var d=0;0<c.length;){var e=c.shift();e.appointment.slot=d;for(var e=e.due,f=0;f<c.length;f++)c[f].start>=e&&(c[f].appointment.slot=d,e=c[f].due,
c.splice(f,1),f--);d++}Ext.each(a,function(a){a.slotCount=d})},render:function(a){this.rendered||(this.createDiv(this.parentView.scrollable,"body"),this.createDiv(this.parentView.header,"header","zarafa-calendar-header"),this.createDiv(this.parentView.header,"headerBorderLeft"),this.createDiv(this.parentView.header,"headerBorderRight"),this.createDiv(this.parentView.scrollable,"borderLeft"),this.createDiv(this.parentView.scrollable,"borderRight"),this.createDiv(this.parentView.bottom,"borderBottom"),
this.createDiv(this.parentView.tab,"tabArea"),this.createDiv(this.tabArea,"activeTabStroke"),Zarafa.calendar.ui.AbstractCalendarView.superclass.render.call(this,a),this.renderChildren(),this.mon(this.selectionView,"keypress",this.onKeyPress,this),this.mon(this.selectionView,"keydown",this.onKeyPress,this),(this.enableDD||this.enableBodyDD||this.enableBodyDrag)&&!this.bodyDragZone&&this.body&&(this.bodyDragZone=new Zarafa.calendar.ui.CalendarViewDragZone(this,this.bodyDragConfig||{ddGroup:this.ddGroup||
"AppointmentDD",headerMode:!1})),(this.enableDD||this.enableHeaderDD||this.enableHeaderDrag)&&!this.headerDragZone&&this.header&&(this.headerDragZone=new Zarafa.calendar.ui.CalendarViewDragZone(this,this.headerDragConfig||{ddGroup:this.ddGroup||"AppointmentDD",headerMode:!0})),(this.enableDD||this.enableBodyDD||this.enableBodyDrop)&&!this.bodyDropZone&&this.body&&(this.bodyDropZone=new Zarafa.calendar.ui.CalendarViewDropZone(this,this.bodyDropConfig||{ddGroup:this.ddGroup||"AppointmentDD",headerMode:!1,
selectingSnapMode:Zarafa.calendar.data.SnapModes.ZOOMLEVEL,draggingSnapMode:Zarafa.calendar.data.SnapModes.ZOOMLEVEL}),this.bodyDropZone.proxy=this.selectionView),(this.enableDD||this.enableHeaderDD||this.enableHeaderDrop)&&!this.headerDropZone&&this.header&&(this.headerDropZone=new Zarafa.calendar.ui.CalendarViewDropZone(this,this.headerDropConfig||{ddGroup:this.ddGroup||"AppointmentDD",headerMode:!0,selectingSnapMode:Zarafa.calendar.data.SnapModes.DAY,draggingSnapMode:Zarafa.calendar.data.SnapModes.DAY}),
this.headerDropZone.proxy=this.selectionView))},onKeyPress:function(a){Ext.form.VTypes.alphanum(String.fromCharCode(a.getKey()))&&this.rangeSelectionModel.isActive()&&this.rangeSelectionModel.getCalendarView()==this&&!this.textEditView.isVisible()&&(a=this.rangeSelectionModel.getDateRange(),this.rangeSelectionModel.clearSelections(),this.textEditView.setDateRange(a),this.textEditView.select())},onTextEntered:function(a,b){Ext.isEmpty(b.trim())||this.fireEvent("appointmentcreate",this,a.getDateRange(),
b)},layoutBorder:function(){var a=this.getSelectedFolder(),a=this.contextModel.getColorScheme(a.get("entryid"));if(this.parentView.showBorder){var b=this.getBorderWidth(),c=this.parentView.getHeaderAreaHeight();this.headerBorderLeft.dom.className=this.getClassName("border","left");this.headerBorderLeft.setLeftTop(this.leftOffset,0);this.headerBorderLeft.setSize(b,c);this.headerBorderLeft.applyStyles({"background-color":a.header,"border-color":a.header});this.headerBorderLeft.show();this.headerBorderRight.dom.className=
this.getClassName("border","right");this.headerBorderRight.setLeftTop(this.leftOffset+this.width-b,0);this.headerBorderRight.setSize(b,c);this.headerBorderRight.applyStyles({"background-color":a.header,"border-color":a.header});this.headerBorderRight.show();c=this.parentView.getHourHeight()*this.parentView.numHours;this.borderLeft.dom.className=this.getClassName("border","left");this.borderLeft.setLeftTop(this.leftOffset,0);this.borderLeft.setSize(b,c);this.borderLeft.applyStyles({"background-color":a.header,
"border-color":a.header});this.borderLeft.show();this.borderRight.dom.className=this.getClassName("border","right");this.borderRight.setLeftTop(this.leftOffset+this.width-b,0);this.borderRight.setSize(b,c);this.borderRight.applyStyles({"background-color":a.header,"border-color":a.header});this.borderRight.show();this.borderBottom.dom.className=this.getClassName("border","bottom");this.borderBottom.setLeftTop(this.leftOffset,0);this.borderBottom.setSize(this.width,b);this.borderBottom.applyStyles({"background-color":a.header,
"border-color":a.header});this.borderBottom.show()}else this.headerBorderLeft.hide(),this.headerBorderRight.hide(),this.borderLeft.hide(),this.borderRight.hide(),this.borderBottom.hide()},layoutTabs:function(){for(var a=[],b=[],c=[],d=0,e=0,f;f=this.folders[e];e++){var g=this.tabs[f.get("entryid")];g.setSelected(this.selectedFolder==f,this.active);g.setShowMergeIcon(this.canMerge);g.setShowSeparateIcon(1<this.folders.length);g.setShowCloseIcon(this.canClose);a.push(g);g.desiredWidth=g.getDesiredWidth();
g.lrmargins=g.tabContents.getMargins("lr");d+=g.desiredWidth+g.lrmargins}if(d>this.width){for(e=0;e<a.length;e++)a[e].getDesiredWidth()+a[e].tabContents.getMargins("lr")<this.width/a.length?c.push(a[e]):b.push(a[e]);g=this.width;for(e=f=0;e<c.length;e++)g-=c[e].desiredWidth+c[e].lrmargins;for(e=0;e<b.length;e++)f+=b[e].desiredWidth+b[e].lrmargins;if(1===b.length)b[0].desiredWidth=g-b[0].lrmargins;else for(;f>g;){for(var c=b[0].desiredWidth>b[1].desiredWidth?b[0]:b[1],h=b[0].desiredWidth>b[1].desiredWidth?
b[1]:b[0],e=2;e<b.length;e++)a[e].desiredWidth>c.desiredWidth?c=a[e]:a[e].desiredWidth>h.desiredWidth&&(h=a[e]);c.desiredWidth-h.desiredWidth>f-g?(c.desiredWidth-=f-g+c.lrmargins,f=g):(f-=c.desiredWidth-h.desiredWidth+1,c.desiredWidth=h.desiredWidth-1)}}for(e=0;f=this.folders[e];e++)g=this.tabs[f.get("entryid")],a=g.desiredWidth,g.tabContents.dom.style.removeProperty("min-width"),b=parseInt(g.tabContents.getStyle("min-width"))+g.tabContents.getPadding("lr"),b>a&&(g.tabContents.setStyle("min-width",
0),d<=this.width&&(a=b)),g.setWidth(a)},onLayout:function(){if(this.getSelectedFolder()){var a=this.contextModel.getColorScheme(this.getSelectedFolder().get("entryid"));a&&(this.calendarColorScheme=a)}else return Zarafa.calendar.ui.AbstractCalendarView.superclass.onLayout.call(this);this.layoutBorder();a=this.parentView.getHourHeight()*this.parentView.numHours;this.body.dom.className=this.getClassName("container","body");this.body.setLeftTop(this.leftOffset+this.getBorderWidth(),0);this.body.setSize(this.width-
2*this.getBorderWidth(),a);this.header.dom.className=this.getClassName("container","header");this.header.setLeftTop(this.leftOffset+this.getBorderWidth(),0);this.header.setSize(this.width-2*this.getBorderWidth(),this.parentView.getHeaderAreaHeight());this.tabArea.dom.className=this.getClassName("container","tabarea");this.tabArea.setLeftTop(this.leftOffset,0);this.tabArea.setSize(this.width,this.parentView.getTabAreaHeight());this.activeTabStroke.dom.className=this.getClassName("tabarea","stroke");
this.activeTabStroke.setSize(this.width,this.parentView.tabStrokeHeight);this.parentView.showBorder?this.tabArea.show():this.tabArea.hide();for(var a=0,b;b=this.appointments[a];a++){var c=b.getRecord().get("parent_entryid");b.calendarColorScheme=this.contextModel.getColorScheme(c);c=this.getFolderById(c);b.setActive(c==this.selectedFolder)}Zarafa.calendar.ui.AbstractCalendarView.superclass.onLayout.call(this);this.layoutTabs()},onAfterLayout:function(){this.layoutChildren()},beforeAppointmentsLoad:function(a,
b){this.clearAppointments(!0)},onAppointmentsLoad:function(a,b,c){this.clearAppointments(!0);Ext.each(b,function(a){this.containsFolderId(a.get("parent_entryid"))&&a.isValid()&&this.addAppointment(a,!1)},this);a=this.contextModel.selectedRecords;Ext.isEmpty(a)||this.selectionModel.selectRecord(a[0],!1)},onAppointmentAdd:function(a,b,c){this.containsFolderId(b.get("parent_entryid"))&&!this.containsAppointment(b)&&b.isValid()&&this.addAppointment(b)},onAppointmentRemove:function(a,b,c){this.containsAppointment(b)&&
this.removeAppointment(b)},onAppointmentUpdate:function(a,b,c){if(a=this.findAppointment(b))c=a.getDateRange(),c.getStartDate()!==b.get("startdate")||c.getDueDate()!==b.get("duedate")?(a.updateDateRange(b),this.layout()):a.layout()},onAppointmentSelect:function(a,b){var c=this.findAppointment(b);this.textEditView.isVisible()&&this.textEditView.hide();c&&c.setSelected(!0)},onAppointmentDeselect:function(a,b){var c=this.findAppointment(b);this.textEditView.isVisible()&&this.textEditView.hide();c&&c.setSelected(!1)},
onAppointmentSelectionClear:function(a){this.textEditView.isVisible()&&this.textEditView.hide();a=0;for(var b=this.appointments.length;a<b;a++)this.appointments[a].setSelected(!1)},onRangeSelectionChange:function(a,b,c,d){this.selectionView&&(this.textEditView.isVisible()&&(this.textEditView.hide(),this.textEditView.inputText=""),d&&c==this?(this.selectionView.setDateRange(b),this.selectionView.setVisible(!0)):this.selectionView.isVisible()&&this.selectionView.setVisible(!1))},onTabMerge:function(a){this.fireEvent("merge",
this,a)},onTabSeparate:function(a){this.fireEvent("separate",this,a)},onTabClose:function(a){this.fireEvent("close",this,a)},onTabClick:function(a){this.setSelectedFolder(a);this.fireEvent("activate",this,a)},getDragDropText:function(){var a=this.selectionModel.getCount();return String.format(ngettext("{0} selected item","{0} selected items",a),a)},onDrop:function(a,b,c,d){this.onTabClick(this.getSelectedFolder());this.fireEvent("appointmentcalendardrop",this,b,c.getRecord(),d,a);this.selectionModel.clearSelections()},
onMove:function(a,b,c){this.fireEvent("appointmentmove",this,b.getRecord(),c,a);this.selectionModel.clearSelections()},onResize:function(a,b,c){this.fireEvent("appointmentresize",this,b.getRecord(),c,a);this.selectionModel.clearSelections()},onMouseMove:Ext.emptyFn,onMouseDown:function(a,b){if(this.groupId!=this.contextModel.active_group)this.onTabClick(this.getSelectedFolder());if(b){var c=b.getRecord();a.ctrlKey?this.selectionModel.isSelected(c)?this.selectionModel.deselectRecord(c):this.selectionModel.selectRecord(c,
!0):this.selectionModel.selectRecord(c,!1);this.rangeSelectionModel.clearSelections()}else this.selectionModel.clearSelections(),c=a.getXY(),(c=this.screenLocationToDateRange(c[0],c[1]))&&this.rangeSelectionModel.set(c,this)},onMouseUp:function(a,b){b&&(b.isAllDay()?b.eventOverHeader(a):b.eventOverBody(a))&&this.selectionModel.deselectRecord(b.getRecord())},onInitDrag:function(a,b){this.fireEvent("appointmentinitdrag",this,a,b)},onEndDrag:function(a,b){this.fireEvent("appointmentenddrag",this,a,b)},
onSelect:function(a,b){this.rangeSelectionModel.set(b,this)},destroy:function(){Ext.destroy(this.bodyDragZone,this.bodyDropZone);Ext.destroy(this.headerDragZone,this.headerDropZone);Zarafa.calendar.ui.AbstractCalendarView.superclass.destroy.call(this)},setActive:function(a){this.active=a}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AbstractDateRangeView=Ext.extend(Zarafa.core.ui.View,{slot:void 0,slotCount:void 0,visible:!0,dateRange:void 0,setDateRange:function(a){this.dateRange=a},getDateRange:function(){return this.dateRange},eventOverBody:function(a){return!1},eventOverBodyStartHandle:function(a){return!1},eventOverBodyDueHandle:function(a){return!1},eventOverHeader:function(a){return!1},eventOverHeaderStartHandle:function(a){return!1},eventOverHeaderDueHandle:function(a){return!1},setVisible:function(a){this.visible=
a;for(var b=0,c=this.elements.length;b<c;b++)this.elements[b].setVisible(a)},isVisible:function(){return this.visible},layoutInHeader:Ext.emptyFn,layoutInBody:Ext.emptyFn,onLayout:function(){this.visible&&(this.isHeaderRange()?this.layoutInHeader():this.layoutInBody());Zarafa.calendar.ui.AbstractDateRangeView.superclass.onLayout.call(this)},isHeaderRange:function(){return this.parentView.isHeaderRange(this.getDateRange())}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{calendarPanel:null,records:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.records)&&!Array.isArray(a.records)&&(a.records=[a.records]);a=Ext.applyIf(a,{items:[this.createContextActionItems(),{xtype:"menuseparator"},container.populateInsertionPoint("context.calendar.contextmenu.actions",this),{xtype:"menuseparator"},this.createContextOptionsItems(a.records),{xtype:"menuseparator"},container.populateInsertionPoint("context.calendar.contextmenu.options",
this)],listeners:{scope:this,mouseover:this.onMouseover}});Zarafa.calendar.ui.CalendarContextMenu.superclass.constructor.call(this,a)},createContextActionItems:function(){return[{xtype:"zarafa.conditionalitem",iconCls:"icon_create_appointment",text:_("New Appointment"),beforeShow:this.beforeShowPhantom,meetingRequest:!1,handler:this.onCreate,scope:this},{xtype:"zarafa.conditionalitem",iconCls:"icon_create_meeting_request",text:_("New Meeting Request"),beforeShow:this.beforeShowPhantom,meetingRequest:!0,
handler:this.onCreate,scope:this},{xtype:"zarafa.conditionalitem",iconCls:"icon_open",text:_("Open"),beforeShow:this.beforeShowNonPhantom,handler:this.onOpen,scope:this},{xtype:"zarafa.conditionalitem",text:_("Copy/Move"),iconCls:"icon_copy",beforeShow:this.beforeShowNonPhantom,hideOnDisabled:!1,handler:this.onCopyMove,scope:this},{xtype:"zarafa.conditionalitem",iconCls:"icon_delete",text:_("Delete"),beforeShow:this.beforeShowNonPhantom,handler:this.onDelete,scope:this},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",
ref:"acceptButton",text:_("Accept"),hidden:!0,iconCls:"icon_calendar_appt_accept",beforeShow:this.beforeShowOnMeeting,responseStatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_ACCEPTED,scope:this},{xtype:"zarafa.conditionalitem",ref:"tentativeButton",text:_("Tentative"),hidden:!0,iconCls:"icon_appt_meeting_tentative",beforeShow:this.beforeShowOnMeeting,responseStatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE,scope:this},{xtype:"zarafa.conditionalitem",ref:"declineButton",text:_("Decline"),
iconCls:"icon_calendar_appt_cancelled",hidden:!0,beforeShow:this.beforeShowOnMeeting,responseStatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_DECLINED,scope:this},{xtype:"zarafa.conditionalitem",ref:"proposeNewTimeButton",text:_("Propose New Time"),proposeNewTime:!0,hidden:!0,iconCls:"icon_calendar_appt_newtime",beforeShow:this.beforeShowOnMeeting,scope:this}]},createContextOptionsItems:function(a){return[{xtype:"zarafa.conditionalitem",cls:"k-unclickable",iconCls:"icon_categories",text:_("Categories"),
hideOnClick:!1,beforeShow:this.beforeShowNonPhantom,menu:{xtype:"zarafa.categoriescontextmenu",records:a}},{xtype:"zarafa.conditionalitem",iconCls:"icon_busystatus",text:_("Show as"),beforeShow:this.beforeShowNonPhantom,menu:{xtype:"zarafa.conditionalmenu",items:this.createBusyStatusItems()}}]},createBusyStatusItems:function(){return[{xtype:"zarafa.conditionalitem",iconCls:"icon_busystatus_free",text:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.FREE),busyStatus:Zarafa.core.mapi.BusyStatus.FREE,
handler:this.onSetBusyStatus,scope:this},{xtype:"zarafa.conditionalitem",iconCls:"icon_busystatus_tentative",text:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.TENTATIVE),busyStatus:Zarafa.core.mapi.BusyStatus.TENTATIVE,handler:this.onSetBusyStatus,scope:this},{xtype:"zarafa.conditionalitem",iconCls:"icon_busystatus_busy",text:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.BUSY),busyStatus:Zarafa.core.mapi.BusyStatus.BUSY,handler:this.onSetBusyStatus,
scope:this},{xtype:"zarafa.conditionalitem",iconCls:"icon_busystatus_outofoffice",text:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.OUTOFOFFICE),busyStatus:Zarafa.core.mapi.BusyStatus.OUTOFOFFICE,handler:this.onSetBusyStatus,scope:this}]},onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.records)},beforeShowPhantom:function(a,b){for(var c=!1,d=0,e=b.length;d<e;d++)!1===b[d].phantom&&(c=!0);a.setVisible(!c)},beforeShowNonPhantom:function(a,b){for(var c=
!1,d=0,e=b.length;d<e;d++)!0===b[d].phantom&&(c=!0);a.setVisible(!c)},beforeShowOnMeeting:function(a,b){if(!(1<b.length)){var c=b[0],d=Ext.isDefined(a.proposeNewTime)&&a.proposeNewTime;c.isMeetingReceived()&&a.setVisible(!0);!c.isMeetingReceived()||c.isRecurringOccurence()||c.get("recurring")||(d?a.setHandler(this.openProposeNewTimeContent,this):a.setHandler(this.openSendConfirmationContent,this));c.isMeetingReceived()&&(c.isRecurringOccurence()||c.get("recurring"))&&(a.menu=new Ext.menu.Menu({items:[{xtype:"zarafa.conditionalitem",
text:a.text+" "+_("Occurrence"),responseStatus:a.responseStatus,beforeShow:function(a,b){d?a.setHandler(this.openProposeNewTimeContent,this):a.setHandler(this.openSendConfirmationContent,this)},scope:this},{xtype:"zarafa.conditionalitem",text:a.text+" "+_("Series"),name:"recurring",beforeShow:function(a,b){d?a.setVisible(!1):a.setHandler(this.openSendConfirmationContent,this)},responseStatus:a.responseStatus,isProposeButton:d,scope:this}],scope:this}))}},onMouseover:function(){this.calendarPanel&&
this.calendarPanel.getView().getTooltipInstance().hide(0)},openProposeNewTimeContent:function(a,b){var c;Array.isArray(this.records)&&(c=this.records[0]);c.get("appointment_not_found")?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("This appointment has been moved or deleted, do you want to continue?"),icon:Ext.MessageBox.WARNING,record:c,fn:this.onProposeNewTimeAppointmentNotFoundConfirmation.createDelegate(this,[c],1),scope:this,buttons:Ext.MessageBox.YESNO}):Zarafa.calendar.Actions.openProposeNewTimeContent(c)},
onProposeNewTimeAppointmentNotFoundConfirmation:function(a,b){"yes"===a&&Zarafa.calendar.Actions.openProposeNewTimeContent(b)},openSendConfirmationContent:function(a,b){var c;Array.isArray(this.records)&&(c=this.records[0],c.get("appointment_not_found")?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("This appointment has been moved or deleted, do you want to continue?"),icon:Ext.MessageBox.WARNING,record:c,fn:this.onRespondAppointmentNotFoundConfirmation.createDelegate(this,[a.responseStatus,
c],1),scope:this,buttons:Ext.MessageBox.YESNO}):Zarafa.calendar.Actions.openSendConfirmationContent(c,{responseType:a.responseStatus,buttonName:a.name}))},onRespondAppointmentNotFoundConfirmation:function(a,b,c){"yes"===a&&Zarafa.calendar.Actions.openSendConfirmationContent(c,{responseType:b})},onCategories:function(a){Zarafa.common.Actions.openCategoriesContent(this.records)},onSetBusyStatus:function(a){var b,c=this.records;Ext.each(c,function(c){b=c.getStore();c.set("busystatus",a.busyStatus)},
this);b.save(c)},onOpen:function(a){Zarafa.calendar.Actions.openAppointmentContent(this.records)},onDelete:function(a){Zarafa.common.Actions.deleteRecords(this.records)},onCreate:function(a){if(a.meetingRequest){a=0;for(var b=this.records.length;a<b;a++){var c=this.records[a];c.get("meeting")===Zarafa.core.mapi.MeetingStatus.NONMEETING&&c.convertToMeeting()}Zarafa.calendar.Actions.openMeetingRequestContent(this.records)}else Zarafa.calendar.Actions.openAppointmentContent(this.records)}});
Ext.reg("zarafa.calendarcontextmenu",Zarafa.calendar.ui.CalendarContextMenu);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarGridColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.createColumns(),defaults:{sortable:!0}});Zarafa.calendar.ui.CalendarGridColumnModel.superclass.constructor.call(this,a)},createColumns:function(){return[{xtype:"checkcolumn",headerCls:"zarafa-icon-column",header:'<p class="icon_allday">&nbsp;<span class="title">'+_("All Day")+"</span></p>",dataIndex:"alldayevent",tooltip:_("Sort by: All Day"),width:24,
fixed:!0,processEvent:Ext.emptyFn},{header:'<p class="icon_index">&nbsp;<span class="title">'+_("Icon")+"</span></p>",headerCls:"zarafa-icon-column",dataIndex:"icon_index",tooltip:_("Sort by: Icon"),width:24,renderer:Zarafa.common.ui.grid.Renderers.icon,fixed:!0},{header:'<p class="icon_recurring">&nbsp;<span class="title">'+_("Recurring")+"</span></p>",headerCls:"zarafa-icon-column",dataIndex:"recurring",tooltip:_("Sort by: Recurring"),width:24,renderer:Zarafa.common.ui.grid.Renderers.recurrence,
fixed:!0},{header:_("Subject"),dataIndex:"subject",tooltip:_("Sort by: Subject"),width:200,renderer:Zarafa.common.ui.grid.Renderers.subject},{header:_("Startdate"),dataIndex:"startdate",tooltip:_("Sort by: Startdate"),width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime},{header:_("Enddate"),dataIndex:"duedate",tooltip:_("Sort by: Enddate"),width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime},{header:_("Location"),dataIndex:"location",tooltip:_("Sort by: Location"),width:200,renderer:Zarafa.common.ui.grid.Renderers.subject},
{header:_("Duration"),dataIndex:"duration",tooltip:_("Sort by: Duration"),width:160,renderer:Zarafa.common.ui.grid.Renderers.duration},{header:_("Meeting Status"),dataIndex:"meeting",tooltip:_("Sort by: Meeting Status"),width:160,renderer:Zarafa.common.ui.grid.Renderers.meetingstatus},{header:_("Show as"),dataIndex:"busystatus",tooltip:_("Sort by: Show as"),width:160,renderer:Zarafa.common.ui.grid.Renderers.busystatus,hidden:!0},{header:_("Categories"),dataIndex:"categories",tooltip:_("Sort by: Categories"),
width:160,renderer:Zarafa.common.ui.grid.Renderers.categories},{header:_("Created On"),dataIndex:"creation_time",tooltip:_("Sort by: Created On"),width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime,hidden:!0},{header:_("Due By"),dataIndex:"duedate",tooltip:_("Sort by: Due By"),width:160,renderer:Zarafa.common.ui.grid.Renderers.dueBy,hidden:!0},{header:_("Label"),dataIndex:"label",tooltip:_("Sort by: Label"),width:160,renderer:Zarafa.common.ui.grid.Renderers.label,hidden:!0},{header:_("Organizer"),
dataIndex:"sent_representing_name",tooltip:_("Sort by: Organizer"),hidden:!0,renderer:Zarafa.common.ui.grid.Renderers.organizer},{header:_("Required Attendee"),dataIndex:"display_to",tooltip:_("Sort by: Required Attendee"),hidden:!0,renderer:Ext.util.Format.htmlEncode},{header:_("Optional Attendee"),dataIndex:"display_cc",tooltip:_("Sort by: Optional Attendee"),hidden:!0,renderer:Ext.util.Format.htmlEncode},{header:_("Resources"),dataIndex:"display_bcc",tooltip:_("Sort by: Resources"),hidden:!0,renderer:Ext.util.Format.htmlEncode},
{header:_("Recurring Startdate"),dataIndex:"startdate_recurring",tooltip:_("Sort by: Recurring Startdate"),width:160,renderer:Zarafa.common.ui.grid.Renderers.date,hidden:!0},{header:_("Recurring Enddate"),dataIndex:"enddate_recurring",tooltip:_("Sort by: Recurring Enddate"),width:160,renderer:Zarafa.common.ui.grid.Renderers.date,hidden:!0},{header:_("Recurring Pattern"),dataIndex:"recurring_pattern",tooltip:_("Sort by: Recurring Pattern"),width:400,renderer:Zarafa.common.ui.grid.Renderers.subject,
hidden:!0},{header:'<p class="icon_reminder">&nbsp;<span class="title">'+_("Reminder")+"</span></p>",headerCls:"zarafa-icon-column",dataIndex:"reminder",tooltip:_("Sort by: Reminder"),width:24,renderer:Zarafa.common.ui.grid.Renderers.reminder,fixed:!0,hidden:!0},{header:_("Sensitivity"),dataIndex:"sensitivity",tooltip:_("Sort by: Sensitivity"),width:160,renderer:Zarafa.common.ui.grid.Renderers.sensitivity,hidden:!0}]}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarMainPanel=Ext.extend(Zarafa.common.ui.ContextMainPanel,{viewPanel:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.calendarmainpanel",layout:"fit",items:[{xtype:"zarafa.switchviewcontentcontainer",ref:"viewPanel",layout:"card",lazyItems:this.initViews(a.context)}],tbar:{xtype:"zarafa.calendarpaneltoolbar",defaultTitle:_("Calendar"),paging:container.populateInsertionPoint("context.calendar.toolbar.paging",this),items:container.populateInsertionPoint("context.calendar.toolbar.item",
this),context:a.context,model:a.context.getModel()}});Zarafa.calendar.ui.CalendarMainPanel.superclass.constructor.call(this,a)},initViews:function(a){var b=[{xtype:"zarafa.calendarblockpanel",id:"calendar_blocks",context:a},{xtype:"zarafa.calendargrid",id:"calendar_grid",context:a}];a=container.populateInsertionPoint("context.calendar.views",this,a);return b=b.concat(a)},initEvents:function(){Ext.isDefined(this.context)&&(this.mon(this.context,"viewchange",this.onViewChange,this),this.onViewChange(this.context,
this.context.getCurrentView()))},onViewChange:function(a,b){switch(b){default:this.viewPanel.switchView("calendar_blocks");break;case Zarafa.calendar.data.Views.LIST:case Zarafa.calendar.data.Views.SEARCH:this.viewPanel.switchView("calendar_grid")}}});Ext.reg("zarafa.calendarmainpanel",Zarafa.calendar.ui.CalendarMainPanel);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarMultiView=Ext.extend(Zarafa.core.ui.View,{context:void 0,tabAreaHeight:39,headerTextHeight:24,headerItemHeight:24,headerLineHeight:1,calendarGap:6,numHours:24,timeStripWidth:60,timeStripGap:0,zoomLevel:30,model:void 0,timeStripShift:1,firstWorkingHour:540,lastWorkingHour:1020,workingDays:void 0,tooltip:void 0,tabStrokeHeight:9,constructor:function(a){a=a||{};Ext.isDefined(a.context)&&(Ext.isDefined(a.zoomLevel)||(a.zoomLevel=a.context.getZoomLevel()),Ext.isDefined(a.model)||
(a.model=a.context.getModel()));Ext.isDefined(a.firstWorkingHour)||(a.firstWorkingHour=container.getSettingsModel().get("zarafa/v1/main/start_working_hour"));Ext.isDefined(a.lastWorkingHour)||(a.lastWorkingHour=container.getSettingsModel().get("zarafa/v1/main/end_working_hour"));Ext.isDefined(a.workingDays)||(a.workingDays=container.getSettingsModel().get("zarafa/v1/main/working_days"));a=Ext.applyIf(a,{baseCls:"zarafa-calendar",timeUnitHeight:24,minHeaderDayTextWidth:150,showBorder:!1,borderWidth:1,
showTimeStrips:!0});this.addEvents("appointmentcalendardrop","appointmentmouseover","appointmentmouseout","appointmentmove","appointmentresize","appointmentcreate","appointmentinitdrag","appointmentenddrag","contextmenu","dblclick","dayclick","calendarclose");Zarafa.calendar.ui.CalendarMultiView.superclass.constructor.call(this,a)},init:function(){Zarafa.calendar.ui.CalendarMultiView.superclass.init.call(this);this.calendars=[];this.timeStrips=[];Ext.isDefined(this.context)&&(this.mon(this.context,
"viewmodechange",this.onViewModeChanged,this),this.mon(this.context,"zoomchange",this.onZoomLevelChanged,this));Ext.isDefined(this.model)&&this.mon(this.model,"foldermergestatechanged",this.onFolderMergestateChanged,this);this.addTimeStrip()},getSelectionModel:function(){return this.selectionModel},getRangeSelectionModel:function(){return this.rangeSelectionModel},getDateRange:function(){return this.model.dateRange},getTabHeight:function(){return this.showBorder?this.tabAreaHeight:0},addTimeStrip:function(a,
b){var c=new Zarafa.calendar.ui.TimeStripView({timeDifference:a||0,name:b||""});this.addChildView(c);this.timeStrips.splice(0,0,c);this.rendered&&(c.render(this.container),this.layout())},removeTimeStrip:function(a){for(var b=0,c;c=this.timeStrips[b];b++)if(c.name==a){this.timeStrips.splice(b,1);this.removeChildView(c,!0);break}this.layout()},getTooltipInstance:function(){this.tooltip||(this.tooltip=new Zarafa.calendar.ui.ToolTip({target:this.el,view:this}));return this.tooltip},onViewModeChanged:function(a,
b,c){a=Zarafa.calendar.ui.canvas;if(this.rendered){switch(b){case Zarafa.calendar.data.ViewModes.DAYS:this.showTimeStrips=!0;this.calendarViewConstructor=a.CalendarDaysView;this.container.addClass("zarafa-calendar-daysview");this.container.removeClass("zarafa-calendar-boxview");break;case Zarafa.calendar.data.ViewModes.BOX:this.showTimeStrips=!1;this.calendarViewConstructor=a.CalendarBoxView;this.container.removeClass("zarafa-calendar-daysview");this.container.addClass("zarafa-calendar-boxview");
break;default:this.showTimeStrips=!1,this.container.removeClass("zarafa-calendar-daysview"),this.container.removeClass("zarafa-calendar-boxview")}b=this.calendars.clone();a=0;for(c=b.length;a<c;a++){var d=b[a],e=d.getFolders();0<e.length&&this.createCalendarView(d.groupId,e).setSelectedFolder(d.selectedFolder);this.removeCalendarView(d)}if(this.store&&this.store.lastOptions&&!this.store.isExecuting("list"))this.onLoad(this.store,this.store.getRange(),this.store.lastOptions)}},onZoomLevelChanged:function(a,
b){this.zoomLevel=b;this.layout()},onFolderMergestateChanged:function(a,b){Ext.isDefined(this.folders)&&this.manageCalendarViews()},onAppointmentCalendarDrop:function(a,b,c,d,e){this.fireEvent("appointmentcalendardrop",this,c,b.getSelectedFolder(),a.getSelectedFolder(),d,e)},onAppointmentMouseOver:function(a,b,c){this.fireEvent("appointmentmouseover",this,b,c)},onAppointmentMouseOut:function(a,b,c){this.fireEvent("appointmentmouseout",this,b,c)},onAppointmentMove:function(a,b,c,d){this.fireEvent("appointmentmove",
this,b,c,d)},onAppointmentResize:function(a,b,c,d){this.fireEvent("appointmentresize",this,b,c,d)},onAppointmentCreate:function(a,b,c){this.fireEvent("appointmentcreate",this,a.getSelectedFolder(),b,c)},onAppointmentInitDrag:function(a,b,c){this.fireEvent("appointmentinitdrag",this,b,c)},onAppointmentEndDrag:function(a,b,c){this.fireEvent("appointmentenddrag",this,b,c)},onContextMenu:function(a,b,c,d){if(c){if(0===c.get("access"))return;!0!==c.phantom&&(this.rangeSelectionModel.clearSelections(),
this.selectionModel.selectRecord(c,!1))}else d&&(c=this.model.createRecord(a.getSelectedFolder(),d),this.rangeSelectionModel.set(d,a)),this.selectionModel.clearSelections();this.fireEvent("contextmenu",b,c)},onDoubleClick:function(a,b,c){if(c){if(0===c.get("access"))return;!0!==c.phantom&&(this.selectionModel.selectRecord(c,!1),this.rangeSelectionModel.clearSelections())}else this.selectionModel.clearSelections();this.fireEvent("dblclick",b,c)},onDayClick:function(a,b){this.fireEvent("dayclick",a,
b)},getHourHeight:function(){return 60/this.zoomLevel*this.timeUnitHeight},getBorderWidth:function(){return this.showBorder?this.borderWidth:0},getTabAreaHeight:function(){return this.showBorder?this.tabAreaHeight:0},getHeaderAreaHeight:function(){for(var a=0,b=0,c;c=this.calendars[b];b++)a=Math.max(a,c.getDesiredHeaderHeight());return a},render:function(a){this.rendered||(a.addClass(this.getClassName("body")),this.createDiv(a,"tab",this.getClassName("tabarea")),this.createDiv(a,"header",this.getClassName("header",
void 0,"scrollable")),this.createDiv(a,"scrollable",this.getClassName("scrollable",void 0,"zoom-"+this.zoomLevel+"m")),this.createDiv(a,"bottom",this.getClassName("bottomarea")),this.createDiv(a,"headerLine",this.getClassName("headerLine")),this.scrollable.ddScrollConfig={vthresh:50,hthresh:-1,frequency:100,increment:100},this.header.ddScrollConfig={vthresh:50,hthresh:-1,frequency:100,increment:100},Zarafa.calendar.ui.CalendarMultiView.superclass.render.call(this,a),this.renderChildren(),this.onViewModeChanged(this.context,
this.context.getCurrentViewMode()))},bindStore:function(a){if(this.store!=a&&(Ext.isDefined(a)&&this.mon(a,{beforeload:this.onBeforeLoad,load:this.onLoad,add:this.onAdd,remove:this.onRemove,update:this.onUpdate,scope:this}),(this.store=a)&&a.lastOptions&&!a.isExecuting("list")))this.onLoad(a,a.getRange(),a.lastOptions)},releaseStore:function(a){Ext.isDefined(a)&&this.mun(a,{beforeload:this.onBeforeLoad,load:this.onLoad,add:this.onAdd,remove:this.onRemove,update:this.onUpdate,scope:this});a&&a.autoDestroy&&
a.destroy();this.store=void 0},resizeAreas:function(a){var b=this.getTabHeight(),c=this.getHeaderAreaHeight();this.showTimeStrips&&(c=Math.min(c,this.container.getHeight()/2));var d=b+c,e=this.container.getHeight()-d-this.getBorderWidth();this.showTimeStrips&&(e=Math.min(e,this.getHourHeight()*this.numHours));var f=e+d;this.tab.setLeftTop(0,0);this.tab.setSize(this.container.getWidth(),b);this.header.setLeftTop(0,b);this.header.setSize(this.container.getWidth(),c);this.scrollable.setLeftTop(0,d);
this.scrollable.setSize(this.container.getWidth(),e);this.showTimeStrips&&!a&&(a=this.firstWorkingHour/60*this.getHourHeight(),this.scrollable.scrollTo("top",a));this.bottom.setLeftTop(0,f);this.bottom.setSize(this.container.getWidth(),this.getBorderWidth());for(f=0;a=this.timeStrips[f];f++)a.setLeftMargin((this.timeStripWidth+this.timeStripGap)*f-this.timeStripShift),a.setWidth(this.timeStripWidth);f=this.showTimeStrips?this.timeStrips.length*this.timeStripWidth+(this.timeStrips.length-1)*this.timeStripGap-
this.timeStripShift:0;this.headerLine.setLeftTop(0,d-this.headerLineHeight);this.headerLine.setSize(f,this.headerLineHeight)},onLayout:function(){this.resizeAreas();this.scrollable.dom.style.overflowY=this.showTimeStrips?"scroll":"hidden";this.showTimeStrips&&this.getHeaderAreaHeight()>this.container.getHeight()/2?this.header.dom.style.overflowY="scroll":this.header.dom.style.overflowY="hidden";this.showTimeStrips||(this.scrollable.scrollTo("top",0),this.header.scrollTo("top",0));Ext.dd.ScrollManager.unregister(this.scrollable);
Ext.dd.ScrollManager.unregister(this.header);this.context.getCurrentViewMode()===Zarafa.calendar.data.ViewModes.DAYS&&(Ext.dd.ScrollManager.register(this.scrollable),Ext.dd.ScrollManager.register(this.header));for(var a=0,b;b=this.timeStrips[a];a++)b.setVisible(this.showTimeStrips);b=this.showTimeStrips?this.timeStrips.length*this.timeStripWidth+(this.timeStrips.length-1)*this.timeStripGap-this.timeStripShift:0;for(var c=(this.scrollable.dom.clientWidth-b-(this.calendars.length-1)*this.calendarGap)/
this.calendars.length+this.calendarGap,a=0,d;d=this.calendars[a];a++){var e=Math.round(c*a+b),f=Math.round(c*(a+1)+b-this.calendarGap);d.setActive(this.model.getActiveGroup()==d.groupId);d.setCanMerge(0<a);d.setCanClose(1<this.folders.length);d.setLeftMargin(e);d.setWidth(f-e)}},onAfterLayout:function(){this.layoutChildren()},getCalendarViewByFolder:function(a){for(var b=0,c;c=this.calendars[b];b++)if(c.containsFolder(a))return c},createCalendarView:function(a,b){Ext.isEmpty(b)||Array.isArray(b)||
(b=[b]);var c=new this.calendarViewConstructor({selectionModel:this.selectionModel,rangeSelectionModel:this.rangeSelectionModel,enableDD:this.enableDD,groupId:a,contextModel:this.model});this.mon(c,{appointmentcalendardrop:this.onAppointmentCalendarDrop,appointmentmouseover:this.onAppointmentMouseOver,appointmentmouseout:this.onAppointmentMouseOut,appointmentmove:this.onAppointmentMove,appointmentresize:this.onAppointmentResize,appointmentcreate:this.onAppointmentCreate,appointmentinitdrag:this.onAppointmentInitDrag,
appointmentenddrag:this.onAppointmentEndDrag,contextmenu:this.onContextMenu,dblclick:this.onDoubleClick,dayclick:this.onDayClick,activate:this.onCalendarActivate,merge:this.onCalendarMerge,separate:this.onCalendarSeparate,close:this.onCalendarClose,scope:this});b&&Ext.each(b,c.addFolder,c);this.addChildView(c);this.calendars.push(c);this.rendered&&c.render(this.container);return c},removeCalendarView:function(a){this.calendars.remove(a);this.mun(a,{appointmentcalendardrop:this.onAppointmentCalendarDrop,
appointmentmouseover:this.onAppointmentMouseOver,appointmentmouseout:this.onAppointmentMouseOut,appointmentmove:this.onAppointmentMove,appointmentresize:this.onAppointmentResize,appointmentcreate:this.onAppointmentCreate,appointmentinitdrag:this.onAppointmentInitDrag,appointmentenddrag:this.onAppointmentEndDrag,contextmenu:this.onContextMenu,dblclick:this.onDoubleClick,dayclick:this.onDayClick,activate:this.onCalendarActivate,merge:this.onCalendarMerge,separate:this.onCalendarSeparate,close:this.onCalendarClose,
scope:this});this.removeChildView(a,!0)},pruneCalendarViews:function(a){for(var b=this.calendars.clone(),c=0,d;d=b[c];c++){for(var e=d.getFolders().clone(),f=0,g;g=e[f];f++)-1==a.indexOf(g)&&(this.model.removeFolderFromGroup(g,d.groupId),d.removeFolder(g));this.removeCalendarViewIfEmpty(d);d.isDestroyed||this.updateActiveFolder(d)}},createCalendarViews:function(a){var b=this.model.getGroupings();Ext.isDefined(b)&&0!==Object.keys(b).length||(this.model.resetGroupings(),this.model.applyGrouping(),b=
this.model.getGroupings());Ext.iterate(b,function(b,d){var c=[];if(Ext.isEmpty(d.folders))return!0;for(var f=0;f<a.length;f++)-1<d.folders.indexOf(a[f].get("entryid"))&&c.push(a[f]);if(!Ext.isEmpty(c)){var f=c[0],g=this.getCalendarViewByFolder(f);if(g)if(1<g.folders.length){var h=this.createCalendarView(b);this.moveFolder(g,h,f);g=h}else g.groupId!==b&&(g.groupId=b);else g=this.createCalendarView(b,f);for(f=1;f<c.length;f++){var h=c[f],k=this.getCalendarViewByFolder(h);k&&k!==g?this.moveFolder(k,
g,h):k||g.addFolder(h)}g.setSelectedFolder(g.getFolderById(d.active))}},this)},sortCalendarViews:function(a){for(var b=[],c=0,d;d=a[c];c++)(d=this.getCalendarViewByFolder(d))&&-1==b.indexOf(d)&&b.push(d);for(c=0;d=b[c];c++)d.sortFolders(a);this.calendars=b},manageCalendarViews:function(){this.pruneCalendarViews(this.folders);this.createCalendarViews(this.folders);this.sortCalendarViews(this.folders)},onBeforeLoad:function(a,b){if(this.rendered){for(var c=0,d=this.calendars.length;c<d;c++)this.calendars[c].beforeAppointmentsLoad(a,
b);this.layout()}},onLoad:function(a,b,c){if(this.rendered){this.folders=c.folder||[];this.showBorder=!0;this.manageCalendarViews();for(var d=0,e=this.calendars.length;d<e;d++)this.calendars[d].onAppointmentsLoad(a,b,c);this.layout()}},onAdd:function(a,b,c){if(Array.isArray(b))for(var d=0,e=b.length;d<e;d++)this.onAdd(a,b[d],c);else for(d=0,e=this.calendars.length;d<e;d++)this.calendars[d].onAppointmentAdd(a,b,c)},onRemove:function(a,b,c){if(Array.isArray(b))for(var d=0,e=b.length;d<e;d++)this.onRemove(a,
b[d],c);else{d=0;for(e=this.calendars.length;d<e;d++)this.calendars[d].onAppointmentRemove(a,b,c);!0===b.get("alldayevent")&&1<=Date.diff(Date.DAY,b.get("duedate"),b.get("startdate"))&&this.resizeAreas(!0)}},onUpdate:function(a,b,c){if(Array.isArray(b))for(var d=0,e=b.length;d<e;d++)this.onUpdate(a,b[d],c);else for(d=0,e=this.calendars.length;d<e;d++){var f=this.calendars[d],g=f.containsAppointment(b),h=f.containsFolderId(b.get("parent_entryid"));if(g&&!h)f.onAppointmentRemove(a,b,c);else if(!g&&
h)f.onAppointmentAdd(a,b,c);else this.calendars[d].onAppointmentUpdate(a,b,c)}},removeCalendarViewIfEmpty:function(a){0===a.getFolders().length&&this.removeCalendarView(a)},moveFolder:function(a,b,c){b.addFolder(c);for(var d=a.getAppointmentRecords().clone(),e=0,f;f=d[e];e++)Zarafa.core.EntryId.compareEntryIds(f.get("parent_entryid"),c.get("entryid"))&&(a.removeAppointment(f,!1),b.addAppointment(f,!1));b.sortFolders(this.folders);b.setActive(!0);a.removeFolder(c);this.removeCalendarViewIfEmpty(a);
a.isDestroyed||(this.updateActiveFolder(a),a.setActive(!1))},mergeFolder:function(a,b,c){this.model.mergeFolderToGroup(c,b.groupId,a.groupId);this.moveFolder(a,b,c)},separateFolder:function(a,b){var c=this.model.separateFolderFromGroup(b,a.groupId),c=this.createCalendarView(c);this.moveFolder(a,c,b)},updateActiveFolder:function(a){var b=this.model.getGroupings()[a.groupId];b&&b.active&&a.setSelectedFolder(a.getFolderById(b.active))},onCalendarActivate:function(a,b){this.model.activateFolderInGroup(b,
a.groupId);this.model.setActiveFolder(b);for(var c=0,d=this.calendars.length;c<d;c++)this.calendars[c].setActive(this.model.getActiveGroup()==this.calendars[c].groupId),this.calendars[c].layoutTabs()},onCalendarMerge:function(a,b){for(var c=-1,d=0,e;e=this.calendars[d];d++)e==a&&(c=d);1>c||(this.mergeFolder(a,this.calendars[c-1],b),this.sortCalendarViews(this.folders),this.layout())},onCalendarSeparate:function(a,b){1!=a.getFolders().length&&(this.separateFolder(a,b),this.sortCalendarViews(this.folders),
this.layout())},onCalendarClose:function(a,b){this.fireEvent("calendarclose",b)},onDestroy:function(){Zarafa.calendar.ui.CalendarMultiView.superclass.onDestroy.apply(this,arguments);this.scrollable&&Ext.dd.ScrollManager.unregister(this.scrollable);this.header&&Ext.dd.ScrollManager.unregister(this.header);this.tooltip&&this.tooltip.destroy()}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarPanelToolbar=Ext.extend(Zarafa.common.ui.ContextMainPanelToolbar,{constructor:function(a){a=a||{};a.paging=a.paging||[];a.paging.push({xtype:"toolbar",ref:"dateToolbar",items:[{xtype:"button",iconCls:"x-tbar-page-prev",handler:this.onPrevious,scope:this},{xtype:"button",iconCls:"x-tbar-page-next",handler:this.onNext,scope:this},{xtype:"tbseparator"},{xtype:"tbtext",ref:"../text"}]});Zarafa.calendar.ui.CalendarPanelToolbar.superclass.constructor.call(this,a)},initComponent:function(){Zarafa.calendar.ui.CalendarPanelToolbar.superclass.initComponent.call(this);
this.model&&(this.mon(this.model,"daterangechange",this.onDateRangeChange,this),this.mon(this.model,"datamodechange",this.onDataModeChange,this),this.on("afterlayout",this.onAfterFirstLayout,this,{single:!0}))},onAfterFirstLayout:function(){if(this.model){this.text.setText(this.model.getDateRangeText());var a=this.model.getCurrentDataMode();this.onDataModeChange(this.model,a,a)}},onDataModeChange:function(a,b,c){if(b===Zarafa.calendar.data.DataModes.ALL||b===Zarafa.calendar.data.DataModes.SEARCH)this.pagesToolbar.setVisible(!0),
this.dateToolbar.setVisible(!1);else switch(this.pagesToolbar.setVisible(!1),this.dateToolbar.setVisible(!0),b){case Zarafa.calendar.data.DataModes.WEEK:case Zarafa.calendar.data.DataModes.WORKWEEK:this.text.setWidth(250);break;case Zarafa.calendar.data.DataModes.DAY:this.text.setWidth(140);break;default:this.text.setWidth(120)}this.doLayout()},onDateRangeChange:function(a,b){this.text.setText(a.getDateRangeText())},onNext:function(){this.model.nextDate()},onPrevious:function(){this.model.previousDate()}});
Ext.reg("zarafa.calendarpaneltoolbar",Zarafa.calendar.ui.CalendarPanelToolbar);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarTabView=Ext.extend(Zarafa.core.ui.View,{title:void 0,folder:void 0,tab:void 0,tabContents:void 0,tabText:void 0,mergeIcon:void 0,separateIcon:void 0,closeIcon:void 0,width:0,selected:!0,active:!1,showMergeIcon:!1,showSeparateIcon:!1,showCloseIcon:!1,constructor:function(a){a=a||{};var b;a.folder&&(b=a.folder.getFullyQualifiedDisplayName());Ext.applyIf(a,{baseCls:"zarafa-calendar",title:b?Ext.util.Format.htmlEncode(b):void 0});this.addEvents("merge","separate","close","click");
Zarafa.calendar.ui.CalendarTabView.superclass.constructor.call(this,a)},getDesiredWidth:function(){if(!this.rendered)return 0;var a=!this.tabContents.hasClass("zarafa-calendar-tab-selected");a&&this.tabContents.addClass("zarafa-calendar-tab-selected");var b=Ext.util.TextMetrics.createInstance(this.tabText);a&&this.tabContents.removeClass("zarafa-calendar-tab-selected");a=this.getMinimumWidth()+b.getWidth(this.title);this.tabContents.dom.style.removeProperty("min-width");b=parseInt(this.tabContents.getStyle("min-width"))+
this.tabContents.getPadding("lr");return Math.max(a,b)},getMinimumWidth:function(){if(!this.rendered)return 0;var a=this.tabContents.getPadding("lr");this.showCloseIcon&&(a+=this.closeIcon.getWidth());this.showMergeIcon&&(a+=this.mergeIcon.getWidth());this.showSeparateIcon&&(a+=this.separateIcon.getWidth());return a},setWidth:function(a){this.width=a},setSelected:function(a,b,c){if(!0===c||this.selected!==a||this.active!==b)c=this.getBaseClassName()+"-tab-selected",!0===a?!0===b?(this.tabContents.addClass(c),
this.parentView.activeTabStroke.addClass(c)):(this.tabContents.removeClass(c),this.parentView.activeTabStroke.removeClass(c)):(this.tabContents.removeClass(c),!0!==b&&this.parentView.activeTabStroke.removeClass(c));this.active=b;this.selected=a},setShowMergeIcon:function(a){this.showMergeIcon=a},setShowSeparateIcon:function(a){this.showSeparateIcon=a},setShowCloseIcon:function(a){this.showCloseIcon=a},applyCSSClassNames:function(){var a=container.getCurrentContext().getModel();a instanceof Zarafa.calendar.CalendarContextModel&&
(a=a.getColorScheme(this.folder.get("entryid")),this.tabContents.dom.className=this.getClassName("tab","contents"),this.mergeIcon.dom.className=this.getClassName("tab-icon","merge"),this.tabText.dom.className=this.getClassName("tab-title"),this.closeIcon.dom.className=this.getClassName("tab-icon","close"),this.separateIcon.dom.className=this.getClassName("tab-icon","separate"),this.tabContents.applyStyles({"background-color":a.header}),this.selected&&this.setSelected(this.selected,this.active,!0))},
onLayout:function(){this.applyCSSClassNames();var a=container.getCurrentContext().getModel();a instanceof Zarafa.calendar.CalendarContextModel&&(a=a.getColorScheme(this.folder.get("entryid")),155>Zarafa.core.ColorSchemes.getLuma(a.base)||this.tabContents.addClass("light-background"));this.showMergeIcon?this.tabContents.addClass("zarafa-with-merge-icon"):this.tabContents.removeClass("zarafa-with-merge-icon");this.showSeparateIcon?this.tabContents.addClass("zarafa-with-separate-icon"):this.tabContents.removeClass("zarafa-with-separate-icon");
this.showCloseIcon?this.tabContents.addClass("zarafa-with-close-icon"):this.tabContents.removeClass("zarafa-with-close-icon");this.tabContents.setWidth(this.width);this.tabText.setWidth(this.width-this.getMinimumWidth());this.mergeIcon.setVisible(this.showMergeIcon);this.tabText.dom.innerHTML!=this.title&&(this.tabText.dom.innerHTML=this.title);this.closeIcon.setVisible(this.showCloseIcon);this.separateIcon.setVisible(this.showSeparateIcon);Zarafa.calendar.ui.CalendarTabView.superclass.onLayout.call(this)},
render:function(a){this.createDiv(this.parentView.tabArea,"tabContents");this.createDiv(this.tabContents,"mergeIcon");this.createDiv(this.tabContents,"tabText");this.createDiv(this.tabContents,"closeIcon");this.createDiv(this.tabContents,"separateIcon");this.mergeIcon.setVisibilityMode(Ext.Element.DISPLAY);this.closeIcon.setVisibilityMode(Ext.Element.DISPLAY);this.separateIcon.setVisibilityMode(Ext.Element.DISPLAY);this.mon(this.mergeIcon,"click",this.onMerge,this);this.mon(this.separateIcon,"click",
this.onSeparate,this);this.mon(this.closeIcon,"click",this.onClose,this);this.mon(this.tabText,"click",this.onClick,this);this.tabText.textMetrics=Ext.util.TextMetrics.createInstance(this.tabText);this.applyCSSClassNames();Zarafa.calendar.ui.CalendarTabView.superclass.render.call(this,a)},onMerge:function(){this.fireEvent("merge",this.folder)},onSeparate:function(){this.fireEvent("separate",this.folder)},onClose:function(){this.fireEvent("close",this.folder)},onClick:function(){this.fireEvent("click",
this.folder)}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.TextEditView=Ext.extend(Zarafa.core.ui.View,{dateRange:void 0,minimumHeight:20,inputText:"",constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar",itemCls:"textedit"});this.addEvents("textentered","cancelled");Zarafa.calendar.ui.TextEditView.superclass.constructor.call(this,a)},setDateRange:function(a){this.dateRange=a},getDateRange:function(){return this.dateRange},isVisible:function(){return this.visible},render:function(a){this.create("textarea",this.parentView.getCalendarBody(),
"body",this.getClassName("body"));this.create("textarea",this.parentView.getCalendarHeader(),"header",this.getClassName("header"));this.header.setSize(2,2);this.mon(this.body,"keypress",this.onKeyPress,this);this.mon(this.body,"keydown",this.onKeyPress,this);this.mon(this.body,"blur",this.onBlur,this);this.mon(this.body,"keyup",this.onKeyUp,this);this.mon(this.header,"keypress",this.onKeyPress,this);this.mon(this.header,"keydown",this.onKeyPress,this);this.mon(this.header,"blur",this.onBlur,this);
this.mon(this.header,"keyup",this.onKeyUp,this);Zarafa.calendar.ui.TextEditView.superclass.render.call(this,a);this.hide()},makeElementsVisible:function(a,b){Ext.each(a,function(a){a.setVisible(b)})},hide:function(){this.rendered&&(this.makeElementsVisible([this.body,this.header],!1),this.visible=!1)},show:function(){this.rendered&&(this.visible=!0,this.layout())},onKeyPress:function(a){a.keyCode==a.ESC&&this.hide();if(a.keyCode==a.RETURN){var b=a.browserEvent.target.value;this.inputText=a.browserEvent.target.value=
"";this.hide();this.fireEvent("textentered",this,b)}},onKeyUp:function(a){a.keyCode!==a.RETURN&&(this.inputText=a.browserEvent.target.value)},onBlur:function(a){var b=this.parentView.isHeaderRange(this.getDateRange());if(b&&a.target==this.header.dom||!b&&a.target==this.body.dom)this.hide(),this.fireEvent("cancelled",this)},layoutInBody:function(){this.makeElementsVisible(this.header,!1);var a=this.parentView.dateRangeToBodyBounds(this.dateRange);0===a.length?this.makeElementsVisible(this.body,!1):
(this.makeElementsVisible(this.body,!0),this.body.setLeftTop(a[0].left,a[0].top),this.body.setSize(a[0].right-a[0].left,a[0].bottom-a[0].top))},layoutInHeader:function(){this.makeElementsVisible(this.body,!1);var a=this.parentView.dateRangeToHeaderBounds(this.dateRange,this.slot);this.makeElementsVisible(this.header,!0);this.header.setLeftTop(a.left,a.top);this.header.setSize(a.right-a.left,this.minimumHeight)},onLayout:function(){if(this.rendered){if(this.visible)this.parentView.isHeaderRange(this.getDateRange())?
this.layoutInHeader():this.layoutInBody();else if(this.makeElementsVisible([this.body,this.header],!1),!Ext.isEmpty(this.inputText)){var a=this.inputText;this.inputText="";this.fireEvent("textentered",this,a)}Zarafa.calendar.ui.TextEditView.superclass.onLayout.call(this)}},select:function(){this.rendered&&(this.show(),this.parentView.isHeaderRange(this.getDateRange())?this.header.dom.select():this.body.dom.select())}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.TimeStripView=Ext.extend(Zarafa.core.ui.View,{timeDifference:0,name:"",textTemplate:"<div>{0}:00</div>",leftOffset:0,width:0,header:void 0,body:void 0,bodyElements:void 0,bodyLines:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar",itemCls:"timestrip"});Zarafa.calendar.ui.TimeStripView.superclass.constructor.call(this,a)},setLeftMargin:function(a){this.leftOffset=a},setWidth:function(a){this.width=a},render:function(a){this.createDiv(this.parentView.scrollable,
"body",this.getClassName("body"));this.bodyElements=[];this.bodyLines=[];for(var b=this.parentView.numHours,c=0;c<b;c++)this.createDiv(this.body,"bodyElements",this.getClassName("element")),this.createDiv(this.body,"bodyLines",this.getClassName("line"));this.createDiv(this.parentView.header,"header",this.getClassName("header"));this.header.dom.innerHTML=this.name;Zarafa.calendar.ui.TimeStripView.superclass.render.call(this,a);this.generateText()},setVisible:function(a){this.rendered&&(this.body.setVisible(a),
this.header.setVisible(a))},generateText:function(){if(this.rendered)for(var a=0,b=this.bodyElements.length;a<b;a++)this.bodyElements[a].dom.innerHTML=String.format(this.textTemplate,(new Date(0,0,0,(a+Math.floor(this.timeDifference)+24)%24)).format(_("G")))},onLayout:function(){if(this.rendered){this.body.setLeftTop(this.leftOffset,0);this.body.setSize(this.width,this.parentView.getHourHeight()*this.parentView.numHours);for(var a=Math.round(this.timeDifference)-this.timeDifference,b=0,c=this.bodyElements.length;b<
c;b++)this.bodyElements[b].setSize(this.width,this.parentView.getHourHeight()),this.bodyElements[b].setLeftTop(0,this.parentView.getHourHeight()*(b+a));b=0;for(c=this.bodyLines.length;b<c;b++)this.bodyLines[b].setSize(this.width,1),this.bodyLines[b].setLeftTop(0,this.parentView.getHourHeight()*(b+a)-1);this.header.setWidth(this.width);this.header.setLeft(this.leftOffset);this.header.setBottom(0);Zarafa.calendar.ui.TimeStripView.superclass.onLayout.call(this)}},setTimeDifference:function(a){this.timeDifference=
a;this.generateText();this.layout()},setName:function(a){this.name=a;this.generateText()}});Ext.namespace("Zarafa.contact");
Zarafa.contact.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[{key:Ext.EventObject.C,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewContact,scope:this,settingsCfg:{description:_("New contact"),category:_("Creating an item")}},{key:Ext.EventObject.D,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewDistributionList,scope:this,settingsCfg:{description:_("New distribution list"),category:_("Creating an item")}}];Zarafa.core.KeyMapMgr.register("global",a)},onNewContact:function(a,
b,c){Zarafa.contact.Actions.openCreateContactContent(container.getContextByName("contact").getModel())},onNewDistributionList:function(a,b,c){Zarafa.contact.Actions.openCreateDistlistContent(container.getContextByName("contact").getModel())}});Zarafa.contact.KeyMapping=new Zarafa.contact.KeyMapping;Ext.namespace("Zarafa.contact.attachitem");
Zarafa.contact.attachitem.AttachContactColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.getColumns(),defaults:{sortable:!0}});Zarafa.contact.attachitem.AttachContactColumnModel.superclass.constructor.call(this,a)},getColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:"<p class='icon_index'>&nbsp;</p>",tooltip:_("Sort by: Icon"),width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},
{header:"<p class='icon_attachment'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"hasattach",width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.attachment,tooltip:_("Sort by: Attachment")},{dataIndex:"fileas",header:_("File As"),tooltip:_("Sort by: File As"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"company_name",header:_("Company Name"),tooltip:_("Sort by: Company Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"title",header:_("Job Title"),tooltip:_("Sort by: Job Title"),
renderer:Ext.util.Format.htmlEncode}]}});Ext.namespace("Zarafa.contact.attachitem");
Zarafa.contact.attachitem.AttachContactRenderer=Ext.extend(Zarafa.common.attachment.dialogs.AttachItemBaseRenderer,{constructor:function(a){Zarafa.contact.attachitem.AttachContactRenderer.superclass.constructor.call(this,a);Ext.apply(this.labels,{display_name:_("Full Name"),last_name:_("Last Name"),first_name:_("First Name"),job_title:_("Job Title"),department_name:_("Department Name"),company_name:_("Company Name"),im:_("IM Address"),home_address:_("Home Address"),business_address:_("Business Address"),
other_address:_("Other Address"),office_telephone_number:_("Business Phone"),business2_telephone_number:_("Business 2 Phone"),assistant_telephone_number:_("Assistant Phone"),company_telephone_number:_("Company Main Phone"),home_telephone_number:_("Home Phone"),home2_telephone_number:_("Home 2 Phone"),cellular_telephone_number:_("Mobile"),car_telephone_number:_("Car Phone"),radio_telephone_number:_("Radio"),pager_telephone_number:_("Pager"),callback_telephone_number:_("Callback Phone"),other_telephone_number:_("Other Phone"),
primary_telephone_number:_("Primary Phone"),telex_telephone_number:_("Telex"),ttytdd_telephone_number:_("TTY/TDD Phone"),isdn_number:_("ISDN"),other_fax_number:_("Other Fax"),business_fax_number:_("Business Fax"),home_fax_number:_("Home Fax"),email_address_1:_("Email"),email_address_display_name_1:_("Email Display As"),email_address_2:_("Email 2"),email_address_display_name_2:_("Email2 Display As"),email_address_3:_("Email 3"),email_address_display_name_3:_("Email3 Display As"),birthday:_("Birthday"),
wedding_anniversary:_("Wedding Anniversary"),spouse_name:_("Spouse/Partner"),profession:_("Profession"),assistant:_("Assistant's Name"),webpage:_("Webpage")})},generateHTMLTemplate:function(){var a;a=""+this.addHTMLRowGroup({display_name:"{display_name:htmlEncode}",last_name:"{last_name:htmlEncode}",first_name:"{first_name:htmlEncode}",job_title:"{job_title:htmlEncode}",department_name:"{department_name:htmlEncode}",company_name:"{company_name:htmlEncode}"});a+=this.addHTMLRowGroup({business_address:"{business_address:htmlEncode}",
home_address:"{home_address:htmlEncode}",other_address:"{other_address:htmlEncode}",im:"{im:htmlEncode}"});a+=this.addHTMLRowGroup({office_telephone_number:"{office_telephone_number:htmlEncode}",business2_telephone_number:"{business2_telephone_number:htmlEncode}",assistant_telephone_number:"{assistant_telephone_number:htmlEncode}",company_telephone_number:"{company_telephone_number:htmlEncode}",home_telephone_number:"{home_telephone_number:htmlEncode}",home2_telephone_number:"{home2_telephone_number:htmlEncode}",
cellular_telephone_number:"{cellular_telephone_number:htmlEncode}",car_telephone_number:"{car_telephone_number:htmlEncode}",radio_telephone_number:"{radio_telephone_number:htmlEncode}",pager_telephone_number:"{pager_telephone_number:htmlEncode}",callback_telephone_number:"{callback_telephone_number:htmlEncode}",other_telephone_number:"{other_telephone_number:htmlEncode}",primary_telephone_number:"{primary_telephone_number:htmlEncode}",telex_telephone_number:"{telex_telephone_number:htmlEncode}",ttytdd_telephone_number:"{ttytdd_telephone_number:htmlEncode}",
isdn_number:"{isdn_number:htmlEncode}",other_fax_number:"{other_fax_number:htmlEncode}",business_fax_number:"{business_fax_number:htmlEncode}",home_fax_number:"{business_fax_number:htmlEncode}"});a+=this.addHTMLRowGroup({email_address_1:"{email_address_1:htmlEncode}",email_address_display_name_1:"{email_address_display_name_1:htmlEncode}",email_address_2:"{email_address_2:htmlEncode}",email_address_display_name_2:"{email_address_display_name_2:htmlEncode}",email_address_3:"{email_address_3:htmlEncode}",
email_address_display_name_3:"{email_address_display_name_3:htmlEncode}"});a+=this.addHTMLRowGroup({birthday:'{birthday:date("'+_("l jS F Y G:i")+'")}',wedding_anniversary:'{wedding_anniversary:date("'+_("l jS F Y G:i")+'")}',spouse_name:"{spouse_name:htmlEncode}",profession:"{profession:htmlEncode}",assistant:"{assistant:htmlEncode}",webpage:"{webpage:htmlEncode}"});a+=this.addHTMLRowGroup({sensitivity:"{sensitivity:sensitivityString}",categories:"{categories:htmlEncode}",attachment_names:"{attachment_names:htmlEncode}"});
return a+"{body}"},generatePlainTemplate:function(){var a;a=""+this.addPlainRowGroup({display_name:"{display_name}",last_name:"{last_name}",first_name:"{first_name}",job_title:"{job_title}",department_name:"{department_name}",company_name:"{company_name}"});a+=this.addPlainRowGroup({business_address:"{business_address}",home_address:"{home_address}",other_address:"{other_address}",im:"{im}"});a+=this.addPlainRowGroup({office_telephone_number:"{office_telephone_number}",business2_telephone_number:"{business2_telephone_number}",
assistant_telephone_number:"{assistant_telephone_number}",company_telephone_number:"{company_telephone_number}",home_telephone_number:"{home_telephone_number}",home2_telephone_number:"{home2_telephone_number}",cellular_telephone_number:"{cellular_telephone_number}",car_telephone_number:"{car_telephone_number}",radio_telephone_number:"{radio_telephone_number}",pager_telephone_number:"{pager_telephone_number}",callback_telephone_number:"{callback_telephone_number}",other_telephone_number:"{other_telephone_number}",
primary_telephone_number:"{primary_telephone_number}",telex_telephone_number:"{telex_telephone_number}",ttytdd_telephone_number:"{ttytdd_telephone_number}",isdn_number:"{isdn_number}",other_fax_number:"{other_fax_number}",business_fax_number:"{business_fax_number}",home_fax_number:"{business_fax_number}"});a+=this.addPlainRowGroup({email_address_1:"{email_address_1}",email_address_display_name_1:"{email_address_display_name_1}",email_address_2:"{email_address_2}",email_address_display_name_2:"{email_address_display_name_2}",
email_address_3:"{email_address_3}",email_address_display_name_3:"{email_address_display_name_3}"});a+=this.addPlainRowGroup({birthday:'{birthday:date("'+_("l jS F Y G:i")+'")}',wedding_anniversary:'{wedding_anniversary:date("'+_("l jS F Y G:i")+'")}',spouse_name:"{spouse_name}",profession:"{profession}",assistant:"{assistant}",webpage:"{webpage}"});a+=this.addPlainRowGroup({sensitivity:"{sensitivity:sensitivityString}",categories:"{categories}",attachment_names:"{attachment_names}"});return a+"{body}"}});
Ext.namespace("Zarafa.contact.attachitem");
Zarafa.contact.attachitem.AttachDistlistRenderer=Ext.extend(Zarafa.common.attachment.dialogs.AttachItemBaseRenderer,{constructor:function(a){Zarafa.contact.attachitem.AttachDistlistRenderer.superclass.constructor.call(this,a);Ext.apply(this.labels,{display_name:_("Distribution List Name"),members:_("Members")})},generateHTMLTemplate:function(){var a;a=""+this.addHTMLRowGroup({display_name:"{display_name:htmlEncode}"});a+=this.addHTMLRowGroup({sensitivity:"{sensitivity:sensitivityString}",categories:"{categories:htmlEncode}",
attachment_names:"{attachment_names:htmlEncode}"});a+=this.addHTMLRowGroup({members:"{members:htmlEncode}"});return a+"{body}"},generatePlainTemplate:function(){var a;a=""+this.addPlainRowGroup({display_name:"{display_name}"});a+=this.addPlainRowGroup({sensitivity:"{sensitivity:sensitivityString}",categories:"{categories}",attachment_names:"{attachment_names}"});a+=this.addPlainRowGroup({members:"{members}"});return a+"{body}"},prepareData:function(a,b){var c=Zarafa.contact.attachitem.AttachDistlistRenderer.superclass.prepareData.apply(this,
arguments);c.members=a.getMemberNames();return c}});Ext.namespace("Zarafa.contact.data");
Zarafa.contact.data.ContactDetailsParser=Ext.extend(Object,{prefixOptions:void 0,suffixOptions:void 0,CR:Zarafa.contact.data.config.CR,LF:Zarafa.contact.data.config.LF,CRLF:Zarafa.contact.data.config.CRLF,SP:Zarafa.contact.data.config.SP,NBSP:Zarafa.contact.data.config.NBSP,constructor:function(a){a=a||{};this.prefixOptions=Zarafa.contact.data.config.Prefix;this.suffixOptions=Zarafa.contact.data.config.Suffix;Ext.apply(this,a);Zarafa.contact.data.ContactDetailsParser.superclass.constructor.call(this,
a)},parseInfo:function(a,b){if(!Ext.isString(b))return null;switch(a){case "name":return this.parseNameInfo(b);case "phone":return this.parsePhoneInfo(b);case "address":return this.parseAddressInfo(b);default:return null}},parseNameInfo:function(a){var b={display_name_prefix:"",given_name:"",middle_name:"",surname:"",generation:"",incomplete_info:!1};a=a.split(new RegExp(this.SP+"|"+this.NBSP,"g"));a=Zarafa.core.Util.trimStringArray(a);switch(a.length){case 4:var c=a.shift();b.display_name_prefix=
Zarafa.core.Util.inArray(this.prefixOptions,c,!0)?c:"";var d=a.pop();b.generation=Zarafa.core.Util.inArray(this.suffixOptions,d,!0)?d:"";b.given_name=Ext.isEmpty(b.display_name_prefix)?c:a.shift();b.surname=Ext.isEmpty(b.generation)?d:a.pop();b.middle_name=Ext.isEmpty(a.length)?"":a.shift();break;case 3:c=a.shift();b.display_name_prefix=Zarafa.core.Util.inArray(this.prefixOptions,c,!0)?c:"";d=a.pop();b.generation=Zarafa.core.Util.inArray(this.suffixOptions,d,!0)?d:"";Ext.isEmpty(b.display_name_prefix)&&
Ext.isEmpty(b.generation)?(b.given_name=c,b.middle_name=a.shift(),b.surname=d):!Ext.isEmpty(b.display_name_prefix)&&Ext.isEmpty(b.generation)?(b.given_name=a.shift(),b.surname=d):Ext.isEmpty(b.display_name_prefix)&&!Ext.isEmpty(b.generation)?(b.given_name=c,b.surname=a.shift()):Ext.isEmpty(b.display_name_prefix)||Ext.isEmpty(b.generation)||(b.surname=a.shift());break;case 2:c=a.shift();b.display_name_prefix=Zarafa.core.Util.inArray(this.prefixOptions,c,!0)?c:"";d=a.pop();b.generation=Zarafa.core.Util.inArray(this.suffixOptions,
d,!0)?d:"";Ext.isEmpty(b.display_name_prefix)&&Ext.isEmpty(b.generation)?(b.given_name=c,b.surname=d):Ext.isEmpty(b.display_name_prefix)&&!Ext.isEmpty(b.generation)?(b.surname=c,b.incomplete_info=!0):!Ext.isEmpty(b.display_name_prefix)&&Ext.isEmpty(b.generation)&&(b.surname=d,b.incomplete_info=!0);break;case 1:b.given_name=a.shift();b.incomplete_info=!0;break;default:c=a.shift(),b.display_name_prefix=Zarafa.core.Util.inArray(this.prefixOptions,c,!0)?c:"",d=a.pop(),b.generation=Zarafa.core.Util.inArray(this.suffixOptions,
d,!0)?d:"",b.given_name=Ext.isEmpty(b.display_name_prefix)?c:a.shift(),b.surname=Ext.isEmpty(b.display_name_prefix)?d:a.pop(),b.middle_name=a.join(this.NBSP)}return b},parsePhoneInfo:function(a){for(var b={country_code:"",city_code:"",local_number:"",extension:""},c=["x","/","-"],d=0,e=c.length;d<e;d++){var f=c[d],g=a.indexOf(f);if(0<=g){b.extension=a.slice(g);a=a.replace(b.extension,"");b.extension=b.extension.replace(f,"").trim();break}}c=new RegExp("(\\+|0{2})[^"+this.SP+"|"+this.NBSP+"]+");d=
new RegExp("(^|"+this.SP+"|"+this.NBSP+")\\(?0\\)?[^0|"+this.SP+"|"+this.NBSP+"]+");(e=a.match("\\((.{2,})\\)"))&&2===e.length?(f=e[1].trim(),f.match(c)?b.country_code=f:b.city_code=f,a=a.replace(e[0]," ")):a=a.replace(new RegExp("([^"+this.SP+"|"+this.NBSP+"])\\((.)\\)([^"+this.SP+"|"+this.NBSP+"])"),"$1 $2$3");a=a.split(new RegExp(this.SP+"|"+this.NBSP+"|-","g"));a=Zarafa.core.Util.trimStringArray(a);1<a.length&&!b.country_code&&a[0].match(c)&&(b.country_code=a.shift());1<a.length&&!b.city_code&&
a[0].match(d)&&(b.city_code=a.shift());b.local_number=a.join(this.NBSP);return b},parseAddressInfo:function(a){var b=!1,c={street:"",country:"",postal_code:"",city:"",state:"",incomplete_info:!1};a=a.split(new RegExp(this.CR+"|"+this.LF+"|"+this.CRLF,"g"));a=Zarafa.core.Util.trimStringArray(a);switch(a.length){default:c.country=a.pop();b=a.pop();c.street=a.join(this.CRLF);c.incomplete_info=!1;break;case 2:c.street=a.shift();b=a.shift();c.incomplete_info=!0;break;case 1:b=a.shift();c.incomplete_info=
!0;break;case 0:c.incomplete_info=!1}!1!==b&&(a=b.split(new RegExp(this.SP+"|"+this.NBSP,"g")),a=Zarafa.core.Util.trimStringArray(a),Ext.isNumber(parseInt(a[0]))?c.postal_code=a.shift():Ext.isNumber(parseInt(a[a.length-1]))&&(c.postal_code=a.pop()),1<a.length?(c.state=a.pop(),c.city=a.join(this.NBSP)):1===a.length&&(c.city=a.shift()));return c},combineInfo:function(a,b){if(!Ext.isObject(b))return null;switch(a){case "name":return this.combineNameInfo(b);case "phone":return this.combinePhoneInfo(b);
case "address":return this.combineAddressInfo(b);default:return null}},combineNameInfo:function(a){var b=Ext.isEmpty(a.display_name_prefix)?"":a.display_name_prefix+this.NBSP,b=b+(Ext.isEmpty(a.given_name)?"":a.given_name+this.NBSP),b=b+(Ext.isEmpty(a.middle_name)?"":a.middle_name+this.NBSP),b=b+(Ext.isEmpty(a.surname)?"":a.surname+this.NBSP),b=b+(Ext.isEmpty(a.generation)?"":a.generation);return b.trim()},combinePhoneInfo:function(a){var b=Ext.isEmpty(a.country_code)?"":a.country_code+this.NBSP,
b=b+(Ext.isEmpty(a.city_code)?"":"("+a.city_code+")"+this.NBSP),b=b+(Ext.isEmpty(a.local_number)?"":a.local_number+this.NBSP),b=b+(Ext.isEmpty(a.extension)?"":"-"+this.NBSP+a.extension);return b.trim()},combineAddressInfo:function(a){var b="";Ext.isEmpty(a.street)||(b+=a.street);b[b.length-1]!==this.LF&&(b+=this.CRLF);Ext.isEmpty(a.city)||(b[b.length-1]!==this.LF&&(b+=this.NBSP),b+=a.city);Ext.isEmpty(a.state)||(b[b.length-1]!==this.LF&&(b+=this.NBSP),b+=a.state);Ext.isEmpty(a.postal_code)||(b[b.length-
1]!==this.LF&&(b+=this.NBSP),b+=a.postal_code);b[b.length-1]!==this.LF&&(b+=this.CRLF);Ext.isEmpty(a.country)||(b+=a.country);return b.trim()}});Ext.namespace("Zarafa.contact.data");Zarafa.contact.data.DataModes=Zarafa.core.Enum.create({ALL:0,CHARACTER_RESTRICT:1,SEARCH:2});Ext.namespace("Zarafa.contact.data");
Zarafa.contact.data.JsonMemberWriter=Ext.extend(Zarafa.core.data.JsonWriter,{toPropHash:function(a){var b=a.getMemberStore();a={};if(!Ext.isDefined(b))return a;b=b.getRange();a.members=[];for(var c=0;c<b.length;c++)a.members.push(b[c].data);return a}});Ext.namespace("Zarafa.contact.data");Zarafa.contact.data.ViewModes=Zarafa.core.Enum.create({NORMAL:0,BUSINESS:1,ADDRESS:2,DETAILED:3,PHONE_LIST:4,GROUP_CATEGORY:5,GROUP_COMPANY:6,GROUP_LOCATION:7,SEARCH:8});Ext.namespace("Zarafa.contact.data");
Zarafa.contact.data.Views=Zarafa.core.Enum.create({ICON:0,LIST:1,SEARCH:2});Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.dialogs.ContactGeneralTab=Ext.extend(Ext.form.FormPanel,{hasContactPhoto:!1,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{labelWidth:110,labelAlign:"left"});Ext.applyIf(a,{xtype:"zarafa.contactgeneraltab",cls:"zarafa-contactgeneraltab",title:_("General"),autoScroll:!0,border:!1,layoutConfig:{columns:2},defaults:{columnWidth:.5,border:!1,xtype:"fieldset"},items:[this.createNameFieldset(a),this.createPhotoFieldset(a),
this.createClear(),this.createPhoneFieldset(a),this.createEmailFieldset(a),this.createClear(),this.createAddressFieldset(a),this.createAdditionalFieldset(a),this.createClear(),this.createAttachmentFieldset(a)]});Zarafa.contact.dialogs.ContactGeneralTab.superclass.constructor.call(this,a)},createClear:function(){return{xtype:"panel",cls:"zarafa-clear",columnWidth:1}},createNameFieldset:function(a){return{title:_("Name"),defaultType:"zarafa.compositefield",defaults:{anchor:"100%"},items:[{hideLabel:!0,
items:[{xtype:"button",width:a.labelWidth-1,text:_("Full Name")+":",listeners:{scope:this,click:function(){this.showDetailedNameContent()}}},{xtype:"textfield",flex:1,name:"display_name",listeners:{scope:this,change:this.onDisplayNameChange}}]},{xtype:"textfield",flex:1,name:"company_name",fieldLabel:_("Company"),listeners:{scope:this,change:this.onFieldChange}},{xtype:"textfield",flex:1,name:"title",fieldLabel:_("Job Title"),listeners:{scope:this,change:this.onFieldChange}},{xtype:"combo",flex:1,
name:"fileas",fieldLabel:_("File as"),ref:"../fileAsField",editable:!1,mode:"local",triggerAction:"all",lazyInit:!1,store:{xtype:"arraystore",fields:["displayText"],data:[]},displayField:"displayText",valueField:"displayText",listeners:{scope:this,change:this.onFileasChange}}]}},createPhotoFieldset:function(a){return{title:_("Photo"),layout:{type:"hbox"},items:{xtype:"box",cls:"contact_photo_box default_contact_photo",ctCls:"contact_photo_box_ct",autoEl:{tag:"img",src:Ext.BLANK_IMAGE_URL},ref:"../contactPhotoBox",
listeners:{afterrender:this.onAfterRender,scope:this}}}},createPhoneFieldset:function(a){return{title:_("Phone Numbers"),defaultType:"zarafa.compositefield",defaults:{hideLabel:!0,anchor:"100%"},items:[{items:[{xtype:"splitbutton",width:a.labelWidth-1,text:_("Business")+":",handler:this.handlePhoneButtonClick,scope:this,menu:this.initPhoneButtonMenu("message_phonenumber_1","business_telephone_number")},{xtype:"textfield",flex:1,ref:"../../phone1",name:"business_telephone_number",listeners:{scope:this,
change:this.onFieldChange}}]},{items:[{xtype:"splitbutton",width:a.labelWidth-1,text:_("Home")+":",handler:this.handlePhoneButtonClick,scope:this,menu:this.initPhoneButtonMenu("message_phonenumber_2","home_telephone_number")},{xtype:"textfield",flex:1,name:"home_telephone_number",ref:"../../phone2",listeners:{scope:this,change:this.onFieldChange}}]},{items:[{xtype:"splitbutton",width:a.labelWidth-1,text:_("Business Fax")+":",handler:this.handlePhoneButtonClick,scope:this,menu:this.initPhoneButtonMenu("message_phonenumber_3",
"business_fax_number")},{xtype:"textfield",flex:1,name:"business_fax_number",ref:"../../phone3",listeners:{scope:this,change:this.onFieldChange}}]},{items:[{xtype:"splitbutton",width:a.labelWidth-1,text:_("Mobile")+":",handler:this.handlePhoneButtonClick,scope:this,menu:this.initPhoneButtonMenu("message_phonenumber_4","cellular_telephone_number")},{xtype:"textfield",flex:1,name:"cellular_telephone_number",ref:"../../phone4",listeners:{scope:this,change:this.onFieldChange}}]}]}},createEmailFieldset:function(a){return{title:_("Email"),
items:[{xtype:"zarafa.compositefield",anchor:"100%",hideLabel:!0,items:[{xtype:"splitbutton",width:a.labelWidth-1,text:_("Email")+":",handler:this.openAddressBook,scope:this,menu:this.initEmailButtonMenu("message_email_address","email_address_1")},{xtype:"textfield",flex:1,ref:"../../mailAddressField",name:"email_address_1",listeners:{scope:this,change:this.onEmailAddressChange}}]},{xtype:"textfield",flex:1,anchor:"100%",name:"email_address_display_name_1",fieldLabel:_("Display name"),ref:"../mailDisplayNameField",
listeners:{scope:this,change:this.onFieldChange}},{xtype:"textfield",ref:"../webpageField",flex:1,anchor:"100%",fieldLabel:_("Webpage"),name:"webpage",listeners:{scope:this,change:this.onWebpageChange}},{xtype:"textfield",flex:1,anchor:"100%",fieldLabel:_("IM Address"),name:"im",listeners:{scope:this,change:this.onFieldChange}}]}},createAddressFieldset:function(a){return{title:_("Addresses"),defaultType:"zarafa.compositefield",defaults:{hideLabel:!0,anchor:"100%"},items:[{items:[{xtype:"splitbutton",
width:a.labelWidth-1,text:_("Business")+":",handler:this.handleAddressButtonClick,scope:this,menu:this.initAddressButtonMenu("business_address","business_address")},{xtype:"textarea",flex:1,name:"business_address",height:120,listeners:{scope:this,change:this.onAddressChange}}]}]}},createAdditionalFieldset:function(a){return{title:_("Additional information"),items:[{xtype:"zarafa.editorfield",useHtml:!1,ref:"../editorField",anchor:"100% 100%",height:120,listeners:{change:this.onBodyChange,scope:this}}]}},
createAttachmentFieldset:function(a){return{title:_("Attachments"),columnWidth:1,border:!1,defaultType:"zarafa.resizablecompositefield",defaults:{hideLabel:!0,anchor:"100%"},items:[{cls:"zarafa-contactcreatepanel-field-attachments",items:[{xtype:"zarafa.attachmentbutton",plugins:["zarafa.recordcomponentupdaterplugin"],width:a.labelWidth-1,autoHeight:!0,text:_("Attachments")+":"},{xtype:"zarafa.attachmentfield",plugins:["zarafa.recordcomponentupdaterplugin"],flex:1,hideLabel:!0}]}]}},initPhoneButtonMenu:function(a,
b){return{xtype:"menu",listeners:{click:this.onMenuItemSelection,scope:this},items:[{xtype:"menucheckitem",group:a,text:_("Assistant"),name:"assistant_telephone_number",checked:"assistant_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Business"),name:"business_telephone_number",checked:"business_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Business 2"),name:"business2_telephone_number",checked:"business2_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Business Fax"),
name:"business_fax_number",checked:"business_fax_number"===b},{xtype:"menucheckitem",group:a,text:_("Callback"),name:"callback_telephone_number",checked:"callback_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Car"),name:"car_telephone_number",checked:"car_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Company"),name:"company_telephone_number",checked:"company_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Home"),name:"home_telephone_number",checked:"home_telephone_number"===
b},{xtype:"menucheckitem",group:a,text:_("Home 2"),name:"home2_telephone_number",checked:"home2_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Home Fax"),name:"home_fax_number",checked:"home_fax_number"===b},{xtype:"menucheckitem",group:a,text:_("ISDN"),name:"isdn_number",checked:"isdn_number"===b},{xtype:"menucheckitem",group:a,text:_("Mobile"),name:"cellular_telephone_number",checked:"cellular_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Other"),name:"other_telephone_number",
checked:"other_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Other Fax"),name:"primary_fax_number",checked:"primary_fax_number"===b},{xtype:"menucheckitem",group:a,text:_("Pager"),name:"pager_telephone_number",checked:"pager_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Primary"),name:"primary_telephone_number",checked:"primary_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("Radio"),name:"radio_telephone_number",checked:"radio_telephone_number"===b},{xtype:"menucheckitem",
group:a,text:_("Telex"),name:"telex_telephone_number",checked:"telex_telephone_number"===b},{xtype:"menucheckitem",group:a,text:_("TTY/TDD"),name:"ttytdd_telephone_number",checked:"ttytdd_telephone_number"===b}]}},initAddressButtonMenu:function(a,b){return{xtype:"menu",listeners:{click:this.onMenuItemSelection,scope:this},items:[{xtype:"menucheckitem",group:a,text:_("Home"),name:"home_address",checked:"home_address"===b},{xtype:"menucheckitem",group:a,text:_("Business"),name:"business_address",checked:"business_address"===
b},{xtype:"menucheckitem",group:a,text:_("Other"),name:"other_address",checked:"other_address"===b}]}},initEmailButtonMenu:function(a,b){return{xtype:"menu",listeners:{click:{fn:this.onEmailMenuItemSelection,scope:this}},defaults:{xtype:"menucheckitem",group:a},items:[{text:_("Email"),name:"email_address_1",checked:"email_address_1"===b},{text:_("Email 2"),name:"email_address_2",checked:"email_address_2"===b},{text:_("Email 3"),name:"email_address_3",checked:"email_address_3"===b}]}},handlePhoneButtonClick:function(a,
b){this.showDetailedPhoneContent(a.ownerCt.findByType("textfield")[0].getName())},handleAddressButtonClick:function(a,b){this.showDetailedAddressContent(a.ownerCt.findByType("textarea")[0].getName())},openAddressBook:function(){Zarafa.common.Actions.openABUserSelectionContent({callback:this.abCallBack,scope:this})},abCallBack:function(a){var b;b="ZARAFA"===(a.get("address_type")||"SMTP")?a.get("smtp_address"):a.get("email_address");this.mailAddressField.setValue(b);this.record.beginEdit();switch(this.mailAddressField.getName()){case "email_address_1":this.record.set("email_address_1",
b);this.record.set("email_address_type_1","SMTP",!0);this.record.set("email_address_display_name_1",a.get("display_name"));break;case "email_address_2":this.record.set("email_address_2",b);this.record.set("email_address_type_2","SMTP",!0);this.record.set("email_address_display_name_2",a.get("display_name"));break;case "email_address_3":this.record.set("email_address_3",b),this.record.set("email_address_type_3","SMTP",!0),this.record.set("email_address_display_name_3",a.get("display_name"))}this.record.endEdit()},
update:function(a,b){!Ext.isEmpty(a)&&(this.record=a,this.getForm().loadRecord(a),a.isOpened()&&b&&this.updateContactPhoto(),b&&(this.generateFileAsItems(),this.fileAsField.selectByValue(a.get("fileas"),!0)),a.isModifiedSinceLastUpdate("fileas")&&this.fileAsField.selectByValue(a.get("fileas"),!0),b&&a.isOpened()&&this.editorField.setValue(a.getBody(this.editorField.isHtmlEditor())),a.isModifiedSinceLastUpdate("display_name")||a.isModifiedSinceLastUpdate("company_name"))&&(this.generateFileAsItems(),
this.updateFileas())},updateContactPhoto:function(){var a=this.record.getAttachmentStore(),b=this.contactPhotoBox.getEl(),c=new Ext.Element(Ext.getDoc().dom.createElement("img"));c.on("load",this.onLoadContactPhoto,this,{single:!0});b&&0<a.getCount()&&a.each(function(a){if(a.isContactPhoto())return c.set({src:a.getInlineImageUrl()}),b.setStyle({"background-image":"url("+encodeURI(a.getInlineImageUrl())+")"}),this.hasContactPhoto=!0,this.record.set("has_picture",!0),this.contactPhotoBox.removeClass("default_contact_photo"),
!1},this)},onLoadContactPhoto:function(a,b){var c=this.contactPhotoBox.getEl(),d=Ext.get(b),e=c.up(".contact_photo_box_ct"),f=e.getPadding("lr"),e=e.getWidth()-f-2,f=d.dom.naturalWidth,g=d.dom.naturalHeight;f<e&&g<e?(d=f,f=g):f>g?(d=e,f=e*g/f):(d=e*f/g,f=e);c.setWidth(d);c.setHeight(f);c.setStyle({"background-size":d+"px "+f+"px",left:(e-d)/2+"px",top:(e-f)/2+"px"})},onAfterRender:function(a){a=a.getEl().up("div");this.mon(a,{click:this.onSingleClick,dblclick:this.onDoubleClick,contextmenu:this.onContextMenuClick,
scope:this})},onContextMenuClick:function(a,b,c){this.hasContactPhoto&&(b=this.getAttachedContactPhoto(),Zarafa.core.data.UIFactory.openDefaultContextMenu(b,{position:a.getXY(),parent:this}))},getAttachedContactPhoto:function(){var a;this.record.getAttachmentStore().each(function(b){b.isContactPhoto()&&(a=b)},this);return a},onSingleClick:function(a,b,c){this.hasContactPhoto||this.uploadContactPhoto()},onDoubleClick:function(a,b,c){this.hasContactPhoto&&this.uploadContactPhoto()},clearContactPhoto:function(a,
b){a.remove(b);var c=this.contactPhotoBox.getEl();this.hasContactPhoto=!1;this.record.set("has_picture",!1);var d=this.contactPhotoBox.el.up(".contact_photo_box_ct"),d=d.getWidth()-d.getPadding("lr")-2;c.set({src:Ext.BLANK_IMAGE_URL});c.setStyle({width:d+"px",height:d+"px",left:0,top:0,"background-image":"","background-size":"auto"});this.contactPhotoBox.addClass("default_contact_photo")},uploadContactPhoto:function(){var a=this.record.getAttachmentStore();this.mon(a,"update",this.updateContactPhoto,
this);(new Zarafa.common.attachment.ui.UploadAttachmentComponent({callback:this.uploadContactPhotoCallback,accept:"image/*",scope:this})).openAttachmentDialog()},uploadContactPhotoCallback:function(a,b){var c=this.record.getAttachmentStore();this.beforeUploadContactPhoto(c);c.uploadFiles(a,b,!0,{sourcetype:"contactphoto"})},beforeUploadContactPhoto:function(a){var b=this.getAttachedContactPhoto();Ext.isDefined(b)&&a.remove(b)},onMenuItemSelection:function(a,b,c){Ext.isEmpty(b)||(c=a.findParentByType("zarafa.compositefield"),
a=c.findByType("splitbutton")[0],c=c.findByType("textfield")[0],Ext.isEmpty(a)||Ext.isEmpty(c)||(a.setText(b.initialConfig.text),c.name=b.name,c.el.dom.name=b.name,c.setValue(this.record.get(b.name))))},onEmailMenuItemSelection:function(a,b,c){this.onMenuItemSelection(a,b,c);Ext.isEmpty(this.mailDisplayNameField)||(a=b.name.replace("email_address","email_address_display_name"),this.mailDisplayNameField.name=a,this.mailDisplayNameField.el.dom.name=a,this.mailDisplayNameField.setValue(this.record.get(a)))},
generateFileAsItems:function(){var a=this.record,b=[],c=a.get("display_name"),d=a.get("display_name_prefix"),e=a.get("generation"),a=a.get("company_name"),f=this.fileAsField.getStore();Ext.isEmpty(c)?Ext.isEmpty(a)||b.push([a]):(c=c.replace(d,"").replace(e,"").replace(",",""),c=c.trim().split(new RegExp(Zarafa.contact.data.config.SP+"|"+Zarafa.contact.data.config.NBSP,"g")),c=Zarafa.core.Util.trimStringArray(c),d="",0<c.length&&(1===c.length?(d=c[0],b.push([d])):(d=c[c.length-1]+","+Zarafa.contact.data.config.NBSP,
e=c.slice(0,c.length-1),d+=e.join(Zarafa.contact.data.config.NBSP),b.push([d]),b.push([c.join(Zarafa.contact.data.config.NBSP)]))),Ext.isEmpty(a)||(b.push([a]),Ext.isEmpty(d)||(b.push([d+Zarafa.contact.data.config.NBSP+"("+a+")"]),b.push([a+Zarafa.contact.data.config.NBSP+"("+d+")"]))));f.loadData(b)},updateFileas:function(){var a=this.fileAsField.getStore(),b=this.fileAsField.selectedIndex;0>=a.getCount()?this.record.set("fileas",""):-1===b||b>a.getCount()?this.record.set("fileas",a.getAt(0).get(this.fileAsField.displayField)):
this.record.set("fileas",a.getAt(b).get(this.fileAsField.displayField))},updateRecord:function(a){a.beginEdit();var b=this.webpageField.getValue(),c=a.get(this.webpageField.getName());if(b!==c)this.onWebpageChange(this.webpageField,b,c);b=this.fileAsField.getValue();c=a.get(this.fileAsField.getName());if(b!==c)this.onFileasChange(this.fileAsField,b,c);b=this.mailAddressField.getValue();c=a.get(this.mailAddressField.getName());if(b!==c)this.onEmailAddressChange(this.mailAddressField,b,c);this.getForm().updateRecord(a);
(a.isModified("display_name")||a.isModified("display_name_prefix")||a.isModified("generation")||a.isModified("fileas"))&&a.updateSubject();this.onBodyChange(this.editorField.getEditor(),this.editorField.getValue());a.updateAddressbookProps();a.endEdit()},onFieldChange:function(a,b,c){a.validateValue(a.processValue(b))&&this.record.set(a.getName(),b)},onBodyChange:function(a,b,c){c=this.record;a=a instanceof Ext.form.HtmlEditor;c.beginEdit();c.setBody(b,a);c.endEdit()},onEmailAddressChange:function(a,
b,c){if(a.validateValue(a.processValue(b))){this.record.beginEdit();this.record.set(a.getName(),b);switch(a.getName()){case "email_address_1":this.record.set("email_address_type_1","SMTP",!0);break;case "email_address_2":this.record.set("email_address_type_2","SMTP",!0);break;case "email_address_3":this.record.set("email_address_type_3","SMTP",!0)}this.record.updateAddressbookProps();this.record.endEdit()}},onFileasChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.beginEdit(),
this.record.set(a.getName(),b),this.record.set("fileas_selection",-1),this.record.endEdit())},onWebpageChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.beginEdit(),this.record.set(a.getName(),b),this.record.set("business_home_page",b),this.record.endEdit())},onDisplayNameChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.set(a.getName(),b),function(){var a=this.getContactParser().parseInfo("name",b);this.record.beginEdit();this.record.set("display_name_prefix",
a.display_name_prefix);this.record.set("given_name",a.given_name);this.record.set("middle_name",a.middle_name);this.record.set("surname",a.surname);this.record.set("generation",a.generation);this.record.endEdit();!0!==container.getSettingsModel().get("zarafa/v1/contexts/contact/show_name_dialog")||Ext.isEmpty(b)||!0===a.incomplete_info&&this.showDetailedNameContent(a)}.defer(1,this))},onAddressChange:function(a,b,c){a.validateValue(a.processValue(b))&&(this.record.set(a.getName(),b),function(){var c=
this.getContactParser().parseInfo("address",b),e=a.getName();this.record.beginEdit();this.record.set(e+"_street",c.street);this.record.set(e+"_city",c.city);this.record.set(e+"_state",c.state);this.record.set(e+"_postal_code",c.postal_code);this.record.set(e+"_country",c.country);this.record.endEdit();!0!==container.getSettingsModel().get("zarafa/v1/contexts/contact/show_address_dialog")||Ext.isEmpty(b)||!0===c.incomplete_info&&this.showDetailedAddressContent(e,c)}.defer(1,this))},showDetailedNameContent:function(a){Zarafa.contact.Actions.openDetailedNameContent(this.record,
{parser:this.getContactParser(),parsedData:a})},showDetailedAddressContent:function(a,b){Zarafa.contact.Actions.openDetailedAddressContent(this.record,{parser:this.getContactParser(),parsedData:b,property:a})},showDetailedPhoneContent:function(a){Zarafa.contact.Actions.openDetailedPhoneContent(this.record,{parser:this.getContactParser(),property:a})},getContactParser:function(){return this.dialog.contactParser},initEvents:function(){this.mon(this.dialog,{beforesaverecord:this.onBeforeSaveRecord,scope:this})},
onBeforeSaveRecord:function(){for(var a=1;4>=a;a++){var b=this["phone"+a];0<b.value.indexOf("x")&&(this.record.set(b.name,b.value.replace("x","-"),!0),"business_fax_number"===b.name&&this.record.updateAddressbookProps())}}});Ext.reg("zarafa.contactgeneraltab",Zarafa.contact.dialogs.ContactGeneralTab);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistExternalMemberContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{parentRecord:void 0,record:void 0,formPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.distlistexternalmembercontentpanel",title:_("New e-mail address"),layout:"fit",items:this.createFormItems()});Zarafa.contact.dialogs.DistlistExternalMemberContentPanel.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterFirstLayout,this,{single:!0})},createFormItems:function(){return[{xtype:"form",
layout:"form",border:!1,ref:"formPanel",width:350,height:150,items:[{xtype:"textfield",fieldLabel:_("Name"),name:"display_name",allowBlank:!1,blankText:_("This field is required"),anchor:"100%"},{xtype:"textfield",fieldLabel:_("E-mail address"),name:"email_address",anchor:"100%",allowBlank:!1,blankText:_("This field is required"),vtype:"email",vtypeText:_("Please input a valid email address!")}],buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]},
onAfterFirstLayout:function(){this.record&&this.formPanel.getForm().loadRecord(this.record)},onOk:function(){var a=this.formPanel.getForm();if(!a.isValid())return!1;if(this.record)a.updateRecord(this.record);else{var b=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER);a.updateRecord(b);b.set("smtp_address",b.get("email_address"));this.parentRecord.getMemberStore().add(b)}this.close()},onCancel:function(){this.close()}});
Ext.reg("zarafa.distlistexternalmembercontentpanel",Zarafa.contact.dialogs.DistlistExternalMemberContentPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistMemberGridColumnModel=Ext.extend(Ext.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.createColumns(),defaults:{sortable:!0}});Zarafa.contact.dialogs.DistlistMemberGridColumnModel.superclass.constructor.call(this,a)},createColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',tooltip:_("Sort by: Icon"),width:24,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"display_name",
id:"display_name",header:_("Name"),tooltip:_("Sort by: Name"),renderer:Zarafa.common.ui.grid.Renderers.text},{dataIndex:"smtp_address",header:_("E-mail Address"),tooltip:_("Sort by: Email Address"),width:350,renderer:Zarafa.common.ui.grid.Renderers.text}]}});Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactCardView=Ext.extend(Zarafa.common.ui.DraggableDataView,{context:void 0,model:void 0,store:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.icondragselectorplugin");Ext.apply(this,a,{xtype:"zarafa.contactcardview",border:!1,loadingText:_("Loading contacts")+
"...",deferEmptyText:!1,emptyText:'<div class="emptytext">'+_("There are no items to show in this list")+"</div>",tpl:this.initTemplate(),itemSelector:"div.zarafa-contact-cardview-card",multiSelect:!0,selectedClass:"zarafa-contact-cardview-selected",enableDrag:!0,ddGroup:"dd.mapiitem"});Zarafa.contact.ui.ContactCardView.superclass.constructor.call(this,a);this.initEvents()},initEvents:function(){this.on({dblclick:this.onNodeDblClick,contextmenu:this.onNodeContextMenu,selectionchange:this.onSelectionChange,
scope:this})},onNodeContextMenu:function(a,b,c,d){a.isSelected(c)||a.select(c);Zarafa.core.data.UIFactory.openDefaultContextMenu(a.getSelectedRecords(),{position:d.getXY()})},onNodeDblClick:function(a,b,c,d){Zarafa.contact.Actions.openDialog(a.getSelectedRecords())},onSelectionChange:function(a,b){this.model.setSelectedRecords(a.getSelectedRecords())},initTemplate:function(){var a=['<div class="zarafa-contact-cardview">','<tpl for=".">','<div class="zarafa-contact-cardview-card">','<div id="{entryid}" class="x-panel">',
'<div class="x-panel-tl">','<div class="x-panel-tr">','<div class="x-panel-tc">','<div class="x-panel-header">','<span class="x-panel-header-text">',"{fileas:htmlEncodeUndef}","</span>","</div>","</div>","</div>","</div>",'<div class="x-panel-bwrap">','<div class="x-panel-body zarafa-card-body">',"<p><tpl>{message_class:this.getIcon}</tpl></p>","<div>",'<p class="zarafa-contact-cardview-card-title">{display_name:htmlEncode}</p>',"<p><tpl if=\"values.message_class=='IPM.DistList'\">"+_("Group")+"</tpl></p>",
"<p>{company_name:htmlEncodeUndef}</p>","<p>{title:htmlEncodeUndef}</p>","<p>{department_name:htmlEncodeUndef}</p>","<table>",'<tpl if="!Ext.isEmpty(values.business_telephone_number)"><tr><td class="contact-card-label">'+_("Work")+":</td><td>{business_telephone_number:htmlEncode}</td></tr></tpl>",'<tpl if="!Ext.isEmpty(values.business2_telephone_number)"><tr><td class="contact-card-label">'+_("Work")+":</td><td>{business2_telephone_number:htmlEncode}</td></tr></tpl>",'<tpl if="!Ext.isEmpty(values.primary_telephone_number)"><tr><td class="contact-card-label">'+
_("Primary")+":</td><td>{primary_telephone_number:htmlEncode}</td></tr></tpl>",'<tpl if="!Ext.isEmpty(values.cellular_telephone_number)"><tr><td class="contact-card-label">'+_("Mobile")+":</td><td>{cellular_telephone_number:htmlEncode}</td></tr></tpl>",'<tpl if="!Ext.isEmpty(values.home_telephone_number)"><tr><td class="contact-card-label">'+_("Home")+":</td><td>{home_telephone_number:htmlEncode}</td></tr></tpl>","</table>","</div>","</div>","</div>","</div>","</div>","</tpl>","</div>"];return new Ext.XTemplate(a.join(""),
{compiled:!0,getIcon:function(a){return"IPM.DistList"==a?'<div class="zarafa-contact-cardview-distlist-card"></div>':'<div class="zarafa-contact-cardview-contact-card"></div>'}})}});Ext.reg("zarafa.contactcardview",Zarafa.contact.ui.ContactCardView);Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{records:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.records)&&!Array.isArray(a.records)&&(a.records=[a.records]);Ext.applyIf(a,{items:[this.createContextActionItems(a.records),{xtype:"menuseparator"},container.populateInsertionPoint("context.contact.contextmenu.actions",this),this.createContextExportItems(a),{xtype:"menuseparator"},container.populateInsertionPoint("context.contact.contextmenu.options",
this)],defaults:{xtype:"zarafa.conditionalitem",hideOnDisabled:!1}});Zarafa.contact.ui.ContactContextMenu.superclass.constructor.call(this,a)},createContextActionItems:function(a){return[{text:_("Open"),iconCls:"icon_open",scope:this,handler:this.onContextItemOpen,singleSelectOnly:!0},{text:_("Copy/Move"),iconCls:"icon_copy",scope:this,handler:this.onCopyMove},{text:_("Print"),iconCls:"icon_print",scope:this,handler:this.onContextItemPrint,singleSelectOnly:!0},{xtype:"menuseparator"},{text:_("Categories"),
cls:"k-unclickable",iconCls:"icon_categories",hideOnClick:!1,menu:{xtype:"zarafa.categoriescontextmenu",records:a}},{xtype:"menuseparator"},{text:_("Delete"),iconCls:"icon_delete",scope:this,handler:this.onContextItemDelete}]},createContextExportItems:function(a){return[{text:_("Export as"),cls:"k-unclickable",iconCls:"icon_export",hideOnClick:!1,menu:{xtype:"zarafa.exportcontactcontextmenu",records:a.records}}]},onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.records)},onContextItemOpen:function(){Zarafa.contact.Actions.openDialog(this.records)},
onContextItemPrint:function(){Zarafa.common.Actions.openPrintDialog(this.records)},onContextItemCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.records)},onContextItemDelete:function(){var a;Ext.each(this.records,function(b){a=b.store;a.remove(b)});a.save(this.records)}});Ext.reg("zarafa.contactcontextmenu",Zarafa.contact.ui.ContactContextMenu);Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactGridColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.createColumns(),defaults:{sortable:!0,width:150}});Zarafa.contact.ui.ContactGridColumnModel.superclass.constructor.call(this,a)},createColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column icon",header:'<p class="icon_index">&nbsp;<span class="title">'+_("Icon")+"</span></p>",tooltip:_("Sort by: Icon"),width:25,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},
{dataIndex:"fileas",id:"fileas",header:_("File As"),tooltip:_("Sort by: File As"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"display_name",header:_("Full Name"),tooltip:_("Sort by: Full Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"email_address_1",header:_("Email"),hidden:!0,tooltip:_("Sort by: Email Address 1"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"email_address_2",header:_("Email 2"),hidden:!0,tooltip:_("Sort by: Email Address 2"),renderer:Ext.util.Format.htmlEncode},
{dataIndex:"email_address_3",header:_("Email 3"),hidden:!0,tooltip:_("Sort by: Email Address 3"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"home_telephone_number",header:_("Home Phone"),tooltip:_("Sort by: Home Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"cellular_telephone_number",header:_("Mobile Phone"),tooltip:_("Sort by: Mobile Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"categories",header:_("Categories"),tooltip:_("Sort by: Categories"),renderer:Zarafa.common.ui.grid.Renderers.categories},
{dataIndex:"business_telephone_number",header:_("Business Phone"),tooltip:_("Sort by: Business Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"business_fax_number",header:_("Business Fax"),tooltip:_("Sort by: Business Fax"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"company_name",header:_("Company Name"),tooltip:_("Sort by: Company Name"),hidden:!0,renderer:Ext.util.Format.htmlEncode},{dataIndex:"title",header:_("Job Title"),tooltip:_("Sort by: Job Title"),hidden:!0,renderer:Ext.util.Format.htmlEncode},
{dataIndex:"department_name",header:_("Department Name"),hidden:!0,tooltip:_("Sort by: Department Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"office_location",header:_("Office Location"),hidden:!0,tooltip:_("Sort by: Office Location"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"profession",header:_("Profession"),hidden:!0,tooltip:_("Sort by: Profession"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"manager_name",header:_("Manager Name"),hidden:!0,tooltip:_("Sort by: Manager Name"),
renderer:Ext.util.Format.htmlEncode},{dataIndex:"assistant",header:_("Assistant's Name"),hidden:!0,tooltip:_("Sort by: Assistant's Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"nickname",header:_("Nickname"),hidden:!0,tooltip:_("Sort by: Nickname"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"spouse_name",header:_("Spouse/Partner"),hidden:!0,tooltip:_("Sort by: Spouse/Partner Name"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"birthday",header:_("Birthday"),hidden:!0,tooltip:_("Sort by: Birthday"),
renderer:Zarafa.common.ui.grid.Renderers.date},{dataIndex:"wedding_anniversary",header:_("Anniversary"),hidden:!0,tooltip:_("Sort by: Anniversary"),renderer:Zarafa.common.ui.grid.Renderers.date},{dataIndex:"business_address",header:_("Business Address"),hidden:!0,tooltip:_("Sort by: Business Address"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"home_address",header:_("Home Address"),hidden:!0,tooltip:_("Sort by: Home Address"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"other_address",header:_("Other Address"),
hidden:!0,tooltip:_("Sort by: Office Address"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"mailing_address",header:_("Mailing Address"),hidden:!0,tooltip:_("Sort by: Mailing Address"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"im",header:_("IM Address"),hidden:!0,tooltip:_("Sort by: IM Address"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"webpage",header:_("Webpage"),hidden:!0,tooltip:_("Sort by: Webpage"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"assistant_telephone_number",
header:_("Assistant's Phone"),hidden:!0,tooltip:_("Sort by: Assistant's Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"business2_telephone_number",header:_("Business Phone 2"),hidden:!0,tooltip:_("Sort by: Business Phone 2"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"callback_telephone_number",header:_("Callback Phone"),hidden:!0,tooltip:_("Sort by: Callback"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"car_telephone_number",header:_("Car Phone"),hidden:!0,tooltip:_("Sort by: Car Phone"),
renderer:Ext.util.Format.htmlEncode},{dataIndex:"company_telephone_number",header:_("Company Phone"),hidden:!0,tooltip:_("Sort by: Company Main Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"home2_telephone_number",header:_("Home Phone 2"),hidden:!0,tooltip:_("Sort by: Home Phone 2"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"home_fax_number",header:_("Home Fax"),hidden:!0,tooltip:_("Sort by: Home Fax"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"isdn_number",header:_("ISDN"),
hidden:!0,tooltip:_("Sort by: ISDN"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"other_telephone_number",header:_("Other Phone"),hidden:!0,tooltip:_("Sort by: Other Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"radio_telephone_number",header:_("Radio Phone"),hidden:!0,tooltip:_("Sort by: Radio Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"ttytdd_telephone_number",header:_("TTY/TDD Phone"),hidden:!0,tooltip:_("Sort by: TTY/TDD Phone"),renderer:Ext.util.Format.htmlEncode},
{dataIndex:"telex_telephone_number",header:_("Telex"),hidden:!0,tooltip:_("Sort by: Telex Phone"),renderer:Ext.util.Format.htmlEncode},{dataIndex:"pager_telephone_number",header:_("Pager"),hidden:!0,tooltip:_("Sort by: Pager"),renderer:Ext.util.Format.htmlEncode}]}});Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactMainPanel=Ext.extend(Zarafa.common.ui.ContextMainPanel,{viewPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactmainpanel",layout:"fit",items:[{xtype:"zarafa.switchviewcontentcontainer",ref:"viewPanel",layout:"card",lazyItems:this.initViews(a.context)}],tbar:{xtype:"zarafa.contextmainpaneltoolbar",defaultTitle:_("Contacts"),paging:container.populateInsertionPoint("context.contact.toolbar.paging",this),items:container.populateInsertionPoint("context.contact.toolbar.item",
this),context:a.context}});Zarafa.contact.ui.ContactMainPanel.superclass.constructor.call(this,a)},initViews:function(a){var b=[{xtype:"zarafa.contactgrid",id:"contact-gridview",context:a},{xtype:"zarafa.contactcardpanel",id:"contact-cardview",context:a}];a=container.populateInsertionPoint("context.contact.views",this,a);return b=b.concat(a)},initEvents:function(){Ext.isDefined(this.context)&&(this.mon(this.context,"viewchange",this.onViewChange,this),this.topToolbar.mon(this.topToolbar.pagesToolbar,
"beforechange",this.onBeforeChange,this),this.onViewChange(this.context,this.context.getCurrentView()))},onBeforeChange:function(a,b){var c=a.store.lastOptions.params.restriction;c.search&&Ext.applyIf(b.restriction,{search:c.search});return!0},onViewChange:function(a,b,c){switch(b){case Zarafa.contact.data.Views.ICON:this.viewPanel.switchView("contact-cardview");break;case Zarafa.contact.data.Views.LIST:case Zarafa.contact.data.Views.SEARCH:this.viewPanel.switchView("contact-gridview")}}});
Ext.reg("zarafa.contactmainpanel",Zarafa.contact.ui.ContactMainPanel);Ext.namespace("Zarafa.hierarchy");
Zarafa.hierarchy.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[{key:Ext.EventObject.F,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewFolder,scope:this,settingsCfg:{description:_("New folder"),category:_("Creating an item")}},{key:Ext.EventObject.S,ctrl:!1,alt:!0,shift:!1,stopEvent:!0,handler:this.onOpenSharedFolder,scope:this,settingsCfg:{description:_("Open shared folder/store"),category:_("Basic navigation")}}];Zarafa.core.KeyMapMgr.register("global",a)},onNewFolder:function(a,
b,c){Zarafa.hierarchy.Actions.openCreateFolderContent()},onOpenSharedFolder:function(a,b,c){switch(container.getCurrentContext().getName()){case "calendar":a=Zarafa.hierarchy.data.SharedFolderTypes.APPOINTMENT;break;case "contact":a=Zarafa.hierarchy.data.SharedFolderTypes.CONTACT;break;case "note":a=Zarafa.hierarchy.data.SharedFolderTypes.NOTE;break;case "task":a=Zarafa.hierarchy.data.SharedFolderTypes.TASK;break;default:a=Zarafa.hierarchy.data.SharedFolderTypes.MAIL}Zarafa.hierarchy.Actions.openSharedFolderContent(a)}});
Zarafa.hierarchy.KeyMapping=new Zarafa.hierarchy.KeyMapping;Ext.namespace("Zarafa.hierarchy.data");Zarafa.hierarchy.data.CounterTypes=Zarafa.core.Enum.create({NONE:0,TOTAL:1,UNREAD:2});Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.HierarchyProxy=Ext.extend(Zarafa.core.data.MAPIProxy,{constructor:function(a){a=a||{};var b=Zarafa.core.ModuleNames.getModule("hierarchy");b&&Ext.applyIf(a,{listModuleName:b.list,itemModuleName:b.item});Zarafa.hierarchy.data.HierarchyProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.hierarchy.data.HierarchyResponseHandler({proxy:this,action:c,reader:f,sendRecords:d,options:k,callback:g,scope:h})}});Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.HierarchyState=Ext.extend(Zarafa.core.data.StatefulObservable,{constructor:function(a){a=a||{};Ext.applyIf(a,{stateful:!0,statefulName:"folders"});Zarafa.hierarchy.data.HierarchyState.superclass.constructor.call(this,a)},getStateNameForFolder:function(a,b){return a?"folders/"+a.get("entryid")+"/"+b:"folders/none/"+b},applyStateForFolder:function(a,b,c){this.statefulName=this.getStateNameForFolder(a,b);(a=this.getStateId())&&Ext.state.Manager.set(a,c)},getStateForFolder:function(a,
b){this.statefulName=this.getStateNameForFolder(a,b);var c=this.getStateId();if(c)return Ext.apply({},Ext.state.Manager.get(c))}});Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.JsonPermissionsWriter=Ext.extend(Zarafa.core.data.JsonWriter,{toPropHash:function(a){var b=a.getSubStore("permissions");a={};if(!Ext.isDefined(b))return a;var c=b.getModifiedRecords(),b=b.getRemovedRecords();if(0<c.length||0<b.length){a.permissions={};for(var d=0;d<c.length;d++){var e=c[d],f=e.data;e.phantom?(Ext.isDefined(a.permissions.add)||(a.permissions.add=[]),a.permissions.add.push(f)):(Ext.isDefined(a.permissions.modify)||(a.permissions.modify=[]),a.permissions.modify.push(f))}for(d=
0;d<b.length;d++)e=b[d],f=e.data,Ext.isDefined(a.permissions.remove)||(a.permissions.remove=[]),a.permissions.remove.push(f)}return a}});Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.CreateFolderContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{parentFolder:void 0,preferredContainerClass:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.createfoldercontentpanel",layout:"fit",title:_("Create New Folder"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0,ignoreUpdates:!1,useShadowStore:!0}),width:330,height:380,items:[{xtype:"zarafa.createfolderpanel",parentFolder:a.parentFolder,preferredContainerClass:a.preferredContainerClass}]});
Zarafa.hierarchy.dialogs.CreateFolderContentPanel.superclass.constructor.call(this,a)},onUpdateRecord:function(a,b,c){Zarafa.hierarchy.dialogs.CreateFolderContentPanel.superclass.onUpdateRecord.apply(this,arguments);if(b==Ext.data.Record.COMMIT)return this.close(),!1}});Ext.reg("zarafa.createfoldercontentpanel",Zarafa.hierarchy.dialogs.CreateFolderContentPanel);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderSelectionContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{hideTodoList:!1,folder:void 0,callback:Ext.emptyFn,scope:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:"fit",title:_("Select Folder"),width:330,height:380,items:[{xtype:"zarafa.folderselectionpanel",folder:a.folder,hideTodoList:!!a.hideTodoList,buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.hierarchy.dialogs.FolderSelectionContentPanel.superclass.constructor.call(this,
a)},onOk:function(){Ext.isFunction(this.callback)&&this.callback.call(this.scope||this,this.get(0).getFolder());this.close()},onCancel:function(){this.close()}});Ext.reg("zarafa.folderselectioncontentpanel",Zarafa.hierarchy.dialogs.FolderSelectionContentPanel);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.ContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{contextNode:void 0,contextTree:void 0,constructor:function(a){a=a||{};a.contextNode&&(a.contextTree=a.contextNode.getOwnerTree());Ext.applyIf(a,{items:[this.createContextMenuItems(a)],defaults:{xtype:"zarafa.conditionalitem",scope:this}});Zarafa.hierarchy.ui.ContextMenu.superclass.constructor.call(this,a)},createContextMenuItems:function(a){var b=a.records?a.records.isSpecialFolder("junk"):!1;return[{text:_("Open"),iconCls:"icon_open",
handler:this.onContextItemOpen,beforeShow:function(a,b){b.get("access")&Zarafa.core.mapi.Access.ACCESS_READ&&(!b.isIPMSubTree()||b.getMAPIStore().isDefaultStore())?a.setDisabled(!1):a.setDisabled(!0)}},{xtype:"menuseparator"},{text:_("Copy/Move Folder"),iconCls:"icon_copy",handler:this.onContextCopyMoveFolder,beforeShow:function(a,b){!(b.get("access")&Zarafa.core.mapi.Access.ACCESS_READ)||b.isIPMSubTree()||b.isTodoListFolder()||b.isRSSFolder()||b.isDefaultFolder()?a.setDisabled(!0):a.setDisabled(!1)}},
{text:_("Rename Folder"),iconCls:"icon_folder_rename",handler:this.onContextItemRenameFolder,beforeShow:function(a,b){b.get("access")&Zarafa.core.mapi.Access.ACCESS_MODIFY&&!b.isIPMSubTree()&&!b.isTodoListFolder()&&!b.isRSSFolder()&&!b.isDefaultFolder()&&this.contextTree&&this.contextNode?a.setDisabled(!1):a.setDisabled(!0)}},{text:_("New Folder"),iconCls:"icon_createFolderColor",handler:this.onContextItemNewFolder,beforeShow:function(a,b){b.get("access")&Zarafa.core.mapi.Access.ACCESS_CREATE_HIERARCHY&&
!b.getMAPIStore().isArchiveStore()&&!b.isTodoListFolder()?a.setDisabled(!1):a.setDisabled(!0)}},{xtype:"menuseparator"},{text:_("Mark All Messages Read"),iconCls:"icon_mark_all_read",handler:this.onContextItemReadFlags,beforeShow:function(a,b){b.get("access")&Zarafa.core.mapi.Access.ACCESS_READ&&!b.isIPMSubTree()&&!b.isTodoListFolder()?a.setDisabled(!1):a.setDisabled(!0)}},{xtype:"menuseparator"},{text:_("Delete Folder"),iconCls:"icon_folder_delete",handler:this.onContextItemDeleteFolder,beforeShow:function(a,
b){!(b.get("access")&Zarafa.core.mapi.Access.ACCESS_DELETE)||b.isIPMSubTree()||b.isDefaultFolder()||b.isTodoListFolder()||b.isRSSFolder()||b.getMAPIStore().isArchiveStore()?a.setDisabled(!0):a.setDisabled(!1)}},{text:b?_("Empty Junk E-mail"):_("Empty Deleted Items"),iconCls:"icon_empty_trash",handler:this.onContextItemEmptyFolder,beforeShow:function(a,d){d.get("access")&Zarafa.core.mapi.Access.ACCESS_READ&&d.isSpecialFolder("wastebasket")||b?a.setDisabled(!1):a.setDisabled(!0)}},{xtype:"menuseparator"},
{text:_("Close store"),iconCls:"icon_store_close",handler:this.onContextItemCloseStore,scope:this,beforeShow:function(a,b){b.isIPMSubTree()&&b.getMAPIStore().isSharedStore()?a.setDisabled(!1):a.setDisabled(!0)}},{text:_("Close folder"),iconCls:"icon_folder_close",handler:this.onContextItemCloseFolder,scope:this,beforeShow:function(a,b){!b.isIPMSubTree()&&b.isSharedFolder()?a.setDisabled(!1):a.setDisabled(!0)}},{xtype:"menuseparator"},{text:_("Reload"),iconCls:"icon_refresh",handler:this.onContextItemReload,
scope:this,beforeShow:function(a,b){b.isOwnRoot()?a.setDisabled(!1):a.setDisabled(!0)}},{text:_("Restore items"),handler:this.onContextItemRestore,iconCls:"icon_restore",beforeShow:function(a,b){!b.get("access")||b.isTodoListFolder()?a.setDisabled(!0):a.setDisabled(!1)}},{text:_("Select color"),iconCls:"icon-select-color",beforeShow:function(a,b){var c=this.contextNode.id,d=this.contextTree.model;b.isCalendarFolder()?(a.setDisabled(!1),c=d.getColorScheme(c),a.iconBG=c.base):a.setDisabled(!0)},menu:this.createSelectColorSubmenu(a)},
{text:_("Add to Favorites"),iconCls:"icon_folder_favorites",hidden:!0,beforeShow:function(a,b){if(!b.isInDeletedItems()){var c=b.existsInFavorites();!c&&b.isIPMSubTree()&&(c=!b.isOwnRoot());a.setDisabled(c||b.isTodoListFolder())}},handler:this.onContextItemFavorites},{text:_("Remove From Favorites"),hidden:!0,iconCls:"icon_remove_favorites",beforeShow:function(a,b){b.existsInFavorites()&&a.setDisabled(!1)},handler:this.onContextItemFavoritesRemove},{text:_("Properties"),handler:this.onContextItemProperties,
iconCls:"icon_openMessageOptions",beforeShow:function(a,b){!b.get("access")||b.isTodoListFolder()?a.setDisabled(!0):a.setDisabled(!1)}}]},createSelectColorSubmenu:function(a){var b=[],c=a.contextTree.model;if(!c)return b;var c=c.colorScheme,d=a.contextNode.getFolder().colorTheme;Ext.each(c,function(a){b.push({xtype:"zarafa.conditionalitem",text:a.displayName,ctCls:d===a.name?"x-menu-item-selected":"",iconCls:"icon-select-color color-"+a.name,colorSchemeName:a.name,handler:this.onContextItemSelectColor.createDelegate(this),
iconBG:a.header})},this);return b},onContextItemOpen:function(){this.contextTree&&this.contextTree.selectFolderInTree(this.records);Zarafa.hierarchy.Actions.openFolder(this.records)},onContextCopyMoveFolder:function(){Zarafa.common.Actions.openCopyMoveContent(this.records)},onContextItemRenameFolder:function(){this.contextTree.startEditingNode(this.contextNode)},onContextItemNewFolder:function(){Zarafa.hierarchy.Actions.openCreateFolderContent(this.records)},onContextItemDeleteFolder:function(){var a=
this.records.isInDeletedItems()||this.records.getMAPIStore().isPublicStore(),b;b=a?String.format(_('Are you sure you want to permanently delete all the items and subfolders in the "{0}" folder?'),Ext.util.Format.htmlEncode(this.records.getDisplayName())):String.format(_('Are you sure you want to delete the folder "{0}" and move all of its contents into the Deleted Items folder?'),Ext.util.Format.htmlEncode(this.records.getDisplayName()));Ext.MessageBox.confirm(_("Kopano WebApp"),b,function(b){if("yes"==
b){b=this.records;if(b.existsInFavorites()){var c=b.getFavoritesFolder();c.getStore().remove(c)}c=b.getStore();a?c.remove(b):b.moveTo(container.getHierarchyStore().getDefaultFolder("wastebasket"));c.save(b)}},this)},onContextItemEmptyFolder:function(){Ext.MessageBox.confirm(_("Kopano WebApp"),String.format(_("Are you sure you want to empty {0}?"),Ext.util.Format.htmlEncode(this.records.getDisplayName())),function(a){"yes"==a&&(this.records.emptyFolder(),this.records.save())},this)},onContextItemReadFlags:function(){this.records.seadReadFlags();
this.records.save()},onContextItemSelectColor:function(a){var b=this.contextTree.model,c=a.getRecords(),d=b.getStore();a=Zarafa.core.ColorSchemes.getColorScheme(a.colorSchemeName);b.setColorScheme(c.get("entryid"),a);(b=this.contextNode.getUI().getEl().querySelector("svg"))&&Ext.get(b).setStyle("color",a.base);d&&d.lastOptions&&!d.isExecuting("list")&&d.fireEvent("load",d,d.getRange(),d.lastOptions);this.updateOtherHierarchyTreeNodes(c.get("entryid"),a.base)},onContextItemProperties:function(){Zarafa.hierarchy.Actions.openFolderPropertiesContent(this.records,
{modal:!0,showModalWithoutParent:!0})},onContextItemCloseStore:function(){var a=container.getHierarchyStore(),b=this.records.getMAPIStore();a.remove(b);a.save(b)},onContextItemCloseFolder:function(){var a=this.records.getMAPIStore().getFolderStore();a.remove(this.records);a.save(this.records)},onContextItemReload:function(){container.getHierarchyStore().reload()},onContextItemRestore:function(){Zarafa.common.Actions.openRestoreContent(this.records)},onContextItemFavorites:function(){var a=this.records.copy(),
b=container.getShadowStore();a.phantom=!0;b.add(a);a.addToFavorites();b.save(a);a.phantom=!1;b.remove(a,!0)},onContextItemFavoritesRemove:function(){var a=this.records;if(a.existsInFavorites()){var a=a.getFavoritesFolder(),b=a.getStore();b.remove(a);a.removeFromFavorites();b.save(a)}},updateOtherHierarchyTreeNodes:function(a,b){var c=container.getNavigationBar().centerPanel,d=c.multiSelectHierarchyTree,c=c.allFoldersPanel.allFoldersHierarchyTree;this.setSvgIconColor(this.contextTree,"favorites-"+
a,b);this.setSvgIconColor(c,a,b);this.setSvgIconColor(c,"favorites-"+a,b);this.setSvgIconColor(d,a,b)},setSvgIconColor:function(a,b,c){if(a=a.getNodeById(b))a=a.getUI().iconNode,Ext.get(a).setStyle("color",c)}});Ext.reg("zarafa.hierarchycontextmenu",Zarafa.hierarchy.ui.ContextMenu);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.HierarchyFolderDropZone=Ext.extend(Zarafa.hierarchy.ui.HierarchyTreeDropZone,{constructor:function(a,b){Zarafa.hierarchy.ui.HierarchyFolderDropZone.superclass.constructor.call(this,a,b);if(this.tree)this.tree.on("beforenodedrop",this.onBeforeNodeDrop,this)},onBeforeNodeDrop:function(a){if(a.source===this){var b=a.dropNode;if(Ext.isDefined(b)){var c=a.target;switch(a.point){case "above":case "below":c=c.parentNode}if(b.parentNode===c)return!1}}},getDropPoint:function(a,b,c){c=b.node;
if(c.isRoot)return!1!==c.allowChildren?"append":!1;var d=b.ddel;b=Ext.lib.Dom.getY(d);d=b+d.offsetHeight;a=Ext.lib.Event.getPageY(a);var e=!1===c.allowChildren;if(this.appendOnly||!1===c.parentNode.allowChildren)return e?!1:"append";var f=!1;this.allowParentInsert||(f=c.hasChildNodes()&&c.isExpanded());c=(d-b)/(e?2:3);return a>=b&&a<b+c?"above":!f&&(e||a>=d-c&&a<=d)?"below":"append"},isValidDropPoint:function(a,b,c,d,e){var f=a.node.getFolder();return f.isFavoritesFolder()||f.isFavoritesRootFolder()||
f.isTodoListFolder()?!1:Zarafa.hierarchy.ui.HierarchyFolderDropZone.superclass.isValidDropPoint.apply(this,arguments)}});Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.HierarchyItemDropZone=Ext.extend(Zarafa.hierarchy.ui.HierarchyTreeDropZone,{onNodeDrop:function(a,b,c,d){var e=this.getDropPoint(c,a,b),f=a.node;f.ui.startDrop();return this.isValidDropPoint(a,e,b,c,d)?this.processDrop(f,d,e,b,c,d.selections):(f.ui.endDrop(),!1)},onContainerDrop:function(a,b,c){if(this.allowContainerDrop&&this.isValidDropPoint({ddel:this.tree.getRootNode().ui.elNode,node:this.tree.getRootNode()},"append",a,b,c)){var d=this.tree.getRootNode();d.ui.startDrop();return this.processDrop(d,
c,"append",a,b,c.selections)}return!1},processDrop:function(a,b,c,d,e,f){b={tree:this.tree,target:a,data:b,point:c,source:d,rawEvent:e,dropItem:f,cancel:Ext.isEmpty(f),dropStatus:!1};if(!1===this.tree.fireEvent("beforeitemdrop",b)||!0===b.cancel||Ext.isEmpty(b.dropItem))return a.ui.endDrop(),b.dropStatus;this.completeDrop(b);return!0},completeDrop:function(a){a.target.ui.endDrop();this.tree.fireEvent("itemdrop",a)},isValidDropPoint:function(a,b,c,d,e){b=!1;!a.node||Ext.isEmpty(e.selections)||a.node.getFolder().isFavoritesRootFolder()||
a.node.getFolder().isTodoListFolder()||(a=a.node.getFolder(),e=e.selections[0],a.isIPMSubTree()||(b=a.get("entryid"),c=e.get("parent_entryid"),b=!Zarafa.core.EntryId.compareEntryIds(b,c),!0===b&&(b=a.isSpecialFolder("wastebasket"),!0!==b&&(a=a.get("container_class"),e=e.get("message_class"),b=Zarafa.core.MessageClass.isContainerClassCompatible(e,a)))));return b},getDropPoint:function(a,b,c){return"append"}});Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.HierarchyTreePanel=Ext.extend(Zarafa.hierarchy.ui.Tree,{enableItemDrop:!1,itemDropZone:void 0,itemDropConfig:void 0,bbarConfig:void 0,showAllFoldersDefaultValue:!1,constructor:function(a){a=a||{};var b=Ext.isDefined(a.showAllFoldersDefaultValue)?a.showAllFoldersDefaultValue:this.showAllFoldersDefaultValue;Ext.applyIf(a,{xtype:"zarafa.hierarchytreepanel",baseCls:"zarafa-hierarchy-treepanel",flex:1,minHeight:100,stateful:!0,statefulName:"hierarchytree",tbar:{items:[{xtype:"checkbox",
cls:"zarafa-hierarchy-treepanel-showallfolders",ref:"../showAllFoldersCheckbox",boxLabel:_("Show all folders"),checked:b,listeners:{beforerender:this.reviseCheckboxDisablity,check:this.onCheckShowAllFoldersCheckbox,scope:this}}]},loadMask:!0,treeSorter:!0,trackMouseOver:!0,containerScroll:!0,dragConfig:{ddGroup:"dd.mapifolder"},dropConfig:{ddGroup:"dd.mapifolder",expandDelay:250,allowParentInsert:!0},enableItemDrop:!0,itemDropConfig:{ddGroup:"dd.mapiitem"}});Ext.isDefined(a.bbar)||(a.bbarConfig=a.bbarConfig||
{},a.bbar=Ext.applyIf(a.bbarConfig,{xtype:"zarafa.hierarchytreebottombar"}));this.addEvents("beforeitemdrop","itemdrop");Zarafa.hierarchy.ui.HierarchyTreePanel.superclass.constructor.call(this,a);this.mon(this.store,"remove",this.onStoreRemove,this);this.mon(this.store,"removeFolder",this.onFolderRemove,this)},initEvents:function(){this.on("afterrender",function(){this.on("expandnode",this.checkTreeHeight,this);this.on("collapsenode",this.checkTreeHeight,this);this.on("afterlayout",this.checkTreeHeight,
this);this.on("append",this.checkTreeHeight,this);this.on("remove",this.checkTreeHeight,this);this.on("resize",this.checkTreeHeight,this)},this,{single:!0});this.on("contextmenu",this.onTreeNodeContextMenu,this);this.on("click",this.onFolderClicked,this);this.mon(container,"folderselect",this.onFolderSelect,this);this.mon(container,"contextswitch",this.reviseCheckboxDisablity,this);var a=this.findParentByType("zarafa.navigationpanel");a&&this.mon(a,"toggleshowallfolders",this.onToggleShowAllFolders,
this);this.mon(this.loader,"load",this.onHierarchyLoaderLoad,this);!0===this.stateful&&(this.on("expandnode",this.saveFolderState,this,{buffer:5}),this.on("collapsenode",this.saveFolderState,this,{buffer:5}));if(this.enableDD||this.enableDrop)this.dropZone||(this.dropZone=new Zarafa.hierarchy.ui.HierarchyFolderDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:!0===this.ddAppendOnly})),this.on("nodedrop",this.onNodeDrop,this);this.enableItemDrop&&(this.itemDropZone||(this.itemDropZone=
new Zarafa.hierarchy.ui.HierarchyItemDropZone(this,this.itemDropConfig||{ddGroup:this.ddGroup||"TreeDD"})),this.on("itemdrop",this.onItemDrop,this));Zarafa.hierarchy.ui.HierarchyTreePanel.superclass.initEvents.call(this)},initStateEvents:function(){Zarafa.hierarchy.ui.HierarchyTreePanel.superclass.initStateEvents.call(this);this.mon(this.showAllFoldersCheckbox,"check",this.saveState,this,{delay:100})},checkTreeHeight:function(){if(this.ownerCt){var a=this.body.down("ul").getHeight(),b=this.ownerCt.getHeight(),
c=this.getTopToolbar().getHeight(),d=this.getBottomToolbar().getHeight();b<a+d+c?this.ownerCt.getEl().addClass("fixed-bottombar"):this.ownerCt.getEl().removeClass("fixed-bottombar")}},reviseCheckboxDisablity:function(a,b,c){c=c||container.getCurrentContext();a=c==container.getContextByName("settings")||c==container.getContextByName("today");this.showAllFoldersCheckbox.setDisabled(a)},onNodeDrop:function(a){if(Ext.isDefined(a.dropNode)){var b=a.target;switch(a.point){case "above":case "below":b=a.target.parentNode}var c=
a.dropNode.getFolder(),b=b.getFolder();a.rawEvent.ctrlKey?c.copyTo(b):c.moveTo(b);c.save()}},onItemDrop:function(a){if(!Ext.isEmpty(a.dropItem)){var b=a.target,c=Array.isArray(a.dropItem)?a.dropItem:[a.dropItem],b=b.getFolder(),d=c[0].getStore();if(b.isSpecialFolder("wastebasket"))Zarafa.common.Actions.deleteRecords(c);else if(a.rawEvent.ctrlKey){a=0;for(var e=c.length;a<e;a++)c[a].copyTo(b)}else for(a=0,e=c.length;a<e;a++)c[a].moveTo(b);b.isSpecialFolder("wastebasket")||d.save(c)}},onStoreRemove:function(a,
b){var c=b.getSubStore("folders");this.model&&c.each(function(a){this.model.removeFolder(a)},this)},onFolderRemove:function(a,b,c){this.model&&this.model.removeFolder(c)},onFolderSelect:function(a){Array.isArray(a)&&(a=1<a.length&&this.model?this.model.getDefaultFolder():a[0]);a&&this.selectFolderInTree(a)},onHierarchyLoaderLoad:function(a,b,c){if(a=container.getCurrentContext().getModel()){c=a.getFolders();for(var d=0,e=c.length;d<e;d++)this.selectFolderInTree(c[d],c[d].id===b.id);1<c.length&&a&&
this.selectFolderInTree(a.getDefaultFolder())}},onTreeNodeContextMenu:function(a,b){if(!a.getFolder().isFavoritesRootFolder()){var c=b.getXY();0===c[0]&&0===c[1]&&(c=a.ui.anchor.getBoundingClientRect(),c=[c.left,c.top]);var d=a.getFolder();d.isFavoritesFolder()&&!d.isSearchFolder()&&(d=d.getOriginalRecordFromFavoritesRecord());Zarafa.core.data.UIFactory.openDefaultContextMenu(d,{position:c,contextNode:a})}},onFolderClicked:function(a){a=a.getFolder();Zarafa.hierarchy.Actions.openFolder(a)},getTreeEditor:function(){this.treeEditor||
(this.treeEditor=new Zarafa.hierarchy.ui.TreeEditor(this));return this.treeEditor},startEditingNode:function(a){this.getTreeEditor().startEditingNode(a)},isFolderOpened:function(a){var b;if(!0===this.stateful){var c=container.getHierarchyStore().getState(a,"tree");c&&(b=c.is_open)}Ext.isDefined(b)||(b=Zarafa.hierarchy.ui.HierarchyTreePanel.superclass.isFolderOpened.call(this,a));return b},saveFolderState:function(a){if(!0===this.stateful&&!a.isRoot){var b=a.getFolder();container.getHierarchyStore().getState(b,
"tree").is_open!==a.expanded&&container.getHierarchyStore().applyState(b,"tree",{is_open:a.expanded})}},onCheckShowAllFoldersCheckbox:function(a,b){container.getNavigationBar().setShowFolderList(b)},onToggleShowAllFolders:function(a){this.suspendEvents(!1);this.showAllFoldersCheckbox.setValue(a);this.resumeEvents()},beforeDestroy:function(){this.rendered&&Ext.destroy(this.itemDropZone);Zarafa.hierarchy.ui.HierarchyTreePanel.superclass.beforeDestroy.apply(this,arguments)},getState:function(){var a=
Zarafa.hierarchy.ui.HierarchyTreePanel.superclass.getState.call(this)||{},b=this.showAllFoldersCheckbox.getValue();return Ext.apply(a,{showallcheckbox:b})},getStateName:function(){return"sidebars/"+Zarafa.core.ui.MainViewSidebar.superclass.getStateName.call(this)}});Ext.reg("zarafa.hierarchytreepanel",Zarafa.hierarchy.ui.HierarchyTreePanel);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.RootFolderNode=Ext.extend(Zarafa.hierarchy.ui.FolderNode,{extendedDisplayName:!1,constructor:function(a){a=a||{};var b="zarafa-tree-root-container",c="zarafa-tree-root-node";a.folder&&(a.folder.isIPMSubTree()?b+=" zarafa-tree-ipm-subtree-container":a.folder.isFavoritesRootFolder()&&(b+=" zarafa-tree-ipm-subtree-favorites-container"),c+=" zarafa-tree-ipm-subtree-node");Ext.applyIf(a,{containerCls:b,cls:c,allowDrag:!1,draggable:!1});Zarafa.hierarchy.ui.RootFolderNode.superclass.constructor.call(this,
a);this.on("beforeclick",this.onBeforeClick,this)},onBeforeClick:function(a){a=a.getFolder();if(a.isFavoritesRootFolder())return!1;if(a&&a.isIPMSubTree())return a.getMAPIStore().isDefaultStore()||!0===a.get("is_unavailable")},getTextFromFolder:function(a){return this.attributes.extendedDisplayName?a.getFullyQualifiedDisplayName():Zarafa.hierarchy.ui.RootFolderNode.superclass.getTextFromFolder.call(this,a)}});Ext.tree.TreePanel.nodeTypes.rootfolder=Zarafa.hierarchy.ui.RootFolderNode;Ext.namespace("Zarafa.mail");
Zarafa.mail.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[{key:Ext.EventObject.X,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewMail,scope:this,settingsCfg:{description:_("New mail"),category:_("Creating an item")}}],b=[{key:Ext.EventObject.R,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onReplyMail,scope:this,settingsCfg:{description:_("Reply"),category:_("Mail")}},{key:Ext.EventObject.R,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onReplyAllMail,scope:this,settingsCfg:{description:_("Reply all"),
category:_("Mail")}},{key:Ext.EventObject.F,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onForwardMail,scope:this,settingsCfg:{description:_("Forward"),category:_("Mail")}},{key:Ext.EventObject.E,ctrl:!0,alt:!1,shift:!1,stopEvent:!0,handler:this.onEditAsNewMail,scope:this,settingsCfg:{description:_("Edit as New Message"),category:_("Mail")}}],c=[{key:Ext.EventObject.U,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onReadUnreadToggle,scope:this,settingsCfg:{description:_("Toggle read/unread"),
category:_("Mail")}},{key:Ext.EventObject.G,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onFlagToggle,scope:this,settingsCfg:{description:_("Toggle red/complete flag"),category:_("Mail")}}];Zarafa.core.KeyMapMgr.register("global",a);Zarafa.core.KeyMapMgr.register("grid.mapimessage.mail",c);Zarafa.core.KeyMapMgr.register("grid.mapimessage.mail",b);Zarafa.core.KeyMapMgr.register("previewpanel.mail",b);Zarafa.core.KeyMapMgr.register("contentpanel.record.message.showmail",b)},onNewMail:function(a,
b,c){Zarafa.mail.Actions.openCreateMailContent(container.getContextByName("mail").getModel())},getSelectedRecord:function(a){return Ext.isDefined(a.record)?a.record:Ext.isFunction(a.getSelectionModel)?a.getSelectionModel().getSelected():!1},getModel:function(a){return Ext.isFunction(a.getContextModel)?a.getContextModel():Ext.isDefined(a.model)?a.model:!1},onReplyMail:function(a,b,c){a=this.getSelectedRecord(c);c=this.getModel(c);a&&Zarafa.mail.Actions.openCreateMailResponseContent(a,c,Zarafa.mail.data.ActionTypes.REPLY)},
onReplyAllMail:function(a,b,c){a=this.getSelectedRecord(c);c=this.getModel(c);a&&Zarafa.mail.Actions.openCreateMailResponseContent(a,c,Zarafa.mail.data.ActionTypes.REPLYALL)},onForwardMail:function(a,b,c){a=this.getSelectedRecord(c);c=this.getModel(c);a&&Zarafa.mail.Actions.openCreateMailResponseContent(a,c,Zarafa.mail.data.ActionTypes.FORWARD)},onEditAsNewMail:function(a,b,c){a=this.getSelectedRecord(c);c=this.getModel(c);a&&Zarafa.mail.Actions.openCreateMailResponseContent(a,c,Zarafa.mail.data.ActionTypes.EDIT_AS_NEW)},
onReadUnreadToggle:function(a,b,c){a=c.model.getSelectedRecords();Ext.isEmpty(a)||(a[0].isRead()?Zarafa.common.Actions.markAsRead(a,!1):Zarafa.common.Actions.markAsRead(a,!0))},onFlagToggle:function(a,b,c){a=c.model.getSelectedRecords();if(!Ext.isEmpty(a)){b=a[0].get("flag_status");c=a[0].getStore();for(var d=0,e=a.length;d<e;d++){var f=a[d];!f.isFaultyMessage()&&f.isMessageClass(["IPM.Note","IPM.Schedule.Meeting","REPORT.IPM","REPORT.IPM.Note"],!0)&&(b==Zarafa.core.mapi.FlagStatus.cleared?(f.set("flag_status",
Zarafa.core.mapi.FlagStatus.flagged),f.set("flag_icon",Zarafa.core.mapi.FlagIcon.red)):b==Zarafa.core.mapi.FlagStatus.completed?(f.set("flag_status",Zarafa.core.mapi.FlagStatus.flagged),f.set("flag_icon",Zarafa.core.mapi.FlagIcon.red)):(f.set("flag_status",Zarafa.core.mapi.FlagStatus.completed),f.set("flag_icon",Zarafa.core.mapi.FlagIcon.clear)))}c&&c.save(a)}}});Zarafa.mail.KeyMapping=new Zarafa.mail.KeyMapping;Ext.namespace("Zarafa.mail");
Zarafa.mail.URLAction=Ext.extend(Object,{constructor:function(){Zarafa.core.URLActionMgr.register("mailto",{handler:this.handleMailTo,scope:this})},handleMailTo:function(a,b,c){b=b.replace(/^mailto:/ig,"to=");b=b.replace(/\?/i,"&");a=Ext.urlDecode(b);a=Zarafa.core.Util.objectKeysToLowerCase(a);b=container.getHierarchyStore().getDefaultFolder("drafts");b=container.getContextByFolder(b).getModel().createRecord(b);Ext.isEmpty(a.subject)||b.set("subject",a.subject);Ext.isEmpty(a.body)||(b.set("body",
a.body),b.set("isHTML",!1));c=[];var d={to:Zarafa.core.mapi.RecipientType.MAPI_TO,cc:Zarafa.core.mapi.RecipientType.MAPI_CC,bcc:Zarafa.core.mapi.RecipientType.MAPI_BCC},e;for(e in d)if(!Ext.isEmpty(a[e]))for(var f=a[e].split(/[;,]/),g=0;g<f.length;g++)c.push(Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{display_name:f[g],smtp_address:f[g],address_type:"SMTP",recipient_type:d[e]}));b.getSubStore("recipients").add(c);Zarafa.common.Actions.openMessageContent(b)}});
Zarafa.mail.URLAction=new Zarafa.mail.URLAction;Ext.namespace("Zarafa.mail.attachitem");
Zarafa.mail.attachitem.AttachMailColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.getColumns(),defaults:{sortable:!0}});Zarafa.mail.attachitem.AttachMailColumnModel.superclass.constructor.call(this,a)},getColumns:function(){return[{header:"<p class='icon_importance'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"importance",width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.importance,tooltip:_("Sort by: Importance")},
{header:"<p class='icon_index'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"icon_index",width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon,tooltip:_("Sort by: Icon")},{header:"<p class='icon_attachment'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"hasattach",width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.attachment,tooltip:_("Sort by: Attachment")},{header:_("From"),dataIndex:"sent_representing_name",width:100,renderer:Zarafa.common.ui.grid.Renderers.sender,
tooltip:_("Sort by: From")},{header:_("To"),dataIndex:"display_to",width:100,renderer:Zarafa.common.ui.grid.Renderers.to,tooltip:_("Sort by: To")},{header:_("Subject"),dataIndex:"subject",renderer:Zarafa.common.ui.grid.Renderers.subject,tooltip:_("Sort by: Subject")},{header:_("Received"),dataIndex:"message_delivery_time",width:180,renderer:Zarafa.common.ui.grid.Renderers.datetime,tooltip:_("Sort by: Received")},{header:_("Categories"),dataIndex:"categories",width:160,renderer:Zarafa.common.ui.grid.Renderers.text,
tooltip:_("Sort by: Categories")}]}});Ext.namespace("Zarafa.mail.attachitem");
Zarafa.mail.attachitem.AttachMailRenderer=Ext.extend(Zarafa.common.attachment.dialogs.AttachItemBaseRenderer,{constructor:function(a){Zarafa.mail.attachitem.AttachMailRenderer.superclass.constructor.call(this,a);Ext.apply(this.labels,{message_delivery_time:_("Sent")})},generateHTMLTemplate:function(){var a;a=""+this.addHTMLRowGroup({from:"{from:htmlEncode}",message_delivery_time:'{message_delivery_time:date("'+_("l jS F Y G:i")+'")}',display_to:"{display_to:htmlEncode}",display_cc:"{display_cc:htmlEncode}",
display_bcc:"{display_bcc:htmlEncode}",subject:"{subject:htmlEncode}",attachment_names:"{attachment_names:htmlEncode}"});a+=this.addHTMLRowGroup({sensitivity:"{sensitivity:sensitivityString}",importance:"{importance:importanceString}"});a+=this.addHTMLRow("categories","{categories:htmlEncode}");return a+"{body}"},generatePlainTemplate:function(){var a;a=""+this.addPlainRowGroup({from:"{from}",message_delivery_time:'{message_delivery_time:date("'+_("l jS F Y G:i")+'")}',display_to:"{display_to}",display_cc:"{display_cc}",
display_bcc:"{display_bcc}",subject:"{subject}",attachment_names:"{attachment_names}"});a+=this.addPlainRowGroup({sensitivity:"{sensitivity:sensitivityString}",importance:"{importance:importanceString}"});a+=this.addPlainRow("categories","{categories}");return a+"{body}"}});Ext.namespace("Zarafa.mail.data");Zarafa.mail.data.DataModes=Zarafa.core.Enum.create({ALL:0,SEARCH:1});Ext.namespace("Zarafa.mail.data");
Zarafa.mail.data.ViewModes=Zarafa.core.Enum.create({NO_PREVIEW:0,RIGHT_PREVIEW:1,BOTTOM_PREVIEW:2,SEARCH:3,LIVESCROLL:4,isMainViewMode:function(a){return a===this.NO_PREVIEW||a===this.RIGHT_PREVIEW||a===this.BOTTOM_PREVIEW}});Ext.namespace("Zarafa.mail.data");Zarafa.mail.data.Views=Zarafa.core.Enum.create({LIST:0,SEARCH:1,LIVESCROLL:2});Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.DelayedDeliveryContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:null,deferredSendTime:void 0,constructor:function(a){a=a||{};a=Ext.apply(a,{xtype:"zarafa.delayeddeliverycontentpanel",width:350,height:260,title:_("Schedule mail to be sent out")+"...",layout:"fit",items:[{xtype:"zarafa.delayeddeliverypanel",ref:"delayedDeliveryPanel",buttons:[{text:_("Send"),cls:"zarafa-action",iconCls:"buttons_icon_send_later_white",ref:"../sendButton",disabled:!0,handler:this.onSend,
scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.mail.dialogs.DelayedDeliveryContentPanel.superclass.constructor.call(this,a)},setDisabled:function(a){this.delayedDeliveryPanel.sendButton.setDisabled(a)},onCancel:function(){this.close()},onSend:function(){this.deferredSendTime=this.delayedDeliveryPanel.getMailDateTime();this.mailPanel.un("saverecord",this.onSaveRecord,this);this.mailPanel.on("saverecord",this.onSaveRecord,this);this.mailPanel.sendValidationQueue.un("completequeue",
this.onCompleteQueue.createDelegate(this,[this.mailPanel,this.record]),this);this.mailPanel.sendValidationQueue.on("completequeue",this.onCompleteQueue.createDelegate(this,[this.mailPanel,this.record]),this);this.close();this.mailPanel.sendRecord()},onCompleteQueue:function(a,b){Ext.isEmpty(b.get("deferred_send_time"))&&(a.un("saverecord",this.onSaveRecord,this),a.showInfoMask=!0);a.sendValidationQueue.un("completequeue",this.onCompleteQueue,this)},onSaveRecord:function(a,b){!0===a.isSending&&!0===
a.showInfoMask&&(a.record.set("deferred_send_time",this.deferredSendTime),a.showInfoMask=!1,container.getNotifier().notify("info.saved",_("Scheduled Items"),this.sendLaterMessage()),a.un("saverecord",this.onSaveRecord,this))},sendLaterMessage:function(){var a=this.deferredSendTime.format("d/m/y H:i"),b=_("Your message will be sent at "),c=_("Go to your <b>Outbox</b> to edit your email.");return String.format("{0}<b>{1}.</b> <br>{2}",b,a,c)}});Ext.reg("zarafa.delayeddeliverycontentpanel",Zarafa.mail.dialogs.DelayedDeliveryContentPanel);
Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsComposeWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b={xtype:"jsonstore",autoDestroy:!0,fields:["name","value"],data:[{name:_("HTML"),value:"html"},{name:_("Plain Text"),value:"plain"}]},c={xtype:"jsonstore",autoDestroy:!0,fields:["name","value"],data:Zarafa.common.ui.htmleditor.Fonts.getFontFamilies().split(";").map(function(a){return{name:a.split("=")[0],value:a.split("=")[1].toLowerCase()}})},d=Zarafa.common.ui.htmleditor.Fonts.getFonts(),
e=Object.keys(d).sort(),f=[];Ext.each(e,function(a){f.push({name:d[a]+"pt",value:a})});e={xtype:"jsonstore",autoDestroy:!0,fields:["name","value"],data:f};Ext.applyIf(a,{title:_("Compose mail settings"),layout:"form",items:[{xtype:"combo",name:"zarafa/v1/contexts/mail/dialogs/mailcreate/use_html_editor",ref:"composerCombo",fieldLabel:_("Compose mail in this format"),width:200,store:b,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,
autoSelect:!0,listeners:{select:this.onComposerSelect,scope:this}},{xtype:"combo",name:"zarafa/v1/main/default_font",cls:"x-font-select",fieldLabel:_("Default font"),width:200,ref:"fontCombo",store:c,triggerAction:"all",mode:"local",displayField:"name",valueField:"value",editable:!1,autoSelect:!0,forceSelection:!0,lazyInit:!1,listeners:{select:this.onFontSelect,scope:this}},{xtype:"combo",name:"zarafa/v1/main/default_font_size",cls:"x-font-select",fieldLabel:_("Default font size"),width:200,ref:"fontSizeCombo",
store:e,triggerAction:"all",mode:"local",displayField:"name",valueField:"value",editable:!1,autoSelect:!0,forceSelection:!0,lazyInit:!1,listeners:{select:this.onFontSelect,scope:this}},{xtype:"checkbox",name:"zarafa/v1/contexts/mail/always_request_readreceipt",ref:"readBox",boxLabel:_("Always request a read receipt"),hideLabel:!0,listeners:{check:this.onFieldChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("{A}AutoSave unsent mail every {B} minute(s)"),
labelWidth:250,combineErrors:!1,items:[{xtype:"checkbox",labelSplitter:"{A}",name:"zarafa/v1/contexts/mail/autosave_enable",ref:"../autoSaveBox",boxLabel:"",hideLabel:!0,checked:!0,listeners:{check:this.onAutoSaveCheckBoxChange,change:this.onFieldChange,scope:this}},{xtype:"zarafa.spinnerfield",labelSplitter:"{B}",vtype:"naturalInteger",name:"zarafa/v1/contexts/mail/autosave_time",ref:"../autoSaveTimeSpinner",incrementValue:1,defaultValue:1,minValue:1,allowBlank:!1,allowDecimals:!1,allowNegative:!1,
listeners:{change:this.onFieldChange,scope:this},plugins:["zarafa.numberspinner"]}]}]});Zarafa.mail.settings.SettingsComposeWidget.superclass.constructor.call(this,a)},update:function(a){this.model=a;var b=a.get(this.composerCombo.name);this.composerCombo.setValue(b?"html":"plain");this.fontCombo.setValue(a.get(this.fontCombo.name));this.fontSizeCombo.setValue(a.get(this.fontSizeCombo.name));this.fontCombo.setDisabled(!0!==b);this.fontSizeCombo.setDisabled(!0!==b);this.readBox.setValue(a.get(this.readBox.name));
b=a.get(this.autoSaveBox.name);this.autoSaveBox.setValue(b);this.autoSaveTimeSpinner.setValue(a.get(this.autoSaveTimeSpinner.name)/60)},updateSettings:function(a){var b=this.autoSaveTimeSpinner.getValue(),b=0!==b&&Ext.isDefined(b)?60*b:a.get("zarafa/v1/contexts/mail/autosave_time",!1,!0);a.beginEdit();a.set(this.composerCombo.name,"html"===this.composerCombo.getValue());a.set(this.readBox.name,this.readBox.getValue());a.set(this.autoSaveTimeSpinner.name,b);a.endEdit()},onComposerSelect:function(a,
b){if(this.model){var c=b.get(a.valueField);this.model.get(a.name)!==c&&this.model.set(a.name,"html"===c);this.fontCombo.setDisabled("html"!==c);this.fontSizeCombo.setDisabled("html"!==c)}},onFieldChange:function(a,b){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b)},onAutoSaveCheckBoxChange:function(a,b){this.onFieldChange(a,b);this.autoSaveTimeSpinner.setDisabled(!b)},onFontSelect:function(a,b){if(this.model){var c=b.get(a.valueField);this.model.get(a.name)!==c&&this.model.set(a.name,
c)}}});Ext.reg("zarafa.settingscomposewidget",Zarafa.mail.settings.SettingsComposeWidget);Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsIncomingMailWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Incoming mail"),layout:"form",items:[{xtype:"displayfield",hideLabel:!0,value:_("How to respond to requests for read receipts")},{xtype:"radiogroup",name:"zarafa/v1/contexts/mail/readreceipt_handling",ref:"readReceiptGroup",columns:1,hideLabel:!0,items:[{xtype:"radio",name:"receiptHandling",inputValue:"always",boxLabel:_("Always send a response")},{xtype:"radio",
name:"receiptHandling",inputValue:"never",boxLabel:_("Never send a response")},{xtype:"radio",name:"receiptHandling",inputValue:"ask",boxLabel:_("Ask me before sending a response")}],listeners:{change:this.onRadioChange,scope:this}},{xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],fieldLabel:_("{A}Automatically mark mail as read after {B} second(s)"),labelWidth:250,items:[{xtype:"checkbox",labelSplitter:"{A}",name:"zarafa/v1/contexts/mail/readflag_time_enable",ref:"../readFlagTimeCheckbox",
boxLabel:"",hideLabel:!0,listeners:{check:this.onCheckboxChange,scope:this}},{xtype:"zarafa.spinnerfield",labelSplitter:"{B}",name:"zarafa/v1/contexts/mail/readflag_time",ref:"../readFlagTimeSpinner",incrementValue:1,defaultValue:0,minValue:0,listeners:{change:this.onFieldChange,scope:this},plugins:["zarafa.numberspinner"]}]}]});Zarafa.mail.settings.SettingsIncomingMailWidget.superclass.constructor.call(this,a)},update:function(a){this.model=a;var b=a.get(this.readFlagTimeCheckbox.name);this.readFlagTimeCheckbox.setValue(b);
this.readFlagTimeSpinner.setValue(a.get(this.readFlagTimeSpinner.name));this.readReceiptGroup.setValue(a.get(this.readReceiptGroup.name));this.readFlagTimeSpinner.setDisabled(!b)},updateSettings:function(a){a.beginEdit();a.set(this.readReceiptGroup.name,this.readReceiptGroup.getValue().inputValue);a.set(this.readFlagTimeCheckbox.name,this.readFlagTimeCheckbox.getValue());a.set(this.readFlagTimeSpinner.name,this.readFlagTimeSpinner.getValue());a.endEdit()},onRadioChange:function(a,b){this.model&&this.model.get(a.name)!==
b.inputValue&&this.model.set(a.name,b.inputValue)},onFieldChange:function(a,b){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b)},onCheckboxChange:function(a,b){this.onFieldChange(a,b);this.readFlagTimeSpinner.setDisabled(!b)}});Ext.reg("zarafa.settingsincomingmailwidget",Zarafa.mail.settings.SettingsIncomingMailWidget);Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsMailCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};var b=[{xtype:"zarafa.settingsmailwidget"},{xtype:"zarafa.settingscomposewidget"},container.populateInsertionPoint("context.settings.category.mail.aftercomposesettings",this),{xtype:"zarafa.settingsincomingmailwidget"},{xtype:"zarafa.settingssignatureswidget"},container.populateInsertionPoint("context.settings.category.mail",this)];Ext.applyIf(a,{title:_("Mail"),categoryIndex:1,
iconCls:"zarafa-settings-category-mail",items:b});Zarafa.mail.settings.SettingsMailCategory.superclass.constructor.call(this,a)}});Ext.reg("zarafa.settingsmailcategory",Zarafa.mail.settings.SettingsMailCategory);Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsMailWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b={xtype:"jsonstore",autoDestroy:!0,fields:["name","value"],data:[{name:_("Off"),value:Zarafa.mail.data.ViewModes.NO_PREVIEW},{name:_("Right"),value:Zarafa.mail.data.ViewModes.RIGHT_PREVIEW},{name:_("Bottom"),value:Zarafa.mail.data.ViewModes.BOTTOM_PREVIEW}]};Ext.applyIf(a,{title:_("General mail settings"),layout:"form",items:[{xtype:"combo",name:"zarafa/v1/state/contexts/mail/current_view_mode",
ref:"previewCombo",fieldLabel:_("Location of preview pane"),width:200,store:b,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{select:this.onPreviewSelect,scope:this}},{xtype:"checkbox",name:"zarafa/v1/contexts/mail/close_on_respond",ref:"closeCheck",boxLabel:_("Close original message on reply or forward"),hideLabel:!0,lazyInit:!1,listeners:{check:this.onCheck,scope:this}}]});Zarafa.supportsPopOut()&&a.items.splice(1,
0,{xtype:"displayfield",hideLabel:!0,value:_("Open or compose a mail item in a")+":"},{xtype:"radiogroup",name:"zarafa/v1/main/base_content_layer",ref:"openingMailField",columns:1,hideLabel:!0,items:[{xtype:"radio",name:"openingMail",inputValue:"tabs",boxLabel:_("WebApp tab")},{xtype:"radio",name:"openingMail",inputValue:"separateWindows",boxLabel:_("Browser window")}],listeners:{change:this.onRadioChange,scope:this}});Zarafa.mail.settings.SettingsMailWidget.superclass.constructor.call(this,a)},update:function(a){this.model=
a;var b=a.get(this.previewCombo.name);Ext.isDefined(b)||(b=Zarafa.mail.data.ViewModes.RIGHT_PREVIEW);this.previewCombo.setValue(b);this.closeCheck.setValue(a.get(this.closeCheck.name));Zarafa.supportsPopOut()&&this.openingMailField.setValue(a.get(this.openingMailField.name))},updateSettings:function(a){a.set(this.previewCombo.name,this.previewCombo.getValue());a.set(this.closeCheck.name,this.closeCheck.getValue());Zarafa.supportsPopOut()&&a.set(this.openingMailField.name,this.openingMailField.getValue().inputValue)},
onPreviewSelect:function(a,b){if(this.model){var c=b.get(a.valueField);this.model.get(a.name)!==c&&this.model.set(a.name,c)}},onCheck:function(a,b){this.model&&this.model.get(a.name)!==b&&this.model.set(a.name,b)},onRadioChange:function(a,b){this.model&&this.model.get(a.name)!==b.inputValue&&this.model.set(a.name,b.inputValue)}});Ext.reg("zarafa.settingsmailwidget",Zarafa.mail.settings.SettingsMailWidget);Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsOofWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Out of Office"),iconCls:"zarafa-settings-favorite-oof"});Ext.applyIf(a,this.getNewConfig());Zarafa.mail.settings.SettingsOofWidget.superclass.constructor.call(this,a);this.outOfOfficeDateTimeField.dateField.on("selectnow",this.onOutOfOfficeSelectNow,this);this.backDateTimeField.dateField.on("selectnow",this.onBackSelectNow,this)},getNewConfig:function(){var a=
(new Date).getNextWorkWeekDay()||(new Date).add(Date.DAY,1),a=a.clearTime().add(Date.MINUTE,container.getSettingsModel().get("zarafa/v1/main/start_working_hour"));return{items:[{xtype:"radio",name:"zarafa/v1/contexts/mail/outofoffice/set",inputValue:"false",boxLabel:_("I am currently in the office"),hideLabel:!0,ref:"inOfficeField",listeners:{check:this.onRadioChecked,scope:this}},{xtype:"container",layout:{type:"table",columns:3},border:!1,style:{paddingBottom:"25px"},items:[{xtype:"radio",name:"zarafa/v1/contexts/mail/outofoffice/set",
hideLabel:!0,boxLabel:_("I am out of the office from")+":",ref:"../outOfOfficeRadio",cellCls:"zarafa-settings-oof-table-cellpadding",inputValue:"true",listeners:{check:this.onRadioChecked,scope:this}},{xtype:"zarafa.datetimefield",ref:"../outOfOfficeDateTimeField",name:"zarafa/v1/contexts/mail/outofoffice/from",dateFieldConfig:{showNow:!0,invalidClass:"zarafa-settings-oof-invalid"},fieldLabel:"",width:200,hideLabel:!0,dateFormat:_("d/m/Y"),timeFormat:_("G:i"),minValue:new Date,defaultValue:new Date,
timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),listeners:{change:this.onOutOfOfficeChange,scope:this}},{xtype:"displayfield"},{xtype:"checkbox",disabled:!0,name:"zarafa/v1/contexts/mail/autosave_enable",ref:"../willBeBackCheckBox",cellCls:"zarafa-settings-oof-table-cellpadding",boxLabel:_("I will be back on")+":",hideLabel:!0,listeners:{render:this.onWillBeBackCheckRender,check:this.onWillBeBackCheck,scope:this}},{xtype:"zarafa.datetimefield",fieldLabel:"",
ref:"../backDateTimeField",cellCls:"zarafa-settings-oof-table-cellpadding",name:"zarafa/v1/contexts/mail/outofoffice/until",dateFieldConfig:{showNow:!0,invalidClass:"zarafa-settings-oof-invalid"},timeFieldConfig:{invalidClass:"zarafa-settings-oof-invalid"},width:200,disabled:!0,hideLabel:!0,dateFormat:_("d/m/Y"),timeFormat:_("G:i"),minValue:new Date,defaultValue:a,timeIncrement:container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),listeners:{change:this.backDateTimeChange,
scope:this}},{xtype:"displayfield",width:"100%",cellCls:"zarafa-settings-oof-table-cellpadding",ref:"../oofWarning"}]},{xtype:"container",cls:"zarafa-settings-oof-subject",anchor:"100%",layout:"hbox",items:[{xtype:"displayfield",cls:"label-subject",value:_("Subject")+":",autoWidth:!0},{xtype:"textfield",name:"zarafa/v1/contexts/mail/outofoffice/subject",ref:"../subjectField",emptyText:_("Out of Office"),flex:1,listeners:{change:this.onFieldChange,scope:this}}]},{xtype:"displayfield",anchor:"100%",
cls:"zarafa-settings-oof-autoreplay",hideLabel:!0,value:_("Automatically reply once per day, per sender with the following text")+":"},{xtype:"textarea",anchor:"100%",name:"zarafa/v1/contexts/mail/outofoffice/message",ref:"bodyField",hideLabel:!0,emptyText:_("User is currently out of office."),listeners:{change:this.onFieldChange,scope:this}}]}},onWillBeBackCheckRender:function(a){a.wrap.addClass("zarafa-settings-oof-table-cellalign")},update:function(a){this.model=a;var b=a.get(this.inOfficeField.name);
this.inOfficeField.setValue(!b);this.outOfOfficeRadio.setValue(b);if(b){var b=a.get(this.outOfOfficeDateTimeField.name),c=a.get(this.backDateTimeField.name);0!==b&&this.outOfOfficeDateTimeField.setValue(new Date(1E3*b));0!==c&&(this.backDateTimeField.setValue(new Date(1E3*c)),this.willBeBackCheckBox.setValue(!0))}this.subjectField.setValue(a.get(this.subjectField.name));this.bodyField.setValue(a.get(this.bodyField.name))},updateSettings:function(a){var b=this.subjectField.getValue()||this.subjectField.emptyText,
c=this.bodyField.getValue()||this.bodyField.emptyText;a.beginEdit();a.set(this.subjectField.name,b);a.set(this.bodyField.name,c);a.set(this.outOfOfficeRadio.name,this.outOfOfficeRadio.getValue());this.outOfOfficeRadio.getValue()&&(a.set(this.outOfOfficeDateTimeField.name,this.outOfOfficeDateTimeField.getValue().getTime()/1E3),!0===this.willBeBackCheckBox.getValue()?a.set(this.backDateTimeField.name,this.backDateTimeField.getValue().getTime()/1E3):a.set(this.backDateTimeField.name,0));a.endEdit()},
onOutOfOfficeSelectNow:function(a,b){this.outOfOfficeDateTimeField.timeField.setValue(new Date)},onBackSelectNow:function(a,b){this.backDateTimeField.timeField.setValue(new Date)},onRadioChange:function(a,b){var c="true"===b.inputValue;this.model&&this.model.get(a.name)!==c&&this.model.set(a.name,c);this.subjectField.setDisabled(!c);this.bodyField.setDisabled(!c)},onRadioChecked:function(a,b){if(!0===b){var c="true"===a.inputValue;this.model&&this.model.get(a.name)!==c&&this.model.set(a.name,c);this.subjectField.setDisabled(!c);
this.bodyField.setDisabled(!c);this.outOfOfficeDateTimeField.setDisabled(!c);this.willBeBackCheckBox.setDisabled(!c);!0===this.willBeBackCheckBox.getValue()&&this.willBeBackCheckBox.setValue(!1);this.reviseWarningStatus()}},onWillBeBackCheck:function(a,b){this.backDateTimeField.setDisabled(!b);this.reviseWarningStatus()},onFieldChange:function(a,b){this.model&&this.model.set(a.name,b||a.emptyText)},onOutOfOfficeChange:function(a,b,c){this.backDateTimeField.dateField.setMinValue(b);this.reviseWarningStatus();
this.model&&this.model.set(a.name,b||a.defaultValue)},backDateTimeChange:function(a,b,c){this.reviseWarningStatus();this.model&&this.model.set(a.name,b||a.defaultValue)},reviseWarningStatus:function(){this.outOfOfficeDateTimeField.getValue()>=this.backDateTimeField.getValue()&&!0===this.willBeBackCheckBox.getValue()?(this.oofWarning.setValue(_("The time you entered is before the out of office date. Please reschedule.")),this.backDateTimeField.dateField.markInvalid(),this.backDateTimeField.timeField.markInvalid()):
(this.oofWarning.reset(),this.backDateTimeField.dateField.clearInvalid(),this.backDateTimeField.timeField.clearInvalid())}});Ext.reg("zarafa.settingsoofwidget",Zarafa.mail.settings.SettingsOofWidget);Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsOutOfOfficeCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Out of Office"),categoryIndex:2,iconCls:"zarafa-settings-category-oof",items:[{xtype:"zarafa.settingsoofwidget"},container.populateInsertionPoint("context.settings.category.outofoffice",this)]});Zarafa.mail.settings.SettingsOutOfOfficeCategory.superclass.constructor.call(this,a)}});Ext.reg("zarafa.settingsoutofofficecategory",Zarafa.mail.settings.SettingsOutOfOfficeCategory);
Ext.namespace("Zarafa.mail.settings");
Zarafa.mail.settings.SettingsSignaturesWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{dirtySelectedSignature:!1,selectedSignature:void 0,constructor:function(a){a=a||{};var b={xtype:"jsonstore",fields:[{name:"id",type:"int"},{name:"name"},{name:"content"},{name:"isHTML",type:"boolean"}],sortInfo:{field:"id",direction:"ASC"},autoDestroy:!0};Ext.applyIf(a,{title:_("Signatures"),iconCls:"zarafa-settings-favorite-signatures",items:[{xtype:"container",layout:"column",items:[{xtype:"grid",name:"zarafa/v1/contexts/mail/signatures/all",
ref:"../signaturesGrid",cls:"zarafa-settings-signatures",columnWidth:.5,height:200,store:b,hideHeaders:!0,viewConfig:{forceFit:!0,deferEmptyText:!1,emptyText:'<div class="emptytext">'+_("No signatures configured")+"</div>"},sm:new Ext.grid.RowSelectionModel({singleSelect:!0,listeners:{beforerowselect:this.onSignatureBeforeRowSelect,selectionchange:this.onSignatureSelectionChange,scope:this}}),columns:[{dataIndex:"name",header:"&#160;",renderer:Ext.util.Format.htmlEncode}],buttons:[{text:_("New"),
ref:"../../../newSignatureBtn",handler:this.onAddSignature,scope:this},{text:_("Delete"),ref:"../../../delSignatureBtn",handler:this.onDeleteSignature,scope:this}]},{xtype:"container",layout:"form",columnWidth:.5,labelWidth:200,items:[{xtype:"combo",ref:"../../newMessageCombo",name:"zarafa/v1/contexts/mail/signatures/new_message",fieldLabel:_("Signature for new messages"),anchor:"100%",store:b,mode:"local",triggerAction:"all",displayField:"name",valueField:"id",lazyInit:!1,autoSelect:!0,forceSelection:!0,
editable:!1,listeners:{select:this.onSignatureComboSelect,scope:this}},{xtype:"combo",ref:"../../replyMessageCombo",name:"zarafa/v1/contexts/mail/signatures/replyforward_message",fieldLabel:_("Signature for replies and forwards"),anchor:"100%",store:b,mode:"local",triggerAction:"all",displayField:"name",valueField:"id",lazyInit:!1,autoSelect:!0,forceSelection:!0,editable:!1,listeners:{select:this.onSignatureComboSelect,scope:this}}]}]},{xtype:"textfield",name:"name",fieldLabel:_("Name"),ref:"nameField",
anchor:"100%",listeners:{change:this.onNameFieldChange,scope:this}},{xtype:"zarafa.editorfield",cls:"k-signature-editor",name:"content",htmlName:"content",plaintextName:"content",ref:"contentField",anchor:"100%",height:300,disableEditor:!0,listeners:{change:this.onEditorFieldChange,valuecorrection:this.onValueCorrection,scope:this}}],buttons:[{text:_("Save Signature"),ref:"../saveSignatureBtn",handler:this.onSaveSignature,scope:this}]});Zarafa.mail.settings.SettingsSignaturesWidget.superclass.constructor.call(this,
a)},initEvents:function(){var a=this.signaturesGrid.getStore();this.mon(a,"add",this.onGridAddSignature,this);this.mon(a,"remove",this.onGridDelSignature,this);this.mon(a,"update",this.onGridUpdateSignature,this)},onGridAddSignature:function(a,b,c){a=this.newMessageCombo.getStore();var d=this.replyMessageCombo.getStore();Array.isArray(b)||(b=[b]);for(var e=[],f=[],g=0,h=b.length;g<h;g++){var k;k=Ext.apply({},b[g].data);e.push(new a.recordType(k,b[g].id));k=Ext.apply({},b[g].data);f.push(new d.recordType(k,
b[g].id))}a.insert(c+1,e);d.insert(c+1,f);a.getCount()===b.length&&this.newMessageCombo.setValue(a.getAt(0).get("id"));d.getCount()===b.length&&this.replyMessageCombo.setValue(d.getAt(0).get("id"))},onGridDelSignature:function(a,b,c){a=this.newMessageCombo.getStore();c=this.replyMessageCombo.getStore();Array.isArray(b)||(b=[b]);for(var d=0,e=b.length;d<e;d++){var f;f=a.getById(b[d].id);a.remove(f);f=c.getById(b[d].id);c.remove(f)}(b=a.getById(this.newMessageCombo.getValue()))||this.newMessageCombo.setValue(0);
(b=a.getById(this.replyMessageCombo.getValue()))||this.replyMessageCombo.setValue(0)},onGridUpdateSignature:function(a,b){var c=this.newMessageCombo.getStore(),d=this.replyMessageCombo.getStore();Array.isArray(b)||(b=[b]);for(var e=0,f=b.length;e<f;e++){var g;g=c.getById(b[e].id);Ext.apply(g.data,b[e].data);g=d.getById(b[e].id);Ext.apply(g.data,b[e].data)}c.fireEvent("datachanged",c);d.fireEvent("datachanged",d);this.newMessageCombo.setValue(this.newMessageCombo.getValue());this.replyMessageCombo.setValue(this.replyMessageCombo.getValue())},
update:function(a){this.model=a;this.doSelectSignature(void 0);var b=a.get(this.signaturesGrid.name,!0),c=[],d;for(d in b)c.push(Ext.apply({},b[d],{id:d}));b=this.signaturesGrid.getStore();b.loadData(c);c=[{id:0,name:_("<None>")}].concat(c);b=this.newMessageCombo.getStore();b.loadData(c);d=a.get(this.newMessageCombo.name);b.getById(d)||(d=0);this.newMessageCombo.setValue(d);b=this.replyMessageCombo.getStore();b.loadData(c);c=a.get(this.replyMessageCombo.name);b.getById(c)||(c=0);this.replyMessageCombo.setValue(c);
b=a.get("zarafa/v1/contexts/mail/dialogs/mailcreate/use_html_editor");this.contentField.setHtmlEditor(b,!1);this.mon(a,"set",this.onSettingsSet,this)},updateSettings:function(a){a.beginEdit();this.onSaveSignature();for(var b=this.signaturesGrid.getStore().getRange(),c={},d=0,e=b.length;d<e;d++){var f=b[d];c[f.get("id")]={name:f.get("name"),content:f.get("content"),isHTML:f.get("isHTML")}}0!==b.length?a.set(this.signaturesGrid.name,c):a.remove(this.signaturesGrid.name);b=this.newMessageCombo.getValue();
0!==b?a.set(this.newMessageCombo.name,b):a.remove(this.newMessageCombo.name);b=this.replyMessageCombo.getValue();0!==b?a.set(this.replyMessageCombo.name,b):a.remove(this.replyMessageCombo.name);a.endEdit()},onSettingsSet:function(a,b){Array.isArray(b)||(b=[b]);for(var c=0,d=b.length;c<d;c++){var e=b[c];"zarafa/v1/contexts/mail/dialogs/mailcreate/use_html_editor"===e.path&&this.contentField.setHtmlEditor(e.value)}},onSignatureComboSelect:function(a,b){if(this.model){var c=b.get(a.valueField);0===c&&
(c=void 0);this.model.get(a.name)!==c&&this.model.set(a.name,c)}},onSignatureBeforeRowSelect:function(a,b,c,d){this.signaturesGrid.focus();if(this.hasDirtySignature())return Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("You have unsaved changes. Do you wish to save the changes?"),icon:Ext.MessageBox.QUESTION,fn:this.onSignatureBeforeRowSelectConfirm.createDelegate(this,[a,b,c,d],1),buttons:Ext.MessageBox.YESNOCANCEL}),!1},onSignatureBeforeRowSelectConfirm:function(a,b,c,d,e){if("cancel"!==
a){if("yes"===a)this.onSaveSignature();else this.onRejectSignature();b.selectRow(c,d)}},onSignatureSelectionChange:function(a){a=a.getSelected();this.doSelectSignature(a)},doSelectSignature:function(a){Ext.isEmpty(a)?(delete this.selectedSignature,this.dirtySelectedSignature=!1,this.delSignatureBtn.disable(),this.nameField.reset(),this.nameField.disable(),this.contentField.bindRecord(),this.contentField.setValue(""),this.contentField.disable(),this.saveSignatureBtn.disable(),this.signaturesGrid.getSelectionModel().clearSelections()):
(this.selectedSignature=a,this.dirtySelectedSignature=!1,this.delSignatureBtn.enable(),this.nameField.setValue(a.get("name")),this.nameField.enable(),this.contentField.bindRecord(a),this.contentField.setHtmlEditor(a.get("isHTML"),!1),this.contentField.setValue(a.get("content")),this.contentField.enable(),this.saveSignatureBtn.enable(),this.contentField.focus())},onAddSignature:function(){this.signaturesGrid.focus();this.hasDirtySignature()?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("You have unsaved changes. Do you wish to save the changes?"),
icon:Ext.MessageBox.QUESTION,fn:this.onAddSignatureConfirm.createDelegate(this),buttons:Ext.MessageBox.YESNOCANCEL}):this.doAddSignature()},onAddSignatureConfirm:function(a){if("cancel"!==a){if("yes"===a)this.onSaveSignature();else this.onRejectSignature();this.doAddSignature()}},doAddSignature:function(){var a=this.contentField.isHtmlEditor(),b=this.signaturesGrid.getStore(),a=new b.recordType({id:(new Date).getTime(),name:_("New signature"),isHTML:a});b.add(a);this.model&&this.model.set(this.signaturesGrid.name+
"/"+a.get("id"),{name:a.get("name"),content:a.get("content"),isHTML:a.get("isHTML")});this.signaturesGrid.getSelectionModel().selectRecords([a]);this.doSelectSignature(a);a.set("content",this.contentField.getValue())},onDeleteSignature:function(){this.model&&this.model.remove(this.signaturesGrid.name+"/"+this.selectedSignature.get("id"));var a=this.signaturesGrid.getStore(),b=a.indexOf(this.selectedSignature);a.remove(this.selectedSignature);delete this.selectedSignature;this.dirtySelectedSignature=
!1;b<a.getCount()?this.signaturesGrid.getSelectionModel().selectRow(b):this.signaturesGrid.getSelectionModel().selectLastRow()},onSaveSignature:function(){var a=this.selectedSignature;a&&(a.set(this.nameField.name,this.nameField.getValue()),a.set(this.contentField.name,this.contentField.getValue()),a.set("isHTML",this.contentField.isHtmlEditor(),!0),a.commit(),this.dirtySelectedSignature=!1)},onRejectSignature:function(){var a=this.selectedSignature;a&&(this.nameField.setValue(a.get(this.nameField.name)),
this.contentField.setValue(""),this.contentField.setValue(a.get(this.contentField.name)),this.dirtySelectedSignature=!1)},onNameFieldChange:function(a,b){this.selectedSignature&&this.selectedSignature.get(a.name)!==b&&(this.dirtySelectedSignature=!0)},onEditorFieldChange:function(a,b){this.selectedSignature&&this.selectedSignature.get(a.name)!==this.contentField.getValue()&&(this.dirtySelectedSignature=!0)},hasDirtySignature:function(){return this.selectedSignature?(!0!==this.dirtySelectedSignature&&
(this.onNameFieldChange(this.nameField,this.nameField.getValue()),this.onEditorFieldChange(this.contentField,this.contentField.getValue())),this.dirtySelectedSignature):!1},onValueCorrection:function(a,b,c){this.selectedSignature.data.content=b}});Ext.reg("zarafa.settingssignatureswidget",Zarafa.mail.settings.SettingsSignaturesWidget);Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.ExportAsContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{records:[],model:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.exportascontextmenu",cls:"k-categories",items:[{text:_("EML file(s)"),iconCls:"icon_saveaseml",handler:this.onContextItemEml,scope:this},{text:_("ZIP file"),hideOnDisabled:!1,iconCls:"icon_saveemlaszip",beforeShow:this.onZipMenuItemBeforeShow,handler:this.onContextItemEmlZip,scope:this}]});Zarafa.mail.ui.ExportAsContextMenu.superclass.constructor.call(this,
a)},onZipMenuItemBeforeShow:function(a,b){var c=container.getServerConfig().getMaxEmlFilesInZIP();b.length>c&&(a.setText(a.text+" ( "+_("max. ")+c+" )"),a.disable())},onContextItemEml:function(){Zarafa.common.Actions.openSaveEmlDialog(this.records)},onContextItemEmlZip:function(){Zarafa.common.Actions.openSaveEmlDialog(this.records,!0)}});Ext.reg("zarafa.exportascontextmenu",Zarafa.mail.ui.ExportAsContextMenu);Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailGridColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{useCompactView:!1,constructor:function(a){a=a||{};this.defaultColumns=this.createDefaultColumns();this.compactColumns=this.createCompactColumns();var b=container.populateInsertionPoint("context.mail.griddefaultcolumn",this)||[];this.defaultColumns=this.defaultColumns.concat(b);this.compactColumns=this.compactColumns.concat(b);Ext.applyIf(a,{columns:this.defaultColumns,defaults:{sortable:!0}});!0===a.useCompactView&&(a.columns=
this.compactColumns);Zarafa.mail.ui.MailGridColumnModel.superclass.constructor.call(this,a)},createDefaultColumns:function(){return[{header:'<p class="icon_importance">&nbsp;<span class="title">'+_("Importance")+"</span></p>",headerCls:"zarafa-icon-column importance",dataIndex:"importance",width:24,renderer:Zarafa.common.ui.grid.Renderers.importance,fixed:!0,tooltip:_("Sort by: Importance")},{id:"column_icon",header:'<p class="icon_index">&nbsp;<span class="title">'+_("Icon")+"</span></p>",headerCls:"zarafa-icon-column icon",
dataIndex:"icon_index",width:24,renderer:Zarafa.common.ui.grid.Renderers.icon,fixed:!0,tooltip:_("Sort by: Icon"),preventRowSelection:!0},{header:'<p class="icon_attachment">&nbsp;<span class="title">'+_("Attachment")+"</span></p>",headerCls:"zarafa-icon-column attachment",dataIndex:"hasattach",width:24,renderer:Zarafa.common.ui.grid.Renderers.attachment,fixed:!0,tooltip:_("Sort by: Attachment")},{header:_("From"),dataIndex:"sent_representing_name",width:100,renderer:Zarafa.common.ui.grid.Renderers.sender,
tooltip:_("Sort by: From")},{header:_("To"),dataIndex:"display_to",width:320,renderer:Zarafa.common.ui.grid.Renderers.to,tooltip:_("Sort by: To")},{header:_("Subject"),dataIndex:"subject",width:400,renderer:Zarafa.common.ui.grid.Renderers.subject,tooltip:_("Sort by: Subject")},{header:_("Categories"),dataIndex:"categories",width:160,renderer:Zarafa.common.ui.grid.Renderers.categories,tooltip:_("Sort by: Categories")},{header:_("Received"),dataIndex:"message_delivery_time",width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime.createDelegate(null,
[{css:"mail-received"}],!0),tooltip:_("Sort by: Received"),groupRenderer:this.groupHeaderByDate},{header:_("Sent"),dataIndex:"client_submit_time",width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime.createDelegate(null,[{css:"mail-sent"}],!0),tooltip:_("Sort by: Sent"),groupRenderer:this.groupHeaderByDate},{header:_("Modified"),dataIndex:"last_modification_time",width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime.createDelegate(null,[{css:"mail-modified"}],!0),hidden:!0,tooltip:_("Sort by: Modified"),
groupRenderer:this.groupHeaderByDate},{header:_("Size"),dataIndex:"message_size",width:80,renderer:Zarafa.common.ui.grid.Renderers.size,tooltip:_("Sort by: Size"),groupRenderer:this.groupHeaderBySize},{header:'<p class="icon_flag">&nbsp;<span class="title">'+_("Flag")+"</span></p>",headerCls:"zarafa-icon-column flag",dataIndex:"flag_due_by",width:24,renderer:Zarafa.common.ui.grid.Renderers.flag,fixed:!0,tooltip:_("Sort by: flag")}]},createCompactColumns:function(){return[{header:'<p class="icon_index">&nbsp;<span class="title">'+
_("Icon")+"</span></p>",dataIndex:"icon_index",headerCls:"zarafa-icon-column icon",width:24,renderer:Zarafa.common.ui.grid.Renderers.icon,fixed:!0,tooltip:_("Sort by: Icon"),preventRowSelection:!0},{header:_("From"),dataIndex:"sent_representing_name",width:160,renderer:Zarafa.common.ui.grid.Renderers.sender,tooltip:_("Sort by: From")},{header:_("To"),dataIndex:"display_to",width:160,renderer:Zarafa.common.ui.grid.Renderers.to,tooltip:_("Sort by: To")},{header:_("Received"),dataIndex:"message_delivery_time",
width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime.createDelegate(null,[{css:"mail-received"}],!0),tooltip:_("Sort by: Received"),groupRenderer:this.groupHeaderByDate},{header:_("Sent"),dataIndex:"client_submit_time",width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime.createDelegate(null,[{css:"mail-sent"}],!0),tooltip:_("Sort by: Sent"),groupRenderer:this.groupHeaderByDate},{header:_("Modified"),dataIndex:"last_modification_time",width:160,sortable:!0,renderer:Zarafa.common.ui.grid.Renderers.datetime.createDelegate(null,
[{css:"mail-modified"}],!0),tooltip:_("Sort by: Modified"),groupRenderer:this.groupHeaderByDate},{header:_("Size"),dataIndex:"message_size",width:80,hidden:!0,renderer:Zarafa.common.ui.grid.Renderers.size,tooltip:_("Sort by: Size"),groupRenderer:this.groupHeaderBySize},{header:'<p class="icon_importance">&nbsp;<span class="title">'+_("Importance")+"</span></p>",headerCls:"zarafa-icon-column importance",dataIndex:"importance",width:24,renderer:Zarafa.common.ui.grid.Renderers.importance,fixed:!0,tooltip:_("Sort by: Importance")},
{header:'<p class="icon_attachment">&nbsp;<span class="title">'+_("Attachment")+"</span></p>",headerCls:"zarafa-icon-column attachment",dataIndex:"hasattach",width:24,renderer:Zarafa.common.ui.grid.Renderers.attachment,fixed:!0,tooltip:_("Sort by: Attachment")},{header:'<p class="icon_flag">&nbsp;<span class="title">'+_("Flag")+"</span></p>",headerCls:"zarafa-icon-column flag",dataIndex:"flag_due_by",width:24,renderer:Zarafa.common.ui.grid.Renderers.flag,fixed:!0,tooltip:_("Sort by: flag")}]},setCompactView:function(a){this.useCompactView!==
a&&((this.useCompactView=a)?(this.name="compact",this.defaultColumns=this.config,this.columns=this.compactColumns):(this.name="default",this.compactColumns=this.config,this.columns=this.defaultColumns),this.setConfig(this.columns,!1))},groupHeaderByDate:function(a){if(!Ext.isDate(a))return _("Older");a=a.clone().setToNoon();var b=(new Date).setToNoon();if(a.getTime()===b.getTime())return _("Today");if(a.getTime()===b.add(Date.DAY,-1).getTime())return _("Yesterday");var c=container.getSettingsModel().get("zarafa/v1/main/week_start");
b.getDay()<c?c=b.getPreviousWeekDay(c):(c=-1*(b.getDay()-c),c=b.add(Date.DAY,c));var d=c.add(Date.DAY,6);if(a.between(c,d))return a.format("l");c=c.add(Date.DAY,-7);d=c.add(Date.DAY,7);if(a.between(c,d))return _("Last Week");d=c.add(Date.DAY,-7);if(a.between(d,c))return _("Two Weeks Ago");c=d.add(Date.DAY,-7);if(a.between(c,d))return _("Three Weeks Ago");b=b.add(Date.MONTH,-1).getFirstDateOfMonth();return a.between(b,c)?_("Last Month"):_("Older")},groupHeaderBySize:function(a){return 51200>=a?_("Small")+
" - 50kb":51200<=a&&512E3>=a?_("Medium")+" 50kb - 500kb":512E3<=a&&5242880>=a?_("Large")+" 500kb - 5mb":5242880<=a&&20971520>=a?_("Very large")+" 5mb - 20mb":_("Huge")+" + 20mb"}});Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailGridContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{context:void 0,model:void 0,records:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.model)||(Ext.isDefined(a.context)?a.model=a.context.getModel():a.model=container.getContextByName("mail").getModel());Ext.applyIf(a,{items:[this.createContextActionItems(),{xtype:"menuseparator"},this.createContextExportItems(a),container.populateInsertionPoint("context.mail.contextmenu.actions",this),{xtype:"menuseparator"},
this.createContextOptionsItems(a.records),{xtype:"menuseparator"},container.populateInsertionPoint("context.mail.contextmenu.options",this)]});Zarafa.mail.ui.MailGridContextMenu.superclass.constructor.call(this,a);this.mon(this.model.getStore(),"load",this.onLoad,this)},createContextActionItems:function(){return[{xtype:"zarafa.conditionalitem",text:_("Open"),iconCls:"icon_open",singleSelectOnly:!0,handler:this.onContextItemOpen,scope:this},{xtype:"zarafa.conditionalitem",text:_("Copy/Move"),iconCls:"icon_copy",
hideOnDisabled:!1,handler:this.onCopyMove,scope:this},{xtype:"zarafa.conditionalitem",text:_("Print"),iconCls:"icon_print",singleSelectOnly:!0,handler:this.onContextItemPrint,scope:this},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",text:_("Reply"),iconCls:"icon_replyEmail",beforeShow:this.onMenuItemBeforeShow,singleSelectOnly:!0,responseMode:Zarafa.mail.data.ActionTypes.REPLY,handler:this.onContextItemResponse,scope:this},{xtype:"zarafa.conditionalitem",text:_("Reply All"),iconCls:"icon_replyAllEmail",
singleSelectOnly:!0,beforeShow:this.onMenuItemBeforeShow,responseMode:Zarafa.mail.data.ActionTypes.REPLYALL,handler:this.onContextItemResponse,scope:this},{xtype:"zarafa.conditionalitem",text:_("Forward"),iconCls:"icon_forwardEmail",singleSelectOnly:!0,beforeShow:this.onMenuItemBeforeShow,responseMode:Zarafa.mail.data.ActionTypes.FORWARD,handler:this.onContextItemResponse,scope:this},{xtype:"zarafa.conditionalitem",text:_("Edit as New Message"),iconCls:"icon_editAsNewEmail",singleSelectOnly:!0,beforeShow:this.onMenuItemBeforeShow,
responseMode:Zarafa.mail.data.ActionTypes.EDIT_AS_NEW,handler:this.onContextItemResponse,scope:this}]},createContextOptionsItems:function(a){return[{xtype:"zarafa.conditionalitem",text:_("Mark Read"),iconCls:"icon_mail icon_message_read",beforeShow:function(a,c){this.onReadFlagItemBeforeShow(a,c,!1)},handler:function(){this.onReadFlagItemClicked(!0)},scope:this},{xtype:"zarafa.conditionalitem",text:_("Mark Unread"),iconCls:"icon_mail icon_message_unread",beforeShow:function(a,c){this.onReadFlagItemBeforeShow(a,
c,!0)},handler:function(){this.onReadFlagItemClicked(!1)},scope:this},{xtype:"zarafa.conditionalitem",text:_("Categories"),cls:"k-unclickable",iconCls:"icon_categories",hideOnClick:!1,menu:{xtype:"zarafa.categoriescontextmenu",records:a}},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",text:_("Follow up"),cls:"k-unclickable",iconCls:"icon_mail_flag_red",hideOnClick:!1,menu:{xtype:"zarafa.flagsmenu",records:a},scope:this},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",text:_("Move to Junk Folder"),
iconCls:"icon_junk",beforeShow:this.onMoveToJunkBeforeShow,handler:this.onContextItemJunk,scope:this},{xtype:"zarafa.conditionalitem",text:_("Delete"),iconCls:"icon_delete",handler:this.onContextItemDelete,scope:this},{xtype:"menuseparator"},{xtype:"zarafa.conditionalitem",text:_("Options"),iconCls:"icon_openMessageOptions",beforeShow:this.onMenuItemBeforeShow,singleSelectOnly:!0,handler:this.onContextItemOptions,scope:this}]},createContextExportItems:function(a){return[{xtype:"zarafa.conditionalitem",
text:_("Send to")+"...",iconCls:"icon_embedded_attachment",singleSelectOnly:!0,beforeShow:this.onMenuItemBeforeShow,responseMode:Zarafa.mail.data.ActionTypes.FORWARD_ATTACH,handler:this.onContextItemResponse,scope:this},{xtype:"zarafa.conditionalitem",text:_("Export as"),cls:"k-unclickable",iconCls:"icon_export",hideOnClick:!1,menu:{xtype:"zarafa.exportascontextmenu",records:a.records,model:a.model}}]},onContextItemOpen:function(){Zarafa.common.Actions.openMessageContent(this.records)},onContextItemPrint:function(){Zarafa.common.Actions.openPrintDialog(this.records)},
onContextItemResponse:function(a){Zarafa.mail.Actions.openCreateMailResponseContent(this.records,this.model,a.responseMode)},onMenuItemBeforeShow:function(a,b){Ext.each(b,function(b){if(b.isFaultyMessage())return a.setVisible(!1),!1},this)},onMoveToJunkBeforeShow:function(a,b){if(this.model){var c=this.model.getDefaultFolder();a.setVisible(!c.isSpecialFolder("junk"))}},onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.model.getSelectedRecords())},onReadFlagItemBeforeShow:function(a,
b,c){var d=0;Ext.each(b,function(a){a.isRead()===c&&d++},this);a.setDisabled(0===d)},onReadFlagItemClicked:function(a){Zarafa.common.Actions.markAsRead(this.records,a)},onContextItemJunk:function(){var a=container.getHierarchyStore().getDefaultFolder("junk"),b;Ext.each(this.records,function(c){b=c.store;c.moveTo(a)},this);b.save(this.records)},onContextItemDelete:function(){Zarafa.common.Actions.deleteRecords(this.records)},onContextItemOptions:function(){Zarafa.mail.Actions.openMailOptionsContent(this.records,
{autoSave:!0})},onLoad:function(a,b,c){var d=[];Ext.each(this.records,function(b){(b=a.getById(b.id))?d.push(b):this.destroy()},this);this.records=d}});Ext.reg("zarafa.mailgridcontextmenu",Zarafa.mail.ui.MailGridContextMenu);Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailPanel=Ext.extend(Zarafa.common.ui.ContextMainPanel,{viewPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.mailpanel",layout:"zarafa.switchborder",items:[this.initMailGrid(a),this.initPreviewPanel(a.context)]});Zarafa.mail.ui.MailPanel.superclass.constructor.call(this,a)},initMailGrid:function(a){return{xtype:"panel",layout:"zarafa.collapsible",cls:"zarafa-context-mainpanel",minWidth:200,minHeight:200,region:"center",collapsible:!1,split:!0,items:[{xtype:"zarafa.switchviewcontentcontainer",
ref:"../viewPanel",layout:"card",lazyItems:this.initViews(a.context)}],tbar:{xtype:"zarafa.mailpaneltoolbar",id:"zarafa-main-content-mail-toolbar",defaultTitle:_("Mail"),paging:container.populateInsertionPoint("context.mail.toolbar.paging",this),items:container.populateInsertionPoint("context.mail.toolbar.item",this),context:a.context},listeners:{render:function(a){this.topToolbar=a.getTopToolbar()},scope:this}}},initViews:function(a){var b=[{xtype:"zarafa.mailgrid",flex:1,id:"mail-grid",anchor:"100%",
context:a,ref:"../../mailGrid"}];a=container.populateInsertionPoint("context.mail.views",this,a);return b=b.concat(a)},getGridPanel:function(){return this.mailGrid},initPreviewPanel:function(a){return{xtype:"zarafa.mailpreviewpanel",id:"zarafa-main-content-mail-preview",region:"south",split:!0,context:a}},initEvents:function(){Ext.isDefined(this.context)&&(this.mon(this.context,"viewchange",this.onViewChange,this),this.mon(this.context,"viewmodechange",this.onViewModeChange,this),this.onViewChange(this.context,
this.context.getCurrentView()),this.onViewModeChange(this.context,this.context.getCurrentViewMode()))},onViewChange:function(a,b,c){switch(b){case Zarafa.mail.data.Views.LIST:this.viewPanel.switchView("mail-grid")}},onViewModeChange:function(a,b,c){var d;a=this.getEl();switch(b){case Zarafa.mail.data.ViewModes.NO_PREVIEW:d=Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.OFF;a.removeClass("zarafa-preview-bottom").removeClass("zarafa-preview-right").addClass("zarafa-preview-off");break;case Zarafa.mail.data.ViewModes.RIGHT_PREVIEW:d=
Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.HORIZONTAL;a.removeClass("zarafa-preview-bottom").removeClass("zarafa-preview-off").addClass("zarafa-preview-right");break;case Zarafa.mail.data.ViewModes.BOTTOM_PREVIEW:d=Zarafa.common.ui.layout.SwitchBorderLayout.Orientation.VERTICAL;a.removeClass("zarafa-preview-off").removeClass("zarafa-preview-right").addClass("zarafa-preview-bottom");break;case Zarafa.mail.data.ViewModes.SEARCH:case Zarafa.mail.data.ViewModes.LIVESCROLL:return}b=this.getLayout();
Ext.isFunction(b.setOrientation)?b.setOrientation(d):Ext.isString(b)?this.layoutConfig=Ext.apply(this.layoutConfig||{},{orientation:d}):this.layout.orientation=d}});Ext.reg("zarafa.mailpanel",Zarafa.mail.ui.MailPanel);Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailPanelToolbar=Ext.extend(Zarafa.common.ui.ContextMainPanelToolbar,{constructor:function(a){a=a||{};Zarafa.mail.ui.MailPanelToolbar.superclass.constructor.call(this,a)},onResize:function(a,b,c,d){Zarafa.mail.ui.MailPanelToolbar.superclass.onResize.apply(this,arguments);Ext.isDefined(a)&&this.resizeSearchField()},initComponent:function(){Zarafa.mail.ui.MailPanelToolbar.superclass.initComponent.call(this);container.getSettingsModel().get("zarafa/v1/contexts/mail/enable_live_scroll")?
this.pagesToolbar.setVisible(!1):(this.pagesToolbar.setVisible(!0),this.pagesToolbar.inputItem.setWidth(30),this.pagesToolbar.next.setIconClass("x-tbar-page-next btn-width"),this.pagesToolbar.next.addClass("btn-margin-right"),this.pagesToolbar.prev.setIconClass("x-tbar-page-prev btn-width"),this.pagesToolbar.prev.addClass("btn-margin-right"),this.pagesToolbar.first.setIconClass("x-tbar-page-first btn-width"),this.pagesToolbar.first.addClass("btn-margin-right"),this.pagesToolbar.last.setIconClass("x-tbar-page-last btn-width"),
this.pagesToolbar.last.addClass("btn-margin-right"))},onAfterLayout:Ext.emptyFn,resizeSearchField:function(){var a=this.el.getStyleSize().width,b=0,c,d;this.pagesToolbar.isVisible()?b=this.pagesToolbar.getWidth():this.pagesToolbar.xtbHidden&&(b=this.pagesToolbar.xtbWidth,a>this.searchFieldContainer.getWidth()+b&&(this.layout.unhideItem(this.pagesToolbar),this.doLayout()));this.copyButton.xtbHidden?(c=this.copyButton.xtbWidth,a>this.searchFieldContainer.getWidth()+b+c&&(this.layout.unhideItem(this.copyButton),
this.doLayout())):c=this.copyButton.getWidth();this.deleteButton.xtbHidden?(d=this.deleteButton.xtbWidth,a>this.searchFieldContainer.getWidth()+b+c+d&&(this.layout.unhideItem(this.deleteButton),this.doLayout())):d=this.deleteButton.getWidth();a=a-b-c-d-0;d=this.searchFieldContainer;var b=d.searchTextField,e=d.searchFolderCombo;c=e.getWidth();e=e.getTriggerWidth();d=d.searchBtn.getWidth();b.setWidth(a-(c+d+e))}});Ext.reg("zarafa.mailpaneltoolbar",Zarafa.mail.ui.MailPanelToolbar);Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailPreviewPanel=Ext.extend(Zarafa.core.ui.PreviewPanel,{constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());Ext.applyIf(a,{xtype:"zarafa.mailpreviewpanel",cls:"zarafa-previewpanel zarafa-context-mainpanel",recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{enableOpenLoadTask:!0,autoOpenLoadTaskDefer:250}),width:600,height:400,tbar:{items:[this.createReplyButton(),this.createReplyAllButton(),this.createForwardButton()]}});
Zarafa.mail.ui.MailPreviewPanel.superclass.constructor.call(this,a)},update:function(a,b){this.record&&this.record!==a&&this.record.store&&this.record.store!==a.store&&Zarafa.core.PresenceManager.unregisterStore(this.record.store);a&&a.store&&Zarafa.core.PresenceManager.registerStore(a.store,"sender");this.record&&this.record.subStores&&this.record.subStores.recipients&&Zarafa.core.PresenceManager.unregisterStore(this.record.subStores.recipients);a&&a.subStores&&a.subStores.recipients&&Zarafa.core.PresenceManager.registerStore(a.subStores.recipients);
Zarafa.mail.ui.MailPreviewPanel.superclass.update.apply(this,arguments);if(a){var c=a.isFaultyMessage(),d=this.getTopToolbar();d.replyBtn.setVisible(!c);d.replyAllBtn.setVisible(!c);d.forwardBtn.setVisible(!c)}},createReplyButton:function(){return{xtype:"button",tooltip:_("Reply")+" (Ctrl + R)",overflowText:_("Reply"),iconCls:"icon_replyEmail",ref:"replyBtn",responseMode:Zarafa.mail.data.ActionTypes.REPLY,handler:this.onResponse,scope:this}},createReplyAllButton:function(){return{xtype:"button",tooltip:_("Reply All")+
" (Ctrl + Alt + R)",overflowText:_("Reply All"),iconCls:"icon_replyAllEmail",ref:"replyAllBtn",responseMode:Zarafa.mail.data.ActionTypes.REPLYALL,handler:this.onResponse,scope:this}},createForwardButton:function(){return{xtype:"button",tooltip:_("Forward")+" (Ctrl + F)",overflowText:_("Forward"),iconCls:"icon_forwardEmail",ref:"forwardBtn",responseMode:Zarafa.mail.data.ActionTypes.FORWARD,handler:this.onResponse,scope:this}},onResponse:function(a){Zarafa.mail.Actions.openCreateMailResponseContent(this.record,
this.model,a.responseMode)}});Ext.reg("zarafa.mailpreviewpanel",Zarafa.mail.ui.MailPreviewPanel);Ext.namespace("Zarafa.note");Zarafa.note.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[{key:Ext.EventObject.S,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewNote,scope:this,settingsCfg:{description:_("New note"),category:_("Creating an item")}}];Zarafa.core.KeyMapMgr.register("global",a)},onNewNote:function(a,b,c){Zarafa.note.Actions.openCreateNoteContent(container.getContextByName("note").getModel())}});
Zarafa.note.KeyMapping=new Zarafa.note.KeyMapping;Ext.namespace("Zarafa.note.attachitem");
Zarafa.note.attachitem.AttachNoteColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.getColumns(),defaults:{sortable:!0}});Zarafa.note.attachitem.AttachNoteColumnModel.superclass.constructor.call(this,a)},getColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:"<p class='icon_index'>&nbsp;</p>",tooltip:_("Sort by: Icon"),width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"subject",
header:_("Subject"),tooltip:_("Sort by: Subject"),renderer:Zarafa.common.ui.grid.Renderers.subject}]}});Ext.namespace("Zarafa.note.attachitem");Zarafa.note.attachitem.AttachNoteRenderer=Ext.extend(Zarafa.common.attachment.dialogs.AttachItemBaseRenderer,{generateHTMLTemplate:function(){return""+this.addHTMLRow("categories","{categories:htmlEncode}")+"{body}"},generatePlainTemplate:function(){return""+this.addPlainRow("categories","{categories}")+"{body}"}});Ext.namespace("Zarafa.note.data");
Zarafa.note.data.DataModes=Zarafa.core.Enum.create({ALL:0,LAST_7_DAYS:1,SEARCH:2});Ext.namespace("Zarafa.note.data");Zarafa.note.data.ViewModes=Zarafa.core.Enum.create({NORMAL:0,GROUP_CATEGORY:1,GROUP_COLOR:2,SEARCH:3});Ext.namespace("Zarafa.note.data");Zarafa.note.data.Views=Zarafa.core.Enum.create({LIST:0,ICON:1,SEARCH:2});Ext.namespace("Zarafa.note.ui");
Zarafa.note.ui.NoteContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{records:void 0,constructor:function(a){a=a||{};a.records&&!Array.isArray(a.records)&&(a.records=[a.records]);Ext.applyIf(a,{items:[this.createContextActionItems(a.records),{xtype:"menuseparator"},container.populateInsertionPoint("context.note.contextmenu.actions",this),{xtype:"menuseparator"},container.populateInsertionPoint("context.note.contextmenu.options",this)],defaults:{xtype:"zarafa.conditionalitem",hideOnDisabled:!1}});
Zarafa.note.ui.NoteContextMenu.superclass.constructor.call(this,a)},createContextActionItems:function(a){return[{text:_("Open"),iconCls:"icon_open",scope:this,handler:this.onContextItemOpen,singleSelectOnly:!0},{text:_("Copy/Move"),iconCls:"icon_copy",scope:this,handler:this.onCopyMove},{text:_("Print"),iconCls:"icon_print",scope:this,handler:this.onContextItemPrint,singleSelectOnly:!0},{xtype:"menuseparator"},{text:_("Categories"),cls:"k-unclickable",iconCls:"icon_categories",hideOnClick:!1,menu:{xtype:"zarafa.categoriescontextmenu",
records:a}},{xtype:"menuseparator"},{text:_("Delete"),iconCls:"icon_delete",scope:this,handler:this.onContextItemDelete}]},onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.records)},onContextItemOpen:function(){Zarafa.note.Actions.openNoteContent(this.records)},onContextItemEmail:function(){Zarafa.note.Actions.openNoteEmailContent(this.records)},onContextItemCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.records)},onContextItemPrint:function(){Zarafa.common.Actions.openPrintDialog(this.records)},
onContextItemDelete:function(){var a=this.records[0].getStore();a.remove(this.records);a.save()}});Ext.reg("zarafa.notecontextmenu",Zarafa.note.ui.NoteContextMenu);Ext.namespace("Zarafa.note.ui");
Zarafa.note.ui.NoteGridColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.createColumns(),defaults:{sortable:!0}});Zarafa.note.ui.NoteGridColumnModel.superclass.constructor.call(this,a)},createColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:'<p class="icon_index">&nbsp;</p>',tooltip:_("Sort by: Icon"),width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"subject",header:_("Subject"),
width:400,tooltip:_("Sort by: Subject"),renderer:Zarafa.common.ui.grid.Renderers.subject},{dataIndex:"creation_time",header:_("Created"),tooltip:_("Sort by: Created"),width:160,renderer:Zarafa.common.ui.grid.Renderers.datetime},{dataIndex:"categories",id:"categories",header:_("Categories"),width:160,tooltip:_("Sort by: Categories"),renderer:Zarafa.common.ui.grid.Renderers.categories},{dataIndex:"color",header:_("Color"),width:160,tooltip:_("Sort by: Color"),renderer:Zarafa.common.ui.grid.Renderers.colorTextValue,
hidden:!0}]}});Ext.namespace("Zarafa.note.ui");
Zarafa.note.ui.NoteIconView=Ext.extend(Zarafa.common.ui.DraggableDataView,{context:void 0,model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.icondragselectorplugin");Ext.applyIf(a,{xtype:"zarafa.noteiconview",id:"note-iconview",cls:"zarafa-note-iconview",
loadingText:_("Loading notes")+"...",deferEmptyText:!1,emptyText:'<div class="emptytext">'+_("There are no items to show in this list")+"</div>",overClass:"zarafa-note-iconview-over",tpl:this.initTemplate(),multiSelect:!0,selectedClass:"zarafa-note-iconview-selected",itemSelector:"div.zarafa-note-iconview-thumb",enableDrag:!0,ddGroup:"dd.mapiitem"});Zarafa.note.ui.NoteIconView.superclass.constructor.call(this,a);this.initEvents()},initTemplate:function(){return new Ext.XTemplate('<div style="height: 100%; width: 100%; overflow: auto;">',
'<tpl for=".">','<div class="zarafa-note-iconview-thumb">','<div class="zarafa-note-iconview-icon {icon_index:this.getTheme}"></div>','<div class="zarafa-note-iconview-subject">{subject:this.encodeSubject}</div>',"</div>","</tpl>","</div>",{getTheme:function(a){switch(a){case 768:return"icon_note_blue_large";case 769:return"icon_note_green_large";case 770:return"icon_note_pink_large";case 771:return"icon_note_yellow_large";case 772:return"icon_note_white_large";default:return"icon_note_yellow_large"}},
encodeSubject:function(a){return Ext.util.Format.ellipsis(Ext.util.Format.htmlEncode(a),20)}})},getMainPanel:function(){return this.ownerCt},initEvents:function(){this.on({contextmenu:this.onNoteIconContextMenu,dblclick:this.onIconDblClick,selectionchange:this.onSelectionChange,scope:this})},onNoteIconContextMenu:function(a,b,c,d){a.isSelected(c)||a.select(c);Zarafa.core.data.UIFactory.openDefaultContextMenu(a.getSelectedRecords(),{position:d.getXY()})},onIconDblClick:function(a,b,c,d){Zarafa.note.Actions.openNoteContent(this.getStore().getAt(b))},
onSelectionChange:function(a,b){this.model.setSelectedRecords(a.getSelectedRecords())}});Ext.reg("zarafa.noteiconview",Zarafa.note.ui.NoteIconView);Ext.namespace("Zarafa.note.ui");
Zarafa.note.ui.NoteMainPanel=Ext.extend(Zarafa.common.ui.ContextMainPanel,{viewPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.notemainpanel",layout:"fit",items:[{xtype:"zarafa.switchviewcontentcontainer",ref:"viewPanel",layout:"card",lazyItems:this.initViews(a.context)}],tbar:{xtype:"zarafa.contextmainpaneltoolbar",defaultTitle:_("Notes"),paging:container.populateInsertionPoint("context.note.toolbar.paging",this),items:container.populateInsertionPoint("context.note.toolbar.item",
this),context:a.context}});Zarafa.note.ui.NoteMainPanel.superclass.constructor.call(this,a)},initViews:function(a){var b=[{xtype:"zarafa.noteiconview",id:"note-iconview",context:a},{xtype:"zarafa.notegrid",id:"note-gridview",context:a}];a=container.populateInsertionPoint("context.note.views",this,a);return b=b.concat(a)},initEvents:function(){Ext.isDefined(this.context)&&(this.mon(this.context,"viewchange",this.onViewChange,this),this.onViewChange(this.context,this.context.getCurrentView()))},onViewChange:function(a,
b,c){switch(b){case Zarafa.note.data.Views.ICON:this.viewPanel.switchView("note-iconview");break;case Zarafa.note.data.Views.LIST:case Zarafa.note.data.Views.SEARCH:this.viewPanel.switchView("note-gridview")}}});Ext.reg("zarafa.notemainpanel",Zarafa.note.ui.NoteMainPanel);Ext.namespace("Zarafa.settings");
Zarafa.settings.PersistentSettingsModel=Ext.extend(Zarafa.settings.SettingsModel,{constructor:function(a){a=a||{};Ext.isObject(a.defaults)||(a.defaults=Zarafa.settings.data.PersistentSettingsDefaultValue.getDefaultValues());Zarafa.settings.PersistentSettingsModel.superclass.constructor.call(this,a)},execute:function(a,b){!1!==this.fireEvent("beforesave",this,{action:b})&&container.getRequest().singleRequest(Zarafa.core.ModuleNames.getListName("settings"),a,{persistentSetting:b},new Zarafa.core.data.ProxyResponseHandler({proxy:this,
action:Ext.data.Api.actions.update,options:{action:a,parameters:b},callback:this.onExecuteComplete,scope:this}))}});Ext.namespace("Zarafa.settings.data");Zarafa.settings.data.KeyboardSettings=Zarafa.core.Enum.create({NO_KEYBOARD_SHORTCUTS:"disabled",ALL_KEYBOARD_SHORTCUTS:"full",BASIC_KEYBOARD_SHORTCUTS:"basic"});Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsAccountWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{origLanguage:"",defaultThemeName:_("Basic"),constructor:function(a){a=a||{};for(var b=container.getUser(),c={xtype:"jsonstore",autoDestroy:!0,fields:["lang","name"],data:container.getLanguages()},d=container.populateInsertionPoint("main.maintabbar.left",this),d=Zarafa.core.Util.sortArray(d,"ASC","tabOrderIndex"),e={xtype:"jsonstore",autoDestroy:!0,fields:["context","text"],data:d},d=[[0,this.defaultThemeName,"basic"]],
f=container.getPlugins(),g=0;g<f.length;g++){var h=f[g];h instanceof Zarafa.core.ThemePlugin&&d.push([d.length,h.getDisplayName(),h.getName()])}d=new Ext.data.ArrayStore({fields:["id","displayName","name"],idIndex:0,data:d,sortInfo:{field:"displayName",direction:"ASC"}});Ext.applyIf(a,{title:String.format(_("Account information - {0}"),b.getDisplayName()),layout:"form",items:[{xtype:"displayfield",fieldLabel:_("Display Name"),value:b.getDisplayName(),htmlEncode:!0},{xtype:"displayfield",fieldLabel:_("E-mail"),
value:b.getSMTPAddress(),htmlEncode:!0},{xtype:"zarafa.compositefield",fieldLabel:_("Language"),items:[{xtype:"combo",name:"zarafa/v1/main/language",ref:"../languageCombo",width:200,store:c,mode:"local",triggerAction:"all",displayField:"name",valueField:"lang",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{select:this.onLanguageSelect,scope:this}},{xtype:"displayfield",cls:"zarafa-settings-reload-warning",ref:"../languageWarning"}]},{xtype:"combo",fieldLabel:_("Startup folder"),
name:"zarafa/v1/main/default_context",ref:"startupCombo",width:200,store:e,mode:"local",triggerAction:"all",displayField:"text",valueField:"context",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{select:this.onStartupSelect,scope:this}}]});1<d.data.length&&a.items.push({xtype:"combo",width:200,editable:!1,forceSelection:!0,triggerAction:"all",store:d,fieldLabel:_("Theme"),mode:"local",valueField:"name",displayField:"displayName",ref:"themeCombo",name:"zarafa/v1/main/active_theme",
listeners:{select:this.onThemeSelect,scope:this}});Zarafa.settings.ui.SettingsAccountWidget.superclass.constructor.call(this,a)},onLanguageSelect:function(a,b,c){b=b.get(a.valueField);this.origLanguage!==b?(this.model.requiresReload=!0,this.languageWarning.setValue(_("This change requires a reload of the WebApp"))):this.languageWarning.reset();this.model&&this.model.set(a.name,b)},onStartupSelect:function(a,b,c){b=b.get(a.valueField);this.model&&this.model.set(a.name,b)},onThemeSelect:function(a,
b,c){b=b.get(a.valueField);this.activeTheme!==b&&(this.model.requiresReload=!0);this.model&&this.model.set(a.name,b)},update:function(a){Zarafa.settings.ui.SettingsAccountWidget.superclass.update.apply(this,arguments);this.model=a;this.origLanguage=a.get(this.languageCombo.name);this.languageCombo.setValue(this.origLanguage);this.languageWarning.reset();this.startupCombo.setValue(a.get(this.startupCombo.name));Ext.isDefined(this.themeCombo)&&(this.activeTheme=a.get(this.themeCombo.name),this.activeTheme&&
-1!==this.themeCombo.store.find("name",this.activeTheme)||(this.activeTheme=container.getServerConfig().getActiveTheme()||this.defaultThemeName),this.themeCombo.setValue(this.activeTheme))},updateSettings:function(a){Zarafa.settings.ui.SettingsAccountWidget.superclass.updateSettings.apply(this,arguments);a.beginEdit();a.set(this.languageCombo.name,this.languageCombo.getValue());a.set(this.startupCombo.name,this.startupCombo.getValue());Ext.isDefined(this.themeCombo)&&a.set(this.themeCombo.name,this.themeCombo.getValue());
a.endEdit()}});Ext.reg("zarafa.settingsaccountwidget",Zarafa.settings.ui.SettingsAccountWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsAddressBookWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b=new Ext.XTemplate('<tpl for=".">','<div class="x-combo-list-item<tpl if="group_header"> k-combo-list-item-header</tpl>">',"{depth:indent}{display_name:htmlEncode}","</div>","</tpl>",{compiled:!0});Ext.applyIf(a,{xtype:"zarafa.settingsaddressbookwidget",title:_("Address Book"),layout:"form",items:[{xtype:"combo",fieldLabel:_("Select Default Folder"),name:"zarafa/v1/main/default_addressbook",
ref:"defaultABCombo",width:200,store:Zarafa.addressbook.AddressBookHierarchyStore,mode:"local",triggerAction:"all",displayField:"display_name",valueField:"entryid",tpl:b,lazyInit:!1,forceSelection:!0,editable:!1,listeners:{beforeselect:this.onBeforeDefaultABSelect,select:this.onDefaultABSelect,scope:this}}]});Zarafa.settings.ui.SettingsAddressBookWidget.superclass.constructor.call(this,a)},onBeforeDefaultABSelect:function(a,b,c){return!b.get("group_header")},onDefaultABSelect:function(a,b,c){b=b.get(a.valueField);
this.model&&this.model.set(a.name,b)},update:function(a){Zarafa.settings.ui.SettingsAddressBookWidget.superclass.update.apply(this,arguments);this.model=a;if(0!==Zarafa.addressbook.AddressBookHierarchyStore.getCount()){var b=this.defaultABCombo,c=this.model.get(b.name),d;Ext.isEmpty(c)||(d=Zarafa.addressbook.AddressBookHierarchyStore.getById(c));Ext.isEmpty(d)&&(d=Zarafa.addressbook.AddressBookHierarchyStore.getAt(0));b.setValue(d.get(b.valueField))}},updateSettings:function(a){Zarafa.settings.ui.SettingsAddressBookWidget.superclass.updateSettings.apply(this,
arguments);a.set(this.defaultABCombo.name,this.defaultABCombo.getValue())}});Ext.reg("zarafa.settingsaddressbookwidget",Zarafa.settings.ui.SettingsAddressBookWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsAdvancedCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Advanced"),categoryIndex:9999,iconCls:"zarafa-settings-category-advanced",layout:"fit",autoScroll:!1,items:[{xtype:"zarafa.settingswidget",title:_("Advanced settings"),layout:"fit",items:[{xtype:"zarafa.settingstreepanel",ref:"../treePanel"}]}]});Zarafa.settings.ui.SettingsAdvancedCategory.superclass.constructor.call(this,a)},update:function(a){Zarafa.settings.ui.SettingsAdvancedCategory.superclass.update.apply(this,
arguments);this.treePanel.bindModel(a)}});Ext.reg("zarafa.settingsadvancedcategory",Zarafa.settings.ui.SettingsAdvancedCategory);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{settingsModel:void 0,constructor:function(a){a=a||{};var b=!1,c=!1;a.records&&(Array.isArray(a.records)&&(a.records=a.records[0]),b=Ext.isDefined(a.records.isRoot)&&a.records.isRoot,c=a.records.isEditable());Ext.applyIf(a,{settingsModel:container.getSettingsModel(),items:[{xtype:"zarafa.conditionalitem",text:_("Edit setting"),hidden:b||!c,handler:this.onEditSetting,scope:this},{xtype:"zarafa.conditionalitem",text:_("Restore to defaults"),
hidden:b,handler:this.onRestoreSettings,scope:this},{xtype:"zarafa.conditionalitem",text:_("Delete settings"),hidden:b,handler:this.onDeleteSettings,scope:this},{xtype:"menuseparator"},container.populateInsertionPoint("context.settings.tree.contextmenu.actions",this)]});Zarafa.settings.ui.SettingsContextMenu.superclass.constructor.call(this,a)},onEditSetting:function(){this.records.startEdit()},onRestoreSettings:function(){this.settingsModel.restore(this.records.id)},onDeleteSettings:function(){this.settingsModel.remove(this.records.id)}});
Ext.reg("zarafa.settingscontextmenu",Zarafa.settings.ui.SettingsContextMenu);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsCopyrightCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("About"),categoryIndex:1E4,iconCls:"zarafa-settings-category-copyright",items:[{xtype:"zarafa.settingscopyrightwidget",about:Zarafa.ABOUT},container.populateInsertionPoint("context.settings.category.copyright",this)]});Zarafa.settings.ui.SettingsCopyrightCategory.superclass.constructor.call(this,a)}});Ext.reg("zarafa.settingscopyrightcategory",Zarafa.settings.ui.SettingsCopyrightCategory);
Ext.namespace("Zarafa.settings.ui");Zarafa.settings.ui.SettingsCopyrightWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{about:Zarafa.ABOUT,constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Kopano WebApp"),layout:"form",items:[{xtype:"displayfield",cls:"zarafa-settings-about-text",value:a.about||this.about,hideLabel:!0,htmlEncode:!1}]});Zarafa.settings.ui.SettingsCopyrightWidget.superclass.constructor.call(this,a)}});Ext.reg("zarafa.settingscopyrightwidget",Zarafa.settings.ui.SettingsCopyrightWidget);
Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsDisplayWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{settingsModel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.settingsdisplaywidget",title:_("Display"),layout:"form",items:[{xtype:"displayfield",hideLabel:!0,value:_("I want to display date and time in this format:")},{xtype:"radiogroup",name:"zarafa/v1/main/datetime_display_format",ref:"datetimeDisplayFormat",hideLabel:!0,columns:1,items:[{xtype:"radio",inputValue:"short",name:"datetimeDisplayFormat",
boxLabel:_("Short")+'<span class="k-settings-label-minor">('+(new Date).format(_("D G:i"))+")</span>"},{xtype:"radio",name:"datetimeDisplayFormat",inputValue:"long",boxLabel:_("Long")+'<span class="k-settings-label-minor">('+(new Date).format(_("l d/m/Y G:i"))+")</span>"}],listeners:{change:this.onRadioChange,scope:this}}]});Zarafa.settings.ui.SettingsDisplayWidget.superclass.constructor.call(this,a)},update:function(a){this.model=a;this.datetimeDisplayFormat.setValue(a.get(this.datetimeDisplayFormat.name))},
updateSettings:function(a){var b=this.datetimeDisplayFormat.getValue().inputValue;a.set(this.datetimeDisplayFormat.name,b)},onRadioChange:function(a,b){this.model&&this.model.get(a.name)!==b.inputValue&&this.model.set(a.name,b.inputValue)}});Ext.reg("zarafa.settingsdisplaywidget",Zarafa.settings.ui.SettingsDisplayWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsGeneralCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("General"),categoryIndex:0,iconCls:"zarafa-settings-category-general",items:[{xtype:"zarafa.settingsaccountwidget"},{xtype:"zarafa.settingsinboxnavigationwidget"},{xtype:"zarafa.settingsdisplaywidget"},{xtype:"zarafa.settingsaddressbookwidget"},{xtype:"zarafa.settingsquotainfowidget"},{xtype:"zarafa.settingsresetsettingswidget",settingsContext:a.settingsContext},
{xtype:"zarafa.settingsversionwidget"},container.populateInsertionPoint("context.settings.category.general",this)]});Zarafa.settings.ui.SettingsGeneralCategory.superclass.constructor.call(this,a)}});Ext.reg("zarafa.settingsgeneralcategory",Zarafa.settings.ui.SettingsGeneralCategory);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsInboxNavigationWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.settingsinboxnavigationwidget",title:_("Inbox navigation"),layout:"form",items:[{xtype:"displayfield",hideLabel:!0,value:_("I want to navigate through my items by using.")},{xtype:"radiogroup",name:"zarafa/v1/contexts/mail/enable_live_scroll",ref:"liveScroll",hideLabel:!0,columns:1,style:{marginBottom:"10px"},items:[{xtype:"radio",name:"enablescroll",
inputValue:"true",boxLabel:_("Infinite Scroll")+'<span class="k-settings-label-minor">('+_("WebApp automatically loads additional items when you scroll down")+")</span>"},{xtype:"radio",name:"enablescroll",inputValue:"false",boxLabel:_("Pagination")+'<span class="k-settings-label-minor">('+_("WebApp displays items on pages and you can use navigation controls to navigate")+")</span>"}],listeners:{change:this.onRadioChange,scope:this}},this.createPageSizeField()]});Zarafa.settings.ui.SettingsInboxNavigationWidget.superclass.constructor.call(this,
a)},createPageSizeField:function(){var a=(Ext.isDefined(this.liveScroll)?"true"===this.liveScroll.getValue().getRawValue():1)?_("Load items in blocks of {A}"):_("Load {A} items per page.");return new Zarafa.common.ui.CompositeField({xtype:"zarafa.compositefield",plugins:["zarafa.splitfieldlabeler"],ref:"pageSizeContainer",fieldLabel:a,items:[{labelSplitter:"{A}",xtype:"combo",name:"zarafa/v1/main/page_size",ref:"pageSize",width:55,hideLabel:!0,store:{xtype:"jsonstore",autoDestroy:!0,fields:["size"],
data:[{size:50},{size:100},{size:150},{size:200}]},mode:"local",triggerAction:"all",displayField:"size",valueField:"size",lazyInit:!1,forceSelection:!0,editable:!1,autoSelect:!0,listeners:{select:this.onPageSizeSelect,scope:this}}]})},update:function(a){this.model=a;this.liveScroll.setValue(a.get(this.liveScroll.name));this.pageSizeContainer.pageSize.setValue(a.get(this.pageSizeContainer.pageSize.name))},updateSettings:function(a){var b="true"===this.liveScroll.getValue().inputValue;a.beginEdit();
a.set(this.liveScroll.name,b);a.set(this.pageSizeContainer.pageSize.name,this.pageSizeContainer.pageSize.getValue());a.endEdit()},onRadioChange:function(a,b){var c="true"===b.inputValue,d=this.pageSizeContainer.pageSize.getValue();this.pageSizeContainer.destroy();this.pageSizeContainer=this.createPageSizeField();this.pageSizeContainer.pageSize.setValue(d);this.add(this.pageSizeContainer);this.doLayout();this.model&&this.model.get(a.name)!==c&&this.model.set(a.name,c)},onPageSizeSelect:function(a,
b){this.model&&this.model.get(a.name)!==a.getValue()&&this.model.set(a.name,a.getValue())}});Ext.reg("zarafa.settingsinboxnavigationwidget",Zarafa.settings.ui.SettingsInboxNavigationWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsKeyShortcutCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Keyboard Shortcuts"),categoryIndex:9998,iconCls:"zarafa-settings-category-keyshortcut",items:this.generateWidgets(a)});Zarafa.settings.ui.SettingsKeyShortcutCategory.superclass.constructor.call(this,a)},getShortcutDescription:function(){var a={};Ext.iterate(Zarafa.core.KeyMapMgr.keys,function(b,c){for(var d=0,e=c.length;d<e;d++){var f=this.getKeyCombination(c[d]),
g=c[d].settingsCfg;if(!Ext.isEmpty(f)&&Ext.isDefined(g)){var h=g.category;Ext.isObject(a[h])||(a[h]={});a[h][f]={shortcutDesc:g.description,fieldLabel:f,basicShortcut:Ext.isDefined(c[d].basic)}}}},this);return a},generateWidgets:function(a){var b=this.getShortcutDescription(),c=[{xtype:"zarafa.settingskeyshortcutwidget",settingsContext:a.settingsContext}];Ext.iterate(b,function(a,e){c.push({xtype:"zarafa.settingswidget",title:a,layout:"form",itemCls:"zarafa-settings-keyboard-shortcut-row",items:this.generateRows(b[a]),
labelSeparator:""})},this);return c},generateRows:function(a){var b=[];Ext.iterate(a,function(a,d){b.push({xtype:"displayfield",fieldLabel:d.fieldLabel,html:this.generateDisplayValue(d)})},this);return b},generateDisplayValue:function(a){a.basicShortcut?(a='<span class="keyboard-desc" style="width: 300px"> '+a.shortcutDesc+"</span>",a+='<span class="keyboard-type" title="'+_("Part of basic keyboard shortcuts")+'">'+_("Basic")+"</span>"):a='<span class="keyboard-desc"> '+a.shortcutDesc+"</span>";return a},
getKeyCombination:function(a){var b=[];a.ctrl&&b.push(Ext.isMac?"CMD":"CTRL");a.alt&&b.push("ALT");a.shift&&b.push("SHIFT");var c=a.key;return Ext.isEmpty(c)?"":(Array.isArray(c)?c[0]===Ext.EventObject.LEFT&&c[1]===Ext.EventObject.RIGHT?b.push("ARROW KEYS"):b.push(a.ctrl&&a.alt?"1...9":"0...9"):c===Ext.EventObject.F5?b.push("F5"):c===Ext.EventObject.ENTER?b.push("ENTER"):c===Ext.EventObject.HOME?b.push("HOME"):c===Ext.EventObject.END?b.push("END"):c===Ext.EventObject.DELETE?(Ext.isMac&&b.push("FN"),
b.push("DELETE")):Ext.isNumber(c)?b.push(String.fromCharCode(c)):b.push(c),b.join(" + "))}});Ext.reg("zarafa.settingskeyshortcutcategory",Zarafa.settings.ui.SettingsKeyShortcutCategory);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsKeyShortcutWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Keyboard Shortcuts"),layout:"form",items:[{xtype:"zarafa.compositefield",hideLabel:!0,height:60,items:[{xtype:"radiogroup",ref:"../keyShortcutGroup",columns:1,hideLabel:!0,name:"zarafa/v1/main/keycontrols",items:[{xtype:"radio",boxLabel:_("Keyboard shortcuts off"),name:"keyboardshortcut",inputValue:Zarafa.settings.data.KeyboardSettings.NO_KEYBOARD_SHORTCUTS},
{xtype:"radio",boxLabel:_("Basic keyboard shortcuts on"),name:"keyboardshortcut",inputValue:Zarafa.settings.data.KeyboardSettings.BASIC_KEYBOARD_SHORTCUTS},{xtype:"radio",boxLabel:_("All keyboard shortcuts on"),name:"keyboardshortcut",inputValue:Zarafa.settings.data.KeyboardSettings.ALL_KEYBOARD_SHORTCUTS}],listeners:{change:this.enableKeyboardShortcuts,scope:this},flex:1},{xtype:"displayfield",hideLabel:!0,height:20,ref:"../keyShortcutWarning",flex:2}]}]});Zarafa.settings.ui.SettingsKeyShortcutWidget.superclass.constructor.call(this,
a)},initEvents:function(){Zarafa.settings.ui.SettingsKeyShortcutWidget.superclass.initEvents.call(this);var a=this.settingsContext.getModel();this.mon(a,"savesettings",this.onSaveSettings,this)},onSaveSettings:function(a,b){var c=!1,d=b.modified;if(!Ext.isEmpty(d))for(var e=0;e<d.length;e++)if(d[e].path===this.keyShortcutGroup.name){c=!0;break}!0===c&&(b.get(this.keyShortcutGroup.name)!==Zarafa.settings.data.KeyboardSettings.NO_KEYBOARD_SHORTCUTS?Zarafa.core.KeyMapMgr.enableAllKeymaps():Zarafa.core.KeyMapMgr.disableAllKeymaps())},
update:function(a){this.model=a;this.keyShortcutGroup.setValue(a.get(this.keyShortcutGroup.name));this.keyShortcutWarning.reset()},updateSettings:function(a){a.set(this.keyShortcutGroup.name,this.keyShortcutGroup.getValue().inputValue)},enableKeyboardShortcuts:function(a,b){this.model.get(a.name)!==b.inputValue&&this.model.set(a.name,b.inputValue);Ext.isEmpty(this.model.modified)?this.keyShortcutWarning.reset():(this.keyShortcutWarning.setValue(_("This change requires a reload of the WebApp")),this.model.requiresReload=
!0)}});Ext.reg("zarafa.settingskeyshortcutwidget",Zarafa.settings.ui.SettingsKeyShortcutWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsMainPanel=Ext.extend(Zarafa.common.ui.ContextMainPanel,{constructor:function(a){a=a||{};Ext.apply(a,{iconCls:"zarafa-settings-category-general"});for(var b=container.populateInsertionPoint("context.settings.categories",this,a.context),c=[],d=0,e=b.length;d<e;d++){var f=Ext.create(b[d]);c.push({xtype:"zarafa.settingscategorytab",title:f.title,categoryIndex:f.categoryIndex,iconCls:f.iconCls,hidden:f.hidden,context:a.context,category:f});b[d]=f}c=Zarafa.core.Util.sortArray(c,
"ASC","categoryIndex");b=Zarafa.core.Util.sortArray(b,"ASC","categoryIndex");Ext.applyIf(a,{cls:"zarafa-setting-mainpanel",header:!1,layout:{type:"hbox",align:"stretch"},items:[{xtype:"zarafa.settingscategorypanel",width:200,context:a.context,autoScroll:!0,items:c},{xtype:"container",flex:1,layout:{type:"vbox",align:"stretch"},items:[{xtype:"container",flex:1,layout:{type:"fit",align:"stretch"},items:[{xtype:"zarafa.settingscategorywidgetpanel",context:a.context,items:b}]},{xtype:"container",height:50,
layout:{type:"fit",align:"stretch"},items:[{xtype:"container",cls:"x-panel-btns",layout:"fit",items:[{xtype:"toolbar",toolbarCls:"x-panel-footer",buttonAlign:"right",items:[{xtype:"button",cls:"zarafa-action",text:_("Apply"),handler:this.onApply,scope:this},{xtype:"button",text:_("Discard"),handler:this.onDiscard,scope:this}]}]}]}]}]});Zarafa.settings.ui.SettingsMainPanel.superclass.constructor.call(this,a)},onApply:function(){this.context&&this.context.getModel().applyChanges()},onDiscard:function(){this.context&&
this.context.getModel().discardChanges()}});Ext.reg("zarafa.settingsmainpanel",Zarafa.settings.ui.SettingsMainPanel);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsPluginsCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Plugins"),categoryIndex:9998,iconCls:"zarafa-settings-category-plugins",autoScroll:!1,layout:{type:"vbox",align:"stretch",pack:"start"},items:[{xtype:"zarafa.settingspluginswidget",settingsContext:a.settingsContext,flex:1},container.populateInsertionPoint("context.settings.category.plugins",this)]});Zarafa.settings.ui.SettingsPluginsCategory.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.settingspluginscategory",Zarafa.settings.ui.SettingsPluginsCategory);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsPluginsWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};for(var b=new Ext.data.ArrayStore({fields:[{name:"name"},{name:"display_name"},{name:"version"},{name:"enabled",type:"boolean"},{name:"allow_disable",type:"boolean"},{name:"settings_base"}]}),c=container.getPluginsMetaData(),d=container.getServerConfig().getPluginsVersion(),e,f=0,g=c.length;f<g;f++){var h=c[f];h.isPrivate()||(e=Ext.isEmpty(d[h.getName()])?_("Unknown"):d[h.getName()],
b.add(new Ext.data.Record({name:h.getName(),display_name:h.getDisplayName(),version:e,enabled:h.isEnabled(),allow_disable:h.allowUserDisable,settings_base:h.getSettingsBase()})))}b.sort("display_name","ASC");c=new Ext.grid.CheckboxSelectionModel({checkOnly:!0,header:"&#160;",renderer:this.onEnabledRenderer,onKeyPress:Ext.emptyFn,listeners:{rowselect:this.onRowSelect,rowdeselect:this.onRowDeselect,scope:this}});Ext.applyIf(a,{title:_("Available plugins"),layout:"fit",items:[{xtype:"panel",border:!1,
cls:"zarafa-settings-pluginavailable",ref:"pluginsPanel",layout:{type:"vbox",align:"stretch",pack:"start"},items:[{xtype:"displayfield",value:_("The following plugins are available in the WebApp. It is possible to select and/or deselect different plugins to indicate which plugins should be enabled. When any plugin is enabled or disabled, the WebApp must be reloaded in order for the changes to take effect."),fieldClass:"zarafa-settings-widget-extrainfo",ref:"extrainfo",height:50},{xtype:"grid",border:!0,
flex:1,enableHdMenu:!1,deferRowRender:!1,autoExpandColumn:"display_name",cls:"k-settings-plugingrid",ref:"../pluginsGrid",viewConfig:{forceFit:!0,emptyText:"<div class='emptytext'>"+_("No plugins available")+"</div>"},store:b,columns:[c,{id:"display_name",header:_("Display Name"),dataIndex:"display_name",sortable:!1,renderer:this.onDisplayNameRenderer},{id:"display_name",header:_("Version"),dataIndex:"version",sortable:!1}],selModel:c}],listeners:{scope:this,resize:this.onResizePluginsPanel}}]});
Zarafa.settings.ui.SettingsCopyrightWidget.superclass.constructor.call(this,a);this.pluginsGrid.on("rowclick",this.onRowClick,this)},onResizePluginsPanel:function(a){var b=a.extrainfo.getEl();b.setHeight("auto");b=b.getHeight();a.extrainfo.setHeight(b);a.extrainfo.height=b;a.doLayout()},onRowClick:function(a,b,c){a.getView().focusRow(b);c=a.getSelectionModel();a=a.getStore().getAt(b);a.get("allow_disable")&&(a.get("enabled")?c.deselectRow(b):c.selectRow(b,!0))},update:function(a){this.model=a;var b=
this.pluginsGrid.getSelectionModel(),c=[];this.pluginsGrid.getStore().each(function(b){b.get("allow_disable")&&b.set("enabled",a.get(b.get("settings_base")+"/enable"));b.get("enabled")&&c.push(b)});b.suspendEvents(!1);b.selectRecords(c);b.resumeEvents()},updateSettings:function(a){var b=this.pluginsGrid.getStore();a.beginEdit();b.each(function(b){b.get("allow_disable")&&a.set(b.get("settings_base")+"/enable",b.get("enabled"))});a.endEdit()},onDisplayNameRenderer:function(a,b,c){a=Ext.util.Format.htmlEncode(a);
c.get("allow_disable")||(b.css+=" zarafa-settings-pluginavailable-fixed",a=!0===c.get("enabled")?a+(" <span>"+_("This plugin cannot be disabled")+"</span>"):a+(" <span>"+_("This plugin cannot be enabled")+"</span>"));return a},onEnabledRenderer:function(a,b,c){if(c.get("allow_disable"))return Ext.grid.CheckboxSelectionModel.prototype.renderer.apply(this,arguments);b.css+=" zarafa-settings-pluginavailable-fixed";return""},onRowSelect:function(a,b,c){c.set("enabled",!0);this.model.set(c.get("settings_base")+
"/enable",!0);this.model.requiresReload=!0},onRowDeselect:function(a,b,c){c.set("enabled",!1);this.model.set(c.get("settings_base")+"/enable",!1);this.model.requiresReload=!0}});Ext.reg("zarafa.settingspluginswidget",Zarafa.settings.ui.SettingsPluginsWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsQuotaInfoWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.settingswidget",title:_("Mailbox Usage"),layout:"form",items:[{xtype:"zarafa.quotabar",width:400,hidden:!0,ref:"quotaBar",userStore:container.getHierarchyStore().getDefaultStore()},{xtype:"displayfield",width:400,hideLabel:!0,ref:"unavailableQuotaInfo",hidden:!0,value:_("Quota information is not set on the user's store.")},{xtype:"displayfield",hideLabel:!0,
width:400,ref:"quotaInfo"}]});Zarafa.settings.ui.SettingsQuotaInfoWidget.superclass.constructor.call(this,a);this.on("afterrender",this.updateQuotaInfo,this);this.mon(container.getHierarchyStore(),"update",this.onUpdateHierarchyStore,this)},updateQuotaInfo:function(){var a=container.getHierarchyStore().getDefaultStore(),b=a.get("store_size"),c=a.get("quota_soft"),d=a.get("quota_hard"),a=a.get("quota_warning"),e=String.format(_("{0} of mailbox space is used."),Ext.util.Format.fileSize(1024*b)),f='<span class="zarafa-quota-string">'+
e+"</span>";c||d||a?(this.quotaBar.setVisible(!0),this.unavailableQuotaInfo.setVisible(!1),e=this.getQuotaSuggestionString(c,d,b),Ext.isEmpty(e)||(f+=" "+e)):(this.quotaBar.setVisible(!1),this.unavailableQuotaInfo.setVisible(!0));this.quotaInfo.setValue(f)},getQuotaSuggestionString:function(a,b,c){if(Ext.isDefined(c)){b&&a>=b&&(a=null);if(b&&c>b)return _("You have exceeded hard quota, you can not send or recieve mails.");if(a&&c<a)return String.format(_("At {0} you won't be able to send mails."),
Ext.util.Format.fileSize(1024*a));if(a&&b&&a<c&&c<b)return String.format(_("You can not send mails as you have exceeded soft quota, at {0} you won't be able to recieve mails."),Ext.util.Format.fileSize(1024*b));if(!a&&b&&c<b)return String.format(_("At {0} you won't be able to send or recieve mails."),Ext.util.Format.fileSize(1024*b));if(a&&!b&&a<c)return _("You can not send mails as you have exceeded soft quota.")}},onUpdateHierarchyStore:function(a,b,c){b.isDefaultStore()&&this.updateQuotaInfo()}});
Ext.reg("zarafa.settingsquotainfowidget",Zarafa.settings.ui.SettingsQuotaInfoWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsResetSettingsWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{loadMask:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{title:_("Reset WebApp settings"),layout:"column",items:[{xtype:"displayfield",columnWidth:1,hideLabel:!0,value:_("Resets WebApp's settings to their original defaults")},{xtype:"button",text:_("Reset WebApp settings"),columnWidth:1,autoWidth:!0,handler:this.onResetSettings,scope:this}]});Zarafa.settings.ui.SettingsResetSettingsWidget.superclass.constructor.call(this,
a)},onResetSettings:function(){var a=_("Your WebApp settings will be restored to their default condition. Are you sure you want to reset all WebApp settings?"),a=a+"<br/><br/>"+_("WebApp will automatically restart in order for these changes to take effect"),a=a+"<br/>";Zarafa.common.dialogs.MessageBox.addCustomButtons({title:_("Reset WebApp settings"),msg:a,icon:Ext.MessageBox.QUESTION,fn:this.resetDefaultSettings,customButton:[{text:_("Reset"),name:"reset"},{text:_("Cancel"),name:"cancel"}],scope:this})},
resetDefaultSettings:function(a){"reset"===a&&(a=this.settingsContext.getModel().getRealSettingsModel(),a.reset("zarafa/v1"),a.save(),this.loadMask=new Zarafa.common.ui.LoadMask(Ext.getBody(),{msg:"<b>"+_("Webapp is reloading, Please wait.")+"</b>"}),this.loadMask.show(),this.mon(a,"save",this.onSettingsSave,this),this.mon(a,"exception",this.onSettingsException,this))},onSettingsSave:function(a,b){b.action===Zarafa.core.Actions.reset&&(this.mun(a,"save",this.onSettingsSave,this),this.mun(a,"exception",
this.onSettingsException,this),Zarafa.core.Util.reloadWebapp())},onSettingsException:function(a,b,c,d,e){d.action===Zarafa.core.Actions.reset&&(this.loadMask.hide(),this.mun(a,"save",this.onSettingsSave,this),this.mun(a,"exception",this.onSettingsException,this))}});Ext.reg("zarafa.settingsresetsettingswidget",Zarafa.settings.ui.SettingsResetSettingsWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsVersionWidget=Ext.extend(Zarafa.settings.ui.SettingsWidget,{constructor:function(a){a=a||{};var b=container.getVersion();Ext.applyIf(a,{title:_("Version information"),layout:"form",defaults:{xtype:"displayfield",htmlEncode:!0},items:[{fieldLabel:_("WebApp"),value:b.getWebApp()+(Ext.isEmpty(b.getGit())?"":"-"+b.getGit())},{fieldLabel:_("Kopano Core"),value:b.getZCP()},container.populateInsertionPoint("settings.versioninformation")]});Zarafa.settings.ui.SettingsVersionWidget.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.settingsversionwidget",Zarafa.settings.ui.SettingsVersionWidget);Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsWelcomeCategory=Ext.extend(Zarafa.settings.ui.SettingsCategory,{constructor:function(a){a=a||{};Ext.applyIf(a,{categoryIndex:0,iconCls:"zarafa-settings-category-welcome",defaults:{cls:"zarafa-settings-widget-welcome"},items:[{xtype:"zarafa.settingsaccountwidget"},{xtype:"zarafa.settingscalendarwidget"},container.populateInsertionPoint("context.settings.category.welcome",this)]});Zarafa.settings.ui.SettingsWelcomeCategory.superclass.constructor.call(this,a)},onRender:function(){Zarafa.settings.ui.SettingsWelcomeCategory.superclass.onRender.apply(this,
arguments);var a=this.find("name","zarafa/v1/contexts/calendar/datepicker_show_busy");Ext.isEmpty(a)||a[0].hide()}});Ext.reg("zarafa.settingswelcomecategory",Zarafa.settings.ui.SettingsWelcomeCategory);Ext.namespace("Zarafa.task");
Zarafa.task.KeyMapping=Ext.extend(Object,{constructor:function(){var a=[{key:Ext.EventObject.K,ctrl:!0,alt:!0,shift:!1,stopEvent:!0,handler:this.onNewTask,scope:this,settingsCfg:{description:_("New task"),category:_("Creating an item")}}];Zarafa.core.KeyMapMgr.register("global",a)},onNewTask:function(a,b,c){Zarafa.task.Actions.openCreateTaskContent(container.getContextByName("task").getModel())}});Zarafa.task.KeyMapping=new Zarafa.task.KeyMapping;Ext.namespace("Zarafa.task.attachitem");
Zarafa.task.attachitem.AttachTaskColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{columns:this.getColumns(),defaults:{sortable:!0}});Zarafa.task.attachitem.AttachTaskColumnModel.superclass.constructor.call(this,a)},getColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column",header:"<p class='icon_index'>&nbsp;</p>",width:24,fixed:!0,tooltip:_("Sort by: Icon"),renderer:Zarafa.common.ui.grid.Renderers.icon},{dataIndex:"importance",
headerCls:"zarafa-icon-column",header:"<p class='icon_importance'>&nbsp;</p>",width:24,fixed:!0,tooltip:_("Sort by: Priority"),renderer:Zarafa.common.ui.grid.Renderers.importance},{header:"<p class='icon_attachment'>&nbsp;</p>",headerCls:"zarafa-icon-column",dataIndex:"hasattach",width:24,fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.attachment,tooltip:_("Sort by: Attachment")},{dataIndex:"subject",header:_("Subject"),tooltip:_("Sort by: Subject"),renderer:Zarafa.common.ui.grid.Renderers.subject},
{header:_("Status"),dataIndex:"status",width:160,renderer:Zarafa.common.ui.grid.Renderers.taskstatus,tooltip:_("Sort by: Status")},{dataIndex:"duedate",header:_("Due Date"),tooltip:_("Sort by: Due Date"),renderer:Zarafa.common.ui.grid.Renderers.utcdate},{dataIndex:"percent_complete",header:_("% Completed"),width:75,tooltip:_("Sort by: Percent Completed"),renderer:Zarafa.common.ui.grid.Renderers.percentage},{dataIndex:"categories",header:_("Categories"),tooltip:_("Sort by: Categories"),renderer:Zarafa.common.ui.grid.Renderers.text}]}});
Ext.namespace("Zarafa.task.attachitem");
Zarafa.task.attachitem.AttachTaskRenderer=Ext.extend(Zarafa.common.attachment.dialogs.AttachItemBaseRenderer,{constructor:function(a){Zarafa.task.attachitem.AttachTaskRenderer.superclass.constructor.call(this,a);Ext.apply(this.labels,{startdate:_("Start Date"),duedate:_("Due Date"),status:_("Task Status"),percent_complete:_("Percent Complete"),totalwork:_("Total Work"),actualwork:_("Actual Work"),owner:_("Owner"),companies:_("Companies"),billinginformation:_("Billing Information"),mileage:_("Mileage")})},
generateHTMLTemplate:function(){var a;a=""+this.addHTMLRowGroup({subject:"{subject:htmlEncode}",startdate:'{startdate:date("'+_("l jS F Y G:i")+'")}',duedate:'{duedate:date("'+_("l jS F Y G:i")+'")}',importance:"{importance:importanceString}",sensitivity:"{sensitivity:sensitivityString}"});a+=this.addHTMLRowGroup({status:"{status:taskStatusString}",percent_complete:"{percent_complete:percentage}",datecompleted:'{datecompleted:date("'+_("l jS F Y G:i")+'")}'});a+=this.addHTMLRowGroup({totalwork:"{totalwork:duration}",
actualwork:"{actualwork:duration}",owner:"{owner:htmlEncode}",categories:"{categories:htmlEncode}",companies:"{companies:htmlEncode}",billinginformation:"{billinginformation:htmlEncode}",mileage:"{mileage:htmlEncode}"});a+=this.addHTMLRowGroup({categories:"{categories:htmlEncode}",companies:"{companies:htmlEncode}",billinginformation:"{billinginformation:htmlEncode}",mileage:"{mileage:htmlEncode}"});a+=this.addHTMLRow("attachment_names","{attachment_names:htmlEncode}");return a+"{body}"},generatePlainTemplate:function(){var a;
a=""+this.addPlainRowGroup({subject:"{subject}",startdate:'{startdate:date("'+_("l jS F Y G:i")+'")}',duedate:'{duedate:date("'+_("l jS F Y G:i")+'")}',importance:"{importance:importanceString}",sensitivity:"{sensitivity:sensitivityString}"});a+=this.addPlainRowGroup({status:"{status:taskStatusString}",percent_complete:"{percent_complete:percentage}",datecompleted:'{datecompleted:date("'+_("l jS F Y G:i")+'")}'});a+=this.addPlainRowGroup({totalwork:"{totalwork:duration}",actualwork:"{actualwork:duration}",
owner:"{owner}",categories:"{categories}",companies:"{companies}",billinginformation:"{billinginformation}",mileage:"{mileage}"});a+=this.addPlainRowGroup({categories:"{categories}",companies:"{companies}",billinginformation:"{billinginformation}",mileage:"{mileage}"});a+=this.addPlainRow("attachment_names","{attachment_names}");return a+"{body}"},prepareData:function(a,b){var c=Zarafa.task.attachitem.AttachTaskRenderer.superclass.prepareData.apply(this,arguments);c.status===Zarafa.core.mapi.TaskStatus.NOT_STARTED&&
delete c.status;0===c.percent_complete&&delete c.percent_complete;0===c.actualwork&&delete c.actualwork;0===c.totalwork&&delete c.totalwork;return c}});Ext.namespace("Zarafa.task.data");Zarafa.task.data.DataModes=Zarafa.core.Enum.create({ALL:0});Ext.namespace("Zarafa.task.data");Zarafa.task.data.ViewModes=Zarafa.core.Enum.create({SIMPLE:0,SEARCH:1,DETAILED:2});Ext.namespace("Zarafa.task.data");Zarafa.task.data.Views=Zarafa.core.Enum.create({LIST:0,SEARCH:1});Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.SendTaskRequestConfirmationContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{record:void 0,responseType:void 0,constructor:function(a){a=a||{};var b=_("Accepting Task");a.responseType===Zarafa.core.mapi.TaskMode.DECLINE&&(b=_("Declining Task"));a=Ext.applyIf(a,{xtype:"zarafa.sendtaskrequestconfirmcontentpanel",layout:"fit",title:b,modal:!0,width:350,height:250,items:[{xtype:"zarafa.sendtaskrequestconfirmationpanel",record:a.record,responseType:a.responseType,ref:"sendTaskConfirmationPanel",
buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.task.dialogs.SendTaskRequestConfirmationContentPanel.superclass.constructor.call(this,a)},onOk:function(){this.sendTaskConfirmationPanel.updateRecord(this.record);this.close()},onCancel:function(){this.close()}});Ext.reg("zarafa.sendtaskrequestconfirmcontentpanel",Zarafa.task.dialogs.SendTaskRequestConfirmationContentPanel);Ext.namespace("Zarafa.task.printer");
Zarafa.task.printer.TaskListViewRenderer=Ext.extend(Zarafa.common.printer.renderers.BaseRenderer,{generateBodyTemplate:function(a){a='<table id="tasks" class="task-list" cellpadding=0 cellspacing=0>\n'+('<tr class="nowrap"><th>'+_("Priority")+"</th><th>"+_("% Completed")+'</th><th class="wrap fullwidth">'+_("Subject")+"</th><th>"+_("Owner")+"</th><th>"+_("Due date")+"</th></tr>\n");a+='<tpl for="tasks"><tr class="nowrap"><td>{values.data.importance:importanceString}</td><td>{values.data.percent_complete:percentage(0)}</td><td class="wrap fullwidth">{values.data.subject:htmlEncode}</td><td>{values.data.owner:htmlEncode}</td><td>{values.data.duedate:date("'+
_("l jS F Y")+'")}</td></tr>\n</tpl>';return a=a+"</table>\n"+('<table id="bottom"><tr><td class="nowrap" align=left>{fullname:htmlEncode}</td><td class="nowrap" align=right>{currenttime:date("'+_("l jS F Y G:i")+'")}</td></tr></table>\n')},prepareData:function(a){var b=Zarafa.task.printer.TaskListViewRenderer.superclass.prepareData.apply(this,arguments),c=a.getModel();b.currenttime=new Date;b.tasks=c.getStore().getRange();return b},customStylesheetPath:"client/resources/css/external/print.task.css"});
Ext.namespace("Zarafa.task.ui");
Zarafa.task.ui.TaskContextMenu=Ext.extend(Zarafa.core.ui.menu.ConditionalMenu,{records:void 0,actsOnTodoListFolder:!1,constructor:function(a){a=a||{};Ext.isDefined(a.records)&&!Array.isArray(a.records)&&(a.records=[a.records]);this.records=a.records;Ext.applyIf(a,{items:[this.createContextActionItems(),{xtype:"menuseparator"},container.populateInsertionPoint("context.task.contextmenu.actions",this),{xtype:"menuseparator"},this.createContextOptionsItems(),{xtype:"menuseparator"},container.populateInsertionPoint("context.task.contextmenu.options",
this)]});Zarafa.task.ui.TaskContextMenu.superclass.constructor.call(this,a)},createContextActionItems:function(){return[{xtype:"zarafa.conditionalitem",text:_("Open"),iconCls:"icon_open",singleSelectOnly:!0,handler:this.onOpenTask,scope:this},{xtype:"zarafa.conditionalitem",text:_("Follow up"),iconCls:"icon_mail_flag_red",cls:"k-unclickable",hideOnClick:!1,beforeShow:this.onBeforeShowFollowUp,menu:{xtype:"zarafa.taskflagsmenu",records:this.records},scope:this},{xtype:"zarafa.conditionalitem",text:_("Mark Complete"),
iconCls:"icon_task_complete",isMarkComplete:!0,beforeShow:this.onMarkCompleteItemBeforeShow,handler:this.onMarkCompleteItemClick,scope:this},{xtype:"zarafa.conditionalitem",text:_("Mark Incomplete"),iconCls:"icon_task_incomplete",isMarkComplete:!1,beforeShow:this.onMarkCompleteItemBeforeShow,handler:this.onMarkCompleteItemClick,scope:this},{text:_("Copy/Move"),iconCls:"icon_copy",handler:this.onCopyMove,scope:this}]},createContextOptionsItems:function(){return[{xtype:"zarafa.conditionalitem",text:_("Categories"),
cls:"k-unclickable",iconCls:"icon_categories",hideOnClick:!1,menu:{xtype:"zarafa.categoriescontextmenu",records:this.records}},{xtype:"zarafa.conditionalitem",text:_("Delete"),iconCls:"icon_delete",nonEmptySelectOnly:!0,handler:this.onContextItemDelete,scope:this}]},onBeforeShowFollowUp:function(a,b){Array.isArray(b)||(b=[b]);var c=b.some(function(a){return a.isMessageClass("IPM.Task",!0)&&(a.isTaskOrganized()||a.isTaskNotResponded())});a.setDisabled(c)},onOpenTask:function(){Zarafa.common.Actions.openMessageContent(this.records)},
onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.records)},onContextItemDelete:function(){Zarafa.common.Actions.deleteRecords(this.records)},onMarkCompleteItemClick:function(a){var b=a.isMarkComplete,c=!1;Ext.each(this.records,function(a){a.beginEdit();a.set("complete",b);a.set("percent_complete",b);a.set("status",b?Zarafa.core.mapi.TaskStatus.COMPLETE:Zarafa.core.mapi.TaskStatus.NOT_STARTED);a.set("date_completed",b?new Date:null);a.set("flag_icon",b?Zarafa.core.mapi.FlagIcon.clear:
Zarafa.core.mapi.FlagIcon.red);a.set("flag_complete_time",b?new Date:null);a.set("flag_request",b?"":"Follow up");a.set("flag_status",b?Zarafa.core.mapi.FlagStatus.completed:Zarafa.core.mapi.FlagStatus.flagged);a.endEdit();a.isNormalTask()||(a.isTaskOwner()||a.isTaskRequest()?a.addMessageAction("response_type",Zarafa.core.mapi.TaskMode.UPDATE):c=!0)},this);c&&Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Please note that assigned task(s) will be overwritten when the assignee makes changes."),
icon:Ext.MessageBox.WARNING,buttons:Ext.MessageBox.OK});!Ext.isEmpty(this.records)&&Ext.isDefined(this.records[0])&&this.records[0].getStore().save()},onMarkCompleteItemBeforeShow:function(a,b){var c=!0;!0!==this.actsOnTodoListFolder&&(c=!b.some(function(b){return b.get("complete")!==a.isMarkComplete}));a.setDisabled(c)}});Ext.reg("zarafa.taskcontextmenu",Zarafa.task.ui.TaskContextMenu);Ext.namespace("Zarafa.task.ui");
Zarafa.task.ui.TaskGridColumnModel=Ext.extend(Zarafa.common.ui.grid.ColumnModel,{simpleColumns:[],detailedColumns:[],model:void 0,constructor:function(a){a=a||{};this.simpleColumns=this.createSimpleColumns();this.detailedColumns=this.createDetailedColumns();Ext.applyIf(a,{columns:this.simpleColumns,defaults:{sortable:!0}});Zarafa.task.ui.TaskGridColumnModel.superclass.constructor.call(this,a)},createSimpleColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column icon",header:'<p class="icon_index">&nbsp;</p>',
width:25,tooltip:_("Sort by: Icon"),fixed:!0,hideable:!1,renderer:Zarafa.common.ui.grid.Renderers.icon},{headerCls:"zarafa-icon-column",header:'<p class="icon_reminder">&nbsp;</p>',dataIndex:"reminder",tooltip:_("Sort by: Reminder"),width:24,renderer:Zarafa.common.ui.grid.Renderers.reminder,fixed:!0},{xtype:"checkcolumn",dataIndex:"complete",headerCls:"zarafa-icon-column",header:'<p class="icon_complete">&nbsp;</p>',width:25,fixed:!0,renderer:this.completeColumnRenderer.createDelegate(this),tooltip:_("Sort by: Complete"),
processEvent:Ext.ux.grid.CheckColumn.prototype.processEvent.createSequence(this.onCompleteColumnProcessEvent)},{id:"subject",dataIndex:"subject",header:_("Subject"),tooltip:_("Sort by: Subject"),renderer:this.columnRenderer},{dataIndex:"duedate",header:_("Due Date"),tooltip:_("Sort by: Due Date"),renderer:this.columnRenderer},{header:_("Reminder Time"),dataIndex:"reminder_time",width:160,renderer:this.columnRenderer,tooltip:_("Sort by: Reminder Time"),hidden:!0},{header:_("Assigned To"),dataIndex:"display_to",
width:100,renderer:this.columnRenderer,tooltip:_("Sort by: Assignee"),hidden:!0},{dataIndex:"startdate",header:_("Start Date"),tooltip:_("Sort by: Start Date"),renderer:this.columnRenderer,hidden:!0},{dataIndex:"percent_complete",header:_("% Completed"),width:75,tooltip:_("Sort by: Percent Completed"),renderer:this.columnRenderer,hidden:!0},{dataIndex:"categories",header:_("Categories"),tooltip:_("Sort by: Categories"),renderer:Zarafa.common.ui.grid.Renderers.categories},{headerCls:"zarafa-icon-column",
header:'<p class="icon_attachment">&nbsp;</p>',dataIndex:"hasattach",width:24,renderer:Zarafa.common.ui.grid.Renderers.attachment,fixed:!0,tooltip:_("Sort by: Attachment"),hidden:!0},{dataIndex:"importance",headerCls:"zarafa-icon-column importance",header:'<p class="icon_importance">&nbsp;</p>',width:24,tooltip:_("Sort by: Priority"),fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.importance,hidden:!0},{headerCls:"zarafa-icon-column",header:'<p class="icon_recurring">&nbsp;</p>',dataIndex:"recurring",
width:24,renderer:Zarafa.common.ui.grid.Renderers.recurrence,fixed:!0,hidden:!0},{dataIndex:"owner",header:_("Owner"),tooltip:_("Sort by: Owner"),renderer:this.columnRenderer,hidden:!0},{header:'<p class="icon_flag">&nbsp;<span class="title">'+_("Flag")+"</span></p>",headerCls:"zarafa-icon-column flag",dataIndex:"flag_due_by",width:24,renderer:Zarafa.common.ui.grid.Renderers.flag,fixed:!0,tooltip:_("Sort by: flag")}]},createDetailedColumns:function(){return[{dataIndex:"icon_index",headerCls:"zarafa-icon-column icon",
header:'<p class="icon_index">&nbsp;</p>',width:25,tooltip:_("Sort by: Icon"),fixed:!0,hideable:!1,renderer:Zarafa.common.ui.grid.Renderers.icon},{headerCls:"zarafa-icon-column",header:'<p class="icon_reminder">&nbsp;</p>',dataIndex:"reminder",tooltip:_("Sort by: Reminder"),width:24,renderer:Zarafa.common.ui.grid.Renderers.reminder,fixed:!0},{header:_("Reminder Time"),dataIndex:"reminder_time",width:160,renderer:this.columnRenderer,tooltip:_("Sort by: Reminder Time"),hidden:!0},{xtype:"checkcolumn",
dataIndex:"complete",headerCls:"zarafa-icon-column",header:'<p class="icon_complete">&nbsp;</p>',width:25,fixed:!0,renderer:this.completeColumnRenderer.createDelegate(this),tooltip:_("Sort by: Complete"),processEvent:Ext.ux.grid.CheckColumn.prototype.processEvent.createSequence(this.onCompleteColumnProcessEvent)},{id:"subject",dataIndex:"subject",header:_("Subject"),tooltip:_("Sort by: Subject"),renderer:this.columnRenderer},{header:_("Assigned To"),dataIndex:"display_to",width:100,renderer:this.columnRenderer,
tooltip:_("Sort by: Assignee")},{dataIndex:"startdate",header:_("Start Date"),tooltip:_("Sort by: Start Date"),renderer:this.columnRenderer},{dataIndex:"duedate",header:_("Due Date"),tooltip:_("Sort by: Due Date"),renderer:this.columnRenderer},{dataIndex:"percent_complete",header:_("% Completed"),width:75,tooltip:_("Sort by: Percent Completed"),renderer:this.columnRenderer},{dataIndex:"categories",header:_("Categories"),tooltip:_("Sort by: Categories"),renderer:Zarafa.common.ui.grid.Renderers.categories},
{headerCls:"zarafa-icon-column",header:'<p class="icon_attachment">&nbsp;</p>',dataIndex:"hasattach",width:24,renderer:Zarafa.common.ui.grid.Renderers.attachment,fixed:!0,tooltip:_("Sort by: Attachment")},{dataIndex:"importance",headerCls:"zarafa-icon-column importance",header:'<p class="icon_importance">&nbsp;</p>',width:24,tooltip:_("Sort by: Priority"),fixed:!0,renderer:Zarafa.common.ui.grid.Renderers.importance,hidden:!0},{headerCls:"zarafa-icon-column",header:'<p class="icon_recurring">&nbsp;</p>',
dataIndex:"recurring",width:24,renderer:Zarafa.common.ui.grid.Renderers.recurrence,fixed:!0,hidden:!0},{dataIndex:"owner",header:_("Owner"),tooltip:_("Sort by: Owner"),renderer:this.columnRenderer,hidden:!0},{header:'<p class="icon_flag">&nbsp;<span class="title">'+_("Flag")+"</span></p>",headerCls:"zarafa-icon-column flag",dataIndex:"flag_due_by",width:24,renderer:Zarafa.common.ui.grid.Renderers.flag,fixed:!0,tooltip:_("Sort by: flag")}]},columnRenderer:function(a,b,c){switch(this.dataIndex){case "subject":a=
Zarafa.common.ui.grid.Renderers.subject(a,b,c);break;case "display_to":a=Ext.isDefined(c.isTaskAssigned)&&c.isTaskAssigned()?Zarafa.common.ui.grid.Renderers.name(a,b,c):"";break;case "startdate":case "duedate":a=Zarafa.common.ui.grid.Renderers.utcdate(a,b,c);break;case "percent_complete":a=Zarafa.common.ui.grid.Renderers.percentage(a,b,c);break;case "owner":a=Zarafa.common.ui.grid.Renderers.text(a,b,c);break;case "reminder_time":a=Zarafa.common.ui.grid.Renderers.dateWithTime(a,b)}!c.get("complete")&&
c.get("flag_status")!==Zarafa.core.mapi.FlagStatus.completed||Ext.isEmpty(a)||(b.css+=" k-task-complete");return a},completeColumnRenderer:function(a,b,c){b.css+=" zarafa-grid-empty-cell";Ext.isDefined(a)||c.get("flag_status")!==Zarafa.core.mapi.FlagStatus.completed||(a=!0);return Ext.ux.grid.CheckColumn.prototype.renderer.apply(this,arguments)},onCompleteColumnProcessEvent:function(a,b,c,d,e){if("mousedown"===a)if(a=c.store.getAt(d),a instanceof Zarafa.task.TaskRecord)c=a.get("complete"),a.beginEdit(),
a.set("percent_complete",c?1:0),a.set("status",c?Zarafa.core.mapi.TaskStatus.COMPLETE:Zarafa.core.mapi.TaskStatus.NOT_STARTED),a.set("date_completed",c?new Date:null),a.set("flag_icon",c?Zarafa.core.mapi.FlagIcon.clear:Zarafa.core.mapi.FlagIcon.red),a.set("flag_complete_time",c?new Date:null),a.set("flag_request",c?"":"Follow up"),a.set("flag_status",c?Zarafa.core.mapi.FlagStatus.completed:Zarafa.core.mapi.FlagStatus.flagged),a.endEdit(),a.isNormalTask()?a.save():a.isTaskOwner()||a.isTaskRequest()?
a.respondToTaskRequest(Zarafa.core.mapi.TaskMode.UPDATE):(Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Please note that assigned task(s) will be overwritten when the assignee makes changes."),icon:Ext.MessageBox.WARNING,scope:this,buttons:Ext.MessageBox.OK}),a.save());else{Zarafa.common.flags.Util.updateCategories(a);b={flag_icon:Zarafa.core.mapi.FlagIcon.clear,flag_complete_time:new Date,flag_request:"",flag_status:Zarafa.core.mapi.FlagStatus.completed,reminder:!1};c.store.suspendEvents(!1);
a.beginEdit();for(var f in b)a.set(f,b[f]);a.endEdit();a.save();c.store.resumeEvents()}},setSimpleView:function(a){a?(this.name="simple",this.columns=this.simpleColumns,this.setConfig(this.simpleColumns,!1)):(this.name="detailed",this.columns=this.detailedColumns,this.setConfig(this.detailedColumns,!1))},setConfig:function(a,b){Ext.isDefined(this.model)&&this.model.getDefaultFolder()&&this.model.getDefaultFolder().isTodoListFolder()&&(a=a.filter(function(a){return"percent_complete"!==a.dataIndex}));
Zarafa.task.ui.TaskGridColumnModel.superclass.setConfig.call(this,a,b)}});Ext.namespace("Zarafa.task.ui");
Zarafa.task.ui.TaskMainPanel=Ext.extend(Zarafa.common.ui.ContextMainPanel,{viewPanel:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.taskmainpanel",layout:"fit",items:[{xtype:"zarafa.switchviewcontentcontainer",ref:"viewPanel",layout:"card",lazyItems:this.initViews(a.context)}],tbar:{xtype:"zarafa.contextmainpaneltoolbar",defaultTitle:_("Tasks"),paging:container.populateInsertionPoint("context.task.toolbar.paging",this),items:container.populateInsertionPoint("context.task.toolbar.item",
this),context:a.context}});Zarafa.task.ui.TaskMainPanel.superclass.constructor.call(this,a)},initViews:function(a){var b=[{xtype:"zarafa.taskgrid",id:"task-grid",context:a}];a=container.populateInsertionPoint("context.task.views",this,a);return b=b.concat(a)},initEvents:function(){Ext.isDefined(this.context)&&(this.mon(this.context,"viewchange",this.onViewChange,this),this.onViewChange(this.context,this.context.getCurrentView()))},onViewChange:function(a,b,c){switch(b){case Zarafa.task.data.Views.SEARCH:case Zarafa.task.data.Views.LIST:this.viewPanel.switchView("task-grid")}}});
Ext.reg("zarafa.taskmainpanel",Zarafa.task.ui.TaskMainPanel);Ext.namespace("Zarafa.whatsnew");
Zarafa.whatsnew.Features={version:"3.4.0",features:[{title:_("Improved categories"),description:_("Categories now have a prominent place in your overviews of Mail, Calendar, Tasks and more.")+"<br><br>"+_('Adding a category is easy and can be done from the overview. Move your mouse over an email to see the "Add category" icon and click it, or right-click an item to open the context menu.'),image_url:"client/resources/images/whatsnew/improvedcategories.png",icon_url:"client/resources/images/whatsnew/iconwebapp.png"},
{title:_("Flag item for follow up"),description:_("You can now mark email items for follow-up by setting a flag. In the new flags menu you can select the follow-up date. A reminder will be shown that day.")+"<br><br>"+_("The Tasks context provides a complete overview of your to-do's. All tasks and flagged emails will be shown in this to-do list."),image_url:"client/resources/images/whatsnew/flagitem.png",icon_url:"client/resources/images/whatsnew/iconwebapp.png"},{title:_("Transformation of flags into follow-ups and categories"),
description:_('Your former flagged items are transformed into items with a color category and a "No date" follow-up flag. For example: an item with a blue flag will now have a category named "Blue".')+"<br><br>"+_(" You have the option to rename a color category when you first use it and all items with this category will get updated."),image_url:"client/resources/images/whatsnew/transformflags.png",icon_url:"client/resources/images/whatsnew/iconwebapp.png"},{title:_("Search folders"),description:_('If there is a search query you use frequently you are in luck! After you have completed a search you can now save it as a "search folder" which will show up in your favorites! You can then do the same search again with a single click.'),
image_url:"client/resources/images/whatsnew/searchfolder.png",icon_url:"client/resources/images/whatsnew/iconwebapp.png"}]};Ext.namespace("Zarafa.core");
Zarafa.core.Context=Ext.extend(Zarafa.core.Plugin,{current_view:void 0,current_view_mode:void 0,hasContentPanel:!0,groupViewBtns:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{stateful:!0});this.addEvents(["viewchange","viewmodechange"]);Zarafa.core.Context.superclass.constructor.call(this,a);!0===this.hasContentPanel&&this.registerInsertionPoint("main.content",this.createContentPanel,this)},createContentPanel:function(){},getMainToolbarViewButtons:function(){return[]},getMainToolbarPrintButtons:function(){return[]},
switchView:function(a,b,c){this.suspendEvents(!0);this.setView(a,c);this.setViewMode(b,c);this.resumeEvents()},setView:function(a,b){if(!0===b||this.current_view!==a){var c=this.current_view;this.current_view=a;this.onViewChange(this,this.current_view,c);this.fireEvent("viewchange",this,this.current_view,c)}},onViewChange:Ext.emptyFn,getCurrentView:function(){return this.current_view},setViewMode:function(a,b){if(!0===b||this.current_view_mode!==a){var c=this.current_view_mode;this.current_view_mode=
a;this.onViewModeChange(this,this.current_view_mode,c);this.fireEvent("viewmodechange",this,this.current_view_mode,c)}},onViewModeChange:Ext.emptyFn,getCurrentViewMode:function(){return this.current_view_mode},getModel:Ext.emptyFn,enable:function(a,b){this.stateful&&this.initState();var c=this.getModel();c&&c.enable(a,b);this.switchView(this.getCurrentView(),this.getCurrentViewMode(),!0)},disable:function(){var a=this.getModel();a&&a.disable()},bid:function(a){return-1},getStateName:function(){var a=
this.statefulName;a||(a=this.getName());return"contexts/"+a},initStateEvents:function(){Zarafa.core.Context.superclass.initStateEvents.call(this);this.on("viewchange",this.saveViewModeState,this,{delay:100});this.on("viewmodechange",this.saveViewModeState,this,{delay:100})},saveViewModeState:function(a,b,c){b!=c&&this.saveState()},getState:function(){var a=Zarafa.core.Context.superclass.getState.call(this)||{},b=this.getModel(),c=b&&b.isSearching(),d=b&&b.isLiveScrolling(),b=d&&!c&&!Zarafa.mail.data.ViewModes.isMainViewMode(this.current_view_mode),
c=d&&c&&Zarafa.mail.data.ViewModes.isMainViewMode(this.oldViewMode);return Ext.apply(a,b||c?{current_view:this.oldView,current_view_mode:this.oldViewMode}:{current_view:this.current_view,current_view_mode:this.current_view_mode})}});Ext.namespace("Zarafa.core");
Zarafa.core.MultiFolderContextModel=Ext.extend(Zarafa.core.ContextModel,{colorScheme:void 0,assigningColors:!1,default_merge_state:!1,groupings:void 0,colorMap:void 0,active_group:void 0,constructor:function(a){a=a||{};this.addEvents("foldermergestatechanged","foldergroupingchanged","colormapchanged");this.groupings={};this.colorMap={};Zarafa.core.MultiFolderContextModel.superclass.constructor.call(this,a);container.getHierarchyStore().on("addFolder",this.onHierarchyAddFolder,this)},enable:function(a,
b){Zarafa.core.MultiFolderContextModel.superclass.enable.apply(this,arguments);this.setMergeState(this.getCurrentMergeState(),!0)},setMergeState:function(a,b){if(!0===b||this.default_merge_state!==a)this.default_merge_state=a,this.fireEvent("foldermergestatechanged",this,this.default_merge_state)},getCurrentMergeState:function(){return this.default_merge_state},onFolderChange:function(a,b){Zarafa.core.MultiFolderContextModel.superclass.onFolderChange.apply(this,arguments);this.sortFolders();this.assignColors();
this.applyGrouping()},onHierarchyLoad:function(a){0!==a.getCount()&&(Zarafa.core.MultiFolderContextModel.superclass.onHierarchyLoad.apply(this,arguments),this.sortFolders(),this.assignColors())},onHierarchyAddFolder:function(a,b,c){this.assignColors()},getDefaultFolder:function(){if(this.enabled){var a=this.getActiveGroup();if(a&&this.groupings[a]&&(a=this.getFolder(this.groupings[a].active),!Ext.isEmpty(a)))return a}return Zarafa.core.MultiFolderContextModel.superclass.getDefaultFolder.apply(this,
arguments)},activateFolderInGroup:function(a,b){this.active_group=b;this.groupings[b].active=a.get("entryid");this.fireEvent("foldergroupingchanged",this,this.groupings,this.active_group)},mergeFolderToGroup:function(a,b,c){a=a.get("entryid");this.groupings[c]&&(this.groupings[c].folders.remove(a),Ext.isEmpty(this.groupings[c].folders)?delete this.groupings[c]:this.groupings[c].active==a&&(this.groupings[c].active=this.groupings[c].folders[0]));this.groupings[b].folders.push(a);this.groupings[b].active=
a;this.active_group=b;this.fireEvent("foldergroupingchanged",this,this.groupings,this.active_group);return b},separateFolderFromGroup:function(a,b){var c=Ext.id(null,"group-"),d=a.get("entryid");this.groupings[b]&&(this.groupings[b].folders.remove(d),Ext.isEmpty(this.groupings[b].folders)?delete this.groupings[b]:this.groupings[b].active==d&&(this.groupings[b].active=this.groupings[b].folders[0]));this.groupings[c]={folders:[d],active:d};this.active_group=c;this.fireEvent("foldergroupingchanged",
this,this.groupings,this.active_group);return c},removeFolderFromGroup:function(a,b){var c=a.get("entryid");this.groupings[b]&&(this.groupings[b].folders.remove(c),Ext.isEmpty(this.groupings[b].folders)?delete this.groupings[b]:this.groupings[b].active==c&&(this.groupings[b].active=this.groupings[b].folders[0]));this.fireEvent("foldergroupingchanged",this,this.groupings,this.active_group)},addItemToGroup:function(a){if(this.default_merge_state){var b=Object.keys(this.groupings);Ext.isEmpty(b)?(this.active_group=
Ext.id(null,"group-"),this.groupings[this.active_group]={folders:[a],active:a}):(this.active_group=b[0],this.groupings[b[0]].folders.push(a))}else this.active_group=Ext.id(null,"group-"),this.groupings[this.active_group]={folders:[a],active:a}},removeItemFromGroup:function(a){Ext.iterate(this.groupings,function(b,c){if(Ext.isEmpty(c.folders))return!0;var d=c.folders.indexOf(a);if(-1<d)return c.folders.splice(d,1),Ext.isEmpty(c.folders)&&(delete this.groupings[b],this.active_group==b&&(this.active_group=
Object.keys(this.groupings).pop())),!1},this)},applyGrouping:function(){for(var a=[],b=0,c=this.folders.length;b<c;b++)a.push(this.folders[b].get("entryid"));var d=[];Ext.iterate(this.groupings,function(a,b){d=d.concat(b.folders)},this);b=0;for(c=d.length;b<c;b++){var e=d[b];0>a.indexOf(e)?this.removeItemFromGroup(e):a.remove(e)}b=0;for(c=a.length;b<c;b++)this.addItemToGroup(a[b]);this.fireEvent("foldergroupingchanged",this,this.groupings,this.active_group)},getGroupings:function(){return this.groupings},
sortFolders:function(){1<this.folders.length&&(this.folders=container.getHierarchyStore().getSortedFolders(this.hasFolder,this))},assignColors:function(){this.assigningColors=!0;for(var a=0,b=this.folders.length;a<b;a++)this.getColorScheme(this.folders[a].get("entryid"));this.assigningColors=!1},getColorScheme:function(a){a=a.replace("favorites-","");if(this.colorMap){var b=Zarafa.core.ColorSchemes.getColorScheme(this.colorMap[a]);Ext.isDefined(b)||(b=this.colorScheme[Math.floor(Math.random()*this.colorScheme.length)],
this.setColorScheme(a,b));return b}},setColorScheme:function(a,b){this.colorMap[a]=b.name;this.assigningColors||this.fireEvent("colormapchanged",this,this.colorMap)},getActiveGroup:function(){return this.active_group},saveFolderGroupinChanged:function(a,b,c){this.groupings==b&&c==this.active_group||this.saveState()},initStateEvents:function(){Zarafa.core.MultiFolderContextModel.superclass.initStateEvents.call(this);this.on("foldergroupingchanged",this.saveFolderGroupinChanged,this,{delay:100});this.on("colormapchanged",
this.saveState,this,{delay:100})},getState:function(){var a=Zarafa.core.MultiFolderContextModel.superclass.getState.call(this)||{};return Ext.apply(a,{groupings:this.groupings,active_group:this.active_group,colorMap:this.colorMap})},applyState:function(a){if(Ext.isDefined(a.groupings)){Array.isArray(a.groupings)&&(a.groupings={});for(var b in a.groupings)a.groupings.hasOwnProperty(b)&&0>a.groupings[b].folders.indexOf(a.groupings[b].active)&&(a.groupings[b].active=a.groupings[b].folders[0])}Zarafa.core.MultiFolderContextModel.superclass.applyState.call(this,
a)},resetGroupings:function(){this.groupings={}}});Ext.namespace("Zarafa.core");Zarafa.core.PresencePlugin=Ext.extend(Zarafa.core.Plugin,{getPresenceStatuses:function(a){return a.map(function(){return Zarafa.core.data.PresenceStatus.UNKNOWN})}});Ext.namespace("Zarafa.core");Zarafa.core.ThemePlugin=Ext.extend(Zarafa.core.Plugin,{constructor:function(a){Zarafa.core.Plugin.superclass.constructor.call(this,a);container.getServerConfig().getActiveTheme()===this.getName()&&this.initPlugin()}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.DummyResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{start:function(a,b,c,d){this.proxy&&Ext.isFunction(this.proxy.deleteRequestId)&&this.proxy.deleteRequestId(b);return!1}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMAttachmentRecordFields=[{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_ATTACH},{name:"attach_num",type:"int",defaultValue:-1},{name:"attach_method",type:"int",defaultValue:Zarafa.core.mapi.AttachMethod.NO_ATTACHMENT},{name:"attach_message_class",type:"string",defaultValue:"IPM.Note"},{name:"size",type:"int",defaultValue:0},{name:"cid"},{name:"attach_id"},{name:"filetype"},{name:"hidden",type:"boolean",defaultValue:!1},{name:"name",type:"string",defaultValue:_("Untitled")},
{name:"tmpname"},{name:"attachment_contactphoto",type:"boolean",defaultValue:!1},{name:"entryid"},{name:"store_entryid"},{name:"extension",type:"string"}];
Zarafa.core.data.IPMAttachmentRecord=Ext.extend(Ext.data.Record,{uploadAttempted:!1,inline:!1,applyData:function(a){this.beginEdit();Ext.apply(this.data,a.data);Ext.apply(this.modified,a.modified);this.inline=a.inline;this.uploadAttempted=a.uploadAttempted;this.dirty=a.dirty;this.endEdit(!1);return this},setInline:function(a){this.inline=a},isUploaded:function(){return!Ext.isEmpty(this.get("tmpname"))||!this.isTmpFile()},isTmpFile:function(){return-1>=this.get("attach_num")},isInline:function(){return this.inline},
isHidden:function(){return this.get("hidden")},isRecurrenceException:function(){return this.isHidden()&&Zarafa.core.MessageClass.isClass(this.get("attach_message_class"),"IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}")},isContactPhoto:function(){return this.get("attachment_contactphoto")},isEmbeddedMessage:function(){return this.get("attach_method")===Zarafa.core.mapi.AttachMethod.ATTACH_EMBEDDED_MSG&&!this.isRecurrenceException()},canBeImported:function(){var a=this.get("extension");return container.getServerConfig().isImportSupported()&&
("eml"===a||"vcf"===a)},getStore:function(){return this.store},getInlineImageUrl:function(){return this.store.getInlineImageUrl(this)},getAttachmentUrl:function(a){return this.store.getAttachmentUrl(this,a)},getParentAttachNum:function(a){a||(a=this.store.getParentRecord());a=a.get("attach_num");return Ext.isEmpty(a)||-1===a[0]?[]:[].concat(a)},attemptedToUpload:function(){return this.uploadAttempted},convertToIPMRecord:function(){var a=this.get("attach_message_class");if(!Ext.isEmpty(a)){if(this.isTmpFile()){var b=
this.get("entryid"),c=[].concat(this.get("attach_num"));return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass(a,{message_class:a,object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,attach_num:c,entryid:b,store_entryid:this.get("store_entryid")},b+c.join(""))}b=this.store.getParentRecord();c=[];if(!Ext.isFunction(b.isRecurringException)||Ext.isFunction(b.isRecurringException)&&!b.isRecurringException())c=this.getParentAttachNum(b);var c=c.concat(this.get("attach_num")),d=b.get("entryid");
return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass(a,{message_class:a,object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,attach_num:c,entryid:d,store_entryid:b.get("store_entryid")},d+c.join(""))}}});Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_ATTACH,Zarafa.core.data.IPMAttachmentRecord);Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_ATTACH,Zarafa.core.data.IPMAttachmentRecordFields);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMAttachmentResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doUpdate:function(a){this.receivedRecords=this.receivedRecords.concat(this.correlateRecordFromResponse(a))},compareResponseDataToRecord:function(a,b){return a.props.name==b.get("name")}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMAttachmentStore=Ext.extend(Zarafa.core.data.MAPISubStore,{id:null,attachmentRecordType:Zarafa.core.mapi.ObjectType.MAPI_ATTACH,constructor:function(a){a=a||{};Ext.applyIf(a,{id:Zarafa.generateId(32),proxy:new Zarafa.core.data.IPMAttachmentProxy({listModuleName:"attachments",itemModuleName:"attachments"}),writer:new Zarafa.core.data.JsonAttachmentWriter,reader:new Zarafa.core.data.JsonAttachmentReader({},Zarafa.core.data.RecordFactory.getRecordClassByCustomType(this.attachmentRecordType))});
Zarafa.core.data.IPMAttachmentStore.superclass.constructor.call(this,a);this.on({update:this.onAttachmentsChange,add:this.onAttachmentsChange,remove:this.onAttachmentsChange,datachanged:this.onAttachmentsChange,scope:this});Zarafa.core.data.ZarafaCustomEventDispatcher.addEvents("attachmentstorebeforecheck","attachmentstorebeforeupload","attachmentstorebeforedestroyrecord","attachmentstorebeforegetbaseurl")},onAttachmentsChange:function(){this.getParentRecord()&&(0<this.getCount()?this.getParentRecord().set("hasattach",
!0):this.getParentRecord().set("hasattach",!1))},getId:function(){return this.id},setId:function(a){this.id=a},getInlineImageUrl:function(a){a=this.getDownloadAttachmentUrl(a);return Ext.urlAppend(a,"contentDispositionType=inline")},getAttachmentUrl:function(a,b){var c=this.getDownloadAttachmentUrl(a,b);return Ext.urlAppend(c,"contentDispositionType=attachment")},getDownloadAttachmentUrl:function(a,b){var c=this.getParentRecord(),d=c.isSubMessage(),e=this.getAttachmentBaseUrl(),e=Ext.urlAppend(e,
"load=download_attachment");if(!b||b&&d){var f=[];if(!Ext.isFunction(c.isRecurringException)||Ext.isFunction(c.isRecurringException)&&!c.isRecurringException())f=a.getParentAttachNum(c);if(-1!=a.get("attach_num")){f.push(a.get("attach_num"));for(var g=0,h=f.length;g<h;g++)e=Ext.urlAppend(e,"attachNum[]="+f[g])}else e=Ext.urlAppend(e,"attachNum[]="+a.get("tmpname"))}b&&(e=Ext.urlAppend(e,"AllAsZip=true"),d&&(e=Ext.urlAppend(e,"isSubMessage=true")),e=Ext.urlAppend(e,"subject="+c.get("subject")));c=
{url:e};Zarafa.core.data.ZarafaCustomEventDispatcher.fireEvent("attachmentstorebeforegetbaseurl",this,a,b,c);return c.url},getAttachmentParentRecordEntryId:function(){var a=this.getParentRecord(),b=a.get("entryid")||"",a=a.getMessageActions();if(Ext.isEmpty(b)&&a)switch(a.action_type){case "forward":b=a.source_entryid}return b},getAttachmentBaseUrl:function(){var a=container.getBaseURL(),a=Ext.urlAppend(a,"store="+this.getParentRecord().get("store_entryid")),a=Ext.urlAppend(a,"entryid="+this.getAttachmentParentRecordEntryId());
return a=Ext.urlAppend(a,"dialog_attachments="+this.getId())},getUploadAttachmentUrl:function(){return Ext.urlAppend(this.getAttachmentBaseUrl(),"load=upload_attachment")},getImportAttachmentUrl:function(a,b){var c=this.getDownloadAttachmentUrl(a),c=Ext.urlAppend(c,"import=true");return c=Ext.urlAppend(c,"destination_folder="+b.get("entryid"))},canUploadFiles:function(a,b){if(Ext.isEmpty(a)||0===a.length)return!1;var c={handledfiles:[],checkfailed:!1};Zarafa.core.data.ZarafaCustomEventDispatcher.fireEvent("attachmentstorebeforecheck",
this,a,b,c);if(c.checkfailed)return!1;var d=container.getServerConfig(),e=d.getMaxAttachments(),f=d.getMaxAttachmentSize(),g=d.getMaxAttachmentTotalSize();if(Ext.isDefined(e)&&this.getCount()+a.length-c.handledfiles.length>=e)return container.getNotifier().notify("error.attachment",_("Attachment error"),String.format(_("Cannot upload attachment, only {0} attachments are allowed to be added to the message"),e),b),!1;for(var e=0,h=this.sum("size"),k=0;k<a.length;k++){var l=a[k],m=l.fileSize||l.size;
if(-1===c.handledfiles.indexOf(l)&&(e+=m,h+=m,Ext.isDefined(f)&&m>f))return container.getNotifier().notify("error.attachment",_("Attachment error"),String.format(_("Cannot upload attachment, attachment is {0} while the allowed maximum is {1}."),Ext.util.Format.fileSize(m),Ext.util.Format.fileSize(f)),b),!1}if(Ext.isDefined(g)&&h>g)return container.getNotifier().notify("error.attachment",_("Attachment error"),String.format(_("Cannot upload attachment, the total attachment size is {0} while the allowed maximum is {1}"),
Ext.util.Format.fileSize(h),Ext.util.Format.fileSize(g)),b),!1;c=d.getMaxFileUploads();d=d.getMaxPostRequestSize();if(Ext.isDefined(d)&&e>d)return container.getNotifier().notify("error.attachment",_("Attachment error"),String.format(_("Cannot upload attachment, total attachment is {0} while the allowed maximum attachment in single request is {1}."),Ext.util.Format.fileSize(e),Ext.util.Format.fileSize(d)),b),!1;d=a.length;return Ext.isDefined(c)&&d>c?(container.getNotifier().notify("error.attachment",
_("Attachment error"),String.format(_("Cannot upload attachment, total attachments are {0} files while the maximum {1} files are allowed in single request."),d,c),b),!1):!0},uploadFiles:function(a,b,c,d){var e=[],f=[],g=Zarafa.core.BrowserWindowMgr.getActive()||window,g=a instanceof g.FileList,h={handledfiles:[]};Zarafa.core.data.ZarafaCustomEventDispatcher.fireEvent("attachmentstorebeforeupload",this,a,b,c,d,h);for(var k=0;k<a.length;k++){var l=a[k];if(-1===h.handledfiles.indexOf(l)){var m;g?(f.push(l),
m=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(this.attachmentRecordType,{name:l.name,size:l.size,filetype:l.type,hidden:Ext.isDefined(c)?c:!1,attach_method:Zarafa.core.mapi.AttachMethod.ATTACH_BY_VALUE})):m=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(this.attachmentRecordType,{name:Ext.util.Format.basename(l),hidden:Ext.isDefined(c)?c:!1});m.file=l;e.push(m)}}this.add(e);a={};a=Ext.apply(a,d);g&&(a.attachments=f);b={params:a,requestUrl:this.getUploadAttachmentUrl(),
requestForm:b};this.batch&&this.addToBatch(++this.batchCounter);0<e.length&&(d=Ext.data.Api.actions.create,f=this.createCallback(d,e,!1),this.proxy.request(d,e,b.params,this.reader,f,this,b))},addEmbeddedAttachment:function(a){var b={entryid:a.get("entryid"),store_entryid:a.get("store_entryid"),attach_method:Zarafa.core.mapi.AttachMethod.ATTACH_EMBEDDED_MSG};Ext.isEmpty(a.get("subject"))||(b.name=a.get("subject"));Ext.isEmpty(a.get("message_class"))||(b.attach_message_class=a.get("message_class"));
Ext.isEmpty(a.get("message_size"))||(b.size=a.get("message_size"));a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.mapi.ObjectType.MAPI_ATTACH,b);this.add(a);var b={params:a.data,requestUrl:this.getUploadAttachmentUrl()},c=Ext.data.Api.actions.create,d=this.createCallback(c,a,!1);this.proxy.request(c,a,b.params,this.reader,d,this,b)},destroyRecord:function(a,b,c){Zarafa.core.data.IPMAttachmentStore.superclass.destroyRecord.apply(this,arguments);var d={};b.isTmpFile()?(d.deleteattachment=
!0,d.attach_num=b.get("tmpname")):(d.deleteattachment=!0,d.attach_num=b.get("attach_num"));var d={params:d,requestUrl:this.getUploadAttachmentUrl()},e={options:d};Zarafa.core.data.ZarafaCustomEventDispatcher.fireEvent("attachmentstorebeforedestroyrecord",this,b,e);var f=Ext.data.Api.actions.destroy,g=this.createCallback(f,b,!1);this.proxy.request(f,b,d.params,this.reader,g,this,e.options)},importRecord:function(a,b,c){a={params:{},requestUrl:this.getImportAttachmentUrl(a,c)};c=this.createCallback("import",
c,!1);this.proxy.request("import",b,a.params,this.reader,c,this,a)},handleException:Ext.data.Store.prototype.handleException,createCallback:Ext.data.Store.prototype.createCallback,onCreateRecords:Ext.data.Store.prototype.onCreateRecords,onDestroyRecords:Ext.data.Store.prototype.onDestroyRecords,reMap:Ext.data.Store.prototype.reMap,addToBatch:Ext.emptyFn,removeFromBatch:Ext.emptyFn,onImportRecords:function(a,b,c){!0===a?container.getNotifier().notify("info.import",_("Import"),String.format(_("Successfully imported item(s) to {0}"),
b.get("display_name"))):container.getNotifier().notify("info.import",_("Import"),String.format(_("Failed to import item(s) to {0}"),b.get("display_name")))}});Ext.namespace("Zarafa.core.data");Zarafa.core.data.IPMExpandDistlistRecord=Ext.data.Record.create([{name:"display_name"},{name:"address_type"},{name:"smtp_address"},{name:"email_address"},{name:"entryid"},{name:"search_key"},{name:"object_type",type:"int"},{name:"display_type",type:"int"},{name:"display_type_ex",type:"int"}]);
Zarafa.core.data.IPMExpandDistlistRecord=Ext.extend(Zarafa.core.data.IPMExpandDistlistRecord,{convertToRecipient:function(a){return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{object_type:this.get("object_type"),display_name:this.get("display_name"),email_address:this.get("email_address"),smtp_address:this.get("smtp_address"),address_type:this.get("address_type"),entryid:this.get("entryid"),search_key:this.get("search_key"),
display_type_ex:this.get("display_type_ex"),recipient_type:a||Zarafa.core.mapi.RecipientType.MAPI_TO})}});Ext.namespace("Zarafa.core.data");Zarafa.core.data.IPMExpandDistlistResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doExpand:function(a){a=a.results||[];Array.isArray(a)||(a=[a]);this.receivedRecords=this.reader.readRecords({result:a}).records}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMNotificationResponseHandler=Ext.extend(Zarafa.core.data.AbstractNotificationResponseHandler,{doUpdate:function(a){if(a=this.reader.readResponse(Ext.data.Api.actions.read,a)){a=a.data;for(var b=0,c=a.length;b<c;b++){var d=a[b],e=this.store.getById(d.entryid);Ext.isDefined(e)?this.addNotification(Zarafa.core.data.Notifications.objectModified,e,d):this.addNotification(Zarafa.core.data.Notifications.objectCreated,null,d)}}},doDelete:function(a){a=a.item;Array.isArray(a)||(a=[a]);for(var b=
0,c=a.length;b<c;b++){var d=a[b],e=this.store.getById(d.entryid);e&&this.addNotification(Zarafa.core.data.Notifications.objectDeleted,e,d)}},doNewobject:function(a){var b=Ext.pluck(a.item,"entryid"),b=Zarafa.core.data.IPMStoreMgr.getStoresForFolders(b);this.addNotification(Zarafa.core.data.Notifications.objectCreated,b,a)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMRecipientRecordFields=[{name:"entryid"},{name:"search_key"},{name:"rowid",type:"int"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_MAILUSER},{name:"display_name"},{name:"display_type",type:"int",defaultValue:Zarafa.core.mapi.DisplayType.DT_MAILUSER},{name:"display_type_ex",type:"int",defaultValue:Zarafa.core.mapi.DisplayType.DT_MAILUSER},{name:"email_address"},{name:"smtp_address"},{name:"address_type",type:"string",defaultValue:"SMTP"},{name:"presence_status",
type:"int"},{name:"recipient_type",type:"int"},{name:"recipient_flags",type:"int"},{name:"recipient_trackstatus",type:"int"},{name:"recipient_trackstatus_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"proposednewtime",type:"boolean",defaultValue:!1},{name:"proposednewtime_start",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"proposednewtime_end",type:"date",dateFormat:"timestamp",defaultValue:null}];
Zarafa.core.data.IPMRecipientRecord=Ext.extend(Ext.data.Record,{resolveAttempted:!1,resolveAttemptAmbiguous:!1,copy:function(a){a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,this.data,a||this.id);a.phantom=this.phantom;return a.applyData(this)},applyData:function(a){this.beginEdit();Ext.apply(this.data,a.data);Ext.apply(this.modified,a.modified);this.resolveAttempted=a.resolveAttempted;this.resolveAttemptAmbiguous=a.resolveAttemptAmbiguous;
this.dirty=a.dirty;this.endEdit(!1);return this},isValid:function(){return this.isMeetingOrganizer()?!1:Zarafa.core.data.IPMRecipientRecord.superclass.isValid.call(this)},resolve:function(){this.store&&this.store.resolve(this)},isResolved:function(){return!Ext.isEmpty(this.get("entryid"))},isOneOff:function(){return Zarafa.core.EntryId.isOneOffEntryId(this.get("entryid"))},isValidSMTP:function(){return Zarafa.core.Util.validateEmailAddress(this.get("smtp_address"))},isAmbiguous:function(){return this.resolveAttempted&&
this.resolveAttemptAmbiguous},isPersonalContact:function(){return this.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_MAILUSER&&Zarafa.core.EntryId.hasContactProviderGUID(this.get("entryid"))?!0:!1},isPersonalDistList:function(){return this.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&Zarafa.core.EntryId.hasContactProviderGUID(this.get("entryid"))?!0:!1},attemptedToResolve:function(){return this.resolveAttempted},isMeetingOrganizer:function(){return(this.get("recipient_flags")&
Zarafa.core.mapi.RecipientFlags.recipOrganizer)===Zarafa.core.mapi.RecipientFlags.recipOrganizer},equals:function(a){var b=this.get("smtp_address"),c=a.get("smtp_address");if(Ext.isEmpty(b)||Ext.isEmpty(c))b=this.get("display_name")||"",c=a.get("display_name")||"";return b.toUpperCase()==c.toUpperCase()?!0:!1},convertToABRecord:function(){var a=Zarafa.core.mapi.ObjectType.MAPI_MAILUSER;if(!this.isResolved())return!1;var b=this.get("entryid"),c=this.get("display_type");switch(c){case Zarafa.core.mapi.DisplayType.DT_MAILUSER:case Zarafa.core.mapi.DisplayType.DT_REMOTE_MAILUSER:a=
Zarafa.core.mapi.ObjectType.MAPI_MAILUSER;break;case Zarafa.core.mapi.DisplayType.DT_DISTLIST:case Zarafa.core.mapi.DisplayType.DT_ORGANIZATION:case Zarafa.core.mapi.DisplayType.DT_PRIVATE_DISTLIST:a=Zarafa.core.mapi.ObjectType.MAPI_DISTLIST}return Zarafa.core.data.RecordFactory.createRecordObjectByObjectType(a,{entryid:b,display_type:c,display_type_ex:this.get("display_type_ex")},b)},convertToContactRecord:function(){var a=this.get("entryid"),b=a.indexOf("_");0<b&&(a=a.substr(0,b));Zarafa.core.EntryId.hasContactProviderGUID(a)&&
(a=Zarafa.core.EntryId.unwrapContactProviderEntryId(a));return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Contact",{entryid:a,message_class:"IPM.Contact",object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,store_entryid:this.get("store_entryid"),parent_entryid:this.get("parent_entryid")},a)},convertToDistListRecord:function(){var a=this.get("entryid"),b=a.indexOf("_");0<b&&(a=a.substr(0,b));Zarafa.core.EntryId.hasContactProviderGUID(a)&&(a=Zarafa.core.EntryId.unwrapContactProviderEntryId(a));
return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.DistList",{entryid:a,message_class:"IPM.DistList",object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,store_entryid:this.get("store_entryid"),parent_entryid:this.get("parent_entryid")},a)},applyResolveRecord:function(a,b){this.beginEdit();this.set("entryid",a.get("entryid"));this.set("display_name",a.get("display_name"));this.set("smtp_address",a.get("smtp_address"));this.set("email_address",a.get("email_address"));this.set("object_type",
a.get("object_type"));this.set("display_type",a.get("display_type"));this.set("display_type_ex",a.get("display_type_ex"));this.set("address_type",a.get("address_type"));this.set("search_key",a.get("search_key"));this.endEdit();Ext.isDefined(b)&&!1!==b||this.store.fireEvent("resolved",this.store,[this])},getDisplayType:function(){var a=this.get("display_type"),b=this.get("display_type_ex");switch(a){case Zarafa.core.mapi.DisplayType.DT_MAILUSER:case Zarafa.core.mapi.DisplayType.DT_DISTLIST:a=b&~Zarafa.core.mapi.DisplayTypeEx.DTE_FLAG_ACL_CAPABLE}return a},
formatRecipient:function(a){var b=[],c=this.get("display_name"),d=this.get("smtp_address");Ext.isEmpty(c)||b.push(c);Ext.isEmpty(d)||c==d||b.push("<"+d+">");b=b.join(" ");a&&(b=Ext.util.Format.htmlEncode(b));return b},generateOneOffEntryId:function(){var a=this.get("display_name"),b=this.get("address_type"),c=this.get("smtp_address");this.set("entryid",Zarafa.core.EntryId.createOneOffEntryId(a,b,c))},endEdit:function(a){this.editing=!1;!1!==a&&(this.resolveAttemptAmbiguous=this.resolveAttempted=!1);
this.dirty&&this.afterEdit()}});Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_RECIPIENT");Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,Zarafa.core.data.IPMRecipientRecord);Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,Zarafa.core.data.IPMRecipientRecordFields);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMRecipientResolveResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doChecknames:function(a){this.receivedRecords=[];if(Ext.isDefined(a.resolveresponse))for(var b=0;b<a.resolveresponse.length;b++)this.receivedRecords.push({id:a.resolveresponse[b].id,result:this.readRecordsFromResponse(a.resolveresponse[b],"result")})},readRecordsFromResponse:function(a,b){var c=a[b]||[];Array.isArray(c)||(c=[c]);var d={};d[b]=c;return this.reader.readRecords(d)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doList:function(a){a.folder&&(this.metaData.folder=Ext.apply({},a.folder));this.receivedRecords=this.readRecordsFromResponse(a,"item")},doUpdatelist:function(a){a.folder&&(this.metaData.folder=Ext.apply({},a.folder));this.receivedRecords=this.readRecordsFromResponse(a,"item")},doItem:function(a){this.receivedRecords=this.receivedRecords.concat(this.correlateRecordFromResponse(a))},doUpdate:function(a){this.receivedRecords=
this.receivedRecords.concat(this.correlateRecordFromResponse(a))},doSearch:function(a){this.receivedRecords=this.readRecordsFromResponse(a,"item");Ext.iterate(a,function(a,c){"item"!=a&&(this.metaData[a]=c)},this)},doUpdatesearch:function(a){this.receivedRecords=this.readRecordsFromResponse(a,"item");Ext.iterate(a,function(a,c){"item"!=a&&(this.metaData[a]=c)},this);Ext.apply(this.options,{add:!0})},doStopsearch:function(a){this.receivedRecords=this.readRecordsFromResponse(a,"item")},doSearch_error:function(a){this.doError(a);
return!1},compareResponseDataToRecord:function(a,b){if(!b.phantom)if(!Ext.isEmpty(b.get("attach_num"))){if(Zarafa.core.EntryId.compareEntryIds(a.entryid,b.get("entryid"))&&b.get("attach_num").equals(a.props.attach_num))return!0}else if(Ext.isDefined(a.props.task_goid)&&!Zarafa.core.EntryId.compareEntryIds(a.entryid,b.get("entryid"))&&b.get("task_goid")===a.props.task_goid)return!0;return Zarafa.core.data.IPMResponseHandler.superclass.compareResponseDataToRecord.apply(this,arguments)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.JsonRecipientReader=Ext.extend(Zarafa.core.data.JsonReader,{customObjectType:Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,constructor:function(a,b){a=Ext.applyIf(a||{},{id:"rowid",idProperty:"rowid",dynamicRecord:!1});Ext.isDefined(b)||(b=Zarafa.core.data.RecordFactory.getRecordClassByCustomType(a.customObjectType||this.customObjectType));Zarafa.core.data.JsonRecipientReader.superclass.constructor.call(this,a,b)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.ListModuleStore=Ext.extend(Zarafa.core.data.IPMStore,{hasSearchResults:!1,useSearchFolder:!1,actionType:void 0,subfolders:!1,entryId:void 0,storeEntryId:void 0,folder:void 0,syncStore:!1,totalLoadedRecord:void 0,loadMask:void 0,preferredMessageClass:"IPM.Note",defaultSortInfo:void 0,searchUpdateTimer:void 0,constructor:function(a){a=a||{};a.restriction={};a.preferredMessageClass=a.preferredMessageClass||this.preferredMessageClass;var b=Zarafa.core.ModuleNames.getModule(a.preferredMessageClass,
!0);Ext.isEmpty(b)&&a.preferredMessageClass!=this.preferredMessageClass&&(b=Zarafa.core.ModuleNames.getModule(this.preferredMessageClass,!0));var c=Zarafa.core.data.RecordFactory.getRecordClassByMessageClass(a.preferredMessageClass);Ext.applyIf(a,{remoteSort:!0,actionType:Zarafa.core.Actions.list,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.core.data.JsonReader({},c),proxy:new Zarafa.core.data.IPMProxy({listModuleName:b.list,itemModuleName:b.item})});this.addEvents("search","beforeupdatesearch",
"updatesearch","stopsearch");this.totalLoadedRecord=container.getSettingsModel().get("zarafa/v1/main/page_size");Zarafa.core.data.ListModuleStore.superclass.constructor.call(this,a);Ext.isEmpty(this.folder)||this.setFolder(this.folder)},idComparison:function(a,b){return Zarafa.core.EntryId.compareEntryIds(a,b)},setActionType:function(a){this.actionType=a},setFolder:function(a){Ext.each(a,function(a,c){this.setEntryId(a.get("entryid"),0!==c);this.setStoreEntryId(a.get("store_entryid"),0!==c)},this)},
setEntryId:function(a,b){!Ext.isEmpty(b)&&b?(Ext.isEmpty(this.entryId)&&(this.entryId=[]),Ext.isEmpty(this.entryId)||Array.isArray(this.entryId)||(this.entryId=[this.entryId]),this.entryId.push(a)):this.entryId=a},getEntryId:function(){return this.entryId},setStoreEntryId:function(a,b){!Ext.isEmpty(b)&&b?(Ext.isEmpty(this.storeEntryId)&&(this.storeEntryId=[]),Ext.isEmpty(this.storeEntryId)||Array.isArray(this.storeEntryId)||(this.storeEntryId=[this.storeEntryId]),this.storeEntryId.push(a)):this.storeEntryId=
a},getStoreEntryId:function(){return this.storeEntryId},setRestriction:function(a){this.restriction=a},setSearchRestriction:function(a){Ext.isEmpty(a)?delete this.restriction.search:this.restriction=Ext.apply(this.restriction||{},{search:a})},setSubfolders:function(a){this.subfolders=a},setUseSearchFolder:function(a){this.useSearchFolder=a},load:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isDefined(a.cancelPreviousRequest)||(a.cancelPreviousRequest=!0);this.hasSearchResults||
(Ext.isEmpty(a.folder)?Ext.isDefined(a.params.entryid)&&Ext.isDefined(a.params.store_entryid)&&(this.setEntryId(a.params.entryid,!1),this.setStoreEntryId(a.params.store_entryid,!1)):this.setFolder(a.folder));Ext.apply(a.params,{entryid:this.entryId,search_folder_entryid:this.searchFolderEntryId,store_entryid:this.storeEntryId});Ext.applyIf(a,{actionType:this.actionType});Ext.applyIf(a.params,{restriction:this.restriction});this.restriction.search&&(this.isAdvanceSearchStore()?a.params.restriction=
Ext.apply(a.params.restriction||{},{search:this.restriction.search}):delete a.params.restriction.search);a.actionType==Zarafa.core.Actions.search&&Ext.applyIf(a.params,{use_searchfolder:this.useSearchFolder,subfolders:this.subfolders,forceCreateSearchFolder:a.forceCreateSearchFolder});a.actionType==Zarafa.core.Actions.list&&Array.isArray(a.params.restriction.search)&&Ext.isDefined(a.params.search_folder_entryid)&&delete a.params.restriction.search;a.actionType!=Zarafa.core.Actions.updatesearch&&a.actionType!=
Zarafa.core.Actions.stopsearch||delete a.params.restriction;a.actionType==Zarafa.core.Actions.list&&Array.isArray(a.params.restriction.search)&&Ext.isDefined(this.searchFolderEntryId)&&this.useSearchFolder&&delete a.params.restriction.search;return Zarafa.core.data.ListModuleStore.superclass.load.call(this,a)},reload:function(a){this.hasSearchResults?this.updateSearch(Ext.applyIf(a||{},this.lastOptions)):Zarafa.core.data.ListModuleStore.superclass.reload.apply(this,arguments)},isAdvanceSearchStore:function(){return"IPM.Search"===
this.preferredMessageClass},liveScroll:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});this.isExecuting("list")&&this.proxy.cancelRequests("list");Ext.apply(a,{actionType:Zarafa.core.Actions.updatelist});Ext.isDefined(this.searchFolderEntryId)&&this.useSearchFolder&&delete this.restriction.search;this.load(a)},stopLiveScroll:function(){var a=this.lastOptions.params.restriction;this.isExecuting("updatelist")&&this.proxy.cancelRequests("updatelist");Ext.apply(this.lastOptions,
{actionType:Zarafa.core.Actions.list});Ext.apply(a,{start:0});Ext.isDefined(a)&&delete a.limit;delete this.lastOptions.add},search:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isEmpty(a.searchRestriction)||(this.setSearchRestriction(a.searchRestriction),this.isExecuting("list")&&this.proxy.cancelRequests("list"),this.setUseSearchFolder(a.useSearchFolder),this.setSubfolders(a.subfolders),this.useSearchFolder&&Ext.apply(a,{actionType:Zarafa.core.Actions.search}),this.load(a),
this.useSearchFolder&&(this.hasSearchResults=!0),this.fireEvent("search",this,a))},updateSearch:function(a){this.hasSearchResults&&(Ext.isObject(a)||(a={}),Ext.apply(a,{actionType:Zarafa.core.Actions.updatesearch}),this.load(a),this.fireEvent("updatesearch",this,a),Ext.apply(this.lastOptions,{actionType:Zarafa.core.Actions.search,originalActionType:Zarafa.core.Actions.updatesearch}))},stopSearch:function(a){this.setSearchRestriction({});if(this.hasSearchResults){Ext.isObject(a)||(a={});Ext.isObject(a.params)||
(a.params={});if(this.isExecuting(Zarafa.core.Actions.updatesearch)||this.isExecuting(Zarafa.core.Actions.search))this.proxy.cancelRequests(Zarafa.core.Actions.updatesearch),this.proxy.cancelRequests(Zarafa.core.Actions.search);this.searchUpdateTimer&&(clearTimeout(this.searchUpdateTimer),delete this.searchUpdateTimer);Ext.apply(a,{actionType:Zarafa.core.Actions.stopsearch});Ext.apply(a.params,{store_entryid:this.storeEntryId,search_folder_entryid:this.searchFolderEntryId});this.proxy.request(Ext.data.Api.actions.destroy,
null,a.params,this.reader,Ext.emptyFn,this,a);this.setSearchEntryId(void 0);this.hasSearchResults=!1;this.fireEvent("stopsearch",this,a);Ext.apply(this.lastOptions,{actionType:Zarafa.core.Actions.list})}},loadRecords:function(a,b,c,d){if(!1!==c){var e;Ext.isDefined(b.params)&&Ext.isDefined(b.params.restriction)&&(e=b.params.restriction);var f=container.getSettingsModel().get("zarafa/v1/main/page_size");e&&(this.totalLoadedRecord=e.start?e.start+e.limit:f,this.syncStore&&(e.start=this.totalLoadedRecord-
f,delete e.limit,delete this.lastOptions.add,this.syncStore=!1));d&&(d.search_meta&&this.updateSearchInfo(d.search_meta,d.page),d.page&&(this.totalLength=d.page.totalrowcount),d.folder&&b.folder&&1===b.folder.length&&(e=b.folder[0],Ext.isDefined(d.folder.content_unread)&&e.set("content_unread",d.folder.content_unread),Ext.isDefined(d.folder.content_count)&&e.set("content_count",d.folder.content_count)))}Zarafa.core.data.ListModuleStore.superclass.loadRecords.apply(this,arguments)},updateSearchInfo:function(a,
b){var c={entryId:a.searchfolder_entryid,searchState:parseInt(a.searchstate,10),results:parseInt(a.results,10)};Ext.isEmpty(b)||Ext.apply(c,{page:{start:parseInt(b.start,10),rowCount:parseInt(b.rowcount,10),totalRowCount:parseInt(b.totalrowcount,10)}});this.fireEvent("beforeupdatesearch",this,c);this.setSearchEntryId(c.entryId);this.setSearchStoreEntryId(a.search_store_entryid);Zarafa.core.mapi.Search.isSearchRunning(c.searchState)?this.searchUpdateTimer=this.updateSearch.defer(container.getSettingsModel().get("zarafa/v1/contexts/search/updatesearch_timeout"),
this):delete this.searchUpdateTimer},showLoadMask:function(){if(!this.loadMask){var a=container.getContentPanel();Ext.isFunction(a.getGridPanel)&&(this.loadMask=a.getGridPanel().loadMask,this.loadMask.show())}}});Ext.reg("zarafa.listmodulestore",Zarafa.core.data.ListModuleStore);Ext.namespace("Zarafa.core.data");
Zarafa.core.data.RestrictionFactory={createResAnd:function(a){return[Zarafa.core.mapi.Restrictions.RES_AND,a.clone()]},createResOr:function(a){return[Zarafa.core.mapi.Restrictions.RES_OR,a.clone()]},createResNot:function(a){return[Zarafa.core.mapi.Restrictions.RES_NOT,a]},createResCompareProps:function(a,b){var c=[],d=Zarafa.core.mapi.Restrictions.RES_COMPAREPROPS,e={};e[Zarafa.core.mapi.Restrictions.ULPROPTAG1]=a;e[Zarafa.core.mapi.Restrictions.ULPROPTAG2]=b;c.push(d);c.push(e);return c},createResSubRestriction:function(a,
b){var c=[],d=Zarafa.core.mapi.Restrictions.RES_SUBRESTRICTION,e={};e[Zarafa.core.mapi.Restrictions.ULPROPTAG]=a;e[Zarafa.core.mapi.Restrictions.RESTRICTION]=b;c.push(d);c.push(e);return c},createPropertyObject:function(a,b,c){var d=[];Ext.isEmpty(c)&&(c=a);d[Zarafa.core.mapi.Restrictions.ULPROPTAG]=a;d[Zarafa.core.mapi.Restrictions.VALUE]={};d[Zarafa.core.mapi.Restrictions.VALUE][c]=b;return d},dataResComment:function(a,b){var c=[],d=Zarafa.core.mapi.Restrictions.RES_COMMENT,e={};e[Zarafa.core.mapi.Restrictions.RESTRICTION]=
a;e[Zarafa.core.mapi.Restrictions.PROPS]=b;c.push(d);c.push(e);return c},dataResProperty:function(a,b,c,d){var e=[],f=Zarafa.core.mapi.Restrictions.RES_PROPERTY,g={};Ext.isEmpty(d)&&(d=a);g[Zarafa.core.mapi.Restrictions.RELOP]=b;g[Zarafa.core.mapi.Restrictions.ULPROPTAG]=a;g[Zarafa.core.mapi.Restrictions.VALUE]={};g[Zarafa.core.mapi.Restrictions.VALUE][d]=c;e.push(f);e.push(g);return e},dataResExist:function(a){var b=[],c=Zarafa.core.mapi.Restrictions.RES_EXIST,d={};d[Zarafa.core.mapi.Restrictions.ULPROPTAG]=
a;b.push(c);b.push(d);return b},dataResSize:function(a,b,c){var d=[],e=Zarafa.core.mapi.Restrictions.RES_SIZE,f={};f[Zarafa.core.mapi.Restrictions.ULPROPTAG]=a;f[Zarafa.core.mapi.Restrictions.RELOP]=b;f[Zarafa.core.mapi.Restrictions.CB]=c;d.push(e);d.push(f);return d},dataResBitmask:function(a,b,c){var d=[],e=Zarafa.core.mapi.Restrictions.RES_BITMASK,f={};f[Zarafa.core.mapi.Restrictions.ULPROPTAG]=a;f[Zarafa.core.mapi.Restrictions.ULTYPE]=b;f[Zarafa.core.mapi.Restrictions.ULMASK]=c;d.push(e);d.push(f);
return d},dataResContent:function(a,b,c,d){var e=[],f=Zarafa.core.mapi.Restrictions.RES_CONTENT,g={};Ext.isEmpty(d)&&(d=a);g[Zarafa.core.mapi.Restrictions.FUZZYLEVEL]=Zarafa.core.mapi.Restrictions.FL_FULLSTRING;Ext.isObject(b)?Ext.each(b,function(a){g[Zarafa.core.mapi.Restrictions.FUZZYLEVEL]+=a}):g[Zarafa.core.mapi.Restrictions.FUZZYLEVEL]=b;g[Zarafa.core.mapi.Restrictions.ULPROPTAG]=a;g[Zarafa.core.mapi.Restrictions.VALUE]={};g[Zarafa.core.mapi.Restrictions.VALUE][d]=c;e.push(f);e.push(g);return e}};
Ext.namespace("Zarafa.core.ui");
Zarafa.core.ui.MessageContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{sendValidationQueue:void 0,sendingText:{msg:_("Sending")+"..."},sendingDoneText:{title:_("Sent"),msg:_("Sent successfully")},isSending:!1,closeOnSend:!1,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push({ptype:"zarafa.markasreadplugin",ignoreReadFlagTimer:!0});this.addEvents("beforesendrecord","sendrecord","aftersendrecord");Zarafa.core.ui.MessageContentPanel.superclass.constructor.call(this,a);
this.createSendValidationQueue();Ext.isString(this.sendingText)&&(this.sendingText={title:"",msg:this.sendingText});Ext.isString(this.sendingDoneText)&&(this.sendingDoneText={title:"",msg:this.sendingDoneText});if(this.record&&(a=this.record.getStore()))a.on("update",this.syncUpdatesToShadowStore,this)},syncUpdatesToShadowStore:function(a,b,c){Zarafa.core.EntryId.compareEntryIds(b.get("entryid"),this.record.get("entryid"))&&c===Ext.data.Record.COMMIT&&(a=b.get("message_flags"),b=b.get("categories"),
c=!1,this.record.setUpdateModificationsTracking(!1),this.record.beginEdit(),this.record.get("message_flags")!==a&&(this.record.set("message_flags",a),c=!0),this.record.get("categories")!==b&&(this.record.set("categories",b),c=!0),this.record.endEdit(),c&&this.record.commit(),this.record.setUpdateModificationsTracking(!0))},createSendValidationQueue:function(){this.sendValidationQueue=new Zarafa.core.data.CallbackQueue;this.sendValidationQueue.add(this.validateEmptyRecipients,this);this.sendValidationQueue.add(this.validateEmptySubject,
this);this.sendValidationQueue.add(this.validateResolvedRecipients,this);this.sendValidationQueue.add(this.validateAttachmentUpload,this)},displayInfoMask:function(){!1!==this.showInfoMask&&(this.record.hasMessageAction("send")||this.record.getMessageAction("sendResponse")?container.getNotifier().notify("info.sending",this.sendingText.title,this.sendingText.msg,{container:this.getEl()}):Zarafa.core.ui.MessageContentPanel.superclass.displayInfoMask.apply(this,arguments))},hideInfoMask:function(a){!1!==
this.showInfoMask&&(this.record.hasMessageAction("send")||this.record.getMessageAction("sendResponse")?!1!==a&&container.getNotifier().notify("info.sent",this.sendingDoneText.title,this.sendingDoneText.msg):Zarafa.core.ui.MessageContentPanel.superclass.hideInfoMask.apply(this,arguments))},onBeforeSaveRecord:function(a,b){b&&(b.update&&0<=b.update.indexOf(this.record)||b.create&&0<=b.create.indexOf(this.record))&&(this.isSending=this.record.hasMessageAction("send")||this.record.hasMessageAction("sendResponse"));
Zarafa.core.ui.MessageContentPanel.superclass.onBeforeSaveRecord.apply(this,arguments)},onUpdateRecord:function(a,b,c){Zarafa.core.ui.MessageContentPanel.superclass.onUpdateRecord.apply(this,arguments);var d=this.isSending;if(b==Ext.data.Record.COMMIT){var e=c.hasMessageAction("send")||this.record.hasMessageAction("sendResponse");e&&(this.fireEvent("aftersendrecord",this,this.record),this.isSending=!1);if(d&&this.closeOnSend&&e)return this.close(),!1}},onExceptionRecord:function(a,b,c,d,e,f){Zarafa.core.ui.MessageContentPanel.superclass.onExceptionRecord.apply(this,
arguments);"open"!==b&&(this.isSending=!1)},sendRecord:function(){if(!0===this.isSaving)this.on("aftersaverecord",this.onAfterSaveRecord,this,{single:!0});else!1!==this.recordComponentPlugin.allowWrite&&!0!==this.isSending&&!1!==this.fireEvent("beforesendrecord",this,this.record)&&(this.isSending=!0,this.sendValidationQueue.run(this.onCompleteValidateSendRecord,this))},onAfterSaveRecord:function(a,b){var c=b.getStore();this.mon(c,"write",this.sendRecord,this,{single:!0})},validateEmptyRecipients:function(a){var b=
this.record.getRecipientStore();if(Ext.isDefined(b)&&0!==b.getCount()){var c=!0;b.each(function(a){if(a.get("recipient_type")!==Zarafa.core.mapi.RecipientType.MAPI_ORIG)return c=!1},this);c?(container.getNotifier().notify("warning.sending",_("Kopano WebApp"),_("Please specify a recipient")),a(!1)):a(!0)}else container.getNotifier().notify("warning.sending",_("Kopano WebApp"),_("Please specify a recipient")),a(!1)},validateAttachmentUpload:function(a){var b=!0;this.record.getAttachmentStore().each(function(a){if(!a.isUploaded())return b=
!1},this);if(b)a(!0);else{var c=_("The attached files are not uploaded yet."),c=c+"<br/>"+_("Do you want to send this message without attachments?");Zarafa.common.dialogs.MessageBox.addCustomButtons({title:_("Kopano WebApp"),icon:Ext.MessageBox.WARNING,msg:c,fn:function(b){a("sendanyway"===b)},customButton:[{text:_("Don't Send"),name:"dontsend"},{text:_("Send Anyway"),name:"sendanyway"}]})}},validateEmptySubject:function(a){Ext.isEmpty(this.record.get("subject"))?Ext.MessageBox.confirm(_("Kopano WebApp"),
_("Send this message without a subject?"),function(b){a("yes"==b)},this):a(!0)},validateResolvedRecipients:function(a){var b=this.record.getRecipientStore(),c=b.getUnresolvedRecipients(),d=b.getInvalidRecipients();Ext.isEmpty(d)?Ext.isEmpty(c)?a(!0):(this.mon(b,"resolved",this.validateResolvedRecipients.createDelegate(this,[a],!1),this,{single:!0}),b.resolve(c,{cancelPreviousRequest:!0})):(container.getNotifier().notify("warning.sending","",_("Not all recipients could be resolved")),a(!1))},onCompleteValidateSendRecord:function(a){a?
(this.record.addMessageAction("send",!0),!1!==this.saveRecord()&&this.fireEvent("sendrecord",this,this.record)):this.isSending=!1}});Ext.reg("zarafa.messagecontentpanel",Zarafa.core.ui.MessageContentPanel);Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.DropdownBoxPlugin=Ext.extend(Zarafa.core.ui.notifier.SliderNotifierPlugin,{constructor:function(a){a=a||{};Ext.applyIf(a,{itemCls:"zarafa-notifier-dropdown-item",sliderContainerPosition:"t"});Zarafa.core.ui.notifier.DropdownBoxPlugin.superclass.constructor.call(this,a)}});
Zarafa.onReady(function(){container.getNotifier().registerPlugin("dropdown",new Zarafa.core.ui.notifier.DropdownBoxPlugin);container.getNotifier().registerPlugin("eventdropdown",new Zarafa.core.ui.notifier.DropdownBoxPlugin);container.getNotifier().registerPlugin("persistentmessageplugin",new Zarafa.core.ui.notifier.DropdownBoxPlugin);container.getNotifier().registerPlugin("dialognotifier",new Zarafa.core.ui.notifier.DropdownBoxPlugin)});Ext.namespace("Zarafa.core.ui.notifier");
Zarafa.core.ui.notifier.PopupBoxPlugin=Ext.extend(Zarafa.core.ui.notifier.SliderNotifierPlugin,{constructor:function(a){a=a||{};Ext.apply(a,{itemCls:"zarafa-notifier-popup-item",sliderContainerPosition:"br",msgLifetime:5});Zarafa.core.ui.notifier.PopupBoxPlugin.superclass.constructor.call(this,a)}});Zarafa.onReady(function(){container.getNotifier().registerPlugin("popup",new Zarafa.core.ui.notifier.PopupBoxPlugin)});Ext.namespace("Zarafa.common.attachment.dialogs");
Zarafa.common.attachment.dialogs.ImportToFolderContentPanel=Ext.extend(Zarafa.common.dialogs.CopyMoveContentPanel,{constructor:function(a){a=a||{};a.record&&!Array.isArray(a.record)&&(a.record=[a.record]);Ext.applyIf(a,{xtype:"zarafa.importtofoldercontentpanel",title:_("Import to"),items:[{xtype:"zarafa.importtofolderpanel",record:a.record}]});Zarafa.common.attachment.dialogs.ImportToFolderContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.importtofoldercontentpanel",Zarafa.common.attachment.dialogs.ImportToFolderContentPanel);
Ext.namespace("Zarafa.common.data");
Zarafa.common.data.ImportanceFlags={flags:[{value:Zarafa.core.mapi.Importance.NONURGENT,name:Zarafa.core.mapi.Importance.getDisplayName(Zarafa.core.mapi.Importance.NONURGENT),iconCls:Zarafa.core.mapi.Importance.getClassName(Zarafa.core.mapi.Importance.NONURGENT)},{value:Zarafa.core.mapi.Importance.NORMAL,name:Zarafa.core.mapi.Importance.getDisplayName(Zarafa.core.mapi.Importance.NORMAL),iconCls:Zarafa.core.mapi.Importance.getClassName(Zarafa.core.mapi.Importance.NORMAL)},{value:Zarafa.core.mapi.Importance.URGENT,
name:Zarafa.core.mapi.Importance.getDisplayName(Zarafa.core.mapi.Importance.URGENT),iconCls:Zarafa.core.mapi.Importance.getClassName(Zarafa.core.mapi.Importance.URGENT)}]};Ext.namespace("Zarafa.common.data");
Zarafa.common.data.SensitivityFlags={flags:[{value:Zarafa.core.mapi.Sensitivity.NONE,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.NONE)},{value:Zarafa.core.mapi.Sensitivity.PERSONAL,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.PERSONAL)},{value:Zarafa.core.mapi.Sensitivity.PRIVATE,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.PRIVATE)},{value:Zarafa.core.mapi.Sensitivity.COMPANY_CONFIDENTIAL,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.COMPANY_CONFIDENTIAL)}]};
Ext.namespace("Zarafa.common.delegates.data");Zarafa.common.delegates.data.DelegatePermissionProfiles=[{value:Zarafa.core.mapi.Rights.RIGHTS_OWNER,name:_("Owner")},{value:Zarafa.core.mapi.Rights.RIGHTS_SECRETARY,name:_("Secretary")},{value:Zarafa.core.mapi.Rights.RIGHTS_READONLY,name:_("Only read")},{value:Zarafa.core.mapi.Rights.RIGHTS_NONE,name:_("None")}];Ext.namespace("Zarafa.common.delegates.data");
Zarafa.common.delegates.data.DelegateRecordFields=[{name:"entryid",type:"string"},{name:"display_name",type:"string"},{name:"can_see_private",type:"boolean",defaultValue:!1},{name:"has_meeting_rule",type:"boolean",defaultValue:!1},{name:"rights_calendar",type:"int"},{name:"rights_tasks",type:"int"},{name:"rights_inbox",type:"int"},{name:"rights_contacts",type:"int"},{name:"rights_notes",type:"int"},{name:"rights_journal",type:"int"}];
Zarafa.common.delegates.data.DelegateRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{baseIdProperties:["entryid"],copy:function(a){a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DELEGATE,this.data,a||this.id);a.idProperties=this.idProperties.clone();a.phantom=this.phantom;return a.applyData(this)},applyData:function(a){this.beginEdit();Ext.apply(this.data,a.data);Ext.apply(this.modified,a.modified);this.dirty=a.dirty;this.endEdit();return this},
equals:function(a){return this===a?!0:Zarafa.core.EntryId.compareABEntryIds(this.get("entryid"),a.get("entryid"))}});Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_DELEGATE");Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DELEGATE,Zarafa.common.delegates.data.DelegateRecord);Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DELEGATE,Zarafa.common.delegates.data.DelegateRecordFields);
Ext.namespace("Zarafa.common.delegates.dialogs");
Zarafa.common.delegates.dialogs.DelegatePermissionContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.delegatepermissioncontentpanel",layout:"fit",modal:!0,recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0,useShadowStore:!0}),autoSave:!1,width:500,height:325,title:_("Delegate Permissions"),items:[{xtype:"zarafa.delegatepermissionpanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),
handler:this.onCancel,scope:this}]}]});Zarafa.common.delegates.dialogs.DelegatePermissionContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.delegatepermissioncontentpanel",Zarafa.common.delegates.dialogs.DelegatePermissionContentPanel);Ext.namespace("Zarafa.common.freebusy.data");
Zarafa.common.freebusy.data.FreebusyResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doList:function(a){var b=[];Ext.each(a.users,function(a){Ext.each(a.items,function(c){b.push(Ext.applyIf(c,{userid:a.userid}))})});this.receivedRecords=this.reader.readRecords({count:b.length,item:b})}});Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.UserlistBox=Ext.extend(Zarafa.common.recipientfield.ui.RecipientBox,{constructor:function(a){a=a||{};Ext.applyIf(a,{autoHeight:!0,btnCls:"x-freebusy-userrow-remove",btnHoverCls:"x-freebusy-userrow-remove-hover"});Zarafa.common.freebusy.ui.UserlistBox.superclass.constructor.call(this,a)},prepareIcon:function(a){switch(a.get("recipient_type")){case Zarafa.core.mapi.RecipientType.MAPI_CC:return"x-freebusy-userlist-recipienttype-optional";case Zarafa.core.mapi.RecipientType.MAPI_BCC:return"x-freebusy-userlist-recipienttype-resource";
default:return a.isMeetingOrganizer()?"x-freebusy-userlist-recipienttype-originator":"x-freebusy-userlist-recipienttype-required"}},afterRender:function(a){Zarafa.common.freebusy.ui.UserlistBox.superclass.afterRender.call(this,a);this.delBtnEl.setVisible(this.editable)},update:function(a){a.isMeetingOrganizer()&&this.setEditable(!1);this.iconEl.removeClass(["x-freebusy-userlist-recipienttype-required","x-freebusy-userlist-recipienttype-optional","x-freebusy-userlist-recipienttype-resource"]);Zarafa.common.freebusy.ui.UserlistBox.superclass.update.apply(this,
arguments);if(this.record.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&!0===this.enableButtons&&Ext.isDefined(this.expandBtnEl))this.onResize(this.width,this.height,this.width,this.height)}});Ext.reg("zarafa.userlistbox",Zarafa.common.freebusy.ui.UserlistBox);Ext.ns("Zarafa.common.plugins");
Zarafa.common.plugins.PercentSpinner=Ext.extend(Zarafa.common.plugins.NumberSpinner,{constructor:function(a){a=a||{};Ext.applyIf(a,{allowDecimals:!0,decimalPrecision:4});Zarafa.common.plugins.PercentSpinner.superclass.constructor.call(this,a)},init:function(a){Ext.isDefined(a.defaultValue)&&Ext.isString(a.defaultValue)&&(a.defaultValue=this.stringToFloat(a.defaultValue));Ext.isDefined(a.minValue)?Ext.isString(a.minValue)&&(a.minValue=this.stringToFloat(a.minValue)):a.minValue=0;Ext.isDefined(a.maxValue)?
Ext.isString(a.maxValue)&&(a.maxValue=this.stringToFloat(a.maxValue)):a.maxValue=1;Zarafa.common.plugins.PercentSpinner.superclass.init.call(this,a)},stringToFloat:function(a){var b;if(!Ext.isEmpty(a))return b=a.indexOf("%"),a=parseFloat(a),b&&(a/=100),a},floatToString:function(a){if(Ext.isDefined(a))return 100*a+"%"},setValue:function(a){!Ext.isEmpty(a)&&Ext.isString(a)&&(a=parseFloat(a)/100);Zarafa.common.plugins.PercentSpinner.superclass.setValue.call(this,a)}});
Ext.preg("zarafa.percentspinner",Zarafa.common.plugins.PercentSpinner);Ext.namespace("Zarafa.common.recipientfield.data");Zarafa.common.recipientfield.data.SuggestionListRecord=Ext.data.Record.create([{name:"display_name"},{name:"smtp_address"},{name:"email_address"},{name:"address_type"},{name:"count",type:"int"},{name:"last_used",type:"date",dateFormat:"timestamp"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_MAILUSER}]);
Zarafa.common.recipientfield.data.SuggestionListRecord=Ext.extend(Zarafa.common.recipientfield.data.SuggestionListRecord,{convertToRecipient:function(a){return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{object_type:this.get("object_type"),display_name:this.get("display_name"),email_address:this.get("email_address"),smtp_address:this.get("smtp_address"),address_type:this.get("address_type"),recipient_type:a||Zarafa.core.mapi.RecipientType.MAPI_TO})}});
Ext.namespace("Zarafa.common.recipientfield.data");Zarafa.common.recipientfield.data.SuggestionListResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doList:function(a){a=a.results||[];Array.isArray(a)||(a=[a]);this.receivedRecords=this.reader.readRecords({count:a.length,result:a})}});Ext.namespace("Zarafa.common.recipientfield.ui");
Zarafa.common.recipientfield.ui.RecipientField=Ext.extend(Zarafa.common.ui.BoxField,{defaultRecipientType:Zarafa.core.mapi.RecipientType.MAPI_TO,filterRecipientType:void 0,delimiterCharacters:[";",","],enableDrag:!0,enableDrop:!0,enableDragDrop:!0,dragZone:void 0,dropZone:void 0,queryDelay:250,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.common.recipientfield.data.SuggestionListStore);Ext.applyIf(a,{boxType:"zarafa.recipientbox",itemSelector:"div.x-zarafa-boxfield-suggestion-item",
extraItemSelector:"a.x-zarafa-boxfield-suggestion-cross",border:!1,minChars:1,listEmptyText:_("No suggestions available"),boxMinHeight:24,boxMaxHeight:66,height:24,tpl:new Ext.XTemplate('<tpl for=".">','<div class="x-zarafa-boxfield-suggestion-item x-combo-list-item">','<a class="x-zarafa-boxfield-suggestion-cross" ext:qtip="'+_("Delete recipient from suggestion list")+'" ext:qwidth="100%"></a>',"{values.display_name:htmlEncode} &lt;",'<tpl if="!Ext.isEmpty(values.smtp_address)">{values.smtp_address:htmlEncode}</tpl>',
'<tpl if="Ext.isEmpty(values.smtp_address)">{values.email_address:htmlEncode}</tpl>',"&gt;","</div>","</tpl>")});Zarafa.common.recipientfield.ui.RecipientField.superclass.constructor.call(this,a);this.on("boxdblclick",this.onBoxDblClick,this);this.on("boxcontextmenu",this.onBoxContextMenu,this);this.on("afterrender",function(){this.width&&(this.width=void 0)})},handleInput:function(a){var b=a.match(/([^,;\n\r]*?<{0,1}(?:[a-zA-Z0-9.!#$%&'*+\-/=?^_`{|}~])+\@[a-z0-9\-]+(?:\.[a-z0-9\-]+)*\.(?:[a-z0-9]{2,15}))>{0,1}(?=(?:$|[,;\n\r\s]))/g),
c=[];Ext.isEmpty(b)?(c=a.split(new RegExp(this.delimiterCharacters.join("|"),"g")),Ext.isEmpty(c)&&c.push(a)):c=b;c=c.filter(function(a,b,c){c[b]=c[b].trim();return b===c.indexOf(a.trim())});a=c.map(function(a){return this.boxStore.parseRecipient(a.trim(),this.defaultRecipientType)},this);0<a.length&&this.boxStore.add(a)},handleSelection:function(a){a=a.convertToRecipient(this.defaultRecipientType);this.boxStore.add(a)},setRecipientStore:function(a){return this.setBoxStore.apply(this,arguments)},
getRecipientStore:function(){return this.getBoxStore()},update:function(a,b){a&&a instanceof Zarafa.core.data.MAPIRecord?b&&a.isOpened()&&this.setRecipientStore(a.getRecipientStore()):Zarafa.common.recipientfield.ui.RecipientField.superclass.update.apply(this,arguments)},setBoxStore:function(a,b){if(this.boxStore!==a||!0===b)this.boxStore&&(this.mun(this.boxStore,"resolved",this.onBoxStoreResolved,this),this.mun(this.boxStore,"beforeresolve",this.onBoxStoreBeforeResolve,this)),Zarafa.common.recipientfield.ui.RecipientField.superclass.setBoxStore.apply(this,
arguments),this.boxStore&&(this.mon(this.boxStore,"resolved",this.onBoxStoreResolved,this),this.mon(this.boxStore,"beforeresolve",this.onBoxStoreBeforeResolve,this))},onBoxStoreResolved:function(a,b){b=this.filterRecords(this.getBoxStore(),b);for(var c=0;c<b.length;c++){var d=b[c],e=this.getBoxForRecord(d);e&&(e.update(d),this.hideSuggestionList())}},onBoxStoreBeforeResolve:function(a,b){b=this.filterRecords(this.getBoxStore(),b);for(var c=0;c<b.length;c++){var d=b[c],e=this.getBoxForRecord(d);e&&
e.update(d)}},filterRecord:function(a){return!a.isMeetingOrganizer()&&(!Ext.isDefined(this.filterRecipientType)||a.get("recipient_type")===this.filterRecipientType)},onBoxDblClick:function(a,b,c){c.isResolved()?Zarafa.common.Actions.openViewRecipientContent(c,{manager:Ext.WindowMgr}):Zarafa.core.data.UIFactory.openCreateRecord(c,{manager:Ext.WindowMgr})},onBoxContextMenu:function(a,b,c){Zarafa.core.data.UIFactory.openDefaultContextMenu(c,{position:b.getEl().getXY(),editable:b.editable})},initEvents:function(){Zarafa.common.recipientfield.ui.RecipientField.superclass.initEvents.apply(this,
arguments);!this.enableDrag&&!this.enableDragDrop||this.dragZone||(this.dragZone=new Zarafa.common.ui.BoxFieldDragZone(this.container,{ddGroup:"dd.mapiitem",field:this}));!this.enableDrop&&!this.enableDragDrop||this.dropZone||(this.dropZone=new Zarafa.common.recipientfield.ui.RecipientDropZone(this.container,{ddGroup:"dd.mapiitem",field:this}))}});Ext.reg("zarafa.recipientfield",Zarafa.common.recipientfield.ui.RecipientField);Ext.namespace("Zarafa.common.recurrence.dialogs");
Zarafa.common.recurrence.dialogs.RecurrenceContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{editRecurrence:!1,pasteItem:!1,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.recurrencecontentpanel",layout:"fit",title:_("Appointment Recurrence"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),border:!1,defaults:{bodyStyle:"padding-top: 5px; padding-left: 6px; padding-right: 5px; background-color: inherit;",border:!1},autoSave:!1,width:600,
height:500,items:[{xtype:"zarafa.recurrencepanel",ref:"recurrencePanel",buttons:[{text:a.pasteItem?_("Create"):_("Ok"),handler:this.onOk,scope:this,ref:"../../okBtn"},{text:_("Cancel"),scope:this,handler:this.onCancel},{text:_("Remove Recurrence"),handler:this.onRemoveRecurrence,scope:this,ref:"../../removeReccurrenceBtn"}]}]});Zarafa.common.recurrence.dialogs.RecurrenceContentPanel.superclass.constructor.call(this,a);this.on("beforesetrecord",this.onBeforeSetRecord,this);this.on("saverecord",this.onSaveRecord,
this)},onBeforeSetRecord:function(a,b,c){if(b.get("recurring"))this.editRecurrence=!0;else{a=b.get("startdate")||new Date;var d=b.get("duedate");Ext.isDate(d)||(d=b.get("alldayevent")?a.add(Date.DAY,1):a.add(Date.MINUTE,30));if(b.get("alldayevent")){var e=0;c=60*a.getHours()+a.getMinutes();a.clearTime(!0).getTime()===a.getTime()&&(e=c,c=0);d=c+e+Date.diff(Date.MINUTE,d,a)}else c=60*a.getHours()+a.getMinutes(),d=c+Date.diff(Date.MINUTE,d,a);b.beginEdit();b.set("recurring",!0);b.set("recurrence_type",
Zarafa.common.recurrence.data.RecurrenceType.WEEKLY);b.set("recurrence_subtype",Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY.type);b.set("recurrence_regen",Zarafa.common.recurrence.data.RecurrenceSubtype.WEEKLY.regen);b.set("recurrence_term",Zarafa.common.recurrence.data.RecurrenceEnd.NEVER);b.set("recurrence_start",a.clearTime(!0).fromUTC());b.set("recurrence_startocc",c);b.set("recurrence_endocc",d);b.set("recurrence_everyn",1);b.set("recurrence_weekdays",Math.pow(2,a.getDay()));b.endEdit();
this.editRecurrence=!1}},onOk:function(){!0!==this.record.phantom&&!0===this.editRecurrence&&this.record.hasRecurringExceptions()?Ext.MessageBox.confirm(_("Kopano WebApp"),_("This will discard any exceptions which might have been made for this recurring series. Do you wish to continue?"),function(a){"yes"===a&&Zarafa.common.recurrence.dialogs.RecurrenceContentPanel.superclass.onOk.apply(this,arguments)},this):(this.editRecurrence||(this.record.modified.recurring=this.record.data.recurring,this.record.modified.recurrence_type=
this.record.data.recurrence_type,this.record.modified.recurrence_subtype=this.record.data.recurrence_subtype,this.record.modified.recurrence_regen=this.record.data.recurrence_regen,this.record.modified.recurrence_term=this.record.data.recurrence_term,this.record.modified.recurrence_start=this.record.data.recurrence_start,this.record.modified.recurrence_startocc=this.record.data.recurrence_startocc,this.record.modified.recurrence_endocc=this.record.data.recurrence_endocc,this.record.modified.recurrence_everyn=
this.record.data.recurrence_everyn,this.record.modified.recurrence_weekdays=this.record.data.recurrence_weekdays),this.pasteItem&&this.store.add(this.modalRecord),Zarafa.common.recurrence.dialogs.RecurrenceContentPanel.superclass.onOk.apply(this,arguments))},onSaveRecord:function(a,b){this.pasteItem||b.set("recurring_reset",!0);b.get("recurring")?(b.updateTimezoneInformation(),b.set("recurring_pattern",b.generateRecurringPattern())):b.set("recurring_pattern","")},update:function(a,b){this.updateTitleFromRecord(a);
var c=!1;a&&a.isSubMessage()&&(c=!0);this.pasteItem?this.removeReccurrenceBtn.setVisible(!1):this.removeReccurrenceBtn.setDisabled(c);this.okBtn.setDisabled(c)},updateTitleFromRecord:function(a){Ext.isDefined(a)?a.isMessageClass("IPM.TaskRequest",!0)?this.setTitle(_("Task Recurrence")):this.setTitle(_("Appointment Recurrence")):this.setTitle(this.initialConfig.title)},onSetRecord:function(a,b,c){Zarafa.common.recurrence.dialogs.RecurrenceContentPanel.superclass.onSetRecord.call(this,a,b,c);this.updateTitleFromRecord(b)},
onRemoveRecurrence:function(){this.record.beginEdit();this.record.set("recurring",!1);this.record.set("recurring_pattern","");this.record.set("recurrence_type",Zarafa.common.recurrence.data.RecurrenceType.NONE);this.record.endEdit();Ext.isDefined(this.modalRecord)&&this.modalRecord.applyData(this.record);if(!1!==this.autoSave){var a=this.modalRecord||this.record;this.displayInfoMask();this.isSaving=!0;a.save()}else this.close()}});Ext.reg("zarafa.recurrencecontentpanel",Zarafa.common.recurrence.dialogs.RecurrenceContentPanel);
Ext.namespace("Zarafa.common.reminder.data");
Zarafa.common.reminder.data.ReminderRecordFields=[{name:"entryid"},{name:"store_entryid"},{name:"parent_entryid"},{name:"message_flags"},{name:"message_class"},{name:"icon_index"},{name:"subject"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE},{name:"location"},{name:"reminder",type:"boolean"},{name:"reminder_minutes",type:"int"},{name:"reminder_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"flagdueby",type:"date",dateFormat:"timestamp",defaultValue:null},
{name:"task_duedate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"task_startdate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"task_resetreminder"},{name:"task_recurring"},{name:"appointment_recurring"},{name:"appointment_startdate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"appointment_enddate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"appointment_startdate_recurring"},{name:"appointment_enddate_recurring"}];
Zarafa.common.reminder.data.ReminderRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{convertToIPMRecord:function(){var a=this.get("entryid"),b=this.get("message_class"),c={};if(Zarafa.core.MessageClass.isClass(b,"IPM.Appointment",!0))c={recurring:this.get("appointment_recurring"),startdate:this.get("appointment_startdate"),duedate:this.get("appointment_enddate"),startdate_recurring:this.get("appointment_startdate_recurring"),enddate_recurring:this.get("appointment_enddate_recurring")};else if(Zarafa.core.MessageClass.isClass(b,
"IPM.Task",!0))c={startdate:this.get("task_startdate"),duedate:this.get("task_duedate")};else if(Zarafa.core.MessageClass.isClass(b,"IPM.Contact",!0))return Ext.MessageBox.alert(_("Info"),_("Not supported at the moment.")),!1;Ext.applyIf(c,{entryid:a,parent_entryid:this.get("parent_entryid"),store_entryid:this.get("store_entryid"),object_type:this.get("object_type"),message_class:b,message_flags:this.get("message_flags"),subject:this.get("subject"),location:this.get("location"),icon_index:this.get("icon_index"),
reminder:this.get("reminder"),reminder_minutes:this.get("reminder_minutes"),reminder_time:this.get("reminder_time"),flagdueby:this.get("flagdueby")});a=Zarafa.core.data.RecordFactory.createRecordObjectByRecordData(c,a);Zarafa.core.MessageClass.isClass(b,"IPM.Note",!0)&&Ext.copyTo(a,this,"store");return a}});Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_REMINDER");Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_REMINDER,Zarafa.common.reminder.data.ReminderRecord);
Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_REMINDER,Zarafa.common.reminder.data.ReminderRecordFields);Ext.namespace("Zarafa.common.reminder.data");
Zarafa.common.reminder.data.ReminderStore=Ext.extend(Zarafa.core.data.ListModuleStore,{actionType:Zarafa.core.Actions.list,lastChecksum:void 0,refreshStore:!1,constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_REMINDER);Ext.applyIf(a,{proxy:new Zarafa.common.reminder.data.ReminderProxy,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.core.data.JsonReader({dynamicRecord:!1},b),batch:!1});Zarafa.common.reminder.data.ReminderStore.superclass.constructor.call(this,
a)},initEvents:function(){this.on("exception",this.onError,this);Zarafa.common.reminder.data.ReminderStore.superclass.initEvents.call(this)},load:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isDefined(a.cancelPreviousRequest)||(a.cancelPreviousRequest=!0);Ext.apply(a,{actionType:this.actionType});return Zarafa.common.reminder.data.ReminderStore.superclass.load.call(this,a)},onError:function(a,b,c,d,e,f){c===Ext.data.Api.actions.read&&this.clearReminderInterval();this.lastChecksum=
void 0},initializeReminderInterval:function(){var a=container.getSettingsModel().get("zarafa/v1/main/reminder/polling_interval");Ext.isNumber(a)&&0<a&&(this.on("load",this.sendReminderRequest,this,{buffer:1E3*a}),this.sendReminderRequest.defer(1E3*a,this))},sendReminderRequest:function(){this.load()},resetReminderInterval:function(){this.clearReminderInterval();this.initializeReminderInterval()},clearReminderInterval:function(){this.un("load",this.sendReminderRequest,this)},loadRecords:function(a,
b,c){Zarafa.common.reminder.data.ReminderStore.superclass.loadRecords.apply(this,arguments);if(!1!==c){var d=a.records,e=Ext.util.JSON.encode(Ext.pluck(d,"id"));if(this.lastChecksum!==e){if(0<d.length){var f=String.format(ngettext("There is {0} reminder","There are {0} reminders",d.length),d.length);container.getNotifier().notify("info.reminder",_("Reminders"),f)}Zarafa.common.Actions.openReminderContent(d);this.lastChecksum=e}}},dismissReminders:function(a){Ext.each(a,function(a){a.addMessageAction("action_type",
"dismiss")},this);this.remove(a);this.refreshStore=!0;this.save(a)},snoozeReminders:function(a,b){Ext.each(a,function(a){a.addMessageAction("action_type","snooze");a.addMessageAction("snoozeTime",b)},this);this.remove(a);this.refreshStore=!0;this.save(a)},onWrite:function(a,b,c,d,e){e=[].concat(e);for(var f=0,g=e.length;f<g;f++)if(("dismiss"==e[f].getMessageAction("action_type")||"snooze"==e[f].getMessageAction("action_type"))&&this.refreshStore){this.sendReminderRequest();this.refreshStore=!1;break}Zarafa.common.reminder.data.ReminderStore.superclass.onWrite.apply(this,
arguments)}});Ext.reg("zarafa.reminderstore",Zarafa.common.reminder.data.ReminderStore);Ext.namespace("Zarafa.common.restoreitem.data");
Zarafa.common.restoreitem.data.RestoreItemRecordFields=[{name:"entryid"},{name:"parent_entryid"},{name:"store_entryid"},{name:"icon_index"},{name:"display_name"},{name:"deleted_on",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"content_count",type:"int",defaultValue:0},{name:"sender_name"},{name:"subject"},{name:"message_size",type:"int",defaultValue:0},{name:"message_class"},{name:"object_type"},{name:"message_delivery_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"message_flags",
type:"int",defaultValue:Zarafa.core.mapi.MessageFlags.MSGFLAG_READ},{name:"hasattach",type:"boolean",defaultValue:!1}];
Zarafa.common.restoreitem.data.RestoreItemRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{getDefaultFolderKey:function(){},getMAPIStore:function(){return container.getHierarchyStore().getById(this.get("store_entryid"))},isIPMSubTree:function(){return!1},isRead:function(){return Ext.isDefined(this.get("message_flags"))?0<(this.get("message_flags")&Zarafa.core.mapi.MessageFlags.MSGFLAG_READ):!0}});Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_RESTOREITEM");
Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RESTOREITEM,Zarafa.common.restoreitem.data.RestoreItemRecordFields);Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RESTOREITEM,Zarafa.common.restoreitem.data.RestoreItemRecord);Ext.namespace("Zarafa.common.restoreitem.dialogs");
Zarafa.common.restoreitem.dialogs.RestoreItemContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{folder:void 0,store:void 0,constructor:function(a){a=a||{};var b=a.folder,c,d=_("Restore Softdeleted Items");b&&(c=b.getFullyQualifiedDisplayName(),Ext.isEmpty(c)||(d=String.format(_("Restore From {0}"),c)));Ext.applyIf(a,{xtype:"zarafa.restoreitemcontentpanel",layout:"fit",title:d,items:[{xtype:"zarafa.restoreitempanel",folder:b,store:a.store}]});Zarafa.common.restoreitem.dialogs.RestoreItemContentPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.restoreitemcontentpanel",Zarafa.common.restoreitem.dialogs.RestoreItemContentPanel);Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.ActionProfiles=[{name:_("Move the message to folder ..."),value:Zarafa.common.rules.data.ActionFlags.MOVE},{name:_("Copy the message to folder ..."),value:Zarafa.common.rules.data.ActionFlags.COPY},{name:_("Delete the message"),value:Zarafa.common.rules.data.ActionFlags.DELETE},{name:_("Redirect the message to ..."),value:Zarafa.common.rules.data.ActionFlags.REDIRECT},{name:_("Forward the message to ..."),value:Zarafa.common.rules.data.ActionFlags.FORWARD},{name:_("Forward the message as attachment to ..."),
value:Zarafa.common.rules.data.ActionFlags.FORWARD_ATTACH}];Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.ConditionProfiles=[{name:_("is received from ..."),value:Zarafa.common.rules.data.ConditionFlags.RECEIVED_FROM},{name:_("includes these words in the sender's address ..."),value:Zarafa.common.rules.data.ConditionFlags.SENDER_WORDS},{name:_("includes these words in the subject ..."),value:Zarafa.common.rules.data.ConditionFlags.SUBJECT_WORDS},{name:_("includes these words in the body ..."),value:Zarafa.common.rules.data.ConditionFlags.BODY_WORDS},{name:_("includes these words in the transport-headers ..."),
value:Zarafa.common.rules.data.ConditionFlags.TRANSPORTHEADER_WORDS},{name:_("has importance ..."),value:Zarafa.common.rules.data.ConditionFlags.IMPORTANCE},{name:_("has an attachment"),value:Zarafa.common.rules.data.ConditionFlags.ATTACHMENT},{name:_("is sent to ..."),value:Zarafa.common.rules.data.ConditionFlags.SENT_TO},{name:_("is sent only to me"),value:Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME_ONLY},{name:_("has my name in the Cc field"),value:Zarafa.common.rules.data.ConditionFlags.SENT_CC_ME},
{name:_("has my name in the To or Cc field"),value:Zarafa.common.rules.data.ConditionFlags.NAME_TO_CC},{name:_("has sensitivity"),value:Zarafa.common.rules.data.ConditionFlags.SENSITIVITY},{name:_("is received after"),value:Zarafa.common.rules.data.ConditionFlags.RECEIVED_AFTER},{name:_("is received before"),value:Zarafa.common.rules.data.ConditionFlags.RECEIVED_BEFORE},{name:_("has my name in the To field"),value:Zarafa.common.rules.data.ConditionFlags.SENT_TO_ME},{name:_("is received (all messages)"),
value:Zarafa.common.rules.data.ConditionFlags.NONE}];Ext.namespace("Zarafa.core.data");
Zarafa.common.rules.data.RulesProxy=Ext.extend(Zarafa.core.data.IPMProxy,{getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.common.rules.data.RulesResponseHandler({proxy:this,action:c,reader:f,sendRecords:d,options:k,callback:g,scope:h})},createUpdateAction:function(a,b,c,d,e,f,g){Ext.applyIf(g,{listRequest:!0});var h=c.jsonData.store;c=c.jsonData[d.meta.root];Ext.isEmpty(b)&&(c={store:h});Zarafa.common.rules.data.RulesProxy.superclass.createUpdateAction.apply(this,arguments)},
destroyAction:function(a,b,c,d,e,f,g){Ext.applyIf(g,{listRequest:!0});c=c.jsonData[d.meta.root];Zarafa.common.rules.data.RulesProxy.superclass.destroyAction.apply(this,arguments)},openAction:function(a,b,c,d,e,f,g){Ext.applyIf(g,{listRequest:!0});c=c.jsonData[d.meta.root];Zarafa.common.rules.data.RulesProxy.superclass.openAction.apply(this,arguments)}});Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.RulesRecordFields=[{name:"rule_id",type:"number"},{name:"rule_name",type:"string"},{name:"rule_provider",type:"string",defaultValue:"RuleOrganizer"},{name:"rule_level",type:"number",defaultValue:0},{name:"rule_sequence",type:"number"},{name:"rule_state",type:"number",defaultValue:Zarafa.core.mapi.RuleStates.ST_ENABLED},{name:"rule_condition",allowBlank:!1},{name:"rule_actions",allowBlank:!1}];
Zarafa.common.rules.data.RulesRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{baseIdProperties:["rule_id"],conditionsValid:!0,actionsValid:!0,copy:function(a){a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RULE,this.data,a||this.id);a.idProperties=this.idProperties.clone();a.phantom=this.phantom;return a.applyData(this)},applyData:function(a){this.beginEdit();Ext.apply(this.data,a.data);Ext.apply(this.modified,a.modified);this.dirty=a.dirty;
this.endEdit();return this},equals:function(a){return this===a?!0:this.get("rule_id")===a.get("rule_id")},isOpened:function(){return!0},isValid:function(){return this.conditionsValid&&this.actionsValid&&Zarafa.common.rules.data.RulesRecord.superclass.isValid.apply(this,arguments)},setConditionsValid:function(a){this.conditionsValid=a},setActionsValid:function(a){this.actionsValid=a}});Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_RULE");
Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RULE,Zarafa.common.rules.data.RulesRecord);Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RULE,Zarafa.common.rules.data.RulesRecordFields);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.ReceivedBeforeLink=Ext.extend(Zarafa.common.rules.dialogs.ReceivedAfterLink,{getCondition:function(){if(!0!==this.isModified)return this.condition;var a=Zarafa.core.data.RestrictionFactory,b=Zarafa.core.mapi.Restrictions,c=this.receivedDate.getValue().getTime()/1E3;return a.dataResProperty("PR_MESSAGE_DELIVERY_TIME",b.RELOP_LT,c)}});Ext.reg("zarafa.receivedbeforelink",Zarafa.common.rules.dialogs.ReceivedBeforeLink);Ext.namespace("Zarafa.common.rules.dialogs");
Zarafa.common.rules.dialogs.RulesEditContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.ruleseditcontentpanel",layout:"fit",modal:!0,recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0,useShadowStore:!0}),autoSave:!1,width:600,height:400,title:_("Inbox Rule"),items:[{xtype:"zarafa.ruleseditpanel",storeEntryId:a.record.getStore().storeEntryId,buttons:[{text:_("Save"),handler:this.onOk,scope:this},
{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.common.rules.dialogs.RulesEditContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.ruleseditcontentpanel",Zarafa.common.rules.dialogs.RulesEditContentPanel);Ext.namespace("Zarafa.common.sendas.dialogs");
Zarafa.common.sendas.dialogs.SendAsEditContentPanel=Ext.extend(Zarafa.common.recipientfield.ui.EditRecipientContentPanel,{removeOnCancel:!0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.sendaseditcontentpanel",title:_("Add/Edit sender")});Zarafa.common.sendas.dialogs.SendAsEditContentPanel.superclass.constructor.call(this,a)},onOk:function(){var a=this.formPanel.getForm();a.isValid()&&(a.updateRecord(this.record),this.record.generateOneOffEntryId(),this.close())},closeWrap:function(){this.removePhantomRecord();
Zarafa.common.sendas.dialogs.SendAsEditContentPanel.superclass.closeWrap.apply(this,arguments)},onCancel:function(){this.removePhantomRecord();Zarafa.common.sendas.dialogs.SendAsEditContentPanel.superclass.onCancel.call(this)},removePhantomRecord:function(){!0===this.removeOnCancel&&this.record.phantom&&this.record.store.remove(this.record)}});Ext.reg("zarafa.sendaseditcontentpanel",Zarafa.common.sendas.dialogs.SendAsEditContentPanel);Ext.namespace("Zarafa.common.ui.layout");
Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion=Ext.extend(Ext.layout.BorderLayout.SplitRegion,{hidden:void 0,oldSize:void 0,constructor:function(a,b,c){Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion.superclass.constructor.call(this,a,b,c);this.region=c;this.applyLayout=this.applyLayout.createInterceptor(this.preApplyLayout,this)},setVisible:Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion.prototype.setVisible,isVisible:Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion.prototype.isVisible,
getSize:function(){var a=Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion.superclass.getSize.call(this);return this.restrictSize(a)},restrictSize:Zarafa.common.ui.layout.SwitchBorderLayout.SwitchRegion.prototype.restrictSize,render:function(a,b,c){if(!0===c){var d=b.id;b.id+="-switch";Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion.superclass.render.apply(this,arguments);b.id=d}else Zarafa.common.ui.layout.SwitchBorderLayout.SwitchSplitRegion.superclass.render.apply(this,
arguments)},preApplyLayout:function(a){this.splitEl.setPositioning({left:a.x+"px",top:a.y+a.height+"px"})},onSplitMove:function(a,b){var c=this.panel.getSize();this.lastSplitSize=b;"north"==this.position||"south"==this.position?(this.panel.setSize(c.width,b),this.state.height=b):(this.panel.setSize(b,c.height),this.state.width=b);this.layout.container.doLayout();this.panel.saveState();return!1}});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookEmailAddressesSubStore=Ext.extend(Zarafa.core.data.MAPISubStore,{constructor:function(a){a=a||{};var b=Ext.data.Record.create([{name:"address",type:"string"}]);Ext.applyIf(a,{reader:new Zarafa.core.data.JsonReader({id:"address",idProperty:"address"},b)});Zarafa.addressbook.AddressBookEmailAddressesSubStore.superclass.constructor.call(this,a)}});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookHierarchyNotificationResponseHandler=Ext.extend(Zarafa.core.data.AbstractNotificationResponseHandler,{doAddressbook:function(){this.addNotification(Zarafa.core.data.Notifications.objectModified,null,null)}});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookHierarchyProxy=Ext.extend(Zarafa.core.data.IPMProxy,{constructor:function(a){a=a||{};var b=Zarafa.core.ModuleNames.getModule("addressbook");Ext.applyIf(a,{listModuleName:b.list,itemModuleName:b.item});Zarafa.addressbook.AddressBookHierarchyProxy.superclass.constructor.call(this,a)},getResponseHandlerForRequest:function(a,b,c,d,e,f,g,h,k){return new Zarafa.addressbook.AddressBookResponseHandler({proxy:this,action:c,reader:f,options:k,callback:g,scope:h})}});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookHierchyRecordFields=[{name:"entryid"},{name:"display_name"},{name:"type"},{name:"store_entryid"},{name:"parent_entryid"},{name:"depth",type:"int",defaultValue:0},{name:"group_header",type:"boolean",defaultValue:!1}];Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_ABCONT,Zarafa.core.data.MAPIRecord);Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_ABCONT,Zarafa.addressbook.AddressBookHierchyRecordFields);
Ext.namespace("Zarafa.addressbook");Zarafa.addressbook.AddressBookTelephoneNumberSubStore=Ext.extend(Zarafa.core.data.MAPISubStore,{constructor:function(a){a=a||{};var b=Ext.data.Record.create([{name:"number",type:"string"}]);Ext.applyIf(a,{reader:new Zarafa.core.data.JsonReader({root:"item",id:"number",idProperty:"number"},b)});Zarafa.addressbook.AddressBookTelephoneNumberSubStore.superclass.constructor.call(this,a)}});Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABGroupDetailContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.abgroupdetailcontentpanel",layout:"fit",border:!1,title:_("Group details"),items:[{xtype:"zarafa.abgroupdetailpanel"}]});Zarafa.addressbook.dialogs.ABGroupDetailContentPanel.superclass.constructor.call(this,a)},update:function(a,b){this.updateTitleFromRecord(this.record)},updateTitleFromRecord:function(a){a=a.get("display_name");Ext.isEmpty(a)?
this.setTitle(this.initialConfig.title):this.setTitle(a)}});Ext.reg("zarafa.abgroupdetailcontentpanel",Zarafa.addressbook.dialogs.ABGroupDetailContentPanel);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABUserDetailContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.abuserdetailcontentpanel",layout:"fit",border:!1,title:_("User details"),items:[{xtype:"zarafa.abuserdetailpanel"}]});Zarafa.addressbook.dialogs.ABUserDetailContentPanel.superclass.constructor.call(this,a)},update:function(a,b){this.updateTitleFromRecord(this.record);b&&this.updateIconFromRecord(this.record)},updateIconFromRecord:function(a){a=
Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){a=a.get("display_name");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)}});Ext.reg("zarafa.abuserdetailcontentpanel",Zarafa.addressbook.dialogs.ABUserDetailContentPanel);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.ABUserSelectionContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{callback:Ext.emptyFn,singleSelect:!0,scope:void 0,hideContactsFolders:!1,listRestriction:void 0,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.abuserselectioncontentpanel",layout:"fit",title:_("Address Book"),width:1E3,items:[{xtype:"zarafa.abuserselectionpanel",hideContactsFolders:a.hideContactsFolders,listRestriction:a.listRestriction,callback:a.callback,singleSelect:Ext.isDefined(a.singleSelect)?
a.singleSelect:this.singleSelect,scope:a.scope}]});Zarafa.addressbook.dialogs.ABUserSelectionContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.abuserselectioncontentpanel",Zarafa.addressbook.dialogs.ABUserSelectionContentPanel);Ext.namespace("Zarafa.addressbook.dialogs");
Zarafa.addressbook.dialogs.AddressBookContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{hideContactsFolders:!1,listRestriction:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.addressbookcontentpanel",layout:"fit",cls:"k-addressbookcontentpanel",title:_("Address Book"),width:1E3,items:[{xtype:"zarafa.addressbookpanel",hideContactsFolders:a.hideContactsFolders,listRestriction:a.listRestriction}]});Zarafa.addressbook.dialogs.AddressBookContentPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.addressbookcontentpanel",Zarafa.addressbook.dialogs.AddressBookContentPanel);Ext.namespace("Zarafa.addressbook.ui");Zarafa.addressbook.ui.AddressBookBox=Ext.extend(Zarafa.common.recipientfield.ui.RecipientBox,{validDisplayType:void 0,isValidRecord:function(a){return a.isResolved()&&(!Ext.isDefined(this.validDisplayType)||a.get("display_type")===this.validDisplayType)}});Ext.reg("zarafa.addressbookbox",Zarafa.addressbook.ui.AddressBookBox);Ext.namespace("Zarafa.advancesearch");
Zarafa.advancesearch.AdvanceSearchContextModel=Ext.extend(Zarafa.core.ContextModel,{stores:{},constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.advancesearch.AdvanceSearchStore);Ext.applyIf(a,{statefulRecordSelection:!0,current_data_mode:Zarafa.common.data.DataModes.ALL,stateful:!1});Zarafa.advancesearch.AdvanceSearchContextModel.superclass.constructor.call(this,a);container.on("folderselect",this.onFolderSelect,this);container.getHierarchyStore().on("removeFolder",this.onHierarchyRemoveFolder,
this)},createSearchFolderRecord:function(a){var b=container.getHierarchyStore().getDefaultStore(),c=b.getFavoritesRootFolder(),d="";-1===b.getFavoritesStore().findExact("entryid",this.store.searchFolderEntryId)&&(d=this.store.searchFolderEntryId);return Zarafa.core.data.RecordFactory.createRecordObjectByObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,{entryid:d,parent_entryid:c.get("entryid"),store_entryid:c.get("store_entryid"),display_name:a,folder_type:Zarafa.core.mapi.MAPIFolderType.FOLDER_SEARCH})},
setActiveStore:function(a){this.store=a},getActiveStore:function(){return this.store},pushStore:function(a,b){this.stores[a]=b},discardStore:function(a){delete this.stores[a]},createNewSearchStore:function(a){var b=new Zarafa.advancesearch.AdvanceSearchStore({searchStoreUniqueId:a.searchTabId});this.setActiveStore(b);this.pushStore(a.searchTabId,b);return b},createResponseRecord:function(a,b,c){return container.getContextByName("mail").getModel().createResponseRecord(a,b,c)},onFolderSelect:function(a){var b;
b=Array.isArray(a)?a[0]:a;if(b instanceof Zarafa.core.data.IPFRecord&&Ext.isDefined(b.getMAPIStore())&&Ext.isDefined(b)&&!b.isIPMSubTree()){var c=this.getDefaultFolder();b.equals(c)||this.setFolders(a)}},onHierarchyRemoveFolder:function(a,b,c){c.isSearchFolder()&&container.getSettingsModel().remove("zarafa/v1/contexts/search/search_criteria/"+c.get("entryid"))}});Ext.namespace("Zarafa.advancesearch.dialogs");
Zarafa.advancesearch.dialogs.CreateSearchFolderContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{searchStoreEntryId:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.createsearchfoldercontentpanel",title:_("Add to favorites"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0,enableOpenLoadTask:!1}),layout:"fit",width:250,height:150,stateful:!1,items:[{xtype:"zarafa.createsearchfolderpanel",
searchText:a.searchText,buttons:[{text:_("Add"),handler:this.onAddFolder,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.advancesearch.dialogs.CreateSearchFolderContentPanel.superclass.constructor.call(this,a)},updateRecord:function(a){a.beginEdit();a.set("display_name",this.searchFolderTextField.getValue());a.endEdit()},update:function(a,b){this.searchFolderTextField.setValue(a.get("display_name"))},onAddFolder:function(){var a=this.searchFolderTextField.getValue().trim();
Ext.isEmpty(a)?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("You must specify a name."),buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.INFO}):(this.record.addToFavorites(this.searchStoreEntryId),Ext.isEmpty(this.record.get("entryid"))&&(this.record.addMessageAction("search_folder_entryid",this.searchFolderEntryId),this.record.getStore().setBaseParam("subfolders",this.includeSubFolder)),Zarafa.advancesearch.dialogs.CreateSearchFolderContentPanel.superclass.onOk.apply(this,arguments))}});
Ext.reg("zarafa.createsearchfoldercontentpanel",Zarafa.advancesearch.dialogs.CreateSearchFolderContentPanel);Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.SearchGrid=Ext.extend(Zarafa.common.ui.grid.MapiMessageGrid,{searchContext:void 0,model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.searchContext)&&(a.model=a.searchContext.getModel());if(!Ext.isDefined(a.store)&&Ext.isDefined(a.model))if(Ext.isDefined(a.model.store.getSearchStoreUniqueId()))a.store=a.model.createNewSearchStore({searchTabId:a.searchTabId});else{var b=a.model;b.store.searchStoreUniqueId=a.searchTabId;a.store=b.store;b.pushStore(a.searchTabId,
b.store)}a.store=Ext.StoreMgr.lookup(a.store);b=a.searchCenterPanel.searchPanel.searchFolder;Ext.isDefined(b)&&(a.store.setSearchStoreEntryId(b.get("store_entryid")),a.store.setSearchEntryId(b.get("entryid")));Ext.applyIf(a,{xtype:"zarafa.searchgrid",cls:"zarafa-searchgrid",border:!1,stateful:!1,statefulRelativeDimensions:!1,loadMask:this.initLoadMask(),sm:this.initSelectionModel(),cm:new Zarafa.advancesearch.ui.SearchGridColumnModel({grid:this,folder:a.model.getDefaultFolder()}),enableDragDrop:!0,
ddGroup:"dd.mapiitem",viewConfig:this.initViewConfig(),enableColumnHide:!1,enableColumnMove:!1,enableColumnResize:!1,enableHdMenu:!1,supportLiveScroll:!0,autoExpandMin:200,sortableRecordsMax:500});Zarafa.advancesearch.ui.SearchGrid.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.advancesearch.ui.SearchGrid.superclass.initEvents.call(this);this.on({headerclick:this.onHeaderClick,cellclick:this.onCellClick,rowclick:this.onRowClick,rowcontextmenu:this.onRowContextMenu,rowdblclick:this.onRowDblClick,
scope:this});this.mon(this.getView(),"livescrollstart",this.onLiveScrollStart,this);this.mon(this.getView(),"beforesort",this.onBeforeSort,this);this.mon(this.getSelectionModel(),"rowselect",this.onRowSelect,this,{buffer:1});this.mon(this.getSelectionModel(),"selectionchange",this.onSelectionChange,this,{buffer:1});this.mon(this.model,"searchstop",this.onSearchStop,this);this.mon(this.searchContext,"viewchange",this.onContextViewChange,this);this.store.on("beforeupdatesearch",this.onBeforeUpdateSearch,
this);this.mon(this.searchContext,"viewmodechange",this.onContextViewModeChange,this);this.onContextViewModeChange(this.searchContext,this.searchContext.getCurrentViewMode())},initLoadMask:function(){return{msg:_("Loading Search results")+"..."}},initSelectionModel:function(){return new Zarafa.advancesearch.ui.AdvanceSearchRowSelectionModel({singleSelect:!1})},initViewConfig:function(){return{getRowClass:this.viewConfigGetRowClass,enableRowBody:!0,getBodyCell:this.getBodyCell,getSubjectCell:this.getSubjectCell,
rowSelectorDepth:15}},viewConfigGetRowClass:function(a,b,c,d){b=Ext.isFunction(a.isRead)&&!a.isRead()?"mail_unread":"mail_read";if(this.enableRowBody){c.body='<div class="zarafa-grid-body-container">';d=container.getHierarchyStore().getFolder(a.get("parent_entryid")).getDisplayName();d=String.format('<div class="k-folder-location-container"><div class="k-folder-location" ext:qtip="{0}" ext:qwidth="100%"><span class="k-folder-name">{1}</span></div></div>',d,Ext.util.Format.ellipsis(d,17));b+=" with-categories";
var e=Zarafa.common.categories.Util.getCategories(a),e='<div class="k-category"><div class="k-category-add-container"><span class="k-category-add"></span></div><div class="k-category-container">'+Zarafa.common.categories.Util.getCategoriesHtml(e)+"</div></div>",f=this.getSubjectCell(a);a=this.getBodyCell(a);Ext.isEmpty(f)?(c.body+='<div class="k-right-column"><div class="k-folder-location-row">'+d+"</div>"+e+"</div>",b+=" with-no-subject"):c.body+=d+f+e;c.body+=a+"</div>";return"x-grid3-row-expanded "+
b}return"x-grid3-row-collapsed "+b},getBodyCell:function(a){var b={};switch(a.get("message_class")){case "IPM.Contact":a=Ext.util.Format.htmlEncode(a.get("email_address_1"));break;case "IPM.Task":case "IPM.TaskRequest":a=Zarafa.common.ui.grid.Renderers.percentage(a.get("percent_complete"),b,a);break;default:a=Ext.util.Format.htmlEncode(a.get("body"))}return String.format('<div class="grid_compact grid_compact_left grid_compact_body {0}">{1}</div>',b.css,a)},getSubjectCell:function(a){var b="",c={};
a.isMessageClass("IPM.Contact")?b=Zarafa.advancesearch.ui.SearchGridRenderers.phoneNumber(a.get("home_telephone_number"),c,a):a.isMessageClass("IPM.StickyNote")||(b=Zarafa.common.ui.grid.Renderers.subject(a.get("subject"),c,a));Ext.isEmpty(b)||(b=String.format('<div class="grid_compact grid_compact_left grid_compact_subject {0}">{1}</div>',c.css,b));return b},onContextViewChange:function(a,b,c){c===Zarafa.common.data.Views.LIVESCROLL&&this.getView().resetScroll()},onHeaderClick:function(a,b,c){a=
this.store.suggestion;Ext.isEmpty(a)||"zarafa-search-suggestion"!==c.target.className||(c=this.searchCenterPanel.searchPanel.searchToolbar.getAdvanceSearchField(),c.setValue(a),c.onTriggerClick())},onCellClick:function(a,b,c,d){a=this.store.getAt(b);Ext.isDefined(a)&&(c=this.getColumnModel().getDataIndex(c),"icon_index"===c?Zarafa.common.Actions.markAsRead(a,!a.isRead()):"flag_due_by"===c&&Zarafa.common.Actions.openFlagsMenu(a,d.getXY()))},onRowClick:function(a,b,c){Ext.get(c.target).hasClass("k-category-add")&&
(a=this.store.getAt(b),Zarafa.common.Actions.openCategoriesMenu([a],c.getXY()))},onRowContextMenu:function(a,b,c){a=this.getSelectionModel();a.hasSelection()?a.isSelected(b)||(a.clearSelections(),a.selectRow(b)):a.selectRow(b);b=a.getSelections();Zarafa.core.data.UIFactory.openDefaultContextMenu(b,{position:c.getXY(),context:this.searchContext})},onRowDblClick:function(a,b,c){Zarafa.common.Actions.openMessageContent(this.getSelectionModel().getSelected())},onRowSelect:function(a,b,c){b=a.getCount();
0===b?this.model.setPreviewRecord(void 0):1==b&&a.getSelected()===c&&this.model.setPreviewRecord(c)},onSelectionChange:function(a){a=a.getSelections();this.model.setSelectedRecords(a);Ext.isEmpty(a)&&this.model.setPreviewRecord(void 0)},onLiveScrollStart:function(a){this.model.startLiveScroll(a)},onBeforeSort:function(a){if("searchdate"===this.getColumnModel().getDataIndex(a.activeHdIndex)){var b=this.getStore();a=b.getTotalCount();if(a>=this.sortableRecordsMax)return Zarafa.common.dialogs.MessageBox.alert(_("Sorting tip"),
_("You can sort by date if you narrow down your search results. Enable filters or adjust your input.")),!1;this.model.stopLiveScroll();b.remoteSort=!1;this.dialog.findByType("zarafa.paging")[0].pageSize=this.sortableRecordsMax;b.getCount()<a&&(b.isExecuting("list")&&b.proxy.cancelRequests("list"),a={actionType:Zarafa.core.Actions.list,folder:this.model.getFolders()[0],params:{restriction:{start:0,limit:a}},callback:function(){b.sort(b.sortInfo.field,b.sortInfo.direction)}},b.load(a))}},onSearchStop:function(a){this.loadMask.hide()},
onBeforeUpdateSearch:function(a,b){if(Ext.isDefined(a.lastOptions)&&a.lastOptions.originalActionType!==Zarafa.core.Actions.updatesearch){var c=this.getColumnModel();if(Ext.isEmpty(a.suggestion))c.setColumnHeader(0,""),c.setColumnTooltip(0,"");else{var d=Ext.util.Format.htmlEncode(a.suggestion);c.setColumnHeader(0,_("Did you mean")+' <span class="zarafa-search-suggestion">'+d+"</span> ?");c.setColumnTooltip(0,_("Did you mean")+" "+d)}}},onContextViewModeChange:function(a,b,c){a=b===Zarafa.mail.data.ViewModes.RIGHT_PREVIEW;
this.getView().enableRowBody=a;this.getColumnModel().setCompactView(a)}});Ext.reg("zarafa.searchgrid",Zarafa.advancesearch.ui.SearchGrid);Ext.namespace("Zarafa.advancesearch.ui");
Zarafa.advancesearch.ui.SearchPanelToolbar=Ext.extend(Zarafa.mail.ui.MailPanelToolbar,{constructor:function(a){a=a||{};Zarafa.advancesearch.ui.SearchPanelToolbar.superclass.constructor.call(this,a);this.on("afterlayout",this.onAfterLayout,this)},onAfterLayout:function(){this.resizeSearchField()},initComponent:function(){Zarafa.advancesearch.ui.SearchPanelToolbar.superclass.initComponent.call(this);this.pagesToolbar.bindStore(this.model.getStore())}});Ext.reg("zarafa.searchpaneltoolbar",Zarafa.advancesearch.ui.SearchPanelToolbar);
Ext.namespace("Zarafa.calendar.data");Zarafa.calendar.data.BusyStatus=[{value:Zarafa.core.mapi.BusyStatus.FREE,name:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.FREE)},{value:Zarafa.core.mapi.BusyStatus.TENTATIVE,name:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.TENTATIVE)},{value:Zarafa.core.mapi.BusyStatus.BUSY,name:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.BUSY)},{value:Zarafa.core.mapi.BusyStatus.OUTOFOFFICE,name:Zarafa.core.mapi.BusyStatus.getDisplayName(Zarafa.core.mapi.BusyStatus.OUTOFOFFICE)}];
Ext.namespace("Zarafa.calendar.data.busytime");Zarafa.calendar.data.busytime.BusyTimeRecordFields=[{name:"startdate",type:"date",dateFormat:"timestamp"},{name:"duedate",type:"date",dateFormat:"timestamp"},{name:"busystatus",type:"int",defaultValue:Zarafa.core.mapi.BusyStatus.FREE}];Zarafa.calendar.data.busytime.BusyTimeRecord=Ext.data.Record.create(Zarafa.calendar.data.busytime.BusyTimeRecordFields);Ext.namespace("Zarafa.calendar.data.busytime");
Zarafa.calendar.data.busytime.BusyTimeResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doList:function(a){this.receivedRecords=this.readRecordsFromResponse(a,"item")}});Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.AppointmentToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{insertionPointBase:"context.calendar.appointmentcontentpanel",actionItems:this.createActionButtons(),optionItems:this.createOptionButtons()});Zarafa.calendar.dialogs.AppointmentToolbar.superclass.constructor.call(this,a);this.mon(this.saveMeeting,"beforeshow",this.onSaveButtonBeforeShow,
this)},createActionButtons:function(){return[{xtype:"zarafa.meetingrequestbuttons"},{xtype:"button",overflowText:_("Send invitation"),text:_("Send"),tooltip:{title:_("Send invitation"),text:_("Send invitation to recipients")+" (Ctrl + ENTER)"},iconCls:"buttons-icon_send_white",cls:"button_sendMail zarafa-action",ref:"sendInvitation",handler:this.onSendButton,scope:this},{xtype:"button",text:_("Save"),overflowText:_("Save & Close"),tooltip:{title:_("Save & Close"),text:_("Save appointment and close dialog")+
" (Ctrl + S)"},cls:"zarafa-action",iconCls:"buttons-icon_save_white",ref:"saveAppointment",handler:this.onSaveButton,scope:this},{xtype:"button",overflowText:_("Save"),tooltip:{title:_("Save"),text:_("Save without sending an invitation to recipients")+" (Ctrl + S)"},cls:"tb-calendar-btn-save",iconCls:"icon_saveEmail",ref:"saveMeeting",handler:this.onSaveButton,scope:this},{xtype:"button",overflowText:_("Delete"),tooltip:{title:_("Delete"),text:_("Delete this appointment")},cls:"tb-calendar-btn-delete",
iconCls:"icon_delete",ref:"deleteAppointment",handler:this.onDeleteButton,scope:this},{xtype:"zarafa.attachmentbutton",plugins:["zarafa.recordcomponentupdaterplugin"],ref:"normalAttachmentsButton",overflowText:_("Add attachment"),tooltip:{title:_("Add attachment"),text:_("Add attachments to this appointment")},cls:"tb-calendar-btn-add-attachment",iconCls:"icon_attachment",listeners:{added:this.onAttachmentButtonAdded,scope:this}},{xtype:"button",ref:"occurenceAttachmentsButton",overflowText:_("Cannot add attachment"),
tooltip:{title:_("Cannot add attachment"),text:_("Attachments cannot be modified for a single occurence")},cls:"tb-calendar-btn-occurence-attachment",iconCls:"icon_attachment",handler:function(){Ext.MessageBox.show({title:_("Warning"),msg:_("Attachments cannot be modified for a single occurence"),buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING})}},{xtype:"button",overflowText:_("Print"),tooltip:{title:_("Print"),text:_("Print this appointment")},cls:"tb-calendar-btn-print",iconCls:"icon_print",handler:function(){Zarafa.common.Actions.openPrintDialog(this.record)},
scope:this},{xtype:"button",overflowText:_("Check names"),tooltip:{title:_("Check names"),text:_("Check all recipient names")},cls:"tb-calendar-btn-checknames",iconCls:"icon_checkNames",ref:"checkNames",handler:this.onCheckNamesButton,scope:this}]},onAttachmentButtonAdded:function(a){a.isXType("menuitem")&&(a.update=Zarafa.common.attachment.ui.AttachmentButton.prototype.update.createDelegate(this.normalAttachmentsButton))},createOptionButtons:function(){return[{xtype:"button",text:_("Recurrence"),
overflowText:_("Recurrence"),tooltip:{title:_("Recurrence"),text:_("Open the recurrence dialog")},cls:"tb-calendar-btn-recurrence",iconCls:"icon_recurrence",ref:"recurrence",handler:this.onSetRecurrence,scope:this},{xtype:"button",text:_("Invite attendees"),overflowText:_("Invite attendees"),tooltip:{title:_("Invite attendees"),text:_("Invite attendees for this appointment")},cls:"tb-calendar-btn-ivite-attendees",iconCls:"icon_invite_attendees",ref:"inviteAttendees",handler:this.onSetMeetingRequest,
scope:this},{xtype:"button",text:_("Cancel invitation"),tooltip:{title:_("Cancel invitation"),text:_("Convert this meeting request to an appointment by removing attendees")},overflowText:_("Cancel invitation"),cls:"tb-calendar-btn-cancel",iconCls:"icon_cancel_meeting_request",ref:"cancelInvitation",handler:this.onCancelMeetingRequest,scope:this},{xtype:"button",overflowText:_("High priority"),tooltip:{title:_("High priority"),text:_("Mark this appointment as high priority")},cls:"tb-calendar-btn-high-priority",
iconCls:"icon_setHighPriority",ref:"highPriority",toggleGroup:"priorityGroup",importance:Zarafa.core.mapi.Importance.URGENT,enableToggle:!0,toggleHandler:this.onPriorityGroupToggle,scope:this},{xtype:"button",overflowText:_("Low priority"),tooltip:{title:_("Low priority"),text:_("Mark this appointment as low priority")},cls:"tb-calendar-btn-low-priority",iconCls:"icon_setLowPriority",ref:"lowPriority",toggleGroup:"priorityGroup",importance:Zarafa.core.mapi.Importance.NONURGENT,enableToggle:!0,toggleHandler:this.onPriorityGroupToggle,
scope:this},{xtype:"button",overflowText:_("Categories"),tooltip:{title:_("Categories"),text:_("Open the categories dialog")},cls:"tb-calendar-btn-categories",iconCls:"icon_categories",handler:this.onCategories,scope:this},{xtype:"button",overflowText:_("Private"),tooltip:{title:_("Private"),text:_("Mark this appointment as private")},cls:"tb-calendar-btn-private",iconCls:"icon_private",ref:"setPrivate",enableToggle:!0,toggleHandler:this.onPrivateGroupToggle,scope:this}]},onSetRecurrence:function(){Zarafa.common.Actions.openRecurrenceContent(this.record,
{autoSave:!1})},onSetMeetingRequest:function(){this.record.convertToMeeting()},onCancelMeetingRequest:function(){this.record.isMeetingSent()?this.record.isAppointmentInPast()?this.dialog.deleteRecord():Zarafa.calendar.Actions.openSendCancellationContent(this.record):this.record.convertToAppointment()},onPriorityGroupToggle:function(a){a.pressed?this.record.set("importance",a.importance):this.record.set("importance",Zarafa.core.mapi.Importance.NORMAL)},onCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.record,
{autoSave:!1})},onPrivateGroupToggle:function(a){this.record.beginEdit();this.record.set("private",a.pressed);a.pressed?this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.PRIVATE):this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.NONE);this.record.endEdit()},onCheckNamesButton:function(a){this.record.getRecipientStore().resolve(void 0,{cancelPreviousRequest:!0})},onSendButton:function(a){this.dialog.sendRecord()},onSaveButton:function(a){this.dialog.saveRecord()},onDeleteButton:function(a){this.dialog.deleteRecord()},
onSaveButtonBeforeShow:function(a){if(this.record.isMeetingReceived()){var b={title:_("Save & Close"),text:_("Save meeting request and close dialog")+" (Ctrl + S)"};a.setTooltip(b)}},update:function(a,b){var c=!1;this.record=a;if(a.isSubMessage())this.sendInvitation.setVisible(!1),this.saveAppointment.setVisible(!1),this.saveMeeting.setVisible(!1),this.checkNames.setVisible(!1),this.deleteAppointment.setVisible(!1),this.inviteAttendees.setVisible(!1),this.cancelInvitation.setVisible(!1),this.setPrivate.setVisible(!1),
this.highPriority.setVisible(!1),this.lowPriority.setVisible(!1),c=!0;else{this.setPrivate.setVisible(!0);this.highPriority.setVisible(!0);this.lowPriority.setVisible(!0);this.deleteAppointment.setDisabled(!0===a.phantom);if(!0===b||a.isModifiedSinceLastUpdate("recurring"))Ext.isEmpty(a.get("basedate"))?this.recurrence.setVisible(!0):this.recurrence.setVisible(!1),c=!0;if(!0===b||a.isModifiedSinceLastUpdate("meeting")){switch(a.get("meeting")){default:this.sendInvitation.setVisible(!1);this.saveAppointment.setVisible(!0);
this.saveMeeting.setVisible(!1);this.deleteAppointment.setVisible(!0);this.checkNames.setVisible(!1);this.inviteAttendees.setVisible(!0);this.cancelInvitation.setVisible(!1);break;case Zarafa.core.mapi.MeetingStatus.MEETING:this.sendInvitation.setVisible(!0);this.saveAppointment.setVisible(!1);this.saveMeeting.setVisible(!0);this.deleteAppointment.setVisible(!1);this.checkNames.setVisible(!0);this.inviteAttendees.setVisible(!1);this.cancelInvitation.setVisible(!0);break;case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED:case Zarafa.core.mapi.MeetingStatus.MEETING_CANCELED:case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED_AND_CANCELED:this.sendInvitation.setVisible(!1),
this.saveAppointment.setVisible(!1),this.saveMeeting.setVisible(!0),this.deleteAppointment.setVisible(!0),this.checkNames.setVisible(!1),this.inviteAttendees.setVisible(!1),this.cancelInvitation.setVisible(!1)}c=!0}if(!0===b||a.isModifiedSinceLastUpdate("importance"))switch(a.get("importance")){case Zarafa.core.mapi.Importance.URGENT:this.highPriority.toggle(!0,!0);break;case Zarafa.core.mapi.Importance.NONURGENT:this.lowPriority.toggle(!0,!0)}(!0===b||a.isModifiedSinceLastUpdate("private"))&&this.setPrivate.toggle(a.get("private"),
!0)}!0===b&&(a.isRecurringOccurence()?(this.occurenceAttachmentsButton.setVisible(!0),this.normalAttachmentsButton.setVisible(!1)):(this.occurenceAttachmentsButton.setVisible(!1),this.normalAttachmentsButton.setVisible(!0)),c=!0);!0===c&&this.doLayout()}});Ext.reg("zarafa.appointmenttoolbar",Zarafa.calendar.dialogs.AppointmentToolbar);Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.ProposeNewTimePanel=Ext.extend(Ext.Panel,{record:void 0,responseType:Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.proposenewtimepanel",layout:{type:"vbox",align:"stretch"},border:!1,defaults:{border:!1,bodyStyle:"padding-bottom: 5px; background-color: inherit;"},items:this.createProposeTimePanel()});Zarafa.calendar.dialogs.ProposeNewTimePanel.superclass.constructor.call(this,a);this.update(this.record,!0)},
createProposeTimePanel:function(){return[{xtype:"zarafa.datetimeperiodfield",ref:"datetimePeriod",defaultPeriod:30,width:300,startFieldConfig:{name:"startdate",fieldLabel:_("Start time"),labelWidth:100,listeners:{change:this.onFieldChange,scope:this}},endFieldConfig:{name:"duedate",fieldLabel:_("End time"),labelWidth:100,listeners:{change:this.onFieldChange,scope:this}}},{layout:{type:"hbox",pack:"start",align:"stretch"},items:[{xtype:"label",text:_("Comment")+": ",width:105},{xtype:"textarea",ref:"../comment",
flex:1}],flex:1}]},update:function(a,b){var c,d;a.isMessageClass("IPM.Schedule.Meeting.Request",!0)?(c=a.get("appointment_startdate"),d=a.get("appointment_duedate")):(c=a.get("startdate"),d=a.get("duedate"));c&&d&&this.datetimePeriod.getValue().set(c,d)},updateRecord:function(a){a.proposeNewTimeToMeetingRequest(this.responseType,this.comment.getValue(),this.datetimePeriod.getValue().startDate,this.datetimePeriod.getValue().dueDate)}});Ext.reg("zarafa.proposenewtimepanel",Zarafa.calendar.dialogs.ProposeNewTimePanel);
Ext.namespace("Zarafa.calendar.printer");
Zarafa.calendar.printer.MeetingRenderer=Ext.extend(Zarafa.common.printer.renderers.RecordRenderer,{generateBodyTemplate:function(a){var b;b="<b>{fullname:htmlEncode}</b>\n<hr>\n<table>\n"+this.addRow(_("Subject"),"{subject:htmlEncode}");b+=this.optionalRow(_("Location"),"location","{location:htmlEncode}");b+=this.addRow("","");b+=this.addRow(_("Start"),'{startdate:date("'+_("l jS F Y G:i")+'")}');b+=this.addRow(_("End"),'{enddate:date("'+_("l jS F Y G:i")+'")}');b+=this.addRow("","");b+=this.optionalRow(_("Recurrence pattern"),
"recurring_pattern","{recurring_pattern:htmlEncode}");b+=this.optionalRow("","recurring_pattern","");b+=this.optionalRow(_("Organiser"),"sender_name","{sender_name:htmlEncode}");b+=this.optionalRow(_("Meeting status"),"responsestatus","{responsestatus:responseStatusString}");b=b+'<tpl if="!Ext.isEmpty(values.sender_name) || !Ext.isEmpty(values.responsestatus)">'+this.addRow("","");b=b+"</tpl>"+this.optionalRow(_("Required Attendees"),"display_to","{display_to:htmlEncode}");b+=this.optionalRow(_("Optional Attendees"),
"display_cc","{display_cc:htmlEncode}");b+=this.optionalRow(_("Resources"),"display_bcc","{display_bcc:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Sensitivity"),"sensitivity","{sensitivity:sensitivityString}");b+=this.optionalRow(_("Importance"),"importance","{importance:importanceString}");b=b+'<tpl if="!Ext.isEmpty(values.sensitivity) || !Ext.isEmpty(values.importance)">'+this.addRow("","");b=b+"</tpl>"+this.optionalRow(_("Attachments"),"attachment_names","{attachment_names:htmlEncode}");
b=b+"</table><br><p>\n"+a.getBody(!0);return b+"</p>\n"},prepareData:function(a){var b=Zarafa.calendar.printer.MeetingRenderer.superclass.prepareData.apply(this,arguments);a.isMessageClass("IPM.Schedule",!0)?(b.startdate=b.appointment_startdate,b.enddate=b.appointment_duedate,b.location=b.appointment_location,b.recurring_pattern=b.appointment_recurring_pattern):(b.startdate=b.commonstart,b.enddate=b.commonend);return b}});Ext.namespace("Zarafa.calendar.printer");
Zarafa.calendar.printer.WeekViewRenderer=Ext.extend(Zarafa.calendar.printer.DaysViewRenderer,{constructor:function(a){a=a||{};Ext.applyIf(a,{timeStyle:"width:33%;"});Zarafa.calendar.printer.WeekViewRenderer.superclass.constructor.call(this,a)},generateBodyTemplate:function(a){a='<table class="print-calendar" cellpadding=0 cellspacing=0>\n<tr style="height:10%;"><td colspan=2><table id="top">\n'+('<tr><td align="left" width="60%">{startdate:date("'+_("l d/m/Y")+'")} -</td><td align="center" valign="top" width="20%" rowspan=2><div id=datepicker_left></div></td><td align="center" valign="top" width="20%" rowspan=2><div id=datepicker_right></div></td></tr>');
a+='<tr><td align=left>{duedate:date("'+_("l jS F Y")+'")}</tr>';a=a+"</table></td></tr>\n"+('<tr style="height:40px;">  <th class="date-header">{date1:date("'+_("l jS F")+'")}</th>  <th class="date-header">{date4:date("'+_("l jS F")+'")}</th></tr><tr style="height:25%;">  <td valign="top"><table id="date1">{date1_table_data}</table></td>  <td valign="top"><table id="date4">{date4_table_data}</table></td></tr><tr style="height:40px;">  <th class="date-header">{date2:date("'+_("l jS F")+'")}</th>  <th class="date-header">{date5:date("'+
_("l jS F")+'")}</th></tr><tr style="height:25%;">  <td valign="top"><table id="date2">{date2_table_data}</table></td>  <td valign="top"><table id="date5">{date5_table_data}</table></td></tr><tr style="height:40px;">  <th class="date-header">{date3:date("'+_("l jS F")+'")}</th>  <th class="date-header">{date6:date("'+_("l jS F")+'")}</th></tr><tr>  <td valign="top" rowspan=3><table id="date4">{date3_table_data}</table></td>  <td valign="top" style="height:15%;"><table id="date6">{date6_table_data}</table></td></tr>  <tr style="height:40px;">  <th class="date-header">{date7:date("'+
_("l jS F")+'")}</th></tr><tr>  <td valign="top"><table id="date7">{date7_table_data}</table></td></tr>');return a=a+"</table>"+('<table id="bottom"><tr><td class="nowrap" align=left>{fullname:htmlEncode}</td><td class="nowrap" align=right>{currenttime:date("'+_("l jS F Y G:i")+'")}</td></tr></table>\n')}});Ext.namespace("Zarafa.calendar.printer");
Zarafa.calendar.printer.WorkWeekViewRenderer=Ext.extend(Zarafa.calendar.printer.DaysViewRenderer,{constructor:function(a){a=a||{};Ext.applyIf(a,{timeStyle:"width:10%;"});Zarafa.calendar.printer.WorkWeekViewRenderer.superclass.constructor.call(this,a)},generateBodyTemplate:function(a){a='<table class="print-calendar" cellpadding=0 cellspacing=0>\n<tr style="height:10%;"><td><table id="top">\n'+('<tr><td align="left" width="60%">{startdate:date("'+_("l jS F Y")+'")} -</td><td align="center" valign="top" width="20%" rowspan=2><div id=datepicker_left></div></td><td align="center" valign="top" width="20%" rowspan=2><div id=datepicker_right></div></td></tr>');
a+='<tr><td align=left>{duedate:date("'+_("l jS F Y")+'")}</tr>';a=a+"</table></td></tr>\n"+('<tr style="height:30px;">  <th class="date-header-center">{date1:date("'+_("l jS F")+'")}</th></tr><tr style="height:10%;">  <td valign="top"><table id="date1">{date1_table_data}</table></td></tr><tr style="height:30px;">  <th class="date-header-center">{date2:date("'+_("l jS F")+'")}</th></tr><tr style="height:10%;">  <td valign="top"><table id="date2">{date2_table_data}</table></td></tr><tr style="height:30px;">  <th class="date-header-center">{date3:date("'+
_("l jS F")+'")}</th></tr><tr style="height:10%;">  <td valign="top"><table id="date3">{date3_table_data}</table></td></tr><tr style="height:30px;">  <th class="date-header-center">{date4:date("'+_("l jS F")+'")}</th></tr><tr style="height:10%;">  <td valign="top"><table id="date4">{date4_table_data}</table></td></tr><tr style="height:30px;">  <th class="date-header-center">{date5:date("'+_("l jS F")+'")}</th></tr><tr style="height:10%;">  <td valign="top"><table id="date5">{date5_table_data}</table></td></tr>');
return a=a+"</table>"+('<table id="bottom"><tr><td class="nowrap" align=left>{fullname:htmlEncode}</td><td class="nowrap" align=right>{currenttime:date("'+_("l jS F Y G:i")+'")}</td></tr></table>\n')}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AbstractCalendarBoxView=Ext.extend(Zarafa.calendar.ui.AbstractCalendarView,{dayBoxConfigurations:void 0,firstDayOfWeek:1,dayHeaderHeight:24,headerHeight:30,appointmentHeight:30,expandThreshold:10,numDaysInWeek:7,shortDayHeaderFormat:_("l"),longDayHeaderFormat:_("l"),constructor:function(a){a=a||{};Ext.isDefined(a.firstDayOfWeek)||(a.firstDayOfWeek=container.getSettingsModel().get("zarafa/v1/main/week_start"));Ext.applyIf(a,{appointmentBodyLeftMargin:6,appointmentBodyRightMargin:6});
!0===a.enableDD&&Ext.apply(a,{enableDD:!1,enableBodyDD:!0});Zarafa.calendar.ui.AbstractCalendarBoxView.superclass.constructor.call(this,a)},getDesiredHeaderHeight:function(){return this.headerHeight},getDayHeaderTitle:function(a,b){return a.format(b>=this.parentView.minHeaderDayTextWidth?this.longDayHeaderFormat:this.shortDayHeaderFormat)},screenLocationToDate:function(a,b){for(var c=a-this.body.getLeft(),d=b-this.body.getTop(),e=0,f;f=this.dayBoxConfigurations[e];e++)if(c>f.left&&c<=f.right&&d>f.top&&
d<=f.bottom)return f.date;return null},screenLocationToDateRange:function(a,b){var c=this.screenLocationToDate(a,b);if(Ext.isDate(c)){c.setHours(12);var d=c.add(Date.DAY,1);return new Zarafa.core.DateRange({startDate:c.clearTime(),dueDate:d.clearTime()})}return null},dateRangeToBodyBounds:function(a,b,c,d){var e=this.getVisibleDateRange();c=this.getVisibleWeekCount(e);var f=void 0===b;b=b||0;var g=e.getStartDate(),e=a.getStartDate(),h=a.getDueDate(),g=g.clone();g.setHours(12);e=e.clone();e.setHours(12);
h=h.clone();h.setHours(12);var k=[],l=d?this.appointmentBodyLeftMargin:0;d=d?this.appointmentBodyRightMargin:0;for(var m=0;m<c;m++){var n=g.add(Date.DAY,this.numDaysInWeek);n.setHours(12);var p=Math.floor(Date.diff(Date.DAY,e,g)),g=Math.floor(Date.diff(Date.DAY,h,g)),r=a.getDueDate();r.getTime()==r.clearTime(!0).getTime()&&(a.isZeroMinuteRange()||g--);p=Math.max(p,0);g=Math.min(g,6);if(7>p&&0<=g){var p=this.dayBoxConfigurations[7*m+p],g=this.dayBoxConfigurations[7*m+g],r=p.top+this.dayHeaderHeight+
this.appointmentHeight*b-3*b,q=f?p.bottom:r+this.appointmentHeight;(f||q<p.bottom-this.expandThreshold)&&k.push({left:p.left+l+1,right:g.right-d-1,top:r,bottom:q,firstBox:!0,lastBox:!0})}g=n;if(g>h)break}return k},findAppointmentsByRange:function(a){for(var b=[],c=0,d;d=this.appointments[c];c++)a.inside(d.getDateRange())&&b.push(d);return b},maxSlotInRange:function(a){for(var b=0,c=0,d;d=this.appointments[c];c++)a.overlaps(d.getDateRange())&&(b=Math.max(b,d.slot));return b},getVisibleDateRange:function(){var a=
this.getStartDate().getPreviousWeekDay(this.firstDayOfWeek),b=this.getDueDate().getNextWeekDay(this.firstDayOfWeek);return new Zarafa.core.DateRange({startDate:a,dueDate:b})},getVisibleWeekCount:function(a){a=a||this.getVisibleDateRange();return Math.round(Date.diff(Date.DAY,a.getDueDate(),a.getStartDate())/7)},calculateDayBoxConfigurations:function(a){a||(a=this.body.getHeight());var b=this.getVisibleDateRange(),c=this.getVisibleWeekCount(b);this.dayBoxConfigurations=[];var d=(this.body.getWidth()-
1)/this.numDaysInWeek;a=(a-1)/c;b=b.getStartDate().clone();b.setHours(12);for(var e=(new Date).clearTime().getTime(),f=0;f<c;f++)for(var g=0;g<this.numDaysInWeek;g++){var h=0,k=b.add(Date.DAY,f*this.numDaysInWeek+g),l=k.add(Date.DAY,1);k.clearTime();l.clearTime();var l=new Zarafa.core.DateRange({startDate:k,dueDate:l}),m=0<=this.parentView.workingDays.indexOf(k.getDay()),n=this.findAppointmentsByRange(l);Ext.each(n,function(a){a=a.getRecord().get("busystatus");h=Math.max(h,a)});var n=Math.floor((Math.round((f+
1)*a)+1-Math.round(f*a)-this.headerHeight-this.expandThreshold)/this.appointmentHeight),p=this.contextModel.getActiveDateRange();this.dayBoxConfigurations.push(new Zarafa.calendar.data.DayBoxConfiguration({left:Math.round(g*d),right:Math.round((g+1)*d)+1,top:Math.round(f*a),bottom:Math.round((f+1)*a)+1,date:k,today:e==k.getTime(),workingDay:m,busyStatus:h,overflow:this.maxSlotInRange(l)>=n,active:k.getTime()>=p.getStartDate().getTime()&&k.getTime()<p.getDueDate().getTime()}))}return this.dayBoxConfigurations}});
Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AbstractCalendarDaysView=Ext.extend(Zarafa.calendar.ui.AbstractCalendarView,{dayLayoutPositions:[],rowCount:1,shortDayHeaderFormat:_("jS"),longDayHeaderFormat:_("l jS F"),constructor:function(a){a=a||{};Ext.applyIf(a,{appointmentBodyLeftMargin:1});Zarafa.calendar.ui.AbstractCalendarDaysView.superclass.constructor.call(this,a)},getDesiredHeaderHeight:function(){return Math.max(this.rowCount||1,1)*this.parentView.headerItemHeight+this.parentView.headerTextHeight},getAppointmentHeaderheight:function(){return this.header.getHeight()-
this.parentView.headerTextHeight},isHeaderRange:function(a){return 1<=a.getDuration(Date.DAY)},getDayHeaderTitle:function(a,b){return a.format(b>=this.parentView.minHeaderDayTextWidth?this.longDayHeaderFormat:this.shortDayHeaderFormat)},calculateDayLayoutPositions:function(){var a=(new Date).clearTime().getTime(),b=this.getDateRange().getStartDate(),c=this.getDateRange().getNumDays(),d=(this.body.getWidth()-1)/c,b=b.clone();b.setHours(12);this.dayLayoutPositions=[];for(var e=0;e<c;e++){var f=b.add(Date.DAY,
e).clearTime(),g=0<=this.parentView.workingDays.indexOf(f.getDay());this.dayLayoutPositions.push(new Zarafa.calendar.data.DayLayoutPosition({left:Math.round(e*d),right:Math.round((e+1)*d)+1,date:f,today:a==f.getTime(),workingDay:g}))}return this.dayLayoutPositions},locationToDate:function(a,b){var c=this.getDateRange().getNumDays(),d=this.parentView.numHours*this.parentView.getHourHeight(),e;if(a<this.dayLayoutPositions[0].left)e=0;else if(a>this.dayLayoutPositions[c-1].right)e=c-1;else for(c=0;c<
this.dayLayoutPositions.length;c++)if(a>=this.dayLayoutPositions[c].left&&a<=this.dayLayoutPositions[c].right){e=c;break}c=this.getDateRange().getStartDate().clone();c.setHours(12);c=c.add(Date.DAY,e).clearTime();d=b/d*Date.dayInMillis;0<d&&(d-=1E3*(3600*c.getHours()+60*c.getMinutes()));return c.add(Date.MILLI,d)},screenLocationToDate:function(a,b){return Zarafa.core.Util.inside(this.header.parent().getBox(),a,b)?this.locationToDate(a-this.header.getX(),0):this.locationToDate(a-this.body.getX(),b-
this.body.getY())},screenLocationToDateRange:function(a,b){var c;if(Zarafa.core.Util.inside(this.header.parent().getBox(),a,b)){c=this.locationToDate(a-this.header.getX(),0).clearTime();var d=c.clone();d.setHours(12);d=d.add(Date.DAY,1).clearTime();return new Zarafa.core.DateRange({startDate:c,dueDate:d})}c=this.locationToDate(a-this.body.getX(),b-this.body.getY());d=6E4*this.getZoomLevel();c=c.getTime()-c.getTime()%d;return new Zarafa.core.DateRange({startDate:new Date(c),dueDate:new Date(c+d)})},
getDayColumn:function(a){var b=this.getDateRange().getStartDate(),b=b.clearTime(!0);a=a.clearTime(!0);return Math.floor(Date.diff(Date.DAY,a,b))},getDateVerticalPosition:function(a){var b=6E4*a.getTimezoneOffset();return(a.getTime()-b)%Date.dayInMillis/Date.dayInMillis},getRangeVerticalHeight:function(a){var b=this.parentView.numHours*this.parentView.getHourHeight(),c=a.getDuration(),c=c+Date.getDSTDiff(a.getStartDate(),a.getDueDate());return c*b/Date.dayInMillis},dateRangeToBodyBounds:function(a,
b,c,d){var e=[],f=this.dayLayoutPositions.length,g=this.parentView.numHours*this.parentView.getHourHeight(),h=d?this.appointmentBodyLeftMargin:0;d=d?this.appointmentBodyRightMargin:0;var k=a.getStartDate(),l=a.getDueDate();b=b||0;c=c||1;if(l.getTime()<=k.getTime())return[];var m=this.getDayColumn(k);a=this.getDayColumn(l);if(0>a||m>=f)return[];k=Math.floor(this.getDateVerticalPosition(k)*g);l=Math.floor(this.getDateVerticalPosition(l)*g);k--;if(m==a){var n=(this.dayLayoutPositions[m].right-this.dayLayoutPositions[m].left-
1-d-h)/c,p=this.dayLayoutPositions[m].left+n*b+h+1;e.push(new Zarafa.calendar.data.AppointmentBounds({left:Math.round(p),right:Math.round(p+n),top:k,bottom:l,firstBox:!0,lastBox:!0}))}else{0<=m&&(n=(this.dayLayoutPositions[m].right-this.dayLayoutPositions[m].left-1-d-h)/c,p=this.dayLayoutPositions[m].left+n*b+h,e.push(new Zarafa.calendar.data.AppointmentBounds({left:Math.round(p),right:Math.round(p+n),top:k,bottom:g,firstBox:!0})));for(m=Math.max(m+1,0);m<=Math.min(a-1,f-1);m++)n=(this.dayLayoutPositions[m].right-
this.dayLayoutPositions[m].left-1-d-h)/c,p=this.dayLayoutPositions[m].left+n*b+h,e.push(new Zarafa.calendar.data.AppointmentBounds({left:Math.round(p),right:Math.round(p+n),top:-1,bottom:g}));a<f&&0<l&&(n=(this.dayLayoutPositions[a].right-this.dayLayoutPositions[a].left-1-d-h)/c,p=this.dayLayoutPositions[a].left+n*b+h,e.push(new Zarafa.calendar.data.AppointmentBounds({left:Math.round(p),right:Math.round(p+n),top:-1,bottom:l,lastBox:!0})))}return e},dateRangeToHeaderBounds:function(a,b,c,d){var e=
this.dayLayoutPositions.length,f=d?this.appointmentHeaderLeftMargin:0;d=d?this.appointmentHeaderRightMargin:0;var g=this.parentView.headerTextHeight,h=a.getStartDate();a=a.getDueDate();var h=this.getDayColumn(h),k=this.getDayColumn(a);b=b||0;c=c||this.rowCount;a.clearTime(!0).getTime()===a.getTime()&&k--;return 0>k||h>=e?[]:0>h&&k>=e?new Zarafa.calendar.data.AppointmentBounds({left:this.dayLayoutPositions[0].left,right:this.dayLayoutPositions[e-1].right,top:g+b*this.parentView.headerItemHeight,bottom:g+
(b+c)*this.parentView.headerItemHeight}):0>h?new Zarafa.calendar.data.AppointmentBounds({left:this.dayLayoutPositions[0].left,right:this.dayLayoutPositions[k].right-d,top:g+b*this.parentView.headerItemHeight,bottom:g+(b+c)*this.parentView.headerItemHeight,lastBox:!0}):k>=e?new Zarafa.calendar.data.AppointmentBounds({left:this.dayLayoutPositions[h].left+f,right:this.dayLayoutPositions[e-1].right,top:g+b*this.parentView.headerItemHeight,bottom:g+(b+c)*this.parentView.headerItemHeight,firstBox:!0}):
new Zarafa.calendar.data.AppointmentBounds({left:this.dayLayoutPositions[h].left+f,right:this.dayLayoutPositions[k].right-d,top:g+b*this.parentView.headerItemHeight,bottom:g+(b+c)*this.parentView.headerItemHeight,firstBox:!0,lastBox:!0})},getAppointmentClusters:function(a){a.sort(this.appointmentCompare);for(var b=[],c=[],d=0,e=0,f;f=a[e];e++){var g=f.getDateRange().getStartTime(),h=f.getAdjustedDateRange().getDueTime();0===b.length?(d=h,b.push(f)):g<d?(d=Math.max(h,d),b.push(f)):(c.push(b),b=[f],
d=h)}0<b.length&&c.push(b);return c},calculateBodyOverlaps:function(){var a=[];Ext.each(this.appointments,function(b){this.isHeaderRange(b.getDateRange())||a.push(b)},this);var b=this.getAppointmentClusters(a);Ext.each(b,this.doGreedyColoring,this)},calculateHeaderOverlaps:function(){var a=[];Ext.each(this.appointments,function(b){this.isHeaderRange(b.getDateRange())&&a.push(b)},this);this.doGreedyColoring(a,!0);this.rowCount=0<a.length?a[0].slotCount:0},onAppointmentsLoad:function(a,b,c){Zarafa.calendar.ui.AbstractCalendarDaysView.superclass.onAppointmentsLoad.apply(this,
arguments);this.calculateBodyOverlaps();this.calculateHeaderOverlaps()},addAppointment:function(a,b){if(!Zarafa.calendar.ui.AbstractCalendarDaysView.superclass.addAppointment.apply(this,arguments))return!1;a.get("alldayevent")?this.calculateHeaderOverlaps():this.calculateBodyOverlaps();return!0},removeAppointment:function(a,b){Zarafa.calendar.ui.AbstractCalendarDaysView.superclass.removeAppointment.apply(this,arguments);a.get("alldayevent")?this.calculateHeaderOverlaps():this.calculateBodyOverlaps()},
onBeforeLayout:function(){Zarafa.calendar.ui.AbstractCalendarDaysView.superclass.onBeforeLayout.apply(this,arguments);this.calculateBodyOverlaps();this.calculateHeaderOverlaps()}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.AppointmentView=Ext.extend(Zarafa.calendar.ui.AbstractDateRangeView,{timeFormat:_("G:i"),stripVisible:!0,stripWidth:6,record:void 0,selected:!1,active:!1,adjustedDateRange:void 0,calendarColorScheme:void 0,focusEl:void 0,init:function(){Zarafa.calendar.ui.AppointmentView.superclass.init.call(this);this.record&&this.updateDateRange(this.record)},render:function(a){Zarafa.calendar.ui.AppointmentView.superclass.render.apply(this,arguments);this.create({tag:"a",href:"#",tabindex:-1,
style:"position: absolute; left:-10000px; top:-10000px;"},this.container,"focusEl")},focus:function(){this.focusEl&&this.focusEl.focus()},updateDateRange:function(a){var b=this.getDateRange(),c=this.getAdjustedDateRange(),d=a.get("startdate");a=a.get("duedate");b?b.set(d,a):(b=new Zarafa.core.DateRange({startDate:d,dueDate:a}),this.setDateRange(b));b=Math.max(b.getDuration(Date.MINUTE),this.parentView.getZoomLevel());a=d.add(Date.MINUTE,b);c?c.set(d,a):(c=new Zarafa.core.DateRange({startDate:d,dueDate:a}),
this.setAdjustedDateRange(c))},setAdjustedDateRange:function(a){this.adjustedDateRange=a},getAdjustedDateRange:function(){return this.adjustedDateRange},setSelected:function(a){this.selected=a},isSelected:function(){return this.selected},setActive:function(a){this.active=a},isActive:function(){return this.active},iconRenderer:function(){var a=this.getRecord(),b=[];!0===a.get("private")&&b.push("private");!0===a.isRecurringOccurence()&&(!0===a.isRecurringException()?b.push("exception"):b.push("recurring"));
return b},mainTextRenderer:function(){return Ext.util.Format.htmlEncode(this.record.get("subject"))},subTextRenderer:function(){var a=this.record.get("location");Ext.isEmpty(a)||(a="("+a+")");return Ext.util.Format.htmlEncode(a)},getId:function(){return this.record.id},getRecord:function(){return this.record},getBusyStatus:function(){return this.record.get("busystatus")},getBusyStatusName:function(){return Zarafa.core.mapi.BusyStatus.getName(this.getBusyStatus()).toLowerCase()},getLabel:function(){return this.record.get("label")},
isAllDay:function(){return this.getDateRange().isAllDay()},getStripWidth:function(){return this.stripVisible?this.stripWidth:0},getAppointmentColor:function(){var a=Zarafa.common.categories.Util.getCategories(this.record);return this.isActive()&&!Ext.isEmpty(a)?Zarafa.common.categories.Util.getCategoryColor(a.pop()):this.calendarColorScheme.base}});Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarGridView=Ext.extend(Zarafa.common.ui.grid.MapiMessageGrid,{context:void 0,model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);a=Ext.applyIf(a,{xtype:"zarafa.calendargrid",overCls:"zarafa-calendar-grid-row-over",border:!1,stateful:!0,statefulRelativeDimensions:!1,loadMask:this.initLoadMask(),
viewConfig:this.initViewConfig(),selModel:this.initSelectionModel(),colModel:this.initColumnModel(),enableDragDrop:!0,ddGroup:"dd.mapiitem"});Zarafa.calendar.ui.CalendarGridView.superclass.constructor.call(this,a)},initViewConfig:function(){return{forceFit:!1,getRowClass:this.getRowClass.createDelegate(this)}},initLoadMask:function(){return{msg:_("Loading appointments")+"..."}},initColumnModel:function(){return new Zarafa.calendar.ui.CalendarGridColumnModel},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!1})},
initEvents:function(){Zarafa.calendar.ui.CalendarGridView.superclass.initEvents.call(this);this.mon(this.model,"foldermergestatechanged",this.onFolderMergestateChanged,this);this.on("rowdblclick",this.onRowDblClick,this);this.mon(this.getSelectionModel(),"selectionchange",this.onSelectionChange,this)},onFolderMergestateChanged:function(a,b){b?a.clearGrouping():a.groupBy("parent_entryid")},onRowDblClick:function(a,b,c){Zarafa.calendar.Actions.openAppointmentContent(a.getSelectionModel().getSelections())},
onSelectionChange:function(a){this.model.setSelectedRecords(a.getSelections())},getRowClass:function(a,b,c,d){return"zarafa-calendar-grid-row"}});Ext.reg("zarafa.calendargrid",Zarafa.calendar.ui.CalendarGridView);Ext.namespace("Zarafa.calendar.ui");
Zarafa.calendar.ui.CalendarViewDropZone=Ext.extend(Ext.dd.DropZone,{dropAllowedAdd:"x-dd-drop-ok-add",headerMode:!1,selectingSnapMode:Zarafa.calendar.data.SnapModes.ZOOMLEVEL,draggingSnapMode:Zarafa.calendar.data.SnapModes.ZOOMLEVEL,proxy:void 0,state:Zarafa.calendar.data.DragStates.NONE,dateRange:void 0,initDate:void 0,initDateRange:void 0,constructor:function(a,b){b=b||{};this.calendar=a;var c=this.calendar.body;!0===b.headerMode&&(c=this.calendar.header);Ext.applyIf(b,{ddGroup:"AppointmentDD"});
Zarafa.calendar.ui.CalendarViewDropZone.superclass.constructor.call(this,c,b)},getTargetFromEvent:function(a){var b=this.el;if(!0!==this.headerMode){var c=this.el.parent();if(a.getPageY()<c.getTop()||c.getBottom()<a.getPageY())b=void 0}return b},onNodeEnter:function(a,b,c,d){a=d.selections[0];var e=Zarafa.calendar.data.DragStates;this.state=d.state;this.state!==e.RESIZING_START&&this.state!==e.RESIZING_DUE&&this.state!==e.SELECTING||this.calendar===b.calendar||(this.state=e.DRAGGING);a?(this.initDate=
d.state===e.RESIZING_START||d.state===e.DRAGGING?a.get("startdate"):a.get("duedate"),this.initDateRange=new Zarafa.core.DateRange({startDate:a.get("startdate"),dueDate:a.get("duedate")})):(e=this.calendar.getZoomLevel(),this.initDate=this.calendar.screenLocationToDate(c.getPageX(),c.getPageY()),this.snapMode===Zarafa.calendar.data.SnapModes.DAY?(a=this.initDate.clearTime(!0),e=a.add(Date.DAY,1)):(a=this.initDate.clone().floor(Date.MINUTE,e),e=a.add(Date.MINUTE,e)),this.initDateRange=new Zarafa.core.DateRange({startDate:a,
dueDate:e}));this.dateRange=this.initDateRange.clone();this.onDragKeyDown=Zarafa.calendar.ui.CalendarViewDropZone.prototype.onDragKeyDown.createDelegate({dd:b,dz:this});this.onDragKeyUp=Zarafa.calendar.ui.CalendarViewDropZone.prototype.onDragKeyUp.createDelegate({dd:b,dz:this});Ext.EventManager.on(Ext.getDoc(),"keydown",this.onDragKeyDown,this);Ext.EventManager.on(Ext.getDoc(),"keyup",this.onDragKeyUp,this);this.proxy.setShowTime(this.selectingSnapMode===Zarafa.calendar.data.SnapModes.ZOOMLEVEL);
this.proxy.setDateRange(this.dateRange);this.updateProxy(c.getXY(),d.selections);b.proxy.hide();this.proxy.setVisible(!0)},onNodeOver:function(a,b,c,d){this.updateProxy(c.getXY(),d.selections);return c.ctrlKey?this.dropAllowedAdd:this.dropAllowed},onNodeOut:function(a,b,c,d){Ext.EventManager.un(Ext.getDoc(),"keydown",this.onDragKeyDown,this);Ext.EventManager.un(Ext.getDoc(),"keyup",this.onDragKeyUp,this);delete this.initDate;delete this.initDateRange;this.proxy.setVisible(!1);b.proxy.show()},onDragKeyDown:function(a){(a.ctrlKey||
a.keyCode===Ext.EventObject.CONTROL)&&this.dd.proxy.dropStatus===this.dz.dropAllowed&&this.dd.proxy.setStatus(this.dz.dropAllowedAdd)},onDragKeyUp:function(a){(a.ctrlKey||a.keyCode===Ext.EventObject.CONTROL)&&this.dd.proxy.dropStatus===this.dz.dropAllowedAdd&&this.dd.proxy.setStatus(this.dz.dropAllowed)},onNodeDrop:function(a,b,c,d){a=Zarafa.calendar.data.DragStates;switch(d.state){case a.SELECTING:this.calendar.onSelect(c,this.dateRange);break;case a.DRAGGING:if(b.calendar!==this.calendar)this.calendar.onDrop(c,
b.calendar,d.target,this.dateRange);else if(b=d.selections[0],b.get("access")&Zarafa.core.mapi.Access.ACCESS_MODIFY)this.calendar.onMove(c,d.target,this.dateRange);else return c=b.isMeeting()?_("a meeting request"):_("an appointment"),Ext.MessageBox.show({title:_("Insufficient privileges"),msg:_("You have insufficient privileges to move "+c+" in this calendar. The calendar owner can grant you these rights from: settings > delegates."),icon:"zarafa-calendar-delegate-permission",buttons:Ext.MessageBox.OK}),
!1;break;case a.RESIZING_START:case a.RESIZING_DUE:this.calendar.onResize(c,d.target,this.dateRange)}},updateProxy:function(a,b){var c=Ext.isEmpty(b)?void 0:b[0],d=this.calendar.screenLocationToDate(a[0],a[1]),e=this.calendar.getZoomLevel(),f=Zarafa.calendar.data.DragStates,g=this.state===f.SELECTING||this.state===f.DRAGGING||this.state===f.RESIZING_START,h=this.state===f.SELECTING||this.state===f.DRAGGING||this.state===f.RESIZING_DUE,k=this.dateRange.getStartDate(),l=this.dateRange.getDueDate(),
m=this.dateRange.getDuration(Date.MINUTE),n;n=this.state===f.DRAGGING?this.draggingSnapMode:this.selectingSnapMode;Ext.isDate(d)&&(n===Zarafa.calendar.data.SnapModes.DAY?g?(k=d.clearTime(),h&&(l=c?c.get("alldayevent")?k.add(Date.MINUTE,c.get("duration")):k.add(Date.DAY,1):k.add(Date.DAY,1))):(l=d.add(Date.DAY,1),l===k&&(l=l.add(Date.DAY,1))):n===Zarafa.calendar.data.SnapModes.ZOOMLEVEL?g?(k=d.floor(Date.MINUTE,e),h&&(l=c?c.get("alldayevent")?k.add(Date.MINUTE,e):k.add(Date.MINUTE,c.get("duration")):
k.add(Date.MINUTE,e))):(l=d.ceil(Date.MINUTE,e),l===k&&(l=l.add(Date.MINUTE,e))):(c=60*k.getHours()+k.getMinutes(),k=60*d.getHours()+d.getMinutes(),c=Math.max(0,c-k),k=d.clone(),k=k.add(Date.MINUTE,c),k=k.add(Date.MILLI,Date.getDSTDiff(k,d)),l=k.add(Date.MINUTE,m)));switch(this.state){case f.SELECTING:if(k>this.initDate)this.dateRange.set(this.initDateRange.getStartDate(),l),this.state=f.RESIZING_DUE;else if(l<this.initDate||n===Zarafa.calendar.data.SnapModes.DAY)this.state=f.RESIZING_START,this.dateRange.set(k,
this.initDateRange.getDueDate());break;case f.DRAGGING:this.dateRange.set(k,l);break;case f.RESIZING_START:k>=l?(this.state=f.RESIZING_DUE,this.dateRange.set(this.initDateRange.getStartDate(),k)):this.dateRange.setStartDate(k);break;case f.RESIZING_DUE:k>=l?(this.state=f.RESIZING_START,this.dateRange.set(l,this.initDateRange.getDueDate())):this.dateRange.setDueDate(l)}}});Ext.namespace("Zarafa.contact");
Zarafa.contact.ContactContextModel=Ext.extend(Zarafa.core.ContextModel,{current_character:"a",oldDataMode:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.contact.ContactStore);Ext.applyIf(a,{current_data_mode:Zarafa.contact.data.DataModes.ALL});this.addEvents("characterchange");Zarafa.contact.ContactContextModel.superclass.constructor.call(this,a);this.on({searchstart:this.onSearchStart,searchstop:this.onSearchStop,scope:this})},enable:function(a,b){Zarafa.contact.ContactContextModel.superclass.enable.call(this,
a,!0);this.setRestrictionCharacter(this.getRestrictionCharacter(),!0);!0!==b&&this.resumeLoading()},createRecord:function(a,b){a=a||this.getDefaultFolder();return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass(b?"IPM.Distlist":"IPM.Contact",{store_entryid:a.get("store_entryid"),parent_entryid:a.get("entryid"),icon_index:b?Zarafa.core.mapi.IconIndex.contact_distlist:Zarafa.core.mapi.IconIndex.contact_user})},onDataModeChange:function(a,b,c){Zarafa.contact.ContactContextModel.superclass.onDataModeChange.call(this,
a,b,c);b!==c&&c===Zarafa.contact.data.DataModes.SEARCH&&this.stopSearch();switch(b){case Zarafa.contact.data.DataModes.CHARACTER_RESTRICT:this.load({params:{restriction:{search:this.createCharacterRestriction()}}});break;case Zarafa.contact.data.DataModes.ALL:this.load({params:{restriction:{}}})}},setRestrictionCharacter:function(a,b){if(!0===b||this.current_character!==a){var c=this.current_character;this.current_character=a;this.onCharacterChange(this,this.current_character,c);this.fireEvent("characterchange",
this,this.current_character,c)}},getRestrictionCharacter:function(){return this.current_character},onCharacterChange:function(a,b,c){this.current_data_mode===Zarafa.contact.data.DataModes.CHARACTER_RESTRICT&&(a={start:0},b&&(a.restriction={search:this.createCharacterRestriction(b)}),this.load({params:a}))},createCharacterRestriction:function(a){var b=Zarafa.core.data.RestrictionFactory,c=Zarafa.core.mapi.Restrictions;Ext.isEmpty(a)&&(a=this.current_character||"...");switch(a){case "...":a={};break;
case "123":a=b.createResAnd([b.dataResProperty("0x80B5001E",c.RELOP_GE,"0"),b.dataResProperty("0x80B5001E",c.RELOP_LE,"9")]);break;case "z":a=b.dataResProperty("0x80B5001E",c.RELOP_GE,"z");break;default:var d=String.fromCharCode(a.charCodeAt(0)+1);a=b.createResAnd([b.dataResProperty("0x80B5001E",c.RELOP_GE,a),b.dataResProperty("0x80B5001E",c.RELOP_LE,d)])}return a},saveCharacterChangeState:function(a,b,c){b!=c&&this.saveState()},initStateEvents:function(){Zarafa.contact.ContactContextModel.superclass.initStateEvents.call(this);
this.on("characterchange",this.saveCharacterChangeState,this,{delay:100})},getState:function(){var a=Zarafa.contact.ContactContextModel.superclass.getState.call(this)||{};return Ext.apply(a,{current_character:this.current_character})},onSearchStart:function(a){this.getCurrentDataMode()!=Zarafa.contact.data.DataModes.SEARCH&&(this.oldDataMode=this.getCurrentDataMode(),this.setDataMode(Zarafa.contact.data.DataModes.SEARCH))},onSearchStop:function(a){this.getCurrentDataMode()===Zarafa.contact.data.DataModes.SEARCH&&
this.setDataMode(this.oldDataMode);delete this.oldDataMode},setFolders:function(a){this.suspendLoading(!0);Zarafa.contact.ContactContextModel.superclass.setFolders.call(this,a);this.setRestrictionCharacter(this.getRestrictionCharacter(),!0);this.resumeLoading()}});Ext.namespace("Zarafa.contact");
Zarafa.contact.DistlistMemberFields=[{name:"entryid"},{name:"display_name"},{name:"address_type",type:"string",defaultValue:"SMTP"},{name:"distlist_type",type:"int",defaultValue:Zarafa.core.mapi.DistlistType.DL_EXTERNAL_MEMBER},{name:"email_address"},{name:"smtp_address"}];
Zarafa.contact.DistlistMemberRecord=Ext.extend(Ext.data.Record,{idProperties:["entryid"],copy:function(a){a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,this.data,a||this.id);a.idProperties=this.idProperties.clone();a.phantom=this.phantom;return a.applyData(this)},applyData:function(a){this.beginEdit();Ext.apply(this.data,a.data);Ext.apply(this.modified,a.modified);this.dirty=a.dirty;this.endEdit();return this},equals:function(a){return Zarafa.core.EntryId.compareEntryIds(this.get("entryid"),
a.get("entryid"))},convertToAddressBookRecord:function(){var a=this.get("entryid"),b=this.get("distlist_type"),c=Zarafa.core.mapi.ObjectType.MAPI_MAILUSER;b==Zarafa.core.mapi.DistlistType.DL_DIST_AB&&(c=Zarafa.core.mapi.ObjectType.MAPI_DISTLIST);return Zarafa.core.data.RecordFactory.createRecordObjectByObjectType(c,{entryid:a,object_type:c},a)},convertToContactRecord:function(){var a=this.get("entryid"),b="IPM.Contact";this.get("distlist_type")===Zarafa.core.mapi.DistlistType.DL_DIST&&(b="IPM.DistList");
Zarafa.core.EntryId.hasContactProviderGUID(a)&&(a=Zarafa.core.EntryId.unwrapContactProviderEntryId(a));return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass(b,{entryid:a,message_class:b,object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE},a)},isAmbiguous:function(){return!1},attemptedToResolve:function(){return!0},isResolved:function(){return!0}});Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_DISTLIST_MEMBER");
Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,Zarafa.contact.DistlistMemberFields);Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,Zarafa.contact.DistlistMemberRecord);Ext.namespace("Zarafa.contact.data");
Zarafa.contact.data.JsonMemberReader=Ext.extend(Zarafa.core.data.JsonReader,{customObjectType:Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,constructor:function(a,b){a=Ext.applyIf(a||{},{dynamicRecord:!1});Ext.isDefined(b)||(b=Zarafa.core.data.RecordFactory.getRecordClassByCustomType(a.customObjectType||this.customObjectType));Zarafa.contact.data.JsonMemberReader.superclass.constructor.call(this,a,b)}});Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactAddressContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{parser:null,property:null,parsedData:null,constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:"fit",border:!1,xtype:"zarafa.contactaddresscontentpanel",title:_("Check address"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),autoSave:!1,width:400,height:300,items:[{xtype:"zarafa.contactaddresspanel",ref:"mainPanel",parser:a.parser,parsedData:a.parsedData,property:a.property,
buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),scope:this,handler:this.onCancel}]}]});Zarafa.contact.dialogs.ContactAddressContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.contactaddresscontentpanel",Zarafa.contact.dialogs.ContactAddressContentPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{contactParser:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactcontentpanel",layout:"fit",title:_("Contact"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),closeOnSave:!0,confirmClose:!0,items:this.createPanel()});Zarafa.contact.dialogs.ContactContentPanel.superclass.constructor.call(this,a);this.initContactDetailsParser()},createPanel:function(){return[{xtype:"zarafa.contactpanel",
tbar:{xtype:"zarafa.contacttoolbar"}}]},initContactDetailsParser:function(){var a=container.getSharedComponent(Zarafa.core.data.SharedComponentType["contact.detailsparser"]);a&&(this.contactParser=new a)},update:function(a,b){b&&this.updateIconFromRecord(a);this.updateTitleFromRecord(a)},updateIconFromRecord:function(a){a=Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){a=a.get("display_name");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)}});
Ext.reg("zarafa.contactcontentpanel",Zarafa.contact.dialogs.ContactContentPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactNameContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{parser:null,parsedData:null,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactnamecontentpanel",layout:"fit",border:!1,title:_("Check full name"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),autoSave:!1,width:400,height:250,items:[{xtype:"zarafa.contactnamepanel",ref:"mainPanel",parser:a.parser,parsedData:a.parsedData,buttons:[{text:_("Ok"),handler:this.onOk,
scope:this},{text:_("Cancel"),scope:this,handler:this.onCancel}]}]});Zarafa.contact.dialogs.ContactNameContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.contactnamecontentpanel",Zarafa.contact.dialogs.ContactNameContentPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactPanel=Ext.extend(Ext.Panel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactpanel",cls:"zarafa-contactcreatepanel",border:!1,layout:"fit",items:this.createTabPanel()});Zarafa.contact.dialogs.ContactPanel.superclass.constructor.call(this,a)},createTabPanel:function(){return[{xtype:"tabpanel",activeTab:0,border:!1,defaults:{layout:"column",autoHeight:!1},items:[{xtype:"zarafa.contactgeneraltab"},{xtype:"zarafa.contactdetailtab"},container.populateInsertionPoint("context.contact.contactcontentpanel.tabs",
this)]}]}});Ext.reg("zarafa.contactpanel",Zarafa.contact.dialogs.ContactPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactPhoneContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{parser:null,property:null,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.contactphonecontentpanel",layout:"fit",border:!1,title:_("Check phone number"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),autoSave:!1,width:400,height:250,items:[{xtype:"zarafa.contactphonepanel",ref:"mainPanel",parser:a.parser,parsedData:a.parsedData,property:a.property,
buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),scope:this,handler:this.onCancel}]}]});Zarafa.contact.dialogs.ContactPhoneContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.contactphonecontentpanel",Zarafa.contact.dialogs.ContactPhoneContentPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.ContactToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{insertionPointBase:"context.contact.contactcontentpanel",actionItems:this.createActionButtons(),optionItems:this.createOptionButtons()});Zarafa.contact.dialogs.ContactToolbar.superclass.constructor.call(this,a)},createActionButtons:function(){return[{xtype:"button",ref:"saveCloseBtn",
text:_("Save"),overflowText:_("Save & Close"),tooltip:{title:_("Save & Close"),text:_("Save contact and close dialog")+" (Ctrl + S)"},cls:"zarafa-action",iconCls:"buttons-icon_save_white",handler:this.onSave,scope:this},{xtype:"button",ref:"deleteBtn",overflowText:_("Delete"),tooltip:{title:_("Delete contact"),text:_("Delete this contact.")},iconCls:"icon_delete",handler:this.onDelete,scope:this},{xtype:"zarafa.attachmentbutton",ref:"addAttachment",plugins:["zarafa.recordcomponentupdaterplugin"],
overflowText:_("Add Attachment"),tooltip:{title:_("Add Attachment"),text:_("Add attachments to this contact.")},iconCls:"icon_attachment",listeners:{added:this.onAttachmentButtonAdded,scope:this}},{xtype:"button",overflowText:_("Print"),tooltip:{title:_("Print"),text:_("Print this contact")},iconCls:"icon_print",handler:this.onPrint,scope:this}]},onAttachmentButtonAdded:function(a){a.isXType("menuitem")&&(a.update=Zarafa.common.attachment.ui.AttachmentButton.prototype.update.createDelegate(this.addAttachment))},
createOptionButtons:function(){return[{xtype:"button",overflowText:_("Categories"),tooltip:{title:_("Categories"),text:_("Open the categories dialog.")},iconCls:"icon_categories",handler:this.onCategories,scope:this},{xtype:"button",overflowText:_("Private"),tooltip:{title:_("Private"),text:_("Mark this contact as private.")},iconCls:"icon_private",ref:"setPrivate",enableToggle:!0,toggleHandler:this.onPrivateGroupToggle,scope:this}]},onSave:function(){this.dialog.saveRecord()},onDelete:function(){this.dialog.deleteRecord()},
onPrint:function(){Zarafa.common.Actions.openPrintDialog(this.record)},onCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.record,{autoSave:!1})},onPrivateGroupToggle:function(a){this.record.set("private",a.pressed);!0===a.pressed?this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.PRIVATE):this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.NONE)},update:function(a,b){this.record=a;a.isSubMessage()?(this.deleteBtn.setVisible(!1),this.setPrivate.setVisible(!1),this.saveCloseBtn.setVisible(!1),
this.addAttachment.setVisible(!1)):(this.deleteBtn.setVisible(!0),this.setPrivate.setVisible(!0),this.saveCloseBtn.setVisible(!0),this.addAttachment.setVisible(!0),this.deleteBtn.setDisabled(!0===a.phantom),(!0===b||a.isModifiedSinceLastUpdate("private"))&&this.setPrivate.toggle(a.get("private"),!0));this.doLayout()}});Ext.reg("zarafa.contacttoolbar",Zarafa.contact.dialogs.ContactToolbar);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{layout:"fit",xtype:"zarafa.distlistcontentpanel",title:_("Distribution List"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),confirmClose:!0,closeOnSave:!0,items:[this.createPanel()]});Zarafa.contact.dialogs.DistlistContentPanel.superclass.constructor.call(this,a)},createPanel:function(){return{xtype:"zarafa.distlistpanel",
tbar:{xtype:"zarafa.distlistcontentpaneltoolbar"}}},update:function(a,b){b&&this.updateIconFromRecord(a);this.updateTitleFromRecord(a)},updateIconFromRecord:function(a){a=Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){a=a.get("display_name");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)}});Ext.reg("zarafa.distlistcontentpanel",Zarafa.contact.dialogs.DistlistContentPanel);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistContentPanelToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{insertionPointBase:"context.contact.distlistcontentpanel",actionItems:this.createActionButtons(),optionItems:this.createOptionButtons()});Zarafa.contact.dialogs.DistlistContentPanelToolbar.superclass.constructor.call(this,a)},createActionButtons:function(){return[{xtype:"button",
text:_("Save"),overflowText:_("Save & Close"),tooltip:{title:_("Save & Close"),text:_("Save distribution list and close dialog")+" (Ctrl + S)"},cls:"zarafa-action",iconCls:"buttons-icon_save_white",handler:this.onSave,scope:this,ref:"saveCloseBtn"},{xtype:"button",ref:"deleteBtn",overflowText:_("Delete Distributionlist"),tooltip:{title:_("Delete"),text:_("Delete the Distribution list.")},iconCls:"icon_delete",handler:this.onDelete,scope:this},{xtype:"button",overflowText:_("Print"),tooltip:{title:_("Print distribution list"),
text:_("Print this distribution list.")},iconCls:"icon_print",handler:this.onPrint,scope:this}]},createOptionButtons:function(){return[{xtype:"button",overflowText:_("Categories"),tooltip:{title:_("Categories"),text:_("Open the categories dialog.")},iconCls:"icon_categories",handler:this.onCategories,scope:this},{xtype:"button",overflowText:_("Private"),tooltip:{title:_("Private"),text:_("Mark this Distribution list as private.")},iconCls:"icon_private",ref:"setPrivate",toggleGroup:"privateGroup",
handler:this.onPrivateGroupToggle,scope:this}]},onSave:function(){this.dialog.saveRecord()},onDelete:function(){this.dialog.deleteRecord()},onPrint:function(){Zarafa.common.Actions.openPrintDialog(this.record)},onCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.record,{autoSave:!1})},onPrivateGroupToggle:function(a){this.record.set("private",a.pressed);a.pressed?this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.PRIVATE):this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.NONE)},
update:function(a,b){this.record=a;a.isSubMessage()?(this.deleteBtn.setVisible(!1),this.setPrivate.setVisible(!1),this.saveCloseBtn.setVisible(!1)):(this.deleteBtn.setVisible(!0),this.setPrivate.setVisible(!0),this.saveCloseBtn.setVisible(!0),this.deleteBtn.setDisabled(!0===a.phantom),(!0===b||a.isModified("private"))&&this.setPrivate.toggle(a.get("private"),!0))}});Ext.reg("zarafa.distlistcontentpaneltoolbar",Zarafa.contact.dialogs.DistlistContentPanelToolbar);Ext.namespace("Zarafa.contact.dialogs");
Zarafa.contact.dialogs.DistlistMembersTab=Ext.extend(Ext.form.FormPanel,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.distlistmemberstab",cls:"zarafa-distlist-createpanel-memberstab",title:_("Members"),layout:"vbox",layoutConfig:{align:"stretch",pack:"start"},defaults:{header:!1,margins:{top:0,right:0,bottom:6,left:0},border:!1},items:this.getMembersTabItems()});Zarafa.contact.dialogs.DistlistMembersTab.superclass.constructor.call(this,
a)},getMembersTabItems:function(){return[{layout:"form",items:[{xtype:"textfield",name:"subject",labelStyle:"text-align: left",fieldLabel:_("Name"),anchor:"100%",listeners:{change:this.onPropertyChange,scope:this}}]},{layout:"table",cls:"buttons",layoutConfig:{columns:5},items:[{xtype:"button",autoWidth:!0,text:_("Select Members")+"...",handler:this.showAddressBookContent,scope:this},{xtype:"spacer",width:6},{xtype:"button",autoWidth:!0,handler:this.addExternalMember,scope:this,text:_("Add New")+
"..."},{xtype:"spacer",width:6},{xtype:"button",autoWidth:!0,text:_("Remove"),handler:this.removeMembers,scope:this}]},{xtype:"grid",flex:1,viewConfig:{autoFill:!0},store:new Ext.data.Store({autoDestroy:!0}),listeners:{rowdblclick:this.onRowDblClick},ref:"membersGrid",autoExpandColumn:"display_name",colModel:new Zarafa.contact.dialogs.DistlistMemberGridColumnModel}]},update:function(a,b){Ext.isEmpty(a)||(this.record=a,this.getForm().loadRecord(a),b&&a.isOpened()&&(a.getMemberStore().sort("fileas",
"asc"),this.membersGrid.reconfigure(a.getMemberStore(),this.membersGrid.colModel)))},updateRecord:function(a){a.beginEdit();this.getForm().updateRecord(a);a.set("fileas",a.get("subject"));a.set("display_name",a.get("subject"));a.endEdit()},showAddressBookContent:function(){Zarafa.contact.Actions.openMembersSelectionContent(this.record)},addExternalMember:function(){Zarafa.contact.Actions.openDistlistExternalMemberContent(void 0,{parentRecord:this.record})},removeMembers:function(){var a=this.record.getMemberStore(),
b=this.membersGrid.getSelectionModel().getSelections();a.remove(b)},onPropertyChange:function(a,b,c){this.record.set(a.getName(),b)},onRowDblClick:function(a,b,c){a=this.getStore().getAt(b);Zarafa.contact.Actions.openDistlistMember(a,this.record)}});Ext.reg("zarafa.distlistmemberstab",Zarafa.contact.dialogs.DistlistMembersTab);Ext.namespace("Zarafa.contact.printer");
Zarafa.contact.printer.ContactRenderer=Ext.extend(Zarafa.common.printer.renderers.RecordRenderer,{generateBodyTemplate:function(a){var b;b="<b>{fullname:htmlEncode}</b>\n<hr>\n<table>\n"+this.optionalRow(_("Full Name"),"display_name","{display_name:htmlEncode}");b+=this.optionalRow(_("Last Name"),"surname","{surname:htmlEncode}");b+=this.optionalRow(_("First Name"),"given_name","{given_name:htmlEncode}");b+=this.optionalRow(_("Job Title"),"title","{title:htmlEncode}");b+=this.optionalRow(_("Department"),
"department_name","{department_name:htmlEncode}");b+=this.optionalRow(_("Company"),"company_name","{company_name:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Business Address"),"business_address","{business_address_street:htmlEncode}<br>{business_address_city:htmlEncode} {business_address_state:htmlEncode} {business_address_postal_code:htmlEncode}<br>{business_address_country:htmlEncode}");b+=this.optionalRow(_("IM Address"),"im","{im:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Home Address"),
"home_address","{home_address_street:htmlEncode}<br>{home_address_city:htmlEncode} {home_address_state:htmlEncode} {home_address_postal_code:htmlEncode}<br>{home_address_country:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Business"),"business_telephone_number","{business_telephone_number:htmlEncode}");b+=this.optionalRow(_("Home"),"home_telephone_number","{home_telephone_number:htmlEncode}");b+=this.optionalRow(_("Mobile"),"cellular_telephone_number","{cellular_telephone_number:htmlEncode}");
b+=this.optionalRow(_("Business Fax"),"business_fax_number","{business_fax_number:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("E-mail"),"email_address_1","{email_address_1:htmlEncode}");b+=this.optionalRow(_("E-mail Display As"),"email_address_display_name_1","{email_address_display_name_1:htmlEncode}");b+=this.optionalRow(_("E-mail 2"),"email_address_2","{email_address_2:htmlEncode}");b+=this.optionalRow(_("E-mail 2 Display As"),"email_address_display_name_2","{email_address_display_name_2:htmlEncode}");
b+=this.optionalRow(_("E-mail 3"),"email_address_3","{email_address_3:htmlEncode}");b+=this.optionalRow(_("E-mail 3 Display As"),"email_address_display_name_3","{email_address_display_name_3:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Birthday"),"birthday",'{birthday:date("'+_("jS F Y")+'")}');b+=this.optionalRow(_("Anniversary"),"wedding_anniversary",'{wedding_anniversary:date("'+_("jS F Y")+'")}');b+=this.optionalRow(_("Spouse/Partner"),"spouse_name","{spouse_name:htmlEncode}");b+=
this.optionalRow(_("Profession"),"profession","{profession:htmlEncode}");b+=this.optionalRow(_("Assistent"),"assistent","{assistent:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Categories"),"categories","{categories:htmlEncode}");b+=this.optionalRow(_("Attachments"),"attachment_names","{attachment_names:htmlEncode}");b=b+"</table><br><p>\n"+a.getBody(!0);return b+"</p>\n"}});Ext.namespace("Zarafa.contact.printer");
Zarafa.contact.printer.DistlistRenderer=Ext.extend(Zarafa.common.printer.renderers.RecordRenderer,{generateBodyTemplate:function(a){var b;b="<b>{fullname:htmlEncode}</b>\n<hr>\n<table>\n"+this.optionalRow(_("Full Name"),"display_name","{display_name:htmlEncode}");b=b+"</table><br><p>\n"+(_("Members")+"\n");b=b+'<table>\n<tpl for="members">\n'+this.addRow("","{display_name:htmlEncodeUndef}");b=b+"</tpl>\n</table><br><p>\n"+a.getBody(!0);return b+"</p>\n"},prepareData:function(a){var b=Zarafa.contact.printer.DistlistRenderer.superclass.prepareData.apply(this,
arguments);b.members=Ext.pluck(a.getMemberStore().getRange(),"data");for(var c=0;c<b.members.length;c++){b.members[c]=Ext.apply({},b.members[c]);var d=b.members[c],e;for(e in d)Ext.isString(d[e])&&(d[e]=Ext.util.Format.htmlEncode(d[e]))}return b}});Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactCardPanel=Ext.extend(Ext.Panel,{context:void 0,model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());Ext.applyIf(a,{xtype:"zarafa.contactcardpanel",border:!1,layout:"border",layoutConfig:{targetCls:""},items:[{xtype:"container",autoScroll:!0,region:"center",items:[{xtype:"zarafa.contactcardview",context:a.context}]},{region:"east",xtype:"zarafa.characterstrip",ref:"characterStrip",selectedChar:a.model.getRestrictionCharacter(),
listeners:{selectionchanged:this.onSelectionChanged,selectioncleared:this.onSelectionCleared,scope:this}}]});Zarafa.contact.ui.ContactCardPanel.superclass.constructor.call(this,a)},onSelectionChanged:function(a,b){this.model.setRestrictionCharacter(b)},onSelectionCleared:function(a){this.model.setRestrictionCharacter("")}});Ext.reg("zarafa.contactcardpanel",Zarafa.contact.ui.ContactCardPanel);Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.ContactGrid=Ext.extend(Zarafa.common.ui.grid.MapiMessageGrid,{context:void 0,model:void 0,store:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);Ext.applyIf(a,{xtype:"zarafa.contactgrid",border:!1,stateful:!0,statefulRelativeDimensions:!1,autoExpandColumn:"fileas",loadMask:this.initLoadMask(),viewConfig:this.initViewConfig(),
selModel:this.initSelectionModel(),colModel:this.initColumnModel(),enableDragDrop:!0,ddGroup:"dd.mapiitem"});Zarafa.contact.ui.ContactGrid.superclass.constructor.call(this,a)},initViewConfig:function(){return{}},initLoadMask:function(){return{msg:_("Loading contacts")+"..."}},initColumnModel:function(){return new Zarafa.contact.ui.ContactGridColumnModel},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!1,listeners:{scope:this,selectionchange:this.onSelectionChange}})},
getMainPanel:function(){return this.ownerCt},initEvents:function(){Zarafa.contact.ui.ContactGrid.superclass.initEvents.apply(this,arguments);this.on("rowdblclick",this.onRowDblClick,this)},onRowDblClick:function(a,b,c){Zarafa.contact.Actions.openDialog(a.getSelectionModel().getSelections())},onSelectionChange:function(a){this.model.setSelectedRecords(a.getSelections())}});Ext.reg("zarafa.contactgrid",Zarafa.contact.ui.ContactGrid);Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.MemberBox=Ext.extend(Zarafa.common.recipientfield.ui.RecipientBox,{isValidRecord:function(a){a=a.get("distlist_type");return Ext.isDefined(Zarafa.core.mapi.DistlistType.getName(a))?!0:!1},prepareData:function(a){var b=Zarafa.contact.ui.MemberBox.superclass.prepareData.apply(this,arguments);b.distlist_type=a.get("distlist_type");return b},prepareIcon:function(a){if(this.isValidRecord(a))return Zarafa.common.ui.IconClass.getIconClass(a)}});Ext.reg("zarafa.memberbox",Zarafa.contact.ui.MemberBox);
Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.HierarchyNotificationResponseHandler=Ext.extend(Zarafa.core.data.AbstractNotificationResponseHandler,{doFolders:function(a){var b;a=a.item;if(!Ext.isEmpty(a)){Array.isArray(a)||(a=[a]);try{b=this.reader.readResponse(Ext.data.Api.actions.read,{item:a})}catch(h){return!1}for(var c=0,d=b.data.length;c<d;c++){var e=a[c],f=b.data[c],g=this.store.getById(f.entryid);g?e.folderdelete?this.addNotification(Zarafa.core.data.Notifications.objectDeleted,g,f):this.addNotification(Zarafa.core.data.Notifications.objectModified,
g,f):e.folderdelete||this.addNotification(Zarafa.core.data.Notifications.objectCreated,null,f)}}},doNewmail:function(a){var b=Ext.pluck(a.item,"entryid"),b=Zarafa.core.data.IPMStoreMgr.getStoresForFolders(b);this.addNotification(Zarafa.core.data.Notifications.newMail,b,a)},doStores:function(a){a=a.item;for(var b=Ext.pluck(a,"store_entryid"),c=[],d=0,e=b.length;d<e;d++){var f=this.store.getById(b[d]);Ext.isDefined(f)&&c.push(f)}this.addNotification(Zarafa.core.data.Notifications.objectModified,c,a)}});
Ext.namespace("Zarafa.hierarchy.data");Zarafa.hierarchy.data.HierarchyResponseHandler=Ext.extend(Zarafa.core.data.ProxyResponseHandler,{doList:function(a){this.receivedRecords=this.readRecordsFromResponse(a,"item")},doFolders:function(a){this.receivedRecords=this.receivedRecords.concat(this.correlateRecordFromResponse({item:a}))},doItem:function(a){this.receivedRecords=this.receivedRecords.concat(this.correlateRecordFromResponse({item:a}))},doUpdate:function(a){this.receivedRecords=this.receivedRecords.concat(this.correlateRecordFromResponse({item:a}))}});
Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.HierarchyStore=Ext.extend(Zarafa.core.data.IPFStore,{stateful:!0,state:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{standalone:!0,proxy:new Zarafa.hierarchy.data.HierarchyProxy,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.core.data.JsonReader({id:"store_entryid",idProperty:"store_entryid"})});this.addEvents("addFolder","removeFolder","updateFolder");Zarafa.hierarchy.data.HierarchyStore.superclass.constructor.call(this,a);!1!==this.stateful&&this.initState();
this.on({beforesave:this.onBeforeSave,load:this.onAfterLoad,add:this.onAdd,remove:this.onRemove,scope:this})},idComparison:function(a,b){return Zarafa.core.EntryId.compareStoreEntryIds(a,b)},load:function(a){Ext.isObject(a)||(a={});Ext.isObject(a.params)||(a.params={});Ext.isDefined(a.cancelPreviousRequest)||(a.cancelPreviousRequest=!0);Ext.applyIf(a,{actionType:Zarafa.core.Actions.list});return Zarafa.hierarchy.data.HierarchyStore.superclass.load.call(this,a)},remove:function(a){if(Array.isArray(a))Ext.each(a,
this.remove,this);else if(a.isSharedStore()){var b=a.getFavoritesStore(),c=b.query("store_entryid",a.get("store_entryid"));b.remove(c.getRange());Zarafa.hierarchy.data.HierarchyStore.superclass.remove.call(this,a)}},open:function(a,b,c){a=a.toLowerCase();var d=container.getSettingsModel().get("zarafa/v1/contexts/hierarchy/shared_stores/"+a,!0);if(d&&(d[b]||d.all))return!1;a=Ext.applyIf({params:{user_name:a,folder_type:b,show_subfolders:c},add:!0,actionType:"opensharedfolder",cancelPreviousRequest:!1},
this.lastOptions);try{return this.execute("read",null,a)}catch(e){return this.handleException(e),!1}},loadRecords:function(a,b,c){if(!this.isDestroyed){if(a&&!0===c&&b&&"opensharedfolder"===b.actionType)for(var d=a.records,e=0,f=d.length;e<f;e++){var g=d[e],h=this.getById(g.get("store_entryid"));if(h)if("all"===b.params.folder_type)this.remove(h),this.save(h);else{g.createSubStores();var h=h.getSubStore("folders"),k=g.getSubStore("folders");h.each(function(a){k.getById(k.data.getKey(a))||k.add(a.copy())},
this)}}Zarafa.hierarchy.data.HierarchyStore.superclass.loadRecords.call(this,a,b,c)}},hookStoreRecord:function(a){for(var b=0,c=a.length;b<c;b++){a[b].getSubStore("folders").on({add:this.onFolderAdd,remove:this.onFolderRemove,update:this.onFolderUpdate,scope:this});var d=a[b].getSubStore("favorites");if(Ext.isDefined(d))d.on({add:this.onFolderAdd,remove:this.onFolderRemove,update:this.onFolderUpdate,scope:this})}},unhookStoreRecord:function(a){var b=a.getSubStore("folders");b.un("add",this.onFolderAdd,
this);b.un("remove",this.onFolderRemove,this);b.un("update",this.onFolderUpdate,this);a=a.getSubStore("favorites");Ext.isDefined(a)&&(a.un("add",this.onFolderAdd,this),a.un("remove",this.onFolderRemove,this),a.un("update",this.onFolderUpdate,this))},onAfterLoad:function(a,b,c){if("opensharedfolder"===c.actionType){var d=container.getSettingsModel(),e=c.params.user_name.toLowerCase();a=c.params.folder_type||"all";c=c.params.show_subfolders||!1;var e="zarafa/v1/contexts/hierarchy/shared_stores/"+e,
f=d.get(e,!0);if(f&&(f[a]||f.all))return;d.set(e+"/"+a,{folder_type:a,show_subfolders:c});if("all"===a)switch(a=container.getCurrentContext().getName(),a){case "calendar":case "contacts":case "tasks":case "notes":break;default:a="inbox"}d=this.getFolder(b[0].get("default_folder_"+a));Ext.isDefined(d)&&"calendar"!==a&&Zarafa.hierarchy.Actions.openFolder(d)}this.hookStoreRecord(b)},save:function(){if(this.removed.length){var a={close:this.removed};if(!1!==this.fireEvent("beforesave",this,a)){try{var b=
++this.batchCounter;this.execute("destroy",a.close,{actionType:"closesharedfolder"},b)}catch(c){this.handleException(c)}this.removed=[]}}Zarafa.hierarchy.data.HierarchyStore.superclass.save.apply(this,arguments)},onBeforeSave:function(a,b){if(!Ext.isEmpty(b.close)){var c=container.getSettingsModel(),d=b.close;c.beginEdit();for(var e=0,f=d.length;e<f;e++){var g=d[e],h=g.get("user_name").toString().toLowerCase();c.remove("zarafa/v1/contexts/hierarchy/shared_stores/"+h);g.addIdProp("user_name")}c.endEdit()}},
onAdd:function(a,b,c){this.hookStoreRecord(b)},onRemove:function(a,b,c){this.unhookStoreRecord(b)},onFolderAdd:function(a,b,c){this.fireEvent("addFolder",this,a.getParentRecord(),b,c)},onFolderRemove:function(a,b,c){if(b.isSharedFolder()&&!b.isFavoritesFolder()){var d=!0;a.each(function(a){if(a.isSharedFolder())return d=!1},this);if(d){a.rejectChanges();a=a.getParentRecord();this.remove(a);this.save(a);return}}this.fireEvent("removeFolder",this,a.getParentRecord(),b,c)},onFolderUpdate:function(a,
b,c){this.fireEvent("updateFolder",this,a.getParentRecord(),b,c)},getStores:function(){return this.getRange()},getDefaultStore:function(){var a=this.findExact("mdb_provider",Zarafa.core.mapi.MDBProvider.ZARAFA_SERVICE_GUID);if(-1!==a)return this.getAt(a)},getPublicStore:function(){var a=this.findExact("mdb_provider",Zarafa.core.mapi.MDBProvider.ZARAFA_STORE_PUBLIC_GUID);if(-1!==a)return this.getAt(a)},getDefaultFolder:function(a,b){return b||(b=this.getDefaultStore(),b)?b.getDefaultFolder(a):void 0},
getStoreByOwnerEntryId:function(a){for(var b=0;b<this.getCount();b++){var c=this.getAt(b);if(Zarafa.core.EntryId.compareABEntryIds(c.get("mailbox_owner_entryid"),a))return c}},getFolder:function(a){for(var b=0,c=this.getCount();b<c;b++){var d=this.getAt(b).getFolderStore();if(d&&(d=d.getById(a)))return d}},getDefaultFolderFromMessageClass:function(a){a=Zarafa.core.MessageClass.getDefaultFolderTypeFromMessageClass(a);if(!Ext.isEmpty(a))return this.getDefaultStore().getDefaultFolder(a)},getDefaultFolderFromContainerClass:function(a){a=
Zarafa.core.ContainerClass.getDefaultFolderTypeFromContainerClass(a);if(!Ext.isEmpty(a))return this.getDefaultStore().getDefaultFolder(a)},collectFolders:function(a,b,c,d){Ext.isFunction(b)&&!b.call(c||this,d)||a.push(d);Ext.each(d.getChildren(),function(d){this.collectFolders(a,b,c,d)},this)},getSortedFolders:function(a,b){for(var c=[],d=this.getStores(),e=0;e<d.length;e++)this.collectFolders(c,a,b,d[e].getSubtreeFolder());return c},containsStoreInLastLoad:function(a){return!1},onNotifyNewmail:function(a,
b,c,d,e){Array.isArray(b)||(b=[b]);a=0;for(e=b.length;a<e;a++)if(!d||b[a].lastExecutionTime(Zarafa.core.Actions.list)<d)b[a].lastOptions.actionType===Zarafa.core.Actions.updatelist?(delete b[a].lastOptions.add,Ext.apply(b[a].lastOptions.params.restriction,{start:0,limit:b[a].getCount()}),b[a].reload(b[a].lastOptions)):b[a].reload();var f="wastebasket sent drafts outbox junk journal".split(" ");Ext.isEmpty(c)||Ext.each(c.item,function(a){var b=this.getFolder(a.entryid);if(b){var c=b.getDefaultFolderKey();
0!==a.content_unread&&a.content_unread>b.get("content_unread")&&-1===f.indexOf(c)&&b.isContainerClass("IPF.Note")&&(c=String.format(ngettext("There is {0} unread message in the folder {1}","There are {0} unread messages in the folder {1}",a.content_unread),a.content_unread,a.display_name),container.getNotifier().notify("info.newmail",_("New Mail"),c));b.set("content_unread",a.content_unread);b.set("content_count",a.content_count)}},this)},startKeepAlive:function(){var a=container.getSettingsModel().get("zarafa/v1/contexts/hierarchy/polling_interval");
if(Ext.isNumber(a)&&0<a)container.getRequest().on("aftersend",this.sendKeepAlive,this,{buffer:1E3*a})},sendKeepAlive:function(){var a={params:{},actionType:Zarafa.core.Actions.keepalive};this.proxy.request(Ext.data.Api.actions.read,null,a.params,this.reader,Ext.emptyFn,this,a)},sendDestroySession:function(){var a={params:{},actionType:Zarafa.core.Actions.destroysession};this.proxy.request(Ext.data.Api.actions.read,null,a.params,this.reader,Ext.emptyFn,this,a)},initState:function(){this.state||(this.state=
new Zarafa.hierarchy.data.HierarchyState)},getStateName:function(a,b){if(!1!==this.stateful)return this.state.getStateNameForFolder(a,b)},getState:function(a,b){if(!1!==this.stateful)return this.state.getStateForFolder(a,b)},applyState:function(a,b,c){!1!==this.stateful&&this.state.applyStateForFolder(a,b,c)},onNotifyObjectmodified:function(a,b,c,d,e){Array.isArray(b)||(b=[b]);a=0;for(d=b.length;a<d;a++){e=b[a];var f=Array.isArray(c)?c[a]:c;e.setEventPropagation(!1);f instanceof Ext.data.Record?e.applyData(f):
this.reader.update(e,f);e.setEventPropagation(!0)}},getByContainerClass:function(a){var b=[];this.getStores().forEach(function(c){c=c.getFolderStore().getRange().filter(function(b){return b.get("container_class")===a&&!b.isInDeletedItems()});b=b.concat(c)});return b}});Ext.reg("zarafa.hierarchystore",Zarafa.hierarchy.data.HierarchyStore);Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.IPFSubStore=Ext.extend(Zarafa.core.data.IPFStore,{parentRecord:null,constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER);Ext.applyIf(a,{proxy:new Zarafa.hierarchy.data.HierarchyProxy,writer:new Zarafa.core.data.JsonWriter,reader:new Zarafa.core.data.JsonReader({},b)});Zarafa.hierarchy.data.IPFSubStore.superclass.constructor.call(this,a);this.on({beforesave:this.onBeforeSave,exception:this.onException,
scope:this})},createRecords:function(a,b,c){var d=this.getParentRecord();d&&d.afterEdit();Zarafa.hierarchy.data.IPFSubStore.superclass.createRecords.call(this,a,b,c)},destroyRecord:function(a,b,c){this.getParentRecord()&&this.getParentRecord().markDirty();Zarafa.hierarchy.data.IPFSubStore.superclass.destroyRecord.call(this,a,b,c)},getParentRecord:function(){return this.parentRecord},setParentRecord:function(a){this.parentRecord=a},onException:function(a,b,c,d,e,f){Ext.isDefined(f)&&Array.isArray(f.sendRecords)&&
Ext.each(f.sendRecords,function(a){a.clearMessageActions();a.reject()})},containsStoreInLastLoad:function(a){Array.isArray(a)||(a=[a]);if(this.parentRecord)for(var b=this.parentRecord.get("store_entryid"),c=0,d=a.length;c<d;c++)if(Zarafa.core.EntryId.compareStoreEntryIds(b,a[c]))return!0;return!1},onNotifyObjectdeleted:function(a,b,c,d,e){Array.isArray(b)||(b=[b]);a=0;for(c=b.length;a<c;a++)b[a].setEventPropagation(!1),b[a].phantom=!0;this.remove(b)},onNotifyObjectmodified:function(a,b,c,d,e){Array.isArray(b)||
(b=[b]);a=0;for(d=b.length;a<d;a++){e=b[a];var f=Array.isArray(c)?c[a]:c;e.setEventPropagation(!1);f instanceof Ext.data.Record?e.applyData(f):this.reader.update(e,f);e.setEventPropagation(!0)}},onNotifyObjectcreated:function(a,b,c,d,e){Array.isArray(c)||(c=[c]);a=this instanceof Zarafa.common.favorites.data.MAPIFavoritesSubStore;c[0]instanceof Ext.data.Record?this.loadRecords({records:c},{add:!0}):a||this.loadData({item:c},!0)},save:function(){if(this.removed.length){for(var a=[],b=[],c=0,d=this.removed.length;c<
d;c++){var e=this.removed[c];e.isSharedFolder()&&!e.isFavoritesFolder()?b.push(e):a.push(e)}if(!Ext.isEmpty(b)&&(b={close:b},!1!==this.fireEvent("beforesave",this,b))){try{var f=++this.batchCounter;this.execute("destroy",b.close,{actionType:"closesharedfolder"},f)}catch(g){this.handleException(g)}this.removed=a}}Zarafa.hierarchy.data.IPFSubStore.superclass.save.apply(this,arguments)},onBeforeSave:function(a,b){if(!Ext.isEmpty(b.close)){var c=container.getSettingsModel(),d=b.close;c.beginEdit();for(var e=
0,f=d.length;e<f;e++){var g=d[e],h=g.getMAPIStore().get("user_name").toLowerCase(),k=g.getSharedFolderKey();c.remove("zarafa/v1/contexts/hierarchy/shared_stores/"+h+"/"+k);g.addIdProp("user_name");g.addIdProp("folder_type");g.removeIdProp("parent_entryid");g.removeIdProp("store_entryid");g.set("user_name",h);g.set("folder_type",k)}c.endEdit()}}});Ext.reg("zarafa.ipfsubstore",Zarafa.hierarchy.data.IPFSubStore);Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.MAPIFolderPermissionsSubStore=Ext.extend(Zarafa.core.data.MAPISubStore,{constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_USER_PERMISSION);Ext.applyIf(a,{writer:new Zarafa.hierarchy.data.JsonPermissionsWriter,reader:new Zarafa.core.data.JsonReader({root:"item",dynamicRecord:!1},b)});Zarafa.hierarchy.data.MAPIFolderPermissionsSubStore.superclass.constructor.call(this,a)}});Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.MAPIFolderSubStore=Ext.extend(Zarafa.core.data.MAPISubStore,{constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER);Ext.applyIf(a,{reader:new Zarafa.core.data.JsonReader({dynamicRecord:!1},b)});Zarafa.hierarchy.data.MAPIFolderSubStore.superclass.constructor.call(this,a)}});Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.PermissionProfiles=[{value:Zarafa.core.mapi.Rights.RIGHTS_FULL_CONTROL,name:_("Full control")},{value:Zarafa.core.mapi.Rights.RIGHTS_OWNER,name:_("Owner")},{value:Zarafa.core.mapi.Rights.RIGHTS_SECRETARY,name:_("Secretary")},{value:Zarafa.core.mapi.Rights.RIGHTS_READONLY,name:_("Only read")},{value:Zarafa.core.mapi.Rights.RIGHTS_NO_RIGHTS,name:_("No rights")},{value:null,name:_("Other")}];Ext.namespace("Zarafa.common.data");
Zarafa.hierarchy.data.SharedFolderTypes={APPOINTMENT:"calendar",CONTACT:"contact",ALL:"all",MAIL:"inbox",NOTE:"note",TASK:"task",folders:[{value:"calendar",name:Zarafa.common.data.FolderContentTypes.getFolderName(Zarafa.common.data.FolderContentTypes.appointment)},{value:"contact",name:Zarafa.common.data.FolderContentTypes.getFolderName(Zarafa.common.data.FolderContentTypes.contact)},{value:"all",name:Zarafa.common.data.FolderContentTypes.getFolderName(Zarafa.common.data.FolderContentTypes.ipmsubtree)},
{value:"inbox",name:Zarafa.common.data.FolderContentTypes.getFolderName(Zarafa.common.data.FolderContentTypes.mail)},{value:"note",name:Zarafa.common.data.FolderContentTypes.getFolderName(Zarafa.common.data.FolderContentTypes.note)},{value:"task",name:Zarafa.common.data.FolderContentTypes.getFolderName(Zarafa.common.data.FolderContentTypes.task)}]};Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.UserPermissionsFields=[{name:"entryid"},{name:"display_name"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_MAILUSER},{name:"rights",type:"int",defaultValue:Zarafa.core.mapi.Rights.RIGHTS_NONE}];Zarafa.core.data.RecordCustomObjectType.addProperty("ZARAFA_USER_PERMISSION");Zarafa.core.data.RecordFactory.setBaseClassToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_USER_PERMISSION,Zarafa.core.data.MAPIRecord);
Zarafa.core.data.RecordFactory.addFieldToCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_USER_PERMISSION,Zarafa.hierarchy.data.UserPermissionsFields);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderPropertiesContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.folderpropertiescontentpanel",layout:"fit",title:_("Properties"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0,useShadowStore:!0}),closeOnSave:!0,width:425,height:450,items:[{xtype:"zarafa.folderpropertiespanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,
scope:this}]}]});Zarafa.hierarchy.dialogs.FolderPropertiesContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.folderpropertiescontentpanel",Zarafa.hierarchy.dialogs.FolderPropertiesContentPanel);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.FolderSizeContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.foldersizecontentpanel",layout:"fit",title:_("Folder Size"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0,useShadowStore:!0}),closeOnSave:!0,width:360,height:360,items:[{xtype:"zarafa.foldersizepanel",buttons:[{text:_("Close"),handler:this.close,scope:this}]}]});Zarafa.hierarchy.dialogs.FolderSizeContentPanel.superclass.constructor.call(this,
a)}});Ext.reg("zarafa.foldersizecontentpanel",Zarafa.hierarchy.dialogs.FolderSizeContentPanel);Ext.namespace("Zarafa.hierarchy.ui");
Zarafa.hierarchy.ui.MultiSelectHierarchyTree=Ext.extend(Zarafa.hierarchy.ui.HierarchyTreePanel,{colored:!1,constructor:function(a){a.nodeConfig=Ext.applyIf(a.nodeConfig||{},{checked:!1});Zarafa.hierarchy.ui.MultiSelectHierarchyTree.superclass.constructor.call(this,a);Ext.isDefined(this.model)&&(this.on("checkchange",this.onTreeNodeCheckChange,this),this.on("click",this.onTreeNodeClick,this),this.mon(this.model,"folderchange",this.onFolderChange,this),this.mon(this.model,"activate",this.onCalendarActivate,
this))},initEvents:function(){Zarafa.hierarchy.ui.MultiSelectHierarchyTree.superclass.initEvents.call(this);this.un("click",this.onFolderClicked,this)},onTreeNodeClick:function(a){var b=a.getUI();if(b.checkbox.checked&&a.isNodeSelected)return b.toggleCheck(!1),!1;var c=a.getFolder();this.model.addFolder(c);a.isNodeSelected=!0;b.toggleCheck(!0)},selectFolderInTree:function(a){return(a=this.ensureFolderVisible(a))?(this.getSelectionModel().select(a),!0):!1},onTreeNodeCheckChange:function(a,b){var c=
a.getFolder();b?a.isNodeSelected||this.fireEvent("click",a):(a.isNodeSelected=!1,this.model.removeFolder(c))},onFolderChange:function(a,b){this.updateAll();for(var c=0;c<b.length;c++){var d=b[c].get("entryid"),e=this.getNodeById(d);Ext.isDefined(e)&&(d=a.getColorScheme(d),Ext.get(e.getUI().iconNode).setStyle("color",d.base))}},onCalendarActivate:function(a){(a=this.getNodeById(a.get("entryid")))&&a.select()}});Ext.reg("zarafa.multiselecthierarchytree",Zarafa.hierarchy.ui.MultiSelectHierarchyTree);
Ext.namespace("Zarafa.mail");
Zarafa.mail.MailContextModel=Ext.extend(Zarafa.core.ContextModel,{oldDataMode:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.mail.MailStore);Ext.applyIf(a,{statefulRecordSelection:!0,current_data_mode:Zarafa.mail.data.DataModes.ALL});Zarafa.mail.MailContextModel.superclass.constructor.call(this,a);this.on({searchstart:this.onSearchStart,searchstop:this.onSearchStop,scope:this})},createRecord:function(a){a=a||container.getHierarchyStore().getDefaultFolder("drafts");var b=
this.getSignatureId();return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Note",{store_entryid:a.get("store_entryid"),parent_entryid:a.get("entryid"),body:this.getSignatureData(!1,b),html_body:this.getSignatureData(!0,b),isHTML:container.getSettingsModel().get("zarafa/v1/contexts/mail/dialogs/mailcreate/use_html_editor")})},createResponseRecord:function(a,b,c){if(!Ext.isEmpty(b)&&a){var d=!1;Ext.isDefined(c)?d=!0:c=this.createRecord();c.addMessageAction("action_type",b);c.addMessageAction("source_entryid",
a.get("entryid"));c.addMessageAction("source_store_entryid",a.get("store_entryid"));this.setSourceMessageInfo(a,b,c);var e=a.get("attach_num");Ext.isEmpty(e)||b===Zarafa.mail.data.ActionTypes.EDIT_AS_NEW||c.addMessageAction("source_attach_num",e);if(b===Zarafa.mail.data.ActionTypes.EDIT_AS_NEW)this.copyRecordRecipients(c,a);else{var e=this.getDefaultFolder().getMAPIFolderStore(),f=e.find("entryid",a.get("parent_entryid")),e=(e=e.getAt(f))?"sent"===e.getDefaultFolderKey():!1;this.initRecordRecipients(c,
a,b,e)}this.initRecordSubject(c,a,b);b===Zarafa.mail.data.ActionTypes.FORWARD_ATTACH?c.getAttachmentStore().addEmbeddedAttachment(a):(b===Zarafa.mail.data.ActionTypes.EDIT_AS_NEW?this.copyRecordBody(c,a):this.initRecordBody(c,a,b),this.initRecordAttachments(c,a,b));d&&c.set("subject",_("FW")+": ");Ext.isFunction(a.userIsStoreOwner)&&a.userIsStoreOwner()||(a=container.getHierarchyStore().getById(a.get("store_entryid")))&&c.setDelegatorInfo(a);return c}},setSourceMessageInfo:function(a,b,c){var d;switch(b){case "reply":d=
"0501000066000000";break;case "replyall":d="0501000067000000";break;case "forward":case "forward_attach":d="0601000068000000"}d&&(a="01000E000C000000"+d+"0200000030000000"+a.get("entryid"),c.set("source_message_info",a))},initRecordSubject:function(a,b,c){switch(c){case Zarafa.mail.data.ActionTypes.REPLY:case Zarafa.mail.data.ActionTypes.REPLYALL:c=_("RE")+": ";break;case Zarafa.mail.data.ActionTypes.FORWARD:case Zarafa.mail.data.ActionTypes.FORWARD_ATTACH:c=_("FW")+": ";break;case Zarafa.mail.data.ActionTypes.EDIT_AS_NEW:c=
"";break;default:c=_("RE")+": "}a.set("subject",c+b.get("normalized_subject"));a.set("normalized_subject",b.get("normalized_subject"))},initRecordBody:function(a,b,c){var d,e=this.getSignatureId(c);c=Ext.apply({},b.data);if(b.isOpened()){d=b.getRecipientStore();var f=[],g=[];0<d.getCount()&&(d.each(function(a){switch(a.get("recipient_type")){case Zarafa.core.mapi.RecipientType.MAPI_TO:f.push(a.formatRecipient());break;case Zarafa.core.mapi.RecipientType.MAPI_CC:g.push(a.formatRecipient())}},this),
c.display_to=f.join("; "),c.display_cc=g.join("; "))}d=new Ext.XTemplate(Zarafa.mail.data.Templates.htmlQuotedTemplate,{compiled:!0});c.body=b.getBody(!0);c.signatureData=this.getSignatureData(!0,e);a.set("html_body",d.apply(c));d=new Ext.XTemplate(Zarafa.mail.data.Templates.plaintextQuotedTemplate,{compiled:!0});c.body=b.getBody(!1);c.signatureData=this.getSignatureData(!1,e);b=c.body;for(var e="> ",h=0,k=0;k<b.length;++k)" "===b[k]&&72<h||"\n"===b[k]?(e+="\n> ",h=0):(e+=b[k],h++);c.body=e;a.set("body",
d.apply(c))},initRecordRecipients:function(a,b,c,d){if(c!==Zarafa.mail.data.ActionTypes.FORWARD&&c!==Zarafa.mail.data.ActionTypes.FORWARD_ATTACH){var e=a.getRecipientStore(),f=[];d||(a=container.getUser().getEntryId(),f.push(a),b.getSubStore("reply-to").each(function(a){this.addRecipientToStore(e,a,!0);a=a.get("entryid");f.push(a)},this));if(c===Zarafa.mail.data.ActionTypes.REPLYALL||c===Zarafa.mail.data.ActionTypes.REPLY&&d)b.getRecipientStore().each(function(a){if(c!==Zarafa.mail.data.ActionTypes.REPLY||
a.get("recipient_type")===Zarafa.core.mapi.RecipientType.MAPI_TO){var b=a.get("entryid"),d=!1;if(b)for(var g=0;g<f.length;g++)if(Zarafa.core.EntryId.compareABEntryIds(f[g],b)){d=!0;break}d||(this.addRecipientToStore(e,a,!1),f.push(b))}},this),d&&-1===e.find("recipient_type",Zarafa.core.mapi.RecipientType.MAPI_TO)&&this.addRecipientToStore(e,b.getSender(),!0)}},addRecipientToStore:function(a,b,c){b=Ext.apply({},b.data);b=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
b);c&&b.set("recipient_type",Zarafa.core.mapi.RecipientType.MAPI_TO);b.set("rowid",void 0);a.add(b)},copyRecordBody:function(a,b){a.set("body",b.getBody(!1));var c=b.getBody(!0),c=c.replace(/<\!\-\-.*?\-\->/gi,""),c=c.replace(/^\s*<div\s+class=['"]bodyclass['"]\s*>/gi,""),c=c.replace(/\s*<\/div\s*>\s*$/gi,"");a.set("html_body",c)},copyRecordRecipients:function(a,b){var c=a.getRecipientStore();b.getRecipientStore().each(function(a){a=Ext.apply({},a.data);a=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
a);a.set("rowid",void 0);c.add(a)},this)},initRecordAttachments:function(a,b,c){var d=a.getAttachmentStore();switch(c){case Zarafa.mail.data.ActionTypes.FORWARD:case Zarafa.mail.data.ActionTypes.FORWARD_ATTACH:case Zarafa.mail.data.ActionTypes.EDIT_AS_NEW:b.getAttachmentStore().each(function(a){d.add(a.copy())},this),a.set("hasattach",b.get("hasattach"))}},getSignatureId:function(a){switch(a){case Zarafa.mail.data.ActionTypes.FORWARD:case Zarafa.mail.data.ActionTypes.FORWARD_ATTACH:case Zarafa.mail.data.ActionTypes.REPLYALL:case Zarafa.mail.data.ActionTypes.REPLY:a=
container.getSettingsModel().get("zarafa/v1/contexts/mail/signatures/replyforward_message",!0);break;default:a=container.getSettingsModel().get("zarafa/v1/contexts/mail/signatures/new_message",!0)}return parseInt(a,10)},getSignatureData:function(a,b){if(!b)return"";var c=container.getSettingsModel().get("zarafa/v1/contexts/mail/signatures/all/"+b,!0);if(Ext.isEmpty(c))return"";c=Ext.apply({},c);if(!Ext.isDefined(c.content))return"";var d=c.isHTML;!1===a?(!0===d&&(c.content=Zarafa.core.HTMLParser.convertHTMLToPlain(c.content)),
c.content="\n\n"+c.content):(!1===d&&(c.content=Zarafa.core.HTMLParser.convertPlainToHTML(c.content)),c.content=c.content);c.content=this.replaceSignatureTemplates(c.content,a);return c.content},replaceSignatureTemplates:function(a,b){if(!/{%.*}/gi.test(a))return a;var c=container.getUser(),c={firstname:c.getFirstName(),initials:c.getInitials(),lastname:c.getLastName(),displayname:c.getDisplayName(),title:c.getTitle(),company:c.getCompany(),department:c.getDepartment(),office:c.getOffice(),assistant:c.getAssistant(),
phone:c.getPhone(),primary_email:c.getSMTPAddress(),address:c.getAddress(),city:c.getCity(),state:c.getState(),zipcode:c.getZipCode(),country:c.getCountry(),phone_business:c.getPhoneBusiness(),phone_business2:c.getPhoneBusiness2(),phone_fax:c.getFax(),phone_assistant:c.getPhoneAssistant(),phone_home:c.getPhoneHome(),phone_home2:c.getPhoneHome2(),phone_mobile:c.getPhoneMobile(),phone_pager:c.getPhonePager()};Ext.iterate(c,function(c,e){Ext.isDefined(e)?b&&(e=Zarafa.core.HTMLParser.nl2br(Ext.util.Format.htmlEncode(e))):
e="";a=a.replace(new RegExp("{%"+c+"}","gi"),e)});return a},onDataModeChange:function(a,b,c){Zarafa.mail.MailContextModel.superclass.onDataModeChange.call(this,a,b,c);b!==c&&c===Zarafa.mail.data.DataModes.SEARCH&&(this.stopSearch(),this.stopLiveScroll());switch(b){case Zarafa.mail.data.DataModes.ALL:this.load()}},onFolderChange:function(a,b){if(!Ext.isEmpty(b)){var c=b[0].getDefaultFolderKey(),d="message_delivery_time";if("drafts"===c)d="last_modification_time";else if("sent"===c||"outbox"===c)d=
"client_submit_time";this.store.defaultSortInfo.field=d}Zarafa.mail.MailContextModel.superclass.onFolderChange.call(this,a,b)},onSearchStart:function(a){this.getCurrentDataMode()!=Zarafa.mail.data.DataModes.SEARCH&&(this.oldDataMode=this.getCurrentDataMode(),this.setDataMode(Zarafa.mail.data.DataModes.SEARCH))},onSearchStop:function(a){this.getCurrentDataMode()===Zarafa.mail.data.DataModes.SEARCH&&this.setDataMode(this.oldDataMode);delete this.oldDataMode}});Ext.namespace("Zarafa.mail.data");
Zarafa.mail.data.MailFlags={colors:[{name:_("Red"),iconCls:"icon_flag_red",flagStatus:Zarafa.core.mapi.FlagStatus.flagged,flagColor:Zarafa.core.mapi.FlagIcon.red},{name:_("Blue"),iconCls:"icon_mail_flag_blue",flagStatus:Zarafa.core.mapi.FlagStatus.flagged,flagColor:Zarafa.core.mapi.FlagIcon.blue},{name:_("Yellow"),iconCls:"icon_mail_flag_yellow",flagStatus:Zarafa.core.mapi.FlagStatus.flagged,flagColor:Zarafa.core.mapi.FlagIcon.yellow},{name:_("Green"),iconCls:"icon_mail_flag_green",flagStatus:Zarafa.core.mapi.FlagStatus.flagged,
flagColor:Zarafa.core.mapi.FlagIcon.green},{name:_("Orange"),iconCls:"icon_mail_flag_orange",flagStatus:Zarafa.core.mapi.FlagStatus.flagged,flagColor:Zarafa.core.mapi.FlagIcon.orange},{name:_("Purple"),iconCls:"icon_mail_flag_purple",flagStatus:Zarafa.core.mapi.FlagStatus.flagged,flagColor:Zarafa.core.mapi.FlagIcon.purple}],state:[{name:_("Complete"),iconCls:"icon_flag_complete",flagStatus:Zarafa.core.mapi.FlagStatus.completed,flagColor:Zarafa.core.mapi.FlagIcon.clear},{name:_("None"),iconCls:"icon_mail_flag",
flagStatus:Zarafa.core.mapi.FlagStatus.cleared,flagColor:Zarafa.core.mapi.FlagIcon.clear}]};Ext.namespace("Zarafa.mail.data");
Zarafa.mail.data.SensitivityFlags={flags:[{value:Zarafa.core.mapi.Sensitivity.NONE,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.NONE)},{value:Zarafa.core.mapi.Sensitivity.PERSONAL,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.PERSONAL)},{value:Zarafa.core.mapi.Sensitivity.PRIVATE,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.PRIVATE)},{value:Zarafa.core.mapi.Sensitivity.COMPANY_CONFIDENTIAL,name:Zarafa.core.mapi.Sensitivity.getDisplayName(Zarafa.core.mapi.Sensitivity.COMPANY_CONFIDENTIAL)}]};
Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailCreateOptionsContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.mailcreateoptionscontentpanel",layout:"fit",title:_("Message Options"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),autoSave:a.modal?!1:!0,width:320,height:220,items:[{xtype:"zarafa.mailcreateoptionspanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,
scope:this}]}]});Zarafa.mail.dialogs.MailCreateOptionsContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.mailcreateoptionscontentpanel",Zarafa.mail.dialogs.MailCreateOptionsContentPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailCreateToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"zarafa.mailcreatetoolbar",insertionPointBase:"context.mail.mailcreatecontentpanel",actionItems:this.createActionButtons(),optionItems:this.createOptionButtons(),rightAlignedItems:this.createRightAlignedOptionButtons()});Zarafa.mail.dialogs.MailCreateToolbar.superclass.constructor.call(this,
a)},onRender:function(){Zarafa.mail.dialogs.MailCreateToolbar.superclass.onRender.apply(this,arguments);this.dialog&&(this.mon(this.dialog,"bcctoggle",this.onContentPanelBccToggle,this),this.mon(this.dialog,"fromtoggle",this.onContentPanelFromToggle,this));var a=container.getSettingsModel();this.mon(a,"set",this.onSettingsChange,this);this.mon(a,"remove",this.onSettingsChange,this);this.onSettingsChange(a)},createActionButtons:function(){return[{xtype:"splitbutton",text:_("Send"),overflowText:_("Send email"),
ref:"sendButton",tooltip:{title:_("Send email"),text:_("Send email to recipients")+" (Ctrl + ENTER)"},menu:{defaults:{plugins:"zarafa.menuitemtooltipplugin"},items:[{text:_("Send"),iconCls:"icon_send_black",handler:this.onSendButton,tooltip:{title:_("Send email"),text:_("Send email to recipients")+" (Ctrl + ENTER)"},scope:this},{text:_("Send Later"),tooltip:{title:_("Send Later"),text:_("Schedule your mail to be sent on a specific date and time.")},iconCls:"icon_send_later_black",handler:this.onSendLaterButton,
scope:this}]},cls:"zarafa-action",iconCls:"buttons-icon_send_white",handler:this.onSendButton,scope:this},{xtype:"button",overflowText:_("Save email"),tooltip:{title:_("Save email"),text:_("Save email")+" (Ctrl + S)"},iconCls:"icon_saveEmail",handler:this.onSaveButton,scope:this},{xtype:"button",ref:"deleteBtn",overflowText:_("Delete"),tooltip:{title:_("Delete"),text:_("Delete this mail")},iconCls:"icon_delete",handler:this.onDeleteButton,scope:this},{xtype:"zarafa.attachmentbutton",plugins:["zarafa.recordcomponentupdaterplugin"],
overflowText:_("Add attachment"),tooltip:{title:_("Add attachment"),text:_("Add attachments to this email")},iconCls:"icon_attachment",ref:"attachmentButton",listeners:{added:this.onAttachmentButtonAdded,scope:this}},{xtype:"tbseparator"},{xtype:"button",overflowText:_("Check names"),tooltip:{title:_("Check names"),text:_("Check all recipient names")},iconCls:"icon_checkNames",handler:this.onCheckNamesButton,scope:this},{xtype:"button",overflowText:_("Add signature"),tooltip:{title:_("Add signature"),
text:_("Add signature to this mail")},iconCls:"icon_addSignature",ref:"signatureButton",scope:this}]},onAttachmentButtonAdded:function(a){a.isXType("menuitem")&&(a.update=Zarafa.common.attachment.ui.AttachmentButton.prototype.update.createDelegate(this.attachmentButton))},createOptionButtons:function(){return[{xtype:"button",overflowText:_("Options"),tooltip:{title:_("Options"),text:_("Open options dialog")},iconCls:"icon_openMessageOptions",handler:this.onMailOptionsButton,scope:this},{xtype:"button",
overflowText:_("Set flag"),tooltip:{title:_("Set flag"),text:_("Set flag on this email")},iconCls:"icon_flag_red",handler:this.onSetFlagButton,scope:this},{xtype:"button",overflowText:_("High priority"),tooltip:{title:_("High priority"),text:_("Mark this mail as high priority")},iconCls:"icon_setHighPriority",ref:"highPriority",toggleGroup:"priorityGroup",importance:Zarafa.core.mapi.Importance.URGENT,enableToggle:!0,toggleHandler:this.onPriorityGroupToggle,scope:this},{xtype:"button",overflowText:_("Low priority"),
tooltip:{title:_("Low priority"),text:_("Mark this mail as low priority")},iconCls:"icon_setLowPriority",ref:"lowPriority",toggleGroup:"priorityGroup",importance:Zarafa.core.mapi.Importance.NONURGENT,enableToggle:!0,toggleHandler:this.onPriorityGroupToggle,scope:this},{xtype:"button",overflowText:_("Set read receipt"),tooltip:{title:_("Set read receipt"),text:_("Request read receipt from recipients")},iconCls:"icon_setReadReceipt",enableToggle:!0,ref:"readReceiptField",toggleHandler:this.onReadReceiptToggle,
scope:this},{xtype:"button",overflowText:_("Show bcc"),tooltip:{title:_("Show Bcc"),text:_("Show Bcc field in which you can specify the people who will recieve this message")},iconCls:"icon_showbcc",ref:"showBcc",enableToggle:!0,toggleHandler:this.onBccMenuToggle,scope:this},{xtype:"button",overflowText:_("Show From"),tooltip:{title:_("Show From"),text:_("Show From field, If you have delegate access to another person's account, you can send e-mail that looks like that came from them by entering their name into the From field")},
iconCls:"icon_showfrom",ref:"showFrom",enableToggle:!0,toggleHandler:this.onFromMenuToggle,scope:this}]},createRightAlignedOptionButtons:function(){if(Zarafa.supportsPopOut()&&Zarafa.core.BrowserWindowMgr.isMainWindowActive())return[{xtype:"zarafa.toolbarbutton",tooltip:_("Open in new browser window"),overflowText:_("Pop-Out"),iconCls:"icon_popout",ref:"popOutBtn",handler:this.onPopoutButton,scope:this}]},onSettingsChange:function(a,b){var c=!0;if(!Ext.isEmpty(b))for(var c=!1,d=0;d<b.length;d++)if(b[d].path&&
0<=b[d].path.indexOf("zarafa/v1/contexts/mail/signatures/all")){c=!0;break}if(c&&(d=a.get("zarafa/v1/contexts/mail/signatures/all",!0),!Ext.isEmpty(d))){var c=[],e;for(e in d)c.push({text:Ext.util.Format.htmlEncode(d[e].name),signatureId:parseInt(e,10)});0===c.length&&c.push({text:_("No signatures configured"),signatureId:!1});this.signatureButton.menu?(e=this.signatureButton.menu,e.removeAll(),e.add(c)):this.signatureButton.menu=Ext.menu.MenuMgr.get({xtype:"menu",listeners:{click:this.onSignatureSelect,
scope:this},items:c})}},onSignatureSelect:function(a,b,c){Ext.isNumber(b.signatureId)&&this.dialog.mainPanel.setSignatureInEditor(b.signatureId)},onSendButton:function(a){null!==this.record.get("deferred_send_time")&&this.record.set("deferred_send_time",null);this.dialog.sendRecord()},onSendLaterButton:function(a){this.dialog.sendLaterRecord()},onSaveButton:function(a){this.dialog.saveRecord()},onDeleteButton:function(a){this.dialog.deleteRecord()},onCheckNamesButton:function(a){this.record.getRecipientStore().resolve(void 0,
{cancelPreviousRequest:!0})},onMailOptionsButton:function(a){Zarafa.mail.Actions.openMailOptionsContent(this.record,{autoSave:!1})},onSetFlagButton:function(a,b){Zarafa.common.Actions.openFlagsMenu(this.record,b.getXY(),!1)},onPriorityGroupToggle:function(a,b){b?this.record.set("importance",a.importance):this.record.set("importance",Zarafa.core.mapi.Importance.NORMAL)},onBccMenuToggle:function(a,b){this.dialog.toggleBccState(b)},onFromMenuToggle:function(a,b){this.dialog.toggleFromState(b)},onContentPanelBccToggle:function(a,
b){this.showBcc.toggle(b,!0)},onContentPanelFromToggle:function(a,b){this.showFrom.toggle(b,!0)},onReadReceiptToggle:function(a){this.record.set("read_receipt_requested",a.pressed)},update:function(a,b){this.record=a;this.deleteBtn.setDisabled(!0===a.phantom);if(!0===b||a.isModifiedSinceLastUpdate("importance"))switch(a.get("importance")){case Zarafa.core.mapi.Importance.URGENT:this.highPriority.toggle(!0,!1);break;case Zarafa.core.mapi.Importance.NONURGENT:this.lowPriority.toggle(!0,!1);break;default:this.highPriority.toggle(!1,
!0),this.lowPriority.toggle(!1,!0)}(!0===b||a.isModifiedSinceLastUpdate("read_receipt_requested"))&&this.readReceiptField.toggle(this.record.get("read_receipt_requested"),!0)},onPopoutButton:function(a){Zarafa.mail.Actions.popoutMailContent(this.record,this.dialog)}});Ext.reg("zarafa.mailcreatetoolbar",Zarafa.mail.dialogs.MailCreateToolbar);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailFlagsContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{disableFlagColor:!1,disableCompleted:!1,constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.mailflagscontentpanel",layout:"fit",width:350,height:150,items:[{xtype:"zarafa.mailflagspanel",disableFlagColor:Ext.isBoolean(a.disableFlagColor)?a.disableFlagColor:this.disableFlagColor,disableCompleted:Ext.isBoolean(a.disableCompleted)?a.disableCompleted:this.disableCompleted,buttons:[{text:_("Ok"),handler:this.onOk,
scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}],autoSave:Ext.isDefined(a.modal)?a.modal:!0,title:_("E-Mail Flags"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0})});Zarafa.mail.dialogs.MailFlagsContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.mailflagscontentpanel",Zarafa.mail.dialogs.MailFlagsContentPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailViewOptionsContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{xtype:"zarafa.mailviewoptionscontentpanel",layout:"fit",title:_("Message Options"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),autoSave:a.modal?!1:!0,width:400,height:400,items:[{xtype:"zarafa.mailviewoptionspanel",buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});
Zarafa.mail.dialogs.MailViewOptionsContentPanel.superclass.constructor.call(this,a)}});Ext.reg("zarafa.mailviewoptionscontentpanel",Zarafa.mail.dialogs.MailViewOptionsContentPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.ShowMailToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{xtype:"mail.showmailtoolbar",insertionPointBase:"context.mail.showmailcontentpanel",actionItems:this.createActionButtons("context.mail.showmailcontentpanel"),optionItems:this.createOptionButtons(),rightAlignedItems:this.createRightAlignedOptionButtons()});Zarafa.mail.dialogs.ShowMailToolbar.superclass.constructor.call(this,
a)},createActionButtons:function(a){return container.populateInsertionPoint(a+".toolbar.actions.first").concat([{xtype:"button",rowspan:2,text:_("Reply"),tooltip:_("Reply")+" (Ctrl + R)",overflowText:_("Reply"),cls:"zarafa-action",iconCls:"icon_replyEmail",ref:"replyBtn",actionType:Zarafa.mail.data.ActionTypes.REPLY,handler:this.onMailResponseButton,scope:this,listeners:{beforeshow:this.onBeforeShowReplyButton,scope:this}},{xtype:"button",text:_("Reply All"),tooltip:_("Reply All")+" (Ctrl + Alt + R)",
overflowText:_("Reply All"),iconCls:"icon_replyAllEmail",ref:"replyAllBtn",actionType:Zarafa.mail.data.ActionTypes.REPLYALL,handler:this.onMailResponseButton,scope:this},{xtype:"button",text:_("Forward"),tooltip:_("Forward")+" (Ctrl + F)",overflowText:_("Forward"),iconCls:"icon_forwardEmail",ref:"forwardBtn",actionType:Zarafa.mail.data.ActionTypes.FORWARD,handler:this.onMailResponseButton,scope:this},{xtype:"button",ref:"deleteBtn",overflowText:_("Delete this item."),tooltip:{title:_("Delete mail"),
text:_("Delete this mail.")},iconCls:"icon_delete",handler:this.onDeleteButton,scope:this}])},onBeforeShowReplyButton:function(a){"IPM.Schedule.Meeting"===this.record.get("message_class").substring(0,20)?a.getEl().removeClass("zarafa-action"):a.getEl().addClass("zarafa-action")},createOptionButtons:function(){return[{xtype:"button",ref:"optionsBtn",overflowText:_("Options"),tooltip:{title:_("Options"),text:_("Open options dialog")},iconCls:"icon_openMessageOptions",handler:this.onMailOptionsButton,
scope:this},{xtype:"button",overflowText:_("Set Category"),tooltip:{title:_("Categories"),text:_("Open the categories dialog.")},iconCls:"icon_categories",handler:this.onOpenCategories,scope:this},{xtype:"button",ref:"setFlagBtn",overflowText:_("Set flag"),tooltip:{title:_("Set flag"),text:_("Set flag on this email")},iconCls:"icon_flag_red",handler:this.onSetFlagButton,scope:this},{xtype:"splitbutton",cls:"zarafa-more-options-btn",tooltip:_("More options"),splitOnMoreMenu:!0,overflowText:_("More options"),
iconCls:"icon_more",menu:this.moreMenuButtons(this),handler:function(){this.showMenu()}}]},createRightAlignedOptionButtons:function(){if(Zarafa.supportsPopOut()&&Zarafa.core.BrowserWindowMgr.isMainWindowActive())return[{xtype:"zarafa.toolbarbutton",tooltip:_("Open in new browser window"),overflowText:_("Pop-Out"),iconCls:"icon_popout",ref:"popOutBtn",handler:this.onPopoutButton,scope:this}]},update:function(a,b){this.record=a;var c=!1,d=!1;a&&(c=a.isSubMessage(),d=a.isFaultyMessage());this.deleteBtn.setVisible(!c);
this.setFlagBtn.setVisible(!c);this.optionsBtn.setVisible(!c&&!d);this.replyBtn.setVisible(!d);this.replyAllBtn.setVisible(!d);this.forwardBtn.setVisible(!d)},moreMenuButtons:function(a){return{xtype:"zarafa.conditionalmenu",items:[{xtype:"zarafa.conditionalitem",text:_("Mark Read"),iconCls:"icon_mail icon_message_read",hideMode:"offsets",readState:!0,beforeShow:this.onBeforeShowMoreMenu,handler:this.onReadFlagMenuItemClicked,scope:a},{xtype:"zarafa.conditionalitem",text:_("Mark Unread"),hideMode:"offsets",
iconCls:"icon_mail icon_message_unread",readState:!1,beforeShow:this.onBeforeShowMoreMenu,handler:this.onReadFlagMenuItemClicked,scope:a},{text:_("Copy/Move"),iconCls:"icon_copy",handler:this.onCopyMove,scope:a},{text:_("Print"),iconCls:"icon_print",handler:this.onPrintButton,scope:this},{text:_("Edit as New Message"),iconCls:"icon_editAsNewEmail",actionType:Zarafa.mail.data.ActionTypes.EDIT_AS_NEW,handler:this.onMailResponseButton,scope:a},{text:_("Download"),iconCls:"icon_saveaseml",actionType:Zarafa.mail.data.ActionTypes.EDIT_AS_NEW,
handler:this.onDownloadMailButton,scope:a}]}},onBeforeShowMoreMenu:function(a){a.setVisible(this.record.isRead()?!a.readState:a.readState)},onReadFlagMenuItemClicked:function(a){Zarafa.common.Actions.markAsRead(this.record,a.readState)},onMailOptionsButton:function(a){Zarafa.mail.Actions.openMailOptionsContent(this.record,{autoSave:!0})},onSetFlagButton:function(a,b){Zarafa.common.Actions.openFlagsMenu(this.record,b.getXY(),!1)},onDeleteButton:function(a){this.dialog.deleteRecord()},onOpenCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.record)},
onCopyMove:function(){Zarafa.common.Actions.openCopyMoveContent(this.record)},onPrintButton:function(a){Zarafa.common.Actions.openPrintDialog(this.record)},onPopoutButton:function(a){Zarafa.mail.Actions.popoutMailContent(this.record,this.dialog)},onMailResponseButton:function(a){var b=this.dialog.getContextModel(),c=Zarafa.core.BrowserWindowMgr.isOwnedByMainWindow(a)?void 0:{layerType:"separateWindows"};Zarafa.mail.Actions.openCreateMailResponseContent(this.record,b,a.actionType,c);!0===container.getSettingsModel().get("zarafa/v1/contexts/mail/close_on_respond")&&
this.dialog.close()},onDownloadMailButton:function(a){Zarafa.common.Actions.openSaveEmlDialog(this.record)}});Ext.reg("zarafa.showmailtoolbar",Zarafa.mail.dialogs.ShowMailToolbar);Ext.namespace("Zarafa.mail.printer");
Zarafa.mail.printer.MailRenderer=Ext.extend(Zarafa.common.printer.renderers.RecordRenderer,{generateBodyTemplate:function(a){var b;b="<b>{fullname:htmlEncode}</b>\n<hr>\n<table>\n"+this.addRow(_("From"),"{sender_name:htmlEncode}");b+=this.addRow(_("Sent"),'{message_delivery_time:date("'+_("l jS F Y G:i")+'")}');b+=this.optionalRow(_("To"),"display_to","{display_to:htmlEncode}");b+=this.optionalRow(_("Cc"),"display_cc","{display_cc:htmlEncode}");b+=this.optionalRow(_("Bcc"),"display_bcc","{display_bcc:htmlEncode}");
b+=this.addRow(_("Subject"),"{subject:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Sensitivity"),"sensitivity","{sensitivity:sensitivityString}");b+=this.optionalRow(_("Importance"),"importance","{importance:importanceString}");b=b+'<tpl if="!Ext.isEmpty(values.sensitivity) || !Ext.isEmpty(values.importance)">'+this.addRow("","");b=b+"</tpl>"+this.optionalRow(_("Attachments"),"attachment_names","{attachment_names:htmlEncode}");b=b+"</table><br><p>\n"+a.getBody(!0).replace(/{/g,"&#123;").replace(/}/g,
"&#125;").replace(/\u2028/g,"").replace(/\u2029/g,"");b+="</p>\n";return a.isExternalContentBlocked()?b.replace(/<img[^>]*>/g,""):b}});Ext.namespace("Zarafa.mail.ui");
Zarafa.mail.ui.MailGrid=Ext.extend(Zarafa.common.ui.grid.MapiMessageGrid,{context:void 0,model:void 0,sentFolderTypes:void 0,unSentFolderTypes:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.sentFolderTypes)||(a.sentFolderTypes=["outbox","sent"]);Ext.isDefined(a.unSentFolderTypes)||(a.unSentFolderTypes=["drafts"]);!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);
Ext.applyIf(a,{xtype:"zarafa.mailgrid",border:!1,stateful:!0,statefulRelativeDimensions:!1,loadMask:this.initLoadMask(),viewConfig:this.initViewConfig(),sm:this.initSelectionModel(),cm:this.initColumnModel(),enableDragDrop:!0,supportLiveScroll:!0,ddGroup:"dd.mapiitem"});Zarafa.mail.ui.MailGrid.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.mail.ui.MailGrid.superclass.initEvents.call(this);this.on({cellclick:this.onCellClick,rowclick:this.onRowClick,rowbodycontextmenu:this.onRowBodyContextMenu,
rowdblclick:this.onRowDblClick,scope:this});this.mon(this.getView(),"livescrollstart",this.onLiveScrollStart,this);this.mon(this.getView(),"beforesort",this.onBeforeSort,this);this.mon(this.getSelectionModel(),"rowselect",this.onRowSelect,this,{buffer:1});this.mon(this.getSelectionModel(),"selectionchange",this.onSelectionChange,this,{buffer:1});this.mon(this.context,"viewmodechange",this.onContextViewModeChange,this);this.mon(this.context,"viewchange",this.onContextViewChange,this);this.onContextViewModeChange(this.context,
this.context.getCurrentViewMode())},initLoadMask:function(){return{msg:_("Loading mail")+"..."}},initViewConfig:function(){return{enableRowBody:!0,getRowClass:this.viewConfigGetRowClass,rowSelectorDepth:15,enableGrouping:this.hasEnabledGrouping(),enableGroupingMenu:!0}},viewConfigGetRowClass:function(a,b,c,d){b=Ext.isFunction(a.isRead)&&!a.isRead()?"mail_unread":"mail_read";return this.enableRowBody?(c.body='<div class="zarafa-grid-body-container">',b+=" with-categories",d=Zarafa.common.categories.Util.getCategories(a),
d=Zarafa.common.categories.Util.getCategoriesHtml(d),c.body+='<div class="k-category-add-container"><span class="k-category-add"></span></div><div class="k-category-container">'+d+"</div>",d={},a=Zarafa.common.ui.grid.Renderers.subject(a.get("subject"),d,a),c.body+=String.format('<div class="grid_compact grid_compact_left grid_compact_subject_cell {0}">{1}</div>',d.css,a),c.body+="</div>","x-grid3-row-expanded "+b):"x-grid3-row-collapsed "+b},initSelectionModel:function(){return new Zarafa.mail.ui.MailRowSelectionModel({singleSelect:!1})},
initColumnModel:function(){return new Zarafa.mail.ui.MailGridColumnModel},onContextViewChange:function(a,b,c){c===Zarafa.mail.data.Views.LIVESCROLL&&this.getView().resetScroll()},onContextViewModeChange:function(a,b,c){switch(b){case Zarafa.mail.data.ViewModes.RIGHT_PREVIEW:case Zarafa.mail.data.ViewModes.NO_PREVIEW:case Zarafa.mail.data.ViewModes.BOTTOM_PREVIEW:a=b===Zarafa.mail.data.ViewModes.RIGHT_PREVIEW,this.getView().enableRowBody=a,this.getColumnModel().setCompactView(a)}},onBeforeConfigChange:function(a,
b){if(this.currentEntryId){for(var c=container.getHierarchyStore().getById(this.currentStoreEntryId).getFolder(this.currentEntryId).getDefaultFolderKey(),d=0<=this.sentFolderTypes.indexOf(c),c=0<=this.unSentFolderTypes.indexOf(c),e=!d&&!c,f=0,g=b.length;f<g;f++){var h=b[f];"sent_representing_name"===h.dataIndex?h.hidden=!e:"display_to"===h.dataIndex?h.hidden=!(d||c):"message_delivery_time"===h.dataIndex?h.hidden=!e:"client_submit_time"===h.dataIndex?h.hidden=!d:"last_modification_time"===h.dataIndex&&
(h.hidden=!c)}Zarafa.mail.ui.MailGrid.superclass.onBeforeConfigChange.apply(this,arguments)}},onCellClick:function(a,b,c,d){a=this.store.getAt(b);Ext.isDefined(a)&&(c=this.getColumnModel().config[c],"icon_index"===c.dataIndex?Zarafa.common.Actions.markAsRead(a,!a.isRead()):"flag_due_by"===c.dataIndex&&Zarafa.common.Actions.openFlagsMenu(a,d.getXY()))},onRowClick:function(a,b,c){Ext.get(c.target).hasClass("k-category-add")&&(a=this.store.getAt(b),Zarafa.common.Actions.openCategoriesMenu([a],c.getXY()))},
onRowBodyContextMenu:function(a,b,c){this.onCellContextMenu(a,b,-1,c)},onRowDblClick:function(a,b,c){a=this.getSelectionModel().getSelected();(b=Zarafa.core.BrowserWindowMgr.getOpenedWindow(a))?b.focus():Zarafa.common.Actions.openMessageContent(a)},onRowSelect:function(a,b,c){b=a.getCount();0===b?this.model.setPreviewRecord(void 0):1===b&&a.getSelected()===c&&this.model.setPreviewRecord(c)},onSelectionChange:function(a){a=a.getSelections();this.model.setSelectedRecords(a);Ext.isEmpty(a)&&this.model.setPreviewRecord(void 0)},
onLiveScrollStart:function(a){this.model.startLiveScroll(a)},onBeforeSort:function(){this.model.stopLiveScroll()},onConfigChange:function(){if(this.getView().enableGrouping){var a=this.getStore(),b=this.getStore().sortInfo;this.getView().isAllowGrouping(b.field)&&(a.groupField=b.field)}},hasEnabledGrouping:function(){return container.getSettingsModel().get("zarafa/v1/contexts/mail/enable_grouping")}});Ext.reg("zarafa.mailgrid",Zarafa.mail.ui.MailGrid);Ext.namespace("Zarafa.note");
Zarafa.note.NoteContextModel=Ext.extend(Zarafa.core.ContextModel,{oldDataMode:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.note.NoteStore);Ext.applyIf(a,{statefulRecordSelection:!0,current_data_mode:Zarafa.note.data.DataModes.ALL});Zarafa.note.NoteContextModel.superclass.constructor.call(this,a);this.on({searchstart:this.onSearchStart,searchstop:this.onSearchStop,scope:this})},createRecord:function(a){a=a||this.getDefaultFolder();return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.StickyNote",
{store_entryid:a.get("store_entryid"),parent_entryid:a.get("entryid")})},onDataModeChange:function(a,b,c){Zarafa.note.NoteContextModel.superclass.onDataModeChange.call(this,a,b,c);b!==c&&c===Zarafa.note.data.DataModes.SEARCH&&this.stopSearch();switch(b){case Zarafa.note.data.DataModes.SEARCH:this.store.clearFilter();break;case Zarafa.note.data.DataModes.ALL:this.store.clearFilter();this.load();break;case Zarafa.note.data.DataModes.LAST_7_DAYS:a=new Date,a.setHours(12),a=a.add(Date.DAY,-7).clearTime().getTime()/
1E3,this.load({params:{restriction:{note:Zarafa.core.data.RestrictionFactory.dataResProperty("last_modification_time",Zarafa.core.mapi.Restrictions.RELOP_GT,a)}}})}},onSearchStart:function(a){this.getCurrentDataMode()!=Zarafa.note.data.DataModes.SEARCH&&(this.oldDataMode=this.getCurrentDataMode(),this.setDataMode(Zarafa.note.data.DataModes.SEARCH))},onSearchStop:function(a){this.getCurrentDataMode()===Zarafa.note.data.DataModes.SEARCH&&this.setDataMode(this.oldDataMode);delete this.oldDataMode}});
Ext.namespace("Zarafa.note.dialogs");
Zarafa.note.dialogs.NoteEditContentPanel=Ext.extend(Zarafa.core.ui.RecordContentPanel,{constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.noteeditcontentpanel",layout:"fit",title:_("Note"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),confirmClose:!0,items:[this.createPanel()]});Zarafa.note.dialogs.NoteEditContentPanel.superclass.constructor.call(this,a)},createPanel:function(){return{iconCls:"icon_folder_note",border:!1,tbar:{xtype:"zarafa.noteedittoolbar"},
xtype:"zarafa.noteeditpanel",layout:"fit"}},update:function(a,b){!0===b&&this.inputAutoFocusPlugin.setAutoFocus("zarafa.editorfield");this.updateIconFromRecord(a);this.updateTitleFromRecord(a)},updateIconFromRecord:function(a){a=Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){a=a.get("subject");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)}});Ext.reg("zarafa.noteeditcontentpanel",Zarafa.note.dialogs.NoteEditContentPanel);Ext.namespace("Zarafa.note.dialogs");
Zarafa.note.dialogs.NoteEditToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{insertionPointBase:"context.note.noteeditcontentpanel",actionItems:this.createActionButtons()});Zarafa.note.dialogs.NoteEditToolbar.superclass.constructor.call(this,a)},createActionButtons:function(){return[{xtype:"button",ref:"saveBtn",text:_("Save"),overflowText:_("Save Note"),tooltip:{title:_("Save"),
text:_("Save note")+" (Ctrl + S)"},cls:"zarafa-action",iconCls:"buttons-icon_save_white",handler:this.onSaveButton,scope:this},{xtype:"button",ref:"deleteBtn",overflowText:_("Delete Note"),tooltip:{title:_("Delete"),text:_("Delete this note")},cls:"tb-notes-btn-delete",iconCls:"icon_delete",handler:this.onDeleteButton,scope:this},{xtype:"button",overflowText:_("Set Category"),tooltip:{title:_("Categories"),text:_("Open the categories dialog.")},cls:"tb-notes-btn-categories",iconCls:"icon_categories",
handler:this.onOpenCategories,scope:this},{xtype:"button",overflowText:_("Print"),tooltip:{title:_("Print"),text:_("Print this note")},cls:"tb-notes-btn-print",iconCls:"icon_print",handler:this.onPrintRecord,scope:this},{xtype:"combo",width:75,fieldLabel:_("Color"),overflowText:_("Color"),ref:"colorCombo",cls:"tb-notes-combo-color",store:{xtype:"arraystore",fields:["icon_index","name"],data:[[768,_("Blue")],[769,_("Green")],[770,_("Pink")],[771,_("Yellow")],[772,_("White")]]},displayField:"name",
valueField:"icon_index",mode:"local",editable:!1,triggerAction:"all",listeners:{select:this.onComboSelect,scope:this},plugins:["zarafa.fieldlabeler"]}]},onSaveButton:function(){this.dialog.saveRecord()},onDeleteButton:function(){this.dialog.deleteRecord()},onComboSelect:function(a,b,c){this.record.set("icon_index",b.get("icon_index"));a=Zarafa.core.mapi.NoteColor.getColorValue(b.get("icon_index"));this.record.set("color",a)},onOpenCategories:function(){Zarafa.common.Actions.openCategoriesContent(this.record,
{autoSave:!1})},onPrintRecord:function(){Zarafa.common.Actions.openPrintDialog(this.record)},update:function(a,b){this.record=a;a.isSubMessage()?(this.deleteBtn.setVisible(!1),this.saveBtn.setVisible(!1)):(this.saveBtn.setVisible(!0),this.deleteBtn.setDisabled(!0===a.phantom));this.colorCombo.setValue(a.get("icon_index"));this.doLayout()},updateRecord:function(a){a.set("icon_index",this.colorCombo.getValue())}});Ext.reg("zarafa.noteedittoolbar",Zarafa.note.dialogs.NoteEditToolbar);Ext.namespace("Zarafa.note.printer");
Zarafa.note.printer.NoteRenderer=Ext.extend(Zarafa.common.printer.renderers.RecordRenderer,{generateBodyTemplate:function(a){var b;b="<b>{fullname:htmlEncode}</b>\n<hr>\n<table>\n"+this.addRow(_("Modified"),'{last_modification_time:date("'+_("l jS F Y G:i")+'")}');b+=this.optionalRow(_("Categories"),"categories","{categories:htmlEncode}");b=b+"</table><br><p>\n"+a.getBody(!0);return b+"</p>\n"}});Ext.namespace("Zarafa.note.ui");
Zarafa.note.ui.NoteGrid=Ext.extend(Zarafa.common.ui.grid.MapiMessageGrid,{context:void 0,model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);Ext.applyIf(a,{id:"note-gridview",border:!1,autoExpandColumn:"subject",stateful:!0,statefulRelativeDimensions:!1,loadMask:this.initLoadMask(),viewConfig:this.initViewConfig(),
selModel:this.initSelectionModel(),colModel:this.initColumnModel(),enableDragDrop:!0,ddGroup:"dd.mapiitem"});Zarafa.note.ui.NoteGrid.superclass.constructor.call(this,a)},initViewConfig:function(){return{}},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!1,listeners:{scope:this,selectionchange:this.onSelectionChange}})},initColumnModel:function(){return new Zarafa.note.ui.NoteGridColumnModel},getMainPanel:function(){return this.ownerCt},initLoadMask:function(){return{msg:_("Loading Notes")+
"..."}},initEvents:function(){Zarafa.note.ui.NoteGrid.superclass.initEvents.call(this);this.on({rowdblclick:this.onNoteRowDblClick,scope:this})},onNoteRowDblClick:function(a,b,c){Zarafa.note.Actions.openNoteContent(a.getSelectionModel().getSelected())},onSelectionChange:function(a){this.model.setSelectedRecords(a.getSelections())}});Ext.reg("zarafa.notegrid",Zarafa.note.ui.NoteGrid);Ext.namespace("Zarafa.settings");
Zarafa.settings.SettingsContextModel=Ext.extend(Zarafa.core.ContextModel,{realModel:void 0,editModel:void 0,setlist:void 0,dellist:void 0,dirty:!1,constructor:function(a){a=a||{};this.realModel=container.getSettingsModel();this.editModel=new Zarafa.settings.SettingsModel({autoSave:!1});Ext.applyIf(a,{stateful:!1});this.addEvents("beforesavesettings","savesettings","discardsettings");Zarafa.settings.SettingsContextModel.superclass.constructor.call(this,a);this.editModel.on({set:this.onSetSetting,remove:this.onRemoveSetting,
scope:this})},enable:function(a,b){Zarafa.settings.SettingsContextModel.superclass.enable.apply(this,arguments);var c=this.realModel.get(void 0,!0);this.editModel.initialize(c)},disable:Ext.emptyFn,getEditableSettingsModel:function(){return this.editModel},getRealSettingsModel:function(){return this.realModel},hasChanges:function(){return this.dirty},setDirty:function(){this.dirty=!0},applyChanges:function(){if(!1!==this.fireEvent("beforesavesettings",this,this.editModel)&&this.hasChanges()){this.fireEvent("savesettings",
this,this.editModel);this.realModel.requiresReload=this.editModel.requiresReload;this.realModel.beginEdit();if(!Ext.isEmpty(this.setlist))for(var a=0,b=this.setlist.length;a<b;a++){var c=this.setlist[a];Ext.isDefined(c.value)&&this.realModel.set(c.path,c.value)}if(!Ext.isEmpty(this.dellist))for(a=0,b=this.dellist.length;a<b;a++)c=this.dellist[a],this.realModel.remove(c);this.realModel.endEdit();this.editModel.commit();this.dirty=!1;delete this.setlist;delete this.dellist}},discardChanges:function(){var a=
this.realModel.get(void 0,!0);this.editModel.initialize(a);this.editModel.commit();this.dirty=!1;delete this.setlist;delete this.dellist;this.fireEvent("discardsettings",this,this.editModel)},setFolders:Ext.emptyFn,onSetSetting:function(a,b){this.dirty=!0;this.setlist=Ext.value(this.setlist,[]);this.setlist=this.setlist.concat(b)},onRemoveSetting:function(a,b){this.dirty=!0;this.dellist=Ext.value(this.dellist,[]);this.dellist=this.dellist.concat(b)}});Ext.namespace("Zarafa.settings.ui");
Zarafa.settings.ui.SettingsTreePanel=Ext.extend(Zarafa.common.ui.EditorTreeGrid,{editors:void 0,model:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.editortreegrid",ref:"treeGrid",border:!1,rootVisible:!0,enableHdMenu:!1,enableSort:!0,forceFit:!0,loader:new Zarafa.settings.data.SettingsTreeLoader({model:a.model,autoExpandLevel:4,autoExpandFilter:/^\/*(zarafa.*)?$/}),root:new Zarafa.settings.ui.SettingsTreeNode({text:_("Settings"),id:"/",expanded:!1}),editors:{"boolean":{xtype:"checkbox"},
number:{xtype:"zarafa.spinnerfield",plugins:["zarafa.numberspinner"]},string:{xtype:"textfield"}},columns:[{id:"setting",header:_("Setting"),dataIndex:"text",tpl:"{text:htmlEncodeUndef}"},{id:"value",header:_("Value"),dataIndex:"value",tpl:"{value:htmlEncodeUndef}",width:250,editable:!0}]});Zarafa.settings.ui.SettingsTreePanel.superclass.constructor.call(this,a)},initEvents:function(){Zarafa.settings.ui.SettingsTreePanel.superclass.initEvents.call(this);this.on("afteredit",this.onAfterEdit,this);
this.on("contextmenu",this.onContextMenu,this);this.model&&this.bindModel(this.model,!0)},bindModel:function(a,b){if(b||this.model!==a){if(this.model&&(this.mun(this.model,"set",this.onSettingsChange,this),this.mun(this.model,"remove",this.onSettingsRemove,this),this.root.collapse()),this.model=a)this.loader.bindModel(this.model),this.mon(this.model,{set:this.onSettingsChange,remove:this.onSettingsRemove,scope:this}),this.root.expand()}else this.root.reload()},onSettingsChange:function(a,b){Array.isArray(b)||
(b=[b]);for(var c=0,d=b.length;c<d;c++){var e=b[c],f=this.getNodeById(e.path);f?f.attributes.value!==e.value&&this.rendered&&f.setValue(e.value):(f=e.path.lastIndexOf("/"),e=e.path.substring(0,f)||"/",(e=this.getNodeById(e))&&e.isLoaded()&&e.reload())}},onSettingsRemove:function(a,b){Array.isArray(b)||(b=[b]);for(var c=0,d=b.length;c<d;c++){var e=this.getNodeById(b[c]);e&&e.remove(!0)}},onAfterEdit:function(a,b,c,d){this.model.set(b.id,d)},onContextMenu:function(a,b){a.select();Zarafa.core.data.UIFactory.openDefaultContextMenu(a,
{position:b.getXY(),settingsModel:this.model})},getEditor:function(a,b){var c=this.getColumn(b).dataIndex,c=typeof a.attributes[c];if(Ext.isDefined(this.editors[c]))return Ext.create(this.editors[c]);Ext.MessageBox.show({title:_("Kopano WebApp"),msg:String.format(_("The setting '{0}' can not be edited"),Ext.util.Format.htmlEncode(a.text)),icon:Ext.MessageBox.WARNING,buttons:Ext.MessageBox.OK})},onDestroy:function(){Zarafa.settings.ui.SettingsTreePanel.superclass.onDestroy.call(this);for(var a in this.editors){var b=
this.editors[a];Ext.isFunction(b.destroy)&&b.destroy()}}});Ext.reg("zarafa.settingstreepanel",Zarafa.settings.ui.SettingsTreePanel);Ext.namespace("Zarafa.task");
Zarafa.task.TaskContextModel=Ext.extend(Zarafa.core.ContextModel,{oldDataMode:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.task.TaskStore);Ext.applyIf(a,{statefulRecordSelection:!0,current_data_mode:Zarafa.task.data.DataModes.ALL});Zarafa.task.TaskContextModel.superclass.constructor.call(this,a);this.on({searchstart:this.onSearchStart,searchstop:this.onSearchStop,scope:this})},createRecord:function(a){a=a||this.getDefaultFolder();a.isTodoListFolder()&&(a=container.getHierarchyStore().getDefaultFolderFromMessageClass("IPM.Task"));
var b=a.getMAPIStore();return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Task",{store_entryid:a.get("store_entryid"),parent_entryid:a.get("entryid"),icon_index:Zarafa.core.mapi.IconIndex.task_normal,owner:b.isPublicStore()?container.getUser().getFullName():b.get("mailbox_owner_name")})},onDataModeChange:function(a,b,c){Zarafa.task.TaskContextModel.superclass.onDataModeChange.call(this,a,b,c);b!==c&&c===Zarafa.task.data.DataModes.SEARCH&&this.stopSearch();a=[];switch(b){case Zarafa.task.data.DataModes.SEARCH:this.store.clearFilter();
break;case Zarafa.task.data.DataModes.ALL:this.store.clearFilter();break;case Zarafa.task.data.DataModes.ACTIVE:a=this.prepareRestriction("complete","RELOP_EQ",!1);break;case Zarafa.task.data.DataModes.NEXT_7_DAYS:b=(new Date).clearTime();a=b.clone().add(Date.DAY,7);a=Zarafa.core.data.RestrictionFactory.createResAnd([this.prepareRestriction("duedate","RELOP_GT",b.getTime()/1E3),this.prepareRestriction("duedate","RELOP_LT",a.getTime()/1E3)]);break;case Zarafa.task.data.DataModes.OVERDUE:b=(new Date).clearTime();
a=Zarafa.core.data.RestrictionFactory.createResAnd([this.prepareRestriction("duedate","RELOP_LT",b.getTime()/1E3),this.prepareRestriction("complete","RELOP_EQ",!1)]);break;case Zarafa.task.data.DataModes.COMPLETED:a=this.prepareRestriction("complete","RELOP_EQ",!0)}this.load({params:{restriction:{task:a}}})},prepareRestriction:function(a,b,c){return Zarafa.core.data.RestrictionFactory.dataResProperty(a,Zarafa.core.mapi.Restrictions[b],c)},onSearchStart:function(a){this.getCurrentDataMode()!=Zarafa.task.data.DataModes.SEARCH&&
(this.oldDataMode=this.getCurrentDataMode(),this.setDataMode(Zarafa.task.data.DataModes.SEARCH))},onSearchStop:function(a){this.getCurrentDataMode()===Zarafa.task.data.DataModes.SEARCH&&this.setDataMode(this.oldDataMode);delete this.oldDataMode},onHierarchyLoad:function(a){if(0!==a.getCount()){if(Ext.isEmpty(this.last_used_folders)){var b=a.getDefaultFolder("todolist");if(b){var c=b.get("entryid"),b=b.get("store_entryid");this.last_used_folders={};this.last_used_folders[b]=[c]}}Zarafa.task.TaskContextModel.superclass.onHierarchyLoad.call(this,
a)}}});Ext.namespace("Zarafa.task.data");
Zarafa.task.data.TaskStatus={status:[{value:Zarafa.core.mapi.TaskStatus.NOT_STARTED,name:Zarafa.core.mapi.TaskStatus.getDisplayName(Zarafa.core.mapi.TaskStatus.NOT_STARTED)},{value:Zarafa.core.mapi.TaskStatus.IN_PROGRESS,name:Zarafa.core.mapi.TaskStatus.getDisplayName(Zarafa.core.mapi.TaskStatus.IN_PROGRESS)},{value:Zarafa.core.mapi.TaskStatus.COMPLETE,name:Zarafa.core.mapi.TaskStatus.getDisplayName(Zarafa.core.mapi.TaskStatus.COMPLETE)},{value:Zarafa.core.mapi.TaskStatus.WAIT_FOR_OTHER_PERSON,name:Zarafa.core.mapi.TaskStatus.getDisplayName(Zarafa.core.mapi.TaskStatus.WAIT_FOR_OTHER_PERSON)},
{value:Zarafa.core.mapi.TaskStatus.DEFERRED,name:Zarafa.core.mapi.TaskStatus.getDisplayName(Zarafa.core.mapi.TaskStatus.DEFERRED)}]};Ext.namespace("Zarafa.task.data");Zarafa.task.data.TodoTaskListNotificationResponseHandler=Ext.extend(Zarafa.core.data.AbstractNotificationResponseHandler,{doNewtodotask:function(a){var b=[];Ext.pluck(a.item,"entryid").forEach(function(a){b.push(container.getHierarchyStore().getFolder(a))});this.addNotification(Zarafa.core.data.Notifications.objectCreated,b,null)}});
Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.TaskToolbar=Ext.extend(Zarafa.core.ui.ContentPanelToolbar,{constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");Ext.applyIf(a,{insertionPointBase:"context.task.taskcontentpanel",actionItems:this.createActionButtons(),optionItems:this.createOptionButtons()});Zarafa.task.dialogs.TaskToolbar.superclass.constructor.call(this,a)},createActionButtons:function(){return[{xtype:"button",text:_("Send"),overflowText:_("Send task to assignees"),
tooltip:{title:_("Send assignment"),text:_("Send task to assignees")+" (Ctrl + ENTER)"},cls:"zarafa-action",iconCls:"buttons-icon_send_white",ref:"sendBtn",handler:this.onSendTask,scope:this},{xtype:"button",overflowText:_("Save"),tooltip:{title:_("Save"),text:_("Save without sending a task request to assignees")+" (Ctrl + S)"},iconCls:"icon_saveEmail",ref:"saveTaskRequest",handler:this.onSave,scope:this},{xtype:"button",ref:"saveBtn",text:_("Save"),overflowText:_("Save task"),tooltip:{title:_("Save & Close"),
text:_("Save task and close dialog")+" (Ctrl + S)"},cls:"zarafa-action",iconCls:"buttons-icon_save_white",handler:this.onSave,scope:this},{xtype:"button",ref:"restoreToTaskList",text:_("Restore to Task List"),overflowText:_("Restore to Task List"),hidden:!0,handler:this.onRestoreToTaskList,tooltip:{title:_("Restore to Task List"),text:_("Restore this item to your task list")},scope:this},{xtype:"button",ref:"deleteBtn",overflowText:_("Delete"),tooltip:{title:_("Delete"),text:_("Delete this task")},
iconCls:"icon_delete",handler:this.onDelete,scope:this},{xtype:"zarafa.attachmentbutton",plugins:["zarafa.recordcomponentupdaterplugin"],overflowText:_("Add Attachment"),tooltip:{title:_("Add attachment"),text:_("Add attachments to this task")},iconCls:"icon_attachment",ref:"attachmentButton",listeners:{added:this.onAttachmentButtonAdded,scope:this}},{xtype:"zarafa.taskrequestbuttons"},{xtype:"button",ref:"markCompleteBtn",overflowText:_("Mark as Complete"),tooltip:{title:_("Mark as Complete"),text:_("Mark this task as complete")},
iconCls:"icon_task_complete",handler:this.onComplete,scope:this},{xtype:"button",overflowText:_("Print"),ref:"printBtn",tooltip:{title:_("Print"),text:_("Print this task")},iconCls:"icon_print",handler:this.onPrint,scope:this},{xtype:"button",overflowText:_("Check names"),tooltip:{title:_("Check names"),text:_("Check all recipient names")},iconCls:"icon_checkNames",ref:"checkNamesBtn",handler:this.onCheckNames,scope:this}]},onAttachmentButtonAdded:function(a){a.isXType("menuitem")&&(a.update=Zarafa.common.attachment.ui.AttachmentButton.prototype.update.createDelegate(this.attachmentButton))},
createOptionButtons:function(){return[{xtype:"button",text:_("Assign Task"),overflowText:_("Assign Task"),tooltip:{title:_("Assign Task"),text:_("Assign this task to someone else.")},iconCls:"icon_invite_attendees",ref:"assignTask",handler:this.onAssignment,scope:this},{xtype:"button",text:_("Cancel Assignment"),tooltip:{title:_("Cancel Assignment"),text:_("Convert this task request to a regular task by removing assignees.")},overflowText:_("Cancel Assignment"),iconCls:"icon_cancel_meeting_request",
ref:"cancelAssignmetBtn",handler:this.onCancelAssignment,scope:this},{xtype:"button",overflowText:_("Categories"),tooltip:{title:_("Categories"),text:_("Open the categories dialog")},ref:"categoriesBtn",iconCls:"icon_categories",handler:this.onCategories,scope:this},{xtype:"button",overflowText:_("Private"),tooltip:{title:_("Private"),text:_("Mark this task as private")},iconCls:"icon_private",ref:"setPrivate",enableToggle:!0,toggleHandler:this.onPrivateGroupToggle,scope:this},{xtype:"button",overflowText:_("Set flag"),
tooltip:{title:_("Set flag"),text:_("Set flag on this email")},ref:"setFlags",iconCls:"icon_flag_red",handler:this.onSetFlagButton,scope:this}]},onSave:function(a){this.dialog.saveRecord()},onCheckNames:function(a){this.record.getRecipientStore().resolve(void 0,{cancelPreviousRequest:!0})},onRecurrence:function(a){Zarafa.common.Actions.openRecurrenceContent(this.record,!1)},onSetFlagButton:function(a,b){var c={position:b.getXY(),shadowEdit:!1,saveOnSetFlag:!1};Zarafa.task.Actions.openFlagsMenu(this.record,
c)},onAssignment:function(a){this.record.beginEdit();this.record.set("taskstate",Zarafa.core.mapi.TaskState.OWNER_NEW);this.record.set("taskmode",Zarafa.core.mapi.TaskMode.REQUEST);this.record.endEdit()},onCancelAssignment:function(a){this.record.beginEdit();this.record.set("taskstate",Zarafa.core.mapi.TaskState.NORMAL);this.record.set("taskmode",Zarafa.core.mapi.TaskMode.NOTHING);this.record.endEdit()},onComplete:function(a){this.record.beginEdit();this.record.set("complete",!0);this.record.set("percent_complete",
1);this.record.set("status",Zarafa.core.mapi.TaskStatus.COMPLETE);this.record.set("date_completed",new Date);this.record.set("flag_icon",Zarafa.core.mapi.FlagIcon.red);this.record.set("flag_complete_time",new Date);this.record.set("flag_request","");this.record.set("flag_status",Zarafa.core.mapi.FlagStatus.completed);this.record.endEdit();this.dialog.saveRecord()},onRestoreToTaskList:function(a){a=this.record;a.beginEdit();a.addMessageAction("action_type","restoreToTaskList");a.set("taskstate",Zarafa.core.mapi.TaskState.OWNER_NEW);
a.set("taskmode",Zarafa.core.mapi.TaskMode.NOTHING);a.set("taskhistory",Zarafa.core.mapi.TaskHistory.NONE);a.set("ownership",Zarafa.core.mapi.TaskOwnership.NEWTASK);a.set("icon_index",Zarafa.core.mapi.IconIndex.task_normal);a.set("updatecount",2);a.set("taskfcreator",!0);a.set("tasklastdelegate","");a.set("tasklastuser","");a.set("subject",a.get("conversation_topic"));var b=container.getHierarchyStore().getById(a.get("store_entryid"));b&&a.set("owner",b.get("display_name"));a.getRecipientStore().removeAll();
a.endEdit();a.save()},onCategories:function(a){Zarafa.common.Actions.openCategoriesContent(this.record,{autoSave:!1})},onDelete:function(a){this.dialog.deleteRecord()},onPrint:function(){Zarafa.common.Actions.openPrintDialog(this.record)},onPrivateGroupToggle:function(a){this.record.beginEdit();this.record.set("private",a.pressed);a.pressed?this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.PRIVATE):this.record.set("sensitivity",Zarafa.core.mapi.Sensitivity.NONE);this.record.endEdit()},update:function(a,
b){var c=!1;this.record=a;if(a.isSubMessage())this.deleteBtn.setVisible(!1),this.sendBtn.setVisible(!1),this.saveTaskRequest.setVisible(!1),this.saveBtn.setVisible(!1),this.checkNamesBtn.setVisible(!1),this.restoreToTaskList.setVisible(!1),this.assignTask.setVisible(!1),this.cancelAssignmetBtn.setVisible(!1),this.markCompleteBtn.setVisible(!1),this.setPrivate.setVisible(!1),c=!0;else{var d=a.isTaskReceived()&&a.isTaskOwner()&&!a.isTaskAccepted()&&!a.isTaskUpdated(),e=a.get("taskstate")===Zarafa.core.mapi.TaskState.DECLINE,
f=a.isTaskDelegated(),g=a.isModified("taskmode");this.saveBtn.setVisible(!f&&!e&&!d&&!a.isTaskRequest());if(!g){var h=!1;if(a.isTaskReceived())if(a.get("task_not_found"))h=!1;else{if(a.isTaskAccepted()||a.isTaskUpdated())h=!0}else if(a.isDraftAssignedTask()||a.isNormalTask())h=!0;this.setFlags.setVisible(h);this.categoriesBtn.setVisible(h);this.markCompleteBtn.setVisible(h);this.setPrivate.setVisible(h);this.attachmentButton.setVisible(h);this.printBtn.setVisible(!d)}this.restoreToTaskList.setVisible(a.isTaskOrganized()&&
e);this.restoreToTaskList.isVisible()&&this.restoreToTaskList.getEl().addClass("zarafa-action");d?this.deleteBtn.setVisible(f):this.deleteBtn.setDisabled(!0===a.phantom);(!0===b||a.isModifiedSinceLastUpdate("complete"))&&this.markCompleteBtn.setDisabled(a.get("complete"));(!0===b||a.isModifiedSinceLastUpdate("private"))&&this.setPrivate.toggle(a.get("private"),!0);if(!0===b||g){switch(a.get("taskmode")){case Zarafa.core.mapi.TaskMode.REQUEST:c=a instanceof Zarafa.task.TaskRequestRecord;c=!a.isTaskDelegated()&&
!c||a.get("taskstate")===Zarafa.core.mapi.TaskState.OWNER_NEW;this.sendBtn.setVisible(c);this.saveTaskRequest.setVisible(c);this.saveBtn.setVisible(!1);this.checkNamesBtn.setVisible(c);this.assignTask.setVisible(!1);this.cancelAssignmetBtn.setVisible(c);break;default:this.sendBtn.setVisible(!1),this.saveTaskRequest.setVisible(!1),this.checkNamesBtn.setVisible(!1),this.assignTask.setVisible(a.isNormalTask()),this.cancelAssignmetBtn.setVisible(!1)}c=!0}!b&&a.isModifiedSinceLastUpdate("taskmode")&&(c=
!0);!b&&a.isModifiedSinceLastUpdate("taskhistory")&&a.get("taskhistory")===Zarafa.core.mapi.TaskHistory.NONE&&this.assignTask.setVisible(a.isNormalTask())}c&&this.doLayout()},onSendTask:function(a){this.dialog.sendRecord()}});Ext.reg("zarafa.tasktoolbar",Zarafa.task.dialogs.TaskToolbar);Ext.namespace("Zarafa.task.printer");
Zarafa.task.printer.TaskRenderer=Ext.extend(Zarafa.common.printer.renderers.RecordRenderer,{generateBodyTemplate:function(a){var b;b="<b>{fullname:htmlEncode}</b>\n<hr>\n<table>\n"+this.addRow(_("Subject"),"{subject:htmlEncode}");b+=this.optionalRow(_("Start"),"startdate",'{startdate:date("'+_("l d/m/Y")+'")}');b+=this.optionalRow(_("Due"),"duedate",'{duedate:date("'+_("l d/m/Y")+'")}');b+=this.optionalRow(_("Priority"),"importance","{importance:importanceString}");b+=this.addRow("","");b+=this.addRow(_("Status"),
"{status:taskStatusString}");b+=this.addRow(_("Percent complete"),"{percent_complete:percentage(0)}");b+=this.addRow("","");b+=this.addRow(_("Total work"),_("{totalwork} hours"));b+=this.addRow(_("Actual work"),_("{actualwork} hours"));b+=this.addRow("","");b+=this.optionalRow(_("Recurrence pattern"),"recurring_pattern","{recurring_pattern:htmlEncode}");b+=this.optionalRow("","recurring_pattern","");b+=this.addRow(_("Owner"),"{owner:htmlEncode}");b+=this.addRow("","");b+=this.optionalRow(_("Categories"),
"categories","{categories:htmlEncode}");b+=this.optionalRow(_("Attachments"),"attachment_names","{attachment_names:htmlEncode}");b=b+"</table><br><p>\n"+a.getBody(!0);return b+"</p>\n"}});Ext.namespace("Zarafa.common.flags.ui");
Zarafa.task.ui.TaskFlagsMenu=Ext.extend(Zarafa.common.flags.ui.FlagsMenu,{saveOnSetFlag:!0,action:void 0,constructor:function(a){a=Ext.applyIf(a||{},{xtype:"zarafa.taskflagsmenu"});Zarafa.task.ui.TaskFlagsMenu.superclass.constructor.call(this,a)},setFlag:function(a){this.action=a.action;Zarafa.task.ui.TaskFlagsMenu.superclass.setFlag.apply(this,arguments)},setFlagProperties:function(a,b){a.forEach(function(a){a.beginEdit();for(var c in b)"startdate"!==c&&"duedate"!==c&&"reminder_time"!==c&&a.set(c,
b[c]);"complete"===this.action?(a.set("percent_complete",1),a.set("status",Zarafa.core.mapi.TaskStatus.COMPLETE)):a.get("complete")&&(a.set("complete",!1),a.set("percent_complete",0),a.set("status",Zarafa.core.mapi.TaskStatus.NOT_STARTED));c=b.startdate;var e=b.duedate;Ext.isDate(c)&&Ext.isDate(e)?(c=c.clearTime(),e=e.clearTime(),a.set("startdate",c.fromUTC()),a.set("commonstart",c.clone()),a.set("duedate",e.fromUTC()),a.set("commonend",e.clone())):"complete"!==this.action&&(a.set("startdate",c),
a.set("commonstart",c),a.set("duedate",e),a.set("commonend",e));a.endEdit();this.saveOnSetFlag&&(a.isMessageClass("IPM.Task")&&!a.isNormalTask()?a.respondToTaskRequest(Zarafa.core.mapi.TaskMode.UPDATE):a.save())},this)}});Ext.reg("zarafa.taskflagsmenu",Zarafa.task.ui.TaskFlagsMenu);Ext.namespace("Zarafa.task.ui");
Zarafa.task.ui.TaskGridView=Ext.extend(Zarafa.common.ui.grid.MapiMessageGrid,{model:void 0,constructor:function(a){a=a||{};!Ext.isDefined(a.model)&&Ext.isDefined(a.context)&&(a.model=a.context.getModel());!Ext.isDefined(a.store)&&Ext.isDefined(a.model)&&(a.store=a.model.getStore());a.store=Ext.StoreMgr.lookup(a.store);Ext.applyIf(a,{xtype:"zarafa.taskgrid",border:!1,stateful:!0,statefulRelativeDimensions:!1,loadMask:this.initLoadMask(),viewConfig:this.initViewConfig(),selModel:this.initSelectionModel(),
colModel:this.initColumnModel(a.model),enableDragDrop:!0,ddGroup:"dd.mapiitem"});Zarafa.task.ui.TaskGridView.superclass.constructor.call(this,a)},initViewConfig:function(){return{autoExpandColumn:"subject",enableRowBody:!1,getRowClass:this.viewConfigGetRowClass}},initLoadMask:function(){return{msg:_("Loading tasks")+"..."}},initColumnModel:function(a){return new Zarafa.task.ui.TaskGridColumnModel({model:a})},initSelectionModel:function(){return new Ext.grid.RowSelectionModel({singleSelect:!1,listeners:{scope:this,
selectionchange:this.onSelectionChange}})},initEvents:function(){Zarafa.task.ui.TaskGridView.superclass.initEvents.call(this);this.on({cellclick:this.onCellClick,rowdblclick:this.onRowDblClick,scope:this});this.mon(this.context,"viewmodechange",this.onContextViewModeChange,this);this.onContextViewModeChange(this.context,this.context.getCurrentViewMode());this.mon(this.getStore(),"update",this.onStoreUpdate,this)},onCellClick:function(a,b,c,d){a=this.store.getAt(b);Ext.isDefined(a)&&(c=this.getColumnModel().config[c],
b=a.isMessageClass("IPM.Task",!0)&&(a.isTaskOrganized()||a.isTaskNotResponded()),"flag_due_by"!==c.dataIndex||b||Zarafa.task.Actions.openFlagsMenu(a,{position:d.getXY()}))},onRowDblClick:function(a,b,c){Zarafa.common.Actions.openMessageContent(this.getSelectionModel().getSelected())},onStoreUpdate:function(a,b){var c=container.getHierarchyStore().getDefaultFolder("todolist").get("entryid");Zarafa.core.EntryId.compareEntryIds(c,a.entryId)&&b.modified&&(b.isModified("flag_due_by")||b.isModified("flag_request"))&&
a.reload()},onSelectionChange:function(a){this.model.setSelectedRecords(a.getSelections())},viewConfigGetRowClass:function(a,b,c,d){b="";c=a instanceof Zarafa.task.TaskRecord?a.get("complete"):a.get("flag_status")===Zarafa.core.mapi.FlagStatus.completed;a=a.get("duedate");Ext.isDate(a)&&a.getTime()<(new Date).getTime()&&(b+="zarafa-task-overdue ");c&&(b+="zarafa-task-complete ");return b},onContextViewModeChange:function(a,b,c){switch(b){case Zarafa.task.data.ViewModes.SIMPLE:this.getColumnModel().setSimpleView(!0);
break;case Zarafa.task.data.ViewModes.DETAILED:this.getColumnModel().setSimpleView(!1)}}});Ext.reg("zarafa.taskgrid",Zarafa.task.ui.TaskGridView);Ext.namespace("Zarafa.today");
Zarafa.today.TodayContextModel=Ext.extend(Zarafa.core.ContextModel,{constructor:function(a){a=a||{};Ext.applyIf(a,{stateful:!1});Zarafa.today.TodayContextModel.superclass.constructor.call(this,a)},disable:Ext.emptyFn,setFolders:Ext.emptyFn,getDefaultFolder:function(){if(!this.defaultFolder){var a=container.getHierarchyStore().getDefaultStore();a&&(this.defaultFolder=a.getSubtreeFolder())}return this.defaultFolder}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMRecipientStore=Ext.extend(Zarafa.core.data.MAPISubStore,{resolveProxy:void 0,resolveReader:void 0,autoResolve:!0,customObjectType:Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,allowResolvingToLocalContacts:!0,allowResolvingToGABGroups:!0,expandProxy:void 0,expandReader:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{writer:new Zarafa.core.data.JsonRecipientWriter,reader:new Zarafa.core.data.JsonRecipientReader({customObjectType:a.customObjectType||this.customObjectType})});
this.addEvents("beforeresolve","resolved","exception");Zarafa.core.data.IPMRecipientStore.superclass.constructor.call(this,a);this.resolveProxy=new Zarafa.core.data.IPMRecipientResolveProxy;this.expandProxy=new Zarafa.core.data.IPMExpandDistlistProxy;this.relayEvents(this.resolveProxy,["exception"]);this.resolveReader=new Ext.data.JsonReader({root:"result"},Zarafa.core.data.IPMRecipientResolveRecord);this.expandReader=new Zarafa.core.data.JsonReader({root:"result",id:"entryid",dynamicRecord:!1},Zarafa.core.data.IPMExpandDistlistRecord);
this.on({add:this.onRecipientAdd,update:this.onRecipientUpdate,exception:this.onResolveException,scope:this})},parseRecipient:function(a,b){var c=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(this.customObjectType),d=a.indexOf("<"),e=a.indexOf(">");if(-1!=d&&-1==e||-1==d&&-1!=e)return null;c.beginEdit();-1!=d?(c.set("display_name",a.substring(0,d).trim()),c.set("smtp_address",a.substring(d+1,e).trim())):(c.set("display_name",a),Zarafa.core.Util.validateEmailAddress(a)?(c.set("smtp_address",
a),c.set("object_type",Zarafa.core.mapi.ObjectType.MAPI_MAILUSER)):c.set("smtp_address",""));c.set("recipient_type",b||Zarafa.core.mapi.RecipientType.MAPI_TO);c.endEdit();return c},getResolvedRecipients:function(a){var b=[];a=a||this.data.items;for(var c=0,d=a.length;c<d;c++){var e=a[c];e.isResolved()&&b.push(e)}return b},getUnresolvedRecipients:function(a){var b=[];a=a||this.data.items;for(var c=0,d=a.length;c<d;c++){var e=a[c];e.isResolved()||e.attemptedToResolve()&&!e.isAmbiguous()||b.push(e)}return b},
getInvalidRecipients:function(a){var b=[];a=a||this.data.items;for(var c=0,d=a.length;c<d;c++){var e=a[c];e.isResolved()||!e.attemptedToResolve()||e.isValidSMTP()||b.push(e)}return b},resolve:function(a,b){Ext.isDefined(a)&&!Array.isArray(a)&&(a=[a]);a=this.getUnresolvedRecipients(a);if(0!==a.length){for(var c=[],d=[],e=0;e<a.length;e++){var f=a[e],g=f.get("display_name").trim(),h=f.get("smtp_address").trim(),k=f.get("address_type"),l=f.get("email_address");Ext.isEmpty(l)||(l=l.trim());Ext.isEmpty(l)&&
(l=Zarafa.core.Util.validateEmailAddress(h)?h:"");d.push({id:f.id,display_name:g,email_address:l,address_type:k});c.push(f)}d={resolverequests:d,exclude_local_contacts:!this.allowResolvingToLocalContacts,exclude_gab_groups:!this.allowResolvingToGABGroups};e=Ext.apply({},b,{actionType:Zarafa.core.Actions.checknames,listRequest:!0,pendingRecords:c,params:d});this.fireEvent("beforeresolve",this,c);this.resolveProxy.request(Zarafa.core.Actions.checknames,a,d,this.resolveReader,this.onCheckNamesResult,
this,e)}},onCheckNamesResult:function(a,b,c){Array.isArray(a)||(a=[a]);for(c=0;c<a.length;c++){var d=a[c];if(!Ext.isEmpty(d.id)){var e=this.getById(d.id);if(!e)break;1==d.result.totalRecords?e.applyResolveRecord(d.result.records[0],!0):1<d.result.totalRecords&&(e.resolveAttemptAmbiguous=!0,Zarafa.common.Actions.openCheckNamesContent(d.result.records,e));e.resolveAttempted=!0}}this.fireEvent("resolved",this,b.pendingRecords)},expand:function(a,b,c){b={entryid:a.get("entryid"),recurse:b||!1};c=Ext.apply({},
c,{actionType:Zarafa.core.Actions.expand,listRequest:!0,recipientType:a.get("recipient_type"),params:b});this.expandProxy.request(Zarafa.core.Actions.expand,a,b,this.expandReader,this.onExpandResult,this,c)},onExpandResult:function(a,b,c){if(c){Array.isArray(a)||(a=[a]);c=[];for(var d=0;d<a.length;d++){var e=a[d];Ext.isEmpty(e)||c.push(e.convertToRecipient(b.recipientType))}this.add(c)}},onRecipientAdd:function(a,b){this.autoResolve&&Ext.each(b,function(a){if(a.dirty)return this.resolve(b),!1},this)},
onRecipientUpdate:function(a,b){if(this.autoResolve){var c=[];Array.isArray(b)||(b=[b]);Ext.each(b,function(a){a.isModified()&&c.push(a)});this.resolve(c)}},onResolveException:function(a,b,c,d,e){this.fireEvent("resolved",this,d.pendingRecords)},hasBccRecipients:function(a){var b=!1;a=a||this.data.items;for(var c=0,d=a.length;c<d;c++)if(a[c].get("recipient_type")===Zarafa.core.mapi.RecipientType.MAPI_BCC){b=!0;break}return b}});Ext.namespace("Zarafa.core.themes");
Zarafa.core.themes.ThemeDark=Ext.extend(Zarafa.core.ThemePlugin,{});Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"dark",displayName:_("Dark"),allowUserDisable:!1,allowUserVisible:!1,pluginConstructor:Zarafa.core.themes.ThemeDark}))});Ext.namespace("Zarafa.core.themes");Zarafa.core.themes.ThemeHighContrast=Ext.extend(Zarafa.core.ThemePlugin,{});
Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"highcontrast",displayName:_("High Contrast"),allowUserDisable:!1,allowUserVisible:!1,pluginConstructor:Zarafa.core.themes.ThemeHighContrast}))});Ext.namespace("Zarafa.core.themes");Zarafa.core.themes.ThemeLime=Ext.extend(Zarafa.core.ThemePlugin,{isCorePlugin:!0});
Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"lime",displayName:_("Lime"),allowUserDisable:!1,allowUserVisible:!1,pluginConstructor:Zarafa.core.themes.ThemeLime}))});Ext.namespace("Zarafa.core.themes");Zarafa.core.themes.ThemeOrange=Ext.extend(Zarafa.core.ThemePlugin,{});Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"orange",displayName:_("Orange"),allowUserDisable:!1,allowUserVisible:!1,pluginConstructor:Zarafa.core.themes.ThemeOrange}))});
Ext.namespace("Zarafa.core.themes");Zarafa.core.themes.ThemePurple=Ext.extend(Zarafa.core.ThemePlugin,{});Zarafa.onReady(function(){container.registerPlugin(new Zarafa.core.PluginMetaData({name:"purple",displayName:_("Purple"),allowUserDisable:!1,allowUserVisible:!1,pluginConstructor:Zarafa.core.themes.ThemePurple}))});Ext.namespace("Zarafa.common");
Zarafa.common.CommonContext=Ext.extend(Zarafa.core.Context,{constructor:function(a){a=a||{};Ext.applyIf(a,{hasToolbar:!1,hasContentPanel:!1});Zarafa.common.CommonContext.superclass.constructor.call(this,a);this.registerInsertionPoint("context.settings.categories",this.createDelegateSettingsCategory,this);this.registerInsertionPoint("context.settings.categories",this.createSendAsSettingsCategory,this);this.registerInsertionPoint("context.settings.categories",this.createRuleSettingsCategory,this);Zarafa.core.data.SharedComponentType.addProperty("common.dialog.copymoverecords");
Zarafa.core.data.SharedComponentType.addProperty("common.dialog.recurrence");Zarafa.core.data.SharedComponentType.addProperty("common.dialog.categories");Zarafa.core.data.SharedComponentType.addProperty("common.dialog.widgets");Zarafa.core.data.SharedComponentType.addProperty("common.dialog.checknames");Zarafa.core.data.SharedComponentType.addProperty("common.dialog.restoreitems");Zarafa.core.data.SharedComponentType.addProperty("common.dialog.reminder");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.previewpanel.extrainfo");
Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.importance");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.category");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.categories");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.freebusy");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.freebusy.timelinebody");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.freebusy.timelineheader");
Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.reminder.remindergrid");Zarafa.core.data.SharedComponentType.addProperty("common.contextmenu.flags");Zarafa.core.data.SharedComponentType.addProperty("common.printer.renderer");Zarafa.core.data.SharedComponentType.addProperty("common.rules.dialog.ruleswordsedit");Zarafa.core.data.SharedComponentType.addProperty("common.attachment.dialog.attachitem");Zarafa.core.data.SharedComponentType.addProperty("common.attachment.dialog.mixattachitem");
Zarafa.core.data.SharedComponentType.addProperty("common.attachment.dialog.attachitem.columnmodel");Zarafa.core.data.SharedComponentType.addProperty("common.attachment.dialog.attachitem.textrenderer");Zarafa.core.data.SharedComponentType.addProperty("common.attachment.dialog.importtofolder");Zarafa.core.data.SharedComponentType.addProperty("common.sendas.dialog.sendaseditcontentpanel");Zarafa.core.data.SharedComponentType.addProperty("common.categories.dialogs.newcategory");Zarafa.core.data.SharedComponentType.addProperty("common.categories.dialogs.renamecategory");
Zarafa.core.data.SharedComponentType.addProperty("common.flags.dialogs.customflag")},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.dialog.copymoverecords"]:case Zarafa.core.data.SharedComponentType["common.dialog.recurrence"]:case Zarafa.core.data.SharedComponentType["common.dialog.categories"]:case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem"]:case Zarafa.core.data.SharedComponentType["common.attachment.dialog.mixattachitem"]:case Zarafa.core.data.SharedComponentType["common.attachment.dialog.importtofolder"]:case Zarafa.core.data.SharedComponentType["common.dialog.widgets"]:case Zarafa.core.data.SharedComponentType["common.dialog.checknames"]:case Zarafa.core.data.SharedComponentType["common.dialog.restoreitems"]:case Zarafa.core.data.SharedComponentType["common.dialog.reminder"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.previewpanel.extrainfo"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy.timelinebody"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy.timelineheader"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.importance"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.category"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.flags"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.categories"]:case Zarafa.core.data.SharedComponentType["common.contextmenu.reminder.remindergrid"]:case Zarafa.core.data.SharedComponentType["common.rules.dialog.ruleswordsedit"]:case Zarafa.core.data.SharedComponentType["common.sendas.dialog.sendaseditcontentpanel"]:case Zarafa.core.data.SharedComponentType["common.categories.dialogs.newcategory"]:case Zarafa.core.data.SharedComponentType["common.categories.dialogs.renamecategory"]:case Zarafa.core.data.SharedComponentType["common.flags.dialogs.customflag"]:c=
1;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy"]:b instanceof Zarafa.core.data.IPMRecipientRecord&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:if(b instanceof Zarafa.core.data.IPMRecipientRecord||b instanceof Zarafa.core.data.IPMAttachmentRecord)c=1;break;case Zarafa.core.data.SharedComponentType["common.create"]:b instanceof Zarafa.core.data.IPMRecipientRecord?c=1:b instanceof Zarafa.common.delegates.data.DelegateRecord?c=1:b instanceof
Zarafa.common.rules.data.RulesRecord&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.view"]:b instanceof Zarafa.core.data.IPMRecipientRecord?c=1:b instanceof Zarafa.core.data.IPMAttachmentRecord&&(c=0)}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.dialog.copymoverecords"]:c=Zarafa.common.dialogs.CopyMoveContentPanel;break;case Zarafa.core.data.SharedComponentType["common.dialog.recurrence"]:c=Zarafa.common.recurrence.dialogs.RecurrenceContentPanel;
break;case Zarafa.core.data.SharedComponentType["common.dialog.categories"]:c=Zarafa.common.categories.dialogs.CategoriesContentPanel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem"]:c=Zarafa.common.attachment.dialogs.AttachItemContentPanel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.mixattachitem"]:c=Zarafa.common.attachment.dialogs.MixAttachItemContentPanel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.importtofolder"]:c=
Zarafa.common.attachment.dialogs.ImportToFolderContentPanel;break;case Zarafa.core.data.SharedComponentType["common.dialog.widgets"]:c=Zarafa.core.ui.widget.WidgetContentPanel;break;case Zarafa.core.data.SharedComponentType["common.dialog.checknames"]:c=Zarafa.common.checknames.dialogs.CheckNamesContentPanel;break;case Zarafa.core.data.SharedComponentType["common.dialog.restoreitems"]:c=Zarafa.common.restoreitem.dialogs.RestoreItemContentPanel;break;case Zarafa.core.data.SharedComponentType["common.dialog.reminder"]:c=
Zarafa.common.reminder.dialogs.ReminderContentPanel;break;case Zarafa.core.data.SharedComponentType["common.rules.dialog.ruleswordsedit"]:c=Zarafa.common.rules.dialogs.RulesWordsEditContentPanel;break;case Zarafa.core.data.SharedComponentType["common.sendas.dialog.sendaseditcontentpanel"]:c=Zarafa.common.sendas.dialogs.SendAsEditContentPanel;break;case Zarafa.core.data.SharedComponentType["common.create"]:b instanceof Zarafa.core.data.IPMRecipientRecord?c=Zarafa.common.recipientfield.ui.EditRecipientContentPanel:
b instanceof Zarafa.common.delegates.data.DelegateRecord?c=Zarafa.common.delegates.dialogs.DelegatePermissionContentPanel:b instanceof Zarafa.common.rules.data.RulesRecord&&(c=Zarafa.common.rules.dialogs.RulesEditContentPanel);break;case Zarafa.core.data.SharedComponentType["common.view"]:b instanceof Zarafa.core.data.IPMRecipientRecord?c=Zarafa.common.recipientfield.ui.ViewRecipientContentPanel:b instanceof Zarafa.core.data.IPMAttachmentRecord&&(c=this);break;case Zarafa.core.data.SharedComponentType["common.contextmenu.previewpanel.extrainfo"]:c=
Zarafa.common.ui.messagepanel.ExtraInfoContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy"]:c=Zarafa.common.freebusy.ui.FreebusyContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy.timelinebody"]:c=Zarafa.common.freebusy.ui.FreebusyTimelineBodyContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy.timelineheader"]:c=Zarafa.common.freebusy.ui.FreebusyTimelineHeaderContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof
Zarafa.core.data.IPMRecipientRecord?c=Zarafa.common.recipientfield.ui.RecipientContextMenu:b instanceof Zarafa.core.data.IPMAttachmentRecord&&(c=Zarafa.common.attachment.ui.AttachmentContextMenu);break;case Zarafa.core.data.SharedComponentType["common.contextmenu.importance"]:c=Zarafa.common.ui.ImportanceMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.category"]:c=Zarafa.common.categories.ui.CategoryContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.categories"]:c=
Zarafa.common.categories.ui.CategoriesContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.reminder.remindergrid"]:c=Zarafa.common.reminder.dialogs.ReminderGridContextMenu;break;case Zarafa.core.data.SharedComponentType["common.contextmenu.flags"]:c=Zarafa.common.flags.ui.FlagsMenu;break;case Zarafa.core.data.SharedComponentType["common.categories.dialogs.newcategory"]:c=Zarafa.common.categories.dialogs.NewCategoryPanel;break;case Zarafa.core.data.SharedComponentType["common.categories.dialogs.renamecategory"]:c=
Zarafa.common.categories.dialogs.RenameCategoryPanel;break;case Zarafa.core.data.SharedComponentType["common.flags.dialogs.customflag"]:c=Zarafa.common.flags.dialogs.CustomFlagContentPanel}return c},doOpen:function(a){Zarafa.common.Actions.downloadAttachment(a)},createDelegateSettingsCategory:function(a,b,c){return{xtype:"zarafa.settingsdelegatecategory",settingsContext:c}},createSendAsSettingsCategory:function(a,b,c){return{xtype:"zarafa.settingssendascategory",settingsContext:c}},createRuleSettingsCategory:function(a,
b,c){return{xtype:"zarafa.settingsrulecategory",settingsContext:c}}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"default",allowUserVisible:!1,pluginConstructor:Zarafa.common.CommonContext}))});Ext.namespace("Zarafa.common.favorites.data");Zarafa.common.favorites.data.MAPIFavoritesSubStore=Ext.extend(Zarafa.hierarchy.data.IPFSubStore,{constructor:function(a){a=a||{};Zarafa.common.favorites.data.MAPIFavoritesSubStore.superclass.constructor.call(this,a)}});
Ext.namespace("Zarafa.common.recipientfield.ui");Zarafa.common.recipientfield.ui.RecipientList=Ext.extend(Zarafa.common.recipientfield.ui.RecipientField,{constructor:function(a){a=a||{};Ext.applyIf(a,{boxType:"zarafa.recipientbox",boxConfig:{height:a.inputFieldHeight||this.inputFieldHeight},listMode:!0,autoHeight:!0,autoScroll:!1});Zarafa.common.recipientfield.ui.RecipientList.superclass.constructor.call(this,a)}});Ext.reg("zarafa.recipientlist",Zarafa.common.recipientfield.ui.RecipientList);Ext.namespace("Zarafa.common.rules.data");
Zarafa.common.rules.data.RulesResponseHandler=Ext.extend(Zarafa.core.data.IPMResponseHandler,{correlateRecordFromResponse:function(a){a=this.reader.readResponse(Ext.data.Api.actions.read,a);var b=[];Ext.isEmpty(a.data)||Ext.isEmpty(this.sendRecords)||(b=a.data.clone());return b}});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookContext=Ext.extend(Zarafa.core.Context,{constructor:function(a){a=a||{};Ext.applyIf(a,{hasToolbar:!1,hasContentPanel:!1});Zarafa.addressbook.AddressBookContext.superclass.constructor.call(this,a);Zarafa.core.data.SharedComponentType.addProperty("addressbook.dialog.addressbook");Zarafa.core.data.SharedComponentType.addProperty("addressbook.dialog.abuserselection");Zarafa.core.data.SharedComponentType.addProperty("addressbook.dialog.abmultiuserselection")},bidSharedComponent:function(a,
b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["addressbook.dialog.addressbook"]:case Zarafa.core.data.SharedComponentType["addressbook.dialog.abuserselection"]:case Zarafa.core.data.SharedComponentType["addressbook.dialog.abmultiuserselection"]:c=1;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.addressbook.AddressBookRecord&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.view"]:if(b instanceof Zarafa.addressbook.AddressBookRecord){var d=
b.get("object_type");0<=[Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,Zarafa.core.mapi.ObjectType.MAPI_ABCONT].indexOf(d)&&!Zarafa.core.EntryId.hasContactProviderGUID(b.get("entryid"))&&(c=1)}}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["addressbook.dialog.addressbook"]:c=Zarafa.addressbook.dialogs.AddressBookContentPanel;break;case Zarafa.core.data.SharedComponentType["common.view"]:switch(b.get("object_type")){case Zarafa.core.mapi.ObjectType.MAPI_MAILUSER:c=
Zarafa.addressbook.dialogs.ABUserDetailContentPanel;break;case Zarafa.core.mapi.ObjectType.MAPI_DISTLIST:c=Zarafa.addressbook.dialogs.ABGroupDetailContentPanel;break;case Zarafa.core.mapi.ObjectType.MAPI_ABCONT:c=Zarafa.addressbook.dialogs.ABGroupDetailContentPanel}break;case Zarafa.core.data.SharedComponentType["addressbook.dialog.abuserselection"]:c=Zarafa.addressbook.dialogs.ABUserSelectionContentPanel;break;case Zarafa.core.data.SharedComponentType["addressbook.dialog.abmultiuserselection"]:c=
Zarafa.addressbook.dialogs.ABMultiUserSelectionContentPanel;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=Zarafa.addressbook.ui.AddressBookContextMenu}return c}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"addressbook",allowUserVisible:!1,pluginConstructor:Zarafa.addressbook.AddressBookContext}))});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookHierarchyStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"addressbook",standalone:!0,proxy:new Zarafa.addressbook.AddressBookHierarchyProxy,sortInfo:{field:"display_name",direction:"desc"}});Zarafa.addressbook.AddressBookHierarchyStore.superclass.constructor.call(this,a)},idComparison:function(a,b){return Zarafa.core.EntryId.compareABEntryIds(a,b)},loadAddressBookHierarchy:function(){Zarafa.addressbook.AddressBookHierarchyStore.load({actionType:Zarafa.core.Actions.list,
params:{subActionType:Zarafa.core.Actions.hierarchy,gab:"all"}})},onNotifyObjectmodified:function(a,b,c,d,e){this.loadAddressBookHierarchy()}});Ext.reg("zarafa.addressbookhierarchystore",Zarafa.addressbook.AddressBookHierarchyStore);
Zarafa.onUIReady(function(){"function"===typeof Zarafa.addressbook.AddressBookHierarchyStore&&(Zarafa.addressbook.AddressBookHierarchyStore=new Zarafa.addressbook.AddressBookHierarchyStore,Zarafa.addressbook.AddressBookHierarchyStore.on("load",function(){var a=[];Zarafa.addressbook.AddressBookHierarchyStore.each(function(b,c){0<c&&0===b.get("depth")?c===Zarafa.addressbook.AddressBookHierarchyStore.getCount()||0===Zarafa.addressbook.AddressBookHierarchyStore.getAt(c+1).get("depth")?a.push(b):b.set("group_header",
!0):b.set("group_header",!1)});Ext.each(a,function(a){Zarafa.addressbook.AddressBookHierarchyStore.remove(a)})}),Zarafa.addressbook.AddressBookHierarchyStore.loadAddressBookHierarchy())});Ext.namespace("Zarafa.addressbook");Zarafa.addressbook.AddressBookResponseHandler=Ext.extend(Zarafa.core.data.IPMResponseHandler,{doList:function(a){this.receivedRecords=this.readRecordsFromResponse(a,"item")}});Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER);Ext.applyIf(a,{preferredMessageClass:"addressbook",standalone:!0,sortInfo:{field:"full_name",direction:"desc"},reader:new Zarafa.core.data.JsonReader({},b)});Zarafa.addressbook.AddressBookStore.superclass.constructor.call(this,a)},idComparison:function(a,b){return Zarafa.core.EntryId.compareABEntryIds(a,
b)},getRecordKey:function(a){return a.get("email_index")&&-1!==a.get("email_index")?a.id+"_"+a.get("email_index"):a.id}});Ext.reg("zarafa.addressbookstore",Zarafa.addressbook.AddressBookStore);Ext.namespace("Zarafa.addressbook.ui");
Zarafa.addressbook.ui.AddressBookBoxField=Ext.extend(Zarafa.common.recipientfield.ui.RecipientField,{constructor:function(a){a=a||{};Ext.applyIf(a,{boxType:"zarafa.addressbookbox",enableComboBox:!1,editable:!0,height:24});Zarafa.addressbook.ui.AddressBookBoxField.superclass.constructor.call(this,a)}});Ext.reg("zarafa.addressbookboxfield",Zarafa.addressbook.ui.AddressBookBoxField);Ext.namespace("Zarafa.advancesearch");
Zarafa.advancesearch.AdvanceSearchContext=Ext.extend(Zarafa.core.Context,{constructor:function(a){a=a||{};Ext.applyIf(a,{hasToolbar:!1,hasContentPanel:!1,current_view:Zarafa.common.data.Views.LIST,current_view_mode:Zarafa.common.data.ViewModes.RIGHT_PREVIEW});Zarafa.advancesearch.AdvanceSearchContext.superclass.constructor.call(this,a);this.registerInsertionPoint("main.toolbar.actions.last",this.createMainToolbarSearchViewButton,this);Zarafa.core.data.SharedComponentType.addProperty("search.dialog.selectfolder")},
createMainToolbarSearchViewButton:function(){return{xtype:"button",scale:"large",ref:"searchView",hidden:!0,iconCls:"view_icon",menu:new Zarafa.common.CommonViewButtons({context:this})}},onContextSelectView:function(a){this.getModel().setDataMode(a.valueDataMode);this.switchView(a.valueView,a.valueViewMode)},getModel:function(a){Ext.isDefined(this.model)||(this.model=new Zarafa.advancesearch.AdvanceSearchContextModel);return this.model},bidSharedComponent:function(a,b){var c=-1;switch(a){case Zarafa.core.data.SharedComponentType["common.search"]:c=
1;break;case Zarafa.core.data.SharedComponentType["search.dialog.selectfolder"]:c=1;break;case Zarafa.core.data.SharedComponentType["common.create"]:b.get("folder_type")===Zarafa.core.mapi.MAPIFolderType.FOLDER_SEARCH&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.MAPIRecord&&b.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_FOLDER&&b.isSearchFolder()&&(c=1)}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.search"]:c=
Zarafa.advancesearch.dialogs.SearchContentPanel;break;case Zarafa.core.data.SharedComponentType["search.dialog.selectfolder"]:c=Zarafa.advancesearch.dialogs.SelectFolderContentPanel;break;case Zarafa.core.data.SharedComponentType["common.create"]:b.get("folder_type")===Zarafa.core.mapi.MAPIFolderType.FOLDER_SEARCH&&(c=Zarafa.advancesearch.dialogs.CreateSearchFolderContentPanel);break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.MAPIRecord&&b.get("object_type")==
Zarafa.core.mapi.ObjectType.MAPI_FOLDER&&b.isSearchFolder()&&(c=Zarafa.advancesearch.ui.SearchFolderContextMenu)}return c}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"advancesearch",allowUserVisible:!1,pluginConstructor:Zarafa.advancesearch.AdvanceSearchContext}))});Ext.namespace("Zarafa.advancesearch");
Zarafa.advancesearch.AdvanceSearchStore=Ext.extend(Zarafa.core.data.ListModuleStore,{searchFolderEntryId:void 0,searchStoreEntryId:void 0,searchStoreUniqueId:void 0,isBusySearching:!1,suggestion:"",searchFolder:{},constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"IPM.Search"});Zarafa.advancesearch.AdvanceSearchStore.superclass.constructor.call(this,a)},initEvents:function(){this.on("load",this.onLoad,this)},getSearchStoreUniqueId:function(){return this.searchStoreUniqueId},loadRecords:function(a,
b,c,d){"search"===b.actionType&&(!1!==c&&Ext.isObject(d)&&Ext.isObject(d.search_meta)?this.suggestion=d.search_meta.suggestion:this.suggestion="");Zarafa.advancesearch.AdvanceSearchStore.superclass.loadRecords.apply(this,arguments)},onLoad:function(a,b,c){Ext.each(b,function(a){var b="";switch(a.get("message_class")){case "IPM.Note":b=a.get("message_delivery_time")||a.get("last_modification_time");break;case "IPM.Task":b=a.get("task_duedate");break;case "IPM.TaskRequest":case "IPM.TaskRequest.Accept":case "IPM.TaskRequest.Update":case "IPM.TaskRequest.Decline":case "IPM.TaskRequest.Complete":b=
a.isTaskOrganized()?a.get("client_submit_time"):a.get("message_delivery_time");break;case "IPM.Contact":case "IPM.StickyNote":b=a.get("creation_time");break;case "IPM.Appointment":b=a.get("commonstart");break;case "IPM.Schedule":case "IPM.Schedule.Meeting":case "IPM.Schedule.Meeting.Request":case "IPM.Schedule.Meeting.Canceled":b=a.get("startdate");break;case "IPM.Schedule.Meeting.Resp.Pos":case "IPM.Schedule.Meeting.Resp.Neg":case "IPM.Schedule.Meeting.Resp.Tent":b=a.senderIsUser()?a.get("client_submit_time"):
a.get("message_delivery_time")}a.data.searchdate=b;a.commit()})},setSearchEntryId:function(a){this.searchFolderEntryId=a},setSearchStoreEntryId:function(a){this.searchStoreEntryId=a},search:function(a){this.remoteSort=!0;delete this.sortInfo;if(this.isExecuting(Zarafa.core.Actions.updatesearch)||this.isExecuting(Zarafa.core.Actions.search))this.proxy.cancelRequests(Zarafa.core.Actions.updatesearch),this.proxy.cancelRequests(Zarafa.core.Actions.search);this.hasSearchResults=!1;a.useSearchFolder||this.setSearchEntryId(void 0);
Zarafa.advancesearch.AdvanceSearchStore.superclass.search.apply(this,arguments)}});Ext.reg("zarafa.advancesearchstore",Zarafa.advancesearch.AdvanceSearchStore);Ext.namespace("Zarafa.calendar");
Zarafa.calendar.AppointmentStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"IPM.Appointment",defaultSortInfo:{field:"startdate",direction:"desc"}});Zarafa.calendar.AppointmentStore.superclass.constructor.call(this,a);this.on("update",this.onUpdate,this)},getRecordKey:function(a){return Ext.isDefined(a.isRecurringOccurence)&&a.isRecurringOccurence()?a.id+""+a.get("basedate"):a.id},destroyRecord:function(a,b,c){if(!(-1<this.removed.indexOf(b))){if(b.isRecurring&&
b.isRecurring()){var d=[];this.each(function(a){a.id===b.id&&d.push(a)});for(var e=0,f=d.length;e<f;e++){var g=d[e];this.removed.push(g);this.remove(g);this.removed.remove(g)}}Zarafa.calendar.AppointmentStore.superclass.destroyRecord.call(this,a,b,c)}},getRecordsForUpdateData:function(a,b){if(!Ext.isDefined(a)||b===Ext.data.Api.actions.create)return Zarafa.calendar.AppointmentStore.superclass.getRecordsForUpdateData.apply(this,arguments);var c={records:[],updatedRecords:[]};Array.isArray(a)||(a=[a]);
for(var d=0,e=a.length;d<e;d++){var f=a[d];if(f.isMessageClass("IPM.Appointment")||f.isMessageClass("IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}"))if(f.isRecurringOccurence()){var g=this.findBy(function(a){return Zarafa.core.EntryId.compareEntryIds(f.get("entryid"),a.get("entryid"))&&Ext.isDate(f.get("basedate"))&&Ext.isDate(a.get("basedate"))&&f.get("basedate").getTime()===a.get("basedate").getTime()});0<=g&&(c.records.push(this.getAt(g)),c.updatedRecords.push(f))}else if(f.isRecurring()){g=
-1;do if(g=this.findBy(function(a){return(b===Ext.data.Api.actions.destroy||!a.isRecurringException())&&Zarafa.core.EntryId.compareEntryIds(f.get("entryid"),a.get("entryid"))},void 0,g+1),0<=g){var h=this.getAt(g),k=f.copy(),l=h.get("basedate");Ext.isDate(l)&&k.set("basedate",l.clone());k.set("recurrence",h.get("recurrence"));k.set("startdate",h.get("startdate").clearTime(!0).add(Date.MINUTE,f.get("recurrence_startocc")));k.set("duedate",h.get("startdate").clearTime(!0).add(Date.MINUTE,f.get("recurrence_endocc")));
k.set("commonstart",k.get("startdate").clone());k.set("commonend",k.get("duedate").clone());k.set("duration",(k.get("duedate")-k.get("startdate"))/6E4);c.records.push(h);c.updatedRecords.push(k)}while(-1!=g)}else if(g=this.getById(f.get("entryid")))c.records.push(g),c.updatedRecords.push(f)}return c},onNotifyObjectdeleted:function(a,b,c,d,e){Zarafa.calendar.AppointmentStore.superclass.onNotifyObjectdeleted.apply(this,arguments);this.reload()},onUpdate:function(a,b,c){c===Ext.data.Record.COMMIT&&b.getActionResponse("resources_pasted")&&
b.isMeeting()&&Zarafa.core.data.UIFactory.openViewRecord(b)}});Ext.reg("zarafa.appointmentstore",Zarafa.calendar.AppointmentStore);Ext.namespace("Zarafa.calendar");
Zarafa.calendar.CalendarContext=Ext.extend(Zarafa.core.Context,{default_zoom_level:void 0,oldView:void 0,oldViewMode:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{groupViewBtns:!1,current_view:Zarafa.calendar.data.Views.BLOCKS,current_view_mode:Zarafa.calendar.data.ViewModes.DAYS});this.registerInsertionPoint("main.maintoolbar.new.item",this.createNewAppointmentButton,this);this.registerInsertionPoint("main.maintoolbar.new.item",this.createNewMeetingRequestButton,this);this.registerInsertionPoint("main.maintabbar.left",
this.createMainTab,this);this.registerInsertionPoint("navigation.north",this.createDatePicker,this);this.registerInsertionPoint("navigation.center",this.createCalendarNavigationPanel,this);this.registerInsertionPoint("context.settings.categories",this.createSettingCategories,this);this.registerInsertionPoint("previewpanel.toolbar.right.first",this.getMeetingRequestToolbarButtons,this);this.registerInsertionPoint("previewpanel.toolbar.detaillinks",this.getMeetingRequestDetailLinks,this);this.registerInsertionPoint("context.mail.showmailcontentpanel.toolbar.actions.first",
this.getMeetingRequestToolbarButtons,this);this.addEvents(["zoomchange"]);Zarafa.calendar.CalendarContext.superclass.constructor.call(this,a);Zarafa.core.data.SharedComponentType.addProperty("calendar.dialogs.proposenewtimecontentpanel");Zarafa.core.data.SharedComponentType.addProperty("calendar.dialogs.sendmeetingrequestconfirmation");Zarafa.core.data.SharedComponentType.addProperty("calendar.dialogs.sendmeetingrequestcancellation")},enable:function(a,b){this.default_zoom_level=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level");
Zarafa.calendar.CalendarContext.superclass.enable.apply(this,arguments)},getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.calendar.CalendarContextModel,this.model.on({searchstart:this.onModelSearchStart,searchstop:this.onModelSearchStop,scope:this}));return this.model},onModelSearchStart:function(a){this.getCurrentView()!=Zarafa.calendar.data.Views.SEARCH&&this.getCurrentViewMode()!=Zarafa.calendar.data.ViewModes.SEARCH&&(this.oldView=this.getCurrentView(),this.oldViewMode=this.getCurrentViewMode(),
this.switchView(Zarafa.calendar.data.Views.SEARCH,Zarafa.calendar.data.ViewModes.SEARCH))},onModelSearchStop:function(a){this.switchView(this.oldView,this.oldViewMode);delete this.oldView;delete this.oldViewMode},setZoomLevel:function(a,b){if(!0===b||this.default_zoom_level!==a){var c=this.default_zoom_level;this.default_zoom_level=a;this.fireEvent("zoomchange",this,this.default_zoom_level,c)}},getZoomLevel:function(a){return this.default_zoom_level},bid:function(a){return a.isContainerClass("IPF.Appointment",
!0)?1:-1},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:case Zarafa.core.data.SharedComponentType["common.preview"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&(c=b.isMessageClass(["IPM.Appointment","IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}"],!0)?1:-1);break;case Zarafa.core.data.SharedComponentType["calendar.dialogs.sendmeetingrequestconfirmation"]:case Zarafa.core.data.SharedComponentType["calendar.dialogs.sendmeetingrequestcancellation"]:case Zarafa.core.data.SharedComponentType["calendar.dialogs.proposenewtimecontentpanel"]:b instanceof
Zarafa.core.data.IPMRecord&&b.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&b.isMessageClass(["IPM.Appointment","IPM.Schedule.Meeting","IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}"],!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?b.isMessageClass(["IPM.Appointment","IPM.Schedule.Meeting","IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}"],
!0)&&(c=1):b instanceof Zarafa.calendar.CalendarContext&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.MessageRecord&&b.isMessageClass(["IPM.Appointment","IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}"],!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:b instanceof Zarafa.hierarchy.data.MAPIFolderRecord&&b.isContainerClass("IPF.Appointment",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:b instanceof
Zarafa.core.data.IPMRecord&&b.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&b.isMessageClass(["IPM.Appointment","IPM.Schedule.Meeting"],!0)&&(c=1)}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:c=Zarafa.calendar.dialogs.AppointmentContentPanel;break;case Zarafa.core.data.SharedComponentType["common.preview"]:c=Zarafa.calendar.ui.AppointmentPreviewPanel;break;
case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=Zarafa.calendar.ui.CalendarContextMenu;break;case Zarafa.core.data.SharedComponentType["calendar.dialogs.proposenewtimecontentpanel"]:c=Zarafa.calendar.dialogs.ProposeNewTimeContentPanel;break;case Zarafa.core.data.SharedComponentType["calendar.dialogs.sendmeetingrequestconfirmation"]:c=Zarafa.calendar.dialogs.SendMeetingRequestConfirmationContentPanel;break;case Zarafa.core.data.SharedComponentType["calendar.dialogs.sendmeetingrequestcancellation"]:c=
Zarafa.calendar.dialogs.SendMeetingRequestCancellationContentPanel;break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:if(b instanceof Zarafa.core.data.IPMRecord)c=Zarafa.calendar.printer.MeetingRenderer;else switch(b.getModel().getCurrentDataMode()){case Zarafa.calendar.data.DataModes.WORKWEEK:c=Zarafa.calendar.printer.WorkWeekViewRenderer;break;case Zarafa.calendar.data.DataModes.WEEK:c=Zarafa.calendar.printer.WeekViewRenderer;break;case Zarafa.calendar.data.DataModes.DAY:c=
Zarafa.calendar.printer.DaysViewRenderer}break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:c=Zarafa.calendar.attachitem.AttachCalendarColumnModel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:c=Zarafa.calendar.attachitem.AttachCalendarRenderer}return c},createCalendarNavigationPanel:function(){return{xtype:"zarafa.contextnavigation",context:this,items:[{xtype:"panel",id:"zarafa-navigationpanel-calendar-navigation",
cls:"zarafa-context-navigation-block",layout:"fit",items:[{xtype:"zarafa.multiselecthierarchytree",id:"zarafa-navigationpanel-calendar-navigation-tree",ref:"../../multiSelectHierarchyTree",model:this.getModel(),IPMFilter:"IPF.Appointment",hideDeletedFolders:!0,multiSelect:!0,enableDD:!0,enableItemDrop:!0,deferredLoading:!0,colored:!0,bbarConfig:{defaultSelectedSharedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.APPOINTMENT,buttonText:_("Add Shared Calendar")}}]}]}},createDatePicker:function(){var a=
new Zarafa.calendar.ui.DatePicker({id:"zarafa-navigationpanel-calendar-datepicker",navigationContext:this,showWeekNumber:!0,showToday:!0,width:"100%",handler:function(a,c){this.getModel().setDate(c)},scope:this});this.getModel().on("datechange",function(a,c){this.setValue(c)},a);return a},getMeetingRequestToolbarButtons:function(a){return{xtype:"zarafa.meetingrequestbuttons"}},getMeetingRequestDetailLinks:function(a){return{xtype:"zarafa.meetinginfo"}},createContentPanel:function(){return{xtype:"zarafa.calendarmainpanel",
id:"zarafa-mainpanel-contentpanel-calendar",context:this}},getMainToolbarViewButtons:function(){var a=container.populateInsertionPoint("main.maintoolbar.view.calendar",this)||[];return[{id:"zarafa-maintoolbar-view-calendar-day",text:_("Day"),iconCls:"icon-calendar-day",ref:"calendarDay",valueView:Zarafa.calendar.data.Views.BLOCKS,valueViewMode:Zarafa.calendar.data.ViewModes.DAYS,valueDataMode:Zarafa.calendar.data.DataModes.DAY,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-calendar-workweek",
text:_("Workweek"),iconCls:"icon-calendar-workweek",ref:"calendarWorkweek",valueView:Zarafa.calendar.data.Views.BLOCKS,valueViewMode:Zarafa.calendar.data.ViewModes.DAYS,valueDataMode:Zarafa.calendar.data.DataModes.WORKWEEK,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-calendar-week",text:_("Week"),iconCls:"icon-calendar-week",ref:"calendarWeek",valueView:Zarafa.calendar.data.Views.BLOCKS,valueViewMode:Zarafa.calendar.data.ViewModes.DAYS,valueDataMode:Zarafa.calendar.data.DataModes.WEEK,
handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-calendar-month",text:_("Month"),iconCls:"icon-calendar-month",ref:"calendarMonth",valueView:Zarafa.calendar.data.Views.BLOCKS,valueViewMode:Zarafa.calendar.data.ViewModes.BOX,valueDataMode:Zarafa.calendar.data.DataModes.MONTH,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-calendar-list",text:_("List"),iconCls:"icon-calendar-grid",ref:"calendarList",valueView:Zarafa.calendar.data.Views.LIST,valueViewMode:Zarafa.calendar.data.ViewModes.LIST,
valueDataMode:Zarafa.calendar.data.DataModes.ALL,handler:this.onContextSelectView,scope:this}].concat(a)},onContextSelectView:function(a){this.switchView(a.valueView,a.valueViewMode);this.getModel().setDataMode(a.valueDataMode)},setVisiblityMainToolbarButton:function(a,b){b=b||container.getCurrentContext();var c=b.getCurrentView();b===this&&c==Zarafa.calendar.data.Views.BLOCKS?a.show():a.hide()},createNewAppointmentButton:function(){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-appointment",
tooltip:_("Appointment")+" (Ctrl + Alt + A)",plugins:"zarafa.menuitemtooltipplugin",text:_("Appointment"),handler:function(){Zarafa.calendar.Actions.openCreateAppointmentContent(this.getModel())},scope:this,iconCls:"icon_create_appointment",newMenuIndex:2,context:"calendar"}},createNewMeetingRequestButton:function(){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-meetingrequest",tooltip:_("Meeting request")+" (Ctrl + Alt + V)",plugins:"zarafa.menuitemtooltipplugin",text:_("Meeting request"),
handler:function(){Zarafa.calendar.Actions.openCreateMeetingRequestContent(this.getModel())},scope:this,iconCls:"icon_create_meeting_request",newMenuIndex:2}},getMainToolbarPrintButtons:function(){var a=container.populateInsertionPoint("main.toolbar.print.calendar",this)||[];return[{xtype:"zarafa.conditionalitem",id:"zarafa-maintoolbar-print-selectedappointment",overflowText:_("Print selected appointment"),iconCls:"icon_print_single_appt",tooltip:_("Print selected appointment")+" (Ctrl + P)",plugins:"zarafa.menuitemtooltipplugin",
text:_("Print selected appointment"),hideOnDisabled:!1,singleSelectOnly:!0,handler:this.onPrintSelected,scope:this},{xtype:"zarafa.conditionalitem",id:"zarafa-maintoolbar-print-calendaroverview",overflowText:_("Print overview"),iconCls:"icon_print_view",text:_("Print overview"),tooltip:_("Print overview")+" (Ctrl + Alt + P)",plugins:"zarafa.menuitemtooltipplugin",handler:this.onPrintView,scope:this,hideOnDisabled:!1,beforeShow:function(a,c){var b=a.scope.getModel().getCurrentDataMode();a.setDisabled(b==
Zarafa.calendar.data.DataModes.MONTH)}}].concat(a)},onPrintSelected:function(){var a=this.getModel().getSelectedRecords();Ext.isEmpty(a)?Ext.MessageBox.alert(_("Print"),_("No appointment selected")):Zarafa.common.Actions.openPrintDialog(a)},onPrintView:function(){Zarafa.common.Actions.openPrintDialog(this)},createSettingCategories:function(a,b,c){return[{xtype:"zarafa.settingscalendarcategory",settingsContext:c}]},createMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:3,context:this.getName(),
id:"mainmenu-button-calendar"}}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"calendar",displayName:_("Calendar"),allowUserVisible:!1,pluginConstructor:Zarafa.calendar.CalendarContext}))});Ext.namespace("Zarafa.calendar");
Zarafa.calendar.CalendarContextModel=Ext.extend(Zarafa.core.MultiFolderContextModel,{dateRange:void 0,ignoreDateRange:!1,date:void 0,oldDataMode:void 0,activeDateRange:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.store)||(a.store=new Zarafa.calendar.AppointmentStore);Ext.applyIf(a,{statefulRecordSelection:!0,colorScheme:Zarafa.core.ColorSchemes.getColorSchemes(),current_data_mode:Zarafa.calendar.data.DataModes.WORKWEEK});this.date=(new Date).clearTime(!0);this.dateRange=new Zarafa.core.DateRange;
this.addEvents(["datechange","daterangechange","activate"]);Zarafa.calendar.CalendarContextModel.superclass.constructor.call(this,a);this.on({searchstart:this.onSearchStart,searchstop:this.onSearchStop,scope:this});this.calculateDateRange(this.date)},enable:function(a,b){this.default_merge_state=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_merge_state");Zarafa.calendar.CalendarContextModel.superclass.enable.call(this,a,!0);this.setDate(this.date,!0);!0!==b&&this.resumeLoading()},
createRecord:function(a,b){a=a||this.getDefaultFolder();var c;c=a.existsInFavorites()?container.getHierarchyStore().getById(a.get("store_entryid")):a.getMAPIStore();var d=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_zoom_level"),e=container.getSettingsModel().get("zarafa/v1/contexts/calendar/default_appointment_period"),d=(new Date).ceil(Date.MINUTE,d),e=d.add(Date.MINUTE,e),f=!1,g=Zarafa.core.mapi.BusyStatus.BUSY,h=Date.diff(Date.SECOND,e,d);b&&(d=b.getStartDate(),e=b.getDueDate(),
h=b.getDuration(Date.MINUTE),b.isAllDay()&&(f=!0,g=Zarafa.core.mapi.BusyStatus.FREE));return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Appointment",{store_entryid:c.get("store_entryid"),parent_entryid:a.get("entryid"),busystatus:g,startdate:d,duedate:e,commonstart:d,commonend:e,duration:h,alldayevent:f})},load:function(){this.ignoreDateRange?Zarafa.calendar.CalendarContextModel.superclass.load.call(this):Zarafa.calendar.CalendarContextModel.superclass.load.call(this,{params:{restriction:{startdate:this.dateRange.getStartTime()/
1E3,duedate:this.dateRange.getDueTime()/1E3}}})},calculateDateRange:function(a){var b=this.dateRange.clone(),c=this.ignoreDateRange;a=a.clone();a.setHours(12);switch(this.current_data_mode){case Zarafa.calendar.data.DataModes.DAY:this.dateRange.set(a.clearTime(!0),a.add(Date.DAY,1).clearTime());this.ignoreDateRange=!1;break;case Zarafa.calendar.data.DataModes.WORKWEEK:var d=container.getSettingsModel().get("zarafa/v1/main/week_start"),e=container.getSettingsModel().get("zarafa/v1/main/working_days");
e.sort();if(Ext.isEmpty(e)){this.setWeekView(a);break}if(d<=e[e.length-1])for(var f=0,g=e.length;f<g;f++){if(e[f]>=d){d=e[f];e=0===f?1+e[e.length-1]-e[f]:8-(e[f]-e[f-1]);break}}else d=e[0],e=e[e.length-1];d=a.getPreviousWeekDay(d);this.dateRange.set(d.clearTime(!0),d.add(Date.DAY,e).clearTime());this.ignoreDateRange=!1;break;case Zarafa.calendar.data.DataModes.WEEK:this.setWeekView(a);break;case Zarafa.calendar.data.DataModes.MONTH:d=container.getSettingsModel().get("zarafa/v1/main/week_start"),a=
a.getFirstDateOfMonth(),e=a.add(Date.MONTH,1).clearTime(),this.setActiveDateRange(a,e),a=a.getPreviousWeekDay(d),d=e.getNextWeekDay(d),this.dateRange.set(a,d),this.ignoreDateRange=!1}b.equals(this.dateRange)&&c===this.ignoreDateRange||(this.load(),this.fireEvent("daterangechange",this,this.dateRange,b))},setWeekView:function(a){var b=container.getSettingsModel().get("zarafa/v1/main/week_start");a=a.getPreviousWeekDay(b);this.dateRange.set(a.clearTime(!0),a.add(Date.DAY,7).clearTime());this.ignoreDateRange=
!1},setActiveDateRange:function(a,b){Ext.isObject(this.activeDateRange)||(this.activeDateRange=new Zarafa.core.DateRange);this.activeDateRange.set(a,b)},getActiveDateRange:function(){return Ext.isDefined(this.activeDateRange)?this.activeDateRange:this.dateRange},setDate:function(a,b){var c=this.date;a=a.clearTime(!0);if(b||c.getTime()!==a.getTime())this.date=a,this.fireEvent("datechange",this,a,this.oldDate),this.calculateDateRange(this.date)},moveDate:function(a){var b=this.date.clone();b.setHours(12);
switch(this.current_data_mode){case Zarafa.calendar.data.DataModes.DAY:b=b.add(Date.DAY,1*a);break;case Zarafa.calendar.data.DataModes.WEEK:case Zarafa.calendar.data.DataModes.WORKWEEK:b=b.add(Date.DAY,7*a);break;case Zarafa.calendar.data.DataModes.MONTH:b=b.add(Date.MONTH,1*a)}this.setDate(b.clearTime())},nextDate:function(){this.moveDate(1)},previousDate:function(){this.moveDate(-1)},onDataModeChange:function(a,b,c){Zarafa.calendar.CalendarContextModel.superclass.onDataModeChange.call(this,a,b,
c);b!==c&&c===Zarafa.calendar.data.DataModes.SEARCH&&this.stopSearch();switch(b){case Zarafa.calendar.data.DataModes.SEARCH:this.ignoreDateRange=!0;break;case Zarafa.calendar.data.DataModes.ALL:this.ignoreDateRange=!0;this.load();break;default:this.calculateDateRange(this.date)}},setModeAndDate:function(a,b){this.date=b.clearTime(!0);this.setDataMode(a,!0)},getMonthRangeText:function(){return this.date.getFirstDateOfMonth().format(_("F Y"))},getDateRangeText:function(){return this.current_data_mode==
Zarafa.calendar.data.DataModes.MONTH?this.getMonthRangeText():this.dateRange.format()},onSearchStart:function(a){this.getCurrentDataMode()!=Zarafa.calendar.data.DataModes.SEARCH&&(this.oldDataMode=this.getCurrentDataMode(),this.setDataMode(Zarafa.calendar.data.DataModes.SEARCH))},onSearchStop:function(a){this.getCurrentDataMode()===Zarafa.calendar.data.DataModes.SEARCH&&this.setDataMode(this.oldDataMode);delete this.oldDataMode},setActiveFolder:function(a){this.fireEvent("activate",a,this)}});Ext.namespace("Zarafa.calendar.dialogs");
Zarafa.calendar.dialogs.AppointmentContentPanel=Ext.extend(Zarafa.core.ui.MessageContentPanel,{newAppointmentProps:void 0,activeTab:void 0,isPropertyChanged:!1,isRecipientChanged:!1,constructor:function(a){a=a||{};Ext.isDefined(a.activeTab)&&(this.activeTab=a.activeTab);Ext.applyIf(a,{xtype:"zarafa.appointmentcontentpanel",layout:"fit",recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),title:_("Appointment"),confirmClose:!0,items:[{xtype:"zarafa.appointmentpanel",
activeTab:this.activeTab,tbar:{xtype:"zarafa.appointmenttoolbar"}}]});Zarafa.calendar.dialogs.AppointmentContentPanel.superclass.constructor.call(this,a)},createSendValidationQueue:function(){Zarafa.calendar.dialogs.AppointmentContentPanel.superclass.createSendValidationQueue.apply(this,arguments);this.sendValidationQueue.add(this.validateSendUpdateToRecipients,this);this.sendValidationQueue.add(this.validateBusyRecipients,this)},update:function(a,b){this.updateTitleFromRecord(a,b);b&&this.updateIconFromRecord(a);
if(a.isOpened()){if(b||a.isModifiedSinceLastUpdate("meeting"))switch(a.updateMeetingRecipients(),a.get("meeting")){case Zarafa.core.mapi.MeetingStatus.MEETING:Ext.isDefined(this.initialConfig.closeOnSave)||(this.closeOnSave=!1);Ext.isDefined(this.initialConfig.closeOnSend)||(this.closeOnSend=!0);break;case Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED:Ext.isDefined(this.initialConfig.closeOnSave)||(this.closeOnSave=!0);Ext.isDefined(this.initialConfig.closeOnSend)||(this.closeOnSend=!0);break;default:Ext.isDefined(this.initialConfig.closeOnSave)||
(this.closeOnSave=!0),Ext.isDefined(this.initialConfig.closeOnSend)||(this.closeOnSend=!1)}this.newAppointmentProps&&(a.beginEdit(),Ext.iterate(this.newAppointmentProps,a.set,a),delete this.newAppointmentProps,a.endEdit());var c=a.getSubStore("recipients");c&&a.isMeetingOrganized()&&this.mon(c,"resolved",this.setRecipientTypeOnResolve,this)}},updateIconFromRecord:function(a){a=Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){var b=a.get("subject");Ext.isEmpty(b)?
a.get("meeting")==Zarafa.core.mapi.MeetingStatus.NONMEETING?this.setTitle(this.initialConfig.title):this.setTitle(_("Meeting")):this.setTitle(b)},setRecipientTypeOnResolve:function(a,b){for(var c=0;c<b.length;c++){var d=b[c];switch(d.get("display_type_ex")){case Zarafa.core.mapi.DisplayTypeEx.DT_EQUIPMENT:case Zarafa.core.mapi.DisplayTypeEx.DT_ROOM:d.set("recipient_type",Zarafa.core.mapi.RecipientType.MAPI_BCC)}}},onUpdateRecord:function(a,b,c){b===Ext.data.Record.COMMIT?(c.isMeetingOrganized()&&
!0===this.isSending&&-1!==c.getRecipientStore().findExact("recipient_type",Zarafa.core.mapi.RecipientType.MAPI_BCC)&&c.getActionResponse("resources_booked")&&container.getNotifier().notify("info.meeting",_("Kopano WebApp"),pgettext("calendar.dialog","Resources have been planned.")),this.isRecipientChanged=this.isPropertyChanged=!1):(c.updateModifications&&0<Object.keys(c.updateModifications).length&&(this.isPropertyChanged=!0),c.updateSubStoreModifications&&(c.updateSubStoreModifications.recipients?
this.isRecipientChanged=!0:c.updateSubStoreModifications.attachments&&(this.isPropertyChanged=!0),1<Object.keys(c.updateSubStoreModifications).length&&(this.isPropertyChanged=!0)));Zarafa.calendar.dialogs.AppointmentContentPanel.superclass.onUpdateRecord.apply(this,arguments)},saveRecord:function(a){var b=this.record;if(b.isMeetingSent()&&!b.isAppointmentInPast()&&!0!==b.getMessageAction("send")){if(!this.isOnlyOrganizerPropertiesChanged(b)){Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("An update message will be sent to all recipients, do you wish to continue?"),
icon:Ext.MessageBox.WARNING,fn:this.sendMeetingUpdate,scope:this,buttons:Ext.MessageBox.YESNO});return}if(this.isRecipientChanged){this.sendRecord();return}}return Zarafa.calendar.dialogs.AppointmentContentPanel.superclass.saveRecord.apply(this,arguments)},sendRecord:function(){if(this.record.isMeeting())return Zarafa.calendar.dialogs.AppointmentContentPanel.superclass.sendRecord.apply(this,arguments)},sendMeetingUpdate:function(a){"yes"==a&&this.sendRecord()},validateSendUpdateToRecipients:function(a){this.record.get("request_sent")&&
!this.isPropertyChanged&&this.isRecipientChanged?Zarafa.common.dialogs.MessageBox.select(_("Send update to attendees"),_("You have made changes to the list of attendees, Choose one of the following")+":",function(b,c){"ok"===b?("sendModified"==c.id?this.record.addMessageAction("send_update","modified"):this.record.addMessageAction("send_update","all"),a(!0)):a(!1)},this,[{boxLabel:_("Send updates to only added or deleted attendees."),id:"sendModified",name:"select",checked:!0},{boxLabel:_("Send updates to all attendees."),
id:"sendAll",name:"select"}]):a(!0)},validateBusyRecipients:function(a){var b=this.findByType("zarafa.freebusypanel")[0],c=this.record,d=!1;b&&(d=b.getModel().checkAttendeesBusyStatus(c.get("startdate"),c.get("duedate"),c.get("request_sent")));d?Ext.MessageBox.confirm(_("Kopano WebApp"),_("One or more attendees you have invited are busy. Are you sure to invite?"),function(b){a("yes"==b)},this):a(!0)},isOnlyOrganizerPropertiesChanged:function(a){var b=!0,c="body html_body categories label busystatus private reminder isHTML sensitivity importance hasattach attach_num flagdueby reminder_minutes".split(" ");
Ext.iterate(a.modified,function(d){if(0>c.indexOf(d)&&a.data[d]!=a.modified[d])return b=!1});b&&(this.isPropertyChanged=!1);return b}});Ext.reg("zarafa.appointmentcontentpanel",Zarafa.calendar.dialogs.AppointmentContentPanel);Ext.namespace("Zarafa.calendar.ui.canvas");
Zarafa.calendar.ui.canvas.AppointmentProxy=Ext.extend(Zarafa.calendar.ui.AppointmentView,{showTime:!1,body:void 0,headerClassName:"",bodyClassName:"",constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar",itemCls:"selection"});this.addEvents("keypress","keydown","keyup");Zarafa.calendar.ui.canvas.AppointmentProxy.superclass.constructor.call(this,a)},init:function(){Zarafa.calendar.ui.canvas.AppointmentProxy.superclass.init.call(this);this.body=[]},setDateRange:function(a){this.dateRange&&
this.mun(this.dateRange,"update",this.onDateRangeUpdate,this);Zarafa.calendar.ui.canvas.AppointmentProxy.superclass.setDateRange.call(this,a);this.dateRange&&this.mon(this.dateRange,"update",this.onDateRangeUpdate,this)},render:function(a){Zarafa.calendar.ui.canvas.AppointmentProxy.superclass.render.apply(this,arguments);this.focusEl.relayEvent("keypress",this);this.focusEl.relayEvent("keydown",this);this.focusEl.relayEvent("keyup",this)},setHeaderClass:function(a){this.headerClassName=a},setBodyClass:function(a){this.bodyClassName=
a},setShowTime:function(a){this.showTime=a},createTimeText:function(){if(1<=this.body.length){var a=this.getDateRange(),b=a.getStartDate(),a=a.getDueDate(),b=String.format("{0} - {1}",b.format(_("G:i")),a.format(_("G:i")));this.getFirstBodyElement().dom.innerHTML!==b&&(this.getFirstBodyElement().dom.innerHTML=b)}},clearTimeText:function(){0<this.body.length&&(this.getFirstBodyElement().dom.innerHTML="")},setVisible:function(a){Zarafa.calendar.ui.canvas.AppointmentProxy.superclass.setVisible.call(this,
a);a?(this.setBodyClass("zarafa-calendar-selection zarafa-calendar-selection-dragging zarafa-calendar-dragproxy-time"),this.setHeaderClass("zarafa-calendar-selection zarafa-calendar-selection-dragging")):(this.setBodyClass("zarafa-calendar-selection"),this.setHeaderClass("zarafa-calendar-selection"));this.focusEl&&this.focusEl.show();this.rendered&&this.layout()},layoutBodyElements:function(a){this.showTime?this.createTimeText():this.clearTimeText();for(var b=0;b<a.length;b++)this.body[b].dom.className=
this.bodyClassName,this.body[b].setLeftTop(a[b].left,a[b].top),this.body[b].setSize(a[b].right-a[b].left,a[b].bottom-a[b].top)},onDateRangeUpdate:function(a){this.rendered&&this.isVisible()&&this.layout()},createBodyElement:function(){var a=this.parentView.getCalendarBody(),a=this.createDiv(a,"body");this.mon(a,"contextmenu",this.onContextMenu,this);this.mon(a,"dblclick",this.onDoubleClick,this)},destroyBodyElement:function(){var a=this.body.pop();this.mun(a,"contextmenu",this.onContextMenu,this);
this.mun(a,"dblclick",this.onDoubleClick,this);this.remove(a)},createHeader:function(){this.createDiv(this.parentView.getCalendarHeader(),"header");this.mon(this.header,"contextmenu",this.onContextMenu,this);this.mon(this.header,"dblclick",this.onDoubleClick,this)},destroyHeader:function(){this.mun(this.header,"contextmenu",this.onContextMenu,this);this.mun(this.header,"dblclick",this.onDoubleClick,this);this.remove(this.header);this.header=void 0},layoutInHeader:function(){var a=this.parentView.dateRangeToHeaderBounds(this.getDateRange());
for(this.header||this.createHeader();this.body.length;)this.destroyBodyElement();this.header.dom.className=this.headerClassName;this.header.setLeftTop(a.left,a.top);this.header.setSize(a.right-a.left,this.parentView.getAppointmentHeaderheight())},layoutInBody:function(){var a=this.parentView.dateRangeToBodyBounds(this.dateRange);for(this.header&&this.destroyHeader();this.body.length<a.length;)this.createBodyElement();for(;this.body.length>a.length;)this.destroyBodyElement();this.layoutBodyElements(a)},
onLayout:function(){Zarafa.calendar.ui.canvas.AppointmentProxy.superclass.onLayout.call(this);this.focus()},getFirstBodyElement:function(){return this.body[0]},onContextMenu:function(a){var b=this.parentView.parentView.model.createRecord(this.parentView.getSelectedFolder(),this.getDateRange());this.parentView.fireEvent("contextmenu",this.parentView,a,b)},onDoubleClick:function(a){var b=this.parentView.parentView.model.createRecord(this.parentView.getSelectedFolder(),this.getDateRange());this.parentView.fireEvent("dblclick",
this.parentView,a,b)}});Ext.namespace("Zarafa.calendar.ui.canvas");
Zarafa.calendar.ui.canvas.AppointmentView=Ext.extend(Zarafa.calendar.ui.AppointmentView,{dragHandleWidth:6,dragHandleHeight:6,opacityNonActiveAppointment:.4,constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar",itemCls:"appointment"});Zarafa.calendar.ui.canvas.AppointmentView.superclass.constructor.call(this,a)},getEventHeaderPosition:function(a){var b=this.parentView.getCalendarHeader();return{x:a.getPageX()-b.getX(),y:a.getPageY()-b.getY()}},getEventBodyPosition:function(a){var b=
this.parentView.getCalendarBody();return{x:a.getPageX()-b.getX(),y:a.getPageY()-b.getY()}},isEventOverElement:function(a,b){return a.x>=b.left&&a.x<=b.right&&a.y>=b.top&&a.y<=b.bottom},drawDragHandle:function(a,b,c){a.save();a.strokeStyle="black";a.fillStyle="white";a.lineWidth=1;a.fillRect(b-2,c-2,4,4);a.strokeRect(b-2,c-2,4,4);a.restore()}});Ext.namespace("Zarafa.calendar.ui.canvas");
Zarafa.calendar.ui.canvas.CalendarBoxView=Ext.extend(Zarafa.calendar.ui.AbstractCalendarBoxView,{expandButtonRadius:8,expandButtonMargin:2,headerBackgroundCanvas:void 0,bodyBackgroundCanvas:void 0,bodyAppointmentCanvas:void 0,bodySelectionCanvas:void 0,appointmentOver:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar",enableDD:!0,ddGroup:"dd.mapiitem",bodyDropConfig:{ddGroup:"dd.mapiitem",headerMode:!1,selectingSnapMode:Zarafa.calendar.data.SnapModes.DAY,draggingSnapMode:Zarafa.calendar.data.SnapModes.NONE}});
Zarafa.calendar.ui.canvas.CalendarBoxView.superclass.constructor.call(this,a)},render:function(a){Zarafa.calendar.ui.canvas.CalendarBoxView.superclass.render.call(this,a);this.create("canvas",this.header,"headerBackgroundCanvas","zarafa-canvas zarafa-canvas-layer-1 zarafa-canvas-header-background");this.create("div",this.headerBackgroundCanvas,"headerBackgroundCanvasStylingElement","zarafa-styling-element");this.create("div",this.headerBackgroundCanvas,"headerBackgroundCanvasStylingElementCurrentDay",
"zarafa-styling-element-current-day");this.headerBackgroundCanvasStylingElement.styling={font:this.headerBackgroundCanvasStylingElement.getStyle("font"),fontSize:parseInt(this.headerBackgroundCanvasStylingElement.getStyle("font-size"),10),paddingTop:this.headerBackgroundCanvasStylingElementCurrentDay.getPadding("t"),paddingLeft:this.headerBackgroundCanvasStylingElementCurrentDay.getPadding("l"),paddingRight:this.headerBackgroundCanvasStylingElementCurrentDay.getPadding("r")};this.headerBackgroundCanvasStylingElementCurrentDay.styling=
{backgroundColor:this.headerBackgroundCanvasStylingElementCurrentDay.getStyle("background-color"),color:this.headerBackgroundCanvasStylingElementCurrentDay.getStyle("color")};this.create("canvas",this.body,"bodyBackgroundCanvas","zarafa-canvas zarafa-canvas-layer-1");this.create("canvas",this.body,"bodyAppointmentCanvas","zarafa-canvas zarafa-canvas-layer-2");this.create("canvas",this.body,"bodySelectionCanvas","zarafa-canvas zarafa-canvas-layer-3");this.mon(this.getBodyActionCanvas(),{mousemove:this.onBodyMove,
mouseout:this.onBodyOut,click:this.onBodyClick,dblclick:this.onBodyDblClick,contextmenu:this.onBodyContextMenu,scope:this})},createAppointment:function(a){return new Zarafa.calendar.ui.canvas.AppointmentBoxView({parentView:this,record:a,calendarColorScheme:this.calendarColorScheme})},createAppointmentProxy:function(){return new Zarafa.calendar.ui.canvas.AppointmentProxy({showTime:!1})},getBodyActionCanvas:function(){return this.bodySelectionCanvas},getBodyAppointmentCanvas:function(){return this.bodyAppointmentCanvas},
getBodySelectionCanvas:function(){return this.bodySelectionCanvas},getHeaderActionCanvas:function(){return this.headerSelectionCanvas},getDesiredHeaderHeight:function(){return this.rendered?parseInt(this.headerBackgroundCanvasStylingElement.getStyle("height"),10):0},drawDayHeaders:function(){var a=this.header.getWidth(),b=this.header.getHeight();Zarafa.resizeCanvas(this.headerBackgroundCanvas,a,b);var c=this.headerBackgroundCanvas.dom.getContext("2d");c.save();c.fillStyle=this.calendarColorScheme.base;
c.fillRect(0,0,a,b);c.fillStyle=this.headerBackgroundCanvasStylingElement.getStyle("color");c.font=this.headerBackgroundCanvasStylingElement.getStyle("font");var a=a/this.numDaysInWeek,d=this.getVisibleDateRange().getStartDate().clone(),e=c.lineWidth;d.setHours(12);for(var f=0;f<this.numDaysInWeek;f++){var g=d.add(Date.DAY,f).clearTime(),h=Math.round(a*f),g=this.getDayHeaderTitle(g,Math.round(a*(f+1))+e-h);c.drawText(g,h+this.headerBackgroundCanvasStylingElement.getPadding("l"),b-Math.ceil((b-parseInt(this.headerBackgroundCanvasStylingElement.getStyle("font-size")))/
2,10))}c.restore()},drawExpandButton:function(a,b){var c=b.right-b.left-this.expandButtonRadius-this.expandButtonMargin,d=b.bottom-b.top-this.expandButtonRadius-this.expandButtonMargin;a.beginPath();for(var e=this.expandButtonRadius-2,f=0;4>f;f++){var g=Math.sin(2*f/3*Math.PI)*e+c,h=Math.cos(2*f/3*Math.PI)*e+d;0===f?a.moveTo(g,h):a.lineTo(g,h)}a.closePath();a.fillStyle=this.calendarColorScheme.base;a.fill();a.strokeStyle="white";a.stroke()},drawDayBox:function(a,b){var c=b.right-b.left,d=b.bottom-
b.top;a.save();a.translate(b.left,b.top);var e=a.convertHexRgbToDecRgba(this.calendarColorScheme.base,.2),f;b.today?(e=this.headerBackgroundCanvasStylingElementCurrentDay.getStyle("background-color"),f=this.headerBackgroundCanvasStylingElementCurrentDay.getStyle("color"),a.font=this.headerBackgroundCanvasStylingElementCurrentDay.getStyle("font")):(this.headerBackgroundCanvasStylingElement.getStyle("color"),f="black",a.font=this.headerBackgroundCanvasStylingElement.getStyle("font"));a.fillStyle=e;
a.fillRect(0,0,c,this.dayHeaderHeight);a.fillStyle=f;a.drawText(b.date.format(_("jS")),this.headerBackgroundCanvasStylingElement.getPadding("l"),this.dayHeaderHeight-Math.ceil((this.dayHeaderHeight-parseInt(this.headerBackgroundCanvasStylingElement.getStyle("font-size")))/2)-1);if(b.active)switch(b.busyStatus){case Zarafa.core.mapi.BusyStatus.FREE:a.fillStyle="white";break;case Zarafa.core.mapi.BusyStatus.BUSY:a.fillStyle="#d7e2f1";break;case Zarafa.core.mapi.BusyStatus.TENTATIVE:a.fillStyle=this.calendarColorScheme.stripnormal;
break;case Zarafa.core.mapi.BusyStatus.OUTOFOFFICE:a.fillStyle="#e7d7ef"}else a.fillStyle=a.convertHexRgbToDecRgba(this.calendarColorScheme.base,.1);a.fillRect(0,this.dayHeaderHeight,c,d-this.dayHeaderHeight+1);b.busyStatus===Zarafa.core.mapi.BusyStatus.TENTATIVE&&(a.fillStyle=a.createPattern(Zarafa.calendar.ui.IconCache.getDashedImage(),"repeat"),a.fillRect(0,this.dayHeaderHeight,c,d-this.dayHeaderHeight+1));a.beginPath();b.left?(a.moveTo(.5,d-.5),a.lineTo(.5,.5)):a.moveTo(.5,.5);b.top&&a.lineTo(c-
.5,.5);a.strokeStyle=this.calendarColorScheme.base;a.stroke();b.overflow&&this.drawExpandButton(a,b);a.restore()},drawDays:function(){var a,b=this.body.getWidth(),c=this.body.getHeight();Zarafa.resizeCanvas(this.bodyBackgroundCanvas,b,c);Zarafa.resizeCanvas(this.bodyAppointmentCanvas,b,c);Zarafa.resizeCanvas(this.bodySelectionCanvas,b,c);b=this.bodyBackgroundCanvas.dom.getContext("2d");b.save();for(var c=0,d=this.dayBoxConfigurations.length;c<d;c++){var e=this.dayBoxConfigurations[c];this.drawDayBox(b,
e);e.today&&(a=e)}Ext.isDefined(a)&&(c=a.right-a.left,d=a.bottom-a.top,e=b.lineWidth,b.lineWidth=3,b.strokeStyle=this.headerBackgroundCanvasStylingElementCurrentDay.getStyle("background-color"),b.strokeRect(a.left+e/2,a.top+e/2,c-e,d-e));b.restore()},eventInHeader:function(a){var b=this.getBodyActionCanvas(),c=a.getPageX()-b.getX();a=a.getPageY()-b.getY();for(var b=0,d=this.dayBoxConfigurations.length;b<d;b++){var e=this.dayBoxConfigurations[b];if(c>=e.left&&c<=e.right&&a>=e.top&&a<=e.top+this.dayHeaderHeight)return!0}return!1},
eventInDay:function(a){var b=this.getBodyActionCanvas(),c=a.getPageX()-b.getX();a=a.getPageY()-b.getY();for(var b=0,d=this.dayBoxConfigurations.length;b<d;b++){var e=this.dayBoxConfigurations[b];if(c>=e.left&&c<=e.right&&a>=e.top&&a<=e.bottom)return!0}return!1},eventInExpandButton:function(a){var b=this.getBodyActionCanvas(),c=a.getPageX()-b.getX();a=a.getPageY()-b.getY();for(var d=0,e=this.dayBoxConfigurations.length;d<e;d++)if(b=this.dayBoxConfigurations[d],c>=b.left&&c<=b.right&&a>=b.top&&a<=b.bottom){if(!b.overflow)break;
c=b.right-this.expandButtonRadius-this.expandButtonMargin-c;a=b.bottom-this.expandButtonRadius-this.expandButtonMargin-a;return Math.sqrt(c*c+a*a)<=this.expandButtonRadius}return!1},getCursorForBodyAppointment:function(a,b){return a.eventOverBodyStartHandle(b)?"w-resize":a.eventOverBodyDueHandle(b)?"e-resize":"move"},onBodyMove:function(a){var b="default",c=!1;if(this.eventInHeader(a)||this.eventInExpandButton(a))b="pointer";else if(this.appointmentOver&&this.appointmentOver.eventOverBody(a))c=this.appointmentOver;
else for(var d=0,e=this.appointments.length;d<e;d++){var f=this.appointments[d];if(f.eventOverBody(a)){c=f;break}}c&&(b=this.getCursorForBodyAppointment(c,a));this.appointmentOver!==c&&(this.appointmentOver&&this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord(),a),(this.appointmentOver=c)&&this.fireEvent("appointmentmouseover",this,c.getRecord(),a));this.getBodyActionCanvas().dom.style.cursor=b},onBodyOut:function(a){this.appointmentOver&&!this.appointmentOver.eventOverBody(a)&&
(this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord(),a),this.appointmentOver=!1)},onBodyClick:function(a){if(this.eventInHeader(a)||this.eventInExpandButton(a))a=a.getXY(),a=this.screenLocationToDate(a[0],a[1]),this.fireEvent("dayclick",this,a)},onMouseMove:function(a){this.onBodyMove(a)},getRecordForEvent:function(a){if(this.eventInDay(a))for(var b=0,c=this.appointments.length;b<c;b++){var d=this.appointments[b];if(d.eventOverBody(a))return d.getRecord()}},onBodyDblClick:function(a){var b=
this.getRecordForEvent(a);this.fireEvent("dblclick",this,a,b)},onBodyContextMenu:function(a){var b=this.getRecordForEvent(a),c;b||(c=a.getXY(),c=this.screenLocationToDateRange(c[0],c[1]));this.fireEvent("contextmenu",this,a,b,c)},onAppointmentDeselect:function(a,b){Zarafa.calendar.ui.canvas.CalendarBoxView.superclass.onAppointmentDeselect.call(this,a,b);Zarafa.resizeCanvas(this.bodySelectionCanvas,this.bodySelectionCanvas.getWidth(),this.bodySelectionCanvas.getHeight());if(a.hasSelection())for(var c=
0,d=this.appointments.length;c<d;c++){var e=this.appointments[c];e.setSelected(e.isSelected())}},onAppointmentSelectionClear:function(a){Zarafa.calendar.ui.canvas.CalendarBoxView.superclass.onAppointmentSelectionClear.call(this,a);Zarafa.resizeCanvas(this.bodySelectionCanvas,this.bodySelectionCanvas.getWidth(),this.bodySelectionCanvas.getHeight())},removeChildView:function(a,b){this.appointmentOver&&this.appointmentOver===a&&(this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord()),
this.appointmentOver=!1);return Zarafa.calendar.ui.canvas.CalendarBoxView.superclass.removeChildView.apply(this,arguments)},onLayout:function(){this.doGreedyColoring(this.appointments,!0);Zarafa.calendar.ui.canvas.CalendarBoxView.superclass.onLayout.call(this);155>Zarafa.core.ColorSchemes.getLuma(this.calendarColorScheme.base)?this.headerBackgroundCanvasStylingElement.removeClass("light-background"):this.headerBackgroundCanvasStylingElement.addClass("light-background");var a=this.parentView.scrollable.getHeight();
this.body.setHeight(a);this.calculateDayBoxConfigurations();this.drawDayHeaders();this.drawDays()}});Ext.namespace("Zarafa.calendar.ui.canvas");
Zarafa.calendar.ui.canvas.CalendarDaysView=Ext.extend(Zarafa.calendar.ui.AbstractCalendarDaysView,{headerBackgroundCanvas:void 0,headerAppointmentCanvas:void 0,headerSelectionCanvas:void 0,bodyBackgroundCanvas:void 0,bodyAppointmentCanvas:void 0,bodySelectionCanvas:void 0,appointmentOver:void 0,indicatorIcon:void 0,indicatorLine:void 0,indicatorTask:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{baseCls:"zarafa-calendar",enableDD:!0,ddGroup:"dd.mapiitem"});Zarafa.calendar.ui.canvas.CalendarDaysView.superclass.constructor.call(this,
a);this.on("destroy",this.onDestroy,this)},render:function(a){Zarafa.calendar.ui.canvas.CalendarDaysView.superclass.render.call(this,a);this.create("canvas",this.header,"headerBackgroundCanvas","zarafa-canvas zarafa-canvas-layer-1 zarafa-canvas-header-background");this.create("div",this.headerBackgroundCanvas,"headerBackgroundCanvasStylingElement","zarafa-styling-element");this.create("div",this.headerBackgroundCanvas,"headerBackgroundCanvasStylingElementActive","zarafa-styling-element-active");this.create("canvas",
this.header,"headerAppointmentCanvas","zarafa-canvas zarafa-canvas-layer-2 zarafa-canvas-header-appointment");this.create("canvas",this.header,"headerSelectionCanvas","zarafa-canvas zarafa-canvas-layer-3 zarafa-canvas-header-selection");this.create("canvas",this.body,"bodyBackgroundCanvas","zarafa-canvas zarafa-canvas-layer-1 zarafa-canvas-body-background");this.create("canvas",this.body,"bodyAppointmentCanvas","zarafa-canvas zarafa-canvas-layer-2 zarafa-canvas-body-appointment");this.create("canvas",
this.body,"bodySelectionCanvas","zarafa-canvas zarafa-canvas-layer-3 zarafa-canvas-body-selection");this.mon(this.getHeaderActionCanvas(),{mousemove:this.onHeaderMove,mouseout:this.onHeaderOut,dblclick:this.onHeaderDblClick,contextmenu:this.onHeaderContextMenu,click:this.onHeaderClick,scope:this});this.mon(this.getBodyActionCanvas(),{mousemove:this.onBodyMove,mouseout:this.onBodyOut,dblclick:this.onBodyDblClick,contextmenu:this.onBodyContextMenu,scope:this});this.create({tag:"img",src:Ext.BLANK_IMAGE_URL},
this.parentView.scrollable,"indicatorIcon","k-calendar-timestrip-indicator-icon");this.createDiv(this.parentView.scrollable,"indicatorLine","k-calendar-timestrip-indicator-line")},onDestroy:function(a){this.indicatorTask&&Ext.TaskMgr.stop(this.indicatorTask)},createAppointment:function(a){return new Zarafa.calendar.ui.canvas.AppointmentDaysView({parentView:this,record:a,calendarColorScheme:this.calendarColorScheme})},removeChildView:function(a,b){this.appointmentOver&&this.appointmentOver===a&&(this.fireEvent("appointmentmouseout",
this,this.appointmentOver.getRecord()),this.appointmentOver=!1);return Zarafa.calendar.ui.canvas.CalendarDaysView.superclass.removeChildView.apply(this,arguments)},createAppointmentProxy:function(){return new Zarafa.calendar.ui.canvas.AppointmentProxy({showTime:!0})},getBodyActionCanvas:function(){return this.bodySelectionCanvas},getBodyAppointmentCanvas:function(){return this.bodyAppointmentCanvas},getBodySelectionCanvas:function(){return this.bodySelectionCanvas},getHeaderActionCanvas:function(){return this.headerSelectionCanvas},
getHeaderAppointmentCanvas:function(){return this.headerAppointmentCanvas},getHeaderSelectionCanvas:function(){return this.headerSelectionCanvas},drawHeader:function(a){var b,c=this.header.getWidth(),d=this.header.getHeight();Zarafa.resizeCanvas(this.headerBackgroundCanvas,c,d);Zarafa.resizeCanvas(this.headerAppointmentCanvas,c,d);Zarafa.resizeCanvas(this.headerSelectionCanvas,c,d);var e=this.headerBackgroundCanvas.dom.getContext("2d");e.save();e.fillStyle=this.calendarColorScheme.header;e.fillRect(0,
0,c,d);for(var f=0,g=a.length;f<g;f++){var h=a[f];h.today&&(b=h)}c=this.parentView.headerTextHeight;Ext.isDefined(b)&&(f=b.left,g=b.right,e.fillStyle=this.headerBackgroundCanvasStylingElementActive.getStyle("background-color"),e.fillRect(f,0,g-f-1,c),e.strokeStyle=this.headerBackgroundCanvasStylingElementActive.getStyle("background-color"),e.strokeRect(f+.5,.5,g-f-1,d));e.fillStyle=this.headerBackgroundCanvasStylingElement.getStyle("color");e.font=this.headerBackgroundCanvasStylingElement.getStyle("font");
f=0;for(g=a.length;f<g;f++)h=a[f],b=h.right-h.left,d=this.getDayHeaderTitle(h.date,b),b=e.textWidth(d)-b-this.headerBackgroundCanvasStylingElement.getPadding("lr"),0<b&&(d=Ext.util.Format.substr(d,0,d.length-(b/e.getFontSize()+2)),e.textWidth(d)),h.today&&(e.save(),e.fillStyle=this.headerBackgroundCanvasStylingElementActive.getStyle("color"),e.font=this.headerBackgroundCanvasStylingElementActive.getStyle("font")),e.drawText(d,h.left+this.headerBackgroundCanvasStylingElement.getPadding("l"),(c+e.getFontSize())/
2-2),h.today&&e.restore();e.restore()},drawBody:function(a){var b,c=this.parentView.getHourHeight(),d=this.parentView.firstWorkingHour/60*c,e=this.parentView.lastWorkingHour/60*c,c=this.body.getWidth(),f=this.body.getHeight();Zarafa.resizeCanvas(this.bodyBackgroundCanvas,c,f);Zarafa.resizeCanvas(this.bodyAppointmentCanvas,c,f);Zarafa.resizeCanvas(this.bodySelectionCanvas,c,f);var g=this.bodyBackgroundCanvas.dom.getContext("2d");g.save();g.fillStyle=this.calendarColorScheme.stripnormal;g.fillRect(0,
0,c,f);g.fillStyle=this.calendarColorScheme.stripworking;for(var h=0,k=a.length;h<k;h++){var l=a[h];l.workingDay&&g.fillRect(l.left,e,l.right-l.left,d-e)}d=this.parentView.timeUnitHeight;e=Math.round(f/d);for(h=0;h<e;h++)g.strokeStyle=this.calendarColorScheme.linenormal,k=(h+1)*d-1,g.strokeLine(0,k+.5,c,k+.5);g.strokeStyle=this.calendarColorScheme.linenormal;h=0;for(k=a.length;h<k;h++)l=a[h],g.strokeLine(l.left+.5,0,l.left+.5,f),l.today&&(b=l);g.strokeLine(c-.5,0,c-.5,f);Ext.isDefined(b)&&(g.strokeStyle=
this.headerBackgroundCanvasStylingElementActive.getStyle("background-color"),g.strokeLine(b.left+.5,0,b.left+.5,f),g.strokeLine(b.right-.5,0,b.right-.5,f));g.restore()},drawCurrentTimeIndicator:function(){if(this.parentView){var a=this.parentView.numHours*this.parentView.getHourHeight(),a=Math.floor(this.getDateVerticalPosition(new Date)*a);this.indicatorIcon.setTop(a-6);this.indicatorLine.setWidth(this.width+this.leftOffset);this.indicatorLine.setTop(a-.5)}},eventInHeader:function(a){var b=this.getHeaderActionCanvas(),
c=a.getPageX()-b.getX();a=a.getPageY()-b.getY();return a>this.parentView.headerTextHeight?!1:!Ext.isEmpty(this.screenLocationToDate(c,a))},getCursorForBodyAppointment:function(a,b){return a.eventOverBodyStartHandle(b)?"n-resize":a.eventOverBodyDueHandle(b)?"s-resize":"move"},onBodyMove:function(a){var b="default",c=!1;if(this.appointmentOver&&this.appointmentOver.eventOverBody(a))c=this.appointmentOver;else for(var d=0,e=this.appointments.length;d<e;d++){var f=this.appointments[d];if(f.eventOverBody(a)){c=
f;break}}c&&(b=this.getCursorForBodyAppointment(c,a));this.appointmentOver===c||this.bodyDragZone&&!1!==this.bodyDragZone.dragging||this.headerDragZone&&!1!==this.headerDragZone.dragging||(this.appointmentOver&&this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord(),a),(this.appointmentOver=c)&&this.fireEvent("appointmentmouseover",this,c.getRecord(),a));this.getBodyActionCanvas().dom.style.cursor=b},onBodyOut:function(a){this.appointmentOver&&!this.appointmentOver.eventOverBody(a)&&
(this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord(),a),this.appointmentOver=!1)},getCursorForHeaderAppointment:function(a,b){return a.eventOverHeaderStartHandle(b)?"w-resize":a.eventOverHeaderDueHandle(b)?"e-resize":"move"},onHeaderMove:function(a){var b="default",c=!1;if(this.eventInHeader(a))b="pointer";else if(this.appointmentOver&&this.appointmentOver.eventOverHeader(a))c=this.appointmentOver;else for(var d=0,e=this.appointments.length;d<e;d++){var f=this.appointments[d];
if(f.eventOverHeader(a)){c=f;break}}c&&(b=this.getCursorForHeaderAppointment(c,a));this.appointmentOver!==c&&(this.appointmentOver&&this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord(),a),(this.appointmentOver=c)&&this.fireEvent("appointmentmouseover",this,c.getRecord(),a));this.getHeaderActionCanvas().dom.style.cursor=b},onHeaderOut:function(a){this.appointmentOver&&!this.appointmentOver.eventOverBody(a)&&(this.fireEvent("appointmentmouseout",this,this.appointmentOver.getRecord(),
a),this.appointmentOver=!1)},onHeaderClick:function(a){this.eventInHeader(a)&&(a=a.getXY(),a=this.screenLocationToDate(a[0],a[1]),this.fireEvent("dayclick",this,a))},onMouseMove:function(a){var b={x:this.header.getX(),y:this.header.getY(),width:this.header.getWidth(),height:this.header.getHeight()};if(Zarafa.core.Util.inside(b,a.getPageX(),a.getPageY()))this.onHeaderMove(a);else this.onBodyMove(a)},getRecordForHeaderEvent:function(a){for(var b=0,c=this.appointments.length;b<c;b++){var d=this.appointments[b];
if(d.eventOverHeader(a))return d.getRecord()}},onHeaderDblClick:function(a){var b=this.getRecordForHeaderEvent(a);this.fireEvent("dblclick",this,a,b)},onHeaderContextMenu:function(a){var b=this.getRecordForHeaderEvent(a),c;b||(c=a.getXY(),c=this.screenLocationToDateRange(c[0],c[1]));this.fireEvent("contextmenu",this,a,b,c)},getRecordForBodyEvent:function(a){for(var b=0,c=this.appointments.length;b<c;b++){var d=this.appointments[b];if(d.eventOverBody(a))return d.getRecord()}},onBodyDblClick:function(a){var b=
this.getRecordForBodyEvent(a);this.fireEvent("dblclick",this,a,b)},onBodyContextMenu:function(a){var b=this.getRecordForBodyEvent(a),c;b||(c=a.getXY(),c=this.screenLocationToDateRange(c[0],c[1]));this.fireEvent("contextmenu",this,a,b,c)},onAppointmentDeselect:function(a,b){var c=this.findAppointment(b);Zarafa.calendar.ui.canvas.CalendarDaysView.superclass.onAppointmentDeselect.call(this,a,b);if(c){var d=(c=c.isHeaderRange())?this.headerSelectionCanvas:this.bodySelectionCanvas;Zarafa.resizeCanvas(d,
d.getWidth(),d.getHeight());if(a.hasSelection())for(var d=0,e=this.appointments.length;d<e;d++){var f=this.appointments[d];c==f.isHeaderRange()&&f.setSelected(f.isSelected())}}},onAppointmentSelectionClear:function(a){Zarafa.calendar.ui.canvas.CalendarDaysView.superclass.onAppointmentSelectionClear.call(this,a);Zarafa.resizeCanvas(this.bodySelectionCanvas,this.bodySelectionCanvas.getWidth(),this.bodySelectionCanvas.getHeight());Zarafa.resizeCanvas(this.headerSelectionCanvas,this.headerSelectionCanvas.getWidth(),
this.headerSelectionCanvas.getHeight())},onLayout:function(){Zarafa.calendar.ui.canvas.CalendarDaysView.superclass.onLayout.call(this);155>Zarafa.core.ColorSchemes.getLuma(this.calendarColorScheme.base)?this.headerBackgroundCanvasStylingElement.removeClass("light-background"):this.headerBackgroundCanvasStylingElement.addClass("light-background");var a=this.calculateDayLayoutPositions();this.drawHeader(a);this.drawBody(a);this.getDateRange().containsDate(new Date)?(this.setIndicatorDisplayed(!0),this.drawCurrentTimeIndicator(),
Ext.isDefined(this.indicatorTask)||(this.indicatorTask=Ext.TaskMgr.start({run:function(){this.drawCurrentTimeIndicator()},scope:this,interval:6E4}))):(this.setIndicatorDisplayed(!1),this.indicatorTask&&Ext.TaskMgr.stop(this.indicatorTask))},setIndicatorDisplayed:function(a){this.indicatorIcon.setDisplayed(a);this.indicatorLine.setDisplayed(a)}});Ext.namespace("Zarafa.contact");
Zarafa.contact.ContactContext=Ext.extend(Zarafa.core.Context,{oldView:void 0,oldViewMode:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{current_view:Zarafa.contact.data.Views.LIST,current_view_mode:Zarafa.contact.data.ViewModes.NORMAL});this.registerInsertionPoint("main.maintoolbar.new.item",this.createNewContactButton,this);this.registerInsertionPoint("main.maintoolbar.new.item",this.createNewDistributionListButton,this);this.registerInsertionPoint("context.common.recipientfield.contextmenu.actions",
this.createContactFromRecipientButton,this);this.registerInsertionPoint("main.maintabbar.left",this.createMainTab,this);Zarafa.contact.ContactContext.superclass.constructor.call(this,a);this.registerInsertionPoint("navigation.center",this.createContactNavigationPanel,this);Zarafa.core.data.SharedComponentType.addProperty("contact.detailsparser");Zarafa.core.data.SharedComponentType.addProperty("contact.dialog.contact.namedetails");Zarafa.core.data.SharedComponentType.addProperty("contact.dialog.contact.addressdetails");
Zarafa.core.data.SharedComponentType.addProperty("contact.dialog.contact.phonedetails");Zarafa.core.data.SharedComponentType.addProperty("contact.dialog.distlist.externalmember");a=container.getServerConfig().getContactPrefix();Ext.isDefined(a)&&Array.isArray(a)&&(Zarafa.contact.data.config.Prefix=Zarafa.contact.data.config.Prefix.concat(a));a=container.getServerConfig().getContactSuffix();Ext.isDefined(a)&&Array.isArray(a)&&(Zarafa.contact.data.config.Suffix=Zarafa.contact.data.config.Suffix.concat(a))},
getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.contact.ContactContextModel,this.model.on({searchstart:this.onModelSearchStart,searchstop:this.onModelSearchStop,scope:this}));return this.model},onModelSearchStart:function(a){this.getCurrentView()!==Zarafa.contact.data.Views.SEARCH&&this.getCurrentViewMode()!==Zarafa.contact.data.ViewModes.SEARCH&&(this.oldView=this.getCurrentView(),this.oldViewMode=this.getCurrentViewMode(),this.switchView(Zarafa.contact.data.Views.SEARCH,Zarafa.contact.data.ViewModes.SEARCH))},
onModelSearchStop:function(a){this.switchView(this.oldView,this.oldViewMode);delete this.oldView;delete this.oldViewMode},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:case Zarafa.core.data.SharedComponentType["common.preview"]:if(b instanceof Zarafa.core.data.IPMRecord&&b.isMessageClass(["IPM.Contact","IPM.DistList"],!0))c=1;else if(b instanceof Zarafa.core.data.MAPIRecord){var d=
b.get("entryid");d&&Zarafa.core.EntryId.hasContactProviderGUID(d)&&(c=1)}break;case Zarafa.core.data.SharedComponentType["contact.dialog.contact.namedetails"]:case Zarafa.core.data.SharedComponentType["contact.dialog.contact.addressdetails"]:case Zarafa.core.data.SharedComponentType["contact.dialog.contact.phonedetails"]:case Zarafa.core.data.SharedComponentType["contact.dialog.distlist.externalmember"]:c=1;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.IPMRecord&&
b.isMessageClass(["IPM.Contact","IPM.DistList"],!0)?c=1:b instanceof Zarafa.core.data.IPMAttachmentRecord&&b.isContactPhoto()&&(c=2);break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?b.isMessageClass(["IPM.Contact","IPM.DistList"],!0)&&(c=1):b instanceof Zarafa.contact.ContactContext&&(c=-1);break;case Zarafa.core.data.SharedComponentType["contact.detailsparser"]:c=1;break;
case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:b instanceof Zarafa.hierarchy.data.MAPIFolderRecord&&b.isContainerClass("IPF.Contact",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.isMessageClass(["IPM.Contact","IPM.DistList"],!0)&&(c=1)}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:if(b instanceof
Zarafa.core.data.IPMRecord)b.isMessageClass("IPM.Contact",!0)?c=Zarafa.contact.dialogs.ContactContentPanel:b.isMessageClass("IPM.DistList",!0)&&(c=Zarafa.contact.dialogs.DistlistContentPanel);else if(b instanceof Zarafa.core.data.MAPIRecord){var d=b.get("entryid");d&&Zarafa.core.EntryId.hasContactProviderGUID(d)&&(b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MAILUSER?c=Zarafa.contact.dialogs.ContactContentPanel:b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&(c=Zarafa.contact.dialogs.DistlistContentPanel))}break;
case Zarafa.core.data.SharedComponentType["common.preview"]:c=Zarafa.contact.ui.ContactPreviewPanel;break;case Zarafa.core.data.SharedComponentType["contact.dialog.contact.namedetails"]:c=Zarafa.contact.dialogs.ContactNameContentPanel;break;case Zarafa.core.data.SharedComponentType["contact.dialog.contact.addressdetails"]:c=Zarafa.contact.dialogs.ContactAddressContentPanel;break;case Zarafa.core.data.SharedComponentType["contact.dialog.contact.phonedetails"]:c=Zarafa.contact.dialogs.ContactPhoneContentPanel;
break;case Zarafa.core.data.SharedComponentType["contact.dialog.distlist.externalmember"]:c=Zarafa.contact.dialogs.DistlistExternalMemberContentPanel;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=b instanceof Zarafa.core.data.IPMAttachmentRecord&&b.isContactPhoto()?Zarafa.contact.ui.ContactPhotoContextMenu:Zarafa.contact.ui.ContactContextMenu;break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:c=b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===
Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?b.isMessageClass("IPM.Contact",!0)?Zarafa.contact.printer.ContactRenderer:Zarafa.contact.printer.DistlistRenderer:void 0;break;case Zarafa.core.data.SharedComponentType["contact.detailsparser"]:c=Zarafa.contact.data.ContactDetailsParser;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:c=Zarafa.contact.attachitem.AttachContactColumnModel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:c=
b.isMessageClass("IPM.DistList",!0)?Zarafa.contact.attachitem.AttachDistlistRenderer:Zarafa.contact.attachitem.AttachContactRenderer}return c},createContactNavigationPanel:function(){return{xtype:"zarafa.contextnavigation",context:this,items:[{xtype:"panel",id:"zarafa-navigationpanel-contacts-navigation",cls:"zarafa-context-navigation-block",layout:"fit",items:[{xtype:"zarafa.hierarchytreepanel",id:"zarafa-navigationpanel-contacts-navigation-tree",model:this.getModel(),IPMFilter:"IPF.Contact",hideDeletedFolders:!0,
enableDD:!0,enableItemDrop:!0,deferredLoading:!0,bbarConfig:{defaultSelectedSharedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.CONTACT,buttonText:_("Open Shared Contacts")}}]}]}},bid:function(a){return a.isContainerClass("IPF.Contact",!0)?1:-1},createContentPanel:function(){return{xtype:"zarafa.contactmainpanel",id:"zarafa-mainpanel-contentpanel-contacts",context:this}},getMainToolbarViewButtons:function(){var a=container.populateInsertionPoint("main.maintoolbar.view.contact",this)||[];return[{id:"zarafa-maintoolbar-view-contacts-businesscards",
text:_("Business Cards"),overflowText:_("Business Cards"),iconCls:"icon_contact_card_view",valueView:Zarafa.contact.data.Views.ICON,valueViewMode:Zarafa.contact.data.ViewModes.BUSINESS,valueDataMode:Zarafa.contact.data.DataModes.CHARACTER_RESTRICT,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-contacts-phonlist",text:_("Phone List"),overflowText:_("Phone List"),iconCls:"icon_contact_list",valueView:Zarafa.contact.data.Views.LIST,valueViewMode:Zarafa.contact.data.ViewModes.NORMAL,
valueDataMode:Zarafa.contact.data.DataModes.ALL,handler:this.onContextSelectView,scope:this}].concat(a)},onContextSelectView:function(a){this.getModel().setDataMode(a.valueDataMode);this.switchView(a.valueView,a.valueViewMode)},createNewContactButton:function(){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-contact",text:_("Contact"),tooltip:_("Contact")+" (Ctrl + Alt + C)",plugins:"zarafa.menuitemtooltipplugin",handler:function(){Zarafa.contact.Actions.openCreateContactContent(this.getModel())},
scope:this,iconCls:"icon_createContact",newMenuIndex:3,context:"contact"}},createContactFromRecipientButton:function(a,b){return{xtype:"zarafa.conditionalitem",text:_("Add to contacts"),iconCls:"icon_new_contact",handler:Zarafa.contact.Actions.openRecipientContactContent,scope:this}},getMainToolbarPrintButtons:function(){var a=container.populateInsertionPoint("main.toolbar.print.contact",this)||[];return[{xtype:"zarafa.conditionalitem",id:"zarafa-maintoolbar-print-selectedcontact",overflowText:_("Print selected contact"),
iconCls:"icon_print_single_contact",tooltip:_("Print selected contact")+" (Ctrl + P)",plugins:"zarafa.menuitemtooltipplugin",text:_("Print selected contact"),hideOnDisabled:!1,singleSelectOnly:!0,handler:this.onPrintSingle,scope:this}].concat(a)},onPrintSingle:function(){var a=this.getModel().getSelectedRecords();Ext.isEmpty(a)?Ext.MessageBox.alert(_("Print"),_("No contact selected")):Zarafa.common.Actions.openPrintDialog(a)},createNewDistributionListButton:function(a){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-distlist",
tooltip:_("Distribution list")+" (Ctrl + Alt + D)",plugins:"zarafa.menuitemtooltipplugin",text:_("Distribution list"),handler:function(){Zarafa.contact.Actions.openCreateDistlistContent(this.getModel())},scope:this,iconCls:"icon_createDistributionList",newMenuIndex:3,context:"contact"}},createMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:4,context:this.getName(),id:"mainmenu-button-contacts"}},onViewModeChange:function(a,b,c){a=this.getModel();switch(b){case Zarafa.contact.data.ViewModes.SEARCH:case Zarafa.contact.data.ViewModes.NORMAL:a.clearGrouping();
break;case Zarafa.contact.data.ViewModes.GROUP_CATEGORY:a.groupBy("categories");break;case Zarafa.contact.data.ViewModes.GROUP_COMPANY:a.groupBy("company_name");break;case Zarafa.contact.data.ViewModes.GROUP_LOCATION:a.groupBy("office_location")}}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"contact",displayName:_("Contacts"),allowUserVisible:!1,pluginConstructor:Zarafa.contact.ContactContext}))});Ext.namespace("Zarafa.contact");
Zarafa.contact.ContactStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"IPM.Contact",defaultSortInfo:{field:"fileas",direction:"desc"}});Zarafa.contact.ContactStore.superclass.constructor.call(this,a)}});Ext.reg("zarafa.contactstore",Zarafa.contact.ContactStore);Ext.namespace("Zarafa.contact");
Zarafa.contact.DistlistMemberStore=Ext.extend(Zarafa.core.data.MAPISubStore,{customObjectType:Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,constructor:function(a){a=a||{};Ext.applyIf(a,{writer:new Zarafa.contact.data.JsonMemberWriter,reader:new Zarafa.contact.data.JsonMemberReader({customObjectType:a.customObjectType||this.customObjectType})});Zarafa.contact.DistlistMemberStore.superclass.constructor.call(this,a)},parseMember:function(a){var b=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(this.customObjectType),
c=a.indexOf("<"),d=a.indexOf(">");if(-1!=c&&-1==d||-1==c&&-1!=d)return null;b.beginEdit();-1!=c?(b.set("display_name",a.substring(0,c-1).trim()),b.set("email_address",a.substring(c+1,d).trim())):(b.set("display_name",a),Zarafa.core.Util.validateEmailAddress(a)?b.set("email_address",a):b.set("email_address",""));b.set("address_type","SMTP");b.set("distlist_type",Zarafa.core.mapi.DistlistType.DL_EXTERNAL_MEMBER);b.endEdit();return b}});Ext.namespace("Zarafa.contact.ui");
Zarafa.contact.ui.MemberBoxField=Ext.extend(Zarafa.common.recipientfield.ui.RecipientField,{constructor:function(a){a=a||{};Ext.applyIf(a,{boxType:"zarafa.memberbox",enableComboBox:!1,editable:!0,height:30});Ext.apply(a,{defaultRecipientType:void 0,filterRecipientType:void 0});Zarafa.contact.ui.MemberBoxField.superclass.constructor.call(this,a)},setMemberStore:function(a){return this.setBoxStore.apply(this,arguments)},getMemberStore:function(){return this.getBoxStore()},update:function(a,b){a&&a instanceof
Zarafa.core.data.MAPIRecord?b&&a.isOpened()&&this.setMemberStore(a.getMemberStore()):Zarafa.contact.ui.MemberBoxField.superclass.update.apply(this,arguments)},filterRecord:function(a){return!0},handleInput:function(a){a=a.split(this.delimiterCharacter);for(var b=[],c=0;c<a.length;c++){var d=a[c].trim();Ext.isEmpty(d)||(d=this.boxStore.parseMember(d),b.push(d))}0<b.length&&this.boxStore.add(b)},onBoxDblClick:function(a,b,c){b.isValidRecord(c)&&Zarafa.contact.Actions.openDistlistMember(c)},onBoxContextMenu:Ext.emptyFn});
Ext.reg("zarafa.memberboxfield",Zarafa.contact.ui.MemberBoxField);Ext.namespace("Zarafa.hierarchy");
Zarafa.hierarchy.HierarchyContext=Ext.extend(Zarafa.core.Context,{constructor:function(a){a=a||{};Ext.applyIf(a,{hasToolbar:!1,hasContentPanel:!1});Zarafa.hierarchy.HierarchyContext.superclass.constructor.call(this,a);Zarafa.core.data.SharedComponentType.addProperty("hierarchy.dialog.folderselection");Zarafa.core.data.SharedComponentType.addProperty("hierarchy.dialog.folderproperties");Zarafa.core.data.SharedComponentType.addProperty("hierarchy.dialog.foldersize");Zarafa.core.data.SharedComponentType.addProperty("hierarchy.dialog.opensharedfolder")},
bidSharedComponent:function(a,b){var c=-1;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.MAPIRecord&&(b.get("object_type")!=Zarafa.core.mapi.ObjectType.MAPI_FOLDER||b.isSearchFolder()||(c=1));break;case Zarafa.core.data.SharedComponentType["hierarchy.dialog.folderselection"]:case Zarafa.core.data.SharedComponentType["hierarchy.dialog.folderproperties"]:case Zarafa.core.data.SharedComponentType["hierarchy.dialog.foldersize"]:case Zarafa.core.data.SharedComponentType["hierarchy.dialog.opensharedfolder"]:c=
1}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:c=Zarafa.hierarchy.dialogs.CreateFolderContentPanel;break;case Zarafa.core.data.SharedComponentType["hierarchy.dialog.folderselection"]:c=Zarafa.hierarchy.dialogs.FolderSelectionContentPanel;break;case Zarafa.core.data.SharedComponentType["hierarchy.dialog.folderproperties"]:c=Zarafa.hierarchy.dialogs.FolderPropertiesContentPanel;break;case Zarafa.core.data.SharedComponentType["hierarchy.dialog.foldersize"]:c=
Zarafa.hierarchy.dialogs.FolderSizeContentPanel;break;case Zarafa.core.data.SharedComponentType["hierarchy.dialog.opensharedfolder"]:c=Zarafa.hierarchy.dialogs.SharedFolderContentPanel;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=Zarafa.hierarchy.ui.ContextMenu}return c}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"hierarchy",allowUserVisible:!1,pluginConstructor:Zarafa.hierarchy.HierarchyContext}))});Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.MAPIFolderRecordFields=[{name:"entryid"},{name:"parent_entryid"},{name:"store_entryid"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_FOLDER},{name:"folder_type",type:"int",defaultValue:Zarafa.core.mapi.MAPIFolderType.FOLDER_GENERIC},{name:"folder_pathname"},{name:"display_name"},{name:"container_class",type:"string",defaultValue:"IPF.Note"},{name:"content_count",type:"int",defaultValue:0},{name:"content_unread",type:"int",defaultValue:0},{name:"has_subfolder",
type:"boolean",defaultValue:!1},{name:"comment",type:"string"},{name:"creation_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"message_size",type:"int"},{name:"total_message_size",type:"int"},{name:"deleted_on",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"rights",type:"int"},{name:"access",type:"int"},{name:"extended_flags",type:"int",defaultValue:0},{name:"assoc_content_count",type:"int",defaultValue:0},{name:"is_unavailable",type:"boolean",defaultValue:!1},{name:"isFavorites",
type:"boolean",defaultValue:!1}];Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,Zarafa.hierarchy.data.MAPIFolderRecordFields);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,"permissions",Zarafa.hierarchy.data.MAPIFolderPermissionsSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,"folders",Zarafa.hierarchy.data.MAPIFolderSubStore);
Zarafa.core.data.RecordFactory.addListenerToObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,"createphantom",function(a){a.afterOpen()});
Zarafa.hierarchy.data.MAPIFolderRecord=Ext.extend(Zarafa.core.data.IPFRecord,{commit:function(){this.cacheParentFolder&&(Zarafa.core.EntryId.compareEntryIds(this.get("parent_entryid"),this.cacheParentFolder.get("entryid"))||delete this.cacheParentFolder);Zarafa.hierarchy.data.MAPIFolderRecord.superclass.commit.apply(this,arguments)},getMAPIStore:function(){var a=this.getStore();if(a&&a instanceof Zarafa.hierarchy.data.IPFSubStore)return a.getParentRecord();a=container.getHierarchyStore();return a.getById(this.get("store_entryid"))},
getMAPIFolderStore:function(){var a=this.getMAPIStore();return a?a.getSubStore("folders"):!1},isSpecialFolder:function(a){return this.getDefaultFolderKey()===a},isOwnRoot:function(){return this.isIPMSubTree()&&this.getMAPIStore().isDefaultStore()},getSharedFolderKey:function(){var a=this.getMAPIStore();if(a)return a.getSharedFolderKey(this.get("entryid"))},isSharedFolder:function(){return Ext.isDefined(this.getSharedFolderKey())?!0:!1},getDefaultFolderKey:function(){var a=this.getMAPIStore();if(a)return a.getDefaultFolderKey(this.get("entryid"))},
isDefaultFolder:function(){return Ext.isDefined(this.getDefaultFolderKey())?!0:!1},isIPMSubTree:function(){var a=this.getMAPIStore();return a?Zarafa.core.EntryId.compareEntryIds(this.get("entryid"),a.get("subtree_entryid")):!1},isTodoListFolder:function(){var a=container.getHierarchyStore().getDefaultStore();return a?Zarafa.core.EntryId.compareEntryIds(this.get("entryid"),a.get("default_folder_todolist")):!1},isFavoritesRootFolder:function(){var a=container.getHierarchyStore().getDefaultStore();return a?
Zarafa.core.EntryId.compareEntryIds(this.get("entryid"),a.get("common_view_entryid")):!1},isFavoritesFolder:function(){return this.get("isFavorites")},isRSSFolder:function(){return Zarafa.core.ContainerClass.isClass(this.get("container_class"),"IPF.Note.OutlookHomepage",!0)&&this.getParentFolder().isIPMSubTree()},isCalendarFolder:function(){return Zarafa.core.ContainerClass.isClass(this.get("container_class"),"IPF.Appointment",!0)},isSearchFolder:function(){return this.get("folder_type")===Zarafa.core.mapi.MAPIFolderType.FOLDER_SEARCH},
getDisplayName:function(){return this.isIPMSubTree()?this.getMAPIStore().get("display_name"):this.isFavoritesRootFolder()?_("Favorites"):this.get("display_name")},getFullyQualifiedDisplayName:function(){var a=this.getMAPIStore();return this.isIPMSubTree()?this.getDisplayName():a.isPublicStore()?String.format(_("{0} in {1}"),this.getDisplayName(),a.get("display_name")):a.isSharedStore()?String.format(_("{0} of {1}"),this.getDisplayName(),a.get("mailbox_owner_name")):this.getDisplayName()},getParentFolder:function(){if(!this.cacheParentFolder){var a=
this.get("parent_entryid");this.isIPMSubTree()||Ext.isEmpty(a)||(this.cacheParentFolder=this.getMAPIFolderStore().getById(a));this.cacheParentFolder&&(this.cacheParentFolder.data.has_subfolder=!0)}return this.cacheParentFolder},isInDeletedItems:function(){var a=this.getMAPIStore();return a&&a.isDefaultStore()&&(a=this.getParentFolder())&&!a.isIPMSubTree()?a.isSpecialFolder("wastebasket")||a.isSpecialFolder("junk")?!0:a.isInDeletedItems():!1},getPath:function(){for(var a="",b=this.getParentFolder();b;)a=
"\\"+b.getDisplayName()+a,b.isIPMSubTree()&&(a="\\"+a),b=b.getParentFolder();return a},isFavoriteFolder:function(){return this.isSpecialFolder("favorites")},existsInFavorites:function(){var a=this.getMAPIStore().getFavoritesStore();return Ext.isDefined(a)?-1!==a.find("entryid",this.get("entryid")):!1},getFavoritesFolder:function(){return this.getMAPIStore().getFavoritesStore().getById(this.get("entryid"))},getFavoritesRootFolder:function(){return this.getMAPIStore().getFavoritesRootFolder()},addToFavorites:function(a){this.addMessageAction("action_type",
"addtofavorites");var b=this.isSearchFolder();b&&(this.addMessageAction("isSearchFolder",b),this.addMessageAction("search_store_entryid",a))},removeFromFavorites:function(){this.addMessageAction("action_type","removefavorites");var a=this.isSearchFolder();a&&this.addMessageAction("isSearchFolder",a)},emptyFolder:function(){this.addMessageAction("action_type","emptyfolder")},seadReadFlags:function(){this.addMessageAction("action_type","readflags")},getChildren:function(){var a=[];this.get("has_subfolder")&&
this.getMAPIFolderStore().each(function(b){this===b.getParentFolder()&&a.push(b)},this);return a},getCounterType:function(){var a=this.get("extended_flags");if((a&Zarafa.core.mapi.FolderExtendedFlags.DEFAULT)===Zarafa.core.mapi.FolderExtendedFlags.DEFAULT){if((a=this.isSpecialFolder("drafts")||this.isSpecialFolder("outbox")||this.isSpecialFolder("junk"))&&0<this.get("content_count"))return Zarafa.hierarchy.data.CounterTypes.TOTAL;if(!a&&0<this.get("content_unread"))return Zarafa.hierarchy.data.CounterTypes.UNREAD}else{if((a&
Zarafa.core.mapi.FolderExtendedFlags.USE_UNREAD_COUNT)===Zarafa.core.mapi.FolderExtendedFlags.USE_UNREAD_COUNT&&0<this.get("content_unread"))return Zarafa.hierarchy.data.CounterTypes.UNREAD;if((a&Zarafa.core.mapi.FolderExtendedFlags.USE_TOTAL_COUNT)===Zarafa.core.mapi.FolderExtendedFlags.USE_TOTAL_COUNT&&0<this.get("content_count"))return Zarafa.hierarchy.data.CounterTypes.TOTAL}return Zarafa.hierarchy.data.CounterTypes.NONE},getCounterValue:function(a){a||(a=this.getCounterType());switch(a){case Zarafa.hierarchy.data.CounterTypes.TOTAL:return this.get("content_count");
case Zarafa.hierarchy.data.CounterTypes.UNREAD:return this.get("content_unread")}}});Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,Zarafa.hierarchy.data.MAPIFolderRecord);Ext.namespace("Zarafa.hierarchy.data");
Zarafa.hierarchy.data.MAPIStoreRecordFields=[{name:"store_entryid"},{name:"common_view_entryid"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_STORE},{name:"display_name",type:"string"},{name:"mdb_provider"},{name:"subtree_entryid"},{name:"store_support_mask",type:"int"},{name:"store_size",type:"int",defaultValue:null},{name:"quota_warning",type:"int",defaultValue:null},{name:"quota_soft",type:"int",defaultValue:null},{name:"quota_hard",type:"int",defaultValue:null},
{name:"user_name",type:"string"},{name:"mailbox_owner_entryid"},{name:"mailbox_owner_name"},{name:"default_folder_inbox"},{name:"default_folder_outbox"},{name:"default_folder_sent"},{name:"default_folder_wastebasket"},{name:"default_folder_favorites"},{name:"default_folder_publicfolders"},{name:"default_folder_calendar"},{name:"default_folder_contact"},{name:"default_folder_drafts"},{name:"default_folder_journal"},{name:"default_folder_note"},{name:"default_folder_task"},{name:"default_folder_todolist"},
{name:"default_folder_junk"},{name:"default_folder_syncissues"},{name:"default_folder_conflicts"},{name:"default_folder_localfailures"},{name:"default_folder_serverfailures"},{name:"shared_folder_all"},{name:"shared_folder_inbox"},{name:"shared_folder_calendar"},{name:"shared_folder_contact"},{name:"shared_folder_note"},{name:"shared_folder_task"}];Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_STORE,Zarafa.hierarchy.data.MAPIStoreRecordFields);
Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_STORE,"folders",Zarafa.hierarchy.data.IPFSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_STORE,"favorites",Zarafa.common.favorites.data.MAPIFavoritesSubStore);Zarafa.core.data.RecordFactory.addListenerToObjectType(Zarafa.core.mapi.ObjectType.MAPI_STORE,"createphantom",function(a){a.afterOpen()});
Zarafa.hierarchy.data.MAPIStoreRecord=Ext.extend(Zarafa.core.data.IPFRecord,{baseIdProperties:["store_entryid","user_name"],getFolder:function(a){var b=this.getFolderStore();if(b)return b.getById(a)},hasSearchSupport:function(){return this.get("store_support_mask")&&Zarafa.core.mapi.StoreSupportMask.hasSearchSupport(this.get("store_support_mask"))?!0:!1},isPublicStore:function(){return this.get("mdb_provider")===Zarafa.core.mapi.MDBProvider.ZARAFA_STORE_PUBLIC_GUID},isDefaultStore:function(){return this.get("mdb_provider")===
Zarafa.core.mapi.MDBProvider.ZARAFA_SERVICE_GUID},isSharedStore:function(){return this.get("mdb_provider")===Zarafa.core.mapi.MDBProvider.ZARAFA_STORE_DELEGATE_GUID},isArchiveStore:function(){return this.get("mdb_provider")===Zarafa.core.mapi.MDBProvider.ZARAFA_STORE_ARCHIVER_GUID},getDefaultFolderKey:function(a){for(var b in this.data)if(0===b.indexOf("default_folder_")&&this.get(b)==a)return b.substring(15)},getDefaultFolder:function(a){if(a=this.get("default_folder_"+a))return this.getFolder(a)},
getSharedFolderKey:function(a){for(var b in this.data)if(0===b.indexOf("shared_folder_")&&this.get(b)==a)return b.substring(14)},getSharedFolder:function(a){if(a=this.get("shared_folder_"+a))return this.getFolder(a)},getSubtreeFolder:function(){return this.getFolder(this.get("subtree_entryid"))},getFavoritesRootFolder:function(){var a=container.getHierarchyStore().getDefaultStore();return a?a.getFolder(this.get("common_view_entryid")):!1},getMessageActions:Ext.emptyFn,addMessageAction:Ext.emptyFn,
deleteMessageAction:Ext.emptyFn,clearMessageActions:Ext.emptyFn,copyTo:Ext.emptyFn,moveTo:Ext.emptyFn,supportsFolders:function(){return this.supportsSubStore("folders")},createFolderStore:function(){return this.createSubStore("folders")},setFolderStore:function(a){return this.setSubStore("folders",a)},getFolderStore:function(){return this.getSubStore("folders")},getFavoritesStore:function(){var a=container.getHierarchyStore().getDefaultStore();return a?a.getSubStore("favorites"):!1}});
Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_STORE,Zarafa.hierarchy.data.MAPIStoreRecord);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.SharedFolderContentPanel=Ext.extend(Zarafa.core.ui.ContentPanel,{defaultSelectedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.ALL,store:void 0,constructor:function(a){a=a||{};a.store||(a.store=new Zarafa.core.data.IPMRecipientStore({allowResolvingToLocalContacts:!1,allowResolvingToGABGroups:!1}));a=Ext.applyIf(a,{xtype:"zarafa.sharedfoldercontentpanel",layout:"fit",title:_("Open Shared Folders"),width:330,height:250,items:[{xtype:"zarafa.sharedfolderpanel",ref:"sharedFolderPanel",
store:a.store,defaultSelectedFolderType:a.defaultSelectedFolderType||this.defaultSelectedFolderType,buttons:[{text:_("Ok"),handler:this.onOk,scope:this},{text:_("Cancel"),handler:this.onCancel,scope:this}]}]});Zarafa.hierarchy.dialogs.SharedFolderContentPanel.superclass.constructor.call(this,a)},onOk:function(){if(this.store&&0<this.store.getCount()){var a=this.store.getAt(0);if(a.isResolved()||a.attemptedToResolve())if(a.isResolved())if(a.get("display_type")!==Zarafa.core.mapi.DisplayType.DT_MAILUSER)Ext.MessageBox.show({title:_("Kopano WebApp"),
msg:String.format(_("Username '{0}' is not a valid user."),a.get("display_name")),icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK});else if(a.get("email_address")===container.getUser().getEmailAddress())Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("It is not possible to open your own store twice"),icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK});else{var a=a.get("email_address"),b=this.sharedFolderPanel.getFolderOptions();container.getHierarchyStore().open(a,b.type,b.subfolders)?this.close():
Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("This shared folder is already open."),icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK})}else Ext.MessageBox.show({title:_("Kopano WebApp"),msg:String.format(_("Username '{0}' could not be resolved."),a.get("display_name")),icon:Ext.MessageBox.ERROR,buttons:Ext.MessageBox.OK});else this.mon(this.store,"resolved",this.onOk,this,{single:!0})}else Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("You must specify a username."),icon:Ext.MessageBox.ERROR,
buttons:Ext.MessageBox.OK})},onCancel:function(){this.close()}});Ext.reg("zarafa.sharedfoldercontentpanel",Zarafa.hierarchy.dialogs.SharedFolderContentPanel);Ext.namespace("Zarafa.hierarchy.dialogs");
Zarafa.hierarchy.dialogs.SharedFolderPanel=Ext.extend(Ext.Panel,{defaultSelectedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.ALL,store:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{layout:"form",border:!1,labelWidth:80,flex:1,items:[this.createRecipientField(a.store),this.createFolderTypeCombo(a.defaultSelectedFolderType),this.createSubfolderSelection()]});Zarafa.hierarchy.dialogs.SharedFolderPanel.superclass.constructor.call(this,a)},createRecipientField:function(a){return{xtype:"zarafa.compositefield",
hideLabel:!0,style:"margin-top: 10px; margin-bottom: 10px;",anchor:"100%",items:[{xtype:"button",width:80,text:_("Name")+":",handler:this.onSelectUser,scope:this},{xtype:"zarafa.addressbookboxfield",ref:"../userField",boxStore:a,flex:1,boxLimit:1,boxConfig:{validDisplayType:Zarafa.core.mapi.DisplayType.DT_MAILUSER}}]}},createFolderTypeCombo:function(a){return{xtype:"combo",fieldLabel:_("Folder type"),typeAhead:!0,triggerAction:"all",lazyRender:!0,mode:"local",style:"margin-bottom: 10px;",anchor:"100%",
value:a,store:new Ext.data.JsonStore({fields:["value","name"],data:Zarafa.hierarchy.data.SharedFolderTypes.folders}),lazyInit:!1,editable:!1,displayField:"name",valueField:"value",ref:"folderTypeCombo",listeners:{select:this.onFolderTypeSelect,scope:this}}},createSubfolderSelection:function(){return{xtype:"checkbox",ref:"checkSubFolders",boxLabel:_("Show subfolders"),anchor:"100%"}},onRender:function(){Zarafa.hierarchy.dialogs.SharedFolderPanel.superclass.onRender.apply(this,arguments);this.updateSubFolderCheckBox()},
onSelectUser:function(){Zarafa.common.Actions.openABUserSelectionContent({callback:this.abCallBack,scope:this,hideContactsFolders:!0,listRestriction:{hide_users:["contact","system"],hide_groups:!0,hide_companies:!0}})},abCallBack:function(a){this.store.removeAll();this.store.add(a.convertToRecipient())},onFolderTypeSelect:function(a,b){this.updateSubFolderCheckBox()},updateSubFolderCheckBox:function(){var a=this.folderTypeCombo.getValue()!==Zarafa.hierarchy.data.SharedFolderTypes.ALL;this.checkSubFolders.setDisabled(!a)},
getFolderOptions:function(){return{type:this.folderTypeCombo.getValue(),subfolders:this.checkSubFolders.getValue()}}});Ext.reg("zarafa.sharedfolderpanel",Zarafa.hierarchy.dialogs.SharedFolderPanel);Ext.namespace("Zarafa.mail");
Zarafa.mail.MailContext=Ext.extend(Zarafa.core.Context,{oldView:void 0,oldViewMode:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{current_view:Zarafa.mail.data.Views.LIST,current_view_mode:Zarafa.mail.data.ViewModes.RIGHT_PREVIEW});Zarafa.mail.MailContext.superclass.constructor.call(this,a);this.registerInsertionPoint("main.maintoolbar.new.item",this.createNewMailButton,this);this.registerInsertionPoint("main.maintabbar.left",this.createMainTab,this);this.registerInsertionPoint("navigation.center",
this.createMailNavigationPanel,this);this.registerInsertionPoint("context.settings.categories",this.createSettingCategories,this);a=new Zarafa.common.ui.PreviewPanelToolbarButtons({model:this.getModel()});this.registerInsertionPoint("previewpanel.toolbar.right",a.getToolbarButtons,a);this.registerInsertionPoint("context.addressbook.contextmenu.actions",this.createSendEmailContextItem,this);this.registerInsertionPoint("context.contact.contextmenu.actions",this.createSendEmailContextItem,this);this.registerInsertionPoint("context.contact.contactcontentpanel.toolbar.actions",
this.createSendEmailButton,this);this.registerInsertionPoint("context.contact.distlistcontentpanel.toolbar.actions",this.createSendEmailButton,this);Zarafa.core.data.SharedComponentType.addProperty("mail.dialog.options");Zarafa.core.data.SharedComponentType.addProperty("mail.dialog.delayeddelivery")},getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.mail.MailContextModel,this.model.on({searchstart:this.onModelSearchStart,searchstop:this.onModelSearchStop,livescrollstart:this.onModelLiveScrollStart,
livescrollstop:this.onModelLiveScrollStop,scope:this}));return this.model},onModelLiveScrollStart:function(a){this.getCurrentView()!==Zarafa.mail.data.Views.LIVESCROLL&&this.getCurrentViewMode()!==Zarafa.mail.data.ViewModes.LIVESCROLL&&(Zarafa.mail.data.ViewModes.isMainViewMode(this.getCurrentViewMode())&&(this.oldView=this.getCurrentView(),this.oldViewMode=this.getCurrentViewMode()),this.switchView(Zarafa.mail.data.Views.LIVESCROLL,Zarafa.mail.data.ViewModes.LIVESCROLL))},onModelLiveScrollStop:function(a){Zarafa.mail.data.ViewModes.isMainViewMode(this.getCurrentViewMode())?
this.switchView(this.getCurrentView(),this.getCurrentViewMode()):this.switchView(this.oldView,this.oldViewMode);delete this.oldView;delete this.oldViewMode},onModelSearchStart:function(a){this.getCurrentView()!==Zarafa.mail.data.Views.SEARCH&&this.getCurrentViewMode()!==Zarafa.mail.data.ViewModes.SEARCH&&(Zarafa.mail.data.ViewModes.isMainViewMode(this.getCurrentViewMode())&&(this.oldView=this.getCurrentView(),this.oldViewMode=this.getCurrentViewMode()),this.switchView(Zarafa.mail.data.Views.SEARCH,
Zarafa.mail.data.ViewModes.SEARCH))},onModelSearchStop:function(a){this.switchView(this.oldView,this.oldViewMode);delete this.oldView;delete this.oldViewMode},bid:function(a){return a.isContainerClass("IPF.Note",!0)?1:a.isContainerClass("IPF",!0)?0:-1},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:case Zarafa.core.data.SharedComponentType["common.preview"]:b instanceof
Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&(c=b.isMessageClass(["IPM.Note","IPM.Schedule.Meeting","REPORT.IPM","REPORT.IPM.Note"],!0)?1:0);break;case Zarafa.core.data.SharedComponentType["mail.dialog.options"]:case Zarafa.core.data.SharedComponentType["mail.dialog.delayeddelivery"]:c=1;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&
(c=b.isMessageClass(["IPM.Note","IPM.TaskRequest","IPM.Schedule.Meeting","REPORT.IPM","REPORT.IPM.Note"],!0)?1:0);break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&b.isMessageClass(["IPM.Note","REPORT.IPM","REPORT.IPM.Note"],!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:b instanceof Zarafa.hierarchy.data.MAPIFolderRecord&&
(b.isContainerClass("IPF.Note",!0)?c=1:b.isContainerClass("IPF",!0)&&(c=0));break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:b instanceof Zarafa.core.data.IPMRecord&&(b.isMessageClass(["IPM.Note","REPORT.IPM","REPORT.IPM.Note"],!0)?c=1:b.isMessageClass("IPM",!0)&&(c=0))}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:c=Zarafa.mail.dialogs.MailCreateContentPanel;break;case Zarafa.core.data.SharedComponentType["common.view"]:c=
Zarafa.mail.dialogs.ShowMailContentPanel;break;case Zarafa.core.data.SharedComponentType["mail.dialog.options"]:c=!b||b.phantom||b.isUnsent()?Zarafa.mail.dialogs.MailCreateOptionsContentPanel:Zarafa.mail.dialogs.MailViewOptionsContentPanel;break;case Zarafa.core.data.SharedComponentType["common.preview"]:c=Zarafa.mail.ui.MailViewPanel;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=Zarafa.mail.ui.MailGridContextMenu;break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof
Zarafa.core.data.IPMRecord&&(c=Zarafa.mail.printer.MailRenderer);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:c=Zarafa.mail.attachitem.AttachMailColumnModel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:c=Zarafa.mail.attachitem.AttachMailRenderer;break;case Zarafa.core.data.SharedComponentType["mail.dialog.delayeddelivery"]:c=Zarafa.mail.dialogs.DelayedDeliveryContentPanel}return c},createContentPanel:function(){return{xtype:"zarafa.mailpanel",
id:"zarafa-mainpanel-contentpanel-mail",context:this}},createMailNavigationPanel:function(){return{xtype:"zarafa.contextnavigation",context:this,items:[{xtype:"panel",id:"zarafa-navigationpanel-mail-navigation",cls:"zarafa-context-navigation-block",ref:"mailnavigation",layout:"fit",items:[{xtype:"zarafa.hierarchytreepanel",id:"zarafa-navigationpanel-mail-navigation-tree",model:this.getModel(),IPMFilter:"IPF.Note",hideDeletedFolders:!1,enableDD:!0,enableItemDrop:!0,deferredLoading:!0,bbarConfig:{defaultSelectedSharedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.MAIL,
buttonText:_("Open Shared Mails")}}]}]}},createNewMailButton:function(){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-mail",tooltip:_("Email message")+" (Ctrl + Alt + X)",plugins:"zarafa.menuitemtooltipplugin",text:_("Email message"),iconCls:"icon_createEmailMessage",newMenuIndex:1,context:"mail",handler:function(){Zarafa.mail.Actions.openCreateMailContent(this.getModel())},scope:this}},createSendEmailContextItem:function(){return{text:_("Send E-mail"),iconCls:"icon_send_email_to_recipient",
scope:this,handler:function(a){Zarafa.mail.Actions.openCreateMailContentForContacts(this.getModel(),a.parentMenu.records)},beforeShow:function(a,b){for(var c=!1,d=0,e=b.length;d<e;d++)if(this.isSendEmailButtonVisible(b[d])){c=!0;break}a.setVisible(c)}}},createSendEmailButton:function(){return{xtype:"button",plugins:["zarafa.recordcomponentupdaterplugin"],iconCls:"icon_send_email_to_recipient",overflowText:_("Send E-mail"),tooltip:{title:_("Send E-mail"),text:_("Create a new email message addressed to this recipient.")},
handler:function(a){Zarafa.mail.Actions.openCreateMailContentForContacts(this.getModel(),a.record)},scope:this,update:function(a,b){this.record=a;b&&(this.scope.isSendEmailButtonVisible(a)||this.hide())}}},isSendEmailButtonVisible:function(a){return a.phantom||a.isMessageClass("IPM.Contact")&&!a.hasEmailAddress()?!1:!0},createSettingCategories:function(a,b,c){return[{xtype:"zarafa.settingsmailcategory",settingsContext:c},{xtype:"zarafa.settingsoutofofficecategory",settingsContext:c}]},getMainToolbarViewButtons:function(){var a=
container.populateInsertionPoint("main.maintoolbar.view.mail",this)||[];return[{id:"zarafa-maintoolbar-view-mail-nopreview",overflowText:_("No preview"),iconCls:"icon_previewpanel_off",text:_("No preview"),valueView:Zarafa.mail.data.Views.LIST,valueViewMode:Zarafa.mail.data.ViewModes.NO_PREVIEW,valueDataMode:Zarafa.mail.data.DataModes.ALL,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-mail-previewright",overflowText:_("Right preview"),iconCls:"icon_previewpanel_right",text:_("Right preview"),
valueView:Zarafa.mail.data.Views.LIST,valueViewMode:Zarafa.mail.data.ViewModes.RIGHT_PREVIEW,valueDataMode:Zarafa.mail.data.DataModes.ALL,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-mail-previewbottom",overflowText:_("Bottom preview"),iconCls:"icon_previewpanel_bottom",text:_("Bottom preview"),valueView:Zarafa.mail.data.Views.LIST,valueViewMode:Zarafa.mail.data.ViewModes.BOTTOM_PREVIEW,valueDataMode:Zarafa.mail.data.DataModes.ALL,handler:this.onContextSelectView,scope:this}].concat(a)},
onContextSelectView:function(a){this.getModel().setDataMode(a.valueDataMode);this.switchView(a.valueView,a.valueViewMode)},getMainToolbarPrintButtons:function(){var a=container.populateInsertionPoint("main.toolbar.print.mail",this)||[];return[{xtype:"zarafa.conditionalitem",id:"zarafa-maintoolbar-print-singlemail",overflowText:_("Print single e-mail"),iconCls:"icon_print_single",tooltip:_("Print single e-mail")+" (Ctrl + P)",plugins:"zarafa.menuitemtooltipplugin",text:_("Print single e-mail"),hideOnDisabled:!1,
singleSelectOnly:!0,handler:this.onPrintSingle,scope:this}].concat(a)},onPrintSingle:function(){var a=this.getModel().getSelectedRecords();Ext.isEmpty(a)?Ext.MessageBox.alert(_("Print"),_("No message selected")):Zarafa.common.Actions.openPrintDialog(a)},onPrintList:function(){Zarafa.common.Actions.openPrintDialog(this)},createMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:2,context:this.getName(),id:"mainmenu-button-mail"}}});
Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"mail",displayName:_("Mail"),allowUserVisible:!1,pluginConstructor:Zarafa.mail.MailContext}))});Ext.namespace("Zarafa.mail");
Zarafa.mail.MailStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"IPM.Note",defaultSortInfo:{field:"message_delivery_time",direction:"desc"}});Zarafa.mail.MailStore.superclass.constructor.call(this,a);this.standalone||Zarafa.core.PresenceManager.registerStore(this,["sender","received_by","sent_representing"])},getRecordsForUpdateData:function(a,b){if(!Ext.isDefined(a)||b!==Ext.data.Api.actions.open)return Zarafa.mail.MailStore.superclass.getRecordsForUpdateData.apply(this,
arguments);var c={records:[],updatedRecords:[]};Array.isArray(a)||(a=[a]);for(var d=0,e=a.length;d<e;d++){var f=a[d];if(f instanceof Zarafa.calendar.MeetingRequestRecord){var g=f.get("goid2");if(Ext.isEmpty(g))return Zarafa.mail.MailStore.superclass.getRecordsForUpdateData.apply(this,arguments);var h=-1;do if(h=this.findExact("goid2",g,h+1),!(0>h)){var k=this.getAt(h);f.equals(k)?(c.records.push(this.getAt(h)),c.updatedRecords.push(f)):k.isOpened()&&(k.opened=!1,c.records.push(k),c.updatedRecords.push({}))}while(-1!=
h)}else if(!f.isMessageClass("IPM.TaskRequest",!0))return Zarafa.mail.MailStore.superclass.getRecordsForUpdateData.apply(this,arguments)}return c}});Ext.reg("zarafa.mailstore",Zarafa.mail.MailStore);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailCreateContentPanel=Ext.extend(Zarafa.core.ui.MessageContentPanel,{model:void 0,showbcc:!1,use_html_editor:!1,showfrom:!1,sendLaterValidationQueue:void 0,constructor:function(a){a=a||{};Ext.isDefined(a.use_html_editor)||(a.use_html_editor=container.getSettingsModel().get("zarafa/v1/contexts/mail/dialogs/mailcreate/use_html_editor"));a.plugins=Ext.value(a.plugins,[]);!0===container.getSettingsModel().get("zarafa/v1/contexts/mail/autosave_enable")&&a.plugins.push({ptype:"zarafa.autosavemessageplugin"});
Ext.applyIf(a,{xtype:"zarafa.mailcreatecontentpanel",layout:"fit",title:_("E-Mail"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),closeOnSend:!0,confirmClose:!0,items:[{xtype:"zarafa.mailcreatepanel",ref:"mainPanel",use_html_editor:a.use_html_editor,tbar:{xtype:"zarafa.mailcreatetoolbar"}}]});this.addEvents("bcctoggle","fromtoggle");Zarafa.mail.dialogs.MailCreateContentPanel.superclass.constructor.call(this,a);this.createSendLaterValidationQueue()},displayInfoMask:function(){!1!==
this.showInfoMask&&(this.isSaving&&!this.isSending?this.savingEl=container.getNotifier().notify("info.mailsaving",_("Saving..."),{toolbar:this.mainPanel.getTopToolbar()}):Zarafa.mail.dialogs.MailCreateContentPanel.superclass.displayInfoMask.apply(this,arguments))},hideInfoMask:function(a){if(!1!==this.showInfoMask)if(this.isSaving&&!this.isSending){var b;b=!1===a?_("Message saving failed."):String.format(_("Message Saved at {0}."),this.record.get("last_modification_time").format(_("g:i A")));container.getNotifier().notify("info.mailsaved",
b,{toolbar:this.mainPanel.getTopToolbar()})}else Zarafa.mail.dialogs.MailCreateContentPanel.superclass.hideInfoMask.apply(this,arguments)},update:function(a,b){var c=!1,d;if(b){a.userIsStoreOwner()||(d=container.getHierarchyStore().getById(a.get("store_entryid")),a.setDelegatorInfo(d));if(a.get("sent_representing_email_address")){c=!0;d=this.mainPanel.fromRecipientField.getBoxStore();var e=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
{display_name:a.get("sent_representing_name"),email_address:a.get("sent_representing_email_address"),address_type:a.get("sent_representing_address_type"),entryid:a.get("sent_representing_entryid")});d.removeAll();d.add(e)}d=a.getSubStore("recipients").hasBccRecipients();this.fireEvent("bcctoggle",this,this.showbcc||d,!1);this.fireEvent("fromtoggle",this,this.showfrom||c,!1);if(this.inputAutoFocusPlugin)switch(a.getMessageAction("action_type")){case Zarafa.mail.data.ActionTypes.REPLY:case Zarafa.mail.data.ActionTypes.REPLYALL:case Zarafa.mail.data.ActionTypes.EDIT_AS_NEW:this.inputAutoFocusPlugin.setAutoFocus("zarafa.editorfield");
break;default:this.inputAutoFocusPlugin.setAutoFocus(this.mainPanel.toRecipientField)}}else a.isSubStoreModifiedSincelastUpdate("recipients")&&(d=a.getSubStore("recipients").hasBccRecipients(),this.fireEvent("bcctoggle",this,this.showbcc||d,!1)),a.isModifiedSinceLastUpdate("sent_representing_email_address")&&(Ext.isEmpty(a.get("sent_representing_email_address"))||(c=!0),this.fireEvent("fromtoggle",this,this.showfrom||c,!1));this.updateTitleFromRecord(a);this.updateIconFromRecord(a)},updateIconFromRecord:function(a){a=
Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){a=a.get("subject");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)},initStateEvents:function(){Zarafa.mail.dialogs.MailCreateContentPanel.superclass.initStateEvents.call(this);this.on("bcctoggle",this.saveState,this);this.on("fromtoggle",this.saveState,this)},saveState:function(a,b,c){c&&Zarafa.mail.dialogs.MailCreateContentPanel.superclass.saveState.call(this)},getState:function(){var a=
Zarafa.mail.dialogs.MailCreateContentPanel.superclass.getState.apply(this,arguments);return Ext.apply(a||{},{showbcc:this.showbcc,showfrom:this.showfrom})},toggleBccState:function(a){this.showbcc=a;this.fireEvent("bcctoggle",this,a,!0)},toggleFromState:function(a){this.showfrom=a;this.fireEvent("fromtoggle",this,a,!0)},getContextModel:function(){if(!this.model){var a=this.get("parent_entryid");Ext.isEmpty(a)||(a=container.getHierarchyStore().getById(a));Ext.isEmpty(a)&&(a=container.getHierarchyStore().getDefaultFolder("drafts"));
this.model=container.getContextByFolder(a).getModel()}return this.model},sendLaterRecord:function(){this.sendLaterValidationQueue.run(this.onCompleteValidateSendLaterRecord,this)},createSendLaterValidationQueue:function(){this.sendLaterValidationQueue=new Zarafa.core.data.CallbackQueue;this.sendLaterValidationQueue.add(this.validateEmptyRecipients,this);this.sendLaterValidationQueue.add(this.validateResolvedRecipients,this)},onCompleteValidateSendLaterRecord:function(a){a&&Zarafa.mail.Actions.openDelayedDeliveryContent(this.record,
this)}});Ext.reg("zarafa.mailcreatecontentpanel",Zarafa.mail.dialogs.MailCreateContentPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.MailOptionsSettingsPanel=Ext.extend(Ext.form.FormPanel,{record:void 0,importanceStore:void 0,sensitivityStore:void 0,constructor:function(a){a=a||{};a.plugins=Ext.value(a.plugins,[]);a.plugins.push("zarafa.recordcomponentupdaterplugin");a.importanceStore||(a.importanceStore={xtype:"jsonstore",fields:["value","name"],data:Zarafa.common.data.ImportanceFlags.flags});a.sensitivityStore||(a.sensitivityStore={xtype:"jsonstore",fields:["value","name"],data:Zarafa.mail.data.SensitivityFlags.flags});
Ext.applyIf(a,{xtype:"zarafa.mailoptionssettingspanel",title:_("Message Settings"),layout:"form",items:[{xtype:"combo",fieldLabel:_("Importance"),ref:"importanceCombo",anchor:"100%",name:"importance",store:a.importanceStore,mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}},{xtype:"combo",fieldLabel:_("Sensitivity"),ref:"sensitivityCombo",anchor:"100%",name:"sensitivity",store:a.sensitivityStore,
mode:"local",triggerAction:"all",displayField:"name",valueField:"value",lazyInit:!1,forceSelection:!0,editable:!1,listeners:{select:this.onFieldSelect,scope:this}}]});Zarafa.mail.dialogs.MailOptionsSettingsPanel.superclass.constructor.call(this,a)},onFieldSelect:function(a,b,c){this.record.set(a.getName(),b.get(a.valueField))},update:function(a,b){(this.record=a)?(this.getForm().loadRecord(a),a.phantom||a.isUnsent()?this.sensitivityCombo.enable():this.sensitivityCombo.disable()):(this.importanceCombo.setValue(1),
this.sensitivityCombo.setValue(0))},updateRecord:function(a){this.getForm().updateRecord(a);a.get("sensitivity")===Zarafa.core.mapi.Sensitivity.PRIVATE?a.set("private",!0):a.set("private",!1)}});Ext.reg("zarafa.mailoptionssettingspanel",Zarafa.mail.dialogs.MailOptionsSettingsPanel);Ext.namespace("Zarafa.mail.dialogs");
Zarafa.mail.dialogs.ShowMailContentPanel=Ext.extend(Zarafa.core.ui.MessageContentPanel,{model:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{xtype:"zarafa.showmailcontentpanel",layout:"fit",title:_("no subject"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),closeOnSend:!0,items:[this.createPanel()]});Zarafa.mail.dialogs.ShowMailContentPanel.superclass.constructor.call(this,a)},createPanel:function(){return{xtype:"zarafa.mailviewpanel",tbar:{xtype:"zarafa.showmailtoolbar"}}},
getContextModel:function(){if(!this.model){var a=container.getHierarchyStore(),b=this.get("parent_entryid");Ext.isEmpty(b)||(b=a.getById(b));Ext.isEmpty(b)&&(b=a.getDefaultFolder("drafts"));this.model=container.getContextByFolder(b).getModel()}return this.model},update:function(a,b){this.updateIconFromRecord(a);this.updateTitleFromRecord(a)},updateTitleFromRecord:function(a){a=a.get("subject");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)},updateIconFromRecord:function(a){a=
Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)}});Ext.reg("zarafa.showmailcontentpanel",Zarafa.mail.dialogs.ShowMailContentPanel);Ext.namespace("Zarafa.note");
Zarafa.note.NoteContext=Ext.extend(Zarafa.core.Context,{oldView:void 0,oldViewMode:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{current_view:Zarafa.note.data.Views.ICON,current_view_mode:Zarafa.note.data.ViewModes.NORMAL});this.registerInsertionPoint("main.maintabbar.left",this.createMainTab,this);this.registerInsertionPoint("main.maintoolbar.new.item",this.createNewNoteButton,this);Zarafa.note.NoteContext.superclass.constructor.call(this,a);this.registerInsertionPoint("navigation.center",
this.createNoteNavigationPanel,this)},getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.note.NoteContextModel,this.model.on({searchstart:this.onModelSearchStart,searchstop:this.onModelSearchStop,scope:this}));return this.model},onModelSearchStart:function(a){this.getCurrentView()!==Zarafa.note.data.Views.SEARCH&&this.getCurrentViewMode()!==Zarafa.note.data.ViewModes.SEARCH&&(this.oldView=this.getCurrentView(),this.oldViewMode=this.getCurrentViewMode(),this.switchView(Zarafa.note.data.Views.SEARCH,
Zarafa.note.data.ViewModes.SEARCH))},onModelSearchStop:function(a){this.switchView(this.oldView,this.oldViewMode);delete this.oldView;delete this.oldViewMode},bid:function(a){return a.isContainerClass("IPF.StickyNote",!0)?1:-1},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:b instanceof Zarafa.core.data.IPMRecord&&b.isMessageClass("IPM.StickyNote",!0)&&
(c=1);break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.IPMRecord&&b.isMessageClass("IPM.StickyNote",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.isMessageClass("IPM.StickyNote",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:b instanceof Zarafa.hierarchy.data.MAPIFolderRecord&&b.isContainerClass("IPF.StickyNote",
!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&b.isMessageClass("IPM.StickyNote",!0)&&(c=1)}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:c=Zarafa.note.dialogs.NoteEditContentPanel;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=
Zarafa.note.ui.NoteContextMenu;break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&(c=Zarafa.note.printer.NoteRenderer);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:c=Zarafa.note.attachitem.AttachNoteColumnModel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:c=Zarafa.note.attachitem.AttachNoteRenderer}return c},
createNoteNavigationPanel:function(){return{xtype:"zarafa.contextnavigation",context:this,items:[{xtype:"panel",id:"zarafa-navigationpanel-notes-navigation",cls:"zarafa-context-navigation-block",layout:"fit",items:[{xtype:"zarafa.hierarchytreepanel",id:"zarafa-navigationpanel-notes-navigation-tree",model:this.getModel(),IPMFilter:"IPF.StickyNote",hideDeletedFolders:!0,enableDD:!0,enableItemDrop:!0,deferredLoading:!0,bbarConfig:{defaultSelectedSharedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.NOTE,
buttonText:_("Open Shared Notes")}}]}]}},createContentPanel:function(){return{xtype:"zarafa.notemainpanel",id:"zarafa-mainpanel-contentpanel-notes",context:this}},createNewNoteButton:function(){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-note",tooltip:_("Sticky note")+" (Ctrl + Alt + S)",plugins:"zarafa.menuitemtooltipplugin",text:_("Sticky note"),iconCls:"icon_createNote",newMenuIndex:5,context:"note",handler:function(){Zarafa.note.Actions.openCreateNoteContent(this.getModel())},scope:this}},
getMainToolbarPrintButtons:function(){var a=container.populateInsertionPoint("main.toolbar.print.note",this)||[];return[{xtype:"zarafa.conditionalitem",id:"zarafa-maintoolbar-print-selectednote",overflowText:_("Print selected note"),iconCls:"icon_print_single_note",tooltip:_("Print selected note")+" (Ctrl + P)",plugins:"zarafa.menuitemtooltipplugin",text:_("Print selected note"),hideOnDisabled:!1,singleSelectOnly:!0,handler:this.onPrintSelected,scope:this}].concat(a)},onPrintSelected:function(){var a=
this.getModel().getSelectedRecords();Ext.isEmpty(a)?Ext.MessageBox.alert(_("Print"),_("No note selected")):Zarafa.common.Actions.openPrintDialog(a)},getMainToolbarViewButtons:function(){var a=container.populateInsertionPoint("main.maintoolbar.view.note",this)||[];return[{id:"zarafa-maintoolbar-view-notes-icons",text:_("Icons"),overflowText:_("Icons"),iconCls:"icon_note_icon_view",valueView:Zarafa.note.data.Views.ICON,valueViewMode:Zarafa.note.data.ViewModes.NORMAL,valueDataMode:Zarafa.note.data.DataModes.ALL,
handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-notes-list",text:_("List view"),overflowText:_("List view"),iconCls:"icon_contact_list",valueView:Zarafa.note.data.Views.LIST,valueViewMode:Zarafa.note.data.ViewModes.NORMAL,valueDataMode:Zarafa.note.data.DataModes.ALL,handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-notes-listlastsevendays",text:_("List Last Seven Days"),overflowText:_("List Last Seven Days"),iconCls:"icon_task_seven_days",valueView:Zarafa.note.data.Views.LIST,
valueViewMode:Zarafa.note.data.ViewModes.NORMAL,valueDataMode:Zarafa.note.data.DataModes.LAST_7_DAYS,handler:this.onContextSelectView,scope:this}].concat(a)},onContextSelectView:function(a){this.getModel().setDataMode(a.valueDataMode);this.switchView(a.valueView,a.valueViewMode)},createMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:6,context:this.getName(),id:"mainmenu-button-notes"}},onViewModeChange:function(a,b,c){a=this.getModel();switch(b){case Zarafa.note.data.ViewModes.NORMAL:case Zarafa.note.data.ViewModes.SEARCH:a.clearGrouping();
break;case Zarafa.note.data.ViewModes.GROUP_CATEGORY:a.groupBy("categories");break;case Zarafa.note.data.ViewModes.GROUP_COLOR:a.groupBy("color")}}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"note",displayName:_("Notes"),allowUserVisible:!1,pluginConstructor:Zarafa.note.NoteContext}))});Ext.namespace("Zarafa.note");
Zarafa.note.NoteStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"IPM.StickyNote",defaultSortInfo:{field:"subject",direction:"asc"}});Zarafa.note.NoteStore.superclass.constructor.call(this,a)}});Ext.reg("zarafa.notestore",Zarafa.note.NoteStore);Ext.namespace("Zarafa.settings");
Zarafa.settings.SettingsContext=Ext.extend(Zarafa.core.Context,{constructor:function(a){a=a||{};Ext.applyIf(a,{stateful:!1});Zarafa.settings.SettingsContext.superclass.constructor.call(this,a);this.registerInsertionPoint("main.maintabbar.right",this.createSettingsMainTab,this);this.registerInsertionPoint("context.settings.categories",this.createSettingCategories,this);this.addEvents("afterrequiredreload")},getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.settings.SettingsContextModel);
return this.model},setView:function(a){this.current_view!=a&&(this.getModel().hasChanges()?Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Do you wish to apply the changes?"),icon:Ext.MessageBox.QUESTION,fn:this.applyChanges.createDelegate(this,[a],1),buttons:Ext.MessageBox.YESNOCANCEL}):Zarafa.settings.SettingsContext.superclass.setView.call(this,a))},setViewMode:function(a){var b=this.current_view_mode;this.current_view_mode=a;this.fireEvent("viewmodechange",this,this.current_view_mode,b)},
applyChanges:function(a,b){if("cancel"!==a){var c=this.getModel();"yes"===a?c.applyChanges():c.discardChanges();Zarafa.settings.SettingsContext.superclass.setView.call(this,b)}},enable:function(a,b){Zarafa.settings.SettingsContext.superclass.enable.apply(this,arguments);container.on("beforecontextswitch",this.onBeforeContextSwitch,this);this.getModel().getRealSettingsModel().on("save",this.onSaveSettings,this);container.getNavigationBar().collapse()},disable:function(){container.getNavigationBar().expand();
container.un("beforecontextswitch",this.onBeforeContextSwitch,this);Zarafa.settings.SettingsContext.superclass.disable.apply(this,arguments)},onSaveSettings:function(a,b){if(b.requiresReload){var c=_("In order for the changes to take effect, please reload WebApp.")+"<br>"+_("NOTE: Any unsaved changes will be lost.");Zarafa.common.dialogs.MessageBox.addCustomButtons({title:_("Kopano WebApp"),msg:c,icon:Ext.MessageBox.QUESTION,fn:this.reloadWebapp,customButton:[{text:_("Reload"),name:"reload"},{text:_("Cancel"),
name:"cancel"}],scope:this})}},reloadWebapp:function(a){"reload"===a&&(this.getModel().getRealSettingsModel().un("save",this.onSaveSettings,this),Zarafa.core.Util.reloadWebapp());this.fireEvent("afterrequiredreload",this,a)},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.settings.ui.SettingsTreeNode&&(c=1)}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof
Zarafa.settings.ui.SettingsTreeNode&&(c=Zarafa.settings.ui.SettingsContextMenu)}return c},createContentPanel:function(){return{xtype:"zarafa.settingsmainpanel",id:"zarafa-mainpanel-contentpanel-settings",title:this.getDisplayName(),context:this}},createSettingsMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:1,context:this.getName(),id:"mainmenu-button-settings"}},createSettingCategories:function(){var a=[{xtype:"zarafa.settingsgeneralcategory",settingsContext:this}];container.getServerConfig().isPluginsEnabled()&&
a.push({xtype:"zarafa.settingspluginscategory",settingsContext:this});container.getServerConfig().isAdvancedSettingsEnabled()&&a.push({xtype:"zarafa.settingsadvancedcategory",settingsContext:this});return a=a.concat([{xtype:"zarafa.settingskeyshortcutcategory",settingsContext:this},{xtype:"zarafa.settingscopyrightcategory",settingsContext:this}])},onBeforeContextSwitch:function(a,b,c){if(this.getModel().hasChanges())return Ext.MessageBox.show({title:_("Kopano WebApp"),msg:_("Do you wish to apply the changes?"),
icon:Ext.MessageBox.QUESTION,fn:this.applyChangesContext.createDelegate(this,[a,c],1),buttons:Ext.MessageBox.YESNOCANCEL}),!1},applyChangesContext:function(a,b,c){if("cancel"!==a){var d=this.getModel();"yes"===a?d.applyChanges():d.discardChanges();if(d.getRealSettingsModel().requiresReload)this.on("afterrequiredreload",this.onAfterRequiredReload.createDelegate(this,[b,c],1),this,{single:!0});else container.switchContext(c,b)}},onAfterRequiredReload:function(a,b,c,d){"cancel"===d&&container.switchContext(c,
b)}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"settings",displayName:_("Settings"),allowUserVisible:!1,pluginConstructor:Zarafa.settings.SettingsContext}))});Ext.namespace("Zarafa.task");
Zarafa.task.TaskContext=Ext.extend(Zarafa.core.Context,{oldView:void 0,oldViewMode:void 0,constructor:function(a){a=a||{};Ext.applyIf(a,{current_view:Zarafa.task.data.Views.LIST,current_view_mode:Zarafa.task.data.ViewModes.SIMPLE});this.registerInsertionPoint("main.maintabbar.left",this.createMainTab,this);this.registerInsertionPoint("main.maintoolbar.new.item",this.createToolbarNewTaskButton,this);this.registerInsertionPoint("main.maintoolbar.new.item",this.createToolbarNewTaskRequestButton,this);
this.registerInsertionPoint("previewpanel.toolbar.left",this.createTaskRequestToolbarButtons,this);Zarafa.task.TaskContext.superclass.constructor.call(this,a);this.registerInsertionPoint("navigation.center",this.createTaskNavigationPanel,this);this.registerInsertionPoint("context.mail.contextmenu.actions",this.convertToTask,this);Zarafa.core.data.SharedComponentType.addProperty("task.dialogs.sendtaskrequestconfirmation");Zarafa.core.data.SharedComponentType.addProperty("task.dialogs.sendtaskrequestcancellation");
Zarafa.core.data.SharedComponentType.addProperty("task.contextmenu.flags")},getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.task.TaskContextModel,this.model.on({searchstart:this.onModelSearchStart,searchstop:this.onModelSearchStop,scope:this}));return this.model},onModelSearchStart:function(a){this.getCurrentView()!==Zarafa.task.data.Views.SEARCH&&this.getCurrentViewMode()!==Zarafa.task.data.ViewModes.SEARCH&&(this.oldView=this.getCurrentView(),this.oldViewMode=this.getCurrentViewMode(),
this.switchView(Zarafa.task.data.Views.SEARCH,Zarafa.task.data.ViewModes.SEARCH))},onModelSearchStop:function(a){this.switchView(this.oldView,this.oldViewMode);delete this.oldView;delete this.oldViewMode},bid:function(a){return a.isContainerClass("IPF.Task",!0)?1:-1},bidSharedComponent:function(a,b){var c=-1;Array.isArray(b)&&(b=b[0]);switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:case Zarafa.core.data.SharedComponentType["common.preview"]:b instanceof
Zarafa.core.data.IPMRecord&&b.isMessageClass("IPM.Task",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["task.dialogs.sendtaskrequestconfirmation"]:case Zarafa.core.data.SharedComponentType["task.dialogs.sendtaskrequestcancellation"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&b.isMessageClass("IPM.Task",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:b instanceof Zarafa.core.data.IPMRecord&&(this.model.getDefaultFolder().isTodoListFolder()?
c=2:b.isMessageClass("IPM.Task",!0)&&(c=1));break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?b.isMessageClass(["IPM.Task"],!0)&&(c=1):b instanceof Zarafa.task.TaskContext&&(c=1);break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:b instanceof Zarafa.hierarchy.data.MAPIFolderRecord&&b.isContainerClass("IPF.Task",!0)&&(c=1);
break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE&&b.isMessageClass("IPM.Task",!0)&&(c=1);break;case Zarafa.core.data.SharedComponentType["task.contextmenu.flags"]:c=1}return c},getSharedComponent:function(a,b){var c;switch(a){case Zarafa.core.data.SharedComponentType["common.create"]:case Zarafa.core.data.SharedComponentType["common.view"]:c=Zarafa.task.dialogs.TaskEditContentPanel;
break;case Zarafa.core.data.SharedComponentType["common.preview"]:c=Zarafa.task.ui.TaskPreviewPanel;break;case Zarafa.core.data.SharedComponentType["task.dialogs.sendtaskrequestconfirmation"]:case Zarafa.core.data.SharedComponentType["task.dialogs.sendtaskrequestcancellation"]:c=Zarafa.task.dialogs.SendTaskRequestConfirmationContentPanel;break;case Zarafa.core.data.SharedComponentType["common.contextmenu"]:c=Zarafa.task.ui.TaskContextMenu;break;case Zarafa.core.data.SharedComponentType["task.contextmenu.flags"]:c=
Zarafa.task.ui.TaskFlagsMenu;break;case Zarafa.core.data.SharedComponentType["common.printer.renderer"]:c=b instanceof Zarafa.core.data.IPMRecord&&b.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_MESSAGE?Zarafa.task.printer.TaskRenderer:Zarafa.task.printer.TaskListViewRenderer;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.columnmodel"]:c=Zarafa.task.attachitem.AttachTaskColumnModel;break;case Zarafa.core.data.SharedComponentType["common.attachment.dialog.attachitem.textrenderer"]:c=
Zarafa.task.attachitem.AttachTaskRenderer}return c},createTaskNavigationPanel:function(){return{xtype:"zarafa.contextnavigation",context:this,items:[{xtype:"panel",id:"zarafa-navigationpanel-tasks-navigation",cls:"zarafa-context-navigation-block",layout:"fit",items:[{xtype:"zarafa.hierarchytreepanel",id:"zarafa-navigationpanel-tasks-navigation-tree",model:this.getModel(),IPMFilter:"IPF.Task",hideDeletedFolders:!0,enableDD:!0,enableItemDrop:!0,deferredLoading:!0,bbarConfig:{defaultSelectedSharedFolderType:Zarafa.hierarchy.data.SharedFolderTypes.TASK,
buttonText:_("Open Shared Tasks")}}]}]}},createContentPanel:function(){return{xtype:"zarafa.taskmainpanel",id:"zarafa-mainpanel-contentpanel-tasks",context:this}},getMainToolbarViewButtons:function(){var a=container.populateInsertionPoint("main.maintoolbar.view.task",this)||[];return[{id:"zarafa-maintoolbar-view-tasks-simple",text:_("Simple view"),overflowText:_("Simple view"),iconCls:"icon_task_simple",valueView:Zarafa.task.data.Views.LIST,valueViewMode:Zarafa.task.data.ViewModes.SIMPLE,valueDataMode:Zarafa.task.data.DataModes.ALL,
handler:this.onContextSelectView,scope:this},{id:"zarafa-maintoolbar-view-tasks-detailed",text:_("Detailed view"),overflowText:_("Detailed view"),iconCls:"icon_task_detailed",valueView:Zarafa.task.data.Views.LIST,valueViewMode:Zarafa.task.data.ViewModes.DETAILED,valueDataMode:Zarafa.task.data.DataModes.ALL,handler:this.onContextSelectView,scope:this}].concat(a)},onContextSelectView:function(a){this.getModel().setDataMode(a.valueDataMode);this.switchView(a.valueView,a.valueViewMode)},createToolbarNewTaskButton:function(){return{xtype:"menuitem",
id:"zarafa-maintoolbar-newitem-task",tooltip:_("Task")+" (Ctrl + Alt + K)",plugins:"zarafa.menuitemtooltipplugin",text:_("Task"),handler:function(){Zarafa.task.Actions.openCreateTaskContent(this.getModel())},iconCls:"icon_createTask",newMenuIndex:4,context:"task",scope:this}},createToolbarNewTaskRequestButton:function(){return{xtype:"menuitem",id:"zarafa-maintoolbar-newitem-task-request",tooltip:_("Task request"),plugins:"zarafa.menuitemtooltipplugin",text:_("Task request"),handler:function(){Zarafa.task.Actions.openCreateTaskRequestContent(this.getModel())},
iconCls:"icon_createTaskRequest",newMenuIndex:4,context:"task",scope:this}},getMainToolbarPrintButtons:function(){var a=container.populateInsertionPoint("main.toolbar.print.task",this)||[];return[{xtype:"zarafa.conditionalitem",id:"zarafa-maintoolbar-print-selectedtask",overflowText:_("Print selected task"),iconCls:"icon_print_single_task",tooltip:_("Print selected task")+" (Ctrl + P)",plugins:"zarafa.menuitemtooltipplugin",text:_("Print selected task"),hideOnDisabled:!1,singleSelectOnly:!0,handler:this.onPrintSelected,
scope:this},{overflowText:_("Print task list"),id:"zarafa-maintoolbar-print-tasklist",iconCls:"icon_print_task_list",tooltip:_("Print task list")+" (Ctrl + Alt + P)",plugins:"zarafa.menuitemtooltipplugin",text:_("Print task list"),handler:this.onPrintList,scope:this}].concat(a)},onPrintSelected:function(){var a=this.getModel().getSelectedRecords();Ext.isEmpty(a)?Ext.MessageBox.alert(_("Print"),_("No task selected")):Zarafa.common.Actions.openPrintDialog(a)},onPrintList:function(a){Zarafa.common.Actions.openPrintDialog(this)},
createMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:5,context:this.getName(),id:"mainmenu-button-tasks"}},convertToTask:function(){return{xtype:"zarafa.conditionalitem",text:_("Create task"),iconCls:"icon_createTask",singleSelectOnly:!0,hidden:!0,handler:this.onContextItemCreateTask,scope:this}},createTaskRequestToolbarButtons:function(a){return{xtype:"zarafa.taskrequestbuttons"}},onContextItemCreateTask:function(a,b){var c=a.getRecords();Zarafa.task.Actions.createTaskFromMail(c,
this.getModel())}});Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"task",displayName:_("Tasks"),allowUserVisible:!1,pluginConstructor:Zarafa.task.TaskContext}))});Ext.namespace("Zarafa.task");
Zarafa.task.TaskStore=Ext.extend(Zarafa.core.data.ListModuleStore,{constructor:function(a){a=a||{};Ext.applyIf(a,{preferredMessageClass:"IPM.Task",defaultSortInfo:{field:"duedate",direction:"desc"}});Zarafa.task.TaskStore.superclass.constructor.call(this,a)},onNotifyObjectcreated:function(a,b){container.getCurrentContext().getModel().getDefaultFolder().isTodoListFolder()?this.reload({folder:b}):Zarafa.task.TaskStore.superclass.onNotifyObjectcreated.apply(this,arguments)}});
Ext.reg("zarafa.taskstore",Zarafa.task.TaskStore);Ext.namespace("Zarafa.task.dialogs");
Zarafa.task.dialogs.TaskEditContentPanel=Ext.extend(Zarafa.core.ui.MessageContentPanel,{constructor:function(a){a=a||{};a=Ext.applyIf(a,{layout:"fit",xtype:"zarafa.taskeditcontentpanel",closeOnSave:!0,closeOnSend:!0,title:_("Task"),recordComponentPluginConfig:Ext.applyIf(a.recordComponentPluginConfig||{},{allowWrite:!0}),confirmClose:!0,items:[{xtype:"zarafa.taskpanel",tbar:{xtype:"zarafa.tasktoolbar"}}]});Zarafa.task.dialogs.TaskEditContentPanel.superclass.constructor.call(this,a)},createSendValidationQueue:function(){Zarafa.task.dialogs.TaskEditContentPanel.superclass.createSendValidationQueue.apply(this,
arguments);this.sendValidationQueue.add(this.validateSenderIsNotRecipient,this)},validateSenderIsNotRecipient:function(a){if(this.record.isMessageClass("IPM.Task")){var b=this.record.getRecipientStore().getRange(),c=!1,d=!1,e=0;Ext.each(b,function(a){Zarafa.core.EntryId.compareEntryIds(container.getUser().getEntryId(),a.get("entryid"))&&!c&&(c=!0);a.get("recipient_type")===Zarafa.core.mapi.RecipientType.MAPI_TO&&e++;if(a.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_DISTLIST)return d=!0,!1},
this);c?(container.getNotifier().notify("warning.sending",_("Kopano WebApp"),_("You cannot send a task request to yourself.")),a(!1)):1<e||d?(container.getNotifier().notify("warning.sending",_("Kopano WebApp"),_("A task request can only have one recipient.")),a(!1)):a(!0)}else a(!0)},update:function(a,b){a.isOpened()&&(a.isTaskRequest()||!b&&a.isModifiedSinceLastUpdate("taskhistory")&&a.get("taskhistory")===Zarafa.core.mapi.TaskHistory.NONE?this.closeOnSave=!1:this.closeOnSave=!0);this.updateIconFromRecord(a);
this.updateTitleFromRecord(a)},updateIconFromRecord:function(a){a=Zarafa.common.ui.IconClass.getIconClass(a);this.setIcon(a)},updateTitleFromRecord:function(a){a=a.get("subject");Ext.isEmpty(a)?this.setTitle(this.initialConfig.title):this.setTitle(a)},sendRecord:function(){if(this.record.isTaskRequest())return Zarafa.task.dialogs.TaskEditContentPanel.superclass.sendRecord.apply(this,arguments)}});Ext.reg("zarafa.taskeditcontentpanel",Zarafa.task.dialogs.TaskEditContentPanel);Ext.namespace("Zarafa.today");
Zarafa.today.TodayContext=Ext.extend(Zarafa.core.Context,{constructor:function(a){this.registerInsertionPoint("main.maintabbar.left",this.createMainTab,this);Zarafa.today.TodayContext.superclass.constructor.call(this,a)},getModel:function(){Ext.isDefined(this.model)||(this.model=new Zarafa.today.TodayContextModel);return this.model},bid:function(a){return a.isOwnRoot()?2:0},createContentPanel:function(){return{xtype:"zarafa.widgetpanel",id:"zarafa-mainpanel-contentpanel-today",settingsPath:"zarafa/v1/contexts/today",
showDefaultWidgets:["mail","appointments","tasks"],context:this,collapsible:!1,numColumns:container.getSettingsModel().get("zarafa/v1/contexts/today/num_columns")}},getMainToolbarViewButtons:function(){return container.populateInsertionPoint("main.maintoolbar.view.today",this)||[]},createMainTab:function(){return{text:this.getDisplayName(),tabOrderIndex:1,context:this.getName(),id:"mainmenu-button-today"}}});
Zarafa.onReady(function(){container.registerContext(new Zarafa.core.ContextMetaData({name:"today",displayName:_("Today"),allowUserVisible:!1,pluginConstructor:Zarafa.today.TodayContext}))});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.IPMRecordFields=[{name:"body",type:"string"},{name:"html_body",type:"string"},{name:"isHTML",type:"boolean",defaultValue:!1},{name:"entryid"},{name:"creation_time",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"icon_index",type:"int",defaultValue:-1},{name:"access",type:"number",defaultValue:Zarafa.core.mapi.Access.ACCESS_READ},{name:"message_class",type:"string"},{name:"message_flags",type:"int",defaultValue:Zarafa.core.mapi.MessageFlags.MSGFLAG_UNSENT|
Zarafa.core.mapi.MessageFlags.MSGFLAG_READ},{name:"read_receipt_requested",type:"boolean",defaultValue:!1},{name:"parent_entryid"},{name:"store_entryid"},{name:"subject"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE},{name:"normalized_subject"},{name:"last_modification_time",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"last_verb_execution_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"last_verb_executed",type:"int"},
{name:"hasattach",type:"boolean",defaultValue:!1},{name:"display_to"},{name:"display_cc"},{name:"display_bcc"},{name:"sent_representing_name"},{name:"sent_representing_email_address"},{name:"sent_representing_username"},{name:"sent_representing_address_type"},{name:"sent_representing_entryid"},{name:"sent_representing_search_key"},{name:"sent_representing_presence_status"},{name:"sender_name"},{name:"sender_email_address"},{name:"sender_username"},{name:"sender_address_type"},{name:"sender_entryid"},
{name:"sender_search_key"},{name:"sender_presence_status"},{name:"message_size",type:"int"},{name:"categories"},{name:"deleted_on",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"deferred_send_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"attach_num",defaultValue:null}];Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM",Zarafa.core.data.IPMRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("REPORT.IPM",Zarafa.core.data.IPMRecordFields);
Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,Zarafa.core.data.IPMRecordFields);Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM","createphantom",function(a){a.afterOpen()});Zarafa.core.data.RecordFactory.addListenerToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,"createphantom",function(a){a.afterOpen()});
Zarafa.core.data.IPMRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{eventPropagation:!0,baseIdProperties:["entryid","store_entryid","parent_entryid","attach_num"],equals:function(a){if(this===a)return!0;if(this.fields!==a.fields||this.phantom!==a.phantom)return!1;if(this.phantom)return this.id==a.id;var b=Zarafa.core.EntryId.compareEntryIds(this.get("entryid"),a.get("entryid"));if(b)if(this.isSubMessage()&&a.isSubMessage())b=this.get("attach_num").equals(a.get("attach_num"));else if(this.isSubMessage()||
a.isSubMessage())b=!1;return b},isMessageClass:function(a,b){return Zarafa.core.MessageClass.isClass(this.get("message_class"),a,b)},getSenderString:function(){var a;a=this.get("sender_entryid");var b=this.get("sent_representing_entryid");Ext.isEmpty(a)||Ext.isEmpty(b)||Zarafa.core.EntryId.compareABEntryIds(a,b)?a=Ext.isEmpty(this.get("sender_name"))?this.get("sender_email_address"):this.get("sender_name"):(a=Ext.isEmpty(this.get("sender_name"))?this.get("sender_email_address"):this.get("sender_name"),
b=Ext.isEmpty(this.get("sent_representing_name"))?this.get("sent_representing_email_address"):this.get("sent_representing_name"),a=String.format(_("{0} on behalf of {1}"),a,b));return a},getBody:function(a){var b=this.get("isHTML");return!1===a?b?Zarafa.core.HTMLParser.convertHTMLToPlain(this.get("html_body")):this.get("body"):!0===a?b?this.inlineImgOutlookToZarafa(this.get("html_body")):Zarafa.core.HTMLParser.convertPlainToHTML(this.get("body")):b?this.inlineImgOutlookToZarafa(this.get("html_body")):
this.get("body")},setBody:function(a,b){b?(a=this.inlineImgZarafaToOutlook(a),this.get("html_body")!==a&&(this.set("isHTML",!0,!0),this.set("html_body",a))):Zarafa.core.HTMLParser.rlnl2nl(this.get("body"))!==a&&(this.set("isHTML",!1,!0),this.set("body",a))},inlineImgOutlookToZarafa:function(a){var b,c;b=this.getMessageAction("action_type");var d=this.get("attach_num");this.phantom&&(Zarafa.mail.data.ActionTypes.isSendOrForward(b)||b===Zarafa.mail.data.ActionTypes.EDIT_AS_NEW)?(b=this.getMessageAction("source_entryid"),
c=this.getMessageAction("source_store_entryid")):(b=this.get("entryid"),c=this.get("store_entryid"));c&&b&&(a=Zarafa.core.HTMLParser.inlineImgOutlookToZarafa(a,c,b,d));return a},inlineImgZarafaToOutlook:function(a){return Zarafa.core.HTMLParser.inlineImgZarafaToOutlook(a)},isRead:function(){return this.isSubMessage()||0<(this.get("message_flags")&Zarafa.core.mapi.MessageFlags.MSGFLAG_READ)},isUnsent:function(){return 0<(this.get("message_flags")&Zarafa.core.mapi.MessageFlags.MSGFLAG_UNSENT)},isSubMessage:function(){return!Ext.isEmpty(this.get("attach_num"))},
needsReadReceipt:function(){return(this.get("message_flags")&Zarafa.core.mapi.MessageFlags.MSGFLAG_RN_PENDING)===Zarafa.core.mapi.MessageFlags.MSGFLAG_RN_PENDING},setReadFlags:function(a){var b=this.get("message_flags");!1===a?this.set("message_flags",b&~Zarafa.core.mapi.MessageFlags.MSGFLAG_READ):this.set("message_flags",b|Zarafa.core.mapi.MessageFlags.MSGFLAG_READ)},supportsRecipients:function(){return this.supportsSubStore("recipients")},createRecipientStore:function(){return this.createSubStore("recipients")},
setRecipientStore:function(a){return this.setSubStore("recipients",a)},getRecipientStore:function(){return this.getSubStore("recipients")},supportsAttachments:function(){return this.supportsSubStore("attachments")},createAttachmentStore:function(){return this.createSubStore("attachments")},setAttachmentStore:function(a){return this.setSubStore("attachments",a)},getAttachmentStore:function(){return this.getSubStore("attachments")},getAttachmentNames:function(){if(!this.get("hasattach")||this.get("hide_attachments"))return"";
var a=[];this.getSubStore("attachments").each(function(b){b.get("hidden")||a.push(b.get("name"))},this);return a.join("; ")},isFaultyMessage:function(){var a=this.get("message_class");return Ext.isEmpty(a)?!0:this.isMessageClass(["IPM","MEMO","REPORT","IPM.MAIL"],!1)},fixFaultyMessage:function(){this.isFaultyMessage()&&(this.set("message_class","IPM.Note"),this.save())},getDownloadMessageUrl:function(a){var b=container.getBaseURL(),b=Ext.urlAppend(b,"load=download_message"),b=Ext.urlAppend(b,"storeid="+
this.get("store_entryid"));return b=a?Ext.urlAppend(b,"AllAsZip=true"):Ext.urlAppend(b,"entryid="+this.get("entryid"))},hasVisibleAttachments:function(){var a=!1,b=this.getAttachmentStore().getRange();Ext.each(b,function(b){!1===b.get("hidden")&&(a=!0)},this);return a}});Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("REPORT.IPM",Zarafa.core.data.IPMRecord);Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("REPORT.IPM","recipients",Zarafa.core.data.IPMRecipientStore);
Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("REPORT.IPM","attachments",Zarafa.core.data.IPMAttachmentStore);Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM",Zarafa.core.data.IPMRecord);Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM","recipients",Zarafa.core.data.IPMRecipientStore);Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM","attachments",Zarafa.core.data.IPMAttachmentStore);
Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MESSAGE,Zarafa.core.data.IPMRecord);Ext.namespace("Zarafa.common.favorites.data");
Zarafa.common.favorites.data.FavoritesFolderRecord=Ext.extend(Zarafa.hierarchy.data.MAPIFolderRecord,{getChildren:function(){var a=Zarafa.common.favorites.data.FavoritesFolderRecord.superclass.getChildren.apply(this,arguments);this.isFavoritesRootFolder()&&this.getMAPIStore().getFavoritesStore().each(function(b){b.isFavoritesFolder()&&a.push(b)},this);return a},getOriginalRecordFromFavoritesRecord:function(){return container.getHierarchyStore().getById(this.get("store_entryid")).getFolderStore().getById(this.get("entryid"))}});
Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_FOLDER,Zarafa.common.favorites.data.FavoritesFolderRecord);Ext.namespace("Zarafa.common.freebusy.ui");
Zarafa.common.freebusy.ui.UserListView=Ext.extend(Zarafa.common.recipientfield.ui.RecipientList,{model:null,constructor:function(a){a=a||{};Ext.applyIf(a,{boxType:"zarafa.userlistbox",wrapCls:"x-form-text x-zarafa-boxfield x-freebusy-userlist-container",border:!0});Zarafa.common.freebusy.ui.UserListView.superclass.constructor.call(this,a);this.model&&(this.setRecipientStore(this.model.getUserStore()),this.mon(this.model,"userstorechange",this.onUserStoreChange,this))},onUserStoreChange:function(a){this.setRecipientStore(a)},
filterRecords:function(a,b){for(var c=[],d=0,e=b.length;d<e;d++){var f=b[d];Ext.isDefined(this.filterRecipientType)&&f.get("recipient_type")!==this.filterRecipientType||c.push(f)}return c},doBoxRemove:function(a){a.record.isMeetingOrganizer()||Zarafa.common.freebusy.ui.UserListView.superclass.doBoxRemove.apply(this,arguments)},onBoxContextMenu:function(a,b,c){Zarafa.core.data.UIFactory.openContextMenu(Zarafa.core.data.SharedComponentType["common.contextmenu.freebusy"],c,{position:b.getEl().getXY(),
editable:b.editable})}});Ext.reg("zarafa.freebusyuserlistview",Zarafa.common.freebusy.ui.UserListView);Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookSubStore=Ext.extend(Zarafa.addressbook.AddressBookStore,{parentRecord:null,constructor:function(a){a=a||{};var b=Zarafa.core.data.RecordFactory.getRecordClassByObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER);Ext.applyIf(a,{reader:new Zarafa.core.data.JsonReader({root:"item"},b)});Zarafa.addressbook.AddressBookSubStore.superclass.constructor.call(this,a)},getParentRecord:function(){return this.parentRecord},setParentRecord:function(a){this.parentRecord=a}});Ext.namespace("Zarafa.calendar.ui.canvas");
Zarafa.calendar.ui.canvas.AppointmentBoxView=Ext.extend(Zarafa.calendar.ui.canvas.AppointmentView,{bounds:void 0,mainRenderedText:"",subRenderedText:"",setSelected:function(a){Zarafa.calendar.ui.canvas.AppointmentBoxView.superclass.setSelected.call(this,a);a&&!Ext.isEmpty(this.bounds)&&(this.drawBodySelectionOutline(this.bounds),this.focus())},eventOverBodyStartHandle:function(a){if(this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventBodyPosition(a);var b=this.bounds[0];
return this.isEventOverElement(a,{left:b.left,right:b.left+this.dragHandleWidth,top:b.top,bottom:b.bottom})},eventOverBodyDueHandle:function(a){if(this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventBodyPosition(a);var b=this.bounds[this.bounds.length-1];return this.isEventOverElement(a,{left:b.right-this.dragHandleWidth,right:b.right,top:b.top,bottom:b.bottom})},eventOverBody:function(a){if(this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventBodyPosition(a);
for(var b=0,c=this.bounds.length;b<c;b++)if(this.isEventOverElement(a,this.bounds[b]))return!0;return!1},layoutInHeader:Ext.emptyFn,createHeader:Ext.emptyFn,destroyHeader:Ext.emptyFn,drawBodySelectionOutline:function(a){var b=this.parentView.getBodySelectionCanvas().dom.getContext("2d");b.save();b.lineWidth=1;b.strokeStyle="black";for(var c=0,d=a.length;c<d;c++){var e=a[c],f=e.left+.5,g=e.top+.5,h=e.right-e.left-1,k=e.bottom-e.top-1;b.strokeRect(f,g,h,k);e.firstBox&&(g+=Math.ceil(k/2),this.drawDragHandle(b,
f,g));e.lastBox&&(e.firstBox||(g+=Math.ceil(k/2)),this.drawDragHandle(b,f+h,g))}b.restore()},drawBodyElement:function(a,b,c){var d=b.right-b.left,e=b.bottom-b.top;a.save();a.translate(b.left,b.top);a.lineWidth=1;a.fillStyle="white";a.fillRect(3,3,d-6,e-6);var f=this.getAppointmentColor();b=1;this.isActive()||(b=this.opacityNonActiveAppointment);var g=this.getStripWidth();a.globalAlpha=b;a.fillStyle=f;a.fillRect(3+g,3,d-6-g,e-6);switch(this.getBusyStatus()){case Zarafa.core.mapi.BusyStatus.FREE:a.fillStyle=
"white";a.fillRect(3,3,g,e-6);a.strokeStyle=f;a.strokeRect(3.5,3.5,g,e-7);break;case Zarafa.core.mapi.BusyStatus.TENTATIVE:a.fillStyle=f;a.fillRect(3,3,g,e-6);a.globalAlpha=1;a.fillStyle=a.createPattern(Zarafa.calendar.ui.IconCache.getDashedImage(),"repeat");a.fillRect(3,3,g,e-6);break;case Zarafa.core.mapi.BusyStatus.OUTOFOFFICE:a.fillStyle="#912787";a.fillRect(3,3,g,e-6);break;default:a.fillStyle="#0f70bd",a.fillRect(3,3,g,e-6)}b=g+this.parentView.headerBackgroundCanvasStylingElement.getPadding("l");
a.globalAlpha=this.isActive()?1:this.opacityNonActiveAppointment;for(var g=this.parentView.headerBackgroundCanvasStylingElement.getStyle("font"),f=155>Zarafa.core.ColorSchemes.getLuma(f),f=this.isActive()&&f?"white":"black",h=this.iconRenderer(),k=0,l=h.length;k<l;k++){var m=Zarafa.calendar.ui.IconCache["get"+Ext.util.Format.capitalize(h[k])+"Icon"+("white"===f?"Active":"")]();a.drawImage(m,b,Math.ceil((e-m.height)/2));b+=m.width+5}a.beginPath();a.rect(3,3,d-6,e-6);a.clip();h=Math.min(1,Math.max(.1,
(d-b)/d));k=a.createLinearGradient(0,0,d,0);k.addColorStop(0,this.isActive()?"black":"#666666");k.addColorStop(h,this.isActive()?"black":"#666666");k.addColorStop(1,"rgba(0,0,0,0)");a.fillStyle=k;a.lineWidth=1;a.font=g;a.fillStyle=f;d={xPosition:b,yPosition:e-Math.ceil((e-parseInt(this.parentView.headerBackgroundCanvasStylingElement.getStyle("font-size")))/2)-2,width:d,showStartTime:!1,showEndTime:!1};this.isAllDay()||(d.startTimeText=Ext.util.Format.htmlDecode(this.startTimeTextRenderer()),d.endTimeText=
Ext.util.Format.htmlDecode(this.endTimeTextRenderer()),1<this.bounds.length?0===c?d.showStartTime=!0:this.bounds.length-1===c&&(d.showEndTime=!0):1===this.bounds.length&&(0<this.getDateRange().getNumDays()?(d.showStartTime=!0,d.showEndTime=!0):d.showStartTime=!0));this.drawTextOnAppointment(a,d);a.restore()},drawTextOnAppointment:function(a,b){var c=this.mainRenderedText+" "+this.subRenderedText,d=a.textWidth(b.endTimeText),e=a.textWidth(b.startTimeText+" "),f=b.width-(d+this.getStripWidth());b.showEndTime&&
!b.showStartTime?(a.drawText(b.endTimeText,f,b.yPosition),e=d/b.endTimeText.length,e=Math.floor(f/e),c=Ext.util.Format.ellipsis(c,e,!1)):b.showStartTime&&!b.showEndTime?(a.drawText(b.startTimeText,b.xPosition,b.yPosition),b.xPosition+=e):b.showStartTime&&b.showEndTime&&(a.drawText(b.endTimeText,f,b.yPosition),a.drawText(b.startTimeText,b.xPosition,b.yPosition),b.xPosition+=e,f-=b.xPosition,e/=b.startTimeText.length,e=Math.floor(f/e),c=Ext.util.Format.ellipsis(c,e,!1));a.drawText(c,b.xPosition,b.yPosition)},
drawBodyElements:function(a){for(var b=this.parentView.getBodyAppointmentCanvas().dom.getContext("2d"),c=0,d=a.length;c<d;c++)this.drawBodyElement(b,a[c],c);this.isSelected()&&this.drawBodySelectionOutline(a)},layoutInBody:function(){this.bounds=this.parentView.dateRangeToBodyBounds(this.getDateRange(),this.slot,void 0,!1);Ext.isEmpty(this.bounds)||this.drawBodyElements(this.bounds)},startTimeTextRenderer:function(){return Ext.util.Format.htmlEncode(this.record.get("startdate").format(this.timeFormat))},
endTimeTextRenderer:function(){return Ext.util.Format.htmlEncode(this.record.get("duedate").format(this.timeFormat))},onLayout:function(){this.mainRenderedText=Ext.util.Format.htmlDecode(this.mainTextRenderer());this.subRenderedText=Ext.util.Format.htmlDecode(this.subTextRenderer());Zarafa.calendar.ui.canvas.AppointmentBoxView.superclass.onLayout.call(this)}});Ext.namespace("Zarafa.calendar.ui.canvas");
Zarafa.calendar.ui.canvas.AppointmentDaysView=Ext.extend(Zarafa.calendar.ui.canvas.AppointmentView,{bounds:void 0,lineHeight:13,bodyTextTopOffset:4,bodyTextBottomOffset:2,leftPadding:4,iconSpacing:5,mainRenderedText:"",subRenderedText:"",setSelected:function(a){Zarafa.calendar.ui.canvas.AppointmentDaysView.superclass.setSelected.call(this,a);a&&!Ext.isEmpty(this.bounds)&&(this.isHeaderRange()?this.drawHeaderSelectionOutline(this.bounds):this.drawBodySelectionOutline(this.bounds),this.focus())},eventOverHeaderStartHandle:function(a){if(!this.isHeaderRange()||
!this.bounds||0===this.bounds.length)return!1;a=this.getEventHeaderPosition(a);return this.isEventOverElement(a,{left:this.bounds.left,right:this.bounds.left+this.dragHandleWidth,top:this.bounds.top,bottom:this.bounds.bottom})},eventOverHeaderDueHandle:function(a){if(!this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventHeaderPosition(a);return this.isEventOverElement(a,{left:this.bounds.right-this.dragHandleWidth,right:this.bounds.right,top:this.bounds.top,bottom:this.bounds.bottom})},
eventOverHeader:function(a){if(!this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventHeaderPosition(a);return this.isEventOverElement(a,this.bounds)},eventOverBodyStartHandle:function(a){if(this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventBodyPosition(a);var b=this.bounds[0];return this.isEventOverElement(a,{left:b.left,right:b.right,top:b.top,bottom:b.top+this.dragHandleHeight})},eventOverBodyDueHandle:function(a){if(this.isHeaderRange()||
!this.bounds||0===this.bounds.length)return!1;a=this.getEventBodyPosition(a);var b=this.bounds[this.bounds.length-1];return this.isEventOverElement(a,{left:b.left,right:b.right,top:b.bottom-this.dragHandleHeight,bottom:b.bottom})},eventOverBody:function(a){if(this.isHeaderRange()||!this.bounds||0===this.bounds.length)return!1;a=this.getEventBodyPosition(a);for(var b=0,c=this.bounds.length;b<c;b++)if(this.isEventOverElement(a,this.bounds[b]))return!0;return!1},drawHeaderSelectionOutline:function(a){var b=
this.parentView.getHeaderSelectionCanvas().dom.getContext("2d"),c=a.left+.5,d=a.top+.5,e=a.right-a.left-1,f=a.bottom-a.top-1;b.save();b.beginPath();b.lineWidth=1;b.strokeStyle="black";b.rect(c,d,e,f);b.stroke();d+=Math.floor(f/2);a.firstBox&&this.drawDragHandle(b,c,d);a.lastBox&&this.drawDragHandle(b,c+e,d);b.restore()},drawBodySelectionOutline:function(a){var b=this.parentView.getBodySelectionCanvas().dom.getContext("2d");b.save();b.beginPath();b.lineWidth=1;b.strokeStyle="black";for(var c=0,d=a.length;c<
d;c++){var e=a[c],f=e.left+.5,g=e.top+.5,h=e.right-e.left-1,k=e.bottom-e.top-1;b.rect(f,g,h,k);b.stroke();e.firstBox&&(f+=Math.ceil(h/2),this.drawDragHandle(b,f,g));e.lastBox&&(e.firstBox||(f+=Math.ceil(h/2)),this.drawDragHandle(b,f,g+k))}b.restore()},drawBodyText:function(a,b,c,d,e){if(!(0>=d)){for(var f=this.getAppointmentColor(),g=155>Zarafa.core.ColorSchemes.getLuma(f),h=this.isActive()&&g?"white":"black",k=this.iconRenderer(),l=0,m=c,n,p=0,r=k.length;p<r;p++)n=Zarafa.calendar.ui.IconCache["get"+
Ext.util.Format.capitalize(k[p])+"Icon"+(this.isActive()&&g?"Active":"")](),a.drawImage(n,b+l,m+this.bodyTextTopOffset),l+=n.width+this.iconSpacing;0<k.length&&(n=Zarafa.calendar.ui.IconCache["get"+Ext.util.Format.capitalize(k[0])+"Icon"](),m+=n.height);g=a.createLinearGradient(b,c,b+d,c);k=Math.min(1,Math.max(.1,(d-12)/d));g.addColorStop(0,h);g.addColorStop(k,h);g.addColorStop(1,f);a.fillStyle=g;a.lineWidth=1;a.font=this.parentView.headerBackgroundCanvasStylingElement.getStyle("font");f=a.drawWrappedText(this.mainRenderedText,
b,c+this.lineHeight,d,this.lineHeight,e,l,m);f+this.lineHeight<e&&(a.lineWidth=1,a.font=this.parentView.headerBackgroundCanvasStylingElement.getStyle("font"),a.drawWrappedText(this.subRenderedText,b,c+this.lineHeight+f,d,this.lineHeight,e-f))}},layoutInHeader:function(){var a=this.getAppointmentColor(),b=155>Zarafa.core.ColorSchemes.getLuma(a),c=this.isActive()&&b?"white":"black";this.bounds=this.parentView.dateRangeToHeaderBounds(this.getDateRange(),this.slot,1,!0);if(!Ext.isEmpty(this.bounds)){var d=
this.bounds.right-this.bounds.left,e=this.bounds.bottom-this.bounds.top,f=this.parentView.getHeaderAppointmentCanvas().dom.getContext("2d");f.save();f.translate(this.bounds.left,this.bounds.top);f.lineWidth=1;var g=.8;this.isActive()||(g=this.opacityNonActiveAppointment);f.fillStyle="white";f.fillRect(0,0,d,e-1);var h=this.getStripWidth();f.fillStyle=a;f.globalAlpha=g;f.fillRect(h+1,1,d-2-h,e-3);var g=this.getBusyStatus(),k=e-3;switch(g){case Zarafa.core.mapi.BusyStatus.FREE:break;case Zarafa.core.mapi.BusyStatus.TENTATIVE:f.fillStyle=
a;f.fillRect(1,1,h,k);f.globalAlpha=1;f.fillStyle=f.createPattern(Zarafa.calendar.ui.IconCache.getDashedImage(),"repeat");f.fillRect(1,1,h,k);break;case Zarafa.core.mapi.BusyStatus.OUTOFOFFICE:f.fillStyle="#912787";f.fillRect(1,1,h,k);break;default:f.fillStyle="#0f70bd",f.fillRect(1,1,h,k)}a=this.leftPadding+h;f.globalAlpha=this.isActive()?1:this.opacityNonActiveAppointment;h=this.iconRenderer();g=0;for(k=h.length;g<k;g++){var l=Zarafa.calendar.ui.IconCache["get"+Ext.util.Format.capitalize(h[g])+
"Icon"+(this.isActive()&&b?"Active":"")]();f.drawImage(l,a,6);a+=l.width+5}b=Math.min(1,Math.max(.1,(d-12)/d));h=f.createLinearGradient(0,0,d,0);h.addColorStop(0,c);h.addColorStop(b,c);h.addColorStop(1,this.isActive()?"rgba(255, 255, 255, 0)":"rgba(0, 0, 0, 0)");f.fillStyle=h;f.save();f.beginPath();f.rect(a,0,d-a,e);f.clip();f.lineWidth=1;f.font=this.parentView.headerBackgroundCanvasStylingElement.getStyle("font");f.drawText(this.mainRenderedText,a,e-8);a+=f.textWidth(this.mainRenderedText+" ");f.drawText(this.subRenderedText,
a,e-8);f.restore();this.isSelected()&&this.drawHeaderSelectionOutline(this.bounds);f.restore()}},drawBodyElement:function(a,b){var c=this.getBusyStatus(),d=b.right-b.left-2,e=b.bottom-b.top,f=this.parentView.getRangeVerticalHeight(this.getDateRange());a.save();a.translate(b.left,b.top);a.lineWidth=1;var g=this.getAppointmentColor(),h=.8;this.isActive()||(h=this.opacityNonActiveAppointment);a.globalAlpha=h;a.fillStyle=g;var k=this.getStripWidth(),l=f+1<e,m=!l&&0<k;a.fillRect(k+1,1,d-k,e);var n=e-1;
m?(a.strokeStyle="white",a.globalAlpha=1,a.strokeRect(.5,.5,d,e),a.globalAlpha=h):l&&(n=f-1);switch(c){case Zarafa.core.mapi.BusyStatus.FREE:a.strokeStyle=a.convertHexRgbToDecRgba(g);a.strokeRect(1.5,1.5,k-1,n-1);a.fillStyle="white";a.fillRect(2,2,k-1,n-2);break;case Zarafa.core.mapi.BusyStatus.TENTATIVE:a.fillRect(1,1,k,n);a.globalAlpha=1;a.fillStyle=a.createPattern(Zarafa.calendar.ui.IconCache.getDashedImage(),"repeat");a.fillRect(1,1,k,n);break;case Zarafa.core.mapi.BusyStatus.OUTOFOFFICE:a.fillStyle=
"#912787";a.fillRect(1,1,k,n);break;default:a.fillRect(1,1,k,n)}a.beginPath();a.rect(k+1,1,d-k-2,e-1);a.clip();a.globalAlpha=this.isActive()?1:this.opacityNonActiveAppointment;this.drawBodyText(a,k+this.leftPadding,this.bodyTextTopOffset,d-k-this.leftPadding,e-this.bodyTextTopOffset-this.bodyTextBottomOffset);a.restore()},drawBodyElements:function(a){for(var b=this.parentView.getBodyAppointmentCanvas().dom.getContext("2d"),c=0,d=a.length;c<d;c++)this.drawBodyElement(b,a[c]);this.isSelected()&&this.drawBodySelectionOutline(a)},
layoutInBody:function(){this.bounds=this.parentView.dateRangeToBodyBounds(this.getAdjustedDateRange(),this.slot,this.slotCount,!1);Ext.isEmpty(this.bounds)||this.drawBodyElements(this.bounds)},onLayout:function(){this.mainRenderedText=Ext.util.Format.htmlDecode(this.mainTextRenderer());this.subRenderedText=Ext.util.Format.htmlDecode(this.subTextRenderer());Zarafa.calendar.ui.canvas.AppointmentView.superclass.onLayout.call(this)}});Ext.namespace("Zarafa.core.data");
Zarafa.core.data.MessageRecordFields=[{name:"received_by_name"},{name:"received_by_email_address"},{name:"received_by_username"},{name:"received_by_address_type"},{name:"received_by_entryid"},{name:"received_by_search_key"},{name:"received_by_presence_status"},{name:"received_representing_name"},{name:"received_representing_email_address"},{name:"received_representing_address_type"},{name:"received_representing_entryid"},{name:"received_representing_search_key"},{name:"delegated_by_rule",type:"boolean",
defaultValue:!1},{name:"message_delivery_time",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"client_submit_time",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"transport_message_headers"},{name:"hide_attachments",type:"boolean",defaultValue:!1}];
Zarafa.core.data.MessageRecord=Ext.extend(Zarafa.core.data.IPMRecord,{externalContent:!1,hasExternalContent:function(a){a=Ext.isDefined(a)?a:this.getBody();if(!this.get("isHTML"))return this.externalContent=!1;if(!this.externalContent||this.isModifiedSinceLastUpdate("html_body"))this.externalContent=Zarafa.core.HTMLParser.hasExternalContent(a);return this.externalContent},getBody:function(a){var b=this.get("isHTML"),c=Zarafa.core.data.MessageRecord.superclass.getBody.call(this,a);return!0!==b||!0!==
a||Ext.isEmpty(c)?c:this.isUnsent()||!this.isExternalContentBlocked(c)?c:Zarafa.core.HTMLParser.blockExternalContent(c)},convertToTask:function(a){var b=a.getMAPIStore();a=Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Task",{store_entryid:a.get("store_entryid"),parent_entryid:a.get("entryid"),icon_index:Zarafa.core.mapi.IconIndex.task_normal,subject:this.get("subject"),body:this.getBody(!1),importance:this.get("importance"),categories:this.get("categories"),owner:b.isPublicStore()?
container.getUser().getFullName():b.get("mailbox_owner_name")});a.addMessageAction("source_entryid",this.get("entryid"));a.addMessageAction("source_store_entryid",this.get("store_entryid"));var c=a.getAttachmentStore();this.getAttachmentStore().each(function(a){c.add(a.copy())},this);return a},isExternalContentBlocked:function(a){a=Ext.isDefined(a)?a:this.getBody();if(Ext.isEmpty(a)||!container.getSettingsModel().get("zarafa/v1/contexts/mail/block_external_content"))return!1;var b=!0,c=!1,d=(this.get("sent_representing_email_address")||
this.get("sender_email_address")).toLowerCase(),e=container.getSettingsModel().get("zarafa/v1/contexts/mail/safe_senders_list",!0).map(function(a){return a.toLowerCase()});this.checkBlockStatus()&&(b=!1,c=!0);c||-1==e.indexOf(d)||(b=!1,c=!0);c||Zarafa.core.Util.inArray(e,d,!0,!0)&&(b=!1);return b&&this.hasExternalContent(a)?!0:!1},checkBlockStatus:function(){return this.senderIsUser()?!0:this.get("block_status")&&Ext.isDate(this.get("message_delivery_time"))?this.get("block_status")==this.calculateBlockStatus():
!1},calculateBlockStatus:function(){if(!Ext.isDate(this.get("message_delivery_time")))return 0;var a;a=25569+this.get("message_delivery_time").getTime()/864E5;a=1E8*(a-Math.floor(a))+3;return a=Math.floor(a)},senderIsReceiver:function(){var a=this.get("sent_representing_entryid")||this.get("sender_entryid"),b=this.get("received_by_entryid");if(!Ext.isEmpty(a)&&!Ext.isEmpty(b))return Zarafa.core.EntryId.compareABEntryIds(a,b);a=this.get("sent_representing_email_address")||this.get("sender_email_address");
b=this.get("received_by_email_address");return Ext.isEmpty(a)||Ext.isEmpty(b)?!1:a===b},senderIsUser:function(){var a=this.get("sent_representing_entryid")||this.get("sender_entryid"),b=container.getUser().getEntryId();return Ext.isEmpty(a)||Ext.isEmpty(b)?!1:Zarafa.core.EntryId.compareABEntryIds(a,b)},senderIsStoreOwner:function(){var a=this.get("sent_representing_entryid")||this.get("sender_entryid"),b=container.getHierarchyStore().getById(this.get("store_entryid"));return!b||(b=b.get("mailbox_owner_entryid"),
Ext.isEmpty(a)||Ext.isEmpty(b))?!1:Zarafa.core.EntryId.compareABEntryIds(a,b)},userIsStoreOwner:function(){var a=container.getUser().getEntryId(),b=container.getHierarchyStore().getById(this.get("store_entryid"));return!b||(b=b.get("mailbox_owner_entryid"),Ext.isEmpty(a)||Ext.isEmpty(b))?!1:Zarafa.core.EntryId.compareABEntryIds(a,b)},setDelegatorInfo:function(a,b){a&&(b=b||!1,this.set("sent_representing_name",a.get("mailbox_owner_name"),b),this.set("sent_representing_email_address",a.get("mailbox_owner_name"),
b),this.set("sent_representing_address_type","ZARAFA",b),this.set("sent_representing_entryid",a.get("mailbox_owner_entryid"),b))},getSender:function(){return this.get("sender_entryid")?Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{smtp_address:this.get("sender_email_address"),display_name:this.get("sender_name"),address_type:this.get("sender_address_type"),entryid:this.get("sender_entryid"),search_key:this.get("sender_search_key")}):
!1},getSentRepresenting:function(){return this.get("sent_representing_entryid")?Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{smtp_address:this.get("sent_representing_email_address"),display_name:this.get("sent_representing_name"),address_type:this.get("sent_representing_address_type"),entryid:this.get("sent_representing_entryid"),search_key:this.get("sent_representing_search_key")}):!1}});
Zarafa.core.data.MessageRecordPhantomHandler=function(a){var b=container.getUser();a.beginEdit();a.set("sender_name",b.getFullName());a.set("sender_address_type","ZARAFA");a.set("sender_email_address",b.getUserName());a.set("sender_entryid",b.getEntryId());a.set("sender_search_key",b.getSearchKey());a.userIsStoreOwner()||(b=container.getHierarchyStore().getById(a.get("store_entryid")))&&a.setDelegatorInfo(b);a.endEdit()};Ext.namespace("Zarafa.addressbook");
Zarafa.addressbook.AddressBookRecordFields=[{name:"entryid"},{name:"search_key"},{name:"full_name"},{name:"fileas"},{name:"object_type",type:"int",defaultValue:Zarafa.core.mapi.ObjectType.MAPI_MAILUSER},{name:"display_type",type:"int",defaultValue:Zarafa.core.mapi.DisplayType.DT_MAILUSER},{name:"display_type_ex",type:"int",defaultValue:Zarafa.core.mapi.DisplayType.DT_MAILUSER},{name:"address_type"},{name:"email_address"},{name:"smtp_address"},{name:"given_name"},{name:"initials"},{name:"surname"},
{name:"display_name"},{name:"account"},{name:"street_address"},{name:"locality"},{name:"state_or_province"},{name:"postal_code"},{name:"country"},{name:"title"},{name:"company_name"},{name:"department_name"},{name:"office_location"},{name:"assistant"},{name:"office_telephone_number"},{name:"business_telephone_number"},{name:"business2_telephone_number"},{name:"business2_telephone_number_mv"},{name:"primary_fax_number"},{name:"home_telephone_number"},{name:"home2_telephone_number"},{name:"home2_telephone_number_mv"},
{name:"mobile_telephone_number"},{name:"pager_telephone_number"},{name:"comment"}];Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,Zarafa.addressbook.AddressBookRecordFields);Zarafa.core.data.RecordFactory.addFieldToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,Zarafa.addressbook.AddressBookRecordFields);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"ems_ab_manager",Zarafa.addressbook.AddressBookSubStore);
Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"ems_ab_proxy_addresses",Zarafa.addressbook.AddressBookEmailAddressesSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"ems_ab_is_member_of_dl",Zarafa.addressbook.AddressBookSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"ems_ab_reports",Zarafa.addressbook.AddressBookSubStore);
Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"home2_telephone_numbers",Zarafa.addressbook.AddressBookTelephoneNumberSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"business2_telephone_numbers",Zarafa.addressbook.AddressBookTelephoneNumberSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,"ems_ab_owner",Zarafa.addressbook.AddressBookSubStore);
Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,"ems_ab_proxy_addresses",Zarafa.addressbook.AddressBookEmailAddressesSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,"ems_ab_is_member_of_dl",Zarafa.addressbook.AddressBookSubStore);Zarafa.core.data.RecordFactory.setSubStoreToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,"members",Zarafa.addressbook.AddressBookSubStore);
Zarafa.core.data.RecordFactory.addListenerToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,"createphantom",function(a){a.afterOpen()});Zarafa.core.data.RecordFactory.addListenerToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,"createphantom",function(a){a.afterOpen()});
Zarafa.addressbook.AddressBookRecord=Ext.extend(Zarafa.core.data.MAPIRecord,{convertToRecipient:function(a){return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{entryid:this.get("entryid"),search_key:this.get("search_key"),object_type:this.get("object_type"),display_name:this.get("display_name"),display_type:this.get("display_type"),display_type_ex:this.get("display_type_ex"),email_address:this.get("email_address"),smtp_address:this.get("smtp_address"),
address_type:this.get("address_type"),recipient_type:a||Zarafa.core.mapi.RecipientType.MAPI_TO})},convertToDistlistMember:function(){var a=Zarafa.core.mapi.DistlistType.DL_USER_AB;this.get("object_type")===Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&(a=Zarafa.core.mapi.DistlistType.DL_DIST_AB);var b=this.get("entryid");Zarafa.core.EntryId.hasContactProviderGUID(b)&&(a=a===Zarafa.core.mapi.DistlistType.DL_USER_AB?Zarafa.core.mapi.DistlistType.DL_USER:Zarafa.core.mapi.DistlistType.DL_DIST,b=Zarafa.core.EntryId.unwrapContactProviderEntryId(b));
a={entryid:b,address_type:this.get("address_type"),distlist_type:a,display_name:this.get("display_name"),email_address:this.get("email_address")||this.get("smtp_address"),smtp_address:this.get("smtp_address")||this.get("email_address")};return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,a)},convertToUserPermission:function(){return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_USER_PERMISSION,
{entryid:this.get("entryid"),display_name:this.get("display_name"),object_type:this.get("object_type"),rights:Zarafa.core.mapi.Rights.RIGHTS_NO_RIGHTS})},convertToDelegate:function(){var a={entryid:this.get("entryid"),display_name:this.get("display_name")};return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DELEGATE,a)},isPersonalContact:function(){return Zarafa.core.MessageClass.isClass(this.get("message_class"),"IPM.CONTACT",!0)||this.get("object_type")==
Zarafa.core.mapi.ObjectType.MAPI_MAILUSER&&Zarafa.core.EntryId.hasContactProviderGUID(this.get("entryid"))?!0:!1},isPersonalDistList:function(){return Zarafa.core.MessageClass.isClass(this.get("message_class"),"IPM.DISTLIST",!0)||this.get("object_type")==Zarafa.core.mapi.ObjectType.MAPI_DISTLIST&&Zarafa.core.EntryId.hasContactProviderGUID(this.get("entryid"))?!0:!1},convertToContactRecord:function(){var a=this.get("entryid"),b=a.indexOf("_");0<b&&(a=a.substr(0,b));Zarafa.core.EntryId.hasContactProviderGUID(a)&&
(a=Zarafa.core.EntryId.unwrapContactProviderEntryId(a));return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Contact",{entryid:a,message_class:"IPM.Contact",object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE},a)},convertToDistListRecord:function(){var a=this.get("entryid"),b=a.indexOf("_");0<b&&(a=a.substr(0,b));Zarafa.core.EntryId.hasContactProviderGUID(a)&&(a=Zarafa.core.EntryId.unwrapContactProviderEntryId(a));return Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.DistList",
{entryid:a,message_class:"IPM.DistList",object_type:Zarafa.core.mapi.ObjectType.MAPI_MESSAGE},a)},equals:function(a){return this===a?!0:Zarafa.core.EntryId.compareABEntryIds(this.get("entryid"),a.get("entryid"))}});Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,Zarafa.addressbook.AddressBookRecord);Zarafa.core.data.RecordFactory.setBaseClassToObjectType(Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,Zarafa.addressbook.AddressBookRecord);Ext.namespace("Zarafa.contact");
Zarafa.contact.ContactRecordFields=[{name:"fileas"},{name:"fileas_selection",type:"int",defaultValue:-1},{name:"display_name"},{name:"given_name"},{name:"middle_name"},{name:"surname"},{name:"nickname"},{name:"display_name_prefix"},{name:"generation"},{name:"email_address"},{name:"email_index",type:"number",defaultValue:-1},{name:"email_address_1"},{name:"email_address_display_name_1"},{name:"email_address_display_name_email_1"},{name:"email_address_type_1"},{name:"email_address_entryid_1"},{name:"email_address_2"},
{name:"email_address_display_name_2"},{name:"email_address_display_name_email_2"},{name:"email_address_type_2"},{name:"email_address_entryid_2"},{name:"email_address_3"},{name:"email_address_display_name_3"},{name:"email_address_display_name_email_3"},{name:"email_address_type_3"},{name:"email_address_entryid_3"},{name:"fax_1_email_address"},{name:"fax_1_original_display_name"},{name:"fax_1_address_type"},{name:"fax_1_original_entryid"},{name:"fax_2_email_address"},{name:"fax_2_original_display_name"},
{name:"fax_2_address_type"},{name:"fax_2_original_entryid"},{name:"fax_3_email_address"},{name:"fax_3_original_display_name"},{name:"fax_3_address_type"},{name:"fax_3_original_entryid"},{name:"business_address"},{name:"business_address_street"},{name:"business_address_city"},{name:"business_address_state"},{name:"business_address_postal_code"},{name:"business_address_country"},{name:"home_address"},{name:"home_address_street"},{name:"home_address_city"},{name:"home_address_state"},{name:"home_address_postal_code"},
{name:"home_address_country"},{name:"other_address"},{name:"other_address_street"},{name:"other_address_city"},{name:"other_address_state"},{name:"other_address_postal_code"},{name:"other_address_country"},{name:"mailing_address",type:"int"},{name:"home_telephone_number"},{name:"cellular_telephone_number"},{name:"assistant_telephone_number"},{name:"business_telephone_number"},{name:"business2_telephone_number"},{name:"callback_telephone_number"},{name:"car_telephone_number"},{name:"company_telephone_number"},
{name:"home2_telephone_number"},{name:"isdn_number"},{name:"other_telephone_number"},{name:"pager_telephone_number"},{name:"primary_telephone_number"},{name:"radio_telephone_number"},{name:"telex_telephone_number"},{name:"ttytdd_telephone_number"},{name:"business_fax_number"},{name:"home_fax_number"},{name:"primary_fax_number"},{name:"title"},{name:"company_name"},{name:"department_name"},{name:"office_location"},{name:"profession"},{name:"manager_name"},{name:"assistant"},{name:"nickname"},{name:"has_picture"},
{name:"hide_attachments"},{name:"spouse_name"},{name:"birthday",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"wedding_anniversary",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"birthday_eventid"},{name:"anniversary_eventid"},{name:"im"},{name:"business_home_page"},{name:"webpage"},{name:"private",type:"boolean",defaultValue:!1},{name:"sensitivity",type:"int",defaultValue:Zarafa.core.mapi.Sensitivity.NONE},{name:"contacts_string"},{name:"contacts"},{name:"message_flags",
type:"int",defaultValue:Zarafa.core.mapi.MessageFlags.MSGFLAG_READ},{name:"address_type",type:"string",defaultValue:"SMTP"},{name:"address_book_long",type:"int",defaultValue:0},{name:"address_book_mv",defaultValue:null},{name:"timezone",type:"int"},{name:"timezone_unk",mapping:"unk",type:"int"},{name:"timezone_timezonedst",mapping:"timezonedst",type:"int"},{name:"timezone_dstendmonth",mapping:"dstendmonth",type:"int"},{name:"timezone_dstendweek",mapping:"dstendweek",type:"int"},{name:"timezone_dstendday",
mapping:"dstendday",type:"int"},{name:"timezone_dstendhour",mapping:"dstendhour",type:"int"},{name:"timezone_dststartmonth",mapping:"dststartmonth",type:"int"},{name:"timezone_dststartweek",mapping:"dststartweek",type:"int"},{name:"timezone_dststartday",mapping:"dststartday",type:"int"},{name:"timezone_dststarthour",mapping:"dststarthour",type:"int"}];
Zarafa.contact.ContactRecord=Ext.extend(Zarafa.core.data.IPMRecord,{hasEmailAddress:function(){return!Ext.isEmpty(this.get("email_address_1"))||!Ext.isEmpty(this.get("email_address_2"))||!Ext.isEmpty(this.get("email_address_3"))},convertToRecipient:function(a,b){var c=[];if(!0===b){for(var d=1;4>d;d++)if(!Ext.isEmpty(this.get("email_address_"+d))){var e={entryid:Zarafa.core.EntryId.wrapContactProviderEntryId(this.get("entryid"),Zarafa.core.mapi.ObjectType.MAPI_MAILUSER),object_type:Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,
display_type:Zarafa.core.mapi.DisplayType.DT_MAILUSER,display_type_ex:Zarafa.core.mapi.DisplayType.DT_MAILUSER,display_name:this.get("email_address_display_name_"+d)||this.get("display_name"),smtp_address:this.get("email_address_"+d),email_address:this.get("email_address_"+d),address_type:this.get("email_address_type_"+d)||"SMTP",recipient_type:a||Zarafa.core.mapi.RecipientType.MAPI_TO};c.push(Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
e))}return c}if(!Ext.isEmpty(this.get("email_address")))return e={entryid:Zarafa.core.EntryId.wrapContactProviderEntryId(this.get("entryid"),Zarafa.core.mapi.ObjectType.MAPI_MAILUSER),object_type:Zarafa.core.mapi.ObjectType.MAPI_MAILUSER,display_type:Zarafa.core.mapi.DisplayType.DT_MAILUSER,display_type_ex:Zarafa.core.mapi.DisplayType.DT_MAILUSER,display_name:this.get("email_address_display_name")||this.get("display_name"),smtp_address:this.get("email_address"),email_address:this.get("email_address"),
address_type:"SMTP",recipient_type:a||Zarafa.core.mapi.RecipientType.MAPI_TO},Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,e)},convertToDistlistMember:function(){var a=this.get("entryid"),b=a.indexOf("_");0<b&&(a=a.substr(0,b));return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,{entryid:a,address_type:this.get("address_type"),distlist_type:Zarafa.core.mapi.DistlistType.DL_USER,
display_name:this.get("display_name"),email_address:this.get("email_address")})},updateTimezoneInformation:function(){var a=Date.getTimezoneStruct();this.beginEdit();this.set("timezone",a.timezone,!0);this.set("timezone_timezonedst",a.timezonedst,!0);this.set("timezone_dstendmonth",a.dstendmonth,!0);this.set("timezone_dstendweek",a.dstendweek,!0);this.set("timezone_dstendday",a.dstendday,!0);this.set("timezone_dstendhour",a.dstendhour,!0);this.set("timezone_dststartmonth",a.dststartmonth,!0);this.set("timezone_dststartweek",
a.dststartweek,!0);this.set("timezone_dststartday",a.dststartday,!0);this.set("timezone_dststarthour",a.dststarthour,!0);this.endEdit()},updateSubject:function(){var a=this.get("display_name_prefix"),b=this.get("generation"),c=this.get("display_name"),d=this.get("fileas");Ext.isEmpty(a)||(c=c.replace(a,""));Ext.isEmpty(b)||(c=c.replace(b,""));c=c.trim();Ext.isEmpty(d)&&!Ext.isEmpty(c)&&(a=c.replace(a,"").replace(b,"").replace(",","").trim().split(new RegExp(Zarafa.contact.data.config.SP+"|"+Zarafa.contact.data.config.NBSP,
"g")),d=1===a.length?a[0]:a.join(Zarafa.contact.data.config.NBSP));this.beginEdit();this.set("fileas",d);this.set("subject",c);this.endEdit()},updateAddressbookProps:function(){var a=0,b=[];this.beginEdit();for(var c=1;4>c;c++)if(Ext.isEmpty(this.get("email_address_"+c)))this.set("email_address_display_name_"+c,""),this.set("email_address_display_name_email_"+c,""),this.set("email_address_type_"+c,"");else{var d=this.get("fileas")||"";Ext.isEmpty(d)||(d+=" ");d+="("+this.get("email_address_"+c)+")";
this.set("email_address_display_name_"+c,d);Ext.isEmpty(this.get("email_address_display_name_"+c))?(this.set("email_address_display_name_email_"+c,""),this.set("email_address_type_"+c,"")):(a+=Math.pow(2,c-1),b.push(c-1),this.set("email_address_display_name_email_"+c,this.get("email_address_"+c)))}Ext.isEmpty(this.get("primary_fax_number"))?(this.set("fax_1_original_display_name",""),this.set("fax_1_address_type",""),this.set("fax_1_email_address","")):(this.set("fax_1_original_display_name",this.get("subject"),
!0),this.set("fax_1_address_type","FAX",!0),this.set("fax_1_email_address",this.get("fax_1_original_display_name")+"@"+this.get("primary_fax_number")),a+=32,b.push(5));Ext.isEmpty(this.get("business_fax_number"))?(this.set("fax_2_original_display_name",""),this.set("fax_2_address_type",""),this.set("fax_2_email_address","")):(this.set("fax_2_original_display_name",this.get("subject"),!0),this.set("fax_2_address_type","FAX",!0),this.set("fax_2_email_address",this.get("fax_2_original_display_name")+
"@"+this.get("business_fax_number")),a+=8,b.push(3));Ext.isEmpty(this.get("home_fax_number"))?(this.set("fax_3_original_display_name",""),this.set("fax_3_address_type",""),this.set("fax_3_email_address","")):(this.set("fax_3_original_display_name",this.get("subject"),!0),this.set("fax_3_address_type","FAX",!0),this.set("fax_3_email_address",this.get("fax_3_original_display_name")+"@"+this.get("home_fax_number")),a+=16,b.push(4));this.set("address_book_long",a);0<b.length?this.set("address_book_mv",
b.sort()):this.set("address_book_mv",null);this.endEdit()},afterOpen:function(){if(this.isSubMessage()){this.beginEdit();this.set("attach_num",[]);this.set("message_flags",Zarafa.core.mapi.MessageFlags.MSGFLAG_READ);this.set("entryid","");this.endEdit();this.phantom=!0;var a=this.get("message_class");if(Ext.isEmpty(a))return;a=container.getHierarchyStore().getDefaultFolderFromMessageClass(a);if(Ext.isEmpty(a))return;this.beginEdit();this.set("store_entryid",a.get("store_entryid"));this.set("parent_entryid",
a.get("entryid"));this.endEdit()}return Zarafa.contact.ContactRecord.superclass.afterOpen.call(this,arguments)},getDownloadMessageUrl:function(a){a=container.getBaseURL();a=Ext.urlAppend(a,"load=download_contact");a=Ext.urlAppend(a,"storeid="+this.get("store_entryid"));return a=Ext.urlAppend(a,"entryid="+this.get("entryid"))}});Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Contact",Zarafa.contact.ContactRecordFields);
Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM.Contact","attachments",Zarafa.core.data.IPMAttachmentStore);Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.Contact",Zarafa.contact.ContactRecord);Ext.namespace("Zarafa.contact");
Zarafa.contact.DistListRecordFields=[{name:"fileas"},{name:"dl_name"},{name:"subject"},{name:"display_name"},{name:"sensitivity",type:"int",defaultValue:Zarafa.core.mapi.Sensitivity.NONE},{name:"address_type",type:"string",defaultValue:"SMTP"},{name:"private",type:"boolean",defaultValue:!1}];
Zarafa.contact.DistlistRecord=Ext.extend(Zarafa.core.data.IPMRecord,{convertToRecipient:function(a){return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,{entryid:Zarafa.core.EntryId.wrapContactProviderEntryId(this.get("entryid"),Zarafa.core.mapi.ObjectType.MAPI_DISTLIST),object_type:Zarafa.core.mapi.ObjectType.MAPI_DISTLIST,display_type:Zarafa.core.mapi.DisplayType.DT_DISTLIST,display_type_ex:Zarafa.core.mapi.DisplayType.DT_DISTLIST,
display_name:this.get("display_name"),email_address:this.get("fileas"),address_type:"MAPIPDL",recipient_type:a||Zarafa.core.mapi.RecipientType.MAPI_TO})},convertToDistlistMember:function(){return Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_DISTLIST_MEMBER,{entryid:this.get("entryid"),address_type:"MAPIPDL",email_address:this.get("fileas"),distlist_type:Zarafa.core.mapi.DistlistType.DL_DIST,display_name:this.get("display_name")})},supportsMembers:function(){return this.supportsSubStore("members")},
createMemberStore:function(){return this.createSubStore("members")},setMemberStore:function(a){return this.setSubStore("members",a)},getMemberStore:function(){return this.getSubStore("members")},getMemberNames:function(){var a=[];this.getSubStore("members").each(function(b){var c=b.get("display_name");Ext.isEmpty(c)?a.push(b.get("email_address")):a.push(c)},this);return a.join("; ")}});Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.DistList",Zarafa.contact.DistListRecordFields);
Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM.DistList","members",Zarafa.contact.DistlistMemberStore);Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.DistList",Zarafa.contact.DistlistRecord);Ext.namespace("Zarafa.note");Zarafa.note.NoteRecordFields=[{name:"icon_index",type:"int",defaultValue:Zarafa.core.mapi.IconIndex.note_yellow},{name:"color",type:"int",defaultValue:Zarafa.core.mapi.NoteColor.note_yellow}];
Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.StickyNote",Zarafa.note.NoteRecordFields);Zarafa.note.NoteRecord=Ext.extend(Zarafa.core.data.IPMRecord,{generateSubject:function(){var a=this.get("body");28<a.length&&(a=Ext.util.Format.ellipsis(a,28));a=a.split(/\r\n|\r|\n/)[0];this.set("subject",a);return a}});Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.StickyNote",Zarafa.note.NoteRecord);Ext.namespace("Zarafa.advancesearch");
Zarafa.advancesearch.AdvanceSearchRecordFields=[{name:"searchdate",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"task_duedate",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"}];Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Search",Zarafa.advancesearch.AdvanceSearchRecordFields);Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.Search",Zarafa.core.data.MessageRecord);
Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM",Zarafa.advancesearch.AdvanceSearchRecordFields);Ext.namespace("Zarafa.calendar");
Zarafa.calendar.AppointmentRecordFields=[{name:"importance",type:"int",defaultValue:Zarafa.core.mapi.Importance.NORMAL},{name:"sensitivity",type:"int",defaultValue:Zarafa.core.mapi.Sensitivity.NONE},{name:"startdate",type:"date",dateFormat:"timestamp",allowBlank:!1,sortDir:"DESC"},{name:"duedate",type:"date",dateFormat:"timestamp",allowBlank:!1,sortDir:"DESC"},{name:"basedate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"recurring",type:"boolean",defaultValue:!1},{name:"recurring_reset",
type:"boolean",defaultValue:!1},{name:"recurring_pattern",type:"string"},{name:"startdate_recurring",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"enddate_recurring",type:"date",dateFormat:"timestamp",defaultValue:null,sortDir:"DESC"},{name:"exception",type:"boolean",defaultValue:!1},{name:"reply_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"reply_name",type:"string",defaultValue:""},{name:"busystatus",type:"int",defaultValue:Zarafa.core.mapi.BusyStatus.BUSY},
{name:"label",type:"int",defaultValue:Zarafa.core.mapi.AppointmentLabels.NONE},{name:"request_sent",type:"boolean",defaultValue:!1},{name:"alldayevent",type:"boolean",defaultValue:!1},{name:"private",type:"boolean",defaultValue:!1},{name:"meeting",type:"int",defaultValue:Zarafa.core.mapi.MeetingStatus.NONMEETING},{name:"location",type:"string"},{name:"duration",type:"int"},{name:"auxiliary_flags",type:"int"},{name:"responsestatus",type:"int",defaultValue:Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE},
{name:"reminder",type:"boolean"},{name:"reminder_minutes",type:"int"},{name:"reminder_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"flagdueby",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"commonstart",type:"date",dateFormat:"timestamp",allowBlank:!1},{name:"commonend",type:"date",dateFormat:"timestamp",allowBlank:!1},{name:"commonassign"},{name:"counter_proposal",type:"boolean",defaultValue:!1},{name:"recurrence_type",mapping:"type",type:"int",forceProtocol:!0},
{name:"recurrence_subtype",mapping:"subtype",type:"int",forceProtocol:!0},{name:"recurrence_everyn",mapping:"everyn",type:"int",forceProtocol:!0},{name:"recurrence_regen",mapping:"regen",type:"int",forceProtocol:!0},{name:"recurrence_weekdays",mapping:"weekdays",type:"int",forceProtocol:!0},{name:"recurrence_month",mapping:"month",type:"int",forceProtocol:!0},{name:"recurrence_monthday",mapping:"monthday",type:"int",forceProtocol:!0},{name:"recurrence_nday",mapping:"nday",type:"int",forceProtocol:!0},
{name:"recurrence_term",mapping:"term",type:"int",forceProtocol:!0},{name:"recurrence_numoccur",mapping:"numoccur",type:"int",forceProtocol:!0},{name:"recurrence_numexcept",mapping:"numexcept",type:"int",forceProtocol:!0},{name:"recurrence_numexceptmod",mapping:"numexceptmod",type:"int",forceProtocol:!0},{name:"recurrence_start",mapping:"start",type:"date",dateFormat:"timestamp",forceProtocol:!0,defaultValue:null},{name:"recurrence_end",mapping:"end",type:"date",dateFormat:"timestamp",forceProtocol:!0,
defaultValue:null},{name:"recurrence_startocc",mapping:"startocc",type:"int",forceProtocol:!0},{name:"recurrence_endocc",mapping:"endocc",type:"int",forceProtocol:!0},{name:"timezone",type:"int",forceProtocol:!0},{name:"timezone_unk",mapping:"unk",type:"int",forceProtocol:!0},{name:"timezone_timezonedst",mapping:"timezonedst",type:"int",forceProtocol:!0},{name:"timezone_dstendmonth",mapping:"dstendmonth",type:"int",forceProtocol:!0},{name:"timezone_dstendweek",mapping:"dstendweek",type:"int",forceProtocol:!0},
{name:"timezone_dstendday",mapping:"dstendday",type:"int",forceProtocol:!0},{name:"timezone_dstendhour",mapping:"dstendhour",type:"int",forceProtocol:!0},{name:"timezone_dststartmonth",mapping:"dststartmonth",type:"int",forceProtocol:!0},{name:"timezone_dststartweek",mapping:"dststartweek",type:"int",forceProtocol:!0},{name:"timezone_dststartday",mapping:"dststartday",type:"int",forceProtocol:!0},{name:"timezone_dststarthour",mapping:"dststarthour",type:"int",forceProtocol:!0}];
Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}",Zarafa.calendar.AppointmentRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}",Zarafa.core.data.MessageRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Appointment",Zarafa.calendar.AppointmentRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Appointment",Zarafa.core.data.MessageRecordFields);
Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.Appointment","createphantom",Zarafa.core.data.MessageRecordPhantomHandler);
Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.Appointment","createphantom",function(a,b){a.beginEdit();if(Ext.isNumber(a.get("duration"))){var c=a.get("startdate")||a.get("commonstart"),d=a.get("duedate")||a.get("commonend");c&&d&&a.set("duration",(d-c)/6E4)}c=container.getSettingsModel();if(!b||!Ext.isDefined(b.reminder)){var d=!1,e=container.getHierarchyStore().getById(a.get("store_entryid"));e&&e.isPublicStore()||(d=c.get("zarafa/v1/contexts/calendar/default_reminder"));a.set("reminder",
d)}b&&Ext.isDefined(b.reminder_minutes)||(a.get("alldayevent")?a.set("reminder_minutes",c.get("zarafa/v1/contexts/calendar/default_allday_reminder_time")):a.set("reminder_minutes",c.get("zarafa/v1/contexts/calendar/default_reminder_time")));a.get("reminder")&&(c=a.get("startdate"),Ext.isDate(c)&&(a.set("reminder_time",c),a.set("flagdueby",c.add(Date.MINUTE,-a.get("reminder_minutes")))));a.endEdit()});
Zarafa.calendar.AppointmentRecord=Ext.extend(Zarafa.core.data.MessageRecord,{baseIdProperties:["entryid","store_entryid","parent_entryid","basedate","attach_num"],equals:function(a){return!0===Zarafa.calendar.AppointmentRecord.superclass.equals.apply(this,arguments)?this.get("basedate")===a.get("basedate"):!1},generateRecurringPattern:function(){var a=this.get("recurrence_type"),b=this.get("recurrence_everyn"),c=this.get("recurrence_start").toUTC(),d=this.get("recurrence_end").toUTC(),e=this.get("recurrence_term"),
f=this.get("recurrence_numoccur"),g=this.get("recurrence_startocc"),h=this.get("recurrence_endocc"),k,l=!1,m=0!==g&&0!==h;switch(a){case Zarafa.common.recurrence.data.RecurrenceType.DAILY:1==b?(a=_("workday"),l=!0):1440==b?(a=_("day"),l=!0):(b/=1440,a=_("days"),l=!1);break;case Zarafa.common.recurrence.data.RecurrenceType.WEEKLY:1==b?(a=_("week"),l=!0):(a=_("weeks"),l=!1);a+=_(" on ")+this.prepareWeekDaysString();break;case Zarafa.common.recurrence.data.RecurrenceType.MONTHLY:1==b?(a=_("month"),l=
!0):(a=_("months"),l=!1);break;case Zarafa.common.recurrence.data.RecurrenceType.YEARLY:12>=b?(b=1,a=_("year"),l=!0):(b/=12,a=_("years"),l=!1)}var n=c.clone();n.setHours(g/60);n.setMinutes(g%60);g=n.format(_("G:i"));n.setHours(h/60);n.setMinutes(h%60);h=n.format(_("G:i"));c=c.format(_("d/m/Y"));d=d.format(_("d/m/Y"));e==Zarafa.common.recurrence.data.RecurrenceEnd.NEVER?k=m?l?String.format(_("Occurs every {0} effective {1} from {2} to {3}."),a,c,g,h):String.format(_("Occurs every {0} {1} effective {2} from {3} to {4}."),
b,a,c,g,h):l?String.format(_("Occurs every {0} effective {1}."),a,c):String.format(_("Occurs every {0} {1} effective {2}."),b,a,c):e==Zarafa.common.recurrence.data.RecurrenceEnd.N_OCCURENCES?k=m?l?String.format(ngettext("Occurs every {0} effective {1} for {2} occurence from {3} to {4}.","Occurs every {0} effective {1} for {2} occurences from {3} to {4}.",f),a,c,f,g,h):String.format(ngettext("Occurs every {0} {1} effective {2} for {3} occurence from {4} to {5}.","Occurs every {0} {1} effective {2} for {3} occurences {4} to {5}.",
f),b,a,c,f,g,h):l?String.format(ngettext("Occurs every {0} effective {1} for {2} occurence.","Occurs every {0} effective {1} for {2} occurences.",f),a,c,f):String.format(ngettext("Occurs every {0} {1} effective {2} for {3} occurence.","Occurs every {0} {1} effective {2} for {3} occurences.",f),b,a,c,f):e==Zarafa.common.recurrence.data.RecurrenceEnd.ON_DATE&&(k=m?l?String.format(_("Occurs every {0} effective {1} until {2} from {3} to {4}."),a,c,d,g,h):String.format(_("Occurs every {0} {1} effective {2} until {3} from {4} to {5}."),
b,a,c,d,g,h):l?String.format(_("Occurs every {0} effective {1} until {2}."),a,c,d):String.format(_("Occurs every {0} {1} effective {2} until {3}."),b,a,c,d));return k},generateMeetingTimeInfo:function(a){a=a||"";var b=this.get("startdate"),c=this.get("duedate"),d=this.get("location")||"",e=this.get("recurring_pattern")||"",f=_("When")+": ";e?f+=e+"\n":(f+=b.format(_("l jS F Y G:i"))+" - ",f+=c.format(_("l jS F Y G:i"))+"\n");f+=_("Where")+": "+d+"\n\n";return f+("*~*~*~*~*~*~*~*~*~*\n\n"+a)},sendMeetingRequestResponse:function(a,
b,c){if(Ext.isDefined(a)){switch(a){case Zarafa.core.mapi.ResponseStatus.RESPONSE_TENTATIVE:case Zarafa.core.mapi.ResponseStatus.RESPONSE_ACCEPTED:this.addMessageAction("action_type","acceptMeetingRequest");break;case Zarafa.core.mapi.ResponseStatus.RESPONSE_DECLINED:this.addMessageAction("action_type","declineMeetingRequest")}this.addMessageAction("responseType",a);this.addMessageAction("meetingTimeInfo",b);this.addMessageAction("sendResponse",c);this.getStore().save(this)}},respondToMeetingRequest:function(a,
b,c){this.sendMeetingRequestResponse(a,this.generateMeetingTimeInfo(b),c)},proposeNewTimeToMeetingRequest:function(a,b,c,d){this.set("counter_proposal",!0);this.addMessageAction("proposed_starttime",c);this.addMessageAction("proposed_endtime",d);this.sendMeetingRequestResponse(a,this.generateProposeNewTimeBody(b,c,d),!0)},generateProposeNewTimeBody:function(a,b,c){a=a+"\n\n\n-----------\n"+_("New Meeting Time Proposed")+":\n";a+=b.format(_("l jS F Y G:i"))+" - ";return a+=c.format(_("l jS F Y G:i"))+
"\n"},cancelInvitation:function(a){this.addMessageAction("action_type","cancelInvitation");this.addMessageAction("meetingTimeInfo",this.generateMeetingTimeInfo(a));a=this.getStore();a.remove(this);a.save(this)},declineMeeting:function(a){var b=this.getStore();a&&this.addMessageAction("action_type","declineMeeting");b.remove(this);b.save(this)},isAppointmentInPast:function(){var a=this.get("duedate");this.isRecurring()&&(a=this.get("enddate_recurring"));return Ext.isDate(a)&&a.getTime()<(new Date).getTime()?
!0:!1},isMeetingSent:function(){return this.isMeetingOrganized()&&!0===this.get("request_sent")},isMeetingReceived:function(){return this.get("meeting")===Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED&&this.get("responsestatus")!==Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED},isMeetingOrganized:function(){return this.get("meeting")===Zarafa.core.mapi.MeetingStatus.MEETING&&this.get("responsestatus")===Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED},isMeeting:function(){var a=this.get("meeting");
return a&&a!==Zarafa.core.mapi.MeetingStatus.NONMEETING},isMeetingCanceled:function(){var a=this.get("meeting");return a===Zarafa.core.mapi.MeetingStatus.MEETING_CANCELED||a===Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED_AND_CANCELED},isMeetingReceivedAndCanceled:function(){return this.get("meeting")===Zarafa.core.mapi.MeetingStatus.MEETING_RECEIVED_AND_CANCELED&&this.get("responsestatus")!==Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED},isMeetingResponseRequired:function(){return this.isMeetingReceived()&&
this.get("responsestatus")!==Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE},isRecurring:function(){return!0===this.get("recurring")&&!this.hasIdProp("basedate")},isRecurringOccurence:function(){return Ext.isDate(this.get("basedate"))},isRecurringException:function(){return Ext.isDate(this.get("basedate"))&&!0===this.get("exception")},isSubMessage:function(){return this.isRecurringOccurence()?!1:Zarafa.calendar.AppointmentRecord.superclass.isSubMessage.apply(this,arguments)},hasRecurringExceptions:function(){if(this.isOpened()){if(!this.isRecurring())return!1;
if(this.isRecurring()&&0<this.get("recurrence_numexcept"))return!0;var a=this.getSubStore("attachments");return a?0<=a.findBy(function(a){return a.isRecurrenceException()}):!1}},afterOpen:function(){this.isRecurring()&&(this.modified=this.modified||{},this.modified.startdate=this.get("startdate"),this.modified.duedate=this.get("duedate"),this.modified.basedate=this.get("basedate"),!0===this.trackUpdateModifications&&(this.updateModifications=this.updateModifications||{},this.updateModifications.startdate=
this.get("startdate"),this.updateModifications.duedate=this.get("duedate"),this.updateModifications.basedate=this.get("basedate")));Zarafa.calendar.AppointmentRecord.superclass.afterOpen.call(this);this.opened=!this.isRecurring();this.openedSeries=!this.opened;this.updateMeetingRecipients()},isOpened:function(){return this.isRecurring()?!0===this.openedSeries:!0===this.opened},isCopied:function(){return 0<(this.get("auxiliary_flags")&Zarafa.core.mapi.AppointmentAuxiliaryFlags.auxApptFlagCopied)},
addMessageAction:function(a,b){Zarafa.calendar.AppointmentRecord.superclass.addMessageAction.apply(this,arguments);"send"===a&&this.addMessageAction("meetingTimeInfo",this.generateMeetingTimeInfo(this.getBody()));"meetingTimeInfo"===a&&(this.isOpened()?this.deleteMessageAction("append_body"):this.addMessageAction("append_body",!0))},afterEdit:function(){this.isMeeting()&&this.hasMessageAction("send")&&this.addMessageAction("meetingTimeInfo",this.generateMeetingTimeInfo(this.getBody()));Zarafa.calendar.AppointmentRecord.superclass.afterEdit.apply(this,
arguments)},updateTimezoneInformation:function(){var a=Date.getTimezoneStruct();this.beginEdit();this.set("timezone",a.timezone);this.set("timezone_timezonedst",a.timezonedst);this.set("timezone_dstendmonth",a.dstendmonth);this.set("timezone_dstendweek",a.dstendweek);this.set("timezone_dstendday",a.dstendday);this.set("timezone_dstendhour",a.dstendhour);this.set("timezone_dststartmonth",a.dststartmonth);this.set("timezone_dststartweek",a.dststartweek);this.set("timezone_dststartday",a.dststartday);
this.set("timezone_dststarthour",a.dststarthour);this.endEdit()},updateMeetingRecipients:function(){var a=this.getSubStore("recipients");if(Ext.isDefined(a))if(this.isMeeting()){if(0>a.findBy(function(a,b){if(a.isMeetingOrganizer())return!0},this)){var b={recipient_type:Zarafa.core.mapi.RecipientType.MAPI_ORIG,recipient_flags:Zarafa.core.mapi.RecipientFlags.recipSendable|Zarafa.core.mapi.RecipientFlags.recipOrganizer,recipient_trackstatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED};this.get("sent_representing_entryid")?
Ext.apply(b,{display_name:this.get("sent_representing_name"),smtp_address:this.get("sent_representing_email_address"),address_type:this.get("sent_representing_address_type"),entryid:this.get("sent_representing_entryid")}):Ext.apply(b,{display_name:this.get("sender_name"),smtp_address:this.get("sender_email_address"),address_type:this.get("sender_address_type"),entryid:this.get("sender_entryid")});var b=Zarafa.core.data.RecordFactory.createRecordObjectByCustomType(Zarafa.core.data.RecordCustomObjectType.ZARAFA_RECIPIENT,
b,-1),c=[];a.each(function(a){c.push(a.copy())});c.push(b);a.loadRecords({records:c},void 0,!0);container.getShadowStore().on("update",this.addOrganizerAfterUpdate,this)}a.sortBy("ASC",function(a,b){var c=a.isMeetingOrganizer(),d=b.isMeetingOrganizer();return c!==d?c?-1:1:a.get("rowid")-b.get("rowid")})}else 0<a.getCount()&&a.removeAll()},addOrganizerAfterUpdate:function(a,b,c){c===Ext.data.Record.COMMIT&&(container.getShadowStore().un("update",this.addOrganizerAfterUpdate,this),this.updateMeetingRecipients())},
convertToMeeting:function(){this.beginEdit();this.set("meeting",Zarafa.core.mapi.MeetingStatus.MEETING);this.set("responsestatus",Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED);this.updateMeetingRecipients();this.endEdit()},convertToAppointment:function(){this.beginEdit();this.set("meeting",Zarafa.core.mapi.MeetingStatus.NONMEETING);this.set("responsestatus",Zarafa.core.mapi.ResponseStatus.RESPONSE_NONE);this.updateMeetingRecipients();this.endEdit()},convertToOccurenceRecord:function(){if(!1===
this.hasIdProp("basedate")){var a=this.copy();a.set("recurring",!1);a.addIdProp("basedate");if(!a.userIsStoreOwner()){var b=container.getHierarchyStore().getById(a.get("store_entryid"));b&&a.setDelegatorInfo(b,!0)}return a}return this},convertToSeriesRecord:function(){if(!0===this.hasIdProp("basedate")){var a=this.copy();a.set("recurring",!0);a.set("basedate","");a.set("exception",!1);a.removeIdProp("basedate");return a}return this},prepareWeekDaysString:function(){for(var a=new Ext.util.MixedCollection,
b=container.getSettingsModel().get("zarafa/v1/main/week_start"),c=[],d=0;d<Date.dayNames.length;d++)a.add({dayName:Date.dayNames[(b+d)%7],dayValue:Math.pow(2,(b+d)%7)});var e=this.get("recurrence_weekdays");a.each(function(a){a.dayValue&e&&c.push(a.dayName)});1<c.length&&(a=c.length-1,c[a]=_("and ")+c[a]);return 2===c.length?c.join(" "):c.join(", ")}});Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.Appointment",Zarafa.calendar.AppointmentRecord);
Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}",Zarafa.calendar.AppointmentRecord);Ext.namespace("Zarafa.mail");
Zarafa.mail.MailRecordFields=[{name:"importance",type:"int",defaultValue:Zarafa.core.mapi.Importance.NORMAL},{name:"private",type:"boolean",defaultValue:!1},{name:"sensitivity",type:"int",defaultValue:Zarafa.core.mapi.Sensitivity.NONE},{name:"flag_status"},{name:"flag_icon"},{name:"reply_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"reply_requested"},{name:"response_requested"},{name:"source_message_info"},{name:"reminder",type:"boolean",defaultValue:!1},{name:"reminder_time",
type:"date",dateFormat:"timestamp",defaultValue:null},{name:"flag_request"},{name:"flag_due_by",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"flag_complete_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"block_status",type:"int",defaultValue:void 0},{name:"stubbed",type:"boolean",defaultValue:!1},{name:"startdate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"duedate",type:"date",dateFormat:"timestamp",defaultValue:null}];
Zarafa.mail.MailRecordPhantomHandler=function(a){var b=container.getSettingsModel().get("zarafa/v1/contexts/mail/always_request_readreceipt");a.set("read_receipt_requested",b)};Zarafa.core.data.RecordFactory.addFieldToMessageClass("REPORT.IPM.Note",Zarafa.mail.MailRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("REPORT.IPM.Note",Zarafa.core.data.MessageRecordFields);Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("REPORT.IPM.Note","reply-to",Zarafa.core.data.IPMRecipientStore);
Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Note",Zarafa.mail.MailRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Note",Zarafa.core.data.MessageRecordFields);Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM.Note","reply-to",Zarafa.core.data.IPMRecipientStore);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Schedule",Zarafa.mail.MailRecordFields);Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.Note","createphantom",Zarafa.core.data.MessageRecordPhantomHandler);
Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.Note","createphantom",Zarafa.mail.MailRecordPhantomHandler);Zarafa.core.data.RecordFactory.addDefaultValueToMessageClass("IPM.Note","message_flags",Zarafa.core.mapi.MessageFlags.MSGFLAG_UNSENT);Zarafa.core.data.RecordFactory.addDefaultValueToMessageClass("REPORT.IPM.Note","message_flags",Zarafa.core.mapi.MessageFlags.MSGFLAG_UNSENT);Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("REPORT.IPM.Note",Zarafa.core.data.MessageRecord);
Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.Note",Zarafa.core.data.MessageRecord);Ext.namespace("Zarafa.task");
Zarafa.task.TaskRecordFields=[{name:"importance",type:"int",defaultValue:Zarafa.core.mapi.Importance.NORMAL},{name:"message_flags",type:"int",defaultValue:Zarafa.core.mapi.MessageFlags.MSGFLAG_READ},{name:"last_modification_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"recurring",type:"boolean"},{name:"startdate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"duedate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"commonstart",type:"date",dateFormat:"timestamp",
defaultValue:null},{name:"commonend",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"taskstate",type:"int",defaultValue:Zarafa.core.mapi.TaskState.NORMAL},{name:"taskmode",type:"int",defaultValue:Zarafa.core.mapi.TaskMode.NOTHING},{name:"tasksoc",type:"boolean",defaultValue:!0},{name:"taskupdates",type:"boolean",defaultValue:!0},{name:"reminder",type:"boolean",defaultValue:!1},{name:"reminderdate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"owner"},{name:"status",type:"int",
defaultValue:Zarafa.core.mapi.TaskStatus.NOT_STARTED},{name:"percent_complete",type:"float",defaultValue:0},{name:"complete",type:"boolean",defaultValue:!1},{name:"sensitivity",type:"int",defaultValue:Zarafa.core.mapi.Sensitivity.NONE},{name:"private",type:"boolean",defaultValue:!1},{name:"totalwork",type:"int",defaultValue:0},{name:"actualwork",type:"int",defaultValue:0},{name:"mileage"},{name:"billing_information"},{name:"companies"},{name:"date_completed",type:"date",dateFormat:"timestamp",defaultValue:null},
{name:"reminder",type:"boolean",defaultValue:!1},{name:"reminder_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"hide_attachments",type:"boolean",defaultValue:!1},{name:"ownership",type:"int",defaultValue:Zarafa.core.mapi.TaskOwnership.NEWTASK},{name:"conversation_topic"},{name:"task_assigner"},{name:"task_assigned_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"taskhistory",type:"int",defaultValue:Zarafa.core.mapi.TaskHistory.NONE},{name:"task_goid"},{name:"tasklastuser"},
{name:"flag_status"},{name:"flag_icon"},{name:"flag_request"},{name:"flag_due_by",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"flag_complete_time",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"task_acceptance_state",type:"int",defaultValue:Zarafa.core.mapi.TaskAcceptanceState.NOT_DELEGATED},{name:"updatecount",type:"int"},{name:"task_not_found",type:"boolean"}];Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Task",Zarafa.task.TaskRecordFields);
Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM.Task","reply-to",Zarafa.core.data.IPMRecipientStore);
Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.Task","createphantom",function(a,b){a.beginEdit();if(!b||!Ext.isDefined(b.reminder)){var c=!1,d=container.getHierarchyStore().getById(a.get("store_entryid"));d&&d.isPublicStore()||(c=container.getSettingsModel().get("zarafa/v1/contexts/task/default_reminder"));a.set("reminder",c)}a.get("reminder")&&(c=(new Date).clearTime().add(Date.MINUTE,container.getSettingsModel().get("zarafa/v1/contexts/task/default_reminder_time")),a.set("reminder_time",
c));a.endEdit()});
Zarafa.task.TaskRecord=Ext.extend(Zarafa.core.data.MessageRecord,{isTaskRequest:function(){return this.get("taskmode")!==Zarafa.core.mapi.TaskMode.NOTHING||this.isMessageClass("IPM.TaskRequest")},isTaskOrganized:function(){return this.get("taskstate")===Zarafa.core.mapi.TaskState.ACCEPT||this.get("taskstate")===Zarafa.core.mapi.TaskState.DECLINE},isTaskDelegated:function(){return this.get("ownership")===Zarafa.core.mapi.TaskOwnership.DELEGATEDTASK},isTaskOwner:function(){return this.get("ownership")===Zarafa.core.mapi.TaskOwnership.OWNTASK},
isTaskReceived:function(){return this.get("taskstate")===Zarafa.core.mapi.TaskState.OWNER},isTaskAssigned:function(){return this.get("taskhistory")===Zarafa.core.mapi.TaskHistory.ASSIGNED},isTaskAccepted:function(){return this.get("taskhistory")===Zarafa.core.mapi.TaskHistory.ACCEPTED},isTaskUpdated:function(){return this.get("taskhistory")===Zarafa.core.mapi.TaskHistory.UPDATED},isNormalTask:function(){var a=this.get("taskstate");return a===Zarafa.core.mapi.TaskState.NORMAL||a===Zarafa.core.mapi.TaskState.OWNER_NEW},
isTaskDeclined:function(){return this.get("taskstate")===Zarafa.core.mapi.TaskState.DECLINE&&this.get("taskhistory")===Zarafa.core.mapi.TaskHistory.DECLINED},isDraftAssignedTask:function(){return this.get("taskstate")===Zarafa.core.mapi.TaskState.OWNER_NEW&&this.get("taskmode")===Zarafa.core.mapi.TaskMode.REQUEST},isTaskNotResponded:function(){return this.isTaskOwner()&&this.isTaskReceived()&&this.isTaskAssigned()},generateTaskCommentsInfo:function(a){a=a||"";return Ext.isEmpty(this.get("body"))?
a:a+="\n---------\n"+this.get("body")},respondToTaskRequest:function(a,b,c){this.sendTaskRequestResponse(a,this.generateTaskCommentsInfo(b),c)},sendTaskRequestResponse:function(a,b,c){if(Ext.isDefined(a)){switch(a){case Zarafa.core.mapi.TaskMode.ACCEPT:this.addMessageAction("action_type","acceptTaskRequest");this.set("taskhistory",Zarafa.core.mapi.TaskHistory.ACCEPTED,!0);break;case Zarafa.core.mapi.TaskMode.DECLINE:this.addMessageAction("action_type","declineTaskRequest"),this.set("taskhistory",
Zarafa.core.mapi.TaskHistory.DECLINED,!0)}this.addMessageAction("response_type",a);c&&this.addMessageAction("task_comments_info",b);this.getStore().save(this)}},deleteIncompleteTask:function(a){"delete"!==a&&this.addMessageAction("action_type",a);a=this.getStore();a.remove(this);a.save(this)},convertToTaskRequest:function(){this.beginEdit();this.set("taskstate",Zarafa.core.mapi.TaskState.OWNER_NEW);this.set("taskmode",Zarafa.core.mapi.TaskMode.REQUEST);this.endEdit()}});
Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.Task",Zarafa.task.TaskRecord);Ext.namespace("Zarafa.calendar");
Zarafa.calendar.MeetingRequestRecordFields=[{name:"conflictinfo"},{name:"appointment_not_found",type:"boolean",defaultValue:!1},{name:"counter_proposal",type:"boolean",defaultValue:!1},{name:"meetingtype",type:"number",defaultValue:Zarafa.core.mapi.MeetingType.MEETING_NONE},{name:"proposed_start_date",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"proposed_end_date",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"proposed_duration",type:"number"},{name:"appointment_entryid"},
{name:"appointment_store_entryid"},{name:"appointment_parent_entryid"},{name:"appointment_basedate",type:"date",dateFormat:"timestamp",defaultValue:null},{name:"appointment_duedate",type:"date",dateFormat:"timestamp"},{name:"appointment_startdate",type:"date",dateFormat:"timestamp"},{name:"appointment_recurring",type:"boolean"},{name:"appointment_recurring_pattern",type:"string"},{name:"appointment_startdate_recurring",type:"date",dateFormat:"timestamp"},{name:"appointment_enddate_recurring",type:"date",
dateFormat:"timestamp"},{name:"appointment_exception",type:"boolean",defaultValue:!1},{name:"appointment_location",type:"string"},{name:"updatecounter",type:"int",defaultValue:0},{name:"meeting_updated",type:"boolean",defaultValue:!1},{name:"goid",type:"string"},{name:"goid2",type:"string"}];Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Schedule",Zarafa.calendar.MeetingRequestRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.Schedule",Zarafa.core.data.MessageRecordFields);
Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM.Schedule","reply-to",Zarafa.core.data.IPMRecipientStore);Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.Schedule","createphantom",Zarafa.core.data.MessageRecordPhantomHandler);
Zarafa.calendar.MeetingRequestRecord=Ext.extend(Zarafa.calendar.AppointmentRecord,{isMeetingReceived:function(){return!0},isMeetingRequestResponse:function(){return this.isMessageClass("IPM.Schedule.Meeting.Resp",!0)},isMeetingRequestCanceled:function(){return this.isMessageClass("IPM.Schedule.Meeting.Canceled",!0)},isMeetingRequest:function(){return this.isMessageClass("IPM.Schedule.Meeting.Request",!0)},isRecurring:function(){return!0===this.get("appointment_recurring")},isRecurringOccurence:function(){return Ext.isDate(this.get("appointment_basedate"))},
isRecurringException:function(){return Ext.isDate(this.get("appointment_basedate"))&&!0===this.get("appointment_exception")},isMeetingOutOfDate:function(){return this.get("meetingtype")===Zarafa.core.mapi.MeetingType.MEETING_OUT_OF_DATE},isAppointmentInPast:function(){var a=this.get("appointment_duedate");return Ext.isDate(a)&&a.getTime()<(new Date).getTime()?!0:!1},generateMeetingTimeInfo:function(a){a=a||"";var b=this.get("appointment_startdate"),c=this.get("appointment_duedate"),d=this.get("appointment_location")||
"",e=this.get("appointment_recurring_pattern")||"",f=_("When")+": ";e?f+=e+"\n":(f+=b.format(_("l jS F Y G:i"))+" - ",f+=c.format(_("l jS F Y G:i"))+"\n");f+=_("Where")+": "+d+"\n\n";return f+("*~*~*~*~*~*~*~*~*~*\n\n"+a)},convertToAppointmentRecord:function(a){var b=this.get("appointment_entryid"),c=this.get("appointment_parent_entryid"),d=this.get("appointment_store_entryid"),e=this.get("appointment_basedate");if(!Ext.isEmpty(b)&&!Ext.isEmpty(d))return Ext.isBoolean(a)||(a=!0),Zarafa.core.data.RecordFactory.createRecordObjectByMessageClass("IPM.Appointment",
{entryid:b,store_entryid:d,parent_entryid:c,basedate:e,counter_proposal:a,meeting:Zarafa.core.mapi.MeetingStatus.MEETING,responsestatus:Zarafa.core.mapi.ResponseStatus.RESPONSE_ORGANIZED,startdate:this.get("appointment_startdate"),duedate:this.get("appointment_duedate")},b)},updateMeetingRecipients:Ext.emptyFn});Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.Schedule",Zarafa.calendar.MeetingRequestRecord);Ext.namespace("Zarafa.task");
Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.TaskRequest",Zarafa.task.TaskRecordFields);Zarafa.core.data.RecordFactory.addFieldToMessageClass("IPM.TaskRequest",Zarafa.core.data.MessageRecordFields);Zarafa.core.data.RecordFactory.addListenerToMessageClass("IPM.TaskRequest","createphantom",Zarafa.core.data.MessageRecordPhantomHandler);Zarafa.core.data.RecordFactory.setSubStoreToMessageClass("IPM.TaskRequest","reply-to",Zarafa.core.data.IPMRecipientStore);
Zarafa.task.TaskRequestRecord=Ext.extend(Zarafa.task.TaskRecord,{isReceivedTaskRequestFromAssigner:function(){return this.isTaskOwner()&&this.isTaskAssigned()&&this.get("taskmode")===Zarafa.core.mapi.TaskMode.REQUEST&&this.get("task_acceptance_state")===Zarafa.core.mapi.TaskAcceptanceState.DELEGATION_UNKNOWN}});Zarafa.core.data.RecordFactory.setBaseClassToMessageClass("IPM.TaskRequest",Zarafa.task.TaskRequestRecord);//# sourceMappingURL=kopano.js.map
