Created
October 17, 2019 13:19
-
-
Save wellington1993/a7cab4a75a515e0aa5d41b332777a154 to your computer and use it in GitHub Desktop.
Startup1_2_all.js.zgz?v=190823104651
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Zimbra Collaboration Suite Web Client | |
* Copyright (C) 2004-2017 Synacor, Inc. | |
* https://www.zimbra.com/license | |
*/ | |
if(AjxPackage.define("Startup1_2")){if(AjxPackage.define("zimbraMail.share.model.ZmObjectHandler")){ZmObjectHandler=function(a,b){if(arguments.length>0){this.init(a,b) | |
}}; | |
ZmObjectHandler.prototype.constructor=ZmObjectHandler; | |
ZmObjectHandler.prototype.isZmObjectHandler=true; | |
ZmObjectHandler.prototype.init=function(a,b){this._typeName=a; | |
this._className=b?b:"Object"; | |
this.name=this.toString() | |
}; | |
ZmObjectHandler.prototype.toString=function(){if(!this._toString){var a=""+this.constructor; | |
a=a.substring(0,a.indexOf("(")); | |
this._toString=a.substring("function ".length) | |
}return this._toString | |
}; | |
ZmObjectHandler.prototype.getEnabled=function(){return true | |
}; | |
ZmObjectHandler.prototype.getTypeName=function(){return this._typeName | |
}; | |
ZmObjectHandler.prototype.getClassName=function(c,a,b){return this._className | |
}; | |
ZmObjectHandler.prototype.getHoveredClassName=function(d,b,c){var a=this.getClassName(d,b,c); | |
if(this._cachedClassNameForHovered!==a){this._cachedClassNameForHovered=a; | |
this._classNameHovered=a+"-"+DwtCssStyle.HOVER | |
}return this._classNameHovered | |
}; | |
ZmObjectHandler.prototype.getActiveClassName=function(d,b,c){var a=this.getClassName(d,b,c); | |
if(this._cachedClassNameForActive!==a){this._cachedClassNameForActive=a; | |
this._classNameActive=a+"-"+DwtCssStyle.ACTIVE | |
}return this._classNameActive | |
}; | |
ZmObjectHandler.prototype.findObject=function(a,c,b){if(c===0){this._lastMatch=null; | |
this._noMatch=false | |
}if(this._noMatch){return null | |
}if(this._lastMatch&&this._lastMatch.index>=c){return this._lastMatch | |
}this._lastMatch=this.match(a,c,b); | |
this._noMatch=(this._lastMatch===null); | |
return this._lastMatch | |
}; | |
ZmObjectHandler.prototype.match=function(a,b){return null | |
}; | |
ZmObjectHandler.prototype._getHtmlContent=function(c,a,e,b,d){c[a++]=AjxStringUtil.htmlEncode(e,true); | |
return a | |
}; | |
ZmObjectHandler.prototype.generateSpan=function(d,a,f,e,c,b){d[a++]="<span class='"; | |
d[a++]=this.getClassName(f); | |
d[a++]="' role='link' id='"; | |
d[a++]=e; | |
d[a++]="'>"; | |
a=this._getHtmlContent(d,a,f,c,e,b); | |
d[a++]="</span>"; | |
return a | |
}; | |
ZmObjectHandler.prototype.hasToolTipText=function(b,a){return true | |
}; | |
ZmObjectHandler.prototype.getToolTipText=function(b,a){return AjxStringUtil.htmlEncode(b) | |
}; | |
ZmObjectHandler.prototype.populateToolTip=function(b,a){}; | |
ZmObjectHandler.prototype.getActionMenu=function(c,b,a){return null | |
}; | |
ZmObjectHandler.prototype.selected=function(d,b,c,a){return this.clicked(b,d,a,c) | |
}; | |
ZmObjectHandler.prototype.clicked=function(b,d,a,c){}; | |
ZmObjectHandler.prototype.hoverOver=function(b,c,a,h){var f=this.getToolTipText(b,c)||"",e,g; | |
if(typeof(f)==="string"){e=f | |
}else{if(f.isAjxCallback||AjxUtil.isFunction(f)){g=f | |
}else{if(typeof(f)==="object"){e=f.content; | |
g=f.callback | |
}}}if(!e&&g&&f.loading){e=AjxMsg.loading | |
}if(e){this._showTooltip(b,c,a,h,e) | |
}if(g){var d=new AjxCallback(this,this._showTooltip,[b,c,a,h]); | |
AjxTimedAction.scheduleAction(new AjxTimedAction(null,function(){g.run(d) | |
}),0) | |
}}; | |
ZmObjectHandler.prototype._showTooltip=function(b,d,a,g,e){var c=DwtShell.getShell(window); | |
var f=c.getToolTip(); | |
f.setContent(e); | |
f.popup(a,g); | |
this.populateToolTip(b,d) | |
}; | |
ZmObjectHandler.prototype.hoverOut=function(a,c){var b=DwtShell.getShell(window); | |
var d=b.getToolTip(); | |
d.popdown() | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmObjectManager")){ZmObjectManager=function(b,a,c){this._selectCallback=a; | |
this._uuid=Dwt.getNextId(); | |
this._objectIdPrefix="OBJ_PREFIX_"; | |
this._objectHandlers={}; | |
if(appCtxt.get(ZmSetting.MAIL_ENABLED)&&window.ZmImageAttachmentObjectHandler){this._imageAttachmentHandler=new ZmImageAttachmentObjectHandler() | |
}if(!c){this.initialized=false; | |
this._addAutoHandlers() | |
}else{this.initialized=true | |
}this.sortHandlers(); | |
this.reset(); | |
this.setView(b) | |
}; | |
ZmObjectManager._TOOLTIP_DELAY=275; | |
ZmObjectManager.EMAIL="email"; | |
ZmObjectManager.URL="url"; | |
ZmObjectManager.PHONE="phone"; | |
ZmObjectManager.DATE="date"; | |
ZmObjectManager.ADDRESS="address"; | |
ZmObjectManager.TITLE="title"; | |
ZmObjectManager.ATTR_CURRENT_DATE="currentDate"; | |
ZmObjectManager._autohandlers=[]; | |
ZmObjectManager.registerHandler=function(obj,type,priority){if(typeof obj=="string"){obj=eval(obj) | |
}var c=ZmObjectManager._autohandlers; | |
if(!obj.__registered){var id=c.push(obj); | |
var i=id-1; | |
if(type){c[i].useType=type | |
}if(priority){c[i].usePrio=priority | |
}obj.__registered=true | |
}}; | |
ZmObjectManager.unregisterHandler=function(obj){if(typeof obj=="string"){obj=eval(obj) | |
}var c=ZmObjectManager._autohandlers,i; | |
for(i=c.length; | |
--i>=0; | |
){if(c[i]===obj){c.splice(i,1); | |
break | |
}}}; | |
ZmObjectManager.prototype.toString=function(){return"ZmObjectManager" | |
}; | |
ZmObjectManager.prototype.getHandlers=function(){if(!this.initialized){var a=appCtxt.getZimletMgr(); | |
if(a.isLoaded()){this.initialized=true; | |
var c=a.getContentZimlets(); | |
for(var b=0; | |
b<c.length; | |
b++){this.addHandler(c[b],c[b].type,c[b].prio) | |
}}}return this._objectHandlers | |
}; | |
ZmObjectManager.prototype.addHandler=function(c,b,a){b=b||(c.getTypeName()?c.getTypeName():"none"); | |
a=a?a:-1; | |
c._prio=a; | |
var d=this.getHandlers(); | |
if(!d[b]){d[b]=[] | |
}d[b].push(c) | |
}; | |
ZmObjectManager.prototype.removeHandler=function(c,b){b=b||(c.getTypeName()?c.getTypeName():"none"); | |
var e=this.getHandlers(); | |
if(e[b]){for(var a=0,d=e[b].length; | |
a<d; | |
a++){if(e[b][a]==c){e[b].splice(a,1); | |
break | |
}}}}; | |
ZmObjectManager.prototype.sortHandlers=function(){this._allObjectHandlers=[]; | |
var c=this.getHandlers(); | |
for(var b in c){c[b].sort(ZmObjectManager.__byPriority); | |
for(var a=0; | |
a<c[b].length; | |
a++){this._allObjectHandlers.push(c[b][a]) | |
}}this._allObjectHandlers.sort(ZmObjectManager.__byPriority) | |
}; | |
ZmObjectManager.prototype._addAutoHandlers=function(){var g=ZmObjectManager._autohandlers,a,e,f; | |
for(a=0; | |
a<g.length; | |
++a){e=g[a]; | |
var d=e; | |
var b=e.TYPE; | |
if(!(e.isZmObjectHandler)){d=new e() | |
}if(e.useType){b=e.useType | |
}if(e.usePrio){f=e.usePrio | |
}this.addHandler(d,b,f) | |
}}; | |
ZmObjectManager.prototype.reset=function(){this._objects={} | |
}; | |
ZmObjectManager.prototype.setView=function(a){if(a!=null&&appCtxt.getZimletMgr().isLoaded()){a.addListener(DwtEvent.ONMOUSEOVER,new AjxListener(this,this._mouseOverListener)); | |
a.addListener(DwtEvent.ONMOUSEOUT,new AjxListener(this,this._mouseOutListener)); | |
a.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._mouseDownListener)); | |
a.addListener(DwtEvent.ONMOUSEUP,new AjxListener(this,this._mouseUpListener)); | |
a.addListener(DwtEvent.ONMOUSEMOVE,new AjxListener(this,this._mouseMoveListener)); | |
a.addListener(DwtEvent.ONCONTEXTMENU,new AjxListener(this,this._rightClickListener)); | |
this._hoverOverListener=new AjxListener(this,this._handleHoverOver); | |
this._hoverOutListener=new AjxListener(this,this._handleHoverOut) | |
}this._view=a | |
}; | |
ZmObjectManager.prototype.getView=function(){return this._view | |
}; | |
ZmObjectManager.prototype.objectsCount=function(){return(appCtxt.zimletsPresent())?appCtxt.getZimletMgr().getContentZimlets().length:0 | |
}; | |
ZmObjectManager.prototype.getImageAttachmentHandler=function(){return this._imageAttachmentHandler | |
}; | |
ZmObjectManager.prototype._getAjxEmailAddress=function(a){if(appCtxt.isChildWindow&&a.isAjxEmailAddress){a=AjxEmailAddress.copy(a) | |
}return a | |
}; | |
ZmObjectManager.prototype.findObjects=function(p,a,d,o,c){if(!p){return"" | |
}var h=[]; | |
var l=0; | |
var k=p.length; | |
var t=0; | |
var e=this.getHandlers(); | |
while(true){var u=null; | |
var q=k; | |
var n=null; | |
var s; | |
var m; | |
var g; | |
var f=null; | |
if(d){m=e[d]; | |
if(m){for(s=0; | |
s<m.length; | |
s++){f=m[s].findObject(p,t,this); | |
if(!f){continue | |
}if(f.index>=q){break | |
}u=f; | |
q=f.index; | |
n=m[s] | |
}}if(d=="email"||p instanceof AjxEmailAddress){if(n){p=this._getAjxEmailAddress(p); | |
this.generateSpan(n,h,l,p,u,c) | |
}else{h[l++]=AjxStringUtil.htmlEncode(p.toString()) | |
}return h.join("") | |
}}else{for(var r=0; | |
r<this._allObjectHandlers.length; | |
r++){var b=this._allObjectHandlers[r]; | |
f=b.findObject(p,t,this); | |
if(f&&f.index<q){u=f; | |
q=f.index; | |
n=b | |
}}}if(!u){g=p.substring(t,k); | |
if(a){h[l++]=AjxStringUtil.htmlEncode(g,!!o) | |
}else{h[l++]=g | |
}break | |
}if(q>t){g=p.substring(t,q); | |
if(a){h[l++]=AjxStringUtil.htmlEncode(g,!!o) | |
}else{h[l++]=g | |
}}if(n){l=this.generateSpan(n,h,l,u[0],u.context) | |
}else{h[l++]=u[0] | |
}t=u.index+(u.matchLength||u[0].length) | |
}return h.join("") | |
}; | |
ZmObjectManager.prototype.processObjectsInNode=function(f,e){var a=this; | |
f=f||e.ownerDocument; | |
var c=f.createElement("div"); | |
var d=function(k,l){var p,q,j,r; | |
switch(k.nodeType){case 1:k.normalize(); | |
p=k.tagName.toLowerCase(); | |
if(r==null){if(/^(img|a)$/.test(p)){var g; | |
try{g=k.href | |
}catch(t){}var m=p==="a"&&ZmMailMsgView._MAILTO_RE.test(g),s=p==="a"&&ZmMailMsgView._URL_RE.test(g); | |
if((m||s)&&k.target){var o=m?g:RegExp.$1; | |
p=f.createElement("div"); | |
p.innerHTML=a.findObjects(AjxStringUtil.trim(o)); | |
p=p.firstChild; | |
if(p.nodeType==3){return p.nextSibling | |
}k.parentNode.insertBefore(p,k); | |
p.innerHTML=""; | |
p.appendChild(k); | |
return p.nextSibling | |
}l=false | |
}}else{k=r | |
}if(parseFloat(k.style.textIndent)<0){k.style.textIndent="" | |
}for(q=k.firstChild; | |
q; | |
q=d(q,l)){}return k.nextSibling; | |
case 3:case 4:if(l&&/[^\s\xA0]/.test(k.data)){try{var x=null,v=null; | |
if(!AjxEnv.isIE){var n=/^[\s\xA0]+/.exec(k.data); | |
if(n){x=k; | |
k=k.splitText(n[0].length) | |
}n=/[\s\xA0]+$/.exec(k.data); | |
if(n){v=k.splitText(k.data.length-n[0].length) | |
}}p=c; | |
var h=a.findObjects(k.data,true,null,false); | |
var w=false; | |
if(AjxEnv.isIE){p.innerHTML=["<pre>",h,"</pre>"].join(""); | |
w=true | |
}else{p.innerHTML=h | |
}if(x){p.insertBefore(x,p.firstChild) | |
}if(v){p.appendChild(v) | |
}x=k.parentNode; | |
if(w){p=p.firstChild | |
}while(p.firstChild){x.insertBefore(p.firstChild,k) | |
}p=k.nextSibling; | |
x.removeChild(k); | |
return p | |
}catch(u){}}}return k.nextSibling | |
}; | |
if(e&&e.childNodes&&e.childNodes.length){for(var b=0; | |
b<e.childNodes.length; | |
b++){d(e.childNodes[b],true) | |
}}}; | |
ZmObjectManager.prototype.findObjectsInNode=function(c,b,e,f){var d=this,h=c.ownerDocument,i=h.createElement("div"); | |
if(!b){b=/^(script|link|object|iframe|applet)$/i | |
}var a=function(l,m){var o,p,k,r; | |
switch(l.nodeType){case 1:l.normalize(); | |
o=l.tagName.toLowerCase(); | |
if(f&&f.foreachElement){r=f.foreachElement(l,o,b,e) | |
}if(r==null){if(/^(img|a)$/.test(o)){if(o=="a"&&l.target&&(ZmMailMsgView._URL_RE.test(l.href)||ZmMailMsgView._MAILTO_RE.test(l.href))){var q=RegExp.$1; | |
o=h.createElement("div"); | |
o.innerHTML=d.findObjects(AjxStringUtil.trim(RegExp.$1)); | |
o=o.firstChild; | |
if(o.nodeType==3){return o.nextSibling | |
}l.parentNode.insertBefore(o,l); | |
o.innerHTML=""; | |
o.appendChild(l); | |
return o.nextSibling | |
}m=false | |
}else{if(b.test(o)||(e&&!e.test(o))){o=l.nextSibling; | |
l.parentNode.removeChild(l); | |
return o | |
}}}else{l=r | |
}if(AjxEnv.isIE){l.style.cssText=l.style.cssText | |
}for(p=l.firstChild; | |
p; | |
p=a(p,m)){}return l.nextSibling; | |
case 3:case 4:if(m&&/[^\s\xA0]/.test(l.data)){try{var v=null,t=null; | |
if(!AjxEnv.isIE){var n=/^[\s\xA0]+/.exec(l.data); | |
if(n){v=l; | |
l=l.splitText(n[0].length) | |
}n=/[\s\xA0]+$/.exec(l.data); | |
if(n){t=l.splitText(l.data.length-n[0].length) | |
}}o=i; | |
var j=d.findObjects(l.data,true,null,false); | |
var u=false; | |
if(AjxEnv.isIE){o.innerHTML=["<pre>",j,"</pre>"].join(""); | |
u=true | |
}else{o.innerHTML=j | |
}if(v){o.insertBefore(v,o.firstChild) | |
}if(t){o.appendChild(t) | |
}v=l.parentNode; | |
if(u){o=o.firstChild | |
}while(o.firstChild){v.insertBefore(o.firstChild,l) | |
}o=l.nextSibling; | |
v.removeChild(l); | |
return o | |
}catch(s){}}}return l.nextSibling | |
}; | |
var g=h.createDocumentFragment(); | |
while(c.firstChild){g.appendChild(c.firstChild); | |
a(g.lastChild,true,this) | |
}c.appendChild(g) | |
}; | |
ZmObjectManager.prototype.setHandlerAttr=function(d,b,e){var a=this.getHandlers()[d]; | |
if(a){for(var c=0; | |
c<a.length; | |
c++){a[c][b]=e | |
}}}; | |
ZmObjectManager.prototype.generateSpan=function(e,d,a,f,c,b){var g=this._objectIdPrefix+Dwt.getNextId(); | |
if(e&&e.name){g=g+"_"+e.name | |
}this._objects[g]={object:f,handler:e,id:g,context:c}; | |
return e.generateSpan(d,a,f,g,c,b) | |
}; | |
ZmObjectManager.prototype._findObjectSpan=function(a){while(a&&(!a.id||a.id.indexOf(this._objectIdPrefix)!==0)){a=a.parentNode | |
}return a | |
}; | |
ZmObjectManager.prototype._mouseOverListener=function(e){var d=this._findObjectSpan(e.target); | |
if(!d){return false | |
}var a=this._objects[d.id]; | |
if(!a){return false | |
}d.className=a.handler.getHoveredClassName(a.object,a.context,d.id); | |
if(a.handler.hasToolTipText()){var c=DwtShell.getShell(window); | |
var b=c.getHoverMgr(); | |
if((!b.isHovering()||b.getHoverObject()!=a)&&!DwtMenu.menuShowing()){b.reset(); | |
b.setHoverOverDelay(ZmObjectManager._TOOLTIP_DELAY); | |
b.setHoverObject(a); | |
b.setHoverOverData(a); | |
b.setHoverOverListener(this._hoverOverListener); | |
b.hoverOver(e.docX,e.docY); | |
e.hoverStarted=true | |
}}e._returnValue=true; | |
e._dontCallPreventDefault=true; | |
return false | |
}; | |
ZmObjectManager.prototype._mouseOutListener=function(e){var d=this._findObjectSpan(e.target); | |
var a=d?this._objects[d.id]:null; | |
if(a){d.className=a.handler.getClassName(a.object,a.context,d.id); | |
var c=DwtShell.getShell(window); | |
var b=c.getHoverMgr(); | |
b.setHoverOutDelay(150); | |
b.setHoverOutData(a); | |
b.setHoverOutListener(this._hoverOutListener); | |
b.hoverOut() | |
}return false | |
}; | |
ZmObjectManager.prototype._mouseMoveListener=function(e){e._returnValue=true; | |
e._dontCallPreventDefault=true; | |
e._stopPropagation=true; | |
var d=this._findObjectSpan(e.target); | |
var a=d?this._objects[d.id]:null; | |
if(a){var c=DwtShell.getShell(window); | |
var b=c.getHoverMgr(); | |
if(!b.isHovering()){b.hoverOver(e.docX,e.docY) | |
}}return false | |
}; | |
ZmObjectManager.prototype._rightClickListener=function(a){a.button=DwtMouseEvent.RIGHT; | |
return this._mouseDownListener(a) | |
}; | |
ZmObjectManager.prototype._mouseDownListener=function(e){if(!e._authoritative){e._dontCallPreventDefault=true; | |
e._returnValue=true; | |
e._stopPropagation=false | |
}var d=this._findObjectSpan(e.target); | |
if(!d){return true | |
}var a=this._objects[d.id]; | |
if(!a){return true | |
}e._stopPropagation=true; | |
var c=DwtShell.getShell(window); | |
var b=c.getHoverMgr(); | |
b.setHoverOutDelay(0); | |
b.setHoverOutData(a); | |
b.setHoverOutListener(this._hoverOutListener); | |
b.hoverOut(); | |
d.className=a.handler.getActiveClassName(a.object,a.context,d.id); | |
if(e.button==DwtMouseEvent.RIGHT){var f=a.handler.getActionMenu(a.object,d,a.context,e); | |
if(f){f.popup(0,e.docX,e.docY); | |
e._dontCallPreventDefault=false; | |
e._returnValue=false; | |
e._stopPropagation=true; | |
return true | |
}}else{if(e.button==DwtMouseEvent.LEFT){if(this._selectCallback){this._selectCallback.run() | |
}a.handler.selected(a.object,d,e,a.context); | |
return true | |
}}return false | |
}; | |
ZmObjectManager.prototype._mouseUpListener=function(c){c._returnValue=true; | |
c._dontCallPreventDefault=true; | |
c._stopPropagation=true; | |
var b=this._findObjectSpan(c.target); | |
if(!b){return false | |
}var a=this._objects[b.id]; | |
if(!a){return false | |
}b.className=a.handler.getHoveredClassName(a.object,a.context,b.id); | |
return false | |
}; | |
ZmObjectManager.prototype._handleHoverOver=function(f){if(!(f&&f.object)){return | |
}var e=this._findObjectSpan(f.target); | |
var d=f.object.handler; | |
var b=f.object.object; | |
var c=f.object.context; | |
var h=f.object.id; | |
var a=f.x; | |
var g=f.y; | |
d.hoverOver(b,c,a,g,e,h) | |
}; | |
ZmObjectManager.prototype._handleHoverOut=function(e){if(!(e&&e.object)){return | |
}var d=this._findObjectSpan(e.target); | |
var c=e.object.handler; | |
var a=e.object.object; | |
var b=e.object.context; | |
var f=e.object.id; | |
c.hoverOut(a,b,d,f) | |
}; | |
ZmObjectManager.__byPriority=function(d,c){return(c._prio<d._prio)-(d._prio<c._prio) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmSettings")){ZmSettings=function(a){ZmModel.call(this,ZmEvent.S_SETTINGS); | |
this._settings={}; | |
this._nameToId={}; | |
this.getInfoResponse=null; | |
this._handleImplicitChange=new AjxListener(this,this._implicitChangeListener); | |
if(!a){this.initialize() | |
}}; | |
ZmSettings.prototype=new ZmModel; | |
ZmSettings.prototype.constructor=ZmSettings; | |
ZmSettings.BASE64_TO_NORMAL_RATIO=1.34; | |
ZmSettings.prototype.registerSetting=function(c,b){ZmSetting[c]=c; | |
var a=this._settings[c]=new ZmSetting(c,b); | |
if(b.name){this._nameToId[b.name]=c | |
}if(b.isImplicit){a.addChangeListener(this._handleImplicitChange) | |
}return a | |
}; | |
ZmSettings.prototype.toString=function(){return"ZmSettings" | |
}; | |
ZmSettings.prototype.initialize=function(){this._initialize(); | |
this._setDefaults(); | |
this.userSettingsLoaded=false; | |
var a=new AjxListener(this,this._changeListener); | |
if(!appCtxt.multiAccounts){this.getSetting(ZmSetting.QUOTA_USED).addChangeListener(a) | |
}this.getSetting(ZmSetting.POLLING_INTERVAL).addChangeListener(a); | |
this.getSetting(ZmSetting.SKIN_NAME).addChangeListener(a); | |
this.getSetting(ZmSetting.SHOW_SELECTION_CHECKBOX).addChangeListener(a); | |
this.getSetting(ZmSetting.LOCALE_NAME).addChangeListener(a); | |
this.getSetting(ZmSetting.FONT_NAME).addChangeListener(a); | |
this.getSetting(ZmSetting.FONT_SIZE).addChangeListener(a); | |
this.getSetting(ZmSetting.SHORTCUTS).addChangeListener(a); | |
this.getSetting(ZmSetting.CHILD_ACCTS_VISIBLE).addChangeListener(a); | |
this.getSetting(ZmSetting.ATTACHMENTS_BLOCKED).addChangeListener(a); | |
this.getSetting(ZmSetting.CHAT_PLAY_SOUND).addChangeListener(a); | |
this.getSetting(ZmSetting.CHAT_ENABLED).addChangeListener(a); | |
this.getSetting(ZmSetting.DISPLAY_TIME_IN_MAIL_LIST).addChangeListener(a); | |
if(appCtxt.isOffline){this.getSetting(ZmSetting.OFFLINE_IS_MAILTO_HANDLER).addChangeListener(a); | |
this.getSetting(ZmSetting.OFFLINE_BACKUP_ACCOUNT_ID).addChangeListener(a); | |
this.getSetting(ZmSetting.OFFLINE_BACKUP_INTERVAL).addChangeListener(a); | |
this.getSetting(ZmSetting.OFFLINE_BACKUP_PATH).addChangeListener(a); | |
this.getSetting(ZmSetting.OFFLINE_BACKUP_KEEP).addChangeListener(a); | |
this.getSetting(ZmSetting.OFFLINE_UPDATE_NOTIFY).addChangeListener(a) | |
}}; | |
ZmSettings.prototype.get=function(b,a){return(b&&this._settings[b])?this._settings[b].getValue(a):null | |
}; | |
ZmSettings.prototype.set=function(f,e,b,c,a,d){if(f&&this._settings[f]){this._settings[f].setValue(e,b,c,a,d) | |
}else{}}; | |
ZmSettings.prototype.getSetting=function(a){return this._settings[a] | |
}; | |
ZmSettings.prototype.createFromJs=function(f,h,g,l){l=l==null||l; | |
for(var d in f){var b=f[d]; | |
var m=this._settings[this._nameToId[d]]; | |
if(m){if(m.dataType==ZmSetting.D_HASH){var a=b.split(","); | |
var k={}; | |
for(var c=0; | |
c<a.length; | |
c++){var e=a[c].split(":"); | |
k[e[0]]=e[1] | |
}b=k | |
}m.setValue(b,null,h,g,l); | |
if(ZmSetting.IS_IMPLICIT[m.id]){m.origValue=m.copyValue() | |
}}else{}}}; | |
ZmSettings.prototype.getSettingByName=function(a){return this._nameToId[a] | |
}; | |
ZmSettings.prototype.attrExists=function(b){var a=this.getSetting(b).name; | |
return(this.getInfoResponse.prefs._attrs[a]||this.getInfoResponse.attrs._attrs[a]) | |
}; | |
ZmSettings.prototype.loadUserSettings=function(h,d,g,c,a){var e=[h,g]; | |
var f=AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount"); | |
f.setMethodAttribute("rights","createDistList"); | |
var i=this._handleResponseLoadUserSettings.bind(this,e); | |
if(a){a.addNewRequestParams(f,i) | |
}else{var b={soapDoc:(c?null:f),accountName:g,asyncMode:true,callback:i,errorCallback:d,response:c}; | |
appCtxt.getAppController().sendRequest(b) | |
}}; | |
ZmSettings.prototype._handleResponseLoadUserSettings=function(c,b,a){this.setUserSettings(a.getResponse().GetInfoResponse,b); | |
this.userSettingsLoaded=true; | |
if(c){c.run(a) | |
}}; | |
ZmSettings.prototype.setUserSettings=function(r){r=Dwt.getParams(arguments,["info","accountName","setDefault","skipNotify","skipImplicit","preInit"]); | |
var p=this.getInfoResponse=r.info; | |
appCtxt.createDistListAllowed=false; | |
appCtxt.createDistListAllowedDomains=[]; | |
appCtxt.createDistListAllowedDomainsMap={}; | |
var f=p.rights&&p.rights.targets; | |
if(f){for(var m=0; | |
m<f.length; | |
m++){var t=f[m]; | |
if(t.right=="createDistList"){if(t.target[0].type=="domain"){appCtxt.createDistListAllowed=true; | |
appCtxt.createDistListAllowedDomains.push(t.target[0].name); | |
appCtxt.createDistListAllowedDomainsMap[t.target[0].name]=true; | |
break | |
}}}}if(this.get(ZmSetting.ADMIN_DELEGATED)){if(!this.get(ZmSetting.ADMIN_MAIL_ENABLED)&&this.get(ZmSetting.ADMIN_PREFERENCES_ENABLED)){(new ZmMailApp()).enableMailPrefs() | |
}}this.set(ZmSetting.VOICE_ENABLED,this._hasVoiceFeature(),null,false,true); | |
var a=r.accountName; | |
var q=r.preInit?false:r.setDefault; | |
var h=r.preInit?true:r.skipNotify; | |
var c=r.preInit?true:r.skipImplicit; | |
var o=[ZmSetting.ADMIN_DELEGATED,p.adminDelegated,ZmSetting.MESSAGE_SIZE_LIMIT,this._base64toNormalSize(p.attSizeLimit),ZmSetting.CHANGE_PASSWORD_URL,p.changePasswordURL,ZmSetting.DOCUMENT_SIZE_LIMIT,this._base64toNormalSize(p.docSizeLimit),ZmSetting.LAST_ACCESS,p.accessed,ZmSetting.LICENSE_STATUS,p.license&&p.license.status,ZmSetting.PREVIOUS_SESSION,p.prevSession,ZmSetting.PUBLIC_URL,p.publicURL,ZmSetting.ADMIN_URL,p.adminURL,ZmSetting.QUOTA_USED,p.used,ZmSetting.RECENT_MESSAGES,p.recent,ZmSetting.REST_URL,p.rest,ZmSetting.USERNAME,p.name,ZmSetting.EMAIL_VALIDATION_REGEX,p.zimbraMailAddressValidationRegex,ZmSetting.HAB_ROOT,(p.habRoots&&p.habRoots.hab?p.habRoots.hab:false),ZmSetting.DISABLE_SENSITIVE_ZIMLETS_IN_MIXED_MODE,(p.domainSettings&&p.domainSettings.zimbraZimletDataSensitiveInMixedModeDisabled?p.domainSettings.zimbraZimletDataSensitiveInMixedModeDisabled:"FALSE")]; | |
for(var m=0; | |
m<o.length; | |
m+=2){var k=o[m+1]; | |
if(k!=null){this.set(o[m],k,null,q,h,c) | |
}}if(p.attrs&&p.attrs._attrs){this.createFromJs(p.attrs._attrs,q,h,c) | |
}if(this.get(ZmSetting.ADMIN_DELEGATED)){this.set(ZmSetting.MAIL_ENABLED,this.get(ZmSetting.ADMIN_MAIL_ENABLED),q,h,c); | |
var d=this.get(ZmSetting.MAIL_ENABLED)||(this.get(ZmSetting.ADMIN_DELEGATED)&&this.get(ZmSetting.ADMIN_PREFERENCES_ENABLED)); | |
this.set(ZmSetting.MAIL_PREFERENCES_ENABLED,d,q,h,c); | |
if(this.get(ZmSetting.MAIL_PREFERENCES_ENABLED)&&!this.get(ZmSetting.MAIL_ENABLED)){this.set(ZmSetting.MAIL_FORWARDING_ENABLED,false,q,h,c); | |
this.set(ZmSetting.FILTERS_MAIL_FORWARDING_ENABLED,false,q,h,c); | |
this.set(ZmSetting.NOTIF_FEATURE_ENABLED,false,q,h,c) | |
}}if(p.communityURL){this.set(ZmSetting.SOCIAL_EXTERNAL_URL,p.communityURL,null,q,h) | |
}if(r.preInit){return | |
}if(p.prefs&&p.prefs._attrs){this.createFromJs(p.prefs._attrs,q,h,c) | |
}var j; | |
if(!a){appCtxt.accountList.createAccounts(this,p); | |
if(appCtxt.isOffline){if(AjxEnv.isPrism&&window.platform){this.set(ZmSetting.OFFLINE_SUPPORTS_MAILTO,true,null,q,h,c); | |
this.set(ZmSetting.OFFLINE_SUPPORTS_DOCK_UPDATE,true,null,q,h,c) | |
}appCtxt.set(ZmSetting.SHARING_ENABLED,true,null,q,h) | |
}}j=this._settings[ZmSetting.REPLY_TO_ADDRESS]; | |
if(j){j.defaultValue=this.get(ZmSetting.USERNAME) | |
}if(this.get(ZmSetting.FORCE_CAL_OFF)){this.set(ZmSetting.CALENDAR_ENABLED,false,null,q,h,c) | |
}if(!this.get(ZmSetting.OPTIONS_ENABLED)){this.set(ZmSetting.FILTERS_ENABLED,false,null,q,h,c) | |
}if(!a){if(p.zimlets&&p.zimlets.zimlet){if(this.get(ZmSetting.ZIMLETS_SYNCHRONOUS)){var l=new AjxTimedAction(this,this._beginLoadZimlets,[p.zimlets.zimlet,p.props.prop,true]); | |
AjxTimedAction.scheduleAction(l,0) | |
}else{var e=new AjxListener(this,this._beginLoadZimlets,[p.zimlets.zimlet,p.props.prop,false]); | |
appCtxt.getAppController().addListener(ZmAppEvent.POST_STARTUP,e) | |
}}else{appCtxt.allZimletsLoaded() | |
}}var k=appCtxt.get(ZmSetting.REPLY_INCLUDE_ORIG); | |
if(k){var n=ZmMailApp.INC_MAP[k]; | |
appCtxt.set(ZmSetting.REPLY_INCLUDE_WHAT,n[0],null,q,h); | |
appCtxt.set(ZmSetting.REPLY_USE_PREFIX,n[1],null,q,h); | |
appCtxt.set(ZmSetting.REPLY_INCLUDE_HEADERS,n[2],null,q,h) | |
}var k=appCtxt.get(ZmSetting.FORWARD_INCLUDE_ORIG); | |
if(k){var n=ZmMailApp.INC_MAP[k]; | |
appCtxt.set(ZmSetting.FORWARD_INCLUDE_WHAT,n[0],null,q,h); | |
appCtxt.set(ZmSetting.FORWARD_USE_PREFIX,n[1],null,q,h); | |
appCtxt.set(ZmSetting.FORWARD_INCLUDE_HEADERS,n[2],null,q,h) | |
}var b=ZmSettings.DEFAULT_SORT_PREF; | |
b[ZmId.VIEW_CONVLIST]=ZmSearch.DATE_DESC; | |
b[ZmId.VIEW_CONV]=ZmSearch.DATE_DESC; | |
b[ZmId.VIEW_TRAD]=ZmSearch.DATE_DESC; | |
b[ZmId.VIEW_CONTACT_SRC]=ZmSearch.NAME_ASC; | |
b[ZmId.VIEW_CONTACT_TGT]=ZmSearch.NAME_ASC; | |
b[ZmId.VIEW_CONTACT_SIMPLE]=ZmSearch.NAME_ASC; | |
b[ZmId.VIEW_CAL]=ZmSearch.DATE_ASC; | |
b[ZmId.VIEW_TASKLIST]=ZmSearch.DUE_DATE_ASC; | |
b[ZmId.VIEW_BRIEFCASE_DETAIL]=ZmSearch.SUBJ_ASC; | |
var g=this._settings[ZmSetting.SORTING_PREF]; | |
if(g){for(var s in b){if(!g.getValue(s)){g.setValue(b[s],s,false,true) | |
}}g.defaultValue=AjxUtil.hashCopy(b) | |
}DwtControl.useBrowserTooltips=this.get(ZmSetting.BROWSER_TOOLTIPS_ENABLED); | |
this._updateUserFontPrefsRule() | |
}; | |
ZmSettings.prototype._base64toNormalSize=function(a){if(!a||a===-1){return a | |
}return a/ZmSettings.BASE64_TO_NORMAL_RATIO | |
}; | |
ZmSettings.prototype._beginLoadZimlets=function(a,d,b){var c=new AjxCallback(this,this._loadZimletPackage,[a,d,b]); | |
AjxDispatcher.require(["Startup2"],false,c) | |
}; | |
ZmSettings.prototype._loadZimletPackage=function(a,d,b){var c=new AjxCallback(this,this._loadZimlets,[a,d,b]); | |
AjxDispatcher.require("Zimlet",false,c) | |
}; | |
ZmSettings.prototype._loadZimlets=function(b,h,j){b=b||[]; | |
this.registerSetting("ZIMLETS",{type:ZmSetting.T_CONFIG,defaultValue:b,isGlobal:true}); | |
this.registerSetting("USER_PROPS",{type:ZmSetting.T_CONFIG,defaultValue:h}); | |
var d=this._getCheckedZimlets(b); | |
var c=appCtxt.getZimletMgr(); | |
c.loadZimlets(d,h,null,null,j); | |
if(d&&d.length){var a=appCtxt.getCurrentApp(); | |
if(a){var l; | |
if(appCtxt.multiAccounts){var f=a.getOverviewContainer().containerId; | |
var k=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET]; | |
var e=[f,k].join("_"); | |
l=appCtxt.getOverviewController().getOverview(e) | |
}else{l=a.getOverview() | |
}}if(l){l.setTreeView(ZmOrganizer.ZIMLET); | |
if(appCtxt.multiAccounts&&c.getPanelZimlets().length==0){a.getOverviewContainer().removeZimletSection() | |
}}if(appCtxt.get(ZmSetting.PORTAL_ENABLED)){var g=appCtxt.getApp(ZmApp.PORTAL).getPortletMgr(); | |
var i=g.createPortlets(true) | |
}}}; | |
ZmSettings.prototype._getCheckedZimlets=function(c){var d=[]; | |
for(var b=0; | |
b<c.length; | |
b++){var a=c[b]; | |
if(a.zimletContext[0].presence!="disabled"){d.push(a) | |
}}return d | |
}; | |
ZmSettings.prototype.loadPreferenceData=function(h){var g=new ZmBatchCommand(null,appCtxt.accountList.mainAccount.name); | |
var f=AjxSoapDoc.create("GetAvailableSkinsRequest","urn:zimbraAccount"); | |
var e=new AjxCallback(this,this._handleResponseLoadAvailableSkins); | |
g.addNewRequestParams(f,e); | |
var a=AjxSoapDoc.create("GetAvailableLocalesRequest","urn:zimbraAccount"); | |
var d=new AjxCallback(this,this._handleResponseGetAllLocales); | |
g.addNewRequestParams(a,d); | |
var b=AjxSoapDoc.create("GetAvailableCsvFormatsRequest","urn:zimbraAccount"); | |
var c=new AjxCallback(this,this._handleResponseGetAvailableCsvFormats); | |
g.addNewRequestParams(b,c); | |
g.run(h) | |
}; | |
ZmSettings.prototype._handleResponseLoadAvailableSkins=function(a){var e=a.getResponse().GetAvailableSkinsResponse; | |
var d=e.skin; | |
if(d&&d.length){var c=appCtxt.accountList.mainAccount.settings.getSetting(ZmSetting.AVAILABLE_SKINS); | |
for(var b=0; | |
b<d.length; | |
b++){c.setValue(d[b].name) | |
}}}; | |
ZmSettings.prototype._handleResponseGetAllLocales=function(c){var b=c._data.GetAvailableLocalesResponse.locale; | |
if(b&&b.length){for(var d=0,e=b.length; | |
d<e; | |
d++){var a=b[d]; | |
a.id=a.id.replace(/^in/,"id"); | |
ZmLocale.create(a.id,a.name,ZmMsg["localeName_"+a.id]||a.localName) | |
}if(b.length===1){this.set(ZmSetting.LOCALE_CHANGE_ENABLED,true) | |
}else{this.set(ZmSetting.LOCALE_CHANGE_ENABLED,ZmLocale.hasChoices()) | |
}}}; | |
ZmSettings.prototype._handleResponseGetAvailableCsvFormats=function(b){var a=b.getResponse().GetAvailableCsvFormatsResponse.csv; | |
if(a&&a.length){var d=appCtxt.accountList.mainAccount.settings.getSetting(ZmSetting.AVAILABLE_CSVFORMATS); | |
for(var c=0; | |
c<a.length; | |
c++){d.setValue(a[c].name) | |
}}}; | |
ZmSettings.prototype.save=function(s,d,f,b,o){if(!(s&&s.length)){return | |
}var g=b||appCtxt.getActiveAccount(); | |
var t=AjxSoapDoc.create("ModifyPrefsRequest","urn:zimbraAccount"); | |
var e=false; | |
var q=[],h={},l; | |
for(var r=0; | |
r<s.length; | |
r++){l=s[r]; | |
if(h[l.id]){continue | |
}if(l.type==ZmSetting.T_METADATA){q.push(l); | |
g.metaData.update(l.section,l.name,l.getValue()); | |
continue | |
}else{if(l.type!=ZmSetting.T_PREF){continue | |
}}if(!l.name){continue | |
}if(l.dataType==ZmSetting.D_LIST){var m=l.getValue(); | |
if(m&&m.length){for(var p=0; | |
p<m.length; | |
p++){var n=t.set("pref",m[p]); | |
n.setAttribute("name",l.name) | |
}}else{var n=t.set("pref",""); | |
n.setAttribute("name",l.name) | |
}}else{var m=l.getValue(null,true); | |
var n=t.set("pref",m); | |
n.setAttribute("name",l.name) | |
}h[l.id]=true; | |
e=true | |
}if(appCtxt.isOffline&&ZmSetting.IS_IMPLICIT[l.id]&&ZmSetting.IS_GLOBAL[l.id]){g=appCtxt.accountList.mainAccount | |
}if(q.length>0){var a=new AjxCallback(this,this._handleResponseSaveMetaData,[q]); | |
var k=[ZmSetting.M_IMPLICIT,ZmSetting.M_OFFLINE]; | |
g.metaData.save(k,a) | |
}if(e){var c; | |
if(d||f){c=new AjxCallback(this,this._handleResponseSave,[s,d]) | |
}if(f){f.addNewRequestParams(t,c) | |
}else{appCtxt.getAppController().sendRequest({soapDoc:t,asyncMode:true,callback:c,accountName:g.name,noBusyOverlay:o}) | |
}}}; | |
ZmSettings.prototype._handleResponseSaveMetaData=function(d,a){for(var b=0; | |
b<d.length; | |
b++){var c=d[b]; | |
if(!ZmSetting.IS_IMPLICIT[c.id]){c.origValue=c.copyValue(); | |
c._notify(ZmEvent.E_MODIFY) | |
}}}; | |
ZmSettings.prototype._handleResponseSave=function(d,f,a){var e=a.getResponse(); | |
if(e.ModifyPrefsResponse!=null){for(var b=0; | |
b<d.length; | |
b++){var c=d[b]; | |
c.origValue=c.copyValue(); | |
if(!ZmSetting.IS_IMPLICIT[c.id]){c._notify(ZmEvent.E_MODIFY) | |
}}this._notify(ZmEvent.E_MODIFY,{settings:d}) | |
}if(f){f.run(a) | |
}}; | |
ZmSettings.DEFAULT_SORT_PREF={}; | |
ZmSettings.prototype._setDefaults=function(){var b=AjxUtil.formatUrl({host:location.hostname,path:"/service/soap/",qsReset:true}); | |
this.set(ZmSetting.CSFE_SERVER_URI,b,null,false,true); | |
b=AjxUtil.formatUrl({host:location.hostname,path:"/service/home/~/",qsReset:true,qsArgs:{auth:"co"}}); | |
this.set(ZmSetting.CSFE_MSG_FETCHER_URI,b,null,false,true); | |
b=AjxUtil.formatUrl({host:location.hostname,path:"/service/upload",qsReset:true,qsArgs:{lbfums:""}}); | |
this.set(ZmSetting.CSFE_UPLOAD_URI,b,null,false,true); | |
b=AjxUtil.formatUrl({host:location.hostname,path:"/service/upload",qsReset:true}); | |
this.set(ZmSetting.CSFE_ATTACHMENT_UPLOAD_URI,b,null,false,true); | |
b=AjxUtil.formatUrl({host:location.hostname,path:"/service/home/~/",qsReset:true,qsArgs:{auth:"co",id:"{0}",fmt:"csv"}}); | |
this.set(ZmSetting.CSFE_EXPORT_URI,b,null,false,true); | |
var a=location.hostname; | |
var c=((a.indexOf(".zimbra.com")!=-1)||(window.appDevMode&&(/\.local$/.test(a)||(!appCtxt.isOffline&&a=="localhost")))); | |
this.set(ZmSetting.IS_DEV_SERVER,c); | |
if(c||window.isScriptErrorOn){this.set(ZmSetting.SHOW_SCRIPT_ERRORS,true,null,false,true) | |
}this.setReportScriptErrorsSettings(AjxException,ZmController.handleScriptError) | |
}; | |
ZmSettings.prototype.persistImplicitSortPrefs=function(a){return ZmSettings.DEFAULT_SORT_PREF[a] | |
}; | |
ZmSettings.prototype.setReportScriptErrorsSettings=function(b,c){var a=b.reportScriptErrors=this._settings[ZmSetting.SHOW_SCRIPT_ERRORS].getValue(); | |
if(a){b.setScriptErrorHandler(c) | |
}}; | |
ZmSettings.prototype._initialize=function(){this.registerSetting("ADMIN_DELEGATED",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("AC_TIMER_INTERVAL",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_INT,defaultValue:300}); | |
this.registerSetting("ASYNC_MODE",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("BRANCH",{type:ZmSetting.T_CONFIG,defaultValue:"JUDASPRIEST"}); | |
this.registerSetting("CLIENT_DATETIME",{type:ZmSetting.T_CONFIG,defaultValue:"20190823-1046"}); | |
this.registerSetting("CLIENT_RELEASE",{type:ZmSetting.T_CONFIG,defaultValue:"20190823100304"}); | |
this.registerSetting("CLIENT_VERSION",{type:ZmSetting.T_CONFIG,defaultValue:"8.8.15_GA_3847"}); | |
this.registerSetting("CONFIG_PATH",{type:ZmSetting.T_CONFIG,defaultValue:appContextPath+"/js/zimbraMail/config"}); | |
this.registerSetting("CSFE_EXPORT_URI",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("CSFE_MSG_FETCHER_URI",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("CSFE_SERVER_URI",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("CSFE_UPLOAD_URI",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("CSFE_ATTACHMENT_UPLOAD_URI",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("DEV",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("FORCE_CAL_OFF",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("HELP_URI",{name:"zimbraHelpAdvancedURL",type:ZmSetting.T_CONFIG,defaultValue:appContextPath+ZmMsg.helpURI}); | |
this.registerSetting("HTTP_PORT",{type:ZmSetting.T_CONFIG,defaultValue:ZmSetting.HTTP_DEFAULT_PORT}); | |
this.registerSetting("HTTPS_PORT",{type:ZmSetting.T_CONFIG,defaultValue:ZmSetting.HTTPS_DEFAULT_PORT}); | |
this.registerSetting("INSTANT_NOTIFY_INTERVAL",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_INT,defaultValue:500}); | |
this.registerSetting("INSTANT_NOTIFY_TIMEOUT",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_INT,defaultValue:300}); | |
this.registerSetting("IS_DEV_SERVER",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("LOG_REQUEST",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("LOGO_URI",{type:ZmSetting.T_CONFIG,defaultValue:null}); | |
this.registerSetting("PROTOCOL_MODE",{type:ZmSetting.T_CONFIG,defaultValue:ZmSetting.PROTO_HTTP}); | |
this.registerSetting("SERVER_VERSION",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("SHOW_SCRIPT_ERRORS",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("TIMEOUT",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_INT,defaultValue:30}); | |
this.registerSetting("USE_XML",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("SMIME_HELP_URI",{type:ZmSetting.T_CONFIG,defaultValue:appContextPath+ZmMsg.smimeHelpURI}); | |
this.registerSetting("CHANGE_PASSWORD_URL",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("PUBLIC_URL",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("ADMIN_URL",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("DISABLE_SENSITIVE_ZIMLETS_IN_MIXED_MODE",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("BRIEFCASE_ENABLED",{name:"zimbraFeatureBriefcasesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("ATTACHMENTS_BLOCKED",{name:"zimbraAttachmentsBlocked",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("CALENDAR_ENABLED",{name:"zimbraFeatureCalendarEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("CALENDAR_UPSELL_ENABLED",{name:"zimbraFeatureCalendarUpsellEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("CALENDAR_UPSELL_URL",{name:"zimbraFeatureCalendarUpsellURL",type:ZmSetting.T_COS}); | |
this.registerSetting("CONTACTS_ENABLED",{name:"zimbraFeatureContactsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("CONTACTS_UPSELL_ENABLED",{name:"zimbraFeatureContactsUpsellEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("CONTACTS_UPSELL_URL",{name:"zimbraFeatureContactsUpsellURL",type:ZmSetting.T_COS}); | |
this.registerSetting("IMPORT_ENABLED",{name:"zimbraFeatureImportFolderEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("EXPORT_ENABLED",{name:"zimbraFeatureExportFolderEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("MAIL_ENABLED",{name:"zimbraFeatureMailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("EXTERNAL_USER_MAIL_ADDRESS",{name:"zimbraExternalUserMailAddress",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("ADMIN_MAIL_ENABLED",{name:"zimbraFeatureAdminMailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("ADMIN_PREFERENCES_ENABLED",{name:"zimbraFeatureAdminPreferencesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("MAIL_UPSELL_ENABLED",{name:"zimbraFeatureMailUpsellEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("MAIL_UPSELL_URL",{name:"zimbraFeatureMailUpsellURL",type:ZmSetting.T_COS}); | |
this.registerSetting("OPTIONS_ENABLED",{name:"zimbraFeatureOptionsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("PORTAL_ENABLED",{name:"zimbraFeaturePortalEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("SOCIAL_ENABLED",{name:"zimbraFeatureSocialEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("SOCIAL_EXTERNAL_ENABLED",{name:"zimbraFeatureSocialExternalEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("SOCIAL_EXTERNAL_URL",{name:"zimbraFeatureSocialExternalURL",type:ZmSetting.T_COS}); | |
this.registerSetting("SOCIAL_NAME",{name:"zimbraFeatureSocialName",type:ZmSetting.T_COS,defaultValue:ZmMsg.communityName}); | |
this.registerSetting("TASKS_ENABLED",{name:"zimbraFeatureTasksEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("VOICE_ENABLED",{name:"zimbraFeatureVoiceEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("VOICE_UPSELL_ENABLED",{name:"zimbraFeatureVoiceUpsellEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("VOICE_UPSELL_URL",{name:"zimbraFeatureVoiceUpsellURL",type:ZmSetting.T_COS}); | |
this.registerSetting("DLS_FOLDER_ENABLED",{name:"zimbraFeatureDistributionListFolderEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("ATTACHMENTS_VIEW_IN_HTML_ONLY",{name:"zimbraAttachmentsViewInHtmlOnly",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("AVAILABLE_SKINS",{type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST,isGlobal:true}); | |
this.registerSetting("AVAILABLE_CSVFORMATS",{type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST,isGlobal:true}); | |
this.registerSetting("CHANGE_PASSWORD_ENABLED",{name:"zimbraFeatureChangePasswordEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("DISPLAY_NAME",{name:"displayName",type:ZmSetting.T_COS}); | |
this.registerSetting("DUMPSTER_ENABLED",{name:"zimbraDumpsterEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("ERROR_REPORT_URL",{name:"zimbraErrorReportUrl",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("EXPORT_MAX_DAYS",{name:"zimbraExportMaxDays",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:0}); | |
this.registerSetting("FILTER_BATCH_SIZE",{name:"zimbraFilterBatchSize",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:10000}); | |
this.registerSetting("FLAGGING_ENABLED",{name:"zimbraFeatureFlaggingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("FOLDERS_EXPANDED",{name:"zimbraPrefFoldersExpanded",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_HASH,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
this.registerSetting("FOLDER_TREE_OPEN",{name:"zimbraPrefFolderTreeOpen",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isImplicit:true}); | |
this.registerSetting("FOLDER_TREE_SASH_WIDTH",{name:"zimbraPrefFolderTreeSash",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_INT,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
this.registerSetting("GAL_AUTOCOMPLETE_ENABLED",{name:"zimbraFeatureGalAutoCompleteEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("GAL_ENABLED",{name:"zimbraFeatureGalEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("HAB_ROOT",{type:ZmSetting.T_CONFIG}); | |
this.registerSetting("GROUP_CALENDAR_ENABLED",{name:"zimbraFeatureGroupCalendarEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("HTML_COMPOSE_ENABLED",{name:"zimbraFeatureHtmlComposeEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("IDLE_SESSION_TIMEOUT",{name:"zimbraMailIdleSessionTimeout",type:ZmSetting.T_COS,dataType:ZmSetting.D_LDAP_TIME,defaultValue:0}); | |
this.registerSetting("IMAP_ACCOUNTS_ENABLED",{name:"zimbraFeatureImapDataSourceEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("IMPORT_ON_LOGIN_ENABLED",{name:"zimbraDataSourceImportOnLogin",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("INSTANT_NOTIFY",{name:"zimbraFeatureInstantNotify",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("LOCALE_CHANGE_ENABLED",{name:"zimbraFeatureLocaleChangeEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("LOCALES",{type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("LOGIN_URL",{name:"zimbraWebClientLoginURL",type:ZmSetting.T_COS}); | |
this.registerSetting("LOGOUT_URL",{name:"zimbraWebClientLogoutURL",type:ZmSetting.T_COS}); | |
this.registerSetting("MIN_POLLING_INTERVAL",{name:"zimbraMailMinPollingInterval",type:ZmSetting.T_COS,dataType:ZmSetting.D_LDAP_TIME,defaultValue:120}); | |
this.registerSetting("MOBILE_SYNC_ENABLED",{name:"zimbraFeatureMobileSyncEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("MOBILE_POLICY_ENABLED",{name:"zimbraFeatureMobilePolicyEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("POP_ACCOUNTS_ENABLED",{name:"zimbraFeaturePop3DataSourceEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("PORTAL_NAME",{name:"zimbraPortalName",type:ZmSetting.T_COS,defaultValue:"example"}); | |
this.registerSetting("PRIORITY_INBOX_ENABLED",{name:"zimbraFeaturePriorityInboxEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("PWD_MAX_LENGTH",{name:"zimbraPasswordMaxLength",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:64}); | |
this.registerSetting("PWD_MIN_LENGTH",{name:"zimbraPasswordMinLength",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:6}); | |
this.registerSetting("QUOTA",{name:"zimbraMailQuota",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:0}); | |
this.registerSetting("SAVED_SEARCHES_ENABLED",{name:"zimbraFeatureSavedSearchesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("SEARCH_TREE_OPEN",{name:"zimbraPrefSearchTreeOpen",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isImplicit:true}); | |
this.registerSetting("SHARING_ENABLED",{name:"zimbraFeatureSharingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SHARING_PUBLIC_ENABLED",{name:"zimbraPublicSharingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SHARING_EXTERNAL_ENABLED",{name:"zimbraExternalSharingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SHORTCUT_ALIASES_ENABLED",{name:"zimbraFeatureShortcutAliasesEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SHOW_OFFLINE_LINK",{name:"zimbraWebClientShowOfflineLink",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SIGNATURES_ENABLED",{name:"zimbraFeatureSignaturesEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SKIN_CHANGE_ENABLED",{name:"zimbraFeatureSkinChangeEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SOCIAL_FILTERS_ENABLED",{name:"zimbraFeatureSocialFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
this.registerSetting("SPAM_ENABLED",{name:"zimbraFeatureAntispamEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("TAG_TREE_OPEN",{name:"zimbraPrefTagTreeOpen",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isImplicit:true}); | |
this.registerSetting("TAGGING_ENABLED",{name:"zimbraFeatureTaggingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("VIEW_ATTACHMENT_AS_HTML",{name:"zimbraFeatureViewInHtmlEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("EXPAND_DL_ENABLED",{name:"zimbraFeatureDistributionListExpandMembersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("FORCE_CLEAR_COOKIES",{name:"zimbraForceClearCookies",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("WEBCLIENT_OFFLINE_ENABLED",{name:"zimbraFeatureWebClientOfflineAccessEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SPELL_DICTIONARY",{name:"zimbraPrefSpellDictionary",type:ZmSetting.T_COS,defaultValue:""}); | |
this.registerSetting("TWO_FACTOR_AUTH_AVAILABLE",{name:"zimbraFeatureTwoFactorAuthAvailable",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("TWO_FACTOR_AUTH_REQUIRED",{name:"zimbraFeatureTwoFactorAuthRequired",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("TRUSTED_DEVICES_ENABLED",{name:"zimbraFeatureTrustedDevicesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("APP_PASSWORDS_ENABLED",{name:"zimbraFeatureAppSpecificPasswordsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("RESET_PASSWORD_STATUS",{name:"zimbraFeatureResetPasswordStatus",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("PASSWORD_RECOVERY_EMAIL",{name:"zimbraPrefPasswordRecoveryAddress",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("PASSWORD_RECOVERY_EMAIL_STATUS",{name:"zimbraPrefPasswordRecoveryAddressStatus",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("RESET_PASSWORD_RECOVERY_CODE_EXPIRY",{name:"zimbraResetPasswordRecoveryCodeExpiry",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("PASSWORD_RECOVERY_CODE_VALIDITY",{name:"zimbraRecoveryAccountCodeValidity",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("PASSWORD_RECOVERY_SUSPENSION_TIME",{name:"zimbraFeatureResetPasswordSuspensionTime",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("LICENSE_STATUS",{type:ZmSetting.T_COS,defaultValue:ZmSetting.LICENSE_GOOD}); | |
this.registerSetting("QUOTA_USED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_INT}); | |
this.registerSetting("USERID",{name:"zimbraId",type:ZmSetting.T_COS}); | |
this.registerSetting("USERNAME",{type:ZmSetting.T_COS}); | |
this.registerSetting("CN",{name:"cn",type:ZmSetting.T_COS}); | |
this.registerSetting("LAST_ACCESS",{type:ZmSetting.T_COS,dataType:ZmSetting.D_INT}); | |
this.registerSetting("PREVIOUS_SESSION",{type:ZmSetting.T_COS,dataType:ZmSetting.D_INT}); | |
this.registerSetting("RECENT_MESSAGES",{type:ZmSetting.T_COS,dataType:ZmSetting.D_INT}); | |
this.registerSetting("REST_URL",{name:"rest",type:ZmSetting.T_COS}); | |
this.registerSetting("IS_ADMIN",{name:"zimbraIsAdminAccount",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("IS_EXTERNAL",{name:"zimbraIsExternalVirtualAccount",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("IS_DELEGATED_ADMIN",{name:"zimbraIsDelegatedAdminAccount",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("MESSAGE_SIZE_LIMIT",{type:ZmSetting.T_COS,dataType:ZmSetting.D_INT}); | |
this.registerSetting("DOCUMENT_SIZE_LIMIT",{type:ZmSetting.T_COS,dataType:ZmSetting.D_INT}); | |
this.registerSetting("ATTACHMENT_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("ATT_VIEW_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("BROWSER_TOOLTIPS_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("EVAL_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("FEED_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("HELP_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("HISTORY_SUPPORT_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:("onhashchange" in window)}); | |
this.registerSetting("NOTES_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("PRINT_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SEARCH_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SHORTCUT_LIST_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("OFFLINE_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:appCtxt.isOffline}); | |
this.registerSetting("SPELL_CHECK_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:!appCtxt.isOffline&&(!AjxEnv.isSafari||AjxEnv.isSafari3up||AjxEnv.isChrome)}); | |
this.registerSetting("SPELL_CHECK_ADD_WORD_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:!AjxEnv.isSafari||AjxEnv.isSafari3up||AjxEnv.isChrome}); | |
this.registerSetting("EMAIL_VALIDATION_REGEX",{name:"zimbraMailAddressValidationRegex",type:ZmSetting.T_DOMAIN,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("SUPPORTED_HELPS",{name:"zimbraWebClientSupportedHelps",type:ZmSetting.T_DOMAIN,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("ACCOUNTS",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}); | |
this.registerSetting("TWO_FACTOR_AUTH_ENABLED",{name:"zimbraTwoFactorAuthEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("ACCOUNT_TREE_OPEN",{name:"zimbraPrefAccountTreeOpen",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}); | |
this.registerSetting("CHILD_ACCTS_VISIBLE",{name:"zimbraPrefChildVisibleAccount",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("CLIENT_TYPE",{name:"zimbraPrefClientType",type:ZmSetting.T_PREF,defaultValue:ZmSetting.CLIENT_ADVANCED}); | |
this.registerSetting("COMPOSE_AS_FORMAT",{name:"zimbraPrefComposeFormat",type:ZmSetting.T_PREF,defaultValue:ZmSetting.COMPOSE_HTML,isGlobal:true}); | |
this.registerSetting("COMPOSE_INIT_FONT_COLOR",{name:"zimbraPrefHtmlEditorDefaultFontColor",type:ZmSetting.T_PREF,defaultValue:ZmSetting.COMPOSE_FONT_COLOR,isGlobal:true}); | |
this.registerSetting("COMPOSE_INIT_FONT_FAMILY",{name:"zimbraPrefHtmlEditorDefaultFontFamily",type:ZmSetting.T_PREF,defaultValue:ZmSetting.COMPOSE_FONT_FAM,isGlobal:true}); | |
this.registerSetting("COMPOSE_INIT_FONT_SIZE",{name:"zimbraPrefHtmlEditorDefaultFontSize",type:ZmSetting.T_PREF,defaultValue:ZmSetting.COMPOSE_FONT_SIZE,isGlobal:true}); | |
this.registerSetting("COMPOSE_INIT_DIRECTION",{name:"zimbraPrefComposeDirection",type:ZmSetting.T_PREF,defaultValue:ZmSetting.LTR,isGlobal:true}); | |
this.registerSetting("SHOW_COMPOSE_DIRECTION_BUTTONS",{name:"zimbraPrefShowComposeDirection",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("DEFAULT_TIMEZONE",{name:"zimbraPrefTimeZoneId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:AjxTimezone.getServerId(AjxTimezone.DEFAULT),isGlobal:true}); | |
this.registerSetting("WEBCLIENT_OFFLINE_BROWSER_KEY",{name:"zimbraPrefWebClientOfflineBrowserKey",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,isImplicit:true}); | |
this.registerSetting("DEFAULT_PRINTFONTSIZE",{name:"zimbraPrefDefaultPrintFontSize",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.PRINT_FONT_SIZE,isGlobal:true}); | |
this.registerSetting("GROUPBY_HASH",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}); | |
this.registerSetting("GROUPBY_LIST",{name:"zimbraPrefGroupByList",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_HASH,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
this.registerSetting("FILTERS",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}); | |
this.registerSetting("FONT_NAME",{name:"zimbraPrefFont",type:ZmSetting.T_PREF,defaultValue:ZmSetting.FONT_SYSTEM,isGlobal:true}); | |
this.registerSetting("FONT_SIZE",{name:"zimbraPrefFontSize",type:ZmSetting.T_PREF,defaultValue:ZmSetting.FONT_SIZE_NORMAL,isGlobal:true}); | |
this.registerSetting("IDENTITIES",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}); | |
this.registerSetting("INITIALLY_SEARCH_GAL",{name:"zimbraPrefGalSearchEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("LIST_VIEW_COLUMNS",{name:"zimbraPrefListViewColumns",type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH,isImplicit:true}); | |
this.registerSetting("LOCALE_NAME",{name:"zimbraPrefLocale",type:ZmSetting.T_PREF,defaultValue:appRequestLocaleId,isGlobal:true}); | |
this.registerSetting("SHOW_SELECTION_CHECKBOX",{name:"zimbraPrefShowSelectionCheckbox",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
this.registerSetting("PAGE_SIZE",{name:"zimbraPrefItemsPerVirtualPage",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:50,isGlobal:true}); | |
this.registerSetting("PASSWORD",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}); | |
this.registerSetting("POLLING_INTERVAL",{name:"zimbraPrefMailPollingInterval",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LDAP_TIME,defaultValue:300}); | |
this.registerSetting("POLLING_INTERVAL_ENABLED",{name:"zimbraFeatureMailPollingIntervalPreferenceEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SEARCH_INCLUDES_SHARED",{name:"zimbraPrefIncludeSharedItemsInSearch",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("SEARCH_INCLUDES_SPAM",{name:"zimbraPrefIncludeSpamInSearch",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("SEARCH_INCLUDES_TRASH",{name:"zimbraPrefIncludeTrashInSearch",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("SHORT_ADDRESS",{name:"zimbraPrefShortEmailAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("SHORTCUTS",{name:"zimbraPrefShortcuts",type:ZmSetting.T_PREF}); | |
this.registerSetting("SHOW_SEARCH_STRING",{name:"zimbraPrefShowSearchString",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("SIGNATURES",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}); | |
this.registerSetting("SIGNATURES_MAX",{name:"zimbraSignatureMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:20}); | |
this.registerSetting("SIGNATURES_MIN",{name:"zimbraSignatureMinNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:1}); | |
this.registerSetting("SKIN_NAME",{name:"zimbraPrefSkin",type:ZmSetting.T_PREF,defaultValue:"skin",isGlobal:true}); | |
this.registerSetting("SORTING_PREF",{name:"zimbraPrefSortOrder",type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH,isImplicit:true,isGlobal:true,dontSaveDefault:true}); | |
this.registerSetting("USE_KEYBOARD_SHORTCUTS",{name:"zimbraPrefUseKeyboardShortcuts",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("VIEW_AS_HTML",{name:"zimbraPrefMessageViewHtmlPreferred",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("VOICE_ACCOUNTS",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}); | |
this.registerSetting("WARN_ON_EXIT",{name:"zimbraPrefWarnOnExit",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("DISPLAY_TIME_IN_MAIL_LIST",{name:"zimbraPrefDisplayTimeInMailList",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this._registerOfflineSettings(); | |
this._registerZimletsSettings(); | |
this.registerSetting("ZIMLET_TREE_OPEN",{name:"zimbraPrefZimletTreeOpen",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}); | |
this.registerSetting("MAIL_ALIASES",{name:"zimbraMailAlias",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("ALLOW_FROM_ADDRESSES",{name:"zimbraAllowFromAddress",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("MAIL_PREFERENCES_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("CHAT_PLAY_SOUND",{name:"zimbraPrefChatPlaySound",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
this.registerSetting("CHAT_FEATURE_ENABLED",{name:"zimbraFeatureChatEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
this.registerSetting("CHAT_ENABLED",{name:"zimbraPrefChatEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
ZmApp.runAppFunction("registerSettings",this) | |
}; | |
ZmSettings.prototype._registerZimletsSettings=function(){this.registerSetting("CHECKED_ZIMLETS_ENABLED",{name:"zimbraFeatureManageZimlets",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
this.registerSetting("CHECKED_ZIMLETS",{name:"zimbraPrefZimlets",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST,isGlobal:true}); | |
this.registerSetting("MANDATORY_ZIMLETS",{name:"zimbraZimletMandatoryZimlets",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}); | |
this.registerSetting("ZIMLETS_SYNCHRONOUS",{name:"zimbraZimletLoadSynchronously",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}) | |
}; | |
ZmSettings.prototype._registerOfflineSettings=function(){if(!appCtxt.isOffline){return | |
}this.registerSetting("OFFLINE_ACCOUNT_FLAVOR",{name:"offlineAccountFlavor",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("OFFLINE_COMPOSE_ENABLED",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("OFFLINE_DEBUG_TRACE",{type:ZmSetting.T_CONFIG,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("OFFLINE_IS_MAILTO_HANDLER",{name:"zimbraPrefMailtoHandlerEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("OFFLINE_REMOTE_SERVER_URI",{name:"offlineRemoteServerUri",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("OFFLINE_REPORT_EMAIL",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"zdesktop-report@zimbra.com",isGlobal:true}); | |
this.registerSetting("OFFLINE_SHOW_ALL_MAILBOXES",{name:"offlineShowAllMailboxes",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,section:ZmSetting.M_OFFLINE,isGlobal:true}); | |
this.registerSetting("OFFLINE_ALL_MAILBOXES_TREE_OPEN",{name:"offlineAllMailboxesTreeOpen",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,section:ZmSetting.M_OFFLINE,isGlobal:true,isImplicit:true}); | |
this.registerSetting("OFFLINE_NOTIFY_NEWMAIL_ON_INBOX",{name:"offlineNotifyNewMailOnInbox",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,section:ZmSetting.M_OFFLINE,isGlobal:true}); | |
this.registerSetting("OFFLINE_SAVED_SEARCHES_TREE_OPEN",{name:"offlineSavedSearchesTreeOpen",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,section:ZmSetting.M_OFFLINE,isGlobal:true,isImplicit:true}); | |
this.registerSetting("OFFLINE_SMTP_ENABLED",{name:"zimbraDataSourceSmtpEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
this.registerSetting("OFFLINE_SUPPORTS_MAILTO",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("OFFLINE_SUPPORTS_DOCK_UPDATE",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("OFFLINE_WEBAPP_URI",{name:"offlineWebappUri",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("OFFLINE_BACKUP_INTERVAL",{name:"zimbraPrefOfflineBackupInterval",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}); | |
this.registerSetting("OFFLINE_BACKUP_PATH",{name:"zimbraPrefOfflineBackupPath",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,isGlobal:true}); | |
this.registerSetting("OFFLINE_BACKUP_KEEP",{name:"zimbraPrefOfflineBackupKeep",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,isGlobal:true}); | |
this.registerSetting("OFFLINE_BACKUP_ACCOUNT_ID",{name:"zimbraPrefOfflineBackupAccountId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,isGlobal:true}); | |
this.registerSetting("OFFLINE_BACKUP_RESTORE",{name:"zimbraPrefOfflineBackupRestore",dataType:ZmSetting.D_INT,isGlobal:true}); | |
this.registerSetting("OFFLINE_BACKUP_NOW_BUTTON",{name:"zimbraPrefOfflineBackupAccount",dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
this.registerSetting("OFFLINE_ZIMLET_SYNC_ACCOUNT_ID",{name:"zimbraPrefOfflineZimletSyncAccountId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,isGlobal:true}); | |
this.registerSetting("OFFLINE_WEBAPP_URI",{name:"offlineWebappUri",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING}); | |
this.registerSetting("HELP_URI",{type:ZmSetting.T_CONFIG,defaultValue:"https://www.zimbra.com/desktop7/"}); | |
this.registerSetting("DUMPSTER_ENABLED",{name:"zimbraDumpsterEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
this.registerSetting("OFFLINE_UPDATE_NOTIFY",{name:"zimbraPrefOfflineUpdateChannel",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,isGlobal:true}) | |
}; | |
ZmSettings.prototype._changeListener=function(d){if(d.type!==ZmEvent.S_SETTING){return | |
}var f=d.source.id,e=d.source.getValue(); | |
if(f===ZmSetting.QUOTA_USED){appCtxt.getAppController().setUserInfo() | |
}else{if(f===ZmSetting.POLLING_INTERVAL){appCtxt.getAppController().setPollInterval() | |
}else{if(f===ZmSetting.SKIN_NAME){this._showConfirmDialog(ZmMsg.skinChangeRestart,this._refreshBrowserCallback.bind(this)) | |
}else{if(f===ZmSetting.SHOW_SELECTION_CHECKBOX){this._showConfirmDialog(e?ZmMsg.checkboxChangeRestartShow:ZmMsg.checkboxChangeRestartHide,this._refreshBrowserCallback.bind(this)) | |
}else{if(f===ZmSetting.FONT_NAME||f===ZmSetting.FONT_SIZE){this._showConfirmDialog(ZmMsg.fontChangeRestart,this._refreshBrowserCallback.bind(this)) | |
}else{if(f===ZmSetting.LOCALE_NAME){if(appCtxt.isOffline&&AjxEnv.isPrism){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); | |
var b=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); | |
if(b){var a=appCtxt.get(ZmSetting.LOCALE_NAME).replace("_","-"); | |
b.setCharPref("general.useragent.locale",a); | |
b.setCharPref("intl.accept_languages",a) | |
}}catch(c){}}this._showConfirmDialog(ZmMsg.localeChangeRestart,this._refreshBrowserCallback.bind(this)) | |
}else{if(f===ZmSetting.CHILD_ACCTS_VISIBLE){this._showConfirmDialog(ZmMsg.accountChangeRestart,this._refreshBrowserCallback.bind(this)) | |
}else{if(appCtxt.isOffline&&f===ZmSetting.OFFLINE_IS_MAILTO_HANDLER){appCtxt.getAppController().registerMailtoHandler(true,d.source.getValue()) | |
}else{if(appCtxt.isOffline&&f===ZmSetting.OFFLINE_UPDATE_NOTIFY){appCtxt.getAppController()._offlineUpdateChannelPref(d.source.getValue()) | |
}else{if(f===ZmSetting.CHAT_ENABLED||f===ZmSetting.CHAT_PLAY_SOUND||(f===ZmSetting.CHAT_PLAY_SOUND&&f===ZmSetting.CHAT_ENABLED)){this._showConfirmDialog(ZmMsg.chatFeatureChangeRestart,this._refreshBrowserCallback.bind(this)) | |
}else{if(f===ZmSetting.DISPLAY_TIME_IN_MAIL_LIST){this._showConfirmDialog(e?ZmMsg.timeInMailListChangeRestartShow:ZmMsg.timeInMailListChangeRestartHide,this._refreshBrowserCallback.bind(this)) | |
}}}}}}}}}}}}; | |
ZmSettings.prototype._showConfirmDialog=function(c,d,a){var b=appCtxt.getYesNoMsgDialog(); | |
b.reset(); | |
b.registerCallback(DwtDialog.YES_BUTTON,d); | |
b.setMessage(c,a||DwtMessageDialog.WARNING_STYLE); | |
b.popup() | |
}; | |
ZmSettings.prototype._implicitChangeListener=function(b){if(!appCtxt.get(ZmSetting.OPTIONS_ENABLED)){return | |
}if(b.type!=ZmEvent.S_SETTING){return | |
}var d=b.source.id; | |
var a=this.getSetting(d); | |
if(d==ZmSetting.FOLDERS_EXPANDED&&window.duringExpandAll){if(!window.afterExpandAllCallback){window.afterExpandAllCallback=this.save.bind(this,[a],null,null,appCtxt.getActiveAccount(),true) | |
}return | |
}if(ZmSetting.IS_IMPLICIT[d]&&a){if(d===ZmSetting.WEBCLIENT_OFFLINE_BROWSER_KEY){var c=this._offlineSettingsSaveCallback.bind(this,a) | |
}else{var c=appCtxt.reloadAppCache.bind(appCtxt,false) | |
}this.save([a],c,null,appCtxt.getActiveAccount(),true) | |
}}; | |
ZmSettings.prototype._refreshBrowserCallback=function(b){appCtxt.getYesNoMsgDialog().popdown(); | |
window.onbeforeunload=ZmZimbraMail.getConfirmExitMethod(); | |
var a=AjxUtil.formatUrl({qsArgs:b}); | |
window.location.replace(a) | |
}; | |
ZmSettings.prototype._updateUserFontPrefsRule=function(){if(this._userFontPrefsRuleIndex!=null){DwtCssStyle.removeRule(document.styleSheets[0],this._userFontPrefsRuleIndex) | |
}var a="."+ZmSetting.USER_FONT_CLASS; | |
var b="font-family:"+appCtxt.get(ZmSetting.COMPOSE_INIT_FONT_FAMILY)+";font-size:"+appCtxt.get(ZmSetting.COMPOSE_INIT_FONT_SIZE)+";color:"+appCtxt.get(ZmSetting.COMPOSE_INIT_FONT_COLOR)+";"; | |
this._userFontPrefsRuleIndex=DwtCssStyle.addRule(document.styleSheets[0],a,b) | |
}; | |
ZmSettings.prototype._hasVoiceFeature=function(){var e=this.getInfoResponse; | |
var d=e&&e.license; | |
var b=d&&d.status; | |
if(!d||!d.attr){return false | |
}if(ZmSetting.LICENSE_MSG[b]){return false | |
}for(var c=0; | |
d&&c<d.attr.length; | |
c++){var a=d.attr[c]; | |
if(a.name=="VOICE"){return a._content=="TRUE" | |
}}return false | |
}; | |
ZmSettings.prototype._offlineSettingsSaveCallback=function(c){var a=c.getValue(); | |
var b=localStorage.getItem(ZmSetting.WEBCLIENT_OFFLINE_BROWSER_KEY); | |
if(a&&a.indexOf(b)!==-1){this._showConfirmDialog(ZmMsg.offlineChangeRestart,this._refreshBrowserCallback.bind(this)) | |
}else{ZmOffline.deleteOfflineData(); | |
appCtxt.initWebOffline(); | |
var d=appCtxt.getById(ZmFolder.ID_OUTBOX); | |
if(d){d.notifyDelete() | |
}}appCtxt.reloadAppCache(true) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmMetaData")){ZmMetaData=function(a,b){this._sections={}; | |
this._account=a; | |
this._itemId=b | |
}; | |
ZmMetaData.prototype.constructor=ZmMetaData; | |
ZmMetaData.NAMESPACE="zwc"; | |
ZmMetaData.prototype.toString=function(){return"ZmMetaData" | |
}; | |
ZmMetaData.prototype.set=function(m,f,b,n,g,j){var l; | |
if(this._itemId){l=AjxSoapDoc.create("SetCustomMetadataRequest","urn:zimbraMail"); | |
l.getMethod().setAttribute("id",this._itemId) | |
}else{l=AjxSoapDoc.create("SetMailboxMetadataRequest","urn:zimbraMail") | |
}var o=l.set("meta"); | |
o.setAttribute("section",[ZmMetaData.NAMESPACE,m].join(":")); | |
for(var e in f){var h=f[e]; | |
if(AjxUtil.isObject(h)){h=ZmSetting.serialize(h,ZmSetting.D_HASH) | |
}var k=l.set("a",h,o); | |
k.setAttribute("n",e) | |
}if(b){b.addNewRequestParams(l,n,g) | |
}else{var c={soapDoc:l,asyncMode:true,callback:n,errorCallback:g,accountName:(this._account?this._account.name:null),sensitive:j}; | |
appCtxt.getAppController().sendRequest(c) | |
}}; | |
ZmMetaData.prototype.get=function(g,a,i,d){var b=a||(new ZmBatchCommand()); | |
var c=[ZmMetaData.NAMESPACE,g].join(":"); | |
var e=this._sections[c]; | |
if(!e){var f; | |
if(this._itemId){f=AjxSoapDoc.create("GetCustomMetadataRequest","urn:zimbraMail"); | |
f.getMethod().setAttribute("id",this._itemId) | |
}else{f=AjxSoapDoc.create("GetMailboxMetadataRequest","urn:zimbraMail") | |
}var h=f.set("meta"); | |
h.setAttribute("section",c); | |
b.addNewRequestParams(f); | |
if(!a){b.run(i,d) | |
}}else{if(i){i.run(e) | |
}else{return e | |
}}}; | |
ZmMetaData.prototype.load=function(g,f,b){if(!g){return | |
}if(!(g instanceof Array)){g=[g] | |
}var c=b||(new ZmBatchCommand()); | |
for(var a=0; | |
a<g.length; | |
a++){if(g[a]==ZmSetting.M_OFFLINE&&!appCtxt.isOffline){continue | |
}this.get(g[a],c) | |
}if(!b){if(c.size()>0){var e=new AjxCallback(this,this._handleLoad,[f]); | |
var d=this._handleOfflineLoad.bind(this,e); | |
c.run(e,null,d) | |
}}else{if(f){f.run(this._sections) | |
}}}; | |
ZmMetaData.prototype._handleLoad=function(f,a){this._sections={}; | |
var c=a.getResponse().BatchResponse; | |
if(c){var e=(this._itemId!=null)?c.GetCustomMetadataResponse:c.GetMailboxMetadataResponse; | |
if(e&&e.length){if(ZmOffline.isOnlineMode()){localStorage.setItem("MetadataResponse",JSON.stringify(c)) | |
}for(var b=0; | |
b<e.length; | |
b++){var d=e[b].meta[0]; | |
this._sections[d.section]=d._attrs | |
}}}if(f){f.run(this._sections) | |
}}; | |
ZmMetaData.prototype._handleOfflineLoad=function(c){var a=localStorage.getItem("MetadataResponse"); | |
if(a){var b=new ZmCsfeResult({BatchResponse:JSON.parse(a)}); | |
c.run(b) | |
}}; | |
ZmMetaData.prototype.modify=function(j,d,b,k,f){var h=AjxSoapDoc.create("ModifyMailboxMetadataRequest","urn:zimbraMail"); | |
var l=h.set("meta"); | |
l.setAttribute("section",[ZmMetaData.NAMESPACE,j].join(":")); | |
for(var e in d){var g=h.set("a",d[e],l); | |
g.setAttribute("n",e) | |
}if(b){b.addNewRequestParams(h,k,f) | |
}else{var c={soapDoc:h,asyncMode:true,callback:k,errorCallback:f,accountName:(this._account?this._account.name:null)}; | |
appCtxt.getAppController().sendRequest(c) | |
}}; | |
ZmMetaData.prototype.save=function(g,h,a){if(!g){return | |
}if(!(g instanceof Array)){g=[g] | |
}var f=this._account?this._account.name:null; | |
var b=a||(new ZmBatchCommand(null,f)); | |
for(var d=0; | |
d<g.length; | |
d++){var j=g[d]; | |
var c=[ZmMetaData.NAMESPACE,j].join(":"); | |
var e=this._sections[c]; | |
if(e){this.set(j,e,b) | |
}}if(!a){if(b.size()>0){b.run(h) | |
}}else{if(h){h.run() | |
}}}; | |
ZmMetaData.prototype.update=function(e,c,d){var b=[ZmMetaData.NAMESPACE,e].join(":"); | |
var a=this._sections[b]; | |
if(!a){a=this._sections[b]={} | |
}a[c]=d | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmKeyMap")){ZmKeyMap=function(){ZmKeyMap._setPreconditions(); | |
DwtKeyMap.call(this); | |
this._load(this._map,ZmKeys) | |
}; | |
ZmKeyMap.prototype=new DwtKeyMap(true); | |
ZmKeyMap.prototype.constructor=ZmKeyMap; | |
ZmKeyMap.prototype.isZmKeyMap=true; | |
ZmKeyMap.prototype.toString=function(){return"ZmKeyMap" | |
}; | |
ZmKeyMap.MAP_ADDRESS="address"; | |
ZmKeyMap.MAP_BRIEFCASE="briefcase"; | |
ZmKeyMap.MAP_CALENDAR="calendar"; | |
ZmKeyMap.MAP_CALL="call"; | |
ZmKeyMap.MAP_COMPOSE="compose"; | |
ZmKeyMap.MAP_CONTACTS="contacts"; | |
ZmKeyMap.MAP_CONVERSATION="conversation"; | |
ZmKeyMap.MAP_CONVERSATION_LIST="conversationList"; | |
ZmKeyMap.MAP_DL_ADDRESS_LIST="dlAddressList"; | |
ZmKeyMap.MAP_EDIT_APPOINTMENT="editAppointment"; | |
ZmKeyMap.MAP_EDIT_CONTACT="editContact"; | |
ZmKeyMap.MAP_EDIT_TASK="editTask"; | |
ZmKeyMap.MAP_GLOBAL="global"; | |
ZmKeyMap.MAP_MAIL="mail"; | |
ZmKeyMap.MAP_MESSAGE="message"; | |
ZmKeyMap.MAP_QUICK_REPLY="quickReply"; | |
ZmKeyMap.MAP_OPTIONS="options"; | |
ZmKeyMap.MAP_TASKS="tasks"; | |
ZmKeyMap.MAP_VIEW_APPOINTMENT="viewAppointment"; | |
ZmKeyMap.MAP_VOICEMAIL="voicemail"; | |
ZmKeyMap.ADDRESS_PICKER="AddressPicker"; | |
ZmKeyMap.ADD_EXTERNAL_CALENDAR="AddExternalCalendar"; | |
ZmKeyMap.ATTACHMENT="Attachment"; | |
ZmKeyMap.CAL_DAY_VIEW="DayView"; | |
ZmKeyMap.CAL_FB_VIEW="FBView"; | |
ZmKeyMap.CAL_LIST_VIEW="CalListView"; | |
ZmKeyMap.CAL_MONTH_VIEW="MonthView"; | |
ZmKeyMap.CAL_WEEK_VIEW="WeekView"; | |
ZmKeyMap.CAL_WORK_WEEK_VIEW="WorkWeekView"; | |
ZmKeyMap.CALL_MANAGER="CallManager"; | |
ZmKeyMap.CANCEL="Cancel"; | |
ZmKeyMap.COLLAPSE="Collapse"; | |
ZmKeyMap.COLLAPSE_ALL="CollapseAll"; | |
ZmKeyMap.DEL="Delete"; | |
ZmKeyMap.SHIFT_DEL="ShiftDelete"; | |
ZmKeyMap.DOWNLOAD="Download"; | |
ZmKeyMap.EDIT="Edit"; | |
ZmKeyMap.EXPAND="Expand"; | |
ZmKeyMap.EXPAND_ALL="ExpandAll"; | |
ZmKeyMap.FIRST_UNREAD="FirstUnread"; | |
ZmKeyMap.FIRST_UNREAD_MSG="FirstUnreadMsg"; | |
ZmKeyMap.FLAG="Flag"; | |
ZmKeyMap.FOCUS_CONTENT_PANE="FocusContentPane"; | |
ZmKeyMap.FOCUS_SEARCH_BOX="FocusSearchBox"; | |
ZmKeyMap.FOCUS_TOOLBAR="FocusToolbar"; | |
ZmKeyMap.FORWARD="Forward"; | |
ZmKeyMap.GET_MAIL="GetMail"; | |
ZmKeyMap.GOTO_BRIEFCASE="GoToBriefcase"; | |
ZmKeyMap.GOTO_CALENDAR="GoToCalendar"; | |
ZmKeyMap.GOTO_CONTACTS="GoToContacts"; | |
ZmKeyMap.GOTO_DRAFTS="GoToDrafts"; | |
ZmKeyMap.GOTO_JUNK="GoToJunk"; | |
ZmKeyMap.GOTO_INBOX="GoToInbox"; | |
ZmKeyMap.GOTO_MAIL="GoToMail"; | |
ZmKeyMap.GOTO_OPTIONS="GoToOptions"; | |
ZmKeyMap.GOTO_SENT="GoToSent"; | |
ZmKeyMap.GOTO_TASKS="GoToTasks"; | |
ZmKeyMap.GOTO_TRASH="GoToTrash"; | |
ZmKeyMap.GOTO_VOICE="GoToVoice"; | |
ZmKeyMap.HTML_FORMAT="HtmlFormat"; | |
ZmKeyMap.KEEP_READING="KeepReading"; | |
ZmKeyMap.LAST_UNREAD="LastUnread"; | |
ZmKeyMap.LAST_UNREAD_MSG="LastUnreadMsg"; | |
ZmKeyMap.MARK_COMPLETE="MarkComplete"; | |
ZmKeyMap.MARK_HEARD="MarkHeard"; | |
ZmKeyMap.MARK_READ="MarkRead"; | |
ZmKeyMap.MARK_UNCOMPLETE="MarkUncomplete"; | |
ZmKeyMap.MARK_UNHEARD="MarkUnheard"; | |
ZmKeyMap.MARK_UNREAD="MarkUnread"; | |
ZmKeyMap.MOVE="Move"; | |
ZmKeyMap.MOVE_TO_INBOX="MoveToInbox"; | |
ZmKeyMap.MOVE_TO_JUNK="MoveToJunk"; | |
ZmKeyMap.MOVE_TO_TRASH="MoveToTrash"; | |
ZmKeyMap.MUTE_UNMUTE_CONV="MuteUnmuteConv"; | |
ZmKeyMap.NEW="New"; | |
ZmKeyMap.NEW_APPT="NewAppointment"; | |
ZmKeyMap.NEW_BRIEFCASE="NewBriefcase"; | |
ZmKeyMap.NEW_CALENDAR="NewCalendar"; | |
ZmKeyMap.NEW_CONTACT="NewContact"; | |
ZmKeyMap.NEW_DOC="NewDocument"; | |
ZmKeyMap.NEW_FILE="NewFile"; | |
ZmKeyMap.NEW_FOLDER="NewFolder"; | |
ZmKeyMap.NEW_MESSAGE="NewMessage"; | |
ZmKeyMap.NEW_MESSAGE_WIN="NewMessageWindow"; | |
ZmKeyMap.NEW_SEARCH="NewSearch"; | |
ZmKeyMap.NEW_TAG="NewTag"; | |
ZmKeyMap.NEW_TASK="NewTask"; | |
ZmKeyMap.NEW_WINDOW="NewWindow"; | |
ZmKeyMap.NEXT_APPT="NextAppointment"; | |
ZmKeyMap.NEXT_CONV="NextConversation"; | |
ZmKeyMap.NEXT_DAY="NextDay"; | |
ZmKeyMap.NEXT_MSG="NextMessage"; | |
ZmKeyMap.NEXT_PAGE="NextPage"; | |
ZmKeyMap.NEXT_UNREAD="NextUnread"; | |
ZmKeyMap.NEXT_UNREAD_MSG="NextUnreadMsg"; | |
ZmKeyMap.PLAY="Play"; | |
ZmKeyMap.PRESENCE_MENU="PresenceMenu"; | |
ZmKeyMap.PREV_APPT="PreviousAppointment"; | |
ZmKeyMap.PREV_CONV="PreviousConversation"; | |
ZmKeyMap.PREV_DAY="PreviousDay"; | |
ZmKeyMap.PREV_MSG="PreviousMessage"; | |
ZmKeyMap.PREV_PAGE="PreviousPage"; | |
ZmKeyMap.PREV_UNREAD="PreviousUnread"; | |
ZmKeyMap.PREV_UNREAD_MSG="PreviousUnreadMsg"; | |
ZmKeyMap.PRINT="Print"; | |
ZmKeyMap.PRINT_ALL="PrintAll"; | |
ZmKeyMap.QUICK_ADD="QuickAdd"; | |
ZmKeyMap.QUICK_REMINDER="QuickReminder"; | |
ZmKeyMap.READING_PANE_BOTTOM="ReadingPaneAtBottom"; | |
ZmKeyMap.READING_PANE_OFF="ReadingPaneOff"; | |
ZmKeyMap.READING_PANE_RIGHT="ReadingPaneOnRight"; | |
ZmKeyMap.REFRESH="Refresh"; | |
ZmKeyMap.REPLY="Reply"; | |
ZmKeyMap.REPLY_ALL="ReplyAll"; | |
ZmKeyMap.SAVE="Save"; | |
ZmKeyMap.SAVED_SEARCH="SavedSearch"; | |
ZmKeyMap.SELECT_ALL="SelectAll"; | |
ZmKeyMap.SEND="Send"; | |
ZmKeyMap.SHORTCUTS="Shortcuts"; | |
ZmKeyMap.SHOW_FRAGMENT="ShowFragment"; | |
ZmKeyMap.SPAM="Spam"; | |
ZmKeyMap.SPELLCHECK="Spellcheck"; | |
ZmKeyMap.TAG="Tag"; | |
ZmKeyMap.TODAY="Today"; | |
ZmKeyMap.TOGGLE="Toggle"; | |
ZmKeyMap.UNTAG="Untag"; | |
ZmKeyMap.VIEW_BY_CONV="ViewByConversation"; | |
ZmKeyMap.VIEW_BY_MSG="ViewByMessage"; | |
ZmKeyMap.VISIT="Visit"; | |
ZmKeyMap.VISIT_TAG="VisitTag"; | |
ZmKeyMap.ENTITY={}; | |
ZmKeyMap.ENTITY[DwtKeyMap.ARROW_LEFT]="←"; | |
ZmKeyMap.ENTITY[DwtKeyMap.ARROW_RIGHT]="→"; | |
ZmKeyMap.ENTITY[DwtKeyMap.ARROW_UP]="↑"; | |
ZmKeyMap.ENTITY[DwtKeyMap.ARROW_DOWN]="↓"; | |
ZmKeyMap.ENTITY['"']="""; | |
ZmKeyMap.ENTITY["&"]="&"; | |
ZmKeyMap.ENTITY["<"]="<"; | |
ZmKeyMap.ENTITY[">"]=">"; | |
ZmKeyMap.ENTITY[DwtKeyMap.COMMA]=","; | |
ZmKeyMap.ENTITY[DwtKeyMap.SEMICOLON]=";"; | |
ZmKeyMap.ENTITY[DwtKeyMap.BACKSLASH]="\\"; | |
ZmKeyMap.MAP_PRECONDITION={}; | |
ZmKeyMap.ACTION_PRECONDITION={}; | |
ZmKeyMap._setPreconditions=function(){ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_COMPOSE]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_MAIL]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_CONVERSATION_LIST]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_CONVERSATION]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_DL_ADDRESS_LIST]=ZmSetting.CONTACTS_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_MESSAGE]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_CONTACTS]=ZmSetting.CONTACTS_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_EDIT_CONTACT]=ZmSetting.CONTACTS_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_CALENDAR]=ZmSetting.CALENDAR_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_EDIT_APPOINTMENT]=ZmSetting.CALENDAR_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_OPTIONS]=ZmSetting.OPTIONS_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_BRIEFCASE]=ZmSetting.BRIEFCASE_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_TASKS]=ZmSetting.TASKS_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_EDIT_TASK]=ZmSetting.TASKS_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_VOICEMAIL]=ZmSetting.VOICE_ENABLED; | |
ZmKeyMap.MAP_PRECONDITION[ZmKeyMap.MAP_CALL]=ZmSetting.VOICE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL]={}; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.FOCUS_SEARCH_BOX]=ZmSetting.SEARCH_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_BRIEFCASE]=ZmSetting.BRIEFCASE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_CALENDAR]=ZmSetting.CALENDAR_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_CONTACTS]=ZmSetting.CONTACTS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_MAIL]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_OPTIONS]=ZmSetting.OPTIONS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_TASKS]=ZmSetting.TASKS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.GOTO_VOICE]=ZmSetting.VOICE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_APPT]=ZmSetting.CALENDAR_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_BRIEFCASEITEM]=ZmSetting.BRIEFCASE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_CALENDAR]=ZmSetting.CALENDAR_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_CONTACT]=ZmSetting.CONTACTS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_FILE]=ZmSetting.BRIEFCASE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_DOC]=ZmSetting.DOCS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_FOLDER]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_MESSAGE]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_MESSAGE_WIN]=ZmSetting.MAIL_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_TAG]=ZmSetting.TAGGING_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.NEW_TASK]=ZmSetting.TASKS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.SAVED_SEARCH]=ZmSetting.SAVED_SEARCHES_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.TAG]=ZmSetting.TAGGING_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_GLOBAL][ZmKeyMap.UNTAG]=ZmSetting.TAGGING_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_COMPOSE]={}; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_COMPOSE][ZmKeyMap.ADDRESS_PICKER]=ZmSetting.CONTACTS_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_COMPOSE][ZmKeyMap.HTML_FORMAT]=ZmSetting.HTML_COMPOSE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_COMPOSE][ZmKeyMap.NEW_WINDOW]=ZmSetting.NEW_WINDOW_COMPOSE; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_COMPOSE][ZmKeyMap.SAVE]=ZmSetting.SAVE_DRAFT_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_EDIT_APPOINTMENT]={}; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_EDIT_APPOINTMENT][ZmKeyMap.HTML_FORMAT]=ZmSetting.HTML_COMPOSE_ENABLED; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_CALENDAR]={}; | |
ZmKeyMap.ACTION_PRECONDITION[ZmKeyMap.MAP_CALENDAR][ZmKeyMap.CAL_FB_VIEW]=ZmSetting.FREE_BUSY_VIEW_ENABLED | |
}; | |
ZmKeyMap.prototype._checkMap=function(b){var a=this._checkedMap[b]=appCtxt.checkPrecondition(ZmKeyMap.MAP_PRECONDITION[b]); | |
return a | |
}; | |
ZmKeyMap.prototype._checkAction=function(b,c){if(this._checkedMap[b]===false||(!this._checkedMap[b]&&!this._checkMap(b))){return false | |
}var a=ZmKeyMap.ACTION_PRECONDITION[b]; | |
return appCtxt.checkPrecondition(a&&a[c]) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmTimezone")){ZmTimezone=function(){}; | |
ZmTimezone.getDefault=function(){var b=DwtShell.getShell(window); | |
var a=appCtxt.get(ZmSetting.DEFAULT_TIMEZONE); | |
return(a)?AjxTimezone.getClientId(a):AjxTimezone.DEFAULT | |
}; | |
ZmTimezone.getDefaultRule=function(){return AjxTimezone.getRule(ZmTimezone.getDefault()) | |
}; | |
ZmTimezone.set=function(e,b,a,d){var c=AjxTimezone.getRule(b); | |
if(!c){return | |
}if(c.autoDetected||!d){if(e instanceof AjxSoapDoc){ZmTimezone._setSoap(e,b,a,c) | |
}else{ZmTimezone._setJson(e,b,c) | |
}}}; | |
ZmTimezone._setSoap=function(p,g,m,n){var f=p.set("tz",null,m); | |
var b=AjxTimezone.getServerId(g); | |
f.setAttribute("id",b); | |
if(n.autoDetected){f.setAttribute("stdoff",n.standard.offset); | |
if(n.daylight){f.setAttribute("dayoff",n.daylight.offset); | |
var o=["standard","daylight"]; | |
var a=["mon","mday","week","wkday","hour","min","sec"]; | |
for(var k=0; | |
k<o.length; | |
k++){var d=o[k]; | |
var l=n[d]; | |
var c=p.set(d,null,f); | |
for(var h=0; | |
h<a.length; | |
h++){var e=a[h]; | |
if(e in l){c.setAttribute(e,l[e]) | |
}}}}}}; | |
ZmTimezone._setJson=function(h,f,m){var b=AjxTimezone.getServerId(f); | |
var e=h.tz={id:b}; | |
if(m.autoDetected){e.stdoff=m.standard.offset; | |
if(m.daylight){e.dayoff=m.daylight.offset; | |
var n=["standard","daylight"]; | |
var a=["mon","mday","week","wkday","hour","min","sec"]; | |
for(var k=0; | |
k<n.length; | |
k++){var c=n[k]; | |
var l=m[c]; | |
e[c]={}; | |
for(var g=0; | |
g<a.length; | |
g++){var d=a[g]; | |
if(d in l){e[c][d]=l[d] | |
}}}}}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmItem")){ZmItem=function(c,e,d,a){if(arguments.length==0){return | |
}ZmModel.call(this,c); | |
this.type=c; | |
this.id=e; | |
this.list=d; | |
this._list={}; | |
this.refCount=0; | |
this.tags=[]; | |
this.tagHash={}; | |
this.folderId=0; | |
var b=appCtxt.getById(e); | |
if(b){this._list=AjxUtil.hashCopy(b._list); | |
if(!d){this.list=b.list | |
}}if(d){this._list[d.id]=true | |
}if(e&&!a){appCtxt.cacheSet(e,this) | |
}}; | |
ZmItem.prototype=new ZmModel; | |
ZmItem.prototype.constructor=ZmItem; | |
ZmItem.prototype.isZmItem=true; | |
ZmItem.prototype.toString=function(){return"ZmItem" | |
}; | |
ZmItem.APP={}; | |
ZmItem.MSG_KEY={}; | |
ZmItem.ICON={}; | |
ZmItem.RESULTS_LIST={}; | |
ZmItem.F_ACCOUNT=ZmId.FLD_ACCOUNT; | |
ZmItem.F_ATTACHMENT=ZmId.FLD_ATTACHMENT; | |
ZmItem.F_CAPACITY=ZmId.FLD_CAPACITY; | |
ZmItem.F_COMPANY=ZmId.FLD_COMPANY; | |
ZmItem.F_DATE=ZmId.FLD_DATE; | |
ZmItem.F_DEPARTMENT=ZmId.FLD_DEPARTMENT; | |
ZmItem.F_EMAIL=ZmId.FLD_EMAIL; | |
ZmItem.F_EXPAND=ZmId.FLD_EXPAND; | |
ZmItem.F_FILE_TYPE=ZmId.FLD_FILE_TYPE; | |
ZmItem.F_FLAG=ZmId.FLD_FLAG; | |
ZmItem.F_FOLDER=ZmId.FLD_FOLDER; | |
ZmItem.F_FRAGMENT=ZmId.FLD_FRAGMENT; | |
ZmItem.F_FROM=ZmId.FLD_FROM; | |
ZmItem.F_HOME_PHONE=ZmId.FLD_HOME_PHONE; | |
ZmItem.F_ID=ZmId.FLD_ID; | |
ZmItem.F_INDEX=ZmId.FLD_INDEX; | |
ZmItem.F_ITEM_ROW=ZmId.FLD_ITEM_ROW; | |
ZmItem.F_ITEM_ROW_3PANE=ZmId.FLD_ITEM_ROW_3PANE; | |
ZmItem.F_LOCATION=ZmId.FLD_LOCATION; | |
ZmItem.F_NAME=ZmId.FLD_NAME; | |
ZmItem.F_NOTES=ZmId.FLD_NOTES; | |
ZmItem.F_PARTICIPANT=ZmId.FLD_PARTICIPANT; | |
ZmItem.F_PCOMPLETE=ZmId.FLD_PCOMPLETE; | |
ZmItem.F_PRIORITY=ZmId.FLD_PRIORITY; | |
ZmItem.F_RECURRENCE=ZmId.FLD_RECURRENCE; | |
ZmItem.F_SELECTION=ZmId.FLD_SELECTION; | |
ZmItem.F_SELECTION_CELL=ZmId.FLD_SELECTION_CELL; | |
ZmItem.F_SIZE=ZmId.FLD_SIZE; | |
ZmItem.F_SORTED_BY=ZmId.FLD_SORTED_BY; | |
ZmItem.F_STATUS=ZmId.FLD_STATUS; | |
ZmItem.F_READ=ZmId.FLD_READ; | |
ZmItem.F_MUTE=ZmId.FLD_MUTE; | |
ZmItem.F_SUBJECT=ZmId.FLD_SUBJECT; | |
ZmItem.F_TAG=ZmId.FLD_TAG; | |
ZmItem.F_TAG_CELL=ZmId.FLD_TAG_CELL; | |
ZmItem.F_TO=ZmId.FLD_TO; | |
ZmItem.F_TYPE=ZmId.FLD_TYPE; | |
ZmItem.F_VERSION=ZmId.FLD_VERSION; | |
ZmItem.F_WORK_PHONE=ZmId.FLD_WORK_PHONE; | |
ZmItem.F_LOCK=ZmId.FLD_LOCK; | |
ZmItem.F_MSG_PRIORITY=ZmId.FLD_MSG_PRIORITY; | |
ZmItem.F_APP_PASSCODE_CREATED=ZmId.FLD_CREATED; | |
ZmItem.F_APP_PASSCODE_LAST_USED=ZmId.FLD_LAST_USED; | |
ZmItem.SOAP_CMD={}; | |
ZmItem.TAGS_FIELD=1; | |
ZmItem.FLAG_ATTACH="a"; | |
ZmItem.FLAG_FLAGGED="f"; | |
ZmItem.FLAG_FORWARDED="w"; | |
ZmItem.FLAG_ISDRAFT="d"; | |
ZmItem.FLAG_ISSCHEDULED="c"; | |
ZmItem.FLAG_ISSENT="s"; | |
ZmItem.FLAG_READ_RECEIPT_SENT="n"; | |
ZmItem.FLAG_REPLIED="r"; | |
ZmItem.FLAG_UNREAD="u"; | |
ZmItem.FLAG_MUTE="("; | |
ZmItem.FLAG_LOW_PRIORITY="?"; | |
ZmItem.FLAG_HIGH_PRIORITY="!"; | |
ZmItem.FLAG_PRIORITY="+"; | |
ZmItem.FLAG_NOTE="t"; | |
ZmItem.FLAG_OFFLINE_CREATED="o"; | |
ZmItem.ALL_FLAGS=[ZmItem.FLAG_FLAGGED,ZmItem.FLAG_ATTACH,ZmItem.FLAG_UNREAD,ZmItem.FLAG_MUTE,ZmItem.FLAG_REPLIED,ZmItem.FLAG_FORWARDED,ZmItem.FLAG_ISSENT,ZmItem.FLAG_READ_RECEIPT_SENT,ZmItem.FLAG_ISDRAFT,ZmItem.FLAG_ISSCHEDULED,ZmItem.FLAG_HIGH_PRIORITY,ZmItem.FLAG_LOW_PRIORITY,ZmItem.FLAG_PRIORITY,ZmItem.FLAG_NOTE,ZmItem.FLAG_OFFLINE_CREATED]; | |
ZmItem.FLAG_PROP={}; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_ATTACH]="hasAttach"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_FLAGGED]="isFlagged"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_FORWARDED]="isForwarded"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_ISDRAFT]="isDraft"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_ISSCHEDULED]="isScheduled"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_ISSENT]="isSent"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_READ_RECEIPT_SENT]="readReceiptSent"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_REPLIED]="isReplied"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_UNREAD]="isUnread"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_MUTE]="isMute"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_LOW_PRIORITY]="isLowPriority"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_HIGH_PRIORITY]="isHighPriority"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_PRIORITY]="isPriority"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_NOTE]="isNote"; | |
ZmItem.FLAG_PROP[ZmItem.FLAG_OFFLINE_CREATED]="isOfflineCreated"; | |
ZmItem.DND_ACTION_MOVE=1<<0; | |
ZmItem.DND_ACTION_COPY=1<<1; | |
ZmItem.DND_ACTION_BOTH=ZmItem.DND_ACTION_MOVE|ZmItem.DND_ACTION_COPY; | |
ZmItem.NOTES_SEPARATOR="*~*~*~*~*~*~*~*~*~*"; | |
ZmItem.registerItem=function(a,b){if(b.app){ZmItem.APP[a]=b.app | |
}if(b.nameKey){ZmItem.MSG_KEY[a]=b.nameKey | |
}if(b.icon){ZmItem.ICON[a]=b.icon | |
}if(b.soapCmd){ZmItem.SOAP_CMD[a]=b.soapCmd | |
}if(b.itemClass){ZmList.ITEM_CLASS[a]=b.itemClass | |
}if(b.node){ZmList.NODE[a]=b.node | |
}if(b.organizer){ZmOrganizer.ITEM_ORGANIZER[a]=b.organizer | |
}if(b.searchType){ZmSearch.TYPE[a]=b.searchType | |
}if(b.resultsList){ZmItem.RESULTS_LIST[a]=b.resultsList | |
}if(b.node){ZmList.ITEM_TYPE[b.node]=a | |
}if(b.dropTargets){if(!ZmApp.DROP_TARGETS[b.app]){ZmApp.DROP_TARGETS[b.app]={} | |
}ZmApp.DROP_TARGETS[b.app][a]=b.dropTargets | |
}}; | |
ZmItem.getItemId=function(b){if(!b){return b | |
}if(!ZmItem.SHORT_ID_RE){var a=DwtShell.getShell(window); | |
ZmItem.SHORT_ID_RE=new RegExp(appCtxt.get(ZmSetting.USERID)+":","gi") | |
}return b.replace(ZmItem.SHORT_ID_RE,"") | |
}; | |
ZmItem.prototype.create=function(a){}; | |
ZmItem.prototype.modify=function(a){}; | |
ZmItem.prototype.getById=function(a){if(a==this.id){return this | |
}}; | |
ZmItem.prototype.getAccount=function(){if(!this.account){var d; | |
if(this.folderId){var c=window.parentAppCtxt||window.appCtxt; | |
var b=c.getById(this.folderId); | |
d=b&&b.getAccount() | |
}if(!d){var a=ZmOrganizer.parseId(this.id); | |
d=a&&a.account | |
}this.account=d | |
}return this.account | |
}; | |
ZmItem.prototype.clear=function(){if(this.refCount<=1){this._evtMgr.removeAll(ZmEvent.L_MODIFY); | |
if(this.tags.length){for(var a=0; | |
a<this.tags.length; | |
a++){this.tags[a]=null | |
}this.tags=[] | |
}for(var a in this.tagHash){this.tagHash[a]=null | |
}this.tagHash={} | |
}this.refCount-- | |
}; | |
ZmItem.prototype.cache=function(){if(this.id){appCtxt.cacheSet(this.id,this); | |
return true | |
}return false | |
}; | |
ZmItem.prototype.hasTag=function(a){return(this.tagHash[a]==true) | |
}; | |
ZmItem.prototype.canAddTag=function(a){return !this.hasTag(a) | |
}; | |
ZmItem.prototype.getFolderId=function(){return this.folderId | |
}; | |
ZmItem.prototype.getUrl=function(){return this.getRestUrl() | |
}; | |
ZmItem.prototype.getRestUrl=function(){if(this.restUrl){return this.restUrl | |
}var c=ZmOrganizer.ITEM_ORGANIZER[this.type]; | |
var a=appCtxt.getById(this.folderId); | |
var b=a?([a.getRestUrl(),"/",AjxStringUtil.urlComponentEncode(this.name)].join("")):null; | |
return b | |
}; | |
ZmItem.prototype.getTagImageInfo=function(){return this.getTagImageFromNames(this.getVisibleTags()) | |
}; | |
ZmItem.prototype.getTagImageFromIds=function(b){var a; | |
if(!b||b.length==0){a="Blank_16" | |
}else{if(b.length==1){a=this.getTagImage(b[0]) | |
}else{a="TagStack" | |
}}return a | |
}; | |
ZmItem.prototype.getVisibleTags=function(){if(!appCtxt.get(ZmSetting.TAGGING_ENABLED)){return[] | |
}return this.tags | |
}; | |
ZmItem.prototype.getTagImageFromNames=function(a){if(!a||a.length==0){return"Blank_16" | |
}if(a.length==1){return this.getTagImage(a[0]) | |
}return"TagStack" | |
}; | |
ZmItem.prototype.getTagImage=function(b){var c=appCtxt.getAccountTagList(this); | |
var a=c.getByNameOrRemote(b); | |
return a?a.getIconWithColor():"Blank_16" | |
}; | |
ZmItem.prototype.getDefaultDndAction=function(a){return(this.isReadOnly()||a)?ZmItem.DND_ACTION_COPY:ZmItem.DND_ACTION_MOVE | |
}; | |
ZmItem.prototype.isReadOnly=function(){return false | |
}; | |
ZmItem.prototype.isShared=function(){if(this._isShared==null){if(this.id===-1){this._isShared=false | |
}else{this._isShared=appCtxt.isRemoteId(this.id) | |
}}return this._isShared | |
}; | |
ZmItem.prototype.notifyDelete=function(){this._notifyDelete(); | |
for(var b in this._list){var c=appCtxt.getById(b); | |
if(!c||(this.list&&b==this.list.id)){continue | |
}var a=c.controller; | |
if(!a||a.inactive||(a.getList().id!=b)){continue | |
}var d=c.getById(this.id); | |
if(d){d._notifyDelete() | |
}}}; | |
ZmItem.prototype._notifyDelete=function(){this.deleteLocal(); | |
if(this.list){this.list.deleteLocal([this]) | |
}this._notify(ZmEvent.E_DELETE) | |
}; | |
ZmItem.prototype.notifyModify=function(d,f){this._notifyModify(d,f); | |
for(var b in this._list){var c=b?appCtxt.getById(b):null; | |
if(!c||(this.list&&(b==this.list.id))){continue | |
}var a=c.controller; | |
if(!a||a.inactive||(a.getList().id!=b)){continue | |
}var e=c.getById(this.id); | |
if(e){e._notifyModify(d,f) | |
}}}; | |
ZmItem.prototype._notifyModify=function(g,h){if(g.tn!=null){this._parseTagNames(g.tn); | |
this._notify(ZmEvent.E_TAGS) | |
}if(g.f!=null){var c=this._getFlags(); | |
var f={}; | |
for(var e=0; | |
e<c.length; | |
e++){f[c[e]]=this[ZmItem.FLAG_PROP[c[e]]] | |
}this._parseFlags(g.f); | |
var b=[]; | |
for(var e=0; | |
e<c.length; | |
e++){var a=this[ZmItem.FLAG_PROP[c[e]]]; | |
if(f[c[e]]!=a){b.push(c[e]) | |
}}if(b.length){this._notify(ZmEvent.E_FLAGS,{flags:b}) | |
}}if(g.l!=null&&g.l!=this.folderId){var d={oldFolderId:this.folderId}; | |
this.moveLocal(g.l); | |
if(this.list){this.list.moveLocal([this],g.l) | |
}if(h){delete g.l; | |
return ZmEvent.E_MOVE | |
}else{this._notify(ZmEvent.E_MOVE,d) | |
}}}; | |
ZmItem.prototype.flagLocal=function(b,a){this[ZmItem.FLAG_PROP[b]]=a | |
}; | |
ZmItem.prototype.setFlag=function(c,b){this.flagLocal(c,b); | |
var a=this.flags||""; | |
if(b&&a.indexOf(c)==-1){a=a+c | |
}else{if(!b&&a.indexOf(c)!=-1){a=a.replace(c,"") | |
}}this.flags=a; | |
return a | |
}; | |
ZmItem.prototype.tagLocal=function(a,d){var c=false; | |
if(d){if(!this.tagHash[a]){c=true; | |
this.tags.push(a); | |
this.tagHash[a]=true | |
}}else{for(var b=0; | |
b<this.tags.length; | |
b++){if(this.tags[b]==a){this.tags.splice(b,1); | |
delete this.tagHash[a]; | |
c=true; | |
break | |
}}}return c | |
}; | |
ZmItem.prototype.removeAllTagsLocal=function(){this.tags=[]; | |
for(var a in this.tagHash){delete this.tagHash[a] | |
}}; | |
ZmItem.prototype.deleteLocal=function(){}; | |
ZmItem.prototype.move=function(a,c,b){return ZmItem.move(this.id,a,c,b) | |
}; | |
ZmItem.move=function(f,a,g,b,c){var d={ItemActionRequest:{_jsns:"urn:zimbraMail",action:{id:f instanceof Array?f.join():f,op:"move",l:a}}}; | |
var e={jsonObj:d,asyncMode:Boolean(g),callback:g,errorCallback:b,accountName:c}; | |
return appCtxt.getAppController().sendRequest(e) | |
}; | |
ZmItem.prototype.moveLocal=function(a){this.folderId=a | |
}; | |
ZmItem.prototype._parseTags=function(d){this.tags=[]; | |
this.tagHash={}; | |
if(d&&d.length){var a=d.split(","); | |
for(var b=0; | |
b<a.length; | |
b++){var c=Number(a[b]); | |
if(c>=ZmOrganizer.FIRST_USER_ID[ZmOrganizer.TAG]){this.tagLocal(c,true) | |
}}}}; | |
ZmItem.prototype._parseTagNames=function(d){this.tags=[]; | |
this.tagHash={}; | |
if(!d||!d.length){return | |
}d=d.replace(/\\,/g,"\u001D"); | |
var a=d.split(","); | |
for(var c=0; | |
c<a.length; | |
c++){var b=a[c].replace("\u001D",","); | |
this.tagLocal(b,true) | |
}}; | |
ZmItem.prototype._parseFlags=function(d){this.flags=d; | |
for(var c=0; | |
c<ZmItem.ALL_FLAGS.length; | |
c++){var b=ZmItem.ALL_FLAGS[c]; | |
var a=(d&&(d.indexOf(b)!=-1))?true:false; | |
this.flagLocal(b,a) | |
}}; | |
ZmItem.prototype._notify=function(b,a){this._doNotify(b,a) | |
}; | |
ZmItem.prototype._setupNotify=function(){this._doNotify() | |
}; | |
ZmItem.prototype._doNotify=function(b,a){if(this._evt){this._evt.item=this; | |
if(b!=null){ZmModel.prototype._notify.call(this,b,a) | |
}}else{var c=""; | |
if(this.type&&this.id){c=": item = "+this.type+"("+this.id+")" | |
}}if(this.list){this.list._evt.item=this; | |
this.list._evt.items=[this]; | |
if(b!=null){if(a){a.items=[this] | |
}else{a={items:[this]} | |
}this.list._notify(b,a) | |
}}}; | |
ZmItem.prototype._getFlags=function(){return[ZmItem.FLAG_FLAGGED,ZmItem.FLAG_ATTACH] | |
}; | |
ZmItem.prototype.rename=function(a,c,b){return ZmItem.rename(this.id,a,c,b) | |
}; | |
ZmItem.rename=function(f,a,g,b,c){var d={ItemActionRequest:{_jsns:"urn:zimbraMail",action:{id:f instanceof Array?f[0]:f,op:"rename",name:a}}}; | |
var e={jsonObj:d,asyncMode:Boolean(g),callback:g,errorCallback:b,accountName:c}; | |
return appCtxt.getAppController().sendRequest(e) | |
}; | |
ZmItem.prototype.getSortedTags=function(){var d=this.tags&&this.tags.length; | |
if(d){var e=appCtxt.getAccountTagList(this); | |
var b=[]; | |
for(var c=0; | |
c<d; | |
c++){var a=e.getByNameOrRemote(this.tags[c]); | |
if(!a){continue | |
}b.push(a) | |
}b.sort(ZmTag.sortCompare); | |
return b | |
}return null | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmActionStack")){ZmActionStack=function(a){this._stack=[]; | |
this._pointer=-1; | |
this._maxLength=a||0 | |
}; | |
ZmEvent.S_ACTION="ACTION"; | |
ZmActionStack.validTypes=[ZmId.ORG_FOLDER,ZmId.ITEM_MSG,ZmId.ITEM_CONV,ZmId.ITEM_CONTACT,ZmId.ITEM_GROUP,ZmId.ITEM_BRIEFCASE,ZmId.ORG_BRIEFCASE,ZmId.ITEM_TASK,ZmId.ORG_TASKS]; | |
ZmActionStack.prototype.toString=function(){return"ZmActionStack" | |
}; | |
ZmActionStack.prototype.logAction=function(e){var g=e.op,j=[]; | |
if(e.items){for(var f=0; | |
f<e.items.length; | |
f++){var n=e.items[f]; | |
if(n&&this._isValidType(n.type)){j.push(n) | |
}}}else{if(e.item){if(e.item&&this._isValidType(e.item.type)){j.push(e.item) | |
}}else{if(e.ids){for(var f=0; | |
f<e.ids.length; | |
f++){var n=appCtxt.getById(e.ids[f]); | |
if(n&&this._isValidType(n.type)){j.push(n) | |
}}}else{if(e.id){var n=appCtxt.getById(e.id); | |
if(n&&this._isValidType(n.type)){j.push(n) | |
}}}}}var m=e.attrs; | |
for(var f=0; | |
f<j.length; | |
f++){var n=j[f]; | |
if(n.type===ZmItem.CONV){var l=m&&m.tcon; | |
for(var c in n.msgFolder){var b=n.msgFolder[c],k=ZmFolder.TCON_CODE[b]; | |
if(!l||l.indexOf(k)===-1){j.push({isConvMsg:true,id:c,type:ZmItem.MSG,folderId:b,list:{type:ZmItem.MSG}}) | |
}}}}var h=j.length>1; | |
var d=null; | |
var b; | |
switch(g){case"trash":b=ZmFolder.ID_TRASH; | |
break; | |
case"spam":b=ZmFolder.ID_SPAM; | |
break; | |
case"move":case"!spam":b=m.l; | |
break | |
}var a=appCtxt.getById(b); | |
if(a&&!a.isRemote()){switch(g){case"trash":case"move":case"spam":case"!spam":for(var f=0; | |
f<j.length; | |
f++){var n=j[f]; | |
var o; | |
if(n instanceof ZmItem){if(!n.isShared()){o=new ZmItemMoveAction(n,n.getFolderId(),b,g) | |
}}else{if(n instanceof ZmOrganizer){if(!n.isRemote()){o=new ZmOrganizerMoveAction(n,n.parent.id,b,g) | |
}}else{if(n.isConvMsg){if(!appCtxt.isRemoteId(n.id)){o=new ZmItemMoveAction(n,n.folderId,b,g) | |
}}}}if(o){if(h){if(!d){d=new ZmCompositeAction(b) | |
}d.addAction(o) | |
}else{d=o | |
}}}break | |
}if(d){this._push(d) | |
}}return d | |
}; | |
ZmActionStack.prototype.canUndo=function(){return this._pointer>=0 | |
}; | |
ZmActionStack.prototype.canRedo=function(){return this._pointer<this._stack.length-1 | |
}; | |
ZmActionStack.prototype.actionIsComplete=function(){return this.canUndo()&&this._current().getComplete() | |
}; | |
ZmActionStack.prototype.onComplete=function(b){var a=this._current(); | |
if(a){a.onComplete(b) | |
}}; | |
ZmActionStack.prototype.undo=function(){if(this.canUndo()){var a=this._pop(); | |
a.undo() | |
}}; | |
ZmActionStack.prototype.redo=function(){if(this.canRedo()){var a=this._stack[++this._pointer]; | |
a.redo() | |
}}; | |
ZmActionStack.prototype._push=function(b){if(b&&b instanceof ZmAction){var a=this._pointer+1; | |
while(this._maxLength&&a>=this._maxLength){this._stack.shift(); | |
a-- | |
}this._stack[a]=b; | |
this._stack.length=a+1; | |
this._pointer=a | |
}}; | |
ZmActionStack.prototype._pop=function(){return this.canUndo()?this._stack[this._pointer--]:null | |
}; | |
ZmActionStack.prototype._current=function(){return this.canUndo()?this._stack[this._pointer]:null | |
}; | |
ZmActionStack.prototype._isValidType=function(a){return !ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,a)!==-1 | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmAction")){ZmAction=function(){ZmModel.call(this,ZmEvent.S_ACTION); | |
this._complete=false | |
}; | |
ZmAction.prototype=new ZmModel; | |
ZmAction.prototype.constructor=ZmAction; | |
ZmAction.ACTION_ZMACTION="ZmAction"; | |
ZmAction.ACTION_ZMITEMACTION="ZmItemAction"; | |
ZmAction.ACTION_ZMITEMMOVEACTION="ZmItemMoveAction"; | |
ZmAction.ACTION_ZMITEMTRASHACTION="ZmItemTrashAction"; | |
ZmAction.ACTION_ZMORGANIZERACTION="ZmOrganizerAction"; | |
ZmAction.ACTION_ZMORGANIZERMOVEACTION="ZmOrganizerMoveAction"; | |
ZmAction.ACTION_ZMCOMPOSITEACTION="ZmCompositeAction"; | |
ZmAction.prototype.type=ZmAction.ACTION_ZMITEMACTION; | |
ZmAction.prototype.toString=function(){return"ZmAction" | |
}; | |
ZmAction.prototype.undo=function(){}; | |
ZmAction.prototype.redo=function(){}; | |
ZmAction.prototype.setComplete=function(){if(!this._complete){this._complete=true; | |
this._notify(ZmEvent.E_COMPLETE) | |
}}; | |
ZmAction.prototype.getComplete=function(){return this._complete | |
}; | |
ZmAction.prototype.onComplete=function(a){if(this._complete){a.run(this) | |
}else{this.addChangeListener(new AjxListener(this,this._handleComplete,[a])) | |
}}; | |
ZmAction.prototype._handleComplete=function(b,a){if(a.event===ZmEvent.E_COMPLETE){b.run(this) | |
}}; | |
ZmItemAction=function(a,b){if(!arguments.length){return | |
}ZmAction.call(this); | |
this._item=a; | |
this._op=b | |
}; | |
ZmItemAction.prototype=new ZmAction; | |
ZmItemAction.prototype.constructor=ZmItemAction; | |
ZmItemAction.prototype.type=ZmAction.ACTION_ZMITEMACTION; | |
ZmItemAction.prototype.toString=function(){return"ZmItemAction" | |
}; | |
ZmItemAction.prototype.getItem=function(){return this._item | |
}; | |
ZmItemAction.prototype.getOp=function(){return this._op | |
}; | |
ZmOrganizerAction=function(a,b){if(!arguments.length){return | |
}ZmAction.call(this); | |
this._organizer=a; | |
this._op=b | |
}; | |
ZmOrganizerAction.prototype=new ZmAction; | |
ZmOrganizerAction.prototype.constructor=ZmOrganizerAction; | |
ZmOrganizerAction.prototype.type=ZmAction.ACTION_ZMORGANIZERACTION; | |
ZmOrganizerAction.prototype.toString=function(){return"ZmOrganizerAction" | |
}; | |
ZmOrganizerAction.prototype.getOrganizer=function(){return this._organizer | |
}; | |
ZmOrganizerAction.prototype.getOp=function(){return this._op | |
}; | |
ZmItemMoveAction=function(b,a,d,c){ZmItemAction.call(this,b,c); | |
this._fromFolderId=a; | |
this._toFolderId=d | |
}; | |
ZmItemMoveAction.prototype=new ZmItemAction; | |
ZmItemMoveAction.prototype.constructor=ZmItemMoveAction; | |
ZmItemMoveAction.prototype.type=ZmAction.ACTION_ZMITEMMOVEACTION; | |
ZmItemMoveAction.prototype.toString=function(){return"ZmItemMoveAction" | |
}; | |
ZmItemMoveAction.UNDO_MSG={move:ZmMsg.actionUndoMove,trash:ZmMsg.actionUndoTrash,spam:ZmMsg.actionUndoMarkAsJunk,"!spam":ZmMsg.actionUndoMarkAsNotJunk}; | |
ZmItemMoveAction.prototype.getFromFolderId=function(){return this._fromFolderId | |
}; | |
ZmItemMoveAction.prototype.getToFolderId=function(){return this._toFolderId | |
}; | |
ZmItemMoveAction.prototype._doMove=function(e,c,a){var b=ZmItemMoveAction._realizeItems(this._item),d=b[0]&&b[0].list; | |
d.moveItems({items:b,folder:appCtxt.getById(a),noUndo:true,finalCallback:this._handleDoMove.bind(this,this._item.folderId,a),fromFolderId:this._toFolderId}) | |
}; | |
ZmItemMoveAction.prototype._handleDoMove=function(e,c,g){var a=[]; | |
for(var h in g.idHash){var d=g.idHash[h]; | |
if(d instanceof ZmConv){d.folderId=c | |
}var f=d&&d.list; | |
if(AjxUtil.indexOf(a,f)==-1){a.push(f) | |
}}for(var b=0; | |
b<a.length; | |
b++){a[b]._notify(ZmEvent.E_MOVE,{oldFolderId:e}) | |
}ZmListController.handleProgress({state:ZmListController.PROGRESS_DIALOG_CLOSE}); | |
ZmBaseController.showSummary(g.actionSummary) | |
}; | |
ZmItemMoveAction.prototype.undo=function(b,a){this._doMove(b,a,this._fromFolderId) | |
}; | |
ZmItemMoveAction.prototype.redo=function(b,a){this._doMove(b,a,this._toFolderId) | |
}; | |
ZmItemMoveAction.multipleUndo=function(e,h,b){var a={}; | |
for(var f=0; | |
f<e.length; | |
f++){var d=e[f]; | |
if(d instanceof ZmItemMoveAction){var l=d.getFromFolderId(); | |
var m=d.getToFolderId(); | |
var n=d.getItem(); | |
var k=(n&&n.list&&n.list.type)||0; | |
if(!a[l]){a[l]={} | |
}if(!a[l][m]){a[l][m]={} | |
}if(!a[l][m][k]){a[l][m][k]=[] | |
}a[l][m][k].push(d) | |
}}for(var l in a){for(var m in a[l]){for(var k in a[l][m]){var c=a[l][m][k]; | |
var j=[]; | |
var g=null; | |
for(var f=0; | |
f<c.length; | |
f++){var d=c[f]; | |
var n=d.getItem(); | |
j.push(n) | |
}j=ZmItemMoveAction._realizeItems(j); | |
g=j[0]&&j[0].list; | |
if(g){g.moveItems({items:j,folder:appCtxt.getById(h?m:l),noUndo:true,fromFolderId:b}) | |
}}}}}; | |
ZmItemMoveAction.multipleRedo=function(a){ZmItemMoveAction.multipleUndo(a,true) | |
}; | |
ZmItemMoveAction._realizeItems=function(a){var b,c; | |
return AjxUtil.map(AjxUtil.toArray(a),function(d){if(d.isConvMsg){b=b||new ZmMailList(ZmItem.MSG); | |
c=new ZmMailMsg(d.id,b,true); | |
c.folderId=d.folderId; | |
return c | |
}else{return d | |
}}) | |
}; | |
ZmOrganizerMoveAction=function(a,b,d,c){ZmOrganizerAction.call(this,a,c); | |
this._fromFolderId=b; | |
this._toFolderId=d | |
}; | |
ZmOrganizerMoveAction.prototype=new ZmOrganizerAction; | |
ZmOrganizerMoveAction.prototype.constructor=ZmOrganizerMoveAction; | |
ZmOrganizerMoveAction.prototype.type=ZmAction.ACTION_ZMORGANIZERMOVEACTION; | |
ZmOrganizerMoveAction.prototype.toString=function(){return"ZmOrganizerMoveAction" | |
}; | |
ZmOrganizerMoveAction.prototype.getFromFolderId=function(){return this._fromFolderId | |
}; | |
ZmOrganizerMoveAction.prototype.getToFolderId=function(){return this._toFolderId | |
}; | |
ZmOrganizerMoveAction.prototype._doMove=function(d,b,a){var c=appCtxt.getById(a); | |
if(c){this._organizer.move(c,true) | |
}}; | |
ZmOrganizerMoveAction.prototype.undo=function(b,a){this._doMove(b,a,this._fromFolderId) | |
}; | |
ZmOrganizerMoveAction.prototype.redo=function(b,a){this._doMove(b,a,this._toFolderId) | |
}; | |
ZmOrganizerMoveAction.multipleUndo=function(d,a){for(var b=0; | |
b<d.length; | |
b++){var c=d[b]; | |
if(c instanceof ZmOrganizerMoveAction){c._doMove(null,null,a?this._toFolderId:this._fromFolderId) | |
}}}; | |
ZmOrganizerMoveAction.multipleRedo=function(a){ZmItemMoveAction.multipleUndo(a,true) | |
}; | |
ZmCompositeAction=function(a){ZmAction.call(this); | |
this._actions={}; | |
this._toFolderId=a | |
}; | |
ZmCompositeAction.prototype=new ZmAction; | |
ZmCompositeAction.prototype.constructor=ZmCompositeAction; | |
ZmCompositeAction.prototype.type=ZmAction.ACTION_ZMCOMPOSITEACTION; | |
ZmCompositeAction.prototype.toString=function(){return"ZmCompositeAction" | |
}; | |
ZmCompositeAction.prototype.addAction=function(b){if(b&&b!=this&&b instanceof ZmAction){var a=b.type; | |
if(!this._actions[a]){this._actions[a]=[] | |
}this._actions[a].push(b) | |
}}; | |
ZmCompositeAction.prototype.getActions=function(a){return this._actions[a]||[] | |
}; | |
ZmCompositeAction.prototype.hasActions=function(a){return this._actions[a]&&this._actions[a].length>0 | |
}; | |
ZmCompositeAction.prototype.undo=function(d,a){if(this.hasActions(ZmAction.ACTION_ZMITEMMOVEACTION)){ZmItemMoveAction.multipleUndo(this.getActions(ZmAction.ACTION_ZMITEMMOVEACTION),null,this._toFolderId) | |
}if(this.hasActions(ZmAction.ACTION_ZMORGANIZERMOVEACTION)){ZmOrganizerMoveAction.multipleUndo(this.getActions(ZmAction.ACTION_ZMORGANIZERMOVEACTION)) | |
}if(this.hasActions(ZmAction.ACTION_ZMCOMPOSITEACTION)||this.hasActions(ZmAction.ACTION_ZMITEMACTION)){var c=this.getActions(ZmAction.ACTION_ZMCOMPOSITEACTION).concat(this.getActions(ZmAction.ACTION_ZMITEMACTION)); | |
for(var b=0; | |
b<c.length; | |
b++){c[b].undo() | |
}}}; | |
ZmCompositeAction.prototype.redo=function(d,a){if(this.hasActions(ZmAction.ACTION_ZMITEMMOVEACTION)){ZmItemMoveAction.multipleRedo(this.getActions(ZmAction.ACTION_ZMITEMMOVEACTION)) | |
}if(this.hasActions(ZmAction.ACTION_ZMORGANIZERMOVEACTION)){ZmOrganizerMoveAction.multipleRedo(this.getActions(ZmAction.ACTION_ZMORGANIZERMOVEACTION)) | |
}if(this.hasActions(ZmAction.ACTION_ZMCOMPOSITEACTION)||this.hasActions(ZmAction.ACTION_ZMITEMACTION)||this.hasActions(ZmAction.ACTION_ZMORGANIZERACTION)){var c=this.getActions(ZmAction.ACTION_ZMCOMPOSITEACTION).concat(this.getActions(ZmAction.ACTION_ZMITEMACTION)).concat(this.getActions(ZmAction.ACTION_ZMORGANIZERACTION)); | |
for(var b=0; | |
b<c.length; | |
b++){c[b].redo() | |
}}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmOrganizer")){ZmOrganizer=function(a){if(arguments.length==0){return | |
}this.type=a.type; | |
var b=this.id=a.id; | |
this.nId=ZmOrganizer.normalizeId(b); | |
this.name=ZmFolder.MSG_KEY[this.nId]?ZmMsg[ZmFolder.MSG_KEY[this.nId]]:a.name; | |
this.mail=a.mail; | |
this._systemName=this.nId<256&&a.name; | |
this.parent=a.parent; | |
this.tree=a.tree; | |
this.numUnread=a.numUnread||0; | |
this.numTotal=a.numTotal||0; | |
this.noTooltip=a.noTooltip; | |
this.sizeTotal=a.sizeTotal||0; | |
this.url=a.url; | |
this.owner=a.owner; | |
this.oname=a.oname; | |
this.link=a.link||(Boolean(a.zid))||(this.parent&&this.parent.link); | |
this.isMountpoint=a.link; | |
this.zid=a.zid; | |
this.rid=a.rid; | |
this.restUrl=a.restUrl; | |
this.account=a.account; | |
this.perm=a.perm; | |
this.noSuchFolder=a.broken; | |
this._isAdmin=this._isReadOnly=this._hasPrivateAccess=null; | |
this.retentionPolicy=a.retentionPolicy; | |
this.webOfflineSyncDays=a.webOfflineSyncDays; | |
this.color=a.color||(this.parent&&this.parent.color)||ZmOrganizer.ORG_COLOR[b]||ZmOrganizer.ORG_COLOR[this.nId]||ZmOrganizer.DEFAULT_COLOR[this.type]||ZmOrganizer.C_NONE; | |
this.isColorCustom=a.rgb!=null; | |
this.rgb=a.rgb||ZmOrganizer.COLOR_VALUES[this.color]||ZmOrganizer.COLOR_VALUES[ZmOrganizer.ORG_DEFAULT_COLOR]; | |
if(appCtxt.isOffline&&!this.account&&this.id==this.nId){this.account=appCtxt.accountList.mainAccount | |
}if(b&&a.tree){appCtxt.cacheSet(b,this); | |
if(this.link){appCtxt.cacheSet([this.zid,this.rid].join(":"),this) | |
}}this.children=new AjxVector() | |
}; | |
ZmOrganizer.prototype.isZmOrganizer=true; | |
ZmOrganizer.prototype.toString=function(){return"ZmOrganizer" | |
}; | |
ZmOrganizer.TAG=ZmEvent.S_TAG; | |
ZmOrganizer.SEARCH=ZmEvent.S_SEARCH; | |
ZmOrganizer.SHARE=ZmEvent.S_SHARE; | |
ZmOrganizer.MOUNTPOINT=ZmEvent.S_MOUNTPOINT; | |
ZmOrganizer.ZIMLET=ZmEvent.S_ZIMLET; | |
ZmOrganizer.HAB=ZmEvent.S_HAB; | |
ZmOrganizer.ID_ROOT=1; | |
ZmOrganizer.ID_INBOX=2; | |
ZmOrganizer.ID_TRASH=3; | |
ZmOrganizer.ID_SPAM=4; | |
ZmOrganizer.ID_ADDRBOOK=7; | |
ZmOrganizer.ID_CALENDAR=10; | |
ZmOrganizer.ID_AUTO_ADDED=13; | |
ZmOrganizer.ID_CHATS=14; | |
ZmOrganizer.ID_TASKS=15; | |
ZmOrganizer.ID_BRIEFCASE=16; | |
ZmOrganizer.ID_ALL_MAILBOXES=249; | |
ZmOrganizer.ID_NOTIFICATION_MP=250; | |
ZmOrganizer.ID_SYNC_FAILURES=252; | |
ZmOrganizer.ID_OUTBOX=254; | |
ZmOrganizer.ID_ZIMLET=-1000; | |
ZmOrganizer.ID_ATTACHMENTS=-17; | |
ZmOrganizer.ID_DLS=-18; | |
ZmOrganizer.F_NAME="name"; | |
ZmOrganizer.F_UNREAD="unread"; | |
ZmOrganizer.F_TOTAL="total"; | |
ZmOrganizer.F_SIZE="size"; | |
ZmOrganizer.F_COLOR="color"; | |
ZmOrganizer.F_RGB="rgb"; | |
ZmOrganizer.F_QUERY="query"; | |
ZmOrganizer.F_SHARES="shares"; | |
ZmOrganizer.F_FLAGS="flags"; | |
ZmOrganizer.F_REST_URL="rest"; | |
ZmOrganizer.F_PERMS="perms"; | |
ZmOrganizer.F_RNAME="rname"; | |
ZmOrganizer.FLAG_CHECKED="#"; | |
ZmOrganizer.FLAG_DISALLOW_SUBFOLDER="o"; | |
ZmOrganizer.FLAG_EXCLUDE_FREE_BUSY="b"; | |
ZmOrganizer.FLAG_IMAP_SUBSCRIBED="*"; | |
ZmOrganizer.FLAG_OFFLINE_GLOBAL="g"; | |
ZmOrganizer.FLAG_OFFLINE_SYNCABLE="y"; | |
ZmOrganizer.FLAG_OFFLINE_SYNCING="~"; | |
ZmOrganizer.ALL_FLAGS=[ZmOrganizer.FLAG_CHECKED,ZmOrganizer.FLAG_IMAP_SUBSCRIBED,ZmOrganizer.FLAG_EXCLUDE_FREE_BUSY,ZmOrganizer.FLAG_DISALLOW_SUBFOLDER,ZmOrganizer.FLAG_OFFLINE_GLOBAL,ZmOrganizer.FLAG_OFFLINE_SYNCABLE,ZmOrganizer.FLAG_OFFLINE_SYNCING]; | |
ZmOrganizer.FLAG_PROP={}; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_CHECKED]="isChecked"; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_IMAP_SUBSCRIBED]="imapSubscribed"; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_EXCLUDE_FREE_BUSY]="excludeFreeBusy"; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_DISALLOW_SUBFOLDER]="disallowSubFolder"; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_OFFLINE_GLOBAL]="isOfflineGlobalSearch"; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_OFFLINE_SYNCABLE]="isOfflineSyncable"; | |
ZmOrganizer.FLAG_PROP[ZmOrganizer.FLAG_OFFLINE_SYNCING]="isOfflineSyncing"; | |
ZmOrganizer.VALID_NAME_CHARS='[^\\x00-\\x1F\\x7F:\\/\\"]'; | |
ZmOrganizer.VALID_PATH_CHARS='[^\\x00-\\x1F\\x7F:\\"]'; | |
ZmOrganizer.VALID_NAME_RE=new RegExp("^"+ZmOrganizer.VALID_NAME_CHARS+"+$"); | |
ZmOrganizer.MAX_NAME_LENGTH=128; | |
ZmOrganizer.MAX_DISPLAY_NAME_LENGTH=30; | |
ZmOrganizer.C_NONE=0; | |
ZmOrganizer.C_BLUE=1; | |
ZmOrganizer.C_CYAN=2; | |
ZmOrganizer.C_GREEN=3; | |
ZmOrganizer.C_PURPLE=4; | |
ZmOrganizer.C_RED=5; | |
ZmOrganizer.C_YELLOW=6; | |
ZmOrganizer.C_PINK=7; | |
ZmOrganizer.C_GRAY=8; | |
ZmOrganizer.C_ORANGE=9; | |
ZmOrganizer.MAX_COLOR=ZmOrganizer.C_ORANGE; | |
ZmOrganizer.ORG_DEFAULT_COLOR=ZmOrganizer.C_GRAY; | |
ZmOrganizer.COLOR_VALUES=[null,ZmMsg.colorBlue,ZmMsg.colorCyan,ZmMsg.colorGreen,ZmMsg.colorPurple,ZmMsg.colorRed,ZmMsg.colorYellow,ZmMsg.colorPink,ZmMsg.colorGray,ZmMsg.colorOrange]; | |
ZmOrganizer.COLOR_TEXT={}; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_NONE]=ZmMsg.none; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_ORANGE]=ZmMsg.orange; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_BLUE]=ZmMsg.blue; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_CYAN]=ZmMsg.cyan; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_GREEN]=ZmMsg.green; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_PURPLE]=ZmMsg.purple; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_RED]=ZmMsg.red; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_YELLOW]=ZmMsg.yellow; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_PINK]=ZmMsg.pink; | |
ZmOrganizer.COLOR_TEXT[ZmOrganizer.C_GRAY]=ZmMsg.gray; | |
ZmOrganizer.COLORS=[]; | |
ZmOrganizer.COLOR_CHOICES=[]; | |
(function(){for(var b=0; | |
b<=ZmOrganizer.MAX_COLOR; | |
b++){var a=ZmOrganizer.COLOR_TEXT[b]; | |
ZmOrganizer.COLORS.push(a); | |
ZmOrganizer.COLOR_CHOICES.push({value:b,label:a}) | |
}})(); | |
ZmOrganizer.MSG_KEY={}; | |
ZmOrganizer.ROOT_MSG_KEY={}; | |
ZmOrganizer.ITEM_ORGANIZER={}; | |
ZmOrganizer.DEFAULT_FOLDER={}; | |
ZmOrganizer.SOAP_CMD={}; | |
ZmOrganizer.FIRST_USER_ID={}; | |
ZmOrganizer.PRECONDITION={}; | |
ZmOrganizer.HAS_COLOR={}; | |
ZmOrganizer.DEFAULT_COLOR={}; | |
ZmOrganizer.ORG_COLOR={}; | |
ZmOrganizer.APP={}; | |
ZmOrganizer.ORG_CLASS={}; | |
ZmOrganizer.ORG_PACKAGE={}; | |
ZmOrganizer.CREATE_FUNC={}; | |
ZmOrganizer.LABEL={}; | |
ZmOrganizer.ITEMS_KEY={}; | |
ZmOrganizer.TREE_TYPE={}; | |
ZmOrganizer.VIEWS={}; | |
ZmOrganizer.VIEW_HASH={}; | |
ZmOrganizer.TYPE={}; | |
ZmOrganizer.FOLDER_KEY={}; | |
ZmOrganizer.MOUNT_KEY={}; | |
ZmOrganizer.DEFERRABLE={}; | |
ZmOrganizer.PATH_IN_NAME={}; | |
ZmOrganizer.OPEN_SETTING={}; | |
ZmOrganizer.NEW_OP={}; | |
ZmOrganizer.DISPLAY_ORDER={}; | |
ZmOrganizer.HIDE_EMPTY={}; | |
ZmOrganizer.SHAREABLE={}; | |
ZmOrganizer.APP2ORGANIZER={}; | |
ZmOrganizer.APP2ORGANIZER_R={}; | |
ZmOrganizer.PERM_READ="r"; | |
ZmOrganizer.PERM_WRITE="w"; | |
ZmOrganizer.PERM_INSERT="i"; | |
ZmOrganizer.PERM_DELETE="d"; | |
ZmOrganizer.PERM_ADMIN="a"; | |
ZmOrganizer.PERM_WORKFLOW="x"; | |
ZmOrganizer.PERM_PRIVATE="p"; | |
ZmOrganizer.RETENTION_KEEP="keep"; | |
ZmOrganizer.RETENTION_PURGE="purge"; | |
ZmOrganizer.registerOrg=function(c,a){if(a.nameKey){ZmOrganizer.MSG_KEY[c]=a.nameKey | |
}if(a.app){ZmOrganizer.APP[c]=a.app; | |
if(!ZmOrganizer.APP2ORGANIZER[a.app]){ZmOrganizer.APP2ORGANIZER[a.app]=[] | |
}ZmOrganizer.APP2ORGANIZER[a.app].push(c); | |
ZmOrganizer.APP2ORGANIZER_R[c]=a.app | |
}if(a.defaultFolder){ZmOrganizer.DEFAULT_FOLDER[c]=a.defaultFolder | |
}if(a.precondition){ZmOrganizer.PRECONDITION[c]=a.precondition | |
}if(a.soapCmd){ZmOrganizer.SOAP_CMD[c]=a.soapCmd | |
}if(a.firstUserId){ZmOrganizer.FIRST_USER_ID[c]=a.firstUserId | |
}if(a.orgClass){ZmOrganizer.ORG_CLASS[c]=a.orgClass | |
}if(a.orgPackage){ZmOrganizer.ORG_PACKAGE[c]=a.orgPackage | |
}if(a.labelKey){ZmOrganizer.LABEL[c]=a.labelKey | |
}if(a.itemsKey){ZmOrganizer.ITEMS_KEY[c]=a.itemsKey | |
}if(a.hasColor){ZmOrganizer.HAS_COLOR[c]=a.hasColor | |
}if(a.views){ZmOrganizer.VIEWS[c]=a.views | |
}if(a.folderKey){ZmOrganizer.FOLDER_KEY[c]=a.folderKey | |
}if(a.mountKey){ZmOrganizer.MOUNT_KEY[c]=a.mountKey | |
}if(a.deferrable){ZmOrganizer.DEFERRABLE[c]=a.deferrable | |
}if(a.pathInName){ZmOrganizer.PATH_IN_NAME[c]=a.pathInName | |
}if(a.openSetting){ZmOrganizer.OPEN_SETTING[c]=a.openSetting | |
}if(a.newOp){ZmOrganizer.NEW_OP[c]=a.newOp | |
}if(a.displayOrder){ZmOrganizer.DISPLAY_ORDER[c]=a.displayOrder | |
}if(a.hideEmpty){ZmOrganizer.HIDE_EMPTY[c]=a.hideEmpty | |
}ZmOrganizer.SHAREABLE[c]=!a.disableShare; | |
if(!appCtxt.isChildWindow||a.childWindow){if(a.compareFunc){ZmTreeView.COMPARE_FUNC[c]=a.compareFunc | |
}if(a.treeController){ZmOverviewController.CONTROLLER[c]=a.treeController | |
}}ZmOrganizer.TREE_TYPE[c]=a.treeType||c; | |
ZmOrganizer.CREATE_FUNC[c]=a.createFunc||"ZmOrganizer.create"; | |
if(a.views){ZmOrganizer.VIEW_HASH[c]=AjxUtil.arrayAsHash(ZmOrganizer.VIEWS[c]) | |
}if(a.hasColor){ZmOrganizer.DEFAULT_COLOR[c]=(a.defaultColor!=null)?a.defaultColor:ZmOrganizer.ORG_DEFAULT_COLOR | |
}if(a.orgColor){for(var b in a.orgColor){ZmOrganizer.ORG_COLOR[b]=a.orgColor[b] | |
}}if(a.dropTargets){if(!ZmApp.DROP_TARGETS[a.app]){ZmApp.DROP_TARGETS[a.app]={} | |
}ZmApp.DROP_TARGETS[a.app][c]=a.dropTargets | |
}}; | |
ZmOrganizer.sortCompare=function(b,a){}; | |
ZmOrganizer.getColorValue=function(b,a){if(b==ZmOrganizer.DEFAULT_COLOR[a]){return null | |
}return b | |
}; | |
ZmOrganizer.create=function(f){var h={CreateFolderRequest:{_jsns:"urn:zimbraMail"}}; | |
var d=h.CreateFolderRequest.folder={}; | |
var a=f.errorCallback||new AjxCallback(null,ZmOrganizer._handleErrorCreate,f); | |
var c=f.type; | |
f.view=f.view||ZmOrganizer.VIEWS[c]?ZmOrganizer.VIEWS[c][0]:null; | |
for(var b in f){if(b=="type"||b=="errorCallback"||b=="account"){continue | |
}var e=f[b]; | |
if(e){d[b]=e | |
}}var g=f.asyncMode===undefined?true:f.asyncMode; | |
return appCtxt.getAppController().sendRequest({jsonObj:h,asyncMode:g,accountName:(f.account&&f.account.name),callback:f.callback,callbackAfterNotifications:f.callbackAfterNotifications,errorCallback:a}) | |
}; | |
ZmOrganizer._handleErrorCreate=function(e,a){if(!e.url&&!e.name){return false | |
}var d; | |
if(e.name&&(a.code==ZmCsfeException.MAIL_ALREADY_EXISTS)){var b=appCtxt.getFolderTree(appCtxt.getActiveAccount()).getFolderTypeByName(e.name); | |
d=AjxMessageFormat.format(ZmMsg.errorAlreadyExists,[e.name,b.toLowerCase()]) | |
}else{if(e.url){var c=(a.code==ZmCsfeException.SVC_RESOURCE_UNREACHABLE)?ZmMsg.feedUnreachable:ZmMsg.feedInvalid; | |
d=AjxMessageFormat.format(c,e.url) | |
}}if(d){ZmOrganizer._showErrorMsg(d); | |
return true | |
}return false | |
}; | |
ZmOrganizer._showErrorMsg=function(b){var a=appCtxt.getMsgDialog(); | |
a.reset(); | |
a.setMessage(AjxStringUtil.htmlEncode(b),DwtMessageDialog.CRITICAL_STYLE); | |
a.popup() | |
}; | |
ZmOrganizer.getFolder=function(f,e,a){var d={GetFolderRequest:{_jsns:"urn:zimbraMail"}}; | |
var b=d.GetFolderRequest; | |
b.folder={l:f}; | |
var c=new AjxCallback(null,ZmOrganizer._handleResponseGetFolder,[e]); | |
if(a){a.addRequestParams(d,c) | |
}else{appCtxt.getRequestMgr().sendRequest({jsonObj:d,asyncMode:true,callback:c}) | |
}}; | |
ZmOrganizer._handleResponseGetFolder=function(f,a){var e=a.getResponse().GetFolderResponse; | |
var b=(e&&e.folder&&e.folder[0])||(e&&e.link&&e.link[0]); | |
var d; | |
if(b){d=appCtxt.getById(b.id); | |
if(d){d.clearShares(); | |
d._setSharesFromJs(b) | |
}else{var c=appCtxt.getById(b.l); | |
d=ZmFolderTree.createFromJs(c,b,appCtxt.getFolderTree(),"folder") | |
}}if(f){f.run(d) | |
}}; | |
ZmOrganizer.prototype.getFolder=function(b,a){ZmOrganizer.getFolder(this.id,b,a) | |
}; | |
ZmOrganizer.getViewName=function(a){return ZmOrganizer.VIEWS[a][0] | |
}; | |
ZmOrganizer.checkWebOfflineSyncDays=function(b){if(isNaN(b)){return ZmMsg.invalidFolderSyncInterval | |
}var a=parseInt(b); | |
if(a<0||a>30){return ZmMsg.invalidFolderSyncInterval | |
}return null | |
}; | |
ZmOrganizer.checkName=function(a){if(a.length==0){return ZmMsg.nameEmpty | |
}if(a.length>ZmOrganizer.MAX_NAME_LENGTH){return AjxMessageFormat.format(ZmMsg.nameTooLong,ZmOrganizer.MAX_NAME_LENGTH) | |
}if(!ZmOrganizer.VALID_NAME_RE.test(a)){return AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(a)) | |
}return null | |
}; | |
ZmOrganizer.checkUrl=function(a){if(!a.match(/^[a-zA-Z]+:\/\/.*$/i)){return ZmMsg.errorUrlMissing | |
}return null | |
}; | |
ZmOrganizer.checkSortArgs=function(a,b){if(!a&&!b){return 0 | |
}if(a&&!b){return 1 | |
}if(!a&&b){return -1 | |
}return null | |
}; | |
ZmOrganizer.checkColor=function(a){return((a!=null)&&(a>=0&&a<=ZmOrganizer.MAX_COLOR))?a:ZmOrganizer.ORG_DEFAULT_COLOR | |
}; | |
ZmOrganizer.getSystemId=function(c,b,a){b=b||appCtxt.getActiveAccount(); | |
if((b&&!b.isMain)||a){return((typeof(c)=="string")&&(c.indexOf(":")!=-1)||!c)?c:([b.id,c].join(":")) | |
}return c | |
}; | |
ZmOrganizer.normalizeId=function(d,c){if(typeof(d)!="string"){return d | |
}var a=d.indexOf(":"); | |
var b=(a==-1)?d:d.substr(a+1); | |
return(c&&(b>=ZmOrganizer.FIRST_USER_ID[c]))?d:b | |
}; | |
ZmOrganizer.parseId=function(d,b){var c=window.parentAppCtxt||window.appCtxt; | |
b=b||{}; | |
if(d==null){return b | |
}var a=(typeof d=="string")?d.indexOf(":"):-1; | |
if(a==-1){b.account=c.accountList.mainAccount; | |
b.id=d | |
}else{b.acctId=d.substring(0,a); | |
b.account=c.accountList.getAccount(b.acctId); | |
b.id=d.substr(a+1) | |
}return b | |
}; | |
ZmOrganizer.prototype.getName=function(h,c,g,b,f,a){if(this.nId==ZmFolder.ID_ROOT){var e=a||this.type; | |
return(ZmOrganizer.LABEL[e])?ZmMsg[ZmOrganizer.LABEL[e]]:"" | |
}var d=(b&&this._systemName)||(f&&this.oname)||this.name||""; | |
if(ZmOrganizer.PATH_IN_NAME[this.type]&&this.path){d=[this.path,d].join("/") | |
}d=(c&&d.length>c)?d.substring(0,c-3)+"...":d; | |
return this._markupName(d,h,g) | |
}; | |
ZmOrganizer.prototype.getPath=function(c,h,b,g,a,e){var d=this.parent; | |
var f=this.getName(h,b,g,a,e); | |
while(d&&((d.nId!=ZmOrganizer.ID_ROOT)||c)){f=d.getName(h,b,g,a,e)+ZmFolder.SEP+f; | |
d=d.parent | |
}return f | |
}; | |
ZmOrganizer.prototype.getToolTip=function(c){if(this.noTooltip){return null | |
}if(!this._tooltip||c){var a=this._getItemsText(); | |
var d=this._getUnreadLabel(); | |
var b={name:this.name,itemText:a,numTotal:this.numTotal,sizeTotal:this.sizeTotal,numUnread:this.numUnread,unreadLabel:d}; | |
this._tooltip=AjxTemplate.expand("share.App#FolderTooltip",b) | |
}return this._tooltip | |
}; | |
ZmOrganizer.prototype.getSearchPath=function(a){return(this.nId!=ZmOrganizer.ID_ROOT)?this.getPath(null,null,null,true,true,a):"/" | |
}; | |
ZmOrganizer.prototype.getUrl=function(){return this.getRestUrl() | |
}; | |
ZmOrganizer.prototype.getSyncUrl=function(){return url | |
}; | |
ZmOrganizer.prototype.getRemoteId=function(){if(!this._remoteId){this._remoteId=(this.isRemote()&&this.zid&&this.rid)?(this.zid+":"+this.rid):this.id | |
}return this._remoteId | |
}; | |
ZmOrganizer.prototype.getRestUrl=function(c){var b=appCtxt.get(ZmSetting.REST_URL); | |
if(b&&(!this.isRemote()||c)){var d=AjxStringUtil.urlEncode(this.getSearchPath()).replace("#","%23").replace(";","%3B"); | |
return([b,"/",d].join("")) | |
}if(this.restUrl){return this.restUrl | |
}var a=this._generateRestUrl(); | |
return a | |
}; | |
ZmOrganizer.prototype.getOwnerRestUrl=function(){var a=this.restUrl; | |
var b=AjxStringUtil.urlEncode(this.oname).replace("#","%23"); | |
return([a,"/",b].join("")) | |
}; | |
ZmOrganizer.prototype._generateRestUrl=function(){var e=document.location; | |
var b=appCtxt.get(ZmSetting.USERNAME); | |
var c=e.host; | |
var a=b.match(/^(.*)@(.*)$/); | |
c=(a&&a[2])||c; | |
if(e.port&&e.port!=80){c=c+":"+e.port | |
}var d=AjxStringUtil.urlEncode(this.getSearchPath()).replace("#","%23"); | |
return[e.protocol,"//",c,"/service/user/",b,"/",d].join("") | |
}; | |
ZmOrganizer.prototype.getAccount=function(){if(appCtxt.multiAccounts){if(!this.account){this.account=ZmOrganizer.parseId(this.id).account | |
}if(!this.account){var a=this.parent; | |
while(a&&!this.account){this.account=a.getAccount(); | |
a=a.parent | |
}}return this.account | |
}return(this.account||appCtxt.accountList.mainAccount) | |
}; | |
ZmOrganizer.prototype.getShares=function(){return this.shares | |
}; | |
ZmOrganizer.prototype.addShare=function(c){this.shares=this.shares||[]; | |
this.shares.push(c); | |
var d=appCtxt.getActiveAccount(); | |
var a=d&&d.id; | |
var b=c.grantee&&c.grantee.id; | |
if(b&&(b==a)){this._mainShare=c | |
}}; | |
ZmOrganizer.prototype.clearShares=function(){if(this.shares&&this.shares.length){for(var a=0; | |
a<this.shares.length; | |
a++){this.shares[a]=null | |
}}this.shares=null; | |
this._mainShare=null | |
}; | |
ZmOrganizer.prototype.getMainShare=function(){if(!this._mainShare){var d=appCtxt.getActiveAccount(); | |
var a=d&&d.id; | |
if(a&&this.shares&&this.shares.length){for(var b=0; | |
b<this.shares.length; | |
b++){var c=this.shares[b]; | |
var e=c&&c.grantee&&c.grantee.id; | |
if(e&&e==a){this._mainShare=c; | |
break | |
}}}}return this._mainShare | |
}; | |
ZmOrganizer.prototype.supportsSharing=function(){return true | |
}; | |
ZmOrganizer.prototype.supportsPublicAccess=function(){return true | |
}; | |
ZmOrganizer.prototype.supportsPrivatePermission=function(){return false | |
}; | |
ZmOrganizer.prototype.getIcon=function(){}; | |
ZmOrganizer.prototype.getColor=function(){return this.rgb||ZmOrganizer.COLOR_VALUES[this.color] | |
}; | |
ZmOrganizer.prototype.getIconWithColor=function(){var b=this.getIcon()||""; | |
var a=this.getColor(); | |
return a?[b,a].join(",color="):b | |
}; | |
ZmOrganizer.prototype.rename=function(c,e,b,a){if(c==this.name){return | |
}var d={action:"rename",attrs:{name:c},callback:e,errorCallback:b,batchCmd:a}; | |
this._organizerAction(d) | |
}; | |
ZmOrganizer.prototype.setOfflineSyncInterval=function(c,d,b,a){if(this.webOfflineSyncDays==c){return | |
}this._organizerAction({action:"webofflinesyncdays",attrs:{numDays:c},callback:d,errorCallback:b,batchCmd:a}) | |
}; | |
ZmOrganizer.prototype.setColor=function(c,d,b,a){var c=ZmOrganizer.checkColor(c); | |
if(!this.isColorChanged(c)){return | |
}this._organizerAction({action:"color",attrs:{color:c},callback:d,errorCallback:b,batchCmd:a}) | |
}; | |
ZmOrganizer.prototype.setRGB=function(c,d,b,a){if(!this.isColorChanged(c)){return | |
}this._organizerAction({action:"color",attrs:{rgb:c},callback:d,errorCallback:b,batchCmd:a}) | |
}; | |
ZmOrganizer.prototype.getRetentionPolicy=function(a){var b=null; | |
if(this.retentionPolicy&&this.retentionPolicy[0]&&this.retentionPolicy[0][a]&&this.retentionPolicy[0][a][0]&&this.retentionPolicy[0][a][0].policy&&this.retentionPolicy[0][a][0].policy[0]){b=this.retentionPolicy[0][a][0].policy[0] | |
}return b | |
}; | |
ZmOrganizer.prototype.getRetentionPolicyLifetimeMsec=function(e){if(e){var a=e.lifetime; | |
var d=parseInt(a); | |
var b=a.slice(a.length-1); | |
var c=0; | |
switch(b){case"d":c=d*AjxDateUtil.MSEC_PER_DAY; | |
break; | |
case"h":c=d*AjxDateUtil.MSEC_PER_HOUR; | |
break; | |
case"m":c=d*AjxDateUtil.MSEC_PER_MINUTE; | |
break; | |
case"s":c=d*1000; | |
break; | |
case"ms":c=d; | |
break; | |
default:c=d*1000; | |
break | |
}}return c | |
}; | |
ZmOrganizer.prototype.setRetentionPolicy=function(d,j,g,c){var a=this.getRetentionPolicy(ZmOrganizer.RETENTION_KEEP); | |
var e=this.getRetentionPolicy(ZmOrganizer.RETENTION_PURGE); | |
if(!this.policiesDiffer(a,d.keep)&&!this.policiesDiffer(e,d.purge)){return | |
}var b=ZmOrganizer.SOAP_CMD[this.type]+"Request"; | |
var f={_jsns:"urn:zimbraMail",action:{op:"retentionpolicy",id:this.id,retentionPolicy:{keep:{},purge:{}}}}; | |
var k={}; | |
k[b]=f; | |
var i=f.action.retentionPolicy; | |
if(d.keep){this._addPolicy(i.keep,d.keep) | |
}if(d.purge){this._addPolicy(i.purge,d.purge) | |
}if(c){c.addRequestParams(k,j,g) | |
}else{var h; | |
if(appCtxt.multiAccounts){h=(this.account)?this.account.name:appCtxt.accountList.mainAccount.name | |
}appCtxt.getAppController().sendRequest({jsonObj:k,asyncMode:true,accountName:h,callback:j,errorCallback:g}) | |
}}; | |
ZmOrganizer.prototype.policiesDiffer=function(b,a){var c=false; | |
if((b&&!a)||(!b&&a)){c=true | |
}else{if(b){if(b.type!=a.type){c=true | |
}else{if(b.type=="user"){c=b.lifetime!=a.lifetime | |
}else{c=b.id!=a.id | |
}}}}return c | |
}; | |
ZmOrganizer.prototype._addPolicy=function(c,d){var b=c.policy={}; | |
for(var a in d){if(AjxEnv.isIE){d[a]+="" | |
}b[a]=d[a] | |
}}; | |
ZmOrganizer.getStandardColorNumber=function(b){if(String(b).match(/^#/)){var a=ZmOrganizer.COLOR_VALUES.length; | |
for(var d=0; | |
d<a; | |
d++){var c=ZmOrganizer.COLOR_VALUES[d]; | |
if(c&&c==b){return d | |
}}}else{if(b<=9&&b>=0){return b | |
}}return -1 | |
}; | |
ZmOrganizer.prototype.isColorChanged=function(b){var a=ZmOrganizer.getStandardColorNumber(b)===-1,c=this.isColorCustom; | |
if((a&&!c)||(!a&&c)){return true | |
}else{if(a&&c){return b!=this.rgb | |
}else{if(!a&&!c){return b!=this.color | |
}}}return false | |
}; | |
ZmOrganizer.prototype.update=function(a){this._organizerAction({action:"update",attrs:a}) | |
}; | |
ZmOrganizer.prototype.move=function(d,c,a){var b=(d.nId>0)?d.id:ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT); | |
if((b==this.id||b==this.parent.id)||(this.type==ZmOrganizer.FOLDER&&(ZmOrganizer.normalizeId(b,this.type)==ZmFolder.ID_SPAM))||(d.isChildOf(this))){return | |
}var e={}; | |
e.batchCmd=a; | |
e.actionTextKey="actionMoveOrganizer"; | |
e.orgName=this.getName(false,false,true,false,false,this.type); | |
if(b==ZmOrganizer.ID_TRASH){e.actionArg=ZmMsg.trash; | |
e.action="trash"; | |
e.noUndo=c | |
}else{if(d.account&&d.account.isLocal()){b=[ZmAccount.LOCAL_ACCOUNT_ID,b].join(":") | |
}e.actionArg=d.getName(false,false,true,false,false,this.type); | |
e.action="move"; | |
e.attrs={l:b}; | |
e.noUndo=c | |
}this._organizerAction(e) | |
}; | |
ZmOrganizer.prototype._delete=function(b){var a=((this.type==ZmOrganizer.FOLDER||this.type==ZmOrganizer.ADDRBOOK||this.type==ZmOrganizer.BRIEFCASE)&&(this.nId==ZmFolder.ID_SPAM||this.nId==ZmFolder.ID_TRASH)); | |
if(this.isSystem()&&!a){return | |
}var c=a?"empty":"delete"; | |
this._organizerAction({action:c,batchCmd:b}) | |
}; | |
ZmOrganizer.prototype.empty=function(f,c,h,e,b,d){f=f||false; | |
var a=((this.type==ZmOrganizer.FOLDER||this.type==ZmOrganizer.ADDRBOOK)&&(this.nId==ZmFolder.ID_SPAM||this.nId==ZmFolder.ID_TRASH||this.nId==ZmFolder.ID_CHATS||this.nId==ZmOrganizer.ID_SYNC_FAILURES)); | |
if(this.isSystem()&&!a){return | |
}var g={action:"empty",batchCmd:c,callback:h,timeout:e,errorCallback:b,noBusyOverlay:d}; | |
g.attrs=(this.nId==ZmFolder.ID_TRASH)?{recursive:true}:{recursive:f}; | |
if(this.isRemote()){g.id=this.getRemoteId() | |
}this._organizerAction(g) | |
}; | |
ZmOrganizer.prototype.markAllRead=function(a){var b=this.isRemote()?this.getRemoteId():null; | |
this._organizerAction({action:"read",id:b,attrs:{l:this.id},batchCmd:a}) | |
}; | |
ZmOrganizer.prototype.sync=function(){this._organizerAction({action:"sync"}) | |
}; | |
ZmOrganizer.prototype.notifyDelete=function(){var b=appCtxt.getOverviewController().getTreeController(this.type); | |
var d=b&&b.getTreeView(appCtxt.getCurrentApp().getOverviewId()); | |
var e=d&&d.getSelected(); | |
if(e){if(!(e instanceof Array)){e=[e] | |
}for(var g=0; | |
g<e.length; | |
g++){var a=e[g]; | |
if(a&&(a==this||a.isChildOf(this))){var c=this.parent.id; | |
if(this.parent.nId==ZmOrganizer.ID_ROOT){c=ZmOrganizer.getSystemId(this.getDefaultFolderId()) | |
}var f=false; | |
d.setSelected(c,f) | |
}}}this.deleteLocal(); | |
this._notify(ZmEvent.E_DELETE) | |
}; | |
ZmOrganizer.prototype.notifyCreate=function(){}; | |
ZmOrganizer.prototype.notifyModify=function(obj,details){var doNotify=false; | |
var details=details||{}; | |
var fields={}; | |
if(obj.name!=null&&(this.name!=obj.name||this.id!=obj.id)){if(obj.id==this.id){details.oldName=this.name; | |
this.name=obj.name; | |
fields[ZmOrganizer.F_NAME]=true; | |
this.parent.children.sort(eval(ZmTreeView.COMPARE_FUNC[this.type])) | |
}else{details.newName=obj.name; | |
fields[ZmOrganizer.F_RNAME]=true | |
}doNotify=true | |
}if(obj.u!=null&&this.numUnread!=obj.u){this.numUnread=obj.u; | |
fields[ZmOrganizer.F_UNREAD]=true; | |
doNotify=true | |
}if(obj.n!=null&&this.numTotal!=obj.n){this.numTotal=obj.n; | |
fields[ZmOrganizer.F_TOTAL]=true; | |
doNotify=true | |
}if(obj.s!=null&&this.sizeTotal!=obj.s){this.sizeTotal=obj.s; | |
fields[ZmOrganizer.F_SIZE]=true; | |
doNotify=true | |
}if((obj.rgb!=null||obj.color!=null)&&!obj._isRemote){var color=obj.color||obj.rgb; | |
if(this.isColorChanged(color)){this.isColorCustom=obj.rgb!=null; | |
this.color=obj.color; | |
this.rgb=obj.rgb||ZmOrganizer.COLOR_VALUES[color]; | |
fields[ZmOrganizer.F_COLOR]=true; | |
fields[ZmOrganizer.F_RGB]=true | |
}doNotify=true | |
}if(obj.f!=null&&!obj._isRemote){var oflags=this._setFlags().split("").sort().join(""); | |
var nflags=obj.f.split("").sort().join(""); | |
if(oflags!=nflags){this._parseFlags(obj.f); | |
fields[ZmOrganizer.F_FLAGS]=true; | |
doNotify=true | |
}}if(obj.rest!=null&&this.restUrl!=obj.rest&&!obj._isRemote){this.restUrl=obj.rest; | |
fields[ZmOrganizer.F_REST_URL]=true; | |
doNotify=true | |
}if(obj.acl){this.clearShares(); | |
if(obj.acl.grant&&obj.acl.grant.length){AjxDispatcher.require("Share"); | |
for(var i=0; | |
i<obj.acl.grant.length; | |
i++){share=ZmShare.createFromJs(this,obj.acl.grant[i]); | |
this.addShare(share) | |
}}fields[ZmOrganizer.F_SHARES]=true; | |
doNotify=true | |
}if(obj.perm&&obj._isRemote){fields[ZmOrganizer.F_PERMS]=true; | |
doNotify=true; | |
this._isAdmin=this._isReadOnly=this._hasPrivateAccess=null | |
}if(obj.retentionPolicy){if(obj.retentionPolicy[0].keep||obj.retentionPolicy[0].purge){this.retentionPolicy=obj.retentionPolicy | |
}else{this.retentionPolicy=null | |
}}if(obj.hasOwnProperty("webOfflineSyncDays")){this.webOfflineSyncDays=obj.webOfflineSyncDays | |
}if(doNotify){details.fields=fields; | |
this._notify(ZmEvent.E_MODIFY,details) | |
}if(this.parent&&obj.l!=null&&obj.l!=this.parent.id){var newParent=this._getNewParent(obj.l); | |
if(newParent){this.reparent(newParent); | |
this._notify(ZmEvent.E_MOVE); | |
this.tree=newParent.tree | |
}}}; | |
ZmOrganizer.prototype.deleteLocal=function(){this.parent.children.remove(this); | |
var b=this.children.getArray(); | |
var d=this.children.size(); | |
for(var c=0; | |
c<d; | |
c++){var e=b[c]; | |
if(e){e.deleteLocal() | |
}}this.children.removeAll() | |
}; | |
ZmOrganizer.prototype.hasChild=function(a){return(this.getChild(a)!=null) | |
}; | |
ZmOrganizer.prototype.getChild=function(c){c=c?c.toLowerCase():""; | |
var b=this.children.getArray(); | |
var e=this.children.size(); | |
for(var d=0; | |
d<e; | |
d++){if(b[d]&&b[d].name&&(b[d].name.toLowerCase()==c)){return b[d] | |
}}return null | |
}; | |
ZmOrganizer.prototype.getChildByPath=function(e){var a=this; | |
if(e.match(/^\//)){while(a.nId!=ZmOrganizer.ID_ROOT){a=a.parent | |
}e=e.substr(1) | |
}if(e.length==0){return a | |
}var d=e.split("/"); | |
var c=0; | |
while(c<d.length){var b=d[c++]; | |
var f=a.getChild(b); | |
if(f==null){return null | |
}a=f | |
}return a | |
}; | |
ZmOrganizer.prototype.reparent=function(a){if(this.parent){this.parent.children.remove(this) | |
}if(a){a.children.add(this) | |
}this.parent=a | |
}; | |
ZmOrganizer.prototype.getById=function(g){if(this.link&&g&&typeof(g)=="string"){var e=g.split(":"); | |
if(this.zid==e[0]&&this.rid==e[1]){return this | |
}}if(this.id==g||this.nId==g){return this | |
}var b; | |
var c=this.children.getArray(); | |
var f=this.children.size(); | |
for(var d=0; | |
d<f; | |
d++){if(b=c[d].getById(g)){return b | |
}}return null | |
}; | |
ZmOrganizer.prototype.getByName=function(b,a){return this._getByName(b.toLowerCase(),a) | |
}; | |
ZmOrganizer.prototype.getByType=function(a){var b=[]; | |
this._getByType(a,b); | |
return b | |
}; | |
ZmOrganizer.prototype._getByType=function(d,e){if(this.type==d){e.push(this) | |
}var b=this.children.getArray(); | |
for(var c=0; | |
c<b.length; | |
c++){if(b[c]){b[c]._getByType(d,e) | |
}}}; | |
ZmOrganizer.prototype.getByPath=function(b,a){return this._getByPath(b.toLowerCase(),a) | |
}; | |
ZmOrganizer.prototype._getByPath=function(f,d){if(this.nId==ZmFolder.ID_TAGS){return null | |
}if(f==this.getPath(false,false,null,true,d).toLowerCase()){return this | |
}var c=this.children.getArray(); | |
for(var e=0; | |
e<c.length; | |
e++){var b=c[e]._getByPath(f,d); | |
if(b){return b | |
}}return null | |
}; | |
ZmOrganizer.prototype.size=function(){return this.children.size() | |
}; | |
ZmOrganizer.prototype.isChildOf=function(a){var b=this.parent; | |
while(b){if(b==a){return true | |
}b=b.parent | |
}return false | |
}; | |
ZmOrganizer.prototype._getNewParent=function(a){return appCtxt.getById(a) | |
}; | |
ZmOrganizer.prototype.isUnder=function(b){b=b.toString(); | |
if(this.nId==b||(this.isRemote()&&this.rid==b)){return true | |
}var a=this.parent; | |
while(a&&a.nId!=ZmOrganizer.ID_ROOT){if(a.nId==b){return true | |
}a=a.parent | |
}return false | |
}; | |
ZmOrganizer.prototype.isInTrash=function(){return this.isUnder(ZmOrganizer.ID_TRASH) | |
}; | |
ZmOrganizer.prototype.isPermAllowed=function(b){if(this.perm){var a=this.perm.replace(/-./g,""); | |
return(a.indexOf(b)!=-1) | |
}return false | |
}; | |
ZmOrganizer.prototype.isReadOnly=function(){if(this._isReadOnly==null){var a=this.getMainShare(); | |
this._isReadOnly=(a!=null)?(this.isRemote()&&!a.isWrite()):(this.isRemote()&&this.isPermAllowed(ZmOrganizer.PERM_READ)&&!this.isPermAllowed(ZmOrganizer.PERM_WRITE)) | |
}return this._isReadOnly | |
}; | |
ZmOrganizer.prototype.isAdmin=function(){if(this._isAdmin==null){var a=this.getMainShare(); | |
this._isAdmin=(a!=null)?(this.isRemote()&&a.isAdmin()):(this.isRemote()&&this.isPermAllowed(ZmOrganizer.PERM_ADMIN)) | |
}return this._isAdmin | |
}; | |
ZmOrganizer.prototype.hasPrivateAccess=function(){if(this._hasPrivateAccess==null){var a=this.getMainShare(); | |
this._hasPrivateAccess=(a!=null)?(this.isRemote()&&a.hasPrivateAccess()):(this.isRemote()&&this.isPermAllowed(ZmOrganizer.PERM_PRIVATE)) | |
}return this._hasPrivateAccess | |
}; | |
ZmOrganizer.prototype.isRemote=function(){if(this._isRemote==null){if(this.zid!=null){this._isRemote=true | |
}else{if(appCtxt.multiAccounts){var b=this.account; | |
var a=ZmOrganizer.parseId(this.id); | |
if(!b){if(a.account&&a.account.isMain){this._isRemote=false; | |
return this._isRemote | |
}else{b=appCtxt.getActiveAccount() | |
}}this._isRemote=Boolean(!a.account||(a.account&&(a.account!=b))) | |
}else{var c=String(this.id); | |
this._isRemote=((c.indexOf(":")!=-1)&&(c.indexOf(appCtxt.getActiveAccount().id)!=0)) | |
}}}return this._isRemote | |
}; | |
ZmOrganizer.prototype.isRemoteRoot=function(){return this.isRemote()&&(this.rid==ZmOrganizer.ID_ROOT) | |
}; | |
ZmOrganizer.prototype.isSystem=function(){return(this.nId<ZmOrganizer.FIRST_USER_ID[this.type]) | |
}; | |
ZmOrganizer.prototype.isDefault=function(){return this.nId==this.getDefaultFolderId() | |
}; | |
ZmOrganizer.prototype.getDefaultFolderId=function(){return ZmOrganizer.DEFAULT_FOLDER[this.type] | |
}; | |
ZmOrganizer.prototype.isTrash=function(){return this.nId==ZmFolder.ID_TRASH | |
}; | |
ZmOrganizer.prototype.isFeed=function(){return Boolean(this.url) | |
}; | |
ZmOrganizer.prototype.hasFeeds=function(){return false | |
}; | |
ZmOrganizer.prototype.isDataSource=function(b,c){var a=this.getDataSources(b,c); | |
return(a&&a.length>0) | |
}; | |
ZmOrganizer.prototype.getDataSources=function(b,c){if(!appCtxt.get(ZmSetting.MAIL_ENABLED)){return null | |
}var a=appCtxt.getDataSourceCollection(); | |
var d=a.getByFolderId(this.nId,b); | |
if(d.length==0){return(c&&this.parent)?this.parent.getDataSources(b,c):null | |
}return d | |
}; | |
ZmOrganizer.prototype.getOwner=function(){return this.owner||(this.parent&&this.parent.getOwner())||appCtxt.get(ZmSetting.USERNAME) | |
}; | |
ZmOrganizer.getSortIndex=function(e,a){if(!(e&&e.parent&&a)){return null | |
}var c=e.parent.children.getArray(); | |
for(var b=0; | |
b<c.length; | |
b++){var d=a(e,c[b]); | |
if(d==-1){return b | |
}}return b | |
}; | |
ZmOrganizer.prototype._organizerAction=function(c){var b=ZmOrganizer.SOAP_CMD[this.type]+"Request"; | |
var d={_jsns:"urn:zimbraMail",action:{op:c.action,id:c.id||this.id}}; | |
var h={}; | |
h[b]=d; | |
for(var e in c.attrs){if(AjxEnv.isIE){c.attrs[e]+="" | |
}d.action[e]=c.attrs[e] | |
}var g=appCtxt.getActionController(); | |
g.dismiss(); | |
var a=(!c.noUndo&&g&&g.actionPerformed({op:c.action,id:c.id||this.id,attrs:c.attrs}))||null; | |
var i=new AjxCallback(this,this._handleResponseOrganizerAction,[c,a]); | |
if(c.batchCmd){c.batchCmd.addRequestParams(h,i,c.errorCallback) | |
}else{var f; | |
if(appCtxt.multiAccounts){f=(this.account)?this.account.name:appCtxt.accountList.mainAccount.name | |
}appCtxt.getAppController().sendRequest({jsonObj:h,asyncMode:true,accountName:f,callback:i,errorCallback:c.errorCallback,timeout:c.timeout,noBusyOverlay:c.noBusyOverlay}) | |
}}; | |
ZmOrganizer.prototype._handleResponseOrganizerAction=function(f,e,a){if(e){e.setComplete() | |
}if(f.callback){f.callback.run(a) | |
}if(f.actionTextKey){var d=appCtxt.getActionController(); | |
var c=ZmOrganizer.getActionSummary({actionTextKey:f.actionTextKey,numItems:f.numItems||1,type:this.type,orgName:f.orgName,actionArg:f.actionArg}); | |
var b=e&&d&&d.getUndoLink(e); | |
if(b&&d){d.onPopup(); | |
appCtxt.setStatusMsg({msg:c+b,transitions:d.getStatusTransitions()}) | |
}else{appCtxt.setStatusMsg(c) | |
}}}; | |
ZmOrganizer.getActionSummary=function(a){var f=a.type,g=ZmOrganizer.FOLDER_KEY[f],c=ZmMsg[g],d=AjxStringUtil.capitalize(g),b=a.actionTextKey+d,h=ZmMsg[b]||ZmMsg[a.actionTextKey],e=AjxStringUtil.htmlEncode(a.orgName),i=AjxStringUtil.htmlEncode(a.actionArg); | |
return AjxMessageFormat.format(h,[c,e,i]) | |
}; | |
ZmOrganizer.prototype._getByName=function(e,c){if(this.name&&e==this.name.toLowerCase()){return this | |
}var b; | |
var d=this.children.getArray(); | |
var g=this.children.size(); | |
for(var f=0; | |
f<g; | |
f++){if(b=d[f]._getByName(e,c)){if(c&&b.isDataSource(ZmAccount.TYPE_IMAP,true)){continue | |
}return b | |
}}return null | |
}; | |
ZmOrganizer.prototype._parseFlags=function(c){for(var b=0; | |
b<ZmOrganizer.ALL_FLAGS.length; | |
b++){var a=ZmOrganizer.ALL_FLAGS[b]; | |
this[ZmOrganizer.FLAG_PROP[a]]=(Boolean(c&&(c.indexOf(a)!=-1))) | |
}}; | |
ZmOrganizer.prototype._setFlags=function(){var b=""; | |
for(var c=0; | |
c<ZmOrganizer.ALL_FLAGS.length; | |
c++){var a=ZmOrganizer.ALL_FLAGS[c]; | |
var d=ZmOrganizer.FLAG_PROP[a]; | |
if(this[d]){b=b+a | |
}}return b | |
}; | |
ZmOrganizer.prototype.addChangeListener=function(a){this.tree.addChangeListener(a) | |
}; | |
ZmOrganizer.prototype.removeChangeListener=function(a){this.tree.removeChangeListener(a) | |
}; | |
ZmOrganizer.prototype._setSharesFromJs=function(c){if(c.acl&&c.acl.grant&&c.acl.grant.length>0){AjxDispatcher.require("Share"); | |
for(var b=0; | |
b<c.acl.grant.length; | |
b++){var a=c.acl.grant[b]; | |
this.addShare(ZmShare.createFromJs(this,a)) | |
}}}; | |
ZmOrganizer.prototype._notify=function(b,a){if(a){a.organizers=[this] | |
}else{a={organizers:[this]} | |
}this.tree._evt.type=this.type; | |
this.tree._notify(b,a) | |
}; | |
ZmOrganizer.prototype._markupName=function(a,c,b){if(!b){a=AjxStringUtil.htmlEncode(a,true) | |
}if(c&&this.hasUnreadDescendent()){if(this.numUnread>0){a=AjxMessageFormat.format(ZmMsg.folderUnread,[a,this.numUnread]) | |
}if(!b){a=["<span style='font-weight:bold'>",a,"</span>"].join("") | |
}}if(this.noSuchFolder&&!b){a=["<del>",a,"</del>"].join("") | |
}return a | |
}; | |
ZmOrganizer.prototype._getItemsText=function(){var a=ZmMsg[ZmOrganizer.ITEMS_KEY[this.type]]; | |
if(!a||this.isTrash()){a=ZmMsg.items | |
}return a | |
}; | |
ZmOrganizer.prototype._getUnreadLabel=function(){return ZmMsg.unread | |
}; | |
ZmOrganizer.prototype.hasUnreadDescendent=function(){if(this.numUnread>0){return true | |
}var b=this.children.getArray(),d=this.children.size(); | |
for(var c=0; | |
c<d; | |
c++){if(b[c].hasUnreadDescendent()){return true | |
}}return false | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmFolder")){ZmFolder=function(a){if(arguments.length==0){return | |
}a.type=a.type||ZmOrganizer.FOLDER; | |
ZmOrganizer.call(this,a) | |
}; | |
ZmFolder.prototype=new ZmOrganizer; | |
ZmFolder.prototype.constructor=ZmFolder; | |
ZmFolder.prototype.isZmFolder=true; | |
ZmFolder.prototype.toString=function(){return"ZmFolder" | |
}; | |
ZmOrganizer.ORG_CLASS[ZmId.ORG_FOLDER]="ZmFolder"; | |
ZmFolder.SEP="/"; | |
ZmFolder.ID_LOAD_FOLDERS=-3; | |
ZmFolder.ID_OTHER=-2; | |
ZmFolder.ID_SEP=-1; | |
ZmFolder.ID_ROOT=ZmOrganizer.ID_ROOT; | |
ZmFolder.ID_INBOX=ZmOrganizer.ID_INBOX; | |
ZmFolder.ID_TRASH=ZmOrganizer.ID_TRASH; | |
ZmFolder.ID_SPAM=ZmOrganizer.ID_SPAM; | |
ZmFolder.ID_SENT=5; | |
ZmFolder.ID_DRAFTS=6; | |
ZmFolder.ID_CONTACTS=ZmOrganizer.ID_ADDRBOOK; | |
ZmFolder.ID_AUTO_ADDED=ZmOrganizer.ID_AUTO_ADDED; | |
ZmFolder.ID_TAGS=8; | |
ZmFolder.ID_TASKS=ZmOrganizer.ID_TASKS; | |
ZmFolder.ID_SYNC_FAILURES=ZmOrganizer.ID_SYNC_FAILURES; | |
ZmFolder.ID_OUTBOX=ZmOrganizer.ID_OUTBOX; | |
ZmFolder.ID_CHATS=ZmOrganizer.ID_CHATS; | |
ZmFolder.ID_ATTACHMENTS=ZmOrganizer.ID_ATTACHMENTS; | |
ZmFolder.ID_DLS=ZmOrganizer.ID_DLS; | |
ZmFolder.MSG_KEY={}; | |
ZmFolder.MSG_KEY[ZmFolder.ID_INBOX]="inbox"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_TRASH]="trash"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_SPAM]="junk"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_SENT]="sent"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_DRAFTS]="drafts"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_CONTACTS]="contacts"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_AUTO_ADDED]="emailedContacts"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_TASKS]="tasks"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_TAGS]="tags"; | |
ZmFolder.MSG_KEY[ZmOrganizer.ID_CALENDAR]="calendar"; | |
ZmFolder.MSG_KEY[ZmOrganizer.ID_BRIEFCASE]="briefcase"; | |
ZmFolder.MSG_KEY[ZmOrganizer.ID_CHATS]="chats"; | |
ZmFolder.MSG_KEY[ZmOrganizer.ID_ALL_MAILBOXES]="allMailboxes"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_OUTBOX]="outbox"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_SYNC_FAILURES]="errorReports"; | |
ZmFolder.MSG_KEY[ZmFolder.ID_ATTACHMENTS]="attachments"; | |
ZmFolder.ICON={}; | |
ZmFolder.ICON[ZmFolder.ID_INBOX]="Inbox"; | |
ZmFolder.ICON[ZmFolder.ID_TRASH]="Trash"; | |
ZmFolder.ICON[ZmFolder.ID_SPAM]="SpamFolder"; | |
ZmFolder.ICON[ZmFolder.ID_SENT]="SentFolder"; | |
ZmFolder.ICON[ZmFolder.ID_SYNC_FAILURES]="SendReceive"; | |
ZmFolder.ICON[ZmFolder.ID_OUTBOX]="Outbox"; | |
ZmFolder.ICON[ZmFolder.ID_DRAFTS]="DraftFolder"; | |
ZmFolder.ICON[ZmFolder.ID_CHATS]="ChatFolder"; | |
ZmFolder.ICON[ZmFolder.ID_LOAD_FOLDERS]="Plus"; | |
ZmFolder.ICON[ZmFolder.ID_ATTACHMENTS]="Attachment"; | |
ZmFolder.QUERY_NAME={}; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_INBOX]="inbox"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_TRASH]="trash"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_SPAM]="junk"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_SENT]="sent"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_OUTBOX]="outbox"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_DRAFTS]="drafts"; | |
ZmFolder.QUERY_NAME[ZmOrganizer.ID_CALENDAR]="calendar"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_CONTACTS]="contacts"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_TASKS]="tasks"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_AUTO_ADDED]="Emailed Contacts"; | |
ZmFolder.QUERY_NAME[ZmOrganizer.ID_BRIEFCASE]="briefcase"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_CHATS]="chats"; | |
ZmFolder.QUERY_NAME[ZmFolder.ID_SYNC_FAILURES]="Error Reports"; | |
ZmFolder.QUERY_ID=AjxUtil.valueHash(ZmFolder.QUERY_NAME); | |
ZmFolder.SORT_ORDER={}; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_INBOX]=1; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_CHATS]=2; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_SENT]=3; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_DRAFTS]=4; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_SPAM]=5; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_OUTBOX]=6; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_TRASH]=7; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_SYNC_FAILURES]=8; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_SEP]=9; | |
ZmFolder.SORT_ORDER[ZmFolder.ID_ATTACHMENTS]=99; | |
ZmFolder.TCON_CODE={}; | |
ZmFolder.TCON_CODE[ZmFolder.ID_TRASH]="t"; | |
ZmFolder.TCON_CODE[ZmFolder.ID_SYNC_FAILURES]="o"; | |
ZmFolder.TCON_CODE[ZmFolder.ID_SPAM]="j"; | |
ZmFolder.TCON_CODE[ZmFolder.ID_SENT]="s"; | |
ZmFolder.TCON_CODE[ZmFolder.ID_DRAFTS]="d"; | |
ZmFolder.TCON_CODE[ZmFolder.ID_OTHER]="o"; | |
ZmFolder.HIDE_ID={}; | |
ZmFolder.HIDE_ID[ZmOrganizer.ID_CHATS]=true; | |
ZmFolder.HIDE_ID[ZmOrganizer.ID_NOTIFICATION_MP]=true; | |
ZmFolder.HIDE_NAME={}; | |
ZmFolder.OUTBOUND=[ZmFolder.ID_SENT,ZmFolder.ID_OUTBOX,ZmFolder.ID_DRAFTS]; | |
ZmFolder.SYNC_ISSUES="Sync Issues"; | |
ZmFolder.QUERY_ID={}; | |
(function(){for(var a in ZmFolder.QUERY_NAME){ZmFolder.QUERY_ID[ZmFolder.QUERY_NAME[a]]=a | |
}})(); | |
ZmFolder.sortCompare=function(d,c,b){var a=ZmOrganizer.checkSortArgs(d,c); | |
if(a!=null){return a | |
}if(appCtxt.isOffline){if(d.isDataSource(ZmAccount.TYPE_POP)){if(d.id==ZmFolder.ID_INBOX){return -1 | |
}if(c.isDataSource(ZmAccount.TYPE_POP)){if(d.name.toLowerCase()>c.name.toLowerCase()){return 1 | |
}if(d.name.toLowerCase()<c.name.toLowerCase()){return -1 | |
}return 0 | |
}return -1 | |
}else{if(c.isDataSource(ZmAccount.TYPE_POP)){return 1 | |
}}}if(ZmFolder.SORT_ORDER[d.nId]&&ZmFolder.SORT_ORDER[c.nId]){return(ZmFolder.SORT_ORDER[d.nId]-ZmFolder.SORT_ORDER[c.nId]) | |
}if(d.link!==c.link){return d.link?1:-1 | |
}if(b){if(d.isTrash()){return 1 | |
}if(c.isTrash()){return -1 | |
}if(d.isSystem()&&!c.isSystem()){return -1 | |
}if(!d.isSystem()&&c.isSystem()){return 1 | |
}if(d.isSystem()&&c.isSystem()){if(d.isDefault()){return -1 | |
}if(c.isDefault()){return 1 | |
}}}else{if(!ZmFolder.SORT_ORDER[d.nId]&&ZmFolder.SORT_ORDER[c.nId]){return 1 | |
}if(ZmFolder.SORT_ORDER[d.nId]&&!ZmFolder.SORT_ORDER[c.nId]){return -1 | |
}}if(d.name.toLowerCase()>c.name.toLowerCase()){return 1 | |
}if(d.name.toLowerCase()<c.name.toLowerCase()){return -1 | |
}return 0 | |
}; | |
ZmFolder.sortCompareNonMail=function(b,a){return ZmFolder.sortCompare(b,a,true) | |
}; | |
ZmFolder.sortComparePath=function(e,d){var c=e&&e.getPath(false,false,null,true,true); | |
var b=d&&d.getPath(false,false,null,true,true); | |
var a=ZmOrganizer.checkSortArgs(c,b); | |
if(a!=null){return a | |
}if(ZmFolder.SORT_ORDER[e.nId]&&ZmFolder.SORT_ORDER[d.nId]){return(ZmFolder.SORT_ORDER[e.nId]-ZmFolder.SORT_ORDER[d.nId]) | |
}if(!ZmFolder.SORT_ORDER[e.nId]&&ZmFolder.SORT_ORDER[d.nId]){return 1 | |
}if(ZmFolder.SORT_ORDER[e.nId]&&!ZmFolder.SORT_ORDER[d.nId]){return -1 | |
}if(c.toLowerCase()>b.toLowerCase()){return 1 | |
}if(c.toLowerCase()<b.toLowerCase()){return -1 | |
}return 0 | |
}; | |
ZmFolder.checkName=function(c,d){var b=ZmOrganizer.checkName(c); | |
if(b){return b | |
}d=d||appCtxt.getFolderTree().root; | |
if(d&&(d.id==ZmFolder.ID_ROOT)){var a=c.toLowerCase(); | |
for(var f in ZmFolder.MSG_KEY){var e=ZmMsg[ZmFolder.MSG_KEY[f]]; | |
if(e&&(a==e.toLowerCase())){return ZmMsg.folderNameReserved | |
}}}return null | |
}; | |
ZmFolder.getIdForName=function(c){var a=c.toLowerCase(); | |
for(var b in ZmFolder.MSG_KEY){if(ZmFolder.MSG_KEY[b]==a){return b | |
}}return null | |
}; | |
ZmFolder.prototype.move=function(e,d,f,a){var c=this.name; | |
var b=this.name; | |
while(e.hasChild(b)){b=b+"_" | |
}if(c!=b){this.rename(b) | |
}ZmOrganizer.prototype.move.call(this,e,d,a) | |
}; | |
ZmFolder.prototype.toggleSyncOffline=function(f,a){if(!this.isOfflineSyncable){return | |
}var e=this.isOfflineSyncing?"!syncon":"syncon"; | |
var c=AjxSoapDoc.create("FolderActionRequest","urn:zimbraMail"); | |
var b=c.set("action"); | |
b.setAttribute("op",e); | |
b.setAttribute("id",this.id); | |
var d={soapDoc:c,asyncMode:true,callback:f,errorCallback:a}; | |
appCtxt.getAppController().sendRequest(d) | |
}; | |
ZmFolder.prototype.hasFeeds=function(){if(this.type!=ZmOrganizer.FOLDER){return false | |
}var b=this.children.getArray(); | |
var d=this.children.size(); | |
for(var c=0; | |
c<d; | |
c++){if(b[c].isFeed()){return true | |
}if(b[c].children&&b[c].children.size()>0){return(b[c].hasFeeds&&b[c].hasFeeds()) | |
}}return false | |
}; | |
ZmFolder.prototype.hasSearch=function(e){if(this.type==ZmOrganizer.SEARCH){return true | |
}var b=this.children.getArray(); | |
var d=this.children.size(); | |
for(var c=0; | |
c<d; | |
c++){if(b[c].hasSearch()){return true | |
}}return false | |
}; | |
ZmFolder.prototype.supportsPublicAccess=function(){return true | |
}; | |
ZmFolder.prototype.notifyCreate=function(obj,elementType,skipNotify){var nId=ZmOrganizer.normalizeId(obj.id); | |
if(this.isSystem()&&nId<ZmOrganizer.FIRST_USER_ID[this.type]){return | |
}var account=ZmOrganizer.parseId(obj.id).account; | |
var folder=ZmFolderTree.createFromJs(this,obj,this.tree,elementType,null,account); | |
if(folder){var index=ZmOrganizer.getSortIndex(folder,eval(ZmTreeView.COMPARE_FUNC[this.type])); | |
this.children.add(folder,index); | |
if(!skipNotify){folder._notify(ZmEvent.E_CREATE) | |
}}}; | |
ZmFolder.prototype.notifyModify=function(obj){var details={}; | |
var fields={}; | |
var doNotify=false; | |
if(obj.name!=null&&this.name!=obj.name&&obj.id==this.id){details.oldPath=this.getPath(); | |
this.name=obj.name; | |
fields[ZmOrganizer.F_NAME]=true; | |
this.parent.children.sort(eval(ZmTreeView.COMPARE_FUNC[this.type])); | |
doNotify=true; | |
obj.name=null | |
}if(doNotify){details.fields=fields; | |
this._notify(ZmEvent.E_MODIFY,details) | |
}if(obj.l!=null&&(!this.parent||(obj.l!=this.parent.id))){var newParent=this._getNewParent(obj.l); | |
if(newParent){details.oldPath=this.getPath(); | |
this.reparent(newParent); | |
this._notify(ZmEvent.E_MOVE,details); | |
obj.l=null | |
}}ZmOrganizer.prototype.notifyModify.apply(this,[obj]) | |
}; | |
ZmFolder.prototype.createQuery=function(c){if(!this.isRemote()&&this.isSystem()){var e=ZmFolder.QUERY_NAME[this.nId]||this.getName(false,null,true,true)||this.name; | |
var a=/^\w+$/.test(e)?"":'"'; | |
return c?e:("in:"+a+e+a) | |
}var g=this.isSystem()?ZmFolder.QUERY_NAME[this.nId]:this.name; | |
var d=this.parent; | |
while(d&&(d.nId!=ZmFolder.ID_ROOT)&&d.name.length){var b=(d.isSystem()&&ZmFolder.QUERY_NAME[d.nId])||d.name; | |
g=b+"/"+g; | |
d=d.parent | |
}g='"'+g+'"'; | |
return c?g:("in:"+g) | |
}; | |
ZmFolder.prototype.getName=function(e,b,d,a){if(this.nId==ZmFolder.ID_DRAFTS||this.nId==ZmFolder.ID_OUTBOX||this.rid==ZmFolder.ID_DRAFTS){var c=(a&&this._systemName)?this._systemName:this.name; | |
if(e&&this.numTotal>0){c=AjxMessageFormat.format(ZmMsg.folderUnread,[c,this.numTotal]); | |
if(!d){c=["<span style='font-weight:bold'>",c,"</span>"].join("") | |
}}return c | |
}else{return ZmOrganizer.prototype.getName.apply(this,arguments) | |
}}; | |
ZmFolder.prototype.getIcon=function(){if(this.nId==ZmOrganizer.ID_ROOT){return null | |
}if(ZmFolder.ICON[this.nId]){return ZmFolder.ICON[this.nId] | |
}if(this.isFeed()){return"RSS" | |
}if(this.isRemote()){return"SharedMailFolder" | |
}if(this.isDataSource(ZmAccount.TYPE_POP)){return"POPAccount" | |
}var a=this.getSystemEquivalentFolderId(); | |
if(a){return ZmFolder.ICON[a]||"Folder" | |
}return"Folder" | |
}; | |
ZmFolder.prototype.getSystemEquivalentFolderId=function(){if(this.parent&&this.parent.isDataSource(ZmAccount.TYPE_IMAP)){return ZmFolder.getIdForName(this.name) | |
}return null | |
}; | |
ZmFolder.prototype.isSystemEquivalent=function(){return this.getSystemEquivalentFolderId()!=null | |
}; | |
ZmFolder.prototype.mayContainFolderFromAccount=function(a){var b=this.getAccount(); | |
if(b==a){return true | |
}return b.isLocal() | |
}; | |
ZmFolder.prototype.mayContain=function(h,k,l){if(!h){return true | |
}if(this.isFeed()){return false | |
}if(this.id==ZmFolder.ID_LOAD_FOLDERS){return false | |
}var j=k||this.type; | |
var d=false; | |
if(h instanceof ZmFolder){d=((h.parent===this&&!l)||this.isChildOf(h)||this.nId==ZmFolder.ID_DRAFTS||this.nId==ZmFolder.ID_SPAM||(!this.isInTrash()&&this.hasChild(h.name)&&!l)||(h.type!==j&&this.nId!=ZmFolder.ID_TRASH)||(h.id===this.id)||(this.disallowSubFolder)||(appCtxt.multiAccounts&&!this.mayContainFolderFromAccount(h.getAccount()))||(this.isRemote()&&!this._remoteMoveOk(h))||(h.isRemote()&&!this._remoteMoveOk(h))) | |
}else{var e=AjxUtil.toArray(h); | |
var m=e[0]; | |
if((this.nId==ZmOrganizer.ID_ROOT&&(h.type!==ZmOrganizer.CALENDAR))||this.nId==ZmOrganizer.ID_OUTBOX||this.nId==ZmOrganizer.ID_SYNC_FAILURES){d=true | |
}else{if(j===ZmOrganizer.SEARCH){d=true | |
}else{if(m&&(m.type===ZmItem.CONTACT)&&m.isGal){d=true | |
}else{if(m&&(m.type===ZmItem.CONV)&&m.list&&m.list.search&&(m.list.search.folderId===this.id)){d=true | |
}else{for(var b=0; | |
b<e.length; | |
b++){var g=e[b]; | |
if(!g){d=true; | |
break | |
}if(Dwt.instanceOf(g,"ZmBriefcaseFolderItem")){if(g.folder&&g.folder.isRemote()&&!g.folder.rid){d=true; | |
break | |
}}else{if(m.type===ZmItem.MSG&&g.isDraft&&(this.nId!=ZmFolder.ID_TRASH&&this.nId!=ZmFolder.ID_DRAFTS&&this.rid!=ZmFolder.ID_DRAFTS)){d=true; | |
break | |
}else{if((this.nId==ZmFolder.ID_DRAFTS||this.rid==ZmFolder.ID_DRAFTS)&&!g.isDraft){d=true; | |
break | |
}}}}if(appCtxt.isOffline&&!d){var f=this.getAccount(); | |
if(f&&m.getAccount()!=f&&(f.type===ZmAccount.TYPE_MSE||f.type===ZmAccount.TYPE_EXCHANGE)){d=true | |
}else{var c=appCtxt.getCurrentSearch(); | |
var a=c&&appCtxt.getById(c.folderId); | |
if(a&&a.nId==ZmOrganizer.ID_SYNC_FAILURES){d=true | |
}}}if(appCtxt.multiAccounts&&this.isRemote()&&h.getAccount&&this.getAccount().id!=h.getAccount().id){d=true | |
}if(!d&&!l){if(m&&m.folderId){d=true; | |
for(var b=0; | |
b<e.length; | |
b++){if(e[b].folderId!=this.id){d=false; | |
break | |
}}}}}}}}if(!d&&this.link){d=this.isReadOnly() | |
}}return !d | |
}; | |
ZmFolder.prototype.isHardDelete=function(){return(this.isInTrash()||this.isInSpam()||(appCtxt.isOffline&&this.isUnder(ZmOrganizer.ID_SYNC_FAILURES))) | |
}; | |
ZmFolder.prototype.isInSpam=function(){return this.isUnder(ZmFolder.ID_SPAM) | |
}; | |
ZmFolder.prototype._remoteMoveOk=function(a){if(!this.isRemote()&&a.isMountpoint&&a.rid){return true | |
}if(!this.link||!a.link||this.getOwner()!==a.getOwner()){return false | |
}if(!this._folderActionOk(this,"isInsert")){return false | |
}return this._folderActionOk(a,"isDelete") | |
}; | |
ZmFolder.prototype._folderActionOk=function(c,b){var a=c.shares&&c.shares[0]; | |
if(!a){return !c.isReadOnly() | |
}return a[b]() | |
}; | |
ZmFolder.prototype.isOutbound=function(){for(var a=0; | |
a<ZmFolder.OUTBOUND.length; | |
a++){if(this.isUnder(ZmFolder.OUTBOUND[a])){return true | |
}}return false | |
}; | |
ZmOrganizer.prototype.setGlobalMarkRead=function(c,d,b,a){if(this.globalMarkRead==c){return | |
}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmSearchFolder")){ZmSearchFolder=function(b){b.type=ZmOrganizer.SEARCH; | |
ZmFolder.call(this,b); | |
if(b.query){var a={query:b.query,types:b.types,checkTypes:true,sortBy:b.sortBy,searchId:b.id,accountName:(b.account&&b.account.name)}; | |
this.search=new ZmSearch(a) | |
}}; | |
ZmSearchFolder.prototype=new ZmFolder; | |
ZmSearchFolder.prototype.constructor=ZmSearchFolder; | |
ZmSearchFolder.prototype.toString=function(){return"ZmSearchFolder" | |
}; | |
ZmSearchFolder.ID_ROOT=ZmOrganizer.ID_ROOT; | |
ZmSearchFolder.create=function(e){e=e||{}; | |
var d=e.search,f={CreateSearchFolderRequest:{_jsns:"urn:zimbraMail"}},c=f.CreateSearchFolderRequest.search={}; | |
c.name=e.name; | |
c.query=d.query; | |
c.l=e.l; | |
if(e.sortBy){c.sortBy=e.sortBy | |
}c.types=ZmSearchFolder._getSearchTypes(d); | |
if(e.rgb){c.rgb=e.rgb | |
}else{if(e.color){var a=ZmOrganizer.getColorValue(e.color,e.type); | |
if(a){c.color=a | |
}}}var b; | |
if(e.isGlobal){c.f="g"; | |
b=appCtxt.accountList.mainAccount.name | |
}return appCtxt.getAppController().sendRequest({jsonObj:f,asyncMode:e.asyncMode!==false,accountName:b,callback:ZmSearchFolder._handleCreate,errorCallback:e.errorCallback||ZmOrganizer._handleErrorCreate.bind(null)}) | |
}; | |
ZmSearchFolder._getSearchTypes=function(e){var b=""; | |
if(e&&e.types){var c=e.types.getArray(); | |
if(c.length){var b=[]; | |
for(var d=0; | |
d<c.length; | |
d++){b.push(ZmSearch.TYPE[c[d]]) | |
}b=b.join(",") | |
}}return b | |
}; | |
ZmSearchFolder._handleCreate=function(a){appCtxt.setStatusMsg(ZmMsg.searchSaved) | |
}; | |
ZmSearchFolder.prototype.setQuery=function(f,h,e,b){if(f===this.search.query){return | |
}var c={callback:h,errorCallback:e,batchCmd:b}; | |
var a="ModifySearchFolderRequest"; | |
var d={_jsns:"urn:zimbraMail",search:{query:f,id:c.id||this.id,types:ZmSearchFolder._getSearchTypes(this.search)}}; | |
var j={}; | |
j[a]=d; | |
var i=this._handleResponseOrganizerAction.bind(this,c); | |
if(c.batchCmd){c.batchCmd.addRequestParams(j,i,c.errorCallback) | |
}else{var g; | |
if(appCtxt.multiAccounts){g=this.account?this.account.name:appCtxt.accountList.mainAccount.name | |
}appCtxt.getAppController().sendRequest({jsonObj:j,asyncMode:true,accountName:g,callback:i,errorCallback:c.errorCallback}) | |
}}; | |
ZmSearchFolder.prototype.getIcon=function(){return(this.nId==ZmOrganizer.ID_ROOT)?null:(this.isOfflineGlobalSearch?"GlobalSearchFolder":"SearchFolder") | |
}; | |
ZmSearchFolder.prototype.getToolTip=function(){}; | |
ZmSearchFolder.prototype._getNewParent=function(b){var a=appCtxt.getById(b); | |
if(a){return a | |
}return appCtxt.getById(b) | |
}; | |
ZmSearchFolder.prototype.notifyModify=function(b){if(b.query&&b.query!==this.search.query&&b.id===this.id){this.search.query=b.query; | |
var a={}; | |
a[ZmOrganizer.F_QUERY]=true; | |
this._notify(ZmEvent.E_MODIFY,{fields:a}); | |
b.query=null | |
}ZmFolder.prototype.notifyModify.apply(this,[b]) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmSearch")){ZmSearch=function(f){f=f||{}; | |
for(var b in f){this[b]=f[b] | |
}this.galType=this.galType||ZmSearch.GAL_ACCOUNT; | |
this.join=this.join||ZmSearch.JOIN_AND; | |
if(this.query||this.queryHint){if(!this.isGalSearch&&!this.isAutocompleteSearch&&!this.isGalAutocompleteSearch&&!this.isCalResSearch){var c=this.parsedQuery=new ZmParsedQuery(this.query||this.queryHint); | |
this._setProperties(); | |
var a=c.getTerm("sort"); | |
if(a){this.sortBy=a.arg | |
}}}this.isGalSearch=false; | |
this.isCalResSearch=false; | |
if(ZmSearch._mailEnabled==null){ZmSearch._mailEnabled=appCtxt.get(ZmSetting.MAIL_ENABLED); | |
if(ZmSearch._mailEnabled){AjxDispatcher.require("MailCore") | |
}}if(f.checkTypes){var h=AjxUtil.toArray(this.types); | |
var e=[]; | |
for(var g=0; | |
g<h.length; | |
g++){var j=h[g]; | |
var d=ZmItem.APP[j]; | |
if(appCtxt.get(ZmApp.SETTING[d])){e.push(j) | |
}}this.types=AjxVector.fromArray(e) | |
}}; | |
ZmSearch.prototype.isZmSearch=true; | |
ZmSearch.prototype.toString=function(){return"ZmSearch" | |
}; | |
ZmSearch.TYPE={}; | |
ZmSearch.TYPE_ANY="any"; | |
ZmSearch.GAL_ACCOUNT="account"; | |
ZmSearch.GAL_RESOURCE="resource"; | |
ZmSearch.GAL_ALL=""; | |
ZmSearch.JOIN_AND=1; | |
ZmSearch.JOIN_OR=2; | |
ZmSearch.TYPE_MAP={}; | |
ZmSearch.DEFAULT_LIMIT=DwtListView.DEFAULT_LIMIT; | |
ZmSearch.DATE_DESC="dateDesc"; | |
ZmSearch.DATE_ASC="dateAsc"; | |
ZmSearch.SUBJ_DESC="subjDesc"; | |
ZmSearch.SUBJ_ASC="subjAsc"; | |
ZmSearch.NAME_DESC="nameDesc"; | |
ZmSearch.NAME_ASC="nameAsc"; | |
ZmSearch.SIZE_DESC="sizeDesc"; | |
ZmSearch.SIZE_ASC="sizeAsc"; | |
ZmSearch.RCPT_ASC="rcptAsc"; | |
ZmSearch.RCPT_DESC="rcptDesc"; | |
ZmSearch.ATTACH_ASC="attachAsc"; | |
ZmSearch.ATTACH_DESC="attachDesc"; | |
ZmSearch.FLAG_ASC="flagAsc"; | |
ZmSearch.FLAG_DESC="flagDesc"; | |
ZmSearch.MUTE_ASC="muteAsc"; | |
ZmSearch.MUTE_DESC="muteDesc"; | |
ZmSearch.READ_ASC="readAsc"; | |
ZmSearch.READ_DESC="readDesc"; | |
ZmSearch.PRIORITY_ASC="priorityAsc"; | |
ZmSearch.PRIORITY_DESC="priorityDesc"; | |
ZmSearch.SCORE_DESC="scoreDesc"; | |
ZmSearch.DURATION_DESC="durDesc"; | |
ZmSearch.DURATION_ASC="durAsc"; | |
ZmSearch.STATUS_DESC="taskStatusDesc"; | |
ZmSearch.STATUS_ASC="taskStatusAsc"; | |
ZmSearch.PCOMPLETE_DESC="taskPercCompletedDesc"; | |
ZmSearch.PCOMPLETE_ASC="taskPercCompletedAsc"; | |
ZmSearch.DUE_DATE_DESC="taskDueDesc"; | |
ZmSearch.DUE_DATE_ASC="taskDueAsc"; | |
ZmSearch.prototype.execute=function(a){if(a.batchCmd||this.soapInfo){return this._executeSoap(a) | |
}else{return this._executeJson(a) | |
}}; | |
ZmSearch.prototype._executeSoap=function(e){this.isGalSearch=(this.contactSource&&(this.contactSource==ZmId.SEARCH_GAL)); | |
this.isCalResSearch=(!this.contactSource&&this.conds!=null); | |
if(appCtxt.isOffline&&this.isCalResSearch){this.isCalResSearch=appCtxt.isZDOnline() | |
}if(this.isEmpty){this._handleResponseExecute(e.callback); | |
return null | |
}var n; | |
if(!this.response){if(this.isGalSearch){n=AjxSoapDoc.create("SearchGalRequest","urn:zimbraAccount"); | |
var b=n.getMethod(); | |
if(this.galType){b.setAttribute("type",this.galType) | |
}n.set("name",this.query); | |
var h=n.set("searchFilter"); | |
if(this.conds&&this.conds.length){var g=n.set("conds",null,h); | |
this._applySoapCond(this.conds,n,g) | |
}}else{if(this.isAutocompleteSearch){n=AjxSoapDoc.create("AutoCompleteRequest","urn:zimbraMail"); | |
var b=n.getMethod(); | |
if(this.limit){b.setAttribute("limit",this.limit) | |
}n.set("name",this.query) | |
}else{if(this.isGalAutocompleteSearch){n=AjxSoapDoc.create("AutoCompleteGalRequest","urn:zimbraAccount"); | |
var b=n.getMethod(); | |
b.setAttribute("limit",this._getLimit()); | |
if(this.galType){b.setAttribute("type",this.galType) | |
}n.set("name",this.query) | |
}else{if(this.isCalResSearch){n=AjxSoapDoc.create("SearchCalendarResourcesRequest","urn:zimbraAccount"); | |
var b=n.getMethod(); | |
if(this.attrs){var o=[].concat(this.attrs); | |
AjxUtil.arrayRemove(o,"fullName"); | |
b.setAttribute("attrs",o.join(",")) | |
}var h=n.set("searchFilter"); | |
if(this.conds&&this.conds.length){var g=n.set("conds",null,h); | |
this._applySoapCond(this.conds,n,g) | |
}}else{if(this.soapInfo){n=AjxSoapDoc.create(this.soapInfo.method,this.soapInfo.namespace); | |
for(var m in this.soapInfo.additional){var d=n.set(m); | |
var o=this.soapInfo.additional[m]; | |
for(var j in o){d.setAttribute(j,o[j]) | |
}}}else{n=AjxSoapDoc.create("SearchRequest","urn:zimbraMail") | |
}var b=this._getStandardMethod(n); | |
if(this.types){var l=this.types.getArray(); | |
if(l.length){var k=[]; | |
for(var f=0; | |
f<l.length; | |
f++){k.push(ZmSearch.TYPE[l[f]]) | |
}b.setAttribute("types",k.join(",")); | |
if(this.types.contains(ZmItem.MSG)||this.types.contains(ZmItem.CONV)){var c=this.folderId&&appCtxt.getById(this.folderId); | |
b.setAttribute("recip",(c&&c.isOutbound())?"1":"0") | |
}if(this.types.contains(ZmItem.CONV)){b.setAttribute("fullConversation",1) | |
}if(this.fetch){b.setAttribute("fetch",(this.fetch=="all")?"all":"1"); | |
if(this.getHtml){b.setAttribute("html","1") | |
}}if(this.markRead){b.setAttribute("read","1") | |
}}}if(this.inDumpster){b.setAttribute("inDumpster","1") | |
}}}}}}var p=this._getStandardMethod(n); | |
p.setAttribute("needExp",1); | |
var q=this._handleResponseExecute.bind(this,e.callback); | |
if(e.batchCmd){e.batchCmd.addRequestParams(n,q) | |
}else{return appCtxt.getAppController().sendRequest({soapDoc:n,asyncMode:true,callback:q,errorCallback:e.errorCallback,timeout:e.timeout,noBusyOverlay:e.noBusyOverlay,response:this.response}) | |
}}; | |
ZmSearch.prototype._executeJson=function(d){this.isGalSearch=(this.contactSource&&(this.contactSource==ZmId.SEARCH_GAL)); | |
this.isCalResSearch=(!this.contactSource&&this.conds!=null); | |
if(appCtxt.isOffline&&this.isCalResSearch){this.isCalResSearch=appCtxt.isZDOnline() | |
}if(this.isEmpty){this._handleResponseExecute(d.callback); | |
return null | |
}var q,e,l; | |
if(!this.response){if(this.isGalSearch){e={_jsns:"urn:zimbraAccount",needIsOwner:"1",needIsMember:"directOnly"}; | |
q={SearchGalRequest:e}; | |
if(this.galType){e.type=this.galType | |
}e.name=this.query; | |
e.offset=this.offset=(this.offset||0); | |
e.limit=this._getLimit(); | |
e.locale={_content:AjxEnv.DEFAULT_LOCALE}; | |
if(this.lastId){e.cursor={id:this.lastId,sortVal:(this.lastSortVal||"")} | |
}if(this.sortBy){e.sortBy=this.sortBy | |
}if(this.conds&&this.conds.length){e.searchFilter={conds:{}}; | |
e.searchFilter.conds=ZmSearch.prototype._applyJsonCond(this.conds,e) | |
}}else{if(this.isAutocompleteSearch){q={AutoCompleteRequest:{_jsns:"urn:zimbraMail"}}; | |
e=q.AutoCompleteRequest; | |
if(this.limit){e.limit=this.limit | |
}e.name={_content:this.query}; | |
if(d.autocompleteType){e.t=d.autocompleteType | |
}}else{if(this.isGalAutocompleteSearch){q={AutoCompleteGalRequest:{_jsns:"urn:zimbraAccount"}}; | |
e=q.AutoCompleteGalRequest; | |
e.limit=this._getLimit(); | |
e.name=this.query; | |
if(this.galType){e.type=this.galType | |
}}else{if(this.isCalResSearch){q={SearchCalendarResourcesRequest:{_jsns:"urn:zimbraAccount"}}; | |
e=q.SearchCalendarResourcesRequest; | |
if(this.attrs){var o=[].concat(this.attrs); | |
e.attrs=o.join(",") | |
}e.offset=this.offset=(this.offset||0); | |
e.limit=this._getLimit(); | |
if(this.conds&&this.conds.length){e.searchFilter={conds:{}}; | |
e.searchFilter.conds=ZmSearch.prototype._applyJsonCond(this.conds,e) | |
}}else{if(this.soapInfo){l=AjxSoapDoc.create(this.soapInfo.method,this.soapInfo.namespace); | |
for(var k in this.soapInfo.additional){var c=l.set(k); | |
var o=this.soapInfo.additional[k]; | |
for(var g in o){c.setAttribute(g,o[g]) | |
}}}else{q={SearchRequest:{_jsns:"urn:zimbraMail"}}; | |
e=q.SearchRequest | |
}this._getStandardMethodJson(e); | |
if(this.types){var j=this.types.getArray(); | |
if(j.length){var h=[]; | |
for(var f=0; | |
f<j.length; | |
f++){h.push(ZmSearch.TYPE[j[f]]) | |
}e.types=h.join(","); | |
if(this.types.contains(ZmItem.MSG)||this.types.contains(ZmItem.CONV)){var b=this.folderId&&appCtxt.getById(this.folderId); | |
e.recip=(b&&b.isOutbound())?"2":"0" | |
}if(this.types.contains(ZmItem.CONV)){e.fullConversation=1 | |
}if(this.fetch){e.fetch=(this.fetch=="all")?"all":1; | |
if(this.getHtml){e.html=1 | |
}}if(this.markRead){e.read=1 | |
}if(this.headers){for(var n in this.headers){if(!e.header){e.header=[] | |
}e.header.push({n:this.headers[n]}) | |
}}if(j.length==1&&j[0]==ZmItem.TASK&&this.allowableTaskStatus){e.allowableTaskStatus=this.allowableTaskStatus | |
}}}if(this.inDumpster){e.inDumpster=1 | |
}}}}}}if(e){e.needExp=1 | |
}var p=this._handleResponseExecute.bind(this,d.callback); | |
if(d.batchCmd){d.batchCmd.addRequestParams(l,p) | |
}else{var m={jsonObj:q,soapDoc:l,asyncMode:true,callback:p,errorCallback:d.errorCallback,offlineCallback:d.offlineCallback,timeout:d.timeout,offlineCache:d.offlineCache,noBusyOverlay:d.noBusyOverlay,response:this.response,accountName:this.accountName,offlineRequest:d.offlineRequest}; | |
return appCtxt.getAppController().sendRequest(m) | |
}}; | |
ZmSearch.prototype._applySoapCond=function(k,j,g,e){if(e||this.join==ZmSearch.JOIN_OR){g.setAttribute("or",1) | |
}for(var f=0; | |
f<k.length; | |
f++){var h=k[f]; | |
if(AjxUtil.isArray(h)){var d=j.set("conds",null,g); | |
this._applySoapCond(h,j,d,true) | |
}else{if(h.attr=="fullName"&&h.op=="has"){var b=j.set("name",h.value) | |
}else{var a=j.set("cond",null,g); | |
a.setAttribute("attr",h.attr); | |
a.setAttribute("op",h.op); | |
a.setAttribute("value",h.value) | |
}}}}; | |
ZmSearch.prototype._applyJsonCond=function(a,d,e){var g={}; | |
if(e||this.join==ZmSearch.JOIN_OR){g.or=1 | |
}for(var b=0; | |
b<a.length; | |
b++){var f=a[b]; | |
if(AjxUtil.isArray(f)){if(!g.conds){g.conds=[] | |
}g.conds.push(this._applyJsonCond(f,d,true)) | |
}else{if(f.attr=="fullName"&&f.op=="has"){d.name={_content:f.value} | |
}else{if(!g.cond){g.cond=[] | |
}g.cond.push({attr:f.attr,op:f.op,value:f.value}) | |
}}}return g | |
}; | |
ZmSearch.prototype._handleResponseExecute=function(d,b){if(b){var c=b.getResponse(); | |
if(this.isGalSearch){c=c.SearchGalResponse | |
}else{if(this.isCalResSearch){c=c.SearchCalendarResourcesResponse | |
}else{if(this.isAutocompleteSearch){c=c.AutoCompleteResponse | |
}else{if(this.isGalAutocompleteSearch){c=c.AutoCompleteGalResponse | |
}else{if(this.soapInfo){c=c[this.soapInfo.response] | |
}else{c=c.SearchResponse | |
}}}}}}else{c={_jsns:"urn:zimbraMail",more:false} | |
}var a=new ZmSearchResult(this); | |
a.set(c); | |
b=b||new ZmCsfeResult(); | |
b.set(a); | |
if(d){d.run(b) | |
}}; | |
ZmSearch.prototype.getConv=function(c){if((!this.query&&!this.queryHint)||!c.cid){return | |
}var d={SearchConvRequest:{_jsns:"urn:zimbraMail"}}; | |
var a=d.SearchConvRequest; | |
this._getStandardMethodJson(a); | |
a.cid=c.cid; | |
if(c.fetch){a.fetch=c.fetch; | |
if(c.markRead){a.read=1 | |
}if(this.getHtml){a.html=1 | |
}if(c.needExp!==false){a.needExp=1 | |
}}if(!c.noTruncate){a.max=appCtxt.get(ZmSetting.MAX_MESSAGE_SIZE) | |
}a.recip="2"; | |
var b={jsonObj:d,asyncMode:true,callback:this._handleResponseGetConv.bind(this,c.callback),accountName:this.accountName}; | |
appCtxt.getAppController().sendRequest(b) | |
}; | |
ZmSearch.prototype._handleResponseGetConv=function(d,b){var c=b.getResponse().SearchConvResponse; | |
var a=new ZmSearchResult(this); | |
a.set(c,null,true); | |
b.set(a); | |
if(d){d.run(b) | |
}}; | |
ZmSearch.prototype.clearCursor=function(){this.lastId=this.lastSortVal=this.endSortVal=null | |
}; | |
ZmSearch.prototype.getTitle=function(){var c; | |
var a=this.parsedQuery; | |
var b=this.searchId||((a&&(a.getNumTokens()==1))?this.folderId||this.tagId:null); | |
if(b){var d=appCtxt.getById(ZmOrganizer.getSystemId(b)); | |
if(d){c=d.getName(true,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH,true) | |
}}return c?([ZmMsg.zimbraTitle,c].join(": ")):([ZmMsg.zimbraTitle,ZmMsg.searchResults].join(": ")) | |
}; | |
ZmSearch.prototype.isMultiAccount=function(){if(!this._isMultiAccount){this._isMultiAccount=(this.queryHint&&this.queryHint.length>0&&(this.queryHint.split("inid:").length>1||this.queryHint.split("underid:").length>1)) | |
}return this._isMultiAccount | |
}; | |
ZmSearch.prototype._getStandardMethod=function(a){var d=a.getMethod(); | |
if(this.sortBy){d.setAttribute("sortBy",this.sortBy) | |
}if(this.types.contains(ZmItem.MSG)||this.types.contains(ZmItem.CONV)){ZmMailMsg.addRequestHeaders(a) | |
}ZmTimezone.set(a,AjxTimezone.DEFAULT,null); | |
a.set("locale",appCtxt.get(ZmSetting.LOCALE_NAME),null); | |
if(this.lastId!=null&&this.lastSortVal){var c=a.set("cursor"); | |
c.setAttribute("id",this.lastId); | |
c.setAttribute("sortVal",this.lastSortVal); | |
if(this.endSortVal){c.setAttribute("endSortVal",this.endSortVal) | |
}}this.offset=this.offset||0; | |
d.setAttribute("offset",this.offset); | |
d.setAttribute("limit",this._getLimit()); | |
var b=this._getQuery(); | |
a.set("query",b); | |
if(this.field){d.setAttribute("field",this.field) | |
}return d | |
}; | |
ZmSearch.prototype._getStandardMethodJson=function(a){if(this.sortBy){a.sortBy=this.sortBy | |
}if(this.types.contains(ZmItem.MSG)||this.types.contains(ZmItem.CONV)){ZmMailMsg.addRequestHeaders(a) | |
}ZmTimezone.set(a,AjxTimezone.DEFAULT); | |
a.locale={_content:AjxEnv.DEFAULT_LOCALE}; | |
if(this.lastId!=null&&this.lastSortVal){a.cursor={id:this.lastId,sortVal:this.lastSortVal}; | |
if(this.endSortVal){a.cursor.endSortVal=this.endSortVal | |
}}a.offset=this.offset=this.offset||0; | |
a.limit=this._getLimit(); | |
if(this.idsOnly){a.resultMode="IDS" | |
}a.query=this._getQuery(); | |
if(this.field){a.field=this.field | |
}}; | |
ZmSearch.prototype._getQuery=function(){if(this.queryHint){var a=this.query?["(",this.query,") "].join(""):""; | |
return[a,"(",this.queryHint,")"].join("") | |
}return this.query | |
}; | |
ZmSearch.prototype._getLimit=function(){if(this.limit){return this.limit | |
}var a; | |
if(this.isGalAutocompleteSearch){a=appCtxt.get(ZmSetting.AUTOCOMPLETE_LIMIT) | |
}else{var b=this.types&&this.types.get(0); | |
var c=appCtxt.getApp(ZmItem.APP[b])||appCtxt.getCurrentApp(); | |
if(c&&c.getLimit){a=c.getLimit(this.offset) | |
}else{a=appCtxt.get(ZmSetting.PAGE_SIZE)||ZmSearch.DEFAULT_LIMIT | |
}}this.limit=a; | |
return a | |
}; | |
ZmSearch.prototype.matches=function(a){if(!this.parsedQuery){return null | |
}if(this.folderId&&!this.parsedQuery.hasOrTerm){if(a.type===ZmItem.CONV){if(a.folders&&!a.folders[this.folderId]){return false | |
}}else{if(a.folderId&&a.folderId!==this.folderId){return false | |
}}}var b=this.parsedQuery.getMatchFunction(); | |
return b?b(a):null | |
}; | |
ZmSearch.prototype.hasFolderTerm=function(a){return this.parsedQuery&&this.parsedQuery.hasTerm(["in","under"],a) | |
}; | |
ZmSearch.prototype.replaceFolderTerm=function(c,a){if(!this.parsedQuery){return this.query | |
}var b=this.parsedQuery.replaceTerm(["in","under"],c,a); | |
if(b){this.query=b | |
}return Boolean(b) | |
}; | |
ZmSearch.prototype.hasTagTerm=function(a){return this.parsedQuery&&this.parsedQuery.hasTerm("tag",a) | |
}; | |
ZmSearch.prototype.replaceTagTerm=function(b,a){if(!this.parsedQuery){return this.query | |
}var c=this.parsedQuery.replaceTerm("tag",b,a); | |
if(c){this.query=c | |
}return Boolean(c) | |
}; | |
ZmSearch.prototype.hasUnreadTerm=function(){return(this.parsedQuery&&(this.parsedQuery.hasTerm("is","read")||this.parsedQuery.hasTerm("is","unread"))) | |
}; | |
ZmSearch.prototype.isAnywhere=function(){return(this.parsedQuery&&this.parsedQuery.hasTerm("is","anywhere")) | |
}; | |
ZmSearch.prototype.hasContentTerm=function(){return(this.parsedQuery&&this.parsedQuery.hasTerm("content")) | |
}; | |
ZmSearch.prototype.isSimple=function(){var a=this.parsedQuery; | |
if(a&&(a.getNumTokens()==1)){return a.hasTerm(["in","inid","tag"]) | |
}return false | |
}; | |
ZmSearch.prototype.getTokens=function(){return this.parsedQuery&&this.parsedQuery.getTokens() | |
}; | |
ZmSearch.prototype._setProperties=function(){var b=this.parsedQuery&&this.parsedQuery.getProperties(); | |
for(var a in b){this[a]=b[a] | |
}}; | |
ZmParsedQuery=function(a){this.hasOrTerm=false; | |
this._tokens=this._parse(AjxStringUtil.trim(a,true)); | |
if(!ZmParsedQuery.IS_VALUE_PRECONDITION){ZmParsedQuery.IS_VALUE_PRECONDITION={}; | |
ZmParsedQuery.IS_VALUE_PRECONDITION.flagged=ZmSetting.FLAGGING_ENABLED; | |
ZmParsedQuery.IS_VALUE_PRECONDITION.unflagged=ZmSetting.FLAGGING_ENABLED | |
}}; | |
ZmParsedQuery.prototype.isZmParsedQuery=true; | |
ZmParsedQuery.prototype.toString=function(){return"ZmParsedQuery" | |
}; | |
ZmParsedQuery.TERM="TERM"; | |
ZmParsedQuery.COND="COND"; | |
ZmParsedQuery.GROUP="GROUP"; | |
ZmParsedQuery.OP_CONTENT="content"; | |
ZmParsedQuery.OP_LIST=["content","subject","msgid","envto","envfrom","contact","to","from","cc","tofrom","tocc","fromcc","tofromcc","in","under","inid","underid","has","filename","type","attachment","is","date","mdate","day","week","month","year","after","before","size","bigger","larger","smaller","tag","priority","message","my","modseq","conv","conv-count","conv-minm","conv-maxm","conv-start","conv-end","appt-start","appt-end","author","title","keywords","company","metadata","item","sort"]; | |
ZmParsedQuery.IS_OP=AjxUtil.arrayAsHash(ZmParsedQuery.OP_LIST); | |
ZmParsedQuery.IS_VALUES=["unread","read","flagged","unflagged","draft","sent","received","replied","unreplied","forwarded","unforwarded","invite","solo","tome","fromme","ccme","tofromme","toccme","fromccme","tofromccme","local","remote","anywhere"]; | |
ZmParsedQuery.MULTIPLE={}; | |
ZmParsedQuery.MULTIPLE.to=true; | |
ZmParsedQuery.MULTIPLE.is=true; | |
ZmParsedQuery.MULTIPLE.has=true; | |
ZmParsedQuery.MULTIPLE.tag=true; | |
ZmParsedQuery.MULTIPLE["appt-start"]=true; | |
ZmParsedQuery.MULTIPLE["appt-end"]=true; | |
ZmParsedQuery.MULTIPLE.type=true; | |
ZmParsedQuery.isMultiple=function(a){return Boolean(a&&ZmParsedQuery.MULTIPLE[a.op]) | |
}; | |
ZmParsedQuery.EXCLUDE={}; | |
ZmParsedQuery.EXCLUDE.before=["date"]; | |
ZmParsedQuery.EXCLUDE.after=["date"]; | |
ZmParsedQuery.EXCLUDE.is={}; | |
ZmParsedQuery.EXCLUDE.is["read"]=["unread"]; | |
ZmParsedQuery.EXCLUDE.is["flagged"]=["unflagged"]; | |
ZmParsedQuery.EXCLUDE.is["sent"]=["received"]; | |
ZmParsedQuery.EXCLUDE.is["replied"]=["unreplied"]; | |
ZmParsedQuery.EXCLUDE.is["forwarded"]=["unforwarded"]; | |
ZmParsedQuery.EXCLUDE.is["local"]=["remote","anywhere"]; | |
ZmParsedQuery.EXCLUDE.is["tome"]=["tofromme","toccme","tofromccme"]; | |
ZmParsedQuery.EXCLUDE.is["fromme"]=["tofromme","fromccme","tofromccme"]; | |
ZmParsedQuery.EXCLUDE.is["ccme"]=["toccme","fromccme","tofromccme"]; | |
ZmParsedQuery._createExcludeMap=function(f){var c={}; | |
for(var b in f){var e=f[b]; | |
if(AjxUtil.isArray1(e)){e.push(b); | |
ZmParsedQuery._permuteExcludeMap(c,e) | |
}else{for(var d in e){var a=f[b][d]; | |
a.push(d); | |
ZmParsedQuery._permuteExcludeMap(c,AjxUtil.map(a,function(g){return new ZmSearchToken(b,g).toString() | |
})) | |
}}}return c | |
}; | |
ZmParsedQuery._permuteExcludeMap=function(g,h){if(h.length<2){return | |
}for(var f=0; | |
f<h.length-1; | |
f++){var d=h[f]; | |
for(var e=f+1; | |
e<h.length; | |
e++){var c=h[e]; | |
g[d]=g[d]||{}; | |
g[c]=g[c]||{}; | |
g[d][c]=true; | |
g[c][d]=true | |
}}}; | |
ZmParsedQuery.areExclusive=function(d,b){if(!d||!b){return false | |
}var f=ZmParsedQuery.EXCLUDE_MAP; | |
if(!f){f=ZmParsedQuery.EXCLUDE_MAP=ZmParsedQuery._createExcludeMap(ZmParsedQuery.EXCLUDE) | |
}var a=d.op,g=b.op; | |
var e=d.toString(),c=b.toString(); | |
return Boolean((f[a]&&f[a][g])||(f[g]&&f[g][a])||(f[e]&&f[e][c])||(f[c]&&f[c][e])) | |
}; | |
ZmParsedQuery.COND_AND="and"; | |
ZmParsedQuery.COND_OR="or"; | |
ZmParsedQuery.COND_NOT="not"; | |
ZmParsedQuery.GROUP_OPEN="("; | |
ZmParsedQuery.GROUP_CLOSE=")"; | |
ZmParsedQuery.COND_OP={}; | |
ZmParsedQuery.COND_OP[ZmParsedQuery.COND_AND]=" && "; | |
ZmParsedQuery.COND_OP[ZmParsedQuery.COND_OR]=" || "; | |
ZmParsedQuery.COND_OP[ZmParsedQuery.COND_NOT]=" !"; | |
ZmParsedQuery.EOW_LIST=[" ",":",ZmParsedQuery.GROUP_OPEN,ZmParsedQuery.GROUP_CLOSE]; | |
ZmParsedQuery.IS_EOW=AjxUtil.arrayAsHash(ZmParsedQuery.EOW_LIST); | |
ZmParsedQuery.FLAG={}; | |
ZmParsedQuery.FLAG.unread="item.isUnread"; | |
ZmParsedQuery.FLAG.read="!item.isUnread"; | |
ZmParsedQuery.FLAG.flagged="item.isFlagged"; | |
ZmParsedQuery.FLAG.unflagged="!item.isFlagged"; | |
ZmParsedQuery.FLAG.forwarded="item.isForwarded"; | |
ZmParsedQuery.FLAG.unforwarded="!item.isForwarded"; | |
ZmParsedQuery.FLAG.sent="item.isSent"; | |
ZmParsedQuery.FLAG.draft="item.isDraft"; | |
ZmParsedQuery.FLAG.replied="item.isReplied"; | |
ZmParsedQuery.FLAG.unreplied="!item.isReplied"; | |
ZmParsedQuery.prototype._parse=function(a){function c(y,z,x){var x=x||y.charAt(z); | |
z++; | |
var u=false,w,v=""; | |
while(z<y.length&&!u){w=y.charAt(z); | |
if(w==x){u=true | |
}else{v+=w; | |
z++ | |
}}return u?{str:v,pos:z+1}:null | |
}function f(u,v){while(v<u.length&&u.charAt(v)==" "){v++ | |
}return v | |
}function e(v,u){this.parseFailed=v; | |
return k | |
}var p=a.length; | |
var k=[],j,t,i,q="",g=false,m=true,s=0,o=0; | |
var d=f(a,0); | |
while(d<p){t=(j!=" ")?j:t; | |
j=a.charAt(d); | |
g=ZmParsedQuery.IS_EOW[j]; | |
if(j==":"){if(ZmParsedQuery.IS_OP[q]){i=q | |
}else{return e("unrecognized op '"+q+"'",a) | |
}q=""; | |
d=f(a,d+1); | |
continue | |
}if(g){var h=q.toLowerCase(); | |
var b=!!ZmParsedQuery.COND_OP[h]; | |
if(i&&q&&!(b&&s>0)){k.push(new ZmSearchToken(i,h)); | |
if(s==0){i="" | |
}q=""; | |
m=true | |
}else{if(!i||(i&&s>0)){if(b){k.push(new ZmSearchToken(h)); | |
m=false; | |
if(h==ZmParsedQuery.COND_OR){this.hasOrTerm=true | |
}}else{if(q){k.push(new ZmSearchToken(ZmParsedQuery.OP_CONTENT,q)) | |
}}q="" | |
}}}if(j=='"'){var n=c(a,d); | |
if(n){q=n.str; | |
d=n.pos | |
}else{return e("improper use of quotes",a) | |
}}else{if(j==ZmParsedQuery.GROUP_OPEN){var l=false; | |
if(s>0){s++ | |
}else{if(t==":"){s=1; | |
var r=a.substr(d,a.indexOf(ZmParsedQuery.GROUP_CLOSE,d+1)); | |
r=r&&r.toLowerCase(); | |
if(r&&(r.indexOf(" "+ZmParsedQuery.COND_OR+" ")==-1)&&(r.indexOf(" "+ZmParsedQuery.COND_AND+" ")==-1)){var n=c(a,d,ZmParsedQuery.GROUP_CLOSE); | |
if(n){q=n.str; | |
d=n.pos; | |
s=0 | |
}else{return e("improper use of paren-based quoting",a) | |
}l=true | |
}}}if(!l){k.push(new ZmSearchToken(j)); | |
o++ | |
}d=f(a,d+1) | |
}else{if(j==ZmParsedQuery.GROUP_CLOSE){if(s>0){s-- | |
}if(s==0){i="" | |
}k.push(new ZmSearchToken(j)); | |
d=f(a,d+1) | |
}else{if(j=="-"&&!q&&!i){k.push(new ZmSearchToken(ZmParsedQuery.COND_NOT)); | |
d=f(a,d+1); | |
m=false | |
}else{if(j!=" "){q+=j | |
}d++ | |
}}}}}if((d>=a.length)&&i&&q){k.push(new ZmSearchToken(i,q)); | |
m=true | |
}else{if(!i&&q){k.push(new ZmSearchToken(q)) | |
}}if(k.length>=3&&o==1&&k[0].op==ZmParsedQuery.GROUP_OPEN&&k[k.length-1].op==ZmParsedQuery.GROUP_CLOSE){k.shift(); | |
k.pop() | |
}if(!m){return e("unexpected end of query",a) | |
}return k | |
}; | |
ZmParsedQuery.prototype.getTokens=function(){return this._tokens | |
}; | |
ZmParsedQuery.prototype.getNumTokens=function(){return this._tokens?this._tokens.length:0 | |
}; | |
ZmParsedQuery.prototype.getProperties=function(){var d={}; | |
for(var c=0,a=this._tokens.length; | |
c<a; | |
c++){var b=this._tokens[c]; | |
if(b.type==ZmParsedQuery.TERM){var e=c>0?this._tokens[c-1]:null; | |
if(!((e&&e.op==ZmParsedQuery.COND_NOT)||this.hasOrTerm)){if((b.op=="in"||b.op=="inid")){this.folderId=d.folderId=(b.op=="in")?this._getFolderId(b.arg):b.arg | |
}else{if(b.op=="tag"){this.tagId=d.tagId=this._getTagId(b.arg,true) | |
}}}}}return d | |
}; | |
ZmParsedQuery.prototype.getMatchFunction=function(){if(this._matchFunction){return this._matchFunction | |
}if(this.parseFailed||this.hasTerm(ZmParsedQuery.OP_CONTENT)){return null | |
}var a,d; | |
var c=["return Boolean("]; | |
for(var e=0,g=this._tokens.length; | |
e<g; | |
e++){var k=this._tokens[e]; | |
if(k.type===ZmParsedQuery.TERM){if(k.op==="in"||k.op==="inid"){a=(k.op==="in")?this._getFolderId(k.arg):k.arg; | |
if(a){c.push("((item.type === ZmItem.CONV) ? item.folders && item.folders['"+a+"'] : item.folderId === '"+a+"')") | |
}}else{if(k.op==="tag"){d=this._getTagId(k.arg,true); | |
if(d){c.push("item.hasTag('"+k.arg+"')") | |
}}else{if(k.op==="is"){var j=ZmParsedQuery.FLAG[k.arg]; | |
if(j){c.push(j) | |
}}else{if(k.op==="has"&&k.arg==="attachment"){c.push("item.hasAttach") | |
}else{return null | |
}}}}var f=this._tokens[e+1]; | |
if(f&&(f.type==ZmParsedQuery.TERM||f==ZmParsedQuery.COND_OP[ZmParsedQuery.COND_NOT]||f==ZmParsedQuery.GROUP_CLOSE)){c.push(ZmParsedQuery.COND_OP[ZmParsedQuery.COND_AND]) | |
}}else{if(k.type===ZmParsedQuery.COND){c.push(ZmParsedQuery.COND_OP[k.op]) | |
}else{if(k.type===ZmParsedQuery.GROUP){c.push(k.op) | |
}}}}c.push(")"); | |
var b=(appCtxt.multiAccounts&&this.isMultiAccount()&&!this.query&&this.queryHint); | |
if(!this.hasOrTerm||b){this.folderId=a; | |
this.tagId=d | |
}try{this._matchFunction=new Function("item",c.join("")) | |
}catch(h){}return this._matchFunction | |
}; | |
ZmParsedQuery.prototype.createQuery=function(){var c=[]; | |
for(var b=0,a=this._tokens.length; | |
b<a; | |
b++){c.push(this._tokens[b].toString()) | |
}return c.join(" ") | |
}; | |
ZmParsedQuery.prototype._getFolderId=function(g){var a=ZmFolder.QUERY_ID[g]; | |
var b=this.accountName; | |
if(!b){var f=appCtxt.getActiveAccount(); | |
b=f?f.name:appCtxt.accountList.mainAccount | |
}if(!a){var e=b&&appCtxt.accountList.getAccountByName(b); | |
var c=appCtxt.getFolderTree(e); | |
var d=c?c.getByPath(g,true):null; | |
if(d){a=d.id | |
}}if(b){a=ZmOrganizer.getSystemId(a,appCtxt.accountList.getAccountByName(b)) | |
}return a | |
}; | |
ZmParsedQuery.prototype._getTagId=function(c,d){var b=appCtxt.getTagTree(); | |
if(b){var a=b.getByName(c.toLowerCase()); | |
if(a){return d?a.nId:a.id | |
}}return null | |
}; | |
ZmParsedQuery.prototype.getTerm=function(f,h){var g=AjxUtil.arrayAsHash(f); | |
var b=h&&h.toLowerCase(); | |
for(var d=0,a=this._tokens.length; | |
d<a; | |
d++){var c=this._tokens[d]; | |
var e=c.arg&&c.arg.toLowerCase(); | |
if(c.type==ZmParsedQuery.TERM&&g[c.op]&&(!h||e==b)){return c | |
}}return null | |
}; | |
ZmParsedQuery.prototype.hasTerm=function(a,b){return Boolean(this.getTerm(a,b)) | |
}; | |
ZmParsedQuery.prototype.replaceTerm=function(d,a,c){var f=a&&a.toLowerCase(); | |
var b=AjxUtil.arrayAsHash(d); | |
if(a&&c){for(var e=0,g=this._tokens.length; | |
e<g; | |
e++){var j=this._tokens[e]; | |
var h=j.arg&&j.arg.toLowerCase(); | |
if(j.type==ZmParsedQuery.TERM&&b[j.op]&&(h==f)){j.arg=c; | |
return this.createQuery() | |
}}}return"" | |
}; | |
ZmSearchToken=function(c,a){if(c&&arguments.length==1){var b=c.split(":"); | |
c=b[0]; | |
a=b[1] | |
}this.op=c; | |
this.arg=a; | |
if(ZmParsedQuery.IS_OP[c]&&a){this.type=ZmParsedQuery.TERM | |
}else{if(c&&ZmParsedQuery.COND_OP[c.toLowerCase()]){this.type=ZmParsedQuery.COND; | |
this.op=c.toLowerCase() | |
}else{if(c==ZmParsedQuery.GROUP_OPEN||c==ZmParsedQuery.GROUP_CLOSE){this.type=ZmParsedQuery.GROUP | |
}else{if(c){this.type=ZmParsedQuery.TERM; | |
this.op=ZmParsedQuery.OP_CONTENT; | |
this.arg=c | |
}}}}}; | |
ZmSearchToken.prototype.isZmSearchToken=true; | |
ZmSearchToken.prototype.toString=function(b){if(this.type==ZmParsedQuery.TERM){var a=this.arg; | |
if(this.op==ZmParsedQuery.OP_CONTENT){return/\W/.test(a)?'"'+a.replace(/"/g,'\\"')+'"':a | |
}else{a=(a&&(a.indexOf('"')!==0)&&a.indexOf(" ")!=-1)?'"'+a+'"':a; | |
return[this.op,a].join(":") | |
}}else{return(!b&&this.op==ZmParsedQuery.COND_AND)?"":this.op | |
}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmSearchResult")){ZmSearchResult=function(a){if(!a){return | |
}this._results={}; | |
this.search=a; | |
this.type=a.searchFor | |
}; | |
ZmSearchResult.prototype.isZmSearchResult=true; | |
ZmSearchResult.prototype.toString=function(){return"ZmSearchResult" | |
}; | |
ZmSearchResult.prototype.getResults=function(a){a=a||this.type; | |
if(!this._results){return this._getResultsList(a) | |
}else{if(this.search.idsOnly){return this._results | |
}else{return this._results[a]?this._results[a]:a&&this._getResultsList(a) | |
}}}; | |
ZmSearchResult.prototype.getAttribute=function(a){return this._respEl?this._respEl[a]:null | |
}; | |
ZmSearchResult.prototype.set=function(n){if(!this.search){return | |
}this._respEl=n; | |
if(this.search.isAutocompleteSearch){return | |
}var l={}; | |
var f=0; | |
var o,d; | |
var b=this.search.isGalSearch; | |
var c=new Date(); | |
var e=0; | |
if(b||this.search.isCalResSearch){o=d=b?ZmItem.CONTACT:ZmItem.RESOURCE; | |
var u=b?n.cn:n.calresource; | |
if(u){if(!this._results[o]){this._results[o]=this._getResultsList(o) | |
}for(var p=0; | |
p<u.length; | |
p++){this._results[o].addFromDom(u[p]) | |
}if(b){this._results[o].getArray().sort(ZmSearchResult._sortGalResults) | |
}e=u.length | |
}}else{if(this.search.idsOnly){this._results=n.hit||[]; | |
return | |
}else{var h=this.search.types.getArray(); | |
d=h[0]; | |
if(!d){var g=AjxUtil.values(ZmList.NODE); | |
for(var q=0; | |
q<g.length; | |
q++){var k=g[q]; | |
if(n[k]){d=ZmList.ITEM_TYPE[k]; | |
if(h&&h.length==0){h=[d] | |
}break | |
}}}if(!d){var s=appCtxt.getCurrentAppName(); | |
var h=ZmApp.SEARCH_TYPES[s]; | |
d=h&&h.length&&h[0] | |
}for(var q=0; | |
q<h.length; | |
q++){var a=h[q]; | |
var u=n[ZmList.NODE[a]]; | |
if(!u&&(a==ZmItem.MSG)){u=n.chat | |
}if(!u&&(a==ZmItem.RESOURCE)){u=n[ZmList.NODE[ZmItem.CONTACT]] | |
}if(u&&u.length){e+=u.length; | |
if(!this._results[a]){this._results[a]=this._getResultsList(a) | |
}for(var p=0; | |
p<u.length; | |
p++){var r=u[p]; | |
r._type=a; | |
this._results[a].addFromDom(r) | |
}if(!l[a]){l[a]=true; | |
f++; | |
o=a | |
}}}}}if(!e&&d){this._results[d]=this._getResultsList(d) | |
}if((b||this.search.isGalAutocompleteSearch)&&this._results[ZmItem.CONTACT]){this._results[ZmItem.CONTACT].setIsGal(true) | |
}if(this.search.isGalAutocompleteSearch){this.isTokenized=(this._respEl.tokenizeKey!=null) | |
}var m=new Date(); | |
o=o||d; | |
if(f<=1){this.type=o | |
}return this.type | |
}; | |
ZmSearchResult._sortGalResults=function(d,c){var e=d.getFileAs&&d.getFileAs().toLowerCase(); | |
var f=c.getFileAs&&c.getFileAs().toLowerCase(); | |
return e<f?-1:(e>f?1:0) | |
}; | |
ZmSearchResult.prototype._getResultsList=function(a){if(a&&typeof(ZmItem.RESULTS_LIST[a])==="function"){return ZmItem.RESULTS_LIST[a](this.search) | |
}else{DBG.println(AjxDebug.DBG1,AjxMessageFormat.format("!type || ZmItem.RESULTS_LIST[type] !== function. Active app: {0}, type: {1}, searchFor: {2}.",[appCtxt.getCurrentAppName(),a,this.search.searchFor])); | |
return new ZmList(a,this.search) | |
}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmTag")){ZmTag=function(a){a.type=ZmOrganizer.TAG; | |
ZmOrganizer.call(this,a); | |
this.notLocal=a.notLocal | |
}; | |
ZmTag.prototype=new ZmOrganizer; | |
ZmTag.prototype.constructor=ZmTag; | |
ZmTag.prototype.isZmTag=true; | |
ZmTag.prototype.toString=function(){return"ZmTag" | |
}; | |
ZmTag.COLOR_ICON=new Object(); | |
ZmTag.COLOR_ICON[ZmOrganizer.C_ORANGE]="TagOrange"; | |
ZmTag.COLOR_ICON[ZmOrganizer.C_BLUE]="TagBlue"; | |
ZmTag.COLOR_ICON[ZmOrganizer.C_CYAN]="TagCyan"; | |
ZmTag.COLOR_ICON[ZmOrganizer.C_GREEN]="TagGreen"; | |
ZmTag.COLOR_ICON[ZmOrganizer.C_PURPLE]="TagPurple"; | |
ZmTag.COLOR_ICON[ZmOrganizer.C_RED]="TagRed"; | |
ZmTag.COLOR_ICON[ZmOrganizer.C_YELLOW]="TagYellow"; | |
ZmTag.ID_ROOT=ZmOrganizer.ID_ROOT; | |
ZmTag.ID_UNREAD=32; | |
ZmTag.ID_FLAGGED=33; | |
ZmTag.ID_FROM_ME=34; | |
ZmTag.ID_REPLIED=35; | |
ZmTag.ID_FORWARDED=36; | |
ZmTag.ID_ATTACHED=37; | |
ZmTag.createFromJs=function(h,d,i,g,f){var j; | |
var a=ZmOrganizer.normalizeId(d.id); | |
if(a<ZmOrganizer.FIRST_USER_ID[ZmOrganizer.TAG]){return | |
}j=i.getById(d.id); | |
if(j){return j | |
}var b={id:d.id,name:d.name,color:ZmTag.checkColor(d.color),rgb:d.rgb,parent:h,tree:i,numUnread:d.u,account:f}; | |
j=new ZmTag(b); | |
var e=g?ZmOrganizer.getSortIndex(j,ZmTag.sortCompare):null; | |
h.children.add(j,e); | |
var c=h.getTagNameMap(); | |
c[d.name]=j; | |
return j | |
}; | |
ZmTag.createNotLocalTag=function(c){var b=ZmTag.notLocalCache=ZmTag.notLocalCache||[]; | |
var a=b[c]; | |
if(a){return a | |
}a=new ZmTag({notLocal:true,id:"notLocal_"+c,name:c}); | |
b[c]=a; | |
return a | |
}; | |
ZmTag.sortCompare=function(c,b){var a=ZmOrganizer.checkSortArgs(c,b); | |
if(a!=null){return a | |
}if(c.name.toLowerCase()>b.name.toLowerCase()){return 1 | |
}if(c.name.toLowerCase()<b.name.toLowerCase()){return -1 | |
}return 0 | |
}; | |
ZmTag.checkName=function(a){var b=ZmOrganizer.checkName(a); | |
if(b){return b | |
}if(a.indexOf("\\")==0){return AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(a)) | |
}return null | |
}; | |
ZmTag.checkColor=function(a){a=Number(a); | |
return((a!=null)&&(a>=0&&a<=ZmOrganizer.MAX_COLOR))?a:ZmOrganizer.DEFAULT_COLOR[ZmOrganizer.TAG] | |
}; | |
ZmTag.getIcon=function(a){var b={getIcon:ZmTag.prototype.getIcon,getColor:ZmTag.prototype.getColor,color:a}; | |
if(String(a).match(/^#/)){b.rgb=a; | |
b.color=null | |
}return ZmTag.prototype.getIconWithColor.call(b) | |
}; | |
ZmTag.create=function(c){var b={_jsns:"urn:zimbraMail"}; | |
var d={CreateTagRequest:b}; | |
b.tag={name:c.name}; | |
if(c.rgb){b.tag.rgb=c.rgb | |
}else{b.tag.color=ZmOrganizer.checkColor(c.color)||ZmOrganizer.DEFAULT_COLOR[ZmOrganizer.TAG] | |
}var a=new AjxCallback(null,ZmTag._handleErrorCreate,c); | |
appCtxt.getAppController().sendRequest({jsonObj:d,asyncMode:true,errorCallback:a,accountName:c.accountName}) | |
}; | |
ZmTag._handleErrorCreate=function(d,b){if(b.code==ZmCsfeException.MAIL_INVALID_NAME){var c=AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(d.name)); | |
var a=appCtxt.getMsgDialog(); | |
a.setMessage(c,DwtMessageDialog.CRITICAL_STYLE); | |
a.popup(); | |
return true | |
}return false | |
}; | |
ZmTag.prototype.getIcon=function(){if(this.notLocal){return"TagShared" | |
}return(this.id==ZmOrganizer.ID_ROOT)?null:"Tag" | |
}; | |
ZmTag.prototype.getTagNameMap=function(){if(!this.tagNameMap){this.tagNameMap={} | |
}return this.tagNameMap | |
}; | |
ZmTag.prototype.createQuery=function(){return['tag:"',this.name,'"'].join("") | |
}; | |
ZmTag.prototype.getToolTip=function(){}; | |
ZmTag.prototype.notifyCreate=function(a){var b=ZmTag.createFromJs(this,a,this.tree,true); | |
b._notify(ZmEvent.E_CREATE) | |
}; | |
ZmTag.prototype.notifyModify=function(b){if(b.name){var a=this.name; | |
var c=this.parent.getTagNameMap(); | |
delete c[a]; | |
c[b.name]=this | |
}ZmOrganizer.prototype.notifyModify.call(this,b) | |
}; | |
ZmTag.prototype.notifyDelete=function(){var a=this.parent.getTagNameMap(); | |
delete a[this.name]; | |
ZmOrganizer.prototype.notifyDelete.call(this) | |
}; | |
ZmTag.prototype.supportsSharing=function(){return false | |
}; | |
ZmTag.prototype.getByNameOrRemote=function(b){var c=this.getTagNameMap(); | |
var a=c[b]; | |
if(a){return a | |
}return ZmTag.createNotLocalTag(b) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmTree")){ZmTree=function(a){if(arguments.length==0){return | |
}ZmModel.call(this,a); | |
this.type=a; | |
this.root=null | |
}; | |
ZmTree.prototype=new ZmModel; | |
ZmTree.prototype.constructor=ZmTree; | |
ZmTree.prototype.toString=function(){return"ZmTree" | |
}; | |
ZmTree.prototype.asString=function(){return this.root?this._asString(this.root,""):"" | |
}; | |
ZmTree.prototype.getById=function(a){return this.root?this.root.getById(a):null | |
}; | |
ZmTree.prototype.getByName=function(a){return this.root?this.root.getByName(a):null | |
}; | |
ZmTree.prototype.getFolderTypeByName=function(b){var d=b.toLowerCase(); | |
var l=appCtxt.getTree(ZmOrganizer.FOLDER).asList(); | |
var h; | |
var g; | |
for(g=0; | |
g<l.length; | |
g++){var m=l[g].name; | |
if(d==m.toLowerCase()){return l[g].type | |
}}var a=ZmApp.APPS; | |
for(g=0; | |
g<a.length; | |
g++){var c=appCtxt.getApp(a[g]); | |
var k=c&&c._deferredFolders; | |
if(!k){continue | |
}var e; | |
for(e=0; | |
e<k.length; | |
e++){var f=k[e]; | |
var m=f.obj&&f.obj.name; | |
if(d==m.toLowerCase()){return f.type | |
}}}h=ZmOrganizer.FOLDER; | |
return h | |
}; | |
ZmTree.prototype.getByType=function(a){return this.root?this.root.getByType(a):null | |
}; | |
ZmTree.prototype.size=function(){return this.root?this.root.size():0 | |
}; | |
ZmTree.prototype.reset=function(){this.root=null | |
}; | |
ZmTree.prototype.asList=function(a){var b=[]; | |
return this.root?this._addToList(this.root,b,a):b | |
}; | |
ZmTree.prototype.getUnreadHash=function(a){if(!a){a={} | |
}return this.root?this._getUnreadHash(this.root,a):a | |
}; | |
ZmTree.prototype._addToList=function(a,g,b){var f=b&&b.includeRemote; | |
var h=b&&b.remoteOnly; | |
var e=a.isRemote(); | |
if((!e&&!h)||(e&&(h||f))){g.push(a) | |
}var d=a.children.getArray(); | |
for(var c=0; | |
c<d.length; | |
c++){this._addToList(d[c],g,b) | |
}return g | |
}; | |
ZmTree.prototype._asString=function(a,d){if(a.id){d=d+a.id | |
}var c=a.children.clone().getArray(); | |
if(c.length){c.sort(function(f,e){return f.id-e.id | |
}); | |
d=d+"["; | |
for(var b=0; | |
b<c.length; | |
b++){if(c[b].id==ZmFolder.ID_TAGS){continue | |
}if(b>0){d=d+"," | |
}d=this._asString(c[b],d) | |
}d=d+"]" | |
}return d | |
}; | |
ZmTree.prototype._getUnreadHash=function(a,b){b[a.id]=a.numUnread; | |
var d=a.children.getArray(); | |
for(var c=0; | |
c<d.length; | |
c++){this._getUnreadHash(d[c],b) | |
}return b | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmTagTree")){ZmTagTree=function(a){ZmTree.call(this,ZmOrganizer.TAG); | |
var b=(a)?([a.id,ZmTag.ID_ROOT].join(":")):ZmTag.ID_ROOT; | |
this.root=new ZmTag({id:b,tree:this}) | |
}; | |
ZmTagTree.prototype=new ZmTree; | |
ZmTagTree.prototype.constructor=ZmTagTree; | |
ZmTagTree.COLOR_LIST=[ZmOrganizer.C_BLUE,ZmOrganizer.C_CYAN,ZmOrganizer.C_GREEN,ZmOrganizer.C_PURPLE,ZmOrganizer.C_RED,ZmOrganizer.C_YELLOW,ZmOrganizer.C_PINK,ZmOrganizer.C_GRAY,ZmOrganizer.C_ORANGE]; | |
ZmTagTree.prototype.toString=function(){return"ZmTagTree" | |
}; | |
ZmTagTree.prototype.loadFromJs=function(c,d,e){if(!c||!c.tag||!c.tag.length){return | |
}for(var b=0; | |
b<c.tag.length; | |
b++){ZmTag.createFromJs(this.root,c.tag[b],this,null,e) | |
}var a=this.root.children.getArray(); | |
if(a.length){a.sort(ZmTag.sortCompare) | |
}}; | |
ZmTagTree.prototype.getByIndex=function(a){var b=this.asList(); | |
if(b&&b.length&&(a<b.length)){return b[a] | |
}}; | |
ZmTagTree.prototype.reset=function(){this.root=new ZmTag({id:ZmTag.ID_ROOT,tree:this}) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmFolderTree")){ZmFolderTree=function(a){ZmTree.call(this,a) | |
}; | |
ZmFolderTree.prototype=new ZmTree; | |
ZmFolderTree.prototype.constructor=ZmFolderTree; | |
ZmFolderTree.IS_PARSED={}; | |
ZmFolderTree.prototype.toString=function(){return"ZmFolderTree" | |
}; | |
ZmFolderTree.prototype.loadFromJs=function(c,a,b){this.root=(a=="zimlet")?ZmZimlet.createFromJs(null,c,this):ZmFolderTree.createFromJs(null,c,this,a,null,b) | |
}; | |
ZmFolderTree.createFromJs=function(g,k,m,o,n,a){if(!(k&&k.id)){return | |
}var e; | |
if(o=="search"){var h; | |
var r=k.id.split(":"); | |
if(!r||(r.length<=1)){if(k.types){var l=k.types.split(","); | |
h=[]; | |
var j=appCtxt.get(ZmSetting.MAIL_ENABLED); | |
for(var q=0; | |
q<l.length; | |
q++){var c=ZmSearch.TYPE_MAP[l[q]]; | |
if(!c||(!j&&(c==ZmItem.CONV||c==ZmItem.MSG))){continue | |
}h.push(c) | |
}if(h.length==0){return null | |
}}var s={id:k.id,name:k.name,parent:g,tree:m,numUnread:k.u,query:k.query,types:h,sortBy:k.sortBy,account:a,color:k.color,rgb:k.rgb}; | |
e=new ZmSearchFolder(s); | |
ZmFolderTree._fillInFolder(e,k,n); | |
ZmFolderTree._traverse(e,k,m,(n||[]),o,a) | |
}}else{var c=k.view?(ZmOrganizer.TYPE[k.view]):(g?g.type:ZmOrganizer.FOLDER); | |
if(!c){return | |
}var p=(k.acl&&k.acl.grant&&k.acl.grant.length>0); | |
if(appCtxt.inStartup&&ZmOrganizer.DEFERRABLE[c]&&!appCtxt.isOffline){var f=appCtxt.getApp(ZmOrganizer.APP[c]); | |
var d={type:c,parent:g,obj:k,tree:m,path:n,elementType:o,account:a}; | |
f.addDeferredFolder(d) | |
}else{var b=ZmOrganizer.ORG_PACKAGE[c]; | |
if(b){AjxDispatcher.require(b) | |
}e=ZmFolderTree.createFolder(c,g,k,m,n,o,a); | |
if(appCtxt.isExternalAccount()&&e.isSystem()&&e.id!=ZmOrganizer.ID_ROOT){return | |
}ZmFolderTree._traverse(e,k,m,(n||[]),o,a) | |
}}return e | |
}; | |
ZmFolderTree.createAllDeferredFolders=function(){var a=appCtxt.getAppController(); | |
for(var b in ZmApp.ORGANIZER){var c=a.getApp(b); | |
c.createDeferred() | |
}}; | |
ZmFolderTree._traverse=function(a,e,n,m,j,h){var c=(a.nId==ZmOrganizer.ID_ROOT); | |
if(j==="hab"){e.folder=e.habGroup | |
}if(e.folder&&e.folder.length){if(!c){m.push(e.name) | |
}for(var f=0; | |
f<e.folder.length; | |
f++){var g=e.folder[f]; | |
var d=ZmFolderTree.createFromJs(a,g,n,(j||"folder"),m,h); | |
if(a&&d){a.children.add(d) | |
}}if(!c){m.pop() | |
}}if(e.search&&e.search.length){if(!c){m.push(e.name) | |
}for(var f=0; | |
f<e.search.length; | |
f++){var l=e.search[f]; | |
var b=ZmFolderTree.createFromJs(a,l,n,"search",m,h); | |
if(b){a.children.add(b) | |
}}if(!c){m.pop() | |
}}if(e.link&&e.link.length){for(var f=0; | |
f<e.link.length; | |
f++){var k=e.link[f]; | |
var d=ZmFolderTree.createFromJs(a,k,n,"link",m,h); | |
if(d){a.children.add(d) | |
}}}}; | |
ZmFolderTree.createFolder=function(type,parent,obj,tree,path,elementType,account){var orgClass=eval(ZmOrganizer.ORG_CLASS[type]); | |
if(!orgClass){return null | |
}var params={id:obj.id,name:obj.name,parent:parent,tree:tree,color:obj.color,rgb:obj.rgb,owner:obj.owner,oname:obj.oname,zid:obj.zid,rid:obj.rid,restUrl:obj.rest,url:obj.url,numUnread:obj.u,numTotal:obj.n,sizeTotal:obj.s,perm:obj.perm,link:elementType=="link",broken:obj.broken,account:account,webOfflineSyncDays:obj.webOfflineSyncDays,retentionPolicy:obj.retentionPolicy}; | |
if(elementType=="hab"){params.name=obj._attrs?obj._attrs.displayName:obj.name; | |
params.mail=obj._attrs?obj._attrs.mail:undefined | |
}var folder=new orgClass(params); | |
ZmFolderTree._fillInFolder(folder,obj,path); | |
ZmFolderTree.IS_PARSED[type]=true; | |
return folder | |
}; | |
ZmFolderTree._fillInFolder=function(a,c,b){if(b&&b.length){a.path=b.join("/") | |
}if(c.f&&a._parseFlags){a._parseFlags(c.f) | |
}a._setSharesFromJs(c) | |
}; | |
ZmFolderTree.prototype.getByType=function(a){return this.root?this.root.getByType(a):null | |
}; | |
ZmFolderTree.prototype.getByPath=function(b,a){return this.root?this.root.getByPath(b,a):null | |
}; | |
ZmFolderTree.prototype.handleNoSuchFolderError=function(a,g,j){var h=this.getByType(a); | |
var c; | |
var f=false; | |
if(h){for(var e=0; | |
e<h.length; | |
e++){if((h[e].zid==g)&&(h[e].rid==j)){h[e].noSuchFolder=true; | |
if(!c){var d=appCtxt.getAppController().getOverviewId(); | |
c=appCtxt.getOverviewController().getTreeView(d,a) | |
}var b=c.getTreeItemById(h[e].id); | |
b.setText(h[e].getName(true)); | |
this.handleDeleteNoSuchFolder(h[e]); | |
f=true | |
}}}return f | |
}; | |
ZmFolderTree.prototype.handleDeleteNoSuchFolder=function(a){var b=appCtxt.getYesNoMsgDialog(); | |
b.reset(); | |
b.registerCallback(DwtDialog.YES_BUTTON,this._deleteOrganizerYesCallback,this,[a,b]); | |
b.registerCallback(DwtDialog.NO_BUTTON,appCtxt.getAppController()._clearDialog,this,b); | |
var c=AjxMessageFormat.format(ZmMsg.confirmDeleteMissingFolder,AjxStringUtil.htmlEncode(a.getName(false,0,true))); | |
b.setMessage(c,DwtMessageDialog.WARNING_STYLE); | |
b.popup() | |
}; | |
ZmFolderTree.prototype._deleteOrganizerYesCallback=function(a,b){a._delete(); | |
appCtxt.getAppController()._clearDialog(b) | |
}; | |
ZmFolderTree.prototype.getPermissions=function(g){var e=g.folderIds||this._getItemsWithoutPerms(g.type); | |
if(e.length>0){var d=AjxSoapDoc.create("BatchRequest","urn:zimbra"); | |
d.setMethodAttribute("onerror","continue"); | |
var f=d.getDoc(); | |
for(var c=0; | |
c<e.length; | |
c++){var b=d.set("GetFolderRequest",null,null,"urn:zimbraMail"); | |
var a=f.createElement("folder"); | |
a.setAttribute("l",e[c]); | |
b.appendChild(a) | |
}var h=new AjxCallback(this,this._handleResponseGetShares,[g.callback,g.skipNotify]); | |
appCtxt.getRequestMgr().sendRequest({soapDoc:d,asyncMode:true,callback:h,noBusyOverlay:g.noBusyOverlay,accountName:g.accountName}) | |
}else{if(g.callback){g.callback.run() | |
}}}; | |
ZmFolderTree.prototype._getItemsWithoutPerms=function(e){var f=[]; | |
var d=e?[e]:[ZmOrganizer.FOLDER,ZmOrganizer.CALENDAR,ZmOrganizer.TASKS,ZmOrganizer.BRIEFCASE,ZmOrganizer.ADDRBOOK]; | |
for(var b=0; | |
b<d.length; | |
b++){var g=d[b]; | |
if(!ZmFolderTree.IS_PARSED[g]){continue | |
}var a=this.getByType(g); | |
for(var c=0; | |
c<a.length; | |
c++){if(a[c].link&&a[c].shares==null){f.push(a[c].id) | |
}}}return f | |
}; | |
ZmFolderTree.prototype._handleResponseGetShares=function(h,d,l){var k=l.getResponse().BatchResponse; | |
this._handleErrorGetShares(k); | |
var a=k.GetFolderResponse; | |
if(a){for(var c=0; | |
c<a.length; | |
c++){var e=a[c].link?a[c].link[0]:null; | |
if(e){var f=appCtxt.getById(e.id); | |
if(f){f.perm=e.perm; | |
if(e.n){f.numTotal=e.n | |
}if(e.u){f.numUnread=e.u | |
}f._setSharesFromJs(e) | |
}if(e.folder&&e.folder.length>0){var g=appCtxt.getById(e.id); | |
if(g){for(var b=0; | |
b<e.folder.length; | |
b++){if(appCtxt.getById(e.folder[b].id)){continue | |
}g.notifyCreate(e.folder[b],"link",d) | |
}}}}}}if(h){h.run() | |
}}; | |
ZmFolderTree.prototype._handleErrorGetShares=function(j){var e=j.Fault; | |
if(e){var c=[]; | |
var b=[]; | |
for(var d=0,a=e.length; | |
d<a; | |
d++){var g=ZmCsfeCommand.faultToEx(e[d]); | |
if(g.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER){var h=g.data.itemId[0]; | |
var f=h.lastIndexOf(":"); | |
b.push(h.substring(0,f)); | |
c.push(h.substring(f+1,h.length)) | |
}}if(b.length){this._markNoSuchFolder(b,c) | |
}}}; | |
ZmFolderTree.prototype._markNoSuchFolder=function(b,e){var f=appCtxt.getFolderTree(); | |
var a=f&&f.root?f.root.children.getArray():null; | |
for(var d=0; | |
d<a.length; | |
d++){for(var c=0; | |
c<e.length; | |
c++){if((a[d].zid==b[c])&&(a[d].rid==e[c])){a[d].noSuchFolder=true | |
}}}}; | |
ZmFolderTree.prototype._sortFolder=function(c){var b=c.children; | |
if(b&&b.length){b.sort(ZmFolder.sortCompare); | |
for(var a=0; | |
a<b.length; | |
a++){this._sortFolder(b[a]) | |
}}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmList")){ZmList=function(b,a){if(arguments.length==0){return | |
}ZmModel.call(this,b); | |
this.type=b; | |
this.search=a; | |
this._vector=new AjxVector(); | |
this._hasMore=false; | |
this._idHash={}; | |
var c=appCtxt.getTagTree(); | |
if(c){this._tagChangeListener=new AjxListener(this,this._tagTreeChangeListener); | |
c.addChangeListener(this._tagChangeListener) | |
}this.id="LIST"+ZmList.NEXT++; | |
appCtxt.cacheSet(this.id,this) | |
}; | |
ZmList.prototype=new ZmModel; | |
ZmList.prototype.constructor=ZmList; | |
ZmList.prototype.isZmList=true; | |
ZmList.prototype.toString=function(){return"ZmList" | |
}; | |
ZmList.NEXT=1; | |
ZmList.ITEM_CLASS={}; | |
ZmList.NODE={}; | |
ZmList.ITEM_TYPE={}; | |
ZmList.CHUNK_SIZE=100; | |
ZmList.CHUNK_PAUSE=500; | |
ZmList.prototype.get=function(a){return this._vector.get(a) | |
}; | |
ZmList.prototype.add=function(b,a){this._vector.add(b,a); | |
if(b.id){this._idHash[b.id]=b | |
}}; | |
ZmList.prototype.remove=function(a){this._vector.remove(a); | |
if(a.id){delete this._idHash[a.id] | |
}}; | |
ZmList.prototype.create=function(args){var item; | |
var obj=eval(ZmList.ITEM_CLASS[this.type]); | |
if(obj){item=new obj(this); | |
item.create(args) | |
}return item | |
}; | |
ZmList.prototype.size=function(){return this._vector.size() | |
}; | |
ZmList.prototype.indexOf=function(a){return this._vector.indexOf(a) | |
}; | |
ZmList.prototype.hasMore=function(){return this._hasMore | |
}; | |
ZmList.prototype.setHasMore=function(a){this._hasMore=a | |
}; | |
ZmList.prototype.getArray=function(){return this._vector.getArray() | |
}; | |
ZmList.prototype.getVector=function(){return this._vector | |
}; | |
ZmList.prototype.getById=function(a){return this._idHash[a] | |
}; | |
ZmList.prototype.clear=function(){var b=this.getArray(); | |
for(var c=0; | |
c<b.length; | |
c++){b[c].clear() | |
}this._evtMgr.removeAll(ZmEvent.L_MODIFY); | |
this._vector.removeAll(); | |
for(var d in this._idHash){this._idHash[d]=null | |
}this._idHash={} | |
}; | |
ZmList.prototype.set=function(respNode){this.clear(); | |
var nodes=respNode.childNodes; | |
var args={list:this}; | |
for(var i=0; | |
i<nodes.length; | |
i++){var node=nodes[i]; | |
if(node.nodeName==ZmList.NODE[this.type]){if(parseInt(node.getAttribute("l"))==ZmFolder.ID_TRASH&&(this.type!=ZmItem.CONTACT)){continue | |
}var obj=eval(ZmList.ITEM_CLASS[this.type]); | |
if(obj){this.add(obj.createFromDom(node,args)) | |
}}}}; | |
ZmList.prototype.addFromDom=function(node,args){args=args||{}; | |
args.list=this; | |
var obj=eval(ZmList.ITEM_CLASS[this.type]); | |
if(obj){this.add(obj.createFromDom(node,args)) | |
}}; | |
ZmList.prototype.getSubList=function(d,c){var e=null; | |
var b=(d+c>this.size())?this.size():d+c; | |
var a=this.getArray(); | |
if(d<b){e=AjxVector.fromArray(a.slice(d,b)) | |
}return e | |
}; | |
ZmList.prototype.cache=function(e,b){this.getVector().merge(e,b); | |
var d=b.getArray(); | |
for(var a=0; | |
a<d.length; | |
a++){var c=d[a]; | |
c.list=this; | |
if(c.id){this._idHash[c.id]=c | |
}}}; | |
ZmList.prototype.flagItems=function(c){c=Dwt.getParams(arguments,["items","op","value","callback"]); | |
c.items=AjxUtil.toArray(c.items); | |
if(c.op=="update"){c.action=c.op; | |
c.attrs={f:c.value} | |
}else{c.action=c.value?c.op:"!"+c.op | |
}if(appCtxt.multiAccounts){var b=this.search.folderId; | |
var a=b&&appCtxt.getById(b); | |
if(a&&a.isRemote()){c.accountName=c.items[0].getAccount().name | |
}}this._itemAction(c) | |
}; | |
ZmList.prototype.tagItems=function(f){f=Dwt.getParams(arguments,["items","tagId","doTag"]); | |
var d=f.tagName||(f.tag&&f.tag.name); | |
var b=AjxUtil.toArray(f.items); | |
var a=[],g=f.doTag; | |
if(b[0]&&b[0] instanceof ZmItem){for(var c=0; | |
c<b.length; | |
c++){var e=b[c]; | |
if((g&&(!e.hasTag(d)||e.type==ZmItem.CONV))||(!g&&e.hasTag(d))){a.push(e) | |
}}}else{a=b | |
}f.items=a; | |
f.attrs={tn:d}; | |
f.action=g?"tag":"!tag"; | |
f.actionTextKey=g?"actionTag":"actionUntag"; | |
f.actionArg=f.tag&&f.tag.name; | |
this._itemAction(f) | |
}; | |
ZmList.prototype.removeAllTags=function(e){e=(e&&e.items)?e:{items:e}; | |
var b=AjxUtil.toArray(e.items); | |
var a=[]; | |
if(b[0]&&b[0] instanceof ZmItem){for(var c=0; | |
c<b.length; | |
c++){var d=b[c]; | |
if(d.tags&&d.tags.length){a.push(d) | |
}}}else{a=b | |
}e.items=a; | |
e.action="update"; | |
e.attrs={t:""}; | |
e.actionTextKey="actionRemoveTags"; | |
this._itemAction(e) | |
}; | |
ZmList.prototype.moveItems=function(e){e=Dwt.getParams(arguments,["items","folder","attrs","callback","errorCallback","finalCallback","noUndo"]); | |
var c=AjxUtil.hashCopy(e); | |
c.items=AjxUtil.toArray(e.items); | |
c.attrs=e.attrs||{}; | |
c.childWin=e.childWin; | |
c.closeChildWin=e.closeChildWin; | |
if(c.folder.id==ZmFolder.ID_TRASH){c.actionTextKey="actionTrash"; | |
c.action="trash" | |
}else{c.actionTextKey="actionMove"; | |
c.actionArg=e.folder.getName(false,false,true); | |
c.action="move"; | |
c.attrs.l=e.folder.id | |
}c.callback=new AjxCallback(this,this._handleResponseMoveItems,[e]); | |
if(e.noToast){c.actionTextKey=null | |
}if(appCtxt.multiAccounts){var b=e.items[0].getFolderId&&e.items[0].getFolderId(); | |
if(!b){var d=e.items[0]&&e.items[0].id; | |
b=d&&appCtxt.getById(d)&&appCtxt.getById(d).folderId | |
}var a=appCtxt.getById(b); | |
if((e.items[0].isDraft&&e.folder.id==ZmFolder.ID_DRAFTS)||(e.folder.isRemote())||(a&&a.isRemote())){c.accountName=e.items[0].getAccount().name | |
}}c.errorCallback=e.errorCallback; | |
if(this._handleDeleteFromSharedFolder(e,c)){return | |
}this._itemAction(c) | |
}; | |
ZmList.prototype._handleDeleteFromSharedFolder=function(a,g){if(a.folder&&a.folder.id==ZmFolder.ID_TRASH){var e; | |
var b=[]; | |
for(var c=0; | |
c<a.items.length; | |
c++){var j=a.items[c]; | |
var d=j.id.indexOf(":"); | |
if(d!=-1){var h=j.id.substring(0,d); | |
if(!appCtxt.accountList.getAccount(h)){e=appCtxt.getById(j.folderId); | |
if(e&&!e.isReadOnly()){b.push(j) | |
}}}}if(b.length){var f={items:b,folder:a.folder,finalCallback:this._itemAction.bind(this,g,null),actionTextKey:null}; | |
this.copyItems(f); | |
return true | |
}}}; | |
ZmList.prototype._handleResponseMoveItems=function(b,j){var e=j.getResponse(); | |
if(e&&e.length&&(e[0] instanceof ZmItem)){this.moveLocal(e,b.folder.id); | |
for(var c=0; | |
c<e.length; | |
c++){var g=e[c]; | |
var a={oldFolderId:g.folderId}; | |
g.moveLocal(b.folder.id) | |
}var g=e[0]; | |
if(!g._list[g.list.id]){g._list[g.list.id]=true | |
}for(var d in g._list){var h=window.parentAppCtxt||appCtxt; | |
var f=h.getById(d); | |
if(!f){continue | |
}f._evt.batchMode=true; | |
f._evt.item=g; | |
f._evt.items=e; | |
f._notify(ZmEvent.E_MOVE,a) | |
}}if(b.callback){b.callback.run(j) | |
}}; | |
ZmList.prototype.copyItems=function(a){a=Dwt.getParams(arguments,["items","folder","attrs","actionTextKey"]); | |
a.items=AjxUtil.toArray(a.items); | |
a.attrs=a.attrs||{}; | |
if(!appCtxt.isExternalAccount()){a.attrs.l=a.folder.id; | |
a.action="copy"; | |
a.actionTextKey="itemCopied" | |
}else{a.action="trash" | |
}a.actionArg=a.folder.getName(false,false,true); | |
a.callback=new AjxCallback(this,this._handleResponseCopyItems,a); | |
if(appCtxt.multiAccounts&&a.folder.isRemote()){a.accountName=a.items[0].getAccount().name | |
}this._itemAction(a) | |
}; | |
ZmList.prototype._handleResponseCopyItems=function(d,a){var c=a.getResponse(); | |
if(c.length>0){if(d.actionTextKey){var b=AjxMessageFormat.format(ZmMsg[d.actionTextKey],c.length); | |
appCtxt.getAppController().setStatusMsg(b) | |
}}}; | |
ZmList.prototype.deleteItems=function(d){d=Dwt.getParams(arguments,["items","hardDelete","attrs","childWin"]); | |
var h=d.items=AjxUtil.toArray(d.items); | |
var g=[]; | |
var e=[]; | |
if(d.hardDelete){e=h | |
}else{if(h[0]&&h[0] instanceof ZmItem){for(var f=0; | |
f<h.length; | |
f++){var k=h[f]; | |
var b=k.getFolderId(); | |
var a=appCtxt.getById(b); | |
if(a&&a.isHardDelete()){e.push(k) | |
}else{g.push(k) | |
}}}else{g=h | |
}}if(e.length&&!d.confirmDelete){d.confirmDelete=true; | |
var j=ZmList.prototype.deleteItems.bind(this,d); | |
this._popupDeleteWarningDialog(j,g.length,e.length); | |
return | |
}d.callback=d.childWin&&new AjxCallback(this._handleDeleteNewWindowResponse,d.childWin); | |
if(g.length){if(appCtxt.multiAccounts){var c=this._filterItemsByAccount(g); | |
if(!d.callback){d.callback=new AjxCallback(this,this._deleteAccountItems,[c,d]) | |
}this._deleteAccountItems(c,d) | |
}else{d.items=g; | |
d.folder=appCtxt.getById(ZmFolder.ID_TRASH); | |
this.moveItems(d) | |
}}if(e.length){d.items=e; | |
d.action="delete"; | |
d.actionTextKey="actionDelete"; | |
this._itemAction(d) | |
}}; | |
ZmList.prototype._popupDeleteWarningDialog=function(d,b,c){var a=appCtxt.getOkCancelMsgDialog(); | |
a.reset(); | |
a.setMessage(AjxMessageFormat.format(ZmMsg[b?"confirmDeleteSomeForever":"confirmDeleteForever"],[c]),DwtMessageDialog.WARNING_STYLE); | |
a.registerCallback(DwtDialog.OK_BUTTON,this._deleteWarningDialogListener.bind(this,d,a)); | |
a.associateEnterWithButton(DwtDialog.OK_BUTTON); | |
a.popup(null,DwtDialog.OK_BUTTON) | |
}; | |
ZmList.prototype._deleteWarningDialogListener=function(b,a){a.popdown(); | |
b() | |
}; | |
ZmList.prototype._deleteAccountItems=function(d,e){var a; | |
for(var b in d){a=d[b]; | |
break | |
}if(a){delete d[b]; | |
var c=window.parentAppCtxt||window.appCtxt; | |
e.accountName=c.accountList.getAccount(b).name; | |
e.items=a; | |
e.folder=appCtxt.getById(ZmFolder.ID_TRASH); | |
this.moveItems(e) | |
}}; | |
ZmList.prototype._filterItemsByAccount=function(a){var e={}; | |
if(a[0]&&a[0] instanceof ZmItem){for(var c=0; | |
c<a.length; | |
c++){var d=a[c]; | |
var b=d.getAccount().id; | |
if(!e[b]){e[b]=[] | |
}e[b].push(d) | |
}}else{var f=appCtxt.accountList.mainAccount.id; | |
e[f]=a | |
}return e | |
}; | |
ZmList.prototype._handleDeleteNewWindowResponse=function(b,a){if(b){b.close() | |
}}; | |
ZmList.prototype.modifyItem=function(b,a,c){b.modify(a,c) | |
}; | |
ZmList.prototype.notifyCreate=function(node){var obj=eval(ZmList.ITEM_CLASS[this.type]); | |
if(obj){var item=obj.createFromDom(node,{list:this}); | |
this.add(item,this._sortIndex(item)); | |
this.createLocal(item); | |
this._notify(ZmEvent.E_CREATE,{items:[item]}) | |
}}; | |
ZmList.prototype.modifyLocal=function(a,b){}; | |
ZmList.prototype.createLocal=function(a){}; | |
ZmList.prototype.flagLocal=function(b,a,c){}; | |
ZmList.prototype.tagLocal=function(b,a,c){}; | |
ZmList.prototype.removeAllTagsLocal=function(a){}; | |
ZmList.prototype.deleteLocal=function(a){for(var b=0; | |
b<a.length; | |
b++){this.remove(a[b]) | |
}}; | |
ZmList.prototype.moveLocal=function(b,a){for(var c=0; | |
c<b.length; | |
c++){this.remove(b[c]) | |
}}; | |
ZmList.prototype._itemAction=function(q,i){var h=this._getIds(q.items); | |
var p=h.hash; | |
var k=h.list; | |
if(!(k&&k.length)){if(q.callback){q.callback.run(new ZmCsfeResult([])) | |
}if(q.finalCallback){q.finalCallback(q) | |
}return | |
}var c; | |
if(q.items.length==1&&q.items[0]&&q.items[0].type){c=q.items[0].type | |
}else{c=this.type | |
}if(!c){return | |
}if(!q.accountName&&appCtxt.multiAccounts){q.accountName=appCtxt.accountList.mainAccount.name | |
}var n=ZmItem.SOAP_CMD[c]+"Request"; | |
var s=i?i._useJson:true; | |
var d,m; | |
if(s){d={}; | |
var b=this._getActionNamespace(); | |
d[n]={_jsns:b}; | |
var m=d[n].action={}; | |
m.op=q.action; | |
for(var l in q.attrs){m[l]=q.attrs[l] | |
}}else{d=AjxSoapDoc.create(n,this._getActionNamespace()); | |
m=d.set("action"); | |
m.setAttribute("op",q.action); | |
for(var l in q.attrs){m.setAttribute(l,q.attrs[l]) | |
}}var r=window.parentAppCtxt||appCtxt; | |
var g=r.getActionController(); | |
var f=!q.noUndo&&(this.type!=ZmItem.CONV||this.search&&this.search.folderId); | |
var j=(f&&g&&g.actionPerformed({op:q.action,ids:k,attrs:q.attrs}))||null; | |
var a=new AjxCallback(this,this._handleResponseItemAction,[q.callback,j]); | |
var o={ids:k,idHash:p,accountName:q.accountName,request:d,action:m,type:c,callback:a,finalCallback:q.finalCallback,errorCallback:q.errorCallback,batchCmd:i,numItems:q.count||0,actionTextKey:q.actionTextKey,actionArg:q.actionArg,actionLogItem:j,childWin:q.childWin,closeChildWin:q.closeChildWin,safeMove:q.safeMove}; | |
if(k.length>=ZmList.CHUNK_SIZE){var e={state:ZmListController.PROGRESS_DIALOG_INIT,callback:new AjxCallback(this,this._cancelAction,[o])}; | |
ZmListController.handleProgress(e) | |
}this._doAction(o) | |
}; | |
ZmList.prototype._handleResponseItemAction=function(d,c,b,a){if(c){c.setComplete() | |
}if(d){a.set(b); | |
d.run(a) | |
}}; | |
ZmList.prototype._doAction=function(d){var f=d.ids.splice(0,ZmList.CHUNK_SIZE); | |
var e=f.join(","); | |
var b=true; | |
if(d.action.setAttribute){d.action.setAttribute("id",e); | |
b=false | |
}else{d.action.id=e | |
}var g=Boolean(d.ids.length&&!d.cancelled); | |
var i=new AjxCallback(this,this._handleResponseDoAction,[d]); | |
var c=this.controller&&this.controller.isOutboxFolder(); | |
var a=this._handleOfflineResponseDoAction.bind(this,d,c); | |
if(d.batchCmd){d.batchCmd.addRequestParams(d.request,i,d.errorCallback) | |
}else{var h={asyncMode:true,callback:i,errorCallback:d.errorCallback,offlineCallback:a,accountName:d.accountName,more:g}; | |
if(b){h.jsonObj=d.request | |
}else{h.soapDoc=d.request | |
}if(d.safeMove){h.useChangeToken=true | |
}if(c){h.offlineRequest=true | |
}d.reqId=appCtxt.getAppController().sendRequest(h) | |
}}; | |
ZmList.prototype._handleResponseDoAction=function(b,k){var f; | |
var d=k.getResponse(); | |
var c=d[ZmItem.SOAP_CMD[b.type]+"Response"]; | |
if(c&&c.action){var a=c.action.id.split(","); | |
if(a){var g=[]; | |
for(var e=0; | |
e<a.length; | |
e++){var j=b.idHash[a[e]]; | |
if(j){g.push(j) | |
}}b.numItems+=g.length; | |
if(b.callback){b.callback.run(g,k) | |
}if(b.actionTextKey){f=ZmList.getActionSummary(b); | |
var h={state:ZmListController.PROGRESS_DIALOG_UPDATE,summary:f}; | |
ZmListController.handleProgress(h) | |
}}}if(b.ids.length&&!b.cancelled){AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._doAction,[b]),ZmItem.CHUNK_PAUSE) | |
}else{b.reqId=null; | |
b.actionSummary=f; | |
if(b.finalCallback){b.finalCallback(b) | |
}else{ZmListController.handleProgress({state:ZmListController.PROGRESS_DIALOG_CLOSE}); | |
ZmBaseController.showSummary(b.actionSummary,b.actionLogItem,b.closeChildWin) | |
}}}; | |
ZmList.prototype._handleOfflineResponseDoAction=function(f,d,c){var b=f.action,g=this._handleOfflineResponseDoActionCallback.bind(this,f,d,c.callback); | |
if(d&&b.op==="trash"){var a={methodName:"SendMsgRequest",id:b.id.split(",")}; | |
ZmOfflineDB.deleteItemInRequestQueue(a,g) | |
}else{var e=c.jsonObj; | |
e.methodName=ZmItem.SOAP_CMD[f.type]+"Request"; | |
e.id=b.id; | |
ZmOfflineDB.setItem(e,ZmOffline.REQUESTQUEUE,g) | |
}}; | |
ZmList.prototype._handleOfflineResponseDoActionCallback=function(e,d,h){var c={},g=this._generateOfflineHeader(e),a,f,b; | |
c[ZmItem.SOAP_CMD[e.type]+"Response"]=e.request[ZmItem.SOAP_CMD[e.type]+"Request"]; | |
a=new ZmCsfeResult(c,false,g); | |
f=a.getHeader(); | |
if(h){h.run(a) | |
}if(f){b=f.context.notify[0]; | |
if(b){appCtxt._requestMgr._notifyHandler(b); | |
this._updateOfflineData(e,d,b) | |
}}}; | |
ZmList.prototype._generateOfflineHeader=function(u){var p=u.action,g=p.op,o=p.id.split(","),l=o.length,k,d,e,a,f,v,b,j,s,n=[],t=[],h=[],r; | |
for(var q=0; | |
q<l; | |
q++){k=o[q]; | |
d=this.getById(k); | |
e=d.flags||""; | |
a=d.getFolderId(); | |
f=appCtxt.getById(a); | |
b={id:k}; | |
j={id:"-"+b.id}; | |
s={id:a}; | |
switch(g){case"flag":b.f=e+"f"; | |
break; | |
case"!flag":b.f=e.replace("f",""); | |
break; | |
case"read":b.f=e.replace("u",""); | |
s.u=f.numUnread-1; | |
break; | |
case"!read":b.f=e+"u"; | |
s.u=f.numUnread+1; | |
break; | |
case"trash":b.l=ZmFolder.ID_TRASH; | |
break; | |
case"spam":b.l=ZmFolder.ID_SPAM; | |
break; | |
case"!spam":b.l=ZmFolder.ID_INBOX; | |
break; | |
case"move":if(p.l){b.l=p.l | |
}s.n=f.numTotal-1; | |
if(d.isUnread&&f.numUnread>1){s.u=f.numUnread-1 | |
}v=appCtxt.getById(b.l); | |
h.push({id:v.id,n:v.numTotal+1,u:(d.isUnread?v.numUnread+1:v.numUnread)}); | |
break; | |
case"tag":d.tags.push(p.tn); | |
b.tn=d.tags.join(); | |
break; | |
case"!tag":AjxUtil.arrayRemove(d.tags,p.tn); | |
b.tn=d.tags.join(); | |
break; | |
case"update":if(p.t===""){b.tn=""; | |
b.t="" | |
}break | |
}n.push(b); | |
t.push(j); | |
h.push(s) | |
}r={context:{notify:[{modified:{m:n,c:t,folder:h}}]}}; | |
return r | |
}; | |
ZmList.prototype._updateOfflineData=function(e,d,c){var b=c.modified; | |
if(!b){return | |
}var a=b.m; | |
if(!a){return | |
}var f=this._updateOfflineDataCallback.bind(this,e,a); | |
ZmOfflineDB.getItem(e.action.id.split(","),ZmApp.MAIL,f) | |
}; | |
ZmList.prototype._updateOfflineDataCallback=function(d,b,a){a=ZmOffline.recreateMsg(a); | |
var c=[]; | |
a.forEach(function(e){b.forEach(function(f){if(f.id===e.id){c.push($.extend(e,f)) | |
}}) | |
}); | |
ZmOfflineDB.setItem(c,ZmApp.MAIL) | |
}; | |
ZmList.getActionSummary=function(b){var h=b.type,i=ZmItem.MSG_KEY[h],f=ZmMsg[i],g=AjxStringUtil.capitalizeFirstLetter(i),c="type"+g,e=b.numItems,d=b.actionTextKey+g,j=ZmMsg[d]||ZmMsg[b.actionTextKey],a=ZmMsg[c],l=AjxStringUtil.htmlEncode(b.actionArg),m=a?AjxMessageFormat.format(a,e):f,k=a?AjxMessageFormat.format(ZmMsg[c],1):f; | |
return AjxMessageFormat.format(j,[e,m,l,k]) | |
}; | |
ZmList.prototype._cancelAction=function(a){a.cancelled=true; | |
if(a.reqId){appCtxt.getRequestMgr().cancelRequest(a.reqId) | |
}if(a.finalCallback){a.finalCallback(a) | |
}ZmListController.handleProgress({state:ZmListController.PROGRESS_DIALOG_CLOSE}) | |
}; | |
ZmList.prototype._getTypedItems=function(b){var a={}; | |
for(var c=0; | |
c<b.length; | |
c++){var d=b[c].type; | |
if(!a[d]){a[d]=[] | |
}a[d].push(b[c]) | |
}return a | |
}; | |
ZmList.prototype._getIds=function(e){var d={}; | |
if(e instanceof ZmItem){e=[e] | |
}var b=[]; | |
if((e&&e.length)){for(var a=0; | |
a<e.length; | |
a++){var c=e[a]; | |
var f=c.id; | |
if(f){b.push(f); | |
d[f]=c | |
}}}return{hash:d,list:b} | |
}; | |
ZmList.prototype._sortIndex=function(a){return 0 | |
}; | |
ZmList.prototype._redoSearch=function(a){var b=appCtxt.getSearchController(); | |
b.redoSearch(a._currentSearch) | |
}; | |
ZmList.prototype._getActionNamespace=function(){return"urn:zimbraMail" | |
}; | |
ZmList.prototype._folderTreeChangeListener=function(f){if(f.type!=ZmEvent.S_FOLDER){return | |
}var e=f.getDetail("organizers")[0]; | |
var d=f.getDetail("fields"); | |
var c=appCtxt.getCurrentController(); | |
var b=(appCtxt.getCurrentList()==this); | |
if(f.event==ZmEvent.E_DELETE&&(f.source instanceof ZmFolder)&&f.source.id==ZmFolder.ID_TRASH){var a=c.getListView&&c.getListView(); | |
if(a){a.offset=0 | |
}c._resetNavToolBarButtons(view) | |
}else{if(b&&c&&c._currentSearch&&(f.event==ZmEvent.E_MOVE||(f.event==ZmEvent.E_MODIFY)&&d&&d[ZmOrganizer.F_NAME])){if(c._currentSearch.replaceFolderTerm(f.getDetail("oldPath"),e.getPath())){appCtxt.getSearchController().setSearchField(c._currentSearch.query) | |
}}}}; | |
ZmList.prototype._tagTreeChangeListener=function(m){if(m.type!=ZmEvent.S_TAG){return | |
}var s=m.getDetail("organizers")[0]; | |
var g=m.getDetail("fields"); | |
var p=appCtxt.getCurrentController(); | |
if(!p){return | |
}var n=this.getArray(); | |
if((m.event==ZmEvent.E_MODIFY)&&g&&g[ZmOrganizer.F_NAME]){var c=m.getDetail("oldName"); | |
if(p._currentSearch&&p._currentSearch.hasTagTerm(c)){p._currentSearch.replaceTagTerm(c,s.getName()); | |
appCtxt.getSearchController().setSearchField(p._currentSearch.query) | |
}var k=s.name; | |
for(var f=0; | |
f<n.length; | |
f++){var q=n[f]; | |
if(!q||!q.isZmItem||!q.hasTag(c)){continue | |
}if(q.isShared()){continue | |
}var h=q.tagHash; | |
var r=q.tags; | |
delete h[c]; | |
h[k]=true; | |
for(var d=0; | |
d<r.length; | |
d++){if(r[d]==c){r[d]=k; | |
break | |
}}}}else{if(m.event==ZmEvent.E_DELETE){var b=this._evtMgr.isListenerRegistered(ZmEvent.L_MODIFY); | |
for(var f=0; | |
f<n.length; | |
f++){var q=this.getById(n[f].id); | |
if(q){if(q.isShared()){continue | |
}if(q.hasTag(s.name)){q.tagLocal(s.name,false); | |
if(b){this._notify(ZmEvent.E_TAGS,{items:[q]}) | |
}}}}if(p._currentSearch&&p._currentSearch.hasTagTerm(s.getName())){var o=appCtxt.getCurrentViewId(); | |
var e=appCtxt.getCurrentViewType(); | |
p.enablePagination(false,o); | |
var l=p.getListView&&p.getListView(); | |
if(l&&l.sortingEnabled){l.sortingEnabled=false | |
}if(e==ZmId.VIEW_CONVLIST){p._currentSearch.query="is:read is:unread" | |
}p._currentSearch.tagId=null; | |
appCtxt.getSearchController().setSearchField("") | |
}}}} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmAccountList")){ZmAccountList=function(){this._accounts={}; | |
this._count=0; | |
this.visibleAccounts=[]; | |
this.mainAccount=null; | |
this.activeAccount=null; | |
this.defaultAccount=null; | |
this._evtMgr=new AjxEventMgr() | |
}; | |
ZmAccountList.prototype.constructor=ZmAccountList; | |
ZmAccountList.DEFAULT_ID="main"; | |
ZmAccountList.prototype.toString=function(){return"ZmAccountList" | |
}; | |
ZmAccountList.prototype.size=function(a){return(a)?this._count:this.visibleAccounts.length | |
}; | |
ZmAccountList.prototype.add=function(a){this._accounts[a.id]=a; | |
this._count++; | |
if(a.visible||a.id==ZmAccountList.DEFAULT_ID){this.visibleAccounts.push(a) | |
}if(a.id==ZmAccountList.DEFAULT_ID){this.mainAccount=a | |
}}; | |
ZmAccountList.prototype.getAccounts=function(){return this._accounts | |
}; | |
ZmAccountList.prototype.getAccount=function(a){return a?this._accounts[a]:this.mainAccount | |
}; | |
ZmAccountList.prototype.getAccountByName=function(a){for(var b in this._accounts){if(this._accounts[b].name==a){return this._accounts[b] | |
}}return null | |
}; | |
ZmAccountList.prototype.getAccountByEmail=function(a){for(var b in this._accounts){if(this._accounts[b].getEmail()==a){return this._accounts[b] | |
}}return null | |
}; | |
ZmAccountList.prototype.getItemCount=function(a,e){var d=0; | |
for(var b=0; | |
b<this.visibleAccounts.length; | |
b++){var g=this.visibleAccounts[b]; | |
if(g.isMain){continue | |
}var f=ZmOrganizer.getSystemId(a,g); | |
var c=appCtxt.getById(f); | |
if(c){d+=(e?c.numUnread:c.numTotal) | |
}}return d | |
}; | |
ZmAccountList.prototype.generateQuery=function(a,f){var j=f&&f.get(0); | |
var h=[]; | |
var g=this.visibleAccounts; | |
var c=a||ZmOrganizer.ID_ROOT; | |
var d=a?"inid":"underid"; | |
for(var e=0; | |
e<g.length; | |
e++){var k=g[e]; | |
if((j&&!k.isAppEnabled(ZmItem.APP[j]))||k.isMain){continue | |
}var b=[d,':"',ZmOrganizer.getSystemId(c,k,true),'"']; | |
h.push(b.join("")) | |
}if(c==ZmOrganizer.ID_ROOT){h.push([d,':"',appCtxt.accountList.mainAccount.id,":",c,'"'].join("")) | |
}return(h.join(" OR ")) | |
}; | |
ZmAccountList.prototype.loadAccounts=function(b){var a=(new Array()).concat(this.visibleAccounts); | |
this._loadAccount(a,b) | |
}; | |
ZmAccountList.prototype._loadAccount=function(b,e){var d=b.shift(); | |
if(d){var c=new AjxCallback(this,this._loadAccount,[b,e]); | |
d.load(c) | |
}else{ZmOrganizer.HIDE_EMPTY[ZmOrganizer.TAG]=true; | |
ZmOrganizer.HIDE_EMPTY[ZmOrganizer.SEARCH]=true; | |
for(var a=0; | |
a<this.visibleAccounts.length; | |
a++){if(appCtxt.get(ZmSetting.OFFLINE_SMTP_ENABLED,null,this.visibleAccounts[a])){appCtxt.set(ZmSetting.OFFLINE_COMPOSE_ENABLED,true,null,null,true); | |
break | |
}}if(e){e.run() | |
}}}; | |
ZmAccountList.prototype.setActiveAccount=function(b,a){this.activeAccount=b; | |
this._evt=this._evt||new ZmEvent(); | |
this._evt.account=b; | |
if(!a){this._evtMgr.notifyListeners("ACCOUNT",this._evt) | |
}}; | |
ZmAccountList.prototype.addActiveAcountListener=function(b,a){return this._evtMgr.addListener("ACCOUNT",b,a) | |
}; | |
ZmAccountList.prototype.isInitialSyncing=function(){for(var a=0; | |
a<this.visibleAccounts.length; | |
a++){var b=this.visibleAccounts[a]; | |
if(b.isMain){continue | |
}if(b.isOfflineInitialSync()){return true | |
}}return false | |
}; | |
ZmAccountList.prototype.isSyncStatus=function(a){for(var b=0; | |
b<this.visibleAccounts.length; | |
b++){var c=this.visibleAccounts[b]; | |
if(c.isMain){continue | |
}if(c.status==a){return true | |
}}return false | |
}; | |
ZmAccountList.prototype.accountTypeExists=function(b){for(var a=0; | |
a<this.visibleAccounts.length; | |
a++){var c=this.visibleAccounts[a]; | |
if(b==ZmAccount.TYPE_ZIMBRA&&c.isMain){continue | |
}if(c.type==b){return true | |
}}return false | |
}; | |
ZmAccountList.prototype.syncAll=function(b){var a=(new Array()).concat(this.visibleAccounts); | |
this._sendSync(a,b) | |
}; | |
ZmAccountList.prototype._sendSync=function(a,c){var b=a.shift(); | |
if(b){if(!b.isMain){b.sync() | |
}AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._sendSync,[a,c]),500) | |
}else{if(c){c.run() | |
}}}; | |
ZmAccountList.prototype.createAccounts=function(b,e){var d=appCtxt.accountList.mainAccount; | |
d.id=e.id; | |
d.name=e.name; | |
d.isMain=true; | |
d.isZimbraAccount=true; | |
d.loaded=true; | |
d.visible=true; | |
d.settings=b; | |
d.type=ZmAccount.TYPE_ZIMBRA; | |
d.icon="AccountZimbra"; | |
d.active=true; | |
this._accounts[d.id]=d; | |
delete this._accounts[ZmAccountList.DEFAULT_ID]; | |
this.setActiveAccount(d); | |
if(appCtxt.isOffline){d.displayName=ZmMsg.localFolders | |
}var c=e.childAccounts&&e.childAccounts.childAccount; | |
if(c){for(var a=0; | |
a<c.length; | |
a++){this.add(ZmZimbraAccount.createFromDom(c[a])) | |
}appCtxt.multiAccounts=this.size()>1; | |
appCtxt.isFamilyMbox=appCtxt.multiAccounts&&!appCtxt.isOffline; | |
this.defaultAccount=appCtxt.isFamilyMbox?this.mainAccount:this.visibleAccounts[1] | |
}}; | |
ZmAccountList.prototype.resetTrees=function(){for(var b=0; | |
b<this.visibleAccounts.length; | |
b++){for(var c in trees){var a=trees[c]; | |
if(a&&a.reset){a.reset() | |
}}}}; | |
ZmAccountList.prototype.saveImplicitPrefs=function(){for(var a=0; | |
a<this.visibleAccounts.length; | |
a++){this.visibleAccounts[a].saveImplicitPrefs() | |
}}; | |
ZmAccountList.prototype.getTooltipForVirtualFolder=function(a){var f=0; | |
var e=0; | |
for(var c=0; | |
c<this.visibleAccounts.length; | |
c++){var h=this.visibleAccounts[c]; | |
var g=ZmOrganizer.getSystemId(a,h); | |
var d=appCtxt.getById(g); | |
if(d){f+=d.numTotal; | |
e+=d.sizeTotal | |
}}var b={itemText:ZmMsg.messages,numTotal:f,sizeTotal:e}; | |
return AjxTemplate.expand("share.App#FolderTooltip",b) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmAccount")){ZmAccount=function(b,c,a){if(arguments.length==0){return | |
}this.id=c; | |
this.name=a; | |
this.type=b||ZmAccount.TYPE_ZIMBRA | |
}; | |
ZmAccount.TYPE_AOL="AOL"; | |
ZmAccount.TYPE_GMAIL="Gmail"; | |
ZmAccount.TYPE_IMAP="Imap"; | |
ZmAccount.TYPE_LIVE="Live"; | |
ZmAccount.TYPE_MSE="MSE"; | |
ZmAccount.TYPE_EXCHANGE="Xsync"; | |
ZmAccount.TYPE_PERSONA="PERSONA"; | |
ZmAccount.TYPE_POP="Pop"; | |
ZmAccount.TYPE_YMP="YMP"; | |
ZmAccount.TYPE_ZIMBRA="Zimbra"; | |
ZmAccount.TYPE_CALDAV="CalDAV"; | |
ZmAccount.LOCAL_ACCOUNT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff"; | |
ZmAccount.getTypeName=function(a){switch(a){case ZmAccount.TYPE_AOL:return ZmMsg.aol; | |
case ZmAccount.TYPE_GMAIL:return ZmMsg.gmail; | |
case ZmAccount.TYPE_IMAP:return ZmMsg.accountTypeImap; | |
case ZmAccount.TYPE_LIVE:return ZmMsg.msLive; | |
case ZmAccount.TYPE_MSE:return ZmMsg.msExchange; | |
case ZmAccount.TYPE_EXCHANGE:return ZmMsg.msExchange; | |
case ZmAccount.TYPE_PERSONA:return ZmMsg.accountTypePersona; | |
case ZmAccount.TYPE_POP:return ZmMsg.accountTypePop; | |
case ZmAccount.TYPE_YMP:return ZmMsg.yahooMail; | |
case ZmAccount.TYPE_ZIMBRA:return ZmMsg.zimbraTitle | |
}return ZmMsg.unknown | |
}; | |
ZmAccount.prototype.toString=function(){return"ZmAccount" | |
}; | |
ZmAccount.prototype.setName=function(a){this.name=a | |
}; | |
ZmAccount.prototype.getName=function(){return this.name | |
}; | |
ZmAccount.prototype.setEmail=function(a){throw this.toString()+"#setEmail" | |
}; | |
ZmAccount.prototype.getEmail=function(){throw this.toString()+"#getEmail" | |
}; | |
ZmAccount.prototype.getIdentity=function(){throw this.toString()+"#getIdentity" | |
}; | |
ZmAccount.prototype.isLocal=function(){return this.id==ZmAccount.LOCAL_ACCOUNT_ID | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmZimbraAccount")){ZmZimbraAccount=function(c,a,b){ZmAccount.call(this,null,c,a); | |
this.visible=(b!==false); | |
this.settings=null; | |
this.trees={}; | |
this.loaded=false; | |
this.acl=new ZmAccessControlList(); | |
this.metaData=new ZmMetaData(this) | |
}; | |
ZmZimbraAccount.prototype=new ZmAccount; | |
ZmZimbraAccount.prototype.constructor=ZmZimbraAccount; | |
ZmZimbraAccount.prototype.isZmZimbraAccount=true; | |
ZmZimbraAccount.prototype.toString=function(){return"ZmZimbraAccount" | |
}; | |
ZmZimbraAccount.STATUS_UNKNOWN="unknown"; | |
ZmZimbraAccount.STATUS_OFFLINE="offline"; | |
ZmZimbraAccount.STATUS_ONLINE="online"; | |
ZmZimbraAccount.STATUS_RUNNING="running"; | |
ZmZimbraAccount.STATUS_AUTHFAIL="authfail"; | |
ZmZimbraAccount.STATUS_ERROR="error"; | |
ZmZimbraAccount.prototype.setName=function(b){var a=this.getIdentity(); | |
if(!a){return | |
}a.name=b | |
}; | |
ZmZimbraAccount.prototype.getName=function(){var a=this.getIdentity(); | |
var b=(!a)?this.settings.get(ZmSetting.DISPLAY_NAME):a.name; | |
if(!b){b=this.getDisplayName() | |
}return a.isDefault&&b==ZmIdentity.DEFAULT_NAME?ZmMsg.accountDefault:b | |
}; | |
ZmZimbraAccount.prototype.setEmail=function(a){}; | |
ZmZimbraAccount.prototype.getEmail=function(){return this.name | |
}; | |
ZmZimbraAccount.prototype.getDisplayName=function(){if(!this.displayName){var a=this.isMain?this.settings.get(ZmSetting.DISPLAY_NAME):this._displayName; | |
this.displayName=(this._accountName||a||this.name) | |
}return this.displayName | |
}; | |
ZmZimbraAccount.prototype.getIdentity=function(){var a=appCtxt.getIdentityCollection(this).defaultIdentity; | |
if(!appCtxt.isFamilyMbox||this.isMain){return a | |
}if(!this.dummyIdentity){this.dummyIdentity=new ZmIdentity(this.name); | |
AjxUtil.hashUpdate(this.dummyIdentity,a,true,["name","isDefault"]) | |
}return this.dummyIdentity | |
}; | |
ZmZimbraAccount.prototype.getToolTip=function(){if(this.status||this.lastSync||this.isMain){var c=(this.lastSync&&this.lastSync!=0)?(new Date(parseInt(this.lastSync))):null; | |
var b=appCtxt.get(ZmSetting.QUOTA_USED,null,this); | |
var a; | |
if(!c){if(b>0&&!this.isMain){a=ZmMsg.unknown | |
}}else{a=AjxDateUtil.computeWordyDateStr(new Date(),c) | |
}var d={lastSync:a,hasNotSynced:this.hasNotSynced(),status:this.getStatusMessage(),quota:AjxUtil.formatSize(b,false,1)}; | |
return AjxTemplate.expand("share.App#ZimbraAccountTooltip",d) | |
}return"" | |
}; | |
ZmZimbraAccount.prototype.getDefaultColor=function(){if(this.isMain){return ZmOrganizer.C_GRAY | |
}switch(this.type){case ZmAccount.TYPE_GMAIL:return ZmOrganizer.C_RED; | |
case ZmAccount.TYPE_MSE:return ZmOrganizer.C_GREEN; | |
case ZmAccount.TYPE_EXCHANGE:return ZmOrganizer.C_GREEN; | |
case ZmAccount.TYPE_YMP:return ZmOrganizer.C_PURPLE | |
}return null | |
}; | |
ZmZimbraAccount.prototype.hasNotSynced=function(){return(this.isOfflineInitialSync()&&this.status==ZmZimbraAccount.STATUS_UNKNOWN&&appCtxt.get(ZmSetting.QUOTA_USED,null,this)==0) | |
}; | |
ZmZimbraAccount.prototype.isOfflineInitialSync=function(){return(appCtxt.isOffline&&(!this.lastSync||(this.lastSync&&this.lastSync==0))) | |
}; | |
ZmZimbraAccount.prototype.isCalDavBased=function(){return(this.type==ZmAccount.TYPE_GMAIL||this.type==ZmAccount.TYPE_YMP) | |
}; | |
ZmZimbraAccount.prototype.getDefaultCalendar=function(){var a=appCtxt.getFolderTree(this); | |
if(this.isCalDavBased()){var c=a.getByType(ZmOrganizer.CALENDAR); | |
for(var b=0; | |
b<c.length; | |
b++){if(c[b].nId==ZmOrganizer.ID_CALENDAR){continue | |
}return c[b] | |
}}return a.getById(ZmOrganizer.ID_CALENDAR) | |
}; | |
ZmZimbraAccount.prototype.updateState=function(d){if(this.isMain){return | |
}var g=false; | |
if(this.lastSync!=d.lastsync){this.lastSync=d.lastsync; | |
if(this.visible){g=true | |
}}var a=false; | |
if(this.status!=d.status){this.status=d.status; | |
if(this.visible){a=true | |
}}var b=appCtxt.getOverviewController()._overviewContainer; | |
for(var f in b){var h=b[f]; | |
if(a||g){h.updateAccountInfo(this,a,g) | |
}}if(this.visible&&d.unread!=this.unread){this.unread=d.unread | |
}this.code=d.code; | |
if(d.error){var e=d.error[0]; | |
this.errorDetail=e.exception[0]._content; | |
this.errorMessage=e.message | |
}}; | |
ZmZimbraAccount.prototype.getStatusIcon=function(){if(this.inNewMailMode){return"NewMailAlert" | |
}switch(this.status){case ZmZimbraAccount.STATUS_OFFLINE:return"ImAway"; | |
case ZmZimbraAccount.STATUS_AUTHFAIL:return"ImDnd"; | |
case ZmZimbraAccount.STATUS_ERROR:return"Critical" | |
}return null | |
}; | |
ZmZimbraAccount.prototype.isError=function(){return(this.status==ZmZimbraAccount.STATUS_AUTHFAIL||this.status==ZmZimbraAccount.STATUS_ERROR) | |
}; | |
ZmZimbraAccount.prototype.getIcon=function(){return(this.isMain&&appCtxt.isOffline)?"LocalFolders":this.icon | |
}; | |
ZmZimbraAccount.prototype.getZdMsg=function(a){var b=((ZdMsg["client."+a])||(ZdMsg["exception."+a])); | |
if(!b&&a){b=ZdMsg["exception.offline.UNEXPECTED"] | |
}return b | |
}; | |
ZmZimbraAccount.prototype.getStatusMessage=function(){if(this.inNewMailMode){return AjxMessageFormat.format(ZmMsg.unreadCount,this.unread) | |
}switch(this.status){case ZmZimbraAccount.STATUS_OFFLINE:return ZmMsg.netStatusOffline; | |
case ZmZimbraAccount.STATUS_ONLINE:return ZmMsg.netStatusOnline; | |
case ZmZimbraAccount.STATUS_RUNNING:return ZmMsg.running; | |
case ZmZimbraAccount.STATUS_AUTHFAIL:return this.code?this.getZdMsg(this.code):AjxMessageFormat.format(ZmMsg.authFailure,this.getEmail()); | |
case ZmZimbraAccount.STATUS_ERROR:return this.code?this.getZdMsg(this.code):ZmMsg.error | |
}return"" | |
}; | |
ZmZimbraAccount.prototype.showErrorMessage=function(){if(!this.isError()){return | |
}var c=(this.status==ZmZimbraAccount.STATUS_ERROR)?appCtxt.getErrorDialog():appCtxt.getMsgDialog(); | |
var d=this.getZdMsg(this.code); | |
if(d==""){d=this.getStatusMessage() | |
}c.setMessage(d); | |
if(this.status==ZmZimbraAccount.STATUS_ERROR){var b=[]; | |
var a=0; | |
if(this.errorMessage){b[a++]="<p><b>"; | |
b[a++]=ZdMsg.DebugMsg; | |
b[a++]="</b>: "; | |
b[a++]=this.errorMessage; | |
b[a++]="</p>" | |
}if(this.errorDetail){b[a++]="<p><b>"; | |
b[a++]=ZdMsg.DebugStack; | |
b[a++]="</b>:</p><p><pre>"; | |
b[a++]=this.errorDetail; | |
b[a++]="</pre></p>" | |
}b[a++]="<p><b>"; | |
b[a++]=ZdMsg.DebugActionNote; | |
b[a++]="</b></p>"; | |
c.setDetailString(b.join("")) | |
}c.popup(null,true) | |
}; | |
ZmZimbraAccount.createFromDom=function(a){var b=new ZmZimbraAccount(); | |
b._loadFromDom(a); | |
return b | |
}; | |
ZmZimbraAccount.prototype.load=function(m){if(!this.loaded){this.settings=new ZmSettings(); | |
var g=appCtxt.accountList.mainAccount; | |
for(var d=0; | |
d<ZmApp.APPS.length; | |
d++){var h=ZmApp.APPS[d]; | |
var o=ZmApp.SETTING[h]; | |
if(o&&appCtxt.get(o,null,g)){var b=appCtxt.getApp(h); | |
if(b){b._registerSettings(this.settings) | |
}}}var c=new ZmBatchCommand(null,this.name); | |
var e=new AjxCallback(this,this._handleLoadSettings); | |
this.settings.loadUserSettings(e,null,this.name,null,c); | |
var a=AjxSoapDoc.create("GetTagRequest","urn:zimbraMail"); | |
var l=new AjxCallback(this,this._handleLoadTags); | |
c.addNewRequestParams(a,l); | |
this.loadMetaData(null,c); | |
var k=AjxSoapDoc.create("GetFolderRequest","urn:zimbraMail"); | |
k.getMethod().setAttribute("visible","1"); | |
var j=new AjxCallback(this,this._handleLoadFolders); | |
c.addNewRequestParams(k,j); | |
var n=new AjxCallback(this,this._handleLoadUserInfo,m); | |
var f=new AjxCallback(this,this._handleErrorLoad,m); | |
c.run(n,f) | |
}else{if(m){m.run() | |
}}}; | |
ZmZimbraAccount.prototype.loadMetaData=function(d,b){var a=new AjxCallback(this,this._handleLoadMetaData,[d]); | |
var c=[ZmSetting.M_IMPLICIT,ZmSetting.M_OFFLINE]; | |
this.metaData.load(c,a,b) | |
}; | |
ZmZimbraAccount.prototype.unload=function(){if(!appCtxt.inStartup){this.settings.loadShortcuts(true) | |
}}; | |
ZmZimbraAccount.prototype.sync=function(c){var a=AjxSoapDoc.create("SyncRequest","urn:zimbraOffline"); | |
if(appCtxt.get(ZmSetting.OFFLINE_DEBUG_TRACE)){var b=a.getMethod(); | |
b.setAttribute("debug",1) | |
}appCtxt.getAppController().sendRequest({soapDoc:a,asyncMode:true,noBusyOverlay:true,callback:c,accountName:this.name}) | |
}; | |
ZmZimbraAccount.prototype.save=function(c,b,a){return(this.getIdentity().save(c,b,a)) | |
}; | |
ZmZimbraAccount.prototype.saveImplicitPrefs=function(){var b=this.settings?this.settings.get(ZmSetting.IS_EXTERNAL):false; | |
if(b){return | |
}var c=[]; | |
for(var d in ZmSetting.CHANGED_IMPLICIT){var a=this.settings?this.settings.getSetting(d):null; | |
if(ZmSetting.IS_GLOBAL[a.id]&&!this.isMain){continue | |
}if(a&&(a.getValue(null,true)!=a.getOrigValue(null,true))){c.push(a) | |
}}if(c.length>0){this.settings.save(c,null,null,this) | |
}}; | |
ZmZimbraAccount.prototype.isAppEnabled=function(a){switch(a){case ZmApp.BRIEFCASE:return appCtxt.get(ZmSetting.BRIEFCASE_ENABLED,null,this); | |
case ZmApp.CALENDAR:return appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,this); | |
case ZmApp.CONTACTS:return appCtxt.get(ZmSetting.CONTACTS_ENABLED,null,this); | |
case ZmApp.MAIL:return appCtxt.get(ZmSetting.MAIL_ENABLED,null,this); | |
case ZmApp.PREFERENCES:return appCtxt.get(ZmSetting.OPTIONS_ENABLED,null,this); | |
case ZmApp.TASKS:return appCtxt.get(ZmSetting.TASKS_ENABLED,null,this) | |
}return false | |
}; | |
ZmZimbraAccount.prototype._handleLoadSettings=function(a){this.type=appCtxt.isOffline?appCtxt.get(ZmSetting.OFFLINE_ACCOUNT_FLAVOR,null,this):ZmAccount.TYPE_ZIMBRA; | |
this.isZimbraAccount=this.type==ZmAccount.TYPE_ZIMBRA; | |
switch(this.type){case ZmAccount.TYPE_AOL:this.icon="AccountAOL"; | |
break; | |
case ZmAccount.TYPE_GMAIL:this.icon="AccountGmail"; | |
break; | |
case ZmAccount.TYPE_IMAP:this.icon="AccountIMAP"; | |
break; | |
case ZmAccount.TYPE_LIVE:this.icon="AccountMSN"; | |
break; | |
case ZmAccount.TYPE_MSE:this.icon="AccountExchange"; | |
break; | |
case ZmAccount.TYPE_EXCHANGE:this.icon="AccountExchange"; | |
break; | |
case ZmAccount.TYPE_POP:this.icon="AccountPOP"; | |
break; | |
case ZmAccount.TYPE_YMP:this.icon="AccountYahoo"; | |
break; | |
case ZmAccount.TYPE_ZIMBRA:this.icon="AccountZimbra"; | |
break | |
}var b=a.getResponse().GetInfoResponse; | |
appCtxt.getIdentityCollection(this).initialize(b.identities); | |
appCtxt.getDataSourceCollection(this).initialize(b.dataSources); | |
appCtxt.getSignatureCollection(this).initialize(b.signatures) | |
}; | |
ZmZimbraAccount.prototype._handleLoadFolders=function(a){var c=a.getResponse().GetFolderResponse; | |
var b=c?c.folder[0]:null; | |
if(b){appCtxt.getRequestMgr()._loadTree(ZmOrganizer.FOLDER,null,c.folder[0],"folder",this) | |
}}; | |
ZmZimbraAccount.prototype._handleLoadTags=function(a){var b=a.getResponse().GetTagResponse; | |
appCtxt.getRequestMgr()._loadTree(ZmOrganizer.TAG,null,b,null,this) | |
}; | |
ZmZimbraAccount.prototype._handleLoadUserInfo=function(b){this.loaded=true; | |
var a=appCtxt.getFolderTree(this); | |
if(a){a.getPermissions({noBusyOverlay:true,accountName:this.name}) | |
}if(b){b.run() | |
}}; | |
ZmZimbraAccount.prototype._handleLoadMetaData=function(c,b){for(var a in b){this.settings.createFromJs(b[a]) | |
}if(c){c.run() | |
}}; | |
ZmZimbraAccount.prototype._handleErrorLoad=function(b,a){if(b){b.run() | |
}}; | |
ZmZimbraAccount.prototype._loadFromDom=function(a){this.id=a.id; | |
this.name=a.name; | |
this.visible=a.visible; | |
this.active=a.active; | |
var b=a.attrs&&a.attrs._attrs; | |
this._displayName=b?b.displayName:this.email; | |
this._accountName=b&&b.zimbraPrefLabel | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmAccessControlList")){ZmAccessControlList=function(a){this._aces={} | |
}; | |
ZmAccessControlList.prototype.toString=function(){return"ZmAccessControlList" | |
}; | |
ZmAccessControlList.prototype.load=function(c){var b={GetRightsRequest:{_jsns:"urn:zimbraAccount"}}; | |
var a=new AjxCallback(this,this._handleResponseLoad,[c]); | |
appCtxt.getAppController().sendRequest({jsonObj:b,asyncMode:true,callback:a}) | |
}; | |
ZmAccessControlList.prototype._handleResponseLoad=function(e,a){var b=a.getResponse(); | |
var d=b.GetRightsResponse.ace; | |
if(d&&d.length){for(var c=0; | |
c<d.length; | |
c++){this.add(ZmAccessControlEntry.createFromDom(d[c])) | |
}}if(e){e.run() | |
}}; | |
ZmAccessControlList.prototype.getACLByRight=function(a){return this._aces[a] | |
}; | |
ZmAccessControlList.prototype.getGranteeType=function(n){var b=this._aces[n]; | |
var c=ZmSetting.ACL_PUBLIC; | |
var o={}; | |
if(b&&b.length){for(var g=0; | |
g<b.length; | |
g++){var e=b[g]; | |
var l=(e.granteeType==ZmSetting.ACL_USER||e.granteeType==ZmSetting.ACL_GROUP)?ZmSetting.ACL_USER:e.granteeType; | |
o[l]=e.negative?-1:1 | |
}}var m=(o[ZmSetting.ACL_PUBLIC]==1); | |
var d=(o[ZmSetting.ACL_PUBLIC]==-1); | |
var h=(o[ZmSetting.ACL_AUTH]==1); | |
var f=(o[ZmSetting.ACL_AUTH]==-1); | |
var j=(o[ZmSetting.ACL_DOMAIN]==1); | |
var k=(o[ZmSetting.ACL_USER]==1); | |
var a=(d||f)&&(o[ZmSetting.ACL_USER]==null); | |
if(m){return ZmSetting.ACL_PUBLIC | |
}if(h){return ZmSetting.ACL_AUTH | |
}if(d){if(h){return ZmSetting.ACL_AUTH | |
}}if(k){return ZmSetting.ACL_USER | |
}if(j){return ZmSetting.ACL_DOMAIN | |
}if(a){return ZmSetting.ACL_NONE | |
}return c | |
}; | |
ZmAccessControlList.prototype.getACLByGranteeType=function(d,a){var c=this._aces[d]; | |
var f=[]; | |
if(c&&c.length){for(var b=0; | |
b<c.length; | |
b++){var e=c[b]; | |
if(e.granteeType==a){f.push(e) | |
}}}f.sort(); | |
return f | |
}; | |
ZmAccessControlList.prototype.getGrantees=function(c){var b=this._aces[c]; | |
var e=[]; | |
if(b&&b.length){for(var a=0; | |
a<b.length; | |
a++){var d=b[a]; | |
if(d.granteeType==ZmSetting.ACL_USER||d.granteeType==ZmSetting.ACL_GROUP){e.push(d.grantee) | |
}}}e.sort(); | |
return e | |
}; | |
ZmAccessControlList.prototype.getGranteesInfo=function(c){var b=this._aces[c]; | |
var e=[]; | |
if(b&&b.length){for(var a=0; | |
a<b.length; | |
a++){var d=b[a]; | |
if(d.granteeType==ZmSetting.ACL_USER||d.granteeType==ZmSetting.ACL_GROUP){e.push({grantee:d.grantee,zid:d.zid}) | |
}}}e.sort(ZmAccessControlList.sortByGrantee); | |
return e | |
}; | |
ZmAccessControlList.prototype.grant=function(b,c,a){this._setPerms(b,false,c,a) | |
}; | |
ZmAccessControlList.prototype.revoke=function(b,c,a){this._setPerms(b,true,c,a) | |
}; | |
ZmAccessControlList.prototype._setPerms=function(a,j,h,c){var d=j?"RevokeRightsRequest":"GrantRightsRequest"; | |
var f=AjxSoapDoc.create(d,"urn:zimbraAccount"); | |
for(var e=0; | |
e<a.length; | |
e++){var b=a[e]; | |
var g=f.set("ace"); | |
g.setAttribute("right",b.right); | |
g.setAttribute("gt",b.granteeType); | |
if(b.grantee){g.setAttribute("d",b.grantee) | |
}if(b.zid){g.setAttribute("zid",b.zid) | |
}if(b.negative){g.setAttribute("deny",1) | |
}}var k=new AjxCallback(this,this._handleResponseSetPerms,[j,h]); | |
if(c){c.addNewRequestParams(f,k) | |
}else{appCtxt.getAppController().sendRequest({soapDoc:f,asyncMode:true,callback:k}) | |
}}; | |
ZmAccessControlList.prototype._handleResponseSetPerms=function(h,g,j){var e=j.getResponse(); | |
var d=h?e.RevokeRightsResponse:e.GrantRightsResponse; | |
var a=d&&d.ace; | |
var b=[]; | |
if(a&&a.length){for(var f=0; | |
f<a.length; | |
f++){var c=ZmAccessControlEntry.createFromDom(a[f]); | |
b.push(c); | |
if(h){this.remove(c) | |
}else{this.update(c) | |
}}}if(g){g.run(b) | |
}}; | |
ZmAccessControlList.prototype.add=function(b){if(!b){return | |
}var a=b.right; | |
if(!this._aces[a]){this._aces[a]=[] | |
}this._aces[a].push(b) | |
}; | |
ZmAccessControlList.prototype.remove=function(c){if(!c){return | |
}var d=this._aces[c.right]; | |
var b=[]; | |
if(d&&d.length){for(var a=0; | |
a<d.length; | |
a++){if(d[a].grantee!=c.grantee){b.push(d[a]) | |
}}}this._aces[c.right]=b | |
}; | |
ZmAccessControlList.prototype.update=function(b,e){if(!b||!b.right){return | |
}var d=false; | |
if(!this._aces[b.right]){this._aces[b.right]=[] | |
}var c=this._aces[b.right]; | |
if(c.length){for(var a=0; | |
a<c.length; | |
a++){if((c[a].grantee==b.grantee)&&(c[a].granteeType==b.granteeType)){this._aces[b.right][a]=b; | |
d=true | |
}}}if(!d){this._aces[b.right].push(b) | |
}}; | |
ZmAccessControlList.prototype.cleanup=function(){this._aces={} | |
}; | |
ZmAccessControlList.sortByGrantee=function(e,c){var f=e.grantee||""; | |
var d=c.grantee||""; | |
if(f.toLowerCase()>d.toLowerCase()){return 1 | |
}if(f.toLowerCase()<d.toLowerCase()){return -1 | |
}return 0 | |
}; | |
ZmAccessControlEntry=function(a){this.grantee=a.grantee; | |
this.zid=a.zid; | |
this.granteeType=a.granteeType; | |
this.right=a.right; | |
this.negative=a.negative | |
}; | |
ZmAccessControlEntry.prototype.toString=function(){return"ZmAccessControlEntry" | |
}; | |
ZmAccessControlEntry.createFromDom=function(a){var b={}; | |
b.grantee=a.d; | |
b.granteeType=a.gt; | |
b.zid=a.zid; | |
b.right=a.right; | |
b.negative=(a.deny=="1"); | |
return new ZmAccessControlEntry(b) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmDomainList")){ZmDomainList=function(){ZmModel.call(this) | |
}; | |
ZmDomainList.prototype=new ZmModel; | |
ZmDomainList.prototype.constructor=ZmDomainList; | |
ZmDomainList.prototype.isZmDomainList=true; | |
ZmDomainList.prototype.toString=function(){return"ZmDomainList" | |
}; | |
ZmDomainList.DOMAIN_RE=new RegExp("\\.\\w{2,3}$"); | |
ZmDomainList.prototype.search=function(c,a,f){var e={BrowseRequest:{_jsns:"urn:zimbraMail"}}; | |
var b=e.BrowseRequest; | |
b.browseBy="domains"; | |
if(c&&(/[a-z]/i.test(c))){if(ZmDomainList.DOMAIN_RE.test(c)){b.regex=[".*",AjxStringUtil.regExEscape(c),"$"].join("") | |
}else{b.regex=["^",c,".*"].join("") | |
}}if(a){b.maxToReturn=a | |
}var d=ZmDomainList._handleResponseSearch.bind(null,c,f); | |
appCtxt.getAppController().sendRequest({jsonObj:e,asyncMode:true,callback:d}) | |
}; | |
ZmDomainList._handleResponseSearch=function(f,g,b){var a=b.getResponse().BrowseResponse.bd; | |
var e=[]; | |
if(a){for(var c=0; | |
c<a.length; | |
c++){var d=a[c]; | |
e[c]=new ZmDomain(d._content,d.h) | |
}}e.sort(ZmDomain.sortCompare); | |
g.run(e) | |
}; | |
ZmDomain=function(a,b){ZmModel.call(this); | |
this.name=a.toLowerCase(); | |
this._headerFlags=b | |
}; | |
ZmDomain.prototype=new ZmModel; | |
ZmDomain.prototype.constructor=ZmDomain; | |
ZmDomain.prototype.isZmDomain=true; | |
ZmDomain.prototype.toString=function(){return"ZmDomain" | |
}; | |
ZmDomain.ADDR_FLAG={}; | |
ZmDomain.ADDR_FLAG[AjxEmailAddress.FROM]="f"; | |
ZmDomain.ADDR_FLAG[AjxEmailAddress.TO]="t"; | |
ZmDomain.ADDR_FLAG[AjxEmailAddress.CC]="c"; | |
ZmDomain.sortCompare=function(e,c){var d=ZmOrganizer.checkSortArgs(e,c); | |
if(d!=null){return d | |
}if(e.name<c.name){return -1 | |
}if(e.name>c.name){return 1 | |
}return 0 | |
}; | |
ZmDomain.prototype.hasAddress=function(b){var a=ZmDomain.ADDR_FLAG[b]; | |
return a&&this._headerFlags&&(this._headerFlags.indexOf(a)!=-1) | |
} | |
}if(AjxPackage.define("zimbraMail.share.model.ZmAttachmentTypeList")){ZmAttachmentTypeList=function(){ZmModel.call(this,ZmEvent.S_ATT) | |
}; | |
ZmAttachmentTypeList.prototype=new ZmModel; | |
ZmAttachmentTypeList.prototype.constructor=ZmAttachmentTypeList; | |
ZmAttachmentTypeList.prototype.isZmAttachmentTypeList=true; | |
ZmAttachmentTypeList.prototype.toString=function(){return"ZmAttachmentTypeList" | |
}; | |
ZmAttachmentTypeList.prototype.getAttachments=function(){return this._attachments | |
}; | |
ZmAttachmentTypeList.compareEntry=function(d,c){if(d.desc.toLowerCase()<c.desc.toLowerCase()){return -1 | |
}if(d.desc.toLowerCase()>c.desc.toLowerCase()){return 1 | |
}return 0 | |
}; | |
ZmAttachmentTypeList.prototype.load=function(d){this._attachments=[]; | |
var c={BrowseRequest:{_jsns:"urn:zimbraMail"}}; | |
var a=c.BrowseRequest; | |
a.browseBy="attachments"; | |
var b=this._handleResponseLoad.bind(this,d); | |
appCtxt.getAppController().sendRequest({jsonObj:c,asyncMode:true,callback:b}) | |
}; | |
ZmAttachmentTypeList.prototype._handleResponseLoad=function(f,b){var c=this._organizeTypes(b.getResponse().BrowseResponse.bd); | |
var a=false; | |
if(c){for(var d=0; | |
d<c.length; | |
d++){var e=c[d]._content; | |
if(!ZmMimeTable.isIgnored(e)){this._attachments.push(ZmMimeTable.getInfo(e,true)) | |
}}this._attachments.sort(ZmAttachmentTypeList.compareEntry) | |
}if(f){f.run(this._attachments) | |
}}; | |
ZmAttachmentTypeList.prototype._isSupportedType=function(a){var b=[ZmMimeTable.APP_ADOBE_PDF,ZmMimeTable.APP_MS_WORD,ZmMimeTable.APP_MS_EXCEL,ZmMimeTable.APP_MS_PPT,ZmMimeTable.APP_ZIP,ZmMimeTable.APP_ZIP2,ZmMimeTable.MSG_RFC822,ZmMimeTable.TEXT_HTML,ZmMimeTable.TEXT_CAL]; | |
return AjxUtil.arrayContains(b,a) | |
}; | |
ZmAttachmentTypeList.prototype._isSupportedGroup=function(c){var d=[ZmMimeTable.APP,ZmMimeTable.AUDIO,ZmMimeTable.IMG,ZmMimeTable.TEXT,ZmMimeTable.VIDEO]; | |
var b=new RegExp("^"+d.join("|^"),"ig"); | |
var a=c.match(b); | |
return a&&a[0] | |
}; | |
ZmAttachmentTypeList.prototype._organizeTypes=function(b){var e=[]; | |
if(!(b&&b.length)){return e | |
}for(var d=0; | |
d<b.length; | |
d++){var f=b[d]._content; | |
var h=b[d].freq; | |
var g=true; | |
var a=null; | |
if(this._isSupportedType(f)){g=false | |
}else{if(f=this._isSupportedGroup(f)){g=false; | |
for(var c=0; | |
c<e.length; | |
c++){if(e[c]._content===f){e[c].freq+=h; | |
g=true; | |
break | |
}}}}if(!g){e.push({_content:f,freq:h}) | |
}}return e | |
} | |
}if(AjxPackage.define("zimbraMail.core.ZmApp")){ZmApp=function(c,b,a){if(arguments.length==0){return | |
}this._name=c; | |
this._container=b; | |
this._parentController=a; | |
this._active=false; | |
this.currentSearch=null; | |
this._defaultFolderId=null; | |
this._deferredFolders=[]; | |
this._deferredFolderHash={}; | |
this._deferredNotifications=[]; | |
this._sessionController={}; | |
this._nextSessionId={}; | |
this._curSessionId={}; | |
ZmApp.DROP_TARGETS[c]={}; | |
this._defineAPI(); | |
if(!a){this._registerSettings() | |
}this._registerOperations(); | |
this._registerItems(); | |
this._registerOrganizers(); | |
if(!a){this._setupSearchToolbar() | |
}this._registerApp() | |
}; | |
ZmApp.CLASS={}; | |
ZmApp.SETTING={}; | |
ZmApp.UPSELL_SETTING={}; | |
ZmApp.LOAD_SORT={}; | |
ZmApp.BUTTON_ID={}; | |
ZmApp.MAIN_PKG={}; | |
ZmApp.NAME={}; | |
ZmApp.ICON={}; | |
ZmApp.TEXT_PRECEDENCE={}; | |
ZmApp.IMAGE_PRECEDENCE={}; | |
ZmApp.QS_ARG={}; | |
ZmApp.QS_ARG_R={}; | |
ZmApp.CHOOSER_TOOLTIP={}; | |
ZmApp.VIEW_TOOLTIP={}; | |
ZmApp.DEFAULT_SEARCH={}; | |
ZmApp.ORGANIZER={}; | |
ZmApp.OVERVIEW_TREES={}; | |
ZmApp.HIDE_ZIMLETS={}; | |
ZmApp.SEARCH_TYPES={}; | |
ZmApp.SEARCH_TYPES_R={}; | |
ZmApp.GOTO_ACTION_CODE={}; | |
ZmApp.GOTO_ACTION_CODE_R={}; | |
ZmApp.NEW_ACTION_CODE={}; | |
ZmApp.ACTION_CODES={}; | |
ZmApp.ACTION_CODES_R={}; | |
ZmApp.OPS={}; | |
ZmApp.OPS_R={}; | |
ZmApp.QS_VIEWS={}; | |
ZmApp.TRASH_VIEW_OP={}; | |
ZmApp.UPSELL_URL={}; | |
ZmApp.DROP_TARGETS={}; | |
ZmApp.SEARCH_RESULTS_TAB={}; | |
ZmApp.CHOOSER_SORT={}; | |
ZmApp.DEFAULT_SORT={}; | |
ZmApp.ENABLED_APPS={}; | |
ZmApp.APPS=[]; | |
ZmApp.DEFAULT_APPS=[]; | |
ZmApp.OVERVIEW_ID="main"; | |
ZmApp.BATCH_NOTIF_LIMIT=25; | |
ZmApp.MAIN_SESSION="main"; | |
ZmApp.HIDDEN_SESSION="hidden"; | |
ZmApp.initialize=function(){if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){ZmApp.ACTION_CODES[ZmKeyMap.NEW_FOLDER]=ZmOperation.NEW_FOLDER; | |
ZmApp.ACTION_CODES[ZmKeyMap.NEW_TAG]=ZmOperation.NEW_TAG | |
}}; | |
ZmApp.registerApp=function(e,d){if(d.mainPkg){ZmApp.MAIN_PKG[e]=d.mainPkg | |
}if(d.nameKey){ZmApp.NAME[e]=d.nameKey | |
}if(d.icon){ZmApp.ICON[e]=d.icon | |
}if(d.textPrecedence){ZmApp.TEXT_PRECEDENCE[e]=d.textPrecedence | |
}if(d.imagePrecedence){ZmApp.IMAGE_PRECEDENCE[e]=d.imagePrecedence | |
}if(d.chooserTooltipKey){ZmApp.CHOOSER_TOOLTIP[e]=d.chooserTooltipKey | |
}if(d.viewTooltipKey){ZmApp.VIEW_TOOLTIP[e]=d.viewTooltipKey | |
}if(d.defaultSearch){ZmApp.DEFAULT_SEARCH[e]=d.defaultSearch | |
}if(d.organizer){ZmApp.ORGANIZER[e]=d.organizer | |
}if(d.overviewTrees){ZmApp.OVERVIEW_TREES[e]=d.overviewTrees | |
}if(d.hideZimlets){ZmApp.HIDE_ZIMLETS[e]=d.hideZimlets | |
}if(d.searchTypes){ZmApp.SEARCH_TYPES[e]=d.searchTypes | |
}if(d.gotoActionCode){ZmApp.GOTO_ACTION_CODE[e]=d.gotoActionCode | |
}if(d.newActionCode){ZmApp.NEW_ACTION_CODE[e]=d.newActionCode | |
}if(d.qsViews){ZmApp.QS_VIEWS[e]=d.qsViews | |
}if(d.chooserSort){ZmApp.CHOOSER_SORT[e]=d.chooserSort | |
}if(d.defaultSort){ZmApp.DEFAULT_SORT[e]=d.defaultSort | |
}if(d.trashViewOp){ZmApp.TRASH_VIEW_OP[e]=d.trashViewOp | |
}if(d.upsellUrl){ZmApp.UPSELL_URL[e]=d.upsellUrl | |
}if(d.searchResultsTab){ZmApp.SEARCH_RESULTS_TAB[e]=d.searchResultsTab | |
}if(d.searchTypes){ZmApp.SEARCH_TYPES_R[e]={}; | |
for(var b=0; | |
b<d.searchTypes.length; | |
b++){ZmApp.SEARCH_TYPES_R[e][d.searchTypes[b]]=true | |
}}if(d.gotoActionCode){ZmApp.GOTO_ACTION_CODE_R[d.gotoActionCode]=e | |
}if(d.actionCodes){for(var c in d.actionCodes){if(!c){continue | |
}ZmApp.ACTION_CODES_R[c]=e; | |
ZmApp.ACTION_CODES[c]=d.actionCodes[c] | |
}}var a=appCtxt.get(ZmApp.SETTING[e]); | |
if(d.newItemOps&&a){for(var f in d.newItemOps){if(!f){continue | |
}ZmApp.OPS_R[f]=e; | |
ZmOperation.NEW_ITEM_OPS.push(f); | |
ZmOperation.NEW_ITEM_KEY[f]=d.newItemOps[f] | |
}}if(d.newOrgOps&&a){for(var f in d.newOrgOps){if(!f){continue | |
}ZmApp.OPS_R[f]=e; | |
ZmOperation.NEW_ORG_OPS.push(f); | |
ZmOperation.NEW_ORG_KEY[f]=d.newOrgOps[f] | |
}}if(d.qsViews){for(var b=0; | |
b<d.qsViews.length; | |
b++){ZmApp.QS_VIEWS[d.qsViews[b]]=e | |
}}}; | |
ZmApp.runAppFunction=function(d){var b; | |
for(var a in ZmApp.CLASS){var e=window[ZmApp.CLASS[a]]; | |
var c=e&&e[d]; | |
if(c&&(typeof(c)=="function")){b=b||Array.prototype.slice.call(arguments,1); | |
c.apply(e,b) | |
}}}; | |
ZmApp.prototype.toString=function(){return"ZmApp" | |
}; | |
ZmApp.prototype._defineAPI=function(){}; | |
ZmApp.prototype._registerSettings=function(){}; | |
ZmApp.prototype._registerOperations=function(){}; | |
ZmApp.prototype._registerItems=function(){}; | |
ZmApp.prototype._registerOrganizers=function(){}; | |
ZmApp.prototype._setupSearchToolbar=function(){}; | |
ZmApp.prototype._registerApp=function(){}; | |
ZmApp.prototype._registerPrefs=function(){}; | |
ZmApp.prototype.startup=function(a){}; | |
ZmApp.prototype.preNotify=function(a){}; | |
ZmApp.prototype.deleteNotify=function(a){}; | |
ZmApp.prototype.createNotify=function(a){}; | |
ZmApp.prototype.modifyNotify=function(a){}; | |
ZmApp.prototype.postNotify=function(a){}; | |
ZmApp.prototype.refresh=function(a){}; | |
ZmApp.prototype.handleOp=function(b,a){}; | |
ZmApp.prototype.getName=function(){return this._name | |
}; | |
ZmApp.prototype.getDisplayName=function(){return ZmMsg[ZmApp.NAME[this._name]]||ZmApp.NAME[this._name] | |
}; | |
ZmApp.prototype.getInitialSearchType=function(){return null | |
}; | |
ZmApp.prototype.getLimit=function(a){return appCtxt.get(ZmSetting.PAGE_SIZE) | |
}; | |
ZmApp.prototype.setAppView=function(a){appCtxt.getAppViewMgr().setAppView(this._name,a) | |
}; | |
ZmApp.prototype.createView=function(a){a.appName=this._name; | |
return appCtxt.getAppViewMgr().createView(a) | |
}; | |
ZmApp.prototype.pushView=function(a,b){return appCtxt.getAppViewMgr().pushView(a,b) | |
}; | |
ZmApp.prototype.popView=function(b,a,c){return appCtxt.getAppViewMgr().popView(b,a,c) | |
}; | |
ZmApp.prototype.setView=function(a,b){return appCtxt.getAppViewMgr().setView(a,b) | |
}; | |
ZmApp.prototype.stageView=function(a){return appCtxt.getAppViewMgr().stageView(a) | |
}; | |
ZmApp.prototype.addDeferredFolder=function(a){var b=a.obj&&a.obj.id; | |
if(b&&!this._deferredFolderHash[b]){this._deferredFolders.push(a); | |
this._deferredFolderHash[b]=true; | |
appCtxt.cacheSetDeferred(b,this._name) | |
}}; | |
ZmApp.prototype.getRemoteFolderIds=function(g){var f=[]; | |
if(appCtxt.getOverviewController(true)){var d=ZmApp.ORGANIZER[this.getName()]; | |
if(this._deferredFolders.length){this._createDeferredFolders(d) | |
}var a=appCtxt.getFolderTree(g); | |
var c=a?a.getByType(d):[]; | |
for(var b=0; | |
b<c.length; | |
b++){var e=c[b]; | |
if(e.isRemote()){f.push(e.id) | |
}}}return f | |
}; | |
ZmApp.prototype.getOverviewPanelContent=function(){if(!this._overviewPanelContent){var b=this._getOverviewParams(); | |
b.overviewId=this.getOverviewId(); | |
var a=this._overviewPanelContent=appCtxt.getOverviewController().createOverview(b); | |
a.set(this._getOverviewTrees()) | |
}return this._overviewPanelContent | |
}; | |
ZmApp.prototype.getOverviewContainer=function(c){if(!this._overviewContainer&&!c){var a={appName:this._name,containerId:([ZmApp.OVERVIEW_ID,this._name].join("_")),posStyle:Dwt.ABSOLUTE_STYLE}; | |
var b=this._getOverviewParams(); | |
b.overviewTrees=this._getOverviewTrees(); | |
this._overviewContainer=appCtxt.getOverviewController().createOverviewContainer(a,b) | |
}return this._overviewContainer | |
}; | |
ZmApp.prototype.setOverviewPanelContent=function(d){if(d){this._overviewPanelContent=null; | |
this._overviewContainer=null | |
}var a=appCtxt.getAppViewMgr(); | |
if(!a.isFullScreen()){Dwt.setLoadingTime(this.toString()+"-overviewPanel"); | |
var b=((appCtxt.multiAccounts&&appCtxt.accountList.size()>1)||this.getName()==ZmApp.VOICE)?this.getOverviewContainer():this.getOverviewPanelContent(); | |
var c={}; | |
c[ZmAppViewMgr.C_TREE]=b; | |
a.setViewComponents(ZmAppViewMgr.APP,c,true,this.getName()); | |
Dwt.setLoadedTime(this.toString()+"-overviewPanel") | |
}}; | |
ZmApp.prototype.getOverview=function(){var a=appCtxt.getOverviewController(); | |
return a&&a.getOverview(this.getOverviewId()) | |
}; | |
ZmApp.prototype.resetOverview=function(b){var n=b?appCtxt.getOverviewController().getOverview(b):this.getOverview(); | |
if(n){var f=[]; | |
var m=n.getTreeViews(),k=m.length; | |
for(var e=0; | |
e<k; | |
e++){var h=m[e]; | |
var a=n.getTreeView(h); | |
if(a){var l=a.getTreeItemList(); | |
var d=l.length; | |
for(var c=0; | |
c<d; | |
c++){var g=l[c]; | |
if(g._expanded){f.push(g._htmlElId) | |
}}}}n.clear(); | |
n.set(this._getOverviewTrees()); | |
k=f.length; | |
for(var e=0; | |
e<k; | |
e++){var g=DwtControl.fromElementId(f[e]); | |
if(g&&!g._expanded){g.setExpanded(true) | |
}}}}; | |
ZmApp.prototype.getOverviewId=function(a){return appCtxt.getOverviewId([ZmApp.OVERVIEW_ID,this._name],a) | |
}; | |
ZmApp.prototype._getOverviewParams=function(){var a=[]; | |
for(var c in ZmOverviewController.CONTROLLER){a.push(c) | |
}var b=function(e,d){return(ZmOrganizer.DISPLAY_ORDER[e]||9999)-(ZmOrganizer.DISPLAY_ORDER[d]||9999) | |
}; | |
a.sort(b); | |
return{posStyle:Dwt.ABSOLUTE_STYLE,selectionSupported:true,actionSupported:true,dndSupported:true,showUnread:true,showNewButtons:true,isAppOverview:true,treeIds:a,appName:this._name,account:appCtxt.getActiveAccount()} | |
}; | |
ZmApp.prototype._getOverviewTrees=function(){var d=ZmApp.OVERVIEW_TREES[this._name]||[]; | |
var b=[]; | |
for(var a=0,c=d.length; | |
a<c; | |
a++){if((d[a]==ZmOrganizer.FOLDER&&!appCtxt.get(ZmSetting.MAIL_ENABLED))){continue | |
}b.push(d[a]) | |
}if(!appCtxt.multiAccounts&&window[ZmOverviewController.CONTROLLER[ZmOrganizer.ZIMLET]]&&!ZmApp.HIDE_ZIMLETS[this._name]){b.push(ZmOrganizer.ZIMLET) | |
}return b | |
}; | |
ZmApp.prototype.getNumSessionControllers=function(b){var c=this._sessionController[b]||[]; | |
var a=0; | |
for(var d in c){if(!c[d].inactive){a++ | |
}}return a | |
}; | |
ZmApp.prototype.getTypeFromController=function(controllerClass){var controller=eval(controllerClass); | |
if(!controller.getDefaultViewType){throw new AjxException("Session controller "+controllerClass+" must implement getDefaultViewType()") | |
}return controller.getDefaultViewType() | |
}; | |
ZmApp.prototype.getSessionController=function(params){var type=this.getTypeFromController(params.controllerClass); | |
if(!this._sessionController[type]){this._sessionController[type]={}; | |
this._nextSessionId[type]=1 | |
}var sessionId=params.sessionId; | |
if(sessionId&&this._sessionController[type][sessionId]){return this._sessionController[type][sessionId] | |
}var controller; | |
if(!sessionId){var controllers=this._sessionController[type]; | |
for(var id in controllers){if(controllers[id].inactive&&!controllers[id].isPinned&&!controllers[id].isHidden){controller=controllers[id]; | |
break | |
}}}sessionId=(controller&&controller.getSessionId())||sessionId||String(this._nextSessionId[type]++); | |
if(!controller){var ctlrClass=eval(params.controllerClass); | |
controller=this._sessionController[type][sessionId]=new ctlrClass(this._container,this,type,sessionId,params.searchResultsController) | |
}this._curSessionId[type]=sessionId; | |
controller.inactive=false; | |
return controller | |
}; | |
ZmApp.prototype.deleteSessionController=function(c){var a=this.getTypeFromController(c.controllerClass); | |
var b=c.sessionId; | |
if(!this._sessionController[a]){return | |
}delete this._sessionController[a][b] | |
}; | |
ZmApp.prototype.getCurrentSessionId=function(a){return this._curSessionId[a] | |
}; | |
ZmApp.prototype.getAllControllers=function(){var e=[]; | |
for(var c in this._sessionController){var d=this._sessionController[c]; | |
if(d){for(var b in d){var a=d[b]; | |
if(a){e.push(a) | |
}}}}return e | |
}; | |
ZmApp.prototype._addSettingsChangeListeners=function(){if(!this._settingListener){this._settingListener=new AjxListener(this,this._settingChangeListener) | |
}}; | |
ZmApp.prototype._settingChangeListener=function(a){}; | |
ZmApp.prototype.getNewButtonProps=function(){return{} | |
}; | |
ZmApp.prototype.getSearchParams=function(a){return(a||{}) | |
}; | |
ZmApp.prototype._postLoadCore=function(){if(!appCtxt.isChildWindow){this._setupDropTargets() | |
}}; | |
ZmApp.prototype._postLoad=function(a){if(a){this._createDeferredFolders(a) | |
}this._handleDeferredNotifications(); | |
if(appCtxt.isExternalAccount()){this._handleExternalAccountSettings(a) | |
}}; | |
ZmApp.prototype.containsWritableFolder=function(){return appCtxt.isExternalAccount()?(this._containsWritableFolder?true:false):true | |
}; | |
ZmApp.prototype.getDefaultFolderId=function(){return this._defaultFolderId | |
}; | |
ZmApp.prototype._handleExternalAccountSettings=function(d){var f=appCtxt.getTree(d,appCtxt.getActiveAccount()),c=f?f.getByType(d):[],a=c.length,e,b; | |
this._containsWritableFolder=false; | |
for(b=0; | |
b<a; | |
b++){e=c[b]; | |
if(!this._defaultFolderId){this._defaultFolderId=e.id | |
}if(e.isPermAllowed(ZmOrganizer.PERM_WRITE)){this._containsWritableFolder=true | |
}}}; | |
ZmApp.prototype._setupDropTargets=function(){var c=ZmApp.DROP_TARGETS[this._name]; | |
for(var f in c){var b=c[f]; | |
for(var d=0; | |
d<b.length; | |
d++){var g=b[d]; | |
var a=appCtxt.getOverviewController().getTreeController(g,true); | |
var e=ZmList.ITEM_CLASS[f]||ZmOrganizer.ORG_CLASS[f]; | |
if(a){a._dropTgt.addTransferType(e) | |
}else{if(!ZmTreeController.DROP_SOURCES[g]){ZmTreeController.DROP_SOURCES[g]=[] | |
}ZmTreeController.DROP_SOURCES[g].push(e) | |
}}}}; | |
ZmApp.prototype.disposeTreeControllers=function(){var a=appCtxt.getOverviewController(true); | |
if(!a){return | |
}var c=ZmApp.DROP_TARGETS[this._name]; | |
for(var e in c){var b=c[e]; | |
for(var d=0; | |
d<b.length; | |
d++){var g=b[d]; | |
var f=a.getTreeController(g,true); | |
if(!f){continue | |
}f.dispose() | |
}}}; | |
ZmApp.prototype.createDeferred=function(){var c=ZmOrganizer.APP2ORGANIZER[this._name]||[]; | |
for(var b=0; | |
b<c.length; | |
b++){var d=c[b]; | |
var a=ZmOrganizer.ORG_PACKAGE[d]; | |
AjxDispatcher.require(a); | |
this._createDeferredFolders(d) | |
}}; | |
ZmApp.prototype._createDeferredFolders=function(b){for(var a=0; | |
a<this._deferredFolders.length; | |
a++){var d=this._deferredFolders[a]; | |
var c=ZmFolderTree.createFolder(d.type,d.parent,d.obj,d.tree,d.path,d.elementType); | |
if(appCtxt.isExternalAccount()&&c.isSystem()){continue | |
}d.parent.children.add(c); | |
c.parent=d.parent; | |
ZmFolderTree._traverse(c,d.obj,d.tree,d.path||[]) | |
}this._clearDeferredFolders() | |
}; | |
ZmApp.prototype._clearDeferredFolders=function(){this._deferredFolders=[]; | |
this._deferredFolderHash={} | |
}; | |
ZmApp.prototype._deferNotifications=function(b,c){var a=ZmApp.MAIN_PKG[this._name]; | |
if(a&&!AjxDispatcher.loaded(a)){this._deferredNotifications.push({type:b,data:c}); | |
return true | |
}else{this._noDefer=true; | |
return false | |
}}; | |
ZmApp.prototype._handleDeferredNotifications=function(){var b=this._deferredNotifications; | |
for(var c=0; | |
c<b.length; | |
c++){var a=b[c]; | |
if(a.type=="delete"){this.deleteNotify(a.data,true) | |
}else{if(a.type=="create"){this.createNotify(a.data,true) | |
}else{if(a.type=="modify"){this.modifyNotify(a.data,true) | |
}}}}}; | |
ZmApp.prototype._batchNotify=function(j){if(!(j&&j.length>=ZmApp.BATCH_NOTIF_LIMIT)){return | |
}var b={},k,c=false; | |
for(var d=0,e=j.length; | |
d<e; | |
d++){var h=j[d]; | |
k=appCtxt.cacheGet(h.id); | |
if(k){var g=k.notifyModify(h,true); | |
if(g){if(!b[g]){b[g]=[] | |
}h.item=k; | |
b[g].push(h); | |
c=true | |
}}}if(!c||!k){return | |
}var f=k.list; | |
if(!f){return | |
}f._evt.batchMode=true; | |
f._evt.item=k; | |
f._evt.items=null; | |
for(var g in b){var a={notifs:b[g]}; | |
f._notify(g,a) | |
}}; | |
ZmApp.prototype._inNewWindow=function(b){if(appCtxt.isWebClientOffline()){return false | |
}else{var a=appCtxt.get(ZmSetting.NEW_WINDOW_COMPOSE); | |
return !b?a:((!a&&b&&b.shiftKey)||(a&&b&&!b.shiftKey)) | |
}}; | |
ZmApp.prototype._handleCreateFolder=function(a,c){var b=appCtxt.getById(a.l); | |
if(b&&(ZmOrganizer.VIEW_HASH[c][a.view])){b.notifyCreate(a,"folder"); | |
a._handled=true | |
}}; | |
ZmApp.prototype._handleCreateLink=function(b,d){var c=appCtxt.getById(b.l); | |
var a=b.view||"message"; | |
if(c&&c.supportsSharing()&&(ZmOrganizer.VIEW_HASH[d][a])){c.notifyCreate(b,"link"); | |
b._handled=true | |
}}; | |
ZmApp.prototype.launch=function(a,b){this.createDeferred(); | |
if(b){b.run() | |
}}; | |
ZmApp.prototype.activate=function(b,a){this._active=b; | |
if(b){appCtxt.getAppController().setNewButtonProps(this.getNewButtonProps()); | |
this.setOverviewPanelContent(); | |
this.stopAlert(); | |
if(appCtxt.isWebClientOfflineSupported){this.resetWebClientOfflineOperations() | |
}this._setRefreshButtonTooltip() | |
}}; | |
ZmApp.prototype.resetWebClientOfflineOperations=function(){var c=!appCtxt.isWebClientOffline(); | |
var d=this.getOverview(); | |
if(d){var a=d.getTreeView(ZmOrganizer.ZIMLET); | |
if(a){a.setVisible(c) | |
}d.actionSupported=c; | |
d.dndSupported=c | |
}var b=appCtxt.getAppController().getNewButton(); | |
if(b){if(ZmController._defaultNewId===ZmOperation.NEW_MESSAGE){b._setDropDownCellMouseHandlers(c) | |
}else{b.setEnabled(c) | |
}}}; | |
ZmApp.prototype.isActive=function(){return this._active | |
}; | |
ZmApp.prototype.reset=function(a){}; | |
ZmApp.prototype.startAlert=function(){AjxDispatcher.require("Alert"); | |
this._alert=this._alert||new ZmAppAlert(this); | |
this._alert.start() | |
}; | |
ZmApp.prototype.stopAlert=function(){if(this._alert){this._alert.stop() | |
}}; | |
ZmApp.prototype._setRefreshButtonTooltip=function(){if(appCtxt.refreshButton){appCtxt.refreshButton.setToolTipContent(this._getRefreshButtonTooltip()) | |
}}; | |
ZmApp.prototype._getRefreshButtonTooltip=function(){return ZmMsg.checkMailPrefUpdate | |
}; | |
ZmApp.prototype._notifyRendered=function(){if(!this._hasRendered){appCtxt.getAppController().appRendered(this._name); | |
this._hasRendered=true | |
}this.stopAlert() | |
}; | |
ZmApp.prototype._getExternalAccount=function(){var b; | |
if(appCtxt.multiAccounts){var c=appCtxt.accountList.visibleAccounts; | |
for(var a=0; | |
a<c.length; | |
a++){var d=c[a]; | |
if(d.isMain){continue | |
}if(appCtxt.get(ZmApp.SETTING[this.name],null,d)){b=d; | |
break | |
}}}return b | |
}; | |
ZmApp.prototype._setLaunchTime=function(a,b){if(!window.isPerfMetric){return | |
}var d=a+"_launched"; | |
if(!b){b=new Date() | |
}if(!document.getElementById(d)){var c=document.createElement("DIV"); | |
c.id=d; | |
c.innerHTML=b.getTime(); | |
c.style.display="none"; | |
document.body.appendChild(c) | |
}if(window.appDevMode){console.profile(d) | |
}}; | |
ZmApp.prototype._setLoadedTime=function(a,b){if(!window.isPerfMetric){return | |
}var d=a+"_loaded"; | |
if(!b){b=new Date() | |
}if(!document.getElementById(d)){var c=document.createElement("DIV"); | |
c.id=d; | |
c.innerHTML=b.getTime(); | |
c.style.display="none"; | |
document.body.appendChild(c) | |
}if(window.appDevMode){console.profileEnd() | |
}} | |
}if(AjxPackage.define("zimbraMail.share.ZmSearchApp")){ZmSearchApp=function(b,a){ZmApp.call(this,ZmApp.SEARCH,b,a); | |
this._groupBy=appCtxt.get(ZmSetting.GROUP_MAIL_BY) | |
}; | |
ZmSearchApp.prototype=new ZmApp; | |
ZmSearchApp.prototype.constructor=ZmSearchApp; | |
ZmSearchApp.prototype.isZmSearchApp=true; | |
ZmSearchApp.prototype.toString=function(){return"ZmSearchApp" | |
}; | |
ZmApp.SEARCH=ZmId.APP_SEARCH; | |
ZmApp.CLASS[ZmApp.SEARCH]="ZmSearchApp"; | |
ZmApp.SETTING[ZmApp.SEARCH]=ZmSetting.SEARCH_ENABLED; | |
ZmSearchApp.CONTROLLER_CLASS="ZmSearchResultsController"; | |
ZmSearchApp.prototype.getSearchResultsController=function(b,a){return this.getSessionController({controllerClass:ZmSearchApp.CONTROLLER_CLASS,sessionId:b,appName:a}) | |
}; | |
ZmSearchApp.prototype.activate=function(a){this._active=a | |
}; | |
ZmSearchApp.prototype.resetWebClientOfflineOperations=function(b){ZmApp.prototype.resetWebClientOfflineOperations.apply(this); | |
if(!b){var e=this.getTypeFromController(ZmSearchApp.CONTROLLER_CLASS); | |
var d=this.getCurrentSessionId(e); | |
b=this.getSearchResultsController(d) | |
}var c=b&&b._toolbar; | |
var a=c&&c.getButton(ZmSearchToolBar.SAVE_BUTTON); | |
if(a){a.setEnabled(!appCtxt.isWebClientOffline()) | |
}}; | |
ZmSearchApp.prototype.getGroupMailBy=function(){return ZmMailApp.prototype.getGroupMailBy.call(this) | |
}; | |
ZmSearchApp.prototype.setGroupMailBy=function(a){this._groupBy=a | |
} | |
}if(AjxPackage.define("zimbraMail.share.ZmSocialApp")){ZmSocialApp=function(a){ZmApp.call(this,ZmApp.SOCIAL,a) | |
}; | |
ZmSocialApp.prototype=new ZmApp; | |
ZmSocialApp.prototype.constructor=ZmSocialApp; | |
ZmSocialApp.prototype.isZmSocialApp=true; | |
ZmSocialApp.prototype.toString=function(){return"ZmSocialApp" | |
}; | |
ZmApp.SOCIAL=ZmId.APP_SOCIAL; | |
ZmApp.CLASS[ZmApp.SOCIAL]="ZmSocialApp"; | |
ZmApp.SETTING[ZmApp.SOCIAL]=ZmSetting.SOCIAL_ENABLED; | |
ZmApp.UPSELL_SETTING[ZmApp.SOCIAL]=ZmSetting.SOCIAL_EXTERNAL_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.SOCIAL]=100; | |
ZmSocialApp.prototype._registerApp=function(){ZmApp.registerApp(ZmApp.SOCIAL,{nameKey:"communityName",icon:"Globe",chooserTooltipKey:"goToSocial",chooserSort:32,defaultSort:100,upsellUrl:ZmSetting.SOCIAL_EXTERNAL_URL}); | |
var a=appCtxt.get(ZmSetting.SOCIAL_NAME); | |
if(a){ZmMsg[ZmApp.NAME[this._name]]=a | |
}}; | |
ZmSocialApp.prototype.runRefresh=function(){var a=appCtxt.getAppController(),b=a._appIframeView[ZmApp.SOCIAL]; | |
if(b){b.runRefresh() | |
}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmPopupMenu")){ZmPopupMenu=function(c,b,e,a){if(arguments.length==0){return | |
}var d=Dwt.getParams(arguments,ZmPopupMenu.PARAMS); | |
d.className=d.className?d.className:"ActionMenu"; | |
d.style=d.style||DwtMenu.POPUP_STYLE; | |
d.id=d.id||"POPUP_"+Dwt.getNextId(); | |
DwtMenu.call(this,d); | |
a=a||appCtxt.getCurrentController(); | |
if(a){this._controller=a; | |
this._keyMap=this._controller.getKeyMapName() | |
}this._menuItems={} | |
}; | |
ZmPopupMenu.PARAMS=["parent","className","id","controller"]; | |
ZmPopupMenu.prototype=new DwtMenu; | |
ZmPopupMenu.prototype.constructor=ZmPopupMenu; | |
ZmPopupMenu.prototype.isZmPopupMenu=true; | |
ZmPopupMenu.prototype.toString=function(){return"ZmPopupMenu" | |
}; | |
ZmPopupMenu.prototype.addSelectionListener=function(d,c,a){var b=this._menuItems[d]; | |
if(b){b.addSelectionListener(c,a) | |
}}; | |
ZmPopupMenu.prototype.removeSelectionListener=function(c,b){var a=this._menuItems[c]; | |
if(a){a.removeSelectionListener(b) | |
}}; | |
ZmPopupMenu.prototype.popup=function(b,a,d,c){b=b?b:0; | |
a=(a!=null)?a:Dwt.DEFAULT; | |
d=(d!=null)?d:Dwt.DEFAULT; | |
DwtMenu.prototype.popup.call(this,b,a,d,c) | |
}; | |
ZmPopupMenu.prototype.enable=function(c,a){c=(c instanceof Array)?c:[c]; | |
for(var b=0; | |
b<c.length; | |
b++){if(this._menuItems[c[b]]){this._menuItems[c[b]].setEnabled(a) | |
}}}; | |
ZmPopupMenu.prototype.enableAll=function(a){for(var b in this._menuItems){this._menuItems[b].setEnabled(a) | |
}}; | |
ZmPopupMenu.prototype.createMenuItem=function(e,d,b){var a=this._menuItems[e]=new DwtMenuItem({parent:this,style:d.style,radioGroupId:d.radioGroupId,id:(b||d.id||e),index:d.index}); | |
if(d.image){a.setImage(d.image) | |
}if(d.text){a.setText(AjxStringUtil.htmlEncode(d.text)) | |
}if(d.shortcut){a.setShortcut(appCtxt.getShortcutHint(this._keyMap,d.shortcut)) | |
}a.setEnabled(d.enabled!==false); | |
a.setData(ZmOperation.MENUITEM_ID,e); | |
var c=a.getRowElement(); | |
if(c){c.setAttribute("id","POPUP_"+a.getHTMLElId().toString().replace(/\s/g,"")) | |
}return a | |
}; | |
ZmPopupMenu.prototype.getMenuItem=function(a){return this._menuItems[a] | |
}; | |
ZmPopupMenu.prototype.setItemVisible=function(c,b){var a=this.getMenuItem(c); | |
if(!a){return | |
}a.setVisible(b) | |
}; | |
ZmPopupMenu.prototype.getMenuItems=function(){return this._menuItems | |
}; | |
ZmPopupMenu.prototype.getSearchMenu=function(){var a=this.getMenuItem(ZmOperation.SEARCH_MENU); | |
if(a){return a.getMenu() | |
}}; | |
ZmPopupMenu.prototype.getContactGroupMenu=function(){var a=this.getMenuItem(ZmOperation.CONTACTGROUP_MENU); | |
if(a){return a.getMenu() | |
}}; | |
ZmPopupMenu.prototype.createSeparator=function(){new DwtMenuItem({parent:this,style:DwtMenuItem.SEPARATOR_STYLE}) | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmActionMenu")){ZmActionMenu=function(b){var c=b.id||(b.context?ZmId.getMenuId(b.context,b.menuType):null); | |
ZmPopupMenu.call(this,b.parent,null,c,b.controller); | |
var a=b.menuItems; | |
if(!a){a=[ZmOperation.TAG_MENU,ZmOperation.PRINT,ZmOperation.DELETE] | |
}else{if(a==ZmOperation.NONE){a=null | |
}}this.opList=ZmOperation.filterOperations(a); | |
this._context=b.context; | |
this._menuType=b.menuType; | |
this._menuItems=ZmOperation.createOperations(this,this.opList,b.overrides) | |
}; | |
ZmActionMenu.prototype=new ZmPopupMenu; | |
ZmActionMenu.prototype.constructor=ZmActionMenu; | |
ZmActionMenu.prototype.isZmActionMenu=true; | |
ZmActionMenu.prototype.toString=function(){return"ZmActionMenu" | |
}; | |
ZmActionMenu.prototype.createOp=function(d,c,b){c.id=this._context?ZmId.getMenuItemId(this._context,d,this._menuType):null; | |
var a=this.createMenuItem(d,c,b); | |
a.setData(ZmOperation.KEY_ID,d); | |
return a | |
}; | |
ZmActionMenu.prototype.addOp=function(a){ZmOperation.addOperation(this,a,this._menuItems) | |
}; | |
ZmActionMenu.prototype.removeOp=function(a){ZmOperation.removeOperation(this,a,this._menuItems) | |
}; | |
ZmActionMenu.prototype.getOp=function(a){return this.getMenuItem(a) | |
}; | |
ZmActionMenu.prototype.getTagMenu=function(){var a=this.getMenuItem(ZmOperation.TAG_MENU); | |
if(a){return a.getMenu() | |
}}; | |
ZmActionMenu.prototype._menuItemId=function(a){return a.getData(ZmOperation.KEY_ID) | |
}; | |
ZmActionMenu.prototype.removeMenuItemById=function(b){var a=this.getMenuItem(b); | |
this.removeMenuItem(a) | |
}; | |
ZmActionMenu.prototype.removeMenuItem=function(a){if(!a){return | |
}this.removeChild(a); | |
a.dispose() | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmToolBar")){ZmToolBar=function(b){if(arguments.length==0){return | |
}b.posStyle=b.posStyle||DwtControl.ABSOLUTE_STYLE; | |
DwtToolBar.call(this,b); | |
var a=b.controller||appCtxt.getCurrentController(); | |
if(a){this._controller=a; | |
this._keyMap=this._controller.getKeyMapName() | |
}this._refElementId=b.refElementId; | |
this._buttons={} | |
}; | |
ZmToolBar.prototype=new DwtToolBar; | |
ZmToolBar.prototype.constructor=ZmToolBar; | |
ZmToolBar.prototype.isZmToolBar=true; | |
ZmToolBar.prototype.toString=function(){return"ZmToolBar" | |
}; | |
ZmToolBar.prototype.addSelectionListener=function(b,c){var a=this._buttons[b]; | |
if(a){a.addSelectionListener(c) | |
}}; | |
ZmToolBar.prototype.removeSelectionListener=function(b,c){var a=this._buttons[b]; | |
if(a){a.removeSelectionListener(c) | |
}}; | |
ZmToolBar.prototype.getButton=function(a){return this._buttons[a] | |
}; | |
ZmToolBar.prototype.setItemVisible=function(b,c){var a=this.getButton(b); | |
if(!a){return | |
}a.setVisible(c) | |
}; | |
ZmToolBar.prototype.setData=function(b,a,c){this._buttons[b].setData(a,c) | |
}; | |
ZmToolBar.prototype.enable=function(c,a){c=(c instanceof Array)?c:[c]; | |
for(var b=0; | |
b<c.length; | |
b++){if(this._buttons[c[b]]){this._buttons[c[b]].setEnabled(a) | |
}}}; | |
ZmToolBar.prototype.setSelected=function(c){var a=this._selectedId?this._buttons[this._selectedId]:null; | |
var b=c?this._buttons[c]:null; | |
if(a){a.setSelected(false) | |
}if(b){b.setSelected(true); | |
this._selectedId=c | |
}}; | |
ZmToolBar.prototype.enableAll=function(a){for(var b in this._buttons){this._buttons[b].setEnabled(a) | |
}}; | |
ZmToolBar.prototype.createButton=function(d,c){var a=this._buttons[d]=this._createButton(c); | |
if(c.image){a.setImage(c.image) | |
}if(c.text){a.setText(c.text) | |
}if(c.tooltip){a.setToolTipContent(ZmOperation.getToolTip(d,this._keyMap)||c.tooltip,true) | |
}a.setEnabled(c.enabled!==false); | |
a.setData("_buttonId",d); | |
if(c.menu){a.setMenu(c.menu,false,null,c.menuAbove) | |
}return a | |
}; | |
ZmToolBar.prototype.SEPARATOR_TEMPLATE="share.Widgets#ZmToolBarSeparator"; | |
ZmToolBar.prototype._createButton=function(d,b){var c=d.ctor||DwtToolBarButton; | |
var a=new c({parent:this,style:d.style,className:b,index:d.index,id:d.id,template:d.template}); | |
a.textPrecedence=d.textPrecedence; | |
a.imagePrecedence=d.imagePrecedence; | |
a.whatToShow=d.whatToShow; | |
return a | |
}; | |
ZmToolBar.prototype._buttonId=function(a){return a.getData("_buttonId") | |
}; | |
ZmToolBar.prototype._createPrecedenceList=function(){this._precedenceList=[]; | |
for(var e in this._buttons){if(ZmOperation.isSep(e)){continue | |
}var a=this._buttons[e]; | |
var d=a.textPrecedence; | |
if(d){this._precedenceList.push({id:e,type:"text",precedence:d}) | |
}var c=a.imagePrecedence; | |
if(c){this._precedenceList.push({id:e,type:"image",precedence:c}) | |
}}this._precedenceList.sort(function(g,f){return(g.precedence>f.precedence)?1:(g.precedence<f.precedence)?-1:0 | |
}) | |
}; | |
ZmToolBar.prototype.setSize=function(b,a){var c=this.getSize(); | |
if(c&&(b!=c.x||a!=c.y)){DwtToolBar.prototype.setSize.apply(this,arguments) | |
}}; | |
ZmToolBar.prototype.adjustSize=function(){if(!this._refElementId||!this._inited){return | |
}if(!this._refElement){this._refElement=document.getElementById(this._refElementId) | |
}var a=this._refElement&&this._refElement.parentNode; | |
var c; | |
if(a&&((c=a.offsetWidth)>=30)){var b=this._refElement.style; | |
b.maxWidth=b.width=(c-30)+"px"; | |
b.overflow="hidden" | |
}}; | |
ZmToolBar.addButton=function(e){if(e.setting&&!appCtxt.get(e.setting)){return | |
}var c; | |
var b=e.parent._htmlElId+(e.tdId||e.buttonId); | |
var a=document.getElementById(b); | |
if(a){var f={parent:e.parent,index:e.index,style:e.style,id:e.buttonId,template:e.template,className:e.className}; | |
c=(e.type&&e.type=="toolbar")?(new DwtToolBarButton(f)):(new DwtButton(f)); | |
var d=Dwt.getAttr(a,"hint"); | |
ZmToolBar._setButtonStyle(c,d,e.lbl,e.icon); | |
if(e.tooltip){c.setToolTipContent(e.tooltip,true) | |
}c.reparentHtmlElement(b) | |
}return c | |
}; | |
ZmToolBar._setButtonStyle=function(a,d,c,b){if(d=="text"){a.whatToShow={showText:true} | |
}else{if(d=="icon"){a.whatToShow={showImage:true} | |
}else{a.whatToShow={showImage:true,showText:true} | |
}}a.setText(c); | |
a.setImage(b) | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmButtonToolBar")){ZmButtonToolBar=function(f){if(arguments.length==0){return | |
}if(!f.className&&(f.controller&&f.controller._elementsToHide==ZmAppViewMgr.LEFT_NAV)){f.className="ZToolbar itemToolbar" | |
}f.className=f.className||"ZToolbar"; | |
f.id=f.context?ZmId.getToolbarId(f.context,f.toolbarType):null; | |
ZmToolBar.call(this,f); | |
this._context=f.context; | |
this._toolbarType=f.toolbarType; | |
this._buttonStyle=f.buttonClassName; | |
var a=f.buttons; | |
if(!a){a=[ZmOperation.NEW_MENU,ZmOperation.TAG_MENU,ZmOperation.PRINT,ZmOperation.DELETE] | |
}else{if(a==ZmOperation.NONE){a=null | |
}}this.opList=ZmOperation.filterOperations(a); | |
this._zimletButtonLocation=this.opList.length; | |
var d=ZmOperation.filterOperations(f.secondaryButtons); | |
if(d&&d.length){this.opList.push(ZmOperation.SEP,ZmOperation.ACTIONS_MENU) | |
}var e=ZmOperation.filterOperations(f.rightSideButtons); | |
if(e.length>0||f.addTextElement){this.opList.push(ZmOperation.FILLER) | |
}if(f.addTextElement){this.opList.push(ZmOperation.TEXT) | |
}if(e.length>0){this.opList=this.opList.concat(e) | |
}this._buttons=ZmOperation.createOperations(this,this.opList,f.overrides); | |
if(d&&d.length){var c=this._secondaryButton=this.getButton(ZmOperation.ACTIONS_MENU); | |
c.noMenuBar=true; | |
var b=this._secondaryButtonMenu=new ZmActionMenu({parent:c,menuItems:ZmOperation.NONE,context:this._context,controller:f.controller}); | |
var h=ZmOperation.createOperations(b,d,f.overrides); | |
c.setMenu(b); | |
for(var g in h){this._buttons[g]=h[g] | |
}this.opList=this.opList.concat(d) | |
}this._createPrecedenceList(); | |
this._inited=true | |
}; | |
ZmButtonToolBar.prototype=new ZmToolBar; | |
ZmButtonToolBar.prototype.constructor=ZmButtonToolBar; | |
ZmButtonToolBar.prototype.isZmButtonToolBar=true; | |
ZmButtonToolBar.prototype.toString=function(){return"ZmButtonToolBar" | |
}; | |
ZmButtonToolBar.prototype.createOp=function(g,f){f.className=this._buttonStyle; | |
var a; | |
if(g==ZmOperation.TEXT){var g; | |
if(this._context){var d=this._toolbarType?[this._context,this._toolbarType].join("_"):this._context; | |
g=[ZmId.WIDGET,AjxStringUtil.toMixed(d,"_",true),AjxStringUtil.toMixed(g,"_")].join("") | |
}f.textClassName=f.textClassName||"DwtText ZWidgetTitle"; | |
a=new DwtText({parent:this,className:f.textClassName,id:g}) | |
}else{f.id=f.domId||(this._context?ZmId.getButtonId(this._context,g,this._toolbarType):null); | |
f.textPrecedence=ZmOperation.getProp(g,"textPrecedence"); | |
f.iconPrecedence=ZmOperation.getProp(g,"iconPrecedence"); | |
var e=f.showImageInToolbar||false; | |
var c=!e||f.showTextInToolbar; | |
e=e||!f.text; | |
c=c||!f.image; | |
f.image=e&&f.image; | |
f.whatToShow={showImage:e,showText:c}; | |
a=this.createButton(g,f) | |
}a.setData(ZmOperation.KEY_ID,g); | |
return a | |
}; | |
ZmButtonToolBar.prototype.createZimletOp=function(b,a){a.index=this._zimletButtonLocation; | |
return this.createOp(b,a) | |
}; | |
ZmButtonToolBar.prototype.addOp=function(b,a){if(this.getOp(b)){return | |
}ZmOperation.addOperation(this,b,this._buttons,a); | |
AjxUtil.arrayAdd(this.opList,b,a) | |
}; | |
ZmButtonToolBar.prototype.removeOp=function(a){ZmOperation.removeOperation(this,a,this._buttons); | |
AjxUtil.arrayRemove(this.opList,a) | |
}; | |
ZmButtonToolBar.prototype.getOp=function(a){return this.getButton(a) | |
}; | |
ZmButtonToolBar.prototype.getTagMenu=function(){var a=this.getButton(ZmOperation.TAG_MENU); | |
if(a){return a.getMenu() | |
}}; | |
ZmButtonToolBar.prototype.getActionsMenu=function(){return this._secondaryButtonMenu | |
}; | |
ZmButtonToolBar.prototype.getActionsButton=function(){return this._secondaryButton | |
}; | |
ZmButtonToolBar.prototype._buttonId=function(a){return a.getData(ZmOperation.KEY_ID) | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmNavToolBar")){ZmNavToolBar=function(b){b.className=b.className||"ZmNavToolBar"; | |
var a=(b.hasText!==false); | |
b.buttons=this._getButtons(a); | |
b.toolbarType=ZmId.TB_NAV; | |
b.posStyle=b.posStyle||DwtControl.STATIC_STYLE; | |
ZmButtonToolBar.call(this,b); | |
if(a){this._textButton=this.getButton(ZmOperation.TEXT) | |
}}; | |
ZmNavToolBar.prototype=new ZmButtonToolBar; | |
ZmNavToolBar.prototype.constructor=ZmNavToolBar; | |
ZmNavToolBar.prototype.toString=function(){return"ZmNavToolBar" | |
}; | |
ZmNavToolBar.prototype.enable=function(d,a){ZmButtonToolBar.prototype.enable.call(this,d,a); | |
if(!a){if(!(d instanceof Array)){d=[d] | |
}for(var c=0; | |
c<d.length; | |
c++){var b=this.getButton(d[c]); | |
if(b){b.setToolTipContent(null) | |
}}}}; | |
ZmNavToolBar.prototype.setToolTip=function(b,c){var a=this.getButton(b); | |
if(a){a.setToolTipContent(c) | |
}}; | |
ZmNavToolBar.prototype.setText=function(a){if(!this._textButton){return | |
}this._textButton.setText(a) | |
}; | |
ZmNavToolBar.prototype._getButtons=function(a){var b=[]; | |
b.push(ZmOperation.PAGE_BACK); | |
if(a){b.push(ZmOperation.TEXT) | |
}b.push(ZmOperation.PAGE_FORWARD); | |
return b | |
}; | |
ZmNavToolBar.prototype.createOp=function(b,a){a.textClassName="ZWidgetTitle ZmNavToolBarTitle"; | |
return ZmButtonToolBar.prototype.createOp.apply(this,arguments) | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmSearchToolBar")){ZmSearchToolBar=function(a){if(arguments.length==0){return | |
}a.className=a.className||"ZmSearchToolbar"; | |
this._button={}; | |
DwtToolBar.apply(this,arguments); | |
this._origin=ZmId.SEARCH; | |
this._searchMenu=null | |
}; | |
ZmSearchToolBar.prototype=new DwtToolBar; | |
ZmSearchToolBar.prototype.constructor=ZmSearchToolBar; | |
ZmSearchToolBar.prototype.isZmSearchToolBar=true; | |
ZmSearchToolBar.prototype.toString=function(){return"ZmSearchToolBar" | |
}; | |
ZmSearchToolBar.prototype.role="toolbar"; | |
ZmSearchToolBar.TYPES_BUTTON="TYPES"; | |
ZmSearchToolBar.SEARCH_BUTTON="SEARCH"; | |
ZmSearchToolBar.SAVE_BUTTON="SAVE"; | |
ZmSearchToolBar.SEARCH_MENU_BUTTON=ZmSearchToolBar.TYPES_BUTTON; | |
ZmSearchToolBar.MENU_ITEMS=[]; | |
ZmSearchToolBar.SETTING={}; | |
ZmSearchToolBar.MSG_KEY={}; | |
ZmSearchToolBar.TT_MSG_KEY={}; | |
ZmSearchToolBar.ICON={}; | |
ZmSearchToolBar.SHARE_ICON={}; | |
ZmSearchToolBar.ID={}; | |
ZmSearchToolBar.DISABLE_OFFLINE={}; | |
ZmSearchToolBar.addMenuItem=function(b,a){if(a.msgKey){ZmSearchToolBar.MSG_KEY[b]=a.msgKey | |
}if(a.tooltipKey){ZmSearchToolBar.TT_MSG_KEY[b]=a.tooltipKey | |
}if(a.icon){ZmSearchToolBar.ICON[b]=a.icon | |
}if(a.shareIcon){ZmSearchToolBar.SHARE_ICON[b]=a.shareIcon | |
}if(a.setting){ZmSearchToolBar.SETTING[b]=a.setting | |
}if(a.id){ZmSearchToolBar.ID[b]=a.id | |
}if(a.disableOffline){ZmSearchToolBar.DISABLE_OFFLINE[b]=a.disableOffline | |
}if(a.index==null||a.index<0||a.index>=ZmSearchToolBar.MENU_ITEMS.length){ZmSearchToolBar.MENU_ITEMS.push(b) | |
}else{ZmSearchToolBar.MENU_ITEMS.splice(a.index,0,b) | |
}}; | |
ZmSearchToolBar.prototype.removeMenuItem=function(c){var b=this._searchMenu; | |
if(b){var a=b.getItemById(ZmOperation.MENUITEM_ID,c); | |
if(a){b.removeChild(a); | |
a.dispose() | |
}this._cleanupSeparators(b) | |
}}; | |
ZmSearchToolBar.prototype._cleanupSeparators=function(f){var d=this._button[ZmSearchToolBar.TYPES_BUTTON]; | |
f=f||(d&&d.getMenu()); | |
if(!f){return | |
}var b=f.getItems(); | |
var e=[]; | |
for(var c=0; | |
c<b.length; | |
c++){var a=b[c]; | |
if(a.isSeparator()&&(c==0||c==b.length-1||b[c-1].isSeparator())){e.push(a) | |
}}for(var c=0; | |
c<e.length; | |
c++){var a=e[c]; | |
f.removeChild(a); | |
a.dispose() | |
}}; | |
ZmSearchToolBar.prototype.getSearchField=function(){return this._searchField.getInputElement() | |
}; | |
ZmSearchToolBar.prototype.registerEnterCallback=function(a){this._enterCallback=a | |
}; | |
ZmSearchToolBar.prototype.addSelectionListener=function(b,c){var a=this._button[b]; | |
if(a){a.addSelectionListener(c) | |
}}; | |
ZmSearchToolBar.prototype.getButton=function(a){return this._button[a] | |
}; | |
ZmSearchToolBar.prototype.getButtons=function(){return AjxUtil.values(this._button) | |
}; | |
ZmSearchToolBar.prototype.focus=function(a){if(a){return DwtToolBar.prototype.focus.apply(this,arguments) | |
}else{if(this._searchField){this._searchField.focus(); | |
this._searchField.moveCursorToEnd(); | |
return this._searchField | |
}}}; | |
ZmSearchToolBar.prototype.blur=function(){if(this._searchField){this._searchField.blur() | |
}}; | |
ZmSearchToolBar.prototype.setEnabled=function(a){if(this._searchField){this._searchField.setEnabled(a) | |
}for(var b in this._button){this._button[b].setEnabled(a) | |
}}; | |
ZmSearchToolBar.prototype.setSearchFieldValue=function(a){if(this._searchField&&a!=this.getSearchFieldValue()){this._searchField.setValue(a) | |
}}; | |
ZmSearchToolBar.prototype.getSearchFieldValue=function(){return this._searchField?this._searchField.getValue():null | |
}; | |
ZmSearchToolBar.prototype._handleKeyDown=function(b){var a=DwtKeyEvent.getCharCode(b); | |
if(DwtKeyEvent.IS_RETURN[a]){return this._handleEnterKeyPress(b) | |
}return true | |
}; | |
ZmSearchToolBar.prototype._handleEnterKeyPress=function(a){if(this._enterCallback){this._enterCallback.run({ev:a,zimletEvent:"onKeyPressSearchField",origin:this._origin}) | |
}return false | |
}; | |
ZmSearchToolBar.prototype.initAutocomplete=function(){if(!this._acList){this._acList=new ZmAutocompleteListView(this._getAutocompleteParams()); | |
this._acList.handle(this.getSearchField()) | |
}}; | |
ZmSearchToolBar.prototype._getAutocompleteParams=function(){var a={dataClass:new ZmSearchAutocomplete(),matchValue:"matchText",delims:[" ","\t"],delimCodes:[3,13,9],separator:" ",keyDownCallback:this._handleKeyDown.bind(this),contextId:this.toString(),locationCallback:this._getAcLocation.bind(this)}; | |
return a | |
}; | |
ZmSearchToolBar.prototype.getAutocompleteListView=function(){return this._acList | |
}; | |
ZmSearchToolBar.prototype._getAcLocation=function(){var d=this._searchField.getInputElement(); | |
if(!d){return{} | |
}var c=Dwt.getLocation(d); | |
var b=Dwt.getSize(d); | |
var e=AjxStringUtil.getWidth(d.value); | |
if(AjxEnv.isWindows&&(AjxEnv.isFirefox||AjxEnv.isSafari||AjxEnv.isChrome)){e=e*1.2 | |
}var a=c.x+e; | |
var f=c.y+b.y; | |
DwtPoint.tmp.set(a,f); | |
return DwtPoint.tmp | |
}; | |
ZmMainSearchToolBar=function(b){if(arguments.length==0){return | |
}ZmSearchToolBar.apply(this,arguments); | |
this._initialize(); | |
var a={msgKey:"searchShared",tooltipKey:"searchShared",icon:"Group",setting:ZmSetting.SHARING_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_SHARED),disableOffline:true}; | |
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_SHARED,a); | |
if(appCtxt.multiAccounts){var a={msgKey:"searchAllAccounts",icon:"Globe",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_ALL_ACCOUNTS)}; | |
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_ALL_ACCOUNTS,a) | |
}}; | |
ZmMainSearchToolBar.prototype=new ZmSearchToolBar; | |
ZmMainSearchToolBar.prototype.constructor=ZmMainSearchToolBar; | |
ZmMainSearchToolBar.prototype.isZmMainSearchToolBar=true; | |
ZmMainSearchToolBar.prototype.toString=function(){return"ZmMainSearchToolBar" | |
}; | |
ZmMainSearchToolBar.CUSTOM_ITEM_ID="CustomSearchItem"; | |
ZmMainSearchToolBar.CUSTOM_BUTTON="CUSTOM"; | |
ZmMainSearchToolBar.prototype._initialize=function(){var c=appCtxt.isExternalAccount(); | |
var e=ZmSearchToolBar.MENU_ITEMS[0]; | |
var b=ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_MENU); | |
var a=this._button[ZmSearchToolBar.TYPES_BUTTON]=new DwtButton({parent:this,index:0,id:b}); | |
a.setImage(ZmSearchToolBar.ICON[e]); | |
a.setToolTipContent(ZmMsg[ZmSearchToolBar.TT_MSG_KEY[e]],true); | |
var f=new AjxCallback(this,this._createSearchMenu); | |
a.setMenu(f,false,DwtMenuItem.RADIO_STYLE); | |
if(c){a.setEnabled(false) | |
}var g=this._searchField=new DwtInputField({parent:this,hint:ZmMsg.searchInput,label:ZmMsg.searchInput,inputId:ZmId.SEARCH_INPUTFIELD}); | |
var d=g.getInputElement(); | |
d.className="search_input"; | |
this._searchField._showHint(); | |
this._searchField.addListener(DwtEvent.ONFOCUS,this._onInputFocus.bind(this)); | |
this._searchField.addListener(DwtEvent.ONBLUR,this._onInputBlur.bind(this)); | |
if(c){this._searchField.setEnabled(false) | |
}g.addListener(DwtEvent.ONFOCUS,this._childFocusListener.bind(this)); | |
a=this._button[ZmSearchToolBar.SEARCH_BUTTON]=new DwtButton({parent:this,className:"ZmSearchButton",id:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_SEARCH)}); | |
a.setImage("Search2"); | |
a.setToolTipContent(ZmMsg.searchTooltip,true); | |
if(c){if(this._button[ZmSearchToolBar.SEARCH_BUTTON]){this._button[ZmSearchToolBar.SEARCH_BUTTON].setEnabled(false) | |
}}}; | |
ZmMainSearchToolBar.prototype._createSearchMenu=function(){var g=this._searchMenu=new DwtMenu({parent:this._button[ZmSearchToolBar.TYPES_BUTTON],className:"ActionMenu",id:ZmId.getMenuId(ZmId.SEARCH)}); | |
var b; | |
if(this._customSearchMenuItems){for(var d=0; | |
d<this._customSearchMenuItems.length; | |
d++){var c=this._customSearchMenuItems[d]; | |
this._createCustomSearchMenuItem(g,c.icon,c.text,c.listener) | |
}}var f={parent:g,enabled:true,radioGroupId:0,style:DwtMenuItem.RADIO_STYLE}; | |
for(var d=0; | |
d<ZmSearchToolBar.MENU_ITEMS.length; | |
d++){var h=ZmSearchToolBar.MENU_ITEMS[d]; | |
if(h==ZmId.SEARCH_SHARED){if(ZmSearchToolBar.MENU_ITEMS.length<=1){continue | |
}b=new DwtMenuItem({parent:g,style:DwtMenuItem.SEPARATOR_STYLE}) | |
}var e=ZmSearchToolBar.SETTING[h]; | |
if(e&&!appCtxt.get(e)){continue | |
}var a=(h==ZmId.SEARCH_SHARED||h==ZmId.SEARCH_ALL_ACCOUNTS); | |
if(a){f.style=DwtMenuItem.CHECK_STYLE | |
}f.style=(h==ZmId.SEARCH_SHARED||h==ZmId.SEARCH_ALL_ACCOUNTS)?DwtMenuItem.CHECK_STYLE:DwtMenuItem.RADIO_STYLE; | |
f.imageInfo=ZmSearchToolBar.ICON[h]; | |
f.text=ZmMsg[ZmSearchToolBar.MSG_KEY[h]]; | |
f.id=ZmSearchToolBar.ID[h]; | |
b=DwtMenuItem.create(f); | |
b.setData(ZmOperation.MENUITEM_ID,h); | |
if(!a){b.setAttribute("aria-label",ZmMsg[ZmSearchToolBar.TT_MSG_KEY[h]]) | |
}}this._checkSharedMenuItem(); | |
appCtxt.getSettings().getSetting(ZmSetting.SEARCH_INCLUDES_SHARED).addChangeListener(this._checkSharedMenuItem.bind(this)); | |
appCtxt.getSearchController()._addMenuListeners(g); | |
this._searchMenuCreated=true; | |
return g | |
}; | |
ZmMainSearchToolBar.prototype.setOfflineState=function(a){var d=this._button[ZmSearchToolBar.TYPES_BUTTON]; | |
var f=d&&d.getMenu(); | |
var c=f.getItemCount(); | |
for(var b=0; | |
b<c; | |
b++){var e=f.getItem(b); | |
if(e){var g=e.getData(ZmOperation.MENUITEM_ID); | |
if(g&&ZmSearchToolBar.DISABLE_OFFLINE[g]){e.setEnabled(!a) | |
}}}}; | |
ZmMainSearchToolBar.prototype.getSearchType=function(){var a=this._button[ZmSearchToolBar.TYPES_BUTTON]; | |
var d=a&&a.getMenu(); | |
var b=d?d.getSelectedItem()||d.getItems()[0]:null; | |
var c=b?b.getData(ZmMainSearchToolBar.CUSTOM_ITEM_ID)||b.getData(ZmOperation.MENUITEM_ID):ZmSearchToolBar.MENU_ITEMS[0]; | |
return c | |
}; | |
ZmMainSearchToolBar.prototype.createCustomSearchBtn=function(h,i,d,b){if(!this._customSearchListener){this._customSearchListener=this._customSearchBtnListener.bind(this) | |
}var k=document.getElementById(this._htmlElId+"_customSearchButton"); | |
if(k){var f={icon:h,text:i,listener:d}; | |
var g=this._button[ZmSearchToolBar.CUSTOM_BUTTON]; | |
if(!g){g=this._button[ZmSearchToolBar.CUSTOM_BUTTON]=ZmToolBar.addButton({parent:this,tdId:"_customSearchButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_CUSTOM),lbl:i,icon:h}); | |
g.setData(ZmMainSearchToolBar.CUSTOM_ITEM_ID,f); | |
g.addSelectionListener(this._customSearchListener); | |
var l=document.getElementById(this._htmlElId+"_customSearchButtonSep"); | |
if(l){Dwt.setVisible(l,true) | |
}}else{var c=g&&g.getMenu(); | |
var j; | |
var e={parent:c,enabled:true,style:DwtMenuItem.RADIO_STYLE,radioGroupId:0,id:b}; | |
if(!c){var a=g.getData(ZmMainSearchToolBar.CUSTOM_ITEM_ID); | |
c=new DwtMenu({parent:g,className:"ActionMenu",id:ZmId.getMenuId(ZmId.SEARCH,ZmId.SEARCH_CUSTOM)}); | |
g.setMenu(c,false,DwtMenuItem.RADIO_STYLE); | |
e.imageInfo=a.icon; | |
e.text=a.text; | |
j=DwtMenuItem.create(e); | |
j.setData(ZmMainSearchToolBar.CUSTOM_ITEM_ID,a); | |
j.setData(ZmOperation.MENUITEM_ID,ZmId.SEARCH_CUSTOM); | |
j.setChecked(true,true); | |
j.addSelectionListener(this._customSearchListener) | |
}e.imageInfo=h; | |
e.text=i; | |
j=DwtMenuItem.create(e); | |
j.setData(ZmMainSearchToolBar.CUSTOM_ITEM_ID,f); | |
j.addSelectionListener(this._customSearchListener) | |
}}else{if(this._searchMenuCreated){var c=this._button[ZmSearchToolBar.TYPES_BUTTON].getMenu(); | |
this._createCustomSearchMenuItem(c,h,i,d,b) | |
}else{if(!this._customSearchMenuItems){this._customSearchMenuItems=[] | |
}this._customSearchMenuItems.push({icon:h,text:i,listener:d,id:b}) | |
}}}; | |
ZmMainSearchToolBar.prototype._createCustomSearchMenuItem=function(g,b,f,d,h){var a=g.getItem(0); | |
var e={parent:g,imageInfo:b,text:f,enabled:true,style:DwtMenuItem.RADIO_STYLE,radioGroupId:0,index:0,id:h}; | |
a=DwtMenuItem.create(e); | |
var c={icon:b,text:f,listener:d}; | |
a.setData(ZmMainSearchToolBar.CUSTOM_ITEM_ID,c); | |
a.setData(ZmOperation.MENUITEM_ID,ZmId.SEARCH_CUSTOM); | |
a.addSelectionListener(this._customSearchListener); | |
if(!(a&&a.getData(ZmMainSearchToolBar.CUSTOM_ITEM_ID))){a=new DwtMenuItem({parent:g,style:DwtMenuItem.SEPARATOR_STYLE,index:1}) | |
}}; | |
ZmMainSearchToolBar.prototype._customSearchBtnListener=function(d){var c=d.item; | |
if(!c){return | |
}var e=c.getData(ZmMainSearchToolBar.CUSTOM_ITEM_ID); | |
if(!e){return | |
}if(this._customSearchBtn){if(c.isDwtMenuItem){if(d.detail!=DwtMenuItem.CHECKED){return | |
}this._customSearchBtn.setToolTipContent(e[1]); | |
this._customSearchBtn.setData(ZmMainSearchToolBar.CUSTOM_ITEM_ID,e) | |
}e.listener.run(d) | |
}else{var b=this._button[ZmSearchToolBar.TYPES_BUTTON]; | |
b.setToolTipContent(e.text); | |
var f=c.parent; | |
var a=f?f.getItemById(ZmOperation.MENUITEM_ID,ZmId.SEARCH_SHARED):null; | |
if(a){a.setChecked(false,true); | |
a.setEnabled(false) | |
}b.setImage(e.icon); | |
b.setText(e.text) | |
}}; | |
ZmMainSearchToolBar.prototype._onInputFocus=function(a){this._setInputExpanded(true) | |
}; | |
ZmMainSearchToolBar.prototype._onInputBlur=function(b){var a=appCtxt.getKeyboardMgr().getFocusObj(); | |
if(a!==this._button[ZmSearchToolBar.TYPES_BUTTON]&&a!==this._button[ZmSearchToolBar.SEARCH_BUTTON]&&!this._movingFocus){this._setInputExpanded(false) | |
}this._movingFocus=false | |
}; | |
ZmMainSearchToolBar.prototype._moveFocus=function(a){this._movingFocus=true; | |
ZmSearchToolBar.prototype._moveFocus.apply(this,arguments) | |
}; | |
ZmMainSearchToolBar.prototype._setInputExpanded=function(c){if(!c&&this._searchMenu&&this._searchMenu.isPoppedUp()){return | |
}var b=this._searchField.getInputElement(); | |
var a=c?"search_input-expanded":"search_input"; | |
if(AjxEnv.isIE9){setTimeout(function(){b.className=a | |
},0) | |
}else{b.className=a | |
}}; | |
ZmMainSearchToolBar.prototype._checkSharedMenuItem=function(){var a=this._searchMenu&&this._searchMenu.getItemById(ZmOperation.MENUITEM_ID,ZmId.SEARCH_SHARED); | |
if(a){a.setChecked(appCtxt.get(ZmSetting.SEARCH_INCLUDES_SHARED)) | |
}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmSearchResultsToolBar")){ZmSearchResultsToolBar=function(a){a.posStyle=Dwt.ABSOLUTE_STYLE; | |
a.className="ZmSearchResultsToolBar"; | |
this._controller=a.controller; | |
ZmSearchToolBar.apply(this,arguments); | |
this._bubbleId={}; | |
this._origin=ZmId.SEARCHRESULTS; | |
this.initAutocomplete() | |
}; | |
ZmSearchResultsToolBar.prototype=new ZmSearchToolBar; | |
ZmSearchResultsToolBar.prototype.constructor=ZmSearchResultsToolBar; | |
ZmSearchResultsToolBar.prototype.isZmSearchResultsToolBar=true; | |
ZmSearchResultsToolBar.prototype.toString=function(){return"ZmSearchResultsToolBar" | |
}; | |
ZmSearchResultsToolBar.prototype.TEMPLATE="share.Widgets#ZmSearchResultsToolBar"; | |
ZmSearchResultsToolBar.prototype.PENDING_BUBBLE_CONTAINER_CLASS="addrBubbleContainerPending"; | |
ZmSearchResultsToolBar.prototype.PENDING_SEARCH_DELAY=2000; | |
ZmSearchResultsToolBar.prototype._createHtml=function(){this.getHtmlElement().innerHTML=AjxTemplate.expand(this.TEMPLATE,{id:this._htmlElId}); | |
var a=this._controller.getCurrentViewId(); | |
this._label=document.getElementById(this._htmlElId+"_label"); | |
this._iconDiv=document.getElementById(this._htmlElId+"_icon"); | |
var d=this._htmlElId+"_inputFieldCell"; | |
var c=document.getElementById(d); | |
if(c){var b={parent:this,strictMode:false,id:DwtId.makeId(ZmId.WIDGET_INPUT,a),bubbleAddedCallback:this._bubbleChange.bind(this),bubbleRemovedCallback:this._bubbleChange.bind(this),noOutsideListening:true,type:ZmId.SEARCH}; | |
var e=this._searchField=new ZmAddressInputField(b); | |
e.reparentHtmlElement(c); | |
var f=this._searchField.getInputElement(); | |
f.className="search_results_input" | |
}this._button[ZmSearchToolBar.SEARCH_BUTTON]=ZmToolBar.addButton({parent:this,tdId:"_searchButton",buttonId:ZmId.getButtonId(a,ZmId.SEARCHRESULTS_SEARCH),lbl:ZmMsg.search,tooltip:ZmMsg.searchTooltip}); | |
this._button[ZmSearchToolBar.SAVE_BUTTON]=ZmToolBar.addButton({parent:this,setting:ZmSetting.SAVED_SEARCHES_ENABLED,tdId:"_saveButton",buttonId:ZmId.getButtonId(a,ZmId.SEARCHRESULTS_SAVE),lbl:ZmMsg.save,tooltip:ZmMsg.saveSearchTooltip}) | |
}; | |
ZmSearchResultsToolBar.prototype.initAutocomplete=function(){if(!this._acList){this._acList=new ZmAutocompleteListView(this._getAutocompleteParams()); | |
this._acList.handle(this.getSearchField(),this._searchField._htmlElId) | |
}this._searchField.setAutocompleteListView(this._acList) | |
}; | |
ZmSearchResultsToolBar.prototype._getAutocompleteParams=function(){var a=ZmSearchToolBar.prototype._getAutocompleteParams.apply(this,arguments); | |
a.options={noBubbleParse:true}; | |
return a | |
}; | |
ZmSearchResultsToolBar.prototype.setSearch=function(k){this._settingSearch=true; | |
this._searchField.clear(true); | |
var g=k.getTokens(); | |
if(g&&g.length){for(var d=0,e=g.length; | |
d<e; | |
d++){var c=g[d],a=g[d-1],b=g[d+1]; | |
var j=(a&&a.op==ZmParsedQuery.GROUP_CLOSE)||(b&&b.op==ZmParsedQuery.GROUP_OPEN); | |
var h=c.toString(j); | |
if(h){var f=this._searchField.addBubble({address:h,noParse:true}); | |
this._bubbleId[h]=f.id | |
}}}this._settingSearch=false | |
}; | |
ZmSearchResultsToolBar.prototype.setLabel=function(b,a){this._label.innerHTML=b; | |
this._iconDiv.style.display=a?"inline-block":"none" | |
}; | |
ZmSearchResultsToolBar.prototype._bubbleChange=function(b,c){this._clearPendingSearchTimeout(); | |
if(this._settingSearch){return | |
}var a=new ZmParsedQuery(b.address); | |
var d=a.getTokens(); | |
if(d&&d[0]&&d[0].type==ZmParsedQuery.COND){return | |
}Dwt.addClass(this._searchField._elRef,this.PENDING_BUBBLE_CONTAINER_CLASS); | |
this._pendingSearchTimeout=setTimeout(this._handleEnterKeyPress.bind(this),this.PENDING_SEARCH_DELAY) | |
}; | |
ZmSearchResultsToolBar.prototype._clearPendingSearchTimeout=function(){if(!this._pendingSearchTimeout){return | |
}clearTimeout(this._pendingSearchTimeout); | |
this._pendingSearchTimeout=null | |
}; | |
ZmSearchResultsToolBar.prototype._handleKeyDown=function(a){this._clearPendingSearchTimeout(); | |
ZmSearchToolBar.prototype._handleKeyDown.apply(this,arguments) | |
}; | |
ZmSearchResultsToolBar.prototype._handleEnterKeyPress=function(a){this._clearPendingSearchTimeout(); | |
Dwt.delClass(this._searchField._elRef,this.PENDING_BUBBLE_CONTAINER_CLASS); | |
this.setLabel(ZmMsg.searching); | |
ZmSearchToolBar.prototype._handleEnterKeyPress.apply(this,arguments) | |
}; | |
ZmSearchResultsToolBar.prototype.addSearchTerm=function(b,f,a){var j=b.toString(a); | |
var e; | |
if(a){var h=this._searchField._getBubbleList(); | |
var d=h.getArray(); | |
for(var c=0; | |
c<d.length; | |
c++){if(h.isSelected(d[c])){e=c; | |
break | |
}}}var g=this._searchField.addBubble({address:j,addClass:b.type,skipNotify:f,index:e}); | |
if(g){this._bubbleId[j]=g.id; | |
return g.id | |
}}; | |
ZmSearchResultsToolBar.prototype.removeSearchTerm=function(b,a){if(!b){return | |
}var c=b.toString(); | |
var d=b.isZmSearchToken?this._bubbleId[c]:b; | |
if(d){this._searchField.removeBubble(d,a); | |
delete this._bubbleId[c] | |
}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmSearchResultsFilterPanel")){ZmSearchResultsFilterPanel=function(a){a.className=a.className||"ZmSearchResultsFilterPanel"; | |
a.posStyle=Dwt.ABSOLUTE_STYLE; | |
DwtComposite.apply(this,arguments); | |
if(!ZmSearchResultsFilterPanel.BASIC_FILTER){ZmSearchResultsFilterPanel._initConstants() | |
}this._controller=a.controller; | |
this._resultsApp=a.resultsApp; | |
this._viewId=this._controller.getCurrentViewId(); | |
this._checkbox={}; | |
this._menu={}; | |
this._advancedFilterHandlers={}; | |
this._createHtml(); | |
this._addFilters(); | |
this._addConditionals() | |
}; | |
ZmSearchResultsFilterPanel.prototype=new DwtComposite; | |
ZmSearchResultsFilterPanel.prototype.constructor=ZmSearchResultsFilterPanel; | |
ZmSearchResultsFilterPanel.prototype.isZmSearchResultsFilterPanel=true; | |
ZmSearchResultsFilterPanel.prototype.toString=function(){return"ZmSearchResultsFilterPanel" | |
}; | |
ZmSearchResultsFilterPanel.prototype.TEMPLATE="share.Widgets#ZmSearchResultsFilterPanel"; | |
ZmSearchResultsFilterPanel.BASIC="BasicFilter"; | |
ZmSearchResultsFilterPanel.ADVANCED="AdvancedFilter"; | |
ZmSearchResultsFilterPanel.ID_ATTACHMENT="ATTACHMENT"; | |
ZmSearchResultsFilterPanel.ID_FLAGGED="FLAGGED"; | |
ZmSearchResultsFilterPanel.ID_UNREAD="UNREAD"; | |
ZmSearchResultsFilterPanel.ID_TO="TO"; | |
ZmSearchResultsFilterPanel.ID_FROM="FROM"; | |
ZmSearchResultsFilterPanel.ID_DATE="DATE"; | |
ZmSearchResultsFilterPanel.ID_DATE_BRIEFCASE="DATE_BRIEFCASE"; | |
ZmSearchResultsFilterPanel.ID_DATE_SENT="DATE_SENT"; | |
ZmSearchResultsFilterPanel.ID_SIZE="SIZE"; | |
ZmSearchResultsFilterPanel.ID_STATUS="STATUS"; | |
ZmSearchResultsFilterPanel.ID_TAG="TAG"; | |
ZmSearchResultsFilterPanel.ID_FOLDER="FOLDER"; | |
ZmSearchResultsFilterPanel.ALL_APPS="ALL"; | |
ZmSearchResultsFilterPanel.BASIC_FILTER_LIST=[ZmSearchResultsFilterPanel.ID_ATTACHMENT,ZmSearchResultsFilterPanel.ID_FLAGGED,ZmSearchResultsFilterPanel.ID_UNREAD]; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER_LIST=[ZmSearchResultsFilterPanel.ID_FROM,ZmSearchResultsFilterPanel.ID_TO,ZmSearchResultsFilterPanel.ID_DATE,ZmSearchResultsFilterPanel.ID_DATE_BRIEFCASE,ZmSearchResultsFilterPanel.ID_DATE_SENT,ZmSearchResultsFilterPanel.ID_ATTACHMENT,ZmSearchResultsFilterPanel.ID_SIZE,ZmSearchResultsFilterPanel.ID_STATUS,ZmSearchResultsFilterPanel.ID_TAG,ZmSearchResultsFilterPanel.ID_FOLDER]; | |
ZmSearchResultsFilterPanel._initConstants=function(){ZmSearchResultsFilterPanel.BASIC_FILTER={}; | |
ZmSearchResultsFilterPanel.BASIC_FILTER[ZmSearchResultsFilterPanel.ID_ATTACHMENT]={text:ZmMsg.filterHasAttachment,term:new ZmSearchToken("has","attachment"),apps:[ZmApp.MAIL,ZmApp.CALENDAR,ZmApp.TASKS]}; | |
ZmSearchResultsFilterPanel.BASIC_FILTER[ZmSearchResultsFilterPanel.ID_FLAGGED]={text:ZmMsg.filterIsFlagged,term:new ZmSearchToken("is","flagged"),precondition:ZmSetting.FLAGGING_ENABLED}; | |
ZmSearchResultsFilterPanel.BASIC_FILTER[ZmSearchResultsFilterPanel.ID_UNREAD]={text:ZmMsg.filterisUnread,term:new ZmSearchToken("is","unread")}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER={}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_FROM]={text:ZmMsg.filterReceivedFrom,handler:"ZmAddressSearchFilter",searchOp:"from"}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_TO]={text:ZmMsg.filterSentTo,handler:"ZmAddressSearchFilter",searchOp:"to"}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_DATE]={text:ZmMsg.filterDate,handler:"ZmApptDateSearchFilter",apps:[ZmApp.CALENDAR,ZmApp.TASKS]}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_DATE_SENT]={text:ZmMsg.filterDateSent,handler:"ZmDateSearchFilter"}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_DATE_BRIEFCASE]={text:ZmMsg.filterDate,handler:"ZmDateSearchFilter",apps:[ZmApp.BRIEFCASE]}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_ATTACHMENT]={text:ZmMsg.filterAttachments,handler:"ZmAttachmentSearchFilter",searchOp:"attachment",apps:[ZmApp.MAIL,ZmApp.CALENDAR,ZmApp.TASKS]}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_SIZE]={text:ZmMsg.filterSize,handler:"ZmSizeSearchFilter",apps:[ZmApp.MAIL,ZmApp.BRIEFCASE]}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_STATUS]={text:ZmMsg.filterStatus,handler:"ZmStatusSearchFilter",searchOp:"is"}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_TAG]={text:ZmMsg.filterTag,handler:"ZmTagSearchFilter",searchOp:"tag",apps:ZmSearchResultsFilterPanel.ALL_APPS,precondition:appCtxt.getTagTree()&&appCtxt.getTagTree().size()>0}; | |
ZmSearchResultsFilterPanel.ADVANCED_FILTER[ZmSearchResultsFilterPanel.ID_FOLDER]={text:ZmMsg.filterFolder,handler:"ZmFolderSearchFilter",searchOp:"in",noMenu:true,apps:ZmSearchResultsFilterPanel.ALL_APPS} | |
}; | |
ZmSearchResultsFilterPanel.CONDITIONALS=[ZmParsedQuery.COND_AND,ZmParsedQuery.COND_OR,ZmParsedQuery.COND_NOT,ZmParsedQuery.GROUP_OPEN,ZmParsedQuery.GROUP_CLOSE]; | |
ZmSearchResultsFilterPanel.prototype._createHtml=function(){this.getHtmlElement().innerHTML=AjxTemplate.expand(this.TEMPLATE,{id:this._htmlElId}); | |
this._basicPanel=document.getElementById(this._htmlElId+"_basicPanel"); | |
this._basicContainer=document.getElementById(this._htmlElId+"_basic"); | |
this._advancedPanel=document.getElementById(this._htmlElId+"_advancedPanel"); | |
this._advancedContainer=document.getElementById(this._htmlElId+"_advanced"); | |
this._conditionalsContainer=document.getElementById(this._htmlElId+"_conditionals") | |
}; | |
ZmSearchResultsFilterPanel.prototype._getApplicableFilters=function(d,f){var c=[]; | |
for(var a=0; | |
a<d.length; | |
a++){var g=d[a]; | |
var b=f[g]; | |
b.index=a; | |
if(!appCtxt.checkPrecondition(b.precondition)){continue | |
}var e=(b.apps==ZmSearchResultsFilterPanel.ALL_APPS)?b.apps:AjxUtil.arrayAsHash(b.apps||[ZmApp.MAIL]); | |
if((b.apps==ZmSearchResultsFilterPanel.ALL_APPS)||e[this._resultsApp]){c.push({id:g,filter:b}) | |
}}return c | |
}; | |
ZmSearchResultsFilterPanel.prototype._addFilters=function(){var c=this._getApplicableFilters(ZmSearchResultsFilterPanel.BASIC_FILTER_LIST,ZmSearchResultsFilterPanel.BASIC_FILTER); | |
Dwt.setVisible(this._basicPanel,(c.length>0)); | |
for(var b=0; | |
b<c.length; | |
b++){var a=c[b]; | |
this._addBasicFilter(a.id,a.filter.text) | |
}var c=this._getApplicableFilters(ZmSearchResultsFilterPanel.ADVANCED_FILTER_LIST,ZmSearchResultsFilterPanel.ADVANCED_FILTER); | |
Dwt.setVisible(this._advancedPanel,(c.length>0)); | |
this._addAdvancedFilters() | |
}; | |
ZmSearchResultsFilterPanel.prototype._addAdvancedFilters=function(b){ZmSearchResultsFilterPanel.attTypes=b; | |
var d=this._getApplicableFilters(ZmSearchResultsFilterPanel.ADVANCED_FILTER_LIST,ZmSearchResultsFilterPanel.ADVANCED_FILTER); | |
Dwt.setVisible(this._advancedPanel,(d.length>0)); | |
for(var c=0; | |
c<d.length; | |
c++){var a=d[c]; | |
this._addAdvancedFilter(a.id,a.filter.text) | |
}}; | |
ZmSearchResultsFilterPanel.prototype._addBasicFilter=function(c,b){var a=this._checkbox[c]=new DwtCheckbox({parent:this,className:"filter",parentElement:this._basicContainer,id:DwtId.makeId(ZmId.WIDGET_CHECKBOX,this._viewId,ZmSearchResultsFilterPanel.BASIC,c)}); | |
a.setText(b); | |
a.addSelectionListener(this._checkboxListener.bind(this,c)) | |
}; | |
ZmSearchResultsFilterPanel.prototype._checkboxListener=function(e,d){var a=this._checkbox[e]; | |
if(!a){return | |
}var c=ZmSearchResultsFilterPanel.BASIC_FILTER[e]; | |
var b=c&&c.term; | |
if(b){if(a.isSelected()){this._controller.addSearchTerm(b) | |
}else{this._controller.removeSearchTerm(b) | |
}}}; | |
ZmSearchResultsFilterPanel.prototype._addAdvancedFilter=function(h,g){var b,f; | |
b=new DwtButton({parent:this,parentElement:this._advancedContainer,id:ZmId.getButtonId(this._viewId,h)}); | |
b.setText(g); | |
var a=b.getHtmlElement(); | |
var d=a&&a.firstChild; | |
if(d&&d.tagName&&(d.tagName.toLowerCase()=="table")){d.style.width="100%" | |
}var c=ZmSearchResultsFilterPanel.ADVANCED_FILTER[h]; | |
if(!c.noMenu){var e={parent:b,id:ZmId.getMenuId(this._viewId,h),style:DwtMenu.POPUP_STYLE}; | |
f=new AjxCallback(this,this._createMenu,[e,h,c]); | |
b.setMenu({menu:f,menuPopupStyle:DwtButton.MENU_POPUP_STYLE_CASCADE}) | |
}else{this._createFilter(b,h,c) | |
}}; | |
ZmSearchResultsFilterPanel.prototype._createMenu=function(d,e,b,a){var c=this._menu[e]=new DwtMenu(d); | |
this._createFilter(c,e,b); | |
return c | |
}; | |
ZmSearchResultsFilterPanel.prototype._createFilter=function(parent,id,filter){var handler=filter&&filter.handler; | |
var updateCallback=this.update.bind(this,id); | |
var params={parent:parent,id:id,viewId:this._viewId,searchOp:filter.searchOp,updateCallback:updateCallback,resultsApp:this._resultsApp}; | |
var filterClass=eval(handler); | |
this._advancedFilterHandlers[id]=new filterClass(params) | |
}; | |
ZmSearchResultsFilterPanel.prototype.update=function(a,h,e){if(!a||!h){return | |
}h=AjxUtil.toArray(h); | |
var l=this._controller.getSearchTerms(); | |
if(l&&l.length){var b=AjxUtil.arrayAsHash(AjxUtil.map(l,function(i){return i.op | |
})); | |
var c=b[ZmParsedQuery.COND_OR]; | |
for(var g=0; | |
g<l.length; | |
g++){var d=l[g]; | |
for(var f=0; | |
f<h.length; | |
f++){var k=h[f]; | |
if(this._areExclusiveTerms(d,k,c)){this._controller.removeSearchTerm(d,true) | |
}}}}for(var g=0; | |
g<h.length; | |
g++){this._controller.addSearchTerm(h[g]) | |
}if(this._menu[a]&&!e){this._menu[a].popdown() | |
}}; | |
ZmSearchResultsFilterPanel.prototype.reset=function(){for(var d in this._checkbox){var a=this._checkbox[d]; | |
if(a){a.setSelected(false) | |
}}for(var b in this._advancedFilterHandlers){var c=this._advancedFilterHandlers[b]; | |
if(c&&c.reset){c.reset() | |
}}}; | |
ZmSearchResultsFilterPanel.prototype.resetBasicFiltersToQuery=function(e){var b=ZmSearchResultsFilterPanel.BASIC_FILTER_LIST; | |
for(var c=0; | |
c<b.length; | |
c++){var f=b[c]; | |
var a=this._checkbox[f]; | |
if(!a){continue | |
}var d=ZmSearchResultsFilterPanel.BASIC_FILTER[f]; | |
a.setSelected(e.indexOf(d.term.toString())!==-1) | |
}}; | |
ZmSearchResultsFilterPanel.prototype._areExclusiveTerms=function(b,a,c){b=this._translateTerm(b); | |
a=this._translateTerm(a); | |
return(ZmParsedQuery.areExclusive(b,a)||(!c&&(b.op==a.op)&&!ZmParsedQuery.isMultiple(b))) | |
}; | |
ZmSearchResultsFilterPanel.prototype._translateTerm=function(b){var a; | |
if(b.op=="appt-start"){var c=b.arg.substr(0,1); | |
a=(c=="<")?"before":(c==">")?"after":"date" | |
}return a?new ZmSearchToken(a,b.arg):b | |
}; | |
ZmSearchResultsFilterPanel.prototype._addConditionals=function(){var d=ZmSearchResultsFilterPanel.CONDITIONALS; | |
for(var c=0; | |
c<d.length; | |
c++){var e=d[c]; | |
var b={parent:appCtxt.getShell(),parentElement:this._conditionalsContainer,address:e,addClass:ZmParsedQuery.COND_OP[e]?ZmParsedQuery.COND:ZmParsedQuery.GROUP}; | |
var a=new ZmAddressBubble(b); | |
a.addSelectionListener(this._conditionalSelectionListener.bind(this)) | |
}}; | |
ZmSearchResultsFilterPanel.prototype._conditionalSelectionListener=function(b){var a=b.item; | |
this._controller.addSearchTerm(new ZmSearchToken(a.address),true,true) | |
}; | |
ZmSearchFilter=function(a){if(arguments.length==0){return | |
}this.parent=a.parent; | |
this.id=a.id; | |
this._viewId=a.viewId; | |
this._searchOp=a.searchOp; | |
this._updateCallback=a.updateCallback; | |
this._resultsApp=a.resultsApp; | |
this._setUi(a.parent) | |
}; | |
ZmSearchFilter.prototype.isZmSearchFilter=true; | |
ZmSearchFilter.prototype.toString=function(){return"ZmSearchFilter" | |
}; | |
ZmSearchFilter.DATA_KEY="DATA"; | |
ZmSearchFilter.prototype._setUi=function(a){}; | |
ZmSearchFilter.prototype._selectionListener=function(b){var c=b&&b.dwtObj&&b.dwtObj.getData(ZmSearchFilter.DATA_KEY); | |
if(c&&this._searchOp){var a=new ZmSearchToken(this._searchOp,c); | |
this._updateCallback(a) | |
}}; | |
ZmAddressSearchFilter=function(a){ZmSearchFilter.apply(this,arguments) | |
}; | |
ZmAddressSearchFilter.prototype=new ZmSearchFilter; | |
ZmAddressSearchFilter.prototype.constructor=ZmAddressSearchFilter; | |
ZmAddressSearchFilter.prototype.isZmAddressSearchFilter=true; | |
ZmAddressSearchFilter.prototype.toString=function(){return"ZmAddressSearchFilter" | |
}; | |
ZmAddressSearchFilter.ADDRESS="address"; | |
ZmAddressSearchFilter.DOMAIN="domain"; | |
ZmAddressSearchFilter.ADDR={}; | |
ZmAddressSearchFilter.ADDR.from=AjxEmailAddress.FROM; | |
ZmAddressSearchFilter.ADDR.to=AjxEmailAddress.TO; | |
ZmAddressSearchFilter.INPUT_WIDTH=25; | |
ZmAddressSearchFilter.NUM_DOMAINS_TO_FETCH=100; | |
ZmAddressSearchFilter.NUM_DOMAINS_TO_SHOW=10; | |
ZmAddressSearchFilter.prototype._addInput=function(f,e,d){var c=new DwtMenuItem({parent:f,id:ZmId.getMenuItemId(this._viewId,this.id,ZmAddressSearchFilter.ADDRESS)}); | |
c.setText(e); | |
var b=new DwtMenu({parent:c,id:ZmId.getMenuId(this._viewId,this.id,ZmAddressSearchFilter.ADDRESS),style:DwtMenu.GENERIC_WIDGET_STYLE}); | |
c.setMenu({menu:b,menuPopupStyle:DwtButton.MENU_POPUP_STYLE_CASCADE}); | |
var a=new DwtInputField({parent:b,id:DwtId.makeId(ZmId.WIDGET_INPUT,this._viewId,this.id,ZmAddressSearchFilter.ADDRESS),size:d}); | |
return a | |
}; | |
ZmAddressSearchFilter.prototype._addComboBox=function(f,e,c){var b=new DwtMenuItem({parent:f,id:ZmId.getMenuItemId(this._viewId,this.id,ZmAddressSearchFilter.DOMAIN)}); | |
b.setText(e); | |
var a=new DwtMenu({parent:b,id:ZmId.getMenuId(this._viewId,this.id,ZmAddressSearchFilter.DOMAIN),style:DwtMenu.GENERIC_WIDGET_STYLE}); | |
b.setMenu({menu:a,menuPopupStyle:DwtButton.MENU_POPUP_STYLE_CASCADE}); | |
var d=new DwtComboBox({parent:a,id:DwtId.makeId(ZmId.WIDGET_COMBOBOX,this._viewId,this.id,ZmAddressSearchFilter.ADDRESS),inputParams:{size:c},maxRows:ZmAddressSearchFilter.NUM_DOMAINS_TO_SHOW,layout:DwtMenu.LAYOUT_SCROLL,autoScroll:true}); | |
d.addChangeListener(this._domainChangeListener.bind(this)); | |
d.input.addListener(DwtEvent.ONKEYUP,this._keyUpListener.bind(this)); | |
a.addPopdownListener(d.popdown.bind(d)); | |
return d | |
}; | |
ZmAddressSearchFilter.prototype._initAutocomplete=function(){if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)||appCtxt.get(ZmSetting.GAL_ENABLED)||appCtxt.isOffline){var b={dataClass:appCtxt.getAutocompleter(),matchValue:ZmAutocomplete.AC_VALUE_EMAIL,compCallback:this._acCompHandler.bind(this),separator:"",contextId:[this._viewId,this.id].join("-")}; | |
var a=new ZmAutocompleteListView(b); | |
a.handle(this._addressBox.getInputElement()) | |
}}; | |
ZmAddressSearchFilter.prototype._acCompHandler=function(){this._doUpdate(this._addressBox.getValue()); | |
this._addressBox.clear() | |
}; | |
ZmAddressSearchFilter.prototype._domainChangeListener=function(a){if(a&&a.dwtObj){this._doUpdate(a._args.newValue) | |
}}; | |
ZmAddressSearchFilter.prototype._keyUpListener=function(a){var b=DwtKeyEvent.getCharCode(a); | |
if(b==13||b==3){this._doUpdate(this._domainBox.getText()) | |
}}; | |
ZmAddressSearchFilter.prototype._doUpdate=function(a){if(a){var b=new ZmSearchToken(this._searchOp,a); | |
this._updateCallback(b) | |
}}; | |
ZmAddressSearchFilter.prototype._setUi=function(b){this._addressBox=this._addInput(b,ZmMsg.address,ZmAddressSearchFilter.INPUT_WIDTH); | |
this._initAutocomplete(); | |
if(!ZmSearchResultsFilterPanel.domains){var a=new ZmDomainList(); | |
a.search("",ZmAddressSearchFilter.NUM_DOMAINS_TO_FETCH,this._addDomains.bind(this,b)) | |
}else{this._addDomains(b,ZmSearchResultsFilterPanel.domains) | |
}}; | |
ZmAddressSearchFilter.prototype._addDomains=function(e,a){ZmSearchResultsFilterPanel.domains=a; | |
this._domainBox=this._addComboBox(e,ZmMsg.domain,ZmAddressSearchFilter.INPUT_WIDTH); | |
if(a&&a.length){for(var b=0; | |
b<a.length; | |
b++){var c=a[b]; | |
var d=ZmAddressSearchFilter.ADDR[this._searchOp]; | |
if(c.hasAddress(d)){this._domainBox.add(c.name,c.name) | |
}}}}; | |
ZmAddressSearchFilter.prototype.reset=function(){if(this._domainBox){this._domainBox.setText("") | |
}if(this._addressBox){this._addressBox.setValue("") | |
}}; | |
ZmDateSearchFilter=function(a){this._calendar={}; | |
ZmSearchFilter.apply(this,arguments); | |
this._formatter=AjxDateFormat.getDateInstance(AjxDateFormat.SHORT) | |
}; | |
ZmDateSearchFilter.prototype=new ZmSearchFilter; | |
ZmDateSearchFilter.prototype.constructor=ZmDateSearchFilter; | |
ZmDateSearchFilter.prototype.isZmDateSearchFilter=true; | |
ZmDateSearchFilter.prototype.toString=function(){return"ZmDateSearchFilter" | |
}; | |
ZmDateSearchFilter.BEFORE="BEFORE"; | |
ZmDateSearchFilter.AFTER="AFTER"; | |
ZmDateSearchFilter.ON="ON"; | |
ZmDateSearchFilter.TEXT_KEY={}; | |
ZmDateSearchFilter.TEXT_KEY[ZmDateSearchFilter.BEFORE]="filterBefore"; | |
ZmDateSearchFilter.TEXT_KEY[ZmDateSearchFilter.AFTER]="filterAfter"; | |
ZmDateSearchFilter.TEXT_KEY[ZmDateSearchFilter.ON]="filterOn"; | |
ZmDateSearchFilter.OP={}; | |
ZmDateSearchFilter.OP[ZmDateSearchFilter.BEFORE]="before"; | |
ZmDateSearchFilter.OP[ZmDateSearchFilter.AFTER]="after"; | |
ZmDateSearchFilter.OP[ZmDateSearchFilter.ON]="date"; | |
ZmDateSearchFilter.prototype._createCalendar=function(e,c){var b=new DwtMenuItem({parent:e,id:ZmId.getMenuItemId(this._viewId,this.id,c)}); | |
b.setText(ZmMsg[ZmDateSearchFilter.TEXT_KEY[c]]); | |
var a=new DwtMenu({parent:b,id:ZmId.getMenuId(this._viewId,this.id,c),style:DwtMenu.CALENDAR_PICKER_STYLE}); | |
b.setMenu({menu:a,menuPopupStyle:DwtButton.MENU_POPUP_STYLE_CASCADE}); | |
var d=new DwtCalendar({parent:a,id:DwtId.makeId(ZmId.WIDGET_CALENDAR,this._viewId,this.id,c)}); | |
d.addSelectionListener(this._doUpdate.bind(this,c)); | |
return d | |
}; | |
ZmDateSearchFilter.prototype._doUpdate=function(c){var d=this._calendar[c]; | |
var a=this._formatter.format(d.getDate()); | |
var b=this._getSearchTerm(c,a); | |
this._updateCallback(b,true) | |
}; | |
ZmDateSearchFilter.prototype._getTypes=function(){return[ZmDateSearchFilter.BEFORE,ZmDateSearchFilter.AFTER,ZmDateSearchFilter.ON] | |
}; | |
ZmDateSearchFilter.prototype._getSearchTerm=function(b,a){return new ZmSearchToken(ZmDateSearchFilter.OP[b],a) | |
}; | |
ZmDateSearchFilter.prototype._setUi=function(c){var b=this._getTypes(); | |
for(var a=0; | |
a<b.length; | |
a++){var d=b[a]; | |
this._calendar[d]=this._createCalendar(c,d) | |
}}; | |
ZmApptDateSearchFilter=function(a){ZmDateSearchFilter.apply(this,arguments) | |
}; | |
ZmApptDateSearchFilter.prototype=new ZmDateSearchFilter; | |
ZmApptDateSearchFilter.prototype.constructor=ZmApptDateSearchFilter; | |
ZmApptDateSearchFilter.prototype.isZmApptDateSearchFilter=true; | |
ZmApptDateSearchFilter.prototype.toString=function(){return"ZmApptDateSearchFilter" | |
}; | |
ZmApptDateSearchFilter.prototype._getSearchTerm=function(b,a){if(b==ZmDateSearchFilter.BEFORE){return new ZmSearchToken("appt-start","<"+a) | |
}else{if(b==ZmDateSearchFilter.AFTER){return new ZmSearchToken("appt-end",">"+a) | |
}else{if(b==ZmDateSearchFilter.ON){return[new ZmSearchToken("appt-start","<="+a),new ZmSearchToken("appt-end",">="+a)] | |
}}}}; | |
ZmAttachmentSearchFilter=function(a){ZmSearchFilter.apply(this,arguments) | |
}; | |
ZmAttachmentSearchFilter.prototype=new ZmSearchFilter; | |
ZmAttachmentSearchFilter.prototype.constructor=ZmAttachmentSearchFilter; | |
ZmAttachmentSearchFilter.prototype.isZmAttachmentSearchFilter=true; | |
ZmAttachmentSearchFilter.prototype.toString=function(){return"ZmAttachmentSearchFilter" | |
}; | |
ZmAttachmentSearchFilter.prototype._setUi=function(b){if(!ZmSearchResultsFilterPanel.attTypes){var a=new ZmAttachmentTypeList(); | |
a.load(this._addAttachmentTypes.bind(this,b)) | |
}else{this._addAttachmentTypes(b,ZmSearchResultsFilterPanel.attTypes) | |
}}; | |
ZmAttachmentSearchFilter.prototype._addAttachmentTypes=function(f,b){ZmSearchResultsFilterPanel.attTypes=b; | |
var e={}; | |
if(b&&b.length){for(var c=0; | |
c<b.length; | |
c++){var a=b[c]; | |
if(e[a.desc]){continue | |
}var d=new DwtMenuItem({parent:f,id:ZmId.getMenuItemId(this._viewId,this.id,a.type.replace("/",":"))}); | |
d.setText(a.desc); | |
d.setImage(a.image); | |
d.setData(ZmSearchFilter.DATA_KEY,a.query||a.type); | |
e[a.desc]=true | |
}}else{var d=new DwtMenuItem({parent:f}); | |
d.setText(ZmMsg.noAtt) | |
}f.addSelectionListener(this._selectionListener.bind(this)) | |
}; | |
ZmAttachmentSearchFilter.prototype._selectionListener=function(c){var d=c&&c.dwtObj&&c.dwtObj.getData(ZmSearchFilter.DATA_KEY); | |
if(d&&this._searchOp){var b=[]; | |
if(d==ZmMimeTable.APP_ZIP||d==ZmMimeTable.APP_ZIP2){var a=(d==ZmMimeTable.APP_ZIP)?ZmMimeTable.APP_ZIP2:ZmMimeTable.APP_ZIP; | |
b.push(new ZmSearchToken(this._searchOp,d)); | |
b.push(new ZmSearchToken(ZmParsedQuery.COND_OR)); | |
b.push(new ZmSearchToken(this._searchOp,a)) | |
}else{b.push(new ZmSearchToken(this._searchOp,d)) | |
}this._updateCallback(b) | |
}}; | |
ZmSizeSearchFilter=function(a){this._input={}; | |
ZmSearchFilter.apply(this,arguments) | |
}; | |
ZmSizeSearchFilter.prototype=new ZmSearchFilter; | |
ZmSizeSearchFilter.prototype.constructor=ZmSizeSearchFilter; | |
ZmSizeSearchFilter.prototype.isZmSizeSearchFilter=true; | |
ZmSizeSearchFilter.prototype.toString=function(){return"ZmSizeSearchFilter" | |
}; | |
ZmSizeSearchFilter.LARGER="LARGER"; | |
ZmSizeSearchFilter.SMALLER="SMALLER"; | |
ZmSizeSearchFilter.UNIT="unit"; | |
ZmSizeSearchFilter.COMBO_INPUT_WIDTH=2; | |
ZmSizeSearchFilter.TYPES=[ZmSizeSearchFilter.LARGER,ZmSizeSearchFilter.SMALLER]; | |
ZmSizeSearchFilter.TEXT_KEY={}; | |
ZmSizeSearchFilter.TEXT_KEY[ZmSizeSearchFilter.LARGER]="filterLarger"; | |
ZmSizeSearchFilter.TEXT_KEY[ZmSizeSearchFilter.SMALLER]="filterSmaller"; | |
ZmSizeSearchFilter.OP={}; | |
ZmSizeSearchFilter.OP[ZmSizeSearchFilter.LARGER]="larger"; | |
ZmSizeSearchFilter.OP[ZmSizeSearchFilter.SMALLER]="smaller"; | |
ZmSizeSearchFilter.prototype._setUi=function(h){var d=ZmSizeSearchFilter.TYPES; | |
for(var c=0; | |
c<d.length; | |
c++){var f=d[c]; | |
var e=new DwtMenuItem({parent:h,id:ZmId.getMenuItemId(this._viewId,this.id,f)}); | |
e.setText(ZmMsg[ZmSizeSearchFilter.TEXT_KEY[f]]); | |
var b=new DwtMenu({parent:e,id:ZmId.getMenuId(this._viewId,this.id,f),style:DwtMenu.GENERIC_WIDGET_STYLE}); | |
b.addClassName(this.toString()+"SubMenu"); | |
e.setMenu({menu:b,menuPopupStyle:DwtButton.MENU_POPUP_STYLE_CASCADE}); | |
var a=this._input[f]=new DwtInputField({parent:b,type:DwtInputField.FLOAT,errorIconStyle:DwtInputField.ERROR_ICON_LEFT,validationStyle:DwtInputField.CONTINUAL_VALIDATION,size:5}); | |
a.setValidNumberRange(0,1000000); | |
var g=new DwtComboBox({parent:a,parentElement:a.getInputElement().parentNode,id:DwtId.makeId(ZmId.WIDGET_COMBOBOX,this._viewId,this.id,f+ZmSizeSearchFilter.UNIT),inputParams:{size:ZmSizeSearchFilter.COMBO_INPUT_WIDTH},useLabel:true,posStyle:DwtControl.ABSOLUTE_STYLE,className:this.toString()+"Combobox"}); | |
a.addListener(DwtEvent.ONKEYUP,this._keyUpListener.bind(this,f,g)); | |
g.addChangeListener(this._unitChangeListener.bind(this,f,g)); | |
g.add(ZmMsg.kb,"KB",true); | |
g.add(ZmMsg.mb,"MB") | |
}}; | |
ZmSizeSearchFilter.prototype._unitChangeListener=function(b,e,c){var d=this._input[b].getValue(); | |
if(d&&d!=""){var a=new ZmSearchToken(ZmSizeSearchFilter.OP[b],d+e.getValue()); | |
this._updateCallback(a) | |
}}; | |
ZmSizeSearchFilter.prototype._keyUpListener=function(c,g,e){var f=DwtKeyEvent.getCharCode(e); | |
var a=this._input[c]; | |
if(f==13||f==3){var d=a.getValidationError(); | |
if(d){appCtxt.setStatusMsg(d,ZmStatusView.LEVEL_WARNING) | |
}else{var b=new ZmSearchToken(ZmSizeSearchFilter.OP[c],a.getValue()+g.getValue()); | |
this._updateCallback(b) | |
}}}; | |
ZmStatusSearchFilter=function(a){ZmSearchFilter.apply(this,arguments) | |
}; | |
ZmStatusSearchFilter.prototype=new ZmSearchFilter; | |
ZmStatusSearchFilter.prototype.constructor=ZmStatusSearchFilter; | |
ZmStatusSearchFilter.prototype.isZmStatusSearchFilter=true; | |
ZmStatusSearchFilter.prototype.toString=function(){return"ZmStatusSearchFilter" | |
}; | |
ZmStatusSearchFilter.prototype._setUi=function(e){var a=ZmParsedQuery.IS_VALUES; | |
for(var b=0; | |
b<a.length; | |
b++){var d=a[b]; | |
var c=new DwtMenuItem({parent:e,id:ZmId.getMenuItemId(this._viewId,this.id,d)}); | |
c.setText(ZmMsg["QUERY_IS_"+d]); | |
c.setData(ZmSearchFilter.DATA_KEY,d) | |
}e.addSelectionListener(this._selectionListener.bind(this)) | |
}; | |
ZmTagSearchFilter=function(a){ZmSearchFilter.apply(this,arguments); | |
this._tagList=appCtxt.getTagTree(); | |
if(this._tagList){this._tagList.addChangeListener(this._tagChangeListener.bind(this)) | |
}}; | |
ZmTagSearchFilter.prototype=new ZmSearchFilter; | |
ZmTagSearchFilter.prototype.constructor=ZmTagSearchFilter; | |
ZmTagSearchFilter.prototype.isZmTagSearchFilter=true; | |
ZmTagSearchFilter.prototype.toString=function(){return"ZmTagSearchFilter" | |
}; | |
ZmTagSearchFilter.prototype._setUi=function(e){this._menu=e; | |
var b=appCtxt.getTagTree().asList(); | |
if(b&&b.length){for(var c=0; | |
c<b.length; | |
c++){var a=b[c]; | |
if(a.id==ZmOrganizer.ID_ROOT){continue | |
}var d=new DwtMenuItem({parent:e,id:ZmId.getMenuItemId(this._viewId,this.id,a.id)}); | |
d.setText(a.getName()); | |
d.setImage(a.getIconWithColor()); | |
d.setData(ZmSearchFilter.DATA_KEY,a.getName(false,null,true)) | |
}}e.addSelectionListener(this._selectionListener.bind(this)) | |
}; | |
ZmTagSearchFilter.prototype._tagChangeListener=function(a){if(this._menu){this._menu.removeChildren(); | |
this._setUi(this._menu) | |
}}; | |
ZmFolderSearchFilter=function(b){ZmSearchFilter.apply(this,arguments); | |
if(!ZmFolderSearchFilter.TEXT_KEY){ZmFolderSearchFilter._initConstants() | |
}var a=ZmMsg[ZmFolderSearchFilter.TEXT_KEY[this._resultsApp]]||ZmMsg.filterFolder; | |
b.parent.setText(a) | |
}; | |
ZmFolderSearchFilter.prototype=new ZmSearchFilter; | |
ZmFolderSearchFilter.prototype.constructor=ZmFolderSearchFilter; | |
ZmFolderSearchFilter.prototype.isZmFolderSearchFilter=true; | |
ZmFolderSearchFilter.prototype.toString=function(){return"ZmFolderSearchFilter" | |
}; | |
ZmFolderSearchFilter._initConstants=function(a){ZmFolderSearchFilter.TEXT_KEY={}; | |
ZmFolderSearchFilter.TEXT_KEY[ZmApp.MAIL]="filterFolder"; | |
ZmFolderSearchFilter.TEXT_KEY[ZmApp.CALENDAR]="filterCalendar"; | |
ZmFolderSearchFilter.TEXT_KEY[ZmApp.CONTACTS]="filterAddressBook"; | |
ZmFolderSearchFilter.TEXT_KEY[ZmApp.TASKS]="filterTasksFolder"; | |
ZmFolderSearchFilter.TEXT_KEY[ZmApp.BRIEFCASE]="filterBriefcase" | |
}; | |
ZmFolderSearchFilter.prototype._setUi=function(a){var d=this._moveMenu=new DwtMenu({parent:a,id:ZmId.getMenuId(this._viewId,this.id)}); | |
d.getHtmlElement().style.width="auto"; | |
a.setMenu({menu:d,menuPopupStyle:DwtButton.MENU_POPUP_STYLE_CASCADE}); | |
var b=this._folderChooser=new ZmFolderChooser({parent:d,id:DwtId.makeId(ZmId.WIDGET_CHOOSER,this._viewId,this.id),hideNewButton:true}); | |
var c=this._getMoveParams(b); | |
b.setupFolderChooser(c,this._selectionListener.bind(this)) | |
}; | |
ZmFolderSearchFilter.prototype._getMoveParams=function(a){return{overviewId:a.getOverviewId([this.toString(),this._resultsApp,this._viewId].join("_")),treeIds:[ZmApp.ORGANIZER[this._resultsApp]],noRootSelect:true,treeStyle:DwtTree.SINGLE_STYLE} | |
}; | |
ZmFolderSearchFilter.prototype._selectionListener=function(b){if(b){var a=new ZmSearchToken("in",b.createQuery(true)); | |
this._updateCallback(a); | |
this._moveMenu.popdown() | |
}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmTreeView")){ZmTreeView=function(a){if(arguments.length==0){return | |
}DwtTree.call(this,{parent:a.parent,parentElement:a.parentElement,style:a.treeStyle,isCheckedByDefault:a.isCheckedByDefault,className:(a.className||"OverviewTree"),posStyle:a.posStyle,id:a.id}); | |
this._headerClass=a.headerClass||"overviewHeader"; | |
this.overviewId=a.overviewId; | |
this.type=a.type; | |
this.allowedTypes=a.allowedTypes; | |
this.allowedSubTypes=a.allowedSubTypes; | |
this._overview=appCtxt.getOverviewController().getOverview(this.overviewId); | |
this._dragSrc=a.dragSrc; | |
this._dropTgt=a.dropTgt; | |
this.actionSupported=a.actionSupported!==undefined?a.actionSupported:this._overview.actionSupported; | |
this.dynamicWidth=this._overview.dynamicWidth; | |
this._dataTree=null; | |
this._treeItemHash={}; | |
this._idToOrganizer={} | |
}; | |
ZmTreeView.KEY_TYPE="_type_"; | |
ZmTreeView.KEY_ID="_treeId_"; | |
ZmTreeView.COMPARE_FUNC={}; | |
ZmTreeView.ADD_SEP={}; | |
ZmTreeView.ADD_SEP[ZmFolder.ID_TRASH]=true; | |
ZmTreeView.MAX_ITEMS=50; | |
ZmTreeView.getSortIndex=function(f,b,a){if(!a){return null | |
}var e=f.getItemCount(); | |
var d=f.getItems(); | |
for(var c=0; | |
c<d.length; | |
c++){if(d[c]._isSeparator){continue | |
}var h=d[c].getData(Dwt.KEY_OBJECT); | |
if(!h){continue | |
}var g=a(b,h); | |
if(g==-1){return c | |
}}return c | |
}; | |
ZmTreeView.prototype=new DwtTree; | |
ZmTreeView.prototype.constructor=ZmTreeView; | |
ZmTreeView.prototype.toString=function(){return"ZmTreeView" | |
}; | |
ZmTreeView.prototype.set=function(f){this._showUnread=f.showUnread; | |
this._dataTree=f.dataTree; | |
this._optButton=f.optButton; | |
this.clearItems(); | |
var b=this._dataTree.root; | |
var e=(appCtxt.multiAccounts&&(this.type==ZmOrganizer.SEARCH||this.type==ZmOrganizer.TAG)); | |
var a=this._getHeaderTreeItemImage(); | |
var d=this._headerItem=new DwtHeaderTreeItem({parent:this,className:e?"DwtTreeItem":this._headerClass,imageInfo:a,id:ZmId.getTreeItemId(this.overviewId,null,this.type),optButton:f.optButton,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId}); | |
d._isHeader=true; | |
var c=ZmMsg[ZmOrganizer.LABEL[this.type]]||b.name; | |
if(c){d.setText(c) | |
}d.setData(Dwt.KEY_ID,b.id); | |
d.setData(Dwt.KEY_OBJECT,b); | |
d.setData(ZmTreeView.KEY_ID,this.overviewId); | |
d.setData(ZmTreeView.KEY_TYPE,this.type); | |
if(this._dropTgt){d.setDropTarget(this._dropTgt) | |
}this._treeItemHash[b.id]=d; | |
d.getHtmlElement().style.overflow="hidden"; | |
f.treeNode=d; | |
f.organizer=b; | |
this._render(f); | |
d.setExpanded(!f.collapsed,null,true); | |
if(!appCtxt.multiAccounts){this.addSeparator() | |
}if(appCtxt.getSkinHint("noOverviewHeaders")||this._hideHeaderTreeItem()){d.setVisible(false,true) | |
}}; | |
ZmTreeView.prototype.getTreeItemById=function(a){return this._treeItemHash[a] | |
}; | |
ZmTreeView.prototype.getHeaderItem=function(){return this._headerItem | |
}; | |
ZmTreeView.prototype.getSelected=function(){if(this.isCheckedStyle){var c=[]; | |
for(var a in this._treeItemHash){var b=this._treeItemHash[a]; | |
if(b&&b.getChecked()){c.push(b.getData(Dwt.KEY_OBJECT)) | |
}}return c | |
}else{return(this.getSelectionCount()!=1)?null:this.getSelection()[0].getData(Dwt.KEY_OBJECT) | |
}}; | |
ZmTreeView.prototype.setSelected=function(a,b,d){var c=ZmOrganizer.getSystemId((a instanceof ZmOrganizer)?a.id:a); | |
if(!c||!this._treeItemHash[c]){return | |
}this.setSelection(this._treeItemHash[c],b,false,d) | |
}; | |
ZmTreeView.prototype._render=function(params){params.omit=params.omit||{}; | |
this._setOmit(params.omit,params.dataTree); | |
var org=params.organizer; | |
var children=org.children.getArray(); | |
if(org.isDataSource(ZmAccount.TYPE_IMAP)){children.sort(ZmImapAccount.sortCompare) | |
}else{if(ZmTreeView.COMPARE_FUNC[this.type]){if(appCtxt.isOffline&&this.type==ZmOrganizer.SEARCH){var local=[]; | |
for(var j=0; | |
j<children.length; | |
j++){var child=children[j]; | |
if(child&&child.type==ZmOrganizer.SEARCH&&!child.isOfflineGlobalSearch){local.push(child) | |
}}children=local | |
}if(appCtxt.isChildWindow&&AjxEnv.isIE){var children1=[]; | |
for(var i=0,len=children.length; | |
i<len; | |
i++){children1.push(children[i]) | |
}children=children1 | |
}children.sort(eval(ZmTreeView.COMPARE_FUNC[this.type])) | |
}}var addSep=true; | |
var numItems=0; | |
var len=children.length; | |
if(params.startPos===undefined&¶ms.lastRenderedFolder){for(var i=0,len=children.length; | |
i<len; | |
i++){if(params.lastRenderedFolder==children[i]){params.startPos=i+1; | |
break | |
}}}for(var i=params.startPos||0; | |
i<len; | |
i++){var child=children[i]; | |
if(!child||(params.omit&¶ms.omit[child.nId])){continue | |
}if(!(params.include&¶ms.include[child.nId])){if(!this._isAllowed(org,child)){if(params.omitParents){continue | |
}var proxy=AjxUtil.createProxy(params); | |
proxy.treeNode=null; | |
proxy.organizer=child; | |
this._render(proxy); | |
continue | |
}}if(child.numTotal==0&&(child.nId==ZmFolder.ID_SYNC_FAILURES)){continue | |
}var parentNode=params.treeNode; | |
var account=appCtxt.multiAccounts&&child.getAccount(); | |
if(account&&account.isCalDavBased()&&child.parent.nId==ZmOrganizer.ID_CALENDAR){parentNode=parentNode.parent | |
}if(numItems>=ZmTreeView.MAX_ITEMS){if(params.startPos){params.startPos=i; | |
params.len=(params.startPos+ZmTreeView.MAX_ITEMS>=len)?len:0; | |
this._showRemainingFolders(params); | |
return | |
}else{if(numItems>=ZmTreeView.MAX_ITEMS*2){var orgs=ZmMsg[ZmOrganizer.LABEL[this.type]].toLowerCase(); | |
var name=AjxMessageFormat.format(ZmMsg.showRemainingFolders,orgs); | |
child=new ZmFolder({id:ZmFolder.ID_LOAD_FOLDERS,name:name,parent:org}); | |
child._tooltip=AjxMessageFormat.format(ZmMsg.showRemainingFoldersTooltip,[(children.length-i),orgs]); | |
var ti=this._addNew(parentNode,child); | |
ti.enableSelection(true); | |
if(this.isCheckedStyle){ti.showCheckBox(false) | |
}params.lastRenderedFolder=children[i-1]; | |
params.showRemainingFoldersNode=ti; | |
child._showFoldersCallback=new AjxCallback(this,this._showRemainingFolders,[params]); | |
if(this._dragSrc){ti._dragHover=this._showRemainingFolders.bind(this,params) | |
}return | |
}}}if((org.nId==ZmOrganizer.ID_ROOT)&&child.link&&addSep){params.treeNode.addSeparator(); | |
addSep=false | |
}this._addNew(parentNode,child,null,params.noTooltips,params.omit); | |
numItems++ | |
}}; | |
ZmTreeView.prototype._setOmit=function(c,d){for(var e in ZmFolder.HIDE_ID){c[e]=true | |
}d=this.type!==ZmOrganizer.VOICE&&d; | |
if(!d){return | |
}for(var a in ZmFolder.HIDE_NAME){var b=d.getByName(a); | |
if(b){c[b.id]=true | |
}}}; | |
ZmTreeView.prototype._isAllowed=function(d,c){if(!d){return true | |
}if(this.type===ZmOrganizer.SEARCH&&c.type===ZmOrganizer.SEARCH&&this._overview.appName){var a=c.search.types&&c.search.types.getArray(); | |
if(!a||a.length===0){a=[ZmItem.MSG] | |
}var b=AjxUtil.intersection(a,ZmApp.SEARCH_TYPES[this._overview.appName]||ZmApp.SEARCH_TYPES[appCtxt.getCurrentAppName()]); | |
if(b.length===0){return false | |
}}if(d.nId==ZmOrganizer.ID_ROOT){return this.allowedTypes[c.type] | |
}if(this.allowedTypes[c.type]){return true | |
}if(this.allowedSubTypes[c.type]){return this._isAllowed(d.parent,d) | |
}return false | |
}; | |
ZmTreeView.prototype._addNew=function(h,m,i,l,c){var b; | |
var n; | |
var a=(m.type==ZmOrganizer.FOLDER)&&appCtxt.getDataSourceCollection(); | |
var k=a&&a.getByFolderId(m.nId); | |
var d=(k&&k.length>0)?k[0]:null; | |
if(d&&d.type==ZmAccount.TYPE_IMAP){var g=appCtxt.isFamilyMbox?null:this._headerClass; | |
b=new DwtHeaderTreeItem({parent:this,text:m.getName(),className:g}) | |
}else{if(!h){var j=[]; | |
var f=m.parent; | |
if(f){while((h=this.getTreeItemById(f.id))==null){j.push(f); | |
f=f.parent | |
}}while(f=j.pop()){h=this.getTreeItemById(f.parent.id); | |
n=ZmId.getTreeItemId(this.overviewId,f.id); | |
h=new DwtTreeItem({parent:h,text:f.getName(),imageInfo:f.getIconWithColor(),forceNotifySelection:true,arrowDisabled:!this.actionSupported,dynamicWidth:this.dynamicWidth,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,id:n}); | |
h.setData(Dwt.KEY_ID,f.id); | |
h.setData(Dwt.KEY_OBJECT,f); | |
h.setData(ZmTreeView.KEY_ID,this.overviewId); | |
h.setData(ZmTreeView.KEY_TYPE,f.type); | |
this._treeItemHash[f.id]=h; | |
this._idToOrganizer[n]=f.id | |
}}var e={parent:h,index:i,text:m.getName(this._showUnread),arrowDisabled:!this.actionSupported,dynamicWidth:this.dynamicWidth,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,imageInfo:m.getIconWithColor(),id:ZmId.getTreeItemId(this.overviewId,m.id)}; | |
b=new DwtTreeItem(e); | |
this._idToOrganizer[e.id]=m.id | |
}if(appCtxt.multiAccounts&&(m.type==ZmOrganizer.SEARCH||m.type==ZmOrganizer.TAG)){b.addClassName("DwtTreeItemChildDiv") | |
}b.setDndText(m.getName()); | |
b.setData(Dwt.KEY_ID,m.id); | |
b.setData(Dwt.KEY_OBJECT,m); | |
b.setData(ZmTreeView.KEY_ID,this.overviewId); | |
b.setData(ZmTreeView.KEY_TYPE,m.type); | |
if(!l){var o=m.getToolTip(); | |
if(o){b.setToolTipContent(o) | |
}}if(this._dragSrc){b.setDragSource(this._dragSrc) | |
}if(this._dropTgt){b.setDropTarget(this._dropTgt) | |
}this._treeItemHash[m.id]=b; | |
if(ZmTreeView.ADD_SEP[m.nId]){h.addSeparator() | |
}if(m.children&&m.children.size()){this._render({treeNode:b,organizer:m,omit:c}) | |
}if(d&&d.type==ZmAccount.TYPE_IMAP){b.setExpanded(!appCtxt.get(ZmSetting.COLLAPSE_IMAP_TREES)) | |
}return b | |
}; | |
ZmTreeView.prototype.getNextData=function(b){var g=this.getTreeItemById(b); | |
if(!g||!g.parent){return null | |
}while(g&&g.parent){var d=g.parent; | |
if(!(d instanceof DwtTreeItem)){return null | |
}var a=d.getItems(); | |
var j=null; | |
if(a&&a.length>1){for(var e=0; | |
e<a.length; | |
e++){var f=a[e]; | |
if(f==g){var h=this.findNext(g,a,e); | |
if(h){return h | |
}var c=this.findPrev(g,a,e); | |
if(c){return c | |
}}}}g=g.parent | |
}return null | |
}; | |
ZmTreeView.prototype.findNext=function(e,d,b){for(var a=b+1; | |
a<d.length; | |
a++){var c=d[a]; | |
if(c&&c.getData){return c.getData(Dwt.KEY_OBJECT) | |
}}return null | |
}; | |
ZmTreeView.prototype.findPrev=function(e,d,b){for(var a=b-1; | |
a>=0; | |
a--){var c=d[a]; | |
if(c&&c.getData){return c.getData(Dwt.KEY_OBJECT) | |
}}return null | |
}; | |
ZmTreeView.prototype._showRemainingFolders=function(a){if(a.showRemainingFoldersNode){a.showRemainingFoldersNode.dispose() | |
}AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){this._render(a); | |
if(a.len){var b=ZmMsg[ZmOrganizer.LABEL[this.type]].toLowerCase(); | |
appCtxt.setStatusMsg(AjxMessageFormat.format(ZmMsg.foldersShown,[a.len,b])); | |
a.len=0 | |
}}),100) | |
}; | |
ZmTreeView.prototype._getNextTreeItem=function(b){var a=DwtTree.prototype._getNextTreeItem.apply(this,arguments); | |
return a||(this._overview&&this._overview._getNextTreeItem(b,this)) | |
}; | |
ZmTreeView.prototype._getFirstTreeItem=function(){if(!this._overview){return DwtTree.prototype._getFirstTreeItem.call(a) | |
}var b=this._overview.getTreeViews(); | |
var a=this._overview.getTreeView(b[0]); | |
return a&&DwtTree.prototype._getFirstTreeItem.call(a) | |
}; | |
ZmTreeView.prototype._getLastTreeItem=function(){if(!this._overview){return DwtTree.prototype._getLastTreeItem.call(a) | |
}var b=this._overview.getTreeViews(); | |
var a=this._overview.getTreeView(b[b.length-1]); | |
return a&&DwtTree.prototype._getLastTreeItem.call(a) | |
}; | |
ZmTreeView.prototype._hideHeaderTreeItem=function(){return(appCtxt.multiAccounts&&appCtxt.accountList.size()>1&&(this.type==ZmOrganizer.FOLDER||this.type==ZmOrganizer.ADDRBOOK||this.type==ZmOrganizer.CALENDAR||this.type==ZmOrganizer.TASKS||this.type==ZmOrganizer.BRIEFCASE||this.type==ZmOrganizer.PREF_PAGE||this.type==ZmOrganizer.ZIMLET)) | |
}; | |
ZmTreeView.prototype._getHeaderTreeItemImage=function(){if(appCtxt.multiAccounts){if(this.type==ZmOrganizer.SEARCH){return"SearchFolder" | |
}if(this.type==ZmOrganizer.TAG){return"TagStack" | |
}}return null | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmTagMenu")){ZmTagMenu=function(b,a){ZmPopupMenu.call(this,b,null,b.getHTMLElId()+"|MENU",a); | |
b.setMenu(this); | |
this._addHash={}; | |
this._removeHash={}; | |
this._evtMgr=new AjxEventMgr(); | |
this._desiredState=true; | |
this._items=null; | |
this._dirty=true; | |
if(b instanceof DwtMenuItem){b.setHoverDelay(ZmTagMenu._HOVER_TIME) | |
}}; | |
ZmTagMenu.prototype=new ZmPopupMenu; | |
ZmTagMenu.prototype.constructor=ZmTagMenu; | |
ZmTagMenu.KEY_TAG_EVENT="_tagEvent_"; | |
ZmTagMenu.KEY_TAG_ADDED="_tagAdded_"; | |
ZmTagMenu.MENU_ITEM_ADD_ID="tag_add"; | |
ZmTagMenu.MENU_ITEM_REM_ID="tag_remove"; | |
ZmTagMenu._HOVER_TIME=200; | |
ZmTagMenu.prototype.toString=function(){return"ZmTagMenu" | |
}; | |
ZmTagMenu.prototype.addSelectionListener=function(a){this._evtMgr.addListener(DwtEvent.SELECTION,a) | |
}; | |
ZmTagMenu.prototype.removeSelectionListener=function(a){this._evtMgr.removeListener(DwtEvent.SELECTION,a) | |
}; | |
ZmTagMenu.prototype.setEnabled=function(a){this._desiredState=a; | |
if(a&&!this._tagList){return | |
}this.parent.setEnabled(a) | |
}; | |
ZmTagMenu.prototype.set=function(a,b){this._tagList=b; | |
this._items=a; | |
this._dirty=true; | |
if(this.parent instanceof DwtMenuItem){this.parent.setHoverDelay(ZmTagMenu._HOVER_TIME) | |
}}; | |
ZmTagMenu.prototype._doPopup=function(b,e,c){if(this._dirty){this.removeChildren(); | |
if(this._tagList){var d=this._tagList.root; | |
var a=this._getAddRemove(this._items,d); | |
this._render(d,a) | |
}this._dirty=false; | |
if(this.parent instanceof DwtMenuItem){this.parent.setHoverDelay(0) | |
}}ZmPopupMenu.prototype._doPopup.call(this,b,e,c) | |
}; | |
ZmTagMenu.prototype._getAddRemove=function(g,k){var h={}; | |
var f={}; | |
for(var e=0; | |
e<g.length; | |
e++){var n=g[e]; | |
if(!n.tags){continue | |
}for(var c=0; | |
c<n.tags.length; | |
c++){var b=n.tags[c]; | |
h[b]=h[b]||0; | |
f[b]=true; | |
if(!n.canAddTag(b)){h[b]+=1 | |
}}}var d=AjxUtil.keys(f); | |
var m=[]; | |
var l=k.children.getArray(); | |
for(e=0; | |
e<l.length; | |
e++){var o=l[e]; | |
b=o.name; | |
if(!h[b]||(h[b]<g.length)){m.push(b) | |
}}return{add:m,remove:d} | |
}; | |
ZmTagMenu.prototype._render=function(j,k){for(var f=0; | |
f<k.add.length; | |
f++){var c=k.add[f]; | |
this._addNewTag(this,c,j,true,null,this._addHash) | |
}if(k.add.length){new DwtMenuItem({parent:this,style:DwtMenuItem.SEPARATOR_STYLE}) | |
}var a=appCtxt.getCurrentController()&&appCtxt.getCurrentController().getKeyMapName(); | |
var e=a?(a+"_newtag"):this._htmlElId+"|NEWTAG"; | |
var d=a?(a+"_removetag"):this._htmlElId+"|REMOVETAG"; | |
var l=this._menuItems[ZmTagMenu.MENU_ITEM_ADD_ID]=new DwtMenuItem({parent:this,id:e}); | |
l.setText(ZmMsg.newTag); | |
l.setImage("NewTag"); | |
l.setShortcut(appCtxt.getShortcutHint(this._keyMap,ZmKeyMap.NEW_TAG)); | |
l.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_CREATE); | |
l.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0); | |
l.setEnabled(!appCtxt.isWebClientOffline()); | |
var n=this._menuItems[ZmTagMenu.MENU_ITEM_REM_ID]=new DwtMenuItem({parent:this,id:d}); | |
n.setEnabled(false); | |
n.setText(ZmMsg.removeTag); | |
n.setImage("DeleteTag"); | |
var h=k.remove; | |
if(h.length>0){n.setEnabled(true); | |
var b=null; | |
if(h.length>1){for(f=0; | |
f<h.length; | |
f++){if(!b){b=new DwtMenu({parent:n,className:this._className}); | |
n.setMenu(b); | |
b.setHtmlElementId("REMOVE_TAG_MENU_"+this.getHTMLElId()) | |
}var c=h[f]; | |
var m="Remove_tag_"+f; | |
this._addNewTag(b,c,j,false,null,this._removeHash,m) | |
}new DwtMenuItem({parent:b,style:DwtMenuItem.SEPARATOR_STYLE}); | |
var g=new DwtMenuItem({parent:b,id:"REMOVE_ALL_TAGS"}); | |
g.setText(ZmMsg.allTags); | |
g.setImage("TagStack"); | |
g.setShortcut(appCtxt.getShortcutHint(this._keyMap,ZmKeyMap.UNTAG)); | |
g.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_REMOVE_ALL); | |
g.setData(Dwt.KEY_OBJECT,h); | |
g.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0) | |
}else{var o=j.getByNameOrRemote(h[0]); | |
n.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_TAGS); | |
n.setData(ZmTagMenu.KEY_TAG_ADDED,false); | |
n.setData(Dwt.KEY_OBJECT,o); | |
n.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0) | |
}}}; | |
ZmTagMenu.tagNameLength=20; | |
ZmTagMenu.prototype._addNewTag=function(a,c,h,j,f,e,i){var k=h.getByNameOrRemote(c); | |
var d=new DwtMenuItem({parent:a,index:f,id:i}); | |
var b=AjxStringUtil.clipByLength(k.getName(false),ZmTagMenu.tagNameLength); | |
var g=k.notLocal?AjxMessageFormat.format(ZmMsg.tagNotLocal,b):b; | |
d.setText(g); | |
d.setImage(k.getIconWithColor()); | |
d.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_TAGS); | |
d.setData(ZmTagMenu.KEY_TAG_ADDED,j); | |
d.setData(Dwt.KEY_OBJECT,k); | |
d.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0); | |
e[k.id]=d | |
}; | |
ZmTagMenu.prototype._menuItemSelectionListener=function(a){if(a.item.getData(ZmTagMenu.KEY_TAG_EVENT)){this._evtMgr.notifyListeners(DwtEvent.SELECTION,a) | |
}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmListView")){ZmListView=function(d){if(arguments.length==0){return | |
}d.id=d.id||ZmId.getViewId(d.view); | |
DwtListView.call(this,d); | |
this.view=d.view; | |
this.type=d.type; | |
this._controller=d.controller; | |
this.setDropTarget(d.dropTgt); | |
this._listChangeListener=new AjxListener(this,this._changeListener); | |
this._tagListChangeListener=new AjxListener(this,this._tagChangeListener); | |
var c=appCtxt.getTagTree(); | |
if(c){c.addChangeListener(this._tagListChangeListener) | |
}var b=appCtxt.getFolderTree(); | |
if(b){this._boundFolderChangeListener=this._folderChangeListener.bind(this); | |
b.addChangeListener(this._boundFolderChangeListener) | |
}this._handleEventType={}; | |
this._handleEventType[this.type]=true; | |
this._disallowSelection={}; | |
this._disallowSelection[ZmItem.F_FLAG]=true; | |
this._disallowSelection[ZmItem.F_MSG_PRIORITY]=true; | |
this._selectAllEnabled=false; | |
if(d.dropTgt){var a={container:this._parentEl,threshold:15,amount:5,interval:10,id:d.id}; | |
this._dndScrollCallback=new AjxCallback(null,DwtControl._dndScrollCallback,[a]); | |
this._dndScrollId=d.id | |
}this._isPageless=d.pageless; | |
if(this._isPageless){Dwt.setHandler(this._getScrollDiv(),DwtEvent.ONSCROLL,ZmListView.handleScroll) | |
}this._state={} | |
}; | |
ZmListView.prototype=new DwtListView; | |
ZmListView.prototype.constructor=ZmListView; | |
ZmListView.prototype.isZmListView=true; | |
ZmListView.prototype.toString=function(){return"ZmListView" | |
}; | |
ZmListView.KEY_ID="_keyId"; | |
ZmListView.COL_WIDTH_ICON=19; | |
ZmListView.COL_WIDTH_NARROW_ICON=11; | |
ZmListView.FIELD_CLASS={}; | |
ZmListView.FIELD_CLASS[ZmItem.F_TYPE]="ListViewIcon"; | |
ZmListView.FIELD_CLASS[ZmItem.F_FLAG]="Flag"; | |
ZmListView.FIELD_CLASS[ZmItem.F_TAG]="Tag"; | |
ZmListView.FIELD_CLASS[ZmItem.F_ATTACHMENT]="Attach"; | |
ZmListView.ITEM_FLAG_CLICKED=DwtListView._LAST_REASON+1; | |
ZmListView.DEFAULT_REPLENISH_THRESHOLD=0; | |
ZmListView.COL_JOIN="|"; | |
ZmListView.CHECKED_IMAGE="CheckboxChecked"; | |
ZmListView.UNCHECKED_IMAGE="CheckboxUnchecked"; | |
ZmListView.CHECKED_CLASS="ImgCheckboxChecked"; | |
ZmListView.UNCHECKED_CLASS="ImgCheckboxUnchecked"; | |
ZmListView.ITEM_CHECKED_ATT_NAME="itemChecked"; | |
ZmListView.prototype._getHeaderList=function(){}; | |
ZmListView.prototype.getController=function(){return this._controller | |
}; | |
ZmListView.prototype.set=function(e,c){this._sortByString=this._controller._currentSearch&&this._controller._currentSearch.sortBy; | |
if(this._sortByString){this._sortByString=this._sortByString.replace("asc","Asc").replace("desc","Desc") | |
}var d=appCtxt.getSettings(); | |
if(!appCtxt.isExternalAccount()&&this.view){appCtxt.set(ZmSetting.SORTING_PREF,this._sortByString,this.view,false,false,null,d&&!d.persistImplicitSortPrefs(this.view)) | |
}this.setSelectionHdrCbox(false); | |
if(appCtxt.multiAccounts){var f=appCtxt.getTagTree(); | |
if(f){f.addChangeListener(this._tagListChangeListener) | |
}}if(this._isPageless){if(this._itemsToAdd){if(this._itemsToAdd.length){this.addItems(this._itemsToAdd); | |
this._itemsToAdd=null | |
}}else{var b=e; | |
if(e&&e.isZmList){e.addChangeListener(this._listChangeListener); | |
b=e.getSubList(0,e.size()) | |
}DwtListView.prototype.set.call(this,b,c) | |
}this._setRowHeight() | |
}else{var a; | |
if(e&&e.isZmList){e.addChangeListener(this._listChangeListener); | |
a=e.getSubList(this.offset,this.getLimit()) | |
}else{a=e | |
}DwtListView.prototype.set.call(this,a,c) | |
}this._rendered=true; | |
if(this._isPageless){AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._checkItemCount),1000) | |
}}; | |
ZmListView.prototype.reset=function(){this._rendered=false | |
}; | |
ZmListView.prototype.setUI=function(a){DwtListView.prototype.setUI.call(this,a); | |
this._resetColWidth() | |
}; | |
ZmListView.prototype.getLimit=function(b){if(this._isPageless){var a=appCtxt.get(ZmSetting.PAGE_SIZE); | |
return b?a:2*a | |
}else{return appCtxt.get(ZmSetting.PAGE_SIZE) | |
}}; | |
ZmListView.prototype.getPagelessThreshold=function(){return Math.ceil(this.getLimit()/5) | |
}; | |
ZmListView.prototype.getReplenishThreshold=function(){return ZmListView.DEFAULT_REPLENISH_THRESHOLD | |
}; | |
ZmListView.prototype.getItemList=function(){return this._controller&&this._controller._list | |
}; | |
ZmListView.prototype._changeListener=function(m){var n=this._getItemFromEvent(m); | |
if(!n||m.handled||!this._handleEventType[n.type]){return | |
}if(m.event===ZmEvent.E_TAGS||m.event===ZmEvent.E_REMOVE_ALL){this._replaceTagImage(n,ZmItem.F_TAG,this._getClasses(ZmItem.F_TAG)) | |
}if(m.event===ZmEvent.E_FLAGS){var a=m.getDetail("flags"); | |
for(var b=0; | |
b<a.length; | |
b++){var k=a[b]; | |
var f=n[ZmItem.FLAG_PROP[k]]; | |
if(k===ZmItem.FLAG_FLAGGED){this._setImage(n,ZmItem.F_FLAG,f?"FlagRed":"FlagDis",this._getClasses(ZmItem.F_FLAG)) | |
}else{if(k===ZmItem.FLAG_ATTACH){this._setImage(n,ZmItem.F_ATTACHMENT,f?"Attachment":null,this._getClasses(ZmItem.F_ATTACHMENT)) | |
}else{if(k===ZmItem.FLAG_PRIORITY){this._setImage(n,ZmItem.F_MSG_PRIORITY,f?"Priority":"PriorityDis",this._getClasses(ZmItem.F_MSG_PRIORITY)) | |
}}}}}if(m.event===ZmEvent.E_DELETE||m.event===ZmEvent.E_MOVE){var h=m.batchMode?this._getItemsFromBatchEvent(m):[n]; | |
var l=false; | |
for(var c=0,e=h.length; | |
c<e; | |
c++){var n=h[c]; | |
var g=(n.type===ZmId.ITEM_CONV)?n.folders[this._folderId]:n.folderId===this._folderId; | |
if(g&&m.event===ZmEvent.E_MOVE){if(this._getRowIndex(n)===null){this.addItem(n); | |
l=true | |
}}else{if(m.event===ZmEvent.E_DELETE||this.view==appCtxt.getCurrentViewId()||this._controller._currentSearch.matches(n)===false){this.removeItem(n,true,m.batchMode); | |
var d=this.getItemList(); | |
if(m.event!==ZmEvent.E_MOVE||!d.isCanonical){d.remove(n) | |
}}}}if(l){this._saveState({scroll:true,selection:true,focus:true}); | |
this._redoSearch(this._restoreState.bind(this,this._state)) | |
}if(m.batchMode){this._fixAlternation(0) | |
}this._checkReplenishOnTimer(); | |
this._controller._resetToolbarOperations() | |
}this._updateLabelForItem(n) | |
}; | |
ZmListView.prototype._getItemFromEvent=function(c){var b=c.item; | |
if(!b){var a=c.getDetail("items"); | |
b=(a&&a.length)?a[0]:null | |
}return b | |
}; | |
ZmListView.prototype._getItemsFromBatchEvent=function(e){if(!e.batchMode){return[] | |
}var b=e.items; | |
if(!b){b=[]; | |
var f=e.getDetail("notifs"); | |
if(f&&f.length){for(var d=0,a=f.length; | |
d<a; | |
d++){var c=f[d]; | |
b.push(c.item||appCtxt.cacheGet(c.id)) | |
}}}return b | |
}; | |
ZmListView.prototype._updateField=function(d,e){var a=this._getFieldId(d,e); | |
var c=document.getElementById(a); | |
if(c){var b=[]; | |
var f=this._headerHash[e]&&this._headerHash[e]._index; | |
this._getCellContents(b,0,d,e,f,new Date()); | |
c.innerHTML=$(b.join("")).html() | |
}this._updateLabelForItem(d) | |
}; | |
ZmListView.prototype._checkReplenishOnTimer=function(a){if(!this.allSelected){if(!this._isPageless){this._controller._app._checkReplenishListView=this | |
}else{if(!this._replenishTimedAction){this._replenishTimedAction=new AjxTimedAction(this,this._handleResponseCheckReplenish) | |
}AjxTimedAction.scheduleAction(this._replenishTimedAction,10) | |
}}}; | |
ZmListView.prototype._checkReplenish=function(b,a){var c=new AjxCallback(this,this._handleResponseCheckReplenish,[false,b,a]); | |
this._controller._checkReplenish(c) | |
}; | |
ZmListView.prototype._handleResponseCheckReplenish=function(c,b,a){if(this.size()==0){this._controller._handleEmptyList(this) | |
}else{this._controller._resetNavToolBarButtons() | |
}if(!c){this._setNextSelection(b,a) | |
}}; | |
ZmListView.prototype._folderChangeListener=function(d){if(appCtxt.getCurrentController()!=this._controller){return | |
}if(this._controller._app._checkReplenishListView==this){return | |
}var c=d.getDetail("organizers"); | |
var b=(c&&c.length)?c[0]:d.source; | |
var e=b.id; | |
var a=d.getDetail("fields"); | |
if(d.event==ZmEvent.E_MODIFY){if(!a){return | |
}if(a[ZmOrganizer.F_TOTAL]){this._controller._resetNavToolBarButtons() | |
}}}; | |
ZmListView.prototype._tagChangeListener=function(f){if(f.type!=ZmEvent.S_TAG){return | |
}var b=f.getDetail("fields"); | |
var d=this._getChildren(); | |
var a=f.getDetail("organizers")[0]; | |
for(var c=0; | |
c<d.length; | |
c++){var e=this.getItemFromElement(d[c]); | |
if(!e||!e.tags||!e.hasTag(a.name)){continue | |
}var g=false; | |
if(f.event==ZmEvent.E_MODIFY&&(b&&(b[ZmOrganizer.F_COLOR]||b[ZmOrganizer.F_NAME]))){g=e.tags.length==1 | |
}else{if(f.event==ZmEvent.E_DELETE){g=true | |
}else{if(f.event==ZmEvent.E_CREATE){g=true | |
}}}if(g){this._replaceTagImage(e,ZmItem.F_TAG,this._getClasses(ZmItem.F_TAG)) | |
}}}; | |
ZmListView.prototype._getChildren=function(){return this._parentEl.childNodes | |
}; | |
ZmListView.prototype._getRowId=function(a){return DwtId.getListViewItemId(DwtId.WIDGET_ITEM_FIELD,this._view,a?a.id:Dwt.getNextId(),ZmItem.F_ITEM_ROW) | |
}; | |
ZmListView.prototype._getCellId=function(a,b){if(b==ZmItem.F_DATE){return this._getFieldId(a,b) | |
}else{if(b==ZmItem.F_SELECTION){return this._getFieldId(a,ZmItem.F_SELECTION_CELL) | |
}else{return DwtListView.prototype._getCellId.apply(this,arguments) | |
}}}; | |
ZmListView.prototype._getCellClass=function(a,b,c){return ZmListView.FIELD_CLASS[b] | |
}; | |
ZmListView.prototype._getCellContents=function(b,a,d,e,h,g,c){if(e==ZmItem.F_SELECTION){a=this._getImageHtml(b,a,"CheckboxUnchecked",this._getFieldId(d,e),c) | |
}else{if(e==ZmItem.F_TYPE){a=this._getImageHtml(b,a,ZmItem.ICON[d.type],this._getFieldId(d,e),c) | |
}else{if(e==ZmItem.F_FLAG){a=this._getImageHtml(b,a,this._getFlagIcon(d.isFlagged),this._getFieldId(d,e),c) | |
}else{if(e==ZmItem.F_TAG){a=this._getImageHtml(b,a,d.getTagImageInfo(),this._getFieldId(d,e),c) | |
}else{if(e==ZmItem.F_ATTACHMENT){a=this._getImageHtml(b,a,d.hasAttach?"Attachment":null,this._getFieldId(d,e),c) | |
}else{if(e==ZmItem.F_DATE){b[a++]=AjxDateUtil.computeDateStr(g.now||new Date(),d.date) | |
}else{if(e==ZmItem.F_PRIORITY){var f=null; | |
if(d.isHighPriority){f="PriorityHigh_list" | |
}else{if(d.isLowPriority){f="PriorityLow_list" | |
}}if(f){a=this._getImageHtml(b,a,f,this._getFieldId(d,e),c) | |
}else{b[a++]="<div id='"+this._getFieldId(d,e)+"' "+AjxUtil.getClassAttr(c)+"></div>" | |
}}else{a=DwtListView.prototype._getCellContents.apply(this,arguments) | |
}}}}}}}return a | |
}; | |
ZmListView.prototype._getImageHtml=function(c,b,a,e,d){c[b++]="<div"; | |
if(e){c[b++]=[" id='",e,"' "].join("") | |
}c[b++]=AjxUtil.getClassAttr(d); | |
c[b++]=">"; | |
c[b++]=AjxImg.getImageHtml(a||"Blank_16"); | |
c[b++]="</div>"; | |
return b | |
}; | |
ZmListView.prototype._getClasses=function(b,a){if(this.isMultiColumn&&this.isMultiColumn()&&this._headerHash[b]){a=a||[]; | |
a=[this._headerHash[b]._cssClass] | |
}return a | |
}; | |
ZmListView.prototype._setImage=function(d,e,b,c){var a=this._getElement(d,e); | |
if(a){if(c){a.className=AjxUtil.uniq(c).join(" ") | |
}a.innerHTML=AjxImg.getImageHtml(b||"Blank_16") | |
}}; | |
ZmListView.prototype._replaceTagImage=function(b,c,a){this._setImage(b,c,b.getTagImageInfo(),a) | |
}; | |
ZmListView.prototype._getFragmentSpan=function(a){return["<span class='ZmConvListFragment' aria-hidden='true' id='",this._getFieldId(a,ZmItem.F_FRAGMENT),"'>",this._getFragmentHtml(a),"</span>"].join("") | |
}; | |
ZmListView.prototype._getFragmentHtml=function(a){return[" - ",AjxStringUtil.htmlEncode(a.fragment,true)].join("") | |
}; | |
ZmListView.prototype._getFlagIcon=function(c,a,b){if(!c&&!a){return"Blank_16" | |
}else{if(b){return"FlagDis" | |
}else{return"FlagRed" | |
}}}; | |
ZmListView.prototype._parseId=function(b){var a=b.split(DwtId.SEP); | |
if(a&&a.length){return{view:a[1],item:a[2],field:a[3],participant:a[4]} | |
}else{return null | |
}}; | |
ZmListView.prototype._mouseDownAction=function(a,b){return !Dwt.ffScrollbarCheck(a) | |
}; | |
ZmListView.prototype._mouseUpAction=function(a,b){return !Dwt.ffScrollbarCheck(a) | |
}; | |
ZmListView.prototype._getField=function(c,g){var e=this._getEventTarget(c); | |
var f=e&&e.id||g.id; | |
if(!f){return null | |
}var d=this._data[g.id]; | |
var b=d.type; | |
if(!b||b!=DwtListView.TYPE_LIST_ITEM){return null | |
}var a=this._parseId(f); | |
if(!a||!a.field){return null | |
}return a.field | |
}; | |
ZmListView.prototype._mouseOutAction=function(b,e){DwtListView.prototype._mouseOutAction.call(this,b,e); | |
var d=this._getField(b,e); | |
if(!d){return true | |
}if(d==ZmItem.F_FLAG){var a=this.getItemFromElement(e); | |
if(!a.isFlagged){var c=this._getEventTarget(b); | |
AjxImg.setImage(c,this._getFlagIcon(a.isFlagged,false),false,false); | |
c.className=this._getClasses(d) | |
}}return true | |
}; | |
ZmListView.prototype._mouseOverAction=function(b,e){DwtListView.prototype._mouseOverAction.call(this,b,e); | |
var d=this._getField(b,e); | |
if(!d){return true | |
}if(d===ZmItem.F_FLAG){var a=this.getItemFromElement(e); | |
if(!a.isReadOnly()&&!a.isFlagged){var c=this._getEventTarget(b); | |
AjxImg.setDisabledImage(c,this._getFlagIcon(a.isFlagged,true),false); | |
c.className=this._getClasses(d) | |
}}return true | |
}; | |
ZmListView.prototype._doubleClickAction=function(b,e){var c=this._getEventTarget(b); | |
var d=c&&c.id||e.id; | |
if(!d){return true | |
}var a=this._parseId(d); | |
return(!(a&&(a.field==ZmItem.F_FLAG))) | |
}; | |
ZmListView.prototype._itemClicked=function(d,h){if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)&&h.button==DwtMouseEvent.LEFT){if(!h.shiftKey&&!h.ctrlKey){var g=this._getEventTarget(h); | |
var b=(g&&g.id&&g.id.indexOf("AjxImg")==-1)?g.id:d.id; | |
var e=b?this._parseId(b):null; | |
if(e&&(e.field==ZmItem.F_SELECTION||e.field==ZmItem.F_SELECTION_CELL)){if(this._selectedItems.size()==1){var c=this._selectedItems.get(0); | |
var k=this.getItemFromElement(c); | |
var i=k?this._getFieldId(k,ZmItem.F_SELECTION):null; | |
var j=i?document.getElementById(i):null; | |
if(j&&c==d){var f=this._getItemData(c,ZmListView.ITEM_CHECKED_ATT_NAME); | |
this._setImage(k,ZmItem.F_SELECTION,f?ZmListView.UNCHECKED_IMAGE:ZmListView.CHECKED_IMAGE); | |
this._setItemData(c,ZmListView.ITEM_CHECKED_ATT_NAME,!f); | |
if(!f){return | |
}}else{if(j&&!this._getItemData(c,ZmListView.ITEM_CHECKED_ATT_NAME)){this.deselectAll(); | |
this._markUnselectedViewedItem(true) | |
}}}var a=this._selectedItems.contains(d); | |
this.setMultiSelection(d,a); | |
this._controller._setItemSelectionCountText(); | |
return | |
}}else{if(h.shiftKey){this._checkSelectedItems(false); | |
DwtListView.prototype._itemClicked.call(this,d,h); | |
this._checkSelectedItems(true); | |
return | |
}}}DwtListView.prototype._itemClicked.call(this,d,h) | |
}; | |
ZmListView.prototype._columnClicked=function(b,a){DwtListView.prototype._columnClicked.call(this,b,a); | |
this._checkSelectionColumnClicked(b,a) | |
}; | |
ZmListView.prototype._checkSelectionColumnClicked=function(g,e){if(!appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){return | |
}var f=this.getList(); | |
var c=f?f.size():null; | |
if(c>0){var a=this._data[g.id].index; | |
var d=this._headerList[a]; | |
if(d&&(d._field==ZmItem.F_SELECTION)){var b=DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,d._field); | |
var h=document.getElementById(b); | |
if(h){if(h.className==ZmListView.CHECKED_CLASS){if(e.shiftKey&&!this.allSelected){this.selectAll(e.shiftKey) | |
}else{this.deselectAll(); | |
h.className=ZmListView.UNCHECKED_CLASS | |
}}else{this.allSelected=false; | |
h.className=ZmListView.CHECKED_CLASS; | |
this.selectAll(e.shiftKey) | |
}}}this._controller._resetToolbarOperations() | |
}}; | |
ZmListView.prototype.handleKeyAction=function(a,b){var c=DwtListView.prototype.handleKeyAction.call(this,a,b); | |
if(a==DwtKeyMap.SELECT_ALL){this._controller._resetToolbarOperations() | |
}return c | |
}; | |
ZmListView.prototype.setMultiSelection=function(a,c,b){if(b&&b.ctrlKey&&this._selectedItems.size()==1){this._checkSelectedItems(true) | |
}DwtListView.prototype.setMultiSelection.call(this,a,c); | |
this.setSelectionCbox(a,c); | |
this.setSelectionHdrCbox(this._isAllChecked()); | |
this._controller._resetToolbarOperations() | |
}; | |
ZmListView.prototype._isAllChecked=function(){var a=this.getList(); | |
return(a&&(this.getSelection().length==a.size())) | |
}; | |
ZmListView.prototype.setSelectionCbox=function(e,d){if(!e){return | |
}var b=e.tagName?this.getItemFromElement(e):e; | |
var a=b?this._getFieldId(b,ZmItem.F_SELECTION):null; | |
var c=a?document.getElementById(a):null; | |
if(c){this._setImage(b,ZmItem.F_SELECTION,d?ZmListView.UNCHECKED_IMAGE:ZmListView.CHECKED_IMAGE); | |
this._setItemData(this._getElFromItem(b),ZmListView.ITEM_CHECKED_ATT_NAME,!d) | |
}}; | |
ZmListView.prototype.setSelectionHdrCbox=function(b){var c=this._headerHash?this._headerHash[ZmItem.F_SELECTION]:null; | |
var a=c?DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,c._field):null; | |
var d=a?document.getElementById(a):null; | |
if(d){d.className=b?ZmListView.CHECKED_CLASS:ZmListView.UNCHECKED_CLASS | |
}}; | |
ZmListView.prototype.setSelectedItems=function(b,a){DwtListView.prototype.setSelectedItems.call(this,b); | |
if(!a&&appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){this._checkSelectedItems(true,true) | |
}}; | |
ZmListView.prototype.selectAll=function(c){DwtListView.prototype.selectAll.apply(this,arguments); | |
if(this._selectAllEnabled){var l=this._controller._activeSearch; | |
if(l&&l.getAttribute("more")){var h=this.getList(),k=this.type,d="type"+AjxStringUtil.capitalize(ZmItem.MSG_KEY[k]),g=AjxMessageFormat.format(ZmMsg[d],h?h.size():2),e=appCtxt.getShortcutHint(null,ZmKeyMap.SELECT_ALL),j=[h?h.size():ZmMsg.all,g,e,"ZmListView.selectAllResults()"],b=AjxMessageFormat.format(ZmMsg.allPageSelected,j); | |
if(c){this.allSelected=true; | |
b=ZmMsg.allSearchSelected | |
}appCtxt.setStatusMsg(b) | |
}var a=this._selectedItems.getArray(); | |
for(var f=0; | |
f<a.length; | |
f++){this.setSelectionCbox(a[f],false) | |
}}}; | |
ZmListView.selectAllResults=function(){var a=appCtxt.getCurrentController(); | |
var b=a&&a.getListView(); | |
if(b&&b.selectAll){b.selectAll(true) | |
}}; | |
ZmListView.prototype.deselectAll=function(){this.allSelected=false; | |
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){this._checkSelectedItems(false); | |
var a=DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,ZmItem.F_SELECTION); | |
var d=document.getElementById(a); | |
if(d){d.className=ZmListView.UNCHECKED_CLASS | |
}var c=this._selectedItems.getArray(); | |
for(var b=0; | |
b<c.length; | |
b++){this.setSelectionCbox(c[b],true) | |
}}DwtListView.prototype.deselectAll.call(this) | |
}; | |
ZmListView.prototype._checkSelectedItems=function(a){var e=this.getSelection(); | |
for(var c=0; | |
c<e.length; | |
c++){this.setSelectionCbox(e[c],!a) | |
}var d=this.getList(); | |
var b=d&&d.size(); | |
this.setSelectionHdrCbox(b&&e.length==b) | |
}; | |
ZmListView.prototype._setNoResultsHtml=function(){DwtListView.prototype._setNoResultsHtml.call(this); | |
this.setSelectionHdrCbox(false); | |
this._rendered=true | |
}; | |
ZmListView.prototype._clearRightSel=function(){DwtListView.prototype._clearRightSel.call(this); | |
this._controller._resetToolbarOperations() | |
}; | |
ZmListView.prototype._getSortMenu=function(e,c,h){var b=new ZmPopupMenu(h||this,null,Dwt.getNextId("SORT_MENU_")); | |
var a=this._sortMenuListener.bind(this); | |
for(var f=0; | |
f<e.length; | |
f++){var d=e[f]; | |
var j=ZmMsg[d.msg]; | |
var g=b.createMenuItem(d.field,{text:h&&h.isDwtMenuItem?j:AjxMessageFormat.format(ZmMsg.arrangeBy,j),style:DwtMenuItem.RADIO_STYLE}); | |
if(d.field==c){g.setChecked(true,true) | |
}g.setData(ZmListView.KEY_ID,d.field); | |
b.addSelectionListener(d.field,a) | |
}return b | |
}; | |
ZmListView.prototype._sortMenuListener=function(d){var c; | |
if(this.isMultiColumn()){var b=d&&d.item&&d.item.getData(ZmOperation.MENUITEM_ID); | |
c=this._headerHash[b] | |
}else{c=this._headerHash[ZmItem.F_SORTED_BY]; | |
var a=document.getElementById(DwtId.getListViewHdrId(DwtId.WIDGET_HDR_LABEL,this._view,c._field)); | |
if(a){var e=d.item.getText(); | |
a.innerHTML=e&&e.replace(ZmMsg.sortBy,ZmMsg.sortedBy) | |
}c._sortable=d.item.getData(ZmListView.KEY_ID) | |
}this._bSortAsc=(c._sortable===this._currentSortColId)?!this._bSortAsc:this._isDefaultSortAscending(c); | |
this._sortColumn(c,this._bSortAsc) | |
}; | |
ZmListView.prototype._getActionMenuForColHeader=function(c,j,e){var f; | |
if(!this._colHeaderActionMenu||c){f=new ZmPopupMenu(j||this); | |
var b=this._colHeaderActionListener.bind(this); | |
for(var g=0; | |
g<this._headerList.length; | |
g++){var d=this._headerList[g]; | |
if(d._width){var a=ZmId.getMenuItemId([this._view,e].join("_"),d._field); | |
var h=f.createMenuItem(a,{text:d._name,style:DwtMenuItem.CHECK_STYLE}); | |
h.setData(ZmListView.KEY_ID,d._id); | |
h.setChecked(d._visible,true); | |
if(d._noRemove){h.setEnabled(false) | |
}f.addSelectionListener(a,b) | |
}}}return f | |
}; | |
ZmListView.prototype._colHeaderActionListener=function(c){var d=c.item.getData(ZmListView.KEY_ID); | |
for(var b=0; | |
b<this._headerList.length; | |
b++){var a=this._headerList[b]; | |
if(a._id==d){a._visible=!a._visible; | |
break | |
}}this._relayout() | |
}; | |
ZmListView.prototype.getToolTipContent=function(i){var a=this.getTargetItemDiv(i); | |
if(!a){return"" | |
}var g=Dwt.findAncestor(this._getEventTarget(i),"id"),c=(g&&g.id)||a.id; | |
if(!c){return"" | |
}var e=this._data[a.id]; | |
var h=e.type; | |
var l; | |
if(h&&h==DwtListView.TYPE_HEADER_ITEM){var b=e.index; | |
var j=this._headerList[b]._field; | |
l=this._getHeaderToolTip(j,b) | |
}else{var f=this._parseId(c); | |
if(f&&f.field){var k=this.getItemFromElement(a); | |
var d={field:f.field,item:k,ev:i,div:a,match:f}; | |
l=this._getToolTip(d) | |
}}return l | |
}; | |
ZmListView.prototype.getTooltipBase=function(a){return a?DwtUiEvent.getTargetWithProp(a.object,"id"):DwtListView.prototype.getTooltipBase.apply(this,arguments) | |
}; | |
ZmListView.prototype._getHeaderToolTip=function(c,a,e){var b=null; | |
var d=this._headerList[a]._sortable; | |
if(c==ZmItem.F_SELECTION){b=ZmMsg.selectionColumn | |
}else{if(c==ZmItem.F_FLAG){b=ZmMsg.flagHeaderToolTip | |
}else{if(c==ZmItem.F_PRIORITY){b=ZmMsg.priorityHeaderTooltip | |
}else{if(c==ZmItem.F_TAG){b=ZmMsg.tag | |
}else{if(c==ZmItem.F_ATTACHMENT){b=ZmMsg.attachmentHeaderToolTip | |
}else{if(c==ZmItem.F_SUBJECT){b=d?ZmMsg.sortBySubject:ZmMsg.subject | |
}else{if(c==ZmItem.F_DATE){if(d){if(e){b=(this._folderId==ZmFolder.ID_DRAFTS)?ZmMsg.sortByLastSaved:ZmMsg.sortBySent | |
}else{b=ZmMsg.sortByReceived | |
}}else{b=ZmMsg.date | |
}}else{if(c==ZmItem.F_FROM){b=d?e?ZmMsg.sortByTo:ZmMsg.sortByFrom:e?ZmMsg.to:ZmMsg.from | |
}else{if(c==ZmItem.F_SIZE){b=d?ZmMsg.sortBySize:ZmMsg.sizeToolTip | |
}else{if(c==ZmItem.F_ACCOUNT){b=ZmMsg.account | |
}else{if(c==ZmItem.F_FOLDER){b=ZmMsg.folder | |
}else{if(c==ZmItem.F_MSG_PRIORITY){b=ZmMsg.messagePriority | |
}}}}}}}}}}}}return b | |
}; | |
ZmListView.prototype._getToolTip=function(d){var b,c=d.field,a=d.item,e=d.div; | |
if(c==ZmItem.F_FLAG){return null | |
}else{if(c==ZmItem.F_PRIORITY){if(a.isHighPriority){b=ZmMsg.highPriorityTooltip | |
}else{if(a.isLowPriority){b=ZmMsg.lowPriorityTooltip | |
}}}else{if(c==ZmItem.F_TAG){b=this._getTagToolTip(a) | |
}else{if(c==ZmItem.F_ATTACHMENT){}else{if(e&&(c==ZmItem.F_DATE)){b=this._getDateToolTip(a,e) | |
}}}}}return b | |
}; | |
ZmListView.prototype._getLabelFieldList=function(){var a=this._getHeaderList(); | |
if(a){return AjxUtil.map(a,function(b){return b._field | |
}) | |
}}; | |
ZmListView.prototype._getLabelForField=function(a,c){var b=this._getToolTip({item:a,field:c}); | |
return AjxStringUtil.stripTags(b) | |
}; | |
ZmListView.prototype._updateLabelForItem=function(f){var a=this._getLabelFieldList(); | |
var b=this._getElFromItem(f); | |
if(!f||!a||!b){return | |
}var d=[]; | |
for(var e=0; | |
e<a.length; | |
e++){var c=this._getLabelForField(f,a[e]); | |
if(c){d.push(c) | |
}}if(d.length>0){b.setAttribute("aria-label",d.join(", ")) | |
}else{b.removeAttribute("aria-label") | |
}}; | |
ZmListView.prototype._getTagToolTip=function(g){if(!g){return | |
}var c=g.tags&&g.tags.length; | |
if(!c){return | |
}var e=appCtxt.getAccountTagList(g); | |
var h=g.tags; | |
var b=[]; | |
var f=0; | |
for(var a=0; | |
a<c; | |
a++){var j=e.getByNameOrRemote(h[a]); | |
if(!j){continue | |
}var d=j.notLocal?AjxMessageFormat.format(ZmMsg.tagNotLocal,j.name):j.name; | |
b[f++]="<table><tr><td>"; | |
b[f++]=AjxImg.getImageHtml(j.getIconWithColor()); | |
b[f++]="</td><td valign='middle'>"; | |
b[f++]=AjxStringUtil.htmlEncode(d); | |
b[f++]="</td></tr></table>" | |
}return b.join("") | |
}; | |
ZmListView.prototype._getAttachmentToolTip=function(a){var b=null; | |
var d=a&&a.attachments?a.attachments:[]; | |
if(d.length==1){var c=ZmMimeTable.getInfo(d[0].ct); | |
b=c?c.desc:null | |
}else{if(d.length>1){b=AjxMessageFormat.format(ZmMsg.multipleAttachmentsTooltip,[d.length]) | |
}}return b | |
}; | |
ZmListView.prototype._getDateToolTip=function(a,b){b._dateStr=b._dateStr||this._getDateToolTipText(a.date); | |
return b._dateStr | |
}; | |
ZmListView.prototype._getDateToolTipText=function(b,e){if(!b){return"" | |
}var a=[]; | |
var c=0; | |
a[c++]=e; | |
var d=AjxDateFormat.getDateTimeInstance(AjxDateFormat.FULL,AjxDateFormat.MEDIUM); | |
a[c++]=d.format(new Date(b)); | |
var f=AjxDateUtil.computeDateDelta(b); | |
if(f){a[c++]="<br><center><span style='white-space:nowrap'>("; | |
a[c++]=f; | |
a[c++]=")</span></center>" | |
}return a.join("") | |
}; | |
ZmListView.prototype._setListEvent=function(d,f,b){DwtListView.prototype._setListEvent.call(this,d,f,b); | |
var e=this._getEventTarget(d); | |
var g=(e&&e.id&&e.id.indexOf("AjxImg")==-1)?e.id:b.id; | |
if(!g){return false | |
}var a=this._parseId(g); | |
if(d.button==DwtMouseEvent.LEFT){this._selEv.field=a?a.field:null | |
}else{if(d.button==DwtMouseEvent.RIGHT){this._actionEv.field=a?a.field:null; | |
if(a&&a.field){if(a.field==ZmItem.F_PARTICIPANT){var c=this.getItemFromElement(b); | |
this._actionEv.detail=c.participants?c.participants.get(a.participant):null | |
}}}}return true | |
}; | |
ZmListView.prototype._allowLeftSelection=function(d,e,b){if(!(e instanceof DwtMouseEvent)){return true | |
}var g=this._getEventTarget(e); | |
var h=(g&&g.id&&g.id.indexOf("AjxImg")==-1)?g.id:d.id; | |
var f=this._data[d.id]; | |
var c=f.type; | |
if(h&&c&&c==DwtListView.TYPE_LIST_ITEM){var a=this._parseId(h); | |
if(a&&a.field){return this._allowFieldSelection(a.item,a.field) | |
}}return true | |
}; | |
ZmListView.prototype._allowFieldSelection=function(b,a){return(!this._disallowSelection[a]) | |
}; | |
ZmListView.prototype._redoSearch=function(e){var a=this._controller._currentSearch; | |
if(!a){return | |
}var d=this.getSelection(); | |
var c=d&&d[0]; | |
var b={isRedo:true,selectedItem:c}; | |
appCtxt.getSearchController().redoSearch(a,false,b,e) | |
}; | |
ZmListView.prototype._sortColumn=function(d,f,h){var g; | |
switch(d._sortable){case ZmItem.F_FROM:g=f?ZmSearch.NAME_ASC:ZmSearch.NAME_DESC; | |
break; | |
case ZmItem.F_TO:g=f?ZmSearch.RCPT_ASC:ZmSearch.RCPT_DESC; | |
break; | |
case ZmItem.F_NAME:g=f?ZmSearch.SUBJ_ASC:ZmSearch.SUBJ_DESC; | |
break; | |
case ZmItem.F_SUBJECT:g=f?ZmSearch.SUBJ_ASC:ZmSearch.SUBJ_DESC; | |
break; | |
case ZmItem.F_DATE:g=f?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC; | |
break; | |
case ZmItem.F_SIZE:g=f?ZmSearch.SIZE_ASC:ZmSearch.SIZE_DESC; | |
break; | |
case ZmItem.F_FLAG:g=f?ZmSearch.FLAG_ASC:ZmSearch.FLAG_DESC; | |
break; | |
case ZmItem.F_ATTACHMENT:g=f?ZmSearch.ATTACH_ASC:ZmSearch.ATTACH_DESC; | |
break; | |
case ZmItem.F_READ:g=f?ZmSearch.READ_ASC:ZmSearch.READ_DESC; | |
break; | |
case ZmItem.F_PRIORITY:g=f?ZmSearch.PRIORITY_ASC:ZmSearch.PRIORITY_DESC; | |
break; | |
case ZmItem.F_SORTED_BY:g=f?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC; | |
break | |
}if(g){this._currentSortColId=d._sortable; | |
if(d._sortable!=ZmItem.F_READ&&(this._sortByString==ZmSearch.READ_ASC||this._sortByString==ZmSearch.READ_DESC)){var b=this._controller; | |
var e=b.getSearchString(); | |
if(e){b.setSearchString(AjxStringUtil.trim(e.replace("is:unread",""))) | |
}}this._sortByString=g; | |
var a=this._folderId?true:false; | |
if(!appCtxt.isExternalAccount()){var c=appCtxt.getSettings(); | |
appCtxt.set(ZmSetting.SORTING_PREF,g,this.view,false,a,null,c&&!c.persistImplicitSortPrefs(this.view)); | |
if(this._folderId){appCtxt.set(ZmSetting.SORTING_PREF,g,this._folderId) | |
}}if(!this._isMultiColumn){this._setSortedColStyle(d._id) | |
}}if(h){h.run() | |
}}; | |
ZmListView.prototype._setNextSelection=function(b,a){if(this.firstSelIndex<0){this.firstSelIndex=0 | |
}if(this._list&&!b){b=this._list.get(this.firstSelIndex)||this._list.getLast() | |
}if(b){this.setSelection(b,false,a) | |
}}; | |
ZmListView.prototype._relayout=function(){DwtListView.prototype._relayout.call(this); | |
this._checkColumns() | |
}; | |
ZmListView.prototype._checkColumns=function(){var d=this._headerList.length; | |
var a=[]; | |
for(var b=0; | |
b<d; | |
b++){var e=this._headerList[b]; | |
if(e&&e._field!=ZmItem.F_ACCOUNT){a.push(e._field+(e._visible?"":"*")) | |
}}var c=a.join(ZmListView.COL_JOIN); | |
c=(c==this._defaultCols)?"":c; | |
if(!appCtxt.isExternalAccount()&&!this._controller.isSearchResults){appCtxt.set(ZmSetting.LIST_VIEW_COLUMNS,c,appCtxt.getViewTypeFromId(this.view)) | |
}this._colHeaderActionMenu=this._getActionMenuForColHeader(true) | |
}; | |
ZmListView.handleScroll=function(a){var b=DwtUiEvent.getTarget(a); | |
var c=DwtControl.findControl(b); | |
if(c){c._checkItemCount() | |
}}; | |
ZmListView.prototype._checkItemCount=function(){var a=this._getItemsNeeded(); | |
if(a){this._controller._paginate(this._view,true,null,a) | |
}}; | |
ZmListView.prototype._getItemsNeeded=function(d){if(!d){var a=this.getItemList(); | |
if(!(a&&a.hasMore())||!this._list){return 0 | |
}}if(!this._rendered||!this._rowHeight){return 0 | |
}var b=new AjxCallback(null,AjxTimedAction.scheduleAction,[new AjxTimedAction(this,this._resetColWidth),100]); | |
var c={scrollDiv:this._getScrollDiv(),rowHeight:this._rowHeight,threshold:this.getPagelessThreshold(),limit:this.getLimit(1),listSize:this._list.size(),sbCallback:b}; | |
return ZmListView.getRowsNeeded(c) | |
}; | |
ZmListView.prototype._getScrollDiv=function(){return this._parentEl | |
}; | |
ZmListView.getRowsNeeded=function(c){var b=c.scrollDiv; | |
var e=b.scrollHeight,j=b.scrollTop,g=c.rowHeight; | |
var d=b.clientHeight||Dwt.getSize(b).y; | |
var f=d+(c.threshold*g); | |
var a=e-j; | |
if(a==d){a=(c.listSize*g)-j; | |
if(j==0&&c.sbCallback){c.sbCallback.run() | |
}}var i=0; | |
if(a<f){i=Math.max(Math.floor((f-a)/g),c.limit) | |
}return i | |
}; | |
ZmListView.prototype._sizeChildren=function(a){if(DwtListView.prototype._sizeChildren.apply(this,arguments)){this._checkItemCount() | |
}}; | |
ZmListView.prototype._getItemCountType=function(){return this.type | |
}; | |
ZmListView.prototype.hasItem=function(e){var f=(typeof e=="string")?e:e&&e.id; | |
if(f&&this._list){var c=this._list.getArray(); | |
for(var d=0,b=c.length; | |
d<b; | |
d++){var e=c[d]; | |
if(e&&e.id==f){return true | |
}}}return false | |
}; | |
ZmListView.prototype._saveState=function(c){var b=this._state={}; | |
c=c||{}; | |
if(c.selection){b.selected=this.getSelection(); | |
if(b.selected.length==1){var a=this._getElFromItem(b.selected[0]); | |
b.singleItemChecked=this._getItemData(a,ZmListView.ITEM_CHECKED_ATT_NAME) | |
}}if(c.focus){b.focused=this.hasFocus(); | |
b.anchorItem=this._kbAnchor&&this.getItemFromElement(this._kbAnchor) | |
}if(c.scroll){b.rowHeight=this._rowHeight; | |
b.scrollTop=this._listDiv.scrollTop | |
}}; | |
ZmListView.prototype._restoreState=function(d){var c=d||this._state; | |
if(c.selected&&c.selected.length){var b=c.selected.length==1&&!c.singleItemChecked; | |
this.setSelectedItems(c.selected,b) | |
}if(c.anchorItem){var a=this._getElFromItem(c.anchorItem); | |
if(a){this._setKbFocusElement(a) | |
}}if(c.focused){this.focus() | |
}if(c.rowHeight){this._listDiv.scrollTop=c.scrollTop*(this._rowHeight/c.rowHeight) | |
}this._state={} | |
}; | |
ZmListView.prototype._renderList=function(g,f,c){var l=this._group; | |
if(!l){return DwtListView.prototype._renderList.call(this,g,f,c) | |
}if(g instanceof AjxVector&&g.size()){var b=new Date(); | |
var o=g.size(); | |
var m=[]; | |
var k; | |
var h; | |
for(var e=0; | |
e<o; | |
e++){var n=g.get(e); | |
var a=this._createItemHtml(n,{now:b},!c,e); | |
if(a){if(a instanceof Array){for(var d=0; | |
d<a.length; | |
d++){k=l.addMsgToSection(n,a[d]); | |
if(l.getSectionSize(k)==1){h=this._getSectionHeaderDiv(l,k); | |
this._addRow(h) | |
}this._addRow(a[d]) | |
}}else{if(a.tagName||c){k=l.addMsgToSection(n,a); | |
if(l.getSectionSize(k)==1){h=this._getSectionHeaderDiv(l,k); | |
this._addRow(h) | |
}this._addRow(a) | |
}else{l.addMsgToSection(n,a) | |
}}}}if(l&&!c){l.resetSectionHeaders(); | |
m.push(l.getAllSections(this._bSortAsc)) | |
}if(m.length&&!c){this._parentEl.innerHTML=m.join("") | |
}}else{if(!f){this._setNoResultsHtml() | |
}}}; | |
ZmListView.prototype._addRow=function(b,a){DwtListView.prototype._addRow.apply(this,arguments); | |
this._updateLabelForItem(this.getItemFromElement(b)) | |
}; | |
ZmListView.prototype._itemAdded=function(a){a.refCount++ | |
}; | |
ZmListView.prototype._getSectionHeaderDiv=function(e,d){if(e&&d){var c=document.createElement("div"); | |
var a=e.getSectionTitle(d); | |
var b=e.getSectionHeader(a); | |
c.innerHTML=b; | |
return c.firstChild | |
}}; | |
ZmListView.prototype.deactivate=function(){this._controller.inactive=true | |
}; | |
ZmListView.prototype._getEventTarget=function(a){var b=a&&a.target; | |
if(b&&(b.nodeName==="IMG"||(b.className&&b.className.match(/\bImg/)))){return b.parentNode | |
}return b | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmAppChooser")){ZmAppChooser=function(c){c.className=c.className||"ZmAppChooser"; | |
c.width=appCtxt.getSkinHint("appChooser","fullWidth")?"100%":null; | |
ZmToolBar.call(this,c); | |
Dwt.setLocation(this.getHtmlElement(),Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE); | |
this.setScrollStyle(Dwt.CLIP); | |
this._buttonListener=new AjxListener(this,this._handleButton); | |
this._initOverFlowTabs(); | |
var b=c.buttons; | |
for(var a=0; | |
a<b.length; | |
a++){var d=b[a]; | |
if(d==ZmAppChooser.SPACER){this.addSpacer(ZmAppChooser.SPACER_HEIGHT) | |
}else{this._createButton(d) | |
}}this._createPrecedenceList(); | |
this._inited=true | |
}; | |
ZmAppChooser.prototype=new ZmToolBar; | |
ZmAppChooser.prototype.constructor=ZmAppChooser; | |
ZmAppChooser.prototype.role="tablist"; | |
ZmAppChooser.prototype._initOverFlowTabs=function(){this._leftOverflow=document.getElementById("moreTabsLeftContainer"); | |
this._rightOverflow=document.getElementById("moreTabsRightContainer"); | |
if(this._leftOverflow){this._leftOverflow.onclick=this._showLeftTab.bind(this) | |
}if(this._rightOverflow){this._rightOverflow.onclick=this._showRightTab.bind(this) | |
}this._leftBtnIndex=-1; | |
this._deletedButtons=[] | |
}; | |
ZmAppChooser.prototype._showLeftTab=function(){var a=this.getItems(); | |
if(this._leftBtnIndex>-1){a[this._leftBtnIndex].setVisible(true); | |
this._leftBtnIndex-- | |
}this._checkArrowVisibility() | |
}; | |
ZmAppChooser.prototype._showRightTab=function(){var a=this.getItems(); | |
this._leftBtnIndex++; | |
a[this._leftBtnIndex].setVisible(false); | |
this._checkArrowVisibility() | |
}; | |
ZmAppChooser.prototype._showTab=function(e,c){var b=this._buttons[e]; | |
this._moreTabsBtn.getMenu().popdown(); | |
if(!b){return | |
}if(!b.getVisible()){var d=false; | |
for(var a in this._buttons){if(!d&&this._buttons[a].getHTMLElId()==b.getHTMLElId()){d=true | |
}else{if(this._buttons[a].getVisible()){break | |
}}if(d){this._buttons[a].setVisible(true); | |
this._leftBtnIndex-- | |
}}}else{while(this._isTabOverflow(b.getHtmlElement())){this._showRightTab() | |
}}this._checkArrowVisibility(); | |
appCtxt.getAppController()._appButtonListener(c) | |
}; | |
ZmAppChooser.prototype._attachMoreTabMenuItems=function(e){for(var d=0; | |
d<this._deletedButtons.length; | |
d++){var a=e.getItemById(ZmOperation.MENUITEM_ID,this._deletedButtons[d]+"_menu"); | |
if(a){e.removeChild(a); | |
a.dispose() | |
}}this._deletedButtons=[]; | |
for(var b in this._buttons){var c=e.getItemById(ZmOperation.MENUITEM_ID,b+"_menu"); | |
if(c){if(c.getText()!=this._buttons[b].getText()){c.setText(this._buttons[b].getText()) | |
}}else{var a=new DwtMenuItem({parent:e,style:DwtMenuItem.CASCADE_STYLE,id:b+"_menu"}); | |
a.setData(ZmOperation.MENUITEM_ID,b+"_menu"); | |
a.setData(Dwt.KEY_ID,b); | |
a.addSelectionListener(this._showTab.bind(this,b)); | |
a.setText(this._buttons[b].getText()) | |
}}if(e.getHtmlElement().style.width=="0px"){this._moreTabsBtn.popup() | |
}}; | |
ZmAppChooser.prototype._showOverflowTabsMenu=function(){var a=new DwtMenu({parent:this._moreTabsBtn}); | |
a.addPopupListener(new AjxListener(this,this._attachMoreTabMenuItems,[a])); | |
return a | |
}; | |
ZmAppChooser.prototype._checkArrowVisibility=function(){var a=this.getItems(); | |
if(this._leftBtnIndex<0){this._setArrowVisibility(this._leftOverflow,"none") | |
}else{this._setArrowVisibility(this._leftOverflow,"") | |
}if(!this._isTabOverflow(a[a.length-1].getHtmlElement())){this._setArrowVisibility(this._rightOverflow,"none") | |
}else{this._setArrowVisibility(this._rightOverflow,"") | |
}this._adjustWidth() | |
}; | |
ZmAppChooser.prototype._setArrowVisibility=function(c,d){if(!c){return | |
}c.style.display=d||""; | |
var f=((this._leftOverflow&&this._leftOverflow.style.display=="none")&&(this._rightOverflow&&this._rightOverflow.style.display=="none"))?"none":""; | |
var a=document.getElementById("moreTabsMenu"); | |
if(a){a.style.display=f | |
}if(f!="none"&&!this._moreTabsBtn&&a){var e=a; | |
var b=new DwtToolBarButton({parent:DwtShell.getShell(window),id:"moreTabsMenuBtn",style:"background:none no-repeat scroll 0 0 transparent; border: none"}); | |
b.setToolTipContent(ZmMsg.more,true); | |
b.setText(""); | |
b.reparentHtmlElement(a); | |
b.setMenu(new AjxListener(this,this._showOverflowTabsMenu)); | |
this._moreTabsBtn=b | |
}}; | |
ZmAppChooser.prototype.toString=function(){return"ZmAppChooser" | |
}; | |
ZmAppChooser.SPACER="spacer"; | |
ZmAppChooser.B_HELP="Help"; | |
ZmAppChooser.B_LOGOUT="Logout"; | |
ZmApp.CHOOSER_SORT[ZmAppChooser.SPACER]=160; | |
ZmApp.CHOOSER_SORT[ZmAppChooser.B_HELP]=170; | |
ZmApp.CHOOSER_SORT[ZmAppChooser.B_LOGOUT]=190; | |
ZmApp.ICON[ZmAppChooser.B_HELP]="Help"; | |
ZmApp.ICON[ZmAppChooser.B_LOGOUT]="Logoff"; | |
ZmApp.CHOOSER_TOOLTIP[ZmAppChooser.B_HELP]="goToHelp"; | |
ZmApp.CHOOSER_TOOLTIP[ZmAppChooser.B_LOGOUT]="logOff"; | |
ZmAppChooser.SPACER_HEIGHT=10; | |
ZmAppChooser.prototype.TEMPLATE="share.Widgets#ZmAppChooser"; | |
ZmAppChooser.prototype.ITEM_TEMPLATE="share.Widgets#ZmAppChooserItem"; | |
ZmAppChooser.prototype.SPACER_TEMPLATE="dwt.Widgets#ZmAppChooserSpacer"; | |
ZmAppChooser.prototype.addSelectionListener=function(a){this.addListener(DwtEvent.SELECTION,a) | |
}; | |
ZmAppChooser.prototype._checkTabOverflowAdd=function(a){var b="none"; | |
if(this._isTabOverflow(a)){b="" | |
}this._setArrowVisibility(this._rightOverflow,b); | |
this._adjustWidth() | |
}; | |
ZmAppChooser.prototype._isTabOverflow=function(d){var b=d.offsetLeft+d.clientWidth+30; | |
if(!this._refElement){this._refElement=document.getElementById(this._refElementId) | |
}var a=this._refElement&&this._refElement.parentNode; | |
if(!a){return false | |
}var c=a.offsetWidth; | |
return(c<b) | |
}; | |
ZmAppChooser.prototype._adjustWidth=function(){var a=this._refElement&&this._refElement.parentNode; | |
if(a&&a.offsetWidth>=30){this._refElement.style.maxWidth=this._refElement.style.width=a.offsetWidth-30+"px"; | |
this._refElement.style.overflow="hidden" | |
}}; | |
ZmAppChooser.prototype._checkTabOverflowDelete=function(b){var a=this.getItems(); | |
if(this._isTabOverflow(a[a.length-1])){return | |
}this._showLeftTab() | |
}; | |
ZmAppChooser.prototype.addButton=function(d,c){var b={parent:this,id:ZmId.getButtonId(ZmId.APP,d),text:c.text,image:c.image,leftImage:c.leftImage,rightImage:c.rightImage,index:c.index}; | |
b.style=c.style?c.style:DwtLabel.IMAGE_LEFT; | |
var a=new ZmAppButton(b); | |
a.setToolTipContent(c.tooltip,true); | |
a.textPrecedence=c.textPrecedence; | |
a.imagePrecedence=c.imagePrecedence; | |
a.setData(Dwt.KEY_ID,d); | |
a.addSelectionListener(this._buttonListener); | |
this._buttons[d]=a; | |
this._checkTabOverflowAdd(a.getHtmlElement()); | |
return a | |
}; | |
ZmAppChooser.prototype.removeButton=function(c){var b=this._buttons[c]; | |
if(b){var a=this.__getButtonIndex(c); | |
b.dispose(); | |
this._buttons[c]=null; | |
delete this._buttons[c]; | |
if(this._moreTabsBtn&&this._moreTabsBtn.getMenu()&&this._moreTabsBtn.getMenu().getItemCount()>0){this._deletedButtons.push(c) | |
}this._checkTabOverflowDelete(a) | |
}}; | |
ZmAppChooser.prototype.replaceButton=function(c,a,b){if(!this._buttons[c]){return null | |
}b.index=this.__getButtonIndex(c); | |
this.removeButton(c); | |
return this.addButton(a,b) | |
}; | |
ZmAppChooser.prototype.getButton=function(a){return this._buttons[a] | |
}; | |
ZmAppChooser.prototype.setSelected=function(c){var a=this._buttons[this._selectedId]; | |
if(this._selectedId&&a){this.__markPrevNext(this._selectedId,false); | |
a.setSelected(false) | |
}var b=this._buttons[c]; | |
if(b){b.setSelected(true); | |
this.setAttribute("aria-activedescendant",b.getHTMLElId()); | |
if(b._toggleText!=null&&b._toggleText!=""){if(a){a._toggleText=(a._toggleText!=null&&a._toggleText!="")?a._toggleText:a.getText(); | |
a.setText("") | |
}b.setText(b._toggleText); | |
b._toggleText=null | |
}}this._selectedId=c | |
}; | |
ZmAppChooser.prototype._createButton=function(a){this.addButton(a,{text:ZmMsg[ZmApp.NAME[a]]||ZmApp.NAME[a],image:ZmApp.ICON[a],tooltip:ZmMsg[ZmApp.CHOOSER_TOOLTIP[a]],textPrecedence:ZmApp.TEXT_PRECEDENCE[a],imagePrecedence:ZmApp.IMAGE_PRECEDENCE[a]}) | |
}; | |
ZmAppChooser.prototype._handleButton=function(a){this.notifyListeners(DwtEvent.SELECTION,a) | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmAppButton")){ZmAppButton=function(a){if(arguments.length==0){return | |
}a.style=a.style?a.style:DwtLabel.IMAGE_LEFT; | |
a.posStyle=DwtControl.RELATIVE_STYLE; | |
DwtButton.call(this,a); | |
if(a.image){this.setImage(a.image) | |
}else{if(a.leftImage){this.setImage(a.leftImage,DwtLabel.LEFT) | |
}if(a.rightImage){this.setImage(a.rightImage,DwtLabel.RIGHT) | |
}}if(a.hoverImage){this.setHoverImage(a.hoverImage) | |
}else{if(a.leftHoverImage){this.setHoverImage(a.leftHoverImage,DwtLabel.LEFT) | |
}if(a.rightHoverImage){this.setHoverImage(a.rightHoverImage,DwtLabel.RIGHT) | |
}}this.setText(a.text) | |
}; | |
ZmAppButton.prototype=new DwtButton; | |
ZmAppButton.prototype.constructor=ZmAppButton; | |
ZmAppButton.prototype.role="tab"; | |
ZmAppButton.prototype.toString=function(){return"ZmAppButton" | |
}; | |
ZmAppButton.prototype.TEMPLATE="share.Widgets#ZmAppChooserButton"; | |
ZmAppButton.prototype.setSelected=function(a){this.isSelected=a; | |
this.setDisplayState(a?DwtControl.SELECTED:DwtControl.NORMAL) | |
}; | |
ZmAppButton.prototype.setDisplayState=function(a){if(this.isSelected&&a!=DwtControl.SELECTED){a=[DwtControl.SELECTED,a].join(" ") | |
}DwtButton.prototype.setDisplayState.call(this,a) | |
}; | |
ZmAppButton.prototype.handleKeyAction=function(a,b){switch(a){case DwtKeyMap.SELECT:if(this.isListenerRegistered(DwtEvent.SELECTION)){var c=DwtShell.selectionEvent; | |
c.item=this; | |
this.notifyListeners(DwtEvent.SELECTION,c) | |
}break; | |
default:return false | |
}return true | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmStatusView")){ZmStatusView=function(c,b,a,d){DwtControl.call(this,{parent:c,className:(b||"ZmStatus"),posStyle:a,id:d}); | |
this._toast=this._standardToast=new ZmToast(this,ZmId.TOAST); | |
this._statusQueue=[] | |
}; | |
ZmStatusView.prototype=new DwtControl; | |
ZmStatusView.prototype.constructor=ZmStatusView; | |
ZmStatusView.LEVEL_INFO=1; | |
ZmStatusView.LEVEL_WARNING=2; | |
ZmStatusView.LEVEL_CRITICAL=3; | |
ZmStatusView.MSG_PARAMS=["msg","level","detail","transitions","toast","force","dismissCallback","finishCallback"]; | |
ZmStatusView.prototype.toString=function(){return"ZmStatusView" | |
}; | |
ZmStatusView.prototype.setStatusMsg=function(c){c=Dwt.getParams(arguments,ZmStatusView.MSG_PARAMS); | |
if(typeof c=="string"){c={msg:c} | |
}var a={msg:c.msg,level:c.level||ZmStatusView.LEVEL_INFO,detail:c.detail,date:new Date(),transitions:c.transitions,toast:c.toast||this._standardToast,dismissCallback:(c.dismissCallback instanceof AjxCallback)?c.dismissCallback:null,finishCallback:(c.finishCallback instanceof AjxCallback)?c.finishCallback:null,dismissed:false}; | |
if(c.force){for(var b=0; | |
b<this._statusQueue.length; | |
b++){this._statusQueue[b].dismissed=true | |
}}this._statusQueue.push(a); | |
if(!this._toast.isPoppedUp()){this._updateStatusMsg() | |
}else{if(c.force){this.dismissStatusMsg() | |
}}}; | |
ZmStatusView.prototype.nextStatus=function(){if(this._statusQueue.length>0){this._updateStatusMsg(); | |
return true | |
}return false | |
}; | |
ZmStatusView.prototype.dismissStatusMsg=function(b){if(b){for(var a=0; | |
a<this._statusQueue.length; | |
a++){this._statusQueue[a].dismissed=true | |
}}this._toast.dismiss() | |
}; | |
ZmStatusView.prototype._updateStatusMsg=function(){var a=this._statusQueue.shift(); | |
if(!a){return | |
}if(a.dismissed){if(a.dismissCallback){a.dismissCallback.run() | |
}this.nextStatus() | |
}else{this._toast=a.toast; | |
this._toast.popup(a) | |
}}; | |
ZmToast=function(a,b){if(arguments.length==0){return | |
}DwtComposite.call(this,{parent:a.shell,className:"ZToast",posStyle:Dwt.ABSOLUTE_STYLE,id:b}); | |
this._statusView=a; | |
this._createHtml(); | |
this._funcs={}; | |
this._funcs.position=AjxCallback.simpleClosure(this.__position,this); | |
this._funcs.show=AjxCallback.simpleClosure(this.__show,this); | |
this._funcs.hide=AjxCallback.simpleClosure(this.__hide,this); | |
this._funcs.pause=AjxCallback.simpleClosure(this.__pause,this); | |
this._funcs.hold=AjxCallback.simpleClosure(this.__hold,this); | |
this._funcs.idle=AjxCallback.simpleClosure(this.__idle,this); | |
this._funcs.fade=AjxCallback.simpleClosure(this.__fade,this); | |
this._funcs["fade-in"]=this._funcs.fade; | |
this._funcs["fade-out"]=this._funcs.fade; | |
this._funcs.slide=AjxCallback.simpleClosure(this.__slide,this); | |
this._funcs["slide-in"]=this._funcs.slide; | |
this._funcs["slide-out"]=this._funcs.slide; | |
this._funcs.next=AjxCallback.simpleClosure(this.transition,this) | |
}; | |
ZmToast.prototype=new DwtComposite; | |
ZmToast.prototype.constructor=ZmToast; | |
ZmToast.prototype.toString=function(){return"ZmToast" | |
}; | |
ZmToast.prototype.role="alert"; | |
ZmToast.prototype.isFocusable=true; | |
ZmToast.FADE={type:"fade"}; | |
ZmToast.FADE_IN={type:"fade-in"}; | |
ZmToast.FADE_OUT={type:"fade-out"}; | |
ZmToast.SLIDE={type:"slide"}; | |
ZmToast.SLIDE_IN={type:"slide-in"}; | |
ZmToast.SLIDE_OUT={type:"slide-out"}; | |
ZmToast.PAUSE={type:"pause"}; | |
ZmToast.HOLD={type:"hold"}; | |
ZmToast.IDLE={type:"idle"}; | |
ZmToast.SHOW={type:"show"}; | |
ZmToast.DEFAULT_TRANSITIONS=[ZmToast.SLIDE_IN,ZmToast.PAUSE,ZmToast.SLIDE_OUT]; | |
ZmToast.DEFAULT_STATE={}; | |
ZmToast.DEFAULT_STATE.position={location:"C"}; | |
ZmToast.DEFAULT_STATE.pause={duration:1200}; | |
ZmToast.DEFAULT_STATE.hold={}; | |
ZmToast.DEFAULT_STATE.fade={duration:100,multiplier:1}; | |
ZmToast.DEFAULT_STATE["fade-in"]={start:0,end:99,step:10,duration:200,multiplier:1}; | |
ZmToast.DEFAULT_STATE["fade-out"]={start:99,end:0,step:-10,duration:200,multiplier:1}; | |
ZmToast.DEFAULT_STATE.slide={duration:100,multiplier:1}; | |
ZmToast.DEFAULT_STATE["slide-in"]={start:-40,end:0,step:1,duration:100,multiplier:1}; | |
ZmToast.DEFAULT_STATE["slide-out"]={start:0,end:-40,step:-1,duration:100,multiplier:1}; | |
ZmToast.LEVEL_RE=/\b(ZToastCrit|ZToastWarn|ZToastInfo)\b/g; | |
ZmToast.DISMISSABLE_STATES=[ZmToast.HOLD]; | |
ZmToast.prototype.TEMPLATE="share.Widgets#ZToast"; | |
ZmToast.prototype.dispose=function(){this._textEl=null; | |
this._iconEl=null; | |
this._detailEl=null; | |
DwtComposite.prototype.dispose.call(this) | |
}; | |
ZmToast.prototype.popup=function(b){this.__clear(); | |
this._poppedUp=true; | |
this._dismissed=false; | |
this._dismissCallback=b.dismissCallback; | |
this._finishCallback=b.finishCallback; | |
var g,f,c; | |
switch(b.level){case ZmStatusView.LEVEL_CRITICAL:f="ZToastCrit"; | |
g="Critical"; | |
c=AjxMsg.criticalMsg; | |
break; | |
case ZmStatusView.LEVEL_WARNING:f="ZToastWarn"; | |
g="Warning"; | |
c=AjxMsg.warningMsg; | |
break; | |
case ZmStatusView.LEVEL_INFO:default:f="ZToastInfo"; | |
g="Success"; | |
c=AjxMsg.infoMsg; | |
break | |
}var e=this.getHtmlElement(); | |
Dwt.delClass(e,ZmToast.LEVEL_RE,f); | |
if(this._iconEl){this._iconEl.innerHTML=AjxImg.getImageHtml({imageName:g,altText:c}) | |
}if(this._textEl){var d=document.createElement("SPAN"); | |
d.innerHTML=b.msg||""; | |
Dwt.removeChildren(this._textEl); | |
this._textEl.appendChild(d) | |
}var a=appCtxt.getSkinHint("toast","location"); | |
var h=(b.transitions||appCtxt.getSkinHint("toast","transitions")||ZmToast.DEFAULT_TRANSITIONS); | |
h=[].concat({type:"position",location:a},h,{type:"hide"}); | |
this._transitions=h; | |
this.transition() | |
}; | |
ZmToast.prototype.popdown=function(){this.__clear(); | |
this.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE); | |
this._poppedUp=false; | |
if(!this._dismissed){if(this._finishCallback){this._finishCallback.run() | |
}}this._dismissed=false | |
}; | |
ZmToast.prototype.isPoppedUp=function(){return this._poppedUp | |
}; | |
ZmToast.prototype.transition=function(){if(this._pauseTimer){clearTimeout(this._pauseTimer); | |
this._pauseTimer=null | |
}if(this._held){this._held=false | |
}var b=this._transitions&&this._transitions.shift(); | |
if(!b){this._poppedUp=false; | |
if(!this._statusView.nextStatus()){this.popdown() | |
}return | |
}var a=this._state=this._createState(b); | |
this.setLocation(a.x,a.y); | |
this._funcs[b.type||"next"]() | |
}; | |
ZmToast.prototype._createHtml=function(a){var c={id:this._htmlElId}; | |
this._createHtmlFromTemplate(a||this.TEMPLATE,c); | |
this.setZIndex(Dwt.Z_TOAST); | |
var b=this.getHtmlElement(); | |
b.setAttribute("aria-live","assertive"); | |
b.setAttribute("aria-relevant","additions"); | |
b.setAttribute("aria-atomic",true) | |
}; | |
ZmToast.prototype._createHtmlFromTemplate=function(a,b){DwtComposite.prototype._createHtmlFromTemplate.call(this,a,b); | |
this._textEl=document.getElementById(b.id+"_text"); | |
this._iconEl=document.getElementById(b.id+"_icon"); | |
this._detailEl=document.getElementById(b.id+"_detail") | |
}; | |
ZmToast.prototype._createState=function(d){var b=AjxUtil.createProxy(d); | |
var c=ZmToast.DEFAULT_STATE[b.type]; | |
for(var a in c){if(!b[a]){b[a]=c[a] | |
}}switch(b.type){case"fade-in":this.setOpacity(0); | |
this.setLocation(null,0); | |
b.value=b.start; | |
break; | |
case"fade-out":case"fade":this.setLocation(null,0); | |
b.value=b.start; | |
break; | |
case"slide-in":case"slide-out":case"slide":this.setLocation(null,-36); | |
this.setOpacity(100); | |
b.value=b.start; | |
break | |
}return b | |
}; | |
ZmToast.prototype.__clear=function(){clearTimeout(this._actionId); | |
clearInterval(this._actionId); | |
this._actionId=-1 | |
}; | |
ZmToast.prototype.__position=function(){var d=this._state.location||"C"; | |
var c="skin_container_toast"; | |
var b=Dwt.byId(c)||this.shell.getHtmlElement(); | |
var g=Dwt.getSize(b); | |
var e=this.getSize(); | |
var a=(g.x-e.x)/2; | |
var h=(g.y-e.y)/2; | |
switch(d.toUpperCase()){case"N":h=0-e.y; | |
break; | |
case"S":h=g.y-e.y; | |
break; | |
case"E":a=g.x-e.x; | |
break; | |
case"W":a=0; | |
break; | |
case"NE":a=g.x-e.x; | |
h=0; | |
break; | |
case"NW":a=0; | |
h=0; | |
break; | |
case"SE":a=g.x-e.x; | |
h=g.y-e.y; | |
break; | |
case"SW":a=0; | |
h=g.y-e.y; | |
break; | |
case"C":default:break | |
}var f=Dwt.toWindow(b); | |
a+=f.x; | |
h+=f.y; | |
this.setLocation(a,h); | |
this._funcs.next() | |
}; | |
ZmToast.prototype.__show=function(){this.setVisible(true); | |
this.setVisibility(true); | |
this._funcs.next() | |
}; | |
ZmToast.prototype.__hide=function(){this.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE); | |
if(this._textEl){Dwt.removeChildren(this._textEl) | |
}if(this._iconEl){Dwt.removeChildren(this._iconEl) | |
}this._funcs.next() | |
}; | |
ZmToast.prototype.__pause=function(){if(this._dismissed&&ZmToast.__mayDismiss(ZmToast.PAUSE)){this._funcs.next() | |
}else{this._pauseTimer=setTimeout(this._funcs.next,this._state.duration) | |
}}; | |
ZmToast.prototype.__hold=function(){if(this._dismissed&&ZmToast.__mayDismiss(ZmToast.HOLD)!=-1){this._funcs.next() | |
}else{this._held=true | |
}}; | |
ZmToast.__mayDismiss=function(a){return AjxUtil.indexOf(ZmToast.DISMISSABLE_STATES,a)!=-1 | |
}; | |
ZmToast.prototype.dismiss=function(){if(!this._dismissed&&this._poppedUp){var a=(this._pauseTimer&&ZmToast.__mayDismiss(ZmToast.PAUSE))||(this._held&&ZmToast.__mayDismiss(ZmToast.HOLD)); | |
if(a){this._funcs.next() | |
}this._dismissed=true; | |
if(this._dismissCallback instanceof AjxCallback){this._dismissCallback.run() | |
}}}; | |
ZmToast.prototype.__idle=function(){if(!this._idleTimer){this._idleTimer=new DwtIdleTimer(0,new AjxCallback(this,this.__idleCallback)) | |
}else{this._idleTimer.resurrect(0) | |
}}; | |
ZmToast.prototype.__idleCallback=function(a){if(!a){this.transition(); | |
this._idleTimer.kill() | |
}}; | |
ZmToast.prototype.__move=function(){this._funcs.next() | |
}; | |
ZmToast.prototype.__fade=function(){var a=this._state.value; | |
var b=this._state.step; | |
var d=b>0?a>=this._state.end:a<=this._state.end; | |
if(d){a=this._state.end | |
}this.setOpacity(a); | |
if(d){this.__clear(); | |
setTimeout(this._funcs.next,0); | |
return | |
}if(this._actionId==-1){var c=this._state.duration; | |
var e=c/Math.abs(b); | |
this._actionId=setInterval(this._funcs.fade,e) | |
}this._state.value+=b; | |
this._state.step*=this._state.multiplier | |
}; | |
ZmToast.prototype.__slide=function(){var c=this._state.value; | |
var a=this._state.step; | |
var d=a>0?c>=this._state.end:c<=this._state.end; | |
if(d){c=this._state.end | |
}this.setLocation(null,c); | |
if(d){this.__clear(); | |
setTimeout(this._funcs.next,0); | |
return | |
}if(this._actionId==-1){var b=this._state.duration; | |
var e=b/Math.abs(a); | |
this._actionId=setInterval(this._funcs.slide,e) | |
}this._state.value+=a; | |
this._state.step*=this._state.multiplier | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmOverviewContainer")){ZmOverviewContainer=function(a){if(arguments.length==0){return | |
}a.className=a.className||"ZmOverviewContainer"; | |
a.id=a.id||ZmId.getOverviewContainerId(a.containerId); | |
DwtTree.call(this,a); | |
this.setScrollStyle(a.scroll||Dwt.SCROLL_Y); | |
this.containerId=a.containerId; | |
this._appName=a.appName; | |
this._controller=a.controller; | |
this._headerItems={}; | |
this._overview={}; | |
this.addSelectionListener(new AjxListener(this,this._treeViewListener)); | |
this.addTreeListener(new AjxListener(this,this._treeListener)) | |
}; | |
ZmOverviewContainer.prototype=new DwtTree; | |
ZmOverviewContainer.prototype.constructor=ZmOverviewContainer; | |
ZmOverviewContainer.prototype.toString=function(){return"ZmOverviewContainer" | |
}; | |
ZmOverviewContainer.prototype.initialize=function(a){}; | |
ZmOverviewContainer.prototype.getOverview=function(a){return this._overview[a] | |
}; | |
ZmOverviewContainer.prototype.getOverviews=function(){return this._overview | |
}; | |
ZmOverviewContainer.prototype.getHeaderItem=function(){}; | |
ZmOverviewContainer.prototype.getSelected=function(){var b; | |
for(var a in this._overview){b=this._overview[a].getSelected(); | |
if(b){return b | |
}}}; | |
ZmOverviewContainer.prototype.deselectAll=function(a){DwtTree.prototype.deselectAll.call(this); | |
this._deselectAllTreeViews(a) | |
}; | |
ZmOverviewContainer.prototype.setOverviewTrees=function(a){for(var b in this._overview){this._overview[b].set(a) | |
}}; | |
ZmOverviewContainer.prototype.resetOperations=function(b,a){}; | |
ZmOverviewContainer.prototype._treeViewListener=function(a){}; | |
ZmOverviewContainer.prototype._treeListener=function(a){}; | |
ZmOverviewContainer.prototype._initializeActionMenu=function(a){}; | |
ZmOverviewContainer.prototype._getActionMenu=function(a){if(this._actionMenu instanceof AjxCallback){var b=this._actionMenu; | |
this._actionMenu=b.run() | |
}return this._actionMenu | |
}; | |
ZmOverviewContainer.prototype._createActionMenu=function(b,a,c){}; | |
ZmOverviewContainer.prototype._actionMenuListener=function(a){}; | |
ZmOverviewContainer.prototype._deselectAllTreeViews=function(d){for(var c in this._overview){var e=this._overview[c]; | |
if(d&&d==e){continue | |
}var b=e._treeHash; | |
for(var a in b){if(b[a].getSelectionCount()>0){b[a].deselectAll(); | |
break | |
}}}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmAccountOverviewContainer")){ZmAccountOverviewContainer=function(b){if(arguments.length==0){return | |
}ZmOverviewContainer.call(this,b); | |
this._vFolderTreeItemMap={}; | |
this._settingChangeListener=new AjxListener(this,this._handleSettingChange); | |
var a=new AjxListener(this,this._mouseListener); | |
this.addListener(DwtEvent.ONMOUSEDOWN,a); | |
this.addListener(DwtEvent.ONMOUSEUP,a) | |
}; | |
ZmAccountOverviewContainer.prototype=new ZmOverviewContainer; | |
ZmAccountOverviewContainer.prototype.constructor=ZmAccountOverviewContainer; | |
ZmAccountOverviewContainer.VIRTUAL_FOLDERS=[ZmFolder.ID_INBOX,ZmFolder.ID_SENT,ZmFolder.ID_DRAFTS,ZmFolder.ID_SPAM,ZmFolder.ID_OUTBOX,ZmFolder.ID_TRASH]; | |
ZmAccountOverviewContainer.prototype.toString=function(){return"ZmAccountOverviewContainer" | |
}; | |
ZmAccountOverviewContainer.prototype.getHeaderItem=function(a){return a&&this._headerItems[a.id] | |
}; | |
ZmAccountOverviewContainer.prototype.expandAccountOnly=function(b){if(!b){b=appCtxt.getActiveAccount() | |
}for(var a in this._headerItems){this._headerItems[a].setExpanded((a==b.id),false,false) | |
}}; | |
ZmAccountOverviewContainer.prototype.getSelected=function(){var b=ZmOverviewContainer.prototype.getSelected.call(this); | |
if(!b){b=this.getSelection()[0]; | |
var c=b&&appCtxt.accountList.getAccount(b.getData(Dwt.KEY_ID)); | |
var a=c&&appCtxt.getFolderTree(c); | |
return a&&a.root | |
}return b | |
}; | |
ZmAccountOverviewContainer.prototype.initialize=function(F){var y,l; | |
var k=appCtxt.accountList.visibleAccounts; | |
var t=(appCtxt.isOffline&&this._appName==ZmApp.MAIL&&(k.length>2)); | |
var o=t; | |
var e=appCtxt.accountList.mainAccount; | |
var D=F.omit; | |
for(var z=0; | |
z<k.length; | |
z++){l=k[z]; | |
if(appCtxt.isOffline&&l.isMain&&this._appName!=ZmApp.PREFERENCES){continue | |
}if(!l.active){continue | |
}F.omit={}; | |
if(l.type==ZmAccount.TYPE_POP){F.omit[ZmFolder.ID_SPAM]=true; | |
F.omit[ZmFolder.ID_OUTBOX]=true | |
}if(F.overviewId&&!F.isAppOverview){var r=F.overviewId.split(":")[1]; | |
if(r&&(r=="ZmNewOrganizerDialog")){F.omit[ZmFolder.ID_DRAFTS]=true | |
}}this._addAccount(F,l,o,null,"account"+z); | |
y=this.getHeaderItem(l); | |
if(y){this._setupHeader(y,l) | |
}this.updateAccountInfo(l,true,true); | |
o=!o | |
}u=D&&D[ZmOrganizer.ID_ALL_MAILBOXES]; | |
if(t&&!u){var m=ZmMsg[ZmFolder.MSG_KEY[ZmOrganizer.ID_ALL_MAILBOXES]]; | |
var f=appCtxt.get(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN)?m:this._getFolderLabel(ZmOrganizer.ID_INBOX,m); | |
var B={parent:this,text:f,imageInfo:"AccountAll"}; | |
var q=appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES); | |
var d=this._allMailboxesTreeHeader=new DwtTreeItem(B); | |
d.setData(Dwt.KEY_ID,ZmOrganizer.ID_ALL_MAILBOXES); | |
d.addClassName("ZmOverviewGlobalInbox"); | |
d._initialize(0,true); | |
d.setVisible(q); | |
d.__origText=m; | |
if(q){this.highlightAllMboxes() | |
}var s=appCtxt.getSettings(e).getSetting(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES); | |
s.addChangeListener(this._settingChangeListener); | |
var C=ZmAccountOverviewContainer.VIRTUAL_FOLDERS; | |
for(var z=0; | |
z<C.length; | |
z++){var a=C[z]; | |
B={parent:d,text:this._getFolderLabel(a,ZmMsg[ZmFolder.MSG_KEY[a]]),imageInfo:ZmFolder.ICON[a]}; | |
var g=this._vFolderTreeItemMap[a]=new DwtTreeItem(B); | |
g.setData(Dwt.KEY_ID,a); | |
g.addClassName("DwtTreeItemChildDiv"); | |
g._initialize(null,true); | |
g.setToolTipContent(appCtxt.accountList.getTooltipForVirtualFolder(a)) | |
}B={parent:d,text:ZmMsg.globalSearches,imageInfo:"SearchFolder"}; | |
var w=this._searchTreeHeader=new DwtTreeItem(B); | |
w.addClassName("DwtTreeItemChildDiv"); | |
w._initialize(null,true); | |
w.__isSearch=true; | |
var v=appCtxt.getById(ZmOrganizer.ID_ROOT,e); | |
var n=v.getByType(ZmOrganizer.SEARCH); | |
for(var z=0; | |
z<n.length; | |
z++){var j=n[z]; | |
if(j.id!=ZmOrganizer.ID_ALL_MAILBOXES&&j.isOfflineGlobalSearch){this.addSearchFolder(j) | |
}}w.setVisible(w.getItemCount()>0); | |
if(appCtxt.get(ZmSetting.OFFLINE_SAVED_SEARCHES_TREE_OPEN)){w.setExpanded(true,null,true) | |
}if(appCtxt.get(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN)){d.setExpanded(true,null,true) | |
}}if(appCtxt.isOffline){var A=AjxUtil.hashCopy(F); | |
A.omit={}; | |
if(this._appName!=ZmApp.PREFERENCES){this._addAccount(A,e,o,"ZmOverviewLocalHeader","LocalFolders"); | |
y=this.getHeaderItem(e); | |
y.setExpanded(appCtxt.get(ZmSetting.ACCOUNT_TREE_OPEN,null,e)); | |
this.updateAccountInfo(e,false,true) | |
}else{var x={parent:this,text:e.getDisplayName(),imageInfo:e.getIcon()}; | |
var p=new DwtTreeItem(x); | |
p._initialize(null,true); | |
var h=appCtxt.getOverviewId(this.containerId,e); | |
var H=this._overview[h].getTreeView(ZmOrganizer.PREF_PAGE); | |
var G=H.getTreeItemById("PREF_PAGE_IMPORT_EXPORT"); | |
H.getHeaderItem().removeChild(G); | |
p._addItem(G); | |
G.addClassName("DwtTreeItemChildDiv"); | |
p.setExpanded(true,null,true) | |
}}var u=F.omit&&F.omit[ZmOrganizer.ID_ZIMLET]; | |
if(!appCtxt.inStartup&&!u&&appCtxt.getZimletMgr().getPanelZimlets().length==0){u=true | |
}if(!u){AjxDispatcher.require("Zimlet") | |
}if(!u&&window[ZmOverviewController.CONTROLLER[ZmOrganizer.ZIMLET]]&&this._appName!=ZmApp.PREFERENCES){var c=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET]; | |
var E=F.overviewId=appCtxt.getOverviewId([this.containerId,c],null); | |
var b={label:ZmMsg[c],icon:"Zimlet",dataId:E,className:"ZmOverviewZimletHeader"}; | |
F.overviewTrees=[ZmOrganizer.ZIMLET]; | |
this._addSection(b,null,F); | |
var y=this._headerItems[E]; | |
if(y){y.__isZimlet=true; | |
y.setExpanded(appCtxt.get(ZmSetting.ZIMLET_TREE_OPEN,null,e)) | |
}}this._initializeActionMenu() | |
}; | |
ZmAccountOverviewContainer.prototype.addSearchFolder=function(b){if(!this._searchTreeHeader){return | |
}var c={parent:this._searchTreeHeader,text:b.getName(),imageInfo:b.getIcon()}; | |
var a=new DwtTreeItem(c); | |
a.setData(Dwt.KEY_ID,b); | |
a._initialize(null,true); | |
if(!this._searchTreeHeader.getVisible()){this._searchTreeHeader.setVisible(true) | |
}}; | |
ZmAccountOverviewContainer.prototype.updateAccountInfo=function(f,a,e){var b=appCtxt.getApp(this._appName)&&this.getHeaderItem(f); | |
if(b){if(a){var d=(f.status==ZmZimbraAccount.STATUS_RUNNING)?("<img src='/img/animated/ImgSpinner.gif' width=16 height=16 border=0>"):(AjxImg.getImageHtml(f.getStatusIcon())); | |
if(b._extraCell){b._extraCell.innerHTML=(d||"") | |
}if(appCtxt.isOffline&&f.status==ZmZimbraAccount.STATUS_AUTHFAIL){var c=appCtxt.getPasswordChangeDialog(); | |
c.popup(f) | |
}}if(e||a){b.setToolTipContent(f.getToolTip()) | |
}}}; | |
ZmAccountOverviewContainer.prototype.updateLabel=function(a){if(a.nId==ZmOrganizer.ID_INBOX){var e=a.getAccount(); | |
var d=this.getHeaderItem(e); | |
if(d&&!d.getExpanded()){d.setText(this._getAccountHeaderLabel(e)) | |
}}var b=this._vFolderTreeItemMap[a.nId]; | |
if(b){b.setText(this._getFolderLabel(a.nId,a.name)); | |
if(a.nId==ZmOrganizer.ID_INBOX&&!this._allMailboxesTreeHeader.getExpanded()){var c=this._getFolderLabel(a.nId,this._allMailboxesTreeHeader.__origText); | |
this._allMailboxesTreeHeader.setText(c) | |
}}}; | |
ZmAccountOverviewContainer.prototype.updateTooltip=function(a){var b=this._allMailboxesTreeHeader&&this._vFolderTreeItemMap[a]; | |
if(b){b.setToolTipContent(appCtxt.accountList.getTooltipForVirtualFolder(a)) | |
}}; | |
ZmAccountOverviewContainer.prototype.resetOperations=function(c,e){var d=c.getOp(ZmOperation.EMPTY_FOLDER); | |
if(e instanceof ZmSearchFolder){c.getOp(ZmOperation.MARK_ALL_READ).setVisible(false); | |
d.setVisible(false); | |
c.getOp(this._newOp).setVisible(false); | |
if(appCtxt.isOffline){c.getOp(ZmOperation.SYNC).setVisible(false) | |
}c.getOp(ZmOperation.DELETE).setVisible(true); | |
return | |
}var g=appCtxt.accountList.getAccount(e); | |
var b=(g||e==ZmOrganizer.ID_ALL_MAILBOXES); | |
c.getOp(ZmOperation.MARK_ALL_READ).setVisible(!b); | |
d.setVisible(false); | |
c.getOp(this._newOp).setVisible(b&&e!=ZmOrganizer.ID_ALL_MAILBOXES); | |
if(appCtxt.isOffline){c.getOp(ZmOperation.SYNC).setVisible(b&&(!g||(g&&!g.isMain))) | |
}c.getOp(ZmOperation.DELETE).setVisible(false); | |
if(b){c.enable(this._newOp,true); | |
c.enable(ZmOperation.SYNC,(!g||(g&&!g.isMain))) | |
}else{var a=false; | |
if(e!=ZmOrganizer.ID_OUTBOX&&e!=ZmFolder.ID_DRAFTS&&this._actionedHeaderItem.getText().indexOf("bold")!=-1){a=true | |
}c.enable(ZmOperation.MARK_ALL_READ,a); | |
if(e==ZmOrganizer.ID_TRASH||e==ZmOrganizer.ID_SPAM){var f=(e==ZmOrganizer.ID_TRASH)?ZmMsg.emptyTrash:ZmMsg.emptyJunk; | |
d.setText(f); | |
d.setVisible(true); | |
c.enable(ZmOperation.EMPTY_FOLDER,!this._isFolderEmpty(e)) | |
}}}; | |
ZmAccountOverviewContainer.prototype.removeZimletSection=function(){var a=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET]; | |
var b=appCtxt.getOverviewId([this.containerId,a],null); | |
var c=this._headerItems[b]; | |
if(c){this.removeChild(c) | |
}}; | |
ZmAccountOverviewContainer.prototype.highlightAllMboxes=function(){this.deselectAll(); | |
this.setSelection(this._allMailboxesTreeHeader,true) | |
}; | |
ZmAccountOverviewContainer.prototype._addAccount=function(g,h,b,j,a){g.overviewId=appCtxt.getOverviewId(this.containerId,h); | |
g.account=h; | |
var e=appCtxt.getApp(this._appName); | |
var c=(!e||(e&&appCtxt.get(ZmApp.SETTING[this._appName],null,h))); | |
if(this._appName==ZmApp.PREFERENCES||c){var d=g.omitPerAcct?g.omitPerAcct[h.id]:g.omit; | |
var i,f; | |
if(this._appName==ZmApp.PREFERENCES&&h.isMain&&appCtxt.isOffline){i=ZmMsg.allAccounts; | |
f="AccountAll" | |
}else{i=h.getDisplayName(); | |
if(!appCtxt.isFamilyMbox){f=h.getIcon() | |
}}var k={label:i,icon:f,dataId:h.id,className:j,predictableId:a}; | |
this._addSection(k,d,g,b) | |
}var l=appCtxt.getSettings(h).getSetting(ZmSetting.QUOTA_USED); | |
l.addChangeListener(this._settingChangeListener) | |
}; | |
ZmAccountOverviewContainer.prototype._addSection=function(h,d,e,c){var f={parent:this,text:h.label,imageInfo:h.icon,selectable:e.selectable,className:h.className,id:this.getHTMLElId()+"__"+(h.predictableId||h.dataId)+"__SECTION"}; | |
var g=this._headerItems[h.dataId]=new DwtTreeItem(f); | |
g.setData(Dwt.KEY_ID,h.dataId); | |
g.setScrollStyle(Dwt.CLIP); | |
g._initialize(null,true,true); | |
g.addClassName(c?"ZmOverviewSectionHilite":"ZmOverviewSection"); | |
e.id=ZmId.getOverviewId(e.overviewId); | |
e.parent=g; | |
e.scroll=Dwt.CLIP; | |
e.posStyle=Dwt.STATIC_STYLE; | |
var b=this._controller._overview[e.overviewId]=this._overview[e.overviewId]=new ZmOverview(e,this._controller); | |
g._dndScrollCallback=this._overview._dndScrollCallback,g._dndScrollId=this._overview._scrollableContainerId,g._addItem(b,null,true); | |
var a=e.overviewTrees||e.treeIds; | |
b.set(a,d) | |
}; | |
ZmAccountOverviewContainer.prototype._setupHeader=function(e,d){if(this._appName==ZmApp.PREFERENCES){e.setExpanded(true,false,true); | |
e.enableSelection(false) | |
}else{var c=appCtxt.get(ZmSetting.ACCOUNT_TREE_OPEN,null,d); | |
e.setExpanded(c); | |
if(!c){e.setText(this._getAccountHeaderLabel(d)) | |
}}if(e._extraCell){e._extraCell.onclick=AjxCallback.simpleClosure(this._handleStatusClick,this,d) | |
}var a=this._controller.getTreeController(ZmOrganizer.FOLDER).getDropTarget(); | |
var b=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,d); | |
e.setDropTarget(a); | |
e.setData(Dwt.KEY_OBJECT,appCtxt.getById(b)) | |
}; | |
ZmAccountOverviewContainer.prototype._isFolderEmpty=function(a){var d=appCtxt.accountList.visibleAccounts; | |
for(var b=0; | |
b<d.length; | |
b++){var c=appCtxt.getById(ZmOrganizer.getSystemId(a,d[b])); | |
if(c&&c.numTotal>0){return false | |
}}return true | |
}; | |
ZmAccountOverviewContainer.prototype._syncAccount=function(a,b){a.popdown(); | |
b.sync() | |
}; | |
ZmAccountOverviewContainer.prototype._treeViewListener=function(n){if(n.detail!=DwtTree.ITEM_ACTIONED&&n.detail!=DwtTree.ITEM_SELECTED&&n.detail!=DwtTree.ITEM_DBL_CLICKED){return | |
}var o=this._actionedHeaderItem=n.item; | |
if(o&&(o.__isZimlet||o.__isSearch)){return | |
}var g=o&&o.getData(Dwt.KEY_ID); | |
if(n.detail==DwtTree.ITEM_ACTIONED&&appCtxt.getApp(this._appName)){var m=this._getActionMenu(g); | |
if(m){this.resetOperations(m,g); | |
m.popup(0,n.docX,n.docY) | |
}}else{if((n.detail==DwtTree.ITEM_SELECTED)&&o){if(this._appName==ZmApp.CALENDAR||this._appName==ZmApp.PREFERENCES){return | |
}this._deselectAllTreeViews(); | |
if(!ZmApp.NAME[this._appName]){return | |
}if(g){var l=appCtxt.getSearchController(); | |
var j=appCtxt.accountList.getAccount(g); | |
if(j){if(appCtxt.isOffline&&j.inNewMailMode){j.inNewMailMode=false; | |
var c=appCtxt.getOverviewController()._overviewContainer; | |
for(var h in c){c[h].updateAccountInfo(j,true,true) | |
}}if((n.target.parentNode==n.item._extraCell)&&j.isError()){return | |
}l.searchAllAccounts=false; | |
appCtxt.accountList.setActiveAccount(j); | |
if(appCtxt.isOffline&&j.hasNotSynced()&&!j.__syncAsked){j.__syncAsked=true; | |
var k=appCtxt.getYesNoMsgDialog(); | |
k.registerCallback(DwtDialog.YES_BUTTON,this._syncAccount,this,[k,j]); | |
k.setMessage(ZmMsg.neverSyncedAsk,DwtMessageDialog.INFO_STYLE); | |
k.popup() | |
}var d=ZmOrganizer.DEFAULT_FOLDER[ZmApp.ORGANIZER[this._appName]]; | |
var b=appCtxt.getById(ZmOrganizer.getSystemId(d,j)); | |
if(!(b instanceof ZmFolder)){return | |
}var a=(this._appName==ZmApp.TASKS)?ZmSearch.DUE_DATE_DESC:ZmSearch.DATE_DESC; | |
var f={query:b.createQuery(),getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),searchFor:(ZmApp.DEFAULT_SEARCH[this._appName]),sortBy:((l.currentSearch&&b.nId==l.currentSearch.folderId)?null:a),accountName:(j&&j.name),noUpdateOverview:true} | |
}else{var e=appCtxt.accountList.mainAccount; | |
l.resetSearchAllAccounts(); | |
l.searchAllAccounts=true; | |
if(g instanceof ZmSearchFolder){f={searchAllAccounts:true,accountName:e.name,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),noUpdateOverview:true}; | |
l.redoSearch(g.search,false,f); | |
return | |
}if(g==ZmOrganizer.ID_ALL_MAILBOXES){g=ZmFolder.ID_INBOX | |
}f={queryHint:appCtxt.accountList.generateQuery(g),folderId:null,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML,null,e),searchFor:(ZmApp.DEFAULT_SEARCH[this._appName]),sortBy:ZmSearch.DATE_DESC,accountName:e.name,noUpdateOverview:true} | |
}l.search(f) | |
}}else{}}}; | |
ZmAccountOverviewContainer.prototype._treeListener=function(b){if(b.detail!=DwtTree.ITEM_COLLAPSED&&b.detail!=DwtTree.ITEM_EXPANDED){return | |
}var f=b.item; | |
var a=b.detail==DwtTree.ITEM_EXPANDED; | |
var e; | |
if(f){if(f.__isSearch){appCtxt.set(ZmSetting.OFFLINE_SAVED_SEARCHES_TREE_OPEN,a); | |
return | |
}var c=f.getData(Dwt.KEY_ID); | |
if(c==ZmOrganizer.ID_ALL_MAILBOXES){var d=a?f.__origText:this._getFolderLabel(ZmOrganizer.ID_INBOX,f.__origText); | |
f.setText(d); | |
appCtxt.set(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN,a); | |
return | |
}e=f.__isZimlet?appCtxt.accountList.mainAccount:appCtxt.accountList.getAccount(c) | |
}if(e&&appCtxt.getCurrentAppName()!=ZmApp.PREFERENCES){if(!appCtxt.inStartup){appCtxt.accountList.setActiveAccount(e); | |
appCtxt.set(ZmSetting.ACCOUNT_TREE_OPEN,a,null,null,null,e) | |
}if(!f.__isZimlet){var d=a?e.getDisplayName():this._getAccountHeaderLabel(e); | |
f.setText(d) | |
}}}; | |
ZmAccountOverviewContainer.prototype._mouseListener=function(a){return !Dwt.ffScrollbarCheck(a) | |
}; | |
ZmAccountOverviewContainer.prototype._handleSettingChange=function(c){if(c.type!=ZmEvent.S_SETTING){return | |
}var b=c.source; | |
if(b.id==ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES){var a=b.getValue(); | |
this._allMailboxesTreeHeader.setVisible(a); | |
if(!a){if(appCtxt.getActiveAccount().isMain){appCtxt.accountList.setActiveAccount(appCtxt.accountList.defaultAccount) | |
}appCtxt.getSearchController().searchAllAccounts=false; | |
appCtxt.getApp(ZmApp.MAIL).mailSearch() | |
}else{this._deselect(this._allMailboxesTreeHeader) | |
}}else{if(b.id==ZmSetting.QUOTA_USED){this.updateAccountInfo(c.getDetails().account,false,true) | |
}}}; | |
ZmAccountOverviewContainer.prototype._getAccountHeaderLabel=function(e,d){var b=(this._appName==ZmApp.MAIL)?ZmOrganizer.getSystemId(ZmOrganizer.ID_INBOX,e,true):null; | |
var c=b&&appCtxt.getById(b); | |
if(c&&c.numUnread>0){var a=AjxMessageFormat.format(ZmMsg.folderUnread,[e.getDisplayName(),c.numUnread]); | |
return(["<span style='font-weight:bold;'>",a,"</span>"].join("")) | |
}return e.getDisplayName() | |
}; | |
ZmAccountOverviewContainer.prototype._getFolderLabel=function(a,c){var e=(a!=ZmFolder.ID_DRAFTS&&a!=ZmFolder.ID_OUTBOX); | |
var d=appCtxt.accountList.getItemCount(a,e); | |
if(d>0){var b=AjxMessageFormat.format(ZmMsg.folderUnread,[c,d]); | |
return(["<span style='font-weight:bold;'>",b,"</span>"].join("")) | |
}return c | |
}; | |
ZmAccountOverviewContainer.prototype._initializeActionMenu=function(){if(!this._actionMenu){var b=ZmApp.ORGANIZER[this._appName]; | |
this._newOp=ZmOrganizer.NEW_OP[b]; | |
var a=[this._newOp]; | |
if(appCtxt.isOffline){a.push(ZmOperation.SYNC) | |
}a.push(ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER,ZmOperation.DELETE); | |
this._actionMenu=new AjxCallback(this,this._createActionMenu,[a]) | |
}}; | |
ZmAccountOverviewContainer.prototype._createActionMenu=function(c){var e=new AjxListener(this,this._actionMenuListener); | |
var d=new ZmActionMenu({parent:appCtxt.getShell(),menuItems:c}); | |
c=d.opList; | |
for(var b=0; | |
b<c.length; | |
b++){var a=d.getItem(b); | |
var f=c[b]; | |
if(f==ZmOperation.SYNC){a.setText(ZmMsg.sendReceive) | |
}d.addSelectionListener(f,e) | |
}d.addPopdownListener(new AjxListener(this,this._menuPopdownActionListener)); | |
return d | |
}; | |
ZmAccountOverviewContainer.prototype._menuPopdownActionListener=function(){this._actionedHeaderItem._setActioned(false) | |
}; | |
ZmAccountOverviewContainer.prototype._actionMenuListener=function(d){var b=d.item.getData(ZmOperation.KEY_ID); | |
var g=this._actionedHeaderItem.getData(Dwt.KEY_ID); | |
if(b==this._newOp){var f=ZmApp.ORGANIZER[this._appName]; | |
var a=this._controller.getTreeController(f,true); | |
if(a){a._actionedOrganizer=null; | |
var e=appCtxt.accountList.getAccount(g); | |
a._actionedOrganizer=appCtxt.getFolderTree(e).root; | |
a._newListener(d,e) | |
}}else{if(b==ZmOperation.SYNC){if(g==ZmOrganizer.ID_ALL_MAILBOXES){appCtxt.accountList.syncAll() | |
}else{var e=appCtxt.accountList.getAccount(g); | |
if(e){e.sync() | |
}}}else{if(b==ZmOperation.MARK_ALL_READ){this._doAction(g,b) | |
}else{if(b==ZmOperation.EMPTY_FOLDER){this._confirmEmptyAction(g,b) | |
}else{if(b==ZmOperation.DELETE){g._delete(); | |
var c=this._actionedHeaderItem.parent; | |
c.removeChild(this._actionedHeaderItem); | |
c.setVisible(c.getItemCount()>0) | |
}}}}}}; | |
ZmAccountOverviewContainer.prototype._confirmEmptyAction=function(c,a){var b=appCtxt.getOkCancelMsgDialog(); | |
b.reset(); | |
b.registerCallback(DwtDialog.OK_BUTTON,this._emptyCallback,this,[b,c,a]); | |
var d=(c==ZmFolder.ID_TRASH)?ZmMsg.confirmEmptyTrashFolder:(AjxMessageFormat.format(ZmMsg.confirmEmptyFolder,ZmMsg[ZmFolder.MSG_KEY[c]])); | |
b.setMessage(d,DwtMessageDialog.WARNING_STYLE); | |
b.popup() | |
}; | |
ZmAccountOverviewContainer.prototype._emptyCallback=function(c,b,a){c.popdown(); | |
this._doAction(b,a) | |
}; | |
ZmAccountOverviewContainer.prototype._doAction=function(b,a){var g=new ZmBatchCommand(true,appCtxt.accountList.mainAccount.name); | |
var e=appCtxt.accountList.visibleAccounts; | |
for(var c=0; | |
c<e.length; | |
c++){var f=e[c]; | |
if(f.isMain){continue | |
}var h=ZmOrganizer.getSystemId(b,f); | |
var d=appCtxt.getById(h); | |
if(d){if(a==ZmOperation.MARK_ALL_READ){d.markAllRead(g) | |
}else{d.empty(null,g) | |
}g.curId++ | |
}}g.run(); | |
if(appCtxt.isOffline){appCtxt.getApp(ZmApp.MAIL).clearNewMailBadge() | |
}}; | |
ZmAccountOverviewContainer.prototype._handleStatusClick=function(c,b){if(!c.isError()){return | |
}else{if(appCtxt.isOffline&&(c.status==ZmZimbraAccount.STATUS_AUTHFAIL)){var a=appCtxt.getPasswordChangeDialog(); | |
a.popup(c) | |
}else{c.showErrorMessage() | |
}}} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmOverview")){ZmOverview=function(c,f){var j=c.overviewClass?c.overviewClass:"ZmOverview"; | |
c.id=c.id||ZmId.getOverviewId(c.overviewId); | |
DwtComposite.call(this,{parent:c.parent,className:j,posStyle:c.posStyle,id:c.id}); | |
this._controller=f; | |
this.setScrollStyle(c.scroll||Dwt.SCROLL_Y); | |
this.overviewId=c.overviewId; | |
this.containerId=c.containerId; | |
this.account=c.account; | |
this.selectionSupported=c.selectionSupported; | |
this.actionSupported=c.actionSupported; | |
this.dynamicWidth=c.dynamicWidth; | |
this.dndSupported=c.dndSupported; | |
this.headerClass=c.headerClass; | |
this.showUnread=c.showUnread; | |
this.showNewButtons=c.showNewButtons; | |
this.treeStyle=c.treeStyle; | |
this.isCheckedByDefault=c.isCheckedByDefault; | |
this.noTooltips=c.noTooltips; | |
this.isAppOverview=c.isAppOverview; | |
this.skipImplicit=c.skipImplicit; | |
this.appName=c.appName; | |
this._treeIds=[]; | |
this._treeHash={}; | |
this._treeParents={}; | |
var k=document; | |
var d=this.getHtmlElement(); | |
if(c.treeIds){for(var e=0,h=c.treeIds.length; | |
e<h; | |
e++){var b=k.createElement("DIV"); | |
var g=c.treeIds[e]; | |
this._treeParents[g]=b.id=[this.overviewId,g].join("-parent-"); | |
d.appendChild(b) | |
}}if(this.dndSupported){this._scrollableContainerId=this.containerId||this.overviewId; | |
var a=this.containerId?document.getElementById(this.containerId):this.getHtmlElement(); | |
var c={container:a,threshold:15,amount:5,interval:10,id:this._scrollableContainerId}; | |
this._dndScrollCallback=new AjxCallback(null,DwtControl._dndScrollCallback,[c]) | |
}this.setAttribute("aria-label",ZmMsg.overviewLabel); | |
this.tabGroupMember=this | |
}; | |
ZmOverview.prototype=new DwtComposite; | |
ZmOverview.prototype.constructor=ZmOverview; | |
ZmOverview.prototype.isZmOverview=true; | |
ZmOverview.prototype.toString=function(){return"ZmOverview" | |
}; | |
ZmOverview.prototype.role="navigation"; | |
ZmOverview.prototype.getTreeParent=function(a){return this._treeParents[a] | |
}; | |
ZmOverview.prototype.set=function(a,c){if(a&&a.length){for(var b=0; | |
b<a.length; | |
b++){this.setTreeView(a[b],c) | |
}}}; | |
ZmOverview.prototype.setTreeView=function(b,a){if(!appCtxt.checkPrecondition(ZmOrganizer.PRECONDITION[b])){return | |
}AjxDispatcher.require(ZmOrganizer.ORG_PACKAGE[b]); | |
var c=this._controller.getTreeController(b); | |
if(!c){return | |
}if(this._treeHash[b]){c.clearTreeView(this.overviewId) | |
}else{this._treeIds.push(b) | |
}var d={overviewId:this.overviewId,omit:a,showUnread:this.showUnread,account:this.account}; | |
this._treeHash[b]=c.show(d) | |
}; | |
ZmOverview.prototype.clearChangeListener=function(b){for(var c=0; | |
c<b.length; | |
c++){var e=this._controller.getTreeController(b[c]); | |
var a=e._getTreeChangeListener(); | |
if(a){var d=appCtxt.getFolderTree(); | |
if(d){d.removeChangeListener(a) | |
}}}}; | |
ZmOverview.prototype.getTreeView=function(a){return this._treeHash[a] | |
}; | |
ZmOverview.prototype.getTreeViews=function(){return this._treeIds | |
}; | |
ZmOverview.prototype.getTreeItemById=function(e,c){if(!e){return null | |
}for(var b=0; | |
b<this._treeIds.length; | |
b++){var a=this._treeHash[this._treeIds[b]]; | |
if(a){var d=a.getTreeItemById&&a.getTreeItemById(e); | |
if(d&&(!c||(this._treeIds[b]==c))){return d | |
}}}return null | |
}; | |
ZmOverview.prototype.getSelected=function(b){for(var c=0; | |
c<this._treeIds.length; | |
c++){var a=this._treeHash[this._treeIds[c]]; | |
if(a){var d=a.getSelected(); | |
if(d){return b?a.type:d | |
}}}return null | |
}; | |
ZmOverview.prototype.deselectAllTreeViews=function(){for(var b=0; | |
b<this._treeIds.length; | |
b++){var a=this._treeHash[this._treeIds[b]]; | |
if(a){a.deselectAll() | |
}}}; | |
ZmOverview.prototype.setSelected=function(d,c){var b,a; | |
if(c){a=this._treeHash[c]; | |
b=a&&a.getTreeItemById(d) | |
}else{for(var c in this._treeHash){a=this._treeHash[c]; | |
b=a&&a.getTreeItemById(d); | |
if(b){break | |
}}}if(b&&(this._selectedTreeItem!=b)){a.setSelected(d,true,true) | |
}this.itemSelected(b) | |
}; | |
ZmOverview.prototype.itemSelected=function(c){if(appCtxt.multiAccounts&&c){var b=this.overviewId.substring(0,this.overviewId.indexOf(":")); | |
var a=this._controller.getOverviewContainer(b); | |
if(a){a.deselectAll(this) | |
}}if(this._selectedTreeItem&&(this._selectedTreeItem._tree!=(c&&c._tree))){this._selectedTreeItem._tree.deselectAll() | |
}this._selectedTreeItem=c | |
}; | |
ZmOverview.prototype.clear=function(){for(var a=0; | |
a<this._treeIds.length; | |
a++){var b=this._treeIds[a]; | |
if(this._treeHash[b]){var c=this._controller.getTreeController(b); | |
c.clearTreeView(this.overviewId); | |
delete this._treeHash[b] | |
}}}; | |
ZmOverview.prototype.clearSelection=function(){if(this._selectedTreeItem){this._selectedTreeItem._tree.deselectAll() | |
}}; | |
ZmOverview.prototype._initialize=function(){}; | |
ZmOverview.prototype.focus=function(){var b=this._selectedTreeItem; | |
if(!b){var a=this._treeHash[this._treeIds[0]]; | |
if(a){b=a._getNextTreeItem(true) | |
}}if(b){b.focus(); | |
b._tree.setSelection(b,false,true); | |
return b | |
}}; | |
ZmOverview.prototype.blur=function(){var a=this._selectedTreeItem; | |
if(a){a._blur() | |
}}; | |
ZmOverview.prototype._getNextTreeItem=function(e,c){for(var d=0; | |
d<this._treeIds.length; | |
d++){if(this._treeHash[this._treeIds[d]]==c){break | |
}}var b=null; | |
var a=e?d+1:d-1; | |
c=this._treeHash[this._treeIds[a]]; | |
while(c){b=DwtTree.prototype._getNextTreeItem.call(c,e); | |
if(b){break | |
}a=e?a+1:a-1; | |
c=this._treeHash[this._treeIds[a]] | |
}return b | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmAppIframeView")){ZmAppIframeView=function(a){if(arguments.length===0){return | |
}DwtControl.call(this,{parent:appCtxt.getShell(),posStyle:Dwt.ABSOLUTE_STYLE,className:"ZmAppIframeView"}); | |
this._createFrame(a) | |
}; | |
ZmAppIframeView.prototype=new DwtControl; | |
ZmAppIframeView.prototype.constructor=ZmAppIframeView; | |
ZmAppIframeView.prototype.isZmAppIframeView=true; | |
ZmAppIframeView.prototype.toString=function(){return"ZmAppIframeView" | |
}; | |
ZmAppIframeView.prototype._createFrame=function(e){e=e||{}; | |
var d=this._appName=e.appName,c=appCtxt.get(ZmApp.UPSELL_URL[d]),b=[],a=0; | |
var f=this._iframeId=this._getIframeId(); | |
b[a++]="<iframe id='"+f+"' width='100%' height='100%' frameborder='0' src='"; | |
b[a++]=c; | |
b[a++]="'>"; | |
this.setContent(b.join("")) | |
}; | |
ZmAppIframeView.prototype._getIframeId=function(){return"iframe_"+this.getHTMLElId() | |
}; | |
ZmAppIframeView.prototype.activate=function(a){}; | |
ZmAppIframeView.prototype.runRefresh=function(){}; | |
ZmAppIframeView.prototype.setBounds=function(b,h,d,a,f){var e=0; | |
if(!f){e=this._getToolbarHeight() | |
}DwtControl.prototype.setBounds.call(this,b,h-e,d,a+e); | |
var g="iframe_"+this.getHTMLElId(); | |
var c=document.getElementById(g); | |
if(c){c.width=d; | |
c.height=a+e | |
}}; | |
ZmAppIframeView.prototype._getToolbarHeight=function(){var b=appCtxt.getAppViewMgr().getViewComponent(ZmAppViewMgr.C_TOOLBAR_TOP); | |
if(b){var c=b.getSize(); | |
var a=c.y?c.y:b.getHtmlElement().clientHeight; | |
return a | |
}return 0 | |
}; | |
ZmAppIframeView.prototype.getTitle=function(){return[ZmMsg.zimbraTitle,appCtxt.getApp(this._appName).getDisplayName()].join(": ") | |
} | |
}if(AjxPackage.define("zimbraMail.share.view.ZmCommunityView")){ZmCommunityView=function(a){ZmAppIframeView.apply(this,arguments); | |
this._createFrame(a); | |
this._setupMessageHandling() | |
}; | |
ZmCommunityView.prototype=new ZmAppIframeView; | |
ZmCommunityView.prototype.constructor=ZmCommunityView; | |
ZmCommunityView.prototype.isZmCommunityView=true; | |
ZmCommunityView.prototype.toString=function(){return"ZmCommunityView" | |
}; | |
ZmCommunityView.prototype._setupMessageHandling=function(b){var a=document.getElementById(this._iframeId); | |
if(a){var c=ZmCommunityView.handleMessage.bind(null,this); | |
if(window.addEventListener){window.addEventListener("message",c,false) | |
}else{if(window.attachEvent){window.attachEvent("onmessage",c) | |
}}}}; | |
ZmCommunityView.prototype._getIframeId=function(){return"fragment-41812_iframe" | |
}; | |
ZmCommunityView.handleMessage=function(a,c){var b=document.getElementById(a._iframeId); | |
if(b&&c.source===b.contentWindow){var d=AjxStringUtil.parseQueryString(c.data||""); | |
var e=(d.unread&&d.unread.toLowerCase()==="true"); | |
if(d.type==="community-notification"&&e){appCtxt.getApp(a._appName).startAlert(); | |
a.getUpdates() | |
}}}; | |
ZmCommunityView.prototype.getUpdates=function(){var a=document.getElementById(this._iframeId); | |
if(a){a.contentWindow.postMessage("type=community-update","*") | |
}}; | |
ZmCommunityView.prototype.activate=function(a){if(a){this.getUpdates() | |
}}; | |
ZmCommunityView.prototype.runRefresh=function(){this.getUpdates() | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmController")){ZmController=function(a,d,b,c){if(arguments.length==0){return | |
}this.setCurrentViewType(this.getDefaultViewType()); | |
this.setCurrentViewId(this.getDefaultViewType()); | |
if(c){this.setSessionId(c,b) | |
}this._container=a; | |
this._app=d; | |
this._shell=appCtxt.getShell(); | |
this._appViews={}; | |
this._authenticating=false; | |
this.isHidden=(c==ZmApp.HIDDEN_SESSION); | |
this._elementsToHide=null | |
}; | |
ZmController.prototype.isZmController=true; | |
ZmController.prototype.toString=function(){return"ZmController" | |
}; | |
ZmController.SESSION_ID_SEP="-"; | |
ZmController.prototype._setView=function(){}; | |
ZmController.getDefaultViewType=function(){}; | |
ZmController.prototype.getDefaultViewType=function(){}; | |
ZmController.prototype._defaultView=ZmController.prototype.getDefaultViewType; | |
ZmController.prototype.getSessionId=function(){return this._sessionId | |
}; | |
ZmController.prototype.setSessionId=function(b,a){this._sessionId=b; | |
if(a){this.setCurrentViewType(a); | |
this.setCurrentViewId(b?[a,b].join(ZmController.SESSION_ID_SEP):a); | |
this.tabId=b?["tab",this.getCurrentViewId()].join("_"):"" | |
}this.sessionId=this._sessionId; | |
this.viewId=this.getCurrentViewId() | |
}; | |
ZmController.prototype.getCurrentViewType=function(a){return this._currentViewType | |
}; | |
ZmController.prototype._getViewType=ZmController.prototype.getCurrentViewType; | |
ZmController.prototype.setCurrentViewType=function(a){this._currentViewType=a | |
}; | |
ZmController.prototype.getCurrentViewId=function(){return this._currentViewIdOverride||this._currentViewId | |
}; | |
ZmController.prototype.setCurrentViewId=function(a){this._currentViewId=a; | |
this._currentView=this._currentViewId | |
}; | |
ZmController.prototype.getApp=function(){return this._app | |
}; | |
ZmController.prototype.getViewElements=function(a,b,c){var d={}; | |
c=c||this._toolbar[a]; | |
d[ZmAppViewMgr.C_TOOLBAR_TOP]=c; | |
d[ZmAppViewMgr.C_APP_CONTENT]=b; | |
return d | |
}; | |
ZmController.prototype.popupErrorDialog=function(a,n,p,m,l,c){var h=appCtxt.getErrorDialog(); | |
var d=""; | |
if(typeof n=="string"){d=n | |
}else{if(n instanceof Object){n.msg=n.msg||a; | |
var k=["method","msg","code","detail","trace","request","fileName","lineNumber","message","name","stack"]; | |
var g=[],f=0; | |
g[f++]="<table>"; | |
for(var e=0; | |
e<k.length; | |
e++){var b=k[e]; | |
var q=AjxStringUtil.htmlEncode(n[b]); | |
if(q){if(b=="request"){q=["<pre>",q,"</pre>"].join(""); | |
var o=document.getElementById(h._msgCellId); | |
if(o){o.className="DwtMsgDialog-wide" | |
}}g[f++]=["<tr><td valign='top'>",k[e],":</td><td valign='top'>",q,"</td></tr>"].join("") | |
}}g[f++]="</table>"; | |
d=g.join("") | |
}}h.registerCallback(DwtDialog.OK_BUTTON,this._errorDialogCallback,this); | |
if(!c){a=AjxStringUtil.htmlEncode(a) | |
}h.setMessage(a,d,DwtMessageDialog.CRITICAL_STYLE,ZmMsg.zimbraTitle); | |
h.popup(null,m); | |
if(l){h.showDetail() | |
}}; | |
ZmController.prototype.popupUploadErrorDialog=function(e,b,c){var a=appCtxt.getMsgDialog(); | |
var d=DwtMessageDialog.CRITICAL_STYLE; | |
var f=this.createErrorMessage(e,b,c); | |
if(f.length>0){a.setMessage(f,d); | |
a.popup() | |
}}; | |
ZmController.prototype.createErrorMessage=function(d,a,b){var f=""; | |
switch(a){case AjxPost.SC_OK:break; | |
case AjxPost.SC_REQUEST_ENTITY_TOO_LARGE:var c=d&&ZmMsg["attachmentSizeError_"+d]||ZmMsg.attachmentSizeError; | |
var e=AjxUtil.formatSize(appCtxt.get(ZmSetting.MESSAGE_SIZE_LIMIT)); | |
f=AjxMessageFormat.format(c,e); | |
break; | |
default:var c=d&&ZmMsg["errorAttachment_"+d]||ZmMsg.errorAttachment; | |
f=AjxMessageFormat.format(c,a||AjxPost.SC_NO_CONTENT); | |
break | |
}if((f.length>0)&&b){f+="<br /><br />"; | |
f+=b | |
}return f | |
}; | |
ZmController.handleScriptError=function(b,f){var h=[]; | |
var e="<br/>"; | |
if(b){var g=ZmMsg.scriptError+": "+b.message; | |
var a=b.fileName&&b.fileName.match(/(\w+\.js)/); | |
if(a&&a.length){g+=" - "+a[1]+":"+b.lineNumber | |
}if(b.fileName){h.push("File: "+b.fileName) | |
}if(b.lineNumber){h.push("Line: "+b.lineNumber) | |
}if(b.name){h.push("Error: "+b.name) | |
}if(b.stack){h.push("Stack: "+b.stack.replace("\n",e,"g")) | |
}}var d=h.join(e); | |
var c=[g,d].join(e+e); | |
if(f){}else{AjxDebug.println(AjxDebug.EXCEPTION,c); | |
appCtxt.getAppController().popupErrorDialog(g,d,null,false,true) | |
}}; | |
ZmController.prototype.getKeyMapName=function(){return ZmKeyMap.MAP_GLOBAL | |
}; | |
ZmController.prototype.handleKeyAction=function(i,j){var c=this.getTabView?this.getTabView():null; | |
if(c&&c.handleKeyAction(i)){return true | |
}var k=appCtxt.isExternalAccount(); | |
var a=ZmApp.ACTION_CODES_R[i]; | |
if(a){var e=ZmApp.ACTION_CODES[i]; | |
if(e){if(k){return true | |
}appCtxt.getApp(a).handleOp(e); | |
return true | |
}}switch(i){case ZmKeyMap.NEW:if(k){break | |
}a=appCtxt.getCurrentAppName(); | |
var g=ZmApp.NEW_ACTION_CODE[a]; | |
if(g){var e=ZmApp.ACTION_CODES[g]; | |
if(e){appCtxt.getApp(a).handleOp(e); | |
return true | |
}}break; | |
case ZmKeyMap.NEW_FOLDER:case ZmKeyMap.NEW_TAG:if(k||appCtxt.isWebClientOffline()){break | |
}var e=ZmApp.ACTION_CODES[i]; | |
if(e){this._newListener(null,e) | |
}break; | |
case ZmKeyMap.NEW_SEARCH:appCtxt.getSearchController().openNewSearchTab(); | |
break; | |
case ZmKeyMap.SAVED_SEARCH:if(k){break | |
}var f=appCtxt.getFolderTree().getByType(ZmOrganizer.SEARCH); | |
if(f&&f.length>0){var h=appCtxt.getChooseFolderDialog(); | |
var d={treeIds:[ZmOrganizer.SEARCH],overviewId:h.getOverviewId(ZmOrganizer.SEARCH,this._app._name),appName:this._app._name,title:ZmMsg.selectSearch}; | |
ZmController.showDialog(h,new AjxCallback(null,ZmController._searchSelectionCallback,[h]),d) | |
}break; | |
case ZmKeyMap.VISIT:var h=appCtxt.getChooseFolderDialog(); | |
var b=ZmApp.ORGANIZER[this._app._name]||ZmOrganizer.FOLDER; | |
var d={treeIds:[b],overviewId:h.getOverviewId(ZmOrganizer.APP[b]),appName:this._app._name,noRootSelect:true,title:AjxMessageFormat.format(ZmMsg.goToFolder,ZmMsg[ZmOrganizer.MSG_KEY[b]])}; | |
ZmController.showDialog(h,new AjxCallback(null,ZmController._visitOrgCallback,[h,b]),d); | |
break; | |
case ZmKeyMap.VISIT_TAG:if(appCtxt.getTagTree().size()>0){var h=appCtxt.getPickTagDialog(); | |
ZmController.showDialog(h,new AjxCallback(null,ZmController._visitOrgCallback,[h,ZmOrganizer.TAG])) | |
}break; | |
default:return false | |
}return true | |
}; | |
ZmController._searchSelectionCallback=function(b,a){if(a){appCtxt.getSearchController().redoSearch(a.search) | |
}b.popdown() | |
}; | |
ZmController._visitOrgCallback=function(b,c,d){if(d){var a=appCtxt.getOverviewController().getTreeController(c); | |
if(a&&a._itemClicked){a._itemClicked(d) | |
}}b.popdown() | |
}; | |
ZmController.prototype.mapSupported=function(a){return false | |
}; | |
ZmController.prototype._newListener=function(a,b){switch(b){case ZmOperation.NEW_FOLDER:ZmController.showDialog(appCtxt.getNewFolderDialog(),this.getNewFolderCallback()); | |
break; | |
case ZmOperation.NEW_TAG:if(!this._newTagCb){this._newTagCb=new AjxCallback(this,this._newTagCallback) | |
}ZmController.showDialog(appCtxt.getNewTagDialog(),this._newTagCb); | |
break | |
}}; | |
ZmController.prototype._newFolderCallback=function(f,d,b,c){var e=appCtxt.getNewFolderDialog(); | |
e.popdown(); | |
var a=appCtxt.getOverviewController(); | |
a.getTreeController(ZmOrganizer.FOLDER)._doCreate(f,d,b,c) | |
}; | |
ZmController.prototype._newTagCallback=function(b){appCtxt.getNewTagDialog().popdown(); | |
var a=appCtxt.getOverviewController(); | |
a.getTreeController(ZmOrganizer.TAG)._doCreate(b) | |
}; | |
ZmController.prototype._createTabGroup=function(a){a=a?a:this.toString(); | |
this._tabGroup=new DwtTabGroup(a); | |
return this._tabGroup | |
}; | |
ZmController.prototype._setTabGroup=function(a){this._tabGroup=a | |
}; | |
ZmController.prototype.getTabGroup=function(){return this._tabGroup | |
}; | |
ZmController.prototype.getNewFolderCallback=function(){if(!this._newFolderCb){this._newFolderCb=new AjxCallback(this,this._newFolderCallback) | |
}return this._newFolderCb | |
}; | |
ZmController.prototype._saveFocus=function(){var b=appCtxt.getRootTabGroup().getFocusMember(); | |
var a=this.getTabGroup(); | |
this._savedFocusMember=(b&&a&&a.contains(b))?b:null; | |
return this._savedFocusMember | |
}; | |
ZmController.prototype._restoreFocus=function(f,h){var d=appCtxt.getRootTabGroup(); | |
var c=appCtxt.getCurrentApp(); | |
var g=c&&c.getOverviewId(); | |
var e=g&&appCtxt.getOverviewController().getOverview(g); | |
if(d&&e&&(e!=ZmController._currentOverview)){var b=ZmController._currentOverview&&ZmController._currentOverview.getTabGroupMember(); | |
d.replaceMember(b,e.getTabGroupMember(),false,false,null,true); | |
ZmController._currentOverview=e | |
}var a=this.getTabGroup(); | |
f=f||this._savedFocusMember||this._getDefaultFocusItem()||d.getFocusMember(); | |
h=h||ZmController.noFocus; | |
ZmController.noFocus=false; | |
if(d&&a&&(a!=ZmController._currentAppViewTabGroup)){d.replaceMember(ZmController._currentAppViewTabGroup,a,false,false,f,h); | |
ZmController._currentAppViewTabGroup=a | |
}else{if(f&&!h){appCtxt.getKeyboardMgr().grabFocus(f) | |
}}}; | |
ZmController.prototype._getDefaultFocusItem=function(){var a=this.getTabGroup(); | |
return a?a.getFirstMember(true):null | |
}; | |
ZmController.prototype._preUnloadCallback=function(){return true | |
}; | |
ZmController.prototype._postHideCallback=function(){return true | |
}; | |
ZmController.prototype._postRemoveCallback=function(){return true | |
}; | |
ZmController.prototype._preShowCallback=function(){return true | |
}; | |
ZmController.prototype._preHideCallback=function(){this._saveFocus(); | |
return true | |
}; | |
ZmController.prototype._postShowCallback=function(){this._restoreFocus(); | |
return true | |
}; | |
ZmController.prototype._handleError=function(b,a){this._handleException(b,a) | |
}; | |
ZmController.prototype._handleException=function(d,b){if(d.code==AjxSoapException.INVALID_PDU){d.code=ZmCsfeException.SVC_FAILURE; | |
d.detail=["contact your administrator (",d.msg,")"].join(""); | |
d.msg="Service failure" | |
}if(d.code==ZmCsfeException.SVC_AUTH_EXPIRED||d.code==ZmCsfeException.SVC_AUTH_REQUIRED||d.code==ZmCsfeException.NO_AUTH_TOKEN){ZmCsfeCommand.noAuth=true; | |
ZmZimbraMail.logOff(null,true); | |
return | |
}if(d.code==ZmCsfeException.MAIL_NO_SUCH_MSG){var a=appCtxt.getCurrentViewId(); | |
if(a==ZmId.VIEW_CONVLIST||a==ZmId.VIEW_TRAD){var e=appCtxt.getApp(ZmApp.MAIL); | |
var g=appCtxt.isOffline?new AjxCallback(this,this._handleMailSearch,e):null; | |
e.mailSearch(null,g); | |
return | |
}}if(d.method!=="NoOpRequest"){var c; | |
if(d.code===ZmCsfeException.MAIL_NO_SUCH_ITEM){c=d.data.itemId | |
}else{if(d.code===ZmCsfeException.MAIL_SEND_FAILURE){c=d.code | |
}else{if(d.code===ZmCsfeException.MAIL_INVALID_NAME){c=d.data.name | |
}else{if(d.code===ZmCsfeException.SVC_UNKNOWN_DOCUMENT){c=d.msg.split(": ")[1] | |
}}}}if(d.lineNumber&&!d.detail){ZmController.handleScriptError(d) | |
}else{var f; | |
if(b&&b.restUri&&b.restUri.indexOf("zimbraim")!==-1){f=ZmMsg.chatXMPPError | |
}else{f=d.getErrorMsg?d.getErrorMsg(c):d.msg||d.message | |
}this.popupErrorDialog(f,d,true,this._hideSendReportBtn(d)) | |
}}}; | |
ZmController.prototype._handleMailSearch=function(a){if(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)){a.getOverviewContainer().highlightAllMboxes() | |
}}; | |
ZmController.prototype._hideSendReportBtn=function(a){return(a.code==ZmCsfeException.MAIL_TOO_MANY_TERMS||a.code==ZmCsfeException.MAIL_MAINTENANCE_MODE||a.code==ZmCsfeException.MAIL_MESSAGE_TOO_BIG||a.code==ZmCsfeException.NETWORK_ERROR||a.code==ZmCsfeException.EMPTY_RESPONSE||a.code==ZmCsfeException.BAD_JSON_RESPONSE||a.code==ZmCsfeException.TOO_MANY_TAGS||a.code==ZmCsfeException.OFFLINE_ONLINE_ONLY_OP) | |
}; | |
ZmController.prototype._errorDialogCallback=function(){appCtxt.getErrorDialog().popdown() | |
}; | |
ZmController.showDialog=function(a,d,c,b){a.reset(b); | |
a.registerCallback(DwtDialog.OK_BUTTON,d); | |
a.popup(c,b) | |
}; | |
ZmController.prototype._clearDialog=function(a){a.popdown(); | |
this._pendingActionData=null | |
}; | |
ZmController.prototype._menuPopdownActionListener=function(){}; | |
ZmController.prototype.isTransient=function(a,b){return false | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmBaseController")){ZmBaseController=function(a,e,b,d,c){if(arguments.length==0){return | |
}ZmController.apply(this,arguments); | |
this.setSessionId(d,b||this.getDefaultViewType(),c); | |
this._view={}; | |
this._toolbar={}; | |
this._tabGroups={}; | |
this._tagList=appCtxt.getTagTree(); | |
if(this._tagList){this._boundTagChangeListener=this._tagChangeListener.bind(this); | |
this._tagList.addChangeListener(this._boundTagChangeListener) | |
}this._listeners={}; | |
this._listeners[ZmOperation.NEW_MENU]=this._newListener.bind(this); | |
this._listeners[ZmOperation.TAG_MENU]=this._tagButtonListener.bind(this); | |
this._listeners[ZmOperation.MOVE_MENU]=this._moveButtonListener.bind(this); | |
this._listeners[ZmOperation.ACTIONS_MENU]=this._actionsButtonListener.bind(this); | |
this._listeners[ZmOperation.TAG]=this._tagListener.bind(this); | |
this._listeners[ZmOperation.PRINT]=this._printListener.bind(this); | |
this._listeners[ZmOperation.DELETE]=this._deleteListener.bind(this); | |
this._listeners[ZmOperation.DELETE_WITHOUT_SHORTCUT]=this._deleteListener.bind(this); | |
this._listeners[ZmOperation.CLOSE]=this._backListener.bind(this); | |
this._listeners[ZmOperation.MOVE]=this._moveListener.bind(this); | |
this._listeners[ZmOperation.SEARCH]=this._searchListener.bind(this); | |
this._listeners[ZmOperation.NEW_MESSAGE]=this._composeListener.bind(this); | |
this._listeners[ZmOperation.CONTACT]=this._contactListener.bind(this); | |
this._listeners[ZmOperation.VIEW]=this._viewMenuItemListener.bind(this); | |
this._listeners[ZmOperation.GO_TO_URL]=this._goToUrlListener.bind(this); | |
if(window.ZmImApp){this._listeners[ZmOperation.IM]=ZmImApp.getImMenuItemListener() | |
}this.operationsToEnableOnZeroSelection=[ZmOperation.NEW_MENU]; | |
this.operationsToEnableOnMultiSelection=[ZmOperation.NEW_MENU,ZmOperation.TAG_MENU,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.MOVE_MENU,ZmOperation.FORWARD,ZmOperation.ACTIONS_MENU]; | |
this.operationsToDisableOnSingleSelection=[] | |
}; | |
ZmBaseController.prototype=new ZmController; | |
ZmBaseController.prototype.constructor=ZmBaseController; | |
ZmBaseController.prototype.isZmBaseController=true; | |
ZmBaseController.prototype.toString=function(){return"ZmBaseController" | |
}; | |
ZmBaseController.prototype.setSessionId=function(c,a,b){ZmController.prototype.setSessionId.apply(this,arguments); | |
this.searchResultsController=b; | |
this.isSearchResults=Boolean(b) | |
}; | |
ZmBaseController.prototype.getCurrentView=function(){return this._view[this._currentViewId] | |
}; | |
ZmBaseController.prototype.getItemView=function(){return null | |
}; | |
ZmBaseController.prototype.getCurrentToolbar=function(){return this._toolbar[this._currentViewId] | |
}; | |
ZmBaseController.prototype.getItems=function(){}; | |
ZmBaseController.prototype.getItemCount=function(){}; | |
ZmBaseController.prototype.handleKeyAction=function(b,d){var c=appCtxt.isExternalAccount(); | |
switch(b){case ZmKeyMap.MOVE:if(c){break | |
}var a=this.getItems(); | |
if(a&&a.length){this._moveListener() | |
}break; | |
case ZmKeyMap.PRINT:if(appCtxt.get(ZmSetting.PRINT_ENABLED)&&!appCtxt.isWebClientOffline()){this._printListener() | |
}break; | |
case ZmKeyMap.TAG:if(c){break | |
}var a=this.getItems(); | |
if(a&&a.length&&(appCtxt.getTagTree().size()>0)){var e=appCtxt.getPickTagDialog(); | |
ZmController.showDialog(e,new AjxCallback(this,this._tagSelectionCallback,[a,e])) | |
}break; | |
case ZmKeyMap.UNTAG:if(c){break | |
}if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){var a=this.getItems(); | |
if(a&&a.length){this._doRemoveAllTags(a) | |
}}break; | |
default:return ZmController.prototype.handleKeyAction.apply(this,arguments) | |
}return true | |
}; | |
ZmBaseController.prototype.isCurrent=function(){return(this._currentViewId==appCtxt.getCurrentViewId()) | |
}; | |
ZmBaseController.prototype.supportsDnD=function(){return !appCtxt.isExternalAccount() | |
}; | |
ZmBaseController.prototype._createNewView=function(){}; | |
ZmBaseController.prototype._setViewContents=function(a){}; | |
ZmBaseController.prototype._getTagMenuMsg=function(a){}; | |
ZmBaseController.prototype._getMoveDialogTitle=function(a){}; | |
ZmBaseController.prototype._getToolBarOps=function(){}; | |
ZmBaseController.prototype._getSecondaryToolBarOps=function(){}; | |
ZmBaseController.prototype._getRightSideToolBarOps=function(){}; | |
ZmBaseController.prototype._setup=function(a){this._initialize(a); | |
this._resetOperations(this._toolbar[a],0) | |
}; | |
ZmBaseController.prototype._initialize=function(a){this._initializeToolBar(a); | |
this._initializeView(a); | |
this._initializeTabGroup(a) | |
}; | |
ZmBaseController.prototype._standardToolBarOps=function(){return[ZmOperation.DELETE,ZmOperation.MOVE_MENU,ZmOperation.PRINT] | |
}; | |
ZmBaseController.prototype._initializeToolBar=function(j,g){if(this._toolbar[j]){return | |
}var h=this._getToolBarOps(); | |
var b=this._getSecondaryToolBarOps()||[]; | |
var m=this._getRightSideToolBarOps()||[]; | |
if(!(h||b)){return | |
}var k={parent:this._container,buttons:h,secondaryButtons:b,rightSideButtons:m,overrides:this._getButtonOverrides(h.concat(b).concat(m)),context:j,controller:this,refElementId:ZmId.SKIN_APP_TOP_TOOLBAR,addTextElement:true,className:g}; | |
var c=this._toolbar[j]=new ZmButtonToolBar(k); | |
var l=c.getButton(ZmOperation.TEXT); | |
if(l){l.addClassName("itemCountText") | |
}var e; | |
for(var d=0; | |
d<c.opList.length; | |
d++){e=c.opList[d]; | |
if(this._listeners[e]){c.addSelectionListener(e,this._listeners[e]) | |
}}e=c.getButton(ZmOperation.TAG_MENU); | |
if(e){e.noMenuBar=true; | |
this._setupTagMenu(c) | |
}e=c.getButton(ZmOperation.MOVE_MENU); | |
if(e){e.noMenuBar=true; | |
this._setupMoveMenu(c) | |
}var f=c.getActionsButton(); | |
if(f){f.addDropDownSelectionListener(this._listeners[ZmOperation.ACTIONS_MENU]) | |
}var a=c.getActionsMenu(); | |
if(a){this._setSearchMenu(a,true) | |
}appCtxt.notifyZimlets("initializeToolbar",[this._app,c,this,j],{waitUntilLoaded:true}) | |
}; | |
ZmBaseController.prototype._getButtonOverrides=function(a){}; | |
ZmBaseController.prototype._initializeView=function(a){if(this._view[a]){return | |
}this._view[a]=this._createNewView(a); | |
this._view[a].addSelectionListener(this._listSelectionListener.bind(this)); | |
this._view[a].addActionListener(this._listActionListener.bind(this)) | |
}; | |
ZmBaseController.prototype._initializeListView=ZmBaseController.prototype._initializeView; | |
ZmBaseController.prototype._initializeTabGroup=function(a){if(this._tabGroups[a]){return | |
}this._tabGroups[a]=this._createTabGroup(); | |
this._tabGroups[a].newParent(appCtxt.getRootTabGroup()); | |
this._tabGroups[a].addMember(this._toolbar[a].getTabGroupMember()); | |
this._tabGroups[a].addMember(this._view[a].getTabGroupMember()) | |
}; | |
ZmBaseController.prototype._setView=function(c){var a=c.view; | |
if(!this._appViews[a]){var b={}; | |
b[ZmAppViewMgr.CB_PRE_HIDE]=this._preHideCallback.bind(this); | |
b[ZmAppViewMgr.CB_PRE_UNLOAD]=this._preUnloadCallback.bind(this); | |
b[ZmAppViewMgr.CB_POST_HIDE]=this._postHideCallback.bind(this); | |
b[ZmAppViewMgr.CB_POST_REMOVE]=this._postRemoveCallback.bind(this); | |
b[ZmAppViewMgr.CB_PRE_SHOW]=this._preShowCallback.bind(this); | |
b[ZmAppViewMgr.CB_POST_SHOW]=this._postShowCallback.bind(this); | |
c.callbacks=b; | |
c.viewId=a; | |
c.controller=this; | |
this._app.createView(c); | |
this._appViews[a]=true | |
}if(!c.pushOnly){this._setViewContents(a) | |
}if(c.stageView){this._app.stageView(a) | |
}else{if(!c.noPush){return(c.clear?this._app.setView(a):this._app.pushView(a)) | |
}}}; | |
ZmBaseController.prototype._tagButtonListener=function(b){var a=this._toolbar[this._currentViewId]; | |
if(b.item.parent==a){this._setTagMenu(a) | |
}}; | |
ZmBaseController.prototype._moveButtonListener=function(d,e){this._pendingActionData=e||this.getItems(); | |
var c=this._toolbar[this._currentViewId]; | |
var a=c.getOp(ZmOperation.MOVE_MENU); | |
if(!a){return | |
}if(!this._moveButtonInitialized){this._moveButtonInitialized=true; | |
appCtxt.getShell().setBusy(true); | |
this._setMoveButton(a); | |
appCtxt.getShell().setBusy(false) | |
}else{this._folderChooser.updateData(this._getMoveParams(this._folderChooser).data) | |
}var b=this._folderChooser._getNewButton(); | |
if(b){b.setVisible(!appCtxt.isWebClientOffline()) | |
}a.popup(); | |
a.getMenu().getHtmlElement().style.width="auto"; | |
this._folderChooser.focus() | |
}; | |
ZmBaseController.prototype._actionsButtonListener=function(a){var b=this.getCurrentToolbar().getActionsMenu(); | |
b.parent.popup() | |
}; | |
ZmBaseController.prototype._tagListener=function(c,a){if(this.isCurrent()){var b=c.item; | |
var f=b.getData(ZmTagMenu.KEY_TAG_EVENT); | |
var e=b.getData(ZmTagMenu.KEY_TAG_ADDED); | |
a=a||this.getItems(); | |
if(f==ZmEvent.E_TAGS&&e){this._doTag(a,b.getData(Dwt.KEY_OBJECT),true) | |
}else{if(f==ZmEvent.E_CREATE){this._pendingActionData=a; | |
var d=appCtxt.getNewTagDialog(); | |
if(!this._newTagCb){this._newTagCb=new AjxCallback(this,this._newTagCallback) | |
}ZmController.showDialog(d,this._newTagCb); | |
d.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,d) | |
}else{if(f==ZmEvent.E_TAGS&&!e){this._doTag(a,b.getData(Dwt.KEY_OBJECT),false) | |
}else{if(f==ZmEvent.E_REMOVE_ALL){this._doRemoveAllTags(a) | |
}}}}}}; | |
ZmBaseController.prototype._tagSelectionCallback=function(b,c,a){if(a){this._doTag(b,a,true) | |
}c.popdown() | |
}; | |
ZmBaseController.prototype._printListener=function(b){var a=this.getItems(); | |
if(a&&a[0]){window.open(a[0].getRestUrl(),"_blank") | |
}}; | |
ZmBaseController.prototype._backListener=function(a){this._app.popView() | |
}; | |
ZmBaseController.prototype._deleteListener=function(a){this._doDelete(this.getItems(),a.shiftKey) | |
}; | |
ZmBaseController.prototype._moveListener=function(a,c){this._pendingActionData=c||this.getItems(); | |
var b=appCtxt.getChooseFolderDialog(); | |
if(!this._moveCb){this._moveCb=new AjxCallback(this,this._moveCallback) | |
}ZmController.showDialog(b,this._moveCb,this._getMoveParams(b)); | |
b.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,b) | |
}; | |
ZmBaseController.prototype._getMoveParams=function(a){var b=ZmApp.ORGANIZER[this._app._name]||ZmOrganizer.FOLDER; | |
return{overviewId:a.getOverviewId(this._app._name),data:this._pendingActionData,treeIds:[b],title:this._getMoveDialogTitle(this._pendingActionData.length,this._pendingActionData),description:ZmMsg.targetFolder,treeStyle:DwtTree.SINGLE_STYLE,noRootSelect:true,appName:this._app._name} | |
}; | |
ZmBaseController.prototype._viewMenuItemListener=function(a){if(a.detail==DwtMenuItem.CHECKED||a.detail==DwtMenuItem.UNCHECKED){this.switchView(a.item.getData(ZmOperation.MENUITEM_ID)) | |
}}; | |
ZmBaseController.prototype._tagChangeListener=function(b){if(this.isCurrent()){if(b.type==ZmEvent.S_TAG&&b.event==ZmEvent.E_CREATE&&this._pendingActionData){var a=b.getDetail("organizers")[0]; | |
this._doTag(this._pendingActionData,a,true); | |
this._pendingActionData=null; | |
this._menuPopdownActionListener() | |
}}}; | |
ZmBaseController.prototype._moveCallback=function(a){this._doMove(this._pendingActionData,a); | |
this._clearDialog(appCtxt.getChooseFolderDialog()); | |
this._pendingActionData=null | |
}; | |
ZmBaseController.prototype._moveMenuCallback=function(a,b){this._doMove(this._pendingActionData,b); | |
a.getMenu().popdown(); | |
this._pendingActionData=null | |
}; | |
ZmBaseController.prototype._getList=function(a){a=AjxUtil.toArray(a); | |
var b=a[0]; | |
return b&&b.list | |
}; | |
ZmBaseController.prototype._getAllDoneCallback=function(){}; | |
ZmBaseController.showSummary=function(c,f,e){if(!c){return | |
}var a=e?parentAppCtxt:appCtxt; | |
var d=a.getActionController(); | |
var b=f&&d&&d.getUndoLink(f); | |
if(b&&d){d.onPopup(); | |
a.setStatusMsg({msg:c+b,transitions:d.getStatusTransitions()}) | |
}else{a.setStatusMsg(c) | |
}}; | |
ZmBaseController.prototype._doFlag=function(c,b){c=AjxUtil.toArray(c); | |
if(!c.length){return | |
}if(c[0].isZmItem){if(b!==true&&b!==false){b=!c[0].isFlagged | |
}var a=[]; | |
for(var d=0; | |
d<c.length; | |
d++){if(c[d].isFlagged!=b){a.push(c[d]) | |
}}}else{a=c | |
}var f={items:a,op:"flag",value:b}; | |
f.actionTextKey=b?"actionFlag":"actionUnflag"; | |
var e=f.list=this._getList(f.items); | |
this._setupContinuation(this._doFlag,[b],f); | |
e.flagItems(f) | |
}; | |
ZmBaseController.prototype._doMsgPriority=function(c,b){c=AjxUtil.toArray(c); | |
if(!c.length){return | |
}if(c[0].isZmItem){if(b!==true&&b!==false){b=!c[0].isPriority | |
}var a=[]; | |
for(var d=0; | |
d<c.length; | |
d++){if(c[d].isPriority!=b){a.push(c[d]) | |
}}}else{a=c | |
}var f={items:a,op:"priority",value:b}; | |
f.actionTextKey=b?"actionMsgPriority":"actionUnMsgPriority"; | |
var e=f.list=this._getList(f.items); | |
this._setupContinuation(this._doMsgPriority,[b],f); | |
e.flagItems(f) | |
}; | |
ZmBaseController.prototype._doTag=function(b,a,f){b=AjxUtil.toArray(b); | |
if(!b.length){return | |
}for(var c=0; | |
c<b.length; | |
c++){if(b[c].cloneOf){b[c]=b[c].cloneOf | |
}}var e={items:b,tag:a,doTag:f}; | |
var d=e.list=this._getList(e.items); | |
this._setupContinuation(this._doTag,[a,f],e); | |
d.tagItems(e) | |
}; | |
ZmBaseController.prototype._doRemoveAllTags=function(a){a=AjxUtil.toArray(a); | |
if(!a.length){return | |
}for(var b=0; | |
b<a.length; | |
b++){if(a[b].cloneOf){a[b]=a[b].cloneOf | |
}}var d={items:a}; | |
var c=d.list=this._getList(d.items); | |
this._setupContinuation(this._doRemoveAllTags,null,d); | |
c.removeAllTags(d) | |
}; | |
ZmBaseController.prototype._doDelete=function(j,g,l,d){j=AjxUtil.toArray(j); | |
if(!j.length){return | |
}var b=this._getSearchFolder(); | |
var k=(b&&b.nId==ZmFolder.ID_TRASH); | |
if(k){g=true | |
}var e={items:j,hardDelete:g,attrs:l,childWin:appCtxt.isChildWindow&&window,closeChildWin:appCtxt.isChildWindow,confirmDelete:d}; | |
var m=this._getAllDoneCallback(); | |
var h=e.list=this._getList(e.items); | |
this._setupContinuation(this._doDelete,[g,l,true],e,m); | |
if(!g){var a=false; | |
for(var f=0,c=j.length; | |
f<c; | |
f++){if(j[f]&&j[f].isScheduled){a=true; | |
break | |
}}if(a){e.noUndo=true; | |
this._popupScheduledWarningDialog(h.deleteItems.bind(h,e)) | |
}else{h.deleteItems(e) | |
}}else{h.deleteItems(e) | |
}}; | |
ZmBaseController.prototype._doMove=function(m,c,o,j,e){m=AjxUtil.toArray(m); | |
if(!m.length){return | |
}var f=[]; | |
var b=[]; | |
if(m[0].isZmItem){for(var h=0; | |
h<m.length; | |
h++){var p=m[h]; | |
if(!p.folderId||(p.folderId!=c.id||(o&&o.op=="recover"))){if(!this._isItemMovable(p,j,c)){b.push(p) | |
}else{f.push(p) | |
}}}}else{f=m | |
}var g={folder:c,attrs:o,noUndo:e}; | |
g.errorCallback=this._actionErrorCallback.bind(this); | |
var r=this._getAllDoneCallback(); | |
if(f.length){g.items=f; | |
var l=g.list=this._getList(g.items); | |
this._setupContinuation(this._doMove,[c,o,j],g,r); | |
if(c.isInTrash()){var a=false; | |
var n=AjxUtil.toArray(f); | |
for(var h=0,d=n.length; | |
h<d; | |
h++){if(n[h]&&n[h].isScheduled){a=true; | |
break | |
}}if(a){g.noUndo=true; | |
this._popupScheduledWarningDialog(l.moveItems.bind(l,g)) | |
}else{l.moveItems(g) | |
}}else{if(c.id==appCtxt.get(ZmSetting.MAIL_ACTIVITYSTREAM_FOLDER)&&m.length==1){l.moveItems(g); | |
var q=appCtxt.getActivityStreamFilterDialog(); | |
q.setFields(m[0]); | |
q.popup() | |
}else{if(m.length==1&&c.id==ZmFolder.ID_INBOX){l.moveItems(g); | |
var k=appCtxt.getById(m[0].folderId); | |
if(k&&k.id==appCtxt.get(ZmSetting.MAIL_ACTIVITYSTREAM_FOLDER)){var q=appCtxt.getActivityToInboxFilterDialog(); | |
q.setFields(m[0]); | |
q.popup() | |
}}else{l.moveItems(g) | |
}}}}if(b.length){g.items=b; | |
var l=g.list=this._getList(g.items); | |
this._setupContinuation(this._doMove,[c,o,j],g,r,true); | |
l.copyItems(g) | |
}}; | |
ZmBaseController.prototype._actionErrorCallback=function(a){return false | |
}; | |
ZmBaseController.prototype._popupScheduledWarningDialog=function(b){var a=appCtxt.getOkCancelMsgDialog(); | |
a.reset(); | |
a.setMessage(ZmMsg.moveScheduledMessageWarning,DwtMessageDialog.WARNING_STYLE); | |
a.registerCallback(DwtDialog.OK_BUTTON,this._scheduledWarningDialogListener.bind(this,b,a)); | |
a.associateEnterWithButton(DwtDialog.OK_BUTTON); | |
a.popup(null,DwtDialog.OK_BUTTON) | |
}; | |
ZmBaseController.prototype._scheduledWarningDialogListener=function(b,a){a.popdown(); | |
b() | |
}; | |
ZmBaseController.prototype._isItemMovable=function(c,a,b){return(!a&&!c.isReadOnly()&&!b.isReadOnly()) | |
}; | |
ZmBaseController.prototype._doModify=function(b,a){var c=this._getList(b); | |
c.modifyItem(b,a) | |
}; | |
ZmBaseController.prototype._doCreate=function(b,a){b.create(a) | |
}; | |
ZmBaseController.prototype._setupTagMenu=function(b,c){if(!b){return | |
}var d=b.getTagMenu(); | |
c=c||this._listeners[ZmOperation.TAG]; | |
if(d){d.addSelectionListener(c) | |
}if(b.isZmButtonToolBar){var a=b.getOp(ZmOperation.TAG_MENU); | |
if(a){a.addDropDownSelectionListener(this._listeners[ZmOperation.TAG_MENU]) | |
}}}; | |
ZmBaseController.prototype._setupMoveMenu=function(b){if(!b){return | |
}if(!b.isZmButtonToolBar){return | |
}var a=b.getOp(ZmOperation.MOVE_MENU); | |
if(a){a.addDropDownSelectionListener(this._listeners[ZmOperation.MOVE_MENU]) | |
}}; | |
ZmBaseController.prototype._setTagMenu=function(e,b){if(!e){return | |
}var d=e.getOp(ZmOperation.TAG_MENU); | |
if(d){var g=e.getTagMenu(); | |
if(!g){return | |
}b=b||AjxUtil.toArray(this.getItems()); | |
for(var c=0; | |
c<b.length; | |
c++){if(b[c].cloneOf){b[c]=b[c].cloneOf | |
}}var f=(appCtxt.multiAccounts&&b.length==1)?b[0].getAccount():null; | |
g.set(b,appCtxt.getTagTree(f)); | |
if(e.isZmActionMenu){d.setText(this._getTagMenuMsg(b.length,b)) | |
}else{g.parent.popup(); | |
if(appCtxt.isChildWindow||appCtxt.isWebClientOffline()){var a=g.getMenuItem(ZmTagMenu.MENU_ITEM_ADD_ID); | |
if(a){a.setVisible(false) | |
}}}}}; | |
ZmBaseController.prototype._setMoveButton=function(a){var d=new DwtMenu({parent:a,style:DwtMenu.CALENDAR_PICKER_STYLE,id:"ZmMoveButton_"+this.getCurrentViewId()}); | |
d.getHtmlElement().style.width="auto"; | |
a.setMenu(d,true); | |
var b=this._folderChooser=new ZmFolderChooser({parent:d}); | |
var c=this._getMoveParams(b); | |
c.overviewId+=this._currentViewId; | |
b.setupFolderChooser(c,this._moveMenuCallback.bind(this,a)); | |
return a | |
}; | |
ZmBaseController.prototype._resetOperations=function(b,a){if(!b){return | |
}if(a==0){b.enableAll(false); | |
b.enable(this.operationsToEnableOnZeroSelection,true) | |
}else{if(a==1){b.enableAll(true); | |
b.enable(this.operationsToDisableOnSingleSelection,false) | |
}else{if(a>1){b.enableAll(false); | |
b.enable(this.operationsToEnableOnMultiSelection,true) | |
}}}var c=(a>0)&&this._getSearchFolder(); | |
if(c&&c.isReadOnly()){b.enable(ZmOperation.TAG_MENU,false) | |
}}; | |
ZmBaseController.prototype._resetOperation=function(b,a,c){}; | |
ZmBaseController.prototype._resetToolbarOperations=function(){this._resetOperations(this._toolbar[this._currentViewId],this.getItemCount()) | |
}; | |
ZmBaseController.prototype._getDefaultFocusItem=function(){return this.getCurrentView() | |
}; | |
ZmBaseController.prototype._setupContinuation=function(b,a,d,c){d.finalCallback=this._continueAction.bind(this,{allDoneCallback:c}) | |
}; | |
ZmBaseController.prototype._continueAction=function(a){if(a.allDoneCallback){a.allDoneCallback() | |
}ZmBaseController.showSummary(a.actionSummary,a.actionLogItem,a.closeChildWin) | |
}; | |
ZmBaseController.prototype._bubbleSelectionListener=function(c){this._actionEv=c; | |
var b=c.item; | |
if(c.detail===DwtEvent.ONDBLCLICK){this._actionEv.bubble=b; | |
this._actionEv.address=b.addrObj||b.address; | |
this._composeListener(c) | |
}else{var a=this.getItemView(),d=a&&a._bubbleList; | |
if(d&&d.selectAddressText){d.selectAddressText() | |
}}}; | |
ZmBaseController.prototype._bubbleActionListener=function(c,e){this._actionEv=c; | |
var b=this._actionEv.bubble=c.item,a=this._actionEv.address=e||b.addrObj||b.address,d=this._getBubbleActionMenu(); | |
if(d){d.enable([ZmOperation.CONTACT,ZmOperation.ADD_TO_FILTER_RULE],!appCtxt.isWebClientOffline()); | |
this._loadContactForMenu(d,a,c) | |
}}; | |
ZmBaseController.prototype._getBubbleActionMenu=function(){if(this._bubbleActionMenu){return this._bubbleActionMenu | |
}var b=this._getBubbleActionMenuOps(); | |
var e=this._bubbleActionMenu=new ZmActionMenu({parent:this._shell,menuItems:b,controller:this,id:ZmId.create({componentType:ZmId.WIDGET_MENU,componentName:this._currentViewId,app:this._app})}); | |
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){this._setSearchMenu(e,false) | |
}if(appCtxt.get(ZmSetting.FILTERS_ENABLED)&&this._setAddToFilterMenu){this._setAddToFilterMenu(e) | |
}e.addPopdownListener(this._bubbleMenuPopdownListener.bind(this)); | |
for(var a=0; | |
a<b.length; | |
a++){var c=b[a]; | |
if(this._listeners[c]){e.addSelectionListener(c,this._listeners[c]) | |
}}e.setVisible(true); | |
var d=appCtxt.getClipboard(); | |
if(d){d.init(e.getOp(ZmOperation.COPY),{onMouseDown:this._clipCopy.bind(this),onComplete:this._clipCopyComplete.bind(this)}) | |
}return e | |
}; | |
ZmBaseController.prototype._getBubbleActionMenuOps=function(){var a=[]; | |
if(AjxClipboard.isSupported()){a.push(ZmOperation.COPY) | |
}a.push(ZmOperation.SEARCH_MENU); | |
a.push(ZmOperation.NEW_MESSAGE); | |
a.push(ZmOperation.CONTACT); | |
a.push(ZmOperation.GO_TO_URL); | |
if(appCtxt.get(ZmSetting.FILTERS_ENABLED)&&this._filterListener){a.push(ZmOperation.ADD_TO_FILTER_RULE) | |
}return a | |
}; | |
ZmBaseController.prototype._clipCopy=function(a){a.setText(this._actionEv.address+AjxEmailAddress.SEPARATOR) | |
}; | |
ZmBaseController.prototype._clipCopyComplete=function(a){this._bubbleActionMenu.popdown() | |
}; | |
ZmBaseController.prototype._bubbleMenuPopdownListener=function(){var b=this.getItemView(),c=b&&b._bubbleList,a=this._actionEv&&this._actionEv.bubble; | |
if(c){c.clearRightSelection(); | |
if(a){a.setClassName(c._normalClass) | |
}}this._actionEv.bubble=null | |
}; | |
ZmBaseController.prototype._dlAddrSelected=function(a,b){this._actionEv.address=a; | |
this._composeListener(b) | |
}; | |
ZmBaseController.prototype._loadContactForMenu=function(b,h,f,a){var j=window.parentAppCtxt||appCtxt; | |
var g=j.getApp(ZmApp.CONTACTS),h=h.isAjxEmailAddress?h:new AjxEmailAddress(h),e=h.getAddress(); | |
if(!e){return | |
}var d=g.getContactByEmail(e); | |
if(d){this._handleResponseGetContact(b,h,f,a,d); | |
return | |
}var c=b.getOp(ZmOperation.CONTACT); | |
if(c){c.setText(ZmMsg.loading) | |
}if(a){if(ZmImApp.updateImMenuItemByAddress(a,h,false)){a.setText(ZmMsg.loading) | |
}else{a=null | |
}}b.popup(0,f.docX||f.item.getXW(),f.docY||f.item.getYH()); | |
var i=this._handleResponseGetContact.bind(this,b,h,f,a); | |
g.getContactByEmail(e,i) | |
}; | |
ZmBaseController.prototype._handleResponseGetContact=function(e,b,d,c,a){this._actionEv.contact=a; | |
this._setContactText(a,e); | |
if(c){if(a){ZmImApp.updateImMenuItemByContact(c,a,b) | |
}else{ZmImApp.handleResponseGetContact(c,b,true) | |
}}e.popup(0,d.docX||d.item.getXW(),d.docY||d.item.getYH()) | |
}; | |
ZmBaseController.prototype._setContactText=function(a,b){ZmBaseController.setContactTextOnMenu(a,b||this._actionMenu) | |
}; | |
ZmBaseController.setContactTextOnMenu=function(a,d){if(!d){return | |
}var b=ZmOperation.EDIT_CONTACT; | |
var c=null; | |
if(a&&a.isDistributionList()){c=ZmMsg.AB_EDIT_DL | |
}else{if(a&&a.isGroup()){c=ZmMsg.AB_EDIT_GROUP | |
}else{if(!a||a.isGal){c=ZmMsg.AB_ADD_CONTACT; | |
b=ZmOperation.NEW_CONTACT | |
}}}ZmOperation.setOperation(d,ZmOperation.CONTACT,b,c); | |
if(appCtxt.isWebClientOffline()){d.enable(ZmOperation.CONTACT,false) | |
}}; | |
ZmBaseController.prototype._setSearchMenu=function(a,c){var b=a&&a.getSearchMenu&&a.getSearchMenu(); | |
if(!b){return | |
}b.addSelectionListener(ZmOperation.SEARCH,this._searchListener.bind(this,AjxEmailAddress.FROM,c)); | |
b.addSelectionListener(ZmOperation.SEARCH_TO,this._searchListener.bind(this,AjxEmailAddress.TO,c)); | |
if(this.getSearchFromText()){b.getMenuItem(ZmOperation.SEARCH).setText(this.getSearchFromText()) | |
}if(this.getSearchToText()){b.getMenuItem(ZmOperation.SEARCH_TO).setText(this.getSearchToText()) | |
}}; | |
ZmBaseController.prototype._searchListener=function(g,c,h){var b=this._getSearchFolder(),k=this._actionEv.item,i=this._actionEv.address,a; | |
if(k&&k.isZmMailMsg&&b&&b.isOutbound()){var d=k.getAddresses(AjxEmailAddress.TO).getArray(),e=k.getAddresses(AjxEmailAddress.CC).getArray(); | |
a=d.concat(e) | |
}else{if(i){a=i.isAjxEmailAddress?i.getAddress():i | |
}}if(a){var j=window.parentAppCtxt||window.appCtxt; | |
var f=j.getSearchController(); | |
if(g===AjxEmailAddress.FROM){f.fromSearch(a) | |
}else{if(g===AjxEmailAddress.TO){f.toSearch(a) | |
}}}}; | |
ZmBaseController.prototype._composeListener=function(b,c){var c=c||(this._actionEv&&this._actionEv.address),a=c&&c.toString(); | |
if(a){AjxDispatcher.run("Compose",{action:ZmOperation.NEW_MESSAGE,inNewWindow:this._app._inNewWindow(b),toOverride:a+AjxEmailAddress.SEPARATOR}) | |
}}; | |
ZmBaseController.prototype._contactListener=function(b){var a=this._handleLoadContactListener.bind(this); | |
AjxDispatcher.require(["ContactsCore","Contacts"],false,a,null,true) | |
}; | |
ZmBaseController.prototype._handleLoadContactListener=function(){var d=appCtxt.isChildWindow?window.parentAppCtxt.getApp(ZmApp.CONTACTS).getContactController():AjxDispatcher.run("GetContactController"); | |
var a=this._actionEv.contact; | |
if(a){if(a.isDistributionList()){this._editListener(this._actionEv,a); | |
return | |
}if(a.isLoaded){var b=a.isGal; | |
d.show(a,b) | |
}else{var c=this._loadContactCallback.bind(this); | |
a.load(c) | |
}}else{var a=d._createNewContact(this._actionEv); | |
d.show(a,true) | |
}if(appCtxt.isChildWindow){window.close() | |
}}; | |
ZmBaseController.prototype.getSearchFromText=function(){return null | |
}; | |
ZmBaseController.prototype.getSearchToText=function(){return null | |
}; | |
ZmBaseController.prototype._createNewContact=function(b){var a=new ZmContact(null); | |
a.initFromEmail(b.address); | |
return a | |
}; | |
ZmBaseController.prototype._loadContactCallback=function(b,a){AjxDispatcher.run("GetContactController").show(a) | |
}; | |
ZmBaseController.prototype._getSearchFolder=function(){var a=this._getSearchFolderId(); | |
return a&&appCtxt.getById(a) | |
}; | |
ZmBaseController.prototype._getSearchFolderId=function(a){var b=this._activeSearch&&this._activeSearch.search; | |
return b&&(a||b.isSimple())&&b.folderId | |
}; | |
ZmBaseController.prototype._goToUrlListener=function(c){var f=this._getAddress(this._actionEv.address); | |
var e=f.split("@"); | |
if(!e.length){return | |
}var d=e[1]; | |
var b=d.split("."); | |
var a="http://"+(b.length<=2?"www."+d:d); | |
window.open(a,"_blank") | |
}; | |
ZmBaseController.prototype._getAddress=function(a){return a.isAjxEmailAddress?a.address:a | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmListController")){ZmListController=function(a,e,b,d,c){if(arguments.length==0){return | |
}ZmBaseController.apply(this,arguments); | |
this._navToolBar={}; | |
this._listView=this._view; | |
this._list=null; | |
this._activeSearch=null; | |
this._newButton=null; | |
this._actionMenu=null; | |
this._actionEv=null; | |
this._lastSelectedListItem=null; | |
if(this.supportsDnD()){this._dropTgt=new DwtDropTarget("ZmTag"); | |
this._dropTgt.markAsMultiple(); | |
this._dropTgt.addDropListener(this._dropListener.bind(this)) | |
}this._menuPopdownListener=this._menuPopdownActionListener.bind(this); | |
this._itemCountText={}; | |
this._continuation={count:0,totalItems:0} | |
}; | |
ZmListController.prototype=new ZmBaseController; | |
ZmListController.prototype.constructor=ZmListController; | |
ZmListController.prototype.isZmListController=true; | |
ZmListController.prototype.toString=function(){return"ZmListController" | |
}; | |
ZmListController.CONTINUATION_SEARCH_ITEMS=500; | |
ZmListController.PROGRESS_DIALOG_INIT="INIT"; | |
ZmListController.PROGRESS_DIALOG_UPDATE="UPDATE"; | |
ZmListController.PROGRESS_DIALOG_CLOSE="CLOSE"; | |
ZmListController.prototype.show=function(a){this._activeSearch=a; | |
if(a){this._currentSearch=a.search; | |
this._activeSearch.viewId=this._currentSearch.viewId=this._currentViewId | |
}this.currentPage=1; | |
this.maxPage=1 | |
}; | |
ZmListController.prototype.getListView=function(){return this._view[this._currentViewId] | |
}; | |
ZmListController.prototype.getCurrentSearchResults=function(){return this._activeSearch | |
}; | |
ZmListController.prototype.getSearchString=function(){return this._currentSearch?this._currentSearch.query:"" | |
}; | |
ZmListController.prototype.setSearchString=function(a){this._currentSearch.query=a | |
}; | |
ZmListController.prototype.getSearchStringHint=function(){return this._currentSearch?this._currentSearch.queryHint:"" | |
}; | |
ZmListController.prototype.getSelection=function(a){a=a||this.getListView(); | |
return a?a.getSelection():[] | |
}; | |
ZmListController.prototype.getSelectionCount=function(a){a=a||this.getListView(); | |
return a?a.getSelectionCount():0 | |
}; | |
ZmListController.prototype.getList=function(){return this._list | |
}; | |
ZmListController.prototype.setList=function(a){if(a!=this._list&&a.isZmList){if(this._list){this._list.clear() | |
}this._list=a; | |
this._list.controller=this | |
}}; | |
ZmListController.prototype.setHasMore=function(a){if(a&&this._list){this._list.setHasMore(a); | |
this._resetNavToolBarButtons() | |
}}; | |
ZmListController.prototype.getItems=function(){return this.getSelection() | |
}; | |
ZmListController.prototype.getItemCount=function(){return this.getSelectionCount() | |
}; | |
ZmListController.prototype.handleKeyAction=function(e,f){var g=this._view[this._currentViewId]; | |
var i=false; | |
var a=document.activeElement; | |
switch(e){case DwtKeyMap.DBLCLICK:if(a&&a.nodeName&&a.nodeName.toLowerCase()==="a"){return false | |
}return g.handleKeyAction(e); | |
case ZmKeyMap.SHIFT_DEL:case ZmKeyMap.DEL:var c=this.getCurrentToolbar(); | |
var d=c&&(c.getButton(ZmOperation.DELETE)||c.getButton(ZmOperation.DELETE_MENU)); | |
if(d&&d.getEnabled()){this._doDelete(this.getSelection(),(e==ZmKeyMap.SHIFT_DEL)); | |
i=true | |
}break; | |
case ZmKeyMap.NEXT_PAGE:var b=this._navToolBar[this._currentViewId]; | |
var d=b?b.getButton(ZmOperation.PAGE_FORWARD):null; | |
if(d&&d.getEnabled()){this._paginate(this._currentViewId,true); | |
i=true | |
}break; | |
case ZmKeyMap.PREV_PAGE:var b=this._navToolBar[this._currentViewId]; | |
var d=b?b.getButton(ZmOperation.PAGE_BACK):null; | |
if(d&&d.getEnabled()){this._paginate(this._currentViewId,false); | |
i=true | |
}break; | |
case ZmKeyMap.CANCEL:var h=this.isSearchResults&&this.searchResultsController; | |
if(h){h._closeListener() | |
}break; | |
default:return ZmBaseController.prototype.handleKeyAction.apply(this,arguments) | |
}return i | |
}; | |
ZmListController.prototype._getActionMenuOps=function(){}; | |
ZmListController.prototype._standardActionMenuOps=function(){return[ZmOperation.TAG_MENU,ZmOperation.MOVE,ZmOperation.PRINT] | |
}; | |
ZmListController.prototype._participantOps=function(){var a=[ZmOperation.SEARCH_MENU]; | |
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){a.push(ZmOperation.NEW_MESSAGE) | |
}if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){a.push(ZmOperation.CONTACT) | |
}return a | |
}; | |
ZmListController.prototype._initializeActionMenu=function(){if(this._actionMenu){return | |
}var a=this._getActionMenuOps(); | |
if(!a){return | |
}var b={parent:this._shell,menuItems:a,context:this._getMenuContext(),controller:this}; | |
this._actionMenu=new ZmActionMenu(b); | |
this._addMenuListeners(this._actionMenu); | |
if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){this._setupTagMenu(this._actionMenu) | |
}}; | |
ZmListController.prototype._initializeTabGroup=function(b){if(this._tabGroups[b]){return | |
}ZmBaseController.prototype._initializeTabGroup.apply(this,arguments); | |
var a=this._navToolBar[b]; | |
if(a){this._tabGroups[b].addMember(a.getTabGroupMember()) | |
}}; | |
ZmListController.prototype.getTabGroup=function(){return this._tabGroups[this._currentViewId] | |
}; | |
ZmListController.prototype._addMenuListeners=function(d){var b=d.opList; | |
for(var a=0; | |
a<b.length; | |
a++){var c=b[a]; | |
if(this._listeners[c]){d.addSelectionListener(c,this._listeners[c],0) | |
}}d.addPopdownListener(this._menuPopdownListener) | |
}; | |
ZmListController.prototype._menuPopdownActionListener=function(c){var a=this.getListView(); | |
if(!this._pendingActionData){if(a&&a.handleActionPopdown){a.handleActionPopdown(c) | |
}}var b=a?a.getSelectionCount():-1; | |
if(b<=1){this._setItemCountText() | |
}}; | |
ZmListController.prototype._listSelectionListener=function(a){if(a.field==ZmItem.F_FLAG){this._doFlag([a.item]); | |
return true | |
}else{var b=this._listView[this._currentViewId]; | |
if(b){if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)&&!a.ctrlKey){if(b.setSelectionHdrCbox){b.setSelectionHdrCbox(false) | |
}}this._resetOperations(this.getCurrentToolbar(),b.getSelectionCount()); | |
if(a.shiftKey){this._setItemSelectionCountText() | |
}else{this._setItemCountText() | |
}}}return false | |
}; | |
ZmListController.prototype._listActionListener=function(a){this._actionEv=a; | |
var b=this.getActionMenu(); | |
if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){this._setTagMenu(b) | |
}if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){this._setSearchMenu(b) | |
}this._resetOperations(b,this.getSelectionCount()); | |
this._setItemSelectionCountText() | |
}; | |
ZmListController.prototype._navBarListener=function(a){if(!this.isCurrent()){return | |
}var b=a.item.getData(ZmOperation.KEY_ID); | |
if(b==ZmOperation.PAGE_BACK||b==ZmOperation.PAGE_FORWARD){this._paginate(this._currentViewId,(b==ZmOperation.PAGE_FORWARD)) | |
}}; | |
ZmListController.prototype._dragListener=function(a){if(this.isSearchResults&&a.action==DwtDragEvent.DRAG_START){this.searchResultsController.showOverview(true) | |
}else{if(a.action==DwtDragEvent.SET_DATA){a.srcData={data:a.srcControl.getDnDSelection(),controller:this} | |
}else{if(this.isSearchResults&&(a.action==DwtDragEvent.DRAG_END||a.action==DwtDragEvent.DRAG_CANCEL)){this.searchResultsController.showOverview(false) | |
}}}}; | |
ZmListController.prototype._dropListener=function(g){var h=this._view[this._currentViewId]; | |
var a=h.getTargetItemDiv(g.uiEvent); | |
var j=h.getItemFromElement(a); | |
var d=g.srcData.data; | |
if(g.action==DwtDropEvent.DRAG_ENTER){g.doIt=(j&&(j instanceof ZmItem)&&!j.isReadOnly()&&this._dropTgt.isValidTarget(d)); | |
if(appCtxt.multiAccounts){var i=j?j.getAccount().id:null; | |
var e=(d.account&&d.account.id)||d[0].account.id; | |
if(i!=e){g.doIt=false | |
}}if(g.doIt){h.dragSelect(a) | |
}}else{if(g.action==DwtDropEvent.DRAG_DROP){h.dragDeselect(a); | |
var f=[j]; | |
var b=this.getSelection(); | |
if(b.length){var c=AjxVector.fromArray(b); | |
if(c.contains(j)){f=b | |
}}this._doTag(f,d,true) | |
}else{if(g.action==DwtDropEvent.DRAG_LEAVE){h.dragDeselect(a) | |
}else{if(g.action==DwtDropEvent.DRAG_OP_CHANGED){}}}}}; | |
ZmListController.prototype.isDraftsFolder=function(){var a=this._getSearchFolder(); | |
if(!a){return false | |
}return a.nId==ZmFolder.ID_DRAFTS | |
}; | |
ZmListController.prototype.isOutboxFolder=function(){var a=this._getSearchFolder(); | |
if(!a){return false | |
}return a.nId==ZmFolder.ID_OUTBOX | |
}; | |
ZmListController.prototype.isSyncFailuresFolder=function(){var a=this._getSearchFolder(); | |
if(!a){return false | |
}return a.nId==ZmFolder.ID_SYNC_FAILURES | |
}; | |
ZmListController.prototype._getList=function(a){var b=ZmBaseController.prototype._getList.apply(this,arguments); | |
if(!b){b=this._list | |
}return b | |
}; | |
ZmListController.prototype._getAllDoneCallback=function(){return this._checkItemCount.bind(this) | |
}; | |
ZmListController.handleProgress=function(b){var a=appCtxt.getCancelMsgDialog(); | |
if(b.state==ZmListController.PROGRESS_DIALOG_INIT){a.reset(); | |
a.registerCallback(DwtDialog.CANCEL_BUTTON,b.callback); | |
ZmListController.progressDialogReady=true | |
}else{if(b.state==ZmListController.PROGRESS_DIALOG_UPDATE&&ZmListController.progressDialogReady){a.setMessage(b.summary,DwtMessageDialog.INFO_STYLE,AjxMessageFormat.format(ZmMsg.inProgress)); | |
if(!a.isPoppedUp()){a.popup() | |
}}else{if(b.state==ZmListController.PROGRESS_DIALOG_CLOSE){a.unregisterCallback(DwtDialog.CANCEL_BUTTON); | |
a.popdown(); | |
ZmListController.progressDialogReady=false | |
}}}}; | |
ZmListController.prototype._cacheList=function(a,c){if(this._list){var b=a.getResults().getVector(); | |
c=c?c:parseInt(a.getAttribute("offset")); | |
this._list.cache(c,b) | |
}else{this._list=a.getResults(type) | |
}}; | |
ZmListController.prototype._search=function(h,e,d,i,a,b,g){var f=this._activeSearch&&this._activeSearch.search; | |
var c={query:this.getSearchString(),queryHint:this.getSearchStringHint(),types:f&&f.types||[],userInitiated:f&&f.userInitiated,sortBy:appCtxt.get(ZmSetting.SORTING_PREF,h),offset:e,limit:d,lastId:b,lastSortVal:g}; | |
this._getMoreSearchParams(c); | |
var j=new ZmSearch(c); | |
if(a){this._currentSearch=j | |
}appCtxt.getSearchController().redoSearch(j,true,null,i) | |
}; | |
ZmListController.prototype._paginate=function(j,g,f,d){var c=false; | |
var b=this._view[j]; | |
if(!b){return | |
}var e,k; | |
d=d||b.getLimit(e); | |
if(b._isPageless){e=this._list.size(); | |
c=true | |
}else{e=b.getNewOffset(g); | |
c=(e+d>this._list.size()); | |
this.currentPage=this.currentPage+(g?1:-1); | |
this.maxPage=Math.max(this.maxPage,this.currentPage) | |
}if(c&&this._list.hasMore()){b.offset=e; | |
if(b._isPageless){k=d | |
}else{var m=(e+d)-this._list.size(); | |
k=m<d&&m>0?m:d; | |
if(k<d){e=((e+d)-k)+1 | |
}}if(this._searchPending){return false | |
}var i=b.getList(); | |
var l=i&&i.getLast(); | |
var h=(l&&l.id)?l.sf:null; | |
var a=h?l.id:null; | |
this._setItemCountText(ZmMsg.loading); | |
this._searchPending=true; | |
var n=this._handleResponsePaginate.bind(this,j,false,f,e); | |
this._search(j,e,k,n,true,a,h); | |
return false | |
}else{if(!b._isPageless){b.offset=e; | |
this._resetOperations(this._toolbar[j],0); | |
this._resetNavToolBarButtons(j); | |
this._setViewContents(j); | |
this._resetSelection(); | |
return true | |
}}}; | |
ZmListController.prototype._handleResponsePaginate=function(n,d,g,f,p,a){var k=p.getResponse(); | |
this._list.setHasMore(k.getAttribute("more")); | |
this._cacheList(k,f); | |
var c=this._view[this._currentViewId]; | |
var j=c._isPageless?this.getSelectionCount():0; | |
this._resetOperations(this._toolbar[n],j); | |
var b=d?this.getSelection()[0]:null; | |
var e=b?c.getItemIndex(b):-1; | |
var m=k&&k.getResults().getArray(); | |
if(c._isPageless&&m&&m.length){c._itemsToAdd=m | |
}else{c._itemsToAdd=null | |
}var o=(c._isPageless&&(c.size()==0)); | |
this._setViewContents(n); | |
if(c.allSelected){for(var h=0,l=m.length; | |
h<l; | |
h++){c.selectItem(m[h],true); | |
c.setSelectionCbox(m[h],false) | |
}c.setSelectionHdrCbox(true) | |
}this._resetNavToolBarButtons(n); | |
if(!a&&!c._isPageless){this._resetSelection(e) | |
}else{if(o){c._setNextSelection() | |
}}this._searchPending=false | |
}; | |
ZmListController.prototype._getMoreSearchParams=function(a){}; | |
ZmListController.prototype._checkReplenish=function(e){var a=this.getListView(); | |
var d=a.getList(); | |
var b=false; | |
if(d){var c=a.getLimit()-a.size(); | |
if(c>a.getReplenishThreshold()){this._replenishList(this._currentViewId,c,e); | |
b=true | |
}}if(e&&!b){e.run() | |
}}; | |
ZmListController.prototype._handleEmptyList=function(a){if(this.currentPage>1){this._paginate(this._currentViewId,false,0) | |
}else{a.removeAll(true); | |
a._setNoResultsHtml(); | |
this._resetNavToolBarButtons(); | |
a._checkItemCount() | |
}}; | |
ZmListController.prototype._replenishList=function(g,c,h){var b=this._view[g].offset+this._view[g].size(); | |
var i=this._list.size(); | |
if(b<i){var f=(f>i)?i:(b+c); | |
var e=this._list.getVector().getArray(); | |
var d=e.slice(b,f); | |
var a=AjxVector.fromArray(d); | |
this._view[g].replenish(a); | |
if(h){h.run() | |
}}else{this._getMoreToReplenish(g,c,h) | |
}}; | |
ZmListController.prototype._resetSelection=function(b){var c=this.getListView().getList(); | |
if(c){var a=b>=0?b:0; | |
var d=c.get(a); | |
this._view[this._currentViewId].setSelection(d,false) | |
}}; | |
ZmListController.prototype._getMoreToReplenish=function(b,e,h){if(this._list.hasMore()){var d=this._view[b].getList(); | |
var c=d.getLast(); | |
var a=(c&&c.id)?c.sf:null; | |
var f=a?c.id:null; | |
var g=this._handleResponseGetMoreToReplenish.bind(this,b,h); | |
this._search(b,this._list.size(),e,g,false,f,a) | |
}else{if(h){h.run() | |
}}}; | |
ZmListController.prototype._handleResponseGetMoreToReplenish=function(c,f,b){var a=b.getResponse(); | |
var d=a.getAttribute("more"); | |
this._list.setHasMore(d); | |
this._cacheList(a); | |
var e=a.getResults().getVector(); | |
this._view[c].replenish(e); | |
this._toolbar[c].enable(ZmOperation.PAGE_FORWARD,d); | |
if(f){f.run(b) | |
}}; | |
ZmListController.prototype._initializeNavToolBar=function(b){var a=new ZmNavToolBar({parent:this._toolbar[b],context:b}); | |
this._setNavToolBar(a,b) | |
}; | |
ZmListController.prototype._setNavToolBar=function(b,a){this._navToolBar[a]=b; | |
if(this._navToolBar[a]){var c=this._navBarListener.bind(this); | |
this._navToolBar[a].addSelectionListener(ZmOperation.PAGE_BACK,c); | |
this._navToolBar[a].addSelectionListener(ZmOperation.PAGE_FORWARD,c) | |
}}; | |
ZmListController.prototype._resetNavToolBarButtons=function(a){var b; | |
if(a){b=this._view[a] | |
}else{b=this.getListView(); | |
a=this._currentViewId | |
}if(!b){return | |
}if(b._isPageless){this._setItemCountText() | |
}if(!this._navToolBar[a]){return | |
}this._navToolBar[a].enable(ZmOperation.PAGE_BACK,b.offset>0); | |
var c=false; | |
if(this._list){c=this._list.hasMore(); | |
if(!c&&((b.offset+b.getLimit())<this._list.size())){c=true | |
}}this._navToolBar[a].enable(ZmOperation.PAGE_FORWARD,c); | |
this._navToolBar[a].setText(this._getNavText(a)) | |
}; | |
ZmListController.prototype.enablePagination=function(b,a){if(!this._navToolBar[a]){return | |
}if(b){this._resetNavToolBarButtons(a) | |
}else{this._navToolBar[a].enable([ZmOperation.PAGE_BACK,ZmOperation.PAGE_FORWARD],false) | |
}}; | |
ZmListController.prototype._getNavText=function(b){var e=this._getNavStartEnd(b); | |
if(!e){return"" | |
}var c=e.size; | |
var h=""; | |
if(c===0){h=AjxMessageFormat.format(ZmMsg.navTextNoItems,ZmMsg[ZmApp.NAME[ZmApp.TASKS]]) | |
}else{if(c===1){h=AjxMessageFormat.format(ZmMsg.navTextOneItem,ZmMsg[ZmItem.MSG_KEY[ZmItem.TASK]]) | |
}else{var g=this._view[b]; | |
var a=e.limit; | |
if(c<a){h=AjxMessageFormat.format(ZmMsg.navTextWithTotal,[e.start,e.end,c]) | |
}else{var f=this._getUpperLimitSizeText(c); | |
var d=f?ZmMsg.navTextWithTotal:ZmMsg.navTextRange; | |
h=AjxMessageFormat.format(d,[e.start,e.end,f]) | |
}}}return h | |
}; | |
ZmListController.prototype._getNavStartEnd=function(c){var e=this._view[c]; | |
var b=e.getLimit(); | |
var d=this._list?this._list.size():0; | |
var f,a; | |
if(d>0){f=e.offset+1; | |
a=Math.min(e.offset+b,d) | |
}return(f&&a)?{start:f,end:a,size:d,limit:b}:null | |
}; | |
ZmListController.prototype._getNumTotal=function(){var a=this._getSearchFolderId(); | |
if(a&&(a!=ZmFolder.ID_TRASH)){var b=appCtxt.getById(a); | |
if(b){return b.numTotal | |
}}return null | |
}; | |
ZmListController.prototype.getActionMenu=function(){if(!this._actionMenu){this._initializeActionMenu(); | |
this._resetOperations(this._actionMenu,0) | |
}return this._actionMenu | |
}; | |
ZmListController.prototype._getMenuContext=function(){return this._app&&this._app._name | |
}; | |
ZmListController.prototype._getItemCountText=function(){var i=this._getItemCount(); | |
if(!i){return"" | |
}var b=this._view[this._currentViewId],f=b&&b._list,g=b._getItemCountType(),h=this._getNumTotal(),d=h||i,c="type"+AjxStringUtil.capitalizeFirstLetter(ZmItem.MSG_KEY[g]),e=g?AjxMessageFormat.format(ZmMsg[c],d):""; | |
if(h&&(i!=h)){return AjxMessageFormat.format(ZmMsg.itemCount1,[i,h,e]) | |
}else{var a=this._getUpperLimitSizeText(i); | |
return AjxMessageFormat.format(ZmMsg.itemCount,[a,e]) | |
}}; | |
ZmListController.prototype._getUpperLimitSizeText=function(a){var c=a; | |
if(this._list.hasMore()){var b=a<10?1:a<100?10:100; | |
c=(Math.floor(a/b))*b+"+" | |
}return c | |
}; | |
ZmListController.prototype._getItemCount=function(){var b=this.getListView(); | |
var a=b&&b._list; | |
if(!a){return 0 | |
}return a.size() | |
}; | |
ZmListController.prototype._setItemCountText=function(b){b=b||this._getItemCountText(); | |
var a=this._itemCountText[this._currentViewId]; | |
if(a){a.setText(b) | |
}}; | |
ZmListController.prototype._getItemSelectionCountText=function(){var f=this._view[this._currentViewId],d=f&&f._list,c=f._getItemCountType(),b=f.getSelectionCount(),a="type"+AjxStringUtil.capitalizeFirstLetter(ZmItem.MSG_KEY[c]),e=c?AjxMessageFormat.format(ZmMsg[a],b):""; | |
return b>0?AjxMessageFormat.format(ZmMsg.itemSelectionCount,[b,e]):"" | |
}; | |
ZmListController.prototype._setItemSelectionCountText=function(){this._setItemCountText(this._getItemSelectionCountText()) | |
}; | |
ZmListController.prototype._setupContinuation=function(c,b,e,d,f){var a=new AjxCallback(this,c,b); | |
e.finalCallback=this._continueAction.bind(this,{actionCallback:a,allDoneCallback:d,notIdsOnly:f}); | |
e.count=this._continuation.count; | |
e.idsOnly=!f; | |
if(!this._continuation.lastItem){this._continuation.lastItem=e.list.getVector().getLast(); | |
this._continuation.totalItems=e.list.size() | |
}}; | |
ZmListController.prototype._continueAction=function(d,b){var c=this._view[this._currentViewId]; | |
var f=b&&b.cancelled; | |
var m=this._continuation.result; | |
var a=m?m.getAttribute("more"):(this._list?this._list.hasMore():false); | |
if(c.allSelected&&a&&!f){var g=this._currentSearch; | |
var e=ZmListController.CONTINUATION_SEARCH_ITEMS; | |
var k={query:this.getSearchString(),queryHint:this.getSearchStringHint(),types:g.types,sortBy:g.sortBy,limit:e,idsOnly:!d.notIdsOnly}; | |
var h=m?m.getResults():this._list.getArray(); | |
var j=this._continuation.lastItem; | |
if(!j){j=h&&h[h.length-1] | |
}if(j){k.lastId=j.id; | |
k.lastSortVal=j.sf | |
}else{k.offset=e+(this._continuation.search?this._continuation.search.offset:0) | |
}this._continuation.count=b.numItems; | |
if(!this._continuation.totalItems){this._continuation.totalItems=h.length | |
}this._continuation.search=new ZmSearch(k); | |
var l=this._handleResponseContinueAction.bind(this,d.actionCallback); | |
appCtxt.getSearchController().redoSearch(this._continuation.search,true,null,l) | |
}else{if(m){if(c.allSelected){if(b.actionTextKey){var i=m.type; | |
if(i===ZmId.SEARCH_MAIL){i=this._list.type | |
}b.actionSummary=ZmList.getActionSummary({actionTextKey:b.actionTextKey,numItems:this._continuation.totalItems,type:i,actionArg:b.actionArg}) | |
}c.deselectAll() | |
}this._continuation={count:0,totalItems:0} | |
}if(d.allDoneCallback){d.allDoneCallback() | |
}ZmListController.handleProgress({state:ZmListController.PROGRESS_DIALOG_CLOSE}); | |
ZmBaseController.showSummary(b.actionSummary,b.actionLogItem,b.closeChildWin) | |
}}; | |
ZmListController.prototype._handleResponseContinueAction=function(b,a){this._continuation.result=a.getResponse(); | |
var c=this._continuation.result.getResults(); | |
if(c.isZmMailList){c=c.getArray() | |
}if(c.length){this._continuation.lastItem=c[c.length-1]; | |
this._continuation.totalItems+=c.length; | |
b.args=b.args||[]; | |
b.args.unshift(c); | |
b.run() | |
}else{}}; | |
ZmListController.prototype._checkItemCount=function(){var a=this._view[this._currentViewId]; | |
a._checkItemCount(); | |
a._handleResponseCheckReplenish(true) | |
}; | |
ZmListController.prototype.supportsSorting=function(){return true | |
}; | |
ZmListController.prototype.supportsGrouping=function(){return false | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmTreeController")){ZmTreeController=function(a){if(arguments.length==0){return | |
}ZmController.call(this,null); | |
this.type=a; | |
this._opc=appCtxt.getOverviewController(); | |
this._listeners={}; | |
this._listeners[ZmOperation.DELETE]=this._deleteListener.bind(this); | |
this._listeners[ZmOperation.DELETE_WITHOUT_SHORTCUT]=this._deleteListener.bind(this); | |
this._listeners[ZmOperation.MOVE]=this._moveListener.bind(this); | |
this._listeners[ZmOperation.EXPAND_ALL]=this._expandAllListener.bind(this); | |
this._listeners[ZmOperation.MARK_ALL_READ]=this._markAllReadListener.bind(this); | |
this._listeners[ZmOperation.SYNC]=this._syncListener.bind(this); | |
this._listeners[ZmOperation.SYNC_ALL]=this._syncAllListener.bind(this); | |
this._listeners[ZmOperation.EDIT_PROPS]=this._editPropsListener.bind(this); | |
this._listeners[ZmOperation.EMPTY_FOLDER]=this._emptyListener.bind(this); | |
this._listeners[ZmOperation.FIND_SHARES]=this._findSharesListener.bind(this); | |
this._listeners[ZmOperation.OPEN_IN_TAB]=this._openInTabListener.bind(this); | |
this._dragSrc=new DwtDragSource(Dwt.DND_DROP_MOVE); | |
this._dragSrc.addDragListener(this._dragListener.bind(this)); | |
this._dropTgt=new DwtDropTarget(ZmTreeController.DROP_SOURCES[a]); | |
this._dropTgt.addDropListener(this._dropListener.bind(this)); | |
this._treeView={}; | |
this._hideEmpty={}; | |
this._dataTree={}; | |
this._treeSelectionShortcutDelay=ZmTreeController.TREE_SELECTION_SHORTCUT_DELAY | |
}; | |
ZmTreeController.prototype=new ZmController; | |
ZmTreeController.prototype.constructor=ZmTreeController; | |
ZmTreeController.COLOR_CLASS={}; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_ORANGE]="OrangeBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_BLUE]="BlueBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_CYAN]="CyanBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_GREEN]="GreenBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_PURPLE]="PurpleBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_RED]="RedBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_YELLOW]="YellowBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_PINK]="PinkBg"; | |
ZmTreeController.COLOR_CLASS[ZmOrganizer.C_GRAY]="Gray"; | |
ZmTreeController.TREE_SELECTION_SHORTCUT_DELAY=750; | |
ZmTreeController.DROP_SOURCES={}; | |
ZmTreeController.EMPTY_FOLDER_RETRY_INTERVAL=5; | |
ZmTreeController.EMPTY_FOLDER_MAX_TRIALS=6; | |
ZmTreeController.prototype.resetOperations=function(){}; | |
ZmTreeController.prototype._getHeaderActionMenuOps=function(){}; | |
ZmTreeController.prototype._getActionMenuOps=function(){}; | |
ZmTreeController.prototype._getNewDialog=function(){}; | |
ZmTreeController.prototype._getRenameDialog=function(){}; | |
ZmTreeController.prototype._itemClicked=function(){}; | |
ZmTreeController.prototype._itemDblClicked=function(){}; | |
ZmTreeController.prototype._dropListener=function(){}; | |
ZmTreeController.prototype._getMoveDialogTitle=function(){}; | |
ZmTreeController.prototype._resetOperation=function(b,g,e,c,a,d){var f=b&&b.getOp(g); | |
if(!f){return | |
}if(e){f.setText(e) | |
}if(c){f.setImage(c) | |
}if(a!=null){f.setEnabled(a) | |
}if(d!=null){f.setVisible(d) | |
}}; | |
ZmTreeController.prototype._resetButtonPerSetting=function(c,d,b){var a=c.getOp(d); | |
if(a){if(b){a.setVisible(true); | |
if(appCtxt.isOffline&&!appCtxt.getActiveAccount().isZimbraAccount){a.setEnabled(false) | |
}}else{a.setVisible(false) | |
}}}; | |
ZmTreeController.prototype._enableRecoverDeleted=function(c,b){op=c.getOp(ZmOperation.RECOVER_DELETED_ITEMS); | |
if(!op){return | |
}var a=appCtxt.get(ZmSetting.DUMPSTER_ENABLED); | |
op.setVisible(a&&b); | |
op.setEnabled(b) | |
}; | |
ZmTreeController.prototype._findSharesListener=function(c){var b=this._getActionedOrganizer(c); | |
var e=b.getAccount(); | |
if(appCtxt.multiAccounts&&e&&e.isZimbraAccount){appCtxt.accountList.setActiveAccount(e) | |
}var a=appCtxt.getShareSearchDialog(); | |
var d=this._handleAddShare.bind(this); | |
a.popup(b.type,d) | |
}; | |
ZmTreeController.prototype._handleAddShare=function(){var c=appCtxt.getShareSearchDialog(); | |
var b=c.getShares(); | |
c.popdown(); | |
if(b.length===0){return | |
}AjxDispatcher.require("Share"); | |
var f=[]; | |
for(var a=0; | |
a<b.length; | |
a++){var d=b[a]; | |
f.push({_jsns:"urn:zimbraMail",link:{l:ZmOrganizer.ID_ROOT,name:d.defaultMountpointName,view:d.view,zid:d.ownerId,rid:d.folderId}}) | |
}var e={jsonObj:{BatchRequest:{_jsns:"urn:zimbra",CreateMountpointRequest:f}},asyncMode:true}; | |
appCtxt.getAppController().sendRequest(e) | |
}; | |
ZmTreeController.prototype._openInTabListener=function(a){this._itemClicked(this._getActionedOrganizer(a),true) | |
}; | |
ZmTreeController.prototype.toString=function(){return"ZmTreeController" | |
}; | |
ZmTreeController.prototype.show=function(f){var g=f.overviewId; | |
this._hideEmpty[g]=f.hideEmpty; | |
if(!this._treeView[g]||f.forceCreate){this._treeViewCreated=false; | |
this._treeView[g]=null; | |
this._treeView[g]=this.getTreeView(g,true) | |
}var a=(appCtxt.multiAccounts&&this.type==ZmOrganizer.ZIMLET); | |
var c=a?appCtxt.accountList.mainAccount:(this.type==ZmOrganizer.VOICE?g:f.account); | |
var d=this.getDataTree(c); | |
if(d){f.dataTree=d; | |
var b=ZmOrganizer.OPEN_SETTING[this.type]; | |
f.collapsed=(!a&&(!(!b||(appCtxt.get(b,null,c)!==false)))); | |
var e=this._opc.getOverview(g); | |
if(e&&e.showNewButtons&&this.type!=ZmOrganizer.ZIMLET&&this.type!=ZmId.ORG_PREF_PAGE){this._setupOptButton(f) | |
}this._treeView[g].set(f); | |
this._checkTreeView(g) | |
}if(!this._treeViewCreated){this._treeViewCreated=true; | |
this._postSetup(g,f.account) | |
}return this._treeView[g] | |
}; | |
ZmTreeController.prototype.getTreeView=function(b,a){if(a&&!this._treeView[b]){this._treeView[b]=this._setup(b) | |
}return this._treeView[b] | |
}; | |
ZmTreeController.prototype.clearTreeView=function(a){if(this._treeView[a]){this._treeView[a].dispose(); | |
delete this._treeView[a] | |
}}; | |
ZmTreeController.prototype.getDropTarget=function(){return this._dropTgt | |
}; | |
ZmTreeController.prototype.getDataTree=function(a){a=a||appCtxt.getActiveAccount(); | |
var b=this._dataTree[a.id]; | |
if(!b){b=this._dataTree[a.id]=appCtxt.getTree(this.type,a); | |
if(b){b.addChangeListener(this._getTreeChangeListener()) | |
}}return b | |
}; | |
ZmTreeController.prototype.dispose=function(){var a=appCtxt.getActiveAccount(); | |
var b=this._dataTree[a.id]; | |
if(!b){return | |
}b.removeChangeListener(this._getTreeChangeListener()) | |
}; | |
ZmTreeController.prototype.setVisibleIfExists=function(b,a,c){var d=b.getOp(a); | |
if(!d){return | |
}d.setVisible(c) | |
}; | |
ZmTreeController.prototype._setupOptButton=function(b){var a=ZmOperation.getProp(ZmOperation.OPTIONS,"tooltipKey"); | |
b.optButton={image:ZmOperation.getProp(ZmOperation.OPTIONS,"image"),tooltip:a?ZmMsg[a]:null,callback:new AjxCallback(this,this._dispOpts)} | |
}; | |
ZmTreeController.prototype._dispOpts=function(b){var d=b.dwtObj; | |
var a=d&&d.getData(ZmTreeView.KEY_TYPE); | |
if(!a){return | |
}var c=this._getHeaderActionMenu(b); | |
if(c){c.popup(0,b.docX,b.docY) | |
}}; | |
ZmTreeController.prototype._getTreeChangeListener=function(){if(!this._dataChangeListener){this._dataChangeListener=appCtxt.isChildWindow?AjxCallback.simpleClosure(this._treeChangeListener,this):new AjxListener(this,this._treeChangeListener) | |
}return this._dataChangeListener | |
}; | |
ZmTreeController.prototype._setup=function(b){var a=this._initializeTreeView(b); | |
if(this._opc.getOverview(b).actionSupported){this._initializeActionMenus() | |
}return a | |
}; | |
ZmTreeController.prototype._postSetup=function(g,f){var c=this.getTreeView(g); | |
if(!c.isCheckedStyle&&!ZmOrganizer.HAS_COLOR[this.type]){return | |
}var b=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,f); | |
var a=c.getTreeItemById(b); | |
if(!a){return | |
}if(c.isCheckedStyle){a.showCheckBox(false) | |
}var e=a.getItems(); | |
for(var d=0; | |
d<e.length; | |
d++){this._fixupTreeNode(e[d],null,c,true) | |
}}; | |
ZmTreeController.prototype._fixupTreeNode=function(f,a,b,d){if(f._isSeparator){return | |
}a=a||f.getData(Dwt.KEY_OBJECT); | |
if(a){if(ZmOrganizer.HAS_COLOR[this.type]){this._setTreeItemColor(f,a) | |
}if(b.isCheckedStyle){if((a.type==this.type&&b.isCheckedStyle)||a.nId==ZmOrganizer.ID_TRASH||a.nId==ZmOrganizer.ID_DRAFTS){f.setChecked(a.isChecked,true) | |
}else{f.showCheckBox(false); | |
f.enableSelection(true) | |
}}this._expandTreeItem(f,d) | |
}var e=f.getItems(); | |
for(var c=0; | |
c<e.length; | |
c++){this._fixupTreeNode(e[c],null,b,d) | |
}}; | |
ZmTreeController.prototype._expandTreeItem=function(e,c){var b=appCtxt.get(ZmSetting.FOLDERS_EXPANDED); | |
var a=e.getData(Dwt.KEY_ID); | |
var d=e.parent; | |
if(b[a]&&d&&(d instanceof DwtTreeItem)&&d.getExpanded()){e.setExpanded(true,null,c) | |
}}; | |
ZmTreeController.prototype._expandTreeItems=function(c){if(c._isSeparator){return | |
}this._expandTreeItem(c); | |
var b=c.getItems(); | |
for(var a=0; | |
a<b.length; | |
a++){this._expandTreeItems(b[a]) | |
}}; | |
ZmTreeController.prototype._setTreeItemColor=function(b,a){b.setImage(a.getIconWithColor()) | |
}; | |
ZmTreeController.prototype._getTreeItemColorClassName=function(c,a){if(!c||!a){return null | |
}if(a.isInTrash()){return null | |
}var b=a.color?a.color:ZmOrganizer.DEFAULT_COLOR[a.type]; | |
return(b&&(b!=ZmOrganizer.C_NONE))?ZmTreeController.COLOR_CLASS[b]:"" | |
}; | |
ZmTreeController.prototype._initializeTreeView=function(d){var c=this._opc.getOverview(d); | |
var b={parent:c,parentElement:c.getTreeParent(this.type),overviewId:d,type:this.type,headerClass:c.headerClass,dragSrc:(c.dndSupported?this._dragSrc:null),dropTgt:(c.dndSupported?this._dropTgt:null),treeStyle:c.treeStyle,isCheckedByDefault:c.isCheckedByDefault,allowedTypes:this._getAllowedTypes(),allowedSubTypes:this._getAllowedSubTypes()}; | |
b.id=ZmId.getTreeId(d,b.type); | |
if(b.type&&b.type.match(/TASK|ADDRBOOK|FOLDER|BRIEFCASE|CALENDAR|PREF_PAGE/)&&(!b.headerClass||b.headerClass=="overviewHeader")){b.headerClass="FirstOverviewHeader overviewHeader" | |
}var a=this._createTreeView(b); | |
a.addSelectionListener(new AjxListener(this,this._treeViewListener)); | |
a.addTreeListener(new AjxListener(this,this._treeListener)); | |
return a | |
}; | |
ZmTreeController.prototype._createTreeView=function(a){return new ZmTreeView(a) | |
}; | |
ZmTreeController.prototype._initializeActionMenus=function(){var d=this; | |
var c=this._createActionMenu; | |
var b=this._getHeaderActionMenuOps(); | |
if(!this._headerActionMenu&&b){var a=[this._shell,b]; | |
this._headerActionMenu=new AjxCallback(d,c,a) | |
}var b=this._getActionMenuOps(); | |
if(!this._actionMenu&&b){var a=[this._shell,b]; | |
this._actionMenu=new AjxCallback(d,c,a) | |
}}; | |
ZmTreeController.prototype._getHeaderActionMenu=function(a){if(this._headerActionMenu instanceof AjxCallback){var b=this._headerActionMenu; | |
this._headerActionMenu=b.run() | |
}return this._headerActionMenu | |
}; | |
ZmTreeController.prototype._getActionMenu=function(c,b){var a=this; | |
if(b&&b.type==ZmOrganizer.SEARCH){a=this._opc.getTreeController(ZmOrganizer.SEARCH) | |
}if(a._actionMenu instanceof AjxCallback){var d=a._actionMenu; | |
a._actionMenu=d.run() | |
}return a._actionMenu | |
}; | |
ZmTreeController.prototype._createActionMenu=function(d,b){if(!b){return | |
}var f=appCtxt.getCurrentController()&&appCtxt.getCurrentController().getKeyMapName(); | |
var g=f?("ZmActionMenu_"+f):Dwt.getNextId("ZmActionMenu_"); | |
g=(f&&this.type)?g+"_"+this.type:g; | |
var e=new ZmActionMenu({parent:d,menuItems:b,id:g}); | |
b=e.opList; | |
for(var a=0; | |
a<b.length; | |
a++){var c=b[a]; | |
if(this._listeners[c]){e.addSelectionListener(c,this._listeners[c]) | |
}}e.addPopdownListener(new AjxListener(this,this._menuPopdownActionListener)); | |
return e | |
}; | |
ZmTreeController.prototype._getAllowedTypes=function(){var a={}; | |
a[this.type]=true; | |
return a | |
}; | |
ZmTreeController.prototype._getAllowedSubTypes=function(){var a={}; | |
a[this.type]=true; | |
return a | |
}; | |
ZmTreeController.prototype._doCreate=function(params){params.type=this.type; | |
var funcName=ZmOrganizer.CREATE_FUNC[this.type]; | |
if(funcName){var func=eval(funcName); | |
return func(params) | |
}}; | |
ZmTreeController.prototype._doDelete=function(a){a._delete() | |
}; | |
ZmTreeController.prototype._doEmpty=function(a,g,e){var d=false; | |
var f=ZmTreeController.EMPTY_FOLDER_RETRY_INTERVAL; | |
var c=true; | |
if(!g){g=1 | |
}var b=this._doEmptyErrorHandler.bind(this,a,g); | |
a.empty(d,null,this._doEmptyHandler.bind(this,a),f,b,c) | |
}; | |
ZmTreeController.prototype._doEmptyErrorHandler=function(a,c,b){if(b){if(b.code==ZmCsfeException.SVC_ALREADY_IN_PROGRESS){appCtxt.setStatusMsg(ZmMsg.emptyFolderAlreadyInProgress); | |
return true | |
}else{if(b.code!=AjxException.CANCELED){return false | |
}}}if(c>ZmTreeController.EMPTY_FOLDER_MAX_TRIALS-1){appCtxt.setStatusMsg(ZmMsg.emptyFolderNoResponse,ZmStatusView.LEVEL_CRITICAL); | |
return true | |
}c++; | |
this._doEmpty(a,c) | |
}; | |
ZmTreeController.prototype._doEmptyHandler=function(b){appCtxt.setStatusMsg({msg:AjxMessageFormat.format(ZmMsg.folderEmptied,b.getName())}); | |
var a=appCtxt.getCurrentController(); | |
if(!a||!a._getSearchFolderId||!a.getListView){return | |
}var d=a._getSearchFolderId(); | |
if(d!==b.id){return | |
}var c=a.getListView(); | |
c._resetList(); | |
c._setNoResultsHtml() | |
}; | |
ZmTreeController.prototype._doRename=function(a,b){a.rename(b) | |
}; | |
ZmTreeController.prototype._doMove=function(a,b){a.move(b) | |
}; | |
ZmTreeController.prototype._doMarkAllRead=function(a){a.markAllRead() | |
}; | |
ZmTreeController.prototype._doSync=function(a){a.sync() | |
}; | |
ZmTreeController.prototype._treeViewListener=function(h){if(h.detail!==DwtTree.ITEM_ACTIONED&&h.detail!==DwtTree.ITEM_SELECTED&&h.detail!==DwtTree.ITEM_DBL_CLICKED){return | |
}var d=h.item; | |
var f=d.getData(ZmTreeView.KEY_TYPE); | |
if(!f){return | |
}var j=d.getData(Dwt.KEY_OBJECT); | |
if(j){this._actionedOrganizer=j; | |
if(j.noSuchFolder){var b=appCtxt.getFolderTree(); | |
if(b){b.handleDeleteNoSuchFolder(j) | |
}return | |
}if(j&&j.type===ZmOrganizer.SEARCH){var e=this._opc.getTreeController(ZmOrganizer.SEARCH); | |
if(e){e._actionedOrganizer=j; | |
e._actionedOverviewId=d.getData(ZmTreeView.KEY_ID) | |
}}}var a=d.getData(Dwt.KEY_ID); | |
var c=this._actionedOverviewId=d.getData(ZmTreeView.KEY_ID); | |
var i=this._opc.getOverview(c); | |
if(!i){return | |
}if(h.detail===DwtTree.ITEM_ACTIONED){if(i.actionSupported){var g=this.getItemActionMenu(h,j); | |
if(g){this.resetOperations(g,f,a); | |
g.popup(0,h.docX,h.docY) | |
}}}else{if((h.detail===DwtTree.ITEM_SELECTED)&&j){if(appCtxt.multiAccounts&&(j instanceof ZmOrganizer)){this._handleMultiAccountItemSelection(h,i,d,j) | |
}else{this._handleItemSelection(h,i,d,j) | |
}}else{if((h.detail===DwtTree.ITEM_DBL_CLICKED)&&j){this._itemDblClicked(j) | |
}}}}; | |
ZmTreeController.prototype.getItemActionMenu=function(b,a){var c=(a.nId==ZmOrganizer.ID_ROOT||a.isDataSource(ZmAccount.TYPE_IMAP))?this._getHeaderActionMenu(b):this._getActionMenu(b,a); | |
return c | |
}; | |
ZmTreeController.prototype._handleItemSelection=function(b,f,e,a){f.itemSelected(e); | |
if(b.kbNavEvent){Dwt.scrollIntoView(e._itemDiv,f.getHtmlElement()); | |
ZmController.noFocus=true | |
}if(f._treeSelectionShortcutDelayActionId){AjxTimedAction.cancelAction(f._treeSelectionShortcutDelayActionId) | |
}if((f.selectionSupported||a._showFoldersCallback)&&!e._isHeader){if(b.kbNavEvent){if(b.enter||this._treeSelectionShortcutDelay){var d=new AjxTimedAction(this,ZmTreeController.prototype._treeSelectionTimedAction,[a,f]); | |
f._treeSelectionShortcutDelayActionId=AjxTimedAction.scheduleAction(d,this._treeSelectionShortcutDelay) | |
}}else{if((appCtxt.multiAccounts&&(a instanceof ZmOrganizer))||(a.type==ZmOrganizer.VOICE)){appCtxt.getCurrentApp().getOverviewContainer().deselectAll(f); | |
var c=a.account||appCtxt.accountList.mainAccount; | |
appCtxt.accountList.setActiveAccount(c) | |
}this._itemSelected(a) | |
}}}; | |
ZmTreeController.prototype._itemSelected=function(a){if(a&&a._showFoldersCallback){a._showFoldersCallback.run() | |
}else{this._itemClicked(a) | |
}}; | |
ZmTreeController.prototype._handleMultiAccountItemSelection=function(b,d,c,a){this._handleItemSelection(b,d,c,a) | |
}; | |
ZmTreeController.prototype._treeSelectionTimedAction=function(a,b){if(b._treeSelectionShortcutDelayActionId){AjxTimedAction.cancelAction(b._treeSelectionShortcutDelayActionId) | |
}this._itemSelected(a) | |
}; | |
ZmTreeController.prototype._treeListener=function(g){var e=g&&g.item; | |
var c=e&&e._tree&&e._tree.overviewId; | |
var i=appCtxt.getOverviewController().getOverview(c); | |
var f=i.account; | |
if(appCtxt.multiAccounts&&f){appCtxt.accountList.setActiveAccount(f) | |
}var d=g.detail==DwtTree.ITEM_EXPANDED; | |
var a=(g.detail==DwtTree.ITEM_COLLAPSED||d)?e.getData(Dwt.KEY_ID):null; | |
if(a&&!e._isHeader){var h=appCtxt.get(ZmSetting.FOLDERS_EXPANDED,a)||false; | |
if(typeof(h)=="string"){h=(h==="true") | |
}if(!i.skipImplicit&&h!==d){appCtxt.set(ZmSetting.FOLDERS_EXPANDED,d,a) | |
}if(d){this._expandTreeItems(e) | |
}}if(!(g&&g.detail&&i&&i.isAppOverview&&e._isHeader)){return | |
}var b=appCtxt.getSettings(f); | |
var j=b.getSetting(ZmOrganizer.OPEN_SETTING[this.type]); | |
if(j){j.setValue(g.detail==DwtTree.ITEM_EXPANDED) | |
}}; | |
ZmTreeController.prototype._treeChangeListener=function(a){this._evHandled={}; | |
for(var b in this._treeView){this._changeListener(a,this._treeView[b],b) | |
}}; | |
ZmTreeController.prototype._changeListener=function(ev,treeView,overviewId){if(this._evHandled[overviewId]){return | |
}if(!treeView.allowedTypes[ev.type]&&!treeView.allowedSubTypes[ev.type]){return | |
}var organizers=ev.getDetail("organizers"); | |
if(!organizers&&ev.source){organizers=[ev.source] | |
}for(var i=0; | |
i<organizers.length; | |
i++){var organizer=organizers[i]; | |
var node=treeView.getTreeItemById(organizer.id); | |
if(!node&&(ev.event!=ZmEvent.E_CREATE)){continue | |
}var fields=ev.getDetail("fields"); | |
if(ev.event==ZmEvent.E_DELETE){if(organizer.nId==ZmFolder.ID_TRASH||organizer.nId==ZmFolder.ID_SPAM){node.setText(organizer.getName(false)) | |
}else{node.dispose() | |
}this._checkTreeView(overviewId); | |
this._evHandled[overviewId]=true | |
}else{if(ev.event==ZmEvent.E_CREATE||ev.event==ZmEvent.E_MOVE){if(appCtxt.multiAccounts){var overview=this._opc.getOverview(overviewId); | |
if(overview&&overview.account!=organizer.getAccount()){continue | |
}}var parentNode=this._getParentNode(organizer,ev,overviewId); | |
var idx=parentNode?ZmTreeView.getSortIndex(parentNode,organizer,eval(ZmTreeView.COMPARE_FUNC[organizer.type])):null; | |
if(parentNode&&(ev.event==ZmEvent.E_CREATE)){var type=((organizer.parent.nId==ZmOrganizer.ID_ROOT)||organizer.parent.isRemoteRoot())?ev.type:organizer.parent.type; | |
if(type!==this.type||!treeView._isAllowed(organizer.parent,organizer)){continue | |
}if(organizer.isOfflineGlobalSearch){appCtxt.getApp(ZmApp.MAIL).getOverviewContainer().addSearchFolder(organizer); | |
return | |
}else{node=this._addNew(treeView,parentNode,organizer,idx) | |
}this.createDataSource(organizer) | |
}else{if(ev.event==ZmEvent.E_MOVE){var selectedItem=treeView.getSelected(); | |
if(AjxUtil.isArray1(selectedItem)){selectedItem=null | |
}node.dispose(); | |
if(parentNode){node=this._addNew(treeView,parentNode,organizer,idx) | |
}if(!treeView.getSelected()&&selectedItem){treeView.setSelected(selectedItem.id,true,true) | |
}}}if(parentNode){parentNode.setExpanded(true); | |
this._fixupTreeNode(node,organizer,treeView) | |
}this._checkTreeView(overviewId); | |
this._evHandled[overviewId]=true | |
}else{if(ev.event==ZmEvent.E_MODIFY){if(!fields){return | |
}if(fields[ZmOrganizer.F_TOTAL]||fields[ZmOrganizer.F_SIZE]||fields[ZmOrganizer.F_UNREAD]||fields[ZmOrganizer.F_NAME]){node.setToolTipContent(organizer.getToolTip(true)); | |
if(appCtxt.multiAccounts&&organizer.type==ZmOrganizer.FOLDER){appCtxt.getApp(ZmApp.MAIL).getOverviewContainer().updateTooltip(organizer.nId) | |
}}if(fields[ZmOrganizer.F_NAME]||fields[ZmOrganizer.F_UNREAD]||fields[ZmOrganizer.F_FLAGS]||fields[ZmOrganizer.F_COLOR]||((organizer.nId==ZmFolder.ID_DRAFTS||organizer.rid==ZmFolder.ID_DRAFTS||organizer.nId==ZmOrganizer.ID_OUTBOX)&&fields[ZmOrganizer.F_TOTAL])){this._updateOverview({organizer:organizer,node:node,fields:fields,treeView:treeView,overviewId:overviewId,ev:ev}); | |
this._evHandled[overviewId]=true | |
}}}}}}; | |
ZmTreeController.prototype._updateOverview=function(params){var org=params.organizer,node=params.node,parentNode=this._getParentNode(org,params.ev,params.overviewId); | |
node.setText(org.getName(params.treeView._showUnread)); | |
if(params.fields&¶ms.fields[ZmOrganizer.F_NAME]){if(parentNode&&(parentNode.getNumChildren()>1)){var nodeSelected=node._selected; | |
node.dispose(); | |
var idx=ZmTreeView.getSortIndex(parentNode,org,eval(ZmTreeView.COMPARE_FUNC[org.type])); | |
node=params.treeView._addNew(parentNode,org,idx); | |
if(nodeSelected){params.treeView.setSelected(org,true) | |
}}else{node.setDndText(org.getName()) | |
}appCtxt.getAppViewMgr().updateTitle() | |
}if(params.fields[ZmOrganizer.F_UNREAD]){var parent=org.parent; | |
while(parent&&parentNode&&parent.nId!=ZmOrganizer.ID_ROOT){parentNode.setText(parent.getName(params.treeView._showUnread)); | |
parentNode=this._getParentNode(parent,params.ev,params.overviewId); | |
parent=parent.parent | |
}}this._fixupTreeNode(node,org,params.treeView) | |
}; | |
ZmTreeController.prototype._getParentNode=function(a,c,d){if(a.parent){var b=(a.parent.nId==ZmOrganizer.ID_ROOT)?c.type:null; | |
return this._opc.getOverview(d).getTreeItemById(a.parent.id,b) | |
}}; | |
ZmTreeController.prototype._addNew=function(d,c,b,a){return d._addNew(c,b,a) | |
}; | |
ZmTreeController.prototype._newListener=function(c,d){this._pendingActionData=this._getActionedOrganizer(c); | |
var b=this._getNewDialog(); | |
if(!this._newCb){this._newCb=new AjxCallback(this,this._newCallback) | |
}if(this._pendingActionData&&!appCtxt.getById(this._pendingActionData.id)){this._pendingActionData=appCtxt.getFolderTree(d).root | |
}if(!d&&appCtxt.multiAccounts){var a=this._opc.getOverview(this._actionedOverviewId); | |
d=a&&a.account | |
}ZmController.showDialog(b,this._newCb,this._pendingActionData,d); | |
b.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,b) | |
}; | |
ZmTreeController.prototype.createDataSource=function(a){}; | |
ZmTreeController.prototype._renameListener=function(a){this._pendingActionData=this._getActionedOrganizer(a); | |
var b=this._getRenameDialog(); | |
if(!this._renameCb){this._renameCb=new AjxCallback(this,this._renameCallback) | |
}ZmController.showDialog(b,this._renameCb,this._pendingActionData); | |
b.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,b) | |
}; | |
ZmTreeController.prototype._deleteListener=function(a){this._doDelete(this._getActionedOrganizer(a)) | |
}; | |
ZmTreeController.prototype._emptyListener=function(a){this._doEmpty(this._getActionedOrganizer(a)) | |
}; | |
ZmTreeController.prototype._moveListener=function(a){this._pendingActionData=this._getActionedOrganizer(a); | |
var b=appCtxt.getChooseFolderDialog(); | |
if(!this._moveCb){this._moveCb=new AjxCallback(this,this._moveCallback) | |
}ZmController.showDialog(b,this._moveCb,this._getMoveParams(b)); | |
b.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,b) | |
}; | |
ZmTreeController.prototype._getMoveParams=function(b){var a={}; | |
a[ZmFolder.ID_SPAM]=true; | |
return{data:this._pendingActionData,treeIds:[this.type],overviewId:b.getOverviewId(appCtxt.getCurrentAppName()+"_"+this.type),omit:a,title:AjxStringUtil.htmlEncode(this._getMoveDialogTitle()),description:ZmMsg.targetFolder,appName:ZmOrganizer.APP[this.type]} | |
}; | |
ZmTreeController.prototype._expandAllListener=function(d){var a=this._getActionedOrganizer(d); | |
var b=this.getTreeView(this._actionedOverviewId); | |
var c=b.getTreeItemById(a.id); | |
window.duringExpandAll=true; | |
c.setExpanded(true,true); | |
window.duringExpandAll=false; | |
if(window.afterExpandAllCallback){window.afterExpandAllCallback(); | |
window.afterExpandAllCallback=null | |
}}; | |
ZmTreeController.prototype._markAllReadListener=function(a){this._doMarkAllRead(this._getActionedOrganizer(a)) | |
}; | |
ZmTreeController.prototype._syncAllListener=function(g){for(var e in this._treeView){var d=this.getTreeView(e); | |
var h=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,appCtxt.getActiveAccount()); | |
var j=d.getTreeItemById(h); | |
var a=j&&j.getItems(); | |
if(a){for(var f=0; | |
f<a.length; | |
f++){var b=a[f]; | |
var c=b&&b.getData&&b.getData(Dwt.KEY_OBJECT); | |
if(c&&(c.isFeed()||c.hasFeeds())){this._syncFeeds(c) | |
}}}}}; | |
ZmTreeController.prototype._syncListener=function(a){this._syncFeeds(this._getActionedOrganizer(a)) | |
}; | |
ZmTreeController.prototype._syncFeeds=function(d){if(d.isFeed()){this._doSync(d) | |
}else{if(d.hasFeeds()){var b=d.children.getArray(); | |
var e=d.children.size(); | |
for(var c=0; | |
c<e; | |
c++){if(b[c].isFeed()||(b[c].hasFeeds&&b[c].hasFeeds())){this._syncFeeds(b[c]) | |
}}}}}; | |
ZmTreeController.prototype._editPropsListener=function(b){var a=appCtxt.getFolderPropsDialog(); | |
a.popup(this._getActionedOrganizer(b)) | |
}; | |
ZmTreeController.prototype._dragListener=function(a){switch(a.action){case DwtDragEvent.SET_DATA:a.srcData={data:a.srcControl.getData(Dwt.KEY_OBJECT),controller:this}; | |
break | |
}}; | |
ZmTreeController.prototype._menuPopdownActionListener=function(){if(this._pendingActionData){return | |
}var a=this.getTreeView(this._actionedOverviewId); | |
if(this._actionedOrganizer&&(a.getSelected()!=this._actionedOrganizer)){var b=a.getTreeItemById(this._actionedOrganizer.id); | |
if(b){b._setActioned(false) | |
}}}; | |
ZmTreeController.prototype._newCallback=function(a){this._doCreate(a); | |
this._clearDialog(this._getNewDialog()) | |
}; | |
ZmTreeController.prototype._renameCallback=function(a,b){this._doRename(a,b); | |
this._clearDialog(this._getRenameDialog()) | |
}; | |
ZmTreeController.prototype._moveCallback=function(a){this._doMove(this._pendingActionData,a); | |
this._clearDialog(appCtxt.getChooseFolderDialog()) | |
}; | |
ZmTreeController.prototype._deleteShieldYesCallback=function(a){this._doDelete(a); | |
this._clearDialog(this._deleteShield) | |
}; | |
ZmTreeController.prototype._emptyShieldYesCallback=function(a){this._doEmpty(a); | |
this._clearDialog(this._emptyShield) | |
}; | |
ZmTreeController.prototype._getEmptyShieldWarning=function(b){var a=this._pendingActionData=this._getActionedOrganizer(b); | |
var c=this._emptyShield=appCtxt.getOkCancelMsgDialog(); | |
c.reset(); | |
c.registerCallback(DwtDialog.OK_BUTTON,this._emptyShieldYesCallback,this,a); | |
c.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,this._emptyShield); | |
var e=(a.nId!=ZmFolder.ID_TRASH)?(AjxMessageFormat.format(ZmMsg.confirmEmptyFolder,a.getName())):ZmMsg.confirmEmptyTrashFolder; | |
c.setMessage(e,DwtMessageDialog.WARNING_STYLE); | |
var f=(a.nId==ZmFolder.ID_TRASH||a.nId==ZmFolder.ID_SPAM)?DwtDialog.OK_BUTTON:DwtDialog.CANCEL_BUTTON; | |
c.associateEnterWithButton(f); | |
c.popup(null,f); | |
if(!(a.nId==ZmFolder.ID_SPAM||a.isInTrash())){var d=c.getButton(DwtDialog.CANCEL_BUTTON); | |
d.focus() | |
}}; | |
ZmTreeController.prototype._getActionedOrganizer=function(a){if(this._actionedOrganizer){return this._actionedOrganizer | |
}var c=a.item; | |
while(c){var b=c.getData(Dwt.KEY_OBJECT); | |
if(b instanceof ZmOrganizer){this._actionedOrganizer=b; | |
return this._actionedOrganizer | |
}c=c.parent | |
}return null | |
}; | |
ZmTreeController.prototype._checkTreeView=function(d){if(!d||!this._treeView[d]){return | |
}var b=this._opc.getOverview(d).account; | |
var c=this.getDataTree(b); | |
var a=(ZmOrganizer.HIDE_EMPTY[this.type]&&c&&(c.size()==0)); | |
this._treeView[d].setVisible(!a) | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmTagTreeController")){ZmTagTreeController=function(){ZmTreeController.call(this,ZmOrganizer.TAG); | |
this._listeners[ZmOperation.NEW_TAG]=this._newListener.bind(this); | |
this._listeners[ZmOperation.RENAME_TAG]=this._renameListener.bind(this); | |
this._listeners[ZmOperation.TAG_COLOR_MENU]=this._colorListener.bind(this) | |
}; | |
ZmTagTreeController.prototype=new ZmTreeController; | |
ZmTagTreeController.prototype.constructor=ZmTagTreeController; | |
ZmTagTreeController.prototype.isZmTagTreeController=true; | |
ZmTagTreeController.prototype.toString=function(){return"ZmTagTreeController" | |
}; | |
ZmTagTreeController.prototype._getActionMenu=function(){var b=ZmTreeController.prototype._getActionMenu.call(this); | |
if(b&&!b._initialized){var a=b.getMenuItem(ZmOperation.TAG_COLOR_MENU); | |
if(a){a.getMenu().addSelectionListener(this._listeners[ZmOperation.TAG_COLOR_MENU]) | |
}b._initialized=true | |
}return b | |
}; | |
ZmTagTreeController.prototype.resetOperations=function(c,b,d){var a=appCtxt.getById(d); | |
c.enableAll(true); | |
if(a.isSystem()){c.enable([ZmOperation.RENAME_TAG,ZmOperation.TAG_COLOR_MENU,ZmOperation.DELETE_WITHOUT_SHORTCUT],false) | |
}c.enable(ZmOperation.MARK_ALL_READ,(a&&(a.numUnread>0))) | |
}; | |
ZmTagTreeController.prototype._getHeaderActionMenuOps=function(){return[ZmOperation.NEW_TAG] | |
}; | |
ZmTagTreeController.prototype._getActionMenuOps=function(){return[ZmOperation.NEW_TAG,ZmOperation.MARK_ALL_READ,ZmOperation.DELETE_WITHOUT_SHORTCUT,ZmOperation.RENAME_TAG,ZmOperation.TAG_COLOR_MENU,ZmOperation.OPEN_IN_TAB] | |
}; | |
ZmTagTreeController.prototype._getNewDialog=function(){return appCtxt.getNewTagDialog() | |
}; | |
ZmTagTreeController.prototype._getRenameDialog=function(){return appCtxt.getRenameTagDialog() | |
}; | |
ZmTagTreeController.prototype._itemClicked=function(b,c){var a; | |
switch(appCtxt.getCurrentAppName()){case ZmApp.CONTACTS:a=ZmItem.CONTACT; | |
break; | |
case ZmApp.CALENDAR:a=ZmItem.APPT; | |
break; | |
case ZmApp.BRIEFCASE:a=ZmItem.BRIEFCASE_ITEM; | |
break; | |
case ZmApp.TASKS:a=ZmItem.TASK; | |
break; | |
default:a=ZmId.SEARCH_MAIL; | |
break | |
}var e={query:b.createQuery(),searchFor:a,noGal:true,inclSharedItems:true,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),accountName:appCtxt.multiAccounts?b.getAccount().name:null,userInitiated:c}; | |
var d=appCtxt.getSearchController(); | |
d.searchAllAccounts=false; | |
d.search(e) | |
}; | |
ZmTagTreeController.prototype._deleteListener=function(b){var a=this._pendingActionData=this._getActionedOrganizer(b); | |
var c=this._deleteShield=appCtxt.getYesNoMsgDialog(); | |
c.reset(); | |
c.registerCallback(DwtDialog.NO_BUTTON,this._clearDialog,this,this._deleteShield); | |
c.registerCallback(DwtDialog.YES_BUTTON,this._deleteShieldYesCallback,this,a); | |
var d=AjxMessageFormat.format(ZmMsg.askDeleteTag,a.getName(false,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH)); | |
c.setMessage(d,DwtMessageDialog.WARNING_STYLE); | |
c.popup() | |
}; | |
ZmTagTreeController.prototype._colorListener=function(c){var a=this._getActionedOrganizer(c); | |
if(a){var b=c.item.getData(ZmOperation.MENUITEM_ID); | |
if(String(b).match(/^#/)){a.setRGB(b) | |
}else{a.setColor(b) | |
}}}; | |
ZmTagTreeController.prototype._dropListener=function(e){var f=e.srcData.data; | |
if(e.action==DwtDropEvent.DRAG_ENTER){var d=(f instanceof Array)?f[0]:f; | |
var b=e.targetControl.getData(Dwt.KEY_OBJECT); | |
if(b.id==ZmOrganizer.ID_ROOT){e.doIt=false | |
}else{if(d instanceof ZmItem&&d.isReadOnly()){e.doIt=false | |
}else{if(appCtxt.multiAccounts&&b.getAccount()!=d.account){e.doIt=false | |
}else{e.doIt=this._dropTgt.isValidTarget(f) | |
}}}}else{if(e.action==DwtDropEvent.DRAG_DROP){var a=e.srcData.controller; | |
var c=(f instanceof Array)?f:[f]; | |
a._doTag(c,e.targetControl.getData(Dwt.KEY_OBJECT),true) | |
}}}; | |
ZmTagTreeController.prototype._changeListener=function(g,c,h){var b=g.getDetail("fields"); | |
var d=g.getDetail("organizers"); | |
for(var e=0; | |
e<d.length; | |
e++){var a=d[e]; | |
if(g.event==ZmEvent.E_MODIFY&&((b&&b[ZmOrganizer.F_COLOR]))){var f=c.getTreeItemById(a.id); | |
if(f){f.setImage(a.getIconWithColor()) | |
}}else{ZmTreeController.prototype._changeListener.call(this,g,c,h) | |
}}}; | |
ZmTagTreeController.prototype._setTreeItemColor=function(b,a){} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmFolderTreeController")){ZmFolderTreeController=function(b,a){if(!arguments.length){return | |
}ZmTreeController.call(this,(b||ZmOrganizer.FOLDER)); | |
this._listeners[ZmOperation.NEW_FOLDER]=this._newListener.bind(this); | |
this._listeners[ZmOperation.PRIORITY_FILTER]=this._priorityFilterListener.bind(this); | |
this._listeners[ZmOperation.RENAME_FOLDER]=this._renameListener.bind(this); | |
this._listeners[ZmOperation.SHARE_FOLDER]=this._shareFolderListener.bind(this); | |
this._listeners[ZmOperation.EMPTY_FOLDER]=this._emptyListener.bind(this); | |
this._listeners[ZmOperation.RECOVER_DELETED_ITEMS]=this._recoverListener.bind(this); | |
this._listeners[ZmOperation.SYNC_OFFLINE_FOLDER]=this._syncOfflineFolderListener.bind(this) | |
}; | |
ZmFolderTreeController.prototype=new ZmTreeController; | |
ZmFolderTreeController.prototype.constructor=ZmFolderTreeController; | |
ZmFolderTreeController.prototype.isZmFolderTreeController=true; | |
ZmFolderTreeController.prototype.toString=function(){return"ZmFolderTreeController" | |
}; | |
ZmFolderTreeController.prototype.show=function(a){return ZmTreeController.prototype.show.call(this,a) | |
}; | |
ZmFolderTreeController.prototype.resetOperations=function(k,d,r){var n=ZmMsg.emptyFolder; | |
var g=appCtxt.getById(r); | |
var t=((g.numTotal>0)||(g.children&&(g.children.size()>0))); | |
var i=true; | |
var l=g.rid; | |
if(l==ZmFolder.ID_ROOT||l==ZmFolder.ID_INBOX||l==ZmFolder.ID_SENT||l==ZmFolder.ID_DRAFTS){i=false | |
}var q=ZmOrganizer.normalizeId(r,this.type); | |
if(q==ZmOrganizer.ID_ROOT||(!g.isSystem()&&!g.isSystemEquivalent())){var c=(!g.link||g.isAdmin()); | |
if(appCtxt.isOffline){c=!g.getAccount().isMain&&g.getAccount().isZimbraAccount | |
}k.enableAll(true); | |
var m=g.parent&&g.parent.isReadOnly(); | |
k.enable([ZmOperation.DELETE_WITHOUT_SHORTCUT,ZmOperation.MOVE,ZmOperation.EDIT_PROPS],!m); | |
k.enable(ZmOperation.SYNC,g.isFeed()); | |
k.enable(ZmOperation.SYNC_ALL,g.isFeed()||g.hasFeeds()); | |
k.enable(ZmOperation.SHARE_FOLDER,c); | |
k.enable(ZmOperation.EMPTY_FOLDER,((t||g.link)&&i&&!appCtxt.isExternalAccount())); | |
k.enable(ZmOperation.RENAME_FOLDER,!(m||g.isDataSource()||appCtxt.isExternalAccount())); | |
k.enable(ZmOperation.NEW_FOLDER,!(g.disallowSubFolder||appCtxt.isExternalAccount())); | |
if(g.isRemote()&&g.isReadOnly()){k.enable([ZmOperation.NEW_FOLDER,ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER],false) | |
}if(appCtxt.isExternalAccount()){k.enable([ZmOperation.DELETE_WITHOUT_SHORTCUT,ZmOperation.MOVE],false) | |
}}else{if(g.isSystemEquivalent()){q=g.getSystemEquivalentFolderId() | |
}k.enableAll(false); | |
if(!g.disallowSubFolder&&(q==ZmFolder.ID_INBOX||q==ZmFolder.ID_SENT||q==ZmFolder.ID_TRASH)){k.enable(ZmOperation.NEW_FOLDER,true) | |
}if(q==ZmFolder.ID_SPAM||q==ZmFolder.ID_TRASH||q==ZmFolder.ID_CHATS){if(q==ZmFolder.ID_SPAM){n=ZmMsg.emptyJunk | |
}else{if(q==ZmFolder.ID_TRASH){n=ZmMsg.emptyTrash | |
}}k.enable(ZmOperation.EMPTY_FOLDER,t) | |
}if(!g.link&&(q==ZmFolder.ID_INBOX||q==ZmFolder.ID_SENT||q==ZmFolder.ID_DRAFTS)){k.enable([ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS],true) | |
}if(appCtxt.multiAccounts){var c=!g.getAccount().isMain&&g.getAccount().isZimbraAccount; | |
if(q==ZmFolder.ID_SPAM||q==ZmFolder.ID_TRASH){c=false | |
}k.enable([ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS],c) | |
}if(appCtxt.isOffline&&q==ZmOrganizer.ID_SYNC_FAILURES&&t){k.enable(ZmOperation.EMPTY_FOLDER,true) | |
}}k.enable(ZmOperation.OPEN_IN_TAB,true); | |
k.enable(ZmOperation.EXPAND_ALL,(g.size()>0)); | |
if(q!=ZmOrganizer.ID_ROOT&&!g.isReadOnly()){k.enable(ZmOperation.MARK_ALL_READ,!g.isRemoteRoot()&&(g.numUnread>0||g.link)) | |
}var j=k.getOp(ZmOperation.EMPTY_FOLDER); | |
if(j){j.setText(n) | |
}var e=(q==ZmOrganizer.ID_TRASH); | |
var a=k.getOp(ZmOperation.SYNC); | |
if(a){var o=k.getOp(ZmOperation.SYNC_ALL); | |
var v=g.hasFeeds(); | |
if(g.isFeed()){a.setEnabled(true); | |
a.setVisible(true); | |
a.setText(ZmMsg.checkFeed); | |
if(o){o.setEnabled(true); | |
o.setVisible(true); | |
o.setText(ZmMsg.checkAllFeed) | |
}}else{if(v&&!e){if(o){o.setEnabled(true); | |
o.setVisible(true); | |
o.setText(ZmMsg.checkAllFeed) | |
}}else{var u=appCtxt.get(ZmSetting.POP_ACCOUNTS_ENABLED)||appCtxt.get(ZmSetting.IMAP_ACCOUNTS_ENABLED); | |
if(!appCtxt.isOffline&&u){var s=AjxDispatcher.run("GetDataSourceCollection"); | |
var f=s.getItemsFor(ZmOrganizer.normalizeId(g.id)); | |
if(f.length>0){a.setText(ZmMsg.checkExternalMail); | |
a.setEnabled(true); | |
a.setVisible(true) | |
}else{a.setVisible(false) | |
}}else{a.setVisible(false) | |
}if((!v||e)&&o){o.setVisible(false) | |
}}}}a=k.getOp(ZmOperation.SYNC_OFFLINE_FOLDER); | |
if(a){if(!g.isOfflineSyncable){a.setVisible(false) | |
}else{a.setVisible(true); | |
a.setEnabled(true); | |
var p=(g.isOfflineSyncing)?ZmMsg.syncOfflineFolderOff:ZmMsg.syncOfflineFolderOn; | |
a.setText(p) | |
}}var h=appCtxt.get(ZmSetting.PRIORITY_INBOX_ENABLED); | |
var b=k.getOp(ZmOperation.PRIORITY_FILTER); | |
if(b){b.setVisible(h); | |
b.setEnabled(h) | |
}this._enableRecoverDeleted(k,e); | |
this._resetButtonPerSetting(k,ZmOperation.SHARE_FOLDER,appCtxt.get(ZmSetting.SHARING_ENABLED)) | |
}; | |
ZmFolderTreeController.prototype._getHeaderActionMenuOps=function(){if(appCtxt.isExternalAccount()){return[ZmOperation.EXPAND_ALL] | |
}return[ZmOperation.NEW_FOLDER,ZmOperation.SEP,ZmOperation.PRIORITY_FILTER,ZmOperation.EXPAND_ALL,ZmOperation.SYNC,ZmOperation.FIND_SHARES] | |
}; | |
ZmFolderTreeController.prototype._getActionMenuOps=function(){return[ZmOperation.NEW_FOLDER,ZmOperation.SYNC,ZmOperation.SYNC_ALL,ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER,ZmOperation.RECOVER_DELETED_ITEMS,ZmOperation.SHARE_FOLDER,ZmOperation.MOVE,ZmOperation.DELETE_WITHOUT_SHORTCUT,ZmOperation.RENAME_FOLDER,ZmOperation.EDIT_PROPS,ZmOperation.SYNC_OFFLINE_FOLDER,ZmOperation.OPEN_IN_TAB,ZmOperation.EXPAND_ALL] | |
}; | |
ZmFolderTreeController.prototype._getAllowedSubTypes=function(){var a={}; | |
a[ZmOrganizer.FOLDER]=true; | |
a[ZmOrganizer.SEARCH]=true; | |
return a | |
}; | |
ZmFolderTreeController.prototype._getNewDialog=function(){return appCtxt.getNewFolderDialog() | |
}; | |
ZmFolderTreeController.prototype._getRenameDialog=function(){return appCtxt.getRenameFolderDialog() | |
}; | |
ZmFolderTreeController.prototype._itemClicked=function(b,l){if(appCtxt.isOffline){var o=b.getAccount(); | |
if(o&&o.inNewMailMode){o.inNewMailMode=false; | |
var c=appCtxt.getOverviewController()._overviewContainer; | |
for(var k in c){c[k].updateAccountInfo(o,true,true) | |
}}}if(b.type==ZmOrganizer.SEARCH){var g=this._opc.getTreeController(ZmOrganizer.SEARCH); | |
g._itemClicked(b,l) | |
}else{if(b.id==ZmFolder.ID_ATTACHMENTS){var j=AjxDispatcher.run("GetAttachmentsController"); | |
j.show() | |
}else{var a=ZmId.SEARCH_MAIL; | |
if(b.isInTrash()){var e=appCtxt.getCurrentAppName(); | |
if(e==ZmApp.CONTACTS){a=ZmItem.CONTACT | |
}}var n=appCtxt.getSearchController(); | |
var o=b.getAccount(); | |
var p=appCtxt.get(ZmSetting.SORTING_PREF,b.nId); | |
if(!p){p=(n.currentSearch&&b.nId==n.currentSearch.folderId)?null:ZmSearch.DATE_DESC | |
}else{var h=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy(); | |
if(h==ZmItem.CONV&&(p==ZmSearch.NAME_ASC||p==ZmSearch.NAME_DESC)){p=appCtxt.get(ZmSetting.SORTING_PREF,appCtxt.getCurrentViewId()); | |
if(!p){p=ZmSearch.DATE_DESC | |
}appCtxt.set(ZmSetting.SORTING_PREF,p,b.nId) | |
}}var f={query:b.createQuery(),searchFor:a,getHtml:b.nId==ZmFolder.ID_DRAFTS||appCtxt.get(ZmSetting.VIEW_AS_HTML),types:b.nId==ZmOrganizer.ID_SYNC_FAILURES?[ZmItem.MSG]:null,sortBy:p,accountName:o&&o.name,userInitiated:l,origin:ZmId.SEARCH}; | |
n.resetSearchAllAccounts(); | |
if(appCtxt.multiAccounts){if(b.link&&b.perm==null){var d=appCtxt.getFolderTree(o); | |
if(d){var q=new AjxCallback(this,this._getPermissionsResponse,[f]); | |
d.getPermissions({callback:q,folderIds:[b.id]}) | |
}return | |
}if(appCtxt.isOffline&&o.hasNotSynced()&&!o.__syncAsked){o.__syncAsked=true; | |
var m=appCtxt.getYesNoMsgDialog(); | |
m.registerCallback(DwtDialog.YES_BUTTON,this._syncAccount,this,[m,o]); | |
m.setMessage(ZmMsg.neverSyncedAsk,DwtMessageDialog.INFO_STYLE); | |
m.popup() | |
}}n.search(f) | |
}}}; | |
ZmFolderTreeController.prototype._syncAccount=function(a,b){a.popdown(); | |
b.sync() | |
}; | |
ZmFolderTreeController.prototype._getPermissionsResponse=function(a){appCtxt.getSearchController().search(a) | |
}; | |
ZmFolderTreeController.prototype._doSync=function(c){var b=AjxDispatcher.run("GetDataSourceCollection"); | |
var a=ZmOrganizer.normalizeId(c.id); | |
var d=b.getItemsFor(a); | |
if(d.length>0){b.importMailFor(a) | |
}else{ZmTreeController.prototype._doSync.call(this,c) | |
}}; | |
ZmFolderTreeController.prototype._syncFeeds=function(b){if(!appCtxt.isOffline&&b&&!b.isFeed()){var c=(appCtxt.get(ZmSetting.POP_ACCOUNTS_ENABLED)||appCtxt.get(ZmSetting.IMAP_ACCOUNTS_ENABLED))?b.getDataSources(null,true):null; | |
if(c){var a=AjxDispatcher.run("GetDataSourceCollection"); | |
a.importMail(c); | |
return | |
}}ZmTreeController.prototype._syncFeeds.call(this,b) | |
}; | |
ZmFolderTreeController.prototype._addNew=function(d,c,b,a){if(ZmFolder.HIDE_ID[b.id]){return false | |
}return d._addNew(c,b,a) | |
}; | |
ZmFolderTreeController.prototype._deleteListener=function(c){var a=this._getActionedOrganizer(c); | |
var f=appCtxt.isOffline?this.getDataTree().getById(ZmFolder.ID_TRASH):null; | |
if(f&&f.disallowSubFolder&&a.numTotal>0){var h=appCtxt.getMsgDialog(); | |
h.setMessage(ZmMsg.errorCannotDeleteFolder); | |
h.popup(); | |
return | |
}if(a.nId==ZmFolder.ID_SPAM||a.isInTrash()||(f&&f.disallowSubFolder)){this._pendingActionData=a; | |
var e=this._deleteShield=appCtxt.getOkCancelMsgDialog(); | |
e.reset(); | |
e.registerCallback(DwtDialog.OK_BUTTON,this._deleteShieldYesCallback,this,a); | |
e.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,this._deleteShield); | |
var b; | |
if(a.type===ZmOrganizer.SEARCH){b=ZmMsg.confirmDeleteSavedSearch | |
}else{if(a.nId==ZmFolder.ID_TRASH){b=ZmMsg.confirmEmptyTrashFolder | |
}else{if(a.nId==ZmFolder.ID_SPAM){b=ZmMsg.confirmEmptyFolder | |
}else{b=ZmMsg.confirmDeleteFolder | |
}}}var g=AjxMessageFormat.format(b,a.getName()); | |
e.setMessage(g,DwtMessageDialog.WARNING_STYLE); | |
e.popup() | |
}else{this._doMove(a,appCtxt.getById(ZmFolder.ID_TRASH)) | |
}}; | |
ZmFolderTreeController.prototype._emptyListener=function(a){this._getEmptyShieldWarning(a) | |
}; | |
ZmFolderTreeController.prototype._recoverListener=function(a){appCtxt.getDumpsterDialog().popup(this._getSearchFor(),this._getSearchTypes()) | |
}; | |
ZmFolderTreeController.prototype._getSearchFor=function(a){return ZmId.SEARCH_MAIL | |
}; | |
ZmFolderTreeController.prototype._getSearchTypes=function(a){return[ZmItem.MSG] | |
}; | |
ZmFolderTreeController.prototype._syncOfflineFolderListener=function(b){var a=this._getActionedOrganizer(b); | |
if(a){a.toggleSyncOffline() | |
}}; | |
ZmFolderTreeController.prototype._dragListener=function(b){if(b.action==DwtDragEvent.DRAG_START){var a=b.srcControl.getData(Dwt.KEY_OBJECT); | |
b.srcData={data:a,controller:this}; | |
if(!(a instanceof ZmFolder)||a.isSystem()){b.operation=Dwt.DND_DROP_NONE | |
}}}; | |
ZmFolderTreeController.prototype._dropListener=function(k){var e=k.targetControl.getData(Dwt.KEY_OBJECT); | |
var b=k.srcData.data; | |
var d=(k.shiftKey||k.uiEvent.shiftKey); | |
if(k.action==DwtDropEvent.DRAG_ENTER){if(!b){k.doIt=false; | |
return | |
}var j=k.targetControl.getData(ZmTreeView.KEY_TYPE); | |
if(b instanceof ZmFolder){k.doIt=e.mayContain(b,j)&&!e.disallowSubFolder | |
}else{if(b instanceof ZmTag){k.doIt=false | |
}else{if(this._dropTgt.isValidTarget(b)){k.doIt=e.mayContain(b,j); | |
var a; | |
var n=AjxUtil.toArray(b); | |
for(var c=0; | |
c<n.length; | |
c++){if(n[c] instanceof ZmItem){a|=n[c].getDefaultDndAction(d) | |
}}var l=document.getElementById(DwtId.DND_PLUS_ID); | |
if(a&&l){var h=((a&ZmItem.DND_ACTION_COPY)!=0); | |
Dwt.setVisibility(l,h) | |
}}else{k.doIt=false | |
}}}}else{if(k.action==DwtDropEvent.DRAG_DROP){if(b instanceof ZmFolder){this._doMove(b,e) | |
}else{var m=k.srcData.controller; | |
var g=(b instanceof Array)?b:[b]; | |
if(appCtxt.multiAccounts&&!d&&!e.getAccount().isMain&&this._isMovingAcrossAccount(g,e)){var f=appCtxt.getYesNoMsgDialog(); | |
f.registerCallback(DwtDialog.YES_BUTTON,this._continueMovingAcrossAccount,this,[f,m,g,e]); | |
f.setMessage(ZmMsg.moveAcrossAccountWarning,DwtMessageDialog.WARNING_STYLE); | |
f.popup() | |
}else{m._doMove(g,e,null,d) | |
}}}}}; | |
ZmFolderTreeController.prototype._isMovingAcrossAccount=function(a,e){for(var c=0; | |
c<a.length; | |
c++){var d=a[c]; | |
var b=d.getAccount(); | |
if(b&&b!=e.getAccount()){return true | |
}}return false | |
}; | |
ZmFolderTreeController.prototype._continueMovingAcrossAccount=function(c,a,b,d){c.popdown(); | |
a._doMove(b,d) | |
}; | |
ZmTreeController.prototype._priorityFilterListener=function(b){var a=appCtxt.getPriorityMessageFilterDialog(); | |
ZmController.showDialog(a) | |
}; | |
ZmFolderTreeController.prototype._shareFolderListener=function(a){this._pendingActionData=this._getActionedOrganizer(a); | |
appCtxt.getSharePropsDialog().popup(ZmSharePropsDialog.NEW,this._pendingActionData) | |
}; | |
ZmFolderTreeController.prototype._getMoveDialogTitle=function(){return AjxMessageFormat.format(ZmMsg.moveFolder,this._pendingActionData.name) | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmSearchTreeController")){ZmSearchTreeController=function(){ZmFolderTreeController.call(this,ZmOrganizer.SEARCH); | |
this._listeners[ZmOperation.RENAME_SEARCH]=this._renameListener.bind(this) | |
}; | |
ZmSearchTreeController.prototype=new ZmFolderTreeController; | |
ZmSearchTreeController.prototype.constructor=ZmSearchTreeController; | |
ZmSearchTreeController.prototype.isZmSearchTreeController=true; | |
ZmSearchTreeController.prototype.toString=function(){return"ZmSearchTreeController" | |
}; | |
ZmSearchTreeController.APP_JOIN_CHAR="-"; | |
ZmSearchTreeController.prototype.show=function(d){var e=d.overviewId; | |
if(!this._treeView[e]||d.forceCreate){this._treeView[e]=this._setup(e) | |
}var b=this.getDataTree(d.account); | |
if(b){d.dataTree=b; | |
d.searchTypes={}; | |
d.omit=d.omit||{}; | |
d.omit[ZmFolder.ID_TRASH]=true; | |
d.omitParents=true; | |
var a=ZmOrganizer.OPEN_SETTING[this.type]; | |
d.collapsed=!(!a||(appCtxt.get(a,null,d.account)!==false)); | |
var c=this._opc.getOverview(e); | |
if(c&&c.showNewButtons){this._setupOptButton(d) | |
}this._treeView[e].set(d); | |
this._checkTreeView(e) | |
}return this._treeView[e] | |
}; | |
ZmSearchTreeController.prototype.getTreeStyle=function(){return null | |
}; | |
ZmSearchTreeController.prototype.resetOperations=function(c,b,d){c.enableAll(true); | |
var a=appCtxt.getById(d); | |
c.enable(ZmOperation.EXPAND_ALL,(a.size()>0)) | |
}; | |
ZmSearchTreeController.prototype._getHeaderActionMenuOps=function(){return[ZmOperation.EXPAND_ALL] | |
}; | |
ZmSearchTreeController.prototype._getActionMenuOps=function(){return[ZmOperation.MOVE,ZmOperation.DELETE_WITHOUT_SHORTCUT,ZmOperation.RENAME_SEARCH,ZmOperation.EDIT_PROPS,ZmOperation.OPEN_IN_TAB,ZmOperation.EXPAND_ALL] | |
}; | |
ZmSearchTreeController.prototype._getAllowedSubTypes=function(){return ZmTreeController.prototype._getAllowedSubTypes.call(this) | |
}; | |
ZmSearchTreeController.prototype._getNewDialog=function(){return appCtxt.getNewSearchDialog() | |
}; | |
ZmSearchTreeController.prototype._itemClicked=function(b,a){if(b._showFoldersCallback){b._showFoldersCallback.run(); | |
return | |
}appCtxt.getSearchController().redoSearch(b.search,false,{getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),userInitiated:a,origin:ZmId.SEARCH}) | |
}; | |
ZmSearchTreeController.prototype._getMoveDialogTitle=function(){return AjxMessageFormat.format(ZmMsg.moveSearch,this._pendingActionData.name) | |
}; | |
ZmSearchTreeController.prototype._checkTreeView=function(e){var b=this._treeView[e]; | |
if(!e||!b){return | |
}var d=this._opc.getOverview(e).account; | |
var a=(appCtxt.multiAccounts&&!d.isMain)?(ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,d)):ZmOrganizer.ID_ROOT; | |
var c=ZmOrganizer.HIDE_EMPTY[this.type]&&!b.getTreeItemById(a).getItemCount(); | |
this._treeView[e].setVisible(!c) | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmShareTreeController")){ZmShareTreeController=function(){ZmTreeController.call(this,ZmOrganizer.SHARE) | |
}; | |
ZmShareTreeController.prototype=new ZmTreeController; | |
ZmShareTreeController.prototype.constructor=ZmShareTreeController; | |
ZmShareTreeController.prototype.toString=function(){return"ZmShareTreeController" | |
}; | |
ZmShareTreeController.prototype.getDataTree=function(b){var a=new ZmFolderTree(ZmOrganizer.SHARE); | |
var c={id:ZmOrganizer.ID_ROOT,name:ZmMsg.sharedFoldersHeader}; | |
a.root=ZmFolderTree.createFolder(ZmOrganizer.SHARE,null,c,a); | |
return a | |
}; | |
ZmShareTreeController.prototype._createTreeView=function(a){return new ZmShareTreeView(a) | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmOverviewController")){ZmOverviewController=function(a){ZmController.call(this,a); | |
this._overviewContainer={}; | |
this._overview={}; | |
this._controller={}; | |
this._appOverviewId={} | |
}; | |
ZmOverviewController.CONTROLLER={}; | |
ZmOverviewController.DEFAULT_FOLDER_ID=ZmFolder.ID_INBOX; | |
ZmOverviewController.prototype=new ZmController; | |
ZmOverviewController.prototype.constructor=ZmOverviewController; | |
ZmOverviewController.prototype.toString=function(){return"ZmOverviewController" | |
}; | |
ZmOverviewController.prototype.createOverviewContainer=function(b,c){b.parent=b.parent||this._shell; | |
b.controller=this; | |
b.id=ZmId.getOverviewContainerId(b.containerId); | |
var a=this._overviewContainer[b.containerId]=new ZmAccountOverviewContainer(b); | |
c.containerId=b.id; | |
a.initialize(c); | |
return a | |
}; | |
ZmOverviewController.prototype.createOverview=function(b){b.parent=b.parent||this._shell; | |
var a=this._overview[b.overviewId]=new ZmOverview(b,this); | |
return a | |
}; | |
ZmOverviewController.prototype.getOverviewContainer=function(a){var a=a||appCtxt.getCurrentAppName(); | |
return this._overviewContainer[a] | |
}; | |
ZmOverviewController.prototype.getOverview=function(a){return this._overview[a] | |
}; | |
ZmOverviewController.prototype.getTreeController=function(treeId,noCreate){if(!treeId){return null | |
}if(!this._controller[treeId]&&!noCreate){var className=ZmOverviewController.CONTROLLER[treeId]; | |
if(className&&window[className]){var treeControllerCtor=eval(ZmOverviewController.CONTROLLER[treeId]); | |
if(treeControllerCtor){this._controller[treeId]=new treeControllerCtor(treeId) | |
}}}return this._controller[treeId] | |
}; | |
ZmOverviewController.prototype.getTreeData=function(a){return a?appCtxt.getTree(a):null | |
}; | |
ZmOverviewController.prototype.getTreeView=function(b,a){if(!b||!a){return null | |
}if(!this.getOverview(b)){return null | |
}return this.getOverview(b).getTreeView(a) | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmSearchController")){ZmSearchController=function(a){ZmController.call(this,a); | |
this._inited=false; | |
this._contactSource=ZmItem.CONTACT; | |
this._results=null; | |
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){this._setView() | |
}}; | |
ZmSearchController.prototype=new ZmController; | |
ZmSearchController.prototype.constructor=ZmSearchController; | |
ZmSearchController.prototype.isZmSearchController=true; | |
ZmSearchController.prototype.toString=function(){return"ZmSearchController" | |
}; | |
ZmSearchController.QUERY_ISREMOTE="is:remote OR is:local"; | |
ZmSearchController.prototype.getSearchToolbar=function(){return this._searchToolBar | |
}; | |
ZmSearchController.prototype.dateSearch=function(g,a){g=g||new Date(); | |
var e=AjxDateFormat.getDateInstance(AjxDateFormat.SHORT); | |
var c=e.format(g); | |
var b=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy(); | |
var f="date:"+c; | |
this.search({query:f,types:[b],searchFor:a,origin:ZmId.SEARCH,userInitiated:true}) | |
}; | |
ZmSearchController.prototype.fromSearch=function(a){var b=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy(); | |
var c=AjxUtil.map(AjxUtil.toArray(a),function(d){return"from:"+((d&&d.isAjxEmailAddress)?d.getAddress():d) | |
}); | |
this.search({query:c.join(" OR "),types:[b],origin:ZmId.SEARCH,userInitiated:true}) | |
}; | |
ZmSearchController.prototype.toSearch=function(a){var b=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy(); | |
var c=AjxUtil.map(AjxUtil.toArray(a),function(e){return"tocc:"+((e&&e.isAjxEmailAddress)?e.getAddress():e) | |
}); | |
var d={types:[b],origin:ZmId.SEARCH,userInitiated:true,query:c.join(" OR ")}; | |
if(this.currentSearch&&this.currentSearch.folderId==ZmFolder.ID_SENT){if(c.length>1){d.query="("+d.query+")" | |
}d.query="in:sent AND "+d.query | |
}this.search(d) | |
}; | |
ZmSearchController.prototype.setSearchField=function(a){if(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)&&this._searchToolBar){this._searchToolBar.setSearchFieldValue(a) | |
}else{this._currentQuery=a | |
}}; | |
ZmSearchController.prototype.getSearchFieldValue=function(){return this._searchToolBar?this._searchToolBar.getSearchFieldValue():"" | |
}; | |
ZmSearchController.prototype.setEnabled=function(a){if(this._searchToolBar){this._searchToolBar.setEnabled(a) | |
}}; | |
ZmSearchController.prototype.setDefaultSearchType=function(a){if(!this._searchToolBar){return | |
}var b=this._searchToolBar.getButton(ZmSearchToolBar.TYPES_BUTTON).getMenu(); | |
b.checkItem(ZmOperation.MENUITEM_ID,a); | |
this._searchMenuListener(null,a,true) | |
}; | |
ZmSearchController.prototype._setView=function(){this.searchPanel=new DwtComposite({parent:this._container,className:"SearchPanel",posStyle:Dwt.ABSOLUTE_STYLE}); | |
this._searchToolBar=new ZmMainSearchToolBar({parent:this.searchPanel,id:ZmId.SEARCH_TOOLBAR}); | |
this._createTabGroup(); | |
this._tabGroup.addMember(this._searchToolBar.getChildren()); | |
this._searchToolBar.registerEnterCallback(this._toolbarSearch.bind(this)); | |
this._searchToolBar.addSelectionListener(ZmSearchToolBar.SEARCH_BUTTON,this._searchButtonListener.bind(this)) | |
}; | |
ZmSearchController.prototype._addMenuListeners=function(f){var c=this._searchMenuListener.bind(this); | |
var b=f.getItems(); | |
for(var d=0; | |
d<b.length; | |
d++){var e=b[d]; | |
e.addSelectionListener(c); | |
var a=e.getData(ZmOperation.MENUITEM_ID); | |
if(a==ZmId.SEARCH_MAIL){e.setChecked(true,true) | |
}}}; | |
ZmSearchController.prototype.search=function(a){if(a.query&&(a.query.indexOf("$set:")==0||a.query.indexOf("$cmd:")==0)){appCtxt.getClientCmdHandler().execute((a.query.substr(5)),this); | |
return | |
}a.searchAllAccounts=this.searchAllAccounts; | |
var b=this._handleResponseSearch.bind(this,a.callback); | |
this._doSearch(a,a.noRender,b,a.errorCallback) | |
}; | |
ZmSearchController.prototype._handleResponseSearch=function(b,a){if(b){b.run(a) | |
}}; | |
ZmSearchController.prototype.redoSearch=function(d,a,e,g,b){var f={}; | |
f.query=d.query; | |
f.queryHint=d.queryHint; | |
f.types=d.types; | |
f.forceTypes=d.forceTypes; | |
f.sortBy=d.sortBy; | |
f.offset=d.offset; | |
f.limit=d.limit; | |
f.fetch=d.fetch; | |
f.searchId=d.searchId; | |
f.lastSortVal=d.lastSortVal; | |
f.endSortVal=d.endSortVal; | |
f.lastId=d.lastId; | |
f.soapInfo=d.soapInfo; | |
f.accountName=d.accountName; | |
f.searchFor=this._searchFor; | |
f.idsOnly=d.idsOnly; | |
f.inDumpster=d.inDumpster; | |
f.userInitiated=d.userInitiated; | |
f.sessionId=d.sessionId; | |
f.isEmpty=d.isEmpty; | |
f.markRead=d.markRead; | |
if(e){for(var c in e){f[c]=e[c] | |
}}this._doSearch(f,a,g,b) | |
}; | |
ZmSearchController.prototype.resetSearchAllAccounts=function(){var a=this.searchAllAccounts&&this._searchToolBar.getButton(ZmSearchToolBar.TYPES_BUTTON); | |
var e=a&&a.getMenu(); | |
var d=e&&e.getItemById(ZmOperation.MENUITEM_ID,ZmId.SEARCH_ALL_ACCOUNTS); | |
if(d){d.setChecked(false,true); | |
var c=e.getSelectedItem(); | |
var b=this._inclSharedItems?this._getSharedImage(c):c.getImage(); | |
a.setImage(b); | |
this.searchAllAccounts=false | |
}}; | |
ZmSearchController.prototype.resetSearchToolbar=function(){var a=this._searchToolBar.getButton(ZmSearchToolBar.TYPES_BUTTON); | |
var b=a?a.getMenu().getItemById(ZmOperation.MENUITEM_ID,ZmId.SEARCH_GAL):null; | |
if(b){b.setVisible(appCtxt.getActiveAccount().isZimbraAccount) | |
}}; | |
ZmSearchController.prototype.getTypeFromSearchFor=function(a,d){var b=a; | |
if(a===ZmId.SEARCH_MAIL){var c=window.parentAppCtxt||window.appCtxt,e=c.getApp(d?ZmApp.SEARCH:ZmApp.MAIL); | |
b=e?e.getGroupMailBy():ZmItem.MSG | |
}return b | |
}; | |
ZmSearchController.prototype.getSearchForFromType=function(a){return(a===ZmItem.MSG||a===ZmItem.CONV)?ZmId.SEARCH_MAIL:a | |
}; | |
ZmSearchController.prototype.updateOverview=function(a){var b=a||appCtxt.getCurrentSearch(); | |
if(!b){return | |
}var h,c; | |
if(b.isSimple()||b.searchId){if(b.searchId){h=this._getNormalizedId(b.searchId); | |
c=ZmOrganizer.SEARCH | |
}else{if(b.folderId){h=this._getNormalizedId(b.folderId); | |
var e=appCtxt.getFolderTree(),d=e&&e.getById(h); | |
c=ZmOrganizer.ITEM_ORGANIZER[b.searchFor]||(d&&d.type)||ZmOrganizer.FOLDER | |
}else{if(b.tagId){h=this._getNormalizedId(b.tagId); | |
c=ZmOrganizer.TAG | |
}}}if(c){var g=appCtxt.getCurrentApp(); | |
var f=g&&g.getOverview(); | |
if(f){f.setSelected(h,c) | |
}}}}; | |
ZmSearchController.prototype._getSuitableSortBy=function(b){var d; | |
var a; | |
switch(b){case ZmItem.CONV:a=ZmId.VIEW_CONVLIST; | |
break; | |
case ZmItem.MSG:a=ZmId.VIEW_TRAD; | |
break; | |
case ZmItem.CONTACT:a=ZmId.VIEW_CONTACT_SIMPLE; | |
break; | |
case ZmItem.APPT:a=ZmId.VIEW_CAL; | |
break; | |
case ZmItem.TASK:a=ZmId.VIEW_TASKLIST; | |
break; | |
case ZmId.SEARCH_GAL:a=ZmId.VIEW_CONTACT_SIMPLE; | |
break; | |
case ZmItem.BRIEFCASE_ITEM:a=ZmId.VIEW_BRIEFCASE_DETAIL; | |
break | |
}if(a){d=appCtxt.get(ZmSetting.SORTING_PREF,a) | |
}var c=this._searchToolBar.getSearchFieldValue(); | |
if(c&&c.length>0){if(d===ZmSearch.RCPT_ASC||d===ZmSearch.RCPT_DESC){d=d===ZmSearch.RCPT_ASC?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC | |
}else{if(d===ZmSearch.FLAG_ASC||d===ZmSearch.FLAG_DESC){d=d===ZmSearch.FLAG_ASC?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC | |
}else{if(d===ZmSearch.ATTACH_ASC||d===ZmSearch.ATTACH_DESC){d=d===ZmSearch.ATTACH_ASC?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC | |
}else{if(d===ZmSearch.PRIORITY_ASC||d===ZmSearch.PRIORITY_DESC){d=d===ZmSearch.PRIORITY_ASC?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC | |
}}}}}return d | |
}; | |
ZmSearchController.prototype._doSearch=function(d,l,m,g){var a=this._searchFor=d.searchFor||this._searchFor||ZmSearchToolBar.MENU_ITEMS[0]; | |
appCtxt.notifyZimlets("onSearch",[d.query]); | |
if(!d.skipUpdateSearchToolbar&&this._searchToolBar){var k=(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)||d.userText)?d.query:null; | |
this._searchToolBar.setSearchFieldValue(k||""); | |
if(appCtxt.multiAccounts&&d.userText&&this.searchAllAccounts){appCtxt.getCurrentApp().getOverviewContainer().deselectAll() | |
}}var h=d.types; | |
var i=!h?a:AjxUtil.toArray(h)[0]; | |
a=this.getSearchForFromType(i); | |
if(!d.forceTypes){i=this.getTypeFromSearchFor(a,d.userInitiated) | |
}var h=AjxVector.fromArray([i]); | |
if(a==ZmId.SEARCH_MAIL){d=appCtxt.getApp(ZmApp.MAIL).getSearchParams(d) | |
}if(a==ZmItem.TASK){var c=AjxDispatcher.run("GetTaskListController"); | |
d.allowableTaskStatus=c&&c.getAllowableTaskStatus() | |
}if(d.searchAllAccounts&&!d.queryHint){d.queryHint=appCtxt.accountList.generateQuery(null,h); | |
d.accountName=appCtxt.accountList.mainAccount.name | |
}else{if(d.inclSharedItems||this._inclSharedItems){d.queryHint=ZmSearchController.generateQueryForShares(i) | |
}}d.contactSource=!d.noGal&&(i===ZmItem.CONTACT||i===ZmId.SEARCH_GAL)?this._contactSource:null; | |
if(d.contactSource==ZmId.SEARCH_GAL){d.expandDL=true | |
}d.sortBy=d.sortBy||this._getSuitableSortBy(i); | |
d.types=h; | |
var p=new ZmSearch(d); | |
if(a===ZmId.SEARCH_MAIL&&(d.inDumpster||(!d.isViewSwitch&&p.folderId&&p.folderId==ZmFolder.ID_DRAFTS))){p.types=AjxVector.fromArray([ZmItem.MSG]); | |
p.isDefaultToMessageView=true | |
}var n=this._handleResponseDoSearch.bind(this,p,l,m,d.noUpdateOverview); | |
var b=this._handleOfflineDoSearch.bind(this,p,n); | |
if(p.folderId==ZmFolder.ID_OUTBOX){var j=true | |
}if(!g){g=this._handleErrorDoSearch.bind(this,p); | |
if(!d.errorCallback){d.errorCallback=g | |
}}p.calController=null; | |
if(a==ZmItem.APPT&&!d.forceSearch&&!d.inDumpster){var o,e; | |
if(p.userInitiated&&ZmApp.SEARCH_RESULTS_TAB[ZmApp.CALENDAR]){o=appCtxt.getApp(ZmApp.SEARCH).getSearchResultsController(p.sessionId,ZmApp.CALENDAR); | |
e=o.getCurrentViewId() | |
}var f=AjxDispatcher.run("GetCalController",e,o); | |
if(f&&i===ZmItem.APPT){p.calController=f; | |
f.handleUserSearch(d,n) | |
}else{p.execute({offlineCache:d&&d.offlineCache,callback:n,errorCallback:g,offlineCallback:b,offlineRequest:j}) | |
}}else{p.execute({offlineCache:d&&d.offlineCache,callback:n,errorCallback:g,offlineCallback:b,offlineRequest:j}) | |
}}; | |
ZmSearchController.prototype._handleResponseDoSearch=function(d,b,f,e,a){var c=a&&a.getResponse(); | |
if(!c){return | |
}if(!c.type){c.type=d.types.get(0) | |
}this.currentSearch=d; | |
if(!b){this._showResults(c,d,e) | |
}if(f){f.run(a) | |
}}; | |
ZmSearchController.prototype._handleOfflineDoSearch=function(a,c){if(a.types&&a.types.replaceObject(ZmItem.CONV,ZmItem.MSG)){a.isDefaultToMessageView=true | |
}var b=this._handleOfflineResponseDoSearch.bind(this,a,c); | |
ZmOfflineDB.search(a,b) | |
}; | |
ZmSearchController.prototype._showResults=function(d,i,a){this._results=d=(d&&d.isZmSearchResult)?d:new ZmSearchResult(i); | |
var h=window.parentAppCtxt||window.appCtxt; | |
if(h.get(ZmSetting.SAVED_SEARCHES_ENABLED)){var e=this._searchToolBar&&this._searchToolBar.getButton(ZmSearchToolBar.SAVE_BUTTON); | |
if(e){e.setEnabled(this._contactSource!=ZmId.SEARCH_GAL) | |
}}var b=i.calController?h.getApp(ZmApp.CALENDAR):h.getApp(ZmItem.APP[d.type])||h.getCurrentApp(); | |
var f=b.getName(); | |
if(i.userInitiated&&ZmApp.SEARCH_RESULTS_TAB[f]){var g=(i.calController&&i.calController.searchResultsController)||h.getApp(ZmApp.SEARCH).getSearchResultsController(i.sessionId,f); | |
g.show(d,i.calController); | |
this._searchToolBar.setSearchFieldValue("") | |
}else{if(b.showSearchResults){var c=this._handleLoadShowResults.bind(this,d,i,a); | |
b.currentSearch=i; | |
b.currentQuery=i.query; | |
b.showSearchResults(d,c) | |
}}}; | |
ZmSearchController.prototype.openNewSearchTab=function(){this._toolbarSearch({isEmpty:true,origin:ZmId.SEARCH}) | |
}; | |
ZmSearchController.prototype._handleLoadShowResults=function(b,a,c){appCtxt.setCurrentList(b.getResults(b.type)); | |
if(!c){this.updateOverview(a) | |
}}; | |
ZmSearchController.prototype._handleErrorDoSearch=function(b,a){if(a.code==ZmCsfeException.MAIL_NO_SUCH_TAG||a.code==ZmCsfeException.MAIL_QUERY_PARSE_ERROR||a.code==ZmCsfeException.MAIL_TOO_MANY_TERMS||(a.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER&&!(a.data.itemId&&a.data.itemId.length))){var c=a.getErrorMsg(); | |
appCtxt.setStatusMsg(c,ZmStatusView.LEVEL_WARNING); | |
return true | |
}return false | |
}; | |
ZmSearchController.generateQueryForShares=function(g,e){var j=window.parentAppCtxt||window.appCtxt; | |
var f=[]; | |
var c=j.getApp(ZmItem.APP[g]); | |
if(!c){return null | |
}var a=c.getRemoteFolderIds(e); | |
for(var d=0; | |
d<a.length; | |
d++){var b=a[d]; | |
var h=AjxUtil.isNumeric(b)?b:['"',b,'"'].join(""); | |
f.push("inid:"+h) | |
}if(f.length>0){f.push("is:local"); | |
return f.join(" OR ") | |
}return null | |
}; | |
ZmSearchController.prototype._searchButtonListener=function(a){this._toolbarSearch({ev:a,zimletEvent:"onSearchButtonClick",origin:ZmId.SEARCH}) | |
}; | |
ZmSearchController.prototype._toolbarSearch=function(d){var a=d.searchFor||this._searchToolBar.getSearchType(); | |
if(a&&a.listener){a.listener.run(d.ev) | |
}else{var e=!d.isEmpty?d.query||this._searchToolBar.getSearchFieldValue():""; | |
var b=(e.length>0); | |
if(e){this._currentQuery=null | |
}else{e=this._currentQuery||"" | |
}appCtxt.notifyZimlets(d.zimletEvent,[e]); | |
var c={query:e,userText:b,userInitiated:true,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),searchFor:a,skipUpdateSearchToolbar:d.skipUpdateSearchToolbar,origin:d.origin,sessionId:d.sessionId,errorCallback:d.errorCallback,sortBy:d.sortBy,isEmpty:d.isEmpty||!e}; | |
this.search(c) | |
}}; | |
ZmSearchController.prototype._searchMenuListener=function(h,a,f){var d=this._searchToolBar.getButton(ZmSearchToolBar.TYPES_BUTTON); | |
if(!d){return | |
}var b=d.getMenu(); | |
var i=h?h.item:(b.getItemById(ZmOperation.MENUITEM_ID,a)); | |
if(!i||(!!(i._style&DwtMenuItem.SEPARATOR_STYLE))){return | |
}a=i.getData(ZmOperation.MENUITEM_ID); | |
var c=b.getSelectedItem(); | |
var k=b.getItemById(ZmOperation.MENUITEM_ID,ZmId.SEARCH_SHARED); | |
if(a==ZmId.SEARCH_GAL){this._contactSource=ZmId.SEARCH_GAL; | |
if(k){k.setChecked(false,true); | |
k.setEnabled(false) | |
}}else{if(k){if(a==ZmItem.APPT||a==ZmId.SEARCH_CUSTOM){if(this._sharedMenuItemChecked==null){this._sharedMenuItemChecked=k.getChecked() | |
}k.setChecked(false,true); | |
k.setEnabled(false) | |
}else{k.setEnabled(true); | |
if(this._sharedMenuItemChecked){k.setChecked(true,true) | |
}this._sharedMenuItemChecked=null | |
}}this._contactSource=ZmItem.CONTACT | |
}this._inclSharedItems=k&&k.getChecked(); | |
var e=b.getItemById(ZmOperation.MENUITEM_ID,ZmId.SEARCH_ALL_ACCOUNTS); | |
if(e){if(a==ZmItem.APPT){this.resetSearchAllAccounts(); | |
e.setEnabled(false) | |
}else{e.setEnabled(true); | |
this.searchAllAccounts=e&&e.getChecked() | |
}}if(a==ZmId.SEARCH_SHARED){var g=this.searchAllAccounts?e.getImage():c.getImage(); | |
if(this._inclSharedItems){g=this._getSharedImage(c) | |
}d.setImage(g) | |
}else{if(a==ZmId.SEARCH_ALL_ACCOUNTS){var g=(this.searchAllAccounts&&!this._inclSharedItems)?i.getImage():(this._inclSharedItems)?this._getSharedImage(c):c.getImage(); | |
d.setImage(g) | |
}else{this._searchFor=a; | |
var g=i.getImage(); | |
if(this._inclSharedItems){g=this._getSharedImage(c) | |
}else{if(this.searchAllAccounts){g=e.getImage() | |
}}d.setImage(g) | |
}}var j=ZmMsg[ZmSearchToolBar.TT_MSG_KEY[a]]; | |
if(a!=ZmId.SEARCH_SHARED&&a!=ZmId.SEARCH_ALL_ACCOUNTS){d.setToolTipContent(j); | |
d.setAttribute("aria-label",j) | |
}if(!f){setTimeout(this._searchToolBar.focus.bind(this._searchToolBar),10) | |
}}; | |
ZmSearchController.prototype._getSharedImage=function(a){var b=a&&a.getData(ZmOperation.MENUITEM_ID); | |
return(b&&ZmSearchToolBar.SHARE_ICON[b])?ZmSearchToolBar.SHARE_ICON[b]:ZmSearchToolBar.ICON[b] | |
}; | |
ZmSearchController.prototype._getNormalizedId=function(c){var b=c; | |
var a=appCtxt.getActiveAccount(); | |
if(!a.isMain&&c.indexOf(":")==-1){b=a.id+":"+c | |
}return b | |
}; | |
ZmSearchController.prototype._handleOfflineResponseDoSearch=function(c,e,b){if(c.sortBy===ZmSearch.DATE_DESC){b.sort(function(g,f){return f.d-g.d | |
}) | |
}else{if(c.sortBy===ZmSearch.DATE_ASC){b.sort(function(g,f){return g.d-f.d | |
}) | |
}}var a=new ZmSearchResult(c); | |
if(c.searchFor===ZmId.SEARCH_MAIL||c.parsedSearchFor===ZmId.SEARCH_MAIL){c.types=new AjxVector([ZmItem.MSG]); | |
a.set({m:b}) | |
}else{if(c.searchFor===ZmItem.CONTACT||c.contactSource===ZmItem.CONTACT){a.set({cn:b}) | |
}}var d=new ZmCsfeResult(a); | |
e(d); | |
if(c.folderId==ZmFolder.ID_OUTBOX||c.folderId==ZmFolder.ID_DRAFTS){ZmOffline.updateFolderCountCallback(c.folderId,b.length) | |
}}; | |
ZmSearchController.prototype._addOfflineDrafts=function(c,a){var d=this._addOfflineDraftsCallback.bind(this,c,a); | |
var b={methodName:"SaveDraftRequest"}; | |
ZmOfflineDB.getItemInRequestQueue(b,d,d) | |
}; | |
ZmSearchController.prototype._addOfflineDraftsCallback=function(c,a,b){var d=ZmOffline.generateMsgResponse(b); | |
this._handleResponseDoIndexedDBSearch(c,[].concat(a).concat(d)) | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmSearchResultsController")){ZmSearchResultsController=function(a,d,b,c){ZmController.apply(this,arguments); | |
this._initialize() | |
}; | |
ZmSearchResultsController.prototype=new ZmController; | |
ZmSearchResultsController.prototype.constructor=ZmSearchController; | |
ZmSearchResultsController.prototype.isZmSearchResultsController=true; | |
ZmSearchResultsController.prototype.toString=function(){return"ZmSearchResultsController" | |
}; | |
ZmSearchResultsController.DEFAULT_TAB_TEXT=ZmMsg.search; | |
ZmSearchResultsController.getDefaultViewType=function(){return ZmId.VIEW_SEARCH_RESULTS | |
}; | |
ZmSearchResultsController.prototype.getDefaultViewType=ZmSearchResultsController.getDefaultViewType; | |
ZmSearchResultsController.prototype.show=function(b,c){var a=b.type; | |
b.search.sessionId=this.sessionId; | |
var d=this._resultsApp=appCtxt.getApp(ZmItem.APP[a])||appCtxt.getCurrentApp(); | |
if(!c){d.showSearchResults(b,this._displayResults.bind(this,b.search),this) | |
}else{this._displayResults(b.search,c) | |
}appCtxt.searchAppName=d.getName(); | |
this._curSearch=b.search; | |
this.inactive=true | |
}; | |
ZmSearchResultsController.prototype.showOverview=function(a){var d=this._resultsApp.getOverview(),b=appCtxt.getAppViewMgr(); | |
if(d){var c={}; | |
c[ZmAppViewMgr.C_TREE]=a?d:this._filterPanel; | |
b.setViewComponents(this.viewId,c,true); | |
b.displayComponent(ZmAppViewMgr.C_TREE_FOOTER,a,true) | |
}}; | |
ZmSearchResultsController.prototype._initialize=function(){this._toolbar=new ZmSearchResultsToolBar({parent:this._container,controller:this,id:DwtId.makeId(ZmId.SEARCHRESULTS_TOOLBAR,this._currentViewId),noMenuButton:true}); | |
this._toolbar.getButton(ZmSearchToolBar.SEARCH_BUTTON).addSelectionListener(this._searchListener.bind(this)); | |
var a=this._toolbar.getButton(ZmSearchToolBar.SAVE_BUTTON); | |
if(a){a.addSelectionListener(this._saveListener.bind(this)) | |
}this._toolbar.registerEnterCallback(this._searchListener.bind(this)); | |
this.isPinned=false | |
}; | |
ZmSearchResultsController.prototype._displayResults=function(i,g){var f=g.getApp().getName(); | |
if(!this._filterPanel||this._filterPanel._resultsApp!==f){this._filterPanel=new ZmSearchResultsFilterPanel({parent:this._container,controller:this,id:DwtId.makeId(ZmId.SEARCHRESULTS_PANEL,this._currentViewId),resultsApp:f}) | |
}this._resultsController=g; | |
var a={}; | |
a[ZmAppViewMgr.C_TREE]=this._filterPanel; | |
a[ZmAppViewMgr.C_TOOLBAR_TOP]=g.getCurrentToolbar(); | |
a[ZmAppViewMgr.C_APP_CONTENT]=g.getViewMgr?g.getViewMgr():g.getCurrentView(); | |
if(appCtxt.getCurrentViewId().indexOf(this._currentViewId)!==-1){appCtxt.getAppViewMgr().setViewComponents(this._currentViewId,a,true) | |
}else{var e={}; | |
e[ZmAppViewMgr.CB_POST_REMOVE]=this._postRemoveCallback.bind(this); | |
e[ZmAppViewMgr.CB_POST_SHOW]=this._postShowCallback.bind(this); | |
a[ZmAppViewMgr.C_SEARCH_RESULTS_TOOLBAR]=this._toolbar; | |
this._app.createView({viewId:this._currentViewId,viewType:this._currentViewType,elements:a,callbacks:e,controller:this,hide:[ZmAppViewMgr.C_TREE_FOOTER],tabParams:this._getTabParams()}); | |
this._app.pushView(this._currentViewId); | |
this._filterPanel.reset(); | |
if(!this._button){this._button=appCtxt.getAppChooser().getButton(this.tabId); | |
Dwt.addClass(this._button.getHtmlElement(),"SearchTabButton"); | |
this._button.addSelectionListener(this._pinnedListener.bind(this)) | |
}}if(i&&i.query){this._filterPanel.resetBasicFiltersToQuery(i.query) | |
}if(i&&i.origin==ZmId.SEARCH){this._toolbar.setSearch(i) | |
}var c=g.getCurrentSearchResults&&g.getCurrentSearchResults(); | |
var b=(c&&c.getResults())||g.getList(); | |
var j=b&&b.size&&b.size(); | |
var d=(b&&b.hasMore&&b.hasMore())?"+":""; | |
var h=j?AjxMessageFormat.format(ZmMsg.searchResultsLabel,[j,d]):i.isEmpty?ZmMsg.searchResultsEnterSearch:ZmMsg.searchResultsLabelNone; | |
this._toolbar.setLabel(h,false); | |
if(g&&g.updateTimeIndicator){g.updateTimeIndicator() | |
}setTimeout(this._toolbar.focus.bind(this._toolbar),100) | |
}; | |
ZmSearchResultsController.prototype._postHideCallback=function(){}; | |
ZmSearchResultsController.prototype._postRemoveCallback=function(){this._app.deleteSessionController({appName:this._resultsApp.getName(),controllerClass:"ZmSearchResultsController",sessionId:this.sessionId}) | |
}; | |
ZmSearchResultsController.prototype._postShowCallback=function(){if(appCtxt.isWebClientOfflineSupported){this.getApp().resetWebClientOfflineOperations(this) | |
}}; | |
ZmSearchResultsController.prototype._getTabParams=function(){return{id:this.tabId,leftImage:"Pin",rightImage:"CloseGray",rightHoverImage:"Close",text:ZmSearchResultsController.DEFAULT_TAB_TEXT,textPrecedence:90,tooltip:ZmSearchResultsController.DEFAULT_TAB_TEXT,style:DwtLabel.IMAGE_BOTH} | |
}; | |
ZmSearchResultsController.prototype._searchListener=function(d,h){var c=this._toolbar,b=c&&c._searchField.getInputElement(); | |
if(b&&c._acList){c._settingSearch=true; | |
c._acList._complete(b); | |
c._settingSearch=false | |
}var a=appCtxt.getCurrentViewId(); | |
var g=a?appCtxt.get(ZmSetting.SORTING_PREF,a):null; | |
var e=this._toolbar.getSearchFieldValue(); | |
var f={ev:d,zimletEvent:h||"onSearchButtonClick",query:e,isEmpty:!e,sessionId:this.sessionId,skipUpdateSearchToolbar:true,origin:ZmId.SEARCHRESULTS,searchFor:this._curSearch&&this._curSearch.searchFor,sortBy:g,errorCallback:this._errorCallback.bind(this)}; | |
c.setLabel(ZmMsg.searching); | |
appCtxt.getSearchController()._toolbarSearch(f) | |
}; | |
ZmSearchResultsController.prototype._errorCallback=function(a){var b=ZmCsfeException.getErrorMsg(a.code); | |
b=b||ZmMsg.unknownError; | |
this._toolbar.setLabel(b,true); | |
return true | |
}; | |
ZmSearchResultsController.prototype._saveListener=function(b){var a=appCtxt.getOverviewController().getTreeController(ZmOrganizer.SEARCH); | |
if(!a._newCb){a._newCb=a._newCallback.bind(a) | |
}var c={search:this._curSearch,appName:this._resultsApp.getName()}; | |
ZmController.showDialog(a._getNewDialog(),a._newCb,c) | |
}; | |
ZmSearchResultsController.prototype._pinnedListener=function(b){if(!Dwt.hasClass(b.target,"ImgPin")&&!Dwt.hasClass(b.target,"ImgUnpin")){return | |
}this.isPinned=!this.isPinned; | |
var a=appCtxt.getAppChooser().getButton(this.tabId); | |
a.setImage(this.isPinned?"Unpin":"Pin",DwtLabel.LEFT) | |
}; | |
ZmSearchResultsController.prototype._closeListener=function(a){appCtxt.getAppViewMgr().popView(false,this.getCurrentViewId()) | |
}; | |
ZmSearchResultsController.prototype.addSearchTerm=function(c,b,a){return this._toolbar.addSearchTerm(c,b,a) | |
}; | |
ZmSearchResultsController.prototype.removeSearchTerm=function(b,a){this._toolbar.removeSearchTerm(b,a) | |
}; | |
ZmSearchResultsController.prototype.getSearchTerms=function(c,b){var a=this._toolbar._searchField.getAddresses(); | |
var d=AjxUtil.map(a,function(f,e){return new ZmSearchToken(f) | |
}); | |
return d | |
} | |
}if(AjxPackage.define("zimbraMail.share.controller.ZmActionController")){ZmActionController=function(){this._actionStack=new ZmActionStack(1); | |
this._statusTransitions=ZmActionController._substituteTransitions(appCtxt.getSkinHint("toast","transitions")||ZmToast.DEFAULT_TRANSITIONS); | |
this._outsideListener=new AjxListener(this,ZmActionController.prototype._outsideMouseDownListener); | |
appCtxt.getKeyboardMgr().addListener(DwtEvent.ONKEYDOWN,this._outsideListener) | |
}; | |
ZmActionController.prototype.toString=function(){return"ZmActionController" | |
}; | |
ZmActionController.prototype.actionPerformed=function(b){var a=this._actionStack.logAction(b); | |
if(a){this.dismiss(); | |
a.onComplete(new AjxCallback(this,this._handleActionComplete)) | |
}return a | |
}; | |
ZmActionController.prototype._handleActionComplete=function(a){this._active=true | |
}; | |
ZmActionController.prototype.getUndoLink=function(b,c){if(b instanceof ZmAction){var a=ZmActionController._registerCallback(new AjxCallback(this,this.undoCurrent)); | |
return["<a onclick='ZmActionController.callRegisteredCallback(",a,")' href='javascript:;' class='undo'>",c||ZmMsg.undo,"</a>"].join("") | |
}else{return"" | |
}}; | |
ZmActionController.prototype.getStatusTransitions=function(){return this._statusTransitions | |
}; | |
ZmActionController.prototype.undo=function(a){if(this._active){this.dismiss(); | |
a.undo() | |
}}; | |
ZmActionController.prototype.undoCurrent=function(){if(this._actionStack.canUndo()){if(this._actionStack.actionIsComplete()){if(this._active){this.dismiss() | |
}this._actionStack.undo() | |
}else{this._actionStack.onComplete(new AjxCallback(this,function(a){setTimeout(AjxCallback.simpleClosure(this.undo,this,a),0) | |
})) | |
}}}; | |
ZmActionController.prototype.onPopup=function(){var a=appCtxt.getOutsideMouseEventMgr(); | |
var b={id:"ZmActionController",obj:this,elementId:ZmId.TOAST,outsideListener:this._outsideListener}; | |
a.startListening(b) | |
}; | |
ZmActionController.prototype.dismiss=function(){appCtxt.dismissStatusMsg(true); | |
var a=appCtxt.getOutsideMouseEventMgr(); | |
a.stopListening("ZmActionController"); | |
this._active=false | |
}; | |
ZmActionController._substituteTransitions=function(d){var c=[]; | |
var b=false; | |
for(var a=0; | |
a<d.length; | |
a++){var e=d[a]; | |
if(e){if(e.type==ZmToast.PAUSE.type){if(!b){b=true; | |
c.push(ZmToast.HOLD) | |
}}else{c.push(e) | |
}}}return c | |
}; | |
ZmActionController._registeredCallbacks=[]; | |
ZmActionController._registerCallback=function(b){var a=ZmActionController._registeredCallbacks.length; | |
ZmActionController._registeredCallbacks[a]=b; | |
return a | |
}; | |
ZmActionController.callRegisteredCallback=function(b){var a=ZmActionController._registeredCallbacks[b]; | |
if(a){if(a instanceof AjxCallback){a.run() | |
}else{if(AjxUtil.isFunction(a)){a() | |
}}}}; | |
ZmActionController.prototype._outsideMouseDownListener=function(a){this.dismiss() | |
} | |
}if(AjxPackage.define("zimbraMail.core.ZmAppViewMgr")){ZmAppViewMgr=function(d,b,a,c){ZmAppViewMgr._setContainerIds(); | |
this._shell=d; | |
this._controller=b; | |
this._isNewWindow=a; | |
this._hasSkin=c; | |
this._shellSz=this._shell.getSize(); | |
this._shell.addControlListener(this._shellControlListener.bind(this)); | |
this._sashSupported=(window.skin&&typeof window.skin.setTreeWidth=="function"); | |
if(appCtxt.get(ZmSetting.HISTORY_SUPPORT_ENABLED)&&!a&&!AjxEnv.isPrism){this._historyMgr=appCtxt.getHistoryMgr(); | |
this._historyMgr.addListener(this._historyChangeListener.bind(this)) | |
}this._hashViewId={}; | |
this._nextHashIndex=0; | |
this._curHashIndex=0; | |
this._noHistory=false; | |
this._ignoreHistoryChange=false; | |
this._lastViewId=null; | |
this._currentViewId=null; | |
this._hidden=[]; | |
this._toRemove=[]; | |
this._view={}; | |
this._component={}; | |
this._app={}; | |
this._emptyView={component:{},callback:{},hide:{}}; | |
this._viewByTabId={}; | |
this._pushCallback=this.pushView.bind(this); | |
this._popCallback=this.popView.bind(this); | |
this._createLoadingView() | |
}; | |
ZmAppViewMgr.prototype.isZmAppViewMgr=true; | |
ZmAppViewMgr.prototype.toString=function(){return"ZmAppViewMgr" | |
}; | |
ZmAppViewMgr.C_BANNER="banner"; | |
ZmAppViewMgr.C_USER_INFO="userInfo"; | |
ZmAppViewMgr.C_QUOTA_INFO="quota"; | |
ZmAppViewMgr.C_SEARCH="search"; | |
ZmAppViewMgr.C_APP_CHOOSER="appChooser"; | |
ZmAppViewMgr.C_TREE="tree"; | |
ZmAppViewMgr.C_TOOLBAR_TOP="topToolbar"; | |
ZmAppViewMgr.C_NEW_BUTTON="newButton"; | |
ZmAppViewMgr.C_APP_CONTENT="main"; | |
ZmAppViewMgr.C_SASH="sash"; | |
ZmAppViewMgr.C_TREE_FOOTER="treeFooter"; | |
ZmAppViewMgr.C_SEARCH_RESULTS_TOOLBAR="searchResultsToolbar"; | |
ZmAppViewMgr.LEFT_NAV=[ZmAppViewMgr.C_NEW_BUTTON,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_SASH]; | |
ZmAppViewMgr.GLOBAL="Global"; | |
ZmAppViewMgr.APP="App"; | |
ZmAppViewMgr.CONT_ID_KEY={}; | |
ZmAppViewMgr.CB_PRE_HIDE="PRE_HIDE"; | |
ZmAppViewMgr.CB_POST_HIDE="POST_HIDE"; | |
ZmAppViewMgr.CB_PRE_SHOW="PRE_SHOW"; | |
ZmAppViewMgr.CB_POST_SHOW="POST_SHOW"; | |
ZmAppViewMgr.CB_PRE_UNLOAD="PRE_UNLOAD"; | |
ZmAppViewMgr.CB_POST_REMOVE="POST_REMOVE"; | |
ZmAppViewMgr.PENDING_VIEW="ZmAppViewMgr.PENDING_VIEW"; | |
ZmAppViewMgr.BROWSER_BACK="BACK"; | |
ZmAppViewMgr.BROWSER_FORWARD="FORWARD"; | |
ZmAppViewMgr.TAB_BUTTON_MAX_TEXT=15; | |
ZmAppViewMgr._setContainerIds=function(){ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_BANNER]=ZmId.SKIN_LOGO; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_USER_INFO]=ZmId.SKIN_USER_INFO; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_QUOTA_INFO]=ZmId.SKIN_QUOTA_INFO; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SEARCH]=ZmId.SKIN_SEARCH; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SEARCH_RESULTS_TOOLBAR]=ZmId.SKIN_SEARCH_RESULTS_TOOLBAR; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CHOOSER]=ZmId.SKIN_APP_CHOOSER; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_TREE]=ZmId.SKIN_TREE; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_TREE_FOOTER]=ZmId.SKIN_TREE_FOOTER; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_TOOLBAR_TOP]=ZmId.SKIN_APP_TOP_TOOLBAR; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_NEW_BUTTON]=ZmId.SKIN_APP_NEW_BUTTON; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT]=ZmId.SKIN_APP_MAIN; | |
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SASH]=ZmId.SKIN_SASH; | |
ZmAppViewMgr.ALL_COMPONENTS=AjxUtil.keys(ZmAppViewMgr.CONT_ID_KEY) | |
}; | |
ZmAppViewMgr.prototype.getViewComponent=function(f,a){var b=this._view[a||this._currentViewId]||this._emptyView; | |
var e=b.app||appCtxt.getCurrentAppName(); | |
var d=this._view[e]; | |
var c=this._view[ZmAppViewMgr.GLOBAL]; | |
return((b&&b.component[f])||(d&&d.component[f])||(c&&c.component[f])) | |
}; | |
ZmAppViewMgr.prototype.getCurrentViewComponent=ZmAppViewMgr.prototype.getViewComponent; | |
ZmAppViewMgr.prototype._getView=function(a,c){var b; | |
if(a==ZmAppViewMgr.GLOBAL){b=this._view[a]||this.createView({viewId:a}) | |
}else{if(a==ZmAppViewMgr.APP){a=c||appCtxt.getCurrentAppName(); | |
b=this._view[a]||this.createView({viewId:a}) | |
}else{b=this._view[a||this._currentViewId]||this.createView({viewId:a}) | |
}}return b | |
}; | |
ZmAppViewMgr.prototype.setViewComponents=function(n,h,m,c){var l=this._getView(n,c); | |
if(!l){return | |
}var f=0; | |
var a=AjxUtil.arraySize(h); | |
for(var k in h){var g=h[k]; | |
if(!g){continue | |
}if(this.isHidden(k,n)){continue | |
}var b=m&&!this.isHidden(k,this._currentViewId); | |
if(b){var j=this._component[k]&&this._component[k].control; | |
if(j&&(j!=g)){this.showComponent(k,false,j) | |
}}l.component[k]=g; | |
if(this._hasSkin){this.getContainer(k,g) | |
}this.displayComponent(k,b,false,null,true); | |
if(k==ZmAppViewMgr.C_SASH){if(this._sashSupported){g.registerCallback(this._appTreeSashCallback,this); | |
if(appCtxt.get(ZmSetting.FOLDER_TREE_SASH_WIDTH)){var e=appCtxt.get(ZmSetting.FOLDER_TREE_SASH_WIDTH); | |
var d=skin.getTreeWidth(); | |
this._appTreeSashCallback(e-d) | |
}}g.setCursor("default") | |
}f++ | |
}if(m){this.fitAll() | |
}}; | |
ZmAppViewMgr.prototype.addComponents=ZmAppViewMgr.prototype.setViewComponents; | |
ZmAppViewMgr.prototype.isHidden=function(f,a){var b=this._view[a||this._currentViewId]||this._emptyView; | |
var e=b.app||appCtxt.getCurrentAppName(); | |
var d=this._view[e]; | |
var c=this._view[ZmAppViewMgr.GLOBAL]; | |
if(b&&b.component[f]){return false | |
}else{if(b&&b.hide[f]){return true | |
}else{if(d&&d.component[f]){return false | |
}else{if(d&&d.hide[f]){return true | |
}else{if(c&&c.component[f]){return false | |
}else{return c&&c.hide[f] | |
}}}}}}; | |
ZmAppViewMgr.prototype.setHiddenComponents=function(b,a,e,f){a=AjxUtil.toArray(a); | |
var c=this._getView(b,f); | |
if(!c){return | |
}for(var d=0; | |
d<a.length; | |
d++){c.hide[a[d]]=e | |
}}; | |
ZmAppViewMgr.prototype.showSkinElement=function(c,a,b){if(this._hasSkin){skin.show(c,a,b) | |
}}; | |
ZmAppViewMgr.prototype.showComponent=function(c,a,b){b=b||this.getViewComponent(c); | |
if(b){if(a){b.zShow(true); | |
b.noTab=false | |
}else{if(b.getPosition()==Dwt.ABSOLUTE_STYLE){b.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE) | |
}b.zShow(false); | |
b.noTab=true | |
}}}; | |
ZmAppViewMgr.prototype.displayComponent=function(e,a,c,b,d){this.showSkinElement(e,a,d); | |
this.showComponent(e,a,b); | |
if(c){this._fitToContainer(e) | |
}}; | |
ZmAppViewMgr.prototype.getContainer=function(g,b){var c=this._component[g]=this._component[g]||{}; | |
if(!c.container){var f=ZmAppViewMgr.CONT_ID_KEY[g]; | |
var a=document.getElementById(f); | |
if(!a){return null | |
}c.container=a; | |
if(b){a.innerHTML=""; | |
var e=this._getContainerBounds(g); | |
var d=Boolean(this.getViewComponent(ZmAppViewMgr.C_TOOLBAR_TOP)); | |
if(e){b.setBounds(e.x,e.y,e.width,e.height,d) | |
}}}return c.container | |
}; | |
ZmAppViewMgr.prototype.getCurrentViewId=function(){return this._currentViewId | |
}; | |
ZmAppViewMgr.prototype.getCurrentViewType=function(){var a=this._view[this._currentViewId]; | |
return a?a.type:"" | |
}; | |
ZmAppViewMgr.prototype.getLastViewId=function(){return this._lastViewId | |
}; | |
ZmAppViewMgr.prototype.getCurrentView=function(a){return this.getViewComponent(ZmAppViewMgr.C_APP_CONTENT,a||this._currentViewId) | |
}; | |
ZmAppViewMgr.prototype.getAppView=function(a){return this._app[a]&&this._app[a].viewId | |
}; | |
ZmAppViewMgr.prototype.setAppView=function(b,a){if(!b||!a){return | |
}var b=this._app[b]; | |
if(!b){b=this._app[b]={} | |
}b.viewId=a | |
}; | |
ZmAppViewMgr.prototype.getViewsByType=function(c,e){var d=[]; | |
for(var a in this._view){var b=this._view[a]; | |
if(b.type==c&&(!e||b.visible)){d.push(b) | |
}}return d | |
}; | |
ZmAppViewMgr.prototype.isVisible=function(a){var b=this._view[a]; | |
return b&&b.visible | |
}; | |
ZmAppViewMgr.prototype.createView=function(e){e=e||{}; | |
var a=e.viewId; | |
if(!a){return null | |
}var b=this._view[a]={id:a,type:e.viewType||a,component:e.elements||{},controller:e.controller,callback:e.callbacks||{},app:e.appName,isAppView:e.isAppView,isTransient:e.isTransient,isFullScreen:e.isFullScreen,hide:AjxUtil.arrayAsHash(e.hide||[])}; | |
if(e.appName&&!this._app[e.appName]){this._app[e.appName]={} | |
}if(!this._isNewWindow&&e.tabParams){b.tabParams=e.tabParams; | |
b.isTabView=true; | |
this._viewByTabId[e.tabParams.id]=a | |
}var d=e.isAppView&&e.elements&&e.elements[ZmAppViewMgr.C_APP_CONTENT],c=d&&d.getHtmlElement(); | |
if(c){c.setAttribute("role","main") | |
}return b | |
}; | |
ZmAppViewMgr.prototype.pushView=function(m,b){if(!m){return false | |
}m=this._viewByTabId[m]||m; | |
var j=this._view[m]||this._emptyView; | |
var c=(m==ZmAppViewMgr.PENDING_VIEW); | |
if(!c&&!j){return false | |
}if(c){m=this._pendingView | |
}var a=j.controller; | |
if(m==this._currentViewId){if(a){a._restoreFocus() | |
}return true | |
}if(j.isTabView){var l=j.tabParams; | |
var g=l&&l.tabCallback&&l.tabCallback.run(this._currentViewId,m); | |
if(l&&!g){var o=appCtxt.getAppChooser(); | |
var f=o.getButton(l.id); | |
if(!f){f=o.addButton(l.id,l); | |
f.setHoverImage("Close","right") | |
}}}if(c){b=true | |
}var k=this._view[this._currentViewId]||this._emptyView; | |
if(!this._hideView(this._currentViewId,b||k.isTabView,false,m)){this._pendingAction=this._pushCallback; | |
this._pendingView=m; | |
return false | |
}this.setViewComponents(m,j.component); | |
var h=k.controller; | |
var d=k.isTransient||(h&&h.isTransient(this._currentViewId,m)); | |
if(this._currentViewId&&(this._currentViewId!=m)&&!d){this._hidden.push(this._currentViewId) | |
}this._removeFromHidden(m); | |
var n=this._lastViewId; | |
this._lastViewId=this._currentViewId; | |
this._currentViewId=m; | |
if(!this._showView(m,b,(m!=this._currentViewId))){this._currentViewId=this._lastViewId; | |
this._lastViewId=n; | |
this._pendingAction=this._pushCallback; | |
this._pendingView=m; | |
return false | |
}if(this._noHistory){this._noHistory=false | |
}else{if(m!=ZmId.VIEW_LOADING){this._nextHashIndex++; | |
this._curHashIndex=this._nextHashIndex; | |
this._hashViewId[this._curHashIndex]=m; | |
if(this._historyMgr){this._historyMgr.add(this._curHashIndex) | |
}}}this._layout(this._currentViewId); | |
if(a&&a.setCurrentViewId){a.setCurrentViewId(m) | |
}if(j.isAppView){this.setAppView(j.app,m) | |
}if(this._toRemove.length){for(var e=0; | |
e<this._toRemove.length; | |
e++){this._removeFromHidden(this._toRemove[e]) | |
}this._toRemove=[] | |
}return true | |
}; | |
ZmAppViewMgr.prototype.popView=function(b,h,e){h=this._viewByTabId[h]||h; | |
var f=this._view[h]||this._emptyView; | |
if(!this._currentViewId){return false | |
}var c=(b==ZmAppViewMgr.PENDING_VIEW); | |
if(c){h=b; | |
b=true | |
}if(h&&!c&&(this._currentViewId!=h)){if(f.isTabView&&(this._currentViewId!=h)){this.pushView(h) | |
}else{return false | |
}}var j=false,d=false; | |
var a=null; | |
var g=this._view[this._currentViewId]||this._emptyView; | |
if(!this._hidden.length&&!this._isNewWindow){j=!g.isTabView; | |
d=true; | |
a=appCtxt.getCurrentAppName()||appCtxt.startApp | |
}if(!this._hideView(this._currentViewId,b,j)){this._pendingAction=this._popCallback; | |
this._pendingView=null; | |
return false | |
}this._deactivateView(this._currentViewId); | |
if(g.isTabView){appCtxt.getAppChooser().removeButton(g.tabParams.id); | |
var i=g.callback[ZmAppViewMgr.CB_POST_REMOVE]; | |
if(i){i.run() | |
}}if(d){if(a){this._controller.activateApp(ZmApp.MAIL) | |
}return !j | |
}this._lastViewId=this._currentViewId; | |
this._currentViewId=this._hidden.pop(); | |
if(!this._currentViewId&&this._isNewWindow){window.close(); | |
return false | |
}if(!this._showView(this._currentViewId,this._popCallback,null,b,true)){return false | |
}this._removeFromHidden(this._currentViewId); | |
if(this._historyMgr&&!e){if(this._noHistory){this._noHistory=false | |
}else{this._ignoreHistoryChange=true; | |
history.back() | |
}}this._layout(this._currentViewId); | |
return true | |
}; | |
ZmAppViewMgr.prototype.setView=function(b,d){var a=this.pushView(b,d); | |
if(a){for(var c=0; | |
c<this._hidden.length; | |
c++){this._deactivateView(this._hidden[c]) | |
}this._hidden=[] | |
}return a | |
}; | |
ZmAppViewMgr.prototype.stageView=function(a){this._removeFromHidden(a); | |
this._hidden.push(a) | |
}; | |
ZmAppViewMgr.prototype.isAppView=function(a){var b=this._view[a||this._currentViewId]||this._emptyView; | |
return b.isAppView | |
}; | |
ZmAppViewMgr.prototype.isFullScreen=function(a){var b=this._view[a||this._currentViewId]||this._emptyView; | |
return b.isFullScreen | |
}; | |
ZmAppViewMgr.prototype.showPendingView=function(a){if(a&&this._pendingAction){this._pendingAction.run(ZmAppViewMgr.PENDING_VIEW) | |
}if(!a){if(this._browserAction==ZmAppViewMgr.BROWSER_BACK){this._ignoreHistoryChange=true; | |
history.forward() | |
}else{if(this._browserAction==ZmAppViewMgr.BROWSER_FORWARD){this._ignoreHistoryChange=true; | |
history.back() | |
}}this._browserAction=null | |
}this._pendingAction=this._pendingView=null | |
}; | |
ZmAppViewMgr.prototype.fitAll=function(){this._shell.relayout(); | |
this._fitToContainer(ZmAppViewMgr.ALL_COMPONENTS) | |
}; | |
ZmAppViewMgr.prototype.getPendingViewId=function(){return this._pendingView | |
}; | |
ZmAppViewMgr.prototype.updateTitle=function(){this._setTitle(this._currentViewId) | |
}; | |
ZmAppViewMgr.prototype.setTabTitle=function(a,e){var b=this._view[a||this._currentViewId]||this._emptyView; | |
var d=b.tabParams; | |
var c=!appCtxt.isChildWindow&&d&&appCtxt.getAppChooser().getButton(d.id); | |
if(c){c.setText(AjxStringUtil.htmlEncode(e)) | |
}}; | |
ZmAppViewMgr.prototype.isOkToUnload=function(){for(var a in this._view){var b=this._view[a]; | |
var d=b&&b.callback&&b.callback[ZmAppViewMgr.CB_PRE_UNLOAD]; | |
if(d){var c=d.run(a); | |
if(!c){return false | |
}}}return true | |
}; | |
ZmAppViewMgr.prototype._createLoadingView=function(){this.loadingView=new DwtControl({parent:this._shell,className:"DwtListView",posStyle:Dwt.ABSOLUTE_STYLE,id:ZmId.LOADING_VIEW}); | |
var a=this.loadingView.getHtmlElement(); | |
a.innerHTML=AjxTemplate.expand("share.App#Loading",this._htmlElId); | |
var b={}; | |
b[ZmAppViewMgr.C_APP_CONTENT]=this.loadingView; | |
this.createView({viewId:ZmId.VIEW_LOADING,elements:b}) | |
}; | |
ZmAppViewMgr.prototype._fitToContainer=function(a,h){var a=AjxUtil.toArray(a); | |
for(var c=0; | |
c<a.length; | |
c++){var g=a[c]; | |
var n=this.getContainer(g); | |
if(n){var f=this.getViewComponent(g); | |
if(f&&!this.isHidden(g,this._currentViewId)){var d=this._getComponentPosition(g); | |
var l=(d==Dwt.STATIC_STYLE); | |
var m=f.getHtmlElement(); | |
if(d){m.style.position=d | |
}var k=this._component[g]; | |
if(l){if(m.parentNode!=n){n.appendChild(m) | |
}if(f.adjustSize){f.adjustSize() | |
}}else{var e=Dwt.getBounds(n); | |
var b=Dwt.getInsets(n); | |
Dwt.insetBounds(e,b); | |
k.bounds=e; | |
var j=Boolean(this._component[ZmAppViewMgr.C_TOOLBAR_TOP].control); | |
f.setBounds(e.x,e.y,e.width,e.height,j) | |
}k.control=f | |
}}}if(window.DBG&&DBG.getDebugLevel()>=AjxDebug.DBG2){this._debugShowMetrics(a) | |
}}; | |
ZmAppViewMgr.prototype._getComponentPosition=function(a){return appCtxt.getSkinHint(a,"position") | |
}; | |
ZmAppViewMgr.prototype._getContainerBounds=function(e){var a=this._getComponentPosition(e); | |
if(a==Dwt.STATIC_STYLE){return null | |
}var c=this.getContainer(e); | |
if(c){var d=Dwt.getBounds(c); | |
var b=Dwt.getInsets(c); | |
Dwt.insetBounds(d,b); | |
return d | |
}return null | |
}; | |
ZmAppViewMgr.prototype._layout=function(b){if(this._hasSkin){return | |
}var c=this.getViewComponent(ZmAppViewMgr.C_TOOLBAR_TOP); | |
if(c){var e=c.getSize(); | |
var a=e.y?e.y:c.getHtmlElement().clientHeight; | |
c.setBounds(0,0,this._shellSz.x,a) | |
}var d=this.getCurrentView(); | |
if(d){d.setBounds(0,a,this._shellSz.x,this._shellSz.y-a,Boolean(c)) | |
}}; | |
ZmAppViewMgr.prototype._hideView=function(a,e,f,c){if(!a){return true | |
}var b=this._view[a]||this._emptyView; | |
var d=true; | |
var g=b.callback[ZmAppViewMgr.CB_PRE_HIDE]; | |
if(g){d=g.run(a,e,c) | |
}if(d){if(!f){this._setViewVisible(a,false) | |
}if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){appCtxt.getKeyboardMgr().clearKeySeq() | |
}g=b.callback[ZmAppViewMgr.CB_POST_HIDE]; | |
if(g){g.run(a,c) | |
}}return d | |
}; | |
ZmAppViewMgr.prototype._showView=function(a,e,d){if(!a){return true | |
}var b=this._view[a]||this._emptyView; | |
var c=true; | |
var f=b.callback[ZmAppViewMgr.CB_PRE_SHOW]; | |
if(f){c=f.run(a,d,e) | |
}if(c){this._setViewVisible(a,true); | |
f=b.callback[ZmAppViewMgr.CB_POST_SHOW]; | |
if(f){f.run(a,d) | |
}}appCtxt.notifyZimlets("onShowView",[a,d]); | |
return c | |
}; | |
ZmAppViewMgr.prototype._setViewVisible=function(j,h){var g=this._view[j]||this._emptyView; | |
g.visible=h; | |
if(h){for(var c=0; | |
c<ZmAppViewMgr.ALL_COMPONENTS.length; | |
c++){var f=ZmAppViewMgr.ALL_COMPONENTS[c]; | |
var e=this.getViewComponent(f,this._lastViewId); | |
if(e){this.displayComponent(f,false,null,e,true) | |
}var d=this.getViewComponent(f,j); | |
if(d){this.displayComponent(f,!this.isHidden(f,j),null,d,true) | |
}}if(this._hasSkin){this.fitAll() | |
}this._setTitle(j); | |
if(g.isTabView){var a=g.tabParams.id; | |
this._controller.setActiveTabId(a) | |
}if(g.app){this._controller.setActiveApp(g) | |
}}else{for(var f in g.component){this.showComponent(f,false) | |
}var b=this._view[g.app]; | |
if(b){for(var f in b.component){this.showComponent(f,false) | |
}}}}; | |
ZmAppViewMgr.prototype._removeFromHidden=function(a){AjxUtil.arrayRemove(this._hidden,a) | |
}; | |
ZmAppViewMgr.prototype._deactivateView=function(a){a=a||this._currentViewId; | |
var b=this._view[a]||this._emptyView; | |
for(var d in b.component){var c=this.getViewComponent(d,a); | |
if(c&&c.deactivate){c.deactivate() | |
}}}; | |
ZmAppViewMgr.prototype._setTitle=function(a){var b=this.getCurrentView(); | |
if(b&&b.getTitle){var c=b.getTitle(); | |
Dwt.setTitle(c?c:ZmMsg.zimbraTitle) | |
}}; | |
ZmAppViewMgr.prototype._shellControlListener=function(d){if(d.oldWidth!=d.newWidth||d.oldHeight!=d.newHeight){this._shellSz.x=d.newWidth; | |
this._shellSz.y=d.newHeight; | |
var c=d.newWidth-d.oldWidth; | |
var f=d.newHeight-d.oldHeight; | |
if(this._isNewWindow){var a=this._view[this._currentViewId]||this._emptyView; | |
if(a.component){var b=a.component[ZmAppViewMgr.C_TOOLBAR_TOP]; | |
if(b){b.setSize(d.newWidth,Dwt.DEFAULT) | |
}var e=this.getCurrentView(); | |
if(e){e.setSize(d.newWidth,d.newHeight-b.getH()) | |
}}}else{this.fitAll() | |
}}}; | |
ZmAppViewMgr.prototype._debugShowMetrics=function(d){for(var b=0; | |
b<d.length; | |
b++){var e=d[b]; | |
var a=this.getContainer(e); | |
if(a){var c=Dwt.getBounds(a) | |
}}}; | |
ZmAppViewMgr.prototype._historyChangeListener=function(c){if(appCtxt.inStartup){return | |
}if(!(c&&c.data)){return | |
}if(this._ignoreHistoryChange){this._ignoreHistoryChange=false; | |
return | |
}var d; | |
while(d=DwtBaseDialog.getActiveDialog()){if(d&&d.isPoppedUp()){d.popdown() | |
}}var b=parseInt(c.data); | |
this._noHistory=true; | |
var a=this._hashViewId[b]; | |
if(b==(this._curHashIndex-1)){this._browserAction=ZmAppViewMgr.BROWSER_BACK; | |
this.popView() | |
}else{if(b==(this._curHashIndex+1)){this._browserAction=ZmAppViewMgr.BROWSER_FORWARD; | |
this.pushView(a) | |
}else{this._browserAction=null; | |
this.pushView(a) | |
}}this._curHashIndex=b | |
}; | |
ZmAppViewMgr.prototype._appTreeSashCallback=function(d){if(!window.skin){return | |
}var a=skin.getTreeWidth(); | |
if(a===null){return 0 | |
}if(!this.treeMinSize){this.treeMinSize=DwtCssStyle.asPixelCount(window.skin.hints.tree.minWidth||150); | |
this.treeMaxSize=DwtCssStyle.asPixelCount(window.skin.hints.tree.maxWidth||1000) | |
}if(a+d>this.treeMaxSize){d=Math.max(0,this.treeMaxSize-a) | |
}if(a+d<this.treeMinSize){d=Math.min(0,this.treeMinSize-a) | |
}var b=a+d; | |
skin.setTreeWidth(b); | |
var c=this; | |
setTimeout(function(){c.fitAll() | |
},0); | |
return d | |
} | |
}if(AjxPackage.define("zimbraMail.core.ZmRequestMgr")){ZmRequestMgr=function(a){this._controller=a; | |
appCtxt.setRequestMgr(this); | |
ZmCsfeCommand.setServerUri(appCtxt.get(ZmSetting.CSFE_SERVER_URI)); | |
var b=appCtxt.get(ZmSetting.CLIENT_VERSION); | |
ZmCsfeCommand.clientVersion=(!b||b.indexOf("@")==0)?"dev build":b; | |
this._shell=appCtxt.getShell(); | |
this._highestNotifySeen=0; | |
this._cancelActionId={}; | |
this._pendingRequests={}; | |
this._useXml=appCtxt.get(ZmSetting.USE_XML); | |
this._logRequest=appCtxt.get(ZmSetting.LOG_REQUEST); | |
this._stdTimeout=appCtxt.get(ZmSetting.TIMEOUT); | |
this._unreadListener=new AjxListener(this,this._unreadChangeListener) | |
}; | |
ZmRequestMgr.prototype.isZmRequestMgr=true; | |
ZmRequestMgr.prototype.toString=function(){return"ZmRequestMgr" | |
}; | |
ZmRequestMgr._SENT=1; | |
ZmRequestMgr._RESPONSE=2; | |
ZmRequestMgr._CANCEL=3; | |
ZmRequestMgr.RETRY_MAX=2; | |
ZmRequestMgr.RETRY_DELAY=5; | |
ZmRequestMgr.RETRY_ON_EXCEPTION={}; | |
ZmRequestMgr.RETRY_ON_EXCEPTION[ZmCsfeException.EMPTY_RESPONSE]=true; | |
ZmRequestMgr._nextReqId=1; | |
ZmRequestMgr.OFFLINE_HEAP_DUMP="heapdump_upload"; | |
ZmRequestMgr.OFFLINE_MUST_RESYNC="resync"; | |
ZmRequestMgr.OFFLINE_MUST_GAL_RESYNC="gal_resync"; | |
ZmRequestMgr.OFFLINE_FOLDER_MOVE_FAILED="foldermove_failed"; | |
ZmRequestMgr.FOCUS_CHECK_DELAY=500; | |
ZmRequestMgr.prototype.sendRequest=function(q){var b=q.response; | |
if(b){if(q.reqId){q=this._pendingRequests[q.reqId]||q; | |
q.response=b | |
}q.asyncMode=true; | |
return this._handleResponseSendRequest(q,new ZmCsfeResult(b)) | |
}if(q.offlineRequest||appCtxt.isWebClientOffline()){if(q.offlineCallback){q.offlineCallback.run(q) | |
}return | |
}var l=q.reqId=("Req_"+ZmRequestMgr._nextReqId++); | |
var g=q.timeout=(q.timeout!=null)?q.timeout:this._stdTimeout; | |
if(g){g=g*1000 | |
}var r=q.asyncMode?new AjxCallback(this,this._handleResponseSendRequest,[q]):null; | |
if(q.sensitive){var o=document.location.protocol==ZmSetting.PROTO_HTTP; | |
var d=appCtxt.get(ZmSetting.PROTOCOL_MODE)==ZmSetting.PROTO_MIXED; | |
if(o&&d){return this._sensitiveRequest(q,l) | |
}}var c=new ZmCsfeCommand(); | |
var a=q.accountName; | |
if(!a){var i=appCtxt.getActiveAccount(); | |
a=(i&&i.id!=ZmAccountList.DEFAULT_ID)?i.name:null | |
}var j=null; | |
if(q.useChangeToken&&(!a||(a===appCtxt.accountList.mainAccount.name))){j=this._changeToken | |
}var f,h; | |
if(q.restUri){f={restUri:q.restUri,asyncMode:q.asyncMode,callback:r} | |
}else{f={jsonObj:q.jsonObj,soapDoc:q.soapDoc,accountName:a,useXml:this._useXml,changeToken:j,asyncMode:q.asyncMode,callback:r,logRequest:this._logRequest,highestNotifySeen:this._highestNotifySeen,noAuthToken:true,skipAuthCheck:q.skipAuthCheck,resend:q.resend,noSession:q.noSession,useStringify1:(AjxEnv.isIE||AjxEnv.isModernIE)&&q.fromChildWindow,emptyResponseOkay:q.emptyResponseOkay}; | |
h=q.methodName=ZmCsfeCommand.getMethodName(f.jsonObj||f.soapDoc) | |
}appCtxt.currentRequestParams=q; | |
var m=g?[l,q.errorCallback,q.noBusyOverlay]:null; | |
if(!q.noBusyOverlay){var e=null; | |
var k=false; | |
if(g){e=new AjxCallback(this,this.cancelRequest,m); | |
this._shell.setBusyDialogText(ZmMsg.askCancel); | |
k=true | |
}this._shell.setBusy(true,l,k,g,e) | |
}else{if(g){var n=new AjxTimedAction(this,this.cancelRequest,m); | |
this._cancelActionId[l]=AjxTimedAction.scheduleAction(n,g) | |
}}this._pendingRequests[l]=c; | |
try{var b=q.restUri?c.invokeRest(f):c.invoke(f); | |
c.state=ZmRequestMgr._SENT | |
}catch(p){this._handleResponseSendRequest(q,new ZmCsfeResult(p,true)); | |
return | |
}return(q.asyncMode)?l:(this._handleResponseSendRequest(q,b)) | |
}; | |
ZmRequestMgr.prototype._handleResponseSendRequest=function(b,l){var k=(b.response!=null); | |
if(!k&&!appCtxt.isWebClientOffline()){if(!this._pendingRequests[b.reqId]){return | |
}if(this._pendingRequests[b.reqId].state==ZmRequestMgr._CANCEL){return | |
}this._pendingRequests[b.reqId].state=ZmRequestMgr._RESPONSE; | |
if(!b.noBusyOverlay){this._shell.setBusy(false,b.reqId) | |
}}var c,j; | |
try{if(b.asyncMode&&!b.restUri){c=l.getResponse() | |
}else{if(l._isException){throw l._data | |
}else{c=l | |
}}if(c.Header){j=this._handleHeader(c.Header) | |
}}catch(f){var a=b.errorCallback; | |
if(a){var d=a.run(f,b); | |
if(!d){this._handleException(f,b) | |
}}else{var e=function(m,n){if(m&&(m.length>0)){for(var o in m){if(m[o]==n){return true | |
}}}return false | |
}(b.ignoreErrs,f.code); | |
if(f.code===ZmCsfeException.EMPTY_RESPONSE&&b.offlineCallback){b.offlineCallback(b); | |
if(appCtxt.isWebClientOffline()&&!b.noBusyOverlay){this._shell.setBusy(false,b.reqId) | |
}e=true | |
}if(!e){this._handleException(f,b) | |
}}var i=l.getHeader(); | |
if(i){this._handleHeader(i); | |
this._handleNotifications(i) | |
}this._clearPendingRequest(b.reqId); | |
return | |
}if(b.asyncMode&&!b.restUri){l.set(c.Body) | |
}if(!appCtxt.isOffline&&!k){this._controller._kickPolling(true) | |
}var g=ZmCsfeCommand.getMethodName(b.jsonObj||b.soapDoc); | |
if(b.asyncMode&&b.callback){b.callback.run(l) | |
}this._handleNotifications(c.Header,g); | |
this._clearPendingRequest(b.reqId); | |
if(j&&(!appCtxt.isOffline||!appCtxt.multiAccounts)&&!b.more){this._refreshHandler(j) | |
}if(!b.asyncMode){return c.Body | |
}var h=this._controller; | |
if(h._evtMgr&&h._evtMgr.isListenerRegistered(ZmAppEvent.RESPONSE)){h._evt.request=g; | |
h.notify(ZmAppEvent.RESPONSE) | |
}}; | |
ZmRequestMgr.prototype.cancelRequest=function(d,a,b){if(!this._pendingRequests[d]){return | |
}if(this._pendingRequests[d].state==ZmRequestMgr._RESPONSE){return | |
}this._pendingRequests[d].state=ZmRequestMgr._CANCEL; | |
if(!b){this._shell.setBusy(false,d) | |
}this._pendingRequests[d].cancel(); | |
if(a){var c=new AjxException("Request canceled",AjxException.CANCELED,"ZmRequestMgr.prototype.cancelRequest"); | |
a.isAjxCallback?a.run(c):a(c) | |
}this._clearPendingRequest(d) | |
}; | |
ZmRequestMgr.prototype._clearPendingRequest=function(c){var b=this._pendingRequests[c]; | |
if(b){if(b.iframeId){var a=document.getElementById(b.iframeId); | |
if(a){a.parentNode.removeChild(a) | |
}}delete this._pendingRequests[c] | |
}var d=this._cancelActionId[c]; | |
if(d&&d!=-1){AjxTimedAction.cancelAction(d); | |
this._cancelActionId[c]=-1 | |
}}; | |
ZmRequestMgr.prototype._handleHeader=function(f){var b=f&&f.context; | |
if(!b){return | |
}if(b.change){this._changeToken=b.change.token | |
}if(b.zdsync&&b.zdsync.account){var a=b.zdsync.account; | |
for(var d=0; | |
d<a.length; | |
d++){var e=appCtxt.accountList.getAccount(a[d].id); | |
if(e){var c=a[d].dialog; | |
if(c){this._handleOfflineInfoDialog(c[0],e) | |
}e.updateState(a[d]) | |
}}}if(b.refresh){this._controller.runAppFunction("_clearDeferredFolders"); | |
this._loadTrees(b.refresh); | |
this._controller.runAppFunction("_createVirtualFolders"); | |
this._highestNotifySeen=0 | |
}return b.refresh | |
}; | |
ZmRequestMgr.prototype._handleOfflineInfoDialog=function(c,d){if(!c.type){return | |
}var a; | |
switch(c.type){case ZmRequestMgr.OFFLINE_HEAP_DUMP:a=ZmMsg.offlineHeapDump; | |
break; | |
case ZmRequestMgr.OFFLINE_MUST_RESYNC:a=AjxMessageFormat.format(ZmMsg.offlineMustReSync,d.name); | |
break; | |
case ZmRequestMgr.OFFLINE_MUST_GAL_RESYNC:a=AjxMessageFormat.format(ZmMsg.offlineMustGalReSync,d.name); | |
break; | |
case ZmRequestMgr.OFFLINE_FOLDER_MOVE_FAILED:appCtxt.setStatusMsg(ZmMsg.offlineMoveFolderError); | |
break; | |
default:}if(!a){return | |
}var b=appCtxt.getOkCancelMsgDialog(); | |
b.setMessage(a); | |
b.registerCallback(DwtDialog.OK_BUTTON,this._handleOfflineDialogAction,this,[b,c.type,d.id,true]); | |
b.registerCallback(DwtDialog.CANCEL_BUTTON,this._handleOfflineDialogAction,this,[b,c.type,d.id,false]); | |
b.popup() | |
}; | |
ZmRequestMgr.prototype._handleOfflineDialogAction=function(e,c,b,d){var a={jsonObj:{DialogActionRequest:{_jsns:"urn:zimbraOffline",type:c,id:b,action:d?"yes":"no"}},callback:new AjxCallback(this,this._handleOfflineDialogActionResp,e),errorCallback:new AjxCallback(this,this._handleOfflineDialogActionResp,e),asyncMode:true}; | |
this.sendRequest(a) | |
}; | |
ZmRequestMgr.prototype._handleOfflineDialogActionResp=function(b,a){if(b.isPoppedUp()){b.popdown() | |
}}; | |
ZmRequestMgr.prototype._handleException=function(a,c){var b=false; | |
if(ZmRequestMgr.RETRY_ON_EXCEPTION[a.code]){c.retryCount=c.retryCount||0; | |
if(c.retryCount<ZmRequestMgr.RETRY_MAX){c.resend=ZmCsfeCommand.RETRY; | |
c.retryCount++; | |
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){this.sendRequest(c) | |
}),ZmRequestMgr.RETRY_DELAY*1000); | |
b=true | |
}}if(!b){this._controller._handleException(a,c) | |
}}; | |
ZmRequestMgr.prototype._handleNotifications=function(f,c){if(f&&f.context&&f.context.notify){for(var e=0; | |
e<f.context.notify.length; | |
e++){var d=f.context.notify[e]; | |
var b=d.seq; | |
var a=f.context&&ZmCsfeCommand.extractSessionId(f.context.session); | |
if(d.seq>this._highestNotifySeen&&!(a&&ZmCsfeCommand._staleSession[a])){this._highestNotifySeen=b; | |
this._notifyHandler(d,c) | |
}else{}}}}; | |
ZmRequestMgr.prototype._refreshHandler=function(a){AjxDebug.println(AjxDebug.NOTIFY,"REFRESH block received"); | |
if(!appCtxt.inStartup){this._controller._execPoll() | |
}if(a.version){if(!this._canceledReload){var d=appCtxt.get(ZmSetting.SERVER_VERSION); | |
if(d!=a.version){appCtxt.set(ZmSetting.SERVER_VERSION,a.version); | |
if(d){var c=appCtxt.getYesNoMsgDialog(); | |
c.reset(); | |
c.registerCallback(DwtDialog.YES_BUTTON,this._reloadYesCallback,this,[c,d,a.version]); | |
c.registerCallback(DwtDialog.NO_BUTTON,this._reloadNoCallback,this,[c,a]); | |
var b=AjxMessageFormat.format(ZmMsg.versionChangeRestart,[d,a.version]); | |
c.setMessage(b,DwtMessageDialog.WARNING_STYLE); | |
c.popup(); | |
appCtxt.reloadAppCache(true); | |
return | |
}}}}if(!this._recentlyRefreshed){this._controller.runAppFunction("refresh",false,a); | |
this._recentlyRefreshed=true; | |
this._lastSkippedRefresh=null | |
}else{this._lastSkippedRefresh=a | |
}if(!this._refreshTimer){this._refreshTimer=new AjxTimedAction(this,this._refreshTimeout) | |
}AjxTimedAction.scheduleAction(this._refreshTimer,5000) | |
}; | |
ZmRequestMgr.prototype._refreshTimeout=function(){if(this._lastSkippedRefresh){this._controller.runAppFunction("refresh",false,this._lastSkippedRefresh); | |
this._lastSkippedRefresh=null | |
}this._recentlyRefreshed=false | |
}; | |
ZmRequestMgr.prototype._loadTrees=function(c){var b={}; | |
var a=appCtxt.multiAccounts?appCtxt.accountList.mainAccount:null; | |
this._loadTree(ZmOrganizer.TAG,b,c.tags,null,a); | |
this._loadTree(ZmOrganizer.FOLDER,b,c.folder[0],"folder",a); | |
this._loadHabTree() | |
}; | |
ZmRequestMgr.prototype._loadHabTree=function(){var b=appCtxt.get(ZmSetting.HAB_ROOT); | |
if(!b&&b.length===0){return | |
}var c=b[0]; | |
if(c){var a=c._content; | |
var d={_jsns:"urn:zimbraAccount",ownerOf:1,habRootGroupId:a}; | |
var f={GetHABRequest:d}; | |
var e=this._handleHABResponse.bind(this,a); | |
appCtxt.getAppController().sendRequest({jsonObj:f,asyncMode:true,callback:e}) | |
}}; | |
ZmRequestMgr.prototype._handleHABResponse=function(c,a){var d=a._data.GetHABResponse.ou[0]; | |
var b=d.habGroup[0]; | |
b.id=c; | |
this._loadTree("HAB",{},b,"hab",null) | |
}; | |
ZmRequestMgr.prototype._reloadYesCallback=function(b){b.popdown(); | |
window.onbeforeunload=null; | |
var a=AjxUtil.formatUrl(); | |
ZmZimbraMail.sendRedirect(a) | |
}; | |
ZmRequestMgr.prototype._reloadNoCallback=function(a,b){a.popdown(); | |
this._canceledReload=true; | |
this._refreshHandler(b) | |
}; | |
ZmRequestMgr.prototype._loadTree=function(c,b,f,g,e){var d=(c==ZmOrganizer.TAG); | |
var a=appCtxt.getTree(c,e); | |
if(a){a.reset() | |
}else{a=d?new ZmTagTree(e):new ZmFolderTree() | |
}appCtxt.setTree(c,a,e); | |
a.addChangeListener(this._unreadListener); | |
a.getUnreadHash(b); | |
a.loadFromJs(f,g,e) | |
}; | |
ZmRequestMgr.prototype._notifyHandler=function(b,a){AjxDebug.println(AjxDebug.NOTIFY,"Notification block:"); | |
AjxDebug.dumpObj(AjxDebug.NOTIFY,b); | |
this._controller.runAppFunction("preNotify",false,b); | |
if(b.deleted&&b.deleted.id){this._handleDeletes(b.deleted) | |
}if(b.created){this._handleCreates(b.created) | |
}if(b.modified){this._handleModifies(b.modified) | |
}if(ZmOffline.isOnlineMode()&&(b.deleted||b.created||b.modified)){appCtxt.webClientOfflineHandler.scheduleSyncRequest(b,a) | |
}this._controller.runAppFunction("postNotify",false,b) | |
}; | |
ZmRequestMgr.prototype._handleDeletes=function(d){var b=d.id.split(","); | |
this._controller.runAppFunction("deleteNotify",false,b); | |
for(var a=0; | |
a<b.length; | |
a++){var e=b[a]; | |
if(!e){continue | |
}var c=appCtxt.cacheGet(e); | |
if(c&&c.notifyDelete){c.notifyDelete(); | |
appCtxt.cacheRemove(e); | |
c=null | |
}}}; | |
ZmRequestMgr.prototype._handleCreates=function(h){this._controller.runAppFunction("createNotify",false,h); | |
for(var a in h){if(h.hasOwnProperty(a)){var g=h[a]; | |
for(var c=0; | |
c<g.length; | |
c++){var e=g[c]; | |
if(e._handled){continue | |
}if(appCtxt.cacheGet(e.id)&&a!="tag"){continue | |
}if(a=="tag"){var f=appCtxt.multiAccounts&&ZmOrganizer.parseId(e.id).account; | |
var b=appCtxt.getTagTree(f); | |
if(b){b.root.notifyCreate(e) | |
}}else{if(a=="folder"||a=="search"||a=="link"){var d=e.l; | |
var j=appCtxt.getById(d); | |
if(j&&j.notifyCreate&&j.type!=ZmOrganizer.TAG){j.notifyCreate(e,a) | |
}}}}}}}; | |
ZmRequestMgr.prototype._handleModifies=function(c){this._controller.runAppFunction("modifyNotify",false,c); | |
for(var b in c){if(b=="mbx"){var k=c[b]; | |
for(var e=0; | |
e<k.length; | |
e++){var a=k[e]; | |
var j=a.acct; | |
var f=j&&appCtxt.accountList.getAccount(j); | |
var m=appCtxt.getSettings(f).getSetting(ZmSetting.QUOTA_USED); | |
m.notifyModify({_name:b,s:a.s,account:f}) | |
}continue | |
}var g=c[b]; | |
for(var e=0; | |
e<g.length; | |
e++){var h=g[e]; | |
if(h._handled){continue | |
}var l=appCtxt.cacheGet(h.id); | |
if(!l&&b=="cn"&&AjxDispatcher.loaded("ContactsCore")){var d=appCtxt.getApp(ZmApp.CONTACTS); | |
if(d.isContactListLoaded()){l=d.getContactList().getById(h.id) | |
}}if(l&&l.notifyModify){h._isRemote=(b=="folder"&&l.link); | |
l.notifyModify(h) | |
}}}}; | |
ZmRequestMgr.prototype._unreadChangeListener=function(f){if(f.event==ZmEvent.E_MODIFY){var e=f.getDetail("fields"); | |
if(e&&e[ZmOrganizer.F_UNREAD]){var c=f.getDetail("organizers"); | |
var g=c?c[0]:null; | |
var a=g?(g.isSystem()?g.nId:g.id):null; | |
var i=appCtxt.getCurrentSearch(); | |
if(i){var d=appCtxt.multiAccounts&&appCtxt.getById(i.folderId); | |
var b=(d&&d.getAccount()==appCtxt.getActiveAccount())?d.nId:i.folderId; | |
if(a&&(a==b||a==i.tagId)){Dwt.setTitle(i.getTitle()) | |
}}var h=appCtxt.getApp(ZmApp.MAIL); | |
if(h){h.setNewMailNotice(g) | |
}}}}; | |
ZmRequestMgr.prototype._sensitiveRequest=function(h,e){h.noSession=true; | |
h.noAuthToken=true; | |
var a=ZmCsfeCommand.getRequestStr(h); | |
var g=document.location; | |
var b=appCtxt.get(ZmSetting.HTTPS_PORT); | |
if(b&&b!=ZmSetting.DEFAULT_HTTPS_PORT){b=":"+b | |
}var c=document.createElement("IFRAME"); | |
c.style.display="none"; | |
c.id=Dwt.getNextId(); | |
document.body.appendChild(c); | |
var f=Dwt.getIframeDoc(c); | |
f.write("<form ","id=",c.id,"-form ","target=",c.id,"-iframe ","method=POST ","action='https://",g.hostname,b,appContextPath,"/public/secureRequest.jsp'",">","<input type=hidden name=reqId value='",e,"'>","<textarea name=data>",AjxStringUtil.htmlEncode(a),"</textarea>","</form>","<iframe name=",c.id,"-iframe></iframe>"); | |
f.close(); | |
h.iframeId=c.id; | |
this._pendingRequests[e]=h; | |
var d=f.getElementById(c.id+"-form"); | |
d.submit() | |
} | |
}if(AjxPackage.define("zimbraMail.core.ZmZimbraMail")){ZmZimbraMail=function(e){if(arguments.length==0){return | |
}ZmController.call(this,null); | |
appCtxt.setZimbraMail(this); | |
appCtxt.setAppController(this); | |
window._zimbraMail=this; | |
this._evt=new ZmAppEvent(); | |
this._evtMgr=new AjxEventMgr(); | |
for(var b in ZmZimbraMail._listeners){var d=ZmZimbraMail._listeners[b]; | |
if(d&&d.length){for(var a=0; | |
a<d.length; | |
a++){this._evtMgr.addListener(b,d[a]) | |
}}}ZmZimbraMail.addListener=AjxCallback.simpleClosure(this.addListener,this); | |
ZmZimbraMail.addAppListener=AjxCallback.simpleClosure(this.addAppListener,this); | |
ZmOperation.initialize(); | |
this._createSettings(e); | |
this._createEnabledApps(); | |
this._initializeSettings(e); | |
this._postInitializeSettings(); | |
document.body.className="user_font_"+appCtxt.get(ZmSetting.FONT_NAME); | |
Dwt.delClass(document.documentElement,"user_font_size_normal","user_font_size_"+appCtxt.get(ZmSetting.FONT_SIZE)); | |
this._shell=appCtxt.getShell(); | |
this._userShell=e.userShell; | |
this._requestMgr=new ZmRequestMgr(this); | |
this._appIframeView={}; | |
this._activeApp=null; | |
this._sessionTimer=new AjxTimedAction(null,ZmZimbraMail.executeSessionTimer); | |
this._sessionTimerId=-1; | |
this._pollActionId=null; | |
this._pollRequest=null; | |
this._pollInstantNotifications=false; | |
this.statusView=null; | |
ZmZimbraMail._exitTimer=new AjxTimedAction(null,ZmZimbraMail.exitSession); | |
ZmZimbraMail._exitTimerId=-1; | |
ZmZimbraMail.stayOnPagePrompt=false; | |
ZmZimbraMail.STAYONPAGE_INTERVAL=2; | |
if(appCtxt.get(ZmSetting.HISTORY_SUPPORT_ENABLED)&&!AjxEnv.isSafari){window.historyMgr=appCtxt.getHistoryMgr() | |
}this._appViewMgr=new ZmAppViewMgr(this._shell,this,false,true); | |
var c=[ZmAppViewMgr.C_SEARCH_RESULTS_TOOLBAR,ZmAppViewMgr.C_TASKBAR]; | |
if(!appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){c.push(ZmAppViewMgr.C_TREE_FOOTER) | |
}this._appViewMgr.setHiddenComponents(ZmAppViewMgr.GLOBAL,c,true); | |
AjxDispatcher.setPackageLoadFunction("Zimlet",new AjxCallback(this,this._postLoadZimlet)); | |
AjxDispatcher.setPreLoadFunction(new AjxCallback(this,function(){this._appViewMgr.pushView(ZmId.VIEW_LOADING) | |
})); | |
AjxDispatcher.setPostLoadFunction(new AjxCallback(this,function(){if(!AjxUtil.arrayContains(this._appViewMgr._toRemove,ZmId.VIEW_LOADING)){this._appViewMgr._toRemove.push(ZmId.VIEW_LOADING) | |
}})); | |
for(var a in ZmApp.QS_ARG){ZmApp.QS_ARG_R[ZmApp.QS_ARG[a]]=a | |
}this._shell.addGlobalSelectionListener(new AjxListener(this,this._globalSelectionListener)); | |
appCtxt.initWebOffline(); | |
this.startup(e) | |
}; | |
ZmZimbraMail.prototype=new ZmController; | |
ZmZimbraMail.prototype.constructor=ZmZimbraMail; | |
ZmZimbraMail.prototype.isZmZimbraMail=true; | |
ZmZimbraMail.prototype.toString=function(){return"ZmZimbraMail" | |
}; | |
ZmMsg.BETA_documents=[ZmMsg.documents,ZmMsg.beta].join(" "); | |
ZmApp.MAIN="ZmZimbraMail"; | |
ZmApp.DROP_TARGETS[ZmApp.MAIN]={}; | |
ZmZimbraMail._listeners={}; | |
ZmZimbraMail.UI_LOAD_BEGIN="ui_load_begin"; | |
ZmZimbraMail.UI_LOAD_END="ui_load_end"; | |
ZmZimbraMail.UI_NETWORK_UP="network_up"; | |
ZmZimbraMail.UI_NETWORK_DOWN="network_down"; | |
ZmZimbraMail.run=function(c){if(c.noSplashScreen){ZmZimbraMail.killSplash() | |
}window.appCtxt=new ZmAppCtxt(); | |
appCtxt.rememberMe=false; | |
if(c.offlineMode){appCtxt.isOffline=true | |
}var b=c.userShell=window.document.getElementById(ZmId.SKIN_SHELL); | |
if(!b){alert("Could not get user shell - skin file did not load properly") | |
}var a=new DwtShell({userShell:b,docBodyScrollable:false,id:ZmId.SHELL}); | |
appCtxt.setShell(a); | |
new ZmZimbraMail(c) | |
}; | |
ZmZimbraMail.unload=function(){if(!ZmZimbraMail._endSessionDone){ZmZimbraMail._endSession() | |
}if(ZmZimbraMail._isLogOff){ZmZimbraMail._isLogOff=false; | |
if(window._zimbraMail){window._zimbraMail.setSessionTimer(false) | |
}ZmCsfeCommand.noAuth=true | |
}ZmZimbraMail.closeChildWindows(); | |
ZmZimbraMail.stayOnPagePrompt=false; | |
ZmZimbraMail.setExitTimer(false); | |
ZmZimbraMail.sessionTimerInvoked=false; | |
window._zimbraMail=window.onload=window.onunload=window.onresize=window.document.onkeypress=null | |
}; | |
ZmZimbraMail.closeChildWindows=function(){var b=window._zimbraMail&&window._zimbraMail._childWinList; | |
if(b){for(var a=0; | |
a<b.size(); | |
a++){var c=b.get(a); | |
if(c.win){c.win.onbeforeunload=null; | |
c.win.parentController=null; | |
c.win.close() | |
}}}}; | |
ZmZimbraMail.hashSortCompare=function(g,e,c){var f=e?Number(g[e]):0; | |
var d=c?Number(g[c]):0; | |
if(f>d){return 1 | |
}if(f<d){return -1 | |
}return 0 | |
}; | |
ZmZimbraMail.killSplash=function(){Dwt.hide("skin_container_splash_screen") | |
}; | |
ZmZimbraMail.hasSessionEnded=function(){return ZmZimbraMail._endSessionDone | |
}; | |
ZmZimbraMail.prototype.startup=function(d){if(appCtxt.isOffline){this.sendClientEventNotify(ZmZimbraMail.UI_LOAD_BEGIN) | |
}appCtxt.inStartup=true; | |
if(typeof(skin)=="undefined"){}skin.show("skin",true); | |
appCtxt.getShell().relayout(); | |
if(!this._components){this._components={}; | |
this._components[ZmAppViewMgr.C_SASH]=new DwtSash({parent:this._shell,style:DwtSash.HORIZONTAL_STYLE,className:"console_inset_app_l",threshold:20,id:ZmId.MAIN_SASH}); | |
this._components[ZmAppViewMgr.C_SASH].addListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._folderTreeSashRelease); | |
this._components[ZmAppViewMgr.C_BANNER]=this._createBanner(); | |
this._components[ZmAppViewMgr.C_USER_INFO]=this._userNameField=this._createUserInfo("BannerTextUser",ZmAppViewMgr.C_USER_INFO,ZmId.USER_NAME); | |
this._components[ZmAppViewMgr.C_QUOTA_INFO]=this._usedQuotaField=this._createUserInfo("BannerTextQuota",ZmAppViewMgr.C_QUOTA_INFO,ZmId.USER_QUOTA); | |
if(appCtxt.isOffline){this._initOfflineUserInfo() | |
}}if(!this.statusView){this.statusView=new ZmStatusView(this._shell,"ZmStatus",Dwt.ABSOLUTE_STYLE,ZmId.STATUS_VIEW) | |
}this._registerOrganizers(); | |
for(var a in ZmSearch.TYPE){ZmSearch.TYPE_MAP[ZmSearch.TYPE[a]]=a | |
}ZmZimbraMail.registerViewsToTypeMap(); | |
this._getStartApp(d); | |
appCtxt.startApp=d.startApp; | |
this._postRenderCallbacks=[]; | |
this._postRenderLast=0; | |
if(d.startApp==ZmApp.MAIL){this._doingPostRenderStartup=true; | |
var f=new AjxCallback(this,function(){AjxDispatcher.require("Startup2"); | |
var g=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,g)){this.handleCalendarComponents() | |
}if(appCtxt.get(ZmSetting.TASKS_ENABLED,null,g)){this.handleTaskComponents() | |
}this._appViewMgr.loadingView.setVisible(false) | |
}); | |
this.addPostRenderCallback(f,0,0,true); | |
var f=new AjxCallback(this,function(){AjxDispatcher.require("Startup2"); | |
var g=new DwtIdleTimer(30*1000,function(){AjxDispatcher.require("TinyMCE",true); | |
g.kill() | |
}) | |
}); | |
this.addPostRenderCallback(f,0,0,true) | |
}var c=AjxUtil.get(d,"getInfoResponse"); | |
if(c){this._requestMgr.sendRequest({response:c}) | |
}var e=new AjxCallback(this,this._handleResponseGetMetaData,d); | |
appCtxt.accountList.mainAccount.loadMetaData(e); | |
this._initDelegatedSenderAddrs(); | |
if(appCtxt.isOffline){var b=appCtxt.get(ZmSetting.OFFLINE_UPDATE_NOTIFY); | |
this._offlineUpdateChannelPref(b) | |
}}; | |
ZmZimbraMail.prototype._initDelegatedSenderAddrs=function(){var b=AjxSoapDoc.create("DiscoverRightsRequest","urn:zimbraAccount"); | |
b.set("right","sendAs"); | |
b.set("right","sendOnBehalfOf"); | |
b.set("right","sendAsDistList"); | |
b.set("right","sendOnBehalfOfDistList"); | |
var a=new ZmBatchCommand(null,appCtxt.accountList.mainAccount.name); | |
var d=this._initDelegatedSenderEmails.bind(this); | |
a.addNewRequestParams(b,d,d); | |
var c=this._handleOfflineDelegatedSenderEmails.bind(this,d); | |
a.run(null,null,c) | |
}; | |
ZmZimbraMail.prototype._getDelegatedSenderEmails=function(p,n){var f=[]; | |
if(!p||!p.length){return f | |
}for(var d=0; | |
d<p.length; | |
d++){var g=p[d].target; | |
var o=p[d].right; | |
var e=n+"DistList"; | |
if(o!==n&&o!==e){continue | |
}var l=o===e; | |
for(var c=0; | |
c<g.length; | |
c++){var h=g[c]; | |
var b=h.email; | |
for(var a=0; | |
a<b.length; | |
a++){var m=b[a].addr; | |
f.push({addr:m,isDL:l,displayName:h.d}) | |
}}}return f | |
}; | |
ZmZimbraMail.prototype._initDelegatedSenderEmails=function(a){var b=a.getResponse(); | |
if(ZmOffline.isOnlineMode()){localStorage.setItem("DiscoverRightsResponse",JSON.stringify(b)) | |
}var d=b&&b.DiscoverRightsResponse; | |
var c=d&&d.targets; | |
appCtxt.sendAsEmails=this._getDelegatedSenderEmails(c,"sendAs"); | |
appCtxt.sendOboEmails=this._getDelegatedSenderEmails(c,"sendOnBehalfOf") | |
}; | |
ZmZimbraMail.prototype._handleOfflineDelegatedSenderEmails=function(c){var a=localStorage.getItem("DiscoverRightsResponse"); | |
if(a){var b=new ZmCsfeResult({BatchResponse:JSON.parse(a)}); | |
c.run(b) | |
}}; | |
ZmZimbraMail.registerViewsToTypeMap=function(){for(var b in ZmOrganizer.VIEWS){var c=ZmOrganizer.VIEWS[b]; | |
for(var a=0; | |
a<c.length; | |
a++){ZmOrganizer.TYPE[c[a]]=b | |
}}}; | |
ZmZimbraMail.prototype._createSettings=function(e){if(e.batchInfoResponse){var b=e.batchInfoResponse.Body.BatchResponse; | |
var c=b.GetInfoResponse[0]; | |
if(!c){c={} | |
}c.domainSettings=e.settings; | |
e.getInfoResponse={Header:e.batchInfoResponse.Header,Body:{GetInfoResponse:c}}; | |
var d=AjxUtil.get(e.getInfoResponse,"Header","context","session"); | |
if(d){ZmCsfeCommand.setSessionId(d) | |
}if(b.SearchResponse){e.searchResponse={Body:{SearchResponse:b.SearchResponse[0]}} | |
}}var a=new ZmSettings(); | |
appCtxt.setSettings(a); | |
a.setUserSettings({info:e.getInfoResponse.Body.GetInfoResponse,preInit:true}) | |
}; | |
ZmZimbraMail.prototype._initializeSettings=function(f){var e=f.getInfoResponse.Body.GetInfoResponse; | |
var c=appCtxt.getSettings(); | |
c.setUserSettings(e,null,true,true,true); | |
c.userSettingsLoaded=true; | |
var b=appCtxt.get(ZmSetting.BRANCH); | |
if(window.DBG&&!DBG.isDisabled()){}if(f.settings){for(var a in f.settings){var g=c.getSettingByName(a); | |
if(g){c.getSetting(g).setValue(f.settings[a]) | |
}}}if(appCtxt.isOffline){appCtxt.set(ZmSetting.POLLING_INTERVAL,60,null,null,true) | |
}if(f.devMode=="1"){appCtxt.set(ZmSetting.DEV,true) | |
}if(f.protocolMode){var d=(f.protocolMode.indexOf(":")==-1)?f.protocolMode+":":f.protocolMode; | |
appCtxt.set(ZmSetting.PROTOCOL_MODE,d) | |
}if(f.httpPort){appCtxt.set(ZmSetting.HTTP_PORT,f.httpPort) | |
}if(f.httpsPort){appCtxt.set(ZmSetting.HTTPS_PORT,f.httpsPort) | |
}if(!appCtxt.get(ZmSetting.SPAM_ENABLED)){ZmFolder.HIDE_ID[ZmFolder.ID_SPAM]=true | |
}if(appCtxt.get(ZmSetting.SHOW_CHATS_FOLDER)){delete ZmFolder.HIDE_ID[ZmOrganizer.ID_CHATS] | |
}}; | |
ZmZimbraMail.prototype._postInitializeSettings=function(){this._setCustomInvalidEmailPats() | |
}; | |
ZmZimbraMail.prototype._setCustomInvalidEmailPats=function(){var d=appCtxt.getSettings().getSetting(ZmSetting.EMAIL_VALIDATION_REGEX); | |
var a=[]; | |
if(d){a=d.value | |
}for(var c=0; | |
c<a.length; | |
c++){var b=a[c]; | |
if(b&&b!=""){AjxEmailAddress.customInvalidEmailPats.push(new RegExp(b)) | |
}}}; | |
ZmZimbraMail.prototype._handleResponseGetMetaData=function(a){if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){var b=appCtxt.multiAccounts?"GetContactsForAllAccounts":"GetContacts"; | |
AjxDispatcher.run({method:b,callback:this._handleResponseLoadUserSettings.bind(this,a)}) | |
}else{this._handleResponseLoadUserSettings(a) | |
}}; | |
ZmZimbraMail.prototype.showMiniCalendar=function(){var a=appCtxt.getCalManager(); | |
a.getMiniCalendar(); | |
appCtxt.getAppViewMgr().displayComponent(ZmAppViewMgr.C_TREE_FOOTER,true); | |
a.highlightMiniCal(); | |
a.startDayRollTimer() | |
}; | |
ZmZimbraMail.prototype.showReminder=function(){var a=appCtxt.getApp(ZmApp.CALENDAR).getReminderController(); | |
a.refresh() | |
}; | |
ZmZimbraMail.prototype.showTaskReminder=function(){var b=appCtxt.getTaskManager(); | |
var a=b.getReminderController(); | |
a.refresh() | |
}; | |
ZmZimbraMail.prototype._isProtocolHandlerAccessed=function(){if(AjxEnv.isFirefox){if(!localStorage||localStorage.zimbra_mailto_init){return true | |
}localStorage.zimbra_mailto_init=true | |
}return false | |
}; | |
ZmZimbraMail.prototype._handleResponseLoadUserSettings=function(b,a){if(appCtxt.multiAccounts){var c=new AjxCallback(this,this._handleResponseStartup,[b,a]); | |
appCtxt.accountList.loadAccounts(c) | |
}else{this._handleResponseStartup(b,a) | |
}}; | |
ZmZimbraMail.prototype._handleResponseStartup=function(d,q){d=d||{}; | |
if(d.settingOverrides){this._needOverviewLayout=true; | |
for(var a in d.settingOverrides){var p=appCtxt.getSetting(a); | |
if(p){p.setValue(d.settingOverrides[a]) | |
}}}if(d.preset){var g=d.preset.split(","); | |
for(var f=0; | |
f<g.length; | |
f++){var j=g[f].split(":"); | |
var p=appCtxt.getSettings().getSetting(j[0]); | |
if(p&&p.canPreset){p.setValue(j[1]) | |
}}}if(!appCtxt.isOffline){if(appCtxt.get(ZmSetting.INSTANT_NOTIFY)&&appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL)==appCtxt.get(ZmSetting.POLLING_INTERVAL)){AjxTimedAction.scheduleAction(new AjxTimedAction(this,this.setInstantNotify,[true]),4000) | |
}else{this.setPollInterval(true) | |
}}else{if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&window.platform&&window.platform.isRegisteredProtocolHandler("mailto")){this.registerMailtoHandler(!AjxEnv.isWindows,true) | |
}}window.onbeforeunload=ZmZimbraMail._confirmExitMethod; | |
if(!this._components[ZmAppViewMgr.C_APP_CHOOSER]){this._components[ZmAppViewMgr.C_APP_CHOOSER]=this._appChooser=this._createAppChooser() | |
}ZmApp.initialize(); | |
if(appCtxt.get(ZmSetting.DEFAULT_TIMEZONE)){AjxTimezone.DEFAULT_RULE=AjxTimezone._guessMachineTimezone(appCtxt.get(ZmSetting.DEFAULT_TIMEZONE)); | |
AjxTimezone.DEFAULT=AjxTimezone.getClientId(AjxTimezone.DEFAULT_RULE.serverId) | |
}this.notify(ZmAppEvent.PRE_STARTUP); | |
d.result=q; | |
var o=new AjxCallback(this,this._handleResponseStartup1,d); | |
if(this._doingPostRenderStartup){this.addAppListener(d.startApp,ZmAppEvent.POST_RENDER,new AjxListener(this,this._postRenderStartup)); | |
if(!appCtxt.isWebClientOffline()){this._searchResponse=d.searchResponse | |
}}else{AjxDispatcher.require("Startup2") | |
}var n=new AjxCallback(this,function(){this.runAppFunction("startup",false,d.result) | |
}); | |
this.addPostRenderCallback(n,2,0,true); | |
n=new AjxCallback(this,function(){this._setupTabGroups(); | |
this.focusContentPane() | |
}); | |
this.addPostRenderCallback(n,3,100); | |
n=new AjxCallback(this,function(){AjxDispatcher.enableLoadFunctions(true); | |
appCtxt.inStartup=false; | |
this.notify(ZmAppEvent.POST_STARTUP); | |
var i=appCtxt.getSearchController(); | |
i.getSearchToolbar().initAutocomplete(); | |
if(appCtxt.isOffline){i.resetSearchToolbar() | |
}if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&appCtxt.isOffline){this.handleOfflineMailTo(location.search) | |
}}); | |
this.addPostRenderCallback(n,5,100); | |
if(appCtxt.get(ZmSetting.MAIL_ENABLED)&&!appCtxt.isExternalAccount()&&navigator.registerProtocolHandler&&!this._isProtocolHandlerAccessed()){n=new AjxCallback(this,function(){try{navigator.registerProtocolHandler("mailto",AjxUtil.formatUrl({qsArgs:{view:"compose",to:"%s"},qsReset:true}),ZmMsg.zimbraTitle) | |
}catch(i){}}); | |
this.addPostRenderCallback(n,6,100) | |
}this.activateApp(d.startApp,false,o,this._errorCallback,d); | |
var k=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,k)&&!this._doingPostRenderStartup&&(d.startApp!=ZmApp.CALENDAR)){this.handleCalendarComponents() | |
}if(appCtxt.get(ZmSetting.TASKS_ENABLED,null,k)&&!this._doingPostRenderStartup&&(d.startApp!=ZmApp.TASKS)){this.handleTaskComponents() | |
}if(appCtxt.get(ZmSetting.IMPORT_ON_LOGIN_ENABLED)){var b=new ZmDataSourceCollection(); | |
var l=appCtxt.getDataSourceCollection(); | |
var m=l&&l.getPopAccounts(); | |
var e=l&&l.getImapAccounts(); | |
var h={}; | |
if(m){for(var f=0; | |
f<m.length; | |
f++){h[m[f].id]=m[f] | |
}}if(e){for(var f=0; | |
f<e.length; | |
f++){h[e[f].id]=e[f] | |
}}if(m||e){var c=new AjxTimedAction(b,b.checkStatus,[h,2000]); | |
AjxTimedAction.scheduleAction(c,10000) | |
}}}; | |
ZmZimbraMail.prototype.handleTaskComponents=function(){var b=new AjxTimedAction(this,this.showTaskReminder); | |
var a=appCtxt.isOffline?0:ZmTasksApp.REMINDER_START_DELAY; | |
AjxTimedAction.scheduleAction(b,a) | |
}; | |
ZmZimbraMail.prototype.handleCalendarComponents=function(){if(appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){var c=new AjxTimedAction(this,this.showMiniCalendar); | |
var a=appCtxt.isOffline?0:ZmCalendarApp.MINICAL_DELAY; | |
AjxTimedAction.scheduleAction(c,a) | |
}AjxDispatcher.require(["ContactsCore","MailCore","CalendarCore","Calendar"]); | |
var b=new AjxTimedAction(this,this.showReminder); | |
var a=appCtxt.isOffline?0:ZmCalendarApp.REMINDER_START_DELAY; | |
AjxTimedAction.scheduleAction(b,a) | |
}; | |
ZmZimbraMail.prototype._handleResponseStartup1=function(e){this._setExternalLinks(); | |
this.setUserInfo(); | |
this._setRefresh(); | |
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){this._components[ZmAppViewMgr.C_SEARCH]=appCtxt.getSearchController().getSearchToolbar() | |
}else{Dwt.hide(ZmId.SKIN_SEARCH) | |
}var b=this.getNewButton(); | |
var d={parent:this._shell,context:ZmOperation.NEW_MENU,buttons:ZmOperation.NONE,controller:this,refElementId:ZmId.SKIN_APP_NEW_BUTTON}; | |
var a=this._newToolbar=new ZmButtonToolBar(d); | |
b.reparent(a); | |
this._components[ZmAppViewMgr.C_NEW_BUTTON]=a; | |
if(e.unitTest){var c=window.unitTestManager; | |
appCtxt.addZimletsLoadedListener(c.runTests.bind(c),0) | |
}this.getKeyMapMgr(); | |
this.setSessionTimer(true); | |
ZmZimbraMail.killSplash(); | |
this.runAppFunction("addComponents",false,this._components); | |
this._appViewMgr.setViewComponents(ZmAppViewMgr.GLOBAL,this._components,true); | |
this._checkLicense(); | |
if(!this._doingPostRenderStartup){this._postRenderStartup() | |
}}; | |
ZmZimbraMail.prototype._setRefresh=function(){var b=document.getElementById(ZmId.SKIN_REFRESH); | |
if(!b){return | |
}var a=appCtxt.refreshButton=new DwtToolBarButton({parent:DwtShell.getShell(window),id:ZmId.OP_CHECK_MAIL}); | |
a.setImage("RefreshAll"); | |
a.setToolTipContent(ZmMsg.checkMailPrefUpdate,true); | |
a.reparentHtmlElement(ZmId.SKIN_REFRESH); | |
var c=this._refreshListener.bind(this); | |
a.addSelectionListener(c) | |
}; | |
ZmZimbraMail.prototype._refreshListener=function(){if(!appCtxt.isWebClientOffline()){this.runAppFunction("runRefresh") | |
}}; | |
ZmZimbraMail.prototype._checkLicense=function(b){var a=appCtxt.get(ZmSetting.LICENSE_STATUS); | |
var d=ZmSetting.LICENSE_MSG[a]; | |
if(d){AjxDispatcher.require("Startup2"); | |
var c=appCtxt.getMsgDialog(); | |
c.reset(); | |
c.setMessage(d,DwtMessageDialog.WARNING_STYLE); | |
c.popup() | |
}}; | |
ZmZimbraMail.prototype._postRenderStartup=function(a){this._postRenderCallbacks.sort(function(d,c){return d.order-c.order | |
}); | |
this._runNextPostRenderCallback() | |
}; | |
ZmZimbraMail.prototype._runNextPostRenderCallback=function(){if(this._postRenderCallbacks&&this._postRenderCallbacks.length){var a=this._postRenderCallbacks.shift(); | |
if(!a){return | |
}AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){a.callback.run(); | |
this._runNextPostRenderCallback() | |
}),a.delay) | |
}else{if(appCtxt.isOffline){this.sendClientEventNotify(ZmZimbraMail.UI_LOAD_END); | |
if(AjxEnv.isPrism){this._firstTimeNetworkChange=true; | |
var b=new ZimbraNetworkChecker(); | |
b.addEventListener("offline",function(c){window.appCtxt.getAppController().handleNetworkChange(false) | |
},false); | |
b.addEventListener("online",function(c){window.appCtxt.getAppController().handleNetworkChange(true) | |
},false) | |
}}}}; | |
ZmZimbraMail.prototype.handleNetworkChange=function(a){this._isPrismOnline=a; | |
if(this._isUserOnline||this._firstTimeNetworkChange){this._updateNetworkStatus(a) | |
}}; | |
ZmZimbraMail.prototype._updateNetworkStatus=function(a){if((a&&this._currentNetworkStatus==ZmZimbraMail.UI_NETWORK_UP)||(!a&&this._currentNetworkStatus==ZmZimbraMail.UI_NETWORK_DOWN)){return | |
}if(a){if(!this._firstTimeNetworkChange){this.setStatusMsg(ZmMsg.networkChangeOnline) | |
}else{this._firstTimeNetworkChange=false; | |
this._isUserOnline=a | |
}this._currentNetworkStatus=ZmZimbraMail.UI_NETWORK_UP; | |
this.sendClientEventNotify(this._currentNetworkStatus,true) | |
}else{this.setStatusMsg(ZmMsg.networkChangeOffline,ZmStatusView.LEVEL_WARNING); | |
this._currentNetworkStatus=ZmZimbraMail.UI_NETWORK_DOWN; | |
this.sendClientEventNotify(this._currentNetworkStatus) | |
}this._networkStatusIcon.setToolTipContent(a?ZmMsg.networkStatusOffline:ZmMsg.networkStatusOnline,true); | |
this._networkStatusIcon.getHtmlElement().innerHTML=AjxImg.getImageHtml(a?"Connect":"Disconnect"); | |
var b=a?ZmMsg.netStatusOnline:ZmMsg.netStatusOffline; | |
this._networkStatusText.getHtmlElement().innerHTML=b.substr(0,1).toUpperCase()+b.substr(1) | |
}; | |
ZmZimbraMail.prototype.addPostRenderCallback=function(d,a,b,c){if(!this._doingPostRenderStartup&&c){d.run() | |
}else{a=a||this._postRenderLast++; | |
this._postRenderCallbacks.push({callback:d,order:a,delay:b||0}) | |
}}; | |
ZmZimbraMail.prototype._isInternalApp=function(a){return !ZmApp.SETTING[a]||(appCtxt.get(ZmApp.SETTING[a],null,appCtxt.multiAccounts&&appCtxt.accountList.mainAccount)) | |
}; | |
ZmZimbraMail.prototype._isIframeApp=function(a){return !this._isInternalApp(a)&&appCtxt.get(ZmApp.UPSELL_SETTING[a]) | |
}; | |
ZmZimbraMail.prototype._getStartApp=function(g){var b; | |
var e=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
if(g&&g.app){b=ZmApp.QS_ARG_R[g.app.toLowerCase()]; | |
if(!this._isInternalApp(b)&&!this._isIframeApp(b)){b=null | |
}}if(!b){for(var f in ZmApp.DEFAULT_SORT){ZmApp.DEFAULT_APPS.push(f) | |
}ZmApp.DEFAULT_APPS.sort(function(i,h){return ZmZimbraMail.hashSortCompare(ZmApp.DEFAULT_SORT,i,h) | |
}); | |
var a=null; | |
for(var d=0; | |
d<ZmApp.DEFAULT_APPS.length; | |
d++){var f=ZmApp.DEFAULT_APPS[d]; | |
if(this._isInternalApp(f)){a=f; | |
break | |
}}b=this._getDefaultStartAppName(e) | |
}var c=AjxStringUtil.parseQueryString(); | |
if(c&&c.view&&!c.app){b=ZmApp.QS_VIEWS[c.view] | |
}g.startApp=b; | |
g.qsParams=c | |
}; | |
ZmZimbraMail.prototype._getDefaultStartAppName=function(d){d=d||(appCtxt.multiAccounts&&appCtxt.accountList.mainAccount)||null; | |
for(var e in ZmApp.DEFAULT_SORT){ZmApp.DEFAULT_APPS.push(e) | |
}ZmApp.DEFAULT_APPS.sort(function(g,f){return ZmZimbraMail.hashSortCompare(ZmApp.DEFAULT_SORT,g,f) | |
}); | |
var a=null; | |
for(var b=0; | |
b<ZmApp.DEFAULT_APPS.length; | |
b++){var e=ZmApp.DEFAULT_APPS[b]; | |
var c=ZmApp.SETTING[e]; | |
if(!c||appCtxt.get(c,null,d)){return e | |
}}}; | |
ZmZimbraMail.prototype.cancelRequest=function(c,a,b){this._requestMgr.cancelRequest(c,a,b) | |
}; | |
ZmZimbraMail.prototype.sendRequest=function(a){return this._requestMgr.sendRequest(a) | |
}; | |
ZmZimbraMail.prototype.runAppFunction=function(h,a){var f=[]; | |
for(var d=2; | |
d<arguments.length; | |
d++){f.push(arguments[d]) | |
}for(var d=0; | |
d<ZmApp.APPS.length; | |
d++){var g=ZmApp.APPS[d]; | |
var j=this._isIframeApp(g)?ZmApp.UPSELL_SETTING[g]:ZmApp.SETTING[g]; | |
var e=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
if(!j||appCtxt.get(j,null,e)||a){var c=appCtxt.getApp(g,null,e); | |
var b=c&&c[h]; | |
if(b&&(typeof(b)=="function")){b.apply(c,f) | |
}}}appCtxt.notifyZimlets("runAppFunction",[h]) | |
}; | |
ZmZimbraMail.prototype._createEnabledApps=function(c){this._apps={}; | |
for(var e in ZmApp.CLASS){if(!c||c[e]){ZmApp.APPS.push(e) | |
}}ZmApp.APPS.sort(function(g,f){return ZmZimbraMail.hashSortCompare(ZmApp.LOAD_SORT,g,f) | |
}); | |
for(var b=0; | |
b<ZmApp.APPS.length; | |
b++){var e=ZmApp.APPS[b]; | |
var d=this._isInternalApp(e); | |
var a=this._isIframeApp(e); | |
if(d||a||e===ZmApp.BRIEFCASE){ZmApp.ENABLED_APPS[e]=d||a; | |
this._createApp(e); | |
this._apps[e].isIframe=a | |
}}}; | |
ZmZimbraMail.addListener=function(a,b){if(!ZmZimbraMail._listeners[a]){ZmZimbraMail._listeners[a]=[] | |
}ZmZimbraMail._listeners[a].push(b) | |
}; | |
ZmZimbraMail.addAppListener=function(a,b,c){b=[a,b].join("_"); | |
ZmZimbraMail.addListener(b,c) | |
}; | |
ZmZimbraMail.prototype.addListener=function(a,b){return this._evtMgr.addListener(a,b) | |
}; | |
ZmZimbraMail.prototype.removeListener=function(a,b){return this._evtMgr.removeListener(a,b) | |
}; | |
ZmZimbraMail.prototype.addAppListener=function(c,a,b){a=[c,a].join("_"); | |
return this.addListener(a,b) | |
}; | |
ZmZimbraMail.prototype.removeAppListener=function(c,a,b){a=[c,a].join("_"); | |
return this.removeListener(a,b) | |
}; | |
ZmZimbraMail.prototype.sendNoOp=function(){var b={NoOpRequest:{_jsns:"urn:zimbraMail"}}; | |
var a=appCtxt.isOffline&&appCtxt.accountList.mainAccount.name; | |
this.sendRequest({jsonObj:b,asyncMode:true,noBusyOverlay:true,accountName:a}) | |
}; | |
ZmZimbraMail.prototype.sendClientEventNotify=function(b,a){var c={jsonObj:{ClientEventNotifyRequest:{_jsns:"urn:zimbraOffline",e:b}},asyncMode:true}; | |
if(a){c.callback=new AjxCallback(this,this.handleClientEventNotifyResponse,b); | |
c.noBusyOverlay=true; | |
if(this.clientEventNotifyReqId){appCtxt.getRequestMgr().cancelRequest(this.clientEventNotifyReqId) | |
}this.clientEventNotifyTimerId=AjxTimedAction.scheduleAction(new AjxTimedAction(this,this.sendClientEventNotify,[b,true]),3000) | |
}else{c.callback=new AjxCallback(this,this.setInstantNotify,true) | |
}this.clientEventNotifyReqId=this.sendRequest(c) | |
}; | |
ZmZimbraMail.prototype.handleClientEventNotifyResponse=function(b,a){if(!a.isException()&&a.getResponse()){if(this.clientEventNotifyTimerId){AjxTimedAction.cancelAction(this.clientEventNotifyTimerId); | |
this.clientEventNotityTimerId=null | |
}this.setInstantNotify(true) | |
}}; | |
ZmZimbraMail.prototype.setInstantNotify=function(a){if(a){this._pollInstantNotifications=true; | |
this._pollInterval=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL); | |
if(this._pollActionId){AjxTimedAction.cancelAction(this._pollActionId); | |
this._pollActionId=null | |
}this._kickPolling(true) | |
}else{this._pollInstantNotifications=false; | |
this._cancelInstantNotify(); | |
this.setPollInterval(true) | |
}}; | |
ZmZimbraMail.prototype.getInstantNotify=function(){return this._pollInstantNotifications | |
}; | |
ZmZimbraMail.prototype.registerMailtoHandler=function(f,d){if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&window.platform){try{if(d){if(f){var a=appCtxt.get(ZmSetting.OFFLINE_WEBAPP_URI,null,appCtxt.accountList.mainAccount); | |
window.platform.registerProtocolHandler("mailto",a+"&mailto=%s"); | |
if(AjxEnv.isWindows){var c=new ZimbraDesktopShell; | |
c.defaultClient=true | |
}}var e=AjxCallback.simpleClosure(this.handleOfflineMailTo,this); | |
window.platform.registerProtocolCallback("mailto",e) | |
}else{window.platform.unregisterProtocolHandler("mailto"); | |
if(AjxEnv.isWindows){var c=new ZimbraDesktopShell; | |
c.defaultClient=false | |
}}}catch(b){}}}; | |
ZmZimbraMail.prototype.handleOfflineMailTo=function(c,f){if(window.platform&&!window.platform.isRegisteredProtocolHandler("mailto")){return false | |
}var e=this.getApp(ZmApp.MAIL); | |
var a=(c.indexOf("mailto")); | |
if(a>=0){var d="to="+decodeURIComponent(c.substring(a+7)); | |
d=d.replace(/\?/g,"&"); | |
var b=e._showComposeView(f,d); | |
this._checkOfflineMailToAttachments(b,d); | |
return true | |
}return false | |
}; | |
ZmZimbraMail.prototype._checkOfflineMailToAttachments=function(d,g){var c=g||location.search; | |
var e=c.match(/\bto=([^&]+)/); | |
var h=e?AjxStringUtil.urlComponentDecode(e[1]):null; | |
e=c.match(/\battachments=([^&]+)/); | |
var b=e?(AjxStringUtil.urlComponentDecode(e[1]).replace(/\+/g," ")):null; | |
if(h&&h.indexOf("mailto")==0){h=h.replace(/mailto:/,""); | |
var a=h.split("?"); | |
if(a.length>1){a=a[1]; | |
e=a.match(/\battachments=([^&]+)/); | |
if(!b){b=e?(AjxStringUtil.urlComponentDecode(e[1]).replace(/\+/g," ")):null | |
}}}if(b){b=b.replace(/;$/,""); | |
b=b.split(";"); | |
this._mailtoAttachmentsLength=b.length; | |
this._attachmentsProcessed=0; | |
this.attachment_ids=[]; | |
for(var f=0; | |
f<b.length; | |
f++){this._handleMailToAttachment(b[f],d) | |
}}}; | |
ZmZimbraMail.prototype._handleMailToAttachment=function(h,i){var f=h; | |
var a=f.replace(/^.*\\/,""); | |
try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") | |
}catch(j){return | |
}try{var d=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); | |
d.initWithPath(f); | |
var m=this._getAttachmentContentType(d); | |
var b=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); | |
b.init(d,-1,-1,false); | |
var g=Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream); | |
g.setInputStream(b); | |
var l=new XMLHttpRequest(); | |
l.open("POST",appCtxt.get(ZmSetting.CSFE_UPLOAD_URI)+"&fmt=extended,raw",true); | |
l.setRequestHeader("Cache-Control","no-cache"); | |
l.setRequestHeader("X-Requested-With","XMLHttpRequest"); | |
l.setRequestHeader("Content-Type",(m||"application/octet-stream")); | |
l.setRequestHeader("Content-Disposition",'attachment; filename="'+AjxUtil.convertToEntities(a)+'"'); | |
var c=l; | |
l.onreadystatechange=AjxCallback.simpleClosure(this._handleUploadResponse,this,c,i); | |
l.sendAsBinary(g.readBytes(g.available())); | |
delete l | |
}catch(k){this._attachmentsProcessed++ | |
}}; | |
ZmZimbraMail.prototype._getAttachmentContentType=function(b){var c; | |
try{c=Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService).getTypeFromFile(b) | |
}catch(a){c="application/octet-stream" | |
}return c | |
}; | |
ZmZimbraMail.prototype._handleUploadResponse=function(req,controller){if(req){if(req.readyState==4&&req.status==200){var resp=eval("["+req.responseText+"]"); | |
this._attachmentsProcessed++; | |
this.popupUploadErrorDialog(ZmItem.MSG,resp[0]); | |
if(resp.length>2){var respObj=resp[2]; | |
for(var i=0; | |
i<respObj.length; | |
i++){if(respObj[i].aid!="undefined"){this.attachment_ids.push(respObj[i].aid) | |
}}if(this.attachment_ids.length>0&&this._attachmentsProcessed==this._mailtoAttachmentsLength){var attachment_list=this.attachment_ids.join(","); | |
if(!controller){var msg=new ZmMailMsg(); | |
controller=AjxDispatcher.run("GetComposeController"); | |
controller._setView({action:ZmOperation.NEW_MESSAGE,msg:msg,inNewWindow:false}) | |
}var callback=new AjxCallback(controller,controller._handleResponseSaveDraftListener); | |
controller.sendMsg(attachment_list,ZmComposeController.DRAFT_TYPE_MANUAL,callback); | |
this.getAppViewMgr().pushView(controller.getCurrentViewId()) | |
}}}}}; | |
ZmZimbraMail.prototype.setPollInterval=function(a){if(!this._pollInstantNotifications){this._pollInterval=appCtxt.get(ZmSetting.POLLING_INTERVAL)*1000; | |
if(this._pollInterval){if(a){this._kickPolling(true) | |
}}else{if(this._pollActionId){AjxTimedAction.cancelAction(this._pollActionId); | |
this._pollActionId=null | |
}}return true | |
}else{this._pollInterval=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL); | |
return false | |
}}; | |
ZmZimbraMail.prototype._cancelInstantNotify=function(){if(this._pollRequest){this._requestMgr.cancelRequest(this._pollRequest); | |
this._pollRequest=null | |
}if(this._pollActionId){AjxTimedAction.cancelAction(this._pollActionId); | |
this._pollActionId=null | |
}}; | |
ZmZimbraMail.prototype._kickPolling=function(c){DBG.println(AjxDebug.DBG2,["ZmZimbraMail._kickPolling ",this._pollInterval,", ",this._pollActionId,", ",this._pollRequest?"request_pending":"no_request_pending"].join("")); | |
if(this._pollActionId){AjxTimedAction.cancelAction(this._pollActionId); | |
this._pollActionId=null | |
}if(c&&this._pollInstantNotifications){var a=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL); | |
if(this._pollInterval>a){this._pollInterval=a | |
}}if(this._pollInterval&&!this._pollRequest){try{this._pollActionId=AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._execPoll),this._pollInterval) | |
}catch(b){this._pollActionId=null | |
}}}; | |
ZmZimbraMail.prototype._execPoll=function(){this._cancelInstantNotify(); | |
var f={NoOpRequest:{_jsns:"urn:zimbraMail"}},e=f.NoOpRequest; | |
try{if(this._pollInstantNotifications){var d=ZmCsfeCommand.getSessionId(); | |
if(d){e.wait=1; | |
e.limitToOneBlocked=1 | |
}}var c={jsonObj:f,asyncMode:true,callback:this._handleResponseDoPoll.bind(this),errorCallback:this._handleErrorDoPoll.bind(this),noBusyOverlay:true,timeout:appCtxt.get(ZmSetting.INSTANT_NOTIFY_TIMEOUT),accountName:appCtxt.isOffline&&appCtxt.accountList.mainAccount.name}; | |
this._pollRequest=this.sendRequest(c); | |
var b=appCtxt.accountList; | |
if(appCtxt.isOffline&&!b.isInitialSyncing()&&b.isSyncStatus(ZmZimbraAccount.STATUS_RUNNING)){this.sendNoOp() | |
}}catch(a){this._handleErrorDoPoll(a) | |
}}; | |
ZmZimbraMail.prototype._handleErrorDoPoll=function(b){if(this._pollRequest){if(this._pollActionId){AjxTimedAction.cancelAction(this._pollActionId); | |
this._pollActionId=null | |
}this._requestMgr.cancelRequest(this._pollRequest); | |
this._pollRequest=null | |
}if(this._pollInstantNotifications){this._pollInterval*=2; | |
if(this._pollInterval>(1000*60*2)){this._pollInterval=1000*60*2 | |
}}var a=(b.code==ZmCsfeException.SVC_AUTH_EXPIRED||b.code==ZmCsfeException.SVC_AUTH_REQUIRED||b.code==ZmCsfeException.NO_AUTH_TOKEN); | |
if(!a){this._kickPolling(false) | |
}return !a | |
}; | |
ZmZimbraMail.prototype._handleResponseDoPoll=function(a){this._pollRequest=null; | |
var b=a.getResponse().NoOpResponse; | |
if(b.waitDisallowed){this._waitDisallowed=true; | |
this.setInstantNotify(false) | |
}else{this._kickPolling(true) | |
}}; | |
ZmZimbraMail.prototype.getKeyMapMgr=function(){var a=appCtxt.getKeyboardMgr(); | |
if(!a.__keyMapMgr){this._initKeyboardHandling() | |
}return a.__keyMapMgr | |
}; | |
ZmZimbraMail.prototype._initKeyboardHandling=function(){var a=appCtxt.getKeyboardMgr(); | |
if(a.__keyMapMgr){return | |
}if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){a.enable(true); | |
a.registerKeyMap(new ZmKeyMap()); | |
a.pushDefaultHandler(this) | |
}else{a.enable(false) | |
}}; | |
ZmZimbraMail.prototype._setupTabGroups=function(){var b=appCtxt.getRootTabGroup(); | |
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){b.addMember(appCtxt.getSearchController().getSearchToolbar().getTabGroupMember()) | |
}b.addMember(this._userNameField); | |
b.addMember(this._usedQuotaField); | |
if(this._helpButton){b.addMember(this._helpButton) | |
}b.addMember(appCtxt.getAppChooser().getTabGroupMember()); | |
b.addMember(appCtxt.refreshButton); | |
b.addMember(this._newToolbar); | |
var a=appCtxt.getCurrentApp(); | |
var c=a&&a.getOverview(); | |
if(c){b.addMember(c.getTabGroupMember()); | |
ZmController._currentOverview=c | |
}appCtxt.getKeyboardMgr().setTabGroup(b) | |
}; | |
ZmZimbraMail.prototype._registerOrganizers=function(){ZmOrganizer.registerOrg(ZmOrganizer.FOLDER,{app:ZmApp.MAIL,nameKey:"folder",defaultFolder:ZmOrganizer.ID_INBOX,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmFolder",orgPackage:"MailCore",treeController:"ZmMailFolderTreeController",labelKey:"mailFolders",itemsKey:"messages",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER],views:["message","conversation"],folderKey:"mailFolder",mountKey:"mountFolder",createFunc:"ZmOrganizer.create",compareFunc:"ZmFolder.sortCompare",newOp:ZmOperation.NEW_FOLDER,displayOrder:100,childWindow:true,openSetting:ZmSetting.FOLDER_TREE_OPEN}); | |
ZmOrganizer.registerOrg(ZmOrganizer.SEARCH,{app:ZmApp.MAIN,nameKey:"savedSearch",precondition:ZmSetting.SAVED_SEARCHES_ENABLED,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmSearchFolder",treeController:"ZmSearchTreeController",labelKey:"searches",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,folderKey:"savedSearch",disableShare:true,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.SEARCH],createFunc:"ZmSearchFolder.create",compareFunc:"ZmFolder.sortCompare",openSetting:ZmSetting.SEARCH_TREE_OPEN,displayOrder:300}); | |
ZmOrganizer.registerOrg(ZmOrganizer.SHARE,{orgClass:"ZmShareProxy",treeController:"ZmShareTreeController",labelKey:"sharedFoldersHeader",compareFunc:"ZmFolder.sortCompare",displayOrder:101,hideEmpty:false}); | |
ZmOrganizer.registerOrg(ZmOrganizer.TAG,{app:ZmApp.MAIN,nameKey:"tag",precondition:ZmSetting.TAGGING_ENABLED,soapCmd:"TagAction",firstUserId:64,orgClass:"ZmTag",treeController:"ZmTagTreeController",hasColor:true,defaultColor:ZmOrganizer.C_ORANGE,labelKey:"tags",treeType:ZmOrganizer.TAG,createFunc:"ZmTag.create",compareFunc:"ZmTag.sortCompare",newOp:ZmOperation.NEW_TAG,openSetting:ZmSetting.TAG_TREE_OPEN,displayOrder:400}); | |
ZmOrganizer.registerOrg(ZmOrganizer.ZIMLET,{orgClass:"ZmZimlet",treeController:"ZmZimletTreeController",labelKey:"zimlets",compareFunc:"ZmZimlet.sortCompare",openSetting:ZmSetting.ZIMLET_TREE_OPEN,hideEmpty:true}); | |
ZmOrganizer.registerOrg(ZmOrganizer.HAB,{treeController:"ZmHabTreeController",labelKey:"hab",childWindow:true}); | |
this._name=ZmApp.MAIN; | |
ZmApp.prototype._setupDropTargets.call(this) | |
}; | |
ZmZimbraMail.prototype.getApp=function(a){if(!ZmApp.ENABLED_APPS[a]){return null | |
}if(!this._apps[a]){this._createApp(a) | |
}return this._apps[a] | |
}; | |
ZmZimbraMail.prototype.getAppViewMgr=function(){return this._appViewMgr | |
}; | |
ZmZimbraMail.prototype.getActiveApp=function(){return this._activeApp | |
}; | |
ZmZimbraMail.prototype.getPreviousApp=function(){return this._previousApp | |
}; | |
ZmZimbraMail.prototype.activateApp=function(f,b,i,d,c){var e=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
var k=this._isIframeApp(f); | |
var g=this._appViewMgr.getAppView(f); | |
if(g&&!b){if(this._appViewMgr.pushView(g)){this._appViewMgr.setAppView(f,g); | |
if(k){var h=[ZmMsg.zimbraTitle,f].join(": "); | |
Dwt.setTitle(h) | |
}}if(i){i.run() | |
}}else{if(!this._apps[f]){this._createApp(f) | |
}if(k){this._createAppIframeView(f); | |
if(i){i.run() | |
}}else{var j=new AjxCallback(this,this._handleResponseActivateApp,[i,f]); | |
var a=[f,ZmAppEvent.PRE_LAUNCH].join("_"); | |
this._evt.item=this._apps[f]; | |
this.notify(a); | |
c=c||{}; | |
c.searchResponse=this._searchResponse; | |
this._apps[f].launch(c,j); | |
delete this._searchResponse | |
}}}; | |
ZmZimbraMail.prototype._handleResponseActivateApp=function(c,a){if(c){c.run() | |
}if(ZmApp.DEFAULT_SEARCH[a]){appCtxt.getSearchController().setDefaultSearchType(ZmApp.DEFAULT_SEARCH[a]) | |
}var b=[a,ZmAppEvent.POST_LAUNCH].join("_"); | |
this._evt.item=this._apps[a]; | |
this.notify(b) | |
}; | |
ZmZimbraMail.prototype.setActiveApp=function(i){var g=i.app; | |
if(!i.isTabView){this._components[ZmAppViewMgr.C_APP_CHOOSER].setSelected(g) | |
}var d=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
var b=!ZmApp.SETTING[g]||appCtxt.get(ZmApp.SETTING[g],null,d); | |
this._activeTabId=null; | |
if(g===ZmApp.SEARCH){this._setSearchTabNewButtonProps(i.controller._resultsController) | |
}if(this._activeApp!=g){if(this._activeApp){var a=this._apps[this._activeApp]; | |
if(a){a.activate(false,i.id) | |
}this._previousApp=this._activeApp | |
}this._activeApp=g; | |
if(b){var a=this._apps[this._activeApp]; | |
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){var h; | |
var e; | |
if(g===ZmApp.SEARCH){e=i.controller._resultsController._currentSearch; | |
var f=e&&e.types; | |
h=f&&f.size()>0&&f.get(0) | |
}else{e=a.currentSearch; | |
h=a.getInitialSearchType(); | |
if(!h){h=ZmApp.DEFAULT_SEARCH[g] | |
}}if(h){appCtxt.getSearchController().setDefaultSearchType(h) | |
}var c=appCtxt.getSearchController().getSearchToolbar(); | |
if(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)&&c){var j=e?e.query:a.currentQuery; | |
j=g===ZmApp.SEARCH?"":j; | |
c.setSearchFieldValue(j?j+" ":"") | |
}}if(a){if(appCtxt.inStartup&&this._doingPostRenderStartup){var k=new AjxCallback(this,function(){a.activate(true) | |
}); | |
this.addPostRenderCallback(k,1,0,true) | |
}else{a.activate(true) | |
}}}this._evt.item=this._apps[g]; | |
this.notify(ZmAppEvent.ACTIVATE) | |
}else{if(this._activeApp&&this._apps[this._activeApp]){this._apps[this._activeApp].stopAlert() | |
}}}; | |
ZmZimbraMail.prototype._setSearchTabNewButtonProps=function(e){var a; | |
if(e.isZmCalViewController){a=appCtxt.getApp(ZmApp.CALENDAR) | |
}else{var d=e._currentSearch; | |
var c=d&&d.types; | |
var b=c&&c.size()>0&&c.get(0); | |
a=b&&appCtxt.getApp(ZmItem.APP[b]) | |
}if(a){appCtxt.getAppController().setNewButtonProps(a.getNewButtonProps()) | |
}}; | |
ZmZimbraMail.prototype.getAppChooserButton=function(b){var a=this._components[ZmAppViewMgr.C_APP_CHOOSER]; | |
return a&&a.getButton(b) | |
}; | |
ZmZimbraMail.prototype.appRendered=function(a){var b=[a,ZmAppEvent.POST_RENDER].join("_"); | |
this.notify(b); | |
if(window._facadeCleanup){window._facadeCleanup(); | |
window._facadeCleanup=null | |
}}; | |
ZmZimbraMail.prototype.addApp=function(b){var a=b.getName(); | |
this._apps[a]=b; | |
ZmApp.ENABLED_APPS[a]=true | |
}; | |
ZmZimbraMail.prototype._createApp=function(appName){if(!appName||this._apps[appName]){return | |
}var appClass=eval(ZmApp.CLASS[appName]); | |
this.addApp(new appClass(this._shell)) | |
}; | |
ZmZimbraMail.prototype._setExternalLinks=function(){var c; | |
if(!appCtxt.isOffline&&(appCtxt.get(ZmSetting.IS_ADMIN)||appCtxt.get(ZmSetting.IS_DELEGATED_ADMIN))){c=appCtxt.get(ZmSetting.ADMIN_URL); | |
if(!c){c=["https://",location.hostname,":7071"].join("") | |
}}var a=document.getElementById("skin_container_links"); | |
if(a){var b={showOfflineLink:(!appCtxt.isOffline&&appCtxt.get(ZmSetting.SHOW_OFFLINE_LINK)),helpIcon:(appCtxt.getSkinHint("helpButton","hideIcon")?null:"Help"),logoutIcon:(appCtxt.getSkinHint("logoutButton","hideIcon")?null:"Logoff"),logoutText:(appCtxt.isOffline?ZmMsg.setup:ZmMsg.logOff),adminUrl:c}; | |
a.innerHTML=AjxTemplate.expand("share.App#UserInfo",b) | |
}a=document.getElementById("skin_container_help_button"); | |
if(a){this._helpButton=this.getHelpButton(DwtShell.getShell(window)); | |
this._helpButton.reparentHtmlElement("skin_container_help_button") | |
}a=document.getElementById("skin_dropMenu"); | |
if(a){this._helpButton=this.getDropMenuOptions(DwtShell.getShell(window),a,c) | |
}}; | |
ZmZimbraMail.ONLINE_HELP_URL="https://help.zimbra.com/?"; | |
ZmZimbraMail.NEW_FEATURES_URL="https://www.zimbra.com/products/whats_new.html?"; | |
ZmZimbraMail.DEFAULT_CONTACT_ICON=appContextPath+"/img/large/ImgPerson_48.png?v="+window.cacheKillerVersion; | |
ZmZimbraMail.DEFAULT_CONTACT_ICON_SMALL=appContextPath+"/img/large/ImgPerson_32.png?v="+window.cacheKillerVersion; | |
ZmZimbraMail.prototype.getDropMenuOptions=function(f,b,h){var e=new DwtLinkButton({parent:f,className:DwtButton.LINK_BUTTON_CLASS,parentElement:b,elementTag:"DIV"}); | |
e.whatToShow={}; | |
e.setSize(Dwt.DEFAULT); | |
e.setAlign(DwtLabel.ALIGN_LEFT); | |
e.setText(ZmMsg.help); | |
e.setAttribute("aria-label",ZmMsg.userActions); | |
var g=new ZmPopupMenu(e); | |
var a=appCtxt.get(ZmSetting.SUPPORTED_HELPS); | |
var d=new AjxListener(this,this._helpListener); | |
e.addSelectionListener(d); | |
var c; | |
if(h){c=g.createMenuItem("adminLink",{text:ZmMsg.adminLinkLabel}); | |
c.addSelectionListener(new AjxListener(null,ZmZimbraMail.adminLinkCallback,h)) | |
}c=g.createMenuItem("standardHtmlLink",{text:ZmMsg.htmlClient}); | |
c.addSelectionListener(ZmZimbraMail.standardHtmlLinkCallback); | |
g.createSeparator(); | |
if(a.indexOf("productHelp")!==-1){c=g.createMenuItem("documentation",{text:ZmMsg.productHelp}); | |
c.addSelectionListener(d) | |
}if(a.indexOf("onlineHelp")!==-1){c=g.createMenuItem("onlinehelp",{text:ZmMsg.onlineHelp}); | |
c.addSelectionListener(new AjxListener(this,this._onlineHelpListener)) | |
}if(a.indexOf("newFeatures")!==-1){c=g.createMenuItem("newFeatures",{text:ZmMsg.newFeatures}); | |
c.addSelectionListener(new AjxListener(this,this._newFeaturesListener)) | |
}c=g.createMenuItem("showCurrentShortcuts",{text:ZmMsg.shortcuts}); | |
c.addSelectionListener(this._showCurrentShortcuts.bind(this)); | |
g.createSeparator(); | |
c=g.createMenuItem(ZmZimbraMail.HELP_MENU_ABOUT,{text:ZmMsg.about}); | |
c.addSelectionListener(new AjxListener(this,this._aboutListener)); | |
g.createSeparator(); | |
if(!appCtxt.isExternalAccount()&&appCtxt.get(ZmSetting.WEBCLIENT_OFFLINE_ENABLED)){c=g.createMenuItem("offlineSettings",{text:ZmMsg.offlineSettings}); | |
c.addSelectionListener(new AjxListener(this,this._offlineSettingsListener)) | |
}if(AjxEnv.isFirefox&&(AjxEnv.browserVersion>=23)&&!appCtxt.isExternalAccount()){c=g.createMenuItem("socialfoxSettings",{text:ZmMsg.socialfoxEnableSidebar}); | |
c.addSelectionListener(this._socialfoxSettingsListener.bind(this)) | |
}if(appCtxt.get(ZmSetting.CHANGE_PASSWORD_ENABLED)){c=g.createMenuItem("changePassword",{text:ZmMsg.changePassword}); | |
c.addSelectionListener(new AjxListener(this,this._changePasswordListener)) | |
}c=g.createMenuItem(ZmZimbraMail.HELP_MENU_LOGOFF,{text:ZmMsg.logOff}); | |
c.addSelectionListener(new AjxListener(null,ZmZimbraMail.logOff)); | |
e.setMenu(g); | |
this.setupHelpMenu(e); | |
return e | |
}; | |
ZmZimbraMail.HELP_MENU_ABOUT="about"; | |
ZmZimbraMail.HELP_MENU_LOGOFF="logOff"; | |
ZmZimbraMail.prototype.setupHelpMenu=function(b){b=b||this._helpButton; | |
if(!b){return | |
}var c=b.getMenu(); | |
if(!c){return | |
}var d=!appCtxt.isWebClientOffline(); | |
if(d){c.enableAll(true) | |
}else{c.enableAll(false); | |
var a=[ZmZimbraMail.HELP_MENU_ABOUT]; | |
c.enable(a,true) | |
}}; | |
ZmZimbraMail.prototype.getNewButton=function(){var b=this._newButton; | |
if(!b){var a=ZmId.getButtonId(null,ZmOperation.NEW_MENU); | |
var e={parent:appCtxt.getShell(),id:a,posStyle:DwtControl.ABSOLUTE_STYLE,className:"ZToolbarButton ZNewButton"}; | |
b=this._newButton=new DwtToolBarButton(e); | |
b.setText(ZmMsg._new); | |
ZmOperation.addNewMenu(b); | |
var d=this._newButtonListener.bind(this); | |
var c=this._newDropDownListener.bind(this,d); | |
this._newDropDownListener=c; | |
b.addSelectionListener(d); | |
b.addDropDownSelectionListener(c) | |
}return b | |
}; | |
ZmZimbraMail.prototype._newDropDownListener=function(f,d){var c=this.getNewButton(); | |
var g=c.getMenu(); | |
var a=g.getItems(); | |
for(var b=0; | |
b<g.getItemCount(); | |
b++){a[b].addSelectionListener(f) | |
}var e=this._newDropDownListener; | |
c.removeDropDownSelectionListener(e); | |
c.popup(); | |
delete this._newDropDownListener | |
}; | |
ZmZimbraMail.prototype._newButtonListener=function(b,e,d){if(!b&&!e){return | |
}e=e||b.item.getData(ZmOperation.KEY_ID); | |
if(!e||e==ZmOperation.NEW_MENU){e=ZmController._defaultNewId | |
}var c=ZmApp.OPS_R[e]; | |
if(c){d=d||{}; | |
d.ev=b; | |
appCtxt.getApp(c).handleOp(e,d) | |
}else{var a=appCtxt.getCurrentController(); | |
if(a){a._newListener(b,e) | |
}}}; | |
ZmZimbraMail.prototype.setNewButtonProps=function(b){var a=this.getNewButton(); | |
if(a){a.setText(b.text); | |
a.setToolTipContent(b.tooltip); | |
a.setImage(b.icon); | |
a.setEnabled(!b.disabled); | |
ZmController._defaultNewId=b.defaultId; | |
b.hidden?a.setVisibility(false):a.setVisibility(true) | |
}}; | |
ZmZimbraMail.prototype.getHelpButton=function(d){var c=new DwtLinkButton({parent:d,className:DwtButton.LINK_BUTTON_CLASS}); | |
c.dontStealFocus(); | |
c.setSize(Dwt.DEFAULT); | |
c.setAlign(DwtLabel.ALIGN_LEFT); | |
c.setText(ZmMsg.help); | |
var e=new ZmPopupMenu(c); | |
var b=new AjxListener(this,this._helpListener); | |
c.addSelectionListener(b); | |
var a=e.createMenuItem("documentation",{text:ZmMsg.productHelp}); | |
a.addSelectionListener(b); | |
var a=e.createMenuItem("onlinehelp",{text:ZmMsg.onlineHelp}); | |
a.addSelectionListener(new AjxListener(this,this._onlineHelpListener)); | |
a=e.createMenuItem("newFeatures",{text:ZmMsg.newFeatures}); | |
a.addSelectionListener(new AjxListener(this,this._newFeaturesListener)); | |
a=e.createMenuItem("showCurrentShortcuts",{text:ZmMsg.shortcuts}); | |
a.addSelectionListener(this._showCurrentShortcuts.bind(this)); | |
e.createSeparator(); | |
a=e.createMenuItem("about",{text:ZmMsg.about}); | |
a.addSelectionListener(new AjxListener(this,this._aboutListener)); | |
c.setMenu(e); | |
return c | |
}; | |
ZmZimbraMail.prototype._helpListener=function(a){ZmZimbraMail.helpLinkCallback() | |
}; | |
ZmZimbraMail.prototype._getVersion=function(){return appCtxt.get(ZmSetting.CLIENT_VERSION) | |
}; | |
ZmZimbraMail.prototype._getQueryParams=function(){var b=appCtxt.getCurrentAppName().toLowerCase(); | |
var a=appCtxt.isOffline?"zd":"zcs"; | |
return["utm_source=",b,"&utm_medium=",a,"&utm_content=",this._getVersion(),"&utm_campaign=help"].join("") | |
}; | |
ZmZimbraMail.prototype._onlineHelpListener=function(b){ZmZimbraMail.unloadHackCallback(); | |
var a=[ZmZimbraMail.ONLINE_HELP_URL,this._getQueryParams()].join(""); | |
window.open(a) | |
}; | |
ZmZimbraMail.prototype._newFeaturesListener=function(b){ZmZimbraMail.unloadHackCallback(); | |
var a=[ZmZimbraMail.NEW_FEATURES_URL,this._getQueryParams()].join(""); | |
window.open(a) | |
}; | |
ZmZimbraMail.prototype._changePasswordListener=function(a){appCtxt.getChangePasswordWindow(a) | |
}; | |
ZmZimbraMail.prototype._aboutListener=function(e){var c=appCtxt.getMsgDialog(); | |
c.reset(); | |
var b=this._getVersion(); | |
var a=appCtxt.get(ZmSetting.CLIENT_RELEASE); | |
var d=appCtxt.isOffline?ZmMsg.aboutMessageZD:ZmMsg.aboutMessage; | |
c.setMessage(AjxMessageFormat.format(d,[b,a,AjxDateUtil.getYearStr()]),DwtMessageDialog.INFO_STYLE,ZmMsg.about); | |
c.popup() | |
}; | |
ZmZimbraMail.prototype._offlineSettingsListener=function(b){var a; | |
if(AjxEnv.isOfflineSupported){a=appCtxt.getOfflineSettingsDialog() | |
}else{a=appCtxt.getMsgDialog(); | |
a.setMessage(ZmMsg.offlineSupportedBrowser,"",ZmMsg.offlineSettings) | |
}a.popup() | |
}; | |
ZmZimbraMail.prototype._socialfoxSettingsListener=function(b){var a=new ZmSocialfoxActivationDialog(); | |
a.popup() | |
}; | |
ZmZimbraMail.prototype._initOfflineUserInfo=function(){var a=this._userNameField.getHTMLElId(); | |
this._userNameField.getHtmlElement().innerHTML=AjxTemplate.expand("share.App#NetworkStatus",{id:a}); | |
this._userNameField.addClassName("BannerTextUserOffline"); | |
var d={parent:this._userNameField,parentElement:(a+"_networkStatusIcon")}; | |
this._networkStatusIcon=new DwtComposite(d); | |
var b={parent:this._userNameField,parentElement:(a+"_networkStatusText")}; | |
this._networkStatusText=new DwtComposite(b); | |
var c=document.getElementById("skin_container_tree_top"); | |
if(c){Dwt.setSize(c,Dwt.DEFAULT,"20") | |
}}; | |
ZmZimbraMail.prototype._offlineUpdateChannelPref=function(c){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); | |
var a=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); | |
if(a){a.setCharPref("app.update.channel",c) | |
}}catch(b){}}; | |
ZmZimbraMail.prototype.setUserInfo=function(){if(appCtxt.isOffline){return | |
}var a=appCtxt.getLoggedInUsername(); | |
var c=(appCtxt.get(ZmSetting.DISPLAY_NAME))||a; | |
if(c){var b=this._userNameField.getHtmlElement(); | |
b.innerHTML=AjxStringUtil.htmlEncode(AjxStringUtil.clipByLength(c,24)); | |
b.setAttribute("aria-label",c); | |
if(AjxEnv.isLinux){b.style.lineHeight="13px" | |
}}this.setQuotaInfo(a,c) | |
}; | |
ZmZimbraMail.prototype.setQuotaInfo=function(a,h){var d=appCtxt.get(ZmSetting.QUOTA); | |
var g=(appCtxt.get(ZmSetting.QUOTA_USED))||0; | |
var f={id:this._usedQuotaField._htmlElId,login:a,username:h,quota:d,usedQuota:g,size:(AjxUtil.formatSize(g,false,1))}; | |
var e; | |
if(f.quota){e="UsedLimited"; | |
f.limit=AjxUtil.formatSize(f.quota,false,1); | |
f.percent=Math.min(Math.round((f.usedQuota/f.quota)*100),100); | |
f.desc=AjxMessageFormat.format(ZmMsg.usingDescLimited,[f.size,"("+f.percent+"%)",f.limit]) | |
}else{f.desc=AjxMessageFormat.format(ZmMsg.usingDescUnlimited,[f.size]); | |
e="UsedUnlimited" | |
}var c=this._usedQuotaField.getHtmlElement(); | |
c.innerHTML=AjxTemplate.expand("share.Quota#"+e,f); | |
c.setAttribute("aria-label",f.desc); | |
var b=AjxTemplate.expand("share.Quota#Tooltip",f); | |
this._components[ZmAppViewMgr.C_USER_INFO].setToolTipContent(b); | |
this._components[ZmAppViewMgr.C_QUOTA_INFO].setToolTipContent(b) | |
}; | |
ZmZimbraMail.setExitTimer=function(b){if(b&&ZmZimbraMail.stayOnPagePrompt){if(ZmZimbraMail._exitTimerId==-1){ZmZimbraMail._exitTimerId=AjxTimedAction.scheduleAction(ZmZimbraMail._exitTimer,ZmZimbraMail.STAYONPAGE_INTERVAL*60*1000); | |
if(AjxEnv.isFirefox){var c=AjxMessageFormat.format(ZmMsg.appExitPrompt,[ZmZimbraMail.STAYONPAGE_INTERVAL]); | |
var a=appCtxt.getMsgDialog(); | |
a.setMessage(c,DwtMessageDialog.CRITICAL_STYLE); | |
setTimeout(function(){a.popup() | |
},1000*2) | |
}}}else{if(!b&&ZmZimbraMail._exitTimerId){AjxTimedAction.cancelAction(ZmZimbraMail._exitTimerId); | |
ZmZimbraMail._exitTimerId=-1 | |
}}}; | |
ZmZimbraMail.logOff=function(e,d){if(appCtxt.isChildWindow){window.close(); | |
return | |
}if(appCtxt.isWebClientOfflineSupported&&(e||d)){return ZmOffline.handleLogOff(e,d) | |
}ZmZimbraMail._isLogOff=true; | |
if(appCtxt.isOffline&&AjxEnv.isWindows&&appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_DOCK_UPDATE)){window.platform.icon().imageSpec="resource://webapp/icons/default/launcher.ico"; | |
window.platform.icon().title=null | |
}var a={path:appContextPath,qsArgs:{loginOp:d?"relogin":"logout"}}; | |
if(d){a.qsArgs.username=appCtxt.getLoggedInUsername() | |
}if(appCtxt.isExternalAccount()){var c=appCtxt.getUserDomain(); | |
a.qsArgs.virtualacctdomain=c?c:"" | |
}var b=AjxUtil.formatUrl(a); | |
ZmZimbraMail.sendRedirect(b); | |
if(AjxEnv.isFirefox){ZmZimbraMail.setExitTimer(true) | |
}}; | |
ZmZimbraMail.exitSession=function(){ZmZimbraMail.logOff() | |
}; | |
ZmZimbraMail.executeSessionTimer=function(){ZmZimbraMail.sessionTimerInvoked=true; | |
ZmZimbraMail.logOff() | |
}; | |
ZmZimbraMail.getConfirmExitMethod=function(){return this._confirmExitMethod | |
}; | |
ZmZimbraMail._onClickLogOff=function(){if(AjxEnv.isIE){var a=DwtUiEvent.getEvent(); | |
a.returnValue=false | |
}ZmZimbraMail.logOff() | |
}; | |
ZmZimbraMail.adminLinkCallback=function(a){ZmZimbraMail.unloadHackCallback(); | |
var b=window.parentAppCtxt||window.appCtxt; | |
window.open(a) | |
}; | |
ZmZimbraMail.standardHtmlLinkCallback=function(){var a={path:appContextPath,qsArgs:{client:"standard"}}; | |
var b=AjxUtil.formatUrl(a); | |
ZmZimbraMail.sendRedirect(b) | |
}; | |
ZmZimbraMail.helpLinkCallback=function(c){ZmZimbraMail.unloadHackCallback(); | |
var d=window.parentAppCtxt||window.appCtxt; | |
var b; | |
if(!d.isOffline){try{b=c||skin.hints.helpButton.url | |
}catch(f){}b=b||d.get(ZmSetting.HELP_URI); | |
var a=b.match(/\?/)?"&":"?"; | |
b=[b,a,"locid=",AjxEnv.DEFAULT_LOCALE].join("") | |
}else{b=d.get(ZmSetting.HELP_URI).replace(/\/$/,""); | |
b=[b,"help","en_US","Zimbra_Mail_Help.htm"].join("/") | |
}window.open(b) | |
}; | |
ZmZimbraMail.sendRedirect=function(b){if(AjxEnv.isIE){var a=new AjxTimedAction(null,ZmZimbraMail.redir,[b]); | |
AjxTimedAction.scheduleAction(a,1) | |
}else{ZmZimbraMail.redir(b) | |
}}; | |
ZmZimbraMail.redir=function(b){try{window.location=b | |
}catch(a){}}; | |
ZmZimbraMail.prototype.setSessionTimer=function(b){var a=appCtxt.get(ZmSetting.IDLE_SESSION_TIMEOUT)*1000; | |
if(a<=0){return | |
}if(b){this._sessionTimerId=AjxTimedAction.scheduleAction(this._sessionTimer,a); | |
DwtEventManager.addListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr); | |
this._shell.setHandler(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr); | |
if(document.attachEvent){document.attachEvent("onkeydown",ZmZimbraMail._userEventHdlr) | |
}window.onkeydown=ZmZimbraMail._userEventHdlr | |
}else{AjxTimedAction.cancelAction(this._sessionTimerId); | |
this._sessionTimerId=-1; | |
DwtEventManager.removeListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr); | |
this._shell.clearHandler(DwtEvent.ONMOUSEUP); | |
if(document.detachEvent){document.detachEvent("onkeydown",ZmZimbraMail._userEventHdlr) | |
}window.onkeydown=null | |
}}; | |
ZmZimbraMail.prototype.addChildWindow=function(c,b){if(this._childWinList==null){this._childWinList=new AjxVector() | |
}var a={win:c,childId:b}; | |
this._childWinList.add(a); | |
return a | |
}; | |
ZmZimbraMail.prototype.getChildWindow=function(d){var c=this._childWinList; | |
if(c&&d){for(var b=0; | |
b<c.size(); | |
b++){var a=c.get(b); | |
if(d===a.win||d.childId===a.childId){return a | |
}}}return null | |
}; | |
ZmZimbraMail.prototype.removeChildWindow=function(d){var c=this._childWinList; | |
if(c){for(var b=0; | |
b<c.size(); | |
b++){var a=c.get(b); | |
if(d==a.win){a.win=null; | |
break | |
}}}}; | |
ZmZimbraMail.prototype._handleException=function(g,b){var d=false; | |
if(g.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER){var a=[ZmOrganizer.CALENDAR,ZmOrganizer.ADDRBOOK]; | |
if(g.data.itemId&&g.data.itemId.length){var i=g.data.itemId[0]; | |
var e=i.lastIndexOf(":"); | |
var f=i.substring(0,e); | |
var j=i.substring(e+1,i.length); | |
var c=appCtxt.getFolderTree(); | |
for(var h=0; | |
h<a.length; | |
h++){d|=c.handleNoSuchFolderError(a[h],f,j,true) | |
}}}else{if(appCtxt.isWebClientOffline()&&g.code===ZmCsfeException.EMPTY_RESPONSE){d=true | |
}}if(!d){ZmController.prototype._handleException.apply(this,arguments) | |
}}; | |
ZmZimbraMail._confirmExitMethod=function(){if(!ZmCsfeCommand.noAuth){appCtxt.accountList.saveImplicitPrefs(); | |
if(appCtxt.get(ZmSetting.WARN_ON_EXIT)&&!ZmZimbraMail._isOkToExit()){if(ZmZimbraMail.stayOnPagePrompt){return | |
}ZmZimbraMail._isLogOff=false; | |
var a=(appCtxt.isOffline)?ZmMsg.appExitWarningZD:ZmMsg.appExitWarning; | |
if(ZmZimbraMail.sessionTimerInvoked){ZmZimbraMail.stayOnPagePrompt=true; | |
a=AjxMessageFormat.format(a+ZmMsg.appExitTimeWarning,[ZmZimbraMail.STAYONPAGE_INTERVAL]) | |
}if(!AjxEnv.isFirefox){ZmZimbraMail.setExitTimer(true) | |
}return a | |
}ZmZimbraMail._endSession() | |
}if(window.ZmDesktopAlert){ZmDesktopAlert.closeNotification() | |
}ZmZimbraMail._endSessionDone=true | |
}; | |
ZmZimbraMail._isOkToExit=function(){var b=window._zimbraMail; | |
if(!b){return true | |
}var a=b._appViewMgr.isOkToUnload()&&ZmZimbraMail._childWindowsOkToUnload(); | |
if(a&&!AjxEnv.isPrism&&b._pollRequest){b._requestMgr.cancelRequest(b._pollRequest) | |
}return a | |
}; | |
ZmZimbraMail._childWindowsOkToUnload=function(){var b=window._zimbraMail?window._zimbraMail._childWinList:null; | |
if(b){for(var a=0; | |
a<b.size(); | |
a++){var c=b.get(a); | |
if(c.win&&c.win.ZmNewWindow&&c.win.ZmNewWindow._confirmExitMethod()){return false | |
}}}return true | |
}; | |
ZmZimbraMail.handleNetworkStatusClick=function(){var a=window.appCtxt.getAppController(); | |
if(!a._isPrismOnline){return | |
}a._isUserOnline=!a._isUserOnline; | |
a._updateNetworkStatus(a._isUserOnline) | |
}; | |
ZmZimbraMail.unloadHackCallback=function(){window.onbeforeunload=null; | |
var a=function(){window.onbeforeunload=ZmZimbraMail._confirmExitMethod | |
}; | |
AjxTimedAction.scheduleAction((new AjxTimedAction(null,a)),3000) | |
}; | |
ZmZimbraMail._userEventHdlr=function(b){var a=window._zimbraMail; | |
if(a){AjxTimedAction.cancelAction(a._sessionTimerId); | |
var c=appCtxt.get(ZmSetting.IDLE_SESSION_TIMEOUT)*1000; | |
if(c<=0){return | |
}a._sessionTimerId=AjxTimedAction.scheduleAction(a._sessionTimer,c) | |
}}; | |
ZmZimbraMail.prototype._createBanner=function(){var a=new DwtComposite({parent:this._shell,posStyle:Dwt.ABSOLUTE_STYLE,id:ZmId.BANNER}); | |
var c=appCtxt.getSkinHint("banner","url")||appCtxt.get(ZmSetting.LOGO_URI); | |
var b={url:c,isOffline:appCtxt.isOffline}; | |
a.getHtmlElement().innerHTML=AjxTemplate.expand("share.App#Banner",b); | |
a.getHtmlElement().style.height="100%"; | |
return a | |
}; | |
ZmZimbraMail.prototype._createUserInfo=function(c,f,e){var a=appCtxt.getSkinHint(f,"position"); | |
var b=a||Dwt.ABSOLUTE_STYLE; | |
var d=new DwtComposite({parent:this._shell,className:c,posStyle:b,id:e,isFocusable:true}); | |
d._setMouseEventHdlrs(); | |
return d | |
}; | |
ZmZimbraMail.prototype._createAppChooser=function(){var b=[]; | |
for(var d in ZmApp.CHOOSER_SORT){if(d==ZmAppChooser.SPACER||d==ZmAppChooser.B_HELP||d==ZmAppChooser.B_LOGOUT){continue | |
}if(this._isInternalApp(d)||this._isIframeApp(d)){b.push(d) | |
}}b.sort(function(f,e){return ZmZimbraMail.hashSortCompare(ZmApp.CHOOSER_SORT,f,e) | |
}); | |
var c=new ZmAppChooser({parent:this._shell,buttons:b,id:ZmId.APP_CHOOSER,refElementId:ZmId.SKIN_APP_CHOOSER}); | |
var a=new AjxListener(this,this._appButtonListener); | |
c.addSelectionListener(a); | |
return c | |
}; | |
ZmZimbraMail.prototype._appButtonListener=function(b){try{var d=b.item.getData(Dwt.KEY_ID); | |
if(d==ZmAppChooser.B_HELP){window.open(appCtxt.get(ZmSetting.HELP_URI)) | |
}else{if(d==ZmAppChooser.B_LOGOUT){ZmZimbraMail.logOff() | |
}else{if(d&&ZmApp.ENABLED_APPS[d]&&(d!=this._activeTabId)){this.activateApp(d); | |
if(appCtxt.zimletsPresent()){appCtxt.getZimletMgr().notifyZimlets("onSelectApp",d) | |
}}else{var c=(DwtUiEvent.getTargetWithProp(b,"id")==b.item._getIconEl(DwtLabel.RIGHT)); | |
if(c){this._appViewMgr.popView(false,d) | |
}else{if(d!=this._activeTabId){this._appViewMgr.pushView(d) | |
}}}}}}catch(a){this._handleException(a) | |
}}; | |
ZmZimbraMail.prototype.getAppChooser=function(){return this._appChooser | |
}; | |
ZmZimbraMail.prototype.setActiveTabId=function(a){this._activeTabId=a; | |
this._appChooser.setSelected(a) | |
}; | |
ZmZimbraMail.prototype.setStatusMsg=function(a){a=Dwt.getParams(arguments,ZmStatusView.MSG_PARAMS); | |
this.statusView.setStatusMsg(a) | |
}; | |
ZmZimbraMail.prototype.dismissStatusMsg=function(a){this.statusView.dismissStatusMsg(a) | |
}; | |
ZmZimbraMail.prototype.getKeyMapName=function(){var a=appCtxt.getCurrentController(); | |
if(a&&a.getKeyMapName){return a.getKeyMapName() | |
}return ZmKeyMap.MAP_GLOBAL | |
}; | |
ZmZimbraMail.prototype.handleKeyAction=function(g,i){DwtMenu.closeActiveMenu(); | |
var a=ZmApp.GOTO_ACTION_CODE_R[g]; | |
if(a){if(a==this.getActiveApp()){return false | |
}if(appCtxt.isWebClientOffline()&&!AjxUtil.arrayContains(ZmOffline.SUPPORTED_APPS,a)){return false | |
}this.activateApp(a); | |
return true | |
}switch(g){case ZmKeyMap.QUICK_REMINDER:var f=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount; | |
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,f)&&!appCtxt.isWebClientOffline()){var h=appCtxt.getCalManager(); | |
h.showQuickReminder() | |
}break; | |
case ZmKeyMap.FOCUS_SEARCH_BOX:var b=appCtxt.getSearchController().getSearchToolbar(); | |
if(b){var k=b.getSearchField(); | |
appCtxt.getKeyboardMgr().grabFocus(k); | |
if(ZmSearchAutocomplete){ZmSearchAutocomplete._ignoreNextKey=true | |
}}break; | |
case ZmKeyMap.FOCUS_CONTENT_PANE:this.focusContentPane(); | |
break; | |
case ZmKeyMap.FOCUS_TOOLBAR:this.focusToolbar(); | |
break; | |
case ZmKeyMap.SHORTCUTS:this._showCurrentShortcuts(); | |
break; | |
case ZmKeyMap.CANCEL:var e=false; | |
var d=(DwtMouseEventCapture.getId()=="DwtControl")?DwtMouseEventCapture.getCaptureObj():null; | |
var c=d&&d.targetObj; | |
if(c&&(c._dragging==DwtControl._DRAGGING)){d.release(); | |
c.__lastDestDwtObj=null; | |
c._setDragProxyState(false); | |
DwtControl.__badDrop(c,DwtShell.mouseEvent); | |
e=true | |
}if(e){break | |
}default:var j=appCtxt.getCurrentController(); | |
return j&&j.handleKeyAction?j.handleKeyAction(g,i):false | |
}return true | |
}; | |
ZmZimbraMail.prototype.focusContentPane=function(){var a=appCtxt.getCurrentController(); | |
var b=a&&a._getDefaultFocusItem(); | |
if(b){appCtxt.getKeyboardMgr().grabFocus(b) | |
}}; | |
ZmZimbraMail.prototype.focusToolbar=function(){var a=appCtxt.getCurrentController(); | |
var b=a&&a.getCurrentToolbar&&a.getCurrentToolbar(); | |
if(b){appCtxt.getKeyboardMgr().grabFocus(b) | |
}}; | |
ZmZimbraMail.prototype._createAppIframeView=function(a){var h=[a,"iframe"].join("_"),e=(a===ZmApp.SOCIAL),g={appName:a},c=this._appIframeView[a]; | |
if(!c){c=this._appIframeView[a]=e?new ZmCommunityView(g):new ZmAppIframeView(g); | |
var f={},d={}; | |
f[ZmAppViewMgr.C_APP_CONTENT]=c; | |
d[ZmAppViewMgr.CB_POST_SHOW]=this._displayAppIframeView.bind(this); | |
var b=[ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_NEW_BUTTON,ZmAppViewMgr.C_SASH]; | |
this._appViewMgr.createView({viewId:h,appName:a,controller:this,elements:f,hide:b,isTransient:true,isFullScreen:true,callbacks:d}) | |
}this._appViewMgr.pushView(h); | |
c.activate(true) | |
}; | |
ZmZimbraMail.prototype._displayAppIframeView=function(a){appCtxt.getApp(this._getDefaultStartAppName()).setOverviewPanelContent(false) | |
}; | |
ZmZimbraMail.prototype._postLoadZimlet=function(){appCtxt.setZimletsPresent(true) | |
}; | |
ZmZimbraMail.prototype._globalSelectionListener=function(e){if(this._waitDisallowed){this._waitDisallowed=false; | |
this.setInstantNotify(true) | |
}if(!appCtxt.areZimletsLoaded()){return | |
}var d=e.item; | |
var h=(d&&d.getText)?(d.getText()||d._toggleText):null; | |
if(d&&!h){h=d.getData(ZmOperation.KEY_ID)||d.getData(Dwt.KEY_ID) | |
}if(h){var c; | |
if(d instanceof ZmAppButton){c="app" | |
}else{if(d instanceof DwtMenuItem){c="menuitem" | |
}else{if(d instanceof DwtButton){c="button" | |
}else{if(d instanceof DwtTreeItem){if(!d.getSelected()){return | |
}c="treeitem" | |
}else{c=d.toString() | |
}}}}var b=appCtxt.getAppViewMgr(); | |
var a=b.getCurrentViewId(); | |
var g=b.getLastViewId(); | |
var f=(AjxStringUtil.split((""+h)," ")).join(""); | |
appCtxt.notifyZimlets("onAction",[c,f,a,g]) | |
}}; | |
ZmZimbraMail._folderTreeSashRelease=function(b){var a=skin.getTreeWidth(); | |
if(a){appCtxt.set(ZmSetting.FOLDER_TREE_SASH_WIDTH,a) | |
}}; | |
ZmZimbraMail._endSession=function(){if(!AjxEnv.isPrism&&navigator.onLine){var b={jsonObj:{EndSessionRequest:{_jsns:"urn:zimbraAccount"}},asyncMode:!appCtxt.get("FORCE_CLEAR_COOKIES"),emptyResponseOkay:true}; | |
var a=appCtxt.getAppController(); | |
a&&a.sendRequest(b) | |
}}; | |
ZmZimbraMail.prototype.notify=function(a){this._evtMgr.notifyListeners(a,this._evt) | |
}; | |
ZmZimbraMail.prototype._showCurrentShortcuts=function(){var b=appCtxt.getShortcutsPanel(); | |
var k=this.getKeyMapName(); | |
var a=appCtxt.getAppController().getKeyMapMgr(); | |
var l=a.getAncestors(k); | |
var m=(l&&l.length>0); | |
l.unshift(k); | |
var e=[]; | |
if(m){if(l.length>1&&l[l.length-1]==ZmKeyMap.MAP_GLOBAL){l.pop(); | |
e.push(ZmKeyMap.MAP_GLOBAL) | |
}}var j={},h={}; | |
j.type=ZmShortcutList.TYPE_APP; | |
j.maps=l; | |
var d=[j]; | |
if(e.length){h.type=ZmShortcutList.TYPE_APP; | |
h.maps=e; | |
d.push(h) | |
}var g={}; | |
g.type=ZmShortcutList.TYPE_SYS; | |
g.maps=[]; | |
var n=appCtxt.getCurrentController(); | |
var c=["list","editor","tabView"]; | |
for(var f=0; | |
f<c.length; | |
f++){if(n&&n.mapSupported(c[f])){g.maps.push(c[f]) | |
}}g.maps.push("button","menu","tree","dialog","toolbarHorizontal"); | |
d.push(g); | |
b.popup(d) | |
}; | |
ZmOrganizer.ZIMLET="ZIMLET" | |
}if(AjxPackage.define("zimbraMail.prefs.model.ZmPref")){ZmPref=function(c,b,a){ZmSetting.call(this,c,b,ZmSetting.T_PREF,a); | |
this.origValue=null; | |
this.isDirty=false | |
}; | |
ZmPref.prototype=new ZmSetting; | |
ZmPref.prototype.constructor=ZmPref; | |
ZmPref.prototype.isZmPref=true; | |
ZmPref.prototype.toString=function(){return"ZmPref" | |
}; | |
ZmPref.KEY_ID="prefId_"; | |
ZmPref.TYPE_STATIC="STATIC"; | |
ZmPref.TYPE_INPUT="INPUT"; | |
ZmPref.TYPE_CHECKBOX="CHECKBOX"; | |
ZmPref.TYPE_COLOR="COLOR"; | |
ZmPref.TYPE_RADIO_GROUP="RADIO_GROUP"; | |
ZmPref.TYPE_SELECT="SELECT"; | |
ZmPref.TYPE_COMBOBOX="COMBOBOX"; | |
ZmPref.TYPE_TEXTAREA="TEXTAREA"; | |
ZmPref.TYPE_PASSWORD="PASSWORD"; | |
ZmPref.TYPE_IMPORT="IMPORT"; | |
ZmPref.TYPE_EXPORT="EXPORT"; | |
ZmPref.TYPE_SHORTCUTS="SHORTCUTS"; | |
ZmPref.TYPE_CUSTOM="CUSTOM"; | |
ZmPref.TYPE_LOCALES="LOCALES"; | |
ZmPref.TYPE_FONT="FONT"; | |
ZmPref.TYPE_FONT_SIZE="FONT_SIZE"; | |
ZmPref.ORIENT_VERTICAL="vertical"; | |
ZmPref.ORIENT_HORIZONTAL="horizontal"; | |
ZmPref.MAX_ROWS=7; | |
ZmPref.loadSkins=function(a){var e=appCtxt.get(ZmSetting.AVAILABLE_SKINS); | |
a.options=[]; | |
for(var b=0; | |
b<e.length; | |
b++){var c=e[b]; | |
a.options.push(c); | |
var d=ZmMsg["theme-"+c]||c.substr(0,1).toUpperCase()+c.substr(1); | |
a.displayOptions.push(d) | |
}}; | |
ZmPref.loadCsvFormats=function(b){var a=appCtxt.get(ZmSetting.AVAILABLE_CSVFORMATS); | |
if(!a._options){var c=a._options=[]; | |
var e=a._displayOptions=[]; | |
for(var d=0; | |
d<a.length; | |
d++){c.push(a[d]) | |
}c.sort(ZmPref.__BY_CSVFORMAT); | |
for(var d=0; | |
d<c.length; | |
d++){e.push((ZmMsg[c[d]]||c[d])) | |
}}b.options=a._options; | |
b.displayOptions=a._displayOptions | |
}; | |
ZmPref.__BY_CSVFORMAT=function(d,c){if(d.match(/^zimbra/)){return -1 | |
}if(c.match(/^zimbra/)){return 1 | |
}if(d.match(/^yahoo/)){return -1 | |
}if(c.match(/^yahoo/)){return 1 | |
}return d.localeCompare(c) | |
}; | |
ZmPref.loadPageSizes=function(b){var a=(b.maxSetting&&appCtxt.get(b.maxSetting))||100; | |
var e=[]; | |
for(var d=0; | |
d<ZmPref.PAGE_SIZES.length; | |
d++){var c=parseInt(ZmPref.PAGE_SIZES[d]); | |
if(c<=a){e.push(ZmPref.PAGE_SIZES[d]) | |
}}if(a>ZmPref.PAGE_SIZES[ZmPref.PAGE_SIZES.length-1]){e.push(String(a)) | |
}b.displayOptions=b.options=e | |
}; | |
ZmPref.PAGE_SIZES=["10","25","50","100","250","500","1000"]; | |
ZmPref.validateEmail=function(a){if(a){return a.match(/\@localhost$/i)||AjxEmailAddress.parse(a)!=null | |
}return true | |
}; | |
ZmPref.validateEmailList=function(a){for(var b in a){if(!ZmPref.validateEmail(a[b])){return false | |
}}return true | |
}; | |
ZmPref.downloadSinceDisplay=function(a){if(!a){return ZmMailApp.POP_DOWNLOAD_SINCE_ALL | |
}if(a===appCtxt.get(ZmSetting.POP_DOWNLOAD_SINCE)){return ZmMailApp.POP_DOWNLOAD_SINCE_NO_CHANGE | |
}return ZmMailApp.POP_DOWNLOAD_SINCE_FROM_NOW | |
}; | |
ZmPref.downloadSinceValue=function(b){if(b==ZmMailApp.POP_DOWNLOAD_SINCE_ALL){return"" | |
}if(b==ZmMailApp.POP_DOWNLOAD_SINCE_NO_CHANGE){return appCtxt.get(ZmSetting.POP_DOWNLOAD_SINCE) | |
}var a=new Date(); | |
a.setMinutes(a.getMinutes()+a.getTimezoneOffset()); | |
return AjxDateFormat.format("yyyyMMddHHmmss'Z'",a) | |
}; | |
ZmPref.validatePollingInterval=function(a){var c=appCtxt.get(ZmSetting.MIN_POLLING_INTERVAL); | |
if(a&&(!c||a>=c)){return true | |
}else{var b=c/60; | |
ZmPref.SETUP[ZmSetting.POLLING_INTERVAL].errorMessage=AjxMessageFormat.format(ZmMsg.invalidPollingInterval,b); | |
return false | |
}}; | |
ZmPref.pollingIntervalDisplay=function(a){if(appCtxt.get(ZmSetting.INSTANT_NOTIFY)&&a==appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL)){return a | |
}else{return a/60 | |
}}; | |
ZmPref.pollingIntervalValue=function(a){if(appCtxt.get(ZmSetting.INSTANT_NOTIFY)&&a==appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL)){return a | |
}else{return a*60 | |
}}; | |
ZmPref.int2DurationDay=function(a){return a!=null&&a!=0?a+"d":a | |
}; | |
ZmPref.string2EmailList=function(d){var e=[]; | |
var f,c=AjxEmailAddress.split(d); | |
if(c&&c.length){for(var b=0; | |
b<c.length; | |
b++){f=c[b]; | |
var a=AjxEmailAddress.parse(f); | |
if(a){f=a.getAddress() | |
}if(f){e.push(AjxStringUtil.htmlEncode(f)) | |
}}}return e | |
}; | |
ZmPref.durationDay2Int=function(a){return parseInt(a,10) | |
}; | |
ZmPref.approximateInterval=function(b){var a=[].concat(ZmPref.SETUP.POLLING_INTERVAL.options); | |
a.sort(ZmPref.__BY_NUMBER); | |
return ZmPref.approximateValue(a,b) | |
}; | |
ZmPref.approximateValue=function(f,j){for(var h=0; | |
h<f.length+1; | |
h++){var d=f[h]; | |
var c=f[h+1]; | |
if(j<c){var g=j-d; | |
var e=c-j; | |
return g<e?d:c | |
}}return f[f.length-1] | |
}; | |
ZmPref.validateLifetime=function(b){var a=appCtxt.get(ZmSetting.MAIL_LIFETIME_GLOBAL); | |
if(a=="0"){return true | |
}return ZmPref.__BY_DURATION(b,a)<=0 | |
}; | |
ZmPref.validateLifetimeJunk=function(b){var a=appCtxt.get(ZmSetting.MAIL_LIFETIME_JUNK_GLOBAL); | |
if(a=="0"){return true | |
}return ZmPref.__BY_DURATION(b,a)<=0&&ZmPref.validateLifetime(b) | |
}; | |
ZmPref.validateLifetimeTrash=function(b){var a=appCtxt.get(ZmSetting.MAIL_LIFETIME_TRASH_GLOBAL); | |
if(a=="0"){return true | |
}return ZmPref.__BY_DURATION(b,a)<=0&&ZmPref.validateLifetime(b) | |
}; | |
ZmPref.approximateLifetimeInboxRead=function(a){return ZmPref.approximateLifetime("MAIL_LIFETIME_INBOX_READ",a,ZmPref.validateLifetime) | |
}; | |
ZmPref.approximateLifetimeInboxUnread=function(a){return ZmPref.approximateLifetime("MAIL_LIFETIME_INBOX_UNREAD",a,ZmPref.validateLifetime) | |
}; | |
ZmPref.approximateLifetimeJunk=function(a){return ZmPref.approximateLifetime("MAIL_LIFETIME_JUNK",a,ZmPref.validateLifetimeJunk,ZmPref.validateLifetime) | |
}; | |
ZmPref.approximateLifetimeSent=function(a){return ZmPref.approximateLifetime("MAIL_LIFETIME_SENT",a,ZmPref.validateLifetime) | |
}; | |
ZmPref.approximateLifetimeTrash=function(a){return ZmPref.approximateLifetime("MAIL_LIFETIME_TRASH",a,ZmPref.validateLifetimeTrash,ZmPref.validateLifetime) | |
}; | |
ZmPref.approximateLifetime=function(e,a,c){var h=[].concat(ZmPref.SETUP[e].options); | |
for(var d=0; | |
d<h.length; | |
d++){var g=h[d]; | |
h[d]=ZmPref.__DUR2SECS(g!="0"?g+"d":g) | |
}h.sort(ZmPref.__BY_NUMBER); | |
valuesLoop:for(var d=h.length-1; | |
d>=0; | |
d--){for(var b=2; | |
b<arguments.length; | |
b++){var k=arguments[b]; | |
var g=ZmPref.__SECS2DUR(h[d]); | |
if(!k(g)){h.pop(); | |
continue valuesLoop | |
}}break | |
}var f; | |
if(a=="0"){f=h[h.length-1] | |
}else{f=ZmPref.approximateValue(h,ZmPref.__DUR2SECS(a+"d")) | |
}a=ZmPref.__SECS2DUR(f); | |
return a!="0"?parseInt(a,10):0 | |
}; | |
ZmPref.markMsgReadDisplay=function(a){return(a>0)?1:a | |
}; | |
ZmPref.markMsgReadValue=function(c){if(c==ZmSetting.MARK_READ_TIME){var b=DwtId.makeId(ZmId.WIDGET_INPUT,ZmId.OP_MARK_READ); | |
var a=DwtControl.fromElementId(b); | |
if(a){return a.getValue()||ZmSetting.MARK_READ_NOW | |
}}return c | |
}; | |
ZmPref.setFormValue=function(a,c){var e=appCtxt.getApp(ZmApp.PREFERENCES); | |
var d=ZmPref.getPrefSectionWithPref(a); | |
if(e&&d){var b=e.getPreferencesPage(d.id); | |
if(b){b.setFormValue(a,c) | |
}}}; | |
ZmPref.getFormValue=function(a){var d=appCtxt.getApp(ZmApp.PREFERENCES); | |
var c=ZmPref.getPrefSectionWithPref(a); | |
if(d&&c){var b=d.getPreferencesPage(c.id); | |
if(b){return b.getFormValue(a) | |
}}}; | |
ZmPref.setIncludeOrig=function(j,f,d){j.setValue(f); | |
j.origValue=j.copyValue(); | |
var b=[ZmSetting.REPLY_INCLUDE_WHAT,ZmSetting.REPLY_USE_PREFIX,ZmSetting.REPLY_INCLUDE_HEADERS]; | |
var c=AjxUtil.arrayAsHash(b); | |
var e=ZmSetting.REPLY_INCLUDE_ORIG; | |
if(!c[j.id]){b=[ZmSetting.FORWARD_INCLUDE_WHAT,ZmSetting.FORWARD_USE_PREFIX,ZmSetting.FORWARD_INCLUDE_HEADERS]; | |
e=ZmSetting.FORWARD_INCLUDE_ORIG | |
}var h=AjxUtil.map(b,function(k){return appCtxt.get(k) | |
}); | |
var g=(h[0]==ZmSetting.INC_NONE||h[0]==ZmSetting.INC_ATTACH)?h[0]:h.join("|"); | |
var a=ZmMailApp.INC_MAP_REV[g]; | |
var i=appCtxt.getSettings().getSetting(e); | |
i.setValue(a); | |
d.push(i) | |
}; | |
ZmPref.addOOOVacationExternalPrefToList=function(c,b,a){var d=appCtxt.get(b); | |
if(d!==a){prefToAdd=appCtxt.getSettings().getSetting(b); | |
prefToAdd.setValue(a); | |
c.push(prefToAdd) | |
}}; | |
ZmPref.addOOOVacationExternalPrefOnSave=function(a,d,c,b){var f,e; | |
ZmPref.addOOOVacationExternalPrefToList(c,ZmSetting.VACATION_EXTERNAL_SUPPRESS,d); | |
f=b.getFormObject(ZmSetting.VACATION_EXTERNAL_SUPPRESS); | |
e=f.getText(); | |
if(e.indexOf(ZmMsg.vacationExternalReplySuppress)===-1){if(e===ZmMsg.vacationExternalAllStandard){ZmPref.addOOOVacationExternalPrefToList(c,ZmSetting.VACATION_EXTERNAL_MSG_ENABLED,false); | |
return | |
}if(e===ZmMsg.vacationExternalAllCustom){ZmPref.addOOOVacationExternalPrefToList(c,ZmSetting.VACATION_EXTERNAL_TYPE,"ALL") | |
}if(e===ZmMsg.vacationExternalAllExceptABCustom){ZmPref.addOOOVacationExternalPrefToList(c,ZmSetting.VACATION_EXTERNAL_TYPE,"ALLNOTINAB") | |
}ZmPref.addOOOVacationExternalPrefToList(c,ZmSetting.VACATION_EXTERNAL_MSG_ENABLED,true) | |
}}; | |
ZmPref.initOOOVacationExternalSuppress=function(){var d=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_EXTERNAL_MSG); | |
var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView().getView(d.id); | |
var c=a.getFormObject(ZmSetting.VACATION_EXTERNAL_MSG); | |
var e=a.getFormObject(ZmSetting.VACATION_EXTERNAL_SUPPRESS); | |
if(appCtxt.get(ZmSetting.VACATION_EXTERNAL_SUPPRESS)){c.setVisible(false); | |
return | |
}if(!appCtxt.get(ZmSetting.VACATION_EXTERNAL_MSG_ENABLED)){e.setSelected(0); | |
c.setVisible(false); | |
return | |
}var b={ALL:1,ALLNOTINAB:2}; | |
e.setSelected(b[appCtxt.get(ZmSetting.VACATION_EXTERNAL_TYPE)]) | |
}; | |
ZmPref.initIncludeWhat=function(a,b){AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){ZmPref._showIncludeOptions(a,(b==ZmSetting.INC_BODY||b==ZmSetting.INC_SMART)) | |
}),100) | |
}; | |
ZmPref.onChangeIncludeWhat=function(d){var a=d._args.newValue; | |
var c=d._args.oldValue; | |
var e=(a==ZmSetting.INC_BODY||a==ZmSetting.INC_SMART); | |
var b=(c==ZmSetting.INC_BODY||c==ZmSetting.INC_SMART); | |
if(e!=b){ZmPref._showIncludeOptions(d._args.selectObj,e) | |
}}; | |
ZmPref._showIncludeOptions=function(a,b){var c=(a._name==ZmSetting.REPLY_INCLUDE_WHAT)?[ZmSetting.REPLY_USE_PREFIX,ZmSetting.REPLY_INCLUDE_HEADERS]:[ZmSetting.FORWARD_USE_PREFIX,ZmSetting.FORWARD_INCLUDE_HEADERS]; | |
for(var d=0; | |
d<c.length; | |
d++){var e=a.parent._dwtObjects[c[d]]; | |
if(e){e.setVisible(b) | |
}}}; | |
ZmPref.getSendToFiltersActive=function(a,b){if(a.target.checked){if(b){b.run(false) | |
}return false | |
}AjxDispatcher.run("GetFilterController").hasOutgoingFiltersActive(b) | |
}; | |
ZmPref.onChangeConfirm=function(c,b,e,g,d){var a=false; | |
var f=e?new AjxCallback(this,ZmPref._showOnChangeConfirm,[c,g]):null; | |
if(AjxUtil.isFunction(b)){a=b(d,f) | |
}else{if(AjxUtil.isInstance(b,AjxCallback)){a=b.run(d,f) | |
}else{a=b | |
}}ZmPref._showOnChangeConfirm(c,g,a) | |
}; | |
ZmPref._showOnChangeConfirm=function(c,d,a){if(a){if(a){var b=appCtxt.getYesNoMsgDialog(); | |
b.reset(); | |
b.setMessage(c); | |
b.setButtonListener(DwtDialog.NO_BUTTON,new AjxListener(null,ZmPref._handleOnChangeConfirmNo,[d])); | |
b.popup() | |
}}}; | |
ZmPref._handleOnChangeConfirmNo=function(a){if(a){a.run() | |
}appCtxt.getYesNoMsgDialog().popdown() | |
}; | |
ZmPref.__BY_NUMBER=function(d,c){if(d==c){return 0 | |
}if(d==Math.POSITIVE_INFINITY||c==Math.NEGATIVE_INFINITY){return 1 | |
}if(c==Math.POSITIVE_INFINITY||d==Math.NEGATIVE_INFINITY){return -1 | |
}return Number(d)-Number(c) | |
}; | |
ZmPref.__BY_DURATION=function(d,c){if(d==c){return 0 | |
}if(d=="0"){return 1 | |
}if(c=="0"){return -1 | |
}var e=ZmPref.__DUR2SECS(d); | |
var f=ZmPref.__DUR2SECS(c); | |
return e-f | |
}; | |
ZmPref.__DURMULT={s:1,m:60,h:3600,d:86400}; | |
ZmPref.__DURDIV={86400:"d",3600:"h",60:"m",1:"s"}; | |
ZmPref.__DUR2SECS=function(b){if(b=="0"){return Number.POSITIVE_INFINITY | |
}var a=b.substring(b.length-1).toLowerCase(); | |
return parseInt(b,10)*ZmPref.__DURMULT[a] | |
}; | |
ZmPref.__SECS2DUR=function(d,b){if(d==Number.POSITIVE_INFINITY){return"0" | |
}var c=ZmPref.__DURDIV; | |
if(b){b={}; | |
b[ZmPref.__DURMULT[b]]=b | |
}for(var e in c){var a=Math.floor(d/e); | |
if(a>0){return[a,c[e]].join("") | |
}}return"0"+b | |
}; | |
ZmPref.MAX_LENGTH={}; | |
ZmPref.MAX_LENGTH[ZmSetting.INITIAL_SEARCH]=512; | |
ZmPref.MAX_LENGTH[ZmSetting.SIGNATURE]=1024; | |
ZmPref.MAX_LENGTH[ZmSetting.AWAY_MESSAGE]=8192; | |
ZmPref.setPrefList=function(a,b){ZmPref[a]=b | |
}; | |
ZmPref.SETUP={}; | |
ZmPref.registerPref=function(b,a){ZmPref.SETUP[b]=a | |
}; | |
ZmPref.clearPrefSections=function(){ZmPref._prefSectionMap={}; | |
ZmPref._prefSectionArray=null | |
}; | |
ZmPref.registerPrefSection=function(c,b){if(!c||!b){return | |
}var a=b.templateId||c; | |
if(!a.match(/#/)){a=["prefs.Pages",a].join("#") | |
}b.templateId=a; | |
b.id=c; | |
appCtxt.set(ZmSetting.PREF_SECTIONS,b,c); | |
ZmPref._prefSectionArray=null | |
}; | |
ZmPref.unregisterPrefSection=function(a){appCtxt.set(ZmSetting.PREF_SECTIONS,null,a); | |
ZmPref._prefSectionArray=null | |
}; | |
ZmPref.getPrefSectionMap=function(){return appCtxt.get(ZmSetting.PREF_SECTIONS) | |
}; | |
ZmPref.getPrefSectionArray=function(){if(!ZmPref._prefSectionArray){ZmPref._prefSectionArray=[]; | |
var a=appCtxt.get(ZmSetting.PREF_SECTIONS); | |
for(var b in a){ZmPref._prefSectionArray.push(a[b]) | |
}ZmPref._prefSectionArray.sort(ZmPref.__BY_PRIORITY) | |
}return ZmPref._prefSectionArray | |
}; | |
ZmPref.getPrefSectionWithPref=function(d){var b=appCtxt.get(ZmSetting.PREF_SECTIONS); | |
for(var c in b){var e=b[c]; | |
if(e.prefs==null){continue | |
}for(var a=0; | |
a<e.prefs.length; | |
a++){if(e.prefs[a]==d){return e | |
}}}return null | |
}; | |
ZmPref.clearPrefSections(); | |
ZmPref.__BY_PRIORITY=function(d,c){return Number(d.priority)-Number(c.priority) | |
}; | |
ZmPref.regenerateSignatureEditor=function(d){var a=d.parent; | |
var b=document.getElementById(a._htmlElId+"_SIG_EDITOR"); | |
var c=new ZmHtmlEditor({parent:a,parentElement:b.parentNode,textAreaId:"TEXTAREA_SIGNATURE",autoFocus:true,attachmentCallback:a._insertImagesListener.bind(a)}); | |
b.parentNode.removeChild(b); | |
a._sigEditor=c; | |
a._populateSignatures() | |
}; | |
ZmPref._normalizeFontId=function(h,g){var d=h; | |
h=h.replace(/,\s/g,",").replace(/'/g,"").toLowerCase(); | |
if(!g){var e=ZmPref.FONT_FAMILY; | |
if(e&&!e[h]){var c=AjxUtil.keys(e); | |
if(c.length){var f=h.split(","); | |
for(var b=0; | |
b<f.length; | |
b++){for(var a=0; | |
a<c.length; | |
a++){if(c[a].indexOf(f[b])!=-1){return c[a] | |
}}}return c[0] | |
}}}return h | |
}; | |
ZmPref._normalizeFontName=function(a){return ZmPref.FONT_FAMILY[ZmPref._normalizeFontId(a)].name | |
}; | |
ZmPref._normalizeFontValue=function(a){return ZmPref.FONT_FAMILY[ZmPref._normalizeFontId(a)].value | |
}; | |
ZmPref.handleOOOVacationExternalOptionChange=function(d){var e=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_EXTERNAL_MSG); | |
var b=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView().getView(e.id); | |
var c=b.getFormObject(ZmSetting.VACATION_EXTERNAL_MSG); | |
var f=b.getFormObject(ZmSetting.VACATION_EXTERNAL_SUPPRESS); | |
var a=f.getSelectedOption().getItem()._optionIndex; | |
if(a===0||a===3){c.setVisible(false) | |
}else{c.setVisible(true) | |
}}; | |
ZmPref.setMailNotificationAddressValue=function(a,f,e,c){a.setValue(f); | |
e.push(a); | |
var b=appCtxt.getSettings().getSetting(ZmSetting.NOTIF_ENABLED),d=!!f; | |
if(b.getValue()!==d){b.setValue(d); | |
e.push(b) | |
}}; | |
ZmPref.FONT_FAMILY={}; | |
(function(){var a=["fontFamilyIntl","fontFamilyBase"]; | |
var e,c,d,f,b; | |
for(c=0; | |
c<a.length; | |
c++){for(e=1; | |
f=AjxMsg[a[c]+e+".css"]; | |
e++){if(f.match(/^#+$/)){break | |
}f=ZmPref._normalizeFontId(f,true); | |
b=AjxMsg[a[c]+e+".display"]; | |
ZmPref.FONT_FAMILY[f]={name:b,value:f} | |
}}})() | |
}if(AjxPackage.define("zimbraMail.calendar.model.ZmCalBaseItem")){ZmCalBaseItem=function(b,c,d,a){if(arguments.length==0){return | |
}ZmItem.call(this,b,d,c); | |
this.id=d||-1; | |
this.uid=-1; | |
this.folderId=a||this._getDefaultFolderId(); | |
this.fragment=""; | |
this.name=""; | |
this.allDayEvent="0"; | |
this.startDate=null; | |
this.endDate=null; | |
this.timezone=AjxTimezone.getServerId(AjxTimezone.DEFAULT); | |
this.alarm=false; | |
this.alarmData=null; | |
this.isException=false; | |
this.recurring=false; | |
this.priority=null; | |
this.ptst=null; | |
this.status=ZmCalendarApp.STATUS_CONF; | |
this._reminderMinutes=0; | |
this.otherAttendees=false | |
}; | |
ZmCalBaseItem.prototype=new ZmItem; | |
ZmCalBaseItem.prototype.constructor=ZmCalBaseItem; | |
ZmCalBaseItem.prototype.toString=function(){return"ZmCalBaseItem" | |
}; | |
ZmCalBaseItem.PERSON="PERSON"; | |
ZmCalBaseItem.OPTIONAL_PERSON="OPT_PERSON"; | |
ZmCalBaseItem.GROUP="GROUP"; | |
ZmCalBaseItem.LOCATION="LOCATION"; | |
ZmCalBaseItem.EQUIPMENT="EQUIPMENT"; | |
ZmCalBaseItem.FORWARD="FORWARD"; | |
ZmCalBaseItem.PSTATUS_ACCEPT="AC"; | |
ZmCalBaseItem.PSTATUS_DECLINED="DE"; | |
ZmCalBaseItem.PSTATUS_DEFERRED="DF"; | |
ZmCalBaseItem.PSTATUS_DELEGATED="DG"; | |
ZmCalBaseItem.PSTATUS_NEEDS_ACTION="NE"; | |
ZmCalBaseItem.PSTATUS_COMPLETED="CO"; | |
ZmCalBaseItem.PSTATUS_TENTATIVE="TE"; | |
ZmCalBaseItem.PSTATUS_WAITING="WA"; | |
ZmCalBaseItem.FBA_TO_PTST={B:ZmCalBaseItem.PSTATUS_ACCEPT,F:ZmCalBaseItem.PSTATUS_DECLINED,T:ZmCalBaseItem.PSTATUS_TENTATIVE}; | |
ZmCalBaseItem._pstatusString={NE:ZmMsg._new,TE:ZmMsg.tentative,AC:ZmMsg.accepted,DE:ZmMsg.declined,DG:ZmMsg.delegated}; | |
ZmCalBaseItem.compareByTimeAndDuration=function(d,c){if(d.getStartTime()>c.getStartTime()){return 1 | |
}if(d.getStartTime()<c.getStartTime()){return -1 | |
}if(d.getDuration()<c.getDuration()){return 1 | |
}if(d.getDuration()>c.getDuration()){return -1 | |
}return 0 | |
}; | |
ZmCalBaseItem.createFromDom=function(b,c,a){var d=new ZmCalBaseItem(ZmItem.APPT,c.list); | |
d._loadFromDom(b,(a||{})); | |
return d | |
}; | |
ZmCalBaseItem.prototype.getName=function(){return this.name||"" | |
}; | |
ZmCalBaseItem.prototype.getEndTime=function(){return this.endDate.getTime() | |
}; | |
ZmCalBaseItem.prototype.getStartTime=function(){return this.startDate.getTime() | |
}; | |
ZmCalBaseItem.prototype.getAlarmInstStart=function(){return this._alarmInstStart | |
}; | |
ZmCalBaseItem.prototype.getDuration=function(){return this.getEndTime()-this.getStartTime() | |
}; | |
ZmCalBaseItem.prototype.getLocation=function(){return this.location||"" | |
}; | |
ZmCalBaseItem.prototype.isAllDayEvent=function(){return this.allDayEvent=="1" | |
}; | |
ZmCalBaseItem.prototype.getParticipantStatusStr=function(){return ZmCalBaseItem._pstatusString[this.ptst] | |
}; | |
ZmCalBaseItem.prototype.getUniqueId=function(a){if(a){if(!this._startTimeUniqId){this._startTimeUniqId=this.id+"_"+this.getStartTime() | |
}return this._startTimeUniqId | |
}else{if(this._uniqId==null){this._uniqId=Dwt.getNextId() | |
}return(this.id+"_"+this._uniqId) | |
}}; | |
ZmCalBaseItem.prototype.isMultiDay=function(){var b=this.startDate; | |
var a=this.endDate; | |
if(!b&&!a){return false | |
}if(!b){return false | |
}if(a.getHours()==0&&a.getMinutes()==0&&a.getSeconds()==0){a=new Date(a.getTime()-2*AjxDateUtil.MSEC_PER_HOUR) | |
}return(b.getDate()!=a.getDate())||(b.getMonth()!=a.getMonth())||(b.getFullYear()!=a.getFullYear()) | |
}; | |
ZmCalBaseItem.prototype.getDurationText=function(c,a,f){var d=this.isAllDayEvent(); | |
var g=this.isMultiDay(); | |
var e; | |
if(d){if(c){return"" | |
}var h=this.startDate; | |
var b=new Date(this.endDate.getTime()-(g?2*AjxDateUtil.MSEC_PER_HOUR:0)); | |
if(f){if(g){e=ZmMsg.apptTimeAllDayMultiCondensed | |
}else{return ZmMsg.allDay | |
}}else{e=g?ZmMsg.apptTimeAllDayMulti:ZmMsg.apptTimeAllDay | |
}return AjxMessageFormat.format(e,[h,b]) | |
}if(a){return ZmCalBaseItem._getTTHour(this.startDate) | |
}if(f){e=g?ZmMsg.apptTimeInstanceMultiCondensed:ZmMsg.apptTimeInstanceCondensed | |
}else{e=g?ZmMsg.apptTimeInstanceMulti:ZmMsg.apptTimeInstance | |
}return AjxMessageFormat.format(e,[this.getDateInLocalTimezone(this.startDate),this.getDateInLocalTimezone(this.endDate),""]) | |
}; | |
ZmCalBaseItem.prototype.isAlarmInRange=function(){if(!this.alarmData){return false | |
}var b=this.alarmData[0]; | |
if(!b){return false | |
}this._nextAlarmTime=this.adjustMS(b.nextAlarm,this.tzo); | |
this._alarmInstStart=this.adjustMS(b.alarmInstStart,this.tzo); | |
var a=(new Date()).getTime(); | |
return(a>=this._nextAlarmTime) | |
}; | |
ZmCalBaseItem.prototype.adjustMS=function(a,c){var b=this.isAllDayEvent()?(c+new Date(a).getTimezoneOffset()*60*1000):0; | |
return parseInt(a,10)+b | |
}; | |
ZmCalBaseItem.prototype.isAlarmInstance=function(){var a=this.alarmData?this.alarmData[0]:null; | |
if(!a||!a.alarmInstStart||!this.startDate){return false | |
}this._alarmInstStart=this.adjustMS(a.alarmInstStart,this.tzo); | |
return(this._alarmInstStart==this.startDate.getTime()) | |
}; | |
ZmCalBaseItem.prototype.hasAlarmData=function(){return(this.alarmData!=null) | |
}; | |
ZmCalBaseItem.prototype._loadFromDom=function(c,a){this.uid=c.uid; | |
this.folderId=c.l||this._getDefaultFolderId(); | |
this.invId=c.invId; | |
this.isException=a.ex; | |
this.id=c.id; | |
this.name=this._getAttr(c,a,"name"); | |
this.fragment=this._getAttr(c,a,"fr"); | |
this.status=this._getAttr(c,a,"status"); | |
this.ptst=this._getAttr(c,a,"ptst"); | |
this.allDayEvent=(a.allDay||c.allDay)?"1":"0"; | |
this.organizer=c.or&&c.or.a; | |
this.isOrg=this._getAttr(c,a,"isOrg"); | |
this.transparency=this._getAttr(c,a,"transp"); | |
if(a.allDay==false){this.allDayEvent="0" | |
}this.alarm=this._getAttr(c,a,"alarm"); | |
this.alarmData=this._getAttr(c,a,"alarmData"); | |
if(!this.alarmData&&this.isException){this.alarmData=c.alarmData | |
}this.priority=parseInt(this._getAttr(c,a,"priority")); | |
this.recurring=a.recur!=null?a.recur:c.recur; | |
this.ridZ=this.recurring&&a&&a.ridZ; | |
this.fba=this._getAttr(c,a,"fba"); | |
var g=a.s!=null?a.s:c.inst&&c.inst.length>0&&c.inst[0].s; | |
if(g){var h=this.tzo=a.tzo!=null?a.tzo:c.tzo; | |
var f=this.isAllDayEvent()?(h+new Date(g).getTimezoneOffset()*60*1000):0; | |
var e=parseInt(g,10)+f; | |
this.startDate=new Date(e); | |
this.uniqStartTime=this.startDate.getTime() | |
}var d=this._getAttr(c,a,"dur"); | |
if(d){var b=e+(parseInt(d)); | |
this.endDate=new Date(b) | |
}this.otherAttendees=this._getAttr(c,a,"otherAtt"); | |
this.location=this._getAttr(c,a,"loc") | |
}; | |
ZmCalBaseItem.prototype._getDefaultFolderId=function(){return appCtxt.get(ZmSetting.CAL_DEFAULT_ID) | |
}; | |
ZmCalBaseItem.prototype._getAttr=function(a,c,b){return c[b]!=null?c[b]:c.ex?null:a[b] | |
}; | |
ZmCalBaseItem.prototype._addLocationToRequest=function(a){a.loc=this.getLocation() | |
}; | |
ZmCalBaseItem._getTTHour=function(b){var a=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT); | |
return a.format(b) | |
}; | |
ZmCalBaseItem.prototype.getReminderLocation=function(){return(this.alarmData[0].loc||"") | |
}; | |
ZmCalBaseItem.prototype.getReminderName=function(){return(this.alarmData[0].name||"") | |
}; | |
ZmCalBaseItem.prototype.getAlarmData=function(){return this.alarmData | |
}; | |
ZmCalBaseItem.prototype.isAlarmOld=function(){if(!this.alarmData){return false | |
}var c=this.alarmData[0]; | |
this._nextAlarmTime=c.nextAlarm; | |
this._alarmInstStart=c.alarmInstStart; | |
var a=(new Date()).getTime(); | |
var b=(a-this._nextAlarmTime); | |
if(b>2*60*1000){return true | |
}return false | |
}; | |
ZmCalBaseItem.prototype.getRestUrl=function(){if(this.restUrl){return this.restUrl | |
}var a=appCtxt.getById(this.folderId); | |
var b=a?([a.getRestUrl(),"/?id=",AjxStringUtil.urlComponentEncode(this.id||this.invId)].join("")):null; | |
return b | |
}; | |
ZmCalBaseItem.prototype.getDateInLocalTimezone=function(b){var e=this.getTimezone(); | |
var a=AjxTimezone.getServerId(AjxTimezone.DEFAULT); | |
if(e!=a){var d=AjxTimezone.getOffset(AjxTimezone.DEFAULT,b); | |
var c=AjxTimezone.getOffset(AjxTimezone.getClientId(e),b); | |
return new Date(b.getTime()+(d-c)*60*1000) | |
}return b | |
} | |
}if(AjxPackage.define("zimbraMail.calendar.model.ZmCalItem")){ZmCalItem=function(b,c,d,a){if(arguments.length==0){return | |
}ZmCalBaseItem.call(this,b,c,d,a); | |
this.notesTopPart=null; | |
this.attachments=null; | |
this.viewMode=ZmCalItem.MODE_NEW; | |
this._recurrence=new ZmRecurrence(this); | |
this._noBusyOverlay=null; | |
this._sendNotificationMail=true; | |
this.identity=null; | |
this.isProposeTimeMode=false; | |
this.isForwardMode=false; | |
this.alarmActions=new AjxVector(); | |
this.alarmActions.add(ZmCalItem.ALARM_DISPLAY); | |
this._useAbsoluteReminder=false; | |
this._ignoreVersion=false | |
}; | |
ZmCalItem.prototype=new ZmCalBaseItem; | |
ZmCalItem.prototype.constructor=ZmCalItem; | |
ZmCalItem.prototype.toString=function(){return"ZmCalItem" | |
}; | |
ZmCalItem.MODE_NEW="NEW"; | |
ZmCalItem.MODE_EDIT="EDIT"; | |
ZmCalItem.MODE_COPY_SINGLE_INSTANCE="COPY_INST"; | |
ZmCalItem.MODE_EDIT_SINGLE_INSTANCE="EDIT_INST"; | |
ZmCalItem.MODE_EDIT_SERIES="EDIT_SER"; | |
ZmCalItem.MODE_DELETE="DELETE"; | |
ZmCalItem.MODE_DELETE_INSTANCE="DELETE_INST"; | |
ZmCalItem.MODE_DELETE_SERIES="DELETE_SER"; | |
ZmCalItem.MODE_NEW_FROM_QUICKADD="NEW_FROM_QUICK"; | |
ZmCalItem.MODE_GET="GET"; | |
ZmCalItem.MODE_FORWARD="FORWARD"; | |
ZmCalItem.MODE_FORWARD_SINGLE_INSTANCE="FORWARD_INST"; | |
ZmCalItem.MODE_FORWARD_SERIES="FORWARD_SER"; | |
ZmCalItem.MODE_FORWARD_INVITE="FORWARD_INV"; | |
ZmCalItem.MODE_PROPOSE_TIME="PROPOSE_TIME"; | |
ZmCalItem.MODE_PURGE=15; | |
ZmCalItem.MODE_LAST=15; | |
ZmCalItem.FORWARD_MAPPING={}; | |
ZmCalItem.FORWARD_MAPPING[ZmCalItem.MODE_FORWARD]=ZmCalItem.MODE_EDIT; | |
ZmCalItem.FORWARD_MAPPING[ZmCalItem.MODE_FORWARD_SINGLE_INSTANCE]=ZmCalItem.MODE_EDIT_SINGLE_INSTANCE; | |
ZmCalItem.FORWARD_MAPPING[ZmCalItem.MODE_FORWARD_SERIES]=ZmCalItem.MODE_EDIT_SERIES; | |
ZmCalItem.FORWARD_MAPPING[ZmCalItem.MODE_FORWARD_INVITE]=ZmCalItem.MODE_EDIT; | |
ZmCalItem.PRIORITY_LOW=9; | |
ZmCalItem.PRIORITY_LOW_RANGE=[6,7,8,9]; | |
ZmCalItem.PRIORITY_NORMAL=5; | |
ZmCalItem.PRIORITY_NORMAL_RANGE=[0,5]; | |
ZmCalItem.PRIORITY_HIGH=1; | |
ZmCalItem.PRIORITY_HIGH_RANGE=[1,2,3,4]; | |
ZmCalItem.ROLE_CHAIR="CHA"; | |
ZmCalItem.ROLE_REQUIRED="REQ"; | |
ZmCalItem.ROLE_OPTIONAL="OPT"; | |
ZmCalItem.ROLE_NON_PARTICIPANT="NON"; | |
ZmCalItem.SERVER_WEEK_DAYS=["SU","MO","TU","WE","TH","FR","SA"]; | |
ZmCalItem.ATTACHMENT_CHECKBOX_NAME="__calAttCbox__"; | |
ZmCalItem.ATT_LINK_IMAGE="mainImage"; | |
ZmCalItem.ATT_LINK_MAIN="main"; | |
ZmCalItem.ATT_LINK_DOWNLOAD="download"; | |
ZmCalItem.REMINDER_UNIT_MINUTES="minutes"; | |
ZmCalItem.REMINDER_UNIT_HOURS="hours"; | |
ZmCalItem.REMINDER_UNIT_DAYS="days"; | |
ZmCalItem.REMINDER_UNIT_WEEKS="weeks"; | |
ZmCalItem.REMINDER_NONE="none"; | |
ZmCalItem.ALARM_DISPLAY="DISPLAY"; | |
ZmCalItem.ALARM_EMAIL="EMAIL"; | |
ZmCalItem.ALARM_DEVICE_EMAIL="DEVICE_EMAIL"; | |
ZmCalItem.MSEC_LIMIT_PER_WEEK=AjxDateUtil.MSEC_PER_DAY*7; | |
ZmCalItem.MSEC_LIMIT_PER_MONTH=AjxDateUtil.MSEC_PER_DAY*7*5; | |
ZmCalItem.MSEC_LIMIT_PER_YEAR=AjxDateUtil.MSEC_PER_DAY*366; | |
ZmCalItem.prototype.getCompNum=function(){return this.compNum||"0" | |
}; | |
ZmCalItem.prototype.getFolder=function(){}; | |
ZmCalItem.prototype.getOrganizer=function(){return this.organizer||"" | |
}; | |
ZmCalItem.prototype.getOrganizerName=function(){return this.organizerName | |
}; | |
ZmCalItem.prototype.getSentBy=function(){return this.sentBy||"" | |
}; | |
ZmCalItem.prototype.getOrigStartDate=function(){return this._origStartDate||this.startDate | |
}; | |
ZmCalItem.prototype.getOrigStartTime=function(){return this.getOrigStartDate().getTime() | |
}; | |
ZmCalItem.prototype.getOrigEndDate=function(){return this._origEndDate||this.endDate | |
}; | |
ZmCalItem.prototype.getOrigEndTime=function(){return this.getOrigEndDate().getTime() | |
}; | |
ZmCalItem.prototype.getOrig=function(){return this._orig | |
}; | |
ZmCalItem.prototype.getOrigTimezone=function(){return this._origTimezone||this.timezone | |
}; | |
ZmCalItem.prototype.getRecurBlurb=function(){return this._recurrence.getBlurb() | |
}; | |
ZmCalItem.prototype.getRecurrence=function(){return this._recurrence | |
}; | |
ZmCalItem.prototype.getRecurType=function(){return this._recurrence.repeatType | |
}; | |
ZmCalItem.prototype.getTimezone=function(){return this.timezone | |
}; | |
ZmCalItem.prototype.getSummary=function(a){}; | |
ZmCalItem.prototype.getToolTip=function(a){}; | |
ZmCalItem.prototype.isCustomRecurrence=function(){return this._recurrence.repeatCustom=="1"||this._recurrence.repeatEndType!="N" | |
}; | |
ZmCalItem.prototype.isOrganizer=function(){return(typeof(this.isOrg)==="undefined")||(this.isOrg==true) | |
}; | |
ZmCalItem.prototype.isRecurring=function(){return(this.recurring||(this._rawRecurrences!=null)) | |
}; | |
ZmCalItem.prototype.hasAttachments=function(){return this.getAttachments()!=null | |
}; | |
ZmCalItem.prototype.hasAttendeeForType=function(a){return false | |
}; | |
ZmCalItem.prototype.hasAttendees=function(){return false | |
}; | |
ZmCalItem.prototype.hasPersonAttendees=function(){return false | |
}; | |
ZmCalItem.prototype.setAllDayEvent=function(a){this.allDayEvent=a?"1":"0" | |
}; | |
ZmCalItem.prototype.setName=function(a){this.name=a | |
}; | |
ZmCalItem.prototype.setOrganizer=function(a){this.organizer=a!=""?a:null | |
}; | |
ZmCalItem.prototype.setRecurType=function(a){this._recurrence.repeatType=a | |
}; | |
ZmCalItem.prototype.setType=function(a){this.type=a | |
}; | |
ZmCalItem.prototype.setOrigTimezone=function(a){this._origTimezone=a | |
}; | |
ZmCalItem.prototype.setFolderId=function(a){this.folderId=a||ZmOrganizer.ID_CALENDAR | |
}; | |
ZmCalItem.prototype.getLocalFolderId=function(){var b=this.folderId; | |
if(this.isShared()){var a=appCtxt.getById(this.folderId); | |
if(a){b=a.id | |
}}return b | |
}; | |
ZmCalItem.prototype.setEndDate=function(b,a){if(this._origEndDate==null&&this.endDate!=null&&this.endDate!=""){this._origEndDate=new Date(this.endDate.getTime()) | |
}this.endDate=new Date(b instanceof Date?b.getTime():b); | |
if(!a){this._resetCached() | |
}}; | |
ZmCalItem.prototype.setStartDate=function(a,b){if(this._origStartDate==null&&this.startDate!=null&&this.startDate!=""){this._origStartDate=new Date(this.startDate.getTime()) | |
}this.startDate=new Date(a instanceof Date?a.getTime():a); | |
if(!b){this._resetCached() | |
}if(this.recurring&&this._recurrence){this._recurrence.setRecurrenceStartTime(this.startDate.getTime()) | |
}}; | |
ZmCalItem.prototype.setTimezone=function(a,b){if(this._origTimezone==null){this._origTimezone=a | |
}this.timezone=a; | |
if(!b){this._resetCached() | |
}}; | |
ZmCalItem.prototype.setEndTimezone=function(a){if(this._origEndTimezone==null){this._origEndTimezone=a | |
}this.endTimezone=a | |
}; | |
ZmCalItem.prototype.setViewMode=function(a){this.viewMode=a||ZmCalItem.MODE_NEW; | |
if(this.viewMode==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE){this._recurrence.repeatType="NON" | |
}}; | |
ZmCalItem.prototype.getViewMode=function(a){return this.viewMode | |
}; | |
ZmCalItem.prototype.getNotesPart=function(e){if(this.notesTopPart){var a=e||ZmMimeTable.TEXT_PLAIN; | |
var b=this.notesTopPart.getContentForType(a); | |
if(!b){if(a==ZmMimeTable.TEXT_PLAIN){var d=document.createElement("div"); | |
b=this.notesTopPart.getContentForType(ZmMimeTable.TEXT_HTML); | |
d.innerHTML=b||""; | |
var c=AjxStringUtil.convertHtml2Text(d); | |
return c.substring(1) | |
}else{if(a==ZmMimeTable.TEXT_HTML){b=AjxStringUtil.convertToHtml(this.notesTopPart.getContentForType(ZmMimeTable.TEXT_PLAIN)) | |
}}}return b | |
}else{return this.fragment | |
}}; | |
ZmCalItem.prototype.getRemoteFolderOwner=function(){var b=AjxDispatcher.run("GetCalController"); | |
if(b.isMovingBetwAccounts(this,this.folderId)){return null | |
}var c=this.getFolder(); | |
var a=c&&c.link&&c.owner; | |
var d=(!a&&appCtxt.multiAccounts&&c.getAccount()); | |
if(d){a=d.name | |
}return a | |
}; | |
ZmCalItem.prototype.isReadOnly=function(){var c=this.getFolder(); | |
if(appCtxt.multiAccounts){var a=appCtxt.accountList.getAccountByEmail(this.organizer); | |
var b=appCtxt.accountList.getAccountByEmail(c.getAccount().getEmail()); | |
if(a==b){return false | |
}}return(!this.isOrganizer()||(c.link&&c.isReadOnly())) | |
}; | |
ZmCalItem.prototype.isFolderReadOnly=function(){var a=this.getFolder(); | |
return(a&&a.isReadOnly()) | |
}; | |
ZmCalItem.prototype.isVersionIgnored=function(){return this._ignoreVersion | |
}; | |
ZmCalItem.prototype.setIgnoreVersion=function(a){this._ignoreVersion=a | |
}; | |
ZmCalItem.prototype.resetRepeatWeeklyDays=function(){if(this.startDate){this._recurrence.repeatWeeklyDays=[ZmCalItem.SERVER_WEEK_DAYS[this.startDate.getDay()]] | |
}}; | |
ZmCalItem.prototype.resetRepeatMonthlyDayList=function(){if(this.startDate){this._recurrence.repeatMonthlyDayList=[this.startDate.getDate()] | |
}}; | |
ZmCalItem.prototype.resetRepeatYearlyMonthsList=function(a){this._recurrence.repeatYearlyMonthsList=a | |
}; | |
ZmCalItem.prototype.resetRepeatCustomDayOfWeek=function(){if(this.startDate){this._recurrence.repeatCustomDayOfWeek=ZmCalItem.SERVER_WEEK_DAYS[this.startDate.getDay()] | |
}}; | |
ZmCalItem.prototype.isOverlapping=function(a,f){if(f&&this.folderId!=a.folderId){return false | |
}var b=this.getStartTime(); | |
var d=this.getEndTime(); | |
var e=a.getStartTime(); | |
var c=a.getEndTime(); | |
return(b<c)&&(d>e) | |
}; | |
ZmCalItem.prototype.isInRange=function(c,b){var a=this.getStartTime(); | |
var d=this.getEndTime(); | |
return(a<b&&d>c) | |
}; | |
ZmCalItem.prototype.isValidDuration=function(){var d=this.getStartTime(); | |
var b=this.getEndTime(); | |
if(this.endTimezone&&this.endTimezone!=this.timezone){var a=AjxTimezone.getRule(this.timezone).standard.offset; | |
var c=AjxTimezone.getRule(this.endTimezone).standard.offset; | |
d=d-(a*60000); | |
b=b-(c*60000) | |
}return(d<=b) | |
}; | |
ZmCalItem.prototype.isValidDurationRecurrence=function(){var a=true; | |
var c=this.getRecurType(); | |
var b=this.getDuration(); | |
switch(c){case ZmRecurrence.DAILY:a=b<=AjxDateUtil.MSEC_PER_DAY; | |
break; | |
case ZmRecurrence.WEEKLY:a=b<=ZmCalItem.MSEC_LIMIT_PER_WEEK; | |
break; | |
case ZmRecurrence.MONTHLY:a=b<=ZmCalItem.MSEC_LIMIT_PER_MONTH; | |
break; | |
case ZmRecurrence.YEARLY:a=b<=ZmCalItem.MSEC_LIMIT_PER_YEAR; | |
break; | |
default:break | |
}return a | |
}; | |
ZmCalItem.prototype.parseAlarmData=function(){if(!this.alarmData){return | |
}for(var b=0; | |
b<this.alarmData.length; | |
b++){var c=this.alarmData[b].alarm; | |
if(c){for(var a=0; | |
a<c.length; | |
a++){this.parseAlarm(c[a]) | |
}}}}; | |
ZmCalItem.prototype.parseAlarm=function(f){if(!f){return | |
}var i,b,g,j,c; | |
var e=f.trigger; | |
var a=(e&&(e.length>0))?e[0].rel:null; | |
i=(a&&(a.length>0))?a[0].s:null; | |
b=(a&&(a.length>0))?a[0].m:null; | |
j=(a&&(a.length>0))?a[0].d:null; | |
g=(a&&(a.length>0))?a[0].h:null; | |
c=(a&&(a.length>0))?a[0].w:null; | |
this._reminderMinutes=-1; | |
if(f.action==ZmCalItem.ALARM_DISPLAY){if(i==0){this._reminderMinutes=0 | |
}if(b!=null){this._reminderMinutes=b; | |
this._origReminderUnits=ZmCalItem.REMINDER_UNIT_MINUTES | |
}if(g!=null){g=parseInt(g); | |
this._reminderMinutes=g*60; | |
this._origReminderUnits=ZmCalItem.REMINDER_UNIT_HOURS | |
}if(j!=null){j=parseInt(j); | |
this._reminderMinutes=j*24*60; | |
this._origReminderUnits=ZmCalItem.REMINDER_UNIT_DAYS | |
}if(c!=null){c=parseInt(c); | |
this._reminderMinutes=c*7*24*60; | |
this._origReminderUnits=ZmCalItem.REMINDER_UNIT_WEEKS | |
}}}; | |
ZmCalItem.prototype.isStartInRange=function(c,b){var a=this.getStartTime(); | |
return(a<b&&a>=c) | |
}; | |
ZmCalItem.prototype.isEndInRange=function(b,a){var c=this.getEndTime(); | |
return(c<=a&&c>b) | |
}; | |
ZmCalItem.prototype.setDateRange=function(c,a,f,b){var d=c.startDate; | |
var g=c.endDate; | |
this.endDate.setTime(c.endDate.getTime()); | |
this.startDate.setTime(c.startDate.getTime()) | |
}; | |
ZmCalItem.prototype.getDateRange=function(a,c,b){return{startDate:this.startDate,endDate:this.endDate} | |
}; | |
ZmCalItem.prototype.setAttachments=function(c){this.attachments=[]; | |
if(c&&c.length>0){var b=c.split(","); | |
for(var a=0; | |
a<b.length; | |
a++){this.attachments[a]={id:b[a]} | |
}}}; | |
ZmCalItem.prototype.getAttachments=function(){var b=this.message?this.message.attachments:null; | |
if(b){if(this._validAttachments==null){this._validAttachments=[]; | |
for(var a=0; | |
a<b.length; | |
++a){if(this.message.isRealAttachment(b[a])||b[a].contentType==ZmMimeTable.TEXT_CAL){this._validAttachments.push(b[a]) | |
}}}return this._validAttachments.length>0?this._validAttachments:null | |
}return null | |
}; | |
ZmCalItem.prototype.removeAttachment=function(a){if(this._validAttachments&&this._validAttachments.length>0){for(var b=0; | |
b<this._validAttachments.length; | |
b++){if(this._validAttachments[b].part==a){this._validAttachments.splice(b,1); | |
break | |
}}}}; | |
ZmCalItem.prototype.getShortStartHour=function(){var a=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT); | |
return a.format(this.startDate) | |
}; | |
ZmCalItem.prototype.getUniqueStartDate=function(){if(this._uniqueStartDate==null&&this.uniqStartTime){this._uniqueStartDate=new Date(this.uniqStartTime) | |
}return this._uniqueStartDate | |
}; | |
ZmCalItem.prototype.getUniqueEndDate=function(){if(this._uniqueEndDate==null&&this.uniqStartTime){this._uniqueEndDate=new Date(this.uniqStartTime+this.getDuration()) | |
}return this._uniqueEndDate | |
}; | |
ZmCalItem.prototype.getDetails=function(d,l,h,f,k,e){var i=d||this.viewMode; | |
var c=i==ZmCalItem.MODE_EDIT_SERIES; | |
var a=(c&&this.message&&!this.message.seriesMode); | |
if(this.message==null||a){var b=c?(this.seriesInvId||this.invId||this.id):this.invId; | |
this.message=new ZmMailMsg(b); | |
if(this._orig){this._orig.message=this.message | |
}var n=new AjxCallback(this,this._handleResponseGetDetails,[i,this.message,l]); | |
var m=(!f)?(new AjxCallback(this,this._handleErrorGetDetails,[i,l,h])):h; | |
var j=appCtxt.isOffline&&this.getFolder().getAccount(); | |
var g={callback:n,errorCallback:m,noBusyOverlay:k,ridZ:(c?null:this.ridZ),batchCmd:e,accountName:(j&&j.name)}; | |
this.message.load(g) | |
}else{this.setFromMessage(this.message,i); | |
if(l){l.run() | |
}}}; | |
ZmCalItem.prototype.convertToLocalTimezone=function(){var f=this.getTimezone(); | |
var b=AjxTimezone.getServerId(AjxTimezone.DEFAULT); | |
var e=this.startDate; | |
var a=this.endDate; | |
if(f!=b){var d=AjxTimezone.getOffset(AjxTimezone.DEFAULT,e); | |
var c=AjxTimezone.getOffset(AjxTimezone.getClientId(f),e); | |
e.setTime(e.getTime()+(d-c)*60*1000); | |
a.setTime(a.getTime()+(d-c)*60*1000); | |
this.setTimezone(b); | |
this.setEndTimezone(b) | |
}}; | |
ZmCalItem.prototype._handleResponseGetDetails=function(e,d,h,a){this.setFromMessage(d,e); | |
d.seriesMode=(e==ZmCalItem.MODE_EDIT_SERIES); | |
if(this._orig&&this._orig.proposedInvite){var c=this._orig.proposedInvite; | |
var g=c.getServerStartTime(); | |
var b=c.getServerEndTime(); | |
if(g){this.setStartDate(AjxDateUtil.parseServerDateTime(g,true)) | |
}if(b){this.setEndDate(AjxDateUtil.parseServerDateTime(b,true)) | |
}var f=c.getServerStartTimeTz(); | |
this.setTimezone(f||AjxTimezone.getServerId(AjxTimezone.DEFAULT)); | |
this.startsInUTC=g?g.charAt(g.length-1)=="Z":null; | |
this.endsInUTC=b&&g?b.charAt(g.length-1)=="Z":null; | |
this.status=c.components[0].status; | |
this.convertToLocalTimezone(); | |
this.isAcceptingProposal=true | |
}if(h){h.run(a) | |
}}; | |
ZmCalItem.prototype._handleErrorGetDetails=function(g,i,f,h){if(h.code=="mail.INVITE_OUT_OF_DATE"){var j={},k=this._getRequestNameForMode(ZmCalItem.MODE_GET),e=j[k]={_jsns:"urn:zimbraMail"},l=new AjxCallback(this,this._handleErrorGetDetails2,[g,i,f]),d; | |
e.id=this.id; | |
d={jsonObj:j,asyncMode:true,callback:l,errorCallback:f}; | |
appCtxt.getAppController().sendRequest(d); | |
return true | |
}if(h.code=="account.ACCOUNT_INACTIVE"){var b=h.msg?h.msg.split(":"):null,a=b?b[1]:"",c=appCtxt.getMsgDialog(); | |
c.setMessage(AjxMessageFormat.format(ZmMsg.accountInactiveError,a),DwtMessageDialog.CRITICAL_STYLE); | |
c.popup(); | |
return true | |
}if(f){return f.run(h) | |
}return false | |
}; | |
ZmCalItem.prototype._handleErrorGetDetails2=function(e,f,c,a){var b=this._getInviteFromError(a); | |
this.invId=[this.id,b.id].join("-"); | |
this.message=null; | |
var d=true; | |
this.getDetails(e,f,c,d) | |
}; | |
ZmCalItem.prototype.setFromMessage=function(b,a){if(b==this._currentlyLoaded){return | |
}if(b.invite){this.isOrg=b.invite.isOrganizer(); | |
this.organizer=b.invite.getOrganizerEmail(); | |
this.organizerName=b.invite.getOrganizerName(); | |
this.sentBy=b.invite.getSentBy(); | |
this.name=b.invite.getName()||b.subject; | |
this.isException=b.invite.isException(); | |
this.recurring=b.invite.isRecurring(); | |
this.location=b.invite.getLocation(); | |
this.seq=b.invite.getSequenceNo(); | |
this.allDayEvent=b.invite.isAllDayEvent(); | |
if(b.invite.id){this.invId=this.id+"-"+b.invite.id | |
}this._setTimeFromMessage(b,a); | |
this._setExtrasFromMessage(b); | |
this._setRecurrence(b) | |
}this._setNotes(b); | |
this.getAttachments(); | |
this._currentlyLoaded=b | |
}; | |
ZmCalItem.prototype.setFromSavedResponse=function(a){this.invId=a.invId; | |
if(this.message){this.message.rev=a.rev; | |
this.message.ms=a.ms | |
}if(this.viewMode==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE&&!this.isException){this.isException=true | |
}}; | |
ZmCalItem.prototype.setFromMailMessage=function(b,a){this.name=a; | |
this._setNotes(b); | |
this.message=b; | |
this.invId=b.id | |
}; | |
ZmCalItem.prototype.setTextNotes=function(a){this.notesTopPart=new ZmMimePart(); | |
this.notesTopPart.setContentType(ZmMimeTable.TEXT_PLAIN); | |
this.notesTopPart.setContent(a) | |
}; | |
ZmCalItem.prototype._setTimeFromMessage=function(j,d){var b=j.invite.getServerStartTime(); | |
var e=j.invite.getServerEndTime(); | |
if(d===ZmCalItem.MODE_EDIT_SINGLE_INSTANCE||d===ZmCalItem.MODE_FORWARD_SINGLE_INSTANCE||d===ZmCalItem.MODE_COPY_SINGLE_INSTANCE){var a=this.getUniqueStartDate(); | |
if(a){this.setStartDate(a) | |
}var i=this.getUniqueEndDate(); | |
if(i){if(this.isAllDayEvent()&&d===ZmCalItem.MODE_COPY_SINGLE_INSTANCE){i.setDate(i.getDate()-1) | |
}this.setEndDate(i) | |
}if(d===ZmCalItem.MODE_COPY_SINGLE_INSTANCE){d=ZmCalItem.MODE_EDIT_SINGLE_INSTANCE | |
}}else{if(b){this.setStartDate(AjxDateUtil.parseServerDateTime(b)) | |
}if(e){this.setEndDate(AjxDateUtil.parseServerDateTime(e)) | |
}}this.startsInUTC=b?b.charAt(b.length-1)=="Z":null; | |
this.endsInUTC=e&&b?e.charAt(b.length-1)=="Z":null; | |
var g; | |
if(d==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE||d==ZmCalItem.MODE_DELETE_INSTANCE||d==ZmCalItem.MODE_FORWARD_SINGLE_INSTANCE){g=AjxTimezone.getServerId(AjxTimezone.DEFAULT); | |
this.setTimezone(g); | |
this.setEndTimezone(g) | |
}else{var f=!this.startsInUTC&&j.invite.getServerStartTimeTz(); | |
g=f||AjxTimezone.getServerId(AjxTimezone.DEFAULT); | |
this.setTimezone(g); | |
var c=!this.endsInUTC&&j.invite.getServerEndTimeTz(); | |
this.setEndTimezone(c||AjxTimezone.getServerId(AjxTimezone.DEFAULT)); | |
if(!this.startsInUTC&&j.invite.getServerEndTimeTz()){this.setEndTimezone(j.invite.getServerEndTimeTz()) | |
}}var h=AjxTimezone.getRule(AjxTimezone.getClientId(this.getTimezone())); | |
if(h){if(h.aliasId){h=AjxTimezone.getRule(h.aliasId)||h | |
}this.setTimezone(h.serverId) | |
}h=AjxTimezone.getRule(AjxTimezone.getClientId(this.endTimezone)); | |
if(h){if(h.aliasId){h=AjxTimezone.getRule(h.aliasId)||h | |
}this.setEndTimezone(h.serverId) | |
}}; | |
ZmCalItem.prototype._setExtrasFromMessage=function(a){this._setAlarmFromMessage(a) | |
}; | |
ZmCalItem.prototype._setAlarmFromMessage=function(d){this._reminderMinutes=-1; | |
var h=d.invite.getAlarm(); | |
if(h){for(var c=0; | |
c<h.length; | |
c++){var f=h[c]; | |
if(!f){continue | |
}var e=f.action; | |
if(e==ZmCalItem.ALARM_DISPLAY){this.parseAlarm(f); | |
continue | |
}if(e==ZmCalItem.ALARM_EMAIL){var g=f.at; | |
if(!g){continue | |
}for(var b=0; | |
b<g.length; | |
b++){var a=g[b].a; | |
if(a==appCtxt.get(ZmSetting.CAL_DEVICE_EMAIL_REMINDERS_ADDRESS)){e=ZmCalItem.ALARM_DEVICE_EMAIL | |
}this.addReminderAction(e) | |
}}}}}; | |
ZmCalItem.prototype._setRecurrence=function(b){var a=b.invite.getRecurrenceRules(); | |
if(a){this._recurrence.parse(a) | |
}if(this._recurrence.repeatWeeklyDays==null){this.resetRepeatWeeklyDays() | |
}if(this._recurrence.repeatMonthlyDayList==null){this.resetRepeatMonthlyDayList() | |
}}; | |
ZmCalItem.prototype._getCleanHtml2Text=function(g){var d; | |
var b=g?g.getDocument():null; | |
var a=b?b.body:null; | |
if(a){var c=a.innerHTML.replace(/\n/ig,""); | |
a.innerHTML=c.replace(/<!--.*-->/ig,""); | |
var f=a.firstChild; | |
var e=(f&&f.tagName&&f.tagName.toLocaleLowerCase()=="p"); | |
d=AjxStringUtil.convertHtml2Text(a); | |
if(e){d=d.replace(/\n\n/i,"") | |
}}return d | |
}; | |
ZmCalItem.prototype._setNotes=function(i){if(!(i.isZmMailMsg)){return | |
}this.notesTopPart=new ZmMimePart(); | |
var e=i.getBodyContent(ZmMimeTable.TEXT_HTML); | |
if(e){e=e.replace(/<title\s*>.*\/title>/ig,""); | |
if(!this._includeEditReply){e=this._trimNotesSummary(e,true) | |
}}if(e){var b={parent:appCtxt.getShell(),hidden:true,html:e}; | |
var f=i.getInviteDescriptionContentValue(ZmMimeTable.TEXT_PLAIN); | |
if(!f){var c=new DwtIframe(b); | |
f=this._getCleanHtml2Text(c); | |
var d=c.getIframe(); | |
if(d&&d.parentNode){d.parentNode.removeChild(d) | |
}delete c | |
}var a=new ZmMimePart(); | |
a.setContentType(ZmMimeTable.TEXT_PLAIN); | |
a.setContent(f); | |
var h=new ZmMimePart(); | |
h.setContentType(ZmMimeTable.TEXT_HTML); | |
h.setContent(e); | |
this.notesTopPart.setContentType(ZmMimeTable.MULTI_ALT); | |
this.notesTopPart.children.add(a); | |
this.notesTopPart.children.add(h) | |
}else{var f=i.getBodyContent(ZmMimeTable.TEXT_PLAIN); | |
if(!this._includeEditReply){f=this._trimNotesSummary(f) | |
}var g=this.isTextPartPresent(i)?ZmMimeTable.TEXT_PLAIN:i._lastContentType; | |
this.notesTopPart.setContentType(g); | |
this.notesTopPart.setContent(f) | |
}}; | |
ZmCalItem.prototype.getMailNotificationOption=function(){return this._sendNotificationMail | |
}; | |
ZmCalItem.prototype.setMailNotificationOption=function(a){this._sendNotificationMail=a | |
}; | |
ZmCalItem.prototype.addExceptionDetails=function(a){var e=a.exceptId={},c=this._orig?this._orig.allDayEvent:this.allDayEvent,b,d; | |
if(c!="1"){d=AjxDateUtil.getServerDateTime(this.getOrigStartDate(),this.startsInUTC); | |
b=this.getOrigTimezone(); | |
if(!this.startsInUTC&&b){e.tz=b | |
}e.d=d | |
}else{d=AjxDateUtil.getServerDate(this.getOrigStartDate()); | |
e.d=d | |
}}; | |
ZmCalItem.prototype.save=function(c,h,e,a){var k=false,i={},j=this._getRequestNameForMode(this.viewMode,this.isException),d=i[j]={_jsns:"urn:zimbraMail"},g,b,f; | |
if(this.viewMode==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE&&!this.isException){this._addInviteAndCompNum(d); | |
k=true | |
}else{if(this.viewMode==ZmCalItem.MODE_EDIT||this.viewMode==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE||this.viewMode==ZmCalItem.MODE_EDIT_SERIES){this._addInviteAndCompNum(d); | |
k=this.isException | |
}}g=this.getRemoteFolderOwner(); | |
b=this._setRequestAttributes(d,c,a,g); | |
f=b.inv.comp[0]; | |
if(k){this.addExceptionDetails(f) | |
}else{this._recurrence.setJson(f) | |
}this._setAlarmData(f); | |
this._sendRequest(null,g,h,e,i,j) | |
}; | |
ZmCalItem.prototype._setAlarmData=function(f){var g=this._useAbsoluteReminder,c=g?this._reminderAbs:this._reminderMinutes; | |
if(c==null||c===-1){return | |
}for(var e=0,h=this.alarmActions.size(); | |
e<h; | |
e++){var j=null; | |
var d=this.alarmActions.get(e); | |
if(d==ZmCalItem.ALARM_EMAIL){j=appCtxt.get(ZmSetting.CAL_EMAIL_REMINDERS_ADDRESS); | |
if(!j){continue | |
}}if(d==ZmCalItem.ALARM_DEVICE_EMAIL){j=appCtxt.get(ZmSetting.CAL_DEVICE_EMAIL_REMINDERS_ADDRESS); | |
if(!j){continue | |
}d=ZmCalItem.ALARM_EMAIL | |
}var k=f.alarm=f.alarm||[]; | |
var a={action:d}; | |
k.push(a); | |
var b=a.trigger={}; | |
this._setReminderUnits(b,c); | |
this._addXPropsToAlarm(a); | |
if(j){a.at={a:j} | |
}}}; | |
ZmCalItem.prototype._setReminderUnits=function(b,d){d=d||0; | |
var c=this._useAbsoluteReminder,a=b[c?"abs":"rel"]={}; | |
if(c){a.d=d | |
}else{a.m=d; | |
a.related="START"; | |
a.neg="1" | |
}}; | |
ZmCalItem.prototype._addXPropsToAlarm=function(a){if(!this.alarmData){return | |
}var c=(this.alarmData&&this.alarmData.length>0)?this.alarmData[0]:null,d=c?c.alarm:null,b=(d&&d.length>0)?d[0]:null; | |
this._setAlarmXProps(b,a) | |
}; | |
ZmCalItem.prototype._setAlarmXProps=function(f,e){var d=(f&&f.xprop)?f.xprop:null,c,a,b; | |
if(!d){return | |
}d=(d instanceof Array)?d:[d]; | |
for(c=0; | |
c<d.length; | |
c++){b=d[c]; | |
if(b&&b.name){a=e.xprop={}; | |
a.name=b.name; | |
if(b.value!=null){a.value=b.value | |
}this._addXParamToRequest(a,b.xparam) | |
}}}; | |
ZmCalItem.prototype.setReminderMinutes=function(a){this._reminderMinutes=a | |
}; | |
ZmCalItem.prototype.setReminderUnits=function(a,b,c){if(!a){this._reminderMinutes=0; | |
return | |
}a=parseInt(a+""); | |
this._reminderMinutes=ZmCalendarApp.convertReminderUnits(a,b); | |
this._reminderSendEmail=c | |
}; | |
ZmCalItem.prototype.addReminderAction=function(a){this.alarmActions.add(a,null,true) | |
}; | |
ZmCalItem.prototype.removeReminderAction=function(a){this.alarmActions.remove(a) | |
}; | |
ZmCalItem.prototype.cancel=function(f,a,g,e,c){this.setViewMode(f); | |
if(a){var k=[]; | |
var b=(a._topPart.contentType==ZmMimeTable.MULTI_ALT)?a._topPart.children.getArray():[a._topPart]; | |
for(var d=0; | |
d<b.length; | |
d++){k.push(b[d]) | |
}a.setBodyParts(k); | |
this._setNotes(a); | |
this._doCancel(f,g,a,c) | |
}else{var h=new AjxCallback(this,this._doCancel,[f,g,null,c]); | |
var j=new AjxCallback(this,this._handleCancelError,[f,g,e]); | |
if(this._blobInfoMissing&&f!=ZmCalItem.MODE_DELETE_SERIES){this.showBlobMissingDlg() | |
}else{this.getDetails(null,h,j) | |
}}}; | |
ZmCalItem.prototype.showBlobMissingDlg=function(){var a=appCtxt.getMsgDialog(); | |
a.setMessage(ZmMsg.apptBlobMissing,DwtMessageDialog.INFO_STYLE); | |
a.popup() | |
}; | |
ZmCalItem.prototype._handleCancelError=function(c,d,a,b){if(b.code=="mail.NO_SUCH_BLOB"){if(this.isRecurring()&&c!=ZmCalItem.MODE_DELETE_SERIES){this._blobInfoMissing=true; | |
this.showBlobMissingDlg(); | |
return true | |
}else{this._doCancel(c,d,this.message) | |
}return true | |
}if(a){return a.run(b) | |
}return false | |
}; | |
ZmCalItem.prototype.setCancelFutureInstances=function(a){this._cancelFutureInstances=a | |
}; | |
ZmCalItem.prototype._sendCancelMsg=function(a){this.save(null,a) | |
}; | |
ZmCalItem.prototype._doCancel=function(u,k,l,v,t){var b=this.getFolder().nId,F={},D,g,y,a=this.getRemoteFolderOwner(),s,q,d,w,B,E,x,C,A,z,f,c,p,r,n,h,o; | |
if(b==ZmOrganizer.ID_TRASH){u=ZmCalItem.MODE_PURGE; | |
D=this._getRequestNameForMode(u); | |
g=F[D]={_jsns:"urn:zimbraMail"}; | |
y=g.action={}; | |
y.op="delete"; | |
y.id=this.id; | |
if(v){v.addRequestParams(F,k) | |
}else{this._sendRequest(null,a,k,null,F,D) | |
}}else{if(u==ZmCalItem.MODE_DELETE_SERIES&&this._cancelFutureInstances&&this.getOrigStartDate().getTime()!=this.getStartTime()){s=this._recurrence; | |
q=new Date(this.getOrigStartDate().getTime()); | |
q.setTime(q.getTime()-AjxDateUtil.MSEC_PER_DAY); | |
s.repeatEndDate=q; | |
s.repeatEndType="D"; | |
this.viewMode=ZmCalItem.MODE_EDIT_SERIES; | |
this._sendCancelMsg(k); | |
return | |
}if(u==ZmCalItem.MODE_DELETE||u==ZmCalItem.MODE_DELETE_SERIES||u==ZmCalItem.MODE_DELETE_INSTANCE){D=this._getRequestNameForMode(u); | |
g=F[D]={_jsns:"urn:zimbraMail"}; | |
this._addInviteAndCompNum(g); | |
if(u==ZmCalItem.MODE_DELETE_INSTANCE||this.isException){g.s=this.getOrigStartTime(); | |
d=g.inst={}; | |
w=this.isAllDayEvent(); | |
B=w?AjxDateUtil.getServerDate:AjxDateUtil.getServerDateTime; | |
d.d=B(this.getOrigStartDate()); | |
if(!w&&this.timezone){d.tz=this.timezone; | |
E=AjxTimezone.getClientId(this.timezone); | |
ZmTimezone.set(g,E,null,true) | |
}}x=g.m={}; | |
C=x.e=[]; | |
o=this.isOrganizer(); | |
if(o){if(!this.inviteNeverSent){if(l){for(A=0; | |
A<ZmMailMsg.ADDRS.length; | |
A++){f=ZmMailMsg.ADDRS[A]; | |
if((a&&f==AjxEmailAddress.FROM)||(f==AjxEmailAddress.RESENT_FROM)){continue | |
}c=l.getAddresses(f); | |
p=c.size(); | |
for(z=0; | |
z<p; | |
z++){r=c.get(z); | |
C.push({a:r.getAddress(),t:AjxEmailAddress.toSoapType[f]}) | |
}}if(a){C.push({a:a,t:AjxEmailAddress.toSoapType[AjxEmailAddress.FROM]}) | |
}}else{this._addAttendeesToRequest(null,x,null,a) | |
}}h=this.getMailFromAddress(); | |
if(h){C.push({a:h,t:AjxEmailAddress.toSoapType[AjxEmailAddress.FROM]}) | |
}}n=(l&&l.subject)?l.subject:([ZmMsg.cancelled,": ",this.name].join("")); | |
x.su=n; | |
this._addNotesToRequest(x,true); | |
if(v){v.addRequestParams(F,k) | |
}else{this._sendRequest(null,a,k,null,F,D) | |
}}else{if(k){k.run() | |
}}}}; | |
ZmCalItem.prototype.getMailFromAddress=function(){var a=appCtxt.get(ZmSetting.MAIL_FROM_ADDRESS); | |
if(a){return(a instanceof Array)?a[0]:a | |
}}; | |
ZmCalItem.prototype.getTextSummary=function(){return this.getSummary(false) | |
}; | |
ZmCalItem.prototype.getHtmlSummary=function(){return this.getSummary(true) | |
}; | |
ZmCalItem.prototype._getTextSummaryTime=function(e,h,b,a,d,j){var k=appCtxt.get(ZmSetting.CAL_SHOW_TIMEZONE); | |
var c=[]; | |
var f=0; | |
if(b){c[f++]=AjxDateUtil.longComputeDateStr(b); | |
c[f++]=", " | |
}if(this.isAllDayEvent()){c[f++]=ZmMsg.allDay | |
}else{var g=AjxDateFormat.getTimeInstance(); | |
if(a){c[f++]=g.format(a) | |
}if(a&&d){c[f++]=" - " | |
}if(d){c[f++]=g.format(d) | |
}if(k){c[f++]=" "; | |
c[f++]=AjxTimezone.getLongName(AjxTimezone.getClientId(this.timezone)) | |
}}if(e&&((this._orig&&this._orig.isAllDayEvent()!=this.isAllDayEvent())||j)){c[f++]=" "; | |
c[f++]=ZmMsg.apptModifiedStamp | |
}c[f++]="\n"; | |
return c.join("") | |
}; | |
ZmCalItem.prototype._trimNotesSummary=function(b,c){if(b){var a=b.indexOf(ZmItem.NOTES_SEPARATOR); | |
if(a!=-1){b=b.substr(a+ZmItem.NOTES_SEPARATOR.length); | |
if(c){b=b.replace(/^<br><br>/i,""); | |
b=b.replace(/^<\/div><br>/i,""); | |
b=b.replace(/^<\/body><\/html>/i,"") | |
}else{b=b.replace(/^\n\n/i,"") | |
}}}return AjxStringUtil.trim(b) | |
}; | |
ZmCalItem.prototype._resetCached=function(){delete this._startTimeUniqId; | |
this._startTimeUniqId=null; | |
delete this._validAttachments; | |
this._validAttachments=null; | |
delete this.tooltip; | |
this.tooltip=null | |
}; | |
ZmCalItem.prototype._getTTDay=function(a){return DwtCalendar.getDayFormatter().format(a) | |
}; | |
ZmCalItem.prototype._addInviteAndCompNum=function(a){var b; | |
if(this.message&&!this.isVersionIgnored()){a.ms=this.message.ms; | |
a.rev=this.message.rev | |
}if(this.viewMode==ZmCalItem.MODE_EDIT_SERIES||this.viewMode==ZmCalItem.MODE_DELETE_SERIES){if(this.recurring&&this.seriesInvId!=null){a.id=this.seriesInvId; | |
a.comp=this.getCompNum() | |
}}else{if(this.invId!=null&&this.invId!=-1){b=this.invId; | |
if(appCtxt.multiAccounts&&this._orig&&this._orig.getFolder().getAccount()!=this.getFolder().getAccount()){b=ZmOrganizer.getSystemId(this.invId,this._orig.getFolder().getAccount(),true) | |
}a.id=b; | |
a.comp=this.getCompNum() | |
}}}; | |
ZmCalItem.prototype._getDefaultBlurb=function(e,d){var a=[]; | |
var b=0; | |
var c=this.viewMode==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE||this.viewMode==ZmCalItem.MODE_DELETE_INSTANCE; | |
if(d){a[b++]="<h3>" | |
}if(this.isProposeTimeMode){a[b++]=ZmMsg.subjectNewTime | |
}else{if(e){a[b++]=c?ZmMsg.apptInstanceCanceled:ZmMsg.apptCanceled | |
}else{if(!this.isForwardMode||this.isOrganizer()){if(!this.inviteNeverSent&&(this.viewMode==ZmCalItem.MODE_EDIT||this.viewMode==ZmCalItem.MODE_EDIT_SINGLE_INSTANCE||this.viewMode==ZmCalItem.MODE_EDIT_SERIES)){a[b++]=c?ZmMsg.apptInstanceModified:ZmMsg.apptModified | |
}else{a[b++]=ZmMsg.apptNew | |
}}else{a[b++]=ZmMsg.apptForwarded | |
}}}if(d){a[b++]="</h3>" | |
}a[b++]="\n\n"; | |
a[b++]=this.getSummary(d); | |
return a.join("") | |
}; | |
ZmCalItem.prototype._getRequestNameForMode=function(b,a){}; | |
ZmCalItem.prototype._getInviteFromError=function(a){}; | |
ZmCalItem.prototype._setRequestAttributes=function(d,f,j,c){var w=d.m={},s=this.getFolder(),p=s.getAccount(),q=c&&p&&p.name!=c,g,l,h,C,k,D,v,r,G,y,o,u,t,A,F,n,b,a,B,E,z,x; | |
w.l=(q?this.getFolder().rid:this.folderId); | |
b=w.inv={}; | |
z=w.e=[]; | |
if(this.uid!=null&&this.uid!=-1&&!this.isSharedCopy){b.uid=this.uid | |
}t=b.comp=[]; | |
A=t[0]={}; | |
A.at=[]; | |
this._addAttendeesToRequest(A,w,j,c); | |
G=this.identity; | |
v=G==null||G.isDefault; | |
y=s.isRemote(); | |
g=this.getMailFromAddress(); | |
if(this.isOrganizer()&&!c&&(g||y||!v)){if(g){n=g | |
}else{if(y){n=this.organizer | |
}else{if(G){n=G.sendFromAddress; | |
h=G.sendFromDisplay | |
}}}o={a:n,t:AjxEmailAddress.toSoapType[AjxEmailAddress.FROM]}; | |
if(!h&&n==appCtxt.get(ZmSetting.USERNAME)){h=appCtxt.get(ZmSetting.DISPLAY_NAME) | |
}if(h){o.p=h | |
}z.push(o); | |
if(G&&G.isFromDataSource&&!y){this._addIdentityFrom(G,z,w) | |
}}if(y){if(!G){r=appCtxt.getIdentityCollection(); | |
G=r&&r.defaultIdentity | |
}if(G){n=G.sendFromAddress; | |
h=G.sendFromDisplay | |
}else{n=appCtxt.get(ZmSetting.USERNAME); | |
h=appCtxt.get(ZmSetting.DISPLAY_NAME) | |
}o={a:n,t:AjxEmailAddress.toSoapType[AjxEmailAddress.SENDER]}; | |
if(h){o.p=h | |
}z.push(o) | |
}this._addExtrasToRequest(d,A); | |
this._addDateTimeToRequest(d,A); | |
this._addXPropsToRequest(A); | |
w.su=this.name; | |
A.name=this.name; | |
this._addLocationToRequest(A); | |
this._addNotesToRequest(w); | |
if(!(appCtxt.isOffline&&p.isMain)){E=(appCtxt.multiAccounts)?p.getEmail():appCtxt.get(ZmSetting.USERNAME); | |
if(!G){r=appCtxt.getIdentityCollection(p); | |
G=r&&r.defaultIdentity | |
}if(G){l=G.sendFromAddress; | |
h=G.sendFromDisplay | |
}F=g||l||E; | |
D=this.organizer||F; | |
a=A.or={}; | |
a.a=D; | |
if(y){a.sentBy=F | |
}u=(D==l)?h:(ZmApptViewHelper.getAddressEmail(D)).getName(); | |
if(u){a.d=u | |
}}this.flagLocal(ZmItem.FLAG_ATTACH,false); | |
this.getAttachments(); | |
if(f!=null||(this._validAttachments!=null&&this._validAttachments.length)){k=d.m.attach={}; | |
if(f){k.aid=f; | |
this.flagLocal(ZmItem.FLAG_ATTACH,true) | |
}if(this._validAttachments){C=this._validAttachments.length; | |
k.mp=[]; | |
for(x=0; | |
x<C; | |
x++){B=(this.invId||this.message.id); | |
if((B.indexOf(":")<0)&&s.isRemote()){B=(appCtxt.getActiveAccount().id+":"+B) | |
}k.mp.push({mid:B,part:this._validAttachments[x].part}) | |
}if(C>0){this.flagLocal(ZmItem.FLAG_ATTACH,true) | |
}}}return{inv:b,m:w} | |
}; | |
ZmCalItem.prototype._addIdentityFrom=function(c,f,a){var i=appCtxt.getDataSourceCollection().getById(c.id),h,d,g,b; | |
if(i){h=ZmDataSource.getProviderForAccount(i); | |
d=h&&h._nosender; | |
if(!d){f.push({t:AjxEmailAddress.toSoapType[AjxEmailAddress.SENDER],p:appCtxt.get(ZmSetting.DISPLAY_NAME)||""}) | |
}g={t:AjxEmailAddress.toSoapType[AjxEmailAddress.SENDER],a:i.getEmail()}; | |
if(appCtxt.get(ZmSetting.DEFAULT_DISPLAY_NAME)){b=i.identity&&i.identity.sendFromDisplay; | |
b=b||i.userName||i.getName(); | |
if(b){g.p=b | |
}}f.push(g) | |
}}; | |
ZmCalItem.prototype._addExtrasToRequest=function(b,a){if(this.priority){a.priority=this.priority | |
}a.status=this.status | |
}; | |
ZmCalItem.prototype._addXPropsToRequest=function(c){var f=this.message?this.message:null,b=(f&&f.invite)?f.invite:null,g=b?b.getXProp():null,e,a,d; | |
if(!g){return | |
}c.xprop=[]; | |
g=(g instanceof Array)?g:[g]; | |
for(d=0; | |
d<g.length; | |
d++){e=g[d],a={}; | |
if(e&&e.name){a.name=e.name; | |
if(e.value!=null){a.value=e.value | |
}this._addXParamToRequest(a,e.xparam); | |
c.xprop.push(a) | |
}}}; | |
ZmCalItem.prototype._addXParamToRequest=function(d,f){if(!f){return | |
}f=(f instanceof Array)?f:[f]; | |
var b=d.xparam=[],e={},c,a; | |
for(c=0; | |
c<f.length; | |
c++){a=f[c]; | |
e={}; | |
if(a&&a.name){e.name=a.name; | |
if(a.value!=null){e.value=a.value | |
}b.push(e) | |
}}}; | |
ZmCalItem.prototype._addDateTimeToRequest=function(f,c){c.allDay=this.allDayEvent+""; | |
var i,a,d,h,g,b; | |
if(this.timezone){a=AjxTimezone.getClientId(this.timezone); | |
ZmTimezone.set(f,a,null,true); | |
i=this.timezone | |
}if(this.startDate){d=c.s={}; | |
if(!this.isAllDayEvent()){h=AjxDateUtil.getServerDateTime(this.startDate,this.startsInUTC); | |
if(!this.startsInUTC&&i&&i.length){d.tz=i | |
}d.d=h | |
}else{d.d=AjxDateUtil.getServerDate(this.startDate) | |
}}if(this.endTimezone){i=this.endTimezone | |
}if(this.endDate){g=c.e={}; | |
if(!this.isAllDayEvent()){b=AjxDateUtil.getServerDateTime(this.endDate,this.endsInUTC); | |
if(!this.endsInUTC&&i&&i.length){g.tz=i | |
}g.d=b | |
}else{g.d=AjxDateUtil.getServerDate(this.endDate) | |
}}}; | |
ZmCalItem.prototype._addAttendeesToRequest=function(b,a,d,c){if(this.isOrganizer()&&c){a.e.push({a:c,t:AjxEmailAddress.toSoapType[AjxEmailAddress.FROM]}) | |
}}; | |
ZmCalItem.prototype._addNotesToRequest=function(d,q){var e=this.hasAttendees(),j=e?this._getDefaultBlurb(q):"",r=e?this._getDefaultBlurb(q,true):"",c=d.mp={mp:[]},b,a,p,k,l,n,o,h,g; | |
c.ct=ZmMimeTable.MULTI_ALT; | |
b=this.notesTopPart?this.notesTopPart.children.size():0; | |
if(b>0){for(g=0; | |
g<b; | |
g++){a=this.notesTopPart.children.get(g); | |
p=a.getContentType(); | |
if(p==ZmMimeTable.TEXT_HTML){var f=a.getContent(); | |
f=AjxStringUtil.defangHtmlContent(f); | |
k="<html><body id='htmlmode'>"+(this._includeEditReply?f:AjxBuffer.concat(r,f))+"</body></html>" | |
}else{k=this._includeEditReply?a.getContent():AjxBuffer.concat(j,a.getContent()) | |
}c.mp.push({ct:p,content:k}) | |
}}else{l=this.notesTopPart; | |
n=l?l.getContent():""; | |
p=l?l.getContentType():ZmMimeTable.TEXT_PLAIN; | |
c.mp.push({ct:p}); | |
if(p==ZmMimeTable.TEXT_HTML){o=AjxStringUtil.nl2br(AjxStringUtil.htmlEncode(n)); | |
h="<html><body>"+(this._includeEditReply?o:AjxBuffer.concat(r,o))+"</body></html>"; | |
c.mp[0].content=h | |
}else{c.mp[0].content=(this._includeEditReply?n:AjxBuffer.concat(j,n)) | |
}}}; | |
ZmCalItem.prototype.getInviteDescription=function(e){var d=this.hasAttendees(); | |
var c=d?this.getSummary(false):""; | |
var b=d?this.getSummary(true):""; | |
var a=this.getNotesPart(e?ZmMimeTable.TEXT_HTML:ZmMimeTable.TEXT_PLAIN); | |
return AjxBuffer.concat(e?b:c,a) | |
}; | |
ZmCalItem.prototype.setIncludeEditReply=function(a){this._includeEditReply=a | |
}; | |
ZmCalItem.prototype._sendRequest=function(d,c,h,b,g,f){var a=d?d.getMethod().nodeName.replace("Request","Response"):f.replace("Request","Response"); | |
var e=new AjxCallback(this,this._handleResponseSend,[a,h]); | |
if(!g){appCtxt.getAppController().sendRequest({soapDoc:d,asyncMode:true,accountName:c,callback:e,errorCallback:b}) | |
}else{appCtxt.getAppController().sendRequest({jsonObj:g,asyncMode:true,accountName:c,callback:e,errorCallback:b}) | |
}}; | |
ZmCalItem.prototype._loadFromDom=function(b,a){ZmCalBaseItem.prototype._loadFromDom.call(this,b,a); | |
this.isOrg=this._getAttr(b,a,"isOrg"); | |
var c=b.or; | |
this.organizer=c&&c.a; | |
this.sentBy=c&&c.sentBy; | |
this.invId=this._getAttr(b,a,"invId"); | |
this.compNum=this._getAttr(b,a,"compNum")||"0"; | |
this.parseAlarmData(this.alarmData); | |
this.seriesInvId=this.recurring?b.invId:null; | |
this.ridZ=a&&a.ridZ; | |
if(b.tn){this._parseTagNames(b.tn) | |
}if(b.f){this._parseFlags(b.f) | |
}}; | |
ZmCalItem.prototype._handleResponseSend=function(f,g,a){var e=a.getResponse(); | |
var d=e[f]; | |
if(d.uid!=null){this.uid=d.uid | |
}var c; | |
if(d.echo){c=d.echo; | |
if(c.length>0){c=c[0] | |
}}c=c?c.m:d.m; | |
if(c!=null){if(c.length>0){c=c[0] | |
}var b=this.invId; | |
this.invId=c.id; | |
if(AjxUtil.isSpecified(b)&&b!=this.invId){this.message=null | |
}else{if(c){this.message=new ZmMailMsg(c.id); | |
this.message._loadFromDom(c); | |
delete this._validAttachments; | |
this._validAttachments=null; | |
this.getAttachments() | |
}}}this._messageNode=null; | |
if(g){g.run(d) | |
}}; | |
ZmCalItem.prototype.processErrorSave=function(b){var a={continueSave:false,errorMessage:""}; | |
if(b.code==ZmCsfeException.MAIL_SEND_ABORTED_ADDRESS_FAILURE){var c=b.getData(ZmCsfeException.MAIL_SEND_ADDRESS_FAILURE_INVALID); | |
var d=(c&&c.length)?AjxMessageFormat.format(ZmMsg.apptSendErrorInvalidAddresses,AjxStringUtil.htmlEncode(c.join(", "))):null; | |
a.errorMessage=ZmMsg.apptSendErrorAbort+"<br/>"+d | |
}else{if(b.code==ZmCsfeException.MAIL_SEND_PARTIAL_ADDRESS_FAILURE){var c=b.getData(ZmCsfeException.MAIL_SEND_ADDRESS_FAILURE_INVALID); | |
a.errorMessage=(c&&c.length)?AjxMessageFormat.format(ZmMsg.apptSendErrorPartial,AjxStringUtil.htmlEncode(c.join(", "))):ZmMsg.apptSendErrorAbort | |
}else{if(b.code==ZmCsfeException.MAIL_MESSAGE_TOO_BIG){a.errorMessage=(this.type==ZmItem.TASK)?ZmMsg.taskSaveErrorToobig:ZmMsg.apptSaveErrorToobig | |
}else{if(b.code==ZmCsfeException.MAIL_INVITE_OUT_OF_DATE){if(!this.isVersionIgnored()){this.setIgnoreVersion(true); | |
a.continueSave=true | |
}else{a.errorMessage=ZmMsg.inviteOutOfDate; | |
this.setIgnoreVersion(false) | |
}}else{if(b.code==ZmCsfeException.MAIL_NO_SUCH_CALITEM){a.errorMessage=b.getErrorMsg([b.getData("itemId")]) | |
}else{if(b.code==ZmCsfeException.MAIL_QUOTA_EXCEEDED){if(this.type==ZmItem.APPT){a.errorMessage=ZmMsg.errorQuotaExceededAppt | |
}else{if(this.type==ZmItem.TASK){a.errorMessage=ZmMsg.errorQuotaExceededTask | |
}}}else{if(b.code===ZmCsfeException.MUST_BE_ORGANIZER){a.errorMessage=ZmMsg.mustBeOrganizer | |
}}}}}}}return a | |
}; | |
ZmCalItem.prototype.setProposedTimeCallback=function(a){this._proposedTimeCallback=a | |
}; | |
ZmCalItem.prototype.handlePostSaveCallbacks=function(){if(this._proposedTimeCallback){this._proposedTimeCallback.run(this) | |
}this.setIgnoreVersion(false) | |
}; | |
ZmCalItem.isPriorityHigh=function(a){return AjxUtil.arrayContains(ZmCalItem.PRIORITY_HIGH_RANGE,a) | |
}; | |
ZmCalItem.isPriorityLow=function(a){return AjxUtil.arrayContains(ZmCalItem.PRIORITY_LOW_RANGE,a) | |
}; | |
ZmCalItem.isPriorityNormal=function(a){return AjxUtil.arrayContains(ZmCalItem.PRIORITY_NORMAL_RANGE,a) | |
}; | |
ZmCalItem.getLabelForPriority=function(a){if(ZmCalItem.isPriorityLow(a)){return ZmMsg.low | |
}if(ZmCalItem.isPriorityNormal(a)){return ZmMsg.normal | |
}if(ZmCalItem.isPriorityHigh(a)){return ZmMsg.high | |
}return"" | |
}; | |
ZmCalItem.getImageForPriority=function(a,b){if(ZmCalItem.isPriorityLow(a.priority)){return b?AjxImg.getImageHtml("PriorityLow_list",null,["id='",b,"'"].join("")):AjxImg.getImageHtml("PriorityLow_list") | |
}else{if(ZmCalItem.isPriorityHigh(a.priority)){return b?AjxImg.getImageHtml("PriorityHigh_list",null,["id='",b,"'"].join("")):AjxImg.getImageHtml("PriorityHigh_list") | |
}}return"" | |
}; | |
ZmCalItem.getLabelForStatus=function(a){switch(a){case ZmCalendarApp.STATUS_CANC:return ZmMsg.cancelled; | |
case ZmCalendarApp.STATUS_COMP:return ZmMsg.completed; | |
case ZmCalendarApp.STATUS_DEFR:return ZmMsg.deferred; | |
case ZmCalendarApp.STATUS_INPR:return ZmMsg.inProgress; | |
case ZmCalendarApp.STATUS_NEED:return ZmMsg.notStarted; | |
case ZmCalendarApp.STATUS_WAIT:return ZmMsg.waitingOn | |
}return"" | |
}; | |
ZmCalItem.getLabelForParticipationStatus=function(a){switch(a){case ZmCalBaseItem.PSTATUS_ACCEPT:return ZmMsg.ptstAccept; | |
case ZmCalBaseItem.PSTATUS_DECLINED:return ZmMsg.ptstDeclined; | |
case ZmCalBaseItem.PSTATUS_DEFERRED:return ZmMsg.ptstDeferred; | |
case ZmCalBaseItem.PSTATUS_DELEGATED:return ZmMsg.ptstDelegated; | |
case ZmCalBaseItem.PSTATUS_NEEDS_ACTION:return ZmMsg.ptstNeedsAction; | |
case ZmCalBaseItem.PSTATUS_COMPLETED:return ZmMsg.completed; | |
case ZmCalBaseItem.PSTATUS_TENTATIVE:return ZmMsg.ptstTentative; | |
case ZmCalBaseItem.PSTATUS_WAITING:return ZmMsg.ptstWaiting | |
}return"" | |
}; | |
ZmCalItem.getParticipationStatusIcon=function(a){switch(a){case ZmCalBaseItem.PSTATUS_ACCEPT:return"Check"; | |
case ZmCalBaseItem.PSTATUS_DECLINED:return"Cancel"; | |
case ZmCalBaseItem.PSTATUS_DEFERRED:return"QuestionMark"; | |
case ZmCalBaseItem.PSTATUS_DELEGATED:return"Plus"; | |
case ZmCalBaseItem.PSTATUS_NEEDS_ACTION:return"NeedsAction"; | |
case ZmCalBaseItem.PSTATUS_COMPLETED:return"Completed"; | |
case ZmCalBaseItem.PSTATUS_TENTATIVE:return"QuestionMark"; | |
case ZmCalBaseItem.PSTATUS_WAITING:return"Minus" | |
}return"" | |
}; | |
ZmCalItem._getTTDay=function(c,b){b=b||AjxDateFormat.SHORT; | |
var a=AjxDateFormat.getDateInstance(); | |
return a.format(c) | |
}; | |
ZmCalItem.prototype.isTextPartPresent=function(c){var a=c._topPart&&c._topPart.children.getArray().filter(function(d){return d.contentType===ZmMimeTable.TEXT_PLAIN | |
}); | |
var b=a&&a.length&&a[0].getContent(); | |
if(b&&b.length){return true | |
}else{return false | |
}} | |
}if(AjxPackage.define("zimbraMail.tasks.model.ZmTask")){ZmTask=function(b,c,a){ZmCalItem.call(this,ZmItem.TASK,b,c,a); | |
this.priority=ZmCalItem.PRIORITY_NORMAL; | |
this.pComplete=0; | |
this.status=ZmCalendarApp.STATUS_NEED; | |
this.startDate=null; | |
this.endDate=null; | |
this.remindDate=new Date(); | |
this.alarm=false; | |
this._useAbsoluteReminder=true | |
}; | |
ZmTask.prototype=new ZmCalItem; | |
ZmTask.prototype.constructor=ZmTask; | |
ZmTask.PCOMPLETE_INT=10; | |
ZmTaskClone=function(){}; | |
ZmTask.quickClone=function(b){ZmTaskClone.prototype=b; | |
var a=new ZmTaskClone(); | |
a.startDate=b.startDate?(new Date(b.startDate.getTime())):null; | |
a.endDate=b.endDate?(new Date(b.endDate.getTime())):null; | |
a._uniqId=Dwt.getNextId(); | |
a._validAttachments=AjxUtil.createProxy(b._validAttachments); | |
if(!a._orig){a._orig=b | |
}a.type=ZmItem.TASK; | |
return a | |
}; | |
ZmTask.createFromDom=function(d,c,a){var b=new ZmTask(c.list,d.id); | |
b._loadFromDom(d,a); | |
return b | |
}; | |
ZmTask.prototype.toString=function(){return"ZmTask" | |
}; | |
ZmTask.prototype.getIcon=function(){return"Task" | |
}; | |
ZmTask.prototype.getFolder=function(){return appCtxt.getById(this.folderId) | |
}; | |
ZmTask.prototype.getId=function(){return this.id | |
}; | |
ZmTask.prototype.getSummary=function(a){}; | |
ZmTask.prototype.getToolTip=function(a){}; | |
ZmTask.prototype.notifyModify=function(a){ZmItem.prototype.notifyModify.call(this,a); | |
this.uid=a.uid; | |
if(a.l){this.folderId=a.l | |
}this._loadFromDom(a); | |
this._notify(ZmEvent.E_MODIFY,a) | |
}; | |
ZmTask.prototype.isPastDue=function(){return(this.endDate&&((new Date()).getTime()>this.endDate.getTime())) | |
}; | |
ZmTask.prototype.getEndTime=function(){return this.endDate?this.endDate.getTime():null | |
}; | |
ZmTask.prototype.getStartTime=function(){return this.startDate?this.startDate.getTime():null | |
}; | |
ZmTask.prototype.isComplete=function(){return(this.pComplete==100)||(this.status==ZmCalendarApp.STATUS_COMP) | |
}; | |
ZmTask.prototype.getPercentComplete=function(){return this.pComplete | |
}; | |
ZmTask.prototype.getStatus=function(){return this.status | |
}; | |
ZmTask.prototype.getPriority=function(){return this.priority | |
}; | |
ZmTask.prototype.cancel=function(c,a){this.setViewMode(c); | |
var e={},d=this._getRequestNameForMode(c),b=e[d]={_jsns:"urn:zimbraMail"}; | |
this._addInviteAndCompNum(b); | |
a.addRequestParams(e) | |
}; | |
ZmTask.prototype.getRemoteFolderOwner=function(){var a=AjxDispatcher.run("GetTaskController"); | |
if(a.isMovingBetwAccounts(this,this.folderId)){return null | |
}var b=this.getFolder(); | |
return(b&&b.link)?b.owner:null | |
}; | |
ZmTask.prototype._getDefaultFolderId=function(){return ZmOrganizer.ID_TASKS | |
}; | |
ZmTask.prototype._loadFromDom=function(d,m){var h=d.inv?d.inv[0]:null; | |
var j=h?h.comp[0]:null; | |
if(!d.id){this.id=d.id | |
}if(d.invId){this.invId=d.invId | |
}else{if(h){var e=h.id; | |
e=e.toString().indexOf(":"); | |
if(e!=-1){this.invId=this.id+"-"+h.id.substring(e+1) | |
}else{this.invId=[d.id,h.id].join("-") | |
}}}this.uid=d.uid; | |
if(d.l){this.folderId=d.l | |
}if(d.s){this.size=d.s | |
}if(d.sf){this.sf=d.sf | |
}this.allDayEvent=(m?m.allDay:null||d.allDay)?"1":"0"; | |
var c=d.inst&&d.inst.length>0?d.inst[0]:null; | |
var p=this.tzo=c&&c.tzo!=null?parseInt(c.tzo):0; | |
var l=this.tzoDue=c&&c.tzoDue!=null?parseInt(c.tzoDue):0; | |
if(c&&c.s){var k=this.isAllDayEvent()?(p+new Date(parseInt(c.s,10)).getTimezoneOffset()*60*1000):0; | |
var b=parseInt(c.s,10)+k; | |
this.startDate=new Date(b); | |
this.uniqStartTime=this.startDate.getTime() | |
}else{if(j){this.startDate=null; | |
if(j.s&&j.s[0].d){var a=j.s[0].d; | |
var g=parseInt(a.substr(0,4),10); | |
var o=parseInt(a.substr(4,2),10); | |
var n=parseInt(a.substr(6,2),10); | |
this.startDate=new Date(g,o-1,n) | |
}}}if(c&&c.dueDate){var k=this.isAllDayEvent()?(l+new Date(parseInt(c.dueDate,10)).getTimezoneOffset()*60*1000):0; | |
var i=parseInt(c.dueDate,10)+k; | |
this.endDate=new Date(i) | |
}else{if(j){this.endDate=null; | |
if(j.e&&j.e[0].d){var f=j.e[0].d; | |
var g=parseInt(f.substr(0,4),10); | |
var o=parseInt(f.substr(4,2),10); | |
var n=parseInt(f.substr(6,2),10); | |
this.endDate=new Date(g,o-1,n) | |
}}}if(d.alarm){if(d.alarm){this.alarm=d.alarm | |
}if(d.alarmData){this.alarmData=this._getAttr(d,j,"alarmData") | |
}}else{if(j&&j.alarm&&(j.alarm.length>0)){this.alarm=d.alarm=true; | |
this.alarmData=d.alarmData=j.alarm | |
}}if(d.name||j){this.name=this._getAttr(d,j,"name") | |
}if(d.loc||j){this.location=this._getAttr(d,j,"loc") | |
}if(d.allDay||j){this.setAllDayEvent(this._getAttr(d,j,"allDay")) | |
}if(d.priority||j){this.priority=parseInt(this._getAttr(d,j,"priority")) | |
}if(d.percentComplete||j){this.pComplete=parseInt(this._getAttr(d,j,"percentComplete")) | |
}if(d.status||j){this.status=this._getAttr(d,j,"status") | |
}if(d.isOrg||j){this.isOrg=new Boolean(this._getAttr(d,j,"isOrg")) | |
}if(d.or||j){this.organizer=d.or?d.or.a:(j.or?j.or.a:null) | |
}if(d.ptst||j){this.ptst=this._getAttr(d,j,"ptst") | |
}if(d.compNum!=null){this.compNum=(this._getAttr(d,j,"compNum")||"0") | |
}if(d.f){this._parseFlags(d.f) | |
}if(d.tn){this._parseTagNames(d.tn) | |
}this.type=ZmItem.TASK | |
}; | |
ZmTask.prototype.isAlarmInRange=function(){if(!this.alarmData){return false | |
}var b=this.alarmData[0]; | |
if(!b){return false | |
}this._nextAlarmTime=new Date(b.nextAlarm); | |
this._alarmInstStart=this.adjustMS(b.alarmInstStart,this.tzo); | |
var a=(new Date()).getTime(); | |
return this._nextAlarmTime<=a | |
}; | |
ZmTask.prototype._getAttr=function(c,a,b){if(c[b]!=null){return c[b] | |
}if(a){return a[b] | |
}return null | |
}; | |
ZmTask.prototype.isAlarmModified=function(){if(this._orig.alarm==true&&this.alarm==false){return true | |
}return false | |
}; | |
ZmTask.prototype.isMultiDay=function(){var b=this.startDate; | |
var a=this.endDate; | |
if(!b&&!a){return false | |
}if(!b){return false | |
}return(b.getDate()!=a.getDate())||(b.getMonth()!=a.getMonth())||(b.getFullYear()!=a.getFullYear()) | |
}; | |
ZmTask.prototype._setExtrasFromMessage=function(a){ZmCalItem.prototype._setExtrasFromMessage.apply(this,arguments); | |
this.location=a.invite.getLocation() | |
}; | |
ZmTask.prototype._setTimeFromMessage=function(b,a){ZmCalItem.prototype._setTimeFromMessage.apply(this,arguments); | |
if(b.invite.components[0].s==null){this.startDate=null | |
}}; | |
ZmTask.prototype.parseAlarm=function(c){if(!c){return | |
}var e; | |
var b=(c)?c.trigger:null; | |
var a=(b&&(b.length>0))?b[0].abs:null; | |
e=(a&&(a.length>0))?a[0].d:null; | |
this._reminderMinutes=0; | |
if(c&&(c.action=="DISPLAY")){if(e!=null){this._reminderAbs=e; | |
this.remindDate=e?AjxDateUtil.parseServerDateTime(e):null | |
}}}; | |
ZmTask.prototype._getRequestNameForMode=function(b,a){switch(b){case ZmCalItem.MODE_NEW:return"CreateTaskRequest"; | |
case ZmCalItem.MODE_EDIT_SINGLE_INSTANCE:return !a?"CreateTaskExceptionRequest":"ModifyTaskRequest"; | |
case ZmCalItem.MODE_EDIT:case ZmCalItem.MODE_EDIT_SERIES:return"ModifyTaskRequest"; | |
case ZmCalItem.MODE_DELETE:case ZmCalItem.MODE_DELETE_SERIES:case ZmCalItem.MODE_DELETE_INSTANCE:return"CancelTaskRequest"; | |
case ZmCalItem.MODE_GET:return"GetTaskRequest" | |
}return null | |
}; | |
ZmTask.prototype._addExtrasToRequest=function(b,a){ZmCalItem.prototype._addExtrasToRequest.call(this,b,a); | |
a.percentComplete=this.pComplete | |
}; | |
ZmTask.prototype._getInviteFromError=function(a){return(a._data.GetTaskResponse.task[0].inv[0]) | |
}; | |
ZmTask.prototype.setTaskReminder=function(a){this._reminderAbs=a | |
}; | |
ZmTask.isInTrash=function(b){var a=(b instanceof ZmTask)?b.folderId:b.l; | |
var c=appCtxt.getById(a); | |
return(c&&c.isInTrash()) | |
} | |
}if(AjxPackage.define("zimbraMail.prefs.ZmPreferencesApp")){ZmPreferencesApp=function(b,a){ZmApp.call(this,ZmApp.PREFERENCES,b,a); | |
this._filterRules={}; | |
this._outgoingFilterRules={} | |
}; | |
ZmPreferencesApp.prototype=new ZmApp; | |
ZmPreferencesApp.prototype.constructor=ZmPreferencesApp; | |
ZmPreferencesApp.prototype.isZmPreferencesApp=true; | |
ZmPreferencesApp.prototype.toString=function(){return"ZmPreferencesApp" | |
}; | |
ZmEvent.S_FILTER="FILTER"; | |
ZmEvent.S_PREF_ZIMLET="PREF_ZIMLET"; | |
ZmEvent.S_PREF_ACCOUNT="PREF_ACCOUNT"; | |
ZmEvent.S_PREF_BACKUP="PREF_BACKUP"; | |
ZmApp.PREFERENCES=ZmId.APP_PREFERENCES; | |
ZmApp.CLASS[ZmApp.PREFERENCES]="ZmPreferencesApp"; | |
ZmApp.SETTING[ZmApp.PREFERENCES]=ZmSetting.OPTIONS_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.PREFERENCES]=10; | |
ZmApp.QS_ARG[ZmApp.PREFERENCES]="options"; | |
ZmOrganizer.PREF_PAGE="PREF_PAGE"; | |
ZmPreferencesApp.QS_ARG_SECTION="section"; | |
ZmPreferencesApp._registerAllPrefs=function(){AjxDispatcher.require("PreferencesCore"); | |
appCtxt.getAppController().runAppFunction("_registerPrefs") | |
}; | |
ZmZimbraMail.addAppListener(ZmApp.PREFERENCES,ZmAppEvent.PRE_LAUNCH,new AjxListener(ZmPreferencesApp._registerAllPrefs)); | |
ZmPreferencesApp.prototype.launch=function(b,d){if(appCtxt.multiAccounts){appCtxt.accountList.setActiveAccount(appCtxt.accountList.mainAccount) | |
}var c=(b.qsParams&&b.qsParams[ZmPreferencesApp.QS_ARG_SECTION])||"GENERAL"; | |
d=new AjxCallback(this,this.gotoSection,[c,d]); | |
var a=new AjxCallback(this,this._handleLoadLaunch,[d]); | |
AjxDispatcher.require(["PreferencesCore","Preferences"],true,a,null,true) | |
}; | |
ZmPreferencesApp.prototype.getPrefController=function(){if(!this._prefController){AjxDispatcher.require(["PreferencesCore","Preferences"]); | |
this._prefController=new ZmPrefController(this._container,this) | |
}return this._prefController | |
}; | |
ZmPreferencesApp.prototype.getFilterController=function(){if(!this._filterController){this._filterController=this.getPrefController().getFilterController() | |
}return this._filterController | |
}; | |
ZmPreferencesApp.prototype.getFilterRules=function(a){var b=window.parentAppCtxt||window.appCtxt; | |
var c=a||b.getActiveAccount().name; | |
if(!this._filterRules[c]){this._filterRules[c]=new ZmFilterRules(c) | |
}return this._filterRules[c] | |
}; | |
ZmPreferencesApp.prototype.getOutgoingFilterRules=function(a){var b=window.parentAppCtxt||window.appCtxt; | |
var c=a||b.getActiveAccount().name; | |
if(!this._outgoingFilterRules[c]){this._outgoingFilterRules[c]=new ZmFilterRules(c,true) | |
}return this._outgoingFilterRules[c] | |
}; | |
ZmPreferencesApp.prototype.modifyNotify=function(c,a){var b=this._getSharingView(); | |
if(b){b.notifyModify(c) | |
}}; | |
ZmPreferencesApp.prototype.refresh=function(b,d){var a=this.getPreferencesPage("TRUSTED_ADDR"); | |
if(a&&d){a.addItem(d) | |
}if(!appCtxt.inStartup){var c=this._getSharingView(); | |
if(c){c.refresh(b) | |
}}}; | |
ZmPreferencesApp.prototype.gotoSection=function(b,e){if(b){var d=this.getPrefController(); | |
var a=d&&d.getPrefsView(); | |
if(a){b=b.toUpperCase(); | |
var c=this.getOverview(); | |
if(c){c.setSelected([ZmOrganizer.PREF_PAGE,b].join("_")) | |
}a.selectSection(b) | |
}}if(e&&e.run){e.run() | |
}}; | |
ZmPreferencesApp.prototype._defineAPI=function(){AjxDispatcher.registerMethod("GetFilterRules",["PreferencesCore","Preferences"],new AjxCallback(this,this.getFilterRules)); | |
AjxDispatcher.registerMethod("GetOutgoingFilterRules",["PreferencesCore","Preferences"],new AjxCallback(this,this.getOutgoingFilterRules)); | |
AjxDispatcher.registerMethod("GetPrefController",["PreferencesCore","Preferences"],new AjxCallback(this,this.getPrefController)); | |
AjxDispatcher.registerMethod("GetFilterController",["PreferencesCore","Preferences"],new AjxCallback(this,this.getFilterController)) | |
}; | |
ZmPreferencesApp.prototype._registerOrganizers=function(){ZmOrganizer.registerOrg(ZmOrganizer.PREF_PAGE,{app:ZmApp.PREFERENCES,orgClass:"ZmPrefPage",orgPackage:"PreferencesCore",treeController:"ZmPrefPageTreeController",labelKey:"preferences",treeType:ZmOrganizer.PREF_PAGE,displayOrder:100}) | |
}; | |
ZmPreferencesApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_MOBILE_REMOVE,{textKey:"mobileRemoveFromList",image:"Delete"}); | |
ZmOperation.registerOp(ZmId.OP_MOBILE_RESUME_SYNC,{textKey:"mobileResumeSync",image:"ImAvailable"}); | |
ZmOperation.registerOp(ZmId.OP_MOBILE_SUSPEND_SYNC,{textKey:"mobileSuspendSync",image:"Offline"}); | |
ZmOperation.registerOp(ZmId.OP_MOBILE_WIPE,{textKey:"mobileWipe",image:"MobileWipe"},ZmSetting.MOBILE_POLICY_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_MOBILE_CANCEL_WIPE,{textKey:"mobileWipeCancel",image:"MobileWipeCancel"},ZmSetting.MOBILE_POLICY_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_REVERT_PAGE,{textKey:"restorePage"}) | |
}; | |
ZmPreferencesApp.prototype._registerSettings=function(a){a=a||appCtxt.getSettings(); | |
a.registerSetting("IMPORT_FOLDER",{type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("IMPORT_BUTTON",{type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("EXPORT_FOLDER",{type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("EXPORT_BUTTON",{type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("PREF_SECTIONS",{type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_HASH,isGlobal:true}); | |
a.registerSetting("SIGNATURE_MAX_LENGTH",{name:"zimbraMailSignatureMaxLength",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:1024}); | |
a.registerSetting("DISCARD_IN_FILTER_ENABLED",{name:"zimbraFeatureDiscardInFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("FROM_DISPLAY_ENABLED",{name:"zimbraFeatureFromDisplayEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}) | |
}; | |
ZmPreferencesApp.prototype._registerApp=function(){ZmApp.registerApp(ZmApp.PREFERENCES,{mainPkg:"Preferences",nameKey:"preferences",icon:"Preferences",textPrecedence:50,chooserTooltipKey:"goToOptions",button:appCtxt.isChildWindow?null:ZmAppChooser.B_OPTIONS,overviewTrees:[ZmOrganizer.PREF_PAGE],hideZimlets:true,gotoActionCode:ZmKeyMap.GOTO_OPTIONS,chooserSort:180}) | |
}; | |
ZmPreferencesApp.prototype._registerPrefs=function(){var r={GENERAL:{title:ZmMsg.general,templateId:"prefs.Pages#General",priority:0,prefs:[ZmSetting.LOCALE_NAME,ZmSetting.COMPOSE_INIT_DIRECTION,ZmSetting.SHOW_COMPOSE_DIRECTION_BUTTONS,ZmSetting.FONT_NAME,ZmSetting.FONT_SIZE,ZmSetting.PASSWORD,ZmSetting.SEARCH_INCLUDES_SHARED,ZmSetting.SEARCH_INCLUDES_SPAM,ZmSetting.SEARCH_INCLUDES_TRASH,ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES,ZmSetting.SHOW_SEARCH_STRING,ZmSetting.SHOW_SELECTION_CHECKBOX,ZmSetting.SKIN_NAME,ZmSetting.CLIENT_TYPE,ZmSetting.DEFAULT_TIMEZONE,ZmSetting.DEFAULT_PRINTFONTSIZE,ZmSetting.OFFLINE_IS_MAILTO_HANDLER,ZmSetting.SHORT_ADDRESS,ZmSetting.OFFLINE_UPDATE_NOTIFY]},ACCOUNTS:{icon:"Accounts",title:appCtxt.isOffline?ZmMsg.personas:ZmMsg.accounts,templateId:"prefs.Pages#Accounts",priority:9,precondition:ZmSetting.MAIL_PREFERENCES_ENABLED,prefs:[ZmSetting.ACCOUNTS,ZmSetting.SAVE_TO_SENT_DELEGATED_TARGET],manageDirty:true,createView:function(w,x,p){return new ZmAccountsPage(w,x,p) | |
}},FILTERS:{icon:"MailRule",title:ZmMsg.filterRules,templateId:"prefs.Pages#MailFilters",priority:50,precondition:[ZmSetting.MAIL_PREFERENCES_ENABLED,ZmSetting.FILTERS_ENABLED],prefs:[ZmSetting.FILTERS],manageChanges:true,createView:function(w,x,p){return p.getFilterController(x).getFilterView() | |
}},SIGNATURES:{icon:"AddSignature",title:ZmMsg.signatures,templateId:"prefs.Pages#Signatures",priority:51,precondition:[ZmSetting.MAIL_PREFERENCES_ENABLED,ZmSetting.SIGNATURES_ENABLED],prefs:[ZmSetting.SIGNATURES,ZmSetting.SIGNATURE_STYLE,ZmSetting.SIGNATURE_ENABLED],manageDirty:true,createView:function(w,x,p){return new ZmSignaturesPage(w,x,p) | |
}},OUTOFOFFICE:{icon:"OutOfOffice",title:ZmMsg.outOfOffice,priority:55,templateId:"prefs.Pages#OutOfOffice",precondition:[ZmSetting.MAIL_PREFERENCES_ENABLED,ZmSetting.VACATION_MSG_FEATURE_ENABLED],prefs:[ZmSetting.START_DATE_ENABLED,ZmSetting.END_DATE_ENABLED,ZmSetting.VACATION_DURATION_ENABLED,ZmSetting.VACATION_DURATION_ALL_DAY,ZmSetting.VACATION_CALENDAR_ENABLED,ZmSetting.VACATION_FROM,ZmSetting.VACATION_FROM_TIME,ZmSetting.VACATION_MSG_ENABLED,ZmSetting.VACATION_MSG,ZmSetting.VACATION_EXTERNAL_MSG_ENABLED,ZmSetting.VACATION_EXTERNAL_MSG,ZmSetting.VACATION_EXTERNAL_TYPE,ZmSetting.VACATION_EXTERNAL_SUPPRESS,ZmSetting.VACATION_CALENDAR_TYPE,ZmSetting.VACATION_UNTIL,ZmSetting.VACATION_UNTIL_TIME],manageDirty:true,createView:function(w,x,p){AjxDispatcher.require("Alert"); | |
return new ZmMailPrefsPage(w,x,p) | |
}},TRUSTED_ADDR:{title:ZmMsg.trustedAddrs,icon:"TrustedAddresses",templateId:"prefs.Pages#Trusted",priority:60,precondition:ZmSetting.MAIL_PREFERENCES_ENABLED,createView:function(w,x,p){return new ZmTrustedPage(w,x,p,"Prefs_Pages_TrustedAddresses") | |
},manageDirty:true,prefs:[ZmSetting.TRUSTED_ADDR_LIST]},SHARING:{title:ZmMsg.sharing,icon:"SharedContact",templateId:"prefs.Pages#SharingPrefPage",priority:85,precondition:ZmSetting.SHARING_ENABLED,manageChanges:true,createView:function(w,x,p){AjxDispatcher.require("Share"); | |
return new ZmSharingPage(w,x,p,"Prefs_Pages_Sharing") | |
}},NOTIFICATIONS:{title:ZmMsg.notifications,icon:"ApptReminder",templateId:"prefs.Pages#Notifications",priority:88,precondition:[ZmSetting.CALENDAR_ENABLED,ZmSetting.TASKS_ENABLED],preconditionAny:true,prefs:[ZmSetting.CAL_EMAIL_REMINDERS_ADDRESS,ZmSetting.CAL_DEVICE_EMAIL_REMINDERS_ADDRESS],createView:function(w,x,p){return new ZmNotificationsPage(w,x,p) | |
}},MOBILE:{title:ZmMsg.connectedDevicesAndApps,icon:"Mobile",templateId:"prefs.Pages#MobileDevices",priority:90,precondition:ZmSetting.MOBILE_SYNC_ENABLED,manageChanges:true,createView:function(w,x,p){return new ZmMobileDevicesPage(w,x,p) | |
}},IMPORT_EXPORT:{title:ZmMsg.importExport,icon:"SendReceive",templateId:"data.ImportExport#ImportExportPrefPage",priority:100,precondition:[ZmSetting.IMPORT_ENABLED,ZmSetting.EXPORT_ENABLED],preconditionAny:true,prefs:[ZmSetting.IMPORT_FOLDER,ZmSetting.IMPORT_BUTTON,ZmSetting.EXPORT_FOLDER,ZmSetting.EXPORT_BUTTON],manageChanges:true,createView:function(w,x,p){AjxDispatcher.require("ImportExport"); | |
return new ZmImportExportPage(w,x,p) | |
}},SHORTCUTS:{title:ZmMsg.shortcuts,icon:"Shortcut",templateId:"prefs.Pages#Shortcuts",priority:120,precondition:ZmSetting.USE_KEYBOARD_SHORTCUTS,createView:function(w,x,p){return new ZmShortcutsPage(w,x,p) | |
}},PREF_ZIMLETS:{title:ZmMsg.zimlets,icon:"Zimlet",templateId:"prefs.Pages#Zimlets",manageDirty:true,priority:140,precondition:ZmSetting.CHECKED_ZIMLETS_ENABLED,prefs:[ZmSetting.CHECKED_ZIMLETS,ZmSetting.OFFLINE_ZIMLET_SYNC_ACCOUNT_ID],createView:function(w,x,p){return new ZmZimletsPage(w,x,p) | |
}}}; | |
if(appCtxt.isOffline){r.BACKUP={title:ZmMsg.offlineBackups,icon:"backup",manageDirty:true,templateId:"prefs.Pages#BackUp",priority:130,prefs:[ZmSetting.OFFLINE_BACKUP_NOW_BUTTON,ZmSetting.OFFLINE_BACKUP_INTERVAL,ZmSetting.OFFLINE_BACKUP_PATH,ZmSetting.OFFLINE_BACKUP_KEEP,ZmSetting.OFFLINE_BACKUP_ACCOUNT_ID,ZmSetting.OFFLINE_BACKUP_RESTORE],createView:function(w,x,p){return new ZmBackupPage(w,x,p) | |
}} | |
}if(appCtxt.get(ZmSetting.CHAT_FEATURE_ENABLED)){ZmPref.registerPref("CHAT_ENABLED",{displayName:ZmMsg.chatFeatureStatus,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.chatFeatureEnabled,ZmMsg.chatFeatureDisabled],options:[true,false]}); | |
ZmPref.registerPref("CHAT_PLAY_SOUND",{displayName:ZmMsg.chatPlaySound,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
r.CHAT={title:ZmMsg.chat,icon:"Conversation",templateId:"prefs.Pages#Chat",priority:65,prefs:[ZmSetting.CHAT_ENABLED,ZmSetting.CHAT_PLAY_SOUND]} | |
}for(var s in r){ZmPref.registerPrefSection(s,r[s]) | |
}ZmPref.registerPref("CLIENT_TYPE",{displayName:ZmMsg.clientType,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.clientAdvanced,ZmMsg.clientStandard],options:[ZmSetting.CLIENT_ADVANCED,ZmSetting.CLIENT_STANDARD]}); | |
ZmPref.registerPref("COMPOSE_AS_FORMAT",{displayName:ZmMsg.composeUsing,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.composeAsHTML,ZmMsg.composeAsText],options:[ZmSetting.COMPOSE_HTML,ZmSetting.COMPOSE_TEXT],precondition:ZmSetting.HTML_COMPOSE_ENABLED,inputId:["COMPOSE_AS_HTML","COMPOSE_AS_TEXT"]}); | |
ZmPref.registerPref("COMPOSE_INIT_FONT_COLOR",{displayOptions:["rgb(0, 0, 0)"],displayContainer:ZmPref.TYPE_COLOR,precondition:ZmSetting.HTML_COMPOSE_ENABLED}); | |
var g=[],n=[]; | |
for(var v in ZmPref.FONT_FAMILY){var l=ZmPref.FONT_FAMILY[v]; | |
g.push(l.value); | |
n.push(l.name) | |
}ZmPref.registerPref("COMPOSE_INIT_FONT_FAMILY",{displayName:ZmMsg.defaultFontSettings,displayContainer:ZmPref.TYPE_SELECT,displayOptions:n,options:g,precondition:[ZmSetting.HTML_COMPOSE_ENABLED,ZmSetting.NOTEBOOK_ENABLED],preconditionAny:true,approximateFunction:function(p){if(AjxUtil.indexOf(g,p)!=-1){return p | |
}return ZmPref._normalizeFontId(p) | |
}}); | |
var h=[8,9,10,11,12,13,14,16,18,24,36,48],c=AjxUtil.map(h,function(p){return AjxMessageFormat.format(ZmMsg.pt,p) | |
}),e=AjxUtil.map(h,function(p){return p+"pt" | |
}); | |
var t=function(){var x=appCtxt.accountList.visibleAccounts; | |
var w=[]; | |
w.push(ZmMsg.zimletPrefDontSync); | |
for(var p=0; | |
p<x.length; | |
p++){if(x[p].isZimbraAccount&&!x[p].isMain){w.push([ZmMsg.zimletPrefSyncWith," ",x[p].name].join("")) | |
}}return w | |
}; | |
var i=function(){var x=appCtxt.accountList.visibleAccounts; | |
var w=[]; | |
w.push(""); | |
for(var p=0; | |
p<x.length; | |
p++){if(x[p].isZimbraAccount&&!x[p].isMain){w.push(x[p].id) | |
}}return w | |
}; | |
ZmPref.registerPref("COMPOSE_INIT_FONT_SIZE",{displayName:null,displayContainer:ZmPref.TYPE_SELECT,displayOptions:c,options:e,precondition:ZmSetting.HTML_COMPOSE_ENABLED}); | |
ZmPref.registerPref("COMPOSE_SAME_FORMAT",{displayName:ZmMsg.replyForwardInSameFormat,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CHECKED_ZIMLETS",{displayName:ZmMsg.zimlets,displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("OFFLINE_ZIMLET_SYNC_ACCOUNT_ID",{displayName:ZmMsg.zimletSyncPref,displayContainer:ZmPref.TYPE_SELECT,displayOptions:t(),options:i()}); | |
ZmPref.registerPref("DEFAULT_TIMEZONE",{displayName:ZmMsg.selectTimezone,displayContainer:ZmPref.TYPE_SELECT,displayParams:{layout:DwtMenu.LAYOUT_SCROLL,maxRows:ZmPref.MAX_ROWS},displayOptions:AjxTimezone.getZonePreferences(),options:AjxTimezone.getZonePreferencesOptions()}); | |
ZmPref.registerPref("DEFAULT_PRINTFONTSIZE",{displayName:ZmMsg.printFontSizePref,displayContainer:ZmPref.TYPE_SELECT,displayOptions:c,options:e}); | |
ZmPref.registerPref("EXPORT_FOLDER",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("EXPORT_BUTTON",{displayName:ZmMsg._export,displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("FORWARD_INCLUDE_WHAT",{displayName:ZmMsg.forwardInclude,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.includeInBody,ZmMsg.includeOriginalAsAttach],options:[ZmSetting.INC_BODY,ZmSetting.INC_ATTACH],setFunction:ZmPref.setIncludeOrig,initFunction:ZmPref.initIncludeWhat,changeFunction:ZmPref.onChangeIncludeWhat}); | |
ZmPref.registerPref("FORWARD_USE_PREFIX",{displayName:ZmMsg.usePrefix,displayContainer:ZmPref.TYPE_CHECKBOX,setFunction:ZmPref.setIncludeOrig}); | |
ZmPref.registerPref("FORWARD_INCLUDE_HEADERS",{displayName:ZmMsg.includeHeaders,displayContainer:ZmPref.TYPE_CHECKBOX,setFunction:ZmPref.setIncludeOrig}); | |
ZmPref.registerPref("IMPORT_FOLDER",{loadFunction:ZmPref.loadCsvFormats,displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("IMPORT_BUTTON",{displayName:ZmMsg._import,displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("LOCALE_NAME",{displayName:ZmMsg.selectLanguage,displayContainer:ZmPref.TYPE_LOCALES,precondition:ZmSetting.LOCALE_CHANGE_ENABLED}); | |
ZmPref.registerPref("COMPOSE_INIT_DIRECTION",{displayName:ZmMsg.composeDirectionLabel,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.directionLTR,ZmMsg.directionRTL],options:[ZmSetting.LTR,ZmSetting.RTL]}); | |
ZmPref.registerPref("SHOW_COMPOSE_DIRECTION_BUTTONS",{displayName:ZmMsg.showDirectionButtons,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("FONT_NAME",{displayName:ZmMsg.selectFong,displayContainer:ZmPref.TYPE_FONT}); | |
ZmPref.registerPref("FONT_SIZE",{displayName:ZmMsg.selectFontSize,displayContainer:ZmPref.TYPE_FONT_SIZE}); | |
var b=AjxMessageFormat.format(ZmMsg.messageReadTime,DwtId.makeId(ZmId.WIDGET_INPUT,ZmId.OP_MARK_READ)); | |
ZmPref.registerPref("MARK_MSG_READ",{displayName:ZmMsg.messageReadLabel,displayContainer:ZmPref.TYPE_RADIO_GROUP,displayFunction:ZmPref.markMsgReadDisplay,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.messageReadNow,b,ZmMsg.messageReadNone],options:[ZmSetting.MARK_READ_NOW,ZmSetting.MARK_READ_TIME,ZmSetting.MARK_READ_NONE],valueFunction:ZmPref.markMsgReadValue}); | |
ZmPref.registerPref("NEW_WINDOW_COMPOSE",{displayName:ZmMsg.composeInNewWin,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:[ZmSetting.MAIL_ENABLED,ZmSetting.DETACH_COMPOSE_ENABLED]}); | |
ZmPref.registerPref("MAIL_MANDATORY_SPELLCHECK",{displayName:ZmMsg.mandatorySpellcheck,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("PAGE_SIZE",{displayContainer:ZmPref.TYPE_SELECT,displayOptions:["25","50","100","200"]}); | |
ZmPref.registerPref("PASSWORD",{displayName:ZmMsg.changePassword,displayContainer:ZmPref.TYPE_PASSWORD,precondition:ZmSetting.CHANGE_PASSWORD_ENABLED}); | |
ZmPref.registerPref("SHARING",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("SHORT_ADDRESS",{displayName:ZmMsg.shortAddress,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
if(appCtxt.isOffline){ZmPref.registerPref("OFFLINE_IS_MAILTO_HANDLER",{displayName:ZmMsg.offlineAllowMailTo,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("OFFLINE_BACKUP_ACCOUNT_ID",{displayName:ZmMsg.offlineBackUpAccounts,displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("OFFLINE_BACKUP_RESTORE",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("OFFLINE_BACKUP_NOW_BUTTON",{displayName:ZmMsg.offlineBackUpButton,displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("OFFLINE_BACKUP_INTERVAL",{displayName:ZmMsg.offlineBackUpInterval,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.pollNever,ZmMsg.everyDay,ZmMsg.everyWeek,ZmMsg.everyMonth],options:[0,86400000,604800000,2628000000]}); | |
ZmPref.registerPref("OFFLINE_BACKUP_PATH",{displayName:ZmMsg.offlineBackUpPath,displayContainer:ZmPref.TYPE_INPUT}); | |
ZmPref.registerPref("OFFLINE_BACKUP_KEEP",{displayName:ZmMsg.offlineBackUpKeep,displayContainer:ZmPref.TYPE_SELECT,displayOptions:["1","2","3","4","5"]}); | |
ZmPref.registerPref("OFFLINE_UPDATE_NOTIFY",{displayName:ZmMsg.offlineUpdateNotify,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.offlineUpdateRelease,ZmMsg.offlineUpdateBeta],options:["release","beta"]}) | |
}var j=525600; | |
var k=10; | |
var d=[j]; | |
var m=[ZmMsg.pollManually]; | |
var u=appCtxt.get(ZmSetting.INSTANT_NOTIFY)?true:false; | |
if(u){d.push(appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL)); | |
m.push(ZmMsg.pollInstant) | |
}var o=ZmPref.pollingIntervalDisplay(appCtxt.get(ZmSetting.MIN_POLLING_INTERVAL)); | |
o=(o<1)?1:Math.round(o); | |
var a=ZmPref.pollingIntervalDisplay(appCtxt.get(ZmSetting.POLLING_INTERVAL)); | |
a=Math.round(a); | |
while(o<=k){d.push(o); | |
o++ | |
}o=o-1; | |
var f=d.length; | |
while(f<k){o=o+5; | |
d.push(o); | |
f++ | |
}if(a>o&&a!=j&&(u&&a!=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL))){var q=a%5; | |
q=(q==0)?a:((a/5+1)*5); | |
d.push(q) | |
}else{o=o+5; | |
d.push(o) | |
}while(m.length<=f){m.push(ZmMsg.pollEveryNMinutes) | |
}ZmPref.registerPref("POLLING_INTERVAL",{displayName:ZmMsg.pollingInterval,displayContainer:ZmPref.TYPE_SELECT,displayOptions:m,options:d,approximateFunction:ZmPref.approximateInterval,displayFunction:ZmPref.pollingIntervalDisplay,valueFunction:ZmPref.pollingIntervalValue,validationFunction:ZmPref.validatePollingInterval}); | |
ZmPref.registerPref("REPLY_INCLUDE_WHAT",{displayName:ZmMsg.replyInclude,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.dontInclude,ZmMsg.includeInBody,ZmMsg.smartInclude,ZmMsg.includeOriginalAsAttach],options:[ZmSetting.INC_NONE,ZmSetting.INC_BODY,ZmSetting.INC_SMART,ZmSetting.INC_ATTACH],setFunction:ZmPref.setIncludeOrig,initFunction:ZmPref.initIncludeWhat,changeFunction:ZmPref.onChangeIncludeWhat}); | |
ZmPref.registerPref("REPLY_USE_PREFIX",{displayName:ZmMsg.usePrefix,displayContainer:ZmPref.TYPE_CHECKBOX,setFunction:ZmPref.setIncludeOrig}); | |
ZmPref.registerPref("REPLY_INCLUDE_HEADERS",{displayName:ZmMsg.includeHeaders,displayContainer:ZmPref.TYPE_CHECKBOX,setFunction:ZmPref.setIncludeOrig}); | |
ZmPref.registerPref("REPLY_PREFIX",{displayName:ZmMsg.prefix,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:[">","|"]}); | |
ZmPref.registerPref("SAVE_TO_SENT",{displayName:ZmMsg.saveToSent,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.MAIL_ENABLED,changeFunction:AjxCallback.simpleClosure(ZmPref.onChangeConfirm,null,ZmMsg.saveToSentWarning,ZmPref.getSendToFiltersActive,true,new AjxCallback(null,ZmPref.setFormValue,["SAVE_TO_SENT",true]))}); | |
ZmPref.registerPref("SAVE_TO_SENT_DELEGATED_TARGET",{displayName:ZmMsg.saveToSentDelegatedTarget,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.saveToSentDelegatedOwner,ZmMsg.saveToSentDelegatedSender,ZmMsg.saveToSentDelegatedBoth,ZmMsg.saveToSentDelegatedNone],options:["owner","sender","both","none"],precondition:ZmSetting.MAIL_ENABLED}); | |
ZmPref.registerPref("SEARCH_INCLUDES_SHARED",{displayName:ZmMsg.includeSharedItems,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.SHARING_ENABLED}); | |
ZmPref.registerPref("SEARCH_INCLUDES_SPAM",{displayName:ZmMsg.includeJunkFolder,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:[ZmSetting.MAIL_ENABLED,ZmSetting.SPAM_ENABLED]}); | |
ZmPref.registerPref("SEARCH_INCLUDES_TRASH",{displayName:ZmMsg.includeTrashFolder,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:[ZmSetting.MAIL_ENABLED,ZmSetting.CONTACTS_ENABLED],preconditionAny:true}); | |
ZmPref.registerPref("SHOW_FRAGMENTS",{displayName:ZmMsg.showFragments,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("COLOR_MESSAGES",{displayName:ZmMsg.colorMessages,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
if(appCtxt.isOffline){ZmPref.registerPref("OFFLINE_SHOW_ALL_MAILBOXES",{displayName:ZmMsg.showAllMailboxes,displayContainer:ZmPref.TYPE_CHECKBOX}) | |
}ZmPref.registerPref("SHOW_SEARCH_STRING",{displayName:ZmMsg.showSearchString,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("SHOW_SELECTION_CHECKBOX",{displayName:ZmMsg.showSelectionString,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("SKIN_NAME",{displayName:ZmMsg.selectSkin,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[],options:[],loadFunction:ZmPref.loadSkins,precondition:ZmSetting.SKIN_CHANGE_ENABLED}); | |
ZmPref.registerPref("VIEW_AS_HTML",{displayName:ZmMsg.displayMail,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.displayAsHTML,ZmMsg.displayAsText],options:[true,false]}) | |
}; | |
ZmPreferencesApp.prototype._handleLoadLaunch=function(b){var a=new AjxCallback(this,this._handleResponseLaunch,[b]); | |
appCtxt.getSettings().loadPreferenceData(a) | |
}; | |
ZmPreferencesApp.prototype._handleResponseLaunch=function(a){AjxDispatcher.run("GetPrefController").show(); | |
if(a){a.run() | |
}}; | |
ZmPreferencesApp.prototype._getSharingView=function(){var a=this.getPreferencesPage("SHARING"); | |
return(a&&a.view) | |
}; | |
ZmPreferencesApp.prototype.getPreferencesPage=function(c){if(!this._prefController){return null | |
}var b=this.getPrefController(); | |
var a=b&&b.getPrefsView(); | |
return a&&a.getView(c) | |
}; | |
ZmPreferencesApp.prototype._getOverviewParams=function(){var a=ZmApp.prototype._getOverviewParams.call(this); | |
a.omit={}; | |
a.omit[ZmOrganizer.ID_ZIMLET]=true; | |
a.actionSupported=false; | |
return a | |
}; | |
ZmPreferencesApp.getFilterRulesController=function(a){var c=AjxDispatcher.run("GetPrefController"); | |
if(c&&c.getPrefsView()){var b=c.getFilterController(); | |
return a?b.getOutgoingFilterRulesController():b.getIncomingFilterRulesController() | |
}return null | |
}; | |
ZmPreferencesApp.prototype.getNewButtonProps=function(){return{hidden:true} | |
} | |
}if(AjxPackage.define("zimbraMail.portal.ZmPortalApp")){ZmPortalApp=function(b,a){ZmApp.call(this,ZmApp.PORTAL,b,a) | |
}; | |
ZmPortalApp.prototype=new ZmApp; | |
ZmPortalApp.prototype.constructor=ZmPortalApp; | |
ZmPortalApp.prototype.toString=function(){return"ZmPortalApp" | |
}; | |
ZmPortalApp.prototype._registerApp=function(){ZmApp.registerApp(ZmApp.PORTAL,{nameKey:"portal",icon:"Globe",chooserTooltipKey:"goToPortal",button:ZmAppChooser.B_PORTAL,chooserSort:1,defaultSort:1}) | |
}; | |
ZmApp.PORTAL=ZmId.APP_PORTAL; | |
ZmApp.CLASS[ZmApp.PORTAL]="ZmPortalApp"; | |
ZmApp.SETTING[ZmApp.PORTAL]=ZmSetting.PORTAL_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.PORTAL]=1; | |
ZmApp.QS_ARG[ZmApp.PORTAL]="home"; | |
ZmEvent.S_PORTLET="PORTLET"; | |
ZmItem.PORTLET=ZmEvent.S_PORTLET; | |
ZmPortalApp.__PORTLET_ID=0; | |
ZmPortalApp.prototype.refreshPortlets=function(){var b=this.getPortletMgr(); | |
var a=b.getPortlets(); | |
for(var c in a){a[c].refresh() | |
}}; | |
ZmPortalApp.prototype.launch=function(b,c){var a=new AjxCallback(this,this._handleLoadLaunch,[b,c]); | |
AjxDispatcher.require("Portal",true,a,null,true) | |
}; | |
ZmPortalApp.prototype._handleLoadLaunch=function(b,c){var a=this.getPortalController(); | |
a.show(); | |
ZmApp.prototype.launch.call(this,b,c) | |
}; | |
ZmPortalApp.prototype.activate=function(b){var a=this.getPortalController(); | |
a.setPaused(!b); | |
ZmApp.prototype.activate.call(this,b) | |
}; | |
ZmPortalApp.prototype.getManifest=function(e){if(!this._manifest){var c=appCtxt.get(ZmSetting.PORTAL_NAME); | |
if(c){var b=new Date().getTime(); | |
var d={url:[window.appContextPath,"/portals/",c,"/manifest.xml?v=",b].join(""),callback:e?new AjxCallback(this,this._handleLoadManifest,[e]):null}; | |
var a=AjxLoader.load(d); | |
if(!e){this._handleLoadManifest(e,a) | |
}}}else{if(e){e.run(this._manifest) | |
}}return this._manifest | |
}; | |
ZmPortalApp.prototype._handleLoadManifest=function(j,g){var d; | |
if(g.status==200&&g.responseXML){try{var k=new AjxJsonSerializer(true).serialize(g.responseXML); | |
this._manifest=JSON.parse(k); | |
var c=this._manifest.portal; | |
var b=c&&c.portlets; | |
if(b&&!(b.portlet instanceof Array)){b.portlet=[b.portlet] | |
}c.portlets=b.portlet; | |
if(c.portlets){for(var a=0; | |
a<c.portlets.length; | |
a++){var h=c.portlets[a]; | |
var f=h.property; | |
if(f&&!(f instanceof Array)){f=[f] | |
}h.properties=f; | |
delete h.property | |
}}}catch(d){}}else{d="" | |
}if(!this._manifest){this._manifest={error:d} | |
}if(j){j.run(this._manifest) | |
}}; | |
ZmPortalApp.prototype.getPortalController=function(){AjxDispatcher.require("Portal"); | |
if(!this._portalController){this._portalController=new ZmPortalController(this._container,this) | |
}return this._portalController | |
}; | |
ZmPortalApp.prototype.getPortletMgr=function(){AjxDispatcher.require("Portal"); | |
if(!this._portletMgr){this._portletMgr=new ZmPortletMgr() | |
}return this._portletMgr | |
}; | |
ZmPortalApp.prototype._getOverviewTrees=function(){return this._getOverviewApp()._getOverviewTrees() | |
}; | |
ZmPortalApp.prototype._getOverviewApp=function(){if(!this._overviewApp){var d=[]; | |
for(var b in ZmApp.CHOOSER_SORT){d.push({name:b,sort:ZmApp.CHOOSER_SORT[b]}) | |
}d.sort(ZmPortalApp.__BY_SORT); | |
var a=null; | |
for(var c=0; | |
c<d.length; | |
c++){var e=d[c]; | |
if(e.name==this._name){continue | |
}if(appCtxt.getApp(e.name).isIframe){continue | |
}a=e.name; | |
break | |
}this._overviewApp=appCtxt.getApp(a) | |
}return this._overviewApp | |
}; | |
ZmPortalApp.__BY_SORT=function(d,c){return d.sort-c.sort | |
} | |
}if(AjxPackage.define("zimbraMail.mail.ZmMailApp")){ZmMailApp=function(b,a){ZmApp.call(this,ZmApp.MAIL,b,a); | |
this._dataSourceCollection={}; | |
this._identityCollection={}; | |
this._signatureCollection={}; | |
this.numEntries=0; | |
this.globalMailCount=0; | |
this._throttleStats=[]; | |
this._addSettingsChangeListeners(); | |
AjxCore.addOnloadListener(this._checkVacationReplyEnabled.bind(this)) | |
}; | |
ZmMailApp.prototype=new ZmApp; | |
ZmMailApp.prototype.constructor=ZmMailApp; | |
ZmMailApp.prototype.isZmMailApp=true; | |
ZmMailApp.prototype.toString=function(){return"ZmMailApp" | |
}; | |
ZmEvent.S_CONV=ZmId.ITEM_CONV; | |
ZmEvent.S_MSG=ZmId.ITEM_MSG; | |
ZmEvent.S_ATT=ZmId.ITEM_ATT; | |
ZmEvent.S_FOLDER=ZmId.ORG_FOLDER; | |
ZmEvent.S_DATA_SOURCE=ZmId.ITEM_DATA_SOURCE; | |
ZmEvent.S_IDENTITY="IDENTITY"; | |
ZmEvent.S_SIGNATURE="SIGNATURE"; | |
ZmItem.CONV=ZmEvent.S_CONV; | |
ZmItem.MSG=ZmEvent.S_MSG; | |
ZmItem.ATT=ZmEvent.S_ATT; | |
ZmItem.DATA_SOURCE=ZmEvent.S_DATA_SOURCE; | |
ZmOrganizer.FOLDER=ZmEvent.S_FOLDER; | |
ZmApp.MAIL=ZmId.APP_MAIL; | |
ZmApp.CLASS[ZmApp.MAIL]="ZmMailApp"; | |
ZmApp.SETTING[ZmApp.MAIL]=ZmSetting.MAIL_ENABLED; | |
ZmApp.UPSELL_SETTING[ZmApp.MAIL]=ZmSetting.MAIL_UPSELL_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.MAIL]=20; | |
ZmApp.QS_ARG[ZmApp.MAIL]="mail"; | |
ZmMailApp.DEFAULT_AUTO_SAVE_DRAFT_INTERVAL=15; | |
ZmMailApp.AUTO_SAVE_IDLE_TIME=3; | |
ZmMailApp.DEFAULT_MAX_MESSAGE_SIZE=250000; | |
ZmMailApp.POP_DOWNLOAD_SINCE_ALL=0; | |
ZmMailApp.POP_DOWNLOAD_SINCE_NO_CHANGE=1; | |
ZmMailApp.POP_DOWNLOAD_SINCE_FROM_NOW=2; | |
ZmMailApp.POP_DELETE_OPTION_KEEP="keep"; | |
ZmMailApp.POP_DELETE_OPTION_READ="read"; | |
ZmMailApp.POP_DELETE_OPTION_TRASH="trash"; | |
ZmMailApp.POP_DELETE_OPTION_HARD_DELETE="delete"; | |
ZmMailApp.SEND_RECEIPT_NEVER="never"; | |
ZmMailApp.SEND_RECEIPT_ALWAYS="always"; | |
ZmMailApp.SEND_RECEIPT_PROMPT="prompt"; | |
ZmMailApp.INC_MAP={}; | |
ZmMailApp.INC_MAP[ZmSetting.INC_NONE]=[ZmSetting.INC_NONE,false,false]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_ATTACH]=[ZmSetting.INC_ATTACH,false,false]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_BODY]=[ZmSetting.INC_BODY,false,true]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_BODY_ONLY]=[ZmSetting.INC_BODY,false,false]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_BODY_PRE]=[ZmSetting.INC_BODY,true,false]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_BODY_HDR]=[ZmSetting.INC_BODY,false,true]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_BODY_PRE_HDR]=[ZmSetting.INC_BODY,true,true]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_SMART]=[ZmSetting.INC_SMART,false,false]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_SMART_PRE]=[ZmSetting.INC_SMART,true,false]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_SMART_HDR]=[ZmSetting.INC_SMART,false,true]; | |
ZmMailApp.INC_MAP[ZmSetting.INC_SMART_PRE_HDR]=[ZmSetting.INC_SMART,true,true]; | |
ZmMailApp.INC_MAP_REV={}; | |
AjxUtil.foreach(ZmMailApp.INC_MAP,function(a,c){var b=(c==ZmSetting.INC_NONE||c==ZmSetting.INC_ATTACH)?a[0]:a.join("|"); | |
ZmMailApp.INC_MAP_REV[b]=c | |
}); | |
ZmMailApp.GROUP_MAIL_BY_ITEM={}; | |
ZmMailApp.GROUP_MAIL_BY_ITEM[ZmSetting.GROUP_BY_CONV]=ZmItem.CONV; | |
ZmMailApp.GROUP_MAIL_BY_ITEM[ZmSetting.GROUP_BY_MESSAGE]=ZmItem.MSG; | |
ZmMailApp.prototype._defineAPI=function(){AjxDispatcher.setPackageLoadFunction("MailCore",new AjxCallback(this,this._postLoadCore)); | |
AjxDispatcher.setPackageLoadFunction("Mail",new AjxCallback(this,this._postLoad,ZmOrganizer.FOLDER)); | |
AjxDispatcher.registerMethod("Compose",["MailCore","Mail"],new AjxCallback(this,this.compose)); | |
AjxDispatcher.registerMethod("GetComposeController",["MailCore","Mail"],new AjxCallback(this,this.getComposeController)); | |
AjxDispatcher.registerMethod("GetConvController",["MailCore","Mail"],new AjxCallback(this,this.getConvController)); | |
AjxDispatcher.registerMethod("GetConvListController",["MailCore","Mail"],new AjxCallback(this,this.getConvListController)); | |
AjxDispatcher.registerMethod("GetMsgController",["MailCore","Mail"],new AjxCallback(this,this.getMsgController)); | |
AjxDispatcher.registerMethod("GetTradController",["MailCore","Mail"],new AjxCallback(this,this.getTradController)); | |
AjxDispatcher.registerMethod("GetMailListController","MailCore",new AjxCallback(this,this.getMailListController)); | |
AjxDispatcher.registerMethod("GetIdentityCollection","MailCore",new AjxCallback(this,this.getIdentityCollection)); | |
AjxDispatcher.registerMethod("GetSignatureCollection","MailCore",new AjxCallback(this,this.getSignatureCollection)); | |
AjxDispatcher.registerMethod("GetDataSourceCollection","MailCore",new AjxCallback(this,this.getDataSourceCollection)); | |
AjxDispatcher.registerMethod("GetMailConfirmController",["MailCore","Mail"],new AjxCallback(this,this.getConfirmController)) | |
}; | |
ZmMailApp.prototype._registerSettings=function(a){var a=a||appCtxt.getSettings(); | |
a.registerSetting("ALLOW_ANY_FROM_ADDRESS",{name:"zimbraAllowAnyFromAddress",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("AUTO_READ_RECEIPT_ENABLED",{name:"zimbraPrefMailRequestReadReceipts",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("AUTO_SAVE_DRAFT_INTERVAL",{name:"zimbraPrefAutoSaveDraftInterval",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LDAP_TIME,defaultValue:ZmMailApp.DEFAULT_AUTO_SAVE_DRAFT_INTERVAL,isGlobal:true}); | |
a.registerSetting("COLLAPSE_IMAP_TREES",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("COLOR_MESSAGES",{name:"zimbraPrefColorMessagesEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("COMPOSE_SAME_FORMAT",{name:"zimbraPrefForwardReplyInOriginalFormat",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CONVERSATIONS_ENABLED",{name:"zimbraFeatureConversationsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("CONVERSATION_ORDER",{name:"zimbraPrefConversationOrder",type:ZmSetting.T_PREF,defaultValue:ZmSearch.DATE_DESC,isImplicit:true}); | |
a.registerSetting("CONVERSATION_PAGE_SIZE",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:250,isGlobal:true}); | |
a.registerSetting("CONV_SHOW_CALENDAR",{name:"zimbraPrefConvShowCalendar",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}); | |
a.registerSetting("DEDUPE_MSG_TO_SELF",{name:"zimbraPrefDedupeMessagesSentToSelf",type:ZmSetting.T_PREF,defaultValue:ZmSetting.DEDUPE_NONE}); | |
a.registerSetting("DEDUPE_MSG_ENABLED",{name:"zimbraPrefMessageIdDedupingEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("DEFAULT_DISPLAY_NAME",{type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("DETACH_COMPOSE_ENABLED",{name:"zimbraFeatureComposeInNewWindowEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("DETACH_MAILVIEW_ENABLED",{name:"zimbraFeatureOpenMailInNewWindowEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("DISPLAY_EXTERNAL_IMAGES",{name:"zimbraPrefDisplayExternalImages",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("END_DATE_ENABLED",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("FILTERS_ENABLED",{name:"zimbraFeatureFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("FILTERS_MAIL_FORWARDING_ENABLED",{name:"zimbraFeatureMailForwardingInFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("FORWARD_INCLUDE_HEADERS",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("FORWARD_INCLUDE_ORIG",{name:"zimbraPrefForwardIncludeOriginalText",type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}); | |
a.registerSetting("FORWARD_INCLUDE_WHAT",{type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}); | |
a.registerSetting("FORWARD_MENU_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("FORWARD_USE_PREFIX",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("GROUP_MAIL_BY",{name:"zimbraPrefGroupMailBy",type:ZmSetting.T_PREF,defaultValue:ZmSetting.GROUP_BY_MESSAGE,isImplicit:true,isGlobal:true}); | |
a.registerSetting("HIGHLIGHT_OBJECTS",{name:"zimbraMailHighlightObjectsMaxSize",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:70}); | |
a.registerSetting("HTML_SIGNATURE_ENABLED",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("IDENTITIES_ENABLED",{name:"zimbraFeatureIdentitiesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("INITIAL_SEARCH",{name:"zimbraPrefMailInitialSearch",type:ZmSetting.T_PREF,defaultValue:"in:inbox"}); | |
a.registerSetting("INITIAL_SEARCH_ENABLED",{name:"zimbraFeatureInitialSearchPreferenceEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("MAIL_ATTACH_VIEW_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("MAIL_BLACKLIST",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}); | |
a.registerSetting("TRUSTED_ADDR_LIST",{name:"zimbraPrefMailTrustedSenderList",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}); | |
a.registerSetting("TRUSTED_ADDR_LIST_MAX_NUM_ENTRIES",{name:"zimbraMailTrustedSenderListMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}); | |
a.registerSetting("MAIL_ACTIVITYSTREAM_FOLDER",{name:"zimbraMailActivityStreamFolder",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_INT,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
a.registerSetting("MAIL_BLACKLIST_MAX_NUM_ENTRIES",{name:"zimbraMailBlacklistMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}); | |
a.registerSetting("MAIL_FOLDER_COLORS_ENABLED",{name:"zimbraPrefFolderColorEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("MAIL_FORWARDING_ADDRESS",{name:"zimbraPrefMailForwardingAddress",type:ZmSetting.T_PREF}); | |
a.registerSetting("MAIL_FORWARDING_ENABLED",{name:"zimbraFeatureMailForwardingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("MAIL_MANDATORY_SPELLCHECK",{name:"zimbraPrefMandatorySpellCheckEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("MAIL_FROM_ADDRESS",{name:"zimbraPrefFromAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}); | |
a.registerSetting("MAIL_FROM_ADDRESS_TYPE",{name:"zimbraPrefFromAddressType",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"sendAs"}); | |
a.registerSetting("MAIL_LIFETIME_GLOBAL",{name:"zimbraMailMessageLifetime",type:ZmSetting.T_COS,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_INBOX_READ",{name:"zimbraPrefInboxReadLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_INBOX_UNREAD",{name:"zimbraPrefInboxUnreadLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_JUNK",{name:"zimbraPrefJunkLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_JUNK_GLOBAL",{name:"zimbraMailSpamLifetime",type:ZmSetting.T_COS,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_SENT",{name:"zimbraPrefSentLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_TRASH",{name:"zimbraPrefTrashLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}); | |
a.registerSetting("MAIL_LIFETIME_TRASH_GLOBAL",{name:"zimbraMailTrashLifetime",type:ZmSetting.T_COS,defaultValue:"0"}); | |
a.registerSetting("MAIL_LOCAL_DELIVERY_DISABLED",{name:"zimbraPrefMailLocalDeliveryDisabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("MAIL_NOTIFY_ALL",{name:"zimbraPrefShowAllNewMailNotifications",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("MAIL_NOTIFY_SOUNDS",{name:"zimbraPrefMailSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("MAIL_NOTIFY_APP",{name:"zimbraPrefMailFlashIcon",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("MAIL_NOTIFY_BROWSER",{name:"zimbraPrefMailFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("MAIL_NOTIFY_TOASTER",{name:"zimbraPrefMailToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("MAIL_PRIORITY_ENABLED",{name:"zimbraFeatureMailPriorityEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("MAIL_READ_RECEIPT_ENABLED",{name:"zimbraFeatureReadReceiptsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("MAIL_SEND_LATER_ENABLED",{name:"zimbraFeatureMailSendLaterEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("MAIL_SEND_READ_RECEIPTS",{name:"zimbraPrefMailSendReadReceipts",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"never"}); | |
a.registerSetting("MAIL_WHITELIST",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}); | |
a.registerSetting("MAIL_WHITELIST_MAX_NUM_ENTRIES",{name:"zimbraMailWhitelistMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}); | |
a.registerSetting("MARK_MSG_READ",{name:"zimbraPrefMarkMsgRead",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}); | |
a.registerSetting("MAX_MESSAGE_SIZE",{type:ZmSetting.T_PREF,defaultValue:ZmMailApp.DEFAULT_MAX_MESSAGE_SIZE}); | |
a.registerSetting("NEW_WINDOW_COMPOSE",{name:"zimbraPrefComposeInNewWindow",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("NOTIF_ADDRESS",{name:"zimbraPrefNewMailNotificationAddress",type:ZmSetting.T_PREF}); | |
a.registerSetting("NOTIF_ENABLED",{name:"zimbraPrefNewMailNotificationEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("NOTIF_FEATURE_ENABLED",{name:"zimbraFeatureNewMailNotificationEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("OPEN_MAIL_IN_NEW_WIN",{name:"zimbraPrefOpenMailInNewWindow",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("POP_ENABLED",{name:"zimbraPop3Enabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:!appCtxt.isOffline}); | |
a.registerSetting("POP_DOWNLOAD_SINCE_VALUE",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}); | |
a.registerSetting("POP_DOWNLOAD_SINCE",{name:"zimbraPrefPop3DownloadSince",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}); | |
a.registerSetting("POP_DELETE_OPTION",{name:"zimbraPrefPop3DeleteOption",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmMailApp.POP_DELETE_OPTION_HARD_DELETE}); | |
a.registerSetting("POP_INCLUDE_SPAM",{name:"zimbraPrefPop3IncludeSpam",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("READING_PANE_LOCATION",{name:"zimbraPrefReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true,isGlobal:true}); | |
a.registerSetting("READING_PANE_LOCATION_CV",{name:"zimbraPrefConvReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}); | |
a.registerSetting("READING_PANE_SASH_HORIZONTAL",{name:"zimbraPrefReadingPaneSashHorizontal",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_INT,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
a.registerSetting("READING_PANE_SASH_VERTICAL",{name:"zimbraPrefReadingPaneSashVertical",type:ZmSetting.T_METADATA,dataType:ZmSetting.D_INT,isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
a.registerSetting("REPLY_INCLUDE_HEADERS",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("REPLY_INCLUDE_ORIG",{name:"zimbraPrefReplyIncludeOriginalText",type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}); | |
a.registerSetting("REPLY_INCLUDE_WHAT",{type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}); | |
a.registerSetting("REPLY_MENU_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("REPLY_PREFIX",{name:"zimbraPrefForwardReplyPrefixChar",type:ZmSetting.T_PREF,defaultValue:">",isGlobal:true}); | |
a.registerSetting("REPLY_TO_ADDRESS",{name:"zimbraPrefReplyToAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}); | |
a.registerSetting("REPLY_TO_ENABLED",{name:"zimbraPrefReplyToEnabled",type:ZmSetting.T_PREF}); | |
a.registerSetting("REPLY_USE_PREFIX",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("SAVE_DRAFT_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("SAVE_TO_IMAP_SENT",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("SAVE_TO_SENT",{name:"zimbraPrefSaveToSent",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("SAVE_TO_SENT_DELEGATED_TARGET",{name:"zimbraPrefDelegatedSendSaveTarget",type:ZmSetting.T_PREF,defaultValue:"owner",isGlobal:true}); | |
a.registerSetting("SELECT_AFTER_DELETE",{name:"zimbraPrefMailSelectAfterDelete",type:ZmSetting.T_PREF,defaultValue:ZmSetting.DELETE_SELECT_NEXT,isGlobal:true}); | |
a.registerSetting("SENT_FOLDER_NAME",{name:"zimbraPrefSentMailFolder",type:ZmSetting.T_PREF,defaultValue:"sent"}); | |
a.registerSetting("SHOW_BCC",{type:ZmSetting.T_PREF,defaultValue:false}); | |
a.registerSetting("SHOW_FRAGMENTS",{name:"zimbraPrefShowFragments",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("SHOW_MAIL_CONFIRM",{name:"zimbraFeatureConfirmationPageEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("SHOW_CHATS_FOLDER",{name:"zimbraPrefShowChatsFolderInMail",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("SIGNATURE",{name:"zimbraPrefMailSignature",type:ZmSetting.T_PREF}); | |
a.registerSetting("SIGNATURE_ENABLED",{name:"zimbraPrefMailSignatureEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("SIGNATURE_STYLE",{name:"zimbraPrefMailSignatureStyle",type:ZmSetting.T_PREF,defaultValue:ZmSetting.SIG_OUTLOOK}); | |
a.registerSetting("START_DATE_ENABLED",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("TAB_IN_EDITOR",{name:"zimbraPrefTabInEditorEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("USE_SEND_MSG_SHORTCUT",{name:"zimbraPrefUseSendMsgShortcut",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("USER_FOLDERS_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("VACATION_DURATION_ENABLED",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("VACATION_DURATION_ALL_DAY",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("VACATION_FROM",{name:"zimbraPrefOutOfOfficeFromDate",type:ZmSetting.T_PREF,defaultValue:""}); | |
a.registerSetting("VACATION_FROM_TIME",{type:ZmSetting.T_PREF,defaultValue:""}); | |
a.registerSetting("VACATION_MSG",{name:"zimbraPrefOutOfOfficeReply",type:ZmSetting.T_PREF,defaultValue:""}); | |
a.registerSetting("VACATION_EXTERNAL_TYPE",{name:"zimbraPrefExternalSendersType",type:ZmSetting.T_PREF,defaultValue:"ALL"}); | |
a.registerSetting("VACATION_EXTERNAL_SUPPRESS",{name:"zimbraPrefOutOfOfficeSuppressExternalReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("VACATION_CALENDAR_TYPE",{name:"zimbraPrefOutOfOfficeFreeBusyStatus",type:ZmSetting.T_PREF,defaultValue:"OUTOFOFFICE"}); | |
a.registerSetting("VACATION_CALENDAR_APPT_ID",{name:"zimbraPrefOutOfOfficeCalApptID",type:ZmSetting.T_METADATA,defaultValue:"-1",isImplicit:true,section:ZmSetting.M_IMPLICIT}); | |
a.registerSetting("VACATION_CALENDAR_ENABLED",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("VACATION_EXTERNAL_MSG",{name:"zimbraPrefOutOfOfficeExternalReply",type:ZmSetting.T_PREF,defaultValue:""}); | |
a.registerSetting("VACATION_MSG_ENABLED",{name:"zimbraPrefOutOfOfficeReplyEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("VACATION_EXTERNAL_MSG_ENABLED",{name:"zimbraPrefOutOfOfficeExternalReplyEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("VACATION_MSG_REMIND_ON_LOGIN",{name:"zimbraPrefOutOfOfficeStatusAlertOnLogin",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("VACATION_MSG_FEATURE_ENABLED",{name:"zimbraFeatureOutOfOfficeReplyEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("VACATION_UNTIL",{name:"zimbraPrefOutOfOfficeUntilDate",type:ZmSetting.T_PREF,defaultValue:""}); | |
a.registerSetting("VACATION_UNTIL_TIME",{type:ZmSetting.T_PREF,defaultValue:""}) | |
}; | |
ZmMailApp.prototype._registerPrefs=function(){var c={MAIL:{title:ZmMsg.mail,icon:"MailApp",templateId:"prefs.Pages#Mail",priority:10,precondition:ZmSetting.MAIL_PREFERENCES_ENABLED,prefs:[ZmSetting.AUTO_READ_RECEIPT_ENABLED,ZmSetting.DEDUPE_MSG_TO_SELF,ZmSetting.DEDUPE_MSG_ENABLED,ZmSetting.DISPLAY_EXTERNAL_IMAGES,ZmSetting.DISPLAY_TIME_IN_MAIL_LIST,ZmSetting.GET_MAIL_ACTION,ZmSetting.INITIAL_SEARCH,ZmSetting.MAIL_BLACKLIST,ZmSetting.MAIL_FORWARDING_ADDRESS,ZmSetting.MAIL_LIFETIME_INBOX_READ,ZmSetting.MAIL_LIFETIME_INBOX_UNREAD,ZmSetting.MAIL_LIFETIME_JUNK,ZmSetting.MAIL_LIFETIME_SENT,ZmSetting.MAIL_LIFETIME_TRASH,ZmSetting.MAIL_LOCAL_DELIVERY_DISABLED,ZmSetting.MAIL_NOTIFY_SOUNDS,ZmSetting.MAIL_NOTIFY_ALL,ZmSetting.MAIL_NOTIFY_APP,ZmSetting.MAIL_NOTIFY_BROWSER,ZmSetting.MAIL_NOTIFY_TOASTER,ZmSetting.MAIL_WHITELIST,ZmSetting.MAIL_SEND_READ_RECEIPTS,ZmSetting.MARK_MSG_READ,ZmSetting.NOTIF_ADDRESS,ZmSetting.OFFLINE_NOTIFY_NEWMAIL_ON_INBOX,ZmSetting.OPEN_MAIL_IN_NEW_WIN,ZmSetting.PAGE_SIZE,ZmSetting.POP_DOWNLOAD_SINCE_VALUE,ZmSetting.POP_DOWNLOAD_SINCE,ZmSetting.POP_DELETE_OPTION,ZmSetting.POP_INCLUDE_SPAM,ZmSetting.POLLING_INTERVAL,ZmSetting.SELECT_AFTER_DELETE,ZmSetting.SHOW_FRAGMENTS,ZmSetting.COLOR_MESSAGES,ZmSetting.START_DATE_ENABLED,ZmSetting.VACATION_DURATION_ENABLED,ZmSetting.VACATION_DURATION_ALL_DAY,ZmSetting.VACATION_FROM,ZmSetting.VACATION_FROM_TIME,ZmSetting.VACATION_CALENDAR_ENABLED,ZmSetting.VACATION_MSG_ENABLED,ZmSetting.VACATION_MSG,ZmSetting.VACATION_EXTERNAL_MSG_ENABLED,ZmSetting.VACATION_EXTERNAL_MSG,ZmSetting.VACATION_EXTERNAL_TYPE,ZmSetting.VACATION_EXTERNAL_SUPPRESS,ZmSetting.VACATION_CALENDAR_TYPE,ZmSetting.VACATION_UNTIL,ZmSetting.VACATION_UNTIL_TIME,ZmSetting.VIEW_AS_HTML,ZmSetting.COMPOSE_AS_FORMAT,ZmSetting.COMPOSE_INIT_FONT_COLOR,ZmSetting.COMPOSE_INIT_FONT_FAMILY,ZmSetting.COMPOSE_INIT_FONT_SIZE,ZmSetting.FORWARD_INCLUDE_WHAT,ZmSetting.FORWARD_USE_PREFIX,ZmSetting.FORWARD_INCLUDE_HEADERS,ZmSetting.NEW_WINDOW_COMPOSE,ZmSetting.AUTO_SAVE_DRAFT_INTERVAL,ZmSetting.REPLY_INCLUDE_WHAT,ZmSetting.REPLY_USE_PREFIX,ZmSetting.REPLY_INCLUDE_HEADERS,ZmSetting.REPLY_PREFIX,ZmSetting.SAVE_TO_SENT,ZmSetting.TAB_IN_EDITOR,ZmSetting.USE_SEND_MSG_SHORTCUT,ZmSetting.COMPOSE_SAME_FORMAT,ZmSetting.MAIL_MANDATORY_SPELLCHECK],manageDirty:true,createView:function(e,f,d){AjxDispatcher.require("Alert"); | |
return new ZmMailPrefsPage(e,f,d) | |
}}}; | |
for(var b in c){ZmPref.registerPrefSection(b,c[b]) | |
}ZmPref.registerPref("ACCOUNTS",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("AUTO_SAVE_DRAFT_INTERVAL",{displayName:ZmMsg.autoSaveDrafts,displayContainer:ZmPref.TYPE_CHECKBOX,options:[0,ZmMailApp.DEFAULT_AUTO_SAVE_DRAFT_INTERVAL]}); | |
ZmPref.registerPref("AUTO_READ_RECEIPT_ENABLED",{displayName:ZmMsg.autoReadReceiptRequest,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("USE_SEND_MSG_SHORTCUT",{displayFunc:this.formatKeySeq.bind(this,AjxMessageFormat.format(ZmMsg.useSendMsgShortcut,[ZmKeys["compose.Send.display"]])),displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("DEDUPE_MSG_TO_SELF",{displayName:ZmMsg.removeDupesToSelf,displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.dedupeNone,ZmMsg.dedupeSecondCopy,ZmMsg.dedupeAll],options:[ZmSetting.DEDUPE_NONE,ZmSetting.DEDUPE_SECOND,ZmSetting.DEDUPE_ALL]}); | |
ZmPref.registerPref("DEDUPE_MSG_ENABLED",{displayName:ZmMsg.autoDeleteDedupeMsg,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("DISPLAY_EXTERNAL_IMAGES",{displayName:ZmMsg.showExternalImages,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("DISPLAY_TIME_IN_MAIL_LIST",{displayName:ZmMsg.displayTimeInMailList,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("END_DATE_ENABLED",{displayName:ZmMsg.endOn,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}); | |
ZmPref.registerPref("INITIAL_SEARCH",{displayName:ZmMsg.initialMailSearch,displayContainer:ZmPref.TYPE_INPUT,maxLength:ZmPref.MAX_LENGTH[ZmSetting.INITIAL_SEARCH],errorMessage:AjxMessageFormat.format(ZmMsg.invalidInitialSearch,ZmPref.MAX_LENGTH[ZmSetting.INITIAL_SEARCH]),precondition:ZmSetting.INITIAL_SEARCH_ENABLED}); | |
ZmPref.registerPref("MAIL_BLACKLIST",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("TRUSTED_ADDR_LIST",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("MAIL_FORWARDING_ADDRESS",{displayName:ZmMsg.mailForwardingAddress,displayContainer:ZmPref.TYPE_INPUT,validationFunction:ZmMailApp.validateForwardEmail,errorMessage:ZmMsg.invalidEmail,precondition:ZmSetting.MAIL_FORWARDING_ENABLED,hint:ZmMsg.enterEmailAddress}); | |
ZmPref.registerPref("MAIL_LIFETIME_INBOX_READ",{displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:[ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationNever],options:[30,45,60,90,120,0],approximateFunction:ZmPref.approximateLifetimeInboxRead,displayFunction:ZmPref.durationDay2Int,valueFunction:ZmPref.int2DurationDay,validationFunction:ZmPref.validateLifetime}); | |
ZmPref.registerPref("MAIL_LIFETIME_INBOX_UNREAD",{displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:[ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationNever],options:[30,45,60,90,120,0],approximateFunction:ZmPref.approximateLifetimeInboxUnread,displayFunction:ZmPref.durationDay2Int,valueFunction:ZmPref.int2DurationDay,validationFunction:ZmPref.validateLifetime}); | |
ZmPref.registerPref("MAIL_LIFETIME_JUNK",{displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:ZmMsg.lifetimeDurationDays,options:[1,3,7,30],approximateFunction:ZmPref.approximateLifetimeJunk,displayFunction:ZmPref.durationDay2Int,valueFunction:ZmPref.int2DurationDay,validationFunction:ZmPref.validateLifetimeJunk}); | |
ZmPref.registerPref("MAIL_LIFETIME_SENT",{displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:[ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationDays,ZmMsg.lifetimeDurationNever],options:[30,45,60,90,120,0],approximateFunction:ZmPref.approximateLifetimeSent,displayFunction:ZmPref.durationDay2Int,valueFunction:ZmPref.int2DurationDay,validationFunction:ZmPref.validateLifetime}); | |
ZmPref.registerPref("MAIL_LIFETIME_TRASH",{displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:ZmMsg.lifetimeDurationDays,options:[1,3,7,30],approximateFunction:ZmPref.approximateLifetimeTrash,displayFunction:ZmPref.durationDay2Int,valueFunction:ZmPref.int2DurationDay,validationFunction:ZmPref.validateLifetimeTrash}); | |
ZmPref.registerPref("MAIL_LOCAL_DELIVERY_DISABLED",{displayName:ZmMsg.mailDeliveryDisabled,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.MAIL_FORWARDING_ENABLED,validationFunction:ZmMailApp.validateMailLocalDeliveryDisabled,errorMessage:ZmMsg.errorMissingFwdAddr}); | |
ZmPref.registerPref("MAIL_NOTIFY_ALL",{displayName:ZmMsg.messageNotificationFoldersLabel,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.messageNotificationFoldersInbox,ZmMsg.messageNotificationFoldersAll],options:[false,true]}); | |
ZmPref.registerPref("MAIL_NOTIFY_SOUNDS",{displayName:ZmMsg.playSound,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("MAIL_NOTIFY_APP",{displayName:ZmMsg.flashMailAppTab,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("MAIL_NOTIFY_BROWSER",{displayName:ZmMsg.flashBrowser,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("MAIL_SEND_READ_RECEIPTS",{displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.readReceiptNever,ZmMsg.readReceiptAlways,ZmMsg.readReceiptAsk],options:[ZmMailApp.SEND_RECEIPT_NEVER,ZmMailApp.SEND_RECEIPT_ALWAYS,ZmMailApp.SEND_RECEIPT_PROMPT],precondition:ZmSetting.MAIL_READ_RECEIPT_ENABLED}); | |
ZmPref.registerPref("MAIL_WHITELIST",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("NOTIF_ADDRESS",{displayName:ZmMsg.mailNotifAddress,displayContainer:ZmPref.TYPE_INPUT,validationFunction:ZmPref.validateEmail,errorMessage:ZmMsg.invalidEmail,precondition:ZmSetting.NOTIF_FEATURE_ENABLED,hint:ZmMsg.enterEmailAddress,setFunction:ZmPref.setMailNotificationAddressValue}); | |
ZmPref.registerPref("OPEN_MAIL_IN_NEW_WIN",{displayName:ZmMsg.openMailNewWin,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.DETACH_MAILVIEW_ENABLED}); | |
ZmPref.registerPref("POP_DOWNLOAD_SINCE_VALUE",{displayContainer:ZmPref.TYPE_STATIC,precondition:ZmSetting.POP_ENABLED}); | |
ZmPref.registerPref("POP_DOWNLOAD_SINCE",{displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.externalAccessPopDownloadAll,"*** NOT SHOWN ***",ZmMsg.externalAccessPopDownloadFromNow],options:[ZmMailApp.POP_DOWNLOAD_SINCE_ALL,ZmMailApp.POP_DOWNLOAD_SINCE_NO_CHANGE,ZmMailApp.POP_DOWNLOAD_SINCE_FROM_NOW],displayFunction:ZmPref.downloadSinceDisplay,valueFunction:ZmPref.downloadSinceValue,precondition:ZmSetting.POP_ENABLED}); | |
ZmPref.registerPref("POP_DELETE_OPTION",{displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.popDeleteHardDelete,ZmMsg.popDeleteTrash,ZmMsg.popDeleteRead,ZmMsg.popDeleteKeep],options:[ZmMailApp.POP_DELETE_OPTION_HARD_DELETE,ZmMailApp.POP_DELETE_OPTION_TRASH,ZmMailApp.POP_DELETE_OPTION_READ,ZmMailApp.POP_DELETE_OPTION_KEEP],precondition:ZmSetting.POP_ENABLED}); | |
ZmPref.registerPref("POP_INCLUDE_SPAM",{displayName:ZmMsg.popIncludeSpam,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("REPLY_TO_ADDRESS",{displayName:ZmMsg.replyToAddress,displayContainer:ZmPref.TYPE_INPUT,validationFunction:ZmPref.validateEmail,errorMessage:ZmMsg.invalidEmail}); | |
ZmPref.registerPref("SELECT_AFTER_DELETE",{displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.selectNext,ZmMsg.selectPrevious,ZmMsg.selectAdapt],options:[ZmSetting.DELETE_SELECT_NEXT,ZmSetting.DELETE_SELECT_PREV,ZmSetting.DELETE_SELECT_ADAPT]}); | |
ZmPref.registerPref("SIGNATURE",{displayName:ZmMsg.signature,displayContainer:ZmPref.TYPE_TEXTAREA,maxLength:ZmPref.MAX_LENGTH[ZmSetting.SIGNATURE],errorMessage:AjxMessageFormat.format(ZmMsg.invalidSignature,ZmPref.MAX_LENGTH[ZmSetting.SIGNATURE])}); | |
ZmPref.registerPref("SIGNATURE_ENABLED",{displayName:ZmMsg.signatureEnabled,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("SIGNATURE_STYLE",{displayName:ZmMsg.signatureStyle,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_HORIZONTAL,displayOptions:[ZmMsg.aboveQuotedText,ZmMsg.atBottomOfMessage],options:[ZmSetting.SIG_OUTLOOK,ZmSetting.SIG_INTERNET]}); | |
ZmPref.registerPref("SIGNATURES",{displayContainer:ZmPref.TYPE_CUSTOM,initFunction:ZmPref.regenerateSignatureEditor}); | |
ZmPref.registerPref("START_DATE_ENABLED",{displayContainer:ZmPref.TYPE_CHECKBOX,displayName:ZmMsg.startOn,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}); | |
ZmPref.registerPref("TAB_IN_EDITOR",{displayName:ZmMsg.tabInEditor,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("VACATION_DURATION_ENABLED",{displayContainer:ZmPref.TYPE_CHECKBOX,displayName:ZmMsg.oooDurationLabel,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}); | |
ZmPref.registerPref("VACATION_DURATION_ALL_DAY",{displayContainer:ZmPref.TYPE_CHECKBOX,displayName:ZmMsg.oooAllDayDurationLabel,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}); | |
ZmPref.registerPref("VACATION_CALENDAR_ENABLED",{displayContainer:ZmPref.TYPE_CHECKBOX,displayName:ZmMsg.vacationCalLabel,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}); | |
ZmPref.registerPref("VACATION_FROM",{displayName:ZmMsg.startDate,displayContainer:ZmPref.TYPE_INPUT,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,displayFunction:AjxDateUtil.dateGMT2Local,valueFunction:AjxDateUtil.dateLocal2GMT}); | |
ZmPref.registerPref("VACATION_UNTIL",{displayName:ZmMsg.endDate,displayContainer:ZmPref.TYPE_INPUT,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,displayFunction:AjxDateUtil.dateGMT2Local,valueFunction:AjxDateUtil.dateLocal2GMT}); | |
ZmPref.registerPref("VACATION_MSG",{displayName:ZmMsg.awayMessage,displayContainer:ZmPref.TYPE_TEXTAREA,maxLength:ZmPref.MAX_LENGTH[ZmSetting.AWAY_MESSAGE],errorMessage:AjxMessageFormat.format(ZmMsg.invalidAwayMessage,ZmPref.MAX_LENGTH[ZmSetting.AWAY_MESSAGE]),precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,validationFunction:ZmMailApp.validateVacationMsg}); | |
ZmPref.registerPref("VACATION_MSG_ENABLED",{displayName:ZmMsg.outOfOffice,displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,errorMessage:ZmMsg.missingAwayMessage,displayOptions:[ZmMsg.noAutoReplyMessage,ZmMsg.autoReplyMessage],options:[false,true],inputId:["VACATION_MSG_DISABLED","VACATION_MSG_ENABLED"]}); | |
ZmPref.registerPref("VACATION_EXTERNAL_TYPE",{}); | |
ZmPref.registerPref("VACATION_EXTERNAL_SUPPRESS",{displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.vacationExternalAllStandard,ZmMsg.vacationExternalAllCustom,ZmMsg.vacationExternalAllExceptABCustom,ZmMsg.vacationExternalReplySuppress],options:[false,false,false,true],initFunction:ZmPref.initOOOVacationExternalSuppress,setFunction:ZmPref.addOOOVacationExternalPrefOnSave,changeFunction:ZmPref.handleOOOVacationExternalOptionChange,validationFunction:ZmMailApp.validateExternalVacationMsg,errorMessage:ZmMsg.missingAwayMessage}); | |
ZmPref.registerPref("VACATION_CALENDAR_TYPE",{displayName:ZmMsg.vacationExternalType,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.outOfOffice,ZmMsg.busy],options:["OUTOFOFFICE","BUSY"]}); | |
ZmPref.registerPref("VACATION_EXTERNAL_MSG",{displayName:ZmMsg.externalAwayMessage,displayContainer:ZmPref.TYPE_TEXTAREA,maxLength:ZmPref.MAX_LENGTH[ZmSetting.AWAY_MESSAGE],precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}); | |
ZmPref.registerPref("VACATION_EXTERNAL_MSG_ENABLED",{}); | |
AjxDispatcher.require("Alert"); | |
var a=ZmDesktopAlert.getInstance().getDisplayText(); | |
ZmPref.registerPref("MAIL_NOTIFY_TOASTER",{displayFunc:function(){return a | |
},precondition:!!a,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
if(appCtxt.isOffline){ZmPref.registerPref("OFFLINE_NOTIFY_NEWMAIL_ON_INBOX",{displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.notifyNewMailOnInbox,ZmMsg.notifyNewMailOnAny],options:[true,false]}) | |
}}; | |
ZmMailApp.prototype.formatKeySeq=function(a){new ZmShortcutList({cols:[]}); | |
return ZmShortcutList._formatDisplay(a) | |
}; | |
ZmMailApp.validateForwardEmail=function(b){if(!b||b==""){var d=ZmPref.getPrefSectionWithPref(ZmSetting.MAIL_FORWARDING_ADDRESS); | |
if(!d){return false | |
}var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView(); | |
var c=a.getView(d.id).getFormObject(ZmSetting.MAIL_LOCAL_DELIVERY_DISABLED); | |
if(c&&c.isSelected()){c.setSelected(false) | |
}}return ZmPref.validateEmail(b) | |
}; | |
ZmMailApp.validateMailLocalDeliveryDisabled=function(c){if(!c){return true | |
}var d=ZmPref.getPrefSectionWithPref(ZmSetting.MAIL_FORWARDING_ADDRESS); | |
if(!d){return false | |
}var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView(); | |
var b=a.getView(d.id).getFormObject(ZmSetting.MAIL_FORWARDING_ADDRESS); | |
return(b!=null&&b.isValid()) | |
}; | |
ZmMailApp.validateVacationMsg=function(c){if(c&&(c.length>0)){return true | |
}var e=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG_ENABLED); | |
if(!e){return false | |
}var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView(); | |
var b=a.getView(e.id).getFormObject(ZmSetting.VACATION_MSG_ENABLED); | |
var d=(b&&!(b.getSelectedValue()=="true")); | |
if(!d){ZmPref.SETUP.VACATION_MSG.errorMessage=ZmMsg.missingAwayMessage | |
}return d | |
}; | |
ZmMailApp.validateVacationMsgEnabled=function(c){if(!c){return true | |
}var e=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG); | |
if(!e){return false | |
}var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView(); | |
var b=a.getView(e.id).getFormObject(ZmSetting.VACATION_MSG); | |
if(!b){return false | |
}var d=b.getValue(); | |
return(d&&(d.length>0)) | |
}; | |
ZmMailApp.validateExternalVacationMsg=function(){var d=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG_ENABLED); | |
if(!d){return false | |
}var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView().getView(d.id); | |
var b=a.getFormObject(ZmSetting.VACATION_MSG_ENABLED); | |
if(b&&b.getSelectedValue()==="false"){return true | |
}var g=a.getFormObject(ZmSetting.VACATION_EXTERNAL_SUPPRESS); | |
var f=g.getText(); | |
if(f.indexOf(ZmMsg.vacationExternalAllStandard)>=0||f.indexOf(ZmMsg.vacationExternalReplySuppress)>=0){return true | |
}var e=a.getFormObject(ZmSetting.VACATION_EXTERNAL_MSG); | |
var c=e.getValue(); | |
return(c&&(c.length>0)) | |
}; | |
ZmMailApp.validateExternalVacationMsgEnabled=function(c){if(!c){return true | |
}var e=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_EXTERNAL_MSG); | |
if(!e){return false | |
}var a=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView(); | |
var b=a.getView(e.id).getFormObject(ZmSetting.VACATION_EXTERNAL_MSG); | |
if(!b){return false | |
}var d=b.getValue(); | |
return(d&&(d.length>0)) | |
}; | |
ZmMailApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_ADD_FILTER_RULE,{textKey:"createFilter",image:"Plus"},ZmSetting.FILTERS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_ADD_TO_FILTER_RULE,{textKey:"addToFilter",image:"MailRule"},ZmSetting.FILTERS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_ADD_SIGNATURE,{textKey:"signature",image:"AddSignature",tooltipKey:"chooseSignature"},ZmSetting.SIGNATURES_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_CHECK_MAIL,{textKey:"checkMail",tooltipKey:"checkMailPrefDefault",image:"Refresh",textPrecedence:90,showImageInToolbar:true}); | |
ZmOperation.registerOp(ZmId.OP_CREATE_APPT,{textKey:"createAppt",image:"NewAppointment"},ZmSetting.CALENDAR_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_CREATE_TASK,{textKey:"createTask",image:"NewTask"},ZmSetting.TASKS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_DELETE_CONV,{textKey:"delConv",image:"DeleteConversation"},ZmSetting.CONVERSATIONS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_DELETE_MSG,{textKey:"delMsg",image:"DeleteMessage"}); | |
ZmOperation.registerOp(ZmId.OP_DELETE_MENU,{textKey:"del",image:"Delete",tooltipKey:"deleteTooltip"}); | |
ZmOperation.registerOp(ZmId.OP_DETACH_COMPOSE,{tooltipKey:"detachComposeTooltip",image:"OpenInNewWindow"}); | |
ZmOperation.registerOp(ZmId.OP_DRAFT,null,ZmSetting.SAVE_DRAFT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_EDIT_FILTER_RULE,{textKey:"filterEdit",image:"Edit"},ZmSetting.FILTERS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_FORWARD,{textKey:"forward",tooltipKey:"forwardTooltip",image:"Forward",shortcut:ZmKeyMap.FORWARD,textPrecedence:46}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_ATT,{textKey:"forwardAtt",tooltipKey:"forwardAtt",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_CONV,{textKey:"forwardConv",tooltipKey:"forwardConv",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_INLINE,{textKey:"forwardInline",tooltipKey:"forwardTooltip",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_INC_ATTACHMENT,{textKey:"includeMenuAttachment"}); | |
ZmOperation.registerOp(ZmId.OP_INC_BODY,{textKey:"includeMenuBody"}); | |
ZmOperation.registerOp(ZmId.OP_INC_NONE,{textKey:"includeMenuNone"}); | |
ZmOperation.registerOp(ZmId.OP_INC_SMART,{textKey:"includeMenuSmart"}); | |
ZmOperation.registerOp(ZmId.OP_INCLUDE_HEADERS,{textKey:"includeHeaders"}); | |
ZmOperation.registerOp(ZmId.OP_KEEP_READING,{textKey:"keepReading",tooltipKey:"keepReadingTooltip",shortcut:ZmKeyMap.KEEP_READING}); | |
ZmOperation.registerOp(ZmId.OP_MARK_READ,{textKey:"markAsRead",image:"ReadMessage",shortcut:ZmKeyMap.MARK_READ}); | |
ZmOperation.registerOp(ZmId.OP_MARK_UNREAD,{textKey:"markAsUnread",image:"UnreadMessage",shortcut:ZmKeyMap.MARK_UNREAD}); | |
ZmOperation.registerOp(ZmId.OP_FLAG,{textKey:"flag",image:"FlagRed",shortcut:ZmKeyMap.FLAG},ZmSetting.FLAGGING_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_UNFLAG,{textKey:"unflag",image:"FlagDis",shortcut:ZmKeyMap.FLAG},ZmSetting.FLAGGING_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_MOVE_DOWN_FILTER_RULE,{textKey:"filterMoveDown",image:"DownArrow"},ZmSetting.FILTERS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_MOVE_TO_BCC,{textKey:"moveToBcc"}); | |
ZmOperation.registerOp(ZmId.OP_MOVE_TO_CC,{textKey:"moveToCc"}); | |
ZmOperation.registerOp(ZmId.OP_MOVE_TO_TO,{textKey:"moveToTo"}); | |
ZmOperation.registerOp(ZmId.OP_MOVE_UP_FILTER_RULE,{textKey:"filterMoveUp",image:"UpArrow"},ZmSetting.FILTERS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_NEW_MESSAGE,{textKey:"newEmail",tooltipKey:"newMessageTooltip",image:"NewMessage",shortcut:ZmKeyMap.NEW_MESSAGE}); | |
ZmOperation.registerOp(ZmId.OP_NEW_MESSAGE_WIN,{textKey:"newEmail",tooltipKey:"newMessageTooltip",image:"NewMessage",shortcut:ZmKeyMap.NEW_MESSAGE_WIN}); | |
ZmOperation.registerOp(ZmId.OP_PRIORITY_HIGH,{textKey:"priorityHigh",image:"PriorityHigh_list"}); | |
ZmOperation.registerOp(ZmId.OP_PRIORITY_LOW,{textKey:"priorityLow",image:"PriorityLow_list"}); | |
ZmOperation.registerOp(ZmId.OP_PRIORITY_NORMAL,{textKey:"priorityNormal",image:"PriorityNormal_list"}); | |
ZmOperation.registerOp(ZmId.OP_REMOVE_FILTER_RULE,{textKey:"filterRemove",image:"Delete"},ZmSetting.FILTERS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_REDIRECT,{textKey:"mailRedirect",tooltipKey:"mailRedirectTooltip",image:"Redirect"}); | |
ZmOperation.registerOp(ZmId.OP_REPLY,{textKey:"reply",tooltipKey:"replyTooltip",image:"Reply",shortcut:ZmKeyMap.REPLY,textPrecedence:50}); | |
ZmOperation.registerOp(ZmId.OP_REPLY_ALL,{textKey:"replyAll",tooltipKey:"replyAllTooltip",image:"ReplyAll",shortcut:ZmKeyMap.REPLY_ALL,textPrecedence:48}); | |
ZmOperation.registerOp(ZmId.OP_REQUEST_READ_RECEIPT,{textKey:"requestReadReceipt",image:"ReadMessage"}); | |
ZmOperation.registerOp(ZmId.OP_RESET,{textKey:"reset",image:"Refresh",tooltipKey:"refreshFilters"}); | |
ZmOperation.registerOp(ZmId.OP_RUN_FILTER_RULE,{textKey:"filterRun",image:"SwitchFormat"},[ZmSetting.MAIL_ENABLED,ZmSetting.FILTERS_ENABLED]); | |
ZmOperation.registerOp(ZmId.OP_SAVE_DRAFT,{textKey:"saveDraft",tooltipKey:"saveDraftTooltip",image:"DraftFolder",shortcut:ZmKeyMap.SAVE},ZmSetting.SAVE_DRAFT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SEND_MENU,{textKey:"send",tooltipKey:"sendTooltip",image:"Send"},ZmSetting.SAVE_DRAFT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SEND_LATER,{textKey:"sendLater",tooltipKey:"sendLaterTooltip",image:"SendLater"},ZmSetting.SAVE_DRAFT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SHOW_BCC,{textKey:"showBcc"}); | |
ZmOperation.registerOp(ZmId.OP_SHOW_CONV,{textKey:"showConv",image:"Conversation"},ZmSetting.CONVERSATIONS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SHOW_ORIG,{textKey:"showOrig",image:"Message"}); | |
ZmOperation.registerOp(ZmId.OP_SPAM,{textKey:"junkLabel",tooltipKey:"junkTooltip",image:"JunkMail",shortcut:ZmKeyMap.SPAM,textPrecedence:70},ZmSetting.SPAM_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_USE_PREFIX,{textKey:"usePrefix"}) | |
}; | |
ZmMailApp.prototype._registerItems=function(){ZmItem.registerItem(ZmItem.CONV,{app:ZmApp.MAIL,nameKey:"conversation",icon:"Conversation",soapCmd:"ConvAction",itemClass:"ZmConv",node:"c",organizer:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.TAG,ZmOrganizer.ZIMLET],searchType:"conversation",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("MailCore"); | |
return new ZmMailList(ZmItem.CONV,a) | |
},this)}); | |
ZmItem.registerItem(ZmItem.MSG,{app:ZmApp.MAIL,nameKey:"message",icon:"Message",soapCmd:"MsgAction",itemClass:"ZmMailMsg",node:"m",organizer:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.TAG,ZmOrganizer.ZIMLET],searchType:"message",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("MailCore"); | |
return new ZmMailList(ZmItem.MSG,a) | |
},this)}); | |
ZmItem.registerItem(ZmItem.ATT,{app:ZmApp.MAIL,nameKey:"attachment",icon:"Attachment",itemClass:"ZmMimePart",node:"mp",resultsList:AjxCallback.simpleClosure(function(a){return new ZmMailList(ZmItem.ATT,a) | |
},this)}) | |
}; | |
ZmMailApp.prototype._setupSearchToolbar=function(){if(appCtxt.get(ZmSetting.MAIL_ENABLED)){ZmSearchToolBar.addMenuItem(ZmId.SEARCH_MAIL,{msgKey:"mail",tooltipKey:"searchMail",icon:"Message",shareIcon:"SharedMailFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_MAIL)}) | |
}}; | |
ZmMailApp.prototype._registerApp=function(){var b={}; | |
b[ZmOperation.NEW_MESSAGE]="message"; | |
var a={}; | |
a[ZmKeyMap.NEW_MESSAGE]=ZmOperation.NEW_MESSAGE; | |
a[ZmKeyMap.NEW_MESSAGE_WIN]=ZmOperation.NEW_MESSAGE_WIN; | |
ZmApp.registerApp(ZmApp.MAIL,{mainPkg:"MailCore",nameKey:"mail",icon:"MailApp",textPrecedence:70,chooserTooltipKey:"goToMail",viewTooltipKey:"displayMailToolTip",defaultSearch:appCtxt.isChildWindow?null:ZmId.SEARCH_MAIL,organizer:ZmOrganizer.FOLDER,overviewTrees:[ZmOrganizer.FOLDER,ZmOrganizer.SEARCH,ZmOrganizer.TAG],searchTypes:[ZmItem.MSG,ZmItem.CONV],newItemOps:b,actionCodes:a,gotoActionCode:ZmKeyMap.GOTO_MAIL,newActionCode:ZmKeyMap.NEW_MESSAGE,qsViews:["compose","msg"],chooserSort:10,defaultSort:10,upsellUrl:ZmSetting.MAIL_UPSELL_URL,searchResultsTab:true}) | |
}; | |
ZmMailApp.prototype.startup=function(a){}; | |
ZmMailApp.prototype.preNotify=function(o){if(!(o.deleted&&o.created&&o.modified)){return o | |
}var g=false; | |
var h=o.deleted.id&&o.deleted.id.split(","); | |
var r={}; | |
var k=[]; | |
if(h&&h.length){for(var A=0; | |
A<h.length; | |
A++){var v=h[A]; | |
var s=ZmOrganizer.normalizeId(v); | |
if(s<0){r[s]=true; | |
g=true | |
}else{k.push(v) | |
}}}if(!g){return o | |
}var p=false; | |
var q={}; | |
var l={}; | |
for(var F in o.created){var B=o.created[F]; | |
if(B&&B.length){for(var A=0; | |
A<B.length; | |
A++){var m=B[A]; | |
var v=m.id; | |
var d=(F=="m")?"|cid="+m.cid+"|l="+m.l:"|n="+m.n; | |
AjxDebug.println(AjxDebug.NOTIFY,F+": id="+v+"|su='"+m.su+"'|f="+m.f+"|d="+m.d+d); | |
if(F=="m"){q[v]=m | |
}else{if(F=="c"&&(m.n>1)){l[v]=m; | |
p=true | |
}}}}}if(!p){return o | |
}var y=false; | |
var z={}; | |
var n={}; | |
var B=o.modified.m; | |
if(B&&B.length){for(var A=0; | |
A<B.length; | |
A++){var E=B[A]; | |
var v=E.id; | |
var s=ZmOrganizer.normalizeId(v); | |
var b=s*-1; | |
if(r[b]&&l[E.cid]){y=true; | |
n[v]=E; | |
z[E.cid]=appCtxt.multiAccounts?ZmOrganizer.getSystemId(b):b; | |
l[E.cid]._wasVirtConv=true; | |
var f=appCtxt.getById(v),a; | |
if(f){f.cid=E.cid; | |
a=f.folderId | |
}l[E.cid].m=[{id:v,l:a}] | |
}}}if(!y){return o | |
}if(k.length){o.deleted.id=k.join(",") | |
}else{delete o.deleted | |
}var D=[]; | |
var B=o.created.c; | |
if(B&&B.length){for(var A=0; | |
A<B.length; | |
A++){var m=B[A]; | |
var C=l[m.id]; | |
if(!(C&&C._wasVirtConv)){D.push(m) | |
}}}if(D&&D.length){o.created.c=D | |
}else{delete o.created.c | |
}for(var v in q){var t=q[v]; | |
var u=l[t.cid]; | |
if(u&&u._wasVirtConv){t._convCreateNode=u | |
}}var w=[]; | |
for(var j in z){var x=l[j]; | |
x.id=z[j]; | |
x._newId=j; | |
w.push(x) | |
}if(w.length){var e={}; | |
e.c=w; | |
appCtxt.getRequestMgr()._handleModifies(e) | |
}}; | |
ZmMailApp.prototype.createNotify=function(e,g){if(!e.m&&!e.c&&!e.link){return | |
}if(!g&&!this._noDefer&&this._deferNotifications("create",e)){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: skipping/deferring notifications"); | |
return | |
}if(e.link){var f=e.link; | |
for(var d=0; | |
d<f.length; | |
d++){var c=f[d]; | |
if(appCtxt.cacheGet(c.id)){continue | |
}this._handleCreateLink(c,ZmOrganizer.FOLDER) | |
}}var h=this.getAllControllers(); | |
var b=this._getCurrentViewController(); | |
if(b&&h[h.length-1]!==b){AjxUtil.arrayRemove(h,b); | |
h.push(b) | |
}for(var d=0; | |
d<h.length; | |
d++){var a=h[d]; | |
if(a&&a.isZmDoublePaneController){this._checkList(e,a.getList(),a,d==h.length-1) | |
}}this._handleAlerts(e) | |
}; | |
ZmMailApp.prototype._handleAlerts=function(q){var a=q.m||[]; | |
if(a.length==0){return | |
}AjxDispatcher.require("Alert"); | |
var r=appCtxt.getActiveAccount(); | |
var b,p,g=false; | |
var k=0; | |
for(var o=0; | |
o<a.length; | |
o++){var t=a[o]; | |
var e=(t&&t.f&&(t.f.indexOf(ZmItem.FLAG_UNREAD)!=-1))?ZmOrganizer.parseId(t.l):null; | |
var d=e&&e.account; | |
if(!d||(d&&d.isOfflineInitialSync())){continue | |
}if(appCtxt.isOffline&&e&&!d.isMain){var l=(appCtxt.get(ZmSetting.OFFLINE_NOTIFY_NEWMAIL_ON_INBOX))?(e.id==ZmOrganizer.ID_INBOX):(e.id!=ZmOrganizer.ID_SPAM&&e.id!=ZmOrganizer.ID_TRASH); | |
if(l){this.globalMailCount++; | |
d.inNewMailMode=true; | |
var u=appCtxt.getOverviewController()._overviewContainer; | |
for(var n in u){u[n].updateAccountInfo(d,true,true) | |
}}}if(appCtxt.get(ZmSetting.MAIL_NOTIFY_ALL)||(e&&e.id==ZmOrganizer.ID_INBOX)){if(appCtxt.accountList.size()>1){ZmAccountAlert.get(d).start(this) | |
}if(!b&&d==r&&appCtxt.get(ZmSetting.MAIL_NOTIFY_APP,null,d)){this.startAlert(); | |
b=true | |
}if(!p&&appCtxt.get(ZmSetting.MAIL_NOTIFY_SOUNDS,null,d)){ZmSoundAlert.getInstance().start(); | |
p=true | |
}if(!g&&appCtxt.get(ZmSetting.MAIL_NOTIFY_BROWSER,null,d)){ZmBrowserAlert.getInstance().start(ZmMsg.newMessage); | |
g=true | |
}if(appCtxt.get(ZmSetting.MAIL_NOTIFY_TOASTER,null,d)&&k<5){var c=appCtxt.getById(t.id)||ZmMailMsg.createFromDom(t,{}); | |
var f=(c.subject)?([c.subject," - ",(c.fragment||"")].join("")):(c.fragment||""); | |
var m=c.getAddress(AjxEmailAddress.FROM); | |
var h=(m&&m instanceof AjxEmailAddress)?m.getName()||m.getAddress():(m&&typeof m=="string")?m:ZmMsg.unknown; | |
var s=(appCtxt.accountList.size()>1)?AjxMessageFormat.format(ZmMsg.newMailWithAccount,[h,d.getDisplayName()]):AjxMessageFormat.format(ZmMsg.newMail,h); | |
ZmDesktopAlert.getInstance().start(s,f); | |
k++ | |
}}}}; | |
ZmMailApp.prototype._checkList=function(f,e,d,i){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: handling mail creates for view "+d.getCurrentViewId()); | |
if(!(e&&e instanceof ZmMailList)){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: list is not a ZmMailList: "+e); | |
return | |
}var c={}; | |
var g={}; | |
var h=e.search.sortBy; | |
var a=this._checkType(f,ZmItem.CONV,c,e,h,null,i); | |
var b=this._checkType(f,ZmItem.MSG,g,e,h,c,i); | |
if(a.gotMail||b.gotMail){e.notifyCreate(c,g) | |
}if(a.hasMore||b.hasMore){var d=this._getCurrentViewController(); | |
if(d){d.setHasMore(true) | |
}}}; | |
ZmMailApp.prototype._getCurrentViewController=function(){var b; | |
var a=appCtxt.getCurrentViewType(); | |
if(a==ZmId.VIEW_CONVLIST){b=this.getConvListController() | |
}else{if(a==ZmId.VIEW_TRAD){b=this.getTradController() | |
}}return b | |
}; | |
ZmMailApp.prototype._checkType=function(creates,type,items,currList,sortBy,convs,last){var result={gotMail:false,hasMore:false}; | |
var nodeName=ZmList.NODE[type]; | |
var list=creates[nodeName]; | |
if(!(list&&list.length)){return result | |
}var throttle; | |
if(appCtxt.isOffline){throttle=(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES))?appCtxt.accountList.isInitialSyncing():appCtxt.getActiveAccount().isOfflineInitialSync() | |
}if(throttle){if(!this._maxEntries){var mlv=this.getMailListController().getCurrentView().getMailListView(); | |
this._maxEntries=mlv&&mlv.calculateMaxEntries() | |
}if(this.numEntries>this._maxEntries){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: too many creates: num="+this.numEntries+", max="+this._maxEntries); | |
return result | |
}}var INTERVAL_LENGTH=10*1000; | |
var INTERVAL_THRESHOLD=20; | |
for(var i=0; | |
i<list.length; | |
i++){var create=list[i]; | |
var folder=create.l||"conv"; | |
var now=new Date(); | |
var data=this._throttleStats[folder]; | |
if(!data||now.getTime()-data.intervalStart.getTime()>INTERVAL_LENGTH){data=this._throttleStats[folder]={intervalStart:now,count:0} | |
}data.count++; | |
if(data.count>INTERVAL_THRESHOLD){if(data.count==INTERVAL_THRESHOLD+1){}result.hasMore=true; | |
continue | |
}AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: process create notification:"); | |
var extra=(type==ZmItem.MSG)?"|cid="+create.cid+"|l="+create.l:"|n="+create.n; | |
AjxDebug.println(AjxDebug.NOTIFY,type+": id="+create.id+"|su='"+create.su+"'|f="+create.f+"|d="+create.d+extra); | |
if(create._handled){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: create already handled "+create.id); | |
continue | |
}if(last){create._handled=true | |
}if(currList.type==ZmItem.MSG&&type==ZmItem.CONV){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: msg list ignoring conv create"); | |
continue | |
}if(appCtxt.isOffline){if((ZmList.ITEM_TYPE[nodeName]!=currList.type)&&(currList.type!=ZmItem.CONV)){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: type mismatch: "+ZmList.ITEM_TYPE[nodeName]+" / "+currList.type); | |
continue | |
}}if(throttle&&this.numEntries>this._maxEntries){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: throttling"); | |
result.hasMore=true; | |
break | |
}var item=appCtxt.getById(create.id); | |
if(!item){AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: create "+type+" object "+create.id); | |
var itemClass=eval(ZmList.ITEM_CLASS[type]); | |
item=itemClass.createFromDom(create,{list:currList}) | |
}else{if(item.type==ZmItem.MSG){var conv=appCtxt.getById(item.cid); | |
if(conv){conv.folders[item.folderId]=true | |
}}}items[item.id]=item; | |
result.gotMail=true | |
}return result | |
}; | |
ZmMailApp.prototype.modifyNotify=function(b,a){if(!b.m&&!b.c){return | |
}if(!a&&!this._noDefer&&this._deferNotifications("modify",b)){return | |
}this._batchNotify(b.m); | |
this._batchNotify(b.c) | |
}; | |
ZmMailApp.prototype.postNotify=function(a){var b=this._checkReplenishListView; | |
if(b&&!b._isPageless){b._checkReplenish(); | |
this._checkReplenishListView=null | |
}}; | |
ZmMailApp.prototype.refresh=function(g){var f=appCtxt.getById(ZmFolder.ID_INBOX); | |
if(f){this.setNewMailNotice(f) | |
}if(!appCtxt.inStartup){this.resetOverview(this.getOverviewId()); | |
var e=[ZmId.VIEW_TRAD,ZmId.VIEW_CONVLIST,ZmId.VIEW_CONV]; | |
var a=appCtxt.getAppViewMgr(); | |
for(var c=0; | |
c<e.length; | |
c++){var k=a.getViewsByType(e[c]); | |
for(var b=0; | |
b<k.length; | |
b++){var h=a.getViewComponent(ZmAppViewMgr.C_APP_CONTENT,k[b].id); | |
if(h&&h.isZmDoublePaneView){h.isStale=true | |
}}}var d=appCtxt.getCurrentViewId(); | |
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._checkRefresh,[d]),1000) | |
}}; | |
ZmMailApp.prototype._checkRefresh=function(b){if(appCtxt.getCurrentViewId()==b){var a=appCtxt.getCurrentView(); | |
if(a&&a.isStale&&a._staleHandler){a._staleHandler() | |
}}}; | |
ZmMailApp.prototype.handleOp=function(e,d){var b=false; | |
var c=true; | |
if((e==ZmOperation.NEW_MESSAGE_WIN)||(e==ZmOperation.NEW_MESSAGE)){if(!appCtxt.isWebClientOffline()){b=(e==ZmOperation.NEW_MESSAGE_WIN)?true:this._inNewWindow(d&&d.ev); | |
c=false | |
}var a=new AjxCallback(this,this.compose,{action:ZmOperation.NEW_MESSAGE,inNewWindow:b}); | |
AjxDispatcher.require(["ContactsCore","Contacts"],false,a,null,c) | |
}}; | |
ZmMailApp.prototype.getOverviewPanelContent=function(){var b=!this._overviewPanelContent; | |
var a=ZmApp.prototype.getOverviewPanelContent.apply(this,arguments); | |
if(b){appCtxt.getSearchController().updateOverview() | |
}return a | |
}; | |
ZmMailApp.prototype.getOverviewContainer=function(){var b=!this._overviewContainer; | |
var a=ZmApp.prototype.getOverviewContainer.apply(this,arguments); | |
if(b&&!appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)){appCtxt.getSearchController().updateOverview() | |
}return a | |
}; | |
ZmMailApp.prototype.getNewButtonProps=function(){return{text:ZmMsg.newMessage,tooltip:ZmMsg.compose,icon:"NewMessage",iconDis:"NewMessageDis",defaultId:ZmOperation.NEW_MESSAGE,disabled:!this.containsWritableFolder()} | |
}; | |
ZmMailApp.prototype.launch=function(b,c){this._setLaunchTime(this.toString(),new Date()); | |
if(appCtxt.isExternalAccount()){var a=this._handleLoadLaunch.bind(this,b,c); | |
AjxDispatcher.require(["MailCore","Mail","Startup2"],true,a,null,true) | |
}else{this._handleLoadLaunch(b,c) | |
}}; | |
ZmMailApp.prototype._handleLoadLaunch=function(f,h){this._groupBy=appCtxt.get(ZmSetting.GROUP_MAIL_BY); | |
if(!appCtxt.get(ZmSetting.CONVERSATIONS_ENABLED)&&this._groupBy==="conversation"){this._groupBy="message" | |
}var d; | |
f=f||{}; | |
if(f.qsParams){var a=f.qsParams.view,g=f.qsParams.id; | |
if(a=="compose"){this._showComposeView(h); | |
return | |
}else{if(g){a=a||"msg"; | |
if(a=="list"){d=["item:",g].join(""); | |
f.searchResponse=null; | |
this._forceMsgView=true | |
}else{if(a=="msg"){var c=new ZmMailList(ZmItem.MSG); | |
var e=new ZmMailMsg(g,c,true); | |
c.add(e); | |
var b={getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),markRead:(appCtxt.get(ZmSetting.MARK_MSG_READ)==ZmSetting.MARK_READ_NOW),callback:new AjxCallback(this,this._handleResponseMsgLoad,[e,h]),errorCallback:new AjxCallback(this,this._handleErrorMsgLoad,h)}; | |
e.load(b); | |
return | |
}}}}}this.mailSearch(d,h,f.searchResponse) | |
}; | |
ZmMailApp.prototype._handleErrorLaunch=function(b,a){if(a.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER||a.code==ZmCsfeException.MAIL_NO_SUCH_TAG||a.code==ZmCsfeException.MAIL_QUERY_PARSE_ERROR){var c={query:"in:inbox",callback:b.callback,errorCallback:null,types:b.types}; | |
appCtxt.getSearchController().search(c) | |
}}; | |
ZmMailApp.prototype._handleErrorMsgLoad=function(b,a){this.mailSearch(); | |
if(b){b.run() | |
}this._notifyRendered(); | |
return false | |
}; | |
ZmMailApp.prototype._handleResponseMsgLoad=function(b,c){AjxDispatcher.require("Startup2"); | |
var a=AjxDispatcher.run("GetMsgController"); | |
if(a){a.show(b,null,null,null,true); | |
if(c){c.run() | |
}this._notifyRendered(); | |
appCtxt.notifyZimlets("onMsgView",[b,null,appCtxt.getCurrentView()],{waitUntilLoaded:true}) | |
}}; | |
ZmMailApp.prototype.mailSearch=function(g,j,c,h){var e=appCtxt.isOffline&&appCtxt.inStartup&&appCtxt.accountList.defaultAccount; | |
if(e){appCtxt.accountList.setActiveAccount(e) | |
}var f=appCtxt.getSearchController(); | |
var k,a; | |
if(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)&&appCtxt.accountList.size()>2){g=null; | |
k=appCtxt.accountList.generateQuery(ZmOrganizer.ID_INBOX); | |
a=true; | |
f.searchAllAccounts=true | |
}else{if(appCtxt.isExternalAccount()){g="inid:"+this.getDefaultFolderId() | |
}else{if(appCtxt.isWebClientOffline()){g=g||"in:inbox" | |
}else{g=g||appCtxt.get(ZmSetting.INITIAL_SEARCH,null,e) | |
}}}var d=new AjxVector(); | |
d.add(h||this.getGroupMailBy()); | |
var i=AjxUtil.get(c,"Body","SearchResponse","sortBy")||ZmSearch.DATE_DESC; | |
var b={searchFor:ZmId.SEARCH_MAIL,query:g,queryHint:k,types:d,limit:this.getLimit(),getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML,null,e),noUpdateOverview:a,offlineCache:true,accountName:(e&&e.name),callback:j,response:c,sortBy:i}; | |
b.errorCallback=new AjxCallback(this,this._handleErrorLaunch,b); | |
f.search(b) | |
}; | |
ZmMailApp.prototype.showSearchResults=function(b,d,c){var a=this._handleLoadShowSearchResults.bind(this,b,d,c); | |
AjxDispatcher.require("MailCore",false,a,null,true) | |
}; | |
ZmMailApp.prototype._handleLoadShowSearchResults=function(b,e,c){var d=c?c.getCurrentViewId():ZmApp.MAIN_SESSION; | |
var a=((b.type==ZmItem.MSG)||!appCtxt.get(ZmSetting.CONVERSATIONS_ENABLED))?this.getTradController(d,c):this.getConvListController(d,c); | |
a.show(b); | |
this._setLoadedTime(this.toString(),new Date()); | |
if(this._forceMsgView){a.selectFirstItem(); | |
this._forceMsgView=false | |
}if(e){e.run(a) | |
}this._notifyRendered(); | |
appCtxt.getAppViewMgr().updateTitle() | |
}; | |
ZmMailApp.prototype._parseComposeUrl=function(b){b=b||""; | |
b.replace(/^mailto:/i,""); | |
b=AjxStringUtil.urlComponentDecode(b); | |
var d=b.match(/\bto=([^&]+)/i); | |
var g=d?AjxStringUtil.urlComponentDecode(d[1].replace(/\+/g," ")):null; | |
g=g&&AjxEmailAddress.isValid(g)?AjxStringUtil.urlComponentDecode(g):AjxStringUtil.htmlEncode(g); | |
d=b.match(/\bsubject=([^&]+)/i); | |
var e=d?(AjxStringUtil.urlComponentDecode(d[1]).replace(/\+/g," ")):null; | |
d=b.match(/\bcc=([^&]+)/i); | |
var f=d?AjxStringUtil.urlComponentDecode(d[1].replace(/\+/g," ")):null; | |
f=f&&AjxEmailAddress.isValid(f)?f:AjxStringUtil.htmlEncode(f); | |
d=b.match(/\bbcc=([^&]+)/i); | |
var c=d?AjxStringUtil.urlComponentDecode(d[1].replace(/\+/g," ")):null; | |
c=c&&AjxEmailAddress.isValid(c)?c:AjxStringUtil.htmlEncode(c); | |
d=b.match(/\bbody=([^&]+)/i); | |
var a=d?(AjxStringUtil.urlComponentDecode(d[1]).replace(/\+/g," ")):null; | |
return{to:g,subject:AjxStringUtil.htmlEncode(e),cc:f,bcc:c,body:AjxStringUtil.htmlEncode(a)} | |
}; | |
ZmMailApp.prototype._showComposeView=function(g,c){var d=c||location.search; | |
AjxDispatcher.require("Startup2"); | |
var i=AjxDispatcher.run("GetComposeController"); | |
var a=this._parseComposeUrl(d); | |
var f=a.to; | |
if(f&&f.indexOf("mailto")==0){f=f.replace(/mailto:/,""); | |
var e=f.split("?"); | |
a.to=e[0]; | |
if(e.length>1){e=e[1]; | |
var h=this._parseComposeUrl(e); | |
a.to=a.to?(h.to?[a.to,","+h.to].join(""):a.to):h.to; | |
a.subject=h.subject||a.subject; | |
a.cc=h.cc||a.cc; | |
a.bcc=h.bcc||a.bcc; | |
a.body=h.body||a.body | |
}}var b={action:ZmOperation.NEW_MESSAGE,toOverride:a.to,ccOverride:a.cc,bccOverride:a.bcc,subjOverride:a.subject,extraBodyText:a.body,extraBodyTextIsExternal:Boolean(a.body),callback:g}; | |
if(appCtxt.isOffline&&appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&appCtxt.getCurrentViewId()==ZmId.VIEW_COMPOSE){i.resetComposeForMailto(b) | |
}else{i.doAction(b) | |
}this._notifyRendered(); | |
return i | |
}; | |
ZmMailApp.prototype.getConvListController=function(b,a){return this.getSessionController({controllerClass:"ZmConvListController",sessionId:b||ZmApp.MAIN_SESSION,searchResultsController:a}) | |
}; | |
ZmMailApp.prototype.getConvController=function(a){return this.getSessionController({controllerClass:"ZmConvController",sessionId:a}) | |
}; | |
ZmMailApp.prototype.getTradController=function(b,a){return this.getSessionController({controllerClass:"ZmTradController",sessionId:b||ZmApp.MAIN_SESSION,searchResultsController:a}) | |
}; | |
ZmMailApp.prototype.getMsgController=function(c){var b=this._sessionController[ZmId.VIEW_MSG]; | |
var a; | |
for(var d in b){if(!b[d].isHidden&&b[d].getMsg()&&b[d].getMsg().nId==c){a=b[d]; | |
break | |
}}if(a){c=a.getSessionId(); | |
this._curSessionId[ZmId.VIEW_MSG]=c; | |
a.inactive=false; | |
return a | |
}return this.getSessionController({controllerClass:"ZmMsgController",sessionId:c}) | |
}; | |
ZmMailApp.prototype.getComposeController=function(a){return this.getSessionController({controllerClass:"ZmComposeController",sessionId:a}) | |
}; | |
ZmMailApp.prototype.getConfirmController=function(a){return this.getSessionController({controllerClass:"ZmMailConfirmController",sessionId:a}) | |
}; | |
ZmMailApp.prototype.getMailListController=function(){var a=appCtxt.get(ZmSetting.GROUP_MAIL_BY); | |
return(a==ZmSetting.GROUP_BY_CONV)?AjxDispatcher.run("GetConvListController"):AjxDispatcher.run("GetTradController") | |
}; | |
ZmMailApp.prototype.runRefresh=function(){this.getMailListController().runRefresh() | |
}; | |
ZmMailApp.prototype.compose=function(d){Dwt.setLoadingTime("ZmMailApp-compose"); | |
d=d||{}; | |
if(!d.sessionId){var c=this._sessionController[ZmId.VIEW_COMPOSE]; | |
var a; | |
var b=d.msg&&d.msg.nId; | |
for(var e in c){if(c[e].getMsg()&&c[e].getMsg().nId==b){a=c[e]; | |
break | |
}}}if(!a){a=AjxDispatcher.run("GetComposeController",d.sessionId) | |
}appCtxt.composeCtlrSessionId=a.getSessionId(); | |
a.doAction(d); | |
Dwt.setLoadedTime("ZmMailApp-compose") | |
}; | |
ZmMailApp.prototype.setNewMailNotice=function(a){var c=appCtxt.getAppChooser(); | |
if(c){var d=c.getButton(ZmApp.MAIL); | |
var b=(a.numUnread>0)?"EnvelopeOpen":"MailApp"; | |
d.setImage(b) | |
}if(a.id==ZmOrganizer.ID_INBOX){this._setFavIcon(a.numUnread) | |
}this._setNewMailBadge() | |
}; | |
ZmMailApp.prototype._setNewMailBadge=function(){if(appCtxt.isOffline&&appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_DOCK_UPDATE)){if(AjxEnv.isMac&&window.platform){window.platform.icon().badgeText=(this.globalMailCount>0)?this.globalMailCount:null | |
}else{if(AjxEnv.isWindows){window.platform.icon().imageSpec=(this.globalMailCount>0)?"resource://webapp/icons/default/newmail.png":"resource://webapp/icons/default/launcher.ico"; | |
window.platform.icon().title=(this.globalMailCount>0)?AjxMessageFormat.format(ZmMsg.unreadCount,this.globalMailCount):null | |
}}}}; | |
ZmMailApp.prototype.clearNewMailBadge=function(){this.globalMailCount=0; | |
this._setNewMailBadge() | |
}; | |
ZmMailApp.prototype._setFavIcon=function(a){var b; | |
if(a==0){b=[appContextPath,"/img/logo/favicon.ico"].join("") | |
}else{if(a>9){b=[appContextPath,"/img/logo/favicon_plus.ico"].join("") | |
}else{b=[appContextPath,"/img/logo/favicon_",a,".ico"].join("") | |
}}Dwt.setFavIcon(b) | |
}; | |
ZmMailApp.prototype.getGroupMailBy=function(){var a=this._groupBy||appCtxt.get(ZmSetting.GROUP_MAIL_BY); | |
return a?ZmMailApp.GROUP_MAIL_BY_ITEM[a]:ZmItem.MSG | |
}; | |
ZmMailApp.prototype.setGroupMailBy=function(a,b){this._groupBy=a; | |
appCtxt.set(ZmSetting.GROUP_MAIL_BY,a,null,false,b) | |
}; | |
ZmMailApp.prototype.getLimit=function(b){var a=appCtxt.get(ZmSetting.PAGE_SIZE); | |
return b?a:2*a | |
}; | |
ZmMailApp.addReplyMenu=function(a){var b=[ZmOperation.REPLY,ZmOperation.REPLY_ALL]; | |
var c=new ZmActionMenu({parent:a,menuItems:b}); | |
a.setMenu(c); | |
return c | |
}; | |
ZmMailApp.addForwardMenu=function(a){var b=[ZmOperation.FORWARD_INLINE,ZmOperation.FORWARD_ATT]; | |
var c=new ZmActionMenu({parent:a,menuItems:b}); | |
a.setMenu(c); | |
return c | |
}; | |
ZmMailApp.prototype.getDataSourceCollection=function(b){var c=window.parentAppCtxt||window.appCtxt; | |
var a=b?b.name:c.getActiveAccount().name; | |
if(!this._dataSourceCollection[a]){this._dataSourceCollection[a]=new ZmDataSourceCollection(); | |
if(c.getActiveAccount().isMain){this._dataSourceCollection[a].initialize(c.getSettings().getInfoResponse.dataSources) | |
}}return this._dataSourceCollection[a] | |
}; | |
ZmMailApp.prototype.getIdentityCollection=function(d){if(appCtxt.isChildWindow){if(!this._identityCollection){this._identityCollection=new ZmIdentityCollection() | |
}return this._identityCollection | |
}var b=d?d.name:appCtxt.getActiveAccount().name; | |
if(!this._identityCollection[b]){var a=this._identityCollection[b]=new ZmIdentityCollection(); | |
var c=appCtxt.getSettings(d); | |
if(c){a.initialize(c.getInfoResponse.identities) | |
}}return this._identityCollection[b] | |
}; | |
ZmMailApp.prototype.getSignatureCollection=function(c){var d=window.parentAppCtxt||window.appCtxt; | |
c=c||d.getActiveAccount(); | |
var a=c.name; | |
var b=d.getSettings(c); | |
if(!this._signatureCollection[a]&&b){var e=this._signatureCollection[a]=new ZmSignatureCollection(); | |
e.initialize(b.getInfoResponse.signatures) | |
}return this._signatureCollection[a] | |
}; | |
ZmMailApp.prototype._addSettingsChangeListeners=function(){ZmApp.prototype._addSettingsChangeListeners.call(this); | |
if(!this._settingsListener){this._settingsListener=new AjxListener(this,this._settingsChangeListener) | |
}var a=appCtxt.getSettings(); | |
a.getSetting(ZmSetting.VIEW_AS_HTML).addChangeListener(this._settingListener); | |
a.getSetting(ZmSetting.TRUSTED_ADDR_LIST).addChangeListener(this._settingListener); | |
a.addChangeListener(this._settingsListener) | |
}; | |
ZmMailApp.prototype._settingChangeListener=function(c){ZmApp.prototype._settingChangeListener.call(this,c); | |
if(c.type!=ZmEvent.S_SETTING){return | |
}var b=c.source; | |
var e=this.getMailListController(); | |
if(e&&(b.id==ZmSetting.VIEW_AS_HTML||b.id==ZmSetting.TRUSTED_ADDR_LIST)){this.resetTrustedSendersList(); | |
var a=e._doublePaneView; | |
var d=a?a.getMsg():null; | |
if(d){a.reset(); | |
a.setItem(d) | |
}}}; | |
ZmMailApp.prototype._settingsChangeListener=function(e){if(e.type!=ZmEvent.S_SETTINGS){return | |
}var f=e.getDetail("settings"); | |
if(!(f&&f.length)){return | |
}var h=this.getMailListController(); | |
if(!h){return | |
}var a=h.getCurrentViewType(); | |
var g,d; | |
for(var b=0; | |
b<f.length; | |
b++){var c=f[b]; | |
if(c.id==ZmSetting.SHOW_FRAGMENTS){if(a!=ZmId.VIEW_MSG){g=d||a | |
}}}g=d||g; | |
if(g){h.switchView(g,true) | |
}}; | |
ZmMailApp.prototype.getTrustedSendersList=function(){if(!this._trustedList){var a=appCtxt.get(ZmSetting.TRUSTED_ADDR_LIST); | |
if(a){this._trustedList=AjxVector.fromArray(a) | |
}else{this._trustedList=new AjxVector() | |
}}return this._trustedList | |
}; | |
ZmMailApp.prototype.resetTrustedSendersList=function(){this._trustedList=null | |
}; | |
ZmMailApp._handleOOORemindResponse=function(c,b){ZmMailApp._hideOOORemindDialog(c); | |
var a=document.getElementById(c._htmlElId+"_dontRemind"); | |
if(b||a.checked){ZmMailApp._saveRemindStatus(b,a.checked) | |
}}; | |
ZmMailApp._hideOOORemindDialog=function(a){if(a){a.popdown() | |
}}; | |
ZmMailApp._saveRemindStatus=function(a,b){var c=AjxSoapDoc.create("ModifyPrefsRequest","urn:zimbraAccount"); | |
if(a){var d=c.set("pref","FALSE"); | |
d.setAttribute("name","zimbraPrefOutOfOfficeReplyEnabled") | |
}else{if(b){var d=c.set("pref","FALSE"); | |
d.setAttribute("name","zimbraPrefOutOfOfficeStatusAlertOnLogin") | |
}}var e={soapDoc:c,asyncMode:true}; | |
if(a){e.callback=ZmMailApp._oooReplyCallback | |
}appCtxt.getAppController().sendRequest(e) | |
}; | |
ZmMailApp._oooReplyCallback=function(){appCtxt.set(ZmSetting.VACATION_MSG_ENABLED,false) | |
}; | |
ZmMailApp.prototype._isOnVacation=function(){if(!appCtxt.get(ZmSetting.VACATION_MSG_ENABLED)){return false | |
}var f=appCtxt.get(ZmSetting.VACATION_FROM); | |
var e=appCtxt.get(ZmSetting.VACATION_UNTIL); | |
if(!f){return true | |
}var b=new Date(); | |
var d=new AjxDateFormat("yyyyMMddHHmmss'Z'"); | |
var c=d.parse(AjxDateUtil.dateGMT2Local(f)); | |
var a=d.parse(AjxDateUtil.dateGMT2Local(e)); | |
return c<b&&b<a | |
}; | |
ZmMailApp.prototype._checkVacationReplyEnabled=function(){if(!appCtxt.get(ZmSetting.VACATION_MSG_REMIND_ON_LOGIN)){return | |
}if(!this._isOnVacation()){return | |
}var b=new DwtMessageDialog({parent:appCtxt.getShell(),buttons:[DwtDialog.YES_BUTTON,DwtDialog.NO_BUTTON],id:"VacationDialog"}); | |
var c=AjxTemplate.expand("mail.Message#VacationRemindDialog",{id:b._htmlElId}); | |
b.setTitle(ZmMsg.OOORemindDialogTitle); | |
b.setContent(c); | |
var a=document.getElementById(b._htmlElId+"_dontRemind"); | |
a.checked=false; | |
b.registerCallback(DwtDialog.YES_BUTTON,ZmMailApp._handleOOORemindResponse,null,[b,true]); | |
b.registerCallback(DwtDialog.NO_BUTTON,ZmMailApp._handleOOORemindResponse,null,[b,false]); | |
b.popup() | |
}; | |
ZmMailApp.prototype._createVirtualFolders=function(){ZmOffline.addOutboxFolder() | |
}; | |
ZmMailApp.prototype.resetWebClientOfflineOperations=function(){ZmApp.prototype.resetWebClientOfflineOperations.apply(this); | |
var d=!appCtxt.isWebClientOffline(); | |
this.refresh(); | |
var b=appCtxt.getFolderTree().getByType(ZmOrganizer.FOLDER); | |
var f=this.getOverview(); | |
if(b&&f){for(var a=0; | |
a<b.length; | |
a++){var c=b[a]; | |
var e=c&&f.getTreeItemById(c.id); | |
if(!e){continue | |
}if(d){e.setVisible(true) | |
}else{if(c.id!=ZmFolder.ID_ROOT&&c.rid!=ZmFolder.ID_ROOT&&c.id!=ZmFolder.ID_OUTBOX&&c.webOfflineSyncDays===0){e.setVisible(false) | |
}}}}}; | |
ZmMailApp.prototype.enableMailPrefs=function(){AjxDispatcher.require("PreferencesCore"); | |
this._registerSettings(); | |
this._registerOperations(); | |
this._registerPrefs() | |
}; | |
ZmMailApp.FOLDERS_TO_OMIT=[ZmFolder.ID_TRASH,ZmFolder.ID_SPAM]; | |
ZmMailApp.getFoldersToOmit=function(c){c=c||appCtxt.getCurrentSearch(); | |
var b=ZmMailApp.FOLDERS_TO_OMIT,d=[],e=c&&c.folderId; | |
var f=c&&c.userInitiated; | |
for(var a=0; | |
a<b.length; | |
a++){if(!f&&b[a]!=e){d.push(b[a]) | |
}}return AjxUtil.arrayAsHash(d) | |
}; | |
ZmMailApp.getReplyFoldersToOmit=function(a){var b=ZmMailApp.getFoldersToOmit(a); | |
b[ZmFolder.ID_DRAFTS]=true; | |
return b | |
} | |
}if(AjxPackage.define("zimbraMail.calendar.ZmCalendarApp")){ZmCalendarApp=function(b,a){ZmApp.call(this,ZmApp.CALENDAR,b,a); | |
this._addSettingsChangeListeners(); | |
this._resByName={}; | |
this._resByEmail={} | |
}; | |
ZmCalendarApp.prototype=new ZmApp; | |
ZmCalendarApp.prototype.constructor=ZmCalendarApp; | |
ZmCalendarApp.prototype.isZmCalendarApp=true; | |
ZmCalendarApp.prototype.toString=function(){return"ZmCalendarApp" | |
}; | |
ZmEvent.S_APPT=ZmId.ITEM_APPOINTMENT; | |
ZmEvent.S_RESOURCE=ZmId.ITEM_RESOURCE; | |
ZmItem.APPT=ZmEvent.S_APPT; | |
ZmItem.RESOURCE=ZmEvent.S_RESOURCE; | |
ZmOrganizer.CALENDAR=ZmId.ORG_CALENDAR; | |
ZmApp.CALENDAR=ZmId.APP_CALENDAR; | |
ZmApp.CLASS[ZmApp.CALENDAR]="ZmCalendarApp"; | |
ZmApp.SETTING[ZmApp.CALENDAR]=ZmSetting.CALENDAR_ENABLED; | |
ZmApp.UPSELL_SETTING[ZmApp.CALENDAR]=ZmSetting.CALENDAR_UPSELL_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.CALENDAR]=40; | |
ZmApp.QS_ARG[ZmApp.CALENDAR]="calendar"; | |
ZmCalendarApp.REMINDER_START_DELAY=10000; | |
ZmCalendarApp.MINICAL_DELAY=5000; | |
ZmCalendarApp.VIEW_FOR_SETTING={}; | |
ZmCalendarApp.VIEW_FOR_SETTING[ZmSetting.CAL_DAY]=ZmId.VIEW_CAL_DAY; | |
ZmCalendarApp.VIEW_FOR_SETTING[ZmSetting.CAL_WEEK]=ZmId.VIEW_CAL_WEEK; | |
ZmCalendarApp.VIEW_FOR_SETTING[ZmSetting.CAL_WORK_WEEK]=ZmId.VIEW_CAL_WORK_WEEK; | |
ZmCalendarApp.VIEW_FOR_SETTING[ZmSetting.CAL_MONTH]=ZmId.VIEW_CAL_MONTH; | |
ZmCalendarApp.VIEW_FOR_SETTING[ZmSetting.CAL_LIST]=ZmId.VIEW_CAL_LIST; | |
ZmCalendarApp.COLORS=[]; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_ORANGE]="Orange"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_BLUE]="Blue"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_CYAN]="Cyan"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_GREEN]="Green"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_PURPLE]="Purple"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_RED]="Red"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_YELLOW]="Yellow"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_PINK]="Pink"; | |
ZmCalendarApp.COLORS[ZmOrganizer.C_GRAY]="Gray"; | |
ZmCalendarApp.CUTYPE_INDIVIDUAL="IND"; | |
ZmCalendarApp.CUTYPE_GROUP="GRO"; | |
ZmCalendarApp.CUTYPE_RESOURCE="RES"; | |
ZmCalendarApp.CUTYPE_ROOM="ROO"; | |
ZmCalendarApp.CUTYPE_UNKNOWN="UNK"; | |
ZmCalendarApp.STATUS_CANC="CANC"; | |
ZmCalendarApp.STATUS_COMP="COMP"; | |
ZmCalendarApp.STATUS_CONF="CONF"; | |
ZmCalendarApp.STATUS_DEFR="DEFERRED"; | |
ZmCalendarApp.STATUS_INPR="INPR"; | |
ZmCalendarApp.STATUS_NEED="NEED"; | |
ZmCalendarApp.STATUS_TENT="TENT"; | |
ZmCalendarApp.STATUS_WAIT="WAITING"; | |
ZmCalendarApp.METHOD_CANCEL="CANCEL"; | |
ZmCalendarApp.METHOD_PUBLISH="PUBLISH"; | |
ZmCalendarApp.METHOD_REPLY="REPLY"; | |
ZmCalendarApp.METHOD_REQUEST="REQUEST"; | |
ZmCalendarApp.METHOD_COUNTER="COUNTER"; | |
ZmCalendarApp.DEFAULT_WORKING_HOURS="1:N:0800:1700,2:Y:0800:1700,3:Y:0800:1700,4:Y:0800:1700,5:Y:0800:1700,6:Y:0800:1700,7:N:0800:1700"; | |
ZmCalendarApp.DEFAULT_APPT_DURATION="60"; | |
ZmCalendarApp.reminderTimeWarningDisplayMsgs=[ZmMsg.apptRemindNever,ZmMsg.apptRemindAtEventTime,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNHoursBefore,ZmMsg.apptRemindNHoursBefore,ZmMsg.apptRemindNHoursBefore,ZmMsg.apptRemindNHoursBefore,ZmMsg.apptRemindNHoursBefore,ZmMsg.apptRemindNDaysBefore,ZmMsg.apptRemindNDaysBefore,ZmMsg.apptRemindNDaysBefore,ZmMsg.apptRemindNDaysBefore,ZmMsg.apptRemindNWeeksBefore,ZmMsg.apptRemindNWeeksBefore]; | |
ZmCalendarApp.reminderTimeWarningValues=[-1,0,1,5,10,15,30,45,60,120,180,240,300,1080,1440,2880,4320,5760,10080,20160]; | |
ZmCalendarApp.reminderTimeWarningLabels=[-1,0,1,5,10,15,30,45,60,2,3,4,5,18,1,2,3,4,1,2]; | |
ZmCalendarApp.prototype._defineAPI=function(){AjxDispatcher.setPackageLoadFunction("CalendarCore",new AjxCallback(this,this._postLoadCore)); | |
AjxDispatcher.setPackageLoadFunction("Calendar",new AjxCallback(this,this._postLoad,ZmOrganizer.CALENDAR)); | |
AjxDispatcher.registerMethod("GetCalController",["MailCore","CalendarCore"],new AjxCallback(this,this.getCalController)); | |
AjxDispatcher.registerMethod("GetReminderController",["MailCore","CalendarCore"],new AjxCallback(this,this.getReminderController)); | |
AjxDispatcher.registerMethod("ShowMiniCalendar",["MailCore","CalendarCore"],new AjxCallback(this,this.showMiniCalendar)); | |
AjxDispatcher.registerMethod("GetApptComposeController",["MailCore","CalendarCore","Calendar","CalendarAppt"],new AjxCallback(this,this.getApptComposeController)) | |
}; | |
ZmCalendarApp.prototype._registerSettings=function(a){var a=a||appCtxt.getSettings(); | |
a.registerSetting("CAL_ALWAYS_SHOW_MINI_CAL",{name:"zimbraPrefCalendarAlwaysShowMiniCal",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_APPT_VISIBILITY",{name:"zimbraPrefCalendarApptVisibility",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"public",isGlobal:true}); | |
a.registerSetting("CAL_EMAIL_REMINDERS_ADDRESS",{name:"zimbraPrefCalendarReminderEmail",type:ZmSetting.T_PREF}); | |
a.registerSetting("CAL_DEVICE_EMAIL_REMINDERS_ADDRESS",{name:"zimbraCalendarReminderDeviceEmail",type:ZmSetting.T_PREF}); | |
a.registerSetting("CAL_DEVICE_EMAIL_REMINDERS_ENABLED",{name:"zimbraFeatureCalendarReminderDeviceEmailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("CAL_EXPORT",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("CAL_FIRST_DAY_OF_WEEK",{name:"zimbraPrefCalendarFirstDayOfWeek",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}); | |
a.registerSetting("CAL_FREE_BUSY_ACL",{type:ZmSetting.T_PREF,defaultValue:ZmSetting.ACL_ALL}); | |
a.registerSetting("CAL_FREE_BUSY_ACL_USERS",{type:ZmSetting.T_PREF}); | |
a.registerSetting("CAL_IMPORT",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("CAL_INVITE_ACL",{type:ZmSetting.T_PREF,defaultValue:ZmSetting.ACL_ALL}); | |
a.registerSetting("CAL_INVITE_ACL_USERS",{type:ZmSetting.T_PREF}); | |
a.registerSetting("CAL_REMINDER_NOTIFY_SOUNDS",{name:"zimbraPrefCalendarReminderSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CAL_REMINDER_NOTIFY_BROWSER",{name:"zimbraPrefCalendarReminderFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CAL_REMINDER_NOTIFY_TOASTER",{name:"zimbraPrefCalendarToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_REMINDER_WARNING_TIME",{name:"zimbraPrefCalendarApptReminderWarningTime",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}); | |
a.registerSetting("CAL_SHOW_DECLINED_MEETINGS",{name:"zimbraPrefCalendarShowDeclinedMeetings",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("CAL_SHOW_TIMEZONE",{name:"zimbraPrefUseTimeZoneListInCalendar",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_USE_QUICK_ADD",{name:"zimbraPrefCalendarUseQuickAdd",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CALENDAR_INITIAL_VIEW",{name:"zimbraPrefCalendarInitialView",type:ZmSetting.T_PREF,defaultValue:ZmSetting.CAL_DAY,isGlobal:true}); | |
a.registerSetting("CAL_WORKING_HOURS",{name:"zimbraPrefCalendarWorkingHours",type:ZmSetting.T_PREF,defaultValue:ZmCalendarApp.DEFAULT_WORKING_HOURS,isGlobal:true}); | |
a.registerSetting("FREE_BUSY_VIEW_ENABLED",{name:"zimbraFeatureFreeBusyViewEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("DELETE_INVITE_ON_REPLY",{name:"zimbraPrefDeleteInviteOnReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("ENABLE_APPL_ICAL_DELEGATION",{name:"zimbraPrefAppleIcalDelegationEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_AUTO_ADD_INVITES",{name:"zimbraPrefCalendarAutoAddInvites",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("CAL_SEND_INV_DENIED_REPLY",{name:"zimbraPrefCalendarSendInviteDeniedAutoReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("CAL_INV_FORWARDING_ADDRESS",{name:"zimbraPrefCalendarForwardInvitesTo",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST,isGlobal:true}); | |
a.registerSetting("CAL_SHOW_PAST_DUE_REMINDERS",{name:"zimbraPrefCalendarShowPastDueReminders",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CAL_SHOW_CALENDAR_WEEK",{name:"zimbraPrefShowCalendarWeek",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_APPT_ALLOW_ATTENDEE_EDIT",{name:"zimbraPrefCalendarApptAllowAtendeeEdit",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CAL_RESOURCE_DBL_BOOKING_ALLOWED",{name:"zimbraCalendarResourceDoubleBookingAllowed",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CAL_SHOW_RESOURCE_TABS",{name:"zimbraCalendarShowResourceTabs",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}); | |
a.registerSetting("CAL_DEFAULT_APPT_DURATION",{name:"zimbraPrefCalendarDefaultApptDuration",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LDAP_TIME,defaultValue:ZmCalendarApp.DEFAULT_APPT_DURATION,isGlobal:true}); | |
a.registerSetting("CAL_EXCEPTION_ON_SERIES_TIME_CHANGE",{name:"zimbraCalendarKeepExceptionsOnSeriesTimeChange",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_LOCATION_FIELDS_DISABLED",{name:"zimbraCalendarLocationDisabledFields",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING,defaultValue:false,isGlobal:true}); | |
a.registerSetting("CAL_DEFAULT_ID",{name:"zimbraPrefDefaultCalendarId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"10"}) | |
}; | |
ZmCalendarApp.prototype._registerPrefs=function(){var d={CALENDAR:{title:ZmMsg.calendar,icon:"CalendarApp",templateId:"prefs.Pages#Calendar",priority:80,precondition:ZmSetting.CALENDAR_ENABLED,prefs:[ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL,ZmSetting.CAL_AUTO_ADD_INVITES,ZmSetting.CAL_SEND_INV_DENIED_REPLY,ZmSetting.CAL_APPT_VISIBILITY,ZmSetting.CAL_EXPORT,ZmSetting.CAL_FIRST_DAY_OF_WEEK,ZmSetting.CAL_IMPORT,ZmSetting.CAL_REMINDER_WARNING_TIME,ZmSetting.CAL_REMINDER_NOTIFY_SOUNDS,ZmSetting.CAL_REMINDER_NOTIFY_BROWSER,ZmSetting.CAL_SHOW_DECLINED_MEETINGS,ZmSetting.CAL_DEFAULT_ID,ZmSetting.CAL_SHOW_TIMEZONE,ZmSetting.CAL_USE_QUICK_ADD,ZmSetting.CALENDAR_INITIAL_VIEW,ZmSetting.CAL_WORKING_HOURS,ZmSetting.DELETE_INVITE_ON_REPLY,ZmSetting.ENABLE_APPL_ICAL_DELEGATION,ZmSetting.CAL_FREE_BUSY_ACL,ZmSetting.CAL_FREE_BUSY_ACL_USERS,ZmSetting.CAL_INVITE_ACL,ZmSetting.CAL_INVITE_ACL_USERS,ZmSetting.CAL_REMINDER_NOTIFY_TOASTER,ZmSetting.CAL_INV_FORWARDING_ADDRESS,ZmSetting.CAL_SHOW_PAST_DUE_REMINDERS,ZmSetting.CAL_SHOW_CALENDAR_WEEK,ZmSetting.CAL_DEFAULT_APPT_DURATION,ZmSetting.CAL_LOCATION_FIELDS_DISABLED],manageDirty:true,createView:function(f,g,e){AjxDispatcher.require("Alert"); | |
return new ZmCalendarPrefsPage(f,g,e) | |
}}}; | |
for(var c in d){ZmPref.registerPrefSection(c,d[c]) | |
}ZmPref.registerPref("CAL_ALWAYS_SHOW_MINI_CAL",{displayName:ZmMsg.alwaysShowMiniCal,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_WORKING_HOURS",{displayContainer:ZmPref.TYPE_CUSTOM}); | |
ZmPref.registerPref("CAL_AUTO_ADD_INVITES",{displayName:ZmMsg.autoAddInvites,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_SEND_INV_DENIED_REPLY",{displayName:ZmMsg.sendInvDeniedAutoReply,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_EMAIL_REMINDERS_ADDRESS",{displayName:ZmMsg.emailNotificationsDescription,displayContainer:ZmPref.TYPE_INPUT,errorMessage:ZmMsg.invalidEmail,hint:ZmMsg.enterEmailAddress}); | |
ZmPref.registerPref("CAL_DEVICE_EMAIL_REMINDERS_ADDRESS",{displayName:ZmMsg.deviceEmailNotificationsDescription,displayContainer:ZmPref.TYPE_INPUT,errorMessage:ZmMsg.invalidEmail,hint:ZmMsg.enterEmailAddress}); | |
ZmPref.registerPref("CAL_EXPORT",{displayName:ZmMsg.exportToICS,displayContainer:ZmPref.TYPE_EXPORT}); | |
ZmPref.registerPref("CAL_FIRST_DAY_OF_WEEK",{displayName:ZmMsg.calendarFirstDayOfWeek,displayContainer:ZmPref.TYPE_SELECT,displayOptions:AjxDateUtil.WEEKDAY_LONG,options:[0,1,2,3,4,5,6]}); | |
ZmPref.registerPref("CAL_FREE_BUSY_ACL",{displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.freeBusyAllowAll,ZmMsg.freeBusyAllowLocal,ZmMsg.freeBusyAllowDomain,ZmMsg.freeBusyAllowNone,ZmMsg.freeBusyAllowSome],options:[ZmSetting.ACL_PUBLIC,ZmSetting.ACL_AUTH,ZmSetting.ACL_DOMAIN,ZmSetting.ACL_NONE,ZmSetting.ACL_USER]}); | |
ZmPref.registerPref("CAL_FREE_BUSY_ACL_USERS",{displayContainer:ZmPref.TYPE_TEXTAREA,hint:ZmMsg.enterEmailAddresses}); | |
ZmPref.registerPref("CAL_IMPORT",{displayName:ZmMsg.importFromICS,displayContainer:ZmPref.TYPE_IMPORT}); | |
ZmPref.registerPref("CAL_INVITE_ACL",{displayContainer:ZmPref.TYPE_RADIO_GROUP,displayOptions:[ZmMsg.invitesAllowAll,ZmMsg.invitesAllowLocal,ZmMsg.invitesAllowNone,ZmMsg.invitesAllowSome],options:[ZmSetting.ACL_PUBLIC,ZmSetting.ACL_AUTH,ZmSetting.ACL_NONE,ZmSetting.ACL_USER]}); | |
ZmPref.registerPref("CAL_INVITE_ACL_USERS",{displayContainer:ZmPref.TYPE_TEXTAREA,hint:ZmMsg.enterEmailAddresses}); | |
ZmPref.registerPref("CAL_REMINDER_WARNING_TIME",{displayName:ZmMsg.numberOfMinutes,displayContainer:ZmPref.TYPE_SELECT,displayOptions:ZmCalendarApp.getReminderTimeWarningDisplayOptions(),options:ZmCalendarApp.reminderTimeWarningValues,setFunction:ZmCalendarApp.setDefaultReminderTimePrefValueOnSave,loadFunction:ZmCalendarApp.postLoadSetDefaultReminderValue}); | |
ZmPref.registerPref("CAL_SHOW_DECLINED_MEETINGS",{displayName:ZmMsg.showDeclinedMeetings,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
var a=ZmCalendarApp.getDefaultCalendarFolders(); | |
ZmPref.registerPref("CAL_DEFAULT_ID",{displayName:ZmMsg.defaultCalendar,displayContainer:ZmPref.TYPE_SELECT,displayOptions:a.displayOptions,options:a.options}); | |
ZmPref.registerPref("CAL_SHOW_TIMEZONE",{displayName:ZmMsg.shouldShowTimezone,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_USE_QUICK_ADD",{displayName:ZmMsg.useQuickAdd,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CALENDAR_INITIAL_VIEW",{displayName:ZmMsg.calendarInitialView,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.calViewDay,ZmMsg.calViewWorkWeek,ZmMsg.calViewWeek,ZmMsg.calViewMonth,ZmMsg.calViewList],options:[ZmSetting.CAL_DAY,ZmSetting.CAL_WORK_WEEK,ZmSetting.CAL_WEEK,ZmSetting.CAL_MONTH,ZmSetting.CAL_LIST]}); | |
ZmPref.registerPref("CAL_REMINDER_NOTIFY_SOUNDS",{displayName:ZmMsg.playSound,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_REMINDER_NOTIFY_BROWSER",{displayName:ZmMsg.flashBrowser,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("DELETE_INVITE_ON_REPLY",{displayName:ZmMsg.deleteInviteOnReply,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("ENABLE_APPL_ICAL_DELEGATION",{displayName:ZmMsg.enableAppleICalDelegation,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
AjxDispatcher.require("Alert"); | |
var b=ZmDesktopAlert.getInstance().getDisplayText(); | |
ZmPref.registerPref("CAL_REMINDER_NOTIFY_TOASTER",{displayFunc:function(){return b | |
},precondition:!!b,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_APPT_VISIBILITY",{displayName:ZmMsg.calendarInitialApptVisibility,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg._public,ZmMsg._private],options:[ZmSetting.CAL_VISIBILITY_PUB,ZmSetting.CAL_VISIBILITY_PRIV]}); | |
ZmPref.registerPref("CAL_INV_FORWARDING_ADDRESS",{displayName:ZmMsg.inviteForwardingAddress,displayContainer:ZmPref.TYPE_INPUT,validationFunction:ZmPref.validateEmailList,valueFunction:ZmPref.string2EmailList,errorMessage:ZmMsg.invalidEmail,hint:ZmMsg.enterEmailAddress}); | |
ZmPref.registerPref("CAL_SHOW_PAST_DUE_REMINDERS",{displayName:ZmMsg.apptPastDueReminderLabel,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_SHOW_CALENDAR_WEEK",{displayName:ZmMsg.showWeekNumber,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("CAL_DEFAULT_APPT_DURATION",{displayName:ZmMsg.defaultApptDuration,displayContainer:ZmPref.TYPE_SELECT,displayOptions:["30","60","90","120"],options:["1800","3600","5400","7200"]}) | |
}; | |
ZmCalendarApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_CAL_LIST_VIEW,{textKey:"list",tooltipKey:"viewCalListTooltip",image:"CalListView",shortcut:ZmKeyMap.CAL_LIST_VIEW}); | |
ZmOperation.registerOp(ZmId.OP_CAL_REFRESH,{textKey:"refresh",tooltipKey:"calRefreshTooltip",image:"Refresh",shortcut:ZmKeyMap.REFRESH,showImageInToolbar:true}); | |
ZmOperation.registerOp(ZmId.OP_CAL_VIEW_MENU,{textKey:"view",image:"Appointment"},null,AjxCallback.simpleClosure(function(a){ZmOperation.addDeferredMenu(ZmCalendarApp.addCalViewMenu,a) | |
})); | |
ZmOperation.registerOp(ZmId.OP_DAY_VIEW,{textKey:"viewDay",tooltipKey:"viewDayTooltip",image:"DayView",shortcut:ZmKeyMap.CAL_DAY_VIEW}); | |
ZmOperation.registerOp(ZmId.OP_EDIT_REPLY_ACCEPT,{textKey:"replyAccept",image:"Check"}); | |
ZmOperation.registerOp(ZmId.OP_EDIT_REPLY_CANCEL); | |
ZmOperation.registerOp(ZmId.OP_EDIT_REPLY_TENTATIVE,{textKey:"replyTentative",image:"QuestionMark"}); | |
ZmOperation.registerOp(ZmId.OP_EDIT_REPLY_DECLINE,{textKey:"replyDecline",image:"Cancel"}); | |
ZmOperation.registerOp(ZmId.OP_INVITE_REPLY_ACCEPT,{textKey:"editReply",image:"Check"}); | |
ZmOperation.registerOp(ZmId.OP_INVITE_REPLY_DECLINE,{textKey:"editReply",image:"Cancel"}); | |
ZmOperation.registerOp(ZmId.OP_INVITE_REPLY_MENU,{textKey:"editReply",image:"Reply"},ZmSetting.MAIL_ENABLED,AjxCallback.simpleClosure(function(a){ZmOperation.addDeferredMenu(ZmCalendarApp.addInviteReplyMenu,a) | |
})); | |
ZmOperation.registerOp(ZmId.OP_INVITE_REPLY_TENTATIVE,{textKey:"editReply",image:"QuestionMark"}); | |
ZmOperation.registerOp(ZmId.OP_MONTH_VIEW,{textKey:"viewMonth",tooltipKey:"viewMonthTooltip",image:"MonthView",shortcut:ZmKeyMap.CAL_MONTH_VIEW}); | |
ZmOperation.registerOp(ZmId.OP_MOUNT_CALENDAR,{textKey:"mountCalendar",image:"GroupSchedule"}); | |
ZmOperation.registerOp(ZmId.OP_NEW_ALLDAY_APPT,{textKey:"newAllDayAppt",tooltipKey:"newAllDayApptTooltip",image:"NewAppointment"}); | |
ZmOperation.registerOp(ZmId.OP_NEW_APPT,{textKey:"newAppt",tooltipKey:"newApptTooltip",image:"NewAppointment",shortcut:ZmKeyMap.NEW_APPT}); | |
ZmOperation.registerOp(ZmId.OP_NEW_CALENDAR,{textKey:"newCalendar",image:"NewAppointment",tooltipKey:"newCalendarTooltip",shortcut:ZmKeyMap.NEW_CALENDAR}); | |
ZmOperation.registerOp(ZmId.OP_ADD_EXTERNAL_CALENDAR,{textKey:"addExternalCalendar",image:"NewAppointment",tooltipKey:"addExternalCalendarTooltip",shortcut:ZmKeyMap.ADD_EXTERNAL_CALENDAR}); | |
ZmOperation.registerOp(ZmId.OP_PRINT_CALENDAR,{textKey:"print",tooltipKey:"printTooltip",image:"Print",shortcut:ZmKeyMap.PRINT,textPrecedence:30,showImageInToolbar:true},ZmSetting.PRINT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_PROPOSE_NEW_TIME,{textKey:"proposeNewTime",image:"ProposeTime",showTextInToolbar:true,showImageInToolbar:true}); | |
ZmOperation.registerOp(ZmId.OP_REINVITE_ATTENDEES,{textKey:"reinviteAttendees",image:"MeetingRequest"}); | |
ZmOperation.registerOp(ZmId.OP_FB_VIEW,{textKey:"viewFB",tooltipKey:"viewFBTooltip",image:"GroupSchedule",shortcut:ZmKeyMap.CAL_FB_VIEW}); | |
ZmOperation.registerOp(ZmId.OP_SEARCH_MAIL,{textKey:"searchMail",image:"SearchMail"},ZmSetting.MAIL_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SHARE_CALENDAR,{textKey:"shareCalendar",image:"CalendarFolder"}); | |
ZmOperation.registerOp(ZmId.OP_TODAY,{textKey:"today",tooltipKey:"todayTooltip",image:"Date",shortcut:ZmKeyMap.TODAY}); | |
ZmOperation.registerOp(ZmId.OP_VIEW_APPOINTMENT,{textKey:"viewAppointment",image:"Appointment"}); | |
ZmOperation.registerOp(ZmId.OP_OPEN_APPT_INSTANCE,{textKey:"openApptInstance",image:"Appointment"}); | |
ZmOperation.registerOp(ZmId.OP_OPEN_APPT_SERIES,{textKey:"openApptSeries",image:"Appointment"}); | |
ZmOperation.registerOp(ZmId.OP_DELETE_APPT_INSTANCE,{textKey:"deleteApptInstance",image:"Delete"}); | |
ZmOperation.registerOp(ZmId.OP_DELETE_APPT_SERIES,{textKey:"deleteApptSeries",image:"Delete"}); | |
ZmOperation.registerOp(ZmId.OP_VIEW_APPT_INSTANCE,{textKey:"apptInstance",image:"Appointment"}); | |
ZmOperation.registerOp(ZmId.OP_VIEW_APPT_SERIES,{textKey:"apptSeries",image:"Appointment"}); | |
ZmOperation.registerOp(ZmId.OP_WEEK_VIEW,{textKey:"viewWeek",tooltipKey:"viewWeekTooltip",image:"WeekView",shortcut:ZmKeyMap.CAL_WEEK_VIEW}); | |
ZmOperation.registerOp(ZmId.OP_WORK_WEEK_VIEW,{textKey:"viewWorkWeek",tooltipKey:"viewWorkWeekTooltip",image:"WorkWeekView",shortcut:ZmKeyMap.CAL_WORK_WEEK_VIEW}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_APPT,{textKey:"forward",tooltipKey:"forward",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_APPT_INSTANCE,{textKey:"forwardInstance",tooltipKey:"forwardInstance",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_APPT_SERIES,{textKey:"forwardSeries",tooltipKey:"forwardSeries",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_DUPLICATE_APPT,{textKey:"createCopy",tooltipKey:"createCopy",image:"Copy"}); | |
ZmOperation.registerOp(ZmId.OP_INVITE_ATTENDEES,{textKey:"inviteAttendees",tooltipKey:"inviteAttendees",image:"Group"}); | |
ZmOperation.registerOp(ZmId.OP_SEND_INVITE,{textKey:"send",tooltipKey:"sendInvites",image:"MeetingRequest"}) | |
}; | |
ZmCalendarApp.prototype._registerItems=function(){ZmItem.registerItem(ZmItem.APPT,{app:ZmApp.CALENDAR,nameKey:"appointment",icon:"Appointment",soapCmd:"ItemAction",itemClass:"ZmAppt",node:"appt",organizer:ZmOrganizer.CALENDAR,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.CALENDAR],searchType:"appointment",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require(["MailCore","CalendarCore"]); | |
return new ZmApptList(ZmItem.APPT,a) | |
},this)}); | |
ZmItem.registerItem(ZmItem.RESOURCE,{app:ZmApp.CALENDAR,itemClass:"ZmResource",node:"calResource",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require(["MailCore","CalendarCore"]); | |
return new ZmResourceList(null,a) | |
},this)}) | |
}; | |
ZmCalendarApp.prototype._registerOrganizers=function(){ZmOrganizer.registerOrg(ZmOrganizer.CALENDAR,{app:ZmApp.CALENDAR,nameKey:"calendar",defaultFolder:ZmOrganizer.ID_CALENDAR,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmCalendar",orgPackage:"CalendarCore",treeController:"ZmCalendarTreeController",labelKey:"calendars",itemsKey:"appointments",hasColor:true,defaultColor:ZmOrganizer.C_BLUE,treeType:ZmOrganizer.FOLDER,views:["appointment"],folderKey:"calendar",mountKey:"mountCalendar",createFunc:"ZmCalendar.create",compareFunc:"ZmFolder.sortCompareNonMail",newOp:ZmOperation.NEW_CALENDAR,displayOrder:100,deferrable:true,childWindow:true}) | |
}; | |
ZmCalendarApp.prototype._setupSearchToolbar=function(){var a={msgKey:"appointments",tooltipKey:"searchAppts",icon:"Appointment",shareIcon:"SharedCalendarFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_APPOINTMENT)}; | |
if(!appCtxt.isOffline){a.setting=ZmSetting.CALENDAR_ENABLED | |
}ZmSearchToolBar.addMenuItem(ZmItem.APPT,a) | |
}; | |
ZmCalendarApp.prototype._registerApp=function(){var c={}; | |
c[ZmOperation.NEW_APPT]="appointment"; | |
var b={}; | |
b[ZmOperation.NEW_CALENDAR]="calendar"; | |
var a={}; | |
a[ZmKeyMap.NEW_APPT]=ZmOperation.NEW_APPT; | |
a[ZmKeyMap.NEW_CALENDAR]=ZmOperation.NEW_CALENDAR; | |
a[ZmKeyMap.ADD_EXTERNAL_CALENDAR]=ZmOperation.ADD_EXTERNAL_CALENDAR; | |
ZmApp.registerApp(ZmApp.CALENDAR,{mainPkg:"Calendar",nameKey:"calendar",icon:"CalendarApp",textPrecedence:60,chooserTooltipKey:"goToCalendar",viewTooltipKey:"displayCalendar",defaultSearch:ZmItem.APPT,organizer:ZmOrganizer.CALENDAR,overviewTrees:[ZmOrganizer.CALENDAR,ZmOrganizer.SEARCH,ZmOrganizer.TAG],newItemOps:c,newOrgOps:b,actionCodes:a,searchTypes:[ZmItem.APPT],gotoActionCode:ZmKeyMap.GOTO_CALENDAR,newActionCode:ZmKeyMap.NEW_APPT,chooserSort:30,defaultSort:20,upsellUrl:ZmSetting.CALENDAR_UPSELL_URL,searchResultsTab:true}) | |
}; | |
ZmCalendarApp.prototype._getRefreshButtonTooltip=function(){return ZmMsg.showAllEventsFromSelectedCalendars | |
}; | |
ZmCalendarApp.prototype.startup=function(a){}; | |
ZmCalendarApp.prototype.refresh=function(a){if(!appCtxt.inStartup){this.resetOverview(this.getOverviewId()); | |
AjxDispatcher.run("GetCalController").refreshHandler(a) | |
}}; | |
ZmCalendarApp.prototype.runRefresh=function(){appCtxt.getCalManager().getCalViewController().runRefresh() | |
}; | |
ZmCalendarApp.prototype.deleteNotify=function(a,b){if(!b&&this._deferNotifications("delete",a)){return | |
}AjxDispatcher.run("GetCalController").notifyDelete(a) | |
}; | |
ZmCalendarApp.prototype.createNotify=function(e,g){if(!e.folder&&!e.appt&&!e.link){return | |
}if(!g&&!this._noDefer&&this._deferNotifications("create",e)){return | |
}var a=AjxDispatcher.run("GetCalController"); | |
for(var b in e){var f=e[b]; | |
for(var d=0; | |
d<f.length; | |
d++){var c=f[d]; | |
if(appCtxt.cacheGet(c.id)){continue | |
}if(b=="folder"){this._handleCreateFolder(c,ZmOrganizer.CALENDAR) | |
}else{if(b=="link"){this._handleCreateLink(c,ZmOrganizer.CALENDAR) | |
}else{if(b=="appt"){a.notifyCreate(c) | |
}}}if((b=="folder"||b=="link")&&a){a._updateCheckedCalendars() | |
}}}}; | |
ZmCalendarApp.prototype.modifyNotify=function(b,a){if(!a&&!this._noDefer&&this._deferNotifications("modify",b)){return | |
}AjxDispatcher.run("GetCalController").notifyModify(b) | |
}; | |
ZmCalendarApp.prototype.preNotify=function(b){var a=AjxDispatcher.run("GetCalController"); | |
if(a){a.preNotify(b) | |
}}; | |
ZmCalendarApp.prototype.postNotify=function(b){var a=AjxDispatcher.run("GetCalController"); | |
if(a){a.postNotify(b) | |
}}; | |
ZmCalendarApp.prototype.handleOp=function(b){if(!appCtxt.isWebClientOffline()){switch(b){case ZmOperation.NEW_APPT:var a=new AjxCallback(this,this._handleLoadNewAppt); | |
AjxDispatcher.require(["MailCore","CalendarCore","Calendar"],false,a,null,true); | |
break; | |
case ZmOperation.NEW_CALENDAR:var a=new AjxCallback(this,this._handleLoadNewCalendar); | |
AjxDispatcher.require(["MailCore","CalendarCore","Calendar"],false,a,null,true); | |
break; | |
case ZmOperation.ADD_EXTERNAL_CALENDAR:var a=new AjxCallback(this,this._handleLoadExternalCalendar); | |
AjxDispatcher.require(["MailCore","CalendarCore","Calendar"],false,a,null,true); | |
break | |
}}}; | |
ZmCalendarApp.prototype._handleLoadNewAppt=function(){Dwt.setLoadingTime("ZmCalendarApp-newAppt"); | |
AjxDispatcher.run("GetCalController").newAppointment(null,null,null,null); | |
Dwt.setLoadedTime("ZmCalendarApp-newAppt") | |
}; | |
ZmCalendarApp.prototype._handleLoadNewCalendar=function(){appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING); | |
var a=appCtxt.getNewCalendarDialog(); | |
if(!this._newCalendarCb){this._newCalendarCb=new AjxCallback(this,this._newCalendarCallback) | |
}ZmController.showDialog(a,this._newCalendarCb) | |
}; | |
ZmCalendarApp.prototype._handleLoadExternalCalendar=function(){appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING); | |
var b=appCtxt.getOverviewController(); | |
var a=b.getTreeController(ZmOrganizer.CALENDAR); | |
if(a){a._addExternalCalendarListener() | |
}}; | |
ZmCalendarApp.prototype.launch=function(b,c){this._setLaunchTime(this.toString(),new Date()); | |
var a=new AjxCallback(this,this._handleLoadLaunch,[b,c]); | |
AjxDispatcher.require(["MailCore","ContactsCore","CalendarCore","Calendar"],true,a,null,true) | |
}; | |
ZmCalendarApp.prototype._handleLoadLaunch=function(f,h){var g=AjxDispatcher.run("GetCalController"); | |
var b=g.getDefaultViewType(); | |
var e=null; | |
f=f||{}; | |
if(f.qsParams){var d=f.qsParams.view; | |
if(d){var a=ZmCalendarApp.VIEW_FOR_SETTING[d]; | |
if(a){b=a; | |
var c=f.qsParams.date; | |
if(c){c=AjxDateUtil.parseServerDateTime(c); | |
if(c&&!isNaN(c)){e=new Date((c).setHours(0,0,0,0)) | |
}}}}}if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){this.initResources() | |
}ZmCalendarApp.postLoadSetDefaultReminderValue(); | |
g.show(b,e); | |
this._setLoadedTime(this.toString(),new Date()); | |
if(h){h.run() | |
}this._setRefreshButtonTooltip() | |
}; | |
ZmCalendarApp.prototype.getNewButtonProps=function(){return{text:ZmMsg.newAppt,tooltip:ZmMsg.createNewAppt,icon:"NewAppointment",iconDis:"NewAppointmentDis",defaultId:ZmOperation.NEW_APPT,disabled:!this.containsWritableFolder()} | |
}; | |
ZmCalendarApp.prototype.showSearchResults=function(a,b){if(b){b.run(AjxDispatcher.run("GetCalController")) | |
}}; | |
ZmCalendarApp.prototype.activate=function(d,a){this._createDeferredFolders(ZmApp.CALENDAR); | |
ZmApp.prototype.activate.apply(this,arguments); | |
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){var c=appCtxt.getAppViewMgr(); | |
var b=(d||appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL))&&!c.isHidden(ZmAppViewMgr.C_TREE_FOOTER,a); | |
AjxDispatcher.run("ShowMiniCalendar",b) | |
}}; | |
ZmCalendarApp.prototype.resetWebClientOfflineOperations=function(){ZmApp.prototype.resetWebClientOfflineOperations.apply(this); | |
var a=this.getCalController(); | |
if(a){a._resetToolbarOperations(); | |
a._clearViewActionMenu() | |
}}; | |
ZmCalendarApp.prototype.showMiniCalendar=function(a,b){var c=AjxDispatcher.run("GetCalController").getMiniCalendar(b); | |
c.setSkipNotifyOnPage(a&&!this._active); | |
if(!this._active){c.setSelectionMode(DwtCalendar.DAY) | |
}appCtxt.getAppViewMgr().displayComponent(ZmAppViewMgr.C_TREE_FOOTER,a) | |
}; | |
ZmCalendarApp.prototype.getListController=function(){return AjxDispatcher.run("GetCalController") | |
}; | |
ZmCalendarApp.prototype.getCalController=function(b,a){AjxDispatcher.require(["Startup2","MailCore","CalendarCore"]); | |
return this.getSessionController({controllerClass:"ZmCalViewController",sessionId:b||ZmApp.MAIN_SESSION,searchResultsController:a}) | |
}; | |
ZmCalendarApp.prototype.getFreeBusyCache=function(){if(!this._freeBusyCache){AjxDispatcher.require(["MailCore","CalendarCore"]); | |
this._freeBusyCache=new ZmFreeBusyCache(this) | |
}return this._freeBusyCache | |
}; | |
ZmCalendarApp.prototype.getReminderController=function(){if(!this._reminderController){AjxDispatcher.require(["MailCore","CalendarCore"]); | |
var a=appCtxt.getCalManager(); | |
this._reminderController=a.getReminderController(); | |
this._reminderController._calController=AjxDispatcher.run("GetCalController") | |
}return this._reminderController | |
}; | |
ZmCalendarApp.prototype.getApptComposeController=function(a){AjxDispatcher.require(["MailCore","CalendarCore","Calendar","CalendarAppt"]); | |
return this.getSessionController({controllerClass:"ZmApptComposeController",sessionId:a}) | |
}; | |
ZmCalendarApp.prototype.getSimpleApptComposeController=function(){AjxDispatcher.require(["MailCore","CalendarCore","Calendar","CalendarAppt"]); | |
return this.getSessionController({controllerClass:"ZmSimpleApptComposeController"}) | |
}; | |
ZmCalendarApp.prototype.getApptViewController=function(a){AjxDispatcher.require(["MailCore","CalendarCore","Calendar","CalendarAppt"]); | |
return this.getSessionController({controllerClass:"ZmApptController",sessionId:a}) | |
}; | |
ZmCalendarApp.prototype.initResources=function(){if(!this._locations){this._locations=new ZmResourceList(ZmCalBaseItem.LOCATION); | |
this._locations.isCanonical=true | |
}if(!this._equipment){this._equipment=new ZmResourceList(ZmCalBaseItem.EQUIPMENT); | |
this._equipment.isCanonical=true | |
}}; | |
ZmCalendarApp.prototype.loadResources=function(){this.initResources(); | |
if(appCtxt.get(ZmSetting.GAL_ENABLED)){var a=new ZmBatchCommand(); | |
if(!this._locations.isLoaded){a.add(new AjxCallback(this._locations,this._locations.load)) | |
}if(!this._equipment.isLoaded){a.add(new AjxCallback(this._equipment,this._equipment.load)) | |
}if(a._cmds.length){a.run() | |
}}}; | |
ZmCalendarApp.prototype.getLocations=function(){this.initResources(); | |
return this._locations | |
}; | |
ZmCalendarApp.prototype.getEquipment=function(){this.initResources(); | |
return this._equipment | |
}; | |
ZmCalendarApp.prototype.getReminderCalendarFolderIds=function(){var c=[]; | |
if(AjxDispatcher.loaded("CalendarCore")){c=AjxDispatcher.run("GetCalController").getReminderCalendarFolderIds() | |
}else{this._folderNames={}; | |
for(var a=0; | |
a<this._deferredFolders.length; | |
a++){var b=this._deferredFolders[a]; | |
c.push(b.obj.id); | |
this._folderNames[b.obj.id]=b.obj.name | |
}}return c | |
}; | |
ZmCalendarApp.prototype.getCheckedCalendarFolderIds=function(a,c){var f=[]; | |
if(AjxDispatcher.loaded("CalendarCore")){f=AjxDispatcher.run("GetCalController").getCheckedCalendarFolderIds(a,c) | |
}else{this._folderNames={}; | |
for(var b=0; | |
b<this._deferredFolders.length; | |
b++){var e=this._deferredFolders[b]; | |
var d=(e&&e.obj&&e.obj.f)?e.obj.f:""; | |
if(d&&(d.indexOf(ZmOrganizer.FLAG_CHECKED)!=-1)){if(a&&e.obj.zid!=null){continue | |
}if(e.obj.id==ZmOrganizer.ID_TRASH&&!c){continue | |
}f.push(e.obj.id); | |
this._folderNames[e.obj.id]=e.obj.name | |
}}}return f | |
}; | |
ZmCalendarApp.prototype.getCalendarName=function(a){return appCtxt.getById(a)?appCtxt.getById(a).name:this._folderNames[a] | |
}; | |
ZmCalendarApp.createMiniCalButton=function(l,h,g,b,c){var f={parent:l}; | |
if(c===false){f.id=h | |
}var j=new DwtButton(f); | |
j.addDropDownSelectionListener(g); | |
j.addSelectionListener(g); | |
j.setDropDownHovImage(null); | |
j.setData(Dwt.KEY_ID,h); | |
if(AjxEnv.isIE){j.setSize("20") | |
}var i=new DwtMenu({parent:j,style:DwtMenu.CALENDAR_PICKER_STYLE}); | |
i.setSize("150"); | |
i._table.width="100%"; | |
j.setMenu(i,true); | |
var a=new DwtCalendar({parent:i}); | |
a.setData(Dwt.KEY_ID,h); | |
a.setSkipNotifyOnPage(true); | |
var e=appCtxt.get(ZmSetting.CAL_FIRST_DAY_OF_WEEK)||0; | |
a.setFirstDayOfWeek(e); | |
a.addSelectionListener(b); | |
var k=appCtxt.getSettings().getSetting(ZmSetting.CAL_FIRST_DAY_OF_WEEK); | |
if(k){var d=new AjxListener(null,ZmCalendarApp._settingChangeListener,a); | |
k.addChangeListener(d) | |
}if(c!==false){j.reparentHtmlElement(h) | |
}return j | |
}; | |
ZmCalendarApp.createReminderButton=function(h,d,k,c){var e=new DwtButton({parent:h}); | |
e.addDropDownSelectionListener(k); | |
e.setData(Dwt.KEY_ID,d); | |
if(AjxEnv.isIE){e.setSize("20") | |
}var g=new DwtMenu({parent:e,style:DwtMenu.DROPDOWN_STYLE}); | |
g.setSize("150"); | |
e.setMenu(g,true); | |
var f=appCtxt.get(ZmSetting.CAL_REMINDER_WARNING_TIME); | |
for(var a=0; | |
a<ZmCalendarApp.reminderTimeWarningDisplayMsgs.length; | |
a++){var j=ZmCalendarApp.__formatLabel(ZmCalendarApp.reminderTimeWarningDisplayMsgs[a],ZmCalendarApp.reminderTimeWarningLabels[a]); | |
var b=new DwtMenuItem({parent:g,style:DwtMenuItem.NO_STYLE}); | |
b.setText(j); | |
b.setData("value",ZmCalendarApp.reminderTimeWarningValues[a]); | |
if(c){b.addSelectionListener(c) | |
}}e.reparentHtmlElement(d); | |
delete d; | |
return e | |
}; | |
ZmCalendarApp.getReminderSummary=function(a){var d=((a%60)==0); | |
var c=((a%(60*24))==0); | |
var b=((a%(60*24*7))==0); | |
if(a===-1){return ZmMsg.apptRemindNever | |
}if(a===0){return ZmMsg.apptRemindAtEventTime | |
}if(b){return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNWeeksBefore,a/(60*24*7)) | |
}if(c){return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNDaysBefore,a/(60*24)) | |
}if(d){return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNHoursBefore,a/60) | |
}return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNMinutesBefore,a) | |
}; | |
ZmCalendarApp._settingChangeListener=function(c,b){if(b.type!=ZmEvent.S_SETTING){return | |
}var a=b.source; | |
if(a.id==ZmSetting.CAL_FIRST_DAY_OF_WEEK){c.setFirstDayOfWeek(a.getValue()) | |
}}; | |
ZmCalendarApp.prototype._newCalendarCallback=function(f,d,b,c,g){var e=appCtxt.getNewCalendarDialog(); | |
e.popdown(); | |
var a=appCtxt.getOverviewController(); | |
a.getTreeController(ZmOrganizer.CALENDAR)._doCreate(f,d,b,c,g) | |
}; | |
ZmCalendarApp.addInviteReplyMenu=function(a){var b=[ZmOperation.EDIT_REPLY_ACCEPT,ZmOperation.EDIT_REPLY_TENTATIVE,ZmOperation.EDIT_REPLY_DECLINE]; | |
var c=new ZmActionMenu({parent:a,menuItems:b}); | |
a.setMenu(c); | |
return c | |
}; | |
ZmCalendarApp.addCalViewMenu=function(a){var b=[ZmOperation.DAY_VIEW,ZmOperation.WORK_WEEK_VIEW,ZmOperation.WEEK_VIEW,ZmOperation.MONTH_VIEW,ZmOperation.CAL_LIST_VIEW]; | |
if(appCtxt.get(ZmSetting.FREE_BUSY_VIEW_ENABLED)){b.push(ZmOperation.FB_VIEW) | |
}var c=new ZmActionMenu({parent:a,menuItems:b}); | |
a.setMenu(c); | |
return c | |
}; | |
ZmCalendarApp.__formatLabel=function(b,a){b=b||""; | |
return b.match(/\{/)?AjxMessageFormat.format(b,a):b | |
}; | |
ZmCalendarApp.parseReminderString=function(l){var j={}; | |
j[ZmMsg.apptRemindNDaysBefore]=ZmCalItem.REMINDER_UNIT_DAYS; | |
j[ZmMsg.apptRemindNMinutesBefore]=ZmCalItem.REMINDER_UNIT_MINUTES; | |
j[ZmMsg.apptRemindNHoursBefore]=ZmCalItem.REMINDER_UNIT_HOURS; | |
j[ZmMsg.apptRemindNWeeksBefore]=ZmCalItem.REMINDER_UNIT_WEEKS; | |
l=AjxStringUtil.trim(l); | |
var k=l; | |
var g=k.replace(/\D/g,""); | |
g=AjxStringUtil.trim(g); | |
if(l===ZmMsg.apptRemindAtEventTime){return{reminderValue:0,reminderUnits:ZmCalItem.REMINDER_UNIT_MINUTES} | |
}if(g==""){return{reminderValue:"",reminderUnits:ZmCalItem.REMINDER_NONE} | |
}if(g.indexOf(" ")>=0){g=g.split(" ")[0] | |
}for(var h in j){var b=ZmCalendarApp.__formatLabel(h,g); | |
if(b!=""&&b.toLowerCase()==l.toLowerCase()){return{reminderValue:g,reminderUnits:j[h],before:true} | |
}}var f=parseInt(g); | |
var d={}; | |
d[ZmCalItem.REMINDER_UNIT_MINUTES]=AjxMsg.minute; | |
d[ZmCalItem.REMINDER_UNIT_HOURS]=AjxMsg.hour; | |
d[ZmCalItem.REMINDER_UNIT_DAYS]=AjxMsg.day; | |
d[ZmCalItem.REMINDER_UNIT_WEEKS]=AjxMsg.week; | |
var c=ZmCalItem.REMINDER_UNIT_HOURS; | |
for(var e in d){if(k.indexOf(d[e])>=0){c=e; | |
return{reminderValue:f?f:0,reminderUnits:c} | |
}}var a={}; | |
a[ZmCalItem.REMINDER_UNIT_MINUTES]=AjxMsg.minutes; | |
a[ZmCalItem.REMINDER_UNIT_HOURS]=AjxMsg.hours; | |
a[ZmCalItem.REMINDER_UNIT_DAYS]=AjxMsg.days; | |
a[ZmCalItem.REMINDER_UNIT_WEEKS]=AjxMsg.weeks; | |
for(var e in a){if(k.indexOf(a[e])>=0){c=e; | |
return{reminderValue:f?f:0,reminderUnits:c} | |
}}return{reminderValue:f?f:0,reminderUnits:c} | |
}; | |
ZmCalendarApp.convertReminderUnits=function(a,b){switch(b){case ZmCalItem.REMINDER_UNIT_MINUTES:return a; | |
case ZmCalItem.REMINDER_UNIT_HOURS:return a*60; | |
case ZmCalItem.REMINDER_UNIT_DAYS:return a*60*24; | |
case ZmCalItem.REMINDER_UNIT_WEEKS:return a*60*24*7; | |
default:return 0 | |
}}; | |
ZmCalendarApp.prototype.updateResourceCache=function(c){var b=c.getFullName(); | |
if(b){this._resByName[b.toLowerCase()]=c | |
}var a=c.getEmail(); | |
if(a){this._resByEmail[a.toLowerCase()]=c | |
}}; | |
ZmCalendarApp.prototype._addSettingsChangeListeners=function(){ZmApp.prototype._addSettingsChangeListeners.call(this); | |
if(!this._settingsListener){this._settingsListener=new AjxListener(this,this._settingsChangeListener) | |
}var b=appCtxt.getSettings(); | |
var a=b.getSetting(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL); | |
if(a){a.addChangeListener(this._settingListener) | |
}a=b.getSetting(ZmSetting.CAL_FIRST_DAY_OF_WEEK); | |
if(a){a.addChangeListener(this._settingListener) | |
}a=b.getSetting(ZmSetting.CAL_WORKING_HOURS); | |
if(a){a.addChangeListener(this._settingListener) | |
}a=b.getSetting(ZmSetting.CAL_SHOW_DECLINED_MEETINGS); | |
if(a){a.addChangeListener(this._settingListener) | |
}var b=appCtxt.getSettings(); | |
b.getSetting(ZmSetting.CAL_SHOW_CALENDAR_WEEK).addChangeListener(this._settingListener); | |
b.addChangeListener(this._settingsListener) | |
}; | |
ZmCalendarApp.prototype._settingChangeListener=function(g){if(g.type!=ZmEvent.S_SETTING){return | |
}var i=g.source; | |
if(i.id==ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL){if(i.getValue()){var c=appCtxt.getAppViewMgr(); | |
var h=!c.isHidden(ZmAppViewMgr.C_TREE_FOOTER,c.getCurrentViewId()); | |
AjxDispatcher.run("ShowMiniCalendar",h) | |
}else{if(!this._active){AjxDispatcher.run("ShowMiniCalendar",false) | |
}}}else{if(i.id==ZmSetting.CAL_FIRST_DAY_OF_WEEK){var f=AjxDispatcher.run("GetCalController"); | |
var e=f.getMiniCalendar(); | |
var a=i.getValue(); | |
e.setFirstDayOfWeek(a); | |
var b=e.getDate(); | |
f.setDate(b,0,true) | |
}else{if(i.id==ZmSetting.CAL_WORKING_HOURS){var f=AjxDispatcher.run("GetCalController"); | |
var d=f.getViewMgr(); | |
if(d){d.layoutWorkingHours() | |
}}else{if(i.id==ZmSetting.CAL_SHOW_DECLINED_MEETINGS){var f=AjxDispatcher.run("GetCalController"); | |
f.refreshCurrentView() | |
}}}}}; | |
ZmCalendarApp.prototype._settingsChangeListener=function(d){if(d.type!=ZmEvent.S_SETTINGS){return | |
}var e=d.getDetail("settings"); | |
if(!(e&&e.length)){return | |
}for(var b=0; | |
b<e.length; | |
b++){var c=e[b]; | |
if(c.id==ZmSetting.CAL_SHOW_CALENDAR_WEEK){var a=AjxDispatcher.run("GetCalController").recreateMiniCalendar(); | |
var f=appCtxt.getCalManager(); | |
f.highlightMiniCal() | |
}}}; | |
ZmCalendarApp.prototype.showDayView=function(c){var b=AjxDispatcher.run("GetCalController"); | |
var a=b.getMiniCalendar(); | |
b.setDate(c,0,a.getForceRollOver()); | |
if(!b._viewVisible){b.show(ZmId.VIEW_CAL_DAY) | |
}}; | |
ZmCalendarApp.prototype.getDateToolTip=function(a,b){var c=AjxDispatcher.run("GetCalController"); | |
return c.getDayToolTipText(a,null,null,true,b) | |
}; | |
ZmCalendarApp.prototype.importAppointment=function(d,c,b){var a=new AjxCallback(this,this._handleImportAppointment,[d,c,b]); | |
AjxDispatcher.require(["MailCore","CalendarCore","Calendar"],false,a) | |
}; | |
ZmCalendarApp.prototype._handleImportAppointment=function(d,c,b){if(this._deferredFolders.length!=0){this._createDeferredFolders(ZmApp.CALENDAR) | |
}var e=this._copyToDialog=appCtxt.getChooseFolderDialog(); | |
var a=new AjxCallback(this,this._chooserCallback,[d,c,b]); | |
ZmController.showDialog(e,a,this._getCopyParams(e,d,c)) | |
}; | |
ZmCalendarApp.prototype._getCopyParams=function(c,b,a){return{data:{msgId:b,partId:a},treeIds:[ZmOrganizer.CALENDAR],overviewId:c.getOverviewId(this._name),title:ZmMsg.addToCalendar,description:ZmMsg.targetFolder,appName:ZmApp.CALENDAR} | |
}; | |
ZmCalendarApp.prototype._chooserCallback=function(f,e,b,d){var h={ImportAppointmentsRequest:{_jsns:"urn:zimbraMail"}}; | |
var c=h.ImportAppointmentsRequest; | |
c.l=d.id; | |
c.ct="text/calendar"; | |
var a=c.content={}; | |
a.mid=f; | |
a.part=e; | |
var g={jsonObj:h,asyncMode:true,callback:(new AjxCallback(this,this._handleImportApptResponse,[d.id])),errorCallback:(new AjxCallback(this,this._handleImportApptError))}; | |
appCtxt.getAppController().sendRequest(g) | |
}; | |
ZmCalendarApp.prototype._handleImportApptResponse=function(a,b){appCtxt.getAppController().setStatusMsg(ZmMsg.addedToCalendar); | |
appCtxt.getChooseFolderDialog().popdown(); | |
var c=window.parentAppCtxt||window.appCtxt; | |
if(c.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){var d=c.getCalManager(); | |
d.getMiniCalCache().clearCache(); | |
d.highlightMiniCal() | |
}}; | |
ZmCalendarApp.prototype._handleImportApptError=function(a){appCtxt.getAppController().setStatusMsg(ZmMsg.errorImportAppt,ZmStatusView.LEVEL_CRITICAL) | |
}; | |
ZmCalendarApp.getReminderTimeWarningDisplayOptions=function(){var b=[]; | |
for(var a=0; | |
a<ZmCalendarApp.reminderTimeWarningDisplayMsgs.length; | |
a++){b.push(ZmCalendarApp.__formatLabel(ZmCalendarApp.reminderTimeWarningDisplayMsgs[a],ZmCalendarApp.reminderTimeWarningLabels[a])) | |
}return b | |
}; | |
ZmCalendarApp.getDefaultCalendarFolders=function(){var n=ZmOrganizer.ITEM_ORGANIZER[ZmId.ITEM_APPOINTMENT]; | |
var j=[]; | |
var h=[]; | |
var o=[]; | |
var l=[]; | |
var d; | |
var e=appCtxt.accountList.visibleAccounts; | |
for(var k=0; | |
k<e.length; | |
k++){var m=e[k]; | |
var g=ZmApp.SETTING[ZmItem.APP[ZmId.ITEM_APPOINTMENT]]; | |
if((appCtxt.isOffline&&m.isMain)||!appCtxt.get(g,null,m)){continue | |
}d=appCtxt.getFolderTree(m); | |
j=j.concat(d.getByType(n)) | |
}if(appCtxt.isOffline){d=appCtxt.getFolderTree(appCtxt.accountList.mainAccount); | |
j=j.concat(d.getByType(n)) | |
}for(var k=0; | |
k<j.length; | |
k++){var b=j[k]; | |
var m=b.getAccount(); | |
if(b.noSuchFolder||b.isFeed()||(b.link&&b.isReadOnly())||b.isInTrash()){continue | |
}if(appCtxt.multiAccounts&&b.nId==ZmOrganizer.ID_CALENDAR&&m.isCalDavBased()){continue | |
}var c=b.link?b.getRemoteId():b.id; | |
var f=appCtxt.multiAccounts?m.getIcon():b.getIconWithColor(); | |
var a=AjxStringUtil.htmlDecode(appCtxt.multiAccounts?([b.getName()," (",m.getDisplayName(),")"].join("")):b.getName()); | |
h.push(a); | |
o.push(c); | |
l.push(f) | |
}return{displayOptions:h,options:o,images:l} | |
}; | |
ZmCalendarApp.setDefaultReminderTimePrefValueOnSave=function(a,c,b){c===0?(c=-1):(c===-1?c=0:""); | |
a.setValue(c); | |
b.push(a) | |
}; | |
ZmCalendarApp.postLoadSetDefaultReminderValue=function(){if(ZmCalendarApp.postLoadSetReminderCalled){return | |
}var a=appCtxt.get(ZmSetting.CAL_REMINDER_WARNING_TIME); | |
if(a===-1||a===0){a===-1?(a=0):(a=-1); | |
appCtxt.set(ZmSetting.CAL_REMINDER_WARNING_TIME,a) | |
}ZmCalendarApp.postLoadSetReminderCalled=true | |
} | |
}if(AjxPackage.define("zimbraMail.tasks.ZmTasksApp")){ZmTasksApp=function(a){ZmApp.call(this,ZmApp.TASKS,a) | |
}; | |
ZmTasksApp.prototype=new ZmApp; | |
ZmTasksApp.prototype.constructor=ZmTasksApp; | |
ZmTasksApp.prototype.isZmTasksApp=true; | |
ZmTasksApp.prototype.toString=function(){return"ZmTasksApp" | |
}; | |
ZmEvent.S_TASK=ZmId.ITEM_TASK; | |
ZmItem.TASK=ZmEvent.S_TASK; | |
ZmOrganizer.TASKS=ZmEvent.S_TASK; | |
ZmApp.TASKS=ZmId.APP_TASKS; | |
ZmApp.CLASS[ZmApp.TASKS]="ZmTasksApp"; | |
ZmApp.SETTING[ZmApp.TASKS]=ZmSetting.TASKS_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.TASKS]=45; | |
ZmApp.QS_ARG[ZmApp.TASKS]="tasks"; | |
ZmTasksApp.REMINDER_START_DELAY=10000; | |
ZmTasksApp.prototype._defineAPI=function(){AjxDispatcher.setPackageLoadFunction("TasksCore",new AjxCallback(this,this._postLoadCore)); | |
AjxDispatcher.setPackageLoadFunction("Tasks",new AjxCallback(this,this._postLoad,ZmOrganizer.TASKS)); | |
AjxDispatcher.registerMethod("GetTaskListController",["TasksCore","Tasks"],new AjxCallback(this,this.getTaskListController)); | |
AjxDispatcher.registerMethod("GetTaskController",["TasksCore","Tasks"],new AjxCallback(this,this.getTaskController)) | |
}; | |
ZmTasksApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_NEW_TASK,{textKey:"newTask",tooltipKey:"newTaskTooltip",image:"NewTask",shortcut:ZmKeyMap.NEW_TASK}); | |
ZmOperation.registerOp(ZmId.OP_NEW_TASK_FOLDER,{textKey:"newTaskFolder",tooltipKey:"newTaskFolderTooltip",image:"NewTaskList"}); | |
ZmOperation.registerOp(ZmId.OP_SHARE_TASKFOLDER,{textKey:"shareTaskFolder",image:"TaskList"}); | |
ZmOperation.registerOp(ZmId.OP_PRINT_TASK,{textKey:"printTask",image:"Print",shortcut:ZmKeyMap.PRINT},ZmSetting.PRINT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_PRINT_TASKFOLDER,{textKey:"printTaskFolder",image:"Print"},ZmSetting.PRINT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SORTBY_MENU,{tooltipKey:"viewTooltip",textKey:"taskFilterBy",image:"SplitPane",textPrecedence:80}); | |
ZmOperation.registerOp(ZmId.OP_MARK_AS_COMPLETED,{tooltipKey:"markAsCompleted",textKey:"markAsCompleted",image:"CheckboxChecked",textPrecedence:80}) | |
}; | |
ZmTasksApp.prototype._registerSettings=function(a){a=a||appCtxt.getSettings(); | |
a.registerSetting("READING_PANE_LOCATION_TASKS",{name:"zimbraPrefTasksReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}); | |
a.registerSetting("TASKS_FILTERBY",{name:"zimbraPrefTasksFilterBy",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.TASK_FILTER_ALL,isImplicit:true}); | |
if(!appCtxt.get(ZmSetting.HIGHLIGHT_OBJECTS)){a.registerSetting("HIGHLIGHT_OBJECTS",{name:"zimbraMailHighlightObjectsMaxSize",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:70}) | |
}}; | |
ZmTasksApp.prototype._registerItems=function(){ZmItem.registerItem(ZmItem.TASK,{app:ZmApp.TASKS,nameKey:"task",icon:"TasksApp",soapCmd:"ItemAction",itemClass:"ZmTask",node:"task",organizer:ZmOrganizer.TASKS,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.TASKS],searchType:"task",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("TasksCore"); | |
return new ZmList(ZmItem.TASK,a) | |
},this)}) | |
}; | |
ZmTasksApp.prototype._registerOrganizers=function(){ZmOrganizer.registerOrg(ZmOrganizer.TASKS,{app:ZmApp.TASKS,nameKey:"tasksFolder",defaultFolder:ZmFolder.ID_TASKS,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmTaskFolder",orgPackage:"TasksCore",treeController:"ZmTaskTreeController",labelKey:"taskLists",itemsKey:"tasks",folderKey:"tasksFolder",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,views:["task"],createFunc:"ZmOrganizer.create",compareFunc:"ZmFolder.sortCompareNonMail",deferrable:true,newOp:ZmOperation.NEW_TASK_FOLDER,displayOrder:100}) | |
}; | |
ZmTasksApp.prototype._setupSearchToolbar=function(){ZmSearchToolBar.addMenuItem(ZmItem.TASK,{msgKey:"tasks",tooltipKey:"searchTasks",icon:"TasksApp",shareIcon:"SharedTaskList",setting:ZmSetting.TASKS_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_TASK),disableOffline:true}) | |
}; | |
ZmTasksApp.prototype._registerApp=function(){var c={}; | |
c[ZmOperation.NEW_TASK]="task"; | |
var b={}; | |
b[ZmOperation.NEW_TASK_FOLDER]="tasksFolder"; | |
var a={}; | |
a[ZmKeyMap.NEW_TASK]=ZmOperation.NEW_TASK; | |
ZmApp.registerApp(ZmApp.TASKS,{mainPkg:"Tasks",nameKey:"tasks",icon:"TasksApp",textPrecedence:20,chooserTooltipKey:"goToTasks",defaultSearch:ZmItem.TASK,organizer:ZmOrganizer.TASKS,overviewTrees:[ZmOrganizer.TASKS,ZmOrganizer.SEARCH,ZmOrganizer.TAG],newItemOps:c,newOrgOps:b,actionCodes:a,searchTypes:[ZmItem.TASK],gotoActionCode:ZmKeyMap.GOTO_TASKS,newActionCode:ZmKeyMap.NEW_TASK,chooserSort:35,defaultSort:25,searchResultsTab:true}) | |
}; | |
ZmTasksApp.prototype.postNotify=function(a){if(this._checkReplenishListView){var c=a.modified&&a.modified.task; | |
var b; | |
if(c){b=c[0].items[0] | |
}this._checkReplenishListView._checkReplenish(b,true); | |
this._checkReplenishListView=null | |
}}; | |
ZmTasksApp.prototype.handleOp=function(c,b){switch(c){case ZmOperation.NEW_TASK:b=b||{}; | |
var a=new AjxCallback(this,this._handleLoadNewTask,[b]); | |
AjxDispatcher.require(["TasksCore","Tasks"],false,a,null,true); | |
break; | |
case ZmOperation.NEW_TASK_FOLDER:var a=new AjxCallback(this,this._handleLoadNewTaskFolder); | |
AjxDispatcher.require(["TasksCore","Tasks"],false,a,null,true); | |
break | |
}}; | |
ZmTasksApp.prototype._handleLoadNewTask=function(a){a.folderId=a.folderId||this.getTaskListController()._folderId; | |
AjxDispatcher.run("GetTaskController").show((new ZmTask(null,null,a&&a.folderId))) | |
}; | |
ZmTasksApp.prototype._handleLoadNewTaskFolder=function(){appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING); | |
var a=appCtxt.getNewTaskFolderDialog(); | |
if(!this._newTaskFolderCb){this._newTaskFolderCb=new AjxCallback(this,this._newTaskFolderCallback) | |
}ZmController.showDialog(a,this._newTaskFolderCb) | |
}; | |
ZmTasksApp.prototype.createNotify=function(j,b){if(!j.folder&&!j.task&&!j.link){return | |
}if(!b&&this._deferNotifications("create",j)){return | |
}for(var a in j){var g=j[a]; | |
if(!g){continue | |
}for(var d=0; | |
d<g.length; | |
d++){var e=g[d]; | |
if(appCtxt.cacheGet(e.id)){continue | |
}if(a=="folder"){this._handleCreateFolder(e,ZmOrganizer.TASKS) | |
}else{if(a=="link"){this._handleCreateLink(e,ZmOrganizer.TASKS) | |
}else{if(a=="task"){var h=AjxDispatcher.run("GetTaskListController").getList(); | |
if(h&&!AjxUtil.isEmpty(e.inv)&&!AjxUtil.isEmpty(e.inv[0].comp)){var c=h.controller.getAllowableTaskStatus(); | |
var f=e.inv[0].comp[0].status; | |
if(!c||c.indexOf(f)!==-1){h.notifyCreate(e) | |
}}}}}}}}; | |
ZmTasksApp.prototype.launch=function(b,c){this._setLaunchTime(this.toString(),new Date()); | |
var a=new AjxCallback(this,this._handleLoadLaunch,c); | |
AjxDispatcher.require(["TasksCore","Tasks"],true,a,null,true) | |
}; | |
ZmTasksApp.prototype._handleLoadLaunch=function(b){var a=this._getExternalAccount(); | |
this.search(null,null,null,null,(a&&a.name)); | |
if(b){b.run() | |
}}; | |
ZmTasksApp.prototype.getNewButtonProps=function(){return{text:ZmMsg.newTask,tooltip:ZmMsg.createNewTask,icon:"NewTask",iconDis:"NewTaskDis",defaultId:ZmOperation.NEW_TASK,disabled:!this.containsWritableFolder()} | |
}; | |
ZmTasksApp.prototype.showSearchResults=function(b,d,c){var a=this._handleLoadShowSearchResults.bind(this,b,d,c); | |
AjxDispatcher.require("Tasks",false,a,null,true) | |
}; | |
ZmTasksApp.prototype._handleLoadShowSearchResults=function(c,f,d){var b=c&&c.search&&c.search.isSimple()&&c.search.folderId||null; | |
var e=d?d.getCurrentViewId():ZmApp.MAIN_SESSION; | |
var a=AjxDispatcher.run("GetTaskListController",e,d); | |
a.show(c,b); | |
this._setLoadedTime(this.toString(),new Date()); | |
if(f){f.run(a) | |
}}; | |
ZmTasksApp.prototype.runRefresh=function(){if(window.ZmTaskListController===undefined){return | |
}AjxDispatcher.run("GetTaskListController").runRefresh() | |
}; | |
ZmTasksApp.prototype.getListController=function(){return AjxDispatcher.run("GetTaskListController") | |
}; | |
ZmTasksApp.prototype.getTaskListController=function(b,a){return this.getSessionController({controllerClass:"ZmTaskListController",sessionId:b||ZmApp.MAIN_SESSION,searchResultsController:a}) | |
}; | |
ZmTasksApp.prototype.getTaskController=function(a){return this.getSessionController({controllerClass:"ZmTaskController",sessionId:a}) | |
}; | |
ZmTasksApp.prototype.newTaskFromMailItem=function(c,a){var b=c.subject||""; | |
if(c instanceof ZmConv){c=c.getFirstHotMsg() | |
}c.load({getHtml:false,callback:new AjxCallback(this,this._msgLoadedCallback,[c,a,b])}) | |
}; | |
ZmTasksApp.prototype._msgLoadedCallback=function(d,a,c){var b=new ZmTask(); | |
b.setEndDate(AjxDateUtil.roundTimeMins(a,30)); | |
b.setFromMailMessage(d,c); | |
this.getTaskController().show(b,ZmCalItem.MODE_NEW,true) | |
}; | |
ZmTasksApp.prototype.search=function(c,a,e,h,b){var d=c?c.createQuery():""; | |
d=d||(appCtxt.isExternalAccount()?"inid:"+this.getDefaultFolderId():"in:tasks"); | |
var g={query:d,types:[ZmItem.TASK],limit:this.getLimit(),searchFor:ZmItem.TASK,callback:h,accountName:(b||(c&&c.getAccount().name))}; | |
var f=appCtxt.getSearchController(); | |
f.searchAllAccounts=false; | |
f.search(g) | |
}; | |
ZmTasksApp.prototype._newTaskFolderCallback=function(e,c,b){var d=appCtxt.getNewTaskFolderDialog(); | |
d.popdown(); | |
var a=appCtxt.getOverviewController(); | |
a.getTreeController(ZmOrganizer.TASKS)._doCreate(e,c,b) | |
}; | |
ZmTasksApp.prototype.getTaskFolderIds=function(a){var d=[]; | |
if(AjxDispatcher.loaded("TasksCore")){d=AjxDispatcher.run("GetTaskListController").getTaskFolderIds(a) | |
}else{this._folderNames={}; | |
for(var b=0; | |
b<this._deferredFolders.length; | |
b++){var c=this._deferredFolders[b]; | |
if(a&&c.obj.zid!=null){continue | |
}d.push(c.obj.id); | |
this._folderNames[c.obj.id]=c.obj.name | |
}}return d | |
}; | |
ZmTasksApp.prototype.getTaskFolderName=function(a){return appCtxt.getById(a)?appCtxt.getById(a).name:this._folderNames[a] | |
}; | |
ZmTasksApp.prototype.getReminderController=function(){if(!this._reminderController){AjxDispatcher.require("TasksCore"); | |
var a=appCtxt.getTaskManager(); | |
this._reminderController=a.getReminderController(); | |
this._reminderController._calController=a; | |
this._reminderController.refresh() | |
}return this._reminderController | |
}; | |
ZmTasksApp.createpCompleteButton=function(g,e,j,d){var a=new DwtButton({parent:g}); | |
a.addDropDownSelectionListener(j); | |
a.setData(Dwt.KEY_ID,e); | |
a.setSize("25"); | |
var f=new DwtMenu({parent:a,style:DwtMenu.DROPDOWN_STYLE}); | |
f.setSize("100"); | |
a.setMenu(f,true); | |
var h=new AjxMessageFormat(AjxMsg.percentageString); | |
for(var b=0; | |
b<=100; | |
b+=ZmTask.PCOMPLETE_INT){var c=new DwtMenuItem({parent:f,style:DwtMenuItem.NO_STYLE}); | |
c.setText((h.format(b))); | |
c.setData("value",b); | |
if(d){c.addSelectionListener(d) | |
}}a.reparentHtmlElement(e); | |
delete e; | |
return a | |
} | |
}if(AjxPackage.define("zimbraMail.abook.ZmContactsApp")){ZmContactsApp=function(b,a){ZmApp.call(this,ZmApp.CONTACTS,b,a); | |
this.contactsLoaded={}; | |
this._contactList={}; | |
this._initialized=false; | |
this._byEmail={}; | |
this._byPhone={}; | |
this._dlCache={} | |
}; | |
ZmContactsApp.prototype=new ZmApp; | |
ZmContactsApp.prototype.constructor=ZmContactsApp; | |
ZmContactsApp.prototype.isZmContactsApp=true; | |
ZmContactsApp.prototype.toString=function(){return"ZmContactsApp" | |
}; | |
ZmEvent.S_CONTACT=ZmId.ITEM_CONTACT; | |
ZmEvent.S_GROUP=ZmId.ITEM_GROUP; | |
ZmItem.CONTACT=ZmEvent.S_CONTACT; | |
ZmItem.GROUP=ZmEvent.S_GROUP; | |
ZmItem.GAL=ZmId.ITEM_GAL_CONTACT; | |
ZmOrganizer.ADDRBOOK=ZmId.ORG_ADDRBOOK; | |
ZmApp.CONTACTS=ZmId.APP_CONTACTS; | |
ZmApp.CLASS[ZmApp.CONTACTS]="ZmContactsApp"; | |
ZmApp.SETTING[ZmApp.CONTACTS]=ZmSetting.CONTACTS_ENABLED; | |
ZmApp.UPSELL_SETTING[ZmApp.CONTACTS]=ZmSetting.CONTACTS_UPSELL_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.CONTACTS]=30; | |
ZmApp.QS_ARG[ZmApp.CONTACTS]="contacts"; | |
ZmContactsApp.SEARCHFOR_CONTACTS=1; | |
ZmContactsApp.SEARCHFOR_GAL=2; | |
ZmContactsApp.SEARCHFOR_PAS=3; | |
ZmContactsApp.SEARCHFOR_FOLDERS=4; | |
ZmContactsApp.SEARCHFOR_HAB=5; | |
ZmContactsApp.SEARCHFOR_MAX=50; | |
ZmContactsApp.prototype._defineAPI=function(){AjxDispatcher.setPackageLoadFunction("ContactsCore",new AjxCallback(this,this._postLoadCore)); | |
AjxDispatcher.setPackageLoadFunction("Contacts",new AjxCallback(this,this._postLoad,ZmOrganizer.ADDRBOOK)); | |
AjxDispatcher.registerMethod("GetContacts","ContactsCore",new AjxCallback(this,this.getContactList)); | |
AjxDispatcher.registerMethod("GetContactsForAllAccounts","ContactsCore",new AjxCallback(this,this.getContactListForAllAccounts)); | |
AjxDispatcher.registerMethod("GetContactListController",["ContactsCore","Contacts"],new AjxCallback(this,this.getContactListController)); | |
AjxDispatcher.registerMethod("GetContactController",["ContactsCore","Contacts"],new AjxCallback(this,this.getContactController)) | |
}; | |
ZmContactsApp.prototype._registerSettings=function(a){var a=a||appCtxt.getSettings(); | |
a.registerSetting("AUTO_ADD_ADDRESS",{name:"zimbraPrefAutoAddAddressEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}); | |
a.registerSetting("AUTOCOMPLETE_LIMIT",{name:"zimbraContactAutoCompleteMaxResults",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:20}); | |
a.registerSetting("AUTOCOMPLETE_ON_COMMA",{name:"zimbraPrefAutoCompleteQuickCompletionOnComma",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("AUTOCOMPLETE_SHARE",{name:"zimbraPrefShareContactsInAutoComplete",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("AUTOCOMPLETE_SHARED_ADDR_BOOKS",{name:"zimbraPrefSharedAddrBookAutoCompleteEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("EXPORT",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("GAL_AUTOCOMPLETE",{name:"zimbraPrefGalAutoCompleteEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("IMPORT",{type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}); | |
a.registerSetting("MAX_CONTACTS",{name:"zimbraContactMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:0}); | |
a.registerSetting("NEW_ADDR_BOOK_ENABLED",{name:"zimbraFeatureNewAddrBookEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("PHONETIC_CONTACT_FIELDS",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:/^ja/.test(AjxEnv.DEFAULT_LOCALE)}); | |
a.registerSetting("DETAILED_CONTACT_SEARCH_ENABLED",{name:"zimbraFeatureContactsDetailedSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}) | |
}; | |
ZmContactsApp.prototype._registerPrefs=function(){var b={CONTACTS:{title:ZmMsg.addressBook,icon:"ContactsApp",templateId:"prefs.Pages#Contacts",priority:70,precondition:ZmSetting.CONTACTS_ENABLED,prefs:[ZmSetting.AUTO_ADD_ADDRESS,ZmSetting.AUTOCOMPLETE_ON_COMMA,ZmSetting.AUTOCOMPLETE_SHARE,ZmSetting.AUTOCOMPLETE_SHARED_ADDR_BOOKS,ZmSetting.EXPORT,ZmSetting.GAL_AUTOCOMPLETE,ZmSetting.INITIALLY_SEARCH_GAL,ZmSetting.IMPORT]}}; | |
for(var a in b){ZmPref.registerPrefSection(a,b[a]) | |
}ZmPref.registerPref("AUTO_ADD_ADDRESS",{displayName:ZmMsg.autoAddContacts,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("AUTOCOMPLETE_ON_COMMA",{displayName:ZmMsg.autocompleteOnComma,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("AUTOCOMPLETE_SHARE",{displayName:ZmMsg.autocompleteShare,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("AUTOCOMPLETE_SHARED_ADDR_BOOKS",{displayName:ZmMsg.autocompleteSharedAddrBooks,displayContainer:ZmPref.TYPE_CHECKBOX}); | |
ZmPref.registerPref("EXPORT",{loadFunction:ZmPref.loadCsvFormats,displayContainer:ZmPref.TYPE_EXPORT}); | |
ZmPref.registerPref("GAL_AUTOCOMPLETE",{displayName:ZmMsg.galAutocomplete,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:[ZmSetting.GAL_AUTOCOMPLETE_ENABLED,ZmSetting.GAL_ENABLED]}); | |
ZmPref.registerPref("IMPORT",{displayName:ZmMsg.importFromCSV,displayContainer:ZmPref.TYPE_IMPORT}); | |
ZmPref.registerPref("INITIALLY_SEARCH_GAL",{displayName:ZmMsg.initiallySearchGal,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:function(){return appCtxt.get(ZmSetting.GAL_ENABLED)&&appCtxt.getActiveAccount().isZimbraAccount | |
}}) | |
}; | |
ZmContactsApp.prototype._createVirtualFolders=function(){if(!window.ZmContactList||!window.ZmAddrBook){return | |
}ZmContactList.addDlFolder() | |
}; | |
ZmContactsApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_CONTACT); | |
ZmOperation.registerOp(ZmId.OP_EDIT_CONTACT,{textKey:"AB_EDIT_CONTACT",image:"Edit",shortcut:ZmKeyMap.EDIT}); | |
ZmOperation.registerOp(ZmId.OP_NEW_ADDRBOOK,{textKey:"newAddrBook",tooltipKey:"newAddrBookTooltip",image:"NewContactsFolder"},ZmSetting.NEW_ADDR_BOOK_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_NEW_CONTACT,{textKey:"newContact",tooltipKey:"newContactTooltip",image:"NewContact",shortcut:ZmKeyMap.NEW_CONTACT},ZmSetting.CONTACTS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_NEW_GROUP,{textKey:"newGroup",tooltipKey:"newGroupTooltip",image:"NewGroup"},ZmSetting.CONTACTS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_NEW_DISTRIBUTION_LIST,{textKey:"newDistList",tooltipKey:"newDistListTooltip",image:"NewGroup"},ZmSetting.CONTACTS_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_PRINT_CONTACT,{textKey:"printContact",image:"Print",shortcut:ZmKeyMap.PRINT},ZmSetting.PRINT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_PRINT_ADDRBOOK,{textKey:"printAddrBook",image:"Print"},ZmSetting.PRINT_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_SHARE_ADDRBOOK,{textKey:"shareAddrBook",image:"SharedContactsFolder"}) | |
}; | |
ZmContactsApp.prototype._registerItems=function(){ZmItem.registerItem(ZmItem.CONTACT,{app:ZmApp.CONTACTS,nameKey:"contact",icon:"Contact",soapCmd:"ContactAction",itemClass:"ZmContact",node:"cn",organizer:ZmOrganizer.ADDRBOOK,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.ZIMLET,ZmOrganizer.ADDRBOOK],searchType:"contact",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("ContactsCore"); | |
return new ZmContactList(a,a?a.isGalSearch||a.isGalAutocompleteSearch:null) | |
},this)}); | |
ZmItem.registerItem(ZmItem.GROUP,{nameKey:"group",icon:"Group",soapCmd:"ContactAction"}); | |
ZmItem.registerItem(ZmItem.GAL,{app:ZmApp.CONTACTS}) | |
}; | |
ZmContactsApp.prototype._registerOrganizers=function(){var a={}; | |
ZmOrganizer.registerOrg(ZmOrganizer.ADDRBOOK,{app:ZmApp.CONTACTS,nameKey:"addressBook",defaultFolder:ZmOrganizer.ID_ADDRBOOK,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmAddrBook",orgPackage:"ContactsCore",treeController:"ZmAddrBookTreeController",labelKey:"contactLists",itemsKey:"contacts",hasColor:true,defaultColor:ZmOrganizer.C_NONE,orgColor:a,treeType:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.ADDRBOOK],views:["contact"],folderKey:"contactsFolder",mountKey:"mountAddrBook",createFunc:"ZmOrganizer.create",compareFunc:"ZmFolder.sortCompareNonMail",displayOrder:100,newOp:ZmOperation.NEW_ADDRBOOK,deferrable:true}) | |
}; | |
ZmContactsApp.prototype._setupSearchToolbar=function(){ZmSearchToolBar.addMenuItem(ZmItem.CONTACT,{msgKey:"contacts",tooltipKey:"searchPersonalContacts",icon:"Contact",shareIcon:"SharedContactsFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_CONTACT)}); | |
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_GAL,{msgKey:"GAL",tooltipKey:"searchGALContacts",icon:"GAL",setting:ZmSetting.GAL_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_GAL),disableOffline:true}) | |
}; | |
ZmContactsApp.prototype._registerApp=function(){var c={}; | |
c[ZmOperation.NEW_CONTACT]="contact"; | |
c[ZmOperation.NEW_GROUP]="group"; | |
if(appCtxt.createDistListAllowed){c[ZmOperation.NEW_DISTRIBUTION_LIST]="distributionList" | |
}var b={}; | |
b[ZmOperation.NEW_ADDRBOOK]="contactsFolder"; | |
var a={}; | |
a[ZmKeyMap.NEW_CONTACT]=ZmOperation.NEW_CONTACT; | |
ZmApp.registerApp(ZmApp.CONTACTS,{mainPkg:"Contacts",nameKey:"addressBook",icon:"ContactsApp",textPrecedence:40,chooserTooltipKey:"goToContacts",viewTooltipKey:"displayContacts",defaultSearch:ZmItem.CONTACT,organizer:ZmOrganizer.ADDRBOOK,overviewTrees:[ZmOrganizer.ADDRBOOK,ZmOrganizer.SEARCH,ZmOrganizer.TAG],searchTypes:[ZmItem.CONTACT],newItemOps:c,newOrgOps:b,actionCodes:a,gotoActionCode:ZmKeyMap.GOTO_CONTACTS,newActionCode:ZmKeyMap.NEW_CONTACT,trashViewOp:ZmOperation.SHOW_ONLY_CONTACTS,chooserSort:20,defaultSort:40,upsellUrl:ZmSetting.CONTACTS_UPSELL_URL,searchResultsTab:true}) | |
}; | |
ZmContactsApp.prototype.createNotify=function(j,c){if(!j.folder&&!j.cn&&!j.link){return | |
}if(!c&&!this._noDefer&&this._deferNotifications("create",j)){return | |
}for(var a in j){var g=j[a]; | |
if(g&&g.length){for(var e=0; | |
e<g.length; | |
e++){var f=g[e]; | |
if(appCtxt.cacheGet(f.id)){continue | |
}if(a=="folder"){this._handleCreateFolder(f,ZmOrganizer.ADDRBOOK) | |
}else{if(a=="link"){this._handleCreateLink(f,ZmOrganizer.ADDRBOOK) | |
}else{if(a=="cn"){var h=AjxDispatcher.run("GetContactListController"); | |
if(h._folderId==ZmFolder.ID_DLS){continue | |
}var d=(h&&h.getFolderId())?h.getList():new ZmContactList(null); | |
if(appCtxt.multiAccounts&&d.search&&d.search.folderId!=f.l){continue | |
}d.notifyCreate(f); | |
var b=window.parentAppCtxt||window.appCtxt; | |
b.clearAutocompleteCache(ZmAutocomplete.AC_TYPE_CONTACT); | |
f._handled=true | |
}}}}}}}; | |
ZmContactsApp.prototype.modifyNotify=function(b,a){if(!b.cn){return | |
}if(!a&&!this._noDefer&&this._deferNotifications("modify",b)){return | |
}this._batchNotify(b.cn) | |
}; | |
ZmContactsApp.prototype.postNotify=function(a){if(this._checkReplenishListView){this._checkReplenishListView._checkReplenish(); | |
this._checkReplenishListView=null | |
}}; | |
ZmContactsApp.prototype.handleOp=function(c){if(!appCtxt.isWebClientOffline()){switch(c){case ZmOperation.NEW_CONTACT:case ZmOperation.NEW_DISTRIBUTION_LIST:case ZmOperation.NEW_GROUP:var b=(c==ZmOperation.NEW_CONTACT)?null:ZmItem.GROUP; | |
var a=new AjxCallback(this,this._handleLoadNewItem,[b,c==ZmOperation.NEW_DISTRIBUTION_LIST]); | |
AjxDispatcher.require(["ContactsCore","Contacts"],false,a,null,true); | |
break; | |
case ZmOperation.NEW_ADDRBOOK:var a=new AjxCallback(this,this._handleLoadNewAddrBook); | |
AjxDispatcher.require(["ContactsCore","Contacts"],false,a,null,true); | |
break | |
}}}; | |
ZmContactsApp.prototype._handleLoadNewItem=function(c,b){var a=new ZmContact(null,null,c,b); | |
AjxDispatcher.run("GetContactController").show(a) | |
}; | |
ZmContactsApp.prototype._handleLoadNewAddrBook=function(){appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING); | |
var a=appCtxt.getNewAddrBookDialog(); | |
if(!this._newAddrBookCb){this._newAddrBookCb=new AjxCallback(this,this._newAddrBookCallback) | |
}ZmController.showDialog(a,this._newAddrBookCb) | |
}; | |
ZmContactsApp.prototype.activate=function(a){ZmApp.prototype.activate.apply(this,arguments) | |
}; | |
ZmContactsApp.prototype.getNewButtonProps=function(){return{text:ZmMsg.newContact,tooltip:ZmMsg.createNewContact,icon:"NewContact",iconDis:"NewContactDis",defaultId:ZmOperation.NEW_CONTACT,disabled:!this.containsWritableFolder()} | |
}; | |
ZmContactsApp.prototype.launch=function(b,c){this._setLaunchTime(this.toString(),new Date()); | |
var a=new AjxCallback(this,this._handleLoadLaunch,c); | |
AjxDispatcher.require(["ContactsCore","Contacts"],false,a,null,true) | |
}; | |
ZmContactsApp.prototype._handleLoadLaunch=function(b){var a="in:contacts"; | |
if(appCtxt.isExternalAccount()){a="inid:"+this.getDefaultFolderId() | |
}this._contactsSearch(a,b) | |
}; | |
ZmContactsApp.prototype._contactsSearch=function(a,d){var c={searchFor:ZmId.ITEM_CONTACT,query:a,limit:this.getLimit(),types:[ZmId.ITEM_CONTACT],callback:d}; | |
var b=appCtxt.getSearchController(); | |
b.searchAllAccounts=false; | |
b.search(c) | |
}; | |
ZmContactsApp.prototype.getLimit=function(b){var a=appCtxt.get(ZmSetting.PAGE_SIZE); | |
return b?a:2*a | |
}; | |
ZmContactsApp.prototype.getInitialSearchType=function(){var a=appCtxt.getCurrentList(); | |
return(a&&(a instanceof ZmContactList)&&a.isGal)?ZmId.SEARCH_GAL:null | |
}; | |
ZmContactsApp.prototype.showSearchResults=function(b,d,c){var a=this._handleLoadShowSearchResults.bind(this,b,d,c); | |
AjxDispatcher.require("Contacts",false,a,null,true) | |
}; | |
ZmContactsApp.prototype._handleLoadShowSearchResults=function(e,h,f){var d=e&&e.search; | |
var b=d&&d.isSimple()&&d.folderId; | |
var c=d&&(d.contactSource==ZmId.SEARCH_GAL); | |
var g=f?f.getCurrentViewId():ZmApp.MAIN_SESSION; | |
var a=AjxDispatcher.run("GetContactListController",g,f); | |
a.show(e,c,b); | |
this._setLoadedTime(this.toString(),new Date()); | |
if(h){h.run(a) | |
}}; | |
ZmContactsApp.prototype.runRefresh=function(){var a=AjxDispatcher.run("GetContactListController"); | |
a.runRefresh() | |
}; | |
ZmContactsApp.prototype.setActive=function(b){if(b){var a=AjxDispatcher.run("GetContactListController"); | |
a.show() | |
}}; | |
ZmContactsApp.prototype.isContactListLoaded=function(a){var b=(a||appCtxt.getActiveAccount().id); | |
return(this._contactList[b]&&this._contactList[b].isLoaded) | |
}; | |
ZmContactsApp.prototype.getContactByEmail=function(f,g){if(!f){return null | |
}var e=f.toLowerCase(); | |
var d=this._byEmail[e]; | |
if(!d&&this._notFound(e)){this._removeAddrFromLookupGroup(e); | |
if(g){g.run(null) | |
}return null | |
}if(d){this._removeAddrFromLookupGroup(e); | |
d=this._realizeContact(d); | |
d._lookupEmail=f; | |
if(g){g.run(d) | |
}return d | |
}if(g){var j=null,c=false,a=[]; | |
if(this._addrLookupHash&&this._addrLookupHash[e]){if(this._addrLookupList){for(var b=0; | |
b<this._addrLookupList.length; | |
b++){a.push(this._addrLookupList[b]) | |
}j=this._getSearchForAddresses(this._addrLookupList); | |
c=true; | |
this._addrLookupList=null | |
}this._addrLookupHash[e].push(g) | |
}else{j=this._getSearchForAddresses([f]) | |
}if(j){var h=new AjxCallback(this,this._handleResponseSearch,[c?a:e,c,g]); | |
j.execute({callback:h,noBusyOverlay:true}) | |
}}}; | |
ZmContactsApp.prototype._handleResponseSearch=function(l,e,n,o){var b=o.getResponse(); | |
var f=b&&b.getResults(ZmItem.CONTACT); | |
if(e){var k=f.getArray(); | |
for(var d=0; | |
d<k.length; | |
d++){this._updateLookupCache(k[d]) | |
}for(var d=0; | |
d<l.length; | |
d++){var m=l[d]; | |
if(!this._byEmail[m]){this._updateLookupCache(null,m) | |
}var h=this._addrLookupHash[m]; | |
if(h&&h.length){for(var c=0; | |
c<h.length; | |
c++){h[c].run(this._byEmail[m]) | |
}}this._removeAddrFromLookupGroup(m) | |
}}else{var g=f?f.get(0):null; | |
this._updateLookupCache(g,l); | |
this._byEmail[l]=g; | |
n.run(g) | |
}}; | |
ZmContactsApp.prototype.getContactsByEmails=function(b,h){var j=[],a=null,f=null; | |
for(var c=0,e=b.length; | |
c<e; | |
c++){var g=b[c]; | |
var d=this.getContactByEmail(g.getAddress()); | |
if(d||d===null){j.push({address:g,contact:d}) | |
}else{a=a||[]; | |
f=f||[]; | |
a.push(g); | |
f.push(g.getAddress()) | |
}}if(!h){return j | |
}if(!a){h.run(j); | |
return j | |
}var l=this._getSearchForAddresses(f); | |
var k=new AjxCallback(this,this._handleResponseSearchByEmails,[a,j,h]); | |
l.execute({callback:k}) | |
}; | |
ZmContactsApp.prototype._handleResponseSearchByEmails=function(a,m,l,n){var b=n.getResponse(); | |
var h=b&&b.getResults(ZmItem.CONTACT); | |
if(!h){l.run(m) | |
}for(var f=0,e=h.size(); | |
f<e; | |
f++){var d=h.get(f); | |
for(var c=1; | |
true; | |
c++){var j=ZmContact.getAttributeName(ZmContact.F_email,c); | |
var g=d.getAttr(j); | |
if(!g){break | |
}this._byEmail[g]=d | |
}}for(var c=0,e=a.length; | |
c<e; | |
c++){var k=a[c]; | |
var d=this.getContactByEmail(k.getAddress()); | |
m.push({address:k,contact:d}) | |
}l.run(m) | |
}; | |
ZmContactsApp.prototype._getSearchForAddresses=function(c){var a; | |
if(c.length==1){a=["to:",c[0]," not #type:group"] | |
}else{a=["("]; | |
for(var b=0,d=c.length; | |
b<d; | |
b++){if(b>0){a.push(" OR ") | |
}a.push("to:"); | |
a.push(c[b]) | |
}a.push(") not #type:group") | |
}var e={query:a.join(""),limit:c.length*2,types:AjxVector.fromArray([ZmItem.CONTACT])}; | |
return new ZmSearch(e) | |
}; | |
ZmContactsApp.prototype._notFound=function(a){return(a===null||Boolean(this._contactList[appCtxt.getActiveAccount().id])) | |
}; | |
ZmContactsApp.prototype.setAddrLookupGroup=function(b){this._addrLookupList=[]; | |
this._addrLookupHash={}; | |
if(b&&b.length){for(var a=0; | |
a<b.length; | |
a++){if(b[a]){var c=b[a].address||b[a]; | |
c=(c&&AjxUtil.isString(c))?c.toLowerCase():null; | |
if(c&&!this._addrLookupHash[c]){this._addrLookupList.push(c); | |
this._addrLookupHash[c]=[] | |
}}}}}; | |
ZmContactsApp.prototype._removeAddrFromLookupGroup=function(a){if(!(this._addrLookupList&&this._addrLookupList.length)){return | |
}AjxUtil.arrayRemove(this._addrLookupList,a); | |
delete this._addrLookupHash[a] | |
}; | |
ZmContactsApp.prototype._updateLookupCache=function(b,e){if(e){this._byEmail[e]=b | |
}if(b){for(var d=1; | |
true; | |
d++){var c=ZmContact.getAttributeName(ZmContact.F_email,d); | |
var a=b.getAttr(c); | |
if(!a){break | |
}this._byEmail[a.toLowerCase()]=b | |
}}}; | |
ZmContactsApp.prototype.getContactByPhone=function(a){if(!a){return null | |
}var c=a.replace(/[^\d]/g,""); | |
var b=this._phoneToContact[c]; | |
if(b){b.contact=this._realizeContact(b.contact) | |
}return b | |
}; | |
ZmContactsApp.prototype._realizeContact=function(a){var c=appCtxt.getActiveAccount().id; | |
var b=this._contactList[c]; | |
return b?b._realizeContact(a):a | |
}; | |
ZmContactsApp.prototype.updateCache=function(a,b){this._updateHash(a,b,ZmContact.EMAIL_FIELDS,this._byEmail); | |
if(appCtxt.get(ZmSetting.VOICE_ENABLED)){this._updateHash(a,b,ZmContact.PHONE_FIELDS,this._byPhone,true,true) | |
}}; | |
ZmContactsApp.prototype._updateHash=function(h,c,f,e,b,a){for(var g=0; | |
g<f.length; | |
g++){var l=f[g]; | |
for(var d=1; | |
true; | |
d++){var k=ZmContact.getAttributeName(l,d); | |
var j=ZmContact.getAttr(h,k); | |
if(!j){break | |
}j=a?j.replace(/[^\d]/g,""):j.toLowerCase(); | |
if(c){e[j]=b?{contact:h,field:k}:h | |
}else{delete e[j] | |
}}}}; | |
ZmContactsApp.prototype.getContactListForAllAccounts=function(){var a=[]; | |
var c=appCtxt.accountList.visibleAccounts; | |
for(var b=0; | |
b<c.length; | |
b++){if(appCtxt.get(ZmSetting.CONTACTS_ENABLED,null,c[b])){a.push(c[b]) | |
}}if(a.length>0){this._loadContactsForAccount(a) | |
}}; | |
ZmContactsApp.prototype._loadContactsForAccount=function(a){var c=a.shift(); | |
if(c){var b=new AjxCallback(this,this._loadContactsForAccount,[a]); | |
this.getContactList(b,null,c) | |
}}; | |
ZmContactsApp.prototype.getContactList=function(g,a,e){var c=(e&&e.id)||appCtxt.getActiveAccount().id; | |
if(!this._contactList[c]){try{if(this._parentController){this._contactList[c]=this._parentController.getApp(ZmApp.CONTACTS).getContactList() | |
}else{this._contactList[c]=new ZmContactList(null); | |
var f=new AjxCallback(this,this._handleResponseGetContactList,[g]); | |
var b=(e&&e.getEmail()); | |
this._contactList[c].load(f,a,b) | |
}return this._contactList[c] | |
}catch(d){this._contactList[c]=null; | |
throw d | |
}}else{if(g&&g.isAjxCallback){g.run(this._contactList[c]) | |
}return this._contactList[c] | |
}}; | |
ZmContactsApp.prototype._handleResponseGetContactList=function(b){var a=appCtxt.getActiveAccount().id; | |
this.contactsLoaded[a]=true; | |
if(b){b.run(this._contactList[a]) | |
}}; | |
ZmContactsApp.prototype.getGalContactList=function(){if(!this._galContactList){try{this._galContactList=new ZmContactList(null,true); | |
this._galContactList.load() | |
}catch(a){this._galContactList=null; | |
throw a | |
}}return this._galContactList | |
}; | |
ZmContactsApp.prototype.createFromVCard=function(c,b){var a=new ZmContact(null); | |
a.createFromVCard(c,b) | |
}; | |
ZmContactsApp.prototype.getContactListController=function(b,a){return this.getSessionController({controllerClass:"ZmContactListController",sessionId:b||ZmApp.MAIN_SESSION,searchResultsController:a}) | |
}; | |
ZmContactsApp.prototype.getContactController=function(a){return this.getSessionController({controllerClass:"ZmContactController",sessionId:a}) | |
}; | |
ZmContactsApp.prototype._newAddrBookCallback=function(e,c,b){var d=appCtxt.getNewAddrBookDialog(); | |
d.popdown(); | |
var a=appCtxt.getOverviewController(); | |
a.getTreeController(ZmOrganizer.ADDRBOOK)._doCreate(e,c,b) | |
}; | |
ZmContactsApp.prototype.getDL=function(a){return this._dlCache[a] | |
}; | |
ZmContactsApp.prototype.cacheDL=function(b,a){this._dlCache[b]=a | |
}; | |
ZmContactsApp.prototype.updateIdHash=function(a,b){var d=a.id; | |
var c=this.getContactList().getIdHash(); | |
if(!b){c[d]=a | |
}else{delete c[d] | |
}}; | |
ZmContactsApp.prototype.resetWebClientOfflineOperations=function(){ZmApp.prototype.resetWebClientOfflineOperations.apply(this); | |
var b=this.getContactListController(); | |
var c=b&&b.getCurrentToolbar(); | |
if(b&&c){b._resetOperations(c) | |
}var d=this.getOverview(); | |
var a=d&&d.getTreeItemById(ZmFolder.ID_DLS); | |
if(a){a.setVisible(!appCtxt.isWebClientOffline()) | |
}} | |
}if(AjxPackage.define("zimbraMail.briefcase.ZmBriefcaseApp")){ZmBriefcaseApp=function(b,a){ZmApp.call(this,ZmApp.BRIEFCASE,b,a) | |
}; | |
ZmBriefcaseApp.prototype=new ZmApp; | |
ZmBriefcaseApp.prototype.constructor=ZmBriefcaseApp; | |
ZmBriefcaseApp.prototype.isZmBriefcaseApp=true; | |
ZmBriefcaseApp.prototype.toString=function(){return"ZmBriefcaseApp" | |
}; | |
ZmEvent.S_BRIEFCASE_ITEM=ZmId.ITEM_BRIEFCASE; | |
ZmItem.BRIEFCASE_ITEM=ZmEvent.S_BRIEFCASE_ITEM; | |
ZmItem.BRIEFCASE=ZmItem.BRIEFCASE_ITEM; | |
ZmEvent.S_BRIEFCASE_REVISION_ITEM=ZmId.ITEM_BRIEFCASE_REV; | |
ZmItem.BRIEFCASE_REVISION_ITEM=ZmEvent.S_BRIEFCASE_REVISION_ITEM; | |
ZmItem.BRIEFCASE_REVISION=ZmItem.BRIEFCASE_REVISION_ITEM; | |
ZmOrganizer.BRIEFCASE=ZmId.ORG_BRIEFCASE; | |
ZmApp.BRIEFCASE=ZmId.APP_BRIEFCASE; | |
ZmApp.CLASS[ZmApp.BRIEFCASE]="ZmBriefcaseApp"; | |
ZmApp.SETTING[ZmApp.BRIEFCASE]=ZmSetting.BRIEFCASE_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.BRIEFCASE]=65; | |
ZmApp.QS_ARG[ZmApp.BRIEFCASE]="briefcase"; | |
ZmApp.BUTTON_ID[ZmApp.BRIEFCASE]=ZmId.BRIEFCASE_APP; | |
ZmBriefcaseApp.prototype._defineAPI=function(){AjxDispatcher.setPackageLoadFunction("BriefcaseCore",new AjxCallback(this,this._postLoadCore)); | |
AjxDispatcher.setPackageLoadFunction("Briefcase",new AjxCallback(this,this._postLoad,ZmOrganizer.BRIEFCASE)); | |
AjxDispatcher.registerMethod("GetBriefcaseController",["BriefcaseCore","Briefcase"],new AjxCallback(this,this.getBriefcaseController)) | |
}; | |
ZmBriefcaseApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_NEW_BRIEFCASE,{textKey:"newBriefcase",image:"NewFolder",tooltipKey:"newBriefcaseTooltip",shortcut:ZmKeyMap.NEW_BRIEFCASE}); | |
ZmOperation.registerOp(ZmId.OP_NEW_FILE,{textKey:"uploadNewFile",tooltipKey:"uploadNewFile",textPrecedence:70,showImageInToolbar:true,showTextInToolbar:true}); | |
ZmOperation.registerOp(ZmId.OP_NEW_DOC,{textKey:"newDocument",tooltipKey:"newDocument",image:"NewDoc",shortcut:ZmKeyMap.NEW_DOC,textPrecedence:12}); | |
ZmOperation.registerOp(ZmId.OP_SHARE_BRIEFCASE,{textKey:"shareFolder",image:"SharedMailFolder"},ZmSetting.SHARING_ENABLED); | |
ZmOperation.registerOp(ZmId.OP_OPEN_FILE,{textKey:"openFile",tooltipKey:"openFileTooltip",image:"NewDoc"}); | |
ZmOperation.registerOp(ZmId.OP_SAVE_FILE,{textKey:"saveFile",tooltipKey:"saveFileTooltip",image:"DownArrow"}); | |
ZmOperation.registerOp(ZmId.OP_VIEW_FILE_AS_HTML,{textKey:"viewFileAsHtml",tooltipKey:"viewAsHtml",image:"HtmlDoc"}); | |
ZmOperation.registerOp(ZmId.OP_SEND_FILE,{textKey:"sendLink",tooltipKey:"sendLink",image:"Send"}); | |
ZmOperation.registerOp(ZmId.OP_SEND_FILE_AS_ATT,{textKey:"sendAsAttachment",tooltipKey:"sendAsAttachment",image:"Attachment"}); | |
ZmOperation.registerOp(ZmId.OP_SEND_FILE_MENU,{textKey:"send",image:"Send",textPrecedence:75}); | |
ZmOperation.registerOp(ZmId.OP_EDIT_FILE,{textKey:"edit",image:"Edit"}); | |
ZmOperation.registerOp(ZmId.OP_RENAME_FILE,{textKey:"rename",image:"FileRename"}); | |
ZmOperation.registerOp(ZmId.OP_CHECKIN,{textKey:"checkInFile",image:"Checkin"}); | |
ZmOperation.registerOp(ZmId.OP_CHECKOUT,{textKey:"checkOutFile",image:"Checkout"}); | |
ZmOperation.registerOp(ZmId.OP_DISCARD_CHECKOUT,{textKey:"checkOutFileDiscard",image:"DiscardCheckout"}); | |
ZmOperation.registerOp(ZmId.OP_VERSION_HISTORY,{textKey:"versionHistory",image:"VersionHistory"}); | |
ZmOperation.registerOp(ZmId.OP_RESTORE_VERSION,{textKey:"restoreCurrentVersion",image:"RestoreVersion"}); | |
ZmOperation.registerOp(ZmId.OP_DELETE_VERSION,{textKey:"deleteVersion",image:"Delete"}) | |
}; | |
ZmBriefcaseApp.prototype._registerSettings=function(a){a=a||appCtxt.getSettings(); | |
a.registerSetting("DOCS_ENABLED",{name:"zimbraFeatureBriefcaseDocsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}); | |
a.registerSetting("PREVIEW_ENABLED",{type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}); | |
a.registerSetting("READING_PANE_LOCATION_BRIEFCASE",{name:"zimbraPrefBriefcaseReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}) | |
}; | |
ZmBriefcaseApp.prototype._registerItems=function(){ZmItem.registerItem(ZmItem.BRIEFCASE_ITEM,{app:ZmApp.BRIEFCASE,nameKey:"file",icon:"GenericDoc",soapCmd:"ItemAction",itemClass:"ZmBriefcaseItem",node:"doc",organizer:ZmOrganizer.BRIEFCASE,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.BRIEFCASE],searchType:"document",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("BriefcaseCore"); | |
return new ZmList(ZmItem.BRIEFCASE_ITEM,a) | |
},this)}) | |
}; | |
ZmBriefcaseApp.prototype._registerOrganizers=function(){ZmOrganizer.registerOrg(ZmOrganizer.BRIEFCASE,{app:ZmApp.BRIEFCASE,nameKey:"folder",defaultFolder:ZmOrganizer.ID_BRIEFCASE,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmBriefcase",orgPackage:"BriefcaseCore",treeController:"ZmBriefcaseTreeController",labelKey:"briefcaseFolders",itemsKey:"files",treeType:ZmOrganizer.FOLDER,views:["document"],folderKey:"briefcase",mountKey:"mountFolder",createFunc:"ZmOrganizer.create",compareFunc:"ZmFolder.sortCompareNonMail",deferrable:true,newOp:ZmOperation.NEW_BRIEFCASE,displayOrder:100,hasColor:true,defaultColor:ZmOrganizer.C_NONE,childWindow:true}) | |
}; | |
ZmBriefcaseApp.prototype._setupSearchToolbar=function(){ZmSearchToolBar.addMenuItem(ZmItem.BRIEFCASE_ITEM,{msgKey:"files",tooltipKey:"searchForFiles",icon:"Doc",shareIcon:null,setting:ZmSetting.BRIEFCASE_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_BRIEFCASE),disableOffline:true}) | |
}; | |
ZmBriefcaseApp.prototype._registerApp=function(){var c={}; | |
c[ZmOperation.NEW_DOC]="document"; | |
var b={}; | |
b[ZmOperation.NEW_BRIEFCASE]="briefcase"; | |
var a={}; | |
a[ZmKeyMap.NEW_FILE]=ZmOperation.NEW_FILE; | |
a[ZmKeyMap.NEW_BRIEFCASE]=ZmOperation.NEW_BRIEFCASE; | |
a[ZmKeyMap.NEW_DOC]=ZmOperation.NEW_DOC; | |
ZmApp.registerApp(ZmApp.BRIEFCASE,{mainPkg:"Briefcase",nameKey:"briefcase",icon:"Briefcase",textPrecedence:30,chooserTooltipKey:"gotoBriefcase",defaultSearch:ZmItem.BRIEFCASE_ITEM,organizer:ZmOrganizer.BRIEFCASE,overviewTrees:[ZmOrganizer.BRIEFCASE,ZmOrganizer.TAG],searchTypes:[ZmItem.BRIEFCASE_ITEM],newItemOps:c,newOrgOps:b,actionCodes:a,gotoActionCode:ZmKeyMap.GOTO_BRIEFCASE,newActionCode:ZmKeyMap.NEW_DOC,chooserSort:70,defaultSort:60,searchResultsTab:true}) | |
}; | |
ZmBriefcaseApp.prototype.createNotify=function(d,f){if(!d.folder&&!d.doc&&!d.link){return | |
}if(!f&&!this._noDefer&&this._deferNotifications("create",d)){return | |
}for(var a in d){var e=d[a]; | |
for(var c=0; | |
(e!=null)&&c<e.length; | |
c++){var b=e[c]; | |
if(appCtxt.cacheGet(b.id)){continue | |
}if(a=="folder"){this._handleCreateFolder(b,ZmOrganizer.BRIEFCASE) | |
}else{if(a=="link"){this._handleCreateLink(b,ZmOrganizer.BRIEFCASE) | |
}else{if(a=="doc"){var g=AjxDispatcher.run("GetBriefcaseController"); | |
g.handleCreateNotify(b) | |
}}}}}}; | |
ZmBriefcaseApp.prototype.modifyNotify=function(c,a){if(!c.doc){return | |
}var b=AjxDispatcher.run("GetBriefcaseController"); | |
b.handleModifyNotify(c) | |
}; | |
ZmBriefcaseApp.prototype.handleOp=function(c){switch(c){case ZmOperation.NEW_FILE:var a=new AjxCallback(this,this._handleNewItem); | |
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,a,null,true); | |
break; | |
case ZmOperation.NEW_BRIEFCASE:var a=new AjxCallback(this,this._handleLoadNewBriefcase); | |
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,a,null,true); | |
break; | |
case ZmOperation.NEW_DOC:var b=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_DOC]); | |
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,b,null); | |
break | |
}}; | |
ZmBriefcaseApp.prototype.newDoc=function(i,a,g){var b=appCtxt.getOverviewController(); | |
var d=b.getTreeController(ZmOrganizer.BRIEFCASE); | |
var c=ZmOrganizer.ID_BRIEFCASE; | |
if(d){var e=d.getTreeView(this.getOverviewId()); | |
var h=e?e.getSelected():null; | |
c=h?h.id:ZmOrganizer.ID_BRIEFCASE | |
}if(AjxDispatcher.run("GetBriefcaseController").chkFolderPermission(c)){if(i==ZmMimeTable.APP_ZIMBRA_DOC){var f=appCtxt.getNewWindow(false,null,null,g); | |
if(f){f.command="documentEdit"; | |
f.params={name:a,folderId:c} | |
}}}}; | |
ZmBriefcaseApp.getDocWindowFeatures=function(){return["width=",(screen.width||640),",","height=",(screen.height||480),",","scrollbars=yes,","resizable=yes"].join("") | |
}; | |
ZmBriefcaseApp.prototype._handleNewItem=function(){appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING); | |
AjxDispatcher.run("GetBriefcaseController").__popupUploadDialog(ZmMsg.uploadFileToBriefcase) | |
}; | |
ZmBriefcaseApp.prototype._handleLoadNewBriefcase=function(){appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING); | |
if(!this._newBriefcaseCb){this._newBriefcaseCb=this._newBriefcaseCallback.bind(this) | |
}ZmController.showDialog(appCtxt.getNewBriefcaseDialog(),this._newBriefcaseCb) | |
}; | |
ZmBriefcaseApp.prototype.launch=function(c,d){this._setLaunchTime(this.toString(),new Date()); | |
var a=this._handleLoadLaunch.bind(this,d); | |
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,a,null,true); | |
if(appCtxt.isExternalAccount()){var b=appCtxt.getAppController().getNewButton(); | |
b.removePullDownMenuOptions() | |
}}; | |
ZmBriefcaseApp.prototype._handleLoadLaunch=function(a){this.search(); | |
if(a){a.run() | |
}}; | |
ZmBriefcaseApp.prototype.getNewButtonProps=function(){return{text:ZmMsg.newDocument,tooltip:ZmMsg.newDocument,icon:"NewDoc",iconDis:"NewDocDis",defaultId:ZmOperation.NEW_DOC,disabled:!this.containsWritableFolder()} | |
}; | |
ZmBriefcaseApp.prototype.search=function(e){e=e||{}; | |
var a=e.folderId||(appCtxt.isExternalAccount()?this.getDefaultFolderId():ZmOrganizer.ID_BRIEFCASE); | |
var b=appCtxt.getById(a); | |
var d={query:e.query||b.createQuery(),types:[ZmItem.BRIEFCASE_ITEM],limit:this.getLimit(),searchFor:ZmId.ITEM_BRIEFCASE,callback:e.callback,accountName:e.accountName,noRender:e.noRender}; | |
var c=appCtxt.getSearchController(); | |
c.searchAllAccounts=false; | |
c.search(d) | |
}; | |
ZmBriefcaseApp.prototype.showSearchResults=function(b,d,c){var a=this._handleLoadShowSearchResults.bind(this,b,d,c); | |
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,a,null,true) | |
}; | |
ZmBriefcaseApp.prototype._handleLoadShowSearchResults=function(b,e,c){var d=c?c.getCurrentViewId():ZmApp.MAIN_SESSION; | |
var a=AjxDispatcher.run("GetBriefcaseController",d,c); | |
a.show(b); | |
this._setLoadedTime(this.toString(),new Date()); | |
if(e){e.run(a) | |
}}; | |
ZmBriefcaseApp.prototype.setActive=function(a){}; | |
ZmBriefcaseApp.prototype.getLimit=function(b){var a=appCtxt.get(ZmSetting.PAGE_SIZE); | |
return b?a:2*a | |
}; | |
ZmBriefcaseApp.prototype._newBriefcaseCallback=function(d,c,b){appCtxt.getNewBriefcaseDialog().popdown(); | |
var a=appCtxt.getOverviewController(); | |
a.getTreeController(ZmOrganizer.BRIEFCASE)._doCreate(d,c,b) | |
}; | |
ZmBriefcaseApp.prototype.getBriefcaseController=function(b,a){return this.getSessionController({controllerClass:"ZmBriefcaseController",sessionId:b||ZmApp.MAIN_SESSION,searchResultsController:a}) | |
}; | |
ZmBriefcaseApp.prototype.createFromAttachment=function(d,c,b){var a=new AjxCallback(this,this._handleCreateFromAttachment,[d,c,b]); | |
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,a) | |
}; | |
ZmBriefcaseApp.prototype._handleCreateFromAttachment=function(c,b,a){if(this._deferredFolders.length!=0){this._createDeferredFolders(ZmApp.BRIEFCASE) | |
}AjxDispatcher.run("GetBriefcaseController").createFromAttachment(c,b,a) | |
}; | |
ZmBriefcaseApp.prototype._createDeferredFolders=function(a){AjxPackage.require("BriefcaseCore"); | |
ZmApp.prototype._createDeferredFolders.call(this,a) | |
}; | |
ZmBriefcaseApp.prototype.initExternalDndUpload=function(e,n,m,k,a){var u=""; | |
if(!AjxEnv.supportsHTML5File){if(k){k.run() | |
}return | |
}if(!e){e=n.files | |
}var l=0; | |
if(e){var t; | |
var q=[]; | |
var h={}; | |
var g=ZmAppCtxt.handleWindowOpener(); | |
var d=g.get(ZmSetting.DOCUMENT_SIZE_LIMIT); | |
var c=AjxDispatcher.run("GetBriefcaseController"); | |
if(!a){if(c){a=c.getFolderId() | |
}if(!a||a==ZmOrganizer.ID_TRASH){a=ZmOrganizer.ID_BRIEFCASE | |
}}if(this.chkFolderPermission(a)){var s=appCtxt.getById(a); | |
var f=appCtxt.getZmUploadManager(); | |
var h=[]; | |
for(var o=0; | |
o<e.length; | |
o++){var j=f.getErrors(e[o],d); | |
if(j){h.push(j) | |
}}if(h.length>0){var b=f.createUploadErrorMsg(h,d,"<br>"); | |
var p=appCtxt.getMsgDialog(); | |
p.setMessage(b,DwtMessageDialog.WARNING_STYLE); | |
p.popup() | |
}else{var r={attachment:false,uploadFolder:s,files:e,notes:"",allResponses:null,start:0,curView:null,preAllCallback:null,initOneUploadCallback:null,progressCallback:null,errorCallback:null,completeOneCallback:null,completeAllCallback:this.uploadSaveDocs.bind(this),completeDocSaveCallback:this._finishUpload.bind(this,null)}; | |
f.upload(r) | |
}}}}; | |
ZmBriefcaseApp.prototype.chkFolderPermission=function(a){var c=appCtxt.getById(a); | |
if(c.isRemote()&&c.isReadOnly()){var b=appCtxt.getMsgDialog(); | |
b.setMessage(ZmMsg.errorPermissionCreate,DwtMessageDialog.WARNING_STYLE); | |
b.popup(); | |
return false | |
}return true | |
}; | |
ZmBriefcaseApp.prototype.uploadSaveDocs=function(k,e,f,j){if(f!=AjxPost.SC_OK){var l=appCtxt.getAppController().createErrorMessage(ZmItem.BRIEFCASE,f); | |
this._popupErrorDialog(l,e.errorCallback) | |
}else{var h; | |
if(k){h=[]; | |
var a=e.files; | |
if(k.length===a.length){for(var g=0; | |
g<a.length; | |
g++){var c=a[g]; | |
var d=k[g]; | |
var b=(d&&d.aid); | |
h.push({name:c.name,fullname:c.name,notes:e.notes,version:c.version,id:c.id,guid:b,preventDuplicate:c.preventDuplicate}) | |
}e.docFiles=h | |
}}else{h=e.docFiles; | |
if(j){j=j.split(","); | |
for(var g=0; | |
g<h.length; | |
g++){h[g].guid=j[g] | |
}}}if(e.uploadFolder){this._uploadSaveDocs2(e) | |
}else{this._completeUpload(e) | |
}}}; | |
ZmBriefcaseApp.prototype._popupErrorDialog=function(c,a){if(a){a.run() | |
}var b=appCtxt.getMsgDialog(); | |
b.setMessage(c,DwtMessageDialog.CRITICAL_STYLE); | |
b.popup() | |
}; | |
ZmBriefcaseApp.prototype._uploadSaveDocs2=function(d){var e=[]; | |
var h=false; | |
var g=d.docFiles; | |
for(var f=0; | |
f<g.length; | |
f++){var c=g[f]; | |
if(c.done){continue | |
}h=true; | |
var a={_jsns:"urn:zimbraMail",requestId:f,doc:{}}; | |
var j=a.doc; | |
if(c.id){j.id=c.id; | |
j.ver=c.version | |
}else{j.l=d.uploadFolder.id | |
}if(c.notes){j.desc=c.notes | |
}j.upload={id:c.guid}; | |
e.push(a) | |
}if(h){var m={BatchRequest:{_jsns:"urn:zimbra",onerror:"continue",SaveDocumentRequest:((e.length==1)?e[0]:e)}}; | |
var l=this._uploadSaveDocsResponse.bind(this,d); | |
var b={jsonObj:m,asyncMode:true,callback:l}; | |
var k=appCtxt.getAppController(); | |
k.sendRequest(b) | |
}else{this._completeUpload(d) | |
}}; | |
ZmBriefcaseApp.prototype._uploadSaveDocsResponse=function(A,b){var o=b&&b._data&&b._data.BatchResponse; | |
var y=A.docFiles; | |
if(o&&o.SaveDocumentResponse){for(var v=0; | |
v<o.SaveDocumentResponse.length; | |
v++){var a=o.SaveDocumentResponse[v]; | |
y[a.requestId].done=true; | |
y[a.requestId].name=a.doc[0].name; | |
y[a.requestId].id=a.doc[0].id; | |
y[a.requestId].ver=a.doc[0].ver; | |
y[a.requestId].version=a.doc[0].ver | |
}}var m=false; | |
var g=false; | |
var e=false; | |
var k=false; | |
var c=0; | |
var l=[]; | |
if(o&&o.Fault){var j=[]; | |
var e=false,d="Unknown",x="Unknown"; | |
for(var v=0; | |
v<o.Fault.length; | |
v++){var h=o.Fault[v]; | |
var t=h.Detail.Error; | |
c=t.Code; | |
var q=t.a; | |
k=(c==ZmCsfeException.LOCKED); | |
var z=y[h.requestId]; | |
if((c==ZmCsfeException.MAIL_ALREADY_EXISTS)&&z.preventDuplicate){g=true | |
}else{if(c==ZmCsfeException.MAIL_ALREADY_EXISTS||c==ZmCsfeException.MODIFY_CONFLICT){for(var n in q){var r=q[n]; | |
switch(r.n){case"itemId":z.id=r._content; | |
break; | |
case"id":z.id=r._content; | |
break; | |
case"ver":z.version=r._content; | |
break; | |
case"name":z.name=r._content; | |
break | |
}}z.version=z.version||1; | |
l.push(z) | |
}else{if(c==ZmCsfeException.MAIL_QUOTA_EXCEEDED){m=true | |
}else{if(c===ZmCsfeException.UPLOAD_REJECTED){e=true; | |
for(var n in q){var r=q[n]; | |
switch(r.n){case"reason":x=r._content; | |
break; | |
case"name":d=r._content; | |
break | |
}}}}j[h.requestId]=h | |
}}}}if(A.preResolveConflictCallback){A.preResolveConflictCallback.run() | |
}if(m){this._popupErrorDialog(ZmMsg.errorQuotaExceeded,A.errorCallback); | |
return | |
}else{if(g){this._popupErrorDialog(AjxMessageFormat.format(ZmMsg.itemWithFileNameExits,z.name),A.errorCallback); | |
return | |
}else{if(k){this._popupErrorDialog(ZmMsg.errorItemLocked,A.errorCallback); | |
return | |
}else{if(e){var f=AjxMessageFormat.format(ZmMsg.uploadRejectedError,[d,x]); | |
this._popupErrorDialog(f,A.errorCallback); | |
return | |
}else{if(c==ZmCsfeException.SVC_PERM_DENIED){this._popupErrorDialog(ZmMsg.errorPermissionDenied,A.errorCallback); | |
return | |
}}}}}var u=l.length; | |
var s=A.conflictAction||ZmBriefcaseApp.ACTION_KEEP_MINE; | |
if(u>0&&s==ZmBriefcaseApp.ACTION_ASK){var w=appCtxt.getUploadConflictDialog(); | |
w.popup(A.uploadFolder,l,this._uploadSaveDocs2.bind(this,A)) | |
}else{if(u>0&&s==ZmBriefcaseApp.ACTION_KEEP_MINE){if(A.conflictAction){this._shieldSaveDocs(A) | |
}else{this._uploadSaveDocs2(A) | |
}}else{this._completeUpload(A) | |
}}}; | |
ZmBriefcaseApp.prototype._shieldSaveDocs=function(b){var a=appCtxt.getYesNoMsgDialog(); | |
a.reset(); | |
a.setButtonListener(DwtDialog.YES_BUTTON,new AjxListener(this,this._shieldSaveDocsYesCallback,[a,b])); | |
a.setMessage(ZmMsg.uploadConflictShield,DwtMessageDialog.WARNING_STYLE,ZmMsg.uploadConflict); | |
a.popup() | |
}; | |
ZmBriefcaseApp.prototype._shieldSaveDocsYesCallback=function(b,a){this._uploadSaveDocs2(a); | |
b.popdown() | |
}; | |
ZmBriefcaseApp.prototype._completeUpload=function(a){if(a.completeDocSaveCallback){a.completeDocSaveCallback.run(a.docFiles,a.uploadFolder) | |
}}; | |
ZmBriefcaseApp.prototype._finishUpload=function(a,d,f){var e=[]; | |
for(var c in d){var b=d[c].name; | |
e.push(b) | |
}this._handlePostUpload(f,e,d); | |
if(a){a(d) | |
}}; | |
ZmBriefcaseApp.prototype._handlePostUpload=function(c,b,a){var d=ZmMsg.successfullyUploaded; | |
if(a.length>1){d=AjxMessageFormat.format(ZmMsg.successfullyUploadedFiles,a.length) | |
}appCtxt.setStatusMsg(d,ZmStatusView.LEVEL_INFO); | |
var e=AjxDispatcher.run("GetBriefcaseController"); | |
e.resetSelection() | |
}; | |
ZmBriefcaseApp.ACTION_KEEP_MINE="mine"; | |
ZmBriefcaseApp.ACTION_KEEP_THEIRS="theirs"; | |
ZmBriefcaseApp.ACTION_ASK="ask" | |
}if(AjxPackage.define("zimbraMail.voicemail.ZmVoiceApp")){ZmVoiceApp=function(b,a){this.phones=[]; | |
this._nameToPhone={}; | |
this.accordionItem=null; | |
this.soapInfo={method:"SearchVoiceRequest",namespace:"urn:zimbraVoice",response:"SearchVoiceResponse",additional:null}; | |
this._storeprincipal=null; | |
ZmApp.call(this,ZmApp.VOICE,b,a) | |
}; | |
ZmEvent.S_VOICEMAIL=ZmId.APP_VOICE; | |
ZmItem.VOICEMAIL=ZmId.ITEM_VOICEMAIL; | |
ZmEvent.S_CALL=ZmId.ITEM_CALL; | |
ZmItem.CALL=ZmEvent.S_CALL; | |
ZmOrganizer.VOICE=ZmEvent.S_VOICEMAIL; | |
ZmApp.VOICE="Voice"; | |
ZmApp.CLASS[ZmApp.VOICE]="ZmVoiceApp"; | |
ZmApp.SETTING[ZmApp.VOICE]=ZmSetting.VOICE_ENABLED; | |
ZmApp.UPSELL_SETTING[ZmApp.VOICE]=ZmSetting.VOICE_UPSELL_ENABLED; | |
ZmApp.LOAD_SORT[ZmApp.VOICE]=80; | |
ZmApp.QS_ARG[ZmApp.VOICE]="voice"; | |
ZmVoiceApp.overviewFallbackApp=ZmApp.PORTAL; | |
ZmVoiceApp.prototype=new ZmApp; | |
ZmVoiceApp.prototype.constructor=ZmVoiceApp; | |
ZmVoiceApp.prototype.isZmVoiceApp=true; | |
ZmVoiceApp.prototype.toString=function(){return"ZmVoiceApp" | |
}; | |
ZmVoiceApp.AUDIO_MP3_FORMAT="audio/mpeg"; | |
ZmVoiceApp.AUDIO_WAV_FORMAT="audio/wav"; | |
ZmVoiceApp.ERROR_CODE_AUTH="voice.UNABLE_TO_AUTH"; | |
ZmVoiceApp.audioType=ZmVoiceApp.AUDIO_MP3_FORMAT; | |
ZmVoiceApp.hasTrashFolder=false; | |
ZmVoiceApp.prototype._defineAPI=function(){AjxDispatcher.setPackageLoadFunction("Voicemail",new AjxCallback(this,this._postLoadCore)); | |
AjxDispatcher.registerMethod("GetVoiceController","Voicemail",new AjxCallback(this,this.getVoiceController)); | |
AjxDispatcher.registerMethod("GetCallListController","Voicemail",new AjxCallback(this,this.getCallListController)) | |
}; | |
ZmVoiceApp.prototype._registerItems=function(){ZmItem.registerItem(ZmItem.VOICEMAIL,{app:ZmApp.VOICE,nameKey:"voicemail",icon:"Voicemail",soapCmd:"VoiceMsgAction",itemClass:"ZmVoicemail",node:"vm",organizer:ZmOrganizer.VOICE,dropTargets:[ZmOrganizer.VOICE],searchType:"voicemail",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("Voicemail"); | |
return new ZmVoiceList(ZmItem.VOICEMAIL,a) | |
},this)}); | |
ZmItem.registerItem(ZmItem.CALL,{app:ZmApp.VOICE,nameKey:"call",icon:"Voicemail",soapCmd:"VoiceMsgAction",itemClass:"ZmCall",node:"cl",organizer:ZmOrganizer.VOICE,searchType:"calllog",resultsList:AjxCallback.simpleClosure(function(a){AjxDispatcher.require("Voicemail"); | |
return new ZmVoiceList(ZmItem.CALL,a) | |
},this)}) | |
}; | |
ZmVoiceApp.prototype._registerOperations=function(){ZmOperation.registerOp(ZmId.OP_CALL_BACK,{textKey:"callBack",image:"CallManager",tooltipKey:"callBackTooltip"}); | |
ZmOperation.registerOp(ZmId.OP_MARK_HEARD,{textKey:"markAsHeard",image:"MarkAsHeard",shortcut:ZmKeyMap.MARK_HEARD}); | |
ZmOperation.registerOp(ZmId.OP_MARK_UNHEARD,{textKey:"markAsUnheard",image:"MarkAsUnheard",shortcut:ZmKeyMap.MARK_UNHEARD}); | |
ZmOperation.registerOp(ZmId.OP_VIEW_BY_DATE,{textKey:"viewByDate"}); | |
ZmOperation.registerOp(ZmId.OP_REPLY_BY_EMAIL,{textKey:"replyByEmail",tooltipKey:"replyByEmailTooltip",image:"Reply"}); | |
ZmOperation.registerOp(ZmId.OP_FORWARD_BY_EMAIL,{textKey:"forwardByEmail",tooltipKey:"forwardByEmailTooltip",image:"Forward"}); | |
ZmOperation.registerOp(ZmId.OP_DOWNLOAD_VOICEMAIL,{textKey:"downloadVoicemail",tooltipKey:"downloadVoicemailTooltip",image:"Save"}); | |
ZmOperation.registerOp(ZmId.OP_NEW_CALL,{textKey:"newCall",tooltipKey:"newCallTooltip",shortcut:ZmKeyMap.NEW_CALL,image:"PlacedCalls"}) | |
}; | |
ZmVoiceApp.prototype._registerOrganizers=function(){ZmOrganizer.registerOrg(ZmOrganizer.VOICE,{app:ZmApp.VOICE,nameKey:"voicemailFolder",defaultFolder:0,firstUserId:256,orgClass:"ZmVoiceFolder",orgPackage:"Voicemail",treeController:"ZmVoiceTreeController",labelKey:"voicemail",itemsKey:"messages",views:["voicemail"],createFunc:"ZmOrganizer.create",compareFunc:"ZmVoiceFolder.sortCompare",displayOrder:100,deferrable:false}) | |
}; | |
ZmVoiceApp.prototype._registerApp=function(){var a={}; | |
a[ZmOperation.NEW_CALL]="call"; | |
ZmApp.registerApp(ZmApp.VOICE,{mainPkg:"Voicemail",nameKey:"voice",icon:"VoicemailApp",qsArg:"voicemail",chooserTooltipKey:"goToVoice",defaultSearch:ZmId.SEARCH_MAIL,overviewTrees:[ZmOrganizer.VOICE],searchTypes:[ZmItem.VOICEMAIL],gotoActionCode:ZmKeyMap.GOTO_VOICE,chooserSort:15,defaultSort:15,newItemOps:a,upsellUrl:ZmSetting.VOICE_UPSELL_URL}) | |
}; | |
ZmVoiceApp.prototype._registerPrefs=function(){}; | |
ZmVoiceApp.prototype._registerSettings=function(a){a=a||appCtxt.getSettings(); | |
a.registerSetting("VOICE_PAGE_SIZE",{name:"zimbraPrefVoiceItemsPerPage",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:25}); | |
a.registerSetting("VOICE_PAGE_SIZE_MAX",{name:"zimbraMaxVoiceItemsPerPage",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}) | |
}; | |
ZmVoiceApp.prototype.handleOp=function(a){switch(a){case ZmOperation.NEW_CALL:this.displayClickToCallDlg(); | |
break; | |
default:}}; | |
ZmVoiceApp.prototype.deleteNotify=function(a){this._handleDeletes(a) | |
}; | |
ZmVoiceApp.prototype.createNotify=function(a){this._handleCreates(a) | |
}; | |
ZmVoiceApp.prototype.modifyNotify=function(a){this._handleModifies(a) | |
}; | |
ZmVoiceApp.prototype.getOverviewId=function(){var a=this.accordionItem?this.accordionItem.data.phone.name:""; | |
return[this._name,a].join(":") | |
}; | |
ZmVoiceApp.prototype.getOverviewContainer=function(){if(!this._overviewContainer){var a=[ZmApp.OVERVIEW_ID,this._name].join("_"); | |
var b={appName:this._name,containerId:a,posStyle:Dwt.ABSOLUTE_STYLE,parent:appCtxt.getShell(),controller:appCtxt.getOverviewController()}; | |
b.id=ZmId.getOverviewContainerId(a); | |
this._overviewContainer=appCtxt.getOverviewController()._overviewContainer[a]=new ZmVoiceOverviewContainer(b) | |
}return this._overviewContainer | |
}; | |
ZmVoiceApp.prototype.getNewButtonProps=function(){return{text:ZmMsg.newCall,tooltip:ZmMsg.newCallTooltip,icon:"PlacedCalls",iconDis:"PlacedCallsDis",defaultId:ZmOperation.NEW_CALL} | |
}; | |
ZmVoiceApp.prototype.getVoiceInfo=function(g,a,b){if(!this.phones.length){if(!this._gettingVoiceInfo){var c=AjxSoapDoc.create("GetVoiceInfoRequest","urn:zimbraVoice"); | |
var f=new AjxCallback(this,this._handleResponseVoiceInfo); | |
var d=new AjxCallback(this,this._handleErrorResponseVoiceInfo); | |
var e={soapDoc:c,asyncMode:true,noBusyOverlay:b,callback:f,errorCallback:d}; | |
appCtxt.getAppController().sendRequest(e); | |
this._gettingVoiceInfo=true | |
}if(g){this._voiceInfoCallbacks=this._voiceInfoCallbacks||[]; | |
this._voiceInfoCallbacks.push(g) | |
}if(a){this._voiceInfoErrorCallbacks=this._voiceInfoErrorCallbacks||[]; | |
this._voiceInfoErrorCallbacks.push(a) | |
}}else{if(g){g.run() | |
}}}; | |
ZmVoiceApp.prototype._handleResponseVoiceInfo=function(a){var b=new AjxCallback(this,this._handleResponseVoiceInfo2,[a]); | |
AjxPackage.require({name:"Voicemail",callback:b}) | |
}; | |
ZmVoiceApp.prototype._handleResponseVoiceInfo2=function(b){var f=b._data.GetVoiceInfoResponse; | |
this._storeprincipal=f.storeprincipal[0]; | |
this._setAudioType(f); | |
this.soapInfo.additional={storeprincipal:this._storeprincipal}; | |
var c=f.phone; | |
for(var d=0,e=c.length; | |
d<e; | |
d++){var g=c[d]; | |
var a=new ZmPhone(); | |
a._loadFromDom(g); | |
this.phones.push(a); | |
this._nameToPhone[a.name]=a; | |
if(g.folder&&g.folder.length){a.folderTree=new ZmVoiceFolderTree(); | |
if(d==0){this._setHasTrashFolder(g.folder[0].folder) | |
}a.folderTree.loadFromJs(g.folder[0],a) | |
}}if(this._voiceInfoCallbacks){for(d=0,e=this._voiceInfoCallbacks.length; | |
d<e; | |
d++){this._voiceInfoCallbacks[d].run(b) | |
}}this._voiceInfoCallbacks=null; | |
this._voiceInfoErrorCallbacks=null; | |
this._gettingVoiceInfo=false | |
}; | |
ZmVoiceApp.prototype._setAudioType=function(a){if(a.audioType&&a.audioType[0]&&a.audioType[0]._content){ZmVoiceApp.audioType=a.audioType[0]._content | |
}}; | |
ZmVoiceApp.prototype._setHasTrashFolder=function(c){if(c&&c.length){var a=c.length; | |
for(var b=0; | |
b<a; | |
b++){if(c[b].id.indexOf(ZmVoiceFolder.TRASH_ID)==0){ZmVoiceApp.hasTrashFolder=true; | |
return | |
}}}}; | |
ZmVoiceApp.prototype._handleErrorResponseVoiceInfo=function(a){var c=false; | |
if(this._voiceInfoErrorCallbacks){for(var b=0,d=this._voiceInfoErrorCallbacks.length; | |
b<d; | |
b++){c=this._voiceInfoErrorCallbacks[b].run(a)||c | |
}}this._voiceInfoCallbacks=null; | |
this._voiceInfoErrorCallbacks=null; | |
this._gettingVoiceInfo=false; | |
if(!c){this.processErrors(a) | |
}return true | |
}; | |
ZmVoiceApp.prototype.refreshFolders=function(e,a){if(this.phones.length){var b=AjxSoapDoc.create("GetVoiceFolderRequest","urn:zimbraVoice"); | |
this.setStorePrincipal(b); | |
var d=new AjxCallback(this,this._handleResponseUpdateFolders,[e]); | |
var c={soapDoc:b,asyncMode:true,callback:d,errorCallback:a}; | |
appCtxt.getAppController().sendRequest(c) | |
}else{if(e){e.run() | |
}}}; | |
ZmVoiceApp.prototype._handleResponseUpdateFolders=function(g,b){var c=b._data.GetVoiceFolderResponse.phone; | |
for(var d=0,e=c.length; | |
d<e; | |
d++){var f=c[d]; | |
var a=this._nameToPhone[f.name]; | |
if(a){this._updateFolders(a,f.folder[0].folder) | |
}}if(g){g.run() | |
}}; | |
ZmVoiceApp.prototype._updateFolders=function(b,g){var f=b.folderTree; | |
for(var c=0,e=g.length; | |
c<e; | |
c++){var a=g[c]; | |
var d=f.getByName(a.name); | |
if(d){d.notifyModify(a) | |
}}}; | |
ZmVoiceApp.prototype.search=function(d,g,f){var a=(d.getSearchType()==ZmItem.VOICEMAIL)?ZmId.VIEW_VOICEMAIL:ZmId.VIEW_CALL_LIST; | |
if((a==ZmId.VIEW_VOICEMAIL)&&!d.phone.hasVoiceMail){AjxDispatcher.run("GetVoiceController").show(null,d); | |
this._setupOverviewContainer(); | |
if(g){g.run(null) | |
}}else{if(!f){f=appCtxt.get(ZmSetting.SORTING_PREF,a) | |
}var e={soapInfo:this.soapInfo,types:AjxVector.fromArray([d.getSearchType()]),sortBy:f,query:d.getSearchQuery(),limit:this.getLimit()}; | |
var b=new ZmSearch(e); | |
var c=new AjxCallback(this,this._handleResponseSearch,[d,g]); | |
b.execute({callback:c}) | |
}}; | |
ZmVoiceApp.prototype._handleResponseSearch=function(a,i,b){var d=b._data; | |
var e=d.getResults(a.getSearchType()); | |
e.folder=a; | |
var g=(a.getSearchType()==ZmItem.VOICEMAIL)?AjxDispatcher.run("GetVoiceController"):AjxDispatcher.run("GetCallListController"); | |
g.show(d,a); | |
this._setupOverviewContainer(); | |
this.selectFolderInOverview(a); | |
var c=d.getAttribute("vfi"); | |
if(c){a.notifyModify(c[0]) | |
}if(this._paramId){var f=g.getList(); | |
var j=f.getById(this._paramId); | |
if(j){var h=g.getListView(); | |
h.setSelection(j,true); | |
h.setPlaying(j) | |
}}if(i){i.run(d) | |
}}; | |
ZmVoiceApp.prototype._setupOverviewContainer=function(){this.getOverviewContainer(); | |
if(!this._overviewContainer.initialized){var a=this._getOverviewParams(); | |
a.overviewTrees=this._getOverviewTrees(); | |
a.phones=this.phones; | |
this._overviewContainer.initialize(a) | |
}}; | |
ZmVoiceApp.prototype.markItemsHeard=function(b,c,e,a){var d=c?"read":"!read"; | |
this._performAction(b,d,null,e,a) | |
}; | |
ZmVoiceApp.prototype._performAction=function(j,g,d,l,f){if(!j.length){if(l){l.run(j) | |
}return | |
}var a=[]; | |
for(var e=0,h=j.length; | |
e<h; | |
e++){a[e]=j[e].id | |
}var k=AjxSoapDoc.create("VoiceMsgActionRequest","urn:zimbraVoice"); | |
this.setStorePrincipal(k); | |
var b=k.set("action"); | |
b.setAttribute("op",g); | |
b.setAttribute("id",a.join(",")); | |
b.setAttribute("phone",j[0].getPhone().name); | |
for(var e in d){b.setAttribute(e,d[e]) | |
}var c={soapDoc:k,asyncMode:true,callback:l,errorCallback:f}; | |
appCtxt.getAppController().sendRequest(c) | |
}; | |
ZmVoiceApp.prototype.launch=function(a,b){this._showApp(a,b) | |
}; | |
ZmVoiceApp.prototype._showApp=function(b,c){this._paramId=(b.qsParams?b.qsParams.id:null); | |
var a=new AjxCallback(this,this._handleLoadLaunch,[c]); | |
AjxDispatcher.require("Voicemail",true,a,null,true) | |
}; | |
ZmVoiceApp.prototype._handleLoadLaunch=function(c){var b=new AjxCallback(this,this._handleResponseLoadLaunchGotInfo,c); | |
var a=new AjxCallback(this,this._handleErrorLoadLaunchGotInfo,c); | |
this.getVoiceInfo(b,a) | |
}; | |
ZmVoiceApp.prototype._handleErrorLoadLaunchGotInfo=function(d,a){var c; | |
this._loadError=true; | |
switch(a.code){case"voice.SECONDARY_NOT_ALLOWED":case"voice.ACCOUNT_NOT_CPNI_COMPLIANT":case"voice.ACCOUNT_CPNI_NOT_AVAILABLE":this._showUpsellMessage(a.code); | |
c=true; | |
break; | |
case"voice.UNABLE_TO_RETRIEVE_PROFILE_SUMMARY":default:var b=appCtxt.getApp(ZmVoiceApp.overviewFallbackApp); | |
if(b){b.launch() | |
}c=false; | |
break | |
}this.setOverviewPanelContent(false); | |
if(d instanceof AjxCallback){d.run() | |
}return c | |
}; | |
ZmVoiceApp.prototype._showUpsellMessage=function(b){if(!this._showingSecondaryMessage){this._showingSecondaryMessage=true; | |
var a=new DwtControl({parent:appCtxt.getShell(),posStyle:Dwt.ABSOLUTE_STYLE}); | |
a.setScrollStyle(DwtControl.SCROLL); | |
var d=null; | |
if(b=="voice.ACCOUNT_NOT_CPNI_COMPLIANT"||b=="voice.ACCOUNT_CPNI_NOT_AVAILABLE"){d=ZMsg[b+"_PREFS"] | |
}a.getHtmlElement().innerHTML=d||ZMsg["voice.SECONDARY_NOT_ALLOWED_VOICE"]; | |
var e={}; | |
e[ZmAppViewMgr.C_APP_CONTENT]=a; | |
var c=[ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_SASH]; | |
var f="VoiceMessage"; | |
this.createView({viewId:f,appName:this._name,controller:appCtxt.getAppController(),elements:e,hide:c,isFullScreen:true,isAppView:true}); | |
this.pushView(f,true) | |
}}; | |
ZmVoiceApp.prototype._handleResponseLoadLaunchGotInfo=function(c,a){this._loadError=false; | |
var b=this.getStartFolder(); | |
if(b){this.search(b,c) | |
}else{if(c){c.run() | |
}}}; | |
ZmVoiceApp.prototype.setStartPhone=function(a,c){this._startPhone=a; | |
if(c){var b=this.getStartFolder(); | |
if(this.view!=ZmId.VIEW_VOICEMAIL){this.pushView(ZmId.VIEW_VOICEMAIL) | |
}if(this.getVoiceController().getFolder()!=b){this.search(b); | |
this.getVoiceController().setFolder(b,true) | |
}this.selectFolderInOverview(b) | |
}}; | |
ZmVoiceApp.prototype.getStartFolder=function(b){var e=0; | |
var c=0; | |
var d=b||this._startPhone; | |
if(d){for(c=0; | |
c<this.phones.length; | |
c++){var a=this.phones[c]; | |
if(a.name==d){e=c | |
}}}else{for(c=0; | |
c<this.phones.length; | |
c++){var a=this.phones[c]; | |
if(a.hasVoiceMail){e=c; | |
break | |
}}}return this.phones[e].folderTree.getByName(ZmVoiceFolder.VOICEMAIL) | |
}; | |
ZmVoiceApp.prototype.selectFolderInOverview=function(a){var c=this.getOverviewContainer().getOverviews(); | |
for(id in c){var b=c[id]; | |
if(b.phone==a.phone){b.setSelected(a.id,"Voice") | |
}else{b.itemSelected(null) | |
}}}; | |
ZmVoiceApp.prototype.getVoiceController=function(){if(!this._voiceController){this._voiceController=new ZmVoicemailListController(this._container,this) | |
}return this._voiceController | |
}; | |
ZmVoiceApp.prototype.getCallListController=function(){if(!this._callListController){this._callListController=new ZmCallListController(this._container,this) | |
}return this._callListController | |
}; | |
ZmVoiceApp.prototype.setStorePrincipal=function(b){var c=b.set("storeprincipal"); | |
for(var a in this._storeprincipal){c.setAttribute(a,this._storeprincipal[a]) | |
}}; | |
ZmVoiceApp.prototype.setOverviewPanelContent=function(b){if((this._showingSecondaryMessage||this._loadError)&&ZmVoiceApp.overviewFallbackApp){var a=appCtxt.getApp(ZmVoiceApp.overviewFallbackApp); | |
if(a){return a.setOverviewPanelContent(b) | |
}}return ZmApp.prototype.setOverviewPanelContent.call(this,b) | |
}; | |
ZmVoiceApp.prototype.redoSearch=function(){var b=appCtxt.getAppViewMgr().getAppView(ZmApp.VOICE); | |
if(b){var a; | |
if(b==ZmId.VIEW_VOICEMAIL){a=AjxDispatcher.run("GetVoiceController") | |
}else{if(b==ZmId.VIEW_CALL_LIST){a=AjxDispatcher.run("GetCallListController") | |
}}if(a){this.search(a.getFolder()) | |
}}}; | |
ZmVoiceApp.prototype._handleDeletes=function(a){}; | |
ZmVoiceApp.prototype._handleCreates=function(a){}; | |
ZmVoiceApp.prototype._handleModifies=function(a){}; | |
ZmVoiceApp.prototype._getOverviewTrees=function(){return[ZmOrganizer.VOICE] | |
}; | |
ZmVoiceApp.prototype.registerUCProvider=function(a){this._UCProvider=a | |
}; | |
ZmVoiceApp.prototype.displayClickToCallDlg=function(a){if(this._UCProvider){this._UCProvider.display(a) | |
}}; | |
ZmVoiceApp.prototype.processErrors=function(c){var a=ZmMsg.voicemailErrorUnknown; | |
if(!c.code){return | |
}if(c.code==ZmVoiceApp.ERROR_CODE_AUTH){a=ZmMsg.voicemailErrorAuthFailure | |
}if(this._UCProvider){a=this._UCProvider.getErrorDescription(c)||a | |
}var b=appCtxt.getErrorDialog(); | |
b.setMessage(a,a,DwtMessageDialog.CRITICAL_STYLE); | |
b.popup(); | |
return | |
}; | |
ZmVoiceApp.prototype.hasVoicePIN=function(a){if(this._UCProvider){return this._UCProvider.hasVoicePIN() | |
}return true | |
} | |
}}if(AjxPackage.define("dwt.Widgets")){AjxTemplate.register("dwt.Widgets#DwtAlert",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]='<table role="presentation" width=100%><tr><td width=1%><div id=\''; | |
a[c++]=e.id; | |
a[c++]="_icon' style='margin-right:5px;'></div></td><td width=99%><table role=\"presentation\"><tr><td id='"; | |
a[c++]=e.id; | |
a[c++]="_title' class='DwtAlertTitle'></td></tr><tr><td id='"; | |
a[c++]=e.id; | |
a[c++]="_content' class='DwtAlertContent'></td></tr></table></td><td width=1%><div id='"; | |
a[c++]=e.id; | |
a[c++]="_dismiss' style='margin-left:5px;'></div></td></tr></table>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtAlert"},false); | |
AjxTemplate.register("dwt.Widgets",AjxTemplate.getTemplate("dwt.Widgets#DwtAlert"),AjxTemplate.getParams("dwt.Widgets#DwtAlert")); | |
AjxTemplate.register("dwt.Widgets#DwtCheckbox",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<table role=\"presentation\" class='ZCheckboxTable'><tr><td><label id='"; | |
a[c++]=e.id; | |
a[c++]="_text_left' for='"; | |
a[c++]=e.id; | |
a[c++]="_input' class='Text' style='text-align:right'></label></td><td><input id='"; | |
a[c++]=e.id; | |
a[c++]="_input' name='"; | |
a[c++]=e.name; | |
a[c++]="' value='"; | |
a[c++]=e.value; | |
a[c++]="' type='"; | |
a[c++]=e.type; | |
a[c++]="' aria-labelledby='"; | |
a[c++]=e.id; | |
a[c++]="_text_left "; | |
a[c++]=e.id; | |
a[c++]="_text_right'></td><td><label id='"; | |
a[c++]=e.id; | |
a[c++]="_text_right' for='"; | |
a[c++]=e.id; | |
a[c++]="_input' class='Text' style='text-align:left'></label></td></tr></table>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtCheckbox"},false); | |
AjxTemplate.register("dwt.Widgets#DwtBaseDialog",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div class='DwtDialog WindowOuterContainer'><table role=\"presentation\"><tr id='"; | |
a[c++]=e.dragId; | |
a[c++]="'><td class='minWidth'>"; | |
a[c++]=e.icon; | |
a[c++]="</td><td id='"; | |
a[c++]=e.id; | |
a[c++]="_title' class='DwtDialogTitle'>"; | |
a[c++]=e.title; | |
a[c++]="</td><td class='minWidth'><div class='"; | |
a[c++]=e.closeIcon2; | |
a[c++]="'></div></td><td class='minWidth'><div class='"; | |
a[c++]=e.closeIcon1; | |
a[c++]="'></div></td></tr><tr><td class='WindowInnerContainer' colspan='4'><div id='"; | |
a[c++]=e.id; | |
a[c++]="_content' class='DwtDialogBody'></div>"; | |
if(e.controlsTemplateId){a[c++]=AjxTemplate.expand(e.controlsTemplateId,e) | |
}a[c++]="</td></tr></table></div>"; | |
return d?a.length:a.join("") | |
},{width:"20",id:"dwt.Widgets#DwtBaseDialog",height:"32"},false); | |
AjxTemplate.register("dwt.Widgets#DwtDialogControls",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div class='horizSep' id=\""; | |
a[c++]=e.id; | |
a[c++]="_buttonsSep\"></div><div id='"; | |
a[c++]=e.id; | |
a[c++]="_buttons' class='DwtDialogButtonBar'>"; | |
if(AjxEnv.isNav){a[c++]="<input type='button' id='"; | |
a[c++]=e.id; | |
a[c++]="_focus' style='height:0px;width:0px;display:none;'>" | |
}a[c++]="</div>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtDialogControls"},false); | |
AjxTemplate.register("dwt.Widgets#DwtSemiModalDialog",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div class='DwtDialog LightWindowOuterContainer'><table role=\"presentation\" style='cursor:move;'><tr id='"; | |
a[c++]=e.dragId; | |
a[c++]="'><td class='minWidth'>"; | |
a[c++]=e.icon; | |
a[c++]="</td><td id='"; | |
a[c++]=e.id; | |
a[c++]="_title' class='DwtDialogTitle'>"; | |
a[c++]=e.title; | |
a[c++]="</td><td class='minWidth'><div class='"; | |
a[c++]=e.closeIcon2; | |
a[c++]="'></div></td><td class='minWidth'><div class='"; | |
a[c++]=e.closeIcon1; | |
a[c++]="'></div></td></tr><tr><td class='LightWindowInnerContainer full_size' colspan='4'><div id='"; | |
a[c++]=e.id; | |
a[c++]="_content' class='DwtDialogBody'></div><div class='horizSep'></div><div id='"; | |
a[c++]=e.id; | |
a[c++]="_buttons' class='DwtDialogButtonBar'>"; | |
if(AjxEnv.isNav){a[c++]="<input type='button' id='"; | |
a[c++]=e.id; | |
a[c++]="_focus' style='height:0px;width:0px;display:none;'>" | |
}a[c++]="</div></td></tr></table></div>"; | |
return d?a.length:a.join("") | |
},{width:"20",id:"dwt.Widgets#DwtSemiModalDialog",height:"32"},false); | |
AjxTemplate.register("dwt.Widgets#DwtToolTip",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div id='tooltipContents' class='DwtToolTipBody'></div>"; | |
return d?a.length:a.join("") | |
},{width:"5",id:"dwt.Widgets#DwtToolTip",height:"5"},false); | |
AjxTemplate.register("dwt.Widgets#DwtVerticalSash",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div class='DwtVerticalSash'><div class='VSashContainer'><div class='VSashThumb ImgVSash_thumb'></div></div></div>"; | |
return d?a.length:a.join("") | |
},{width:"0",id:"dwt.Widgets#DwtVerticalSash",height:"0"},false); | |
AjxTemplate.register("dwt.Widgets#DwtHorizontalSash",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div class='DwtHorizontalSash'><div class='HSashContainer'><div class='HSashThumb ImgHSash_thumb'></div></div></div>"; | |
return d?a.length:a.join("") | |
},{width:"0",id:"dwt.Widgets#DwtHorizontalSash",height:"0"},false); | |
AjxTemplate.register("dwt.Widgets#DwtMissingSoundPlayer",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<table role=\"presentation\" class='DwtMissingSoundPlayer'><tr><td nowrap class='ImgCritical'> </td><td nowrap>"; | |
a[c++]=ZmMsg.missingPlugin; | |
a[c++]="</td></tr></table>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtMissingSoundPlayer"},false); | |
AjxTemplate.register("dwt.Widgets#DwtVerticalSlider",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div id='"; | |
a[c++]=e.id; | |
a[c++]="_button' class='DwtThumb DwtSliderThumb'><div class='DwtSliderThumbBorder'><div class='ImgVerticalSliderThumb'></div></div></div>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtVerticalSlider","class":"DwtSlider DwtVerticalSlider"},false); | |
AjxTemplate.register("dwt.Widgets#DwtHorizontalSlider",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div id='"; | |
a[c++]=e.id; | |
a[c++]="_button' class='DwtThumb DwtSliderThumb'><div class='DwtSliderThumbBorder'><div class='ImgHorizontalSliderThumb'></div></div></div>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtHorizontalSlider","class":"DwtSlider DwtHorizontalSlider"},false); | |
AjxTemplate.register("dwt.Widgets#ZLabel",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<table role=\"presentation\" class='ZWidgetTable ZLabelBorder'><tr><td id='"; | |
a[c++]=e.id; | |
a[c++]="_left_icon' \tclass='ZLeftIcon ZWidgetIcon'></td><td id='"; | |
a[c++]=e.id; | |
a[c++]="_title'\t\tclass='ZWidgetTitle'></td><td id='"; | |
a[c++]=e.id; | |
a[c++]="_right_icon' \tclass='ZRightIcon ZWidgetIcon'></td></tr></table>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZLabel","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZButton",function(c,g,f,b){var e=Boolean(b); | |
f=(typeof f=="string"?{id:f}:f)||{}; | |
b=b||[]; | |
var d=b.length; | |
var a=f.buttonClass||"Button"; | |
b[d++]='<table role="presentation" class=\'ZWidgetTable Z'; | |
b[d++]=a; | |
b[d++]="Table Z"; | |
b[d++]=a; | |
b[d++]="Border' style='table-layout:auto;' cellspacing='0'><tr><td id='"; | |
b[d++]=f.id; | |
b[d++]="_left_icon' \tclass='ZLeftIcon ZWidgetIcon'></td><td id='"; | |
b[d++]=f.id; | |
b[d++]="_title'\t\tclass='ZWidgetTitle'></td><td id='"; | |
b[d++]=f.id; | |
b[d++]="_right_icon' \tclass='ZRightIcon ZWidgetIcon'></td><td id='"; | |
b[d++]=f.id; | |
b[d++]="_dropdown' \tclass='ZDropDown'></td></tr></table>"; | |
return e?b.length:b.join("") | |
},{id:"dwt.Widgets#ZButton","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZImageOnlyButton",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div id='"; | |
a[c++]=e.id; | |
a[c++]="_left_icon'></div>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZImageOnlyButton","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZToolbarButton",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
e.buttonClass=e.buttonClass||"ToolbarButton"; | |
a[c++]=AjxTemplate.expand("#ZButton",e); | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZToolbarButton","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZBorderlessButton",function(c,g,f,b){var e=Boolean(b); | |
f=(typeof f=="string"?{id:f}:f)||{}; | |
b=b||[]; | |
var d=b.length; | |
var a=f.buttonClass||"Button"; | |
b[d++]='<table role="presentation" class=\'ZWidgetTable Z'; | |
b[d++]=a; | |
b[d++]="Table' style='table-layout:auto;'><tr><td id='"; | |
b[d++]=f.id; | |
b[d++]="_left_icon' \tclass='ZLeftIcon ZWidgetIcon'></td><td id='"; | |
b[d++]=f.id; | |
b[d++]="_title'\t\tclass='ZWidgetTitle'></td><td id='"; | |
b[d++]=f.id; | |
b[d++]="_right_icon' \tclass='ZRightIcon ZWidgetIcon'></td><td id='"; | |
b[d++]=f.id; | |
b[d++]="_dropdown' \tclass='ZDropDown'></td></tr></table>"; | |
return e?b.length:b.join("") | |
},{id:"dwt.Widgets#ZBorderlessButton","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZLinkButton",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
if(e.noDropDown){a[c++]="<a href='javascript:;' onclick='return false;' id='"; | |
a[c++]=e.id; | |
a[c++]="_title'></a>" | |
}else{a[c++]="<table role=\"presentation\" class='DwtLinkButtonTable' style='table-layout:auto;'><tr><td class='ZWidgetTitle'><a href='javascript:;' onclick='return false;' id='"; | |
a[c++]=e.id; | |
a[c++]="_title'></a></td><td id='"; | |
a[c++]=e.id; | |
a[c++]="_dropdown' class='DwtLinkButtonDropDownArrowTd'><div class='DwtLinkButtonDropDownArrow'><center><div class='DwtLinkButtonDropDownArrowRow' style='width:7px;'> </div><div class='DwtLinkButtonDropDownArrowRow' style='width:5px;'> </div><div class='DwtLinkButtonDropDownArrowRow' style='width:3px;'> </div><div class='DwtLinkButtonDropDownArrowRow' style='width:1px;'> </div></center></div></td></tr></table>" | |
}return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZLinkButton","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZButtonColorDisplay",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div id='"; | |
a[c++]=e.id; | |
a[c++]="_color' class='DwtButtonColorPicker-display' unselectable></div>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZButtonColorDisplay"},false); | |
AjxTemplate.register("dwt.Widgets#DwtComboBox",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]='<table role="presentation"><tr><td width=*><div id=\''; | |
a[c++]=e.id; | |
a[c++]="_input'></div></td><td><div id='"; | |
a[c++]=e.id; | |
a[c++]="_button'></div></td></tr></table>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#DwtComboBox","class":"DwtComboBox"},false); | |
AjxTemplate.register("dwt.Widgets#DwtComboBoxButton",function(c,g,f,b){var e=Boolean(b); | |
f=(typeof f=="string"?{id:f}:f)||{}; | |
b=b||[]; | |
var d=b.length; | |
var a=f.buttonClass||"Button"; | |
b[d++]='<table role="presentation" class=\'Z'; | |
b[d++]=a; | |
b[d++]="Border'><tr><td id='"; | |
b[d++]=f.id; | |
b[d++]="_dropdown' class='ZDropDown'></td></tr></table>"; | |
return e?b.length:b.join("") | |
},{id:"dwt.Widgets#DwtComboBoxButton","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZTabView",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<div id='"; | |
a[c++]=e.id; | |
a[c++]="_tabbar'></div><div id='"; | |
a[c++]=e.id; | |
a[c++]="_page'></div>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZTabView","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZTabBar",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e}:e)||{}; | |
a=a||[]; | |
var c=a.length; | |
a[c++]="<table role=\"presentation\" width='100%'><tr valign='bottom' id='"; | |
a[c++]=e.id; | |
a[c++]="_items'>"; | |
a[c++]=AjxTemplate.expand("#ZTabBarPrefix",e); | |
a[c++]=AjxTemplate.expand("#ZTabBarSuffix",e); | |
a[c++]="</tr></table>"; | |
return d?a.length:a.join("") | |
},{id:"dwt.Widgets#ZTabBar","class":"ZWidget"},false); | |
AjxTemplate.register("dwt.Widgets#ZTabBarPrefix",function(b,f,e,a){var d=Boolean(a); | |
e=(typeof e=="string"?{id:e} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment