This problem first started last Thursday and is being observed by all three users of the Zimbra Desktop software. Every couple of minutes, the "Account Authentication" pop-up appears with the message: "Zimbra Desktop is unable to synchronise data for "users email address". Re-enter the password and click save to re-authenticate the account"
When you type in your password it does not seem to accept it and the "Account Authentication" pop-up window re-appears. If you dismiss it then, the pop-up window with the same message re-appears several minutes later or if you enter a password nothing happens and you are prompted to re-enter the password.
If anybody can help please reply asap.
Thanks
Roger
Zimbra is continuously asking for "Account Authentication"
-
- Posts: 3
- Joined: Mon Jun 01, 2015 6:07 am
Zimbra is continuously asking for "Account Authentication"
You haven't mentioned which version of ZD is in use nor what type of server you are connect to - both of those are important. Have you also tried the new ZD 7.2.7 beta? If you haven't then see if that works any better.
-
- Posts: 3
- Joined: Mon Jun 01, 2015 6:07 am
Zimbra is continuously asking for "Account Authentication"
Hi,
We are currently using ZD for desktop, version # 7.2.5 QA (build # 12038), on individual PC's. We GMail as our mail server who we log into using the internet. I have just downloaded the new ZD 7.2.7 beta - but I am observing the same result.
We are currently using ZD for desktop, version # 7.2.5 QA (build # 12038), on individual PC's. We GMail as our mail server who we log into using the internet. I have just downloaded the new ZD 7.2.7 beta - but I am observing the same result.
- jorgedlcruz
- Zimbra Alumni
- Posts: 2782
- Joined: Thu May 22, 2014 4:47 pm
Zimbra is continuously asking for "Account Authentication"
Hi,
I've passed the next question to our Zimbra Desktop team, will come back with more info soon.
Best regards
I've passed the next question to our Zimbra Desktop team, will come back with more info soon.
Best regards
-
- Posts: 3
- Joined: Mon Jun 01, 2015 6:07 am
Zimbra is continuously asking for "Account Authentication"
This is error log:
/* Copyright (C) 2005-2009 Zimbra Inc. http://www.zimbra.com/ */
if(AjxPackage.define("Startup1_2")){
if(AjxPackage.define("zimbraMail.share.model.ZmObjectHandler")){
ZmObjectHandler=function(e,t){
if(arguments.length>0){
this.init(e,t)
}};
ZmObjectHandler.prototype.constructor=ZmObjectHandler;
ZmObjectHandler.prototype.init=function(e,t){
this._typeName=e;
this._className=t?t:"Object"
};
ZmObjectHandler.prototype.toString=function(){
if(!this._toString){
var e=""+this.constructor;
e=e.substring(0,e.indexOf("("));
this._toString=e.substring("function ".length)
}
return this._toString
};
ZmObjectHandler.prototype.getTypeName=function(){
return this._typeName
};
ZmObjectHandler.prototype.getClassName=function(a,e,t){
return this._className
};
ZmObjectHandler.prototype.getHoveredClassName=function(o,t,a){
var e=this.getClassName(o,t,a);
if(this._cachedClassNameForHovered!==e){
this._cachedClassNameForHovered=e;
this._classNameHovered=e+"-"+DwtCssStyle.HOVER
}
return this._classNameHovered
};
ZmObjectHandler.prototype.getActiveClassName=function(o,t,a){
var e=this.getClassName(o,t,a);
if(this._cachedClassNameForActive!==e){
this._cachedClassNameForActive=e;
this._classNameActive=e+"-"+DwtCssStyle.ACTIVE
}
return this._classNameActive
};
ZmObjectHandler.prototype.findObject=function(e,t){
if(t===0){
this._lastMatch=null;
this._noMatch=false
}
if(this._noMatch){
return null
}
if(this._lastMatch&&this._lastMatch.index>=t){
return this._lastMatch
}
this._lastMatch=this.match(e,t);
this._noMatch=(this._lastMatch===null);
return this._lastMatch
};
ZmObjectHandler.prototype.match=function(e,t){
return null
};
ZmObjectHandler.prototype._getHtmlContent=function(a,e,n,t,o){
a[e++]=AjxStringUtil.htmlEncode(n,true);
return e
};
ZmObjectHandler.prototype.generateSpan=function(o,e,s,n,a,t){
o[e++]="<span class='";
o[e++]=this.getClassName(s);
o[e++]="' id='";
o[e++]=n;
o[e++]="'>";
e=this._getHtmlContent(o,e,s,a,n,t);
o[e++]="</span>";
return e
};
ZmObjectHandler.prototype.hasToolTipText=function(t,e){
return true
};
ZmObjectHandler.prototype.getToolTipText=function(t,e){
return AjxStringUtil.htmlEncode(t)
};
ZmObjectHandler.prototype.populateToolTip=function(t,e){};
ZmObjectHandler.prototype.getActionMenu=function(a,t,e){
return null
};
ZmObjectHandler.prototype.selected=function(o,t,a,e){
return this.clicked(t,o,e,a)
};
ZmObjectHandler.prototype.clicked=function(t,o,e,a){};
ZmObjectHandler.prototype.hoverOver=function(t,o,e,s){
var a=DwtShell.getShell(window);
var n=a.getToolTip();
n.setContent(this.getToolTipText(t,o));
n.popup(e,s);
this.populateToolTip(t,o)
};
ZmObjectHandler.prototype.hoverOut=function(e,a){
var t=DwtShell.getShell(window);
var o=t.getToolTip();
o.popdown()
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmObjectManager")){
ZmObjectManager=function(t,e,a){
this._selectCallback=e;
this._uuid=Dwt.getNextId();
this._objectIdPrefix="OBJ_PREFIX_";
this._objectHandlers={};
if(appCtxt.get(ZmSetting.MAIL_ENABLED)&&window.ZmImageAttachmentObjectHandler){
this._imageAttachmentHandler=new ZmImageAttachmentObjectHandler()
}
if(!a){
this.initialized=false;
this._addAutoHandlers()
}else{
this.initialized=true
}
this.sortHandlers();
this.reset();
this.setView(t)
};
ZmObjectManager._TOOLTIP_DELAY=275;
ZmObjectManager.EMAIL="email";
ZmObjectManager.URL="url";
ZmObjectManager.PHONE="phone";
ZmObjectManager.DATE="date";
ZmObjectManager.ADDRESS="address";
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.useType=type
}
if(priority){
c.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===obj){
c.splice(i,1);
break
}}};
ZmObjectManager.prototype.toString=function(){
return"ZmObjectManager"
};
ZmObjectManager.prototype.getHandlers=function(){
if(!this.initialized&&appCtxt.zimletsPresent()){
var e=appCtxt.getZimletMgr();
if(e.isLoaded()){
this.initialized=true;
var a=e.getContentZimlets();
for(var t=0;
t<a.length;
t++){
this.addHandler(a[t],a[t].type,a[t].prio)
}}}
return this._objectHandlers
};
ZmObjectManager.prototype.addHandler=function(a,t,e){
t=t||(a.getTypeName()?a.getTypeName():"none");
e=e?e:-1;
a._prio=e;
var o=this.getHandlers();
if(!o[t]){
o[t]=[]
}
o[t].push(a)
};
ZmObjectManager.prototype.removeHandler=function(a,t){
t=t||(a.getTypeName()?a.getTypeName():"none");
var n=this.getHandlers();
if(n[t]){
for(var e=0,o=n[t].length;
e<o;
e++){
if(n[t][e]==a){
n[t].splice(e,1);
break
}}}};
ZmObjectManager.prototype.sortHandlers=function(){
this._allObjectHandlers=[];
var t=this.getHandlers();
for(i in t){
t.sort(ZmObjectManager.__byPriority);
for(var e=0;
e<t.length;
e++){
this._allObjectHandlers.push(t[e])
}}
this._allObjectHandlers.sort(ZmObjectManager.__byPriority)
};
ZmObjectManager.prototype._addAutoHandlers=function(){
var s=ZmObjectManager._autohandlers,e,o,n;
for(e=0;
e<s.length;
++e){
o=s[e];
var a=o;
var t=o.TYPE;
if(appCtxt.zimletsPresent()){
if(!(o instanceof ZmZimletBase)){
a=new o()
}}
if(o.useType){
t=o.useType
}
if(o.usePrio){
n=o.usePrio
}
this.addHandler(a,t,n)
}};
ZmObjectManager.prototype.reset=function(){
this._objects={}
};
ZmObjectManager.prototype.setView=function(e){
if(e!=null&&appCtxt.getZimletMgr().isLoaded()){
e.addListener(DwtEvent.ONMOUSEOVER,new AjxListener(this,this._mouseOverListener));
e.addListener(DwtEvent.ONMOUSEOUT,new AjxListener(this,this._mouseOutListener));
e.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._mouseDownListener));
e.addListener(DwtEvent.ONMOUSEUP,new AjxListener(this,this._mouseUpListener));
e.addListener(DwtEvent.ONMOUSEMOVE,new AjxListener(this,this._mouseMoveListener));
e.addListener(DwtEvent.ONCONTEXTMENU,new AjxListener(this,this._rightClickListener));
this._hoverOverListener=new AjxListener(this,this._handleHoverOver);
this._hoverOutListener=new AjxListener(this,this._handleHoverOut)
}
this._view=e
};
ZmObjectManager.prototype.objectsCount=function(){
return(appCtxt.zimletsPresent())?appCtxt.getZimletMgr().getContentZimlets().length:0
};
ZmObjectManager.prototype.getImageAttachmentHandler=function(){
return this._imageAttachmentHandler
};
ZmObjectManager.prototype._getAjxEmailAddress=function(e){
if(appCtxt.isChildWindow&&e.isAjxEmailAddress){
e=AjxEmailAddress.copy(e)
}
return e
};
ZmObjectManager.prototype.findObjects=function(f,e,o,m,a){
if(!f){
return""
}
var h=[];
var c=0;
var l=f.length;
var b=0;
var n=this.getHandlers();
while(true){
var w=null;
var p=l;
var u=null;
var y;
var d;
var r;
var s=null;
if(o){
d=n[o];
if(d){
for(y=0;
y<d.length;
y++){
s=d[y].findObject(f,b);
if(!s){
continue
}
if(s.index>=p){
break
}
w=s;
p=s.index;
u=d[y]
}}
if(o=="email"||f instanceof AjxEmailAddress){
if(u){
f=this._getAjxEmailAddress(f);
this.generateSpan(u,h,c,f,null,a)
}else{
h[c++]=AjxStringUtil.htmlEncode(f.toString())
}
return h.join("")
}}else{
for(var g=0;
g<this._allObjectHandlers.length;
g++){
var t=this._allObjectHandlers[g];
s=t.findObject(f,b);
if(s&&s.index<p){
w=s;
p=s.index;
u=t
}}}
if(!w){
r=f.substring(b,l);
if(e){
h[c++]=AjxStringUtil.htmlEncode(r,!!m)
}else{
h[c++]=r
}
break
}
if(p>b){
r=f.substring(b,p);
if(e){
h[c++]=AjxStringUtil.htmlEncode(r,!!m)
}else{
h[c++]=r
}}
if(u){
c=this.generateSpan(u,h,c,w[0],w.context)
}else{
h[c++]=w[0]
}
b=w.index+(w.matchLength||w[0].length)
}
return h.join("")
};
ZmObjectManager.prototype.processObjectsInNode=function(s,n){
var e=this;
var a=s.createElement("div");
s||(s=n.ownerDocument);
var o=function(l,c){
var u,m,h,p;
switch(l.nodeType){
case 1:l.normalize();
u=l.tagName.toLowerCase();
if(p==null){
if(/^(img|a)$/.test(u)){
var y=(u=="a"&&ZmMailMsgView._MAILTO_RE.test(l.href));
if(u=="a"&&l.target&&(y||ZmMailMsgView._URL_RE.test(l.href))){
var f=y?l.href:RegExp.$1;
u=s.createElement("div");
u.innerHTML=e.findObjects(AjxStringUtil.trim(f));
u=u.firstChild;
if(u.nodeType==3){
return u.nextSibling
}
l.parentNode.insertBefore(u,l);
u.innerHTML="";
u.appendChild(l);
return u.nextSibling
}
c=false
}}else{
l=p
}
if(parseFloat(l.style.textIndent)<0){
l.style.textIndent=""
}
for(m=l.firstChild;
m;
m=o(m,c)){}
return l.nextSibling;
case 3:case 4:if(c&&/[^sxA0]/.test(l.data)){
try{
var k=null,w=null;
if(!AjxEnv.isIE){
var d=/^[sxA0]+/.exec(l.data);
if(d){
k=l;
l=l.splitText(d[0].length)
}
d=/[sxA0]+$/.exec(l.data);
if(d){
w=l.splitText(l.data.length-d[0].length)
}}
u=a;
var r=e.findObjects(l.data,true,null,false);
var v=false;
if(AjxEnv.isIE){
u.innerHTML=["<pre>",r,"</pre>"].join("");
v=true
}else{
u.innerHTML=r
}
if(k){
u.insertBefore(k,u.firstChild)
}
if(w){
u.appendChild(w)
}
k=l.parentNode;
if(v){
u=u.firstChild
}
while(u.firstChild){
k.insertBefore(u.firstChild,l)
}
u=l.nextSibling;
k.removeChild(l);
return u
}
catch(g){}}}
return l.nextSibling
};
for(var t=0;
t<n.childNodes.length;
t++){
o(n.childNodes[t],true)
}};
ZmObjectManager.prototype.findObjectsInNode=function(a,t,n,s){
var o=this,h=a.ownerDocument,l=h.createElement("div");
if(!t){
t=/^(script|link|object|iframe|applet)$/i
}
var e=function(u,m){
var p,g,d,w;
switch(u.nodeType){
case 1:u.normalize();
p=u.tagName.toLowerCase();
if(s&&s.foreachElement){
w=s.foreachElement(u,p,t,n)
}
if(w==null){
if(/^(img|a)$/.test(p)){
if(p=="a"&&u.target&&(ZmMailMsgView._URL_RE.test(u.href)||ZmMailMsgView._MAILTO_RE.test(u.href))){
var y=RegExp.$1;
p=h.createElement("div");
p.innerHTML=o.findObjects(AjxStringUtil.trim(RegExp.$1));
p=p.firstChild;
if(p.nodeType==3){
return p.nextSibling
}
u.parentNode.insertBefore(p,u);
p.innerHTML="";
p.appendChild(u);
return p.nextSibling
}
m=false
}else{
if(t.test(p)||(n&&!n.test(p))){
p=u.nextSibling;
u.parentNode.removeChild(u);
return p
}}}else{
u=w
}
if(AjxEnv.isIE){
u.style.cssText=u.style.cssText
}
for(g=u.firstChild;
g;
g=e(g,m)){}
return u.nextSibling;
case 3:case 4:if(m&&/[^sxA0]/.test(u.data)){
try{
var q=null,k=null;
if(!AjxEnv.isIE){
var f=/^[sxA0]+/.exec(u.data);
if(f){
q=u;
u=u.splitText(f[0].length)
}
f=/[sxA0]+$/.exec(u.data);
if(f){
k=u.splitText(u.data.length-f[0].length)
}}
p=l;
var c=o.findObjects(u.data,true,null,false);
var x=false;
if(AjxEnv.isIE){
p.innerHTML=["<pre>",c,"</pre>"].join("");
x=true
}else{
p.innerHTML=c
}
if(q){
p.insertBefore(q,p.firstChild)
}
if(k){
p.appendChild(k)
}
q=u.parentNode;
if(x){
p=p.firstChild
}
while(p.firstChild){
q.insertBefore(p.firstChild,u)
}
p=u.nextSibling;
q.removeChild(u);
return p
}
catch(v){}}}
return u.nextSibling
};
var r=h.createDocumentFragment();
while(a.firstChild){
r.appendChild(a.firstChild);
e(r.lastChild,true,this)
}
a.appendChild(r)
};
ZmObjectManager.prototype.findMatch=function(r,h){
if(!r){
return""
}
var a=r.length;
var s=0;
var l=null;
var e=a;
var c=null;
var n;
var u=null;
if(h){
var t=this.getHandlers()[h];
if(t){
for(n=0;
n<t.length;
n++){
u=t[n].findObject(r,s);
if(!u){
continue
}
if(u.index>=e){
break
}
l=u;
e=u.index;
c=t[n]
}}}else{
for(var o=0;
o<this._allObjectHandlers.length;
o++){
var d=this._allObjectHandlers[o];
u=d.findObject(r,s);
if(u&&u.index<e){
l=u;
e=u.index;
c=d
}}}
return l
};
ZmObjectManager.prototype.processHtmlNode=function(l,h,y,u){
var w=l.ownerDocument;
h=h!=null?h:true;
var r=y instanceof RegExp?y:null;
if(!r){
y=y||["script","link","object","style","applet","iframe"];
y=y instanceof Array?y:[y];
r=new RegExp("^("+y.join("|")+")$","i")
}
var m=u instanceof RegExp?u:null;
if(!m&&u){
u=u instanceof Array?u:;
m=new RegExp("^("+u.join("|")+")$","i")
}
var f,c,v;
switch(l.nodeType){
case 1:l.normalize();
f=l.tagName.toLowerCase();
if(/^(img|a)$/.test(f)){
if(f=="a"&&(ZmMailMsgView._URL_RE.test(l.href)||ZmMailMsgView._MAILTO_RE.test(l.href))){
var n=RegExp.$1;
f=w.createElement("div");
f.innerHTML=this.findObjects(AjxStringUtil.trim(RegExp.$1));
f=f.firstChild;
if(f.nodeType==3){
return f.nextSibling
}
l.parentNode.insertBefore(f,l);
f.innerHTML="";
f.appendChild(l);
return f.nextSibling
}
h=false
}else{
if(r.test(f)){
f=l.nextSibling;
l.parentNode.removeChild(l);
return f
}else{
if(m&&m.test(f)){
f=l.nextSibling;
var e=w.createDocumentFragment();
for(var o=l.firstChild;
o;
o=o.nextSibling){
e.appendChild(o)
}
l.parentNode.replaceChild(e,l);
return f
}else{
if(f=="style"){
return l.nextSibling
}}}}
if(AjxEnv.isIE){
l.style.cssText=l.style.cssText
}
var o=l.firstChild;
while(o){
o=this.processHtmlNode(o,h,r,m)
}
return l.nextSibling;
case 3:case 4:if(h&&/[^sxA0]/.test(l.data)){
try{
var g=null,p=null;
if(!AjxEnv.isIE){
if(/^[sxA0]+/.test(l.data)){
g=l;
l=l.splitText(RegExp.lastMatch.length)
}
if(/[sxA0]+$/.test(l.data)){
p=l.splitText(l.data.length-RegExp.lastMatch.length)
}}
f=w.createElement("div");
var t=this.findObjects(l.data,true,null,false);
var s=false;
if(AjxEnv.isIE){
f.innerHTML=["<pre>",t,"</pre>"].join("");
s=true
}else{
f.innerHTML=t
}
if(g){
f.insertBefore(g,f.firstChild)
}
if(p){
f.appendChild(p)
}
g=l.parentNode;
if(s){
f=f.firstChild
}
while(f.firstChild){
g.insertBefore(f.firstChild,l)
}
f=l.nextSibling;
g.removeChild(l);
return f
}
catch(d){}}}
return l.nextSibling
};
ZmObjectManager.prototype.setHandlerAttr=function(o,t,n){
var e=this.getHandlers()[o];
if(e){
for(var a=0;
a<e.length;
a++){
e[a][t]=n
}}};
ZmObjectManager.prototype.generateSpan=function(n,o,e,s,a,t){
var r=this._objectIdPrefix+Dwt.getNextId();
if(n&&n.name){
r=r+"_"+n.name
}
this._objects[r]={
object:s,handler:n,id:r,context:a};
return n.generateSpan(o,e,s,r,a,t)
};
ZmObjectManager.prototype._findObjectSpan=function(t){
while(t&&(!t.id||t.id.indexOf(this._objectIdPrefix)!==0)){
t=t.parentNode
}
return t
};
ZmObjectManager.prototype._mouseOverListener=function(n){
var o=this._findObjectSpan(n.target);
if(!o){
return false
}
var e=this._objects[o.id];
if(!e){
return false
}
o.className=e.handler.getHoveredClassName(e.object,e.context,o.id);
if(e.handler.hasToolTipText()){
var a=DwtShell.getShell(window);
var t=a.getHoverMgr();
if((!t.isHovering()||t.getHoverObject()!=e)&&!DwtMenu.menuShowing()){
t.reset();
t.setHoverOverDelay(ZmObjectManager._TOOLTIP_DELAY);
t.setHoverObject(e);
t.setHoverOverData(e);
t.setHoverOverListener(this._hoverOverListener);
t.hoverOver(n.docX,n.docY);
n.hoverStarted=true
}}
n._returnValue=true;
n._dontCallPreventDefault=true;
return false
};
ZmObjectManager.prototype._mouseOutListener=function(n){
var o=this._findObjectSpan(n.target);
var e=o?this._objects[o.id]:null;
if(e){
o.className=e.handler.getClassName(e.object,e.context,o.id);
var a=DwtShell.getShell(window);
var t=a.getHoverMgr();
t.setHoverOutDelay(0);
t.setHoverOutData(e);
t.setHoverOutListener(this._hoverOutListener);
t.hoverOut()
}
return false
};
ZmObjectManager.prototype._mouseMoveListener=function(n){
n._returnValue=true;
n._dontCallPreventDefault=true;
n._stopPropagation=true;
var o=this._findObjectSpan(n.target);
var e=o?this._objects[o.id]:null;
if(e){
var a=DwtShell.getShell(window);
var t=a.getHoverMgr();
if(!t.isHovering()){
t.hoverOver(n.docX,n.docY)
}}
return false
};
ZmObjectManager.prototype._rightClickListener=function(e){
e.button=DwtMouseEvent.RIGHT;
return this._mouseDownListener(e)
};
ZmObjectManager.prototype._mouseDownListener=function(s){
s._dontCallPreventDefault=true;
s._returnValue=true;
s._stopPropagation=false;
var n=this._findObjectSpan(s.target);
if(!n){
return true
}
var t=this._objects[n.id];
if(!t){
return true
}
s._stopPropagation=true;
var o=DwtShell.getShell(window);
var a=o.getHoverMgr();
a.setHoverOutDelay(0);
a.setHoverOutData(t);
a.setHoverOutListener(this._hoverOutListener);
a.hoverOut();
n.className=t.handler.getActiveClassName(t.object,t.context,n.id);
if(s.button==DwtMouseEvent.RIGHT){
var e=(this._view instanceof DwtDialog);
var r=t.handler.getActionMenu(t.object,n,t.context,e);
if(r){
r.popup(0,s.docX,s.docY);
s._dontCallPreventDefault=false;
s._returnValue=false;
s._stopPropagation=true;
return true
}}else{
if(s.button==DwtMouseEvent.LEFT){
if(this._selectCallback){
this._selectCallback.run()
}
t.handler.selected(t.object,n,s,t.context);
return true
}}
return false
};
ZmObjectManager.prototype._mouseUpListener=function(a){
a._returnValue=true;
a._dontCallPreventDefault=true;
a._stopPropagation=true;
var t=this._findObjectSpan(a.target);
if(!t){
return false
}
var e=this._objects[t.id];
if(!e){
return false
}
t.className=e.handler.getHoveredClassName(e.object,e.context,t.id);
return false
};
ZmObjectManager.prototype._handleHoverOver=function(s){
if(!(s&&s.object)){
return
}
var n=this._findObjectSpan(s.target);
var o=s.object.handler;
var t=s.object.object;
var a=s.object.context;
var h=s.object.id;
var e=s.x;
var r=s.y;
o.hoverOver(t,a,e,r,n,h)
};
ZmObjectManager.prototype._handleHoverOut=function(n){
if(!(n&&n.object)){
return
}
var o=this._findObjectSpan(n.target);
var a=n.object.handler;
var e=n.object.object;
var t=n.object.context;
var s=n.object.id;
a.hoverOut(e,t,o,s)
};
ZmObjectManager.__byPriority=function(t,e){
return(e._prio<t._prio)-(t._prio<e._prio)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSettings")){
ZmSettings=function(e){
ZmModel.call(this,ZmEvent.S_SETTINGS);
this._settings={};
this._nameToId={};
this.getInfoResponse=null;
this._handleImplicitChange=new AjxListener(this,this._implicitChangeListener);
if(!e){
this.initialize()
}};
ZmSettings.prototype=new ZmModel;
ZmSettings.prototype.constructor=ZmSettings;
ZmSettings.BASE64_TO_NORMAL_RATIO=1.34;
ZmSettings.prototype.registerSetting=function(a,t){
ZmSetting[a]=a;
var e=this._settings[a]=new ZmSetting(a,t);
if(t.name){
this._nameToId[t.name]=a
}
if(t.isImplicit){
e.addChangeListener(this._handleImplicitChange)
}
return e
};
ZmSettings.prototype.toString=function(){
return"ZmSettings"
};
ZmSettings.prototype.initialize=function(){
this._initialize();
this._setDefaults();
this.userSettingsLoaded=false;
var e=new AjxListener(this,this._changeListener);
if(!appCtxt.multiAccounts){
this.getSetting(ZmSetting.QUOTA_USED).addChangeListener(e)
}
this.getSetting(ZmSetting.POLLING_INTERVAL).addChangeListener(e);
this.getSetting(ZmSetting.SKIN_NAME).addChangeListener(e);
this.getSetting(ZmSetting.LOCALE_NAME).addChangeListener(e);
this.getSetting(ZmSetting.SHORTCUTS).addChangeListener(e);
this.getSetting(ZmSetting.CHILD_ACCTS_VISIBLE).addChangeListener(e);
this.getSetting(ZmSetting.ATTACHMENTS_BLOCKED).addChangeListener(e);
if(appCtxt.isOffline){
this.getSetting(ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_IS_MAILTO_HANDLER).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_ACCOUNT_ID).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_INTERVAL).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_PATH).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_KEEP).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_UPDATE_NOTIFY).addChangeListener(e)
}};
ZmSettings.prototype.get=function(t,e){
return(t&&this._settings[t])?this._settings[t].getValue(e):null
};
ZmSettings.prototype.getSetting=function(e){
return this._settings[e]
};
ZmSettings.prototype.createFromJs=function(s,h,r,c){
c=c==null||c;
for(var o in s){
var t=s[o];
var d=this._settings[this._nameToId[o]];
if(d){
if(d.dataType==ZmSetting.D_HASH){
var e=t.split(",");
var l={};
for(var a=0;
a<e.length;
a++){
var n=e[a].split(":");
l[n[0]]=n[1]
}
t=l
}
d.setValue(t,null,h,r,c);
if(ZmSetting.IS_IMPLICIT[d.id]){
d.origValue=d.copyValue()
}}else{}}};
ZmSettings.prototype.getSettingByName=function(e){
return this._nameToId[e]
};
ZmSettings.prototype.attrExists=function(t){
var e=this.getSetting(t).name;
return(this.getInfoResponse.prefs._attrs[e]||this.getInfoResponse.attrs._attrs[e])
};
ZmSettings.prototype.loadUserSettings=function(h,o,r,a,e){
var n=[h,r];
if(e){
var s=AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount");
var l=new AjxCallback(this,this._handleResponseLoadUserSettings,n);
e.addNewRequestParams(s,l)
}else{
var t={
soapDoc:(a?null:AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount")),accountName:r,asyncMode:true,callback:(new AjxCallback(this,this._handleResponseLoadUserSettings,n)),errorCallback:o,response:a};
appCtxt.getAppController().sendRequest(t)
}};
ZmSettings.prototype._handleResponseLoadUserSettings=function(a,t,e){
this.setUserSettings(e.getResponse().GetInfoResponse,t);
this.userSettingsLoaded=true;
if(a){
a.run(e)
}};
ZmSettings.prototype.setUserSettings=function(s){
s=Dwt.getParams(arguments,["info","accountName","setDefault","skipNotify","skipImplicit","preInit"]);
var t=this.getInfoResponse=s.info;
var u=s.accountName;
var d=s.preInit?false:s.setDefault;
var l=s.preInit?true:s.skipNotify;
var g=s.preInit?true:s.skipImplicit;
var o=[ZmSetting.ADMIN_DELEGATED,t.adminDelegated,ZmSetting.ATTACHMENT_SIZE_LIMIT,this._base64toNormalSize(t.attrs._attrs.zimbraMtaMaxMessageSize),ZmSetting.CHANGE_PASSWORD_URL,t.changePasswordURL,ZmSetting.DOCUMENT_SIZE_LIMIT,this._base64toNormalSize(t.attrs._attrs.zimbraFileUploadMaxSize),ZmSetting.LAST_ACCESS,t.accessed,ZmSetting.LICENSE_STATUS,t.license&&t.license.status,ZmSetting.PREVIOUS_SESSION,t.prevSession,ZmSetting.PUBLIC_URL,t.publicURL,ZmSetting.QUOTA_USED,t.used,ZmSetting.RECENT_MESSAGES,t.recent,ZmSetting.REST_URL,t.rest,ZmSetting.USERNAME,t.name,ZmSetting.EMAIL_VALIDATION_REGEX,t.zimbraMailAddressValidationRegex,ZmSetting.DISABLE_SENSITIVE_ZIMLETS_IN_MIXED_MODE,(t.domainSettings&&t.domainSettings.zimbraZimletDataSensitiveInMixedModeDisabled?t.domainSettings.zimbraZimletDataSensitiveInMixedModeDisabled:"FALSE")];
for(var r=0;
r<o.length;
r+=2){
var m=o[r+1];
if(m!=null){
this._settings[o[r]].setValue(m,null,d,l,g)
}}
if(t.attrs&&t.attrs._attrs){
this.createFromJs(t.attrs._attrs,d,l,g)
}
if(this.get(ZmSetting.ADMIN_DELEGATED)&&!this.get(ZmSetting.ADMIN_MAIL_ENABLED)){
this.getSetting(ZmSetting.MAIL_ENABLED).setValue(false)
}
if(s.preInit){
return
}
if(t.prefs&&t.prefs._attrs){
this.createFromJs(t.prefs._attrs,d,l,g)
}
if(!u){
appCtxt.accountList.createAccounts(this,t);
if(appCtxt.isOffline){
if(AjxEnv.isPrism&&window.platform){
var p=this._settings[ZmSetting.OFFLINE_SUPPORTS_MAILTO];
if(p){
p.setValue(true,null,d,l,g)
}
p=this._settings[ZmSetting.OFFLINE_SUPPORTS_DOCK_UPDATE];
if(p){
p.setValue(true,null,d,l,g)
}}
appCtxt.set(ZmSetting.SHARING_ENABLED,true,null,d,l)
}}
var p=this._settings[ZmSetting.REPLY_TO_ADDRESS];
if(p){
p.defaultValue=this.get(ZmSetting.USERNAME)
}
if(!this.get(ZmSetting.SEARCH_ENABLED)){
p=this._settings[ZmSetting.BROWSE_ENABLED];
if(p){
p.setValue(false,null,d,l,g)
}}
if(this.get(ZmSetting.FORCE_CAL_OFF)){
p=this._settings[ZmSetting.CALENDAR_ENABLED];
if(p){
p.setValue(false,null,d,l,g)
}}
if(!this.get(ZmSetting.OPTIONS_ENABLED)){
p=this._settings[ZmSetting.FILTERS_ENABLED];
if(p){
p.setValue(false,null,d,l,g)
}}
if(!u){
if(t.zimlets&&t.zimlets.zimlet){
if(this.get(ZmSetting.ZIMLETS_SYNCHRONOUS)){
var n=new AjxTimedAction(this,this._beginLoadZimlets,[t.zimlets.zimlet,t.props.prop,true]);
AjxTimedAction.scheduleAction(n,0)
}else{
var e=new AjxListener(this,this._beginLoadZimlets,[t.zimlets.zimlet,t.props.prop,false]);
appCtxt.getAppController().addListener(ZmAppEvent.POST_STARTUP,e)
}}else{
appCtxt.allZimletsLoaded()
}}
var m=appCtxt.get(ZmSetting.REPLY_INCLUDE_ORIG);
if(m){
var h=ZmMailApp.INC_MAP[m];
appCtxt.set(ZmSetting.REPLY_INCLUDE_WHAT,h[0],null,d,l);
appCtxt.set(ZmSetting.REPLY_USE_PREFIX,h[1],null,d,l);
appCtxt.set(ZmSetting.REPLY_INCLUDE_HEADERS,h[2],null,d,l)
}
var m=appCtxt.get(ZmSetting.FORWARD_INCLUDE_ORIG);
if(m){
var h=ZmMailApp.INC_MAP[m];
appCtxt.set(ZmSetting.FORWARD_INCLUDE_WHAT,h[0],null,d,l);
appCtxt.set(ZmSetting.FORWARD_USE_PREFIX,h[1],null,d,l);
appCtxt.set(ZmSetting.FORWARD_INCLUDE_HEADERS,h[2],null,d,l)
}
var c=ZmSettings.DEFAULT_SORT_PREF;
c[ZmId.VIEW_CONVLIST]=ZmSearch.DATE_DESC;
c[ZmId.VIEW_CONV]=ZmSearch.DATE_DESC;
c[ZmId.VIEW_TRAD]=ZmSearch.DATE_DESC;
c[ZmId.VIEW_CONTACT_SRC]=ZmSearch.NAME_ASC;
c[ZmId.VIEW_CONTACT_TGT]=ZmSearch.NAME_ASC;
c[ZmId.VIEW_CONTACT_SIMPLE]=ZmSearch.NAME_ASC;
c[ZmId.VIEW_CAL]=ZmSearch.DATE_ASC;
c[ZmId.VIEW_TASKLIST]=ZmSearch.DUE_DATE_ASC;
c[ZmId.VIEW_BRIEFCASE_DETAIL]=ZmSearch.SUBJ_ASC;
var a=this._settings[ZmSetting.SORTING_PREF];
if(a){
for(var f in c){
if(!a.getValue(f)){
a.setValue(c[f],f,false,true)
}}
a.setValue(ZmSearch.DATE_DESC,ZmId.VIEW_CONVLIST,false,true);
a.setValue(ZmSearch.DATE_DESC,ZmId.VIEW_CONV,false,true);
a.setValue(ZmSearch.DATE_DESC,ZmId.VIEW_TRAD,false,true);
a.defaultValue=AjxUtil.hashCopy(c)
}};
ZmSettings.prototype._beginLoadZimlets=function(e,o,t){
var a=new AjxCallback(this,this._loadZimletPackage,[e,o,t]);
AjxDispatcher.require(["Startup2"],false,a)
};
ZmSettings.prototype._loadZimletPackage=function(e,o,t){
var a=new AjxCallback(this,this._loadZimlets,[e,o,t]);
AjxDispatcher.require("Zimlet",false,a)
};
ZmSettings.prototype._loadZimlets=function(t,h,c){
t=t||[];
this.registerSetting("ZIMLETS",{
type:ZmSetting.T_CONFIG,defaultValue:t,isGlobal:true}
);
this.registerSetting("USER_PROPS",{
type:ZmSetting.T_CONFIG,defaultValue:h}
);
var o=this._getCheckedZimlets(t);
var a=appCtxt.getZimletMgr();
a.loadZimlets(o,h,null,null,c);
if(o&&o.length){
var e=appCtxt.getCurrentApp();
if(e){
var u;
if(appCtxt.multiAccounts){
var s=e.getOverviewContainer().containerId;
var d=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET];
var n=[s,d].join("_");
u=appCtxt.getOverviewController().getOverview(n)
}else{
u=e.getOverview()
}}
if(u){
u.setTreeView(ZmOrganizer.ZIMLET);
if(appCtxt.multiAccounts&&a.getPanelZimlets().length==0){
e.getOverviewContainer().removeZimletSection()
}}
if(appCtxt.get(ZmSetting.PORTAL_ENABLED)){
var r=appCtxt.getApp(ZmApp.PORTAL).getPortletMgr();
var l=r.createPortlets(true)
}}};
ZmSettings.prototype._getCheckedZimlets=function(a){
var o=[];
for(var t=0;
t<a.length;
t++){
var e=a[t];
if(e.zimletContext[0].presence!="disabled"){
o.push(e)
}}
return o
};
ZmSettings.prototype.loadPreferenceData=function(h){
var r=new ZmBatchCommand(null,appCtxt.accountList.mainAccount.name);
var s=AjxSoapDoc.create("GetAvailableSkinsRequest","urn:zimbraAccount");
var n=new AjxCallback(this,this._handleResponseLoadAvailableSkins);
r.addNewRequestParams(s,n);
var e=AjxSoapDoc.create("GetAvailableLocalesRequest","urn:zimbraAccount");
var o=new AjxCallback(this,this._handleResponseGetAllLocales);
r.addNewRequestParams(e,o);
var t=AjxSoapDoc.create("GetAvailableCsvFormatsRequest","urn:zimbraAccount");
var a=new AjxCallback(this,this._handleResponseGetAvailableCsvFormats);
r.addNewRequestParams(t,a);
r.run(h)
};
ZmSettings.prototype._handleResponseLoadAvailableSkins=function(e){
var n=e.getResponse().GetAvailableSkinsResponse;
var o=n.skin;
if(o&&o.length){
var a=appCtxt.accountList.mainAccount.settings.getSetting(ZmSetting.AVAILABLE_SKINS);
for(var t=0;
t<o.length;
t++){
a.setValue(o[t].name)
}}};
ZmSettings.prototype._handleResponseGetAllLocales=function(a){
var t=a._data.GetAvailableLocalesResponse.locale;
if(t&&t.length){
for(var o=0,n=t.length;
o<n;
o++){
var e=t[o];
e.id=e.id.replace(/^in/,"id");
ZmLocale.create(e.id,e.name)
}
this.getSetting(ZmSetting.LOCALE_CHANGE_ENABLED).setValue(ZmLocale.hasChoices())
}};
ZmSettings.prototype._handleResponseGetAvailableCsvFormats=function(t){
var e=t.getResponse().GetAvailableCsvFormatsResponse.csv;
if(e&&e.length){
var o=appCtxt.accountList.mainAccount.settings.getSetting(ZmSetting.AVAILABLE_CSVFORMATS);
for(var a=0;
a<e.length;
a++){
o.setValue(e[a].name)
}}};
ZmSettings.prototype.save=function(y,o,s,t,m){
if(!(y&&y.length)){
return
}
var r=t||appCtxt.getActiveAccount();
var b=AjxSoapDoc.create("ModifyPrefsRequest","urn:zimbraAccount");
var n=false;
var p=[],h={}
,c;
for(var g=0;
g<y.length;
g++){
c=y[g];
if(h[c.id]){
continue
}
if(c.type==ZmSetting.T_METADATA){
p.push(c);
r.metaData.update(c.section,c.name,c.getValue());
continue
}else{
if(c.type!=ZmSetting.T_PREF){
continue
}}
if(!c.name){
continue
}
if(c.dataType==ZmSetting.D_LIST){
var d=c.getValue();
if(d&&d.length){
for(var f=0;
f<d.length;
f++){
var u=b.set("pref",d[f]);
u.setAttribute("name",c.name)
}}else{
var u=b.set("pref","");
u.setAttribute("name",c.name)
}}else{
var d=c.getValue(null,true);
var u=b.set("pref",d);
u.setAttribute("name",c.name)
}
h[c.id]=true;
n=true
}
if(appCtxt.isOffline&&ZmSetting.IS_IMPLICIT[c.id]&&ZmSetting.IS_GLOBAL[c.id]){
r=appCtxt.accountList.mainAccount
}
if(p.length>0){
var e=new AjxCallback(this,this._handleResponseSaveMetaData,[p]);
var l=[ZmSetting.M_IMPLICIT,ZmSetting.M_OFFLINE];
r.metaData.save(l,e)
}
if(n){
var a;
if(o||s){
a=new AjxCallback(this,this._handleResponseSave,[y,o])
}
if(s){
s.addNewRequestParams(b,a)
}else{
appCtxt.getAppController().sendRequest({
soapDoc:b,asyncMode:true,callback:a,accountName:r.name,noBusyOverlay:m}
)
}}};
ZmSettings.prototype._handleResponseSaveMetaData=function(o,e){
for(var t=0;
t<o.length;
t++){
var a=o[t];
if(!ZmSetting.IS_IMPLICIT[a.id]){
a.origValue=a.copyValue();
a._notify(ZmEvent.E_MODIFY)
}}};
ZmSettings.prototype._handleResponseSave=function(o,s,e){
var n=e.getResponse();
if(n.ModifyPrefsResponse!=null){
for(var t=0;
t<o.length;
t++){
var a=o[t];
a.origValue=a.copyValue();
if(!ZmSetting.IS_IMPLICIT[a.id]){
a._notify(ZmEvent.E_MODIFY)
}}
this._notify(ZmEvent.E_MODIFY,{
settings:o}
)
}
if(s){
s.run(e)
}};
ZmSettings.DEFAULT_SORT_PREF={};
ZmSettings.prototype._setDefaults=function(){
var t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/soap/",qsReset:true}
);
this._settings[ZmSetting.CSFE_SERVER_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/home/~/",qsReset:true,qsArgs:{
auth:"co"}}
);
this._settings[ZmSetting.CSFE_MSG_FETCHER_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/upload",qsReset:true,qsArgs:{
lbfums:""}}
);
this._settings[ZmSetting.CSFE_UPLOAD_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/upload",qsReset:true}
);
this._settings[ZmSetting.CSFE_ATTACHMENT_UPLOAD_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/home/~/",qsReset:true,qsArgs:{
auth:"co",id:"{0}",fmt:"csv"}}
);
this._settings[ZmSetting.CSFE_EXPORT_URI].setValue(t,null,false,true);
var e=location.hostname;
var a=((e.indexOf(".zimbra.com")!=-1)||(window.appDevMode&&(/.local$/.test(e)||(!appCtxt.isOffline&&e=="localhost"))));
this._settings[ZmSetting.IS_DEV_SERVER].setValue(a);
if(a||window.isScriptErrorOn){
this._settings[ZmSetting.SHOW_SCRIPT_ERRORS].setValue(true,null,false,true)
}
this.setReportScriptErrorsSettings(AjxException,ZmController.handleScriptError)
};
ZmSettings.prototype.persistImplicitSortPrefs=function(e){
return ZmSettings.DEFAULT_SORT_PREF[e]
};
ZmSettings.prototype.setReportScriptErrorsSettings=function(t,a){
var e=t.reportScriptErrors=this._settings[ZmSetting.SHOW_SCRIPT_ERRORS].getValue();
if(e){
t.setScriptErrorHandler(a)
}};
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:"HELIX"}
);
this.registerSetting("CLIENT_DATETIME",{
type:ZmSetting.T_CONFIG,defaultValue:"20150521-0806"}
);
this.registerSetting("CLIENT_RELEASE",{
type:ZmSetting.T_CONFIG,defaultValue:"12052"}
);
this.registerSetting("CLIENT_VERSION",{
type:ZmSetting.T_CONFIG,defaultValue:"7.2.7 BETA"}
);
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",{
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("CHANGE_PASSWORD_URL",{
type:ZmSetting.T_CONFIG}
);
this.registerSetting("PUBLIC_URL",{
type:ZmSetting.T_CONFIG}
);
this.registerSetting("DISABLE_SENSITIVE_ZIMLETS_IN_MIXED_MODE",{
type:ZmSetting.T_CONFIG}
);
this.registerSetting("ASSISTANT_ENABLED",{
name:"zimbraFeatureZimbraAssistantEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("IM_ENABLED",{
name:"zimbraFeatureIMEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("ADMIN_MAIL_ENABLED",{
name:"zimbraFeatureAdminMailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
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("NOTEBOOK_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("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("MAIL_SEND_LATER_ENABLED",{
name:"zimbraFeatureMailSendLaterEnabled",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("BROWSE_ENABLED",{
name:"zimbraFeatureAdvancedSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("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("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("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("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("PEOPLE_SEARCH_ENABLED",{
name:"zimbraFeaturePeopleSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
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("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("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("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("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_DELEGATED_ADMIN",{
name:"zimbraIsDelegatedAdminAccount",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
this.registerSetting("ADMIN_REFERENCE",{
name:"zimbraWebClientAdminReference",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}
);
this.registerSetting("ATTACHMENT_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("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:true}
);
this.registerSetting("MIXED_VIEW_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
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("ACCOUNTS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}
);
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_TEXT,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("DEFAULT_TIMEZONE",{
name:"zimbraPrefTimeZoneId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:AjxTimezone.getServerId(AjxTimezone.DEFAULT),isGlobal:true}
);
this.registerSetting("DEFAULT_PRINTFONTSIZE",{
name:"zimbraPrefDefaultPrintFontSize",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.PRINT_FONT_SIZE,isGlobal:true}
);
this.registerSetting("FILTERS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}
);
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_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_ADDR_BUBBLES",{
name:"zimbraPrefAutocompleteAddressBubblesEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue: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._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}
)
};
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_NOTEBOOK_SYNC_ENABLED",{
name:"zimbraPrefNotebookSyncEnabled",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_REMOTE_SERVER_VERSION",{
name:"offlineRemoteServerVersion",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:"http://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(o){
if(o.type!=ZmEvent.S_SETTING){
return
}
var r=o.source.id;
if(r==ZmSetting.QUOTA_USED){
appCtxt.getAppController().setUserInfo()
}else{
if(r==ZmSetting.POLLING_INTERVAL){
appCtxt.getAppController().setPollInterval()
}else{
if(r==ZmSetting.SKIN_NAME){
var s=appCtxt.getYesNoMsgDialog();
s.reset();
var n=o.source.getValue();
s.registerCallback(DwtDialog.YES_BUTTON,this._newSkinYesCallback,this,[n,s]);
s.setMessage(ZmMsg.skinChangeRestart,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
if(r==ZmSetting.LOCALE_NAME){
if(appCtxt.isOffline&&AjxEnv.isPrism){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var t=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
if(t){
var e=appCtxt.get(ZmSetting.LOCALE_NAME).replace("_","-");
t.setCharPref("general.useragent.locale",e);
t.setCharPref("intl.accept_languages",e)
}}
catch(a){}}
var s=appCtxt.getYesNoMsgDialog();
s.reset();
var n=o.source.getValue();
s.registerCallback(DwtDialog.YES_BUTTON,this._refreshBrowserCallback,this,[s]);
s.setMessage(ZmMsg.localeChangeRestart,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
if(r==ZmSetting.CHILD_ACCTS_VISIBLE||r==ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED){
var s=appCtxt.getYesNoMsgDialog();
s.reset();
s.registerCallback(DwtDialog.YES_BUTTON,this._refreshBrowserCallback,this,[s]);
s.setMessage(ZmMsg.accountChangeRestart,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
if(appCtxt.isOffline&&r==ZmSetting.OFFLINE_IS_MAILTO_HANDLER){
appCtxt.getAppController().registerMailtoHandler(true,o.source.getValue())
}else{
if(appCtxt.isOffline&&r==ZmSetting.OFFLINE_UPDATE_NOTIFY){
appCtxt.getAppController()._offlineUpdateChannelPref(o.source.getValue())
}}}}}}}};
ZmSettings.prototype._implicitChangeListener=function(t){
if(t.type!=ZmEvent.S_SETTING){
return
}
var a=t.source.id;
var e=this.getSetting(a);
if(a==ZmSetting.FOLDERS_EXPANDED&&window.duringExpandAll){
if(!window.afterExpandAllCallback){
window.afterExpandAllCallback=this.save.bind(this,[e],null,null,appCtxt.getActiveAccount(),true)
}
return
}
if(ZmSetting.IS_IMPLICIT[a]&&e){
this.save([e],null,null,appCtxt.getActiveAccount(),true)
}};
ZmSettings.prototype._newSkinYesCallback=function(a,t){
t.popdown();
window.onbeforeunload=null;
var e=AjxUtil.formatUrl({
qsArgs:{
skin:a}}
);
ZmZimbraMail.sendRedirect(e)
};
ZmSettings.prototype._refreshBrowserCallback=function(t){
t.popdown();
window.onbeforeunload=null;
var e=AjxUtil.formatUrl({}
);
window.location.replace(e)
};
ZmSettings.prototype._base64toNormalSize=function(e){
if(!e||e===-1){
return e
}
return e/ZmSettings.BASE64_TO_NORMAL_RATIO
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmMetaData")){
ZmMetaData=function(e,t){
this._sections={};
this._account=e;
this._itemId=t
};
ZmMetaData.prototype.constructor=ZmMetaData;
ZmMetaData.NAMESPACE="zwc";
ZmMetaData.prototype.toString=function(){
return"ZmMetaData"
};
ZmMetaData.prototype.set=function(u,n,e,m,s,h){
var c;
if(this._itemId){
c=AjxSoapDoc.create("SetCustomMetadataRequest","urn:zimbraMail");
c.getMethod().setAttribute("id",this._itemId)
}else{
c=AjxSoapDoc.create("SetMailboxMetadataRequest","urn:zimbraMail")
}
var f=c.set("meta");
f.setAttribute("section",[ZmMetaData.NAMESPACE,u].join(":"));
for(var o in n){
var r=n[o];
if(AjxUtil.isObject(r)){
r=ZmSetting.serialize(r,ZmSetting.D_HASH)
}
var l=c.set("a",r,f);
l.setAttribute("n",o)
}
if(e){
e.addNewRequestParams(c,m,s)
}else{
var t={
soapDoc:c,asyncMode:true,callback:m,errorCallback:s,accountName:(this._account?this._account.name:null),sensitive:h};
appCtxt.getAppController().sendRequest(t)
}};
ZmMetaData.prototype.get=function(r,e,l,o){
var t=e||(new ZmBatchCommand());
var a=[ZmMetaData.NAMESPACE,r].join(":");
var n=this._sections[a];
if(!n){
var s;
if(this._itemId){
s=AjxSoapDoc.create("GetCustomMetadataRequest","urn:zimbraMail");
s.getMethod().setAttribute("id",this._itemId)
}else{
s=AjxSoapDoc.create("GetMailboxMetadataRequest","urn:zimbraMail")
}
var h=s.set("meta");
h.setAttribute("section",a);
t.addNewRequestParams(s);
if(!e){
t.run(l,o)
}}else{
if(l){
l.run(n)
}else{
return n
}}};
ZmMetaData.prototype.load=function(s,n,t){
if(!s){
return
}
if(!(s instanceof Array)){
s=[s]
}
var a=t||(new ZmBatchCommand());
for(var e=0;
e<s.length;
e++){
if(s[e]==ZmSetting.M_OFFLINE&&!appCtxt.isOffline){
continue
}
this.get(s[e],a)
}
if(!t){
if(a.size()>0){
var o=new AjxCallback(this,this._handleLoad,[n]);
a.run(o)
}}else{
if(n){
n.run(this._sections)
}}};
ZmMetaData.prototype._handleLoad=function(s,e){
this._sections={};
var a=e.getResponse().BatchResponse;
if(a){
var n=(this._itemId!=null)?a.GetCustomMetadataResponse:a.GetMailboxMetadataResponse;
if(n&&n.length){
for(var t=0;
t<n.length;
t++){
var o=n[t].meta[0];
this._sections[o.section]=o._attrs
}}}
if(s){
s.run(this._sections)
}};
ZmMetaData.prototype.modify=function(l,o,e,c,s){
var h=AjxSoapDoc.create("ModifyMailboxMetadataRequest","urn:zimbraMail");
var d=h.set("meta");
d.setAttribute("section",[ZmMetaData.NAMESPACE,l].join(":"));
for(var n in o){
var r=h.set("a",o[n],d);
r.setAttribute("n",n)
}
if(e){
e.addNewRequestParams(h,c,s)
}else{
var t={
soapDoc:h,asyncMode:true,callback:c,errorCallback:s,accountName:(this._account?this._account.name:null)};
appCtxt.getAppController().sendRequest(t)
}};
ZmMetaData.prototype.save=function(h,l,e){
if(!h){
return
}
if(!(h instanceof Array)){
h=[h]
}
var r=this._account?this._account.name:null;
var t=e||(new ZmBatchCommand(null,r));
for(var o=0;
o<h.length;
o++){
var c=h[o];
var a=[ZmMetaData.NAMESPACE,c].join(":");
var n=this._sections[a];
if(n){
this.set(c,n,t)
}}
if(!e){
if(t.size()>0){
t.run(l)
}}else{
if(l){
l.run()
}}};
ZmMetaData.prototype.update=function(n,a,o){
var t=[ZmMetaData.NAMESPACE,n].join(":");
var e=this._sections[t];
if(!e){
e=this._sections[t]={}
}
e[a]=o
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmKeyMap")){
ZmKeyMap=function(){
ZmKeyMap._setPreconditions();
DwtKeyMap.call(this);
this._load(this._map,ZmKeys,ZmKeyMap.MAP_NAME);
if(appCtxt.get(ZmSetting.DEV)){
this._map.Global["Alt+Shift+D,0"]=ZmKeyMap.DBG_NONE;
this._map.Global["Alt+Shift+D,1"]=ZmKeyMap.DBG_1;
this._map.Global["Alt+Shift+D,2"]=ZmKeyMap.DBG_2;
this._map.Global["Alt+Shift+D,3"]=ZmKeyMap.DBG_3;
this._map.Global["Alt+Shift+D,T"]=ZmKeyMap.DBG_TIMING
}};
ZmKeyMap.prototype=new DwtKeyMap(true);
ZmKeyMap.prototype.constructor=ZmKeyMap;
ZmKeyMap.MAP_NAME={};
ZmKeyMap.MAP_NAME.address="ZmAddressBubble";
ZmKeyMap.MAP_NAME.briefcase="ZmBriefcaseController";
ZmKeyMap.MAP_NAME.calendar="ZmCalViewController";
ZmKeyMap.MAP_NAME.call="ZmCallListController";
ZmKeyMap.MAP_NAME.compose="ZmComposeController";
ZmKeyMap.MAP_NAME.contacts="ZmContactListController";
ZmKeyMap.MAP_NAME.conversation="ZmConvController";
ZmKeyMap.MAP_NAME.conversationList="ZmConvListController";
ZmKeyMap.MAP_NAME.editAppointment="ZmApptComposeController";
ZmKeyMap.MAP_NAME.editContact="ZmContactController";
ZmKeyMap.MAP_NAME.editPage="ZmPageEditController";
ZmKeyMap.MAP_NAME.editTask="ZmTaskController";
ZmKeyMap.MAP_NAME.global="Global";
ZmKeyMap.MAP_NAME.mail="ZmMailListController";
ZmKeyMap.MAP_NAME.message="ZmMsgController";
ZmKeyMap.MAP_NAME.mixed="ZmMixedController";
ZmKeyMap.MAP_NAME.notebook="ZmNotebookPageController";
ZmKeyMap.MAP_NAME.options="ZmPrefController";
ZmKeyMap.MAP_NAME.tasks="ZmTaskListController";
ZmKeyMap.MAP_NAME.voicemail="ZmVoicemailListController";
ZmKeyMap.MAP_NAME_R={};
(function(){
for(var e in ZmKeyMap.MAP_NAME){
ZmKeyMap.MAP_NAME_R[ZmKeyMap.MAP_NAME[e]]=e
}}
)();
ZmKeyMap.ADDRESS_PICKER="AddressPicker";
ZmKeyMap.ASSISTANT="Assistant";
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_SCHEDULE_VIEW="ScheduleView";
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.COPY="Copy";
ZmKeyMap.DBG_NONE="DebugNone";
ZmKeyMap.DBG_1="DebugLevel1";
ZmKeyMap.DBG_2="DebugLevel2";
ZmKeyMap.DBG_3="DebugLevel3";
ZmKeyMap.DBG_TIMING="ToggleDebugTiming";
ZmKeyMap.DEL="Delete";
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_NOTEBOOK="GoToNotebook";
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.LAST_UNREAD="LastUnread";
ZmKeyMap.LAST_UNREAD_MSG="LastUnreadMsg";
ZmKeyMap.LOGOFF="LogOff";
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.NEW="New";
ZmKeyMap.NEW_APPT="NewAppointment";
ZmKeyMap.NEW_BRIEFCASE="NewBriefcase";
ZmKeyMap.NEW_CALENDAR="NewCalendar";
ZmKeyMap.NEW_CHAT="NewChat";
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_NOTEBOOK="NewNotebook";
ZmKeyMap.NEW_PAGE="NewPage";
ZmKeyMap.NEW_PRESENTATION="NewPresentation";
ZmKeyMap.NEW_ROSTER_ITEM="NewRosterItem";
ZmKeyMap.NEW_SPREADSHEET="NewSpreadsheet";
ZmKeyMap.NEW_TAG="NewTag";
ZmKeyMap.NEW_TASK="NewTask";
ZmKeyMap.NEW_WINDOW="NewWindow";
ZmKeyMap.NEXT_CONV="NextConversation";
ZmKeyMap.NEXT_PAGE="NextPage";
ZmKeyMap.NEXT_UNREAD="NextUnread";
ZmKeyMap.NEXT_UNREAD_MSG="NextUnreadMsg";
ZmKeyMap.PASTE="Paste";
ZmKeyMap.PLAY="Play";
ZmKeyMap.PRESENCE_MENU="PresenceMenu";
ZmKeyMap.PREV_CONV="PreviousConversation";
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.UNDO="Undo";
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.ZmComposeController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmMailListController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmConvListController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmConvController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmMsgController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmContactListController=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmContactController=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmCalViewController=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmApptComposeController=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmMixedController=ZmSetting.MIXED_VIEW_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmPrefController=ZmSetting.OPTIONS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmNotebookPageController=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmBriefcaseController=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmTaskListController=ZmSetting.TASKS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmTaskController=ZmSetting.TASKS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmVoicemailListController=ZmSetting.VOICE_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmCallListController=ZmSetting.VOICE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global={};
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.FOCUS_SEARCH_BOX]=ZmSetting.SEARCH_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_BRIEFCASE]=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_CALENDAR]=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_CONTACTS]=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_MAIL]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_NOTEBOOK]=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_OPTIONS]=ZmSetting.OPTIONS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_TASKS]=ZmSetting.TASKS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_VOICE]=ZmSetting.VOICE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_APPT]=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_BRIEFCASEITEM]=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_CALENDAR]=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_CHAT]=ZmSetting.IM_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_CONTACT]=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_FILE]=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_DOC]=ZmSetting.DOCS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_FOLDER]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_MESSAGE]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_MESSAGE_WIN]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_NOTEBOOK]=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_PAGE]=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_ROSTER_ITEM]=ZmSetting.IM_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_TAG]=ZmSetting.TAGGING_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_TASK]=ZmSetting.TASKS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.PRESENCE_MENU]=ZmSetting.IM_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.SAVED_SEARCH]=ZmSetting.SAVED_SEARCHES_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.TAG]=ZmSetting.TAGGING_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.UNTAG]=ZmSetting.TAGGING_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController={};
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.ADDRESS_PICKER]=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.HTML_FORMAT]=ZmSetting.HTML_COMPOSE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.NEW_WINDOW]=ZmSetting.NEW_WINDOW_COMPOSE;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.SAVE]=ZmSetting.SAVE_DRAFT_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmApptComposeController={};
ZmKeyMap.ACTION_PRECONDITION.ZmApptComposeController[ZmKeyMap.HTML_FORMAT]=ZmSetting.HTML_COMPOSE_ENABLED
};
ZmKeyMap.prototype._checkMap=function(a){
var t;
var e=ZmKeyMap.MAP_PRECONDITION[a];
if(!e){
t=true
}else{
if(typeof e=="string"||typeof e=="number"){
t=appCtxt.get(e)
}else{
if(typeof e=="function"){
t=e()
}}}
this._checkedMap[a]=t;
return t
};
ZmKeyMap.prototype._checkAction=function(t,a){
if((this._checkedMap[t]===false)||(!this._checkedMap[t]&&!this._checkMap(t))){
return false
}
var e=ZmKeyMap.ACTION_PRECONDITION[t];
if(!e){
return true
}
var o=e[a];
if(!o){
return true
}
if(typeof o=="string"||typeof o=="number"){
return appCtxt.get(o)
}else{
if(typeof o=="function"){
return o()
}}
return true
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTimezone")){
ZmTimezone=function(){};
ZmTimezone.getDefault=function(){
var t=DwtShell.getShell(window);
var e=appCtxt.get(ZmSetting.DEFAULT_TIMEZONE);
return(e)?AjxTimezone.getClientId(e):AjxTimezone.DEFAULT
};
ZmTimezone.getDefaultRule=function(){
return AjxTimezone.getRule(ZmTimezone.getDefault())
};
ZmTimezone.set=function(n,t,e,o){
var a=AjxTimezone.getRule(t);
if(!a){
return
}
if(a.autoDetected||!o){
if(n instanceof AjxSoapDoc){
ZmTimezone._setSoap(n,t,e,a)
}else{
ZmTimezone._setJson(n,t,a)
}}};
ZmTimezone._setSoap=function(f,r,d,u){
var s=f.set("tz",null,d);
var t=AjxTimezone.getServerId(r);
s.setAttribute("id",t);
if(u.autoDetected){
s.setAttribute("stdoff",u.standard.offset);
if(u.daylight){
s.setAttribute("dayoff",u.daylight.offset);
var m=["standard","daylight"];
var e=["mon","mday","week","wkday","hour","min","sec"];
for(var l=0;
l<m.length;
l++){
var o=m[l];
var c=u[o];
var a=f.set(o,null,s);
for(var h=0;
h<e.length;
h++){
var n=e[h];
if(n in c){
a.setAttribute(n,c[n])
}}}}}};
ZmTimezone._setJson=function(h,s,d){
var t=AjxTimezone.getServerId(s);
var n=h.tz={
id:t};
if(d.autoDetected){
n.stdoff=d.standard.offset;
if(d.daylight){
n.dayoff=d.daylight.offset;
var u=["standard","daylight"];
var e=["mon","mday","week","wkday","hour","min","sec"];
for(var l=0;
l<u.length;
l++){
var a=u[l];
var c=d[a];
n[a]={};
for(var r=0;
r<e.length;
r++){
var o=e[r];
if(o in c){
n[a][o]=c[o]
}}}}}}
}
if(AjxPackage.define("zimbraMail.share.model.ZmItem")){
ZmItem=function(t,o,a,e){
if(arguments.length==0){
return
}
ZmModel.call(this,t);
this.type=t;
this.id=o;
this.list=a;
this.tags=[];
this.tagHash={};
this.folderId=0;
if(o&&!e){
appCtxt.cacheSet(o,this)
}};
ZmItem.prototype=new ZmModel;
ZmItem.prototype.constructor=ZmItem;
ZmItem.APP={};
ZmItem.MSG_KEY={};
ZmItem.COUNT_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_SUBJECT=ZmId.FLD_SUBJECT;
ZmItem.F_TAG=ZmId.FLD_TAG;
ZmItem.F_TAG_CELL=ZmId.FLD_TAG_CELL;
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.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_LOW_PRIORITY="?";
ZmItem.FLAG_HIGH_PRIORITY="!";
ZmItem.ALL_FLAGS=[ZmItem.FLAG_FLAGGED,ZmItem.FLAG_ATTACH,ZmItem.FLAG_UNREAD,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_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_LOW_PRIORITY]="isLowPriority";
ZmItem.FLAG_PROP[ZmItem.FLAG_HIGH_PRIORITY]="isHighPriority";
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(e,t){
if(t.app){
ZmItem.APP[e]=t.app
}
if(t.nameKey){
ZmItem.MSG_KEY[e]=t.nameKey
}
if(t.countKey){
ZmItem.COUNT_KEY[e]=t.countKey
}
if(t.icon){
ZmItem.ICON[e]=t.icon
}
if(t.soapCmd){
ZmItem.SOAP_CMD[e]=t.soapCmd
}
if(t.itemClass){
ZmList.ITEM_CLASS[e]=t.itemClass
}
if(t.node){
ZmList.NODE[e]=t.node
}
if(t.organizer){
ZmOrganizer.ITEM_ORGANIZER[e]=t.organizer
}
if(t.searchType){
ZmSearch.TYPE[e]=t.searchType
}
if(t.resultsList){
ZmItem.RESULTS_LIST[e]=t.resultsList
}
if(t.node){
ZmList.ITEM_TYPE[t.node]=e
}
if(t.dropTargets){
if(!ZmApp.DROP_TARGETS[t.app]){
ZmApp.DROP_TARGETS[t.app]={}
}
ZmApp.DROP_TARGETS[t.app][e]=t.dropTargets
}};
ZmItem.getItemId=function(t){
if(!t){
return t
}
if(!ZmItem.SHORT_ID_RE){
var e=DwtShell.getShell(window);
ZmItem.SHORT_ID_RE=new RegExp(appCtxt.get(ZmSetting.USERID)+":","gi")
}
return t.replace(ZmItem.SHORT_ID_RE,"")
};
ZmItem.prototype.create=function(e){};
ZmItem.prototype.modify=function(e){};
ZmItem.prototype.getById=function(e){
if(e==this.id){
return this
}};
ZmItem.prototype.getAccount=function(){
if(!this.account){
var o;
if(this.folderId){
var a=window.parentAppCtxt||window.appCtxt;
var t=a.getById(this.folderId);
o=t&&t.getAccount()
}
if(!o){
var e=ZmOrganizer.parseId(this.id);
o=e&&e.account
}
this.account=o
}
return this.account
};
ZmItem.prototype.clear=function(){
this._evtMgr.removeAll(ZmEvent.L_MODIFY);
if(this.tags.length){
for(var e=0;
e<this.tags.length;
e++){
this.tags[e]=null
}
this.tags=[]
}
for(var e in this.tagHash){
this.tagHash[e]=null
}
this.tagHash={}
};
ZmItem.prototype.cache=function(){
if(this.id){
appCtxt.cacheSet(this.id,this);
return true
}
return false
};
ZmItem.prototype.hasTag=function(e){
return(this.tagHash[e]==true)
};
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 a=ZmOrganizer.ITEM_ORGANIZER[this.type];
var e=appCtxt.getById(this.folderId);
var t=e?([e.getRestUrl(),"/",AjxStringUtil.urlComponentEncode(this.name)].join("")):null;
return t
};
ZmItem.prototype.getTagImageInfo=function(){
var t;
var o=appCtxt.getSearchController().searchAllAccounts;
if(!this.tags.length||(!o&&this.isShared())){
t="Blank_16"
}else{
if(this.tags.length==1){
var a=(!this.getAccount().isMain)?([this.getAccount().id,this.tags[0]].join(":")):(ZmOrganizer.getSystemId(this.tags[0]));
var e=appCtxt.getById(a);
t=e?e.getIconWithColor():"Blank_16"
}else{
t="TagStack"
}}
return t
};
ZmItem.prototype.getDefaultDndAction=function(e){
return(this.isReadOnly()||e)?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{
var t=appCtxt.getActiveAccount();
var e=String(this.id);
this._isShared=((e.indexOf(":")!=-1)&&(e.indexOf(t.id)!=0))
}}
return this._isShared
};
ZmItem.prototype.notifyDelete=function(){
this.deleteLocal();
if(this.list){
this.list.deleteLocal([this])
}
this._notify(ZmEvent.E_DELETE)
};
ZmItem.prototype.notifyModify=function(r,h){
if(r.t!=null){
this._parseTags(r.t);
this._notify(ZmEvent.E_TAGS)
}
if(r.f!=null){
var a=this._getFlags();
var s={};
for(var n=0;
n<a.length;
n++){
s[a[n]]=this[ZmItem.FLAG_PROP[a[n]]]
}
this._parseFlags(r.f);
var t=[];
for(var n=0;
n<a.length;
n++){
var e=this[ZmItem.FLAG_PROP[a[n]]];
if(s[a[n]]!=e){
t.push(a[n])
}}
if(t.length){
this._notify(ZmEvent.E_FLAGS,{
flags:t}
)
}}
if(r.l!=null&&r.l!=this.folderId){
var o={
oldFolderId:this.folderId};
this.moveLocal(r.l);
if(this.list){
this.list.moveLocal([this],r.l)
}
if(h){
delete r.l;
return ZmEvent.E_MOVE
}else{
this._notify(ZmEvent.E_MOVE,o)
}}};
ZmItem.prototype.flagLocal=function(t,e){
this[ZmItem.FLAG_PROP[t]]=e
};
ZmItem.prototype.setFlag=function(a,t){
this.flagLocal(a,t);
var e=this.flags||"";
if(t&&e.indexOf(a)==-1){
e=e+a
}else{
if(!t&&e.indexOf(a)!=-1){
e=e.replace(a,"")
}}
this.flags=e;
return e
};
ZmItem.prototype.tagLocal=function(a,o){
var t=false;
if(o){
if(!this.tagHash[a]){
t=true;
this.tags.push(a);
this.tagHash[a]=true
}}else{
for(var e=0;
e<this.tags.length;
e++){
if(this.tags[e]==a){
this.tags.splice(e,1);
delete this.tagHash[a];
t=true;
break
}}}
return t
};
ZmItem.prototype.removeAllTagsLocal=function(){
this.tags=[];
for(var e in this.tagHash){
delete this.tagHash[e]
}};
ZmItem.prototype.deleteLocal=function(){};
ZmItem.prototype.move=function(e,a,t){
return ZmItem.move(this.id,e,a,t)
};
ZmItem.move=function(s,e,r,t,a){
var o={
ItemActionRequest:{
_jsns:"urn:zimbraMail",action:{
id:s instanceof Array?s.join():s,op:"move",l:e}}};
var n={
jsonObj:o,asyncMode:Boolean(r),callback:r,errorCallback:t,accountName:a};
return appCtxt.getAppController().sendRequest(n)
};
ZmItem.prototype.moveLocal=function(e){
this.folderId=e
};
ZmItem.prototype._parseTags=function(o){
this.tags=[];
this.tagHash={};
if(o&&o.length){
var e=o.split(",");
for(var t=0;
t<e.length;
t++){
var a=Number(e[t]);
if(a>=ZmOrganizer.FIRST_USER_ID[ZmOrganizer.TAG]){
this.tagLocal(a,true)
}}}};
ZmItem.prototype._parseFlags=function(o){
this.flags=o;
for(var a=0;
a<ZmItem.ALL_FLAGS.length;
a++){
var t=ZmItem.ALL_FLAGS[a];
var e=(o&&(o.indexOf(t)!=-1))?true:false;
this.flagLocal(t,e)
}};
ZmItem.prototype._notify=function(t,e){
ZmModel.prototype._notify.call(this,t,e);
if(this.list){
if(e){
e.items=[this]
}else{
e={
items:[this]}
}
this.list._evt.item=this;
this.list._evt.items=[this];
this.list._notify(t,e)
}};
ZmItem.prototype._getFlags=function(){
return[ZmItem.FLAG_FLAGGED,ZmItem.FLAG_ATTACH]
};
ZmItem.prototype.rename=function(e,a,t){
return ZmItem.rename(this.id,e,a,t)
};
ZmItem.rename=function(s,e,r,t,a){
var o={
ItemActionRequest:{
_jsns:"urn:zimbraMail",action:{
id:s instanceof Array?s[0]:s,op:"rename",name:e}}};
var n={
jsonObj:o,asyncMode:Boolean(r),callback:r,errorCallback:t,accountName:a};
return appCtxt.getAppController().sendRequest(n)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmActionStack")){
ZmActionStack=function(e){
this._stack=[];
this._pointer=-1;
this._maxLength=e||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(o){
var r=o.op;
var l=[];
if(o.items){
for(var s=0;
s<o.items.length;
s++){
var u=o.items[s];
if(u&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,u.type)!=-1)){
l.push(u)
}}}else{
if(o.item){
if(o.item&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,o.item.type)!=-1)){
l.push(o.item)
}}else{
if(o.ids){
for(var s=0;
s<o.ids.length;
s++){
var u=appCtxt.getById(o.ids[s]);
if(u&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,u.type)!=-1)){
l.push(u)
}}}else{
if(o.id){
var u=appCtxt.getById(o.id);
if(u&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,u.type)!=-1)){
l.push(u)
}}}}}
for(var s=0;
s<l.length;
s++){
if(l[s] instanceof ZmConv){
var c=l[s].getMsgList();
for(var n=0;
n<c.length;
n++){
if(AjxUtil.indexOf(c[n])==-1){
l.push(c[n])
}}}}
var d=o.attrs;
var h=l.length>1;
var a=null;
var t;
switch(r){
case"trash":t=ZmFolder.ID_TRASH;
break;
case"spam":t=ZmFolder.ID_SPAM;
break;
case"move":case"!spam":t=d.l;
break
}
var e=appCtxt.getById(t);
if(e&&!e.isRemote()){
switch(r){
case"trash":case"move":case"spam":case"!spam":for(var s=0;
s<l.length;
s++){
var u=l[s];
var m;
if(u instanceof ZmItem){
if(!u.isShared()){
m=new ZmItemMoveAction(u,u.getFolderId(),t,r)
}}else{
if(u instanceof ZmOrganizer){
if(!u.isRemote()){
m=new ZmOrganizerMoveAction(u,u.parent.id,t,r)
}}}
if(m){
if(h){
if(!a){
a=new ZmCompositeAction()
}
a.addAction(m)
}else{
a=m
}}}
break
}
if(a){
this._push(a)
}}
return a
};
ZmActionStack.prototype.canUndo=function(){
return this._pointer>=0
};
ZmActionStack.prototype.canRedo=function(){
return this._pointer<this._stack.length-1
};
ZmActionStack.prototype.undo=function(){
if(this.canUndo()){
var e=this._pop();
e.undo()
}};
ZmActionStack.prototype.redo=function(){
if(this.canRedo()){
var e=this._stack[++this._pointer];
e.redo()
}};
ZmActionStack.prototype._push=function(t){
if(t&&t instanceof ZmAction){
var e=this._pointer+1;
while(this._maxLength&&e>=this._maxLength){
this._stack.shift();
e--
}
this._stack[e]=t;
this._stack.length=e+1;
this._pointer=e
}};
ZmActionStack.prototype._pop=function(){
return this.canUndo()?this._stack[this._pointer--]:null
}
}
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(){
this._complete=true;
this._notify(ZmEvent.E_COMPLETE)
};
ZmAction.prototype.getComplete=function(){
return this._complete
};
ZmItemAction=function(e,t){
if(!arguments.length){
return
}
ZmAction.call(this);
this._item=e;
this._op=t
};
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(e,t){
if(!arguments.length){
return
}
ZmAction.call(this);
this._organizer=e;
this._op=t
};
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(t,e,o,a){
ZmItemAction.call(this,t,a);
this._fromFolderId=e;
this._toFolderId=o
};
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(a,t,e){
this._item.list.moveItems({
items:[this._item],folder:appCtxt.getById(e),noUndo:true,finalCallback:new AjxCallback(this,this._handleDoMove,[this._item.folderId,e]),actionText:ZmItemMoveAction.UNDO_MSG[this._op],fromFolderId:this._toFolderId}
)
};
ZmItemMoveAction.prototype._handleDoMove=function(n,a,r){
var e=[];
for(var h in r.idHash){
var o=r.idHash[h];
if(o instanceof ZmConv){
o.folderId=a
}
var s=o&&o.list;
if(AjxUtil.indexOf(e,s)==-1){
e.push(s)
}}
for(var t=0;
t<e.length;
t++){
e[t]._notify(ZmEvent.E_MOVE,{
oldFolderId:n}
)
}
ZmList.killProgressDialog(r.actionSummary)
};
ZmItemMoveAction.prototype.undo=function(t,e){
this._doMove(t,e,this._fromFolderId)
};
ZmItemMoveAction.prototype.redo=function(t,e){
this._doMove(t,e,this._toFolderId)
};
ZmItemMoveAction.multipleUndo=function(n,l){
var u=n&&n.length&&n[0];
var e={};
for(var s=0;
s<n.length;
s++){
var o=n[s];
if(o instanceof ZmItemMoveAction){
var f=o.getFromFolderId();
var p=o.getToFolderId();
var g=o.getItem();
var d=(g&&g.list&&g.list.type)||0;
if(!e[f]){
e[f]={}
}
if(!e[f][p]){
e[f][p]={}
}
if(!e[f][p][d]){
e[f][p][d]=[]
}
e[f][p][d].push(o)
}}
for(var f in e){
for(var p in e[f]){
for(var d in e[f][p]){
var a=e[f][p][d];
var c=[];
var h=null;
var t=false;
var m;
for(var s=0;
s<a.length;
s++){
var o=a[s];
if(o==u){
t=true
}
var g=o.getItem();
c.push(g);
if(!h&&g.list){
h=g.list
}
var r=o.getOp&&o.getOp();
if(!m){
m=r
}else{
if(m!=r){
m="move"
}}}
if(h){
h.moveItems({
items:c,folder:appCtxt.getById(l?p:f),noUndo:true,actionText:t?(m&&ZmItemMoveAction.UNDO_MSG[m]):null}
)
}}}}};
ZmItemMoveAction.multipleRedo=function(e){
ZmItemMoveAction.multipleUndo(e,true)
};
ZmOrganizerMoveAction=function(e,t,o,a){
ZmOrganizerAction.call(this,e,a);
this._fromFolderId=t;
this._toFolderId=o
};
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(o,t,e){
var a=appCtxt.getById(e);
if(a){
this._organizer.move(a,true,ZmMsg.actionUndoMove)
}};
ZmOrganizerMoveAction.prototype.undo=function(t,e){
this._doMove(t,e,this._fromFolderId)
};
ZmOrganizerMoveAction.prototype.redo=function(t,e){
this._doMove(t,e,this._toFolderId)
};
ZmOrganizerMoveAction.multipleUndo=function(o,e){
for(var t=0;
t<o.length;
t++){
var a=o[t];
if(a instanceof ZmOrganizerMoveAction){
a._doMove(null,null,e?this._toFolderId:this._fromFolderId)
}}};
ZmOrganizerMoveAction.multipleRedo=function(e){
ZmItemMoveAction.multipleUndo(e,true)
};
ZmCompositeAction=function(){
ZmAction.call(this);
this._actions={}
};
ZmCompositeAction.prototype=new ZmAction;
ZmCompositeAction.prototype.constructor=ZmCompositeAction;
ZmCompositeAction.prototype.type=ZmAction.ACTION_ZMCOMPOSITEACTION;
ZmCompositeAction.prototype.toString=function(){
return"ZmCompositeAction"
};
ZmCompositeAction.prototype.addAction=function(t){
if(t&&t!=this&&t instanceof ZmAction){
var e=t.type;
if(!this._actions[e]){
this._actions[e]=[]
}
this._actions[e].push(t)
}};
ZmCompositeAction.prototype.getActions=function(e){
return this._actions[e]||[]
};
ZmCompositeAction.prototype.hasActions=function(e){
return this._actions[e]&&this._actions[e].length>0
};
ZmCompositeAction.prototype.undo=function(o,e){
if(this.hasActions(ZmAction.ACTION_ZMITEMMOVEACTION)){
ZmItemMoveAction.multipleUndo(this.getActions(ZmAction.ACTION_ZMITEMMOVEACTION))
}
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 a=this.getActions(ZmAction.ACTION_ZMCOMPOSITEACTION).concat(this.getActions(ZmAction.ACTION_ZMITEMACTION));
for(var t=0;
t<a.length;
t++){
a[t].undo()
}}};
ZmCompositeAction.prototype.redo=function(o,e){
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 a=this.getActions(ZmAction.ACTION_ZMCOMPOSITEACTION).concat(this.getActions(ZmAction.ACTION_ZMITEMACTION)).concat(this.getActions(ZmAction.ACTION_ZMORGANIZERACTION));
for(var t=0;
t<a.length;
t++){
a[t].redo()
}}}
}
if(AjxPackage.define("zimbraMail.share.model.ZmOrganizer")){
ZmOrganizer=function(e){
if(arguments.length==0){
return
}
this.type=e.type;
var t=this.id=e.id;
this.nId=ZmOrganizer.normalizeId(t);
this.name=ZmFolder.MSG_KEY[this.nId]?ZmMsg[ZmFolder.MSG_KEY[this.nId]]:e.name;
this._systemName=this.nId<256&&e.name;
this.parent=e.parent;
this.tree=e.tree;
this.numUnread=e.numUnread||0;
this.numTotal=e.numTotal||0;
this.sizeTotal=e.sizeTotal||0;
this.url=e.url;
this.owner=e.owner;
this.oname=e.oname;
this.link=e.link||(Boolean(e.zid))||(this.parent&&this.parent.link);
this.isMountpoint=e.link;
this.zid=e.zid;
this.rid=e.rid;
this.restUrl=e.restUrl;
this.account=e.account;
this.perm=e.perm;
this.noSuchFolder=false;
this._isAdmin=this._isReadOnly=this._hasPrivateAccess=null;
this.color=e.color||(this.parent&&this.parent.color)||ZmOrganizer.ORG_COLOR[t]||ZmOrganizer.ORG_COLOR[this.nId]||ZmOrganizer.DEFAULT_COLOR[this.type]||ZmOrganizer.C_NONE;
this.rgb=e.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(t&&e.tree){
appCtxt.cacheSet(t,this);
if(this.link){
appCtxt.cacheSet([this.zid,this.rid].join(":"),this)
}}
this.children=new AjxVector()
};
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.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_NOTEBOOK=12;
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_ROSTER_LIST=-11;
ZmOrganizer.ID_ROSTER_TREE_ITEM=-13;
ZmOrganizer.ID_ATTACHMENTS=-17;
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_ORANGE;
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 t=0;
t<=ZmOrganizer.MAX_COLOR;
t++){
var e=ZmOrganizer.COLOR_TEXT[t];
ZmOrganizer.COLORS.push(e);
ZmOrganizer.COLOR_CHOICES.push({
value:t,label:e}
)
}}
)();
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.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.registerOrg=function(a,e){
if(e.nameKey){
ZmOrganizer.MSG_KEY[a]=e.nameKey
}
if(e.app){
ZmOrganizer.APP[a]=e.app;
if(!ZmOrganizer.APP2ORGANIZER[e.app]){
ZmOrganizer.APP2ORGANIZER[e.app]=[]
}
ZmOrganizer.APP2ORGANIZER[e.app].push(a);
ZmOrganizer.APP2ORGANIZER_R[a]=e.app
}
if(e.defaultFolder){
ZmOrganizer.DEFAULT_FOLDER[a]=e.defaultFolder
}
if(e.precondition){
ZmOrganizer.PRECONDITION[a]=e.precondition
}
if(e.soapCmd){
ZmOrganizer.SOAP_CMD[a]=e.soapCmd
}
if(e.firstUserId){
ZmOrganizer.FIRST_USER_ID[a]=e.firstUserId
}
if(e.orgClass){
ZmOrganizer.ORG_CLASS[a]=e.orgClass
}
if(e.orgPackage){
ZmOrganizer.ORG_PACKAGE[a]=e.orgPackage
}
if(e.labelKey){
ZmOrganizer.LABEL[a]=e.labelKey
}
if(e.itemsKey){
ZmOrganizer.ITEMS_KEY[a]=e.itemsKey
}
if(e.hasColor){
ZmOrganizer.HAS_COLOR[a]=e.hasColor
}
if(e.views){
ZmOrganizer.VIEWS[a]=e.views
}
if(e.folderKey){
ZmOrganizer.FOLDER_KEY[a]=e.folderKey
}
if(e.mountKey){
ZmOrganizer.MOUNT_KEY[a]=e.mountKey
}
if(e.deferrable){
ZmOrganizer.DEFERRABLE[a]=e.deferrable
}
if(e.pathInName){
ZmOrganizer.PATH_IN_NAME[a]=e.pathInName
}
if(e.openSetting){
ZmOrganizer.OPEN_SETTING[a]=e.openSetting
}
if(e.newOp){
ZmOrganizer.NEW_OP[a]=e.newOp
}
if(e.displayOrder){
ZmOrganizer.DISPLAY_ORDER[a]=e.displayOrder
}
if(e.hideEmpty){
ZmOrganizer.HIDE_EMPTY[a]=e.hideEmpty
}
if(!appCtxt.isChildWindow||e.childWindow){
if(e.compareFunc){
ZmTreeView.COMPARE_FUNC[a]=e.compareFunc
}
if(e.treeController){
ZmOverviewController.CONTROLLER[a]=e.treeController
}}
ZmOrganizer.TREE_TYPE[a]=e.treeType||a;
ZmOrganizer.CREATE_FUNC[a]=e.createFunc||"ZmOrganizer.create";
if(e.views){
ZmOrganizer.VIEW_HASH[a]=AjxUtil.arrayAsHash(ZmOrganizer.VIEWS[a])
}
if(e.hasColor){
ZmOrganizer.DEFAULT_COLOR[a]=(e.defaultColor!=null)?e.defaultColor:ZmOrganizer.ORG_DEFAULT_COLOR
}
if(e.orgColor){
for(var t in e.orgColor){
ZmOrganizer.ORG_COLOR[t]=e.orgColor[t]
}}
if(e.dropTargets){
if(!ZmApp.DROP_TARGETS[e.app]){
ZmApp.DROP_TARGETS[e.app]={}
}
ZmApp.DROP_TARGETS[e.app][a]=e.dropTargets
}};
ZmOrganizer.sortCompare=function(t,e){};
ZmOrganizer.create=function(s){
var r={
CreateFolderRequest:{
_jsns:"urn:zimbraMail"}};
var o=r.CreateFolderRequest.folder={};
var e=s.errorCallback||new AjxCallback(null,ZmOrganizer._handleErrorCreate,s);
var a=s.type;
s.view=s.view||ZmOrganizer.VIEWS[a]?ZmOrganizer.VIEWS[a][0]:null;
for(var t in s){
if(t=="type"||t=="errorCallback"||t=="account"){
continue
}
var n=s[t];
if(t=="color"){
if(!n||(n==ZmOrganizer.DEFAULT_COLOR[a])){
n=null
}}
if(n){
o[t]=n
}}
return appCtxt.getAppController().sendRequest({
jsonObj:r,asyncMode:true,accountName:(s.account&&s.account.name),errorCallback:e}
)
};
ZmOrganizer._handleErrorCreate=function(o,e){
if(!o.url&&!o.name){
return false
}
var a;
if(o.name&&(e.code==ZmCsfeException.MAIL_ALREADY_EXISTS)){
a=AjxMessageFormat.format(ZmMsg.errorAlreadyExists,[o.name])
}else{
if(o.url){
var t=(e.code==ZmCsfeException.SVC_RESOURCE_UNREACHABLE)?ZmMsg.feedUnreachable:ZmMsg.feedInvalid;
a=AjxMessageFormat.format(t,o.url)
}}
if(a){
ZmOrganizer._showErrorMsg(a);
return true
}
return false
};
ZmOrganizer._showErrorMsg=function(t){
var e=appCtxt.getMsgDialog();
e.reset();
e.setMessage(AjxStringUtil.htmlEncode(t),DwtMessageDialog.CRITICAL_STYLE);
e.popup()
};
ZmOrganizer.getFolder=function(s,n,e){
var o={
GetFolderRequest:{
_jsns:"urn:zimbraMail"}};
var t=o.GetFolderRequest;
t.folder={
l:s};
var a=new AjxCallback(null,ZmOrganizer._handleResponseGetFolder,[n]);
if(e){
e.addRequestParams(o,a)
}else{
appCtxt.getRequestMgr().sendRequest({
jsonObj:o,asyncMode:true,callback:a}
)
}};
ZmOrganizer._handleResponseGetFolder=function(s,e){
var n=e.getResponse().GetFolderResponse;
var t=(n&&n.folder&&n.folder[0])||(n&&n.link&&n.link[0]);
var o;
if(t){
o=appCtxt.getById(t.id);
if(o){
o.clearShares();
o._setSharesFromJs(t)
}else{
var a=appCtxt.getById(t.l);
o=ZmFolderTree.createFromJs(a,t,appCtxt.getFolderTree(),"folder")
}}
if(s){
s.run(o)
}};
ZmOrganizer.prototype.getFolder=function(t,e){
ZmOrganizer.getFolder(this.id,t,e)
};
ZmOrganizer.getViewName=function(e){
return ZmOrganizer.VIEWS[e][0]
};
ZmOrganizer.checkName=function(e){
if(e.length==0){
return ZmMsg.nameEmpty
}
if(e.length>ZmOrganizer.MAX_NAME_LENGTH){
return AjxMessageFormat.format(ZmMsg.nameTooLong,ZmOrganizer.MAX_NAME_LENGTH)
}
if(!ZmOrganizer.VALID_NAME_RE.test(e)){
return AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(e))
}
return null
};
ZmOrganizer.checkUrl=function(e){
if(!e.match(/^[a-zA-Z]+://.*$/i)){
return ZmMsg.errorUrlMissing
}
return null
};
ZmOrganizer.checkSortArgs=function(e,t){
if(!e&&!t){
return 0
}
if(e&&!t){
return 1
}
if(!e&&t){
return -1
}
return null
};
ZmOrganizer.checkColor=function(e){
return((e!=null)&&(e>=0&&e<=ZmOrganizer.MAX_COLOR))?e:ZmOrganizer.ORG_DEFAULT_COLOR
};
ZmOrganizer.getSystemId=function(a,t,e){
t=t||appCtxt.getActiveAccount();
if((t&&!t.isMain)||e){
return((typeof(a)=="string")&&(a.indexOf(":")!=-1)||!a)?a:([t.id,a].join(":"))
}
return a
};
ZmOrganizer.normalizeId=function(o,a){
if(typeof(o)!="string"){
return o
}
var e=o.indexOf(":");
var t=(e==-1)?o:o.substr(e+1);
return(a&&(t>=ZmOrganizer.FIRST_USER_ID[a]))?o:t
};
ZmOrganizer.parseId=function(o,t){
var a=window.parentAppCtxt||window.appCtxt;
t=t||{};
if(o==null){
return t
}
var e=(typeof o=="string")?o.indexOf(":"):-1;
if(e==-1){
t.account=a.accountList.mainAccount;
t.id=o
}else{
t.account=a.accountList.getAccount(o.substring(0,e));
t.id=o.substr(e+1)
}
return t
};
ZmOrganizer.prototype.toString=function(){
return"ZmOrganizer"
};
ZmOrganizer.prototype.getName=function(s,t,n,e,o){
if(this.nId==ZmFolder.ID_ROOT){
return(ZmOrganizer.LABEL[this.type])?ZmMsg[ZmOrganizer.LABEL[this.type]]:""
}
var a=(e&&this._systemName)||(o&&this.oname)||this.name||"";
if(ZmOrganizer.PATH_IN_NAME[this.type]&&this.path){
a=[this.path,a].join("/")
}
a=(t&&a.length>t)?a.substring(0,t-3)+"...":a;
return this._markupName(a,s,n)
};
ZmOrganizer.prototype.getPath=function(a,h,t,r,e,n){
var o=this.parent;
var s=this.getName(h,t,r,e,n);
while(o&&((o.nId!=ZmOrganizer.ID_ROOT)||a)){
s=o.getName(h,t,r,e,n)+ZmFolder.SEP+s;
o=o.parent
}
return s
};
ZmOrganizer.prototype.getToolTip=function(a){
if(!this._tooltip||a){
var e=this._getItemsText();
var t={
itemText:e,numTotal:this.numTotal,sizeTotal:this.sizeTotal};
this._tooltip=AjxTemplate.expand("share.App#FolderTooltip",t)
}
return this._tooltip
};
ZmOrganizer.prototype.getSearchPath=function(e){
return(this.nId!=ZmOrganizer.ID_ROOT)?this.getPath(null,null,null,true,true,e):"/"
};
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(){
var e=appCtxt.get(ZmSetting.REST_URL);
if(e){
var t=AjxStringUtil.urlEncode(this.getSearchPath()).replace("#","%23");
return([e,"/",t].join(""))
}
if(this.restUrl){
return this.restUrl
}
url=this._generateRestUrl();
return url
};
ZmOrganizer.prototype.getOwnerRestUrl=function(){
var e=this.restUrl;
var t=AjxStringUtil.urlEncode(this.oname).replace("#","%23");
return([e,"/",t].join(""))
};
ZmOrganizer.prototype._generateRestUrl=function(){
var n=document.location;
var t=appCtxt.get(ZmSetting.USERNAME);
var a=n.host;
var e=t.match(/^(.*)@(.*)$/);
a=(e&&e[2])||a;
if(n.port&&n.port!=80){
a=a+":"+n.port
}
var o=AjxStringUtil.urlEncode(this.getSearchPath()).replace("#","%23");
return[n.protocol,"//",a,"/service/user/",t,"/",o].join("")
};
ZmOrganizer.prototype.getAccount=function(){
if(appCtxt.multiAccounts){
if(!this.account){
this.account=ZmOrganizer.parseId(this.id).account
}
if(!this.account){
var e=this.parent;
while(e&&!this.account){
this.account=e.getAccount();
e=e.parent
}}
return this.account
}
return(this.account||appCtxt.accountList.mainAccount)
};
ZmOrganizer.prototype.getShares=function(){
return this.shares
};
ZmOrganizer.prototype.addShare=function(a){
this.shares=this.shares||[];
this.shares.push(a);
var o=appCtxt.getActiveAccount();
var e=o&&o.id;
var t=a.grantee&&a.grantee.id;
if(t&&(t==e)){
this._mainShare=a
}};
ZmOrganizer.prototype.clearShares=function(){
if(this.shares&&this.shares.length){
for(var e=0;
e<this.shares.length;
e++){
this.shares[e]=null
}}
this.shares=null;
this._mainShare=null
};
ZmOrganizer.prototype.getMainShare=function(){
if(!this._mainShare){
var o=appCtxt.getActiveAccount();
var e=o&&o.id;
if(e&&this.shares&&this.shares.length){
for(var t=0;
t<this.shares.length;
t++){
var a=this.shares[t];
var n=a&&a.grantee&&a.grantee.id;
if(n&&n==e){
this._mainShare=a;
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.getIconWithColor=function(){
var t=this.getIcon()||"";
var e=this.rgb||ZmOrganizer.COLOR_VALUES[this.color];
return e?[t,e].join(",color="):t
};
ZmOrganizer.prototype.rename=function(a,n,t,e){
if(a==this.name){
return
}
var o={
action:"rename",attrs:{
name:a}
,callback:n,errorCallback:t,batchCmd:e};
this._organizerAction(o)
};
ZmOrganizer.prototype.setColor=function(t,a,e){
var t=ZmOrganizer.checkColor(t);
if(this.color==t){
return
}
this._organizerAction({
action:"color",attrs:{
color:t}
,callback:a,errorCallback:e}
)
};
ZmOrganizer.prototype.setRGB=function(t,a,e){
if(this.rgb==t){
return
}
this._organizerAction({
action:"color",attrs:{
rgb:t}
,callback:a,errorCallback:e}
)
};
ZmOrganizer.getStandardColorNumber=function(t){
if(String(t).match(/^#/)){
var e=ZmOrganizer.COLOR_VALUES.length;
for(var o=0;
o<e;
o++){
var a=ZmOrganizer.COLOR_VALUES[o];
if(a&&a==t){
return o
}}}else{
if(t<=9&&t>=0){
return t
}}
return -1
};
ZmOrganizer.prototype.update=function(e){
this._organizerAction({
action:"update",attrs:e}
)
};
ZmOrganizer.prototype.move=function(o,a,n,e){
var t=(o.nId>0)?o.id:ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT);
if((t==this.id||t==this.parent.id)||(this.type==ZmOrganizer.FOLDER&&(ZmOrganizer.normalizeId(t,this.type)==ZmFolder.ID_SPAM))||(o.isChildOf(this))){
return
}
var s={};
s.batchCmd=e;
if(t==ZmOrganizer.ID_TRASH){
s.action="trash";
s.noUndo=a
}else{
if(o.account&&o.account.isLocal()){
t=[ZmAccount.LOCAL_ACCOUNT_ID,t].join(":")
}
s.actionText=n||ZmMsg.actionMove;
s.actionArg=o.getName(false,false,true);
s.action="move";
s.attrs={
l:t};
s.noUndo=a
}
this._organizerAction(s)
};
ZmOrganizer.prototype._delete=function(t){
var e=((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()&&!e){
return
}
var a=e?"empty":"delete";
this._organizerAction({
action:a,batchCmd:t}
)
};
ZmOrganizer.prototype.empty=function(a,t){
a=a||false;
var e=((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()&&!e){
return
}
var o={
action:"empty",batchCmd:t};
o.attrs=(this.nId==ZmFolder.ID_TRASH)?{
recursive:true}
:{
recursive:a};
if(this.isRemote()){
o.id=this.getRemoteId()
}
this._organizerAction(o)
};
ZmOrganizer.prototype.markAllRead=function(e){
var t=this.isRemote()?this.getRemoteId():null;
this._organizerAction({
action:"read",id:t,attrs:{
l:this.id}
,batchCmd:e}
)
};
ZmOrganizer.prototype.sync=function(){
this._organizerAction({
action:"sync"}
)
};
ZmOrganizer.prototype.notifyDelete=function(){
var t=appCtxt.getOverviewController().getTreeController(this.type);
var o=t&&t.getTreeView(appCtxt.getCurrentApp().getOverviewId());
var n=o&&o.getSelected();
if(n){
if(!(n instanceof Array)){
n=[n]
}
for(var r in n){
var e=n[r];
if(e&&(e==this||e.isChildOf(this))){
var a=this.parent.id;
if(this.parent.nId==ZmOrganizer.ID_ROOT){
a=ZmOrganizer.getSystemId(ZmOrganizer.DEFAULT_FOLDER[this.type])
}
var s=false;
o.setSelected(a,s)
}}}
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=ZmOrganizer.checkColor(obj.color)||ZmOrganizer.DEFAULT_COLOR[this.type]||ZmOrganizer.ORG_DEFAULT_COLOR;
if(color!=this.color){
this.color=color;
fields[ZmOrganizer.F_COLOR]=true;
fields[ZmOrganizer.F_RGB]=true
}
var rgb=obj.rgb||ZmOrganizer.COLOR_VALUES[color];
if(rgb!=this.rgb){
this.rgb=rgb;
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);
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(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 e=this.children.getArray();
var o=this.children.size();
for(var t=0;
t<o;
t++){
var n=e[t];
if(n){
n.deleteLocal()
}}
this.children.removeAll()
};
ZmOrganizer.prototype.hasChild=function(e){
return(this.getChild(e)!=null)
};
ZmOrganizer.prototype.getChild=function(t){
t=t.toLowerCase();
var e=this.children.getArray();
var n=this.children.size();
for(var o=0;
o<n;
o++){
if(e[o]&&e[o].name&&(e[o].name.toLowerCase()==t)){
return e[o]
}}
return null
};
ZmOrganizer.prototype.getChildByPath=function(n){
var e=this;
if(n.match(/^//)){
while(e.nId!=ZmOrganizer.ID_ROOT){
e=e.parent
}
n=n.substr(1)
}
if(n.length==0){
return e
}
var o=n.split("/");
var a=0;
while(a<o.length){
var t=o[a++];
var s=e.getChild(t);
if(s==null){
return null
}
e=s
}
return e
};
ZmOrganizer.prototype.reparent=function(e){
if(this.parent){
this.parent.children.remove(this)
}
if(e){
e.children.add(this)
}
this.parent=e
};
ZmOrganizer.prototype.getById=function(r){
if(this.link&&r&&typeof(r)=="string"){
var n=r.split(":");
if(this.zid==n[0]&&this.rid==n[1]){
return this
}}
if(this.id==r||this.nId==r){
return this
}
var e;
var t=this.children.getArray();
var s=this.children.size();
for(var o=0;
o<s;
o++){
if(e=t[o].getById(r)){
return e
}}
return null
};
ZmOrganizer.prototype.getByName=function(t,e){
return this._getByName(t.toLowerCase(),e)
};
ZmOrganizer.prototype.getByType=function(e){
var t=[];
this._getByType(e,t);
return t
};
ZmOrganizer.prototype._getByType=function(o,n){
if(this.type==o){
n.push(this)
}
var e=this.children.getArray();
for(var t=0;
t<e.length;
t++){
if(e[t]){
e[t]._getByType(o,n)
}}};
ZmOrganizer.prototype.getByPath=function(t,e){
return this._getByPath(t.toLowerCase(),e)
};
ZmOrganizer.prototype._getByPath=function(s,o){
if(this.nId==ZmFolder.ID_TAGS){
return null
}
if(s==this.getPath(false,false,null,true,o).toLowerCase()){
return this
}
var t=this.children.getArray();
for(var n=0;
n<t.length;
n++){
var e=t[n]._getByPath(s,o);
if(e){
return e
}}
return null
};
ZmOrganizer.prototype.size=function(){
return this.children.size()
};
ZmOrganizer.prototype.isChildOf=function(e){
var t=this.parent;
while(t){
if(t==e){
return true
}
t=t.parent
}
return false
};
ZmOrganizer.prototype._getNewParent=function(e){
return appCtxt.getById(e)
};
ZmOrganizer.prototype.isUnder=function(t){
t=t.toString();
if(this.nId==t||(this.isRemote()&&this.rid==t)){
return true
}
var e=this.parent;
while(e&&e.nId!=ZmOrganizer.ID_ROOT){
if(e.nId==t){
return true
}
e=e.parent
}
return false
};
ZmOrganizer.prototype.isInTrash=function(){
return this.isUnder(ZmOrganizer.ID_TRASH)
};
ZmOrganizer.prototype.isPermAllowed=function(t){
if(this.perm){
var e=this.perm.replace(/-./g,"");
return(e.indexOf(t)!=-1)
}
return false
};
ZmOrganizer.prototype.isReadOnly=function(){
if(this._isReadOnly==null){
var e=this.getMainShare();
this._isReadOnly=(e!=null)?(this.isRemote()&&!e.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 e=this.getMainShare();
this._isAdmin=(e!=null)?(this.isRemote()&&e.isAdmin()):(this.isRemote()&&this.isPermAllowed(ZmOrganizer.PERM_ADMIN))
}
return this._isAdmin
};
ZmOrganizer.prototype.hasPrivateAccess=function(){
if(this._hasPrivateAccess==null){
var e=this.getMainShare();
this._hasPrivateAccess=(e!=null)?(this.isRemote()&&e.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 t=this.account;
var e=ZmOrganizer.parseId(this.id);
if(!t){
if(e.account&&e.account.isMain){
this._isRemote=false;
return this._isRemote
}else{
t=appCtxt.getActiveAccount()
}}
this._isRemote=Boolean(!e.account||(e.account&&(e.account!=t)))
}else{
var a=String(this.id);
this._isRemote=((a.indexOf(":")!=-1)&&(a.indexOf(appCtxt.getActiveAccount().id)!=0))
}}}
return this._isRemote
};
ZmOrganizer.prototype.isSystem=function(){
return(this.nId<ZmOrganizer.FIRST_USER_ID[this.type])
};
ZmOrganizer.prototype.isFeed=function(){
return Boolean(this.url)
};
ZmOrganizer.prototype.hasFeeds=function(){
return false
};
ZmOrganizer.prototype.isDataSource=function(t,a){
var e=this.getDataSources(t,a);
return(e&&e.length>0)
};
ZmOrganizer.prototype.getDataSources=function(t,a){
if(!appCtxt.get(ZmSetting.MAIL_ENABLED)){
return null
}
var e=appCtxt.getDataSourceCollection();
var o=e.getByFolderId(this.nId,t);
if(o.length==0){
return(a&&this.parent)?this.parent.getDataSources(t,a):null
}
return o
};
ZmOrganizer.prototype.getOwner=function(){
return this.owner||(this.parent&&this.parent.getOwner())||appCtxt.get(ZmSetting.USERNAME)
};
ZmOrganizer.getSortIndex=function(n,e){
if(!(n&&n.parent&&e)){
return null
}
var a=n.parent.children.getArray();
for(var t=0;
t<a.length;
t++){
var o=e(n,a[t]);
if(o==-1){
return t
}}
return t
};
ZmOrganizer.prototype._organizerAction=function(a){
var t=ZmOrganizer.SOAP_CMD[this.type];
var s=AjxSoapDoc.create(t+"Request","urn:zimbraMail");
var r=s.set("action");
r.setAttribute("op",a.action);
r.setAttribute("id",a.id||this.id);
for(var o in a.attrs){
if(AjxEnv.isIE){
a.attrs[o]+=""
}
r.setAttribute(o,a.attrs[o])
}
var h=appCtxt.getActionController();
h.dismiss();
var e=(!a.noUndo&&h&&h.actionPerformed({
op:a.action,id:a.id||this.id,attrs:a.attrs}
))||null;
var l=new AjxCallback(this,this._handleResponseOrganizerAction,[a,e]);
if(a.batchCmd){
a.batchCmd.addRequestParams(s,l,a.errorCallback)
}else{
var n;
if(appCtxt.multiAccounts){
n=(this.account)?this.account.name:appCtxt.accountList.mainAccount.name
}
appCtxt.getAppController().sendRequest({
soapDoc:s,asyncMode:true,accountName:n,callback:l,errorCallback:a.errorCallback}
)
}};
ZmOrganizer.prototype._handleResponseOrganizerAction=function(s,n,e){
if(n){
n.setComplete()
}
if(s.callback){
s.callback.run(e)
}
if(s.actionText){
var o=appCtxt.getActionController();
var a=ZmOrganizer.getActionSummary(s.actionText,s.numItems||1,this.type,s.actionArg);
a=AjxStringUtil.htmlEncode(a);
var t=n&&o&&o.getUndoLink(n);
if(t&&o){
o.onPopup();
appCtxt.setStatusMsg({
msg:a+t,transitions:o.getStatusTransitions()}
)
}else{
appCtxt.setStatusMsg(a)
}}};
ZmOrganizer.getActionSummary=function(s,a,n,e){
var o=ZmMsg[ZmOrganizer.MSG_KEY[n]];
var t=ZmMsg[ZmOrganizer.MSG_KEY[n]];
return AjxMessageFormat.format(s,[a,o,e,t])
};
ZmOrganizer.prototype._getByName=function(n,t){
if(this.name&&n==this.name.toLowerCase()){
return this
}
var e;
var o=this.children.getArray();
var r=this.children.size();
for(var s=0;
s<r;
s++){
if(e=o[s]._getByName(n,t)){
if(t&&e.isDataSource(ZmAccount.TYPE_IMAP,true)){
continue
}
return e
}}
return null
};
ZmOrganizer.prototype._parseFlags=function(a){
for(var t=0;
t<ZmOrganizer.ALL_FLAGS.length;
t++){
var e=ZmOrganizer.ALL_FLAGS[t];
this[ZmOrganizer.FLAG_PROP[e]]=(Boolean(a&&(a.indexOf(e)!=-1)))
}};
ZmOrganizer.prototype._setFlags=function(){
var t="";
for(var a=0;
a<ZmOrganizer.ALL_FLAGS.length;
a++){
var e=ZmOrganizer.ALL_FLAGS[a];
var o=ZmOrganizer.FLAG_PROP[e];
if(this[o]){
t=t+e
}}
return t
};
ZmOrganizer.prototype.addChangeListener=function(e){
this.tree.addChangeListener(e)
};
ZmOrganizer.prototype.removeChangeListener=function(e){
this.tree.removeChangeListener(e)
};
ZmOrganizer.prototype._setSharesFromJs=function(a){
if(a.acl&&a.acl.grant&&a.acl.grant.length>0){
AjxDispatcher.require("Share");
for(var t=0;
t<a.acl.grant.length;
t++){
var e=a.acl.grant[t];
this.addShare(ZmShare.createFromJs(this,e))
}}};
ZmOrganizer.prototype._notify=function(t,e){
appCtxt.setNotifyDebug("ZmOrganizer notify called. --- This should update the folder tree");
if(e){
e.organizers=[this]
}else{
e={
organizers:[this]}
}
this.tree._evt.type=this.type;
this.tree._notify(t,e)
};
ZmOrganizer.prototype._markupName=function(e,a,t){
if(!t){
e=AjxStringUtil.htmlEncode(e,true)
}
if(a&&this.numUnread>0){
e=AjxMessageFormat.format(ZmMsg.folderUnread,[e,this.numUnread]);
if(!t){
e=["<span style='font-weight:bold'>",e,"</span>"].join("")
}}
if(this.noSuchFolder&&!t){
e=["<del>",e,"</del>"].join("")
}
return e
};
ZmOrganizer.prototype._getItemsText=function(){
var e=ZmMsg[ZmOrganizer.ITEMS_KEY[this.type]];
if(!e||(this.nId==ZmFolder.ID_TRASH)){
e=ZmMsg.items
}
return e
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmFolder")){
ZmFolder=function(e){
if(arguments.length==0){
return
}
e.type=e.type||ZmOrganizer.FOLDER;
ZmOrganizer.call(this,e)
};
ZmFolder.prototype=new ZmOrganizer;
ZmFolder.prototype.constructor=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.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_NOTEBOOK]="notebook";
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[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_NOTEBOOK]="notebook";
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={};
for(var id in ZmFolder.QUERY_NAME){
ZmFolder.QUERY_ID[ZmFolder.QUERY_NAME[id]]=id
}
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_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 e in ZmFolder.QUERY_NAME){
ZmFolder.QUERY_ID[ZmFolder.QUERY_NAME[e]]=e
}}
)();
ZmFolder.sortCompare=function(a,t){
var e=ZmOrganizer.checkSortArgs(a,t);
if(e!=null){
return e
}
if(appCtxt.isOffline){
if(a.isDataSource(ZmAccount.TYPE_POP)){
if(a.id==ZmFolder.ID_INBOX){
return -1
}
if(t.isDataSource(ZmAccount.TYPE_POP)){
if(a.name.toLowerCase()>t.name.toLowerCase()){
return 1
}
if(a.name.toLowerCase()<t.name.toLowerCase()){
return -1
}
return 0
}
return -1
}else{
if(t.isDataSource(ZmAccount.TYPE_POP)){
return 1
}}}
if(ZmFolder.SORT_ORDER[a.nId]&&ZmFolder.SORT_ORDER[t.nId]){
return(ZmFolder.SORT_ORDER[a.nId]-ZmFolder.SORT_ORDER[t.nId])
}
if(!ZmFolder.SORT_ORDER[a.nId]&&ZmFolder.SORT_ORDER[t.nId]){
return 1
}
if(ZmFolder.SORT_ORDER[a.nId]&&!ZmFolder.SORT_ORDER[t.nId]){
return -1
}
if(a.name.toLowerCase()>t.name.toLowerCase()){
return 1
}
if(a.name.toLowerCase()<t.name.toLowerCase()){
return -1
}
return 0
};
ZmFolder.sortComparePath=function(n,o){
var a=n&&n.getPath(false,false,null,true,true);
var t=o&&o.getPath(false,false,null,true,true);
var e=ZmOrganizer.checkSortArgs(a,t);
if(e!=null){
return e
}
if(ZmFolder.SORT_ORDER[n.nId]&&ZmFolder.SORT_ORDER[o.nId]){
return(ZmFolder.SORT_ORDER[n.nId]-ZmFolder.SORT_ORDER[o.nId])
}
if(!ZmFolder.SORT_ORDER[n.nId]&&ZmFolder.SORT_ORDER[o.nId]){
return 1
}
if(ZmFolder.SORT_ORDER[n.nId]&&!ZmFolder.SORT_ORDER[o.nId]){
return -1
}
if(a.toLowerCase()>t.toLowerCase()){
return 1
}
if(a.toLowerCase()<t.toLowerCase()){
return -1
}
return 0
};
ZmFolder.checkName=function(a,o){
var t=ZmOrganizer.checkName(a);
if(t){
return t
}
o=o||appCtxt.getFolderTree().root;
if(o&&(o.id==ZmFolder.ID_ROOT)){
var e=a.toLowerCase();
for(var s in ZmFolder.MSG_KEY){
var n=ZmMsg[ZmFolder.MSG_KEY[s]];
if(n&&(e==n.toLowerCase())){
return ZmMsg.folderNameReserved
}}
if(e==ZmFolder.SYNC_ISSUES.toLowerCase()){
return ZmMsg.folderNameReserved
}}
return null
};
ZmFolder.getIdForName=function(a){
var e=a.toLowerCase();
for(var t in ZmFolder.MSG_KEY){
if(ZmFolder.MSG_KEY[t]==e){
return t
}}
return null
};
ZmFolder.prototype.toString=function(){
return"ZmFolder"
};
ZmFolder.prototype.move=function(n,o,s,e){
var a=this.name;
var t=this.name;
while(n.hasChild(t)){
t=t+"_"
}
if(a!=t){
this.rename(t)
}
ZmOrganizer.prototype.move.call(this,n,o,s,e)
};
ZmFolder.prototype.toggleSyncOffline=function(s,e){
if(!this.isOfflineSyncable){
return
}
var n=this.isOfflineSyncing?"!syncon":"syncon";
var a=AjxSoapDoc.create("FolderActionRequest","urn:zimbraMail");
var t=a.set("action");
t.setAttribute("op",n);
t.setAttribute("id",this.id);
var o={
soapDoc:a,asyncMode:true,callback:s,errorCallback:e};
appCtxt.getAppController().sendRequest(o)
};
ZmFolder.prototype.hasFeeds=function(){
if(this.type!=ZmOrganizer.FOLDER){
return false
}
var e=this.children.getArray();
var o=this.children.size();
for(var t=0;
t<o;
t++){
if(e[t].isFeed()){
return true
}
if(e[t].children&&e[t].children.size()>0){
return(e[t].hasFeeds&&e[t].hasFeeds())
}}
return false
};
ZmFolder.prototype.hasSearch=function(n){
if(this.type==ZmOrganizer.SEARCH){
return true
}
var e=this.children.getArray();
var o=this.children.size();
for(var t=0;
t<o;
t++){
if(e[t].hasSearch()){
return true
}}
return false
};
ZmFolder.prototype.supportsPublicAccess=function(){
return false
};
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(t){
if(!this.isRemote()&&this.isSystem()){
var o=ZmFolder.QUERY_NAME[this.nId];
return t?o:('in:"'+(o||this.name)+'"')
}
var n=this.isSystem()?ZmFolder.QUERY_NAME[this.nId]:this.name;
var a=this.parent;
while(a&&(a.nId!=ZmFolder.ID_ROOT)&&a.name.length){
var e=a.isSystem()?ZmFolder.QUERY_NAME[a.nId]:a.name;
n=e+"/"+n;
a=a.parent
}
n='"'+n+'"';
return t?n:("in:"+n)
};
ZmFolder.prototype.getName=function(n,t,o,e){
if(this.nId==ZmFolder.ID_DRAFTS||this.nId==ZmFolder.ID_OUTBOX||this.rid==ZmFolder.ID_DRAFTS){
var a=(e&&this._systemName)?this._systemName:this.name;
if(n&&this.numTotal>0){
a=AjxMessageFormat.format(ZmMsg.folderUnread,[a,this.numTotal]);
if(!o){
a=["<span style='font-weight:bold'>",a,"</span>"].join("")
}}
return a
}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"
}
if(this.parent&&this.parent.isDataSource(ZmAccount.TYPE_IMAP)){
var e=ZmFolder.getIdForName(this.name);
if(e){
return ZmFolder.ICON[e]||"Folder"
}}
return"Folder"
};
ZmFolder.prototype.mayContainFolderFromAccount=function(e){
var t=this.getAccount();
if(t==e){
return true
}
return t.isLocal()
};
ZmFolder.prototype.mayContain=function(h,c,d){
if(!h){
return true
}
if(this.isFeed()||this.isSyncIssuesFolder()){
return false
}
var l=c||this.type;
var o=false;
if(h instanceof ZmFolder){
o=((h.parent==this&&!d)||this.isChildOf(h)||this.nId==ZmFolder.ID_DRAFTS||this.nId==ZmFolder.ID_SPAM||(!this.isInTrash()&&this.hasChild(h.name)&&!d)||(h.type==ZmOrganizer.FOLDER&&l==ZmOrganizer.SEARCH)||(h.type==ZmOrganizer.SEARCH&&l==ZmOrganizer.FOLDER&&this.nId==ZmOrganizer.ID_ROOT)||(h.id==this.id)||(h.disallowSubFolder)||(appCtxt.multiAccounts&&!this.mayContainFolderFromAccount(h.getAccount()))||(this.isRemote()&&!this._remoteMoveOk(h))||(h.isRemote()&&!this._remoteMoveOk(h)))
}else{
var n=AjxUtil.toArray(h);
var u=n[0];
if(this.nId==ZmOrganizer.ID_ROOT||this.nId==ZmOrganizer.ID_OUTBOX||this.nId==ZmOrganizer.ID_SYNC_FAILURES){
o=true
}else{
if(l==ZmOrganizer.SEARCH){
o=true
}else{
if(u&&(u.type==ZmItem.CONTACT)&&u.isGal){
o=true
}else{
if(u&&(u.type==ZmItem.CONV)&&u.list&&u.list.search&&(u.list.search.folderId==this.id)){
o=true
}else{
for(var t=0;
t<n.length;
t++){
var r=n[t];
if(!r){
o=true;
break
}
if(r==ZmItem.CONTACT){
if(this.nId!=ZmFolder.ID_TRASH){
o=true;
break
}}else{
if(Dwt.instanceOf(r,"ZmBriefcaseFolderItem")){
if(r.folder&&r.folder.isRemote()&&!r.folder.rid){
o=true;
break
}}else{
if(r.isDraft&&(this.nId!=ZmFolder.ID_TRASH&&this.nId!=ZmFolder.ID_DRAFTS&&this.rid!=ZmFolder.ID_DRAFTS)){
o=true;
break
}else{
if((this.nId==ZmFolder.ID_DRAFTS||this.rid==ZmFolder.ID_DRAFTS)&&!r.isDraft){
o=true;
break
}}}}}
if(appCtxt.isOffline&&!o){
var s=this.getAccount();
if(s&&u.getAccount()!=s&&(s.type==ZmAccount.TYPE_MSE||s.type==ZmAccount.TYPE_EXCHANGE)){
o=true
}else{
var a=appCtxt.getCurrentSearch();
var e=a&&appCtxt.getById(a.folderId);
if(e&&e.nId==ZmOrganizer.ID_SYNC_FAILURES){
o=true
}}}
if(appCtxt.multiAccounts&&this.isRemote()&&h.getAccount&&this.getAccount().id!=h.getAccount().id){
o=true
}
if(!o&&!d){
if(u.folderId){
o=true;
for(var t=0;
t<n.length;
t++){
if(n[t].folderId!=this.id){
o=false;
break
}}}}}}}}
if(!o&&this.link){
o=this.isReadOnly()
}}
return !o
};
ZmFolder.prototype.isSyncIssuesFolder=function(){
return(this.name==ZmFolder.SYNC_ISSUES)
};
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(t){
if(!this.isRemote()&&t.isMountpoint&&t.rid){
return true
}
if(!this.link||!t.link||this.zid!=t.zid){
return false
}
if(this.id.split(":")[0]!=t.id.split(":")[0]){
return false
}
var e=this.shares&&this.shares[0];
if(!(e&&e.isInsert())){
return false
}
e=t.shares&&t.shares[0];
return(e&&e.isDelete())
};
ZmFolder.prototype.isOutbound=function(){
for(var e=0;
e<ZmFolder.OUTBOUND.length;
e++){
if(this.isUnder(ZmFolder.OUTBOUND[e])){
return true
}}
return false
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSearchFolder")){
ZmSearchFolder=function(t){
t.type=ZmOrganizer.SEARCH;
ZmFolder.call(this,t);
if(t.query){
var e={
query:t.query,types:t.types,sortBy:t.sortBy,searchId:t.id,accountName:(t.account&&t.account.name)};
this.search=new ZmSearch(e)
}};
ZmSearchFolder.ID_ROOT=ZmOrganizer.ID_ROOT;
ZmSearchFolder.create=function(h){
var r=AjxSoapDoc.create("CreateSearchFolderRequest","urn:zimbraMail");
var s=r.set("search");
s.setAttribute("name",h.name);
s.setAttribute("query",h.search.query);
if(h.search.types){
var t=h.search.types.getArray();
if(t.length){
var e=[];
for(var n=0;
n<t.length;
n++){
e.push(ZmSearch.TYPE[t[n]])
}
s.setAttribute("types",e.join(","))
}}
if(h.search.sortBy){
s.setAttribute("sortBy",h.search.sortBy)
}
var o;
if(h.isGlobal){
s.setAttribute("f","g");
o=appCtxt.accountList.mainAccount.name
}
s.setAttribute("l",h.parent.id);
appCtxt.getAppController().sendRequest({
soapDoc:r,asyncMode:true,accountName:o,errorCallback:(new AjxCallback(null,ZmOrganizer._handleErrorCreate,h))}
)
};
ZmSearchFolder.prototype=new ZmFolder;
ZmSearchFolder.prototype.constructor=ZmSearchFolder;
ZmSearchFolder.prototype.toString=function(){
return"ZmSearchFolder"
};
ZmSearchFolder.prototype.getIcon=function(){
return(this.nId==ZmOrganizer.ID_ROOT)?null:(this.isOfflineGlobalSearch?"GlobalSearchFolder":"SearchFolder")
};
ZmSearchFolder.prototype.getToolTip=function(){};
ZmSearchFolder.prototype._getNewParent=function(t){
var e=appCtxt.getById(t);
if(e){
return e
}
return appCtxt.getById(t)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSearch")){
ZmSearch=function(t){
if(t){
for(var e in t){
this[e]=t[e]
}
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){
this._parseQuery()
}
if(this.querySortOrder){
this.sortBy=this.querySortOrder
}}}
this.isGalSearch=false;
this.isCalResSearch=false;
if(ZmSearch._mailEnabled==null){
ZmSearch._mailEnabled=appCtxt.get(ZmSetting.MAIL_ENABLED);
if(ZmSearch._mailEnabled){
AjxDispatcher.require("MailCore")
}}
if(!(this.types instanceof AjxVector)){
this.types=AjxUtil.toArray(this.types);
if(!appCtxt.get(ZmSetting.MAIL_ENABLED)){
this.types=AjxUtil.arrayAsHash(this.types);
delete this.types[ZmSearch.TYPE[ZmItem.MSG]];
delete this.types[ZmSearch.TYPE[ZmItem.CONV]];
this.types=AjxUtil.keys(this.types)
}
this.types=AjxVector.fromArray(this.types)
}
if(this.types.size()==0){
this.types=AjxVector.fromArray(AjxUtil.keys(ZmSearch.TYPE))
}};
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.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.UNREAD_QUERY_RE=new RegExp("\bis:\s*(un)?read\b","i");
ZmSearch.IS_ANYWHERE_QUERY_RE=new RegExp("\bis:\s*anywhere\b","i");
ZmSearch.prototype.toString=function(){
return"ZmSearch"
};
ZmSearch.prototype.execute=function(e){
if(e.batchCmd||this.soapInfo){
this._executeSoap(e)
}else{
this._executeJson(e)
}};
ZmSearch.prototype._executeSoap=function(n){
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.query&&!this.isCalResSearch){
return
}
var m;
if(!this.response){
if(this.isGalSearch){
m=AjxSoapDoc.create("SearchGalRequest","urn:zimbraAccount");
var e=m.getMethod();
if(this.galType){
e.setAttribute("type",this.galType)
}
if(this.expandDL){
e.setAttribute("needExp",1)
}
m.set("name",this.query);
var h=m.set("searchFilter");
if(this.conds&&this.conds.length){
var r=m.set("conds",null,h);
this._applySoapCond(this.conds,m,r)
}}else{
if(this.isAutocompleteSearch){
m=AjxSoapDoc.create("AutoCompleteRequest","urn:zimbraMail");
var e=m.getMethod();
if(this.limit){
e.setAttribute("limit",this.limit)
}
if(this.expandDL){
e.setAttribute("needExp",1)
}
m.set("name",this.query)
}else{
if(this.isGalAutocompleteSearch){
m=AjxSoapDoc.create("AutoCompleteGalRequest","urn:zimbraAccount");
var e=m.getMethod();
e.setAttribute("limit",this._getLimit());
if(this.galType){
e.setAttribute("type",this.galType)
}
if(this.expandDL){
e.setAttribute("needExp",1)
}
m.set("name",this.query)
}else{
if(this.isCalResSearch){
m=AjxSoapDoc.create("SearchCalendarResourcesRequest","urn:zimbraAccount");
var e=m.getMethod();
if(this.attrs){
var f=[].concat(this.attrs);
AjxUtil.arrayRemove(f,"fullName");
e.setAttribute("attrs",f.join(","))
}
var h=m.set("searchFilter");
if(this.conds&&this.conds.length){
var r=m.set("conds",null,h);
this._applySoapCond(this.conds,m,r)
}}else{
if(this.soapInfo){
m=AjxSoapDoc.create(this.soapInfo.method,this.soapInfo.namespace);
for(var u in this.soapInfo.additional){
var o=m.set(u);
var f=this.soapInfo.additional;
for(var l in f){
o.setAttribute(l,f[l])
}}}else{
m=AjxSoapDoc.create("SearchRequest","urn:zimbraMail")
}
var e=this._getStandardMethod(m);
if(this.types){
var d=this.types.getArray();
if(d.length){
var c=[];
for(var s=0;
s<d.length;
s++){
c.push(ZmSearch.TYPE[d[s]])
}
e.setAttribute("types",c.join(","));
var t=appCtxt.getById(this.folderId);
if(t&&(t.isUnder(ZmFolder.ID_SENT)||t.isUnder(ZmFolder.ID_DRAFTS)||t.isUnder(ZmFolder.ID_OUTBOX))){
e.setAttribute("recip","1")
}
if(this.fetch){
e.setAttribute("fetch",(this.fetch=="all")?"all":"1");
if(this.getHtml){
e.setAttribute("html","1")
}}
if(this.markRead){
e.setAttribute("read","1")
}}}
if(this.inDumpster){
e.setAttribute("inDumpster","1")
}}}}}}
var p=new AjxCallback(this,this._handleResponseExecute,[n.callback]);
if(n.batchCmd){
n.batchCmd.addRequestParams(m,p)
}else{
return appCtxt.getAppController().sendRequest({
soapDoc:m,asyncMode:true,callback:p,errorCallback:n.errorCallback,timeout:n.timeout,noBusyOverlay:n.noBusyOverlay,response:this.response}
)
}};
ZmSearch.prototype._executeJson=function(o){
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.query&&!this.queryHint&&!this.isCalResSearch){
return
}
var g,n,d;
if(!this.response){
if(this.isGalSearch){
g={
SearchGalRequest:{
_jsns:"urn:zimbraAccount"}};
n=g.SearchGalRequest;
if(this.galType){
n.type=this.galType
}
if(this.expandDL){
n.needExp=1
}
n.name=this.query;
n.offset=this.offset=(this.offset||0);
n.limit=this._getLimit();
n.locale={
_content:AjxEnv.DEFAULT_LOCALE};
if(this.lastId){
n.cursor={
id:this.lastId,sortVal:(this.lastSortVal||"")}
}
if(this.sortBy){
n.sortBy=this.sortBy
}
if(this.conds&&this.conds.length){
n.searchFilter={
conds:{}};
n.searchFilter.conds=ZmSearch.prototype._applyJsonCond(this.conds,n)
}}else{
if(this.isAutocompleteSearch){
g={
AutoCompleteRequest:{
_jsns:"urn:zimbraMail"}};
n=g.AutoCompleteRequest;
if(this.limit){
n.limit=this.limit
}
if(this.expandDL){
n.needExp=1
}
n.name={
_content:this.query}
}else{
if(this.isGalAutocompleteSearch){
g={
AutoCompleteGalRequest:{
_jsns:"urn:zimbraAccount"}};
n=g.AutoCompleteGalRequest;
n.limit=this._getLimit();
n.name=this.query;
if(this.galType){
n.type=this.galType
}
if(this.expandDL){
n.needExp=1
}}else{
if(this.isCalResSearch){
g={
SearchCalendarResourcesRequest:{
_jsns:"urn:zimbraAccount"}};
n=g.SearchCalendarResourcesRequest;
if(this.attrs){
var f=[].concat(this.attrs);
n.attrs=f.join(",")
}
n.offset=this.offset=(this.offset||0);
n.limit=this._getLimit();
if(this.conds&&this.conds.length){
n.searchFilter={
conds:{}};
n.searchFilter.conds=ZmSearch.prototype._applyJsonCond(this.conds,n)
}}else{
if(this.soapInfo){
d=AjxSoapDoc.create(this.soapInfo.method,this.soapInfo.namespace);
for(var c in this.soapInfo.additional){
var t=d.set(c);
var f=this.soapInfo.additional[c];
for(var r in f){
t.setAttribute(r,f[r])
}}}else{
g={
SearchRequest:{
_jsns:"urn:zimbraMail"}};
n=g.SearchRequest
}
this._getStandardMethodJson(n);
if(this.types){
var l=this.types.getArray();
if(l.length){
var h=[];
for(var s=0;
s<l.length;
s++){
h.push(ZmSearch.TYPE[l[s]])
}
n.types=h.join(",");
var e=appCtxt.getById(this.folderId);
if(e&&(e.isUnder(ZmFolder.ID_SENT)||e.isUnder(ZmFolder.ID_DRAFTS)||e.isUnder(ZmFolder.ID_OUTBOX))){
n.recip=1
}
if(this.fetch){
n.fetch=(this.fetch=="all")?"all":1;
if(this.getHtml){
n.html=1
}}
if(this.markRead){
n.read=1
}
if(this.headers){
for(var m in this.headers){
if(!n.header){
n.header=[]
}
n.header.push({
n:m}
)
}}
if(l.length==1&&l[0]==ZmItem.TASK&&this.allowableTaskStatus){
n.allowableTaskStatus=this.allowableTaskStatus
}}}
if(this.inDumpster){
n.inDumpster=1
}}}}}}
var p=new AjxCallback(this,this._handleResponseExecute,[o.callback]);
if(o.batchCmd){
o.batchCmd.addRequestParams(d,p)
}else{
var u={
jsonObj:g,soapDoc:d,asyncMode:true,callback:p,errorCallback:o.errorCallback,timeout:o.timeout,noBusyOverlay:o.noBusyOverlay,response:this.response,accountName:this.accountName};
return appCtxt.getAppController().sendRequest(u)
}};
ZmSearch.prototype._applySoapCond=function(l,h,s,o){
if(o||this.join==ZmSearch.JOIN_OR){
s.setAttribute("or",1)
}
for(var n=0;
n<l.length;
n++){
var r=l[n];
if(AjxUtil.isArray(r)){
var a=h.set("conds",null,s);
this._applySoapCond(r,h,a,true)
}else{
if(r.attr=="fullName"&&r.op=="has"){
var t=h.set("name",r.value)
}else{
var e=h.set("cond",null,s);
e.setAttribute("attr",r.attr);
e.setAttribute("op",r.op);
e.setAttribute("value",r.value)
}}}};
ZmSearch.prototype._applyJsonCond=function(e,a,o){
var s={};
if(o||this.join==ZmSearch.JOIN_OR){
s.or=1
}
for(var t=0;
t<e.length;
t++){
var n=e[t];
if(AjxUtil.isArray(n)){
if(!s.conds){
s.conds=[]
}
s.conds.push(this._applyJsonCond(n,a,true))
}else{
if(n.attr=="fullName"&&n.op=="has"){
a.name={
_content:n.value}
}else{
if(!s.cond){
s.cond=[]
}
s.cond.push({
attr:n.attr,op:n.op,value:n.value}
)
}}}
return s
};
ZmSearch.prototype._handleResponseExecute=function(o,t){
var a=t.getResponse();
if(this.isGalSearch){
a=a.SearchGalResponse
}else{
if(this.isCalResSearch){
a=a.SearchCalendarResourcesResponse
}else{
if(this.isAutocompleteSearch){
a=a.AutoCompleteResponse
}else{
if(this.isGalAutocompleteSearch){
a=a.AutoCompleteGalResponse
}else{
if(this.soapInfo){
a=a[this.soapInfo.response]
}else{
a=a.SearchResponse
}}}}}
var e=new ZmSearchResult(this);
e.set(a);
t.set(e);
if(o){
o.run(t)
}};
ZmSearch.prototype.getConv=function(a){
if((!this.query&&!this.queryHint)||!a.cid){
return
}
var n={
SearchConvRequest:{
_jsns:"urn:zimbraMail"}};
var e=n.SearchConvRequest;
this._getStandardMethodJson(e);
e.cid=a.cid;
if(a.fetchId){
e.fetch=a.fetchId;
if(a.markRead){
e.read=1
}
if(this.getHtml){
e.html=1
}
if(a.needExp!==false){
e.needExp=1
}
if(ZmMailMsg.requestHeaders){
for(var o in ZmMailMsg.requestHeaders){
if(!e.header){
e.header=[]
}
e.header.push({
n:o}
)
}}}
if(!a.noTruncate){
e.max=appCtxt.get(ZmSetting.MAX_MESSAGE_SIZE)
}
var t={
jsonObj:n,asyncMode:true,callback:(new AjxCallback(this,this._handleResponseGetConv,a.callback)),accountName:this.accountName};
appCtxt.getAppController().sendRequest(t)
};
ZmSearch.prototype._handleResponseGetConv=function(o,t){
var a=t.getResponse().SearchConvResponse;
var e=new ZmSearchResult(this);
e.set(a,null,true);
t.set(e);
if(o){
o.run(t)
}};
ZmSearch.prototype.getTitle=function(){
var t;
if(this.folderId){
var o=ZmOrganizer.getSystemId(this.folderId);
var a=appCtxt.getById(o);
if(a){
t=a.getName(true,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH,true)
}}else{
if(this.tagId){
var e=appCtxt.getById(this.tagId);
t=e&&e.getName(true,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH,true)
}}
return t?([ZmMsg.zimbraTitle,t].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(t){
var s=t.getMethod();
if(this.sortBy){
s.setAttribute("sortBy",this.sortBy)
}
if(ZmSearch._mailEnabled){
var e;
for(var n in ZmMailMsg.requestHeaders){
e=t.set("header",null,null);
e.setAttribute("n",n)
}}
ZmTimezone.set(t,AjxTimezone.DEFAULT,null);
t.set("locale",appCtxt.get(ZmSetting.LOCALE_NAME),null);
if(this.lastId!=null&&this.lastSortVal){
var o=t.set("cursor");
o.setAttribute("id",this.lastId);
o.setAttribute("sortVal",this.lastSortVal);
if(this.endSortVal){
o.setAttribute("endSortVal",this.endSortVal)
}}
this.offset=this.offset||0;
s.setAttribute("offset",this.offset);
s.setAttribute("limit",this._getLimit());
var a=(this.queryHint)?([this.query," (",this.queryHint,")"].join("")):this.query;
t.set("query",a);
if(this.field){
s.setAttribute("field",this.field)
}
return s
};
ZmSearch.prototype._getStandardMethodJson=function(t){
if(this.sortBy){
t.sortBy=this.sortBy
}
if(ZmSearch._mailEnabled){
var e=ZmMailMsg.requestHeaders;
if(e&&e.length){
t.header=[];
for(var a in e){
t.header.push({
n:a}
)
}}}
ZmTimezone.set(t,AjxTimezone.DEFAULT);
t.locale={
_content:AjxEnv.DEFAULT_LOCALE};
if(this.lastId!=null&&this.lastSortVal){
t.cursor={
id:this.lastId,sortVal:this.lastSortVal};
if(this.endSortVal){
t.cursor.endSortVal=this.endSortVal
}}
t.offset=this.offset=this.offset||0;
t.limit=this._getLimit();
if(this.idsOnly){
t.resultMode="IDS"
}
t.query=(this.queryHint)?([this.query," (",this.queryHint,")"].join("")):this.query;
if(this.field){
t.field=this.field
}};
ZmSearch.prototype._getLimit=function(){
if(this.limit){
return this.limit
}
var e;
if(this.isGalAutocompleteSearch){
e=appCtxt.get(ZmSetting.AUTOCOMPLETE_LIMIT)
}else{
var t=this.types&&this.types.get(0);
var a=appCtxt.getApp(ZmItem.APP[t])||appCtxt.getCurrentApp();
if(a&&a.getLimit){
e=a.getLimit(this.offset)
}else{
e=appCtxt.get(ZmSetting.PAGE_SIZE)||ZmSearch.DEFAULT_LIMIT
}}
this.limit=e;
return e
};
ZmSearch.IS_OP={
"in":true,inid:true,is:true,tag:true,sort:true};
ZmSearch.COND={
and:" && ",or:" || ",not:" !"};
ZmSearch.EOW={
" ":true,":":true,"(":true,")":true};
ZmSearch.FLAG={};
ZmSearch.FLAG.unread="item.isUnread";
ZmSearch.FLAG.read="!item.isUnread";
ZmSearch.FLAG.flagged="item.isFlagged";
ZmSearch.FLAG.unflagged="!item.isFlagged";
ZmSearch.FLAG.forwarded="item.isForwarded";
ZmSearch.FLAG.unforwarded="!item.isForwarded";
ZmSearch.FLAG.sent="item.isSent";
ZmSearch.FLAG.replied="item.isReplied";
ZmSearch.FLAG.unreplied="!item.isReplied";
ZmSearch.prototype._parseQuery=function(){
var r=this.query||this.queryHint;
this.hasUnreadTerm=ZmSearch.UNREAD_QUERY_RE.test(r);
this.isAnywhere=ZmSearch.IS_ANYWHERE_QUERY_RE.test(r);
function u(t,O){
while(O<t.length&&t.charAt(O)==" "){
O++
}
return O
}
function h(B,C){
var W=B.charAt(C);
C++;
var t=false,A,O="";
while(C<B.length&&!t){
A=B.charAt(C);
if(A==W){
t=true
}else{
O+=A;
C++
}}
return t?{
str:O,pos:C+1}
:null
}
var q=r.length;
var y=[],p,m,j="",c=false,o=false,w=true,d=false,e=false;
var l=u(r,0);
while(l<q){
p=r.charAt(l);
o=ZmSearch.EOW[p];
if(p==":"){
if(ZmSearch.IS_OP[j]){
m=j
}else{
c=true
}
j="";
l=u(r,l+1);
continue
}
if(o){
if(m&&j){
y.push({
isTerm:true,op:m,arg:j}
);
m=j="";
w=true
}else{
if(!m){
if(ZmSearch.COND[j.toLowerCase()]){
var f=j.toLowerCase();
y.push(ZmSearch.COND[f]);
w=false;
if(f=="or"){
d=true
}}else{
if(j){
c=e=true
}}
j=""
}}}
if(p=="'"||p=='"'){
var v=h(r,l);
if(v){
j=v.str;
l=v.pos
}else{
c=true;
j="";
l=u(r,l+1)
}}else{
if(p=="("||p==")"){
y.push(p);
l=u(r,l+1)
}else{
if(p=="-"&&!j){
y.push("not");
l=u(r,l+1);
w=false
}else{
if(p!=" "){
j+=p
}
l++
}}}}
if(!c&&(l==r.length)&&m&&j){
y.push({
isTerm:true,op:m,arg:j}
);
w=true
}else{
if(!m&&j){
c=e=true
}}
c=c||!w;
var a,k;
var s=["return Boolean("];
for(var x=0,q=y.length;
x<q;
x++){
var g=y[x];
if(g.isTerm){
if(g.op=="in"||g.op=="inid"){
a=(g.op=="in")?this._getFolderId(g.arg):g.arg;
if(a){
s.push("((item.type == ZmItem.CONV) ? item.folders && item.folders['"+a+"'] : item.folderId == '"+a+"')")
}}else{
if(g.op=="tag"){
k=this._getTagId(g.arg,true);
if(k){
s.push("item.hasTag('"+k+"')")
}}else{
if(g.op=="is"){
var T=ZmSearch.FLAG[g.arg];
if(T){
s.push(T)
}}else{
if(g.op=="sort"){
this.querySortOrder=g.arg
}}}}
var b=y[x+1];
if(b&&(b.isTerm||b==ZmSearch.COND.not||b=="(")){
s.push(ZmSearch.COND.and)
}}else{
s.push(g)
}}
s.push(")");
if(!c){
try{
this.matches=new Function("item",s.join(""))
}
catch(z){}}
this.singleTerm=(a||k)&&(y.length==1)&&!c;
this.hasTextTerm=e;
var n=(appCtxt.multiAccounts&&this.isMultiAccount()&&!this.query&&this.queryHint);
if(!d||n){
this.folderId=a;
this.tagId=k
}};
ZmSearch.prototype._getFolderId=function(r){
var e=ZmFolder.QUERY_ID[r];
var t=this.accountName;
if(!t){
var s=appCtxt.getActiveAccount();
t=s?s.name:appCtxt.accountList.mainAccount
}
if(!e){
var n=t&&appCtxt.accountList.getAccountByName(t);
var a=appCtxt.getFolderTree(n);
var o=a?a.getByPath(r,true):null;
if(o){
e=o.id
}}
if(t){
e=ZmOrganizer.getSystemId(e,appCtxt.accountList.getAccountByName(t))
}
return e
};
ZmSearch.prototype._getTagId=function(a,o){
var t=appCtxt.getTagTree();
if(t){
var e=t.getByName(a.toLowerCase());
if(e){
return o?e.nId:e.id
}}};
ZmSearch.prototype.hasFolderTerm=function(t){
if(!t){
return false
}
var e=new RegExp('\s*in:\s*"?('+AjxStringUtil.regExEscape(t)+')"?\s*',"i");
var a=new RegExp('(-|not)\s*in:\s*"?('+AjxStringUtil.regExEscape(t)+')"?\s*',"i");
return(e.test(this.query)&&!a.test(this.query))
};
ZmSearch.prototype.replaceFolderTerm=function(a,e){
if(!(a&&e)){
return
}
var t=new RegExp('(\s*in:\s*"?)('+AjxStringUtil.regExEscape(a)+')("?\s*)',"gi");
this.query=this.query.replace(t,"$1"+e+"$3")
};
ZmSearch.prototype.hasTagTerm=function(e){
if(!e){
return false
}
var t=new RegExp('\s*tag:\s*"?('+AjxStringUtil.regExEscape(e)+')"?\s*',"i");
var a=new RegExp('(-|not)\s*tag:\s*"?('+AjxStringUtil.regExEscape(e)+')"?\s*',"i");
return(t.test(this.query)&&!a.test(this.query))
};
ZmSearch.prototype.replaceTagTerm=function(t,e){
if(!(t&&e)){
return
}
var a=new RegExp('(\s*tag:\s*"?)('+AjxStringUtil.regExEscape(t)+')("?\s*)',"gi");
this.query=this.query.replace(a,"$1"+e+"$3")
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSearchResult")){
ZmSearchResult=function(e){
if(!e){
return
}
this._results={};
this.search=e
};
ZmSearchResult.prototype.toString=function(){
return"ZmSearchResult"
};
ZmSearchResult.prototype.dtor=function(){
for(var e in this._results){
if(this._results[e].clear){
this._results[e].clear();
this._results[e]=null
}}
this._results=null
};
ZmSearchResult.prototype.getResults=function(n){
n=n||this.type;
if(!this._results){
return ZmItem.RESULTS_LIST[n](this.search)
}
if(n==ZmItem.MIXED){
var s=new ZmMailList(ZmItem.MIXED,this.search);
for(var n in this._results){
var o=this._results[n];
if(o&&o.size()){
var e=o.getArray();
for(var t=0;
t<e.length;
t++){
s.add(e[t])
}}}
return s
}else{
if(this.search.idsOnly){
return this._results
}else{
return this._results[n]?this._results[n]:n&&ZmItem.RESULTS_LIST[n](this.search)
}}};
ZmSearchResult.prototype.getAttribute=function(e){
return this._respEl?this._respEl[e]:null
};
ZmSearchResult.prototype.set=function(m){
if(!this.search){
return
}
this._respEl=m;
if(this.search.isAutocompleteSearch){
return
}
var d={};
var r=0;
var f,n;
var a=this.search.isGalSearch;
var o=new Date();
var s=0;
if(a||this.search.isCalResSearch){
f=n=a?ZmItem.CONTACT:ZmItem.RESOURCE;
var w=a?m.cn:m.calresource;
if(w){
if(!this._results[f]){
this._results[f]=ZmItem.RESULTS_LIST[f](this.search)
}
for(var p=0;
p<w.length;
p++){
this._results[f].addFromDom(w[p])
}
s=w.length
}}else{
if(this.search.idsOnly){
this._results=m.hit||[];
return
}else{
var l=this.search.types.getArray();
n=l[0];
if(!n){
var h=AjxUtil.values(ZmList.NODE);
for(var g=0;
g<h.length;
g++){
var c=h[g];
if(m[c]){
n=ZmList.ITEM_TYPE[c];
if(l&&l.length==0){
l=[n]
}
break
}}}
if(!n){
var b=appCtxt.getCurrentAppName();
var l=ZmApp.SEARCH_TYPES;
n=l&&l.length&&l[0]
}
for(var g=0;
g<l.length;
g++){
var e=l[g];
var w=m[ZmList.NODE[e]];
if(!w&&(e==ZmItem.MSG)){
w=m.chat
}
if(w&&w.length){
s+=w.length;
if(!this._results[e]){
this._results[e]=ZmItem.RESULTS_LIST[e](this.search)
}
for(var p=0;
p<w.length;
p++){
var y=w[p];
y._type=e;
this._results[e].addFromDom(y)
}
if(!d[e]){
d[e]=true;
r++;
f=e
}}}}}
if(!s&&n){
this._results[n]=ZmItem.RESULTS_LIST[n](this.search)
}
if((a||this.search.isGalAutocompleteSearch)&&this._results[ZmItem.CONTACT]){
this._results[ZmItem.CONTACT].setIsGal(true)
}
if(this.search.isGalAutocompleteSearch){
this.isTokenized=(this._respEl.tokenizeKey!=null)
}
var u=new Date();
f=f||n;
if(r<=1){
this.type=f
}else{
if(r==2&&(d[ZmItem.PAGE]||d[ZmItem.DOCUMENT])){
this.type=ZmItem.PAGE
}else{
this.type=appCtxt.get(ZmSetting.MIXED_VIEW_ENABLED)?ZmItem.MIXED:f
}}
return this.type
};
ZmSearchResult._sortGalResults=function(t,e){
var o=t.getFileAs&&t.getFileAs().toLowerCase();
var n=e.getFileAs&&e.getFileAs().toLowerCase();
return o<n?-1:(o>n?1:0)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTag")){
ZmTag=function(e){
e.type=ZmOrganizer.TAG;
ZmOrganizer.call(this,e)
};
ZmTag.prototype=new ZmOrganizer;
ZmTag.prototype.constructor=ZmTag;
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(r,a,h,s,n){
var l;
var e=ZmOrganizer.normalizeId(a.id);
if(e<ZmOrganizer.FIRST_USER_ID[ZmOrganizer.TAG]){
return
}
l=h.getById(a.id);
if(l){
return l
}
var t={
id:a.id,name:a.name,color:ZmTag.checkColor(a.color),rgb:a.rgb,parent:r,tree:h,numUnread:a.u,account:n};
l=new ZmTag(t);
var o=s?ZmOrganizer.getSortIndex(l,ZmTag.sortCompare):null;
r.children.add(l,o);
return l
};
ZmTag.sortCompare=function(a,t){
var e=ZmOrganizer.checkSortArgs(a,t);
if(e!=null){
return e
}
if(a.name.toLowerCase()>t.name.toLowerCase()){
return 1
}
if(a.name.toLowerCase()<t.name.toLowerCase()){
return -1
}
return 0
};
ZmTag.checkName=function(e){
var t=ZmOrganizer.checkName(e);
if(t){
return t
}
if(e.indexOf("\")==0){
return AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(e))
}
return null
};
ZmTag.checkColor=function(e){
e=Number(e);
return((e!=null)&&(e>=0&&e<=ZmOrganizer.MAX_COLOR))?e:ZmOrganizer.DEFAULT_COLOR[ZmOrganizer.TAG]
};
ZmTag.getIcon=function(e){
var t={
getIcon:ZmTag.prototype.getIcon,color:e};
if(String(e).match(/^#/)){
t.rgb=e;
t.color=null
}
return ZmTag.prototype.getIconWithColor.call(t)
};
ZmTag.create=function(n){
var a=AjxSoapDoc.create("CreateTagRequest","urn:zimbraMail");
var o=a.set("tag");
o.setAttribute("name",n.name);
if(n.rgb){
o.setAttribute("rgb",n.rgb)
}else{
var t=ZmOrganizer.checkColor(n.color)||ZmOrganizer.DEFAULT_COLOR[ZmOrganizer.TAG];
o.setAttribute("color",t)
}
var e=new AjxCallback(null,ZmTag._handleErrorCreate,n);
appCtxt.getAppController().sendRequest({
soapDoc:a,asyncMode:true,errorCallback:e,accountName:n.accountName}
)
};
ZmTag._handleErrorCreate=function(o,t){
if(t.code==ZmCsfeException.MAIL_INVALID_NAME){
var a=AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(o.name));
var e=appCtxt.getMsgDialog();
e.setMessage(a,DwtMessageDialog.CRITICAL_STYLE);
e.popup();
return true
}
return false
};
ZmTag.prototype.getIcon=function(){
return(this.id==ZmOrganizer.ID_ROOT)?null:"Tag"
};
ZmTag.prototype.createQuery=function(){
return['tag:"',this.name,'"'].join("")
};
ZmTag.prototype.getToolTip=function(){};
ZmTag.prototype.notifyCreate=function(e){
var t=ZmTag.createFromJs(this,e,this.tree,true);
t._notify(ZmEvent.E_CREATE)
};
ZmTag.prototype.supportsSharing=function(){
return false
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTree")){
ZmTree=function(e){
if(arguments.length==0){
return
}
ZmModel.call(this,e);
this.type=e;
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(e){
return this.root?this.root.getById(e):null
};
ZmTree.prototype.getByName=function(e){
return this.root?this.root.getByName(e):null
};
ZmTree.prototype.getByType=function(e){
return this.root?this.root.getByType(e):null
};
ZmTree.prototype.size=function(){
return this.root?this.root.size():0
};
ZmTree.prototype.reset=function(){
this.root=null
};
ZmTree.prototype.asList=function(e){
var t=[];
return this.root?this._addToList(this.root,t,e):t
};
ZmTree.prototype.getUnreadHash=function(e){
if(!e){
e={}
}
return this.root?this._getUnreadHash(this.root,e):e
};
ZmTree.prototype._addToList=function(e,r,t){
var s=t&&t.includeRemote;
var h=t&&t.remoteOnly;
var n=e.isRemote();
if((!n&&!h)||(n&&(h||s))){
r.push(e)
}
var o=e.children.getArray();
for(var a=0;
a<o.length;
a++){
this._addToList(o[a],r,t)
}
return r
};
ZmTree.prototype._asString=function(e,o){
if(e.id){
o=o+e.id
}
var a=e.children.clone().getArray();
if(a.length){
a.sort(function(s,n){
return s.id-n.id
}
);
o=o+"[";
for(var t=0;
t<a.length;
t++){
if(a[t].id==ZmFolder.ID_TAGS){
continue
}
if(t>0){
o=o+","
}
o=this._asString(a[t],o)
}
o=o+"]"
}
return o
};
ZmTree.prototype._getUnreadHash=function(e,t){
t[e.id]=e.numUnread;
var o=e.children.getArray();
for(var a=0;
a<o.length;
a++){
this._getUnreadHash(o[a],t)
}
return t
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTagTree")){
ZmTagTree=function(e){
ZmTree.call(this,ZmOrganizer.TAG);
var t=(e)?([e.id,ZmTag.ID_ROOT].join(":")):ZmTag.ID_ROOT;
this.root=new ZmTag({
id:t,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(a,o,n){
if(!a||!a.tag||!a.tag.length){
return
}
for(var t=0;
t<a.tag.length;
t++){
ZmTag.createFromJs(this.root,a.tag[t],this,null,n)
}
var e=this.root.children.getArray();
if(e.length){
e.sort(ZmTag.sortCompare)
}};
ZmTagTree.prototype.getByIndex=function(e){
var t=this.asList();
if(t&&t.length&&(e<t.length)){
return t[e]
}};
ZmTagTree.prototype.reset=function(){
this.root=new ZmTag({
id:ZmTag.ID_ROOT,tree:this}
)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmFolderTree")){
ZmFolderTree=function(e){
ZmTree.call(this,e)
};
ZmFolderTree.prototype=new ZmTree;
ZmFolderTree.prototype.constructor=ZmFolderTree;
ZmFolderTree.IS_PARSED={};
ZmFolderTree.prototype.toString=function(){
return"ZmFolderTree"
};
ZmFolderTree.prototype.loadFromJs=function(a,e,t){
this.root=(e=="zimlet")?ZmZimlet.createFromJs(null,a,this):ZmFolderTree.createFromJs(null,a,this,e,null,t)
};
ZmFolderTree.createFromJs=function(f,r,b,d,y,h){
if(!(r&&r.id)){
return
}
var a;
if(d=="search"){
var l;
if(r.types){
var p=r.types.split(",");
l=[];
var c=appCtxt.get(ZmSetting.MAIL_ENABLED);
for(var s=0;
s<p.length;
s++){
var m=ZmSearch.TYPE_MAP[p[s]];
if(!m||(!c&&(m==ZmItem.CONV||m==ZmItem.MSG))){
continue
}
l.push(m)
}
if(l.length==0){
return null
}}
var n={
id:r.id,name:r.name,parent:f,tree:b,numUnread:r.u,query:r.query,types:l,sortBy:r.sortBy,account:h};
a=new ZmSearchFolder(n);
ZmFolderTree._fillInFolder(a,r,y);
ZmFolderTree._traverse(a,r,b,(y||[]),d,h)
}else{
var m=r.view?(ZmOrganizer.TYPE[r.view]):(f?f.type:ZmOrganizer.FOLDER);
if(!m){
return
}
var g=(r.acl&&r.acl.grant&&r.acl.grant.length>0);
if(appCtxt.inStartup&&ZmOrganizer.DEFERRABLE[m]&&!appCtxt.isOffline){
var o=appCtxt.getApp(ZmOrganizer.APP[m]);
var e={
type:m,parent:f,obj:r,tree:b,path:y,elementType:d,account:h};
o.addDeferredFolder(e)
}else{
var u=ZmOrganizer.ORG_PACKAGE[m];
if(u){
AjxDispatcher.require(u)
}
a=ZmFolderTree.createFolder(m,f,r,b,y,d,h);
ZmFolderTree._traverse(a,r,b,(y||[]),d,h)
}}
return a
};
ZmFolderTree.createAllDeferredFolders=function(){
var e=appCtxt.getAppController();
for(var t in ZmApp.ORGANIZER){
var a=e.getApp(t);
a.createDeferred()
}};
ZmFolderTree._traverse=function(e,n,m,u,l,h){
var a=(e.nId==ZmOrganizer.ID_ROOT);
if(n.folder&&n.folder.length){
if(!a){
u.push(n.name)
}
for(var s=0;
s<n.folder.length;
s++){
var r=n.folder[s];
var o=ZmFolderTree.createFromJs(e,r,m,(l||"folder"),u,h);
if(e&&o){
e.children.add(o)
}}
if(!a){
u.pop()
}}
if(n.search&&n.search.length){
if(!a){
u.push(n.name)
}
for(var s=0;
s<n.search.length;
s++){
var d=n.search[s];
var t=ZmFolderTree.createFromJs(e,d,m,"search",u,h);
if(t){
e.children.add(t)
}}
if(!a){
u.pop()
}}
if(n.link&&n.link.length){
for(var s=0;
s<n.link.length;
s++){
var c=n.link[s];
var o=ZmFolderTree.createFromJs(e,c,m,"link",u,h);
if(o){
e.children.add(o)
}}}};
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",account:account};
var folder=new orgClass(params);
ZmFolderTree._fillInFolder(folder,obj,path);
ZmFolderTree.IS_PARSED[type]=true;
return folder
};
ZmFolderTree._fillInFolder=function(e,a,t){
if(t&&t.length){
e.path=t.join("/")
}
if(a.f&&e._parseFlags){
e._parseFlags(a.f)
}
e._setSharesFromJs(a)
};
ZmFolderTree.prototype.getByType=function(e){
return this.root?this.root.getByType(e):null
};
ZmFolderTree.prototype.getByPath=function(t,e){
return this.root?this.root.getByPath(t,e):null
};
ZmFolderTree.prototype.handleNoSuchFolderError=function(e,r,l){
var h=this.getByType(e);
var a;
var s=false;
if(h){
for(var n=0;
n<h.length;
n++){
if((h[n].zid==r)&&(h[n].rid==l)){
h[n].noSuchFolder=true;
if(!a){
var o=appCtxt.getAppController().getOverviewId();
a=appCtxt.getOverviewController().getTreeView(o,e)
}
var t=a.getTreeItemById(h[n].id);
t.setText(h[n].getName(true));
this.handleDeleteNoSuchFolder(h[n]);
s=true
}}}
return s
};
ZmFolderTree.prototype.handleDeleteNoSuchFolder=function(e){
var t=appCtxt.getYesNoMsgDialog();
t.reset();
t.registerCallback(DwtDialog.YES_BUTTON,this._deleteOrganizerYesCallback,this,[e,t]);
t.registerCallback(DwtDialog.NO_BUTTON,appCtxt.getAppController()._clearDialog,this,t);
var a=AjxMessageFormat.format(ZmMsg.confirmDeleteMissingFolder,AjxStringUtil.htmlEncode(e.getName(false,0,true)));
t.setMessage(a,DwtMessageDialog.WARNING_STYLE);
t.popup()
};
ZmFolderTree.prototype._deleteOrganizerYesCallback=function(e,t){
e._delete();
appCtxt.getAppController()._clearDialog(t)
};
ZmFolderTree.prototype.getPermissions=function(r){
var n=r.folderIds||this._getItemsWithoutPerms(r.type);
if(n.length>0){
var o=AjxSoapDoc.create("BatchRequest","urn:zimbra");
o.setMethodAttribute("onerror","continue");
var s=o.getDoc();
for(var a=0;
a<n.length;
a++){
var t=o.set("GetFolderRequest",null,null,"urn:zimbraMail");
var e=s.createElement("folder");
e.setAttribute("l",n[a]);
t.appendChild(e)
}
var h=new AjxCallback(this,this._handleResponseGetShares,[r.callback,r.skipNotify]);
appCtxt.getRequestMgr().sendRequest({
soapDoc:o,asyncMode:true,callback:h,noBusyOverlay:r.noBusyOverlay,accountName:r.accountName}
)
}else{
if(r.callback){
r.callback.run()
}}};
ZmFolderTree.prototype._getItemsWithoutPerms=function(n){
var s=[];
var o=n?[n]:[ZmOrganizer.FOLDER,ZmOrganizer.CALENDAR,ZmOrganizer.TASKS,ZmOrganizer.NOTEBOOK,ZmOrganizer.BRIEFCASE,ZmOrganizer.ADDRBOOK];
for(var t=0;
t<o.length;
t++){
var r=o[t];
if(!ZmFolderTree.IS_PARSED[r]){
continue
}
var e=this.getByType(r);
for(var a=0;
a<e.length;
a++){
if(e[a].link&&e[a].shares==null){
s.push(e[a].id)
}}}
return s
};
ZmFolderTree.prototype._handleResponseGetShares=function(h,o,c){
var l=c.getResponse().BatchResponse;
this._handleErrorGetShares(l);
var e=l.GetFolderResponse;
if(e){
for(var a=0;
a<e.length;
a++){
var n=e[a].link?e[a].link[0]:null;
if(n){
var s=appCtxt.getById(n.id);
if(s){
s.perm=n.perm;
if(n.n){
s.numTotal=n.n
}
if(n.u){
s.numUnread=n.u
}
s._setSharesFromJs(n)
}
if(n.folder&&n.folder.length>0){
var r=appCtxt.getById(n.id);
if(r){
for(var t=0;
t<n.folder.length;
t++){
if(appCtxt.getById(n.folder[t].id)){
continue
}
r.notifyCreate(n.folder[t],"link",o)
}}}}}}
if(h){
h.run()
}};
ZmFolderTree.prototype._handleErrorGetShares=function(l){
var n=l.Fault;
if(n){
var a=[];
var t=[];
for(var o=0,e=n.length;
o<e;
o++){
var r=ZmCsfeCommand.faultToEx(n[o]);
if(r.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER){
var h=r.data.itemId[0];
var s=h.lastIndexOf(":");
t.push(h.substring(0,s));
a.push(h.substring(s+1,h.length))
}}
if(t.length){
this._markNoSuchFolder(t,a)
}}};
ZmFolderTree.prototype._markNoSuchFolder=function(t,n){
var s=appCtxt.getFolderTree();
var e=s&&s.root?s.root.children.getArray():null;
for(var o=0;
o<e.length;
o++){
for(var a=0;
a<n.length;
a++){
if((e[o].zid==t[a])&&(e[o].rid==n[a])){
e[o].noSuchFolder=true
}}}};
ZmFolderTree.prototype._sortFolder=function(a){
var t=a.children;
if(t&&t.length){
t.sort(ZmFolder.sortCompare);
for(var e=0;
e<t.length;
e++){
this._sortFolder(t[e])
}}}
}
if(AjxPackage.define("zimbraMail.share.model.ZmList")){
ZmList=function(t,e){
if(arguments.length==0){
return
}
ZmModel.call(this,t);
this.type=t;
this.search=e;
this._vector=new AjxVector();
this._hasMore=false;
this._idHash=new Object();
var a=appCtxt.getTagTree();
if(a){
this._tagChangeListener=new AjxListener(this,this._tagTreeChangeListener);
a.addChangeListener(this._tagChangeListener)
}};
ZmList.prototype=new ZmModel;
ZmList.prototype.constructor=ZmList;
ZmList.ITEM_CLASS={};
ZmList.NODE={};
ZmList.ITEM_TYPE={};
ZmList.CHUNK_SIZE=100;
ZmList.CHUNK_PAUSE=500;
ZmList.prototype.toString=function(){
return"ZmList"
};
ZmList.prototype.get=function(e){
return this._vector.get(e)
};
ZmList.prototype.add=function(t,e){
this._vector.add(t,e);
if(t.id){
this._idHash[t.id]=t
}};
ZmList.prototype.remove=function(e){
this._vector.remove(e);
if(e.id){
delete this._idHash[e.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(e){
return this._vector.indexOf(e)
};
ZmList.prototype.hasMore=function(){
return this._hasMore
};
ZmList.prototype.setHasMore=function(e){
this._hasMore=e
};
ZmList.prototype.getArray=function(){
return this._vector.getArray()
};
ZmList.prototype.getVector=function(){
return this._vector
};
ZmList.prototype.getById=function(e){
return this._idHash[e]
};
ZmList.prototype.clear=function(){
var e=this.getArray();
for(var t=0;
t<e.length;
t++){
e[t].clear()
}
this._evtMgr.removeAll(ZmEvent.L_MODIFY);
this._vector.removeAll();
for(var o in this._idHash){
this._idHash[o]=null
}
this._idHash=new Object()
};
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;
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){
if(!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(o,a){
var n=null;
var t=(o+a>this.size())?this.size():o+a;
var e=this.getArray();
if(o<t){
n=AjxVector.fromArray(e.slice(o,t))
}
return n
};
ZmList.prototype.cache=function(n,t){
this.getVector().merge(n,t);
var o=t.getArray();
for(var e=0;
e<o.length;
e++){
var a=o[e];
a.list=this;
if(a.id){
this._idHash[a.id]=a
}}};
ZmList.prototype.flagItems=function(a){
a=Dwt.getParams(arguments,["items","op","value","callback"]);
a.items=AjxUtil.toArray(a.items);
if(a.op=="update"){
a.action=a.op;
a.attrs={
f:a.value}
}else{
a.action=a.value?a.op:"!"+a.op
}
if(appCtxt.multiAccounts){
var t=this.search.folderId;
var e=t&&appCtxt.getById(t);
if(e&&e.isRemote()){
a.accountName=a.items[0].getAccount().name
}}
this._itemAction(a)
};
ZmList.prototype.tagItems=function(s){
s=Dwt.getParams(arguments,["items","tagId","doTag"]);
var o=s.tagId||(s.tag&&s.tag.id);
if(appCtxt.multiAccounts&&!appCtxt.getActiveAccount().isMain){
o=ZmOrganizer.normalizeId(o)
}
var t=AjxUtil.toArray(s.items);
var e=[],r=s.doTag;
if(t[0]&&t[0] instanceof ZmItem){
for(var a=0;
a<t.length;
a++){
var n=t[a];
if((r&&(!n.hasTag(o)||n.type==ZmItem.CONV))||(!r&&n.hasTag(o))){
e.push(n)
}}}else{
e=t
}
s.items=e;
s.attrs={
tag:o};
s.action=r?"tag":"!tag";
s.actionText=r?ZmMsg.actionTag:ZmMsg.actionUntag;
if(s.tag&&s.tag.name){
s.actionArg=AjxStringUtil.htmlEncode(s.tag.name)
}
this._itemAction(s)
};
ZmList.prototype.removeAllTags=function(n){
n=(n&&n.items)?n:{
items:n};
var t=AjxUtil.toArray(n.items);
var e=[];
if(t[0]&&t[0] instanceof ZmItem){
for(var a=0;
a<t.length;
a++){
var o=t[a];
if(o.tags&&o.tags.length){
e.push(o)
}}}else{
e=t
}
n.items=e;
n.action="update";
n.attrs={
t:""};
n.actionText=ZmMsg.actionRemoveTags;
this._itemAction(n)
};
ZmList.prototype.moveItems=function(n){
n=Dwt.getParams(arguments,["items","folder","attrs","callback","errorCallback","finalCallback","noUndo","actionText"]);
var a=AjxUtil.hashCopy(n);
a.items=AjxUtil.toArray(n.items);
a.attrs=n.attrs||{};
a.childWin=n.childWin;
a.closeChildWin=n.closeChildWin;
if(a.folder.id==ZmFolder.ID_TRASH){
a.actionText=(n.actionText!==null)?(n.actionText||ZmMsg.actionTrash):null;
a.action="trash"
}else{
a.actionText=(n.actionText!==null)?(n.actionText||ZmMsg.actionMove):null;
a.actionArg=n.folder.getName(false,false,true);
a.action="move";
a.attrs.l=n.folder.id
}
a.callback=new AjxCallback(this,this._handleResponseMoveItems,[n]);
if(appCtxt.multiAccounts){
var t=n.items[0].getFolderId&&n.items[0].getFolderId();
if(!t){
var o=n.items[0]&&n.items[0].id;
t=o&&appCtxt.getById(o)&&appCtxt.getById(o).folderId
}
var e=appCtxt.getById(t);
if((n.items[0].isDraft&&n.folder.id==ZmFolder.ID_DRAFTS)||(n.folder.isRemote())||(e&&e.isRemote())){
a.accountName=n.items[0].getAccount().name
}}
a.errorCallback=n.errorCallback;
this._itemAction(a)
};
ZmList.prototype._handleResponseMoveItems=function(s,e){
var r=e.getResponse();
if(r&&r.length&&(r[0] instanceof ZmItem)){
this.moveLocal(r,s.folder.id);
for(var a=0;
a<r.length;
a++){
var o=r[a];
var t={
oldFolderId:o.folderId};
o.moveLocal(s.folder.id)
}
var o=r[0];
var n=o.list;
if(n){
n._evt.batchMode=true;
n._evt.item=o;
n._evt.items=r;
n._notify(ZmEvent.E_MOVE,t)
}}
if(s.callback){
s.callback.run(e)
}};
ZmList.prototype.copyItems=function(e){
e=Dwt.getParams(arguments,["items","folder","attrs"]);
e.items=AjxUtil.toArray(e.items);
e.attrs=e.attrs||{};
e.attrs.l=e.folder.id;
e.action="copy";
e.actionText=ZmMsg.actionCopied;
e.actionArg=e.folder.getName(false,false,true);
e.callback=new AjxCallback(this,this._handleResponseCopyItems,e);
if(appCtxt.multiAccounts&&e.folder.isRemote()){
e.accountName=e.items[0].getAccount().name
}
this._itemAction(e)
};
ZmList.prototype._handleResponseCopyItems=function(o,e){
var a=e.getResponse();
if(a.length>0){
var t=AjxMessageFormat.format(ZmMsg.itemCopied,a.length);
appCtxt.getAppController().setStatusMsg(t)
}};
ZmList.prototype.deleteItems=function(o){
o=Dwt.getParams(arguments,["items","hardDelete","attrs","childWin"]);
var h=o.items=AjxUtil.toArray(o.items);
var r=[];
var n=[];
if(h[0]&&h[0] instanceof ZmItem){
for(var s=0;
s<h.length;
s++){
var l=h[s];
var t=l.getFolderId();
var e=appCtxt.getById(t);
if(o.hardDelete||(e&&e.isHardDelete())){
n.push(l)
}else{
r.push(l)
}}}else{
r=h
}
o.callback=o.childWin&&new AjxCallback(this._handleDeleteNewWindowResponse,o.childWin);
if(r.length){
if(appCtxt.multiAccounts){
var a=this._filterItemsByAccount(r);
if(!o.callback){
o.callback=new AjxCallback(this,this._deleteAccountItems,[a,o])
}
this._deleteAccountItems(a,o)
}else{
o.items=r;
o.folder=appCtxt.getById(ZmFolder.ID_TRASH);
this.moveItems(o)
}}
if(n.length){
o.items=n;
o.action="delete";
o.actionText=ZmMsg.actionDelete;
this._itemAction(o)
}};
ZmList.prototype._deleteAccountItems=function(o,n){
var e;
for(var t in o){
e=o[t];
break
}
if(e){
delete o[t];
var a=window.parentAppCtxt||window.appCtxt;
n.accountName=a.accountList.getAccount(t).name;
n.items=e;
n.folder=appCtxt.getById(ZmFolder.ID_TRASH);
this.moveItems(n)
}};
ZmList.prototype._filterItemsByAccount=function(e){
var n={};
if(e[0]&&e[0] instanceof ZmItem){
for(var a=0;
a<e.length;
a++){
var o=e[a];
var t=o.getAccount().id;
if(!n[t]){
n[t]=[]
}
n[t].push(o)
}}else{
var s=appCtxt.accountList.mainAccount.id;
n[s]=e
}
return n
};
ZmList.prototype._handleDeleteNewWindowResponse=function(t,e){
if(t){
t.close()
}};
ZmList.prototype.modifyItem=function(t,e,a){
t.modify(e,a)
};
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(e,t){};
ZmList.prototype.createLocal=function(e){};
ZmList.prototype.flagLocal=function(t,e,a){};
ZmList.prototype.tagLocal=function(t,e,a){};
ZmList.prototype.removeAllTagsLocal=function(e){};
ZmList.prototype.deleteLocal=function(e){
for(var t=0;
t<e.length;
t++){
this.remove(e[t])
}};
ZmList.prototype.moveLocal=function(t,e){
for(var a=0;
a<t.length;
a++){
this.remove(t[a])
}};
ZmList.prototype._itemAction=function(r,o){
var y=this._getIds(r.items);
var n=y.hash;
var l=y.list;
if(!(l&&l.length)){
if(r.callback){
r.callback.run(new ZmCsfeResult([]))
}
if(r.finalCallback){
r.finalCallback.run(r)
}
return
}
var u;
if(r.items.length==1&&r.items[0]&&r.items[0].type){
u=r.items[0].type
}else{
u=this.type
}
if(!u){
return
}
if(!r.accountName&&appCtxt.multiAccounts){
r.accountName=appCtxt.accountList.mainAccount.name
}
var a=ZmItem.SOAP_CMD+"Request";
var t=o?o._useJson:true;
var h,s;
if(t){
h={};
var g=this._getActionNamespace();
h[a]={
_jsns:g};
var s=h[a].action={};
s.op=r.action;
for(var c in r.attrs){
s[c]=r.attrs[c]
}}else{
h=AjxSoapDoc.create(a,this._getActionNamespace());
s=h.set("action");
s.setAttribute("op",r.action);
for(var c in r.attrs){
s.setAttribute(c,r.attrs[c])
}}
var f=appCtxt.getActionController();
var e=(!r.noUndo&&f&&f.actionPerformed({
op:r.action,ids:l,attrs:r.attrs}
))||null;
var p=new AjxCallback(this,this._handleResponseItemAction,[r.callback,e]);
var m={
ids:l,idHash:n,accountName:r.accountName,request:h,action:s,type:u,callback:p,finalCallback:r.finalCallback,errorCallback:r.errorCallback,batchCmd:o,numItems:r.count||0,actionText:r.actionText,actionArg:r.actionArg,actionLogItem:e,childWin:r.childWin,closeChildWin:r.closeChildWin};
var d=ZmList.progressDialog;
if(l.length>=ZmList.CHUNK_SIZE){
if(!d){
d=ZmList.progressDialog=appCtxt.getCancelMsgDialog();
d.reset();
d.registerCallback(DwtDialog.CANCEL_BUTTON,new AjxCallback(this,this._cancelAction,[m]))
}}
this._doAction(m)
};
ZmList.prototype._handleResponseItemAction=function(o,a,t,e){
if(a){
a.setComplete()
}
if(o){
e.set(t);
o.run(e)
}};
ZmList.prototype._doAction=function(n){
var o=n.ids.splice(0,ZmList.CHUNK_SIZE);
var a=o.join(",");
var r=true;
if(n.action.setAttribute){
n.action.setAttribute("id",a);
r=false
}else{
n.action.id=a
}
var t=Boolean(n.ids.length&&!n.cancelled);
var s=new AjxCallback(this,this._handleResponseDoAction,[n]);
if(n.batchCmd){
n.batchCmd.addRequestParams(n.request,s,n.errorCallback)
}else{
var e={
asyncMode:true,callback:s,errorCallback:n.errorCallback,accountName:n.accountName,more:t};
if(r){
e.jsonObj=n.request
}else{
e.soapDoc=n.request
}
n.reqId=appCtxt.getAppController().sendRequest(e)
}};
ZmList.prototype._handleResponseDoAction=function(t,c){
var r;
var o=c.getResponse();
var a=o[ZmItem.SOAP_CMD[t.type]+"Response"];
if(a&&a.action){
var e=a.action.id.split(",");
if(e){
var h=[];
for(var n=0;
n<e.length;
n++){
var l=t.idHash[e[n]];
if(l){
h.push(l)
}}
t.numItems+=h.length;
if(t.callback){
t.callback.run(h,c)
}
var s=ZmList.progressDialog;
if(t.actionText){
r=ZmList.getActionSummary(t.actionText,t.numItems,t.type,t.actionArg)
}
if(s&&r){
s.setMessage(r,DwtMessageDialog.INFO_STYLE,AjxMessageFormat.format(ZmMsg.inProgress));
if(!s.isPoppedUp()){
s.popup()
}}}}
if(t.ids.length&&!t.cancelled){
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._doAction,[t]),ZmItem.CHUNK_PAUSE)
}else{
t.reqId=null;
t.actionSummary=r;
if(t.finalCallback){
t.finalCallback.run(t)
}else{
ZmList.killProgressDialog(t.actionSummary,t.actionLogItem,t.closeChildWin)
}}};
ZmList.killProgressDialog=function(a,r,s){
var n=ZmList.progressDialog;
if(n){
n.unregisterCallback(DwtDialog.CANCEL_BUTTON);
n.popdown();
ZmList.progressDialog=null
}
if(a){
a=AjxStringUtil.htmlEncode(a);
var e=s?parentAppCtxt:appCtxt;
var o=e.getActionController();
var t=r&&o&&o.getUndoLink(r);
if(t&&o){
o.onPopup();
e.setStatusMsg({
msg:a+t,transitions:o.getStatusTransitions()}
)
}else{
e.setStatusMsg(a)
}}};
ZmList.getActionSummary=function(s,a,n,e){
var o=AjxMessageFormat.format(ZmMsg[ZmItem.COUNT_KEY[n]],a);
var t=AjxMessageFormat.format(ZmMsg[ZmItem.COUNT_KEY[n]],1);
return AjxMessageFormat.format(s,[a,o,e,t])
};
ZmList.prototype._cancelAction=function(t){
t.cancelled=true;
if(t.reqId){
appCtxt.getRequestMgr().cancelRequest(t.reqId)
}
if(t.finalCallback){
t.finalCallback.run(t)
}
var e=ZmList.progressDialog;
if(e&&e.isPoppedUp()){
e.popdown()
}};
ZmList.prototype._getTypedItems=function(t){
var e={};
for(var a=0;
a<t.length;
a++){
var o=t[a].type;
if(!e[o]){
e[o]=[]
}
e[o].push(t[a])
}
return e
};
ZmList.prototype._getIds=function(n){
var o={};
if(n instanceof ZmItem){
n=[n]
}
var t=[];
if((n&&n.length)){
for(var e=0;
e<n.length;
e++){
var a=n[e];
var s=a.id;
if(s){
t.push(s);
o[s]=a
}}}
return{
hash:o,list:t}
};
ZmList.prototype._sortIndex=function(e){
return 0
};
ZmList.prototype._redoSearch=function(e){
var t=appCtxt.getSearchController();
t.redoSearch(e._currentSearch)
};
ZmList.prototype._getActionNamespace=function(){
return"urn:zimbraMail"
};
ZmList.prototype._folderTreeChangeListener=function(s){
if(s.type!=ZmEvent.S_FOLDER){
return
}
var n=s.getDetail("organizers")[0];
var o=s.getDetail("fields");
var a=appCtxt.getCurrentController();
var t=(appCtxt.getCurrentList()==this);
if(s.event==ZmEvent.E_DELETE&&(s.source instanceof ZmFolder)&&s.source.id==ZmFolder.ID_TRASH){
var e=a.getCurrentView();
if(e){
e.offset=0
}
a._resetNavToolBarButtons(view)
}else{
if(t&&a&&a._currentSearch&&(s.event==ZmEvent.E_MOVE||(s.event==ZmEvent.E_MODIFY)&&o&&o[ZmOrganizer.F_NAME])){
var r=s.getDetail("oldPath");
if(a._currentSearch.hasFolderTerm(r)){
a._currentSearch.replaceFolderTerm(r,n.getPath());
appCtxt.getSearchController().setSearchField(a._currentSearch.query)
}}}};
ZmList.prototype._tagTreeChangeListener=function(r){
if(r.type!=ZmEvent.S_TAG){
return
}
var u=r.getDetail("organizers")[0];
var n=r.getDetail("fields");
var c=appCtxt.getCurrentController();
if(!c||(appCtxt.getCurrentList()!=this)){
return
}
if((r.event==ZmEvent.E_MODIFY)&&n&&n[ZmOrganizer.F_NAME]){
var t=r.getDetail("oldName");
if(c._currentSearch&&c._currentSearch.hasTagTerm(t)){
c._currentSearch.replaceTagTerm(t,u.getName());
appCtxt.getSearchController().setSearchField(c._currentSearch.query)
}}else{
if(r.event==ZmEvent.E_DELETE){
var h=this.getArray();
var e=this._evtMgr.isListenerRegistered(ZmEvent.L_MODIFY);
for(var o=0;
o<h.length;
o++){
var d=this.getById(h[o].id);
if(d&&d.hasTag(u.id)){
d.tagLocal(u.id,false);
if(e){
this._notify(ZmEvent.E_TAGS,{
items:[d]}
)
}}}
if(c._currentSearch&&c._currentSearch.hasTagTerm(u.getName())){
var l=appCtxt.getCurrentViewId();
c.enablePagination(false,l);
var s=c.getCurrentView();
if(s&&s.sortingEnabled){
s.sortingEnabled=false
}
if(l==ZmId.VIEW_CONVLIST){
c._currentSearch.query="is:read is:unread"
}
c._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(e){
return(e)?this._count:this.visibleAccounts.length
};
ZmAccountList.prototype.add=function(e){
this._accounts[e.id]=e;
this._count++;
if(e.visible||e.id==ZmAccountList.DEFAULT_ID){
this.visibleAccounts.push(e)
}
if(e.id==ZmAccountList.DEFAULT_ID){
this.mainAccount=e
}};
ZmAccountList.prototype.getAccounts=function(){
return this._accounts
};
ZmAccountList.prototype.getAccount=function(e){
return e?this._accounts[e]:this.mainAccount
};
ZmAccountList.prototype.getAccountByName=function(e){
for(var t in this._accounts){
if(this._accounts[t].name==e){
return this._accounts[t]
}}
return null
};
ZmAccountList.prototype.getAccountByEmail=function(e){
for(var t in this._accounts){
if(this._accounts[t].getEmail()==e){
return this._accounts[t]
}}
return null
};
ZmAccountList.prototype.getItemCount=function(e,n){
var o=0;
for(var t=0;
t<this.visibleAccounts.length;
t++){
var r=this.visibleAccounts[t];
if(r.isMain){
continue
}
var s=ZmOrganizer.getSystemId(e,r);
var a=appCtxt.getById(s);
if(a){
o+=(n?a.numUnread:a.numTotal)
}}
return o
};
ZmAccountList.prototype.generateQuery=function(e,s){
var l=s&&s.get(0);
var h=[];
var r=this.visibleAccounts;
var a=e||ZmOrganizer.ID_ROOT;
var o=e?"inid":"underid";
for(var n=0;
n<r.length;
n++){
var c=r[n];
if((l&&!c.isAppEnabled(ZmItem.APP[l]))||c.isMain){
continue
}
var t=[o,':"',ZmOrganizer.getSystemId(a,c,true),'"'];
h.push(t.join(""))
}
if(a==ZmOrganizer.ID_ROOT){
h.push([o,':"',appCtxt.accountList.mainAccount.id,":",a,'"'].join(""))
}
return(h.join(" OR "))
};
ZmAccountList.prototype.loadAccounts=function(t){
var e=(new Array()).concat(this.visibleAccounts);
this._loadAccount(e,t)
};
ZmAccountList.prototype._loadAccount=function(t,n){
var o=t.shift();
if(o){
var a=new AjxCallback(this,this._loadAccount,[t,n]);
o.load(a)
}else{
ZmOrganizer.HIDE_EMPTY[ZmOrganizer.TAG]=true;
ZmOrganizer.HIDE_EMPTY[ZmOrganizer.SEARCH]=true;
for(var e=0;
e<this.visibleAccounts.length;
e++){
if(appCtxt.get(ZmSetting.OFFLINE_SMTP_ENABLED,null,this.visibleAccounts[e])){
appCtxt.set(ZmSetting.OFFLINE_COMPOSE_ENABLED,true,null,null,true);
break
}}
if(n){
n.run()
}}};
ZmAccountList.prototype.setActiveAccount=function(t,e){
this.activeAccount=t;
this._evt=this._evt||new ZmEvent();
this._evt.account=t;
if(!e){
this._evtMgr.notifyListeners("ACCOUNT",this._evt)
}};
ZmAccountList.prototype.addActiveAcountListener=function(t,e){
return this._evtMgr.addListener("ACCOUNT",t,e)
};
ZmAccountList.prototype.isInitialSyncing=function(){
for(var e=0;
e<this.visibleAccounts.length;
e++){
var t=this.visibleAccounts[e];
if(t.isMain){
continue
}
if(t.isOfflineInitialSync()){
return true
}}
return false
};
ZmAccountList.prototype.isSyncStatus=function(e){
for(var t=0;
t<this.visibleAccounts.length;
t++){
var a=this.visibleAccounts[t];
if(a.isMain){
continue
}
if(a.status==e){
return true
}}
return false
};
ZmAccountList.prototype.accountTypeExists=function(t){
for(var e=0;
e<this.visibleAccounts.length;
e++){
var a=this.visibleAccounts[e];
if(t==ZmAccount.TYPE_ZIMBRA&&a.isMain){
continue
}
if(a.type==t){
return true
}}
return false
};
ZmAccountList.prototype.syncAll=function(t){
var e=(new Array()).concat(this.visibleAccounts);
this._sendSync(e,t)
};
ZmAccountList.prototype._sendSync=function(e,a){
var t=e.shift();
if(t){
if(!t.isMain){
t.sync()
}
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._sendSync,[e,a]),500)
}else{
if(a){
a.run()
}}};
ZmAccountList.prototype.createAccounts=function(t,n){
var o=appCtxt.accountList.mainAccount;
o.id=n.id;
o.name=n.name;
o.isMain=true;
o.isZimbraAccount=true;
o.loaded=true;
o.visible=true;
o.settings=t;
o.type=ZmAccount.TYPE_ZIMBRA;
o.icon="AccountZimbra";
o.active=true;
this._accounts[o.id]=o;
delete this._accounts[ZmAccountList.DEFAULT_ID];
this.setActiveAccount(o);
if(appCtxt.isOffline){
o.displayName=ZmMsg.localFolders;
if(appCtxt.get(ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED)){
appCtxt.set(ZmSetting.NOTEBOOK_ENABLED,true,null,null,true)
}}
var a=n.childAccounts&&n.childAccounts.childAccount;
if(a){
for(var e=0;
e<a.length;
e++){
this.add(ZmZimbraAccount.createFromDom(a[e]))
}
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 t=0;
t<this.visibleAccounts.length;
t++){
for(var a in trees){
var e=trees[a];
if(e&&e.reset){
e.reset()
}}}};
ZmAccountList.prototype.saveImplicitPrefs=function(){
for(var e=0;
e<this.visibleAccounts.length;
e++){
this.visibleAccounts[e].saveImplicitPrefs()
}};
ZmAccountList.prototype.getTooltipForVirtualFolder=function(e){
var s=0;
var n=0;
for(var a=0;
a<this.visibleAccounts.length;
a++){
var h=this.visibleAccounts[a];
var r=ZmOrganizer.getSystemId(e,h);
var o=appCtxt.getById(r);
if(o){
s+=o.numTotal;
n+=o.sizeTotal
}}
var t={
itemText:ZmMsg.messages,numTotal:s,sizeTotal:n};
return AjxTemplate.expand("share.App#FolderTooltip",t)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmAccount")){
ZmAccount=function(t,a,e){
if(arguments.length==0){
return
}
this.id=a;
this.name=e;
this.type=t||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.LOCAL_ACCOUNT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff";
ZmAccount.getTypeName=function(e){
switch(e){
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(e){
this.name=e
};
ZmAccount.prototype.getName=function(){
return this.name
};
ZmAccount.prototype.setEmail=function(e){
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(a,e,t){
ZmAccount.call(this,null,a,e);
this.visible=(t!==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.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(t){
var e=this.getIdentity();
if(!e){
return
}
e.name=t
};
ZmZimbraAccount.prototype.getName=function(){
var e=this.getIdentity();
var t=(!e)?this.settings.get(ZmSetting.DISPLAY_NAME):e.name;
if(!t){
t=this.getDisplayName()
}
return e.isDefault&&t==ZmIdentity.DEFAULT_NAME?ZmMsg.accountDefault:t
};
ZmZimbraAccount.prototype.setEmail=function(e){};
ZmZimbraAccount.prototype.getEmail=function(){
return this.name
};
ZmZimbraAccount.prototype.getDisplayName=function(){
if(!this.displayName){
var e=this.isMain?this.settings.get(ZmSetting.DISPLAY_NAME):this._displayName;
this.displayName=(this._accountName||e||this.name)
}
return this.displayName
};
ZmZimbraAccount.prototype.getIdentity=function(){
var e=appCtxt.getIdentityCollection(this).defaultIdentity;
if(!appCtxt.isFamilyMbox||this.isMain){
return e
}
if(!this.dummyIdentity){
this.dummyIdentity=new ZmIdentity(this.name);
AjxUtil.hashUpdate(this.dummyIdentity,e,true,["name","isDefault"])
}
return this.dummyIdentity
};
ZmZimbraAccount.prototype.getToolTip=function(){
if(this.status||this.lastSync||this.isMain){
var a=(this.lastSync&&this.lastSync!=0)?(new Date(parseInt(this.lastSync))):null;
var t=appCtxt.get(ZmSetting.QUOTA_USED,null,this);
var e;
if(!a){
if(t>0&&!this.isMain){
e=ZmMsg.unknown
}}else{
e=AjxDateUtil.computeWordyDateStr(new Date(),a)
}
var o={
lastSync:e,hasNotSynced:this.hasNotSynced(),status:this.getStatusMessage(),quota:AjxUtil.formatSize(t,false,1)};
return AjxTemplate.expand("share.App#ZimbraAccountTooltip",o)
}
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 e=appCtxt.getFolderTree(this);
if(this.isCalDavBased()){
var a=e.getByType(ZmOrganizer.CALENDAR);
for(var t=0;
t<a.length;
t++){
if(a[t].nId==ZmOrganizer.ID_CALENDAR){
continue
}
return a[t]
}}
return e.getById(ZmOrganizer.ID_CALENDAR)
};
ZmZimbraAccount.prototype.updateState=function(a){
if(this.isMain){
return
}
var s=false;
if(this.lastSync!=a.lastsync){
this.lastSync=a.lastsync;
if(this.visible){
s=true
}}
var e=false;
if(this.status!=a.status){
this.status=a.status;
if(this.visible){
e=true
}}
var t=appCtxt.getOverviewController()._overviewContainer;
for(var n in t){
var r=t[n];
if(e||s){
r.updateAccountInfo(this,e,s)
}}
if(this.visible&&a.unread!=this.unread){
this.unread=a.unread
}
this.code=a.code;
if(a.error){
var o=a.error[0];
this.errorDetail=o.exception[0]._content;
this.errorMessage=o.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(e){
var t=((ZdMsg["client."+e])||(ZdMsg["exception."+e]));
if(!t&&e){
t=ZdMsg["exception.offline.UNEXPECTED"]
}
return t
};
ZmZimbraAccount.prototype.getStatusMessage=function(){
if(this.inNewMailMode){
return AjxMessageFormat.format(ZmMsg.unreadCount,this.unread)
}
switch(this.status){
case ZmZimbraAccount.STATUS_OFFLINE:return ZmMsg.imStatusOffline;
case ZmZimbraAccount.STATUS_ONLINE:return ZmMsg.imStatusOnline;
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 a=(this.status==ZmZimbraAccount.STATUS_ERROR)?appCtxt.getErrorDialog():appCtxt.getMsgDialog();
var o=this.getZdMsg(this.code);
if(o==""){
o=this.getStatusMessage()
}
a.setMessage(o);
if(this.status==ZmZimbraAccount.STATUS_ERROR){
var t=[];
var e=0;
if(this.errorMessage){
t[e++]="<p><b>";
t[e++]=ZdMsg.DebugMsg;
t[e++]="</b>: ";
t[e++]=this.errorMessage;
t[e++]="</p>"
}
if(this.errorDetail){
t[e++]="<p><b>";
t[e++]=ZdMsg.DebugStack;
t[e++]="</b>:</p><p><pre>";
t[e++]=this.errorDetail;
t[e++]="</pre></p>"
}
t[e++]="<p><b>";
t[e++]=ZdMsg.DebugActionNote;
t[e++]="</b></p>";
a.setDetailString(t.join(""))
}
a.popup(null,true)
};
ZmZimbraAccount.createFromDom=function(e){
var t=new ZmZimbraAccount();
t._loadFromDom(e);
return t
};
ZmZimbraAccount.prototype.load=function(u){
if(!this.loaded){
this.settings=new ZmSettings();
var r=appCtxt.accountList.mainAccount;
for(var o=0;
o<ZmApp.APPS.length;
o++){
var h=ZmApp.APPS[o];
var f=ZmApp.SETTING[h];
if(f&&appCtxt.get(f,null,r)){
var t=appCtxt.getApp(h);
if(t){
t._registerSettings(this.settings)
}}}
var a=new ZmBatchCommand(null,this.name);
var n=new AjxCallback(this,this._handleLoadSettings);
this.settings.loadUserSettings(n,null,this.name,null,a);
var e=AjxSoapDoc.create("GetTagRequest","urn:zimbraMail");
var d=new AjxCallback(this,this._handleLoadTags);
a.addNewRequestParams(e,d);
this.loadMetaData(null,a);
var c=AjxSoapDoc.create("GetFolderRequest","urn:zimbraMail");
c.getMethod().setAttribute("visible","1");
var l=new AjxCallback(this,this._handleLoadFolders);
a.addNewRequestParams(c,l);
var m=new AjxCallback(this,this._handleLoadUserInfo,u);
var s=new AjxCallback(this,this._handleErrorLoad,u);
a.run(m,s)
}else{
if(u){
u.run()
}}};
ZmZimbraAccount.prototype.loadMetaData=function(o,t){
var e=new AjxCallback(this,this._handleLoadMetaData,[o]);
var a=[ZmSetting.M_IMPLICIT,ZmSetting.M_OFFLINE];
this.metaData.load(a,e,t)
};
ZmZimbraAccount.prototype.unload=function(){
if(!appCtxt.inStartup){
this.settings.loadShortcuts(true)
}};
ZmZimbraAccount.prototype.sync=function(a){
var e=AjxSoapDoc.create("SyncRequest","urn:zimbraOffline");
if(appCtxt.get(ZmSetting.OFFLINE_DEBUG_TRACE)){
var t=e.getMethod();
t.setAttribute("debug",1)
}
appCtxt.getAppController().sendRequest({
soapDoc:e,asyncMode:true,noBusyOverlay:true,callback:a,accountName:this.name}
)
};
ZmZimbraAccount.prototype.save=function(a,t,e){
return(this.getIdentity().save(a,t,e))
};
ZmZimbraAccount.prototype.saveImplicitPrefs=function(){
var t=[];
for(var a in ZmSetting.CHANGED_IMPLICIT){
var e=this.settings?this.settings.getSetting(a):null;
if(ZmSetting.IS_GLOBAL[e.id]&&!this.isMain){
continue
}
if(e&&(e.getValue(null,true)!=e.getOrigValue(null,true))){
t.push(e)
}}
if(t.length>0){
this.settings.save(t,null,null,this)
}};
ZmZimbraAccount.prototype.isAppEnabled=function(e){
switch(e){
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.IM:return appCtxt.get(ZmSetting.IM_ENABLED,null,this);
case ZmApp.MAIL:return appCtxt.get(ZmSetting.MAIL_ENABLED,null,this);
case ZmApp.NOTEBOOK:return appCtxt.get(ZmSetting.NOTEBOOK_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(e){
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 t=e.getResponse().GetInfoResponse;
appCtxt.getIdentityCollection(this).initialize(t.identities);
appCtxt.getDataSourceCollection(this).initialize(t.dataSources);
appCtxt.getSignatureCollection(this).initialize(t.signatures)
};
ZmZimbraAccount.prototype._handleLoadFolders=function(e){
var a=e.getResponse().GetFolderResponse;
var t=a?a.folder[0]:null;
if(t){
appCtxt.getRequestMgr()._loadTree(ZmOrganizer.FOLDER,null,a.folder[0],"folder",this)
}};
ZmZimbraAccount.prototype._handleLoadTags=function(e){
var t=e.getResponse().GetTagResponse;
appCtxt.getRequestMgr()._loadTree(ZmOrganizer.TAG,null,t,null,this)
};
ZmZimbraAccount.prototype._handleLoadUserInfo=function(t){
this.loaded=true;
var e=appCtxt.getFolderTree(this);
if(e){
e.getPermissions({
noBusyOverlay:true,accountName:this.name}
)
}
if(t){
t.run()
}};
ZmZimbraAccount.prototype._handleLoadMetaData=function(a,t){
for(var e in t){
this.settings.createFromJs(t[e])
}
if(a){
a.run()
}};
ZmZimbraAccount.prototype._handleErrorLoad=function(t,e){
if(t){
t.run()
}};
ZmZimbraAccount.prototype._loadFromDom=function(e){
this.id=e.id;
this.name=e.name;
this.visible=e.visible;
this.active=e.active;
var t=e.attrs&&e.attrs._attrs;
this._displayName=t?t.displayName:this.email;
this._accountName=t&&t.zimbraPrefLabel
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmInvite")){
ZmInvite=function(){
ZmModel.call(this)
};
ZmInvite.prototype=new ZmModel;
ZmInvite.prototype.constructor=ZmInvite;
ZmInvite.CHANGES_LOCATION="location";
ZmInvite.CHANGES_SUBJECT="subject";
ZmInvite.CHANGES_RECURRENCE="recurrence";
ZmInvite.CHANGES_TIME="time";
ZmInvite.prototype.toString=function(){
return"ZmInvite: name="+this.name+" id="+this.id
};
ZmInvite._sendFun=null;
ZmInvite.createFromDom=function(n){
var t=new ZmInvite();
t.components=n[0].comp;
t.replies=n[0].replies;
t.id=n[0].id;
if(t.components==null){
t.components=[{}
];
t.components.empty=true
}
var e=n[0];
if(e.tz){
for(var o=0;
o<e.tz.length;
o++){
var h=e.tz[o];
var s=AjxTimezone.getRule(h.id);
if(!s){
var r={
standard:h.standard?AjxUtil.createProxy(h.standard[0]):{}
,daylight:h.daylight?AjxUtil.createProxy(h.daylight[0]):null};
r.standard.offset=h.stdoff;
delete r.standard._object_;
if(h.daylight){
r.daylight.offset=h.dayoff;
delete r.daylight._object_
}
s=AjxTimezone.getRule(h.id,r);
if(s){
var a=AjxUtil.createProxy(s);
a.aliasId=s.clientId;
a.clientId=h.id;
a.serverId=h.id;
AjxTimezone.addRule(a)
}}
if(!s){
s={
clientId:h.id,serverId:h.id,autoDetected:true};
if(h.daylight){
s.standard=AjxUtil.createProxy(h.standard[0]);
s.standard.offset=h.stdoff;
s.standard.trans=AjxTimezone.createTransitionDate(s.standard);
s.daylight=AjxUtil.createProxy(h.daylight[0]);
s.daylight.offset=h.dayoff;
s.daylight.trans=AjxTimezone.createTransitionDate(s.daylight)
}else{
s.standard={
offset:h.stdoff}
}
AjxTimezone.addRule(s)
}}}
t.type=e&&e.type?e.type:"appt";
return t
};
ZmInvite.prototype.setMessageId=function(e){
this.msgId=e
};
ZmInvite.prototype.getMessageId=function(){
return this.msgId
};
ZmInvite.prototype.getComponent=function(e){
return this.components[e]
};
ZmInvite.prototype.getComponents=function(){
return this.components
};
ZmInvite.prototype.hasMultipleComponents=function(){
return(this.components.length>1)
};
ZmInvite.prototype.hasOtherAttendees=function(e){
var t=e||0;
return this.components[t].at&&this.components[t].at.length>0
};
ZmInvite.prototype.getEventName=function(e){
var t=e||0;
return this.components[t]?this.components[t].name:null
};
ZmInvite.prototype.getAlarm=function(e){
var t=e||0;
return this.components[t]?this.components[t].alarm:null
};
ZmInvite.prototype.getInviteMethod=function(e){
var t=e||0;
return this.components[t]?this.components[t].method:null
};
ZmInvite.prototype.getSequenceNo=function(e){
var t=e||0;
return this.components[t]?this.components[t].seq:null
};
ZmInvite.prototype.getOrganizerEmail=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].or&&this.components[t].or.url)?(this.components[t].or.url.replace("MAILTO:","")):null
};
ZmInvite.prototype.getOrganizerName=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].or)?(this.components[t].or.d||this.components[t].or.url):null
};
ZmInvite.prototype.getSentBy=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].or)?this.components[t].or.sentBy:null
};
ZmInvite.prototype.isOrganizer=function(e){
var t=e||0;
return this.components[t]?(!!this.components[t].isOrg):false
};
ZmInvite.prototype.shouldRsvp=function(e){
var t=e||0;
return this.components[t]?this.components[t].rsvp:null
};
ZmInvite.prototype.getRecurrenceRules=function(e){
var t=e||0;
return this.components[t].recur
};
ZmInvite.prototype.getAttendees=function(a){
var n=a||0;
var e=this.components[n].at;
var o=[];
if(!(e&&e.length)){
return o
}
for(var t=0;
t<e.length;
t++){
if(!e[t].cutype||(e[t].cutype==ZmCalendarApp.CUTYPE_INDIVIDUAL)){
o.push(e[t])
}}
return o
};
ZmInvite.prototype.getReplies=function(e){
var t=e||0;
return(this.replies&&this.replies[t])?this.replies[t].reply:null
};
ZmInvite.prototype.getResources=function(a){
var n=a||0;
var e=this.components[n].at;
var o=[];
if(!(e&&e.length)){
return o
}
for(var t=0;
t<e.length;
t++){
if(e[t].cutype==ZmCalendarApp.CUTYPE_RESOURCE||e[t].cutype==ZmCalendarApp.CUTYPE_ROOM){
o.push(e[t])
}}
return o
};
ZmInvite.prototype.getExceptId=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].exceptId)?this.components[t].exceptId[0]:null
};
ZmInvite.prototype.getAppointmentId=function(e){
var t=e||0;
return this.components[t].apptId
};
ZmInvite.prototype.getStatus=function(e){
var t=e||0;
return this.components[t].status
};
ZmInvite.prototype.isEmpty=function(){
return Boolean(this.components.empty)
};
ZmInvite.prototype.isException=function(e){
var t=e||0;
return this.components[t]?this.components[t].ex:false
};
ZmInvite.prototype.isRecurring=function(e){
var t=e||0;
return this.components[t]?this.components[t].recur:false
};
ZmInvite.prototype.isAllDayEvent=function(e){
var t=e||0;
return this.components[t]?this.components[t].allDay=="1":false
};
ZmInvite.prototype.isMultiDay=function(t){
var o=t||0;
var a=this.getServerStartDate(o);
var e=this.getServerEndDate(o);
if(!a){
return false
}
return(a.getDate()!=e.getDate())||(a.getMonth()!=e.getMonth())||(a.getFullYear()!=e.getFullYear())
};
ZmInvite.prototype.getComponentDescriptionHtml=function(t){
var s=t||0;
var e=this.components[s];
if(e==null){
return
}
var n=e.descHtml;
var o=n&&n[0]._content||null;
if(!o){
var a=e.desc;
a=(a&&a[0]._content)||null;
if(!a){
o=this.getApptSummary(true)
}}
return o
};
ZmInvite.prototype.getComponentDescription=function(t){
var s=t||0;
var e=this.components[s];
if(e==null){
return
}
var o=e.desc;
var a=o&&o[0]._content||null;
if(!a){
var n=e.descHtml;
n=(n&&n[0]._content)||null;
if(!n){
a=this.getApptSummary()
}}
return a
};
ZmInvite.prototype.getServerEndTime=function(l){
var u=l||0;
if(this.components==null){
return
}
if(this._serverEndTime==null){
if(this.components.e!=null){
this._serverEndTime=this.components.e[0].d
}else{
if(this.components.s){
var a=this.components.dur;
var f=a&&a[0].d||0;
var e=a&&a[0].w||0;
var n=a&&a[0].h||0;
var s=a&&a[0].m||0;
var g=a&&a[0].s||0;
var p=parseInt(g)+(parseInt(s)*60)+(parseInt(n)*3600)+(parseInt(f)*24*3600)+(parseInt(e)*7*24*3600);
var o=this.components.s[0].d;
var r=parseInt(o.substr(0,4),10);
var m=parseInt(o.substr(4,2),10);
var f=parseInt(o.substr(6,2),10);
var c=new Date(r,m-1,f);
if(o.charAt(8)=="T"){
n=parseInt(o.substr(9,2),10);
s=parseInt(o.substr(11,2),10);
g=parseInt(o.substr(13,2),10);
c.setHours(n,s,g,0)
}
var h=new Date(c.getTime()+(p*1000));
m=AjxDateUtil._pad(c.getMonth()+1);
f=AjxDateUtil._pad(c.getDate());
n=AjxDateUtil._pad(c.getHours());
s=AjxDateUtil._pad(c.getMinutes());
g=AjxDateUtil._pad(c.getSeconds());
r=c.getFullYear();
this._serverEndTime=[r,m,f,"T",n,s,g].join("")
}}}
return this._serverEndTime
};
ZmInvite.prototype.getServerEndDate=function(t,e){
var a=t||0;
return AjxDateUtil.parseServerDateTime(this.getServerEndTime(a),e)
};
ZmInvite.prototype.getServerStartTime=function(e){
var t=e||0;
return this.components[t]&&this.components[t].s?this.components[t].s[0].d:null
};
ZmInvite.prototype.getServerStartDate=function(t,e){
var a=t||0;
return AjxDateUtil.parseServerDateTime(this.getServerStartTime(a),e)
};
ZmInvite.prototype.getStartDateFromExceptId=function(e){
var t=e||0;
return AjxDateUtil.parseServerDateTime(this.components[t]&&this.components[t].exceptId?this.components[t].exceptId[0].d:null)
};
ZmInvite.prototype.getServerStartTimeTz=function(e){
var a=e||0;
if(this.components[a]==null){
return
}
if(this._serverStartTimeZone==null){
var t=this.getServerStartTime();
this._serverStartTimeZone=t&&t.charAt(t.length-1)=="Z"?AjxTimezone.GMT_NO_DST:(this.components[a].s?this.components[a].s[0].tz:null)
}
return this._serverStartTimeZone
};
ZmInvite.prototype.getServerEndTimeTz=function(t){
var o=t||0;
var a=this.components[o]&&this.components[o].e;
if(!a){
return null
}
if(!this._serverEndTimeZone){
var e=this.getServerEndTime();
this._serverEndTimeZone=(e&&e.charAt(e.length-1)=="Z")?AjxTimezone.GMT_NO_DST:a[0].tz
}
return this._serverEndTimeZone
};
ZmInvite.prototype.getDurationText=function(m,y,e,h,o,c){
var p=this.components[m];
var f=o||this.getServerStartDate(m);
var l=c||this.getServerEndDate(m);
if(!f&&!l){
return""
}
if(this.isAllDayEvent(m)){
if(y){
return""
}
if(this.isMultiDay(m)){
var r=AjxDateFormat.getDateInstance();
var u=r.format(f);
var t=r.format(l);
if(!ZmInvite._daysFormatter){
ZmInvite._daysFormatter=new AjxMessageFormat(ZmMsg.durationDays)
}
return ZmInvite._daysFormatter.format([u,t])
}
return f?AjxDateFormat.getDateInstance(AjxDateFormat.FULL).format(f):""
}
var r=AjxDateFormat.getDateInstance(AjxDateFormat.FULL);
var s=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
var g=f?[r.format(f),h?" ":"<br>"]:[];
if(e){
g.push(f?s.format(f):"")
}else{
var n=f?s.format(f):"";
var d=s.format(l);
if(!ZmInvite._hoursFormatter){
ZmInvite._hoursFormatter=new AjxMessageFormat(ZmMsg.durationHours)
}
g.push(ZmInvite._hoursFormatter.format([n,d]))
}
return g.join("")
};
ZmInvite.prototype.getName=function(e){
var t=e||0;
return this.components[t]?this.components[t].name:null
};
ZmInvite.prototype.getFreeBusy=function(e){
var t=e||0;
return this.components[t]?this.components[t].fb:null
};
ZmInvite.prototype.getPrivacy=function(e){
var t=e||0;
return this.components[t]?this.components[t]["class"]:null
};
ZmInvite.prototype.getXProp=function(e){
var t=e||0;
return this.components[t]?this.components[t]["xprop"]:null
};
ZmInvite.prototype.getLocation=function(e){
var t=e||0;
return this.components[t]?this.components[t].loc:null
};
ZmInvite.prototype.getRecurrenceId=function(e){
var t=e||0;
return this.components[t]?this.components[t].ridZ:null
};
ZmInvite.prototype.getToolTip=function(){
if(this._toolTip){
return this._toolTip
}
var o=0;
var a=[];
var t=0;
a[t++]="<table cellpadding=0 cellspacing=0 border=0 >";
a[t++]="<tr valign='center'><td colspan=2 align='left'>";
a[t++]="<div style='border-bottom: 1px solid black;'>";
a[t++]="<table cellpadding=0 cellspacing=0 border=0 width=100%>";
a[t++]="<tr valign='center'><td><b>";
a[t++]="<div style='white-space:nowrap'><table border=0 cellpadding=0 cellspacing=0 style='display:inline'><tr>";
if(this.hasOtherAttendees(o)){
a[t++]="<td>";
a[t++]=AjxImg.getImageHtml("ApptMeeting");
a[t++]="</td>"
}
if(this.isException(o)){
a[t++]="<td>";
a[t++]=AjxImg.getImageHtml("ApptException");
a[t++]="</td>"
}else{
if(this.isRecurring(o)){
a[t++]="<td>";
a[t++]=AjxImg.getImageHtml("ApptRecur");
a[t++]="</td>"
}}
a[t++]="</tr></table> ";
a[t++]=AjxStringUtil.htmlEncode(this.getName(o));
a[t++]=" </div></b></td><td align='right'>";
a[t++]=AjxImg.getImageHtml("Appointment");
a[t++]="</td></table></div></td></tr>";
var e=this.getDurationText(o,false,false);
t=this._addEntryRow(ZmMsg.when,e,a,t,false,null,true);
if(this.isRecurring(o)){
if(!this._recurBlurb){
AjxDispatcher.require("CalendarCore");
var n=new ZmRecurrence();
n.parse(this.getRecurrenceRules(o));
this._recurBlurb=n.getBlurb()
}
t=this._addEntryRow(ZmMsg.repeats,this._recurBlurb,a,t,true,null,true)
}
t=this._addEntryRow(ZmMsg.location,this.getLocation(o),a,t,false);
a[t++]="</table>";
this._toolTip=a.join("");
return this._toolTip
};
ZmInvite.prototype.getApptSummary=function(e){
var a=appCtxt.getById(this.getMessageId());
var t;
if(a){
AjxDispatcher.require("CalendarCore");
t=new ZmAppt();
t.setFromMessage(a)
}
return t?t.getSummary(e):this.getSummary(e)
};
ZmInvite.prototype.getSummary=function(e){
if(this.isRecurring()){
if(!this._recurBlurb){
AjxDispatcher.require("CalendarCore");
var n=new ZmRecurrence();
n.setRecurrenceRules(this.getRecurrenceRules(),this.getServerStartDate());
this._recurBlurb=n.getBlurb()
}}
var t=[];
var o=0;
if(!this._summaryHtmlLineFormatter){
this._summaryHtmlLineFormatter=new AjxMessageFormat("<tr><th align='left'>{0}</th><td>{1} {2}</td></tr>");
this._summaryTextLineFormatter=new AjxMessageFormat("{0} {1} {2}")
}
var l=e?this._summaryHtmlLineFormatter:this._summaryTextLineFormatter;
var a=[];
if(e){
t[o++]="<p>
<table border='0'>
"
}
var r=this.getOrganizerName();
if(r){
a=[ZmMsg.organizerLabel,r,""];
t[o++]=l.format(a);
t[o++]="
"
}
var h=this.getDurationText(0,false,false,true);
if(h){
a=[ZmMsg.whenLabel,h,""];
t[o++]=l.format(a);
t[o++]="
"
}
var s=this.getLocation();
if(s){
a=[ZmMsg.locationLabel,s,""];
t[o++]=l.format(a);
t[o++]="
"
}
if(this._recurBlurb){
a=[ZmMsg.repeatLabel,this._recurBlurb,""];
t[o++]=l.format(a);
t[o++]="
"
}
if(e){
t[o++]="</table>
"
}
t[o++]=e?"<div>":"
";
t[o++]=ZmItem.NOTES_SEPARATOR;
t[o++]=e?"</div><br>":"
";
return t.join("")
};
ZmInvite.prototype._addEntryRow=function(r,s,t,e,n,o,a){
if(s!=null&&s!=""){
t[e++]="<tr valign='top'><td align='right' style='padding-right: 5px;'><b><div style='white-space:nowrap'>";
t[e++]=AjxMessageFormat.format(ZmMsg.makeLabel,AjxStringUtil.htmlEncode(r));
t[e++]="</div></b></td><td align='left'><div style='white-space:";
t[e++]=n?"wrap;":"nowrap;";
if(o){
t[e++]="width:";
t[e++]=o;
t[e++]="px;"
}
t[e++]="'>";
t[e++]=a?s:AjxStringUtil.htmlEncode(s);
t[e++]="</div></td></tr>"
}
return e
};
ZmInvite.prototype.hasAcceptableComponents=function(){
for(var e in this.components){
if(this.getStatus(e)!=ZmCalendarApp.STATUS_CANC){
return true
}}
return false
};
ZmInvite.prototype.hasInviteReplyMethod=function(t){
var e=this.getInviteMethod(t);
var a=(e==ZmCalendarApp.METHOD_REQUEST||e==ZmCalendarApp.METHOD_PUBLISH);
return((e==null)||a)
};
ZmInvite.prototype.hasCounterMethod=function(e){
return(this.getInviteMethod(e)==ZmCalendarApp.METHOD_COUNTER)
};
ZmInvite.prototype.getProposedTimeStr=function(t){
var e=this.getInviteMethod(t);
if(e==ZmCalendarApp.METHOD_COUNTER){
return this.getDurationText(t,false,false,true)
}
return""
};
ZmInvite.prototype.getChanges=function(a){
var s=a||0;
var n=this.components[s]&&this.components[s].changes;
var e=n&&n.split(",");
if(e&&e.length>0){
var o={};
for(var t=0;
t<e.length;
t++){
o[e[t]]=true
}
return o
}
return null
};
ZmInvite.prototype.hasAttendeeResponse=function(){
var e=this.getAttendees();
return(e.length>0&&e[0].ptst!=ZmCalBaseItem.PSTATUS_NEEDS_ACTION)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmImAddress")){
ZmImAddress={
IM_SERVICES:[{
label:ZmMsg.zimbraTitle,value:"local"}
,{
label:ZmMsg.yahoo,value:"yahoo"}
,{
label:ZmMsg.msn,value:"msn"}
,{
label:ZmMsg.aol,value:"aol"}
,{
label:ZmMsg.other,value:"other"}
],REGEXP:[],parse:function(t){
var e=ZmImAddress.REGEXP.exec(t);
if(e){
return{
service:e[1],screenName:e[2]}
}}
,make:function(e,t){
var a=e+"://"+t;
if(ZmImAddress.parse(a)){
return a
}
return""
}
,display:function(r){
var n=ZmImAddress.parse(r);
if(n){
var e=ZmImAddress.IM_SERVICES,t=0,o;
while(o=e[t++]){
if(o.value==n.service){
break
}}
if(o){
return n.screenName+" ("+o.label+")"
}}
return r
}};
if(/^SmartZone/.test(ZmMsg.zimbraTitle)){
ZmImAddress.IM_SERVICES.splice(0,1)
}
for(var i=0;
i<ZmImAddress.IM_SERVICES.length;
++i){
ZmImAddress.REGEXP.push(ZmImAddress.IM_SERVICES.value)
}
ZmImAddress.REGEXP=new RegExp("^("+ZmImAddress.REGEXP.join("|")+")://([^\s]+)$","i")
}
if(AjxPackage.define("zimbraMail.share.model.ZmAccessControlList")){
ZmAccessControlList=function(e){
this._aces={}
};
ZmAccessControlList.prototype.toString=function(){
return"ZmAccessControlList"
};
ZmAccessControlList.prototype.load=function(a){
var t={
GetPermissionRequest:{
_jsns:"urn:zimbraMail"}};
var e=new AjxCallback(this,this._handleResponseLoad,[a]);
appCtxt.getAppController().sendRequest({
jsonObj:t,asyncMode:true,callback:e}
)
};
ZmAccessControlList.prototype._handleResponseLoad=function(n,e){
var t=e.getResponse();
var o=t.GetPermissionResponse.ace;
if(o&&o.length){
for(var a=0;
a<o.length;
a++){
this.add(ZmAccessControlEntry.createFromDom(o[a]))
}}
if(n){
n.run()
}};
ZmAccessControlList.prototype.getACLByRight=function(e){
return this._aces[e]
};
ZmAccessControlList.prototype.getGranteeType=function(m){
var t=this._aces[m];
var a=ZmSetting.ACL_PUBLIC;
var f={};
if(t&&t.length){
for(var r=0;
r<t.length;
r++){
var n=t[r];
var d=(n.granteeType==ZmSetting.ACL_USER||n.granteeType==ZmSetting.ACL_GROUP)?ZmSetting.ACL_USER:n.granteeType;
f[d]=n.negative?-1:1
}}
var u=(f[ZmSetting.ACL_PUBLIC]==1);
var o=(f[ZmSetting.ACL_PUBLIC]==-1);
var h=(f[ZmSetting.ACL_AUTH]==1);
var s=(f[ZmSetting.ACL_AUTH]==-1);
var l=(f[ZmSetting.ACL_DOMAIN]==1);
var c=(f[ZmSetting.ACL_USER]==1);
var e=(o||s)&&(f[ZmSetting.ACL_USER]==null);
if(u){
return ZmSetting.ACL_PUBLIC
}
if(h){
return ZmSetting.ACL_AUTH
}
if(o){
if(h){
return ZmSetting.ACL_AUTH
}}
if(c){
return ZmSetting.ACL_USER
}
if(l){
return ZmSetting.ACL_DOMAIN
}
if(e){
return ZmSetting.ACL_NONE
}
return a
};
ZmAccessControlList.prototype.getACLByGranteeType=function(o,e){
var a=this._aces[o];
var s=[];
if(a&&a.length){
for(var t=0;
t<a.length;
t++){
var n=a[t];
if(n.granteeType==e){
s.push(n)
}}}
s.sort();
return s
};
ZmAccessControlList.prototype.getGrantees=function(a){
var t=this._aces[a];
var n=[];
if(t&&t.length){
for(var e=0;
e<t.length;
e++){
var o=t[e];
if(o.granteeType==ZmSetting.ACL_USER||o.granteeType==ZmSetting.ACL_GROUP){
n.push(o.grantee)
}}}
n.sort();
return n
};
ZmAccessControlList.prototype.getGranteesInfo=function(a){
var t=this._aces[a];
var n=[];
if(t&&t.length){
for(var e=0;
e<t.length;
e++){
var o=t[e];
if(o.granteeType==ZmSetting.ACL_USER||o.granteeType==ZmSetting.ACL_GROUP){
n.push({
grantee:o.grantee,zid:o.zid}
)
}}}
n.sort(ZmAccessControlList.sortByGrantee);
return n
};
ZmAccessControlList.prototype.grant=function(t,a,e){
this._setPerms(t,false,a,e)
};
ZmAccessControlList.prototype.revoke=function(t,a,e){
this._setPerms(t,true,a,e)
};
ZmAccessControlList.prototype._setPerms=function(e,l,h,a){
var o=l?"RevokePermissionRequest":"GrantPermissionRequest";
var s=AjxSoapDoc.create(o,"urn:zimbraMail");
for(var n=0;
n<e.length;
n++){
var t=e[n];
var r=s.set("ace");
r.setAttribute("right",t.right);
r.setAttribute("gt",t.granteeType);
if(t.grantee){
r.setAttribute("d",t.grantee)
}
if(t.zid){
r.setAttribute("zid",t.zid)
}
if(t.negative){
r.setAttribute("deny",1)
}}
var c=new AjxCallback(this,this._handleResponseSetPerms,[l,h]);
if(a){
a.addNewRequestParams(s,c)
}else{
appCtxt.getAppController().sendRequest({
soapDoc:s,asyncMode:true,callback:c}
)
}};
ZmAccessControlList.prototype._handleResponseSetPerms=function(h,r,l){
var n=l.getResponse();
var o=h?n.RevokePermissionResponse:n.GrantPermissionResponse;
var e=o&&o.ace;
var t=[];
if(e&&e.length){
for(var s=0;
s<e.length;
s++){
var a=ZmAccessControlEntry.createFromDom(e[s]);
t.push(a);
if(h){
this.remove(a)
}else{
this.update(a)
}}}
if(r){
r.run(t)
}};
ZmAccessControlList.prototype.add=function(t){
if(!t){
return
}
var e=t.right;
if(!this._aces[e]){
this._aces[e]=[]
}
this._aces[e].push(t)
};
ZmAccessControlList.prototype.remove=function(a){
if(!a){
return
}
var o=this._aces[a.right];
var t=[];
if(o&&o.length){
for(var e=0;
e<o.length;
e++){
if(o[e].grantee!=a.grantee){
t.push(o[e])
}}}
this._aces[a.right]=t
};
ZmAccessControlList.prototype.update=function(t,n){
if(!t||!t.right){
return
}
var o=false;
if(!this._aces[t.right]){
this._aces[t.right]=[]
}
var a=this._aces[t.right];
if(a.length){
for(var e=0;
e<a.length;
e++){
if((a[e].grantee==t.grantee)&&(a[e].granteeType==t.granteeType)){
this._aces[t.right][e]=t;
o=true
}}}
if(!o){
this._aces[t.right].push(t)
}};
ZmAccessControlList.prototype.cleanup=function(){
this._aces={}
};
ZmAccessControlList.sortByGrantee=function(o,e){
var n=o.grantee||"";
var t=e.grantee||"";
if(n.toLowerCase()>t.toLowerCase()){
return 1
}
if(n.toLowerCase()<t.toLowerCase()){
return -1
}
return 0
};
ZmAccessControlEntry=function(e){
this.grantee=e.grantee;
this.zid=e.zid;
this.granteeType=e.granteeType;
this.right=e.right;
this.negative=e.negative
};
ZmAccessControlEntry.prototype.toString=function(){
return"ZmAccessControlEntry"
};
ZmAccessControlEntry.createFromDom=function(e){
var t={};
t.grantee=e.d;
t.granteeType=e.gt;
t.zid=e.zid;
t.right=e.right;
t.negative=(e.deny=="1");
return new ZmAccessControlEntry(t)
}
}
if(AjxPackage.define("zimbraMail.core.ZmApp")){
ZmApp=function(a,t,e){
if(arguments.length==0){
return
}
this._name=a;
this._container=t;
this._parentController=e;
this._active=false;
this.currentSearch=null;
this._deferredFolders=[];
this._deferredFolderHash={};
this._deferredNotifications=[];
this._sessionController={};
this._sessionId={};
this._curSessionId={};
ZmApp.DROP_TARGETS[a]={};
this._defineAPI();
if(!e){
this._registerSettings()
}
this._registerOperations();
this._registerItems();
this._registerOrganizers();
if(!e){
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.ASSISTANTS={};
ZmApp.CHOOSER_SORT={};
ZmApp.DEFAULT_SORT={};
ZmApp.ENABLED_APPS={};
ZmApp.APPS=[];
ZmApp.DEFAULT_APPS=[];
ZmApp.OVERVIEW_ID="main";
ZmApp.BATCH_NOTIF_LIMIT=25;
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(n,o){
if(o.mainPkg){
ZmApp.MAIN_PKG[n]=o.mainPkg
}
if(o.nameKey){
ZmApp.NAME[n]=o.nameKey
}
if(o.icon){
ZmApp.ICON[n]=o.icon
}
if(o.textPrecedence){
ZmApp.TEXT_PRECEDENCE[n]=o.textPrecedence
}
if(o.imagePrecedence){
ZmApp.IMAGE_PRECEDENCE[n]=o.imagePrecedence
}
if(o.chooserTooltipKey){
ZmApp.CHOOSER_TOOLTIP[n]=o.chooserTooltipKey
}
if(o.viewTooltipKey){
ZmApp.VIEW_TOOLTIP[n]=o.viewTooltipKey
}
if(o.defaultSearch){
ZmApp.DEFAULT_SEARCH[n]=o.defaultSearch
}
if(o.organizer){
ZmApp.ORGANIZER[n]=o.organizer
}
if(o.overviewTrees){
ZmApp.OVERVIEW_TREES[n]=o.overviewTrees
}
if(o.hideZimlets){
ZmApp.HIDE_ZIMLETS[n]=o.hideZimlets
}
if(o.assistants){
ZmApp.ASSISTANTS[n]=o.assistants
}
if(o.searchTypes){
ZmApp.SEARCH_TYPES[n]=o.searchTypes
}
if(o.gotoActionCode){
ZmApp.GOTO_ACTION_CODE[n]=o.gotoActionCode
}
if(o.newActionCode){
ZmApp.NEW_ACTION_CODE[n]=o.newActionCode
}
if(o.qsViews){
ZmApp.QS_VIEWS[n]=o.qsViews
}
if(o.chooserSort){
ZmApp.CHOOSER_SORT[n]=o.chooserSort
}
if(o.defaultSort){
ZmApp.DEFAULT_SORT[n]=o.defaultSort
}
if(o.trashViewOp){
ZmApp.TRASH_VIEW_OP[n]=o.trashViewOp
}
if(o.upsellUrl){
ZmApp.UPSELL_URL[n]=o.upsellUrl
}
if(o.searchTypes){
ZmApp.SEARCH_TYPES_R[n]={};
for(var t=0;
t<o.searchTypes.length;
t++){
ZmApp.SEARCH_TYPES_R[n][o.searchTypes[t]]=true
}}
if(o.gotoActionCode){
ZmApp.GOTO_ACTION_CODE_R[o.gotoActionCode]=n
}
if(o.actionCodes){
for(var a in o.actionCodes){
if(!a){
continue
}
ZmApp.ACTION_CODES_R[a]=n;
ZmApp.ACTION_CODES[a]=o.actionCodes[a]
}}
var e=appCtxt.get(ZmApp.SETTING[n]);
if(o.newItemOps&&e){
for(var s in o.newItemOps){
if(!s){
continue
}
ZmApp.OPS_R[s]=n;
ZmOperation.NEW_ITEM_OPS.push(s);
ZmOperation.NEW_ITEM_KEY[s]=o.newItemOps[s]
}}
if(o.newOrgOps&&e){
for(var s in o.newOrgOps){
if(!s){
continue
}
ZmApp.OPS_R[s]=n;
ZmOperation.NEW_ORG_OPS.push(s);
ZmOperation.NEW_ORG_KEY[s]=o.newOrgOps[s]
}}
if(o.qsViews){
for(var t=0;
t<o.qsViews.length;
t++){
ZmApp.QS_VIEWS[o.qsViews[t]]=n
}}};
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(e){};
ZmApp.prototype.preNotify=function(e){};
ZmApp.prototype.deleteNotify=function(e){};
ZmApp.prototype.createNotify=function(e){};
ZmApp.prototype.modifyNotify=function(e){};
ZmApp.prototype.postNotify=function(e){};
ZmApp.prototype.refresh=function(e){};
ZmApp.prototype.handleOp=function(t,e){};
ZmApp.prototype.getName=function(){
return this._name
};
ZmApp.prototype.getDisplayName=function(){
return ZmMsg[ZmApp.NAME[this._name]]
};
ZmApp.prototype.getInitialSearchType=function(){
return null
};
ZmApp.prototype.getLimit=function(e){
return appCtxt.get(ZmSetting.PAGE_SIZE)
};
ZmApp.prototype.setAppView=function(e){
appCtxt.getAppViewMgr().setAppView(this._name,e)
};
ZmApp.prototype.createView=function(e){
e.appName=this._name;
return appCtxt.getAppViewMgr().createView(e)
};
ZmApp.prototype.pushView=function(e,t){
return appCtxt.getAppViewMgr().pushView(e,t)
};
ZmApp.prototype.popView=function(t,e,a){
return appCtxt.getAppViewMgr().popView(t,e,a)
};
ZmApp.prototype.setView=function(e,t){
return appCtxt.getAppViewMgr().setView(e,t)
};
ZmApp.prototype.stageView=function(e){
return appCtxt.getAppViewMgr().stageView(e)
};
ZmApp.prototype.addDeferredFolder=function(e){
var t=e.obj&&e.obj.id;
if(t&&!this._deferredFolderHash[t]){
this._deferredFolders.push(e);
this._deferredFolderHash[t]=true;
appCtxt.cacheSetDeferred(t,this._name)
}};
ZmApp.prototype.getRemoteFolderIds=function(r){
var s=[];
if(appCtxt.getOverviewController(true)){
var o=ZmApp.ORGANIZER[this.getName()];
if(this._deferredFolders.length){
this._createDeferredFolders(o)
}
var e=appCtxt.getFolderTree(r);
var a=e?e.getByType(o):[];
for(var t=0;
t<a.length;
t++){
var n=a[t];
if(n.isRemote()){
s.push(n.id)
}}}
return s
};
ZmApp.prototype.getOverviewPanelContent=function(){
if(!this._overviewPanelContent){
var t=this._getOverviewParams();
t.overviewId=this.getOverviewId();
var e=this._overviewPanelContent=appCtxt.getOverviewController().createOverview(t);
e.set(this._getOverviewTrees())
}
return this._overviewPanelContent
};
ZmApp.prototype.getOverviewContainer=function(a){
if(!this._overviewContainer&&!a){
var e={
appName:this._name,containerId:([ZmApp.OVERVIEW_ID,this._name].join("_")),posStyle:Dwt.ABSOLUTE_STYLE};
var t=this._getOverviewParams();
t.overviewTrees=this._getOverviewTrees();
this._overviewContainer=appCtxt.getOverviewController().createOverviewContainer(e,t)
}
return this._overviewContainer
};
ZmApp.prototype.setOverviewPanelContent=function(a){
if(a){
this._overviewPanelContent=null;
this._overviewContainer=null
}
var e=appCtxt.getAppViewMgr();
if(!e.isFullScreen()){
var t=((appCtxt.multiAccounts&&appCtxt.accountList.size()>1)||this.getName()==ZmApp.VOICE)?this.getOverviewContainer():this.getOverviewPanelContent();
e.setComponent(ZmAppViewMgr.C_TREE,t)
}};
ZmApp.prototype.getOverview=function(){
var e=appCtxt.getOverviewController();
return e&&e.getOverview(this.getOverviewId())
};
ZmApp.prototype.resetOverview=function(t){
var u=t?appCtxt.getOverviewController().getOverview(t):this.getOverview();
if(u){
var s=[];
var d=u.getTreeViews(),l=d.length;
for(var n=0;
n<l;
n++){
var h=d[n];
var e=u.getTreeView(h);
var c=e.getTreeItemList();
var o=c.length;
for(var a=0;
a<o;
a++){
var r=c[a];
if(r._expanded){
s.push(r._htmlElId)
}}}
u.clear();
u.set(this._getOverviewTrees());
l=s.length;
for(var n=0;
n<l;
n++){
var r=DwtControl.fromElementId(s[n]);
if(r&&!r._expanded){
r.setExpanded(true)
}}}};
ZmApp.prototype.getOverviewId=function(e){
return appCtxt.getOverviewId([ZmApp.OVERVIEW_ID,this._name],e)
};
ZmApp.prototype._getOverviewParams=function(){
var e=[];
for(var a in ZmOverviewController.CONTROLLER){
e.push(a)
}
var t=function(n,o){
return(ZmOrganizer.DISPLAY_ORDER[n]||9999)-(ZmOrganizer.DISPLAY_ORDER[o]||9999)
};
e.sort(t);
return{
posStyle:Dwt.ABSOLUTE_STYLE,selectionSupported:true,actionSupported:true,dndSupported:true,showUnread:true,showNewButtons:true,isAppOverview:true,treeIds:e,appName:this._name,account:appCtxt.getActiveAccount()}
};
ZmApp.prototype._getOverviewTrees=function(){
var o=ZmApp.OVERVIEW_TREES[this._name]||[];
var t=[];
for(var e=0,a=o.length;
e<a;
e++){
if((o[e]==ZmOrganizer.FOLDER&&!appCtxt.get(ZmSetting.MAIL_ENABLED))){
continue
}
t.push(o[e])
}
if(!appCtxt.multiAccounts&&window[ZmOverviewController.CONTROLLER[ZmOrganizer.ZIMLET]]&&!ZmApp.HIDE_ZIMLETS[this._name]){
t.push(ZmOrganizer.ZIMLET)
}
return t
};
ZmApp.prototype.getNumSessionControllers=function(t){
var a=this._sessionController[t]||[];
var e=0;
for(var o in a){
if(!a[o].inactive){
e++
}}
return e
};
ZmApp.prototype.getSessionController=function(type,controllerClass,sessionId){
if(!this._sessionController[type]){
this._sessionController[type]={};
this._sessionId[type]=1
}
if(sessionId&&this._sessionController[type][sessionId]){
return this._sessionController[type][sessionId]
}
var controllers=this._sessionController[type];
var controller;
for(var id in controllers){
if(controllers[id].inactive){
controller=controllers[id];
break
}}
sessionId=controller?controller.sessionId:this._sessionId[type]++;
if(!controller){
var ctlrClass=eval(controllerClass);
controller=this._sessionController[type][sessionId]=new ctlrClass(this._container,this)
}
controller.setSessionId(type,sessionId);
this._curSessionId[type]=sessionId;
controller.inactive=false;
return controller
};
ZmApp.prototype._addSettingsChangeListeners=function(){
if(!this._settingListener){
this._settingListener=new AjxListener(this,this._settingChangeListener)
}};
ZmApp.prototype._settingChangeListener=function(e){};
ZmApp.prototype.getSearchParams=function(e){
return(e||{}
)
};
ZmApp.prototype._postLoadCore=function(){
if(!appCtxt.isChildWindow){
this._setupDropTargets()
}};
ZmApp.prototype._postLoad=function(e){
if(e){
this._createDeferredFolders(e)
}
this._handleDeferredNotifications()
};
ZmApp.prototype._setupDropTargets=function(){
var a=ZmApp.DROP_TARGETS[this._name];
for(var s in a){
var t=a[s];
for(var o=0;
o<t.length;
o++){
var r=t[o];
var e=appCtxt.getOverviewController().getTreeController(r,true);
var n=ZmList.ITEM_CLASS[s]||ZmOrganizer.ORG_CLASS[s];
if(e){
e._dropTgt.addTransferType(n)
}else{
if(!ZmTreeController.DROP_SOURCES[r]){
ZmTreeController.DROP_SOURCES[r]=[]
}
ZmTreeController.DROP_SOURCES[r].push(n)
}}}};
ZmApp.prototype.disposeTreeControllers=function(){
var e=appCtxt.getOverviewController(true);
if(!e){
return
}
var a=ZmApp.DROP_TARGETS[this._name];
for(var n in a){
var t=a[n];
for(var o=0;
o<t.length;
o++){
var r=t[o];
var s=e.getTreeController(r,true);
if(!s){
continue
}
s.dispose()
}}};
ZmApp.prototype.createDeferred=function(){
var a=ZmOrganizer.APP2ORGANIZER[this._name]||[];
for(var t=0;
t<a.length;
t++){
var o=a[t];
var e=ZmOrganizer.ORG_PACKAGE[o];
AjxDispatcher.require(e);
this._createDeferredFolders(o)
}};
ZmApp.prototype._createDeferredFolders=function(t){
for(var e=0;
e<this._deferredFolders.length;
e++){
var o=this._deferredFolders[e];
var a=ZmFolderTree.createFolder(o.type,o.parent,o.obj,o.tree,o.path,o.elementType);
o.parent.children.add(a);
a.parent=o.parent;
ZmFolderTree._traverse(a,o.obj,o.tree,o.path||[])
}
this._clearDeferredFolders()
};
ZmApp.prototype._clearDeferredFolders=function(){
this._deferredFolders=[];
this._deferredFolderHash={}
};
ZmApp.prototype._deferNotifications=function(t,a){
var e=ZmApp.MAIN_PKG[this._name];
if(e&&!AjxDispatcher.loaded(e)){
this._deferredNotifications.push({
type:t,data:a}
);
return true
}else{
this._noDefer=true;
return false
}};
ZmApp.prototype._handleDeferredNotifications=function(){
var t=this._deferredNotifications;
for(var a=0;
a<t.length;
a++){
var e=t[a];
if(e.type=="delete"){
this.deleteNotify(e.data,true)
}else{
if(e.type=="create"){
this.createNotify(e.data,true)
}else{
if(e.type=="modify"){
this.modifyNotify(e.data,true)
}}}}};
ZmApp.prototype._batchNotify=function(l){
if(!(l&&l.length>=ZmApp.BATCH_NOTIF_LIMIT)){
return
}
var t={}
,c,a=false;
for(var o=0,n=l.length;
o<n;
o++){
var h=l[o];
c=appCtxt.cacheGet(h.id);
if(c){
var r=c.notifyModify(h,true);
if(r){
if(!t[r]){
t[r]=[]
}
h.item=c;
t[r].push(h);
a=true
}}}
if(!a||!c){
return
}
var s=c.list;
if(!s){
return
}
s._evt.batchMode=true;
s._evt.item=c;
s._evt.items=null;
for(var r in t){
var e={
notifs:t[r]};
s._notify(r,e)
}};
ZmApp.prototype._inNewWindow=function(t){
var e=appCtxt.get(ZmSetting.NEW_WINDOW_COMPOSE);
return !t?e:((!e&&t&&t.shiftKey)||(e&&t&&!t.shiftKey))
};
ZmApp.prototype._handleCreateFolder=function(e,a){
var t=appCtxt.getById(e.l);
if(t&&(ZmOrganizer.VIEW_HASH[a][e.view])){
t.notifyCreate(e,"folder");
e._handled=true
}};
ZmApp.prototype._handleCreateLink=function(t,o){
var a=appCtxt.getById(t.l);
var e=t.view||"message";
if(a&&a.supportsSharing()&&(ZmOrganizer.VIEW_HASH[o][e])){
a.notifyCreate(t,"link");
t._handled=true
}};
ZmApp.prototype.launch=function(e,t){
this.createDeferred();
if(t){
t.run()
}};
ZmApp.prototype.activate=function(e){
this._active=e;
if(e){
this.setOverviewPanelContent();
this.stopAlert()
}};
ZmApp.prototype.isActive=function(){
return this._active
};
ZmApp.prototype.reset=function(e){};
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._notifyRendered=function(){
if(!this._hasRendered){
appCtxt.getAppController().appRendered(this._name);
this._hasRendered=true
}};
ZmApp.prototype._getExternalAccount=function(){
var t;
if(appCtxt.multiAccounts){
var a=appCtxt.accountList.visibleAccounts;
for(var e=0;
e<a.length;
e++){
var o=a[e];
if(o.isMain){
continue
}
if(appCtxt.get(ZmApp.SETTING[this.name],null,o)){
t=o;
break
}}}
return t
};
ZmApp.prototype._setLaunchTime=function(e,t){
if(!window.isPerfMetric){
return
}
var o=e+"_launched";
if(!t){
t=new Date()
}
if(!document.getElementById(o)){
var a=document.createElement("DIV");
a.id=o;
a.innerHTML=t.getTime();
a.style.display="none";
document.body.appendChild(a)
}};
ZmApp.prototype._setLoadedTime=function(e,t){
if(!window.isPerfMetric){
return
}
var o=e+"_loaded";
if(!t){
t=new Date()
}
if(!document.getElementById(o)){
var a=document.createElement("DIV");
a.id=o;
a.innerHTML=t.getTime();
a.style.display="none";
document.body.appendChild(a)
}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmPopupMenu")){
ZmPopupMenu=function(a,t,n,e){
if(arguments.length==0){
return
}
var o=Dwt.getParams(arguments,ZmPopupMenu.PARAMS);
o.className=o.className?o.className:"ActionMenu";
o.style=o.style||DwtMenu.POPUP_STYLE;
DwtMenu.call(this,o);
e=e||appCtxt.getCurrentController();
if(e){
this._controller=e;
this._keyMap=ZmKeyMap.MAP_NAME_R[this._controller.getKeyMapName()]
}
this._menuItems={}
};
ZmPopupMenu.PARAMS=["parent","className","id","controller"];
ZmPopupMenu.prototype=new DwtMenu;
ZmPopupMenu.prototype.constructor=ZmPopupMenu;
ZmPopupMenu.prototype.toString=function(){
return"ZmPopupMenu"
};
ZmPopupMenu.MENU_ITEM_ID_KEY="menuItemId";
ZmPopupMenu.prototype.addSelectionListener=function(o,a,e){
var t=this._menuItems[o];
if(t){
t.addSelectionListener(a,e)
}};
ZmPopupMenu.prototype.removeSelectionListener=function(a,t){
var e=this._menuItems[a];
if(e){
e.removeSelectionListener(t)
}};
ZmPopupMenu.prototype.popup=function(t,e,o,a){
t=t?t:0;
e=(e!=null)?e:Dwt.DEFAULT;
o=(o!=null)?o:Dwt.DEFAULT;
DwtMenu.prototype.popup.call(this,t,e,o,a)
};
ZmPopupMenu.prototype.enable=function(a,e){
a=(a instanceof Array)?a:[a];
for(var t=0;
t<a.length;
t++){
if(this._menuItems[a[t]]){
this._menuItems[a[t]].setEnabled(e)
}}};
ZmPopupMenu.prototype.enableAll=function(e){
for(var t in this._menuItems){
this._menuItems[t].setEnabled(e)
}};
ZmPopupMenu.prototype.createMenuItem=function(o,a){
var e=this._menuItems[o]=new DwtMenuItem({
parent:this,style:a.style,radioGroupId:a.radioGroupId,id:a.id,index:a.index}
);
if(a.image){
e.setImage(a.image)
}
if(a.text){
e.setText(a.text)
}
if(a.shortcut){
e.setShortcut(appCtxt.getShortcutHint(this._keyMap,a.shortcut))
}
e.setEnabled(a.enabled!==false);
e.setData(ZmPopupMenu.MENU_ITEM_ID_KEY,o);
var t=e.getRowElement();
if(t&&o&&typeof o=="string"){
t.setAttribute("id","POPUP_"+o.replace(/s/g,""))
}
return e
};
ZmPopupMenu.prototype.getMenuItem=function(e){
return this._menuItems[e]
};
ZmPopupMenu.prototype.getMenuItems=function(){
return this._menuItems
};
ZmPopupMenu.prototype.createSeparator=function(){
new DwtMenuItem({
parent:this,style:DwtMenuItem.SEPARATOR_STYLE}
)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmActionMenu")){
ZmActionMenu=function(t){
var a=t.context?ZmId.getMenuId(t.context,t.menuType):null;
ZmPopupMenu.call(this,t.parent,null,a,t.controller);
var e=t.menuItems;
if(!e){
e=[ZmOperation.TAG_MENU,ZmOperation.PRINT,ZmOperation.DELETE]
}else{
if(e==ZmOperation.NONE){
e=null
}}
this.opList=ZmOperation.filterOperations(e);
this._context=t.context;
this._menuType=t.menuType;
this._menuItems=ZmOperation.createOperations(this,this.opList,t.overrides)
};
ZmActionMenu.prototype=new ZmPopupMenu;
ZmActionMenu.prototype.constructor=ZmActionMenu;
ZmActionMenu.prototype.toString=function(){
return"ZmActionMenu"
};
ZmActionMenu.prototype.createOp=function(a,t){
t.id=this._context?ZmId.getMenuItemId(this._context,a,this._menuType):null;
var e=this.createMenuItem(a,t);
e.setData(ZmOperation.KEY_ID,a);
return e
};
ZmActionMenu.prototype.addOp=function(e){
ZmOperation.addOperation(this,e,this._menuItems)
};
ZmActionMenu.prototype.removeOp=function(e){
ZmOperation.removeOperation(this,e,this._menuItems)
};
ZmActionMenu.prototype.getOp=function(e){
return this.getMenuItem(e)
};
ZmActionMenu.prototype.getTagMenu=function(){
var e=this.getMenuItem(ZmOperation.TAG_MENU);
if(e){
return e.getMenu()
}};
ZmActionMenu.prototype.getSearchMenu=function(){
var e=this.getMenuItem(ZmOperation.SEARCH_MENU);
if(e){
return e.getMenu()
}};
ZmActionMenu.prototype._menuItemId=function(e){
return e.getData(ZmOperation.KEY_ID)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmToolBar")){
ZmToolBar=function(t){
if(arguments.length==0){
return
}
t.posStyle=t.posStyle||DwtControl.ABSOLUTE_STYLE;
DwtToolBar.call(this,t);
var e=t.controller||appCtxt.getCurrentController();
if(e){
this._controller=e;
this._keyMap=ZmKeyMap.MAP_NAME_R[this._controller.getKeyMapName()]
}
this._refElementId=t.refElementId;
this._buttons={}
};
ZmToolBar.prototype=new DwtToolBar;
ZmToolBar.prototype.constructor=ZmToolBar;
ZmToolBar.prototype.toString=function(){
return"ZmToolBar"
};
ZmToolBar.prototype.addSelectionListener=function(t,a){
var e=this._buttons[t];
if(e){
e.addSelectionListener(a)
}};
ZmToolBar.prototype.removeSelectionListener=function(t,a){
var e=this._buttons[t];
if(e){
e.removeSelectionListener(a)
}};
ZmToolBar.prototype.getButton=function(e){
return this._buttons[e]
};
ZmToolBar.prototype.setData=function(t,e,a){
this._buttons[t].setData(e,a)
};
ZmToolBar.prototype.enable=function(a,e){
a=(a instanceof Array)?a:[a];
for(var t=0;
t<a.length;
t++){
if(this._buttons[a[t]]){
this._buttons[a[t]].setEnabled(e)
}}};
ZmToolBar.prototype.enableAll=function(e){
for(var t in this._buttons){
this._buttons[t].setEnabled(e)
}};
ZmToolBar.prototype.createButton=function(a,t){
var e=this._buttons[a]=this._createButton(t);
if(t.image){
e.setImage(t.image)
}
if(t.text){
e.setText(t.text)
}
if(t.tooltip){
e.setToolTipContent(ZmOperation.getToolTip(a,this._keyMap)||t.tooltip)
}
e.setEnabled(t.enabled!==false);
e.setData("_buttonId",a);
if(t.menu){
e.setMenu(t.menu,false,null,t.menuAbove)
}
return e
};
ZmToolBar.prototype.SEPARATOR_TEMPLATE="share.Widgets#ZmToolBarSeparator";
ZmToolBar.prototype._createButton=function(o,t){
var a=o.ctor||DwtToolBarButton;
var e=new a({
parent:this,style:o.style,className:t,index:o.index,id:o.id,template:o.template}
);
e.textPrecedence=o.textPrecedence;
e.imagePrecedence=o.imagePrecedence;
return e
};
ZmToolBar.prototype._buttonId=function(e){
return e.getData("_buttonId")
};
ZmToolBar.prototype._createPrecedenceList=function(){
this._precedenceList=[];
for(var o in this._buttons){
if(ZmOperation.isSep(o)){
continue
}
var e=this._buttons[o];
var a=e.textPrecedence;
if(a){
this._precedenceList.push({
id:o,type:"text",precedence:a}
)
}
var t=e.imagePrecedence;
if(t){
this._precedenceList.push({
id:o,type:"image",precedence:t}
)
}}
this._precedenceList.sort(function(s,n){
return(s.precedence>n.precedence)?1:(s.precedence<n.precedence)?-1:0
}
)
};
ZmToolBar.prototype.adjustSize=function(){
if(!this._refElementId||!this._inited){
return
}
var o=this.getHtmlElement();
if(!this._refElement){
this._refElement=document.getElementById(this._refElementId)
}
if(!o||!this._refElement){
return
}
var a=this._refElement.offsetWidth;
var t=o.firstChild?o.firstChild.offsetWidth:a;
for(var s=0;
s<this._precedenceList.length;
s++){
var e=this._precedenceList[s];
var l=this._buttons[e.id];
if(!l){
continue
}
if(e.type=="text"&&l._toggleText){
l.setText(l._toggleText);
l._toggleText=null
}else{
if(e.type=="image"&&l._toggleimage){
l.setImage(l._toggleimage);
l._toggleimage=null
}}}
t=o.firstChild?o.firstChild.offsetWidth:a;
if(a>0&&t>a){
for(var s=0;
s<this._precedenceList.length;
s++){
var e=this._precedenceList[s];
var l=this._buttons[e.id];
if(!l||!l.getVisible()){
continue
}
var c=l.getText();
var n=l.getImage();
var r=Boolean(c||l._toggleText);
var h=Boolean(n||l._toggleimage);
if(r&&h&&(t>a)){
if(e.type=="text"){
l._toggleText=c;
l.setText("")
}else{
if(e.type=="image"){
l._toggleimage=n;
l.setImage("")
}}}
t=o.firstChild?o.firstChild.offsetWidth:a
}}};
ZmToolBar.prototype.setSize=function(t,e){
var a=this.getSize();
if(t!=a.x||e!=a.y){
DwtToolBar.prototype.setSize.apply(this,arguments);
this.adjustSize()
}};
ZmToolBar.prototype._addItem=function(a,t,e){
DwtToolBar.prototype._addItem.apply(this,arguments);
this.adjustSize()
};
ZmToolBar.prototype._removeItem=function(a,t,e){
DwtToolBar.prototype._removeItem.apply(this,arguments);
this.adjustSize()
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmButtonToolBar")){
ZmButtonToolBar=function(t){
if(arguments.length==0){
return
}
t.className=t.className||"ZToolbar";
t.id=t.context?ZmId.getToolbarId(t.context,t.toolbarType):null;
ZmToolBar.call(this,t);
this._context=t.context;
this._toolbarType=t.toolbarType;
this._buttonStyle=t.buttonClassName;
var e=t.buttons;
if(!e){
e=[ZmOperation.NEW_MENU,ZmOperation.TAG_MENU,ZmOperation.PRINT,ZmOperation.DELETE]
}else{
if(e==ZmOperation.NONE){
e=null
}}
this.opList=ZmOperation.filterOperations(e);
this._buttons=ZmOperation.createOperations(this,this.opList,t.overrides);
this._createPrecedenceList();
this._inited=true
};
ZmButtonToolBar.prototype=new ZmToolBar;
ZmButtonToolBar.prototype.constructor=ZmButtonToolBar;
ZmButtonToolBar.prototype.toString=function(){
return"ZmButtonToolBar"
};
ZmButtonToolBar.prototype.createOp=function(o,a){
a.className=this._buttonStyle;
var e;
if(o==ZmOperation.TEXT){
var o;
if(this._context){
var t=this._toolbarType?[this._context,this._toolbarType].join("_"):this._context;
o=[ZmId.WIDGET,AjxStringUtil.toMixed(t,"_",true),AjxStringUtil.toMixed(o,"_")].join("")
}
a.textClassName=a.textClassName||"ZWidgetTitle";
e=new DwtText({
parent:this,className:a.textClassName,id:o}
)
}else{
a.id=this._context?ZmId.getButtonId(this._context,o,this._toolbarType):null;
a.textPrecedence=ZmOperation.getProp(o,"textPrecedence");
a.iconPrecedence=ZmOperation.getProp(o,"iconPrecedence");
e=this.createButton(o,a)
}
e.setData(ZmOperation.KEY_ID,o);
return e
};
ZmButtonToolBar.prototype.addOp=function(t,e){
if(this.getOp(t)){
return
}
ZmOperation.addOperation(this,t,this._buttons,e);
AjxUtil.arrayAdd(this.opList,t,e)
};
ZmButtonToolBar.prototype.removeOp=function(e){
ZmOperation.removeOperation(this,e,this._buttons);
AjxUtil.arrayRemove(this.opList,e)
};
ZmButtonToolBar.prototype.getOp=function(e){
return this.getButton(e)
};
ZmButtonToolBar.prototype.getTagMenu=function(){
var e=this.getButton(ZmOperation.TAG_MENU);
if(e){
return e.getMenu()
}};
ZmButtonToolBar.prototype._buttonId=function(e){
return e.getData(ZmOperation.KEY_ID)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmNavToolBar")){
ZmNavToolBar=function(t){
t.className=t.className||"ZmNavToolBar";
var e=(t.hasText!==false);
t.buttons=this._getButtons(e);
t.toolbarType=ZmId.TB_NAV;
t.posStyle=t.posStyle||DwtControl.STATIC_STYLE;
ZmButtonToolBar.call(this,t);
if(e){
this._textButton=this.getButton(ZmOperation.TEXT)
}};
ZmNavToolBar.prototype=new ZmButtonToolBar;
ZmNavToolBar.prototype.constructor=ZmNavToolBar;
ZmNavToolBar.prototype.toString=function(){
return"ZmNavToolBar"
};
ZmNavToolBar.prototype.enable=function(o,e){
ZmButtonToolBar.prototype.enable.call(this,o,e);
if(!e){
if(!(o instanceof Array)){
o=[o]
}
for(var a=0;
a<o.length;
a++){
var t=this.getButton(o[a]);
if(t){
t.setToolTipContent(null)
}}}};
ZmNavToolBar.prototype.setToolTip=function(t,a){
var e=this.getButton(t);
if(e){
e.setToolTipContent(a)
}};
ZmNavToolBar.prototype.setText=function(e){
if(!this._textButton){
return
}
this._textButton.setText(e)
};
ZmNavToolBar.prototype._getButtons=function(e){
var t=[];
t.push(ZmOperation.PAGE_BACK);
if(e){
t.push(ZmOperation.TEXT)
}
t.push(ZmOperation.PAGE_FORWARD);
return t
};
ZmNavToolBar.prototype.createOp=function(t,e){
e.textClassName="ZWidgetTitle ZmNavToolBarTitle";
return ZmButtonToolBar.prototype.createOp.apply(this,arguments)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmSearchToolBar")){
ZmSearchToolBar=function(e,a){
DwtComposite.call(this,{
parent:e,className:"ZmSearchToolbar",id:a}
);
var t={
msgKey:"searchAll",tooltipKey:"searchForAny",icon:"Globe",setting:ZmSetting.MIXED_VIEW_ENABLED,index:0,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_ANY)};
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_ANY,t);
t={
msgKey:"searchShared",tooltipKey:"searchShared",icon:"Group",setting:ZmSetting.SHARING_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_SHARED)};
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_SHARED,t);
if(appCtxt.multiAccounts){
t={
msgKey:"searchAllAccounts",icon:"Globe",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_ALL_ACCOUNTS)};
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_ALL_ACCOUNTS,t)
}
this._createHtml()
};
ZmSearchToolBar.prototype=new DwtComposite;
ZmSearchToolBar.prototype.constructor=ZmSearchToolBar;
ZmSearchToolBar.SEARCH_MENU_BUTTON=1;
ZmSearchToolBar.SEARCH_BUTTON=2;
ZmSearchToolBar.SAVE_BUTTON=3;
ZmSearchToolBar.BROWSE_BUTTON=4;
ZmSearchToolBar.MENUITEM_ID="_menuItemId";
ZmSearchToolBar.SETTING={};
ZmSearchToolBar.MENU_ITEMS=[];
ZmSearchToolBar.MSG_KEY={};
ZmSearchToolBar.TT_MSG_KEY={};
ZmSearchToolBar.ICON={};
ZmSearchToolBar.SHARE_ICON={};
ZmSearchToolBar.ID={};
ZmSearchToolBar.addMenuItem=function(t,e){
if(e.msgKey){
ZmSearchToolBar.MSG_KEY[t]=e.msgKey
}
if(e.tooltipKey){
ZmSearchToolBar.TT_MSG_KEY[t]=e.tooltipKey
}
if(e.icon){
ZmSearchToolBar.ICON[t]=e.icon
}
if(e.shareIcon){
ZmSearchToolBar.SHARE_ICON[t]=e.shareIcon
}
if(e.setting){
ZmSearchToolBar.SETTING[t]=e.setting
}
if(e.id){
ZmSearchToolBar.ID[t]=e.id
}
if(e.index==null||e.index<0||e.index>=ZmSearchToolBar.MENU_ITEMS.length){
ZmSearchToolBar.MENU_ITEMS.push(t)
}else{
ZmSearchToolBar.MENU_ITEMS.splice(e.index,0,t)
}};
ZmSearchToolBar.prototype.toString=function(){
return"ZmSearchToolBar"
};
ZmSearchToolBar.prototype.removeMenuItem=function(a){
var e=0;
while(e<ZmSearchToolBar.MENU_ITEMS.length){
if(ZmSearchToolBar.MENU_ITEMS[e]==a){
break
}
e++
}
if(e<ZmSearchToolBar.MENU_ITEMS.length){
var t=this._searchMenuButton.getMenu();
t.removeChild(t.getItemById("_menuItemId",a));
ZmSearchToolBar.MENU_ITEMS.splice(e,1);
ZmSearchToolBar.MSG_KEY[a]="";
ZmSearchToolBar.TT_MSG_KEY[a]="";
ZmSearchToolBar.ICON[a]="";
ZmSearchToolBar.SHARE_ICON[a]="";
ZmSearchToolBar.SETTING[a]="";
ZmSearchToolBar.ID[a]=""
}
this.dedupSeparators(t)
};
ZmSearchToolBar.prototype.dedupSeparators=function(o){
if(o==null){
o=this._searchMenuButton.getMenu()
}
var e=o.getItems();
var a=false;
var t=[];
for(mi in e){
if(!e[mi].__text){
if(a==true||a==null){
t.push(e[mi])
}else{
a=true
}}else{
a=false
}}
for(mi in t){
o.removeChild(t[mi])
}
if(!e[e.length-1].__text){
o.removeChild(e[e.length-1])
}};
ZmSearchToolBar.prototype.getSearchField=function(){
return this._searchField.getInputElement()
};
ZmSearchToolBar.prototype.registerCallback=function(e,t){
this._callback=new AjxCallback(t,e)
};
ZmSearchToolBar.prototype.addSelectionListener=function(t,a){
var e;
switch(t){
case ZmSearchToolBar.SEARCH_MENU_BUTTON:e=this._searchMenuButton;
break;
case ZmSearchToolBar.SEARCH_BUTTON:e=this._searchButton;
break;
case ZmSearchToolBar.SAVE_BUTTON:e=this._saveButton;
break;
case ZmSearchToolBar.BROWSE_BUTTON:e=this._browseButton;
break
}
if(e){
e.addSelectionListener(a)
}};
ZmSearchToolBar.prototype.getButton=function(e){
switch(e){
case ZmSearchToolBar.SEARCH_MENU_BUTTON:return this._searchMenuButton;
case ZmSearchToolBar.SEARCH_BUTTON:return this._searchButton;
case ZmSearchToolBar.SAVE_BUTTON:return this._saveButton;
case ZmSearchToolBar.BROWSE_BUTTON:return this._browseButton
}
return null
};
ZmSearchToolBar.prototype.getButtons=function(){
return AjxUtil.collapseList([this._searchMenuButton,this._searchButton,this._saveButton,this._browseButton,this._customSearchBtn])
};
ZmSearchToolBar.prototype.focus=function(){
if(this._searchField){
this._searchField.focus()
}};
ZmSearchToolBar.prototype.blur=function(){
if(this._searchField){
this._searchField.blur()
}};
ZmSearchToolBar.prototype.setEnabled=function(e){
if(this._searchField){
this._searchField.setEnabled(e)
}
if(this._searchMenuButton){
this._searchMenuButton.setEnabled(e)
}
if(this._searchButton){
this._searchButton.setEnabled(e)
}
if(this._saveButton){
this._saveButton.setEnabled(e)
}
if(this._browseButton){
this._browseButton.setEnabled(e)
}
if(this._customSearchBtn){
this._customSearchBtn.setEnabled(e)
}};
ZmSearchToolBar.prototype.setSearchFieldValue=function(e){
if(this._searchField&&e!=this.getSearchFieldValue()){
this._searchField.setValue(e)
}};
ZmSearchToolBar.prototype.getSearchFieldValue=function(){
return this._searchField?this._searchField.getValue():null
};
ZmSearchToolBar.prototype.createCustomSearchBtn=function(s,r,a,e){
if(!this._customSearchListener){
this._customSearchListener=new AjxListener(this,this._customSearchBtnListener)
}
var l=document.getElementById(this._htmlElId+"_customSearchButton");
if(l){
if(!this._customSearchBtn){
this._customSearchBtn=this._addButton({
tdId:"_customSearchButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_CUSTOM),lbl:r,icon:s}
);
this._customSearchBtn.setData("CustomSearchItem",[s,r,a]);
this._customSearchBtn.addSelectionListener(this._customSearchListener);
var c=document.getElementById(this._htmlElId+"_customSearchButtonSep");
if(c){
Dwt.setVisible(c,true)
}}else{
var t=this._customSearchBtn.getMenu();
var h;
var o={
parent:t,enabled:true,style:DwtMenuItem.RADIO_STYLE,radioGroupId:0,id:e};
if(!t){
var n=this._customSearchBtn.getData("CustomSearchItem");
t=new DwtMenu({
parent:this._customSearchBtn,className:"ActionMenu",id:ZmId.getMenuId(ZmId.SEARCH,ZmId.SEARCH_CUSTOM)}
);
this._customSearchBtn.setMenu(t,false,DwtMenuItem.RADIO_STYLE);
o.imageInfo=n[0];
o.text=n[1];
h=DwtMenuItem.create(o);
h.setData("CustomSearchItem",n);
h.setData(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_CUSTOM);
h.setChecked(true,true);
h.addSelectionListener(this._customSearchListener)
}
o.imageInfo=s;
o.text=r;
h=DwtMenuItem.create(o);
h.setData("CustomSearchItem",[s,r,a]);
h.addSelectionListener(this._customSearchListener)
}}else{
if(this._searchMenuCreated){
var t=this._searchMenuButton.getMenu();
this._createCustomSearchMenuItem(t,s,r,a,e)
}else{
if(!this._customSearchMenuItems){
this._customSearchMenuItems=[]
}
this._customSearchMenuItems.push({
icon:s,text:r,listener:a,id:e}
)
}}};
ZmSearchToolBar.prototype._createCustomSearchMenuItem=function(s,t,n,a,r){
var e=s.getItem(0);
var o={
parent:s,imageInfo:t,text:n,enabled:true,style:DwtMenuItem.RADIO_STYLE,radioGroupId:0,index:0,id:r};
e=DwtMenuItem.create(o);
e.setData("CustomSearchItem",[t,n,a]);
e.setData(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_CUSTOM);
e.addSelectionListener(this._customSearchListener);
if(!(e&&e.getData("CustomSearchItem"))){
e=new DwtMenuItem({
parent:s,style:DwtMenuItem.SEPARATOR_STYLE,index:1}
)
}};
ZmSearchToolBar.prototype._customSearchBtnListener=function(a){
var t=a.item;
if(!t){
return
}
var o=t.getData("CustomSearchItem");
if(this._customSearchBtn){
if(t instanceof DwtMenuItem){
if(a.detail!=DwtMenuItem.CHECKED){
return
}
this._customSearchBtn.setToolTipContent(o[1]);
this._customSearchBtn.setData("CustomSearchItem",o)
}
o[2].run(a)
}else{
this._searchMenuButton.setToolTipContent(o[1]);
var n=t.parent;
var e=n?n.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_SHARED):null;
if(e){
e.setChecked(false,true);
e.setEnabled(false)
}
this._searchMenuButton.setImage(o[0]);
this._searchMenuButton.setText(o[1])
}};
ZmSearchToolBar.prototype._createHtml=function(){
this.getHtmlElement().innerHTML=AjxTemplate.expand("share.Widgets#ZmSearchToolBar",{
id:this._htmlElId}
);
var n=this._htmlElId+"_inputField";
var t=document.getElementById(n);
if(t){
this._searchField=new DwtInputField({
parent:this,hint:ZmMsg.searchInput,inputId:ZmId.SEARCH_INPUTFIELD}
);
var o=this._searchField.getInputElement();
o.className="search_input";
this._searchField.reparentHtmlElement(n);
this._searchField.addListener(DwtEvent.ONKEYUP,new AjxListener(this,this._handleKeyUp));
this._searchField._showHint()
}
var r=this._htmlElId+"_searchMenuButton";
var a=document.getElementById(r);
if(a){
var e=appCtxt.get(ZmSetting.MAIL_ENABLED);
this._searchMenuButton=this._addButton({
tdId:"_searchMenuButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_MENU),lbl:e?ZmMsg.searchMail:ZmMsg.searchAll,icon:e?"Message":"Globe"}
);
var s=new AjxCallback(this,this._createSearchMenu);
this._searchMenuButton.setMenu(s,false,DwtMenuItem.RADIO_STYLE);
this._searchMenuButton.reparentHtmlElement(r)
}
this._searchButton=this._addButton({
tdId:"_searchButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_SEARCH),lbl:ZmMsg.search,icon:"Search",tooltip:ZmMsg.searchTooltip}
);
this._saveButton=this._addButton({
setting:ZmSetting.SAVED_SEARCHES_ENABLED,tdId:"_saveButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_SAVE),lbl:ZmMsg.save,icon:"Save",type:"toolbar",tooltip:ZmMsg.saveSearchTooltip}
);
this._browseButton=this._addButton({
setting:ZmSetting.BROWSE_ENABLED,tdId:"_advancedButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_ADVANCED),style:(DwtLabel.IMAGE_LEFT|DwtLabel.ALIGN_CENTER|DwtButton.TOGGLE_STYLE),lbl:ZmMsg.searchBuilder,icon:"SearchBuilder",type:"toolbar",tooltip:ZmMsg.openSearchBuilder}
)
};
ZmSearchToolBar.prototype._createSearchMenu=function(){
var s=new DwtMenu({
parent:this._searchMenuButton,className:"ActionMenu",id:ZmId.getMenuId(ZmId.SEARCH)}
);
var e;
if(this._customSearchMenuItems){
for(var a=0;
a<this._customSearchMenuItems.length;
a++){
var t=this._customSearchMenuItems[a];
this._createCustomSearchMenuItem(s,t.icon,t.text,t.listener)
}}
var n={
parent:s,enabled:true,radioGroupId:0};
for(var a=0;
a<ZmSearchToolBar.MENU_ITEMS.length;
a++){
var r=ZmSearchToolBar.MENU_ITEMS[a];
if(r==ZmId.SEARCH_SHARED){
if(ZmSearchToolBar.MENU_ITEMS.length<=1){
continue
}
e=new DwtMenuItem({
parent:s,style:DwtMenuItem.SEPARATOR_STYLE}
)
}
var o=ZmSearchToolBar.SETTING[r];
if(o&&!appCtxt.get(o)){
continue
}
n.style=(r==ZmId.SEARCH_SHARED||r==ZmId.SEARCH_ALL_ACCOUNTS)?DwtMenuItem.CHECK_STYLE:DwtMenuItem.RADIO_STYLE;
n.imageInfo=ZmSearchToolBar.ICON[r];
n.text=ZmMsg[ZmSearchToolBar.MSG_KEY[r]];
n.id=ZmSearchToolBar.ID[r];
e=DwtMenuItem.create(n);
e.setData(ZmSearchToolBar.MENUITEM_ID,r);
if(r==ZmId.SEARCH_ANY){
if(ZmSearchToolBar.MENU_ITEMS.length<=1){
continue
}
e=new DwtMenuItem({
parent:s,style:DwtMenuItem.SEPARATOR_STYLE}
)
}}
appCtxt.getSearchController()._addMenuListeners(s);
this._searchMenuCreated=true;
return s
};
ZmSearchToolBar.prototype._addButton=function(n){
if(n.setting&&!appCtxt.get(n.setting)){
return
}
var a;
var t=this._htmlElId+(n.tdId||n.buttonId);
var e=document.getElementById(t);
if(e){
var s={
parent:this,style:n.style,id:n.buttonId};
a=(n.type&&n.type=="toolbar")?(new DwtToolBarButton(s)):(new DwtButton(s));
var o=Dwt.getAttr(e,"hint");
this._setButtonStyle(a,o,n.lbl,n.icon);
if(n.tooltip){
a.setToolTipContent(n.tooltip)
}
a.reparentHtmlElement(t)
}
return a
};
ZmSearchToolBar.prototype._setButtonStyle=function(e,o,a,t){
if(o=="text"){
e.setText(a)
}else{
if(o=="icon"){
e.setImage(t)
}else{
e.setText(a);
e.setImage(t)
}}};
ZmSearchToolBar.prototype._handleKeyUp=function(t){
var e=DwtKeyEvent.getCharCode(t);
if(e==13){
return this._handleEnterKeyPress(t)
}
return true
};
ZmSearchToolBar.prototype._handleEnterKeyPress=function(a){
var n=this._searchMenuButton&&this._searchMenuButton.getMenu();
var t=n?n.getSelectedItem()||n.getItems()[0]:null;
var o=t&&t.getData("CustomSearchItem");
if(o){
o[2].run(a)
}else{
var e=t.getData(ZmSearchToolBar.MENUITEM_ID);
var s=this.getSearchFieldValue();
appCtxt.notifyZimlets("onKeyPressSearchField",[s]);
this._callback.run(s,e)
}
return false
};
ZmSearchToolBar.prototype.initAutocomplete=function(t){
var e={
dataClass:new ZmSearchAutocomplete(),matchValue:"matchText",delims:[" "," "],delimCodes:[3,13,32,9],separator:" ",enterCallback:new AjxCallback(this,this._handleEnterKeyPress)};
this._acList=new ZmAutocompleteListView(e);
this._acList.handle(this.getSearchField())
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmPeopleSearchToolBar")){
ZmPeopleSearchToolBar=function(e,t){
DwtComposite.call(this,{
parent:e,className:"ZmPeopleSearchToolbar",id:t,posStyle:Dwt.ABSOLUTE_STYLE}
);
this._createHtml()
};
ZmPeopleSearchToolBar.prototype=new DwtComposite;
ZmPeopleSearchToolBar.prototype.constructor=ZmPeopleSearchToolBar;
ZmPeopleSearchToolBar.prototype.toString=function(){
return"ZmPeopleSearchToolBar"
};
ZmPeopleSearchToolBar.prototype._createHtml=function(){
this.getHtmlElement().innerHTML=AjxTemplate.expand("share.Widgets#ZmPeopleSearchToolBar",{
id:this._htmlElId}
);
var a=this._htmlElId+"_inputField";
var e=document.getElementById(a);
if(e){
this._searchField=new DwtInputField({
parent:this,hint:ZmMsg.peopleSearchHint,inputId:ZmId.PEOPLE_SEARCH_INPUTFIELD}
);
var t=this._searchField.getInputElement();
Dwt.addClass(t,"people_search_input");
this._searchField.reparentHtmlElement(a);
this._searchField._showHint()
}};
ZmPeopleSearchToolBar.prototype.initAutocomplete=function(){
var e={
parent:appCtxt.getShell(),dataClass:(new ZmPeopleSearchAutocomplete()),matchValue:ZmAutocomplete.AC_VALUE_EMAIL,options:{
type:ZmAutocomplete.AC_TYPE_GAL}
,separator:"",compCallback:(new AjxCallback(this,this._acCompCallback))};
this._autocomplete=new ZmPeopleAutocompleteListView(e);
this._autocomplete.handle(this._searchField.getInputElement())
};
ZmPeopleSearchToolBar.prototype._acCompCallback=function(o,t,e){
AjxDispatcher.require(["ContactsCore","Contacts"]);
var a=new ZmContactList((new ZmSearch()),true);
a.add(e.item);
appCtxt.getApp(ZmApp.CONTACTS).getContactListController().show(a,true)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmTreeView")){
ZmTreeView=function(e){
if(arguments.length==0){
return
}
DwtTree.call(this,{
parent:e.parent,parentElement:e.parentElement,style:e.treeStyle,isCheckedByDefault:e.isCheckedByDefault,className:(e.className||"OverviewTree"),posStyle:e.posStyle,id:e.id}
);
this._headerClass=e.headerClass||"overviewHeader";
this.overviewId=e.overviewId;
this.type=e.type;
this.allowedTypes=e.allowedTypes;
this.allowedSubTypes=e.allowedSubTypes;
this._overview=appCtxt.getOverviewController().getOverview(this.overviewId);
this._dragSrc=e.dragSrc;
this._dropTgt=e.dropTgt;
this._dataTree=null;
this._treeItemHash={}
};
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(s,t,e){
if(!e){
return null
}
var n=s.getItemCount();
var o=s.getItems();
for(var a=0;
a<o.length;
a++){
if(o[a]._isSeparator){
continue
}
var h=o[a].getData(Dwt.KEY_OBJECT);
if(!h){
continue
}
var r=e(t,h);
if(r==-1){
return a
}}
return a
};
ZmTreeView.prototype=new DwtTree;
ZmTreeView.prototype.constructor=ZmTreeView;
ZmTreeView.prototype.toString=function(){
return"ZmTreeView"
};
ZmTreeView.prototype.SHARE_LINK_TEMPLATE="share.Widgets#ZmAddShareLink";
ZmTreeView.prototype.set=function(r){
this._showUnread=r.showUnread;
this._dataTree=r.dataTree;
this._newButton=r.newButton;
this.clearItems();
var c=this._dataTree.root;
var s=(appCtxt.multiAccounts&&(this.type==ZmOrganizer.SEARCH||this.type==ZmOrganizer.TAG));
var d=this._getHeaderTreeItemImage();
var t=this._headerItem=new DwtHeaderTreeItem({
parent:this,className:s?"DwtTreeItem":this._headerClass,imageInfo:d,id:ZmId.getTreeItemId(this.overviewId,null,this.type),button:s?null:r.newButton,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,selectable:(appCtxt.multiAccounts&&this.type!=ZmOrganizer.SEARCH&&this.type!=ZmOrganizer.TAG)}
);
t._isHeader=true;
var a=ZmMsg[ZmOrganizer.LABEL[this.type]];
if(a){
t.setText(a)
}
t.setData(Dwt.KEY_ID,c.id);
t.setData(Dwt.KEY_OBJECT,c);
t.setData(ZmTreeView.KEY_ID,this.overviewId);
t.setData(ZmTreeView.KEY_TYPE,this.type);
if(this._dropTgt){
t.setDropTarget(this._dropTgt)
}
this._treeItemHash[c.id]=t;
r.treeNode=t;
r.organizer=c;
this._render(r);
t.setExpanded(!r.collapsed,null,true);
if(!appCtxt.multiAccounts){
this.addSeparator()
}
var n=this._overview&&this._overview.isAppOverview;
var e=true;
var l;
if(appCtxt.multiAccounts&&r.account){
l=r.account;
e=l.isZimbraAccount&&!l.isMain
}
var f=appCtxt.get(ZmSetting.SHARING_ENABLED,null,l)&&n&&e&&(this.type==ZmOrganizer.FOLDER||this.type==ZmOrganizer.ADDRBOOK||this.type==ZmOrganizer.CALENDAR||this.type==ZmOrganizer.TASKS||this.type==ZmOrganizer.BRIEFCASE);
if(f){
var h=this._treeItemHash[c.id];
h._realizeDeferredChildren();
var m=new DwtTreeItem({
parent:h,deferred:false}
);
m.setImage("Blank_16");
m.enableSelection(false);
m.showCheckBox(false);
var o=m.getHTMLElId();
m.setText(AjxTemplate.expand(this.SHARE_LINK_TEMPLATE,o));
var u=document.getElementById(o+"_addshare_link");
u.onclick=AjxCallback.simpleClosure(this._handleAddShareLink,this,(l?l.id:null));
this._addShareLink=m
}
if(appCtxt.getSkinHint("noOverviewHeaders")||this._hideHeaderTreeItem()){
t.setVisible(false,true)
}};
ZmTreeView.prototype.getTreeItemById=function(e){
return this._treeItemHash[e]
};
ZmTreeView.prototype.getHeaderItem=function(){
return this._headerItem
};
ZmTreeView.prototype.getSelected=function(){
if(this.isCheckedStyle){
var a=[];
for(var e in this._treeItemHash){
var t=this._treeItemHash[e];
if(t&&t.getChecked()){
a.push(t.getData(Dwt.KEY_OBJECT))
}}
return a
}else{
return(this.getSelectionCount()!=1)?null:this.getSelection()[0].getData(Dwt.KEY_OBJECT)
}};
ZmTreeView.prototype.setSelected=function(e,t,o){
var a=ZmOrganizer.getSystemId((e instanceof ZmOrganizer)?e.id:e);
if(!a||!this._treeItemHash[a]){
return
}
this.setSelection(this._treeItemHash[a],t,false,o)
};
ZmTreeView.prototype._render=function(params){
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)
}
children=children1
}
children.sort(eval(ZmTreeView.COMPARE_FUNC[this.type]))
}}
var addSep=true;
var numItems=0;
var len=children.length;
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])){
var allowed=((org.nId==ZmOrganizer.ID_ROOT)&&this.allowedTypes[child.type])||((org.nId!=ZmOrganizer.ID_ROOT)&&this.allowedSubTypes[child.type]);
if(!allowed){
if(params.omitParents){
continue
}
var proxy=AjxUtil.createProxy(params);
proxy.treeNode=null;
proxy.organizer=child;
this._render(proxy);
continue
}
if(this._allowedTypes&&!this._allowedTypes[child.type]){
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.startPos=i;
params.showRemainingFoldersNode=ti;
child._showFoldersCallback=new AjxCallback(this,this._showRemainingFolders,[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._addNew=function(l,p,c,m,a){
var t;
var e=(p.type==ZmOrganizer.FOLDER)&&appCtxt.getDataSourceCollection();
var f=e&&e.getByFolderId(p.nId);
var n=(f&&f.length>0)?f[0]:null;
if(n&&n.type==ZmAccount.TYPE_IMAP){
var h=appCtxt.isFamilyMbox?null:this._headerClass;
var u=appCtxt.isFamilyMbox?"AccountIMAP":null;
t=new DwtTreeItem({
parent:this,text:p.getName(),className:h,imageInfo:u}
);
t.enableSelection(false)
}else{
if(!l){
var d=[];
var r=p.parent;
if(r){
while((l=this.getTreeItemById(r.id))==null){
d.push(r);
r=r.parent
}}
while(r=d.pop()){
l=this.getTreeItemById(r.parent.id);
l=new DwtTreeItem({
parent:l,text:r.getName(),imageInfo:r.getIconWithColor(),forceNotifySelection:true,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,id:ZmId.getTreeItemId(this.overviewId,r.id)}
);
l.setData(Dwt.KEY_ID,r.id);
l.setData(Dwt.KEY_OBJECT,r);
l.setData(ZmTreeView.KEY_ID,this.overviewId);
l.setData(ZmTreeView.KEY_TYPE,r.type);
this._treeItemHash[r.id]=l
}}
if(this._addShareLink&&this._addShareLink.parent==l){
var o=l.getChildIndex(this._addShareLink);
if(o>=0&&(!c||c>o)){
c=o
}}
var s={
parent:l,index:c,text:p.getName(this._showUnread),dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,imageInfo:p.getIconWithColor(),id:ZmId.getTreeItemId(this.overviewId,p.id)};
t=new DwtTreeItem(s)
}
if(appCtxt.multiAccounts&&(p.type==ZmOrganizer.SEARCH||p.type==ZmOrganizer.TAG)){
t.addClassName("DwtTreeItemChildDiv")
}
t.setDndText(p.getName());
t.setData(Dwt.KEY_ID,p.id);
t.setData(Dwt.KEY_OBJECT,p);
t.setData(ZmTreeView.KEY_ID,this.overviewId);
t.setData(ZmTreeView.KEY_TYPE,p.type);
if(!m){
var g=p.getToolTip();
if(g){
t.setToolTipContent(g)
}}
if(this._dragSrc){
t.setDragSource(this._dragSrc)
}
if(this._dropTgt){
t.setDropTarget(this._dropTgt)
}
this._treeItemHash[p.id]=t;
if(ZmTreeView.ADD_SEP[p.nId]){
l.addSeparator()
}
if(p.children&&p.children.size()){
this._render({
treeNode:t,organizer:p,omit:a}
)
}
if(n&&n.type==ZmAccount.TYPE_IMAP){
t.setExpanded(!appCtxt.get(ZmSetting.COLLAPSE_IMAP_TREES))
}
return t
};
ZmTreeView.prototype.getNextData=function(t){
var r=this.getTreeItemById(t);
if(!r||!r.parent){
return null
}
while(r&&r.parent){
var o=r.parent;
if(!(o instanceof DwtTreeItem)){
return null
}
var e=o.getItems();
var l=null;
if(e&&e.length>1){
for(var n=0;
n<e.length;
n++){
var s=e[n];
if(s==r){
var h=this.findNext(r,e,n);
if(h){
return h
}
var a=this.findPrev(r,e,n);
if(a){
return a
}}}}
r=r.parent
}
return null
};
ZmTreeView.prototype.findNext=function(n,o,t){
for(var e=t+1;
e<o.length;
e++){
var a=o[e];
if(a&&a.getData){
return a.getData(Dwt.KEY_OBJECT)
}}
return null
};
ZmTreeView.prototype.findPrev=function(n,o,t){
for(var e=t-1;
e>=0;
e--){
var a=o[e];
if(a&&a.getData){
return a.getData(Dwt.KEY_OBJECT)
}}
return null
};
ZmTreeView.prototype._showRemainingFolders=function(e){
if(e.showRemainingFoldersNode){
e.showRemainingFoldersNode.dispose()
}
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){
this._render(e);
if(e.len){
var t=ZmMsg[ZmOrganizer.LABEL[this.type]].toLowerCase();
appCtxt.setStatusMsg(AjxMessageFormat.format(ZmMsg.foldersShown,[e.len,t]));
e.len=0
}}
),100)
};
ZmTreeView.prototype._getNextTreeItem=function(t){
var e=DwtTree.prototype._getNextTreeItem.apply(this,arguments);
return e||(this._overview&&this._overview._getNextTreeItem(t,this))
};
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.NOTEBOOK||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
};
ZmTreeView.prototype._handleAddShareLink=function(t,e){
if(appCtxt.multiAccounts&&t){
var n=appCtxt.accountList.getAccount(t);
if(n&&n.isZimbraAccount){
appCtxt.accountList.setActiveAccount(n)
}}
try{
var a=appCtxt.getShareSearchDialog();
var o=new AjxCallback(this,this._handleAddShare);
a.popup(this.type,o)
}
finally{
return false
}};
ZmTreeView.prototype._handleAddShare=function(){
var o=appCtxt.getShareSearchDialog();
var a=o.getShares();
o.popdown();
if(a.length==0){
return
}
AjxDispatcher.require("Share");
var h=[];
for(var t=0;
t<a.length;
t++){
var s=a[t];
var e=s.folderPath.substr(1).replace(///g," ");
var n=(s.normalizedOwnerName.indexOf("@")>1)?s.normalizedOwnerName.substr(0,s.normalizedOwnerName.indexOf("@")):s.normalizedOwnerName;
h.push({
_jsns:"urn:zimbraMail",link:{
l:ZmOrganizer.ID_ROOT,name:ZmShare.getDefaultMountpointName(n,e),view:s.view,zid:s.ownerId,rid:s.folderId}}
);
var r={
jsonObj:{
BatchRequest:{
_jsns:"urn:zimbra",CreateMountpointRequest:h}}
,asyncMode:true,callback:new AjxCallback(this,this._handleAddShareResponse),errorCallback:new AjxCallback(this,this._handleAddShareError)};
appCtxt.getAppController().sendRequest(r)
}};
ZmTreeView.prototype._handleAddShareResponse=function(e){};
ZmTreeView.prototype._handleAddShareError=function(e){}
}
if(AjxPackage.define("zimbraMail.share.view.ZmTagMenu")){
ZmTagMenu=function(t,e){
ZmPopupMenu.call(this,t,null,t.getHTMLElId()+"|MENU",e);
t.setMenu(this);
this._addHash={};
this._removeHash={};
this._evtMgr=new AjxEventMgr();
this._desiredState=true;
this._items=null;
this._dirty=true;
if(t instanceof DwtMenuItem){
t.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(e){
this._evtMgr.addListener(DwtEvent.SELECTION,e)
};
ZmTagMenu.prototype.removeSelectionListener=function(e){
this._evtMgr.removeListener(DwtEvent.SELECTION,e)
};
ZmTagMenu.prototype.setEnabled=function(e){
this._desiredState=e;
if(e&&!this._tagList){
return
}
this.parent.setEnabled(e)
};
ZmTagMenu.prototype.set=function(e,t){
this._tagList=t;
this._items=e;
this._dirty=true;
this.parent.setEnabled(true);
if(this.parent instanceof DwtMenuItem){
this.parent.setHoverDelay(ZmTagMenu._HOVER_TIME)
}};
ZmTagMenu.prototype._doPopup=function(t,n,a){
if(this._dirty){
this.removeChildren();
if(this._tagList){
var o=this._tagList.root;
var e=this._getAddRemove(this._items,o);
this._render(o,e)
}
this._dirty=false;
if(this.parent instanceof DwtMenuItem){
this.parent.setHoverDelay(0)
}}
ZmPopupMenu.prototype._doPopup.call(this,t,n,a)
};
ZmTagMenu.prototype._getAddRemove=function(s,h){
var r={};
for(var n=0;
n<s.length;
n++){
var d=s[n];
if(!d){
continue
}
if(d.tags&&d.tags.length){
for(var t=0;
t<d.tags.length;
t++){
var e=d.tags[t];
r[e]=r[e]?r[e]+1:1
}}}
var c={};
var o={};
var l=h.children.getArray();
for(var n=0;
n<l.length;
n++){
var e=l[n].nId;
if(!r[e]||(r[e]<s.length)){
c[e]=true
}}
for(var e in r){
o[e]=true
}
return{
add:c,remove:o}
};
ZmTagMenu.prototype._render=function(h,l){
var r=h.size();
var d=h.children.getArray();
var s=[];
for(var o=0;
o<r;
o++){
var m=d[o];
var t=m.nId;
if(l.add[t]){
this._addNewTag(this,m,true,null,this._addHash)
}
if(l.remove[t]){
s.push(t)
}}
if(this._tagList.size()){
new DwtMenuItem({
parent:this,style:DwtMenuItem.SEPARATOR_STYLE}
)
}
var c=this._menuItems[ZmTagMenu.MENU_ITEM_ADD_ID]=new DwtMenuItem({
parent:this,id:this._htmlElId+"|NEWTAG"}
);
c.setText(AjxStringUtil.htmlEncode(ZmMsg.newTag));
c.setImage("NewTag");
c.setShortcut(appCtxt.getShortcutHint(this._keyMap,ZmKeyMap.NEW_TAG));
c.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_CREATE);
c.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0);
var u=this._menuItems[ZmTagMenu.MENU_ITEM_REM_ID]=new DwtMenuItem({
parent:this,id:this._htmlElId+"|REMOVETAG"}
);
u.setEnabled(false);
u.setText(AjxStringUtil.htmlEncode(ZmMsg.removeTag));
u.setImage("DeleteTag");
if(s.length>0){
u.setEnabled(true);
var e=null;
if(s.length>1){
for(o=0;
o<s.length;
o++){
if(!e){
e=new DwtMenu({
parent:u,className:this._className}
);
u.setMenu(e)
}
var m=h.getById(s[o]);
this._addNewTag(e,m,false,null,this._removeHash)
}}else{
if(s.length==1){
var m=h.getById(s[0]);
u.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_TAGS);
u.setData(ZmTagMenu.KEY_TAG_ADDED,false);
u.setData(Dwt.KEY_OBJECT,m);
u.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0)
}}
if(s.length>1){
new DwtMenuItem({
parent:e,style:DwtMenuItem.SEPARATOR_STYLE}
);
var n=new DwtMenuItem({
parent:e}
);
n.setText(ZmMsg.allTags);
n.setImage("TagStack");
n.setShortcut(appCtxt.getShortcutHint(this._keyMap,ZmKeyMap.UNTAG));
n.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_REMOVE_ALL);
n.setData(Dwt.KEY_OBJECT,s);
n.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0)
}}};
ZmTagMenu.tagNameLength=20;
ZmTagMenu.prototype._addNewTag=function(r,o,n,t,s){
var e=new DwtMenuItem({
parent:r,index:t}
);
var a=AjxStringUtil.clipByLength(o.getName(false),ZmTagMenu.tagNameLength);
e.setText(a);
e.setImage(o.getIconWithColor());
e.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_TAGS);
e.setData(ZmTagMenu.KEY_TAG_ADDED,n);
e.setData(Dwt.KEY_OBJECT,o);
e.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0);
e.setShortcut(appCtxt.getShortcutHint(null,ZmKeyMap.TAG));
s[o.id]=e
};
ZmTagMenu.prototype._menuItemSelectionListener=function(e){
if(e.item.getData(ZmTagMenu.KEY_TAG_EVENT)){
this._evtMgr.notifyListeners(DwtEvent.SELECTION,e.item)
}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmListView")){
ZmListView=function(o){
if(arguments.length==0){
return
}
o.id=o.id||ZmId.getViewId(o.view);
DwtListView.call(this,o);
this.view=o.view;
this.type=o.type;
this._controller=o.controller;
this.setDropTarget(o.dropTgt);
this._listChangeListener=new AjxListener(this,this._changeListener);
this._tagListChangeListener=new AjxListener(this,this._tagChangeListener);
var a=appCtxt.getTagTree();
if(a){
a.addChangeListener(this._tagListChangeListener)
}
var t=appCtxt.getFolderTree();
if(t){
t.addChangeListener(new AjxListener(this,this._folderChangeListener))
}
this._handleEventType={};
this._handleEventType[this.type]=true;
this._disallowSelection={};
this._disallowSelection[ZmItem.F_FLAG]=true;
this._selectAllEnabled=false;
if(o.dropTgt){
var e={
container:this._parentEl,threshold:15,amount:5,interval:10,id:o.id};
this._dndScrollCallback=new AjxCallback(null,DwtControl._dndScrollCallback,[e]);
this._dndScrollId=o.id
}
this._isPageless=o.pageless;
if(this._isPageless){
Dwt.setHandler(this._getScrollDiv(),DwtEvent.ONSCROLL,ZmListView.handleScroll)
}
this._state={}
};
ZmListView.prototype=new DwtListView;
ZmListView.prototype.constructor=ZmListView;
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]="Icon";
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_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(n,a){
this._sortByString=this._controller._currentSearch&&this._controller._currentSearch.sortBy;
var o=appCtxt.getSettings();
if(this.view&&(o&&o.persistImplicitSortPrefs(this.view))){
appCtxt.set(ZmSetting.SORTING_PREF,this._sortByString,this.view)
}
this.setSelectionHdrCbox(false);
if(appCtxt.multiAccounts){
var s=appCtxt.getTagTree();
if(s){
s.addChangeListener(this._tagListChangeListener)
}}
if(this._isPageless){
if(this._itemsToAdd){
if(this._itemsToAdd.length){
this.addItems(this._itemsToAdd);
this._itemsToAdd=null
}}else{
var t=n;
if(n instanceof ZmList){
n.addChangeListener(this._listChangeListener);
t=n.getSubList(0,n.size())
}
DwtListView.prototype.set.call(this,t,a)
}
this._setRowHeight()
}else{
var e;
if(n instanceof ZmList){
n.addChangeListener(this._listChangeListener);
e=n.getSubList(this.offset,this.getLimit())
}else{
e=n
}
DwtListView.prototype.set.call(this,e,a)
}
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(e){
DwtListView.prototype.setUI.call(this,e);
this._resetColWidth()
};
ZmListView.prototype.getLimit=function(t){
if(this._isPageless){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
}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(u){
var f=this._getItemFromEvent(u);
if(!f||u.handled||!this._handleEventType[f.type]&&(this.type!=ZmItem.MIXED)){
return
}
if(u.event==ZmEvent.E_TAGS||u.event==ZmEvent.E_REMOVE_ALL){
this._setImage(f,ZmItem.F_TAG,f.getTagImageInfo())
}
if(u.event==ZmEvent.E_FLAGS){
var t=u.getDetail("flags");
for(var a=0;
a<t.length;
a++){
var c=t[a];
var r=f[ZmItem.FLAG_PROP[c]];
if(c==ZmItem.FLAG_FLAGGED){
this._setImage(f,ZmItem.F_FLAG,r?"FlagRed":"FlagDis")
}else{
if(c==ZmItem.FLAG_ATTACH){
this._setImage(f,ZmItem.F_ATTACHMENT,r?"Attachment":null)
}}}}
if(u.event==ZmEvent.E_DELETE||u.event==ZmEvent.E_MOVE){
var l=u.batchMode?this._getItemsFromBatchEvent(u):[f];
var d=false;
for(var o=0,s=l.length;
o<s;
o++){
var f=l[o];
var h=f.type==ZmId.ITEM_CONV?f.folders[this._folderId]:f.folderId==this._folderId;
if(h&&u.event==ZmEvent.E_MOVE){
if(this._getRowIndex(f)===null){
this.addItem(f);
d=true
}}else{
this.removeItem(f,true,u.batchMode);
var n=this.getItemList();
if(u.event!=ZmEvent.E_MOVE||!n.isCanonical){
n.remove(f)
}}}
if(d){
var e=Dwt.byId(this._currentColId);
var m=(e&&this.getItemFromElement(e))||(this._headerHash&&this._headerHash[ZmItem.F_SORTED_BY])||null;
if(m){
this._saveState({
scroll:true,selection:true,focus:true}
);
this._sortColumn(m,this._bSortAsc,new AjxCallback(this,this._restoreState))
}}
if(u.batchMode){
this._fixAlternation(0)
}
this._checkReplenishOnTimer();
this._controller._resetToolbarOperations()
}};
ZmListView.prototype._getItemFromEvent=function(a){
var t=a.item;
if(!t){
var e=a.getDetail("items");
t=(e&&e.length)?e[0]:null
}
return t
};
ZmListView.prototype._getItemsFromBatchEvent=function(n){
if(!n.batchMode){
return[]
}
var t=n.items;
if(!t){
t=[];
var s=n.getDetail("notifs");
if(s&&s.length){
for(var o=0,e=s.length;
o<e;
o++){
var a=s[o];
t.push(a.item||appCtxt.cacheGet(a.id))
}}}
return t
};
ZmListView.prototype._checkReplenishOnTimer=function(e){
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(){
var e=new AjxCallback(this,this._handleResponseCheckReplenish);
this._controller._checkReplenish(e)
};
ZmListView.prototype._handleResponseCheckReplenish=function(e){
if(this.size()==0){
this._controller._handleEmptyList(this)
}else{
this._controller._resetNavToolBarButtons(this._controller._getViewType())
}
if(!e){
this._setNextSelection()
}};
ZmListView.prototype._folderChangeListener=function(o){
if(appCtxt.getCurrentController()!=this._controller){
return
}
if(this._controller._app._checkReplenishListView==this){
return
}
var a=o.getDetail("organizers");
var t=(a&&a.length)?a[0].source;
var n=t.id;
var e=o.getDetail("fields");
if(o.event==ZmEvent.E_MODIFY){
if(!e){
return
}
if(e[ZmOrganizer.F_TOTAL]){
this._controller._resetNavToolBarButtons(this._controller._getViewType())
}}};
ZmListView.prototype._tagChangeListener=function(r){
if(r.type!=ZmEvent.S_TAG){
return
}
var t=r.getDetail("fields");
if(r.event==ZmEvent.E_MODIFY&&(t&&t[ZmOrganizer.F_COLOR])){
var n=this._getChildren();
var e=r.getDetail("organizers")[0];
for(var o=0;
o<n.length;
o++){
var s=this.getItemFromElement(n[o]);
if(s&&s.tags&&(s.tags.length==1)&&(s.tags[0]==e.id)){
this._setImage(s,ZmItem.F_TAG,s.getTagImageInfo())
}}}else{
if(r.event==ZmEvent.E_DELETE){
var n=this._getChildren();
var e=r.getDetail("organizers")[0];
for(var o=0;
o<n.length;
o++){
var s=this.getItemFromElement(n[o]);
var a=ZmOrganizer.normalizeId(e.id);
if(s&&s.tags&&s.hasTag(a)){
s.tagLocal(a,false);
this._setImage(s,ZmItem.F_TAG,s.getTagImageInfo())
}}}}};
ZmListView.prototype._getChildren=function(){
return this._parentEl.childNodes
};
ZmListView.prototype._getRowId=function(e){
return DwtId.getListViewItemId(DwtId.WIDGET_ITEM_FIELD,this._view,e?e.id:Dwt.getNextId(),ZmItem.F_ITEM_ROW)
};
ZmListView.prototype._getCellId=function(e,t){
if(t==ZmItem.F_DATE){
return this._getFieldId(e,t)
}else{
if(t==ZmItem.F_SELECTION){
return this._getFieldId(e,ZmItem.F_SELECTION_CELL)
}else{
return DwtListView.prototype._getCellId.apply(this,arguments)
}}};
ZmListView.prototype._getCellClass=function(e,t,a){
return ZmListView.FIELD_CLASS[t]
};
ZmListView.prototype._getCellContents=function(t,e,a,o,r,s){
if(o==ZmItem.F_SELECTION){
e=this._getImageHtml(t,e,"CheckboxUnchecked",this._getFieldId(a,o))
}else{
if(o==ZmItem.F_TYPE){
e=this._getImageHtml(t,e,ZmItem.ICON[a.type],this._getFieldId(a,o))
}else{
if(o==ZmItem.F_FLAG){
e=this._getImageHtml(t,e,this._getFlagIcon(a.isFlagged),this._getFieldId(a,o))
}else{
if(o==ZmItem.F_TAG){
e=this._getImageHtml(t,e,a.getTagImageInfo(),this._getFieldId(a,o))
}else{
if(o==ZmItem.F_ATTACHMENT){
e=this._getImageHtml(t,e,a.hasAttach?"Attachment":null,this._getFieldId(a,o))
}else{
if(o==ZmItem.F_DATE){
t[e++]=AjxDateUtil.computeDateStr(s.now||new Date(),a.date)
}else{
if(o==ZmItem.F_PRIORITY){
var n=null;
if(a.isHighPriority){
n="PriorityHigh_list"
}else{
if(a.isLowPriority){
n="PriorityLow_list"
}else{
n=""
}}
e=this._getImageHtml(t,e,n,this._getFieldId(a,o))
}else{
e=DwtListView.prototype._getCellContents.apply(this,arguments)
}}}}}}}
return e
};
ZmListView.prototype._getImageHtml=function(a,t,e,n){
e=e||"Blank_16";
var o=n?["id='",n,"'"].join(""):null;
a[t++]=AjxImg.getImageHtml(e,null,o);
return t
};
ZmListView.prototype._setImage=function(a,o,e){
var t=this._getElement(a,o);
if(t&&t.parentNode){
e=e||"Blank_16";
AjxImg.setImage(t.parentNode,e)
}};
ZmListView.prototype._getFragmentSpan=function(e){
return["<span class='ZmConvListFragment' id='",this._getFieldId(e,ZmItem.F_FRAGMENT),"'>",this._getFragmentHtml(e),"</span>"].join("")
};
ZmListView.prototype._getFragmentHtml=function(e){
return[" - ",AjxStringUtil.htmlEncode(e.fragment,true)].join("")
};
ZmListView.prototype._getFlagIcon=function(t,e){
return(t||e)?"FlagRed":"Blank_16"
};
ZmListView.prototype._parseId=function(t){
var e=t.split(DwtId.SEP);
if(e&&e.length){
return{
view:e[1],item:e[2],field:e[3],participant:e[4]}
}else{
return null
}};
ZmListView.prototype._mouseDownAction=function(e,t){
return !Dwt.ffScrollbarCheck(e)
};
ZmListView.prototype._mouseUpAction=function(e,t){
return !Dwt.ffScrollbarCheck(e)
};
ZmListView.prototype._getField=function(a,s){
var n=a.target.id||s.id;
if(!n){
return null
}
var o=this._data[s.id];
var t=o.type;
if(!t||t!=DwtListView.TYPE_LIST_ITEM){
return null
}
var e=this._parseId(n);
if(!e||!e.field){
return null
}
return e.field
};
ZmListView.prototype._mouseOutAction=function(t,o){
DwtListView.prototype._mouseOutAction.call(this,t,o);
var a=this._getField(t,o);
if(!a){
return true
}
if(a==ZmItem.F_FLAG){
var e=this.getItemFromElement(o);
if(!e.isFlagged){
AjxImg.setImage(t.target,this._getFlagIcon(e.isFlagged,false),true)
}}
return true
};
ZmListView.prototype._mouseOverAction=function(t,o){
DwtListView.prototype._mouseOverAction.call(this,t,o);
var a=this._getField(t,o);
if(!a){
return true
}
if(a==ZmItem.F_FLAG){
var e=this.getItemFromElement(o);
if(!e.isFlagged){
AjxImg.setDisabledImage(t.target,this._getFlagIcon(e.isFlagged,true),true)
}}
return true
};
ZmListView.prototype._doubleClickAction=function(t,o){
var a=t.target.id?t.target.id:o.id;
if(!a){
return true
}
var e=this._parseId(a);
return(!(e&&(e.field==ZmItem.F_FLAG)))
};
ZmListView.prototype._itemClicked=function(o,h){
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)&&h.button==DwtMouseEvent.LEFT){
if(!h.shiftKey&&!h.ctrlKey){
var t=(h.target.id&&h.target.id.indexOf("AjxImg")==-1)?h.target.id:o.id;
var n=t?this._parseId(t):null;
if(n&&(n.field==ZmItem.F_SELECTION||n.field==ZmItem.F_SELECTION_CELL)){
if(this._selectedItems.size()==1){
var a=this._selectedItems.get(0);
var d=this.getItemFromElement(a);
var l=d?this._getFieldId(d,ZmItem.F_SELECTION):null;
var c=l?document.getElementById(l):null;
if(c&&a==o){
var s=this._getItemData(a,ZmListView.ITEM_CHECKED_ATT_NAME);
var r=s?ZmListView.UNCHECKED_CLASS:ZmListView.CHECKED_CLASS;
c.className=r;
this._setItemData(a,ZmListView.ITEM_CHECKED_ATT_NAME,!s);
if(r==ZmListView.CHECKED_CLASS){
return
}}else{
if(c&&c.className==ZmListView.UNCHECKED_CLASS){
DwtListView.prototype.deselectAll.call(this)
}}}
var e=this._selectedItems.contains(o);
this.setMultiSelection(o,e);
return
}}else{
if(h.shiftKey){
this._checkSelectedItems(false);
DwtListView.prototype._itemClicked.call(this,o,h);
this._checkSelectedItems(true);
return
}}}
DwtListView.prototype._itemClicked.call(this,o,h)
};
ZmListView.prototype._columnClicked=function(t,e){
DwtListView.prototype._columnClicked.call(this,t,e);
this._checkSelectionColumnClicked(t,e)
};
ZmListView.prototype._checkSelectionColumnClicked=function(r,n){
if(!appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
return
}
var s=this.getList();
var a=s?s.size():null;
if(a>0){
var e=this._data[r.id].index;
var o=this._headerList[e];
if(o&&(o._field==ZmItem.F_SELECTION)){
var t=DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,o._field);
var h=document.getElementById(t);
if(h){
if(h.className==ZmListView.CHECKED_CLASS){
if(n.shiftKey&&!this.allSelected){
this.selectAll(n.shiftKey)
}else{
this.deselectAll();
h.className=ZmListView.UNCHECKED_CLASS
}}else{
this.allSelected=false;
h.className=ZmListView.CHECKED_CLASS;
this.selectAll(n.shiftKey)
}}}
this._controller._resetToolbarOperations()
}};
ZmListView.prototype.handleKeyAction=function(e,t){
var a=DwtListView.prototype.handleKeyAction.call(this,e,t);
if(e==DwtKeyMap.SELECT_ALL){
this._controller._resetToolbarOperations()
}
return a
};
ZmListView.prototype.setMultiSelection=function(e,a,t){
if(t&&t.ctrlKey&&this._selectedItems.size()==1){
this._checkSelectedItems(true)
}
DwtListView.prototype.setMultiSelection.call(this,e,a);
this.setSelectionCbox(e,a);
this.setSelectionHdrCbox(this._isAllChecked());
this._controller._resetToolbarOperations()
};
ZmListView.prototype._isAllChecked=function(){
return this.getSelection().length==this.getList().size()
};
ZmListView.prototype.setSelectionCbox=function(n,o){
if(!n){
return
}
var t=n.tagName?this.getItemFromElement(n):n;
var e=t?this._getFieldId(t,ZmItem.F_SELECTION):null;
var a=e?document.getElementById(e):null;
if(a){
a.className=o?ZmListView.UNCHECKED_CLASS:ZmListView.CHECKED_CLASS;
this._setItemData(n,ZmListView.ITEM_CHECKED_ATT_NAME,!o)
}};
ZmListView.prototype.setSelectionHdrCbox=function(t){
var a=this._headerHash?this._headerHash[ZmItem.F_SELECTION]:null;
var e=a?DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,a._field):null;
var o=e?document.getElementById(e):null;
if(o){
o.className=t?ZmListView.CHECKED_CLASS:ZmListView.UNCHECKED_CLASS
}};
ZmListView.prototype.setSelectedItems=function(t,e){
DwtListView.prototype.setSelectedItems.call(this,t);
if(!e&&appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
this._checkSelectedItems(true,true)
}};
ZmListView.prototype.selectAll=function(e){
DwtListView.prototype.selectAll.apply(this,arguments);
if(this._selectAllEnabled){
var n=this._controller._activeSearch;
if(n&&n.getAttribute("more")){
var a=AjxMessageFormat.format(ZmMsg.allPageSelected,this.getList().size());
if(e){
this.allSelected=true;
a=ZmMsg.allSearchSelected
}
appCtxt.setStatusMsg(a)
}
var o=this._selectedItems.getArray();
for(var t=0;
t<o.length;
t++){
this.setSelectionCbox(o[t],false)
}}};
ZmListView.prototype.deselectAll=function(){
this.allSelected=false;
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
this._checkSelectedItems(false);
var e=DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,ZmItem.F_SELECTION);
var o=document.getElementById(e);
if(o){
o.className=ZmListView.UNCHECKED_CLASS
}
var a=this._selectedItems.getArray();
for(var t=0;
t<a.length;
t++){
this.setSelectionCbox(a[t],true)
}}
DwtListView.prototype.deselectAll.call(this)
};
ZmListView.prototype._checkSelectedItems=function(e){
var n=this.getSelection();
for(var a=0;
a<n.length;
a++){
this.setSelectionCbox(n[a],!e)
}
var o=this.getList();
var t=o&&o.size();
this.setSelectionHdrCbox(t&&n.length==t)
};
ZmListView.prototype._setNoResultsHtml=function(){
DwtListView.prototype._setNoResultsHtml.call(this);
this.setSelectionHdrCbox(false);
this._rendered=true
};
ZmListView.prototype._getSortMenu=function(o,h){
var r=new ZmPopupMenu(this);
var s=new AjxListener(this,this._colHeaderActionListener);
for(var a=0;
a<o.length;
a++){
var n=o[a];
var t=AjxMessageFormat.format(ZmMsg.arrangedBy,ZmMsg[n.msg]);
var e=r.createMenuItem(n.field,{
text:t,style:DwtMenuItem.RADIO_STYLE}
);
if(n.field==h){
e.setChecked(true,true)
}
e.setData(ZmListView.KEY_ID,n.field);
r.addSelectionListener(n.field,s)
}
return r
};
ZmListView.prototype._sortMenuListener=function(a){
var t=this._headerHash[ZmItem.F_SORTED_BY];
var e=document.getElementById(DwtId.getListViewHdrId(DwtId.WIDGET_HDR_LABEL,this._view,t._field));
if(e){
e.innerHTML=a.item.getText()
}
t._sortable=a.item.getData(ZmListView.KEY_ID);
this._sortColumn(t,this._bSortAsc)
};
ZmListView.prototype._getActionMenuForColHeader=function(o){
if(!this._colHeaderActionMenu||o){
this._colHeaderActionMenu=new ZmPopupMenu(this);
var n=new AjxListener(this,this._colHeaderActionListener);
for(var t=0;
t<this._headerList.length;
t++){
var a=this._headerList[t];
if(a._width){
var e=this._colHeaderActionMenu.createMenuItem(a._id,{
text:a._name,style:DwtMenuItem.CHECK_STYLE}
);
e.setData(ZmListView.KEY_ID,a._id);
e.setChecked(a._visible,true);
if(a._noRemove){
e.setEnabled(false)
}
this._colHeaderActionMenu.addSelectionListener(a._id,n)
}}}
return this._colHeaderActionMenu
};
ZmListView.prototype._colHeaderActionListener=function(a){
var o=a.item.getData(ZmListView.KEY_ID);
for(var t=0;
t<this._headerList.length;
t++){
var e=this._headerList[t];
if(e._id==o){
e._visible=!e._visible;
break
}}
this._relayout()
};
ZmListView.prototype.getToolTipContent=function(h){
var e=this.getTargetItemDiv(h);
if(!e){
return
}
var a=h.target.id||e.id;
if(!a){
return""
}
var n=this._data[e.id];
var r=n.type;
var d;
if(r&&r==DwtListView.TYPE_HEADER_ITEM){
var t=n.index;
var l=this._headerList[t]._field;
d=this._getHeaderToolTip(l,t)
}else{
var s=this._parseId(a);
if(s&&s.field){
var c=this.getItemFromElement(e);
var o={
field:s.field,item:c,ev:h,div:e,match:s};
d=this._getToolTip(o)
}}
return d
};
ZmListView.prototype._getHeaderToolTip=function(a,e,n){
var t=null;
var o=this._headerList[e]._sortable;
if(a==ZmItem.F_SELECTION){
t=ZmMsg.selectionColumn
}else{
if(a==ZmItem.F_FLAG){
t=ZmMsg.flagHeaderToolTip
}else{
if(a==ZmItem.F_PRIORITY){
t=ZmMsg.priority
}else{
if(a==ZmItem.F_TAG){
t=ZmMsg.tag
}else{
if(a==ZmItem.F_ATTACHMENT){
t=ZmMsg.attachmentHeaderToolTip
}else{
if(a==ZmItem.F_SUBJECT){
t=o?ZmMsg.sortBySubject:ZmMsg.subject
}else{
if(a==ZmItem.F_DATE){
if(o){
if(n){
t=(this._folderId==ZmFolder.ID_DRAFTS)?ZmMsg.sortByLastSaved:ZmMsg.sortBySent
}else{
t=ZmMsg.sortByReceived
}}else{
t=ZmMsg.date
}}else{
if(a==ZmItem.F_FROM){
t=o?n?ZmMsg.sortByTo:ZmMsg.sortByFrom:n?ZmMsg.to:ZmMsg.from
}else{
if(a==ZmItem.F_SIZE){
t=o?ZmMsg.sortBySize:ZmMsg.sizeToolTip
}else{
if(a==ZmItem.F_ACCOUNT){
t=ZmMsg.account
}else{
if(a==ZmItem.F_FOLDER){
t=ZmMsg.folder
}}}}}}}}}}}
return t
};
ZmListView.prototype._getToolTip=function(n){
var t,o=n.field,a=n.ev.target,e=n.item;
if(o==ZmItem.F_FLAG){
return null
}else{
if(o==ZmItem.F_PRIORITY){
if(e.isHighPriority){
t=ZmMsg.highPriorityTooltip
}else{
if(e.isLowPriority){
t=ZmMsg.lowPriorityTooltip
}}}else{
if(o==ZmItem.F_TAG){
t=this._getTagToolTip(e)
}else{
if(o==ZmItem.F_ATTACHMENT){}else{
if(o==ZmItem.F_DATE){
t=this._getDateToolTip(e,n.div)
}}}}}
return t
};
ZmListView.prototype._getTagToolTip=function(r){
if(!r){
return
}
var o=r.tags&&r.tags.length;
if(!o){
return
}
var a=appCtxt.multiAccounts?r.getAccount():null;
var n=appCtxt.getTagTree(a);
var l=r.tags;
var t=[];
var s=0;
for(var e=0;
e<o;
e++){
var h=n.getById(l[e]);
if(!h){
continue
}
t[s++]="<table><tr><td>";
t[s++]=AjxImg.getImageHtml(h.getIconWithColor());
t[s++]="</td><td valign='middle'>";
t[s++]=AjxStringUtil.htmlEncode(h.name);
t[s++]="</td></tr></table>"
}
return t.join("")
};
ZmListView.prototype._getAttachmentToolTip=function(e){
var t=null;
var o=e&&e.attachments?e.attachments:[];
if(o.length==1){
var a=ZmMimeTable.getInfo(o[0].ct);
t=a?a.desc:null
}else{
if(o.length>1){
t=AjxMessageFormat.format(ZmMsg.multipleAttachmentsTooltip,[o.length])
}}
return t
};
ZmListView.prototype._getDateToolTip=function(e,t){
t._dateStr=t._dateStr||this._getDateToolTipText(e.date);
return t._dateStr
};
ZmListView.prototype._getDateToolTipText=function(t,n){
if(!t){
return""
}
var e=[];
var a=0;
e[a++]=n;
var o=AjxDateFormat.getDateTimeInstance(AjxDateFormat.FULL,AjxDateFormat.MEDIUM);
e[a++]=o.format(new Date(t));
var s=AjxDateUtil.computeDateDelta(t);
if(s){
e[a++]="<br><center><span style='white-space:nowrap'>(";
e[a++]=s;
e[a++]=")</span></center>"
}
return e.join("")
};
ZmListView.prototype._setListEvent=function(o,n,t){
DwtListView.prototype._setListEvent.call(this,o,n,t);
var s=(o.target.id&&o.target.id.indexOf("AjxImg")==-1)?o.target.id:t.id;
if(!s){
return false
}
var e=this._parseId(s);
if(o.button==DwtMouseEvent.LEFT){
this._selEv.field=e?e.field:null
}else{
if(o.button==DwtMouseEvent.RIGHT){
this._actionEv.field=e?e.field:null;
if(e&&e.field){
if(e.field==ZmItem.F_PARTICIPANT){
var a=this.getItemFromElement(t);
this._actionEv.detail=a.participants?a.participants.get(e.participant):null
}}}}
return true
};
ZmListView.prototype._allowLeftSelection=function(o,n,t){
if(!(n instanceof DwtMouseEvent)){
return true
}
var r=(n.target.id&&n.target.id.indexOf("AjxImg")==-1)?n.target.id:o.id;
var s=this._data[o.id];
var a=s.type;
if(r&&a&&a==DwtListView.TYPE_LIST_ITEM){
var e=this._parseId(r);
if(e&&e.field){
return this._allowFieldSelection(e.item,e.field)
}}
return true
};
ZmListView.prototype._allowFieldSelection=function(t,e){
return(!this._disallowSelection[e])
};
ZmListView.prototype._sortColumn=function(e,t,o){
var a;
switch(e._sortable){
case ZmItem.F_FROM:a=t?ZmSearch.NAME_ASC:ZmSearch.NAME_DESC;
break;
case ZmItem.F_NAME:a=t?ZmSearch.SUBJ_ASC:ZmSearch.SUBJ_DESC;
break;
case ZmItem.F_SUBJECT:a=t?ZmSearch.SUBJ_ASC:ZmSearch.SUBJ_DESC;
break;
case ZmItem.F_DATE:a=t?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC;
break;
case ZmItem.F_SIZE:a=t?ZmSearch.SIZE_ASC:ZmSearch.SIZE_DESC;
break;
case ZmItem.F_SORTED_BY:a=t?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC;
break
}
if(a){
this._sortByString=a;
appCtxt.set(ZmSetting.SORTING_PREF,a,this.view)
}
if(o){
o.run()
}};
ZmListView.prototype._setNextSelection=function(){
if(this.firstSelIndex<0){
this.firstSelIndex=0
}
var e;
if(this._list){
e=this._list.get(this.firstSelIndex)||this._list.getLast()
}
if(e){
this.setSelection(e,false)
}};
ZmListView.prototype._relayout=function(){
DwtListView.prototype._relayout.call(this);
this._checkColumns()
};
ZmListView.prototype._checkColumns=function(){
var o=this._headerList.length;
var e=[];
for(var t=0;
t<o;
t++){
var n=this._headerList[t];
if(n&&n._field!=ZmItem.F_ACCOUNT){
e.push(n._field+(n._visible?"":"*"))
}}
var a=e.join(ZmListView.COL_JOIN);
a=(a==this._defaultCols)?"":a;
appCtxt.set(ZmSetting.LIST_VIEW_COLUMNS,a,this.view);
this._getActionMenuForColHeader(true)
};
ZmListView.handleScroll=function(e){
var t=DwtUiEvent.getTarget(e);
var a=DwtControl.findControl(t);
if(a){
a._checkItemCount()
}};
ZmListView.prototype._checkItemCount=function(){
var e=this._getItemsNeeded();
if(e){
this._controller._paginate(this._view,true,null,e)
}};
ZmListView.prototype._getItemsNeeded=function(o){
if(!o){
var e=this.getItemList();
if(!(e&&e.hasMore())||!this._list){
return 0
}}
if(!this._rendered||!this._rowHeight){
return 0
}
var t=new AjxCallback(null,AjxTimedAction.scheduleAction,[new AjxTimedAction(this,this._resetColWidth),100]);
var a={
scrollDiv:this._getScrollDiv(),rowHeight:this._rowHeight,threshold:this.getPagelessThreshold(),limit:this.getLimit(1),listSize:this._list.size(),sbCallback:t};
return ZmListView.getRowsNeeded(a)
};
ZmListView.prototype._getScrollDiv=function(){
return this._parentEl
};
ZmListView.getRowsNeeded=function(a){
var t=a.scrollDiv;
var n=t.scrollHeight,c=t.scrollTop,r=a.rowHeight;
var o=t.clientHeight||Dwt.getSize(t).y;
var s=o+(a.threshold*r);
var e=n-c;
if(e==o){
e=(a.listSize*r)-c;
if(c==0&&a.sbCallback){
a.sbCallback.run()
}}
var l=0;
if(e<s){
l=Math.max(Math.floor((s-e)/r),a.limit)
}
return l
};
ZmListView.prototype._sizeChildren=function(e){
if(DwtListView.prototype._sizeChildren.apply(this,arguments)){
this._checkItemCount()
}};
ZmListView.prototype._getItemCountType=function(){
return this.type
};
ZmListView.prototype.hasItem=function(n){
var s=(typeof n=="string")?n:n&&n.id;
if(s&&this._list){
var t=this._list.getArray();
for(var o=0,e=t.length;
o<e;
o++){
var n=t[o];
if(n&&n.id==s){
return true
}}}
return false
};
ZmListView.prototype._saveState=function(a){
var t=this._state={};
a=a||{};
if(a.selection){
t.selected=this.getSelection();
if(t.selected.length==1){
var e=this._getElFromItem(t.selected[0]);
t.singleItemChecked=this._getItemData(e,ZmListView.ITEM_CHECKED_ATT_NAME)
}}
if(a.focus){
t.focused=this.hasFocus();
t.anchorItem=this._kbAnchor&&this.getItemFromElement(this._kbAnchor)
}
if(a.scroll){
t.rowHeight=this._rowHeight;
t.scrollTop=this._listDiv.scrollTop
}};
ZmListView.prototype._restoreState=function(){
var a=this._state;
if(a.selected&&a.selected.length){
var t=a.selected.length==1&&!a.singleItemChecked;
this.setSelectedItems(a.selected,t)
}
if(a.anchorItem){
var e=this._getElFromItem(a.anchorItem);
if(e){
this._setKbFocusElement(e)
}}
if(a.focused){
this.focus()
}
if(a.rowHeight){
this._listDiv.scrollTop=a.scrollTop*(this._rowHeight/a.rowHeight)
}
this._state={}
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmAppChooser")){
ZmAppChooser=function(a){
a.className=a.className||"ZmAppChooser";
a.width=appCtxt.getSkinHint("appChooser","fullWidth")?"100%":null;
ZmToolBar.call(this,a);
Dwt.setLocation(this.getHtmlElement(),Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE);
this.setScrollStyle(Dwt.CLIP);
this._buttonListener=new AjxListener(this,this._handleButton);
var t=a.buttons;
for(var e=0;
e<t.length;
e++){
var o=t[e];
if(o==ZmAppChooser.SPACER){
this.addSpacer(ZmAppChooser.SPACER_HEIGHT)
}else{
this._createButton(o)
}}
this._createPrecedenceList();
this._inited=true
};
ZmAppChooser.prototype=new ZmToolBar;
ZmAppChooser.prototype.constructor=ZmAppChooser;
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(e){
this.addListener(DwtEvent.SELECTION,e)
};
ZmAppChooser.prototype.addButton=function(o,a){
var t={
parent:this,id:ZmId.getButtonId(ZmId.APP,o),text:a.text,image:a.image,index:a.index};
var e=new ZmAppButton(t);
e.setToolTipContent(a.tooltip);
e.textPrecedence=a.textPrecedence;
e.imagePrecedence=a.imagePrecedence;
e.setData(Dwt.KEY_ID,o);
e.addSelectionListener(this._buttonListener);
this._buttons[o]=e;
if(e.textPrecedence||e.imagePrecedence){
this._createPrecedenceList()
}
this.adjustSize();
return e
};
ZmAppChooser.prototype.removeButton=function(a){
var t=this._buttons[a];
if(t){
var e=this.__getButtonIndex(a);
t.dispose();
this._buttons[a]=null;
delete this._buttons[a];
if(e!=null){
this._removeItem(this._items[e])
}}};
ZmAppChooser.prototype.replaceButton=function(a,e,t){
if(!this._buttons[a]){
return
}
t.index=this.__getButtonIndex(a);
this.removeButton(a);
return this.addButton(e,t)
};
ZmAppChooser.prototype.getButton=function(e){
return this._buttons[e]
};
ZmAppChooser.prototype.setSelected=function(a){
var e=this._buttons[this._selectedId];
if(this._selectedId&&e){
this.__markPrevNext(this._selectedId,false);
e.setSelected(false);
e._noFocus=false
}
var t=this._buttons[a];
if(t){
t.setSelected(true);
if(t._toggleText!=null&&t._toggleText!=""){
if(e){
e._toggleText=(e._toggleText!=null&&e._toggleText!="")?e._toggleText:e.getText();
e.setText("")
}
t.setText(t._toggleText);
t._toggleText=null
}
t._noFocus=true
}
this._selectedId=a
};
ZmAppChooser.prototype._createButton=function(e){
this.addButton(e,{
text:ZmMsg[ZmApp.NAME[e]],image:ZmApp.ICON[e],tooltip:ZmMsg[ZmApp.CHOOSER_TOOLTIP[e]],textPrecedence:ZmApp.TEXT_PRECEDENCE[e],imagePrecedence:ZmApp.IMAGE_PRECEDENCE[e]}
)
};
ZmAppChooser.prototype._handleButton=function(e){
this.notifyListeners(DwtEvent.SELECTION,e)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmAppButton")){
ZmAppButton=function(e){
if(arguments.length==0){
return
}
e.style=DwtLabel.IMAGE_LEFT;
e.posStyle=DwtControl.RELATIVE_STYLE;
DwtButton.call(this,e);
this.setImage(e.image);
this.setText(e.text)
};
ZmAppButton.prototype=new DwtButton;
ZmAppButton.prototype.constructor=ZmAppButton;
ZmAppButton.prototype.toString=function(){
return"ZmAppButton"
};
ZmAppButton.prototype.TEMPLATE="share.Widgets#ZmAppChooserButton";
ZmAppButton.prototype.setSelected=function(e){
this.isSelected=e;
this.setDisplayState(e?DwtControl.SELECTED:DwtControl.NORMAL)
};
ZmAppButton.prototype.setDisplayState=function(e){
if(this.isSelected&&e!=DwtControl.SELECTED){
e=[DwtControl.SELECTED,e].join(" ")
}
DwtButton.prototype.setDisplayState.call(this,e)
};
ZmAppButton.prototype.getKeyMapName=function(){
return"ZmAppButton"
};
ZmAppButton.prototype.handleKeyAction=function(e,t){
switch(e){
case DwtKeyMap.SELECT:if(this.isListenerRegistered(DwtEvent.SELECTION)){
var a=DwtShell.selectionEvent;
a.item=this;
this.notifyListeners(DwtEvent.SELECTION,a)
}
break;
default:return false
}
return true
};
ZmAppButton.prototype._focus=function(){
this.setDisplayState(DwtControl.HOVER)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmStatusView")){
ZmStatusView=function(a,t,e,o){
DwtControl.call(this,{
parent:a,className:(t||"ZmStatus"),posStyle:e,id:o}
);
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(a){
a=Dwt.getParams(arguments,ZmStatusView.MSG_PARAMS);
if(typeof a=="string"){
a={
msg:a}
}
var e={
msg:a.msg,level:a.level||ZmStatusView.LEVEL_INFO,detail:a.detail,date:new Date(),transitions:a.transitions,toast:a.toast||this._standardToast,dismissCallback:(a.dismissCallback instanceof AjxCallback)?a.dismissCallback:null,finishCallback:(a.finishCallback instanceof AjxCallback)?a.finishCallback:null,dismissed:false};
if(a.force){
for(var t=0;
t<this._statusQueue.length;
t++){
this._statusQueue[t].dismissed=true
}}
this._statusQueue.push(e);
if(!this._toast.isPoppedUp()){
this._updateStatusMsg()
}else{
if(a.force){
this.dismissStatusMsg()
}}};
ZmStatusView.prototype.nextStatus=function(){
if(this._statusQueue.length>0){
this._updateStatusMsg();
return true
}
return false
};
ZmStatusView.prototype.dismissStatusMsg=function(t){
if(t){
for(var e=0;
e<this._statusQueue.length;
e++){
this._statusQueue[e].dismissed=true
}}
this._toast.dismiss()
};
ZmStatusView.getClass=function(e){
switch(e.level){
case ZmStatusView.LEVEL_CRITICAL:return"ZToastCrit";
case ZmStatusView.LEVEL_WARNING:return"ZToastWarn";
default:return"ZToastInfo"
}};
ZmStatusView.getImageHtml=function(e){
switch(e.level){
case ZmStatusView.LEVEL_CRITICAL:return"Critical";
case ZmStatusView.LEVEL_WARNING:return"Warning";
default:return"Success"
}};
ZmStatusView.prototype._updateStatusMsg=function(){
var e=this._statusQueue.shift();
if(!e){
return
}
if(e.dismissed){
if(e.dismissCallback){
e.dismissCallback.run()
}
this.nextStatus()
}else{
var a=ZmStatusView.getClass(e);
var t=ZmStatusView.getImageHtml(e);
this._toast=e.toast;
this._toast.popup(a,e.msg,t,null,e.transitions,e.dismissCallback,e.finishCallback)
}};
ZmToast=function(e,t){
if(arguments.length==0){
return
}
DwtComposite.call(this,{
parent:e.shell,className:"ZToast",posStyle:Dwt.ABSOLUTE_STYLE,id:t}
);
this._statusView=e;
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.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=/(ZToastCrit|ZToastWarn|ZToastInfo)/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(e,l,s,n,o,a,c){
this.__clear();
this._poppedUp=true;
this._dismissed=false;
this._dismissCallback=a;
this._finishCallback=c;
var t=this.getHtmlElement();
Dwt.delClass(t,ZmToast.LEVEL_RE,e||"ZToastInfo");
if(this._textEl){
this._textEl.innerHTML=l||""
}
if(this._iconEl){
AjxImg.setImage(this._iconEl,s,false)
}
var h=appCtxt.getSkinHint("toast","location")||n;
var r=o||appCtxt.getSkinHint("toast","transitions")||ZmToast.DEFAULT_TRANSITIONS;
r=[].concat({
type:"position",location:h}
,r,{
type:"hide"}
);
this._transitions=r;
this.transition()
};
ZmToast.prototype.popdown=function(){
this.__clear();
Dwt.setLocation(this.getHtmlElement(),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 a=this._transitions&&this._transitions.shift();
if(!a){
this._poppedUp=false;
if(!this._statusView.nextStatus()){
this.popdown()
}
return
}
var t=this._state=this._createState(a);
var e=this.getHtmlElement();
Dwt.setLocation(e,t.x,t.y);
this._funcs[a.type||"next"]()
};
ZmToast.prototype._createHtml=function(e){
var t={
id:this._htmlElId};
this._createHtmlFromTemplate(e||this.TEMPLATE,t);
Dwt.setZIndex(this.getHtmlElement(),Dwt.Z_TOAST)
};
ZmToast.prototype._createHtmlFromTemplate=function(e,t){
DwtComposite.prototype._createHtmlFromTemplate.call(this,e,t);
this._textEl=document.getElementById(t.id+"_text");
this._iconEl=document.getElementById(t.id+"_icon");
this._detailEl=document.getElementById(t.id+"_detail")
};
ZmToast.prototype._createState=function(n){
var a=AjxUtil.createProxy(n);
var o=ZmToast.DEFAULT_STATE[a.type];
for(var e in o){
if(!a[e]){
a[e]=o[e]
}}
var t=this.getHtmlElement();
switch(a.type){
case"fade-in":Dwt.setOpacity(t,0);
Dwt.setLocation(t,null,0);
a.value=a.start;
break;
case"fade-out":case"fade":Dwt.setLocation(t,null,0);
a.value=a.start;
break;
case"slide-in":case"slide-out":case"slide":Dwt.setLocation(t,null,-36);
Dwt.setOpacity(t,100);
a.value=a.start;
break
}
return a
};
ZmToast.prototype.__clear=function(){
clearTimeout(this._actionId);
clearInterval(this._actionId);
this._actionId=-1
};
ZmToast.prototype.__position=function(){
var h=this._state.location||"C";
var n="skin_container_toast";
var t=this.getHtmlElement();
var e=Dwt.byId(n)||this.shell.getHtmlElement();
var o=Dwt.getSize(e);
var l=Dwt.getSize(t);
var r=(o.x-l.x)/2;
var s=(o.y-l.y)/2;
switch(h.toUpperCase()){
case"N":s=0-l.y;
break;
case"S":s=o.y-l.y;
break;
case"E":r=o.x-l.x;
break;
case"W":r=0;
break;
case"NE":r=o.x-l.x;
s=0;
break;
case"NW":r=0;
s=0;
break;
case"SE":r=o.x-l.x;
s=o.y-l.y;
break;
case"SW":r=0;
s=o.y-l.y;
break;
case"C":default:break
}
var a=Dwt.toWindow(e);
r+=a.x;
s+=a.y;
Dwt.setLocation(t,r,s);
this._funcs.next()
};
ZmToast.prototype.__show=function(){
var e=this.getHtmlElement();
Dwt.setVisible(e,true);
Dwt.setVisibility(e,true);
this._funcs.next()
};
ZmToast.prototype.__hide=function(){
var e=this.getHtmlElement();
Dwt.setLocation(e,Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE);
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(e){
return AjxUtil.indexOf(ZmToast.DISMISSABLE_STATES,e)!=-1
};
ZmToast.prototype.dismiss=function(){
if(!this._dismissed&&this._poppedUp){
var e=(this._pauseTimer&&ZmToast.__mayDismiss(ZmToast.PAUSE))||(this._held&&ZmToast.__mayDismiss(ZmToast.HOLD));
if(e){
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(e){
if(!e){
this.transition();
this._idleTimer.kill()
}};
ZmToast.prototype.__move=function(){
this._funcs.next()
};
ZmToast.prototype.__fade=function(){
var t=this._state.value;
var o=this._state.step;
if(AjxEnv.isIE){
if(AjxEnv.isIE5_5up){
try{
var a=this.getHtmlElement();
a.style.visibility=o>0?"hidden":"visible";
var s=this._state.duration/1000;
a.style.filter="progid:DXImageTransform.Microsoft.Fade(duration="+s+",overlap=1.0)";
a.filters[0].Apply();
a.style.visibility=o>0?"visible":"hidden";
a.filters[0].Play()
}
catch(n){}}
setTimeout(this._funcs.next,0);
return
}
var r=o>0?t>=this._state.end:t<=this._state.end;
if(r){
t=this._state.end
}
var a=this.getHtmlElement();
Dwt.setOpacity(a,t);
if(r){
this.__clear();
setTimeout(this._funcs.next,0);
return
}
if(this._actionId==-1){
var s=this._state.duration;
var h=s/Math.abs(o);
this._actionId=setInterval(this._funcs.fade,h)
}
this._state.value+=o;
this._state.step*=this._state.multiplier
};
ZmToast.prototype.__slide=function(){
var o=this._state.value;
var t=this._state.step;
var n=t>0?o>=this._state.end:o<=this._state.end;
if(n){
o=this._state.end
}
var e=this.getHtmlElement();
Dwt.setLocation(e,null,o);
if(n){
this.__clear();
setTimeout(this._funcs.next,0);
return
}
if(this._actionId==-1){
var a=this._state.duration;
var s=a/Math.abs(t);
this._actionId=setInterval(this._funcs.slide,s)
}
this._state.value+=t;
this._state.step*=this._state.multiplier
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmOverviewContainer")){
ZmOverviewContainer=function(e){
if(arguments.length==0){
return
}
e.className=e.className||"ZmOverviewContainer";
e.id=e.id||ZmId.getOverviewContainerId(e.containerId);
DwtTree.call(this,e);
this.setScrollStyle(e.scroll||Dwt.SCROLL_Y);
this.containerId=e.containerId;
this._appName=e.appName;
this._controller=e.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(e){};
ZmOverviewContainer.prototype.getOverview=function(e){
return this._overview[e]
};
ZmOverviewContainer.prototype.getOverviews=function(){
return this._overview
};
ZmOverviewContainer.prototype.getHeaderItem=function(){};
ZmOverviewContainer.prototype.getSelected=function(){
var t;
for(var e in this._overview){
t=this._overview[e].getSelected();
if(t){
return t
}}};
ZmOverviewContainer.prototype.deselectAll=function(e){
DwtTree.prototype.deselectAll.call(this);
this._deselectAllTreeViews(e)
};
ZmOverviewContainer.prototype.setOverviewTrees=function(e){
for(var t in this._overview){
this._overview[t].set(e)
}};
ZmOverviewContainer.prototype.resetOperations=function(t,e){};
ZmOverviewContainer.prototype._treeViewListener=function(e){};
ZmOverviewContainer.prototype._treeListener=function(e){};
ZmOverviewContainer.prototype._initializeActionMenu=function(e){};
ZmOverviewContainer.prototype._getActionMenu=function(e){
if(this._actionMenu instanceof AjxCallback){
var t=this._actionMenu;
this._actionMenu=t.run()
}
return this._actionMenu
};
ZmOverviewContainer.prototype._createActionMenu=function(t,e,a){};
ZmOverviewContainer.prototype._actionMenuListener=function(e){};
ZmOverviewContainer.prototype._deselectAllTreeViews=function(o){
for(var a in this._overview){
var n=this._overview[a];
if(o&&o==n){
continue
}
var t=n._treeHash;
for(var e in t){
if(t[e].getSelectionCount()>0){
t[e].deselectAll();
break
}}}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmAccountOverviewContainer")){
ZmAccountOverviewContainer=function(t){
if(arguments.length==0){
return
}
ZmOverviewContainer.call(this,t);
this._vFolderTreeItemMap={};
this._settingChangeListener=new AjxListener(this,this._handleSettingChange);
var e=new AjxListener(this,this._mouseListener);
this.addListener(DwtEvent.ONMOUSEDOWN,e);
this.addListener(DwtEvent.ONMOUSEUP,e)
};
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(e){
return e&&this._headerItems[e.id]
};
ZmAccountOverviewContainer.prototype.expandAccountOnly=function(t){
if(!t){
t=appCtxt.getActiveAccount()
}
for(var e in this._headerItems){
this._headerItems[e].setExpanded((e==t.id),false,false)
}};
ZmAccountOverviewContainer.prototype.getSelected=function(){
var t=ZmOverviewContainer.prototype.getSelected.call(this);
if(!t){
t=this.getSelection()[0];
var a=t&&appCtxt.accountList.getAccount(t.getData(Dwt.KEY_ID));
var e=a&&appCtxt.getFolderTree(a);
return e&&e.root
}
return t
};
ZmAccountOverviewContainer.prototype.initialize=function(C){
var j,d;
var c=appCtxt.accountList.visibleAccounts;
var w=(appCtxt.isOffline&&this._appName==ZmApp.MAIL&&(c.length>2));
var f=w;
var n=appCtxt.accountList.mainAccount;
var W=C.omit;
for(var z=0;
z<c.length;
z++){
d=c[z];
if(appCtxt.isOffline&&d.isMain&&this._appName!=ZmApp.PREFERENCES){
continue
}
if(!d.active){
continue
}
C.omit={};
if(d.type==ZmAccount.TYPE_POP){
C.omit[ZmFolder.ID_SPAM]=true;
C.omit[ZmFolder.ID_OUTBOX]=true
}
if(C.overviewId&&!C.isAppOverview){
var y=C.overviewId.split(":")[1];
if(y&&(y=="ZmNewOrganizerDialog")){
C.omit[ZmFolder.ID_DRAFTS]=true
}}
if(this._appName==ZmApp.CALENDAR){
C.selectable=false
}
this._addAccount(C,d,f,null,"account"+z);
j=this.getHeaderItem(d);
if(j){
this._setupHeader(j,d)
}
this.updateAccountInfo(d,true,true);
f=!f
}
v=W&&W[ZmOrganizer.ID_ALL_MAILBOXES];
if(w&&!v){
var u=ZmMsg[ZmFolder.MSG_KEY[ZmOrganizer.ID_ALL_MAILBOXES]];
var s=appCtxt.get(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN)?u:this._getFolderLabel(ZmOrganizer.ID_INBOX,u);
var O={
parent:this,text:s,imageInfo:"AccountAll"};
var g=appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES);
var o=this._allMailboxesTreeHeader=new DwtTreeItem(O);
o.setData(Dwt.KEY_ID,ZmOrganizer.ID_ALL_MAILBOXES);
o.addClassName("ZmOverviewGlobalInbox");
o._initialize(0,true);
o.setVisible(g);
o.__origText=u;
if(g){
this.highlightAllMboxes()
}
var b=appCtxt.getSettings(n).getSetting(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES);
b.addChangeListener(this._settingChangeListener);
var A=ZmAccountOverviewContainer.VIRTUAL_FOLDERS;
for(var z=0;
z<A.length;
z++){
var e=A[z];
O={
parent:o,text:this._getFolderLabel(e,ZmMsg[ZmFolder.MSG_KEY[e]]),imageInfo:ZmFolder.ICON[e]};
var r=this._vFolderTreeItemMap[e]=new DwtTreeItem(O);
r.setData(Dwt.KEY_ID,e);
r.addClassName("DwtTreeItemChildDiv");
r._initialize(null,true);
r.setToolTipContent(appCtxt.accountList.getTooltipForVirtualFolder(e))
}
O={
parent:o,text:ZmMsg.globalSearches,imageInfo:"SearchFolder",selectable:false};
var x=this._searchTreeHeader=new DwtTreeItem(O);
x.addClassName("DwtTreeItemChildDiv");
x._initialize(null,true);
x.__isSearch=true;
var k=appCtxt.getById(ZmOrganizer.ID_ROOT,n);
var m=k.getByType(ZmOrganizer.SEARCH);
for(var z=0;
z<m.length;
z++){
var l=m[z];
if(l.id!=ZmOrganizer.ID_ALL_MAILBOXES&&l.isOfflineGlobalSearch){
this.addSearchFolder(l)
}}
x.setVisible(x.getItemCount()>0);
if(appCtxt.get(ZmSetting.OFFLINE_SAVED_SEARCHES_TREE_OPEN)){
x.setExpanded(true,null,true)
}
if(appCtxt.get(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN)){
o.setExpanded(true,null,true)
}}
if(appCtxt.isOffline){
var T=AjxUtil.hashCopy(C);
T.omit={};
T.selectable=true;
if(this._appName!=ZmApp.PREFERENCES){
this._addAccount(T,n,f,"ZmOverviewLocalHeader","LocalFolders");
j=this.getHeaderItem(n);
j.setExpanded(appCtxt.get(ZmSetting.ACCOUNT_TREE_OPEN,null,n));
this.updateAccountInfo(n,false,true)
}else{
var q={
parent:this,text:n.getDisplayName(),imageInfo:n.getIcon(),selectable:false};
var p=new DwtTreeItem(q);
p._initialize(null,true);
var h=appCtxt.getOverviewId(this.containerId,n);
var S=this._overview[h].getTreeView(ZmOrganizer.PREF_PAGE);
var D=S.getTreeItemById("PREF_PAGE_IMPORT_EXPORT");
S.getHeaderItem().removeChild(D);
p._addItem(D);
D.addClassName("DwtTreeItemChildDiv");
p.setExpanded(true,null,true)
}}
var v=C.omit&&C.omit[ZmOrganizer.ID_ZIMLET];
if(!appCtxt.inStartup&&!v&&appCtxt.getZimletMgr().getPanelZimlets().length==0){
v=true
}
if(!v){
AjxDispatcher.require("Zimlet")
}
if(!v&&window[ZmOverviewController.CONTROLLER[ZmOrganizer.ZIMLET]]&&this._appName!=ZmApp.PREFERENCES){
var a=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET];
var B=C.overviewId=appCtxt.getOverviewId([this.containerId,a],null);
var t={
label:ZmMsg[a],icon:"Zimlet",dataId:B,className:"ZmOverviewZimletHeader"};
C.overviewTrees=[ZmOrganizer.ZIMLET];
this._addSection(t,null,C);
var j=this._headerItems;
if(j){
j.__isZimlet=true;
j.setExpanded(appCtxt.get(ZmSetting.ZIMLET_TREE_OPEN,null,n))
}}
this._initializeActionMenu()
};
ZmAccountOverviewContainer.prototype.addSearchFolder=function(t){
if(!this._searchTreeHeader){
return
}
var a={
parent:this._searchTreeHeader,text:t.getName(),imageInfo:t.getIcon()};
var e=new DwtTreeItem(a);
e.setData(Dwt.KEY_ID,t);
e._initialize(null,true);
if(!this._searchTreeHeader.getVisible()){
this._searchTreeHeader.setVisible(true)
}};
ZmAccountOverviewContainer.prototype.updateAccountInfo=function(s,e,n){
var t=appCtxt.getApp(this._appName)&&this.getHeaderItem(s);
if(t){
if(e){
var o=(s.status==ZmZimbraAccount.STATUS_RUNNING)?("<img src='/img/animated/ImgSpinner.gif' width=16 height=16 border=0>"):(AjxImg.getImageHtml(s.getStatusIcon()));
if(t._extraCell){
t._extraCell.innerHTML=(o||"")
}
if(appCtxt.isOffline&&s.status==ZmZimbraAccount.STATUS_AUTHFAIL){
var a=appCtxt.getPasswordChangeDialog();
a.popup(s)
}}
if(n||e){
t.setToolTipContent(s.getToolTip())
}}};
ZmAccountOverviewContainer.prototype.updateLabel=function(e){
if(e.nId==ZmOrganizer.ID_INBOX){
var n=e.getAccount();
var o=this.getHeaderItem(n);
if(o&&!o.getExpanded()){
o.setText(this._getAccountHeaderLabel(n))
}}
var t=this._vFolderTreeItemMap[e.nId];
if(t){
t.setText(this._getFolderLabel(e.nId,e.name));
if(e.nId==ZmOrganizer.ID_INBOX&&!this._allMailboxesTreeHeader.getExpanded()){
var a=this._getFolderLabel(e.nId,this._allMailboxesTreeHeader.__origText);
this._allMailboxesTreeHeader.setText(a)
}}};
ZmAccountOverviewContainer.prototype.updateTooltip=function(e){
var t=this._allMailboxesTreeHeader&&this._vFolderTreeItemMap[e];
if(t){
t.setToolTipContent(appCtxt.accountList.getTooltipForVirtualFolder(e))
}};
ZmAccountOverviewContainer.prototype.resetOperations=function(a,n){
var o=a.getOp(ZmOperation.EMPTY_FOLDER);
if(n instanceof ZmSearchFolder){
a.getOp(ZmOperation.MARK_ALL_READ).setVisible(false);
o.setVisible(false);
a.getOp(this._newOp).setVisible(false);
if(appCtxt.isOffline){
a.getOp(ZmOperation.SYNC).setVisible(false)
}
a.getOp(ZmOperation.DELETE).setVisible(true);
return
}
var r=appCtxt.accountList.getAccount(n);
var t=(r||n==ZmOrganizer.ID_ALL_MAILBOXES);
a.getOp(ZmOperation.MARK_ALL_READ).setVisible(!t);
o.setVisible(false);
a.getOp(this._newOp).setVisible(t&&n!=ZmOrganizer.ID_ALL_MAILBOXES);
if(appCtxt.isOffline){
a.getOp(ZmOperation.SYNC).setVisible(t&&(!r||(r&&!r.isMain)))
}
a.getOp(ZmOperation.DELETE).setVisible(false);
if(t){
a.enable(this._newOp,true);
a.enable(ZmOperation.SYNC,(!r||(r&&!r.isMain)))
}else{
var e=false;
if(n!=ZmOrganizer.ID_OUTBOX&&n!=ZmFolder.ID_DRAFTS&&this._actionedHeaderItem.getText().indexOf("bold")!=-1){
e=true
}
a.enable(ZmOperation.MARK_ALL_READ,e);
if(n==ZmOrganizer.ID_TRASH||n==ZmOrganizer.ID_SPAM){
var s=(n==ZmOrganizer.ID_TRASH)?ZmMsg.emptyTrash:ZmMsg.emptyJunk;
o.setText(s);
o.setVisible(true);
a.enable(ZmOperation.EMPTY_FOLDER,!this._isFolderEmpty(n))
}}};
ZmAccountOverviewContainer.prototype.removeZimletSection=function(){
var e=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET];
var t=appCtxt.getOverviewId([this.containerId,e],null);
var a=this._headerItems[t];
if(a){
this.removeChild(a)
}};
ZmAccountOverviewContainer.prototype.highlightAllMboxes=function(){
this.deselectAll();
this.setSelection(this._allMailboxesTreeHeader,true)
};
ZmAccountOverviewContainer.prototype._addAccount=function(r,h,t,c,e){
r.overviewId=appCtxt.getOverviewId(this.containerId,h);
r.account=h;
var n=appCtxt.getApp(this._appName);
var a=(!n||(n&&appCtxt.get(ZmApp.SETTING[this._appName],null,h)));
if(this._appName==ZmApp.PREFERENCES||a){
var o=r.omitPerAcct?r.omitPerAcct[h.id]:r.omit;
var l,s;
if(this._appName==ZmApp.PREFERENCES&&h.isMain&&appCtxt.isOffline){
l=ZmMsg.allAccounts;
s="AccountAll"
}else{
l=h.getDisplayName();
if(!appCtxt.isFamilyMbox){
s=h.getIcon()
}}
var d={
label:l,icon:s,dataId:h.id,className:c,predictableId:e};
this._addSection(d,o,r,t)
}
var u=appCtxt.getSettings(h).getSetting(ZmSetting.QUOTA_USED);
u.addChangeListener(this._settingChangeListener)
};
ZmAccountOverviewContainer.prototype._addSection=function(h,o,n,a){
var s={
parent:this,text:h.label,imageInfo:h.icon,selectable:n.selectable,className:h.className,id:this.getHTMLElId()+"__"+(h.predictableId||h.dataId)+"__SECTION"};
var r=this._headerItems[h.dataId]=new DwtTreeItem(s);
r.setData(Dwt.KEY_ID,h.dataId);
r.setScrollStyle(Dwt.CLIP);
r._initialize(null,true,true);
r.addClassName(a?"ZmOverviewSectionHilite":"ZmOverviewSection");
n.id=ZmId.getOverviewId(n.overviewId);
n.parent=r;
n.scroll=Dwt.CLIP;
n.posStyle=Dwt.STATIC_STYLE;
var t=this._controller._overview[n.overviewId]=this._overview[n.overviewId]=new ZmOverview(n,this._controller);
r._dndScrollCallback=this._overview._dndScrollCallback,r._dndScrollId=this._overview._scrollableContainerId,r._addItem(t,null,true);
var e=n.overviewTrees||n.treeIds;
t.set(e,o)
};
ZmAccountOverviewContainer.prototype._setupHeader=function(n,o){
if(this._appName==ZmApp.PREFERENCES){
n.setExpanded(true,false,true);
n.enableSelection(false)
}else{
var a=appCtxt.get(ZmSetting.ACCOUNT_TREE_OPEN,null,o);
n.setExpanded(a);
if(!a){
n.setText(this._getAccountHeaderLabel(o))
}}
if(n._extraCell){
n._extraCell.onclick=AjxCallback.simpleClosure(this._handleStatusClick,this,o)
}
var e=this._controller.getTreeController(ZmOrganizer.FOLDER).getDropTarget();
var t=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,o);
n.setDropTarget(e);
n.setData(Dwt.KEY_OBJECT,appCtxt.getById(t))
};
ZmAccountOverviewContainer.prototype._isFolderEmpty=function(e){
var o=appCtxt.accountList.visibleAccounts;
for(var t=0;
t<o.length;
t++){
var a=appCtxt.getById(ZmOrganizer.getSystemId(e,o[t]));
if(a&&a.numTotal>0){
return false
}}
return true
};
ZmAccountOverviewContainer.prototype._syncAccount=function(e,t){
e.popdown();
t.sync()
};
ZmAccountOverviewContainer.prototype._treeViewListener=function(m){
if(m.detail!=DwtTree.ITEM_ACTIONED&&m.detail!=DwtTree.ITEM_SELECTED&&m.detail!=DwtTree.ITEM_DBL_CLICKED){
return
}
var f=this._actionedHeaderItem=m.item;
if(f&&(f.__isZimlet||f.__isSearch)){
return
}
var r=f&&f.getData(Dwt.KEY_ID);
if(m.detail==DwtTree.ITEM_ACTIONED&&appCtxt.getApp(this._appName)){
var u=this._getActionMenu(r);
if(u){
this.resetOperations(u,r);
u.popup(0,m.docX,m.docY)
}}else{
if((m.detail==DwtTree.ITEM_SELECTED)&&f){
if(this._appName==ZmApp.CALENDAR||this._appName==ZmApp.PREFERENCES){
return
}
this._deselectAllTreeViews();
if(!ZmApp.NAME[this._appName]){
return
}
if(r){
var d=appCtxt.getSearchController();
var l=appCtxt.accountList.getAccount(r);
if(l){
if(appCtxt.isOffline&&l.inNewMailMode){
l.inNewMailMode=false;
var a=appCtxt.getOverviewController()._overviewContainer;
for(var h in a){
a[h].updateAccountInfo(l,true,true)
}}
if((m.target.parentNode==m.item._extraCell)&&l.isError()){
return
}
d.searchAllAccounts=false;
appCtxt.accountList.setActiveAccount(l);
if(appCtxt.isOffline&&l.hasNotSynced()&&!l.__syncAsked){
l.__syncAsked=true;
var c=appCtxt.getYesNoMsgDialog();
c.registerCallback(DwtDialog.YES_BUTTON,this._syncAccount,this,[c,l]);
c.setMessage(ZmMsg.neverSyncedAsk,DwtMessageDialog.INFO_STYLE);
c.popup()
}
var o=ZmOrganizer.DEFAULT_FOLDER[ZmApp.ORGANIZER[this._appName]];
var t=appCtxt.getById(ZmOrganizer.getSystemId(o,l));
if(!(t instanceof ZmFolder)){
return
}
var e=(this._appName==ZmApp.TASKS)?ZmSearch.DUE_DATE_DESC:ZmSearch.DATE_DESC;
var s={
query:t.createQuery(),getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),searchFor:(ZmApp.DEFAULT_SEARCH[this._appName]),sortBy:((d.currentSearch&&t.nId==d.currentSearch.folderId)?null:e),accountName:(l&&l.name),noUpdateOverview:true}
}else{
var n=appCtxt.accountList.mainAccount;
d.resetSearchAllAccounts();
d.searchAllAccounts=true;
if(r instanceof ZmSearchFolder){
s={
searchAllAccounts:true,accountName:n.name,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),noUpdateOverview:true};
d.redoSearch(r.search,false,s);
return
}
if(r==ZmOrganizer.ID_ALL_MAILBOXES){
r=ZmFolder.ID_INBOX
}
s={
queryHint:appCtxt.accountList.generateQuery(r),folderId:null,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML,null,n),searchFor:(ZmApp.DEFAULT_SEARCH[this._appName]),sortBy:ZmSearch.DATE_DESC,accountName:n.name,noUpdateOverview:true}
}
d.search(s)
}}else{}}};
ZmAccountOverviewContainer.prototype._treeListener=function(t){
if(t.detail!=DwtTree.ITEM_COLLAPSED&&t.detail!=DwtTree.ITEM_EXPANDED){
return
}
var r=t.item;
var e=t.detail==DwtTree.ITEM_EXPANDED;
var s;
if(r){
if(r.__isSearch){
appCtxt.set(ZmSetting.OFFLINE_SAVED_SEARCHES_TREE_OPEN,e);
return
}
var a=r.getData(Dwt.KEY_ID);
if(a==ZmOrganizer.ID_ALL_MAILBOXES){
var n=AjxStringUtil.htmlEncode(r.__origText);
var o=e?n:this._getFolderLabel(ZmOrganizer.ID_INBOX,n);
r.setText(o);
appCtxt.set(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN,e);
return
}
s=r.__isZimlet?appCtxt.accountList.mainAccount:appCtxt.accountList.getAccount(a)
}
if(s&&appCtxt.getCurrentAppName()!=ZmApp.PREFERENCES){
if(!appCtxt.inStartup){
appCtxt.accountList.setActiveAccount(s);
appCtxt.set(ZmSetting.ACCOUNT_TREE_OPEN,e,null,null,null,s)
}
if(!r.__isZimlet){
var o=e?AjxStringUtil.htmlEncode(s.getDisplayName()):this._getAccountHeaderLabel(s);
r.setText(o)
}}};
ZmAccountOverviewContainer.prototype._mouseListener=function(e){
return !Dwt.ffScrollbarCheck(e)
};
ZmAccountOverviewContainer.prototype._handleSettingChange=function(a){
if(a.type!=ZmEvent.S_SETTING){
return
}
var t=a.source;
if(t.id==ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES){
var e=t.getValue();
this._allMailboxesTreeHeader.setVisible(e);
if(!e){
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(t.id==ZmSetting.QUOTA_USED){
this.updateAccountInfo(a.getDetails().account,false,true)
}}};
ZmAccountOverviewContainer.prototype._getAccountHeaderLabel=function(n,o){
var t=(this._appName==ZmApp.MAIL)?ZmOrganizer.getSystemId(ZmOrganizer.ID_INBOX,n,true):null;
var a=t&&appCtxt.getById(t);
if(a&&a.numUnread>0){
var e=AjxMessageFormat.format(ZmMsg.folderUnread,[AjxStringUtil.htmlEncode(n.getDisplayName()),a.numUnread]);
return(["<span style='font-weight:bold;'>",e,"</span>"].join(""))
}
return n.getDisplayName()
};
ZmAccountOverviewContainer.prototype._getFolderLabel=function(e,a){
var n=(e!=ZmFolder.ID_DRAFTS&&e!=ZmFolder.ID_OUTBOX);
var o=appCtxt.accountList.getItemCount(e,n);
if(o>0){
var t=AjxMessageFormat.format(ZmMsg.folderUnread,[a,o]);
return(["<span style='font-weight:bold;'>",t,"</span>"].join(""))
}
return a
};
ZmAccountOverviewContainer.prototype._initializeActionMenu=function(){
if(!this._actionMenu){
var t=ZmApp.ORGANIZER[this._appName];
this._newOp=ZmOrganizer.NEW_OP[t];
var e=[this._newOp];
if(appCtxt.isOffline){
e.push(ZmOperation.SYNC)
}
e.push(ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER,ZmOperation.DELETE);
this._actionMenu=new AjxCallback(this,this._createActionMenu,[e])
}};
ZmAccountOverviewContainer.prototype._createActionMenu=function(a){
var n=new AjxListener(this,this._actionMenuListener);
var o=new ZmActionMenu({
parent:appCtxt.getShell(),menuItems:a}
);
a=o.opList;
for(var t=0;
t<a.length;
t++){
var e=o.getItem(t);
var s=a[t];
if(s==ZmOperation.SYNC){
e.setText(ZmMsg.sendReceive)
}
o.addSelectionListener(s,n)
}
o.addPopdownListener(new AjxListener(this,this._menuPopdownActionListener));
return o
};
ZmAccountOverviewContainer.prototype._menuPopdownActionListener=function(){
this._actionedHeaderItem._setActioned(false)
};
ZmAccountOverviewContainer.prototype._actionMenuListener=function(o){
var t=o.item.getData(ZmOperation.KEY_ID);
var r=this._actionedHeaderItem.getData(Dwt.KEY_ID);
if(t==this._newOp){
var s=ZmApp.ORGANIZER[this._appName];
var e=this._controller.getTreeController(s,true);
if(e){
e._actionedOrganizer=null;
var n=appCtxt.accountList.getAccount(r);
e._actionedOrganizer=appCtxt.getFolderTree(n).root;
e._newListener(o,n)
}}else{
if(t==ZmOperation.SYNC){
if(r==ZmOrganizer.ID_ALL_MAILBOXES){
appCtxt.accountList.syncAll()
}else{
var n=appCtxt.accountList.getAccount(r);
if(n){
n.sync()
}}}else{
if(t==ZmOperation.MARK_ALL_READ){
this._doAction(r,t)
}else{
if(t==ZmOperation.EMPTY_FOLDER){
this._confirmEmptyAction(r,t)
}else{
if(t==ZmOperation.DELETE){
r._delete();
var a=this._actionedHeaderItem.parent;
a.removeChild(this._actionedHeaderItem);
a.setVisible(a.getItemCount()>0)
}}}}}};
ZmAccountOverviewContainer.prototype._confirmEmptyAction=function(a,e){
var t=appCtxt.getOkCancelMsgDialog();
t.reset();
t.registerCallback(DwtDialog.OK_BUTTON,this._emptyCallback,this,[t,a,e]);
var o=(a==ZmFolder.ID_TRASH)?ZmMsg.confirmEmptyTrashFolder:(AjxMessageFormat.format(ZmMsg.confirmEmptyFolder,ZmMsg[ZmFolder.MSG_KEY[a]]));
t.setMessage(o,DwtMessageDialog.WARNING_STYLE);
t.popup()
};
ZmAccountOverviewContainer.prototype._emptyCallback=function(a,t,e){
a.popdown();
this._doAction(t,e)
};
ZmAccountOverviewContainer.prototype._doAction=function(t,e){
var r=new ZmBatchCommand(true,appCtxt.accountList.mainAccount.name);
var n=appCtxt.accountList.visibleAccounts;
for(var a=0;
a<n.length;
a++){
var s=n[a];
if(s.isMain){
continue
}
var h=ZmOrganizer.getSystemId(t,s);
var o=appCtxt.getById(h);
if(o){
if(e==ZmOperation.MARK_ALL_READ){
o.markAllRead(r)
}else{
o.empty(null,r)
}
r.curId++
}}
r.run();
if(appCtxt.isOffline){
appCtxt.getApp(ZmApp.MAIL).clearNewMailBadge()
}};
ZmAccountOverviewContainer.prototype._handleStatusClick=function(a,t){
if(!a.isError()){
return
}else{
if(appCtxt.isOffline&&(a.status==ZmZimbraAccount.STATUS_AUTHFAIL)){
var e=appCtxt.getPasswordChangeDialog();
e.popup(a)
}else{
a.showErrorMessage()
}}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmOverview")){
ZmOverview=function(a,s){
var l=a.overviewClass?a.overviewClass:"ZmOverview";
a.id=a.id||ZmId.getOverviewId(a.overviewId);
DwtComposite.call(this,{
parent:a.parent,className:l,posStyle:a.posStyle,id:a.id}
);
this._controller=s;
this.setScrollStyle(a.scroll||Dwt.SCROLL);
this.overviewId=a.overviewId;
this.containerId=a.containerId;
this.account=a.account;
this.selectionSupported=a.selectionSupported;
this.actionSupported=a.actionSupported;
this.dndSupported=a.dndSupported;
this.headerClass=a.headerClass;
this.showUnread=a.showUnread;
this.showNewButtons=a.showNewButtons;
this.treeStyle=a.treeStyle;
this.isCheckedByDefault=a.isCheckedByDefault;
this.noTooltips=a.noTooltips;
this.isAppOverview=a.isAppOverview;
this._treeIds=[];
this._treeHash={};
this._treeParents={};
var c=document;
var o=this.getHtmlElement();
if(a.treeIds){
for(var n=0,h=a.treeIds.length;
n<h;
n++){
var t=c.createElement("DIV");
var r=a.treeIds[n];
this._treeParents[r]=t.id=[this.overviewId,r].join("-parent-");
o.appendChild(t)
}}
if(this.dndSupported){
this._scrollableContainerId=this.containerId||this.overviewId;
var e=this.containerId?document.getElementById(this.containerId):this.getHtmlElement();
var a={
container:e,threshold:15,amount:5,interval:10,id:this._scrollableContainerId};
this._dndScrollCallback=new AjxCallback(null,DwtControl._dndScrollCallback,[a])
}};
ZmOverview.prototype=new DwtComposite;
ZmOverview.prototype.constructor=ZmOverview;
ZmOverview.prototype.toString=function(){
return"ZmOverview"
};
ZmOverview.prototype.getTreeParent=function(e){
return this._treeParents[e]
};
ZmOverview.prototype.set=function(e,a){
if(e&&e.length){
for(var t=0;
t<e.length;
t++){
this.setTreeView(e[t],a)
}}};
ZmOverview.prototype.setTreeView=function(t,e){
if(appCtxt.get(ZmOrganizer.PRECONDITION[t])===false){
return
}
AjxDispatcher.require(ZmOrganizer.ORG_PACKAGE[t]);
var a=this._controller.getTreeController(t);
if(!a){
return
}
if(this._treeHash[t]){
a.clearTreeView(this.overviewId)
}else{
this._treeIds.push(t)
}
var o={
overviewId:this.overviewId,omit:e,showUnread:this.showUnread,account:this.account};
this._treeHash[t]=a.show(o)
};
ZmOverview.prototype.getTreeView=function(e){
return this._treeHash[e]
};
ZmOverview.prototype.getTreeViews=function(){
return this._treeIds
};
ZmOverview.prototype.getTreeItemById=function(n,a){
if(!n){
return null
}
for(var t=0;
t<this._treeIds.length;
t++){
var e=this._treeHash[this._treeIds[t]];
if(e){
var o=e.getTreeItemById&&e.getTreeItemById(n);
if(o&&(!a||(this._treeIds[t]==a))){
return o
}}}
return null
};
ZmOverview.prototype.getSelected=function(t){
for(var a=0;
a<this._treeIds.length;
a++){
var e=this._treeHash[this._treeIds[a]];
if(e){
var o=e.getSelected();
if(o){
return t?e.type:o
}}}
return null
};
ZmOverview.prototype.deselectAllTreeViews=function(){
for(var t=0;
t<this._treeIds.length;
t++){
var e=this._treeHash[this._treeIds[t]];
if(e){
e.deselectAll()
}}};
ZmOverview.prototype.setSelected=function(o,a){
var t,e;
if(a){
e=this._treeHash[a];
t=e&&e.getTreeItemById(o)
}else{
for(var a in this._treeHash){
e=this._treeHash[a];
t=e&&e.getTreeItemById(o);
if(t){
break
}}}
if(t&&(this._selectedTreeItem!=t)){
e.setSelected(o,true,true)
}
this.itemSelected(t)
};
ZmOverview.prototype.itemSelected=function(a){
if(appCtxt.multiAccounts&&a){
var t=this.overviewId.substring(0,this.overviewId.indexOf(":"));
var e=this._controller.getOverviewContainer(t);
if(e){
e.deselectAll(this)
}}
if(this._selectedTreeItem&&(this._selectedTreeItem._tree!=(a&&a._tree))){
this._selectedTreeItem._tree.deselectAll()
}
this._selectedTreeItem=a
};
ZmOverview.prototype.clear=function(){
for(var e=0;
e<this._treeIds.length;
e++){
var t=this._treeIds[e];
if(this._treeHash[t]){
var a=this._controller.getTreeController(t);
a.clearTreeView(this.overviewId);
delete this._treeHash[t]
}}};
ZmOverview.prototype._initialize=function(){};
ZmOverview.prototype._focus=function(){
var t=this._selectedTreeItem;
if(!t){
var e=this._treeHash[this._treeIds[0]];
if(e){
t=e._getNextTreeItem(true)
}}
if(t){
t.focus()
}};
ZmOverview.prototype._blur=function(){
var e=this._selectedTreeItem;
if(e){
e._blur()
}};
ZmOverview.prototype._getNextTreeItem=function(n,a){
for(var o=0;
o<this._treeIds.length;
o++){
if(this._treeHash[this._treeIds[o]]==a){
break
}}
var t=null;
var e=n?o+1:o-1;
a=this._treeHash[this._treeIds[e]];
while(a){
t=DwtTree.prototype._getNextTreeItem.call(a,n);
if(t){
break
}
e=n?e+1:e-1;
a=this._treeHash[this._treeIds[e]]
}
return t
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmUpsellView")){
ZmUpsellView=function(e){
DwtControl.call(this,e)
};
ZmUpsellView.prototype=new DwtControl;
ZmUpsellView.prototype.constructor=ZmUpsellView;
ZmUpsellView.prototype.toString=function(){
return"ZmUpsellView"
};
ZmUpsellView.prototype.setBounds=function(t,h,o,e,s){
var n=0;
if(!s){
n=this._getToolbarHeight()
}
DwtControl.prototype.setBounds.call(this,t,h-n,o,e+n);
var r="iframe_"+this.getHTMLElId();
var a=document.getElementById(r);
if(a){
a.width=o;
a.height=e+n
}};
ZmUpsellView.prototype._getToolbarHeight=function(){
var t=appCtxt.getAppViewMgr().getCurrentViewComponent(ZmAppViewMgr.C_TOOLBAR_TOP);
if(t){
var a=t.getSize();
var e=a.y?a.y:t.getHtmlElement().clientHeight;
return e
}
return 0
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmTimeSelect")){
ZmTimeSelect=function(e,t){
DwtComposite.call(this,{
parent:e}
);
this.id=t;
this._isLocale24Hour=true;
this._createSelects()
};
ZmTimeSelect.START=1;
ZmTimeSelect.END=2;
ZmTimeSelect.HOUR=1;
ZmTimeSelect.MINUTE=2;
ZmTimeSelect.AMPM=3;
ZmTimeSelect.getDateFromFields=function(e,o,a,t){
e=Number(e);
if(a){
if(a=="AM"||a===0){
e=(e==12)?0:e
}else{
if(a=="PM"||a==1){
e=(e<12)?e+12:e
}}}
t=t?t:new Date();
t.setHours(e,Number(o),0,0);
return t
};
ZmTimeSelect.parse=function(a){
var t;
var o=a.toLowerCase();
if(o===ZmMsg.midnight.toLowerCase()||o===ZmMsg.noon.toLowerCase()){
t=new Date();
t.setMinutes(0);
t.setSeconds(0);
t.setHours(o===ZmMsg.noon.toLowerCase()?12:0)
}else{
var e=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
t=e.parse(a)||AjxDateFormat.parseTime(a)
}
return t
};
ZmTimeSelect.format=function(e){
if(e.getHours()==0&&e.getMinutes()==0){
return ZmMsg.midnight
}else{
if(e.getHours()==12&&e.getMinutes()==0){
return ZmMsg.noon
}else{
return AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT).format(e)
}}};
ZmTimeSelect.adjustStartEnd=function(b,e,l,c,m){
var r=b._args.selectObj;
var t=AjxDateUtil.simpleParseDateStr(c.value);
var g=AjxDateUtil.simpleParseDateStr(m.value);
var s=c.value;
var a=m.value;
if(r.id==ZmTimeSelect.START){
var f=(r.compId==ZmTimeSelect.HOUR)?b._args.oldValue:e.getHours();
var d=(r.compId==ZmTimeSelect.MINUTE)?b._args.oldValue:e.getMinutes();
var o=(r.compId==ZmTimeSelect.AMPM)?b._args.oldValue:e.getAmPm();
var u=ZmTimeSelect.getDateFromFields(f,d,o,t).getTime();
var h=ZmTimeSelect.getDateFromFields(e.getHours(),e.getMinutes(),e.getAmPm(),t).getTime();
var p=ZmTimeSelect.getDateFromFields(l.getHours(),l.getMinutes(),l.getAmPm(),g).getTime();
var w=p-u;
if(!w){
return null
}
var n=h+w;
var y=new Date(n);
l.set(y);
m.value=AjxDateUtil.simpleComputeDateStr(y);
if(m.value!=a){
return m
}}else{
return null
}};
ZmTimeSelect.validStartEnd=function(h,t,o,r){
var e=AjxDateUtil.simpleParseDateStr(h.value);
var s=AjxDateUtil.simpleParseDateStr(t.value);
if(e&&s){
if((e.valueOf()>s.valueOf())){
return false
}
if(e.getFullYear()>9999||s.getFullYear()>9999){
return false
}
if(o&&r){
var a=ZmTimeSelect.getDateFromFields(o.getHours(),o.getMinutes(),o.getAmPm(),e).getTime();
var n=ZmTimeSelect.getDateFromFields(r.getHours(),r.getMinutes(),r.getAmPm(),s).getTime();
if(a>n){
return false
}}}else{
return false
}
return true
};
ZmTimeSelect.prototype=new DwtComposite;
ZmTimeSelect.prototype.constructor=ZmTimeSelect;
ZmTimeSelect.prototype.set=function(o){
var a=0,s=0,n=0;
var t=this.isLocale24Hour();
var e=o.getHours();
if(!t&&e>12){
a=e-13
}else{
if(!t&&e==0){
a=this.getHourSelectSize()-1
}else{
a=t?e:e-1
}}
s=Math.floor(o.getMinutes()/5);
if(!t){
n=(o.getHours()>=12)?1:0
}
this.setSelected(a,s,n)
};
ZmTimeSelect.prototype.getValue=function(e){
return(ZmTimeSelect.getDateFromFields(this.getHours(),this.getMinutes(),this.getAmPm(),e))
};
ZmTimeSelect.prototype.getHours=function(){
return this._hourSelect.getValue()
};
ZmTimeSelect.prototype.getMinutes=function(){
return this._minuteSelect.getValue()
};
ZmTimeSelect.prototype.getAmPm=function(){
return this._amPmSelect?this._amPmSelect.getValue():null
};
ZmTimeSelect.prototype.setSelected=function(e,a,t){
this._hourSelect.setSelected(e);
this._minuteSelect.setSelected(a);
if(!this._isLocale24Hour){
this._amPmSelect.setSelected(t)
}};
ZmTimeSelect.prototype.addChangeListener=function(e){
this._hourSelect.addChangeListener(e);
this._minuteSelect.addChangeListener(e);
if(this._amPmSelect){
this._amPmSelect.addChangeListener(e)
}};
ZmTimeSelect.prototype.isLocale24Hour=function(){
return this._isLocale24Hour
};
ZmTimeSelect.prototype.getHourSelectSize=function(){
return this._hourSelect.size()
};
ZmTimeSelect.prototype.getMinuteSelectSize=function(){
return this._minuteSelect.size()
};
ZmTimeSelect.prototype.getSelectedHourIdx=function(){
return this._hourSelect.getSelectedIndex()
};
ZmTimeSelect.prototype.getSelectedMinuteIdx=function(){
return this._minuteSelect.getSelectedIndex()
};
ZmTimeSelect.prototype.getSelectedAmPmIdx=function(){
return this._amPmSelect?this._amPmSelect.getSelectedIndex():0
};
ZmTimeSelect.prototype.setEnabled=function(e){
DwtComposite.prototype.setEnabled.call(this,e);
this._hourSelect.setEnabled(e);
this._minuteSelect.setEnabled(e);
if(this._amPmSelect){
this._amPmSelect.setEnabled(e)
}};
ZmTimeSelect.prototype._createSelects=function(){
this._hourSelectId=Dwt.getNextId();
this._minuteSelectId=Dwt.getNextId();
this._amPmSelectId=Dwt.getNextId();
var o=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
var s=0;
var d=0;
var c=[];
var h=0;
c[h++]="<table border=0 cellpadding=0 cellspacing=0><tr>";
for(var r=0;
r<o._segments.length;
r++){
var l=o._segments[r]._s;
if(o._segments[r] instanceof AjxFormat.TextSegment){
var e=AjxStringUtil.trim(l);
if(e.length){
c[h++]="<td class='TextPadding ZmFieldLabel'>";
c[h++]=l;
c[h++]="</td>"
}}else{
if(l.charAt(0)=="h"||l.charAt(0)=="H"){
s=r;
c[h++]="<td width=42 id='";
c[h++]=this._hourSelectId;
c[h++]="'></td>"
}else{
if(l.charAt(0)=="m"){
d=r;
c[h++]="<td width=42 id='";
c[h++]=this._minuteSelectId;
c[h++]="'></td>"
}else{
if(l=="a"){
this._isLocale24Hour=false;
c[h++]="<td width=42 id='";
c[h++]=this._amPmSelectId;
c[h++]="'></td>"
}}}}}
c[h++]="</tr></table>";
this.getHtmlElement().innerHTML=c.join("");
var a=new Date();
var t=this._isLocale24Hour?0:1;
var n=this._isLocale24Hour?24:13;
this._hourSelect=new DwtSelect({
parent:this}
);
this._hourSelect.id=this.id;
this._hourSelect.compId=ZmTimeSelect.HOUR;
for(var h=t;
h<n;
h++){
a.setHours(h);
var u=o._segments[s].format(a);
this._hourSelect.addOption(u,false,h)
}
this._hourSelect.reparentHtmlElement(this._hourSelectId);
delete this._hourSelectId;
this._minuteSelect=new DwtSelect({
parent:this}
);
this._minuteSelect.id=this.id;
this._minuteSelect.compId=ZmTimeSelect.MINUTE;
for(var h=0;
h<60;
h=h+5){
a.setMinutes(h);
var u=o._segments[d].format(a);
this._minuteSelect.addOption(u,false,h)
}
this._minuteSelect.reparentHtmlElement(this._minuteSelectId);
delete this._minuteSelectId;
if(!this._isLocale24Hour){
this._amPmSelect=new DwtSelect({
parent:this}
);
this._amPmSelect.id=this.id;
this._amPmSelect.compId=ZmTimeSelect.AMPM;
this._amPmSelect.addOption(I18nMsg.periodAm,false,"AM");
this._amPmSelect.addOption(I18nMsg.periodPm,false,"PM");
this._amPmSelect.reparentHtmlElement(this._amPmSelectId);
delete this._amPmSelectId
}};
ZmTimeInput=function(t,o,e){
var a={
parent:t,id:"ZmTimeInput"};
if(e){
a.parentElement=e
}
DwtComposite.call(this,a);
this.id=o;
this._isLocale24Hour=true;
this._createSelects();
this._useTextInput=true
};
ZmTimeInput.START=1;
ZmTimeInput.END=2;
ZmTimeInput.HOUR=1;
ZmTimeInput.MINUTE=2;
ZmTimeInput.AMPM=3;
ZmTimeInput.ROWS=8;
ZmTimeInput.DEFAULT_TOP_ROW=8;
ZmTimeInput.getDateFromFields=function(t,e){
var a=ZmTimeSelect.parse(t);
e=e||new Date();
e.setHours(a.getHours(),a.getMinutes(),0,0);
return e
};
ZmTimeInput.adjustStartEnd=function(b,e,h,c,u,g,s){
var t=AjxDateUtil.simpleParseDateStr(c.value);
var p=AjxDateUtil.simpleParseDateStr(u.value);
var o=c.value;
var a=u.value;
if(s==ZmTimeInput.START){
var l=g?g.startTimeStr:e.getTimeString();
var d=ZmTimeInput.getDateFromFields(l,t).getTime();
var r=ZmTimeInput.getDateFromFields(e.getTimeString(),t).getTime();
var f=ZmTimeInput.getDateFromFields(h.getTimeString(),p).getTime();
var w=f-d;
if(!w){
return null
}
var n=r+w;
var y=new Date(n);
e.set(new Date(r));
h.set(y);
u.value=AjxDateUtil.simpleComputeDateStr(y);
if(u.value!=a){
return u
}}else{
if(s==ZmTimeInput.END){
var l=g?g.endTimeStr:h.getTimeString();
var f=ZmTimeInput.getDateFromFields(l,p).getTime();
var n=ZmTimeInput.getDateFromFields(h.getTimeString(),p).getTime();
var d=ZmTimeInput.getDateFromFields(e.getTimeString(),t).getTime();
var w=f-d;
if(!w){
return null
}
if(n<d){
var r=n-w;
var m=new Date(r);
e.set(m);
h.set(new Date(n));
c.value=AjxDateUtil.simpleComputeDateStr(m);
u.value=AjxDateUtil.simpleComputeDateStr(new Date(n))
}
if(c.value!=o){
return c
}}else{
return null
}}};
ZmTimeInput.validStartEnd=function(n,e,c,l){
var o=AjxDateUtil.simpleParseDateStr(n.value);
var r=AjxDateUtil.simpleParseDateStr(e.value);
if(o&&r){
if((o.valueOf()>r.valueOf())){
return false
}
if(o.getFullYear()>9999||r.getFullYear()>9999){
return false
}
if(c&&l){
var a=c.getTimeString();
var h=l.getTimeString();
if(a&&h){
var t=ZmTimeInput.getDateFromFields(a,o).getTime();
var s=ZmTimeInput.getDateFromFields(h,r).getTime();
if(t>s){
return false
}}}}else{
return false
}
return true
};
ZmTimeInput.prototype=new DwtComposite;
ZmTimeInput.prototype.constructor=ZmTimeInput;
ZmTimeInput.prototype.set=function(e){
var t=ZmTimeSelect.format(e);
this._originalTimeStr=t;
this._timeSelectInput.setValue(t);
this._scrollToValue(t)
};
ZmTimeInput.prototype.setValue=function(t){
var e=ZmTimeSelect.parse(t);
if(!e){
t=""
}
this._originalTimeStr=t;
this._timeSelectInput.setValue(t);
this._scrollToValue(t)
};
ZmTimeInput.prototype._scrollToValue=function(t){
var e=this.getTimeIndex(t);
if(e!==null){
this._hoursSelectMenu.setSelectedItem(e)
}};
ZmTimeInput.prototype.getValue=function(e){
var t=ZmTimeSelect.parse(this._timeSelectInput.getValue());
if(!t){
t=new Date()
}
e=e||new Date();
if(AjxDateUtil.isDayShifted(e)){
AjxDateUtil.rollToNextDay(e)
}
e.setHours(t.getHours(),t.getMinutes(),0,0);
return e
};
ZmTimeInput.prototype.getHours=function(){
var e=this.getValue();
return e?e.getHours():null
};
ZmTimeInput.prototype.getMinutes=function(){
var e=this.getValue();
return e?e.getMinutes():null
};
ZmTimeInput.prototype.addChangeListener=function(e){
this._changeListener=e;
var t=AjxCallback.simpleClosure(this.handleTimeChange,this,e);
this._timeSelectInput.setHandler(DwtEvent.ONFOCUS,t);
this._timeSelectInput.setHandler(DwtEvent.ONBLUR,t)
};
ZmTimeInput.prototype.handleTimeChange=function(t,e){
var o=this._timeSelectInput.getValue();
var a=ZmTimeSelect.parse(o);
if(!a){
this.setValue(this._originalTimeStr)
}else{
this._scrollToValue(o)
}
t.run(e,this.id)
};
ZmTimeInput.prototype.correctTimeString=function(n,t){
var e=n.split(":");
if(!e){
return t
}
var a=(e.length&&e[0]!=null)?parseInt(e[0].replace(/D/g,"")):null;
var o=(e.length>1&&e[1]!=null)?parseInt(e[1].replace(/D/g,"")):0;
if(!a){
a=(a==0)?0:t.getHours()
}
if(!o){
o=0
}
t.setHours(a,o,0,0);
return t
};
ZmTimeInput.prototype.isLocale24Hour=function(){
return this._isLocale24Hour
};
ZmTimeInput.prototype.setEnabled=function(e){
DwtComposite.prototype.setEnabled.call(this,e);
this._timeSelectInput.setEnabled(e);
this._timeSelectBtn.setEnabled(e)
};
ZmTimeInput.prototype._timeButtonListener=function(d){
if(!this._menuItemsAdded){
var n,a,r,s,u,c,e=new Date(),l=this._timeSelectBtn,t=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT),h=new AjxListener(this,this._timeSelectionListener),o;
for(n=0;
n<24;
n++){
e.setHours(n);
e.setMinutes(0);
r=new DwtMenuItem({
parent:this._hoursSelectMenu,style:DwtMenuItem.NO_STYLE}
);
u=t.format(e);
this.putTimeIndex(u,n);
if(n==0||n==12){
u=ZmTimeSelect.format(e);
this.putTimeIndex(u,n)
}
r.setText(u);
r.setData("value",n*60);
if(h){
r.addSelectionListener(h)
}
if(n==ZmTimeInput.DEFAULT_TOP_ROW){
o=r
}
c=new DwtMenu({
parent:r,style:DwtMenu.DROPDOWN_STYLE,layout:DwtMenu.LAYOUT_CASCADE,maxRows:1,congruent:true}
);
r.setMenu(c,true);
r.setSelectableWithSubmenu(true);
for(a=1;
a<4;
a++){
e.setMinutes(a*15);
s=new DwtMenuItem({
parent:c,style:DwtMenuItem.NO_STYLE}
);
s.setText(t.format(e));
s.setData("value",n*60+a*15);
if(h){
s.addSelectionListener(h)
}}}
this._hoursSelectMenu.setWidth(l.getW()+this._timeSelectInput.getW());
if(o){
this._hoursSelectMenu.scrollToItem(o)
}
this._scrollToValue(t.format(this.getValue()));
this._menuItemsAdded=true
}
d.item.popup()
};
ZmTimeInput.prototype._timeSelectionListener=function(e){
if(e.item&&e.item instanceof DwtMenuItem){
this._timeSelectInput.setValue(e.item.getText());
this._timeSelectValue=e.item.getData("value");
if(this._changeListener){
this._changeListener.run(e,this.id)
}
return
}};
ZmTimeInput.prototype.getTimeString=function(){
var e=ZmTimeSelect.parse(this._timeSelectInput.getValue());
return e?this._timeSelectInput.getValue():""
};
ZmTimeInput.prototype.getInputField=function(){
return this._timeSelectInput
};
ZmTimeInput.prototype.putTimeIndex=function(t,e){
this._timeIndex[t.replace(/:dd/,":00").replace(/s/,"").toLowerCase()]=e
};
ZmTimeInput.prototype.getTimeIndex=function(t){
if(!t){
return null
}
var e=this._timeIndex[t.replace(/:dd/,":00").replace(/s/,"").toLowerCase()];
return(e||e===0)?e:null
};
ZmTimeInput.prototype._createSelects=function(){
this.getHtmlElement().innerHTML=AjxTemplate.expand("calendar.Appointment#ApptTimeInput",{
id:this._htmlElId}
);
var a=Dwt.getNextId("ZmTimeInputSelect_");
if(this.id&&this.id==ZmTimeSelect.START){
a+="_startTimeInput"
}else{
if(this.id&&this.id==ZmTimeSelect.END){
a+="_endTimeInput"
}}
var s={
parent:this,parentElement:(this._htmlElId+"_timeSelectInput"),type:DwtInputField.STRING,errorIconStyle:DwtInputField.ERROR_ICON_NONE,validationStyle:DwtInputField.CONTINUAL_VALIDATION,inputId:a,id:Dwt.getNextId("ZmTimeInputField_")};
this._timeSelectInput=new DwtInputField(s);
var o=this._timeSelectInput.getInputElement();
Dwt.setSize(o,"80px","22px");
o.typeId=this.id;
var e=new AjxListener(this,this._timeButtonListener);
var n=this._htmlElId+"_timeSelectBtn";
var t=this._timeSelectBtn=new DwtButton({
parent:this}
);
t.addDropDownSelectionListener(e);
t.setData(Dwt.KEY_ID,n);
t.setSize("20");
this._timeIndex={};
this._hoursSelectMenu=new DwtMenu({
parent:t,style:DwtMenu.DROPDOWN_STYLE,layout:DwtMenu.LAYOUT_SCROLL,maxRows:ZmTimeInput.ROWS}
);
t.setMenu(this._hoursSelectMenu,true,false,false,true);
this._menuItemsAdded=false;
t.reparentHtmlElement(n)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmController")){
ZmController=function(e,t){
if(arguments.length==0){
return
}
this._container=e;
this._app=t;
this._shell=appCtxt.getShell();
this._appViews={};
this._currentView=null;
this._authenticating=false
};
ZmController.prototype._setView=function(){};
ZmController.prototype.toString=function(){
return"ZmController"
};
ZmController.prototype.getApp=function(){
return this._app
};
ZmController.prototype.popupErrorDialog=function(e,u,f,d,c,a){
var h=appCtxt.getErrorDialog();
var o="";
if(typeof u=="string"){
o=u
}else{
if(u instanceof Object){
u.msg=u.msg||e;
var l=["method","msg","code","detail","trace","request","fileName","lineNumber","message","name","stack"];
var r=[],s=0;
r[s++]="<table>";
for(var n=0;
n<l.length;
n++){
var t=l[n];
var p=AjxStringUtil.htmlEncode(u[t]);
if(p){
if(t=="request"){
p=["<pre>",p,"</pre>"].join("");
var m=document.getElementById(h._msgCellId);
if(m){
m.className="DwtMsgDialog-wide"
}}
r[s++]=["<tr><td valign='top'>",l[n],":</td><td valign='top'>",p,"</td></tr>"].join("")
}}
r[s++]="</table>";
o=r.join("")
}}
h.registerCallback(DwtDialog.OK_BUTTON,this._errorDialogCallback,this);
if(!a){
e=AjxStringUtil.htmlEncode(e)
}
h.setMessage(e,o,DwtMessageDialog.CRITICAL_STYLE,ZmMsg.zimbraTitle);
h.popup(null,d);
if(c){
h.showDetail()
}};
ZmController.handleScriptError=function(t){
var s=[];
var o="<br/>";
if(t){
var n=ZmMsg.scriptError+": "+t.message;
var e=t.fileName&&t.fileName.match(/(w+.js)/);
if(e&&e.length){
n+=" - "+e[1]+":"+t.lineNumber
}
if(t.fileName){
s.push("File: "+t.fileName)
}
if(t.lineNumber){
s.push("Line: "+t.lineNumber)
}
if(t.name){
s.push("Error: "+t.name)
}
if(t.stack){
s.push("Stack: "+t.stack.replace("
",o,"g"))
}}
var a=s.join(o);
AjxDebug.println(AjxDebug.EXCEPTION,[n,a].join(o+o));
appCtxt.getAppController().popupErrorDialog(n,a,null,false,true)
};
ZmController.prototype.setCurrentView=function(e){
this._currentView=e
};
ZmController.prototype.getCurrentView=function(){
return this._currentView
};
ZmController.prototype.getKeyMapName=function(){
return"Global"
};
ZmController.prototype.handleKeyAction=function(l){
var a=this.getTabView?this.getTabView():null;
if(a&&a.handleKeyAction(l)){
return true
}
var e=ZmApp.ACTION_CODES_R[l];
if(e){
var n=ZmApp.ACTION_CODES[l];
if(n){
appCtxt.getApp(e).handleOp(n);
return true
}}
switch(l){
case ZmKeyMap.NEW:e=appCtxt.getCurrentAppName();
var r=ZmApp.NEW_ACTION_CODE[e];
if(r){
var n=ZmApp.ACTION_CODES[r];
if(n){
appCtxt.getApp(e).handleOp(n);
return true
}}
break;
case ZmKeyMap.NEW_FOLDER:case ZmKeyMap.NEW_TAG:var n=ZmApp.ACTION_CODES[l];
if(n){
this._newListener(null,n)
}
break;
case ZmKeyMap.SAVED_SEARCH:var s=appCtxt.getFolderTree().getByType(ZmOrganizer.SEARCH);
if(s&&s.length>0){
var h=appCtxt.getChooseFolderDialog();
var o={
treeIds:[ZmOrganizer.SEARCH],overviewId:h.getOverviewId(ZmOrganizer.SEARCH),title:ZmMsg.selectSearch};
ZmController.showDialog(h,new AjxCallback(null,ZmController._searchSelectionCallback,[h]),o)
}
break;
case ZmKeyMap.VISIT:var h=appCtxt.getChooseFolderDialog();
var t=ZmApp.ORGANIZER[this._app._name]||ZmOrganizer.FOLDER;
var o={
treeIds:[t],overviewId:h.getOverviewId(ZmOrganizer.APP[t]),appName:this._app._name,title:AjxMessageFormat.format(ZmMsg.goToFolder,ZmMsg[ZmOrganizer.MSG_KEY[t]])};
ZmController.showDialog(h,new AjxCallback(null,ZmController._visitOrgCallback,[h,t]),o);
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(t,e){
if(e){
appCtxt.getSearchController().redoSearch(e.search)
}
t.popdown()
};
ZmController._visitOrgCallback=function(t,a,o){
if(o){
var e=appCtxt.getOverviewController().getTreeController(a);
if(e&&e._itemClicked){
e._itemClicked(o)
}}
t.popdown()
};
ZmController.prototype.mapSupported=function(e){
return false
};
ZmController.prototype._newListener=function(a,n){
switch(n){
case ZmOperation.NEW_FOLDER:var o=appCtxt.getCurrentView();
var t=o.getMailListView?o.getMailListView():null;
var e=t&&t.getFolder?t.getFolder():null;
ZmController.showDialog(appCtxt.getNewFolderDialog(),this.getNewFolderCallback(),e);
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(s,o,t,a){
var n=appCtxt.getNewFolderDialog();
n.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.FOLDER)._doCreate(s,o,t,a)
};
ZmController.prototype._newTagCallback=function(t){
appCtxt.getNewTagDialog().popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.TAG)._doCreate(t)
};
ZmController.prototype._createTabGroup=function(e){
e=e?e:this.toString();
this._tabGroup=new DwtTabGroup(e);
return this._tabGroup
};
ZmController.prototype._setTabGroup=function(e){
this._tabGroup=e
};
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 t=appCtxt.getRootTabGroup().getFocusMember();
var e=this.getTabGroup();
this._savedFocusMember=(t&&e&&e.contains(t))?t:null;
return this._savedFocusMember
};
ZmController.prototype._restoreFocus=function(n,r){
var a=appCtxt.getRootTabGroup();
var t=appCtxt.getCurrentApp();
var s=t&&t.getOverviewId();
var o=s&&appCtxt.getOverviewController().getOverview(s);
if(a&&o&&(o!=ZmController._currentOverview)){
a.replaceMember(ZmController._currentOverview,o,false,false,null,true);
ZmController._currentOverview=o
}
var e=this.getTabGroup();
n=n||this._savedFocusMember||this._getDefaultFocusItem()||a.getFocusMember();
r=r||ZmController.noFocus;
ZmController.noFocus=false;
if(a&&e&&(e!=ZmController._currentAppViewTabGroup)){
a.replaceMember(ZmController._currentAppViewTabGroup,e,false,false,n,r);
ZmController._currentAppViewTabGroup=e
}else{
if(n&&!r){
appCtxt.getKeyboardMgr().grabFocus(n)
}}};
ZmController.prototype._getDefaultFocusItem=function(){
var e=this.getTabGroup();
return e?e.getFirstMember(true):null
};
ZmController.prototype._preHideCallback=function(){
this._saveFocus();
return true
};
ZmController.prototype._postShowCallback=function(){
this._restoreFocus();
return true
};
ZmController.prototype._handleError=function(t,e){
this._handleException(t,e)
};
ZmController.prototype._handleException=function(s,o){
if(s.code==AjxSoapException.INVALID_PDU){
s.code=ZmCsfeException.SVC_FAILURE;
s.detail=["contact your administrator (",s.msg,")"].join("");
s.msg="Service failure"
}
if(s.code==ZmCsfeException.SVC_AUTH_EXPIRED||s.code==ZmCsfeException.SVC_AUTH_REQUIRED||s.code==ZmCsfeException.NO_AUTH_TOKEN||s.code==ZmCsfeException.AUTH_TOKEN_CHANGED){
ZmCsfeCommand.noAuth=true;
ZmZimbraMail.logOff(null,true);
return
}
if(s.code==ZmCsfeException.AUTH_TOKEN_CHANGED){
var r=AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount");
var e=r.getMethod();
e.setAttribute("sections","mbox");
var d=new AjxCallback(this,this._handleResponseGetInfo);
var a={
soapDoc:r,asyncMode:true,callback:d,skipAuthCheck:true};
ZmCsfeCommand._oldSessionId=ZmCsfeCommand._sessionId;
appCtxt.getAppController().sendRequest(a);
return
}
if(s.code==ZmCsfeException.MAIL_NO_SUCH_MSG){
var h=appCtxt.getCurrentViewId();
if(h==ZmId.VIEW_CONVLIST||h==ZmId.VIEW_TRAD){
var c=appCtxt.getApp(ZmApp.MAIL);
var l=appCtxt.isOffline?new AjxCallback(this,this._handleMailSearch,c):null;
c.mailSearch(null,l);
return
}}
if(s.method!="NoOpRequest"){
var n;
if(s.code==ZmCsfeException.MAIL_NO_SUCH_ITEM){
n=s.data.itemId
}else{
if(s.code==ZmCsfeException.MAIL_SEND_FAILURE){
n=s.code
}else{
if(s.code==ZmCsfeException.MAIL_INVALID_NAME){
n=s.data.name
}}}
if(s.lineNumber&&!s.detail){
ZmController.handleScriptError(s)
}else{
var t=s.getErrorMsg?s.getErrorMsg(n):s.msg?s.msg:s.message;
this.popupErrorDialog(t,s,true,this._hideSendReportBtn(s))
}}};
ZmController.prototype._handleMailSearch=function(e){
if(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)){
e.getOverviewContainer().highlightAllMboxes()
}};
ZmController.prototype._handleLogin=function(t,e){
var a=appCtxt.get(ZmSetting.LOGIN_URL);
if(a){
ZmZimbraMail.sendRedirect(a);
return
}
var s=appCtxt.getUsername();
if(!s||appCtxt.isOffline){
ZmZimbraMail.logOff();
return
}
this._authenticating=true;
var n=appCtxt.getLoginDialog();
n.registerCallback(this._loginCallback,this,[e]);
n.setVisible(true,false);
try{
n.setFocus(s,t)
}
catch(o){}};
ZmController.prototype._loginCallback=function(e,o,t,a){
this._doAuth(e,o,t,a)
};
ZmController.prototype._doAuth=function(e,s,t,n){
var a=new ZmAuthenticate();
var o=new AjxCallback(this,this._handleResponseDoAuth,[e,n]);
a.execute(s,t,o)
};
ZmController.prototype._handleResponseDoAuth=function(t,s,e){
try{
var e=e.getResponse();
this._authenticating=false;
appCtxt.rememberMe=s;
if(t){
if(t.continueCallback){
t.continueCallback.run()
}else{
t.resend=ZmCsfeCommand.REAUTH;
appCtxt.getRequestMgr().sendRequest(t)
}
this._hideLoginDialog()
}else{
window.onbeforeunload=null;
var a=AjxUtil.formatUrl();
ZmZimbraMail.sendRedirect(a)
}}
catch(n){
var o=appCtxt.getLoginDialog();
if(n.code==ZmCsfeException.ACCT_AUTH_FAILED||n.code==ZmCsfeException.SVC_INVALID_REQUEST){
o.setError(ZmMsg.loginError)
}else{
if(n.code==ZmCsfeException.ACCT_MAINTENANCE_MODE){
o.setError(ZmMsg.errorMaintenanceMode+" "+ZmMsg.errorContact)
}else{
this.popupErrorDialog(ZmMsg.errorGeneric,n)
}}}};
ZmController.prototype._hideLoginDialog=function(){
var e=appCtxt.getLoginDialog();
e.setVisible(false);
e.setError(null);
e.clearPassword()
};
ZmController.prototype._handleResponseGetInfo=function(e){
var a=e.getResponse();
var n=a.GetInfoResponse;
if(appCtxt.isOffline){
if(location.search.indexOf("offlineHack")!=-1){
var s="old user: "+appCtxt.getUsername()+"
old session ID: "+ZmCsfeCommand._oldSessionId+"
new user: "+n.name+"
new session ID: "+ZmCsfeCommand._sessionId+"
";
alert(s)
}}else{
if(n.name!=appCtxt.getUsername()){
ZmCsfeCommand.noAuth=true;
var o=appCtxt.getLoginDialog();
o.setError(ZmMsg.authChanged);
var t=false;
o.setReloginMode(t);
this._handleLogin(t)
}else{}}};
ZmController.prototype._hideSendReportBtn=function(e){
return(e.code==ZmCsfeException.MAIL_TOO_MANY_TERMS||e.code==ZmCsfeException.MAIL_MAINTENANCE_MODE||e.code==ZmCsfeException.MAIL_MESSAGE_TOO_BIG||e.code==ZmCsfeException.NETWORK_ERROR||e.code==ZmCsfeException.EMPTY_RESPONSE||e.code==ZmCsfeException.BAD_JSON_RESPONSE||e.code==ZmCsfeException.TOO_MANY_TAGS||e.code==ZmCsfeException.OFFLINE_ONLINE_ONLY_OP)
};
ZmController.prototype._errorDialogCallback=function(){
appCtxt.getErrorDialog().popdown()
};
ZmController.showDialog=function(e,o,a,t){
e.reset(t);
e.registerCallback(DwtDialog.OK_BUTTON,o);
e.popup(a,t)
};
ZmController.prototype._clearDialog=function(e){
e.popdown();
this._pendingActionData=null
};
ZmController.prototype._menuPopdownActionListener=function(){};
ZmController.prototype.setSessionId=function(e,t){
this.sessionId=t;
this.viewId=[e,this.sessionId].join("");
this.tabId=["tab",this.viewId].join("_")
};
ZmController.prototype.isTransient=function(e,t){
return false
};
ZmController.prototype._setSearchToolbarVisibilityPerSkin=function(t){
if(!appCtxt.getSkinHint("hideSearchInCompose")){
return
}
if(!t){
appCtxt.getSearchController().showBrowseView(false,null,true)
}
var e=document.getElementById(ZmId.SEARCH_TOOLBAR);
if(!e){
return
}
e.style.display=t?"block":"none"
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmListController")){
ZmListController=function(e,t){
if(arguments.length==0){
return
}
ZmController.call(this,e,t);
this._toolbar={};
this._navToolBar={};
this._listView={};
this._tabGroups={};
this._list=null;
this._actionMenu=null;
this._actionEv=null;
this._activeSearch=null;
this._tagList=appCtxt.getTagTree();
if(this._tagList){
this._tagChangeLstnr=new AjxListener(this,this._tagChangeListener);
this._tagList.addChangeListener(this._tagChangeLstnr)
}
this._listeners={};
this._listeners[ZmOperation.NEW_MENU]=new AjxListener(this,this._newListener);
this._listeners[ZmOperation.TAG_MENU]=new AjxListener(this,this._tagButtonListener);
this._listeners[ZmOperation.TAG]=new AjxListener(this,this._tagListener);
this._listeners[ZmOperation.PRINT]=new AjxListener(this,this._printListener);
this._listeners[ZmOperation.DELETE]=new AjxListener(this,this._deleteListener);
this._listeners[ZmOperation.CLOSE]=new AjxListener(this,this._backListener);
this._listeners[ZmOperation.MOVE]=new AjxListener(this,this._moveListener);
this._listeners[ZmOperation.SEARCH]=new AjxListener(this,this._participantSearchListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._participantBrowseListener);
this._listeners[ZmOperation.NEW_MESSAGE]=new AjxListener(this,this._participantComposeListener);
if(window.ZmImApp){
this._listeners[ZmOperation.IM]=ZmImApp.getImMenuItemListener()
}
this._listeners[ZmOperation.CONTACT]=new AjxListener(this,this._participantContactListener);
this._listeners[ZmOperation.VIEW]=new AjxListener(this,this._viewMenuItemListener);
this._menuPopdownListener=new AjxListener(this,this._menuPopdownActionListener);
this._dropTgt=new DwtDropTarget("ZmTag");
this._dropTgt.markAsMultiple();
this._dropTgt.addDropListener(new AjxListener(this,this._dropListener));
this._itemCountText={};
this._continuation={
count:0,totalItems:0}
};
ZmListController.prototype=new ZmController;
ZmListController.prototype.constructor=ZmListController;
ZmListController.CONTINUATION_SEARCH_ITEMS=500;
ZmListController.prototype.toString=function(){
return"ZmListController"
};
ZmListController.prototype.show=function(t,e){
this._currentView=e||this._defaultView();
this._activeSearch=t;
if(t){
this._currentSearch=t.search
}
this.currentPage=1;
this.maxPage=1
};
ZmListController.prototype.getSearchString=function(){
return this._currentSearch?this._currentSearch.query:""
};
ZmListController.prototype.getSearchStringHint=function(){
return this._currentSearch?this._currentSearch.queryHint:""
};
ZmListController.prototype.getSelection=function(e){
e=e||this.getCurrentView();
return e?e.getSelection():[]
};
ZmListController.prototype.getSelectionCount=function(e){
e=e||this.getCurrentView();
return e?e.getSelectionCount():0
};
ZmListController.prototype.getCurrentView=function(){
return this._listView[this._currentView]
};
ZmListController.prototype.getCurrentToolbar=function(){
return this._toolbar[this._currentView]
};
ZmListController.prototype.getList=function(){
return this._list
};
ZmListController.prototype.setList=function(e){
if(e!=this._list&&(e instanceof ZmList)){
if(this._list){
this._list.clear()
}
this._list=e
}};
ZmListController.prototype.setHasMore=function(e){
if(e){
this._list.setHasMore(e);
this._resetNavToolBarButtons(this._currentView)
}};
ZmListController.prototype.handleKeyAction=function(s){
var a=this._listView[this._currentView];
switch(s){
case DwtKeyMap.DBLCLICK:return a.handleKeyAction(s);
case ZmKeyMap.DEL:var t=this._toolbar[this._currentView];
var n=t&&(t.getButton(ZmOperation.DELETE)||t.getButton(ZmOperation.DELETE_MENU));
if(n&&n.getEnabled()){
this._doDelete(this.getSelection())
}
break;
case ZmKeyMap.FLAG:this._doFlag(this.getSelection());
break;
case ZmKeyMap.MOVE:this._moveListener();
break;
case ZmKeyMap.NEXT_PAGE:var e=this._navToolBar[this._currentView];
var n=e?e.getButton(ZmOperation.PAGE_FORWARD):null;
if(n&&n.getEnabled()){
this._paginate(this._currentView,true)
}
break;
case ZmKeyMap.PREV_PAGE:var e=this._navToolBar[this._currentView];
var n=e?e.getButton(ZmOperation.PAGE_BACK):null;
if(n&&n.getEnabled()){
this._paginate(this._currentView,false)
}
break;
case ZmKeyMap.PRINT:if(appCtxt.get(ZmSetting.PRINT_ENABLED)){
this._printListener()
}
break;
case ZmKeyMap.TAG:var o=this.getSelection();
if(o&&o.length&&(appCtxt.getTagTree().size()>0)){
var r=appCtxt.getPickTagDialog();
ZmController.showDialog(r,new AjxCallback(this,this._tagSelectionCallback,[o,r]))
}
break;
case ZmKeyMap.UNTAG:if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){
var o=this.getSelection();
if(o&&o.length){
this._doRemoveAllTags(o)
}}
break;
default:return ZmController.prototype.handleKeyAction.call(this,s)
}
return true
};
ZmListController.prototype._createNewView=function(){};
ZmListController.prototype._getViewType=function(){};
ZmListController.prototype._defaultView=function(){
return this._getViewType()
};
ZmListController.prototype._setViewContents=function(e){};
ZmListController.prototype._getTagMenuMsg=function(e){};
ZmListController.prototype._getMoveDialogTitle=function(e){};
ZmListController.prototype._getToolBarOps=function(){};
ZmListController.prototype._getActionMenuOps=function(){};
ZmListController.prototype._setup=function(e){
this._initialize(e);
this._resetOperations(this._toolbar[e],0)
};
ZmListController.prototype._initialize=function(e){
this._initializeToolBar(e);
this._initializeListView(e);
this._initializeTabGroup(e)
};
ZmListController.prototype._standardToolBarOps=function(){
return[ZmOperation.NEW_MENU,ZmOperation.SEP,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.PRINT]
};
ZmListController.prototype._standardActionMenuOps=function(){
return[ZmOperation.TAG_MENU,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.PRINT]
};
ZmListController.prototype._participantOps=function(){
var e=[ZmOperation.SEARCH_MENU,ZmOperation.BROWSE];
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){
e.push(ZmOperation.NEW_MESSAGE)
}
if(appCtxt.get(ZmSetting.IM_ENABLED)){
e.push(ZmOperation.IM)
}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
e.push(ZmOperation.CONTACT)
}
return e
};
ZmListController.prototype._initializeToolBar=function(t){
if(this._toolbar[t]){
return
}
var n=this._getToolBarOps();
if(!n){
return
}
var e=this._toolbar[t]=new ZmButtonToolBar({
parent:this._container,buttons:n,context:t,controller:this,refElementId:ZmId.SKIN_APP_TOP_TOOLBAR}
);
var o;
for(var a=0;
a<e.opList.length;
a++){
o=e.opList[a];
if(this._listeners[o]){
e.addSelectionListener(o,this._listeners[o])
}}
o=e.getButton(ZmOperation.PRINT);
if(o){
o.setText(null)
}
o=e.getButton(ZmOperation.MOVE);
if(o){
o.setText(null)
}
o=e.getButton(ZmOperation.NEW_MENU);
if(o){
var s=new AjxListener(e,ZmListController._newDropDownListener);
o.addDropDownSelectionListener(s);
e._ZmListController_this=this;
e._ZmListController_newDropDownListener=s
}
o=e.getButton(ZmOperation.TAG_MENU);
if(o){
o.noMenuBar=true;
this._setupTagMenu(e)
}
appCtxt.notifyZimlets("initializeToolbar",[this._app,e,this,t],{
waitUntilLoaded:true}
)
};
ZmListController.prototype._initializeListView=function(e){
if(this._listView[e]){
return
}
this._listView[e]=this._createNewView(e);
this._listView[e].addSelectionListener(new AjxListener(this,this._listSelectionListener));
this._listView[e].addActionListener(new AjxListener(this,this._listActionListener))
};
ZmListController.prototype._initializeActionMenu=function(){
if(this._actionMenu){
return
}
var e=this._getActionMenuOps();
if(!e){
return
}
this._actionMenu=new ZmActionMenu({
parent:this._shell,menuItems:e,context:this._getMenuContext(),controller:this}
);
this._addMenuListeners(this._actionMenu);
if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){
this._setupTagMenu(this._actionMenu)
}};
ZmListController.prototype._addMenuListeners=function(o){
var t=o.opList;
for(var e=0;
e<t.length;
e++){
var a=t[e];
if(this._listeners[a]){
o.addSelectionListener(a,this._listeners[a],0)
}}
o.addPopdownListener(this._menuPopdownListener)
};
ZmListController.prototype._initializeTabGroup=function(e){
if(this._tabGroups[e]){
return
}
this._tabGroups[e]=this._createTabGroup();
this._tabGroups[e].newParent(appCtxt.getRootTabGroup());
this._toolbar[e].noFocus=true;
this._tabGroups[e].addMember(this._listView[e].getTabGroupMember())
};
ZmListController.prototype._setView=function(a){
var e=a.view;
if(!this._appViews[e]){
var t={};
t[ZmAppViewMgr.CB_PRE_HIDE]=this._preHideCallback?new AjxCallback(this,this._preHideCallback):null;
t[ZmAppViewMgr.CB_PRE_UNLOAD]=this._preUnloadCallback?new AjxCallback(this,this._preUnloadCallback):null;
t[ZmAppViewMgr.CB_POST_HIDE]=this._postHideCallback?new AjxCallback(this,this._postHideCallback):null;
t[ZmAppViewMgr.CB_PRE_SHOW]=this._preShowCallback?new AjxCallback(this,this._preShowCallback):null;
t[ZmAppViewMgr.CB_POST_SHOW]=this._postShowCallback?new AjxCallback(this,this._postShowCallback):null;
a.callbacks=t;
a.viewId=e;
this._app.createView(a);
this._appViews[e]=1
}
if(!a.pushOnly){
this._setViewContents(e)
}
if(a.stageView){
this._app.stageView(e)
}else{
return(a.clear?this._app.setView(e):this._app.pushView(e))
}};
ZmListController.prototype._listSelectionListener=function(e){
if(e.field==ZmItem.F_FLAG){
this._doFlag([e.item])
}else{
var t=this._listView[this._currentView];
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
if(!e.ctrlKey&&t.setSelectionHdrCbox){
t.setSelectionHdrCbox(false)
}}
this._resetOperations(this._toolbar[this._currentView],t.getSelectionCount())
}};
ZmListController.prototype._listActionListener=function(e){
this._actionEv=e;
var t=this.getActionMenu();
if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){
this._setTagMenu(t)
}
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
this._setSearchMenu(t)
}
this._resetOperations(t,this.getSelectionCount())
};
ZmListController.prototype._menuPopdownActionListener=function(){
if(!this._pendingActionData){
this.getCurrentView().handleActionPopdown()
}};
ZmListController.prototype._newListener=function(o,r,s){
if(!o&&!r){
return
}
r=r||o.item.getData(ZmOperation.KEY_ID);
if(!r||r==ZmOperation.NEW_MENU){
r=this._defaultNewId
}
var t=ZmApp.OPS_R[r];
var n=t&&appCtxt.getApp(t);
if(n){
s=s||{};
s.ev=o;
if(!s.folderId&&appCtxt.multiAccounts){
var e=appCtxt.getFolderTree(appCtxt.getActiveAccount()||appCtxt.accountList.defaultAccount);
var a=n.getDefaultFolderId&&n.getDefaultFolderId(r);
if(a){
s.folderId=e.getById(a).id
}}
n.handleOp(r,s)
}else{
ZmController.prototype._newListener.call(this,o,r)
}};
ZmListController.prototype._tagButtonListener=function(t){
var e=this._toolbar[this._currentView];
if(t.item.parent==e){
this._setTagMenu(e)
}};
ZmListController.prototype._tagListener=function(a,t){
var e=appCtxt.getAppViewMgr().getCurrentViewId();
if(e==this._getViewType()||e==ZmId.VIEW_MIXED){
var s=a.getData(ZmTagMenu.KEY_TAG_EVENT);
var n=a.getData(ZmTagMenu.KEY_TAG_ADDED);
t=t||this.getSelection();
if(s==ZmEvent.E_TAGS&&n){
this._doTag(t,a.getData(Dwt.KEY_OBJECT),true)
}else{
if(s==ZmEvent.E_CREATE){
this._pendingActionData=t;
var o=appCtxt.getNewTagDialog();
if(!this._newTagCb){
this._newTagCb=new AjxCallback(this,this._newTagCallback)
}
ZmController.showDialog(o,this._newTagCb);
o.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,o)
}else{
if(s==ZmEvent.E_TAGS&&!n){
this._doTag(t,a.getData(Dwt.KEY_OBJECT),false)
}else{
if(s==ZmEvent.E_REMOVE_ALL){
this._doRemoveAllTags(t)
}}}}}};
ZmListController.prototype._tagSelectionCallback=function(t,a,e){
if(e){
this._doTag(t,e,true)
}
a.popdown()
};
ZmListController.prototype._printListener=function(a){
var e=this.getSelection();
var t=(e instanceof Array)?e[0]:e;
if(t){
window.open(t.getRestUrl(),"_blank")
}};
ZmListController.prototype._backListener=function(e){
this._app.popView()
};
ZmListController.prototype._deleteListener=function(e){
this._doDelete(this.getSelection())
};
ZmListController.prototype._moveListener=function(e,a){
this._pendingActionData=a||(this.getSelection());
var t=appCtxt.getChooseFolderDialog();
if(!this._moveCb){
this._moveCb=new AjxCallback(this,this._moveCallback)
}
ZmController.showDialog(t,this._moveCb,this._getMoveParams(t));
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmListController.prototype._getMoveParams=function(e){
var t=ZmApp.ORGANIZER[this._app._name]||ZmOrganizer.FOLDER;
return{
overviewId:e.getOverviewId(this._app._name),data:this._pendingActionData,treeIds:[t],title:AjxStringUtil.htmlEncode(this._getMoveDialogTitle(this._pendingActionData.length)),description:ZmMsg.targetFolder,treeStyle:DwtTree.SINGLE_STYLE,appName:this._app._name}
};
ZmListController.prototype._viewMenuItemListener=function(e){
if(e.detail==DwtMenuItem.CHECKED||e.detail==DwtMenuItem.UNCHECKED){
this.switchView(e.item.getData(ZmOperation.MENUITEM_ID))
}};
ZmListController.prototype._navBarListener=function(t){
var e=appCtxt.getAppViewMgr().getCurrentViewId();
if(e!=this._getViewType()&&e!=ZmId.VIEW_MIXED){
return
}
var a=t.item.getData(ZmOperation.KEY_ID);
if(a==ZmOperation.PAGE_BACK||a==ZmOperation.PAGE_FORWARD){
this._paginate(this._currentView,(a==ZmOperation.PAGE_FORWARD))
}};
ZmListController.prototype._participantSearchListener=function(a){
var t=this._getSearchFolder();
if(t&&(t.nId==ZmFolder.ID_SENT||t.nId==ZmFolder.ID_DRAFTS)){
var o=this._actionEv.item.getAddresses(AjxEmailAddress.CC).getArray();
var n=this._actionEv.item.getAddresses(AjxEmailAddress.TO).getArray();
var e=n.concat(o);
appCtxt.getSearchController().fromSearch(e)
}else{
var e=this._actionEv.address.getAddress();
appCtxt.getSearchController().fromSearch(e)
}};
ZmListController.prototype._participantSearchToListener=function(a){
var t=this._getSearchFolder();
if(t&&(t.nId==ZmFolder.ID_SENT||t.nId==ZmFolder.ID_DRAFTS)){
var n=this._actionEv.item.getAddresses(AjxEmailAddress.TO).getArray();
var o=this._actionEv.item.getAddresses(AjxEmailAddress.CC).getArray();
var e=n.concat(o).concat(o);
appCtxt.getSearchController().toSearch(e)
}else{
var e=this._actionEv.address.getAddress();
appCtxt.getSearchController().toSearch(e)
}};
ZmListController.prototype._participantBrowseListener=function(t){
var e=this._actionEv.address.getAddress();
appCtxt.getSearchController().fromBrowse(e)
};
ZmListController.prototype._participantComposeListener=function(t){
var e=this._actionEv.address.toString()+AjxEmailAddress.SEPARATOR;
AjxDispatcher.run("Compose",{
action:ZmOperation.NEW_MESSAGE,inNewWindow:this._app._inNewWindow(t),toOverride:e}
)
};
ZmListController.prototype._participantContactListener=function(t){
var e=new AjxCallback(this,this._handleLoadParticipantContactListener);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,true)
};
ZmListController.prototype._handleLoadParticipantContactListener=function(){
var o=AjxDispatcher.run("GetContactController");
if(this._actionEv.contact){
if(this._actionEv.contact.isLoaded){
var t=this._actionEv.contact.isGal;
o.show(this._actionEv.contact,t)
}else{
var a=new AjxCallback(this,this._loadContactCallback);
this._actionEv.contact.load(a)
}}else{
var e=this._createNewContact(this._actionEv);
o.show(e,true)
}};
ZmListController.prototype._createNewContact=function(t){
var e=new ZmContact(null);
e.initFromEmail(t.address);
return e
};
ZmListController.prototype._loadContactCallback=function(t,e){
AjxDispatcher.run("GetContactController").show(e)
};
ZmListController.prototype._dragListener=function(e){
if(e.action==DwtDragEvent.SET_DATA){
e.srcData={
data:e.srcControl.getDnDSelection(),controller:this}
}};
ZmListController.prototype._dropListener=function(r){
var h=this._listView[this._currentView];
var e=h.getTargetItemDiv(r.uiEvent);
var c=h.getItemFromElement(e);
var o=r.srcData.data;
if(r.action==DwtDropEvent.DRAG_ENTER){
r.doIt=(c&&(c instanceof ZmItem)&&!c.isShared()&&this._dropTgt.isValidTarget(o));
if(appCtxt.multiAccounts){
var l=c?c.getAccount().id:null;
var n=(o.account&&o.account.id)||o[0].account.id;
if(l!=n){
r.doIt=false
}}
if(r.doIt){
h.dragSelect(e)
}}else{
if(r.action==DwtDropEvent.DRAG_DROP){
h.dragDeselect(e);
var s=[c];
var t=this.getSelection();
if(t.length){
var a=AjxVector.fromArray(t);
if(a.contains(c)){
s=t
}}
this._doTag(s,o,true)
}else{
if(r.action==DwtDropEvent.DRAG_LEAVE){
h.dragDeselect(e)
}else{
if(r.action==DwtDropEvent.DRAG_OP_CHANGED){}}}}};
ZmListController.prototype._tagChangeListener=function(a){
var t=appCtxt.getAppViewMgr().getCurrentViewId();
if(t==this._getViewType()||t==ZmId.VIEW_MIXED){
if(a.type==ZmEvent.S_TAG&&a.event==ZmEvent.E_CREATE&&this._pendingActionData){
var e=a.getDetail("organizers")[0];
this._doTag(this._pendingActionData,e,true);
this._pendingActionData=null;
this._menuPopdownActionListener()
}}};
ZmListController.prototype._moveCallback=function(e){
this._doMove(this._pendingActionData,e);
this._clearDialog(appCtxt.getChooseFolderDialog());
this._pendingActionData=null
};
ZmListController.prototype._doFlag=function(a,t){
a=AjxUtil.toArray(a);
if(!a.length){
return
}
if(a[0] instanceof ZmItem){
if(t!==true&&t!==false){
t=!a[0].isFlagged
}
var e=[];
for(var o=0;
o<a.length;
o++){
if(a[o].isFlagged!=t){
e.push(a[o])
}}}else{
e=a
}
var s={
items:e,op:"flag",value:t};
s.actionText=t?ZmMsg.actionFlag:ZmMsg.actionUnflag;
var n=this._setupContinuation(this._doFlag,[t],s);
n.flagItems(s)
};
ZmListController.prototype._doTag=function(t,e,n){
t=AjxUtil.toArray(t);
if(!t.length){
return
}
var o={
items:t,tag:e,doTag:n};
var a=this._setupContinuation(this._doTag,[e,n],o);
a.tagItems(o)
};
ZmListController.prototype._doRemoveAllTags=function(e){
e=AjxUtil.toArray(e);
if(!e.length){
return
}
var a={
items:e};
var t=this._setupContinuation(this._doRemoveAllTags,null,a);
t.removeAllTags(a)
};
ZmListController.prototype._doDelete=function(r,n,h){
r=AjxUtil.toArray(r);
if(!r.length){
return
}
var a={
items:r,hardDelete:n,attrs:h,childWin:appCtxt.isChildWindow&&window,closeChildWin:appCtxt.isChildWindow};
var l=new AjxCallback(this,this._checkItemCount);
var s=this._setupContinuation(this._doDelete,[n,h],a,l);
if(!n){
var e=false;
for(var o=0,t=r.length;
o<t;
o++){
if(r[o]&&r[o].isScheduled){
e=true;
break
}}
if(e){
a.noUndo=true;
this._popupScheduledWarningDialog(new AjxCallback(s,s.deleteItems,a))
}else{
s.deleteItems(a)
}}else{
s.deleteItems(a)
}};
ZmListController.prototype._doMove=function(c,a,u,h){
c=AjxUtil.toArray(c);
if(!c.length){
return
}
var n=[];
var t=[];
if(c[0] instanceof ZmItem){
for(var r=0;
r<c.length;
r++){
var m=c[r];
if(!m.folderId||(m.folderId!=a.id||(u&&u.op=="recover"))){
if(!this._isItemMovable(m,h,a)){
t.push(m)
}else{
n.push(m)
}}}}else{
n=c
}
var s={
folder:a,attrs:u};
s.errorCallback=new AjxCallback(this,this._actionErrorCallback);
var f=new AjxCallback(this,this._checkItemCount);
if(n.length){
s.items=n;
var l=this._setupContinuation(this._doMove,[a,u,h],s,f);
if(a.isInTrash()){
var e=false;
var d=AjxUtil.toArray(n);
for(var r=0,o=d.length;
r<o;
r++){
if(d[r]&&d[r].isScheduled){
e=true;
break
}}
if(e){
s.noUndo=true;
this._popupScheduledWarningDialog(new AjxCallback(l,l.moveItems,s))
}else{
l.moveItems(s)
}}else{
l.moveItems(s)
}}
if(t.length){
s.items=t;
var l=this._setupContinuation(this._doMove,[a,u,h],s,f);
l.copyItems(s)
}};
ZmListController.prototype._actionErrorCallback=function(e){
return false
};
ZmListController.prototype._popupScheduledWarningDialog=function(t){
var e=appCtxt.getOkCancelMsgDialog();
e.reset();
e.setMessage(ZmMsg.moveScheduledMessageWarning,DwtMessageDialog.WARNING_STYLE);
e.registerCallback(DwtDialog.OK_BUTTON,new AjxCallback(this,this._scheduledWarningDialogListener,[t,e]));
e.associateEnterWithButton(DwtDialog.OK_BUTTON);
e.popup(null,DwtDialog.OK_BUTTON)
};
ZmListController.prototype._scheduledWarningDialogListener=function(t,e){
e.popdown();
t.run()
};
ZmListController.prototype._isItemMovable=function(a,e,t){
return(!e&&!a.isReadOnly()&&!t.isReadOnly())
};
ZmListController.prototype._doModify=function(t,e){
var a=t.list||this._list;
a.modifyItem(t,e)
};
ZmListController.prototype._doCreate=function(t,e){
t.create(e)
};
ZmListController.prototype._propagateMenuListeners=function(n,h,s){
if(!n){
return
}
s=s||this._listeners[h];
var o=n.getOp(h);
if(o){
var r=o.getMenu();
var e=r.getItems();
var a=r.getItemCount();
for(var t=0;
t<a;
t++){
e[t].addSelectionListener(s)
}}};
ZmListController.prototype._setSearchMenu=function(e){
if(!e){
return
}
var t=e.getSearchMenu();
if(t){
t.addSelectionListener(ZmOperation.SEARCH,new AjxListener(this,this._participantSearchListener));
t.addSelectionListener(ZmOperation.SEARCH_TO,new AjxListener(this,this._participantSearchToListener))
}};
ZmListController.prototype._setupTagMenu=function(t){
if(!t){
return
}
var a=t.getTagMenu();
if(a){
a.addSelectionListener(this._listeners[ZmOperation.TAG])
}
if(t instanceof ZmButtonToolBar){
var e=t.getOp(ZmOperation.TAG_MENU);
if(e){
e.addDropDownSelectionListener(this._listeners[ZmOperation.TAG_MENU])
}}};
ZmListController.prototype._setTagMenu=function(o){
if(!o){
return
}
var a=o.getOp(ZmOperation.TAG_MENU);
if(a){
var s=o.getTagMenu();
var t=this.getSelection();
t=AjxUtil.toArray(t);
var n=(appCtxt.multiAccounts&&t.length==1)?t[0].getAccount():null;
s.set(t,appCtxt.getTagTree(n));
if(o instanceof ZmActionMenu){
a.setText(this._getTagMenuMsg(t.length))
}else{
s.parent.popup();
if(appCtxt.isChildWindow){
var e=s.getMenuItem(ZmTagMenu.MENU_ITEM_ADD_ID);
if(e){
e.setVisible(false)
}}}}};
ZmListController.prototype._setNewButtonProps=function(e,a,s,n,t){
var o=this._toolbar[e].getButton(ZmOperation.NEW_MENU);
if(o){
o.setToolTipContent(a);
o.setImage(s);
this._defaultNewId=t
}};
ZmListController.prototype._setContactText=function(t){
var e=t?ZmOperation.EDIT_CONTACT:ZmOperation.NEW_CONTACT;
var a=t?null:ZmMsg.AB_ADD_CONTACT;
ZmOperation.setOperation(this._toolbar[this._currentView],ZmOperation.CONTACT,e,ZmMsg.AB_ADD_CONTACT);
ZmOperation.setOperation(this.getActionMenu(),ZmOperation.CONTACT,e,a)
};
ZmListController.prototype._resetOperations=function(t,e){
if(!t){
return
}
if(e==0){
t.enableAll(false);
t.enable(ZmOperation.NEW_MENU,true)
}else{
if(e==1){
t.enableAll(true)
}else{
if(e>1){
t.enableAll(false);
t.enable([ZmOperation.NEW_MENU,ZmOperation.TAG_MENU,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.FORWARD],true)
}}}
var a=(e>0)&&this._getSearchFolder();
if(a&&a.isRemote()){
t.enable(ZmOperation.TAG_MENU,false)
}};
ZmListController.prototype._resetToolbarOperations=function(){
this._resetOperations(this._toolbar[this._currentView],this.getSelectionCount())
};
ZmListController.prototype._getSearchFolderId=function(){
var e=this._activeSearch&&this._activeSearch.search;
return e&&e.singleTerm&&e.folderId
};
ZmListController.prototype._getSearchFolder=function(){
var e=this._getSearchFolderId();
return e&&appCtxt.getById(e)
};
ZmListController.prototype._cacheList=function(e,a){
if(this._list){
var t=e.getResults().getVector();
a=a?a:parseInt(e.getAttribute("offset"));
this._list.cache(a,t)
}else{
this._list=e.getResults(type)
}};
ZmListController.prototype._search=function(r,n,o,h,e,t,s){
var a={
query:this.getSearchString(),queryHint:this.getSearchStringHint(),types:((this._activeSearch&&this._activeSearch.search)?this._activeSearch.search.types:[]),sortBy:appCtxt.get(ZmSetting.SORTING_PREF,r),offset:n,limit:o,lastId:t,lastSortVal:s};
this._getMoreSearchParams(a);
var l=new ZmSearch(a);
if(e){
this._currentSearch=l
}
appCtxt.getSearchController().redoSearch(l,true,null,h)
};
ZmListController.prototype._paginate=function(c,r,s,o){
var a=false;
var t=this._listView[c];
var n,d;
o=o||t.getLimit(n);
if(t._isPageless){
n=this._list.size();
a=true
}else{
n=t.getNewOffset(r);
a=(n+o>this._list.size());
this.currentPage=this.currentPage+(r?1:-1);
this.maxPage=Math.max(this.maxPage,this.currentPage)
}
if(a&&this._list.hasMore()){
t.offset=n;
if(t._isPageless){
d=o
}else{
var m=(n+o)-this._list.size();
d=m<o&&m>0?m:o;
if(d<o){
n=((n+o)-d)+1
}}
if(this._searchPending){
return false
}
var l=t.getList();
var u=l&&l.getLast();
var h=(u&&u.id)?u.sf:null;
var e=h?u.id:null;
this._setItemCountText(ZmMsg.loading);
this._searchPending=true;
var f=new AjxCallback(this,this._handleResponsePaginate,[c,false,s,n]);
this._search(c,n,d,f,true,e,h);
return false
}else{
if(!t._isPageless){
t.offset=n;
this._resetOperations(this._toolbar[c],0);
this._resetNavToolBarButtons(c);
this._setViewContents(c);
this._resetSelection();
return true
}}};
ZmListController.prototype._handleResponsePaginate=function(m,o,r,s,p,e){
var c=p.getResponse();
this._list.setHasMore(c.getAttribute("more"));
this._cacheList(c,s);
var a=this._listView[this._currentView];
var l=a._isPageless?this.getSelectionCount():0;
this._resetOperations(this._toolbar[m],l);
var t=o?this.getSelection()[0]:null;
var n=t?a.getItemIndex(t):-1;
var u=c&&c.getResults().getArray();
if(a._isPageless&&u&&u.length){
a._itemsToAdd=u
}else{
a._itemsToAdd=null
}
var f=(a._isPageless&&(a.size()==0));
this._setViewContents(m);
if(a.allSelected){
for(var h=0,d=u.length;
h<d;
h++){
a.selectItem(u[h],true);
a.setSelectionCbox(u[h],false)
}
a.setSelectionHdrCbox(true)
}
this._resetNavToolBarButtons(m);
if(!e&&!a._isPageless){
this._resetSelection(n)
}else{
if(f){
a._setNextSelection()
}}
if(!appCtxt.isChildWindow){
appCtxt.getAppController().focusContentPane()
}
this._searchPending=false
};
ZmListController.prototype._getMoreSearchParams=function(e){};
ZmListController.prototype._checkReplenish=function(n){
var e=this.getCurrentView();
var o=e.getList();
var t=false;
if(o){
var a=e.getLimit()-e.size();
if(a>e.getReplenishThreshold()){
this._replenishList(this._currentView,a,n);
t=true
}}
if(n&&!t){
n.run()
}};
ZmListController.prototype._handleEmptyList=function(e){
if(this.currentPage>1){
this._paginate(this._currentView,false,0)
}else{
e.removeAll(true);
e._setNoResultsHtml();
this._resetNavToolBarButtons(this._currentView);
e._checkItemCount()
}};
ZmListController.prototype._replenishList=function(r,a,h){
var t=this._listView[r].offset+this._listView[r].size();
var l=this._list.size();
if(t<l){
var s=(s>l)?l:(t+a);
var n=this._list.getVector().getArray();
var o=n.slice(t,s);
var e=AjxVector.fromArray(o);
this._listView[r].replenish(e);
if(h){
h.run()
}}else{
this._getMoreToReplenish(r,a,h)
}};
ZmListController.prototype._resetSelection=function(t){
var a=this.getCurrentView().getList();
if(a){
var e=t>=0?t:0;
var o=a.get(e);
this._listView[this._currentView].setSelection(o,false)
}};
ZmListController.prototype._getMoreToReplenish=function(t,n,h){
if(this._list.hasMore()){
var o=this._listView[t].getList();
var a=o.getLast();
var e=(a&&a.id)?a.sf:null;
var s=e?a.id:null;
var r=new AjxCallback(this,this._handleResponseGetMoreToReplenish,[t,h]);
this._search(t,this._list.size(),n,r,false,s,e)
}else{
if(h){
h.run()
}}};
ZmListController.prototype._handleResponseGetMoreToReplenish=function(a,s,t){
var e=t.getResponse();
var o=e.getAttribute("more");
this._list.setHasMore(o);
this._cacheList(e);
var n=e.getResults().getVector();
this._listView[a].replenish(n);
this._toolbar[a].enable(ZmOperation.PAGE_FORWARD,o);
if(s){
s.run(t)
}};
ZmListController.prototype._initializeNavToolBar=function(t){
var e=new ZmNavToolBar({
parent:this._toolbar[t],context:t}
);
this._setNavToolBar(e,t)
};
ZmListController.prototype._setNavToolBar=function(t,e){
this._navToolBar[e]=t;
if(this._navToolBar[e]){
var a=new AjxListener(this,this._navBarListener);
this._navToolBar[e].addSelectionListener(ZmOperation.PAGE_BACK,a);
this._navToolBar[e].addSelectionListener(ZmOperation.PAGE_FORWARD,a)
}};
ZmListController.prototype._resetNavToolBarButtons=function(e){
var t=this._listView[e];
if(!t){
return
}
if(t._isPageless){
this._setItemCountText()
}
if(!this._navToolBar[e]){
return
}
this._navToolBar[e].enable(ZmOperation.PAGE_BACK,t.offset>0);
var a=false;
if(this._list){
a=this._list.hasMore();
if(!a&&((t.offset+t.getLimit())<this._list.size())){
a=true
}}
this._navToolBar[e].enable(ZmOperation.PAGE_FORWARD,a);
this._navToolBar[e].setText(this._getNavText(e))
};
ZmListController.prototype.enablePagination=function(t,e){
if(!this._navToolBar[e]){
return
}
if(t){
this._resetNavToolBarButtons(e)
}else{
this._navToolBar[e].enable([ZmOperation.PAGE_BACK,ZmOperation.PAGE_FORWARD],false)
}};
ZmListController.prototype._getNavText=function(e){
var o=this._getNavStartEnd(e);
if(!o){
return""
}
var a=this._getNumTotal();
var t=a?ZmMsg.navText2:ZmMsg.navText1;
return AjxMessageFormat.format(t,[o.start,o.end,a])
};
ZmListController.prototype._getNavStartEnd=function(a){
var n=this._listView[a];
var t=n.getLimit();
var o=this._list?this._list.size():0;
var s,e;
if(o>0){
s=n.offset+1;
e=Math.min(n.offset+t,o)
}
return(s&&e)?{
start:s,end:e}
:null
};
ZmListController.prototype._getNumTotal=function(){
var e=this._getSearchFolderId();
if(e&&(e!=ZmFolder.ID_TRASH)){
var t=appCtxt.getById(e);
if(t){
return t.numTotal
}}
return null
};
ZmListController._newDropDownListener=function(o){
var a=this;
var e=a._ZmListController_this;
e._propagateMenuListeners(a,ZmOperation.NEW_MENU);
var t=a.getButton(ZmOperation.NEW_MENU);
var n=a._ZmListController_newDropDownListener;
t.removeDropDownSelectionListener(n);
t.popup();
delete a._ZmListController_this;
delete a._ZmListController_newDropDownListener
};
ZmListController.prototype._getDefaultFocusItem=function(){
return this.getCurrentView()
};
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 t=this._getItemCount();
if(t==null){
return""
}
var h=this._listView[this._currentView];
var n=h&&h._list;
var a=h._getItemCountType();
var o=this._getNumTotal();
var e=o||t;
var s=a?AjxMessageFormat.format(ZmMsg[ZmItem.COUNT_KEY[a]],e):"";
if(o&&(t!=o)){
return AjxMessageFormat.format(ZmMsg.itemCount1,[t,o,s])
}else{
var r=t+(this._list.hasMore()?"+":"");
return AjxMessageFormat.format(ZmMsg.itemCount,[r,s])
}};
ZmListController.prototype._getItemCount=function(){
var t=this.getCurrentView();
var e=t&&t._list;
if(!e){
return null
}
return e.size()
};
ZmListController.prototype._setItemCountText=function(t){
t=t||this._getItemCountText();
var e=this._itemCountText[this._currentView];
if(e){
e.setText(t)
}};
ZmListController.prototype._setupContinuation=function(n,a,h,r){
var e=new AjxCallback(this,n,a);
h.finalCallback=new AjxCallback(this,this._continueAction,{
actionCallback:e,allDoneCallback:r}
);
h.count=this._continuation.count;
h.idsOnly=true;
var t=h.items||[];
var o=t[0];
var s=(o&&o.list)||this._list;
if(s&&(s.type==ZmItem.MIXED)&&o._mixedType){
s.type=o._mixedType
}
if(!this._continuation.lastItem){
this._continuation.lastItem=s.getVector().getLast();
this._continuation.totalItems=s.size()
}
return s
};
ZmListController.prototype._continueAction=function(o,t){
var a=this._listView[this._currentView];
var s=t&&t.cancelled;
var u=this._continuation.result;
var e=u?u.getAttribute("more"):this._list.hasMore();
if(a.allSelected&&e&&!s){
var r=this._currentSearch;
var n=ZmListController.CONTINUATION_SEARCH_ITEMS;
var c={
query:this.getSearchString(),queryHint:this.getSearchStringHint(),types:r.types,sortBy:r.sortBy,limit:n,idsOnly:true};
var h=u?u.getResults():this._list.getArray();
var l=this._continuation.lastItem;
if(!l){
l=h&&h[h.length-1]
}
if(l){
c.lastId=l.id;
c.lastSortVal=l.sf
}else{
c.offset=n+(this._continuation.search?this._continuation.search.offset:0)
}
this._continuation.count=t.numItems;
if(!this._continuation.totalItems){
this._continuation.totalItems=h.length
}
this._continuation.search=new ZmSearch(c);
var d=new AjxCallback(this,this._handleResponseContinueAction,[o.actionCallback]);
appCtxt.getSearchController().redoSearch(this._continuation.search,true,null,d)
}else{
if(u){
if(a.allSelected){
if(t.actionText){
t.actionSummary=ZmList.getActionSummary(t.actionText,this._continuation.totalItems,u.type,t.actionArg)
}
a.deselectAll()
}
this._continuation={
count:0,totalItems:0}
}
if(o.allDoneCallback){
o.allDoneCallback.run()
}
ZmList.killProgressDialog(t.actionSummary,t.actionLogItem,t.closeChildWin)
}};
ZmListController.prototype._handleResponseContinueAction=function(t,e){
this._continuation.result=e.getResponse();
var a=this._continuation.result.getResults();
if(a.length){
this._continuation.lastItem=a[a.length-1];
this._continuation.totalItems+=a.length;
t.args=t.args||[];
t.args.unshift(a);
t.run()
}else{}};
ZmListController.prototype._checkItemCount=function(){
var e=this._listView[this._currentView];
e._checkItemCount();
e._handleResponseCheckReplenish(true)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmTreeController")){
ZmTreeController=function(e){
if(arguments.length==0){
return
}
ZmController.call(this,null);
this.type=e;
this._opc=appCtxt.getOverviewController();
this._listeners={};
this._listeners[ZmOperation.DELETE]=new AjxListener(this,this._deleteListener);
this._listeners[ZmOperation.MOVE]=new AjxListener(this,this._moveListener);
this._listeners[ZmOperation.EXPAND_ALL]=new AjxListener(this,this._expandAllListener);
this._listeners[ZmOperation.MARK_ALL_READ]=new AjxListener(this,this._markAllReadListener);
this._listeners[ZmOperation.SYNC]=new AjxListener(this,this._syncListener);
this._listeners[ZmOperation.SYNC_ALL]=new AjxListener(this,this._syncAllListener);
this._listeners[ZmOperation.EDIT_PROPS]=new AjxListener(this,this._editPropsListener);
this._listeners[ZmOperation.EMPTY_FOLDER]=new AjxListener(this,this._emptyListener);
this._dragSrc=new DwtDragSource(Dwt.DND_DROP_MOVE);
this._dragSrc.addDragListener(new AjxListener(this,this._dragListener));
this._dropTgt=new DwtDropTarget(ZmTreeController.DROP_SOURCES[e]);
this._dropTgt.addDropListener(new AjxListener(this,this._dropListener));
this._treeView={};
this._hideEmpty={};
this._dataTree={}
};
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.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(t,r,n,a,e,o){
var s=t&&t.getOp(r);
if(!s){
return
}
if(n){
s.setText(n)
}
if(a){
s.setImage(a)
}
if(e!=null){
s.setEnabled(e)
}
if(o!=null){
s.setVisible(o)
}};
ZmTreeController.prototype._resetButtonPerSetting=function(a,o,t){
var e=a.getOp(o);
if(e){
if(t){
e.setVisible(true);
if(appCtxt.isOffline&&!appCtxt.getActiveAccount().isZimbraAccount){
e.setEnabled(false)
}}else{
e.setVisible(false)
}}};
ZmTreeController.prototype._enableRecoverDeleted=function(a,t){
op=a.getOp(ZmOperation.RECOVER_DELETED_ITEMS);
if(!op){
return
}
var e=appCtxt.get(ZmSetting.DUMPSTER_ENABLED);
op.setVisible(e&&t);
op.setEnabled(t)
};
ZmTreeController.prototype.toString=function(){
return"ZmTreeController"
};
ZmTreeController.prototype.show=function(s){
var r=s.overviewId;
this._hideEmpty[r]=s.hideEmpty;
if(!this._treeView[r]||s.forceCreate){
this._treeViewCreated=false;
this._treeView[r]=null;
this._treeView[r]=this.getTreeView(r,true)
}
var e=(appCtxt.multiAccounts&&this.type==ZmOrganizer.ZIMLET);
var a=e?appCtxt.accountList.mainAccount:(this.type==ZmOrganizer.VOICE?r:s.account);
var o=this.getDataTree(a);
if(o){
s.dataTree=o;
var t=ZmOrganizer.OPEN_SETTING[this.type];
s.collapsed=(!e&&(!(!t||(appCtxt.get(t,null,a)!==false))));
var n=this._opc.getOverview(r);
if(n.showNewButtons){
this._setupNewOp(s)
}
this._treeView[r].set(s);
this._checkTreeView(r)
}
if(!this._treeViewCreated){
this._treeViewCreated=true;
this._postSetup(r,s.account)
}
return this._treeView[r]
};
ZmTreeController.prototype.getTreeView=function(t,e){
if(e&&!this._treeView[t]){
this._treeView[t]=this._setup(t)
}
return this._treeView[t]
};
ZmTreeController.prototype.clearTreeView=function(e){
if(this._treeView[e]){
this._treeView[e].dispose();
delete this._treeView[e]
}};
ZmTreeController.prototype.getDropTarget=function(){
return this._dropTgt
};
ZmTreeController.prototype.getDataTree=function(e){
e=e||appCtxt.getActiveAccount();
var t=this._dataTree[e.id];
if(!t){
t=this._dataTree[e.id]=appCtxt.getTree(this.type,e);
if(t){
t.addChangeListener(this._getTreeChangeListener())
}}
return t
};
ZmTreeController.prototype.dispose=function(){
var e=appCtxt.getActiveAccount();
var t=this._dataTree[e.id];
if(!t){
return
}
t.removeChangeListener(this._getTreeChangeListener())
};
ZmTreeController.prototype.setVisibleIfExists=function(t,e,a){
var o=t.getOp(e);
if(!o){
return
}
o.setVisible(a)
};
ZmTreeController.prototype._setupNewOp=function(o){
var a=ZmOrganizer.NEW_OP[this.type];
if(a){
var t=ZmOperation.SETTING[a];
if(!t||appCtxt.get(t)){
var e=ZmOperation.getProp(a,"tooltipKey");
o.newButton={
image:ZmOperation.getProp(a,"image"),tooltip:e?ZmMsg[e]:null,callback:new AjxCallback(this,this._newListener)}
}}};
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(t){
var e=this._initializeTreeView(t);
if(this._opc.getOverview(t).actionSupported){
this._initializeActionMenus()
}
return e
};
ZmTreeController.prototype._postSetup=function(r,s){
var a=this.getTreeView(r);
if(!a.isCheckedStyle&&!ZmOrganizer.HAS_COLOR[this.type]){
return
}
var t=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,s);
var e=a.getTreeItemById(t);
if(!e){
return
}
if(a.isCheckedStyle){
e.showCheckBox(false)
}
var n=e.getItems();
for(var o=0;
o<n.length;
o++){
this._fixupTreeNode(n[o],null,a,true)
}};
ZmTreeController.prototype._fixupTreeNode=function(s,e,t,o){
if(s._isSeparator){
return
}
e=e||s.getData(Dwt.KEY_OBJECT);
if(e){
if(ZmOrganizer.HAS_COLOR[this.type]){
this._setTreeItemColor(s,e)
}
if(t.isCheckedStyle){
if((e.type==this.type&&t.isCheckedStyle)||e.nId==ZmOrganizer.ID_TRASH||e.nId==ZmOrganizer.ID_DRAFTS){
s.setChecked(e.isChecked,true)
}else{
s.showCheckBox(false);
s.enableSelection(true)
}}
this._expandTreeItem(s,o)
}
var n=s.getItems();
for(var a=0;
a<n.length;
a++){
this._fixupTreeNode(n[a],null,t,o)
}};
ZmTreeController.prototype._expandTreeItem=function(n,a){
var t=appCtxt.get(ZmSetting.FOLDERS_EXPANDED);
var e=n.getData(Dwt.KEY_ID);
var o=n.parent;
if(t[e]&&o&&(o instanceof DwtTreeItem)&&o.getExpanded()){
n.setExpanded(true,null,a)
}};
ZmTreeController.prototype._expandTreeItems=function(a){
if(a._isSeparator){
return
}
this._expandTreeItem(a);
var t=a.getItems();
for(var e=0;
e<t.length;
e++){
this._expandTreeItems(t[e])
}};
ZmTreeController.prototype._setTreeItemColor=function(t,e){
t.setImage(e.getIconWithColor())
};
ZmTreeController.prototype._getTreeItemColorClassName=function(a,e){
if(!a||!e){
return null
}
if(e.isInTrash()){
return null
}
var t=e.color?e.color:ZmOrganizer.DEFAULT_COLOR[e.type];
return(t&&(t!=ZmOrganizer.C_NONE))?ZmTreeController.COLOR_CLASS[t]:""
};
ZmTreeController.prototype._initializeTreeView=function(o){
var a=this._opc.getOverview(o);
var t={
parent:a,parentElement:a.getTreeParent(this.type),overviewId:o,type:this.type,headerClass:a.headerClass,dragSrc:(a.dndSupported?this._dragSrc:null),dropTgt:(a.dndSupported?this._dropTgt:null),treeStyle:a.treeStyle,isCheckedByDefault:a.isCheckedByDefault,allowedTypes:this._getAllowedTypes(),allowedSubTypes:this._getAllowedSubTypes()};
t.id=ZmId.getTreeId(o,t.type);
var e=this._createTreeView(t);
e.addSelectionListener(new AjxListener(this,this._treeViewListener));
e.addTreeListener(new AjxListener(this,this._treeListener));
return e
};
ZmTreeController.prototype._createTreeView=function(e){
return new ZmTreeView(e)
};
ZmTreeController.prototype._initializeActionMenus=function(){
var o=this;
var a=this._createActionMenu;
var t=this._getHeaderActionMenuOps();
if(!this._headerActionMenu&&t){
var e=[this._shell,t];
this._headerActionMenu=new AjxCallback(o,a,e)
}
var t=this._getActionMenuOps();
if(!this._actionMenu&&t){
var e=[this._shell,t];
this._actionMenu=new AjxCallback(o,a,e)
}};
ZmTreeController.prototype._getHeaderActionMenu=function(e){
if(this._headerActionMenu instanceof AjxCallback){
var t=this._headerActionMenu;
this._headerActionMenu=t.run()
}
return this._headerActionMenu
};
ZmTreeController.prototype._getActionMenu=function(a,t){
var e=this;
if(t&&t.type==ZmOrganizer.SEARCH){
e=this._opc.getTreeController(ZmOrganizer.SEARCH)
}
if(e._actionMenu instanceof AjxCallback){
var o=e._actionMenu;
e._actionMenu=o.run()
}
return e._actionMenu
};
ZmTreeController.prototype._sharingPossible=function(t){
if(appCtxt.isZDOnline()){
return true
}
var e=appCtxt.getMsgDialog();
e.setMessage(ZMsg["offline.ONLINE_ONLY_OP"]);
e.popup();
return false
};
ZmTreeController.prototype._createActionMenu=function(o,t){
if(!t){
return
}
var n=new ZmActionMenu({
parent:o,menuItems:t}
);
t=n.opList;
for(var e=0;
e<t.length;
e++){
var a=t[e];
if(this._listeners[a]){
n.addSelectionListener(a,this._listeners[a])
}}
n.addPopdownListener(new AjxListener(this,this._menuPopdownActionListener));
return n
};
ZmTreeController.prototype._getAllowedTypes=function(){
var e={};
e[this.type]=true;
return e
};
ZmTreeController.prototype._getAllowedSubTypes=function(){
var e={};
e[this.type]=true;
return e
};
ZmTreeController.prototype._doCreate=function(params){
params.type=this.type;
var funcName=ZmOrganizer.CREATE_FUNC[this.type];
if(funcName){
var func=eval(funcName);
func(params)
}};
ZmTreeController.prototype._doDelete=function(e){
e._delete()
};
ZmTreeController.prototype._doEmpty=function(t){
var n=false;
t.empty(n);
var e=appCtxt.getCurrentController();
if(e&&e._getSearchFolderId){
var o=e._getSearchFolderId();
if(o&&(o==t.id)){
var a=e.getCurrentView();
a._resetList();
a._setNoResultsHtml()
}}};
ZmTreeController.prototype._doRename=function(e,t){
e.rename(t)
};
ZmTreeController.prototype._doMove=function(e,t){
e.move(t)
};
ZmTreeController.prototype._doMarkAllRead=function(e){
e.markAllRead()
};
ZmTreeController.prototype._doSync=function(e){
e.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 o=h.item;
var s=o.getData(ZmTreeView.KEY_TYPE);
if(!s){
return
}
var c=o.getData(Dwt.KEY_OBJECT);
if(c){
this._actionedOrganizer=c;
if(c.noSuchFolder){
var t=appCtxt.getFolderTree();
if(t){
t.handleDeleteNoSuchFolder(c)
}
return
}
if(c&&c.type==ZmOrganizer.SEARCH){
var n=this._opc.getTreeController(ZmOrganizer.SEARCH);
if(n){
n._actionedOrganizer=c;
n._actionedOverviewId=o.getData(ZmTreeView.KEY_ID)
}}}
var e=o.getData(Dwt.KEY_ID);
var a=this._actionedOverviewId=o.getData(ZmTreeView.KEY_ID);
var l=this._opc.getOverview(a);
if(!l){
return
}
if(h.detail==DwtTree.ITEM_ACTIONED){
if(l.actionSupported){
var r=(c.nId==ZmOrganizer.ID_ROOT||c.isDataSource(ZmAccount.TYPE_IMAP))?this._getHeaderActionMenu(h):this._getActionMenu(h,c);
if(r){
this.resetOperations(r,s,e);
r.popup(0,h.docX,h.docY)
}}}else{
if((h.detail==DwtTree.ITEM_SELECTED)&&c){
if(appCtxt.multiAccounts&&(c instanceof ZmOrganizer)){
this._handleMultiAccountItemSelection(h,l,o,c)
}else{
this._handleItemSelection(h,l,o,c)
}}else{
if((h.detail==DwtTree.ITEM_DBL_CLICKED)&&c){
this._itemDblClicked(c)
}}}};
ZmTreeController.prototype._handleItemSelection=function(t,s,n,e){
s.itemSelected(n);
if(t.kbNavEvent){
DwtControl._scrollIntoView(n._itemDiv,s.getHtmlElement());
ZmController.noFocus=true
}
if(s._treeSelectionShortcutDelayActionId){
AjxTimedAction.cancelAction(s._treeSelectionShortcutDelayActionId)
}
if((s.selectionSupported||e._showFoldersCallback)&&!n._isHeader){
if(t.kbNavEvent&&ZmTreeController.TREE_SELECTION_SHORTCUT_DELAY){
var o=new AjxTimedAction(this,ZmTreeController.prototype._treeSelectionTimedAction,[e,s]);
s._treeSelectionShortcutDelayActionId=AjxTimedAction.scheduleAction(o,ZmTreeController.TREE_SELECTION_SHORTCUT_DELAY)
}else{
if((appCtxt.multiAccounts&&(e instanceof ZmOrganizer))||(e.type==ZmOrganizer.VOICE)){
appCtxt.getCurrentApp().getOverviewContainer().deselectAll(s);
var a=e.account||appCtxt.accountList.mainAccount;
appCtxt.accountList.setActiveAccount(a)
}
this._itemSelected(e)
}}};
ZmTreeController.prototype._itemSelected=function(e){
if(e&&e._showFoldersCallback){
e._showFoldersCallback.run()
}else{
this._itemClicked(e)
}};
ZmTreeController.prototype._handleMultiAccountItemSelection=function(t,o,a,e){
this._handleItemSelection(t,o,a,e)
};
ZmTreeController.prototype._treeSelectionTimedAction=function(e,t){
if(t._treeSelectionShortcutDelayActionId){
AjxTimedAction.cancelAction(t._treeSelectionShortcutDelayActionId)
}
this._itemSelected(e)
};
ZmTreeController.prototype._treeListener=function(r){
var n=r&&r.item;
var a=n&&n._tree&&n._tree.overviewId;
var l=appCtxt.getOverviewController().getOverview(a);
var s=l.account;
if(appCtxt.multiAccounts&&s){
appCtxt.accountList.setActiveAccount(s)
}
var o=r.detail==DwtTree.ITEM_EXPANDED;
var e=(r.detail==DwtTree.ITEM_COLLAPSED||o)?n.getData(Dwt.KEY_ID):null;
if(e&&!n._isHeader){
var h=appCtxt.get(ZmSetting.FOLDERS_EXPANDED,e)||false;
if(typeof(h)=="string"){
h=(h==="true")
}
if(h!=o){
appCtxt.set(ZmSetting.FOLDERS_EXPANDED,o,e)
}
if(o){
this._expandTreeItems(n)
}}
if(!(r&&r.detail&&l&&l.isAppOverview&&n._isHeader)){
return
}
var t=appCtxt.getSettings(s);
var c=t.getSetting(ZmOrganizer.OPEN_SETTING[this.type]);
if(c){
c.setValue(r.detail==DwtTree.ITEM_EXPANDED)
}};
ZmTreeController.prototype._treeChangeListener=function(e){
this._evHandled={};
for(var t in this._treeView){
this._changeListener(e,this._treeView[t],t)
}};
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_FLAGS){
var flag=ev.getDetail("flag");
var state=ev.getDetail("state");
if((flag==ZmItem.FLAG_UNREAD)&&!state){
node.setText(organizer.getName(false));
this._evHandled[overviewId]=true
}}else{
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)?ev.type:organizer.parent.type;
if(type!=this.type){
continue
}
if(organizer.isOfflineGlobalSearch){
appCtxt.getApp(ZmApp.MAIL).getOverviewContainer().addSearchFolder(organizer);
return
}else{
node=this._addNew(treeView,parentNode,organizer,idx)
}}else{
if(ev.event==ZmEvent.E_MOVE){
node.dispose();
if(parentNode){
node=this._addNew(treeView,parentNode,organizer,idx)
}}}
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]){
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])){
var parentNode=this._getParentNode(organizer,ev,overviewId);
if(!parentNode){
return
}
this._updateOverview(parentNode,node,fields,organizer,treeView);
this._evHandled[overviewId]=true
}}}}}}};
ZmTreeController.prototype._updateOverview=function(parentNode,node,fields,organizer,treeView){
node.setText(organizer.getName(treeView._showUnread));
if(fields&&fields[ZmOrganizer.F_NAME]){
if(parentNode&&(parentNode.getNumChildren()>1)){
node.dispose();
var idx=ZmTreeView.getSortIndex(parentNode,organizer,eval(ZmTreeView.COMPARE_FUNC[organizer.type]));
node=treeView._addNew(parentNode,organizer,idx)
}else{
node.setDndText(organizer.getName())
}
appCtxt.getAppViewMgr().updateTitle()
}
this._fixupTreeNode(node,organizer,treeView)
};
ZmTreeController.prototype._getParentNode=function(e,a,o){
if(e.parent){
var t=(e.parent.nId==ZmOrganizer.ID_ROOT)?a.type:null;
return this._opc.getOverview(o).getTreeItemById(e.parent.id,t)
}};
ZmTreeController.prototype._addNew=function(o,a,t,e){
return o._addNew(a,t,e)
};
ZmTreeController.prototype._newListener=function(a,o){
this._pendingActionData=this._getActionedOrganizer(a);
var t=this._getNewDialog();
if(!this._newCb){
this._newCb=new AjxCallback(this,this._newCallback)
}
if(this._pendingActionData&&!appCtxt.getById(this._pendingActionData.id)){
this._pendingActionData=appCtxt.getFolderTree(o).root
}
if(!o&&appCtxt.multiAccounts){
var e=this._opc.getOverview(this._actionedOverviewId);
o=e&&e.account
}
ZmController.showDialog(t,this._newCb,this._pendingActionData,o);
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmTreeController.prototype._renameListener=function(e){
this._pendingActionData=this._getActionedOrganizer(e);
var t=this._getRenameDialog();
if(!this._renameCb){
this._renameCb=new AjxCallback(this,this._renameCallback)
}
ZmController.showDialog(t,this._renameCb,this._pendingActionData);
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmTreeController.prototype._deleteListener=function(e){
this._doDelete(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._emptyListener=function(e){
this._doEmpty(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._moveListener=function(e){
this._pendingActionData=this._getActionedOrganizer(e);
var t=appCtxt.getChooseFolderDialog();
if(!this._moveCb){
this._moveCb=new AjxCallback(this,this._moveCallback)
}
ZmController.showDialog(t,this._moveCb,this._getMoveParams(t));
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmTreeController.prototype._getMoveParams=function(t){
var e={};
e[ZmFolder.ID_SPAM]=true;
return{
data:this._pendingActionData,treeIds:[this.type],overviewId:t.getOverviewId(ZmOrganizer.APP[this.type]),omit:e,title:AjxStringUtil.htmlEncode(this._getMoveDialogTitle()),description:ZmMsg.targetFolder,appName:ZmOrganizer.APP[this.type]}
};
ZmTreeController.prototype._expandAllListener=function(o){
var e=this._getActionedOrganizer(o);
var t=this.getTreeView(this._actionedOverviewId);
var a=t.getTreeItemById(e.id);
window.duringExpandAll=true;
a.setExpanded(true,true);
window.duringExpandAll=false;
if(window.afterExpandAllCallback){
window.afterExpandAllCallback();
window.afterExpandAllCallback=null
}};
ZmTreeController.prototype._markAllReadListener=function(e){
this._doMarkAllRead(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._syncAllListener=function(r){
for(var n in this._treeView){
var o=this.getTreeView(n);
var h=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,appCtxt.getActiveAccount());
var l=o.getTreeItemById(h);
var e=l&&l.getItems();
if(e){
for(var s=0;
s<e.length;
s++){
var t=e[s];
var a=t&&t.getData&&t.getData(Dwt.KEY_OBJECT);
if(a&&(a.isFeed()||a.hasFeeds())){
this._syncFeeds(a)
}}}}};
ZmTreeController.prototype._syncListener=function(e){
this._syncFeeds(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._syncFeeds=function(o){
if(o.isFeed()){
this._doSync(o)
}else{
if(o.hasFeeds()){
var e=o.children.getArray();
var n=o.children.size();
for(var t=0;
t<n;
t++){
if(e[t].isFeed()||(e[t].hasFeeds&&e[t].hasFeeds())){
this._syncFeeds(e[t])
}}}}};
ZmTreeController.prototype._editPropsListener=function(t){
var e=appCtxt.getFolderPropsDialog();
e.popup(this._getActionedOrganizer(t))
};
ZmTreeController.prototype._dragListener=function(e){
switch(e.action){
case DwtDragEvent.SET_DATA:e.srcData={
data:e.srcControl.getData(Dwt.KEY_OBJECT),controller:this};
break
}};
ZmTreeController.prototype._menuPopdownActionListener=function(){
if(this._pendingActionData){
return
}
var e=this.getTreeView(this._actionedOverviewId);
if(this._actionedOrganizer&&(e.getSelected()!=this._actionedOrganizer)){
var t=e.getTreeItemById(this._actionedOrganizer.id);
if(t){
t._setActioned(false)
}}};
ZmTreeController.prototype._newCallback=function(e){
this._doCreate(e);
this._clearDialog(this._getNewDialog())
};
ZmTreeController.prototype._renameCallback=function(e,t){
this._doRename(e,t);
this._clearDialog(this._getRenameDialog())
};
ZmTreeController.prototype._moveCallback=function(e){
this._doMove(this._pendingActionData,e);
this._clearDialog(appCtxt.getChooseFolderDialog())
};
ZmTreeController.prototype._deleteShieldYesCallback=function(e){
this._doDelete(e);
this._clearDialog(this._deleteShield)
};
ZmTreeController.prototype._emptyShieldYesCallback=function(e){
this._doEmpty(e);
this._clearDialog(this._emptyShield)
};
ZmTreeController.prototype._getEmptyShieldWarning=function(t){
var e=this._pendingActionData=this._getActionedOrganizer(t);
var a=this._emptyShield=appCtxt.getOkCancelMsgDialog();
a.reset();
a.registerCallback(DwtDialog.OK_BUTTON,this._emptyShieldYesCallback,this,e);
a.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,this._emptyShield);
var n=(e.nId!=ZmFolder.ID_TRASH)?(AjxMessageFormat.format(ZmMsg.confirmEmptyFolder,e.getName())):ZmMsg.confirmEmptyTrashFolder;
a.setMessage(n,DwtMessageDialog.WARNING_STYLE);
var s=(e.nId==ZmFolder.ID_TRASH||e.nId==ZmFolder.ID_SPAM)?DwtDialog.OK_BUTTON:DwtDialog.CANCEL_BUTTON;
a.associateEnterWithButton(s);
a.popup(null,s);
if(!(e.nId==ZmFolder.ID_SPAM||e.isInTrash())){
var o=a.getButton(DwtDialog.CANCEL_BUTTON);
o.focus()
}};
ZmTreeController.prototype._getActionedOrganizer=function(e){
if(this._actionedOrganizer){
return this._actionedOrganizer
}
var a=e.item;
while(a){
var t=a.getData(Dwt.KEY_OBJECT);
if(t instanceof ZmOrganizer){
this._actionedOrganizer=t;
return this._actionedOrganizer
}
a=a.parent
}
return null
};
ZmTreeController.prototype._checkTreeView=function(o){
if(!o||!this._treeView[o]){
return
}
var t=this._opc.getOverview(o).account;
var a=this.getDataTree(t);
var e=(ZmOrganizer.HIDE_EMPTY[this.type]&&a&&(a.size()==0));
this._treeView[o].setVisible(!e)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmTagTreeController")){
ZmTagTreeController=function(){
ZmTreeController.call(this,ZmOrganizer.TAG);
this._listeners[ZmOperation.NEW_TAG]=new AjxListener(this,this._newListener);
this._listeners[ZmOperation.RENAME_TAG]=new AjxListener(this,this._renameListener);
this._listeners[ZmOperation.TAG_COLOR_MENU]=new AjxListener(this,this._colorListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._browseListener)
};
ZmTagTreeController.prototype=new ZmTreeController;
ZmTagTreeController.prototype.constructor=ZmTagTreeController;
ZmTagTreeController.prototype.toString=function(){
return"ZmTagTreeController"
};
ZmTagTreeController.prototype._getActionMenu=function(){
var t=ZmTreeController.prototype._getActionMenu.call(this);
if(t&&!t._initialized){
var e=t.getMenuItem(ZmOperation.TAG_COLOR_MENU);
if(e){
e.getMenu().addSelectionListener(this._listeners[ZmOperation.TAG_COLOR_MENU])
}
t._initialized=true
}
return t
};
ZmTagTreeController.prototype.resetOperations=function(a,t,o){
var e=appCtxt.getById(o);
a.enableAll(true);
if(e.isSystem()){
a.enable([ZmOperation.RENAME_TAG,ZmOperation.TAG_COLOR_MENU,ZmOperation.DELETE],false)
}
a.enable(ZmOperation.MARK_ALL_READ,(e&&(e.numUnread>0)))
};
ZmTagTreeController.prototype._getHeaderActionMenuOps=function(){
return[ZmOperation.NEW_TAG,ZmOperation.BROWSE]
};
ZmTagTreeController.prototype._getActionMenuOps=function(){
return[ZmOperation.NEW_TAG,ZmOperation.MARK_ALL_READ,ZmOperation.RENAME_TAG,ZmOperation.DELETE,ZmOperation.TAG_COLOR_MENU]
};
ZmTagTreeController.prototype._getNewDialog=function(){
return appCtxt.getNewTagDialog()
};
ZmTagTreeController.prototype._getRenameDialog=function(){
return appCtxt.getRenameTagDialog()
};
ZmTagTreeController.prototype._itemClicked=function(t){
var e;
switch(appCtxt.getCurrentAppName()){
case ZmApp.CONTACTS:e=ZmItem.CONTACT;
break;
case ZmApp.NOTEBOOK:e=ZmItem.PAGE;
break;
case ZmApp.CALENDAR:e=ZmItem.APPT;
break;
case ZmApp.BRIEFCASE:e=ZmItem.BRIEFCASE_ITEM;
break;
case ZmApp.TASKS:e=ZmItem.TASK;
break;
default:e=ZmId.SEARCH_MAIL;
break
}
var o={
query:t.createQuery(),searchFor:e,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),accountName:(appCtxt.multiAccounts?t.getAccount().name:null)};
var a=appCtxt.getSearchController();
a.searchAllAccounts=false;
a.search(o)
};
ZmTagTreeController.prototype._deleteListener=function(t){
var e=this._pendingActionData=this._getActionedOrganizer(t);
var a=this._deleteShield=appCtxt.getYesNoCancelMsgDialog();
a.reset();
a.registerCallback(DwtDialog.NO_BUTTON,this._clearDialog,this,this._deleteShield);
a.registerCallback(DwtDialog.YES_BUTTON,this._deleteShieldYesCallback,this,e);
var o=AjxMessageFormat.format(ZmMsg.askDeleteTag,e.getName(false,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH));
a.setMessage(o,DwtMessageDialog.WARNING_STYLE);
a.popup()
};
ZmTagTreeController.prototype._colorListener=function(a){
var e=this._getActionedOrganizer(a);
if(e){
var t=a.item.getData(ZmOperation.MENUITEM_ID);
if(String(t).match(/^#/)){
e.setRGB(t)
}else{
e.setColor(t)
}}};
ZmTagTreeController.prototype._browseListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowsePickers([ZmPicker.TAG])
}};
ZmTagTreeController.prototype._dropListener=function(n){
var s=n.srcData.data;
if(n.action==DwtDropEvent.DRAG_ENTER){
var o=(s instanceof Array)?s[0]:s;
var t=n.targetControl.getData(Dwt.KEY_OBJECT);
if(t.id==ZmOrganizer.ID_ROOT){
n.doIt=false
}else{
if(o instanceof ZmContact&&(o.isGal||o.isShared())){
n.doIt=false
}else{
if(o&&(o instanceof ZmItem)&&o.isShared()){
n.doIt=false
}else{
if(appCtxt.multiAccounts&&t.getAccount()!=o.account){
n.doIt=false
}else{
n.doIt=this._dropTgt.isValidTarget(s)
}}}}}else{
if(n.action==DwtDropEvent.DRAG_DROP){
var e=n.srcData.controller;
var a=(s instanceof Array)?s:[s];
e._doTag(a,n.targetControl.getData(Dwt.KEY_OBJECT),true)
}}};
ZmTagTreeController.prototype._changeListener=function(r,a,h){
var t=r.getDetail("fields");
var o=r.getDetail("organizers");
for(var n=0;
n<o.length;
n++){
var e=o[n];
if(r.event==ZmEvent.E_MODIFY&&((t&&t[ZmOrganizer.F_COLOR]))){
var s=a.getTreeItemById(e.id);
if(s){
s.setImage(e.getIconWithColor())
}}else{
ZmTreeController.prototype._changeListener.call(this,r,a,h)
}}};
ZmTagTreeController.prototype._setTreeItemColor=function(t,e){}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmFolderTreeController")){
ZmFolderTreeController=function(t,e){
if(!arguments.length){
return
}
ZmTreeController.call(this,(t||ZmOrganizer.FOLDER));
this._listeners[ZmOperation.NEW_FOLDER]=new AjxListener(this,this._newListener);
this._listeners[ZmOperation.RENAME_FOLDER]=new AjxListener(this,this._renameListener);
this._listeners[ZmOperation.SHARE_FOLDER]=new AjxListener(this,this._shareFolderListener);
this._listeners[ZmOperation.EMPTY_FOLDER]=new AjxListener(this,this._emptyListener);
this._listeners[ZmOperation.RECOVER_DELETED_ITEMS]=new AjxListener(this,this._recoverListener);
this._listeners[ZmOperation.SYNC_OFFLINE_FOLDER]=new AjxListener(this,this._syncOfflineFolderListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._browseListener)
};
ZmFolderTreeController.prototype=new ZmTreeController;
ZmFolderTreeController.prototype.constructor=ZmFolderTreeController;
ZmFolderTreeController.prototype.toString=function(){
return"ZmFolderTreeController"
};
ZmFolderTreeController.prototype.show=function(n){
var a=n.omit||{};
for(var s in ZmFolder.HIDE_ID){
a[s]=true
}
var o=this.type!=ZmOrganizer.VOICE&&this.getDataTree(n.account);
if(o){
for(var e in ZmFolder.HIDE_NAME){
var t=o.getByName(e);
if(t){
a[t.id]=true
}}}
n.omit=a;
return ZmTreeController.prototype.show.call(this,n)
};
ZmFolderTreeController.prototype.resetOperations=function(g,f,a){
var s=ZmMsg.emptyFolder;
var o=appCtxt.getById(a);
var r=((o.numTotal>0)||(o.children&&(o.children.size()>0)));
var n=ZmOrganizer.normalizeId(a,this.type);
if(n==ZmOrganizer.ID_ROOT||((!o.isSystem())&&!o.isSyncIssuesFolder())){
var m=(!o.link||o.isAdmin());
if(appCtxt.isOffline){
m=!o.getAccount().isMain&&o.getAccount().isZimbraAccount
}
g.enableAll(true);
g.enable(ZmOperation.SYNC,o.isFeed());
g.enable(ZmOperation.SYNC_ALL,o.isFeed()||o.hasFeeds());
g.enable(ZmOperation.SHARE_FOLDER,m);
g.enable(ZmOperation.EMPTY_FOLDER,(r||o.link));
g.enable(ZmOperation.RENAME_FOLDER,!o.isDataSource());
g.enable(ZmOperation.NEW_FOLDER,!o.disallowSubFolder);
if(o.isRemote()&&o.isReadOnly()){
g.enable([ZmOperation.NEW_FOLDER,ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER],false)
}}else{
g.enableAll(false);
if(!o.disallowSubFolder&&(n==ZmFolder.ID_INBOX||n==ZmFolder.ID_SENT||n==ZmFolder.ID_TRASH)){
g.enable(ZmOperation.NEW_FOLDER,true)
}
if(n==ZmFolder.ID_SPAM||n==ZmFolder.ID_TRASH||n==ZmFolder.ID_CHATS){
if(n==ZmFolder.ID_SPAM){
s=ZmMsg.emptyJunk
}else{
if(n==ZmFolder.ID_TRASH){
s=ZmMsg.emptyTrash
}}
g.enable(ZmOperation.EMPTY_FOLDER,r)
}
if(!o.link&&(n==ZmFolder.ID_INBOX||n==ZmFolder.ID_SENT||n==ZmFolder.ID_DRAFTS)){
g.enable([ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS],true)
}
if(appCtxt.multiAccounts){
var m=!o.getAccount().isMain&&o.getAccount().isZimbraAccount;
if(n==ZmFolder.ID_SPAM||n==ZmFolder.ID_TRASH){
m=false
}
g.enable([ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS],m)
}
if(appCtxt.isOffline&&n==ZmOrganizer.ID_SYNC_FAILURES&&r){
g.enable(ZmOperation.EMPTY_FOLDER,true)
}}
g.enable(ZmOperation.EXPAND_ALL,(o.size()>0));
if(n!=ZmOrganizer.ID_ROOT&&!o.isReadOnly()){
g.enable(ZmOperation.MARK_ALL_READ,(o.numUnread>0||o.link))
}
var l=g.getOp(ZmOperation.EMPTY_FOLDER);
if(l){
l.setText(s)
}
var d=(n==ZmOrganizer.ID_TRASH);
var h=g.getOp(ZmOperation.SYNC);
if(h){
var u=g.getOp(ZmOperation.SYNC_ALL);
var t=o.hasFeeds();
if(o.isFeed()){
h.setEnabled(true);
h.setVisible(true);
h.setText(ZmMsg.checkFeed);
if(u){
u.setEnabled(true);
u.setVisible(true);
u.setText(ZmMsg.checkAllFeed)
}}else{
if(t&&!d){
if(u){
u.setEnabled(true);
u.setVisible(true);
u.setText(ZmMsg.checkAllFeed)
}}else{
var p=appCtxt.get(ZmSetting.POP_ACCOUNTS_ENABLED)||appCtxt.get(ZmSetting.IMAP_ACCOUNTS_ENABLED);
if(!appCtxt.isOffline&&p){
var c=AjxDispatcher.run("GetDataSourceCollection");
var e=c.getItemsFor(ZmOrganizer.normalizeId(o.id));
if(e.length>0){
h.setText(ZmMsg.checkExternalMail);
h.setEnabled(true);
h.setVisible(true)
}else{
h.setVisible(false)
}}else{
h.setVisible(false)
}
if((!t||d)&&u){
u.setVisible(false)
}}}}
h=g.getOp(ZmOperation.SYNC_OFFLINE_FOLDER);
if(h){
if(!o.isOfflineSyncable){
h.setVisible(false)
}else{
h.setVisible(true);
h.setEnabled(true);
var y=(o.isOfflineSyncing)?ZmMsg.syncOfflineFolderOff:ZmMsg.syncOfflineFolderOn;
h.setText(y)
}}
g.enable(ZmOperation.BROWSE,true);
this._enableRecoverDeleted(g,d);
this._resetButtonPerSetting(g,ZmOperation.SHARE_FOLDER,appCtxt.get(ZmSetting.SHARING_ENABLED))
};
ZmFolderTreeController.prototype._getHeaderActionMenuOps=function(){
return[ZmOperation.NEW_FOLDER,ZmOperation.EXPAND_ALL,ZmOperation.SYNC,ZmOperation.BROWSE]
};
ZmFolderTreeController.prototype._getActionMenuOps=function(){
return[ZmOperation.NEW_FOLDER,ZmOperation.MARK_ALL_READ,ZmOperation.DELETE,ZmOperation.RENAME_FOLDER,ZmOperation.MOVE,ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS,ZmOperation.EXPAND_ALL,ZmOperation.SYNC,ZmOperation.SYNC_ALL,ZmOperation.EMPTY_FOLDER,ZmOperation.RECOVER_DELETED_ITEMS,ZmOperation.SYNC_OFFLINE_FOLDER]
};
ZmFolderTreeController.prototype._getAllowedSubTypes=function(){
var e={};
e[ZmOrganizer.FOLDER]=true;
e[ZmOrganizer.SEARCH]=true;
return e
};
ZmFolderTreeController.prototype._getNewDialog=function(){
return appCtxt.getNewFolderDialog()
};
ZmFolderTreeController.prototype._getRenameDialog=function(){
return appCtxt.getRenameFolderDialog()
};
ZmFolderTreeController.prototype._itemClicked=function(t){
if(appCtxt.isOffline){
var u=t.getAccount();
if(u&&u.inNewMailMode){
u.inNewMailMode=false;
var a=appCtxt.getOverviewController()._overviewContainer;
for(var l in a){
a[l].updateAccountInfo(u,true,true)
}}}
if(t.type==ZmOrganizer.SEARCH){
var r=this._opc.getTreeController(ZmOrganizer.SEARCH);
r._itemClicked(t)
}else{
if(t.id==ZmFolder.ID_ATTACHMENTS){
var h=AjxDispatcher.run("GetAttachmentsController");
h.show()
}else{
var e=ZmId.SEARCH_MAIL;
if(t.isInTrash()){
var n=appCtxt.getCurrentAppName();
if(n==ZmApp.CONTACTS){
e=ZmItem.CONTACT
}}
var d=appCtxt.getSearchController();
var u=t.getAccount();
var s={
query:t.createQuery(),searchFor:e,getHtml:(t.nId==ZmFolder.ID_DRAFTS)||appCtxt.get(ZmSetting.VIEW_AS_HTML),types:((t.nId==ZmOrganizer.ID_SYNC_FAILURES)?[ZmItem.MSG]:null),sortBy:((d.currentSearch&&t.nId==d.currentSearch.folderId)?null:ZmSearch.DATE_DESC),accountName:(u&&u.name)};
d.resetSearchAllAccounts();
if(appCtxt.multiAccounts){
if(t.link&&t.perm==null){
var o=appCtxt.getFolderTree(u);
if(o){
var m=new AjxCallback(this,this._getPermissionsResponse,[s]);
o.getPermissions({
callback:m,folderIds:[t.id]}
)
}
return
}
if(appCtxt.isOffline&&u.hasNotSynced()&&!u.__syncAsked){
u.__syncAsked=true;
var c=appCtxt.getYesNoMsgDialog();
c.registerCallback(DwtDialog.YES_BUTTON,this._syncAccount,this,[c,u]);
c.setMessage(ZmMsg.neverSyncedAsk,DwtMessageDialog.INFO_STYLE);
c.popup()
}}
d.search(s)
}}};
ZmFolderTreeController.prototype._syncAccount=function(e,t){
e.popdown();
t.sync()
};
ZmFolderTreeController.prototype._getPermissionsResponse=function(e){
appCtxt.getSearchController().search(e)
};
ZmFolderTreeController.prototype._doSync=function(a){
var t=AjxDispatcher.run("GetDataSourceCollection");
var e=ZmOrganizer.normalizeId(a.id);
var o=t.getItemsFor(e);
if(o.length>0){
t.importMailFor(e)
}else{
ZmTreeController.prototype._doSync.call(this,a)
}};
ZmFolderTreeController.prototype._syncFeeds=function(t){
if(!appCtxt.isOffline&&t&&!t.isFeed()){
var a=(appCtxt.get(ZmSetting.POP_ACCOUNTS_ENABLED)||appCtxt.get(ZmSetting.IMAP_ACCOUNTS_ENABLED))?t.getDataSources(null,true):null;
if(a){
var e=AjxDispatcher.run("GetDataSourceCollection");
e.importMail(a);
return
}}
ZmTreeController.prototype._syncFeeds.call(this,t)
};
ZmFolderTreeController.prototype._addNew=function(o,a,t,e){
if(ZmFolder.HIDE_ID[t.id]){
return false
}
return o._addNew(a,t,e)
};
ZmFolderTreeController.prototype._deleteListener=function(a){
var e=this._getActionedOrganizer(a);
var n=appCtxt.isOffline?this.getDataTree().getById(ZmFolder.ID_TRASH):null;
if(n&&n.disallowSubFolder&&e.numTotal>0){
var r=appCtxt.getMsgDialog();
r.setMessage(ZmMsg.errorCannotDeleteFolder);
r.popup();
return
}
if(e.nId==ZmFolder.ID_SPAM||e.isInTrash()||(n&&n.disallowSubFolder)){
this._pendingActionData=e;
var o=this._deleteShield=appCtxt.getOkCancelMsgDialog();
o.reset();
o.registerCallback(DwtDialog.OK_BUTTON,this._deleteShieldYesCallback,this,e);
o.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,this._deleteShield);
var t;
if(e.type==ZmOrganizer.SEARCH){
t=ZmMsg.confirmDeleteSavedSearch
}else{
if(e.disallowSubFolder||e.isMountpoint){
t=ZmMsg.confirmDeleteFolder
}else{
if(e.nId==ZmFolder.ID_TRASH){
t=ZmMsg.confirmEmptyTrashFolder
}else{
t=ZmMsg.confirmEmptyFolder
}}}
var s=AjxMessageFormat.format(t,e.getName());
o.setMessage(s,DwtMessageDialog.WARNING_STYLE);
o.popup()
}else{
this._doMove(e,appCtxt.getById(ZmFolder.ID_TRASH))
}};
ZmFolderTreeController.prototype._emptyListener=function(e){
this._getEmptyShieldWarning(e)
};
ZmFolderTreeController.prototype._recoverListener=function(e){
appCtxt.getDumpsterDialog().popup(this._getSearchFor(),this._getSearchTypes())
};
ZmFolderTreeController.prototype._getSearchFor=function(e){
return ZmId.SEARCH_ANY
};
ZmFolderTreeController.prototype._getSearchTypes=function(e){
return[ZmItem.MSG]
};
ZmFolderTreeController.prototype._syncOfflineFolderListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
e.toggleSyncOffline()
}};
ZmFolderTreeController.prototype._browseListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowsePickers([ZmPicker.FOLDER])
}};
ZmFolderTreeController.prototype._dragListener=function(t){
if(t.action==DwtDragEvent.DRAG_START){
var e=t.srcControl.getData(Dwt.KEY_OBJECT);
t.srcData={
data:e,controller:this};
if(!(e instanceof ZmFolder)||e.isSystem()||e.isSyncIssuesFolder()){
t.operation=Dwt.DND_DROP_NONE
}}};
ZmFolderTreeController.prototype._dropListener=function(c){
var n=c.targetControl.getData(Dwt.KEY_OBJECT);
var t=c.srcData.data;
var o=(c.shiftKey||c.uiEvent.shiftKey);
if(c.action==DwtDropEvent.DRAG_ENTER){
if(!t){
c.doIt=false;
return
}
var l=c.targetControl.getData(ZmTreeView.KEY_TYPE);
if(t instanceof ZmFolder){
c.doIt=n.mayContain(t,l)&&!n.disallowSubFolder
}else{
if(t instanceof ZmTag){
c.doIt=false
}else{
if(this._dropTgt.isValidTarget(t)){
c.doIt=n.mayContain(t,l);
var e;
var m=AjxUtil.toArray(t);
for(var a=0;
a<m.length;
a++){
if(m[a] instanceof ZmItem){
e|=m[a].getDefaultDndAction(o)
}}
var d=document.getElementById(DwtId.DND_PLUS_ID);
if(e&&d){
var h=((e&ZmItem.DND_ACTION_COPY)!=0);
Dwt.setVisibility(d,h)
}}else{
c.doIt=false
}}}}else{
if(c.action==DwtDropEvent.DRAG_DROP){
if(t instanceof ZmFolder){
this._doMove(t,n)
}else{
var u=c.srcData.controller;
var r=(t instanceof Array)?t:[t];
if(appCtxt.multiAccounts&&!o&&!n.getAccount().isMain&&this._isMovingAcrossAccount(r,n)){
var s=appCtxt.getYesNoMsgDialog();
s.registerCallback(DwtDialog.YES_BUTTON,this._continueMovingAcrossAccount,this,[s,u,r,n]);
s.setMessage(ZmMsg.moveAcrossAccountWarning,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
u._doMove(r,n,null,o)
}}}}};
ZmFolderTreeController.prototype._isMovingAcrossAccount=function(e,n){
for(var a=0;
a<e.length;
a++){
var o=e[a];
var t=o.getAccount();
if(t&&t!=n.getAccount()){
return true
}}
return false
};
ZmFolderTreeController.prototype._continueMovingAcrossAccount=function(a,e,t,o){
a.popdown();
e._doMove(t,o)
};
ZmFolderTreeController.prototype._shareFolderListener=function(e){
if(!this._sharingPossible()){
return
}
this._pendingActionData=this._getActionedOrganizer(e);
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]=new AjxListener(this,this._renameListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._browseListener)
};
ZmSearchTreeController.prototype=new ZmFolderTreeController;
ZmSearchTreeController.prototype.constructor=ZmSearchTreeController;
ZmSearchTreeController.APP_JOIN_CHAR="-";
ZmSearchTreeController.prototype.toString=function(){
return"ZmSearchTreeController"
};
ZmSearchTreeController.prototype.show=function(a){
var o=a.overviewId;
if(!this._treeView[o]||a.forceCreate){
this._treeView[o]=this._setup(o)
}
var t=this.getDataTree(a.account);
if(t){
a.dataTree=t;
a.searchTypes={};
a.omit=a.omit||{};
a.omit[ZmFolder.ID_TRASH]=true;
a.omitParents=true;
var e=ZmOrganizer.OPEN_SETTING[this.type];
a.collapsed=!(!e||(appCtxt.get(e,null,a.account)!==false));
this._setupNewOp(a);
this._treeView[o].set(a);
this._checkTreeView(o)
}
return this._treeView[o]
};
ZmSearchTreeController.prototype.getTreeStyle=function(){
return null
};
ZmSearchTreeController.prototype.resetOperations=function(a,t,o){
a.enableAll(true);
var e=appCtxt.getById(o);
a.enable(ZmOperation.EXPAND_ALL,(e.size()>0))
};
ZmSearchTreeController.prototype._newListener=function(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowseView()
};
ZmSearchTreeController.prototype._browseListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowsePickers([ZmPicker.SEARCH])
}};
ZmSearchTreeController.prototype._getHeaderActionMenuOps=function(){
return[ZmOperation.EXPAND_ALL,ZmOperation.BROWSE]
};
ZmSearchTreeController.prototype._getActionMenuOps=function(){
return[ZmOperation.DELETE,ZmOperation.RENAME_SEARCH,ZmOperation.MOVE,ZmOperation.EXPAND_ALL]
};
ZmSearchTreeController.prototype._getAllowedSubTypes=function(){
return ZmTreeController.prototype._getAllowedSubTypes.call(this)
};
ZmSearchTreeController.prototype._getNewDialog=function(){
return appCtxt.getNewSearchDialog()
};
ZmSearchTreeController.prototype._itemClicked=function(e){
if(e._showFoldersCallback){
e._showFoldersCallback.run();
return
}
appCtxt.getSearchController().redoSearch(e.search,false,{
getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML)}
)
};
ZmSearchTreeController.prototype._getMoveParams=function(t){
var e=ZmTreeController.prototype._getMoveParams.apply(this,arguments);
e.overviewId=t.getOverviewId(this.type);
e.treeIds=[ZmOrganizer.FOLDER,ZmOrganizer.SEARCH];
return e
};
ZmSearchTreeController.prototype._getMoveDialogTitle=function(){
return AjxMessageFormat.format(ZmMsg.moveSearch,this._pendingActionData.name)
};
ZmSearchTreeController.prototype._checkTreeView=function(n){
var t=this._treeView[n];
if(!n||!t){
return
}
var o=this._opc.getOverview(n).account;
var e=(appCtxt.multiAccounts&&!o.isMain)?(ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,o)):ZmOrganizer.ID_ROOT;
var a=ZmOrganizer.HIDE_EMPTY[this.type]&&!t.getTreeItemById(e).getItemCount();
this._treeView[n].setVisible(!a)
}
}
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(t){
var e=new ZmFolderTree(ZmOrganizer.SHARE);
var a={
id:ZmOrganizer.ID_ROOT,name:ZmMsg.sharedFoldersHeader};
e.root=ZmFolderTree.createFolder(ZmOrganizer.SHARE,null,a,e);
return e
};
ZmShareTreeController.prototype._createTreeView=function(e){
return new ZmShareTreeView(e)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmOverviewController")){
ZmOverviewController=function(e){
ZmController.call(this,e);
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(t,a){
t.parent=t.parent||this._shell;
t.controller=this;
t.id=ZmId.getOverviewContainerId(t.containerId);
var e=this._overviewContainer[t.containerId]=new ZmAccountOverviewContainer(t);
a.containerId=t.id;
e.initialize(a);
return e
};
ZmOverviewController.prototype.createOverview=function(t){
t.parent=t.parent||this._shell;
var e=this._overview[t.overviewId]=new ZmOverview(t,this);
return e
};
ZmOverviewController.prototype.getOverviewContainer=function(e){
var e=e||appCtxt.getCurrentAppName();
return this._overviewContainer[e]
};
ZmOverviewController.prototype.getOverview=function(e){
return this._overview[e]
};
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(e){
return e?appCtxt.getTree(e):null
};
ZmOverviewController.prototype.getTreeView=function(t,e){
if(!t||!e){
return null
}
if(!this.getOverview(t)){
return null
}
return this.getOverview(t).getTreeView(e)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmSearchController")){
ZmSearchController=function(e){
ZmController.call(this,e);
this._inited=false;
this._searchFor=appCtxt.get(ZmSetting.MAIL_ENABLED)?ZmId.SEARCH_MAIL:ZmId.SEARCH_ANY;
this._contactSource=ZmItem.CONTACT;
this._results=null;
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
this._setView()
}};
ZmSearchController.prototype=new ZmController;
ZmSearchController.prototype.constructor=ZmSearchController;
ZmSearchController.QUERY_ISREMOTE="is:remote OR is:local";
ZmSearchController.prototype.toString=function(){
return"ZmSearchController"
};
ZmSearchController.prototype.getSearchToolbar=function(){
return this._searchToolBar
};
ZmSearchController.prototype.dateSearch=function(s,e){
s=s||new Date();
var o=AjxDateFormat.getDateInstance(AjxDateFormat.SHORT);
var a=o.format(s);
var t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
var n="date:"+a;
this.search({
query:n,types:[t],searchFor:e}
)
};
ZmSearchController.prototype.fromSearch=function(e){
var t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
var o=e instanceof Array?e.concat():[e];
for(var a=0;
a<o.length;
a++){
o[a]=["from:(",o[a],")"].join("")
}
this.search({
query:o.join(" OR "),types:[t]}
)
};
ZmSearchController.prototype.toSearch=function(e){
var t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
var o=e instanceof Array?e.concat():[e];
for(var a=0;
a<o.length;
a++){
o[a]=["tocc:(",o[a],")"].join("")
}
if(this.currentSearch&&this.currentSearch.folderId==ZmFolder.ID_SENT){
this.search({
query:"in:sent AND ("+o.join(" OR ")+")",types:[t]}
)
}else{
this.search({
query:o.join(" OR "),types:[t]}
)
}};
ZmSearchController.prototype.fromBrowse=function(t){
var e=new AjxCallback(this,this._handleLoadFromBrowse,[t]);
this.showBrowseView(true,e)
};
ZmSearchController.prototype.showBrowsePickers=function(a,e){
e=(!e||e==null)?true:e;
this.showBrowseView(true,null);
if(a instanceof Array){
this._browseViewController.removeAllPickers();
if(e){
this._browseViewController.addPicker(ZmPicker.BASIC)
}
for(var t=0;
t<a.length;
t++){
this._browseViewController.addPicker(a[t])
}}};
ZmSearchController.prototype._handleLoadFromBrowse=function(a,e){
this.setDefaultSearchType(ZmId.SEARCH_MAIL);
e.removeAllPickers();
this._browseViewController.removeAllPickers();
var t=this._browseViewController.addPicker(ZmPicker.BASIC);
t.setFrom(a);
t.execute()
};
ZmSearchController.prototype.showBrowseView=function(t,o,a){
if(!this._browseViewController){
if(a){
return
}
var e=new AjxCallback(this,this._handleLoadShowBrowseView,[t,a,o]);
AjxDispatcher.require("Browse",false,e,null,false);
return
}
this._doShowBrowseView(t,a,o)
};
ZmSearchController.prototype._handleLoadShowBrowseView=function(e,t,a){
this._browseViewController=new ZmBrowseController(this.searchPanel);
this._doShowBrowseView(e,t,a)
};
ZmSearchController.prototype._doShowBrowseView=function(e,t,o){
var a=this._browseViewController;
a.setBrowseViewVisible(!t&&(e||!a.getBrowseViewVisible()));
if(o){
o.run(a.getBrowseView())
}};
ZmSearchController.prototype.getBrowseView=function(){
return(this._browseViewController&&this._browseViewController.getBrowseView())
};
ZmSearchController.prototype.setSearchField=function(e){
if(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)&&this._searchToolBar){
this._searchToolBar.setSearchFieldValue(e)
}else{
this._currentQuery=e
}};
ZmSearchController.prototype.getSearchFieldValue=function(){
return this._searchToolBar?this._searchToolBar.getSearchFieldValue():""
};
ZmSearchController.prototype.setEnabled=function(e){
if(this._searchToolBar){
this._searchToolBar.setEnabled(e)
}};
ZmSearchController.prototype.setDefaultSearchType=function(e){
if(this._searchToolBar&&!appCtxt.inStartup){
var t=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON).getMenu();
t.checkItem(ZmSearchToolBar.MENUITEM_ID,e);
this._searchMenuListener(null,e)
}};
ZmSearchController.prototype._setView=function(){
this.searchPanel=new DwtComposite({
parent:this._container,className:"SearchPanel",posStyle:Dwt.ABSOLUTE_STYLE}
);
this._searchToolBar=new ZmSearchToolBar(this.searchPanel,ZmId.SEARCH_TOOLBAR);
if(!appCtxt.isChildWindow){
this.peopleSearchToolBar=new ZmPeopleSearchToolBar(this._container,ZmId.PEOPLE_SEARCH_TOOLBAR)
}
this._createTabGroup();
this._tabGroup.addMember(this._searchToolBar.getSearchField());
var t=this._searchToolBar.getButtons();
for(var e=0;
e<t.length;
e++){
this._tabGroup.addMember(t[e])
}
this._searchToolBar.registerCallback(this._searchFieldCallback,this);
this._searchToolBar.addSelectionListener(ZmSearchToolBar.SEARCH_BUTTON,new AjxListener(this,this._searchButtonListener));
if(appCtxt.get(ZmSetting.BROWSE_ENABLED)){
this._searchToolBar.addSelectionListener(ZmSearchToolBar.BROWSE_BUTTON,new AjxListener(this,this._browseButtonListener))
}
if(appCtxt.get(ZmSetting.SAVED_SEARCHES_ENABLED)){
this._searchToolBar.addSelectionListener(ZmSearchToolBar.SAVE_BUTTON,new AjxListener(this,this._saveButtonListener))
}};
ZmSearchController.prototype._addMenuListeners=function(s){
var a=new AjxListener(this,this._searchMenuListener);
var t=s.getItems();
for(var o=0;
o<t.length;
o++){
var n=t[o];
n.addSelectionListener(a);
var e=n.getData(ZmSearchToolBar.MENUITEM_ID);
if(e==ZmId.SEARCH_MAIL){
n.setChecked(true,true)
}}};
ZmSearchController.prototype.search=function(n){
if(!n.query&&!n.queryHint){
var e;
switch(n.searchFor){
case ZmId.SEARCH_MAIL:e=ZmApp.MAIL;
break;
case ZmId.SEARCH_GAL:return;
case ZmId.SEARCH_ANY:n.query="is:anywhere";
break;
case ZmItem.APPT:break;
default:e=ZmItem.APP[n.searchFor];
break
}
if(e){
var t=ZmOrganizer.APP2ORGANIZER[e];
var a=t&&ZmOrganizer.DEFAULT_FOLDER[t];
var o=a&&appCtxt.getById(a);
if(o){
n.query="in:"+o._systemName
}}
if(n.query){
n.userText=false
}else{
if(n.searchFor!=ZmItem.APPT){
return
}}}
if(n.query&&(n.query.indexOf("$set:")==0||n.query.indexOf("$cmd:")==0)){
appCtxt.getClientCmdHandler().execute((n.query.substr(5)),this);
return
}
n.searchAllAccounts=this.searchAllAccounts;
var s=new AjxCallback(this,this._handleResponseSearch,[n.callback]);
this._doSearch(n,n.noRender,s,n.errorCallback)
};
ZmSearchController.prototype._handleResponseSearch=function(t,e){
if(t){
t.run(e)
}};
ZmSearchController.prototype.redoSearch=function(o,e,n,r,t){
var s={};
s.query=o.query;
s.queryHint=o.queryHint;
s.types=o.types;
s.sortBy=o.sortBy;
s.offset=o.offset;
s.limit=o.limit;
s.prevId=o.prevId;
s.prevSortBy=o.prevSortBy;
s.fetch=o.fetch;
s.searchId=o.searchId;
s.lastSortVal=o.lastSortVal;
s.endSortVal=o.endSortVal;
s.lastId=o.lastId;
s.soapInfo=o.soapInfo;
s.accountName=o.accountName;
s.searchFor=this._searchFor;
s.idsOnly=o.idsOnly;
s.inDumpster=o.inDumpster;
if(n){
for(var a in n){
s[a]=n[a]
}}
this._doSearch(s,e,r,t)
};
ZmSearchController.prototype.resetSearchAllAccounts=function(){
var e=this.searchAllAccounts&&this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
var n=e&&e.getMenu();
var o=n&&n.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_ALL_ACCOUNTS);
if(o){
o.setChecked(false,true);
var a=n.getSelectedItem();
var t=this._inclSharedItems?this._getSharedImage(a):a.getImage();
e.setImage(t);
this.searchAllAccounts=false
}};
ZmSearchController.prototype.resetSearchToolbar=function(){
var e=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
var t=e?e.getMenu().getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_GAL):null;
if(t){
t.setVisible(appCtxt.getActiveAccount().isZimbraAccount)
}};
ZmSearchController.prototype.getTypes=function(o){
var a=new AjxVector();
var e=o.searchFor||this._searchFor;
var t;
if((e==ZmId.SEARCH_MAIL||e==ZmId.SEARCH_ANY)&&appCtxt.get(ZmSetting.MAIL_ENABLED)){
t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy()
}
if(e==ZmId.SEARCH_MAIL){
a.add(t)
}else{
if(e==ZmId.SEARCH_ANY){
if(appCtxt.get(ZmSetting.MAIL_ENABLED)&&t){
a.add(t)
}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
a.add(ZmItem.CONTACT)
}
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){
a.add(ZmItem.APPT)
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED)){
a.add(ZmItem.TASK)
}
if(appCtxt.get(ZmSetting.NOTEBOOK_ENABLED)){
a.add(ZmItem.PAGE)
}
if(appCtxt.get(ZmSetting.BRIEFCASE_ENABLED)){
a.add(ZmItem.BRIEFCASE_ITEM)
}}else{
a.add(e);
if(e==ZmItem.PAGE){
a.add(ZmItem.DOCUMENT)
}}}
return a
};
ZmSearchController.prototype.updateOverview=function(e){
var t=e||appCtxt.getCurrentSearch();
var h,a;
if(t&&(t.singleTerm||t.searchId)){
if(t.searchId){
h=this._getNormalizedId(t.searchId);
a=ZmOrganizer.SEARCH
}else{
if(t.folderId){
h=this._getNormalizedId(t.folderId);
var n=appCtxt.getFolderTree();
var o=n&&n.getById(h);
a=o?o.type:ZmOrganizer.FOLDER;
if(t.searchFor==ZmItem.TASK){
a=ZmOrganizer.TASKS
}}else{
if(t.tagId){
h=this._getNormalizedId(t.tagId);
a=ZmOrganizer.TAG
}}}
var r=appCtxt.getCurrentApp();
var s=r&&r.getOverview();
if(s){
s.setSelected(h,a)
}}};
ZmSearchController.prototype._getSuitableSortBy=function(t){
var o;
if(t.size()==1){
var a=t.get(0);
var e;
switch(a){
case ZmItem.CONV:e=ZmId.VIEW_CONVLIST;
break;
case ZmItem.MSG:e=ZmId.VIEW_TRAD;
break;
case ZmItem.CONTACT:e=ZmId.VIEW_CONTACT_SIMPLE;
break;
case ZmItem.APPT:e=ZmId.VIEW_CAL;
break;
case ZmItem.TASK:e=ZmId.VIEW_TASKLIST;
break;
case ZmId.SEARCH_GAL:e=ZmId.VIEW_CONTACT_SIMPLE;
break;
case ZmItem.BRIEFCASE_ITEM:e=ZmId.VIEW_BRIEFCASE_DETAIL;
break
}
if(e){
o=appCtxt.get(ZmSetting.SORTING_PREF,e)
}}
return o
};
ZmSearchController.prototype._doSearch=function(t,c,d,n){
var e=this._searchFor=t.searchFor||this._searchFor;
appCtxt.notifyZimlets("onSearch",[t.query]);
if(this._searchToolBar){
var l=(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)||t.userText)?t.query:null;
this._searchToolBar.setSearchFieldValue(l||"");
if(appCtxt.multiAccounts&&t.userText&&this.searchAllAccounts){
appCtxt.getCurrentApp().getOverviewContainer().deselectAll()
}}
var s=t.types||this.getTypes(t);
if(s instanceof Array){
s=AjxVector.fromArray(s)
}
if(e==ZmId.SEARCH_MAIL){
t=appCtxt.getApp(ZmApp.MAIL).getSearchParams(t)
}
if(e==ZmItem.TASK){
var a=AjxDispatcher.run("GetTaskListController");
t.allowableTaskStatus=(a)?a.getAllowableTaskStatus():null
}
var h=(e==ZmId.SEARCH_ANY);
if(t.searchAllAccounts&&!t.queryHint){
t.queryHint=appCtxt.accountList.generateQuery(null,s);
t.accountName=appCtxt.accountList.mainAccount.name
}else{
if(this._inclSharedItems){
t.queryHint=h?ZmSearchController.QUERY_ISREMOTE:ZmSearchController.generateQueryForShares(s.getArray())
}}
t.contactSource=(s.contains(ZmItem.CONTACT)||s.contains(ZmId.SEARCH_GAL))?this._contactSource:null;
if(t.contactSource==ZmId.SEARCH_GAL){
t.expandDL=true
}
t.sortBy=t.sortBy||this._getSuitableSortBy(s);
t.types=s;
var m=new ZmSearch(t);
var r=[m,c,h,d,t.noUpdateOverview,t.noClear];
var u=new AjxCallback(this,this._handleResponseDoSearch,r);
if(!n){
n=new AjxCallback(this,this._handleErrorDoSearch,[m,h])
}
if(e==ZmItem.APPT&&!t.forceSearch){
var o=AjxDispatcher.run("GetCalController");
if(o&&s.contains(ZmItem.APPT)){
o.handleUserSearch(t,u)
}else{
m.execute({
callback:u,errorCallback:n}
)
}}else{
m.execute({
callback:u,errorCallback:n}
)
}};
ZmSearchController.prototype._handleResponseDoSearch=function(o,t,n,h,s,r,e){
var a=e&&e.getResponse();
if(!a){
return
}
if(!a.type){
a.type=o.types.get(0)
}
if(a.type==ZmItem.APPT){
this._results=new ZmSearchResult(o)
}else{
this.currentSearch=o;
if(!t){
this._showResults(a,o,n,s,r)
}}
if(h){
h.run(e)
}};
ZmSearchController.prototype._showResults=function(a,l,r,e,h){
if(!h&&this._results&&(this._results.type==a.type)&&this._results.dtor){
this._results.dtor()
}
this._results=a;
if(appCtxt.get(ZmSetting.SAVED_SEARCHES_ENABLED)){
var s=this._searchToolBar&&this._searchToolBar.getButton(ZmSearchToolBar.SAVE_BUTTON);
if(s){
s.setEnabled(this._contactSource!=ZmId.SEARCH_GAL)
}}
var n=r?ZmItem.MIXED:a.type;
var o=new AjxCallback(this,this._handleLoadShowResults,[a,l,e]);
var t=appCtxt.getApp(ZmItem.APP[n])||appCtxt.getCurrentApp();
t.currentSearch=l;
t.currentQuery=l.query;
t.showSearchResults(a,o)
};
ZmSearchController.prototype._handleLoadShowResults=function(t,e,a){
appCtxt.setCurrentList(t.getResults(t.type));
if(!a){
this.updateOverview(e)
}};
ZmSearchController.prototype._handleErrorDoSearch=function(a,o,t){
if(t.code==ZmCsfeException.MAIL_NO_SUCH_TAG||t.code==ZmCsfeException.MAIL_QUERY_PARSE_ERROR||t.code==ZmCsfeException.MAIL_TOO_MANY_TERMS||(t.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER&&!(t.data.itemId&&t.data.itemId.length))){
var n=t.getErrorMsg();
appCtxt.setStatusMsg(n,ZmStatusView.LEVEL_WARNING);
var e=new ZmSearchResult(a);
e.type=a.types?a.types.get(0):null;
this._showResults(e,a,o);
return true
}
return false
};
ZmSearchController.generateQueryForShares=function(r,s){
var d=window.parentAppCtxt||window.appCtxt;
var h=[];
for(var o=0;
o<r.length;
o++){
var l=r[o];
var a=d.getApp(ZmItem.APP[l]);
if(a){
var e=a.getRemoteFolderIds(s);
for(var n=0;
n<e.length;
n++){
var t=e[n];
var c=AjxUtil.isNumeric(t)?t:['"',t,'"'].join("");
h.push("inid:"+c)
}}}
if(h.length>0){
h.push("is:local");
return h.join(" OR ")
}
return null
};
ZmSearchController.prototype._searchFieldCallback=function(a,e){
var t=appCtxt.get(ZmSetting.VIEW_AS_HTML);
this.search({
query:a,userText:true,getHtml:t,searchFor:e}
)
};
ZmSearchController.prototype._searchButtonListener=function(l){
var a=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
var t=a&&a.getMenu();
var s=t&&t.getSelectedItem();
var o=s&&s.getData("CustomSearchItem");
var h=s&&s.getData(ZmOperation.MENUITEM_ID);
if(o){
o[2].run(l)
}else{
var e=this._searchToolBar.getSearchFieldValue();
var r=(e.length>0);
if(e){
this._currentQuery=null
}else{
e=this._currentQuery?this._currentQuery:""
}
appCtxt.notifyZimlets("onSearchButtonClick",[e]);
var n=appCtxt.get(ZmSetting.VIEW_AS_HTML);
this.search({
query:e,userText:r,getHtml:n,searchFor:h}
)
}};
ZmSearchController.prototype._browseButtonListener=function(e){
this.showBrowseView()
};
ZmSearchController.prototype._saveButtonListener=function(t){
var e=appCtxt.getOverviewController().getTreeController(ZmOrganizer.SEARCH);
if(!e._newCb){
e._newCb=new AjxCallback(e,e._newCallback)
}
var a={
search:this._results&&this._results.search,showOverview:(this._searchFor==ZmId.SEARCH_MAIL)};
ZmController.showDialog(e._getNewDialog(),e._newCb,a)
};
ZmSearchController.prototype._searchMenuListener=function(r,e){
var o=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
if(!o){
return
}
var t=o.getMenu();
var l=r?r.item:(t.getItemById(ZmSearchToolBar.MENUITEM_ID,e));
if(!l||(!!(l._style&DwtMenuItem.SEPARATOR_STYLE))){
return
}
e=l.getData(ZmSearchToolBar.MENUITEM_ID);
var a=t.getSelectedItem();
var u=t.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_SHARED);
if(e==ZmId.SEARCH_GAL){
this._contactSource=ZmId.SEARCH_GAL;
if(u){
u.setChecked(false,true);
u.setEnabled(false)
}}else{
if(u){
if(e==ZmItem.APPT||e==ZmId.SEARCH_CUSTOM){
u.setChecked(false,true);
u.setEnabled(false)
}else{
u.setEnabled(true)
}}
this._contactSource=ZmItem.CONTACT
}
this._inclSharedItems=u&&u.getChecked();
var n=t.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_ALL_ACCOUNTS);
if(n){
if(e==ZmItem.APPT){
this.resetSearchAllAccounts();
n.setEnabled(false)
}else{
n.setEnabled(true);
this.searchAllAccounts=n&&n.getChecked()
}}
if(e==ZmId.SEARCH_SHARED){
var s=this.searchAllAccounts?n.getImage():a.getImage();
if(this._inclSharedItems){
var d=a&&a.getData(ZmSearchToolBar.MENUITEM_ID);
s=d?((ZmSearchToolBar.SHARE_ICON[d])||l.getImage()):l.getImage()
}
o.setImage(s)
}else{
if(e==ZmId.SEARCH_ALL_ACCOUNTS){
var s=(this.searchAllAccounts&&!this._inclSharedItems)?l.getImage():(this._inclSharedItems)?this._getSharedImage(a):a.getImage();
o.setImage(s)
}else{
this._searchFor=e;
var s=l.getImage();
if(this._inclSharedItems){
s=this._getSharedImage(a)
}else{
if(this.searchAllAccounts){
s=n.getImage()
}}
o.setImage(s);
o.setText(l.getText())
}}
var c=ZmMsg[ZmSearchToolBar.TT_MSG_KEY[e]];
if(e==ZmId.SEARCH_MAIL){
var h=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
c=ZmMsg[ZmSearchToolBar.TT_MSG_KEY[h]]
}
o.setToolTipContent(c)
};
ZmSearchController.prototype._getSharedImage=function(e){
var t=e&&e.getData(ZmSearchToolBar.MENUITEM_ID);
return(t&&ZmSearchToolBar.SHARE_ICON[t])?ZmSearchToolBar.SHARE_ICON[t]:ZmSearchToolBar.ICON[ZmId.SEARCH_SHARED]
};
ZmSearchController.prototype._getNormalizedId=function(a){
var t=a;
var e=appCtxt.getActiveAccount();
if(!e.isMain&&a.indexOf(":")==-1){
t=e.id+":"+a
}
return t
}
}
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(t){
this.dismiss();
var e=this._actionStack.logAction(t);
if(e){
this._active=true
}
return e
};
ZmActionController.prototype.getUndoLink=function(t,a){
if(t instanceof ZmAction){
var e=ZmActionController._registerCallback(new AjxCallback(this,this.undoCurrent));
return["<a onclick='ZmActionController.callRegisteredCallback(",e,")' href='javascript:;' class='undo'>",a||ZmMsg.undo,"</a>"].join("")
}else{
return""
}};
ZmActionController.prototype.getStatusTransitions=function(){
return this._statusTransitions
};
ZmActionController.prototype.undo=function(e){
if(this._active){
this.dismiss();
e.undo()
}};
ZmActionController.prototype.undoCurrent=function(){
if(this._active){
this.dismiss()
}
this._actionStack.undo()
};
ZmActionController.prototype.onPopup=function(){
var e=appCtxt.getOutsideMouseEventMgr();
var t={
id:"ZmActionController",obj:this,elementId:ZmId.TOAST,outsideListener:this._outsideListener};
e.startListening(t)
};
ZmActionController.prototype.dismiss=function(){
appCtxt.dismissStatusMsg(true);
var e=appCtxt.getOutsideMouseEventMgr();
e.stopListening("ZmActionController");
this._active=false
};
ZmActionController._substituteTransitions=function(o){
var a=[];
var t=false;
for(var e=0;
e<o.length;
e++){
var n=o[e];
if(n){
if(n.type==ZmToast.PAUSE.type){
if(!t){
t=true;
a.push(ZmToast.HOLD)
}}else{
a.push(n)
}}}
return a
};
ZmActionController._registeredCallbacks=[];
ZmActionController._registerCallback=function(t){
var e=ZmActionController._registeredCallbacks.length;
ZmActionController._registeredCallbacks[e]=t;
return e
};
ZmActionController.callRegisteredCallback=function(t){
var e=ZmActionController._registeredCallbacks[t];
if(e){
if(e instanceof AjxCallback){
e.run()
}else{
if(AjxUtil.isFunction(e)){
e()
}}}};
ZmActionController.prototype._outsideMouseDownListener=function(e){
this.dismiss()
}
}
if(AjxPackage.define("zimbraMail.im.model.ZmRoster")){
ZmRoster=function(e){
ZmModel.call(this,ZmEvent.S_ROSTER);
this._gateways={
byService:{}
,byDomain:{}
,array:[]};
this._notificationBuffer=[];
this._imApp=e
};
ZmRoster.prototype=new ZmModel;
ZmRoster.prototype.constructor=ZmRoster;
ZmRoster.F_PRESENCE="ZmRoster.presence";
ZmRoster.NOTIFICATION_FOO_TIMEOUT=10000;
ZmRoster.GATEWAY_EVENT="gateway list";
ZmRoster.prototype.toString=function(){
return"ZmRoster"
};
ZmRoster.prototype.getPrivacyList=function(){
return this._privacyList=this._privacyList||new ZmImPrivacyList(this)
};
ZmRoster.prototype.getChatList=function(){
if(!this._chatList){
this._chatList=new ZmChatList(this)
}
return this._chatList
};
ZmRoster.prototype.getMyAddress=function(){
return ZmImApp.INSTANCE.getService().getMyAddress()
};
ZmRoster.prototype.getRosterItem=function(a,e){
if(!a){
return null
}
a=a.toLowerCase();
var t=this.getRosterItemList().getByAddr(a);
if(t){
return t
}
if(e){
a=ZmImAddress.parse(a);
t=a?this.getRosterItemList().getByAddr(a.screenName):null;
if(t){
return t
}
if(a){
a=this.makeServerAddress(a.screenName,a.service);
if(a){
return this.getRosterItemList().getByAddr(a)
}}}};
ZmRoster.prototype.getRosterItemList=function(){
if(!this._rosterItemList){
this._rosterItemList=new ZmRosterItemList()
}
return this._rosterItemList
};
ZmRoster.prototype.getPresence=function(){
if(!this._rosterPresence){
this._rosterPresence=new ZmRosterPresence()
}
return this._rosterPresence
};
ZmRoster.prototype.notifyPresence=function(){
var e={};
e[ZmRoster.F_PRESENCE]=this.getPresence();
this._notify(ZmEvent.E_MODIFY,{
fields:e}
)
};
ZmRoster.prototype.reload=function(t){
this.getRosterItemList().removeAllItems();
var a=new AjxCallback(this,this._handleResponseReload);
var e={
asyncMode:true,noBusyOverlay:t};
ZmImApp.INSTANCE.getService().getRoster(a,e)
};
ZmRoster.prototype._handleResponseReload=function(r){
if(!r){
return
}
var s=this.getRosterItemList();
if(r.items&&r.items.item){
var t=r.items.item;
if(t.length){
var e=new Array(t.length);
for(var a=0;
a<t.length;
a++){
var n=t[a];
if(n.subscription=="TO"||n.subscription=="BOTH"){
var o=new ZmRosterPresence();
o.setFromJS(n.presence);
e[a]=new ZmRosterItem(n.addr,s,n.name,o,n.groups)
}}
s.addItems(e)
}}
if(r.presence){
if(/XA|AWAY/.test(r.presence.show)){
r.presence.show="ONLINE";
this.setPresence("ONLINE")
}
this.getPresence().setFromJS(r.presence);
this.notifyPresence()
}
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.createRosterItem=function(a,t,e){
ZmImApp.INSTANCE.getService().createRosterItem(a,t,e)
};
ZmRoster.prototype.setPresence=function(e,t,a,o){
ZmImApp.INSTANCE.getService().setPresence(e,t,a,o);
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.pushNotification=function(e){
if(!this._gateways){
this._notificationBuffer.push(e)
}else{
this.handleNotification(e)
}};
ZmRoster.prototype.refresh=function(){
this._requestGateways(new AjxCallback(this,this.reload))
};
ZmRoster.prototype.handleNotification=function(e){
ZmImApp.INSTANCE.getService().handleNotification(e)
};
ZmRoster.prototype.getConferenceTree=function(){
AjxDispatcher.require(["IMConference"]);
if(!this._conferenceTree){
this._conferenceTree=new ZmTree(ZmOrganizer.CONFERENCE_ITEM);
this._conferenceTree.root=new ZmOrganizer({
tree:this._conferenceTree}
)
}
return this._conferenceTree
};
ZmRoster.prototype.getConferenceServices=function(o,a){
var e=this.getConferenceTree();
if(!e.root.children.size()||a){
var t=new AjxCallback(this,this._handleResponceGetConferenceServices,[o]);
ZmImApp.INSTANCE.getService().getConferenceServices(t)
}else{
o.run(e.root.children.getArray())
}};
ZmRoster.prototype._handleResponceGetConferenceServices=function(h,s){
var t=this.getConferenceTree();
var a=t.root;
for(var n=0,r=s.length;
n<r;
n++){
var o={
id:s[n].addr,tree:t,name:s[n].name,parent:a};
var e=new ZmConferenceService(o);
a.children.add(e)
}
h.run(a.children.getArray())
};
ZmRoster.prototype.joinChatRequest=function(e,o){
var t=AjxSoapDoc.create("IMJoinConferenceRoomRequest","urn:zimbraIM");
var a=t.getMethod();
a.setAttribute("thread",e);
a.setAttribute("addr",o);
appCtxt.getAppController().sendRequest({
soapDoc:t,asyncMode:true}
)
};
ZmRoster.prototype.sendSubscribeAuthorization=function(e,t,a){
ZmImApp.INSTANCE.getService().sendSubscribeAuthorization(e,t,a)
};
ZmRoster.prototype.addGatewayListListener=function(e){
this._evtMgr.addListener(ZmRoster.GATEWAY_EVENT,e)
};
ZmRoster.prototype.reconnectGateway=function(e){
ZmImApp.INSTANCE.getService().reconnectGateway(e);
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.unregisterGateway=function(e,t){
ZmImApp.INSTANCE.getService().unregisterGateway(e,t);
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.registerGateway=function(e,o,a,t){
ZmImApp.INSTANCE.getService().registerGateway(e,o,a,t);
ZmImApp.INSTANCE.getService().startIgnoreNotify();
this.getGatewayByType(e).nick=o
};
ZmRoster.prototype._requestGateways=function(e){
ZmImApp.INSTANCE.getService().getGateways(new AjxCallback(this,this._handleRequestGateways,[e]))
};
ZmRoster.prototype._handleRequestGateways=function(s,n){
var a={};
var e={};
for(var t=0;
t<n.length;
++t){
var o=n[t]=new ZmImGateway(n[t]);
a[n[t].type.toLowerCase()]=o;
e[n[t].domain.toLowerCase()]=o
}
this._gateways={
byService:a,byDomain:e,array:n};
for(var t=0;
t<this._notificationBuffer.length;
++t){
this.handleNotification(this._notificationBuffer[t])
}
this._notificationBuffer=[];
this._evtMgr.notifyListeners(ZmRoster.GATEWAY_EVENT,{
roster:this}
);
if(s){
s.run()
}};
ZmRoster.prototype.getGatewayByType=function(e){
return this._gateways.byService[e.toLowerCase()]
};
ZmRoster.prototype.getGatewayByDomain=function(e){
return this._gateways.byDomain[e.toLowerCase()]
};
ZmRoster.prototype.getGateways=function(){
return this._gateways.array
};
ZmRoster.prototype.makeServerAddress=function(t,e){
return ZmImApp.INSTANCE.getService().makeServerAddress(t,e)
};
ZmRoster.prototype.makeGenericAddress=function(e){
e=this.breakDownAddress(e);
if(e.type.toLowerCase()=="xmpp"){
e.type="local"
}
return ZmImAddress.make(e.type,e.addr)
};
ZmRoster.prototype.breakDownAddress=function(o){
var t=/@(.*)$/;
var e=t.exec(o);
if(e){
var a=this.getGatewayByDomain(e[1]);
if(a){
return{
type:a.type,addr:o.substr(0,e.index),gateway:a}
}}
return{
type:"XMPP",addr:o}
};
ZmRoster.prototype.getGroups=function(){
return AjxVector.fromArray(this.getRosterItemList().getGroupsArray())
};
ZmRoster.prototype.setIdle=function(e){
if(ZmImApp.INSTANCE.getService().isLoggedIn()){
ZmImApp.INSTANCE.getService().setIdle(e,this._idleTimer.timeout)
}};
ZmRoster.prototype.onServiceAddChatMessage=function(e){
appCtxt.getApp(ZmApp.IM).prepareVisuals();
var o=this.getRosterItem(e.from);
if(o){
o._notifyTyping(false)
}
var a=this.getChatList();
var t=a.getChatByThread(e.thread);
if(t==null){
if(!e.fromMe){
t=a.getChatByRosterAddr(e.from,true,true)
}else{
t=a.getChatByRosterAddr(e.to,false)
}
if(t){
t.setThread(e.thread)
}}
if(t){
if(!e.fromMe){
if(appCtxt.get(ZmSetting.IM_PREF_FLASH_BROWSER)){
AjxDispatcher.require("Alert");
ZmBrowserAlert.getInstance().start(ZmMsg.newInstantMessage)
}
if(appCtxt.get(ZmSetting.IM_PREF_DESKTOP_ALERT)){
AjxDispatcher.require("Alert");
ZmDesktopAlert.getInstance().start(ZmMsg.newInstantMessage,e.getTextBody())
}}
t.addMessage(e)
}};
ZmRoster.prototype.onServiceAddBuddy=function(h,o,n,t,a){
var r=this.getRosterItemList();
var s=new ZmRosterItem(h,r,o,n,t);
r.addItem(s);
if(a){
this._newRosterItemtoastFormatter=this._newRosterItemtoastFormatter||new AjxMessageFormat(ZmMsg.imNewRosterItemToast);
var e=this._newRosterItemtoastFormatter.format([s.getDisplayName()]);
ZmTaskbarController.INSTANCE.setMessage(e)
}};
ZmRoster.prototype.onServiceRemoveBuddy=function(n,t){
var o=this.getRosterItemList();
var a=o.getByAddr(n);
if(a){
var e=a.getDisplayName();
o.removeItem(a);
if(t){
this._removeRosterItemToastFormatter=this._removeRosterItemToastFormatter||new AjxMessageFormat(ZmMsg.imRemoveRosterItemToast);
ZmTaskbarController.INSTANCE.setMessage(this._removeRosterItemToastFormatter.format([e]))
}}};
ZmRoster.prototype.onServiceRequestBuddyAuth=function(t){
var e=this.getRosterItem(t);
ZmTaskbarController.INSTANCE.showSubscribeRequest(t,e)
};
ZmRoster.prototype.onServiceSetBuddyPresence=function(s,r,o){
var n=s.getPresence().getShow();
if(s.getPresence().setFromJS(r)){
s._notifyPresence();
if(n!=ZmRosterPresence.SHOW_UNKNOWN){
this._presenceToastFormatter=this._presenceToastFormatter||new AjxMessageFormat(ZmMsg.imStatusToast);
var t=this._presenceToastFormatter.format([s.getDisplayName(),AjxStringUtil.htmlEncode(s.getPresence().getShowText())]);
var e=n==s.getPresence().getShow();
if(o&&((!e&&appCtxt.get(ZmSetting.IM_PREF_NOTIFY_PRESENCE))||(e&&appCtxt.get(ZmSetting.IM_PREF_NOTIFY_STATUS)))){
ZmTaskbarController.INSTANCE.setMessage(t);
var a=this.getChatList().getChatByRosterAddr(r.from);
if(a){
a.addMessage(ZmChatMessage.system(t))
}}}}};
ZmRoster.prototype.onServiceLoggedIn=function(t){
if(!this._idleTimer){
this._idleTimer=new DwtIdleTimer(appCtxt.get(ZmSetting.IM_PREF_IDLE_TIMEOUT)*60*1000,new AjxCallback(this,this.setIdle));
if(!appCtxt.get(ZmSetting.IM_PREF_REPORT_IDLE)){
this._idleTimer.kill()
}}
this._notify(ZmEvent.E_LOAD,{
loggedIn:true}
);
var a=new AjxCallback(this,this._loggedInGatewayCallback,[t]);
var e={
asyncMode:true,noBusyOverlay:true};
ZmImApp.INSTANCE.getService().getGateways(a,e)
};
ZmRoster.prototype._loggedInGatewayCallback=function(e,t){
this._handleRequestGateways(null,t);
ZmImApp.INSTANCE.getService().initializePresence(e?e.presence:null);
this.reload();
if(e&&e.callback){
e.callback.run(this)
}};
ZmRoster.prototype.onServiceLoggedOut=function(){
if(this.getPresence().setFromJS({
show:ZmRosterPresence.SHOW_OFFLINE}
)){
this.notifyPresence()
}
this.getRosterItemList().removeAllItems();
this._notify(ZmEvent.E_LOAD,{
loggedIn:false}
)
};
ZmRosterTreeGroups=function(e){
this._groups=e.getGroups()
};
ZmRosterTreeGroups.prototype.constructor=ZmRosterTreeGroups;
ZmRosterTreeGroups.prototype.autocompleteMatch=function(r,h){
r=r.toLowerCase();
var e=[];
var t=this._groups;
var s=t.size();
for(var o=0;
o<s;
o++){
var n=t.get(o);
if(n.toLowerCase().indexOf(r)==0){
e.push({
data:n,text:n}
)
}}
h.run(e)
};
ZmRosterTreeGroups.prototype.getArray=function(){
return this._groups
}
}
if(AjxPackage.define("zimbraMail.im.view.ZmImOverview")){
ZmImOverview=function(e,a){
if(!a){
a={}
}
var t={
parent:e,parentElement:a.parentElement,className:"ZmImOverview",posStyle:a.posStyle||Dwt.ABSOLUTE_STYLE};
DwtComposite.call(this,t);
this._groupItems={};
this._itemsById={};
delete a.parentElement;
this._options=a;
this._sortBy=appCtxt.get("IM_PREF_BUDDY_SORT");
this._actionMenuOps={
root:[ZmOperation.NEW_ROSTER_ITEM,ZmOperation.NEW_ROSTER_GROUP,ZmOperation.SEP,ZmOperation.IM_TOGGLE_OFFLINE,ZmOperation.IM_TOGGLE_BLOCKED,ZmOperation.SEP,ZmOperation.IM_SORT_BY_PRESENCE,ZmOperation.IM_SORT_BY_NAME],buddy:[ZmOperation.IM_NEW_CHAT,ZmOperation.IM_BUDDY_ARCHIVE,ZmOperation.SEP,ZmOperation.EDIT_PROPS,ZmOperation.DELETE,ZmOperation.SEP,ZmOperation.IM_CREATE_CONTACT,ZmOperation.IM_ADD_TO_CONTACT,ZmOperation.IM_EDIT_CONTACT],assistant:[ZmOperation.IM_NEW_CHAT],group:[ZmOperation.NEW_ROSTER_ITEM,ZmOperation.IM_DELETE_GROUP]};
this._actionMenuPopdownListener=new AjxListener(this,this._actionMenuPopdownListener);
this._im_dragSrc=new DwtDragSource(Dwt.DND_DROP_MOVE);
this._im_dragSrc.addDragListener(new AjxListener(this,this._dragListener));
this.__filters=[];
this.__filterOffline=appCtxt.get(ZmSetting.IM_PREF_HIDE_OFFLINE);
if(this.__filterOffline){
this.__filters.push(ZmImOverview.FILTER_OFFLINE_BUDDIES)
}
this.__filterBlocked=appCtxt.get(ZmSetting.IM_PREF_HIDE_BLOCKED);
if(this.__filterBlocked){
this.__filters.push(ZmImOverview.FILTER_BLOCKED_BUDDIES)
}
this._modelListeners=[];
this._init()
};
ZmImOverview.prototype=new DwtComposite;
ZmImOverview.prototype.constructor=ZmImOverview;
ZmImOverview.prototype.toString=function(){
return"ZmImOverview"
};
ZmImOverview.NO_MESSAGE=0;
ZmImOverview.NOT_LOGGED_IN=1;
ZmImOverview.LOADING=2;
ZmImOverview.NO_BUDDIES=3;
ZmImOverview.prototype.dispose=function(){
for(var e in this._actionMenuOps){
var n=this._actionMenuOps[e]._dwtControl;
if(n){
n.dispose()
}}
for(var t=0,a=this._modelListeners.length;
t<a;
t++){
var o=this._modelListeners[t];
o.modelObject.removeChangeListener(o.listener)
}
DwtComposite.prototype.dispose.call(this)
};
ZmImOverview.prototype.getTree=function(){
return this._tree
};
ZmImOverview.prototype._dragListener=function(e){
var t=e.srcControl.getData("ZmImOverview.data");
switch(e.action){
case DwtDragEvent.SET_DATA:if(t.buddy){
e.srcData=t.buddy;
e.srcData._drag_from_group=e.srcControl.parent.getData("ZmImOverview.data").group
}
break
}};
ZmImOverview.prototype._setCheck=function(e,t){
e.setImage(t?"Check":null)
};
ZmImOverview.prototype._setCheckOp=function(a,o,t){
var e=a.getMenuItem(o);
if(e){
this._setCheck(e,t)
}};
ZmImOverview.prototype._updateFilter=function(t,e){
if(e){
this.addFilter(t)
}else{
this.removeFilter(t)
}};
ZmImOverview.prototype._newGroupOkCallback=function(a){
var t;
if(!a.value){
t=ZmMsg.nameEmpty
}else{
if(this._groupItems[a.value]){
t=ZmMsg.imGroupExists
}}
if(t){
var e=appCtxt.getMsgDialog();
e.reset();
e.setMessage(t,DwtMessageDialog.CRITICAL_STYLE);
e.popup()
}else{
this._updateSpecialItems(ZmImOverview.NO_MESSAGE);
this.getGroupItem(a.value).setExpanded(true);
a.dialog.popdown()
}};
ZmImOverview.prototype._actionMenuListener=function(a,o){
var e=o.item.getData(ZmOperation.KEY_ID);
switch(e){
case ZmOperation.IM_SORT_BY_PRESENCE:this.sort(ZmImApp.BUDDY_SORT_PRESENCE,true);
break;
case ZmOperation.IM_SORT_BY_NAME:this.sort(ZmImApp.BUDDY_SORT_NAME,true);
break;
case ZmOperation.IM_TOGGLE_OFFLINE:this.__filterOffline=!this.__filterOffline;
appCtxt.getSettings().getSetting(ZmSetting.IM_PREF_HIDE_OFFLINE).setValue(this.__filterOffline);
this._updateFilter(ZmImOverview.FILTER_OFFLINE_BUDDIES,this.__filterOffline);
break;
case ZmOperation.IM_TOGGLE_BLOCKED:this.__filterBlocked=!this.__filterBlocked;
appCtxt.getSettings().getSetting(ZmSetting.IM_PREF_HIDE_BLOCKED).setValue(this.__filterBlocked);
this._updateFilter(ZmImOverview.FILTER_BLOCKED_BUDDIES,this.__filterBlocked);
break;
case ZmOperation.NEW_ROSTER_GROUP:this._newGroupOkCallbackObj=this._newGroupOkCallbackObj||new AjxCallback(this,this._newGroupOkCallback);
AjxDispatcher.require(["IM"]);
var h={
title:ZmMsg.imCreateNewGroup,label:ZmMsg.imGroupName,callback:this._newGroupOkCallbackObj};
ZmPromptDialog.getInstance().popup(h);
break;
default:var r=appCtxt.getApp("IM").getImController();
var s=r._listeners[e];
if(s){
var t={
dwtObj:o.dwtObj};
if(a&&this._actionedItem){
var n=this._actionedItem.getData("ZmImOverview.data");
t.type=n.type;
t.buddy=n.buddy;
t.group=n.group;
t.actionedItem=this._actionedItem
}
s.handleEvent(t)
}}};
ZmImOverview.PRESENCE_SORT_INDEX={
CHAT:1,ONLINE:2,AWAY:3,XA:4,DND:5,OFFLINE:6,UNKNOWN:7};
ZmImOverview.CMP_SORT_BY_NAME=function(t,e){
t=t.getData("ZmImOverview.data").buddy.getDisplayName();
e=e.getData("ZmImOverview.data").buddy.getDisplayName();
return t<e?-1:(t>e?1:0)
};
ZmImOverview.CMP_SORT_BY_PRESENCE=function(o,t){
var e=ZmImOverview.PRESENCE_SORT_INDEX[o.getData("ZmImOverview.data").buddy.getPresence().getShow()]||100;
var n=ZmImOverview.PRESENCE_SORT_INDEX[t.getData("ZmImOverview.data").buddy.getPresence().getShow()]||100;
if(e==n){
return ZmImOverview.CMP_SORT_BY_NAME(o,t)
}
return e-n
};
ZmImOverview.prototype.sort=function(t,e){
if(t&&(t!=this._sortBy)){
this._sortBy=t;
appCtxt.getSettings().getSetting("IM_PREF_BUDDY_SORT").setValue(t)
}
if(e){
if(this._sortActionId){
AjxTimedAction.cancelAction(this._sortActionId)
}
this._doSort()
}else{
if(!this._sortActionId){
this._doSortAction=this._doSortAction||new AjxTimedAction(this,this._doSort);
this._sortActionId=AjxTimedAction.scheduleAction(this._doSortAction,1000)
}}};
ZmImOverview.prototype._doSort=function(){
this._sortActionId=null;
var e=this._rootItem;
var t=e.getItems();
var n=this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE?ZmImOverview.CMP_SORT_BY_PRESENCE:ZmImOverview.CMP_SORT_BY_NAME;
for(var a=0;
a<t.length;
++a){
var o=t[a];
o.sort(n)
}};
ZmImOverview.prototype.chatWithBuddy=function(e){
ZmTaskbarController.INSTANCE.chatWithRosterItem(e);
ZmImOverview._popdownDialog()
};
ZmImOverview.prototype._actionMenuPopdownListener=function(){
if(this._actionedItem){
this._actionedItem._setActioned(false)
}};
ZmImOverview.prototype._getActionMenu=function(o,c,d){
var t=this._actionMenuOps[o];
if(t){
var e=t._dwtControl;
if(!e){
var l=this;
while(l&&!(l instanceof DwtDialog)){
l=l.parent
}
e=t._dwtControl=new ZmActionMenu({
parent:this,menuItems:t}
);
var a=new AjxListener(this,this._actionMenuListener,[true]);
for(var n=0;
n<e.opList.length;
++n){
var u=e.opList[n];
e.addSelectionListener(u,a)
}
e.addPopdownListener(this._actionMenuPopdownListener)
}
if(o=="buddy"){
var h=c.getContact();
e.getOp(ZmOperation.IM_ADD_TO_CONTACT).setVisible(!h);
e.getOp(ZmOperation.IM_CREATE_CONTACT).setVisible(!h);
e.getOp(ZmOperation.IM_EDIT_CONTACT).setVisible(!!h)
}else{
if(o=="root"){
var r=ZmImApp.loggedIn();
for(var n=0,s=e.opList.length;
n<s;
n++){
var u=e.getMenuItem(e.opList[n]);
if(u){
u.setEnabled(r)
}}
if(r){
this._setCheckOp(e,ZmOperation.IM_TOGGLE_OFFLINE,this.__filterOffline);
this._setCheckOp(e,ZmOperation.IM_TOGGLE_BLOCKED,this.__filterBlocked);
this._setCheckOp(e,ZmOperation.IM_SORT_BY_PRESENCE,this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE);
this._setCheckOp(e,ZmOperation.IM_SORT_BY_NAME,this._sortBy==ZmImApp.BUDDY_SORT_NAME)
}}}
return e
}};
ZmImOverview.prototype._treeMouseUpListener=function(a){
if((a.button==DwtMouseEvent.RIGHT)){
if(!this._treeViewActionMenu){
var n=[ZmOperation.NEW_ROSTER_ITEM,ZmOperation.IM_NEW_CHAT];
this._treeViewActionMenu=new ZmActionMenu({
parent:this.shell,menuItems:n}
);
var o=new AjxListener(this,this._actionMenuListener,[false]);
for(var e=0,t=n.length;
e<t;
e++){
this._treeViewActionMenu.addSelectionListener(n[e],o)
}}
this._treeViewActionMenu.popup(0,a.docX,a.docY)
}};
ZmImOverview.prototype._treeSelectionListener=function(a){
if(a.detail!=DwtTree.ITEM_ACTIONED&&a.detail!=DwtTree.ITEM_SELECTED&&a.detail!=DwtTree.ITEM_DBL_CLICKED){
return
}
var o=a.item.getData("ZmImOverview.data");
var t=o.type;
var n=o.group;
var e=o.buddy;
if(a.detail==DwtTree.ITEM_ACTIONED){
var s=this._getActionMenu(t,e,n);
if(s){
this._actionedItem=a.item;
s.popup(0,a.docX,a.docY)
}}else{
if(a.detail==DwtTree.ITEM_SELECTED&&e){
if(this._options.singleClick){
DwtMenu.closeActiveMenu();
this.chatWithBuddy(e)
}else{
ZmTaskbarController.INSTANCE.selectChatForRosterItem(e)
}}else{
if(a.detail==DwtTree.ITEM_DBL_CLICKED){
if(!this._options.singleClick){
if(e){
this.chatWithBuddy(e)
}else{
if(n){
a.item.setExpanded(!a.item.getExpanded())
}}}}}}};
ZmImOverview.prototype._init=function(){
var a=this._groupDropTgt=new DwtDropTarget(["ZmRosterItem"]);
a.addDropListener(new AjxListener(this,this._groupDropListener));
var s={
parent:this,className:this._options.overviewId?"OverviewTree":null};
var t=this._tree=new DwtTree(s);
t.getHtmlElement().style.width="100%";
if(!this._options.overviewId){
t.getHtmlElement().style.overflow="auto"
}
if(!this._options.inactiveTree){
t.addSelectionListener(new AjxListener(this,this._treeSelectionListener))
}
t.addListener(DwtEvent.ONMOUSEUP,new AjxListener(this,this._treeMouseUpListener));
this._rootItem=new DwtHeaderTreeItem({
parent:t,overview:this,className:"overviewHeader",noNodeCell:this._options.noHeaderNodeCell}
);
this._rootItem.setData("ZmImOverview.data",{
type:"root"}
);
this._rootItem.setText(ZmMsg.buddyList);
this._rootItem.enableSelection(false);
var r=this._roster=AjxDispatcher.run("GetRoster");
if(!this._options.noAssistant){
var o=r.getRosterItemList();
var n=new ZmAssistantBuddy(o);
this._createTreeItems("assistant",n)
}
this._listen(r,new AjxListener(this,this._rosterListener));
this._listen(r.getRosterItemList(),new AjxListener(this,this._rosterItemListListener));
var e=ZmImApp.loggedIn();
if(e){
o=r.getRosterItemList()
}
if(e&&o.size()){
this._updateSpecialItems(ZmImOverview.NO_MESSAGE);
o.getVector().foreach(this._createBuddy,this);
this.sort()
}else{
this._updateSpecialItems(e?ZmImOverview.NO_BUDDIES:ZmImOverview.NOT_LOGGED_IN)
}
t.addSeparator();
if(!this._options.overviewId){
this.addControlListener(new AjxListener(this,this._controlListener))
}
if(this._options.expanded){
this._rootItem.setExpanded(true)
}else{
t.addTreeListener(new AjxListener(this,this._treeListener))
}};
ZmImOverview.prototype._treeListener=function(e){
if(!this._didInitialExpand&&(e.detail==DwtTree.ITEM_EXPANDED)&&e.items.length&&(e.items[0]==this._rootItem)){
var t=this._groupItems[ZmMsg.buddies];
if(t){
t.setExpanded(true)
}
this._didInitialExpand=true
}};
ZmImOverview.prototype._controlListener=function(o){
var t={
x:o.oldWidth,y:o.oldHeight};
var e={
x:o.newWidth,y:o.newHeight};
if(t.x!=e.x||t.y!=e.y){
var a=e.y;
if(AjxEnv.isIE){
a-=2
}
this._tree.setSize(Dwt.DEFAULT,a)
}};
ZmImOverview._popdownDialog=function(){
if(ZmImNewChatDlg._INSTANCE){
ZmImNewChatDlg._INSTANCE.popdown()
}};
ZmImOverview.login=function(){
ZmImApp.INSTANCE.login()
};
ZmImOverview.newBuddy=function(){
ZmImApp.INSTANCE.prepareVisuals();
ZmImOverview._popdownDialog();
ZmImApp.INSTANCE.getImController()._newRosterItemListener()
};
ZmImOverview.prototype._updateSpecialItems=function(t){
var e=this._rootItem.getExpanded();
if(t==ZmImOverview.NO_MESSAGE){
if(this._infoItem){
this._infoItem.dispose();
this._infoItem=null
}
if(ZmImOverview.FILTER_SEARCH&&!this._filterItem){
this._filterItem=new ZmBuddyFilterItem({
parent:this._rootItem,overview:this}
);
this._filterItem.setData("ZmImOverview.data",{
type:"filter"}
)
}}else{
if(!this._infoItem){
this._rootItem.removeChildren();
this._filterItem=null;
this._groupItems={};
this._infoItem=new ZmInfoTreeItem({
parent:this._rootItem}
);
this._infoItem.setData("ZmImOverview.data",{
type:"infoItem"}
)
}
var a;
switch(t){
case ZmImOverview.NOT_LOGGED_IN:a=AjxMessageFormat.format(ZmMsg.imNotLoggedIn,"ZmImOverview.login()");
break;
case ZmImOverview.LOADING:a=ZmMsg.loading;
break;
case ZmImOverview.NO_BUDDIES:a=AjxMessageFormat.format(ZmMsg.imNoBuddies,"ZmImOverview.newBuddy()");
break
}
this._infoItem.setText(a)
}
if(e){
this._rootItem.setExpanded(true)
}};
ZmImOverview.prototype._listen=function(e,t){
e.addChangeListener(t);
this._modelListeners.push({
modelObject:e,listener:t}
)
};
ZmImOverview.prototype._rosterListener=function(e){
if(e.event==ZmEvent.E_LOAD){
this._updateSpecialItems(e.getDetails().loggedIn?ZmImOverview.LOADING:ZmImOverview.NOT_LOGGED_IN)
}};
ZmImOverview.prototype._rosterItemListListener=function(t){
var e=t.getDetail("fields");
if(t.event==ZmEvent.E_LOAD){
if(!t.source.size()){
this._updateSpecialItems(ZmImOverview.NO_BUDDIES)
}}else{
if(t.event==ZmEvent.E_CREATE){
if(this._infoItem){
this._updateSpecialItems(ZmImOverview.NO_MESSAGE)
}
var a=AjxVector.fromArray(t.getItems());
a.foreach(this._createBuddy,this);
if(a.size()){
this.sort()
}}else{
if(t.event==ZmEvent.E_MODIFY){
this._modifyBuddies(t.getItems(),e)
}else{
if(t.event==ZmEvent.E_REMOVE||t.event==ZmEvent.E_DELETE){
var a=AjxVector.fromArray(t.getItems());
a.foreach(this._removeBuddy,this)
}}}}};
ZmImOverview.prototype._groupDropListener=function(n){
if(!n.srcData){
return false
}
if(n.action==DwtDropEvent.DRAG_ENTER){
n.doIt=this._groupDropTgt.isValidTarget(n.srcData)
}else{
if(n.action==DwtDropEvent.DRAG_DROP){
var o=n.srcData;
var t=o._drag_from_group;
var s=n.targetControl.getData("ZmImOverview.data").group;
var e=AjxVector.fromArray(o.getGroups());
if(t!=s&&e.indexOf(s)==-1){
e.remove(t);
e.add(s);
var a=o.getDisplayName();
var r=o.getAddress();
AjxDispatcher.run("GetRoster").createRosterItem(r,a,e.join(","))
}}}};
ZmImOverview.prototype._getBuddyIcon=function(e){
var a=AjxDispatcher.run("GetRoster");
var t=a.getPrivacyList();
return t.isDenied(e.getAddress())?"BlockUser":e.getPresence().getIcon()
};
ZmImOverview.prototype._createBuddy=function(e){
return this._createTreeItems("buddy",e)
};
ZmImOverview.prototype._createTreeItems=function(s,o){
var e=o.getGroups();
if(e.length==0){
e=s=="buddy"?[ZmMsg.buddies]:[null]
}
var l=o.getDisplayName();
var r=this._getBuddyIcon(o);
var n=[];
var d=this._rootItem.getExpanded();
for(var t=0;
t<e.length;
++t){
var c=this.getGroupItem(e[t]);
var u=new DwtTreeItem({
parent:c,index:this.getSortIndex(o,c),text:AjxStringUtil.htmlEncode(l),imageInfo:r,singleClickAction:this._options.singleClick}
);
u.addClassName("ZmImPresence-"+o.getPresence().getShow());
u.setToolTipContent("-");
u.getToolTipContent=AjxCallback.simpleClosure(o.getToolTip,o);
u.setData("ZmImOverview.data",{
type:s,buddy:o}
);
u.setDragSource(this._im_dragSrc);
n.push(u);
if(this._options.expanded||(d&&(e[t]==ZmMsg.buddies))){
c.setExpanded(true)
}
var h=this._itemsById[o.getAddress()];
if(!h){
h=this._itemsById[o.getAddress()]=new AjxVector()
}
h.add(u)
}
this.applyFilters(n)
};
ZmImOverview.prototype._modifyBuddies=function(e,r){
var o=false;
var d=false;
for(var n=0,h=e.length;
n<h;
n++){
var l=e[n];
var c=this._itemsById[l.getAddress()];
if(c){
var u=ZmRosterItem.F_GROUPS in r;
if(u){
this._removeBuddy(l);
this._createTreeItems("buddy",l)
}else{
var t=ZmRosterItem.F_PRESENCE in r;
var m=ZmRosterItem.F_UNREAD in r;
var s=ZmRosterItem.F_NAME in r;
var a=ZmRosterItem.F_TYPING in r;
o=o||t;
d=d||s;
c.foreach(function(p){
if(t){
p.setImage(this._getBuddyIcon(l));
p.setClassName(p.getClassName());
p.addClassName("ZmImPresence-"+l.getPresence().getShow())
}
if(m||s){
var f=l.getDisplayName();
if(l.getUnread()){
f+=" ("+l.getUnread()+")";
f=f.bold()
}
p.setText(f)
}
if(a){
p.condClassName(r[ZmRosterItem.F_TYPING],"ZmRosterItem-typing")
}}
,this);
this.applyFilters(c.getArray())
}}}
if((o&&(this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE))||(d)){
this.sort()
}};
ZmImOverview.prototype._removeBuddy=function(t){
var e=this._itemsById[t.getAddress()];
e.foreach("dispose");
this._itemsById[t.getAddress()]=null
};
ZmImOverview.prototype.getGroupItem=function(t){
if(!t){
return this._rootItem
}
var e=this._groupItems[t];
if(!e){
e=this._groupItems[t]=new DwtTreeItem({
parent:this._rootItem,index:this.getSortIndex(t),text:AjxStringUtil.htmlEncode(t),imageInfo:"ImGroup"}
);
e.setToolTipContent("-");
e.getToolTipContent=function(){
var a=this.getData("ZmImOverview.data");
return AjxMessageFormat.format(ZmMsg.imGroupItemTooltip,[a.group,this.getItemCount()])
};
e.setData("ZmImOverview.data",{
type:"group",group:t}
);
e.setDropTarget(this._groupDropTgt)
}
return e
};
ZmImOverview.prototype.getSortIndex=function(c,h){
var s="buddy";
if(h==null){
s="group";
h=this._rootItem;
c=c.toLowerCase()
}
var n=h.getItems();
for(var t=0;
t<n.length;
++t){
var d=n[t];
var e=d.getData("ZmImOverview.data");
if(e.type=="filter"||e.type=="infoItem"){
continue
}
if(s=="buddy"){
if(this._sortBy==ZmImApp.BUDDY_SORT_NAME){
var o=e.buddy.getDisplayName();
if(o&&o.toLowerCase()>c.getDisplayName()){
break
}}else{
if(this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE){
var l=ZmImOverview.PRESENCE_SORT_INDEX[e.buddy.getPresence().getShow()]||100;
var r=ZmImOverview.PRESENCE_SORT_INDEX[c.getPresence().getShow()]||100;
if(l>r){
break
}}}}else{
var o=e.group;
if(o&&o.toLowerCase()>c){
break
}}}
return t
};
ZmImOverview.prototype.addFilter=function(t){
for(var e=this.__filters.length;
--e>=0;
){
if(this.__filters[e]===t){
this.__filters.splice(e,1)
}}
this.__filters.push(t);
this.applyFilters()
};
ZmImOverview.prototype.removeFilter=function(t){
if(!this.__filters.length){
return
}
for(var e=this.__filters.length;
--e>=0;
){
if(this.__filters[e]===t){
this.__filters.splice(e,1)
}}
this.applyFilters(null,true)
};
ZmImOverview.prototype.applyFilters=function(s,o){
var e=this.__filters;
if(!e.length&&!o){
return
}
this._firstFilterItem=null;
var n=function(d){
var p=false;
for(var u=d.length;
--u>=0;
){
var m=d;
var y=true;
for(var c=e.length;
--c>=0;
){
var g=e[c];
if(g.call(this,m)){
y=false;
break
}}
if(!this._firstFilterItem&&y){
this._firstFilterItem=m
}
p=p||y;
m.setVisible(y)
}
return p
};
if(s){
n.call(this,s)
}else{
if(this._rootItem){
var r=this._rootItem;
var t=r.getItems();
for(var a=t.length;
--a>=0;
){
var h=t[a];
var s=h.getItems();
var l=n.call(this,s)||s.length==0;
h.setVisible(l);
if(l){
h.setExpanded(true)
}}}}};
ZmImOverview.FILTER_OFFLINE_BUDDIES=function(a){
var e=a.getData("ZmImOverview.data").buddy;
var t=e.getPresence();
return t.getShow()==ZmRosterPresence.SHOW_OFFLINE
};
ZmImOverview.FILTER_BLOCKED_BUDDIES=function(t){
var e=t.getData("ZmImOverview.data").buddy;
return AjxDispatcher.run("GetRoster").getPrivacyList().isDenied(e.getAddress())
};
ZmImOverview.FILTER_SEARCH={
func:function(a){
var t=this.__searchInputEl.value.toLowerCase();
var e=a.getData("ZmImOverview.data").buddy;
if(/^#/.test(t)){
return e.getAddress().indexOf(t.substr(1))<0
}else{
return e.getDisplayName().toLowerCase().indexOf(t)<0
}}
,_doKeyPress:function(){
var e=this.__searchInputEl.value;
if(!/S/.test(e)||e==ZmMsg.filter){
this.removeFilter(ZmImOverview.FILTER_SEARCH.func)
}else{
this.addFilter(ZmImOverview.FILTER_SEARCH.func)
}}
,inputFocus:function(){
Dwt.delClass(this.__searchInputEl,"DwtSimpleInput-hint","DwtSimpleInput-focused");
if(this.__searchInputEl.value==ZmMsg.filter){
this.__searchInputEl.value=""
}else{
try{
this.__searchInputEl.select()
}
catch(e){}}}
,inputBlur:function(){
Dwt.delClass(this.__searchInputEl,"DwtSimpleInput-focused","DwtSimpleInput-hint");
if(!/S/.test(this.__searchInputEl.value)){
this.__searchInputEl.value=ZmMsg.filter
}}
,inputKeyPress:function(t){
if(!t){
t=window.event
}
if(this.__searchInputTimeout){
clearTimeout(this.__searchInputTimeout)
}
if(t.keyCode==27){
this.__searchInputEl.value="";
ZmImOverview.FILTER_SEARCH._doKeyPress.call(this);
ZmImOverview.FILTER_SEARCH.inputBlur.call(this);
this.__searchInputEl.blur()
}
if(t.keyCode==13){
ZmImOverview.FILTER_SEARCH._doKeyPress.call(this);
if(!/S/.test(this.__searchInputEl.value)){
return
}
if(this._firstFilterItem){
var e=this._firstFilterItem.getData("ZmImOverview.data").buddy;
this.chatWithBuddy(e);
this.__searchInputEl.value="";
ZmImOverview.FILTER_SEARCH.inputBlur.call(this);
this.__searchInputEl.blur()
}}
this.__searchInputTimeout=setTimeout(AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH._doKeyPress,this),500)
}};
ZmBuddyFilterItem=function(e){
this.overview=e.overview;
e.className="ZmBuddyFilterItem";
DwtTreeItem.call(this,e)
};
ZmBuddyFilterItem.prototype=new DwtTreeItem;
ZmBuddyFilterItem.prototype.constructor=ZmBuddyFilterItem;
ZmBuddyFilterItem.prototype.toString=function(){
return"ZmBuddyFilterItem"
};
ZmBuddyFilterItem.prototype._createHtmlFromTemplate=function(t,a){
var o=this.getHtmlElement();
o.className="ZmBuddyFilterItem";
var e=o.ownerDocument.createElement("input");
this.overview.__searchInputEl=e;
e.autocomplete="off";
e.className="DwtSimpleInput";
o.appendChild(e);
e.onkeydown=AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH.inputKeyPress,this.overview);
e.onfocus=AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH.inputFocus,this.overview);
e.onblur=AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH.inputBlur,this.overview);
e.onblur()
};
ZmInfoTreeItem=function(e){
e.className="ZmInfoTreeItem";
DwtTreeItem.call(this,e)
};
ZmInfoTreeItem.prototype=new DwtTreeItem;
ZmInfoTreeItem.prototype.constructor=ZmInfoTreeItem;
ZmInfoTreeItem.prototype.TEMPLATE="im.Chat#ZmInfoTreeItem";
ZmInfoTreeItem.prototype.toString=function(){
return"ZmInfoTreeItem"
}
}
if(AjxPackage.define("zimbraMail.im.view.ZmTaskbar")){
ZmTaskbar=function(e){
ZmToolBar.call(this,e);
ZmTaskbar.INSTANCE=this;
this._setMouseEvents();
this.shell.addControlListener(new AjxListener(this,this._shellControlListener))
};
ZmTaskbar.prototype=new ZmToolBar;
ZmTaskbar.prototype.constructor=ZmTaskbar;
ZmTaskbar.prototype.toString=function(){
return"ZmTaskbar"
};
ZmTaskbar.prototype.zShow=function(e){
this.setZIndex(e?Dwt.Z_VIEW+10:Dwt.Z_HIDDEN)
};
ZmTaskbar.prototype.expandItem=function(a,t,e){
if(t&&this.expandedItem){
this.expandedItem._expand(false)
}
a._expand(t,e);
this.expandedItem=t?a:null
};
ZmTaskbar.prototype.toggleExpanded=function(e){
this.expandItem(e,!e.expanded)
};
ZmTaskbar.prototype.conditionalExpand=function(e){
if(!this.expandedItem){
this.expandItem(e,true,true);
return true
}else{
return false
}};
ZmTaskbar.prototype._shellControlListener=function(e){
if((e.oldWidth!=e.newWidth)&&this.expandedItem){
this.expandedItem.positionContent()
}};
ZmTaskbarItem=function(a){
DwtComposite.call(this,a);
this._createHtml();
this._contentClassName=a.contentClassName;
var e={
style:DwtButton.TOGGLE_STYLE,parent:this,parentElement:this._buttonEl};
var t=a.buttonConstructor||DwtToolBarButton;
this.button=new t(e);
this.button.addSelectionListener(a.selectionListener);
if(a.op){
this.button.setText(ZmMsg[ZmOperation.getProp(a.op,"textKey")]);
this.button.setImage(ZmOperation.getProp(a.op,"image"));
this.button.setToolTipContent(ZmMsg[ZmOperation.getProp(a.op,"tooltipKey")])
}
this._rightAlign=a.rightAlign;
this._data=a.data
};
ZmTaskbarItem.prototype=new DwtComposite;
ZmTaskbarItem.prototype.constructor=ZmTaskbarItem;
ZmTaskbarItem.prototype.TEMPLATE="share.App#ZmTaskbarItem";
ZmTaskbarItem.prototype.toString=function(){
return"ZmTaskbarItem"
};
ZmTaskbarItem.prototype.getPopup=function(){
if(!this._popup){
AjxDispatcher.require(["IMCore","IM"]);
var args={
parent:this,parentElement:this._contentEl,taskbarItem:this,taskbar:this.parent,data:this._data};
var ctor=window.eval(this._contentClassName);
this._popup=new ctor(args)
}
return this._popup
};
ZmTaskbarItem.prototype._expand=function(a,t){
this.expanded=a;
Dwt.setVisible(this._contentEl,a);
this.button.setSelected(a);
var e=this.getPopup();
if(a){
this.showAlert(false);
e.popup(t);
this.positionContent()
}else{
e.popdown()
}};
ZmTaskbarItem.prototype.positionContent=function(){
if(this._rightAlign){
var e=Dwt.toWindow(this.button.getHtmlElement(),0,0).x;
var a=this.button.getW();
var t=this.parent.getBounds();
var o=1;
this._contentEl.style.right=t.x+t.width-e-a-o
}};
ZmTaskbarItem.prototype._createHtml=function(){
var e={
id:this._htmlElId};
this._createHtmlFromTemplate(this.TEMPLATE,e);
this._contentEl=document.getElementById(e.id+"_content");
this._buttonEl=document.getElementById(e.id+"_button")
}
}
if(AjxPackage.define("zimbraMail.im.controller.ZmTaskbarController")){
ZmTaskbarController=function(s){
ZmController.call(this,null);
ZmTaskbarController.INSTANCE=this;
var n=Dwt.byId(ZmId.SKIN_TASKBAR);
if(!n){
return
}
this._chatData={};
this._chatMru=[];
var o={
parent:appCtxt.getShell(),id:ZmId.TASKBAR,className:"ZmTaskbar",posStyle:Dwt.ABSOLUTE_STYLE};
this._toolbar=s[ZmAppViewMgr.C_TASKBAR]=new ZmTaskbar(o);
this._toolbar.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._toolbarMouseDownListener));
var h={
contentClassName:"ZmPresencePopup",op:ZmId.OP_IM_PRESENCE_MENU};
this._presenceItem=this._createItem(h);
this._toolbar.addSeparator();
this._newBuddySelectionListenerObj=new AjxListener(this,this._newBuddySelectionListener);
var a={
contentClassName:"ZmNewBuddyPopup",selectionListener:this._newBuddySelectionListenerObj,op:ZmId.OP_NEW_ROSTER_ITEM};
this._newBuddyItem=this._createItem(a);
this._newBuddyItem.button.setText("");
var t={
contentClassName:"ZmBuddyListPopup",op:ZmId.OP_IM_BUDDY_LIST};
this._createItem(t);
this._toolbar.addFiller(null);
this._chatButtonIndex=this._toolbar.getNumChildren()+1;
this._messageButton=new DwtToolBarButton({
parent:this._toolbar}
);
this._messageButton.setText(ZmMsg.betaIM);
this._messageButton.setEnabled(false);
var e=appCtxt.getSkinHint("presence","height")||24;
Dwt.setSize(n,Dwt.DEFAULT,e);
var r=ZmImApp.INSTANCE.getRoster();
this._updatePresenceButton(ZmImApp.loggedIn()?r.getPresence():null);
r.addChangeListener(new AjxListener(this,this._rosterChangeListener));
r.addGatewayListListener(new AjxListener(this,this._gatewayListListener));
ZmImApp.INSTANCE.getRoster().getChatList().addChangeListener(new AjxListener(this,this._chatListListener));
ZmImApp.INSTANCE.getRoster().getRosterItemList().addChangeListener(new AjxListener(this,this._rosterListChangeListener))
};
ZmTaskbarController.prototype=new ZmController;
ZmTaskbarController.prototype.constructor=ZmTaskbarController;
ZmTaskbarController.prototype.toString=function(){
return"ZmTaskbarController"
};
ZmTaskbarController.prototype.setMessage=function(e){
this._messageButton.setText(e);
if(this._resetMessageActionId){
AjxTimedAction.cancelAction(this._resetMessageActionId);
this._resetMessageActionId=0
}
this._resetMessageAction=this._resetMessageAction||new AjxTimedAction(this,this._resetMessage);
this._resetMessageActionId=AjxTimedAction.scheduleAction(this._resetMessageAction,3000)
};
ZmTaskbarController.prototype._resetMessage=function(e){
this._messageButton.setText(ZmMsg.betaIM);
this._resetMessageActionId=0
};
ZmTaskbarController.prototype.createChatItem=function(e,a){
this._addChatToMru(e);
var n=this._toolbar.addSeparator(null,this._chatButtonIndex++);
var t={
index:this._chatButtonIndex++,contentClassName:"ZmChatPopup",selectionListener:new AjxListener(this,this._chatSelectionListener,[e]),data:{
chat:e,statusListener:new AjxListener(this,this._chatStatusListener,[e]),closeListener:new AjxListener(this,this._closeChatListener,[e]),minimizeListener:new AjxListener(this,this._minimizeChatListener,[e])}};
var o=this._createItem(t);
o.button.setToolTipContent(new AjxCallback(this,this._getChatToolTip,[e]));
o.button.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._chatMouseDownListener,[e]));
this._chatData[e.id]={
chat:e,item:o,separator:n};
var s="Close";
o.button.setHoverImage(s);
this._closeClass=this._closeClass||AjxImg.getClassForImage(s);
this._toolbar.expandItem(o,true,a);
this._chatData[e.id].chatWidget=o.getPopup().chatWidget;
this._chatChangeListenerListenerObj=this._chatChangeListenerListenerObj||new AjxListener(this,this._chatChangeListenerListener);
e.addChangeListener(this._chatChangeListenerListenerObj);
return o
};
ZmTaskbarController.prototype.endChat=function(e){
e.sendClose();
ZmImApp.INSTANCE.getRoster().getChatList().removeChat(e)
};
ZmTaskbarController.prototype.selectChat=function(e,a){
var t=this._chatData[e.id];
if(t){
this._expandChatItem(t.item,e,true);
if(a){
t.chatWidget.setEditorContent(AjxStringUtil.trim(a))
}}};
ZmTaskbarController.prototype.selectChatForRosterItem=function(t){
var o=ZmImApp.INSTANCE.getRoster().getChatList().getChatsByRosterAddr(t.getAddress());
var e=null;
for(var a in o){
if(o[a].getRosterSize()==1){
e=o[a];
break
}}
if(e==null&&o.length>0){
e=o[0]
}
if(e!=null){
this.selectChat(e)
}};
ZmTaskbarController.prototype.chatWithContacts=function(t,e,o){
var a=t.map("getBuddy").sub(AjxCallback.isNull);
if(a.size()>0){
this.chatWithRosterItem(a.get(0),o)
}};
ZmTaskbarController.prototype.chatWithRosterItem=function(t,a){
var e=ZmImApp.INSTANCE.getRoster().getChatList().getChatByRosterItem(t,true);
this.selectChat(e,a)
};
ZmTaskbarController.prototype.getChatWidgetForChat=function(e){
var t=this._chatData[e.id];
return t?t.chatWidget:null
};
ZmTaskbarController.prototype.showSubscribeRequest=function(s,t){
this._subscribeData=this._subscribeData||{};
if(this._subscribeData[s]){
return
}
var n=this._toolbar.addSeparator(null,this._chatButtonIndex+1);
var e={
index:this._chatButtonIndex+1,op:ZmId.OP_IM_INVITE,rightAlign:true,contentClassName:"ZmSubscribePopup",data:{
addr:s,buddy:t}};
var a=this._createItem(e);
this._subscribeData[s]={
item:a,separator:n};
this._subscribeRequestTooltip=this._subscribeRequestTooltip||new AjxMessageFormat(ZmMsg.imInvitationFrom);
var o=this._subscribeRequestTooltip.format(t?t.getDisplayName():s);
a.button.setToolTipContent(o);
if(!this._toolbar.conditionalExpand(a)){
a.showAlert(true)
}
a.addDisposeListener(new AjxListener(this,this._subscribeDisposeListener,[s]))
};
ZmTaskbarController.prototype.showNewBuddyPopup=function(){
this._toolbar.expandItem(this._newBuddyItem,true);
return this._newBuddyItem.getPopup()
};
ZmTaskbarController.prototype.showGatewayPopup=function(t){
if(this._gatewayData){
var e=this._gatewayData[t];
if(e){
this._toolbar.expandItem(e.item,true)
}}};
ZmTaskbarController.prototype._subscribeDisposeListener=function(t){
var e=this._subscribeData[t];
this._toolbar.removeSeparator(e.separator);
delete this._subscribeData[t]
};
ZmTaskbarController.prototype._addChatToMru=function(e){
if(this._chatMru.length>=4){
for(var o=this._chatMru.length,a=o-1;
a>=0;
a--){
var t=this._chatMru[a];
var n=this._chatData[t.id].item;
if(!n.expanded&&!n.isAlertShown()){
this.endChat(t);
break
}}}
this._chatMru.unshift(e)
};
ZmTaskbarController.prototype._updateChatMru=function(e){
if(this._chatMru.length&&(this._chatMru[0]!=e)){
this._removeChatFromMru(e);
this._chatMru.unshift(e)
}};
ZmTaskbarController.prototype._removeChatFromMru=function(e){
for(var t=0,a=this._chatMru.length;
t<a;
t++){
if(this._chatMru[t]==e){
this._chatMru.splice(t,1);
return
}}};
ZmTaskbarController.prototype._chatMouseDownListener=function(e,a){
if(a.button!=DwtMouseEvent.RIGHT){
return
}
this._actionedChat=e;
if(!this._chatActionMenu){
var t={
parent:appCtxt.getShell(),controller:this,context:ZmId.TASKBAR,menuType:"Chat",menuItems:[ZmId.OP_IM_CLOSE_CHAT,ZmId.OP_IM_CLOSE_ALL_CHATS,ZmId.OP_IM_CLOSE_OTHER_CHATS]};
this._chatActionMenu=new ZmActionMenu(t);
this._chatActionMenu.getOp(ZmId.OP_IM_CLOSE_CHAT).addSelectionListener(new AjxListener(this,this._closeChatMenuListener));
this._chatActionMenu.getOp(ZmId.OP_IM_CLOSE_ALL_CHATS).addSelectionListener(new AjxListener(this,this._closeAllChatsListener));
this._chatActionMenu.getOp(ZmId.OP_IM_CLOSE_OTHER_CHATS).addSelectionListener(new AjxListener(this,this._closeOtherChatsListener))
}
this._chatActionMenu.popup(0,a.docX,a.docY)
};
ZmTaskbarController.prototype._closeChatMenuListener=function(){
this.endChat(this._actionedChat);
this._actionedChat=null
};
ZmTaskbarController.prototype._closeAllChatsListener=function(){
var e=[];
for(var o in this._chatData){
e.push(this._chatData[o].chat)
}
for(var t=0,a=e.length;
t<a;
t++){
this.endChat(e[t])
}
this._actionedChat=null
};
ZmTaskbarController.prototype._closeOtherChatsListener=function(){
var o=[];
for(var n in this._chatData){
var e=this._chatData[n].chat;
if(e!=this._actionedChat){
o.push(e)
}}
for(var t=0,a=o.length;
t<a;
t++){
this.endChat(o[t])
}
this._actionedChat=null
};
ZmTaskbarController.prototype._newBuddyListener=function(){
ZmImApp.INSTANCE.prepareVisuals();
ZmImApp.INSTANCE.getImController()._newRosterItemListener()
};
ZmTaskbarController.prototype._toolbarMouseDownListener=function(e){
if(e.button==DwtMouseEvent.LEFT&&this._toolbar.expandedItem){
this._toolbar.expandItem(this._toolbar.expandedItem,false)
}};
ZmTaskbarController.prototype._rosterListChangeListener=function(s){
if(s.event==ZmEvent.E_MODIFY){
var t=s.getDetail("fields");
var o=s.getItems();
for(var e=0;
e<o.length;
e++){
var h=o[e];
if(h instanceof ZmRosterItem){
var a;
a=a||ZmImApp.INSTANCE.getRoster().getChatList();
var d=a.getChatsByRosterAddr(h.getAddress());
for(var n in d){
var l=d[n];
var r=this.getChatWidgetForChat(d[n]);
if(r){
r._rosterItemChangeListener(h,t)
}}}}}};
ZmTaskbarController.prototype._chatListListener=function(a){
if(a.event==ZmEvent.E_CREATE){
var e=a.getDetails().items[0];
var o=this._chatData[e.id];
var t;
if(o){
this._toolbar.conditionalExpand(o.item)
}else{
t=this.createChatItem(e,a.getDetails().background)
}}else{
if(a.event==ZmEvent.E_DELETE){
var e=a._details.items[0];
this._deleteChatItem(e)
}}};
ZmTaskbarController.prototype._deleteChatItem=function(e){
this._removeChatFromMru(e);
e.removeChangeListener(this._chatChangeListenerListenerObj);
var t=this._chatData[e.id];
if(t){
this._toolbar.removeSeparator(t.separator);
t.item.dispose();
this._chatButtonIndex-=1;
delete this._chatData[e.id]
}};
ZmTaskbarController.prototype._getChatToolTip=function(e,a){
var t=e.getRosterItem().getToolTip();
a.run(t)
};
ZmTaskbarController.prototype._expandChatItem=function(t,e,a){
this._updateChatMru(e);
this._toolbar.expandItem(t,a);
var o=this._chatData[e.id].chatWidget;
o._onMinimize(!a);
if(a){
o.focus()
}};
ZmTaskbarController.prototype._chatSelectionListener=function(e,a){
if(e&&a.target&&(a.target.className==this._closeClass)){
this.endChat(e)
}else{
var t=a.dwtObj.parent;
this._expandChatItem(t,e,!t.expanded)
}};
ZmTaskbarController.prototype._selectionListener=function(e){
this._toolbar.toggleExpanded(e.dwtObj.parent)
};
ZmTaskbarController.prototype._newBuddySelectionListener=function(e){
if(ZmImApp.loggedIn()){
this._toolbar.toggleExpanded(this._newBuddyItem)
}else{
ZmImApp.INSTANCE.login({
callback:this._newBuddySelectionListenerObj}
)
}};
ZmTaskbarController.prototype._chatChangeListenerListener=function(o){
var e=o.source;
var t=this._chatData[e.id];
if(t&&!t.item.expanded){
var a=o.getDetail("fields")[ZmChat.F_MESSAGE];
if(a&&!a.fromMe&&!a.isSystem){
t.item.showAlert(true);
this._updateChatMru(e)
}}};
ZmTaskbarController.prototype._closeChatListener=function(e){
this.endChat(e)
};
ZmTaskbarController.prototype._minimizeChatListener=function(e){
var t=this._chatData[e.id].item;
this._expandChatItem(t,e,false);
t.button.setDisplayState(DwtControl.SELECTED);
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._minimzeTimedAction,t),250)
};
ZmTaskbarController.prototype._minimzeTimedAction=function(e){
e.button.setDisplayState(DwtControl.NORMAL)
};
ZmTaskbarController.prototype._chatStatusListener=function(t,e){
var a=this._chatData[t.id].item;
a.button.setImage(e.statusImage);
var o=e.title?AjxStringUtil.clipByLength(e.title,15):"";
a.button.setText(o)
};
ZmTaskbarController.prototype._createItem=function(e){
e.parent=this._toolbar;
e.selectionListener=e.selectionListener||new AjxListener(this,this._selectionListener);
return new ZmTaskbarItem(e)
};
ZmTaskbarController.prototype._rosterChangeListener=function(a){
if(a.event==ZmEvent.E_MODIFY){
var e=a.getDetail("fields");
if(ZmRoster.F_PRESENCE in e){
var t=ZmImApp.INSTANCE.getRoster().getPresence();
this._updatePresenceButton(t)
}}};
ZmTaskbarController.prototype._updatePresenceButton=function(a){
var t=this._presenceItem.button;
t.setImage(a?a.getIcon():"Offline");
var e=a?AjxStringUtil.htmlEncode(a.getShowText()):ZmMsg.imStatusOffline;
var o=ZmImApp.INSTANCE.getServiceController().getMyPresenceTooltip(e);
t.setToolTipContent(o)
};
ZmTaskbarController.prototype._gatewayListListener=function(s){
if(!ZmImApp.INSTANCE.getServiceController().capabilities[ZmImServiceController.ACCOUNTS]){
return
}
this._gatewayData=this._gatewayData||{};
var h=s.roster.getGateways();
for(var a=1,n=h.length;
a<n;
a++){
var r=h[a];
if(!this._gatewayData[r.type]){
for(var e in this._gatewayData){
this._toolbar.addSeparator();
break
}
var t={
buttonConstructor:ZmStatusImageButton,contentClassName:"ZmGatewayPopup",data:r,rightAlign:true};
var o=this._createItem(t);
o.button.setImage("WebSearch");
this._gatewayData[r.type]={
item:o};
r.addListener(ZmImGateway.EVENT_SET_STATE,new AjxListener(this,this._gatewayEventListener,[r]))
}
this._updateGatewayButton(r)
}};
ZmTaskbarController.prototype._gatewayEventListener=function(e){
this._updateGatewayButton(e)
};
ZmTaskbarController.prototype._updateGatewayButton=function(o){
var a=this._presenceItem.button.getImage();
var e;
if(o.isOnline()){
e=this._gatewayOnlineFormat=this._gatewayOnlineFormat||new AjxMessageFormat(ZmMsg.imStatusGatewayOnline)
}else{
e=this._gatewayOfflineFormat=this._gatewayOfflineFormat||new AjxMessageFormat(ZmMsg.imStatusGatewayOffline);
a="Offline"
}
var n=e.format([ZmMsg["imGateway_"+o.type],o.nick]);
var t=this._gatewayData[o.type].item.button;
t.setToolTipContent(n);
t.setStatusImage(a)
};
ZmStatusImageButton=function(e){
e.className="ZmStatusImageButton";
DwtButton.call(this,e)
};
ZmStatusImageButton.prototype=new DwtButton;
ZmStatusImageButton.prototype.constructor=ZmStatusImageButton;
ZmStatusImageButton.prototype.TEMPLATE="share.App#ZmStatusImageButton";
ZmStatusImageButton.prototype.toString=function(){
return"ZmStatusImageButton"
};
ZmStatusImageButton.prototype.dispose=function(){
this._statusIconEl=null;
DwtMenuItem.prototype.dispose.call(this)
};
ZmStatusImageButton.prototype.setStatusImage=function(e){
if(this._statusIconEl){
AjxImg.setImage(this._statusIconEl,e)
}};
ZmStatusImageButton.prototype._createHtmlFromTemplate=function(e,t){
DwtButton.prototype._createHtmlFromTemplate.call(this,e,t);
this._statusIconEl=document.getElementById(t.id+"_status_icon")
}
}
if(AjxPackage.define("zimbraMail.core.ZmAppViewMgr")){
ZmAppViewMgr=function(o,t,e,a){
ZmAppViewMgr._setContainerIds();
this._shell=o;
this._controller=t;
this._isNewWindow=e;
this._hasSkin=a;
this._shellSz=this._shell.getSize();
this._controlListener=new AjxListener(this,this._shellControlListener);
this._shell.addControlListener(this._controlListener);
this._sashSupported=(window.skin&&typeof window.skin.setTreeWidth=="function");
if(appCtxt.get(ZmSetting.HISTORY_SUPPORT_ENABLED)&&(!AjxEnv.isChrome&&(!AjxEnv.isSafari||AjxEnv.isSafari5up))&&!e&&!AjxEnv.isPrism){
this._historyMgr=appCtxt.getHistoryMgr();
this._historyMgr.addListener(new AjxListener(this,this._historyChangeListener))
}
this._hashView={};
this._nextHashIndex=0;
this._curHashIndex=0;
this._noHistory=false;
this._ignoreHistoryChange=false;
this._lastView=null;
this._currentView=null;
this._views={};
this._hidden=[];
this._appView={};
this._callbacks={};
this._viewApp={};
this._isAppView={};
this._isTransient={};
this._toRemove=[];
this._isTabView={};
this._tabParams={};
this._viewByTabId={};
this._components={};
this._containers={};
this._contBounds={};
this._pushCallback=new AjxCallback(this,this.pushView);
this._popCallback=new AjxCallback(this,this.popView);
this._createLoadingView()
};
ZmAppViewMgr.C_BANNER="banner";
ZmAppViewMgr.C_USER_INFO="userInfo";
ZmAppViewMgr.C_QUOTA_INFO="quota";
ZmAppViewMgr.C_SEARCH="search";
ZmAppViewMgr.C_PEOPLE_SEARCH="peopleSearch";
ZmAppViewMgr.C_SEARCH_BUILDER="searchBuilder";
ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR="searchBuilderToolbar";
ZmAppViewMgr.C_APP_CHOOSER="appChooser";
ZmAppViewMgr.C_TREE="tree";
ZmAppViewMgr.C_TREE_FOOTER="treeFooter";
ZmAppViewMgr.C_TOOLBAR_TOP="topToolbar";
ZmAppViewMgr.C_TOOLBAR_BOTTOM="bottomToolbar";
ZmAppViewMgr.C_APP_CONTENT="main";
ZmAppViewMgr.C_APP_CONTENT_FULL="fullScreen";
ZmAppViewMgr.C_STATUS="status";
ZmAppViewMgr.C_SASH="sash";
ZmAppViewMgr.C_TASKBAR="taskbar";
ZmAppViewMgr.C_FOOTER="footer";
ZmAppViewMgr.C_AD="adsrvc";
ZmAppViewMgr.ALL_COMPONENTS=[ZmAppViewMgr.C_BANNER,ZmAppViewMgr.C_USER_INFO,ZmAppViewMgr.C_QUOTA_INFO,ZmAppViewMgr.C_SEARCH,ZmAppViewMgr.C_PEOPLE_SEARCH,ZmAppViewMgr.C_SEARCH_BUILDER,ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR,ZmAppViewMgr.C_APP_CHOOSER,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_TOOLBAR_BOTTOM,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL,ZmAppViewMgr.C_STATUS,ZmAppViewMgr.C_SASH,ZmAppViewMgr.C_TASKBAR,ZmAppViewMgr.C_FOOTER,ZmAppViewMgr.C_AD];
ZmAppViewMgr.APP_COMPONENTS=[ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_STATUS,ZmAppViewMgr.C_SASH];
ZmAppViewMgr.CONT_ID_KEY={};
ZmAppViewMgr.CB_PRE_HIDE=1;
ZmAppViewMgr.CB_POST_HIDE=2;
ZmAppViewMgr.CB_PRE_SHOW=3;
ZmAppViewMgr.CB_POST_SHOW=4;
ZmAppViewMgr.CB_PRE_UNLOAD=5;
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_PEOPLE_SEARCH]=ZmId.SKIN_PEOPLE_SEARCH;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SEARCH_BUILDER]=ZmId.SKIN_SEARCH_BUILDER;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR]=ZmId.SKIN_SEARCH_BUILDER_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_TOOLBAR_BOTTOM]=ZmId.SKIN_APP_BOTTOM_TOOLBAR;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT]=ZmId.SKIN_APP_MAIN;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT_FULL]=ZmId.SKIN_APP_MAIN_FULL;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_STATUS]=ZmId.SKIN_STATUS;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SASH]=ZmId.SKIN_SASH;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_TASKBAR]=ZmId.SKIN_TASKBAR;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_FOOTER]=ZmId.SKIN_FOOTER;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_AD]=ZmId.SKIN_AD
};
ZmAppViewMgr.prototype.toString=function(){
return"ZmAppViewMgr"
};
ZmAppViewMgr.prototype.isFullScreen=function(e){
e=e||this._currentView;
return Boolean(e&&this._views[e]&&this._views[e][ZmAppViewMgr.C_APP_CONTENT_FULL])
};
ZmAppViewMgr.prototype.addComponents=function(o,c,t){
var r=[];
for(var h in o){
var n=o[h];
this._components[h]=n;
if(this._hasSkin){
if(!this._containers[h]){
var a=ZmAppViewMgr.CONT_ID_KEY[h];
var s=document.getElementById(a);
if(!s&&h==ZmAppViewMgr.C_APP_CONTENT_FULL){
a=ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT];
s=document.getElementById(a)
}
if(!s){
continue
}
this._containers[h]=s;
if(c){
s.innerHTML="";
var e=this._getContainerBounds(h);
var l=Boolean(this._components[ZmAppViewMgr.C_TOOLBAR_TOP]);
if(e){
n.setBounds(e.x,e.y,e.width,e.height,l)
}}}
r.push(h)
}
if(!t){
n.zShow(true)
}
if(h==ZmAppViewMgr.C_SASH){
if(this._sashSupported){
n.registerCallback(this._appTreeSashCallback,this)
}
n.setCursor("default")
}}
if(c){
this._fitToContainer(r)
}};
ZmAppViewMgr.prototype.setComponent=function(o,t){
var e=this._components[o];
if(e){
e.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE)
}
var a={};
a[o]=t;
this.addComponents(a,true)
};
ZmAppViewMgr.prototype.showSearchBuilder=function(t){
skin.show("searchBuilder",t);
this._components[ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR].zShow(t);
this._components[ZmAppViewMgr.C_SEARCH_BUILDER].zShow(t);
var e=[ZmAppViewMgr.C_SEARCH_BUILDER,ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR,ZmAppViewMgr.C_APP_CHOOSER,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL];
this._fitToContainer(e);
if(!t){
this._components[ZmAppViewMgr.C_SEARCH_BUILDER].setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE)
}};
ZmAppViewMgr.prototype.showTreeFooter=function(e){
skin.show("treeFooter",e);
this._components[ZmAppViewMgr.C_TREE_FOOTER].zShow(e&&!this.isFullScreen());
this._fitToContainer([ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER])
};
ZmAppViewMgr.prototype.getCurrentViewId=function(){
return this._currentView
};
ZmAppViewMgr.prototype.getCurrentViewComponent=function(e){
return this._components[e]
};
ZmAppViewMgr.prototype.getLastViewId=function(){
return this._lastView
};
ZmAppViewMgr.prototype.getCurrentView=function(){
var e=this._views[this._currentView];
return e?e[ZmAppViewMgr.C_APP_CONTENT]||e[ZmAppViewMgr.C_APP_CONTENT_FULL]:null
};
ZmAppViewMgr.prototype.getAppView=function(e){
return this._appView[e]
};
ZmAppViewMgr.prototype.setAppView=function(t,e){
this._appView[t]=e
};
ZmAppViewMgr.prototype.createView=function(t){
var e=t.viewId;
this._views[e]=t.elements;
this._callbacks[e]=t.callbacks||{};
this._viewApp[e]=t.appName;
this._isAppView[e]=t.isAppView;
this._isTransient[e]=t.isTransient;
if(!this._isNewWindow&&t.tabParams){
this._tabParams[e]=t.tabParams;
this._isTabView[e]=Boolean(t.tabParams!=null);
this._viewByTabId[t.tabParams.id]=e
}};
ZmAppViewMgr.prototype.pushView=function(c,t){
c=this._viewByTabId[c]||c;
var a=(c==ZmAppViewMgr.PENDING_VIEW);
if(!a&&!this._views[c]){
return false
}
if(a){
c=this._pendingView
}
var e=this._getViewController(c);
if(c==this._currentView){
this._setViewVisible(c,true);
if(e){
e._restoreFocus()
}
return true
}
if(this._isTabView[c]){
var l=this._tabParams[c];
var r=l&&l.tabCallback&&l.tabCallback.run(this._currentView,c);
if(l&&!r){
var u=appCtxt.getAppChooser();
var s=u.getButton(l.id);
if(!s){
s=u.addButton(l.id,l);
s.setHoverImage("Close")
}}}
if(a){
t=true
}
if(!this._hideView(this._currentView,t||this._isTabView[this._currentView])){
this._pendingAction=this._pushCallback;
this._pendingView=c;
return false
}
this.addComponents(this._views[c]);
var h=this._getViewController(this._currentView);
var o=this._isTransient[this._currentView]||(h&&h.isTransient(this._currentView,c));
if(this._currentView&&(this._currentView!=c)&&!o){
this._hidden.push(this._currentView)
}
this._removeFromHidden(c);
var d=this._lastView;
this._lastView=this._currentView;
this._currentView=c;
if(!this._showView(c,t,(c!=this._currentView))){
this._currentView=this._lastView;
this._lastView=d;
this._pendingAction=this._pushCallback;
this._pendingView=c;
return false
}
if(this._noHistory){
this._noHistory=false
}else{
if(c!=ZmId.VIEW_LOADING){
this._nextHashIndex++;
this._curHashIndex=this._nextHashIndex;
this._hashView[this._curHashIndex]=c;
if(this._historyMgr){
this._historyMgr.add(this._curHashIndex)
}}}
this._layout(this._currentView);
if(e&&e.setCurrentView){
e.setCurrentView(c)
}
if(this._isAppView[c]){
this.setAppView(this._viewApp[c],c)
}
if(this._toRemove.length){
for(var n=0;
n<this._toRemove.length;
n++){
this._removeFromHidden(this._toRemove[n])
}
this._toRemove=[]
}
return true
};
ZmAppViewMgr.prototype.popView=function(n,e,h){
if(!this._currentView){
return false
}
var r=(n==ZmAppViewMgr.PENDING_VIEW);
if(r){
e=n;
n=true
}
if(e&&!r&&(this.getCurrentViewId()!=e)){
return false
}
var s=false,a=false;
var o=null;
if(!this._hidden.length&&!this._isNewWindow){
s=!this._isTabView[this._currentView];
a=true;
var t=AjxStringUtil.parseQueryString();
if(t&&((t.view&&t.view=="compose")||t.id)){
o=ZmApp.MAIL
}}
if(!this._hideView(this._currentView,n,s)){
this._pendingAction=this._popCallback;
this._pendingView=null;
return false
}
this._deactivateView(this._views[this._currentView]);
if(this._isTabView[this._currentView]){
appCtxt.getAppChooser().removeButton(this._tabParams[this._currentView].id)
}
if(a){
if(o){
this._controller.activateApp(ZmApp.MAIL)
}
return !s
}
this._lastView=this._currentView;
this._currentView=this._hidden.pop();
if(!this._currentView&&this._isNewWindow){
window.close();
return false
}
if(!this._showView(this._currentView,this._popCallback,null,n,true)){
return false
}
this._removeFromHidden(this._currentView);
if(this._historyMgr&&!h){
if(this._noHistory){
this._noHistory=false
}else{
this._ignoreHistoryChange=true;
history.back()
}}
this.addComponents(this._views[this._currentView]);
this._layout(this._currentView);
return true
};
ZmAppViewMgr.prototype.setView=function(t,n){
var e=this.pushView(t,n);
if(e){
for(var o=0;
o<this._hidden.length;
o++){
var a=this._views[this._hidden[o]];
this._deactivateView(a)
}
this._hidden=[]
}
return e
};
ZmAppViewMgr.prototype.stageView=function(e){
this._removeFromHidden(e);
this._hidden.push(e)
};
ZmAppViewMgr.prototype.replaceView=function(n,e){
n=n||this._currentView;
var t=this._views[n];
var o=this._views[e];
this._hideView(n,true);
for(var a in o){
t[a]=o[a]
}
if(this._currentView==n){
this._currentView=e;
this._showView(e);
this._layout(this._currentView)
}};
ZmAppViewMgr.prototype.isAppView=function(e){
return this._isAppView[e]
};
ZmAppViewMgr.prototype.showPendingView=function(e){
if(e&&this._pendingAction){
this._pendingAction.run(ZmAppViewMgr.PENDING_VIEW)
}
if(!e){
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._fitToContainer(ZmAppViewMgr.ALL_COMPONENTS)
};
ZmAppViewMgr.prototype.getPendingViewId=function(){
return this._pendingView
};
ZmAppViewMgr.prototype.reset=function(){
this._shell.removeControlListener(this._controlListener);
for(var t in this._views){
var a=this._views[t];
for(var e=0;
e<a.length;
e++){
for(var o in a[e]){
this._components[o].dispose();
this._components[o]=null;
this._containers[o]=null
}}}};
ZmAppViewMgr.prototype.updateTitle=function(){
this._setTitle(this._currentView)
};
ZmAppViewMgr.prototype.setTabTitle=function(e,o){
var a=this._tabParams[e];
var t=!appCtxt.isChildWindow&&a&&appCtxt.getAppChooser().getButton(a.id);
if(t){
t.setText(AjxStringUtil.htmlEncode(o))
}};
ZmAppViewMgr.prototype.isOkToUnload=function(){
var t=AjxUtil.getHashKeys(this._isTabView);
if(!this._isTabView[this._currentView]){
t.push(this._currentView)
}
for(var o=0;
o<t.length;
o++){
var e=t[o];
var n=this._callbacks[e]&&this._callbacks[e][ZmAppViewMgr.CB_PRE_UNLOAD];
if(n){
var a=n.run(e);
if(!a){
return false
}}}
return true
};
ZmAppViewMgr.prototype._createLoadingView=function(){
var t=new DwtControl({
parent:this._shell,className:"DwtListView",posStyle:Dwt.ABSOLUTE_STYLE,id:ZmId.LOADING_VIEW}
);
var e=t.getHtmlElement();
e.innerHTML=AjxTemplate.expand("share.App#Loading",this._htmlElId);
var a={};
a[ZmAppViewMgr.C_APP_CONTENT]=t;
this.createView({
viewId:ZmId.VIEW_LOADING,elements:a}
)
};
ZmAppViewMgr.prototype._fitToContainer=function(n,h){
for(var t=0;
t<n.length;
t++){
var r=n[t];
if(!h&&AjxEnv.isIE&&(r==ZmAppViewMgr.C_TASKBAR)){
if(!this._ieHackAction){
this._ieHackAction=new AjxTimedAction(this,this._fitToContainer,[[ZmAppViewMgr.C_TASKBAR],true])
}
AjxTimedAction.scheduleAction(this._ieHackAction,1)
}
var u=this._containers[r];
if(u){
var s=this._components[r];
if(s&&(s.getZIndex()!=Dwt.Z_HIDDEN)){
var a=this._getComponentPosition(r);
var c=(a==Dwt.STATIC_STYLE);
var d=s.getHtmlElement();
if(a){
d.style.position=a
}
if(c){
if(d.parentNode!=u){
u.appendChild(d)
}
if(s.adjustSize){
s.adjustSize()
}}else{
var o=Dwt.getBounds(u);
var e=Dwt.getInsets(u);
Dwt.insetBounds(o,e);
this._contBounds[r]=o;
var l=Boolean(this._components[ZmAppViewMgr.C_TOOLBAR_TOP]);
s.setBounds(o.x,o.y,o.width,o.height,l)
}}}}
if(window.DBG&&DBG.getDebugLevel()>=AjxDebug.DBG2){
this._debugShowMetrics(n)
}};
ZmAppViewMgr.prototype._getComponentPosition=function(e){
return appCtxt.getSkinHint(e,"position")
};
ZmAppViewMgr.prototype._getContainerBounds=function(n){
var e=this._getComponentPosition(n);
if(e==Dwt.STATIC_STYLE){
return null
}
var a=this._containers[n];
if(a){
var o=Dwt.getBounds(a);
var t=Dwt.getInsets(a);
Dwt.insetBounds(o,t);
return o
}
return null
};
ZmAppViewMgr.prototype._layout=function(t){
if(this._hasSkin){
return
}
var a=this._components[ZmAppViewMgr.C_TOOLBAR_TOP];
var n=a.getSize();
var e=n.y?n.y:a.getHtmlElement().clientHeight;
a.setBounds(0,0,this._shellSz.x,e);
var o=this._components[ZmAppViewMgr.C_APP_CONTENT]||this._components[ZmAppViewMgr.C_APP_CONTENT_FULL];
o.setBounds(0,e,this._shellSz.x,this._shellSz.y-e,Boolean(a))
};
ZmAppViewMgr.prototype._hideView=function(e,a,o){
if(!e){
return true
}
var t=true;
var n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_PRE_HIDE]:null;
if(n){
t=n.run(e,a)
}
if(t){
if(!o){
this._setViewVisible(e,false)
}
if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){
appCtxt.getKeyboardMgr().clearKeySeq()
}
n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_POST_HIDE]:null;
if(n){
n.run(e)
}}
return t
};
ZmAppViewMgr.prototype._showView=function(e,o,a){
var t=true;
var n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_PRE_SHOW]:null;
if(n){
t=n.run(e,a,o)
}
if(t){
this._setViewVisible(e,true);
n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_POST_SHOW]:null;
if(n){
n.run(e,a)
}}
this._onShowView(e,o,a);
return t
};
ZmAppViewMgr.prototype._onShowView=function(e,a,t){
appCtxt.notifyZimlets("onShowView",[e,t])
};
ZmAppViewMgr.prototype._setViewVisible=function(d,u){
var t=this._views[d];
var n=this._lastView?this.isFullScreen(this._lastView):null;
var a=this.isFullScreen(d);
if(u){
if(n!==a){
if(this._hasSkin){
skin.show("fullScreen",a)
}
for(var s=0;
s<ZmAppViewMgr.APP_COMPONENTS.length;
s++){
var c=ZmAppViewMgr.APP_COMPONENTS[s];
var r=this._components[c];
if(!r){
continue
}
r.zShow(!a);
if(a){
try{
r.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE)
}
catch(l){}}}
if(!a&&this._hasSkin){
this._fitToContainer(ZmAppViewMgr.APP_COMPONENTS)
}}
var h=[];
for(var c in t){
h.push(c);
t[c].zShow(true);
this._components[c]=t[c]
}
if(this._hasSkin){
this._fitToContainer(h)
}
this._setTitle(d);
if(this._isTabView[d]){
var o=this._tabParams[d].id;
this._controller.setActiveTabId(o)
}
if(this._viewApp[d]){
this._controller.setActiveApp(this._viewApp[d],d,this._isTabView[d])
}}else{
for(var c in t){
t[c].setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE);
t[c].zShow(false)
}}};
ZmAppViewMgr.prototype._removeFromHidden=function(e){
var a=[];
for(var t=0;
t<this._hidden.length;
t++){
if(this._hidden[t]!=e){
a.push(this._hidden[t])
}}
this._hidden=a
};
ZmAppViewMgr.prototype._deactivateView=function(e){
for(var a in e){
var t=e[a];
if(t.deactivate){
t.deactivate()
}}};
ZmAppViewMgr.prototype._setTitle=function(e){
var a=this._views[e];
if(!a){
return
}
var t=a[ZmAppViewMgr.C_APP_CONTENT]||a[ZmAppViewMgr.C_APP_CONTENT_FULL];
if(t&&t.getTitle){
var o=t.getTitle();
Dwt.setTitle(o?o:ZmMsg.zimbraTitle)
}};
ZmAppViewMgr.prototype._shellControlListener=function(o){
if(o.oldWidth!=o.newWidth||o.oldHeight!=o.newHeight){
this._shellSz.x=o.newWidth;
this._shellSz.y=o.newHeight;
var a=o.newWidth-o.oldWidth;
var r=o.newHeight-o.oldHeight;
if(this._isNewWindow){
var e=this._views[this._currentView];
if(e){
var t=e[ZmAppViewMgr.C_TOOLBAR_TOP];
if(t){
t.setSize(o.newWidth,Dwt.DEFAULT)
}
var s=e[ZmAppViewMgr.C_APP_CONTENT]||e[ZmAppViewMgr.C_APP_CONTENT_FULL];
if(s){
s.setSize(o.newWidth,o.newHeight-t.getH())
}}}else{
if(r&&a){
this.fitAll(true)
}else{
if(r){
var n=[ZmAppViewMgr.C_APP_CHOOSER,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_SASH,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL,ZmAppViewMgr.C_STATUS,ZmAppViewMgr.C_TASKBAR,ZmAppViewMgr.C_AD,ZmAppViewMgr.C_FOOTER];
this._fitToContainer(n,true)
}else{
if(a){
var n=[ZmAppViewMgr.C_BANNER,ZmAppViewMgr.C_SEARCH,ZmAppViewMgr.C_PEOPLE_SEARCH,ZmAppViewMgr.C_USER_INFO,ZmAppViewMgr.C_QUOTA_INFO,ZmAppViewMgr.C_SEARCH_BUILDER,ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL,ZmAppViewMgr.C_TOOLBAR_BOTTOM,ZmAppViewMgr.C_TASKBAR,ZmAppViewMgr.C_AD,ZmAppViewMgr.C_FOOTER];
this._fitToContainer(n,true)
}}}}}};
ZmAppViewMgr.prototype._debugShowMetrics=function(o){
for(var t=0;
t<o.length;
t++){
var n=o[t];
var e=this._containers[n];
if(e){
var a=Dwt.getBounds(e)
}}};
ZmAppViewMgr.prototype._historyChangeListener=function(a){
if(appCtxt.inStartup){
return
}
if(!(a&&a.data)){
return
}
if(this._ignoreHistoryChange){
this._ignoreHistoryChange=false;
return
}
var o=DwtBaseDialog.getActiveDialog();
if(o&&o.isPoppedUp()){
o.popdown()
}
var t=parseInt(a.data);
this._noHistory=true;
var e=this._hashView[t];
if(t==(this._curHashIndex-1)){
this._browserAction=ZmAppViewMgr.BROWSER_BACK;
this.popView()
}else{
if(t==(this._curHashIndex+1)){
this._browserAction=ZmAppViewMgr.BROWSER_FORWARD;
this.pushView(e)
}else{
this._browserAction=null;
this.pushView(e)
}}
this._curHashIndex=t
};
ZmAppViewMgr.prototype._appTreeSashCallback=function(o){
if(!window.skin){
return
}
var e=skin.getTreeWidth();
if(!e){
return 0
}
if(!this.treeMinSize){
this.treeMinSize=window.skin.hints.tree.minWidth||150;
this.treeMaxSize=window.skin.hints.tree.maxWidth||300
}
if(e+o>this.treeMaxSize){
o=Math.max(0,this.treeMaxSize-e)
}
if(e+o<this.treeMinSize){
o=Math.min(0,this.treeMinSize-e)
}
var t=e+o;
skin.setTreeWidth(t);
var a=this;
setTimeout(function(){
a.fitAll(true)
}
,0);
return o
};
ZmAppViewMgr.prototype._getViewController=function(e){
var o;
var t=this._views[e];
if(t){
var a=t[ZmAppViewMgr.C_APP_CONTENT]||t[ZmAppViewMgr.C_APP_CONTENT_FULL];
o=a&&a.getController&&a.getController()
}
return o
}
}
if(AjxPackage.define("zimbraMail.core.ZmRequestMgr")){
ZmRequestMgr=function(e){
this._controller=e;
appCtxt.setRequestMgr(this);
ZmCsfeCommand.setServerUri(appCtxt.get(ZmSetting.CSFE_SERVER_URI));
var t=appCtxt.get(ZmSetting.CLIENT_VERSION);
ZmCsfeCommand.clientVersion=(!t||t.indexOf("@")==0)?"dev build":t;
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._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.prototype.toString=function(){
return"ZmRequestMgr"
};
ZmRequestMgr.prototype.sendRequest=function(x){
var t=x.response;
if(t){
if(x.reqId){
x=this._pendingRequests[x.reqId]||x;
x.response=t
}
x.asyncMode=true;
return this._handleResponseSendRequest(x,new ZmCsfeResult(t))
}
var y=x.reqId=("Req_"+ZmRequestMgr._nextReqId++);
var c=(x.timeout!=null)?x.timeout:this._stdTimeout;
if(c){
c=c*1000
}
var q=x.asyncMode?new AjxCallback(this,this._handleResponseSendRequest,[x]):null;
if(x.sensitive){
var v=document.location.protocol==ZmSetting.PROTO_HTTP;
var s=appCtxt.get(ZmSetting.PROTOCOL_MODE)==ZmSetting.PROTO_MIXED;
if(v&&s){
x.noSession=true;
var o=ZmCsfeCommand.getRequestStr(x);
var d=document.location;
var u=appCtxt.get(ZmSetting.HTTPS_PORT);
if(u&&u!=ZmSetting.DEFAULT_HTTPS_PORT){
u=":"+u
}
var h=document.createElement("IFRAME");
h.style.display="none";
h.id=Dwt.getNextId();
document.body.appendChild(h);
var p=Dwt.getIframeDoc(h);
p.write("<form ","id=",h.id,"-form ","target=",h.id,"-iframe ","method=POST ","action='https://",d.hostname,u,appContextPath,"/public/secureRequest.jsp'",">","<input type=hidden name=reqId value='",y,"'>","<textarea name=data>",AjxStringUtil.htmlEncode(o),"</textarea>","</form>","<iframe name=",h.id,"-iframe></iframe>");
p.close();
x.iframeId=h.id;
this._pendingRequests[y]=x;
var a=p.getElementById(h.id+"-form");
a.submit();
return
}}
var n=new ZmCsfeCommand();
var e=x.accountName;
if(!e){
var f=appCtxt.getActiveAccount();
e=(f&&f.id!=ZmAccountList.DEFAULT_ID)?f.name:null
}
var l,m;
if(x.restUri){
l={
restUri:x.restUri,asyncMode:x.asyncMode,callback:q}
}else{
l={
jsonObj:x.jsonObj,soapDoc:x.soapDoc,accountName:e,useXml:this._useXml,changeToken:(e?null:this._changeToken),asyncMode:x.asyncMode,callback:q,logRequest:this._logRequest,highestNotifySeen:this._highestNotifySeen,noAuthToken:true,skipAuthCheck:x.skipAuthCheck,resend:x.resend,noSession:x.noSession};
m=x.methodName=ZmCsfeCommand.getMethodName(l.jsonObj||l.soapDoc)
}
appCtxt.currentRequestParams=x;
var b=c?[y,x.errorCallback,x.noBusyOverlay]:null;
if(!x.noBusyOverlay){
var r=null;
var g=false;
if(c){
r=new AjxCallback(this,this.cancelRequest,b);
this._shell.setBusyDialogText(ZmMsg.askCancel);
g=true
}
this._shell.setBusy(true,y,g,c,r)
}else{
if(c){
var w=new AjxTimedAction(this,this.cancelRequest,b);
this._cancelActionId[y]=AjxTimedAction.scheduleAction(w,c)
}}
this._pendingRequests[y]=n;
try{
var t=x.restUri?n.invokeRest(l):n.invoke(l);
n.state=ZmRequestMgr._SENT
}
catch(k){
this._handleResponseSendRequest(x,new ZmCsfeResult(k,true));
return
}
return(x.asyncMode)?y:(this._handleResponseSendRequest(x,t))
};
ZmRequestMgr.prototype._handleResponseSendRequest=function(e,l){
var h=(e.response!=null);
if(!h){
if(!this._pendingRequests[e.reqId]){
return
}
if(this._pendingRequests[e.reqId].state==ZmRequestMgr._CANCEL){
return
}
this._pendingRequests[e.reqId].state=ZmRequestMgr._RESPONSE;
if(!e.noBusyOverlay){
this._shell.setBusy(false,e.reqId)
}else{
if(e.timeout){
AjxTimedAction.cancelAction(this._cancelActionId[e.reqId]);
this._cancelActionId[e.reqId]=-1
}}}
var t,r;
try{
if(e.asyncMode&&!e.restUri){
t=l.getResponse()
}else{
if(l._isException){
throw l._data
}else{
t=l
}}
if(t.Header){
r=this._handleHeader(t.Header)
}}
catch(o){
if(e.errorCallback){
var a=e.errorCallback.run(o);
if(!a){
this._handleException(o,e)
}}else{
this._handleException(o,e)
}
var s=l.getHeader();
if(s){
this._handleHeader(s);
this._handleNotifications(s)
}
this._clearPendingRequest(e.reqId);
return
}
if(e.asyncMode&&!e.restUri){
l.set(t.Body)
}
if(!appCtxt.isOffline&&!h){
this._controller._kickPolling(true)
}
var n=(DBG&&DBG.getDebugLevel()>0)?ZmCsfeCommand.getMethodName(e.jsonObj||e.soapDoc):"";
if(e.asyncMode&&e.callback){
e.callback.run(l)
}
this._handleNotifications(t.Header);
this._clearPendingRequest(e.reqId);
if(r&&(!appCtxt.isOffline||!appCtxt.multiAccounts)&&!e.more){
this._refreshHandler(r)
}
if(!e.asyncMode){
return t.Body
}};
ZmRequestMgr.prototype.cancelRequest=function(o,e,t){
if(!this._pendingRequests[o]){
return
}
if(this._pendingRequests[o].state==ZmRequestMgr._RESPONSE){
return
}
this._pendingRequests[o].state=ZmRequestMgr._CANCEL;
if(!t){
this._shell.setBusy(false,o)
}
this._pendingRequests[o].cancel();
if(e){
var a=new AjxException("Request canceled",AjxException.CANCELED,"ZmRequestMgr.prototype.cancelRequest");
e.run(a)
}
this._clearPendingRequest(o)
};
ZmRequestMgr.prototype._clearPendingRequest=function(a){
var t=this._pendingRequests[a];
if(t){
if(t.iframeId){
var e=document.getElementById(t.iframeId);
if(e){
e.parentNode.removeChild(e)
}}
delete this._pendingRequests[a]
}};
ZmRequestMgr.prototype._handleHeader=function(s){
var t=s&&s.context;
if(!t){
return
}
if(t.change){
this._changeToken=t.change.token
}
if(t.zdsync&&t.zdsync.account){
var e=t.zdsync.account;
for(var o=0;
o<e.length;
o++){
var n=appCtxt.accountList.getAccount(e[o].id);
if(n){
var a=e[o].dialog;
if(a){
this._handleOfflineInfoDialog(a[0],n)
}
n.updateState(e[o])
}}}
if(t.refresh){
this._controller.runAppFunction("_clearDeferredFolders");
this._loadTrees(t.refresh);
this._highestNotifySeen=0
}
return t.refresh
};
ZmRequestMgr.prototype._handleOfflineInfoDialog=function(a,o){
if(!a.type){
return
}
var e;
switch(a.type){
case ZmRequestMgr.OFFLINE_HEAP_DUMP:e=ZmMsg.offlineHeapDump;
break;
case ZmRequestMgr.OFFLINE_MUST_RESYNC:e=AjxMessageFormat.format(ZmMsg.offlineMustReSync,o.name);
break;
case ZmRequestMgr.OFFLINE_MUST_GAL_RESYNC:e=AjxMessageFormat.format(ZmMsg.offlineMustGalReSync,o.name);
break;
case ZmRequestMgr.OFFLINE_FOLDER_MOVE_FAILED:appCtxt.setStatusMsg(ZmMsg.offlineMoveFolderError);
break;
default:}
if(!e){
return
}
var t=appCtxt.getOkCancelMsgDialog();
t.setMessage(e);
t.registerCallback(DwtDialog.OK_BUTTON,this._handleOfflineDialogAction,this,[t,a.type,o.id,true]);
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._handleOfflineDialogAction,this,[t,a.type,o.id,false]);
t.popup()
};
ZmRequestMgr.prototype._handleOfflineDialogAction=function(n,a,t,o){
var e={
jsonObj:{
DialogActionRequest:{
_jsns:"urn:zimbraOffline",type:a,id:t,action:o?"yes":"no"}}
,callback:new AjxCallback(this,this._handleOfflineDialogActionResp,n),errorCallback:new AjxCallback(this,this._handleOfflineDialogActionResp,n),asyncMode:true};
this.sendRequest(e)
};
ZmRequestMgr.prototype._handleOfflineDialogActionResp=function(t,e){
if(t.isPoppedUp()){
t.popdown()
}};
ZmRequestMgr.prototype._handleException=function(e,a){
var t=false;
if(ZmRequestMgr.RETRY_ON_EXCEPTION[e.code]){
a.retryCount=a.retryCount||0;
if(a.retryCount<ZmRequestMgr.RETRY_MAX){
a.resend=ZmCsfeCommand.RETRY;
a.retryCount++;
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){
this.sendRequest(a)
}
),ZmRequestMgr.RETRY_DELAY*1000);
t=true
}}
if(!t){
this._controller._handleException(e,a)
}};
ZmRequestMgr.prototype._handleNotifications=function(n){
if(n&&n.context&&n.context.notify){
for(var o=0;
o<n.context.notify.length;
o++){
var a=n.context.notify[o];
var t=a.seq;
var e=n.context&&ZmCsfeCommand.extractSessionId(n.context.session);
if(a.seq>this._highestNotifySeen&&!(e&&ZmCsfeCommand._staleSession[e])){
if(window.isNotifyDebugOn){
appCtxt.setNotifyDebug(["Handling NOTIFY: ["+o+"] in _handleNotifications seq=",t].join(""))
}
this._highestNotifySeen=t;
this._notifyHandler(a)
}else{
if(window.isNotifyDebugOn){
appCtxt.setNotifyDebug(["Handling NOTIFY: Skipping notification[",o,"] seq=",t," highestNotifySeen=",this._highestNotifySeen].join(""))
}}}}};
ZmRequestMgr.prototype._refreshHandler=function(e){
AjxDebug.println(AjxDebug.NOTIFY,"REFRESH block received");
if(!appCtxt.inStartup){
this._controller._execPoll()
}
if(e.version){
if(!this._canceledReload){
var o=appCtxt.get(ZmSetting.SERVER_VERSION);
if(o!=e.version){
appCtxt.set(ZmSetting.SERVER_VERSION,e.version);
if(o){
var a=appCtxt.getYesNoMsgDialog();
a.reset();
a.registerCallback(DwtDialog.YES_BUTTON,this._reloadYesCallback,this,[a,o,e.version]);
a.registerCallback(DwtDialog.NO_BUTTON,this._reloadNoCallback,this,[a,e]);
var t=AjxMessageFormat.format(ZmMsg.versionChangeRestart,[o,e.version]);
a.setMessage(t,DwtMessageDialog.WARNING_STYLE);
a.popup();
return
}}}}
if(!this._recentlyRefreshed){
this._controller.runAppFunction("refresh",false,e);
this._recentlyRefreshed=true;
this._lastSkippedRefresh=null
}else{
this._lastSkippedRefresh=e
}
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(a){
var t={};
var e=appCtxt.multiAccounts?appCtxt.accountList.mainAccount:null;
this._loadTree(ZmOrganizer.TAG,t,a.tags,null,e);
this._loadTree(ZmOrganizer.FOLDER,t,a.folder[0],"folder",e)
};
ZmRequestMgr.prototype._reloadYesCallback=function(t){
t.popdown();
window.onbeforeunload=null;
var e=AjxUtil.formatUrl();
ZmZimbraMail.sendRedirect(e)
};
ZmRequestMgr.prototype._reloadNoCallback=function(e,t){
e.popdown();
this._canceledReload=true;
this._refreshHandler(t)
};
ZmRequestMgr.prototype._loadTree=function(a,t,s,r,n){
var o=(a==ZmOrganizer.TAG);
var e=appCtxt.getTree(a,n);
if(e){
e.reset()
}else{
e=o?new ZmTagTree(n):new ZmFolderTree()
}
appCtxt.setTree(a,e,n);
e.addChangeListener(this._unreadListener);
e.getUnreadHash(t);
e.loadFromJs(s,r,n)
};
ZmRequestMgr.prototype._notifyHandler=function(e){
if(window.isNotifyDebugOn){
var t=AjxStringUtil.objToString(e);
appCtxt.setNotifyDebug("Handling NOTIFY: in ZmRequestMgr _notifyHandler");
appCtxt.setNotifyDebug(t)
}
AjxDebug.println(AjxDebug.NOTIFY,"Notification block:");
AjxDebug.dumpObj(AjxDebug.NOTIFY,e);
this._controller.runAppFunction("preNotify",false,e);
if(e.deleted&&e.deleted.id){
this._handleDeletes(e.deleted)
}
if(e.created){
this._handleCreates(e.created)
}
if(e.modified){
this._handleModifies(e.modified)
}
this._controller.runAppFunction("postNotify",false,e)
};
ZmRequestMgr.prototype._handleDeletes=function(o){
var t=o.id.split(",");
this._controller.runAppFunction("deleteNotify",false,t);
for(var e=0;
e<t.length;
e++){
var n=t[e];
if(!n){
continue
}
var a=appCtxt.cacheGet(n);
if(a&&a.notifyDelete){
a.notifyDelete();
appCtxt.cacheRemove(n);
a=null
}}};
ZmRequestMgr.prototype._handleCreates=function(h){
this._controller.runAppFunction("createNotify",false,h);
for(var e in h){
var r=h[e];
for(var a=0;
a<r.length;
a++){
var n=r[a];
if(n._handled){
continue
}
if(appCtxt.cacheGet(n.id)&&e!="tag"){
continue
}
if(window.isNotifyDebugOn){
appCtxt.setNotifyDebug(["Handling NOTIFY: in ZmRequestMgr - _handleCreates handling CREATE for node: ",e].join(""))
}
if(e=="tag"){
var s=appCtxt.multiAccounts&&ZmOrganizer.parseId(n.id).account;
var t=appCtxt.getTagTree(s);
if(t){
t.root.notifyCreate(n)
}}else{
if(e=="folder"||e=="search"||e=="link"){
var o=n.l;
var l=appCtxt.getById(o);
if(l&&l.notifyCreate&&l.type!=ZmOrganizer.TAG){
l.notifyCreate(n,e)
}}}}}};
ZmRequestMgr.prototype._handleModifies=function(a){
this._controller.runAppFunction("modifyNotify",false,a);
for(var t in a){
if(t=="mbx"){
var c=a[t];
for(var n=0;
n<c.length;
n++){
var e=c[n];
var l=e.acct;
var s=l&&appCtxt.accountList.getAccount(l);
var u=appCtxt.getSettings(s).getSetting(ZmSetting.QUOTA_USED);
u.notifyModify({
_name:t,s:e.s,account:s}
)
}
continue
}
var r=a[t];
for(var n=0;
n<r.length;
n++){
var h=r[n];
if(h._handled){
continue
}
var d=appCtxt.cacheGet(h.id);
if(!d&&t=="cn"&&AjxDispatcher.loaded("ContactsCore")){
var o=appCtxt.getApp(ZmApp.CONTACTS);
if(o.isContactListLoaded()){
d=o.getContactList().getById(h.id)
}}
if(d&&d.notifyModify){
h._isRemote=(t=="folder"&&d.link);
d.notifyModify(h)
}}}};
ZmRequestMgr.prototype._unreadChangeListener=function(s){
if(s.event==ZmEvent.E_MODIFY){
var n=s.getDetail("fields");
if(n&&n[ZmOrganizer.F_UNREAD]){
var a=s.getDetail("organizers");
var r=a?a[0]:null;
var e=r?(r.isSystem()?r.nId:r.id):null;
var l=appCtxt.getCurrentSearch();
if(l){
var o=appCtxt.multiAccounts&&appCtxt.getById(l.folderId);
var t=(o&&o.getAccount()==appCtxt.getActiveAccount())?o.nId:l.folderId;
if(e&&(e==t||e==l.tagId)){
Dwt.setTitle(l.getTitle())
}}
var h=appCtxt.getApp(ZmApp.MAIL);
if(h){
h.setNewMailNotice(r)
}}}}
}
if(AjxPackage.define("zimbraMail.core.ZmZimbraMail")){
ZmZimbraMail=function(o){
ZmController.call(this,null);
appCtxt.setAppController(this);
window._zimbraMail=this;
this._evt=new ZmAppEvent();
this._evtMgr=new AjxEventMgr();
for(var t in ZmZimbraMail._listeners){
var a=ZmZimbraMail._listeners[t];
if(a&&a.length){
for(var e=0;
e<a.length;
e++){
this._evtMgr.addListener(t,a[e])
}}}
ZmZimbraMail.addListener=AjxCallback.simpleClosure(this.addListener,this);
ZmZimbraMail.addAppListener=AjxCallback.simpleClosure(this.addAppListener,this);
ZmOperation.initialize();
this._createSettings(o);
this._createEnabledApps();
this._initializeSettings(o);
this._postInitializeSettings();
this._shell=appCtxt.getShell();
this._userShell=o.userShell;
this._requestMgr=new ZmRequestMgr(this);
this._upsellView={};
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);
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(){
this._appViewMgr._toRemove.push(ZmId.VIEW_LOADING)
}
));
for(var e in ZmApp.QS_ARG){
ZmApp.QS_ARG_R[ZmApp.QS_ARG[e]]=e
}
this._shell.addGlobalSelectionListener(new AjxListener(this,this._globalSelectionListener));
this.startup(o)
};
ZmZimbraMail.prototype=new ZmController;
ZmZimbraMail.prototype.constructor=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.prototype.toString=function(){
return"ZmZimbraMail"
};
ZmZimbraMail.run=function(a){
if(a.noSplashScreen){
ZmZimbraMail.killSplash()
}
window.appCtxt=new ZmAppCtxt();
appCtxt.rememberMe=false;
if(a.offlineMode){
appCtxt.isOffline=true
}
var t=a.userShell=window.document.getElementById(ZmId.SKIN_SHELL);
if(!t){
alert("Could not get user shell - skin file did not load properly")
}
var e=new DwtShell({
userShell:t,docBodyScrollable:false,id:ZmId.SHELL}
);
appCtxt.setShell(e);
new ZmZimbraMail(a)
};
ZmZimbraMail.unload=function(){
if(!ZmZimbraMail._endSessionDone){
ZmZimbraMail._endSession()
}
if(ZmZimbraMail._isLogOff){
ZmZimbraMail._isLogOff=false;
if(window._zimbraMail){
window._zimbraMail.setSessionTimer(false)
}
ZmCsfeCommand.noAuth=true
}
var t=window._zimbraMail?window._zimbraMail._childWinList:null;
if(t){
for(var e=0;
e<t.size();
e++){
var a=t.get(e);
a.win.onbeforeunload=null;
a.win.parentController=null;
a.win.close()
}}
ZmZimbraMail.stayOnPagePrompt=false;
ZmZimbraMail.setExitTimer(false);
ZmZimbraMail.sessionTimerInvoked=false;
window._zimbraMail=window.onload=window.onunload=window.onresize=window.document.onkeypress=null
};
ZmZimbraMail.hashSortCompare=function(s,o,e){
var n=o?Number(s[o]):0;
var t=e?Number(s[e]):0;
if(n>t){
return 1
}
if(n<t){
return -1
}
return 0
};
ZmZimbraMail.killSplash=function(){
Dwt.hide("skin_container_splash_screen")
};
ZmZimbraMail.prototype.startup=function(o){
if(appCtxt.isOffline){
this.sendClientEventNotify(ZmZimbraMail.UI_LOAD_BEGIN)
}
appCtxt.inStartup=true;
if(typeof(skin)=="undefined"){}
skin.show("skin",true);
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_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);
this._components[ZmAppViewMgr.C_STATUS]=this.statusView=new ZmStatusView(this._shell,"ZmStatus",Dwt.ABSOLUTE_STYLE,ZmId.STATUS_VIEW);
if(appCtxt.isOffline){
this._initOfflineUserInfo()
}}
this._registerOrganizers();
for(var e in ZmSearch.TYPE){
ZmSearch.TYPE_MAP[ZmSearch.TYPE[e]]=e
}
ZmZimbraMail.registerViewsToTypeMap();
this._getStartApp(o);
this._postRenderCallbacks=[];
this._postRenderLast=0;
if(o.startApp==ZmApp.MAIL){
this._doingPostRenderStartup=true;
var s=new AjxCallback(this,function(){
AjxDispatcher.require("Startup2");
var r=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,r)){
this.handleCalendarComponents()
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED,null,r)){
this.handleTaskComponents()
}
var h=appCtxt.getSearchController();
h.getSearchToolbar().initAutocomplete();
if(!appCtxt.isChildWindow){
h.peopleSearchToolBar.initAutocomplete()
}}
);
this.addPostRenderCallback(s,0,0,true)
}
var a=AjxUtil.get(o,"getInfoResponse");
if(a){
this._requestMgr.sendRequest({
response:a}
)
}
var n=new AjxCallback(this,this._handleResponseGetMetaData,o);
appCtxt.accountList.mainAccount.loadMetaData(n);
if(appCtxt.isOffline){
var t=appCtxt.get(ZmSetting.OFFLINE_UPDATE_NOTIFY);
this._offlineUpdateChannelPref(t)
}};
ZmZimbraMail.registerViewsToTypeMap=function(){
for(var t in ZmOrganizer.VIEWS){
var a=ZmOrganizer.VIEWS[t];
for(var e=0;
e<a.length;
e++){
ZmOrganizer.TYPE[a[e]]=t
}}};
ZmZimbraMail.prototype._createSettings=function(n){
if(n.batchInfoResponse){
var t=n.batchInfoResponse.Body.BatchResponse;
var a=t.GetInfoResponse[0];
if(!a){
a={}
}
a.domainSettings=n.settings;
n.getInfoResponse={
Header:n.batchInfoResponse.Header,Body:{
GetInfoResponse:a}};
var o=AjxUtil.get(n.getInfoResponse,"Header","context","session");
if(o){
ZmCsfeCommand.setSessionId(o)
}
if(t.SearchResponse){
n.searchResponse={
Body:{
SearchResponse:t.SearchResponse[0]}}
}}
var e=new ZmSettings();
appCtxt.setSettings(e);
e.setUserSettings({
info:n.getInfoResponse.Body.GetInfoResponse,preInit:true}
)
};
ZmZimbraMail.prototype._initializeSettings=function(h){
var o=h.getInfoResponse.Body.GetInfoResponse;
var r=appCtxt.getSettings();
r.setUserSettings(o,null,true,true,true);
r.userSettingsLoaded=true;
var c=appCtxt.get(ZmSetting.BRANCH);
if(window.DBG&&!DBG.isDisabled()){}
if(h.offlineMode){
var e=AjxCookie.getCookie(document,ZmSetting.APPS_COOKIE);
if(e){
for(var s in ZmSetting.APP_LETTER){
var n=ZmSetting.APP_LETTER[s];
if(e.indexOf(n)!=-1){
r.getSetting(s).setValue(true)
}}}}
if(h.settings){
for(var t in h.settings){
var a=r.getSettingByName(t);
if(a){
r.getSetting(a).setValue(h.settings[t])
}}}
if(appCtxt.isOffline){
appCtxt.set(ZmSetting.POLLING_INTERVAL,60,null,null,true)
}
if(h.devMode=="1"){
appCtxt.set(ZmSetting.DEV,true);
appCtxt.set(ZmSetting.POLLING_INTERVAL,0)
}
if(h.protocolMode){
var l=(h.protocolMode.indexOf(":")==-1)?h.protocolMode+":":h.protocolMode;
appCtxt.set(ZmSetting.PROTOCOL_MODE,l)
}
if(h.httpPort){
appCtxt.set(ZmSetting.HTTP_PORT,h.httpPort)
}
if(h.httpsPort){
appCtxt.set(ZmSetting.HTTPS_PORT,h.httpsPort)
}
if(!appCtxt.get(ZmSetting.SPAM_ENABLED)){
ZmFolder.HIDE_ID[ZmFolder.ID_SPAM]=true
}};
ZmZimbraMail.prototype._postInitializeSettings=function(){
this._setCustomInvalidEmailPats()
};
ZmZimbraMail.prototype._setCustomInvalidEmailPats=function(){
var o=appCtxt.getSettings().getSetting(ZmSetting.EMAIL_VALIDATION_REGEX);
var e=[];
if(o){
e=o.value
}
for(var a=0;
a<e.length;
a++){
var t=e[a];
if(t&&t!=""){
AjxEmailAddress.customInvalidEmailPats.push(new RegExp(t))
}}};
ZmZimbraMail.prototype._handleResponseGetMetaData=function(e){
this._handleResponseLoadUserSettings(e)
};
ZmZimbraMail.prototype.showMiniCalendar=function(){
var e=appCtxt.getCalManager();
e.getMiniCalendar();
appCtxt.getAppViewMgr().showTreeFooter(true);
e.highlightMiniCal();
e.startDayRollTimer()
};
ZmZimbraMail.prototype.showReminder=function(){
var t=appCtxt.getCalManager();
var e=t.getReminderController();
e.refresh()
};
ZmZimbraMail.prototype.showTaskReminder=function(){
var t=appCtxt.getTaskManager();
var e=t.getReminderController();
e.refresh()
};
ZmZimbraMail.prototype._handleErrorStartup=function(t,e){
ZmZimbraMail.killSplash();
appCtxt.inStartup=false;
return false
};
ZmZimbraMail.prototype._handleResponseLoadUserSettings=function(t,e){
if(appCtxt.multiAccounts){
var a=new AjxCallback(this,this._handleResponseStartup,[t,e]);
appCtxt.accountList.loadAccounts(a)
}else{
this._handleResponseStartup(t,e)
}};
ZmZimbraMail.prototype._handleResponseStartup=function(o,e){
if(o&&o.settingOverrides){
this._needOverviewLayout=true;
for(var r in o.settingOverrides){
var t=appCtxt.getSetting(r);
if(t){
t.setValue(o.settingOverrides[r])
}}}
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._evtMgr.notifyListeners(ZmAppEvent.PRE_STARTUP,this._evt);
o.result=e;
var s=new AjxCallback(this,this._handleResponseStartup1,o);
if(this._doingPostRenderStartup){
this.addAppListener(o.startApp,ZmAppEvent.POST_RENDER,new AjxListener(this,this._postRenderStartup));
this._searchResponse=o.searchResponse
}else{
AjxDispatcher.require("Startup2")
}
var n=new AjxCallback(this,function(){
this.runAppFunction("startup",false,o.result)
}
);
this.addPostRenderCallback(n,2,100,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._evtMgr.notifyListeners(ZmAppEvent.POST_STARTUP,this._evt);
if(appCtxt.isOffline){
appCtxt.getSearchController().resetSearchToolbar()
}
var h=appCtxt.multiAccounts?"GetContactsForAllAccounts":"GetContacts";
AjxDispatcher.run(h);
if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&appCtxt.isOffline){
this.handleOfflineMailTo(location.search)
}}
);
this.addPostRenderCallback(n,5,100);
this.activateApp(o.startApp,false,s,this._errorCallback,o);
var a=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,a)&&!this._doingPostRenderStartup&&(o.startApp!=ZmApp.CALENDAR)){
this.handleCalendarComponents()
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED,null,a)&&!this._doingPostRenderStartup&&(o.startApp!=ZmApp.TASKS)){
this.handleTaskComponents()
}};
ZmZimbraMail.prototype.handleTaskComponents=function(){
var t=new AjxTimedAction(this,this.showTaskReminder);
var e=appCtxt.isOffline?0:ZmTasksApp.REMINDER_START_DELAY;
AjxTimedAction.scheduleAction(t,e)
};
ZmZimbraMail.prototype.handleCalendarComponents=function(){
if(appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){
var a=new AjxTimedAction(this,this.showMiniCalendar);
var e=appCtxt.isOffline?0:ZmCalendarApp.MINICAL_DELAY;
AjxTimedAction.scheduleAction(a,e)
}
var t=new AjxTimedAction(this,this.showReminder);
var e=appCtxt.isOffline?0:ZmCalendarApp.REMINDER_START_DELAY;
AjxTimedAction.scheduleAction(t,e)
};
ZmZimbraMail.prototype._handleResponseStartup1=function(t){
this._setExternalLinks();
this.setUserInfo();
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
this._components[ZmAppViewMgr.C_SEARCH]=appCtxt.getSearchController().searchPanel
}
if(appCtxt.get(ZmSetting.PEOPLE_SEARCH_ENABLED)&&(appCtxt.get(ZmSetting.CONTACTS_ENABLED)||appCtxt.get(ZmSetting.GAL_ENABLED)||appCtxt.isOffline)){
this._components[ZmAppViewMgr.C_PEOPLE_SEARCH]=appCtxt.getSearchController().peopleSearchToolBar
}else{
Dwt.hide(ZmId.SKIN_PEOPLE_SEARCH)
}
this.getKeyMapMgr();
this.setSessionTimer(true);
ZmZimbraMail.killSplash();
this.runAppFunction("addComponents",false,this._components);
var e=this._appViewMgr._components;
this._appViewMgr.addComponents(this._components,true);
if(e){
this._appViewMgr.addComponents(e,true)
}
this._checkLicense();
if(!this._doingPostRenderStartup){
this._postRenderStartup()
}};
ZmZimbraMail.prototype._checkLicense=function(t){
var e=appCtxt.get(ZmSetting.LICENSE_STATUS);
var o=ZmSetting.LICENSE_MSG[e];
if(o){
AjxDispatcher.require("Startup2");
var a=appCtxt.getMsgDialog();
a.reset();
a.setMessage(o,DwtMessageDialog.WARNING_STYLE);
a.popup()
}};
ZmZimbraMail.prototype._postRenderStartup=function(e){
this._postRenderCallbacks.sort(function(o,t){
return o.order-t.order
}
);
this._runNextPostRenderCallback()
};
ZmZimbraMail.prototype._runNextPostRenderCallback=function(){
if(this._postRenderCallbacks&&this._postRenderCallbacks.length){
var e=this._postRenderCallbacks.shift();
if(!e){
return
}
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){
e.callback.run();
this._runNextPostRenderCallback()
}
),e.delay)
}else{
if(appCtxt.isOffline){
this.sendClientEventNotify(ZmZimbraMail.UI_LOAD_END);
if(AjxEnv.isPrism){
this._firstTimeNetworkChange=true;
var t=new ZimbraNetworkChecker();
t.addEventListener("offline",function(a){
window.appCtxt.getAppController().handleNetworkChange(false)
}
,false);
t.addEventListener("online",function(a){
window.appCtxt.getAppController().handleNetworkChange(true)
}
,false)
}}}};
ZmZimbraMail.prototype.handleNetworkChange=function(e){
this._isPrismOnline=e;
if(this._isUserOnline||this._firstTimeNetworkChange){
this._updateNetworkStatus(e)
}};
ZmZimbraMail.prototype._updateNetworkStatus=function(e){
if((e&&this._currentNetworkStatus==ZmZimbraMail.UI_NETWORK_UP)||(!e&&this._currentNetworkStatus==ZmZimbraMail.UI_NETWORK_DOWN)){
return
}
if(e){
if(!this._firstTimeNetworkChange){
this.setStatusMsg(ZmMsg.networkChangeOnline)
}else{
this._firstTimeNetworkChange=false;
this._isUserOnline=e
}
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(e?ZmMsg.networkStatusOffline:ZmMsg.networkStatusOnline);
this._networkStatusIcon.getHtmlElement().innerHTML=AjxImg.getImageHtml(e?"Connect":"Disconnect");
var t=e?ZmMsg.imStatusOnline:ZmMsg.imStatusOffline;
this._networkStatusText.getHtmlElement().innerHTML=t.substr(0,1).toUpperCase()+t.substr(1)
};
ZmZimbraMail.prototype.addPostRenderCallback=function(o,e,t,a){
if(!this._doingPostRenderStartup&&a){
o.run()
}else{
e=e||this._postRenderLast++;
this._postRenderCallbacks.push({
callback:o,order:e,delay:t||0}
)
}};
ZmZimbraMail.prototype._getStartApp=function(a){
var e;
var r=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(a&&a.app){
e=ZmApp.QS_ARG_R[a.app.toLowerCase()];
var l=ZmApp.SETTING[e];
var o=ZmApp.UPSELL_SETTING[e];
if(l&&!appCtxt.get(l,null,r)&&(!o||!appCtxt.get(o))){
e=null
}}
if(!e){
for(var t in ZmApp.DEFAULT_SORT){
ZmApp.DEFAULT_APPS.push(t)
}
ZmApp.DEFAULT_APPS.sort(function(d,c){
return ZmZimbraMail.hashSortCompare(ZmApp.DEFAULT_SORT,d,c)
}
);
var n=null;
for(var s=0;
s<ZmApp.DEFAULT_APPS.length;
s++){
var t=ZmApp.DEFAULT_APPS[s];
var l=ZmApp.SETTING[t];
if(!l||appCtxt.get(l,null,r)){
n=t;
break
}}
e=this._getDefaultStartAppName(r)
}
var h=AjxStringUtil.parseQueryString();
if(h&&h.view&&!h.app){
e=ZmApp.QS_VIEWS[h.view]
}
a.startApp=e;
a.qsParams=h
};
ZmZimbraMail.prototype._getDefaultStartAppName=function(o){
o=o||(appCtxt.multiAccounts&&appCtxt.accountList.mainAccount)||null;
for(var n in ZmApp.DEFAULT_SORT){
ZmApp.DEFAULT_APPS.push(n)
}
ZmApp.DEFAULT_APPS.sort(function(r,s){
return ZmZimbraMail.hashSortCompare(ZmApp.DEFAULT_SORT,r,s)
}
);
var e=null;
for(var t=0;
t<ZmApp.DEFAULT_APPS.length;
t++){
var n=ZmApp.DEFAULT_APPS[t];
var a=ZmApp.SETTING[n];
if(!a||appCtxt.get(a,null,o)){
return n
}}};
ZmZimbraMail.prototype.restart=function(e){
this.reset();
this.startup({
settingOverrides:e}
)
};
ZmZimbraMail.prototype.reset=function(){
ZmCsfeCommand.clearSessionId();
appCtxt.accountList.resetTrees();
if(!appCtxt.rememberMe()){
appCtxt.getLoginDialog().clearAll()
}
for(var e in this._apps){
this._apps[e]=null
}
this._activeApp=null;
this._appViewMgr.reset()
};
ZmZimbraMail.prototype.cancelRequest=function(a,e,t){
this._requestMgr.cancelRequest(a,e,t)
};
ZmZimbraMail.prototype.sendRequest=function(e){
return this._requestMgr.sendRequest(e)
};
ZmZimbraMail.prototype.runAppFunction=function(h,e){
var s=[];
for(var o=2;
o<arguments.length;
o++){
s.push(arguments[o])
}
for(var o=0;
o<ZmApp.APPS.length;
o++){
var r=ZmApp.APPS[o];
var l=ZmApp.SETTING[r];
var n=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(!l||appCtxt.get(l,null,n)||e){
var a=appCtxt.getApp(r,null,n);
var t=a&&a[h];
if(t&&(typeof(t)=="function")){
t.apply(a,s)
}}}};
ZmZimbraMail.prototype._createEnabledApps=function(n){
this._apps={};
for(var s in ZmApp.CLASS){
if(!n||n[s]){
ZmApp.APPS.push(s)
}}
ZmApp.APPS.sort(function(h,r){
return ZmZimbraMail.hashSortCompare(ZmApp.LOAD_SORT,h,r)
}
);
for(var t=0;
t<ZmApp.APPS.length;
t++){
var s=ZmApp.APPS[t];
var o=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var e=ZmApp.SETTING[s]&&appCtxt.get(ZmApp.SETTING[s],null,o);
var a=ZmApp.UPSELL_SETTING[s]&&appCtxt.get(ZmApp.UPSELL_SETTING[s]);
if(e||a){
ZmApp.ENABLED_APPS[s]=true;
this._createApp(s);
this._apps[s].isUpsell=(!e&&a)
}}};
ZmZimbraMail.addListener=function(e,t){
if(!ZmZimbraMail._listeners[e]){
ZmZimbraMail._listeners[e]=[]
}
ZmZimbraMail._listeners[e].push(t)
};
ZmZimbraMail.addAppListener=function(e,t,a){
t=[e,t].join("_");
ZmZimbraMail.addListener(t,a)
};
ZmZimbraMail.prototype.addListener=function(e,t){
return this._evtMgr.addListener(e,t)
};
ZmZimbraMail.prototype.removeListener=function(e,t){
return this._evtMgr.removeListener(e,t)
};
ZmZimbraMail.prototype.addAppListener=function(a,e,t){
e=[a,e].join("_");
return this.addListener(e,t)
};
ZmZimbraMail.prototype.removeAppListener=function(a,e,t){
e=[a,e].join("_");
return this.removeListener(e,t)
};
ZmZimbraMail.prototype.sendNoOp=function(){
var t=AjxSoapDoc.create("NoOpRequest","urn:zimbraMail");
var e=appCtxt.isOffline&&appCtxt.accountList.mainAccount.name;
this.sendRequest({
soapDoc:t,asyncMode:true,noBusyOverlay:true,accountName:e}
)
};
ZmZimbraMail.prototype.sendClientEventNotify=function(t,e){
var a={
jsonObj:{
ClientEventNotifyRequest:{
_jsns:"urn:zimbraOffline",e:t}}
,asyncMode:true};
if(e){
a.callback=new AjxCallback(this,this.handleClientEventNotifyResponse,t);
a.noBusyOverlay=true;
if(this.clientEventNotifyReqId){
appCtxt.getRequestMgr().cancelRequest(this.clientEventNotifyReqId)
}
this.clientEventNotifyTimerId=AjxTimedAction.scheduleAction(new AjxTimedAction(this,this.sendClientEventNotify,[t,true]),3000)
}else{
a.callback=new AjxCallback(this,this.setInstantNotify,true)
}
this.clientEventNotifyReqId=this.sendRequest(a)
};
ZmZimbraMail.prototype.handleClientEventNotifyResponse=function(t,e){
if(!e.isException()&&e.getResponse()){
if(this.clientEventNotifyTimerId){
AjxTimedAction.cancelAction(this.clientEventNotifyTimerId);
this.clientEventNotityTimerId=null
}
this.setInstantNotify(true)
}};
ZmZimbraMail.prototype.setInstantNotify=function(e){
if(e){
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(s,o){
if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&window.platform){
try{
if(o){
if(s){
var e=appCtxt.get(ZmSetting.OFFLINE_WEBAPP_URI,null,appCtxt.accountList.mainAccount);
window.platform.registerProtocolHandler("mailto",e+"&mailto=%s");
if(AjxEnv.isWindows){
var a=new ZimbraDesktopShell;
a.defaultClient=true
}}
var n=AjxCallback.simpleClosure(this.handleOfflineMailTo,this);
window.platform.registerProtocolCallback("mailto",n)
}else{
window.platform.unregisterProtocolHandler("mailto");
if(AjxEnv.isWindows){
var a=new ZimbraDesktopShell;
a.defaultClient=false
}}}
catch(t){}}};
ZmZimbraMail.prototype.handleOfflineMailTo=function(a,s){
if(window.platform&&!window.platform.isRegisteredProtocolHandler("mailto")){
return false
}
var n=this.getApp(ZmApp.MAIL);
var e=(a.indexOf("mailto"));
if(e>=0){
var o="to="+decodeURIComponent(a.substring(e+7));
o=o.replace(/?/g,"&");
var t=n._showComposeView(s,o);
this._checkOfflineMailToAttachments(t,o);
return true
}
return false
};
ZmZimbraMail.prototype._checkOfflineMailToAttachments=function(o,r){
var a=r||location.search;
var n=a.match(/to=([^&]+)/);
var h=n?AjxStringUtil.urlComponentDecode(n[1]):null;
n=a.match(/attachments=([^&]+)/);
var t=n?(AjxStringUtil.urlComponentDecode(n[1]).replace(/+/g," ")):null;
if(h&&h.indexOf("mailto")==0){
h=h.replace(/mailto:/,"");
var e=h.split("?");
if(e.length>1){
e=e[1];
n=e.match(/attachments=([^&]+)/);
if(!t){
t=n?(AjxStringUtil.urlComponentDecode(n[1]).replace(/+/g," ")):null
}}}
if(t){
t=t.replace(/;$/,"");
t=t.split(";");
this._mailtoAttachmentsLength=t.length;
this._attachmentsProcessed=0;
this.attachment_ids=[];
for(var s=0;
s<t.length;
s++){
this._handleMailToAttachment(t[s],o)
}}};
ZmZimbraMail.prototype._handleMailToAttachment=function(h,l){
var s=h;
var t=s.replace(/^.*\/,"");
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
}
catch(c){
return
}
try{
var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
n.initWithPath(s);
var m=this._getAttachmentContentType(n);
var a=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
a.init(n,-1,-1,false);
var r=Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
r.setInputStream(a);
var u=new XMLHttpRequest();
u.open("POST",appCtxt.get(ZmSetting.CSFE_UPLOAD_URI)+"&fmt=extended,raw",true);
u.setRequestHeader("Cache-Control","no-cache");
u.setRequestHeader("X-Requested-With","XMLHttpRequest");
u.setRequestHeader("Content-Type",(m||"application/octet-stream"));
u.setRequestHeader("Content-Disposition",'attachment; filename="'+t+'"');
var o=u;
u.onreadystatechange=AjxCallback.simpleClosure(this._handleUploadResponse,this,o,l);
u.sendAsBinary(r.readBytes(r.available()));
delete u
}
catch(d){
this._attachmentsProcessed++
}};
ZmZimbraMail.prototype._getAttachmentContentType=function(t){
var a;
try{
a=Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService).getTypeFromFile(t)
}
catch(e){
a="application/octet-stream"
}
return a
};
ZmZimbraMail.prototype._handleUploadErrorResponse=function(t){
var e=appCtxt.getMsgDialog();
var a=DwtMessageDialog.CRITICAL_STYLE;
if(t=="200"){
return true
}else{
if(t=="413"){
e.setMessage(ZmMsg.errorAttachmentTooBig,a)
}else{
var o=AjxMessageFormat.format(ZmMsg.errorAttachment,(t||AjxPost.SC_NO_CONTENT));
e.setMessage(o,a)
}}
e.popup()
};
ZmZimbraMail.prototype._handleUploadResponse=function(req,controller){
if(req){
if(req.readyState==4&&req.status==200){
var resp=eval("["+req.responseText+"]");
this._attachmentsProcessed++;
this._handleUploadErrorResponse(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.viewId)
}}}}};
ZmZimbraMail.prototype.setPollInterval=function(e){
if(!this._pollInstantNotifications){
this._pollInterval=appCtxt.get(ZmSetting.POLLING_INTERVAL)*1000;
if(this._pollInterval){
if(e){
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(a){
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(a&&this._pollInstantNotifications){
var e=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL);
if(this._pollInterval>e){
this._pollInterval=e
}}
if(this._pollInterval&&!this._pollRequest){
try{
this._pollActionId=AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._execPoll),this._pollInterval)
}
catch(t){
this._pollActionId=null
}}};
ZmZimbraMail.prototype._execPoll=function(){
this._cancelInstantNotify();
var t=AjxSoapDoc.create("NoOpRequest","urn:zimbraMail");
try{
if(this._pollInstantNotifications){
var n=t.getMethod();
n.setAttribute("wait",1);
n.setAttribute("limitToOneBlocked",1);
if(window.isNotifyDebugOn){
var o=appCtxt.getNotifyDebug();
t.set("DEBUG",o);
appCtxt.clearNotifyDebug()
}}
var a={
soapDoc:t,asyncMode:true,callback:new AjxCallback(this,this._handleResponseDoPoll),errorCallback:new AjxCallback(this,this._handleErrorDoPoll),noBusyOverlay:true,timeout:appCtxt.get(ZmSetting.INSTANT_NOTIFY_TIMEOUT),accountName:appCtxt.isOffline&&appCtxt.accountList.mainAccount.name};
this._pollRequest=this.sendRequest(a);
if(appCtxt.isOffline&&!appCtxt.accountList.isInitialSyncing()&&appCtxt.accountList.isSyncStatus(ZmZimbraAccount.STATUS_RUNNING)){
this.sendNoOp()
}}
catch(e){
this._handleErrorDoPoll(e)
}};
ZmZimbraMail.prototype._handleErrorDoPoll=function(t){
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 e=(t.code==ZmCsfeException.SVC_AUTH_EXPIRED||t.code==ZmCsfeException.SVC_AUTH_REQUIRED||t.code==ZmCsfeException.NO_AUTH_TOKEN);
if(!e){
this._kickPolling(false)
}
return !e
};
ZmZimbraMail.prototype._handleResponseDoPoll=function(e){
this._pollRequest=null;
var t=e.getResponse().NoOpResponse;
if(t.waitDisallowed){
this._waitDisallowed=true;
this.setInstantNotify(false)
}else{
this._kickPolling(true)
}};
ZmZimbraMail.prototype.getKeyMapMgr=function(){
var e=appCtxt.getKeyboardMgr();
if(!e.__keyMapMgr){
this._initKeyboardHandling()
}
return e.__keyMapMgr
};
ZmZimbraMail.prototype._initKeyboardHandling=function(){
var e=appCtxt.getKeyboardMgr();
if(e.__keyMapMgr){
return
}
if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){
e.enable(true);
e.registerKeyMap(new ZmKeyMap());
e.pushDefaultHandler(this)
}else{
e.enable(false)
}};
ZmZimbraMail.prototype._setupTabGroups=function(){
var t=appCtxt.getRootTabGroup();
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
t.addMember(appCtxt.getSearchController().getTabGroup())
}
this._components[ZmAppViewMgr.C_APP_CHOOSER].noFocus=true;
var e=appCtxt.getCurrentApp();
var o=e&&e.getOverviewId();
var a=o&&appCtxt.getOverviewController().getOverview(o);
if(a){
t.addMember(a);
ZmController._currentOverview=a
}
appCtxt.getKeyboardMgr().setTabGroup(t)
};
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:"folders",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,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",treeType:ZmOrganizer.FOLDER,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}
);
this._name=ZmApp.MAIN;
ZmApp.prototype._setupDropTargets.call(this)
};
ZmZimbraMail.prototype.getApp=function(e){
if(!ZmApp.ENABLED_APPS[e]){
return null
}
if(!this._apps[e]){
this._createApp(e)
}
return this._apps[e]
};
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(s,t,l,o,a){
var n=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var r=this._appViewMgr.getAppView(s);
if(r&&!t){
if(this._appViewMgr.pushView(r)){
this._appViewMgr.setAppView(s,r);
if(!appCtxt.get(ZmApp.SETTING[s],null,n)&&appCtxt.get(ZmApp.UPSELL_SETTING[s])){
var h=[ZmMsg.zimbraTitle,s].join(": ");
Dwt.setTitle(h)
}}
if(l){
l.run()
}}else{
if(!this._apps[s]){
this._createApp(s)
}
if(!appCtxt.get(ZmApp.SETTING[s],null,n)&&appCtxt.get(ZmApp.UPSELL_SETTING[s])){
this._createUpsellView(s);
if(l){
l.run()
}}else{
var c=new AjxCallback(this,this._handleResponseActivateApp,[l,s]);
var e=[s,ZmAppEvent.PRE_LAUNCH].join("_");
this._evt.item=this._apps[s];
this._evtMgr.notifyListeners(e,this._evt);
a=a||{};
a.searchResponse=this._searchResponse;
this._apps[s].launch(a,c);
delete this.searchResponse
}}};
ZmZimbraMail.prototype._handleResponseActivateApp=function(a,e){
if(a){
a.run()
}
if(ZmApp.DEFAULT_SEARCH[e]){
appCtxt.getSearchController().setDefaultSearchType(ZmApp.DEFAULT_SEARCH[e])
}
var t=[e,ZmAppEvent.POST_LAUNCH].join("_");
this._evt.item=this._apps[e];
this._evtMgr.notifyListeners(t,this._evt)
};
ZmZimbraMail.prototype.setActiveApp=function(n,r,h){
if(!h){
this._components[ZmAppViewMgr.C_APP_CHOOSER].setSelected(n)
}
var o=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var t=!ZmApp.SETTING[n]||appCtxt.get(ZmApp.SETTING[n],null,o);
this._activeTabId=null;
if(this._activeApp!=n){
if(this._activeApp){
var e=this._apps[this._activeApp];
if(e){
e.activate(false,r)
}
this._previousApp=this._activeApp
}
this._activeApp=n;
if(t){
var e=this._apps[this._activeApp];
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
var s=e?e.getInitialSearchType():null;
if(!s){
s=ZmApp.DEFAULT_SEARCH[n]
}
if(s){
appCtxt.getSearchController().setDefaultSearchType(s)
}
var a=appCtxt.getSearchController().getSearchToolbar();
if(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)&&a){
var l=e.currentSearch?e.currentSearch.query:e.currentQuery;
a.setSearchFieldValue(l||"")
}}
if(e){
if(appCtxt.inStartup&&this._doingPostRenderStartup){
var c=new AjxCallback(this,function(){
e.activate(true)
}
);
this.addPostRenderCallback(c,1,100,true)
}else{
e.activate(true)
}}}
this._evt.item=this._apps[n];
this._evtMgr.notifyListeners(ZmAppEvent.ACTIVATE,this._evt)
}else{
if(this._activeApp&&this._apps[this._activeApp]){
this._apps[this._activeApp].stopAlert()
}}};
ZmZimbraMail.prototype.getAppChooserButton=function(e){
return this._components[ZmAppViewMgr.C_APP_CHOOSER].getButton(e)
};
ZmZimbraMail.prototype.appRendered=function(e){
var t=[e,ZmAppEvent.POST_RENDER].join("_");
this._evtMgr.notifyListeners(t,this._evt);
if(window._facadeCleanup){
window._facadeCleanup();
window._facadeCleanup=null
}};
ZmZimbraMail.prototype.addApp=function(t){
var e=t.getName();
this._apps[e]=t;
ZmApp.ENABLED_APPS[e]=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 e=document.getElementById("skin_container_links");
if(e){
var a;
if(!appCtxt.isOffline&&(appCtxt.get(ZmSetting.IS_ADMIN)||appCtxt.get(ZmSetting.IS_DELEGATED_ADMIN))){
a=appCtxt.get(ZmSetting.ADMIN_REFERENCE);
if(!a){
a=["https://",location.hostname,":7071"].join("")
}}
var t={
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:a};
e.innerHTML=AjxTemplate.expand("share.App#UserInfo",t)
}
e=document.getElementById("skin_container_help_button");
if(e){
this._helpButton=this.getHelpButton(DwtShell.getShell(window));
this._helpButton.reparentHtmlElement("skin_container_help_button")
}};
ZmZimbraMail.ONLINE_HELP_URL="http://help.zimbra.com/?";
ZmZimbraMail.NEW_FEATURES_URL="http://www.zimbra.com/docs/whats-new/?";
ZmZimbraMail.prototype.getHelpButton=function(o){
var a=new DwtLinkButton({
parent:o,className:DwtButton.LINK_BUTTON_CLASS}
);
a.dontStealFocus();
a.setSize(Dwt.DEFAULT);
a.setAlign(DwtLabel.ALIGN_LEFT);
a.setText(ZmMsg.help);
var n=new ZmPopupMenu(a);
var t=new AjxListener(this,this._helpListener);
a.addSelectionListener(t);
var e=n.createMenuItem("documentation",{
text:ZmMsg.productHelp}
);
e.addSelectionListener(t);
var e=n.createMenuItem("onlinehelp",{
text:ZmMsg.onlineHelp}
);
e.addSelectionListener(new AjxListener(this,this._onlineHelpListener));
e=n.createMenuItem("newFeatures",{
text:ZmMsg.newFeatures}
);
e.addSelectionListener(new AjxListener(this,this._newFeaturesListener));
n.createSeparator();
e=n.createMenuItem("about",{
text:ZmMsg.about}
);
e.addSelectionListener(new AjxListener(this,this._aboutListener));
a.setMenu(n);
return a
};
ZmZimbraMail.prototype._helpListener=function(e){
ZmZimbraMail.helpLinkCallback()
};
ZmZimbraMail.prototype._getVersion=function(){
return appCtxt.get(ZmSetting.CLIENT_VERSION)
};
ZmZimbraMail.prototype._getQueryParams=function(){
var t=appCtxt.getCurrentAppName().toLowerCase();
var e=appCtxt.isOffline?"zd":"zcs";
return["utm_source=",t,"&utm_medium=",e,"&utm_content=",this._getVersion(),"&utm_campaign=help"].join("")
};
ZmZimbraMail.prototype._onlineHelpListener=function(t){
ZmZimbraMail.unloadHackCallback();
var e=[ZmZimbraMail.ONLINE_HELP_URL,this._getQueryParams()].join("");
window.open(e)
};
ZmZimbraMail.prototype._newFeaturesListener=function(t){
ZmZimbraMail.unloadHackCallback();
var e=[ZmZimbraMail.NEW_FEATURES_URL,this._getQueryParams()].join("");
window.open(e)
};
ZmZimbraMail.prototype._aboutListener=function(n){
var a=appCtxt.getMsgDialog();
a.reset();
var t=this._getVersion();
var e=appCtxt.get(ZmSetting.CLIENT_RELEASE);
var o=appCtxt.isOffline?ZmMsg.aboutMessageZD:ZmMsg.aboutMessage;
a.setMessage(AjxMessageFormat.format(o,[t,e]),DwtMessageDialog.INFO_STYLE,ZmMsg.about);
a.popup()
};
ZmZimbraMail.prototype._initOfflineUserInfo=function(){
var e=this._userNameField.getHTMLElId();
this._userNameField.getHtmlElement().innerHTML=AjxTemplate.expand("share.App#NetworkStatus",{
id:e}
);
this._userNameField.addClassName("BannerTextUserOffline");
var o={
parent:this._userNameField,parentElement:(e+"_networkStatusIcon")};
this._networkStatusIcon=new DwtComposite(o);
var t={
parent:this._userNameField,parentElement:(e+"_networkStatusText")};
this._networkStatusText=new DwtComposite(t);
var a=document.getElementById("skin_container_tree_top");
if(a){
Dwt.setSize(a,Dwt.DEFAULT,"20")
}};
ZmZimbraMail.prototype._offlineUpdateChannelPref=function(a){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var e=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
if(e){
e.setCharPref("app.update.channel",a)
}}
catch(t){}};
ZmZimbraMail.prototype.setUserInfo=function(){
if(appCtxt.isOffline){
return
}
var e=appCtxt.getLoggedInUsername();
var t=(appCtxt.get(ZmSetting.DISPLAY_NAME))||e;
if(t){
this._userNameField.getHtmlElement().innerHTML=AjxStringUtil.htmlEncode(AjxStringUtil.clipByLength(t,24));
if(AjxEnv.isLinux){
this._userNameField.getHtmlElement().style.lineHeight="13px"
}}
this.setQuotaInfo(e,t)
};
ZmZimbraMail.prototype.setQuotaInfo=function(e,r){
var a=appCtxt.get(ZmSetting.QUOTA);
var s=(appCtxt.get(ZmSetting.QUOTA_USED))||0;
var n={
id:this._usedQuotaField._htmlElId,login:e,username:r,quota:a,usedQuota:s,size:(AjxUtil.formatSize(s,false,1))};
var o;
if(n.quota){
o="UsedLimited";
n.limit=AjxUtil.formatSize(n.quota,false,1);
n.percent=Math.min(Math.round((n.usedQuota/n.quota)*100),100);
n.desc=AjxMessageFormat.format(ZmMsg.quotaDescLimited,[n.percent+"%",n.limit])
}else{
n.desc=AjxMessageFormat.format(ZmMsg.quotaDescUnlimited,[n.size]);
o="UsedUnlimited"
}
this._usedQuotaField.getHtmlElement().innerHTML=AjxTemplate.expand("share.Quota#"+o,n);
var t=AjxTemplate.expand("share.Quota#Tooltip",n);
this._components[ZmAppViewMgr.C_USER_INFO].setToolTipContent(t);
this._components[ZmAppViewMgr.C_QUOTA_INFO].setToolTipContent(t)
};
ZmZimbraMail.setExitTimer=function(t){
if(t&&ZmZimbraMail.stayOnPagePrompt){
if(ZmZimbraMail._exitTimerId==-1){
ZmZimbraMail._exitTimerId=AjxTimedAction.scheduleAction(ZmZimbraMail._exitTimer,ZmZimbraMail.STAYONPAGE_INTERVAL*60*1000);
if(AjxEnv.isFirefox){
var a=AjxMessageFormat.format(ZmMsg.appExitPrompt,[ZmZimbraMail.STAYONPAGE_INTERVAL]);
var e=appCtxt.getMsgDialog();
e.setMessage(a,DwtMessageDialog.CRITICAL_STYLE);
setTimeout(function(){
e.popup()
}
,1000*2)
}}}else{
if(!t&&ZmZimbraMail._exitTimerId){
AjxTimedAction.cancelAction(ZmZimbraMail._exitTimerId);
ZmZimbraMail._exitTimerId=-1
}}};
ZmZimbraMail.logOff=function(o,a){
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 e={
path:appContextPath,qsArgs:{
loginOp:a?"relogin":"logout"}};
if(a){
e.qsArgs.username=appCtxt.getLoggedInUsername()
}
var t=AjxUtil.formatUrl(e);
ZmZimbraMail.sendRedirect(t);
if(AjxEnv.isFirefox){
ZmZimbraMail.setExitTimer(true)
}};
ZmZimbraMail.exitSession=function(){
ZmZimbraMail.logOff()
};
ZmZimbraMail.executeSessionTimer=function(){
ZmZimbraMail.sessionTimerInvoked=true;
ZmZimbraMail.logOff()
};
ZmZimbraMail._onClickLogOff=function(){
if(AjxEnv.isIE){
var e=DwtUiEvent.getEvent();
e.returnValue=false
}
ZmZimbraMail.logOff()
};
ZmZimbraMail.helpLinkCallback=function(){
ZmZimbraMail.unloadHackCallback();
var o=window.parentAppCtxt||window.appCtxt;
var a;
if(!o.isOffline){
try{
a=skin.hints.helpButton.url
}
catch(n){}
a=a||o.get(ZmSetting.HELP_URI);
var t=a.match(/?/)?"&":"?";
a=[a,t,"locid=",AjxEnv.DEFAULT_LOCALE].join("")
}else{
a=o.get(ZmSetting.HELP_URI).replace(//$/,"");
a=[a,"help","en_US","Zimbra_Mail_Help.htm"].join("/")
}
window.open(a)
};
ZmZimbraMail.sendRedirect=function(t){
if(AjxEnv.isIE){
var e=new AjxTimedAction(null,ZmZimbraMail.redir,[t]);
AjxTimedAction.scheduleAction(e,1)
}else{
ZmZimbraMail.redir(t)
}};
ZmZimbraMail.redir=function(a){
try{
window.location=a
}
catch(t){}};
ZmZimbraMail.prototype.setSessionTimer=function(t){
var e=appCtxt.get(ZmSetting.IDLE_SESSION_TIMEOUT)*1000;
if(e<=0){
return
}
if(t){
this._sessionTimerId=AjxTimedAction.scheduleAction(this._sessionTimer,e);
DwtEventManager.addListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr);
this._shell.setHandler(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr);
if(AjxEnv.isIE){
this._shell.setHandler(DwtEvent.ONMOUSEDOWN,ZmZimbraMail._userEventHdlr)
}else{
window.onkeydown=ZmZimbraMail._userEventHdlr
}}else{
AjxTimedAction.cancelAction(this._sessionTimerId);
this._sessionTimerId=-1;
DwtEventManager.removeListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr);
this._shell.clearHandler(DwtEvent.ONMOUSEUP);
if(AjxEnv.isIE){
this._shell.clearHandler(DwtEvent.ONMOUSEDOWN)
}else{
window.onkeydown=null
}}};
ZmZimbraMail.prototype.addChildWindow=function(t){
if(this._childWinList==null){
this._childWinList=new AjxVector()
}
var e={
win:t};
this._childWinList.add(e);
return e
};
ZmZimbraMail.prototype.getChildWindow=function(t){
if(this._childWinList){
for(var e=0;
e<this._childWinList.size();
e++){
if(t==this._childWinList.get(e).win){
return this._childWinList.get(e)
}}}
return null
};
ZmZimbraMail.prototype.removeChildWindow=function(t){
if(this._childWinList){
for(var e=0;
e<this._childWinList.size();
e++){
if(t==this._childWinList.get(e).win){
this._childWinList.removeAt(e);
break
}}}};
ZmZimbraMail.prototype._handleException=function(r,t){
var o=false;
if(r.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER){
var e=[ZmOrganizer.CALENDAR,ZmOrganizer.NOTEBOOK,ZmOrganizer.ADDRBOOK];
if(r.data.itemId&&r.data.itemId.length){
var l=r.data.itemId[0];
var n=l.lastIndexOf(":");
var s=l.substring(0,n);
var c=l.substring(n+1,l.length);
var a=appCtxt.getFolderTree();
for(var h=0;
h<e.length;
h++){
o|=a.handleNoSuchFolderError(e[h],s,c,true)
}}}
if(!o){
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 e=(appCtxt.isOffline)?ZmMsg.appExitWarningZD:ZmMsg.appExitWarning;
if(ZmZimbraMail.sessionTimerInvoked){
ZmZimbraMail.stayOnPagePrompt=true;
e=AjxMessageFormat.format(e+ZmMsg.appExitTimeWarning,[ZmZimbraMail.STAYONPAGE_INTERVAL])
}
if(!AjxEnv.isFirefox){
ZmZimbraMail.setExitTimer(true)
}
return e
}
ZmZimbraMail._endSession()
}
ZmZimbraMail._endSessionDone=true
};
ZmZimbraMail._isOkToExit=function(){
var t=window._zimbraMail;
if(!t){
return true
}
var e=t._appViewMgr.isOkToUnload()&&ZmZimbraMail._childWindowsOkToUnload();
if(e&&!AjxEnv.isPrism&&t._pollRequest){
t._requestMgr.cancelRequest(t._pollRequest)
}
return e
};
ZmZimbraMail._childWindowsOkToUnload=function(){
var t=window._zimbraMail?window._zimbraMail._childWinList:null;
if(t){
for(var e=0;
e<t.size();
e++){
var a=t.get(e);
if(a.win.ZmNewWindow._confirmExitMethod()){
return false
}}}
return true
};
ZmZimbraMail.handleNetworkStatusClick=function(){
var e=window.appCtxt.getAppController();
if(!e._isPrismOnline){
return
}
e._isUserOnline=!e._isUserOnline;
e._updateNetworkStatus(e._isUserOnline)
};
ZmZimbraMail.unloadHackCallback=function(){
window.onbeforeunload=null;
var e=function(){
window.onbeforeunload=ZmZimbraMail._confirmExitMethod
};
AjxTimedAction.scheduleAction((new AjxTimedAction(null,e)),3000)
};
ZmZimbraMail._userEventHdlr=function(t){
var e=window._zimbraMail;
if(e){
AjxTimedAction.cancelAction(e._sessionTimerId);
var a=appCtxt.get(ZmSetting.IDLE_SESSION_TIMEOUT)*1000;
if(a<=0){
return
}
e._sessionTimerId=AjxTimedAction.scheduleAction(e._sessionTimer,a)
}};
ZmZimbraMail.prototype._createBanner=function(){
var e=new DwtComposite({
parent:this._shell,posStyle:Dwt.ABSOLUTE_STYLE,id:ZmId.BANNER}
);
var a=appCtxt.getSkinHint("banner","url")||appCtxt.get(ZmSetting.LOGO_URI);
var t={
url:a,isOffline:appCtxt.isOffline};
e.getHtmlElement().innerHTML=AjxTemplate.expand("share.App#Banner",t);
return e
};
ZmZimbraMail.prototype._createUserInfo=function(a,s,n){
var e=appCtxt.getSkinHint(s,"position");
var t=e||Dwt.ABSOLUTE_STYLE;
var o=new DwtComposite({
parent:this._shell,className:a,posStyle:t,id:n}
);
o._setMouseEventHdlrs();
return o
};
ZmZimbraMail.prototype._createAppChooser=function(){
var a=[];
for(var r in ZmApp.CHOOSER_SORT){
if(r==ZmAppChooser.SPACER||r==ZmAppChooser.B_HELP||r==ZmAppChooser.B_LOGOUT){
continue
}
var s=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var t=ZmApp.SETTING[r];
var n=ZmApp.UPSELL_SETTING[r];
if((t&&appCtxt.get(t,null,s))||(n&&appCtxt.get(n))){
a.push(r)
}}
a.sort(function(l,h){
return ZmZimbraMail.hashSortCompare(ZmApp.CHOOSER_SORT,l,h)
}
);
var o=new ZmAppChooser({
parent:this._shell,buttons:a,id:ZmId.APP_CHOOSER,refElementId:ZmId.SKIN_APP_CHOOSER}
);
var e=new AjxListener(this,this._appButtonListener);
o.addSelectionListener(e);
return o
};
ZmZimbraMail.prototype._appButtonListener=function(t){
try{
var a=t.item.getData(Dwt.KEY_ID);
if(a==ZmAppChooser.B_HELP){
window.open(appCtxt.get(ZmSetting.HELP_URI))
}else{
if(a==ZmAppChooser.B_LOGOUT){
DBG.println(AjxDebug.DBG1,"ZmZimbraMail : invoking logout.");
ZmZimbraMail.logOff()
}else{
if(a&&ZmApp.ENABLED_APPS[a]&&(a!=this._activeTabId)){
this.activateApp(a);
if(appCtxt.zimletsPresent()){
appCtxt.getZimletMgr().notifyZimlets("onSelectApp",a)
}}else{
if(a!=this._activeTabId){
this._appViewMgr.pushView(a)
}
if(t.target&&(t.target.className=="ImgClose")){
this._appViewMgr.popView()
}}}}}
catch(e){
this._handleException(e)
}};
ZmZimbraMail.prototype.getAppChooser=function(){
return this._appChooser
};
ZmZimbraMail.prototype.setActiveTabId=function(e){
this._activeTabId=e;
this._appChooser.setSelected(e)
};
ZmZimbraMail.prototype.setStatusMsg=function(e){
e=Dwt.getParams(arguments,ZmStatusView.MSG_PARAMS);
this.statusView.setStatusMsg(e)
};
ZmZimbraMail.prototype.dismissStatusMsg=function(e){
this.statusView.dismissStatusMsg(e)
};
ZmZimbraMail.prototype.getKeyMapName=function(){
var e=appCtxt.getCurrentController();
if(e&&e.getKeyMapName){
return e.getKeyMapName()
}
return"Global"
};
ZmZimbraMail.prototype.handleKeyAction=function(n,T){
DwtMenu.closeActiveMenu();
var c=ZmApp.GOTO_ACTION_CODE_R[n];
if(c){
if(c==this.getActiveApp()){
return false
}
this.activateApp(c);
return true
}
if(T&&(T.keyCode==13||T.keyCode==3)&&!(T.altKey||T.ctrlKey||T.metaKey||T.shiftKey)&&T.target&&(T.target.id!=DwtKeyboardMgr.FOCUS_FIELD_ID)){
return false
}
switch(n){
case ZmKeyMap.DBG_NONE:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.NONE);
break;
case ZmKeyMap.DBG_1:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.DBG1);
break;
case ZmKeyMap.DBG_2:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.DBG2);
break;
case ZmKeyMap.DBG_3:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.DBG3);
break;
case ZmKeyMap.DBG_TIMING:var m=DBG._showTiming;
var t=m?"off":"on";
appCtxt.setStatusMsg("Turning Timing Info "+t);
break;
case ZmKeyMap.ASSISTANT:if(appCtxt.get(ZmSetting.ASSISTANT_ENABLED)){
if(!this._assistantDialog){
AjxDispatcher.require("Assistant");
this._assistantDialog=new ZmAssistantDialog()
}
this._assistantDialog.popup()
}
break;
case ZmKeyMap.QUICK_REMINDER:var o=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,o)){
var r=appCtxt.getCalManager();
r.showQuickReminder()
}
break;
case ZmKeyMap.LOGOFF:ZmZimbraMail.logOff();
break;
case ZmKeyMap.FOCUS_SEARCH_BOX:var e=appCtxt.getSearchController().getSearchToolbar();
if(e){
var h=e.getSearchField();
appCtxt.getKeyboardMgr().grabFocus(h);
if(ZmSearchAutocomplete){
ZmSearchAutocomplete._ignoreNextKey=true
}}
break;
case ZmKeyMap.FOCUS_CONTENT_PANE:this.focusContentPane();
break;
case ZmKeyMap.FOCUS_TOOLBAR:this.focusToolbar();
break;
case ZmKeyMap.UNDO:if(!appCtxt.isChildWindow){
var d=appCtxt.getActionController();
if(d){
d.undoCurrent()
}}
break;
case ZmKeyMap.SHORTCUTS:var g=appCtxt.getShortcutsPanel();
var p=this.getKeyMapName();
var a=appCtxt.getAppController().getKeyMapMgr();
var b=a.getAncestors(p);
var f=(b&&b.length>0);
b.unshift(p);
var x=[],v=[];
if(f){
if(b.length>1&&b[b.length-1]=="Global"){
b.pop();
v.push("global")
}}
for(var k=0;
k<b.length;
k++){
x.push(ZmKeyMap.MAP_NAME_R[b[k]]||DwtKeyMap.MAP_NAME_R[b[k]])
}
var z={}
,j={};
z.type=ZmShortcutList.TYPE_APP;
z.maps=x;
var u=[z];
if(v.length){
j.type=ZmShortcutList.TYPE_APP;
j.maps=v;
u.push(j)
}
var q={};
q.type=ZmShortcutList.TYPE_SYS;
q.maps=[];
var s=appCtxt.getCurrentController();
var O=["list","editor","tabView"];
for(var k=0;
k<O.length;
k++){
if(s&&s.mapSupported(O[k])){
q.maps.push(O[k])
}}
q.maps.push("button","menu","tree","dialog","toolbarHorizontal");
u.push(q);
g.popup(u);
break;
case ZmKeyMap.CANCEL:var l=false;
var w=(DwtMouseEventCapture.getId()=="DwtControl")?DwtMouseEventCapture.getCaptureObj():null;
var y=w&&w.targetObj;
if(y&&(y._dragging==DwtControl._DRAGGING)){
w.release();
y.__lastDestDwtObj=null;
y._setDragProxyState(false);
DwtControl.__badDrop(y,DwtShell.mouseEvent);
l=true
}
if(l){
break
}
default:var s=appCtxt.getCurrentController();
return(s&&s.handleKeyAction)?s.handleKeyAction(n,T):false
}
return true
};
ZmZimbraMail.prototype.focusContentPane=function(){
var e=appCtxt.getCurrentController();
var t=e?e.getCurrentView():null;
if(t){
appCtxt.getKeyboardMgr().grabFocus(t)
}};
ZmZimbraMail.prototype.focusToolbar=function(){
var e=appCtxt.getCurrentController();
var t=e?e.getCurrentToolbar():null;
if(t){
appCtxt.getKeyboardMgr().grabFocus(t)
}};
ZmZimbraMail.prototype._createUpsellView=function(s){
var r=[s,"upsell"].join("_");
if(!this._upsellView[s]){
var a=this._upsellView[s]=new ZmUpsellView({
parent:this._shell,posStyle:Dwt.ABSOLUTE_STYLE,className:"ZmUpsellView"}
);
var o=appCtxt.get(ZmApp.UPSELL_URL[s]);
var t=a.getHtmlElement();
var l=[];
var h=0;
l[h++]="<iframe id='iframe_"+a.getHTMLElId()+"' width='100%' height='100%' frameborder='0' src='";
l[h++]=o;
l[h++]="'>";
t.innerHTML=l.join("");
var e={};
e[ZmAppViewMgr.C_APP_CONTENT_FULL]=a;
var n={};
n[ZmAppViewMgr.CB_POST_SHOW]=new AjxCallback(this,this._displayUpsellView);
this._appViewMgr.createView({
viewId:r,appName:s,elements:e,isTransient:true,callbacks:n}
)
}
this._appViewMgr.pushView(r)
};
ZmZimbraMail.prototype._displayUpsellView=function(e){
var t=[ZmMsg.zimbraTitle,e].join(": ");
Dwt.setTitle(t);
appCtxt.getApp(this._getDefaultStartAppName()).setOverviewPanelContent(false)
};
ZmZimbraMail.prototype._postLoadZimlet=function(){
appCtxt.setZimletsPresent(true)
};
ZmZimbraMail.prototype._globalSelectionListener=function(n){
if(this._waitDisallowed){
this._waitDisallowed=false;
this.setInstantNotify(true)
}
if(!appCtxt.areZimletsLoaded()){
return
}
var o=n.item;
var h=(o&&o.getText)?(o.getText()||o._toggleText):null;
if(o&&!h){
h=o.getData(ZmOperation.KEY_ID)||o.getData(Dwt.KEY_ID)
}
if(h){
var a;
if(o instanceof ZmAppButton){
a="app"
}else{
if(o instanceof DwtMenuItem){
a="menuitem"
}else{
if(o instanceof DwtButton){
a="button"
}else{
if(o instanceof DwtTreeItem){
if(!o.getSelected()){
return
}
a="treeitem"
}else{
a=o.toString()
}}}}
var t=appCtxt.getAppViewMgr();
var e=t.getCurrentViewId();
var r=t.getLastViewId();
var s=(AjxStringUtil.split((""+h)," ")).join("");
appCtxt.notifyZimlets("onAction",[a,s,e,r])
}};
ZmZimbraMail._endSession=function(){
if(!AjxEnv.isPrism){
var e=new AjxCallback(null,function(){
return true
}
);
var t={
jsonObj:{
EndSessionRequest:{
_jsns:"urn:zimbraAccount"}}
,asyncMode:true,errorCallback:e};
appCtxt.getAppController().sendRequest(t)
}};
ZmOrganizer.ZIMLET="ZIMLET"
}
if(AjxPackage.define("zimbraMail.calendar.model.ZmCalBaseItem")){
ZmCalBaseItem=function(t,a,o,e){
if(arguments.length==0){
return
}
ZmItem.call(this,t,o,a);
this.id=o||-1;
this.uid=-1;
this.folderId=e||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.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(t,e){
if(t.getStartTime()>e.getStartTime()){
return 1
}
if(t.getStartTime()<e.getStartTime()){
return -1
}
if(t.getDuration()<e.getDuration()){
return 1
}
if(t.getDuration()>e.getDuration()){
return -1
}
return 0
};
ZmCalBaseItem.createFromDom=function(t,a,e){
var o=new ZmCalBaseItem(ZmItem.APPT,a.list);
o._loadFromDom(t,(e||{}
));
return o
};
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.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(e){
if(e){
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 t=this.startDate;
var e=this.endDate;
if(!t&&!e){
return false
}
if(!t){
return false
}
if(e.getHours()==0&&e.getMinutes()==0&&e.getSeconds()==0){
e=new Date(e.getTime()-2*AjxDateUtil.MSEC_PER_HOUR)
}
return(t.getDate()!=e.getDate())||(t.getMonth()!=e.getMonth())||(t.getFullYear()!=e.getFullYear())
};
ZmCalBaseItem.prototype.getDurationText=function(a,e){
var o=this.isAllDayEvent();
var s=this.isMultiDay();
if(o){
if(a){
return""
}
var r=this.startDate;
var t=new Date(this.endDate.getTime()-(s?2*AjxDateUtil.MSEC_PER_HOUR:0));
var n=s?ZmMsg.apptTimeAllDayMulti:ZmMsg.apptTimeAllDay;
return AjxMessageFormat.format(n,[r,t])
}
if(e){
return ZmCalBaseItem._getTTHour(this.startDate)
}
var n=s?ZmMsg.apptTimeInstanceMulti:ZmMsg.apptTimeInstance;
return AjxMessageFormat.format(n,[this.getDateInLocalTimezone(this.startDate),this.getDateInLocalTimezone(this.endDate),""])
};
ZmCalBaseItem.prototype.isAlarmInRange=function(){
if(!this.alarmData){
return false
}
var t=this.alarmData[0];
if(!t){
return false
}
this._nextAlarmTime=this.adjustMS(t.nextAlarm,this.tzo);
this._alarmInstStart=this.adjustMS(t.alarmInstStart,this.tzo);
var e=(new Date()).getTime();
return(e>=this._nextAlarmTime)
};
ZmCalBaseItem.prototype.adjustMS=function(e,a){
var t=this.isAllDayEvent()?(a+new Date(e).getTimezoneOffset()*60*1000):0;
return parseInt(e,10)+t
};
ZmCalBaseItem.prototype.isAlarmInstance=function(){
if(!this.alarmData){
return false
}
var e=this.alarmData[0];
this._alarmInstStart=this.adjustMS(e.alarmInstStart,this.tzo);
return(this._alarmInstStart==this.startDate.getTime())
};
ZmCalBaseItem.prototype.hasAlarmData=function(){
return(this.alarmData!=null)
};
ZmCalBaseItem.prototype._loadFromDom=function(a,e){
this.uid=a.uid;
this.folderId=a.l||this._getDefaultFolderId();
this.invId=a.invId;
this.isException=e.ex;
this.id=a.id;
this.name=this._getAttr(a,e,"name");
this.fragment=this._getAttr(a,e,"fr");
this.status=this._getAttr(a,e,"status");
this.ptst=this._getAttr(a,e,"ptst");
this.allDayEvent=(e.allDay||a.allDay)?"1":"0";
this.organizer=a.or&&a.or.a;
this.isOrg=this._getAttr(a,e,"isOrg");
this.transparency=this._getAttr(a,e,"transp");
if(e.allDay==false){
this.allDayEvent="0"
}
this.alarm=this._getAttr(a,e,"alarm");
this.alarmData=this._getAttr(a,e,"alarmData");
this.priority=parseInt(this._getAttr(a,e,"priority"));
this.recurring=e.recur!=null?e.recur:a.recur;
this.fba=this._getAttr(a,e,"fba");
var r=e.s!=null?e.s:a.inst&&a.inst.length>0&&a.inst[0].s;
if(r){
var h=this.tzo=e.tzo!=null?e.tzo:a.tzo;
var s=this.isAllDayEvent()?(h+new Date(e.s).getTimezoneOffset()*60*1000):0;
var n=parseInt(r,10)+s;
this.startDate=new Date(n);
this.uniqStartTime=this.startDate.getTime()
}
var o=this._getAttr(a,e,"dur");
if(o){
var t=n+(parseInt(o));
this.endDate=new Date(t)
}
this.otherAttendees=this._getAttr(a,e,"otherAtt");
this.location=this._getAttr(a,e,"loc")
};
ZmCalBaseItem.prototype._getDefaultFolderId=function(){
return ZmOrganizer.ID_CALENDAR
};
ZmCalBaseItem.prototype._getAttr=function(e,a,t){
return a[t]!=null?a[t]:a.ex?null:e[t]
};
ZmCalBaseItem.prototype._addLocationToSoap=function(e){
e.setAttribute("loc",this.getLocation())
};
ZmCalBaseItem._getTTHour=function(t){
var e=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
return e.format(t)
};
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 a=this.alarmData[0];
this._nextAlarmTime=a.nextAlarm;
this._alarmInstStart=a.alarmInstStart;
var e=(new Date()).getTime();
var t=(e-this._nextAlarmTime);
if(t>2*60*1000){
return true
}
return false
};
ZmCalBaseItem.prototype.getRestUrl=function(){
if(this.restUrl){
return this.restUrl
}
var e=appCtxt.getById(this.folderId);
var t=e?([e.getRestUrl(),"/?id=",AjxStringUtil.urlComponentEncode(this.id||this.invId)].join("")):null;
return t
};
ZmCalBaseItem.prototype.getDateInLocalTimezone=function(t){
var n=this.getTimezone();
var e=AjxTimezone.getServerId(AjxTimezone.DEFAULT);
if(n!=e){
var o=AjxTimezone.getOffset(AjxTimezone.DEFAULT,t);
var a=AjxTimezone.getOffset(AjxTimezone.getClientId(n),t);
return new Date(t.getTime()+(o-a)*60*1000)
}
return t
}
}
if(AjxPackage.define("zimbraMail.prefs.ZmPreferencesApp")){
ZmPreferencesApp=function(t,e){
ZmApp.call(this,ZmApp.PREFERENCES,t,e);
this._filterRules={};
this._outgoingFilterRules={}
};
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.prototype=new ZmApp;
ZmPreferencesApp.prototype.constructor=ZmPreferencesApp;
ZmPreferencesApp.prototype.toString=function(){
return"ZmPreferencesApp"
};
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(t,a){
if(appCtxt.multiAccounts){
appCtxt.accountList.setActiveAccount(appCtxt.accountList.mainAccount)
}
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require(["PreferencesCore","Preferences"],true,e,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(e){
var t=window.parentAppCtxt||window.appCtxt;
var a=e||t.getActiveAccount().name;
if(!this._filterRules[a]){
this._filterRules[a]=new ZmFilterRules(a)
}
return this._filterRules[a]
};
ZmPreferencesApp.prototype.getOutgoingFilterRules=function(e){
var t=window.parentAppCtxt||window.appCtxt;
var a=e||t.getActiveAccount().name;
if(!this._outgoingFilterRules[a]){
this._outgoingFilterRules[a]=new ZmFilterRules(a,true)
}
return this._outgoingFilterRules[a]
};
ZmPreferencesApp.prototype.modifyNotify=function(a,e){
var t=this._getSharingView();
if(t){
t.notifyModify(a)
}};
ZmPreferencesApp.prototype.refresh=function(t,o){
var e=this.getPreferencesPage("TRUSTED_ADDR");
if(e&&o){
e.addItem(o)
}
if(!appCtxt.inStartup){
var a=this._getSharingView();
if(a){
a.refresh(t)
}}};
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)
};
ZmPreferencesApp.prototype._registerSettings=function(e){
e=e||appCtxt.getSettings();
e.registerSetting("IMPORT_FOLDER",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("IMPORT_BUTTON",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("EXPORT_FOLDER",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("EXPORT_BUTTON",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("PREF_SECTIONS",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_HASH,isGlobal:true}
);
e.registerSetting("SIGNATURE_MAX_LENGTH",{
name:"zimbraMailSignatureMaxLength",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:1024}
);
e.registerSetting("DISCARD_IN_FILTER_ENABLED",{
name:"zimbraFeatureDiscardInFiltersEnabled",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 y={
GENERAL:{
title:ZmMsg.general,templateId:"prefs.Pages#General",priority:0,prefs:[ZmSetting.LOCALE_NAME,ZmSetting.PASSWORD,ZmSetting.SEARCH_INCLUDES_SPAM,ZmSetting.SEARCH_INCLUDES_TRASH,ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES,ZmSetting.SHOW_SEARCH_STRING,ZmSetting.PAGE_SIZE,ZmSetting.SHOW_SELECTION_CHECKBOX,ZmSetting.SKIN_NAME,ZmSetting.CLIENT_TYPE,ZmSetting.DEFAULT_TIMEZONE,ZmSetting.DEFAULT_PRINTFONTSIZE,ZmSetting.OFFLINE_IS_MAILTO_HANDLER,ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED,ZmSetting.SHORT_ADDRESS,ZmSetting.USE_ADDR_BUBBLES,ZmSetting.OFFLINE_UPDATE_NOTIFY]}
,COMPOSING:{
parentId:"MAIL",title:ZmMsg.composing,icon:"Compose",templateId:"prefs.Pages#Composing",priority:20,precondition:[ZmSetting.MAIL_ENABLED],prefs:[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.COMPOSE_SAME_FORMAT,ZmSetting.MAIL_MANDATORY_SPELLCHECK]}
,SHARING:{
title:ZmMsg.sharing,icon:"SharedContact",templateId:"prefs.Pages#SharingPrefPage",priority:85,precondition:ZmSetting.SHARING_ENABLED,manageChanges:true,createView:function(x,q,p){
AjxDispatcher.require("Share");
return new ZmSharingPage(x,q,p)
}}
,NOTIFICATIONS:{
title:ZmMsg.notifications,icon:"ApptReminder",templateId:"prefs.Pages#Notifications",priority:88,precondition:[ZmSetting.CALENDAR_ENABLED,ZmSetting.TASKS_ENABLED],prefs:[ZmSetting.CAL_EMAIL_REMINDERS_ADDRESS,ZmSetting.CAL_DEVICE_EMAIL_REMINDERS_ADDRESS],createView:function(x,q,p){
return new ZmNotificationsPage(x,q,p)
}}
,MOBILE:{
title:ZmMsg.mobileDevices,icon:"Mobile",templateId:"prefs.Pages#MobileDevices",priority:90,precondition:ZmSetting.MOBILE_SYNC_ENABLED,manageChanges:true,createView:function(x,q,p){
return new ZmMobileDevicesPage(x,q,p)
}}
,IMPORT_EXPORT:{
title:ZmMsg.importExport,icon:"SendReceive",templateId:"data.ImportExport#ImportExportPrefPage",priority:100,precondition:[ZmSetting.IMPORT_ENABLED,ZmSetting.EXPORT_ENABLED],prefs:[ZmSetting.IMPORT_FOLDER,ZmSetting.IMPORT_BUTTON,ZmSetting.EXPORT_FOLDER,ZmSetting.EXPORT_BUTTON],manageChanges:true,createView:function(x,q,p){
AjxDispatcher.require("ImportExport");
return new ZmImportExportPage(x,q,p)
}}
,SHORTCUTS:{
title:ZmMsg.shortcuts,icon:"Shortcut",templateId:"prefs.Pages#Shortcuts",priority:120,precondition:ZmSetting.USE_KEYBOARD_SHORTCUTS,createView:function(x,q,p){
return new ZmShortcutsPage(x,q,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(x,q,p){
return new ZmZimletsPage(x,q,p)
}}};
if(appCtxt.isOffline){
y.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(x,q,p){
return new ZmBackupPage(x,q,p)
}}
}
for(var b in y){
ZmPref.registerPrefSection(b,y)
}
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,ZmSetting.NOTEBOOK_ENABLED]}
);
var r=[],m=[];
for(var k in DwtHtmlEditor.FONT_FAMILY){
var d=DwtHtmlEditor.FONT_FAMILY[k];
r.push(d.value);
m.push(d.name)
}
ZmPref.registerPref("COMPOSE_INIT_FONT_FAMILY",{
displayName:ZmMsg.defaultFontSettings,displayContainer:ZmPref.TYPE_SELECT,displayOptions:m,options:r,precondition:[ZmSetting.HTML_COMPOSE_ENABLED,ZmSetting.NOTEBOOK_ENABLED],approximateFunction:function(p){
if(AjxUtil.indexOf(r,p)!=-1){
return p
}
return DwtHtmlEditor._normalizeFontId(p)
}}
);
var a=[AjxMessageFormat.format(ZmMsg.pt,"8"),AjxMessageFormat.format(ZmMsg.pt,"10"),AjxMessageFormat.format(ZmMsg.pt,"12"),AjxMessageFormat.format(ZmMsg.pt,"14"),AjxMessageFormat.format(ZmMsg.pt,"18"),AjxMessageFormat.format(ZmMsg.pt,"24"),AjxMessageFormat.format(ZmMsg.pt,"36")];
var n=["8pt","10pt","12pt","14pt","18pt","24pt","36pt"];
var w=function(){
var q=appCtxt.accountList.visibleAccounts;
var x=[];
x.push(ZmMsg.zimletPrefDontSync);
for(var p=0;
p<q.length;
p++){
if(q[p].isZimbraAccount&&!q[p].isMain){
x.push([ZmMsg.zimletPrefSyncWith," ",q[p].name].join(""))
}}
return x
};
var h=function(){
var q=appCtxt.accountList.visibleAccounts;
var x=[];
x.push("");
for(var p=0;
p<q.length;
p++){
if(q[p].isZimbraAccount&&!q[p].isMain){
x.push(q[p].id)
}}
return x
};
ZmPref.registerPref("COMPOSE_INIT_FONT_SIZE",{
displayName:null,displayContainer:ZmPref.TYPE_SELECT,displayOptions:a,options:n,precondition:[ZmSetting.HTML_COMPOSE_ENABLED,ZmSetting.NOTEBOOK_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:w(),options:h()}
);
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:a,options:n}
);
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}
);
var t=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,t,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:AjxCallback.simpleClosure(ZmPref.requireAllPreConditions,null,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}
);
ZmPref.registerPref("USE_ADDR_BUBBLES",{
displayName:ZmMsg.useAddressBubbles,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 l=525600;
var c=10;
var o=[l];
var u=[ZmMsg.pollManually];
var v=appCtxt.get(ZmSetting.INSTANT_NOTIFY)?true:false;
if(v){
o.push(appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL));
u.push(ZmMsg.pollInstant)
}
var f=ZmPref.pollingIntervalDisplay(appCtxt.get(ZmSetting.MIN_POLLING_INTERVAL));
f=(f<1)?1:Math.round(f);
var e=ZmPref.pollingIntervalDisplay(appCtxt.get(ZmSetting.POLLING_INTERVAL));
e=Math.round(e);
while(f<=c){
o.push(f);
f++
}
f=f-1;
var s=o.length;
while(s<c){
f=f+5;
o.push(f);
s++
}
if(e>f&&e!=l&&(v&&e!=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL))){
var g=e%5;
g=(g==0)?e:((e/5+1)*5);
o.push(g)
}else{
f=f+5;
o.push(f)
}
while(u.length<=s){
u.push(ZmMsg.pollEveryNMinutes)
}
ZmPref.registerPref("POLLING_INTERVAL",{
displayName:ZmMsg.pollingInterval,displayContainer:ZmPref.TYPE_SELECT,displayOptions:u,options:o,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("SEARCH_INCLUDES_SPAM",{
displayName:ZmMsg.includeJunkFolder,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:AjxCallback.simpleClosure(ZmPref.requireAllPreConditions,null,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]}
);
ZmPref.registerPref("SHOW_FRAGMENTS",{
displayName:ZmMsg.showFragments,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(t){
var e=new AjxCallback(this,this._handleResponseLaunch,[t]);
appCtxt.getSettings().loadPreferenceData(e)
};
ZmPreferencesApp.prototype._handleResponseLaunch=function(e){
AjxDispatcher.run("GetPrefController").show();
if(e){
e.run()
}};
ZmPreferencesApp.prototype._getSharingView=function(){
var e=this.getPreferencesPage("SHARING");
return(e&&e.view)
};
ZmPreferencesApp.prototype.getPreferencesPage=function(a){
if(!this._prefController){
return null
}
var t=this.getPrefController();
var e=t&&t.getPrefsView();
return e&&e.getView(a)
};
ZmPreferencesApp.prototype._getOverviewParams=function(){
var e=ZmApp.prototype._getOverviewParams.call(this);
e.omit={};
e.omit[ZmOrganizer.ID_ZIMLET]=true;
return e
};
ZmPreferencesApp.getFilterRulesController=function(e){
var a=AjxDispatcher.run("GetPrefController");
if(a&&a.getPrefsView()){
var t=a.getFilterController();
return e?t.getOutgoingFilterRulesController():t.getIncomingFilterRulesController()
}
return null
}
}
if(AjxPackage.define("zimbraMail.portal.ZmPortalApp")){
ZmPortalApp=function(t,e){
ZmApp.call(this,ZmApp.PORTAL,t,e)
};
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 t=this.getPortletMgr();
var e=t.getPortlets();
for(var a in e){
e[a].refresh()
}};
ZmPortalApp.prototype.launch=function(t,a){
var e=new AjxCallback(this,this._handleLoadLaunch,[t,a]);
AjxDispatcher.require("Portal",true,e,null,true)
};
ZmPortalApp.prototype._handleLoadLaunch=function(t,a){
var e=this.getPortalController();
e.show();
ZmApp.prototype.launch.call(this,t,a)
};
ZmPortalApp.prototype.activate=function(t){
var e=this.getPortalController();
e.setPaused(!t);
ZmApp.prototype.activate.call(this,t)
};
ZmPortalApp.prototype.getManifest=function(n){
if(!this._manifest){
var a=appCtxt.get(ZmSetting.PORTAL_NAME);
if(a){
var t=new Date().getTime();
var o={
url:[window.appContextPath,"/portals/",a,"/manifest.xml?v=",t].join(""),callback:n?new AjxCallback(this,this._handleLoadManifest,[n]):null};
var e=AjxLoader.load(o);
if(!n){
this._handleLoadManifest(n,e)
}}}else{
if(n){
n.run(this._manifest)
}}
return this._manifest
};
ZmPortalApp.prototype._handleLoadManifest=function(callback,req){
var e;
if(req.status==200&&req.responseXML){
try{
var json=new AjxJsonSerializer(true).serialize(req.responseXML);
eval("this._manifest = "+json);
var portalDef=this._manifest.portal;
var portletsDef=portalDef&&portalDef.portlets;
if(portletsDef&&!(portletsDef.portlet instanceof Array)){
portletsDef.portlet=[portletsDef.portlet]
}
portalDef.portlets=portletsDef.portlet;
if(portalDef.portlets){
for(var i=0;
i<portalDef.portlets.length;
i++){
var portletDef=portalDef.portlets[i];
var propertyDef=portletDef.property;
if(propertyDef&&!(propertyDef instanceof Array)){
propertyDef=[propertyDef]
}
portletDef.properties=propertyDef;
delete portletDef.property
}}}
catch(e){}}else{
e=""
}
if(!this._manifest){
this._manifest={
error:e}
}
if(callback){
callback.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 o=[];
for(var t in ZmApp.CHOOSER_SORT){
o.push({
name:t,sort:ZmApp.CHOOSER_SORT[t]}
)
}
o.sort(ZmPortalApp.__BY_SORT);
var e=null;
for(var a=0;
a<o.length;
a++){
var n=o[a];
if(n.name==this._name){
continue
}
if(appCtxt.getApp(n.name).isUpsell){
continue
}
e=n.name;
break
}
this._overviewApp=appCtxt.getApp(e)
}
return this._overviewApp
};
ZmPortalApp.__BY_SORT=function(t,e){
return t.sort-e.sort
}
}
if(AjxPackage.define("zimbraMail.mail.ZmMailApp")){
ZmMailApp=function(t,e){
ZmApp.call(this,ZmApp.MAIL,t,e);
this._dataSourceCollection={};
this._identityCollection={};
this._signatureCollection={};
this.numEntries=0;
this.globalMailCount=0;
this._throttleStats=[];
this._addSettingsChangeListeners()
};
ZmMailApp.prototype=new ZmApp;
ZmMailApp.prototype.constructor=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.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={};
for(var i in ZmMailApp.INC_MAP){
var key=(i==ZmSetting.INC_NONE||i==ZmSetting.INC_ATTACH)?ZmMailApp.INC_MAP[i][0]:ZmMailApp.INC_MAP[i].join("|");
ZmMailApp.INC_MAP_REV[key]=i
}
ZmMailApp._setGroupByMaps=function(){
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.toString=function(){
return"ZmMailApp"
};
ZmMailApp.prototype._defineAPI=function(){
AjxDispatcher.setPackageLoadFunction("MailCore",new AjxCallback(this,this._postLoadCore));
AjxDispatcher.setPackageLoadFunction("Mail",new AjxCallback(this,this._postLoad));
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",new AjxCallback(this,this.getConvListController));
AjxDispatcher.registerMethod("GetMsgController",["MailCore","Mail"],new AjxCallback(this,this.getMsgController));
AjxDispatcher.registerMethod("GetTradController","MailCore",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("GetAttachmentsController",["MailCore","Mail"],new AjxCallback(this,this.getAttachmentsController));
AjxDispatcher.registerMethod("GetMailConfirmController",["MailCore","Mail"],new AjxCallback(this,this.getConfirmController))
};
ZmMailApp.prototype._registerSettings=function(e){
var e=e||appCtxt.getSettings();
e.registerSetting("ALLOW_ANY_FROM_ADDRESS",{
name:"zimbraAllowAnyFromAddress",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.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}
);
e.registerSetting("COMPOSE_SAME_FORMAT",{
name:"zimbraPrefForwardReplyInOriginalFormat",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CONVERSATIONS_ENABLED",{
name:"zimbraFeatureConversationsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("CONVERSATION_ORDER",{
name:"zimbraPrefConversationOrder",type:ZmSetting.T_PREF,defaultValue:ZmSearch.DATE_DESC,isImplicit:true}
);
e.registerSetting("CONVERSATION_PAGE_SIZE",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:250,isGlobal:true}
);
e.registerSetting("DEDUPE_MSG_TO_SELF",{
name:"zimbraPrefDedupeMessagesSentToSelf",type:ZmSetting.T_PREF,defaultValue:ZmSetting.DEDUPE_NONE}
);
e.registerSetting("DEFAULT_DISPLAY_NAME",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("DETACH_COMPOSE_ENABLED",{
name:"zimbraFeatureComposeInNewWindowEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("DETACH_MAILVIEW_ENABLED",{
name:"zimbraFeatureOpenMailInNewWindowEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("DISPLAY_EXTERNAL_IMAGES",{
name:"zimbraPrefDisplayExternalImages",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("END_DATE_ENABLED",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("FILTERS_ENABLED",{
name:"zimbraFeatureFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("FILTERS_MAIL_FORWARDING_ENABLED",{
name:"zimbraFeatureMailForwardingInFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("FORWARD_INCLUDE_HEADERS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("FORWARD_INCLUDE_ORIG",{
name:"zimbraPrefForwardIncludeOriginalText",type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("FORWARD_INCLUDE_WHAT",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("FORWARD_MENU_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("FORWARD_USE_PREFIX",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("GET_MAIL_ACTION",{
name:"zimbraPrefGetMailAction",type:ZmSetting.T_PREF,defaultValue:ZmSetting.GETMAIL_ACTION_DEFAULT,isGlobal:true}
);
e.registerSetting("GROUP_MAIL_BY",{
name:"zimbraPrefGroupMailBy",type:ZmSetting.T_PREF,defaultValue:ZmSetting.GROUP_BY_MESSAGE,isImplicit:true,isGlobal:true}
);
e.registerSetting("HIGHLIGHT_OBJECTS",{
name:"zimbraMailHighlightObjectsMaxSize",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:70}
);
e.registerSetting("HTML_SIGNATURE_ENABLED",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IDENTITIES_ENABLED",{
name:"zimbraFeatureIdentitiesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("INITIAL_SEARCH",{
name:"zimbraPrefMailInitialSearch",type:ZmSetting.T_PREF,defaultValue:"in:inbox"}
);
e.registerSetting("INITIAL_SEARCH_ENABLED",{
name:"zimbraFeatureInitialSearchPreferenceEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_ATTACH_VIEW_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_BLACKLIST",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("TRUSTED_ADDR_LIST",{
name:"zimbraPrefMailTrustedSenderList",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}
);
e.registerSetting("TRUSTED_ADDR_LIST_MAX_NUM_ENTRIES",{
name:"zimbraMailTrustedSenderListMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
);
e.registerSetting("MAIL_BLACKLIST_MAX_NUM_ENTRIES",{
name:"zimbraMailBlacklistMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
);
e.registerSetting("MAIL_FOLDER_COLORS_ENABLED",{
name:"zimbraPrefFolderColorEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("MAIL_FORWARDING_ADDRESS",{
name:"zimbraPrefMailForwardingAddress",type:ZmSetting.T_PREF}
);
e.registerSetting("MAIL_FORWARDING_ENABLED",{
name:"zimbraFeatureMailForwardingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_MANDATORY_SPELLCHECK",{
name:"zimbraPrefMandatorySpellCheckEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_FROM_ADDRESS",{
name:"zimbraPrefFromAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("MAIL_LIFETIME_GLOBAL",{
name:"zimbraMailMessageLifetime",type:ZmSetting.T_COS,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_INBOX_READ",{
name:"zimbraPrefInboxReadLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_INBOX_UNREAD",{
name:"zimbraPrefInboxUnreadLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_JUNK",{
name:"zimbraPrefJunkLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_JUNK_GLOBAL",{
name:"zimbraMailSpamLifetime",type:ZmSetting.T_COS,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_SENT",{
name:"zimbraPrefSentLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_TRASH",{
name:"zimbraPrefTrashLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_TRASH_GLOBAL",{
name:"zimbraMailTrashLifetime",type:ZmSetting.T_COS,defaultValue:"0"}
);
e.registerSetting("MAIL_LOCAL_DELIVERY_DISABLED",{
name:"zimbraPrefMailLocalDeliveryDisabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_NOTIFY_SOUNDS",{
name:"zimbraPrefMailSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_NOTIFY_APP",{
name:"zimbraPrefMailFlashIcon",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_NOTIFY_BROWSER",{
name:"zimbraPrefMailFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_NOTIFY_TOASTER",{
name:"zimbraPrefMailToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_PRIORITY_ENABLED",{
name:"zimbraFeatureMailPriorityEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_READ_RECEIPT_ENABLED",{
name:"zimbraFeatureReadReceiptsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("MAIL_SEND_READ_RECEIPTS",{
name:"zimbraPrefMailSendReadReceipts",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"never"}
);
e.registerSetting("MAIL_WHITELIST",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("MAIL_WHITELIST_MAX_NUM_ENTRIES",{
name:"zimbraMailWhitelistMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
);
e.registerSetting("MARK_MSG_READ",{
name:"zimbraPrefMarkMsgRead",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}
);
e.registerSetting("MAX_MESSAGE_SIZE",{
type:ZmSetting.T_PREF,defaultValue:ZmMailApp.DEFAULT_MAX_MESSAGE_SIZE}
);
e.registerSetting("NEW_WINDOW_COMPOSE",{
name:"zimbraPrefComposeInNewWindow",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("NOTIF_ADDRESS",{
name:"zimbraPrefNewMailNotificationAddress",type:ZmSetting.T_PREF}
);
e.registerSetting("NOTIF_ENABLED",{
name:"zimbraPrefNewMailNotificationEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("NOTIF_FEATURE_ENABLED",{
name:"zimbraFeatureNewMailNotificationEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("OPEN_MAIL_IN_NEW_WIN",{
name:"zimbraPrefOpenMailInNewWindow",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("POP_ENABLED",{
name:"zimbraPop3Enabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:!appCtxt.isOffline}
);
e.registerSetting("POP_DOWNLOAD_SINCE_VALUE",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}
);
e.registerSetting("POP_DOWNLOAD_SINCE",{
name:"zimbraPrefPop3DownloadSince",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}
);
e.registerSetting("READING_PANE_LOCATION",{
name:"zimbraPrefReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true,isGlobal:true}
);
e.registerSetting("READING_PANE_LOCATION_CV",{
name:"zimbraPrefConvReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}
);
e.registerSetting("REPLY_INCLUDE_HEADERS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("REPLY_INCLUDE_ORIG",{
name:"zimbraPrefReplyIncludeOriginalText",type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("REPLY_INCLUDE_WHAT",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("REPLY_MENU_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("REPLY_PREFIX",{
name:"zimbraPrefForwardReplyPrefixChar",type:ZmSetting.T_PREF,defaultValue:">",isGlobal:true}
);
e.registerSetting("REPLY_TO_ADDRESS",{
name:"zimbraPrefReplyToAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("REPLY_TO_ENABLED",{
name:"zimbraPrefReplyToEnabled",type:ZmSetting.T_PREF}
);
e.registerSetting("REPLY_USE_PREFIX",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("SAVE_DRAFT_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("SAVE_TO_SENT",{
name:"zimbraPrefSaveToSent",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("SELECT_AFTER_DELETE",{
name:"zimbraPrefMailSelectAfterDelete",type:ZmSetting.T_PREF,defaultValue:ZmSetting.DELETE_SELECT_NEXT,isGlobal:true}
);
e.registerSetting("SENT_FOLDER_NAME",{
name:"zimbraPrefSentMailFolder",type:ZmSetting.T_PREF,defaultValue:"sent"}
);
e.registerSetting("SHOW_BCC",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SHOW_FRAGMENTS",{
name:"zimbraPrefShowFragments",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("SHOW_MAIL_CONFIRM",{
name:"zimbraFeatureConfirmationPageEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SIGNATURE",{
name:"zimbraPrefMailSignature",type:ZmSetting.T_PREF}
);
e.registerSetting("SIGNATURE_ENABLED",{
name:"zimbraPrefMailSignatureEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SIGNATURE_STYLE",{
name:"zimbraPrefMailSignatureStyle",type:ZmSetting.T_PREF,defaultValue:ZmSetting.SIG_OUTLOOK}
);
e.registerSetting("START_DATE_ENABLED",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("USER_FOLDERS_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("VACATION_FROM",{
name:"zimbraPrefOutOfOfficeFromDate",type:ZmSetting.T_PREF,defaultValue:""}
);
e.registerSetting("VACATION_MSG",{
name:"zimbraPrefOutOfOfficeReply",type:ZmSetting.T_PREF,defaultValue:""}
);
e.registerSetting("VACATION_MSG_ENABLED",{
name:"zimbraPrefOutOfOfficeReplyEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("VACATION_MSG_FEATURE_ENABLED",{
name:"zimbraFeatureOutOfOfficeReplyEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("VACATION_UNTIL",{
name:"zimbraPrefOutOfOfficeUntilDate",type:ZmSetting.T_PREF,defaultValue:""}
);
e.registerSetting("COLLAPSE_IMAP_TREES",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SAVE_TO_IMAP_SENT",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
ZmMailApp._setGroupByMaps()
};
ZmMailApp.prototype._registerPrefs=function(){
var t={
MAIL:{
title:ZmMsg.mail,icon:"MailApp",templateId:"prefs.Pages#Mail",priority:10,precondition:appCtxt.get(ZmSetting.MAIL_ENABLED),prefs:[ZmSetting.DEDUPE_MSG_TO_SELF,ZmSetting.DISPLAY_EXTERNAL_IMAGES,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_APP,ZmSetting.MAIL_NOTIFY_BROWSER,ZmSetting.MAIL_NOTIFY_TOASTER,ZmSetting.OFFLINE_NOTIFY_NEWMAIL_ON_INBOX,ZmSetting.MAIL_WHITELIST,ZmSetting.MAIL_SEND_READ_RECEIPTS,ZmSetting.MARK_MSG_READ,ZmSetting.NOTIF_ADDRESS,ZmSetting.NOTIF_ENABLED,ZmSetting.OPEN_MAIL_IN_NEW_WIN,ZmSetting.PAGE_SIZE,ZmSetting.POP_DOWNLOAD_SINCE_VALUE,ZmSetting.POP_DOWNLOAD_SINCE,ZmSetting.POLLING_INTERVAL,ZmSetting.SHOW_FRAGMENTS,ZmSetting.VACATION_MSG_ENABLED,ZmSetting.VACATION_MSG,ZmSetting.SELECT_AFTER_DELETE,ZmSetting.START_DATE_ENABLED,ZmSetting.END_DATE_ENABLED,ZmSetting.VACATION_FROM,ZmSetting.VACATION_UNTIL,ZmSetting.VIEW_AS_HTML],manageDirty:true,createView:function(o,n,a){
AjxDispatcher.require("Alert");
return new ZmMailPrefsPage(o,n,a)
}}
,ACCOUNTS:{
parentId:"MAIL",icon:"Accounts",title:(appCtxt.isOffline?ZmMsg.personas:ZmMsg.accounts),templateId:"prefs.Pages#Accounts",priority:40,precondition:appCtxt.get(ZmSetting.MAIL_ENABLED),prefs:[ZmSetting.ACCOUNTS],manageDirty:true,createView:function(o,n,a){
return new ZmAccountsPage(o,n,a)
}}
,SIGNATURES:{
parentId:"MAIL",icon:"AddSignature",title:ZmMsg.signatures,templateId:"prefs.Pages#Signatures",priority:30,precondition:(appCtxt.get(ZmSetting.MAIL_ENABLED)&&appCtxt.get(ZmSetting.SIGNATURES_ENABLED)),prefs:[ZmSetting.SIGNATURES,ZmSetting.SIGNATURE_STYLE,ZmSetting.SIGNATURE_ENABLED],manageDirty:true,createView:function(o,n,a){
return new ZmSignaturesPage(o,n,a)
}}
,FILTERS:{
parentId:"MAIL",icon:"MailRule",title:ZmMsg.filterRules,templateId:"prefs.Pages#MailFilters",priority:50,precondition:(appCtxt.get(ZmSetting.MAIL_ENABLED)&&appCtxt.get(ZmSetting.FILTERS_ENABLED)),prefs:[ZmSetting.FILTERS],manageChanges:true,createView:function(o,n,a){
return a.getFilterController(n).getFilterView()
}}
,TRUSTED_ADDR:{
parentId:"MAIL",title:ZmMsg.trustedAddrs,icon:"TrustedAddresses",templateId:"prefs.Pages#Trusted",priority:60,precondition:appCtxt.get(ZmSetting.MAIL_ENABLED),createView:function(o,n,a){
return new ZmTrustedPage(o,n,a)
}
,manageDirty:true,prefs:[ZmSetting.TRUSTED_ADDR_LIST]}};
for(var e in t){
ZmPref.registerPrefSection(e,t[e])
}
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("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("DISPLAY_EXTERNAL_IMAGES",{
displayName:ZmMsg.showExternalImages,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("END_DATE_ENABLED",{
displayName:ZmMsg.endOn,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}
);
ZmPref.registerPref("GET_MAIL_ACTION",{
displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.checkMailPrefDefault,ZmMsg.checkMailPrefUpdate],options:[ZmSetting.GETMAIL_ACTION_DEFAULT,ZmSetting.GETMAIL_ACTION_UPDATE]}
);
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_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}
);
ZmPref.registerPref("NOTIF_ENABLED",{
displayName:ZmMsg.mailNotifEnabled,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.NOTIF_FEATURE_ENABLED,validationFunction:ZmMailApp.validateSendNotification,errorMessage:ZmMsg.errorMissingNotifyAddr}
);
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("REPLY_TO_ADDRESS",{
displayName:ZmMsg.replyToAddress,displayContainer:ZmPref.TYPE_INPUT,validationFunction:ZmPref.validateEmail,errorMessage:ZmMsg.invalidEmail}
);
ZmPref.registerPref("SELECT_AFTER_DELETE",{
displayName:ZmMsg.clientType,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}
);
ZmPref.registerPref("START_DATE_ENABLED",{
displayContainer:ZmPref.TYPE_CHECKBOX,displayName:ZmMsg.startOn,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}
);
ZmPref.registerPref("VACATION_FROM",{
displayName:ZmMsg.startDate,displayContainer:ZmPref.TYPE_INPUT,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,displayFunction:ZmPref.dateGMT2Local,valueFunction:ZmPref.dateLocal2GMT}
);
ZmPref.registerPref("VACATION_UNTIL",{
displayName:ZmMsg.endDate,displayContainer:ZmPref.TYPE_INPUT,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,displayFunction:ZmPref.dateGMT2Local,valueFunction:ZmPref.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.awayMessageEnabled,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,validationFunction:ZmMailApp.validateVacationMsgEnabled,errorMessage:ZmMsg.missingAwayMessage}
);
ZmPref.registerPref("MAIL_NOTIFY_TOASTER",{
displayFunc:function(){
AjxDispatcher.require("Alert");
return ZmDesktopAlert.getInstance().getDisplayText()
}
,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.validateForwardEmail=function(t){
if(!t||t==""){
var o=ZmPref.getPrefSectionWithPref(ZmSetting.MAIL_FORWARDING_ADDRESS);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var a=e.getView(o.id).getFormObject(ZmSetting.MAIL_LOCAL_DELIVERY_DISABLED);
if(a&&a.isSelected()){
a.setSelected(false)
}}
return ZmPref.validateEmail(t)
};
ZmMailApp.validateMailLocalDeliveryDisabled=function(a){
if(!a){
return true
}
var o=ZmPref.getPrefSectionWithPref(ZmSetting.MAIL_FORWARDING_ADDRESS);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(o.id).getFormObject(ZmSetting.MAIL_FORWARDING_ADDRESS);
return(t!=null&&t.isValid())
};
ZmMailApp.validateSendNotification=function(a){
if(!a){
return true
}
var o=ZmPref.getPrefSectionWithPref(ZmSetting.NOTIF_ADDRESS);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(o.id).getFormObject(ZmSetting.NOTIF_ADDRESS);
return(t!=null&&t.isValid())
};
ZmMailApp.validateVacationMsg=function(a){
if(a&&(a.length>0)){
return true
}
var o=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG_ENABLED);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(o.id).getFormObject(ZmSetting.VACATION_MSG_ENABLED);
return(t&&!t.isSelected())
};
ZmMailApp.validateVacationMsgEnabled=function(a){
if(!a){
return true
}
var n=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG);
if(!n){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(n.id).getFormObject(ZmSetting.VACATION_MSG);
if(!t){
return false
}
var o=t.getValue();
return(o&&(o.length>0))
};
ZmMailApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_ACCEPT_PROPOSAL,{
textKey:"replyAccept",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_ADD_FILTER_RULE,{
textKey:"newFilter",image:"Plus"}
,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}
);
ZmOperation.registerOp(ZmId.OP_CHECK_MAIL_DEFAULT,{
textKey:"checkMailDefault"}
);
ZmOperation.registerOp(ZmId.OP_CHECK_MAIL_UPDATE,{
textKey:"checkMailUpdate"}
);
ZmOperation.registerOp(ZmId.OP_COMPOSE_OPTIONS,{
textKey:"options",image:"Preferences"}
);
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_DECLINE_PROPOSAL,{
textKey:"replyDecline",image:"Cancel"}
);
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,{
tooltipKey:"deleteTooltip",image:"Delete"}
);
ZmOperation.registerOp(ZmId.OP_DETACH_COMPOSE,{
tooltipKey:"detachTooltip",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_INLINE,{
textKey:"forwardInline",tooltipKey:"forwardTooltip",image:"Forward"}
);
ZmOperation.registerOp(ZmId.OP_IM,{
textKey:"newIM",image:"ImStartChat",tooltipKey:"imNewChat"}
,ZmSetting.IM_ENABLED);
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_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_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_REMOVE_FILTER_RULE,{
textKey:"filterRemove",image:"Delete"}
,ZmSetting.FILTERS_ENABLED);
ZmOperation.registerOp(ZmId.OP_CAL_REPLY,{
textKey:"reply",tooltipKey:"replyTooltip",image:"Reply",shortcut:ZmKeyMap.REPLY}
);
ZmOperation.registerOp(ZmId.OP_CAL_REPLY_ALL,{
textKey:"replyAll",tooltipKey:"replyAllTooltip",image:"ReplyAll",shortcut:ZmKeyMap.REPLY_ALL}
);
ZmOperation.registerOp(ZmId.OP_REPLY,{
textKey:"reply",tooltipKey:"replyTooltip",image:"Reply",shortcut:ZmKeyMap.REPLY,textPrecedence:50}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT,{
textKey:"replyAccept",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ALL,{
textKey:"replyAll",tooltipKey:"replyAllTooltip",image:"ReplyAll",shortcut:ZmKeyMap.REPLY_ALL,textPrecedence:48}
);
ZmOperation.registerOp(ZmId.OP_REPLY_CANCEL);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE,{
textKey:"replyDecline",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_MODIFY);
ZmOperation.registerOp(ZmId.OP_REPLY_NEW_TIME,{
textKey:"replyNewTime",image:"NewTime"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE,{
textKey:"replyTentative",image:"QuestionMark"}
);
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.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_ONLY_MAIL,{
textKey:"showOnlyMail",image:"Conversation"}
,ZmSetting.MIXED_VIEW_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",countKey:"typeConversation",icon:"Conversation",soapCmd:"ConvAction",itemClass:"ZmConv",node:"c",organizer:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.TAG,ZmOrganizer.ZIMLET],searchType:"conversation",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("MailCore");
return new ZmMailList(ZmItem.CONV,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.MSG,{
app:ZmApp.MAIL,nameKey:"message",countKey:"typeMessage",icon:"Message",soapCmd:"MsgAction",itemClass:"ZmMailMsg",node:"m",organizer:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.TAG,ZmOrganizer.ZIMLET],searchType:"message",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("MailCore");
return new ZmMailList(ZmItem.MSG,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.ATT,{
app:ZmApp.MAIL,nameKey:"attachment",icon:"Attachment",itemClass:"ZmMimePart",node:"mp",resultsList:AjxCallback.simpleClosure(function(e){
return new ZmMailList(ZmItem.ATT,e)
}
,this)}
)
};
ZmMailApp.prototype._setupSearchToolbar=function(){
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_MAIL,{
msgKey:"searchMail",tooltipKey:"searchMail",icon:"Message",shareIcon:"SharedMailFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_MAIL)}
)
}};
ZmMailApp.prototype._registerApp=function(){
var t={};
t[ZmOperation.NEW_MESSAGE]="message";
var e={};
e[ZmKeyMap.NEW_MESSAGE]=ZmOperation.NEW_MESSAGE;
e[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],assistants:{
ZmMailAssistant:"Mail"}
,searchTypes:[ZmItem.MSG,ZmItem.CONV],newItemOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_MAIL,newActionCode:ZmKeyMap.NEW_MESSAGE,qsViews:["compose","msg"],trashViewOp:ZmOperation.SHOW_ONLY_MAIL,chooserSort:10,defaultSort:10,upsellUrl:ZmSetting.MAIL_UPSELL_URL}
)
};
ZmMailApp.prototype.startup=function(e){};
ZmMailApp.prototype.preNotify=function(m){
if(!(m.deleted&&m.created&&m.modified)){
return m
}
var n=false;
var s=m.deleted.id&&m.deleted.id.split(",");
var g={};
var h=[];
if(s&&s.length){
for(var z=0;
z<s.length;
z++){
var v=s[z];
var y=ZmOrganizer.normalizeId(v);
if(y<0){
g[y]=true;
n=true
}else{
h.push(v)
}}}
if(!n){
return m
}
var f=false;
var p={};
var l={};
for(var B in m.created){
var T=m.created;
if(T&&T.length){
for(var z=0;
z<T.length;
z++){
var d=T[z];
var v=d.id;
var t=(B=="m")?"|cid="+d.cid+"|l="+d.l:"|n="+d.n;
AjxDebug.println(AjxDebug.NOTIFY,B+": id="+v+"|su='"+d.su+"'|f="+d.f+"|d="+d.d+t);
if(B=="m"){
p[v]=d
}else{
if(B=="c"&&(d.n>1)){
l[v]=d;
f=true
}}}}}
if(!f){
return m
}
var q=false;
var j={};
var u={};
var T=m.modified.m;
if(T&&T.length){
for(var z=0;
z<T.length;
z++){
var W=T[z];
var v=W.id;
var y=ZmOrganizer.normalizeId(v);
var e=y*-1;
if(g[e]&&l[W.cid]){
q=true;
u[v]=W;
j[W.cid]=appCtxt.multiAccounts?ZmOrganizer.getSystemId(e):e;
l[W.cid]._wasVirtConv=true;
l[W.cid].m=[{
id:v}
];
var o=appCtxt.getById(v);
if(o){
o.cid=W.cid
}}}}
if(!q){
return m
}
if(h.length){
m.deleted.id=h.join(",")
}else{
delete m.deleted
}
var A=[];
var T=m.created.c;
if(T&&T.length){
for(var z=0;
z<T.length;
z++){
var d=T[z];
var O=l[d.id];
if(!(O&&O._wasVirtConv)){
A.push(d)
}}}
if(A&&A.length){
m.created.c=A
}else{
delete m.created.c
}
for(var v in p){
var b=p[v];
var w=l[b.cid];
if(w&&w._wasVirtConv){
b._convCreateNode=w
}}
var k=[];
for(var r in j){
var x=l[r];
x.id=j[r];
x._newId=r;
k.push(x)
}
if(k.length){
var a={};
a.c=k;
appCtxt.getRequestMgr()._handleModifies(a)
}
appCtxt.setNotifyDebug("Handling NOTIFY: in ZmMailApp - End of Prenotify")
};
ZmMailApp.prototype.createNotify=function(h,e){
appCtxt.setNotifyDebug("Handling NOTIFY: In ZmMailAppcreateNotify");
if(!h.m&&!h.c&&!h.link){
return
}
if(!e&&!this._noDefer&&this._deferNotifications("create",h)){
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: skipping/deferring notifications");
return
}
if(h.link){
var r=h.link;
for(var a=0;
a<r.length;
a++){
var n=r[a];
if(appCtxt.cacheGet(n.id)){
continue
}
this._handleCreateLink(n,ZmOrganizer.FOLDER)
}}
var t=[this._tradController,this._convListController,this._convController];
var l=this._getCurrentViewController();
if(l&&t[t.length-1]!==l){
AjxUtil.arrayRemove(t,l);
t.push(l)
}
var s=0;
for(var a=0;
a<t.length;
a++){
if(t[a]){
s=a
}}
for(var a=0;
a<t.length;
a++){
var o=t[a];
if(o){
this._checkList(h,o.getList(),o,a==s)
}}
this._handleAlerts(h)
};
ZmMailApp.prototype._handleAlerts=function(p){
var e=p.m||[];
if(e.length==0){
return
}
AjxDispatcher.require("Alert");
var g=appCtxt.getActiveAccount();
var t,f,r=false;
var l=0;
for(var m=0;
m<e.length;
m++){
var b=e[m];
var n=(b&&b.f&&(b.f.indexOf(ZmItem.FLAG_UNREAD)!=-1))?ZmOrganizer.parseId(b.l):null;
var o=n&&n.account;
if(!o||(o&&o.isOfflineInitialSync())){
continue
}
if(appCtxt.isOffline&&n&&!o.isMain){
var c=(appCtxt.get(ZmSetting.OFFLINE_NOTIFY_NEWMAIL_ON_INBOX))?(n.id==ZmOrganizer.ID_INBOX):(n.id!=ZmOrganizer.ID_SPAM&&n.id!=ZmOrganizer.ID_TRASH);
if(c){
this.globalMailCount++;
o.inNewMailMode=true;
var w=appCtxt.getOverviewController()._overviewContainer;
for(var u in w){
w[u].updateAccountInfo(o,true,true)
}}}
if(n&&n.id==ZmOrganizer.ID_INBOX){
if(appCtxt.accountList.size()>1){
ZmAccountAlert.get(o).start(this)
}
if(!t&&o==g&&appCtxt.get(ZmSetting.MAIL_NOTIFY_APP,null,o)){
this.startAlert();
t=true
}
if(!f&&appCtxt.get(ZmSetting.MAIL_NOTIFY_SOUNDS,null,o)){
ZmSoundAlert.getInstance().start();
f=true
}
if(!r&&appCtxt.get(ZmSetting.MAIL_NOTIFY_BROWSER,null,o)){
ZmBrowserAlert.getInstance().start(ZmMsg.newMessage);
r=true
}
if(appCtxt.get(ZmSetting.MAIL_NOTIFY_TOASTER,null,o)&&l<5){
var a=appCtxt.getById(b.id)||ZmMailMsg.createFromDom(b,{}
);
var s=(a.subject)?([a.subject," - ",(a.fragment||"")].join("")):(a.fragment||"");
var d=a.getAddress(AjxEmailAddress.FROM);
var h=(d&&d instanceof AjxEmailAddress)?d.getName()||d.getAddress():(d&&typeof d=="string")?d:ZmMsg.unknown;
var y=(appCtxt.accountList.size()>1)?AjxMessageFormat.format(ZmMsg.newMailWithAccount,[h,o.getDisplayName()]):AjxMessageFormat.format(ZmMsg.newMail,h);
ZmDesktopAlert.getInstance().start(y,s);
l++
}}}};
ZmMailApp.prototype._checkList=function(r,n,o,c){
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: handling mail creates for view "+o._currentView);
if(!(n&&n instanceof ZmMailList)){
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: list is not a ZmMailList: "+n);
return
}
var a={};
var h={};
if(!(n.search&&n.search.matches)&&(o==this._tradController)){
var s=n.search?n.search.query:"";
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: search not matchable: "+s);
return
}
var l=n.search.sortBy;
var e=this._checkType(r,ZmItem.CONV,a,n,l,null,c);
var t=this._checkType(r,ZmItem.MSG,h,n,l,a,c);
if(e.gotMail||t.gotMail){
n.notifyCreate(a,h)
}
if(e.hasMore||t.hasMore){
var o=this._getCurrentViewController();
if(o){
o.setHasMore(true)
}}};
ZmMailApp.prototype._getCurrentViewController=function(){
var t;
var e=appCtxt.getAppViewMgr().getCurrentViewId();
if(e==ZmId.VIEW_CONVLIST){
t=this.getConvListController()
}else{
if(e==ZmId.VIEW_TRAD){
t=this.getTradController()
}}
return t
};
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().getReferenceView().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,{}
,true)
}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(t,e){
if(!t.m&&!t.c){
return
}
if(!e&&!this._noDefer&&this._deferNotifications("modify",t)){
return
}
this._batchNotify(t.m);
this._batchNotify(t.c)
};
ZmMailApp.prototype.postNotify=function(e){
var t=this._checkReplenishListView;
if(t&&!t._isPageless){
t._checkReplenish();
this._checkReplenishListView=null
}};
ZmMailApp.prototype.refresh=function(r){
var s=appCtxt.getById(ZmFolder.ID_INBOX);
if(s){
this.setNewMailNotice(s)
}
if(!appCtxt.inStartup){
this.resetOverview(this.getOverviewId());
var n=[ZmId.VIEW_TRAD,ZmId.VIEW_CONVLIST,ZmId.VIEW_CONV];
var d=appCtxt.getAppViewMgr()._views;
for(var a=0;
a<n.length;
a++){
var c=d[n[a]];
var h=c&&c[ZmAppViewMgr.C_APP_CONTENT];
if(h){
h.isStale=true
}}
var o=appCtxt.getCurrentViewId();
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._checkRefresh,[o]),1000)
}
if(appCtxt.get(ZmSetting.MAIL_ATTACH_VIEW_ENABLED)){
var e=appCtxt.getFolderTree();
if(!e.getById(ZmFolder.ID_ATTACHMENTS)){
var l=appCtxt.getById(ZmOrganizer.ID_ROOT);
var t={
id:ZmFolder.ID_ATTACHMENTS,parent:l,tree:l.tree,type:ZmOrganizer.FOLDER,numTotal:1};
var u=new ZmFolder(t);
l.children.add(u);
u._notify(ZmEvent.E_CREATE)
}}};
ZmMailApp.prototype._checkRefresh=function(t){
if(appCtxt.getCurrentViewId()==t){
var e=appCtxt.getCurrentView();
if(e&&e.isStale&&e._staleHandler){
e._staleHandler()
}}};
ZmMailApp.prototype.handleOp=function(n,o){
var t=false;
var a=true;
switch(n){
case ZmOperation.NEW_MESSAGE_WIN:t=true;
a=false;
case ZmOperation.NEW_MESSAGE:if(!t){
t=this._inNewWindow(o&&o.ev);
a=false
}
var e=new AjxCallback(this,this.compose,{
action:ZmOperation.NEW_MESSAGE,inNewWindow:t}
);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,a);
break
}};
ZmMailApp.prototype.getOverviewPanelContent=function(){
var t=!this._overviewPanelContent;
var e=ZmApp.prototype.getOverviewPanelContent.apply(this,arguments);
if(t){
appCtxt.getSearchController().updateOverview()
}
return e
};
ZmMailApp.prototype.getOverviewContainer=function(){
var t=!this._overviewContainer;
var e=ZmApp.prototype.getOverviewContainer.apply(this,arguments);
if(t&&!appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)){
appCtxt.getSearchController().updateOverview()
}
return e
};
ZmMailApp.prototype.launch=function(s,h){
this._setLaunchTime(this.toString(),new Date());
this._groupBy=appCtxt.get(ZmSetting.GROUP_MAIL_BY);
var o;
s=s||{};
if(s.qsParams){
var e=s.qsParams.view,r=s.qsParams.id;
if(e=="compose"){
this._showComposeView(h);
return
}else{
if(r){
e=e||"msg";
if(e=="list"){
o=["item:",r].join("");
s.searchResponse=null;
this._forceMsgView=true
}else{
if(e=="msg"){
var a=new ZmMailList(ZmItem.MSG);
var n=new ZmMailMsg(r,a,true);
a.add(n);
var t={
getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),markRead:(appCtxt.get(ZmSetting.MARK_MSG_READ)==ZmSetting.MARK_READ_NOW),callback:new AjxCallback(this,this._handleResponseMsgLoad,[n,h]),errorCallback:new AjxCallback(this,this._handleErrorMsgLoad,h)};
n.load(t);
return
}}}}}
this.mailSearch(o,h,s.searchResponse)
};
ZmMailApp.prototype._handleErrorLaunch=function(t,e){
if(e.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER||e.code==ZmCsfeException.MAIL_NO_SUCH_TAG||e.code==ZmCsfeException.MAIL_QUERY_PARSE_ERROR){
var a={
query:"in:inbox",callback:t.callback,errorCallback:null,types:t.types};
appCtxt.getSearchController().search(a)
}};
ZmMailApp.prototype._handleErrorMsgLoad=function(t,e){
this.mailSearch();
if(t){
t.run()
}
this._notifyRendered();
return false
};
ZmMailApp.prototype._handleResponseMsgLoad=function(t,a){
AjxDispatcher.require("Startup2");
var e=AjxDispatcher.run("GetMsgController");
if(e){
e.show(t);
if(a){
a.run()
}
this._notifyRendered();
appCtxt.notifyZimlets("onMsgView",[t,null,appCtxt.getCurrentView()],{
waitUntilLoaded:true}
)
}};
ZmMailApp.prototype.mailSearch=function(r,l,a,h){
var n=appCtxt.isOffline&&appCtxt.inStartup&&appCtxt.accountList.defaultAccount;
if(n){
appCtxt.accountList.setActiveAccount(n)
}
var s=appCtxt.getSearchController();
var c,e;
if(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)&&appCtxt.accountList.size()>2){
r=null;
c=appCtxt.accountList.generateQuery(ZmOrganizer.ID_INBOX);
e=true;
s.searchAllAccounts=true
}else{
r=r||appCtxt.get(ZmSetting.INITIAL_SEARCH,null,n)
}
var o=new AjxVector();
o.add(h||this.getGroupMailBy());
var t={
searchFor:ZmId.SEARCH_MAIL,query:r,queryHint:c,types:o,limit:this.getLimit(),getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML,null,n),noUpdateOverview:e,accountName:(n&&n.name),callback:l,response:a};
t.errorCallback=new AjxCallback(this,this._handleErrorLaunch,t);
s.search(t)
};
ZmMailApp.prototype.getSearchParams=function(e){
e=e||{};
if(!appCtxt.inStartup&&(appCtxt.get(ZmSetting.READING_PANE_LOCATION)!=ZmSetting.RP_OFF)){
e.fetch=true
}
AjxDispatcher.require("MailCore");
e.headers=ZmMailMsg.requestHeaders;
return e
};
ZmMailApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require("MailCore",false,e,null,true)
};
ZmMailApp.prototype._handleLoadShowSearchResults=function(t,a){
var e=(t.type==ZmItem.MSG)?this.getTradController():this.getConvListController();
e.show(t);
this._setLoadedTime(this.toString(),new Date());
if(this._forceMsgView){
e.selectFirstItem();
this._forceMsgView=false
}
if(a){
a.run()
}
this._notifyRendered()
};
ZmMailApp.prototype._parseComposeUrl=function(t){
t=t||"";
var o=t.match(/to=([^&]+)/);
var r=o?AjxStringUtil.urlComponentDecode(o[1]):null;
o=t.match(/subject=([^&]+)/);
var n=o?(AjxStringUtil.urlComponentDecode(o[1]).replace(/+/g," ")):null;
o=t.match(/cc=([^&]+)/);
var s=o?AjxStringUtil.urlComponentDecode(o[1]):null;
o=t.match(/bcc=([^&]+)/);
var a=o?AjxStringUtil.urlComponentDecode(o[1]):null;
o=t.match(/body=([^&]+)/);
var e=o?(AjxStringUtil.urlComponentDecode(o[1]).replace(/+/g," ")):null;
return{
to:AjxStringUtil.htmlEncode(r),subject:AjxStringUtil.htmlEncode(n),cc:AjxStringUtil.htmlEncode(s),bcc:AjxStringUtil.htmlEncode(a),body:AjxStringUtil.htmlEncode(e)}
};
ZmMailApp.prototype._showComposeView=function(r,a){
var o=a||location.search;
AjxDispatcher.require("Startup2");
var l=AjxDispatcher.run("GetComposeController");
var e=this._parseComposeUrl(o);
var s=e.to;
if(s&&s.indexOf("mailto")==0){
s=s.replace(/mailto:/,"");
var n=s.split("?");
e.to=n[0];
if(n.length>1){
n=n[1];
var h=this._parseComposeUrl(n);
e.to=e.to?(h.to?[e.to,","+h.to].join(""):e.to):h.to;
e.subject=h.subject||e.subject;
e.cc=h.cc||e.cc;
e.bcc=h.bcc||e.bcc;
e.body=h.body||e.body
}}
var t={
action:ZmOperation.NEW_MESSAGE,toOverride:e.to,ccOverride:e.cc,bccOverride:e.bcc,subjOverride:e.subject,extraBodyText:e.body,callback:r};
if(appCtxt.isOffline&&appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&appCtxt.getCurrentViewId()==ZmId.VIEW_COMPOSE){
l.resetComposeForMailto(t)
}else{
l.doAction(t)
}
this._notifyRendered();
return l
};
ZmMailApp.prototype.getConvListController=function(){
if(!this._convListController){
this._convListController=new ZmConvListController(this._container,this)
}
return this._convListController
};
ZmMailApp.prototype.getConvController=function(){
if(!this._convController){
this._convController=new ZmConvController(this._container,this)
}
return this._convController
};
ZmMailApp.prototype.getTradController=function(){
if(!this._tradController){
this._tradController=new ZmTradController(this._container,this)
}
return this._tradController
};
ZmMailApp.prototype.getMsgController=function(a){
var t=this._sessionController[ZmId.VIEW_MSG];
var e;
for(var o in t){
if(t[o].getMsg()&&t[o].getMsg().nId==a){
e=t[o];
break
}}
if(e){
a=e.sessionId;
this._curSessionId[ZmId.VIEW_MSG]=a;
e.inactive=false;
return e
}
return this.getSessionController(ZmId.VIEW_MSG,"ZmMsgController",a)
};
ZmMailApp.prototype.getComposeController=function(e){
return this.getSessionController(ZmId.VIEW_COMPOSE,"ZmComposeController",e)
};
ZmMailApp.prototype.getCurrentSessionId=function(e){
return this._curSessionId[e]
};
ZmMailApp.prototype.getConfirmController=function(e){
return this.getSessionController(ZmId.VIEW_MAIL_CONFIRM,"ZmMailConfirmController",e)
};
ZmMailApp.prototype.getMailListController=function(){
var e=appCtxt.get(ZmSetting.GROUP_MAIL_BY);
return(e==ZmSetting.GROUP_BY_CONV)?AjxDispatcher.run("GetConvListController"):AjxDispatcher.run("GetTradController")
};
ZmMailApp.prototype.getAttachmentsController=function(){
if(!this._attachmentsController){
this._attachmentsController=new ZmAttachmentsController(this._container,this)
}
return this._attachmentsController
};
ZmMailApp.prototype.compose=function(o){
var a=this._sessionController[ZmId.VIEW_COMPOSE];
var e;
var t=o.msg&&o.msg.nId;
for(var n in a){
if(a[n].getMsg()&&a[n].getMsg().nId==t){
e=a[n];
break
}}
if(!e){
e=AjxDispatcher.run("GetComposeController")
}
appCtxt.composeCtlrSessionId=e.sessionId;
e.doAction(o)
};
ZmMailApp.prototype.setNewMailNotice=function(e){
var a=appCtxt.getAppChooser();
if(a){
var o=a.getButton(ZmApp.MAIL);
var t=(e.numUnread>0)?"EnvelopeOpen":"MailApp";
o.setImage(t)
}
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.getGroupMailBy=function(){
var e=this._groupBy||appCtxt.get(ZmSetting.GROUP_MAIL_BY);
return e?ZmMailApp.GROUP_MAIL_BY_ITEM[e]:ZmItem.MSG
};
ZmMailApp.prototype.setGroupMailBy=function(e){
this._groupBy=e;
appCtxt.set(ZmSetting.GROUP_MAIL_BY,e)
};
ZmMailApp.prototype.getLimit=function(t){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
};
ZmMailApp.addReplyMenu=function(e){
var t=[ZmOperation.REPLY,ZmOperation.REPLY_ALL];
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmMailApp.addForwardMenu=function(e){
var t=[ZmOperation.FORWARD_INLINE,ZmOperation.FORWARD_ATT];
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmMailApp.prototype.getDataSourceCollection=function(t){
var a=window.parentAppCtxt||window.appCtxt;
var e=t?t.name:a.getActiveAccount().name;
if(!this._dataSourceCollection[e]){
this._dataSourceCollection[e]=new ZmDataSourceCollection();
if(a.getActiveAccount().isMain){
this._dataSourceCollection[e].initialize(a.getSettings().getInfoResponse.dataSources)
}}
return this._dataSourceCollection[e]
};
ZmMailApp.prototype.getIdentityCollection=function(o){
if(appCtxt.isChildWindow){
if(!this._identityCollection){
this._identityCollection=new ZmIdentityCollection()
}
return this._identityCollection
}
var t=o?o.name:appCtxt.getActiveAccount().name;
if(!this._identityCollection[t]){
var e=this._identityCollection[t]=new ZmIdentityCollection();
var a=appCtxt.getSettings(o);
if(a){
e.initialize(a.getInfoResponse.identities)
}}
return this._identityCollection[t]
};
ZmMailApp.prototype.getSignatureCollection=function(a){
var o=window.parentAppCtxt||window.appCtxt;
a=a||o.getActiveAccount();
var e=a.name;
var t=o.getSettings(a);
if(!this._signatureCollection[e]&&t){
var n=this._signatureCollection[e]=new ZmSignatureCollection();
n.initialize(t.getInfoResponse.signatures)
}
return this._signatureCollection[e]
};
ZmMailApp.prototype._addSettingsChangeListeners=function(){
ZmApp.prototype._addSettingsChangeListeners.call(this);
if(!this._settingsListener){
this._settingsListener=new AjxListener(this,this._settingsChangeListener)
}
var e=appCtxt.getSettings();
e.getSetting(ZmSetting.VIEW_AS_HTML).addChangeListener(this._settingListener);
e.getSetting(ZmSetting.TRUSTED_ADDR_LIST).addChangeListener(this._settingListener);
e.addChangeListener(this._settingsListener)
};
ZmMailApp.prototype._settingChangeListener=function(a){
ZmApp.prototype._settingChangeListener.call(this,a);
if(a.type!=ZmEvent.S_SETTING){
return
}
var t=a.source;
var n=this.getMailListController();
if(n&&(t.id==ZmSetting.VIEW_AS_HTML||t.id==ZmSetting.TRUSTED_ADDR_LIST)){
this.resetTrustedSendersList();
var e=n._doublePaneView;
var o=e?e.getMsg():null;
if(o){
e.reset();
e.setMsg(o)
}}};
ZmMailApp.prototype._settingsChangeListener=function(n){
if(n.type!=ZmEvent.S_SETTINGS){
return
}
var s=n.getDetail("settings");
if(!(s&&s.length)){
return
}
var h=this.getMailListController();
if(!h){
return
}
var e=h._currentView;
var r,o;
for(var t=0;
t<s.length;
t++){
var a=s[t];
if(a.id==ZmSetting.SHOW_FRAGMENTS){
if(e!=ZmId.VIEW_MSG){
r=o||e
}}}
r=o||r;
if(r){
h.switchView(r,true)
}};
ZmMailApp.prototype.getTrustedSendersList=function(){
if(!this._trustedList){
var e=appCtxt.get(ZmSetting.TRUSTED_ADDR_LIST);
if(e){
this._trustedList=AjxVector.fromArray(e)
}else{
this._trustedList=new AjxVector()
}}
return this._trustedList
};
ZmMailApp.prototype.resetTrustedSendersList=function(){
this._trustedList=null
}
}
if(AjxPackage.define("zimbraMail.calendar.ZmCalendarApp")){
ZmCalendarApp=function(e){
ZmApp.call(this,ZmApp.CALENDAR,e);
this._addSettingsChangeListeners();
this._resByName={};
this._resByEmail={}
};
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_SCHEDULE]=ZmId.VIEW_CAL_SCHEDULE;
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:N1700,2:Y1700,3:Y1700,4:Y1700,5:Y1700,6:Y1700,7:N1700";
ZmCalendarApp.prototype=new ZmApp;
ZmCalendarApp.prototype.constructor=ZmCalendarApp;
ZmCalendarApp.prototype.toString=function(){
return"ZmCalendarApp"
};
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","CalendarCore",new AjxCallback(this,this.getCalController));
AjxDispatcher.registerMethod("GetReminderController","CalendarCore",new AjxCallback(this,this.getReminderController));
AjxDispatcher.registerMethod("ShowMiniCalendar","CalendarCore",new AjxCallback(this,this.showMiniCalendar));
AjxDispatcher.registerMethod("GetApptComposeController",["CalendarCore","Calendar","CalendarAppt"],new AjxCallback(this,this.getApptComposeController))
};
ZmCalendarApp.prototype._registerSettings=function(e){
var e=e||appCtxt.getSettings();
e.registerSetting("CAL_ALWAYS_SHOW_MINI_CAL",{
name:"zimbraPrefCalendarAlwaysShowMiniCal",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_APPT_VISIBILITY",{
name:"zimbraPrefCalendarApptVisibility",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"public",isGlobal:true}
);
e.registerSetting("CAL_EMAIL_REMINDERS_ADDRESS",{
name:"zimbraPrefCalendarReminderEmail",type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_DEVICE_EMAIL_REMINDERS_ADDRESS",{
name:"zimbraCalendarReminderDeviceEmail",type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_DEVICE_EMAIL_REMINDERS_ENABLED",{
name:"zimbraFeatureCalendarReminderDeviceEmailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("CAL_EXPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("CAL_FIRST_DAY_OF_WEEK",{
name:"zimbraPrefCalendarFirstDayOfWeek",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}
);
e.registerSetting("CAL_FREE_BUSY_ACL",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.ACL_ALL}
);
e.registerSetting("CAL_FREE_BUSY_ACL_USERS",{
type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_IMPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("CAL_INVITE_ACL",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.ACL_ALL}
);
e.registerSetting("CAL_INVITE_ACL_USERS",{
type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_REMINDER_NOTIFY_SOUNDS",{
name:"zimbraPrefCalendarReminderSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_REMINDER_NOTIFY_BROWSER",{
name:"zimbraPrefCalendarReminderFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_REMINDER_NOTIFY_TOASTER",{
name:"zimbraPrefCalendarToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_REMINDER_WARNING_TIME",{
name:"zimbraPrefCalendarApptReminderWarningTime",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}
);
e.registerSetting("CAL_SHOW_TIMEZONE",{
name:"zimbraPrefUseTimeZoneListInCalendar",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_USE_QUICK_ADD",{
name:"zimbraPrefCalendarUseQuickAdd",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CALENDAR_INITIAL_VIEW",{
name:"zimbraPrefCalendarInitialView",type:ZmSetting.T_PREF,defaultValue:ZmSetting.CAL_DAY,isGlobal:true}
);
e.registerSetting("CAL_WORKING_HOURS",{
name:"zimbraPrefCalendarWorkingHours",type:ZmSetting.T_PREF,defaultValue:ZmCalendarApp.DEFAULT_WORKING_HOURS,isGlobal:true}
);
e.registerSetting("FREE_BUSY_VIEW_ENABLED",{
name:"zimbraFeatureFreeBusyViewEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("DELETE_INVITE_ON_REPLY",{
name:"zimbraPrefDeleteInviteOnReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("ENABLE_APPL_ICAL_DELEGATION",{
name:"zimbraPrefAppleIcalDelegationEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_AUTO_ADD_INVITES",{
name:"zimbraPrefCalendarAutoAddInvites",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("CAL_SEND_INV_DENIED_REPLY",{
name:"zimbraPrefCalendarSendInviteDeniedAutoReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("CAL_INV_FORWARDING_ADDRESS",{
name:"zimbraPrefCalendarForwardInvitesTo",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST,isGlobal:true}
);
e.registerSetting("CAL_SHOW_PAST_DUE_REMINDERS",{
name:"zimbraPrefCalendarShowPastDueReminders",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_SHOW_CALENDAR_WEEK",{
name:"zimbraPrefShowCalendarWeek",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_APPT_ALLOW_ATTENDEE_EDIT",{
name:"zimbraPrefCalendarApptAllowAtendeeEdit",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_RESOURCE_DBL_BOOKING_ALLOWED",{
name:"zimbraCalendarResourceDoubleBookingAllowed",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_SHOW_RESOURCE_TABS",{
name:"zimbraCalendarShowResourceTabs",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_EXCEPTION_ON_SERIES_TIME_CHANGE",{
name:"zimbraCalendarKeepExceptionsOnSeriesTimeChange",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
)
};
ZmCalendarApp.prototype._registerPrefs=function(){
var t={
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_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],manageDirty:true,createView:function(o,n,a){
AjxDispatcher.require("Alert");
return new ZmCalendarPrefsPage(o,n,a)
}}};
for(var e in t){
ZmPref.registerPrefSection(e,t[e])
}
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}
);
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}
);
ZmPref.registerPref("CAL_REMINDER_WARNING_TIME",{
displayName:ZmMsg.numberOfMinutes,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.apptRemindNever,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore],options:[0,1,5,10,15,30,45,60]}
);
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,ZmMsg.calViewSchedule],options:[ZmSetting.CAL_DAY,ZmSetting.CAL_WORK_WEEK,ZmSetting.CAL_WEEK,ZmSetting.CAL_MONTH,ZmSetting.CAL_LIST,ZmSetting.CAL_SCHEDULE]}
);
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}
);
ZmPref.registerPref("CAL_REMINDER_NOTIFY_TOASTER",{
displayFunc:function(){
AjxDispatcher.require("Alert");
return ZmDesktopAlert.getInstance().getDisplayText()
}
,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}
)
};
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}
);
ZmOperation.registerOp(ZmId.OP_CAL_VIEW_MENU,{
textKey:"view",image:"Appointment"}
,null,AjxCallback.simpleClosure(function(e){
ZmOperation.addDeferredMenu(ZmCalendarApp.addCalViewMenu,e)
}
));
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(e){
ZmOperation.addDeferredMenu(ZmCalendarApp.addInviteReplyMenu,e)
}
));
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_PROPOSE_NEW_TIME,{
textKey:"proposeNewTime",image:"ProposeTime"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT,{
textKey:"replyAccept",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT_NOTIFY,{
textKey:"notifyOrganizerLabel",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT_IGNORE,{
textKey:"dontNotifyOrganizerLabel",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_CANCEL);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE,{
textKey:"replyDecline",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE_NOTIFY,{
textKey:"notifyOrganizerLabel",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE_IGNORE,{
textKey:"dontNotifyOrganizerLabel",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_MODIFY);
ZmOperation.registerOp(ZmId.OP_REPLY_NEW_TIME,{
textKey:"replyNewTime",image:"NewTime"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE,{
textKey:"replyTentative",image:"QuestionMark"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE_NOTIFY,{
textKey:"notifyOrganizerLabel",image:"QuestionMark"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE_IGNORE,{
textKey:"dontNotifyOrganizerLabel",image:"QuestionMark"}
);
ZmOperation.registerOp(ZmId.OP_FB_VIEW,{
textKey:"viewFB",tooltipKey:"viewFBTooltip",image:"GroupSchedule",shortcut:ZmKeyMap.CAL_FB_VIEW}
);
ZmOperation.registerOp(ZmId.OP_SCHEDULE_VIEW,{
textKey:"viewSchedule",tooltipKey:"viewScheduleTooltip",image:"GroupSchedule",shortcut:ZmKeyMap.CAL_SCHEDULE_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:"send",image:"MeetingRequest"}
)
};
ZmCalendarApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.APPT,{
app:ZmApp.CALENDAR,nameKey:"appointment",countKey:"typeAppointment",icon:"Appointment",soapCmd:"ItemAction",itemClass:"ZmAppt",node:"appt",organizer:ZmOrganizer.CALENDAR,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.CALENDAR],searchType:"appointment",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("CalendarCore");
return new ZmApptList(ZmItem.APPT,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.RESOURCE,{
app:ZmApp.CALENDAR,itemClass:"ZmResource",node:"calResource",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("CalendarCore");
return new ZmResourceList(null,e)
}
,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,treeType:ZmOrganizer.FOLDER,views:["appointment"],folderKey:"calendar",mountKey:"mountCalendar",createFunc:"ZmCalendar.create",compareFunc:"ZmCalendar.sortCompare",newOp:ZmOperation.NEW_CALENDAR,displayOrder:100,deferrable:true,childWindow:true}
)
};
ZmCalendarApp.prototype._setupSearchToolbar=function(){
var e={
msgKey:"appointments",tooltipKey:"searchAppts",icon:"Appointment",shareIcon:"SharedCalendarFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_APPOINTMENT)};
if(!appCtxt.isOffline){
e.setting=ZmSetting.CALENDAR_ENABLED
}
ZmSearchToolBar.addMenuItem(ZmItem.APPT,e)
};
ZmCalendarApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_APPT]="appointment";
var t={};
t[ZmOperation.NEW_CALENDAR]="calendar";
var e={};
e[ZmKeyMap.NEW_APPT]=ZmOperation.NEW_APPT;
e[ZmKeyMap.NEW_CALENDAR]=ZmOperation.NEW_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],assistants:{
ZmAppointmentAssistant:["CalendarCore","Calendar","CalendarAppt"],ZmCalendarAssistant:["CalendarCore","Calendar","CalendarAppt"]}
,newItemOps:a,newOrgOps:t,actionCodes:e,searchTypes:[ZmItem.APPT],gotoActionCode:ZmKeyMap.GOTO_CALENDAR,newActionCode:ZmKeyMap.NEW_APPT,chooserSort:30,defaultSort:20,upsellUrl:ZmSetting.CALENDAR_UPSELL_URL}
)
};
ZmCalendarApp.prototype.startup=function(e){};
ZmCalendarApp.prototype.refresh=function(e){
if(!appCtxt.inStartup){
AjxDispatcher.run("GetCalController").refreshHandler(e)
}};
ZmCalendarApp.prototype.deleteNotify=function(e,t){
if(!t&&this._deferNotifications("delete",e)){
return
}
AjxDispatcher.run("GetCalController").notifyDelete(e)
};
ZmCalendarApp.prototype.createNotify=function(o,s){
if(!o.folder&&!o.appt&&!o.link){
return
}
if(!s&&!this._noDefer&&this._deferNotifications("create",o)){
return
}
for(var e in o){
var n=o[e];
for(var a=0;
a<n.length;
a++){
var t=n[a];
if(appCtxt.cacheGet(t.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(t,ZmOrganizer.CALENDAR)
}else{
if(e=="link"){
this._handleCreateLink(t,ZmOrganizer.CALENDAR)
}else{
if(e=="appt"){
AjxDispatcher.run("GetCalController").notifyCreate(t)
}}}
if((e=="folder"||e=="link")&&this._calController){
this._calController._updateCheckedCalendars()
}}}};
ZmCalendarApp.prototype.modifyNotify=function(t,e){
if(!e&&!this._noDefer&&this._deferNotifications("modify",t)){
return
}
AjxDispatcher.run("GetCalController").notifyModify(t)
};
ZmCalendarApp.prototype.preNotify=function(e){
if(this._calController!=null){
this._calController.preNotify(e)
}};
ZmCalendarApp.prototype.postNotify=function(e){
if(this._calController!=null){
this._calController.postNotify(e)
}};
ZmCalendarApp.prototype.handleOp=function(t){
switch(t){
case ZmOperation.NEW_APPT:var e=new AjxCallback(this,this._handleLoadNewAppt);
AjxDispatcher.require(["CalendarCore","Calendar"],false,e,null,true);
break;
case ZmOperation.NEW_CALENDAR:var e=new AjxCallback(this,this._handleLoadNewCalendar);
AjxDispatcher.require(["CalendarCore","Calendar"],false,e,null,true);
break
}};
ZmCalendarApp.prototype._handleLoadNewAppt=function(){
AjxDispatcher.run("GetCalController").newAppointment(null,null,null,null)
};
ZmCalendarApp.prototype._handleLoadNewCalendar=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewCalendarDialog();
if(!this._newCalendarCb){
this._newCalendarCb=new AjxCallback(this,this._newCalendarCallback)
}
ZmController.showDialog(e,this._newCalendarCb)
};
ZmCalendarApp.prototype.launch=function(t,a){
this._setLaunchTime(this.toString(),new Date());
var e=new AjxCallback(this,this._handleLoadLaunch,[t,a]);
AjxDispatcher.require(["CalendarCore","Calendar"],true,e,null,true)
};
ZmCalendarApp.prototype._handleLoadLaunch=function(s,h){
var r=AjxDispatcher.run("GetCalController");
var t=r._defaultView();
var n=null;
s=s||{};
if(s.qsParams){
var o=s.qsParams.view;
if(o){
var e=ZmCalendarApp.VIEW_FOR_SETTING[o];
if(e){
t=e;
var a=s.qsParams.date;
if(a){
a=AjxDateUtil.parseServerDateTime(a);
if(a&&!isNaN(a)){
n=new Date((a).setHours(0,0,0,0))
}}}}}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
this.initResources()
}
r.show(t,n);
this._setLoadedTime(this.toString(),new Date());
if(h){
h.run()
}};
ZmCalendarApp.prototype.showSearchResults=function(e,t){
if(t){
t.run()
}};
ZmCalendarApp.prototype.activate=function(t){
this._createDeferredFolders(ZmApp.CALENDAR);
ZmApp.prototype.activate.apply(this,arguments);
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){
var e=t||appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL);
AjxDispatcher.run("ShowMiniCalendar",e)
}};
ZmCalendarApp.prototype.setOverviewPanelContent=function(a){
var e=appCtxt.getCurrentViewId();
if(e.indexOf(ZmId.VIEW_APPOINTMENT)!=0){
ZmApp.prototype.setOverviewPanelContent.apply(this,arguments)
}else{
ZmApp.prototype.setOverviewPanelContent.apply(this,arguments);
var t=appCtxt.getCurrentView().getController();
t.setSchedulerPanelContent()
}};
ZmCalendarApp.prototype.showMiniCalendar=function(e,t){
var a=AjxDispatcher.run("GetCalController").getMiniCalendar(t);
a.setSkipNotifyOnPage(e&&!this._active);
if(!this._active){
a.setSelectionMode(DwtCalendar.DAY)
}
appCtxt.getAppViewMgr().showTreeFooter(e)
};
ZmCalendarApp.prototype.getListController=function(){
return this.getCalController()
};
ZmCalendarApp.prototype.getCalController=function(){
if(!this._calController){
AjxDispatcher.require("CalendarCore");
this._calController=new ZmCalViewController(this._container,this)
}
return this._calController
};
ZmCalendarApp.prototype.getFreeBusyCache=function(){
if(!this._freeBusyCache){
AjxDispatcher.require("CalendarCore");
this._freeBusyCache=new ZmFreeBusyCache(this)
}
return this._freeBusyCache
};
ZmCalendarApp.prototype.getReminderController=function(){
if(!this._reminderController){
AjxDispatcher.require("CalendarCore");
var e=appCtxt.getCalManager();
this._reminderController=e.getReminderController();
this._reminderController._calController=this.getCalController()
}
return this._reminderController
};
ZmCalendarApp.prototype.getApptComposeController=function(e){
AjxDispatcher.require(["CalendarCore","Calendar","CalendarAppt"]);
return this.getSessionController(ZmId.VIEW_APPOINTMENT,"ZmApptComposeController",e)
};
ZmCalendarApp.prototype.getSimpleApptComposeController=function(){
AjxDispatcher.require(["CalendarCore","Calendar","CalendarAppt"]);
return this.getSessionController(ZmId.VIEW_SIMPLE_ADD_APPOINTMENT,"ZmSimpleApptComposeController")
};
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 e=new ZmBatchCommand();
if(!this._locations.isLoaded){
e.add(new AjxCallback(this._locations,this._locations.load))
}
if(!this._equipment.isLoaded){
e.add(new AjxCallback(this._equipment,this._equipment.load))
}
if(e._cmds.length){
e.run()
}}};
ZmCalendarApp.prototype.getLocations=function(){
this.initResources();
return this._locations
};
ZmCalendarApp.prototype.getEquipment=function(){
this.initResources();
return this._equipment
};
ZmCalendarApp.prototype.getCheckedCalendarFolderIds=function(e,a){
var s=[];
if(AjxDispatcher.loaded("CalendarCore")){
s=this.getCalController().getCheckedCalendarFolderIds(e,a)
}else{
this._folderNames={};
for(var t=0;
t<this._deferredFolders.length;
t++){
var n=this._deferredFolders[t];
var o=(n&&n.obj&&n.obj.f)?n.obj.f:"";
if(o&&(o.indexOf(ZmOrganizer.FLAG_CHECKED)!=-1)){
if(e&&n.obj.zid!=null){
continue
}
if(n.obj.id==ZmOrganizer.ID_TRASH&&!a){
continue
}
s.push(n.obj.id);
this._folderNames[n.obj.id]=n.obj.name
}}}
return s
};
ZmCalendarApp.prototype.getCalendarName=function(e){
return appCtxt.getById(e)?appCtxt.getById(e).name:this._folderNames[e]
};
ZmCalendarApp.createMiniCalButton=function(c,s,n,t){
var h=new DwtButton({
parent:c}
);
h.addDropDownSelectionListener(n);
h.addSelectionListener(n);
h.setDropDownHovImage(null);
h.setData(Dwt.KEY_ID,s);
if(AjxEnv.isIE){
h.setSize("20")
}
var r=new DwtMenu({
parent:h,style:DwtMenu.CALENDAR_PICKER_STYLE}
);
r.setSize("150");
r._table.width="100%";
h.setMenu(r,true);
var e=new DwtCalendar({
parent:r}
);
e.setData(Dwt.KEY_ID,s);
e.setSkipNotifyOnPage(true);
var o=appCtxt.get(ZmSetting.CAL_FIRST_DAY_OF_WEEK)||0;
e.setFirstDayOfWeek(o);
e.addSelectionListener(t);
var l=appCtxt.getSettings().getSetting(ZmSetting.CAL_FIRST_DAY_OF_WEEK);
if(l){
var a=new AjxListener(null,ZmCalendarApp._settingChangeListener,e);
l.addChangeListener(a)
}
h.reparentHtmlElement(s);
delete s;
return h
};
ZmCalendarApp.createReminderButton=function(c,r,u,n){
var h=new DwtButton({
parent:c}
);
h.addDropDownSelectionListener(u);
h.setData(Dwt.KEY_ID,r);
if(AjxEnv.isIE){
h.setSize("20")
}
var l=new DwtMenu({
parent:h,style:DwtMenu.DROPDOWN_STYLE}
);
l.setSize("150");
h.setMenu(l,true);
var t=[ZmMsg.apptRemindNever,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];
var m=[0,1,5,10,15,30,45,60,120,180,240,300,1080,1440,2880,4320,5760,10080,20160];
var o=[0,1,5,10,15,30,45,60,2,3,4,5,18,1,2,3,4,1,2];
var s=appCtxt.get(ZmSetting.CAL_REMINDER_WARNING_TIME);
for(var e=0;
e<m.length;
e++){
var d=ZmCalendarApp.__formatLabel(t[e],o[e]);
var a=new DwtMenuItem({
parent:l,style:DwtMenuItem.NO_STYLE}
);
a.setText(d);
a.setData("value",m[e]);
if(n){
a.addSelectionListener(n)
}}
h.reparentHtmlElement(r);
delete r;
return h
};
ZmCalendarApp.getReminderSummary=function(e){
var o=((e%60)==0);
var a=((e%(60*24))==0);
var t=((e%(60*24*7))==0);
if(e==0){
return ZmMsg.apptRemindNever
}
if(t){
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNWeeksBefore,e/(60*24*7))
}
if(a){
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNDaysBefore,e/(60*24))
}
if(o){
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNHoursBefore,e/60)
}
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNMinutesBefore,e)
};
ZmCalendarApp._settingChangeListener=function(a,t){
if(t.type!=ZmEvent.S_SETTING){
return
}
var e=t.source;
if(e.id==ZmSetting.CAL_FIRST_DAY_OF_WEEK){
a.setFirstDayOfWeek(e.getValue())
}};
ZmCalendarApp.prototype._newCalendarCallback=function(s,o,t,a,r){
var n=appCtxt.getNewCalendarDialog();
n.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.CALENDAR)._doCreate(s,o,t,a,r)
};
ZmCalendarApp.addInviteReplyMenu=function(e){
var t=[ZmOperation.EDIT_REPLY_ACCEPT,ZmOperation.EDIT_REPLY_TENTATIVE,ZmOperation.EDIT_REPLY_DECLINE];
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmCalendarApp.addCalViewMenu=function(e){
var t=[ZmOperation.DAY_VIEW,ZmOperation.WORK_WEEK_VIEW,ZmOperation.WEEK_VIEW,ZmOperation.MONTH_VIEW,ZmOperation.CAL_LIST_VIEW,ZmOperation.SCHEDULE_VIEW];
if(appCtxt.get(ZmSetting.FREE_BUSY_VIEW_ENABLED)){
t.push(ZmOperation.FB_VIEW)
}
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmCalendarApp.__formatLabel=function(t,e){
t=t||"";
return t.match(/{/)?AjxMessageFormat.format(t,e):t
};
ZmCalendarApp.parseReminderString=function(c){
var h={};
h[ZmMsg.apptRemindNDaysBefore]=ZmCalItem.REMINDER_UNIT_DAYS;
h[ZmMsg.apptRemindNMinutesBefore]=ZmCalItem.REMINDER_UNIT_MINUTES;
h[ZmMsg.apptRemindNHoursBefore]=ZmCalItem.REMINDER_UNIT_HOURS;
h[ZmMsg.apptRemindNWeeksBefore]=ZmCalItem.REMINDER_UNIT_WEEKS;
c=AjxStringUtil.trim(c);
var l=c;
var s=l.replace(/D/g,"");
s=AjxStringUtil.trim(s);
if(s==""){
return{
reminderValue:"",reminderUnits:ZmCalItem.REMINDER_NONE}
}
if(s.indexOf(" ")>=0){
s=s.split(" ")[0]
}
for(var r in h){
var e=ZmCalendarApp.__formatLabel(r,s);
if(e!=""&&e.toLowerCase()==c.toLowerCase()){
return{
reminderValue:s,reminderUnits:h[r]}
}}
var n=parseInt(s);
var a={};
a[ZmCalItem.REMINDER_UNIT_MINUTES]=AjxMsg.minute;
a[ZmCalItem.REMINDER_UNIT_HOURS]=AjxMsg.hour;
a[ZmCalItem.REMINDER_UNIT_DAYS]=AjxMsg.day;
a[ZmCalItem.REMINDER_UNIT_WEEKS]=AjxMsg.week;
var t=ZmCalItem.REMINDER_UNIT_HOURS;
for(var o in a){
if(l.indexOf(a[o])>=0){
t=o;
break
}}
return{
reminderValue:n?n:0,reminderUnits:t}
};
ZmCalendarApp.convertReminderUnits=function(e,t){
switch(t){
case ZmCalItem.REMINDER_UNIT_MINUTES:return e;
case ZmCalItem.REMINDER_UNIT_HOURS:return e*60;
case ZmCalItem.REMINDER_UNIT_DAYS:return e*60*24;
case ZmCalItem.REMINDER_UNIT_WEEKS:return e*60*24*7;
default:return 0
}};
ZmCalendarApp.prototype.updateResourceCache=function(a){
var t=a.getFullName();
if(t){
this._resByName[t.toLowerCase()]=a
}
var e=a.getEmail();
if(e){
this._resByEmail[e.toLowerCase()]=a
}};
ZmCalendarApp.prototype._addSettingsChangeListeners=function(){
ZmApp.prototype._addSettingsChangeListeners.call(this);
if(!this._settingsListener){
this._settingsListener=new AjxListener(this,this._settingsChangeListener)
}
var t=appCtxt.getSettings();
var e=t.getSetting(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL);
if(e){
e.addChangeListener(this._settingListener)
}
e=t.getSetting(ZmSetting.CAL_FIRST_DAY_OF_WEEK);
if(e){
e.addChangeListener(this._settingListener)
}
e=t.getSetting(ZmSetting.CAL_WORKING_HOURS);
if(e){
e.addChangeListener(this._settingListener)
}
var t=appCtxt.getSettings();
t.getSetting(ZmSetting.CAL_SHOW_CALENDAR_WEEK).addChangeListener(this._settingListener);
t.addChangeListener(this._settingsListener)
};
ZmCalendarApp.prototype._settingChangeListener=function(n){
if(n.type!=ZmEvent.S_SETTING){
return
}
var o=n.source;
if(o.id==ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL){
if(o.getValue()){
AjxDispatcher.run("ShowMiniCalendar",true)
}else{
if(!this._active){
AjxDispatcher.run("ShowMiniCalendar",false)
}}}else{
if(o.id==ZmSetting.CAL_FIRST_DAY_OF_WEEK){
var e=AjxDispatcher.run("GetCalController");
var s=e.getMiniCalendar();
var t=o.getValue();
s.setFirstDayOfWeek(t);
var a=s.getDate();
e.setDate(a,0,true)
}else{
if(o.id==ZmSetting.CAL_WORKING_HOURS){
var e=AjxDispatcher.run("GetCalController");
var r=e.getViewMgr();
if(r){
r.layoutWorkingHours()
}}}}};
ZmCalendarApp.prototype._settingsChangeListener=function(o){
if(o.type!=ZmEvent.S_SETTINGS){
return
}
var n=o.getDetail("settings");
if(!(n&&n.length)){
return
}
for(var t=0;
t<n.length;
t++){
var a=n[t];
if(a.id==ZmSetting.CAL_SHOW_CALENDAR_WEEK){
var e=AjxDispatcher.run("GetCalController").recreateMiniCalendar();
var s=appCtxt.getCalManager();
s.highlightMiniCal()
}}};
ZmCalendarApp.prototype.showDayView=function(a){
var t=AjxDispatcher.run("GetCalController");
var e=t.getMiniCalendar();
t.setDate(a,0,e.getForceRollOver());
if(!t._viewVisible){
t.show(ZmId.VIEW_CAL_DAY)
}};
ZmCalendarApp.prototype.getDateToolTip=function(e){
var t=AjxDispatcher.run("GetCalController");
return t.getDayToolTipText(e)
};
ZmCalendarApp.prototype.importAppointment=function(o,a,t){
var e=new AjxCallback(this,this._handleImportAppointment,[o,a,t]);
AjxDispatcher.require(["CalendarCore","Calendar"],false,e)
};
ZmCalendarApp.prototype._handleImportAppointment=function(o,a,t){
if(this._deferredFolders.length!=0){
this._createDeferredFolders(ZmApp.CALENDAR)
}
var n=this._copyToDialog=appCtxt.getChooseFolderDialog();
var e=new AjxCallback(this,this._chooserCallback,[o,a,t]);
ZmController.showDialog(n,e,this._getCopyParams(n,o,a))
};
ZmCalendarApp.prototype._getCopyParams=function(a,t,e){
return{
data:{
msgId:t,partId:e}
,treeIds:[ZmOrganizer.CALENDAR],overviewId:a.getOverviewId(this._name),title:ZmMsg.addToCalendar,description:ZmMsg.targetFolder,appName:ZmApp.CALENDAR}
};
ZmCalendarApp.prototype._chooserCallback=function(s,n,t,o){
var h={
ImportAppointmentsRequest:{
_jsns:"urn:zimbraMail"}};
var a=h.ImportAppointmentsRequest;
a.l=o.id;
a.ct="text/calendar";
var e=a.content={};
e.mid=s;
e.part=n;
var r={
jsonObj:h,asyncMode:true,callback:(new AjxCallback(this,this._handleImportApptResponse,[o.id])),errorCallback:(new AjxCallback(this,this._handleImportApptError))};
appCtxt.getAppController().sendRequest(r)
};
ZmCalendarApp.prototype._handleImportApptResponse=function(e,t){
appCtxt.getAppController().setStatusMsg(ZmMsg.addedToCalendar);
appCtxt.getChooseFolderDialog().popdown();
var a=window.parentAppCtxt||window.appCtxt;
if(a.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){
var o=a.getCalManager();
o.getMiniCalCache().clearCache();
o.highlightMiniCal()
}};
ZmCalendarApp.prototype._handleImportApptError=function(e){
appCtxt.getAppController().setStatusMsg(ZmMsg.errorImportAppt,ZmStatusView.LEVEL_CRITICAL)
}
}
if(AjxPackage.define("zimbraMail.tasks.ZmTasksApp")){
ZmTasksApp=function(e){
ZmApp.call(this,ZmApp.TASKS,e)
};
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.prototype=new ZmApp;
ZmTasksApp.prototype.constructor=ZmTasksApp;
ZmTasksApp.REMINDER_START_DELAY=10000;
ZmTasksApp.prototype.toString=function(){
return"ZmTasksApp"
};
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(e){
e=e||appCtxt.getSettings();
e.registerSetting("READING_PANE_LOCATION_TASKS",{
name:"zimbraPrefTasksReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}
)
};
ZmTasksApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.TASK,{
app:ZmApp.TASKS,nameKey:"task",countKey:"typeTask",icon:"TasksApp",soapCmd:"ItemAction",itemClass:"ZmTask",node:"task",organizer:ZmOrganizer.TASKS,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.TASKS],searchType:"task",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("TasksCore");
return new ZmList(ZmItem.TASK,e)
}
,this)}
)
};
ZmTasksApp.prototype._registerOrganizers=function(){
ZmOrganizer.registerOrg(ZmOrganizer.TASKS,{
app:ZmApp.TASKS,nameKey:"taskFolder",defaultFolder:ZmFolder.ID_TASKS,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmTaskFolder",orgPackage:"TasksCore",treeController:"ZmTaskTreeController",labelKey:"tasks",itemsKey:"tasks",folderKey:"tasksFolder",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,views:["task"],createFunc:"ZmOrganizer.create",compareFunc:"ZmTaskFolder.sortCompare",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)}
)
};
ZmTasksApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_TASK]="task";
var t={};
t[ZmOperation.NEW_TASK_FOLDER]="tasksFolder";
var e={};
e[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],assistants:{
ZmTaskAssistant:["TasksCore","Tasks"]}
,newItemOps:a,newOrgOps:t,actionCodes:e,searchTypes:[ZmItem.TASK],gotoActionCode:ZmKeyMap.GOTO_TASKS,newActionCode:ZmKeyMap.NEW_TASK,chooserSort:35,defaultSort:25}
)
};
ZmTasksApp.prototype.postNotify=function(e){
if(this._checkReplenishListView){
this._checkReplenishListView._checkReplenish();
this._checkReplenishListView=null
}};
ZmTasksApp.prototype.handleOp=function(a,t){
switch(a){
case ZmOperation.NEW_TASK:var e=new AjxCallback(this,this._handleLoadNewTask,[t]);
AjxDispatcher.require(["TasksCore","Tasks"],false,e,null,true);
break;
case ZmOperation.NEW_TASK_FOLDER:var e=new AjxCallback(this,this._handleLoadNewTaskFolder);
AjxDispatcher.require(["TasksCore","Tasks"],false,e,null,true);
break
}};
ZmTasksApp.prototype.getDefaultFolderId=function(e){
return ZmOrganizer.ID_TASKS
};
ZmTasksApp.prototype._handleLoadNewTask=function(e){
AjxDispatcher.run("GetTaskController").show((new ZmTask(null,null,e&&e.folderId)))
};
ZmTasksApp.prototype._handleLoadNewTaskFolder=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewTaskFolderDialog();
if(!this._newTaskFolderCb){
this._newTaskFolderCb=new AjxCallback(this,this._newTaskFolderCallback)
}
ZmController.showDialog(e,this._newTaskFolderCb)
};
ZmTasksApp.prototype.createNotify=function(n,r){
if(!n.folder&&!n.task&&!n.link){
return
}
if(!r&&this._deferNotifications("create",n)){
return
}
for(var e in n){
var s=n[e];
if(!s){
continue
}
for(var o=0;
o<s.length;
o++){
var a=s[o];
if(appCtxt.cacheGet(a.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(a,ZmOrganizer.TASKS)
}else{
if(e=="link"){
this._handleCreateLink(a,ZmOrganizer.TASKS)
}else{
if(e=="task"){
var t=this.getTaskListController().getList();
if(t){
t.notifyCreate(a)
}}}}}}};
ZmTasksApp.prototype.launch=function(t,a){
this._setLaunchTime(this.toString(),new Date());
var e=new AjxCallback(this,this._handleLoadLaunch,a);
AjxDispatcher.require(["TasksCore","Tasks"],true,e,null,true)
};
ZmTasksApp.prototype._handleLoadLaunch=function(t){
var e=this._getExternalAccount();
this.search(null,null,null,null,(e&&e.name));
if(t){
t.run()
}};
ZmTasksApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require("Tasks",false,e,null,true)
};
ZmTasksApp.prototype._handleLoadShowSearchResults=function(t,a){
var e=t&&t.search&&t.search.singleTerm&&t.search.folderId;
this.getTaskListController().show(t,e);
this._setLoadedTime(this.toString(),new Date());
if(a){
a.run()
}};
ZmTasksApp.prototype.getListController=function(){
return this.getTaskListController()
};
ZmTasksApp.prototype.getTaskListController=function(){
if(!this._taskListController){
this._taskListController=new ZmTaskListController(this._container,this)
}
return this._taskListController
};
ZmTasksApp.prototype.getTaskController=function(e){
return this.getSessionController(ZmId.VIEW_TASKEDIT,"ZmTaskController",e)
};
ZmTasksApp.prototype.newTaskFromMailItem=function(a,e){
var t=a.subject||"";
if(a instanceof ZmConv){
a=a.getFirstHotMsg()
}
a.load({
getHtml:false,callback:new AjxCallback(this,this._msgLoadedCallback,[a,e,t])}
)
};
ZmTasksApp.prototype._msgLoadedCallback=function(n,e,o){
var a=new ZmTask();
a.setEndDate(AjxDateUtil.roundTimeMins(e,30));
a.setFromMailMessage(n,o);
this.getTaskController().show(a,ZmCalItem.MODE_NEW,true)
};
ZmTasksApp.prototype.search=function(a,e,o,r,t){
var s={
query:(a?a.createQuery():"in:tasks"),types:[ZmItem.TASK],limit:this.getLimit(),searchFor:ZmItem.TASK,callback:r,accountName:(t||(a&&a.getAccount().name))};
var n=appCtxt.getSearchController();
n.searchAllAccounts=false;
n.search(s)
};
ZmTasksApp.prototype._newTaskFolderCallback=function(n,a,t){
var o=appCtxt.getNewTaskFolderDialog();
o.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.TASKS)._doCreate(n,a,t)
};
ZmTasksApp.prototype.getTaskFolderIds=function(e){
var o=[];
if(AjxDispatcher.loaded("TasksCore")){
o=this.getTaskListController().getTaskFolderIds(e)
}else{
this._folderNames={};
for(var t=0;
t<this._deferredFolders.length;
t++){
var a=this._deferredFolders[t];
if(e&&a.obj.zid!=null){
continue
}
o.push(a.obj.id);
this._folderNames[a.obj.id]=a.obj.name
}}
return o
};
ZmTasksApp.prototype.getTaskFolderName=function(e){
return appCtxt.getById(e)?appCtxt.getById(e).name:this._folderNames[e]
};
ZmTasksApp.prototype.getReminderController=function(){
if(!this._reminderController){
AjxDispatcher.require("TasksCore");
var e=appCtxt.getTaskManager();
this._reminderController=e.getReminderController();
this._reminderController._calController=e;
this._reminderController.refresh()
}
return this._reminderController
};
ZmTasksApp.createpCompleteButton=function(r,n,l,o){
var e=new DwtButton({
parent:r}
);
e.addDropDownSelectionListener(l);
e.setData(Dwt.KEY_ID,n);
e.setSize("25");
var s=new DwtMenu({
parent:e,style:DwtMenu.DROPDOWN_STYLE}
);
s.setSize("100");
e.setMenu(s,true);
var h=new AjxMessageFormat(AjxMsg.percentageString);
for(var t=0;
t<=100;
t+=ZmTask.PCOMPLETE_INT){
var a=new DwtMenuItem({
parent:s,style:DwtMenuItem.NO_STYLE}
);
a.setText((h.format(t)));
a.setData("value",t);
if(o){
a.addSelectionListener(o)
}}
e.reparentHtmlElement(n);
delete n;
return e
}
}
if(AjxPackage.define("zimbraMail.abook.ZmContactsApp")){
ZmContactsApp=function(t,e){
ZmApp.call(this,ZmApp.CONTACTS,t,e);
this.contactsLoaded={};
this._contactList={};
this._initialized=false;
this._byEmail={};
this._byIM={};
this._byPhone={};
this._dlCache={}
};
ZmEvent.S_CONTACT=ZmId.ITEM_CONTACT;
ZmEvent.S_GROUP=ZmId.ITEM_GROUP;
ZmItem.CONTACT=ZmEvent.S_CONTACT;
ZmItem.GROUP=ZmEvent.S_GROUP;
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_MAX=50;
ZmContactsApp.prototype=new ZmApp;
ZmContactsApp.prototype.constructor=ZmContactsApp;
ZmContactsApp.prototype.toString=function(){
return"ZmContactsApp"
};
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(e){
var e=e||appCtxt.getSettings();
e.registerSetting("AUTO_ADD_ADDRESS",{
name:"zimbraPrefAutoAddAddressEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("AUTOCOMPLETE_LIMIT",{
name:"zimbraContactAutoCompleteMaxResults",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:20}
);
e.registerSetting("AUTOCOMPLETE_NO_GROUP_MATCH",{
name:"zimbraPrefContactsDisableAutocompleteOnContactGroupMembers",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("AUTOCOMPLETE_ON_COMMA",{
name:"zimbraPrefAutoCompleteQuickCompletionOnComma",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("AUTOCOMPLETE_SHARE",{
name:"zimbraPrefShareContactsInAutoComplete",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("AUTOCOMPLETE_SHARED_ADDR_BOOKS",{
name:"zimbraPrefSharedAddrBookAutoCompleteEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("EXPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("GAL_AUTOCOMPLETE",{
name:"zimbraPrefGalAutoCompleteEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("IMPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("MAX_CONTACTS",{
name:"zimbraContactMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:0}
);
e.registerSetting("NEW_ADDR_BOOK_ENABLED",{
name:"zimbraFeatureNewAddrBookEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("PHONETIC_CONTACT_FIELDS",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:/^ja/.test(AjxEnv.DEFAULT_LOCALE)}
);
e.registerSetting("DETAILED_CONTACT_SEARCH_ENABLED",{
name:"zimbraFeatureContactsDetailedSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
)
};
ZmContactsApp.prototype._registerPrefs=function(){
var t={
CONTACTS:{
title:ZmMsg.addressBook,icon:"ContactsApp",templateId:"prefs.Pages#Contacts",priority:70,precondition:ZmSetting.CONTACTS_ENABLED,prefs:[ZmSetting.AUTO_ADD_ADDRESS,ZmSetting.AUTOCOMPLETE_NO_GROUP_MATCH,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 e in t){
ZmPref.registerPrefSection(e,t[e])
}
ZmPref.registerPref("AUTO_ADD_ADDRESS",{
displayName:ZmMsg.autoAddContacts,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("AUTOCOMPLETE_NO_GROUP_MATCH",{
displayName:ZmMsg.autocompleteNoGroupMatch,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:function(){
return appCtxt.get(ZmSetting.GAL_AUTOCOMPLETE_ENABLED)&&appCtxt.get(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._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_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"}
);
ZmOperation.registerOp(ZmId.OP_SHOW_ONLY_CONTACTS,{
textKey:"showOnlyContacts",image:"Contact"}
,ZmSetting.MIXED_VIEW_ENABLED)
};
ZmContactsApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.CONTACT,{
app:ZmApp.CONTACTS,nameKey:"contact",countKey:"typeContact",icon:"Contact",soapCmd:"ContactAction",itemClass:"ZmContact",node:"cn",organizer:ZmOrganizer.ADDRBOOK,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.ZIMLET,ZmOrganizer.ADDRBOOK],searchType:"contact",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("ContactsCore");
return new ZmContactList(e,e?e.isGalSearch||e.isGalAutocompleteSearch:null)
}
,this)}
);
ZmItem.registerItem(ZmItem.GROUP,{
nameKey:"group",countKey:"typeContactGroup",icon:"Group",soapCmd:"ContactAction"}
)
};
ZmContactsApp.prototype._registerOrganizers=function(){
var e={};
ZmOrganizer.registerOrg(ZmOrganizer.ADDRBOOK,{
app:ZmApp.CONTACTS,nameKey:"addressBook",defaultFolder:ZmOrganizer.ID_ADDRBOOK,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmAddrBook",orgPackage:"ContactsCore",treeController:"ZmAddrBookTreeController",labelKey:"addressBooks",itemsKey:"contacts",hasColor:true,defaultColor:ZmOrganizer.C_NONE,orgColor:e,treeType:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.ADDRBOOK],views:["contact"],folderKey:"addressBook",mountKey:"mountAddrBook",createFunc:"ZmOrganizer.create",compareFunc:"ZmAddrBook.sortCompare",displayOrder:100,newOp:ZmOperation.NEW_ADDRBOOK,deferrable:true}
)
};
ZmContactsApp.prototype._setupSearchToolbar=function(){
ZmSearchToolBar.addMenuItem(ZmItem.CONTACT,{
msgKey:"searchContacts",tooltipKey:"searchPersonalContacts",icon:"Contact",shareIcon:"SharedContactsFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_CONTACT)}
);
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_GAL,{
msgKey:"searchGALContacts",tooltipKey:"searchGALContacts",icon:"GAL",setting:ZmSetting.GAL_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_GAL)}
)
};
ZmContactsApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_CONTACT]="contact";
a[ZmOperation.NEW_GROUP]="group";
var t={};
t[ZmOperation.NEW_ADDRBOOK]="addressBook";
var e={};
e[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],assistants:{
ZmContactAssistant:["ContactsCore","Contacts"]}
,searchTypes:[ZmItem.CONTACT],newItemOps:a,newOrgOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_CONTACTS,newActionCode:ZmKeyMap.NEW_CONTACT,trashViewOp:ZmOperation.SHOW_ONLY_CONTACTS,chooserSort:20,defaultSort:40,upsellUrl:ZmSetting.CONTACTS_UPSELL_URL}
)
};
ZmContactsApp.prototype.createNotify=function(l,a){
if(!l.folder&&!l.cn&&!l.link){
return
}
if(!a&&!this._noDefer&&this._deferNotifications("create",l)){
return
}
for(var e in l){
var r=l[e];
if(r&&r.length){
for(var n=0;
n<r.length;
n++){
var s=r[n];
if(appCtxt.cacheGet(s.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(s,ZmOrganizer.ADDRBOOK)
}else{
if(e=="link"){
this._handleCreateLink(s,ZmOrganizer.ADDRBOOK)
}else{
if(e=="cn"){
var h=AjxDispatcher.run("GetContactListController");
var o=(h&&h.getFolderId())?h.getList():new ZmContactList(null);
if(appCtxt.multiAccounts&&o.search&&o.search.folderId!=s.l){
continue
}
o.notifyCreate(s);
var t=window.parentAppCtxt||window.appCtxt;
t.clearAutocompleteCache(ZmAutocomplete.AC_TYPE_CONTACT);
s._handled=true
}}}}}}};
ZmContactsApp.prototype.modifyNotify=function(t,e){
if(!t.cn){
return
}
if(!e&&!this._noDefer&&this._deferNotifications("modify",t)){
return
}
this._batchNotify(t.cn)
};
ZmContactsApp.prototype.postNotify=function(e){
if(this._checkReplenishListView){
this._checkReplenishListView._checkReplenish();
this._checkReplenishListView=null
}};
ZmContactsApp.prototype.handleOp=function(a,t){
switch(a){
case ZmOperation.NEW_CONTACT:case ZmOperation.NEW_GROUP:t.type=(a==ZmOperation.NEW_GROUP)?ZmItem.GROUP:null;
var e=new AjxCallback(this,this._handleLoadNewItem,[t]);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,true);
break;
case ZmOperation.NEW_ADDRBOOK:var e=new AjxCallback(this,this._handleLoadNewAddrBook,[t]);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,true);
break
}};
ZmContactsApp.prototype.getDefaultFolderId=function(e){
switch(e){
case ZmOperation.NEW_CONTACT:case ZmOperation.NEW_GROUP:return ZmOrganizer.ID_ADDRBOOK;
case ZmOperation.NEW_ADDRBOOK:return ZmOrganizer.ID_ROOT
}};
ZmContactsApp.prototype._handleLoadNewItem=function(t){
var e=new ZmContact(null,null,t.type,t.folderId);
AjxDispatcher.run("GetContactController").show(e)
};
ZmContactsApp.prototype._handleLoadNewAddrBook=function(t){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewAddrBookDialog();
if(!this._newAddrBookCb){
this._newAddrBookCb=new AjxCallback(this,this._newAddrBookCallback)
}
ZmController.showDialog(e,this._newAddrBookCb,t)
};
ZmContactsApp.prototype.activate=function(e){
ZmApp.prototype.activate.apply(this,arguments)
};
ZmContactsApp.prototype.launch=function(e,t){
this._setLaunchTime(this.toString(),new Date());
this._contactsSearch("in:contacts",t)
};
ZmContactsApp.prototype._contactsSearch=function(e,o){
var a={
searchFor:ZmId.ITEM_CONTACT,query:e,limit:this.getLimit(),types:[ZmId.ITEM_CONTACT],callback:o};
var t=appCtxt.getSearchController();
t.searchAllAccounts=false;
t.search(a)
};
ZmContactsApp.prototype.getLimit=function(t){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
};
ZmContactsApp.prototype.getInitialSearchType=function(){
var e=appCtxt.getCurrentList();
return(e&&(e instanceof ZmContactList)&&e.isGal)?ZmId.SEARCH_GAL:null
};
ZmContactsApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require("Contacts",false,e,null,true)
};
ZmContactsApp.prototype._handleLoadShowSearchResults=function(o,n){
var a=o&&o.search;
var e=a&&a.singleTerm&&a.folderId;
var t=a&&(a.contactSource==ZmId.SEARCH_GAL);
this.getContactListController().show(o,t,e);
this._setLoadedTime(this.toString(),new Date());
if(n){
n.run()
}};
ZmContactsApp.prototype.setActive=function(t){
if(t){
var e=AjxDispatcher.run("GetContactListController");
e.show()
}};
ZmContactsApp.prototype.isContactListLoaded=function(e){
var t=(e||appCtxt.getActiveAccount().id);
return(this._contactList[t]&&this._contactList[t].isLoaded)
};
ZmContactsApp.prototype.getContactByEmail=function(s,r){
if(!s){
return null
}
var n=s.toLowerCase();
var o=this._byEmail[n];
if(!o&&this._notFound(n)){
this._removeAddrFromLookupGroup(n);
if(r){
r.run(null)
}
return null
}
if(o){
this._removeAddrFromLookupGroup(n);
o=this._realizeContact(o);
o._lookupEmail=s;
if(r){
r.run(o)
}
return o
}
if(r){
var l=null,a=false,e=[];
if(this._addrLookupHash&&this._addrLookupHash[n]){
if(this._addrLookupList){
for(var t=0;
t<this._addrLookupList.length;
t++){
e.push(this._addrLookupList[t])
}
l=this._getSearchForAddresses(this._addrLookupList);
a=true;
this._addrLookupList=null
}
this._addrLookupHash[n].push(r)
}else{
l=this._getSearchForAddresses([s])
}
if(l){
var h=new AjxCallback(this,this._handleResponseSearch,[a?e:n,a,r]);
l.execute({
callback:h,noBusyOverlay:true}
)
}}};
ZmContactsApp.prototype._handleResponseSearch=function(c,n,u,m){
var e=m.getResponse();
var s=e&&e.getResults(ZmItem.CONTACT);
if(n){
var l=s.getArray();
for(var o=0;
o<l.length;
o++){
this._updateLookupCache(l[o])
}
for(var o=0;
o<c.length;
o++){
var d=c[o];
if(!this._byEmail[d]){
this._updateLookupCache(null,d)
}
var h=this._addrLookupHash[d];
if(h&&h.length){
for(var t=0;
t<h.length;
t++){
h[t].run(this._byEmail[d])
}}
this._removeAddrFromLookupGroup(d)
}}else{
var r=s?s.get(0):null;
this._updateLookupCache(r,c);
this._byEmail[c]=r;
u.run(r)
}};
ZmContactsApp.prototype.getContactsByEmails=function(t,h){
var l=[],e=null,s=null;
for(var a=0,n=t.length;
a<n;
a++){
var r=t[a];
var o=this.getContactByEmail(r.getAddress());
if(o||o===null){
l.push({
address:r,contact:o}
)
}else{
e=e||[];
s=s||[];
e.push(r);
s.push(r.getAddress())
}}
if(!h){
return l
}
if(!e){
h.run(l);
return l
}
var d=this._getSearchForAddresses(s);
var c=new AjxCallback(this,this._handleResponseSearchByEmails,[e,l,h]);
d.execute({
callback:c}
)
};
ZmContactsApp.prototype._handleResponseSearchByEmails=function(e,u,d,m){
var t=m.getResponse();
var h=t&&t.getResults(ZmItem.CONTACT);
if(!h){
d.run(u)
}
for(var s=0,n=h.size();
s<n;
s++){
var o=h.get(s);
for(var a=1;
true;
a++){
var l=ZmContact.getAttributeName(ZmContact.F_email,a);
var r=o.getAttr(l);
if(!r){
break
}
this._byEmail[r]=o
}}
for(var a=0,n=e.length;
a<n;
a++){
var c=e[a];
var o=this.getContactByEmail(c.getAddress());
u.push({
address:c,contact:o}
)
}
d.run(u)
};
ZmContactsApp.prototype._getSearchForAddresses=function(a){
var e;
if(a.length==1){
e=["to:",a[0]," not #type:group"]
}else{
e=["("];
for(var t=0,o=a.length;
t<o;
t++){
if(t>0){
e.push(" OR ")
}
e.push("to:");
e.push(a[t])
}
e.push(") not #type:group")
}
var n={
query:e.join(""),limit:a.length*2,types:AjxVector.fromArray([ZmItem.CONTACT])};
return new ZmSearch(n)
};
ZmContactsApp.prototype._notFound=function(e){
return(e===null||Boolean(this._contactList[appCtxt.getActiveAccount().id]))
};
ZmContactsApp.prototype.setAddrLookupGroup=function(t){
this._addrLookupList=[];
this._addrLookupHash={};
if(t&&t.length){
for(var e=0;
e<t.length;
e++){
if(t[e]){
var a=t[e].address||t[e];
a=(a&&AjxUtil.isString(a))?a.toLowerCase():null;
if(a&&!this._addrLookupHash[a]){
this._addrLookupList.push(a);
this._addrLookupHash[a]=[]
}}}}};
ZmContactsApp.prototype._removeAddrFromLookupGroup=function(e){
if(!(this._addrLookupList&&this._addrLookupList.length)){
return
}
AjxUtil.arrayRemove(this._addrLookupList,e);
delete this._addrLookupHash[e]
};
ZmContactsApp.prototype._updateLookupCache=function(t,n){
if(n){
this._byEmail[n]=t
}
if(t){
for(var o=1;
true;
o++){
var a=ZmContact.getAttributeName(ZmContact.F_email,o);
var e=t.getAttr(a);
if(!e){
break
}
this._byEmail[e.toLowerCase()]=t
}}};
ZmContactsApp.prototype.getContactByIMAddress=function(t){
if(!t){
return null
}
var e=this._byIM[t.toLowerCase()];
return this._realizeContact(e)
};
ZmContactsApp.prototype.getContactByPhone=function(e){
if(!e){
return null
}
var a=e.replace(/[^d]/g,"");
var t=this._phoneToContact[a];
if(t){
t.contact=this._realizeContact(t.contact)
}
return t
};
ZmContactsApp.prototype._realizeContact=function(e){
var a=appCtxt.getActiveAccount().id;
var t=this._contactList[a];
return t?t._realizeContact(e):e
};
ZmContactsApp.prototype.updateCache=function(e,t){
this._updateHash(e,t,ZmContact.EMAIL_FIELDS,this._byEmail);
if(appCtxt.get(ZmSetting.VOICE_ENABLED)){
this._updateHash(e,t,ZmContact.PHONE_FIELDS,this._byPhone,true,true)
}
if(appCtxt.get(ZmSetting.IM_ENABLED)){
this._updateHash(e,t,ZmContact.IM_FIELDS,this._byIM)
}};
ZmContactsApp.prototype._updateHash=function(h,a,s,n,t,e){
for(var r=0;
r<s.length;
r++){
var d=s[r];
for(var o=1;
true;
o++){
var c=ZmContact.getAttributeName(d,o);
var l=ZmContact.getAttr(h,c);
if(!l){
break
}
l=e?l.replace(/[^d]/g,""):l.toLowerCase();
if(a){
n[l]=t?{
contact:h,field:c}
:h
}else{
delete n[l]
}}}};
ZmContactsApp.prototype.getContactListForAllAccounts=function(){
var e=[];
var a=appCtxt.accountList.visibleAccounts;
for(var t=0;
t<a.length;
t++){
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED,null,a[t])){
e.push(a[t])
}}
if(e.length>0){
this._loadContactsForAccount(e)
}};
ZmContactsApp.prototype._loadContactsForAccount=function(e){
var a=e.shift();
if(a){
var t=new AjxCallback(this,this._loadContactsForAccount,[e]);
this.getContactList(t,null,a)
}};
ZmContactsApp.prototype.getContactList=function(r,e,n){
var a=(n&&n.id)||appCtxt.getActiveAccount().id;
if(!this._contactList[a]){
try{
if(this._parentController){
this._contactList[a]=this._parentController.getApp(ZmApp.CONTACTS).getContactList()
}else{
this._contactList[a]=new ZmContactList(null);
var s=new AjxCallback(this,this._handleResponseGetContactList,[r]);
var t=(n&&n.getEmail());
this._contactList[a].load(s,e,t)
}
return this._contactList[a]
}
catch(o){
this._contactList[a]=null;
throw o
}}else{
if(r&&r.run){
r.run(this._contactList[a])
}
return this._contactList[a]
}};
ZmContactsApp.prototype._handleResponseGetContactList=function(t){
var e=appCtxt.getActiveAccount().id;
this.contactsLoaded[e]=true;
if(t&&t.run){
t.run(this._contactList[e])
}};
ZmContactsApp.prototype.getGalContactList=function(){
if(!this._galContactList){
try{
this._galContactList=new ZmContactList(null,true);
this._galContactList.load()
}
catch(e){
this._galContactList=null;
throw e
}}
return this._galContactList
};
ZmContactsApp.prototype.createFromVCard=function(a,t){
var e=new ZmContact(null);
e.createFromVCard(a,t)
};
ZmContactsApp.prototype.getContactListController=function(){
if(!this._contactListController){
this._contactListController=new ZmContactListController(this._container,this)
}
return this._contactListController
};
ZmContactsApp.prototype.getContactController=function(){
AjxDispatcher.require(["ContactsCore","Contacts"]);
if(this._contactController==null){
this._contactController=new ZmContactController(this._container,this)
}
return this._contactController
};
ZmContactsApp.prototype._newAddrBookCallback=function(n,a,t){
var o=appCtxt.getNewAddrBookDialog();
o.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.ADDRBOOK)._doCreate(n,a,t)
};
ZmContactsApp.prototype.getDL=function(e){
return this._dlCache[e]
};
ZmContactsApp.prototype.cacheDL=function(t,e){
this._dlCache[t]=e
}
}
if(AjxPackage.define("zimbraMail.im.ZmImApp")){
ZmImApp=function(e){
ZmApp.call(this,ZmApp.IM,e);
delete ZmFolder.HIDE_ID[ZmOrganizer.ID_CHATS];
this._active=false;
ZmImApp.INSTANCE=this;
this._roster=new ZmRoster(this)
};
ZmEvent.S_CHAT=ZmId.ITEM_CHAT;
ZmEvent.S_ROSTER="ROSTER";
ZmEvent.S_ROSTER_ITEM=ZmId.ITEM_ROSTER;
ZmEvent.S_ROSTER_TREE_ITEM=ZmId.ORG_ROSTER_TREE_ITEM;
ZmEvent.S_ROSTER_TREE_GROUP=ZmId.ORG_ROSTER_TREE_GROUP;
ZmItem.CHAT=ZmEvent.S_CHAT;
ZmItem.ROSTER_ITEM=ZmEvent.S_ROSTER_ITEM;
ZmOrganizer.ROSTER_TREE_ITEM=ZmEvent.S_ROSTER_TREE_ITEM;
ZmOrganizer.ROSTER_TREE_GROUP=ZmEvent.S_ROSTER_TREE_GROUP;
ZmOrganizer.CONFERENCE_ITEM="CONFERENCE_ITEM";
ZmItem.F_PRESENCE="PRESENCE";
ZmItem.F_PRESENCE_CELL="PRESENCE_cell";
ZmApp.IM=ZmId.APP_IM;
ZmApp.CLASS[ZmApp.IM]="ZmImApp";
ZmApp.SETTING[ZmApp.IM]=ZmSetting.IM_ENABLED;
ZmApp.LOAD_SORT[ZmApp.IM]=47;
ZmApp.QS_ARG[ZmApp.IM]="chat";
ZmImApp.BUDDY_SORT_PRESENCE="presence";
ZmImApp.BUDDY_SORT_NAME="name";
ZmImApp.prototype=new ZmApp;
ZmImApp.prototype.constructor=ZmImApp;
ZmImApp.loggedIn=function(){
return ZmImApp.INSTANCE&&ZmImApp.INSTANCE._serviceController&&ZmImApp.INSTANCE._serviceController.service.isLoggedIn()&&(appCtxt.get(ZmSetting.IM_PREF_AUTO_LOGIN)||ZmImApp.INSTANCE._roster)
};
ZmImApp.prototype.toString=function(){
return"ZmImApp"
};
ZmImApp.prototype._defineAPI=function(){
AjxDispatcher.registerMethod("GetRoster","IMCore",new AjxCallback(this,this.getRoster))
};
ZmImApp.prototype._registerOrganizers=function(){
ZmOrganizer.registerOrg(ZmOrganizer.CONFERENCE_ITEM,{
app:ZmApp.IM,nameKey:"imConference",defaultFolder:ZmOrganizer.ID_INBOX,orgPackage:"IM",treeController:"ZmConferenceTreeController",labelKey:"imConferences",itemsKey:"messages",hasColor:false,treeType:ZmOrganizer.CONFERENCE_ITEM,compareFunc:"ZmConferenceService.sortCompare",displayOrder:900}
)
};
ZmImApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_IM_NEW_CHAT,{
textKey:"imNewChat",image:"ImFree2Chat",shortcut:ZmKeyMap.NEW_CHAT}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_AWAY,{
textKey:"imStatusAway",image:"ImAway"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_CHAT,{
textKey:"imStatusChat",image:"ImFree2Chat"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_DND,{
textKey:"imStatusDND",image:"ImDnd"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_INVISIBLE,{
textKey:"imStatusInvisible",image:"ImInvisible"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_MENU,{
textKey:"imPresence"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_OFFLINE,{
textKey:"imStatusOffline",image:"Offline"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_ONLINE,{
textKey:"imStatusOnline",image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_XA,{
textKey:"imStatusExtAway",image:"ImExtendedAway"}
);
ZmOperation.registerOp(ZmId.OP_IM_LOGOUT_YAHOO,{
textKey:"imLogoutYahoo",image:"Logoff"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_CUSTOM_MRU,{
image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_MENU,{
image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_NEW_ROSTER_GROUP,{
textKey:"imNewGroup",image:"ImGroup"}
);
ZmOperation.registerOp(ZmId.OP_NEW_ROSTER_ITEM,{
textKey:"newRosterItem",image:"AddBuddy",tooltipKey:"imNewBuddyTooltip"}
);
ZmOperation.registerOp(ZmId.OP_IM_CREATE_CONTACT,{
textKey:"addToNewContact",image:"NewContact"}
);
ZmOperation.registerOp(ZmId.OP_IM_ADD_TO_CONTACT,{
textKey:"addToExistingContact",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_IM_EDIT_CONTACT,{
textKey:"editContact",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_IM_TOGGLE_OFFLINE,{
textKey:"imToggleOffline"}
);
ZmOperation.registerOp(ZmId.OP_IM_TOGGLE_BLOCKED,{
textKey:"imToggleBlocked"}
);
ZmOperation.registerOp(ZmId.OP_IM_SORT_BY_PRESENCE,{
textKey:"imSortListByPresence"}
);
ZmOperation.registerOp(ZmId.OP_IM_SORT_BY_NAME,{
textKey:"imSortListByName"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_CUSTOM_MSG,{
textKey:"imCustomStatusMsg",image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_IM_BLOCK_BUDDY,{
textKey:"imBlock",image:"BlockUser"}
);
ZmOperation.registerOp(ZmId.OP_IM_UNBLOCK_BUDDY,{
textKey:"imUnblock",image:"AllowUser"}
);
ZmOperation.registerOp(ZmId.OP_IM_HTML,{
image:"TextFormat",tooltipKey:"changeEditorMode"}
);
ZmOperation.registerOp(ZmId.OP_IM_DELETE_GROUP,{
image:"Delete",textKey:"del"}
);
ZmOperation.registerOp(ZmId.OP_IM_CLOSE_ALL_CHATS,{
textKey:"imCloseAllChats"}
);
ZmOperation.registerOp(ZmId.OP_IM_CLOSE_OTHER_CHATS,{
textKey:"imCloseOtherChats"}
);
ZmOperation.registerOp(ZmId.OP_IM_CLOSE_CHAT,{
textKey:"imCloseChat"}
);
ZmOperation.registerOp(ZmId.OP_IM_BUDDY_ARCHIVE,{
textKey:"imBuddyArchive",image:"ChatFolder"}
);
ZmOperation.registerOp(ZmId.OP_IM_BUDDY_LIST,{
textKey:"buddyList",image:"ImGroup"}
);
ZmOperation.registerOp(ZmId.OP_IM_INVITE,{
textKey:"imInvitation",image:"AllowUser"}
)
};
ZmImApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.CHAT,{
app:ZmApp.IM,nameKey:"chat",icon:"ImStartChat",soapCmd:"ItemAction",itemClass:"ZmChat",node:"chat",organizer:ZmOrganizer.ROSTER,searchType:"chat"}
)
};
ZmImApp.prototype._registerApp=function(){
var t={};
t[ZmOperation.IM_NEW_CHAT]="chat";
var e={};
e[ZmKeyMap.NEW_CHAT]=ZmOperation.IM_NEW_CHAT;
e[ZmKeyMap.NEW_ROSTER_ITEM]=ZmOperation.NEW_ROSTER_ITEM;
e[ZmKeyMap.PRESENCE_MENU]=ZmOperation.IM_PRESENCE_MENU;
ZmApp.registerApp(ZmApp.IM,{
mainPkg:"IM",defaultSort:50,newItemOps:t,actionCodes:e}
)
};
ZmImApp.prototype._registerSettings=function(e){
e=e||appCtxt.getSettings();
e.registerSetting("IM_PREF_NOTIFY_SOUNDS",{
name:"zimbraPrefIMSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_FLASH_BROWSER",{
name:"zimbraPrefIMFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_DESKTOP_ALERT",{
name:"zimbraPrefIMToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_INSTANT_NOTIFY",{
name:"zimbraPrefIMInstantNotify",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_AUTO_LOGIN",{
name:"zimbraPrefIMAutoLogin",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("IM_PREF_NOTIFY_PRESENCE",{
name:"zimbraPrefIMNotifyPresence",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_NOTIFY_STATUS",{
name:"zimbraPrefIMNotifyStatus",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_LOGCHATS_ENABLED",{
name:"zimbraPrefIMLogChats",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_REPORT_IDLE",{
name:"zimbraPrefIMReportIdle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_IDLE_TIMEOUT",{
name:"zimbraPrefIMIdleTimeout",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:10}
);
e.registerSetting("IM_PREF_IDLE_STATUS",{
name:"zimbraPrefIMIdleStatus",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"xa"}
);
e.registerSetting("IM_CUSTOM_STATUS_MRU",{
name:"zimbraPrefIMCustomStatusMessage",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("IM_PREF_BUDDY_SORT",{
name:"zimbraPrefIMBuddyListSort",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmImApp.BUDDY_SORT_NAME,isImplicit:true}
);
e.registerSetting("IM_PREF_HIDE_OFFLINE",{
name:"zimbraPrefIMHideOfflineBuddies",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}
);
e.registerSetting("IM_PREF_HIDE_BLOCKED",{
name:"zimbraPrefIMHideBlockedBuddies",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}
);
e.registerSetting("IM_YAHOO_ID",{
name:"zimbraPrefIMYahooId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}
);
var t=new AjxListener(this,this._onSettingChange);
e.getSetting(ZmSetting.IM_PREF_INSTANT_NOTIFY).addChangeListener(t);
e.getSetting(ZmSetting.IM_PREF_REPORT_IDLE).addChangeListener(t);
e.getSetting(ZmSetting.IM_PREF_IDLE_TIMEOUT).addChangeListener(t)
};
ZmImApp.prototype._registerPrefs=function(){
var t={
IM:{
title:ZmMsg.im,icon:"ImStartChat",templateId:"prefs.Pages#IM",priority:90,precondition:ZmSetting.IM_ENABLED,prefs:[ZmSetting.IM_PREF_INSTANT_NOTIFY,ZmSetting.IM_PREF_AUTO_LOGIN,ZmSetting.IM_PREF_FLASH_BROWSER,ZmSetting.IM_PREF_DESKTOP_ALERT,ZmSetting.IM_PREF_NOTIFY_PRESENCE,ZmSetting.IM_PREF_NOTIFY_STATUS,ZmSetting.IM_PREF_LOGCHATS_ENABLED,ZmSetting.IM_PREF_REPORT_IDLE,ZmSetting.IM_PREF_IDLE_TIMEOUT,ZmSetting.IM_PREF_IDLE_STATUS,ZmSetting.IM_PREF_NOTIFY_SOUNDS]}};
for(var e in t){
ZmPref.registerPrefSection(e,t[e])
}
ZmPref.registerPref("IM_PREF_NOTIFY_SOUNDS",{
displayName:ZmMsg.playSound,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_INSTANT_NOTIFY",{
displayName:ZmMsg.imPrefInstantNotify,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:function(){
return appCtxt.get(ZmSetting.INSTANT_NOTIFY)&&ZmImApp.INSTANCE.getServiceController().capabilities[ZmImServiceController.INSTANT_NOTIFY]
}}
);
ZmPref.registerPref("IM_PREF_AUTO_LOGIN",{
displayName:ZmMsg.imPrefAutoLogin,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:function(){
return ZmImApp.INSTANCE.getServiceController().capabilities[ZmImServiceController.AUTO_LOGIN_PREF]
}}
);
ZmPref.registerPref("IM_PREF_FLASH_BROWSER",{
displayName:ZmMsg.flashBrowser,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_DESKTOP_ALERT",{
displayName:ZmMsg.showPopupBrowserPlus,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_NOTIFY_PRESENCE",{
displayName:ZmMsg.imPrefNotifyPresence,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_NOTIFY_STATUS",{
displayName:ZmMsg.imPrefNotifyStatus,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_LOGCHATS_ENABLED",{
displayName:ZmMsg.imPrefLogChats,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_REPORT_IDLE",{
displayName:ZmMsg.imPrefReportIdle,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_IDLE_TIMEOUT",{
displayName:ZmMsg.imPrefIdleTimeout,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes],options:[1,5,10,20,30,60],precondition:ZmSetting.IM_PREF_REPORT_IDLE}
);
ZmPref.registerPref("IM_PREF_IDLE_STATUS",{
displayName:ZmMsg.imPrefIdleStatus,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.imStatusAway,ZmMsg.imStatusExtAway,ZmMsg.imStatusOffline],options:["away","xa","offline"],precondition:ZmSetting.IM_PREF_REPORT_IDLE}
)
};
ZmImApp.prototype._onSettingChange=function(e){
if(e.type!=ZmEvent.S_SETTING){
return
}
var a=e.source.id;
var t=appCtxt.get(a);
if(a==ZmSetting.IM_PREF_INSTANT_NOTIFY&&appCtxt.get(ZmSetting.INSTANT_NOTIFY)){
appCtxt.getAppController().setInstantNotify(t)
}else{
if(this._roster&&a==ZmSetting.IM_PREF_REPORT_IDLE){
if(!t){
this._roster._idleTimer.kill()
}else{
this._roster._idleTimer.resurrect(appCtxt.get(ZmSetting.IM_PREF_IDLE_TIMEOUT))
}}else{
if(this._roster&&a==ZmSetting.IM_PREF_IDLE_TIMEOUT){
this._roster._idleTimer.timeout=parseInt(t)*60*1000
}}}};
ZmImApp.prototype.refresh=function(){
delete this._lastSeq;
if(this._serviceController&&this._serviceController.service.isLoggedIn()){
this._roster.refresh()
}};
ZmImApp.prototype.handleOp=function(e){
switch(e){
case ZmOperation.IM_NEW_CHAT:this.prepareVisuals();
this.getImController()._imNewChatListener();
break;
case ZmOperation.NEW_ROSTER_ITEM:this.prepareVisuals();
this.getImController()._newRosterItemListener();
break;
case ZmOperation.IM_PRESENCE_MENU:if(this._presenceButton){
this._presenceButton.popup()
}
break
}};
ZmImApp.prototype.postNotify=function(e){
if(e.im){
if(!this._lastSeq||(e.seq>this._lastSeq)){
this._lastSeq=e.seq;
AjxDispatcher.run("GetRoster").pushNotification(e.im)
}}};
ZmImApp.prototype.addComponents=function(e){
this._taskbarController=new ZmTaskbarController(e)
};
ZmImApp.prototype.startup=function(){
if(appCtxt.get(ZmSetting.IM_PREF_AUTO_LOGIN)){
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._autoLogin),1000)
}};
ZmImApp.prototype.login=function(e){
this.getServiceController().login(e)
};
ZmImApp.prototype._autoLogin=function(){
var e=new AjxCallback(this,this._postLoadAutoLogin);
AjxDispatcher.require(["IMCore"],true,e)
};
ZmImApp.prototype._postLoadAutoLogin=function(){
this.login({
auto:true}
)
};
ZmImApp.prototype.getImController=function(){
if(!this._imController){
AjxDispatcher.require(["IMCore","IM"]);
this._imController=new ZmImController()
}
return this._imController
};
ZmImApp.prototype.isActive=function(){
return this._active
};
ZmImApp.prototype.getRoster=function(){
return this._roster
};
ZmImApp.prototype.hasRoster=function(){
return !!this._roster
};
ZmImApp.prototype.getServiceController=function(){
if(!window.ZmImServiceController||!this._serviceController){
AjxDispatcher.require(["IMCore"]);
var e=this.getRoster();
this._serviceController=new ZmZimbraImServiceController(e)
}
return this._serviceController
};
ZmImApp.prototype.getService=function(){
return this.getServiceController().service
};
ZmImApp.prototype.getAutoCompleteGroups=function(){
return new ZmRosterTreeGroups(this.getRoster())
};
ZmImApp.prototype.prepareVisuals=function(){
AjxDispatcher.require(["IMCore","IM"])
};
ZmImApp._NEW_IM="NEW_IM";
ZmImApp._NEW_BUDDY_FROM_IM_ADDRESS="NEW_BUDDY_FROM_IM_ADDRESS";
ZmImApp._NEW_BUDDY="NEW_BUDDY";
ZmImApp.updateImMenuItemByContact=function(s,e,t){
var n=ZmImApp._updateImMenuItemByLogin(s);
if(n){
return
}
var o=e.getBuddy();
if(o){
ZmImApp._updateImMenuItemByBuddy(s,o);
return
}
var r=e.getIMAddress();
if(r){
s.setText(ZmImApp._getNewBuddyText(e.getFullName()));
s.setImage("NewContact");
s._imData={
op:ZmImApp._NEW_BUDDY_FROM_IM_ADDRESS,contact:e,imAddress:r};
return
}
var a=t&&t.getName()?t.getName():e.getFullName();
s.setText(ZmImApp._getNewBuddyText(a));
s.setImage("NewContact");
s._imData={
op:ZmImApp._NEW_BUDDY,address:t,name:a}
};
ZmImApp.updateImMenuItemByAddress=function(n,e,a,h){
var o=ZmImApp._updateImMenuItemByLogin(n);
if(o){
if(h){
h.run()
}
return
}
var t=AjxDispatcher.run("GetRoster").getRosterItem(e.getAddress());
if(t){
ZmImApp._updateImMenuItemByBuddy(n,t);
if(h){
h.run()
}
return
}
var r=appCtxt.getApp(ZmApp.CONTACTS);
if(r){
if(h){
var s=new AjxCallback(null,ZmImApp.handleResponseGetContact,[n,e,a,h]);
r.getContactByEmail(e.getAddress(),s)
}
return true
}else{
ZmImApp.handleResponseGetContact(n,e,a)
}};
ZmImApp.handleResponseGetContact=function(o,t,a,n,e){
if(e){
ZmImApp.updateImMenuItemByContact(o,e,t)
}else{
if(a){
o.setText(ZmImApp._getNewBuddyText(t.getName()||t.getAddress()));
o.setImage("NewContact");
o._imData={
op:ZmImApp._NEW_BUDDY,address:t,name:t.getName()}
}}
if(n){
n.run()
}};
ZmImApp.getImMenuItemListener=function(){
ZmImApp._imMenuItemListenerObj=ZmImApp._imMenuItemListenerObj||new AjxListener(null,ZmImApp._imMenuItemListener);
return ZmImApp._imMenuItemListenerObj
};
ZmImApp._updateImMenuItemByBuddy=function(t,e){
ZmImApp._newChatFormat=ZmImApp._newChatFormat||new AjxMessageFormat(ZmMsg.imNewChatName);
t.setText(ZmImApp._newChatFormat.format(e.getDisplayName()));
t.setImage(e.getPresence().getIcon());
t._imData={
op:ZmImApp._NEW_IM,buddy:e}
};
ZmImApp._updateImMenuItemByLogin=function(e){
if(!ZmImApp.loggedIn()){
e.setText(ZmMsg.newIM);
e.setImage("ImStartChat");
e.setEnabled(false);
e._imData=null;
return true
}
e.setEnabled(true);
return false
};
ZmImApp._getNewBuddyText=function(e){
ZmImApp._newBuddyFormat=ZmImApp._newBuddyFormat||new AjxMessageFormat(ZmMsg.imNewBuddy);
return ZmImApp._newBuddyFormat.format(e)
};
ZmImApp._imMenuItemListener=function(t){
ZmImApp.INSTANCE.prepareVisuals();
var e=t.dwtObj._imData;
if(e){
switch(e.op){
case ZmImApp._NEW_IM:ZmTaskbarController.INSTANCE.chatWithRosterItem(e.buddy);
break;
case ZmImApp._NEW_BUDDY_FROM_IM_ADDRESS:var o=ZmImAddress.parse(e.imAddress);
var a=o?{
address:o.screenName,name:e.contact.getFullName(),service:o.service}
:{};
ZmImApp.INSTANCE.getImController()._newRosterItemListener(a);
break;
case ZmImApp._NEW_BUDDY:a={
address:e.address?e.address.getAddress():null,name:e.name};
ZmImApp.INSTANCE.getImController()._newRosterItemListener(a);
break
}}}
}
if(AjxPackage.define("zimbraMail.notebook.ZmNotebookApp")){
ZmNotebookApp=function(t,e){
ZmApp.call(this,ZmApp.NOTEBOOK,t,e)
};
ZmEvent.S_PAGE=ZmId.ITEM_PAGE;
ZmEvent.S_DOCUMENT=ZmId.ITEM_DOCUMENT;
ZmEvent.S_NOTEBOOK=ZmId.ORG_NOTEBOOK;
ZmItem.PAGE=ZmEvent.S_PAGE;
ZmItem.DOCUMENT=ZmEvent.S_DOCUMENT;
ZmOrganizer.NOTEBOOK=ZmEvent.S_NOTEBOOK;
ZmApp.NOTEBOOK=ZmId.APP_NOTEBOOK;
ZmApp.CLASS[ZmApp.NOTEBOOK]="ZmNotebookApp";
ZmApp.SETTING[ZmApp.NOTEBOOK]=ZmSetting.NOTEBOOK_ENABLED;
ZmApp.LOAD_SORT[ZmApp.NOTEBOOK]=60;
ZmApp.QS_ARG[ZmApp.NOTEBOOK]="documents";
ZmNotebookApp.prototype=new ZmApp;
ZmNotebookApp.prototype.constructor=ZmNotebookApp;
ZmNotebookApp.prototype.toString=function(){
return"ZmNotebookApp"
};
ZmNotebookApp.prototype._notebookCache;
ZmNotebookApp.prototype._defineAPI=function(){
AjxDispatcher.setPackageLoadFunction("NotebookCore",new AjxCallback(this,this._postLoadCore));
AjxDispatcher.setPackageLoadFunction("Notebook",new AjxCallback(this,this._postLoad,ZmOrganizer.NOTEBOOK));
AjxDispatcher.registerMethod("GetNotebookController",["NotebookCore","Notebook"],new AjxCallback(this,this.getNotebookController));
AjxDispatcher.registerMethod("GetPageEditController",["NotebookCore","Notebook"],new AjxCallback(this,this.getPageEditController));
AjxDispatcher.registerMethod("GetNotebookCache",["NotebookCore","Notebook"],new AjxCallback(this,this.getNotebookCache));
AjxDispatcher.registerMethod("GetPageVersionController",["NotebookCore","Notebook"],new AjxCallback(this,this.getPageVersionController));
AjxDispatcher.registerMethod("GetNotebookFileController",["NotebookCore","Notebook"],new AjxCallback(this,this.getFileController))
};
ZmNotebookApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_CHROME,{
textKey:"editNotebookChrome",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_INDEX,{
textKey:"editNotebookIndex",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_HEADER,{
textKey:"editNotebookHeader",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_FOOTER,{
textKey:"editNotebookFooter",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_SIDE_BAR,{
textKey:"editNotebookSideBar",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_CHROME,{
textKey:"editNotebookChrome",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_FORMAT_HTML_SOURCE,{
textKey:"formatHtmlSource"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_FORMAT_MEDIA_WIKI,{
textKey:"formatMediaWiki"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_FORMAT_RICH_TEXT,{
textKey:"formatRichText"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_FORMAT_TWIKI,{
textKey:"formatTWiki"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_MOUNT_NOTEBOOK,{
textKey:"mountNotebook",image:"Notebook"}
,ZmSetting.SHARING_ENABLED);
ZmOperation.registerOp(ZmId.OP_NEW_NOTEBOOK,{
textKey:"newNotebook",image:"NewNotebook",tooltipKey:"newNotebookTooltip",shortcut:ZmKeyMap.NEW_NOTEBOOK}
);
ZmOperation.registerOp(ZmId.OP_NEW_PAGE,{
textKey:"newPage",tooltipKey:"createNewPage",image:"NewPage"}
);
ZmOperation.registerOp(ZmId.OP_IMPORT_FILE,{
textKey:"_import",tooltipKey:"importDocs"}
);
ZmOperation.registerOp(ZmId.OP_SEND_PAGE,{
textKey:"send",tooltipKey:"sendPageTT",image:"Send"}
,ZmSetting.MAIL_ENABLED);
ZmOperation.registerOp(ZmId.OP_REFRESH,{
textKey:"refresh",tooltipKey:"refreshTooltip",image:"Refresh"}
);
ZmOperation.registerOp(ZmId.OP_SHARE_NOTEBOOK,{
textKey:"shareNotebook",image:"Notebook"}
,ZmSetting.SHARING_ENABLED);
ZmOperation.registerOp(ZmId.OP_REVERT_PAGE,{
textKey:"revert",tooltipKey:"restorePage",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_BROWSE_FOLDER,{
textKey:"browse",image:"Browse"}
)
};
ZmNotebookApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.PAGE,{
app:ZmApp.NOTEBOOK,nameKey:"page",icon:"Page",soapCmd:"ItemAction",itemClass:"ZmPage",node:"w",organizer:ZmOrganizer.NOTEBOOK,dropTargets:[ZmOrganizer.TAG],searchType:"wiki",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("NotebookCore");
return new ZmPageList(e)
}
,this)}
);
ZmItem.registerItem(ZmItem.DOCUMENT,{
app:ZmApp.NOTEBOOK,nameKey:"document",countKey:"typeDocument",icon:"GenericDoc",soapCmd:"ItemAction",itemClass:"ZmDocument",node:"doc",organizer:ZmOrganizer.NOTEBOOK,dropTargets:[ZmOrganizer.TAG],searchType:"document",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("NotebookCore");
return new ZmPageList(e,ZmItem.DOCUMENT)
}
,this)}
)
};
ZmNotebookApp.prototype._registerOrganizers=function(){
ZmOrganizer.registerOrg(ZmOrganizer.NOTEBOOK,{
app:ZmApp.NOTEBOOK,nameKey:"notebook",defaultFolder:ZmOrganizer.ID_NOTEBOOK,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmNotebook",orgPackage:"NotebookCore",treeController:"ZmNotebookTreeController",labelKey:"notebooks",itemsKey:"documents",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,views:["wiki"],folderKey:"notebook",mountKey:"mountNotebook",createFunc:"ZmOrganizer.create",compareFunc:"ZmNotebook.sortCompare",newOp:ZmOperation.NEW_NOTEBOOK,displayOrder:100,deferrable:true}
)
};
ZmNotebookApp.prototype._setupSearchToolbar=function(){
ZmSearchToolBar.addMenuItem(ZmItem.PAGE,{
msgKey:"searchNotebooks",tooltipKey:"searchForPages",icon:"Notebook",shareIcon:"SharedNotebook",setting:ZmSetting.NOTEBOOK_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_PAGE)}
)
};
ZmNotebookApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_PAGE]="page";
var t={};
t[ZmOperation.NEW_NOTEBOOK]="notebook";
var e={};
e[ZmKeyMap.NEW_PAGE]=ZmOperation.NEW_PAGE;
e[ZmKeyMap.NEW_NOTEBOOK]=ZmOperation.NEW_NOTEBOOK;
ZmApp.registerApp(ZmApp.NOTEBOOK,{
mainPkg:"Notebook",nameKey:"documents",icon:"NoteApp",textPrecedence:10,chooserTooltipKey:"goToDocuments",defaultSearch:ZmItem.PAGE,organizer:ZmOrganizer.NOTEBOOK,overviewTrees:[ZmOrganizer.NOTEBOOK,ZmOrganizer.TAG],searchTypes:[ZmItem.PAGE,ZmItem.DOCUMENT],newItemOps:a,newOrgOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_NOTEBOOK,newActionCode:ZmKeyMap.NEW_PAGE,chooserSort:50,defaultSort:30}
)
};
ZmNotebookApp.prototype.deleteNotify=function(t,s){
if(!s&&this._deferNotifications("delete",t)){
return
}
var p=null;
var f=t.join(",")+",";
var y=false;
var n=AjxDispatcher.run("GetNotebookController");
var c=n.getPage();
var a=appCtxt.getOverviewController();
var h=a.getTreeController(ZmOrganizer.NOTEBOOK);
var r=h.getTreeView(this.getOverviewId());
if(!r){
return
}
var e=this.getNotebookCache();
for(var m=0;
m<t.length;
m++){
var u=r.getNextData(t[m]);
if(u&&f.indexOf(u.id+",")<0){
p=u
}
if(c&&c.id==t[m]){
y=true
}}
for(var m=0;
m<t.length;
m++){
var g=e.getPageById(t[m]);
if(g){
e.removePage(g);
g.notifyDelete()
}
var o=appCtxt.getById(t[m]);
if(o&&(o instanceof ZmNotebook)){
e.removeItem(o);
o.notifyDelete()
}
appCtxt.cacheRemove(t[m])
}
if(y){
var d={
folderId:(p?p.id:c.folderId),name:ZmNotebook.PAGE_INDEX};
n.gotoPage(d)
}
for(var m=0;
m<t.length;
m++){
var l=r.getTreeItemById(t[m]);
if(l){
l.dispose()
}
t[m]=null
}};
ZmNotebookApp.prototype.createNotify=function(c,o){
if(!c.folder&&!c.w&&!c.doc&&!c.link){
return
}
if(!o&&!this._noDefer&&this._deferNotifications("create",c)){
return
}
for(var t in c){
var h=c[t];
for(var s=0;
s<h.length;
s++){
var r=h[s];
if(appCtxt.cacheGet(r.id)){
continue
}
if(t=="folder"){
this._handleCreateFolder(r,ZmOrganizer.NOTEBOOK)
}else{
if(t=="link"){
this._handleCreateLink(r,ZmOrganizer.NOTEBOOK)
}else{
if(t=="w"){
var e=this.getNotebookCache();
var l=new ZmPage();
l.set(r);
e.putPage(l);
var a=AjxDispatcher.run("GetNotebookController");
if(!a.isIframeEnabled()){
var n=a.getPage();
if(n&&n.name==ZmNotebook.PAGE_INDEX){
a.gotoPage(n)
}}}else{
if(t=="doc"){
var e=this.getNotebookCache();
var d=new ZmDocument();
d.set(r);
e.putDocument(d)
}}}}}}};
ZmNotebookApp.prototype.modifyNotify=function(s,n){
if(!s){
return
}
if(!s.w&&!s.doc){
return
}
if(!n&&!this._noDefer&&this._deferNotifications("modify",l)){
return
}
for(var t in s){
var l=s[t];
for(var h=0;
h<l.length;
h++){
var d=l[h];
var o=d.id;
if(!o){
continue
}
if(t=="w"){
var e=this.getNotebookCache();
var c=e.getPageById(o);
if(!c){
c=new ZmPage();
c.set(d);
e.putPage(c)
}else{
c.notifyModify(d);
c.set(d)
}
var a=AjxDispatcher.run("GetNotebookController");
if(!a.isIframeEnabled()){
var r=a.getPage();
if(r&&r.folderId==c.folderId){
if(r.name==ZmNotebook.PAGE_INDEX||r.name==c.name){
a.gotoPage(r)
}}}
d._handled=true
}else{
if(t=="doc"){
var e=this.getNotebookCache();
var u=e.getDocumentById(o);
if(!u){
u=new ZmDocument();
u.set(d);
e.putDocument(u)
}else{
u.notifyModify(d);
u.set(d)
}}}}}};
ZmNotebookApp.prototype.handleOp=function(t){
switch(t){
case ZmOperation.NEW_PAGE:var e=new AjxCallback(this,this._handleLoadNewPage);
AjxDispatcher.require(["NotebookCore","Notebook"],false,e,null,true);
break;
case ZmOperation.NEW_NOTEBOOK:var e=new AjxCallback(this,this._handleLoadNewNotebook);
AjxDispatcher.require(["NotebookCore","Notebook"],false,e,null,true);
break
}};
ZmNotebookApp.prototype._handleLoadNewPage=function(){
var e=appCtxt.getOverviewController();
var n=e.getTreeController(ZmOrganizer.NOTEBOOK);
var t=n.getTreeView(this.getOverviewId());
var o=t?t.getSelected():null;
var a=new ZmPage();
a.folderId=o?o.id:ZmNotebookItem.DEFAULT_FOLDER;
a.name=this.generateUniqueName(a.folderId);
AjxDispatcher.run("GetPageEditController").show(a)
};
ZmNotebookApp.prototype._handleLoadNewNotebook=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewNotebookDialog();
if(!this._newNotebookCb){
this._newNotebookCb=new AjxCallback(this,this._newNotebookCallback)
}
ZmController.showDialog(e,this._newNotebookCb)
};
ZmNotebookApp.prototype.launch=function(t,a){
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require(["NotebookCore","Notebook"],true,e,null,true)
};
ZmNotebookApp.prototype._handleLoadLaunch=function(t){
var e=this.getNotebookController();
e.show(null,true);
if(t){
t.run()
}};
ZmNotebookApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require(["NotebookCore","Notebook"],false,e,null,true)
};
ZmNotebookApp.prototype._handleLoadShowSearchResults=function(e,t){
this.getFileController().show(e,true);
if(t){
t.run()
}};
ZmNotebookApp.prototype.setActive=function(e){};
ZmNotebookApp.prototype.getNotebookController=function(){
if(!this._notebookController){
this._notebookController=new ZmNotebookPageController(this._container,this)
}
return this._notebookController
};
ZmNotebookApp.prototype.getPageEditController=function(){
if(!this._pageController){
this._pageController=new ZmPageEditController(this._container,this)
}
return this._pageController
};
ZmNotebookApp.prototype.getFileController=function(){
if(!this._fileController){
this._fileController=new ZmNotebookFileController(this._container,this)
}
return this._fileController
};
ZmNotebookApp.prototype.getNotebookCache=function(){
if(!this._notebookCache){
this._notebookCache=new ZmNotebookCache()
}
return this._notebookCache
};
ZmNotebookApp.prototype._newNotebookCallback=function(n,a,t){
var o=appCtxt.getNewNotebookDialog();
o.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.NOTEBOOK)._doCreate(n,a,t)
};
ZmNotebookApp.prototype.generateUniqueName=function(a){
var t=this.getNotebookCache().getPagesInFolder(a);
var s=[];
for(var n in t){
s.push(t[n].name.toLowerCase())
}
s="/"+s.join("/")+"/";
var e=ZmMsg.defaultPageName.toLowerCase();
for(var o=1;
o<100;
o++){
if(s.indexOf(["/",e,o,"/"].join(""))==-1){
return(ZmMsg.defaultPageName+o)
}}
return ZmMsg.untitled
};
ZmNotebookApp.prototype.getPageVersionController=function(){
if(!this._versionController){
this._versionController=new ZmPageVersionController(this._container,this)
}
return this._versionController
}
}
if(AjxPackage.define("zimbraMail.briefcase.ZmBriefcaseApp")){
ZmBriefcaseApp=function(t,e){
ZmApp.call(this,ZmApp.BRIEFCASE,t,e)
};
ZmBriefcaseApp.prototype=new ZmApp;
ZmBriefcaseApp.prototype.constructor=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.toString=function(){
return"ZmBriefcaseApp"
};
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",image:"Upload",textPrecedence:70}
);
ZmOperation.registerOp(ZmId.OP_NEW_PRESENTATION,{
textKey:"newPresentationBeta",tooltipKey:"newPresentation",image:"Presentation",textPrecedence:10}
);
ZmOperation.registerOp(ZmId.OP_NEW_SPREADSHEET,{
textKey:"newSpreadSheetBeta",tooltipKey:"newSpreadSheet",image:"ZSpreadSheet",textPrecedence:11}
);
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:"NewPage"}
);
ZmOperation.registerOp(ZmId.OP_SAVE_FILE,{
textKey:"saveFile",tooltipKey:"saveFileTooltip",image:"DownArrow"}
);
ZmOperation.registerOp(ZmId.OP_NEW_BRIEFCASE_WIN,{
tooltipKey:"detach",image:"OpenInNewWindow"}
);
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_CREATE_SLIDE_SHOW,{
textKey:"createSlideShow",image:"Presentation"}
);
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(e){
e=e||appCtxt.getSettings();
e.registerSetting("SPREADSHEET_ENABLED",{
name:"zimbraFeatureBriefcaseSpreadsheetEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SLIDES_ENABLED",{
name:"zimbraFeatureBriefcaseSlidesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("DOCS_ENABLED",{
name:"zimbraFeatureBriefcaseDocsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("PREVIEW_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.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",countKey:"typeFile",icon:"GenericDoc",soapCmd:"ItemAction",itemClass:"ZmBriefcaseItem",node:"doc",organizer:ZmOrganizer.BRIEFCASE,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.BRIEFCASE],searchType:"document",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("BriefcaseCore");
return new ZmList(ZmItem.BRIEFCASE_ITEM,e)
}
,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:"folders",itemsKey:"files",treeType:ZmOrganizer.FOLDER,views:["document"],folderKey:"briefcase",mountKey:"mountFolder",createFunc:"ZmOrganizer.create",compareFunc:"ZmBriefcase.sortCompare",deferrable:true,newOp:ZmOperation.NEW_BRIEFCASE,displayOrder:100,hasColor:true,childWindow:true}
)
};
ZmBriefcaseApp.prototype._setupSearchToolbar=function(){
ZmSearchToolBar.addMenuItem(ZmItem.BRIEFCASE_ITEM,{
msgKey:"searchBriefcase",tooltipKey:"searchForFiles",icon:"Doc",shareIcon:"SharedBriefcase",setting:ZmSetting.BRIEFCASE_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_BRIEFCASE)}
)
};
ZmBriefcaseApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_DOC]="document";
var t={};
t[ZmOperation.NEW_BRIEFCASE]="briefcase";
var e={};
e[ZmKeyMap.NEW_FILE]=ZmOperation.NEW_FILE;
e[ZmKeyMap.NEW_BRIEFCASE]=ZmOperation.NEW_BRIEFCASE;
e[ZmKeyMap.NEW_PRESENTATION]=ZmOperation.NEW_PRESENTATION;
e[ZmKeyMap.NEW_SPREADSHEET]=ZmOperation.NEW_SPREADSHEET;
e[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:a,newOrgOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_BRIEFCASE,newActionCode:ZmKeyMap.NEW_DOC,chooserSort:70,defaultSort:60}
)
};
ZmBriefcaseApp.prototype.createNotify=function(o,s){
if(!o.folder&&!o.doc&&!o.link){
return
}
if(!s&&!this._noDefer&&this._deferNotifications("create",o)){
return
}
for(var e in o){
var n=o[e];
for(var a=0;
(n!=null)&&a<n.length;
a++){
var t=n[a];
if(appCtxt.cacheGet(t.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(t,ZmOrganizer.BRIEFCASE)
}else{
if(e=="link"){
this._handleCreateLink(t,ZmOrganizer.BRIEFCASE)
}else{
if(e=="doc"){
var r=AjxDispatcher.run("GetBriefcaseController");
r.handleCreateNotify(t)
}}}}}};
ZmBriefcaseApp.prototype.modifyNotify=function(a,e){
if(!a.doc){
return
}
var t=AjxDispatcher.run("GetBriefcaseController");
t.handleModifyNotify(a)
};
ZmBriefcaseApp.prototype.handleOp=function(a){
switch(a){
case ZmOperation.NEW_FILE:var e=new AjxCallback(this,this._handleNewItem);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e,null,true);
break;
case ZmOperation.NEW_BRIEFCASE:var e=new AjxCallback(this,this._handleLoadNewBriefcase);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e,null,true);
break;
case ZmOperation.NEW_PRESENTATION:var e=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_SLIDES]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,e,null);
break;
case ZmOperation.NEW_SPREADSHEET:var t=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_SPREADSHEET]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,t,null);
break;
case ZmOperation.NEW_DOC:var t=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_DOC]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,t,null);
break
}};
ZmBriefcaseApp.prototype.newDoc=function(c,t,h){
var a=appCtxt.getOverviewController();
var s=a.getTreeController(ZmOrganizer.BRIEFCASE);
var o=ZmOrganizer.ID_BRIEFCASE;
if(s){
var r=s.getTreeView(this.getOverviewId());
var l=r?r.getSelected():null;
o=l?l.id:ZmOrganizer.ID_BRIEFCASE
}
if(this.getBriefcaseController().chkFolderPermission(o)){
var e=this.getEditURLForContentType(c)+"?"+(t?"name="+t+"&":"")+"l="+o+"&skin="+appCurrentSkin+"&localeId="+AjxEnv.DEFAULT_LOCALE;
if(window.appCoverageMode){
e=e+"&coverage=1"
}
var n=h||t||(new Date()).getTime().toString();
window.open(e,n)
}};
ZmBriefcaseApp.getDocWindowFeatures=function(){
return["width=",(screen.width||640),",","height=",(screen.height||480),",","scrollbars=yes,","resizable=yes"].join("")
};
ZmBriefcaseApp.addEditorParam=function(e){
if(e&&window.isTinyMCE){}
return e
};
ZmBriefcaseApp.prototype.getEditURLForContentType=function(t){
AjxDispatcher.require("Startup1_1");
var e="Slides.jsp";
switch(t){
case ZmMimeTable.APP_ZIMBRA_SLIDES:e="Slides.jsp";
break;
case ZmMimeTable.APP_ZIMBRA_SPREADSHEET:e="SpreadsheetDoc.jsp";
break;
case ZmMimeTable.APP_ZIMBRA_DOC:e="Docs.jsp";
break;
default:return null
}
return(appContextPath+"/public/"+e)
};
ZmBriefcaseApp.prototype.isDoclet=function(e){
var t=e.getContentType();
switch(t){
case ZmMimeTable.APP_ZIMBRA_SLIDES:return true;
default:return false
}};
ZmBriefcaseApp.prototype._handleNewItem=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
this.getBriefcaseController().__popupUploadDialog(ZmMsg.uploadFileToBriefcase)
};
ZmBriefcaseApp.prototype._handleLoadNewBriefcase=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
if(!this._newBriefcaseCb){
this._newBriefcaseCb=new AjxCallback(this,this._newBriefcaseCallback)
}
ZmController.showDialog(appCtxt.getNewBriefcaseDialog(),this._newBriefcaseCb)
};
ZmBriefcaseApp.prototype.launch=function(t,a){
this._setLaunchTime(this.toString(),new Date());
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,e,null,true)
};
ZmBriefcaseApp.prototype._handleLoadLaunch=function(e){
this.search();
if(e){
e.run()
}};
ZmBriefcaseApp.prototype.search=function(o){
o=o||{};
var e=appCtxt.getById(o.folderId||ZmOrganizer.ID_BRIEFCASE);
var a={
query:o.query||e.createQuery(),types:[ZmItem.BRIEFCASE_ITEM],limit:this.getLimit(),searchFor:ZmId.ITEM_BRIEFCASE,callback:o.callback,accountName:o.accountName,noRender:o.noRender,noClear:o.noClear};
var t=appCtxt.getSearchController();
t.searchAllAccounts=false;
t.search(a)
};
ZmBriefcaseApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e,null,true)
};
ZmBriefcaseApp.prototype._handleLoadShowSearchResults=function(e,t){
this.getBriefcaseController().show(e);
this._setLoadedTime(this.toString(),new Date());
if(t){
t.run()
}};
ZmBriefcaseApp.prototype.setActive=function(e){};
ZmBriefcaseApp.prototype.getLimit=function(t){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
};
ZmBriefcaseApp.prototype._newBriefcaseCallback=function(o,a,t){
appCtxt.getNewBriefcaseDialog().popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.BRIEFCASE)._doCreate(o,a,t)
};
ZmBriefcaseApp.prototype.getBriefcaseController=function(){
if(!this._briefcaseController){
this._briefcaseController=new ZmBriefcaseController(this._container,this)
}
return this._briefcaseController
};
ZmBriefcaseApp.prototype.createFromAttachment=function(o,a,t){
var e=new AjxCallback(this,this._handleCreateFromAttachment,[o,a,t]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e)
};
ZmBriefcaseApp.prototype._handleCreateFromAttachment=function(a,t,e){
if(this._deferredFolders.length!=0){
this._createDeferredFolders(ZmApp.BRIEFCASE)
}
this.getBriefcaseController().createFromAttachment(a,t,e)
};
ZmBriefcaseApp.prototype._createDeferredFolders=function(e){
AjxPackage.require("BriefcaseCore");
ZmApp.prototype._createDeferredFolders.call(this,e)
}
}
if(AjxPackage.define("zimbraMail.voicemail.ZmVoiceApp")){
ZmVoiceApp=function(t,e){
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,t,e)
};
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.toString=function(){
return"ZmVoiceApp"
};
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",countKey:"typeVoicemail",icon:"Voicemail",soapCmd:"VoiceMsgAction",itemClass:"ZmVoicemail",node:"vm",organizer:ZmOrganizer.VOICE,dropTargets:[ZmOrganizer.VOICE],searchType:"voicemail",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("Voicemail");
return new ZmVoiceList(ZmItem.VOICEMAIL,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.CALL,{
app:ZmApp.VOICE,nameKey:"call",countKey:"typeCall",icon:"Voicemail",soapCmd:"VoiceMsgAction",itemClass:"ZmCall",node:"cl",organizer:ZmOrganizer.VOICE,searchType:"calllog",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("Voicemail");
return new ZmVoiceList(ZmItem.CALL,e)
}
,this)}
)
};
ZmVoiceApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_CHECK_VOICEMAIL,{
textKey:"checkVoicemail",tooltipKey:"checkVoicemailTooltip"}
);
ZmOperation.registerOp(ZmId.OP_CHECK_CALLS,{
textKey:"checkCalls",tooltipKey:"checkCallsTooltip"}
);
ZmOperation.registerOp(ZmId.OP_CALL_MANAGER,{
textKey:"callManager",tooltipKey:"callManagerTooltip",image:"CallManager",shortcut:ZmKeyMap.CALL_MANAGER}
);
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"}
)
};
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(){
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,upsellUrl:ZmSetting.VOICE_UPSELL_URL}
)
};
ZmVoiceApp.prototype._registerPrefs=function(){};
ZmVoiceApp.prototype._registerSettings=function(e){
e=e||appCtxt.getSettings();
e.registerSetting("VOICE_PAGE_SIZE",{
name:"zimbraPrefVoiceItemsPerPage",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:25}
);
e.registerSetting("VOICE_PAGE_SIZE_MAX",{
name:"zimbraMaxVoiceItemsPerPage",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
)
};
ZmVoiceApp.prototype.deleteNotify=function(e){
this._handleDeletes(e)
};
ZmVoiceApp.prototype.createNotify=function(e){
this._handleCreates(e)
};
ZmVoiceApp.prototype.modifyNotify=function(e){
this._handleModifies(e)
};
ZmVoiceApp.prototype.getOverviewId=function(){
var e=this.accordionItem?this.accordionItem.data.phone.name:"";
return[this._name,e].join(":")
};
ZmVoiceApp.prototype.getOverviewContainer=function(){
if(!this._overviewContainer){
var e=[ZmApp.OVERVIEW_ID,this._name].join("_");
var t={
appName:this._name,containerId:e,posStyle:Dwt.ABSOLUTE_STYLE,parent:appCtxt.getShell(),controller:this._opc};
t.id=ZmId.getOverviewContainerId(e);
this._overviewContainer=this._opc._overviewContainer[e]=new ZmVoiceOverviewContainer(t)
}
return this._overviewContainer
};
ZmVoiceApp.prototype.getVoiceInfo=function(r,e,t){
if(!this.phones.length){
if(!this._gettingVoiceInfo){
var a=AjxSoapDoc.create("GetVoiceInfoRequest","urn:zimbraVoice");
var s=new AjxCallback(this,this._handleResponseVoiceInfo);
var o=new AjxCallback(this,this._handleErrorResponseVoiceInfo);
var n={
soapDoc:a,asyncMode:true,noBusyOverlay:t,callback:s,errorCallback:o};
appCtxt.getAppController().sendRequest(n);
this._gettingVoiceInfo=true
}
if(r){
this._voiceInfoCallbacks=this._voiceInfoCallbacks||[];
this._voiceInfoCallbacks.push(r)
}
if(e){
this._voiceInfoErrorCallbacks=this._voiceInfoErrorCallbacks||[];
this._voiceInfoErrorCallbacks.push(e)
}}else{
if(r){
r.run()
}}};
ZmVoiceApp.prototype._handleResponseVoiceInfo=function(e){
var t=new AjxCallback(this,this._handleResponseVoiceInfo2,[e]);
AjxPackage.require({
name:"Voicemail",callback:t}
)
};
ZmVoiceApp.prototype._handleResponseVoiceInfo2=function(t){
var s=t._data.GetVoiceInfoResponse;
this._storeprincipal=s.storeprincipal[0];
this.soapInfo.additional={
storeprincipal:this._storeprincipal};
var a=s.phone;
for(var o=0,n=a.length;
o<n;
o++){
var r=a[o];
var e=new ZmPhone();
e._loadFromDom(r);
this.phones.push(e);
this._nameToPhone[e.name]=e;
if(r.folder&&r.folder.length){
e.folderTree=new ZmVoiceFolderTree();
e.folderTree.loadFromJs(r.folder[0],e)
}}
if(this._voiceInfoCallbacks){
for(o=0,n=this._voiceInfoCallbacks.length;
o<n;
o++){
this._voiceInfoCallbacks[o].run(t)
}}
this._voiceInfoCallbacks=null;
this._voiceInfoErrorCallbacks=null;
this._gettingVoiceInfo=false
};
ZmVoiceApp.prototype._handleErrorResponseVoiceInfo=function(e){
var a=false;
if(this._voiceInfoErrorCallbacks){
for(var t=0,o=this._voiceInfoErrorCallbacks.length;
t<o;
t++){
a=this._voiceInfoErrorCallbacks[t].run(e)||a
}}
this._voiceInfoCallbacks=null;
this._voiceInfoErrorCallbacks=null;
this._gettingVoiceInfo=false;
return a
};
ZmVoiceApp.prototype.refreshFolders=function(n,e){
if(this.phones.length){
var t=AjxSoapDoc.create("GetVoiceFolderRequest","urn:zimbraVoice");
this.setStorePrincipal(t);
var o=new AjxCallback(this,this._handleResponseUpdateFolders,[n]);
var a={
soapDoc:t,asyncMode:true,callback:o,errorCallback:e};
appCtxt.getAppController().sendRequest(a)
}else{
if(n){
n.run()
}}};
ZmVoiceApp.prototype._handleResponseUpdateFolders=function(r,t){
var a=t._data.GetVoiceFolderResponse.phone;
for(var o=0,n=a.length;
o<n;
o++){
var s=a[o];
var e=this._nameToPhone[s.name];
if(e){
this._updateFolders(e,s.folder[0].folder)
}}
if(r){
r.run()
}};
ZmVoiceApp.prototype._updateFolders=function(t,r){
var s=t.folderTree;
for(var a=0,n=r.length;
a<n;
a++){
var e=r[a];
var o=s.getByName(e.name);
if(o){
o.notifyModify(e)
}}};
ZmVoiceApp.prototype.search=function(o,r,s){
var e=(o.getSearchType()==ZmItem.VOICEMAIL)?ZmId.VIEW_VOICEMAIL:ZmId.VIEW_CALL_LIST;
if((e==ZmId.VIEW_VOICEMAIL)&&!o.phone.hasVoiceMail){
AjxDispatcher.run("GetVoiceController").show(null,o);
this._setupOverviewContainer();
if(r){
r.run(null)
}}else{
if(!s){
s=appCtxt.get(ZmSetting.SORTING_PREF,e)
}
var n={
soapInfo:this.soapInfo,types:AjxVector.fromArray([o.getSearchType()]),sortBy:s,query:o.getSearchQuery(),limit:this.getLimit()};
var t=new ZmSearch(n);
var a=new AjxCallback(this,this._handleResponseSearch,[o,r]);
t.execute({
callback:a}
)
}};
ZmVoiceApp.prototype._handleResponseSearch=function(e,l,t){
var o=t._data;
var n=o.getResults(e.getSearchType());
n.folder=e;
var r=(e.getSearchType()==ZmItem.VOICEMAIL)?AjxDispatcher.run("GetVoiceController"):AjxDispatcher.run("GetCallListController");
r.show(o,e);
this._setupOverviewContainer();
this.selectFolderInOverview(e);
var a=o.getAttribute("vfi");
if(a){
e.notifyModify(a[0])
}
if(this._paramId){
var s=r.getList();
var c=s.getById(this._paramId);
if(c){
var h=r.getCurrentView();
h.setSelection(c,true);
h.setPlaying(c)
}}
if(l){
l.run(o)
}};
ZmVoiceApp.prototype._setupOverviewContainer=function(){
this.getOverviewContainer();
if(!this._overviewContainer.initialized){
var e=this._getOverviewParams();
e.overviewTrees=this._getOverviewTrees();
e.phones=this.phones;
this._overviewContainer.initialize(e)
}};
ZmVoiceApp.prototype.markItemsHeard=function(t,a,n,e){
var o=a?"read":"!read";
this._performAction(t,o,null,n,e)
};
ZmVoiceApp.prototype._performAction=function(l,r,o,d,s){
if(!l.length){
if(d){
d.run(l)
}
return
}
var e=[];
for(var n=0,h=l.length;
n<h;
n++){
e[n]=l[n].id
}
var c=AjxSoapDoc.create("VoiceMsgActionRequest","urn:zimbraVoice");
this.setStorePrincipal(c);
var t=c.set("action");
t.setAttribute("op",r);
t.setAttribute("id",e.join(","));
t.setAttribute("phone",l[0].getPhone().name);
for(var n in o){
t.setAttribute(n,o[n])
}
var a={
soapDoc:c,asyncMode:true,callback:d,errorCallback:s};
appCtxt.getAppController().sendRequest(a)
};
ZmVoiceApp.prototype.launch=function(e,t){
this._showApp(e,t)
};
ZmVoiceApp.prototype._showApp=function(t,a){
this._paramId=(t.qsParams?t.qsParams.id:null);
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require("Voicemail",true,e,null,true)
};
ZmVoiceApp.prototype._handleLoadLaunch=function(a){
var t=new AjxCallback(this,this._handleResponseLoadLaunchGotInfo,a);
var e=new AjxCallback(this,this._handleErrorLoadLaunchGotInfo,a);
this.getVoiceInfo(t,e)
};
ZmVoiceApp.prototype._handleErrorLoadLaunchGotInfo=function(o,e){
var a;
this._loadError=true;
switch(e.code){
case"voice.SECONDARY_NOT_ALLOWED":this._showUpsellMessage();
a=true;
break;
case"voice.UNABLE_TO_RETRIEVE_PROFILE_SUMMARY":default:var t=appCtxt.getApp(ZmVoiceApp.overviewFallbackApp);
if(t){
t.launch()
}
a=false;
break
}
this.setOverviewPanelContent(false);
if(o instanceof AjxCallback){
o.run()
}
return a
};
ZmVoiceApp.prototype._showUpsellMessage=function(){
if(!this._showingSecondaryMessage){
this._showingSecondaryMessage=true;
var e=new DwtControl({
parent:appCtxt.getShell(),posStyle:Dwt.ABSOLUTE_STYLE}
);
e.setScrollStyle(DwtControl.SCROLL);
e.getHtmlElement().innerHTML=ZMsg["voice.SECONDARY_NOT_ALLOWED_VOICE"];
var t={};
t[ZmAppViewMgr.C_APP_CONTENT_FULL]=e;
var a="VoiceMessage";
this.createView({
viewId:a,appName:this._name,elements:t,isAppView:true}
);
this.pushView(a,true)
}};
ZmVoiceApp.prototype._handleResponseLoadLaunchGotInfo=function(a,e){
this._loadError=false;
var t=this.getStartFolder();
if(t){
this.search(t,a)
}else{
if(a){
a.run()
}}};
ZmVoiceApp.prototype.setStartPhone=function(e,a){
this._startPhone=e;
if(a){
var t=this.getStartFolder();
if(this.view!=ZmId.VIEW_VOICEMAIL){
this.pushView(ZmId.VIEW_VOICEMAIL)
}
if(this.getVoiceController().getFolder()!=t){
this.search(t);
this.getVoiceController().setFolder(t,true)
}
this.selectFolderInOverview(t)
}};
ZmVoiceApp.prototype.getStartFolder=function(t){
var n=0;
var o=t||this._startPhone;
if(o){
for(var a=0;
a<this.phones.length;
a++){
var e=this.phones[a];
if(e.name==o){
n=a
}}}
return this.phones[n].folderTree.getByName(ZmVoiceFolder.VOICEMAIL)
};
ZmVoiceApp.prototype.selectFolderInOverview=function(e){
var a=this.getOverviewContainer().getOverviews();
for(id in a){
var t=a[id];
if(t.phone==e.phone){
t.setSelected(e.id,"Voice")
}else{
t.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(t){
var a=t.set("storeprincipal");
for(var e in this._storeprincipal){
a.setAttribute(e,this._storeprincipal[e])
}};
ZmVoiceApp.prototype.setOverviewPanelContent=function(t){
if((this._showingSecondaryMessage||this._loadError)&&ZmVoiceApp.overviewFallbackApp){
var e=appCtxt.getApp(ZmVoiceApp.overviewFallbackApp);
if(e){
return e.setOverviewPanelContent(t)
}}
return ZmApp.prototype.setOverviewPanelContent.call(this,t)
};
ZmVoiceApp.prototype.redoSearch=function(){
var t=appCtxt.getAppViewMgr().getAppView(ZmApp.VOICE);
if(t){
var e;
if(t==ZmId.VIEW_VOICEMAIL){
e=AjxDispatcher.run("GetVoiceController")
}else{
if(t==ZmId.VIEW_CALL_LIST){
e=AjxDispatcher.run("GetCallListController")
}}
if(e){
this.search(e.getFolder())
}}};
ZmVoiceApp.prototype._handleDeletes=function(e){};
ZmVoiceApp.prototype._handleCreates=function(e){};
ZmVoiceApp.prototype._handleModifies=function(e){};
ZmVoiceApp.prototype._getOverviewTrees=function(){
return[ZmOrganizer.VOICE]
}
}
if(AjxPackage.define("zimbraMail.mixed.ZmMixedApp")){
ZmMixedApp=function(e){
ZmApp.call(this,ZmApp.MIXED,e)
};
ZmItem.MIXED="MIXED";
ZmApp.MIXED=ZmId.APP_MIXED;
ZmApp.CLASS[ZmApp.MIXED]="ZmMixedApp";
ZmApp.SETTING[ZmApp.MIXED]=ZmSetting.MIXED_VIEW_ENABLED;
ZmApp.LOAD_SORT[ZmApp.MIXED]=50;
ZmMixedApp.prototype=new ZmApp;
ZmMixedApp.prototype.constructor=ZmMixedApp;
ZmMixedApp.prototype.toString=function(){
return"ZmMixedApp"
};
ZmMixedApp.prototype._defineAPI=function(){
AjxDispatcher.registerMethod("GetMixedController","Mixed",new AjxCallback(this,this.getMixedController))
};
ZmMixedApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.MIXED,{
app:ZmApp.MIXED}
)
};
ZmMixedApp.prototype._registerApp=function(){
var e=[],t=[];
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){
e.push(ZmOrganizer.FOLDER);
t.push(ZmItem.MSG,ZmItem.CONV)
}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
e.push(ZmOrganizer.ADDRBOOK)
}
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){
e.push(ZmOrganizer.CALENDAR)
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED)){
e.push(ZmOrganizer.TASKS)
}
if(appCtxt.get(ZmSetting.BRIEFCASE_ENABLED)){
e.push(ZmOrganizer.BRIEFCASE)
}
e.push(ZmOrganizer.SEARCH,ZmOrganizer.TAG);
ZmApp.registerApp(ZmApp.MIXED,{
mainPkg:"Mixed",nameKey:"zimbraTitle",icon:"Globe",overviewTrees:e,searchTypes:t}
)
};
ZmMixedApp.prototype.launch=function(){};
ZmMixedApp.prototype._getOverviewTrees=function(){
var a=ZmApp.OVERVIEW_TREES[this._name];
var e=[];
var n=appCtxt.getAppController().getPreviousApp();
for(var t=0;
t<a.length;
t++){
var o=a[t];
if((n==ZmApp.CONTACTS&&o==ZmOrganizer.FOLDER)||(n!=ZmApp.CONTACTS&&o==ZmOrganizer.ADDRBOOK)){
continue
}
e.push(o)
}
return e
};
ZmMixedApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require(["MailCore","Mail","Mixed"],false,e,null,true)
};
ZmMixedApp.prototype._handleLoadShowSearchResults=function(e,t){
this.getMixedController().show(e);
if(t){
t.run()
}};
ZmMixedApp.prototype.getMixedController=function(){
if(!this._mixedController){
this._mixedController=new ZmMixedController(this._container,this)
}
return this._mixedController
}
}}
if(AjxPackage.define("dwt.Widgets")){
AjxTemplate.register("dwt.Widgets#DwtAlert",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td width=1%><div id='";
e[a++]=n.id;
e[a++]="_icon' style='margin-right:5px;'></div></td><td width=99%><table border=0 cellpadding=0 cellspacing=0><tr><td id='";
e[a++]=n.id;
e[a++]="_title' class='DwtAlertTitle'></td></tr><tr><td id='";
e[a++]=n.id;
e[a++]="_content' class='DwtAlertContent'></td></tr></table></td><td width=1%><div id='";
e[a++]=n.id;
e[a++]="_dismiss' style='margin-left:5px;'></div></td></tr></table>";
return o?e.length:e.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(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='2' cellspacing='0' border='0'><tr><td><label id='";
e[a++]=n.id;
e[a++]="_text_left' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:right'></label></td><td><input id='";
e[a++]=n.id;
e[a++]="_input' name='";
e[a++]=n.name;
e[a++]="' value='";
e[a++]=n.value;
e[a++]="' type='checkbox' ";
e[a++]=n.checked;
e[a++]="></td><td><label id='";
e[a++]=n.id;
e[a++]="_text_right' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:left'></label></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtCheckbox"}
,false);
AjxTemplate.register("dwt.Widgets#DwtRadioButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='2' cellspacing='0' border='0'><tr><td><label id='";
e[a++]=n.id;
e[a++]="_text_left' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:right'></label></td><td><input id='";
e[a++]=n.id;
e[a++]="_input' name='";
e[a++]=n.name;
e[a++]="' value='";
e[a++]=n.value;
e[a++]="' type='radio' ";
e[a++]=n.checked;
e[a++]="></td><td><label id='";
e[a++]=n.id;
e[a++]="_text_right' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:left'></label></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtRadioButton"}
,false);
AjxTemplate.register("dwt.Widgets#DwtBaseDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtDialog WindowOuterContainer'><table cellspacing=0 cellpadding=0><tr id='";
e[a++]=n.dragId;
e[a++]="'><td class='minWidth'>";
e[a++]=n.icon;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_title' class='DwtDialogTitle'>";
e[a++]=n.title;
e[a++]="</td><td class='minWidth'><div class='";
e[a++]=n.closeIcon2;
e[a++]="'></div></td><td class='minWidth'><div class='";
e[a++]=n.closeIcon1;
e[a++]="'></div></td></tr><tr><td class='WindowInnerContainer' colspan='4'><div id='";
e[a++]=n.id;
e[a++]="_content' class='DwtDialogBody'></div>";
if(n.controlsTemplateId){
e[a++]=AjxTemplate.expand(n.controlsTemplateId,n)
}
e[a++]="</td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtBaseDialog",height:"32",width:"20"}
,false);
AjxTemplate.register("dwt.Widgets#DwtDialogControls",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='horizSep'></div><div id='";
e[a++]=n.id;
e[a++]="_buttons' class='DwtDialogButtonBar'>";
if(AjxEnv.isNav){
e[a++]="<input type='button' id='";
e[a++]=n.id;
e[a++]="_focus' style='height:0px;width:0px;display:none;'>"
}
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtDialogControls"}
,false);
AjxTemplate.register("dwt.Widgets#DwtSemiModalDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtDialog LightWindowOuterContainer'><table cellspacing=0 cellpadding=0 style='cursor:move;'><tr id='";
e[a++]=n.dragId;
e[a++]="'><td class='minWidth'>";
e[a++]=n.icon;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_title' class='DwtDialogTitle'>";
e[a++]=n.title;
e[a++]="</td><td class='minWidth'><div class='";
e[a++]=n.closeIcon2;
e[a++]="'></div></td><td class='minWidth'><div class='";
e[a++]=n.closeIcon1;
e[a++]="'></div></td></tr><tr><td class='LightWindowInnerContainer full_size' colspan='4'><div id='";
e[a++]=n.id;
e[a++]="_content' class='DwtDialogBody'></div><div class='horizSep'></div><div id='";
e[a++]=n.id;
e[a++]="_buttons' class='DwtDialogButtonBar'>";
if(AjxEnv.isNav){
e[a++]="<input type='button' id='";
e[a++]=n.id;
e[a++]="_focus' style='height:0px;width:0px;display:none;'>"
}
e[a++]="</div></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtSemiModalDialog",height:"32",width:"20"}
,false);
AjxTemplate.register("dwt.Widgets#DwtToolTip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="TopPointer' class='DwtToolTipTopPointer'><center><div class='DwtToolTipPointerRow' style='width:1px;'> </div><div class='DwtToolTipPointerRow' style='width:3px;'> </div><div class='DwtToolTipPointerRow' style='width:5px;'> </div><div class='DwtToolTipPointerRow' style='width:7px;'> </div><div class='DwtToolTipPointerRow' style='width:9px;'> </div><div class='DwtToolTipPointerRow' style='width:11px;'> </div><div class='DwtToolTipPointerRow' style='width:13px;'> </div><div class='DwtToolTipPointerRow' style='width:15px;'> </div><div class='DwtToolTipPointerRow' style='width:17px;'> </div><div class='DwtToolTipPointerRow' style='width:19px;'> </div><div class='DwtToolTipPointerRow' style='width:21px;'> </div></center></div><div id='";
e[a++]=n.id;
e[a++]="Contents' class='DwtToolTipBody'></div><div id='";
e[a++]=n.id;
e[a++]="BottomPointer' class='DwtToolTipBottomPointer'><center><div class='DwtToolTipPointerRow' style='width:21px;'> </div><div class='DwtToolTipPointerRow' style='width:19px;'> </div><div class='DwtToolTipPointerRow' style='width:17px;'> </div><div class='DwtToolTipPointerRow' style='width:15px;'> </div><div class='DwtToolTipPointerRow' style='width:13px;'> </div><div class='DwtToolTipPointerRow' style='width:11px;'> </div><div class='DwtToolTipPointerRow' style='width:9px;'> </div><div class='DwtToolTipPointerRow' style='width:7px;'> </div><div class='DwtToolTipPointerRow' style='width:5px;'> </div><div class='DwtToolTipPointerRow' style='width:3px;'> </div><div class='DwtToolTipPointerRow' style='width:1px;'> </div></center></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtToolTip",height:"5",width:"5"}
,false);
AjxTemplate.register("dwt.Widgets#DwtVerticalSash",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtVerticalSash'><center><div class='ImgVSash_thumb'></div></center></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtVerticalSash",height:"0",width:"0"}
,false);
AjxTemplate.register("dwt.Widgets#DwtHorizontalSash",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtHorizontalSash'><table cellspacing=0 cellpadding=0 height='100%'><tr><td height='100%' valign='middle'><div class='ImgHSash_thumb'></div></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtHorizontalSash",height:"0",width:"0"}
,false);
AjxTemplate.register("dwt.Widgets#DwtMissingSoundPlayer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='DwtMissingSoundPlayer'><tr><td nowrap class='ImgCritical'> </td><td nowrap>";
e[a++]=ZmMsg.missingPlugin;
e[a++]="</td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtMissingSoundPlayer"}
,false);
AjxTemplate.register("dwt.Widgets#DwtVerticalSlider",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_button' class='DwtThumb DwtSliderThumb'><div class='DwtSliderThumbBorder'><div class='ImgVerticalSliderThumb'></div></div></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtVerticalSlider","class":"DwtSlider DwtVerticalSlider"}
,false);
AjxTemplate.register("dwt.Widgets#DwtHorizontalSlider",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_button' class='DwtThumb DwtSliderThumb'><div class='DwtSliderThumbBorder'><div class='ImgHorizontalSliderThumb'></div></div></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtHorizontalSlider","class":"DwtSlider DwtHorizontalSlider"}
,false);
AjxTemplate.register("dwt.Widgets#ZLabel",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZLabelBorder' cellspacing=0 cellpadding=0><tr><td id='";
e[a++]=n.id;
e[a++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'></td><td id='";
e[a++]=n.id;
e[a++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZLabel","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Button";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_dropdown' class='ZDropDown'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
n.buttonClass=n.buttonClass||"ToolbarButton";
e[a++]=AjxTemplate.expand("#ZButton",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZBorderlessButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Button";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_dropdown' class='ZDropDown'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZBorderlessButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZLinkButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='DwtLinkButtonTable' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td class='ZWidgetTitle'><a href='javascript:;' onclick='return false;' id='";
e[a++]=n.id;
e[a++]="_title'></a></td><td id='";
e[a++]=n.id;
e[a++]="_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 o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZLinkButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZButtonColorDisplay",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_color' class='DwtButtonColorPicker-display' unselectable></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZButtonColorDisplay"}
,false);
AjxTemplate.register("dwt.Widgets#DwtComboBox",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0><tr><td width=*><div id='";
e[a++]=n.id;
e[a++]="_input'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_button'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtComboBox","class":"DwtComboBox"}
,false);
AjxTemplate.register("dwt.Widgets#DwtComboBoxButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Button";
t[o++]="<table class='Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0><tr><td id='";
t[o++]=s.id;
t[o++]="_dropdown' class='ZDropDown'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#DwtComboBoxButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_tabbar'></div><div id='";
e[a++]=n.id;
e[a++]="_page'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabView","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0><tr valign='bottom' id='";
e[a++]=n.id;
e[a++]="_items'>";
e[a++]=AjxTemplate.expand("#ZTabBarPrefix",n);
e[a++]=AjxTemplate.expand("#ZTabBarSuffix",n);
e[a++]="</tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBar","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarFloat",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_items'>";
e[a++]=AjxTemplate.expand("#ZTabBarPrefixFloat",n);
e[a++]=AjxTemplate.expand("#ZTabBarSuffixFloat",n);
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarFloat","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarPrefixFloat",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_prefix' class='ZTabBarPrefix'> </div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarPrefixFloat"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarSuffixFloat",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_suffix' class='ZTabBarSuffix'> </div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarSuffixFloat"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarPrefix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<td id='";
e[a++]=n.id;
e[a++]="_prefix' class='ZTabBarPrefix'> </td>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarPrefix"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarSuffix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<td id='";
e[a++]=n.id;
e[a++]="_suffix' class='ZTabBarSuffix'> </td>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarSuffix"}
,false);
AjxTemplate.register("dwt.Widgets#ZTab",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Tab";
t[o++]="<table id='";
t[o++]=s.id;
t[o++]="_select' class='Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border ZWidgetTable ZWidgetBorder' cellspacing=0 cellpadding=0><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZTab","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabFloat",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Tab";
t[o++]="<table id='";
t[o++]=s.id;
t[o++]="_select' class='Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border ZWidgetBorder' cellspacing=0 cellpadding=0><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZTabFloat","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabPage",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabPage","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelectAutoSizingContainer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table border=0 cellpadding=0 cellspacing=0><tr><td id="';
e[a++]=n.id;
e[a++]='_select_container">';
e[a++]=AjxTemplate.expand(n.selectTemplateId,n.selectData);
e[a++]='</td></tr><tr><td><table id="';
e[a++]=n.id;
e[a++]='_pseudoitems_container" border=0 cellpadding=0 cellspacing=0></table></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelectAutoSizingContainer"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelect",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("#ZButton",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelect","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelectMenu",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("#ZMenu",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelectMenu","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelectMenuItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("#ZMenuItem",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelectMenuItem","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZToolbarTable' border=0 cellpadding=0 cellspacing=0><tr id='";
e[a++]=n.id;
e[a++]="_items'>";
e[a++]=AjxTemplate.expand("#ZToolbarPrefix",n);
e[a++]=AjxTemplate.expand("#ZToolbarSuffix",n);
e[a++]="</tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbar","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarPrefix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarPrefix"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarSuffix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarSuffix"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarItem"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarSeparator",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' class='ZToolbarSeparator'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarSeparator"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarSpacer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' class='ZToolbarSpacer'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarSpacer"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarFiller",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' class='ZToolbarFiller' width='100%'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarFiller"}
,false);
AjxTemplate.register("dwt.Widgets#ZField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<input id='";
e[a++]=n.id;
e[a++]="_field' class='ZFieldInput'>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZField","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTreeItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='";
e[a++]=n.divClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_div'><table id='";
e[a++]=n.id;
e[a++]="_table' border=0 cellpadding=0 cellspacing=0 width=100%><tr><td align=center nowrap id='";
e[a++]=n.id;
e[a++]="_nodeCell'></td>";
if(n.isCheckedStyle){
e[a++]="<td nowrap id='";
e[a++]=n.id;
e[a++]='_checkboxCell' class="ZTreeItemCheckboxCell"><div class="ZTreeItemCheckbox" id='';
e[a++]=n.id;
e[a++]="_checkbox'><div class="ZTreeItemCheckboxImg" id='";
e[a++]=n.id;
e[a++]="_checkboxImg'>";
e[a++]=AjxImg.getImageHtml("MenuCheck");
e[a++]="</div></div></td>"
}
e[a++]="<td nowrap class='imageCell' id='";
e[a++]=n.id;
e[a++]="_imageCell'></td><td width=100% nowrap class='";
e[a++]=n.textClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_textCell'></td><td width=16 class='imageCell' id='";
e[a++]=n.id;
e[a++]="_extraCell'></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTreeItem"}
,false);
AjxTemplate.register("dwt.Widgets#ZHeaderTreeItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='";
e[a++]=n.divClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_div'><table id='";
e[a++]=n.id;
e[a++]="_table' border=0 cellpadding=0 cellspacing=0><tr>";
if(!n.noNodeCell){
e[a++]="<td align=center nowrap id='";
e[a++]=n.id;
e[a++]="_nodeCell'></td>"
}
e[a++]="<td nowrap class='imageCell' id='";
e[a++]=n.id;
e[a++]="_imageCell'></td><td nowrap class='";
e[a++]=n.textClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_textCell' width="100%"></td><td class='";
e[a++]=n.textClassName;
e[a++]=" FakeAnchor' style="padding-right:4px"><div id='";
e[a++]=n.id;
e[a++]="_headerButton'/></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZHeaderTreeItem"}
,false);
AjxTemplate.register("dwt.Widgets#ZAccordion",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_div'><table class='ZAccordionTable ZWidget' border=0 cellspacing=0 cellpadding=0 id='";
e[a++]=n.id;
e[a++]="_accordion_table'></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZAccordion"}
,false);
AjxTemplate.register("dwt.Widgets#ZAccordionItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_header_";
e[a++]=n.itemNum;
e[a++]="' class='ZAccordionHeader'><table class='ZAccordionHeaderBorder ZWidgetTable' cellspacing=0 cellpadding=0><tr><td><div class='";
e[a++]=n.icon;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_icon_";
e[a++]=n.itemNum;
e[a++]="'></div></td><td><div class='ZAccordionTitle' id='";
e[a++]=n.id;
e[a++]="_title_";
e[a++]=n.itemNum;
e[a++]="'>";
e[a++]=n.title;
e[a++]="</div></td><td><div class='ImgAccordionClosed' id='";
e[a++]=n.id;
e[a++]="_status_";
e[a++]=n.itemNum;
e[a++]="'></div></td></tr></table></div><div class='ZAccordionBody' id='";
e[a++]=n.id;
e[a++]="_body_";
e[a++]=n.itemNum;
e[a++]="'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZAccordionItem"}
,false);
AjxTemplate.register("dwt.Widgets#DwtTabView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' border='0' cellspacing='0' cellpadding='0' backgroundColor='";
e[a++]=n.bgcolor;
e[a++]="'><tr align='left' valign='middle'><td id='";
e[a++]=n.id;
e[a++]="_tabs' class='DwtTabTable' nowrap align='left' valign='middle' width='100%'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtTabView"}
,false);
AjxTemplate.register("dwt.Widgets#DwtTabBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<!-- TODO -->";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtTabBar"}
,false);
AjxTemplate.register("dwt.Widgets#DwtTabSpacer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' cellspacing='0' cellpadding='0'><tr></tr><tr></tr><tr><td><div class='ImgTabSpacer'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtTabSpacer"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenu",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_container' class='ZMenuBorder'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenu","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder' cellspacing=0 cellpadding=0><tr><td id='";
e[a++]=n.id;
e[a++]="_check' class='ZCheckIcon'><div></div></td><td id='";
e[a++]=n.id;
e[a++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'></td><td id='";
e[a++]=n.id;
e[a++]="_dropdown' class='ZDropDown'><div></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItem","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemSeparator",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder ZMenuItemSeparatorBorder' cellspacing=0 cellpadding=0><tr><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'><div class='ZMenuItem-Separator'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemSeparator","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemBlankCheck",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZMenuItem-BlankCheck'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemBlankCheck"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemBlankIcon",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZMenuItem-BlankIcon'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemBlankIcon"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemBlankCascade",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZMenuItem-BlankCascade'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemBlankCascade"}
,false);
AjxTemplate.register("dwt.Widgets#DwtListView-NoResults",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' cellspacing=0 cellpadding=1><tr><td class='NoResults' valign='top'><br><br>";
e[a++]=n.message;
e[a++]="
";
e[a++]=" </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtListView-NoResults"}
,false);
AjxTemplate.register("dwt.Widgets#DwtPasswordField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='0' cellspacing='0' border='0'><tr><td><div id='";
e[a++]=n.id;
e[a++]="_input'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_show_password'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtPasswordField"}
,false);
AjxTemplate.register("dwt.Widgets#DwtFormRows",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table border=0 cellspacing=3 cellpadding=0><tbody id="';
e[a++]=n.id;
e[a++]='_rows" tabindex="100"></tbody></table>';
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtFormRows"}
,false);
AjxTemplate.register("dwt.Widgets#DwtFormRow",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table><tr id="';
e[a++]=n.id;
e[a++]='_row" class="DwtFormRow"><td><div id="';
e[a++]=n.id;
e[a++]='" tabindex="100"></div></td><td><div id="';
e[a++]=n.id;
e[a++]='_add" class="DwtFormRowAdd" tabindex="200"></div></td><td><div id="';
e[a++]=n.id;
e[a++]='_remove" class="DwtFormRowRemove" tabindex="300"></div></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtFormRow"}
,false);
AjxTemplate.register("dwt.Widgets#DwtColorPicker",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_colors'><div class='Text'>";
e[a++]=AjxMsg.colorsStandard;
e[a++]="</div><div class='Colors First'><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorRed;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorOrange;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorYellow;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorGreen;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorCyan;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorBlue;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorPurple;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorPink;
e[a++]=";'></div><div class='Color' style='background-color:white;'></div><div class='Color' style='background-color:black;'></div></div><div class='Text'>";
e[a++]=AjxMsg.colorsCustom;
e[a++]="</div><div class='Colors First'><div class='Color' style='background-color:#ff8686;'></div><div class='Color' style='background-color:#ff9966;'></div><div class='Color' style='background-color:#ffff99;'></div><div class='Color' style='background-color:#ccffcc;'></div><div class='Color' style='background-color:#ccffff;'></div><div class='Color' style='background-color:#99ccff;'></div><div class='Color' style='background-color:#ccccff;'></div><div class='Color' style='background-color:#ffccff;'></div><div class='Color' style='background-color:#ededed;'></div><div class='Color' style='background-color:#808080;'></div></div><div class='Colors'><div class='Color' style='background-color:#ff0000;'></div><div class='Color' style='background-color:#ff6600;'></div><div class='Color' style='background-color:#ffcc33;'></div><div class='Color' style='background-color:#66cc66;'></div><div class='Color' style='background-color:#00cccc;'></div><div class='Color' style='background-color:#3366ff;'></div><div class='Color' style='background-color:#6666ff;'></div><div class='Color' style='background-color:#cc33cc;'></div><div class='Color' style='background-color:#d5d5d5;'></div><div class='Color' style='background-color:#666666;'></div></div><div class='Colors'><div class='Color' style='background-color:#cc0000;'></div><div class='Color' style='background-color:#cc6600;'></div><div class='Color' style='background-color:#cc9933;'></div><div class='Color' style='background-color:#009900;'></div><div class='Color' style='background-color:#339999;'></div><div class='Color' style='background-color:#3333ff;'></div><div class='Color' style='background-color:#6633ff;'></div><div class='Color' style='background-color:#993399;'></div><div class='Color' style='background-color:#cccccc;'></div><div class='Color' style='background-color:#4d4d4d;'></div></div><div class='Colors'><div class='Color' style='background-color:#990000;'></div><div class='Color' style='background-color:#993300;'></div><div class='Color' style='background-color:#996633;'></div><div class='Color' style='background-color:#006600;'></div><div class='Color' style='background-color:#336666;'></div><div class='Color' style='background-color:#000099;'></div><div class='Color' style='background-color:#330099;'></div><div class='Color' style='background-color:#663366;'></div><div class='Color' style='background-color:#b3b3b3;'></div><div class='Color' style='background-color:#333333;'></div></div><div class='Colors'><div class='Color' style='background-color:#330000;'></div><div class='Color' style='background-color:#663300;'></div><div class='Color' style='background-color:#333300;'></div><div class='Color' style='background-color:#003300;'></div><div class='Color' style='background-color:#003333;'></div><div class='Color' style='background-color:#000066;'></div><div class='Color' style='background-color:#330066;'></div><div class='Color' style='background-color:#330033;'></div><div class='Color' style='background-color:#aaaaaa;'></div><div class='Color' style='background-color:#1a1a1a;'></div></div></div>";
if(!n.hideNoFill){
e[a++]="<div class='Text' style='margin-top:4px;'><div id='";
e[a++]=n.id;
e[a++]="_default'></div></div>"
}
if(n.allowColorInput){
e[a++]="<div class='Text' style='margin-top:4px;'><table border="0" width='100%'><tr><td><div id='";
e[a++]=n.id;
e[a++]="_input'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_button'></div></td></tr></table><table class='DwtColorPickerLabel' border="0"><tr><td><div>";
e[a++]=AjxMsg.previewResult;
e[a++]="</div></td><td><div id='";
e[a++]=n.id;
e[a++]="_preview' class='Color'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_error'></div></td></tr></table></div>"
}
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtColorPicker"}
,false);
AjxTemplate.register("dwt.Widgets#DwtColorPickerButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder' cellspacing=0 cellpadding=0><tr><td><div id='";
e[a++]=n.id;
e[a++]="_color' class='Color'></div></td><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'
";
e[a++]=" ";
if(AjxEnv.isIE){
e[a++]="
";
e[a++]=" style='width:auto;'
";
e[a++]=" "
}
e[a++]="
";
e[a++]=" ></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtColorPickerButton","class":"ZWidget"}
,false)
}
if(AjxPackage.define("share.App")){
AjxTemplate.register("share.App#Loading",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 style='width:100%;height=100%'><tr><td align='center' valign='middle'><br><br><br>";
e[a++]=ZmMsg.loading;
e[a++]="<br><br><div class='Imgwait_64'></div><br><br><br></td></tr><tr><td style='height:100%'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.App#Loading"}
,false);
AjxTemplate.register("share.App",AjxTemplate.getTemplate("share.App#Loading"),AjxTemplate.getParams("share.App#Loading"));
AjxTemplate.register("share.App#Banner",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 style='width:100%;height:100%'><tr><td align='center' valign='middle'><a";
if(n.url&&n.url!=""){
e[a++]=" href='";
e[a++]=n.url;
e[a++]="' target='_blank'"
}
e[a++]="><div class='ImgAppBanner' ";
if(n.isOffline){
e[a++]=" style='width:220px;' "
}
e[a++]="></div></a></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.App#Banner"}
,false);
AjxTemplate.register("share.App#UserInfo",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='skin_table' cellpadding=0 cellspacing=0 border=0><!--
";
e[a++]=" ";
if(n.showOfflineLink){
e[a++]='<tr><td id='skin_td_switch_offline' colspan=3><a href="http://www.zimbra.com/products/desktop.html" target="_blank">';
e[a++]=ZmMsg.switchToOfflineClientEx;
e[a++]="</a></td></tr>"
}
e[a++]="
";
e[a++]="--><tr>";
if(n.adminUrl){
e[a++]='<td id="skin_container_adminlink"><a target="_blank" href="';
e[a++]=n.adminUrl;
e[a++]='">';
e[a++]=ZmMsg.adminLinkLabel;
e[a++]="</a></td>"
}
e[a++]="<td id='skin_container_help'><span id='skin_container_help_button'></span></td><td id='skin_container_logoff'><a href='javascript:;' onclick='ZmZimbraMail._onClickLogOff();'>";
e[a++]=n.logoutText;
e[a++]="</a></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.App#UserInfo"}
,false);
AjxTemplate.register("share.App#PrintView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<html><head><title>";
e[a++]=ZmMsg.zimbraLabel;
e[a++]=" ";
e[a++]=n.username;
e[a++]="</title><link rel='stylesheet' href='";
e[a++]=n.appContextPath;
e[a++]="/css/msgview,zm,wiki.css?v=";
e[a++]=n.cacheKillerVersion;
e[a++]="' media='screen'></link>";
if(n.onloadStr){
e[a++]="<script language='javascript'>
";
e[a++]=" function handleOnload() {
";
e[a++]=" ";
e[a++]=n.onloadStr;
e[a++]=";
";
e[a++]=" }
";
e[a++]=" </script></head><body onload='handleOnload();'>"
}else{
e[a++]="</head><body>"
}
e[a++]="<table border=0 width=100%><tr><td class='ZmPrintView-company'>";
e[a++]=ZmMsg.zimbraTitle;
e[a++]=" ";
e[a++]=ZmMsg.splashScreenAppName;
e[a++]="</td><td class='ZmPrintView-username' align=right>";
e[a++]=n.username;
e[a++]="</td></tr></table><hr><div style='padding:10px'>";
e[a++]=n.content;
e[a++]="</div></body></html>";
return o?e.length:e.join("")
}
,{
id:"share.App#PrintView"}
,false);
AjxTemplate.register("share.App#FolderTooltip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=0 cellspacing=0 border=0><tr><td valign='top' style='padding-right:20px'>";
e[a++]=AjxMessageFormat.format(ZmMsg.makeLabel,n.itemText);
e[a++]="</td><td valign='top'>";
e[a++]=n.numTotal;
e[a++]="</td></tr>";
if(n.sizeTotal){
e[a++]="<tr><td valign='top'>";
e[a++]=ZmMsg.sizeLabel;
e[a++]="</td><td valign='top'>";
e[a++]=AjxUtil.formatSize(n.sizeTotal);
e[a++]="</td></tr>"
}
e[a++]="</table>";
return o?e.length:e.join("")
}
,{
id:"share.App#FolderTooltip"}
,false);
AjxTemplate.register("share.App#ZimbraAccountTooltip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0>";
if(n.lastSync&&n.lastSync!=""){
e[a++]="<tr><td class='nobreak' align=right>";
e[a++]=ZmMsg.lastSync;
e[a++]=":</td><td class='nobreak'>";
e[a++]=n.lastSync;
e[a++]="</td></tr>"
}else{
if(n.hasNotSynced){
e[a++]="<tr><td class='nobreak' colspan=2>";
e[a++]=ZmMsg.neverSynced;
e[a++]="</td></tr>"
}}
if(n.status&&n.status!=""){
e[a++]="<tr><td align=right valign=top>";
e[a++]=ZmMsg.status;
e[a++]=":</td><td>";
e[a++]=n.status;
e[a++]="</td></tr>"
}
if(!n.hasNotSynced){
e[a++]="<tr><td align=right valign=top>";
e[a++]=ZmMsg.offlineQuota;
e[a++]="</td><td>";
e[a++]=n.quota;
e[a++]="</td></tr>"
}
e[a++]="</table>";
return o?e.length:e.join("")
}
,{
id:"share.App#ZimbraAccountTooltip"}
,false);
AjxTemplate.register("share.App#presenceButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"ToolbarButton";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.App#presenceButton","class":"ZWidget"}
,false);
AjxTemplate.register("share.App#ZmTaskbarItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_button' class='ZmTaskbarButtonParent'></div><div id='";
e[a++]=n.id;
e[a++]="_content' class='ZmTaskbarContentParent' style='display:none;'></div>";
return o?e.length:e.join("")
}
,{
id:"share.App#ZmTaskbarItem","class":"ZWidget"}
,false);
AjxTemplate.register("share.App#ZmStatusImageButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"ToolbarButton";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_status_icon' class='ZLeftIcon ZWidgetIcon'><div></div></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.App#ZmStatusImageButton","class":"ZWidget"}
,false);
AjxTemplate.register("share.App#NetworkStatus",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table border=0 width=90 cellpadding=0 cellspacing=0><tr><td class="ZmNetworkStatusIcon" onclick="ZmZimbraMail.handleNetworkStatusClick();" id="';
e[a++]=n.id;
e[a++]='_networkStatusText"></td><td class="ZmNetworkStatusIcon" align=right width=18 onclick="ZmZimbraMail.handleNetworkStatusClick();" id="';
e[a++]=n.id;
e[a++]='_networkStatusIcon"></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.App#NetworkStatus"}
,false)
}
if(AjxPackage.define("share.Dialogs")){
AjxTemplate.register("share.Dialogs#TableProperties",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table class="ZmHEDialog"><tr><td><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.description;
e[a++]='</legend><table width="100%"><tr><td class="Label" style="width: auto">';
e[a++]=ZmMsg.caption;
e[a++]='</td><td width="100%" id="';
e[a++]=n.id;
e[a++]='_Caption"></td></tr><tr><td class="Label" style="width: auto">';
e[a++]=ZmMsg.summary;
e[a++]='</td><td width="100%" id="';
e[a++]=n.id;
e[a++]='_Summary"></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.layout;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label">';
e[a++]=ZmMsg.tableWidth;
e[a++]='</td><td colspan="4"><table cellpadding="0" cellspacing="0"><tr><td style="padding-right: 2px"><input id="';
e[a++]=n.id;
e[a++]='_WidthAuto" checked="checked" name="';
e[a++]=n.id;
e[a++]='_WidthAuto" type="radio" /></td><td style="padding-right: 2em" colspan="2"><label for="';
e[a++]=n.id;
e[a++]='_WidthAuto">';
e[a++]=ZmMsg.auto;
e[a++]='</label></td></tr><tr><td style="padding-right: 2px"><input id="';
e[a++]=n.id;
e[a++]='_WidthAuto1" name="';
e[a++]=n.id;
e[a++]='_WidthAuto" type="radio" /></td><td style="padding-right: 3px" id="';
e[a++]=n.id;
e[a++]='_Width"></td><td id="';
e[a++]=n.id;
e[a++]='_WidthUnit"></td></tr></table></td></tr></table><table cellspacing="0" id="';
e[a++]=n.id;
e[a++]='_AdvancedMode1" style="margin-top: 4px; display: none"><tr><td class="Label">';
e[a++]=ZmMsg.tableAlignment;
e[a++]='</td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_Align"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td><table cellpadding="1" cellspacing="1"><tr><td><input type="checkbox" id="';
e[a++]=n.id;
e[a++]='_FixedLayout" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_FixedLayout">';
e[a++]=ZmMsg.fixedCellWidth;
e[a++]='</label></td></tr></table></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.textStyle;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label">';
e[a++]=ZmMsg.textAlign;
e[a++]='</td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_TextAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.fontColorLabel;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_ForegroundColor"></td></tr><tr><td class="Label">';
e[a++]=ZmMsg.verticalAlign;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_TextVAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.fontBackgroundLabel;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_BackgroundColor"></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.borderStyle;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label">';
e[a++]=ZmMsg.borderWidth;
e[a++]='</td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_BorderWidth"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.borderColorLabel;
e[a++]='</td><td><table cellspacing="0"><tr><td id="';
e[a++]=n.id;
e[a++]='_BorderColor"></td></tr></table></td></tr><tr><td class="Label">';
e[a++]=ZmMsg.cellPadding;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_CellPadding"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.borderStyleLabel;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_BorderStyle"></td></tr><tr id="';
e[a++]=n.id;
e[a++]='_AdvancedMode2" style="display: none"><td class="Label">';
e[a++]=ZmMsg.cellSpacing;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_BorderSpacing"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td colspan="2" style="padding: 2px 0 2px 0"><table cellpadding="1" cellspacing="1" align="center"><tr><td><input type="checkbox" id="';
e[a++]=n.id;
e[a++]='_BorderCollapse" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_BorderCollapse">';
e[a++]=ZmMsg.collapsedBorders;
e[a++]="</label></td></tr></table></td></tr></table></fieldset></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#TableProperties"}
,false);
AjxTemplate.register("share.Dialogs",AjxTemplate.getTemplate("share.Dialogs#TableProperties"),AjxTemplate.getParams("share.Dialogs#TableProperties"));
AjxTemplate.register("share.Dialogs#CellProperties",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table class="ZmHEDialog"><tr><td><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.borderStyle;
e[a++]='</legend><table width="100%"><tr><td style="width: 19em"><!-- If you're wondering why this has to be so complex, check out this bug:
';
e[a++]=' https://bugzilla.mozilla.org/show_bug.cgi?id=258255 --><div style="padding-left: 1em; padding-top: 1em">';
e[a++]=ZmMsg.clickToDrawABorder;
e[a++]='</div><div style="margin-top: 10px;"><table align="center"><tr><td>';
e[a++]=ZmMsg.styleLabel;
e[a++]="</td><td>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td>";
e[a++]=ZmMsg.widthLabel;
e[a++]='</td></tr><tr><td id="';
e[a++]=n.id;
e[a++]='_BorderStyle"></td><td><!-- embedded in a table so the widget doesn't enlarge --><table cellspacing="0" cellpadding="0"><tr><td id="';
e[a++]=n.id;
e[a++]='_BorderColor"></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_BorderWidth"></td></tr></table></div><table id="';
e[a++]=n.id;
e[a++]='_PreviewGridHolder" style="width: 100px; height: 100px;" cellspacing="0" cellpadding="0" align="center"><tr><td><table cellspacing="0" cellpadding="0" align="center"><tr><td><table id="';
e[a++]=n.id;
e[a++]='_PreviewGrid" style="border-collapse: collapse; background-color: #fff; border: 1px dashed #ccc;" cellspacing="0" cellpadding="0"><tr><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td></tr><tr><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td></tr></table></td></tr></table></td></tr></table></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td valign="top"><div style="padding-left: 1em; padding-top: 1em; padding-bottom: 1em">';
e[a++]=ZmMsg.orPickAStyleBelow;
e[a++]='</div><table align="center" id="';
e[a++]=n.id;
e[a++]='_QuickBorders"><tr><td></td><td></td><td></td><td></td><td></td></tr></table></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.layout;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableWidth" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableWidth">';
e[a++]=ZmMsg.widthLabel;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_Width"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableHorizPadding" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableHorizPadding">';
e[a++]=ZmMsg.paddingHorizontal;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_HorizPadding"></td></tr><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableHeight" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableHeight">';
e[a++]=ZmMsg.heightLabel;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_Height"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableVertPadding" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableVertPadding">';
e[a++]=ZmMsg.paddingVertical;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_VertPadding"></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.textStyle;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableTextAlign" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableTextAlign">';
e[a++]=ZmMsg.textAlign;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_TextAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableForegroundColor" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableForegroundColor">';
e[a++]=ZmMsg.fontColorLabel;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_ForegroundColor"></td></tr><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableTextVAlign" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableTextVAlign">';
e[a++]=ZmMsg.verticalAlign;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_TextVAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableBackgroundColor" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableBackgroundColor">';
e[a++]=ZmMsg.fontBackgroundLabel;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_BackgroundColor"></td></tr></table></fieldset></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#CellProperties"}
,false);
AjxTemplate.register("share.Dialogs#EditorInsertLink",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table class="ZmHEDialog"><tr><td><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.linkText;
e[a++]="</legend>";
e[a++]=ZmMsg.linkTextDesc;
e[a++]='<br /><div id="';
e[a++]=n.id;
e[a++]='_linkTextCont"></div></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.linkTarget;
e[a++]="</legend>";
e[a++]=ZmMsg.linkTargetDesc;
e[a++]='<br /><table cellspacing="0" cellpadding="0"><tr><td id="';
e[a++]=n.id;
e[a++]='_linkTargetCont" style="padding-right: 5px"></td><td id="';
e[a++]=n.id;
e[a++]='_testBtnCont"></td></tr></table></fieldset></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#EditorInsertLink"}
,false);
AjxTemplate.register("share.Dialogs#NewSearch",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='0' cellspacing='0' border='0' ";
e[a++]=AjxEnv.isWebKitBased?"width='320'>":">";
e[a++]="<tr><td class='Label' colspan=2 style='padding: 0px 0px 5px 0px;'>";
e[a++]=ZmMsg.searchName;
e[a++]=" </td></tr><tr><td><input autocomplete=OFF type='text' class='Field' id='";
e[a++]=n.id;
e[a++]="_nameField' /></td></tr><tr><td> </td></tr><tr><td><div id='";
e[a++]=n.id;
e[a++]='_overviewDiv'><div class="Label">';
e[a++]=ZmMsg.newSearchParent;
e[a++]="</div><div id='";
e[a++]=n.id;
e[a++]="_folderTreeCell'></div></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#NewSearch"}
,false);
AjxTemplate.register("share.Dialogs#ZmMountFolderDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 width=375><tr><td colspan=2>";
e[a++]=ZmMsg.mountInstructions1;
e[a++]="</td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.emailLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_email'></td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.folderLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_folder'></td></tr><tr><td><br></td></tr><tr><td colspan=2>";
e[a++]=ZmMsg.mountInstructions2;
e[a++]="</td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.nameLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_name'></td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_color'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmMountFolderDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmPromptDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=2 cellspacing=0 border=0><tr><td class='Label' id='";
e[a++]=n.id;
e[a++]="_label'/></tr><tr><td><input type=";
e[a++]=n.type;
e[a++]=" autocomplete=OFF class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmPromptDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmPromptDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=2 cellspacing=0 border=0><tr><td class='Label'>";
e[a++]=ZmMsg.tagName;
e[a++]=":</td>";
if(appCtxt.multiAccounts){
e[a++]="<td class='Label'>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td class='Label'>";
e[a++]=ZmMsg.accountLabel;
e[a++]="</td>"
}
e[a++]="</tr><tr><td><input type=text autocomplete=OFF id='";
e[a++]=n.id;
e[a++]="_name' /></td><td id='";
e[a++]=n.id;
e[a++]="_tagColor' style="padding-right: 16px;"></td><td id='";
e[a++]=n.id;
e[a++]="_account'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmPromptDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmTimezonePicker",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=4 cellspacing=0 border=0><tr><td colspan='2' class='Label'>";
e[a++]=ZmMsg.selectTimezoneInfo;
e[a++]="</td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.selectTimezoneLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_tzSelect'></td></tr><tr><td></td><td id='";
e[a++]=n.id;
e[a++]="_tzShowAll'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmTimezonePicker"}
,false);
AjxTemplate.register("share.Dialogs#ZmAttachDialog-MyComputerTab",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div style='overflow:auto'><form accept-charset='utf-8' method='POST' action='";
e[a++]=n.uri;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_uploadForm' enctype='multipart/form-data'><input type='hidden' name='_charset_' /><table id='";
e[a++]=n.id;
e[a++]="_attachmentTable' cellspacing=0 cellpadding=0 border=0 class='iframeTable'></table></form></div><div><table id='";
e[a++]=n.id;
e[a++]="_attachmentButtonTable'></table></div>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmAttachDialog-MyComputerTab"}
,false);
AjxTemplate.register("share.Dialogs#ZmAttachDialog-MyComputerTab-AddAttachment",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellspacing=2 cellpadding=0 border=0><tr><td><div class='attachText'>";
e[a++]=ZmMsg.attach;
e[a++]=":</div></td><td class='nobreak'><input id='";
e[a++]=n.id;
e[a++]="_input' type='file' multiple name='";
e[a++]=n.uploadName;
e[a++]="' size=40>
";
e[a++]=" <span id='";
e[a++]=n.id;
e[a++]='_remove' onmouseover='this.style.cursor="pointer"' onmouseout='this.style.cursor="default"' class="ZmAttachDialog-removeLink">';
e[a++]=ZmMsg.remove;
e[a++]="</span><span id='";
e[a++]=n.id;
e[a++]="_size'> </span></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmAttachDialog-MyComputerTab-AddAttachment"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogRemote",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td colspan=2><table cellpadding=0 cellspacing=5 border=0><tr valign='center'><td class='Label'><input type='checkbox' id='";
e[a++]=n.id;
e[a++]="_remote' /></td><td>
";
e[a++]=" ";
e[a++]=n.remoteLabel;
e[a++]="
";
e[a++]=" </td></tr></table></td></tr><tr style='display:none;' id='";
e[a++]=n.id;
e[a++]="_remoteURLrow' valign='center'><td class='Label'>";
e[a++]=ZmMsg.urlLabel;
e[a++]="</td><td><input autocomplete='off' type='text' class='Field' id='";
e[a++]=n.id;
e[a++]="_remoteURLfield' /></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogRemote"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogName",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr valign='center'><td class='Label'>";
e[a++]=ZmMsg.nameLabel;
e[a++]="</td><td><input autocomplete='off' type='text' class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogName"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogColor",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td class='Label'>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_colorSelect'></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogColor"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogFolder",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td class='Label' colspan=2>";
e[a++]=ZmMsg.newFolderParent;
e[a++]="</td></tr><tr><td colspan=2 id='";
e[a++]=n.id;
e[a++]="_folderTree'></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogFolder"}
,false);
AjxTemplate.register("share.Dialogs#ZmSelectAddrDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<tr><td colspan=2> </td></tr><tr><td class="Label" style="padding-right: 5px">Addresses: </td><td id='';
e[a++]=n.id;
e[a++]="_addrListTd'></td></tr><tr><td colspan='2'><input id='";
e[a++]=n.id;
e[a++]="_cboxFind' type='checkbox' name='cbFind' checked></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmSelectAddrDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewCalDialogFreeBusy",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td colspan=2><table cellpadding=0 cellspacing=5 border=0><tr valign='center'><td class='Label'><input type='checkbox' id='";
e[a++]=n.id;
e[a++]="_excludeFbCheckbox' /></td><td>";
e[a++]=ZmMsg.excludeFromFreeBusy;
e[a++]="</td></tr></table></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewCalDialogFreeBusy"}
,false);
AjxTemplate.register("share.Dialogs#ZmRenameDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='0' cellspacing='0' border='0'><tr><td class='Label' colspan=2 style='padding: 0px 0px 5px 0px;'>";
e[a++]=n.newLabel;
e[a++]=": </td></tr><tr><td><input type='text' autocomplete='off' class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmRenameDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmPasswordUpdateDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='2' cellspacing='5' border='0'><tr><td colspan="2" id="";
e[a++]=n.id;
e[a++]="_desc"></td></tr><tr><td class='Label' align="right" style='padding:0 px;'>";
e[a++]=n.labelAcct;
e[a++]=': </td><td id="';
e[a++]=n.id;
e[a++]="_acct"></td></tr><tr><td class='Label' align="right" style='padding: 0 px;'>";
e[a++]=n.labelPasswd;
e[a++]=": </td><td><input type='password' style='padding:0 px;' autocomplete='off' class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmPasswordUpdateDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmTimeDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 width=330><tr><td colspan=2 id='";
e[a++]=n.id;
e[a++]="_description'>";
e[a++]=n.description;
e[a++]="</td></tr><tr><td class='Label'>";
e[a++]=n.label;
e[a++]=":</td><td><table border=0 cellpadding=0 cellspacing=0><tr><td>";
e[a++]=AjxTemplate.expand("#DateField",{
id:n.id+"_date"}
);
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_miniCal'></td><td> </td><td id='";
e[a++]=n.id;
e[a++]="_time'></td></tr></table></td></tr><tr><td width=50><nobr>";
e[a++]=ZmMsg.selectTimezoneLabel;
e[a++]="</nobr></td><td id='";
e[a++]=n.id;
e[a++]="_tzSelect'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmTimeDialog"}
,false);
AjxTemplate.register("share.Dialogs#DateField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<input autocomplete='off' style='height:22px;' type='text' size=14 id='";
e[a++]=n.id;
e[a++]="' value='";
e[a++]=n.value;
e[a++]="'>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#DateField"}
,false);
AjxTemplate.register("share.Dialogs#UploadDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<div style='overflow:auto'><div id="{id}_label" style="margin-bottom:0.5em;">';
e[a++]=ZmMsg.uploadChoose;
e[a++]="</div><div style="margin-bottom:0.5em;margin-left:1em;"><form accept-charset='utf-8' method='POST' action='";
e[a++]=n.uri;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_form' enctype='multipart/form-data'><table id='";
e[a++]=n.id;
e[a++]='_table' cellspacing=4 cellpadding=3 border=0></table></form></div><table border=0 cellpadding="0" cellspacing="4"><tr id="';
e[a++]=n.id;
e[a++]='_actionRow"><td>';
e[a++]=ZmMsg.uploadAction;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_conflict"></td></tr><tr><td colspan="2" id="';
e[a++]=n.id;
e[a++]='_notesTD"><div>';
e[a++]=ZmMsg.notesLabel;
e[a++]='</div><textarea id="';
e[a++]=n.id;
e[a++]='_notes" style="height: 80px; width: 450px;"></textarea></td></tr><tr><td colspan="2" id="';
e[a++]=n.id;
e[a++]='_info"></td></tr><tr><td colspan="2" id="';
e[a++]=n.id;
e[a++]='_msg"></td></tr></table></div>';
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#UploadDialog"}
,false)
}
if(AjxPackage.define("share.Quota")){
AjxTemplate.register("share.Quota#UsedLimited",function(t,r,s,e){
var n=Boolean(e);
s=(typeof s=="string"?{
id:s}
:s)||{};
e=e||[];
var o=e.length;
var a="quotaUsed";
if(s.percent<85&&s.percent>65){
a="quotaWarning"
}else{
if(s.percent>=85){
a="quotaCritical"
}}
e[o++]="<div class='BannerBar'><div class='quotabar'><div style='width:";
e[o++]=s.percent;
e[o++]="%' class='";
e[o++]=a;
e[o++]="'></div></div></div>";
return n?e.length:e.join("")
}
,{
id:"share.Quota#UsedLimited","class":"BannerBar"}
,false);
AjxTemplate.register("share.Quota",AjxTemplate.getTemplate("share.Quota#UsedLimited"),AjxTemplate.getParams("share.Quota#UsedLimited"));
AjxTemplate.register("share.Quota#UsedUnlimited",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='BannerTextQuota' style='display:none;'>";
e[a++]=n.desc;
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"share.Quota#UsedUnlimited"}
,false);
AjxTemplate.register("share.Quota#Tooltip",function(t,r,s,e){
var n=Boolean(e);
s=(typeof s=="string"?{
id:s}
:s)||{};
e=e||[];
var o=e.length;
if(s.username!=s.login){
e[o++]='<div style="text-align:center;">';
e[o++]=s.login;
e[o++]="</div>"
}
e[o++]='<div style="text-align:center;margin-top:3px;">';
if(s.quota){
var a=AjxMessageFormat.format(ZmMsg.quotaDescLimited,[s.size,s.limit]);
e[o++]=ZmMsg.quotaLabel;
e[o++]=" ";
e[o++]=s.percent;
e[o++]="% (";
e[o++]=a;
e[o++]=")
";
e[o++]=" "
}else{
e[o++]="
";
e[o++]=" ";
e[o++]=s.desc;
e[o++]="
";
e[o++]=" "
}
e[o++]="</div>";
return n?e.length:e.join("")
}
,{
id:"share.Quota#Tooltip"}
,false)
}
if(AjxPackage.define("share.Widgets")){
AjxTemplate.register("share.Widgets#ZmToolBarSeparator",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' valign='middle'><div class='vertSep'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmToolBarSeparator"}
,false);
AjxTemplate.register("share.Widgets",AjxTemplate.getTemplate("share.Widgets#ZmToolBarSeparator"),AjxTemplate.getParams("share.Widgets#ZmToolBarSeparator"));
AjxTemplate.register("share.Widgets#ZmAppChooser",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZToolbarTable' border=0 cellpadding=0 cellspacing=0><tr valign='bottom' id='";
e[a++]=n.id;
e[a++]="_items'><td id='";
e[a++]=n.id;
e[a++]='_suffix' valign=bottom><div class='ZAppTabSpacer'></div></td><td width="100%" valign="middle" align="right" style="padding-right: 10px;" id="admin_link_container">
';
e[a++]="
";
e[a++]=" </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAppChooser","class":"ZWidget"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("dwt.Widgets#ZToolbarItem",n);
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAppChooserItem"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"AppTab";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.Widgets#ZmAppChooserButton","class":"ZAppTab"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"AppTab";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.Widgets#ZmAppChooserButton","class":"ZAppTab"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserSpacer",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"AppTab";
t[o++]="<div class='Z";
t[o++]=e;
t[o++]="Spacer'></div>";
return n?t.length:t.join("")
}
,{
id:"share.Widgets#ZmAppChooserSpacer"}
,false);
AjxTemplate.register("share.Widgets#ZToast",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZToastBG'><div class='ZToastContent'><div id='";
e[a++]=n.id;
e[a++]="_icon' class='ZToastIcon'></div><div id='";
e[a++]=n.id;
e[a++]="_text' class='ZToastText'></div></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZToast","class":"ZToastInfo"}
,false);
AjxTemplate.register("share.Widgets#ZmSearchToolBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 height='100%'><tr><td id='";
e[a++]=n.id;
e[a++]="_inputField' class='ZmSearchToolbarCell'></td><td id='";
e[a++]=n.id;
e[a++]="_searchMenuButton' class='ZmSearchToolbarCell'></td><td id='";
e[a++]=n.id;
e[a++]="_searchButton' hint='text' class='ZmSearchToolbarCell'></td><!-- UNCOMMENT THIS IF YOU WANT CUSTOM SEARCH TO APPEAR AS A SEPARATE BUTTON ON SEARCH TOOLBAR
";
e[a++]=" <td class='ZmSearchToolbarSeparatorCell'><div id='";
e[a++]=n.id;
e[a++]="_customSearchButtonSep' class='vertSep' style='display:none'></div></td><td id='";
e[a++]=n.id;
e[a++]="_customSearchButton' class='ZmSearchToolbarCell'></td>
";
e[a++]=" --><td class='ZmSearchToolbarSeparatorCell'><div class='vertSep'></div></td><td id='";
e[a++]=n.id;
e[a++]="_saveButton' hint='text' class='ZmSearchToolbarCell'></td><td class='ZmSearchToolbarSeparatorCell'><div class='vertSep'></div></td><td id='";
e[a++]=n.id;
e[a++]="_advancedButton' hint='text' class='ZmSearchToolbarCell'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmSearchToolBar"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleSearchToolBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'><tr><td><div width='100%' class='ZmPeopleSearchToolbarDiv'><table border=0 cellpadding=0 cellspacing=0 class='ZmPeopleSearchToolbarTable'><tr><td id='";
e[a++]=n.id;
e[a++]="_inputField' width='100%'></td><td>";
e[a++]=AjxImg.getImageHtml("Search2");
e[a++]="</td></tr></table></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleSearchToolBar"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleAutocompleteListView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr id='";
e[a++]=n.rowId;
e[a++]=''><td><table border=0 style="{padding-top: 4px; padding-bottom: 4px}"><tr>';
if(n.photoUrl){
e[a++]='<td><img src="';
e[a++]=n.photoUrl;
e[a++]='" width=32 height=32></img></td>'
}else{
e[a++]="<td>";
e[a++]=AjxImg.getImageHtml("Person_32");
e[a++]="</td>"
}
e[a++]="<td><div class='ZmPeopleSearch-fullname' id='";
e[a++]=n.rowId;
e[a++]="-fullName'></div>";
if(n.title){
e[a++]="<div class='ZmPeopleSearch-title' id='";
e[a++]=n.rowId;
e[a++]="-title'>";
e[a++]=n.title;
e[a++]="</div>"
}
e[a++]="<? if (data.email){ ?><div id='";
e[a++]=n.rowId;
e[a++]="-email'></div><? } ?><? if (data.phone} { ?><div class='ZmPeopleSearch-phone' id='";
e[a++]=n.rowId;
e[a++]="-phone'>";
e[a++]=n.phone;
e[a++]="</div><? } ?></td></tr></table></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleAutocompleteListView"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleAutocompleteListView-NoResults",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr id='";
e[a++]=n.rowId;
e[a++]=''><td class="ZmPeopleSearch-noresults">';
e[a++]=ZmMsg.noCallResults;
e[a++]="</td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleAutocompleteListView-NoResults"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleAutocompleteListView-MoreResults",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td><table><tr><td width='32'> </td><td>";
e[a++]=ZmMsg.morePeopleResults;
e[a++]="</td></tr></table></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleAutocompleteListView-MoreResults"}
,false);
AjxTemplate.register("share.Widgets#ZmChooseFolderDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ChooserDialog'><span id='";
e[a++]=n.id;
e[a++]="_folderDescDivId' style='margin: 0; margin-bottom: 2px'></span><div>";
e[a++]=ZmMsg.chooserDescription;
e[a++]="</div><div id='";
e[a++]=n.id;
e[a++]="_inputDivId'></div><div class='overview' id='";
e[a++]=n.id;
e[a++]="_folderTreeDivId'></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmChooseFolderDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmChooseAccountDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ChooserDialog' style='width:300px'><table border=0 width=100%><tr><td><center><div id='";
e[a++]=n.id;
e[a++]="_chooseAccountMsg'></div><div id='";
e[a++]=n.id;
e[a++]="_accountSelectId'></div></center></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmChooseAccountDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmPickTagDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ChooserDialog'><div style='width:300px'>";
e[a++]=ZmMsg.chooserDescription;
e[a++]="</div><div id='";
e[a++]=n.id;
e[a++]="_inputDivId'></div><div style='background-color:white; width:100%; overflow:auto' id='";
e[a++]=n.id;
e[a++]="_tagTreeDivId'></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPickTagDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmDebugLogDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DebugLogDialog-desc' id='";
e[a++]=n.id;
e[a++]="_desc'></div><div class='DebugLogDialog-log' id='";
e[a++]=n.id;
e[a++]="_log'></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmDebugLogDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmDumpsterDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_toolbar'></div><div id='";
e[a++]=n.id;
e[a++]="_listview'></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmDumpsterDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmAddShareLink",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<a id="';
e[a++]=n.id;
e[a++]='_addshare_link" href="#">';
e[a++]=ZmMsg.sharedFoldersLink;
e[a++]="</a>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAddShareLink"}
,false);
AjxTemplate.register("share.Widgets#ZmShareProxyToolTip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<div style="width:250px"><div class="Img';
e[a++]=n.icon;
e[a++]='" style="float:left;vertical-align:top"></div><div style="font-weight:bold;font-size:1.1em;padding:3px;">';
e[a++]=AjxStringUtil.htmlEncode(n.normalizedFolderPath);
e[a++]='</div><div style="clear:both;"><table border="0" cellpadding="0" cellspacing="3"><tr valign="top"><th align="right">';
e[a++]=ZmMsg.ownerLabel;
e[a++]="</th><td>";
e[a++]=AjxStringUtil.htmlEncode(n.normalizedOwnerName);
e[a++]='</td></tr><tr valign="top"><th align="right">';
e[a++]=ZmMsg.granteeLabel;
e[a++]="</th><td>";
e[a++]=AjxStringUtil.htmlEncode(n.normalizedGranteeName);
e[a++]='</td></tr><tr valign="top"><th align="right">';
e[a++]=ZmMsg.roleLabel;
e[a++]="</th><td>";
e[a++]=n.roleName;
e[a++]=" (";
e[a++]=n.roleActions;
e[a++]=')</td></tr><tr height="4"><td></td><td></td></tr><tr valign="top"><th align="right">';
e[a++]=ZmMsg.noteLabel;
e[a++]='</th><td><div style="margin-top:4px;font-size:.9em;">';
e[a++]=AjxMessageFormat.format(ZmMsg.sharedFoldersLinkHint,[AjxStringUtil.htmlEncode(n.defaultMountpointName)]);
e[a++]="</div></td></tr></table></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmShareProxyToolTip"}
,false);
AjxTemplate.register("share.Widgets#ZmShareSearchView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<div class="FilterTree" style="width:300px;"><div id="';
e[a++]=n.id;
e[a++]='_FILTER" tabindex="100"></div><div id="';
e[a++]=n.id;
e[a++]='_TREE" tabindex="200"></div></div><table border="0" cellspacing="3" width="100%"><tr><td>';
e[a++]=ZmMsg.sharedFoldersFindLabel;
e[a++]='</td><td><div id="';
e[a++]=n.id;
e[a++]='_EMAIL" tabindex="300"></div></td><td><div id="';
e[a++]=n.id;
e[a++]='_SEARCH" tabindex="400"></div></td></tr><tr><td>';
e[a++]=ZmMsg.includeLabel;
e[a++]=":</td><td colspan='2'><div id="";
e[a++]=n.id;
e[a++]='_APP" tabindex="500"></div></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmShareSearchView"}
,false);
AjxTemplate.register("share.Widgets#ZmAddressInputField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.holderId;
e[a++]="' class='addrBubbleHolder-empty'><span id='";
e[a++]=n.dragInsertionBarId;
e[a++]="' style='display:none' class='addrBubbleInsertionBar'> </span><input id='";
e[a++]=n.inputId;
e[a++]="'></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAddressInputField"}
,false)
}
if(AjxPackage.define("zimbra.Widgets")){
AjxTemplate.register("zimbra.Widgets#ZmErrorDialogControls",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_buttons' class='DwtDialogButtonBar'>";
if(AjxEnv.isNav){
e[a++]="<input type='button' id='";
e[a++]=n.id;
e[a++]="_focus' style='height:0px;width:0px;display:none;'>"
}
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"zimbra.Widgets#ZmErrorDialogControls",height:"32",width:"20"}
,false);
AjxTemplate.register("zimbra.Widgets",AjxTemplate.getTemplate("zimbra.Widgets#ZmErrorDialogControls"),AjxTemplate.getParams("zimbra.Widgets#ZmErrorDialogControls"));
AjxTemplate.register("zimbra.Widgets#ZmErrorDialogContent",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' height='100%'><tr><td>";
e[a++]=n.message;
e[a++]="</td></tr>";
if(n.showDetails){
e[a++]="<tr><td><hr/></td></tr><tr><td style='height:100%;vertical-align:top;'>
";
e[a++]=" ";
e[a++]=n.detail;
e[a++]="
";
e[a++]=" </td></tr>"
}
e[a++]="</table>";
return o?e.length:e.join("")
}
,{
id:"zimbra.Widgets#ZmErrorDialogContent"}
,false);
AjxTemplate.register("zimbra.Widgets#ZmColorMenuItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder' cellspacing='0' cellpadding='0'><tr><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"zimbra.Widgets#ZmColorMenuItem","class":"ZWidget"}
,false)
};
/* Copyright (C) 2005-2009 Zimbra Inc. http://www.zimbra.com/ */
if(AjxPackage.define("Startup1_2")){
if(AjxPackage.define("zimbraMail.share.model.ZmObjectHandler")){
ZmObjectHandler=function(e,t){
if(arguments.length>0){
this.init(e,t)
}};
ZmObjectHandler.prototype.constructor=ZmObjectHandler;
ZmObjectHandler.prototype.init=function(e,t){
this._typeName=e;
this._className=t?t:"Object"
};
ZmObjectHandler.prototype.toString=function(){
if(!this._toString){
var e=""+this.constructor;
e=e.substring(0,e.indexOf("("));
this._toString=e.substring("function ".length)
}
return this._toString
};
ZmObjectHandler.prototype.getTypeName=function(){
return this._typeName
};
ZmObjectHandler.prototype.getClassName=function(a,e,t){
return this._className
};
ZmObjectHandler.prototype.getHoveredClassName=function(o,t,a){
var e=this.getClassName(o,t,a);
if(this._cachedClassNameForHovered!==e){
this._cachedClassNameForHovered=e;
this._classNameHovered=e+"-"+DwtCssStyle.HOVER
}
return this._classNameHovered
};
ZmObjectHandler.prototype.getActiveClassName=function(o,t,a){
var e=this.getClassName(o,t,a);
if(this._cachedClassNameForActive!==e){
this._cachedClassNameForActive=e;
this._classNameActive=e+"-"+DwtCssStyle.ACTIVE
}
return this._classNameActive
};
ZmObjectHandler.prototype.findObject=function(e,t){
if(t===0){
this._lastMatch=null;
this._noMatch=false
}
if(this._noMatch){
return null
}
if(this._lastMatch&&this._lastMatch.index>=t){
return this._lastMatch
}
this._lastMatch=this.match(e,t);
this._noMatch=(this._lastMatch===null);
return this._lastMatch
};
ZmObjectHandler.prototype.match=function(e,t){
return null
};
ZmObjectHandler.prototype._getHtmlContent=function(a,e,n,t,o){
a[e++]=AjxStringUtil.htmlEncode(n,true);
return e
};
ZmObjectHandler.prototype.generateSpan=function(o,e,s,n,a,t){
o[e++]="<span class='";
o[e++]=this.getClassName(s);
o[e++]="' id='";
o[e++]=n;
o[e++]="'>";
e=this._getHtmlContent(o,e,s,a,n,t);
o[e++]="</span>";
return e
};
ZmObjectHandler.prototype.hasToolTipText=function(t,e){
return true
};
ZmObjectHandler.prototype.getToolTipText=function(t,e){
return AjxStringUtil.htmlEncode(t)
};
ZmObjectHandler.prototype.populateToolTip=function(t,e){};
ZmObjectHandler.prototype.getActionMenu=function(a,t,e){
return null
};
ZmObjectHandler.prototype.selected=function(o,t,a,e){
return this.clicked(t,o,e,a)
};
ZmObjectHandler.prototype.clicked=function(t,o,e,a){};
ZmObjectHandler.prototype.hoverOver=function(t,o,e,s){
var a=DwtShell.getShell(window);
var n=a.getToolTip();
n.setContent(this.getToolTipText(t,o));
n.popup(e,s);
this.populateToolTip(t,o)
};
ZmObjectHandler.prototype.hoverOut=function(e,a){
var t=DwtShell.getShell(window);
var o=t.getToolTip();
o.popdown()
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmObjectManager")){
ZmObjectManager=function(t,e,a){
this._selectCallback=e;
this._uuid=Dwt.getNextId();
this._objectIdPrefix="OBJ_PREFIX_";
this._objectHandlers={};
if(appCtxt.get(ZmSetting.MAIL_ENABLED)&&window.ZmImageAttachmentObjectHandler){
this._imageAttachmentHandler=new ZmImageAttachmentObjectHandler()
}
if(!a){
this.initialized=false;
this._addAutoHandlers()
}else{
this.initialized=true
}
this.sortHandlers();
this.reset();
this.setView(t)
};
ZmObjectManager._TOOLTIP_DELAY=275;
ZmObjectManager.EMAIL="email";
ZmObjectManager.URL="url";
ZmObjectManager.PHONE="phone";
ZmObjectManager.DATE="date";
ZmObjectManager.ADDRESS="address";
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.useType=type
}
if(priority){
c.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===obj){
c.splice(i,1);
break
}}};
ZmObjectManager.prototype.toString=function(){
return"ZmObjectManager"
};
ZmObjectManager.prototype.getHandlers=function(){
if(!this.initialized&&appCtxt.zimletsPresent()){
var e=appCtxt.getZimletMgr();
if(e.isLoaded()){
this.initialized=true;
var a=e.getContentZimlets();
for(var t=0;
t<a.length;
t++){
this.addHandler(a[t],a[t].type,a[t].prio)
}}}
return this._objectHandlers
};
ZmObjectManager.prototype.addHandler=function(a,t,e){
t=t||(a.getTypeName()?a.getTypeName():"none");
e=e?e:-1;
a._prio=e;
var o=this.getHandlers();
if(!o[t]){
o[t]=[]
}
o[t].push(a)
};
ZmObjectManager.prototype.removeHandler=function(a,t){
t=t||(a.getTypeName()?a.getTypeName():"none");
var n=this.getHandlers();
if(n[t]){
for(var e=0,o=n[t].length;
e<o;
e++){
if(n[t][e]==a){
n[t].splice(e,1);
break
}}}};
ZmObjectManager.prototype.sortHandlers=function(){
this._allObjectHandlers=[];
var t=this.getHandlers();
for(i in t){
t.sort(ZmObjectManager.__byPriority);
for(var e=0;
e<t.length;
e++){
this._allObjectHandlers.push(t[e])
}}
this._allObjectHandlers.sort(ZmObjectManager.__byPriority)
};
ZmObjectManager.prototype._addAutoHandlers=function(){
var s=ZmObjectManager._autohandlers,e,o,n;
for(e=0;
e<s.length;
++e){
o=s[e];
var a=o;
var t=o.TYPE;
if(appCtxt.zimletsPresent()){
if(!(o instanceof ZmZimletBase)){
a=new o()
}}
if(o.useType){
t=o.useType
}
if(o.usePrio){
n=o.usePrio
}
this.addHandler(a,t,n)
}};
ZmObjectManager.prototype.reset=function(){
this._objects={}
};
ZmObjectManager.prototype.setView=function(e){
if(e!=null&&appCtxt.getZimletMgr().isLoaded()){
e.addListener(DwtEvent.ONMOUSEOVER,new AjxListener(this,this._mouseOverListener));
e.addListener(DwtEvent.ONMOUSEOUT,new AjxListener(this,this._mouseOutListener));
e.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._mouseDownListener));
e.addListener(DwtEvent.ONMOUSEUP,new AjxListener(this,this._mouseUpListener));
e.addListener(DwtEvent.ONMOUSEMOVE,new AjxListener(this,this._mouseMoveListener));
e.addListener(DwtEvent.ONCONTEXTMENU,new AjxListener(this,this._rightClickListener));
this._hoverOverListener=new AjxListener(this,this._handleHoverOver);
this._hoverOutListener=new AjxListener(this,this._handleHoverOut)
}
this._view=e
};
ZmObjectManager.prototype.objectsCount=function(){
return(appCtxt.zimletsPresent())?appCtxt.getZimletMgr().getContentZimlets().length:0
};
ZmObjectManager.prototype.getImageAttachmentHandler=function(){
return this._imageAttachmentHandler
};
ZmObjectManager.prototype._getAjxEmailAddress=function(e){
if(appCtxt.isChildWindow&&e.isAjxEmailAddress){
e=AjxEmailAddress.copy(e)
}
return e
};
ZmObjectManager.prototype.findObjects=function(f,e,o,m,a){
if(!f){
return""
}
var h=[];
var c=0;
var l=f.length;
var b=0;
var n=this.getHandlers();
while(true){
var w=null;
var p=l;
var u=null;
var y;
var d;
var r;
var s=null;
if(o){
d=n[o];
if(d){
for(y=0;
y<d.length;
y++){
s=d[y].findObject(f,b);
if(!s){
continue
}
if(s.index>=p){
break
}
w=s;
p=s.index;
u=d[y]
}}
if(o=="email"||f instanceof AjxEmailAddress){
if(u){
f=this._getAjxEmailAddress(f);
this.generateSpan(u,h,c,f,null,a)
}else{
h[c++]=AjxStringUtil.htmlEncode(f.toString())
}
return h.join("")
}}else{
for(var g=0;
g<this._allObjectHandlers.length;
g++){
var t=this._allObjectHandlers[g];
s=t.findObject(f,b);
if(s&&s.index<p){
w=s;
p=s.index;
u=t
}}}
if(!w){
r=f.substring(b,l);
if(e){
h[c++]=AjxStringUtil.htmlEncode(r,!!m)
}else{
h[c++]=r
}
break
}
if(p>b){
r=f.substring(b,p);
if(e){
h[c++]=AjxStringUtil.htmlEncode(r,!!m)
}else{
h[c++]=r
}}
if(u){
c=this.generateSpan(u,h,c,w[0],w.context)
}else{
h[c++]=w[0]
}
b=w.index+(w.matchLength||w[0].length)
}
return h.join("")
};
ZmObjectManager.prototype.processObjectsInNode=function(s,n){
var e=this;
var a=s.createElement("div");
s||(s=n.ownerDocument);
var o=function(l,c){
var u,m,h,p;
switch(l.nodeType){
case 1:l.normalize();
u=l.tagName.toLowerCase();
if(p==null){
if(/^(img|a)$/.test(u)){
var y=(u=="a"&&ZmMailMsgView._MAILTO_RE.test(l.href));
if(u=="a"&&l.target&&(y||ZmMailMsgView._URL_RE.test(l.href))){
var f=y?l.href:RegExp.$1;
u=s.createElement("div");
u.innerHTML=e.findObjects(AjxStringUtil.trim(f));
u=u.firstChild;
if(u.nodeType==3){
return u.nextSibling
}
l.parentNode.insertBefore(u,l);
u.innerHTML="";
u.appendChild(l);
return u.nextSibling
}
c=false
}}else{
l=p
}
if(parseFloat(l.style.textIndent)<0){
l.style.textIndent=""
}
for(m=l.firstChild;
m;
m=o(m,c)){}
return l.nextSibling;
case 3:case 4:if(c&&/[^sxA0]/.test(l.data)){
try{
var k=null,w=null;
if(!AjxEnv.isIE){
var d=/^[sxA0]+/.exec(l.data);
if(d){
k=l;
l=l.splitText(d[0].length)
}
d=/[sxA0]+$/.exec(l.data);
if(d){
w=l.splitText(l.data.length-d[0].length)
}}
u=a;
var r=e.findObjects(l.data,true,null,false);
var v=false;
if(AjxEnv.isIE){
u.innerHTML=["<pre>",r,"</pre>"].join("");
v=true
}else{
u.innerHTML=r
}
if(k){
u.insertBefore(k,u.firstChild)
}
if(w){
u.appendChild(w)
}
k=l.parentNode;
if(v){
u=u.firstChild
}
while(u.firstChild){
k.insertBefore(u.firstChild,l)
}
u=l.nextSibling;
k.removeChild(l);
return u
}
catch(g){}}}
return l.nextSibling
};
for(var t=0;
t<n.childNodes.length;
t++){
o(n.childNodes[t],true)
}};
ZmObjectManager.prototype.findObjectsInNode=function(a,t,n,s){
var o=this,h=a.ownerDocument,l=h.createElement("div");
if(!t){
t=/^(script|link|object|iframe|applet)$/i
}
var e=function(u,m){
var p,g,d,w;
switch(u.nodeType){
case 1:u.normalize();
p=u.tagName.toLowerCase();
if(s&&s.foreachElement){
w=s.foreachElement(u,p,t,n)
}
if(w==null){
if(/^(img|a)$/.test(p)){
if(p=="a"&&u.target&&(ZmMailMsgView._URL_RE.test(u.href)||ZmMailMsgView._MAILTO_RE.test(u.href))){
var y=RegExp.$1;
p=h.createElement("div");
p.innerHTML=o.findObjects(AjxStringUtil.trim(RegExp.$1));
p=p.firstChild;
if(p.nodeType==3){
return p.nextSibling
}
u.parentNode.insertBefore(p,u);
p.innerHTML="";
p.appendChild(u);
return p.nextSibling
}
m=false
}else{
if(t.test(p)||(n&&!n.test(p))){
p=u.nextSibling;
u.parentNode.removeChild(u);
return p
}}}else{
u=w
}
if(AjxEnv.isIE){
u.style.cssText=u.style.cssText
}
for(g=u.firstChild;
g;
g=e(g,m)){}
return u.nextSibling;
case 3:case 4:if(m&&/[^sxA0]/.test(u.data)){
try{
var q=null,k=null;
if(!AjxEnv.isIE){
var f=/^[sxA0]+/.exec(u.data);
if(f){
q=u;
u=u.splitText(f[0].length)
}
f=/[sxA0]+$/.exec(u.data);
if(f){
k=u.splitText(u.data.length-f[0].length)
}}
p=l;
var c=o.findObjects(u.data,true,null,false);
var x=false;
if(AjxEnv.isIE){
p.innerHTML=["<pre>",c,"</pre>"].join("");
x=true
}else{
p.innerHTML=c
}
if(q){
p.insertBefore(q,p.firstChild)
}
if(k){
p.appendChild(k)
}
q=u.parentNode;
if(x){
p=p.firstChild
}
while(p.firstChild){
q.insertBefore(p.firstChild,u)
}
p=u.nextSibling;
q.removeChild(u);
return p
}
catch(v){}}}
return u.nextSibling
};
var r=h.createDocumentFragment();
while(a.firstChild){
r.appendChild(a.firstChild);
e(r.lastChild,true,this)
}
a.appendChild(r)
};
ZmObjectManager.prototype.findMatch=function(r,h){
if(!r){
return""
}
var a=r.length;
var s=0;
var l=null;
var e=a;
var c=null;
var n;
var u=null;
if(h){
var t=this.getHandlers()[h];
if(t){
for(n=0;
n<t.length;
n++){
u=t[n].findObject(r,s);
if(!u){
continue
}
if(u.index>=e){
break
}
l=u;
e=u.index;
c=t[n]
}}}else{
for(var o=0;
o<this._allObjectHandlers.length;
o++){
var d=this._allObjectHandlers[o];
u=d.findObject(r,s);
if(u&&u.index<e){
l=u;
e=u.index;
c=d
}}}
return l
};
ZmObjectManager.prototype.processHtmlNode=function(l,h,y,u){
var w=l.ownerDocument;
h=h!=null?h:true;
var r=y instanceof RegExp?y:null;
if(!r){
y=y||["script","link","object","style","applet","iframe"];
y=y instanceof Array?y:[y];
r=new RegExp("^("+y.join("|")+")$","i")
}
var m=u instanceof RegExp?u:null;
if(!m&&u){
u=u instanceof Array?u:;
m=new RegExp("^("+u.join("|")+")$","i")
}
var f,c,v;
switch(l.nodeType){
case 1:l.normalize();
f=l.tagName.toLowerCase();
if(/^(img|a)$/.test(f)){
if(f=="a"&&(ZmMailMsgView._URL_RE.test(l.href)||ZmMailMsgView._MAILTO_RE.test(l.href))){
var n=RegExp.$1;
f=w.createElement("div");
f.innerHTML=this.findObjects(AjxStringUtil.trim(RegExp.$1));
f=f.firstChild;
if(f.nodeType==3){
return f.nextSibling
}
l.parentNode.insertBefore(f,l);
f.innerHTML="";
f.appendChild(l);
return f.nextSibling
}
h=false
}else{
if(r.test(f)){
f=l.nextSibling;
l.parentNode.removeChild(l);
return f
}else{
if(m&&m.test(f)){
f=l.nextSibling;
var e=w.createDocumentFragment();
for(var o=l.firstChild;
o;
o=o.nextSibling){
e.appendChild(o)
}
l.parentNode.replaceChild(e,l);
return f
}else{
if(f=="style"){
return l.nextSibling
}}}}
if(AjxEnv.isIE){
l.style.cssText=l.style.cssText
}
var o=l.firstChild;
while(o){
o=this.processHtmlNode(o,h,r,m)
}
return l.nextSibling;
case 3:case 4:if(h&&/[^sxA0]/.test(l.data)){
try{
var g=null,p=null;
if(!AjxEnv.isIE){
if(/^[sxA0]+/.test(l.data)){
g=l;
l=l.splitText(RegExp.lastMatch.length)
}
if(/[sxA0]+$/.test(l.data)){
p=l.splitText(l.data.length-RegExp.lastMatch.length)
}}
f=w.createElement("div");
var t=this.findObjects(l.data,true,null,false);
var s=false;
if(AjxEnv.isIE){
f.innerHTML=["<pre>",t,"</pre>"].join("");
s=true
}else{
f.innerHTML=t
}
if(g){
f.insertBefore(g,f.firstChild)
}
if(p){
f.appendChild(p)
}
g=l.parentNode;
if(s){
f=f.firstChild
}
while(f.firstChild){
g.insertBefore(f.firstChild,l)
}
f=l.nextSibling;
g.removeChild(l);
return f
}
catch(d){}}}
return l.nextSibling
};
ZmObjectManager.prototype.setHandlerAttr=function(o,t,n){
var e=this.getHandlers()[o];
if(e){
for(var a=0;
a<e.length;
a++){
e[a][t]=n
}}};
ZmObjectManager.prototype.generateSpan=function(n,o,e,s,a,t){
var r=this._objectIdPrefix+Dwt.getNextId();
if(n&&n.name){
r=r+"_"+n.name
}
this._objects[r]={
object:s,handler:n,id:r,context:a};
return n.generateSpan(o,e,s,r,a,t)
};
ZmObjectManager.prototype._findObjectSpan=function(t){
while(t&&(!t.id||t.id.indexOf(this._objectIdPrefix)!==0)){
t=t.parentNode
}
return t
};
ZmObjectManager.prototype._mouseOverListener=function(n){
var o=this._findObjectSpan(n.target);
if(!o){
return false
}
var e=this._objects[o.id];
if(!e){
return false
}
o.className=e.handler.getHoveredClassName(e.object,e.context,o.id);
if(e.handler.hasToolTipText()){
var a=DwtShell.getShell(window);
var t=a.getHoverMgr();
if((!t.isHovering()||t.getHoverObject()!=e)&&!DwtMenu.menuShowing()){
t.reset();
t.setHoverOverDelay(ZmObjectManager._TOOLTIP_DELAY);
t.setHoverObject(e);
t.setHoverOverData(e);
t.setHoverOverListener(this._hoverOverListener);
t.hoverOver(n.docX,n.docY);
n.hoverStarted=true
}}
n._returnValue=true;
n._dontCallPreventDefault=true;
return false
};
ZmObjectManager.prototype._mouseOutListener=function(n){
var o=this._findObjectSpan(n.target);
var e=o?this._objects[o.id]:null;
if(e){
o.className=e.handler.getClassName(e.object,e.context,o.id);
var a=DwtShell.getShell(window);
var t=a.getHoverMgr();
t.setHoverOutDelay(0);
t.setHoverOutData(e);
t.setHoverOutListener(this._hoverOutListener);
t.hoverOut()
}
return false
};
ZmObjectManager.prototype._mouseMoveListener=function(n){
n._returnValue=true;
n._dontCallPreventDefault=true;
n._stopPropagation=true;
var o=this._findObjectSpan(n.target);
var e=o?this._objects[o.id]:null;
if(e){
var a=DwtShell.getShell(window);
var t=a.getHoverMgr();
if(!t.isHovering()){
t.hoverOver(n.docX,n.docY)
}}
return false
};
ZmObjectManager.prototype._rightClickListener=function(e){
e.button=DwtMouseEvent.RIGHT;
return this._mouseDownListener(e)
};
ZmObjectManager.prototype._mouseDownListener=function(s){
s._dontCallPreventDefault=true;
s._returnValue=true;
s._stopPropagation=false;
var n=this._findObjectSpan(s.target);
if(!n){
return true
}
var t=this._objects[n.id];
if(!t){
return true
}
s._stopPropagation=true;
var o=DwtShell.getShell(window);
var a=o.getHoverMgr();
a.setHoverOutDelay(0);
a.setHoverOutData(t);
a.setHoverOutListener(this._hoverOutListener);
a.hoverOut();
n.className=t.handler.getActiveClassName(t.object,t.context,n.id);
if(s.button==DwtMouseEvent.RIGHT){
var e=(this._view instanceof DwtDialog);
var r=t.handler.getActionMenu(t.object,n,t.context,e);
if(r){
r.popup(0,s.docX,s.docY);
s._dontCallPreventDefault=false;
s._returnValue=false;
s._stopPropagation=true;
return true
}}else{
if(s.button==DwtMouseEvent.LEFT){
if(this._selectCallback){
this._selectCallback.run()
}
t.handler.selected(t.object,n,s,t.context);
return true
}}
return false
};
ZmObjectManager.prototype._mouseUpListener=function(a){
a._returnValue=true;
a._dontCallPreventDefault=true;
a._stopPropagation=true;
var t=this._findObjectSpan(a.target);
if(!t){
return false
}
var e=this._objects[t.id];
if(!e){
return false
}
t.className=e.handler.getHoveredClassName(e.object,e.context,t.id);
return false
};
ZmObjectManager.prototype._handleHoverOver=function(s){
if(!(s&&s.object)){
return
}
var n=this._findObjectSpan(s.target);
var o=s.object.handler;
var t=s.object.object;
var a=s.object.context;
var h=s.object.id;
var e=s.x;
var r=s.y;
o.hoverOver(t,a,e,r,n,h)
};
ZmObjectManager.prototype._handleHoverOut=function(n){
if(!(n&&n.object)){
return
}
var o=this._findObjectSpan(n.target);
var a=n.object.handler;
var e=n.object.object;
var t=n.object.context;
var s=n.object.id;
a.hoverOut(e,t,o,s)
};
ZmObjectManager.__byPriority=function(t,e){
return(e._prio<t._prio)-(t._prio<e._prio)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSettings")){
ZmSettings=function(e){
ZmModel.call(this,ZmEvent.S_SETTINGS);
this._settings={};
this._nameToId={};
this.getInfoResponse=null;
this._handleImplicitChange=new AjxListener(this,this._implicitChangeListener);
if(!e){
this.initialize()
}};
ZmSettings.prototype=new ZmModel;
ZmSettings.prototype.constructor=ZmSettings;
ZmSettings.BASE64_TO_NORMAL_RATIO=1.34;
ZmSettings.prototype.registerSetting=function(a,t){
ZmSetting[a]=a;
var e=this._settings[a]=new ZmSetting(a,t);
if(t.name){
this._nameToId[t.name]=a
}
if(t.isImplicit){
e.addChangeListener(this._handleImplicitChange)
}
return e
};
ZmSettings.prototype.toString=function(){
return"ZmSettings"
};
ZmSettings.prototype.initialize=function(){
this._initialize();
this._setDefaults();
this.userSettingsLoaded=false;
var e=new AjxListener(this,this._changeListener);
if(!appCtxt.multiAccounts){
this.getSetting(ZmSetting.QUOTA_USED).addChangeListener(e)
}
this.getSetting(ZmSetting.POLLING_INTERVAL).addChangeListener(e);
this.getSetting(ZmSetting.SKIN_NAME).addChangeListener(e);
this.getSetting(ZmSetting.LOCALE_NAME).addChangeListener(e);
this.getSetting(ZmSetting.SHORTCUTS).addChangeListener(e);
this.getSetting(ZmSetting.CHILD_ACCTS_VISIBLE).addChangeListener(e);
this.getSetting(ZmSetting.ATTACHMENTS_BLOCKED).addChangeListener(e);
if(appCtxt.isOffline){
this.getSetting(ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_IS_MAILTO_HANDLER).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_ACCOUNT_ID).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_INTERVAL).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_PATH).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_BACKUP_KEEP).addChangeListener(e);
this.getSetting(ZmSetting.OFFLINE_UPDATE_NOTIFY).addChangeListener(e)
}};
ZmSettings.prototype.get=function(t,e){
return(t&&this._settings[t])?this._settings[t].getValue(e):null
};
ZmSettings.prototype.getSetting=function(e){
return this._settings[e]
};
ZmSettings.prototype.createFromJs=function(s,h,r,c){
c=c==null||c;
for(var o in s){
var t=s[o];
var d=this._settings[this._nameToId[o]];
if(d){
if(d.dataType==ZmSetting.D_HASH){
var e=t.split(",");
var l={};
for(var a=0;
a<e.length;
a++){
var n=e[a].split(":");
l[n[0]]=n[1]
}
t=l
}
d.setValue(t,null,h,r,c);
if(ZmSetting.IS_IMPLICIT[d.id]){
d.origValue=d.copyValue()
}}else{}}};
ZmSettings.prototype.getSettingByName=function(e){
return this._nameToId[e]
};
ZmSettings.prototype.attrExists=function(t){
var e=this.getSetting(t).name;
return(this.getInfoResponse.prefs._attrs[e]||this.getInfoResponse.attrs._attrs[e])
};
ZmSettings.prototype.loadUserSettings=function(h,o,r,a,e){
var n=[h,r];
if(e){
var s=AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount");
var l=new AjxCallback(this,this._handleResponseLoadUserSettings,n);
e.addNewRequestParams(s,l)
}else{
var t={
soapDoc:(a?null:AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount")),accountName:r,asyncMode:true,callback:(new AjxCallback(this,this._handleResponseLoadUserSettings,n)),errorCallback:o,response:a};
appCtxt.getAppController().sendRequest(t)
}};
ZmSettings.prototype._handleResponseLoadUserSettings=function(a,t,e){
this.setUserSettings(e.getResponse().GetInfoResponse,t);
this.userSettingsLoaded=true;
if(a){
a.run(e)
}};
ZmSettings.prototype.setUserSettings=function(s){
s=Dwt.getParams(arguments,["info","accountName","setDefault","skipNotify","skipImplicit","preInit"]);
var t=this.getInfoResponse=s.info;
var u=s.accountName;
var d=s.preInit?false:s.setDefault;
var l=s.preInit?true:s.skipNotify;
var g=s.preInit?true:s.skipImplicit;
var o=[ZmSetting.ADMIN_DELEGATED,t.adminDelegated,ZmSetting.ATTACHMENT_SIZE_LIMIT,this._base64toNormalSize(t.attrs._attrs.zimbraMtaMaxMessageSize),ZmSetting.CHANGE_PASSWORD_URL,t.changePasswordURL,ZmSetting.DOCUMENT_SIZE_LIMIT,this._base64toNormalSize(t.attrs._attrs.zimbraFileUploadMaxSize),ZmSetting.LAST_ACCESS,t.accessed,ZmSetting.LICENSE_STATUS,t.license&&t.license.status,ZmSetting.PREVIOUS_SESSION,t.prevSession,ZmSetting.PUBLIC_URL,t.publicURL,ZmSetting.QUOTA_USED,t.used,ZmSetting.RECENT_MESSAGES,t.recent,ZmSetting.REST_URL,t.rest,ZmSetting.USERNAME,t.name,ZmSetting.EMAIL_VALIDATION_REGEX,t.zimbraMailAddressValidationRegex,ZmSetting.DISABLE_SENSITIVE_ZIMLETS_IN_MIXED_MODE,(t.domainSettings&&t.domainSettings.zimbraZimletDataSensitiveInMixedModeDisabled?t.domainSettings.zimbraZimletDataSensitiveInMixedModeDisabled:"FALSE")];
for(var r=0;
r<o.length;
r+=2){
var m=o[r+1];
if(m!=null){
this._settings[o[r]].setValue(m,null,d,l,g)
}}
if(t.attrs&&t.attrs._attrs){
this.createFromJs(t.attrs._attrs,d,l,g)
}
if(this.get(ZmSetting.ADMIN_DELEGATED)&&!this.get(ZmSetting.ADMIN_MAIL_ENABLED)){
this.getSetting(ZmSetting.MAIL_ENABLED).setValue(false)
}
if(s.preInit){
return
}
if(t.prefs&&t.prefs._attrs){
this.createFromJs(t.prefs._attrs,d,l,g)
}
if(!u){
appCtxt.accountList.createAccounts(this,t);
if(appCtxt.isOffline){
if(AjxEnv.isPrism&&window.platform){
var p=this._settings[ZmSetting.OFFLINE_SUPPORTS_MAILTO];
if(p){
p.setValue(true,null,d,l,g)
}
p=this._settings[ZmSetting.OFFLINE_SUPPORTS_DOCK_UPDATE];
if(p){
p.setValue(true,null,d,l,g)
}}
appCtxt.set(ZmSetting.SHARING_ENABLED,true,null,d,l)
}}
var p=this._settings[ZmSetting.REPLY_TO_ADDRESS];
if(p){
p.defaultValue=this.get(ZmSetting.USERNAME)
}
if(!this.get(ZmSetting.SEARCH_ENABLED)){
p=this._settings[ZmSetting.BROWSE_ENABLED];
if(p){
p.setValue(false,null,d,l,g)
}}
if(this.get(ZmSetting.FORCE_CAL_OFF)){
p=this._settings[ZmSetting.CALENDAR_ENABLED];
if(p){
p.setValue(false,null,d,l,g)
}}
if(!this.get(ZmSetting.OPTIONS_ENABLED)){
p=this._settings[ZmSetting.FILTERS_ENABLED];
if(p){
p.setValue(false,null,d,l,g)
}}
if(!u){
if(t.zimlets&&t.zimlets.zimlet){
if(this.get(ZmSetting.ZIMLETS_SYNCHRONOUS)){
var n=new AjxTimedAction(this,this._beginLoadZimlets,[t.zimlets.zimlet,t.props.prop,true]);
AjxTimedAction.scheduleAction(n,0)
}else{
var e=new AjxListener(this,this._beginLoadZimlets,[t.zimlets.zimlet,t.props.prop,false]);
appCtxt.getAppController().addListener(ZmAppEvent.POST_STARTUP,e)
}}else{
appCtxt.allZimletsLoaded()
}}
var m=appCtxt.get(ZmSetting.REPLY_INCLUDE_ORIG);
if(m){
var h=ZmMailApp.INC_MAP[m];
appCtxt.set(ZmSetting.REPLY_INCLUDE_WHAT,h[0],null,d,l);
appCtxt.set(ZmSetting.REPLY_USE_PREFIX,h[1],null,d,l);
appCtxt.set(ZmSetting.REPLY_INCLUDE_HEADERS,h[2],null,d,l)
}
var m=appCtxt.get(ZmSetting.FORWARD_INCLUDE_ORIG);
if(m){
var h=ZmMailApp.INC_MAP[m];
appCtxt.set(ZmSetting.FORWARD_INCLUDE_WHAT,h[0],null,d,l);
appCtxt.set(ZmSetting.FORWARD_USE_PREFIX,h[1],null,d,l);
appCtxt.set(ZmSetting.FORWARD_INCLUDE_HEADERS,h[2],null,d,l)
}
var c=ZmSettings.DEFAULT_SORT_PREF;
c[ZmId.VIEW_CONVLIST]=ZmSearch.DATE_DESC;
c[ZmId.VIEW_CONV]=ZmSearch.DATE_DESC;
c[ZmId.VIEW_TRAD]=ZmSearch.DATE_DESC;
c[ZmId.VIEW_CONTACT_SRC]=ZmSearch.NAME_ASC;
c[ZmId.VIEW_CONTACT_TGT]=ZmSearch.NAME_ASC;
c[ZmId.VIEW_CONTACT_SIMPLE]=ZmSearch.NAME_ASC;
c[ZmId.VIEW_CAL]=ZmSearch.DATE_ASC;
c[ZmId.VIEW_TASKLIST]=ZmSearch.DUE_DATE_ASC;
c[ZmId.VIEW_BRIEFCASE_DETAIL]=ZmSearch.SUBJ_ASC;
var a=this._settings[ZmSetting.SORTING_PREF];
if(a){
for(var f in c){
if(!a.getValue(f)){
a.setValue(c[f],f,false,true)
}}
a.setValue(ZmSearch.DATE_DESC,ZmId.VIEW_CONVLIST,false,true);
a.setValue(ZmSearch.DATE_DESC,ZmId.VIEW_CONV,false,true);
a.setValue(ZmSearch.DATE_DESC,ZmId.VIEW_TRAD,false,true);
a.defaultValue=AjxUtil.hashCopy(c)
}};
ZmSettings.prototype._beginLoadZimlets=function(e,o,t){
var a=new AjxCallback(this,this._loadZimletPackage,[e,o,t]);
AjxDispatcher.require(["Startup2"],false,a)
};
ZmSettings.prototype._loadZimletPackage=function(e,o,t){
var a=new AjxCallback(this,this._loadZimlets,[e,o,t]);
AjxDispatcher.require("Zimlet",false,a)
};
ZmSettings.prototype._loadZimlets=function(t,h,c){
t=t||[];
this.registerSetting("ZIMLETS",{
type:ZmSetting.T_CONFIG,defaultValue:t,isGlobal:true}
);
this.registerSetting("USER_PROPS",{
type:ZmSetting.T_CONFIG,defaultValue:h}
);
var o=this._getCheckedZimlets(t);
var a=appCtxt.getZimletMgr();
a.loadZimlets(o,h,null,null,c);
if(o&&o.length){
var e=appCtxt.getCurrentApp();
if(e){
var u;
if(appCtxt.multiAccounts){
var s=e.getOverviewContainer().containerId;
var d=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET];
var n=[s,d].join("_");
u=appCtxt.getOverviewController().getOverview(n)
}else{
u=e.getOverview()
}}
if(u){
u.setTreeView(ZmOrganizer.ZIMLET);
if(appCtxt.multiAccounts&&a.getPanelZimlets().length==0){
e.getOverviewContainer().removeZimletSection()
}}
if(appCtxt.get(ZmSetting.PORTAL_ENABLED)){
var r=appCtxt.getApp(ZmApp.PORTAL).getPortletMgr();
var l=r.createPortlets(true)
}}};
ZmSettings.prototype._getCheckedZimlets=function(a){
var o=[];
for(var t=0;
t<a.length;
t++){
var e=a[t];
if(e.zimletContext[0].presence!="disabled"){
o.push(e)
}}
return o
};
ZmSettings.prototype.loadPreferenceData=function(h){
var r=new ZmBatchCommand(null,appCtxt.accountList.mainAccount.name);
var s=AjxSoapDoc.create("GetAvailableSkinsRequest","urn:zimbraAccount");
var n=new AjxCallback(this,this._handleResponseLoadAvailableSkins);
r.addNewRequestParams(s,n);
var e=AjxSoapDoc.create("GetAvailableLocalesRequest","urn:zimbraAccount");
var o=new AjxCallback(this,this._handleResponseGetAllLocales);
r.addNewRequestParams(e,o);
var t=AjxSoapDoc.create("GetAvailableCsvFormatsRequest","urn:zimbraAccount");
var a=new AjxCallback(this,this._handleResponseGetAvailableCsvFormats);
r.addNewRequestParams(t,a);
r.run(h)
};
ZmSettings.prototype._handleResponseLoadAvailableSkins=function(e){
var n=e.getResponse().GetAvailableSkinsResponse;
var o=n.skin;
if(o&&o.length){
var a=appCtxt.accountList.mainAccount.settings.getSetting(ZmSetting.AVAILABLE_SKINS);
for(var t=0;
t<o.length;
t++){
a.setValue(o[t].name)
}}};
ZmSettings.prototype._handleResponseGetAllLocales=function(a){
var t=a._data.GetAvailableLocalesResponse.locale;
if(t&&t.length){
for(var o=0,n=t.length;
o<n;
o++){
var e=t[o];
e.id=e.id.replace(/^in/,"id");
ZmLocale.create(e.id,e.name)
}
this.getSetting(ZmSetting.LOCALE_CHANGE_ENABLED).setValue(ZmLocale.hasChoices())
}};
ZmSettings.prototype._handleResponseGetAvailableCsvFormats=function(t){
var e=t.getResponse().GetAvailableCsvFormatsResponse.csv;
if(e&&e.length){
var o=appCtxt.accountList.mainAccount.settings.getSetting(ZmSetting.AVAILABLE_CSVFORMATS);
for(var a=0;
a<e.length;
a++){
o.setValue(e[a].name)
}}};
ZmSettings.prototype.save=function(y,o,s,t,m){
if(!(y&&y.length)){
return
}
var r=t||appCtxt.getActiveAccount();
var b=AjxSoapDoc.create("ModifyPrefsRequest","urn:zimbraAccount");
var n=false;
var p=[],h={}
,c;
for(var g=0;
g<y.length;
g++){
c=y[g];
if(h[c.id]){
continue
}
if(c.type==ZmSetting.T_METADATA){
p.push(c);
r.metaData.update(c.section,c.name,c.getValue());
continue
}else{
if(c.type!=ZmSetting.T_PREF){
continue
}}
if(!c.name){
continue
}
if(c.dataType==ZmSetting.D_LIST){
var d=c.getValue();
if(d&&d.length){
for(var f=0;
f<d.length;
f++){
var u=b.set("pref",d[f]);
u.setAttribute("name",c.name)
}}else{
var u=b.set("pref","");
u.setAttribute("name",c.name)
}}else{
var d=c.getValue(null,true);
var u=b.set("pref",d);
u.setAttribute("name",c.name)
}
h[c.id]=true;
n=true
}
if(appCtxt.isOffline&&ZmSetting.IS_IMPLICIT[c.id]&&ZmSetting.IS_GLOBAL[c.id]){
r=appCtxt.accountList.mainAccount
}
if(p.length>0){
var e=new AjxCallback(this,this._handleResponseSaveMetaData,[p]);
var l=[ZmSetting.M_IMPLICIT,ZmSetting.M_OFFLINE];
r.metaData.save(l,e)
}
if(n){
var a;
if(o||s){
a=new AjxCallback(this,this._handleResponseSave,[y,o])
}
if(s){
s.addNewRequestParams(b,a)
}else{
appCtxt.getAppController().sendRequest({
soapDoc:b,asyncMode:true,callback:a,accountName:r.name,noBusyOverlay:m}
)
}}};
ZmSettings.prototype._handleResponseSaveMetaData=function(o,e){
for(var t=0;
t<o.length;
t++){
var a=o[t];
if(!ZmSetting.IS_IMPLICIT[a.id]){
a.origValue=a.copyValue();
a._notify(ZmEvent.E_MODIFY)
}}};
ZmSettings.prototype._handleResponseSave=function(o,s,e){
var n=e.getResponse();
if(n.ModifyPrefsResponse!=null){
for(var t=0;
t<o.length;
t++){
var a=o[t];
a.origValue=a.copyValue();
if(!ZmSetting.IS_IMPLICIT[a.id]){
a._notify(ZmEvent.E_MODIFY)
}}
this._notify(ZmEvent.E_MODIFY,{
settings:o}
)
}
if(s){
s.run(e)
}};
ZmSettings.DEFAULT_SORT_PREF={};
ZmSettings.prototype._setDefaults=function(){
var t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/soap/",qsReset:true}
);
this._settings[ZmSetting.CSFE_SERVER_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/home/~/",qsReset:true,qsArgs:{
auth:"co"}}
);
this._settings[ZmSetting.CSFE_MSG_FETCHER_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/upload",qsReset:true,qsArgs:{
lbfums:""}}
);
this._settings[ZmSetting.CSFE_UPLOAD_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/upload",qsReset:true}
);
this._settings[ZmSetting.CSFE_ATTACHMENT_UPLOAD_URI].setValue(t,null,false,true);
t=AjxUtil.formatUrl({
host:location.hostname,path:"/service/home/~/",qsReset:true,qsArgs:{
auth:"co",id:"{0}",fmt:"csv"}}
);
this._settings[ZmSetting.CSFE_EXPORT_URI].setValue(t,null,false,true);
var e=location.hostname;
var a=((e.indexOf(".zimbra.com")!=-1)||(window.appDevMode&&(/.local$/.test(e)||(!appCtxt.isOffline&&e=="localhost"))));
this._settings[ZmSetting.IS_DEV_SERVER].setValue(a);
if(a||window.isScriptErrorOn){
this._settings[ZmSetting.SHOW_SCRIPT_ERRORS].setValue(true,null,false,true)
}
this.setReportScriptErrorsSettings(AjxException,ZmController.handleScriptError)
};
ZmSettings.prototype.persistImplicitSortPrefs=function(e){
return ZmSettings.DEFAULT_SORT_PREF[e]
};
ZmSettings.prototype.setReportScriptErrorsSettings=function(t,a){
var e=t.reportScriptErrors=this._settings[ZmSetting.SHOW_SCRIPT_ERRORS].getValue();
if(e){
t.setScriptErrorHandler(a)
}};
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:"HELIX"}
);
this.registerSetting("CLIENT_DATETIME",{
type:ZmSetting.T_CONFIG,defaultValue:"20150521-0806"}
);
this.registerSetting("CLIENT_RELEASE",{
type:ZmSetting.T_CONFIG,defaultValue:"12052"}
);
this.registerSetting("CLIENT_VERSION",{
type:ZmSetting.T_CONFIG,defaultValue:"7.2.7 BETA"}
);
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",{
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("CHANGE_PASSWORD_URL",{
type:ZmSetting.T_CONFIG}
);
this.registerSetting("PUBLIC_URL",{
type:ZmSetting.T_CONFIG}
);
this.registerSetting("DISABLE_SENSITIVE_ZIMLETS_IN_MIXED_MODE",{
type:ZmSetting.T_CONFIG}
);
this.registerSetting("ASSISTANT_ENABLED",{
name:"zimbraFeatureZimbraAssistantEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("IM_ENABLED",{
name:"zimbraFeatureIMEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("ADMIN_MAIL_ENABLED",{
name:"zimbraFeatureAdminMailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
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("NOTEBOOK_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("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("MAIL_SEND_LATER_ENABLED",{
name:"zimbraFeatureMailSendLaterEnabled",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("BROWSE_ENABLED",{
name:"zimbraFeatureAdvancedSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
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("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("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("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("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("PEOPLE_SEARCH_ENABLED",{
name:"zimbraFeaturePeopleSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
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("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("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("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("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_DELEGATED_ADMIN",{
name:"zimbraIsDelegatedAdminAccount",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
this.registerSetting("ADMIN_REFERENCE",{
name:"zimbraWebClientAdminReference",type:ZmSetting.T_COS,dataType:ZmSetting.D_STRING}
);
this.registerSetting("ATTACHMENT_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("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:true}
);
this.registerSetting("MIXED_VIEW_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
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("ACCOUNTS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}
);
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_TEXT,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("DEFAULT_TIMEZONE",{
name:"zimbraPrefTimeZoneId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:AjxTimezone.getServerId(AjxTimezone.DEFAULT),isGlobal:true}
);
this.registerSetting("DEFAULT_PRINTFONTSIZE",{
name:"zimbraPrefDefaultPrintFontSize",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.PRINT_FONT_SIZE,isGlobal:true}
);
this.registerSetting("FILTERS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_HASH}
);
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_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_ADDR_BUBBLES",{
name:"zimbraPrefAutocompleteAddressBubblesEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue: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._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}
)
};
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_NOTEBOOK_SYNC_ENABLED",{
name:"zimbraPrefNotebookSyncEnabled",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_REMOTE_SERVER_VERSION",{
name:"offlineRemoteServerVersion",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:"http://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(o){
if(o.type!=ZmEvent.S_SETTING){
return
}
var r=o.source.id;
if(r==ZmSetting.QUOTA_USED){
appCtxt.getAppController().setUserInfo()
}else{
if(r==ZmSetting.POLLING_INTERVAL){
appCtxt.getAppController().setPollInterval()
}else{
if(r==ZmSetting.SKIN_NAME){
var s=appCtxt.getYesNoMsgDialog();
s.reset();
var n=o.source.getValue();
s.registerCallback(DwtDialog.YES_BUTTON,this._newSkinYesCallback,this,[n,s]);
s.setMessage(ZmMsg.skinChangeRestart,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
if(r==ZmSetting.LOCALE_NAME){
if(appCtxt.isOffline&&AjxEnv.isPrism){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var t=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
if(t){
var e=appCtxt.get(ZmSetting.LOCALE_NAME).replace("_","-");
t.setCharPref("general.useragent.locale",e);
t.setCharPref("intl.accept_languages",e)
}}
catch(a){}}
var s=appCtxt.getYesNoMsgDialog();
s.reset();
var n=o.source.getValue();
s.registerCallback(DwtDialog.YES_BUTTON,this._refreshBrowserCallback,this,[s]);
s.setMessage(ZmMsg.localeChangeRestart,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
if(r==ZmSetting.CHILD_ACCTS_VISIBLE||r==ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED){
var s=appCtxt.getYesNoMsgDialog();
s.reset();
s.registerCallback(DwtDialog.YES_BUTTON,this._refreshBrowserCallback,this,[s]);
s.setMessage(ZmMsg.accountChangeRestart,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
if(appCtxt.isOffline&&r==ZmSetting.OFFLINE_IS_MAILTO_HANDLER){
appCtxt.getAppController().registerMailtoHandler(true,o.source.getValue())
}else{
if(appCtxt.isOffline&&r==ZmSetting.OFFLINE_UPDATE_NOTIFY){
appCtxt.getAppController()._offlineUpdateChannelPref(o.source.getValue())
}}}}}}}};
ZmSettings.prototype._implicitChangeListener=function(t){
if(t.type!=ZmEvent.S_SETTING){
return
}
var a=t.source.id;
var e=this.getSetting(a);
if(a==ZmSetting.FOLDERS_EXPANDED&&window.duringExpandAll){
if(!window.afterExpandAllCallback){
window.afterExpandAllCallback=this.save.bind(this,[e],null,null,appCtxt.getActiveAccount(),true)
}
return
}
if(ZmSetting.IS_IMPLICIT[a]&&e){
this.save([e],null,null,appCtxt.getActiveAccount(),true)
}};
ZmSettings.prototype._newSkinYesCallback=function(a,t){
t.popdown();
window.onbeforeunload=null;
var e=AjxUtil.formatUrl({
qsArgs:{
skin:a}}
);
ZmZimbraMail.sendRedirect(e)
};
ZmSettings.prototype._refreshBrowserCallback=function(t){
t.popdown();
window.onbeforeunload=null;
var e=AjxUtil.formatUrl({}
);
window.location.replace(e)
};
ZmSettings.prototype._base64toNormalSize=function(e){
if(!e||e===-1){
return e
}
return e/ZmSettings.BASE64_TO_NORMAL_RATIO
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmMetaData")){
ZmMetaData=function(e,t){
this._sections={};
this._account=e;
this._itemId=t
};
ZmMetaData.prototype.constructor=ZmMetaData;
ZmMetaData.NAMESPACE="zwc";
ZmMetaData.prototype.toString=function(){
return"ZmMetaData"
};
ZmMetaData.prototype.set=function(u,n,e,m,s,h){
var c;
if(this._itemId){
c=AjxSoapDoc.create("SetCustomMetadataRequest","urn:zimbraMail");
c.getMethod().setAttribute("id",this._itemId)
}else{
c=AjxSoapDoc.create("SetMailboxMetadataRequest","urn:zimbraMail")
}
var f=c.set("meta");
f.setAttribute("section",[ZmMetaData.NAMESPACE,u].join(":"));
for(var o in n){
var r=n[o];
if(AjxUtil.isObject(r)){
r=ZmSetting.serialize(r,ZmSetting.D_HASH)
}
var l=c.set("a",r,f);
l.setAttribute("n",o)
}
if(e){
e.addNewRequestParams(c,m,s)
}else{
var t={
soapDoc:c,asyncMode:true,callback:m,errorCallback:s,accountName:(this._account?this._account.name:null),sensitive:h};
appCtxt.getAppController().sendRequest(t)
}};
ZmMetaData.prototype.get=function(r,e,l,o){
var t=e||(new ZmBatchCommand());
var a=[ZmMetaData.NAMESPACE,r].join(":");
var n=this._sections[a];
if(!n){
var s;
if(this._itemId){
s=AjxSoapDoc.create("GetCustomMetadataRequest","urn:zimbraMail");
s.getMethod().setAttribute("id",this._itemId)
}else{
s=AjxSoapDoc.create("GetMailboxMetadataRequest","urn:zimbraMail")
}
var h=s.set("meta");
h.setAttribute("section",a);
t.addNewRequestParams(s);
if(!e){
t.run(l,o)
}}else{
if(l){
l.run(n)
}else{
return n
}}};
ZmMetaData.prototype.load=function(s,n,t){
if(!s){
return
}
if(!(s instanceof Array)){
s=[s]
}
var a=t||(new ZmBatchCommand());
for(var e=0;
e<s.length;
e++){
if(s[e]==ZmSetting.M_OFFLINE&&!appCtxt.isOffline){
continue
}
this.get(s[e],a)
}
if(!t){
if(a.size()>0){
var o=new AjxCallback(this,this._handleLoad,[n]);
a.run(o)
}}else{
if(n){
n.run(this._sections)
}}};
ZmMetaData.prototype._handleLoad=function(s,e){
this._sections={};
var a=e.getResponse().BatchResponse;
if(a){
var n=(this._itemId!=null)?a.GetCustomMetadataResponse:a.GetMailboxMetadataResponse;
if(n&&n.length){
for(var t=0;
t<n.length;
t++){
var o=n[t].meta[0];
this._sections[o.section]=o._attrs
}}}
if(s){
s.run(this._sections)
}};
ZmMetaData.prototype.modify=function(l,o,e,c,s){
var h=AjxSoapDoc.create("ModifyMailboxMetadataRequest","urn:zimbraMail");
var d=h.set("meta");
d.setAttribute("section",[ZmMetaData.NAMESPACE,l].join(":"));
for(var n in o){
var r=h.set("a",o[n],d);
r.setAttribute("n",n)
}
if(e){
e.addNewRequestParams(h,c,s)
}else{
var t={
soapDoc:h,asyncMode:true,callback:c,errorCallback:s,accountName:(this._account?this._account.name:null)};
appCtxt.getAppController().sendRequest(t)
}};
ZmMetaData.prototype.save=function(h,l,e){
if(!h){
return
}
if(!(h instanceof Array)){
h=[h]
}
var r=this._account?this._account.name:null;
var t=e||(new ZmBatchCommand(null,r));
for(var o=0;
o<h.length;
o++){
var c=h[o];
var a=[ZmMetaData.NAMESPACE,c].join(":");
var n=this._sections[a];
if(n){
this.set(c,n,t)
}}
if(!e){
if(t.size()>0){
t.run(l)
}}else{
if(l){
l.run()
}}};
ZmMetaData.prototype.update=function(n,a,o){
var t=[ZmMetaData.NAMESPACE,n].join(":");
var e=this._sections[t];
if(!e){
e=this._sections[t]={}
}
e[a]=o
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmKeyMap")){
ZmKeyMap=function(){
ZmKeyMap._setPreconditions();
DwtKeyMap.call(this);
this._load(this._map,ZmKeys,ZmKeyMap.MAP_NAME);
if(appCtxt.get(ZmSetting.DEV)){
this._map.Global["Alt+Shift+D,0"]=ZmKeyMap.DBG_NONE;
this._map.Global["Alt+Shift+D,1"]=ZmKeyMap.DBG_1;
this._map.Global["Alt+Shift+D,2"]=ZmKeyMap.DBG_2;
this._map.Global["Alt+Shift+D,3"]=ZmKeyMap.DBG_3;
this._map.Global["Alt+Shift+D,T"]=ZmKeyMap.DBG_TIMING
}};
ZmKeyMap.prototype=new DwtKeyMap(true);
ZmKeyMap.prototype.constructor=ZmKeyMap;
ZmKeyMap.MAP_NAME={};
ZmKeyMap.MAP_NAME.address="ZmAddressBubble";
ZmKeyMap.MAP_NAME.briefcase="ZmBriefcaseController";
ZmKeyMap.MAP_NAME.calendar="ZmCalViewController";
ZmKeyMap.MAP_NAME.call="ZmCallListController";
ZmKeyMap.MAP_NAME.compose="ZmComposeController";
ZmKeyMap.MAP_NAME.contacts="ZmContactListController";
ZmKeyMap.MAP_NAME.conversation="ZmConvController";
ZmKeyMap.MAP_NAME.conversationList="ZmConvListController";
ZmKeyMap.MAP_NAME.editAppointment="ZmApptComposeController";
ZmKeyMap.MAP_NAME.editContact="ZmContactController";
ZmKeyMap.MAP_NAME.editPage="ZmPageEditController";
ZmKeyMap.MAP_NAME.editTask="ZmTaskController";
ZmKeyMap.MAP_NAME.global="Global";
ZmKeyMap.MAP_NAME.mail="ZmMailListController";
ZmKeyMap.MAP_NAME.message="ZmMsgController";
ZmKeyMap.MAP_NAME.mixed="ZmMixedController";
ZmKeyMap.MAP_NAME.notebook="ZmNotebookPageController";
ZmKeyMap.MAP_NAME.options="ZmPrefController";
ZmKeyMap.MAP_NAME.tasks="ZmTaskListController";
ZmKeyMap.MAP_NAME.voicemail="ZmVoicemailListController";
ZmKeyMap.MAP_NAME_R={};
(function(){
for(var e in ZmKeyMap.MAP_NAME){
ZmKeyMap.MAP_NAME_R[ZmKeyMap.MAP_NAME[e]]=e
}}
)();
ZmKeyMap.ADDRESS_PICKER="AddressPicker";
ZmKeyMap.ASSISTANT="Assistant";
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_SCHEDULE_VIEW="ScheduleView";
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.COPY="Copy";
ZmKeyMap.DBG_NONE="DebugNone";
ZmKeyMap.DBG_1="DebugLevel1";
ZmKeyMap.DBG_2="DebugLevel2";
ZmKeyMap.DBG_3="DebugLevel3";
ZmKeyMap.DBG_TIMING="ToggleDebugTiming";
ZmKeyMap.DEL="Delete";
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_NOTEBOOK="GoToNotebook";
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.LAST_UNREAD="LastUnread";
ZmKeyMap.LAST_UNREAD_MSG="LastUnreadMsg";
ZmKeyMap.LOGOFF="LogOff";
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.NEW="New";
ZmKeyMap.NEW_APPT="NewAppointment";
ZmKeyMap.NEW_BRIEFCASE="NewBriefcase";
ZmKeyMap.NEW_CALENDAR="NewCalendar";
ZmKeyMap.NEW_CHAT="NewChat";
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_NOTEBOOK="NewNotebook";
ZmKeyMap.NEW_PAGE="NewPage";
ZmKeyMap.NEW_PRESENTATION="NewPresentation";
ZmKeyMap.NEW_ROSTER_ITEM="NewRosterItem";
ZmKeyMap.NEW_SPREADSHEET="NewSpreadsheet";
ZmKeyMap.NEW_TAG="NewTag";
ZmKeyMap.NEW_TASK="NewTask";
ZmKeyMap.NEW_WINDOW="NewWindow";
ZmKeyMap.NEXT_CONV="NextConversation";
ZmKeyMap.NEXT_PAGE="NextPage";
ZmKeyMap.NEXT_UNREAD="NextUnread";
ZmKeyMap.NEXT_UNREAD_MSG="NextUnreadMsg";
ZmKeyMap.PASTE="Paste";
ZmKeyMap.PLAY="Play";
ZmKeyMap.PRESENCE_MENU="PresenceMenu";
ZmKeyMap.PREV_CONV="PreviousConversation";
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.UNDO="Undo";
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.ZmComposeController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmMailListController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmConvListController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmConvController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmMsgController=ZmSetting.MAIL_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmContactListController=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmContactController=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmCalViewController=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmApptComposeController=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmMixedController=ZmSetting.MIXED_VIEW_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmPrefController=ZmSetting.OPTIONS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmNotebookPageController=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmBriefcaseController=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmTaskListController=ZmSetting.TASKS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmTaskController=ZmSetting.TASKS_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmVoicemailListController=ZmSetting.VOICE_ENABLED;
ZmKeyMap.MAP_PRECONDITION.ZmCallListController=ZmSetting.VOICE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global={};
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.FOCUS_SEARCH_BOX]=ZmSetting.SEARCH_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_BRIEFCASE]=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_CALENDAR]=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_CONTACTS]=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_MAIL]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_NOTEBOOK]=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_OPTIONS]=ZmSetting.OPTIONS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_TASKS]=ZmSetting.TASKS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.GOTO_VOICE]=ZmSetting.VOICE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_APPT]=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_BRIEFCASEITEM]=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_CALENDAR]=ZmSetting.CALENDAR_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_CHAT]=ZmSetting.IM_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_CONTACT]=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_FILE]=ZmSetting.BRIEFCASE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_DOC]=ZmSetting.DOCS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_FOLDER]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_MESSAGE]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_MESSAGE_WIN]=ZmSetting.MAIL_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_NOTEBOOK]=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_PAGE]=ZmSetting.NOTEBOOK_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_ROSTER_ITEM]=ZmSetting.IM_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_TAG]=ZmSetting.TAGGING_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.NEW_TASK]=ZmSetting.TASKS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.PRESENCE_MENU]=ZmSetting.IM_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.SAVED_SEARCH]=ZmSetting.SAVED_SEARCHES_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.TAG]=ZmSetting.TAGGING_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.Global[ZmKeyMap.UNTAG]=ZmSetting.TAGGING_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController={};
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.ADDRESS_PICKER]=ZmSetting.CONTACTS_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.HTML_FORMAT]=ZmSetting.HTML_COMPOSE_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.NEW_WINDOW]=ZmSetting.NEW_WINDOW_COMPOSE;
ZmKeyMap.ACTION_PRECONDITION.ZmComposeController[ZmKeyMap.SAVE]=ZmSetting.SAVE_DRAFT_ENABLED;
ZmKeyMap.ACTION_PRECONDITION.ZmApptComposeController={};
ZmKeyMap.ACTION_PRECONDITION.ZmApptComposeController[ZmKeyMap.HTML_FORMAT]=ZmSetting.HTML_COMPOSE_ENABLED
};
ZmKeyMap.prototype._checkMap=function(a){
var t;
var e=ZmKeyMap.MAP_PRECONDITION[a];
if(!e){
t=true
}else{
if(typeof e=="string"||typeof e=="number"){
t=appCtxt.get(e)
}else{
if(typeof e=="function"){
t=e()
}}}
this._checkedMap[a]=t;
return t
};
ZmKeyMap.prototype._checkAction=function(t,a){
if((this._checkedMap[t]===false)||(!this._checkedMap[t]&&!this._checkMap(t))){
return false
}
var e=ZmKeyMap.ACTION_PRECONDITION[t];
if(!e){
return true
}
var o=e[a];
if(!o){
return true
}
if(typeof o=="string"||typeof o=="number"){
return appCtxt.get(o)
}else{
if(typeof o=="function"){
return o()
}}
return true
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTimezone")){
ZmTimezone=function(){};
ZmTimezone.getDefault=function(){
var t=DwtShell.getShell(window);
var e=appCtxt.get(ZmSetting.DEFAULT_TIMEZONE);
return(e)?AjxTimezone.getClientId(e):AjxTimezone.DEFAULT
};
ZmTimezone.getDefaultRule=function(){
return AjxTimezone.getRule(ZmTimezone.getDefault())
};
ZmTimezone.set=function(n,t,e,o){
var a=AjxTimezone.getRule(t);
if(!a){
return
}
if(a.autoDetected||!o){
if(n instanceof AjxSoapDoc){
ZmTimezone._setSoap(n,t,e,a)
}else{
ZmTimezone._setJson(n,t,a)
}}};
ZmTimezone._setSoap=function(f,r,d,u){
var s=f.set("tz",null,d);
var t=AjxTimezone.getServerId(r);
s.setAttribute("id",t);
if(u.autoDetected){
s.setAttribute("stdoff",u.standard.offset);
if(u.daylight){
s.setAttribute("dayoff",u.daylight.offset);
var m=["standard","daylight"];
var e=["mon","mday","week","wkday","hour","min","sec"];
for(var l=0;
l<m.length;
l++){
var o=m[l];
var c=u[o];
var a=f.set(o,null,s);
for(var h=0;
h<e.length;
h++){
var n=e[h];
if(n in c){
a.setAttribute(n,c[n])
}}}}}};
ZmTimezone._setJson=function(h,s,d){
var t=AjxTimezone.getServerId(s);
var n=h.tz={
id:t};
if(d.autoDetected){
n.stdoff=d.standard.offset;
if(d.daylight){
n.dayoff=d.daylight.offset;
var u=["standard","daylight"];
var e=["mon","mday","week","wkday","hour","min","sec"];
for(var l=0;
l<u.length;
l++){
var a=u[l];
var c=d[a];
n[a]={};
for(var r=0;
r<e.length;
r++){
var o=e[r];
if(o in c){
n[a][o]=c[o]
}}}}}}
}
if(AjxPackage.define("zimbraMail.share.model.ZmItem")){
ZmItem=function(t,o,a,e){
if(arguments.length==0){
return
}
ZmModel.call(this,t);
this.type=t;
this.id=o;
this.list=a;
this.tags=[];
this.tagHash={};
this.folderId=0;
if(o&&!e){
appCtxt.cacheSet(o,this)
}};
ZmItem.prototype=new ZmModel;
ZmItem.prototype.constructor=ZmItem;
ZmItem.APP={};
ZmItem.MSG_KEY={};
ZmItem.COUNT_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_SUBJECT=ZmId.FLD_SUBJECT;
ZmItem.F_TAG=ZmId.FLD_TAG;
ZmItem.F_TAG_CELL=ZmId.FLD_TAG_CELL;
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.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_LOW_PRIORITY="?";
ZmItem.FLAG_HIGH_PRIORITY="!";
ZmItem.ALL_FLAGS=[ZmItem.FLAG_FLAGGED,ZmItem.FLAG_ATTACH,ZmItem.FLAG_UNREAD,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_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_LOW_PRIORITY]="isLowPriority";
ZmItem.FLAG_PROP[ZmItem.FLAG_HIGH_PRIORITY]="isHighPriority";
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(e,t){
if(t.app){
ZmItem.APP[e]=t.app
}
if(t.nameKey){
ZmItem.MSG_KEY[e]=t.nameKey
}
if(t.countKey){
ZmItem.COUNT_KEY[e]=t.countKey
}
if(t.icon){
ZmItem.ICON[e]=t.icon
}
if(t.soapCmd){
ZmItem.SOAP_CMD[e]=t.soapCmd
}
if(t.itemClass){
ZmList.ITEM_CLASS[e]=t.itemClass
}
if(t.node){
ZmList.NODE[e]=t.node
}
if(t.organizer){
ZmOrganizer.ITEM_ORGANIZER[e]=t.organizer
}
if(t.searchType){
ZmSearch.TYPE[e]=t.searchType
}
if(t.resultsList){
ZmItem.RESULTS_LIST[e]=t.resultsList
}
if(t.node){
ZmList.ITEM_TYPE[t.node]=e
}
if(t.dropTargets){
if(!ZmApp.DROP_TARGETS[t.app]){
ZmApp.DROP_TARGETS[t.app]={}
}
ZmApp.DROP_TARGETS[t.app][e]=t.dropTargets
}};
ZmItem.getItemId=function(t){
if(!t){
return t
}
if(!ZmItem.SHORT_ID_RE){
var e=DwtShell.getShell(window);
ZmItem.SHORT_ID_RE=new RegExp(appCtxt.get(ZmSetting.USERID)+":","gi")
}
return t.replace(ZmItem.SHORT_ID_RE,"")
};
ZmItem.prototype.create=function(e){};
ZmItem.prototype.modify=function(e){};
ZmItem.prototype.getById=function(e){
if(e==this.id){
return this
}};
ZmItem.prototype.getAccount=function(){
if(!this.account){
var o;
if(this.folderId){
var a=window.parentAppCtxt||window.appCtxt;
var t=a.getById(this.folderId);
o=t&&t.getAccount()
}
if(!o){
var e=ZmOrganizer.parseId(this.id);
o=e&&e.account
}
this.account=o
}
return this.account
};
ZmItem.prototype.clear=function(){
this._evtMgr.removeAll(ZmEvent.L_MODIFY);
if(this.tags.length){
for(var e=0;
e<this.tags.length;
e++){
this.tags[e]=null
}
this.tags=[]
}
for(var e in this.tagHash){
this.tagHash[e]=null
}
this.tagHash={}
};
ZmItem.prototype.cache=function(){
if(this.id){
appCtxt.cacheSet(this.id,this);
return true
}
return false
};
ZmItem.prototype.hasTag=function(e){
return(this.tagHash[e]==true)
};
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 a=ZmOrganizer.ITEM_ORGANIZER[this.type];
var e=appCtxt.getById(this.folderId);
var t=e?([e.getRestUrl(),"/",AjxStringUtil.urlComponentEncode(this.name)].join("")):null;
return t
};
ZmItem.prototype.getTagImageInfo=function(){
var t;
var o=appCtxt.getSearchController().searchAllAccounts;
if(!this.tags.length||(!o&&this.isShared())){
t="Blank_16"
}else{
if(this.tags.length==1){
var a=(!this.getAccount().isMain)?([this.getAccount().id,this.tags[0]].join(":")):(ZmOrganizer.getSystemId(this.tags[0]));
var e=appCtxt.getById(a);
t=e?e.getIconWithColor():"Blank_16"
}else{
t="TagStack"
}}
return t
};
ZmItem.prototype.getDefaultDndAction=function(e){
return(this.isReadOnly()||e)?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{
var t=appCtxt.getActiveAccount();
var e=String(this.id);
this._isShared=((e.indexOf(":")!=-1)&&(e.indexOf(t.id)!=0))
}}
return this._isShared
};
ZmItem.prototype.notifyDelete=function(){
this.deleteLocal();
if(this.list){
this.list.deleteLocal([this])
}
this._notify(ZmEvent.E_DELETE)
};
ZmItem.prototype.notifyModify=function(r,h){
if(r.t!=null){
this._parseTags(r.t);
this._notify(ZmEvent.E_TAGS)
}
if(r.f!=null){
var a=this._getFlags();
var s={};
for(var n=0;
n<a.length;
n++){
s[a[n]]=this[ZmItem.FLAG_PROP[a[n]]]
}
this._parseFlags(r.f);
var t=[];
for(var n=0;
n<a.length;
n++){
var e=this[ZmItem.FLAG_PROP[a[n]]];
if(s[a[n]]!=e){
t.push(a[n])
}}
if(t.length){
this._notify(ZmEvent.E_FLAGS,{
flags:t}
)
}}
if(r.l!=null&&r.l!=this.folderId){
var o={
oldFolderId:this.folderId};
this.moveLocal(r.l);
if(this.list){
this.list.moveLocal([this],r.l)
}
if(h){
delete r.l;
return ZmEvent.E_MOVE
}else{
this._notify(ZmEvent.E_MOVE,o)
}}};
ZmItem.prototype.flagLocal=function(t,e){
this[ZmItem.FLAG_PROP[t]]=e
};
ZmItem.prototype.setFlag=function(a,t){
this.flagLocal(a,t);
var e=this.flags||"";
if(t&&e.indexOf(a)==-1){
e=e+a
}else{
if(!t&&e.indexOf(a)!=-1){
e=e.replace(a,"")
}}
this.flags=e;
return e
};
ZmItem.prototype.tagLocal=function(a,o){
var t=false;
if(o){
if(!this.tagHash[a]){
t=true;
this.tags.push(a);
this.tagHash[a]=true
}}else{
for(var e=0;
e<this.tags.length;
e++){
if(this.tags[e]==a){
this.tags.splice(e,1);
delete this.tagHash[a];
t=true;
break
}}}
return t
};
ZmItem.prototype.removeAllTagsLocal=function(){
this.tags=[];
for(var e in this.tagHash){
delete this.tagHash[e]
}};
ZmItem.prototype.deleteLocal=function(){};
ZmItem.prototype.move=function(e,a,t){
return ZmItem.move(this.id,e,a,t)
};
ZmItem.move=function(s,e,r,t,a){
var o={
ItemActionRequest:{
_jsns:"urn:zimbraMail",action:{
id:s instanceof Array?s.join():s,op:"move",l:e}}};
var n={
jsonObj:o,asyncMode:Boolean(r),callback:r,errorCallback:t,accountName:a};
return appCtxt.getAppController().sendRequest(n)
};
ZmItem.prototype.moveLocal=function(e){
this.folderId=e
};
ZmItem.prototype._parseTags=function(o){
this.tags=[];
this.tagHash={};
if(o&&o.length){
var e=o.split(",");
for(var t=0;
t<e.length;
t++){
var a=Number(e[t]);
if(a>=ZmOrganizer.FIRST_USER_ID[ZmOrganizer.TAG]){
this.tagLocal(a,true)
}}}};
ZmItem.prototype._parseFlags=function(o){
this.flags=o;
for(var a=0;
a<ZmItem.ALL_FLAGS.length;
a++){
var t=ZmItem.ALL_FLAGS[a];
var e=(o&&(o.indexOf(t)!=-1))?true:false;
this.flagLocal(t,e)
}};
ZmItem.prototype._notify=function(t,e){
ZmModel.prototype._notify.call(this,t,e);
if(this.list){
if(e){
e.items=[this]
}else{
e={
items:[this]}
}
this.list._evt.item=this;
this.list._evt.items=[this];
this.list._notify(t,e)
}};
ZmItem.prototype._getFlags=function(){
return[ZmItem.FLAG_FLAGGED,ZmItem.FLAG_ATTACH]
};
ZmItem.prototype.rename=function(e,a,t){
return ZmItem.rename(this.id,e,a,t)
};
ZmItem.rename=function(s,e,r,t,a){
var o={
ItemActionRequest:{
_jsns:"urn:zimbraMail",action:{
id:s instanceof Array?s[0]:s,op:"rename",name:e}}};
var n={
jsonObj:o,asyncMode:Boolean(r),callback:r,errorCallback:t,accountName:a};
return appCtxt.getAppController().sendRequest(n)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmActionStack")){
ZmActionStack=function(e){
this._stack=[];
this._pointer=-1;
this._maxLength=e||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(o){
var r=o.op;
var l=[];
if(o.items){
for(var s=0;
s<o.items.length;
s++){
var u=o.items[s];
if(u&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,u.type)!=-1)){
l.push(u)
}}}else{
if(o.item){
if(o.item&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,o.item.type)!=-1)){
l.push(o.item)
}}else{
if(o.ids){
for(var s=0;
s<o.ids.length;
s++){
var u=appCtxt.getById(o.ids[s]);
if(u&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,u.type)!=-1)){
l.push(u)
}}}else{
if(o.id){
var u=appCtxt.getById(o.id);
if(u&&(!ZmActionStack.validTypes||AjxUtil.indexOf(ZmActionStack.validTypes,u.type)!=-1)){
l.push(u)
}}}}}
for(var s=0;
s<l.length;
s++){
if(l[s] instanceof ZmConv){
var c=l[s].getMsgList();
for(var n=0;
n<c.length;
n++){
if(AjxUtil.indexOf(c[n])==-1){
l.push(c[n])
}}}}
var d=o.attrs;
var h=l.length>1;
var a=null;
var t;
switch(r){
case"trash":t=ZmFolder.ID_TRASH;
break;
case"spam":t=ZmFolder.ID_SPAM;
break;
case"move":case"!spam":t=d.l;
break
}
var e=appCtxt.getById(t);
if(e&&!e.isRemote()){
switch(r){
case"trash":case"move":case"spam":case"!spam":for(var s=0;
s<l.length;
s++){
var u=l[s];
var m;
if(u instanceof ZmItem){
if(!u.isShared()){
m=new ZmItemMoveAction(u,u.getFolderId(),t,r)
}}else{
if(u instanceof ZmOrganizer){
if(!u.isRemote()){
m=new ZmOrganizerMoveAction(u,u.parent.id,t,r)
}}}
if(m){
if(h){
if(!a){
a=new ZmCompositeAction()
}
a.addAction(m)
}else{
a=m
}}}
break
}
if(a){
this._push(a)
}}
return a
};
ZmActionStack.prototype.canUndo=function(){
return this._pointer>=0
};
ZmActionStack.prototype.canRedo=function(){
return this._pointer<this._stack.length-1
};
ZmActionStack.prototype.undo=function(){
if(this.canUndo()){
var e=this._pop();
e.undo()
}};
ZmActionStack.prototype.redo=function(){
if(this.canRedo()){
var e=this._stack[++this._pointer];
e.redo()
}};
ZmActionStack.prototype._push=function(t){
if(t&&t instanceof ZmAction){
var e=this._pointer+1;
while(this._maxLength&&e>=this._maxLength){
this._stack.shift();
e--
}
this._stack[e]=t;
this._stack.length=e+1;
this._pointer=e
}};
ZmActionStack.prototype._pop=function(){
return this.canUndo()?this._stack[this._pointer--]:null
}
}
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(){
this._complete=true;
this._notify(ZmEvent.E_COMPLETE)
};
ZmAction.prototype.getComplete=function(){
return this._complete
};
ZmItemAction=function(e,t){
if(!arguments.length){
return
}
ZmAction.call(this);
this._item=e;
this._op=t
};
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(e,t){
if(!arguments.length){
return
}
ZmAction.call(this);
this._organizer=e;
this._op=t
};
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(t,e,o,a){
ZmItemAction.call(this,t,a);
this._fromFolderId=e;
this._toFolderId=o
};
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(a,t,e){
this._item.list.moveItems({
items:[this._item],folder:appCtxt.getById(e),noUndo:true,finalCallback:new AjxCallback(this,this._handleDoMove,[this._item.folderId,e]),actionText:ZmItemMoveAction.UNDO_MSG[this._op],fromFolderId:this._toFolderId}
)
};
ZmItemMoveAction.prototype._handleDoMove=function(n,a,r){
var e=[];
for(var h in r.idHash){
var o=r.idHash[h];
if(o instanceof ZmConv){
o.folderId=a
}
var s=o&&o.list;
if(AjxUtil.indexOf(e,s)==-1){
e.push(s)
}}
for(var t=0;
t<e.length;
t++){
e[t]._notify(ZmEvent.E_MOVE,{
oldFolderId:n}
)
}
ZmList.killProgressDialog(r.actionSummary)
};
ZmItemMoveAction.prototype.undo=function(t,e){
this._doMove(t,e,this._fromFolderId)
};
ZmItemMoveAction.prototype.redo=function(t,e){
this._doMove(t,e,this._toFolderId)
};
ZmItemMoveAction.multipleUndo=function(n,l){
var u=n&&n.length&&n[0];
var e={};
for(var s=0;
s<n.length;
s++){
var o=n[s];
if(o instanceof ZmItemMoveAction){
var f=o.getFromFolderId();
var p=o.getToFolderId();
var g=o.getItem();
var d=(g&&g.list&&g.list.type)||0;
if(!e[f]){
e[f]={}
}
if(!e[f][p]){
e[f][p]={}
}
if(!e[f][p][d]){
e[f][p][d]=[]
}
e[f][p][d].push(o)
}}
for(var f in e){
for(var p in e[f]){
for(var d in e[f][p]){
var a=e[f][p][d];
var c=[];
var h=null;
var t=false;
var m;
for(var s=0;
s<a.length;
s++){
var o=a[s];
if(o==u){
t=true
}
var g=o.getItem();
c.push(g);
if(!h&&g.list){
h=g.list
}
var r=o.getOp&&o.getOp();
if(!m){
m=r
}else{
if(m!=r){
m="move"
}}}
if(h){
h.moveItems({
items:c,folder:appCtxt.getById(l?p:f),noUndo:true,actionText:t?(m&&ZmItemMoveAction.UNDO_MSG[m]):null}
)
}}}}};
ZmItemMoveAction.multipleRedo=function(e){
ZmItemMoveAction.multipleUndo(e,true)
};
ZmOrganizerMoveAction=function(e,t,o,a){
ZmOrganizerAction.call(this,e,a);
this._fromFolderId=t;
this._toFolderId=o
};
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(o,t,e){
var a=appCtxt.getById(e);
if(a){
this._organizer.move(a,true,ZmMsg.actionUndoMove)
}};
ZmOrganizerMoveAction.prototype.undo=function(t,e){
this._doMove(t,e,this._fromFolderId)
};
ZmOrganizerMoveAction.prototype.redo=function(t,e){
this._doMove(t,e,this._toFolderId)
};
ZmOrganizerMoveAction.multipleUndo=function(o,e){
for(var t=0;
t<o.length;
t++){
var a=o[t];
if(a instanceof ZmOrganizerMoveAction){
a._doMove(null,null,e?this._toFolderId:this._fromFolderId)
}}};
ZmOrganizerMoveAction.multipleRedo=function(e){
ZmItemMoveAction.multipleUndo(e,true)
};
ZmCompositeAction=function(){
ZmAction.call(this);
this._actions={}
};
ZmCompositeAction.prototype=new ZmAction;
ZmCompositeAction.prototype.constructor=ZmCompositeAction;
ZmCompositeAction.prototype.type=ZmAction.ACTION_ZMCOMPOSITEACTION;
ZmCompositeAction.prototype.toString=function(){
return"ZmCompositeAction"
};
ZmCompositeAction.prototype.addAction=function(t){
if(t&&t!=this&&t instanceof ZmAction){
var e=t.type;
if(!this._actions[e]){
this._actions[e]=[]
}
this._actions[e].push(t)
}};
ZmCompositeAction.prototype.getActions=function(e){
return this._actions[e]||[]
};
ZmCompositeAction.prototype.hasActions=function(e){
return this._actions[e]&&this._actions[e].length>0
};
ZmCompositeAction.prototype.undo=function(o,e){
if(this.hasActions(ZmAction.ACTION_ZMITEMMOVEACTION)){
ZmItemMoveAction.multipleUndo(this.getActions(ZmAction.ACTION_ZMITEMMOVEACTION))
}
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 a=this.getActions(ZmAction.ACTION_ZMCOMPOSITEACTION).concat(this.getActions(ZmAction.ACTION_ZMITEMACTION));
for(var t=0;
t<a.length;
t++){
a[t].undo()
}}};
ZmCompositeAction.prototype.redo=function(o,e){
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 a=this.getActions(ZmAction.ACTION_ZMCOMPOSITEACTION).concat(this.getActions(ZmAction.ACTION_ZMITEMACTION)).concat(this.getActions(ZmAction.ACTION_ZMORGANIZERACTION));
for(var t=0;
t<a.length;
t++){
a[t].redo()
}}}
}
if(AjxPackage.define("zimbraMail.share.model.ZmOrganizer")){
ZmOrganizer=function(e){
if(arguments.length==0){
return
}
this.type=e.type;
var t=this.id=e.id;
this.nId=ZmOrganizer.normalizeId(t);
this.name=ZmFolder.MSG_KEY[this.nId]?ZmMsg[ZmFolder.MSG_KEY[this.nId]]:e.name;
this._systemName=this.nId<256&&e.name;
this.parent=e.parent;
this.tree=e.tree;
this.numUnread=e.numUnread||0;
this.numTotal=e.numTotal||0;
this.sizeTotal=e.sizeTotal||0;
this.url=e.url;
this.owner=e.owner;
this.oname=e.oname;
this.link=e.link||(Boolean(e.zid))||(this.parent&&this.parent.link);
this.isMountpoint=e.link;
this.zid=e.zid;
this.rid=e.rid;
this.restUrl=e.restUrl;
this.account=e.account;
this.perm=e.perm;
this.noSuchFolder=false;
this._isAdmin=this._isReadOnly=this._hasPrivateAccess=null;
this.color=e.color||(this.parent&&this.parent.color)||ZmOrganizer.ORG_COLOR[t]||ZmOrganizer.ORG_COLOR[this.nId]||ZmOrganizer.DEFAULT_COLOR[this.type]||ZmOrganizer.C_NONE;
this.rgb=e.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(t&&e.tree){
appCtxt.cacheSet(t,this);
if(this.link){
appCtxt.cacheSet([this.zid,this.rid].join(":"),this)
}}
this.children=new AjxVector()
};
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.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_NOTEBOOK=12;
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_ROSTER_LIST=-11;
ZmOrganizer.ID_ROSTER_TREE_ITEM=-13;
ZmOrganizer.ID_ATTACHMENTS=-17;
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_ORANGE;
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 t=0;
t<=ZmOrganizer.MAX_COLOR;
t++){
var e=ZmOrganizer.COLOR_TEXT[t];
ZmOrganizer.COLORS.push(e);
ZmOrganizer.COLOR_CHOICES.push({
value:t,label:e}
)
}}
)();
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.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.registerOrg=function(a,e){
if(e.nameKey){
ZmOrganizer.MSG_KEY[a]=e.nameKey
}
if(e.app){
ZmOrganizer.APP[a]=e.app;
if(!ZmOrganizer.APP2ORGANIZER[e.app]){
ZmOrganizer.APP2ORGANIZER[e.app]=[]
}
ZmOrganizer.APP2ORGANIZER[e.app].push(a);
ZmOrganizer.APP2ORGANIZER_R[a]=e.app
}
if(e.defaultFolder){
ZmOrganizer.DEFAULT_FOLDER[a]=e.defaultFolder
}
if(e.precondition){
ZmOrganizer.PRECONDITION[a]=e.precondition
}
if(e.soapCmd){
ZmOrganizer.SOAP_CMD[a]=e.soapCmd
}
if(e.firstUserId){
ZmOrganizer.FIRST_USER_ID[a]=e.firstUserId
}
if(e.orgClass){
ZmOrganizer.ORG_CLASS[a]=e.orgClass
}
if(e.orgPackage){
ZmOrganizer.ORG_PACKAGE[a]=e.orgPackage
}
if(e.labelKey){
ZmOrganizer.LABEL[a]=e.labelKey
}
if(e.itemsKey){
ZmOrganizer.ITEMS_KEY[a]=e.itemsKey
}
if(e.hasColor){
ZmOrganizer.HAS_COLOR[a]=e.hasColor
}
if(e.views){
ZmOrganizer.VIEWS[a]=e.views
}
if(e.folderKey){
ZmOrganizer.FOLDER_KEY[a]=e.folderKey
}
if(e.mountKey){
ZmOrganizer.MOUNT_KEY[a]=e.mountKey
}
if(e.deferrable){
ZmOrganizer.DEFERRABLE[a]=e.deferrable
}
if(e.pathInName){
ZmOrganizer.PATH_IN_NAME[a]=e.pathInName
}
if(e.openSetting){
ZmOrganizer.OPEN_SETTING[a]=e.openSetting
}
if(e.newOp){
ZmOrganizer.NEW_OP[a]=e.newOp
}
if(e.displayOrder){
ZmOrganizer.DISPLAY_ORDER[a]=e.displayOrder
}
if(e.hideEmpty){
ZmOrganizer.HIDE_EMPTY[a]=e.hideEmpty
}
if(!appCtxt.isChildWindow||e.childWindow){
if(e.compareFunc){
ZmTreeView.COMPARE_FUNC[a]=e.compareFunc
}
if(e.treeController){
ZmOverviewController.CONTROLLER[a]=e.treeController
}}
ZmOrganizer.TREE_TYPE[a]=e.treeType||a;
ZmOrganizer.CREATE_FUNC[a]=e.createFunc||"ZmOrganizer.create";
if(e.views){
ZmOrganizer.VIEW_HASH[a]=AjxUtil.arrayAsHash(ZmOrganizer.VIEWS[a])
}
if(e.hasColor){
ZmOrganizer.DEFAULT_COLOR[a]=(e.defaultColor!=null)?e.defaultColor:ZmOrganizer.ORG_DEFAULT_COLOR
}
if(e.orgColor){
for(var t in e.orgColor){
ZmOrganizer.ORG_COLOR[t]=e.orgColor[t]
}}
if(e.dropTargets){
if(!ZmApp.DROP_TARGETS[e.app]){
ZmApp.DROP_TARGETS[e.app]={}
}
ZmApp.DROP_TARGETS[e.app][a]=e.dropTargets
}};
ZmOrganizer.sortCompare=function(t,e){};
ZmOrganizer.create=function(s){
var r={
CreateFolderRequest:{
_jsns:"urn:zimbraMail"}};
var o=r.CreateFolderRequest.folder={};
var e=s.errorCallback||new AjxCallback(null,ZmOrganizer._handleErrorCreate,s);
var a=s.type;
s.view=s.view||ZmOrganizer.VIEWS[a]?ZmOrganizer.VIEWS[a][0]:null;
for(var t in s){
if(t=="type"||t=="errorCallback"||t=="account"){
continue
}
var n=s[t];
if(t=="color"){
if(!n||(n==ZmOrganizer.DEFAULT_COLOR[a])){
n=null
}}
if(n){
o[t]=n
}}
return appCtxt.getAppController().sendRequest({
jsonObj:r,asyncMode:true,accountName:(s.account&&s.account.name),errorCallback:e}
)
};
ZmOrganizer._handleErrorCreate=function(o,e){
if(!o.url&&!o.name){
return false
}
var a;
if(o.name&&(e.code==ZmCsfeException.MAIL_ALREADY_EXISTS)){
a=AjxMessageFormat.format(ZmMsg.errorAlreadyExists,[o.name])
}else{
if(o.url){
var t=(e.code==ZmCsfeException.SVC_RESOURCE_UNREACHABLE)?ZmMsg.feedUnreachable:ZmMsg.feedInvalid;
a=AjxMessageFormat.format(t,o.url)
}}
if(a){
ZmOrganizer._showErrorMsg(a);
return true
}
return false
};
ZmOrganizer._showErrorMsg=function(t){
var e=appCtxt.getMsgDialog();
e.reset();
e.setMessage(AjxStringUtil.htmlEncode(t),DwtMessageDialog.CRITICAL_STYLE);
e.popup()
};
ZmOrganizer.getFolder=function(s,n,e){
var o={
GetFolderRequest:{
_jsns:"urn:zimbraMail"}};
var t=o.GetFolderRequest;
t.folder={
l:s};
var a=new AjxCallback(null,ZmOrganizer._handleResponseGetFolder,[n]);
if(e){
e.addRequestParams(o,a)
}else{
appCtxt.getRequestMgr().sendRequest({
jsonObj:o,asyncMode:true,callback:a}
)
}};
ZmOrganizer._handleResponseGetFolder=function(s,e){
var n=e.getResponse().GetFolderResponse;
var t=(n&&n.folder&&n.folder[0])||(n&&n.link&&n.link[0]);
var o;
if(t){
o=appCtxt.getById(t.id);
if(o){
o.clearShares();
o._setSharesFromJs(t)
}else{
var a=appCtxt.getById(t.l);
o=ZmFolderTree.createFromJs(a,t,appCtxt.getFolderTree(),"folder")
}}
if(s){
s.run(o)
}};
ZmOrganizer.prototype.getFolder=function(t,e){
ZmOrganizer.getFolder(this.id,t,e)
};
ZmOrganizer.getViewName=function(e){
return ZmOrganizer.VIEWS[e][0]
};
ZmOrganizer.checkName=function(e){
if(e.length==0){
return ZmMsg.nameEmpty
}
if(e.length>ZmOrganizer.MAX_NAME_LENGTH){
return AjxMessageFormat.format(ZmMsg.nameTooLong,ZmOrganizer.MAX_NAME_LENGTH)
}
if(!ZmOrganizer.VALID_NAME_RE.test(e)){
return AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(e))
}
return null
};
ZmOrganizer.checkUrl=function(e){
if(!e.match(/^[a-zA-Z]+://.*$/i)){
return ZmMsg.errorUrlMissing
}
return null
};
ZmOrganizer.checkSortArgs=function(e,t){
if(!e&&!t){
return 0
}
if(e&&!t){
return 1
}
if(!e&&t){
return -1
}
return null
};
ZmOrganizer.checkColor=function(e){
return((e!=null)&&(e>=0&&e<=ZmOrganizer.MAX_COLOR))?e:ZmOrganizer.ORG_DEFAULT_COLOR
};
ZmOrganizer.getSystemId=function(a,t,e){
t=t||appCtxt.getActiveAccount();
if((t&&!t.isMain)||e){
return((typeof(a)=="string")&&(a.indexOf(":")!=-1)||!a)?a:([t.id,a].join(":"))
}
return a
};
ZmOrganizer.normalizeId=function(o,a){
if(typeof(o)!="string"){
return o
}
var e=o.indexOf(":");
var t=(e==-1)?o:o.substr(e+1);
return(a&&(t>=ZmOrganizer.FIRST_USER_ID[a]))?o:t
};
ZmOrganizer.parseId=function(o,t){
var a=window.parentAppCtxt||window.appCtxt;
t=t||{};
if(o==null){
return t
}
var e=(typeof o=="string")?o.indexOf(":"):-1;
if(e==-1){
t.account=a.accountList.mainAccount;
t.id=o
}else{
t.account=a.accountList.getAccount(o.substring(0,e));
t.id=o.substr(e+1)
}
return t
};
ZmOrganizer.prototype.toString=function(){
return"ZmOrganizer"
};
ZmOrganizer.prototype.getName=function(s,t,n,e,o){
if(this.nId==ZmFolder.ID_ROOT){
return(ZmOrganizer.LABEL[this.type])?ZmMsg[ZmOrganizer.LABEL[this.type]]:""
}
var a=(e&&this._systemName)||(o&&this.oname)||this.name||"";
if(ZmOrganizer.PATH_IN_NAME[this.type]&&this.path){
a=[this.path,a].join("/")
}
a=(t&&a.length>t)?a.substring(0,t-3)+"...":a;
return this._markupName(a,s,n)
};
ZmOrganizer.prototype.getPath=function(a,h,t,r,e,n){
var o=this.parent;
var s=this.getName(h,t,r,e,n);
while(o&&((o.nId!=ZmOrganizer.ID_ROOT)||a)){
s=o.getName(h,t,r,e,n)+ZmFolder.SEP+s;
o=o.parent
}
return s
};
ZmOrganizer.prototype.getToolTip=function(a){
if(!this._tooltip||a){
var e=this._getItemsText();
var t={
itemText:e,numTotal:this.numTotal,sizeTotal:this.sizeTotal};
this._tooltip=AjxTemplate.expand("share.App#FolderTooltip",t)
}
return this._tooltip
};
ZmOrganizer.prototype.getSearchPath=function(e){
return(this.nId!=ZmOrganizer.ID_ROOT)?this.getPath(null,null,null,true,true,e):"/"
};
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(){
var e=appCtxt.get(ZmSetting.REST_URL);
if(e){
var t=AjxStringUtil.urlEncode(this.getSearchPath()).replace("#","%23");
return([e,"/",t].join(""))
}
if(this.restUrl){
return this.restUrl
}
url=this._generateRestUrl();
return url
};
ZmOrganizer.prototype.getOwnerRestUrl=function(){
var e=this.restUrl;
var t=AjxStringUtil.urlEncode(this.oname).replace("#","%23");
return([e,"/",t].join(""))
};
ZmOrganizer.prototype._generateRestUrl=function(){
var n=document.location;
var t=appCtxt.get(ZmSetting.USERNAME);
var a=n.host;
var e=t.match(/^(.*)@(.*)$/);
a=(e&&e[2])||a;
if(n.port&&n.port!=80){
a=a+":"+n.port
}
var o=AjxStringUtil.urlEncode(this.getSearchPath()).replace("#","%23");
return[n.protocol,"//",a,"/service/user/",t,"/",o].join("")
};
ZmOrganizer.prototype.getAccount=function(){
if(appCtxt.multiAccounts){
if(!this.account){
this.account=ZmOrganizer.parseId(this.id).account
}
if(!this.account){
var e=this.parent;
while(e&&!this.account){
this.account=e.getAccount();
e=e.parent
}}
return this.account
}
return(this.account||appCtxt.accountList.mainAccount)
};
ZmOrganizer.prototype.getShares=function(){
return this.shares
};
ZmOrganizer.prototype.addShare=function(a){
this.shares=this.shares||[];
this.shares.push(a);
var o=appCtxt.getActiveAccount();
var e=o&&o.id;
var t=a.grantee&&a.grantee.id;
if(t&&(t==e)){
this._mainShare=a
}};
ZmOrganizer.prototype.clearShares=function(){
if(this.shares&&this.shares.length){
for(var e=0;
e<this.shares.length;
e++){
this.shares[e]=null
}}
this.shares=null;
this._mainShare=null
};
ZmOrganizer.prototype.getMainShare=function(){
if(!this._mainShare){
var o=appCtxt.getActiveAccount();
var e=o&&o.id;
if(e&&this.shares&&this.shares.length){
for(var t=0;
t<this.shares.length;
t++){
var a=this.shares[t];
var n=a&&a.grantee&&a.grantee.id;
if(n&&n==e){
this._mainShare=a;
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.getIconWithColor=function(){
var t=this.getIcon()||"";
var e=this.rgb||ZmOrganizer.COLOR_VALUES[this.color];
return e?[t,e].join(",color="):t
};
ZmOrganizer.prototype.rename=function(a,n,t,e){
if(a==this.name){
return
}
var o={
action:"rename",attrs:{
name:a}
,callback:n,errorCallback:t,batchCmd:e};
this._organizerAction(o)
};
ZmOrganizer.prototype.setColor=function(t,a,e){
var t=ZmOrganizer.checkColor(t);
if(this.color==t){
return
}
this._organizerAction({
action:"color",attrs:{
color:t}
,callback:a,errorCallback:e}
)
};
ZmOrganizer.prototype.setRGB=function(t,a,e){
if(this.rgb==t){
return
}
this._organizerAction({
action:"color",attrs:{
rgb:t}
,callback:a,errorCallback:e}
)
};
ZmOrganizer.getStandardColorNumber=function(t){
if(String(t).match(/^#/)){
var e=ZmOrganizer.COLOR_VALUES.length;
for(var o=0;
o<e;
o++){
var a=ZmOrganizer.COLOR_VALUES[o];
if(a&&a==t){
return o
}}}else{
if(t<=9&&t>=0){
return t
}}
return -1
};
ZmOrganizer.prototype.update=function(e){
this._organizerAction({
action:"update",attrs:e}
)
};
ZmOrganizer.prototype.move=function(o,a,n,e){
var t=(o.nId>0)?o.id:ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT);
if((t==this.id||t==this.parent.id)||(this.type==ZmOrganizer.FOLDER&&(ZmOrganizer.normalizeId(t,this.type)==ZmFolder.ID_SPAM))||(o.isChildOf(this))){
return
}
var s={};
s.batchCmd=e;
if(t==ZmOrganizer.ID_TRASH){
s.action="trash";
s.noUndo=a
}else{
if(o.account&&o.account.isLocal()){
t=[ZmAccount.LOCAL_ACCOUNT_ID,t].join(":")
}
s.actionText=n||ZmMsg.actionMove;
s.actionArg=o.getName(false,false,true);
s.action="move";
s.attrs={
l:t};
s.noUndo=a
}
this._organizerAction(s)
};
ZmOrganizer.prototype._delete=function(t){
var e=((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()&&!e){
return
}
var a=e?"empty":"delete";
this._organizerAction({
action:a,batchCmd:t}
)
};
ZmOrganizer.prototype.empty=function(a,t){
a=a||false;
var e=((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()&&!e){
return
}
var o={
action:"empty",batchCmd:t};
o.attrs=(this.nId==ZmFolder.ID_TRASH)?{
recursive:true}
:{
recursive:a};
if(this.isRemote()){
o.id=this.getRemoteId()
}
this._organizerAction(o)
};
ZmOrganizer.prototype.markAllRead=function(e){
var t=this.isRemote()?this.getRemoteId():null;
this._organizerAction({
action:"read",id:t,attrs:{
l:this.id}
,batchCmd:e}
)
};
ZmOrganizer.prototype.sync=function(){
this._organizerAction({
action:"sync"}
)
};
ZmOrganizer.prototype.notifyDelete=function(){
var t=appCtxt.getOverviewController().getTreeController(this.type);
var o=t&&t.getTreeView(appCtxt.getCurrentApp().getOverviewId());
var n=o&&o.getSelected();
if(n){
if(!(n instanceof Array)){
n=[n]
}
for(var r in n){
var e=n[r];
if(e&&(e==this||e.isChildOf(this))){
var a=this.parent.id;
if(this.parent.nId==ZmOrganizer.ID_ROOT){
a=ZmOrganizer.getSystemId(ZmOrganizer.DEFAULT_FOLDER[this.type])
}
var s=false;
o.setSelected(a,s)
}}}
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=ZmOrganizer.checkColor(obj.color)||ZmOrganizer.DEFAULT_COLOR[this.type]||ZmOrganizer.ORG_DEFAULT_COLOR;
if(color!=this.color){
this.color=color;
fields[ZmOrganizer.F_COLOR]=true;
fields[ZmOrganizer.F_RGB]=true
}
var rgb=obj.rgb||ZmOrganizer.COLOR_VALUES[color];
if(rgb!=this.rgb){
this.rgb=rgb;
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);
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(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 e=this.children.getArray();
var o=this.children.size();
for(var t=0;
t<o;
t++){
var n=e[t];
if(n){
n.deleteLocal()
}}
this.children.removeAll()
};
ZmOrganizer.prototype.hasChild=function(e){
return(this.getChild(e)!=null)
};
ZmOrganizer.prototype.getChild=function(t){
t=t.toLowerCase();
var e=this.children.getArray();
var n=this.children.size();
for(var o=0;
o<n;
o++){
if(e[o]&&e[o].name&&(e[o].name.toLowerCase()==t)){
return e[o]
}}
return null
};
ZmOrganizer.prototype.getChildByPath=function(n){
var e=this;
if(n.match(/^//)){
while(e.nId!=ZmOrganizer.ID_ROOT){
e=e.parent
}
n=n.substr(1)
}
if(n.length==0){
return e
}
var o=n.split("/");
var a=0;
while(a<o.length){
var t=o[a++];
var s=e.getChild(t);
if(s==null){
return null
}
e=s
}
return e
};
ZmOrganizer.prototype.reparent=function(e){
if(this.parent){
this.parent.children.remove(this)
}
if(e){
e.children.add(this)
}
this.parent=e
};
ZmOrganizer.prototype.getById=function(r){
if(this.link&&r&&typeof(r)=="string"){
var n=r.split(":");
if(this.zid==n[0]&&this.rid==n[1]){
return this
}}
if(this.id==r||this.nId==r){
return this
}
var e;
var t=this.children.getArray();
var s=this.children.size();
for(var o=0;
o<s;
o++){
if(e=t[o].getById(r)){
return e
}}
return null
};
ZmOrganizer.prototype.getByName=function(t,e){
return this._getByName(t.toLowerCase(),e)
};
ZmOrganizer.prototype.getByType=function(e){
var t=[];
this._getByType(e,t);
return t
};
ZmOrganizer.prototype._getByType=function(o,n){
if(this.type==o){
n.push(this)
}
var e=this.children.getArray();
for(var t=0;
t<e.length;
t++){
if(e[t]){
e[t]._getByType(o,n)
}}};
ZmOrganizer.prototype.getByPath=function(t,e){
return this._getByPath(t.toLowerCase(),e)
};
ZmOrganizer.prototype._getByPath=function(s,o){
if(this.nId==ZmFolder.ID_TAGS){
return null
}
if(s==this.getPath(false,false,null,true,o).toLowerCase()){
return this
}
var t=this.children.getArray();
for(var n=0;
n<t.length;
n++){
var e=t[n]._getByPath(s,o);
if(e){
return e
}}
return null
};
ZmOrganizer.prototype.size=function(){
return this.children.size()
};
ZmOrganizer.prototype.isChildOf=function(e){
var t=this.parent;
while(t){
if(t==e){
return true
}
t=t.parent
}
return false
};
ZmOrganizer.prototype._getNewParent=function(e){
return appCtxt.getById(e)
};
ZmOrganizer.prototype.isUnder=function(t){
t=t.toString();
if(this.nId==t||(this.isRemote()&&this.rid==t)){
return true
}
var e=this.parent;
while(e&&e.nId!=ZmOrganizer.ID_ROOT){
if(e.nId==t){
return true
}
e=e.parent
}
return false
};
ZmOrganizer.prototype.isInTrash=function(){
return this.isUnder(ZmOrganizer.ID_TRASH)
};
ZmOrganizer.prototype.isPermAllowed=function(t){
if(this.perm){
var e=this.perm.replace(/-./g,"");
return(e.indexOf(t)!=-1)
}
return false
};
ZmOrganizer.prototype.isReadOnly=function(){
if(this._isReadOnly==null){
var e=this.getMainShare();
this._isReadOnly=(e!=null)?(this.isRemote()&&!e.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 e=this.getMainShare();
this._isAdmin=(e!=null)?(this.isRemote()&&e.isAdmin()):(this.isRemote()&&this.isPermAllowed(ZmOrganizer.PERM_ADMIN))
}
return this._isAdmin
};
ZmOrganizer.prototype.hasPrivateAccess=function(){
if(this._hasPrivateAccess==null){
var e=this.getMainShare();
this._hasPrivateAccess=(e!=null)?(this.isRemote()&&e.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 t=this.account;
var e=ZmOrganizer.parseId(this.id);
if(!t){
if(e.account&&e.account.isMain){
this._isRemote=false;
return this._isRemote
}else{
t=appCtxt.getActiveAccount()
}}
this._isRemote=Boolean(!e.account||(e.account&&(e.account!=t)))
}else{
var a=String(this.id);
this._isRemote=((a.indexOf(":")!=-1)&&(a.indexOf(appCtxt.getActiveAccount().id)!=0))
}}}
return this._isRemote
};
ZmOrganizer.prototype.isSystem=function(){
return(this.nId<ZmOrganizer.FIRST_USER_ID[this.type])
};
ZmOrganizer.prototype.isFeed=function(){
return Boolean(this.url)
};
ZmOrganizer.prototype.hasFeeds=function(){
return false
};
ZmOrganizer.prototype.isDataSource=function(t,a){
var e=this.getDataSources(t,a);
return(e&&e.length>0)
};
ZmOrganizer.prototype.getDataSources=function(t,a){
if(!appCtxt.get(ZmSetting.MAIL_ENABLED)){
return null
}
var e=appCtxt.getDataSourceCollection();
var o=e.getByFolderId(this.nId,t);
if(o.length==0){
return(a&&this.parent)?this.parent.getDataSources(t,a):null
}
return o
};
ZmOrganizer.prototype.getOwner=function(){
return this.owner||(this.parent&&this.parent.getOwner())||appCtxt.get(ZmSetting.USERNAME)
};
ZmOrganizer.getSortIndex=function(n,e){
if(!(n&&n.parent&&e)){
return null
}
var a=n.parent.children.getArray();
for(var t=0;
t<a.length;
t++){
var o=e(n,a[t]);
if(o==-1){
return t
}}
return t
};
ZmOrganizer.prototype._organizerAction=function(a){
var t=ZmOrganizer.SOAP_CMD[this.type];
var s=AjxSoapDoc.create(t+"Request","urn:zimbraMail");
var r=s.set("action");
r.setAttribute("op",a.action);
r.setAttribute("id",a.id||this.id);
for(var o in a.attrs){
if(AjxEnv.isIE){
a.attrs[o]+=""
}
r.setAttribute(o,a.attrs[o])
}
var h=appCtxt.getActionController();
h.dismiss();
var e=(!a.noUndo&&h&&h.actionPerformed({
op:a.action,id:a.id||this.id,attrs:a.attrs}
))||null;
var l=new AjxCallback(this,this._handleResponseOrganizerAction,[a,e]);
if(a.batchCmd){
a.batchCmd.addRequestParams(s,l,a.errorCallback)
}else{
var n;
if(appCtxt.multiAccounts){
n=(this.account)?this.account.name:appCtxt.accountList.mainAccount.name
}
appCtxt.getAppController().sendRequest({
soapDoc:s,asyncMode:true,accountName:n,callback:l,errorCallback:a.errorCallback}
)
}};
ZmOrganizer.prototype._handleResponseOrganizerAction=function(s,n,e){
if(n){
n.setComplete()
}
if(s.callback){
s.callback.run(e)
}
if(s.actionText){
var o=appCtxt.getActionController();
var a=ZmOrganizer.getActionSummary(s.actionText,s.numItems||1,this.type,s.actionArg);
a=AjxStringUtil.htmlEncode(a);
var t=n&&o&&o.getUndoLink(n);
if(t&&o){
o.onPopup();
appCtxt.setStatusMsg({
msg:a+t,transitions:o.getStatusTransitions()}
)
}else{
appCtxt.setStatusMsg(a)
}}};
ZmOrganizer.getActionSummary=function(s,a,n,e){
var o=ZmMsg[ZmOrganizer.MSG_KEY[n]];
var t=ZmMsg[ZmOrganizer.MSG_KEY[n]];
return AjxMessageFormat.format(s,[a,o,e,t])
};
ZmOrganizer.prototype._getByName=function(n,t){
if(this.name&&n==this.name.toLowerCase()){
return this
}
var e;
var o=this.children.getArray();
var r=this.children.size();
for(var s=0;
s<r;
s++){
if(e=o[s]._getByName(n,t)){
if(t&&e.isDataSource(ZmAccount.TYPE_IMAP,true)){
continue
}
return e
}}
return null
};
ZmOrganizer.prototype._parseFlags=function(a){
for(var t=0;
t<ZmOrganizer.ALL_FLAGS.length;
t++){
var e=ZmOrganizer.ALL_FLAGS[t];
this[ZmOrganizer.FLAG_PROP[e]]=(Boolean(a&&(a.indexOf(e)!=-1)))
}};
ZmOrganizer.prototype._setFlags=function(){
var t="";
for(var a=0;
a<ZmOrganizer.ALL_FLAGS.length;
a++){
var e=ZmOrganizer.ALL_FLAGS[a];
var o=ZmOrganizer.FLAG_PROP[e];
if(this[o]){
t=t+e
}}
return t
};
ZmOrganizer.prototype.addChangeListener=function(e){
this.tree.addChangeListener(e)
};
ZmOrganizer.prototype.removeChangeListener=function(e){
this.tree.removeChangeListener(e)
};
ZmOrganizer.prototype._setSharesFromJs=function(a){
if(a.acl&&a.acl.grant&&a.acl.grant.length>0){
AjxDispatcher.require("Share");
for(var t=0;
t<a.acl.grant.length;
t++){
var e=a.acl.grant[t];
this.addShare(ZmShare.createFromJs(this,e))
}}};
ZmOrganizer.prototype._notify=function(t,e){
appCtxt.setNotifyDebug("ZmOrganizer notify called. --- This should update the folder tree");
if(e){
e.organizers=[this]
}else{
e={
organizers:[this]}
}
this.tree._evt.type=this.type;
this.tree._notify(t,e)
};
ZmOrganizer.prototype._markupName=function(e,a,t){
if(!t){
e=AjxStringUtil.htmlEncode(e,true)
}
if(a&&this.numUnread>0){
e=AjxMessageFormat.format(ZmMsg.folderUnread,[e,this.numUnread]);
if(!t){
e=["<span style='font-weight:bold'>",e,"</span>"].join("")
}}
if(this.noSuchFolder&&!t){
e=["<del>",e,"</del>"].join("")
}
return e
};
ZmOrganizer.prototype._getItemsText=function(){
var e=ZmMsg[ZmOrganizer.ITEMS_KEY[this.type]];
if(!e||(this.nId==ZmFolder.ID_TRASH)){
e=ZmMsg.items
}
return e
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmFolder")){
ZmFolder=function(e){
if(arguments.length==0){
return
}
e.type=e.type||ZmOrganizer.FOLDER;
ZmOrganizer.call(this,e)
};
ZmFolder.prototype=new ZmOrganizer;
ZmFolder.prototype.constructor=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.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_NOTEBOOK]="notebook";
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[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_NOTEBOOK]="notebook";
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={};
for(var id in ZmFolder.QUERY_NAME){
ZmFolder.QUERY_ID[ZmFolder.QUERY_NAME[id]]=id
}
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_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 e in ZmFolder.QUERY_NAME){
ZmFolder.QUERY_ID[ZmFolder.QUERY_NAME[e]]=e
}}
)();
ZmFolder.sortCompare=function(a,t){
var e=ZmOrganizer.checkSortArgs(a,t);
if(e!=null){
return e
}
if(appCtxt.isOffline){
if(a.isDataSource(ZmAccount.TYPE_POP)){
if(a.id==ZmFolder.ID_INBOX){
return -1
}
if(t.isDataSource(ZmAccount.TYPE_POP)){
if(a.name.toLowerCase()>t.name.toLowerCase()){
return 1
}
if(a.name.toLowerCase()<t.name.toLowerCase()){
return -1
}
return 0
}
return -1
}else{
if(t.isDataSource(ZmAccount.TYPE_POP)){
return 1
}}}
if(ZmFolder.SORT_ORDER[a.nId]&&ZmFolder.SORT_ORDER[t.nId]){
return(ZmFolder.SORT_ORDER[a.nId]-ZmFolder.SORT_ORDER[t.nId])
}
if(!ZmFolder.SORT_ORDER[a.nId]&&ZmFolder.SORT_ORDER[t.nId]){
return 1
}
if(ZmFolder.SORT_ORDER[a.nId]&&!ZmFolder.SORT_ORDER[t.nId]){
return -1
}
if(a.name.toLowerCase()>t.name.toLowerCase()){
return 1
}
if(a.name.toLowerCase()<t.name.toLowerCase()){
return -1
}
return 0
};
ZmFolder.sortComparePath=function(n,o){
var a=n&&n.getPath(false,false,null,true,true);
var t=o&&o.getPath(false,false,null,true,true);
var e=ZmOrganizer.checkSortArgs(a,t);
if(e!=null){
return e
}
if(ZmFolder.SORT_ORDER[n.nId]&&ZmFolder.SORT_ORDER[o.nId]){
return(ZmFolder.SORT_ORDER[n.nId]-ZmFolder.SORT_ORDER[o.nId])
}
if(!ZmFolder.SORT_ORDER[n.nId]&&ZmFolder.SORT_ORDER[o.nId]){
return 1
}
if(ZmFolder.SORT_ORDER[n.nId]&&!ZmFolder.SORT_ORDER[o.nId]){
return -1
}
if(a.toLowerCase()>t.toLowerCase()){
return 1
}
if(a.toLowerCase()<t.toLowerCase()){
return -1
}
return 0
};
ZmFolder.checkName=function(a,o){
var t=ZmOrganizer.checkName(a);
if(t){
return t
}
o=o||appCtxt.getFolderTree().root;
if(o&&(o.id==ZmFolder.ID_ROOT)){
var e=a.toLowerCase();
for(var s in ZmFolder.MSG_KEY){
var n=ZmMsg[ZmFolder.MSG_KEY[s]];
if(n&&(e==n.toLowerCase())){
return ZmMsg.folderNameReserved
}}
if(e==ZmFolder.SYNC_ISSUES.toLowerCase()){
return ZmMsg.folderNameReserved
}}
return null
};
ZmFolder.getIdForName=function(a){
var e=a.toLowerCase();
for(var t in ZmFolder.MSG_KEY){
if(ZmFolder.MSG_KEY[t]==e){
return t
}}
return null
};
ZmFolder.prototype.toString=function(){
return"ZmFolder"
};
ZmFolder.prototype.move=function(n,o,s,e){
var a=this.name;
var t=this.name;
while(n.hasChild(t)){
t=t+"_"
}
if(a!=t){
this.rename(t)
}
ZmOrganizer.prototype.move.call(this,n,o,s,e)
};
ZmFolder.prototype.toggleSyncOffline=function(s,e){
if(!this.isOfflineSyncable){
return
}
var n=this.isOfflineSyncing?"!syncon":"syncon";
var a=AjxSoapDoc.create("FolderActionRequest","urn:zimbraMail");
var t=a.set("action");
t.setAttribute("op",n);
t.setAttribute("id",this.id);
var o={
soapDoc:a,asyncMode:true,callback:s,errorCallback:e};
appCtxt.getAppController().sendRequest(o)
};
ZmFolder.prototype.hasFeeds=function(){
if(this.type!=ZmOrganizer.FOLDER){
return false
}
var e=this.children.getArray();
var o=this.children.size();
for(var t=0;
t<o;
t++){
if(e[t].isFeed()){
return true
}
if(e[t].children&&e[t].children.size()>0){
return(e[t].hasFeeds&&e[t].hasFeeds())
}}
return false
};
ZmFolder.prototype.hasSearch=function(n){
if(this.type==ZmOrganizer.SEARCH){
return true
}
var e=this.children.getArray();
var o=this.children.size();
for(var t=0;
t<o;
t++){
if(e[t].hasSearch()){
return true
}}
return false
};
ZmFolder.prototype.supportsPublicAccess=function(){
return false
};
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(t){
if(!this.isRemote()&&this.isSystem()){
var o=ZmFolder.QUERY_NAME[this.nId];
return t?o:('in:"'+(o||this.name)+'"')
}
var n=this.isSystem()?ZmFolder.QUERY_NAME[this.nId]:this.name;
var a=this.parent;
while(a&&(a.nId!=ZmFolder.ID_ROOT)&&a.name.length){
var e=a.isSystem()?ZmFolder.QUERY_NAME[a.nId]:a.name;
n=e+"/"+n;
a=a.parent
}
n='"'+n+'"';
return t?n:("in:"+n)
};
ZmFolder.prototype.getName=function(n,t,o,e){
if(this.nId==ZmFolder.ID_DRAFTS||this.nId==ZmFolder.ID_OUTBOX||this.rid==ZmFolder.ID_DRAFTS){
var a=(e&&this._systemName)?this._systemName:this.name;
if(n&&this.numTotal>0){
a=AjxMessageFormat.format(ZmMsg.folderUnread,[a,this.numTotal]);
if(!o){
a=["<span style='font-weight:bold'>",a,"</span>"].join("")
}}
return a
}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"
}
if(this.parent&&this.parent.isDataSource(ZmAccount.TYPE_IMAP)){
var e=ZmFolder.getIdForName(this.name);
if(e){
return ZmFolder.ICON[e]||"Folder"
}}
return"Folder"
};
ZmFolder.prototype.mayContainFolderFromAccount=function(e){
var t=this.getAccount();
if(t==e){
return true
}
return t.isLocal()
};
ZmFolder.prototype.mayContain=function(h,c,d){
if(!h){
return true
}
if(this.isFeed()||this.isSyncIssuesFolder()){
return false
}
var l=c||this.type;
var o=false;
if(h instanceof ZmFolder){
o=((h.parent==this&&!d)||this.isChildOf(h)||this.nId==ZmFolder.ID_DRAFTS||this.nId==ZmFolder.ID_SPAM||(!this.isInTrash()&&this.hasChild(h.name)&&!d)||(h.type==ZmOrganizer.FOLDER&&l==ZmOrganizer.SEARCH)||(h.type==ZmOrganizer.SEARCH&&l==ZmOrganizer.FOLDER&&this.nId==ZmOrganizer.ID_ROOT)||(h.id==this.id)||(h.disallowSubFolder)||(appCtxt.multiAccounts&&!this.mayContainFolderFromAccount(h.getAccount()))||(this.isRemote()&&!this._remoteMoveOk(h))||(h.isRemote()&&!this._remoteMoveOk(h)))
}else{
var n=AjxUtil.toArray(h);
var u=n[0];
if(this.nId==ZmOrganizer.ID_ROOT||this.nId==ZmOrganizer.ID_OUTBOX||this.nId==ZmOrganizer.ID_SYNC_FAILURES){
o=true
}else{
if(l==ZmOrganizer.SEARCH){
o=true
}else{
if(u&&(u.type==ZmItem.CONTACT)&&u.isGal){
o=true
}else{
if(u&&(u.type==ZmItem.CONV)&&u.list&&u.list.search&&(u.list.search.folderId==this.id)){
o=true
}else{
for(var t=0;
t<n.length;
t++){
var r=n[t];
if(!r){
o=true;
break
}
if(r==ZmItem.CONTACT){
if(this.nId!=ZmFolder.ID_TRASH){
o=true;
break
}}else{
if(Dwt.instanceOf(r,"ZmBriefcaseFolderItem")){
if(r.folder&&r.folder.isRemote()&&!r.folder.rid){
o=true;
break
}}else{
if(r.isDraft&&(this.nId!=ZmFolder.ID_TRASH&&this.nId!=ZmFolder.ID_DRAFTS&&this.rid!=ZmFolder.ID_DRAFTS)){
o=true;
break
}else{
if((this.nId==ZmFolder.ID_DRAFTS||this.rid==ZmFolder.ID_DRAFTS)&&!r.isDraft){
o=true;
break
}}}}}
if(appCtxt.isOffline&&!o){
var s=this.getAccount();
if(s&&u.getAccount()!=s&&(s.type==ZmAccount.TYPE_MSE||s.type==ZmAccount.TYPE_EXCHANGE)){
o=true
}else{
var a=appCtxt.getCurrentSearch();
var e=a&&appCtxt.getById(a.folderId);
if(e&&e.nId==ZmOrganizer.ID_SYNC_FAILURES){
o=true
}}}
if(appCtxt.multiAccounts&&this.isRemote()&&h.getAccount&&this.getAccount().id!=h.getAccount().id){
o=true
}
if(!o&&!d){
if(u.folderId){
o=true;
for(var t=0;
t<n.length;
t++){
if(n[t].folderId!=this.id){
o=false;
break
}}}}}}}}
if(!o&&this.link){
o=this.isReadOnly()
}}
return !o
};
ZmFolder.prototype.isSyncIssuesFolder=function(){
return(this.name==ZmFolder.SYNC_ISSUES)
};
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(t){
if(!this.isRemote()&&t.isMountpoint&&t.rid){
return true
}
if(!this.link||!t.link||this.zid!=t.zid){
return false
}
if(this.id.split(":")[0]!=t.id.split(":")[0]){
return false
}
var e=this.shares&&this.shares[0];
if(!(e&&e.isInsert())){
return false
}
e=t.shares&&t.shares[0];
return(e&&e.isDelete())
};
ZmFolder.prototype.isOutbound=function(){
for(var e=0;
e<ZmFolder.OUTBOUND.length;
e++){
if(this.isUnder(ZmFolder.OUTBOUND[e])){
return true
}}
return false
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSearchFolder")){
ZmSearchFolder=function(t){
t.type=ZmOrganizer.SEARCH;
ZmFolder.call(this,t);
if(t.query){
var e={
query:t.query,types:t.types,sortBy:t.sortBy,searchId:t.id,accountName:(t.account&&t.account.name)};
this.search=new ZmSearch(e)
}};
ZmSearchFolder.ID_ROOT=ZmOrganizer.ID_ROOT;
ZmSearchFolder.create=function(h){
var r=AjxSoapDoc.create("CreateSearchFolderRequest","urn:zimbraMail");
var s=r.set("search");
s.setAttribute("name",h.name);
s.setAttribute("query",h.search.query);
if(h.search.types){
var t=h.search.types.getArray();
if(t.length){
var e=[];
for(var n=0;
n<t.length;
n++){
e.push(ZmSearch.TYPE[t[n]])
}
s.setAttribute("types",e.join(","))
}}
if(h.search.sortBy){
s.setAttribute("sortBy",h.search.sortBy)
}
var o;
if(h.isGlobal){
s.setAttribute("f","g");
o=appCtxt.accountList.mainAccount.name
}
s.setAttribute("l",h.parent.id);
appCtxt.getAppController().sendRequest({
soapDoc:r,asyncMode:true,accountName:o,errorCallback:(new AjxCallback(null,ZmOrganizer._handleErrorCreate,h))}
)
};
ZmSearchFolder.prototype=new ZmFolder;
ZmSearchFolder.prototype.constructor=ZmSearchFolder;
ZmSearchFolder.prototype.toString=function(){
return"ZmSearchFolder"
};
ZmSearchFolder.prototype.getIcon=function(){
return(this.nId==ZmOrganizer.ID_ROOT)?null:(this.isOfflineGlobalSearch?"GlobalSearchFolder":"SearchFolder")
};
ZmSearchFolder.prototype.getToolTip=function(){};
ZmSearchFolder.prototype._getNewParent=function(t){
var e=appCtxt.getById(t);
if(e){
return e
}
return appCtxt.getById(t)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSearch")){
ZmSearch=function(t){
if(t){
for(var e in t){
this[e]=t[e]
}
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){
this._parseQuery()
}
if(this.querySortOrder){
this.sortBy=this.querySortOrder
}}}
this.isGalSearch=false;
this.isCalResSearch=false;
if(ZmSearch._mailEnabled==null){
ZmSearch._mailEnabled=appCtxt.get(ZmSetting.MAIL_ENABLED);
if(ZmSearch._mailEnabled){
AjxDispatcher.require("MailCore")
}}
if(!(this.types instanceof AjxVector)){
this.types=AjxUtil.toArray(this.types);
if(!appCtxt.get(ZmSetting.MAIL_ENABLED)){
this.types=AjxUtil.arrayAsHash(this.types);
delete this.types[ZmSearch.TYPE[ZmItem.MSG]];
delete this.types[ZmSearch.TYPE[ZmItem.CONV]];
this.types=AjxUtil.keys(this.types)
}
this.types=AjxVector.fromArray(this.types)
}
if(this.types.size()==0){
this.types=AjxVector.fromArray(AjxUtil.keys(ZmSearch.TYPE))
}};
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.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.UNREAD_QUERY_RE=new RegExp("\bis:\s*(un)?read\b","i");
ZmSearch.IS_ANYWHERE_QUERY_RE=new RegExp("\bis:\s*anywhere\b","i");
ZmSearch.prototype.toString=function(){
return"ZmSearch"
};
ZmSearch.prototype.execute=function(e){
if(e.batchCmd||this.soapInfo){
this._executeSoap(e)
}else{
this._executeJson(e)
}};
ZmSearch.prototype._executeSoap=function(n){
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.query&&!this.isCalResSearch){
return
}
var m;
if(!this.response){
if(this.isGalSearch){
m=AjxSoapDoc.create("SearchGalRequest","urn:zimbraAccount");
var e=m.getMethod();
if(this.galType){
e.setAttribute("type",this.galType)
}
if(this.expandDL){
e.setAttribute("needExp",1)
}
m.set("name",this.query);
var h=m.set("searchFilter");
if(this.conds&&this.conds.length){
var r=m.set("conds",null,h);
this._applySoapCond(this.conds,m,r)
}}else{
if(this.isAutocompleteSearch){
m=AjxSoapDoc.create("AutoCompleteRequest","urn:zimbraMail");
var e=m.getMethod();
if(this.limit){
e.setAttribute("limit",this.limit)
}
if(this.expandDL){
e.setAttribute("needExp",1)
}
m.set("name",this.query)
}else{
if(this.isGalAutocompleteSearch){
m=AjxSoapDoc.create("AutoCompleteGalRequest","urn:zimbraAccount");
var e=m.getMethod();
e.setAttribute("limit",this._getLimit());
if(this.galType){
e.setAttribute("type",this.galType)
}
if(this.expandDL){
e.setAttribute("needExp",1)
}
m.set("name",this.query)
}else{
if(this.isCalResSearch){
m=AjxSoapDoc.create("SearchCalendarResourcesRequest","urn:zimbraAccount");
var e=m.getMethod();
if(this.attrs){
var f=[].concat(this.attrs);
AjxUtil.arrayRemove(f,"fullName");
e.setAttribute("attrs",f.join(","))
}
var h=m.set("searchFilter");
if(this.conds&&this.conds.length){
var r=m.set("conds",null,h);
this._applySoapCond(this.conds,m,r)
}}else{
if(this.soapInfo){
m=AjxSoapDoc.create(this.soapInfo.method,this.soapInfo.namespace);
for(var u in this.soapInfo.additional){
var o=m.set(u);
var f=this.soapInfo.additional;
for(var l in f){
o.setAttribute(l,f[l])
}}}else{
m=AjxSoapDoc.create("SearchRequest","urn:zimbraMail")
}
var e=this._getStandardMethod(m);
if(this.types){
var d=this.types.getArray();
if(d.length){
var c=[];
for(var s=0;
s<d.length;
s++){
c.push(ZmSearch.TYPE[d[s]])
}
e.setAttribute("types",c.join(","));
var t=appCtxt.getById(this.folderId);
if(t&&(t.isUnder(ZmFolder.ID_SENT)||t.isUnder(ZmFolder.ID_DRAFTS)||t.isUnder(ZmFolder.ID_OUTBOX))){
e.setAttribute("recip","1")
}
if(this.fetch){
e.setAttribute("fetch",(this.fetch=="all")?"all":"1");
if(this.getHtml){
e.setAttribute("html","1")
}}
if(this.markRead){
e.setAttribute("read","1")
}}}
if(this.inDumpster){
e.setAttribute("inDumpster","1")
}}}}}}
var p=new AjxCallback(this,this._handleResponseExecute,[n.callback]);
if(n.batchCmd){
n.batchCmd.addRequestParams(m,p)
}else{
return appCtxt.getAppController().sendRequest({
soapDoc:m,asyncMode:true,callback:p,errorCallback:n.errorCallback,timeout:n.timeout,noBusyOverlay:n.noBusyOverlay,response:this.response}
)
}};
ZmSearch.prototype._executeJson=function(o){
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.query&&!this.queryHint&&!this.isCalResSearch){
return
}
var g,n,d;
if(!this.response){
if(this.isGalSearch){
g={
SearchGalRequest:{
_jsns:"urn:zimbraAccount"}};
n=g.SearchGalRequest;
if(this.galType){
n.type=this.galType
}
if(this.expandDL){
n.needExp=1
}
n.name=this.query;
n.offset=this.offset=(this.offset||0);
n.limit=this._getLimit();
n.locale={
_content:AjxEnv.DEFAULT_LOCALE};
if(this.lastId){
n.cursor={
id:this.lastId,sortVal:(this.lastSortVal||"")}
}
if(this.sortBy){
n.sortBy=this.sortBy
}
if(this.conds&&this.conds.length){
n.searchFilter={
conds:{}};
n.searchFilter.conds=ZmSearch.prototype._applyJsonCond(this.conds,n)
}}else{
if(this.isAutocompleteSearch){
g={
AutoCompleteRequest:{
_jsns:"urn:zimbraMail"}};
n=g.AutoCompleteRequest;
if(this.limit){
n.limit=this.limit
}
if(this.expandDL){
n.needExp=1
}
n.name={
_content:this.query}
}else{
if(this.isGalAutocompleteSearch){
g={
AutoCompleteGalRequest:{
_jsns:"urn:zimbraAccount"}};
n=g.AutoCompleteGalRequest;
n.limit=this._getLimit();
n.name=this.query;
if(this.galType){
n.type=this.galType
}
if(this.expandDL){
n.needExp=1
}}else{
if(this.isCalResSearch){
g={
SearchCalendarResourcesRequest:{
_jsns:"urn:zimbraAccount"}};
n=g.SearchCalendarResourcesRequest;
if(this.attrs){
var f=[].concat(this.attrs);
n.attrs=f.join(",")
}
n.offset=this.offset=(this.offset||0);
n.limit=this._getLimit();
if(this.conds&&this.conds.length){
n.searchFilter={
conds:{}};
n.searchFilter.conds=ZmSearch.prototype._applyJsonCond(this.conds,n)
}}else{
if(this.soapInfo){
d=AjxSoapDoc.create(this.soapInfo.method,this.soapInfo.namespace);
for(var c in this.soapInfo.additional){
var t=d.set(c);
var f=this.soapInfo.additional[c];
for(var r in f){
t.setAttribute(r,f[r])
}}}else{
g={
SearchRequest:{
_jsns:"urn:zimbraMail"}};
n=g.SearchRequest
}
this._getStandardMethodJson(n);
if(this.types){
var l=this.types.getArray();
if(l.length){
var h=[];
for(var s=0;
s<l.length;
s++){
h.push(ZmSearch.TYPE[l[s]])
}
n.types=h.join(",");
var e=appCtxt.getById(this.folderId);
if(e&&(e.isUnder(ZmFolder.ID_SENT)||e.isUnder(ZmFolder.ID_DRAFTS)||e.isUnder(ZmFolder.ID_OUTBOX))){
n.recip=1
}
if(this.fetch){
n.fetch=(this.fetch=="all")?"all":1;
if(this.getHtml){
n.html=1
}}
if(this.markRead){
n.read=1
}
if(this.headers){
for(var m in this.headers){
if(!n.header){
n.header=[]
}
n.header.push({
n:m}
)
}}
if(l.length==1&&l[0]==ZmItem.TASK&&this.allowableTaskStatus){
n.allowableTaskStatus=this.allowableTaskStatus
}}}
if(this.inDumpster){
n.inDumpster=1
}}}}}}
var p=new AjxCallback(this,this._handleResponseExecute,[o.callback]);
if(o.batchCmd){
o.batchCmd.addRequestParams(d,p)
}else{
var u={
jsonObj:g,soapDoc:d,asyncMode:true,callback:p,errorCallback:o.errorCallback,timeout:o.timeout,noBusyOverlay:o.noBusyOverlay,response:this.response,accountName:this.accountName};
return appCtxt.getAppController().sendRequest(u)
}};
ZmSearch.prototype._applySoapCond=function(l,h,s,o){
if(o||this.join==ZmSearch.JOIN_OR){
s.setAttribute("or",1)
}
for(var n=0;
n<l.length;
n++){
var r=l[n];
if(AjxUtil.isArray(r)){
var a=h.set("conds",null,s);
this._applySoapCond(r,h,a,true)
}else{
if(r.attr=="fullName"&&r.op=="has"){
var t=h.set("name",r.value)
}else{
var e=h.set("cond",null,s);
e.setAttribute("attr",r.attr);
e.setAttribute("op",r.op);
e.setAttribute("value",r.value)
}}}};
ZmSearch.prototype._applyJsonCond=function(e,a,o){
var s={};
if(o||this.join==ZmSearch.JOIN_OR){
s.or=1
}
for(var t=0;
t<e.length;
t++){
var n=e[t];
if(AjxUtil.isArray(n)){
if(!s.conds){
s.conds=[]
}
s.conds.push(this._applyJsonCond(n,a,true))
}else{
if(n.attr=="fullName"&&n.op=="has"){
a.name={
_content:n.value}
}else{
if(!s.cond){
s.cond=[]
}
s.cond.push({
attr:n.attr,op:n.op,value:n.value}
)
}}}
return s
};
ZmSearch.prototype._handleResponseExecute=function(o,t){
var a=t.getResponse();
if(this.isGalSearch){
a=a.SearchGalResponse
}else{
if(this.isCalResSearch){
a=a.SearchCalendarResourcesResponse
}else{
if(this.isAutocompleteSearch){
a=a.AutoCompleteResponse
}else{
if(this.isGalAutocompleteSearch){
a=a.AutoCompleteGalResponse
}else{
if(this.soapInfo){
a=a[this.soapInfo.response]
}else{
a=a.SearchResponse
}}}}}
var e=new ZmSearchResult(this);
e.set(a);
t.set(e);
if(o){
o.run(t)
}};
ZmSearch.prototype.getConv=function(a){
if((!this.query&&!this.queryHint)||!a.cid){
return
}
var n={
SearchConvRequest:{
_jsns:"urn:zimbraMail"}};
var e=n.SearchConvRequest;
this._getStandardMethodJson(e);
e.cid=a.cid;
if(a.fetchId){
e.fetch=a.fetchId;
if(a.markRead){
e.read=1
}
if(this.getHtml){
e.html=1
}
if(a.needExp!==false){
e.needExp=1
}
if(ZmMailMsg.requestHeaders){
for(var o in ZmMailMsg.requestHeaders){
if(!e.header){
e.header=[]
}
e.header.push({
n:o}
)
}}}
if(!a.noTruncate){
e.max=appCtxt.get(ZmSetting.MAX_MESSAGE_SIZE)
}
var t={
jsonObj:n,asyncMode:true,callback:(new AjxCallback(this,this._handleResponseGetConv,a.callback)),accountName:this.accountName};
appCtxt.getAppController().sendRequest(t)
};
ZmSearch.prototype._handleResponseGetConv=function(o,t){
var a=t.getResponse().SearchConvResponse;
var e=new ZmSearchResult(this);
e.set(a,null,true);
t.set(e);
if(o){
o.run(t)
}};
ZmSearch.prototype.getTitle=function(){
var t;
if(this.folderId){
var o=ZmOrganizer.getSystemId(this.folderId);
var a=appCtxt.getById(o);
if(a){
t=a.getName(true,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH,true)
}}else{
if(this.tagId){
var e=appCtxt.getById(this.tagId);
t=e&&e.getName(true,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH,true)
}}
return t?([ZmMsg.zimbraTitle,t].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(t){
var s=t.getMethod();
if(this.sortBy){
s.setAttribute("sortBy",this.sortBy)
}
if(ZmSearch._mailEnabled){
var e;
for(var n in ZmMailMsg.requestHeaders){
e=t.set("header",null,null);
e.setAttribute("n",n)
}}
ZmTimezone.set(t,AjxTimezone.DEFAULT,null);
t.set("locale",appCtxt.get(ZmSetting.LOCALE_NAME),null);
if(this.lastId!=null&&this.lastSortVal){
var o=t.set("cursor");
o.setAttribute("id",this.lastId);
o.setAttribute("sortVal",this.lastSortVal);
if(this.endSortVal){
o.setAttribute("endSortVal",this.endSortVal)
}}
this.offset=this.offset||0;
s.setAttribute("offset",this.offset);
s.setAttribute("limit",this._getLimit());
var a=(this.queryHint)?([this.query," (",this.queryHint,")"].join("")):this.query;
t.set("query",a);
if(this.field){
s.setAttribute("field",this.field)
}
return s
};
ZmSearch.prototype._getStandardMethodJson=function(t){
if(this.sortBy){
t.sortBy=this.sortBy
}
if(ZmSearch._mailEnabled){
var e=ZmMailMsg.requestHeaders;
if(e&&e.length){
t.header=[];
for(var a in e){
t.header.push({
n:a}
)
}}}
ZmTimezone.set(t,AjxTimezone.DEFAULT);
t.locale={
_content:AjxEnv.DEFAULT_LOCALE};
if(this.lastId!=null&&this.lastSortVal){
t.cursor={
id:this.lastId,sortVal:this.lastSortVal};
if(this.endSortVal){
t.cursor.endSortVal=this.endSortVal
}}
t.offset=this.offset=this.offset||0;
t.limit=this._getLimit();
if(this.idsOnly){
t.resultMode="IDS"
}
t.query=(this.queryHint)?([this.query," (",this.queryHint,")"].join("")):this.query;
if(this.field){
t.field=this.field
}};
ZmSearch.prototype._getLimit=function(){
if(this.limit){
return this.limit
}
var e;
if(this.isGalAutocompleteSearch){
e=appCtxt.get(ZmSetting.AUTOCOMPLETE_LIMIT)
}else{
var t=this.types&&this.types.get(0);
var a=appCtxt.getApp(ZmItem.APP[t])||appCtxt.getCurrentApp();
if(a&&a.getLimit){
e=a.getLimit(this.offset)
}else{
e=appCtxt.get(ZmSetting.PAGE_SIZE)||ZmSearch.DEFAULT_LIMIT
}}
this.limit=e;
return e
};
ZmSearch.IS_OP={
"in":true,inid:true,is:true,tag:true,sort:true};
ZmSearch.COND={
and:" && ",or:" || ",not:" !"};
ZmSearch.EOW={
" ":true,":":true,"(":true,")":true};
ZmSearch.FLAG={};
ZmSearch.FLAG.unread="item.isUnread";
ZmSearch.FLAG.read="!item.isUnread";
ZmSearch.FLAG.flagged="item.isFlagged";
ZmSearch.FLAG.unflagged="!item.isFlagged";
ZmSearch.FLAG.forwarded="item.isForwarded";
ZmSearch.FLAG.unforwarded="!item.isForwarded";
ZmSearch.FLAG.sent="item.isSent";
ZmSearch.FLAG.replied="item.isReplied";
ZmSearch.FLAG.unreplied="!item.isReplied";
ZmSearch.prototype._parseQuery=function(){
var r=this.query||this.queryHint;
this.hasUnreadTerm=ZmSearch.UNREAD_QUERY_RE.test(r);
this.isAnywhere=ZmSearch.IS_ANYWHERE_QUERY_RE.test(r);
function u(t,O){
while(O<t.length&&t.charAt(O)==" "){
O++
}
return O
}
function h(B,C){
var W=B.charAt(C);
C++;
var t=false,A,O="";
while(C<B.length&&!t){
A=B.charAt(C);
if(A==W){
t=true
}else{
O+=A;
C++
}}
return t?{
str:O,pos:C+1}
:null
}
var q=r.length;
var y=[],p,m,j="",c=false,o=false,w=true,d=false,e=false;
var l=u(r,0);
while(l<q){
p=r.charAt(l);
o=ZmSearch.EOW[p];
if(p==":"){
if(ZmSearch.IS_OP[j]){
m=j
}else{
c=true
}
j="";
l=u(r,l+1);
continue
}
if(o){
if(m&&j){
y.push({
isTerm:true,op:m,arg:j}
);
m=j="";
w=true
}else{
if(!m){
if(ZmSearch.COND[j.toLowerCase()]){
var f=j.toLowerCase();
y.push(ZmSearch.COND[f]);
w=false;
if(f=="or"){
d=true
}}else{
if(j){
c=e=true
}}
j=""
}}}
if(p=="'"||p=='"'){
var v=h(r,l);
if(v){
j=v.str;
l=v.pos
}else{
c=true;
j="";
l=u(r,l+1)
}}else{
if(p=="("||p==")"){
y.push(p);
l=u(r,l+1)
}else{
if(p=="-"&&!j){
y.push("not");
l=u(r,l+1);
w=false
}else{
if(p!=" "){
j+=p
}
l++
}}}}
if(!c&&(l==r.length)&&m&&j){
y.push({
isTerm:true,op:m,arg:j}
);
w=true
}else{
if(!m&&j){
c=e=true
}}
c=c||!w;
var a,k;
var s=["return Boolean("];
for(var x=0,q=y.length;
x<q;
x++){
var g=y[x];
if(g.isTerm){
if(g.op=="in"||g.op=="inid"){
a=(g.op=="in")?this._getFolderId(g.arg):g.arg;
if(a){
s.push("((item.type == ZmItem.CONV) ? item.folders && item.folders['"+a+"'] : item.folderId == '"+a+"')")
}}else{
if(g.op=="tag"){
k=this._getTagId(g.arg,true);
if(k){
s.push("item.hasTag('"+k+"')")
}}else{
if(g.op=="is"){
var T=ZmSearch.FLAG[g.arg];
if(T){
s.push(T)
}}else{
if(g.op=="sort"){
this.querySortOrder=g.arg
}}}}
var b=y[x+1];
if(b&&(b.isTerm||b==ZmSearch.COND.not||b=="(")){
s.push(ZmSearch.COND.and)
}}else{
s.push(g)
}}
s.push(")");
if(!c){
try{
this.matches=new Function("item",s.join(""))
}
catch(z){}}
this.singleTerm=(a||k)&&(y.length==1)&&!c;
this.hasTextTerm=e;
var n=(appCtxt.multiAccounts&&this.isMultiAccount()&&!this.query&&this.queryHint);
if(!d||n){
this.folderId=a;
this.tagId=k
}};
ZmSearch.prototype._getFolderId=function(r){
var e=ZmFolder.QUERY_ID[r];
var t=this.accountName;
if(!t){
var s=appCtxt.getActiveAccount();
t=s?s.name:appCtxt.accountList.mainAccount
}
if(!e){
var n=t&&appCtxt.accountList.getAccountByName(t);
var a=appCtxt.getFolderTree(n);
var o=a?a.getByPath(r,true):null;
if(o){
e=o.id
}}
if(t){
e=ZmOrganizer.getSystemId(e,appCtxt.accountList.getAccountByName(t))
}
return e
};
ZmSearch.prototype._getTagId=function(a,o){
var t=appCtxt.getTagTree();
if(t){
var e=t.getByName(a.toLowerCase());
if(e){
return o?e.nId:e.id
}}};
ZmSearch.prototype.hasFolderTerm=function(t){
if(!t){
return false
}
var e=new RegExp('\s*in:\s*"?('+AjxStringUtil.regExEscape(t)+')"?\s*',"i");
var a=new RegExp('(-|not)\s*in:\s*"?('+AjxStringUtil.regExEscape(t)+')"?\s*',"i");
return(e.test(this.query)&&!a.test(this.query))
};
ZmSearch.prototype.replaceFolderTerm=function(a,e){
if(!(a&&e)){
return
}
var t=new RegExp('(\s*in:\s*"?)('+AjxStringUtil.regExEscape(a)+')("?\s*)',"gi");
this.query=this.query.replace(t,"$1"+e+"$3")
};
ZmSearch.prototype.hasTagTerm=function(e){
if(!e){
return false
}
var t=new RegExp('\s*tag:\s*"?('+AjxStringUtil.regExEscape(e)+')"?\s*',"i");
var a=new RegExp('(-|not)\s*tag:\s*"?('+AjxStringUtil.regExEscape(e)+')"?\s*',"i");
return(t.test(this.query)&&!a.test(this.query))
};
ZmSearch.prototype.replaceTagTerm=function(t,e){
if(!(t&&e)){
return
}
var a=new RegExp('(\s*tag:\s*"?)('+AjxStringUtil.regExEscape(t)+')("?\s*)',"gi");
this.query=this.query.replace(a,"$1"+e+"$3")
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmSearchResult")){
ZmSearchResult=function(e){
if(!e){
return
}
this._results={};
this.search=e
};
ZmSearchResult.prototype.toString=function(){
return"ZmSearchResult"
};
ZmSearchResult.prototype.dtor=function(){
for(var e in this._results){
if(this._results[e].clear){
this._results[e].clear();
this._results[e]=null
}}
this._results=null
};
ZmSearchResult.prototype.getResults=function(n){
n=n||this.type;
if(!this._results){
return ZmItem.RESULTS_LIST[n](this.search)
}
if(n==ZmItem.MIXED){
var s=new ZmMailList(ZmItem.MIXED,this.search);
for(var n in this._results){
var o=this._results[n];
if(o&&o.size()){
var e=o.getArray();
for(var t=0;
t<e.length;
t++){
s.add(e[t])
}}}
return s
}else{
if(this.search.idsOnly){
return this._results
}else{
return this._results[n]?this._results[n]:n&&ZmItem.RESULTS_LIST[n](this.search)
}}};
ZmSearchResult.prototype.getAttribute=function(e){
return this._respEl?this._respEl[e]:null
};
ZmSearchResult.prototype.set=function(m){
if(!this.search){
return
}
this._respEl=m;
if(this.search.isAutocompleteSearch){
return
}
var d={};
var r=0;
var f,n;
var a=this.search.isGalSearch;
var o=new Date();
var s=0;
if(a||this.search.isCalResSearch){
f=n=a?ZmItem.CONTACT:ZmItem.RESOURCE;
var w=a?m.cn:m.calresource;
if(w){
if(!this._results[f]){
this._results[f]=ZmItem.RESULTS_LIST[f](this.search)
}
for(var p=0;
p<w.length;
p++){
this._results[f].addFromDom(w[p])
}
s=w.length
}}else{
if(this.search.idsOnly){
this._results=m.hit||[];
return
}else{
var l=this.search.types.getArray();
n=l[0];
if(!n){
var h=AjxUtil.values(ZmList.NODE);
for(var g=0;
g<h.length;
g++){
var c=h[g];
if(m[c]){
n=ZmList.ITEM_TYPE[c];
if(l&&l.length==0){
l=[n]
}
break
}}}
if(!n){
var b=appCtxt.getCurrentAppName();
var l=ZmApp.SEARCH_TYPES;
n=l&&l.length&&l[0]
}
for(var g=0;
g<l.length;
g++){
var e=l[g];
var w=m[ZmList.NODE[e]];
if(!w&&(e==ZmItem.MSG)){
w=m.chat
}
if(w&&w.length){
s+=w.length;
if(!this._results[e]){
this._results[e]=ZmItem.RESULTS_LIST[e](this.search)
}
for(var p=0;
p<w.length;
p++){
var y=w[p];
y._type=e;
this._results[e].addFromDom(y)
}
if(!d[e]){
d[e]=true;
r++;
f=e
}}}}}
if(!s&&n){
this._results[n]=ZmItem.RESULTS_LIST[n](this.search)
}
if((a||this.search.isGalAutocompleteSearch)&&this._results[ZmItem.CONTACT]){
this._results[ZmItem.CONTACT].setIsGal(true)
}
if(this.search.isGalAutocompleteSearch){
this.isTokenized=(this._respEl.tokenizeKey!=null)
}
var u=new Date();
f=f||n;
if(r<=1){
this.type=f
}else{
if(r==2&&(d[ZmItem.PAGE]||d[ZmItem.DOCUMENT])){
this.type=ZmItem.PAGE
}else{
this.type=appCtxt.get(ZmSetting.MIXED_VIEW_ENABLED)?ZmItem.MIXED:f
}}
return this.type
};
ZmSearchResult._sortGalResults=function(t,e){
var o=t.getFileAs&&t.getFileAs().toLowerCase();
var n=e.getFileAs&&e.getFileAs().toLowerCase();
return o<n?-1:(o>n?1:0)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTag")){
ZmTag=function(e){
e.type=ZmOrganizer.TAG;
ZmOrganizer.call(this,e)
};
ZmTag.prototype=new ZmOrganizer;
ZmTag.prototype.constructor=ZmTag;
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(r,a,h,s,n){
var l;
var e=ZmOrganizer.normalizeId(a.id);
if(e<ZmOrganizer.FIRST_USER_ID[ZmOrganizer.TAG]){
return
}
l=h.getById(a.id);
if(l){
return l
}
var t={
id:a.id,name:a.name,color:ZmTag.checkColor(a.color),rgb:a.rgb,parent:r,tree:h,numUnread:a.u,account:n};
l=new ZmTag(t);
var o=s?ZmOrganizer.getSortIndex(l,ZmTag.sortCompare):null;
r.children.add(l,o);
return l
};
ZmTag.sortCompare=function(a,t){
var e=ZmOrganizer.checkSortArgs(a,t);
if(e!=null){
return e
}
if(a.name.toLowerCase()>t.name.toLowerCase()){
return 1
}
if(a.name.toLowerCase()<t.name.toLowerCase()){
return -1
}
return 0
};
ZmTag.checkName=function(e){
var t=ZmOrganizer.checkName(e);
if(t){
return t
}
if(e.indexOf("\")==0){
return AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(e))
}
return null
};
ZmTag.checkColor=function(e){
e=Number(e);
return((e!=null)&&(e>=0&&e<=ZmOrganizer.MAX_COLOR))?e:ZmOrganizer.DEFAULT_COLOR[ZmOrganizer.TAG]
};
ZmTag.getIcon=function(e){
var t={
getIcon:ZmTag.prototype.getIcon,color:e};
if(String(e).match(/^#/)){
t.rgb=e;
t.color=null
}
return ZmTag.prototype.getIconWithColor.call(t)
};
ZmTag.create=function(n){
var a=AjxSoapDoc.create("CreateTagRequest","urn:zimbraMail");
var o=a.set("tag");
o.setAttribute("name",n.name);
if(n.rgb){
o.setAttribute("rgb",n.rgb)
}else{
var t=ZmOrganizer.checkColor(n.color)||ZmOrganizer.DEFAULT_COLOR[ZmOrganizer.TAG];
o.setAttribute("color",t)
}
var e=new AjxCallback(null,ZmTag._handleErrorCreate,n);
appCtxt.getAppController().sendRequest({
soapDoc:a,asyncMode:true,errorCallback:e,accountName:n.accountName}
)
};
ZmTag._handleErrorCreate=function(o,t){
if(t.code==ZmCsfeException.MAIL_INVALID_NAME){
var a=AjxMessageFormat.format(ZmMsg.errorInvalidName,AjxStringUtil.htmlEncode(o.name));
var e=appCtxt.getMsgDialog();
e.setMessage(a,DwtMessageDialog.CRITICAL_STYLE);
e.popup();
return true
}
return false
};
ZmTag.prototype.getIcon=function(){
return(this.id==ZmOrganizer.ID_ROOT)?null:"Tag"
};
ZmTag.prototype.createQuery=function(){
return['tag:"',this.name,'"'].join("")
};
ZmTag.prototype.getToolTip=function(){};
ZmTag.prototype.notifyCreate=function(e){
var t=ZmTag.createFromJs(this,e,this.tree,true);
t._notify(ZmEvent.E_CREATE)
};
ZmTag.prototype.supportsSharing=function(){
return false
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTree")){
ZmTree=function(e){
if(arguments.length==0){
return
}
ZmModel.call(this,e);
this.type=e;
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(e){
return this.root?this.root.getById(e):null
};
ZmTree.prototype.getByName=function(e){
return this.root?this.root.getByName(e):null
};
ZmTree.prototype.getByType=function(e){
return this.root?this.root.getByType(e):null
};
ZmTree.prototype.size=function(){
return this.root?this.root.size():0
};
ZmTree.prototype.reset=function(){
this.root=null
};
ZmTree.prototype.asList=function(e){
var t=[];
return this.root?this._addToList(this.root,t,e):t
};
ZmTree.prototype.getUnreadHash=function(e){
if(!e){
e={}
}
return this.root?this._getUnreadHash(this.root,e):e
};
ZmTree.prototype._addToList=function(e,r,t){
var s=t&&t.includeRemote;
var h=t&&t.remoteOnly;
var n=e.isRemote();
if((!n&&!h)||(n&&(h||s))){
r.push(e)
}
var o=e.children.getArray();
for(var a=0;
a<o.length;
a++){
this._addToList(o[a],r,t)
}
return r
};
ZmTree.prototype._asString=function(e,o){
if(e.id){
o=o+e.id
}
var a=e.children.clone().getArray();
if(a.length){
a.sort(function(s,n){
return s.id-n.id
}
);
o=o+"[";
for(var t=0;
t<a.length;
t++){
if(a[t].id==ZmFolder.ID_TAGS){
continue
}
if(t>0){
o=o+","
}
o=this._asString(a[t],o)
}
o=o+"]"
}
return o
};
ZmTree.prototype._getUnreadHash=function(e,t){
t[e.id]=e.numUnread;
var o=e.children.getArray();
for(var a=0;
a<o.length;
a++){
this._getUnreadHash(o[a],t)
}
return t
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmTagTree")){
ZmTagTree=function(e){
ZmTree.call(this,ZmOrganizer.TAG);
var t=(e)?([e.id,ZmTag.ID_ROOT].join(":")):ZmTag.ID_ROOT;
this.root=new ZmTag({
id:t,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(a,o,n){
if(!a||!a.tag||!a.tag.length){
return
}
for(var t=0;
t<a.tag.length;
t++){
ZmTag.createFromJs(this.root,a.tag[t],this,null,n)
}
var e=this.root.children.getArray();
if(e.length){
e.sort(ZmTag.sortCompare)
}};
ZmTagTree.prototype.getByIndex=function(e){
var t=this.asList();
if(t&&t.length&&(e<t.length)){
return t[e]
}};
ZmTagTree.prototype.reset=function(){
this.root=new ZmTag({
id:ZmTag.ID_ROOT,tree:this}
)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmFolderTree")){
ZmFolderTree=function(e){
ZmTree.call(this,e)
};
ZmFolderTree.prototype=new ZmTree;
ZmFolderTree.prototype.constructor=ZmFolderTree;
ZmFolderTree.IS_PARSED={};
ZmFolderTree.prototype.toString=function(){
return"ZmFolderTree"
};
ZmFolderTree.prototype.loadFromJs=function(a,e,t){
this.root=(e=="zimlet")?ZmZimlet.createFromJs(null,a,this):ZmFolderTree.createFromJs(null,a,this,e,null,t)
};
ZmFolderTree.createFromJs=function(f,r,b,d,y,h){
if(!(r&&r.id)){
return
}
var a;
if(d=="search"){
var l;
if(r.types){
var p=r.types.split(",");
l=[];
var c=appCtxt.get(ZmSetting.MAIL_ENABLED);
for(var s=0;
s<p.length;
s++){
var m=ZmSearch.TYPE_MAP[p[s]];
if(!m||(!c&&(m==ZmItem.CONV||m==ZmItem.MSG))){
continue
}
l.push(m)
}
if(l.length==0){
return null
}}
var n={
id:r.id,name:r.name,parent:f,tree:b,numUnread:r.u,query:r.query,types:l,sortBy:r.sortBy,account:h};
a=new ZmSearchFolder(n);
ZmFolderTree._fillInFolder(a,r,y);
ZmFolderTree._traverse(a,r,b,(y||[]),d,h)
}else{
var m=r.view?(ZmOrganizer.TYPE[r.view]):(f?f.type:ZmOrganizer.FOLDER);
if(!m){
return
}
var g=(r.acl&&r.acl.grant&&r.acl.grant.length>0);
if(appCtxt.inStartup&&ZmOrganizer.DEFERRABLE[m]&&!appCtxt.isOffline){
var o=appCtxt.getApp(ZmOrganizer.APP[m]);
var e={
type:m,parent:f,obj:r,tree:b,path:y,elementType:d,account:h};
o.addDeferredFolder(e)
}else{
var u=ZmOrganizer.ORG_PACKAGE[m];
if(u){
AjxDispatcher.require(u)
}
a=ZmFolderTree.createFolder(m,f,r,b,y,d,h);
ZmFolderTree._traverse(a,r,b,(y||[]),d,h)
}}
return a
};
ZmFolderTree.createAllDeferredFolders=function(){
var e=appCtxt.getAppController();
for(var t in ZmApp.ORGANIZER){
var a=e.getApp(t);
a.createDeferred()
}};
ZmFolderTree._traverse=function(e,n,m,u,l,h){
var a=(e.nId==ZmOrganizer.ID_ROOT);
if(n.folder&&n.folder.length){
if(!a){
u.push(n.name)
}
for(var s=0;
s<n.folder.length;
s++){
var r=n.folder[s];
var o=ZmFolderTree.createFromJs(e,r,m,(l||"folder"),u,h);
if(e&&o){
e.children.add(o)
}}
if(!a){
u.pop()
}}
if(n.search&&n.search.length){
if(!a){
u.push(n.name)
}
for(var s=0;
s<n.search.length;
s++){
var d=n.search[s];
var t=ZmFolderTree.createFromJs(e,d,m,"search",u,h);
if(t){
e.children.add(t)
}}
if(!a){
u.pop()
}}
if(n.link&&n.link.length){
for(var s=0;
s<n.link.length;
s++){
var c=n.link[s];
var o=ZmFolderTree.createFromJs(e,c,m,"link",u,h);
if(o){
e.children.add(o)
}}}};
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",account:account};
var folder=new orgClass(params);
ZmFolderTree._fillInFolder(folder,obj,path);
ZmFolderTree.IS_PARSED[type]=true;
return folder
};
ZmFolderTree._fillInFolder=function(e,a,t){
if(t&&t.length){
e.path=t.join("/")
}
if(a.f&&e._parseFlags){
e._parseFlags(a.f)
}
e._setSharesFromJs(a)
};
ZmFolderTree.prototype.getByType=function(e){
return this.root?this.root.getByType(e):null
};
ZmFolderTree.prototype.getByPath=function(t,e){
return this.root?this.root.getByPath(t,e):null
};
ZmFolderTree.prototype.handleNoSuchFolderError=function(e,r,l){
var h=this.getByType(e);
var a;
var s=false;
if(h){
for(var n=0;
n<h.length;
n++){
if((h[n].zid==r)&&(h[n].rid==l)){
h[n].noSuchFolder=true;
if(!a){
var o=appCtxt.getAppController().getOverviewId();
a=appCtxt.getOverviewController().getTreeView(o,e)
}
var t=a.getTreeItemById(h[n].id);
t.setText(h[n].getName(true));
this.handleDeleteNoSuchFolder(h[n]);
s=true
}}}
return s
};
ZmFolderTree.prototype.handleDeleteNoSuchFolder=function(e){
var t=appCtxt.getYesNoMsgDialog();
t.reset();
t.registerCallback(DwtDialog.YES_BUTTON,this._deleteOrganizerYesCallback,this,[e,t]);
t.registerCallback(DwtDialog.NO_BUTTON,appCtxt.getAppController()._clearDialog,this,t);
var a=AjxMessageFormat.format(ZmMsg.confirmDeleteMissingFolder,AjxStringUtil.htmlEncode(e.getName(false,0,true)));
t.setMessage(a,DwtMessageDialog.WARNING_STYLE);
t.popup()
};
ZmFolderTree.prototype._deleteOrganizerYesCallback=function(e,t){
e._delete();
appCtxt.getAppController()._clearDialog(t)
};
ZmFolderTree.prototype.getPermissions=function(r){
var n=r.folderIds||this._getItemsWithoutPerms(r.type);
if(n.length>0){
var o=AjxSoapDoc.create("BatchRequest","urn:zimbra");
o.setMethodAttribute("onerror","continue");
var s=o.getDoc();
for(var a=0;
a<n.length;
a++){
var t=o.set("GetFolderRequest",null,null,"urn:zimbraMail");
var e=s.createElement("folder");
e.setAttribute("l",n[a]);
t.appendChild(e)
}
var h=new AjxCallback(this,this._handleResponseGetShares,[r.callback,r.skipNotify]);
appCtxt.getRequestMgr().sendRequest({
soapDoc:o,asyncMode:true,callback:h,noBusyOverlay:r.noBusyOverlay,accountName:r.accountName}
)
}else{
if(r.callback){
r.callback.run()
}}};
ZmFolderTree.prototype._getItemsWithoutPerms=function(n){
var s=[];
var o=n?[n]:[ZmOrganizer.FOLDER,ZmOrganizer.CALENDAR,ZmOrganizer.TASKS,ZmOrganizer.NOTEBOOK,ZmOrganizer.BRIEFCASE,ZmOrganizer.ADDRBOOK];
for(var t=0;
t<o.length;
t++){
var r=o[t];
if(!ZmFolderTree.IS_PARSED[r]){
continue
}
var e=this.getByType(r);
for(var a=0;
a<e.length;
a++){
if(e[a].link&&e[a].shares==null){
s.push(e[a].id)
}}}
return s
};
ZmFolderTree.prototype._handleResponseGetShares=function(h,o,c){
var l=c.getResponse().BatchResponse;
this._handleErrorGetShares(l);
var e=l.GetFolderResponse;
if(e){
for(var a=0;
a<e.length;
a++){
var n=e[a].link?e[a].link[0]:null;
if(n){
var s=appCtxt.getById(n.id);
if(s){
s.perm=n.perm;
if(n.n){
s.numTotal=n.n
}
if(n.u){
s.numUnread=n.u
}
s._setSharesFromJs(n)
}
if(n.folder&&n.folder.length>0){
var r=appCtxt.getById(n.id);
if(r){
for(var t=0;
t<n.folder.length;
t++){
if(appCtxt.getById(n.folder[t].id)){
continue
}
r.notifyCreate(n.folder[t],"link",o)
}}}}}}
if(h){
h.run()
}};
ZmFolderTree.prototype._handleErrorGetShares=function(l){
var n=l.Fault;
if(n){
var a=[];
var t=[];
for(var o=0,e=n.length;
o<e;
o++){
var r=ZmCsfeCommand.faultToEx(n[o]);
if(r.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER){
var h=r.data.itemId[0];
var s=h.lastIndexOf(":");
t.push(h.substring(0,s));
a.push(h.substring(s+1,h.length))
}}
if(t.length){
this._markNoSuchFolder(t,a)
}}};
ZmFolderTree.prototype._markNoSuchFolder=function(t,n){
var s=appCtxt.getFolderTree();
var e=s&&s.root?s.root.children.getArray():null;
for(var o=0;
o<e.length;
o++){
for(var a=0;
a<n.length;
a++){
if((e[o].zid==t[a])&&(e[o].rid==n[a])){
e[o].noSuchFolder=true
}}}};
ZmFolderTree.prototype._sortFolder=function(a){
var t=a.children;
if(t&&t.length){
t.sort(ZmFolder.sortCompare);
for(var e=0;
e<t.length;
e++){
this._sortFolder(t[e])
}}}
}
if(AjxPackage.define("zimbraMail.share.model.ZmList")){
ZmList=function(t,e){
if(arguments.length==0){
return
}
ZmModel.call(this,t);
this.type=t;
this.search=e;
this._vector=new AjxVector();
this._hasMore=false;
this._idHash=new Object();
var a=appCtxt.getTagTree();
if(a){
this._tagChangeListener=new AjxListener(this,this._tagTreeChangeListener);
a.addChangeListener(this._tagChangeListener)
}};
ZmList.prototype=new ZmModel;
ZmList.prototype.constructor=ZmList;
ZmList.ITEM_CLASS={};
ZmList.NODE={};
ZmList.ITEM_TYPE={};
ZmList.CHUNK_SIZE=100;
ZmList.CHUNK_PAUSE=500;
ZmList.prototype.toString=function(){
return"ZmList"
};
ZmList.prototype.get=function(e){
return this._vector.get(e)
};
ZmList.prototype.add=function(t,e){
this._vector.add(t,e);
if(t.id){
this._idHash[t.id]=t
}};
ZmList.prototype.remove=function(e){
this._vector.remove(e);
if(e.id){
delete this._idHash[e.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(e){
return this._vector.indexOf(e)
};
ZmList.prototype.hasMore=function(){
return this._hasMore
};
ZmList.prototype.setHasMore=function(e){
this._hasMore=e
};
ZmList.prototype.getArray=function(){
return this._vector.getArray()
};
ZmList.prototype.getVector=function(){
return this._vector
};
ZmList.prototype.getById=function(e){
return this._idHash[e]
};
ZmList.prototype.clear=function(){
var e=this.getArray();
for(var t=0;
t<e.length;
t++){
e[t].clear()
}
this._evtMgr.removeAll(ZmEvent.L_MODIFY);
this._vector.removeAll();
for(var o in this._idHash){
this._idHash[o]=null
}
this._idHash=new Object()
};
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;
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){
if(!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(o,a){
var n=null;
var t=(o+a>this.size())?this.size():o+a;
var e=this.getArray();
if(o<t){
n=AjxVector.fromArray(e.slice(o,t))
}
return n
};
ZmList.prototype.cache=function(n,t){
this.getVector().merge(n,t);
var o=t.getArray();
for(var e=0;
e<o.length;
e++){
var a=o[e];
a.list=this;
if(a.id){
this._idHash[a.id]=a
}}};
ZmList.prototype.flagItems=function(a){
a=Dwt.getParams(arguments,["items","op","value","callback"]);
a.items=AjxUtil.toArray(a.items);
if(a.op=="update"){
a.action=a.op;
a.attrs={
f:a.value}
}else{
a.action=a.value?a.op:"!"+a.op
}
if(appCtxt.multiAccounts){
var t=this.search.folderId;
var e=t&&appCtxt.getById(t);
if(e&&e.isRemote()){
a.accountName=a.items[0].getAccount().name
}}
this._itemAction(a)
};
ZmList.prototype.tagItems=function(s){
s=Dwt.getParams(arguments,["items","tagId","doTag"]);
var o=s.tagId||(s.tag&&s.tag.id);
if(appCtxt.multiAccounts&&!appCtxt.getActiveAccount().isMain){
o=ZmOrganizer.normalizeId(o)
}
var t=AjxUtil.toArray(s.items);
var e=[],r=s.doTag;
if(t[0]&&t[0] instanceof ZmItem){
for(var a=0;
a<t.length;
a++){
var n=t[a];
if((r&&(!n.hasTag(o)||n.type==ZmItem.CONV))||(!r&&n.hasTag(o))){
e.push(n)
}}}else{
e=t
}
s.items=e;
s.attrs={
tag:o};
s.action=r?"tag":"!tag";
s.actionText=r?ZmMsg.actionTag:ZmMsg.actionUntag;
if(s.tag&&s.tag.name){
s.actionArg=AjxStringUtil.htmlEncode(s.tag.name)
}
this._itemAction(s)
};
ZmList.prototype.removeAllTags=function(n){
n=(n&&n.items)?n:{
items:n};
var t=AjxUtil.toArray(n.items);
var e=[];
if(t[0]&&t[0] instanceof ZmItem){
for(var a=0;
a<t.length;
a++){
var o=t[a];
if(o.tags&&o.tags.length){
e.push(o)
}}}else{
e=t
}
n.items=e;
n.action="update";
n.attrs={
t:""};
n.actionText=ZmMsg.actionRemoveTags;
this._itemAction(n)
};
ZmList.prototype.moveItems=function(n){
n=Dwt.getParams(arguments,["items","folder","attrs","callback","errorCallback","finalCallback","noUndo","actionText"]);
var a=AjxUtil.hashCopy(n);
a.items=AjxUtil.toArray(n.items);
a.attrs=n.attrs||{};
a.childWin=n.childWin;
a.closeChildWin=n.closeChildWin;
if(a.folder.id==ZmFolder.ID_TRASH){
a.actionText=(n.actionText!==null)?(n.actionText||ZmMsg.actionTrash):null;
a.action="trash"
}else{
a.actionText=(n.actionText!==null)?(n.actionText||ZmMsg.actionMove):null;
a.actionArg=n.folder.getName(false,false,true);
a.action="move";
a.attrs.l=n.folder.id
}
a.callback=new AjxCallback(this,this._handleResponseMoveItems,[n]);
if(appCtxt.multiAccounts){
var t=n.items[0].getFolderId&&n.items[0].getFolderId();
if(!t){
var o=n.items[0]&&n.items[0].id;
t=o&&appCtxt.getById(o)&&appCtxt.getById(o).folderId
}
var e=appCtxt.getById(t);
if((n.items[0].isDraft&&n.folder.id==ZmFolder.ID_DRAFTS)||(n.folder.isRemote())||(e&&e.isRemote())){
a.accountName=n.items[0].getAccount().name
}}
a.errorCallback=n.errorCallback;
this._itemAction(a)
};
ZmList.prototype._handleResponseMoveItems=function(s,e){
var r=e.getResponse();
if(r&&r.length&&(r[0] instanceof ZmItem)){
this.moveLocal(r,s.folder.id);
for(var a=0;
a<r.length;
a++){
var o=r[a];
var t={
oldFolderId:o.folderId};
o.moveLocal(s.folder.id)
}
var o=r[0];
var n=o.list;
if(n){
n._evt.batchMode=true;
n._evt.item=o;
n._evt.items=r;
n._notify(ZmEvent.E_MOVE,t)
}}
if(s.callback){
s.callback.run(e)
}};
ZmList.prototype.copyItems=function(e){
e=Dwt.getParams(arguments,["items","folder","attrs"]);
e.items=AjxUtil.toArray(e.items);
e.attrs=e.attrs||{};
e.attrs.l=e.folder.id;
e.action="copy";
e.actionText=ZmMsg.actionCopied;
e.actionArg=e.folder.getName(false,false,true);
e.callback=new AjxCallback(this,this._handleResponseCopyItems,e);
if(appCtxt.multiAccounts&&e.folder.isRemote()){
e.accountName=e.items[0].getAccount().name
}
this._itemAction(e)
};
ZmList.prototype._handleResponseCopyItems=function(o,e){
var a=e.getResponse();
if(a.length>0){
var t=AjxMessageFormat.format(ZmMsg.itemCopied,a.length);
appCtxt.getAppController().setStatusMsg(t)
}};
ZmList.prototype.deleteItems=function(o){
o=Dwt.getParams(arguments,["items","hardDelete","attrs","childWin"]);
var h=o.items=AjxUtil.toArray(o.items);
var r=[];
var n=[];
if(h[0]&&h[0] instanceof ZmItem){
for(var s=0;
s<h.length;
s++){
var l=h[s];
var t=l.getFolderId();
var e=appCtxt.getById(t);
if(o.hardDelete||(e&&e.isHardDelete())){
n.push(l)
}else{
r.push(l)
}}}else{
r=h
}
o.callback=o.childWin&&new AjxCallback(this._handleDeleteNewWindowResponse,o.childWin);
if(r.length){
if(appCtxt.multiAccounts){
var a=this._filterItemsByAccount(r);
if(!o.callback){
o.callback=new AjxCallback(this,this._deleteAccountItems,[a,o])
}
this._deleteAccountItems(a,o)
}else{
o.items=r;
o.folder=appCtxt.getById(ZmFolder.ID_TRASH);
this.moveItems(o)
}}
if(n.length){
o.items=n;
o.action="delete";
o.actionText=ZmMsg.actionDelete;
this._itemAction(o)
}};
ZmList.prototype._deleteAccountItems=function(o,n){
var e;
for(var t in o){
e=o[t];
break
}
if(e){
delete o[t];
var a=window.parentAppCtxt||window.appCtxt;
n.accountName=a.accountList.getAccount(t).name;
n.items=e;
n.folder=appCtxt.getById(ZmFolder.ID_TRASH);
this.moveItems(n)
}};
ZmList.prototype._filterItemsByAccount=function(e){
var n={};
if(e[0]&&e[0] instanceof ZmItem){
for(var a=0;
a<e.length;
a++){
var o=e[a];
var t=o.getAccount().id;
if(!n[t]){
n[t]=[]
}
n[t].push(o)
}}else{
var s=appCtxt.accountList.mainAccount.id;
n[s]=e
}
return n
};
ZmList.prototype._handleDeleteNewWindowResponse=function(t,e){
if(t){
t.close()
}};
ZmList.prototype.modifyItem=function(t,e,a){
t.modify(e,a)
};
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(e,t){};
ZmList.prototype.createLocal=function(e){};
ZmList.prototype.flagLocal=function(t,e,a){};
ZmList.prototype.tagLocal=function(t,e,a){};
ZmList.prototype.removeAllTagsLocal=function(e){};
ZmList.prototype.deleteLocal=function(e){
for(var t=0;
t<e.length;
t++){
this.remove(e[t])
}};
ZmList.prototype.moveLocal=function(t,e){
for(var a=0;
a<t.length;
a++){
this.remove(t[a])
}};
ZmList.prototype._itemAction=function(r,o){
var y=this._getIds(r.items);
var n=y.hash;
var l=y.list;
if(!(l&&l.length)){
if(r.callback){
r.callback.run(new ZmCsfeResult([]))
}
if(r.finalCallback){
r.finalCallback.run(r)
}
return
}
var u;
if(r.items.length==1&&r.items[0]&&r.items[0].type){
u=r.items[0].type
}else{
u=this.type
}
if(!u){
return
}
if(!r.accountName&&appCtxt.multiAccounts){
r.accountName=appCtxt.accountList.mainAccount.name
}
var a=ZmItem.SOAP_CMD+"Request";
var t=o?o._useJson:true;
var h,s;
if(t){
h={};
var g=this._getActionNamespace();
h[a]={
_jsns:g};
var s=h[a].action={};
s.op=r.action;
for(var c in r.attrs){
s[c]=r.attrs[c]
}}else{
h=AjxSoapDoc.create(a,this._getActionNamespace());
s=h.set("action");
s.setAttribute("op",r.action);
for(var c in r.attrs){
s.setAttribute(c,r.attrs[c])
}}
var f=appCtxt.getActionController();
var e=(!r.noUndo&&f&&f.actionPerformed({
op:r.action,ids:l,attrs:r.attrs}
))||null;
var p=new AjxCallback(this,this._handleResponseItemAction,[r.callback,e]);
var m={
ids:l,idHash:n,accountName:r.accountName,request:h,action:s,type:u,callback:p,finalCallback:r.finalCallback,errorCallback:r.errorCallback,batchCmd:o,numItems:r.count||0,actionText:r.actionText,actionArg:r.actionArg,actionLogItem:e,childWin:r.childWin,closeChildWin:r.closeChildWin};
var d=ZmList.progressDialog;
if(l.length>=ZmList.CHUNK_SIZE){
if(!d){
d=ZmList.progressDialog=appCtxt.getCancelMsgDialog();
d.reset();
d.registerCallback(DwtDialog.CANCEL_BUTTON,new AjxCallback(this,this._cancelAction,[m]))
}}
this._doAction(m)
};
ZmList.prototype._handleResponseItemAction=function(o,a,t,e){
if(a){
a.setComplete()
}
if(o){
e.set(t);
o.run(e)
}};
ZmList.prototype._doAction=function(n){
var o=n.ids.splice(0,ZmList.CHUNK_SIZE);
var a=o.join(",");
var r=true;
if(n.action.setAttribute){
n.action.setAttribute("id",a);
r=false
}else{
n.action.id=a
}
var t=Boolean(n.ids.length&&!n.cancelled);
var s=new AjxCallback(this,this._handleResponseDoAction,[n]);
if(n.batchCmd){
n.batchCmd.addRequestParams(n.request,s,n.errorCallback)
}else{
var e={
asyncMode:true,callback:s,errorCallback:n.errorCallback,accountName:n.accountName,more:t};
if(r){
e.jsonObj=n.request
}else{
e.soapDoc=n.request
}
n.reqId=appCtxt.getAppController().sendRequest(e)
}};
ZmList.prototype._handleResponseDoAction=function(t,c){
var r;
var o=c.getResponse();
var a=o[ZmItem.SOAP_CMD[t.type]+"Response"];
if(a&&a.action){
var e=a.action.id.split(",");
if(e){
var h=[];
for(var n=0;
n<e.length;
n++){
var l=t.idHash[e[n]];
if(l){
h.push(l)
}}
t.numItems+=h.length;
if(t.callback){
t.callback.run(h,c)
}
var s=ZmList.progressDialog;
if(t.actionText){
r=ZmList.getActionSummary(t.actionText,t.numItems,t.type,t.actionArg)
}
if(s&&r){
s.setMessage(r,DwtMessageDialog.INFO_STYLE,AjxMessageFormat.format(ZmMsg.inProgress));
if(!s.isPoppedUp()){
s.popup()
}}}}
if(t.ids.length&&!t.cancelled){
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._doAction,[t]),ZmItem.CHUNK_PAUSE)
}else{
t.reqId=null;
t.actionSummary=r;
if(t.finalCallback){
t.finalCallback.run(t)
}else{
ZmList.killProgressDialog(t.actionSummary,t.actionLogItem,t.closeChildWin)
}}};
ZmList.killProgressDialog=function(a,r,s){
var n=ZmList.progressDialog;
if(n){
n.unregisterCallback(DwtDialog.CANCEL_BUTTON);
n.popdown();
ZmList.progressDialog=null
}
if(a){
a=AjxStringUtil.htmlEncode(a);
var e=s?parentAppCtxt:appCtxt;
var o=e.getActionController();
var t=r&&o&&o.getUndoLink(r);
if(t&&o){
o.onPopup();
e.setStatusMsg({
msg:a+t,transitions:o.getStatusTransitions()}
)
}else{
e.setStatusMsg(a)
}}};
ZmList.getActionSummary=function(s,a,n,e){
var o=AjxMessageFormat.format(ZmMsg[ZmItem.COUNT_KEY[n]],a);
var t=AjxMessageFormat.format(ZmMsg[ZmItem.COUNT_KEY[n]],1);
return AjxMessageFormat.format(s,[a,o,e,t])
};
ZmList.prototype._cancelAction=function(t){
t.cancelled=true;
if(t.reqId){
appCtxt.getRequestMgr().cancelRequest(t.reqId)
}
if(t.finalCallback){
t.finalCallback.run(t)
}
var e=ZmList.progressDialog;
if(e&&e.isPoppedUp()){
e.popdown()
}};
ZmList.prototype._getTypedItems=function(t){
var e={};
for(var a=0;
a<t.length;
a++){
var o=t[a].type;
if(!e[o]){
e[o]=[]
}
e[o].push(t[a])
}
return e
};
ZmList.prototype._getIds=function(n){
var o={};
if(n instanceof ZmItem){
n=[n]
}
var t=[];
if((n&&n.length)){
for(var e=0;
e<n.length;
e++){
var a=n[e];
var s=a.id;
if(s){
t.push(s);
o[s]=a
}}}
return{
hash:o,list:t}
};
ZmList.prototype._sortIndex=function(e){
return 0
};
ZmList.prototype._redoSearch=function(e){
var t=appCtxt.getSearchController();
t.redoSearch(e._currentSearch)
};
ZmList.prototype._getActionNamespace=function(){
return"urn:zimbraMail"
};
ZmList.prototype._folderTreeChangeListener=function(s){
if(s.type!=ZmEvent.S_FOLDER){
return
}
var n=s.getDetail("organizers")[0];
var o=s.getDetail("fields");
var a=appCtxt.getCurrentController();
var t=(appCtxt.getCurrentList()==this);
if(s.event==ZmEvent.E_DELETE&&(s.source instanceof ZmFolder)&&s.source.id==ZmFolder.ID_TRASH){
var e=a.getCurrentView();
if(e){
e.offset=0
}
a._resetNavToolBarButtons(view)
}else{
if(t&&a&&a._currentSearch&&(s.event==ZmEvent.E_MOVE||(s.event==ZmEvent.E_MODIFY)&&o&&o[ZmOrganizer.F_NAME])){
var r=s.getDetail("oldPath");
if(a._currentSearch.hasFolderTerm(r)){
a._currentSearch.replaceFolderTerm(r,n.getPath());
appCtxt.getSearchController().setSearchField(a._currentSearch.query)
}}}};
ZmList.prototype._tagTreeChangeListener=function(r){
if(r.type!=ZmEvent.S_TAG){
return
}
var u=r.getDetail("organizers")[0];
var n=r.getDetail("fields");
var c=appCtxt.getCurrentController();
if(!c||(appCtxt.getCurrentList()!=this)){
return
}
if((r.event==ZmEvent.E_MODIFY)&&n&&n[ZmOrganizer.F_NAME]){
var t=r.getDetail("oldName");
if(c._currentSearch&&c._currentSearch.hasTagTerm(t)){
c._currentSearch.replaceTagTerm(t,u.getName());
appCtxt.getSearchController().setSearchField(c._currentSearch.query)
}}else{
if(r.event==ZmEvent.E_DELETE){
var h=this.getArray();
var e=this._evtMgr.isListenerRegistered(ZmEvent.L_MODIFY);
for(var o=0;
o<h.length;
o++){
var d=this.getById(h[o].id);
if(d&&d.hasTag(u.id)){
d.tagLocal(u.id,false);
if(e){
this._notify(ZmEvent.E_TAGS,{
items:[d]}
)
}}}
if(c._currentSearch&&c._currentSearch.hasTagTerm(u.getName())){
var l=appCtxt.getCurrentViewId();
c.enablePagination(false,l);
var s=c.getCurrentView();
if(s&&s.sortingEnabled){
s.sortingEnabled=false
}
if(l==ZmId.VIEW_CONVLIST){
c._currentSearch.query="is:read is:unread"
}
c._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(e){
return(e)?this._count:this.visibleAccounts.length
};
ZmAccountList.prototype.add=function(e){
this._accounts[e.id]=e;
this._count++;
if(e.visible||e.id==ZmAccountList.DEFAULT_ID){
this.visibleAccounts.push(e)
}
if(e.id==ZmAccountList.DEFAULT_ID){
this.mainAccount=e
}};
ZmAccountList.prototype.getAccounts=function(){
return this._accounts
};
ZmAccountList.prototype.getAccount=function(e){
return e?this._accounts[e]:this.mainAccount
};
ZmAccountList.prototype.getAccountByName=function(e){
for(var t in this._accounts){
if(this._accounts[t].name==e){
return this._accounts[t]
}}
return null
};
ZmAccountList.prototype.getAccountByEmail=function(e){
for(var t in this._accounts){
if(this._accounts[t].getEmail()==e){
return this._accounts[t]
}}
return null
};
ZmAccountList.prototype.getItemCount=function(e,n){
var o=0;
for(var t=0;
t<this.visibleAccounts.length;
t++){
var r=this.visibleAccounts[t];
if(r.isMain){
continue
}
var s=ZmOrganizer.getSystemId(e,r);
var a=appCtxt.getById(s);
if(a){
o+=(n?a.numUnread:a.numTotal)
}}
return o
};
ZmAccountList.prototype.generateQuery=function(e,s){
var l=s&&s.get(0);
var h=[];
var r=this.visibleAccounts;
var a=e||ZmOrganizer.ID_ROOT;
var o=e?"inid":"underid";
for(var n=0;
n<r.length;
n++){
var c=r[n];
if((l&&!c.isAppEnabled(ZmItem.APP[l]))||c.isMain){
continue
}
var t=[o,':"',ZmOrganizer.getSystemId(a,c,true),'"'];
h.push(t.join(""))
}
if(a==ZmOrganizer.ID_ROOT){
h.push([o,':"',appCtxt.accountList.mainAccount.id,":",a,'"'].join(""))
}
return(h.join(" OR "))
};
ZmAccountList.prototype.loadAccounts=function(t){
var e=(new Array()).concat(this.visibleAccounts);
this._loadAccount(e,t)
};
ZmAccountList.prototype._loadAccount=function(t,n){
var o=t.shift();
if(o){
var a=new AjxCallback(this,this._loadAccount,[t,n]);
o.load(a)
}else{
ZmOrganizer.HIDE_EMPTY[ZmOrganizer.TAG]=true;
ZmOrganizer.HIDE_EMPTY[ZmOrganizer.SEARCH]=true;
for(var e=0;
e<this.visibleAccounts.length;
e++){
if(appCtxt.get(ZmSetting.OFFLINE_SMTP_ENABLED,null,this.visibleAccounts[e])){
appCtxt.set(ZmSetting.OFFLINE_COMPOSE_ENABLED,true,null,null,true);
break
}}
if(n){
n.run()
}}};
ZmAccountList.prototype.setActiveAccount=function(t,e){
this.activeAccount=t;
this._evt=this._evt||new ZmEvent();
this._evt.account=t;
if(!e){
this._evtMgr.notifyListeners("ACCOUNT",this._evt)
}};
ZmAccountList.prototype.addActiveAcountListener=function(t,e){
return this._evtMgr.addListener("ACCOUNT",t,e)
};
ZmAccountList.prototype.isInitialSyncing=function(){
for(var e=0;
e<this.visibleAccounts.length;
e++){
var t=this.visibleAccounts[e];
if(t.isMain){
continue
}
if(t.isOfflineInitialSync()){
return true
}}
return false
};
ZmAccountList.prototype.isSyncStatus=function(e){
for(var t=0;
t<this.visibleAccounts.length;
t++){
var a=this.visibleAccounts[t];
if(a.isMain){
continue
}
if(a.status==e){
return true
}}
return false
};
ZmAccountList.prototype.accountTypeExists=function(t){
for(var e=0;
e<this.visibleAccounts.length;
e++){
var a=this.visibleAccounts[e];
if(t==ZmAccount.TYPE_ZIMBRA&&a.isMain){
continue
}
if(a.type==t){
return true
}}
return false
};
ZmAccountList.prototype.syncAll=function(t){
var e=(new Array()).concat(this.visibleAccounts);
this._sendSync(e,t)
};
ZmAccountList.prototype._sendSync=function(e,a){
var t=e.shift();
if(t){
if(!t.isMain){
t.sync()
}
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._sendSync,[e,a]),500)
}else{
if(a){
a.run()
}}};
ZmAccountList.prototype.createAccounts=function(t,n){
var o=appCtxt.accountList.mainAccount;
o.id=n.id;
o.name=n.name;
o.isMain=true;
o.isZimbraAccount=true;
o.loaded=true;
o.visible=true;
o.settings=t;
o.type=ZmAccount.TYPE_ZIMBRA;
o.icon="AccountZimbra";
o.active=true;
this._accounts[o.id]=o;
delete this._accounts[ZmAccountList.DEFAULT_ID];
this.setActiveAccount(o);
if(appCtxt.isOffline){
o.displayName=ZmMsg.localFolders;
if(appCtxt.get(ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED)){
appCtxt.set(ZmSetting.NOTEBOOK_ENABLED,true,null,null,true)
}}
var a=n.childAccounts&&n.childAccounts.childAccount;
if(a){
for(var e=0;
e<a.length;
e++){
this.add(ZmZimbraAccount.createFromDom(a[e]))
}
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 t=0;
t<this.visibleAccounts.length;
t++){
for(var a in trees){
var e=trees[a];
if(e&&e.reset){
e.reset()
}}}};
ZmAccountList.prototype.saveImplicitPrefs=function(){
for(var e=0;
e<this.visibleAccounts.length;
e++){
this.visibleAccounts[e].saveImplicitPrefs()
}};
ZmAccountList.prototype.getTooltipForVirtualFolder=function(e){
var s=0;
var n=0;
for(var a=0;
a<this.visibleAccounts.length;
a++){
var h=this.visibleAccounts[a];
var r=ZmOrganizer.getSystemId(e,h);
var o=appCtxt.getById(r);
if(o){
s+=o.numTotal;
n+=o.sizeTotal
}}
var t={
itemText:ZmMsg.messages,numTotal:s,sizeTotal:n};
return AjxTemplate.expand("share.App#FolderTooltip",t)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmAccount")){
ZmAccount=function(t,a,e){
if(arguments.length==0){
return
}
this.id=a;
this.name=e;
this.type=t||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.LOCAL_ACCOUNT_ID="ffffffff-ffff-ffff-ffff-ffffffffffff";
ZmAccount.getTypeName=function(e){
switch(e){
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(e){
this.name=e
};
ZmAccount.prototype.getName=function(){
return this.name
};
ZmAccount.prototype.setEmail=function(e){
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(a,e,t){
ZmAccount.call(this,null,a,e);
this.visible=(t!==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.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(t){
var e=this.getIdentity();
if(!e){
return
}
e.name=t
};
ZmZimbraAccount.prototype.getName=function(){
var e=this.getIdentity();
var t=(!e)?this.settings.get(ZmSetting.DISPLAY_NAME):e.name;
if(!t){
t=this.getDisplayName()
}
return e.isDefault&&t==ZmIdentity.DEFAULT_NAME?ZmMsg.accountDefault:t
};
ZmZimbraAccount.prototype.setEmail=function(e){};
ZmZimbraAccount.prototype.getEmail=function(){
return this.name
};
ZmZimbraAccount.prototype.getDisplayName=function(){
if(!this.displayName){
var e=this.isMain?this.settings.get(ZmSetting.DISPLAY_NAME):this._displayName;
this.displayName=(this._accountName||e||this.name)
}
return this.displayName
};
ZmZimbraAccount.prototype.getIdentity=function(){
var e=appCtxt.getIdentityCollection(this).defaultIdentity;
if(!appCtxt.isFamilyMbox||this.isMain){
return e
}
if(!this.dummyIdentity){
this.dummyIdentity=new ZmIdentity(this.name);
AjxUtil.hashUpdate(this.dummyIdentity,e,true,["name","isDefault"])
}
return this.dummyIdentity
};
ZmZimbraAccount.prototype.getToolTip=function(){
if(this.status||this.lastSync||this.isMain){
var a=(this.lastSync&&this.lastSync!=0)?(new Date(parseInt(this.lastSync))):null;
var t=appCtxt.get(ZmSetting.QUOTA_USED,null,this);
var e;
if(!a){
if(t>0&&!this.isMain){
e=ZmMsg.unknown
}}else{
e=AjxDateUtil.computeWordyDateStr(new Date(),a)
}
var o={
lastSync:e,hasNotSynced:this.hasNotSynced(),status:this.getStatusMessage(),quota:AjxUtil.formatSize(t,false,1)};
return AjxTemplate.expand("share.App#ZimbraAccountTooltip",o)
}
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 e=appCtxt.getFolderTree(this);
if(this.isCalDavBased()){
var a=e.getByType(ZmOrganizer.CALENDAR);
for(var t=0;
t<a.length;
t++){
if(a[t].nId==ZmOrganizer.ID_CALENDAR){
continue
}
return a[t]
}}
return e.getById(ZmOrganizer.ID_CALENDAR)
};
ZmZimbraAccount.prototype.updateState=function(a){
if(this.isMain){
return
}
var s=false;
if(this.lastSync!=a.lastsync){
this.lastSync=a.lastsync;
if(this.visible){
s=true
}}
var e=false;
if(this.status!=a.status){
this.status=a.status;
if(this.visible){
e=true
}}
var t=appCtxt.getOverviewController()._overviewContainer;
for(var n in t){
var r=t[n];
if(e||s){
r.updateAccountInfo(this,e,s)
}}
if(this.visible&&a.unread!=this.unread){
this.unread=a.unread
}
this.code=a.code;
if(a.error){
var o=a.error[0];
this.errorDetail=o.exception[0]._content;
this.errorMessage=o.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(e){
var t=((ZdMsg["client."+e])||(ZdMsg["exception."+e]));
if(!t&&e){
t=ZdMsg["exception.offline.UNEXPECTED"]
}
return t
};
ZmZimbraAccount.prototype.getStatusMessage=function(){
if(this.inNewMailMode){
return AjxMessageFormat.format(ZmMsg.unreadCount,this.unread)
}
switch(this.status){
case ZmZimbraAccount.STATUS_OFFLINE:return ZmMsg.imStatusOffline;
case ZmZimbraAccount.STATUS_ONLINE:return ZmMsg.imStatusOnline;
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 a=(this.status==ZmZimbraAccount.STATUS_ERROR)?appCtxt.getErrorDialog():appCtxt.getMsgDialog();
var o=this.getZdMsg(this.code);
if(o==""){
o=this.getStatusMessage()
}
a.setMessage(o);
if(this.status==ZmZimbraAccount.STATUS_ERROR){
var t=[];
var e=0;
if(this.errorMessage){
t[e++]="<p><b>";
t[e++]=ZdMsg.DebugMsg;
t[e++]="</b>: ";
t[e++]=this.errorMessage;
t[e++]="</p>"
}
if(this.errorDetail){
t[e++]="<p><b>";
t[e++]=ZdMsg.DebugStack;
t[e++]="</b>:</p><p><pre>";
t[e++]=this.errorDetail;
t[e++]="</pre></p>"
}
t[e++]="<p><b>";
t[e++]=ZdMsg.DebugActionNote;
t[e++]="</b></p>";
a.setDetailString(t.join(""))
}
a.popup(null,true)
};
ZmZimbraAccount.createFromDom=function(e){
var t=new ZmZimbraAccount();
t._loadFromDom(e);
return t
};
ZmZimbraAccount.prototype.load=function(u){
if(!this.loaded){
this.settings=new ZmSettings();
var r=appCtxt.accountList.mainAccount;
for(var o=0;
o<ZmApp.APPS.length;
o++){
var h=ZmApp.APPS[o];
var f=ZmApp.SETTING[h];
if(f&&appCtxt.get(f,null,r)){
var t=appCtxt.getApp(h);
if(t){
t._registerSettings(this.settings)
}}}
var a=new ZmBatchCommand(null,this.name);
var n=new AjxCallback(this,this._handleLoadSettings);
this.settings.loadUserSettings(n,null,this.name,null,a);
var e=AjxSoapDoc.create("GetTagRequest","urn:zimbraMail");
var d=new AjxCallback(this,this._handleLoadTags);
a.addNewRequestParams(e,d);
this.loadMetaData(null,a);
var c=AjxSoapDoc.create("GetFolderRequest","urn:zimbraMail");
c.getMethod().setAttribute("visible","1");
var l=new AjxCallback(this,this._handleLoadFolders);
a.addNewRequestParams(c,l);
var m=new AjxCallback(this,this._handleLoadUserInfo,u);
var s=new AjxCallback(this,this._handleErrorLoad,u);
a.run(m,s)
}else{
if(u){
u.run()
}}};
ZmZimbraAccount.prototype.loadMetaData=function(o,t){
var e=new AjxCallback(this,this._handleLoadMetaData,[o]);
var a=[ZmSetting.M_IMPLICIT,ZmSetting.M_OFFLINE];
this.metaData.load(a,e,t)
};
ZmZimbraAccount.prototype.unload=function(){
if(!appCtxt.inStartup){
this.settings.loadShortcuts(true)
}};
ZmZimbraAccount.prototype.sync=function(a){
var e=AjxSoapDoc.create("SyncRequest","urn:zimbraOffline");
if(appCtxt.get(ZmSetting.OFFLINE_DEBUG_TRACE)){
var t=e.getMethod();
t.setAttribute("debug",1)
}
appCtxt.getAppController().sendRequest({
soapDoc:e,asyncMode:true,noBusyOverlay:true,callback:a,accountName:this.name}
)
};
ZmZimbraAccount.prototype.save=function(a,t,e){
return(this.getIdentity().save(a,t,e))
};
ZmZimbraAccount.prototype.saveImplicitPrefs=function(){
var t=[];
for(var a in ZmSetting.CHANGED_IMPLICIT){
var e=this.settings?this.settings.getSetting(a):null;
if(ZmSetting.IS_GLOBAL[e.id]&&!this.isMain){
continue
}
if(e&&(e.getValue(null,true)!=e.getOrigValue(null,true))){
t.push(e)
}}
if(t.length>0){
this.settings.save(t,null,null,this)
}};
ZmZimbraAccount.prototype.isAppEnabled=function(e){
switch(e){
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.IM:return appCtxt.get(ZmSetting.IM_ENABLED,null,this);
case ZmApp.MAIL:return appCtxt.get(ZmSetting.MAIL_ENABLED,null,this);
case ZmApp.NOTEBOOK:return appCtxt.get(ZmSetting.NOTEBOOK_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(e){
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 t=e.getResponse().GetInfoResponse;
appCtxt.getIdentityCollection(this).initialize(t.identities);
appCtxt.getDataSourceCollection(this).initialize(t.dataSources);
appCtxt.getSignatureCollection(this).initialize(t.signatures)
};
ZmZimbraAccount.prototype._handleLoadFolders=function(e){
var a=e.getResponse().GetFolderResponse;
var t=a?a.folder[0]:null;
if(t){
appCtxt.getRequestMgr()._loadTree(ZmOrganizer.FOLDER,null,a.folder[0],"folder",this)
}};
ZmZimbraAccount.prototype._handleLoadTags=function(e){
var t=e.getResponse().GetTagResponse;
appCtxt.getRequestMgr()._loadTree(ZmOrganizer.TAG,null,t,null,this)
};
ZmZimbraAccount.prototype._handleLoadUserInfo=function(t){
this.loaded=true;
var e=appCtxt.getFolderTree(this);
if(e){
e.getPermissions({
noBusyOverlay:true,accountName:this.name}
)
}
if(t){
t.run()
}};
ZmZimbraAccount.prototype._handleLoadMetaData=function(a,t){
for(var e in t){
this.settings.createFromJs(t[e])
}
if(a){
a.run()
}};
ZmZimbraAccount.prototype._handleErrorLoad=function(t,e){
if(t){
t.run()
}};
ZmZimbraAccount.prototype._loadFromDom=function(e){
this.id=e.id;
this.name=e.name;
this.visible=e.visible;
this.active=e.active;
var t=e.attrs&&e.attrs._attrs;
this._displayName=t?t.displayName:this.email;
this._accountName=t&&t.zimbraPrefLabel
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmInvite")){
ZmInvite=function(){
ZmModel.call(this)
};
ZmInvite.prototype=new ZmModel;
ZmInvite.prototype.constructor=ZmInvite;
ZmInvite.CHANGES_LOCATION="location";
ZmInvite.CHANGES_SUBJECT="subject";
ZmInvite.CHANGES_RECURRENCE="recurrence";
ZmInvite.CHANGES_TIME="time";
ZmInvite.prototype.toString=function(){
return"ZmInvite: name="+this.name+" id="+this.id
};
ZmInvite._sendFun=null;
ZmInvite.createFromDom=function(n){
var t=new ZmInvite();
t.components=n[0].comp;
t.replies=n[0].replies;
t.id=n[0].id;
if(t.components==null){
t.components=[{}
];
t.components.empty=true
}
var e=n[0];
if(e.tz){
for(var o=0;
o<e.tz.length;
o++){
var h=e.tz[o];
var s=AjxTimezone.getRule(h.id);
if(!s){
var r={
standard:h.standard?AjxUtil.createProxy(h.standard[0]):{}
,daylight:h.daylight?AjxUtil.createProxy(h.daylight[0]):null};
r.standard.offset=h.stdoff;
delete r.standard._object_;
if(h.daylight){
r.daylight.offset=h.dayoff;
delete r.daylight._object_
}
s=AjxTimezone.getRule(h.id,r);
if(s){
var a=AjxUtil.createProxy(s);
a.aliasId=s.clientId;
a.clientId=h.id;
a.serverId=h.id;
AjxTimezone.addRule(a)
}}
if(!s){
s={
clientId:h.id,serverId:h.id,autoDetected:true};
if(h.daylight){
s.standard=AjxUtil.createProxy(h.standard[0]);
s.standard.offset=h.stdoff;
s.standard.trans=AjxTimezone.createTransitionDate(s.standard);
s.daylight=AjxUtil.createProxy(h.daylight[0]);
s.daylight.offset=h.dayoff;
s.daylight.trans=AjxTimezone.createTransitionDate(s.daylight)
}else{
s.standard={
offset:h.stdoff}
}
AjxTimezone.addRule(s)
}}}
t.type=e&&e.type?e.type:"appt";
return t
};
ZmInvite.prototype.setMessageId=function(e){
this.msgId=e
};
ZmInvite.prototype.getMessageId=function(){
return this.msgId
};
ZmInvite.prototype.getComponent=function(e){
return this.components[e]
};
ZmInvite.prototype.getComponents=function(){
return this.components
};
ZmInvite.prototype.hasMultipleComponents=function(){
return(this.components.length>1)
};
ZmInvite.prototype.hasOtherAttendees=function(e){
var t=e||0;
return this.components[t].at&&this.components[t].at.length>0
};
ZmInvite.prototype.getEventName=function(e){
var t=e||0;
return this.components[t]?this.components[t].name:null
};
ZmInvite.prototype.getAlarm=function(e){
var t=e||0;
return this.components[t]?this.components[t].alarm:null
};
ZmInvite.prototype.getInviteMethod=function(e){
var t=e||0;
return this.components[t]?this.components[t].method:null
};
ZmInvite.prototype.getSequenceNo=function(e){
var t=e||0;
return this.components[t]?this.components[t].seq:null
};
ZmInvite.prototype.getOrganizerEmail=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].or&&this.components[t].or.url)?(this.components[t].or.url.replace("MAILTO:","")):null
};
ZmInvite.prototype.getOrganizerName=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].or)?(this.components[t].or.d||this.components[t].or.url):null
};
ZmInvite.prototype.getSentBy=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].or)?this.components[t].or.sentBy:null
};
ZmInvite.prototype.isOrganizer=function(e){
var t=e||0;
return this.components[t]?(!!this.components[t].isOrg):false
};
ZmInvite.prototype.shouldRsvp=function(e){
var t=e||0;
return this.components[t]?this.components[t].rsvp:null
};
ZmInvite.prototype.getRecurrenceRules=function(e){
var t=e||0;
return this.components[t].recur
};
ZmInvite.prototype.getAttendees=function(a){
var n=a||0;
var e=this.components[n].at;
var o=[];
if(!(e&&e.length)){
return o
}
for(var t=0;
t<e.length;
t++){
if(!e[t].cutype||(e[t].cutype==ZmCalendarApp.CUTYPE_INDIVIDUAL)){
o.push(e[t])
}}
return o
};
ZmInvite.prototype.getReplies=function(e){
var t=e||0;
return(this.replies&&this.replies[t])?this.replies[t].reply:null
};
ZmInvite.prototype.getResources=function(a){
var n=a||0;
var e=this.components[n].at;
var o=[];
if(!(e&&e.length)){
return o
}
for(var t=0;
t<e.length;
t++){
if(e[t].cutype==ZmCalendarApp.CUTYPE_RESOURCE||e[t].cutype==ZmCalendarApp.CUTYPE_ROOM){
o.push(e[t])
}}
return o
};
ZmInvite.prototype.getExceptId=function(e){
var t=e||0;
return(this.components[t]&&this.components[t].exceptId)?this.components[t].exceptId[0]:null
};
ZmInvite.prototype.getAppointmentId=function(e){
var t=e||0;
return this.components[t].apptId
};
ZmInvite.prototype.getStatus=function(e){
var t=e||0;
return this.components[t].status
};
ZmInvite.prototype.isEmpty=function(){
return Boolean(this.components.empty)
};
ZmInvite.prototype.isException=function(e){
var t=e||0;
return this.components[t]?this.components[t].ex:false
};
ZmInvite.prototype.isRecurring=function(e){
var t=e||0;
return this.components[t]?this.components[t].recur:false
};
ZmInvite.prototype.isAllDayEvent=function(e){
var t=e||0;
return this.components[t]?this.components[t].allDay=="1":false
};
ZmInvite.prototype.isMultiDay=function(t){
var o=t||0;
var a=this.getServerStartDate(o);
var e=this.getServerEndDate(o);
if(!a){
return false
}
return(a.getDate()!=e.getDate())||(a.getMonth()!=e.getMonth())||(a.getFullYear()!=e.getFullYear())
};
ZmInvite.prototype.getComponentDescriptionHtml=function(t){
var s=t||0;
var e=this.components[s];
if(e==null){
return
}
var n=e.descHtml;
var o=n&&n[0]._content||null;
if(!o){
var a=e.desc;
a=(a&&a[0]._content)||null;
if(!a){
o=this.getApptSummary(true)
}}
return o
};
ZmInvite.prototype.getComponentDescription=function(t){
var s=t||0;
var e=this.components[s];
if(e==null){
return
}
var o=e.desc;
var a=o&&o[0]._content||null;
if(!a){
var n=e.descHtml;
n=(n&&n[0]._content)||null;
if(!n){
a=this.getApptSummary()
}}
return a
};
ZmInvite.prototype.getServerEndTime=function(l){
var u=l||0;
if(this.components==null){
return
}
if(this._serverEndTime==null){
if(this.components.e!=null){
this._serverEndTime=this.components.e[0].d
}else{
if(this.components.s){
var a=this.components.dur;
var f=a&&a[0].d||0;
var e=a&&a[0].w||0;
var n=a&&a[0].h||0;
var s=a&&a[0].m||0;
var g=a&&a[0].s||0;
var p=parseInt(g)+(parseInt(s)*60)+(parseInt(n)*3600)+(parseInt(f)*24*3600)+(parseInt(e)*7*24*3600);
var o=this.components.s[0].d;
var r=parseInt(o.substr(0,4),10);
var m=parseInt(o.substr(4,2),10);
var f=parseInt(o.substr(6,2),10);
var c=new Date(r,m-1,f);
if(o.charAt(8)=="T"){
n=parseInt(o.substr(9,2),10);
s=parseInt(o.substr(11,2),10);
g=parseInt(o.substr(13,2),10);
c.setHours(n,s,g,0)
}
var h=new Date(c.getTime()+(p*1000));
m=AjxDateUtil._pad(c.getMonth()+1);
f=AjxDateUtil._pad(c.getDate());
n=AjxDateUtil._pad(c.getHours());
s=AjxDateUtil._pad(c.getMinutes());
g=AjxDateUtil._pad(c.getSeconds());
r=c.getFullYear();
this._serverEndTime=[r,m,f,"T",n,s,g].join("")
}}}
return this._serverEndTime
};
ZmInvite.prototype.getServerEndDate=function(t,e){
var a=t||0;
return AjxDateUtil.parseServerDateTime(this.getServerEndTime(a),e)
};
ZmInvite.prototype.getServerStartTime=function(e){
var t=e||0;
return this.components[t]&&this.components[t].s?this.components[t].s[0].d:null
};
ZmInvite.prototype.getServerStartDate=function(t,e){
var a=t||0;
return AjxDateUtil.parseServerDateTime(this.getServerStartTime(a),e)
};
ZmInvite.prototype.getStartDateFromExceptId=function(e){
var t=e||0;
return AjxDateUtil.parseServerDateTime(this.components[t]&&this.components[t].exceptId?this.components[t].exceptId[0].d:null)
};
ZmInvite.prototype.getServerStartTimeTz=function(e){
var a=e||0;
if(this.components[a]==null){
return
}
if(this._serverStartTimeZone==null){
var t=this.getServerStartTime();
this._serverStartTimeZone=t&&t.charAt(t.length-1)=="Z"?AjxTimezone.GMT_NO_DST:(this.components[a].s?this.components[a].s[0].tz:null)
}
return this._serverStartTimeZone
};
ZmInvite.prototype.getServerEndTimeTz=function(t){
var o=t||0;
var a=this.components[o]&&this.components[o].e;
if(!a){
return null
}
if(!this._serverEndTimeZone){
var e=this.getServerEndTime();
this._serverEndTimeZone=(e&&e.charAt(e.length-1)=="Z")?AjxTimezone.GMT_NO_DST:a[0].tz
}
return this._serverEndTimeZone
};
ZmInvite.prototype.getDurationText=function(m,y,e,h,o,c){
var p=this.components[m];
var f=o||this.getServerStartDate(m);
var l=c||this.getServerEndDate(m);
if(!f&&!l){
return""
}
if(this.isAllDayEvent(m)){
if(y){
return""
}
if(this.isMultiDay(m)){
var r=AjxDateFormat.getDateInstance();
var u=r.format(f);
var t=r.format(l);
if(!ZmInvite._daysFormatter){
ZmInvite._daysFormatter=new AjxMessageFormat(ZmMsg.durationDays)
}
return ZmInvite._daysFormatter.format([u,t])
}
return f?AjxDateFormat.getDateInstance(AjxDateFormat.FULL).format(f):""
}
var r=AjxDateFormat.getDateInstance(AjxDateFormat.FULL);
var s=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
var g=f?[r.format(f),h?" ":"<br>"]:[];
if(e){
g.push(f?s.format(f):"")
}else{
var n=f?s.format(f):"";
var d=s.format(l);
if(!ZmInvite._hoursFormatter){
ZmInvite._hoursFormatter=new AjxMessageFormat(ZmMsg.durationHours)
}
g.push(ZmInvite._hoursFormatter.format([n,d]))
}
return g.join("")
};
ZmInvite.prototype.getName=function(e){
var t=e||0;
return this.components[t]?this.components[t].name:null
};
ZmInvite.prototype.getFreeBusy=function(e){
var t=e||0;
return this.components[t]?this.components[t].fb:null
};
ZmInvite.prototype.getPrivacy=function(e){
var t=e||0;
return this.components[t]?this.components[t]["class"]:null
};
ZmInvite.prototype.getXProp=function(e){
var t=e||0;
return this.components[t]?this.components[t]["xprop"]:null
};
ZmInvite.prototype.getLocation=function(e){
var t=e||0;
return this.components[t]?this.components[t].loc:null
};
ZmInvite.prototype.getRecurrenceId=function(e){
var t=e||0;
return this.components[t]?this.components[t].ridZ:null
};
ZmInvite.prototype.getToolTip=function(){
if(this._toolTip){
return this._toolTip
}
var o=0;
var a=[];
var t=0;
a[t++]="<table cellpadding=0 cellspacing=0 border=0 >";
a[t++]="<tr valign='center'><td colspan=2 align='left'>";
a[t++]="<div style='border-bottom: 1px solid black;'>";
a[t++]="<table cellpadding=0 cellspacing=0 border=0 width=100%>";
a[t++]="<tr valign='center'><td><b>";
a[t++]="<div style='white-space:nowrap'><table border=0 cellpadding=0 cellspacing=0 style='display:inline'><tr>";
if(this.hasOtherAttendees(o)){
a[t++]="<td>";
a[t++]=AjxImg.getImageHtml("ApptMeeting");
a[t++]="</td>"
}
if(this.isException(o)){
a[t++]="<td>";
a[t++]=AjxImg.getImageHtml("ApptException");
a[t++]="</td>"
}else{
if(this.isRecurring(o)){
a[t++]="<td>";
a[t++]=AjxImg.getImageHtml("ApptRecur");
a[t++]="</td>"
}}
a[t++]="</tr></table> ";
a[t++]=AjxStringUtil.htmlEncode(this.getName(o));
a[t++]=" </div></b></td><td align='right'>";
a[t++]=AjxImg.getImageHtml("Appointment");
a[t++]="</td></table></div></td></tr>";
var e=this.getDurationText(o,false,false);
t=this._addEntryRow(ZmMsg.when,e,a,t,false,null,true);
if(this.isRecurring(o)){
if(!this._recurBlurb){
AjxDispatcher.require("CalendarCore");
var n=new ZmRecurrence();
n.parse(this.getRecurrenceRules(o));
this._recurBlurb=n.getBlurb()
}
t=this._addEntryRow(ZmMsg.repeats,this._recurBlurb,a,t,true,null,true)
}
t=this._addEntryRow(ZmMsg.location,this.getLocation(o),a,t,false);
a[t++]="</table>";
this._toolTip=a.join("");
return this._toolTip
};
ZmInvite.prototype.getApptSummary=function(e){
var a=appCtxt.getById(this.getMessageId());
var t;
if(a){
AjxDispatcher.require("CalendarCore");
t=new ZmAppt();
t.setFromMessage(a)
}
return t?t.getSummary(e):this.getSummary(e)
};
ZmInvite.prototype.getSummary=function(e){
if(this.isRecurring()){
if(!this._recurBlurb){
AjxDispatcher.require("CalendarCore");
var n=new ZmRecurrence();
n.setRecurrenceRules(this.getRecurrenceRules(),this.getServerStartDate());
this._recurBlurb=n.getBlurb()
}}
var t=[];
var o=0;
if(!this._summaryHtmlLineFormatter){
this._summaryHtmlLineFormatter=new AjxMessageFormat("<tr><th align='left'>{0}</th><td>{1} {2}</td></tr>");
this._summaryTextLineFormatter=new AjxMessageFormat("{0} {1} {2}")
}
var l=e?this._summaryHtmlLineFormatter:this._summaryTextLineFormatter;
var a=[];
if(e){
t[o++]="<p>
<table border='0'>
"
}
var r=this.getOrganizerName();
if(r){
a=[ZmMsg.organizerLabel,r,""];
t[o++]=l.format(a);
t[o++]="
"
}
var h=this.getDurationText(0,false,false,true);
if(h){
a=[ZmMsg.whenLabel,h,""];
t[o++]=l.format(a);
t[o++]="
"
}
var s=this.getLocation();
if(s){
a=[ZmMsg.locationLabel,s,""];
t[o++]=l.format(a);
t[o++]="
"
}
if(this._recurBlurb){
a=[ZmMsg.repeatLabel,this._recurBlurb,""];
t[o++]=l.format(a);
t[o++]="
"
}
if(e){
t[o++]="</table>
"
}
t[o++]=e?"<div>":"
";
t[o++]=ZmItem.NOTES_SEPARATOR;
t[o++]=e?"</div><br>":"
";
return t.join("")
};
ZmInvite.prototype._addEntryRow=function(r,s,t,e,n,o,a){
if(s!=null&&s!=""){
t[e++]="<tr valign='top'><td align='right' style='padding-right: 5px;'><b><div style='white-space:nowrap'>";
t[e++]=AjxMessageFormat.format(ZmMsg.makeLabel,AjxStringUtil.htmlEncode(r));
t[e++]="</div></b></td><td align='left'><div style='white-space:";
t[e++]=n?"wrap;":"nowrap;";
if(o){
t[e++]="width:";
t[e++]=o;
t[e++]="px;"
}
t[e++]="'>";
t[e++]=a?s:AjxStringUtil.htmlEncode(s);
t[e++]="</div></td></tr>"
}
return e
};
ZmInvite.prototype.hasAcceptableComponents=function(){
for(var e in this.components){
if(this.getStatus(e)!=ZmCalendarApp.STATUS_CANC){
return true
}}
return false
};
ZmInvite.prototype.hasInviteReplyMethod=function(t){
var e=this.getInviteMethod(t);
var a=(e==ZmCalendarApp.METHOD_REQUEST||e==ZmCalendarApp.METHOD_PUBLISH);
return((e==null)||a)
};
ZmInvite.prototype.hasCounterMethod=function(e){
return(this.getInviteMethod(e)==ZmCalendarApp.METHOD_COUNTER)
};
ZmInvite.prototype.getProposedTimeStr=function(t){
var e=this.getInviteMethod(t);
if(e==ZmCalendarApp.METHOD_COUNTER){
return this.getDurationText(t,false,false,true)
}
return""
};
ZmInvite.prototype.getChanges=function(a){
var s=a||0;
var n=this.components[s]&&this.components[s].changes;
var e=n&&n.split(",");
if(e&&e.length>0){
var o={};
for(var t=0;
t<e.length;
t++){
o[e[t]]=true
}
return o
}
return null
};
ZmInvite.prototype.hasAttendeeResponse=function(){
var e=this.getAttendees();
return(e.length>0&&e[0].ptst!=ZmCalBaseItem.PSTATUS_NEEDS_ACTION)
}
}
if(AjxPackage.define("zimbraMail.share.model.ZmImAddress")){
ZmImAddress={
IM_SERVICES:[{
label:ZmMsg.zimbraTitle,value:"local"}
,{
label:ZmMsg.yahoo,value:"yahoo"}
,{
label:ZmMsg.msn,value:"msn"}
,{
label:ZmMsg.aol,value:"aol"}
,{
label:ZmMsg.other,value:"other"}
],REGEXP:[],parse:function(t){
var e=ZmImAddress.REGEXP.exec(t);
if(e){
return{
service:e[1],screenName:e[2]}
}}
,make:function(e,t){
var a=e+"://"+t;
if(ZmImAddress.parse(a)){
return a
}
return""
}
,display:function(r){
var n=ZmImAddress.parse(r);
if(n){
var e=ZmImAddress.IM_SERVICES,t=0,o;
while(o=e[t++]){
if(o.value==n.service){
break
}}
if(o){
return n.screenName+" ("+o.label+")"
}}
return r
}};
if(/^SmartZone/.test(ZmMsg.zimbraTitle)){
ZmImAddress.IM_SERVICES.splice(0,1)
}
for(var i=0;
i<ZmImAddress.IM_SERVICES.length;
++i){
ZmImAddress.REGEXP.push(ZmImAddress.IM_SERVICES.value)
}
ZmImAddress.REGEXP=new RegExp("^("+ZmImAddress.REGEXP.join("|")+")://([^\s]+)$","i")
}
if(AjxPackage.define("zimbraMail.share.model.ZmAccessControlList")){
ZmAccessControlList=function(e){
this._aces={}
};
ZmAccessControlList.prototype.toString=function(){
return"ZmAccessControlList"
};
ZmAccessControlList.prototype.load=function(a){
var t={
GetPermissionRequest:{
_jsns:"urn:zimbraMail"}};
var e=new AjxCallback(this,this._handleResponseLoad,[a]);
appCtxt.getAppController().sendRequest({
jsonObj:t,asyncMode:true,callback:e}
)
};
ZmAccessControlList.prototype._handleResponseLoad=function(n,e){
var t=e.getResponse();
var o=t.GetPermissionResponse.ace;
if(o&&o.length){
for(var a=0;
a<o.length;
a++){
this.add(ZmAccessControlEntry.createFromDom(o[a]))
}}
if(n){
n.run()
}};
ZmAccessControlList.prototype.getACLByRight=function(e){
return this._aces[e]
};
ZmAccessControlList.prototype.getGranteeType=function(m){
var t=this._aces[m];
var a=ZmSetting.ACL_PUBLIC;
var f={};
if(t&&t.length){
for(var r=0;
r<t.length;
r++){
var n=t[r];
var d=(n.granteeType==ZmSetting.ACL_USER||n.granteeType==ZmSetting.ACL_GROUP)?ZmSetting.ACL_USER:n.granteeType;
f[d]=n.negative?-1:1
}}
var u=(f[ZmSetting.ACL_PUBLIC]==1);
var o=(f[ZmSetting.ACL_PUBLIC]==-1);
var h=(f[ZmSetting.ACL_AUTH]==1);
var s=(f[ZmSetting.ACL_AUTH]==-1);
var l=(f[ZmSetting.ACL_DOMAIN]==1);
var c=(f[ZmSetting.ACL_USER]==1);
var e=(o||s)&&(f[ZmSetting.ACL_USER]==null);
if(u){
return ZmSetting.ACL_PUBLIC
}
if(h){
return ZmSetting.ACL_AUTH
}
if(o){
if(h){
return ZmSetting.ACL_AUTH
}}
if(c){
return ZmSetting.ACL_USER
}
if(l){
return ZmSetting.ACL_DOMAIN
}
if(e){
return ZmSetting.ACL_NONE
}
return a
};
ZmAccessControlList.prototype.getACLByGranteeType=function(o,e){
var a=this._aces[o];
var s=[];
if(a&&a.length){
for(var t=0;
t<a.length;
t++){
var n=a[t];
if(n.granteeType==e){
s.push(n)
}}}
s.sort();
return s
};
ZmAccessControlList.prototype.getGrantees=function(a){
var t=this._aces[a];
var n=[];
if(t&&t.length){
for(var e=0;
e<t.length;
e++){
var o=t[e];
if(o.granteeType==ZmSetting.ACL_USER||o.granteeType==ZmSetting.ACL_GROUP){
n.push(o.grantee)
}}}
n.sort();
return n
};
ZmAccessControlList.prototype.getGranteesInfo=function(a){
var t=this._aces[a];
var n=[];
if(t&&t.length){
for(var e=0;
e<t.length;
e++){
var o=t[e];
if(o.granteeType==ZmSetting.ACL_USER||o.granteeType==ZmSetting.ACL_GROUP){
n.push({
grantee:o.grantee,zid:o.zid}
)
}}}
n.sort(ZmAccessControlList.sortByGrantee);
return n
};
ZmAccessControlList.prototype.grant=function(t,a,e){
this._setPerms(t,false,a,e)
};
ZmAccessControlList.prototype.revoke=function(t,a,e){
this._setPerms(t,true,a,e)
};
ZmAccessControlList.prototype._setPerms=function(e,l,h,a){
var o=l?"RevokePermissionRequest":"GrantPermissionRequest";
var s=AjxSoapDoc.create(o,"urn:zimbraMail");
for(var n=0;
n<e.length;
n++){
var t=e[n];
var r=s.set("ace");
r.setAttribute("right",t.right);
r.setAttribute("gt",t.granteeType);
if(t.grantee){
r.setAttribute("d",t.grantee)
}
if(t.zid){
r.setAttribute("zid",t.zid)
}
if(t.negative){
r.setAttribute("deny",1)
}}
var c=new AjxCallback(this,this._handleResponseSetPerms,[l,h]);
if(a){
a.addNewRequestParams(s,c)
}else{
appCtxt.getAppController().sendRequest({
soapDoc:s,asyncMode:true,callback:c}
)
}};
ZmAccessControlList.prototype._handleResponseSetPerms=function(h,r,l){
var n=l.getResponse();
var o=h?n.RevokePermissionResponse:n.GrantPermissionResponse;
var e=o&&o.ace;
var t=[];
if(e&&e.length){
for(var s=0;
s<e.length;
s++){
var a=ZmAccessControlEntry.createFromDom(e[s]);
t.push(a);
if(h){
this.remove(a)
}else{
this.update(a)
}}}
if(r){
r.run(t)
}};
ZmAccessControlList.prototype.add=function(t){
if(!t){
return
}
var e=t.right;
if(!this._aces[e]){
this._aces[e]=[]
}
this._aces[e].push(t)
};
ZmAccessControlList.prototype.remove=function(a){
if(!a){
return
}
var o=this._aces[a.right];
var t=[];
if(o&&o.length){
for(var e=0;
e<o.length;
e++){
if(o[e].grantee!=a.grantee){
t.push(o[e])
}}}
this._aces[a.right]=t
};
ZmAccessControlList.prototype.update=function(t,n){
if(!t||!t.right){
return
}
var o=false;
if(!this._aces[t.right]){
this._aces[t.right]=[]
}
var a=this._aces[t.right];
if(a.length){
for(var e=0;
e<a.length;
e++){
if((a[e].grantee==t.grantee)&&(a[e].granteeType==t.granteeType)){
this._aces[t.right][e]=t;
o=true
}}}
if(!o){
this._aces[t.right].push(t)
}};
ZmAccessControlList.prototype.cleanup=function(){
this._aces={}
};
ZmAccessControlList.sortByGrantee=function(o,e){
var n=o.grantee||"";
var t=e.grantee||"";
if(n.toLowerCase()>t.toLowerCase()){
return 1
}
if(n.toLowerCase()<t.toLowerCase()){
return -1
}
return 0
};
ZmAccessControlEntry=function(e){
this.grantee=e.grantee;
this.zid=e.zid;
this.granteeType=e.granteeType;
this.right=e.right;
this.negative=e.negative
};
ZmAccessControlEntry.prototype.toString=function(){
return"ZmAccessControlEntry"
};
ZmAccessControlEntry.createFromDom=function(e){
var t={};
t.grantee=e.d;
t.granteeType=e.gt;
t.zid=e.zid;
t.right=e.right;
t.negative=(e.deny=="1");
return new ZmAccessControlEntry(t)
}
}
if(AjxPackage.define("zimbraMail.core.ZmApp")){
ZmApp=function(a,t,e){
if(arguments.length==0){
return
}
this._name=a;
this._container=t;
this._parentController=e;
this._active=false;
this.currentSearch=null;
this._deferredFolders=[];
this._deferredFolderHash={};
this._deferredNotifications=[];
this._sessionController={};
this._sessionId={};
this._curSessionId={};
ZmApp.DROP_TARGETS[a]={};
this._defineAPI();
if(!e){
this._registerSettings()
}
this._registerOperations();
this._registerItems();
this._registerOrganizers();
if(!e){
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.ASSISTANTS={};
ZmApp.CHOOSER_SORT={};
ZmApp.DEFAULT_SORT={};
ZmApp.ENABLED_APPS={};
ZmApp.APPS=[];
ZmApp.DEFAULT_APPS=[];
ZmApp.OVERVIEW_ID="main";
ZmApp.BATCH_NOTIF_LIMIT=25;
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(n,o){
if(o.mainPkg){
ZmApp.MAIN_PKG[n]=o.mainPkg
}
if(o.nameKey){
ZmApp.NAME[n]=o.nameKey
}
if(o.icon){
ZmApp.ICON[n]=o.icon
}
if(o.textPrecedence){
ZmApp.TEXT_PRECEDENCE[n]=o.textPrecedence
}
if(o.imagePrecedence){
ZmApp.IMAGE_PRECEDENCE[n]=o.imagePrecedence
}
if(o.chooserTooltipKey){
ZmApp.CHOOSER_TOOLTIP[n]=o.chooserTooltipKey
}
if(o.viewTooltipKey){
ZmApp.VIEW_TOOLTIP[n]=o.viewTooltipKey
}
if(o.defaultSearch){
ZmApp.DEFAULT_SEARCH[n]=o.defaultSearch
}
if(o.organizer){
ZmApp.ORGANIZER[n]=o.organizer
}
if(o.overviewTrees){
ZmApp.OVERVIEW_TREES[n]=o.overviewTrees
}
if(o.hideZimlets){
ZmApp.HIDE_ZIMLETS[n]=o.hideZimlets
}
if(o.assistants){
ZmApp.ASSISTANTS[n]=o.assistants
}
if(o.searchTypes){
ZmApp.SEARCH_TYPES[n]=o.searchTypes
}
if(o.gotoActionCode){
ZmApp.GOTO_ACTION_CODE[n]=o.gotoActionCode
}
if(o.newActionCode){
ZmApp.NEW_ACTION_CODE[n]=o.newActionCode
}
if(o.qsViews){
ZmApp.QS_VIEWS[n]=o.qsViews
}
if(o.chooserSort){
ZmApp.CHOOSER_SORT[n]=o.chooserSort
}
if(o.defaultSort){
ZmApp.DEFAULT_SORT[n]=o.defaultSort
}
if(o.trashViewOp){
ZmApp.TRASH_VIEW_OP[n]=o.trashViewOp
}
if(o.upsellUrl){
ZmApp.UPSELL_URL[n]=o.upsellUrl
}
if(o.searchTypes){
ZmApp.SEARCH_TYPES_R[n]={};
for(var t=0;
t<o.searchTypes.length;
t++){
ZmApp.SEARCH_TYPES_R[n][o.searchTypes[t]]=true
}}
if(o.gotoActionCode){
ZmApp.GOTO_ACTION_CODE_R[o.gotoActionCode]=n
}
if(o.actionCodes){
for(var a in o.actionCodes){
if(!a){
continue
}
ZmApp.ACTION_CODES_R[a]=n;
ZmApp.ACTION_CODES[a]=o.actionCodes[a]
}}
var e=appCtxt.get(ZmApp.SETTING[n]);
if(o.newItemOps&&e){
for(var s in o.newItemOps){
if(!s){
continue
}
ZmApp.OPS_R[s]=n;
ZmOperation.NEW_ITEM_OPS.push(s);
ZmOperation.NEW_ITEM_KEY[s]=o.newItemOps[s]
}}
if(o.newOrgOps&&e){
for(var s in o.newOrgOps){
if(!s){
continue
}
ZmApp.OPS_R[s]=n;
ZmOperation.NEW_ORG_OPS.push(s);
ZmOperation.NEW_ORG_KEY[s]=o.newOrgOps[s]
}}
if(o.qsViews){
for(var t=0;
t<o.qsViews.length;
t++){
ZmApp.QS_VIEWS[o.qsViews[t]]=n
}}};
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(e){};
ZmApp.prototype.preNotify=function(e){};
ZmApp.prototype.deleteNotify=function(e){};
ZmApp.prototype.createNotify=function(e){};
ZmApp.prototype.modifyNotify=function(e){};
ZmApp.prototype.postNotify=function(e){};
ZmApp.prototype.refresh=function(e){};
ZmApp.prototype.handleOp=function(t,e){};
ZmApp.prototype.getName=function(){
return this._name
};
ZmApp.prototype.getDisplayName=function(){
return ZmMsg[ZmApp.NAME[this._name]]
};
ZmApp.prototype.getInitialSearchType=function(){
return null
};
ZmApp.prototype.getLimit=function(e){
return appCtxt.get(ZmSetting.PAGE_SIZE)
};
ZmApp.prototype.setAppView=function(e){
appCtxt.getAppViewMgr().setAppView(this._name,e)
};
ZmApp.prototype.createView=function(e){
e.appName=this._name;
return appCtxt.getAppViewMgr().createView(e)
};
ZmApp.prototype.pushView=function(e,t){
return appCtxt.getAppViewMgr().pushView(e,t)
};
ZmApp.prototype.popView=function(t,e,a){
return appCtxt.getAppViewMgr().popView(t,e,a)
};
ZmApp.prototype.setView=function(e,t){
return appCtxt.getAppViewMgr().setView(e,t)
};
ZmApp.prototype.stageView=function(e){
return appCtxt.getAppViewMgr().stageView(e)
};
ZmApp.prototype.addDeferredFolder=function(e){
var t=e.obj&&e.obj.id;
if(t&&!this._deferredFolderHash[t]){
this._deferredFolders.push(e);
this._deferredFolderHash[t]=true;
appCtxt.cacheSetDeferred(t,this._name)
}};
ZmApp.prototype.getRemoteFolderIds=function(r){
var s=[];
if(appCtxt.getOverviewController(true)){
var o=ZmApp.ORGANIZER[this.getName()];
if(this._deferredFolders.length){
this._createDeferredFolders(o)
}
var e=appCtxt.getFolderTree(r);
var a=e?e.getByType(o):[];
for(var t=0;
t<a.length;
t++){
var n=a[t];
if(n.isRemote()){
s.push(n.id)
}}}
return s
};
ZmApp.prototype.getOverviewPanelContent=function(){
if(!this._overviewPanelContent){
var t=this._getOverviewParams();
t.overviewId=this.getOverviewId();
var e=this._overviewPanelContent=appCtxt.getOverviewController().createOverview(t);
e.set(this._getOverviewTrees())
}
return this._overviewPanelContent
};
ZmApp.prototype.getOverviewContainer=function(a){
if(!this._overviewContainer&&!a){
var e={
appName:this._name,containerId:([ZmApp.OVERVIEW_ID,this._name].join("_")),posStyle:Dwt.ABSOLUTE_STYLE};
var t=this._getOverviewParams();
t.overviewTrees=this._getOverviewTrees();
this._overviewContainer=appCtxt.getOverviewController().createOverviewContainer(e,t)
}
return this._overviewContainer
};
ZmApp.prototype.setOverviewPanelContent=function(a){
if(a){
this._overviewPanelContent=null;
this._overviewContainer=null
}
var e=appCtxt.getAppViewMgr();
if(!e.isFullScreen()){
var t=((appCtxt.multiAccounts&&appCtxt.accountList.size()>1)||this.getName()==ZmApp.VOICE)?this.getOverviewContainer():this.getOverviewPanelContent();
e.setComponent(ZmAppViewMgr.C_TREE,t)
}};
ZmApp.prototype.getOverview=function(){
var e=appCtxt.getOverviewController();
return e&&e.getOverview(this.getOverviewId())
};
ZmApp.prototype.resetOverview=function(t){
var u=t?appCtxt.getOverviewController().getOverview(t):this.getOverview();
if(u){
var s=[];
var d=u.getTreeViews(),l=d.length;
for(var n=0;
n<l;
n++){
var h=d[n];
var e=u.getTreeView(h);
var c=e.getTreeItemList();
var o=c.length;
for(var a=0;
a<o;
a++){
var r=c[a];
if(r._expanded){
s.push(r._htmlElId)
}}}
u.clear();
u.set(this._getOverviewTrees());
l=s.length;
for(var n=0;
n<l;
n++){
var r=DwtControl.fromElementId(s[n]);
if(r&&!r._expanded){
r.setExpanded(true)
}}}};
ZmApp.prototype.getOverviewId=function(e){
return appCtxt.getOverviewId([ZmApp.OVERVIEW_ID,this._name],e)
};
ZmApp.prototype._getOverviewParams=function(){
var e=[];
for(var a in ZmOverviewController.CONTROLLER){
e.push(a)
}
var t=function(n,o){
return(ZmOrganizer.DISPLAY_ORDER[n]||9999)-(ZmOrganizer.DISPLAY_ORDER[o]||9999)
};
e.sort(t);
return{
posStyle:Dwt.ABSOLUTE_STYLE,selectionSupported:true,actionSupported:true,dndSupported:true,showUnread:true,showNewButtons:true,isAppOverview:true,treeIds:e,appName:this._name,account:appCtxt.getActiveAccount()}
};
ZmApp.prototype._getOverviewTrees=function(){
var o=ZmApp.OVERVIEW_TREES[this._name]||[];
var t=[];
for(var e=0,a=o.length;
e<a;
e++){
if((o[e]==ZmOrganizer.FOLDER&&!appCtxt.get(ZmSetting.MAIL_ENABLED))){
continue
}
t.push(o[e])
}
if(!appCtxt.multiAccounts&&window[ZmOverviewController.CONTROLLER[ZmOrganizer.ZIMLET]]&&!ZmApp.HIDE_ZIMLETS[this._name]){
t.push(ZmOrganizer.ZIMLET)
}
return t
};
ZmApp.prototype.getNumSessionControllers=function(t){
var a=this._sessionController[t]||[];
var e=0;
for(var o in a){
if(!a[o].inactive){
e++
}}
return e
};
ZmApp.prototype.getSessionController=function(type,controllerClass,sessionId){
if(!this._sessionController[type]){
this._sessionController[type]={};
this._sessionId[type]=1
}
if(sessionId&&this._sessionController[type][sessionId]){
return this._sessionController[type][sessionId]
}
var controllers=this._sessionController[type];
var controller;
for(var id in controllers){
if(controllers[id].inactive){
controller=controllers[id];
break
}}
sessionId=controller?controller.sessionId:this._sessionId[type]++;
if(!controller){
var ctlrClass=eval(controllerClass);
controller=this._sessionController[type][sessionId]=new ctlrClass(this._container,this)
}
controller.setSessionId(type,sessionId);
this._curSessionId[type]=sessionId;
controller.inactive=false;
return controller
};
ZmApp.prototype._addSettingsChangeListeners=function(){
if(!this._settingListener){
this._settingListener=new AjxListener(this,this._settingChangeListener)
}};
ZmApp.prototype._settingChangeListener=function(e){};
ZmApp.prototype.getSearchParams=function(e){
return(e||{}
)
};
ZmApp.prototype._postLoadCore=function(){
if(!appCtxt.isChildWindow){
this._setupDropTargets()
}};
ZmApp.prototype._postLoad=function(e){
if(e){
this._createDeferredFolders(e)
}
this._handleDeferredNotifications()
};
ZmApp.prototype._setupDropTargets=function(){
var a=ZmApp.DROP_TARGETS[this._name];
for(var s in a){
var t=a[s];
for(var o=0;
o<t.length;
o++){
var r=t[o];
var e=appCtxt.getOverviewController().getTreeController(r,true);
var n=ZmList.ITEM_CLASS[s]||ZmOrganizer.ORG_CLASS[s];
if(e){
e._dropTgt.addTransferType(n)
}else{
if(!ZmTreeController.DROP_SOURCES[r]){
ZmTreeController.DROP_SOURCES[r]=[]
}
ZmTreeController.DROP_SOURCES[r].push(n)
}}}};
ZmApp.prototype.disposeTreeControllers=function(){
var e=appCtxt.getOverviewController(true);
if(!e){
return
}
var a=ZmApp.DROP_TARGETS[this._name];
for(var n in a){
var t=a[n];
for(var o=0;
o<t.length;
o++){
var r=t[o];
var s=e.getTreeController(r,true);
if(!s){
continue
}
s.dispose()
}}};
ZmApp.prototype.createDeferred=function(){
var a=ZmOrganizer.APP2ORGANIZER[this._name]||[];
for(var t=0;
t<a.length;
t++){
var o=a[t];
var e=ZmOrganizer.ORG_PACKAGE[o];
AjxDispatcher.require(e);
this._createDeferredFolders(o)
}};
ZmApp.prototype._createDeferredFolders=function(t){
for(var e=0;
e<this._deferredFolders.length;
e++){
var o=this._deferredFolders[e];
var a=ZmFolderTree.createFolder(o.type,o.parent,o.obj,o.tree,o.path,o.elementType);
o.parent.children.add(a);
a.parent=o.parent;
ZmFolderTree._traverse(a,o.obj,o.tree,o.path||[])
}
this._clearDeferredFolders()
};
ZmApp.prototype._clearDeferredFolders=function(){
this._deferredFolders=[];
this._deferredFolderHash={}
};
ZmApp.prototype._deferNotifications=function(t,a){
var e=ZmApp.MAIN_PKG[this._name];
if(e&&!AjxDispatcher.loaded(e)){
this._deferredNotifications.push({
type:t,data:a}
);
return true
}else{
this._noDefer=true;
return false
}};
ZmApp.prototype._handleDeferredNotifications=function(){
var t=this._deferredNotifications;
for(var a=0;
a<t.length;
a++){
var e=t[a];
if(e.type=="delete"){
this.deleteNotify(e.data,true)
}else{
if(e.type=="create"){
this.createNotify(e.data,true)
}else{
if(e.type=="modify"){
this.modifyNotify(e.data,true)
}}}}};
ZmApp.prototype._batchNotify=function(l){
if(!(l&&l.length>=ZmApp.BATCH_NOTIF_LIMIT)){
return
}
var t={}
,c,a=false;
for(var o=0,n=l.length;
o<n;
o++){
var h=l[o];
c=appCtxt.cacheGet(h.id);
if(c){
var r=c.notifyModify(h,true);
if(r){
if(!t[r]){
t[r]=[]
}
h.item=c;
t[r].push(h);
a=true
}}}
if(!a||!c){
return
}
var s=c.list;
if(!s){
return
}
s._evt.batchMode=true;
s._evt.item=c;
s._evt.items=null;
for(var r in t){
var e={
notifs:t[r]};
s._notify(r,e)
}};
ZmApp.prototype._inNewWindow=function(t){
var e=appCtxt.get(ZmSetting.NEW_WINDOW_COMPOSE);
return !t?e:((!e&&t&&t.shiftKey)||(e&&t&&!t.shiftKey))
};
ZmApp.prototype._handleCreateFolder=function(e,a){
var t=appCtxt.getById(e.l);
if(t&&(ZmOrganizer.VIEW_HASH[a][e.view])){
t.notifyCreate(e,"folder");
e._handled=true
}};
ZmApp.prototype._handleCreateLink=function(t,o){
var a=appCtxt.getById(t.l);
var e=t.view||"message";
if(a&&a.supportsSharing()&&(ZmOrganizer.VIEW_HASH[o][e])){
a.notifyCreate(t,"link");
t._handled=true
}};
ZmApp.prototype.launch=function(e,t){
this.createDeferred();
if(t){
t.run()
}};
ZmApp.prototype.activate=function(e){
this._active=e;
if(e){
this.setOverviewPanelContent();
this.stopAlert()
}};
ZmApp.prototype.isActive=function(){
return this._active
};
ZmApp.prototype.reset=function(e){};
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._notifyRendered=function(){
if(!this._hasRendered){
appCtxt.getAppController().appRendered(this._name);
this._hasRendered=true
}};
ZmApp.prototype._getExternalAccount=function(){
var t;
if(appCtxt.multiAccounts){
var a=appCtxt.accountList.visibleAccounts;
for(var e=0;
e<a.length;
e++){
var o=a[e];
if(o.isMain){
continue
}
if(appCtxt.get(ZmApp.SETTING[this.name],null,o)){
t=o;
break
}}}
return t
};
ZmApp.prototype._setLaunchTime=function(e,t){
if(!window.isPerfMetric){
return
}
var o=e+"_launched";
if(!t){
t=new Date()
}
if(!document.getElementById(o)){
var a=document.createElement("DIV");
a.id=o;
a.innerHTML=t.getTime();
a.style.display="none";
document.body.appendChild(a)
}};
ZmApp.prototype._setLoadedTime=function(e,t){
if(!window.isPerfMetric){
return
}
var o=e+"_loaded";
if(!t){
t=new Date()
}
if(!document.getElementById(o)){
var a=document.createElement("DIV");
a.id=o;
a.innerHTML=t.getTime();
a.style.display="none";
document.body.appendChild(a)
}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmPopupMenu")){
ZmPopupMenu=function(a,t,n,e){
if(arguments.length==0){
return
}
var o=Dwt.getParams(arguments,ZmPopupMenu.PARAMS);
o.className=o.className?o.className:"ActionMenu";
o.style=o.style||DwtMenu.POPUP_STYLE;
DwtMenu.call(this,o);
e=e||appCtxt.getCurrentController();
if(e){
this._controller=e;
this._keyMap=ZmKeyMap.MAP_NAME_R[this._controller.getKeyMapName()]
}
this._menuItems={}
};
ZmPopupMenu.PARAMS=["parent","className","id","controller"];
ZmPopupMenu.prototype=new DwtMenu;
ZmPopupMenu.prototype.constructor=ZmPopupMenu;
ZmPopupMenu.prototype.toString=function(){
return"ZmPopupMenu"
};
ZmPopupMenu.MENU_ITEM_ID_KEY="menuItemId";
ZmPopupMenu.prototype.addSelectionListener=function(o,a,e){
var t=this._menuItems[o];
if(t){
t.addSelectionListener(a,e)
}};
ZmPopupMenu.prototype.removeSelectionListener=function(a,t){
var e=this._menuItems[a];
if(e){
e.removeSelectionListener(t)
}};
ZmPopupMenu.prototype.popup=function(t,e,o,a){
t=t?t:0;
e=(e!=null)?e:Dwt.DEFAULT;
o=(o!=null)?o:Dwt.DEFAULT;
DwtMenu.prototype.popup.call(this,t,e,o,a)
};
ZmPopupMenu.prototype.enable=function(a,e){
a=(a instanceof Array)?a:[a];
for(var t=0;
t<a.length;
t++){
if(this._menuItems[a[t]]){
this._menuItems[a[t]].setEnabled(e)
}}};
ZmPopupMenu.prototype.enableAll=function(e){
for(var t in this._menuItems){
this._menuItems[t].setEnabled(e)
}};
ZmPopupMenu.prototype.createMenuItem=function(o,a){
var e=this._menuItems[o]=new DwtMenuItem({
parent:this,style:a.style,radioGroupId:a.radioGroupId,id:a.id,index:a.index}
);
if(a.image){
e.setImage(a.image)
}
if(a.text){
e.setText(a.text)
}
if(a.shortcut){
e.setShortcut(appCtxt.getShortcutHint(this._keyMap,a.shortcut))
}
e.setEnabled(a.enabled!==false);
e.setData(ZmPopupMenu.MENU_ITEM_ID_KEY,o);
var t=e.getRowElement();
if(t&&o&&typeof o=="string"){
t.setAttribute("id","POPUP_"+o.replace(/s/g,""))
}
return e
};
ZmPopupMenu.prototype.getMenuItem=function(e){
return this._menuItems[e]
};
ZmPopupMenu.prototype.getMenuItems=function(){
return this._menuItems
};
ZmPopupMenu.prototype.createSeparator=function(){
new DwtMenuItem({
parent:this,style:DwtMenuItem.SEPARATOR_STYLE}
)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmActionMenu")){
ZmActionMenu=function(t){
var a=t.context?ZmId.getMenuId(t.context,t.menuType):null;
ZmPopupMenu.call(this,t.parent,null,a,t.controller);
var e=t.menuItems;
if(!e){
e=[ZmOperation.TAG_MENU,ZmOperation.PRINT,ZmOperation.DELETE]
}else{
if(e==ZmOperation.NONE){
e=null
}}
this.opList=ZmOperation.filterOperations(e);
this._context=t.context;
this._menuType=t.menuType;
this._menuItems=ZmOperation.createOperations(this,this.opList,t.overrides)
};
ZmActionMenu.prototype=new ZmPopupMenu;
ZmActionMenu.prototype.constructor=ZmActionMenu;
ZmActionMenu.prototype.toString=function(){
return"ZmActionMenu"
};
ZmActionMenu.prototype.createOp=function(a,t){
t.id=this._context?ZmId.getMenuItemId(this._context,a,this._menuType):null;
var e=this.createMenuItem(a,t);
e.setData(ZmOperation.KEY_ID,a);
return e
};
ZmActionMenu.prototype.addOp=function(e){
ZmOperation.addOperation(this,e,this._menuItems)
};
ZmActionMenu.prototype.removeOp=function(e){
ZmOperation.removeOperation(this,e,this._menuItems)
};
ZmActionMenu.prototype.getOp=function(e){
return this.getMenuItem(e)
};
ZmActionMenu.prototype.getTagMenu=function(){
var e=this.getMenuItem(ZmOperation.TAG_MENU);
if(e){
return e.getMenu()
}};
ZmActionMenu.prototype.getSearchMenu=function(){
var e=this.getMenuItem(ZmOperation.SEARCH_MENU);
if(e){
return e.getMenu()
}};
ZmActionMenu.prototype._menuItemId=function(e){
return e.getData(ZmOperation.KEY_ID)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmToolBar")){
ZmToolBar=function(t){
if(arguments.length==0){
return
}
t.posStyle=t.posStyle||DwtControl.ABSOLUTE_STYLE;
DwtToolBar.call(this,t);
var e=t.controller||appCtxt.getCurrentController();
if(e){
this._controller=e;
this._keyMap=ZmKeyMap.MAP_NAME_R[this._controller.getKeyMapName()]
}
this._refElementId=t.refElementId;
this._buttons={}
};
ZmToolBar.prototype=new DwtToolBar;
ZmToolBar.prototype.constructor=ZmToolBar;
ZmToolBar.prototype.toString=function(){
return"ZmToolBar"
};
ZmToolBar.prototype.addSelectionListener=function(t,a){
var e=this._buttons[t];
if(e){
e.addSelectionListener(a)
}};
ZmToolBar.prototype.removeSelectionListener=function(t,a){
var e=this._buttons[t];
if(e){
e.removeSelectionListener(a)
}};
ZmToolBar.prototype.getButton=function(e){
return this._buttons[e]
};
ZmToolBar.prototype.setData=function(t,e,a){
this._buttons[t].setData(e,a)
};
ZmToolBar.prototype.enable=function(a,e){
a=(a instanceof Array)?a:[a];
for(var t=0;
t<a.length;
t++){
if(this._buttons[a[t]]){
this._buttons[a[t]].setEnabled(e)
}}};
ZmToolBar.prototype.enableAll=function(e){
for(var t in this._buttons){
this._buttons[t].setEnabled(e)
}};
ZmToolBar.prototype.createButton=function(a,t){
var e=this._buttons[a]=this._createButton(t);
if(t.image){
e.setImage(t.image)
}
if(t.text){
e.setText(t.text)
}
if(t.tooltip){
e.setToolTipContent(ZmOperation.getToolTip(a,this._keyMap)||t.tooltip)
}
e.setEnabled(t.enabled!==false);
e.setData("_buttonId",a);
if(t.menu){
e.setMenu(t.menu,false,null,t.menuAbove)
}
return e
};
ZmToolBar.prototype.SEPARATOR_TEMPLATE="share.Widgets#ZmToolBarSeparator";
ZmToolBar.prototype._createButton=function(o,t){
var a=o.ctor||DwtToolBarButton;
var e=new a({
parent:this,style:o.style,className:t,index:o.index,id:o.id,template:o.template}
);
e.textPrecedence=o.textPrecedence;
e.imagePrecedence=o.imagePrecedence;
return e
};
ZmToolBar.prototype._buttonId=function(e){
return e.getData("_buttonId")
};
ZmToolBar.prototype._createPrecedenceList=function(){
this._precedenceList=[];
for(var o in this._buttons){
if(ZmOperation.isSep(o)){
continue
}
var e=this._buttons[o];
var a=e.textPrecedence;
if(a){
this._precedenceList.push({
id:o,type:"text",precedence:a}
)
}
var t=e.imagePrecedence;
if(t){
this._precedenceList.push({
id:o,type:"image",precedence:t}
)
}}
this._precedenceList.sort(function(s,n){
return(s.precedence>n.precedence)?1:(s.precedence<n.precedence)?-1:0
}
)
};
ZmToolBar.prototype.adjustSize=function(){
if(!this._refElementId||!this._inited){
return
}
var o=this.getHtmlElement();
if(!this._refElement){
this._refElement=document.getElementById(this._refElementId)
}
if(!o||!this._refElement){
return
}
var a=this._refElement.offsetWidth;
var t=o.firstChild?o.firstChild.offsetWidth:a;
for(var s=0;
s<this._precedenceList.length;
s++){
var e=this._precedenceList[s];
var l=this._buttons[e.id];
if(!l){
continue
}
if(e.type=="text"&&l._toggleText){
l.setText(l._toggleText);
l._toggleText=null
}else{
if(e.type=="image"&&l._toggleimage){
l.setImage(l._toggleimage);
l._toggleimage=null
}}}
t=o.firstChild?o.firstChild.offsetWidth:a;
if(a>0&&t>a){
for(var s=0;
s<this._precedenceList.length;
s++){
var e=this._precedenceList[s];
var l=this._buttons[e.id];
if(!l||!l.getVisible()){
continue
}
var c=l.getText();
var n=l.getImage();
var r=Boolean(c||l._toggleText);
var h=Boolean(n||l._toggleimage);
if(r&&h&&(t>a)){
if(e.type=="text"){
l._toggleText=c;
l.setText("")
}else{
if(e.type=="image"){
l._toggleimage=n;
l.setImage("")
}}}
t=o.firstChild?o.firstChild.offsetWidth:a
}}};
ZmToolBar.prototype.setSize=function(t,e){
var a=this.getSize();
if(t!=a.x||e!=a.y){
DwtToolBar.prototype.setSize.apply(this,arguments);
this.adjustSize()
}};
ZmToolBar.prototype._addItem=function(a,t,e){
DwtToolBar.prototype._addItem.apply(this,arguments);
this.adjustSize()
};
ZmToolBar.prototype._removeItem=function(a,t,e){
DwtToolBar.prototype._removeItem.apply(this,arguments);
this.adjustSize()
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmButtonToolBar")){
ZmButtonToolBar=function(t){
if(arguments.length==0){
return
}
t.className=t.className||"ZToolbar";
t.id=t.context?ZmId.getToolbarId(t.context,t.toolbarType):null;
ZmToolBar.call(this,t);
this._context=t.context;
this._toolbarType=t.toolbarType;
this._buttonStyle=t.buttonClassName;
var e=t.buttons;
if(!e){
e=[ZmOperation.NEW_MENU,ZmOperation.TAG_MENU,ZmOperation.PRINT,ZmOperation.DELETE]
}else{
if(e==ZmOperation.NONE){
e=null
}}
this.opList=ZmOperation.filterOperations(e);
this._buttons=ZmOperation.createOperations(this,this.opList,t.overrides);
this._createPrecedenceList();
this._inited=true
};
ZmButtonToolBar.prototype=new ZmToolBar;
ZmButtonToolBar.prototype.constructor=ZmButtonToolBar;
ZmButtonToolBar.prototype.toString=function(){
return"ZmButtonToolBar"
};
ZmButtonToolBar.prototype.createOp=function(o,a){
a.className=this._buttonStyle;
var e;
if(o==ZmOperation.TEXT){
var o;
if(this._context){
var t=this._toolbarType?[this._context,this._toolbarType].join("_"):this._context;
o=[ZmId.WIDGET,AjxStringUtil.toMixed(t,"_",true),AjxStringUtil.toMixed(o,"_")].join("")
}
a.textClassName=a.textClassName||"ZWidgetTitle";
e=new DwtText({
parent:this,className:a.textClassName,id:o}
)
}else{
a.id=this._context?ZmId.getButtonId(this._context,o,this._toolbarType):null;
a.textPrecedence=ZmOperation.getProp(o,"textPrecedence");
a.iconPrecedence=ZmOperation.getProp(o,"iconPrecedence");
e=this.createButton(o,a)
}
e.setData(ZmOperation.KEY_ID,o);
return e
};
ZmButtonToolBar.prototype.addOp=function(t,e){
if(this.getOp(t)){
return
}
ZmOperation.addOperation(this,t,this._buttons,e);
AjxUtil.arrayAdd(this.opList,t,e)
};
ZmButtonToolBar.prototype.removeOp=function(e){
ZmOperation.removeOperation(this,e,this._buttons);
AjxUtil.arrayRemove(this.opList,e)
};
ZmButtonToolBar.prototype.getOp=function(e){
return this.getButton(e)
};
ZmButtonToolBar.prototype.getTagMenu=function(){
var e=this.getButton(ZmOperation.TAG_MENU);
if(e){
return e.getMenu()
}};
ZmButtonToolBar.prototype._buttonId=function(e){
return e.getData(ZmOperation.KEY_ID)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmNavToolBar")){
ZmNavToolBar=function(t){
t.className=t.className||"ZmNavToolBar";
var e=(t.hasText!==false);
t.buttons=this._getButtons(e);
t.toolbarType=ZmId.TB_NAV;
t.posStyle=t.posStyle||DwtControl.STATIC_STYLE;
ZmButtonToolBar.call(this,t);
if(e){
this._textButton=this.getButton(ZmOperation.TEXT)
}};
ZmNavToolBar.prototype=new ZmButtonToolBar;
ZmNavToolBar.prototype.constructor=ZmNavToolBar;
ZmNavToolBar.prototype.toString=function(){
return"ZmNavToolBar"
};
ZmNavToolBar.prototype.enable=function(o,e){
ZmButtonToolBar.prototype.enable.call(this,o,e);
if(!e){
if(!(o instanceof Array)){
o=[o]
}
for(var a=0;
a<o.length;
a++){
var t=this.getButton(o[a]);
if(t){
t.setToolTipContent(null)
}}}};
ZmNavToolBar.prototype.setToolTip=function(t,a){
var e=this.getButton(t);
if(e){
e.setToolTipContent(a)
}};
ZmNavToolBar.prototype.setText=function(e){
if(!this._textButton){
return
}
this._textButton.setText(e)
};
ZmNavToolBar.prototype._getButtons=function(e){
var t=[];
t.push(ZmOperation.PAGE_BACK);
if(e){
t.push(ZmOperation.TEXT)
}
t.push(ZmOperation.PAGE_FORWARD);
return t
};
ZmNavToolBar.prototype.createOp=function(t,e){
e.textClassName="ZWidgetTitle ZmNavToolBarTitle";
return ZmButtonToolBar.prototype.createOp.apply(this,arguments)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmSearchToolBar")){
ZmSearchToolBar=function(e,a){
DwtComposite.call(this,{
parent:e,className:"ZmSearchToolbar",id:a}
);
var t={
msgKey:"searchAll",tooltipKey:"searchForAny",icon:"Globe",setting:ZmSetting.MIXED_VIEW_ENABLED,index:0,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_ANY)};
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_ANY,t);
t={
msgKey:"searchShared",tooltipKey:"searchShared",icon:"Group",setting:ZmSetting.SHARING_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_SHARED)};
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_SHARED,t);
if(appCtxt.multiAccounts){
t={
msgKey:"searchAllAccounts",icon:"Globe",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_ALL_ACCOUNTS)};
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_ALL_ACCOUNTS,t)
}
this._createHtml()
};
ZmSearchToolBar.prototype=new DwtComposite;
ZmSearchToolBar.prototype.constructor=ZmSearchToolBar;
ZmSearchToolBar.SEARCH_MENU_BUTTON=1;
ZmSearchToolBar.SEARCH_BUTTON=2;
ZmSearchToolBar.SAVE_BUTTON=3;
ZmSearchToolBar.BROWSE_BUTTON=4;
ZmSearchToolBar.MENUITEM_ID="_menuItemId";
ZmSearchToolBar.SETTING={};
ZmSearchToolBar.MENU_ITEMS=[];
ZmSearchToolBar.MSG_KEY={};
ZmSearchToolBar.TT_MSG_KEY={};
ZmSearchToolBar.ICON={};
ZmSearchToolBar.SHARE_ICON={};
ZmSearchToolBar.ID={};
ZmSearchToolBar.addMenuItem=function(t,e){
if(e.msgKey){
ZmSearchToolBar.MSG_KEY[t]=e.msgKey
}
if(e.tooltipKey){
ZmSearchToolBar.TT_MSG_KEY[t]=e.tooltipKey
}
if(e.icon){
ZmSearchToolBar.ICON[t]=e.icon
}
if(e.shareIcon){
ZmSearchToolBar.SHARE_ICON[t]=e.shareIcon
}
if(e.setting){
ZmSearchToolBar.SETTING[t]=e.setting
}
if(e.id){
ZmSearchToolBar.ID[t]=e.id
}
if(e.index==null||e.index<0||e.index>=ZmSearchToolBar.MENU_ITEMS.length){
ZmSearchToolBar.MENU_ITEMS.push(t)
}else{
ZmSearchToolBar.MENU_ITEMS.splice(e.index,0,t)
}};
ZmSearchToolBar.prototype.toString=function(){
return"ZmSearchToolBar"
};
ZmSearchToolBar.prototype.removeMenuItem=function(a){
var e=0;
while(e<ZmSearchToolBar.MENU_ITEMS.length){
if(ZmSearchToolBar.MENU_ITEMS[e]==a){
break
}
e++
}
if(e<ZmSearchToolBar.MENU_ITEMS.length){
var t=this._searchMenuButton.getMenu();
t.removeChild(t.getItemById("_menuItemId",a));
ZmSearchToolBar.MENU_ITEMS.splice(e,1);
ZmSearchToolBar.MSG_KEY[a]="";
ZmSearchToolBar.TT_MSG_KEY[a]="";
ZmSearchToolBar.ICON[a]="";
ZmSearchToolBar.SHARE_ICON[a]="";
ZmSearchToolBar.SETTING[a]="";
ZmSearchToolBar.ID[a]=""
}
this.dedupSeparators(t)
};
ZmSearchToolBar.prototype.dedupSeparators=function(o){
if(o==null){
o=this._searchMenuButton.getMenu()
}
var e=o.getItems();
var a=false;
var t=[];
for(mi in e){
if(!e[mi].__text){
if(a==true||a==null){
t.push(e[mi])
}else{
a=true
}}else{
a=false
}}
for(mi in t){
o.removeChild(t[mi])
}
if(!e[e.length-1].__text){
o.removeChild(e[e.length-1])
}};
ZmSearchToolBar.prototype.getSearchField=function(){
return this._searchField.getInputElement()
};
ZmSearchToolBar.prototype.registerCallback=function(e,t){
this._callback=new AjxCallback(t,e)
};
ZmSearchToolBar.prototype.addSelectionListener=function(t,a){
var e;
switch(t){
case ZmSearchToolBar.SEARCH_MENU_BUTTON:e=this._searchMenuButton;
break;
case ZmSearchToolBar.SEARCH_BUTTON:e=this._searchButton;
break;
case ZmSearchToolBar.SAVE_BUTTON:e=this._saveButton;
break;
case ZmSearchToolBar.BROWSE_BUTTON:e=this._browseButton;
break
}
if(e){
e.addSelectionListener(a)
}};
ZmSearchToolBar.prototype.getButton=function(e){
switch(e){
case ZmSearchToolBar.SEARCH_MENU_BUTTON:return this._searchMenuButton;
case ZmSearchToolBar.SEARCH_BUTTON:return this._searchButton;
case ZmSearchToolBar.SAVE_BUTTON:return this._saveButton;
case ZmSearchToolBar.BROWSE_BUTTON:return this._browseButton
}
return null
};
ZmSearchToolBar.prototype.getButtons=function(){
return AjxUtil.collapseList([this._searchMenuButton,this._searchButton,this._saveButton,this._browseButton,this._customSearchBtn])
};
ZmSearchToolBar.prototype.focus=function(){
if(this._searchField){
this._searchField.focus()
}};
ZmSearchToolBar.prototype.blur=function(){
if(this._searchField){
this._searchField.blur()
}};
ZmSearchToolBar.prototype.setEnabled=function(e){
if(this._searchField){
this._searchField.setEnabled(e)
}
if(this._searchMenuButton){
this._searchMenuButton.setEnabled(e)
}
if(this._searchButton){
this._searchButton.setEnabled(e)
}
if(this._saveButton){
this._saveButton.setEnabled(e)
}
if(this._browseButton){
this._browseButton.setEnabled(e)
}
if(this._customSearchBtn){
this._customSearchBtn.setEnabled(e)
}};
ZmSearchToolBar.prototype.setSearchFieldValue=function(e){
if(this._searchField&&e!=this.getSearchFieldValue()){
this._searchField.setValue(e)
}};
ZmSearchToolBar.prototype.getSearchFieldValue=function(){
return this._searchField?this._searchField.getValue():null
};
ZmSearchToolBar.prototype.createCustomSearchBtn=function(s,r,a,e){
if(!this._customSearchListener){
this._customSearchListener=new AjxListener(this,this._customSearchBtnListener)
}
var l=document.getElementById(this._htmlElId+"_customSearchButton");
if(l){
if(!this._customSearchBtn){
this._customSearchBtn=this._addButton({
tdId:"_customSearchButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_CUSTOM),lbl:r,icon:s}
);
this._customSearchBtn.setData("CustomSearchItem",[s,r,a]);
this._customSearchBtn.addSelectionListener(this._customSearchListener);
var c=document.getElementById(this._htmlElId+"_customSearchButtonSep");
if(c){
Dwt.setVisible(c,true)
}}else{
var t=this._customSearchBtn.getMenu();
var h;
var o={
parent:t,enabled:true,style:DwtMenuItem.RADIO_STYLE,radioGroupId:0,id:e};
if(!t){
var n=this._customSearchBtn.getData("CustomSearchItem");
t=new DwtMenu({
parent:this._customSearchBtn,className:"ActionMenu",id:ZmId.getMenuId(ZmId.SEARCH,ZmId.SEARCH_CUSTOM)}
);
this._customSearchBtn.setMenu(t,false,DwtMenuItem.RADIO_STYLE);
o.imageInfo=n[0];
o.text=n[1];
h=DwtMenuItem.create(o);
h.setData("CustomSearchItem",n);
h.setData(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_CUSTOM);
h.setChecked(true,true);
h.addSelectionListener(this._customSearchListener)
}
o.imageInfo=s;
o.text=r;
h=DwtMenuItem.create(o);
h.setData("CustomSearchItem",[s,r,a]);
h.addSelectionListener(this._customSearchListener)
}}else{
if(this._searchMenuCreated){
var t=this._searchMenuButton.getMenu();
this._createCustomSearchMenuItem(t,s,r,a,e)
}else{
if(!this._customSearchMenuItems){
this._customSearchMenuItems=[]
}
this._customSearchMenuItems.push({
icon:s,text:r,listener:a,id:e}
)
}}};
ZmSearchToolBar.prototype._createCustomSearchMenuItem=function(s,t,n,a,r){
var e=s.getItem(0);
var o={
parent:s,imageInfo:t,text:n,enabled:true,style:DwtMenuItem.RADIO_STYLE,radioGroupId:0,index:0,id:r};
e=DwtMenuItem.create(o);
e.setData("CustomSearchItem",[t,n,a]);
e.setData(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_CUSTOM);
e.addSelectionListener(this._customSearchListener);
if(!(e&&e.getData("CustomSearchItem"))){
e=new DwtMenuItem({
parent:s,style:DwtMenuItem.SEPARATOR_STYLE,index:1}
)
}};
ZmSearchToolBar.prototype._customSearchBtnListener=function(a){
var t=a.item;
if(!t){
return
}
var o=t.getData("CustomSearchItem");
if(this._customSearchBtn){
if(t instanceof DwtMenuItem){
if(a.detail!=DwtMenuItem.CHECKED){
return
}
this._customSearchBtn.setToolTipContent(o[1]);
this._customSearchBtn.setData("CustomSearchItem",o)
}
o[2].run(a)
}else{
this._searchMenuButton.setToolTipContent(o[1]);
var n=t.parent;
var e=n?n.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_SHARED):null;
if(e){
e.setChecked(false,true);
e.setEnabled(false)
}
this._searchMenuButton.setImage(o[0]);
this._searchMenuButton.setText(o[1])
}};
ZmSearchToolBar.prototype._createHtml=function(){
this.getHtmlElement().innerHTML=AjxTemplate.expand("share.Widgets#ZmSearchToolBar",{
id:this._htmlElId}
);
var n=this._htmlElId+"_inputField";
var t=document.getElementById(n);
if(t){
this._searchField=new DwtInputField({
parent:this,hint:ZmMsg.searchInput,inputId:ZmId.SEARCH_INPUTFIELD}
);
var o=this._searchField.getInputElement();
o.className="search_input";
this._searchField.reparentHtmlElement(n);
this._searchField.addListener(DwtEvent.ONKEYUP,new AjxListener(this,this._handleKeyUp));
this._searchField._showHint()
}
var r=this._htmlElId+"_searchMenuButton";
var a=document.getElementById(r);
if(a){
var e=appCtxt.get(ZmSetting.MAIL_ENABLED);
this._searchMenuButton=this._addButton({
tdId:"_searchMenuButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_MENU),lbl:e?ZmMsg.searchMail:ZmMsg.searchAll,icon:e?"Message":"Globe"}
);
var s=new AjxCallback(this,this._createSearchMenu);
this._searchMenuButton.setMenu(s,false,DwtMenuItem.RADIO_STYLE);
this._searchMenuButton.reparentHtmlElement(r)
}
this._searchButton=this._addButton({
tdId:"_searchButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_SEARCH),lbl:ZmMsg.search,icon:"Search",tooltip:ZmMsg.searchTooltip}
);
this._saveButton=this._addButton({
setting:ZmSetting.SAVED_SEARCHES_ENABLED,tdId:"_saveButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_SAVE),lbl:ZmMsg.save,icon:"Save",type:"toolbar",tooltip:ZmMsg.saveSearchTooltip}
);
this._browseButton=this._addButton({
setting:ZmSetting.BROWSE_ENABLED,tdId:"_advancedButton",buttonId:ZmId.getButtonId(ZmId.SEARCH,ZmId.SEARCH_ADVANCED),style:(DwtLabel.IMAGE_LEFT|DwtLabel.ALIGN_CENTER|DwtButton.TOGGLE_STYLE),lbl:ZmMsg.searchBuilder,icon:"SearchBuilder",type:"toolbar",tooltip:ZmMsg.openSearchBuilder}
)
};
ZmSearchToolBar.prototype._createSearchMenu=function(){
var s=new DwtMenu({
parent:this._searchMenuButton,className:"ActionMenu",id:ZmId.getMenuId(ZmId.SEARCH)}
);
var e;
if(this._customSearchMenuItems){
for(var a=0;
a<this._customSearchMenuItems.length;
a++){
var t=this._customSearchMenuItems[a];
this._createCustomSearchMenuItem(s,t.icon,t.text,t.listener)
}}
var n={
parent:s,enabled:true,radioGroupId:0};
for(var a=0;
a<ZmSearchToolBar.MENU_ITEMS.length;
a++){
var r=ZmSearchToolBar.MENU_ITEMS[a];
if(r==ZmId.SEARCH_SHARED){
if(ZmSearchToolBar.MENU_ITEMS.length<=1){
continue
}
e=new DwtMenuItem({
parent:s,style:DwtMenuItem.SEPARATOR_STYLE}
)
}
var o=ZmSearchToolBar.SETTING[r];
if(o&&!appCtxt.get(o)){
continue
}
n.style=(r==ZmId.SEARCH_SHARED||r==ZmId.SEARCH_ALL_ACCOUNTS)?DwtMenuItem.CHECK_STYLE:DwtMenuItem.RADIO_STYLE;
n.imageInfo=ZmSearchToolBar.ICON[r];
n.text=ZmMsg[ZmSearchToolBar.MSG_KEY[r]];
n.id=ZmSearchToolBar.ID[r];
e=DwtMenuItem.create(n);
e.setData(ZmSearchToolBar.MENUITEM_ID,r);
if(r==ZmId.SEARCH_ANY){
if(ZmSearchToolBar.MENU_ITEMS.length<=1){
continue
}
e=new DwtMenuItem({
parent:s,style:DwtMenuItem.SEPARATOR_STYLE}
)
}}
appCtxt.getSearchController()._addMenuListeners(s);
this._searchMenuCreated=true;
return s
};
ZmSearchToolBar.prototype._addButton=function(n){
if(n.setting&&!appCtxt.get(n.setting)){
return
}
var a;
var t=this._htmlElId+(n.tdId||n.buttonId);
var e=document.getElementById(t);
if(e){
var s={
parent:this,style:n.style,id:n.buttonId};
a=(n.type&&n.type=="toolbar")?(new DwtToolBarButton(s)):(new DwtButton(s));
var o=Dwt.getAttr(e,"hint");
this._setButtonStyle(a,o,n.lbl,n.icon);
if(n.tooltip){
a.setToolTipContent(n.tooltip)
}
a.reparentHtmlElement(t)
}
return a
};
ZmSearchToolBar.prototype._setButtonStyle=function(e,o,a,t){
if(o=="text"){
e.setText(a)
}else{
if(o=="icon"){
e.setImage(t)
}else{
e.setText(a);
e.setImage(t)
}}};
ZmSearchToolBar.prototype._handleKeyUp=function(t){
var e=DwtKeyEvent.getCharCode(t);
if(e==13){
return this._handleEnterKeyPress(t)
}
return true
};
ZmSearchToolBar.prototype._handleEnterKeyPress=function(a){
var n=this._searchMenuButton&&this._searchMenuButton.getMenu();
var t=n?n.getSelectedItem()||n.getItems()[0]:null;
var o=t&&t.getData("CustomSearchItem");
if(o){
o[2].run(a)
}else{
var e=t.getData(ZmSearchToolBar.MENUITEM_ID);
var s=this.getSearchFieldValue();
appCtxt.notifyZimlets("onKeyPressSearchField",[s]);
this._callback.run(s,e)
}
return false
};
ZmSearchToolBar.prototype.initAutocomplete=function(t){
var e={
dataClass:new ZmSearchAutocomplete(),matchValue:"matchText",delims:[" "," "],delimCodes:[3,13,32,9],separator:" ",enterCallback:new AjxCallback(this,this._handleEnterKeyPress)};
this._acList=new ZmAutocompleteListView(e);
this._acList.handle(this.getSearchField())
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmPeopleSearchToolBar")){
ZmPeopleSearchToolBar=function(e,t){
DwtComposite.call(this,{
parent:e,className:"ZmPeopleSearchToolbar",id:t,posStyle:Dwt.ABSOLUTE_STYLE}
);
this._createHtml()
};
ZmPeopleSearchToolBar.prototype=new DwtComposite;
ZmPeopleSearchToolBar.prototype.constructor=ZmPeopleSearchToolBar;
ZmPeopleSearchToolBar.prototype.toString=function(){
return"ZmPeopleSearchToolBar"
};
ZmPeopleSearchToolBar.prototype._createHtml=function(){
this.getHtmlElement().innerHTML=AjxTemplate.expand("share.Widgets#ZmPeopleSearchToolBar",{
id:this._htmlElId}
);
var a=this._htmlElId+"_inputField";
var e=document.getElementById(a);
if(e){
this._searchField=new DwtInputField({
parent:this,hint:ZmMsg.peopleSearchHint,inputId:ZmId.PEOPLE_SEARCH_INPUTFIELD}
);
var t=this._searchField.getInputElement();
Dwt.addClass(t,"people_search_input");
this._searchField.reparentHtmlElement(a);
this._searchField._showHint()
}};
ZmPeopleSearchToolBar.prototype.initAutocomplete=function(){
var e={
parent:appCtxt.getShell(),dataClass:(new ZmPeopleSearchAutocomplete()),matchValue:ZmAutocomplete.AC_VALUE_EMAIL,options:{
type:ZmAutocomplete.AC_TYPE_GAL}
,separator:"",compCallback:(new AjxCallback(this,this._acCompCallback))};
this._autocomplete=new ZmPeopleAutocompleteListView(e);
this._autocomplete.handle(this._searchField.getInputElement())
};
ZmPeopleSearchToolBar.prototype._acCompCallback=function(o,t,e){
AjxDispatcher.require(["ContactsCore","Contacts"]);
var a=new ZmContactList((new ZmSearch()),true);
a.add(e.item);
appCtxt.getApp(ZmApp.CONTACTS).getContactListController().show(a,true)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmTreeView")){
ZmTreeView=function(e){
if(arguments.length==0){
return
}
DwtTree.call(this,{
parent:e.parent,parentElement:e.parentElement,style:e.treeStyle,isCheckedByDefault:e.isCheckedByDefault,className:(e.className||"OverviewTree"),posStyle:e.posStyle,id:e.id}
);
this._headerClass=e.headerClass||"overviewHeader";
this.overviewId=e.overviewId;
this.type=e.type;
this.allowedTypes=e.allowedTypes;
this.allowedSubTypes=e.allowedSubTypes;
this._overview=appCtxt.getOverviewController().getOverview(this.overviewId);
this._dragSrc=e.dragSrc;
this._dropTgt=e.dropTgt;
this._dataTree=null;
this._treeItemHash={}
};
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(s,t,e){
if(!e){
return null
}
var n=s.getItemCount();
var o=s.getItems();
for(var a=0;
a<o.length;
a++){
if(o[a]._isSeparator){
continue
}
var h=o[a].getData(Dwt.KEY_OBJECT);
if(!h){
continue
}
var r=e(t,h);
if(r==-1){
return a
}}
return a
};
ZmTreeView.prototype=new DwtTree;
ZmTreeView.prototype.constructor=ZmTreeView;
ZmTreeView.prototype.toString=function(){
return"ZmTreeView"
};
ZmTreeView.prototype.SHARE_LINK_TEMPLATE="share.Widgets#ZmAddShareLink";
ZmTreeView.prototype.set=function(r){
this._showUnread=r.showUnread;
this._dataTree=r.dataTree;
this._newButton=r.newButton;
this.clearItems();
var c=this._dataTree.root;
var s=(appCtxt.multiAccounts&&(this.type==ZmOrganizer.SEARCH||this.type==ZmOrganizer.TAG));
var d=this._getHeaderTreeItemImage();
var t=this._headerItem=new DwtHeaderTreeItem({
parent:this,className:s?"DwtTreeItem":this._headerClass,imageInfo:d,id:ZmId.getTreeItemId(this.overviewId,null,this.type),button:s?null:r.newButton,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,selectable:(appCtxt.multiAccounts&&this.type!=ZmOrganizer.SEARCH&&this.type!=ZmOrganizer.TAG)}
);
t._isHeader=true;
var a=ZmMsg[ZmOrganizer.LABEL[this.type]];
if(a){
t.setText(a)
}
t.setData(Dwt.KEY_ID,c.id);
t.setData(Dwt.KEY_OBJECT,c);
t.setData(ZmTreeView.KEY_ID,this.overviewId);
t.setData(ZmTreeView.KEY_TYPE,this.type);
if(this._dropTgt){
t.setDropTarget(this._dropTgt)
}
this._treeItemHash[c.id]=t;
r.treeNode=t;
r.organizer=c;
this._render(r);
t.setExpanded(!r.collapsed,null,true);
if(!appCtxt.multiAccounts){
this.addSeparator()
}
var n=this._overview&&this._overview.isAppOverview;
var e=true;
var l;
if(appCtxt.multiAccounts&&r.account){
l=r.account;
e=l.isZimbraAccount&&!l.isMain
}
var f=appCtxt.get(ZmSetting.SHARING_ENABLED,null,l)&&n&&e&&(this.type==ZmOrganizer.FOLDER||this.type==ZmOrganizer.ADDRBOOK||this.type==ZmOrganizer.CALENDAR||this.type==ZmOrganizer.TASKS||this.type==ZmOrganizer.BRIEFCASE);
if(f){
var h=this._treeItemHash[c.id];
h._realizeDeferredChildren();
var m=new DwtTreeItem({
parent:h,deferred:false}
);
m.setImage("Blank_16");
m.enableSelection(false);
m.showCheckBox(false);
var o=m.getHTMLElId();
m.setText(AjxTemplate.expand(this.SHARE_LINK_TEMPLATE,o));
var u=document.getElementById(o+"_addshare_link");
u.onclick=AjxCallback.simpleClosure(this._handleAddShareLink,this,(l?l.id:null));
this._addShareLink=m
}
if(appCtxt.getSkinHint("noOverviewHeaders")||this._hideHeaderTreeItem()){
t.setVisible(false,true)
}};
ZmTreeView.prototype.getTreeItemById=function(e){
return this._treeItemHash[e]
};
ZmTreeView.prototype.getHeaderItem=function(){
return this._headerItem
};
ZmTreeView.prototype.getSelected=function(){
if(this.isCheckedStyle){
var a=[];
for(var e in this._treeItemHash){
var t=this._treeItemHash[e];
if(t&&t.getChecked()){
a.push(t.getData(Dwt.KEY_OBJECT))
}}
return a
}else{
return(this.getSelectionCount()!=1)?null:this.getSelection()[0].getData(Dwt.KEY_OBJECT)
}};
ZmTreeView.prototype.setSelected=function(e,t,o){
var a=ZmOrganizer.getSystemId((e instanceof ZmOrganizer)?e.id:e);
if(!a||!this._treeItemHash[a]){
return
}
this.setSelection(this._treeItemHash[a],t,false,o)
};
ZmTreeView.prototype._render=function(params){
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)
}
children=children1
}
children.sort(eval(ZmTreeView.COMPARE_FUNC[this.type]))
}}
var addSep=true;
var numItems=0;
var len=children.length;
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])){
var allowed=((org.nId==ZmOrganizer.ID_ROOT)&&this.allowedTypes[child.type])||((org.nId!=ZmOrganizer.ID_ROOT)&&this.allowedSubTypes[child.type]);
if(!allowed){
if(params.omitParents){
continue
}
var proxy=AjxUtil.createProxy(params);
proxy.treeNode=null;
proxy.organizer=child;
this._render(proxy);
continue
}
if(this._allowedTypes&&!this._allowedTypes[child.type]){
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.startPos=i;
params.showRemainingFoldersNode=ti;
child._showFoldersCallback=new AjxCallback(this,this._showRemainingFolders,[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._addNew=function(l,p,c,m,a){
var t;
var e=(p.type==ZmOrganizer.FOLDER)&&appCtxt.getDataSourceCollection();
var f=e&&e.getByFolderId(p.nId);
var n=(f&&f.length>0)?f[0]:null;
if(n&&n.type==ZmAccount.TYPE_IMAP){
var h=appCtxt.isFamilyMbox?null:this._headerClass;
var u=appCtxt.isFamilyMbox?"AccountIMAP":null;
t=new DwtTreeItem({
parent:this,text:p.getName(),className:h,imageInfo:u}
);
t.enableSelection(false)
}else{
if(!l){
var d=[];
var r=p.parent;
if(r){
while((l=this.getTreeItemById(r.id))==null){
d.push(r);
r=r.parent
}}
while(r=d.pop()){
l=this.getTreeItemById(r.parent.id);
l=new DwtTreeItem({
parent:l,text:r.getName(),imageInfo:r.getIconWithColor(),forceNotifySelection:true,dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,id:ZmId.getTreeItemId(this.overviewId,r.id)}
);
l.setData(Dwt.KEY_ID,r.id);
l.setData(Dwt.KEY_OBJECT,r);
l.setData(ZmTreeView.KEY_ID,this.overviewId);
l.setData(ZmTreeView.KEY_TYPE,r.type);
this._treeItemHash[r.id]=l
}}
if(this._addShareLink&&this._addShareLink.parent==l){
var o=l.getChildIndex(this._addShareLink);
if(o>=0&&(!c||c>o)){
c=o
}}
var s={
parent:l,index:c,text:p.getName(this._showUnread),dndScrollCallback:this._overview&&this._overview._dndScrollCallback,dndScrollId:this._overview&&this._overview._scrollableContainerId,imageInfo:p.getIconWithColor(),id:ZmId.getTreeItemId(this.overviewId,p.id)};
t=new DwtTreeItem(s)
}
if(appCtxt.multiAccounts&&(p.type==ZmOrganizer.SEARCH||p.type==ZmOrganizer.TAG)){
t.addClassName("DwtTreeItemChildDiv")
}
t.setDndText(p.getName());
t.setData(Dwt.KEY_ID,p.id);
t.setData(Dwt.KEY_OBJECT,p);
t.setData(ZmTreeView.KEY_ID,this.overviewId);
t.setData(ZmTreeView.KEY_TYPE,p.type);
if(!m){
var g=p.getToolTip();
if(g){
t.setToolTipContent(g)
}}
if(this._dragSrc){
t.setDragSource(this._dragSrc)
}
if(this._dropTgt){
t.setDropTarget(this._dropTgt)
}
this._treeItemHash[p.id]=t;
if(ZmTreeView.ADD_SEP[p.nId]){
l.addSeparator()
}
if(p.children&&p.children.size()){
this._render({
treeNode:t,organizer:p,omit:a}
)
}
if(n&&n.type==ZmAccount.TYPE_IMAP){
t.setExpanded(!appCtxt.get(ZmSetting.COLLAPSE_IMAP_TREES))
}
return t
};
ZmTreeView.prototype.getNextData=function(t){
var r=this.getTreeItemById(t);
if(!r||!r.parent){
return null
}
while(r&&r.parent){
var o=r.parent;
if(!(o instanceof DwtTreeItem)){
return null
}
var e=o.getItems();
var l=null;
if(e&&e.length>1){
for(var n=0;
n<e.length;
n++){
var s=e[n];
if(s==r){
var h=this.findNext(r,e,n);
if(h){
return h
}
var a=this.findPrev(r,e,n);
if(a){
return a
}}}}
r=r.parent
}
return null
};
ZmTreeView.prototype.findNext=function(n,o,t){
for(var e=t+1;
e<o.length;
e++){
var a=o[e];
if(a&&a.getData){
return a.getData(Dwt.KEY_OBJECT)
}}
return null
};
ZmTreeView.prototype.findPrev=function(n,o,t){
for(var e=t-1;
e>=0;
e--){
var a=o[e];
if(a&&a.getData){
return a.getData(Dwt.KEY_OBJECT)
}}
return null
};
ZmTreeView.prototype._showRemainingFolders=function(e){
if(e.showRemainingFoldersNode){
e.showRemainingFoldersNode.dispose()
}
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){
this._render(e);
if(e.len){
var t=ZmMsg[ZmOrganizer.LABEL[this.type]].toLowerCase();
appCtxt.setStatusMsg(AjxMessageFormat.format(ZmMsg.foldersShown,[e.len,t]));
e.len=0
}}
),100)
};
ZmTreeView.prototype._getNextTreeItem=function(t){
var e=DwtTree.prototype._getNextTreeItem.apply(this,arguments);
return e||(this._overview&&this._overview._getNextTreeItem(t,this))
};
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.NOTEBOOK||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
};
ZmTreeView.prototype._handleAddShareLink=function(t,e){
if(appCtxt.multiAccounts&&t){
var n=appCtxt.accountList.getAccount(t);
if(n&&n.isZimbraAccount){
appCtxt.accountList.setActiveAccount(n)
}}
try{
var a=appCtxt.getShareSearchDialog();
var o=new AjxCallback(this,this._handleAddShare);
a.popup(this.type,o)
}
finally{
return false
}};
ZmTreeView.prototype._handleAddShare=function(){
var o=appCtxt.getShareSearchDialog();
var a=o.getShares();
o.popdown();
if(a.length==0){
return
}
AjxDispatcher.require("Share");
var h=[];
for(var t=0;
t<a.length;
t++){
var s=a[t];
var e=s.folderPath.substr(1).replace(///g," ");
var n=(s.normalizedOwnerName.indexOf("@")>1)?s.normalizedOwnerName.substr(0,s.normalizedOwnerName.indexOf("@")):s.normalizedOwnerName;
h.push({
_jsns:"urn:zimbraMail",link:{
l:ZmOrganizer.ID_ROOT,name:ZmShare.getDefaultMountpointName(n,e),view:s.view,zid:s.ownerId,rid:s.folderId}}
);
var r={
jsonObj:{
BatchRequest:{
_jsns:"urn:zimbra",CreateMountpointRequest:h}}
,asyncMode:true,callback:new AjxCallback(this,this._handleAddShareResponse),errorCallback:new AjxCallback(this,this._handleAddShareError)};
appCtxt.getAppController().sendRequest(r)
}};
ZmTreeView.prototype._handleAddShareResponse=function(e){};
ZmTreeView.prototype._handleAddShareError=function(e){}
}
if(AjxPackage.define("zimbraMail.share.view.ZmTagMenu")){
ZmTagMenu=function(t,e){
ZmPopupMenu.call(this,t,null,t.getHTMLElId()+"|MENU",e);
t.setMenu(this);
this._addHash={};
this._removeHash={};
this._evtMgr=new AjxEventMgr();
this._desiredState=true;
this._items=null;
this._dirty=true;
if(t instanceof DwtMenuItem){
t.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(e){
this._evtMgr.addListener(DwtEvent.SELECTION,e)
};
ZmTagMenu.prototype.removeSelectionListener=function(e){
this._evtMgr.removeListener(DwtEvent.SELECTION,e)
};
ZmTagMenu.prototype.setEnabled=function(e){
this._desiredState=e;
if(e&&!this._tagList){
return
}
this.parent.setEnabled(e)
};
ZmTagMenu.prototype.set=function(e,t){
this._tagList=t;
this._items=e;
this._dirty=true;
this.parent.setEnabled(true);
if(this.parent instanceof DwtMenuItem){
this.parent.setHoverDelay(ZmTagMenu._HOVER_TIME)
}};
ZmTagMenu.prototype._doPopup=function(t,n,a){
if(this._dirty){
this.removeChildren();
if(this._tagList){
var o=this._tagList.root;
var e=this._getAddRemove(this._items,o);
this._render(o,e)
}
this._dirty=false;
if(this.parent instanceof DwtMenuItem){
this.parent.setHoverDelay(0)
}}
ZmPopupMenu.prototype._doPopup.call(this,t,n,a)
};
ZmTagMenu.prototype._getAddRemove=function(s,h){
var r={};
for(var n=0;
n<s.length;
n++){
var d=s[n];
if(!d){
continue
}
if(d.tags&&d.tags.length){
for(var t=0;
t<d.tags.length;
t++){
var e=d.tags[t];
r[e]=r[e]?r[e]+1:1
}}}
var c={};
var o={};
var l=h.children.getArray();
for(var n=0;
n<l.length;
n++){
var e=l[n].nId;
if(!r[e]||(r[e]<s.length)){
c[e]=true
}}
for(var e in r){
o[e]=true
}
return{
add:c,remove:o}
};
ZmTagMenu.prototype._render=function(h,l){
var r=h.size();
var d=h.children.getArray();
var s=[];
for(var o=0;
o<r;
o++){
var m=d[o];
var t=m.nId;
if(l.add[t]){
this._addNewTag(this,m,true,null,this._addHash)
}
if(l.remove[t]){
s.push(t)
}}
if(this._tagList.size()){
new DwtMenuItem({
parent:this,style:DwtMenuItem.SEPARATOR_STYLE}
)
}
var c=this._menuItems[ZmTagMenu.MENU_ITEM_ADD_ID]=new DwtMenuItem({
parent:this,id:this._htmlElId+"|NEWTAG"}
);
c.setText(AjxStringUtil.htmlEncode(ZmMsg.newTag));
c.setImage("NewTag");
c.setShortcut(appCtxt.getShortcutHint(this._keyMap,ZmKeyMap.NEW_TAG));
c.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_CREATE);
c.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0);
var u=this._menuItems[ZmTagMenu.MENU_ITEM_REM_ID]=new DwtMenuItem({
parent:this,id:this._htmlElId+"|REMOVETAG"}
);
u.setEnabled(false);
u.setText(AjxStringUtil.htmlEncode(ZmMsg.removeTag));
u.setImage("DeleteTag");
if(s.length>0){
u.setEnabled(true);
var e=null;
if(s.length>1){
for(o=0;
o<s.length;
o++){
if(!e){
e=new DwtMenu({
parent:u,className:this._className}
);
u.setMenu(e)
}
var m=h.getById(s[o]);
this._addNewTag(e,m,false,null,this._removeHash)
}}else{
if(s.length==1){
var m=h.getById(s[0]);
u.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_TAGS);
u.setData(ZmTagMenu.KEY_TAG_ADDED,false);
u.setData(Dwt.KEY_OBJECT,m);
u.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0)
}}
if(s.length>1){
new DwtMenuItem({
parent:e,style:DwtMenuItem.SEPARATOR_STYLE}
);
var n=new DwtMenuItem({
parent:e}
);
n.setText(ZmMsg.allTags);
n.setImage("TagStack");
n.setShortcut(appCtxt.getShortcutHint(this._keyMap,ZmKeyMap.UNTAG));
n.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_REMOVE_ALL);
n.setData(Dwt.KEY_OBJECT,s);
n.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0)
}}};
ZmTagMenu.tagNameLength=20;
ZmTagMenu.prototype._addNewTag=function(r,o,n,t,s){
var e=new DwtMenuItem({
parent:r,index:t}
);
var a=AjxStringUtil.clipByLength(o.getName(false),ZmTagMenu.tagNameLength);
e.setText(a);
e.setImage(o.getIconWithColor());
e.setData(ZmTagMenu.KEY_TAG_EVENT,ZmEvent.E_TAGS);
e.setData(ZmTagMenu.KEY_TAG_ADDED,n);
e.setData(Dwt.KEY_OBJECT,o);
e.addSelectionListener(new AjxListener(this,this._menuItemSelectionListener),0);
e.setShortcut(appCtxt.getShortcutHint(null,ZmKeyMap.TAG));
s[o.id]=e
};
ZmTagMenu.prototype._menuItemSelectionListener=function(e){
if(e.item.getData(ZmTagMenu.KEY_TAG_EVENT)){
this._evtMgr.notifyListeners(DwtEvent.SELECTION,e.item)
}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmListView")){
ZmListView=function(o){
if(arguments.length==0){
return
}
o.id=o.id||ZmId.getViewId(o.view);
DwtListView.call(this,o);
this.view=o.view;
this.type=o.type;
this._controller=o.controller;
this.setDropTarget(o.dropTgt);
this._listChangeListener=new AjxListener(this,this._changeListener);
this._tagListChangeListener=new AjxListener(this,this._tagChangeListener);
var a=appCtxt.getTagTree();
if(a){
a.addChangeListener(this._tagListChangeListener)
}
var t=appCtxt.getFolderTree();
if(t){
t.addChangeListener(new AjxListener(this,this._folderChangeListener))
}
this._handleEventType={};
this._handleEventType[this.type]=true;
this._disallowSelection={};
this._disallowSelection[ZmItem.F_FLAG]=true;
this._selectAllEnabled=false;
if(o.dropTgt){
var e={
container:this._parentEl,threshold:15,amount:5,interval:10,id:o.id};
this._dndScrollCallback=new AjxCallback(null,DwtControl._dndScrollCallback,[e]);
this._dndScrollId=o.id
}
this._isPageless=o.pageless;
if(this._isPageless){
Dwt.setHandler(this._getScrollDiv(),DwtEvent.ONSCROLL,ZmListView.handleScroll)
}
this._state={}
};
ZmListView.prototype=new DwtListView;
ZmListView.prototype.constructor=ZmListView;
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]="Icon";
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_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(n,a){
this._sortByString=this._controller._currentSearch&&this._controller._currentSearch.sortBy;
var o=appCtxt.getSettings();
if(this.view&&(o&&o.persistImplicitSortPrefs(this.view))){
appCtxt.set(ZmSetting.SORTING_PREF,this._sortByString,this.view)
}
this.setSelectionHdrCbox(false);
if(appCtxt.multiAccounts){
var s=appCtxt.getTagTree();
if(s){
s.addChangeListener(this._tagListChangeListener)
}}
if(this._isPageless){
if(this._itemsToAdd){
if(this._itemsToAdd.length){
this.addItems(this._itemsToAdd);
this._itemsToAdd=null
}}else{
var t=n;
if(n instanceof ZmList){
n.addChangeListener(this._listChangeListener);
t=n.getSubList(0,n.size())
}
DwtListView.prototype.set.call(this,t,a)
}
this._setRowHeight()
}else{
var e;
if(n instanceof ZmList){
n.addChangeListener(this._listChangeListener);
e=n.getSubList(this.offset,this.getLimit())
}else{
e=n
}
DwtListView.prototype.set.call(this,e,a)
}
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(e){
DwtListView.prototype.setUI.call(this,e);
this._resetColWidth()
};
ZmListView.prototype.getLimit=function(t){
if(this._isPageless){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
}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(u){
var f=this._getItemFromEvent(u);
if(!f||u.handled||!this._handleEventType[f.type]&&(this.type!=ZmItem.MIXED)){
return
}
if(u.event==ZmEvent.E_TAGS||u.event==ZmEvent.E_REMOVE_ALL){
this._setImage(f,ZmItem.F_TAG,f.getTagImageInfo())
}
if(u.event==ZmEvent.E_FLAGS){
var t=u.getDetail("flags");
for(var a=0;
a<t.length;
a++){
var c=t[a];
var r=f[ZmItem.FLAG_PROP[c]];
if(c==ZmItem.FLAG_FLAGGED){
this._setImage(f,ZmItem.F_FLAG,r?"FlagRed":"FlagDis")
}else{
if(c==ZmItem.FLAG_ATTACH){
this._setImage(f,ZmItem.F_ATTACHMENT,r?"Attachment":null)
}}}}
if(u.event==ZmEvent.E_DELETE||u.event==ZmEvent.E_MOVE){
var l=u.batchMode?this._getItemsFromBatchEvent(u):[f];
var d=false;
for(var o=0,s=l.length;
o<s;
o++){
var f=l[o];
var h=f.type==ZmId.ITEM_CONV?f.folders[this._folderId]:f.folderId==this._folderId;
if(h&&u.event==ZmEvent.E_MOVE){
if(this._getRowIndex(f)===null){
this.addItem(f);
d=true
}}else{
this.removeItem(f,true,u.batchMode);
var n=this.getItemList();
if(u.event!=ZmEvent.E_MOVE||!n.isCanonical){
n.remove(f)
}}}
if(d){
var e=Dwt.byId(this._currentColId);
var m=(e&&this.getItemFromElement(e))||(this._headerHash&&this._headerHash[ZmItem.F_SORTED_BY])||null;
if(m){
this._saveState({
scroll:true,selection:true,focus:true}
);
this._sortColumn(m,this._bSortAsc,new AjxCallback(this,this._restoreState))
}}
if(u.batchMode){
this._fixAlternation(0)
}
this._checkReplenishOnTimer();
this._controller._resetToolbarOperations()
}};
ZmListView.prototype._getItemFromEvent=function(a){
var t=a.item;
if(!t){
var e=a.getDetail("items");
t=(e&&e.length)?e[0]:null
}
return t
};
ZmListView.prototype._getItemsFromBatchEvent=function(n){
if(!n.batchMode){
return[]
}
var t=n.items;
if(!t){
t=[];
var s=n.getDetail("notifs");
if(s&&s.length){
for(var o=0,e=s.length;
o<e;
o++){
var a=s[o];
t.push(a.item||appCtxt.cacheGet(a.id))
}}}
return t
};
ZmListView.prototype._checkReplenishOnTimer=function(e){
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(){
var e=new AjxCallback(this,this._handleResponseCheckReplenish);
this._controller._checkReplenish(e)
};
ZmListView.prototype._handleResponseCheckReplenish=function(e){
if(this.size()==0){
this._controller._handleEmptyList(this)
}else{
this._controller._resetNavToolBarButtons(this._controller._getViewType())
}
if(!e){
this._setNextSelection()
}};
ZmListView.prototype._folderChangeListener=function(o){
if(appCtxt.getCurrentController()!=this._controller){
return
}
if(this._controller._app._checkReplenishListView==this){
return
}
var a=o.getDetail("organizers");
var t=(a&&a.length)?a[0].source;
var n=t.id;
var e=o.getDetail("fields");
if(o.event==ZmEvent.E_MODIFY){
if(!e){
return
}
if(e[ZmOrganizer.F_TOTAL]){
this._controller._resetNavToolBarButtons(this._controller._getViewType())
}}};
ZmListView.prototype._tagChangeListener=function(r){
if(r.type!=ZmEvent.S_TAG){
return
}
var t=r.getDetail("fields");
if(r.event==ZmEvent.E_MODIFY&&(t&&t[ZmOrganizer.F_COLOR])){
var n=this._getChildren();
var e=r.getDetail("organizers")[0];
for(var o=0;
o<n.length;
o++){
var s=this.getItemFromElement(n[o]);
if(s&&s.tags&&(s.tags.length==1)&&(s.tags[0]==e.id)){
this._setImage(s,ZmItem.F_TAG,s.getTagImageInfo())
}}}else{
if(r.event==ZmEvent.E_DELETE){
var n=this._getChildren();
var e=r.getDetail("organizers")[0];
for(var o=0;
o<n.length;
o++){
var s=this.getItemFromElement(n[o]);
var a=ZmOrganizer.normalizeId(e.id);
if(s&&s.tags&&s.hasTag(a)){
s.tagLocal(a,false);
this._setImage(s,ZmItem.F_TAG,s.getTagImageInfo())
}}}}};
ZmListView.prototype._getChildren=function(){
return this._parentEl.childNodes
};
ZmListView.prototype._getRowId=function(e){
return DwtId.getListViewItemId(DwtId.WIDGET_ITEM_FIELD,this._view,e?e.id:Dwt.getNextId(),ZmItem.F_ITEM_ROW)
};
ZmListView.prototype._getCellId=function(e,t){
if(t==ZmItem.F_DATE){
return this._getFieldId(e,t)
}else{
if(t==ZmItem.F_SELECTION){
return this._getFieldId(e,ZmItem.F_SELECTION_CELL)
}else{
return DwtListView.prototype._getCellId.apply(this,arguments)
}}};
ZmListView.prototype._getCellClass=function(e,t,a){
return ZmListView.FIELD_CLASS[t]
};
ZmListView.prototype._getCellContents=function(t,e,a,o,r,s){
if(o==ZmItem.F_SELECTION){
e=this._getImageHtml(t,e,"CheckboxUnchecked",this._getFieldId(a,o))
}else{
if(o==ZmItem.F_TYPE){
e=this._getImageHtml(t,e,ZmItem.ICON[a.type],this._getFieldId(a,o))
}else{
if(o==ZmItem.F_FLAG){
e=this._getImageHtml(t,e,this._getFlagIcon(a.isFlagged),this._getFieldId(a,o))
}else{
if(o==ZmItem.F_TAG){
e=this._getImageHtml(t,e,a.getTagImageInfo(),this._getFieldId(a,o))
}else{
if(o==ZmItem.F_ATTACHMENT){
e=this._getImageHtml(t,e,a.hasAttach?"Attachment":null,this._getFieldId(a,o))
}else{
if(o==ZmItem.F_DATE){
t[e++]=AjxDateUtil.computeDateStr(s.now||new Date(),a.date)
}else{
if(o==ZmItem.F_PRIORITY){
var n=null;
if(a.isHighPriority){
n="PriorityHigh_list"
}else{
if(a.isLowPriority){
n="PriorityLow_list"
}else{
n=""
}}
e=this._getImageHtml(t,e,n,this._getFieldId(a,o))
}else{
e=DwtListView.prototype._getCellContents.apply(this,arguments)
}}}}}}}
return e
};
ZmListView.prototype._getImageHtml=function(a,t,e,n){
e=e||"Blank_16";
var o=n?["id='",n,"'"].join(""):null;
a[t++]=AjxImg.getImageHtml(e,null,o);
return t
};
ZmListView.prototype._setImage=function(a,o,e){
var t=this._getElement(a,o);
if(t&&t.parentNode){
e=e||"Blank_16";
AjxImg.setImage(t.parentNode,e)
}};
ZmListView.prototype._getFragmentSpan=function(e){
return["<span class='ZmConvListFragment' id='",this._getFieldId(e,ZmItem.F_FRAGMENT),"'>",this._getFragmentHtml(e),"</span>"].join("")
};
ZmListView.prototype._getFragmentHtml=function(e){
return[" - ",AjxStringUtil.htmlEncode(e.fragment,true)].join("")
};
ZmListView.prototype._getFlagIcon=function(t,e){
return(t||e)?"FlagRed":"Blank_16"
};
ZmListView.prototype._parseId=function(t){
var e=t.split(DwtId.SEP);
if(e&&e.length){
return{
view:e[1],item:e[2],field:e[3],participant:e[4]}
}else{
return null
}};
ZmListView.prototype._mouseDownAction=function(e,t){
return !Dwt.ffScrollbarCheck(e)
};
ZmListView.prototype._mouseUpAction=function(e,t){
return !Dwt.ffScrollbarCheck(e)
};
ZmListView.prototype._getField=function(a,s){
var n=a.target.id||s.id;
if(!n){
return null
}
var o=this._data[s.id];
var t=o.type;
if(!t||t!=DwtListView.TYPE_LIST_ITEM){
return null
}
var e=this._parseId(n);
if(!e||!e.field){
return null
}
return e.field
};
ZmListView.prototype._mouseOutAction=function(t,o){
DwtListView.prototype._mouseOutAction.call(this,t,o);
var a=this._getField(t,o);
if(!a){
return true
}
if(a==ZmItem.F_FLAG){
var e=this.getItemFromElement(o);
if(!e.isFlagged){
AjxImg.setImage(t.target,this._getFlagIcon(e.isFlagged,false),true)
}}
return true
};
ZmListView.prototype._mouseOverAction=function(t,o){
DwtListView.prototype._mouseOverAction.call(this,t,o);
var a=this._getField(t,o);
if(!a){
return true
}
if(a==ZmItem.F_FLAG){
var e=this.getItemFromElement(o);
if(!e.isFlagged){
AjxImg.setDisabledImage(t.target,this._getFlagIcon(e.isFlagged,true),true)
}}
return true
};
ZmListView.prototype._doubleClickAction=function(t,o){
var a=t.target.id?t.target.id:o.id;
if(!a){
return true
}
var e=this._parseId(a);
return(!(e&&(e.field==ZmItem.F_FLAG)))
};
ZmListView.prototype._itemClicked=function(o,h){
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)&&h.button==DwtMouseEvent.LEFT){
if(!h.shiftKey&&!h.ctrlKey){
var t=(h.target.id&&h.target.id.indexOf("AjxImg")==-1)?h.target.id:o.id;
var n=t?this._parseId(t):null;
if(n&&(n.field==ZmItem.F_SELECTION||n.field==ZmItem.F_SELECTION_CELL)){
if(this._selectedItems.size()==1){
var a=this._selectedItems.get(0);
var d=this.getItemFromElement(a);
var l=d?this._getFieldId(d,ZmItem.F_SELECTION):null;
var c=l?document.getElementById(l):null;
if(c&&a==o){
var s=this._getItemData(a,ZmListView.ITEM_CHECKED_ATT_NAME);
var r=s?ZmListView.UNCHECKED_CLASS:ZmListView.CHECKED_CLASS;
c.className=r;
this._setItemData(a,ZmListView.ITEM_CHECKED_ATT_NAME,!s);
if(r==ZmListView.CHECKED_CLASS){
return
}}else{
if(c&&c.className==ZmListView.UNCHECKED_CLASS){
DwtListView.prototype.deselectAll.call(this)
}}}
var e=this._selectedItems.contains(o);
this.setMultiSelection(o,e);
return
}}else{
if(h.shiftKey){
this._checkSelectedItems(false);
DwtListView.prototype._itemClicked.call(this,o,h);
this._checkSelectedItems(true);
return
}}}
DwtListView.prototype._itemClicked.call(this,o,h)
};
ZmListView.prototype._columnClicked=function(t,e){
DwtListView.prototype._columnClicked.call(this,t,e);
this._checkSelectionColumnClicked(t,e)
};
ZmListView.prototype._checkSelectionColumnClicked=function(r,n){
if(!appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
return
}
var s=this.getList();
var a=s?s.size():null;
if(a>0){
var e=this._data[r.id].index;
var o=this._headerList[e];
if(o&&(o._field==ZmItem.F_SELECTION)){
var t=DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,o._field);
var h=document.getElementById(t);
if(h){
if(h.className==ZmListView.CHECKED_CLASS){
if(n.shiftKey&&!this.allSelected){
this.selectAll(n.shiftKey)
}else{
this.deselectAll();
h.className=ZmListView.UNCHECKED_CLASS
}}else{
this.allSelected=false;
h.className=ZmListView.CHECKED_CLASS;
this.selectAll(n.shiftKey)
}}}
this._controller._resetToolbarOperations()
}};
ZmListView.prototype.handleKeyAction=function(e,t){
var a=DwtListView.prototype.handleKeyAction.call(this,e,t);
if(e==DwtKeyMap.SELECT_ALL){
this._controller._resetToolbarOperations()
}
return a
};
ZmListView.prototype.setMultiSelection=function(e,a,t){
if(t&&t.ctrlKey&&this._selectedItems.size()==1){
this._checkSelectedItems(true)
}
DwtListView.prototype.setMultiSelection.call(this,e,a);
this.setSelectionCbox(e,a);
this.setSelectionHdrCbox(this._isAllChecked());
this._controller._resetToolbarOperations()
};
ZmListView.prototype._isAllChecked=function(){
return this.getSelection().length==this.getList().size()
};
ZmListView.prototype.setSelectionCbox=function(n,o){
if(!n){
return
}
var t=n.tagName?this.getItemFromElement(n):n;
var e=t?this._getFieldId(t,ZmItem.F_SELECTION):null;
var a=e?document.getElementById(e):null;
if(a){
a.className=o?ZmListView.UNCHECKED_CLASS:ZmListView.CHECKED_CLASS;
this._setItemData(n,ZmListView.ITEM_CHECKED_ATT_NAME,!o)
}};
ZmListView.prototype.setSelectionHdrCbox=function(t){
var a=this._headerHash?this._headerHash[ZmItem.F_SELECTION]:null;
var e=a?DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,a._field):null;
var o=e?document.getElementById(e):null;
if(o){
o.className=t?ZmListView.CHECKED_CLASS:ZmListView.UNCHECKED_CLASS
}};
ZmListView.prototype.setSelectedItems=function(t,e){
DwtListView.prototype.setSelectedItems.call(this,t);
if(!e&&appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
this._checkSelectedItems(true,true)
}};
ZmListView.prototype.selectAll=function(e){
DwtListView.prototype.selectAll.apply(this,arguments);
if(this._selectAllEnabled){
var n=this._controller._activeSearch;
if(n&&n.getAttribute("more")){
var a=AjxMessageFormat.format(ZmMsg.allPageSelected,this.getList().size());
if(e){
this.allSelected=true;
a=ZmMsg.allSearchSelected
}
appCtxt.setStatusMsg(a)
}
var o=this._selectedItems.getArray();
for(var t=0;
t<o.length;
t++){
this.setSelectionCbox(o[t],false)
}}};
ZmListView.prototype.deselectAll=function(){
this.allSelected=false;
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
this._checkSelectedItems(false);
var e=DwtId.getListViewHdrId(DwtId.WIDGET_HDR_ICON,this._view,ZmItem.F_SELECTION);
var o=document.getElementById(e);
if(o){
o.className=ZmListView.UNCHECKED_CLASS
}
var a=this._selectedItems.getArray();
for(var t=0;
t<a.length;
t++){
this.setSelectionCbox(a[t],true)
}}
DwtListView.prototype.deselectAll.call(this)
};
ZmListView.prototype._checkSelectedItems=function(e){
var n=this.getSelection();
for(var a=0;
a<n.length;
a++){
this.setSelectionCbox(n[a],!e)
}
var o=this.getList();
var t=o&&o.size();
this.setSelectionHdrCbox(t&&n.length==t)
};
ZmListView.prototype._setNoResultsHtml=function(){
DwtListView.prototype._setNoResultsHtml.call(this);
this.setSelectionHdrCbox(false);
this._rendered=true
};
ZmListView.prototype._getSortMenu=function(o,h){
var r=new ZmPopupMenu(this);
var s=new AjxListener(this,this._colHeaderActionListener);
for(var a=0;
a<o.length;
a++){
var n=o[a];
var t=AjxMessageFormat.format(ZmMsg.arrangedBy,ZmMsg[n.msg]);
var e=r.createMenuItem(n.field,{
text:t,style:DwtMenuItem.RADIO_STYLE}
);
if(n.field==h){
e.setChecked(true,true)
}
e.setData(ZmListView.KEY_ID,n.field);
r.addSelectionListener(n.field,s)
}
return r
};
ZmListView.prototype._sortMenuListener=function(a){
var t=this._headerHash[ZmItem.F_SORTED_BY];
var e=document.getElementById(DwtId.getListViewHdrId(DwtId.WIDGET_HDR_LABEL,this._view,t._field));
if(e){
e.innerHTML=a.item.getText()
}
t._sortable=a.item.getData(ZmListView.KEY_ID);
this._sortColumn(t,this._bSortAsc)
};
ZmListView.prototype._getActionMenuForColHeader=function(o){
if(!this._colHeaderActionMenu||o){
this._colHeaderActionMenu=new ZmPopupMenu(this);
var n=new AjxListener(this,this._colHeaderActionListener);
for(var t=0;
t<this._headerList.length;
t++){
var a=this._headerList[t];
if(a._width){
var e=this._colHeaderActionMenu.createMenuItem(a._id,{
text:a._name,style:DwtMenuItem.CHECK_STYLE}
);
e.setData(ZmListView.KEY_ID,a._id);
e.setChecked(a._visible,true);
if(a._noRemove){
e.setEnabled(false)
}
this._colHeaderActionMenu.addSelectionListener(a._id,n)
}}}
return this._colHeaderActionMenu
};
ZmListView.prototype._colHeaderActionListener=function(a){
var o=a.item.getData(ZmListView.KEY_ID);
for(var t=0;
t<this._headerList.length;
t++){
var e=this._headerList[t];
if(e._id==o){
e._visible=!e._visible;
break
}}
this._relayout()
};
ZmListView.prototype.getToolTipContent=function(h){
var e=this.getTargetItemDiv(h);
if(!e){
return
}
var a=h.target.id||e.id;
if(!a){
return""
}
var n=this._data[e.id];
var r=n.type;
var d;
if(r&&r==DwtListView.TYPE_HEADER_ITEM){
var t=n.index;
var l=this._headerList[t]._field;
d=this._getHeaderToolTip(l,t)
}else{
var s=this._parseId(a);
if(s&&s.field){
var c=this.getItemFromElement(e);
var o={
field:s.field,item:c,ev:h,div:e,match:s};
d=this._getToolTip(o)
}}
return d
};
ZmListView.prototype._getHeaderToolTip=function(a,e,n){
var t=null;
var o=this._headerList[e]._sortable;
if(a==ZmItem.F_SELECTION){
t=ZmMsg.selectionColumn
}else{
if(a==ZmItem.F_FLAG){
t=ZmMsg.flagHeaderToolTip
}else{
if(a==ZmItem.F_PRIORITY){
t=ZmMsg.priority
}else{
if(a==ZmItem.F_TAG){
t=ZmMsg.tag
}else{
if(a==ZmItem.F_ATTACHMENT){
t=ZmMsg.attachmentHeaderToolTip
}else{
if(a==ZmItem.F_SUBJECT){
t=o?ZmMsg.sortBySubject:ZmMsg.subject
}else{
if(a==ZmItem.F_DATE){
if(o){
if(n){
t=(this._folderId==ZmFolder.ID_DRAFTS)?ZmMsg.sortByLastSaved:ZmMsg.sortBySent
}else{
t=ZmMsg.sortByReceived
}}else{
t=ZmMsg.date
}}else{
if(a==ZmItem.F_FROM){
t=o?n?ZmMsg.sortByTo:ZmMsg.sortByFrom:n?ZmMsg.to:ZmMsg.from
}else{
if(a==ZmItem.F_SIZE){
t=o?ZmMsg.sortBySize:ZmMsg.sizeToolTip
}else{
if(a==ZmItem.F_ACCOUNT){
t=ZmMsg.account
}else{
if(a==ZmItem.F_FOLDER){
t=ZmMsg.folder
}}}}}}}}}}}
return t
};
ZmListView.prototype._getToolTip=function(n){
var t,o=n.field,a=n.ev.target,e=n.item;
if(o==ZmItem.F_FLAG){
return null
}else{
if(o==ZmItem.F_PRIORITY){
if(e.isHighPriority){
t=ZmMsg.highPriorityTooltip
}else{
if(e.isLowPriority){
t=ZmMsg.lowPriorityTooltip
}}}else{
if(o==ZmItem.F_TAG){
t=this._getTagToolTip(e)
}else{
if(o==ZmItem.F_ATTACHMENT){}else{
if(o==ZmItem.F_DATE){
t=this._getDateToolTip(e,n.div)
}}}}}
return t
};
ZmListView.prototype._getTagToolTip=function(r){
if(!r){
return
}
var o=r.tags&&r.tags.length;
if(!o){
return
}
var a=appCtxt.multiAccounts?r.getAccount():null;
var n=appCtxt.getTagTree(a);
var l=r.tags;
var t=[];
var s=0;
for(var e=0;
e<o;
e++){
var h=n.getById(l[e]);
if(!h){
continue
}
t[s++]="<table><tr><td>";
t[s++]=AjxImg.getImageHtml(h.getIconWithColor());
t[s++]="</td><td valign='middle'>";
t[s++]=AjxStringUtil.htmlEncode(h.name);
t[s++]="</td></tr></table>"
}
return t.join("")
};
ZmListView.prototype._getAttachmentToolTip=function(e){
var t=null;
var o=e&&e.attachments?e.attachments:[];
if(o.length==1){
var a=ZmMimeTable.getInfo(o[0].ct);
t=a?a.desc:null
}else{
if(o.length>1){
t=AjxMessageFormat.format(ZmMsg.multipleAttachmentsTooltip,[o.length])
}}
return t
};
ZmListView.prototype._getDateToolTip=function(e,t){
t._dateStr=t._dateStr||this._getDateToolTipText(e.date);
return t._dateStr
};
ZmListView.prototype._getDateToolTipText=function(t,n){
if(!t){
return""
}
var e=[];
var a=0;
e[a++]=n;
var o=AjxDateFormat.getDateTimeInstance(AjxDateFormat.FULL,AjxDateFormat.MEDIUM);
e[a++]=o.format(new Date(t));
var s=AjxDateUtil.computeDateDelta(t);
if(s){
e[a++]="<br><center><span style='white-space:nowrap'>(";
e[a++]=s;
e[a++]=")</span></center>"
}
return e.join("")
};
ZmListView.prototype._setListEvent=function(o,n,t){
DwtListView.prototype._setListEvent.call(this,o,n,t);
var s=(o.target.id&&o.target.id.indexOf("AjxImg")==-1)?o.target.id:t.id;
if(!s){
return false
}
var e=this._parseId(s);
if(o.button==DwtMouseEvent.LEFT){
this._selEv.field=e?e.field:null
}else{
if(o.button==DwtMouseEvent.RIGHT){
this._actionEv.field=e?e.field:null;
if(e&&e.field){
if(e.field==ZmItem.F_PARTICIPANT){
var a=this.getItemFromElement(t);
this._actionEv.detail=a.participants?a.participants.get(e.participant):null
}}}}
return true
};
ZmListView.prototype._allowLeftSelection=function(o,n,t){
if(!(n instanceof DwtMouseEvent)){
return true
}
var r=(n.target.id&&n.target.id.indexOf("AjxImg")==-1)?n.target.id:o.id;
var s=this._data[o.id];
var a=s.type;
if(r&&a&&a==DwtListView.TYPE_LIST_ITEM){
var e=this._parseId(r);
if(e&&e.field){
return this._allowFieldSelection(e.item,e.field)
}}
return true
};
ZmListView.prototype._allowFieldSelection=function(t,e){
return(!this._disallowSelection[e])
};
ZmListView.prototype._sortColumn=function(e,t,o){
var a;
switch(e._sortable){
case ZmItem.F_FROM:a=t?ZmSearch.NAME_ASC:ZmSearch.NAME_DESC;
break;
case ZmItem.F_NAME:a=t?ZmSearch.SUBJ_ASC:ZmSearch.SUBJ_DESC;
break;
case ZmItem.F_SUBJECT:a=t?ZmSearch.SUBJ_ASC:ZmSearch.SUBJ_DESC;
break;
case ZmItem.F_DATE:a=t?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC;
break;
case ZmItem.F_SIZE:a=t?ZmSearch.SIZE_ASC:ZmSearch.SIZE_DESC;
break;
case ZmItem.F_SORTED_BY:a=t?ZmSearch.DATE_ASC:ZmSearch.DATE_DESC;
break
}
if(a){
this._sortByString=a;
appCtxt.set(ZmSetting.SORTING_PREF,a,this.view)
}
if(o){
o.run()
}};
ZmListView.prototype._setNextSelection=function(){
if(this.firstSelIndex<0){
this.firstSelIndex=0
}
var e;
if(this._list){
e=this._list.get(this.firstSelIndex)||this._list.getLast()
}
if(e){
this.setSelection(e,false)
}};
ZmListView.prototype._relayout=function(){
DwtListView.prototype._relayout.call(this);
this._checkColumns()
};
ZmListView.prototype._checkColumns=function(){
var o=this._headerList.length;
var e=[];
for(var t=0;
t<o;
t++){
var n=this._headerList[t];
if(n&&n._field!=ZmItem.F_ACCOUNT){
e.push(n._field+(n._visible?"":"*"))
}}
var a=e.join(ZmListView.COL_JOIN);
a=(a==this._defaultCols)?"":a;
appCtxt.set(ZmSetting.LIST_VIEW_COLUMNS,a,this.view);
this._getActionMenuForColHeader(true)
};
ZmListView.handleScroll=function(e){
var t=DwtUiEvent.getTarget(e);
var a=DwtControl.findControl(t);
if(a){
a._checkItemCount()
}};
ZmListView.prototype._checkItemCount=function(){
var e=this._getItemsNeeded();
if(e){
this._controller._paginate(this._view,true,null,e)
}};
ZmListView.prototype._getItemsNeeded=function(o){
if(!o){
var e=this.getItemList();
if(!(e&&e.hasMore())||!this._list){
return 0
}}
if(!this._rendered||!this._rowHeight){
return 0
}
var t=new AjxCallback(null,AjxTimedAction.scheduleAction,[new AjxTimedAction(this,this._resetColWidth),100]);
var a={
scrollDiv:this._getScrollDiv(),rowHeight:this._rowHeight,threshold:this.getPagelessThreshold(),limit:this.getLimit(1),listSize:this._list.size(),sbCallback:t};
return ZmListView.getRowsNeeded(a)
};
ZmListView.prototype._getScrollDiv=function(){
return this._parentEl
};
ZmListView.getRowsNeeded=function(a){
var t=a.scrollDiv;
var n=t.scrollHeight,c=t.scrollTop,r=a.rowHeight;
var o=t.clientHeight||Dwt.getSize(t).y;
var s=o+(a.threshold*r);
var e=n-c;
if(e==o){
e=(a.listSize*r)-c;
if(c==0&&a.sbCallback){
a.sbCallback.run()
}}
var l=0;
if(e<s){
l=Math.max(Math.floor((s-e)/r),a.limit)
}
return l
};
ZmListView.prototype._sizeChildren=function(e){
if(DwtListView.prototype._sizeChildren.apply(this,arguments)){
this._checkItemCount()
}};
ZmListView.prototype._getItemCountType=function(){
return this.type
};
ZmListView.prototype.hasItem=function(n){
var s=(typeof n=="string")?n:n&&n.id;
if(s&&this._list){
var t=this._list.getArray();
for(var o=0,e=t.length;
o<e;
o++){
var n=t[o];
if(n&&n.id==s){
return true
}}}
return false
};
ZmListView.prototype._saveState=function(a){
var t=this._state={};
a=a||{};
if(a.selection){
t.selected=this.getSelection();
if(t.selected.length==1){
var e=this._getElFromItem(t.selected[0]);
t.singleItemChecked=this._getItemData(e,ZmListView.ITEM_CHECKED_ATT_NAME)
}}
if(a.focus){
t.focused=this.hasFocus();
t.anchorItem=this._kbAnchor&&this.getItemFromElement(this._kbAnchor)
}
if(a.scroll){
t.rowHeight=this._rowHeight;
t.scrollTop=this._listDiv.scrollTop
}};
ZmListView.prototype._restoreState=function(){
var a=this._state;
if(a.selected&&a.selected.length){
var t=a.selected.length==1&&!a.singleItemChecked;
this.setSelectedItems(a.selected,t)
}
if(a.anchorItem){
var e=this._getElFromItem(a.anchorItem);
if(e){
this._setKbFocusElement(e)
}}
if(a.focused){
this.focus()
}
if(a.rowHeight){
this._listDiv.scrollTop=a.scrollTop*(this._rowHeight/a.rowHeight)
}
this._state={}
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmAppChooser")){
ZmAppChooser=function(a){
a.className=a.className||"ZmAppChooser";
a.width=appCtxt.getSkinHint("appChooser","fullWidth")?"100%":null;
ZmToolBar.call(this,a);
Dwt.setLocation(this.getHtmlElement(),Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE);
this.setScrollStyle(Dwt.CLIP);
this._buttonListener=new AjxListener(this,this._handleButton);
var t=a.buttons;
for(var e=0;
e<t.length;
e++){
var o=t[e];
if(o==ZmAppChooser.SPACER){
this.addSpacer(ZmAppChooser.SPACER_HEIGHT)
}else{
this._createButton(o)
}}
this._createPrecedenceList();
this._inited=true
};
ZmAppChooser.prototype=new ZmToolBar;
ZmAppChooser.prototype.constructor=ZmAppChooser;
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(e){
this.addListener(DwtEvent.SELECTION,e)
};
ZmAppChooser.prototype.addButton=function(o,a){
var t={
parent:this,id:ZmId.getButtonId(ZmId.APP,o),text:a.text,image:a.image,index:a.index};
var e=new ZmAppButton(t);
e.setToolTipContent(a.tooltip);
e.textPrecedence=a.textPrecedence;
e.imagePrecedence=a.imagePrecedence;
e.setData(Dwt.KEY_ID,o);
e.addSelectionListener(this._buttonListener);
this._buttons[o]=e;
if(e.textPrecedence||e.imagePrecedence){
this._createPrecedenceList()
}
this.adjustSize();
return e
};
ZmAppChooser.prototype.removeButton=function(a){
var t=this._buttons[a];
if(t){
var e=this.__getButtonIndex(a);
t.dispose();
this._buttons[a]=null;
delete this._buttons[a];
if(e!=null){
this._removeItem(this._items[e])
}}};
ZmAppChooser.prototype.replaceButton=function(a,e,t){
if(!this._buttons[a]){
return
}
t.index=this.__getButtonIndex(a);
this.removeButton(a);
return this.addButton(e,t)
};
ZmAppChooser.prototype.getButton=function(e){
return this._buttons[e]
};
ZmAppChooser.prototype.setSelected=function(a){
var e=this._buttons[this._selectedId];
if(this._selectedId&&e){
this.__markPrevNext(this._selectedId,false);
e.setSelected(false);
e._noFocus=false
}
var t=this._buttons[a];
if(t){
t.setSelected(true);
if(t._toggleText!=null&&t._toggleText!=""){
if(e){
e._toggleText=(e._toggleText!=null&&e._toggleText!="")?e._toggleText:e.getText();
e.setText("")
}
t.setText(t._toggleText);
t._toggleText=null
}
t._noFocus=true
}
this._selectedId=a
};
ZmAppChooser.prototype._createButton=function(e){
this.addButton(e,{
text:ZmMsg[ZmApp.NAME[e]],image:ZmApp.ICON[e],tooltip:ZmMsg[ZmApp.CHOOSER_TOOLTIP[e]],textPrecedence:ZmApp.TEXT_PRECEDENCE[e],imagePrecedence:ZmApp.IMAGE_PRECEDENCE[e]}
)
};
ZmAppChooser.prototype._handleButton=function(e){
this.notifyListeners(DwtEvent.SELECTION,e)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmAppButton")){
ZmAppButton=function(e){
if(arguments.length==0){
return
}
e.style=DwtLabel.IMAGE_LEFT;
e.posStyle=DwtControl.RELATIVE_STYLE;
DwtButton.call(this,e);
this.setImage(e.image);
this.setText(e.text)
};
ZmAppButton.prototype=new DwtButton;
ZmAppButton.prototype.constructor=ZmAppButton;
ZmAppButton.prototype.toString=function(){
return"ZmAppButton"
};
ZmAppButton.prototype.TEMPLATE="share.Widgets#ZmAppChooserButton";
ZmAppButton.prototype.setSelected=function(e){
this.isSelected=e;
this.setDisplayState(e?DwtControl.SELECTED:DwtControl.NORMAL)
};
ZmAppButton.prototype.setDisplayState=function(e){
if(this.isSelected&&e!=DwtControl.SELECTED){
e=[DwtControl.SELECTED,e].join(" ")
}
DwtButton.prototype.setDisplayState.call(this,e)
};
ZmAppButton.prototype.getKeyMapName=function(){
return"ZmAppButton"
};
ZmAppButton.prototype.handleKeyAction=function(e,t){
switch(e){
case DwtKeyMap.SELECT:if(this.isListenerRegistered(DwtEvent.SELECTION)){
var a=DwtShell.selectionEvent;
a.item=this;
this.notifyListeners(DwtEvent.SELECTION,a)
}
break;
default:return false
}
return true
};
ZmAppButton.prototype._focus=function(){
this.setDisplayState(DwtControl.HOVER)
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmStatusView")){
ZmStatusView=function(a,t,e,o){
DwtControl.call(this,{
parent:a,className:(t||"ZmStatus"),posStyle:e,id:o}
);
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(a){
a=Dwt.getParams(arguments,ZmStatusView.MSG_PARAMS);
if(typeof a=="string"){
a={
msg:a}
}
var e={
msg:a.msg,level:a.level||ZmStatusView.LEVEL_INFO,detail:a.detail,date:new Date(),transitions:a.transitions,toast:a.toast||this._standardToast,dismissCallback:(a.dismissCallback instanceof AjxCallback)?a.dismissCallback:null,finishCallback:(a.finishCallback instanceof AjxCallback)?a.finishCallback:null,dismissed:false};
if(a.force){
for(var t=0;
t<this._statusQueue.length;
t++){
this._statusQueue[t].dismissed=true
}}
this._statusQueue.push(e);
if(!this._toast.isPoppedUp()){
this._updateStatusMsg()
}else{
if(a.force){
this.dismissStatusMsg()
}}};
ZmStatusView.prototype.nextStatus=function(){
if(this._statusQueue.length>0){
this._updateStatusMsg();
return true
}
return false
};
ZmStatusView.prototype.dismissStatusMsg=function(t){
if(t){
for(var e=0;
e<this._statusQueue.length;
e++){
this._statusQueue[e].dismissed=true
}}
this._toast.dismiss()
};
ZmStatusView.getClass=function(e){
switch(e.level){
case ZmStatusView.LEVEL_CRITICAL:return"ZToastCrit";
case ZmStatusView.LEVEL_WARNING:return"ZToastWarn";
default:return"ZToastInfo"
}};
ZmStatusView.getImageHtml=function(e){
switch(e.level){
case ZmStatusView.LEVEL_CRITICAL:return"Critical";
case ZmStatusView.LEVEL_WARNING:return"Warning";
default:return"Success"
}};
ZmStatusView.prototype._updateStatusMsg=function(){
var e=this._statusQueue.shift();
if(!e){
return
}
if(e.dismissed){
if(e.dismissCallback){
e.dismissCallback.run()
}
this.nextStatus()
}else{
var a=ZmStatusView.getClass(e);
var t=ZmStatusView.getImageHtml(e);
this._toast=e.toast;
this._toast.popup(a,e.msg,t,null,e.transitions,e.dismissCallback,e.finishCallback)
}};
ZmToast=function(e,t){
if(arguments.length==0){
return
}
DwtComposite.call(this,{
parent:e.shell,className:"ZToast",posStyle:Dwt.ABSOLUTE_STYLE,id:t}
);
this._statusView=e;
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.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=/(ZToastCrit|ZToastWarn|ZToastInfo)/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(e,l,s,n,o,a,c){
this.__clear();
this._poppedUp=true;
this._dismissed=false;
this._dismissCallback=a;
this._finishCallback=c;
var t=this.getHtmlElement();
Dwt.delClass(t,ZmToast.LEVEL_RE,e||"ZToastInfo");
if(this._textEl){
this._textEl.innerHTML=l||""
}
if(this._iconEl){
AjxImg.setImage(this._iconEl,s,false)
}
var h=appCtxt.getSkinHint("toast","location")||n;
var r=o||appCtxt.getSkinHint("toast","transitions")||ZmToast.DEFAULT_TRANSITIONS;
r=[].concat({
type:"position",location:h}
,r,{
type:"hide"}
);
this._transitions=r;
this.transition()
};
ZmToast.prototype.popdown=function(){
this.__clear();
Dwt.setLocation(this.getHtmlElement(),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 a=this._transitions&&this._transitions.shift();
if(!a){
this._poppedUp=false;
if(!this._statusView.nextStatus()){
this.popdown()
}
return
}
var t=this._state=this._createState(a);
var e=this.getHtmlElement();
Dwt.setLocation(e,t.x,t.y);
this._funcs[a.type||"next"]()
};
ZmToast.prototype._createHtml=function(e){
var t={
id:this._htmlElId};
this._createHtmlFromTemplate(e||this.TEMPLATE,t);
Dwt.setZIndex(this.getHtmlElement(),Dwt.Z_TOAST)
};
ZmToast.prototype._createHtmlFromTemplate=function(e,t){
DwtComposite.prototype._createHtmlFromTemplate.call(this,e,t);
this._textEl=document.getElementById(t.id+"_text");
this._iconEl=document.getElementById(t.id+"_icon");
this._detailEl=document.getElementById(t.id+"_detail")
};
ZmToast.prototype._createState=function(n){
var a=AjxUtil.createProxy(n);
var o=ZmToast.DEFAULT_STATE[a.type];
for(var e in o){
if(!a[e]){
a[e]=o[e]
}}
var t=this.getHtmlElement();
switch(a.type){
case"fade-in":Dwt.setOpacity(t,0);
Dwt.setLocation(t,null,0);
a.value=a.start;
break;
case"fade-out":case"fade":Dwt.setLocation(t,null,0);
a.value=a.start;
break;
case"slide-in":case"slide-out":case"slide":Dwt.setLocation(t,null,-36);
Dwt.setOpacity(t,100);
a.value=a.start;
break
}
return a
};
ZmToast.prototype.__clear=function(){
clearTimeout(this._actionId);
clearInterval(this._actionId);
this._actionId=-1
};
ZmToast.prototype.__position=function(){
var h=this._state.location||"C";
var n="skin_container_toast";
var t=this.getHtmlElement();
var e=Dwt.byId(n)||this.shell.getHtmlElement();
var o=Dwt.getSize(e);
var l=Dwt.getSize(t);
var r=(o.x-l.x)/2;
var s=(o.y-l.y)/2;
switch(h.toUpperCase()){
case"N":s=0-l.y;
break;
case"S":s=o.y-l.y;
break;
case"E":r=o.x-l.x;
break;
case"W":r=0;
break;
case"NE":r=o.x-l.x;
s=0;
break;
case"NW":r=0;
s=0;
break;
case"SE":r=o.x-l.x;
s=o.y-l.y;
break;
case"SW":r=0;
s=o.y-l.y;
break;
case"C":default:break
}
var a=Dwt.toWindow(e);
r+=a.x;
s+=a.y;
Dwt.setLocation(t,r,s);
this._funcs.next()
};
ZmToast.prototype.__show=function(){
var e=this.getHtmlElement();
Dwt.setVisible(e,true);
Dwt.setVisibility(e,true);
this._funcs.next()
};
ZmToast.prototype.__hide=function(){
var e=this.getHtmlElement();
Dwt.setLocation(e,Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE);
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(e){
return AjxUtil.indexOf(ZmToast.DISMISSABLE_STATES,e)!=-1
};
ZmToast.prototype.dismiss=function(){
if(!this._dismissed&&this._poppedUp){
var e=(this._pauseTimer&&ZmToast.__mayDismiss(ZmToast.PAUSE))||(this._held&&ZmToast.__mayDismiss(ZmToast.HOLD));
if(e){
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(e){
if(!e){
this.transition();
this._idleTimer.kill()
}};
ZmToast.prototype.__move=function(){
this._funcs.next()
};
ZmToast.prototype.__fade=function(){
var t=this._state.value;
var o=this._state.step;
if(AjxEnv.isIE){
if(AjxEnv.isIE5_5up){
try{
var a=this.getHtmlElement();
a.style.visibility=o>0?"hidden":"visible";
var s=this._state.duration/1000;
a.style.filter="progid:DXImageTransform.Microsoft.Fade(duration="+s+",overlap=1.0)";
a.filters[0].Apply();
a.style.visibility=o>0?"visible":"hidden";
a.filters[0].Play()
}
catch(n){}}
setTimeout(this._funcs.next,0);
return
}
var r=o>0?t>=this._state.end:t<=this._state.end;
if(r){
t=this._state.end
}
var a=this.getHtmlElement();
Dwt.setOpacity(a,t);
if(r){
this.__clear();
setTimeout(this._funcs.next,0);
return
}
if(this._actionId==-1){
var s=this._state.duration;
var h=s/Math.abs(o);
this._actionId=setInterval(this._funcs.fade,h)
}
this._state.value+=o;
this._state.step*=this._state.multiplier
};
ZmToast.prototype.__slide=function(){
var o=this._state.value;
var t=this._state.step;
var n=t>0?o>=this._state.end:o<=this._state.end;
if(n){
o=this._state.end
}
var e=this.getHtmlElement();
Dwt.setLocation(e,null,o);
if(n){
this.__clear();
setTimeout(this._funcs.next,0);
return
}
if(this._actionId==-1){
var a=this._state.duration;
var s=a/Math.abs(t);
this._actionId=setInterval(this._funcs.slide,s)
}
this._state.value+=t;
this._state.step*=this._state.multiplier
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmOverviewContainer")){
ZmOverviewContainer=function(e){
if(arguments.length==0){
return
}
e.className=e.className||"ZmOverviewContainer";
e.id=e.id||ZmId.getOverviewContainerId(e.containerId);
DwtTree.call(this,e);
this.setScrollStyle(e.scroll||Dwt.SCROLL_Y);
this.containerId=e.containerId;
this._appName=e.appName;
this._controller=e.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(e){};
ZmOverviewContainer.prototype.getOverview=function(e){
return this._overview[e]
};
ZmOverviewContainer.prototype.getOverviews=function(){
return this._overview
};
ZmOverviewContainer.prototype.getHeaderItem=function(){};
ZmOverviewContainer.prototype.getSelected=function(){
var t;
for(var e in this._overview){
t=this._overview[e].getSelected();
if(t){
return t
}}};
ZmOverviewContainer.prototype.deselectAll=function(e){
DwtTree.prototype.deselectAll.call(this);
this._deselectAllTreeViews(e)
};
ZmOverviewContainer.prototype.setOverviewTrees=function(e){
for(var t in this._overview){
this._overview[t].set(e)
}};
ZmOverviewContainer.prototype.resetOperations=function(t,e){};
ZmOverviewContainer.prototype._treeViewListener=function(e){};
ZmOverviewContainer.prototype._treeListener=function(e){};
ZmOverviewContainer.prototype._initializeActionMenu=function(e){};
ZmOverviewContainer.prototype._getActionMenu=function(e){
if(this._actionMenu instanceof AjxCallback){
var t=this._actionMenu;
this._actionMenu=t.run()
}
return this._actionMenu
};
ZmOverviewContainer.prototype._createActionMenu=function(t,e,a){};
ZmOverviewContainer.prototype._actionMenuListener=function(e){};
ZmOverviewContainer.prototype._deselectAllTreeViews=function(o){
for(var a in this._overview){
var n=this._overview[a];
if(o&&o==n){
continue
}
var t=n._treeHash;
for(var e in t){
if(t[e].getSelectionCount()>0){
t[e].deselectAll();
break
}}}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmAccountOverviewContainer")){
ZmAccountOverviewContainer=function(t){
if(arguments.length==0){
return
}
ZmOverviewContainer.call(this,t);
this._vFolderTreeItemMap={};
this._settingChangeListener=new AjxListener(this,this._handleSettingChange);
var e=new AjxListener(this,this._mouseListener);
this.addListener(DwtEvent.ONMOUSEDOWN,e);
this.addListener(DwtEvent.ONMOUSEUP,e)
};
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(e){
return e&&this._headerItems[e.id]
};
ZmAccountOverviewContainer.prototype.expandAccountOnly=function(t){
if(!t){
t=appCtxt.getActiveAccount()
}
for(var e in this._headerItems){
this._headerItems[e].setExpanded((e==t.id),false,false)
}};
ZmAccountOverviewContainer.prototype.getSelected=function(){
var t=ZmOverviewContainer.prototype.getSelected.call(this);
if(!t){
t=this.getSelection()[0];
var a=t&&appCtxt.accountList.getAccount(t.getData(Dwt.KEY_ID));
var e=a&&appCtxt.getFolderTree(a);
return e&&e.root
}
return t
};
ZmAccountOverviewContainer.prototype.initialize=function(C){
var j,d;
var c=appCtxt.accountList.visibleAccounts;
var w=(appCtxt.isOffline&&this._appName==ZmApp.MAIL&&(c.length>2));
var f=w;
var n=appCtxt.accountList.mainAccount;
var W=C.omit;
for(var z=0;
z<c.length;
z++){
d=c[z];
if(appCtxt.isOffline&&d.isMain&&this._appName!=ZmApp.PREFERENCES){
continue
}
if(!d.active){
continue
}
C.omit={};
if(d.type==ZmAccount.TYPE_POP){
C.omit[ZmFolder.ID_SPAM]=true;
C.omit[ZmFolder.ID_OUTBOX]=true
}
if(C.overviewId&&!C.isAppOverview){
var y=C.overviewId.split(":")[1];
if(y&&(y=="ZmNewOrganizerDialog")){
C.omit[ZmFolder.ID_DRAFTS]=true
}}
if(this._appName==ZmApp.CALENDAR){
C.selectable=false
}
this._addAccount(C,d,f,null,"account"+z);
j=this.getHeaderItem(d);
if(j){
this._setupHeader(j,d)
}
this.updateAccountInfo(d,true,true);
f=!f
}
v=W&&W[ZmOrganizer.ID_ALL_MAILBOXES];
if(w&&!v){
var u=ZmMsg[ZmFolder.MSG_KEY[ZmOrganizer.ID_ALL_MAILBOXES]];
var s=appCtxt.get(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN)?u:this._getFolderLabel(ZmOrganizer.ID_INBOX,u);
var O={
parent:this,text:s,imageInfo:"AccountAll"};
var g=appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES);
var o=this._allMailboxesTreeHeader=new DwtTreeItem(O);
o.setData(Dwt.KEY_ID,ZmOrganizer.ID_ALL_MAILBOXES);
o.addClassName("ZmOverviewGlobalInbox");
o._initialize(0,true);
o.setVisible(g);
o.__origText=u;
if(g){
this.highlightAllMboxes()
}
var b=appCtxt.getSettings(n).getSetting(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES);
b.addChangeListener(this._settingChangeListener);
var A=ZmAccountOverviewContainer.VIRTUAL_FOLDERS;
for(var z=0;
z<A.length;
z++){
var e=A[z];
O={
parent:o,text:this._getFolderLabel(e,ZmMsg[ZmFolder.MSG_KEY[e]]),imageInfo:ZmFolder.ICON[e]};
var r=this._vFolderTreeItemMap[e]=new DwtTreeItem(O);
r.setData(Dwt.KEY_ID,e);
r.addClassName("DwtTreeItemChildDiv");
r._initialize(null,true);
r.setToolTipContent(appCtxt.accountList.getTooltipForVirtualFolder(e))
}
O={
parent:o,text:ZmMsg.globalSearches,imageInfo:"SearchFolder",selectable:false};
var x=this._searchTreeHeader=new DwtTreeItem(O);
x.addClassName("DwtTreeItemChildDiv");
x._initialize(null,true);
x.__isSearch=true;
var k=appCtxt.getById(ZmOrganizer.ID_ROOT,n);
var m=k.getByType(ZmOrganizer.SEARCH);
for(var z=0;
z<m.length;
z++){
var l=m[z];
if(l.id!=ZmOrganizer.ID_ALL_MAILBOXES&&l.isOfflineGlobalSearch){
this.addSearchFolder(l)
}}
x.setVisible(x.getItemCount()>0);
if(appCtxt.get(ZmSetting.OFFLINE_SAVED_SEARCHES_TREE_OPEN)){
x.setExpanded(true,null,true)
}
if(appCtxt.get(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN)){
o.setExpanded(true,null,true)
}}
if(appCtxt.isOffline){
var T=AjxUtil.hashCopy(C);
T.omit={};
T.selectable=true;
if(this._appName!=ZmApp.PREFERENCES){
this._addAccount(T,n,f,"ZmOverviewLocalHeader","LocalFolders");
j=this.getHeaderItem(n);
j.setExpanded(appCtxt.get(ZmSetting.ACCOUNT_TREE_OPEN,null,n));
this.updateAccountInfo(n,false,true)
}else{
var q={
parent:this,text:n.getDisplayName(),imageInfo:n.getIcon(),selectable:false};
var p=new DwtTreeItem(q);
p._initialize(null,true);
var h=appCtxt.getOverviewId(this.containerId,n);
var S=this._overview[h].getTreeView(ZmOrganizer.PREF_PAGE);
var D=S.getTreeItemById("PREF_PAGE_IMPORT_EXPORT");
S.getHeaderItem().removeChild(D);
p._addItem(D);
D.addClassName("DwtTreeItemChildDiv");
p.setExpanded(true,null,true)
}}
var v=C.omit&&C.omit[ZmOrganizer.ID_ZIMLET];
if(!appCtxt.inStartup&&!v&&appCtxt.getZimletMgr().getPanelZimlets().length==0){
v=true
}
if(!v){
AjxDispatcher.require("Zimlet")
}
if(!v&&window[ZmOverviewController.CONTROLLER[ZmOrganizer.ZIMLET]]&&this._appName!=ZmApp.PREFERENCES){
var a=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET];
var B=C.overviewId=appCtxt.getOverviewId([this.containerId,a],null);
var t={
label:ZmMsg[a],icon:"Zimlet",dataId:B,className:"ZmOverviewZimletHeader"};
C.overviewTrees=[ZmOrganizer.ZIMLET];
this._addSection(t,null,C);
var j=this._headerItems;
if(j){
j.__isZimlet=true;
j.setExpanded(appCtxt.get(ZmSetting.ZIMLET_TREE_OPEN,null,n))
}}
this._initializeActionMenu()
};
ZmAccountOverviewContainer.prototype.addSearchFolder=function(t){
if(!this._searchTreeHeader){
return
}
var a={
parent:this._searchTreeHeader,text:t.getName(),imageInfo:t.getIcon()};
var e=new DwtTreeItem(a);
e.setData(Dwt.KEY_ID,t);
e._initialize(null,true);
if(!this._searchTreeHeader.getVisible()){
this._searchTreeHeader.setVisible(true)
}};
ZmAccountOverviewContainer.prototype.updateAccountInfo=function(s,e,n){
var t=appCtxt.getApp(this._appName)&&this.getHeaderItem(s);
if(t){
if(e){
var o=(s.status==ZmZimbraAccount.STATUS_RUNNING)?("<img src='/img/animated/ImgSpinner.gif' width=16 height=16 border=0>"):(AjxImg.getImageHtml(s.getStatusIcon()));
if(t._extraCell){
t._extraCell.innerHTML=(o||"")
}
if(appCtxt.isOffline&&s.status==ZmZimbraAccount.STATUS_AUTHFAIL){
var a=appCtxt.getPasswordChangeDialog();
a.popup(s)
}}
if(n||e){
t.setToolTipContent(s.getToolTip())
}}};
ZmAccountOverviewContainer.prototype.updateLabel=function(e){
if(e.nId==ZmOrganizer.ID_INBOX){
var n=e.getAccount();
var o=this.getHeaderItem(n);
if(o&&!o.getExpanded()){
o.setText(this._getAccountHeaderLabel(n))
}}
var t=this._vFolderTreeItemMap[e.nId];
if(t){
t.setText(this._getFolderLabel(e.nId,e.name));
if(e.nId==ZmOrganizer.ID_INBOX&&!this._allMailboxesTreeHeader.getExpanded()){
var a=this._getFolderLabel(e.nId,this._allMailboxesTreeHeader.__origText);
this._allMailboxesTreeHeader.setText(a)
}}};
ZmAccountOverviewContainer.prototype.updateTooltip=function(e){
var t=this._allMailboxesTreeHeader&&this._vFolderTreeItemMap[e];
if(t){
t.setToolTipContent(appCtxt.accountList.getTooltipForVirtualFolder(e))
}};
ZmAccountOverviewContainer.prototype.resetOperations=function(a,n){
var o=a.getOp(ZmOperation.EMPTY_FOLDER);
if(n instanceof ZmSearchFolder){
a.getOp(ZmOperation.MARK_ALL_READ).setVisible(false);
o.setVisible(false);
a.getOp(this._newOp).setVisible(false);
if(appCtxt.isOffline){
a.getOp(ZmOperation.SYNC).setVisible(false)
}
a.getOp(ZmOperation.DELETE).setVisible(true);
return
}
var r=appCtxt.accountList.getAccount(n);
var t=(r||n==ZmOrganizer.ID_ALL_MAILBOXES);
a.getOp(ZmOperation.MARK_ALL_READ).setVisible(!t);
o.setVisible(false);
a.getOp(this._newOp).setVisible(t&&n!=ZmOrganizer.ID_ALL_MAILBOXES);
if(appCtxt.isOffline){
a.getOp(ZmOperation.SYNC).setVisible(t&&(!r||(r&&!r.isMain)))
}
a.getOp(ZmOperation.DELETE).setVisible(false);
if(t){
a.enable(this._newOp,true);
a.enable(ZmOperation.SYNC,(!r||(r&&!r.isMain)))
}else{
var e=false;
if(n!=ZmOrganizer.ID_OUTBOX&&n!=ZmFolder.ID_DRAFTS&&this._actionedHeaderItem.getText().indexOf("bold")!=-1){
e=true
}
a.enable(ZmOperation.MARK_ALL_READ,e);
if(n==ZmOrganizer.ID_TRASH||n==ZmOrganizer.ID_SPAM){
var s=(n==ZmOrganizer.ID_TRASH)?ZmMsg.emptyTrash:ZmMsg.emptyJunk;
o.setText(s);
o.setVisible(true);
a.enable(ZmOperation.EMPTY_FOLDER,!this._isFolderEmpty(n))
}}};
ZmAccountOverviewContainer.prototype.removeZimletSection=function(){
var e=ZmOrganizer.LABEL[ZmOrganizer.ZIMLET];
var t=appCtxt.getOverviewId([this.containerId,e],null);
var a=this._headerItems[t];
if(a){
this.removeChild(a)
}};
ZmAccountOverviewContainer.prototype.highlightAllMboxes=function(){
this.deselectAll();
this.setSelection(this._allMailboxesTreeHeader,true)
};
ZmAccountOverviewContainer.prototype._addAccount=function(r,h,t,c,e){
r.overviewId=appCtxt.getOverviewId(this.containerId,h);
r.account=h;
var n=appCtxt.getApp(this._appName);
var a=(!n||(n&&appCtxt.get(ZmApp.SETTING[this._appName],null,h)));
if(this._appName==ZmApp.PREFERENCES||a){
var o=r.omitPerAcct?r.omitPerAcct[h.id]:r.omit;
var l,s;
if(this._appName==ZmApp.PREFERENCES&&h.isMain&&appCtxt.isOffline){
l=ZmMsg.allAccounts;
s="AccountAll"
}else{
l=h.getDisplayName();
if(!appCtxt.isFamilyMbox){
s=h.getIcon()
}}
var d={
label:l,icon:s,dataId:h.id,className:c,predictableId:e};
this._addSection(d,o,r,t)
}
var u=appCtxt.getSettings(h).getSetting(ZmSetting.QUOTA_USED);
u.addChangeListener(this._settingChangeListener)
};
ZmAccountOverviewContainer.prototype._addSection=function(h,o,n,a){
var s={
parent:this,text:h.label,imageInfo:h.icon,selectable:n.selectable,className:h.className,id:this.getHTMLElId()+"__"+(h.predictableId||h.dataId)+"__SECTION"};
var r=this._headerItems[h.dataId]=new DwtTreeItem(s);
r.setData(Dwt.KEY_ID,h.dataId);
r.setScrollStyle(Dwt.CLIP);
r._initialize(null,true,true);
r.addClassName(a?"ZmOverviewSectionHilite":"ZmOverviewSection");
n.id=ZmId.getOverviewId(n.overviewId);
n.parent=r;
n.scroll=Dwt.CLIP;
n.posStyle=Dwt.STATIC_STYLE;
var t=this._controller._overview[n.overviewId]=this._overview[n.overviewId]=new ZmOverview(n,this._controller);
r._dndScrollCallback=this._overview._dndScrollCallback,r._dndScrollId=this._overview._scrollableContainerId,r._addItem(t,null,true);
var e=n.overviewTrees||n.treeIds;
t.set(e,o)
};
ZmAccountOverviewContainer.prototype._setupHeader=function(n,o){
if(this._appName==ZmApp.PREFERENCES){
n.setExpanded(true,false,true);
n.enableSelection(false)
}else{
var a=appCtxt.get(ZmSetting.ACCOUNT_TREE_OPEN,null,o);
n.setExpanded(a);
if(!a){
n.setText(this._getAccountHeaderLabel(o))
}}
if(n._extraCell){
n._extraCell.onclick=AjxCallback.simpleClosure(this._handleStatusClick,this,o)
}
var e=this._controller.getTreeController(ZmOrganizer.FOLDER).getDropTarget();
var t=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,o);
n.setDropTarget(e);
n.setData(Dwt.KEY_OBJECT,appCtxt.getById(t))
};
ZmAccountOverviewContainer.prototype._isFolderEmpty=function(e){
var o=appCtxt.accountList.visibleAccounts;
for(var t=0;
t<o.length;
t++){
var a=appCtxt.getById(ZmOrganizer.getSystemId(e,o[t]));
if(a&&a.numTotal>0){
return false
}}
return true
};
ZmAccountOverviewContainer.prototype._syncAccount=function(e,t){
e.popdown();
t.sync()
};
ZmAccountOverviewContainer.prototype._treeViewListener=function(m){
if(m.detail!=DwtTree.ITEM_ACTIONED&&m.detail!=DwtTree.ITEM_SELECTED&&m.detail!=DwtTree.ITEM_DBL_CLICKED){
return
}
var f=this._actionedHeaderItem=m.item;
if(f&&(f.__isZimlet||f.__isSearch)){
return
}
var r=f&&f.getData(Dwt.KEY_ID);
if(m.detail==DwtTree.ITEM_ACTIONED&&appCtxt.getApp(this._appName)){
var u=this._getActionMenu(r);
if(u){
this.resetOperations(u,r);
u.popup(0,m.docX,m.docY)
}}else{
if((m.detail==DwtTree.ITEM_SELECTED)&&f){
if(this._appName==ZmApp.CALENDAR||this._appName==ZmApp.PREFERENCES){
return
}
this._deselectAllTreeViews();
if(!ZmApp.NAME[this._appName]){
return
}
if(r){
var d=appCtxt.getSearchController();
var l=appCtxt.accountList.getAccount(r);
if(l){
if(appCtxt.isOffline&&l.inNewMailMode){
l.inNewMailMode=false;
var a=appCtxt.getOverviewController()._overviewContainer;
for(var h in a){
a[h].updateAccountInfo(l,true,true)
}}
if((m.target.parentNode==m.item._extraCell)&&l.isError()){
return
}
d.searchAllAccounts=false;
appCtxt.accountList.setActiveAccount(l);
if(appCtxt.isOffline&&l.hasNotSynced()&&!l.__syncAsked){
l.__syncAsked=true;
var c=appCtxt.getYesNoMsgDialog();
c.registerCallback(DwtDialog.YES_BUTTON,this._syncAccount,this,[c,l]);
c.setMessage(ZmMsg.neverSyncedAsk,DwtMessageDialog.INFO_STYLE);
c.popup()
}
var o=ZmOrganizer.DEFAULT_FOLDER[ZmApp.ORGANIZER[this._appName]];
var t=appCtxt.getById(ZmOrganizer.getSystemId(o,l));
if(!(t instanceof ZmFolder)){
return
}
var e=(this._appName==ZmApp.TASKS)?ZmSearch.DUE_DATE_DESC:ZmSearch.DATE_DESC;
var s={
query:t.createQuery(),getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),searchFor:(ZmApp.DEFAULT_SEARCH[this._appName]),sortBy:((d.currentSearch&&t.nId==d.currentSearch.folderId)?null:e),accountName:(l&&l.name),noUpdateOverview:true}
}else{
var n=appCtxt.accountList.mainAccount;
d.resetSearchAllAccounts();
d.searchAllAccounts=true;
if(r instanceof ZmSearchFolder){
s={
searchAllAccounts:true,accountName:n.name,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),noUpdateOverview:true};
d.redoSearch(r.search,false,s);
return
}
if(r==ZmOrganizer.ID_ALL_MAILBOXES){
r=ZmFolder.ID_INBOX
}
s={
queryHint:appCtxt.accountList.generateQuery(r),folderId:null,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML,null,n),searchFor:(ZmApp.DEFAULT_SEARCH[this._appName]),sortBy:ZmSearch.DATE_DESC,accountName:n.name,noUpdateOverview:true}
}
d.search(s)
}}else{}}};
ZmAccountOverviewContainer.prototype._treeListener=function(t){
if(t.detail!=DwtTree.ITEM_COLLAPSED&&t.detail!=DwtTree.ITEM_EXPANDED){
return
}
var r=t.item;
var e=t.detail==DwtTree.ITEM_EXPANDED;
var s;
if(r){
if(r.__isSearch){
appCtxt.set(ZmSetting.OFFLINE_SAVED_SEARCHES_TREE_OPEN,e);
return
}
var a=r.getData(Dwt.KEY_ID);
if(a==ZmOrganizer.ID_ALL_MAILBOXES){
var n=AjxStringUtil.htmlEncode(r.__origText);
var o=e?n:this._getFolderLabel(ZmOrganizer.ID_INBOX,n);
r.setText(o);
appCtxt.set(ZmSetting.OFFLINE_ALL_MAILBOXES_TREE_OPEN,e);
return
}
s=r.__isZimlet?appCtxt.accountList.mainAccount:appCtxt.accountList.getAccount(a)
}
if(s&&appCtxt.getCurrentAppName()!=ZmApp.PREFERENCES){
if(!appCtxt.inStartup){
appCtxt.accountList.setActiveAccount(s);
appCtxt.set(ZmSetting.ACCOUNT_TREE_OPEN,e,null,null,null,s)
}
if(!r.__isZimlet){
var o=e?AjxStringUtil.htmlEncode(s.getDisplayName()):this._getAccountHeaderLabel(s);
r.setText(o)
}}};
ZmAccountOverviewContainer.prototype._mouseListener=function(e){
return !Dwt.ffScrollbarCheck(e)
};
ZmAccountOverviewContainer.prototype._handleSettingChange=function(a){
if(a.type!=ZmEvent.S_SETTING){
return
}
var t=a.source;
if(t.id==ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES){
var e=t.getValue();
this._allMailboxesTreeHeader.setVisible(e);
if(!e){
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(t.id==ZmSetting.QUOTA_USED){
this.updateAccountInfo(a.getDetails().account,false,true)
}}};
ZmAccountOverviewContainer.prototype._getAccountHeaderLabel=function(n,o){
var t=(this._appName==ZmApp.MAIL)?ZmOrganizer.getSystemId(ZmOrganizer.ID_INBOX,n,true):null;
var a=t&&appCtxt.getById(t);
if(a&&a.numUnread>0){
var e=AjxMessageFormat.format(ZmMsg.folderUnread,[AjxStringUtil.htmlEncode(n.getDisplayName()),a.numUnread]);
return(["<span style='font-weight:bold;'>",e,"</span>"].join(""))
}
return n.getDisplayName()
};
ZmAccountOverviewContainer.prototype._getFolderLabel=function(e,a){
var n=(e!=ZmFolder.ID_DRAFTS&&e!=ZmFolder.ID_OUTBOX);
var o=appCtxt.accountList.getItemCount(e,n);
if(o>0){
var t=AjxMessageFormat.format(ZmMsg.folderUnread,[a,o]);
return(["<span style='font-weight:bold;'>",t,"</span>"].join(""))
}
return a
};
ZmAccountOverviewContainer.prototype._initializeActionMenu=function(){
if(!this._actionMenu){
var t=ZmApp.ORGANIZER[this._appName];
this._newOp=ZmOrganizer.NEW_OP[t];
var e=[this._newOp];
if(appCtxt.isOffline){
e.push(ZmOperation.SYNC)
}
e.push(ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER,ZmOperation.DELETE);
this._actionMenu=new AjxCallback(this,this._createActionMenu,[e])
}};
ZmAccountOverviewContainer.prototype._createActionMenu=function(a){
var n=new AjxListener(this,this._actionMenuListener);
var o=new ZmActionMenu({
parent:appCtxt.getShell(),menuItems:a}
);
a=o.opList;
for(var t=0;
t<a.length;
t++){
var e=o.getItem(t);
var s=a[t];
if(s==ZmOperation.SYNC){
e.setText(ZmMsg.sendReceive)
}
o.addSelectionListener(s,n)
}
o.addPopdownListener(new AjxListener(this,this._menuPopdownActionListener));
return o
};
ZmAccountOverviewContainer.prototype._menuPopdownActionListener=function(){
this._actionedHeaderItem._setActioned(false)
};
ZmAccountOverviewContainer.prototype._actionMenuListener=function(o){
var t=o.item.getData(ZmOperation.KEY_ID);
var r=this._actionedHeaderItem.getData(Dwt.KEY_ID);
if(t==this._newOp){
var s=ZmApp.ORGANIZER[this._appName];
var e=this._controller.getTreeController(s,true);
if(e){
e._actionedOrganizer=null;
var n=appCtxt.accountList.getAccount(r);
e._actionedOrganizer=appCtxt.getFolderTree(n).root;
e._newListener(o,n)
}}else{
if(t==ZmOperation.SYNC){
if(r==ZmOrganizer.ID_ALL_MAILBOXES){
appCtxt.accountList.syncAll()
}else{
var n=appCtxt.accountList.getAccount(r);
if(n){
n.sync()
}}}else{
if(t==ZmOperation.MARK_ALL_READ){
this._doAction(r,t)
}else{
if(t==ZmOperation.EMPTY_FOLDER){
this._confirmEmptyAction(r,t)
}else{
if(t==ZmOperation.DELETE){
r._delete();
var a=this._actionedHeaderItem.parent;
a.removeChild(this._actionedHeaderItem);
a.setVisible(a.getItemCount()>0)
}}}}}};
ZmAccountOverviewContainer.prototype._confirmEmptyAction=function(a,e){
var t=appCtxt.getOkCancelMsgDialog();
t.reset();
t.registerCallback(DwtDialog.OK_BUTTON,this._emptyCallback,this,[t,a,e]);
var o=(a==ZmFolder.ID_TRASH)?ZmMsg.confirmEmptyTrashFolder:(AjxMessageFormat.format(ZmMsg.confirmEmptyFolder,ZmMsg[ZmFolder.MSG_KEY[a]]));
t.setMessage(o,DwtMessageDialog.WARNING_STYLE);
t.popup()
};
ZmAccountOverviewContainer.prototype._emptyCallback=function(a,t,e){
a.popdown();
this._doAction(t,e)
};
ZmAccountOverviewContainer.prototype._doAction=function(t,e){
var r=new ZmBatchCommand(true,appCtxt.accountList.mainAccount.name);
var n=appCtxt.accountList.visibleAccounts;
for(var a=0;
a<n.length;
a++){
var s=n[a];
if(s.isMain){
continue
}
var h=ZmOrganizer.getSystemId(t,s);
var o=appCtxt.getById(h);
if(o){
if(e==ZmOperation.MARK_ALL_READ){
o.markAllRead(r)
}else{
o.empty(null,r)
}
r.curId++
}}
r.run();
if(appCtxt.isOffline){
appCtxt.getApp(ZmApp.MAIL).clearNewMailBadge()
}};
ZmAccountOverviewContainer.prototype._handleStatusClick=function(a,t){
if(!a.isError()){
return
}else{
if(appCtxt.isOffline&&(a.status==ZmZimbraAccount.STATUS_AUTHFAIL)){
var e=appCtxt.getPasswordChangeDialog();
e.popup(a)
}else{
a.showErrorMessage()
}}}
}
if(AjxPackage.define("zimbraMail.share.view.ZmOverview")){
ZmOverview=function(a,s){
var l=a.overviewClass?a.overviewClass:"ZmOverview";
a.id=a.id||ZmId.getOverviewId(a.overviewId);
DwtComposite.call(this,{
parent:a.parent,className:l,posStyle:a.posStyle,id:a.id}
);
this._controller=s;
this.setScrollStyle(a.scroll||Dwt.SCROLL);
this.overviewId=a.overviewId;
this.containerId=a.containerId;
this.account=a.account;
this.selectionSupported=a.selectionSupported;
this.actionSupported=a.actionSupported;
this.dndSupported=a.dndSupported;
this.headerClass=a.headerClass;
this.showUnread=a.showUnread;
this.showNewButtons=a.showNewButtons;
this.treeStyle=a.treeStyle;
this.isCheckedByDefault=a.isCheckedByDefault;
this.noTooltips=a.noTooltips;
this.isAppOverview=a.isAppOverview;
this._treeIds=[];
this._treeHash={};
this._treeParents={};
var c=document;
var o=this.getHtmlElement();
if(a.treeIds){
for(var n=0,h=a.treeIds.length;
n<h;
n++){
var t=c.createElement("DIV");
var r=a.treeIds[n];
this._treeParents[r]=t.id=[this.overviewId,r].join("-parent-");
o.appendChild(t)
}}
if(this.dndSupported){
this._scrollableContainerId=this.containerId||this.overviewId;
var e=this.containerId?document.getElementById(this.containerId):this.getHtmlElement();
var a={
container:e,threshold:15,amount:5,interval:10,id:this._scrollableContainerId};
this._dndScrollCallback=new AjxCallback(null,DwtControl._dndScrollCallback,[a])
}};
ZmOverview.prototype=new DwtComposite;
ZmOverview.prototype.constructor=ZmOverview;
ZmOverview.prototype.toString=function(){
return"ZmOverview"
};
ZmOverview.prototype.getTreeParent=function(e){
return this._treeParents[e]
};
ZmOverview.prototype.set=function(e,a){
if(e&&e.length){
for(var t=0;
t<e.length;
t++){
this.setTreeView(e[t],a)
}}};
ZmOverview.prototype.setTreeView=function(t,e){
if(appCtxt.get(ZmOrganizer.PRECONDITION[t])===false){
return
}
AjxDispatcher.require(ZmOrganizer.ORG_PACKAGE[t]);
var a=this._controller.getTreeController(t);
if(!a){
return
}
if(this._treeHash[t]){
a.clearTreeView(this.overviewId)
}else{
this._treeIds.push(t)
}
var o={
overviewId:this.overviewId,omit:e,showUnread:this.showUnread,account:this.account};
this._treeHash[t]=a.show(o)
};
ZmOverview.prototype.getTreeView=function(e){
return this._treeHash[e]
};
ZmOverview.prototype.getTreeViews=function(){
return this._treeIds
};
ZmOverview.prototype.getTreeItemById=function(n,a){
if(!n){
return null
}
for(var t=0;
t<this._treeIds.length;
t++){
var e=this._treeHash[this._treeIds[t]];
if(e){
var o=e.getTreeItemById&&e.getTreeItemById(n);
if(o&&(!a||(this._treeIds[t]==a))){
return o
}}}
return null
};
ZmOverview.prototype.getSelected=function(t){
for(var a=0;
a<this._treeIds.length;
a++){
var e=this._treeHash[this._treeIds[a]];
if(e){
var o=e.getSelected();
if(o){
return t?e.type:o
}}}
return null
};
ZmOverview.prototype.deselectAllTreeViews=function(){
for(var t=0;
t<this._treeIds.length;
t++){
var e=this._treeHash[this._treeIds[t]];
if(e){
e.deselectAll()
}}};
ZmOverview.prototype.setSelected=function(o,a){
var t,e;
if(a){
e=this._treeHash[a];
t=e&&e.getTreeItemById(o)
}else{
for(var a in this._treeHash){
e=this._treeHash[a];
t=e&&e.getTreeItemById(o);
if(t){
break
}}}
if(t&&(this._selectedTreeItem!=t)){
e.setSelected(o,true,true)
}
this.itemSelected(t)
};
ZmOverview.prototype.itemSelected=function(a){
if(appCtxt.multiAccounts&&a){
var t=this.overviewId.substring(0,this.overviewId.indexOf(":"));
var e=this._controller.getOverviewContainer(t);
if(e){
e.deselectAll(this)
}}
if(this._selectedTreeItem&&(this._selectedTreeItem._tree!=(a&&a._tree))){
this._selectedTreeItem._tree.deselectAll()
}
this._selectedTreeItem=a
};
ZmOverview.prototype.clear=function(){
for(var e=0;
e<this._treeIds.length;
e++){
var t=this._treeIds[e];
if(this._treeHash[t]){
var a=this._controller.getTreeController(t);
a.clearTreeView(this.overviewId);
delete this._treeHash[t]
}}};
ZmOverview.prototype._initialize=function(){};
ZmOverview.prototype._focus=function(){
var t=this._selectedTreeItem;
if(!t){
var e=this._treeHash[this._treeIds[0]];
if(e){
t=e._getNextTreeItem(true)
}}
if(t){
t.focus()
}};
ZmOverview.prototype._blur=function(){
var e=this._selectedTreeItem;
if(e){
e._blur()
}};
ZmOverview.prototype._getNextTreeItem=function(n,a){
for(var o=0;
o<this._treeIds.length;
o++){
if(this._treeHash[this._treeIds[o]]==a){
break
}}
var t=null;
var e=n?o+1:o-1;
a=this._treeHash[this._treeIds[e]];
while(a){
t=DwtTree.prototype._getNextTreeItem.call(a,n);
if(t){
break
}
e=n?e+1:e-1;
a=this._treeHash[this._treeIds[e]]
}
return t
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmUpsellView")){
ZmUpsellView=function(e){
DwtControl.call(this,e)
};
ZmUpsellView.prototype=new DwtControl;
ZmUpsellView.prototype.constructor=ZmUpsellView;
ZmUpsellView.prototype.toString=function(){
return"ZmUpsellView"
};
ZmUpsellView.prototype.setBounds=function(t,h,o,e,s){
var n=0;
if(!s){
n=this._getToolbarHeight()
}
DwtControl.prototype.setBounds.call(this,t,h-n,o,e+n);
var r="iframe_"+this.getHTMLElId();
var a=document.getElementById(r);
if(a){
a.width=o;
a.height=e+n
}};
ZmUpsellView.prototype._getToolbarHeight=function(){
var t=appCtxt.getAppViewMgr().getCurrentViewComponent(ZmAppViewMgr.C_TOOLBAR_TOP);
if(t){
var a=t.getSize();
var e=a.y?a.y:t.getHtmlElement().clientHeight;
return e
}
return 0
}
}
if(AjxPackage.define("zimbraMail.share.view.ZmTimeSelect")){
ZmTimeSelect=function(e,t){
DwtComposite.call(this,{
parent:e}
);
this.id=t;
this._isLocale24Hour=true;
this._createSelects()
};
ZmTimeSelect.START=1;
ZmTimeSelect.END=2;
ZmTimeSelect.HOUR=1;
ZmTimeSelect.MINUTE=2;
ZmTimeSelect.AMPM=3;
ZmTimeSelect.getDateFromFields=function(e,o,a,t){
e=Number(e);
if(a){
if(a=="AM"||a===0){
e=(e==12)?0:e
}else{
if(a=="PM"||a==1){
e=(e<12)?e+12:e
}}}
t=t?t:new Date();
t.setHours(e,Number(o),0,0);
return t
};
ZmTimeSelect.parse=function(a){
var t;
var o=a.toLowerCase();
if(o===ZmMsg.midnight.toLowerCase()||o===ZmMsg.noon.toLowerCase()){
t=new Date();
t.setMinutes(0);
t.setSeconds(0);
t.setHours(o===ZmMsg.noon.toLowerCase()?12:0)
}else{
var e=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
t=e.parse(a)||AjxDateFormat.parseTime(a)
}
return t
};
ZmTimeSelect.format=function(e){
if(e.getHours()==0&&e.getMinutes()==0){
return ZmMsg.midnight
}else{
if(e.getHours()==12&&e.getMinutes()==0){
return ZmMsg.noon
}else{
return AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT).format(e)
}}};
ZmTimeSelect.adjustStartEnd=function(b,e,l,c,m){
var r=b._args.selectObj;
var t=AjxDateUtil.simpleParseDateStr(c.value);
var g=AjxDateUtil.simpleParseDateStr(m.value);
var s=c.value;
var a=m.value;
if(r.id==ZmTimeSelect.START){
var f=(r.compId==ZmTimeSelect.HOUR)?b._args.oldValue:e.getHours();
var d=(r.compId==ZmTimeSelect.MINUTE)?b._args.oldValue:e.getMinutes();
var o=(r.compId==ZmTimeSelect.AMPM)?b._args.oldValue:e.getAmPm();
var u=ZmTimeSelect.getDateFromFields(f,d,o,t).getTime();
var h=ZmTimeSelect.getDateFromFields(e.getHours(),e.getMinutes(),e.getAmPm(),t).getTime();
var p=ZmTimeSelect.getDateFromFields(l.getHours(),l.getMinutes(),l.getAmPm(),g).getTime();
var w=p-u;
if(!w){
return null
}
var n=h+w;
var y=new Date(n);
l.set(y);
m.value=AjxDateUtil.simpleComputeDateStr(y);
if(m.value!=a){
return m
}}else{
return null
}};
ZmTimeSelect.validStartEnd=function(h,t,o,r){
var e=AjxDateUtil.simpleParseDateStr(h.value);
var s=AjxDateUtil.simpleParseDateStr(t.value);
if(e&&s){
if((e.valueOf()>s.valueOf())){
return false
}
if(e.getFullYear()>9999||s.getFullYear()>9999){
return false
}
if(o&&r){
var a=ZmTimeSelect.getDateFromFields(o.getHours(),o.getMinutes(),o.getAmPm(),e).getTime();
var n=ZmTimeSelect.getDateFromFields(r.getHours(),r.getMinutes(),r.getAmPm(),s).getTime();
if(a>n){
return false
}}}else{
return false
}
return true
};
ZmTimeSelect.prototype=new DwtComposite;
ZmTimeSelect.prototype.constructor=ZmTimeSelect;
ZmTimeSelect.prototype.set=function(o){
var a=0,s=0,n=0;
var t=this.isLocale24Hour();
var e=o.getHours();
if(!t&&e>12){
a=e-13
}else{
if(!t&&e==0){
a=this.getHourSelectSize()-1
}else{
a=t?e:e-1
}}
s=Math.floor(o.getMinutes()/5);
if(!t){
n=(o.getHours()>=12)?1:0
}
this.setSelected(a,s,n)
};
ZmTimeSelect.prototype.getValue=function(e){
return(ZmTimeSelect.getDateFromFields(this.getHours(),this.getMinutes(),this.getAmPm(),e))
};
ZmTimeSelect.prototype.getHours=function(){
return this._hourSelect.getValue()
};
ZmTimeSelect.prototype.getMinutes=function(){
return this._minuteSelect.getValue()
};
ZmTimeSelect.prototype.getAmPm=function(){
return this._amPmSelect?this._amPmSelect.getValue():null
};
ZmTimeSelect.prototype.setSelected=function(e,a,t){
this._hourSelect.setSelected(e);
this._minuteSelect.setSelected(a);
if(!this._isLocale24Hour){
this._amPmSelect.setSelected(t)
}};
ZmTimeSelect.prototype.addChangeListener=function(e){
this._hourSelect.addChangeListener(e);
this._minuteSelect.addChangeListener(e);
if(this._amPmSelect){
this._amPmSelect.addChangeListener(e)
}};
ZmTimeSelect.prototype.isLocale24Hour=function(){
return this._isLocale24Hour
};
ZmTimeSelect.prototype.getHourSelectSize=function(){
return this._hourSelect.size()
};
ZmTimeSelect.prototype.getMinuteSelectSize=function(){
return this._minuteSelect.size()
};
ZmTimeSelect.prototype.getSelectedHourIdx=function(){
return this._hourSelect.getSelectedIndex()
};
ZmTimeSelect.prototype.getSelectedMinuteIdx=function(){
return this._minuteSelect.getSelectedIndex()
};
ZmTimeSelect.prototype.getSelectedAmPmIdx=function(){
return this._amPmSelect?this._amPmSelect.getSelectedIndex():0
};
ZmTimeSelect.prototype.setEnabled=function(e){
DwtComposite.prototype.setEnabled.call(this,e);
this._hourSelect.setEnabled(e);
this._minuteSelect.setEnabled(e);
if(this._amPmSelect){
this._amPmSelect.setEnabled(e)
}};
ZmTimeSelect.prototype._createSelects=function(){
this._hourSelectId=Dwt.getNextId();
this._minuteSelectId=Dwt.getNextId();
this._amPmSelectId=Dwt.getNextId();
var o=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
var s=0;
var d=0;
var c=[];
var h=0;
c[h++]="<table border=0 cellpadding=0 cellspacing=0><tr>";
for(var r=0;
r<o._segments.length;
r++){
var l=o._segments[r]._s;
if(o._segments[r] instanceof AjxFormat.TextSegment){
var e=AjxStringUtil.trim(l);
if(e.length){
c[h++]="<td class='TextPadding ZmFieldLabel'>";
c[h++]=l;
c[h++]="</td>"
}}else{
if(l.charAt(0)=="h"||l.charAt(0)=="H"){
s=r;
c[h++]="<td width=42 id='";
c[h++]=this._hourSelectId;
c[h++]="'></td>"
}else{
if(l.charAt(0)=="m"){
d=r;
c[h++]="<td width=42 id='";
c[h++]=this._minuteSelectId;
c[h++]="'></td>"
}else{
if(l=="a"){
this._isLocale24Hour=false;
c[h++]="<td width=42 id='";
c[h++]=this._amPmSelectId;
c[h++]="'></td>"
}}}}}
c[h++]="</tr></table>";
this.getHtmlElement().innerHTML=c.join("");
var a=new Date();
var t=this._isLocale24Hour?0:1;
var n=this._isLocale24Hour?24:13;
this._hourSelect=new DwtSelect({
parent:this}
);
this._hourSelect.id=this.id;
this._hourSelect.compId=ZmTimeSelect.HOUR;
for(var h=t;
h<n;
h++){
a.setHours(h);
var u=o._segments[s].format(a);
this._hourSelect.addOption(u,false,h)
}
this._hourSelect.reparentHtmlElement(this._hourSelectId);
delete this._hourSelectId;
this._minuteSelect=new DwtSelect({
parent:this}
);
this._minuteSelect.id=this.id;
this._minuteSelect.compId=ZmTimeSelect.MINUTE;
for(var h=0;
h<60;
h=h+5){
a.setMinutes(h);
var u=o._segments[d].format(a);
this._minuteSelect.addOption(u,false,h)
}
this._minuteSelect.reparentHtmlElement(this._minuteSelectId);
delete this._minuteSelectId;
if(!this._isLocale24Hour){
this._amPmSelect=new DwtSelect({
parent:this}
);
this._amPmSelect.id=this.id;
this._amPmSelect.compId=ZmTimeSelect.AMPM;
this._amPmSelect.addOption(I18nMsg.periodAm,false,"AM");
this._amPmSelect.addOption(I18nMsg.periodPm,false,"PM");
this._amPmSelect.reparentHtmlElement(this._amPmSelectId);
delete this._amPmSelectId
}};
ZmTimeInput=function(t,o,e){
var a={
parent:t,id:"ZmTimeInput"};
if(e){
a.parentElement=e
}
DwtComposite.call(this,a);
this.id=o;
this._isLocale24Hour=true;
this._createSelects();
this._useTextInput=true
};
ZmTimeInput.START=1;
ZmTimeInput.END=2;
ZmTimeInput.HOUR=1;
ZmTimeInput.MINUTE=2;
ZmTimeInput.AMPM=3;
ZmTimeInput.ROWS=8;
ZmTimeInput.DEFAULT_TOP_ROW=8;
ZmTimeInput.getDateFromFields=function(t,e){
var a=ZmTimeSelect.parse(t);
e=e||new Date();
e.setHours(a.getHours(),a.getMinutes(),0,0);
return e
};
ZmTimeInput.adjustStartEnd=function(b,e,h,c,u,g,s){
var t=AjxDateUtil.simpleParseDateStr(c.value);
var p=AjxDateUtil.simpleParseDateStr(u.value);
var o=c.value;
var a=u.value;
if(s==ZmTimeInput.START){
var l=g?g.startTimeStr:e.getTimeString();
var d=ZmTimeInput.getDateFromFields(l,t).getTime();
var r=ZmTimeInput.getDateFromFields(e.getTimeString(),t).getTime();
var f=ZmTimeInput.getDateFromFields(h.getTimeString(),p).getTime();
var w=f-d;
if(!w){
return null
}
var n=r+w;
var y=new Date(n);
e.set(new Date(r));
h.set(y);
u.value=AjxDateUtil.simpleComputeDateStr(y);
if(u.value!=a){
return u
}}else{
if(s==ZmTimeInput.END){
var l=g?g.endTimeStr:h.getTimeString();
var f=ZmTimeInput.getDateFromFields(l,p).getTime();
var n=ZmTimeInput.getDateFromFields(h.getTimeString(),p).getTime();
var d=ZmTimeInput.getDateFromFields(e.getTimeString(),t).getTime();
var w=f-d;
if(!w){
return null
}
if(n<d){
var r=n-w;
var m=new Date(r);
e.set(m);
h.set(new Date(n));
c.value=AjxDateUtil.simpleComputeDateStr(m);
u.value=AjxDateUtil.simpleComputeDateStr(new Date(n))
}
if(c.value!=o){
return c
}}else{
return null
}}};
ZmTimeInput.validStartEnd=function(n,e,c,l){
var o=AjxDateUtil.simpleParseDateStr(n.value);
var r=AjxDateUtil.simpleParseDateStr(e.value);
if(o&&r){
if((o.valueOf()>r.valueOf())){
return false
}
if(o.getFullYear()>9999||r.getFullYear()>9999){
return false
}
if(c&&l){
var a=c.getTimeString();
var h=l.getTimeString();
if(a&&h){
var t=ZmTimeInput.getDateFromFields(a,o).getTime();
var s=ZmTimeInput.getDateFromFields(h,r).getTime();
if(t>s){
return false
}}}}else{
return false
}
return true
};
ZmTimeInput.prototype=new DwtComposite;
ZmTimeInput.prototype.constructor=ZmTimeInput;
ZmTimeInput.prototype.set=function(e){
var t=ZmTimeSelect.format(e);
this._originalTimeStr=t;
this._timeSelectInput.setValue(t);
this._scrollToValue(t)
};
ZmTimeInput.prototype.setValue=function(t){
var e=ZmTimeSelect.parse(t);
if(!e){
t=""
}
this._originalTimeStr=t;
this._timeSelectInput.setValue(t);
this._scrollToValue(t)
};
ZmTimeInput.prototype._scrollToValue=function(t){
var e=this.getTimeIndex(t);
if(e!==null){
this._hoursSelectMenu.setSelectedItem(e)
}};
ZmTimeInput.prototype.getValue=function(e){
var t=ZmTimeSelect.parse(this._timeSelectInput.getValue());
if(!t){
t=new Date()
}
e=e||new Date();
if(AjxDateUtil.isDayShifted(e)){
AjxDateUtil.rollToNextDay(e)
}
e.setHours(t.getHours(),t.getMinutes(),0,0);
return e
};
ZmTimeInput.prototype.getHours=function(){
var e=this.getValue();
return e?e.getHours():null
};
ZmTimeInput.prototype.getMinutes=function(){
var e=this.getValue();
return e?e.getMinutes():null
};
ZmTimeInput.prototype.addChangeListener=function(e){
this._changeListener=e;
var t=AjxCallback.simpleClosure(this.handleTimeChange,this,e);
this._timeSelectInput.setHandler(DwtEvent.ONFOCUS,t);
this._timeSelectInput.setHandler(DwtEvent.ONBLUR,t)
};
ZmTimeInput.prototype.handleTimeChange=function(t,e){
var o=this._timeSelectInput.getValue();
var a=ZmTimeSelect.parse(o);
if(!a){
this.setValue(this._originalTimeStr)
}else{
this._scrollToValue(o)
}
t.run(e,this.id)
};
ZmTimeInput.prototype.correctTimeString=function(n,t){
var e=n.split(":");
if(!e){
return t
}
var a=(e.length&&e[0]!=null)?parseInt(e[0].replace(/D/g,"")):null;
var o=(e.length>1&&e[1]!=null)?parseInt(e[1].replace(/D/g,"")):0;
if(!a){
a=(a==0)?0:t.getHours()
}
if(!o){
o=0
}
t.setHours(a,o,0,0);
return t
};
ZmTimeInput.prototype.isLocale24Hour=function(){
return this._isLocale24Hour
};
ZmTimeInput.prototype.setEnabled=function(e){
DwtComposite.prototype.setEnabled.call(this,e);
this._timeSelectInput.setEnabled(e);
this._timeSelectBtn.setEnabled(e)
};
ZmTimeInput.prototype._timeButtonListener=function(d){
if(!this._menuItemsAdded){
var n,a,r,s,u,c,e=new Date(),l=this._timeSelectBtn,t=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT),h=new AjxListener(this,this._timeSelectionListener),o;
for(n=0;
n<24;
n++){
e.setHours(n);
e.setMinutes(0);
r=new DwtMenuItem({
parent:this._hoursSelectMenu,style:DwtMenuItem.NO_STYLE}
);
u=t.format(e);
this.putTimeIndex(u,n);
if(n==0||n==12){
u=ZmTimeSelect.format(e);
this.putTimeIndex(u,n)
}
r.setText(u);
r.setData("value",n*60);
if(h){
r.addSelectionListener(h)
}
if(n==ZmTimeInput.DEFAULT_TOP_ROW){
o=r
}
c=new DwtMenu({
parent:r,style:DwtMenu.DROPDOWN_STYLE,layout:DwtMenu.LAYOUT_CASCADE,maxRows:1,congruent:true}
);
r.setMenu(c,true);
r.setSelectableWithSubmenu(true);
for(a=1;
a<4;
a++){
e.setMinutes(a*15);
s=new DwtMenuItem({
parent:c,style:DwtMenuItem.NO_STYLE}
);
s.setText(t.format(e));
s.setData("value",n*60+a*15);
if(h){
s.addSelectionListener(h)
}}}
this._hoursSelectMenu.setWidth(l.getW()+this._timeSelectInput.getW());
if(o){
this._hoursSelectMenu.scrollToItem(o)
}
this._scrollToValue(t.format(this.getValue()));
this._menuItemsAdded=true
}
d.item.popup()
};
ZmTimeInput.prototype._timeSelectionListener=function(e){
if(e.item&&e.item instanceof DwtMenuItem){
this._timeSelectInput.setValue(e.item.getText());
this._timeSelectValue=e.item.getData("value");
if(this._changeListener){
this._changeListener.run(e,this.id)
}
return
}};
ZmTimeInput.prototype.getTimeString=function(){
var e=ZmTimeSelect.parse(this._timeSelectInput.getValue());
return e?this._timeSelectInput.getValue():""
};
ZmTimeInput.prototype.getInputField=function(){
return this._timeSelectInput
};
ZmTimeInput.prototype.putTimeIndex=function(t,e){
this._timeIndex[t.replace(/:dd/,":00").replace(/s/,"").toLowerCase()]=e
};
ZmTimeInput.prototype.getTimeIndex=function(t){
if(!t){
return null
}
var e=this._timeIndex[t.replace(/:dd/,":00").replace(/s/,"").toLowerCase()];
return(e||e===0)?e:null
};
ZmTimeInput.prototype._createSelects=function(){
this.getHtmlElement().innerHTML=AjxTemplate.expand("calendar.Appointment#ApptTimeInput",{
id:this._htmlElId}
);
var a=Dwt.getNextId("ZmTimeInputSelect_");
if(this.id&&this.id==ZmTimeSelect.START){
a+="_startTimeInput"
}else{
if(this.id&&this.id==ZmTimeSelect.END){
a+="_endTimeInput"
}}
var s={
parent:this,parentElement:(this._htmlElId+"_timeSelectInput"),type:DwtInputField.STRING,errorIconStyle:DwtInputField.ERROR_ICON_NONE,validationStyle:DwtInputField.CONTINUAL_VALIDATION,inputId:a,id:Dwt.getNextId("ZmTimeInputField_")};
this._timeSelectInput=new DwtInputField(s);
var o=this._timeSelectInput.getInputElement();
Dwt.setSize(o,"80px","22px");
o.typeId=this.id;
var e=new AjxListener(this,this._timeButtonListener);
var n=this._htmlElId+"_timeSelectBtn";
var t=this._timeSelectBtn=new DwtButton({
parent:this}
);
t.addDropDownSelectionListener(e);
t.setData(Dwt.KEY_ID,n);
t.setSize("20");
this._timeIndex={};
this._hoursSelectMenu=new DwtMenu({
parent:t,style:DwtMenu.DROPDOWN_STYLE,layout:DwtMenu.LAYOUT_SCROLL,maxRows:ZmTimeInput.ROWS}
);
t.setMenu(this._hoursSelectMenu,true,false,false,true);
this._menuItemsAdded=false;
t.reparentHtmlElement(n)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmController")){
ZmController=function(e,t){
if(arguments.length==0){
return
}
this._container=e;
this._app=t;
this._shell=appCtxt.getShell();
this._appViews={};
this._currentView=null;
this._authenticating=false
};
ZmController.prototype._setView=function(){};
ZmController.prototype.toString=function(){
return"ZmController"
};
ZmController.prototype.getApp=function(){
return this._app
};
ZmController.prototype.popupErrorDialog=function(e,u,f,d,c,a){
var h=appCtxt.getErrorDialog();
var o="";
if(typeof u=="string"){
o=u
}else{
if(u instanceof Object){
u.msg=u.msg||e;
var l=["method","msg","code","detail","trace","request","fileName","lineNumber","message","name","stack"];
var r=[],s=0;
r[s++]="<table>";
for(var n=0;
n<l.length;
n++){
var t=l[n];
var p=AjxStringUtil.htmlEncode(u[t]);
if(p){
if(t=="request"){
p=["<pre>",p,"</pre>"].join("");
var m=document.getElementById(h._msgCellId);
if(m){
m.className="DwtMsgDialog-wide"
}}
r[s++]=["<tr><td valign='top'>",l[n],":</td><td valign='top'>",p,"</td></tr>"].join("")
}}
r[s++]="</table>";
o=r.join("")
}}
h.registerCallback(DwtDialog.OK_BUTTON,this._errorDialogCallback,this);
if(!a){
e=AjxStringUtil.htmlEncode(e)
}
h.setMessage(e,o,DwtMessageDialog.CRITICAL_STYLE,ZmMsg.zimbraTitle);
h.popup(null,d);
if(c){
h.showDetail()
}};
ZmController.handleScriptError=function(t){
var s=[];
var o="<br/>";
if(t){
var n=ZmMsg.scriptError+": "+t.message;
var e=t.fileName&&t.fileName.match(/(w+.js)/);
if(e&&e.length){
n+=" - "+e[1]+":"+t.lineNumber
}
if(t.fileName){
s.push("File: "+t.fileName)
}
if(t.lineNumber){
s.push("Line: "+t.lineNumber)
}
if(t.name){
s.push("Error: "+t.name)
}
if(t.stack){
s.push("Stack: "+t.stack.replace("
",o,"g"))
}}
var a=s.join(o);
AjxDebug.println(AjxDebug.EXCEPTION,[n,a].join(o+o));
appCtxt.getAppController().popupErrorDialog(n,a,null,false,true)
};
ZmController.prototype.setCurrentView=function(e){
this._currentView=e
};
ZmController.prototype.getCurrentView=function(){
return this._currentView
};
ZmController.prototype.getKeyMapName=function(){
return"Global"
};
ZmController.prototype.handleKeyAction=function(l){
var a=this.getTabView?this.getTabView():null;
if(a&&a.handleKeyAction(l)){
return true
}
var e=ZmApp.ACTION_CODES_R[l];
if(e){
var n=ZmApp.ACTION_CODES[l];
if(n){
appCtxt.getApp(e).handleOp(n);
return true
}}
switch(l){
case ZmKeyMap.NEW:e=appCtxt.getCurrentAppName();
var r=ZmApp.NEW_ACTION_CODE[e];
if(r){
var n=ZmApp.ACTION_CODES[r];
if(n){
appCtxt.getApp(e).handleOp(n);
return true
}}
break;
case ZmKeyMap.NEW_FOLDER:case ZmKeyMap.NEW_TAG:var n=ZmApp.ACTION_CODES[l];
if(n){
this._newListener(null,n)
}
break;
case ZmKeyMap.SAVED_SEARCH:var s=appCtxt.getFolderTree().getByType(ZmOrganizer.SEARCH);
if(s&&s.length>0){
var h=appCtxt.getChooseFolderDialog();
var o={
treeIds:[ZmOrganizer.SEARCH],overviewId:h.getOverviewId(ZmOrganizer.SEARCH),title:ZmMsg.selectSearch};
ZmController.showDialog(h,new AjxCallback(null,ZmController._searchSelectionCallback,[h]),o)
}
break;
case ZmKeyMap.VISIT:var h=appCtxt.getChooseFolderDialog();
var t=ZmApp.ORGANIZER[this._app._name]||ZmOrganizer.FOLDER;
var o={
treeIds:[t],overviewId:h.getOverviewId(ZmOrganizer.APP[t]),appName:this._app._name,title:AjxMessageFormat.format(ZmMsg.goToFolder,ZmMsg[ZmOrganizer.MSG_KEY[t]])};
ZmController.showDialog(h,new AjxCallback(null,ZmController._visitOrgCallback,[h,t]),o);
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(t,e){
if(e){
appCtxt.getSearchController().redoSearch(e.search)
}
t.popdown()
};
ZmController._visitOrgCallback=function(t,a,o){
if(o){
var e=appCtxt.getOverviewController().getTreeController(a);
if(e&&e._itemClicked){
e._itemClicked(o)
}}
t.popdown()
};
ZmController.prototype.mapSupported=function(e){
return false
};
ZmController.prototype._newListener=function(a,n){
switch(n){
case ZmOperation.NEW_FOLDER:var o=appCtxt.getCurrentView();
var t=o.getMailListView?o.getMailListView():null;
var e=t&&t.getFolder?t.getFolder():null;
ZmController.showDialog(appCtxt.getNewFolderDialog(),this.getNewFolderCallback(),e);
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(s,o,t,a){
var n=appCtxt.getNewFolderDialog();
n.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.FOLDER)._doCreate(s,o,t,a)
};
ZmController.prototype._newTagCallback=function(t){
appCtxt.getNewTagDialog().popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.TAG)._doCreate(t)
};
ZmController.prototype._createTabGroup=function(e){
e=e?e:this.toString();
this._tabGroup=new DwtTabGroup(e);
return this._tabGroup
};
ZmController.prototype._setTabGroup=function(e){
this._tabGroup=e
};
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 t=appCtxt.getRootTabGroup().getFocusMember();
var e=this.getTabGroup();
this._savedFocusMember=(t&&e&&e.contains(t))?t:null;
return this._savedFocusMember
};
ZmController.prototype._restoreFocus=function(n,r){
var a=appCtxt.getRootTabGroup();
var t=appCtxt.getCurrentApp();
var s=t&&t.getOverviewId();
var o=s&&appCtxt.getOverviewController().getOverview(s);
if(a&&o&&(o!=ZmController._currentOverview)){
a.replaceMember(ZmController._currentOverview,o,false,false,null,true);
ZmController._currentOverview=o
}
var e=this.getTabGroup();
n=n||this._savedFocusMember||this._getDefaultFocusItem()||a.getFocusMember();
r=r||ZmController.noFocus;
ZmController.noFocus=false;
if(a&&e&&(e!=ZmController._currentAppViewTabGroup)){
a.replaceMember(ZmController._currentAppViewTabGroup,e,false,false,n,r);
ZmController._currentAppViewTabGroup=e
}else{
if(n&&!r){
appCtxt.getKeyboardMgr().grabFocus(n)
}}};
ZmController.prototype._getDefaultFocusItem=function(){
var e=this.getTabGroup();
return e?e.getFirstMember(true):null
};
ZmController.prototype._preHideCallback=function(){
this._saveFocus();
return true
};
ZmController.prototype._postShowCallback=function(){
this._restoreFocus();
return true
};
ZmController.prototype._handleError=function(t,e){
this._handleException(t,e)
};
ZmController.prototype._handleException=function(s,o){
if(s.code==AjxSoapException.INVALID_PDU){
s.code=ZmCsfeException.SVC_FAILURE;
s.detail=["contact your administrator (",s.msg,")"].join("");
s.msg="Service failure"
}
if(s.code==ZmCsfeException.SVC_AUTH_EXPIRED||s.code==ZmCsfeException.SVC_AUTH_REQUIRED||s.code==ZmCsfeException.NO_AUTH_TOKEN||s.code==ZmCsfeException.AUTH_TOKEN_CHANGED){
ZmCsfeCommand.noAuth=true;
ZmZimbraMail.logOff(null,true);
return
}
if(s.code==ZmCsfeException.AUTH_TOKEN_CHANGED){
var r=AjxSoapDoc.create("GetInfoRequest","urn:zimbraAccount");
var e=r.getMethod();
e.setAttribute("sections","mbox");
var d=new AjxCallback(this,this._handleResponseGetInfo);
var a={
soapDoc:r,asyncMode:true,callback:d,skipAuthCheck:true};
ZmCsfeCommand._oldSessionId=ZmCsfeCommand._sessionId;
appCtxt.getAppController().sendRequest(a);
return
}
if(s.code==ZmCsfeException.MAIL_NO_SUCH_MSG){
var h=appCtxt.getCurrentViewId();
if(h==ZmId.VIEW_CONVLIST||h==ZmId.VIEW_TRAD){
var c=appCtxt.getApp(ZmApp.MAIL);
var l=appCtxt.isOffline?new AjxCallback(this,this._handleMailSearch,c):null;
c.mailSearch(null,l);
return
}}
if(s.method!="NoOpRequest"){
var n;
if(s.code==ZmCsfeException.MAIL_NO_SUCH_ITEM){
n=s.data.itemId
}else{
if(s.code==ZmCsfeException.MAIL_SEND_FAILURE){
n=s.code
}else{
if(s.code==ZmCsfeException.MAIL_INVALID_NAME){
n=s.data.name
}}}
if(s.lineNumber&&!s.detail){
ZmController.handleScriptError(s)
}else{
var t=s.getErrorMsg?s.getErrorMsg(n):s.msg?s.msg:s.message;
this.popupErrorDialog(t,s,true,this._hideSendReportBtn(s))
}}};
ZmController.prototype._handleMailSearch=function(e){
if(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)){
e.getOverviewContainer().highlightAllMboxes()
}};
ZmController.prototype._handleLogin=function(t,e){
var a=appCtxt.get(ZmSetting.LOGIN_URL);
if(a){
ZmZimbraMail.sendRedirect(a);
return
}
var s=appCtxt.getUsername();
if(!s||appCtxt.isOffline){
ZmZimbraMail.logOff();
return
}
this._authenticating=true;
var n=appCtxt.getLoginDialog();
n.registerCallback(this._loginCallback,this,[e]);
n.setVisible(true,false);
try{
n.setFocus(s,t)
}
catch(o){}};
ZmController.prototype._loginCallback=function(e,o,t,a){
this._doAuth(e,o,t,a)
};
ZmController.prototype._doAuth=function(e,s,t,n){
var a=new ZmAuthenticate();
var o=new AjxCallback(this,this._handleResponseDoAuth,[e,n]);
a.execute(s,t,o)
};
ZmController.prototype._handleResponseDoAuth=function(t,s,e){
try{
var e=e.getResponse();
this._authenticating=false;
appCtxt.rememberMe=s;
if(t){
if(t.continueCallback){
t.continueCallback.run()
}else{
t.resend=ZmCsfeCommand.REAUTH;
appCtxt.getRequestMgr().sendRequest(t)
}
this._hideLoginDialog()
}else{
window.onbeforeunload=null;
var a=AjxUtil.formatUrl();
ZmZimbraMail.sendRedirect(a)
}}
catch(n){
var o=appCtxt.getLoginDialog();
if(n.code==ZmCsfeException.ACCT_AUTH_FAILED||n.code==ZmCsfeException.SVC_INVALID_REQUEST){
o.setError(ZmMsg.loginError)
}else{
if(n.code==ZmCsfeException.ACCT_MAINTENANCE_MODE){
o.setError(ZmMsg.errorMaintenanceMode+" "+ZmMsg.errorContact)
}else{
this.popupErrorDialog(ZmMsg.errorGeneric,n)
}}}};
ZmController.prototype._hideLoginDialog=function(){
var e=appCtxt.getLoginDialog();
e.setVisible(false);
e.setError(null);
e.clearPassword()
};
ZmController.prototype._handleResponseGetInfo=function(e){
var a=e.getResponse();
var n=a.GetInfoResponse;
if(appCtxt.isOffline){
if(location.search.indexOf("offlineHack")!=-1){
var s="old user: "+appCtxt.getUsername()+"
old session ID: "+ZmCsfeCommand._oldSessionId+"
new user: "+n.name+"
new session ID: "+ZmCsfeCommand._sessionId+"
";
alert(s)
}}else{
if(n.name!=appCtxt.getUsername()){
ZmCsfeCommand.noAuth=true;
var o=appCtxt.getLoginDialog();
o.setError(ZmMsg.authChanged);
var t=false;
o.setReloginMode(t);
this._handleLogin(t)
}else{}}};
ZmController.prototype._hideSendReportBtn=function(e){
return(e.code==ZmCsfeException.MAIL_TOO_MANY_TERMS||e.code==ZmCsfeException.MAIL_MAINTENANCE_MODE||e.code==ZmCsfeException.MAIL_MESSAGE_TOO_BIG||e.code==ZmCsfeException.NETWORK_ERROR||e.code==ZmCsfeException.EMPTY_RESPONSE||e.code==ZmCsfeException.BAD_JSON_RESPONSE||e.code==ZmCsfeException.TOO_MANY_TAGS||e.code==ZmCsfeException.OFFLINE_ONLINE_ONLY_OP)
};
ZmController.prototype._errorDialogCallback=function(){
appCtxt.getErrorDialog().popdown()
};
ZmController.showDialog=function(e,o,a,t){
e.reset(t);
e.registerCallback(DwtDialog.OK_BUTTON,o);
e.popup(a,t)
};
ZmController.prototype._clearDialog=function(e){
e.popdown();
this._pendingActionData=null
};
ZmController.prototype._menuPopdownActionListener=function(){};
ZmController.prototype.setSessionId=function(e,t){
this.sessionId=t;
this.viewId=[e,this.sessionId].join("");
this.tabId=["tab",this.viewId].join("_")
};
ZmController.prototype.isTransient=function(e,t){
return false
};
ZmController.prototype._setSearchToolbarVisibilityPerSkin=function(t){
if(!appCtxt.getSkinHint("hideSearchInCompose")){
return
}
if(!t){
appCtxt.getSearchController().showBrowseView(false,null,true)
}
var e=document.getElementById(ZmId.SEARCH_TOOLBAR);
if(!e){
return
}
e.style.display=t?"block":"none"
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmListController")){
ZmListController=function(e,t){
if(arguments.length==0){
return
}
ZmController.call(this,e,t);
this._toolbar={};
this._navToolBar={};
this._listView={};
this._tabGroups={};
this._list=null;
this._actionMenu=null;
this._actionEv=null;
this._activeSearch=null;
this._tagList=appCtxt.getTagTree();
if(this._tagList){
this._tagChangeLstnr=new AjxListener(this,this._tagChangeListener);
this._tagList.addChangeListener(this._tagChangeLstnr)
}
this._listeners={};
this._listeners[ZmOperation.NEW_MENU]=new AjxListener(this,this._newListener);
this._listeners[ZmOperation.TAG_MENU]=new AjxListener(this,this._tagButtonListener);
this._listeners[ZmOperation.TAG]=new AjxListener(this,this._tagListener);
this._listeners[ZmOperation.PRINT]=new AjxListener(this,this._printListener);
this._listeners[ZmOperation.DELETE]=new AjxListener(this,this._deleteListener);
this._listeners[ZmOperation.CLOSE]=new AjxListener(this,this._backListener);
this._listeners[ZmOperation.MOVE]=new AjxListener(this,this._moveListener);
this._listeners[ZmOperation.SEARCH]=new AjxListener(this,this._participantSearchListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._participantBrowseListener);
this._listeners[ZmOperation.NEW_MESSAGE]=new AjxListener(this,this._participantComposeListener);
if(window.ZmImApp){
this._listeners[ZmOperation.IM]=ZmImApp.getImMenuItemListener()
}
this._listeners[ZmOperation.CONTACT]=new AjxListener(this,this._participantContactListener);
this._listeners[ZmOperation.VIEW]=new AjxListener(this,this._viewMenuItemListener);
this._menuPopdownListener=new AjxListener(this,this._menuPopdownActionListener);
this._dropTgt=new DwtDropTarget("ZmTag");
this._dropTgt.markAsMultiple();
this._dropTgt.addDropListener(new AjxListener(this,this._dropListener));
this._itemCountText={};
this._continuation={
count:0,totalItems:0}
};
ZmListController.prototype=new ZmController;
ZmListController.prototype.constructor=ZmListController;
ZmListController.CONTINUATION_SEARCH_ITEMS=500;
ZmListController.prototype.toString=function(){
return"ZmListController"
};
ZmListController.prototype.show=function(t,e){
this._currentView=e||this._defaultView();
this._activeSearch=t;
if(t){
this._currentSearch=t.search
}
this.currentPage=1;
this.maxPage=1
};
ZmListController.prototype.getSearchString=function(){
return this._currentSearch?this._currentSearch.query:""
};
ZmListController.prototype.getSearchStringHint=function(){
return this._currentSearch?this._currentSearch.queryHint:""
};
ZmListController.prototype.getSelection=function(e){
e=e||this.getCurrentView();
return e?e.getSelection():[]
};
ZmListController.prototype.getSelectionCount=function(e){
e=e||this.getCurrentView();
return e?e.getSelectionCount():0
};
ZmListController.prototype.getCurrentView=function(){
return this._listView[this._currentView]
};
ZmListController.prototype.getCurrentToolbar=function(){
return this._toolbar[this._currentView]
};
ZmListController.prototype.getList=function(){
return this._list
};
ZmListController.prototype.setList=function(e){
if(e!=this._list&&(e instanceof ZmList)){
if(this._list){
this._list.clear()
}
this._list=e
}};
ZmListController.prototype.setHasMore=function(e){
if(e){
this._list.setHasMore(e);
this._resetNavToolBarButtons(this._currentView)
}};
ZmListController.prototype.handleKeyAction=function(s){
var a=this._listView[this._currentView];
switch(s){
case DwtKeyMap.DBLCLICK:return a.handleKeyAction(s);
case ZmKeyMap.DEL:var t=this._toolbar[this._currentView];
var n=t&&(t.getButton(ZmOperation.DELETE)||t.getButton(ZmOperation.DELETE_MENU));
if(n&&n.getEnabled()){
this._doDelete(this.getSelection())
}
break;
case ZmKeyMap.FLAG:this._doFlag(this.getSelection());
break;
case ZmKeyMap.MOVE:this._moveListener();
break;
case ZmKeyMap.NEXT_PAGE:var e=this._navToolBar[this._currentView];
var n=e?e.getButton(ZmOperation.PAGE_FORWARD):null;
if(n&&n.getEnabled()){
this._paginate(this._currentView,true)
}
break;
case ZmKeyMap.PREV_PAGE:var e=this._navToolBar[this._currentView];
var n=e?e.getButton(ZmOperation.PAGE_BACK):null;
if(n&&n.getEnabled()){
this._paginate(this._currentView,false)
}
break;
case ZmKeyMap.PRINT:if(appCtxt.get(ZmSetting.PRINT_ENABLED)){
this._printListener()
}
break;
case ZmKeyMap.TAG:var o=this.getSelection();
if(o&&o.length&&(appCtxt.getTagTree().size()>0)){
var r=appCtxt.getPickTagDialog();
ZmController.showDialog(r,new AjxCallback(this,this._tagSelectionCallback,[o,r]))
}
break;
case ZmKeyMap.UNTAG:if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){
var o=this.getSelection();
if(o&&o.length){
this._doRemoveAllTags(o)
}}
break;
default:return ZmController.prototype.handleKeyAction.call(this,s)
}
return true
};
ZmListController.prototype._createNewView=function(){};
ZmListController.prototype._getViewType=function(){};
ZmListController.prototype._defaultView=function(){
return this._getViewType()
};
ZmListController.prototype._setViewContents=function(e){};
ZmListController.prototype._getTagMenuMsg=function(e){};
ZmListController.prototype._getMoveDialogTitle=function(e){};
ZmListController.prototype._getToolBarOps=function(){};
ZmListController.prototype._getActionMenuOps=function(){};
ZmListController.prototype._setup=function(e){
this._initialize(e);
this._resetOperations(this._toolbar[e],0)
};
ZmListController.prototype._initialize=function(e){
this._initializeToolBar(e);
this._initializeListView(e);
this._initializeTabGroup(e)
};
ZmListController.prototype._standardToolBarOps=function(){
return[ZmOperation.NEW_MENU,ZmOperation.SEP,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.PRINT]
};
ZmListController.prototype._standardActionMenuOps=function(){
return[ZmOperation.TAG_MENU,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.PRINT]
};
ZmListController.prototype._participantOps=function(){
var e=[ZmOperation.SEARCH_MENU,ZmOperation.BROWSE];
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){
e.push(ZmOperation.NEW_MESSAGE)
}
if(appCtxt.get(ZmSetting.IM_ENABLED)){
e.push(ZmOperation.IM)
}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
e.push(ZmOperation.CONTACT)
}
return e
};
ZmListController.prototype._initializeToolBar=function(t){
if(this._toolbar[t]){
return
}
var n=this._getToolBarOps();
if(!n){
return
}
var e=this._toolbar[t]=new ZmButtonToolBar({
parent:this._container,buttons:n,context:t,controller:this,refElementId:ZmId.SKIN_APP_TOP_TOOLBAR}
);
var o;
for(var a=0;
a<e.opList.length;
a++){
o=e.opList[a];
if(this._listeners[o]){
e.addSelectionListener(o,this._listeners[o])
}}
o=e.getButton(ZmOperation.PRINT);
if(o){
o.setText(null)
}
o=e.getButton(ZmOperation.MOVE);
if(o){
o.setText(null)
}
o=e.getButton(ZmOperation.NEW_MENU);
if(o){
var s=new AjxListener(e,ZmListController._newDropDownListener);
o.addDropDownSelectionListener(s);
e._ZmListController_this=this;
e._ZmListController_newDropDownListener=s
}
o=e.getButton(ZmOperation.TAG_MENU);
if(o){
o.noMenuBar=true;
this._setupTagMenu(e)
}
appCtxt.notifyZimlets("initializeToolbar",[this._app,e,this,t],{
waitUntilLoaded:true}
)
};
ZmListController.prototype._initializeListView=function(e){
if(this._listView[e]){
return
}
this._listView[e]=this._createNewView(e);
this._listView[e].addSelectionListener(new AjxListener(this,this._listSelectionListener));
this._listView[e].addActionListener(new AjxListener(this,this._listActionListener))
};
ZmListController.prototype._initializeActionMenu=function(){
if(this._actionMenu){
return
}
var e=this._getActionMenuOps();
if(!e){
return
}
this._actionMenu=new ZmActionMenu({
parent:this._shell,menuItems:e,context:this._getMenuContext(),controller:this}
);
this._addMenuListeners(this._actionMenu);
if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){
this._setupTagMenu(this._actionMenu)
}};
ZmListController.prototype._addMenuListeners=function(o){
var t=o.opList;
for(var e=0;
e<t.length;
e++){
var a=t[e];
if(this._listeners[a]){
o.addSelectionListener(a,this._listeners[a],0)
}}
o.addPopdownListener(this._menuPopdownListener)
};
ZmListController.prototype._initializeTabGroup=function(e){
if(this._tabGroups[e]){
return
}
this._tabGroups[e]=this._createTabGroup();
this._tabGroups[e].newParent(appCtxt.getRootTabGroup());
this._toolbar[e].noFocus=true;
this._tabGroups[e].addMember(this._listView[e].getTabGroupMember())
};
ZmListController.prototype._setView=function(a){
var e=a.view;
if(!this._appViews[e]){
var t={};
t[ZmAppViewMgr.CB_PRE_HIDE]=this._preHideCallback?new AjxCallback(this,this._preHideCallback):null;
t[ZmAppViewMgr.CB_PRE_UNLOAD]=this._preUnloadCallback?new AjxCallback(this,this._preUnloadCallback):null;
t[ZmAppViewMgr.CB_POST_HIDE]=this._postHideCallback?new AjxCallback(this,this._postHideCallback):null;
t[ZmAppViewMgr.CB_PRE_SHOW]=this._preShowCallback?new AjxCallback(this,this._preShowCallback):null;
t[ZmAppViewMgr.CB_POST_SHOW]=this._postShowCallback?new AjxCallback(this,this._postShowCallback):null;
a.callbacks=t;
a.viewId=e;
this._app.createView(a);
this._appViews[e]=1
}
if(!a.pushOnly){
this._setViewContents(e)
}
if(a.stageView){
this._app.stageView(e)
}else{
return(a.clear?this._app.setView(e):this._app.pushView(e))
}};
ZmListController.prototype._listSelectionListener=function(e){
if(e.field==ZmItem.F_FLAG){
this._doFlag([e.item])
}else{
var t=this._listView[this._currentView];
if(appCtxt.get(ZmSetting.SHOW_SELECTION_CHECKBOX)){
if(!e.ctrlKey&&t.setSelectionHdrCbox){
t.setSelectionHdrCbox(false)
}}
this._resetOperations(this._toolbar[this._currentView],t.getSelectionCount())
}};
ZmListController.prototype._listActionListener=function(e){
this._actionEv=e;
var t=this.getActionMenu();
if(appCtxt.get(ZmSetting.TAGGING_ENABLED)){
this._setTagMenu(t)
}
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
this._setSearchMenu(t)
}
this._resetOperations(t,this.getSelectionCount())
};
ZmListController.prototype._menuPopdownActionListener=function(){
if(!this._pendingActionData){
this.getCurrentView().handleActionPopdown()
}};
ZmListController.prototype._newListener=function(o,r,s){
if(!o&&!r){
return
}
r=r||o.item.getData(ZmOperation.KEY_ID);
if(!r||r==ZmOperation.NEW_MENU){
r=this._defaultNewId
}
var t=ZmApp.OPS_R[r];
var n=t&&appCtxt.getApp(t);
if(n){
s=s||{};
s.ev=o;
if(!s.folderId&&appCtxt.multiAccounts){
var e=appCtxt.getFolderTree(appCtxt.getActiveAccount()||appCtxt.accountList.defaultAccount);
var a=n.getDefaultFolderId&&n.getDefaultFolderId(r);
if(a){
s.folderId=e.getById(a).id
}}
n.handleOp(r,s)
}else{
ZmController.prototype._newListener.call(this,o,r)
}};
ZmListController.prototype._tagButtonListener=function(t){
var e=this._toolbar[this._currentView];
if(t.item.parent==e){
this._setTagMenu(e)
}};
ZmListController.prototype._tagListener=function(a,t){
var e=appCtxt.getAppViewMgr().getCurrentViewId();
if(e==this._getViewType()||e==ZmId.VIEW_MIXED){
var s=a.getData(ZmTagMenu.KEY_TAG_EVENT);
var n=a.getData(ZmTagMenu.KEY_TAG_ADDED);
t=t||this.getSelection();
if(s==ZmEvent.E_TAGS&&n){
this._doTag(t,a.getData(Dwt.KEY_OBJECT),true)
}else{
if(s==ZmEvent.E_CREATE){
this._pendingActionData=t;
var o=appCtxt.getNewTagDialog();
if(!this._newTagCb){
this._newTagCb=new AjxCallback(this,this._newTagCallback)
}
ZmController.showDialog(o,this._newTagCb);
o.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,o)
}else{
if(s==ZmEvent.E_TAGS&&!n){
this._doTag(t,a.getData(Dwt.KEY_OBJECT),false)
}else{
if(s==ZmEvent.E_REMOVE_ALL){
this._doRemoveAllTags(t)
}}}}}};
ZmListController.prototype._tagSelectionCallback=function(t,a,e){
if(e){
this._doTag(t,e,true)
}
a.popdown()
};
ZmListController.prototype._printListener=function(a){
var e=this.getSelection();
var t=(e instanceof Array)?e[0]:e;
if(t){
window.open(t.getRestUrl(),"_blank")
}};
ZmListController.prototype._backListener=function(e){
this._app.popView()
};
ZmListController.prototype._deleteListener=function(e){
this._doDelete(this.getSelection())
};
ZmListController.prototype._moveListener=function(e,a){
this._pendingActionData=a||(this.getSelection());
var t=appCtxt.getChooseFolderDialog();
if(!this._moveCb){
this._moveCb=new AjxCallback(this,this._moveCallback)
}
ZmController.showDialog(t,this._moveCb,this._getMoveParams(t));
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmListController.prototype._getMoveParams=function(e){
var t=ZmApp.ORGANIZER[this._app._name]||ZmOrganizer.FOLDER;
return{
overviewId:e.getOverviewId(this._app._name),data:this._pendingActionData,treeIds:[t],title:AjxStringUtil.htmlEncode(this._getMoveDialogTitle(this._pendingActionData.length)),description:ZmMsg.targetFolder,treeStyle:DwtTree.SINGLE_STYLE,appName:this._app._name}
};
ZmListController.prototype._viewMenuItemListener=function(e){
if(e.detail==DwtMenuItem.CHECKED||e.detail==DwtMenuItem.UNCHECKED){
this.switchView(e.item.getData(ZmOperation.MENUITEM_ID))
}};
ZmListController.prototype._navBarListener=function(t){
var e=appCtxt.getAppViewMgr().getCurrentViewId();
if(e!=this._getViewType()&&e!=ZmId.VIEW_MIXED){
return
}
var a=t.item.getData(ZmOperation.KEY_ID);
if(a==ZmOperation.PAGE_BACK||a==ZmOperation.PAGE_FORWARD){
this._paginate(this._currentView,(a==ZmOperation.PAGE_FORWARD))
}};
ZmListController.prototype._participantSearchListener=function(a){
var t=this._getSearchFolder();
if(t&&(t.nId==ZmFolder.ID_SENT||t.nId==ZmFolder.ID_DRAFTS)){
var o=this._actionEv.item.getAddresses(AjxEmailAddress.CC).getArray();
var n=this._actionEv.item.getAddresses(AjxEmailAddress.TO).getArray();
var e=n.concat(o);
appCtxt.getSearchController().fromSearch(e)
}else{
var e=this._actionEv.address.getAddress();
appCtxt.getSearchController().fromSearch(e)
}};
ZmListController.prototype._participantSearchToListener=function(a){
var t=this._getSearchFolder();
if(t&&(t.nId==ZmFolder.ID_SENT||t.nId==ZmFolder.ID_DRAFTS)){
var n=this._actionEv.item.getAddresses(AjxEmailAddress.TO).getArray();
var o=this._actionEv.item.getAddresses(AjxEmailAddress.CC).getArray();
var e=n.concat(o).concat(o);
appCtxt.getSearchController().toSearch(e)
}else{
var e=this._actionEv.address.getAddress();
appCtxt.getSearchController().toSearch(e)
}};
ZmListController.prototype._participantBrowseListener=function(t){
var e=this._actionEv.address.getAddress();
appCtxt.getSearchController().fromBrowse(e)
};
ZmListController.prototype._participantComposeListener=function(t){
var e=this._actionEv.address.toString()+AjxEmailAddress.SEPARATOR;
AjxDispatcher.run("Compose",{
action:ZmOperation.NEW_MESSAGE,inNewWindow:this._app._inNewWindow(t),toOverride:e}
)
};
ZmListController.prototype._participantContactListener=function(t){
var e=new AjxCallback(this,this._handleLoadParticipantContactListener);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,true)
};
ZmListController.prototype._handleLoadParticipantContactListener=function(){
var o=AjxDispatcher.run("GetContactController");
if(this._actionEv.contact){
if(this._actionEv.contact.isLoaded){
var t=this._actionEv.contact.isGal;
o.show(this._actionEv.contact,t)
}else{
var a=new AjxCallback(this,this._loadContactCallback);
this._actionEv.contact.load(a)
}}else{
var e=this._createNewContact(this._actionEv);
o.show(e,true)
}};
ZmListController.prototype._createNewContact=function(t){
var e=new ZmContact(null);
e.initFromEmail(t.address);
return e
};
ZmListController.prototype._loadContactCallback=function(t,e){
AjxDispatcher.run("GetContactController").show(e)
};
ZmListController.prototype._dragListener=function(e){
if(e.action==DwtDragEvent.SET_DATA){
e.srcData={
data:e.srcControl.getDnDSelection(),controller:this}
}};
ZmListController.prototype._dropListener=function(r){
var h=this._listView[this._currentView];
var e=h.getTargetItemDiv(r.uiEvent);
var c=h.getItemFromElement(e);
var o=r.srcData.data;
if(r.action==DwtDropEvent.DRAG_ENTER){
r.doIt=(c&&(c instanceof ZmItem)&&!c.isShared()&&this._dropTgt.isValidTarget(o));
if(appCtxt.multiAccounts){
var l=c?c.getAccount().id:null;
var n=(o.account&&o.account.id)||o[0].account.id;
if(l!=n){
r.doIt=false
}}
if(r.doIt){
h.dragSelect(e)
}}else{
if(r.action==DwtDropEvent.DRAG_DROP){
h.dragDeselect(e);
var s=[c];
var t=this.getSelection();
if(t.length){
var a=AjxVector.fromArray(t);
if(a.contains(c)){
s=t
}}
this._doTag(s,o,true)
}else{
if(r.action==DwtDropEvent.DRAG_LEAVE){
h.dragDeselect(e)
}else{
if(r.action==DwtDropEvent.DRAG_OP_CHANGED){}}}}};
ZmListController.prototype._tagChangeListener=function(a){
var t=appCtxt.getAppViewMgr().getCurrentViewId();
if(t==this._getViewType()||t==ZmId.VIEW_MIXED){
if(a.type==ZmEvent.S_TAG&&a.event==ZmEvent.E_CREATE&&this._pendingActionData){
var e=a.getDetail("organizers")[0];
this._doTag(this._pendingActionData,e,true);
this._pendingActionData=null;
this._menuPopdownActionListener()
}}};
ZmListController.prototype._moveCallback=function(e){
this._doMove(this._pendingActionData,e);
this._clearDialog(appCtxt.getChooseFolderDialog());
this._pendingActionData=null
};
ZmListController.prototype._doFlag=function(a,t){
a=AjxUtil.toArray(a);
if(!a.length){
return
}
if(a[0] instanceof ZmItem){
if(t!==true&&t!==false){
t=!a[0].isFlagged
}
var e=[];
for(var o=0;
o<a.length;
o++){
if(a[o].isFlagged!=t){
e.push(a[o])
}}}else{
e=a
}
var s={
items:e,op:"flag",value:t};
s.actionText=t?ZmMsg.actionFlag:ZmMsg.actionUnflag;
var n=this._setupContinuation(this._doFlag,[t],s);
n.flagItems(s)
};
ZmListController.prototype._doTag=function(t,e,n){
t=AjxUtil.toArray(t);
if(!t.length){
return
}
var o={
items:t,tag:e,doTag:n};
var a=this._setupContinuation(this._doTag,[e,n],o);
a.tagItems(o)
};
ZmListController.prototype._doRemoveAllTags=function(e){
e=AjxUtil.toArray(e);
if(!e.length){
return
}
var a={
items:e};
var t=this._setupContinuation(this._doRemoveAllTags,null,a);
t.removeAllTags(a)
};
ZmListController.prototype._doDelete=function(r,n,h){
r=AjxUtil.toArray(r);
if(!r.length){
return
}
var a={
items:r,hardDelete:n,attrs:h,childWin:appCtxt.isChildWindow&&window,closeChildWin:appCtxt.isChildWindow};
var l=new AjxCallback(this,this._checkItemCount);
var s=this._setupContinuation(this._doDelete,[n,h],a,l);
if(!n){
var e=false;
for(var o=0,t=r.length;
o<t;
o++){
if(r[o]&&r[o].isScheduled){
e=true;
break
}}
if(e){
a.noUndo=true;
this._popupScheduledWarningDialog(new AjxCallback(s,s.deleteItems,a))
}else{
s.deleteItems(a)
}}else{
s.deleteItems(a)
}};
ZmListController.prototype._doMove=function(c,a,u,h){
c=AjxUtil.toArray(c);
if(!c.length){
return
}
var n=[];
var t=[];
if(c[0] instanceof ZmItem){
for(var r=0;
r<c.length;
r++){
var m=c[r];
if(!m.folderId||(m.folderId!=a.id||(u&&u.op=="recover"))){
if(!this._isItemMovable(m,h,a)){
t.push(m)
}else{
n.push(m)
}}}}else{
n=c
}
var s={
folder:a,attrs:u};
s.errorCallback=new AjxCallback(this,this._actionErrorCallback);
var f=new AjxCallback(this,this._checkItemCount);
if(n.length){
s.items=n;
var l=this._setupContinuation(this._doMove,[a,u,h],s,f);
if(a.isInTrash()){
var e=false;
var d=AjxUtil.toArray(n);
for(var r=0,o=d.length;
r<o;
r++){
if(d[r]&&d[r].isScheduled){
e=true;
break
}}
if(e){
s.noUndo=true;
this._popupScheduledWarningDialog(new AjxCallback(l,l.moveItems,s))
}else{
l.moveItems(s)
}}else{
l.moveItems(s)
}}
if(t.length){
s.items=t;
var l=this._setupContinuation(this._doMove,[a,u,h],s,f);
l.copyItems(s)
}};
ZmListController.prototype._actionErrorCallback=function(e){
return false
};
ZmListController.prototype._popupScheduledWarningDialog=function(t){
var e=appCtxt.getOkCancelMsgDialog();
e.reset();
e.setMessage(ZmMsg.moveScheduledMessageWarning,DwtMessageDialog.WARNING_STYLE);
e.registerCallback(DwtDialog.OK_BUTTON,new AjxCallback(this,this._scheduledWarningDialogListener,[t,e]));
e.associateEnterWithButton(DwtDialog.OK_BUTTON);
e.popup(null,DwtDialog.OK_BUTTON)
};
ZmListController.prototype._scheduledWarningDialogListener=function(t,e){
e.popdown();
t.run()
};
ZmListController.prototype._isItemMovable=function(a,e,t){
return(!e&&!a.isReadOnly()&&!t.isReadOnly())
};
ZmListController.prototype._doModify=function(t,e){
var a=t.list||this._list;
a.modifyItem(t,e)
};
ZmListController.prototype._doCreate=function(t,e){
t.create(e)
};
ZmListController.prototype._propagateMenuListeners=function(n,h,s){
if(!n){
return
}
s=s||this._listeners[h];
var o=n.getOp(h);
if(o){
var r=o.getMenu();
var e=r.getItems();
var a=r.getItemCount();
for(var t=0;
t<a;
t++){
e[t].addSelectionListener(s)
}}};
ZmListController.prototype._setSearchMenu=function(e){
if(!e){
return
}
var t=e.getSearchMenu();
if(t){
t.addSelectionListener(ZmOperation.SEARCH,new AjxListener(this,this._participantSearchListener));
t.addSelectionListener(ZmOperation.SEARCH_TO,new AjxListener(this,this._participantSearchToListener))
}};
ZmListController.prototype._setupTagMenu=function(t){
if(!t){
return
}
var a=t.getTagMenu();
if(a){
a.addSelectionListener(this._listeners[ZmOperation.TAG])
}
if(t instanceof ZmButtonToolBar){
var e=t.getOp(ZmOperation.TAG_MENU);
if(e){
e.addDropDownSelectionListener(this._listeners[ZmOperation.TAG_MENU])
}}};
ZmListController.prototype._setTagMenu=function(o){
if(!o){
return
}
var a=o.getOp(ZmOperation.TAG_MENU);
if(a){
var s=o.getTagMenu();
var t=this.getSelection();
t=AjxUtil.toArray(t);
var n=(appCtxt.multiAccounts&&t.length==1)?t[0].getAccount():null;
s.set(t,appCtxt.getTagTree(n));
if(o instanceof ZmActionMenu){
a.setText(this._getTagMenuMsg(t.length))
}else{
s.parent.popup();
if(appCtxt.isChildWindow){
var e=s.getMenuItem(ZmTagMenu.MENU_ITEM_ADD_ID);
if(e){
e.setVisible(false)
}}}}};
ZmListController.prototype._setNewButtonProps=function(e,a,s,n,t){
var o=this._toolbar[e].getButton(ZmOperation.NEW_MENU);
if(o){
o.setToolTipContent(a);
o.setImage(s);
this._defaultNewId=t
}};
ZmListController.prototype._setContactText=function(t){
var e=t?ZmOperation.EDIT_CONTACT:ZmOperation.NEW_CONTACT;
var a=t?null:ZmMsg.AB_ADD_CONTACT;
ZmOperation.setOperation(this._toolbar[this._currentView],ZmOperation.CONTACT,e,ZmMsg.AB_ADD_CONTACT);
ZmOperation.setOperation(this.getActionMenu(),ZmOperation.CONTACT,e,a)
};
ZmListController.prototype._resetOperations=function(t,e){
if(!t){
return
}
if(e==0){
t.enableAll(false);
t.enable(ZmOperation.NEW_MENU,true)
}else{
if(e==1){
t.enableAll(true)
}else{
if(e>1){
t.enableAll(false);
t.enable([ZmOperation.NEW_MENU,ZmOperation.TAG_MENU,ZmOperation.DELETE,ZmOperation.MOVE,ZmOperation.FORWARD],true)
}}}
var a=(e>0)&&this._getSearchFolder();
if(a&&a.isRemote()){
t.enable(ZmOperation.TAG_MENU,false)
}};
ZmListController.prototype._resetToolbarOperations=function(){
this._resetOperations(this._toolbar[this._currentView],this.getSelectionCount())
};
ZmListController.prototype._getSearchFolderId=function(){
var e=this._activeSearch&&this._activeSearch.search;
return e&&e.singleTerm&&e.folderId
};
ZmListController.prototype._getSearchFolder=function(){
var e=this._getSearchFolderId();
return e&&appCtxt.getById(e)
};
ZmListController.prototype._cacheList=function(e,a){
if(this._list){
var t=e.getResults().getVector();
a=a?a:parseInt(e.getAttribute("offset"));
this._list.cache(a,t)
}else{
this._list=e.getResults(type)
}};
ZmListController.prototype._search=function(r,n,o,h,e,t,s){
var a={
query:this.getSearchString(),queryHint:this.getSearchStringHint(),types:((this._activeSearch&&this._activeSearch.search)?this._activeSearch.search.types:[]),sortBy:appCtxt.get(ZmSetting.SORTING_PREF,r),offset:n,limit:o,lastId:t,lastSortVal:s};
this._getMoreSearchParams(a);
var l=new ZmSearch(a);
if(e){
this._currentSearch=l
}
appCtxt.getSearchController().redoSearch(l,true,null,h)
};
ZmListController.prototype._paginate=function(c,r,s,o){
var a=false;
var t=this._listView[c];
var n,d;
o=o||t.getLimit(n);
if(t._isPageless){
n=this._list.size();
a=true
}else{
n=t.getNewOffset(r);
a=(n+o>this._list.size());
this.currentPage=this.currentPage+(r?1:-1);
this.maxPage=Math.max(this.maxPage,this.currentPage)
}
if(a&&this._list.hasMore()){
t.offset=n;
if(t._isPageless){
d=o
}else{
var m=(n+o)-this._list.size();
d=m<o&&m>0?m:o;
if(d<o){
n=((n+o)-d)+1
}}
if(this._searchPending){
return false
}
var l=t.getList();
var u=l&&l.getLast();
var h=(u&&u.id)?u.sf:null;
var e=h?u.id:null;
this._setItemCountText(ZmMsg.loading);
this._searchPending=true;
var f=new AjxCallback(this,this._handleResponsePaginate,[c,false,s,n]);
this._search(c,n,d,f,true,e,h);
return false
}else{
if(!t._isPageless){
t.offset=n;
this._resetOperations(this._toolbar[c],0);
this._resetNavToolBarButtons(c);
this._setViewContents(c);
this._resetSelection();
return true
}}};
ZmListController.prototype._handleResponsePaginate=function(m,o,r,s,p,e){
var c=p.getResponse();
this._list.setHasMore(c.getAttribute("more"));
this._cacheList(c,s);
var a=this._listView[this._currentView];
var l=a._isPageless?this.getSelectionCount():0;
this._resetOperations(this._toolbar[m],l);
var t=o?this.getSelection()[0]:null;
var n=t?a.getItemIndex(t):-1;
var u=c&&c.getResults().getArray();
if(a._isPageless&&u&&u.length){
a._itemsToAdd=u
}else{
a._itemsToAdd=null
}
var f=(a._isPageless&&(a.size()==0));
this._setViewContents(m);
if(a.allSelected){
for(var h=0,d=u.length;
h<d;
h++){
a.selectItem(u[h],true);
a.setSelectionCbox(u[h],false)
}
a.setSelectionHdrCbox(true)
}
this._resetNavToolBarButtons(m);
if(!e&&!a._isPageless){
this._resetSelection(n)
}else{
if(f){
a._setNextSelection()
}}
if(!appCtxt.isChildWindow){
appCtxt.getAppController().focusContentPane()
}
this._searchPending=false
};
ZmListController.prototype._getMoreSearchParams=function(e){};
ZmListController.prototype._checkReplenish=function(n){
var e=this.getCurrentView();
var o=e.getList();
var t=false;
if(o){
var a=e.getLimit()-e.size();
if(a>e.getReplenishThreshold()){
this._replenishList(this._currentView,a,n);
t=true
}}
if(n&&!t){
n.run()
}};
ZmListController.prototype._handleEmptyList=function(e){
if(this.currentPage>1){
this._paginate(this._currentView,false,0)
}else{
e.removeAll(true);
e._setNoResultsHtml();
this._resetNavToolBarButtons(this._currentView);
e._checkItemCount()
}};
ZmListController.prototype._replenishList=function(r,a,h){
var t=this._listView[r].offset+this._listView[r].size();
var l=this._list.size();
if(t<l){
var s=(s>l)?l:(t+a);
var n=this._list.getVector().getArray();
var o=n.slice(t,s);
var e=AjxVector.fromArray(o);
this._listView[r].replenish(e);
if(h){
h.run()
}}else{
this._getMoreToReplenish(r,a,h)
}};
ZmListController.prototype._resetSelection=function(t){
var a=this.getCurrentView().getList();
if(a){
var e=t>=0?t:0;
var o=a.get(e);
this._listView[this._currentView].setSelection(o,false)
}};
ZmListController.prototype._getMoreToReplenish=function(t,n,h){
if(this._list.hasMore()){
var o=this._listView[t].getList();
var a=o.getLast();
var e=(a&&a.id)?a.sf:null;
var s=e?a.id:null;
var r=new AjxCallback(this,this._handleResponseGetMoreToReplenish,[t,h]);
this._search(t,this._list.size(),n,r,false,s,e)
}else{
if(h){
h.run()
}}};
ZmListController.prototype._handleResponseGetMoreToReplenish=function(a,s,t){
var e=t.getResponse();
var o=e.getAttribute("more");
this._list.setHasMore(o);
this._cacheList(e);
var n=e.getResults().getVector();
this._listView[a].replenish(n);
this._toolbar[a].enable(ZmOperation.PAGE_FORWARD,o);
if(s){
s.run(t)
}};
ZmListController.prototype._initializeNavToolBar=function(t){
var e=new ZmNavToolBar({
parent:this._toolbar[t],context:t}
);
this._setNavToolBar(e,t)
};
ZmListController.prototype._setNavToolBar=function(t,e){
this._navToolBar[e]=t;
if(this._navToolBar[e]){
var a=new AjxListener(this,this._navBarListener);
this._navToolBar[e].addSelectionListener(ZmOperation.PAGE_BACK,a);
this._navToolBar[e].addSelectionListener(ZmOperation.PAGE_FORWARD,a)
}};
ZmListController.prototype._resetNavToolBarButtons=function(e){
var t=this._listView[e];
if(!t){
return
}
if(t._isPageless){
this._setItemCountText()
}
if(!this._navToolBar[e]){
return
}
this._navToolBar[e].enable(ZmOperation.PAGE_BACK,t.offset>0);
var a=false;
if(this._list){
a=this._list.hasMore();
if(!a&&((t.offset+t.getLimit())<this._list.size())){
a=true
}}
this._navToolBar[e].enable(ZmOperation.PAGE_FORWARD,a);
this._navToolBar[e].setText(this._getNavText(e))
};
ZmListController.prototype.enablePagination=function(t,e){
if(!this._navToolBar[e]){
return
}
if(t){
this._resetNavToolBarButtons(e)
}else{
this._navToolBar[e].enable([ZmOperation.PAGE_BACK,ZmOperation.PAGE_FORWARD],false)
}};
ZmListController.prototype._getNavText=function(e){
var o=this._getNavStartEnd(e);
if(!o){
return""
}
var a=this._getNumTotal();
var t=a?ZmMsg.navText2:ZmMsg.navText1;
return AjxMessageFormat.format(t,[o.start,o.end,a])
};
ZmListController.prototype._getNavStartEnd=function(a){
var n=this._listView[a];
var t=n.getLimit();
var o=this._list?this._list.size():0;
var s,e;
if(o>0){
s=n.offset+1;
e=Math.min(n.offset+t,o)
}
return(s&&e)?{
start:s,end:e}
:null
};
ZmListController.prototype._getNumTotal=function(){
var e=this._getSearchFolderId();
if(e&&(e!=ZmFolder.ID_TRASH)){
var t=appCtxt.getById(e);
if(t){
return t.numTotal
}}
return null
};
ZmListController._newDropDownListener=function(o){
var a=this;
var e=a._ZmListController_this;
e._propagateMenuListeners(a,ZmOperation.NEW_MENU);
var t=a.getButton(ZmOperation.NEW_MENU);
var n=a._ZmListController_newDropDownListener;
t.removeDropDownSelectionListener(n);
t.popup();
delete a._ZmListController_this;
delete a._ZmListController_newDropDownListener
};
ZmListController.prototype._getDefaultFocusItem=function(){
return this.getCurrentView()
};
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 t=this._getItemCount();
if(t==null){
return""
}
var h=this._listView[this._currentView];
var n=h&&h._list;
var a=h._getItemCountType();
var o=this._getNumTotal();
var e=o||t;
var s=a?AjxMessageFormat.format(ZmMsg[ZmItem.COUNT_KEY[a]],e):"";
if(o&&(t!=o)){
return AjxMessageFormat.format(ZmMsg.itemCount1,[t,o,s])
}else{
var r=t+(this._list.hasMore()?"+":"");
return AjxMessageFormat.format(ZmMsg.itemCount,[r,s])
}};
ZmListController.prototype._getItemCount=function(){
var t=this.getCurrentView();
var e=t&&t._list;
if(!e){
return null
}
return e.size()
};
ZmListController.prototype._setItemCountText=function(t){
t=t||this._getItemCountText();
var e=this._itemCountText[this._currentView];
if(e){
e.setText(t)
}};
ZmListController.prototype._setupContinuation=function(n,a,h,r){
var e=new AjxCallback(this,n,a);
h.finalCallback=new AjxCallback(this,this._continueAction,{
actionCallback:e,allDoneCallback:r}
);
h.count=this._continuation.count;
h.idsOnly=true;
var t=h.items||[];
var o=t[0];
var s=(o&&o.list)||this._list;
if(s&&(s.type==ZmItem.MIXED)&&o._mixedType){
s.type=o._mixedType
}
if(!this._continuation.lastItem){
this._continuation.lastItem=s.getVector().getLast();
this._continuation.totalItems=s.size()
}
return s
};
ZmListController.prototype._continueAction=function(o,t){
var a=this._listView[this._currentView];
var s=t&&t.cancelled;
var u=this._continuation.result;
var e=u?u.getAttribute("more"):this._list.hasMore();
if(a.allSelected&&e&&!s){
var r=this._currentSearch;
var n=ZmListController.CONTINUATION_SEARCH_ITEMS;
var c={
query:this.getSearchString(),queryHint:this.getSearchStringHint(),types:r.types,sortBy:r.sortBy,limit:n,idsOnly:true};
var h=u?u.getResults():this._list.getArray();
var l=this._continuation.lastItem;
if(!l){
l=h&&h[h.length-1]
}
if(l){
c.lastId=l.id;
c.lastSortVal=l.sf
}else{
c.offset=n+(this._continuation.search?this._continuation.search.offset:0)
}
this._continuation.count=t.numItems;
if(!this._continuation.totalItems){
this._continuation.totalItems=h.length
}
this._continuation.search=new ZmSearch(c);
var d=new AjxCallback(this,this._handleResponseContinueAction,[o.actionCallback]);
appCtxt.getSearchController().redoSearch(this._continuation.search,true,null,d)
}else{
if(u){
if(a.allSelected){
if(t.actionText){
t.actionSummary=ZmList.getActionSummary(t.actionText,this._continuation.totalItems,u.type,t.actionArg)
}
a.deselectAll()
}
this._continuation={
count:0,totalItems:0}
}
if(o.allDoneCallback){
o.allDoneCallback.run()
}
ZmList.killProgressDialog(t.actionSummary,t.actionLogItem,t.closeChildWin)
}};
ZmListController.prototype._handleResponseContinueAction=function(t,e){
this._continuation.result=e.getResponse();
var a=this._continuation.result.getResults();
if(a.length){
this._continuation.lastItem=a[a.length-1];
this._continuation.totalItems+=a.length;
t.args=t.args||[];
t.args.unshift(a);
t.run()
}else{}};
ZmListController.prototype._checkItemCount=function(){
var e=this._listView[this._currentView];
e._checkItemCount();
e._handleResponseCheckReplenish(true)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmTreeController")){
ZmTreeController=function(e){
if(arguments.length==0){
return
}
ZmController.call(this,null);
this.type=e;
this._opc=appCtxt.getOverviewController();
this._listeners={};
this._listeners[ZmOperation.DELETE]=new AjxListener(this,this._deleteListener);
this._listeners[ZmOperation.MOVE]=new AjxListener(this,this._moveListener);
this._listeners[ZmOperation.EXPAND_ALL]=new AjxListener(this,this._expandAllListener);
this._listeners[ZmOperation.MARK_ALL_READ]=new AjxListener(this,this._markAllReadListener);
this._listeners[ZmOperation.SYNC]=new AjxListener(this,this._syncListener);
this._listeners[ZmOperation.SYNC_ALL]=new AjxListener(this,this._syncAllListener);
this._listeners[ZmOperation.EDIT_PROPS]=new AjxListener(this,this._editPropsListener);
this._listeners[ZmOperation.EMPTY_FOLDER]=new AjxListener(this,this._emptyListener);
this._dragSrc=new DwtDragSource(Dwt.DND_DROP_MOVE);
this._dragSrc.addDragListener(new AjxListener(this,this._dragListener));
this._dropTgt=new DwtDropTarget(ZmTreeController.DROP_SOURCES[e]);
this._dropTgt.addDropListener(new AjxListener(this,this._dropListener));
this._treeView={};
this._hideEmpty={};
this._dataTree={}
};
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.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(t,r,n,a,e,o){
var s=t&&t.getOp(r);
if(!s){
return
}
if(n){
s.setText(n)
}
if(a){
s.setImage(a)
}
if(e!=null){
s.setEnabled(e)
}
if(o!=null){
s.setVisible(o)
}};
ZmTreeController.prototype._resetButtonPerSetting=function(a,o,t){
var e=a.getOp(o);
if(e){
if(t){
e.setVisible(true);
if(appCtxt.isOffline&&!appCtxt.getActiveAccount().isZimbraAccount){
e.setEnabled(false)
}}else{
e.setVisible(false)
}}};
ZmTreeController.prototype._enableRecoverDeleted=function(a,t){
op=a.getOp(ZmOperation.RECOVER_DELETED_ITEMS);
if(!op){
return
}
var e=appCtxt.get(ZmSetting.DUMPSTER_ENABLED);
op.setVisible(e&&t);
op.setEnabled(t)
};
ZmTreeController.prototype.toString=function(){
return"ZmTreeController"
};
ZmTreeController.prototype.show=function(s){
var r=s.overviewId;
this._hideEmpty[r]=s.hideEmpty;
if(!this._treeView[r]||s.forceCreate){
this._treeViewCreated=false;
this._treeView[r]=null;
this._treeView[r]=this.getTreeView(r,true)
}
var e=(appCtxt.multiAccounts&&this.type==ZmOrganizer.ZIMLET);
var a=e?appCtxt.accountList.mainAccount:(this.type==ZmOrganizer.VOICE?r:s.account);
var o=this.getDataTree(a);
if(o){
s.dataTree=o;
var t=ZmOrganizer.OPEN_SETTING[this.type];
s.collapsed=(!e&&(!(!t||(appCtxt.get(t,null,a)!==false))));
var n=this._opc.getOverview(r);
if(n.showNewButtons){
this._setupNewOp(s)
}
this._treeView[r].set(s);
this._checkTreeView(r)
}
if(!this._treeViewCreated){
this._treeViewCreated=true;
this._postSetup(r,s.account)
}
return this._treeView[r]
};
ZmTreeController.prototype.getTreeView=function(t,e){
if(e&&!this._treeView[t]){
this._treeView[t]=this._setup(t)
}
return this._treeView[t]
};
ZmTreeController.prototype.clearTreeView=function(e){
if(this._treeView[e]){
this._treeView[e].dispose();
delete this._treeView[e]
}};
ZmTreeController.prototype.getDropTarget=function(){
return this._dropTgt
};
ZmTreeController.prototype.getDataTree=function(e){
e=e||appCtxt.getActiveAccount();
var t=this._dataTree[e.id];
if(!t){
t=this._dataTree[e.id]=appCtxt.getTree(this.type,e);
if(t){
t.addChangeListener(this._getTreeChangeListener())
}}
return t
};
ZmTreeController.prototype.dispose=function(){
var e=appCtxt.getActiveAccount();
var t=this._dataTree[e.id];
if(!t){
return
}
t.removeChangeListener(this._getTreeChangeListener())
};
ZmTreeController.prototype.setVisibleIfExists=function(t,e,a){
var o=t.getOp(e);
if(!o){
return
}
o.setVisible(a)
};
ZmTreeController.prototype._setupNewOp=function(o){
var a=ZmOrganizer.NEW_OP[this.type];
if(a){
var t=ZmOperation.SETTING[a];
if(!t||appCtxt.get(t)){
var e=ZmOperation.getProp(a,"tooltipKey");
o.newButton={
image:ZmOperation.getProp(a,"image"),tooltip:e?ZmMsg[e]:null,callback:new AjxCallback(this,this._newListener)}
}}};
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(t){
var e=this._initializeTreeView(t);
if(this._opc.getOverview(t).actionSupported){
this._initializeActionMenus()
}
return e
};
ZmTreeController.prototype._postSetup=function(r,s){
var a=this.getTreeView(r);
if(!a.isCheckedStyle&&!ZmOrganizer.HAS_COLOR[this.type]){
return
}
var t=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,s);
var e=a.getTreeItemById(t);
if(!e){
return
}
if(a.isCheckedStyle){
e.showCheckBox(false)
}
var n=e.getItems();
for(var o=0;
o<n.length;
o++){
this._fixupTreeNode(n[o],null,a,true)
}};
ZmTreeController.prototype._fixupTreeNode=function(s,e,t,o){
if(s._isSeparator){
return
}
e=e||s.getData(Dwt.KEY_OBJECT);
if(e){
if(ZmOrganizer.HAS_COLOR[this.type]){
this._setTreeItemColor(s,e)
}
if(t.isCheckedStyle){
if((e.type==this.type&&t.isCheckedStyle)||e.nId==ZmOrganizer.ID_TRASH||e.nId==ZmOrganizer.ID_DRAFTS){
s.setChecked(e.isChecked,true)
}else{
s.showCheckBox(false);
s.enableSelection(true)
}}
this._expandTreeItem(s,o)
}
var n=s.getItems();
for(var a=0;
a<n.length;
a++){
this._fixupTreeNode(n[a],null,t,o)
}};
ZmTreeController.prototype._expandTreeItem=function(n,a){
var t=appCtxt.get(ZmSetting.FOLDERS_EXPANDED);
var e=n.getData(Dwt.KEY_ID);
var o=n.parent;
if(t[e]&&o&&(o instanceof DwtTreeItem)&&o.getExpanded()){
n.setExpanded(true,null,a)
}};
ZmTreeController.prototype._expandTreeItems=function(a){
if(a._isSeparator){
return
}
this._expandTreeItem(a);
var t=a.getItems();
for(var e=0;
e<t.length;
e++){
this._expandTreeItems(t[e])
}};
ZmTreeController.prototype._setTreeItemColor=function(t,e){
t.setImage(e.getIconWithColor())
};
ZmTreeController.prototype._getTreeItemColorClassName=function(a,e){
if(!a||!e){
return null
}
if(e.isInTrash()){
return null
}
var t=e.color?e.color:ZmOrganizer.DEFAULT_COLOR[e.type];
return(t&&(t!=ZmOrganizer.C_NONE))?ZmTreeController.COLOR_CLASS[t]:""
};
ZmTreeController.prototype._initializeTreeView=function(o){
var a=this._opc.getOverview(o);
var t={
parent:a,parentElement:a.getTreeParent(this.type),overviewId:o,type:this.type,headerClass:a.headerClass,dragSrc:(a.dndSupported?this._dragSrc:null),dropTgt:(a.dndSupported?this._dropTgt:null),treeStyle:a.treeStyle,isCheckedByDefault:a.isCheckedByDefault,allowedTypes:this._getAllowedTypes(),allowedSubTypes:this._getAllowedSubTypes()};
t.id=ZmId.getTreeId(o,t.type);
var e=this._createTreeView(t);
e.addSelectionListener(new AjxListener(this,this._treeViewListener));
e.addTreeListener(new AjxListener(this,this._treeListener));
return e
};
ZmTreeController.prototype._createTreeView=function(e){
return new ZmTreeView(e)
};
ZmTreeController.prototype._initializeActionMenus=function(){
var o=this;
var a=this._createActionMenu;
var t=this._getHeaderActionMenuOps();
if(!this._headerActionMenu&&t){
var e=[this._shell,t];
this._headerActionMenu=new AjxCallback(o,a,e)
}
var t=this._getActionMenuOps();
if(!this._actionMenu&&t){
var e=[this._shell,t];
this._actionMenu=new AjxCallback(o,a,e)
}};
ZmTreeController.prototype._getHeaderActionMenu=function(e){
if(this._headerActionMenu instanceof AjxCallback){
var t=this._headerActionMenu;
this._headerActionMenu=t.run()
}
return this._headerActionMenu
};
ZmTreeController.prototype._getActionMenu=function(a,t){
var e=this;
if(t&&t.type==ZmOrganizer.SEARCH){
e=this._opc.getTreeController(ZmOrganizer.SEARCH)
}
if(e._actionMenu instanceof AjxCallback){
var o=e._actionMenu;
e._actionMenu=o.run()
}
return e._actionMenu
};
ZmTreeController.prototype._sharingPossible=function(t){
if(appCtxt.isZDOnline()){
return true
}
var e=appCtxt.getMsgDialog();
e.setMessage(ZMsg["offline.ONLINE_ONLY_OP"]);
e.popup();
return false
};
ZmTreeController.prototype._createActionMenu=function(o,t){
if(!t){
return
}
var n=new ZmActionMenu({
parent:o,menuItems:t}
);
t=n.opList;
for(var e=0;
e<t.length;
e++){
var a=t[e];
if(this._listeners[a]){
n.addSelectionListener(a,this._listeners[a])
}}
n.addPopdownListener(new AjxListener(this,this._menuPopdownActionListener));
return n
};
ZmTreeController.prototype._getAllowedTypes=function(){
var e={};
e[this.type]=true;
return e
};
ZmTreeController.prototype._getAllowedSubTypes=function(){
var e={};
e[this.type]=true;
return e
};
ZmTreeController.prototype._doCreate=function(params){
params.type=this.type;
var funcName=ZmOrganizer.CREATE_FUNC[this.type];
if(funcName){
var func=eval(funcName);
func(params)
}};
ZmTreeController.prototype._doDelete=function(e){
e._delete()
};
ZmTreeController.prototype._doEmpty=function(t){
var n=false;
t.empty(n);
var e=appCtxt.getCurrentController();
if(e&&e._getSearchFolderId){
var o=e._getSearchFolderId();
if(o&&(o==t.id)){
var a=e.getCurrentView();
a._resetList();
a._setNoResultsHtml()
}}};
ZmTreeController.prototype._doRename=function(e,t){
e.rename(t)
};
ZmTreeController.prototype._doMove=function(e,t){
e.move(t)
};
ZmTreeController.prototype._doMarkAllRead=function(e){
e.markAllRead()
};
ZmTreeController.prototype._doSync=function(e){
e.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 o=h.item;
var s=o.getData(ZmTreeView.KEY_TYPE);
if(!s){
return
}
var c=o.getData(Dwt.KEY_OBJECT);
if(c){
this._actionedOrganizer=c;
if(c.noSuchFolder){
var t=appCtxt.getFolderTree();
if(t){
t.handleDeleteNoSuchFolder(c)
}
return
}
if(c&&c.type==ZmOrganizer.SEARCH){
var n=this._opc.getTreeController(ZmOrganizer.SEARCH);
if(n){
n._actionedOrganizer=c;
n._actionedOverviewId=o.getData(ZmTreeView.KEY_ID)
}}}
var e=o.getData(Dwt.KEY_ID);
var a=this._actionedOverviewId=o.getData(ZmTreeView.KEY_ID);
var l=this._opc.getOverview(a);
if(!l){
return
}
if(h.detail==DwtTree.ITEM_ACTIONED){
if(l.actionSupported){
var r=(c.nId==ZmOrganizer.ID_ROOT||c.isDataSource(ZmAccount.TYPE_IMAP))?this._getHeaderActionMenu(h):this._getActionMenu(h,c);
if(r){
this.resetOperations(r,s,e);
r.popup(0,h.docX,h.docY)
}}}else{
if((h.detail==DwtTree.ITEM_SELECTED)&&c){
if(appCtxt.multiAccounts&&(c instanceof ZmOrganizer)){
this._handleMultiAccountItemSelection(h,l,o,c)
}else{
this._handleItemSelection(h,l,o,c)
}}else{
if((h.detail==DwtTree.ITEM_DBL_CLICKED)&&c){
this._itemDblClicked(c)
}}}};
ZmTreeController.prototype._handleItemSelection=function(t,s,n,e){
s.itemSelected(n);
if(t.kbNavEvent){
DwtControl._scrollIntoView(n._itemDiv,s.getHtmlElement());
ZmController.noFocus=true
}
if(s._treeSelectionShortcutDelayActionId){
AjxTimedAction.cancelAction(s._treeSelectionShortcutDelayActionId)
}
if((s.selectionSupported||e._showFoldersCallback)&&!n._isHeader){
if(t.kbNavEvent&&ZmTreeController.TREE_SELECTION_SHORTCUT_DELAY){
var o=new AjxTimedAction(this,ZmTreeController.prototype._treeSelectionTimedAction,[e,s]);
s._treeSelectionShortcutDelayActionId=AjxTimedAction.scheduleAction(o,ZmTreeController.TREE_SELECTION_SHORTCUT_DELAY)
}else{
if((appCtxt.multiAccounts&&(e instanceof ZmOrganizer))||(e.type==ZmOrganizer.VOICE)){
appCtxt.getCurrentApp().getOverviewContainer().deselectAll(s);
var a=e.account||appCtxt.accountList.mainAccount;
appCtxt.accountList.setActiveAccount(a)
}
this._itemSelected(e)
}}};
ZmTreeController.prototype._itemSelected=function(e){
if(e&&e._showFoldersCallback){
e._showFoldersCallback.run()
}else{
this._itemClicked(e)
}};
ZmTreeController.prototype._handleMultiAccountItemSelection=function(t,o,a,e){
this._handleItemSelection(t,o,a,e)
};
ZmTreeController.prototype._treeSelectionTimedAction=function(e,t){
if(t._treeSelectionShortcutDelayActionId){
AjxTimedAction.cancelAction(t._treeSelectionShortcutDelayActionId)
}
this._itemSelected(e)
};
ZmTreeController.prototype._treeListener=function(r){
var n=r&&r.item;
var a=n&&n._tree&&n._tree.overviewId;
var l=appCtxt.getOverviewController().getOverview(a);
var s=l.account;
if(appCtxt.multiAccounts&&s){
appCtxt.accountList.setActiveAccount(s)
}
var o=r.detail==DwtTree.ITEM_EXPANDED;
var e=(r.detail==DwtTree.ITEM_COLLAPSED||o)?n.getData(Dwt.KEY_ID):null;
if(e&&!n._isHeader){
var h=appCtxt.get(ZmSetting.FOLDERS_EXPANDED,e)||false;
if(typeof(h)=="string"){
h=(h==="true")
}
if(h!=o){
appCtxt.set(ZmSetting.FOLDERS_EXPANDED,o,e)
}
if(o){
this._expandTreeItems(n)
}}
if(!(r&&r.detail&&l&&l.isAppOverview&&n._isHeader)){
return
}
var t=appCtxt.getSettings(s);
var c=t.getSetting(ZmOrganizer.OPEN_SETTING[this.type]);
if(c){
c.setValue(r.detail==DwtTree.ITEM_EXPANDED)
}};
ZmTreeController.prototype._treeChangeListener=function(e){
this._evHandled={};
for(var t in this._treeView){
this._changeListener(e,this._treeView[t],t)
}};
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_FLAGS){
var flag=ev.getDetail("flag");
var state=ev.getDetail("state");
if((flag==ZmItem.FLAG_UNREAD)&&!state){
node.setText(organizer.getName(false));
this._evHandled[overviewId]=true
}}else{
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)?ev.type:organizer.parent.type;
if(type!=this.type){
continue
}
if(organizer.isOfflineGlobalSearch){
appCtxt.getApp(ZmApp.MAIL).getOverviewContainer().addSearchFolder(organizer);
return
}else{
node=this._addNew(treeView,parentNode,organizer,idx)
}}else{
if(ev.event==ZmEvent.E_MOVE){
node.dispose();
if(parentNode){
node=this._addNew(treeView,parentNode,organizer,idx)
}}}
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]){
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])){
var parentNode=this._getParentNode(organizer,ev,overviewId);
if(!parentNode){
return
}
this._updateOverview(parentNode,node,fields,organizer,treeView);
this._evHandled[overviewId]=true
}}}}}}};
ZmTreeController.prototype._updateOverview=function(parentNode,node,fields,organizer,treeView){
node.setText(organizer.getName(treeView._showUnread));
if(fields&&fields[ZmOrganizer.F_NAME]){
if(parentNode&&(parentNode.getNumChildren()>1)){
node.dispose();
var idx=ZmTreeView.getSortIndex(parentNode,organizer,eval(ZmTreeView.COMPARE_FUNC[organizer.type]));
node=treeView._addNew(parentNode,organizer,idx)
}else{
node.setDndText(organizer.getName())
}
appCtxt.getAppViewMgr().updateTitle()
}
this._fixupTreeNode(node,organizer,treeView)
};
ZmTreeController.prototype._getParentNode=function(e,a,o){
if(e.parent){
var t=(e.parent.nId==ZmOrganizer.ID_ROOT)?a.type:null;
return this._opc.getOverview(o).getTreeItemById(e.parent.id,t)
}};
ZmTreeController.prototype._addNew=function(o,a,t,e){
return o._addNew(a,t,e)
};
ZmTreeController.prototype._newListener=function(a,o){
this._pendingActionData=this._getActionedOrganizer(a);
var t=this._getNewDialog();
if(!this._newCb){
this._newCb=new AjxCallback(this,this._newCallback)
}
if(this._pendingActionData&&!appCtxt.getById(this._pendingActionData.id)){
this._pendingActionData=appCtxt.getFolderTree(o).root
}
if(!o&&appCtxt.multiAccounts){
var e=this._opc.getOverview(this._actionedOverviewId);
o=e&&e.account
}
ZmController.showDialog(t,this._newCb,this._pendingActionData,o);
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmTreeController.prototype._renameListener=function(e){
this._pendingActionData=this._getActionedOrganizer(e);
var t=this._getRenameDialog();
if(!this._renameCb){
this._renameCb=new AjxCallback(this,this._renameCallback)
}
ZmController.showDialog(t,this._renameCb,this._pendingActionData);
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmTreeController.prototype._deleteListener=function(e){
this._doDelete(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._emptyListener=function(e){
this._doEmpty(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._moveListener=function(e){
this._pendingActionData=this._getActionedOrganizer(e);
var t=appCtxt.getChooseFolderDialog();
if(!this._moveCb){
this._moveCb=new AjxCallback(this,this._moveCallback)
}
ZmController.showDialog(t,this._moveCb,this._getMoveParams(t));
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,t)
};
ZmTreeController.prototype._getMoveParams=function(t){
var e={};
e[ZmFolder.ID_SPAM]=true;
return{
data:this._pendingActionData,treeIds:[this.type],overviewId:t.getOverviewId(ZmOrganizer.APP[this.type]),omit:e,title:AjxStringUtil.htmlEncode(this._getMoveDialogTitle()),description:ZmMsg.targetFolder,appName:ZmOrganizer.APP[this.type]}
};
ZmTreeController.prototype._expandAllListener=function(o){
var e=this._getActionedOrganizer(o);
var t=this.getTreeView(this._actionedOverviewId);
var a=t.getTreeItemById(e.id);
window.duringExpandAll=true;
a.setExpanded(true,true);
window.duringExpandAll=false;
if(window.afterExpandAllCallback){
window.afterExpandAllCallback();
window.afterExpandAllCallback=null
}};
ZmTreeController.prototype._markAllReadListener=function(e){
this._doMarkAllRead(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._syncAllListener=function(r){
for(var n in this._treeView){
var o=this.getTreeView(n);
var h=ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,appCtxt.getActiveAccount());
var l=o.getTreeItemById(h);
var e=l&&l.getItems();
if(e){
for(var s=0;
s<e.length;
s++){
var t=e[s];
var a=t&&t.getData&&t.getData(Dwt.KEY_OBJECT);
if(a&&(a.isFeed()||a.hasFeeds())){
this._syncFeeds(a)
}}}}};
ZmTreeController.prototype._syncListener=function(e){
this._syncFeeds(this._getActionedOrganizer(e))
};
ZmTreeController.prototype._syncFeeds=function(o){
if(o.isFeed()){
this._doSync(o)
}else{
if(o.hasFeeds()){
var e=o.children.getArray();
var n=o.children.size();
for(var t=0;
t<n;
t++){
if(e[t].isFeed()||(e[t].hasFeeds&&e[t].hasFeeds())){
this._syncFeeds(e[t])
}}}}};
ZmTreeController.prototype._editPropsListener=function(t){
var e=appCtxt.getFolderPropsDialog();
e.popup(this._getActionedOrganizer(t))
};
ZmTreeController.prototype._dragListener=function(e){
switch(e.action){
case DwtDragEvent.SET_DATA:e.srcData={
data:e.srcControl.getData(Dwt.KEY_OBJECT),controller:this};
break
}};
ZmTreeController.prototype._menuPopdownActionListener=function(){
if(this._pendingActionData){
return
}
var e=this.getTreeView(this._actionedOverviewId);
if(this._actionedOrganizer&&(e.getSelected()!=this._actionedOrganizer)){
var t=e.getTreeItemById(this._actionedOrganizer.id);
if(t){
t._setActioned(false)
}}};
ZmTreeController.prototype._newCallback=function(e){
this._doCreate(e);
this._clearDialog(this._getNewDialog())
};
ZmTreeController.prototype._renameCallback=function(e,t){
this._doRename(e,t);
this._clearDialog(this._getRenameDialog())
};
ZmTreeController.prototype._moveCallback=function(e){
this._doMove(this._pendingActionData,e);
this._clearDialog(appCtxt.getChooseFolderDialog())
};
ZmTreeController.prototype._deleteShieldYesCallback=function(e){
this._doDelete(e);
this._clearDialog(this._deleteShield)
};
ZmTreeController.prototype._emptyShieldYesCallback=function(e){
this._doEmpty(e);
this._clearDialog(this._emptyShield)
};
ZmTreeController.prototype._getEmptyShieldWarning=function(t){
var e=this._pendingActionData=this._getActionedOrganizer(t);
var a=this._emptyShield=appCtxt.getOkCancelMsgDialog();
a.reset();
a.registerCallback(DwtDialog.OK_BUTTON,this._emptyShieldYesCallback,this,e);
a.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,this._emptyShield);
var n=(e.nId!=ZmFolder.ID_TRASH)?(AjxMessageFormat.format(ZmMsg.confirmEmptyFolder,e.getName())):ZmMsg.confirmEmptyTrashFolder;
a.setMessage(n,DwtMessageDialog.WARNING_STYLE);
var s=(e.nId==ZmFolder.ID_TRASH||e.nId==ZmFolder.ID_SPAM)?DwtDialog.OK_BUTTON:DwtDialog.CANCEL_BUTTON;
a.associateEnterWithButton(s);
a.popup(null,s);
if(!(e.nId==ZmFolder.ID_SPAM||e.isInTrash())){
var o=a.getButton(DwtDialog.CANCEL_BUTTON);
o.focus()
}};
ZmTreeController.prototype._getActionedOrganizer=function(e){
if(this._actionedOrganizer){
return this._actionedOrganizer
}
var a=e.item;
while(a){
var t=a.getData(Dwt.KEY_OBJECT);
if(t instanceof ZmOrganizer){
this._actionedOrganizer=t;
return this._actionedOrganizer
}
a=a.parent
}
return null
};
ZmTreeController.prototype._checkTreeView=function(o){
if(!o||!this._treeView[o]){
return
}
var t=this._opc.getOverview(o).account;
var a=this.getDataTree(t);
var e=(ZmOrganizer.HIDE_EMPTY[this.type]&&a&&(a.size()==0));
this._treeView[o].setVisible(!e)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmTagTreeController")){
ZmTagTreeController=function(){
ZmTreeController.call(this,ZmOrganizer.TAG);
this._listeners[ZmOperation.NEW_TAG]=new AjxListener(this,this._newListener);
this._listeners[ZmOperation.RENAME_TAG]=new AjxListener(this,this._renameListener);
this._listeners[ZmOperation.TAG_COLOR_MENU]=new AjxListener(this,this._colorListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._browseListener)
};
ZmTagTreeController.prototype=new ZmTreeController;
ZmTagTreeController.prototype.constructor=ZmTagTreeController;
ZmTagTreeController.prototype.toString=function(){
return"ZmTagTreeController"
};
ZmTagTreeController.prototype._getActionMenu=function(){
var t=ZmTreeController.prototype._getActionMenu.call(this);
if(t&&!t._initialized){
var e=t.getMenuItem(ZmOperation.TAG_COLOR_MENU);
if(e){
e.getMenu().addSelectionListener(this._listeners[ZmOperation.TAG_COLOR_MENU])
}
t._initialized=true
}
return t
};
ZmTagTreeController.prototype.resetOperations=function(a,t,o){
var e=appCtxt.getById(o);
a.enableAll(true);
if(e.isSystem()){
a.enable([ZmOperation.RENAME_TAG,ZmOperation.TAG_COLOR_MENU,ZmOperation.DELETE],false)
}
a.enable(ZmOperation.MARK_ALL_READ,(e&&(e.numUnread>0)))
};
ZmTagTreeController.prototype._getHeaderActionMenuOps=function(){
return[ZmOperation.NEW_TAG,ZmOperation.BROWSE]
};
ZmTagTreeController.prototype._getActionMenuOps=function(){
return[ZmOperation.NEW_TAG,ZmOperation.MARK_ALL_READ,ZmOperation.RENAME_TAG,ZmOperation.DELETE,ZmOperation.TAG_COLOR_MENU]
};
ZmTagTreeController.prototype._getNewDialog=function(){
return appCtxt.getNewTagDialog()
};
ZmTagTreeController.prototype._getRenameDialog=function(){
return appCtxt.getRenameTagDialog()
};
ZmTagTreeController.prototype._itemClicked=function(t){
var e;
switch(appCtxt.getCurrentAppName()){
case ZmApp.CONTACTS:e=ZmItem.CONTACT;
break;
case ZmApp.NOTEBOOK:e=ZmItem.PAGE;
break;
case ZmApp.CALENDAR:e=ZmItem.APPT;
break;
case ZmApp.BRIEFCASE:e=ZmItem.BRIEFCASE_ITEM;
break;
case ZmApp.TASKS:e=ZmItem.TASK;
break;
default:e=ZmId.SEARCH_MAIL;
break
}
var o={
query:t.createQuery(),searchFor:e,getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),accountName:(appCtxt.multiAccounts?t.getAccount().name:null)};
var a=appCtxt.getSearchController();
a.searchAllAccounts=false;
a.search(o)
};
ZmTagTreeController.prototype._deleteListener=function(t){
var e=this._pendingActionData=this._getActionedOrganizer(t);
var a=this._deleteShield=appCtxt.getYesNoCancelMsgDialog();
a.reset();
a.registerCallback(DwtDialog.NO_BUTTON,this._clearDialog,this,this._deleteShield);
a.registerCallback(DwtDialog.YES_BUTTON,this._deleteShieldYesCallback,this,e);
var o=AjxMessageFormat.format(ZmMsg.askDeleteTag,e.getName(false,ZmOrganizer.MAX_DISPLAY_NAME_LENGTH));
a.setMessage(o,DwtMessageDialog.WARNING_STYLE);
a.popup()
};
ZmTagTreeController.prototype._colorListener=function(a){
var e=this._getActionedOrganizer(a);
if(e){
var t=a.item.getData(ZmOperation.MENUITEM_ID);
if(String(t).match(/^#/)){
e.setRGB(t)
}else{
e.setColor(t)
}}};
ZmTagTreeController.prototype._browseListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowsePickers([ZmPicker.TAG])
}};
ZmTagTreeController.prototype._dropListener=function(n){
var s=n.srcData.data;
if(n.action==DwtDropEvent.DRAG_ENTER){
var o=(s instanceof Array)?s[0]:s;
var t=n.targetControl.getData(Dwt.KEY_OBJECT);
if(t.id==ZmOrganizer.ID_ROOT){
n.doIt=false
}else{
if(o instanceof ZmContact&&(o.isGal||o.isShared())){
n.doIt=false
}else{
if(o&&(o instanceof ZmItem)&&o.isShared()){
n.doIt=false
}else{
if(appCtxt.multiAccounts&&t.getAccount()!=o.account){
n.doIt=false
}else{
n.doIt=this._dropTgt.isValidTarget(s)
}}}}}else{
if(n.action==DwtDropEvent.DRAG_DROP){
var e=n.srcData.controller;
var a=(s instanceof Array)?s:[s];
e._doTag(a,n.targetControl.getData(Dwt.KEY_OBJECT),true)
}}};
ZmTagTreeController.prototype._changeListener=function(r,a,h){
var t=r.getDetail("fields");
var o=r.getDetail("organizers");
for(var n=0;
n<o.length;
n++){
var e=o[n];
if(r.event==ZmEvent.E_MODIFY&&((t&&t[ZmOrganizer.F_COLOR]))){
var s=a.getTreeItemById(e.id);
if(s){
s.setImage(e.getIconWithColor())
}}else{
ZmTreeController.prototype._changeListener.call(this,r,a,h)
}}};
ZmTagTreeController.prototype._setTreeItemColor=function(t,e){}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmFolderTreeController")){
ZmFolderTreeController=function(t,e){
if(!arguments.length){
return
}
ZmTreeController.call(this,(t||ZmOrganizer.FOLDER));
this._listeners[ZmOperation.NEW_FOLDER]=new AjxListener(this,this._newListener);
this._listeners[ZmOperation.RENAME_FOLDER]=new AjxListener(this,this._renameListener);
this._listeners[ZmOperation.SHARE_FOLDER]=new AjxListener(this,this._shareFolderListener);
this._listeners[ZmOperation.EMPTY_FOLDER]=new AjxListener(this,this._emptyListener);
this._listeners[ZmOperation.RECOVER_DELETED_ITEMS]=new AjxListener(this,this._recoverListener);
this._listeners[ZmOperation.SYNC_OFFLINE_FOLDER]=new AjxListener(this,this._syncOfflineFolderListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._browseListener)
};
ZmFolderTreeController.prototype=new ZmTreeController;
ZmFolderTreeController.prototype.constructor=ZmFolderTreeController;
ZmFolderTreeController.prototype.toString=function(){
return"ZmFolderTreeController"
};
ZmFolderTreeController.prototype.show=function(n){
var a=n.omit||{};
for(var s in ZmFolder.HIDE_ID){
a[s]=true
}
var o=this.type!=ZmOrganizer.VOICE&&this.getDataTree(n.account);
if(o){
for(var e in ZmFolder.HIDE_NAME){
var t=o.getByName(e);
if(t){
a[t.id]=true
}}}
n.omit=a;
return ZmTreeController.prototype.show.call(this,n)
};
ZmFolderTreeController.prototype.resetOperations=function(g,f,a){
var s=ZmMsg.emptyFolder;
var o=appCtxt.getById(a);
var r=((o.numTotal>0)||(o.children&&(o.children.size()>0)));
var n=ZmOrganizer.normalizeId(a,this.type);
if(n==ZmOrganizer.ID_ROOT||((!o.isSystem())&&!o.isSyncIssuesFolder())){
var m=(!o.link||o.isAdmin());
if(appCtxt.isOffline){
m=!o.getAccount().isMain&&o.getAccount().isZimbraAccount
}
g.enableAll(true);
g.enable(ZmOperation.SYNC,o.isFeed());
g.enable(ZmOperation.SYNC_ALL,o.isFeed()||o.hasFeeds());
g.enable(ZmOperation.SHARE_FOLDER,m);
g.enable(ZmOperation.EMPTY_FOLDER,(r||o.link));
g.enable(ZmOperation.RENAME_FOLDER,!o.isDataSource());
g.enable(ZmOperation.NEW_FOLDER,!o.disallowSubFolder);
if(o.isRemote()&&o.isReadOnly()){
g.enable([ZmOperation.NEW_FOLDER,ZmOperation.MARK_ALL_READ,ZmOperation.EMPTY_FOLDER],false)
}}else{
g.enableAll(false);
if(!o.disallowSubFolder&&(n==ZmFolder.ID_INBOX||n==ZmFolder.ID_SENT||n==ZmFolder.ID_TRASH)){
g.enable(ZmOperation.NEW_FOLDER,true)
}
if(n==ZmFolder.ID_SPAM||n==ZmFolder.ID_TRASH||n==ZmFolder.ID_CHATS){
if(n==ZmFolder.ID_SPAM){
s=ZmMsg.emptyJunk
}else{
if(n==ZmFolder.ID_TRASH){
s=ZmMsg.emptyTrash
}}
g.enable(ZmOperation.EMPTY_FOLDER,r)
}
if(!o.link&&(n==ZmFolder.ID_INBOX||n==ZmFolder.ID_SENT||n==ZmFolder.ID_DRAFTS)){
g.enable([ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS],true)
}
if(appCtxt.multiAccounts){
var m=!o.getAccount().isMain&&o.getAccount().isZimbraAccount;
if(n==ZmFolder.ID_SPAM||n==ZmFolder.ID_TRASH){
m=false
}
g.enable([ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS],m)
}
if(appCtxt.isOffline&&n==ZmOrganizer.ID_SYNC_FAILURES&&r){
g.enable(ZmOperation.EMPTY_FOLDER,true)
}}
g.enable(ZmOperation.EXPAND_ALL,(o.size()>0));
if(n!=ZmOrganizer.ID_ROOT&&!o.isReadOnly()){
g.enable(ZmOperation.MARK_ALL_READ,(o.numUnread>0||o.link))
}
var l=g.getOp(ZmOperation.EMPTY_FOLDER);
if(l){
l.setText(s)
}
var d=(n==ZmOrganizer.ID_TRASH);
var h=g.getOp(ZmOperation.SYNC);
if(h){
var u=g.getOp(ZmOperation.SYNC_ALL);
var t=o.hasFeeds();
if(o.isFeed()){
h.setEnabled(true);
h.setVisible(true);
h.setText(ZmMsg.checkFeed);
if(u){
u.setEnabled(true);
u.setVisible(true);
u.setText(ZmMsg.checkAllFeed)
}}else{
if(t&&!d){
if(u){
u.setEnabled(true);
u.setVisible(true);
u.setText(ZmMsg.checkAllFeed)
}}else{
var p=appCtxt.get(ZmSetting.POP_ACCOUNTS_ENABLED)||appCtxt.get(ZmSetting.IMAP_ACCOUNTS_ENABLED);
if(!appCtxt.isOffline&&p){
var c=AjxDispatcher.run("GetDataSourceCollection");
var e=c.getItemsFor(ZmOrganizer.normalizeId(o.id));
if(e.length>0){
h.setText(ZmMsg.checkExternalMail);
h.setEnabled(true);
h.setVisible(true)
}else{
h.setVisible(false)
}}else{
h.setVisible(false)
}
if((!t||d)&&u){
u.setVisible(false)
}}}}
h=g.getOp(ZmOperation.SYNC_OFFLINE_FOLDER);
if(h){
if(!o.isOfflineSyncable){
h.setVisible(false)
}else{
h.setVisible(true);
h.setEnabled(true);
var y=(o.isOfflineSyncing)?ZmMsg.syncOfflineFolderOff:ZmMsg.syncOfflineFolderOn;
h.setText(y)
}}
g.enable(ZmOperation.BROWSE,true);
this._enableRecoverDeleted(g,d);
this._resetButtonPerSetting(g,ZmOperation.SHARE_FOLDER,appCtxt.get(ZmSetting.SHARING_ENABLED))
};
ZmFolderTreeController.prototype._getHeaderActionMenuOps=function(){
return[ZmOperation.NEW_FOLDER,ZmOperation.EXPAND_ALL,ZmOperation.SYNC,ZmOperation.BROWSE]
};
ZmFolderTreeController.prototype._getActionMenuOps=function(){
return[ZmOperation.NEW_FOLDER,ZmOperation.MARK_ALL_READ,ZmOperation.DELETE,ZmOperation.RENAME_FOLDER,ZmOperation.MOVE,ZmOperation.SHARE_FOLDER,ZmOperation.EDIT_PROPS,ZmOperation.EXPAND_ALL,ZmOperation.SYNC,ZmOperation.SYNC_ALL,ZmOperation.EMPTY_FOLDER,ZmOperation.RECOVER_DELETED_ITEMS,ZmOperation.SYNC_OFFLINE_FOLDER]
};
ZmFolderTreeController.prototype._getAllowedSubTypes=function(){
var e={};
e[ZmOrganizer.FOLDER]=true;
e[ZmOrganizer.SEARCH]=true;
return e
};
ZmFolderTreeController.prototype._getNewDialog=function(){
return appCtxt.getNewFolderDialog()
};
ZmFolderTreeController.prototype._getRenameDialog=function(){
return appCtxt.getRenameFolderDialog()
};
ZmFolderTreeController.prototype._itemClicked=function(t){
if(appCtxt.isOffline){
var u=t.getAccount();
if(u&&u.inNewMailMode){
u.inNewMailMode=false;
var a=appCtxt.getOverviewController()._overviewContainer;
for(var l in a){
a[l].updateAccountInfo(u,true,true)
}}}
if(t.type==ZmOrganizer.SEARCH){
var r=this._opc.getTreeController(ZmOrganizer.SEARCH);
r._itemClicked(t)
}else{
if(t.id==ZmFolder.ID_ATTACHMENTS){
var h=AjxDispatcher.run("GetAttachmentsController");
h.show()
}else{
var e=ZmId.SEARCH_MAIL;
if(t.isInTrash()){
var n=appCtxt.getCurrentAppName();
if(n==ZmApp.CONTACTS){
e=ZmItem.CONTACT
}}
var d=appCtxt.getSearchController();
var u=t.getAccount();
var s={
query:t.createQuery(),searchFor:e,getHtml:(t.nId==ZmFolder.ID_DRAFTS)||appCtxt.get(ZmSetting.VIEW_AS_HTML),types:((t.nId==ZmOrganizer.ID_SYNC_FAILURES)?[ZmItem.MSG]:null),sortBy:((d.currentSearch&&t.nId==d.currentSearch.folderId)?null:ZmSearch.DATE_DESC),accountName:(u&&u.name)};
d.resetSearchAllAccounts();
if(appCtxt.multiAccounts){
if(t.link&&t.perm==null){
var o=appCtxt.getFolderTree(u);
if(o){
var m=new AjxCallback(this,this._getPermissionsResponse,[s]);
o.getPermissions({
callback:m,folderIds:[t.id]}
)
}
return
}
if(appCtxt.isOffline&&u.hasNotSynced()&&!u.__syncAsked){
u.__syncAsked=true;
var c=appCtxt.getYesNoMsgDialog();
c.registerCallback(DwtDialog.YES_BUTTON,this._syncAccount,this,[c,u]);
c.setMessage(ZmMsg.neverSyncedAsk,DwtMessageDialog.INFO_STYLE);
c.popup()
}}
d.search(s)
}}};
ZmFolderTreeController.prototype._syncAccount=function(e,t){
e.popdown();
t.sync()
};
ZmFolderTreeController.prototype._getPermissionsResponse=function(e){
appCtxt.getSearchController().search(e)
};
ZmFolderTreeController.prototype._doSync=function(a){
var t=AjxDispatcher.run("GetDataSourceCollection");
var e=ZmOrganizer.normalizeId(a.id);
var o=t.getItemsFor(e);
if(o.length>0){
t.importMailFor(e)
}else{
ZmTreeController.prototype._doSync.call(this,a)
}};
ZmFolderTreeController.prototype._syncFeeds=function(t){
if(!appCtxt.isOffline&&t&&!t.isFeed()){
var a=(appCtxt.get(ZmSetting.POP_ACCOUNTS_ENABLED)||appCtxt.get(ZmSetting.IMAP_ACCOUNTS_ENABLED))?t.getDataSources(null,true):null;
if(a){
var e=AjxDispatcher.run("GetDataSourceCollection");
e.importMail(a);
return
}}
ZmTreeController.prototype._syncFeeds.call(this,t)
};
ZmFolderTreeController.prototype._addNew=function(o,a,t,e){
if(ZmFolder.HIDE_ID[t.id]){
return false
}
return o._addNew(a,t,e)
};
ZmFolderTreeController.prototype._deleteListener=function(a){
var e=this._getActionedOrganizer(a);
var n=appCtxt.isOffline?this.getDataTree().getById(ZmFolder.ID_TRASH):null;
if(n&&n.disallowSubFolder&&e.numTotal>0){
var r=appCtxt.getMsgDialog();
r.setMessage(ZmMsg.errorCannotDeleteFolder);
r.popup();
return
}
if(e.nId==ZmFolder.ID_SPAM||e.isInTrash()||(n&&n.disallowSubFolder)){
this._pendingActionData=e;
var o=this._deleteShield=appCtxt.getOkCancelMsgDialog();
o.reset();
o.registerCallback(DwtDialog.OK_BUTTON,this._deleteShieldYesCallback,this,e);
o.registerCallback(DwtDialog.CANCEL_BUTTON,this._clearDialog,this,this._deleteShield);
var t;
if(e.type==ZmOrganizer.SEARCH){
t=ZmMsg.confirmDeleteSavedSearch
}else{
if(e.disallowSubFolder||e.isMountpoint){
t=ZmMsg.confirmDeleteFolder
}else{
if(e.nId==ZmFolder.ID_TRASH){
t=ZmMsg.confirmEmptyTrashFolder
}else{
t=ZmMsg.confirmEmptyFolder
}}}
var s=AjxMessageFormat.format(t,e.getName());
o.setMessage(s,DwtMessageDialog.WARNING_STYLE);
o.popup()
}else{
this._doMove(e,appCtxt.getById(ZmFolder.ID_TRASH))
}};
ZmFolderTreeController.prototype._emptyListener=function(e){
this._getEmptyShieldWarning(e)
};
ZmFolderTreeController.prototype._recoverListener=function(e){
appCtxt.getDumpsterDialog().popup(this._getSearchFor(),this._getSearchTypes())
};
ZmFolderTreeController.prototype._getSearchFor=function(e){
return ZmId.SEARCH_ANY
};
ZmFolderTreeController.prototype._getSearchTypes=function(e){
return[ZmItem.MSG]
};
ZmFolderTreeController.prototype._syncOfflineFolderListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
e.toggleSyncOffline()
}};
ZmFolderTreeController.prototype._browseListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowsePickers([ZmPicker.FOLDER])
}};
ZmFolderTreeController.prototype._dragListener=function(t){
if(t.action==DwtDragEvent.DRAG_START){
var e=t.srcControl.getData(Dwt.KEY_OBJECT);
t.srcData={
data:e,controller:this};
if(!(e instanceof ZmFolder)||e.isSystem()||e.isSyncIssuesFolder()){
t.operation=Dwt.DND_DROP_NONE
}}};
ZmFolderTreeController.prototype._dropListener=function(c){
var n=c.targetControl.getData(Dwt.KEY_OBJECT);
var t=c.srcData.data;
var o=(c.shiftKey||c.uiEvent.shiftKey);
if(c.action==DwtDropEvent.DRAG_ENTER){
if(!t){
c.doIt=false;
return
}
var l=c.targetControl.getData(ZmTreeView.KEY_TYPE);
if(t instanceof ZmFolder){
c.doIt=n.mayContain(t,l)&&!n.disallowSubFolder
}else{
if(t instanceof ZmTag){
c.doIt=false
}else{
if(this._dropTgt.isValidTarget(t)){
c.doIt=n.mayContain(t,l);
var e;
var m=AjxUtil.toArray(t);
for(var a=0;
a<m.length;
a++){
if(m[a] instanceof ZmItem){
e|=m[a].getDefaultDndAction(o)
}}
var d=document.getElementById(DwtId.DND_PLUS_ID);
if(e&&d){
var h=((e&ZmItem.DND_ACTION_COPY)!=0);
Dwt.setVisibility(d,h)
}}else{
c.doIt=false
}}}}else{
if(c.action==DwtDropEvent.DRAG_DROP){
if(t instanceof ZmFolder){
this._doMove(t,n)
}else{
var u=c.srcData.controller;
var r=(t instanceof Array)?t:[t];
if(appCtxt.multiAccounts&&!o&&!n.getAccount().isMain&&this._isMovingAcrossAccount(r,n)){
var s=appCtxt.getYesNoMsgDialog();
s.registerCallback(DwtDialog.YES_BUTTON,this._continueMovingAcrossAccount,this,[s,u,r,n]);
s.setMessage(ZmMsg.moveAcrossAccountWarning,DwtMessageDialog.WARNING_STYLE);
s.popup()
}else{
u._doMove(r,n,null,o)
}}}}};
ZmFolderTreeController.prototype._isMovingAcrossAccount=function(e,n){
for(var a=0;
a<e.length;
a++){
var o=e[a];
var t=o.getAccount();
if(t&&t!=n.getAccount()){
return true
}}
return false
};
ZmFolderTreeController.prototype._continueMovingAcrossAccount=function(a,e,t,o){
a.popdown();
e._doMove(t,o)
};
ZmFolderTreeController.prototype._shareFolderListener=function(e){
if(!this._sharingPossible()){
return
}
this._pendingActionData=this._getActionedOrganizer(e);
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]=new AjxListener(this,this._renameListener);
this._listeners[ZmOperation.BROWSE]=new AjxListener(this,this._browseListener)
};
ZmSearchTreeController.prototype=new ZmFolderTreeController;
ZmSearchTreeController.prototype.constructor=ZmSearchTreeController;
ZmSearchTreeController.APP_JOIN_CHAR="-";
ZmSearchTreeController.prototype.toString=function(){
return"ZmSearchTreeController"
};
ZmSearchTreeController.prototype.show=function(a){
var o=a.overviewId;
if(!this._treeView[o]||a.forceCreate){
this._treeView[o]=this._setup(o)
}
var t=this.getDataTree(a.account);
if(t){
a.dataTree=t;
a.searchTypes={};
a.omit=a.omit||{};
a.omit[ZmFolder.ID_TRASH]=true;
a.omitParents=true;
var e=ZmOrganizer.OPEN_SETTING[this.type];
a.collapsed=!(!e||(appCtxt.get(e,null,a.account)!==false));
this._setupNewOp(a);
this._treeView[o].set(a);
this._checkTreeView(o)
}
return this._treeView[o]
};
ZmSearchTreeController.prototype.getTreeStyle=function(){
return null
};
ZmSearchTreeController.prototype.resetOperations=function(a,t,o){
a.enableAll(true);
var e=appCtxt.getById(o);
a.enable(ZmOperation.EXPAND_ALL,(e.size()>0))
};
ZmSearchTreeController.prototype._newListener=function(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowseView()
};
ZmSearchTreeController.prototype._browseListener=function(t){
var e=this._getActionedOrganizer(t);
if(e){
AjxDispatcher.require("Browse");
appCtxt.getSearchController().showBrowsePickers([ZmPicker.SEARCH])
}};
ZmSearchTreeController.prototype._getHeaderActionMenuOps=function(){
return[ZmOperation.EXPAND_ALL,ZmOperation.BROWSE]
};
ZmSearchTreeController.prototype._getActionMenuOps=function(){
return[ZmOperation.DELETE,ZmOperation.RENAME_SEARCH,ZmOperation.MOVE,ZmOperation.EXPAND_ALL]
};
ZmSearchTreeController.prototype._getAllowedSubTypes=function(){
return ZmTreeController.prototype._getAllowedSubTypes.call(this)
};
ZmSearchTreeController.prototype._getNewDialog=function(){
return appCtxt.getNewSearchDialog()
};
ZmSearchTreeController.prototype._itemClicked=function(e){
if(e._showFoldersCallback){
e._showFoldersCallback.run();
return
}
appCtxt.getSearchController().redoSearch(e.search,false,{
getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML)}
)
};
ZmSearchTreeController.prototype._getMoveParams=function(t){
var e=ZmTreeController.prototype._getMoveParams.apply(this,arguments);
e.overviewId=t.getOverviewId(this.type);
e.treeIds=[ZmOrganizer.FOLDER,ZmOrganizer.SEARCH];
return e
};
ZmSearchTreeController.prototype._getMoveDialogTitle=function(){
return AjxMessageFormat.format(ZmMsg.moveSearch,this._pendingActionData.name)
};
ZmSearchTreeController.prototype._checkTreeView=function(n){
var t=this._treeView[n];
if(!n||!t){
return
}
var o=this._opc.getOverview(n).account;
var e=(appCtxt.multiAccounts&&!o.isMain)?(ZmOrganizer.getSystemId(ZmOrganizer.ID_ROOT,o)):ZmOrganizer.ID_ROOT;
var a=ZmOrganizer.HIDE_EMPTY[this.type]&&!t.getTreeItemById(e).getItemCount();
this._treeView[n].setVisible(!a)
}
}
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(t){
var e=new ZmFolderTree(ZmOrganizer.SHARE);
var a={
id:ZmOrganizer.ID_ROOT,name:ZmMsg.sharedFoldersHeader};
e.root=ZmFolderTree.createFolder(ZmOrganizer.SHARE,null,a,e);
return e
};
ZmShareTreeController.prototype._createTreeView=function(e){
return new ZmShareTreeView(e)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmOverviewController")){
ZmOverviewController=function(e){
ZmController.call(this,e);
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(t,a){
t.parent=t.parent||this._shell;
t.controller=this;
t.id=ZmId.getOverviewContainerId(t.containerId);
var e=this._overviewContainer[t.containerId]=new ZmAccountOverviewContainer(t);
a.containerId=t.id;
e.initialize(a);
return e
};
ZmOverviewController.prototype.createOverview=function(t){
t.parent=t.parent||this._shell;
var e=this._overview[t.overviewId]=new ZmOverview(t,this);
return e
};
ZmOverviewController.prototype.getOverviewContainer=function(e){
var e=e||appCtxt.getCurrentAppName();
return this._overviewContainer[e]
};
ZmOverviewController.prototype.getOverview=function(e){
return this._overview[e]
};
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(e){
return e?appCtxt.getTree(e):null
};
ZmOverviewController.prototype.getTreeView=function(t,e){
if(!t||!e){
return null
}
if(!this.getOverview(t)){
return null
}
return this.getOverview(t).getTreeView(e)
}
}
if(AjxPackage.define("zimbraMail.share.controller.ZmSearchController")){
ZmSearchController=function(e){
ZmController.call(this,e);
this._inited=false;
this._searchFor=appCtxt.get(ZmSetting.MAIL_ENABLED)?ZmId.SEARCH_MAIL:ZmId.SEARCH_ANY;
this._contactSource=ZmItem.CONTACT;
this._results=null;
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
this._setView()
}};
ZmSearchController.prototype=new ZmController;
ZmSearchController.prototype.constructor=ZmSearchController;
ZmSearchController.QUERY_ISREMOTE="is:remote OR is:local";
ZmSearchController.prototype.toString=function(){
return"ZmSearchController"
};
ZmSearchController.prototype.getSearchToolbar=function(){
return this._searchToolBar
};
ZmSearchController.prototype.dateSearch=function(s,e){
s=s||new Date();
var o=AjxDateFormat.getDateInstance(AjxDateFormat.SHORT);
var a=o.format(s);
var t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
var n="date:"+a;
this.search({
query:n,types:[t],searchFor:e}
)
};
ZmSearchController.prototype.fromSearch=function(e){
var t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
var o=e instanceof Array?e.concat():[e];
for(var a=0;
a<o.length;
a++){
o[a]=["from:(",o[a],")"].join("")
}
this.search({
query:o.join(" OR "),types:[t]}
)
};
ZmSearchController.prototype.toSearch=function(e){
var t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
var o=e instanceof Array?e.concat():[e];
for(var a=0;
a<o.length;
a++){
o[a]=["tocc:(",o[a],")"].join("")
}
if(this.currentSearch&&this.currentSearch.folderId==ZmFolder.ID_SENT){
this.search({
query:"in:sent AND ("+o.join(" OR ")+")",types:[t]}
)
}else{
this.search({
query:o.join(" OR "),types:[t]}
)
}};
ZmSearchController.prototype.fromBrowse=function(t){
var e=new AjxCallback(this,this._handleLoadFromBrowse,[t]);
this.showBrowseView(true,e)
};
ZmSearchController.prototype.showBrowsePickers=function(a,e){
e=(!e||e==null)?true:e;
this.showBrowseView(true,null);
if(a instanceof Array){
this._browseViewController.removeAllPickers();
if(e){
this._browseViewController.addPicker(ZmPicker.BASIC)
}
for(var t=0;
t<a.length;
t++){
this._browseViewController.addPicker(a[t])
}}};
ZmSearchController.prototype._handleLoadFromBrowse=function(a,e){
this.setDefaultSearchType(ZmId.SEARCH_MAIL);
e.removeAllPickers();
this._browseViewController.removeAllPickers();
var t=this._browseViewController.addPicker(ZmPicker.BASIC);
t.setFrom(a);
t.execute()
};
ZmSearchController.prototype.showBrowseView=function(t,o,a){
if(!this._browseViewController){
if(a){
return
}
var e=new AjxCallback(this,this._handleLoadShowBrowseView,[t,a,o]);
AjxDispatcher.require("Browse",false,e,null,false);
return
}
this._doShowBrowseView(t,a,o)
};
ZmSearchController.prototype._handleLoadShowBrowseView=function(e,t,a){
this._browseViewController=new ZmBrowseController(this.searchPanel);
this._doShowBrowseView(e,t,a)
};
ZmSearchController.prototype._doShowBrowseView=function(e,t,o){
var a=this._browseViewController;
a.setBrowseViewVisible(!t&&(e||!a.getBrowseViewVisible()));
if(o){
o.run(a.getBrowseView())
}};
ZmSearchController.prototype.getBrowseView=function(){
return(this._browseViewController&&this._browseViewController.getBrowseView())
};
ZmSearchController.prototype.setSearchField=function(e){
if(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)&&this._searchToolBar){
this._searchToolBar.setSearchFieldValue(e)
}else{
this._currentQuery=e
}};
ZmSearchController.prototype.getSearchFieldValue=function(){
return this._searchToolBar?this._searchToolBar.getSearchFieldValue():""
};
ZmSearchController.prototype.setEnabled=function(e){
if(this._searchToolBar){
this._searchToolBar.setEnabled(e)
}};
ZmSearchController.prototype.setDefaultSearchType=function(e){
if(this._searchToolBar&&!appCtxt.inStartup){
var t=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON).getMenu();
t.checkItem(ZmSearchToolBar.MENUITEM_ID,e);
this._searchMenuListener(null,e)
}};
ZmSearchController.prototype._setView=function(){
this.searchPanel=new DwtComposite({
parent:this._container,className:"SearchPanel",posStyle:Dwt.ABSOLUTE_STYLE}
);
this._searchToolBar=new ZmSearchToolBar(this.searchPanel,ZmId.SEARCH_TOOLBAR);
if(!appCtxt.isChildWindow){
this.peopleSearchToolBar=new ZmPeopleSearchToolBar(this._container,ZmId.PEOPLE_SEARCH_TOOLBAR)
}
this._createTabGroup();
this._tabGroup.addMember(this._searchToolBar.getSearchField());
var t=this._searchToolBar.getButtons();
for(var e=0;
e<t.length;
e++){
this._tabGroup.addMember(t[e])
}
this._searchToolBar.registerCallback(this._searchFieldCallback,this);
this._searchToolBar.addSelectionListener(ZmSearchToolBar.SEARCH_BUTTON,new AjxListener(this,this._searchButtonListener));
if(appCtxt.get(ZmSetting.BROWSE_ENABLED)){
this._searchToolBar.addSelectionListener(ZmSearchToolBar.BROWSE_BUTTON,new AjxListener(this,this._browseButtonListener))
}
if(appCtxt.get(ZmSetting.SAVED_SEARCHES_ENABLED)){
this._searchToolBar.addSelectionListener(ZmSearchToolBar.SAVE_BUTTON,new AjxListener(this,this._saveButtonListener))
}};
ZmSearchController.prototype._addMenuListeners=function(s){
var a=new AjxListener(this,this._searchMenuListener);
var t=s.getItems();
for(var o=0;
o<t.length;
o++){
var n=t[o];
n.addSelectionListener(a);
var e=n.getData(ZmSearchToolBar.MENUITEM_ID);
if(e==ZmId.SEARCH_MAIL){
n.setChecked(true,true)
}}};
ZmSearchController.prototype.search=function(n){
if(!n.query&&!n.queryHint){
var e;
switch(n.searchFor){
case ZmId.SEARCH_MAIL:e=ZmApp.MAIL;
break;
case ZmId.SEARCH_GAL:return;
case ZmId.SEARCH_ANY:n.query="is:anywhere";
break;
case ZmItem.APPT:break;
default:e=ZmItem.APP[n.searchFor];
break
}
if(e){
var t=ZmOrganizer.APP2ORGANIZER[e];
var a=t&&ZmOrganizer.DEFAULT_FOLDER[t];
var o=a&&appCtxt.getById(a);
if(o){
n.query="in:"+o._systemName
}}
if(n.query){
n.userText=false
}else{
if(n.searchFor!=ZmItem.APPT){
return
}}}
if(n.query&&(n.query.indexOf("$set:")==0||n.query.indexOf("$cmd:")==0)){
appCtxt.getClientCmdHandler().execute((n.query.substr(5)),this);
return
}
n.searchAllAccounts=this.searchAllAccounts;
var s=new AjxCallback(this,this._handleResponseSearch,[n.callback]);
this._doSearch(n,n.noRender,s,n.errorCallback)
};
ZmSearchController.prototype._handleResponseSearch=function(t,e){
if(t){
t.run(e)
}};
ZmSearchController.prototype.redoSearch=function(o,e,n,r,t){
var s={};
s.query=o.query;
s.queryHint=o.queryHint;
s.types=o.types;
s.sortBy=o.sortBy;
s.offset=o.offset;
s.limit=o.limit;
s.prevId=o.prevId;
s.prevSortBy=o.prevSortBy;
s.fetch=o.fetch;
s.searchId=o.searchId;
s.lastSortVal=o.lastSortVal;
s.endSortVal=o.endSortVal;
s.lastId=o.lastId;
s.soapInfo=o.soapInfo;
s.accountName=o.accountName;
s.searchFor=this._searchFor;
s.idsOnly=o.idsOnly;
s.inDumpster=o.inDumpster;
if(n){
for(var a in n){
s[a]=n[a]
}}
this._doSearch(s,e,r,t)
};
ZmSearchController.prototype.resetSearchAllAccounts=function(){
var e=this.searchAllAccounts&&this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
var n=e&&e.getMenu();
var o=n&&n.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_ALL_ACCOUNTS);
if(o){
o.setChecked(false,true);
var a=n.getSelectedItem();
var t=this._inclSharedItems?this._getSharedImage(a):a.getImage();
e.setImage(t);
this.searchAllAccounts=false
}};
ZmSearchController.prototype.resetSearchToolbar=function(){
var e=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
var t=e?e.getMenu().getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_GAL):null;
if(t){
t.setVisible(appCtxt.getActiveAccount().isZimbraAccount)
}};
ZmSearchController.prototype.getTypes=function(o){
var a=new AjxVector();
var e=o.searchFor||this._searchFor;
var t;
if((e==ZmId.SEARCH_MAIL||e==ZmId.SEARCH_ANY)&&appCtxt.get(ZmSetting.MAIL_ENABLED)){
t=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy()
}
if(e==ZmId.SEARCH_MAIL){
a.add(t)
}else{
if(e==ZmId.SEARCH_ANY){
if(appCtxt.get(ZmSetting.MAIL_ENABLED)&&t){
a.add(t)
}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
a.add(ZmItem.CONTACT)
}
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){
a.add(ZmItem.APPT)
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED)){
a.add(ZmItem.TASK)
}
if(appCtxt.get(ZmSetting.NOTEBOOK_ENABLED)){
a.add(ZmItem.PAGE)
}
if(appCtxt.get(ZmSetting.BRIEFCASE_ENABLED)){
a.add(ZmItem.BRIEFCASE_ITEM)
}}else{
a.add(e);
if(e==ZmItem.PAGE){
a.add(ZmItem.DOCUMENT)
}}}
return a
};
ZmSearchController.prototype.updateOverview=function(e){
var t=e||appCtxt.getCurrentSearch();
var h,a;
if(t&&(t.singleTerm||t.searchId)){
if(t.searchId){
h=this._getNormalizedId(t.searchId);
a=ZmOrganizer.SEARCH
}else{
if(t.folderId){
h=this._getNormalizedId(t.folderId);
var n=appCtxt.getFolderTree();
var o=n&&n.getById(h);
a=o?o.type:ZmOrganizer.FOLDER;
if(t.searchFor==ZmItem.TASK){
a=ZmOrganizer.TASKS
}}else{
if(t.tagId){
h=this._getNormalizedId(t.tagId);
a=ZmOrganizer.TAG
}}}
var r=appCtxt.getCurrentApp();
var s=r&&r.getOverview();
if(s){
s.setSelected(h,a)
}}};
ZmSearchController.prototype._getSuitableSortBy=function(t){
var o;
if(t.size()==1){
var a=t.get(0);
var e;
switch(a){
case ZmItem.CONV:e=ZmId.VIEW_CONVLIST;
break;
case ZmItem.MSG:e=ZmId.VIEW_TRAD;
break;
case ZmItem.CONTACT:e=ZmId.VIEW_CONTACT_SIMPLE;
break;
case ZmItem.APPT:e=ZmId.VIEW_CAL;
break;
case ZmItem.TASK:e=ZmId.VIEW_TASKLIST;
break;
case ZmId.SEARCH_GAL:e=ZmId.VIEW_CONTACT_SIMPLE;
break;
case ZmItem.BRIEFCASE_ITEM:e=ZmId.VIEW_BRIEFCASE_DETAIL;
break
}
if(e){
o=appCtxt.get(ZmSetting.SORTING_PREF,e)
}}
return o
};
ZmSearchController.prototype._doSearch=function(t,c,d,n){
var e=this._searchFor=t.searchFor||this._searchFor;
appCtxt.notifyZimlets("onSearch",[t.query]);
if(this._searchToolBar){
var l=(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)||t.userText)?t.query:null;
this._searchToolBar.setSearchFieldValue(l||"");
if(appCtxt.multiAccounts&&t.userText&&this.searchAllAccounts){
appCtxt.getCurrentApp().getOverviewContainer().deselectAll()
}}
var s=t.types||this.getTypes(t);
if(s instanceof Array){
s=AjxVector.fromArray(s)
}
if(e==ZmId.SEARCH_MAIL){
t=appCtxt.getApp(ZmApp.MAIL).getSearchParams(t)
}
if(e==ZmItem.TASK){
var a=AjxDispatcher.run("GetTaskListController");
t.allowableTaskStatus=(a)?a.getAllowableTaskStatus():null
}
var h=(e==ZmId.SEARCH_ANY);
if(t.searchAllAccounts&&!t.queryHint){
t.queryHint=appCtxt.accountList.generateQuery(null,s);
t.accountName=appCtxt.accountList.mainAccount.name
}else{
if(this._inclSharedItems){
t.queryHint=h?ZmSearchController.QUERY_ISREMOTE:ZmSearchController.generateQueryForShares(s.getArray())
}}
t.contactSource=(s.contains(ZmItem.CONTACT)||s.contains(ZmId.SEARCH_GAL))?this._contactSource:null;
if(t.contactSource==ZmId.SEARCH_GAL){
t.expandDL=true
}
t.sortBy=t.sortBy||this._getSuitableSortBy(s);
t.types=s;
var m=new ZmSearch(t);
var r=[m,c,h,d,t.noUpdateOverview,t.noClear];
var u=new AjxCallback(this,this._handleResponseDoSearch,r);
if(!n){
n=new AjxCallback(this,this._handleErrorDoSearch,[m,h])
}
if(e==ZmItem.APPT&&!t.forceSearch){
var o=AjxDispatcher.run("GetCalController");
if(o&&s.contains(ZmItem.APPT)){
o.handleUserSearch(t,u)
}else{
m.execute({
callback:u,errorCallback:n}
)
}}else{
m.execute({
callback:u,errorCallback:n}
)
}};
ZmSearchController.prototype._handleResponseDoSearch=function(o,t,n,h,s,r,e){
var a=e&&e.getResponse();
if(!a){
return
}
if(!a.type){
a.type=o.types.get(0)
}
if(a.type==ZmItem.APPT){
this._results=new ZmSearchResult(o)
}else{
this.currentSearch=o;
if(!t){
this._showResults(a,o,n,s,r)
}}
if(h){
h.run(e)
}};
ZmSearchController.prototype._showResults=function(a,l,r,e,h){
if(!h&&this._results&&(this._results.type==a.type)&&this._results.dtor){
this._results.dtor()
}
this._results=a;
if(appCtxt.get(ZmSetting.SAVED_SEARCHES_ENABLED)){
var s=this._searchToolBar&&this._searchToolBar.getButton(ZmSearchToolBar.SAVE_BUTTON);
if(s){
s.setEnabled(this._contactSource!=ZmId.SEARCH_GAL)
}}
var n=r?ZmItem.MIXED:a.type;
var o=new AjxCallback(this,this._handleLoadShowResults,[a,l,e]);
var t=appCtxt.getApp(ZmItem.APP[n])||appCtxt.getCurrentApp();
t.currentSearch=l;
t.currentQuery=l.query;
t.showSearchResults(a,o)
};
ZmSearchController.prototype._handleLoadShowResults=function(t,e,a){
appCtxt.setCurrentList(t.getResults(t.type));
if(!a){
this.updateOverview(e)
}};
ZmSearchController.prototype._handleErrorDoSearch=function(a,o,t){
if(t.code==ZmCsfeException.MAIL_NO_SUCH_TAG||t.code==ZmCsfeException.MAIL_QUERY_PARSE_ERROR||t.code==ZmCsfeException.MAIL_TOO_MANY_TERMS||(t.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER&&!(t.data.itemId&&t.data.itemId.length))){
var n=t.getErrorMsg();
appCtxt.setStatusMsg(n,ZmStatusView.LEVEL_WARNING);
var e=new ZmSearchResult(a);
e.type=a.types?a.types.get(0):null;
this._showResults(e,a,o);
return true
}
return false
};
ZmSearchController.generateQueryForShares=function(r,s){
var d=window.parentAppCtxt||window.appCtxt;
var h=[];
for(var o=0;
o<r.length;
o++){
var l=r[o];
var a=d.getApp(ZmItem.APP[l]);
if(a){
var e=a.getRemoteFolderIds(s);
for(var n=0;
n<e.length;
n++){
var t=e[n];
var c=AjxUtil.isNumeric(t)?t:['"',t,'"'].join("");
h.push("inid:"+c)
}}}
if(h.length>0){
h.push("is:local");
return h.join(" OR ")
}
return null
};
ZmSearchController.prototype._searchFieldCallback=function(a,e){
var t=appCtxt.get(ZmSetting.VIEW_AS_HTML);
this.search({
query:a,userText:true,getHtml:t,searchFor:e}
)
};
ZmSearchController.prototype._searchButtonListener=function(l){
var a=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
var t=a&&a.getMenu();
var s=t&&t.getSelectedItem();
var o=s&&s.getData("CustomSearchItem");
var h=s&&s.getData(ZmOperation.MENUITEM_ID);
if(o){
o[2].run(l)
}else{
var e=this._searchToolBar.getSearchFieldValue();
var r=(e.length>0);
if(e){
this._currentQuery=null
}else{
e=this._currentQuery?this._currentQuery:""
}
appCtxt.notifyZimlets("onSearchButtonClick",[e]);
var n=appCtxt.get(ZmSetting.VIEW_AS_HTML);
this.search({
query:e,userText:r,getHtml:n,searchFor:h}
)
}};
ZmSearchController.prototype._browseButtonListener=function(e){
this.showBrowseView()
};
ZmSearchController.prototype._saveButtonListener=function(t){
var e=appCtxt.getOverviewController().getTreeController(ZmOrganizer.SEARCH);
if(!e._newCb){
e._newCb=new AjxCallback(e,e._newCallback)
}
var a={
search:this._results&&this._results.search,showOverview:(this._searchFor==ZmId.SEARCH_MAIL)};
ZmController.showDialog(e._getNewDialog(),e._newCb,a)
};
ZmSearchController.prototype._searchMenuListener=function(r,e){
var o=this._searchToolBar.getButton(ZmSearchToolBar.SEARCH_MENU_BUTTON);
if(!o){
return
}
var t=o.getMenu();
var l=r?r.item:(t.getItemById(ZmSearchToolBar.MENUITEM_ID,e));
if(!l||(!!(l._style&DwtMenuItem.SEPARATOR_STYLE))){
return
}
e=l.getData(ZmSearchToolBar.MENUITEM_ID);
var a=t.getSelectedItem();
var u=t.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_SHARED);
if(e==ZmId.SEARCH_GAL){
this._contactSource=ZmId.SEARCH_GAL;
if(u){
u.setChecked(false,true);
u.setEnabled(false)
}}else{
if(u){
if(e==ZmItem.APPT||e==ZmId.SEARCH_CUSTOM){
u.setChecked(false,true);
u.setEnabled(false)
}else{
u.setEnabled(true)
}}
this._contactSource=ZmItem.CONTACT
}
this._inclSharedItems=u&&u.getChecked();
var n=t.getItemById(ZmSearchToolBar.MENUITEM_ID,ZmId.SEARCH_ALL_ACCOUNTS);
if(n){
if(e==ZmItem.APPT){
this.resetSearchAllAccounts();
n.setEnabled(false)
}else{
n.setEnabled(true);
this.searchAllAccounts=n&&n.getChecked()
}}
if(e==ZmId.SEARCH_SHARED){
var s=this.searchAllAccounts?n.getImage():a.getImage();
if(this._inclSharedItems){
var d=a&&a.getData(ZmSearchToolBar.MENUITEM_ID);
s=d?((ZmSearchToolBar.SHARE_ICON[d])||l.getImage()):l.getImage()
}
o.setImage(s)
}else{
if(e==ZmId.SEARCH_ALL_ACCOUNTS){
var s=(this.searchAllAccounts&&!this._inclSharedItems)?l.getImage():(this._inclSharedItems)?this._getSharedImage(a):a.getImage();
o.setImage(s)
}else{
this._searchFor=e;
var s=l.getImage();
if(this._inclSharedItems){
s=this._getSharedImage(a)
}else{
if(this.searchAllAccounts){
s=n.getImage()
}}
o.setImage(s);
o.setText(l.getText())
}}
var c=ZmMsg[ZmSearchToolBar.TT_MSG_KEY[e]];
if(e==ZmId.SEARCH_MAIL){
var h=appCtxt.getApp(ZmApp.MAIL).getGroupMailBy();
c=ZmMsg[ZmSearchToolBar.TT_MSG_KEY[h]]
}
o.setToolTipContent(c)
};
ZmSearchController.prototype._getSharedImage=function(e){
var t=e&&e.getData(ZmSearchToolBar.MENUITEM_ID);
return(t&&ZmSearchToolBar.SHARE_ICON[t])?ZmSearchToolBar.SHARE_ICON[t]:ZmSearchToolBar.ICON[ZmId.SEARCH_SHARED]
};
ZmSearchController.prototype._getNormalizedId=function(a){
var t=a;
var e=appCtxt.getActiveAccount();
if(!e.isMain&&a.indexOf(":")==-1){
t=e.id+":"+a
}
return t
}
}
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(t){
this.dismiss();
var e=this._actionStack.logAction(t);
if(e){
this._active=true
}
return e
};
ZmActionController.prototype.getUndoLink=function(t,a){
if(t instanceof ZmAction){
var e=ZmActionController._registerCallback(new AjxCallback(this,this.undoCurrent));
return["<a onclick='ZmActionController.callRegisteredCallback(",e,")' href='javascript:;' class='undo'>",a||ZmMsg.undo,"</a>"].join("")
}else{
return""
}};
ZmActionController.prototype.getStatusTransitions=function(){
return this._statusTransitions
};
ZmActionController.prototype.undo=function(e){
if(this._active){
this.dismiss();
e.undo()
}};
ZmActionController.prototype.undoCurrent=function(){
if(this._active){
this.dismiss()
}
this._actionStack.undo()
};
ZmActionController.prototype.onPopup=function(){
var e=appCtxt.getOutsideMouseEventMgr();
var t={
id:"ZmActionController",obj:this,elementId:ZmId.TOAST,outsideListener:this._outsideListener};
e.startListening(t)
};
ZmActionController.prototype.dismiss=function(){
appCtxt.dismissStatusMsg(true);
var e=appCtxt.getOutsideMouseEventMgr();
e.stopListening("ZmActionController");
this._active=false
};
ZmActionController._substituteTransitions=function(o){
var a=[];
var t=false;
for(var e=0;
e<o.length;
e++){
var n=o[e];
if(n){
if(n.type==ZmToast.PAUSE.type){
if(!t){
t=true;
a.push(ZmToast.HOLD)
}}else{
a.push(n)
}}}
return a
};
ZmActionController._registeredCallbacks=[];
ZmActionController._registerCallback=function(t){
var e=ZmActionController._registeredCallbacks.length;
ZmActionController._registeredCallbacks[e]=t;
return e
};
ZmActionController.callRegisteredCallback=function(t){
var e=ZmActionController._registeredCallbacks[t];
if(e){
if(e instanceof AjxCallback){
e.run()
}else{
if(AjxUtil.isFunction(e)){
e()
}}}};
ZmActionController.prototype._outsideMouseDownListener=function(e){
this.dismiss()
}
}
if(AjxPackage.define("zimbraMail.im.model.ZmRoster")){
ZmRoster=function(e){
ZmModel.call(this,ZmEvent.S_ROSTER);
this._gateways={
byService:{}
,byDomain:{}
,array:[]};
this._notificationBuffer=[];
this._imApp=e
};
ZmRoster.prototype=new ZmModel;
ZmRoster.prototype.constructor=ZmRoster;
ZmRoster.F_PRESENCE="ZmRoster.presence";
ZmRoster.NOTIFICATION_FOO_TIMEOUT=10000;
ZmRoster.GATEWAY_EVENT="gateway list";
ZmRoster.prototype.toString=function(){
return"ZmRoster"
};
ZmRoster.prototype.getPrivacyList=function(){
return this._privacyList=this._privacyList||new ZmImPrivacyList(this)
};
ZmRoster.prototype.getChatList=function(){
if(!this._chatList){
this._chatList=new ZmChatList(this)
}
return this._chatList
};
ZmRoster.prototype.getMyAddress=function(){
return ZmImApp.INSTANCE.getService().getMyAddress()
};
ZmRoster.prototype.getRosterItem=function(a,e){
if(!a){
return null
}
a=a.toLowerCase();
var t=this.getRosterItemList().getByAddr(a);
if(t){
return t
}
if(e){
a=ZmImAddress.parse(a);
t=a?this.getRosterItemList().getByAddr(a.screenName):null;
if(t){
return t
}
if(a){
a=this.makeServerAddress(a.screenName,a.service);
if(a){
return this.getRosterItemList().getByAddr(a)
}}}};
ZmRoster.prototype.getRosterItemList=function(){
if(!this._rosterItemList){
this._rosterItemList=new ZmRosterItemList()
}
return this._rosterItemList
};
ZmRoster.prototype.getPresence=function(){
if(!this._rosterPresence){
this._rosterPresence=new ZmRosterPresence()
}
return this._rosterPresence
};
ZmRoster.prototype.notifyPresence=function(){
var e={};
e[ZmRoster.F_PRESENCE]=this.getPresence();
this._notify(ZmEvent.E_MODIFY,{
fields:e}
)
};
ZmRoster.prototype.reload=function(t){
this.getRosterItemList().removeAllItems();
var a=new AjxCallback(this,this._handleResponseReload);
var e={
asyncMode:true,noBusyOverlay:t};
ZmImApp.INSTANCE.getService().getRoster(a,e)
};
ZmRoster.prototype._handleResponseReload=function(r){
if(!r){
return
}
var s=this.getRosterItemList();
if(r.items&&r.items.item){
var t=r.items.item;
if(t.length){
var e=new Array(t.length);
for(var a=0;
a<t.length;
a++){
var n=t[a];
if(n.subscription=="TO"||n.subscription=="BOTH"){
var o=new ZmRosterPresence();
o.setFromJS(n.presence);
e[a]=new ZmRosterItem(n.addr,s,n.name,o,n.groups)
}}
s.addItems(e)
}}
if(r.presence){
if(/XA|AWAY/.test(r.presence.show)){
r.presence.show="ONLINE";
this.setPresence("ONLINE")
}
this.getPresence().setFromJS(r.presence);
this.notifyPresence()
}
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.createRosterItem=function(a,t,e){
ZmImApp.INSTANCE.getService().createRosterItem(a,t,e)
};
ZmRoster.prototype.setPresence=function(e,t,a,o){
ZmImApp.INSTANCE.getService().setPresence(e,t,a,o);
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.pushNotification=function(e){
if(!this._gateways){
this._notificationBuffer.push(e)
}else{
this.handleNotification(e)
}};
ZmRoster.prototype.refresh=function(){
this._requestGateways(new AjxCallback(this,this.reload))
};
ZmRoster.prototype.handleNotification=function(e){
ZmImApp.INSTANCE.getService().handleNotification(e)
};
ZmRoster.prototype.getConferenceTree=function(){
AjxDispatcher.require(["IMConference"]);
if(!this._conferenceTree){
this._conferenceTree=new ZmTree(ZmOrganizer.CONFERENCE_ITEM);
this._conferenceTree.root=new ZmOrganizer({
tree:this._conferenceTree}
)
}
return this._conferenceTree
};
ZmRoster.prototype.getConferenceServices=function(o,a){
var e=this.getConferenceTree();
if(!e.root.children.size()||a){
var t=new AjxCallback(this,this._handleResponceGetConferenceServices,[o]);
ZmImApp.INSTANCE.getService().getConferenceServices(t)
}else{
o.run(e.root.children.getArray())
}};
ZmRoster.prototype._handleResponceGetConferenceServices=function(h,s){
var t=this.getConferenceTree();
var a=t.root;
for(var n=0,r=s.length;
n<r;
n++){
var o={
id:s[n].addr,tree:t,name:s[n].name,parent:a};
var e=new ZmConferenceService(o);
a.children.add(e)
}
h.run(a.children.getArray())
};
ZmRoster.prototype.joinChatRequest=function(e,o){
var t=AjxSoapDoc.create("IMJoinConferenceRoomRequest","urn:zimbraIM");
var a=t.getMethod();
a.setAttribute("thread",e);
a.setAttribute("addr",o);
appCtxt.getAppController().sendRequest({
soapDoc:t,asyncMode:true}
)
};
ZmRoster.prototype.sendSubscribeAuthorization=function(e,t,a){
ZmImApp.INSTANCE.getService().sendSubscribeAuthorization(e,t,a)
};
ZmRoster.prototype.addGatewayListListener=function(e){
this._evtMgr.addListener(ZmRoster.GATEWAY_EVENT,e)
};
ZmRoster.prototype.reconnectGateway=function(e){
ZmImApp.INSTANCE.getService().reconnectGateway(e);
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.unregisterGateway=function(e,t){
ZmImApp.INSTANCE.getService().unregisterGateway(e,t);
ZmImApp.INSTANCE.getService().startIgnoreNotify()
};
ZmRoster.prototype.registerGateway=function(e,o,a,t){
ZmImApp.INSTANCE.getService().registerGateway(e,o,a,t);
ZmImApp.INSTANCE.getService().startIgnoreNotify();
this.getGatewayByType(e).nick=o
};
ZmRoster.prototype._requestGateways=function(e){
ZmImApp.INSTANCE.getService().getGateways(new AjxCallback(this,this._handleRequestGateways,[e]))
};
ZmRoster.prototype._handleRequestGateways=function(s,n){
var a={};
var e={};
for(var t=0;
t<n.length;
++t){
var o=n[t]=new ZmImGateway(n[t]);
a[n[t].type.toLowerCase()]=o;
e[n[t].domain.toLowerCase()]=o
}
this._gateways={
byService:a,byDomain:e,array:n};
for(var t=0;
t<this._notificationBuffer.length;
++t){
this.handleNotification(this._notificationBuffer[t])
}
this._notificationBuffer=[];
this._evtMgr.notifyListeners(ZmRoster.GATEWAY_EVENT,{
roster:this}
);
if(s){
s.run()
}};
ZmRoster.prototype.getGatewayByType=function(e){
return this._gateways.byService[e.toLowerCase()]
};
ZmRoster.prototype.getGatewayByDomain=function(e){
return this._gateways.byDomain[e.toLowerCase()]
};
ZmRoster.prototype.getGateways=function(){
return this._gateways.array
};
ZmRoster.prototype.makeServerAddress=function(t,e){
return ZmImApp.INSTANCE.getService().makeServerAddress(t,e)
};
ZmRoster.prototype.makeGenericAddress=function(e){
e=this.breakDownAddress(e);
if(e.type.toLowerCase()=="xmpp"){
e.type="local"
}
return ZmImAddress.make(e.type,e.addr)
};
ZmRoster.prototype.breakDownAddress=function(o){
var t=/@(.*)$/;
var e=t.exec(o);
if(e){
var a=this.getGatewayByDomain(e[1]);
if(a){
return{
type:a.type,addr:o.substr(0,e.index),gateway:a}
}}
return{
type:"XMPP",addr:o}
};
ZmRoster.prototype.getGroups=function(){
return AjxVector.fromArray(this.getRosterItemList().getGroupsArray())
};
ZmRoster.prototype.setIdle=function(e){
if(ZmImApp.INSTANCE.getService().isLoggedIn()){
ZmImApp.INSTANCE.getService().setIdle(e,this._idleTimer.timeout)
}};
ZmRoster.prototype.onServiceAddChatMessage=function(e){
appCtxt.getApp(ZmApp.IM).prepareVisuals();
var o=this.getRosterItem(e.from);
if(o){
o._notifyTyping(false)
}
var a=this.getChatList();
var t=a.getChatByThread(e.thread);
if(t==null){
if(!e.fromMe){
t=a.getChatByRosterAddr(e.from,true,true)
}else{
t=a.getChatByRosterAddr(e.to,false)
}
if(t){
t.setThread(e.thread)
}}
if(t){
if(!e.fromMe){
if(appCtxt.get(ZmSetting.IM_PREF_FLASH_BROWSER)){
AjxDispatcher.require("Alert");
ZmBrowserAlert.getInstance().start(ZmMsg.newInstantMessage)
}
if(appCtxt.get(ZmSetting.IM_PREF_DESKTOP_ALERT)){
AjxDispatcher.require("Alert");
ZmDesktopAlert.getInstance().start(ZmMsg.newInstantMessage,e.getTextBody())
}}
t.addMessage(e)
}};
ZmRoster.prototype.onServiceAddBuddy=function(h,o,n,t,a){
var r=this.getRosterItemList();
var s=new ZmRosterItem(h,r,o,n,t);
r.addItem(s);
if(a){
this._newRosterItemtoastFormatter=this._newRosterItemtoastFormatter||new AjxMessageFormat(ZmMsg.imNewRosterItemToast);
var e=this._newRosterItemtoastFormatter.format([s.getDisplayName()]);
ZmTaskbarController.INSTANCE.setMessage(e)
}};
ZmRoster.prototype.onServiceRemoveBuddy=function(n,t){
var o=this.getRosterItemList();
var a=o.getByAddr(n);
if(a){
var e=a.getDisplayName();
o.removeItem(a);
if(t){
this._removeRosterItemToastFormatter=this._removeRosterItemToastFormatter||new AjxMessageFormat(ZmMsg.imRemoveRosterItemToast);
ZmTaskbarController.INSTANCE.setMessage(this._removeRosterItemToastFormatter.format([e]))
}}};
ZmRoster.prototype.onServiceRequestBuddyAuth=function(t){
var e=this.getRosterItem(t);
ZmTaskbarController.INSTANCE.showSubscribeRequest(t,e)
};
ZmRoster.prototype.onServiceSetBuddyPresence=function(s,r,o){
var n=s.getPresence().getShow();
if(s.getPresence().setFromJS(r)){
s._notifyPresence();
if(n!=ZmRosterPresence.SHOW_UNKNOWN){
this._presenceToastFormatter=this._presenceToastFormatter||new AjxMessageFormat(ZmMsg.imStatusToast);
var t=this._presenceToastFormatter.format([s.getDisplayName(),AjxStringUtil.htmlEncode(s.getPresence().getShowText())]);
var e=n==s.getPresence().getShow();
if(o&&((!e&&appCtxt.get(ZmSetting.IM_PREF_NOTIFY_PRESENCE))||(e&&appCtxt.get(ZmSetting.IM_PREF_NOTIFY_STATUS)))){
ZmTaskbarController.INSTANCE.setMessage(t);
var a=this.getChatList().getChatByRosterAddr(r.from);
if(a){
a.addMessage(ZmChatMessage.system(t))
}}}}};
ZmRoster.prototype.onServiceLoggedIn=function(t){
if(!this._idleTimer){
this._idleTimer=new DwtIdleTimer(appCtxt.get(ZmSetting.IM_PREF_IDLE_TIMEOUT)*60*1000,new AjxCallback(this,this.setIdle));
if(!appCtxt.get(ZmSetting.IM_PREF_REPORT_IDLE)){
this._idleTimer.kill()
}}
this._notify(ZmEvent.E_LOAD,{
loggedIn:true}
);
var a=new AjxCallback(this,this._loggedInGatewayCallback,[t]);
var e={
asyncMode:true,noBusyOverlay:true};
ZmImApp.INSTANCE.getService().getGateways(a,e)
};
ZmRoster.prototype._loggedInGatewayCallback=function(e,t){
this._handleRequestGateways(null,t);
ZmImApp.INSTANCE.getService().initializePresence(e?e.presence:null);
this.reload();
if(e&&e.callback){
e.callback.run(this)
}};
ZmRoster.prototype.onServiceLoggedOut=function(){
if(this.getPresence().setFromJS({
show:ZmRosterPresence.SHOW_OFFLINE}
)){
this.notifyPresence()
}
this.getRosterItemList().removeAllItems();
this._notify(ZmEvent.E_LOAD,{
loggedIn:false}
)
};
ZmRosterTreeGroups=function(e){
this._groups=e.getGroups()
};
ZmRosterTreeGroups.prototype.constructor=ZmRosterTreeGroups;
ZmRosterTreeGroups.prototype.autocompleteMatch=function(r,h){
r=r.toLowerCase();
var e=[];
var t=this._groups;
var s=t.size();
for(var o=0;
o<s;
o++){
var n=t.get(o);
if(n.toLowerCase().indexOf(r)==0){
e.push({
data:n,text:n}
)
}}
h.run(e)
};
ZmRosterTreeGroups.prototype.getArray=function(){
return this._groups
}
}
if(AjxPackage.define("zimbraMail.im.view.ZmImOverview")){
ZmImOverview=function(e,a){
if(!a){
a={}
}
var t={
parent:e,parentElement:a.parentElement,className:"ZmImOverview",posStyle:a.posStyle||Dwt.ABSOLUTE_STYLE};
DwtComposite.call(this,t);
this._groupItems={};
this._itemsById={};
delete a.parentElement;
this._options=a;
this._sortBy=appCtxt.get("IM_PREF_BUDDY_SORT");
this._actionMenuOps={
root:[ZmOperation.NEW_ROSTER_ITEM,ZmOperation.NEW_ROSTER_GROUP,ZmOperation.SEP,ZmOperation.IM_TOGGLE_OFFLINE,ZmOperation.IM_TOGGLE_BLOCKED,ZmOperation.SEP,ZmOperation.IM_SORT_BY_PRESENCE,ZmOperation.IM_SORT_BY_NAME],buddy:[ZmOperation.IM_NEW_CHAT,ZmOperation.IM_BUDDY_ARCHIVE,ZmOperation.SEP,ZmOperation.EDIT_PROPS,ZmOperation.DELETE,ZmOperation.SEP,ZmOperation.IM_CREATE_CONTACT,ZmOperation.IM_ADD_TO_CONTACT,ZmOperation.IM_EDIT_CONTACT],assistant:[ZmOperation.IM_NEW_CHAT],group:[ZmOperation.NEW_ROSTER_ITEM,ZmOperation.IM_DELETE_GROUP]};
this._actionMenuPopdownListener=new AjxListener(this,this._actionMenuPopdownListener);
this._im_dragSrc=new DwtDragSource(Dwt.DND_DROP_MOVE);
this._im_dragSrc.addDragListener(new AjxListener(this,this._dragListener));
this.__filters=[];
this.__filterOffline=appCtxt.get(ZmSetting.IM_PREF_HIDE_OFFLINE);
if(this.__filterOffline){
this.__filters.push(ZmImOverview.FILTER_OFFLINE_BUDDIES)
}
this.__filterBlocked=appCtxt.get(ZmSetting.IM_PREF_HIDE_BLOCKED);
if(this.__filterBlocked){
this.__filters.push(ZmImOverview.FILTER_BLOCKED_BUDDIES)
}
this._modelListeners=[];
this._init()
};
ZmImOverview.prototype=new DwtComposite;
ZmImOverview.prototype.constructor=ZmImOverview;
ZmImOverview.prototype.toString=function(){
return"ZmImOverview"
};
ZmImOverview.NO_MESSAGE=0;
ZmImOverview.NOT_LOGGED_IN=1;
ZmImOverview.LOADING=2;
ZmImOverview.NO_BUDDIES=3;
ZmImOverview.prototype.dispose=function(){
for(var e in this._actionMenuOps){
var n=this._actionMenuOps[e]._dwtControl;
if(n){
n.dispose()
}}
for(var t=0,a=this._modelListeners.length;
t<a;
t++){
var o=this._modelListeners[t];
o.modelObject.removeChangeListener(o.listener)
}
DwtComposite.prototype.dispose.call(this)
};
ZmImOverview.prototype.getTree=function(){
return this._tree
};
ZmImOverview.prototype._dragListener=function(e){
var t=e.srcControl.getData("ZmImOverview.data");
switch(e.action){
case DwtDragEvent.SET_DATA:if(t.buddy){
e.srcData=t.buddy;
e.srcData._drag_from_group=e.srcControl.parent.getData("ZmImOverview.data").group
}
break
}};
ZmImOverview.prototype._setCheck=function(e,t){
e.setImage(t?"Check":null)
};
ZmImOverview.prototype._setCheckOp=function(a,o,t){
var e=a.getMenuItem(o);
if(e){
this._setCheck(e,t)
}};
ZmImOverview.prototype._updateFilter=function(t,e){
if(e){
this.addFilter(t)
}else{
this.removeFilter(t)
}};
ZmImOverview.prototype._newGroupOkCallback=function(a){
var t;
if(!a.value){
t=ZmMsg.nameEmpty
}else{
if(this._groupItems[a.value]){
t=ZmMsg.imGroupExists
}}
if(t){
var e=appCtxt.getMsgDialog();
e.reset();
e.setMessage(t,DwtMessageDialog.CRITICAL_STYLE);
e.popup()
}else{
this._updateSpecialItems(ZmImOverview.NO_MESSAGE);
this.getGroupItem(a.value).setExpanded(true);
a.dialog.popdown()
}};
ZmImOverview.prototype._actionMenuListener=function(a,o){
var e=o.item.getData(ZmOperation.KEY_ID);
switch(e){
case ZmOperation.IM_SORT_BY_PRESENCE:this.sort(ZmImApp.BUDDY_SORT_PRESENCE,true);
break;
case ZmOperation.IM_SORT_BY_NAME:this.sort(ZmImApp.BUDDY_SORT_NAME,true);
break;
case ZmOperation.IM_TOGGLE_OFFLINE:this.__filterOffline=!this.__filterOffline;
appCtxt.getSettings().getSetting(ZmSetting.IM_PREF_HIDE_OFFLINE).setValue(this.__filterOffline);
this._updateFilter(ZmImOverview.FILTER_OFFLINE_BUDDIES,this.__filterOffline);
break;
case ZmOperation.IM_TOGGLE_BLOCKED:this.__filterBlocked=!this.__filterBlocked;
appCtxt.getSettings().getSetting(ZmSetting.IM_PREF_HIDE_BLOCKED).setValue(this.__filterBlocked);
this._updateFilter(ZmImOverview.FILTER_BLOCKED_BUDDIES,this.__filterBlocked);
break;
case ZmOperation.NEW_ROSTER_GROUP:this._newGroupOkCallbackObj=this._newGroupOkCallbackObj||new AjxCallback(this,this._newGroupOkCallback);
AjxDispatcher.require(["IM"]);
var h={
title:ZmMsg.imCreateNewGroup,label:ZmMsg.imGroupName,callback:this._newGroupOkCallbackObj};
ZmPromptDialog.getInstance().popup(h);
break;
default:var r=appCtxt.getApp("IM").getImController();
var s=r._listeners[e];
if(s){
var t={
dwtObj:o.dwtObj};
if(a&&this._actionedItem){
var n=this._actionedItem.getData("ZmImOverview.data");
t.type=n.type;
t.buddy=n.buddy;
t.group=n.group;
t.actionedItem=this._actionedItem
}
s.handleEvent(t)
}}};
ZmImOverview.PRESENCE_SORT_INDEX={
CHAT:1,ONLINE:2,AWAY:3,XA:4,DND:5,OFFLINE:6,UNKNOWN:7};
ZmImOverview.CMP_SORT_BY_NAME=function(t,e){
t=t.getData("ZmImOverview.data").buddy.getDisplayName();
e=e.getData("ZmImOverview.data").buddy.getDisplayName();
return t<e?-1:(t>e?1:0)
};
ZmImOverview.CMP_SORT_BY_PRESENCE=function(o,t){
var e=ZmImOverview.PRESENCE_SORT_INDEX[o.getData("ZmImOverview.data").buddy.getPresence().getShow()]||100;
var n=ZmImOverview.PRESENCE_SORT_INDEX[t.getData("ZmImOverview.data").buddy.getPresence().getShow()]||100;
if(e==n){
return ZmImOverview.CMP_SORT_BY_NAME(o,t)
}
return e-n
};
ZmImOverview.prototype.sort=function(t,e){
if(t&&(t!=this._sortBy)){
this._sortBy=t;
appCtxt.getSettings().getSetting("IM_PREF_BUDDY_SORT").setValue(t)
}
if(e){
if(this._sortActionId){
AjxTimedAction.cancelAction(this._sortActionId)
}
this._doSort()
}else{
if(!this._sortActionId){
this._doSortAction=this._doSortAction||new AjxTimedAction(this,this._doSort);
this._sortActionId=AjxTimedAction.scheduleAction(this._doSortAction,1000)
}}};
ZmImOverview.prototype._doSort=function(){
this._sortActionId=null;
var e=this._rootItem;
var t=e.getItems();
var n=this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE?ZmImOverview.CMP_SORT_BY_PRESENCE:ZmImOverview.CMP_SORT_BY_NAME;
for(var a=0;
a<t.length;
++a){
var o=t[a];
o.sort(n)
}};
ZmImOverview.prototype.chatWithBuddy=function(e){
ZmTaskbarController.INSTANCE.chatWithRosterItem(e);
ZmImOverview._popdownDialog()
};
ZmImOverview.prototype._actionMenuPopdownListener=function(){
if(this._actionedItem){
this._actionedItem._setActioned(false)
}};
ZmImOverview.prototype._getActionMenu=function(o,c,d){
var t=this._actionMenuOps[o];
if(t){
var e=t._dwtControl;
if(!e){
var l=this;
while(l&&!(l instanceof DwtDialog)){
l=l.parent
}
e=t._dwtControl=new ZmActionMenu({
parent:this,menuItems:t}
);
var a=new AjxListener(this,this._actionMenuListener,[true]);
for(var n=0;
n<e.opList.length;
++n){
var u=e.opList[n];
e.addSelectionListener(u,a)
}
e.addPopdownListener(this._actionMenuPopdownListener)
}
if(o=="buddy"){
var h=c.getContact();
e.getOp(ZmOperation.IM_ADD_TO_CONTACT).setVisible(!h);
e.getOp(ZmOperation.IM_CREATE_CONTACT).setVisible(!h);
e.getOp(ZmOperation.IM_EDIT_CONTACT).setVisible(!!h)
}else{
if(o=="root"){
var r=ZmImApp.loggedIn();
for(var n=0,s=e.opList.length;
n<s;
n++){
var u=e.getMenuItem(e.opList[n]);
if(u){
u.setEnabled(r)
}}
if(r){
this._setCheckOp(e,ZmOperation.IM_TOGGLE_OFFLINE,this.__filterOffline);
this._setCheckOp(e,ZmOperation.IM_TOGGLE_BLOCKED,this.__filterBlocked);
this._setCheckOp(e,ZmOperation.IM_SORT_BY_PRESENCE,this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE);
this._setCheckOp(e,ZmOperation.IM_SORT_BY_NAME,this._sortBy==ZmImApp.BUDDY_SORT_NAME)
}}}
return e
}};
ZmImOverview.prototype._treeMouseUpListener=function(a){
if((a.button==DwtMouseEvent.RIGHT)){
if(!this._treeViewActionMenu){
var n=[ZmOperation.NEW_ROSTER_ITEM,ZmOperation.IM_NEW_CHAT];
this._treeViewActionMenu=new ZmActionMenu({
parent:this.shell,menuItems:n}
);
var o=new AjxListener(this,this._actionMenuListener,[false]);
for(var e=0,t=n.length;
e<t;
e++){
this._treeViewActionMenu.addSelectionListener(n[e],o)
}}
this._treeViewActionMenu.popup(0,a.docX,a.docY)
}};
ZmImOverview.prototype._treeSelectionListener=function(a){
if(a.detail!=DwtTree.ITEM_ACTIONED&&a.detail!=DwtTree.ITEM_SELECTED&&a.detail!=DwtTree.ITEM_DBL_CLICKED){
return
}
var o=a.item.getData("ZmImOverview.data");
var t=o.type;
var n=o.group;
var e=o.buddy;
if(a.detail==DwtTree.ITEM_ACTIONED){
var s=this._getActionMenu(t,e,n);
if(s){
this._actionedItem=a.item;
s.popup(0,a.docX,a.docY)
}}else{
if(a.detail==DwtTree.ITEM_SELECTED&&e){
if(this._options.singleClick){
DwtMenu.closeActiveMenu();
this.chatWithBuddy(e)
}else{
ZmTaskbarController.INSTANCE.selectChatForRosterItem(e)
}}else{
if(a.detail==DwtTree.ITEM_DBL_CLICKED){
if(!this._options.singleClick){
if(e){
this.chatWithBuddy(e)
}else{
if(n){
a.item.setExpanded(!a.item.getExpanded())
}}}}}}};
ZmImOverview.prototype._init=function(){
var a=this._groupDropTgt=new DwtDropTarget(["ZmRosterItem"]);
a.addDropListener(new AjxListener(this,this._groupDropListener));
var s={
parent:this,className:this._options.overviewId?"OverviewTree":null};
var t=this._tree=new DwtTree(s);
t.getHtmlElement().style.width="100%";
if(!this._options.overviewId){
t.getHtmlElement().style.overflow="auto"
}
if(!this._options.inactiveTree){
t.addSelectionListener(new AjxListener(this,this._treeSelectionListener))
}
t.addListener(DwtEvent.ONMOUSEUP,new AjxListener(this,this._treeMouseUpListener));
this._rootItem=new DwtHeaderTreeItem({
parent:t,overview:this,className:"overviewHeader",noNodeCell:this._options.noHeaderNodeCell}
);
this._rootItem.setData("ZmImOverview.data",{
type:"root"}
);
this._rootItem.setText(ZmMsg.buddyList);
this._rootItem.enableSelection(false);
var r=this._roster=AjxDispatcher.run("GetRoster");
if(!this._options.noAssistant){
var o=r.getRosterItemList();
var n=new ZmAssistantBuddy(o);
this._createTreeItems("assistant",n)
}
this._listen(r,new AjxListener(this,this._rosterListener));
this._listen(r.getRosterItemList(),new AjxListener(this,this._rosterItemListListener));
var e=ZmImApp.loggedIn();
if(e){
o=r.getRosterItemList()
}
if(e&&o.size()){
this._updateSpecialItems(ZmImOverview.NO_MESSAGE);
o.getVector().foreach(this._createBuddy,this);
this.sort()
}else{
this._updateSpecialItems(e?ZmImOverview.NO_BUDDIES:ZmImOverview.NOT_LOGGED_IN)
}
t.addSeparator();
if(!this._options.overviewId){
this.addControlListener(new AjxListener(this,this._controlListener))
}
if(this._options.expanded){
this._rootItem.setExpanded(true)
}else{
t.addTreeListener(new AjxListener(this,this._treeListener))
}};
ZmImOverview.prototype._treeListener=function(e){
if(!this._didInitialExpand&&(e.detail==DwtTree.ITEM_EXPANDED)&&e.items.length&&(e.items[0]==this._rootItem)){
var t=this._groupItems[ZmMsg.buddies];
if(t){
t.setExpanded(true)
}
this._didInitialExpand=true
}};
ZmImOverview.prototype._controlListener=function(o){
var t={
x:o.oldWidth,y:o.oldHeight};
var e={
x:o.newWidth,y:o.newHeight};
if(t.x!=e.x||t.y!=e.y){
var a=e.y;
if(AjxEnv.isIE){
a-=2
}
this._tree.setSize(Dwt.DEFAULT,a)
}};
ZmImOverview._popdownDialog=function(){
if(ZmImNewChatDlg._INSTANCE){
ZmImNewChatDlg._INSTANCE.popdown()
}};
ZmImOverview.login=function(){
ZmImApp.INSTANCE.login()
};
ZmImOverview.newBuddy=function(){
ZmImApp.INSTANCE.prepareVisuals();
ZmImOverview._popdownDialog();
ZmImApp.INSTANCE.getImController()._newRosterItemListener()
};
ZmImOverview.prototype._updateSpecialItems=function(t){
var e=this._rootItem.getExpanded();
if(t==ZmImOverview.NO_MESSAGE){
if(this._infoItem){
this._infoItem.dispose();
this._infoItem=null
}
if(ZmImOverview.FILTER_SEARCH&&!this._filterItem){
this._filterItem=new ZmBuddyFilterItem({
parent:this._rootItem,overview:this}
);
this._filterItem.setData("ZmImOverview.data",{
type:"filter"}
)
}}else{
if(!this._infoItem){
this._rootItem.removeChildren();
this._filterItem=null;
this._groupItems={};
this._infoItem=new ZmInfoTreeItem({
parent:this._rootItem}
);
this._infoItem.setData("ZmImOverview.data",{
type:"infoItem"}
)
}
var a;
switch(t){
case ZmImOverview.NOT_LOGGED_IN:a=AjxMessageFormat.format(ZmMsg.imNotLoggedIn,"ZmImOverview.login()");
break;
case ZmImOverview.LOADING:a=ZmMsg.loading;
break;
case ZmImOverview.NO_BUDDIES:a=AjxMessageFormat.format(ZmMsg.imNoBuddies,"ZmImOverview.newBuddy()");
break
}
this._infoItem.setText(a)
}
if(e){
this._rootItem.setExpanded(true)
}};
ZmImOverview.prototype._listen=function(e,t){
e.addChangeListener(t);
this._modelListeners.push({
modelObject:e,listener:t}
)
};
ZmImOverview.prototype._rosterListener=function(e){
if(e.event==ZmEvent.E_LOAD){
this._updateSpecialItems(e.getDetails().loggedIn?ZmImOverview.LOADING:ZmImOverview.NOT_LOGGED_IN)
}};
ZmImOverview.prototype._rosterItemListListener=function(t){
var e=t.getDetail("fields");
if(t.event==ZmEvent.E_LOAD){
if(!t.source.size()){
this._updateSpecialItems(ZmImOverview.NO_BUDDIES)
}}else{
if(t.event==ZmEvent.E_CREATE){
if(this._infoItem){
this._updateSpecialItems(ZmImOverview.NO_MESSAGE)
}
var a=AjxVector.fromArray(t.getItems());
a.foreach(this._createBuddy,this);
if(a.size()){
this.sort()
}}else{
if(t.event==ZmEvent.E_MODIFY){
this._modifyBuddies(t.getItems(),e)
}else{
if(t.event==ZmEvent.E_REMOVE||t.event==ZmEvent.E_DELETE){
var a=AjxVector.fromArray(t.getItems());
a.foreach(this._removeBuddy,this)
}}}}};
ZmImOverview.prototype._groupDropListener=function(n){
if(!n.srcData){
return false
}
if(n.action==DwtDropEvent.DRAG_ENTER){
n.doIt=this._groupDropTgt.isValidTarget(n.srcData)
}else{
if(n.action==DwtDropEvent.DRAG_DROP){
var o=n.srcData;
var t=o._drag_from_group;
var s=n.targetControl.getData("ZmImOverview.data").group;
var e=AjxVector.fromArray(o.getGroups());
if(t!=s&&e.indexOf(s)==-1){
e.remove(t);
e.add(s);
var a=o.getDisplayName();
var r=o.getAddress();
AjxDispatcher.run("GetRoster").createRosterItem(r,a,e.join(","))
}}}};
ZmImOverview.prototype._getBuddyIcon=function(e){
var a=AjxDispatcher.run("GetRoster");
var t=a.getPrivacyList();
return t.isDenied(e.getAddress())?"BlockUser":e.getPresence().getIcon()
};
ZmImOverview.prototype._createBuddy=function(e){
return this._createTreeItems("buddy",e)
};
ZmImOverview.prototype._createTreeItems=function(s,o){
var e=o.getGroups();
if(e.length==0){
e=s=="buddy"?[ZmMsg.buddies]:[null]
}
var l=o.getDisplayName();
var r=this._getBuddyIcon(o);
var n=[];
var d=this._rootItem.getExpanded();
for(var t=0;
t<e.length;
++t){
var c=this.getGroupItem(e[t]);
var u=new DwtTreeItem({
parent:c,index:this.getSortIndex(o,c),text:AjxStringUtil.htmlEncode(l),imageInfo:r,singleClickAction:this._options.singleClick}
);
u.addClassName("ZmImPresence-"+o.getPresence().getShow());
u.setToolTipContent("-");
u.getToolTipContent=AjxCallback.simpleClosure(o.getToolTip,o);
u.setData("ZmImOverview.data",{
type:s,buddy:o}
);
u.setDragSource(this._im_dragSrc);
n.push(u);
if(this._options.expanded||(d&&(e[t]==ZmMsg.buddies))){
c.setExpanded(true)
}
var h=this._itemsById[o.getAddress()];
if(!h){
h=this._itemsById[o.getAddress()]=new AjxVector()
}
h.add(u)
}
this.applyFilters(n)
};
ZmImOverview.prototype._modifyBuddies=function(e,r){
var o=false;
var d=false;
for(var n=0,h=e.length;
n<h;
n++){
var l=e[n];
var c=this._itemsById[l.getAddress()];
if(c){
var u=ZmRosterItem.F_GROUPS in r;
if(u){
this._removeBuddy(l);
this._createTreeItems("buddy",l)
}else{
var t=ZmRosterItem.F_PRESENCE in r;
var m=ZmRosterItem.F_UNREAD in r;
var s=ZmRosterItem.F_NAME in r;
var a=ZmRosterItem.F_TYPING in r;
o=o||t;
d=d||s;
c.foreach(function(p){
if(t){
p.setImage(this._getBuddyIcon(l));
p.setClassName(p.getClassName());
p.addClassName("ZmImPresence-"+l.getPresence().getShow())
}
if(m||s){
var f=l.getDisplayName();
if(l.getUnread()){
f+=" ("+l.getUnread()+")";
f=f.bold()
}
p.setText(f)
}
if(a){
p.condClassName(r[ZmRosterItem.F_TYPING],"ZmRosterItem-typing")
}}
,this);
this.applyFilters(c.getArray())
}}}
if((o&&(this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE))||(d)){
this.sort()
}};
ZmImOverview.prototype._removeBuddy=function(t){
var e=this._itemsById[t.getAddress()];
e.foreach("dispose");
this._itemsById[t.getAddress()]=null
};
ZmImOverview.prototype.getGroupItem=function(t){
if(!t){
return this._rootItem
}
var e=this._groupItems[t];
if(!e){
e=this._groupItems[t]=new DwtTreeItem({
parent:this._rootItem,index:this.getSortIndex(t),text:AjxStringUtil.htmlEncode(t),imageInfo:"ImGroup"}
);
e.setToolTipContent("-");
e.getToolTipContent=function(){
var a=this.getData("ZmImOverview.data");
return AjxMessageFormat.format(ZmMsg.imGroupItemTooltip,[a.group,this.getItemCount()])
};
e.setData("ZmImOverview.data",{
type:"group",group:t}
);
e.setDropTarget(this._groupDropTgt)
}
return e
};
ZmImOverview.prototype.getSortIndex=function(c,h){
var s="buddy";
if(h==null){
s="group";
h=this._rootItem;
c=c.toLowerCase()
}
var n=h.getItems();
for(var t=0;
t<n.length;
++t){
var d=n[t];
var e=d.getData("ZmImOverview.data");
if(e.type=="filter"||e.type=="infoItem"){
continue
}
if(s=="buddy"){
if(this._sortBy==ZmImApp.BUDDY_SORT_NAME){
var o=e.buddy.getDisplayName();
if(o&&o.toLowerCase()>c.getDisplayName()){
break
}}else{
if(this._sortBy==ZmImApp.BUDDY_SORT_PRESENCE){
var l=ZmImOverview.PRESENCE_SORT_INDEX[e.buddy.getPresence().getShow()]||100;
var r=ZmImOverview.PRESENCE_SORT_INDEX[c.getPresence().getShow()]||100;
if(l>r){
break
}}}}else{
var o=e.group;
if(o&&o.toLowerCase()>c){
break
}}}
return t
};
ZmImOverview.prototype.addFilter=function(t){
for(var e=this.__filters.length;
--e>=0;
){
if(this.__filters[e]===t){
this.__filters.splice(e,1)
}}
this.__filters.push(t);
this.applyFilters()
};
ZmImOverview.prototype.removeFilter=function(t){
if(!this.__filters.length){
return
}
for(var e=this.__filters.length;
--e>=0;
){
if(this.__filters[e]===t){
this.__filters.splice(e,1)
}}
this.applyFilters(null,true)
};
ZmImOverview.prototype.applyFilters=function(s,o){
var e=this.__filters;
if(!e.length&&!o){
return
}
this._firstFilterItem=null;
var n=function(d){
var p=false;
for(var u=d.length;
--u>=0;
){
var m=d;
var y=true;
for(var c=e.length;
--c>=0;
){
var g=e[c];
if(g.call(this,m)){
y=false;
break
}}
if(!this._firstFilterItem&&y){
this._firstFilterItem=m
}
p=p||y;
m.setVisible(y)
}
return p
};
if(s){
n.call(this,s)
}else{
if(this._rootItem){
var r=this._rootItem;
var t=r.getItems();
for(var a=t.length;
--a>=0;
){
var h=t[a];
var s=h.getItems();
var l=n.call(this,s)||s.length==0;
h.setVisible(l);
if(l){
h.setExpanded(true)
}}}}};
ZmImOverview.FILTER_OFFLINE_BUDDIES=function(a){
var e=a.getData("ZmImOverview.data").buddy;
var t=e.getPresence();
return t.getShow()==ZmRosterPresence.SHOW_OFFLINE
};
ZmImOverview.FILTER_BLOCKED_BUDDIES=function(t){
var e=t.getData("ZmImOverview.data").buddy;
return AjxDispatcher.run("GetRoster").getPrivacyList().isDenied(e.getAddress())
};
ZmImOverview.FILTER_SEARCH={
func:function(a){
var t=this.__searchInputEl.value.toLowerCase();
var e=a.getData("ZmImOverview.data").buddy;
if(/^#/.test(t)){
return e.getAddress().indexOf(t.substr(1))<0
}else{
return e.getDisplayName().toLowerCase().indexOf(t)<0
}}
,_doKeyPress:function(){
var e=this.__searchInputEl.value;
if(!/S/.test(e)||e==ZmMsg.filter){
this.removeFilter(ZmImOverview.FILTER_SEARCH.func)
}else{
this.addFilter(ZmImOverview.FILTER_SEARCH.func)
}}
,inputFocus:function(){
Dwt.delClass(this.__searchInputEl,"DwtSimpleInput-hint","DwtSimpleInput-focused");
if(this.__searchInputEl.value==ZmMsg.filter){
this.__searchInputEl.value=""
}else{
try{
this.__searchInputEl.select()
}
catch(e){}}}
,inputBlur:function(){
Dwt.delClass(this.__searchInputEl,"DwtSimpleInput-focused","DwtSimpleInput-hint");
if(!/S/.test(this.__searchInputEl.value)){
this.__searchInputEl.value=ZmMsg.filter
}}
,inputKeyPress:function(t){
if(!t){
t=window.event
}
if(this.__searchInputTimeout){
clearTimeout(this.__searchInputTimeout)
}
if(t.keyCode==27){
this.__searchInputEl.value="";
ZmImOverview.FILTER_SEARCH._doKeyPress.call(this);
ZmImOverview.FILTER_SEARCH.inputBlur.call(this);
this.__searchInputEl.blur()
}
if(t.keyCode==13){
ZmImOverview.FILTER_SEARCH._doKeyPress.call(this);
if(!/S/.test(this.__searchInputEl.value)){
return
}
if(this._firstFilterItem){
var e=this._firstFilterItem.getData("ZmImOverview.data").buddy;
this.chatWithBuddy(e);
this.__searchInputEl.value="";
ZmImOverview.FILTER_SEARCH.inputBlur.call(this);
this.__searchInputEl.blur()
}}
this.__searchInputTimeout=setTimeout(AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH._doKeyPress,this),500)
}};
ZmBuddyFilterItem=function(e){
this.overview=e.overview;
e.className="ZmBuddyFilterItem";
DwtTreeItem.call(this,e)
};
ZmBuddyFilterItem.prototype=new DwtTreeItem;
ZmBuddyFilterItem.prototype.constructor=ZmBuddyFilterItem;
ZmBuddyFilterItem.prototype.toString=function(){
return"ZmBuddyFilterItem"
};
ZmBuddyFilterItem.prototype._createHtmlFromTemplate=function(t,a){
var o=this.getHtmlElement();
o.className="ZmBuddyFilterItem";
var e=o.ownerDocument.createElement("input");
this.overview.__searchInputEl=e;
e.autocomplete="off";
e.className="DwtSimpleInput";
o.appendChild(e);
e.onkeydown=AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH.inputKeyPress,this.overview);
e.onfocus=AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH.inputFocus,this.overview);
e.onblur=AjxCallback.simpleClosure(ZmImOverview.FILTER_SEARCH.inputBlur,this.overview);
e.onblur()
};
ZmInfoTreeItem=function(e){
e.className="ZmInfoTreeItem";
DwtTreeItem.call(this,e)
};
ZmInfoTreeItem.prototype=new DwtTreeItem;
ZmInfoTreeItem.prototype.constructor=ZmInfoTreeItem;
ZmInfoTreeItem.prototype.TEMPLATE="im.Chat#ZmInfoTreeItem";
ZmInfoTreeItem.prototype.toString=function(){
return"ZmInfoTreeItem"
}
}
if(AjxPackage.define("zimbraMail.im.view.ZmTaskbar")){
ZmTaskbar=function(e){
ZmToolBar.call(this,e);
ZmTaskbar.INSTANCE=this;
this._setMouseEvents();
this.shell.addControlListener(new AjxListener(this,this._shellControlListener))
};
ZmTaskbar.prototype=new ZmToolBar;
ZmTaskbar.prototype.constructor=ZmTaskbar;
ZmTaskbar.prototype.toString=function(){
return"ZmTaskbar"
};
ZmTaskbar.prototype.zShow=function(e){
this.setZIndex(e?Dwt.Z_VIEW+10:Dwt.Z_HIDDEN)
};
ZmTaskbar.prototype.expandItem=function(a,t,e){
if(t&&this.expandedItem){
this.expandedItem._expand(false)
}
a._expand(t,e);
this.expandedItem=t?a:null
};
ZmTaskbar.prototype.toggleExpanded=function(e){
this.expandItem(e,!e.expanded)
};
ZmTaskbar.prototype.conditionalExpand=function(e){
if(!this.expandedItem){
this.expandItem(e,true,true);
return true
}else{
return false
}};
ZmTaskbar.prototype._shellControlListener=function(e){
if((e.oldWidth!=e.newWidth)&&this.expandedItem){
this.expandedItem.positionContent()
}};
ZmTaskbarItem=function(a){
DwtComposite.call(this,a);
this._createHtml();
this._contentClassName=a.contentClassName;
var e={
style:DwtButton.TOGGLE_STYLE,parent:this,parentElement:this._buttonEl};
var t=a.buttonConstructor||DwtToolBarButton;
this.button=new t(e);
this.button.addSelectionListener(a.selectionListener);
if(a.op){
this.button.setText(ZmMsg[ZmOperation.getProp(a.op,"textKey")]);
this.button.setImage(ZmOperation.getProp(a.op,"image"));
this.button.setToolTipContent(ZmMsg[ZmOperation.getProp(a.op,"tooltipKey")])
}
this._rightAlign=a.rightAlign;
this._data=a.data
};
ZmTaskbarItem.prototype=new DwtComposite;
ZmTaskbarItem.prototype.constructor=ZmTaskbarItem;
ZmTaskbarItem.prototype.TEMPLATE="share.App#ZmTaskbarItem";
ZmTaskbarItem.prototype.toString=function(){
return"ZmTaskbarItem"
};
ZmTaskbarItem.prototype.getPopup=function(){
if(!this._popup){
AjxDispatcher.require(["IMCore","IM"]);
var args={
parent:this,parentElement:this._contentEl,taskbarItem:this,taskbar:this.parent,data:this._data};
var ctor=window.eval(this._contentClassName);
this._popup=new ctor(args)
}
return this._popup
};
ZmTaskbarItem.prototype._expand=function(a,t){
this.expanded=a;
Dwt.setVisible(this._contentEl,a);
this.button.setSelected(a);
var e=this.getPopup();
if(a){
this.showAlert(false);
e.popup(t);
this.positionContent()
}else{
e.popdown()
}};
ZmTaskbarItem.prototype.positionContent=function(){
if(this._rightAlign){
var e=Dwt.toWindow(this.button.getHtmlElement(),0,0).x;
var a=this.button.getW();
var t=this.parent.getBounds();
var o=1;
this._contentEl.style.right=t.x+t.width-e-a-o
}};
ZmTaskbarItem.prototype._createHtml=function(){
var e={
id:this._htmlElId};
this._createHtmlFromTemplate(this.TEMPLATE,e);
this._contentEl=document.getElementById(e.id+"_content");
this._buttonEl=document.getElementById(e.id+"_button")
}
}
if(AjxPackage.define("zimbraMail.im.controller.ZmTaskbarController")){
ZmTaskbarController=function(s){
ZmController.call(this,null);
ZmTaskbarController.INSTANCE=this;
var n=Dwt.byId(ZmId.SKIN_TASKBAR);
if(!n){
return
}
this._chatData={};
this._chatMru=[];
var o={
parent:appCtxt.getShell(),id:ZmId.TASKBAR,className:"ZmTaskbar",posStyle:Dwt.ABSOLUTE_STYLE};
this._toolbar=s[ZmAppViewMgr.C_TASKBAR]=new ZmTaskbar(o);
this._toolbar.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._toolbarMouseDownListener));
var h={
contentClassName:"ZmPresencePopup",op:ZmId.OP_IM_PRESENCE_MENU};
this._presenceItem=this._createItem(h);
this._toolbar.addSeparator();
this._newBuddySelectionListenerObj=new AjxListener(this,this._newBuddySelectionListener);
var a={
contentClassName:"ZmNewBuddyPopup",selectionListener:this._newBuddySelectionListenerObj,op:ZmId.OP_NEW_ROSTER_ITEM};
this._newBuddyItem=this._createItem(a);
this._newBuddyItem.button.setText("");
var t={
contentClassName:"ZmBuddyListPopup",op:ZmId.OP_IM_BUDDY_LIST};
this._createItem(t);
this._toolbar.addFiller(null);
this._chatButtonIndex=this._toolbar.getNumChildren()+1;
this._messageButton=new DwtToolBarButton({
parent:this._toolbar}
);
this._messageButton.setText(ZmMsg.betaIM);
this._messageButton.setEnabled(false);
var e=appCtxt.getSkinHint("presence","height")||24;
Dwt.setSize(n,Dwt.DEFAULT,e);
var r=ZmImApp.INSTANCE.getRoster();
this._updatePresenceButton(ZmImApp.loggedIn()?r.getPresence():null);
r.addChangeListener(new AjxListener(this,this._rosterChangeListener));
r.addGatewayListListener(new AjxListener(this,this._gatewayListListener));
ZmImApp.INSTANCE.getRoster().getChatList().addChangeListener(new AjxListener(this,this._chatListListener));
ZmImApp.INSTANCE.getRoster().getRosterItemList().addChangeListener(new AjxListener(this,this._rosterListChangeListener))
};
ZmTaskbarController.prototype=new ZmController;
ZmTaskbarController.prototype.constructor=ZmTaskbarController;
ZmTaskbarController.prototype.toString=function(){
return"ZmTaskbarController"
};
ZmTaskbarController.prototype.setMessage=function(e){
this._messageButton.setText(e);
if(this._resetMessageActionId){
AjxTimedAction.cancelAction(this._resetMessageActionId);
this._resetMessageActionId=0
}
this._resetMessageAction=this._resetMessageAction||new AjxTimedAction(this,this._resetMessage);
this._resetMessageActionId=AjxTimedAction.scheduleAction(this._resetMessageAction,3000)
};
ZmTaskbarController.prototype._resetMessage=function(e){
this._messageButton.setText(ZmMsg.betaIM);
this._resetMessageActionId=0
};
ZmTaskbarController.prototype.createChatItem=function(e,a){
this._addChatToMru(e);
var n=this._toolbar.addSeparator(null,this._chatButtonIndex++);
var t={
index:this._chatButtonIndex++,contentClassName:"ZmChatPopup",selectionListener:new AjxListener(this,this._chatSelectionListener,[e]),data:{
chat:e,statusListener:new AjxListener(this,this._chatStatusListener,[e]),closeListener:new AjxListener(this,this._closeChatListener,[e]),minimizeListener:new AjxListener(this,this._minimizeChatListener,[e])}};
var o=this._createItem(t);
o.button.setToolTipContent(new AjxCallback(this,this._getChatToolTip,[e]));
o.button.addListener(DwtEvent.ONMOUSEDOWN,new AjxListener(this,this._chatMouseDownListener,[e]));
this._chatData[e.id]={
chat:e,item:o,separator:n};
var s="Close";
o.button.setHoverImage(s);
this._closeClass=this._closeClass||AjxImg.getClassForImage(s);
this._toolbar.expandItem(o,true,a);
this._chatData[e.id].chatWidget=o.getPopup().chatWidget;
this._chatChangeListenerListenerObj=this._chatChangeListenerListenerObj||new AjxListener(this,this._chatChangeListenerListener);
e.addChangeListener(this._chatChangeListenerListenerObj);
return o
};
ZmTaskbarController.prototype.endChat=function(e){
e.sendClose();
ZmImApp.INSTANCE.getRoster().getChatList().removeChat(e)
};
ZmTaskbarController.prototype.selectChat=function(e,a){
var t=this._chatData[e.id];
if(t){
this._expandChatItem(t.item,e,true);
if(a){
t.chatWidget.setEditorContent(AjxStringUtil.trim(a))
}}};
ZmTaskbarController.prototype.selectChatForRosterItem=function(t){
var o=ZmImApp.INSTANCE.getRoster().getChatList().getChatsByRosterAddr(t.getAddress());
var e=null;
for(var a in o){
if(o[a].getRosterSize()==1){
e=o[a];
break
}}
if(e==null&&o.length>0){
e=o[0]
}
if(e!=null){
this.selectChat(e)
}};
ZmTaskbarController.prototype.chatWithContacts=function(t,e,o){
var a=t.map("getBuddy").sub(AjxCallback.isNull);
if(a.size()>0){
this.chatWithRosterItem(a.get(0),o)
}};
ZmTaskbarController.prototype.chatWithRosterItem=function(t,a){
var e=ZmImApp.INSTANCE.getRoster().getChatList().getChatByRosterItem(t,true);
this.selectChat(e,a)
};
ZmTaskbarController.prototype.getChatWidgetForChat=function(e){
var t=this._chatData[e.id];
return t?t.chatWidget:null
};
ZmTaskbarController.prototype.showSubscribeRequest=function(s,t){
this._subscribeData=this._subscribeData||{};
if(this._subscribeData[s]){
return
}
var n=this._toolbar.addSeparator(null,this._chatButtonIndex+1);
var e={
index:this._chatButtonIndex+1,op:ZmId.OP_IM_INVITE,rightAlign:true,contentClassName:"ZmSubscribePopup",data:{
addr:s,buddy:t}};
var a=this._createItem(e);
this._subscribeData[s]={
item:a,separator:n};
this._subscribeRequestTooltip=this._subscribeRequestTooltip||new AjxMessageFormat(ZmMsg.imInvitationFrom);
var o=this._subscribeRequestTooltip.format(t?t.getDisplayName():s);
a.button.setToolTipContent(o);
if(!this._toolbar.conditionalExpand(a)){
a.showAlert(true)
}
a.addDisposeListener(new AjxListener(this,this._subscribeDisposeListener,[s]))
};
ZmTaskbarController.prototype.showNewBuddyPopup=function(){
this._toolbar.expandItem(this._newBuddyItem,true);
return this._newBuddyItem.getPopup()
};
ZmTaskbarController.prototype.showGatewayPopup=function(t){
if(this._gatewayData){
var e=this._gatewayData[t];
if(e){
this._toolbar.expandItem(e.item,true)
}}};
ZmTaskbarController.prototype._subscribeDisposeListener=function(t){
var e=this._subscribeData[t];
this._toolbar.removeSeparator(e.separator);
delete this._subscribeData[t]
};
ZmTaskbarController.prototype._addChatToMru=function(e){
if(this._chatMru.length>=4){
for(var o=this._chatMru.length,a=o-1;
a>=0;
a--){
var t=this._chatMru[a];
var n=this._chatData[t.id].item;
if(!n.expanded&&!n.isAlertShown()){
this.endChat(t);
break
}}}
this._chatMru.unshift(e)
};
ZmTaskbarController.prototype._updateChatMru=function(e){
if(this._chatMru.length&&(this._chatMru[0]!=e)){
this._removeChatFromMru(e);
this._chatMru.unshift(e)
}};
ZmTaskbarController.prototype._removeChatFromMru=function(e){
for(var t=0,a=this._chatMru.length;
t<a;
t++){
if(this._chatMru[t]==e){
this._chatMru.splice(t,1);
return
}}};
ZmTaskbarController.prototype._chatMouseDownListener=function(e,a){
if(a.button!=DwtMouseEvent.RIGHT){
return
}
this._actionedChat=e;
if(!this._chatActionMenu){
var t={
parent:appCtxt.getShell(),controller:this,context:ZmId.TASKBAR,menuType:"Chat",menuItems:[ZmId.OP_IM_CLOSE_CHAT,ZmId.OP_IM_CLOSE_ALL_CHATS,ZmId.OP_IM_CLOSE_OTHER_CHATS]};
this._chatActionMenu=new ZmActionMenu(t);
this._chatActionMenu.getOp(ZmId.OP_IM_CLOSE_CHAT).addSelectionListener(new AjxListener(this,this._closeChatMenuListener));
this._chatActionMenu.getOp(ZmId.OP_IM_CLOSE_ALL_CHATS).addSelectionListener(new AjxListener(this,this._closeAllChatsListener));
this._chatActionMenu.getOp(ZmId.OP_IM_CLOSE_OTHER_CHATS).addSelectionListener(new AjxListener(this,this._closeOtherChatsListener))
}
this._chatActionMenu.popup(0,a.docX,a.docY)
};
ZmTaskbarController.prototype._closeChatMenuListener=function(){
this.endChat(this._actionedChat);
this._actionedChat=null
};
ZmTaskbarController.prototype._closeAllChatsListener=function(){
var e=[];
for(var o in this._chatData){
e.push(this._chatData[o].chat)
}
for(var t=0,a=e.length;
t<a;
t++){
this.endChat(e[t])
}
this._actionedChat=null
};
ZmTaskbarController.prototype._closeOtherChatsListener=function(){
var o=[];
for(var n in this._chatData){
var e=this._chatData[n].chat;
if(e!=this._actionedChat){
o.push(e)
}}
for(var t=0,a=o.length;
t<a;
t++){
this.endChat(o[t])
}
this._actionedChat=null
};
ZmTaskbarController.prototype._newBuddyListener=function(){
ZmImApp.INSTANCE.prepareVisuals();
ZmImApp.INSTANCE.getImController()._newRosterItemListener()
};
ZmTaskbarController.prototype._toolbarMouseDownListener=function(e){
if(e.button==DwtMouseEvent.LEFT&&this._toolbar.expandedItem){
this._toolbar.expandItem(this._toolbar.expandedItem,false)
}};
ZmTaskbarController.prototype._rosterListChangeListener=function(s){
if(s.event==ZmEvent.E_MODIFY){
var t=s.getDetail("fields");
var o=s.getItems();
for(var e=0;
e<o.length;
e++){
var h=o[e];
if(h instanceof ZmRosterItem){
var a;
a=a||ZmImApp.INSTANCE.getRoster().getChatList();
var d=a.getChatsByRosterAddr(h.getAddress());
for(var n in d){
var l=d[n];
var r=this.getChatWidgetForChat(d[n]);
if(r){
r._rosterItemChangeListener(h,t)
}}}}}};
ZmTaskbarController.prototype._chatListListener=function(a){
if(a.event==ZmEvent.E_CREATE){
var e=a.getDetails().items[0];
var o=this._chatData[e.id];
var t;
if(o){
this._toolbar.conditionalExpand(o.item)
}else{
t=this.createChatItem(e,a.getDetails().background)
}}else{
if(a.event==ZmEvent.E_DELETE){
var e=a._details.items[0];
this._deleteChatItem(e)
}}};
ZmTaskbarController.prototype._deleteChatItem=function(e){
this._removeChatFromMru(e);
e.removeChangeListener(this._chatChangeListenerListenerObj);
var t=this._chatData[e.id];
if(t){
this._toolbar.removeSeparator(t.separator);
t.item.dispose();
this._chatButtonIndex-=1;
delete this._chatData[e.id]
}};
ZmTaskbarController.prototype._getChatToolTip=function(e,a){
var t=e.getRosterItem().getToolTip();
a.run(t)
};
ZmTaskbarController.prototype._expandChatItem=function(t,e,a){
this._updateChatMru(e);
this._toolbar.expandItem(t,a);
var o=this._chatData[e.id].chatWidget;
o._onMinimize(!a);
if(a){
o.focus()
}};
ZmTaskbarController.prototype._chatSelectionListener=function(e,a){
if(e&&a.target&&(a.target.className==this._closeClass)){
this.endChat(e)
}else{
var t=a.dwtObj.parent;
this._expandChatItem(t,e,!t.expanded)
}};
ZmTaskbarController.prototype._selectionListener=function(e){
this._toolbar.toggleExpanded(e.dwtObj.parent)
};
ZmTaskbarController.prototype._newBuddySelectionListener=function(e){
if(ZmImApp.loggedIn()){
this._toolbar.toggleExpanded(this._newBuddyItem)
}else{
ZmImApp.INSTANCE.login({
callback:this._newBuddySelectionListenerObj}
)
}};
ZmTaskbarController.prototype._chatChangeListenerListener=function(o){
var e=o.source;
var t=this._chatData[e.id];
if(t&&!t.item.expanded){
var a=o.getDetail("fields")[ZmChat.F_MESSAGE];
if(a&&!a.fromMe&&!a.isSystem){
t.item.showAlert(true);
this._updateChatMru(e)
}}};
ZmTaskbarController.prototype._closeChatListener=function(e){
this.endChat(e)
};
ZmTaskbarController.prototype._minimizeChatListener=function(e){
var t=this._chatData[e.id].item;
this._expandChatItem(t,e,false);
t.button.setDisplayState(DwtControl.SELECTED);
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._minimzeTimedAction,t),250)
};
ZmTaskbarController.prototype._minimzeTimedAction=function(e){
e.button.setDisplayState(DwtControl.NORMAL)
};
ZmTaskbarController.prototype._chatStatusListener=function(t,e){
var a=this._chatData[t.id].item;
a.button.setImage(e.statusImage);
var o=e.title?AjxStringUtil.clipByLength(e.title,15):"";
a.button.setText(o)
};
ZmTaskbarController.prototype._createItem=function(e){
e.parent=this._toolbar;
e.selectionListener=e.selectionListener||new AjxListener(this,this._selectionListener);
return new ZmTaskbarItem(e)
};
ZmTaskbarController.prototype._rosterChangeListener=function(a){
if(a.event==ZmEvent.E_MODIFY){
var e=a.getDetail("fields");
if(ZmRoster.F_PRESENCE in e){
var t=ZmImApp.INSTANCE.getRoster().getPresence();
this._updatePresenceButton(t)
}}};
ZmTaskbarController.prototype._updatePresenceButton=function(a){
var t=this._presenceItem.button;
t.setImage(a?a.getIcon():"Offline");
var e=a?AjxStringUtil.htmlEncode(a.getShowText()):ZmMsg.imStatusOffline;
var o=ZmImApp.INSTANCE.getServiceController().getMyPresenceTooltip(e);
t.setToolTipContent(o)
};
ZmTaskbarController.prototype._gatewayListListener=function(s){
if(!ZmImApp.INSTANCE.getServiceController().capabilities[ZmImServiceController.ACCOUNTS]){
return
}
this._gatewayData=this._gatewayData||{};
var h=s.roster.getGateways();
for(var a=1,n=h.length;
a<n;
a++){
var r=h[a];
if(!this._gatewayData[r.type]){
for(var e in this._gatewayData){
this._toolbar.addSeparator();
break
}
var t={
buttonConstructor:ZmStatusImageButton,contentClassName:"ZmGatewayPopup",data:r,rightAlign:true};
var o=this._createItem(t);
o.button.setImage("WebSearch");
this._gatewayData[r.type]={
item:o};
r.addListener(ZmImGateway.EVENT_SET_STATE,new AjxListener(this,this._gatewayEventListener,[r]))
}
this._updateGatewayButton(r)
}};
ZmTaskbarController.prototype._gatewayEventListener=function(e){
this._updateGatewayButton(e)
};
ZmTaskbarController.prototype._updateGatewayButton=function(o){
var a=this._presenceItem.button.getImage();
var e;
if(o.isOnline()){
e=this._gatewayOnlineFormat=this._gatewayOnlineFormat||new AjxMessageFormat(ZmMsg.imStatusGatewayOnline)
}else{
e=this._gatewayOfflineFormat=this._gatewayOfflineFormat||new AjxMessageFormat(ZmMsg.imStatusGatewayOffline);
a="Offline"
}
var n=e.format([ZmMsg["imGateway_"+o.type],o.nick]);
var t=this._gatewayData[o.type].item.button;
t.setToolTipContent(n);
t.setStatusImage(a)
};
ZmStatusImageButton=function(e){
e.className="ZmStatusImageButton";
DwtButton.call(this,e)
};
ZmStatusImageButton.prototype=new DwtButton;
ZmStatusImageButton.prototype.constructor=ZmStatusImageButton;
ZmStatusImageButton.prototype.TEMPLATE="share.App#ZmStatusImageButton";
ZmStatusImageButton.prototype.toString=function(){
return"ZmStatusImageButton"
};
ZmStatusImageButton.prototype.dispose=function(){
this._statusIconEl=null;
DwtMenuItem.prototype.dispose.call(this)
};
ZmStatusImageButton.prototype.setStatusImage=function(e){
if(this._statusIconEl){
AjxImg.setImage(this._statusIconEl,e)
}};
ZmStatusImageButton.prototype._createHtmlFromTemplate=function(e,t){
DwtButton.prototype._createHtmlFromTemplate.call(this,e,t);
this._statusIconEl=document.getElementById(t.id+"_status_icon")
}
}
if(AjxPackage.define("zimbraMail.core.ZmAppViewMgr")){
ZmAppViewMgr=function(o,t,e,a){
ZmAppViewMgr._setContainerIds();
this._shell=o;
this._controller=t;
this._isNewWindow=e;
this._hasSkin=a;
this._shellSz=this._shell.getSize();
this._controlListener=new AjxListener(this,this._shellControlListener);
this._shell.addControlListener(this._controlListener);
this._sashSupported=(window.skin&&typeof window.skin.setTreeWidth=="function");
if(appCtxt.get(ZmSetting.HISTORY_SUPPORT_ENABLED)&&(!AjxEnv.isChrome&&(!AjxEnv.isSafari||AjxEnv.isSafari5up))&&!e&&!AjxEnv.isPrism){
this._historyMgr=appCtxt.getHistoryMgr();
this._historyMgr.addListener(new AjxListener(this,this._historyChangeListener))
}
this._hashView={};
this._nextHashIndex=0;
this._curHashIndex=0;
this._noHistory=false;
this._ignoreHistoryChange=false;
this._lastView=null;
this._currentView=null;
this._views={};
this._hidden=[];
this._appView={};
this._callbacks={};
this._viewApp={};
this._isAppView={};
this._isTransient={};
this._toRemove=[];
this._isTabView={};
this._tabParams={};
this._viewByTabId={};
this._components={};
this._containers={};
this._contBounds={};
this._pushCallback=new AjxCallback(this,this.pushView);
this._popCallback=new AjxCallback(this,this.popView);
this._createLoadingView()
};
ZmAppViewMgr.C_BANNER="banner";
ZmAppViewMgr.C_USER_INFO="userInfo";
ZmAppViewMgr.C_QUOTA_INFO="quota";
ZmAppViewMgr.C_SEARCH="search";
ZmAppViewMgr.C_PEOPLE_SEARCH="peopleSearch";
ZmAppViewMgr.C_SEARCH_BUILDER="searchBuilder";
ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR="searchBuilderToolbar";
ZmAppViewMgr.C_APP_CHOOSER="appChooser";
ZmAppViewMgr.C_TREE="tree";
ZmAppViewMgr.C_TREE_FOOTER="treeFooter";
ZmAppViewMgr.C_TOOLBAR_TOP="topToolbar";
ZmAppViewMgr.C_TOOLBAR_BOTTOM="bottomToolbar";
ZmAppViewMgr.C_APP_CONTENT="main";
ZmAppViewMgr.C_APP_CONTENT_FULL="fullScreen";
ZmAppViewMgr.C_STATUS="status";
ZmAppViewMgr.C_SASH="sash";
ZmAppViewMgr.C_TASKBAR="taskbar";
ZmAppViewMgr.C_FOOTER="footer";
ZmAppViewMgr.C_AD="adsrvc";
ZmAppViewMgr.ALL_COMPONENTS=[ZmAppViewMgr.C_BANNER,ZmAppViewMgr.C_USER_INFO,ZmAppViewMgr.C_QUOTA_INFO,ZmAppViewMgr.C_SEARCH,ZmAppViewMgr.C_PEOPLE_SEARCH,ZmAppViewMgr.C_SEARCH_BUILDER,ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR,ZmAppViewMgr.C_APP_CHOOSER,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_TOOLBAR_BOTTOM,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL,ZmAppViewMgr.C_STATUS,ZmAppViewMgr.C_SASH,ZmAppViewMgr.C_TASKBAR,ZmAppViewMgr.C_FOOTER,ZmAppViewMgr.C_AD];
ZmAppViewMgr.APP_COMPONENTS=[ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_STATUS,ZmAppViewMgr.C_SASH];
ZmAppViewMgr.CONT_ID_KEY={};
ZmAppViewMgr.CB_PRE_HIDE=1;
ZmAppViewMgr.CB_POST_HIDE=2;
ZmAppViewMgr.CB_PRE_SHOW=3;
ZmAppViewMgr.CB_POST_SHOW=4;
ZmAppViewMgr.CB_PRE_UNLOAD=5;
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_PEOPLE_SEARCH]=ZmId.SKIN_PEOPLE_SEARCH;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SEARCH_BUILDER]=ZmId.SKIN_SEARCH_BUILDER;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR]=ZmId.SKIN_SEARCH_BUILDER_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_TOOLBAR_BOTTOM]=ZmId.SKIN_APP_BOTTOM_TOOLBAR;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT]=ZmId.SKIN_APP_MAIN;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT_FULL]=ZmId.SKIN_APP_MAIN_FULL;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_STATUS]=ZmId.SKIN_STATUS;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_SASH]=ZmId.SKIN_SASH;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_TASKBAR]=ZmId.SKIN_TASKBAR;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_FOOTER]=ZmId.SKIN_FOOTER;
ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_AD]=ZmId.SKIN_AD
};
ZmAppViewMgr.prototype.toString=function(){
return"ZmAppViewMgr"
};
ZmAppViewMgr.prototype.isFullScreen=function(e){
e=e||this._currentView;
return Boolean(e&&this._views[e]&&this._views[e][ZmAppViewMgr.C_APP_CONTENT_FULL])
};
ZmAppViewMgr.prototype.addComponents=function(o,c,t){
var r=[];
for(var h in o){
var n=o[h];
this._components[h]=n;
if(this._hasSkin){
if(!this._containers[h]){
var a=ZmAppViewMgr.CONT_ID_KEY[h];
var s=document.getElementById(a);
if(!s&&h==ZmAppViewMgr.C_APP_CONTENT_FULL){
a=ZmAppViewMgr.CONT_ID_KEY[ZmAppViewMgr.C_APP_CONTENT];
s=document.getElementById(a)
}
if(!s){
continue
}
this._containers[h]=s;
if(c){
s.innerHTML="";
var e=this._getContainerBounds(h);
var l=Boolean(this._components[ZmAppViewMgr.C_TOOLBAR_TOP]);
if(e){
n.setBounds(e.x,e.y,e.width,e.height,l)
}}}
r.push(h)
}
if(!t){
n.zShow(true)
}
if(h==ZmAppViewMgr.C_SASH){
if(this._sashSupported){
n.registerCallback(this._appTreeSashCallback,this)
}
n.setCursor("default")
}}
if(c){
this._fitToContainer(r)
}};
ZmAppViewMgr.prototype.setComponent=function(o,t){
var e=this._components[o];
if(e){
e.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE)
}
var a={};
a[o]=t;
this.addComponents(a,true)
};
ZmAppViewMgr.prototype.showSearchBuilder=function(t){
skin.show("searchBuilder",t);
this._components[ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR].zShow(t);
this._components[ZmAppViewMgr.C_SEARCH_BUILDER].zShow(t);
var e=[ZmAppViewMgr.C_SEARCH_BUILDER,ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR,ZmAppViewMgr.C_APP_CHOOSER,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL];
this._fitToContainer(e);
if(!t){
this._components[ZmAppViewMgr.C_SEARCH_BUILDER].setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE)
}};
ZmAppViewMgr.prototype.showTreeFooter=function(e){
skin.show("treeFooter",e);
this._components[ZmAppViewMgr.C_TREE_FOOTER].zShow(e&&!this.isFullScreen());
this._fitToContainer([ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER])
};
ZmAppViewMgr.prototype.getCurrentViewId=function(){
return this._currentView
};
ZmAppViewMgr.prototype.getCurrentViewComponent=function(e){
return this._components[e]
};
ZmAppViewMgr.prototype.getLastViewId=function(){
return this._lastView
};
ZmAppViewMgr.prototype.getCurrentView=function(){
var e=this._views[this._currentView];
return e?e[ZmAppViewMgr.C_APP_CONTENT]||e[ZmAppViewMgr.C_APP_CONTENT_FULL]:null
};
ZmAppViewMgr.prototype.getAppView=function(e){
return this._appView[e]
};
ZmAppViewMgr.prototype.setAppView=function(t,e){
this._appView[t]=e
};
ZmAppViewMgr.prototype.createView=function(t){
var e=t.viewId;
this._views[e]=t.elements;
this._callbacks[e]=t.callbacks||{};
this._viewApp[e]=t.appName;
this._isAppView[e]=t.isAppView;
this._isTransient[e]=t.isTransient;
if(!this._isNewWindow&&t.tabParams){
this._tabParams[e]=t.tabParams;
this._isTabView[e]=Boolean(t.tabParams!=null);
this._viewByTabId[t.tabParams.id]=e
}};
ZmAppViewMgr.prototype.pushView=function(c,t){
c=this._viewByTabId[c]||c;
var a=(c==ZmAppViewMgr.PENDING_VIEW);
if(!a&&!this._views[c]){
return false
}
if(a){
c=this._pendingView
}
var e=this._getViewController(c);
if(c==this._currentView){
this._setViewVisible(c,true);
if(e){
e._restoreFocus()
}
return true
}
if(this._isTabView[c]){
var l=this._tabParams[c];
var r=l&&l.tabCallback&&l.tabCallback.run(this._currentView,c);
if(l&&!r){
var u=appCtxt.getAppChooser();
var s=u.getButton(l.id);
if(!s){
s=u.addButton(l.id,l);
s.setHoverImage("Close")
}}}
if(a){
t=true
}
if(!this._hideView(this._currentView,t||this._isTabView[this._currentView])){
this._pendingAction=this._pushCallback;
this._pendingView=c;
return false
}
this.addComponents(this._views[c]);
var h=this._getViewController(this._currentView);
var o=this._isTransient[this._currentView]||(h&&h.isTransient(this._currentView,c));
if(this._currentView&&(this._currentView!=c)&&!o){
this._hidden.push(this._currentView)
}
this._removeFromHidden(c);
var d=this._lastView;
this._lastView=this._currentView;
this._currentView=c;
if(!this._showView(c,t,(c!=this._currentView))){
this._currentView=this._lastView;
this._lastView=d;
this._pendingAction=this._pushCallback;
this._pendingView=c;
return false
}
if(this._noHistory){
this._noHistory=false
}else{
if(c!=ZmId.VIEW_LOADING){
this._nextHashIndex++;
this._curHashIndex=this._nextHashIndex;
this._hashView[this._curHashIndex]=c;
if(this._historyMgr){
this._historyMgr.add(this._curHashIndex)
}}}
this._layout(this._currentView);
if(e&&e.setCurrentView){
e.setCurrentView(c)
}
if(this._isAppView[c]){
this.setAppView(this._viewApp[c],c)
}
if(this._toRemove.length){
for(var n=0;
n<this._toRemove.length;
n++){
this._removeFromHidden(this._toRemove[n])
}
this._toRemove=[]
}
return true
};
ZmAppViewMgr.prototype.popView=function(n,e,h){
if(!this._currentView){
return false
}
var r=(n==ZmAppViewMgr.PENDING_VIEW);
if(r){
e=n;
n=true
}
if(e&&!r&&(this.getCurrentViewId()!=e)){
return false
}
var s=false,a=false;
var o=null;
if(!this._hidden.length&&!this._isNewWindow){
s=!this._isTabView[this._currentView];
a=true;
var t=AjxStringUtil.parseQueryString();
if(t&&((t.view&&t.view=="compose")||t.id)){
o=ZmApp.MAIL
}}
if(!this._hideView(this._currentView,n,s)){
this._pendingAction=this._popCallback;
this._pendingView=null;
return false
}
this._deactivateView(this._views[this._currentView]);
if(this._isTabView[this._currentView]){
appCtxt.getAppChooser().removeButton(this._tabParams[this._currentView].id)
}
if(a){
if(o){
this._controller.activateApp(ZmApp.MAIL)
}
return !s
}
this._lastView=this._currentView;
this._currentView=this._hidden.pop();
if(!this._currentView&&this._isNewWindow){
window.close();
return false
}
if(!this._showView(this._currentView,this._popCallback,null,n,true)){
return false
}
this._removeFromHidden(this._currentView);
if(this._historyMgr&&!h){
if(this._noHistory){
this._noHistory=false
}else{
this._ignoreHistoryChange=true;
history.back()
}}
this.addComponents(this._views[this._currentView]);
this._layout(this._currentView);
return true
};
ZmAppViewMgr.prototype.setView=function(t,n){
var e=this.pushView(t,n);
if(e){
for(var o=0;
o<this._hidden.length;
o++){
var a=this._views[this._hidden[o]];
this._deactivateView(a)
}
this._hidden=[]
}
return e
};
ZmAppViewMgr.prototype.stageView=function(e){
this._removeFromHidden(e);
this._hidden.push(e)
};
ZmAppViewMgr.prototype.replaceView=function(n,e){
n=n||this._currentView;
var t=this._views[n];
var o=this._views[e];
this._hideView(n,true);
for(var a in o){
t[a]=o[a]
}
if(this._currentView==n){
this._currentView=e;
this._showView(e);
this._layout(this._currentView)
}};
ZmAppViewMgr.prototype.isAppView=function(e){
return this._isAppView[e]
};
ZmAppViewMgr.prototype.showPendingView=function(e){
if(e&&this._pendingAction){
this._pendingAction.run(ZmAppViewMgr.PENDING_VIEW)
}
if(!e){
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._fitToContainer(ZmAppViewMgr.ALL_COMPONENTS)
};
ZmAppViewMgr.prototype.getPendingViewId=function(){
return this._pendingView
};
ZmAppViewMgr.prototype.reset=function(){
this._shell.removeControlListener(this._controlListener);
for(var t in this._views){
var a=this._views[t];
for(var e=0;
e<a.length;
e++){
for(var o in a[e]){
this._components[o].dispose();
this._components[o]=null;
this._containers[o]=null
}}}};
ZmAppViewMgr.prototype.updateTitle=function(){
this._setTitle(this._currentView)
};
ZmAppViewMgr.prototype.setTabTitle=function(e,o){
var a=this._tabParams[e];
var t=!appCtxt.isChildWindow&&a&&appCtxt.getAppChooser().getButton(a.id);
if(t){
t.setText(AjxStringUtil.htmlEncode(o))
}};
ZmAppViewMgr.prototype.isOkToUnload=function(){
var t=AjxUtil.getHashKeys(this._isTabView);
if(!this._isTabView[this._currentView]){
t.push(this._currentView)
}
for(var o=0;
o<t.length;
o++){
var e=t[o];
var n=this._callbacks[e]&&this._callbacks[e][ZmAppViewMgr.CB_PRE_UNLOAD];
if(n){
var a=n.run(e);
if(!a){
return false
}}}
return true
};
ZmAppViewMgr.prototype._createLoadingView=function(){
var t=new DwtControl({
parent:this._shell,className:"DwtListView",posStyle:Dwt.ABSOLUTE_STYLE,id:ZmId.LOADING_VIEW}
);
var e=t.getHtmlElement();
e.innerHTML=AjxTemplate.expand("share.App#Loading",this._htmlElId);
var a={};
a[ZmAppViewMgr.C_APP_CONTENT]=t;
this.createView({
viewId:ZmId.VIEW_LOADING,elements:a}
)
};
ZmAppViewMgr.prototype._fitToContainer=function(n,h){
for(var t=0;
t<n.length;
t++){
var r=n[t];
if(!h&&AjxEnv.isIE&&(r==ZmAppViewMgr.C_TASKBAR)){
if(!this._ieHackAction){
this._ieHackAction=new AjxTimedAction(this,this._fitToContainer,[[ZmAppViewMgr.C_TASKBAR],true])
}
AjxTimedAction.scheduleAction(this._ieHackAction,1)
}
var u=this._containers[r];
if(u){
var s=this._components[r];
if(s&&(s.getZIndex()!=Dwt.Z_HIDDEN)){
var a=this._getComponentPosition(r);
var c=(a==Dwt.STATIC_STYLE);
var d=s.getHtmlElement();
if(a){
d.style.position=a
}
if(c){
if(d.parentNode!=u){
u.appendChild(d)
}
if(s.adjustSize){
s.adjustSize()
}}else{
var o=Dwt.getBounds(u);
var e=Dwt.getInsets(u);
Dwt.insetBounds(o,e);
this._contBounds[r]=o;
var l=Boolean(this._components[ZmAppViewMgr.C_TOOLBAR_TOP]);
s.setBounds(o.x,o.y,o.width,o.height,l)
}}}}
if(window.DBG&&DBG.getDebugLevel()>=AjxDebug.DBG2){
this._debugShowMetrics(n)
}};
ZmAppViewMgr.prototype._getComponentPosition=function(e){
return appCtxt.getSkinHint(e,"position")
};
ZmAppViewMgr.prototype._getContainerBounds=function(n){
var e=this._getComponentPosition(n);
if(e==Dwt.STATIC_STYLE){
return null
}
var a=this._containers[n];
if(a){
var o=Dwt.getBounds(a);
var t=Dwt.getInsets(a);
Dwt.insetBounds(o,t);
return o
}
return null
};
ZmAppViewMgr.prototype._layout=function(t){
if(this._hasSkin){
return
}
var a=this._components[ZmAppViewMgr.C_TOOLBAR_TOP];
var n=a.getSize();
var e=n.y?n.y:a.getHtmlElement().clientHeight;
a.setBounds(0,0,this._shellSz.x,e);
var o=this._components[ZmAppViewMgr.C_APP_CONTENT]||this._components[ZmAppViewMgr.C_APP_CONTENT_FULL];
o.setBounds(0,e,this._shellSz.x,this._shellSz.y-e,Boolean(a))
};
ZmAppViewMgr.prototype._hideView=function(e,a,o){
if(!e){
return true
}
var t=true;
var n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_PRE_HIDE]:null;
if(n){
t=n.run(e,a)
}
if(t){
if(!o){
this._setViewVisible(e,false)
}
if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){
appCtxt.getKeyboardMgr().clearKeySeq()
}
n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_POST_HIDE]:null;
if(n){
n.run(e)
}}
return t
};
ZmAppViewMgr.prototype._showView=function(e,o,a){
var t=true;
var n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_PRE_SHOW]:null;
if(n){
t=n.run(e,a,o)
}
if(t){
this._setViewVisible(e,true);
n=this._callbacks[e]?this._callbacks[e][ZmAppViewMgr.CB_POST_SHOW]:null;
if(n){
n.run(e,a)
}}
this._onShowView(e,o,a);
return t
};
ZmAppViewMgr.prototype._onShowView=function(e,a,t){
appCtxt.notifyZimlets("onShowView",[e,t])
};
ZmAppViewMgr.prototype._setViewVisible=function(d,u){
var t=this._views[d];
var n=this._lastView?this.isFullScreen(this._lastView):null;
var a=this.isFullScreen(d);
if(u){
if(n!==a){
if(this._hasSkin){
skin.show("fullScreen",a)
}
for(var s=0;
s<ZmAppViewMgr.APP_COMPONENTS.length;
s++){
var c=ZmAppViewMgr.APP_COMPONENTS[s];
var r=this._components[c];
if(!r){
continue
}
r.zShow(!a);
if(a){
try{
r.setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE)
}
catch(l){}}}
if(!a&&this._hasSkin){
this._fitToContainer(ZmAppViewMgr.APP_COMPONENTS)
}}
var h=[];
for(var c in t){
h.push(c);
t[c].zShow(true);
this._components[c]=t[c]
}
if(this._hasSkin){
this._fitToContainer(h)
}
this._setTitle(d);
if(this._isTabView[d]){
var o=this._tabParams[d].id;
this._controller.setActiveTabId(o)
}
if(this._viewApp[d]){
this._controller.setActiveApp(this._viewApp[d],d,this._isTabView[d])
}}else{
for(var c in t){
t[c].setLocation(Dwt.LOC_NOWHERE,Dwt.LOC_NOWHERE);
t[c].zShow(false)
}}};
ZmAppViewMgr.prototype._removeFromHidden=function(e){
var a=[];
for(var t=0;
t<this._hidden.length;
t++){
if(this._hidden[t]!=e){
a.push(this._hidden[t])
}}
this._hidden=a
};
ZmAppViewMgr.prototype._deactivateView=function(e){
for(var a in e){
var t=e[a];
if(t.deactivate){
t.deactivate()
}}};
ZmAppViewMgr.prototype._setTitle=function(e){
var a=this._views[e];
if(!a){
return
}
var t=a[ZmAppViewMgr.C_APP_CONTENT]||a[ZmAppViewMgr.C_APP_CONTENT_FULL];
if(t&&t.getTitle){
var o=t.getTitle();
Dwt.setTitle(o?o:ZmMsg.zimbraTitle)
}};
ZmAppViewMgr.prototype._shellControlListener=function(o){
if(o.oldWidth!=o.newWidth||o.oldHeight!=o.newHeight){
this._shellSz.x=o.newWidth;
this._shellSz.y=o.newHeight;
var a=o.newWidth-o.oldWidth;
var r=o.newHeight-o.oldHeight;
if(this._isNewWindow){
var e=this._views[this._currentView];
if(e){
var t=e[ZmAppViewMgr.C_TOOLBAR_TOP];
if(t){
t.setSize(o.newWidth,Dwt.DEFAULT)
}
var s=e[ZmAppViewMgr.C_APP_CONTENT]||e[ZmAppViewMgr.C_APP_CONTENT_FULL];
if(s){
s.setSize(o.newWidth,o.newHeight-t.getH())
}}}else{
if(r&&a){
this.fitAll(true)
}else{
if(r){
var n=[ZmAppViewMgr.C_APP_CHOOSER,ZmAppViewMgr.C_TREE,ZmAppViewMgr.C_TREE_FOOTER,ZmAppViewMgr.C_SASH,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL,ZmAppViewMgr.C_STATUS,ZmAppViewMgr.C_TASKBAR,ZmAppViewMgr.C_AD,ZmAppViewMgr.C_FOOTER];
this._fitToContainer(n,true)
}else{
if(a){
var n=[ZmAppViewMgr.C_BANNER,ZmAppViewMgr.C_SEARCH,ZmAppViewMgr.C_PEOPLE_SEARCH,ZmAppViewMgr.C_USER_INFO,ZmAppViewMgr.C_QUOTA_INFO,ZmAppViewMgr.C_SEARCH_BUILDER,ZmAppViewMgr.C_SEARCH_BUILDER_TOOLBAR,ZmAppViewMgr.C_TOOLBAR_TOP,ZmAppViewMgr.C_APP_CONTENT,ZmAppViewMgr.C_APP_CONTENT_FULL,ZmAppViewMgr.C_TOOLBAR_BOTTOM,ZmAppViewMgr.C_TASKBAR,ZmAppViewMgr.C_AD,ZmAppViewMgr.C_FOOTER];
this._fitToContainer(n,true)
}}}}}};
ZmAppViewMgr.prototype._debugShowMetrics=function(o){
for(var t=0;
t<o.length;
t++){
var n=o[t];
var e=this._containers[n];
if(e){
var a=Dwt.getBounds(e)
}}};
ZmAppViewMgr.prototype._historyChangeListener=function(a){
if(appCtxt.inStartup){
return
}
if(!(a&&a.data)){
return
}
if(this._ignoreHistoryChange){
this._ignoreHistoryChange=false;
return
}
var o=DwtBaseDialog.getActiveDialog();
if(o&&o.isPoppedUp()){
o.popdown()
}
var t=parseInt(a.data);
this._noHistory=true;
var e=this._hashView[t];
if(t==(this._curHashIndex-1)){
this._browserAction=ZmAppViewMgr.BROWSER_BACK;
this.popView()
}else{
if(t==(this._curHashIndex+1)){
this._browserAction=ZmAppViewMgr.BROWSER_FORWARD;
this.pushView(e)
}else{
this._browserAction=null;
this.pushView(e)
}}
this._curHashIndex=t
};
ZmAppViewMgr.prototype._appTreeSashCallback=function(o){
if(!window.skin){
return
}
var e=skin.getTreeWidth();
if(!e){
return 0
}
if(!this.treeMinSize){
this.treeMinSize=window.skin.hints.tree.minWidth||150;
this.treeMaxSize=window.skin.hints.tree.maxWidth||300
}
if(e+o>this.treeMaxSize){
o=Math.max(0,this.treeMaxSize-e)
}
if(e+o<this.treeMinSize){
o=Math.min(0,this.treeMinSize-e)
}
var t=e+o;
skin.setTreeWidth(t);
var a=this;
setTimeout(function(){
a.fitAll(true)
}
,0);
return o
};
ZmAppViewMgr.prototype._getViewController=function(e){
var o;
var t=this._views[e];
if(t){
var a=t[ZmAppViewMgr.C_APP_CONTENT]||t[ZmAppViewMgr.C_APP_CONTENT_FULL];
o=a&&a.getController&&a.getController()
}
return o
}
}
if(AjxPackage.define("zimbraMail.core.ZmRequestMgr")){
ZmRequestMgr=function(e){
this._controller=e;
appCtxt.setRequestMgr(this);
ZmCsfeCommand.setServerUri(appCtxt.get(ZmSetting.CSFE_SERVER_URI));
var t=appCtxt.get(ZmSetting.CLIENT_VERSION);
ZmCsfeCommand.clientVersion=(!t||t.indexOf("@")==0)?"dev build":t;
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._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.prototype.toString=function(){
return"ZmRequestMgr"
};
ZmRequestMgr.prototype.sendRequest=function(x){
var t=x.response;
if(t){
if(x.reqId){
x=this._pendingRequests[x.reqId]||x;
x.response=t
}
x.asyncMode=true;
return this._handleResponseSendRequest(x,new ZmCsfeResult(t))
}
var y=x.reqId=("Req_"+ZmRequestMgr._nextReqId++);
var c=(x.timeout!=null)?x.timeout:this._stdTimeout;
if(c){
c=c*1000
}
var q=x.asyncMode?new AjxCallback(this,this._handleResponseSendRequest,[x]):null;
if(x.sensitive){
var v=document.location.protocol==ZmSetting.PROTO_HTTP;
var s=appCtxt.get(ZmSetting.PROTOCOL_MODE)==ZmSetting.PROTO_MIXED;
if(v&&s){
x.noSession=true;
var o=ZmCsfeCommand.getRequestStr(x);
var d=document.location;
var u=appCtxt.get(ZmSetting.HTTPS_PORT);
if(u&&u!=ZmSetting.DEFAULT_HTTPS_PORT){
u=":"+u
}
var h=document.createElement("IFRAME");
h.style.display="none";
h.id=Dwt.getNextId();
document.body.appendChild(h);
var p=Dwt.getIframeDoc(h);
p.write("<form ","id=",h.id,"-form ","target=",h.id,"-iframe ","method=POST ","action='https://",d.hostname,u,appContextPath,"/public/secureRequest.jsp'",">","<input type=hidden name=reqId value='",y,"'>","<textarea name=data>",AjxStringUtil.htmlEncode(o),"</textarea>","</form>","<iframe name=",h.id,"-iframe></iframe>");
p.close();
x.iframeId=h.id;
this._pendingRequests[y]=x;
var a=p.getElementById(h.id+"-form");
a.submit();
return
}}
var n=new ZmCsfeCommand();
var e=x.accountName;
if(!e){
var f=appCtxt.getActiveAccount();
e=(f&&f.id!=ZmAccountList.DEFAULT_ID)?f.name:null
}
var l,m;
if(x.restUri){
l={
restUri:x.restUri,asyncMode:x.asyncMode,callback:q}
}else{
l={
jsonObj:x.jsonObj,soapDoc:x.soapDoc,accountName:e,useXml:this._useXml,changeToken:(e?null:this._changeToken),asyncMode:x.asyncMode,callback:q,logRequest:this._logRequest,highestNotifySeen:this._highestNotifySeen,noAuthToken:true,skipAuthCheck:x.skipAuthCheck,resend:x.resend,noSession:x.noSession};
m=x.methodName=ZmCsfeCommand.getMethodName(l.jsonObj||l.soapDoc)
}
appCtxt.currentRequestParams=x;
var b=c?[y,x.errorCallback,x.noBusyOverlay]:null;
if(!x.noBusyOverlay){
var r=null;
var g=false;
if(c){
r=new AjxCallback(this,this.cancelRequest,b);
this._shell.setBusyDialogText(ZmMsg.askCancel);
g=true
}
this._shell.setBusy(true,y,g,c,r)
}else{
if(c){
var w=new AjxTimedAction(this,this.cancelRequest,b);
this._cancelActionId[y]=AjxTimedAction.scheduleAction(w,c)
}}
this._pendingRequests[y]=n;
try{
var t=x.restUri?n.invokeRest(l):n.invoke(l);
n.state=ZmRequestMgr._SENT
}
catch(k){
this._handleResponseSendRequest(x,new ZmCsfeResult(k,true));
return
}
return(x.asyncMode)?y:(this._handleResponseSendRequest(x,t))
};
ZmRequestMgr.prototype._handleResponseSendRequest=function(e,l){
var h=(e.response!=null);
if(!h){
if(!this._pendingRequests[e.reqId]){
return
}
if(this._pendingRequests[e.reqId].state==ZmRequestMgr._CANCEL){
return
}
this._pendingRequests[e.reqId].state=ZmRequestMgr._RESPONSE;
if(!e.noBusyOverlay){
this._shell.setBusy(false,e.reqId)
}else{
if(e.timeout){
AjxTimedAction.cancelAction(this._cancelActionId[e.reqId]);
this._cancelActionId[e.reqId]=-1
}}}
var t,r;
try{
if(e.asyncMode&&!e.restUri){
t=l.getResponse()
}else{
if(l._isException){
throw l._data
}else{
t=l
}}
if(t.Header){
r=this._handleHeader(t.Header)
}}
catch(o){
if(e.errorCallback){
var a=e.errorCallback.run(o);
if(!a){
this._handleException(o,e)
}}else{
this._handleException(o,e)
}
var s=l.getHeader();
if(s){
this._handleHeader(s);
this._handleNotifications(s)
}
this._clearPendingRequest(e.reqId);
return
}
if(e.asyncMode&&!e.restUri){
l.set(t.Body)
}
if(!appCtxt.isOffline&&!h){
this._controller._kickPolling(true)
}
var n=(DBG&&DBG.getDebugLevel()>0)?ZmCsfeCommand.getMethodName(e.jsonObj||e.soapDoc):"";
if(e.asyncMode&&e.callback){
e.callback.run(l)
}
this._handleNotifications(t.Header);
this._clearPendingRequest(e.reqId);
if(r&&(!appCtxt.isOffline||!appCtxt.multiAccounts)&&!e.more){
this._refreshHandler(r)
}
if(!e.asyncMode){
return t.Body
}};
ZmRequestMgr.prototype.cancelRequest=function(o,e,t){
if(!this._pendingRequests[o]){
return
}
if(this._pendingRequests[o].state==ZmRequestMgr._RESPONSE){
return
}
this._pendingRequests[o].state=ZmRequestMgr._CANCEL;
if(!t){
this._shell.setBusy(false,o)
}
this._pendingRequests[o].cancel();
if(e){
var a=new AjxException("Request canceled",AjxException.CANCELED,"ZmRequestMgr.prototype.cancelRequest");
e.run(a)
}
this._clearPendingRequest(o)
};
ZmRequestMgr.prototype._clearPendingRequest=function(a){
var t=this._pendingRequests[a];
if(t){
if(t.iframeId){
var e=document.getElementById(t.iframeId);
if(e){
e.parentNode.removeChild(e)
}}
delete this._pendingRequests[a]
}};
ZmRequestMgr.prototype._handleHeader=function(s){
var t=s&&s.context;
if(!t){
return
}
if(t.change){
this._changeToken=t.change.token
}
if(t.zdsync&&t.zdsync.account){
var e=t.zdsync.account;
for(var o=0;
o<e.length;
o++){
var n=appCtxt.accountList.getAccount(e[o].id);
if(n){
var a=e[o].dialog;
if(a){
this._handleOfflineInfoDialog(a[0],n)
}
n.updateState(e[o])
}}}
if(t.refresh){
this._controller.runAppFunction("_clearDeferredFolders");
this._loadTrees(t.refresh);
this._highestNotifySeen=0
}
return t.refresh
};
ZmRequestMgr.prototype._handleOfflineInfoDialog=function(a,o){
if(!a.type){
return
}
var e;
switch(a.type){
case ZmRequestMgr.OFFLINE_HEAP_DUMP:e=ZmMsg.offlineHeapDump;
break;
case ZmRequestMgr.OFFLINE_MUST_RESYNC:e=AjxMessageFormat.format(ZmMsg.offlineMustReSync,o.name);
break;
case ZmRequestMgr.OFFLINE_MUST_GAL_RESYNC:e=AjxMessageFormat.format(ZmMsg.offlineMustGalReSync,o.name);
break;
case ZmRequestMgr.OFFLINE_FOLDER_MOVE_FAILED:appCtxt.setStatusMsg(ZmMsg.offlineMoveFolderError);
break;
default:}
if(!e){
return
}
var t=appCtxt.getOkCancelMsgDialog();
t.setMessage(e);
t.registerCallback(DwtDialog.OK_BUTTON,this._handleOfflineDialogAction,this,[t,a.type,o.id,true]);
t.registerCallback(DwtDialog.CANCEL_BUTTON,this._handleOfflineDialogAction,this,[t,a.type,o.id,false]);
t.popup()
};
ZmRequestMgr.prototype._handleOfflineDialogAction=function(n,a,t,o){
var e={
jsonObj:{
DialogActionRequest:{
_jsns:"urn:zimbraOffline",type:a,id:t,action:o?"yes":"no"}}
,callback:new AjxCallback(this,this._handleOfflineDialogActionResp,n),errorCallback:new AjxCallback(this,this._handleOfflineDialogActionResp,n),asyncMode:true};
this.sendRequest(e)
};
ZmRequestMgr.prototype._handleOfflineDialogActionResp=function(t,e){
if(t.isPoppedUp()){
t.popdown()
}};
ZmRequestMgr.prototype._handleException=function(e,a){
var t=false;
if(ZmRequestMgr.RETRY_ON_EXCEPTION[e.code]){
a.retryCount=a.retryCount||0;
if(a.retryCount<ZmRequestMgr.RETRY_MAX){
a.resend=ZmCsfeCommand.RETRY;
a.retryCount++;
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){
this.sendRequest(a)
}
),ZmRequestMgr.RETRY_DELAY*1000);
t=true
}}
if(!t){
this._controller._handleException(e,a)
}};
ZmRequestMgr.prototype._handleNotifications=function(n){
if(n&&n.context&&n.context.notify){
for(var o=0;
o<n.context.notify.length;
o++){
var a=n.context.notify[o];
var t=a.seq;
var e=n.context&&ZmCsfeCommand.extractSessionId(n.context.session);
if(a.seq>this._highestNotifySeen&&!(e&&ZmCsfeCommand._staleSession[e])){
if(window.isNotifyDebugOn){
appCtxt.setNotifyDebug(["Handling NOTIFY: ["+o+"] in _handleNotifications seq=",t].join(""))
}
this._highestNotifySeen=t;
this._notifyHandler(a)
}else{
if(window.isNotifyDebugOn){
appCtxt.setNotifyDebug(["Handling NOTIFY: Skipping notification[",o,"] seq=",t," highestNotifySeen=",this._highestNotifySeen].join(""))
}}}}};
ZmRequestMgr.prototype._refreshHandler=function(e){
AjxDebug.println(AjxDebug.NOTIFY,"REFRESH block received");
if(!appCtxt.inStartup){
this._controller._execPoll()
}
if(e.version){
if(!this._canceledReload){
var o=appCtxt.get(ZmSetting.SERVER_VERSION);
if(o!=e.version){
appCtxt.set(ZmSetting.SERVER_VERSION,e.version);
if(o){
var a=appCtxt.getYesNoMsgDialog();
a.reset();
a.registerCallback(DwtDialog.YES_BUTTON,this._reloadYesCallback,this,[a,o,e.version]);
a.registerCallback(DwtDialog.NO_BUTTON,this._reloadNoCallback,this,[a,e]);
var t=AjxMessageFormat.format(ZmMsg.versionChangeRestart,[o,e.version]);
a.setMessage(t,DwtMessageDialog.WARNING_STYLE);
a.popup();
return
}}}}
if(!this._recentlyRefreshed){
this._controller.runAppFunction("refresh",false,e);
this._recentlyRefreshed=true;
this._lastSkippedRefresh=null
}else{
this._lastSkippedRefresh=e
}
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(a){
var t={};
var e=appCtxt.multiAccounts?appCtxt.accountList.mainAccount:null;
this._loadTree(ZmOrganizer.TAG,t,a.tags,null,e);
this._loadTree(ZmOrganizer.FOLDER,t,a.folder[0],"folder",e)
};
ZmRequestMgr.prototype._reloadYesCallback=function(t){
t.popdown();
window.onbeforeunload=null;
var e=AjxUtil.formatUrl();
ZmZimbraMail.sendRedirect(e)
};
ZmRequestMgr.prototype._reloadNoCallback=function(e,t){
e.popdown();
this._canceledReload=true;
this._refreshHandler(t)
};
ZmRequestMgr.prototype._loadTree=function(a,t,s,r,n){
var o=(a==ZmOrganizer.TAG);
var e=appCtxt.getTree(a,n);
if(e){
e.reset()
}else{
e=o?new ZmTagTree(n):new ZmFolderTree()
}
appCtxt.setTree(a,e,n);
e.addChangeListener(this._unreadListener);
e.getUnreadHash(t);
e.loadFromJs(s,r,n)
};
ZmRequestMgr.prototype._notifyHandler=function(e){
if(window.isNotifyDebugOn){
var t=AjxStringUtil.objToString(e);
appCtxt.setNotifyDebug("Handling NOTIFY: in ZmRequestMgr _notifyHandler");
appCtxt.setNotifyDebug(t)
}
AjxDebug.println(AjxDebug.NOTIFY,"Notification block:");
AjxDebug.dumpObj(AjxDebug.NOTIFY,e);
this._controller.runAppFunction("preNotify",false,e);
if(e.deleted&&e.deleted.id){
this._handleDeletes(e.deleted)
}
if(e.created){
this._handleCreates(e.created)
}
if(e.modified){
this._handleModifies(e.modified)
}
this._controller.runAppFunction("postNotify",false,e)
};
ZmRequestMgr.prototype._handleDeletes=function(o){
var t=o.id.split(",");
this._controller.runAppFunction("deleteNotify",false,t);
for(var e=0;
e<t.length;
e++){
var n=t[e];
if(!n){
continue
}
var a=appCtxt.cacheGet(n);
if(a&&a.notifyDelete){
a.notifyDelete();
appCtxt.cacheRemove(n);
a=null
}}};
ZmRequestMgr.prototype._handleCreates=function(h){
this._controller.runAppFunction("createNotify",false,h);
for(var e in h){
var r=h[e];
for(var a=0;
a<r.length;
a++){
var n=r[a];
if(n._handled){
continue
}
if(appCtxt.cacheGet(n.id)&&e!="tag"){
continue
}
if(window.isNotifyDebugOn){
appCtxt.setNotifyDebug(["Handling NOTIFY: in ZmRequestMgr - _handleCreates handling CREATE for node: ",e].join(""))
}
if(e=="tag"){
var s=appCtxt.multiAccounts&&ZmOrganizer.parseId(n.id).account;
var t=appCtxt.getTagTree(s);
if(t){
t.root.notifyCreate(n)
}}else{
if(e=="folder"||e=="search"||e=="link"){
var o=n.l;
var l=appCtxt.getById(o);
if(l&&l.notifyCreate&&l.type!=ZmOrganizer.TAG){
l.notifyCreate(n,e)
}}}}}};
ZmRequestMgr.prototype._handleModifies=function(a){
this._controller.runAppFunction("modifyNotify",false,a);
for(var t in a){
if(t=="mbx"){
var c=a[t];
for(var n=0;
n<c.length;
n++){
var e=c[n];
var l=e.acct;
var s=l&&appCtxt.accountList.getAccount(l);
var u=appCtxt.getSettings(s).getSetting(ZmSetting.QUOTA_USED);
u.notifyModify({
_name:t,s:e.s,account:s}
)
}
continue
}
var r=a[t];
for(var n=0;
n<r.length;
n++){
var h=r[n];
if(h._handled){
continue
}
var d=appCtxt.cacheGet(h.id);
if(!d&&t=="cn"&&AjxDispatcher.loaded("ContactsCore")){
var o=appCtxt.getApp(ZmApp.CONTACTS);
if(o.isContactListLoaded()){
d=o.getContactList().getById(h.id)
}}
if(d&&d.notifyModify){
h._isRemote=(t=="folder"&&d.link);
d.notifyModify(h)
}}}};
ZmRequestMgr.prototype._unreadChangeListener=function(s){
if(s.event==ZmEvent.E_MODIFY){
var n=s.getDetail("fields");
if(n&&n[ZmOrganizer.F_UNREAD]){
var a=s.getDetail("organizers");
var r=a?a[0]:null;
var e=r?(r.isSystem()?r.nId:r.id):null;
var l=appCtxt.getCurrentSearch();
if(l){
var o=appCtxt.multiAccounts&&appCtxt.getById(l.folderId);
var t=(o&&o.getAccount()==appCtxt.getActiveAccount())?o.nId:l.folderId;
if(e&&(e==t||e==l.tagId)){
Dwt.setTitle(l.getTitle())
}}
var h=appCtxt.getApp(ZmApp.MAIL);
if(h){
h.setNewMailNotice(r)
}}}}
}
if(AjxPackage.define("zimbraMail.core.ZmZimbraMail")){
ZmZimbraMail=function(o){
ZmController.call(this,null);
appCtxt.setAppController(this);
window._zimbraMail=this;
this._evt=new ZmAppEvent();
this._evtMgr=new AjxEventMgr();
for(var t in ZmZimbraMail._listeners){
var a=ZmZimbraMail._listeners[t];
if(a&&a.length){
for(var e=0;
e<a.length;
e++){
this._evtMgr.addListener(t,a[e])
}}}
ZmZimbraMail.addListener=AjxCallback.simpleClosure(this.addListener,this);
ZmZimbraMail.addAppListener=AjxCallback.simpleClosure(this.addAppListener,this);
ZmOperation.initialize();
this._createSettings(o);
this._createEnabledApps();
this._initializeSettings(o);
this._postInitializeSettings();
this._shell=appCtxt.getShell();
this._userShell=o.userShell;
this._requestMgr=new ZmRequestMgr(this);
this._upsellView={};
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);
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(){
this._appViewMgr._toRemove.push(ZmId.VIEW_LOADING)
}
));
for(var e in ZmApp.QS_ARG){
ZmApp.QS_ARG_R[ZmApp.QS_ARG[e]]=e
}
this._shell.addGlobalSelectionListener(new AjxListener(this,this._globalSelectionListener));
this.startup(o)
};
ZmZimbraMail.prototype=new ZmController;
ZmZimbraMail.prototype.constructor=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.prototype.toString=function(){
return"ZmZimbraMail"
};
ZmZimbraMail.run=function(a){
if(a.noSplashScreen){
ZmZimbraMail.killSplash()
}
window.appCtxt=new ZmAppCtxt();
appCtxt.rememberMe=false;
if(a.offlineMode){
appCtxt.isOffline=true
}
var t=a.userShell=window.document.getElementById(ZmId.SKIN_SHELL);
if(!t){
alert("Could not get user shell - skin file did not load properly")
}
var e=new DwtShell({
userShell:t,docBodyScrollable:false,id:ZmId.SHELL}
);
appCtxt.setShell(e);
new ZmZimbraMail(a)
};
ZmZimbraMail.unload=function(){
if(!ZmZimbraMail._endSessionDone){
ZmZimbraMail._endSession()
}
if(ZmZimbraMail._isLogOff){
ZmZimbraMail._isLogOff=false;
if(window._zimbraMail){
window._zimbraMail.setSessionTimer(false)
}
ZmCsfeCommand.noAuth=true
}
var t=window._zimbraMail?window._zimbraMail._childWinList:null;
if(t){
for(var e=0;
e<t.size();
e++){
var a=t.get(e);
a.win.onbeforeunload=null;
a.win.parentController=null;
a.win.close()
}}
ZmZimbraMail.stayOnPagePrompt=false;
ZmZimbraMail.setExitTimer(false);
ZmZimbraMail.sessionTimerInvoked=false;
window._zimbraMail=window.onload=window.onunload=window.onresize=window.document.onkeypress=null
};
ZmZimbraMail.hashSortCompare=function(s,o,e){
var n=o?Number(s[o]):0;
var t=e?Number(s[e]):0;
if(n>t){
return 1
}
if(n<t){
return -1
}
return 0
};
ZmZimbraMail.killSplash=function(){
Dwt.hide("skin_container_splash_screen")
};
ZmZimbraMail.prototype.startup=function(o){
if(appCtxt.isOffline){
this.sendClientEventNotify(ZmZimbraMail.UI_LOAD_BEGIN)
}
appCtxt.inStartup=true;
if(typeof(skin)=="undefined"){}
skin.show("skin",true);
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_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);
this._components[ZmAppViewMgr.C_STATUS]=this.statusView=new ZmStatusView(this._shell,"ZmStatus",Dwt.ABSOLUTE_STYLE,ZmId.STATUS_VIEW);
if(appCtxt.isOffline){
this._initOfflineUserInfo()
}}
this._registerOrganizers();
for(var e in ZmSearch.TYPE){
ZmSearch.TYPE_MAP[ZmSearch.TYPE[e]]=e
}
ZmZimbraMail.registerViewsToTypeMap();
this._getStartApp(o);
this._postRenderCallbacks=[];
this._postRenderLast=0;
if(o.startApp==ZmApp.MAIL){
this._doingPostRenderStartup=true;
var s=new AjxCallback(this,function(){
AjxDispatcher.require("Startup2");
var r=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,r)){
this.handleCalendarComponents()
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED,null,r)){
this.handleTaskComponents()
}
var h=appCtxt.getSearchController();
h.getSearchToolbar().initAutocomplete();
if(!appCtxt.isChildWindow){
h.peopleSearchToolBar.initAutocomplete()
}}
);
this.addPostRenderCallback(s,0,0,true)
}
var a=AjxUtil.get(o,"getInfoResponse");
if(a){
this._requestMgr.sendRequest({
response:a}
)
}
var n=new AjxCallback(this,this._handleResponseGetMetaData,o);
appCtxt.accountList.mainAccount.loadMetaData(n);
if(appCtxt.isOffline){
var t=appCtxt.get(ZmSetting.OFFLINE_UPDATE_NOTIFY);
this._offlineUpdateChannelPref(t)
}};
ZmZimbraMail.registerViewsToTypeMap=function(){
for(var t in ZmOrganizer.VIEWS){
var a=ZmOrganizer.VIEWS[t];
for(var e=0;
e<a.length;
e++){
ZmOrganizer.TYPE[a[e]]=t
}}};
ZmZimbraMail.prototype._createSettings=function(n){
if(n.batchInfoResponse){
var t=n.batchInfoResponse.Body.BatchResponse;
var a=t.GetInfoResponse[0];
if(!a){
a={}
}
a.domainSettings=n.settings;
n.getInfoResponse={
Header:n.batchInfoResponse.Header,Body:{
GetInfoResponse:a}};
var o=AjxUtil.get(n.getInfoResponse,"Header","context","session");
if(o){
ZmCsfeCommand.setSessionId(o)
}
if(t.SearchResponse){
n.searchResponse={
Body:{
SearchResponse:t.SearchResponse[0]}}
}}
var e=new ZmSettings();
appCtxt.setSettings(e);
e.setUserSettings({
info:n.getInfoResponse.Body.GetInfoResponse,preInit:true}
)
};
ZmZimbraMail.prototype._initializeSettings=function(h){
var o=h.getInfoResponse.Body.GetInfoResponse;
var r=appCtxt.getSettings();
r.setUserSettings(o,null,true,true,true);
r.userSettingsLoaded=true;
var c=appCtxt.get(ZmSetting.BRANCH);
if(window.DBG&&!DBG.isDisabled()){}
if(h.offlineMode){
var e=AjxCookie.getCookie(document,ZmSetting.APPS_COOKIE);
if(e){
for(var s in ZmSetting.APP_LETTER){
var n=ZmSetting.APP_LETTER[s];
if(e.indexOf(n)!=-1){
r.getSetting(s).setValue(true)
}}}}
if(h.settings){
for(var t in h.settings){
var a=r.getSettingByName(t);
if(a){
r.getSetting(a).setValue(h.settings[t])
}}}
if(appCtxt.isOffline){
appCtxt.set(ZmSetting.POLLING_INTERVAL,60,null,null,true)
}
if(h.devMode=="1"){
appCtxt.set(ZmSetting.DEV,true);
appCtxt.set(ZmSetting.POLLING_INTERVAL,0)
}
if(h.protocolMode){
var l=(h.protocolMode.indexOf(":")==-1)?h.protocolMode+":":h.protocolMode;
appCtxt.set(ZmSetting.PROTOCOL_MODE,l)
}
if(h.httpPort){
appCtxt.set(ZmSetting.HTTP_PORT,h.httpPort)
}
if(h.httpsPort){
appCtxt.set(ZmSetting.HTTPS_PORT,h.httpsPort)
}
if(!appCtxt.get(ZmSetting.SPAM_ENABLED)){
ZmFolder.HIDE_ID[ZmFolder.ID_SPAM]=true
}};
ZmZimbraMail.prototype._postInitializeSettings=function(){
this._setCustomInvalidEmailPats()
};
ZmZimbraMail.prototype._setCustomInvalidEmailPats=function(){
var o=appCtxt.getSettings().getSetting(ZmSetting.EMAIL_VALIDATION_REGEX);
var e=[];
if(o){
e=o.value
}
for(var a=0;
a<e.length;
a++){
var t=e[a];
if(t&&t!=""){
AjxEmailAddress.customInvalidEmailPats.push(new RegExp(t))
}}};
ZmZimbraMail.prototype._handleResponseGetMetaData=function(e){
this._handleResponseLoadUserSettings(e)
};
ZmZimbraMail.prototype.showMiniCalendar=function(){
var e=appCtxt.getCalManager();
e.getMiniCalendar();
appCtxt.getAppViewMgr().showTreeFooter(true);
e.highlightMiniCal();
e.startDayRollTimer()
};
ZmZimbraMail.prototype.showReminder=function(){
var t=appCtxt.getCalManager();
var e=t.getReminderController();
e.refresh()
};
ZmZimbraMail.prototype.showTaskReminder=function(){
var t=appCtxt.getTaskManager();
var e=t.getReminderController();
e.refresh()
};
ZmZimbraMail.prototype._handleErrorStartup=function(t,e){
ZmZimbraMail.killSplash();
appCtxt.inStartup=false;
return false
};
ZmZimbraMail.prototype._handleResponseLoadUserSettings=function(t,e){
if(appCtxt.multiAccounts){
var a=new AjxCallback(this,this._handleResponseStartup,[t,e]);
appCtxt.accountList.loadAccounts(a)
}else{
this._handleResponseStartup(t,e)
}};
ZmZimbraMail.prototype._handleResponseStartup=function(o,e){
if(o&&o.settingOverrides){
this._needOverviewLayout=true;
for(var r in o.settingOverrides){
var t=appCtxt.getSetting(r);
if(t){
t.setValue(o.settingOverrides[r])
}}}
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._evtMgr.notifyListeners(ZmAppEvent.PRE_STARTUP,this._evt);
o.result=e;
var s=new AjxCallback(this,this._handleResponseStartup1,o);
if(this._doingPostRenderStartup){
this.addAppListener(o.startApp,ZmAppEvent.POST_RENDER,new AjxListener(this,this._postRenderStartup));
this._searchResponse=o.searchResponse
}else{
AjxDispatcher.require("Startup2")
}
var n=new AjxCallback(this,function(){
this.runAppFunction("startup",false,o.result)
}
);
this.addPostRenderCallback(n,2,100,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._evtMgr.notifyListeners(ZmAppEvent.POST_STARTUP,this._evt);
if(appCtxt.isOffline){
appCtxt.getSearchController().resetSearchToolbar()
}
var h=appCtxt.multiAccounts?"GetContactsForAllAccounts":"GetContacts";
AjxDispatcher.run(h);
if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&appCtxt.isOffline){
this.handleOfflineMailTo(location.search)
}}
);
this.addPostRenderCallback(n,5,100);
this.activateApp(o.startApp,false,s,this._errorCallback,o);
var a=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,a)&&!this._doingPostRenderStartup&&(o.startApp!=ZmApp.CALENDAR)){
this.handleCalendarComponents()
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED,null,a)&&!this._doingPostRenderStartup&&(o.startApp!=ZmApp.TASKS)){
this.handleTaskComponents()
}};
ZmZimbraMail.prototype.handleTaskComponents=function(){
var t=new AjxTimedAction(this,this.showTaskReminder);
var e=appCtxt.isOffline?0:ZmTasksApp.REMINDER_START_DELAY;
AjxTimedAction.scheduleAction(t,e)
};
ZmZimbraMail.prototype.handleCalendarComponents=function(){
if(appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){
var a=new AjxTimedAction(this,this.showMiniCalendar);
var e=appCtxt.isOffline?0:ZmCalendarApp.MINICAL_DELAY;
AjxTimedAction.scheduleAction(a,e)
}
var t=new AjxTimedAction(this,this.showReminder);
var e=appCtxt.isOffline?0:ZmCalendarApp.REMINDER_START_DELAY;
AjxTimedAction.scheduleAction(t,e)
};
ZmZimbraMail.prototype._handleResponseStartup1=function(t){
this._setExternalLinks();
this.setUserInfo();
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
this._components[ZmAppViewMgr.C_SEARCH]=appCtxt.getSearchController().searchPanel
}
if(appCtxt.get(ZmSetting.PEOPLE_SEARCH_ENABLED)&&(appCtxt.get(ZmSetting.CONTACTS_ENABLED)||appCtxt.get(ZmSetting.GAL_ENABLED)||appCtxt.isOffline)){
this._components[ZmAppViewMgr.C_PEOPLE_SEARCH]=appCtxt.getSearchController().peopleSearchToolBar
}else{
Dwt.hide(ZmId.SKIN_PEOPLE_SEARCH)
}
this.getKeyMapMgr();
this.setSessionTimer(true);
ZmZimbraMail.killSplash();
this.runAppFunction("addComponents",false,this._components);
var e=this._appViewMgr._components;
this._appViewMgr.addComponents(this._components,true);
if(e){
this._appViewMgr.addComponents(e,true)
}
this._checkLicense();
if(!this._doingPostRenderStartup){
this._postRenderStartup()
}};
ZmZimbraMail.prototype._checkLicense=function(t){
var e=appCtxt.get(ZmSetting.LICENSE_STATUS);
var o=ZmSetting.LICENSE_MSG[e];
if(o){
AjxDispatcher.require("Startup2");
var a=appCtxt.getMsgDialog();
a.reset();
a.setMessage(o,DwtMessageDialog.WARNING_STYLE);
a.popup()
}};
ZmZimbraMail.prototype._postRenderStartup=function(e){
this._postRenderCallbacks.sort(function(o,t){
return o.order-t.order
}
);
this._runNextPostRenderCallback()
};
ZmZimbraMail.prototype._runNextPostRenderCallback=function(){
if(this._postRenderCallbacks&&this._postRenderCallbacks.length){
var e=this._postRenderCallbacks.shift();
if(!e){
return
}
AjxTimedAction.scheduleAction(new AjxTimedAction(this,function(){
e.callback.run();
this._runNextPostRenderCallback()
}
),e.delay)
}else{
if(appCtxt.isOffline){
this.sendClientEventNotify(ZmZimbraMail.UI_LOAD_END);
if(AjxEnv.isPrism){
this._firstTimeNetworkChange=true;
var t=new ZimbraNetworkChecker();
t.addEventListener("offline",function(a){
window.appCtxt.getAppController().handleNetworkChange(false)
}
,false);
t.addEventListener("online",function(a){
window.appCtxt.getAppController().handleNetworkChange(true)
}
,false)
}}}};
ZmZimbraMail.prototype.handleNetworkChange=function(e){
this._isPrismOnline=e;
if(this._isUserOnline||this._firstTimeNetworkChange){
this._updateNetworkStatus(e)
}};
ZmZimbraMail.prototype._updateNetworkStatus=function(e){
if((e&&this._currentNetworkStatus==ZmZimbraMail.UI_NETWORK_UP)||(!e&&this._currentNetworkStatus==ZmZimbraMail.UI_NETWORK_DOWN)){
return
}
if(e){
if(!this._firstTimeNetworkChange){
this.setStatusMsg(ZmMsg.networkChangeOnline)
}else{
this._firstTimeNetworkChange=false;
this._isUserOnline=e
}
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(e?ZmMsg.networkStatusOffline:ZmMsg.networkStatusOnline);
this._networkStatusIcon.getHtmlElement().innerHTML=AjxImg.getImageHtml(e?"Connect":"Disconnect");
var t=e?ZmMsg.imStatusOnline:ZmMsg.imStatusOffline;
this._networkStatusText.getHtmlElement().innerHTML=t.substr(0,1).toUpperCase()+t.substr(1)
};
ZmZimbraMail.prototype.addPostRenderCallback=function(o,e,t,a){
if(!this._doingPostRenderStartup&&a){
o.run()
}else{
e=e||this._postRenderLast++;
this._postRenderCallbacks.push({
callback:o,order:e,delay:t||0}
)
}};
ZmZimbraMail.prototype._getStartApp=function(a){
var e;
var r=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(a&&a.app){
e=ZmApp.QS_ARG_R[a.app.toLowerCase()];
var l=ZmApp.SETTING[e];
var o=ZmApp.UPSELL_SETTING[e];
if(l&&!appCtxt.get(l,null,r)&&(!o||!appCtxt.get(o))){
e=null
}}
if(!e){
for(var t in ZmApp.DEFAULT_SORT){
ZmApp.DEFAULT_APPS.push(t)
}
ZmApp.DEFAULT_APPS.sort(function(d,c){
return ZmZimbraMail.hashSortCompare(ZmApp.DEFAULT_SORT,d,c)
}
);
var n=null;
for(var s=0;
s<ZmApp.DEFAULT_APPS.length;
s++){
var t=ZmApp.DEFAULT_APPS[s];
var l=ZmApp.SETTING[t];
if(!l||appCtxt.get(l,null,r)){
n=t;
break
}}
e=this._getDefaultStartAppName(r)
}
var h=AjxStringUtil.parseQueryString();
if(h&&h.view&&!h.app){
e=ZmApp.QS_VIEWS[h.view]
}
a.startApp=e;
a.qsParams=h
};
ZmZimbraMail.prototype._getDefaultStartAppName=function(o){
o=o||(appCtxt.multiAccounts&&appCtxt.accountList.mainAccount)||null;
for(var n in ZmApp.DEFAULT_SORT){
ZmApp.DEFAULT_APPS.push(n)
}
ZmApp.DEFAULT_APPS.sort(function(r,s){
return ZmZimbraMail.hashSortCompare(ZmApp.DEFAULT_SORT,r,s)
}
);
var e=null;
for(var t=0;
t<ZmApp.DEFAULT_APPS.length;
t++){
var n=ZmApp.DEFAULT_APPS[t];
var a=ZmApp.SETTING[n];
if(!a||appCtxt.get(a,null,o)){
return n
}}};
ZmZimbraMail.prototype.restart=function(e){
this.reset();
this.startup({
settingOverrides:e}
)
};
ZmZimbraMail.prototype.reset=function(){
ZmCsfeCommand.clearSessionId();
appCtxt.accountList.resetTrees();
if(!appCtxt.rememberMe()){
appCtxt.getLoginDialog().clearAll()
}
for(var e in this._apps){
this._apps[e]=null
}
this._activeApp=null;
this._appViewMgr.reset()
};
ZmZimbraMail.prototype.cancelRequest=function(a,e,t){
this._requestMgr.cancelRequest(a,e,t)
};
ZmZimbraMail.prototype.sendRequest=function(e){
return this._requestMgr.sendRequest(e)
};
ZmZimbraMail.prototype.runAppFunction=function(h,e){
var s=[];
for(var o=2;
o<arguments.length;
o++){
s.push(arguments[o])
}
for(var o=0;
o<ZmApp.APPS.length;
o++){
var r=ZmApp.APPS[o];
var l=ZmApp.SETTING[r];
var n=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(!l||appCtxt.get(l,null,n)||e){
var a=appCtxt.getApp(r,null,n);
var t=a&&a[h];
if(t&&(typeof(t)=="function")){
t.apply(a,s)
}}}};
ZmZimbraMail.prototype._createEnabledApps=function(n){
this._apps={};
for(var s in ZmApp.CLASS){
if(!n||n[s]){
ZmApp.APPS.push(s)
}}
ZmApp.APPS.sort(function(h,r){
return ZmZimbraMail.hashSortCompare(ZmApp.LOAD_SORT,h,r)
}
);
for(var t=0;
t<ZmApp.APPS.length;
t++){
var s=ZmApp.APPS[t];
var o=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var e=ZmApp.SETTING[s]&&appCtxt.get(ZmApp.SETTING[s],null,o);
var a=ZmApp.UPSELL_SETTING[s]&&appCtxt.get(ZmApp.UPSELL_SETTING[s]);
if(e||a){
ZmApp.ENABLED_APPS[s]=true;
this._createApp(s);
this._apps[s].isUpsell=(!e&&a)
}}};
ZmZimbraMail.addListener=function(e,t){
if(!ZmZimbraMail._listeners[e]){
ZmZimbraMail._listeners[e]=[]
}
ZmZimbraMail._listeners[e].push(t)
};
ZmZimbraMail.addAppListener=function(e,t,a){
t=[e,t].join("_");
ZmZimbraMail.addListener(t,a)
};
ZmZimbraMail.prototype.addListener=function(e,t){
return this._evtMgr.addListener(e,t)
};
ZmZimbraMail.prototype.removeListener=function(e,t){
return this._evtMgr.removeListener(e,t)
};
ZmZimbraMail.prototype.addAppListener=function(a,e,t){
e=[a,e].join("_");
return this.addListener(e,t)
};
ZmZimbraMail.prototype.removeAppListener=function(a,e,t){
e=[a,e].join("_");
return this.removeListener(e,t)
};
ZmZimbraMail.prototype.sendNoOp=function(){
var t=AjxSoapDoc.create("NoOpRequest","urn:zimbraMail");
var e=appCtxt.isOffline&&appCtxt.accountList.mainAccount.name;
this.sendRequest({
soapDoc:t,asyncMode:true,noBusyOverlay:true,accountName:e}
)
};
ZmZimbraMail.prototype.sendClientEventNotify=function(t,e){
var a={
jsonObj:{
ClientEventNotifyRequest:{
_jsns:"urn:zimbraOffline",e:t}}
,asyncMode:true};
if(e){
a.callback=new AjxCallback(this,this.handleClientEventNotifyResponse,t);
a.noBusyOverlay=true;
if(this.clientEventNotifyReqId){
appCtxt.getRequestMgr().cancelRequest(this.clientEventNotifyReqId)
}
this.clientEventNotifyTimerId=AjxTimedAction.scheduleAction(new AjxTimedAction(this,this.sendClientEventNotify,[t,true]),3000)
}else{
a.callback=new AjxCallback(this,this.setInstantNotify,true)
}
this.clientEventNotifyReqId=this.sendRequest(a)
};
ZmZimbraMail.prototype.handleClientEventNotifyResponse=function(t,e){
if(!e.isException()&&e.getResponse()){
if(this.clientEventNotifyTimerId){
AjxTimedAction.cancelAction(this.clientEventNotifyTimerId);
this.clientEventNotityTimerId=null
}
this.setInstantNotify(true)
}};
ZmZimbraMail.prototype.setInstantNotify=function(e){
if(e){
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(s,o){
if(appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&window.platform){
try{
if(o){
if(s){
var e=appCtxt.get(ZmSetting.OFFLINE_WEBAPP_URI,null,appCtxt.accountList.mainAccount);
window.platform.registerProtocolHandler("mailto",e+"&mailto=%s");
if(AjxEnv.isWindows){
var a=new ZimbraDesktopShell;
a.defaultClient=true
}}
var n=AjxCallback.simpleClosure(this.handleOfflineMailTo,this);
window.platform.registerProtocolCallback("mailto",n)
}else{
window.platform.unregisterProtocolHandler("mailto");
if(AjxEnv.isWindows){
var a=new ZimbraDesktopShell;
a.defaultClient=false
}}}
catch(t){}}};
ZmZimbraMail.prototype.handleOfflineMailTo=function(a,s){
if(window.platform&&!window.platform.isRegisteredProtocolHandler("mailto")){
return false
}
var n=this.getApp(ZmApp.MAIL);
var e=(a.indexOf("mailto"));
if(e>=0){
var o="to="+decodeURIComponent(a.substring(e+7));
o=o.replace(/?/g,"&");
var t=n._showComposeView(s,o);
this._checkOfflineMailToAttachments(t,o);
return true
}
return false
};
ZmZimbraMail.prototype._checkOfflineMailToAttachments=function(o,r){
var a=r||location.search;
var n=a.match(/to=([^&]+)/);
var h=n?AjxStringUtil.urlComponentDecode(n[1]):null;
n=a.match(/attachments=([^&]+)/);
var t=n?(AjxStringUtil.urlComponentDecode(n[1]).replace(/+/g," ")):null;
if(h&&h.indexOf("mailto")==0){
h=h.replace(/mailto:/,"");
var e=h.split("?");
if(e.length>1){
e=e[1];
n=e.match(/attachments=([^&]+)/);
if(!t){
t=n?(AjxStringUtil.urlComponentDecode(n[1]).replace(/+/g," ")):null
}}}
if(t){
t=t.replace(/;$/,"");
t=t.split(";");
this._mailtoAttachmentsLength=t.length;
this._attachmentsProcessed=0;
this.attachment_ids=[];
for(var s=0;
s<t.length;
s++){
this._handleMailToAttachment(t[s],o)
}}};
ZmZimbraMail.prototype._handleMailToAttachment=function(h,l){
var s=h;
var t=s.replace(/^.*\/,"");
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
}
catch(c){
return
}
try{
var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
n.initWithPath(s);
var m=this._getAttachmentContentType(n);
var a=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
a.init(n,-1,-1,false);
var r=Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
r.setInputStream(a);
var u=new XMLHttpRequest();
u.open("POST",appCtxt.get(ZmSetting.CSFE_UPLOAD_URI)+"&fmt=extended,raw",true);
u.setRequestHeader("Cache-Control","no-cache");
u.setRequestHeader("X-Requested-With","XMLHttpRequest");
u.setRequestHeader("Content-Type",(m||"application/octet-stream"));
u.setRequestHeader("Content-Disposition",'attachment; filename="'+t+'"');
var o=u;
u.onreadystatechange=AjxCallback.simpleClosure(this._handleUploadResponse,this,o,l);
u.sendAsBinary(r.readBytes(r.available()));
delete u
}
catch(d){
this._attachmentsProcessed++
}};
ZmZimbraMail.prototype._getAttachmentContentType=function(t){
var a;
try{
a=Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService).getTypeFromFile(t)
}
catch(e){
a="application/octet-stream"
}
return a
};
ZmZimbraMail.prototype._handleUploadErrorResponse=function(t){
var e=appCtxt.getMsgDialog();
var a=DwtMessageDialog.CRITICAL_STYLE;
if(t=="200"){
return true
}else{
if(t=="413"){
e.setMessage(ZmMsg.errorAttachmentTooBig,a)
}else{
var o=AjxMessageFormat.format(ZmMsg.errorAttachment,(t||AjxPost.SC_NO_CONTENT));
e.setMessage(o,a)
}}
e.popup()
};
ZmZimbraMail.prototype._handleUploadResponse=function(req,controller){
if(req){
if(req.readyState==4&&req.status==200){
var resp=eval("["+req.responseText+"]");
this._attachmentsProcessed++;
this._handleUploadErrorResponse(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.viewId)
}}}}};
ZmZimbraMail.prototype.setPollInterval=function(e){
if(!this._pollInstantNotifications){
this._pollInterval=appCtxt.get(ZmSetting.POLLING_INTERVAL)*1000;
if(this._pollInterval){
if(e){
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(a){
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(a&&this._pollInstantNotifications){
var e=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL);
if(this._pollInterval>e){
this._pollInterval=e
}}
if(this._pollInterval&&!this._pollRequest){
try{
this._pollActionId=AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._execPoll),this._pollInterval)
}
catch(t){
this._pollActionId=null
}}};
ZmZimbraMail.prototype._execPoll=function(){
this._cancelInstantNotify();
var t=AjxSoapDoc.create("NoOpRequest","urn:zimbraMail");
try{
if(this._pollInstantNotifications){
var n=t.getMethod();
n.setAttribute("wait",1);
n.setAttribute("limitToOneBlocked",1);
if(window.isNotifyDebugOn){
var o=appCtxt.getNotifyDebug();
t.set("DEBUG",o);
appCtxt.clearNotifyDebug()
}}
var a={
soapDoc:t,asyncMode:true,callback:new AjxCallback(this,this._handleResponseDoPoll),errorCallback:new AjxCallback(this,this._handleErrorDoPoll),noBusyOverlay:true,timeout:appCtxt.get(ZmSetting.INSTANT_NOTIFY_TIMEOUT),accountName:appCtxt.isOffline&&appCtxt.accountList.mainAccount.name};
this._pollRequest=this.sendRequest(a);
if(appCtxt.isOffline&&!appCtxt.accountList.isInitialSyncing()&&appCtxt.accountList.isSyncStatus(ZmZimbraAccount.STATUS_RUNNING)){
this.sendNoOp()
}}
catch(e){
this._handleErrorDoPoll(e)
}};
ZmZimbraMail.prototype._handleErrorDoPoll=function(t){
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 e=(t.code==ZmCsfeException.SVC_AUTH_EXPIRED||t.code==ZmCsfeException.SVC_AUTH_REQUIRED||t.code==ZmCsfeException.NO_AUTH_TOKEN);
if(!e){
this._kickPolling(false)
}
return !e
};
ZmZimbraMail.prototype._handleResponseDoPoll=function(e){
this._pollRequest=null;
var t=e.getResponse().NoOpResponse;
if(t.waitDisallowed){
this._waitDisallowed=true;
this.setInstantNotify(false)
}else{
this._kickPolling(true)
}};
ZmZimbraMail.prototype.getKeyMapMgr=function(){
var e=appCtxt.getKeyboardMgr();
if(!e.__keyMapMgr){
this._initKeyboardHandling()
}
return e.__keyMapMgr
};
ZmZimbraMail.prototype._initKeyboardHandling=function(){
var e=appCtxt.getKeyboardMgr();
if(e.__keyMapMgr){
return
}
if(appCtxt.get(ZmSetting.USE_KEYBOARD_SHORTCUTS)){
e.enable(true);
e.registerKeyMap(new ZmKeyMap());
e.pushDefaultHandler(this)
}else{
e.enable(false)
}};
ZmZimbraMail.prototype._setupTabGroups=function(){
var t=appCtxt.getRootTabGroup();
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
t.addMember(appCtxt.getSearchController().getTabGroup())
}
this._components[ZmAppViewMgr.C_APP_CHOOSER].noFocus=true;
var e=appCtxt.getCurrentApp();
var o=e&&e.getOverviewId();
var a=o&&appCtxt.getOverviewController().getOverview(o);
if(a){
t.addMember(a);
ZmController._currentOverview=a
}
appCtxt.getKeyboardMgr().setTabGroup(t)
};
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:"folders",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,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",treeType:ZmOrganizer.FOLDER,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}
);
this._name=ZmApp.MAIN;
ZmApp.prototype._setupDropTargets.call(this)
};
ZmZimbraMail.prototype.getApp=function(e){
if(!ZmApp.ENABLED_APPS[e]){
return null
}
if(!this._apps[e]){
this._createApp(e)
}
return this._apps[e]
};
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(s,t,l,o,a){
var n=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var r=this._appViewMgr.getAppView(s);
if(r&&!t){
if(this._appViewMgr.pushView(r)){
this._appViewMgr.setAppView(s,r);
if(!appCtxt.get(ZmApp.SETTING[s],null,n)&&appCtxt.get(ZmApp.UPSELL_SETTING[s])){
var h=[ZmMsg.zimbraTitle,s].join(": ");
Dwt.setTitle(h)
}}
if(l){
l.run()
}}else{
if(!this._apps[s]){
this._createApp(s)
}
if(!appCtxt.get(ZmApp.SETTING[s],null,n)&&appCtxt.get(ZmApp.UPSELL_SETTING[s])){
this._createUpsellView(s);
if(l){
l.run()
}}else{
var c=new AjxCallback(this,this._handleResponseActivateApp,[l,s]);
var e=[s,ZmAppEvent.PRE_LAUNCH].join("_");
this._evt.item=this._apps[s];
this._evtMgr.notifyListeners(e,this._evt);
a=a||{};
a.searchResponse=this._searchResponse;
this._apps[s].launch(a,c);
delete this.searchResponse
}}};
ZmZimbraMail.prototype._handleResponseActivateApp=function(a,e){
if(a){
a.run()
}
if(ZmApp.DEFAULT_SEARCH[e]){
appCtxt.getSearchController().setDefaultSearchType(ZmApp.DEFAULT_SEARCH[e])
}
var t=[e,ZmAppEvent.POST_LAUNCH].join("_");
this._evt.item=this._apps[e];
this._evtMgr.notifyListeners(t,this._evt)
};
ZmZimbraMail.prototype.setActiveApp=function(n,r,h){
if(!h){
this._components[ZmAppViewMgr.C_APP_CHOOSER].setSelected(n)
}
var o=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var t=!ZmApp.SETTING[n]||appCtxt.get(ZmApp.SETTING[n],null,o);
this._activeTabId=null;
if(this._activeApp!=n){
if(this._activeApp){
var e=this._apps[this._activeApp];
if(e){
e.activate(false,r)
}
this._previousApp=this._activeApp
}
this._activeApp=n;
if(t){
var e=this._apps[this._activeApp];
if(appCtxt.get(ZmSetting.SEARCH_ENABLED)){
var s=e?e.getInitialSearchType():null;
if(!s){
s=ZmApp.DEFAULT_SEARCH[n]
}
if(s){
appCtxt.getSearchController().setDefaultSearchType(s)
}
var a=appCtxt.getSearchController().getSearchToolbar();
if(appCtxt.get(ZmSetting.SHOW_SEARCH_STRING)&&a){
var l=e.currentSearch?e.currentSearch.query:e.currentQuery;
a.setSearchFieldValue(l||"")
}}
if(e){
if(appCtxt.inStartup&&this._doingPostRenderStartup){
var c=new AjxCallback(this,function(){
e.activate(true)
}
);
this.addPostRenderCallback(c,1,100,true)
}else{
e.activate(true)
}}}
this._evt.item=this._apps[n];
this._evtMgr.notifyListeners(ZmAppEvent.ACTIVATE,this._evt)
}else{
if(this._activeApp&&this._apps[this._activeApp]){
this._apps[this._activeApp].stopAlert()
}}};
ZmZimbraMail.prototype.getAppChooserButton=function(e){
return this._components[ZmAppViewMgr.C_APP_CHOOSER].getButton(e)
};
ZmZimbraMail.prototype.appRendered=function(e){
var t=[e,ZmAppEvent.POST_RENDER].join("_");
this._evtMgr.notifyListeners(t,this._evt);
if(window._facadeCleanup){
window._facadeCleanup();
window._facadeCleanup=null
}};
ZmZimbraMail.prototype.addApp=function(t){
var e=t.getName();
this._apps[e]=t;
ZmApp.ENABLED_APPS[e]=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 e=document.getElementById("skin_container_links");
if(e){
var a;
if(!appCtxt.isOffline&&(appCtxt.get(ZmSetting.IS_ADMIN)||appCtxt.get(ZmSetting.IS_DELEGATED_ADMIN))){
a=appCtxt.get(ZmSetting.ADMIN_REFERENCE);
if(!a){
a=["https://",location.hostname,":7071"].join("")
}}
var t={
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:a};
e.innerHTML=AjxTemplate.expand("share.App#UserInfo",t)
}
e=document.getElementById("skin_container_help_button");
if(e){
this._helpButton=this.getHelpButton(DwtShell.getShell(window));
this._helpButton.reparentHtmlElement("skin_container_help_button")
}};
ZmZimbraMail.ONLINE_HELP_URL="http://help.zimbra.com/?";
ZmZimbraMail.NEW_FEATURES_URL="http://www.zimbra.com/docs/whats-new/?";
ZmZimbraMail.prototype.getHelpButton=function(o){
var a=new DwtLinkButton({
parent:o,className:DwtButton.LINK_BUTTON_CLASS}
);
a.dontStealFocus();
a.setSize(Dwt.DEFAULT);
a.setAlign(DwtLabel.ALIGN_LEFT);
a.setText(ZmMsg.help);
var n=new ZmPopupMenu(a);
var t=new AjxListener(this,this._helpListener);
a.addSelectionListener(t);
var e=n.createMenuItem("documentation",{
text:ZmMsg.productHelp}
);
e.addSelectionListener(t);
var e=n.createMenuItem("onlinehelp",{
text:ZmMsg.onlineHelp}
);
e.addSelectionListener(new AjxListener(this,this._onlineHelpListener));
e=n.createMenuItem("newFeatures",{
text:ZmMsg.newFeatures}
);
e.addSelectionListener(new AjxListener(this,this._newFeaturesListener));
n.createSeparator();
e=n.createMenuItem("about",{
text:ZmMsg.about}
);
e.addSelectionListener(new AjxListener(this,this._aboutListener));
a.setMenu(n);
return a
};
ZmZimbraMail.prototype._helpListener=function(e){
ZmZimbraMail.helpLinkCallback()
};
ZmZimbraMail.prototype._getVersion=function(){
return appCtxt.get(ZmSetting.CLIENT_VERSION)
};
ZmZimbraMail.prototype._getQueryParams=function(){
var t=appCtxt.getCurrentAppName().toLowerCase();
var e=appCtxt.isOffline?"zd":"zcs";
return["utm_source=",t,"&utm_medium=",e,"&utm_content=",this._getVersion(),"&utm_campaign=help"].join("")
};
ZmZimbraMail.prototype._onlineHelpListener=function(t){
ZmZimbraMail.unloadHackCallback();
var e=[ZmZimbraMail.ONLINE_HELP_URL,this._getQueryParams()].join("");
window.open(e)
};
ZmZimbraMail.prototype._newFeaturesListener=function(t){
ZmZimbraMail.unloadHackCallback();
var e=[ZmZimbraMail.NEW_FEATURES_URL,this._getQueryParams()].join("");
window.open(e)
};
ZmZimbraMail.prototype._aboutListener=function(n){
var a=appCtxt.getMsgDialog();
a.reset();
var t=this._getVersion();
var e=appCtxt.get(ZmSetting.CLIENT_RELEASE);
var o=appCtxt.isOffline?ZmMsg.aboutMessageZD:ZmMsg.aboutMessage;
a.setMessage(AjxMessageFormat.format(o,[t,e]),DwtMessageDialog.INFO_STYLE,ZmMsg.about);
a.popup()
};
ZmZimbraMail.prototype._initOfflineUserInfo=function(){
var e=this._userNameField.getHTMLElId();
this._userNameField.getHtmlElement().innerHTML=AjxTemplate.expand("share.App#NetworkStatus",{
id:e}
);
this._userNameField.addClassName("BannerTextUserOffline");
var o={
parent:this._userNameField,parentElement:(e+"_networkStatusIcon")};
this._networkStatusIcon=new DwtComposite(o);
var t={
parent:this._userNameField,parentElement:(e+"_networkStatusText")};
this._networkStatusText=new DwtComposite(t);
var a=document.getElementById("skin_container_tree_top");
if(a){
Dwt.setSize(a,Dwt.DEFAULT,"20")
}};
ZmZimbraMail.prototype._offlineUpdateChannelPref=function(a){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var e=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
if(e){
e.setCharPref("app.update.channel",a)
}}
catch(t){}};
ZmZimbraMail.prototype.setUserInfo=function(){
if(appCtxt.isOffline){
return
}
var e=appCtxt.getLoggedInUsername();
var t=(appCtxt.get(ZmSetting.DISPLAY_NAME))||e;
if(t){
this._userNameField.getHtmlElement().innerHTML=AjxStringUtil.htmlEncode(AjxStringUtil.clipByLength(t,24));
if(AjxEnv.isLinux){
this._userNameField.getHtmlElement().style.lineHeight="13px"
}}
this.setQuotaInfo(e,t)
};
ZmZimbraMail.prototype.setQuotaInfo=function(e,r){
var a=appCtxt.get(ZmSetting.QUOTA);
var s=(appCtxt.get(ZmSetting.QUOTA_USED))||0;
var n={
id:this._usedQuotaField._htmlElId,login:e,username:r,quota:a,usedQuota:s,size:(AjxUtil.formatSize(s,false,1))};
var o;
if(n.quota){
o="UsedLimited";
n.limit=AjxUtil.formatSize(n.quota,false,1);
n.percent=Math.min(Math.round((n.usedQuota/n.quota)*100),100);
n.desc=AjxMessageFormat.format(ZmMsg.quotaDescLimited,[n.percent+"%",n.limit])
}else{
n.desc=AjxMessageFormat.format(ZmMsg.quotaDescUnlimited,[n.size]);
o="UsedUnlimited"
}
this._usedQuotaField.getHtmlElement().innerHTML=AjxTemplate.expand("share.Quota#"+o,n);
var t=AjxTemplate.expand("share.Quota#Tooltip",n);
this._components[ZmAppViewMgr.C_USER_INFO].setToolTipContent(t);
this._components[ZmAppViewMgr.C_QUOTA_INFO].setToolTipContent(t)
};
ZmZimbraMail.setExitTimer=function(t){
if(t&&ZmZimbraMail.stayOnPagePrompt){
if(ZmZimbraMail._exitTimerId==-1){
ZmZimbraMail._exitTimerId=AjxTimedAction.scheduleAction(ZmZimbraMail._exitTimer,ZmZimbraMail.STAYONPAGE_INTERVAL*60*1000);
if(AjxEnv.isFirefox){
var a=AjxMessageFormat.format(ZmMsg.appExitPrompt,[ZmZimbraMail.STAYONPAGE_INTERVAL]);
var e=appCtxt.getMsgDialog();
e.setMessage(a,DwtMessageDialog.CRITICAL_STYLE);
setTimeout(function(){
e.popup()
}
,1000*2)
}}}else{
if(!t&&ZmZimbraMail._exitTimerId){
AjxTimedAction.cancelAction(ZmZimbraMail._exitTimerId);
ZmZimbraMail._exitTimerId=-1
}}};
ZmZimbraMail.logOff=function(o,a){
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 e={
path:appContextPath,qsArgs:{
loginOp:a?"relogin":"logout"}};
if(a){
e.qsArgs.username=appCtxt.getLoggedInUsername()
}
var t=AjxUtil.formatUrl(e);
ZmZimbraMail.sendRedirect(t);
if(AjxEnv.isFirefox){
ZmZimbraMail.setExitTimer(true)
}};
ZmZimbraMail.exitSession=function(){
ZmZimbraMail.logOff()
};
ZmZimbraMail.executeSessionTimer=function(){
ZmZimbraMail.sessionTimerInvoked=true;
ZmZimbraMail.logOff()
};
ZmZimbraMail._onClickLogOff=function(){
if(AjxEnv.isIE){
var e=DwtUiEvent.getEvent();
e.returnValue=false
}
ZmZimbraMail.logOff()
};
ZmZimbraMail.helpLinkCallback=function(){
ZmZimbraMail.unloadHackCallback();
var o=window.parentAppCtxt||window.appCtxt;
var a;
if(!o.isOffline){
try{
a=skin.hints.helpButton.url
}
catch(n){}
a=a||o.get(ZmSetting.HELP_URI);
var t=a.match(/?/)?"&":"?";
a=[a,t,"locid=",AjxEnv.DEFAULT_LOCALE].join("")
}else{
a=o.get(ZmSetting.HELP_URI).replace(//$/,"");
a=[a,"help","en_US","Zimbra_Mail_Help.htm"].join("/")
}
window.open(a)
};
ZmZimbraMail.sendRedirect=function(t){
if(AjxEnv.isIE){
var e=new AjxTimedAction(null,ZmZimbraMail.redir,[t]);
AjxTimedAction.scheduleAction(e,1)
}else{
ZmZimbraMail.redir(t)
}};
ZmZimbraMail.redir=function(a){
try{
window.location=a
}
catch(t){}};
ZmZimbraMail.prototype.setSessionTimer=function(t){
var e=appCtxt.get(ZmSetting.IDLE_SESSION_TIMEOUT)*1000;
if(e<=0){
return
}
if(t){
this._sessionTimerId=AjxTimedAction.scheduleAction(this._sessionTimer,e);
DwtEventManager.addListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr);
this._shell.setHandler(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr);
if(AjxEnv.isIE){
this._shell.setHandler(DwtEvent.ONMOUSEDOWN,ZmZimbraMail._userEventHdlr)
}else{
window.onkeydown=ZmZimbraMail._userEventHdlr
}}else{
AjxTimedAction.cancelAction(this._sessionTimerId);
this._sessionTimerId=-1;
DwtEventManager.removeListener(DwtEvent.ONMOUSEUP,ZmZimbraMail._userEventHdlr);
this._shell.clearHandler(DwtEvent.ONMOUSEUP);
if(AjxEnv.isIE){
this._shell.clearHandler(DwtEvent.ONMOUSEDOWN)
}else{
window.onkeydown=null
}}};
ZmZimbraMail.prototype.addChildWindow=function(t){
if(this._childWinList==null){
this._childWinList=new AjxVector()
}
var e={
win:t};
this._childWinList.add(e);
return e
};
ZmZimbraMail.prototype.getChildWindow=function(t){
if(this._childWinList){
for(var e=0;
e<this._childWinList.size();
e++){
if(t==this._childWinList.get(e).win){
return this._childWinList.get(e)
}}}
return null
};
ZmZimbraMail.prototype.removeChildWindow=function(t){
if(this._childWinList){
for(var e=0;
e<this._childWinList.size();
e++){
if(t==this._childWinList.get(e).win){
this._childWinList.removeAt(e);
break
}}}};
ZmZimbraMail.prototype._handleException=function(r,t){
var o=false;
if(r.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER){
var e=[ZmOrganizer.CALENDAR,ZmOrganizer.NOTEBOOK,ZmOrganizer.ADDRBOOK];
if(r.data.itemId&&r.data.itemId.length){
var l=r.data.itemId[0];
var n=l.lastIndexOf(":");
var s=l.substring(0,n);
var c=l.substring(n+1,l.length);
var a=appCtxt.getFolderTree();
for(var h=0;
h<e.length;
h++){
o|=a.handleNoSuchFolderError(e[h],s,c,true)
}}}
if(!o){
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 e=(appCtxt.isOffline)?ZmMsg.appExitWarningZD:ZmMsg.appExitWarning;
if(ZmZimbraMail.sessionTimerInvoked){
ZmZimbraMail.stayOnPagePrompt=true;
e=AjxMessageFormat.format(e+ZmMsg.appExitTimeWarning,[ZmZimbraMail.STAYONPAGE_INTERVAL])
}
if(!AjxEnv.isFirefox){
ZmZimbraMail.setExitTimer(true)
}
return e
}
ZmZimbraMail._endSession()
}
ZmZimbraMail._endSessionDone=true
};
ZmZimbraMail._isOkToExit=function(){
var t=window._zimbraMail;
if(!t){
return true
}
var e=t._appViewMgr.isOkToUnload()&&ZmZimbraMail._childWindowsOkToUnload();
if(e&&!AjxEnv.isPrism&&t._pollRequest){
t._requestMgr.cancelRequest(t._pollRequest)
}
return e
};
ZmZimbraMail._childWindowsOkToUnload=function(){
var t=window._zimbraMail?window._zimbraMail._childWinList:null;
if(t){
for(var e=0;
e<t.size();
e++){
var a=t.get(e);
if(a.win.ZmNewWindow._confirmExitMethod()){
return false
}}}
return true
};
ZmZimbraMail.handleNetworkStatusClick=function(){
var e=window.appCtxt.getAppController();
if(!e._isPrismOnline){
return
}
e._isUserOnline=!e._isUserOnline;
e._updateNetworkStatus(e._isUserOnline)
};
ZmZimbraMail.unloadHackCallback=function(){
window.onbeforeunload=null;
var e=function(){
window.onbeforeunload=ZmZimbraMail._confirmExitMethod
};
AjxTimedAction.scheduleAction((new AjxTimedAction(null,e)),3000)
};
ZmZimbraMail._userEventHdlr=function(t){
var e=window._zimbraMail;
if(e){
AjxTimedAction.cancelAction(e._sessionTimerId);
var a=appCtxt.get(ZmSetting.IDLE_SESSION_TIMEOUT)*1000;
if(a<=0){
return
}
e._sessionTimerId=AjxTimedAction.scheduleAction(e._sessionTimer,a)
}};
ZmZimbraMail.prototype._createBanner=function(){
var e=new DwtComposite({
parent:this._shell,posStyle:Dwt.ABSOLUTE_STYLE,id:ZmId.BANNER}
);
var a=appCtxt.getSkinHint("banner","url")||appCtxt.get(ZmSetting.LOGO_URI);
var t={
url:a,isOffline:appCtxt.isOffline};
e.getHtmlElement().innerHTML=AjxTemplate.expand("share.App#Banner",t);
return e
};
ZmZimbraMail.prototype._createUserInfo=function(a,s,n){
var e=appCtxt.getSkinHint(s,"position");
var t=e||Dwt.ABSOLUTE_STYLE;
var o=new DwtComposite({
parent:this._shell,className:a,posStyle:t,id:n}
);
o._setMouseEventHdlrs();
return o
};
ZmZimbraMail.prototype._createAppChooser=function(){
var a=[];
for(var r in ZmApp.CHOOSER_SORT){
if(r==ZmAppChooser.SPACER||r==ZmAppChooser.B_HELP||r==ZmAppChooser.B_LOGOUT){
continue
}
var s=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
var t=ZmApp.SETTING[r];
var n=ZmApp.UPSELL_SETTING[r];
if((t&&appCtxt.get(t,null,s))||(n&&appCtxt.get(n))){
a.push(r)
}}
a.sort(function(l,h){
return ZmZimbraMail.hashSortCompare(ZmApp.CHOOSER_SORT,l,h)
}
);
var o=new ZmAppChooser({
parent:this._shell,buttons:a,id:ZmId.APP_CHOOSER,refElementId:ZmId.SKIN_APP_CHOOSER}
);
var e=new AjxListener(this,this._appButtonListener);
o.addSelectionListener(e);
return o
};
ZmZimbraMail.prototype._appButtonListener=function(t){
try{
var a=t.item.getData(Dwt.KEY_ID);
if(a==ZmAppChooser.B_HELP){
window.open(appCtxt.get(ZmSetting.HELP_URI))
}else{
if(a==ZmAppChooser.B_LOGOUT){
DBG.println(AjxDebug.DBG1,"ZmZimbraMail : invoking logout.");
ZmZimbraMail.logOff()
}else{
if(a&&ZmApp.ENABLED_APPS[a]&&(a!=this._activeTabId)){
this.activateApp(a);
if(appCtxt.zimletsPresent()){
appCtxt.getZimletMgr().notifyZimlets("onSelectApp",a)
}}else{
if(a!=this._activeTabId){
this._appViewMgr.pushView(a)
}
if(t.target&&(t.target.className=="ImgClose")){
this._appViewMgr.popView()
}}}}}
catch(e){
this._handleException(e)
}};
ZmZimbraMail.prototype.getAppChooser=function(){
return this._appChooser
};
ZmZimbraMail.prototype.setActiveTabId=function(e){
this._activeTabId=e;
this._appChooser.setSelected(e)
};
ZmZimbraMail.prototype.setStatusMsg=function(e){
e=Dwt.getParams(arguments,ZmStatusView.MSG_PARAMS);
this.statusView.setStatusMsg(e)
};
ZmZimbraMail.prototype.dismissStatusMsg=function(e){
this.statusView.dismissStatusMsg(e)
};
ZmZimbraMail.prototype.getKeyMapName=function(){
var e=appCtxt.getCurrentController();
if(e&&e.getKeyMapName){
return e.getKeyMapName()
}
return"Global"
};
ZmZimbraMail.prototype.handleKeyAction=function(n,T){
DwtMenu.closeActiveMenu();
var c=ZmApp.GOTO_ACTION_CODE_R[n];
if(c){
if(c==this.getActiveApp()){
return false
}
this.activateApp(c);
return true
}
if(T&&(T.keyCode==13||T.keyCode==3)&&!(T.altKey||T.ctrlKey||T.metaKey||T.shiftKey)&&T.target&&(T.target.id!=DwtKeyboardMgr.FOCUS_FIELD_ID)){
return false
}
switch(n){
case ZmKeyMap.DBG_NONE:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.NONE);
break;
case ZmKeyMap.DBG_1:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.DBG1);
break;
case ZmKeyMap.DBG_2:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.DBG2);
break;
case ZmKeyMap.DBG_3:appCtxt.setStatusMsg("Setting Debug Level To: "+AjxDebug.DBG3);
break;
case ZmKeyMap.DBG_TIMING:var m=DBG._showTiming;
var t=m?"off":"on";
appCtxt.setStatusMsg("Turning Timing Info "+t);
break;
case ZmKeyMap.ASSISTANT:if(appCtxt.get(ZmSetting.ASSISTANT_ENABLED)){
if(!this._assistantDialog){
AjxDispatcher.require("Assistant");
this._assistantDialog=new ZmAssistantDialog()
}
this._assistantDialog.popup()
}
break;
case ZmKeyMap.QUICK_REMINDER:var o=appCtxt.multiAccounts&&appCtxt.accountList.mainAccount;
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED,null,o)){
var r=appCtxt.getCalManager();
r.showQuickReminder()
}
break;
case ZmKeyMap.LOGOFF:ZmZimbraMail.logOff();
break;
case ZmKeyMap.FOCUS_SEARCH_BOX:var e=appCtxt.getSearchController().getSearchToolbar();
if(e){
var h=e.getSearchField();
appCtxt.getKeyboardMgr().grabFocus(h);
if(ZmSearchAutocomplete){
ZmSearchAutocomplete._ignoreNextKey=true
}}
break;
case ZmKeyMap.FOCUS_CONTENT_PANE:this.focusContentPane();
break;
case ZmKeyMap.FOCUS_TOOLBAR:this.focusToolbar();
break;
case ZmKeyMap.UNDO:if(!appCtxt.isChildWindow){
var d=appCtxt.getActionController();
if(d){
d.undoCurrent()
}}
break;
case ZmKeyMap.SHORTCUTS:var g=appCtxt.getShortcutsPanel();
var p=this.getKeyMapName();
var a=appCtxt.getAppController().getKeyMapMgr();
var b=a.getAncestors(p);
var f=(b&&b.length>0);
b.unshift(p);
var x=[],v=[];
if(f){
if(b.length>1&&b[b.length-1]=="Global"){
b.pop();
v.push("global")
}}
for(var k=0;
k<b.length;
k++){
x.push(ZmKeyMap.MAP_NAME_R[b[k]]||DwtKeyMap.MAP_NAME_R[b[k]])
}
var z={}
,j={};
z.type=ZmShortcutList.TYPE_APP;
z.maps=x;
var u=[z];
if(v.length){
j.type=ZmShortcutList.TYPE_APP;
j.maps=v;
u.push(j)
}
var q={};
q.type=ZmShortcutList.TYPE_SYS;
q.maps=[];
var s=appCtxt.getCurrentController();
var O=["list","editor","tabView"];
for(var k=0;
k<O.length;
k++){
if(s&&s.mapSupported(O[k])){
q.maps.push(O[k])
}}
q.maps.push("button","menu","tree","dialog","toolbarHorizontal");
u.push(q);
g.popup(u);
break;
case ZmKeyMap.CANCEL:var l=false;
var w=(DwtMouseEventCapture.getId()=="DwtControl")?DwtMouseEventCapture.getCaptureObj():null;
var y=w&&w.targetObj;
if(y&&(y._dragging==DwtControl._DRAGGING)){
w.release();
y.__lastDestDwtObj=null;
y._setDragProxyState(false);
DwtControl.__badDrop(y,DwtShell.mouseEvent);
l=true
}
if(l){
break
}
default:var s=appCtxt.getCurrentController();
return(s&&s.handleKeyAction)?s.handleKeyAction(n,T):false
}
return true
};
ZmZimbraMail.prototype.focusContentPane=function(){
var e=appCtxt.getCurrentController();
var t=e?e.getCurrentView():null;
if(t){
appCtxt.getKeyboardMgr().grabFocus(t)
}};
ZmZimbraMail.prototype.focusToolbar=function(){
var e=appCtxt.getCurrentController();
var t=e?e.getCurrentToolbar():null;
if(t){
appCtxt.getKeyboardMgr().grabFocus(t)
}};
ZmZimbraMail.prototype._createUpsellView=function(s){
var r=[s,"upsell"].join("_");
if(!this._upsellView[s]){
var a=this._upsellView[s]=new ZmUpsellView({
parent:this._shell,posStyle:Dwt.ABSOLUTE_STYLE,className:"ZmUpsellView"}
);
var o=appCtxt.get(ZmApp.UPSELL_URL[s]);
var t=a.getHtmlElement();
var l=[];
var h=0;
l[h++]="<iframe id='iframe_"+a.getHTMLElId()+"' width='100%' height='100%' frameborder='0' src='";
l[h++]=o;
l[h++]="'>";
t.innerHTML=l.join("");
var e={};
e[ZmAppViewMgr.C_APP_CONTENT_FULL]=a;
var n={};
n[ZmAppViewMgr.CB_POST_SHOW]=new AjxCallback(this,this._displayUpsellView);
this._appViewMgr.createView({
viewId:r,appName:s,elements:e,isTransient:true,callbacks:n}
)
}
this._appViewMgr.pushView(r)
};
ZmZimbraMail.prototype._displayUpsellView=function(e){
var t=[ZmMsg.zimbraTitle,e].join(": ");
Dwt.setTitle(t);
appCtxt.getApp(this._getDefaultStartAppName()).setOverviewPanelContent(false)
};
ZmZimbraMail.prototype._postLoadZimlet=function(){
appCtxt.setZimletsPresent(true)
};
ZmZimbraMail.prototype._globalSelectionListener=function(n){
if(this._waitDisallowed){
this._waitDisallowed=false;
this.setInstantNotify(true)
}
if(!appCtxt.areZimletsLoaded()){
return
}
var o=n.item;
var h=(o&&o.getText)?(o.getText()||o._toggleText):null;
if(o&&!h){
h=o.getData(ZmOperation.KEY_ID)||o.getData(Dwt.KEY_ID)
}
if(h){
var a;
if(o instanceof ZmAppButton){
a="app"
}else{
if(o instanceof DwtMenuItem){
a="menuitem"
}else{
if(o instanceof DwtButton){
a="button"
}else{
if(o instanceof DwtTreeItem){
if(!o.getSelected()){
return
}
a="treeitem"
}else{
a=o.toString()
}}}}
var t=appCtxt.getAppViewMgr();
var e=t.getCurrentViewId();
var r=t.getLastViewId();
var s=(AjxStringUtil.split((""+h)," ")).join("");
appCtxt.notifyZimlets("onAction",[a,s,e,r])
}};
ZmZimbraMail._endSession=function(){
if(!AjxEnv.isPrism){
var e=new AjxCallback(null,function(){
return true
}
);
var t={
jsonObj:{
EndSessionRequest:{
_jsns:"urn:zimbraAccount"}}
,asyncMode:true,errorCallback:e};
appCtxt.getAppController().sendRequest(t)
}};
ZmOrganizer.ZIMLET="ZIMLET"
}
if(AjxPackage.define("zimbraMail.calendar.model.ZmCalBaseItem")){
ZmCalBaseItem=function(t,a,o,e){
if(arguments.length==0){
return
}
ZmItem.call(this,t,o,a);
this.id=o||-1;
this.uid=-1;
this.folderId=e||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.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(t,e){
if(t.getStartTime()>e.getStartTime()){
return 1
}
if(t.getStartTime()<e.getStartTime()){
return -1
}
if(t.getDuration()<e.getDuration()){
return 1
}
if(t.getDuration()>e.getDuration()){
return -1
}
return 0
};
ZmCalBaseItem.createFromDom=function(t,a,e){
var o=new ZmCalBaseItem(ZmItem.APPT,a.list);
o._loadFromDom(t,(e||{}
));
return o
};
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.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(e){
if(e){
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 t=this.startDate;
var e=this.endDate;
if(!t&&!e){
return false
}
if(!t){
return false
}
if(e.getHours()==0&&e.getMinutes()==0&&e.getSeconds()==0){
e=new Date(e.getTime()-2*AjxDateUtil.MSEC_PER_HOUR)
}
return(t.getDate()!=e.getDate())||(t.getMonth()!=e.getMonth())||(t.getFullYear()!=e.getFullYear())
};
ZmCalBaseItem.prototype.getDurationText=function(a,e){
var o=this.isAllDayEvent();
var s=this.isMultiDay();
if(o){
if(a){
return""
}
var r=this.startDate;
var t=new Date(this.endDate.getTime()-(s?2*AjxDateUtil.MSEC_PER_HOUR:0));
var n=s?ZmMsg.apptTimeAllDayMulti:ZmMsg.apptTimeAllDay;
return AjxMessageFormat.format(n,[r,t])
}
if(e){
return ZmCalBaseItem._getTTHour(this.startDate)
}
var n=s?ZmMsg.apptTimeInstanceMulti:ZmMsg.apptTimeInstance;
return AjxMessageFormat.format(n,[this.getDateInLocalTimezone(this.startDate),this.getDateInLocalTimezone(this.endDate),""])
};
ZmCalBaseItem.prototype.isAlarmInRange=function(){
if(!this.alarmData){
return false
}
var t=this.alarmData[0];
if(!t){
return false
}
this._nextAlarmTime=this.adjustMS(t.nextAlarm,this.tzo);
this._alarmInstStart=this.adjustMS(t.alarmInstStart,this.tzo);
var e=(new Date()).getTime();
return(e>=this._nextAlarmTime)
};
ZmCalBaseItem.prototype.adjustMS=function(e,a){
var t=this.isAllDayEvent()?(a+new Date(e).getTimezoneOffset()*60*1000):0;
return parseInt(e,10)+t
};
ZmCalBaseItem.prototype.isAlarmInstance=function(){
if(!this.alarmData){
return false
}
var e=this.alarmData[0];
this._alarmInstStart=this.adjustMS(e.alarmInstStart,this.tzo);
return(this._alarmInstStart==this.startDate.getTime())
};
ZmCalBaseItem.prototype.hasAlarmData=function(){
return(this.alarmData!=null)
};
ZmCalBaseItem.prototype._loadFromDom=function(a,e){
this.uid=a.uid;
this.folderId=a.l||this._getDefaultFolderId();
this.invId=a.invId;
this.isException=e.ex;
this.id=a.id;
this.name=this._getAttr(a,e,"name");
this.fragment=this._getAttr(a,e,"fr");
this.status=this._getAttr(a,e,"status");
this.ptst=this._getAttr(a,e,"ptst");
this.allDayEvent=(e.allDay||a.allDay)?"1":"0";
this.organizer=a.or&&a.or.a;
this.isOrg=this._getAttr(a,e,"isOrg");
this.transparency=this._getAttr(a,e,"transp");
if(e.allDay==false){
this.allDayEvent="0"
}
this.alarm=this._getAttr(a,e,"alarm");
this.alarmData=this._getAttr(a,e,"alarmData");
this.priority=parseInt(this._getAttr(a,e,"priority"));
this.recurring=e.recur!=null?e.recur:a.recur;
this.fba=this._getAttr(a,e,"fba");
var r=e.s!=null?e.s:a.inst&&a.inst.length>0&&a.inst[0].s;
if(r){
var h=this.tzo=e.tzo!=null?e.tzo:a.tzo;
var s=this.isAllDayEvent()?(h+new Date(e.s).getTimezoneOffset()*60*1000):0;
var n=parseInt(r,10)+s;
this.startDate=new Date(n);
this.uniqStartTime=this.startDate.getTime()
}
var o=this._getAttr(a,e,"dur");
if(o){
var t=n+(parseInt(o));
this.endDate=new Date(t)
}
this.otherAttendees=this._getAttr(a,e,"otherAtt");
this.location=this._getAttr(a,e,"loc")
};
ZmCalBaseItem.prototype._getDefaultFolderId=function(){
return ZmOrganizer.ID_CALENDAR
};
ZmCalBaseItem.prototype._getAttr=function(e,a,t){
return a[t]!=null?a[t]:a.ex?null:e[t]
};
ZmCalBaseItem.prototype._addLocationToSoap=function(e){
e.setAttribute("loc",this.getLocation())
};
ZmCalBaseItem._getTTHour=function(t){
var e=AjxDateFormat.getTimeInstance(AjxDateFormat.SHORT);
return e.format(t)
};
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 a=this.alarmData[0];
this._nextAlarmTime=a.nextAlarm;
this._alarmInstStart=a.alarmInstStart;
var e=(new Date()).getTime();
var t=(e-this._nextAlarmTime);
if(t>2*60*1000){
return true
}
return false
};
ZmCalBaseItem.prototype.getRestUrl=function(){
if(this.restUrl){
return this.restUrl
}
var e=appCtxt.getById(this.folderId);
var t=e?([e.getRestUrl(),"/?id=",AjxStringUtil.urlComponentEncode(this.id||this.invId)].join("")):null;
return t
};
ZmCalBaseItem.prototype.getDateInLocalTimezone=function(t){
var n=this.getTimezone();
var e=AjxTimezone.getServerId(AjxTimezone.DEFAULT);
if(n!=e){
var o=AjxTimezone.getOffset(AjxTimezone.DEFAULT,t);
var a=AjxTimezone.getOffset(AjxTimezone.getClientId(n),t);
return new Date(t.getTime()+(o-a)*60*1000)
}
return t
}
}
if(AjxPackage.define("zimbraMail.prefs.ZmPreferencesApp")){
ZmPreferencesApp=function(t,e){
ZmApp.call(this,ZmApp.PREFERENCES,t,e);
this._filterRules={};
this._outgoingFilterRules={}
};
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.prototype=new ZmApp;
ZmPreferencesApp.prototype.constructor=ZmPreferencesApp;
ZmPreferencesApp.prototype.toString=function(){
return"ZmPreferencesApp"
};
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(t,a){
if(appCtxt.multiAccounts){
appCtxt.accountList.setActiveAccount(appCtxt.accountList.mainAccount)
}
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require(["PreferencesCore","Preferences"],true,e,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(e){
var t=window.parentAppCtxt||window.appCtxt;
var a=e||t.getActiveAccount().name;
if(!this._filterRules[a]){
this._filterRules[a]=new ZmFilterRules(a)
}
return this._filterRules[a]
};
ZmPreferencesApp.prototype.getOutgoingFilterRules=function(e){
var t=window.parentAppCtxt||window.appCtxt;
var a=e||t.getActiveAccount().name;
if(!this._outgoingFilterRules[a]){
this._outgoingFilterRules[a]=new ZmFilterRules(a,true)
}
return this._outgoingFilterRules[a]
};
ZmPreferencesApp.prototype.modifyNotify=function(a,e){
var t=this._getSharingView();
if(t){
t.notifyModify(a)
}};
ZmPreferencesApp.prototype.refresh=function(t,o){
var e=this.getPreferencesPage("TRUSTED_ADDR");
if(e&&o){
e.addItem(o)
}
if(!appCtxt.inStartup){
var a=this._getSharingView();
if(a){
a.refresh(t)
}}};
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)
};
ZmPreferencesApp.prototype._registerSettings=function(e){
e=e||appCtxt.getSettings();
e.registerSetting("IMPORT_FOLDER",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("IMPORT_BUTTON",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("EXPORT_FOLDER",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("EXPORT_BUTTON",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_NONE}
);
e.registerSetting("PREF_SECTIONS",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_HASH,isGlobal:true}
);
e.registerSetting("SIGNATURE_MAX_LENGTH",{
name:"zimbraMailSignatureMaxLength",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:1024}
);
e.registerSetting("DISCARD_IN_FILTER_ENABLED",{
name:"zimbraFeatureDiscardInFiltersEnabled",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 y={
GENERAL:{
title:ZmMsg.general,templateId:"prefs.Pages#General",priority:0,prefs:[ZmSetting.LOCALE_NAME,ZmSetting.PASSWORD,ZmSetting.SEARCH_INCLUDES_SPAM,ZmSetting.SEARCH_INCLUDES_TRASH,ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES,ZmSetting.SHOW_SEARCH_STRING,ZmSetting.PAGE_SIZE,ZmSetting.SHOW_SELECTION_CHECKBOX,ZmSetting.SKIN_NAME,ZmSetting.CLIENT_TYPE,ZmSetting.DEFAULT_TIMEZONE,ZmSetting.DEFAULT_PRINTFONTSIZE,ZmSetting.OFFLINE_IS_MAILTO_HANDLER,ZmSetting.OFFLINE_NOTEBOOK_SYNC_ENABLED,ZmSetting.SHORT_ADDRESS,ZmSetting.USE_ADDR_BUBBLES,ZmSetting.OFFLINE_UPDATE_NOTIFY]}
,COMPOSING:{
parentId:"MAIL",title:ZmMsg.composing,icon:"Compose",templateId:"prefs.Pages#Composing",priority:20,precondition:[ZmSetting.MAIL_ENABLED],prefs:[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.COMPOSE_SAME_FORMAT,ZmSetting.MAIL_MANDATORY_SPELLCHECK]}
,SHARING:{
title:ZmMsg.sharing,icon:"SharedContact",templateId:"prefs.Pages#SharingPrefPage",priority:85,precondition:ZmSetting.SHARING_ENABLED,manageChanges:true,createView:function(x,q,p){
AjxDispatcher.require("Share");
return new ZmSharingPage(x,q,p)
}}
,NOTIFICATIONS:{
title:ZmMsg.notifications,icon:"ApptReminder",templateId:"prefs.Pages#Notifications",priority:88,precondition:[ZmSetting.CALENDAR_ENABLED,ZmSetting.TASKS_ENABLED],prefs:[ZmSetting.CAL_EMAIL_REMINDERS_ADDRESS,ZmSetting.CAL_DEVICE_EMAIL_REMINDERS_ADDRESS],createView:function(x,q,p){
return new ZmNotificationsPage(x,q,p)
}}
,MOBILE:{
title:ZmMsg.mobileDevices,icon:"Mobile",templateId:"prefs.Pages#MobileDevices",priority:90,precondition:ZmSetting.MOBILE_SYNC_ENABLED,manageChanges:true,createView:function(x,q,p){
return new ZmMobileDevicesPage(x,q,p)
}}
,IMPORT_EXPORT:{
title:ZmMsg.importExport,icon:"SendReceive",templateId:"data.ImportExport#ImportExportPrefPage",priority:100,precondition:[ZmSetting.IMPORT_ENABLED,ZmSetting.EXPORT_ENABLED],prefs:[ZmSetting.IMPORT_FOLDER,ZmSetting.IMPORT_BUTTON,ZmSetting.EXPORT_FOLDER,ZmSetting.EXPORT_BUTTON],manageChanges:true,createView:function(x,q,p){
AjxDispatcher.require("ImportExport");
return new ZmImportExportPage(x,q,p)
}}
,SHORTCUTS:{
title:ZmMsg.shortcuts,icon:"Shortcut",templateId:"prefs.Pages#Shortcuts",priority:120,precondition:ZmSetting.USE_KEYBOARD_SHORTCUTS,createView:function(x,q,p){
return new ZmShortcutsPage(x,q,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(x,q,p){
return new ZmZimletsPage(x,q,p)
}}};
if(appCtxt.isOffline){
y.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(x,q,p){
return new ZmBackupPage(x,q,p)
}}
}
for(var b in y){
ZmPref.registerPrefSection(b,y)
}
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,ZmSetting.NOTEBOOK_ENABLED]}
);
var r=[],m=[];
for(var k in DwtHtmlEditor.FONT_FAMILY){
var d=DwtHtmlEditor.FONT_FAMILY[k];
r.push(d.value);
m.push(d.name)
}
ZmPref.registerPref("COMPOSE_INIT_FONT_FAMILY",{
displayName:ZmMsg.defaultFontSettings,displayContainer:ZmPref.TYPE_SELECT,displayOptions:m,options:r,precondition:[ZmSetting.HTML_COMPOSE_ENABLED,ZmSetting.NOTEBOOK_ENABLED],approximateFunction:function(p){
if(AjxUtil.indexOf(r,p)!=-1){
return p
}
return DwtHtmlEditor._normalizeFontId(p)
}}
);
var a=[AjxMessageFormat.format(ZmMsg.pt,"8"),AjxMessageFormat.format(ZmMsg.pt,"10"),AjxMessageFormat.format(ZmMsg.pt,"12"),AjxMessageFormat.format(ZmMsg.pt,"14"),AjxMessageFormat.format(ZmMsg.pt,"18"),AjxMessageFormat.format(ZmMsg.pt,"24"),AjxMessageFormat.format(ZmMsg.pt,"36")];
var n=["8pt","10pt","12pt","14pt","18pt","24pt","36pt"];
var w=function(){
var q=appCtxt.accountList.visibleAccounts;
var x=[];
x.push(ZmMsg.zimletPrefDontSync);
for(var p=0;
p<q.length;
p++){
if(q[p].isZimbraAccount&&!q[p].isMain){
x.push([ZmMsg.zimletPrefSyncWith," ",q[p].name].join(""))
}}
return x
};
var h=function(){
var q=appCtxt.accountList.visibleAccounts;
var x=[];
x.push("");
for(var p=0;
p<q.length;
p++){
if(q[p].isZimbraAccount&&!q[p].isMain){
x.push(q[p].id)
}}
return x
};
ZmPref.registerPref("COMPOSE_INIT_FONT_SIZE",{
displayName:null,displayContainer:ZmPref.TYPE_SELECT,displayOptions:a,options:n,precondition:[ZmSetting.HTML_COMPOSE_ENABLED,ZmSetting.NOTEBOOK_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:w(),options:h()}
);
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:a,options:n}
);
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}
);
var t=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,t,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:AjxCallback.simpleClosure(ZmPref.requireAllPreConditions,null,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}
);
ZmPref.registerPref("USE_ADDR_BUBBLES",{
displayName:ZmMsg.useAddressBubbles,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 l=525600;
var c=10;
var o=[l];
var u=[ZmMsg.pollManually];
var v=appCtxt.get(ZmSetting.INSTANT_NOTIFY)?true:false;
if(v){
o.push(appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL));
u.push(ZmMsg.pollInstant)
}
var f=ZmPref.pollingIntervalDisplay(appCtxt.get(ZmSetting.MIN_POLLING_INTERVAL));
f=(f<1)?1:Math.round(f);
var e=ZmPref.pollingIntervalDisplay(appCtxt.get(ZmSetting.POLLING_INTERVAL));
e=Math.round(e);
while(f<=c){
o.push(f);
f++
}
f=f-1;
var s=o.length;
while(s<c){
f=f+5;
o.push(f);
s++
}
if(e>f&&e!=l&&(v&&e!=appCtxt.get(ZmSetting.INSTANT_NOTIFY_INTERVAL))){
var g=e%5;
g=(g==0)?e:((e/5+1)*5);
o.push(g)
}else{
f=f+5;
o.push(f)
}
while(u.length<=s){
u.push(ZmMsg.pollEveryNMinutes)
}
ZmPref.registerPref("POLLING_INTERVAL",{
displayName:ZmMsg.pollingInterval,displayContainer:ZmPref.TYPE_SELECT,displayOptions:u,options:o,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("SEARCH_INCLUDES_SPAM",{
displayName:ZmMsg.includeJunkFolder,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:AjxCallback.simpleClosure(ZmPref.requireAllPreConditions,null,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]}
);
ZmPref.registerPref("SHOW_FRAGMENTS",{
displayName:ZmMsg.showFragments,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(t){
var e=new AjxCallback(this,this._handleResponseLaunch,[t]);
appCtxt.getSettings().loadPreferenceData(e)
};
ZmPreferencesApp.prototype._handleResponseLaunch=function(e){
AjxDispatcher.run("GetPrefController").show();
if(e){
e.run()
}};
ZmPreferencesApp.prototype._getSharingView=function(){
var e=this.getPreferencesPage("SHARING");
return(e&&e.view)
};
ZmPreferencesApp.prototype.getPreferencesPage=function(a){
if(!this._prefController){
return null
}
var t=this.getPrefController();
var e=t&&t.getPrefsView();
return e&&e.getView(a)
};
ZmPreferencesApp.prototype._getOverviewParams=function(){
var e=ZmApp.prototype._getOverviewParams.call(this);
e.omit={};
e.omit[ZmOrganizer.ID_ZIMLET]=true;
return e
};
ZmPreferencesApp.getFilterRulesController=function(e){
var a=AjxDispatcher.run("GetPrefController");
if(a&&a.getPrefsView()){
var t=a.getFilterController();
return e?t.getOutgoingFilterRulesController():t.getIncomingFilterRulesController()
}
return null
}
}
if(AjxPackage.define("zimbraMail.portal.ZmPortalApp")){
ZmPortalApp=function(t,e){
ZmApp.call(this,ZmApp.PORTAL,t,e)
};
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 t=this.getPortletMgr();
var e=t.getPortlets();
for(var a in e){
e[a].refresh()
}};
ZmPortalApp.prototype.launch=function(t,a){
var e=new AjxCallback(this,this._handleLoadLaunch,[t,a]);
AjxDispatcher.require("Portal",true,e,null,true)
};
ZmPortalApp.prototype._handleLoadLaunch=function(t,a){
var e=this.getPortalController();
e.show();
ZmApp.prototype.launch.call(this,t,a)
};
ZmPortalApp.prototype.activate=function(t){
var e=this.getPortalController();
e.setPaused(!t);
ZmApp.prototype.activate.call(this,t)
};
ZmPortalApp.prototype.getManifest=function(n){
if(!this._manifest){
var a=appCtxt.get(ZmSetting.PORTAL_NAME);
if(a){
var t=new Date().getTime();
var o={
url:[window.appContextPath,"/portals/",a,"/manifest.xml?v=",t].join(""),callback:n?new AjxCallback(this,this._handleLoadManifest,[n]):null};
var e=AjxLoader.load(o);
if(!n){
this._handleLoadManifest(n,e)
}}}else{
if(n){
n.run(this._manifest)
}}
return this._manifest
};
ZmPortalApp.prototype._handleLoadManifest=function(callback,req){
var e;
if(req.status==200&&req.responseXML){
try{
var json=new AjxJsonSerializer(true).serialize(req.responseXML);
eval("this._manifest = "+json);
var portalDef=this._manifest.portal;
var portletsDef=portalDef&&portalDef.portlets;
if(portletsDef&&!(portletsDef.portlet instanceof Array)){
portletsDef.portlet=[portletsDef.portlet]
}
portalDef.portlets=portletsDef.portlet;
if(portalDef.portlets){
for(var i=0;
i<portalDef.portlets.length;
i++){
var portletDef=portalDef.portlets[i];
var propertyDef=portletDef.property;
if(propertyDef&&!(propertyDef instanceof Array)){
propertyDef=[propertyDef]
}
portletDef.properties=propertyDef;
delete portletDef.property
}}}
catch(e){}}else{
e=""
}
if(!this._manifest){
this._manifest={
error:e}
}
if(callback){
callback.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 o=[];
for(var t in ZmApp.CHOOSER_SORT){
o.push({
name:t,sort:ZmApp.CHOOSER_SORT[t]}
)
}
o.sort(ZmPortalApp.__BY_SORT);
var e=null;
for(var a=0;
a<o.length;
a++){
var n=o[a];
if(n.name==this._name){
continue
}
if(appCtxt.getApp(n.name).isUpsell){
continue
}
e=n.name;
break
}
this._overviewApp=appCtxt.getApp(e)
}
return this._overviewApp
};
ZmPortalApp.__BY_SORT=function(t,e){
return t.sort-e.sort
}
}
if(AjxPackage.define("zimbraMail.mail.ZmMailApp")){
ZmMailApp=function(t,e){
ZmApp.call(this,ZmApp.MAIL,t,e);
this._dataSourceCollection={};
this._identityCollection={};
this._signatureCollection={};
this.numEntries=0;
this.globalMailCount=0;
this._throttleStats=[];
this._addSettingsChangeListeners()
};
ZmMailApp.prototype=new ZmApp;
ZmMailApp.prototype.constructor=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.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={};
for(var i in ZmMailApp.INC_MAP){
var key=(i==ZmSetting.INC_NONE||i==ZmSetting.INC_ATTACH)?ZmMailApp.INC_MAP[i][0]:ZmMailApp.INC_MAP[i].join("|");
ZmMailApp.INC_MAP_REV[key]=i
}
ZmMailApp._setGroupByMaps=function(){
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.toString=function(){
return"ZmMailApp"
};
ZmMailApp.prototype._defineAPI=function(){
AjxDispatcher.setPackageLoadFunction("MailCore",new AjxCallback(this,this._postLoadCore));
AjxDispatcher.setPackageLoadFunction("Mail",new AjxCallback(this,this._postLoad));
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",new AjxCallback(this,this.getConvListController));
AjxDispatcher.registerMethod("GetMsgController",["MailCore","Mail"],new AjxCallback(this,this.getMsgController));
AjxDispatcher.registerMethod("GetTradController","MailCore",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("GetAttachmentsController",["MailCore","Mail"],new AjxCallback(this,this.getAttachmentsController));
AjxDispatcher.registerMethod("GetMailConfirmController",["MailCore","Mail"],new AjxCallback(this,this.getConfirmController))
};
ZmMailApp.prototype._registerSettings=function(e){
var e=e||appCtxt.getSettings();
e.registerSetting("ALLOW_ANY_FROM_ADDRESS",{
name:"zimbraAllowAnyFromAddress",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.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}
);
e.registerSetting("COMPOSE_SAME_FORMAT",{
name:"zimbraPrefForwardReplyInOriginalFormat",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CONVERSATIONS_ENABLED",{
name:"zimbraFeatureConversationsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("CONVERSATION_ORDER",{
name:"zimbraPrefConversationOrder",type:ZmSetting.T_PREF,defaultValue:ZmSearch.DATE_DESC,isImplicit:true}
);
e.registerSetting("CONVERSATION_PAGE_SIZE",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:250,isGlobal:true}
);
e.registerSetting("DEDUPE_MSG_TO_SELF",{
name:"zimbraPrefDedupeMessagesSentToSelf",type:ZmSetting.T_PREF,defaultValue:ZmSetting.DEDUPE_NONE}
);
e.registerSetting("DEFAULT_DISPLAY_NAME",{
type:ZmSetting.T_PSEUDO,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("DETACH_COMPOSE_ENABLED",{
name:"zimbraFeatureComposeInNewWindowEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("DETACH_MAILVIEW_ENABLED",{
name:"zimbraFeatureOpenMailInNewWindowEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("DISPLAY_EXTERNAL_IMAGES",{
name:"zimbraPrefDisplayExternalImages",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("END_DATE_ENABLED",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("FILTERS_ENABLED",{
name:"zimbraFeatureFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("FILTERS_MAIL_FORWARDING_ENABLED",{
name:"zimbraFeatureMailForwardingInFiltersEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("FORWARD_INCLUDE_HEADERS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("FORWARD_INCLUDE_ORIG",{
name:"zimbraPrefForwardIncludeOriginalText",type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("FORWARD_INCLUDE_WHAT",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("FORWARD_MENU_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("FORWARD_USE_PREFIX",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("GET_MAIL_ACTION",{
name:"zimbraPrefGetMailAction",type:ZmSetting.T_PREF,defaultValue:ZmSetting.GETMAIL_ACTION_DEFAULT,isGlobal:true}
);
e.registerSetting("GROUP_MAIL_BY",{
name:"zimbraPrefGroupMailBy",type:ZmSetting.T_PREF,defaultValue:ZmSetting.GROUP_BY_MESSAGE,isImplicit:true,isGlobal:true}
);
e.registerSetting("HIGHLIGHT_OBJECTS",{
name:"zimbraMailHighlightObjectsMaxSize",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:70}
);
e.registerSetting("HTML_SIGNATURE_ENABLED",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IDENTITIES_ENABLED",{
name:"zimbraFeatureIdentitiesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("INITIAL_SEARCH",{
name:"zimbraPrefMailInitialSearch",type:ZmSetting.T_PREF,defaultValue:"in:inbox"}
);
e.registerSetting("INITIAL_SEARCH_ENABLED",{
name:"zimbraFeatureInitialSearchPreferenceEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_ATTACH_VIEW_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_BLACKLIST",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("TRUSTED_ADDR_LIST",{
name:"zimbraPrefMailTrustedSenderList",type:ZmSetting.T_COS,dataType:ZmSetting.D_LIST}
);
e.registerSetting("TRUSTED_ADDR_LIST_MAX_NUM_ENTRIES",{
name:"zimbraMailTrustedSenderListMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
);
e.registerSetting("MAIL_BLACKLIST_MAX_NUM_ENTRIES",{
name:"zimbraMailBlacklistMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
);
e.registerSetting("MAIL_FOLDER_COLORS_ENABLED",{
name:"zimbraPrefFolderColorEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("MAIL_FORWARDING_ADDRESS",{
name:"zimbraPrefMailForwardingAddress",type:ZmSetting.T_PREF}
);
e.registerSetting("MAIL_FORWARDING_ENABLED",{
name:"zimbraFeatureMailForwardingEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_MANDATORY_SPELLCHECK",{
name:"zimbraPrefMandatorySpellCheckEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_FROM_ADDRESS",{
name:"zimbraPrefFromAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("MAIL_LIFETIME_GLOBAL",{
name:"zimbraMailMessageLifetime",type:ZmSetting.T_COS,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_INBOX_READ",{
name:"zimbraPrefInboxReadLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_INBOX_UNREAD",{
name:"zimbraPrefInboxUnreadLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_JUNK",{
name:"zimbraPrefJunkLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_JUNK_GLOBAL",{
name:"zimbraMailSpamLifetime",type:ZmSetting.T_COS,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_SENT",{
name:"zimbraPrefSentLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_TRASH",{
name:"zimbraPrefTrashLifetime",type:ZmSetting.T_PREF,defaultValue:"0"}
);
e.registerSetting("MAIL_LIFETIME_TRASH_GLOBAL",{
name:"zimbraMailTrashLifetime",type:ZmSetting.T_COS,defaultValue:"0"}
);
e.registerSetting("MAIL_LOCAL_DELIVERY_DISABLED",{
name:"zimbraPrefMailLocalDeliveryDisabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_NOTIFY_SOUNDS",{
name:"zimbraPrefMailSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_NOTIFY_APP",{
name:"zimbraPrefMailFlashIcon",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_NOTIFY_BROWSER",{
name:"zimbraPrefMailFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_NOTIFY_TOASTER",{
name:"zimbraPrefMailToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("MAIL_PRIORITY_ENABLED",{
name:"zimbraFeatureMailPriorityEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("MAIL_READ_RECEIPT_ENABLED",{
name:"zimbraFeatureReadReceiptsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("MAIL_SEND_READ_RECEIPTS",{
name:"zimbraPrefMailSendReadReceipts",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"never"}
);
e.registerSetting("MAIL_WHITELIST",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("MAIL_WHITELIST_MAX_NUM_ENTRIES",{
name:"zimbraMailWhitelistMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
);
e.registerSetting("MARK_MSG_READ",{
name:"zimbraPrefMarkMsgRead",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}
);
e.registerSetting("MAX_MESSAGE_SIZE",{
type:ZmSetting.T_PREF,defaultValue:ZmMailApp.DEFAULT_MAX_MESSAGE_SIZE}
);
e.registerSetting("NEW_WINDOW_COMPOSE",{
name:"zimbraPrefComposeInNewWindow",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("NOTIF_ADDRESS",{
name:"zimbraPrefNewMailNotificationAddress",type:ZmSetting.T_PREF}
);
e.registerSetting("NOTIF_ENABLED",{
name:"zimbraPrefNewMailNotificationEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("NOTIF_FEATURE_ENABLED",{
name:"zimbraFeatureNewMailNotificationEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("OPEN_MAIL_IN_NEW_WIN",{
name:"zimbraPrefOpenMailInNewWindow",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("POP_ENABLED",{
name:"zimbraPop3Enabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:!appCtxt.isOffline}
);
e.registerSetting("POP_DOWNLOAD_SINCE_VALUE",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}
);
e.registerSetting("POP_DOWNLOAD_SINCE",{
name:"zimbraPrefPop3DownloadSince",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}
);
e.registerSetting("READING_PANE_LOCATION",{
name:"zimbraPrefReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true,isGlobal:true}
);
e.registerSetting("READING_PANE_LOCATION_CV",{
name:"zimbraPrefConvReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}
);
e.registerSetting("REPLY_INCLUDE_HEADERS",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("REPLY_INCLUDE_ORIG",{
name:"zimbraPrefReplyIncludeOriginalText",type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("REPLY_INCLUDE_WHAT",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.INC_BODY,isGlobal:true}
);
e.registerSetting("REPLY_MENU_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("REPLY_PREFIX",{
name:"zimbraPrefForwardReplyPrefixChar",type:ZmSetting.T_PREF,defaultValue:">",isGlobal:true}
);
e.registerSetting("REPLY_TO_ADDRESS",{
name:"zimbraPrefReplyToAddress",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("REPLY_TO_ENABLED",{
name:"zimbraPrefReplyToEnabled",type:ZmSetting.T_PREF}
);
e.registerSetting("REPLY_USE_PREFIX",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("SAVE_DRAFT_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("SAVE_TO_SENT",{
name:"zimbraPrefSaveToSent",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("SELECT_AFTER_DELETE",{
name:"zimbraPrefMailSelectAfterDelete",type:ZmSetting.T_PREF,defaultValue:ZmSetting.DELETE_SELECT_NEXT,isGlobal:true}
);
e.registerSetting("SENT_FOLDER_NAME",{
name:"zimbraPrefSentMailFolder",type:ZmSetting.T_PREF,defaultValue:"sent"}
);
e.registerSetting("SHOW_BCC",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SHOW_FRAGMENTS",{
name:"zimbraPrefShowFragments",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("SHOW_MAIL_CONFIRM",{
name:"zimbraFeatureConfirmationPageEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SIGNATURE",{
name:"zimbraPrefMailSignature",type:ZmSetting.T_PREF}
);
e.registerSetting("SIGNATURE_ENABLED",{
name:"zimbraPrefMailSignatureEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SIGNATURE_STYLE",{
name:"zimbraPrefMailSignatureStyle",type:ZmSetting.T_PREF,defaultValue:ZmSetting.SIG_OUTLOOK}
);
e.registerSetting("START_DATE_ENABLED",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("USER_FOLDERS_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("VACATION_FROM",{
name:"zimbraPrefOutOfOfficeFromDate",type:ZmSetting.T_PREF,defaultValue:""}
);
e.registerSetting("VACATION_MSG",{
name:"zimbraPrefOutOfOfficeReply",type:ZmSetting.T_PREF,defaultValue:""}
);
e.registerSetting("VACATION_MSG_ENABLED",{
name:"zimbraPrefOutOfOfficeReplyEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("VACATION_MSG_FEATURE_ENABLED",{
name:"zimbraFeatureOutOfOfficeReplyEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("VACATION_UNTIL",{
name:"zimbraPrefOutOfOfficeUntilDate",type:ZmSetting.T_PREF,defaultValue:""}
);
e.registerSetting("COLLAPSE_IMAP_TREES",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SAVE_TO_IMAP_SENT",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
ZmMailApp._setGroupByMaps()
};
ZmMailApp.prototype._registerPrefs=function(){
var t={
MAIL:{
title:ZmMsg.mail,icon:"MailApp",templateId:"prefs.Pages#Mail",priority:10,precondition:appCtxt.get(ZmSetting.MAIL_ENABLED),prefs:[ZmSetting.DEDUPE_MSG_TO_SELF,ZmSetting.DISPLAY_EXTERNAL_IMAGES,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_APP,ZmSetting.MAIL_NOTIFY_BROWSER,ZmSetting.MAIL_NOTIFY_TOASTER,ZmSetting.OFFLINE_NOTIFY_NEWMAIL_ON_INBOX,ZmSetting.MAIL_WHITELIST,ZmSetting.MAIL_SEND_READ_RECEIPTS,ZmSetting.MARK_MSG_READ,ZmSetting.NOTIF_ADDRESS,ZmSetting.NOTIF_ENABLED,ZmSetting.OPEN_MAIL_IN_NEW_WIN,ZmSetting.PAGE_SIZE,ZmSetting.POP_DOWNLOAD_SINCE_VALUE,ZmSetting.POP_DOWNLOAD_SINCE,ZmSetting.POLLING_INTERVAL,ZmSetting.SHOW_FRAGMENTS,ZmSetting.VACATION_MSG_ENABLED,ZmSetting.VACATION_MSG,ZmSetting.SELECT_AFTER_DELETE,ZmSetting.START_DATE_ENABLED,ZmSetting.END_DATE_ENABLED,ZmSetting.VACATION_FROM,ZmSetting.VACATION_UNTIL,ZmSetting.VIEW_AS_HTML],manageDirty:true,createView:function(o,n,a){
AjxDispatcher.require("Alert");
return new ZmMailPrefsPage(o,n,a)
}}
,ACCOUNTS:{
parentId:"MAIL",icon:"Accounts",title:(appCtxt.isOffline?ZmMsg.personas:ZmMsg.accounts),templateId:"prefs.Pages#Accounts",priority:40,precondition:appCtxt.get(ZmSetting.MAIL_ENABLED),prefs:[ZmSetting.ACCOUNTS],manageDirty:true,createView:function(o,n,a){
return new ZmAccountsPage(o,n,a)
}}
,SIGNATURES:{
parentId:"MAIL",icon:"AddSignature",title:ZmMsg.signatures,templateId:"prefs.Pages#Signatures",priority:30,precondition:(appCtxt.get(ZmSetting.MAIL_ENABLED)&&appCtxt.get(ZmSetting.SIGNATURES_ENABLED)),prefs:[ZmSetting.SIGNATURES,ZmSetting.SIGNATURE_STYLE,ZmSetting.SIGNATURE_ENABLED],manageDirty:true,createView:function(o,n,a){
return new ZmSignaturesPage(o,n,a)
}}
,FILTERS:{
parentId:"MAIL",icon:"MailRule",title:ZmMsg.filterRules,templateId:"prefs.Pages#MailFilters",priority:50,precondition:(appCtxt.get(ZmSetting.MAIL_ENABLED)&&appCtxt.get(ZmSetting.FILTERS_ENABLED)),prefs:[ZmSetting.FILTERS],manageChanges:true,createView:function(o,n,a){
return a.getFilterController(n).getFilterView()
}}
,TRUSTED_ADDR:{
parentId:"MAIL",title:ZmMsg.trustedAddrs,icon:"TrustedAddresses",templateId:"prefs.Pages#Trusted",priority:60,precondition:appCtxt.get(ZmSetting.MAIL_ENABLED),createView:function(o,n,a){
return new ZmTrustedPage(o,n,a)
}
,manageDirty:true,prefs:[ZmSetting.TRUSTED_ADDR_LIST]}};
for(var e in t){
ZmPref.registerPrefSection(e,t[e])
}
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("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("DISPLAY_EXTERNAL_IMAGES",{
displayName:ZmMsg.showExternalImages,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("END_DATE_ENABLED",{
displayName:ZmMsg.endOn,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}
);
ZmPref.registerPref("GET_MAIL_ACTION",{
displayContainer:ZmPref.TYPE_RADIO_GROUP,orientation:ZmPref.ORIENT_VERTICAL,displayOptions:[ZmMsg.checkMailPrefDefault,ZmMsg.checkMailPrefUpdate],options:[ZmSetting.GETMAIL_ACTION_DEFAULT,ZmSetting.GETMAIL_ACTION_UPDATE]}
);
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_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}
);
ZmPref.registerPref("NOTIF_ENABLED",{
displayName:ZmMsg.mailNotifEnabled,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.NOTIF_FEATURE_ENABLED,validationFunction:ZmMailApp.validateSendNotification,errorMessage:ZmMsg.errorMissingNotifyAddr}
);
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("REPLY_TO_ADDRESS",{
displayName:ZmMsg.replyToAddress,displayContainer:ZmPref.TYPE_INPUT,validationFunction:ZmPref.validateEmail,errorMessage:ZmMsg.invalidEmail}
);
ZmPref.registerPref("SELECT_AFTER_DELETE",{
displayName:ZmMsg.clientType,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}
);
ZmPref.registerPref("START_DATE_ENABLED",{
displayContainer:ZmPref.TYPE_CHECKBOX,displayName:ZmMsg.startOn,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED}
);
ZmPref.registerPref("VACATION_FROM",{
displayName:ZmMsg.startDate,displayContainer:ZmPref.TYPE_INPUT,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,displayFunction:ZmPref.dateGMT2Local,valueFunction:ZmPref.dateLocal2GMT}
);
ZmPref.registerPref("VACATION_UNTIL",{
displayName:ZmMsg.endDate,displayContainer:ZmPref.TYPE_INPUT,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,displayFunction:ZmPref.dateGMT2Local,valueFunction:ZmPref.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.awayMessageEnabled,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:ZmSetting.VACATION_MSG_FEATURE_ENABLED,validationFunction:ZmMailApp.validateVacationMsgEnabled,errorMessage:ZmMsg.missingAwayMessage}
);
ZmPref.registerPref("MAIL_NOTIFY_TOASTER",{
displayFunc:function(){
AjxDispatcher.require("Alert");
return ZmDesktopAlert.getInstance().getDisplayText()
}
,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.validateForwardEmail=function(t){
if(!t||t==""){
var o=ZmPref.getPrefSectionWithPref(ZmSetting.MAIL_FORWARDING_ADDRESS);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var a=e.getView(o.id).getFormObject(ZmSetting.MAIL_LOCAL_DELIVERY_DISABLED);
if(a&&a.isSelected()){
a.setSelected(false)
}}
return ZmPref.validateEmail(t)
};
ZmMailApp.validateMailLocalDeliveryDisabled=function(a){
if(!a){
return true
}
var o=ZmPref.getPrefSectionWithPref(ZmSetting.MAIL_FORWARDING_ADDRESS);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(o.id).getFormObject(ZmSetting.MAIL_FORWARDING_ADDRESS);
return(t!=null&&t.isValid())
};
ZmMailApp.validateSendNotification=function(a){
if(!a){
return true
}
var o=ZmPref.getPrefSectionWithPref(ZmSetting.NOTIF_ADDRESS);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(o.id).getFormObject(ZmSetting.NOTIF_ADDRESS);
return(t!=null&&t.isValid())
};
ZmMailApp.validateVacationMsg=function(a){
if(a&&(a.length>0)){
return true
}
var o=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG_ENABLED);
if(!o){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(o.id).getFormObject(ZmSetting.VACATION_MSG_ENABLED);
return(t&&!t.isSelected())
};
ZmMailApp.validateVacationMsgEnabled=function(a){
if(!a){
return true
}
var n=ZmPref.getPrefSectionWithPref(ZmSetting.VACATION_MSG);
if(!n){
return false
}
var e=appCtxt.getApp(ZmApp.PREFERENCES).getPrefController().getPrefsView();
var t=e.getView(n.id).getFormObject(ZmSetting.VACATION_MSG);
if(!t){
return false
}
var o=t.getValue();
return(o&&(o.length>0))
};
ZmMailApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_ACCEPT_PROPOSAL,{
textKey:"replyAccept",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_ADD_FILTER_RULE,{
textKey:"newFilter",image:"Plus"}
,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}
);
ZmOperation.registerOp(ZmId.OP_CHECK_MAIL_DEFAULT,{
textKey:"checkMailDefault"}
);
ZmOperation.registerOp(ZmId.OP_CHECK_MAIL_UPDATE,{
textKey:"checkMailUpdate"}
);
ZmOperation.registerOp(ZmId.OP_COMPOSE_OPTIONS,{
textKey:"options",image:"Preferences"}
);
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_DECLINE_PROPOSAL,{
textKey:"replyDecline",image:"Cancel"}
);
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,{
tooltipKey:"deleteTooltip",image:"Delete"}
);
ZmOperation.registerOp(ZmId.OP_DETACH_COMPOSE,{
tooltipKey:"detachTooltip",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_INLINE,{
textKey:"forwardInline",tooltipKey:"forwardTooltip",image:"Forward"}
);
ZmOperation.registerOp(ZmId.OP_IM,{
textKey:"newIM",image:"ImStartChat",tooltipKey:"imNewChat"}
,ZmSetting.IM_ENABLED);
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_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_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_REMOVE_FILTER_RULE,{
textKey:"filterRemove",image:"Delete"}
,ZmSetting.FILTERS_ENABLED);
ZmOperation.registerOp(ZmId.OP_CAL_REPLY,{
textKey:"reply",tooltipKey:"replyTooltip",image:"Reply",shortcut:ZmKeyMap.REPLY}
);
ZmOperation.registerOp(ZmId.OP_CAL_REPLY_ALL,{
textKey:"replyAll",tooltipKey:"replyAllTooltip",image:"ReplyAll",shortcut:ZmKeyMap.REPLY_ALL}
);
ZmOperation.registerOp(ZmId.OP_REPLY,{
textKey:"reply",tooltipKey:"replyTooltip",image:"Reply",shortcut:ZmKeyMap.REPLY,textPrecedence:50}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT,{
textKey:"replyAccept",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ALL,{
textKey:"replyAll",tooltipKey:"replyAllTooltip",image:"ReplyAll",shortcut:ZmKeyMap.REPLY_ALL,textPrecedence:48}
);
ZmOperation.registerOp(ZmId.OP_REPLY_CANCEL);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE,{
textKey:"replyDecline",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_MODIFY);
ZmOperation.registerOp(ZmId.OP_REPLY_NEW_TIME,{
textKey:"replyNewTime",image:"NewTime"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE,{
textKey:"replyTentative",image:"QuestionMark"}
);
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.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_ONLY_MAIL,{
textKey:"showOnlyMail",image:"Conversation"}
,ZmSetting.MIXED_VIEW_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",countKey:"typeConversation",icon:"Conversation",soapCmd:"ConvAction",itemClass:"ZmConv",node:"c",organizer:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.TAG,ZmOrganizer.ZIMLET],searchType:"conversation",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("MailCore");
return new ZmMailList(ZmItem.CONV,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.MSG,{
app:ZmApp.MAIL,nameKey:"message",countKey:"typeMessage",icon:"Message",soapCmd:"MsgAction",itemClass:"ZmMailMsg",node:"m",organizer:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.FOLDER,ZmOrganizer.TAG,ZmOrganizer.ZIMLET],searchType:"message",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("MailCore");
return new ZmMailList(ZmItem.MSG,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.ATT,{
app:ZmApp.MAIL,nameKey:"attachment",icon:"Attachment",itemClass:"ZmMimePart",node:"mp",resultsList:AjxCallback.simpleClosure(function(e){
return new ZmMailList(ZmItem.ATT,e)
}
,this)}
)
};
ZmMailApp.prototype._setupSearchToolbar=function(){
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_MAIL,{
msgKey:"searchMail",tooltipKey:"searchMail",icon:"Message",shareIcon:"SharedMailFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_MAIL)}
)
}};
ZmMailApp.prototype._registerApp=function(){
var t={};
t[ZmOperation.NEW_MESSAGE]="message";
var e={};
e[ZmKeyMap.NEW_MESSAGE]=ZmOperation.NEW_MESSAGE;
e[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],assistants:{
ZmMailAssistant:"Mail"}
,searchTypes:[ZmItem.MSG,ZmItem.CONV],newItemOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_MAIL,newActionCode:ZmKeyMap.NEW_MESSAGE,qsViews:["compose","msg"],trashViewOp:ZmOperation.SHOW_ONLY_MAIL,chooserSort:10,defaultSort:10,upsellUrl:ZmSetting.MAIL_UPSELL_URL}
)
};
ZmMailApp.prototype.startup=function(e){};
ZmMailApp.prototype.preNotify=function(m){
if(!(m.deleted&&m.created&&m.modified)){
return m
}
var n=false;
var s=m.deleted.id&&m.deleted.id.split(",");
var g={};
var h=[];
if(s&&s.length){
for(var z=0;
z<s.length;
z++){
var v=s[z];
var y=ZmOrganizer.normalizeId(v);
if(y<0){
g[y]=true;
n=true
}else{
h.push(v)
}}}
if(!n){
return m
}
var f=false;
var p={};
var l={};
for(var B in m.created){
var T=m.created;
if(T&&T.length){
for(var z=0;
z<T.length;
z++){
var d=T[z];
var v=d.id;
var t=(B=="m")?"|cid="+d.cid+"|l="+d.l:"|n="+d.n;
AjxDebug.println(AjxDebug.NOTIFY,B+": id="+v+"|su='"+d.su+"'|f="+d.f+"|d="+d.d+t);
if(B=="m"){
p[v]=d
}else{
if(B=="c"&&(d.n>1)){
l[v]=d;
f=true
}}}}}
if(!f){
return m
}
var q=false;
var j={};
var u={};
var T=m.modified.m;
if(T&&T.length){
for(var z=0;
z<T.length;
z++){
var W=T[z];
var v=W.id;
var y=ZmOrganizer.normalizeId(v);
var e=y*-1;
if(g[e]&&l[W.cid]){
q=true;
u[v]=W;
j[W.cid]=appCtxt.multiAccounts?ZmOrganizer.getSystemId(e):e;
l[W.cid]._wasVirtConv=true;
l[W.cid].m=[{
id:v}
];
var o=appCtxt.getById(v);
if(o){
o.cid=W.cid
}}}}
if(!q){
return m
}
if(h.length){
m.deleted.id=h.join(",")
}else{
delete m.deleted
}
var A=[];
var T=m.created.c;
if(T&&T.length){
for(var z=0;
z<T.length;
z++){
var d=T[z];
var O=l[d.id];
if(!(O&&O._wasVirtConv)){
A.push(d)
}}}
if(A&&A.length){
m.created.c=A
}else{
delete m.created.c
}
for(var v in p){
var b=p[v];
var w=l[b.cid];
if(w&&w._wasVirtConv){
b._convCreateNode=w
}}
var k=[];
for(var r in j){
var x=l[r];
x.id=j[r];
x._newId=r;
k.push(x)
}
if(k.length){
var a={};
a.c=k;
appCtxt.getRequestMgr()._handleModifies(a)
}
appCtxt.setNotifyDebug("Handling NOTIFY: in ZmMailApp - End of Prenotify")
};
ZmMailApp.prototype.createNotify=function(h,e){
appCtxt.setNotifyDebug("Handling NOTIFY: In ZmMailAppcreateNotify");
if(!h.m&&!h.c&&!h.link){
return
}
if(!e&&!this._noDefer&&this._deferNotifications("create",h)){
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: skipping/deferring notifications");
return
}
if(h.link){
var r=h.link;
for(var a=0;
a<r.length;
a++){
var n=r[a];
if(appCtxt.cacheGet(n.id)){
continue
}
this._handleCreateLink(n,ZmOrganizer.FOLDER)
}}
var t=[this._tradController,this._convListController,this._convController];
var l=this._getCurrentViewController();
if(l&&t[t.length-1]!==l){
AjxUtil.arrayRemove(t,l);
t.push(l)
}
var s=0;
for(var a=0;
a<t.length;
a++){
if(t[a]){
s=a
}}
for(var a=0;
a<t.length;
a++){
var o=t[a];
if(o){
this._checkList(h,o.getList(),o,a==s)
}}
this._handleAlerts(h)
};
ZmMailApp.prototype._handleAlerts=function(p){
var e=p.m||[];
if(e.length==0){
return
}
AjxDispatcher.require("Alert");
var g=appCtxt.getActiveAccount();
var t,f,r=false;
var l=0;
for(var m=0;
m<e.length;
m++){
var b=e[m];
var n=(b&&b.f&&(b.f.indexOf(ZmItem.FLAG_UNREAD)!=-1))?ZmOrganizer.parseId(b.l):null;
var o=n&&n.account;
if(!o||(o&&o.isOfflineInitialSync())){
continue
}
if(appCtxt.isOffline&&n&&!o.isMain){
var c=(appCtxt.get(ZmSetting.OFFLINE_NOTIFY_NEWMAIL_ON_INBOX))?(n.id==ZmOrganizer.ID_INBOX):(n.id!=ZmOrganizer.ID_SPAM&&n.id!=ZmOrganizer.ID_TRASH);
if(c){
this.globalMailCount++;
o.inNewMailMode=true;
var w=appCtxt.getOverviewController()._overviewContainer;
for(var u in w){
w[u].updateAccountInfo(o,true,true)
}}}
if(n&&n.id==ZmOrganizer.ID_INBOX){
if(appCtxt.accountList.size()>1){
ZmAccountAlert.get(o).start(this)
}
if(!t&&o==g&&appCtxt.get(ZmSetting.MAIL_NOTIFY_APP,null,o)){
this.startAlert();
t=true
}
if(!f&&appCtxt.get(ZmSetting.MAIL_NOTIFY_SOUNDS,null,o)){
ZmSoundAlert.getInstance().start();
f=true
}
if(!r&&appCtxt.get(ZmSetting.MAIL_NOTIFY_BROWSER,null,o)){
ZmBrowserAlert.getInstance().start(ZmMsg.newMessage);
r=true
}
if(appCtxt.get(ZmSetting.MAIL_NOTIFY_TOASTER,null,o)&&l<5){
var a=appCtxt.getById(b.id)||ZmMailMsg.createFromDom(b,{}
);
var s=(a.subject)?([a.subject," - ",(a.fragment||"")].join("")):(a.fragment||"");
var d=a.getAddress(AjxEmailAddress.FROM);
var h=(d&&d instanceof AjxEmailAddress)?d.getName()||d.getAddress():(d&&typeof d=="string")?d:ZmMsg.unknown;
var y=(appCtxt.accountList.size()>1)?AjxMessageFormat.format(ZmMsg.newMailWithAccount,[h,o.getDisplayName()]):AjxMessageFormat.format(ZmMsg.newMail,h);
ZmDesktopAlert.getInstance().start(y,s);
l++
}}}};
ZmMailApp.prototype._checkList=function(r,n,o,c){
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: handling mail creates for view "+o._currentView);
if(!(n&&n instanceof ZmMailList)){
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: list is not a ZmMailList: "+n);
return
}
var a={};
var h={};
if(!(n.search&&n.search.matches)&&(o==this._tradController)){
var s=n.search?n.search.query:"";
AjxDebug.println(AjxDebug.NOTIFY,"ZmMailApp: search not matchable: "+s);
return
}
var l=n.search.sortBy;
var e=this._checkType(r,ZmItem.CONV,a,n,l,null,c);
var t=this._checkType(r,ZmItem.MSG,h,n,l,a,c);
if(e.gotMail||t.gotMail){
n.notifyCreate(a,h)
}
if(e.hasMore||t.hasMore){
var o=this._getCurrentViewController();
if(o){
o.setHasMore(true)
}}};
ZmMailApp.prototype._getCurrentViewController=function(){
var t;
var e=appCtxt.getAppViewMgr().getCurrentViewId();
if(e==ZmId.VIEW_CONVLIST){
t=this.getConvListController()
}else{
if(e==ZmId.VIEW_TRAD){
t=this.getTradController()
}}
return t
};
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().getReferenceView().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,{}
,true)
}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(t,e){
if(!t.m&&!t.c){
return
}
if(!e&&!this._noDefer&&this._deferNotifications("modify",t)){
return
}
this._batchNotify(t.m);
this._batchNotify(t.c)
};
ZmMailApp.prototype.postNotify=function(e){
var t=this._checkReplenishListView;
if(t&&!t._isPageless){
t._checkReplenish();
this._checkReplenishListView=null
}};
ZmMailApp.prototype.refresh=function(r){
var s=appCtxt.getById(ZmFolder.ID_INBOX);
if(s){
this.setNewMailNotice(s)
}
if(!appCtxt.inStartup){
this.resetOverview(this.getOverviewId());
var n=[ZmId.VIEW_TRAD,ZmId.VIEW_CONVLIST,ZmId.VIEW_CONV];
var d=appCtxt.getAppViewMgr()._views;
for(var a=0;
a<n.length;
a++){
var c=d[n[a]];
var h=c&&c[ZmAppViewMgr.C_APP_CONTENT];
if(h){
h.isStale=true
}}
var o=appCtxt.getCurrentViewId();
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._checkRefresh,[o]),1000)
}
if(appCtxt.get(ZmSetting.MAIL_ATTACH_VIEW_ENABLED)){
var e=appCtxt.getFolderTree();
if(!e.getById(ZmFolder.ID_ATTACHMENTS)){
var l=appCtxt.getById(ZmOrganizer.ID_ROOT);
var t={
id:ZmFolder.ID_ATTACHMENTS,parent:l,tree:l.tree,type:ZmOrganizer.FOLDER,numTotal:1};
var u=new ZmFolder(t);
l.children.add(u);
u._notify(ZmEvent.E_CREATE)
}}};
ZmMailApp.prototype._checkRefresh=function(t){
if(appCtxt.getCurrentViewId()==t){
var e=appCtxt.getCurrentView();
if(e&&e.isStale&&e._staleHandler){
e._staleHandler()
}}};
ZmMailApp.prototype.handleOp=function(n,o){
var t=false;
var a=true;
switch(n){
case ZmOperation.NEW_MESSAGE_WIN:t=true;
a=false;
case ZmOperation.NEW_MESSAGE:if(!t){
t=this._inNewWindow(o&&o.ev);
a=false
}
var e=new AjxCallback(this,this.compose,{
action:ZmOperation.NEW_MESSAGE,inNewWindow:t}
);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,a);
break
}};
ZmMailApp.prototype.getOverviewPanelContent=function(){
var t=!this._overviewPanelContent;
var e=ZmApp.prototype.getOverviewPanelContent.apply(this,arguments);
if(t){
appCtxt.getSearchController().updateOverview()
}
return e
};
ZmMailApp.prototype.getOverviewContainer=function(){
var t=!this._overviewContainer;
var e=ZmApp.prototype.getOverviewContainer.apply(this,arguments);
if(t&&!appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)){
appCtxt.getSearchController().updateOverview()
}
return e
};
ZmMailApp.prototype.launch=function(s,h){
this._setLaunchTime(this.toString(),new Date());
this._groupBy=appCtxt.get(ZmSetting.GROUP_MAIL_BY);
var o;
s=s||{};
if(s.qsParams){
var e=s.qsParams.view,r=s.qsParams.id;
if(e=="compose"){
this._showComposeView(h);
return
}else{
if(r){
e=e||"msg";
if(e=="list"){
o=["item:",r].join("");
s.searchResponse=null;
this._forceMsgView=true
}else{
if(e=="msg"){
var a=new ZmMailList(ZmItem.MSG);
var n=new ZmMailMsg(r,a,true);
a.add(n);
var t={
getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML),markRead:(appCtxt.get(ZmSetting.MARK_MSG_READ)==ZmSetting.MARK_READ_NOW),callback:new AjxCallback(this,this._handleResponseMsgLoad,[n,h]),errorCallback:new AjxCallback(this,this._handleErrorMsgLoad,h)};
n.load(t);
return
}}}}}
this.mailSearch(o,h,s.searchResponse)
};
ZmMailApp.prototype._handleErrorLaunch=function(t,e){
if(e.code==ZmCsfeException.MAIL_NO_SUCH_FOLDER||e.code==ZmCsfeException.MAIL_NO_SUCH_TAG||e.code==ZmCsfeException.MAIL_QUERY_PARSE_ERROR){
var a={
query:"in:inbox",callback:t.callback,errorCallback:null,types:t.types};
appCtxt.getSearchController().search(a)
}};
ZmMailApp.prototype._handleErrorMsgLoad=function(t,e){
this.mailSearch();
if(t){
t.run()
}
this._notifyRendered();
return false
};
ZmMailApp.prototype._handleResponseMsgLoad=function(t,a){
AjxDispatcher.require("Startup2");
var e=AjxDispatcher.run("GetMsgController");
if(e){
e.show(t);
if(a){
a.run()
}
this._notifyRendered();
appCtxt.notifyZimlets("onMsgView",[t,null,appCtxt.getCurrentView()],{
waitUntilLoaded:true}
)
}};
ZmMailApp.prototype.mailSearch=function(r,l,a,h){
var n=appCtxt.isOffline&&appCtxt.inStartup&&appCtxt.accountList.defaultAccount;
if(n){
appCtxt.accountList.setActiveAccount(n)
}
var s=appCtxt.getSearchController();
var c,e;
if(appCtxt.get(ZmSetting.OFFLINE_SHOW_ALL_MAILBOXES)&&appCtxt.accountList.size()>2){
r=null;
c=appCtxt.accountList.generateQuery(ZmOrganizer.ID_INBOX);
e=true;
s.searchAllAccounts=true
}else{
r=r||appCtxt.get(ZmSetting.INITIAL_SEARCH,null,n)
}
var o=new AjxVector();
o.add(h||this.getGroupMailBy());
var t={
searchFor:ZmId.SEARCH_MAIL,query:r,queryHint:c,types:o,limit:this.getLimit(),getHtml:appCtxt.get(ZmSetting.VIEW_AS_HTML,null,n),noUpdateOverview:e,accountName:(n&&n.name),callback:l,response:a};
t.errorCallback=new AjxCallback(this,this._handleErrorLaunch,t);
s.search(t)
};
ZmMailApp.prototype.getSearchParams=function(e){
e=e||{};
if(!appCtxt.inStartup&&(appCtxt.get(ZmSetting.READING_PANE_LOCATION)!=ZmSetting.RP_OFF)){
e.fetch=true
}
AjxDispatcher.require("MailCore");
e.headers=ZmMailMsg.requestHeaders;
return e
};
ZmMailApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require("MailCore",false,e,null,true)
};
ZmMailApp.prototype._handleLoadShowSearchResults=function(t,a){
var e=(t.type==ZmItem.MSG)?this.getTradController():this.getConvListController();
e.show(t);
this._setLoadedTime(this.toString(),new Date());
if(this._forceMsgView){
e.selectFirstItem();
this._forceMsgView=false
}
if(a){
a.run()
}
this._notifyRendered()
};
ZmMailApp.prototype._parseComposeUrl=function(t){
t=t||"";
var o=t.match(/to=([^&]+)/);
var r=o?AjxStringUtil.urlComponentDecode(o[1]):null;
o=t.match(/subject=([^&]+)/);
var n=o?(AjxStringUtil.urlComponentDecode(o[1]).replace(/+/g," ")):null;
o=t.match(/cc=([^&]+)/);
var s=o?AjxStringUtil.urlComponentDecode(o[1]):null;
o=t.match(/bcc=([^&]+)/);
var a=o?AjxStringUtil.urlComponentDecode(o[1]):null;
o=t.match(/body=([^&]+)/);
var e=o?(AjxStringUtil.urlComponentDecode(o[1]).replace(/+/g," ")):null;
return{
to:AjxStringUtil.htmlEncode(r),subject:AjxStringUtil.htmlEncode(n),cc:AjxStringUtil.htmlEncode(s),bcc:AjxStringUtil.htmlEncode(a),body:AjxStringUtil.htmlEncode(e)}
};
ZmMailApp.prototype._showComposeView=function(r,a){
var o=a||location.search;
AjxDispatcher.require("Startup2");
var l=AjxDispatcher.run("GetComposeController");
var e=this._parseComposeUrl(o);
var s=e.to;
if(s&&s.indexOf("mailto")==0){
s=s.replace(/mailto:/,"");
var n=s.split("?");
e.to=n[0];
if(n.length>1){
n=n[1];
var h=this._parseComposeUrl(n);
e.to=e.to?(h.to?[e.to,","+h.to].join(""):e.to):h.to;
e.subject=h.subject||e.subject;
e.cc=h.cc||e.cc;
e.bcc=h.bcc||e.bcc;
e.body=h.body||e.body
}}
var t={
action:ZmOperation.NEW_MESSAGE,toOverride:e.to,ccOverride:e.cc,bccOverride:e.bcc,subjOverride:e.subject,extraBodyText:e.body,callback:r};
if(appCtxt.isOffline&&appCtxt.get(ZmSetting.OFFLINE_SUPPORTS_MAILTO)&&appCtxt.getCurrentViewId()==ZmId.VIEW_COMPOSE){
l.resetComposeForMailto(t)
}else{
l.doAction(t)
}
this._notifyRendered();
return l
};
ZmMailApp.prototype.getConvListController=function(){
if(!this._convListController){
this._convListController=new ZmConvListController(this._container,this)
}
return this._convListController
};
ZmMailApp.prototype.getConvController=function(){
if(!this._convController){
this._convController=new ZmConvController(this._container,this)
}
return this._convController
};
ZmMailApp.prototype.getTradController=function(){
if(!this._tradController){
this._tradController=new ZmTradController(this._container,this)
}
return this._tradController
};
ZmMailApp.prototype.getMsgController=function(a){
var t=this._sessionController[ZmId.VIEW_MSG];
var e;
for(var o in t){
if(t[o].getMsg()&&t[o].getMsg().nId==a){
e=t[o];
break
}}
if(e){
a=e.sessionId;
this._curSessionId[ZmId.VIEW_MSG]=a;
e.inactive=false;
return e
}
return this.getSessionController(ZmId.VIEW_MSG,"ZmMsgController",a)
};
ZmMailApp.prototype.getComposeController=function(e){
return this.getSessionController(ZmId.VIEW_COMPOSE,"ZmComposeController",e)
};
ZmMailApp.prototype.getCurrentSessionId=function(e){
return this._curSessionId[e]
};
ZmMailApp.prototype.getConfirmController=function(e){
return this.getSessionController(ZmId.VIEW_MAIL_CONFIRM,"ZmMailConfirmController",e)
};
ZmMailApp.prototype.getMailListController=function(){
var e=appCtxt.get(ZmSetting.GROUP_MAIL_BY);
return(e==ZmSetting.GROUP_BY_CONV)?AjxDispatcher.run("GetConvListController"):AjxDispatcher.run("GetTradController")
};
ZmMailApp.prototype.getAttachmentsController=function(){
if(!this._attachmentsController){
this._attachmentsController=new ZmAttachmentsController(this._container,this)
}
return this._attachmentsController
};
ZmMailApp.prototype.compose=function(o){
var a=this._sessionController[ZmId.VIEW_COMPOSE];
var e;
var t=o.msg&&o.msg.nId;
for(var n in a){
if(a[n].getMsg()&&a[n].getMsg().nId==t){
e=a[n];
break
}}
if(!e){
e=AjxDispatcher.run("GetComposeController")
}
appCtxt.composeCtlrSessionId=e.sessionId;
e.doAction(o)
};
ZmMailApp.prototype.setNewMailNotice=function(e){
var a=appCtxt.getAppChooser();
if(a){
var o=a.getButton(ZmApp.MAIL);
var t=(e.numUnread>0)?"EnvelopeOpen":"MailApp";
o.setImage(t)
}
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.getGroupMailBy=function(){
var e=this._groupBy||appCtxt.get(ZmSetting.GROUP_MAIL_BY);
return e?ZmMailApp.GROUP_MAIL_BY_ITEM[e]:ZmItem.MSG
};
ZmMailApp.prototype.setGroupMailBy=function(e){
this._groupBy=e;
appCtxt.set(ZmSetting.GROUP_MAIL_BY,e)
};
ZmMailApp.prototype.getLimit=function(t){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
};
ZmMailApp.addReplyMenu=function(e){
var t=[ZmOperation.REPLY,ZmOperation.REPLY_ALL];
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmMailApp.addForwardMenu=function(e){
var t=[ZmOperation.FORWARD_INLINE,ZmOperation.FORWARD_ATT];
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmMailApp.prototype.getDataSourceCollection=function(t){
var a=window.parentAppCtxt||window.appCtxt;
var e=t?t.name:a.getActiveAccount().name;
if(!this._dataSourceCollection[e]){
this._dataSourceCollection[e]=new ZmDataSourceCollection();
if(a.getActiveAccount().isMain){
this._dataSourceCollection[e].initialize(a.getSettings().getInfoResponse.dataSources)
}}
return this._dataSourceCollection[e]
};
ZmMailApp.prototype.getIdentityCollection=function(o){
if(appCtxt.isChildWindow){
if(!this._identityCollection){
this._identityCollection=new ZmIdentityCollection()
}
return this._identityCollection
}
var t=o?o.name:appCtxt.getActiveAccount().name;
if(!this._identityCollection[t]){
var e=this._identityCollection[t]=new ZmIdentityCollection();
var a=appCtxt.getSettings(o);
if(a){
e.initialize(a.getInfoResponse.identities)
}}
return this._identityCollection[t]
};
ZmMailApp.prototype.getSignatureCollection=function(a){
var o=window.parentAppCtxt||window.appCtxt;
a=a||o.getActiveAccount();
var e=a.name;
var t=o.getSettings(a);
if(!this._signatureCollection[e]&&t){
var n=this._signatureCollection[e]=new ZmSignatureCollection();
n.initialize(t.getInfoResponse.signatures)
}
return this._signatureCollection[e]
};
ZmMailApp.prototype._addSettingsChangeListeners=function(){
ZmApp.prototype._addSettingsChangeListeners.call(this);
if(!this._settingsListener){
this._settingsListener=new AjxListener(this,this._settingsChangeListener)
}
var e=appCtxt.getSettings();
e.getSetting(ZmSetting.VIEW_AS_HTML).addChangeListener(this._settingListener);
e.getSetting(ZmSetting.TRUSTED_ADDR_LIST).addChangeListener(this._settingListener);
e.addChangeListener(this._settingsListener)
};
ZmMailApp.prototype._settingChangeListener=function(a){
ZmApp.prototype._settingChangeListener.call(this,a);
if(a.type!=ZmEvent.S_SETTING){
return
}
var t=a.source;
var n=this.getMailListController();
if(n&&(t.id==ZmSetting.VIEW_AS_HTML||t.id==ZmSetting.TRUSTED_ADDR_LIST)){
this.resetTrustedSendersList();
var e=n._doublePaneView;
var o=e?e.getMsg():null;
if(o){
e.reset();
e.setMsg(o)
}}};
ZmMailApp.prototype._settingsChangeListener=function(n){
if(n.type!=ZmEvent.S_SETTINGS){
return
}
var s=n.getDetail("settings");
if(!(s&&s.length)){
return
}
var h=this.getMailListController();
if(!h){
return
}
var e=h._currentView;
var r,o;
for(var t=0;
t<s.length;
t++){
var a=s[t];
if(a.id==ZmSetting.SHOW_FRAGMENTS){
if(e!=ZmId.VIEW_MSG){
r=o||e
}}}
r=o||r;
if(r){
h.switchView(r,true)
}};
ZmMailApp.prototype.getTrustedSendersList=function(){
if(!this._trustedList){
var e=appCtxt.get(ZmSetting.TRUSTED_ADDR_LIST);
if(e){
this._trustedList=AjxVector.fromArray(e)
}else{
this._trustedList=new AjxVector()
}}
return this._trustedList
};
ZmMailApp.prototype.resetTrustedSendersList=function(){
this._trustedList=null
}
}
if(AjxPackage.define("zimbraMail.calendar.ZmCalendarApp")){
ZmCalendarApp=function(e){
ZmApp.call(this,ZmApp.CALENDAR,e);
this._addSettingsChangeListeners();
this._resByName={};
this._resByEmail={}
};
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_SCHEDULE]=ZmId.VIEW_CAL_SCHEDULE;
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:N1700,2:Y1700,3:Y1700,4:Y1700,5:Y1700,6:Y1700,7:N1700";
ZmCalendarApp.prototype=new ZmApp;
ZmCalendarApp.prototype.constructor=ZmCalendarApp;
ZmCalendarApp.prototype.toString=function(){
return"ZmCalendarApp"
};
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","CalendarCore",new AjxCallback(this,this.getCalController));
AjxDispatcher.registerMethod("GetReminderController","CalendarCore",new AjxCallback(this,this.getReminderController));
AjxDispatcher.registerMethod("ShowMiniCalendar","CalendarCore",new AjxCallback(this,this.showMiniCalendar));
AjxDispatcher.registerMethod("GetApptComposeController",["CalendarCore","Calendar","CalendarAppt"],new AjxCallback(this,this.getApptComposeController))
};
ZmCalendarApp.prototype._registerSettings=function(e){
var e=e||appCtxt.getSettings();
e.registerSetting("CAL_ALWAYS_SHOW_MINI_CAL",{
name:"zimbraPrefCalendarAlwaysShowMiniCal",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_APPT_VISIBILITY",{
name:"zimbraPrefCalendarApptVisibility",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"public",isGlobal:true}
);
e.registerSetting("CAL_EMAIL_REMINDERS_ADDRESS",{
name:"zimbraPrefCalendarReminderEmail",type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_DEVICE_EMAIL_REMINDERS_ADDRESS",{
name:"zimbraCalendarReminderDeviceEmail",type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_DEVICE_EMAIL_REMINDERS_ENABLED",{
name:"zimbraFeatureCalendarReminderDeviceEmailEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("CAL_EXPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("CAL_FIRST_DAY_OF_WEEK",{
name:"zimbraPrefCalendarFirstDayOfWeek",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}
);
e.registerSetting("CAL_FREE_BUSY_ACL",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.ACL_ALL}
);
e.registerSetting("CAL_FREE_BUSY_ACL_USERS",{
type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_IMPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("CAL_INVITE_ACL",{
type:ZmSetting.T_PREF,defaultValue:ZmSetting.ACL_ALL}
);
e.registerSetting("CAL_INVITE_ACL_USERS",{
type:ZmSetting.T_PREF}
);
e.registerSetting("CAL_REMINDER_NOTIFY_SOUNDS",{
name:"zimbraPrefCalendarReminderSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_REMINDER_NOTIFY_BROWSER",{
name:"zimbraPrefCalendarReminderFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_REMINDER_NOTIFY_TOASTER",{
name:"zimbraPrefCalendarToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_REMINDER_WARNING_TIME",{
name:"zimbraPrefCalendarApptReminderWarningTime",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:0,isGlobal:true}
);
e.registerSetting("CAL_SHOW_TIMEZONE",{
name:"zimbraPrefUseTimeZoneListInCalendar",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_USE_QUICK_ADD",{
name:"zimbraPrefCalendarUseQuickAdd",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CALENDAR_INITIAL_VIEW",{
name:"zimbraPrefCalendarInitialView",type:ZmSetting.T_PREF,defaultValue:ZmSetting.CAL_DAY,isGlobal:true}
);
e.registerSetting("CAL_WORKING_HOURS",{
name:"zimbraPrefCalendarWorkingHours",type:ZmSetting.T_PREF,defaultValue:ZmCalendarApp.DEFAULT_WORKING_HOURS,isGlobal:true}
);
e.registerSetting("FREE_BUSY_VIEW_ENABLED",{
name:"zimbraFeatureFreeBusyViewEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("DELETE_INVITE_ON_REPLY",{
name:"zimbraPrefDeleteInviteOnReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("ENABLE_APPL_ICAL_DELEGATION",{
name:"zimbraPrefAppleIcalDelegationEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_AUTO_ADD_INVITES",{
name:"zimbraPrefCalendarAutoAddInvites",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("CAL_SEND_INV_DENIED_REPLY",{
name:"zimbraPrefCalendarSendInviteDeniedAutoReply",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("CAL_INV_FORWARDING_ADDRESS",{
name:"zimbraPrefCalendarForwardInvitesTo",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST,isGlobal:true}
);
e.registerSetting("CAL_SHOW_PAST_DUE_REMINDERS",{
name:"zimbraPrefCalendarShowPastDueReminders",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_SHOW_CALENDAR_WEEK",{
name:"zimbraPrefShowCalendarWeek",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("CAL_APPT_ALLOW_ATTENDEE_EDIT",{
name:"zimbraPrefCalendarApptAllowAtendeeEdit",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_RESOURCE_DBL_BOOKING_ALLOWED",{
name:"zimbraCalendarResourceDoubleBookingAllowed",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_SHOW_RESOURCE_TABS",{
name:"zimbraCalendarShowResourceTabs",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true,isGlobal:true}
);
e.registerSetting("CAL_EXCEPTION_ON_SERIES_TIME_CHANGE",{
name:"zimbraCalendarKeepExceptionsOnSeriesTimeChange",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
)
};
ZmCalendarApp.prototype._registerPrefs=function(){
var t={
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_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],manageDirty:true,createView:function(o,n,a){
AjxDispatcher.require("Alert");
return new ZmCalendarPrefsPage(o,n,a)
}}};
for(var e in t){
ZmPref.registerPrefSection(e,t[e])
}
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}
);
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}
);
ZmPref.registerPref("CAL_REMINDER_WARNING_TIME",{
displayName:ZmMsg.numberOfMinutes,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.apptRemindNever,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore,ZmMsg.apptRemindNMinutesBefore],options:[0,1,5,10,15,30,45,60]}
);
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,ZmMsg.calViewSchedule],options:[ZmSetting.CAL_DAY,ZmSetting.CAL_WORK_WEEK,ZmSetting.CAL_WEEK,ZmSetting.CAL_MONTH,ZmSetting.CAL_LIST,ZmSetting.CAL_SCHEDULE]}
);
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}
);
ZmPref.registerPref("CAL_REMINDER_NOTIFY_TOASTER",{
displayFunc:function(){
AjxDispatcher.require("Alert");
return ZmDesktopAlert.getInstance().getDisplayText()
}
,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}
)
};
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}
);
ZmOperation.registerOp(ZmId.OP_CAL_VIEW_MENU,{
textKey:"view",image:"Appointment"}
,null,AjxCallback.simpleClosure(function(e){
ZmOperation.addDeferredMenu(ZmCalendarApp.addCalViewMenu,e)
}
));
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(e){
ZmOperation.addDeferredMenu(ZmCalendarApp.addInviteReplyMenu,e)
}
));
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_PROPOSE_NEW_TIME,{
textKey:"proposeNewTime",image:"ProposeTime"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT,{
textKey:"replyAccept",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT_NOTIFY,{
textKey:"notifyOrganizerLabel",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_ACCEPT_IGNORE,{
textKey:"dontNotifyOrganizerLabel",image:"Check"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_CANCEL);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE,{
textKey:"replyDecline",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE_NOTIFY,{
textKey:"notifyOrganizerLabel",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_DECLINE_IGNORE,{
textKey:"dontNotifyOrganizerLabel",image:"Cancel"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_MODIFY);
ZmOperation.registerOp(ZmId.OP_REPLY_NEW_TIME,{
textKey:"replyNewTime",image:"NewTime"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE,{
textKey:"replyTentative",image:"QuestionMark"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE_NOTIFY,{
textKey:"notifyOrganizerLabel",image:"QuestionMark"}
);
ZmOperation.registerOp(ZmId.OP_REPLY_TENTATIVE_IGNORE,{
textKey:"dontNotifyOrganizerLabel",image:"QuestionMark"}
);
ZmOperation.registerOp(ZmId.OP_FB_VIEW,{
textKey:"viewFB",tooltipKey:"viewFBTooltip",image:"GroupSchedule",shortcut:ZmKeyMap.CAL_FB_VIEW}
);
ZmOperation.registerOp(ZmId.OP_SCHEDULE_VIEW,{
textKey:"viewSchedule",tooltipKey:"viewScheduleTooltip",image:"GroupSchedule",shortcut:ZmKeyMap.CAL_SCHEDULE_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:"send",image:"MeetingRequest"}
)
};
ZmCalendarApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.APPT,{
app:ZmApp.CALENDAR,nameKey:"appointment",countKey:"typeAppointment",icon:"Appointment",soapCmd:"ItemAction",itemClass:"ZmAppt",node:"appt",organizer:ZmOrganizer.CALENDAR,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.CALENDAR],searchType:"appointment",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("CalendarCore");
return new ZmApptList(ZmItem.APPT,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.RESOURCE,{
app:ZmApp.CALENDAR,itemClass:"ZmResource",node:"calResource",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("CalendarCore");
return new ZmResourceList(null,e)
}
,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,treeType:ZmOrganizer.FOLDER,views:["appointment"],folderKey:"calendar",mountKey:"mountCalendar",createFunc:"ZmCalendar.create",compareFunc:"ZmCalendar.sortCompare",newOp:ZmOperation.NEW_CALENDAR,displayOrder:100,deferrable:true,childWindow:true}
)
};
ZmCalendarApp.prototype._setupSearchToolbar=function(){
var e={
msgKey:"appointments",tooltipKey:"searchAppts",icon:"Appointment",shareIcon:"SharedCalendarFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_APPOINTMENT)};
if(!appCtxt.isOffline){
e.setting=ZmSetting.CALENDAR_ENABLED
}
ZmSearchToolBar.addMenuItem(ZmItem.APPT,e)
};
ZmCalendarApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_APPT]="appointment";
var t={};
t[ZmOperation.NEW_CALENDAR]="calendar";
var e={};
e[ZmKeyMap.NEW_APPT]=ZmOperation.NEW_APPT;
e[ZmKeyMap.NEW_CALENDAR]=ZmOperation.NEW_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],assistants:{
ZmAppointmentAssistant:["CalendarCore","Calendar","CalendarAppt"],ZmCalendarAssistant:["CalendarCore","Calendar","CalendarAppt"]}
,newItemOps:a,newOrgOps:t,actionCodes:e,searchTypes:[ZmItem.APPT],gotoActionCode:ZmKeyMap.GOTO_CALENDAR,newActionCode:ZmKeyMap.NEW_APPT,chooserSort:30,defaultSort:20,upsellUrl:ZmSetting.CALENDAR_UPSELL_URL}
)
};
ZmCalendarApp.prototype.startup=function(e){};
ZmCalendarApp.prototype.refresh=function(e){
if(!appCtxt.inStartup){
AjxDispatcher.run("GetCalController").refreshHandler(e)
}};
ZmCalendarApp.prototype.deleteNotify=function(e,t){
if(!t&&this._deferNotifications("delete",e)){
return
}
AjxDispatcher.run("GetCalController").notifyDelete(e)
};
ZmCalendarApp.prototype.createNotify=function(o,s){
if(!o.folder&&!o.appt&&!o.link){
return
}
if(!s&&!this._noDefer&&this._deferNotifications("create",o)){
return
}
for(var e in o){
var n=o[e];
for(var a=0;
a<n.length;
a++){
var t=n[a];
if(appCtxt.cacheGet(t.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(t,ZmOrganizer.CALENDAR)
}else{
if(e=="link"){
this._handleCreateLink(t,ZmOrganizer.CALENDAR)
}else{
if(e=="appt"){
AjxDispatcher.run("GetCalController").notifyCreate(t)
}}}
if((e=="folder"||e=="link")&&this._calController){
this._calController._updateCheckedCalendars()
}}}};
ZmCalendarApp.prototype.modifyNotify=function(t,e){
if(!e&&!this._noDefer&&this._deferNotifications("modify",t)){
return
}
AjxDispatcher.run("GetCalController").notifyModify(t)
};
ZmCalendarApp.prototype.preNotify=function(e){
if(this._calController!=null){
this._calController.preNotify(e)
}};
ZmCalendarApp.prototype.postNotify=function(e){
if(this._calController!=null){
this._calController.postNotify(e)
}};
ZmCalendarApp.prototype.handleOp=function(t){
switch(t){
case ZmOperation.NEW_APPT:var e=new AjxCallback(this,this._handleLoadNewAppt);
AjxDispatcher.require(["CalendarCore","Calendar"],false,e,null,true);
break;
case ZmOperation.NEW_CALENDAR:var e=new AjxCallback(this,this._handleLoadNewCalendar);
AjxDispatcher.require(["CalendarCore","Calendar"],false,e,null,true);
break
}};
ZmCalendarApp.prototype._handleLoadNewAppt=function(){
AjxDispatcher.run("GetCalController").newAppointment(null,null,null,null)
};
ZmCalendarApp.prototype._handleLoadNewCalendar=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewCalendarDialog();
if(!this._newCalendarCb){
this._newCalendarCb=new AjxCallback(this,this._newCalendarCallback)
}
ZmController.showDialog(e,this._newCalendarCb)
};
ZmCalendarApp.prototype.launch=function(t,a){
this._setLaunchTime(this.toString(),new Date());
var e=new AjxCallback(this,this._handleLoadLaunch,[t,a]);
AjxDispatcher.require(["CalendarCore","Calendar"],true,e,null,true)
};
ZmCalendarApp.prototype._handleLoadLaunch=function(s,h){
var r=AjxDispatcher.run("GetCalController");
var t=r._defaultView();
var n=null;
s=s||{};
if(s.qsParams){
var o=s.qsParams.view;
if(o){
var e=ZmCalendarApp.VIEW_FOR_SETTING[o];
if(e){
t=e;
var a=s.qsParams.date;
if(a){
a=AjxDateUtil.parseServerDateTime(a);
if(a&&!isNaN(a)){
n=new Date((a).setHours(0,0,0,0))
}}}}}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
this.initResources()
}
r.show(t,n);
this._setLoadedTime(this.toString(),new Date());
if(h){
h.run()
}};
ZmCalendarApp.prototype.showSearchResults=function(e,t){
if(t){
t.run()
}};
ZmCalendarApp.prototype.activate=function(t){
this._createDeferredFolders(ZmApp.CALENDAR);
ZmApp.prototype.activate.apply(this,arguments);
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){
var e=t||appCtxt.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL);
AjxDispatcher.run("ShowMiniCalendar",e)
}};
ZmCalendarApp.prototype.setOverviewPanelContent=function(a){
var e=appCtxt.getCurrentViewId();
if(e.indexOf(ZmId.VIEW_APPOINTMENT)!=0){
ZmApp.prototype.setOverviewPanelContent.apply(this,arguments)
}else{
ZmApp.prototype.setOverviewPanelContent.apply(this,arguments);
var t=appCtxt.getCurrentView().getController();
t.setSchedulerPanelContent()
}};
ZmCalendarApp.prototype.showMiniCalendar=function(e,t){
var a=AjxDispatcher.run("GetCalController").getMiniCalendar(t);
a.setSkipNotifyOnPage(e&&!this._active);
if(!this._active){
a.setSelectionMode(DwtCalendar.DAY)
}
appCtxt.getAppViewMgr().showTreeFooter(e)
};
ZmCalendarApp.prototype.getListController=function(){
return this.getCalController()
};
ZmCalendarApp.prototype.getCalController=function(){
if(!this._calController){
AjxDispatcher.require("CalendarCore");
this._calController=new ZmCalViewController(this._container,this)
}
return this._calController
};
ZmCalendarApp.prototype.getFreeBusyCache=function(){
if(!this._freeBusyCache){
AjxDispatcher.require("CalendarCore");
this._freeBusyCache=new ZmFreeBusyCache(this)
}
return this._freeBusyCache
};
ZmCalendarApp.prototype.getReminderController=function(){
if(!this._reminderController){
AjxDispatcher.require("CalendarCore");
var e=appCtxt.getCalManager();
this._reminderController=e.getReminderController();
this._reminderController._calController=this.getCalController()
}
return this._reminderController
};
ZmCalendarApp.prototype.getApptComposeController=function(e){
AjxDispatcher.require(["CalendarCore","Calendar","CalendarAppt"]);
return this.getSessionController(ZmId.VIEW_APPOINTMENT,"ZmApptComposeController",e)
};
ZmCalendarApp.prototype.getSimpleApptComposeController=function(){
AjxDispatcher.require(["CalendarCore","Calendar","CalendarAppt"]);
return this.getSessionController(ZmId.VIEW_SIMPLE_ADD_APPOINTMENT,"ZmSimpleApptComposeController")
};
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 e=new ZmBatchCommand();
if(!this._locations.isLoaded){
e.add(new AjxCallback(this._locations,this._locations.load))
}
if(!this._equipment.isLoaded){
e.add(new AjxCallback(this._equipment,this._equipment.load))
}
if(e._cmds.length){
e.run()
}}};
ZmCalendarApp.prototype.getLocations=function(){
this.initResources();
return this._locations
};
ZmCalendarApp.prototype.getEquipment=function(){
this.initResources();
return this._equipment
};
ZmCalendarApp.prototype.getCheckedCalendarFolderIds=function(e,a){
var s=[];
if(AjxDispatcher.loaded("CalendarCore")){
s=this.getCalController().getCheckedCalendarFolderIds(e,a)
}else{
this._folderNames={};
for(var t=0;
t<this._deferredFolders.length;
t++){
var n=this._deferredFolders[t];
var o=(n&&n.obj&&n.obj.f)?n.obj.f:"";
if(o&&(o.indexOf(ZmOrganizer.FLAG_CHECKED)!=-1)){
if(e&&n.obj.zid!=null){
continue
}
if(n.obj.id==ZmOrganizer.ID_TRASH&&!a){
continue
}
s.push(n.obj.id);
this._folderNames[n.obj.id]=n.obj.name
}}}
return s
};
ZmCalendarApp.prototype.getCalendarName=function(e){
return appCtxt.getById(e)?appCtxt.getById(e).name:this._folderNames[e]
};
ZmCalendarApp.createMiniCalButton=function(c,s,n,t){
var h=new DwtButton({
parent:c}
);
h.addDropDownSelectionListener(n);
h.addSelectionListener(n);
h.setDropDownHovImage(null);
h.setData(Dwt.KEY_ID,s);
if(AjxEnv.isIE){
h.setSize("20")
}
var r=new DwtMenu({
parent:h,style:DwtMenu.CALENDAR_PICKER_STYLE}
);
r.setSize("150");
r._table.width="100%";
h.setMenu(r,true);
var e=new DwtCalendar({
parent:r}
);
e.setData(Dwt.KEY_ID,s);
e.setSkipNotifyOnPage(true);
var o=appCtxt.get(ZmSetting.CAL_FIRST_DAY_OF_WEEK)||0;
e.setFirstDayOfWeek(o);
e.addSelectionListener(t);
var l=appCtxt.getSettings().getSetting(ZmSetting.CAL_FIRST_DAY_OF_WEEK);
if(l){
var a=new AjxListener(null,ZmCalendarApp._settingChangeListener,e);
l.addChangeListener(a)
}
h.reparentHtmlElement(s);
delete s;
return h
};
ZmCalendarApp.createReminderButton=function(c,r,u,n){
var h=new DwtButton({
parent:c}
);
h.addDropDownSelectionListener(u);
h.setData(Dwt.KEY_ID,r);
if(AjxEnv.isIE){
h.setSize("20")
}
var l=new DwtMenu({
parent:h,style:DwtMenu.DROPDOWN_STYLE}
);
l.setSize("150");
h.setMenu(l,true);
var t=[ZmMsg.apptRemindNever,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];
var m=[0,1,5,10,15,30,45,60,120,180,240,300,1080,1440,2880,4320,5760,10080,20160];
var o=[0,1,5,10,15,30,45,60,2,3,4,5,18,1,2,3,4,1,2];
var s=appCtxt.get(ZmSetting.CAL_REMINDER_WARNING_TIME);
for(var e=0;
e<m.length;
e++){
var d=ZmCalendarApp.__formatLabel(t[e],o[e]);
var a=new DwtMenuItem({
parent:l,style:DwtMenuItem.NO_STYLE}
);
a.setText(d);
a.setData("value",m[e]);
if(n){
a.addSelectionListener(n)
}}
h.reparentHtmlElement(r);
delete r;
return h
};
ZmCalendarApp.getReminderSummary=function(e){
var o=((e%60)==0);
var a=((e%(60*24))==0);
var t=((e%(60*24*7))==0);
if(e==0){
return ZmMsg.apptRemindNever
}
if(t){
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNWeeksBefore,e/(60*24*7))
}
if(a){
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNDaysBefore,e/(60*24))
}
if(o){
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNHoursBefore,e/60)
}
return ZmCalendarApp.__formatLabel(ZmMsg.apptRemindNMinutesBefore,e)
};
ZmCalendarApp._settingChangeListener=function(a,t){
if(t.type!=ZmEvent.S_SETTING){
return
}
var e=t.source;
if(e.id==ZmSetting.CAL_FIRST_DAY_OF_WEEK){
a.setFirstDayOfWeek(e.getValue())
}};
ZmCalendarApp.prototype._newCalendarCallback=function(s,o,t,a,r){
var n=appCtxt.getNewCalendarDialog();
n.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.CALENDAR)._doCreate(s,o,t,a,r)
};
ZmCalendarApp.addInviteReplyMenu=function(e){
var t=[ZmOperation.EDIT_REPLY_ACCEPT,ZmOperation.EDIT_REPLY_TENTATIVE,ZmOperation.EDIT_REPLY_DECLINE];
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmCalendarApp.addCalViewMenu=function(e){
var t=[ZmOperation.DAY_VIEW,ZmOperation.WORK_WEEK_VIEW,ZmOperation.WEEK_VIEW,ZmOperation.MONTH_VIEW,ZmOperation.CAL_LIST_VIEW,ZmOperation.SCHEDULE_VIEW];
if(appCtxt.get(ZmSetting.FREE_BUSY_VIEW_ENABLED)){
t.push(ZmOperation.FB_VIEW)
}
var a=new ZmActionMenu({
parent:e,menuItems:t}
);
e.setMenu(a);
return a
};
ZmCalendarApp.__formatLabel=function(t,e){
t=t||"";
return t.match(/{/)?AjxMessageFormat.format(t,e):t
};
ZmCalendarApp.parseReminderString=function(c){
var h={};
h[ZmMsg.apptRemindNDaysBefore]=ZmCalItem.REMINDER_UNIT_DAYS;
h[ZmMsg.apptRemindNMinutesBefore]=ZmCalItem.REMINDER_UNIT_MINUTES;
h[ZmMsg.apptRemindNHoursBefore]=ZmCalItem.REMINDER_UNIT_HOURS;
h[ZmMsg.apptRemindNWeeksBefore]=ZmCalItem.REMINDER_UNIT_WEEKS;
c=AjxStringUtil.trim(c);
var l=c;
var s=l.replace(/D/g,"");
s=AjxStringUtil.trim(s);
if(s==""){
return{
reminderValue:"",reminderUnits:ZmCalItem.REMINDER_NONE}
}
if(s.indexOf(" ")>=0){
s=s.split(" ")[0]
}
for(var r in h){
var e=ZmCalendarApp.__formatLabel(r,s);
if(e!=""&&e.toLowerCase()==c.toLowerCase()){
return{
reminderValue:s,reminderUnits:h[r]}
}}
var n=parseInt(s);
var a={};
a[ZmCalItem.REMINDER_UNIT_MINUTES]=AjxMsg.minute;
a[ZmCalItem.REMINDER_UNIT_HOURS]=AjxMsg.hour;
a[ZmCalItem.REMINDER_UNIT_DAYS]=AjxMsg.day;
a[ZmCalItem.REMINDER_UNIT_WEEKS]=AjxMsg.week;
var t=ZmCalItem.REMINDER_UNIT_HOURS;
for(var o in a){
if(l.indexOf(a[o])>=0){
t=o;
break
}}
return{
reminderValue:n?n:0,reminderUnits:t}
};
ZmCalendarApp.convertReminderUnits=function(e,t){
switch(t){
case ZmCalItem.REMINDER_UNIT_MINUTES:return e;
case ZmCalItem.REMINDER_UNIT_HOURS:return e*60;
case ZmCalItem.REMINDER_UNIT_DAYS:return e*60*24;
case ZmCalItem.REMINDER_UNIT_WEEKS:return e*60*24*7;
default:return 0
}};
ZmCalendarApp.prototype.updateResourceCache=function(a){
var t=a.getFullName();
if(t){
this._resByName[t.toLowerCase()]=a
}
var e=a.getEmail();
if(e){
this._resByEmail[e.toLowerCase()]=a
}};
ZmCalendarApp.prototype._addSettingsChangeListeners=function(){
ZmApp.prototype._addSettingsChangeListeners.call(this);
if(!this._settingsListener){
this._settingsListener=new AjxListener(this,this._settingsChangeListener)
}
var t=appCtxt.getSettings();
var e=t.getSetting(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL);
if(e){
e.addChangeListener(this._settingListener)
}
e=t.getSetting(ZmSetting.CAL_FIRST_DAY_OF_WEEK);
if(e){
e.addChangeListener(this._settingListener)
}
e=t.getSetting(ZmSetting.CAL_WORKING_HOURS);
if(e){
e.addChangeListener(this._settingListener)
}
var t=appCtxt.getSettings();
t.getSetting(ZmSetting.CAL_SHOW_CALENDAR_WEEK).addChangeListener(this._settingListener);
t.addChangeListener(this._settingsListener)
};
ZmCalendarApp.prototype._settingChangeListener=function(n){
if(n.type!=ZmEvent.S_SETTING){
return
}
var o=n.source;
if(o.id==ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL){
if(o.getValue()){
AjxDispatcher.run("ShowMiniCalendar",true)
}else{
if(!this._active){
AjxDispatcher.run("ShowMiniCalendar",false)
}}}else{
if(o.id==ZmSetting.CAL_FIRST_DAY_OF_WEEK){
var e=AjxDispatcher.run("GetCalController");
var s=e.getMiniCalendar();
var t=o.getValue();
s.setFirstDayOfWeek(t);
var a=s.getDate();
e.setDate(a,0,true)
}else{
if(o.id==ZmSetting.CAL_WORKING_HOURS){
var e=AjxDispatcher.run("GetCalController");
var r=e.getViewMgr();
if(r){
r.layoutWorkingHours()
}}}}};
ZmCalendarApp.prototype._settingsChangeListener=function(o){
if(o.type!=ZmEvent.S_SETTINGS){
return
}
var n=o.getDetail("settings");
if(!(n&&n.length)){
return
}
for(var t=0;
t<n.length;
t++){
var a=n[t];
if(a.id==ZmSetting.CAL_SHOW_CALENDAR_WEEK){
var e=AjxDispatcher.run("GetCalController").recreateMiniCalendar();
var s=appCtxt.getCalManager();
s.highlightMiniCal()
}}};
ZmCalendarApp.prototype.showDayView=function(a){
var t=AjxDispatcher.run("GetCalController");
var e=t.getMiniCalendar();
t.setDate(a,0,e.getForceRollOver());
if(!t._viewVisible){
t.show(ZmId.VIEW_CAL_DAY)
}};
ZmCalendarApp.prototype.getDateToolTip=function(e){
var t=AjxDispatcher.run("GetCalController");
return t.getDayToolTipText(e)
};
ZmCalendarApp.prototype.importAppointment=function(o,a,t){
var e=new AjxCallback(this,this._handleImportAppointment,[o,a,t]);
AjxDispatcher.require(["CalendarCore","Calendar"],false,e)
};
ZmCalendarApp.prototype._handleImportAppointment=function(o,a,t){
if(this._deferredFolders.length!=0){
this._createDeferredFolders(ZmApp.CALENDAR)
}
var n=this._copyToDialog=appCtxt.getChooseFolderDialog();
var e=new AjxCallback(this,this._chooserCallback,[o,a,t]);
ZmController.showDialog(n,e,this._getCopyParams(n,o,a))
};
ZmCalendarApp.prototype._getCopyParams=function(a,t,e){
return{
data:{
msgId:t,partId:e}
,treeIds:[ZmOrganizer.CALENDAR],overviewId:a.getOverviewId(this._name),title:ZmMsg.addToCalendar,description:ZmMsg.targetFolder,appName:ZmApp.CALENDAR}
};
ZmCalendarApp.prototype._chooserCallback=function(s,n,t,o){
var h={
ImportAppointmentsRequest:{
_jsns:"urn:zimbraMail"}};
var a=h.ImportAppointmentsRequest;
a.l=o.id;
a.ct="text/calendar";
var e=a.content={};
e.mid=s;
e.part=n;
var r={
jsonObj:h,asyncMode:true,callback:(new AjxCallback(this,this._handleImportApptResponse,[o.id])),errorCallback:(new AjxCallback(this,this._handleImportApptError))};
appCtxt.getAppController().sendRequest(r)
};
ZmCalendarApp.prototype._handleImportApptResponse=function(e,t){
appCtxt.getAppController().setStatusMsg(ZmMsg.addedToCalendar);
appCtxt.getChooseFolderDialog().popdown();
var a=window.parentAppCtxt||window.appCtxt;
if(a.get(ZmSetting.CAL_ALWAYS_SHOW_MINI_CAL)){
var o=a.getCalManager();
o.getMiniCalCache().clearCache();
o.highlightMiniCal()
}};
ZmCalendarApp.prototype._handleImportApptError=function(e){
appCtxt.getAppController().setStatusMsg(ZmMsg.errorImportAppt,ZmStatusView.LEVEL_CRITICAL)
}
}
if(AjxPackage.define("zimbraMail.tasks.ZmTasksApp")){
ZmTasksApp=function(e){
ZmApp.call(this,ZmApp.TASKS,e)
};
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.prototype=new ZmApp;
ZmTasksApp.prototype.constructor=ZmTasksApp;
ZmTasksApp.REMINDER_START_DELAY=10000;
ZmTasksApp.prototype.toString=function(){
return"ZmTasksApp"
};
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(e){
e=e||appCtxt.getSettings();
e.registerSetting("READING_PANE_LOCATION_TASKS",{
name:"zimbraPrefTasksReadingPaneLocation",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmSetting.RP_BOTTOM,isImplicit:true}
)
};
ZmTasksApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.TASK,{
app:ZmApp.TASKS,nameKey:"task",countKey:"typeTask",icon:"TasksApp",soapCmd:"ItemAction",itemClass:"ZmTask",node:"task",organizer:ZmOrganizer.TASKS,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.TASKS],searchType:"task",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("TasksCore");
return new ZmList(ZmItem.TASK,e)
}
,this)}
)
};
ZmTasksApp.prototype._registerOrganizers=function(){
ZmOrganizer.registerOrg(ZmOrganizer.TASKS,{
app:ZmApp.TASKS,nameKey:"taskFolder",defaultFolder:ZmFolder.ID_TASKS,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmTaskFolder",orgPackage:"TasksCore",treeController:"ZmTaskTreeController",labelKey:"tasks",itemsKey:"tasks",folderKey:"tasksFolder",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,views:["task"],createFunc:"ZmOrganizer.create",compareFunc:"ZmTaskFolder.sortCompare",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)}
)
};
ZmTasksApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_TASK]="task";
var t={};
t[ZmOperation.NEW_TASK_FOLDER]="tasksFolder";
var e={};
e[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],assistants:{
ZmTaskAssistant:["TasksCore","Tasks"]}
,newItemOps:a,newOrgOps:t,actionCodes:e,searchTypes:[ZmItem.TASK],gotoActionCode:ZmKeyMap.GOTO_TASKS,newActionCode:ZmKeyMap.NEW_TASK,chooserSort:35,defaultSort:25}
)
};
ZmTasksApp.prototype.postNotify=function(e){
if(this._checkReplenishListView){
this._checkReplenishListView._checkReplenish();
this._checkReplenishListView=null
}};
ZmTasksApp.prototype.handleOp=function(a,t){
switch(a){
case ZmOperation.NEW_TASK:var e=new AjxCallback(this,this._handleLoadNewTask,[t]);
AjxDispatcher.require(["TasksCore","Tasks"],false,e,null,true);
break;
case ZmOperation.NEW_TASK_FOLDER:var e=new AjxCallback(this,this._handleLoadNewTaskFolder);
AjxDispatcher.require(["TasksCore","Tasks"],false,e,null,true);
break
}};
ZmTasksApp.prototype.getDefaultFolderId=function(e){
return ZmOrganizer.ID_TASKS
};
ZmTasksApp.prototype._handleLoadNewTask=function(e){
AjxDispatcher.run("GetTaskController").show((new ZmTask(null,null,e&&e.folderId)))
};
ZmTasksApp.prototype._handleLoadNewTaskFolder=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewTaskFolderDialog();
if(!this._newTaskFolderCb){
this._newTaskFolderCb=new AjxCallback(this,this._newTaskFolderCallback)
}
ZmController.showDialog(e,this._newTaskFolderCb)
};
ZmTasksApp.prototype.createNotify=function(n,r){
if(!n.folder&&!n.task&&!n.link){
return
}
if(!r&&this._deferNotifications("create",n)){
return
}
for(var e in n){
var s=n[e];
if(!s){
continue
}
for(var o=0;
o<s.length;
o++){
var a=s[o];
if(appCtxt.cacheGet(a.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(a,ZmOrganizer.TASKS)
}else{
if(e=="link"){
this._handleCreateLink(a,ZmOrganizer.TASKS)
}else{
if(e=="task"){
var t=this.getTaskListController().getList();
if(t){
t.notifyCreate(a)
}}}}}}};
ZmTasksApp.prototype.launch=function(t,a){
this._setLaunchTime(this.toString(),new Date());
var e=new AjxCallback(this,this._handleLoadLaunch,a);
AjxDispatcher.require(["TasksCore","Tasks"],true,e,null,true)
};
ZmTasksApp.prototype._handleLoadLaunch=function(t){
var e=this._getExternalAccount();
this.search(null,null,null,null,(e&&e.name));
if(t){
t.run()
}};
ZmTasksApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require("Tasks",false,e,null,true)
};
ZmTasksApp.prototype._handleLoadShowSearchResults=function(t,a){
var e=t&&t.search&&t.search.singleTerm&&t.search.folderId;
this.getTaskListController().show(t,e);
this._setLoadedTime(this.toString(),new Date());
if(a){
a.run()
}};
ZmTasksApp.prototype.getListController=function(){
return this.getTaskListController()
};
ZmTasksApp.prototype.getTaskListController=function(){
if(!this._taskListController){
this._taskListController=new ZmTaskListController(this._container,this)
}
return this._taskListController
};
ZmTasksApp.prototype.getTaskController=function(e){
return this.getSessionController(ZmId.VIEW_TASKEDIT,"ZmTaskController",e)
};
ZmTasksApp.prototype.newTaskFromMailItem=function(a,e){
var t=a.subject||"";
if(a instanceof ZmConv){
a=a.getFirstHotMsg()
}
a.load({
getHtml:false,callback:new AjxCallback(this,this._msgLoadedCallback,[a,e,t])}
)
};
ZmTasksApp.prototype._msgLoadedCallback=function(n,e,o){
var a=new ZmTask();
a.setEndDate(AjxDateUtil.roundTimeMins(e,30));
a.setFromMailMessage(n,o);
this.getTaskController().show(a,ZmCalItem.MODE_NEW,true)
};
ZmTasksApp.prototype.search=function(a,e,o,r,t){
var s={
query:(a?a.createQuery():"in:tasks"),types:[ZmItem.TASK],limit:this.getLimit(),searchFor:ZmItem.TASK,callback:r,accountName:(t||(a&&a.getAccount().name))};
var n=appCtxt.getSearchController();
n.searchAllAccounts=false;
n.search(s)
};
ZmTasksApp.prototype._newTaskFolderCallback=function(n,a,t){
var o=appCtxt.getNewTaskFolderDialog();
o.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.TASKS)._doCreate(n,a,t)
};
ZmTasksApp.prototype.getTaskFolderIds=function(e){
var o=[];
if(AjxDispatcher.loaded("TasksCore")){
o=this.getTaskListController().getTaskFolderIds(e)
}else{
this._folderNames={};
for(var t=0;
t<this._deferredFolders.length;
t++){
var a=this._deferredFolders[t];
if(e&&a.obj.zid!=null){
continue
}
o.push(a.obj.id);
this._folderNames[a.obj.id]=a.obj.name
}}
return o
};
ZmTasksApp.prototype.getTaskFolderName=function(e){
return appCtxt.getById(e)?appCtxt.getById(e).name:this._folderNames[e]
};
ZmTasksApp.prototype.getReminderController=function(){
if(!this._reminderController){
AjxDispatcher.require("TasksCore");
var e=appCtxt.getTaskManager();
this._reminderController=e.getReminderController();
this._reminderController._calController=e;
this._reminderController.refresh()
}
return this._reminderController
};
ZmTasksApp.createpCompleteButton=function(r,n,l,o){
var e=new DwtButton({
parent:r}
);
e.addDropDownSelectionListener(l);
e.setData(Dwt.KEY_ID,n);
e.setSize("25");
var s=new DwtMenu({
parent:e,style:DwtMenu.DROPDOWN_STYLE}
);
s.setSize("100");
e.setMenu(s,true);
var h=new AjxMessageFormat(AjxMsg.percentageString);
for(var t=0;
t<=100;
t+=ZmTask.PCOMPLETE_INT){
var a=new DwtMenuItem({
parent:s,style:DwtMenuItem.NO_STYLE}
);
a.setText((h.format(t)));
a.setData("value",t);
if(o){
a.addSelectionListener(o)
}}
e.reparentHtmlElement(n);
delete n;
return e
}
}
if(AjxPackage.define("zimbraMail.abook.ZmContactsApp")){
ZmContactsApp=function(t,e){
ZmApp.call(this,ZmApp.CONTACTS,t,e);
this.contactsLoaded={};
this._contactList={};
this._initialized=false;
this._byEmail={};
this._byIM={};
this._byPhone={};
this._dlCache={}
};
ZmEvent.S_CONTACT=ZmId.ITEM_CONTACT;
ZmEvent.S_GROUP=ZmId.ITEM_GROUP;
ZmItem.CONTACT=ZmEvent.S_CONTACT;
ZmItem.GROUP=ZmEvent.S_GROUP;
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_MAX=50;
ZmContactsApp.prototype=new ZmApp;
ZmContactsApp.prototype.constructor=ZmContactsApp;
ZmContactsApp.prototype.toString=function(){
return"ZmContactsApp"
};
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(e){
var e=e||appCtxt.getSettings();
e.registerSetting("AUTO_ADD_ADDRESS",{
name:"zimbraPrefAutoAddAddressEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isGlobal:true}
);
e.registerSetting("AUTOCOMPLETE_LIMIT",{
name:"zimbraContactAutoCompleteMaxResults",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:20}
);
e.registerSetting("AUTOCOMPLETE_NO_GROUP_MATCH",{
name:"zimbraPrefContactsDisableAutocompleteOnContactGroupMembers",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("AUTOCOMPLETE_ON_COMMA",{
name:"zimbraPrefAutoCompleteQuickCompletionOnComma",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("AUTOCOMPLETE_SHARE",{
name:"zimbraPrefShareContactsInAutoComplete",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("AUTOCOMPLETE_SHARED_ADDR_BOOKS",{
name:"zimbraPrefSharedAddrBookAutoCompleteEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("EXPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("GAL_AUTOCOMPLETE",{
name:"zimbraPrefGalAutoCompleteEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("IMPORT",{
type:ZmSetting.T_PREF,dataType:ZmSetting.D_NONE}
);
e.registerSetting("MAX_CONTACTS",{
name:"zimbraContactMaxNumEntries",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:0}
);
e.registerSetting("NEW_ADDR_BOOK_ENABLED",{
name:"zimbraFeatureNewAddrBookEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("PHONETIC_CONTACT_FIELDS",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:/^ja/.test(AjxEnv.DEFAULT_LOCALE)}
);
e.registerSetting("DETAILED_CONTACT_SEARCH_ENABLED",{
name:"zimbraFeatureContactsDetailedSearchEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
)
};
ZmContactsApp.prototype._registerPrefs=function(){
var t={
CONTACTS:{
title:ZmMsg.addressBook,icon:"ContactsApp",templateId:"prefs.Pages#Contacts",priority:70,precondition:ZmSetting.CONTACTS_ENABLED,prefs:[ZmSetting.AUTO_ADD_ADDRESS,ZmSetting.AUTOCOMPLETE_NO_GROUP_MATCH,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 e in t){
ZmPref.registerPrefSection(e,t[e])
}
ZmPref.registerPref("AUTO_ADD_ADDRESS",{
displayName:ZmMsg.autoAddContacts,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("AUTOCOMPLETE_NO_GROUP_MATCH",{
displayName:ZmMsg.autocompleteNoGroupMatch,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:function(){
return appCtxt.get(ZmSetting.GAL_AUTOCOMPLETE_ENABLED)&&appCtxt.get(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._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_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"}
);
ZmOperation.registerOp(ZmId.OP_SHOW_ONLY_CONTACTS,{
textKey:"showOnlyContacts",image:"Contact"}
,ZmSetting.MIXED_VIEW_ENABLED)
};
ZmContactsApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.CONTACT,{
app:ZmApp.CONTACTS,nameKey:"contact",countKey:"typeContact",icon:"Contact",soapCmd:"ContactAction",itemClass:"ZmContact",node:"cn",organizer:ZmOrganizer.ADDRBOOK,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.ZIMLET,ZmOrganizer.ADDRBOOK],searchType:"contact",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("ContactsCore");
return new ZmContactList(e,e?e.isGalSearch||e.isGalAutocompleteSearch:null)
}
,this)}
);
ZmItem.registerItem(ZmItem.GROUP,{
nameKey:"group",countKey:"typeContactGroup",icon:"Group",soapCmd:"ContactAction"}
)
};
ZmContactsApp.prototype._registerOrganizers=function(){
var e={};
ZmOrganizer.registerOrg(ZmOrganizer.ADDRBOOK,{
app:ZmApp.CONTACTS,nameKey:"addressBook",defaultFolder:ZmOrganizer.ID_ADDRBOOK,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmAddrBook",orgPackage:"ContactsCore",treeController:"ZmAddrBookTreeController",labelKey:"addressBooks",itemsKey:"contacts",hasColor:true,defaultColor:ZmOrganizer.C_NONE,orgColor:e,treeType:ZmOrganizer.FOLDER,dropTargets:[ZmOrganizer.ADDRBOOK],views:["contact"],folderKey:"addressBook",mountKey:"mountAddrBook",createFunc:"ZmOrganizer.create",compareFunc:"ZmAddrBook.sortCompare",displayOrder:100,newOp:ZmOperation.NEW_ADDRBOOK,deferrable:true}
)
};
ZmContactsApp.prototype._setupSearchToolbar=function(){
ZmSearchToolBar.addMenuItem(ZmItem.CONTACT,{
msgKey:"searchContacts",tooltipKey:"searchPersonalContacts",icon:"Contact",shareIcon:"SharedContactsFolder",id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_CONTACT)}
);
ZmSearchToolBar.addMenuItem(ZmId.SEARCH_GAL,{
msgKey:"searchGALContacts",tooltipKey:"searchGALContacts",icon:"GAL",setting:ZmSetting.GAL_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.SEARCH_GAL)}
)
};
ZmContactsApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_CONTACT]="contact";
a[ZmOperation.NEW_GROUP]="group";
var t={};
t[ZmOperation.NEW_ADDRBOOK]="addressBook";
var e={};
e[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],assistants:{
ZmContactAssistant:["ContactsCore","Contacts"]}
,searchTypes:[ZmItem.CONTACT],newItemOps:a,newOrgOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_CONTACTS,newActionCode:ZmKeyMap.NEW_CONTACT,trashViewOp:ZmOperation.SHOW_ONLY_CONTACTS,chooserSort:20,defaultSort:40,upsellUrl:ZmSetting.CONTACTS_UPSELL_URL}
)
};
ZmContactsApp.prototype.createNotify=function(l,a){
if(!l.folder&&!l.cn&&!l.link){
return
}
if(!a&&!this._noDefer&&this._deferNotifications("create",l)){
return
}
for(var e in l){
var r=l[e];
if(r&&r.length){
for(var n=0;
n<r.length;
n++){
var s=r[n];
if(appCtxt.cacheGet(s.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(s,ZmOrganizer.ADDRBOOK)
}else{
if(e=="link"){
this._handleCreateLink(s,ZmOrganizer.ADDRBOOK)
}else{
if(e=="cn"){
var h=AjxDispatcher.run("GetContactListController");
var o=(h&&h.getFolderId())?h.getList():new ZmContactList(null);
if(appCtxt.multiAccounts&&o.search&&o.search.folderId!=s.l){
continue
}
o.notifyCreate(s);
var t=window.parentAppCtxt||window.appCtxt;
t.clearAutocompleteCache(ZmAutocomplete.AC_TYPE_CONTACT);
s._handled=true
}}}}}}};
ZmContactsApp.prototype.modifyNotify=function(t,e){
if(!t.cn){
return
}
if(!e&&!this._noDefer&&this._deferNotifications("modify",t)){
return
}
this._batchNotify(t.cn)
};
ZmContactsApp.prototype.postNotify=function(e){
if(this._checkReplenishListView){
this._checkReplenishListView._checkReplenish();
this._checkReplenishListView=null
}};
ZmContactsApp.prototype.handleOp=function(a,t){
switch(a){
case ZmOperation.NEW_CONTACT:case ZmOperation.NEW_GROUP:t.type=(a==ZmOperation.NEW_GROUP)?ZmItem.GROUP:null;
var e=new AjxCallback(this,this._handleLoadNewItem,[t]);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,true);
break;
case ZmOperation.NEW_ADDRBOOK:var e=new AjxCallback(this,this._handleLoadNewAddrBook,[t]);
AjxDispatcher.require(["ContactsCore","Contacts"],false,e,null,true);
break
}};
ZmContactsApp.prototype.getDefaultFolderId=function(e){
switch(e){
case ZmOperation.NEW_CONTACT:case ZmOperation.NEW_GROUP:return ZmOrganizer.ID_ADDRBOOK;
case ZmOperation.NEW_ADDRBOOK:return ZmOrganizer.ID_ROOT
}};
ZmContactsApp.prototype._handleLoadNewItem=function(t){
var e=new ZmContact(null,null,t.type,t.folderId);
AjxDispatcher.run("GetContactController").show(e)
};
ZmContactsApp.prototype._handleLoadNewAddrBook=function(t){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewAddrBookDialog();
if(!this._newAddrBookCb){
this._newAddrBookCb=new AjxCallback(this,this._newAddrBookCallback)
}
ZmController.showDialog(e,this._newAddrBookCb,t)
};
ZmContactsApp.prototype.activate=function(e){
ZmApp.prototype.activate.apply(this,arguments)
};
ZmContactsApp.prototype.launch=function(e,t){
this._setLaunchTime(this.toString(),new Date());
this._contactsSearch("in:contacts",t)
};
ZmContactsApp.prototype._contactsSearch=function(e,o){
var a={
searchFor:ZmId.ITEM_CONTACT,query:e,limit:this.getLimit(),types:[ZmId.ITEM_CONTACT],callback:o};
var t=appCtxt.getSearchController();
t.searchAllAccounts=false;
t.search(a)
};
ZmContactsApp.prototype.getLimit=function(t){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
};
ZmContactsApp.prototype.getInitialSearchType=function(){
var e=appCtxt.getCurrentList();
return(e&&(e instanceof ZmContactList)&&e.isGal)?ZmId.SEARCH_GAL:null
};
ZmContactsApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require("Contacts",false,e,null,true)
};
ZmContactsApp.prototype._handleLoadShowSearchResults=function(o,n){
var a=o&&o.search;
var e=a&&a.singleTerm&&a.folderId;
var t=a&&(a.contactSource==ZmId.SEARCH_GAL);
this.getContactListController().show(o,t,e);
this._setLoadedTime(this.toString(),new Date());
if(n){
n.run()
}};
ZmContactsApp.prototype.setActive=function(t){
if(t){
var e=AjxDispatcher.run("GetContactListController");
e.show()
}};
ZmContactsApp.prototype.isContactListLoaded=function(e){
var t=(e||appCtxt.getActiveAccount().id);
return(this._contactList[t]&&this._contactList[t].isLoaded)
};
ZmContactsApp.prototype.getContactByEmail=function(s,r){
if(!s){
return null
}
var n=s.toLowerCase();
var o=this._byEmail[n];
if(!o&&this._notFound(n)){
this._removeAddrFromLookupGroup(n);
if(r){
r.run(null)
}
return null
}
if(o){
this._removeAddrFromLookupGroup(n);
o=this._realizeContact(o);
o._lookupEmail=s;
if(r){
r.run(o)
}
return o
}
if(r){
var l=null,a=false,e=[];
if(this._addrLookupHash&&this._addrLookupHash[n]){
if(this._addrLookupList){
for(var t=0;
t<this._addrLookupList.length;
t++){
e.push(this._addrLookupList[t])
}
l=this._getSearchForAddresses(this._addrLookupList);
a=true;
this._addrLookupList=null
}
this._addrLookupHash[n].push(r)
}else{
l=this._getSearchForAddresses([s])
}
if(l){
var h=new AjxCallback(this,this._handleResponseSearch,[a?e:n,a,r]);
l.execute({
callback:h,noBusyOverlay:true}
)
}}};
ZmContactsApp.prototype._handleResponseSearch=function(c,n,u,m){
var e=m.getResponse();
var s=e&&e.getResults(ZmItem.CONTACT);
if(n){
var l=s.getArray();
for(var o=0;
o<l.length;
o++){
this._updateLookupCache(l[o])
}
for(var o=0;
o<c.length;
o++){
var d=c[o];
if(!this._byEmail[d]){
this._updateLookupCache(null,d)
}
var h=this._addrLookupHash[d];
if(h&&h.length){
for(var t=0;
t<h.length;
t++){
h[t].run(this._byEmail[d])
}}
this._removeAddrFromLookupGroup(d)
}}else{
var r=s?s.get(0):null;
this._updateLookupCache(r,c);
this._byEmail[c]=r;
u.run(r)
}};
ZmContactsApp.prototype.getContactsByEmails=function(t,h){
var l=[],e=null,s=null;
for(var a=0,n=t.length;
a<n;
a++){
var r=t[a];
var o=this.getContactByEmail(r.getAddress());
if(o||o===null){
l.push({
address:r,contact:o}
)
}else{
e=e||[];
s=s||[];
e.push(r);
s.push(r.getAddress())
}}
if(!h){
return l
}
if(!e){
h.run(l);
return l
}
var d=this._getSearchForAddresses(s);
var c=new AjxCallback(this,this._handleResponseSearchByEmails,[e,l,h]);
d.execute({
callback:c}
)
};
ZmContactsApp.prototype._handleResponseSearchByEmails=function(e,u,d,m){
var t=m.getResponse();
var h=t&&t.getResults(ZmItem.CONTACT);
if(!h){
d.run(u)
}
for(var s=0,n=h.size();
s<n;
s++){
var o=h.get(s);
for(var a=1;
true;
a++){
var l=ZmContact.getAttributeName(ZmContact.F_email,a);
var r=o.getAttr(l);
if(!r){
break
}
this._byEmail[r]=o
}}
for(var a=0,n=e.length;
a<n;
a++){
var c=e[a];
var o=this.getContactByEmail(c.getAddress());
u.push({
address:c,contact:o}
)
}
d.run(u)
};
ZmContactsApp.prototype._getSearchForAddresses=function(a){
var e;
if(a.length==1){
e=["to:",a[0]," not #type:group"]
}else{
e=["("];
for(var t=0,o=a.length;
t<o;
t++){
if(t>0){
e.push(" OR ")
}
e.push("to:");
e.push(a[t])
}
e.push(") not #type:group")
}
var n={
query:e.join(""),limit:a.length*2,types:AjxVector.fromArray([ZmItem.CONTACT])};
return new ZmSearch(n)
};
ZmContactsApp.prototype._notFound=function(e){
return(e===null||Boolean(this._contactList[appCtxt.getActiveAccount().id]))
};
ZmContactsApp.prototype.setAddrLookupGroup=function(t){
this._addrLookupList=[];
this._addrLookupHash={};
if(t&&t.length){
for(var e=0;
e<t.length;
e++){
if(t[e]){
var a=t[e].address||t[e];
a=(a&&AjxUtil.isString(a))?a.toLowerCase():null;
if(a&&!this._addrLookupHash[a]){
this._addrLookupList.push(a);
this._addrLookupHash[a]=[]
}}}}};
ZmContactsApp.prototype._removeAddrFromLookupGroup=function(e){
if(!(this._addrLookupList&&this._addrLookupList.length)){
return
}
AjxUtil.arrayRemove(this._addrLookupList,e);
delete this._addrLookupHash[e]
};
ZmContactsApp.prototype._updateLookupCache=function(t,n){
if(n){
this._byEmail[n]=t
}
if(t){
for(var o=1;
true;
o++){
var a=ZmContact.getAttributeName(ZmContact.F_email,o);
var e=t.getAttr(a);
if(!e){
break
}
this._byEmail[e.toLowerCase()]=t
}}};
ZmContactsApp.prototype.getContactByIMAddress=function(t){
if(!t){
return null
}
var e=this._byIM[t.toLowerCase()];
return this._realizeContact(e)
};
ZmContactsApp.prototype.getContactByPhone=function(e){
if(!e){
return null
}
var a=e.replace(/[^d]/g,"");
var t=this._phoneToContact[a];
if(t){
t.contact=this._realizeContact(t.contact)
}
return t
};
ZmContactsApp.prototype._realizeContact=function(e){
var a=appCtxt.getActiveAccount().id;
var t=this._contactList[a];
return t?t._realizeContact(e):e
};
ZmContactsApp.prototype.updateCache=function(e,t){
this._updateHash(e,t,ZmContact.EMAIL_FIELDS,this._byEmail);
if(appCtxt.get(ZmSetting.VOICE_ENABLED)){
this._updateHash(e,t,ZmContact.PHONE_FIELDS,this._byPhone,true,true)
}
if(appCtxt.get(ZmSetting.IM_ENABLED)){
this._updateHash(e,t,ZmContact.IM_FIELDS,this._byIM)
}};
ZmContactsApp.prototype._updateHash=function(h,a,s,n,t,e){
for(var r=0;
r<s.length;
r++){
var d=s[r];
for(var o=1;
true;
o++){
var c=ZmContact.getAttributeName(d,o);
var l=ZmContact.getAttr(h,c);
if(!l){
break
}
l=e?l.replace(/[^d]/g,""):l.toLowerCase();
if(a){
n[l]=t?{
contact:h,field:c}
:h
}else{
delete n[l]
}}}};
ZmContactsApp.prototype.getContactListForAllAccounts=function(){
var e=[];
var a=appCtxt.accountList.visibleAccounts;
for(var t=0;
t<a.length;
t++){
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED,null,a[t])){
e.push(a[t])
}}
if(e.length>0){
this._loadContactsForAccount(e)
}};
ZmContactsApp.prototype._loadContactsForAccount=function(e){
var a=e.shift();
if(a){
var t=new AjxCallback(this,this._loadContactsForAccount,[e]);
this.getContactList(t,null,a)
}};
ZmContactsApp.prototype.getContactList=function(r,e,n){
var a=(n&&n.id)||appCtxt.getActiveAccount().id;
if(!this._contactList[a]){
try{
if(this._parentController){
this._contactList[a]=this._parentController.getApp(ZmApp.CONTACTS).getContactList()
}else{
this._contactList[a]=new ZmContactList(null);
var s=new AjxCallback(this,this._handleResponseGetContactList,[r]);
var t=(n&&n.getEmail());
this._contactList[a].load(s,e,t)
}
return this._contactList[a]
}
catch(o){
this._contactList[a]=null;
throw o
}}else{
if(r&&r.run){
r.run(this._contactList[a])
}
return this._contactList[a]
}};
ZmContactsApp.prototype._handleResponseGetContactList=function(t){
var e=appCtxt.getActiveAccount().id;
this.contactsLoaded[e]=true;
if(t&&t.run){
t.run(this._contactList[e])
}};
ZmContactsApp.prototype.getGalContactList=function(){
if(!this._galContactList){
try{
this._galContactList=new ZmContactList(null,true);
this._galContactList.load()
}
catch(e){
this._galContactList=null;
throw e
}}
return this._galContactList
};
ZmContactsApp.prototype.createFromVCard=function(a,t){
var e=new ZmContact(null);
e.createFromVCard(a,t)
};
ZmContactsApp.prototype.getContactListController=function(){
if(!this._contactListController){
this._contactListController=new ZmContactListController(this._container,this)
}
return this._contactListController
};
ZmContactsApp.prototype.getContactController=function(){
AjxDispatcher.require(["ContactsCore","Contacts"]);
if(this._contactController==null){
this._contactController=new ZmContactController(this._container,this)
}
return this._contactController
};
ZmContactsApp.prototype._newAddrBookCallback=function(n,a,t){
var o=appCtxt.getNewAddrBookDialog();
o.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.ADDRBOOK)._doCreate(n,a,t)
};
ZmContactsApp.prototype.getDL=function(e){
return this._dlCache[e]
};
ZmContactsApp.prototype.cacheDL=function(t,e){
this._dlCache[t]=e
}
}
if(AjxPackage.define("zimbraMail.im.ZmImApp")){
ZmImApp=function(e){
ZmApp.call(this,ZmApp.IM,e);
delete ZmFolder.HIDE_ID[ZmOrganizer.ID_CHATS];
this._active=false;
ZmImApp.INSTANCE=this;
this._roster=new ZmRoster(this)
};
ZmEvent.S_CHAT=ZmId.ITEM_CHAT;
ZmEvent.S_ROSTER="ROSTER";
ZmEvent.S_ROSTER_ITEM=ZmId.ITEM_ROSTER;
ZmEvent.S_ROSTER_TREE_ITEM=ZmId.ORG_ROSTER_TREE_ITEM;
ZmEvent.S_ROSTER_TREE_GROUP=ZmId.ORG_ROSTER_TREE_GROUP;
ZmItem.CHAT=ZmEvent.S_CHAT;
ZmItem.ROSTER_ITEM=ZmEvent.S_ROSTER_ITEM;
ZmOrganizer.ROSTER_TREE_ITEM=ZmEvent.S_ROSTER_TREE_ITEM;
ZmOrganizer.ROSTER_TREE_GROUP=ZmEvent.S_ROSTER_TREE_GROUP;
ZmOrganizer.CONFERENCE_ITEM="CONFERENCE_ITEM";
ZmItem.F_PRESENCE="PRESENCE";
ZmItem.F_PRESENCE_CELL="PRESENCE_cell";
ZmApp.IM=ZmId.APP_IM;
ZmApp.CLASS[ZmApp.IM]="ZmImApp";
ZmApp.SETTING[ZmApp.IM]=ZmSetting.IM_ENABLED;
ZmApp.LOAD_SORT[ZmApp.IM]=47;
ZmApp.QS_ARG[ZmApp.IM]="chat";
ZmImApp.BUDDY_SORT_PRESENCE="presence";
ZmImApp.BUDDY_SORT_NAME="name";
ZmImApp.prototype=new ZmApp;
ZmImApp.prototype.constructor=ZmImApp;
ZmImApp.loggedIn=function(){
return ZmImApp.INSTANCE&&ZmImApp.INSTANCE._serviceController&&ZmImApp.INSTANCE._serviceController.service.isLoggedIn()&&(appCtxt.get(ZmSetting.IM_PREF_AUTO_LOGIN)||ZmImApp.INSTANCE._roster)
};
ZmImApp.prototype.toString=function(){
return"ZmImApp"
};
ZmImApp.prototype._defineAPI=function(){
AjxDispatcher.registerMethod("GetRoster","IMCore",new AjxCallback(this,this.getRoster))
};
ZmImApp.prototype._registerOrganizers=function(){
ZmOrganizer.registerOrg(ZmOrganizer.CONFERENCE_ITEM,{
app:ZmApp.IM,nameKey:"imConference",defaultFolder:ZmOrganizer.ID_INBOX,orgPackage:"IM",treeController:"ZmConferenceTreeController",labelKey:"imConferences",itemsKey:"messages",hasColor:false,treeType:ZmOrganizer.CONFERENCE_ITEM,compareFunc:"ZmConferenceService.sortCompare",displayOrder:900}
)
};
ZmImApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_IM_NEW_CHAT,{
textKey:"imNewChat",image:"ImFree2Chat",shortcut:ZmKeyMap.NEW_CHAT}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_AWAY,{
textKey:"imStatusAway",image:"ImAway"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_CHAT,{
textKey:"imStatusChat",image:"ImFree2Chat"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_DND,{
textKey:"imStatusDND",image:"ImDnd"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_INVISIBLE,{
textKey:"imStatusInvisible",image:"ImInvisible"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_MENU,{
textKey:"imPresence"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_OFFLINE,{
textKey:"imStatusOffline",image:"Offline"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_ONLINE,{
textKey:"imStatusOnline",image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_XA,{
textKey:"imStatusExtAway",image:"ImExtendedAway"}
);
ZmOperation.registerOp(ZmId.OP_IM_LOGOUT_YAHOO,{
textKey:"imLogoutYahoo",image:"Logoff"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_CUSTOM_MRU,{
image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_MENU,{
image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_NEW_ROSTER_GROUP,{
textKey:"imNewGroup",image:"ImGroup"}
);
ZmOperation.registerOp(ZmId.OP_NEW_ROSTER_ITEM,{
textKey:"newRosterItem",image:"AddBuddy",tooltipKey:"imNewBuddyTooltip"}
);
ZmOperation.registerOp(ZmId.OP_IM_CREATE_CONTACT,{
textKey:"addToNewContact",image:"NewContact"}
);
ZmOperation.registerOp(ZmId.OP_IM_ADD_TO_CONTACT,{
textKey:"addToExistingContact",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_IM_EDIT_CONTACT,{
textKey:"editContact",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_IM_TOGGLE_OFFLINE,{
textKey:"imToggleOffline"}
);
ZmOperation.registerOp(ZmId.OP_IM_TOGGLE_BLOCKED,{
textKey:"imToggleBlocked"}
);
ZmOperation.registerOp(ZmId.OP_IM_SORT_BY_PRESENCE,{
textKey:"imSortListByPresence"}
);
ZmOperation.registerOp(ZmId.OP_IM_SORT_BY_NAME,{
textKey:"imSortListByName"}
);
ZmOperation.registerOp(ZmId.OP_IM_PRESENCE_CUSTOM_MSG,{
textKey:"imCustomStatusMsg",image:"ImAvailable"}
);
ZmOperation.registerOp(ZmId.OP_IM_BLOCK_BUDDY,{
textKey:"imBlock",image:"BlockUser"}
);
ZmOperation.registerOp(ZmId.OP_IM_UNBLOCK_BUDDY,{
textKey:"imUnblock",image:"AllowUser"}
);
ZmOperation.registerOp(ZmId.OP_IM_HTML,{
image:"TextFormat",tooltipKey:"changeEditorMode"}
);
ZmOperation.registerOp(ZmId.OP_IM_DELETE_GROUP,{
image:"Delete",textKey:"del"}
);
ZmOperation.registerOp(ZmId.OP_IM_CLOSE_ALL_CHATS,{
textKey:"imCloseAllChats"}
);
ZmOperation.registerOp(ZmId.OP_IM_CLOSE_OTHER_CHATS,{
textKey:"imCloseOtherChats"}
);
ZmOperation.registerOp(ZmId.OP_IM_CLOSE_CHAT,{
textKey:"imCloseChat"}
);
ZmOperation.registerOp(ZmId.OP_IM_BUDDY_ARCHIVE,{
textKey:"imBuddyArchive",image:"ChatFolder"}
);
ZmOperation.registerOp(ZmId.OP_IM_BUDDY_LIST,{
textKey:"buddyList",image:"ImGroup"}
);
ZmOperation.registerOp(ZmId.OP_IM_INVITE,{
textKey:"imInvitation",image:"AllowUser"}
)
};
ZmImApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.CHAT,{
app:ZmApp.IM,nameKey:"chat",icon:"ImStartChat",soapCmd:"ItemAction",itemClass:"ZmChat",node:"chat",organizer:ZmOrganizer.ROSTER,searchType:"chat"}
)
};
ZmImApp.prototype._registerApp=function(){
var t={};
t[ZmOperation.IM_NEW_CHAT]="chat";
var e={};
e[ZmKeyMap.NEW_CHAT]=ZmOperation.IM_NEW_CHAT;
e[ZmKeyMap.NEW_ROSTER_ITEM]=ZmOperation.NEW_ROSTER_ITEM;
e[ZmKeyMap.PRESENCE_MENU]=ZmOperation.IM_PRESENCE_MENU;
ZmApp.registerApp(ZmApp.IM,{
mainPkg:"IM",defaultSort:50,newItemOps:t,actionCodes:e}
)
};
ZmImApp.prototype._registerSettings=function(e){
e=e||appCtxt.getSettings();
e.registerSetting("IM_PREF_NOTIFY_SOUNDS",{
name:"zimbraPrefIMSoundsEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_FLASH_BROWSER",{
name:"zimbraPrefIMFlashTitle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_DESKTOP_ALERT",{
name:"zimbraPrefIMToasterEnabled",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_INSTANT_NOTIFY",{
name:"zimbraPrefIMInstantNotify",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_AUTO_LOGIN",{
name:"zimbraPrefIMAutoLogin",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("IM_PREF_NOTIFY_PRESENCE",{
name:"zimbraPrefIMNotifyPresence",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_NOTIFY_STATUS",{
name:"zimbraPrefIMNotifyStatus",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_LOGCHATS_ENABLED",{
name:"zimbraPrefIMLogChats",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_REPORT_IDLE",{
name:"zimbraPrefIMReportIdle",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("IM_PREF_IDLE_TIMEOUT",{
name:"zimbraPrefIMIdleTimeout",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:10}
);
e.registerSetting("IM_PREF_IDLE_STATUS",{
name:"zimbraPrefIMIdleStatus",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:"xa"}
);
e.registerSetting("IM_CUSTOM_STATUS_MRU",{
name:"zimbraPrefIMCustomStatusMessage",type:ZmSetting.T_PREF,dataType:ZmSetting.D_LIST}
);
e.registerSetting("IM_PREF_BUDDY_SORT",{
name:"zimbraPrefIMBuddyListSort",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:ZmImApp.BUDDY_SORT_NAME,isImplicit:true}
);
e.registerSetting("IM_PREF_HIDE_OFFLINE",{
name:"zimbraPrefIMHideOfflineBuddies",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}
);
e.registerSetting("IM_PREF_HIDE_BLOCKED",{
name:"zimbraPrefIMHideBlockedBuddies",type:ZmSetting.T_PREF,dataType:ZmSetting.D_BOOLEAN,defaultValue:false,isImplicit:true}
);
e.registerSetting("IM_YAHOO_ID",{
name:"zimbraPrefIMYahooId",type:ZmSetting.T_PREF,dataType:ZmSetting.D_STRING,defaultValue:""}
);
var t=new AjxListener(this,this._onSettingChange);
e.getSetting(ZmSetting.IM_PREF_INSTANT_NOTIFY).addChangeListener(t);
e.getSetting(ZmSetting.IM_PREF_REPORT_IDLE).addChangeListener(t);
e.getSetting(ZmSetting.IM_PREF_IDLE_TIMEOUT).addChangeListener(t)
};
ZmImApp.prototype._registerPrefs=function(){
var t={
IM:{
title:ZmMsg.im,icon:"ImStartChat",templateId:"prefs.Pages#IM",priority:90,precondition:ZmSetting.IM_ENABLED,prefs:[ZmSetting.IM_PREF_INSTANT_NOTIFY,ZmSetting.IM_PREF_AUTO_LOGIN,ZmSetting.IM_PREF_FLASH_BROWSER,ZmSetting.IM_PREF_DESKTOP_ALERT,ZmSetting.IM_PREF_NOTIFY_PRESENCE,ZmSetting.IM_PREF_NOTIFY_STATUS,ZmSetting.IM_PREF_LOGCHATS_ENABLED,ZmSetting.IM_PREF_REPORT_IDLE,ZmSetting.IM_PREF_IDLE_TIMEOUT,ZmSetting.IM_PREF_IDLE_STATUS,ZmSetting.IM_PREF_NOTIFY_SOUNDS]}};
for(var e in t){
ZmPref.registerPrefSection(e,t[e])
}
ZmPref.registerPref("IM_PREF_NOTIFY_SOUNDS",{
displayName:ZmMsg.playSound,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_INSTANT_NOTIFY",{
displayName:ZmMsg.imPrefInstantNotify,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:function(){
return appCtxt.get(ZmSetting.INSTANT_NOTIFY)&&ZmImApp.INSTANCE.getServiceController().capabilities[ZmImServiceController.INSTANT_NOTIFY]
}}
);
ZmPref.registerPref("IM_PREF_AUTO_LOGIN",{
displayName:ZmMsg.imPrefAutoLogin,displayContainer:ZmPref.TYPE_CHECKBOX,precondition:function(){
return ZmImApp.INSTANCE.getServiceController().capabilities[ZmImServiceController.AUTO_LOGIN_PREF]
}}
);
ZmPref.registerPref("IM_PREF_FLASH_BROWSER",{
displayName:ZmMsg.flashBrowser,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_DESKTOP_ALERT",{
displayName:ZmMsg.showPopupBrowserPlus,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_NOTIFY_PRESENCE",{
displayName:ZmMsg.imPrefNotifyPresence,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_NOTIFY_STATUS",{
displayName:ZmMsg.imPrefNotifyStatus,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_LOGCHATS_ENABLED",{
displayName:ZmMsg.imPrefLogChats,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_REPORT_IDLE",{
displayName:ZmMsg.imPrefReportIdle,displayContainer:ZmPref.TYPE_CHECKBOX}
);
ZmPref.registerPref("IM_PREF_IDLE_TIMEOUT",{
displayName:ZmMsg.imPrefIdleTimeout,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes,ZmMsg.imPrefIdleTimeoutMinutes],options:[1,5,10,20,30,60],precondition:ZmSetting.IM_PREF_REPORT_IDLE}
);
ZmPref.registerPref("IM_PREF_IDLE_STATUS",{
displayName:ZmMsg.imPrefIdleStatus,displayContainer:ZmPref.TYPE_SELECT,displayOptions:[ZmMsg.imStatusAway,ZmMsg.imStatusExtAway,ZmMsg.imStatusOffline],options:["away","xa","offline"],precondition:ZmSetting.IM_PREF_REPORT_IDLE}
)
};
ZmImApp.prototype._onSettingChange=function(e){
if(e.type!=ZmEvent.S_SETTING){
return
}
var a=e.source.id;
var t=appCtxt.get(a);
if(a==ZmSetting.IM_PREF_INSTANT_NOTIFY&&appCtxt.get(ZmSetting.INSTANT_NOTIFY)){
appCtxt.getAppController().setInstantNotify(t)
}else{
if(this._roster&&a==ZmSetting.IM_PREF_REPORT_IDLE){
if(!t){
this._roster._idleTimer.kill()
}else{
this._roster._idleTimer.resurrect(appCtxt.get(ZmSetting.IM_PREF_IDLE_TIMEOUT))
}}else{
if(this._roster&&a==ZmSetting.IM_PREF_IDLE_TIMEOUT){
this._roster._idleTimer.timeout=parseInt(t)*60*1000
}}}};
ZmImApp.prototype.refresh=function(){
delete this._lastSeq;
if(this._serviceController&&this._serviceController.service.isLoggedIn()){
this._roster.refresh()
}};
ZmImApp.prototype.handleOp=function(e){
switch(e){
case ZmOperation.IM_NEW_CHAT:this.prepareVisuals();
this.getImController()._imNewChatListener();
break;
case ZmOperation.NEW_ROSTER_ITEM:this.prepareVisuals();
this.getImController()._newRosterItemListener();
break;
case ZmOperation.IM_PRESENCE_MENU:if(this._presenceButton){
this._presenceButton.popup()
}
break
}};
ZmImApp.prototype.postNotify=function(e){
if(e.im){
if(!this._lastSeq||(e.seq>this._lastSeq)){
this._lastSeq=e.seq;
AjxDispatcher.run("GetRoster").pushNotification(e.im)
}}};
ZmImApp.prototype.addComponents=function(e){
this._taskbarController=new ZmTaskbarController(e)
};
ZmImApp.prototype.startup=function(){
if(appCtxt.get(ZmSetting.IM_PREF_AUTO_LOGIN)){
AjxTimedAction.scheduleAction(new AjxTimedAction(this,this._autoLogin),1000)
}};
ZmImApp.prototype.login=function(e){
this.getServiceController().login(e)
};
ZmImApp.prototype._autoLogin=function(){
var e=new AjxCallback(this,this._postLoadAutoLogin);
AjxDispatcher.require(["IMCore"],true,e)
};
ZmImApp.prototype._postLoadAutoLogin=function(){
this.login({
auto:true}
)
};
ZmImApp.prototype.getImController=function(){
if(!this._imController){
AjxDispatcher.require(["IMCore","IM"]);
this._imController=new ZmImController()
}
return this._imController
};
ZmImApp.prototype.isActive=function(){
return this._active
};
ZmImApp.prototype.getRoster=function(){
return this._roster
};
ZmImApp.prototype.hasRoster=function(){
return !!this._roster
};
ZmImApp.prototype.getServiceController=function(){
if(!window.ZmImServiceController||!this._serviceController){
AjxDispatcher.require(["IMCore"]);
var e=this.getRoster();
this._serviceController=new ZmZimbraImServiceController(e)
}
return this._serviceController
};
ZmImApp.prototype.getService=function(){
return this.getServiceController().service
};
ZmImApp.prototype.getAutoCompleteGroups=function(){
return new ZmRosterTreeGroups(this.getRoster())
};
ZmImApp.prototype.prepareVisuals=function(){
AjxDispatcher.require(["IMCore","IM"])
};
ZmImApp._NEW_IM="NEW_IM";
ZmImApp._NEW_BUDDY_FROM_IM_ADDRESS="NEW_BUDDY_FROM_IM_ADDRESS";
ZmImApp._NEW_BUDDY="NEW_BUDDY";
ZmImApp.updateImMenuItemByContact=function(s,e,t){
var n=ZmImApp._updateImMenuItemByLogin(s);
if(n){
return
}
var o=e.getBuddy();
if(o){
ZmImApp._updateImMenuItemByBuddy(s,o);
return
}
var r=e.getIMAddress();
if(r){
s.setText(ZmImApp._getNewBuddyText(e.getFullName()));
s.setImage("NewContact");
s._imData={
op:ZmImApp._NEW_BUDDY_FROM_IM_ADDRESS,contact:e,imAddress:r};
return
}
var a=t&&t.getName()?t.getName():e.getFullName();
s.setText(ZmImApp._getNewBuddyText(a));
s.setImage("NewContact");
s._imData={
op:ZmImApp._NEW_BUDDY,address:t,name:a}
};
ZmImApp.updateImMenuItemByAddress=function(n,e,a,h){
var o=ZmImApp._updateImMenuItemByLogin(n);
if(o){
if(h){
h.run()
}
return
}
var t=AjxDispatcher.run("GetRoster").getRosterItem(e.getAddress());
if(t){
ZmImApp._updateImMenuItemByBuddy(n,t);
if(h){
h.run()
}
return
}
var r=appCtxt.getApp(ZmApp.CONTACTS);
if(r){
if(h){
var s=new AjxCallback(null,ZmImApp.handleResponseGetContact,[n,e,a,h]);
r.getContactByEmail(e.getAddress(),s)
}
return true
}else{
ZmImApp.handleResponseGetContact(n,e,a)
}};
ZmImApp.handleResponseGetContact=function(o,t,a,n,e){
if(e){
ZmImApp.updateImMenuItemByContact(o,e,t)
}else{
if(a){
o.setText(ZmImApp._getNewBuddyText(t.getName()||t.getAddress()));
o.setImage("NewContact");
o._imData={
op:ZmImApp._NEW_BUDDY,address:t,name:t.getName()}
}}
if(n){
n.run()
}};
ZmImApp.getImMenuItemListener=function(){
ZmImApp._imMenuItemListenerObj=ZmImApp._imMenuItemListenerObj||new AjxListener(null,ZmImApp._imMenuItemListener);
return ZmImApp._imMenuItemListenerObj
};
ZmImApp._updateImMenuItemByBuddy=function(t,e){
ZmImApp._newChatFormat=ZmImApp._newChatFormat||new AjxMessageFormat(ZmMsg.imNewChatName);
t.setText(ZmImApp._newChatFormat.format(e.getDisplayName()));
t.setImage(e.getPresence().getIcon());
t._imData={
op:ZmImApp._NEW_IM,buddy:e}
};
ZmImApp._updateImMenuItemByLogin=function(e){
if(!ZmImApp.loggedIn()){
e.setText(ZmMsg.newIM);
e.setImage("ImStartChat");
e.setEnabled(false);
e._imData=null;
return true
}
e.setEnabled(true);
return false
};
ZmImApp._getNewBuddyText=function(e){
ZmImApp._newBuddyFormat=ZmImApp._newBuddyFormat||new AjxMessageFormat(ZmMsg.imNewBuddy);
return ZmImApp._newBuddyFormat.format(e)
};
ZmImApp._imMenuItemListener=function(t){
ZmImApp.INSTANCE.prepareVisuals();
var e=t.dwtObj._imData;
if(e){
switch(e.op){
case ZmImApp._NEW_IM:ZmTaskbarController.INSTANCE.chatWithRosterItem(e.buddy);
break;
case ZmImApp._NEW_BUDDY_FROM_IM_ADDRESS:var o=ZmImAddress.parse(e.imAddress);
var a=o?{
address:o.screenName,name:e.contact.getFullName(),service:o.service}
:{};
ZmImApp.INSTANCE.getImController()._newRosterItemListener(a);
break;
case ZmImApp._NEW_BUDDY:a={
address:e.address?e.address.getAddress():null,name:e.name};
ZmImApp.INSTANCE.getImController()._newRosterItemListener(a);
break
}}}
}
if(AjxPackage.define("zimbraMail.notebook.ZmNotebookApp")){
ZmNotebookApp=function(t,e){
ZmApp.call(this,ZmApp.NOTEBOOK,t,e)
};
ZmEvent.S_PAGE=ZmId.ITEM_PAGE;
ZmEvent.S_DOCUMENT=ZmId.ITEM_DOCUMENT;
ZmEvent.S_NOTEBOOK=ZmId.ORG_NOTEBOOK;
ZmItem.PAGE=ZmEvent.S_PAGE;
ZmItem.DOCUMENT=ZmEvent.S_DOCUMENT;
ZmOrganizer.NOTEBOOK=ZmEvent.S_NOTEBOOK;
ZmApp.NOTEBOOK=ZmId.APP_NOTEBOOK;
ZmApp.CLASS[ZmApp.NOTEBOOK]="ZmNotebookApp";
ZmApp.SETTING[ZmApp.NOTEBOOK]=ZmSetting.NOTEBOOK_ENABLED;
ZmApp.LOAD_SORT[ZmApp.NOTEBOOK]=60;
ZmApp.QS_ARG[ZmApp.NOTEBOOK]="documents";
ZmNotebookApp.prototype=new ZmApp;
ZmNotebookApp.prototype.constructor=ZmNotebookApp;
ZmNotebookApp.prototype.toString=function(){
return"ZmNotebookApp"
};
ZmNotebookApp.prototype._notebookCache;
ZmNotebookApp.prototype._defineAPI=function(){
AjxDispatcher.setPackageLoadFunction("NotebookCore",new AjxCallback(this,this._postLoadCore));
AjxDispatcher.setPackageLoadFunction("Notebook",new AjxCallback(this,this._postLoad,ZmOrganizer.NOTEBOOK));
AjxDispatcher.registerMethod("GetNotebookController",["NotebookCore","Notebook"],new AjxCallback(this,this.getNotebookController));
AjxDispatcher.registerMethod("GetPageEditController",["NotebookCore","Notebook"],new AjxCallback(this,this.getPageEditController));
AjxDispatcher.registerMethod("GetNotebookCache",["NotebookCore","Notebook"],new AjxCallback(this,this.getNotebookCache));
AjxDispatcher.registerMethod("GetPageVersionController",["NotebookCore","Notebook"],new AjxCallback(this,this.getPageVersionController));
AjxDispatcher.registerMethod("GetNotebookFileController",["NotebookCore","Notebook"],new AjxCallback(this,this.getFileController))
};
ZmNotebookApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_CHROME,{
textKey:"editNotebookChrome",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_INDEX,{
textKey:"editNotebookIndex",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_HEADER,{
textKey:"editNotebookHeader",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_FOOTER,{
textKey:"editNotebookFooter",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_SIDE_BAR,{
textKey:"editNotebookSideBar",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_EDIT_NOTEBOOK_CHROME,{
textKey:"editNotebookChrome",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_FORMAT_HTML_SOURCE,{
textKey:"formatHtmlSource"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_FORMAT_MEDIA_WIKI,{
textKey:"formatMediaWiki"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_FORMAT_RICH_TEXT,{
textKey:"formatRichText"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_FORMAT_TWIKI,{
textKey:"formatTWiki"}
,ZmSetting.HTML_COMPOSE_ENABLED);
ZmOperation.registerOp(ZmId.OP_MOUNT_NOTEBOOK,{
textKey:"mountNotebook",image:"Notebook"}
,ZmSetting.SHARING_ENABLED);
ZmOperation.registerOp(ZmId.OP_NEW_NOTEBOOK,{
textKey:"newNotebook",image:"NewNotebook",tooltipKey:"newNotebookTooltip",shortcut:ZmKeyMap.NEW_NOTEBOOK}
);
ZmOperation.registerOp(ZmId.OP_NEW_PAGE,{
textKey:"newPage",tooltipKey:"createNewPage",image:"NewPage"}
);
ZmOperation.registerOp(ZmId.OP_IMPORT_FILE,{
textKey:"_import",tooltipKey:"importDocs"}
);
ZmOperation.registerOp(ZmId.OP_SEND_PAGE,{
textKey:"send",tooltipKey:"sendPageTT",image:"Send"}
,ZmSetting.MAIL_ENABLED);
ZmOperation.registerOp(ZmId.OP_REFRESH,{
textKey:"refresh",tooltipKey:"refreshTooltip",image:"Refresh"}
);
ZmOperation.registerOp(ZmId.OP_SHARE_NOTEBOOK,{
textKey:"shareNotebook",image:"Notebook"}
,ZmSetting.SHARING_ENABLED);
ZmOperation.registerOp(ZmId.OP_REVERT_PAGE,{
textKey:"revert",tooltipKey:"restorePage",image:"Edit"}
);
ZmOperation.registerOp(ZmId.OP_BROWSE_FOLDER,{
textKey:"browse",image:"Browse"}
)
};
ZmNotebookApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.PAGE,{
app:ZmApp.NOTEBOOK,nameKey:"page",icon:"Page",soapCmd:"ItemAction",itemClass:"ZmPage",node:"w",organizer:ZmOrganizer.NOTEBOOK,dropTargets:[ZmOrganizer.TAG],searchType:"wiki",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("NotebookCore");
return new ZmPageList(e)
}
,this)}
);
ZmItem.registerItem(ZmItem.DOCUMENT,{
app:ZmApp.NOTEBOOK,nameKey:"document",countKey:"typeDocument",icon:"GenericDoc",soapCmd:"ItemAction",itemClass:"ZmDocument",node:"doc",organizer:ZmOrganizer.NOTEBOOK,dropTargets:[ZmOrganizer.TAG],searchType:"document",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("NotebookCore");
return new ZmPageList(e,ZmItem.DOCUMENT)
}
,this)}
)
};
ZmNotebookApp.prototype._registerOrganizers=function(){
ZmOrganizer.registerOrg(ZmOrganizer.NOTEBOOK,{
app:ZmApp.NOTEBOOK,nameKey:"notebook",defaultFolder:ZmOrganizer.ID_NOTEBOOK,soapCmd:"FolderAction",firstUserId:256,orgClass:"ZmNotebook",orgPackage:"NotebookCore",treeController:"ZmNotebookTreeController",labelKey:"notebooks",itemsKey:"documents",hasColor:true,defaultColor:ZmOrganizer.C_NONE,treeType:ZmOrganizer.FOLDER,views:["wiki"],folderKey:"notebook",mountKey:"mountNotebook",createFunc:"ZmOrganizer.create",compareFunc:"ZmNotebook.sortCompare",newOp:ZmOperation.NEW_NOTEBOOK,displayOrder:100,deferrable:true}
)
};
ZmNotebookApp.prototype._setupSearchToolbar=function(){
ZmSearchToolBar.addMenuItem(ZmItem.PAGE,{
msgKey:"searchNotebooks",tooltipKey:"searchForPages",icon:"Notebook",shareIcon:"SharedNotebook",setting:ZmSetting.NOTEBOOK_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_PAGE)}
)
};
ZmNotebookApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_PAGE]="page";
var t={};
t[ZmOperation.NEW_NOTEBOOK]="notebook";
var e={};
e[ZmKeyMap.NEW_PAGE]=ZmOperation.NEW_PAGE;
e[ZmKeyMap.NEW_NOTEBOOK]=ZmOperation.NEW_NOTEBOOK;
ZmApp.registerApp(ZmApp.NOTEBOOK,{
mainPkg:"Notebook",nameKey:"documents",icon:"NoteApp",textPrecedence:10,chooserTooltipKey:"goToDocuments",defaultSearch:ZmItem.PAGE,organizer:ZmOrganizer.NOTEBOOK,overviewTrees:[ZmOrganizer.NOTEBOOK,ZmOrganizer.TAG],searchTypes:[ZmItem.PAGE,ZmItem.DOCUMENT],newItemOps:a,newOrgOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_NOTEBOOK,newActionCode:ZmKeyMap.NEW_PAGE,chooserSort:50,defaultSort:30}
)
};
ZmNotebookApp.prototype.deleteNotify=function(t,s){
if(!s&&this._deferNotifications("delete",t)){
return
}
var p=null;
var f=t.join(",")+",";
var y=false;
var n=AjxDispatcher.run("GetNotebookController");
var c=n.getPage();
var a=appCtxt.getOverviewController();
var h=a.getTreeController(ZmOrganizer.NOTEBOOK);
var r=h.getTreeView(this.getOverviewId());
if(!r){
return
}
var e=this.getNotebookCache();
for(var m=0;
m<t.length;
m++){
var u=r.getNextData(t[m]);
if(u&&f.indexOf(u.id+",")<0){
p=u
}
if(c&&c.id==t[m]){
y=true
}}
for(var m=0;
m<t.length;
m++){
var g=e.getPageById(t[m]);
if(g){
e.removePage(g);
g.notifyDelete()
}
var o=appCtxt.getById(t[m]);
if(o&&(o instanceof ZmNotebook)){
e.removeItem(o);
o.notifyDelete()
}
appCtxt.cacheRemove(t[m])
}
if(y){
var d={
folderId:(p?p.id:c.folderId),name:ZmNotebook.PAGE_INDEX};
n.gotoPage(d)
}
for(var m=0;
m<t.length;
m++){
var l=r.getTreeItemById(t[m]);
if(l){
l.dispose()
}
t[m]=null
}};
ZmNotebookApp.prototype.createNotify=function(c,o){
if(!c.folder&&!c.w&&!c.doc&&!c.link){
return
}
if(!o&&!this._noDefer&&this._deferNotifications("create",c)){
return
}
for(var t in c){
var h=c[t];
for(var s=0;
s<h.length;
s++){
var r=h[s];
if(appCtxt.cacheGet(r.id)){
continue
}
if(t=="folder"){
this._handleCreateFolder(r,ZmOrganizer.NOTEBOOK)
}else{
if(t=="link"){
this._handleCreateLink(r,ZmOrganizer.NOTEBOOK)
}else{
if(t=="w"){
var e=this.getNotebookCache();
var l=new ZmPage();
l.set(r);
e.putPage(l);
var a=AjxDispatcher.run("GetNotebookController");
if(!a.isIframeEnabled()){
var n=a.getPage();
if(n&&n.name==ZmNotebook.PAGE_INDEX){
a.gotoPage(n)
}}}else{
if(t=="doc"){
var e=this.getNotebookCache();
var d=new ZmDocument();
d.set(r);
e.putDocument(d)
}}}}}}};
ZmNotebookApp.prototype.modifyNotify=function(s,n){
if(!s){
return
}
if(!s.w&&!s.doc){
return
}
if(!n&&!this._noDefer&&this._deferNotifications("modify",l)){
return
}
for(var t in s){
var l=s[t];
for(var h=0;
h<l.length;
h++){
var d=l[h];
var o=d.id;
if(!o){
continue
}
if(t=="w"){
var e=this.getNotebookCache();
var c=e.getPageById(o);
if(!c){
c=new ZmPage();
c.set(d);
e.putPage(c)
}else{
c.notifyModify(d);
c.set(d)
}
var a=AjxDispatcher.run("GetNotebookController");
if(!a.isIframeEnabled()){
var r=a.getPage();
if(r&&r.folderId==c.folderId){
if(r.name==ZmNotebook.PAGE_INDEX||r.name==c.name){
a.gotoPage(r)
}}}
d._handled=true
}else{
if(t=="doc"){
var e=this.getNotebookCache();
var u=e.getDocumentById(o);
if(!u){
u=new ZmDocument();
u.set(d);
e.putDocument(u)
}else{
u.notifyModify(d);
u.set(d)
}}}}}};
ZmNotebookApp.prototype.handleOp=function(t){
switch(t){
case ZmOperation.NEW_PAGE:var e=new AjxCallback(this,this._handleLoadNewPage);
AjxDispatcher.require(["NotebookCore","Notebook"],false,e,null,true);
break;
case ZmOperation.NEW_NOTEBOOK:var e=new AjxCallback(this,this._handleLoadNewNotebook);
AjxDispatcher.require(["NotebookCore","Notebook"],false,e,null,true);
break
}};
ZmNotebookApp.prototype._handleLoadNewPage=function(){
var e=appCtxt.getOverviewController();
var n=e.getTreeController(ZmOrganizer.NOTEBOOK);
var t=n.getTreeView(this.getOverviewId());
var o=t?t.getSelected():null;
var a=new ZmPage();
a.folderId=o?o.id:ZmNotebookItem.DEFAULT_FOLDER;
a.name=this.generateUniqueName(a.folderId);
AjxDispatcher.run("GetPageEditController").show(a)
};
ZmNotebookApp.prototype._handleLoadNewNotebook=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
var e=appCtxt.getNewNotebookDialog();
if(!this._newNotebookCb){
this._newNotebookCb=new AjxCallback(this,this._newNotebookCallback)
}
ZmController.showDialog(e,this._newNotebookCb)
};
ZmNotebookApp.prototype.launch=function(t,a){
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require(["NotebookCore","Notebook"],true,e,null,true)
};
ZmNotebookApp.prototype._handleLoadLaunch=function(t){
var e=this.getNotebookController();
e.show(null,true);
if(t){
t.run()
}};
ZmNotebookApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require(["NotebookCore","Notebook"],false,e,null,true)
};
ZmNotebookApp.prototype._handleLoadShowSearchResults=function(e,t){
this.getFileController().show(e,true);
if(t){
t.run()
}};
ZmNotebookApp.prototype.setActive=function(e){};
ZmNotebookApp.prototype.getNotebookController=function(){
if(!this._notebookController){
this._notebookController=new ZmNotebookPageController(this._container,this)
}
return this._notebookController
};
ZmNotebookApp.prototype.getPageEditController=function(){
if(!this._pageController){
this._pageController=new ZmPageEditController(this._container,this)
}
return this._pageController
};
ZmNotebookApp.prototype.getFileController=function(){
if(!this._fileController){
this._fileController=new ZmNotebookFileController(this._container,this)
}
return this._fileController
};
ZmNotebookApp.prototype.getNotebookCache=function(){
if(!this._notebookCache){
this._notebookCache=new ZmNotebookCache()
}
return this._notebookCache
};
ZmNotebookApp.prototype._newNotebookCallback=function(n,a,t){
var o=appCtxt.getNewNotebookDialog();
o.popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.NOTEBOOK)._doCreate(n,a,t)
};
ZmNotebookApp.prototype.generateUniqueName=function(a){
var t=this.getNotebookCache().getPagesInFolder(a);
var s=[];
for(var n in t){
s.push(t[n].name.toLowerCase())
}
s="/"+s.join("/")+"/";
var e=ZmMsg.defaultPageName.toLowerCase();
for(var o=1;
o<100;
o++){
if(s.indexOf(["/",e,o,"/"].join(""))==-1){
return(ZmMsg.defaultPageName+o)
}}
return ZmMsg.untitled
};
ZmNotebookApp.prototype.getPageVersionController=function(){
if(!this._versionController){
this._versionController=new ZmPageVersionController(this._container,this)
}
return this._versionController
}
}
if(AjxPackage.define("zimbraMail.briefcase.ZmBriefcaseApp")){
ZmBriefcaseApp=function(t,e){
ZmApp.call(this,ZmApp.BRIEFCASE,t,e)
};
ZmBriefcaseApp.prototype=new ZmApp;
ZmBriefcaseApp.prototype.constructor=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.toString=function(){
return"ZmBriefcaseApp"
};
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",image:"Upload",textPrecedence:70}
);
ZmOperation.registerOp(ZmId.OP_NEW_PRESENTATION,{
textKey:"newPresentationBeta",tooltipKey:"newPresentation",image:"Presentation",textPrecedence:10}
);
ZmOperation.registerOp(ZmId.OP_NEW_SPREADSHEET,{
textKey:"newSpreadSheetBeta",tooltipKey:"newSpreadSheet",image:"ZSpreadSheet",textPrecedence:11}
);
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:"NewPage"}
);
ZmOperation.registerOp(ZmId.OP_SAVE_FILE,{
textKey:"saveFile",tooltipKey:"saveFileTooltip",image:"DownArrow"}
);
ZmOperation.registerOp(ZmId.OP_NEW_BRIEFCASE_WIN,{
tooltipKey:"detach",image:"OpenInNewWindow"}
);
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_CREATE_SLIDE_SHOW,{
textKey:"createSlideShow",image:"Presentation"}
);
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(e){
e=e||appCtxt.getSettings();
e.registerSetting("SPREADSHEET_ENABLED",{
name:"zimbraFeatureBriefcaseSpreadsheetEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("SLIDES_ENABLED",{
name:"zimbraFeatureBriefcaseSlidesEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.registerSetting("DOCS_ENABLED",{
name:"zimbraFeatureBriefcaseDocsEnabled",type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:true}
);
e.registerSetting("PREVIEW_ENABLED",{
type:ZmSetting.T_COS,dataType:ZmSetting.D_BOOLEAN,defaultValue:false}
);
e.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",countKey:"typeFile",icon:"GenericDoc",soapCmd:"ItemAction",itemClass:"ZmBriefcaseItem",node:"doc",organizer:ZmOrganizer.BRIEFCASE,dropTargets:[ZmOrganizer.TAG,ZmOrganizer.BRIEFCASE],searchType:"document",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("BriefcaseCore");
return new ZmList(ZmItem.BRIEFCASE_ITEM,e)
}
,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:"folders",itemsKey:"files",treeType:ZmOrganizer.FOLDER,views:["document"],folderKey:"briefcase",mountKey:"mountFolder",createFunc:"ZmOrganizer.create",compareFunc:"ZmBriefcase.sortCompare",deferrable:true,newOp:ZmOperation.NEW_BRIEFCASE,displayOrder:100,hasColor:true,childWindow:true}
)
};
ZmBriefcaseApp.prototype._setupSearchToolbar=function(){
ZmSearchToolBar.addMenuItem(ZmItem.BRIEFCASE_ITEM,{
msgKey:"searchBriefcase",tooltipKey:"searchForFiles",icon:"Doc",shareIcon:"SharedBriefcase",setting:ZmSetting.BRIEFCASE_ENABLED,id:ZmId.getMenuItemId(ZmId.SEARCH,ZmId.ITEM_BRIEFCASE)}
)
};
ZmBriefcaseApp.prototype._registerApp=function(){
var a={};
a[ZmOperation.NEW_DOC]="document";
var t={};
t[ZmOperation.NEW_BRIEFCASE]="briefcase";
var e={};
e[ZmKeyMap.NEW_FILE]=ZmOperation.NEW_FILE;
e[ZmKeyMap.NEW_BRIEFCASE]=ZmOperation.NEW_BRIEFCASE;
e[ZmKeyMap.NEW_PRESENTATION]=ZmOperation.NEW_PRESENTATION;
e[ZmKeyMap.NEW_SPREADSHEET]=ZmOperation.NEW_SPREADSHEET;
e[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:a,newOrgOps:t,actionCodes:e,gotoActionCode:ZmKeyMap.GOTO_BRIEFCASE,newActionCode:ZmKeyMap.NEW_DOC,chooserSort:70,defaultSort:60}
)
};
ZmBriefcaseApp.prototype.createNotify=function(o,s){
if(!o.folder&&!o.doc&&!o.link){
return
}
if(!s&&!this._noDefer&&this._deferNotifications("create",o)){
return
}
for(var e in o){
var n=o[e];
for(var a=0;
(n!=null)&&a<n.length;
a++){
var t=n[a];
if(appCtxt.cacheGet(t.id)){
continue
}
if(e=="folder"){
this._handleCreateFolder(t,ZmOrganizer.BRIEFCASE)
}else{
if(e=="link"){
this._handleCreateLink(t,ZmOrganizer.BRIEFCASE)
}else{
if(e=="doc"){
var r=AjxDispatcher.run("GetBriefcaseController");
r.handleCreateNotify(t)
}}}}}};
ZmBriefcaseApp.prototype.modifyNotify=function(a,e){
if(!a.doc){
return
}
var t=AjxDispatcher.run("GetBriefcaseController");
t.handleModifyNotify(a)
};
ZmBriefcaseApp.prototype.handleOp=function(a){
switch(a){
case ZmOperation.NEW_FILE:var e=new AjxCallback(this,this._handleNewItem);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e,null,true);
break;
case ZmOperation.NEW_BRIEFCASE:var e=new AjxCallback(this,this._handleLoadNewBriefcase);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e,null,true);
break;
case ZmOperation.NEW_PRESENTATION:var e=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_SLIDES]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,e,null);
break;
case ZmOperation.NEW_SPREADSHEET:var t=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_SPREADSHEET]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,t,null);
break;
case ZmOperation.NEW_DOC:var t=new AjxCallback(this,this.newDoc,[ZmMimeTable.APP_ZIMBRA_DOC]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,t,null);
break
}};
ZmBriefcaseApp.prototype.newDoc=function(c,t,h){
var a=appCtxt.getOverviewController();
var s=a.getTreeController(ZmOrganizer.BRIEFCASE);
var o=ZmOrganizer.ID_BRIEFCASE;
if(s){
var r=s.getTreeView(this.getOverviewId());
var l=r?r.getSelected():null;
o=l?l.id:ZmOrganizer.ID_BRIEFCASE
}
if(this.getBriefcaseController().chkFolderPermission(o)){
var e=this.getEditURLForContentType(c)+"?"+(t?"name="+t+"&":"")+"l="+o+"&skin="+appCurrentSkin+"&localeId="+AjxEnv.DEFAULT_LOCALE;
if(window.appCoverageMode){
e=e+"&coverage=1"
}
var n=h||t||(new Date()).getTime().toString();
window.open(e,n)
}};
ZmBriefcaseApp.getDocWindowFeatures=function(){
return["width=",(screen.width||640),",","height=",(screen.height||480),",","scrollbars=yes,","resizable=yes"].join("")
};
ZmBriefcaseApp.addEditorParam=function(e){
if(e&&window.isTinyMCE){}
return e
};
ZmBriefcaseApp.prototype.getEditURLForContentType=function(t){
AjxDispatcher.require("Startup1_1");
var e="Slides.jsp";
switch(t){
case ZmMimeTable.APP_ZIMBRA_SLIDES:e="Slides.jsp";
break;
case ZmMimeTable.APP_ZIMBRA_SPREADSHEET:e="SpreadsheetDoc.jsp";
break;
case ZmMimeTable.APP_ZIMBRA_DOC:e="Docs.jsp";
break;
default:return null
}
return(appContextPath+"/public/"+e)
};
ZmBriefcaseApp.prototype.isDoclet=function(e){
var t=e.getContentType();
switch(t){
case ZmMimeTable.APP_ZIMBRA_SLIDES:return true;
default:return false
}};
ZmBriefcaseApp.prototype._handleNewItem=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
this.getBriefcaseController().__popupUploadDialog(ZmMsg.uploadFileToBriefcase)
};
ZmBriefcaseApp.prototype._handleLoadNewBriefcase=function(){
appCtxt.getAppViewMgr().popView(true,ZmId.VIEW_LOADING);
if(!this._newBriefcaseCb){
this._newBriefcaseCb=new AjxCallback(this,this._newBriefcaseCallback)
}
ZmController.showDialog(appCtxt.getNewBriefcaseDialog(),this._newBriefcaseCb)
};
ZmBriefcaseApp.prototype.launch=function(t,a){
this._setLaunchTime(this.toString(),new Date());
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],true,e,null,true)
};
ZmBriefcaseApp.prototype._handleLoadLaunch=function(e){
this.search();
if(e){
e.run()
}};
ZmBriefcaseApp.prototype.search=function(o){
o=o||{};
var e=appCtxt.getById(o.folderId||ZmOrganizer.ID_BRIEFCASE);
var a={
query:o.query||e.createQuery(),types:[ZmItem.BRIEFCASE_ITEM],limit:this.getLimit(),searchFor:ZmId.ITEM_BRIEFCASE,callback:o.callback,accountName:o.accountName,noRender:o.noRender,noClear:o.noClear};
var t=appCtxt.getSearchController();
t.searchAllAccounts=false;
t.search(a)
};
ZmBriefcaseApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e,null,true)
};
ZmBriefcaseApp.prototype._handleLoadShowSearchResults=function(e,t){
this.getBriefcaseController().show(e);
this._setLoadedTime(this.toString(),new Date());
if(t){
t.run()
}};
ZmBriefcaseApp.prototype.setActive=function(e){};
ZmBriefcaseApp.prototype.getLimit=function(t){
var e=appCtxt.get(ZmSetting.PAGE_SIZE);
return t?e:2*e
};
ZmBriefcaseApp.prototype._newBriefcaseCallback=function(o,a,t){
appCtxt.getNewBriefcaseDialog().popdown();
var e=appCtxt.getOverviewController();
e.getTreeController(ZmOrganizer.BRIEFCASE)._doCreate(o,a,t)
};
ZmBriefcaseApp.prototype.getBriefcaseController=function(){
if(!this._briefcaseController){
this._briefcaseController=new ZmBriefcaseController(this._container,this)
}
return this._briefcaseController
};
ZmBriefcaseApp.prototype.createFromAttachment=function(o,a,t){
var e=new AjxCallback(this,this._handleCreateFromAttachment,[o,a,t]);
AjxDispatcher.require(["BriefcaseCore","Briefcase"],false,e)
};
ZmBriefcaseApp.prototype._handleCreateFromAttachment=function(a,t,e){
if(this._deferredFolders.length!=0){
this._createDeferredFolders(ZmApp.BRIEFCASE)
}
this.getBriefcaseController().createFromAttachment(a,t,e)
};
ZmBriefcaseApp.prototype._createDeferredFolders=function(e){
AjxPackage.require("BriefcaseCore");
ZmApp.prototype._createDeferredFolders.call(this,e)
}
}
if(AjxPackage.define("zimbraMail.voicemail.ZmVoiceApp")){
ZmVoiceApp=function(t,e){
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,t,e)
};
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.toString=function(){
return"ZmVoiceApp"
};
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",countKey:"typeVoicemail",icon:"Voicemail",soapCmd:"VoiceMsgAction",itemClass:"ZmVoicemail",node:"vm",organizer:ZmOrganizer.VOICE,dropTargets:[ZmOrganizer.VOICE],searchType:"voicemail",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("Voicemail");
return new ZmVoiceList(ZmItem.VOICEMAIL,e)
}
,this)}
);
ZmItem.registerItem(ZmItem.CALL,{
app:ZmApp.VOICE,nameKey:"call",countKey:"typeCall",icon:"Voicemail",soapCmd:"VoiceMsgAction",itemClass:"ZmCall",node:"cl",organizer:ZmOrganizer.VOICE,searchType:"calllog",resultsList:AjxCallback.simpleClosure(function(e){
AjxDispatcher.require("Voicemail");
return new ZmVoiceList(ZmItem.CALL,e)
}
,this)}
)
};
ZmVoiceApp.prototype._registerOperations=function(){
ZmOperation.registerOp(ZmId.OP_CHECK_VOICEMAIL,{
textKey:"checkVoicemail",tooltipKey:"checkVoicemailTooltip"}
);
ZmOperation.registerOp(ZmId.OP_CHECK_CALLS,{
textKey:"checkCalls",tooltipKey:"checkCallsTooltip"}
);
ZmOperation.registerOp(ZmId.OP_CALL_MANAGER,{
textKey:"callManager",tooltipKey:"callManagerTooltip",image:"CallManager",shortcut:ZmKeyMap.CALL_MANAGER}
);
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"}
)
};
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(){
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,upsellUrl:ZmSetting.VOICE_UPSELL_URL}
)
};
ZmVoiceApp.prototype._registerPrefs=function(){};
ZmVoiceApp.prototype._registerSettings=function(e){
e=e||appCtxt.getSettings();
e.registerSetting("VOICE_PAGE_SIZE",{
name:"zimbraPrefVoiceItemsPerPage",type:ZmSetting.T_PREF,dataType:ZmSetting.D_INT,defaultValue:25}
);
e.registerSetting("VOICE_PAGE_SIZE_MAX",{
name:"zimbraMaxVoiceItemsPerPage",type:ZmSetting.T_COS,dataType:ZmSetting.D_INT,defaultValue:100}
)
};
ZmVoiceApp.prototype.deleteNotify=function(e){
this._handleDeletes(e)
};
ZmVoiceApp.prototype.createNotify=function(e){
this._handleCreates(e)
};
ZmVoiceApp.prototype.modifyNotify=function(e){
this._handleModifies(e)
};
ZmVoiceApp.prototype.getOverviewId=function(){
var e=this.accordionItem?this.accordionItem.data.phone.name:"";
return[this._name,e].join(":")
};
ZmVoiceApp.prototype.getOverviewContainer=function(){
if(!this._overviewContainer){
var e=[ZmApp.OVERVIEW_ID,this._name].join("_");
var t={
appName:this._name,containerId:e,posStyle:Dwt.ABSOLUTE_STYLE,parent:appCtxt.getShell(),controller:this._opc};
t.id=ZmId.getOverviewContainerId(e);
this._overviewContainer=this._opc._overviewContainer[e]=new ZmVoiceOverviewContainer(t)
}
return this._overviewContainer
};
ZmVoiceApp.prototype.getVoiceInfo=function(r,e,t){
if(!this.phones.length){
if(!this._gettingVoiceInfo){
var a=AjxSoapDoc.create("GetVoiceInfoRequest","urn:zimbraVoice");
var s=new AjxCallback(this,this._handleResponseVoiceInfo);
var o=new AjxCallback(this,this._handleErrorResponseVoiceInfo);
var n={
soapDoc:a,asyncMode:true,noBusyOverlay:t,callback:s,errorCallback:o};
appCtxt.getAppController().sendRequest(n);
this._gettingVoiceInfo=true
}
if(r){
this._voiceInfoCallbacks=this._voiceInfoCallbacks||[];
this._voiceInfoCallbacks.push(r)
}
if(e){
this._voiceInfoErrorCallbacks=this._voiceInfoErrorCallbacks||[];
this._voiceInfoErrorCallbacks.push(e)
}}else{
if(r){
r.run()
}}};
ZmVoiceApp.prototype._handleResponseVoiceInfo=function(e){
var t=new AjxCallback(this,this._handleResponseVoiceInfo2,[e]);
AjxPackage.require({
name:"Voicemail",callback:t}
)
};
ZmVoiceApp.prototype._handleResponseVoiceInfo2=function(t){
var s=t._data.GetVoiceInfoResponse;
this._storeprincipal=s.storeprincipal[0];
this.soapInfo.additional={
storeprincipal:this._storeprincipal};
var a=s.phone;
for(var o=0,n=a.length;
o<n;
o++){
var r=a[o];
var e=new ZmPhone();
e._loadFromDom(r);
this.phones.push(e);
this._nameToPhone[e.name]=e;
if(r.folder&&r.folder.length){
e.folderTree=new ZmVoiceFolderTree();
e.folderTree.loadFromJs(r.folder[0],e)
}}
if(this._voiceInfoCallbacks){
for(o=0,n=this._voiceInfoCallbacks.length;
o<n;
o++){
this._voiceInfoCallbacks[o].run(t)
}}
this._voiceInfoCallbacks=null;
this._voiceInfoErrorCallbacks=null;
this._gettingVoiceInfo=false
};
ZmVoiceApp.prototype._handleErrorResponseVoiceInfo=function(e){
var a=false;
if(this._voiceInfoErrorCallbacks){
for(var t=0,o=this._voiceInfoErrorCallbacks.length;
t<o;
t++){
a=this._voiceInfoErrorCallbacks[t].run(e)||a
}}
this._voiceInfoCallbacks=null;
this._voiceInfoErrorCallbacks=null;
this._gettingVoiceInfo=false;
return a
};
ZmVoiceApp.prototype.refreshFolders=function(n,e){
if(this.phones.length){
var t=AjxSoapDoc.create("GetVoiceFolderRequest","urn:zimbraVoice");
this.setStorePrincipal(t);
var o=new AjxCallback(this,this._handleResponseUpdateFolders,[n]);
var a={
soapDoc:t,asyncMode:true,callback:o,errorCallback:e};
appCtxt.getAppController().sendRequest(a)
}else{
if(n){
n.run()
}}};
ZmVoiceApp.prototype._handleResponseUpdateFolders=function(r,t){
var a=t._data.GetVoiceFolderResponse.phone;
for(var o=0,n=a.length;
o<n;
o++){
var s=a[o];
var e=this._nameToPhone[s.name];
if(e){
this._updateFolders(e,s.folder[0].folder)
}}
if(r){
r.run()
}};
ZmVoiceApp.prototype._updateFolders=function(t,r){
var s=t.folderTree;
for(var a=0,n=r.length;
a<n;
a++){
var e=r[a];
var o=s.getByName(e.name);
if(o){
o.notifyModify(e)
}}};
ZmVoiceApp.prototype.search=function(o,r,s){
var e=(o.getSearchType()==ZmItem.VOICEMAIL)?ZmId.VIEW_VOICEMAIL:ZmId.VIEW_CALL_LIST;
if((e==ZmId.VIEW_VOICEMAIL)&&!o.phone.hasVoiceMail){
AjxDispatcher.run("GetVoiceController").show(null,o);
this._setupOverviewContainer();
if(r){
r.run(null)
}}else{
if(!s){
s=appCtxt.get(ZmSetting.SORTING_PREF,e)
}
var n={
soapInfo:this.soapInfo,types:AjxVector.fromArray([o.getSearchType()]),sortBy:s,query:o.getSearchQuery(),limit:this.getLimit()};
var t=new ZmSearch(n);
var a=new AjxCallback(this,this._handleResponseSearch,[o,r]);
t.execute({
callback:a}
)
}};
ZmVoiceApp.prototype._handleResponseSearch=function(e,l,t){
var o=t._data;
var n=o.getResults(e.getSearchType());
n.folder=e;
var r=(e.getSearchType()==ZmItem.VOICEMAIL)?AjxDispatcher.run("GetVoiceController"):AjxDispatcher.run("GetCallListController");
r.show(o,e);
this._setupOverviewContainer();
this.selectFolderInOverview(e);
var a=o.getAttribute("vfi");
if(a){
e.notifyModify(a[0])
}
if(this._paramId){
var s=r.getList();
var c=s.getById(this._paramId);
if(c){
var h=r.getCurrentView();
h.setSelection(c,true);
h.setPlaying(c)
}}
if(l){
l.run(o)
}};
ZmVoiceApp.prototype._setupOverviewContainer=function(){
this.getOverviewContainer();
if(!this._overviewContainer.initialized){
var e=this._getOverviewParams();
e.overviewTrees=this._getOverviewTrees();
e.phones=this.phones;
this._overviewContainer.initialize(e)
}};
ZmVoiceApp.prototype.markItemsHeard=function(t,a,n,e){
var o=a?"read":"!read";
this._performAction(t,o,null,n,e)
};
ZmVoiceApp.prototype._performAction=function(l,r,o,d,s){
if(!l.length){
if(d){
d.run(l)
}
return
}
var e=[];
for(var n=0,h=l.length;
n<h;
n++){
e[n]=l[n].id
}
var c=AjxSoapDoc.create("VoiceMsgActionRequest","urn:zimbraVoice");
this.setStorePrincipal(c);
var t=c.set("action");
t.setAttribute("op",r);
t.setAttribute("id",e.join(","));
t.setAttribute("phone",l[0].getPhone().name);
for(var n in o){
t.setAttribute(n,o[n])
}
var a={
soapDoc:c,asyncMode:true,callback:d,errorCallback:s};
appCtxt.getAppController().sendRequest(a)
};
ZmVoiceApp.prototype.launch=function(e,t){
this._showApp(e,t)
};
ZmVoiceApp.prototype._showApp=function(t,a){
this._paramId=(t.qsParams?t.qsParams.id:null);
var e=new AjxCallback(this,this._handleLoadLaunch,[a]);
AjxDispatcher.require("Voicemail",true,e,null,true)
};
ZmVoiceApp.prototype._handleLoadLaunch=function(a){
var t=new AjxCallback(this,this._handleResponseLoadLaunchGotInfo,a);
var e=new AjxCallback(this,this._handleErrorLoadLaunchGotInfo,a);
this.getVoiceInfo(t,e)
};
ZmVoiceApp.prototype._handleErrorLoadLaunchGotInfo=function(o,e){
var a;
this._loadError=true;
switch(e.code){
case"voice.SECONDARY_NOT_ALLOWED":this._showUpsellMessage();
a=true;
break;
case"voice.UNABLE_TO_RETRIEVE_PROFILE_SUMMARY":default:var t=appCtxt.getApp(ZmVoiceApp.overviewFallbackApp);
if(t){
t.launch()
}
a=false;
break
}
this.setOverviewPanelContent(false);
if(o instanceof AjxCallback){
o.run()
}
return a
};
ZmVoiceApp.prototype._showUpsellMessage=function(){
if(!this._showingSecondaryMessage){
this._showingSecondaryMessage=true;
var e=new DwtControl({
parent:appCtxt.getShell(),posStyle:Dwt.ABSOLUTE_STYLE}
);
e.setScrollStyle(DwtControl.SCROLL);
e.getHtmlElement().innerHTML=ZMsg["voice.SECONDARY_NOT_ALLOWED_VOICE"];
var t={};
t[ZmAppViewMgr.C_APP_CONTENT_FULL]=e;
var a="VoiceMessage";
this.createView({
viewId:a,appName:this._name,elements:t,isAppView:true}
);
this.pushView(a,true)
}};
ZmVoiceApp.prototype._handleResponseLoadLaunchGotInfo=function(a,e){
this._loadError=false;
var t=this.getStartFolder();
if(t){
this.search(t,a)
}else{
if(a){
a.run()
}}};
ZmVoiceApp.prototype.setStartPhone=function(e,a){
this._startPhone=e;
if(a){
var t=this.getStartFolder();
if(this.view!=ZmId.VIEW_VOICEMAIL){
this.pushView(ZmId.VIEW_VOICEMAIL)
}
if(this.getVoiceController().getFolder()!=t){
this.search(t);
this.getVoiceController().setFolder(t,true)
}
this.selectFolderInOverview(t)
}};
ZmVoiceApp.prototype.getStartFolder=function(t){
var n=0;
var o=t||this._startPhone;
if(o){
for(var a=0;
a<this.phones.length;
a++){
var e=this.phones[a];
if(e.name==o){
n=a
}}}
return this.phones[n].folderTree.getByName(ZmVoiceFolder.VOICEMAIL)
};
ZmVoiceApp.prototype.selectFolderInOverview=function(e){
var a=this.getOverviewContainer().getOverviews();
for(id in a){
var t=a[id];
if(t.phone==e.phone){
t.setSelected(e.id,"Voice")
}else{
t.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(t){
var a=t.set("storeprincipal");
for(var e in this._storeprincipal){
a.setAttribute(e,this._storeprincipal[e])
}};
ZmVoiceApp.prototype.setOverviewPanelContent=function(t){
if((this._showingSecondaryMessage||this._loadError)&&ZmVoiceApp.overviewFallbackApp){
var e=appCtxt.getApp(ZmVoiceApp.overviewFallbackApp);
if(e){
return e.setOverviewPanelContent(t)
}}
return ZmApp.prototype.setOverviewPanelContent.call(this,t)
};
ZmVoiceApp.prototype.redoSearch=function(){
var t=appCtxt.getAppViewMgr().getAppView(ZmApp.VOICE);
if(t){
var e;
if(t==ZmId.VIEW_VOICEMAIL){
e=AjxDispatcher.run("GetVoiceController")
}else{
if(t==ZmId.VIEW_CALL_LIST){
e=AjxDispatcher.run("GetCallListController")
}}
if(e){
this.search(e.getFolder())
}}};
ZmVoiceApp.prototype._handleDeletes=function(e){};
ZmVoiceApp.prototype._handleCreates=function(e){};
ZmVoiceApp.prototype._handleModifies=function(e){};
ZmVoiceApp.prototype._getOverviewTrees=function(){
return[ZmOrganizer.VOICE]
}
}
if(AjxPackage.define("zimbraMail.mixed.ZmMixedApp")){
ZmMixedApp=function(e){
ZmApp.call(this,ZmApp.MIXED,e)
};
ZmItem.MIXED="MIXED";
ZmApp.MIXED=ZmId.APP_MIXED;
ZmApp.CLASS[ZmApp.MIXED]="ZmMixedApp";
ZmApp.SETTING[ZmApp.MIXED]=ZmSetting.MIXED_VIEW_ENABLED;
ZmApp.LOAD_SORT[ZmApp.MIXED]=50;
ZmMixedApp.prototype=new ZmApp;
ZmMixedApp.prototype.constructor=ZmMixedApp;
ZmMixedApp.prototype.toString=function(){
return"ZmMixedApp"
};
ZmMixedApp.prototype._defineAPI=function(){
AjxDispatcher.registerMethod("GetMixedController","Mixed",new AjxCallback(this,this.getMixedController))
};
ZmMixedApp.prototype._registerItems=function(){
ZmItem.registerItem(ZmItem.MIXED,{
app:ZmApp.MIXED}
)
};
ZmMixedApp.prototype._registerApp=function(){
var e=[],t=[];
if(appCtxt.get(ZmSetting.MAIL_ENABLED)){
e.push(ZmOrganizer.FOLDER);
t.push(ZmItem.MSG,ZmItem.CONV)
}
if(appCtxt.get(ZmSetting.CONTACTS_ENABLED)){
e.push(ZmOrganizer.ADDRBOOK)
}
if(appCtxt.get(ZmSetting.CALENDAR_ENABLED)){
e.push(ZmOrganizer.CALENDAR)
}
if(appCtxt.get(ZmSetting.TASKS_ENABLED)){
e.push(ZmOrganizer.TASKS)
}
if(appCtxt.get(ZmSetting.BRIEFCASE_ENABLED)){
e.push(ZmOrganizer.BRIEFCASE)
}
e.push(ZmOrganizer.SEARCH,ZmOrganizer.TAG);
ZmApp.registerApp(ZmApp.MIXED,{
mainPkg:"Mixed",nameKey:"zimbraTitle",icon:"Globe",overviewTrees:e,searchTypes:t}
)
};
ZmMixedApp.prototype.launch=function(){};
ZmMixedApp.prototype._getOverviewTrees=function(){
var a=ZmApp.OVERVIEW_TREES[this._name];
var e=[];
var n=appCtxt.getAppController().getPreviousApp();
for(var t=0;
t<a.length;
t++){
var o=a[t];
if((n==ZmApp.CONTACTS&&o==ZmOrganizer.FOLDER)||(n!=ZmApp.CONTACTS&&o==ZmOrganizer.ADDRBOOK)){
continue
}
e.push(o)
}
return e
};
ZmMixedApp.prototype.showSearchResults=function(t,a){
var e=new AjxCallback(this,this._handleLoadShowSearchResults,[t,a]);
AjxDispatcher.require(["MailCore","Mail","Mixed"],false,e,null,true)
};
ZmMixedApp.prototype._handleLoadShowSearchResults=function(e,t){
this.getMixedController().show(e);
if(t){
t.run()
}};
ZmMixedApp.prototype.getMixedController=function(){
if(!this._mixedController){
this._mixedController=new ZmMixedController(this._container,this)
}
return this._mixedController
}
}}
if(AjxPackage.define("dwt.Widgets")){
AjxTemplate.register("dwt.Widgets#DwtAlert",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td width=1%><div id='";
e[a++]=n.id;
e[a++]="_icon' style='margin-right:5px;'></div></td><td width=99%><table border=0 cellpadding=0 cellspacing=0><tr><td id='";
e[a++]=n.id;
e[a++]="_title' class='DwtAlertTitle'></td></tr><tr><td id='";
e[a++]=n.id;
e[a++]="_content' class='DwtAlertContent'></td></tr></table></td><td width=1%><div id='";
e[a++]=n.id;
e[a++]="_dismiss' style='margin-left:5px;'></div></td></tr></table>";
return o?e.length:e.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(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='2' cellspacing='0' border='0'><tr><td><label id='";
e[a++]=n.id;
e[a++]="_text_left' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:right'></label></td><td><input id='";
e[a++]=n.id;
e[a++]="_input' name='";
e[a++]=n.name;
e[a++]="' value='";
e[a++]=n.value;
e[a++]="' type='checkbox' ";
e[a++]=n.checked;
e[a++]="></td><td><label id='";
e[a++]=n.id;
e[a++]="_text_right' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:left'></label></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtCheckbox"}
,false);
AjxTemplate.register("dwt.Widgets#DwtRadioButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='2' cellspacing='0' border='0'><tr><td><label id='";
e[a++]=n.id;
e[a++]="_text_left' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:right'></label></td><td><input id='";
e[a++]=n.id;
e[a++]="_input' name='";
e[a++]=n.name;
e[a++]="' value='";
e[a++]=n.value;
e[a++]="' type='radio' ";
e[a++]=n.checked;
e[a++]="></td><td><label id='";
e[a++]=n.id;
e[a++]="_text_right' for='";
e[a++]=n.id;
e[a++]="_input' class='Text' style='text-align:left'></label></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtRadioButton"}
,false);
AjxTemplate.register("dwt.Widgets#DwtBaseDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtDialog WindowOuterContainer'><table cellspacing=0 cellpadding=0><tr id='";
e[a++]=n.dragId;
e[a++]="'><td class='minWidth'>";
e[a++]=n.icon;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_title' class='DwtDialogTitle'>";
e[a++]=n.title;
e[a++]="</td><td class='minWidth'><div class='";
e[a++]=n.closeIcon2;
e[a++]="'></div></td><td class='minWidth'><div class='";
e[a++]=n.closeIcon1;
e[a++]="'></div></td></tr><tr><td class='WindowInnerContainer' colspan='4'><div id='";
e[a++]=n.id;
e[a++]="_content' class='DwtDialogBody'></div>";
if(n.controlsTemplateId){
e[a++]=AjxTemplate.expand(n.controlsTemplateId,n)
}
e[a++]="</td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtBaseDialog",height:"32",width:"20"}
,false);
AjxTemplate.register("dwt.Widgets#DwtDialogControls",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='horizSep'></div><div id='";
e[a++]=n.id;
e[a++]="_buttons' class='DwtDialogButtonBar'>";
if(AjxEnv.isNav){
e[a++]="<input type='button' id='";
e[a++]=n.id;
e[a++]="_focus' style='height:0px;width:0px;display:none;'>"
}
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtDialogControls"}
,false);
AjxTemplate.register("dwt.Widgets#DwtSemiModalDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtDialog LightWindowOuterContainer'><table cellspacing=0 cellpadding=0 style='cursor:move;'><tr id='";
e[a++]=n.dragId;
e[a++]="'><td class='minWidth'>";
e[a++]=n.icon;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_title' class='DwtDialogTitle'>";
e[a++]=n.title;
e[a++]="</td><td class='minWidth'><div class='";
e[a++]=n.closeIcon2;
e[a++]="'></div></td><td class='minWidth'><div class='";
e[a++]=n.closeIcon1;
e[a++]="'></div></td></tr><tr><td class='LightWindowInnerContainer full_size' colspan='4'><div id='";
e[a++]=n.id;
e[a++]="_content' class='DwtDialogBody'></div><div class='horizSep'></div><div id='";
e[a++]=n.id;
e[a++]="_buttons' class='DwtDialogButtonBar'>";
if(AjxEnv.isNav){
e[a++]="<input type='button' id='";
e[a++]=n.id;
e[a++]="_focus' style='height:0px;width:0px;display:none;'>"
}
e[a++]="</div></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtSemiModalDialog",height:"32",width:"20"}
,false);
AjxTemplate.register("dwt.Widgets#DwtToolTip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="TopPointer' class='DwtToolTipTopPointer'><center><div class='DwtToolTipPointerRow' style='width:1px;'> </div><div class='DwtToolTipPointerRow' style='width:3px;'> </div><div class='DwtToolTipPointerRow' style='width:5px;'> </div><div class='DwtToolTipPointerRow' style='width:7px;'> </div><div class='DwtToolTipPointerRow' style='width:9px;'> </div><div class='DwtToolTipPointerRow' style='width:11px;'> </div><div class='DwtToolTipPointerRow' style='width:13px;'> </div><div class='DwtToolTipPointerRow' style='width:15px;'> </div><div class='DwtToolTipPointerRow' style='width:17px;'> </div><div class='DwtToolTipPointerRow' style='width:19px;'> </div><div class='DwtToolTipPointerRow' style='width:21px;'> </div></center></div><div id='";
e[a++]=n.id;
e[a++]="Contents' class='DwtToolTipBody'></div><div id='";
e[a++]=n.id;
e[a++]="BottomPointer' class='DwtToolTipBottomPointer'><center><div class='DwtToolTipPointerRow' style='width:21px;'> </div><div class='DwtToolTipPointerRow' style='width:19px;'> </div><div class='DwtToolTipPointerRow' style='width:17px;'> </div><div class='DwtToolTipPointerRow' style='width:15px;'> </div><div class='DwtToolTipPointerRow' style='width:13px;'> </div><div class='DwtToolTipPointerRow' style='width:11px;'> </div><div class='DwtToolTipPointerRow' style='width:9px;'> </div><div class='DwtToolTipPointerRow' style='width:7px;'> </div><div class='DwtToolTipPointerRow' style='width:5px;'> </div><div class='DwtToolTipPointerRow' style='width:3px;'> </div><div class='DwtToolTipPointerRow' style='width:1px;'> </div></center></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtToolTip",height:"5",width:"5"}
,false);
AjxTemplate.register("dwt.Widgets#DwtVerticalSash",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtVerticalSash'><center><div class='ImgVSash_thumb'></div></center></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtVerticalSash",height:"0",width:"0"}
,false);
AjxTemplate.register("dwt.Widgets#DwtHorizontalSash",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DwtHorizontalSash'><table cellspacing=0 cellpadding=0 height='100%'><tr><td height='100%' valign='middle'><div class='ImgHSash_thumb'></div></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtHorizontalSash",height:"0",width:"0"}
,false);
AjxTemplate.register("dwt.Widgets#DwtMissingSoundPlayer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='DwtMissingSoundPlayer'><tr><td nowrap class='ImgCritical'> </td><td nowrap>";
e[a++]=ZmMsg.missingPlugin;
e[a++]="</td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtMissingSoundPlayer"}
,false);
AjxTemplate.register("dwt.Widgets#DwtVerticalSlider",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_button' class='DwtThumb DwtSliderThumb'><div class='DwtSliderThumbBorder'><div class='ImgVerticalSliderThumb'></div></div></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtVerticalSlider","class":"DwtSlider DwtVerticalSlider"}
,false);
AjxTemplate.register("dwt.Widgets#DwtHorizontalSlider",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_button' class='DwtThumb DwtSliderThumb'><div class='DwtSliderThumbBorder'><div class='ImgHorizontalSliderThumb'></div></div></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtHorizontalSlider","class":"DwtSlider DwtHorizontalSlider"}
,false);
AjxTemplate.register("dwt.Widgets#ZLabel",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZLabelBorder' cellspacing=0 cellpadding=0><tr><td id='";
e[a++]=n.id;
e[a++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'></td><td id='";
e[a++]=n.id;
e[a++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZLabel","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Button";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_dropdown' class='ZDropDown'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
n.buttonClass=n.buttonClass||"ToolbarButton";
e[a++]=AjxTemplate.expand("#ZButton",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZBorderlessButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Button";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_dropdown' class='ZDropDown'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZBorderlessButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZLinkButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='DwtLinkButtonTable' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td class='ZWidgetTitle'><a href='javascript:;' onclick='return false;' id='";
e[a++]=n.id;
e[a++]="_title'></a></td><td id='";
e[a++]=n.id;
e[a++]="_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 o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZLinkButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZButtonColorDisplay",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_color' class='DwtButtonColorPicker-display' unselectable></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZButtonColorDisplay"}
,false);
AjxTemplate.register("dwt.Widgets#DwtComboBox",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0><tr><td width=*><div id='";
e[a++]=n.id;
e[a++]="_input'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_button'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtComboBox","class":"DwtComboBox"}
,false);
AjxTemplate.register("dwt.Widgets#DwtComboBoxButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Button";
t[o++]="<table class='Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0><tr><td id='";
t[o++]=s.id;
t[o++]="_dropdown' class='ZDropDown'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#DwtComboBoxButton","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_tabbar'></div><div id='";
e[a++]=n.id;
e[a++]="_page'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabView","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0><tr valign='bottom' id='";
e[a++]=n.id;
e[a++]="_items'>";
e[a++]=AjxTemplate.expand("#ZTabBarPrefix",n);
e[a++]=AjxTemplate.expand("#ZTabBarSuffix",n);
e[a++]="</tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBar","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarFloat",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_items'>";
e[a++]=AjxTemplate.expand("#ZTabBarPrefixFloat",n);
e[a++]=AjxTemplate.expand("#ZTabBarSuffixFloat",n);
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarFloat","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarPrefixFloat",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_prefix' class='ZTabBarPrefix'> </div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarPrefixFloat"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarSuffixFloat",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_suffix' class='ZTabBarSuffix'> </div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarSuffixFloat"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarPrefix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<td id='";
e[a++]=n.id;
e[a++]="_prefix' class='ZTabBarPrefix'> </td>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarPrefix"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabBarSuffix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<td id='";
e[a++]=n.id;
e[a++]="_suffix' class='ZTabBarSuffix'> </td>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabBarSuffix"}
,false);
AjxTemplate.register("dwt.Widgets#ZTab",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Tab";
t[o++]="<table id='";
t[o++]=s.id;
t[o++]="_select' class='Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border ZWidgetTable ZWidgetBorder' cellspacing=0 cellpadding=0><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZTab","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabFloat",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"Tab";
t[o++]="<table id='";
t[o++]=s.id;
t[o++]="_select' class='Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border ZWidgetBorder' cellspacing=0 cellpadding=0><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"dwt.Widgets#ZTabFloat","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTabPage",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTabPage","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelectAutoSizingContainer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table border=0 cellpadding=0 cellspacing=0><tr><td id="';
e[a++]=n.id;
e[a++]='_select_container">';
e[a++]=AjxTemplate.expand(n.selectTemplateId,n.selectData);
e[a++]='</td></tr><tr><td><table id="';
e[a++]=n.id;
e[a++]='_pseudoitems_container" border=0 cellpadding=0 cellspacing=0></table></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelectAutoSizingContainer"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelect",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("#ZButton",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelect","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelectMenu",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("#ZMenu",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelectMenu","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZSelectMenuItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("#ZMenuItem",n);
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZSelectMenuItem","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZToolbarTable' border=0 cellpadding=0 cellspacing=0><tr id='";
e[a++]=n.id;
e[a++]="_items'>";
e[a++]=AjxTemplate.expand("#ZToolbarPrefix",n);
e[a++]=AjxTemplate.expand("#ZToolbarSuffix",n);
e[a++]="</tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbar","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarPrefix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarPrefix"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarSuffix",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarSuffix"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarItem"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarSeparator",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' class='ZToolbarSeparator'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarSeparator"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarSpacer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' class='ZToolbarSpacer'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarSpacer"}
,false);
AjxTemplate.register("dwt.Widgets#ZToolbarFiller",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' class='ZToolbarFiller' width='100%'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZToolbarFiller"}
,false);
AjxTemplate.register("dwt.Widgets#ZField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<input id='";
e[a++]=n.id;
e[a++]="_field' class='ZFieldInput'>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZField","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZTreeItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='";
e[a++]=n.divClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_div'><table id='";
e[a++]=n.id;
e[a++]="_table' border=0 cellpadding=0 cellspacing=0 width=100%><tr><td align=center nowrap id='";
e[a++]=n.id;
e[a++]="_nodeCell'></td>";
if(n.isCheckedStyle){
e[a++]="<td nowrap id='";
e[a++]=n.id;
e[a++]='_checkboxCell' class="ZTreeItemCheckboxCell"><div class="ZTreeItemCheckbox" id='';
e[a++]=n.id;
e[a++]="_checkbox'><div class="ZTreeItemCheckboxImg" id='";
e[a++]=n.id;
e[a++]="_checkboxImg'>";
e[a++]=AjxImg.getImageHtml("MenuCheck");
e[a++]="</div></div></td>"
}
e[a++]="<td nowrap class='imageCell' id='";
e[a++]=n.id;
e[a++]="_imageCell'></td><td width=100% nowrap class='";
e[a++]=n.textClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_textCell'></td><td width=16 class='imageCell' id='";
e[a++]=n.id;
e[a++]="_extraCell'></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZTreeItem"}
,false);
AjxTemplate.register("dwt.Widgets#ZHeaderTreeItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='";
e[a++]=n.divClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_div'><table id='";
e[a++]=n.id;
e[a++]="_table' border=0 cellpadding=0 cellspacing=0><tr>";
if(!n.noNodeCell){
e[a++]="<td align=center nowrap id='";
e[a++]=n.id;
e[a++]="_nodeCell'></td>"
}
e[a++]="<td nowrap class='imageCell' id='";
e[a++]=n.id;
e[a++]="_imageCell'></td><td nowrap class='";
e[a++]=n.textClassName;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_textCell' width="100%"></td><td class='";
e[a++]=n.textClassName;
e[a++]=" FakeAnchor' style="padding-right:4px"><div id='";
e[a++]=n.id;
e[a++]="_headerButton'/></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZHeaderTreeItem"}
,false);
AjxTemplate.register("dwt.Widgets#ZAccordion",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_div'><table class='ZAccordionTable ZWidget' border=0 cellspacing=0 cellpadding=0 id='";
e[a++]=n.id;
e[a++]="_accordion_table'></table></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZAccordion"}
,false);
AjxTemplate.register("dwt.Widgets#ZAccordionItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_header_";
e[a++]=n.itemNum;
e[a++]="' class='ZAccordionHeader'><table class='ZAccordionHeaderBorder ZWidgetTable' cellspacing=0 cellpadding=0><tr><td><div class='";
e[a++]=n.icon;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_icon_";
e[a++]=n.itemNum;
e[a++]="'></div></td><td><div class='ZAccordionTitle' id='";
e[a++]=n.id;
e[a++]="_title_";
e[a++]=n.itemNum;
e[a++]="'>";
e[a++]=n.title;
e[a++]="</div></td><td><div class='ImgAccordionClosed' id='";
e[a++]=n.id;
e[a++]="_status_";
e[a++]=n.itemNum;
e[a++]="'></div></td></tr></table></div><div class='ZAccordionBody' id='";
e[a++]=n.id;
e[a++]="_body_";
e[a++]=n.itemNum;
e[a++]="'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZAccordionItem"}
,false);
AjxTemplate.register("dwt.Widgets#DwtTabView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' border='0' cellspacing='0' cellpadding='0' backgroundColor='";
e[a++]=n.bgcolor;
e[a++]="'><tr align='left' valign='middle'><td id='";
e[a++]=n.id;
e[a++]="_tabs' class='DwtTabTable' nowrap align='left' valign='middle' width='100%'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtTabView"}
,false);
AjxTemplate.register("dwt.Widgets#DwtTabBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<!-- TODO -->";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtTabBar"}
,false);
AjxTemplate.register("dwt.Widgets#DwtTabSpacer",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' cellspacing='0' cellpadding='0'><tr></tr><tr></tr><tr><td><div class='ImgTabSpacer'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtTabSpacer"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenu",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_container' class='ZMenuBorder'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenu","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder' cellspacing=0 cellpadding=0><tr><td id='";
e[a++]=n.id;
e[a++]="_check' class='ZCheckIcon'><div></div></td><td id='";
e[a++]=n.id;
e[a++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'></td><td id='";
e[a++]=n.id;
e[a++]="_dropdown' class='ZDropDown'><div></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItem","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemSeparator",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder ZMenuItemSeparatorBorder' cellspacing=0 cellpadding=0><tr><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'><div class='ZMenuItem-Separator'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemSeparator","class":"ZWidget"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemBlankCheck",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZMenuItem-BlankCheck'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemBlankCheck"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemBlankIcon",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZMenuItem-BlankIcon'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemBlankIcon"}
,false);
AjxTemplate.register("dwt.Widgets#ZMenuItemBlankCascade",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZMenuItem-BlankCascade'></div>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#ZMenuItemBlankCascade"}
,false);
AjxTemplate.register("dwt.Widgets#DwtListView-NoResults",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' cellspacing=0 cellpadding=1><tr><td class='NoResults' valign='top'><br><br>";
e[a++]=n.message;
e[a++]="
";
e[a++]=" </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtListView-NoResults"}
,false);
AjxTemplate.register("dwt.Widgets#DwtPasswordField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='0' cellspacing='0' border='0'><tr><td><div id='";
e[a++]=n.id;
e[a++]="_input'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_show_password'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtPasswordField"}
,false);
AjxTemplate.register("dwt.Widgets#DwtFormRows",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table border=0 cellspacing=3 cellpadding=0><tbody id="';
e[a++]=n.id;
e[a++]='_rows" tabindex="100"></tbody></table>';
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtFormRows"}
,false);
AjxTemplate.register("dwt.Widgets#DwtFormRow",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table><tr id="';
e[a++]=n.id;
e[a++]='_row" class="DwtFormRow"><td><div id="';
e[a++]=n.id;
e[a++]='" tabindex="100"></div></td><td><div id="';
e[a++]=n.id;
e[a++]='_add" class="DwtFormRowAdd" tabindex="200"></div></td><td><div id="';
e[a++]=n.id;
e[a++]='_remove" class="DwtFormRowRemove" tabindex="300"></div></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtFormRow"}
,false);
AjxTemplate.register("dwt.Widgets#DwtColorPicker",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_colors'><div class='Text'>";
e[a++]=AjxMsg.colorsStandard;
e[a++]="</div><div class='Colors First'><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorRed;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorOrange;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorYellow;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorGreen;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorCyan;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorBlue;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorPurple;
e[a++]=";'></div><div class='Color' style='background-color:";
e[a++]=AjxMsg.colorPink;
e[a++]=";'></div><div class='Color' style='background-color:white;'></div><div class='Color' style='background-color:black;'></div></div><div class='Text'>";
e[a++]=AjxMsg.colorsCustom;
e[a++]="</div><div class='Colors First'><div class='Color' style='background-color:#ff8686;'></div><div class='Color' style='background-color:#ff9966;'></div><div class='Color' style='background-color:#ffff99;'></div><div class='Color' style='background-color:#ccffcc;'></div><div class='Color' style='background-color:#ccffff;'></div><div class='Color' style='background-color:#99ccff;'></div><div class='Color' style='background-color:#ccccff;'></div><div class='Color' style='background-color:#ffccff;'></div><div class='Color' style='background-color:#ededed;'></div><div class='Color' style='background-color:#808080;'></div></div><div class='Colors'><div class='Color' style='background-color:#ff0000;'></div><div class='Color' style='background-color:#ff6600;'></div><div class='Color' style='background-color:#ffcc33;'></div><div class='Color' style='background-color:#66cc66;'></div><div class='Color' style='background-color:#00cccc;'></div><div class='Color' style='background-color:#3366ff;'></div><div class='Color' style='background-color:#6666ff;'></div><div class='Color' style='background-color:#cc33cc;'></div><div class='Color' style='background-color:#d5d5d5;'></div><div class='Color' style='background-color:#666666;'></div></div><div class='Colors'><div class='Color' style='background-color:#cc0000;'></div><div class='Color' style='background-color:#cc6600;'></div><div class='Color' style='background-color:#cc9933;'></div><div class='Color' style='background-color:#009900;'></div><div class='Color' style='background-color:#339999;'></div><div class='Color' style='background-color:#3333ff;'></div><div class='Color' style='background-color:#6633ff;'></div><div class='Color' style='background-color:#993399;'></div><div class='Color' style='background-color:#cccccc;'></div><div class='Color' style='background-color:#4d4d4d;'></div></div><div class='Colors'><div class='Color' style='background-color:#990000;'></div><div class='Color' style='background-color:#993300;'></div><div class='Color' style='background-color:#996633;'></div><div class='Color' style='background-color:#006600;'></div><div class='Color' style='background-color:#336666;'></div><div class='Color' style='background-color:#000099;'></div><div class='Color' style='background-color:#330099;'></div><div class='Color' style='background-color:#663366;'></div><div class='Color' style='background-color:#b3b3b3;'></div><div class='Color' style='background-color:#333333;'></div></div><div class='Colors'><div class='Color' style='background-color:#330000;'></div><div class='Color' style='background-color:#663300;'></div><div class='Color' style='background-color:#333300;'></div><div class='Color' style='background-color:#003300;'></div><div class='Color' style='background-color:#003333;'></div><div class='Color' style='background-color:#000066;'></div><div class='Color' style='background-color:#330066;'></div><div class='Color' style='background-color:#330033;'></div><div class='Color' style='background-color:#aaaaaa;'></div><div class='Color' style='background-color:#1a1a1a;'></div></div></div>";
if(!n.hideNoFill){
e[a++]="<div class='Text' style='margin-top:4px;'><div id='";
e[a++]=n.id;
e[a++]="_default'></div></div>"
}
if(n.allowColorInput){
e[a++]="<div class='Text' style='margin-top:4px;'><table border="0" width='100%'><tr><td><div id='";
e[a++]=n.id;
e[a++]="_input'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_button'></div></td></tr></table><table class='DwtColorPickerLabel' border="0"><tr><td><div>";
e[a++]=AjxMsg.previewResult;
e[a++]="</div></td><td><div id='";
e[a++]=n.id;
e[a++]="_preview' class='Color'></div></td><td><div id='";
e[a++]=n.id;
e[a++]="_error'></div></td></tr></table></div>"
}
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtColorPicker"}
,false);
AjxTemplate.register("dwt.Widgets#DwtColorPickerButton",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder' cellspacing=0 cellpadding=0><tr><td><div id='";
e[a++]=n.id;
e[a++]="_color' class='Color'></div></td><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'
";
e[a++]=" ";
if(AjxEnv.isIE){
e[a++]="
";
e[a++]=" style='width:auto;'
";
e[a++]=" "
}
e[a++]="
";
e[a++]=" ></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"dwt.Widgets#DwtColorPickerButton","class":"ZWidget"}
,false)
}
if(AjxPackage.define("share.App")){
AjxTemplate.register("share.App#Loading",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 style='width:100%;height=100%'><tr><td align='center' valign='middle'><br><br><br>";
e[a++]=ZmMsg.loading;
e[a++]="<br><br><div class='Imgwait_64'></div><br><br><br></td></tr><tr><td style='height:100%'> </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.App#Loading"}
,false);
AjxTemplate.register("share.App",AjxTemplate.getTemplate("share.App#Loading"),AjxTemplate.getParams("share.App#Loading"));
AjxTemplate.register("share.App#Banner",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 style='width:100%;height:100%'><tr><td align='center' valign='middle'><a";
if(n.url&&n.url!=""){
e[a++]=" href='";
e[a++]=n.url;
e[a++]="' target='_blank'"
}
e[a++]="><div class='ImgAppBanner' ";
if(n.isOffline){
e[a++]=" style='width:220px;' "
}
e[a++]="></div></a></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.App#Banner"}
,false);
AjxTemplate.register("share.App#UserInfo",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='skin_table' cellpadding=0 cellspacing=0 border=0><!--
";
e[a++]=" ";
if(n.showOfflineLink){
e[a++]='<tr><td id='skin_td_switch_offline' colspan=3><a href="http://www.zimbra.com/products/desktop.html" target="_blank">';
e[a++]=ZmMsg.switchToOfflineClientEx;
e[a++]="</a></td></tr>"
}
e[a++]="
";
e[a++]="--><tr>";
if(n.adminUrl){
e[a++]='<td id="skin_container_adminlink"><a target="_blank" href="';
e[a++]=n.adminUrl;
e[a++]='">';
e[a++]=ZmMsg.adminLinkLabel;
e[a++]="</a></td>"
}
e[a++]="<td id='skin_container_help'><span id='skin_container_help_button'></span></td><td id='skin_container_logoff'><a href='javascript:;' onclick='ZmZimbraMail._onClickLogOff();'>";
e[a++]=n.logoutText;
e[a++]="</a></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.App#UserInfo"}
,false);
AjxTemplate.register("share.App#PrintView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<html><head><title>";
e[a++]=ZmMsg.zimbraLabel;
e[a++]=" ";
e[a++]=n.username;
e[a++]="</title><link rel='stylesheet' href='";
e[a++]=n.appContextPath;
e[a++]="/css/msgview,zm,wiki.css?v=";
e[a++]=n.cacheKillerVersion;
e[a++]="' media='screen'></link>";
if(n.onloadStr){
e[a++]="<script language='javascript'>
";
e[a++]=" function handleOnload() {
";
e[a++]=" ";
e[a++]=n.onloadStr;
e[a++]=";
";
e[a++]=" }
";
e[a++]=" </script></head><body onload='handleOnload();'>"
}else{
e[a++]="</head><body>"
}
e[a++]="<table border=0 width=100%><tr><td class='ZmPrintView-company'>";
e[a++]=ZmMsg.zimbraTitle;
e[a++]=" ";
e[a++]=ZmMsg.splashScreenAppName;
e[a++]="</td><td class='ZmPrintView-username' align=right>";
e[a++]=n.username;
e[a++]="</td></tr></table><hr><div style='padding:10px'>";
e[a++]=n.content;
e[a++]="</div></body></html>";
return o?e.length:e.join("")
}
,{
id:"share.App#PrintView"}
,false);
AjxTemplate.register("share.App#FolderTooltip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=0 cellspacing=0 border=0><tr><td valign='top' style='padding-right:20px'>";
e[a++]=AjxMessageFormat.format(ZmMsg.makeLabel,n.itemText);
e[a++]="</td><td valign='top'>";
e[a++]=n.numTotal;
e[a++]="</td></tr>";
if(n.sizeTotal){
e[a++]="<tr><td valign='top'>";
e[a++]=ZmMsg.sizeLabel;
e[a++]="</td><td valign='top'>";
e[a++]=AjxUtil.formatSize(n.sizeTotal);
e[a++]="</td></tr>"
}
e[a++]="</table>";
return o?e.length:e.join("")
}
,{
id:"share.App#FolderTooltip"}
,false);
AjxTemplate.register("share.App#ZimbraAccountTooltip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0>";
if(n.lastSync&&n.lastSync!=""){
e[a++]="<tr><td class='nobreak' align=right>";
e[a++]=ZmMsg.lastSync;
e[a++]=":</td><td class='nobreak'>";
e[a++]=n.lastSync;
e[a++]="</td></tr>"
}else{
if(n.hasNotSynced){
e[a++]="<tr><td class='nobreak' colspan=2>";
e[a++]=ZmMsg.neverSynced;
e[a++]="</td></tr>"
}}
if(n.status&&n.status!=""){
e[a++]="<tr><td align=right valign=top>";
e[a++]=ZmMsg.status;
e[a++]=":</td><td>";
e[a++]=n.status;
e[a++]="</td></tr>"
}
if(!n.hasNotSynced){
e[a++]="<tr><td align=right valign=top>";
e[a++]=ZmMsg.offlineQuota;
e[a++]="</td><td>";
e[a++]=n.quota;
e[a++]="</td></tr>"
}
e[a++]="</table>";
return o?e.length:e.join("")
}
,{
id:"share.App#ZimbraAccountTooltip"}
,false);
AjxTemplate.register("share.App#presenceButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"ToolbarButton";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.App#presenceButton","class":"ZWidget"}
,false);
AjxTemplate.register("share.App#ZmTaskbarItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_button' class='ZmTaskbarButtonParent'></div><div id='";
e[a++]=n.id;
e[a++]="_content' class='ZmTaskbarContentParent' style='display:none;'></div>";
return o?e.length:e.join("")
}
,{
id:"share.App#ZmTaskbarItem","class":"ZWidget"}
,false);
AjxTemplate.register("share.App#ZmStatusImageButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"ToolbarButton";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_status_icon' class='ZLeftIcon ZWidgetIcon'><div></div></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.App#ZmStatusImageButton","class":"ZWidget"}
,false);
AjxTemplate.register("share.App#NetworkStatus",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table border=0 width=90 cellpadding=0 cellspacing=0><tr><td class="ZmNetworkStatusIcon" onclick="ZmZimbraMail.handleNetworkStatusClick();" id="';
e[a++]=n.id;
e[a++]='_networkStatusText"></td><td class="ZmNetworkStatusIcon" align=right width=18 onclick="ZmZimbraMail.handleNetworkStatusClick();" id="';
e[a++]=n.id;
e[a++]='_networkStatusIcon"></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.App#NetworkStatus"}
,false)
}
if(AjxPackage.define("share.Dialogs")){
AjxTemplate.register("share.Dialogs#TableProperties",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table class="ZmHEDialog"><tr><td><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.description;
e[a++]='</legend><table width="100%"><tr><td class="Label" style="width: auto">';
e[a++]=ZmMsg.caption;
e[a++]='</td><td width="100%" id="';
e[a++]=n.id;
e[a++]='_Caption"></td></tr><tr><td class="Label" style="width: auto">';
e[a++]=ZmMsg.summary;
e[a++]='</td><td width="100%" id="';
e[a++]=n.id;
e[a++]='_Summary"></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.layout;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label">';
e[a++]=ZmMsg.tableWidth;
e[a++]='</td><td colspan="4"><table cellpadding="0" cellspacing="0"><tr><td style="padding-right: 2px"><input id="';
e[a++]=n.id;
e[a++]='_WidthAuto" checked="checked" name="';
e[a++]=n.id;
e[a++]='_WidthAuto" type="radio" /></td><td style="padding-right: 2em" colspan="2"><label for="';
e[a++]=n.id;
e[a++]='_WidthAuto">';
e[a++]=ZmMsg.auto;
e[a++]='</label></td></tr><tr><td style="padding-right: 2px"><input id="';
e[a++]=n.id;
e[a++]='_WidthAuto1" name="';
e[a++]=n.id;
e[a++]='_WidthAuto" type="radio" /></td><td style="padding-right: 3px" id="';
e[a++]=n.id;
e[a++]='_Width"></td><td id="';
e[a++]=n.id;
e[a++]='_WidthUnit"></td></tr></table></td></tr></table><table cellspacing="0" id="';
e[a++]=n.id;
e[a++]='_AdvancedMode1" style="margin-top: 4px; display: none"><tr><td class="Label">';
e[a++]=ZmMsg.tableAlignment;
e[a++]='</td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_Align"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td><table cellpadding="1" cellspacing="1"><tr><td><input type="checkbox" id="';
e[a++]=n.id;
e[a++]='_FixedLayout" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_FixedLayout">';
e[a++]=ZmMsg.fixedCellWidth;
e[a++]='</label></td></tr></table></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.textStyle;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label">';
e[a++]=ZmMsg.textAlign;
e[a++]='</td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_TextAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.fontColorLabel;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_ForegroundColor"></td></tr><tr><td class="Label">';
e[a++]=ZmMsg.verticalAlign;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_TextVAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.fontBackgroundLabel;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_BackgroundColor"></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.borderStyle;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label">';
e[a++]=ZmMsg.borderWidth;
e[a++]='</td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_BorderWidth"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.borderColorLabel;
e[a++]='</td><td><table cellspacing="0"><tr><td id="';
e[a++]=n.id;
e[a++]='_BorderColor"></td></tr></table></td></tr><tr><td class="Label">';
e[a++]=ZmMsg.cellPadding;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_CellPadding"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label">';
e[a++]=ZmMsg.borderStyleLabel;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_BorderStyle"></td></tr><tr id="';
e[a++]=n.id;
e[a++]='_AdvancedMode2" style="display: none"><td class="Label">';
e[a++]=ZmMsg.cellSpacing;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_BorderSpacing"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td colspan="2" style="padding: 2px 0 2px 0"><table cellpadding="1" cellspacing="1" align="center"><tr><td><input type="checkbox" id="';
e[a++]=n.id;
e[a++]='_BorderCollapse" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_BorderCollapse">';
e[a++]=ZmMsg.collapsedBorders;
e[a++]="</label></td></tr></table></td></tr></table></fieldset></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#TableProperties"}
,false);
AjxTemplate.register("share.Dialogs",AjxTemplate.getTemplate("share.Dialogs#TableProperties"),AjxTemplate.getParams("share.Dialogs#TableProperties"));
AjxTemplate.register("share.Dialogs#CellProperties",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table class="ZmHEDialog"><tr><td><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.borderStyle;
e[a++]='</legend><table width="100%"><tr><td style="width: 19em"><!-- If you're wondering why this has to be so complex, check out this bug:
';
e[a++]=' https://bugzilla.mozilla.org/show_bug.cgi?id=258255 --><div style="padding-left: 1em; padding-top: 1em">';
e[a++]=ZmMsg.clickToDrawABorder;
e[a++]='</div><div style="margin-top: 10px;"><table align="center"><tr><td>';
e[a++]=ZmMsg.styleLabel;
e[a++]="</td><td>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td>";
e[a++]=ZmMsg.widthLabel;
e[a++]='</td></tr><tr><td id="';
e[a++]=n.id;
e[a++]='_BorderStyle"></td><td><!-- embedded in a table so the widget doesn't enlarge --><table cellspacing="0" cellpadding="0"><tr><td id="';
e[a++]=n.id;
e[a++]='_BorderColor"></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_BorderWidth"></td></tr></table></div><table id="';
e[a++]=n.id;
e[a++]='_PreviewGridHolder" style="width: 100px; height: 100px;" cellspacing="0" cellpadding="0" align="center"><tr><td><table cellspacing="0" cellpadding="0" align="center"><tr><td><table id="';
e[a++]=n.id;
e[a++]='_PreviewGrid" style="border-collapse: collapse; background-color: #fff; border: 1px dashed #ccc;" cellspacing="0" cellpadding="0"><tr><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td></tr><tr><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td><td style="border: 1px dashed #ccc;"><div style="width: 30px; height: 30px;"></div></td></tr></table></td></tr></table></td></tr></table></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td valign="top"><div style="padding-left: 1em; padding-top: 1em; padding-bottom: 1em">';
e[a++]=ZmMsg.orPickAStyleBelow;
e[a++]='</div><table align="center" id="';
e[a++]=n.id;
e[a++]='_QuickBorders"><tr><td></td><td></td><td></td><td></td><td></td></tr></table></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.layout;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableWidth" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableWidth">';
e[a++]=ZmMsg.widthLabel;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_Width"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableHorizPadding" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableHorizPadding">';
e[a++]=ZmMsg.paddingHorizontal;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_HorizPadding"></td></tr><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableHeight" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableHeight">';
e[a++]=ZmMsg.heightLabel;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_Height"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableVertPadding" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableVertPadding">';
e[a++]=ZmMsg.paddingVertical;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_VertPadding"></td></tr></table></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.textStyle;
e[a++]='</legend><table cellspacing="0"><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableTextAlign" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableTextAlign">';
e[a++]=ZmMsg.textAlign;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_TextAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableForegroundColor" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableForegroundColor">';
e[a++]=ZmMsg.fontColorLabel;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_ForegroundColor"></td></tr><tr><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableTextVAlign" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableTextVAlign">';
e[a++]=ZmMsg.verticalAlign;
e[a++]='</label></td></tr></table></td><td class="col2" id="';
e[a++]=n.id;
e[a++]='_TextVAlign"></td><td class="VSep-L"> </td><td class="VSep-R"> </td><td class="Label"><table align="right" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 3px"><input id="';
e[a++]=n.id;
e[a++]='_EnableBackgroundColor" type="checkbox" /></td><td><label for="';
e[a++]=n.id;
e[a++]='_EnableBackgroundColor">';
e[a++]=ZmMsg.fontBackgroundLabel;
e[a++]='</label></td></tr></table></td><td id="';
e[a++]=n.id;
e[a++]='_BackgroundColor"></td></tr></table></fieldset></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#CellProperties"}
,false);
AjxTemplate.register("share.Dialogs#EditorInsertLink",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<table class="ZmHEDialog"><tr><td><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.linkText;
e[a++]="</legend>";
e[a++]=ZmMsg.linkTextDesc;
e[a++]='<br /><div id="';
e[a++]=n.id;
e[a++]='_linkTextCont"></div></fieldset><fieldset class="ZmFieldset"><legend class="ZmLegend">';
e[a++]=ZmMsg.linkTarget;
e[a++]="</legend>";
e[a++]=ZmMsg.linkTargetDesc;
e[a++]='<br /><table cellspacing="0" cellpadding="0"><tr><td id="';
e[a++]=n.id;
e[a++]='_linkTargetCont" style="padding-right: 5px"></td><td id="';
e[a++]=n.id;
e[a++]='_testBtnCont"></td></tr></table></fieldset></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#EditorInsertLink"}
,false);
AjxTemplate.register("share.Dialogs#NewSearch",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='0' cellspacing='0' border='0' ";
e[a++]=AjxEnv.isWebKitBased?"width='320'>":">";
e[a++]="<tr><td class='Label' colspan=2 style='padding: 0px 0px 5px 0px;'>";
e[a++]=ZmMsg.searchName;
e[a++]=" </td></tr><tr><td><input autocomplete=OFF type='text' class='Field' id='";
e[a++]=n.id;
e[a++]="_nameField' /></td></tr><tr><td> </td></tr><tr><td><div id='";
e[a++]=n.id;
e[a++]='_overviewDiv'><div class="Label">';
e[a++]=ZmMsg.newSearchParent;
e[a++]="</div><div id='";
e[a++]=n.id;
e[a++]="_folderTreeCell'></div></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#NewSearch"}
,false);
AjxTemplate.register("share.Dialogs#ZmMountFolderDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 width=375><tr><td colspan=2>";
e[a++]=ZmMsg.mountInstructions1;
e[a++]="</td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.emailLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_email'></td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.folderLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_folder'></td></tr><tr><td><br></td></tr><tr><td colspan=2>";
e[a++]=ZmMsg.mountInstructions2;
e[a++]="</td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.nameLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_name'></td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_color'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmMountFolderDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmPromptDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=2 cellspacing=0 border=0><tr><td class='Label' id='";
e[a++]=n.id;
e[a++]="_label'/></tr><tr><td><input type=";
e[a++]=n.type;
e[a++]=" autocomplete=OFF class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmPromptDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmPromptDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=2 cellspacing=0 border=0><tr><td class='Label'>";
e[a++]=ZmMsg.tagName;
e[a++]=":</td>";
if(appCtxt.multiAccounts){
e[a++]="<td class='Label'>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td class='Label'>";
e[a++]=ZmMsg.accountLabel;
e[a++]="</td>"
}
e[a++]="</tr><tr><td><input type=text autocomplete=OFF id='";
e[a++]=n.id;
e[a++]="_name' /></td><td id='";
e[a++]=n.id;
e[a++]="_tagColor' style="padding-right: 16px;"></td><td id='";
e[a++]=n.id;
e[a++]="_account'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmPromptDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmTimezonePicker",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding=4 cellspacing=0 border=0><tr><td colspan='2' class='Label'>";
e[a++]=ZmMsg.selectTimezoneInfo;
e[a++]="</td></tr><tr><td width=50 align=right>";
e[a++]=ZmMsg.selectTimezoneLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_tzSelect'></td></tr><tr><td></td><td id='";
e[a++]=n.id;
e[a++]="_tzShowAll'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmTimezonePicker"}
,false);
AjxTemplate.register("share.Dialogs#ZmAttachDialog-MyComputerTab",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div style='overflow:auto'><form accept-charset='utf-8' method='POST' action='";
e[a++]=n.uri;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_uploadForm' enctype='multipart/form-data'><input type='hidden' name='_charset_' /><table id='";
e[a++]=n.id;
e[a++]="_attachmentTable' cellspacing=0 cellpadding=0 border=0 class='iframeTable'></table></form></div><div><table id='";
e[a++]=n.id;
e[a++]="_attachmentButtonTable'></table></div>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmAttachDialog-MyComputerTab"}
,false);
AjxTemplate.register("share.Dialogs#ZmAttachDialog-MyComputerTab-AddAttachment",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellspacing=2 cellpadding=0 border=0><tr><td><div class='attachText'>";
e[a++]=ZmMsg.attach;
e[a++]=":</div></td><td class='nobreak'><input id='";
e[a++]=n.id;
e[a++]="_input' type='file' multiple name='";
e[a++]=n.uploadName;
e[a++]="' size=40>
";
e[a++]=" <span id='";
e[a++]=n.id;
e[a++]='_remove' onmouseover='this.style.cursor="pointer"' onmouseout='this.style.cursor="default"' class="ZmAttachDialog-removeLink">';
e[a++]=ZmMsg.remove;
e[a++]="</span><span id='";
e[a++]=n.id;
e[a++]="_size'> </span></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmAttachDialog-MyComputerTab-AddAttachment"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogRemote",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td colspan=2><table cellpadding=0 cellspacing=5 border=0><tr valign='center'><td class='Label'><input type='checkbox' id='";
e[a++]=n.id;
e[a++]="_remote' /></td><td>
";
e[a++]=" ";
e[a++]=n.remoteLabel;
e[a++]="
";
e[a++]=" </td></tr></table></td></tr><tr style='display:none;' id='";
e[a++]=n.id;
e[a++]="_remoteURLrow' valign='center'><td class='Label'>";
e[a++]=ZmMsg.urlLabel;
e[a++]="</td><td><input autocomplete='off' type='text' class='Field' id='";
e[a++]=n.id;
e[a++]="_remoteURLfield' /></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogRemote"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogName",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr valign='center'><td class='Label'>";
e[a++]=ZmMsg.nameLabel;
e[a++]="</td><td><input autocomplete='off' type='text' class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogName"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogColor",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td class='Label'>";
e[a++]=ZmMsg.colorLabel;
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_colorSelect'></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogColor"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewOrgDialogFolder",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td class='Label' colspan=2>";
e[a++]=ZmMsg.newFolderParent;
e[a++]="</td></tr><tr><td colspan=2 id='";
e[a++]=n.id;
e[a++]="_folderTree'></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewOrgDialogFolder"}
,false);
AjxTemplate.register("share.Dialogs#ZmSelectAddrDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<tr><td colspan=2> </td></tr><tr><td class="Label" style="padding-right: 5px">Addresses: </td><td id='';
e[a++]=n.id;
e[a++]="_addrListTd'></td></tr><tr><td colspan='2'><input id='";
e[a++]=n.id;
e[a++]="_cboxFind' type='checkbox' name='cbFind' checked></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmSelectAddrDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmNewCalDialogFreeBusy",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td colspan=2><table cellpadding=0 cellspacing=5 border=0><tr valign='center'><td class='Label'><input type='checkbox' id='";
e[a++]=n.id;
e[a++]="_excludeFbCheckbox' /></td><td>";
e[a++]=ZmMsg.excludeFromFreeBusy;
e[a++]="</td></tr></table></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmNewCalDialogFreeBusy"}
,false);
AjxTemplate.register("share.Dialogs#ZmRenameDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='0' cellspacing='0' border='0'><tr><td class='Label' colspan=2 style='padding: 0px 0px 5px 0px;'>";
e[a++]=n.newLabel;
e[a++]=": </td></tr><tr><td><input type='text' autocomplete='off' class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmRenameDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmPasswordUpdateDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table cellpadding='2' cellspacing='5' border='0'><tr><td colspan="2" id="";
e[a++]=n.id;
e[a++]="_desc"></td></tr><tr><td class='Label' align="right" style='padding:0 px;'>";
e[a++]=n.labelAcct;
e[a++]=': </td><td id="';
e[a++]=n.id;
e[a++]="_acct"></td></tr><tr><td class='Label' align="right" style='padding: 0 px;'>";
e[a++]=n.labelPasswd;
e[a++]=": </td><td><input type='password' style='padding:0 px;' autocomplete='off' class='Field' id='";
e[a++]=n.id;
e[a++]="_name' /></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmPasswordUpdateDialog"}
,false);
AjxTemplate.register("share.Dialogs#ZmTimeDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 width=330><tr><td colspan=2 id='";
e[a++]=n.id;
e[a++]="_description'>";
e[a++]=n.description;
e[a++]="</td></tr><tr><td class='Label'>";
e[a++]=n.label;
e[a++]=":</td><td><table border=0 cellpadding=0 cellspacing=0><tr><td>";
e[a++]=AjxTemplate.expand("#DateField",{
id:n.id+"_date"}
);
e[a++]="</td><td id='";
e[a++]=n.id;
e[a++]="_miniCal'></td><td> </td><td id='";
e[a++]=n.id;
e[a++]="_time'></td></tr></table></td></tr><tr><td width=50><nobr>";
e[a++]=ZmMsg.selectTimezoneLabel;
e[a++]="</nobr></td><td id='";
e[a++]=n.id;
e[a++]="_tzSelect'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#ZmTimeDialog"}
,false);
AjxTemplate.register("share.Dialogs#DateField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<input autocomplete='off' style='height:22px;' type='text' size=14 id='";
e[a++]=n.id;
e[a++]="' value='";
e[a++]=n.value;
e[a++]="'>";
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#DateField"}
,false);
AjxTemplate.register("share.Dialogs#UploadDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<div style='overflow:auto'><div id="{id}_label" style="margin-bottom:0.5em;">';
e[a++]=ZmMsg.uploadChoose;
e[a++]="</div><div style="margin-bottom:0.5em;margin-left:1em;"><form accept-charset='utf-8' method='POST' action='";
e[a++]=n.uri;
e[a++]="' id='";
e[a++]=n.id;
e[a++]="_form' enctype='multipart/form-data'><table id='";
e[a++]=n.id;
e[a++]='_table' cellspacing=4 cellpadding=3 border=0></table></form></div><table border=0 cellpadding="0" cellspacing="4"><tr id="';
e[a++]=n.id;
e[a++]='_actionRow"><td>';
e[a++]=ZmMsg.uploadAction;
e[a++]='</td><td id="';
e[a++]=n.id;
e[a++]='_conflict"></td></tr><tr><td colspan="2" id="';
e[a++]=n.id;
e[a++]='_notesTD"><div>';
e[a++]=ZmMsg.notesLabel;
e[a++]='</div><textarea id="';
e[a++]=n.id;
e[a++]='_notes" style="height: 80px; width: 450px;"></textarea></td></tr><tr><td colspan="2" id="';
e[a++]=n.id;
e[a++]='_info"></td></tr><tr><td colspan="2" id="';
e[a++]=n.id;
e[a++]='_msg"></td></tr></table></div>';
return o?e.length:e.join("")
}
,{
id:"share.Dialogs#UploadDialog"}
,false)
}
if(AjxPackage.define("share.Quota")){
AjxTemplate.register("share.Quota#UsedLimited",function(t,r,s,e){
var n=Boolean(e);
s=(typeof s=="string"?{
id:s}
:s)||{};
e=e||[];
var o=e.length;
var a="quotaUsed";
if(s.percent<85&&s.percent>65){
a="quotaWarning"
}else{
if(s.percent>=85){
a="quotaCritical"
}}
e[o++]="<div class='BannerBar'><div class='quotabar'><div style='width:";
e[o++]=s.percent;
e[o++]="%' class='";
e[o++]=a;
e[o++]="'></div></div></div>";
return n?e.length:e.join("")
}
,{
id:"share.Quota#UsedLimited","class":"BannerBar"}
,false);
AjxTemplate.register("share.Quota",AjxTemplate.getTemplate("share.Quota#UsedLimited"),AjxTemplate.getParams("share.Quota#UsedLimited"));
AjxTemplate.register("share.Quota#UsedUnlimited",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='BannerTextQuota' style='display:none;'>";
e[a++]=n.desc;
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"share.Quota#UsedUnlimited"}
,false);
AjxTemplate.register("share.Quota#Tooltip",function(t,r,s,e){
var n=Boolean(e);
s=(typeof s=="string"?{
id:s}
:s)||{};
e=e||[];
var o=e.length;
if(s.username!=s.login){
e[o++]='<div style="text-align:center;">';
e[o++]=s.login;
e[o++]="</div>"
}
e[o++]='<div style="text-align:center;margin-top:3px;">';
if(s.quota){
var a=AjxMessageFormat.format(ZmMsg.quotaDescLimited,[s.size,s.limit]);
e[o++]=ZmMsg.quotaLabel;
e[o++]=" ";
e[o++]=s.percent;
e[o++]="% (";
e[o++]=a;
e[o++]=")
";
e[o++]=" "
}else{
e[o++]="
";
e[o++]=" ";
e[o++]=s.desc;
e[o++]="
";
e[o++]=" "
}
e[o++]="</div>";
return n?e.length:e.join("")
}
,{
id:"share.Quota#Tooltip"}
,false)
}
if(AjxPackage.define("share.Widgets")){
AjxTemplate.register("share.Widgets#ZmToolBarSeparator",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table><tr><td id='";
e[a++]=n.itemId;
e[a++]="' valign='middle'><div class='vertSep'></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmToolBarSeparator"}
,false);
AjxTemplate.register("share.Widgets",AjxTemplate.getTemplate("share.Widgets#ZmToolBarSeparator"),AjxTemplate.getParams("share.Widgets#ZmToolBarSeparator"));
AjxTemplate.register("share.Widgets#ZmAppChooser",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZToolbarTable' border=0 cellpadding=0 cellspacing=0><tr valign='bottom' id='";
e[a++]=n.id;
e[a++]="_items'><td id='";
e[a++]=n.id;
e[a++]='_suffix' valign=bottom><div class='ZAppTabSpacer'></div></td><td width="100%" valign="middle" align="right" style="padding-right: 10px;" id="admin_link_container">
';
e[a++]="
";
e[a++]=" </td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAppChooser","class":"ZWidget"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]=AjxTemplate.expand("dwt.Widgets#ZToolbarItem",n);
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAppChooserItem"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"AppTab";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.Widgets#ZmAppChooserButton","class":"ZAppTab"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserButton",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"AppTab";
t[o++]="<table class='ZWidgetTable Z";
t[o++]=e;
t[o++]="Table Z";
t[o++]=e;
t[o++]="Border' cellspacing=0 cellpadding=0 style='table-layout:auto;'><tr><td id='";
t[o++]=s.id;
t[o++]="_left_icon' class='ZLeftIcon ZWidgetIcon'></td><td id='";
t[o++]=s.id;
t[o++]="_title' class='ZWidgetTitle'></td><td id='";
t[o++]=s.id;
t[o++]="_right_icon' class='ZRightIcon ZWidgetIcon'></td></tr></table>";
return n?t.length:t.join("")
}
,{
id:"share.Widgets#ZmAppChooserButton","class":"ZAppTab"}
,false);
AjxTemplate.register("share.Widgets#ZmAppChooserSpacer",function(a,r,s,t){
var n=Boolean(t);
s=(typeof s=="string"?{
id:s}
:s)||{};
t=t||[];
var o=t.length;
var e=s.buttonClass||"AppTab";
t[o++]="<div class='Z";
t[o++]=e;
t[o++]="Spacer'></div>";
return n?t.length:t.join("")
}
,{
id:"share.Widgets#ZmAppChooserSpacer"}
,false);
AjxTemplate.register("share.Widgets#ZToast",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ZToastBG'><div class='ZToastContent'><div id='";
e[a++]=n.id;
e[a++]="_icon' class='ZToastIcon'></div><div id='";
e[a++]=n.id;
e[a++]="_text' class='ZToastText'></div></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZToast","class":"ZToastInfo"}
,false);
AjxTemplate.register("share.Widgets#ZmSearchToolBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 height='100%'><tr><td id='";
e[a++]=n.id;
e[a++]="_inputField' class='ZmSearchToolbarCell'></td><td id='";
e[a++]=n.id;
e[a++]="_searchMenuButton' class='ZmSearchToolbarCell'></td><td id='";
e[a++]=n.id;
e[a++]="_searchButton' hint='text' class='ZmSearchToolbarCell'></td><!-- UNCOMMENT THIS IF YOU WANT CUSTOM SEARCH TO APPEAR AS A SEPARATE BUTTON ON SEARCH TOOLBAR
";
e[a++]=" <td class='ZmSearchToolbarSeparatorCell'><div id='";
e[a++]=n.id;
e[a++]="_customSearchButtonSep' class='vertSep' style='display:none'></div></td><td id='";
e[a++]=n.id;
e[a++]="_customSearchButton' class='ZmSearchToolbarCell'></td>
";
e[a++]=" --><td class='ZmSearchToolbarSeparatorCell'><div class='vertSep'></div></td><td id='";
e[a++]=n.id;
e[a++]="_saveButton' hint='text' class='ZmSearchToolbarCell'></td><td class='ZmSearchToolbarSeparatorCell'><div class='vertSep'></div></td><td id='";
e[a++]=n.id;
e[a++]="_advancedButton' hint='text' class='ZmSearchToolbarCell'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmSearchToolBar"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleSearchToolBar",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'><tr><td><div width='100%' class='ZmPeopleSearchToolbarDiv'><table border=0 cellpadding=0 cellspacing=0 class='ZmPeopleSearchToolbarTable'><tr><td id='";
e[a++]=n.id;
e[a++]="_inputField' width='100%'></td><td>";
e[a++]=AjxImg.getImageHtml("Search2");
e[a++]="</td></tr></table></div></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleSearchToolBar"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleAutocompleteListView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr id='";
e[a++]=n.rowId;
e[a++]=''><td><table border=0 style="{padding-top: 4px; padding-bottom: 4px}"><tr>';
if(n.photoUrl){
e[a++]='<td><img src="';
e[a++]=n.photoUrl;
e[a++]='" width=32 height=32></img></td>'
}else{
e[a++]="<td>";
e[a++]=AjxImg.getImageHtml("Person_32");
e[a++]="</td>"
}
e[a++]="<td><div class='ZmPeopleSearch-fullname' id='";
e[a++]=n.rowId;
e[a++]="-fullName'></div>";
if(n.title){
e[a++]="<div class='ZmPeopleSearch-title' id='";
e[a++]=n.rowId;
e[a++]="-title'>";
e[a++]=n.title;
e[a++]="</div>"
}
e[a++]="<? if (data.email){ ?><div id='";
e[a++]=n.rowId;
e[a++]="-email'></div><? } ?><? if (data.phone} { ?><div class='ZmPeopleSearch-phone' id='";
e[a++]=n.rowId;
e[a++]="-phone'>";
e[a++]=n.phone;
e[a++]="</div><? } ?></td></tr></table></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleAutocompleteListView"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleAutocompleteListView-NoResults",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr id='";
e[a++]=n.rowId;
e[a++]=''><td class="ZmPeopleSearch-noresults">';
e[a++]=ZmMsg.noCallResults;
e[a++]="</td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleAutocompleteListView-NoResults"}
,false);
AjxTemplate.register("share.Widgets#ZmPeopleAutocompleteListView-MoreResults",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<tr><td><table><tr><td width='32'> </td><td>";
e[a++]=ZmMsg.morePeopleResults;
e[a++]="</td></tr></table></td></tr>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPeopleAutocompleteListView-MoreResults"}
,false);
AjxTemplate.register("share.Widgets#ZmChooseFolderDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ChooserDialog'><span id='";
e[a++]=n.id;
e[a++]="_folderDescDivId' style='margin: 0; margin-bottom: 2px'></span><div>";
e[a++]=ZmMsg.chooserDescription;
e[a++]="</div><div id='";
e[a++]=n.id;
e[a++]="_inputDivId'></div><div class='overview' id='";
e[a++]=n.id;
e[a++]="_folderTreeDivId'></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmChooseFolderDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmChooseAccountDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ChooserDialog' style='width:300px'><table border=0 width=100%><tr><td><center><div id='";
e[a++]=n.id;
e[a++]="_chooseAccountMsg'></div><div id='";
e[a++]=n.id;
e[a++]="_accountSelectId'></div></center></td></tr></table></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmChooseAccountDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmPickTagDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='ChooserDialog'><div style='width:300px'>";
e[a++]=ZmMsg.chooserDescription;
e[a++]="</div><div id='";
e[a++]=n.id;
e[a++]="_inputDivId'></div><div style='background-color:white; width:100%; overflow:auto' id='";
e[a++]=n.id;
e[a++]="_tagTreeDivId'></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmPickTagDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmDebugLogDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div class='DebugLogDialog-desc' id='";
e[a++]=n.id;
e[a++]="_desc'></div><div class='DebugLogDialog-log' id='";
e[a++]=n.id;
e[a++]="_log'></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmDebugLogDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmDumpsterDialog",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_toolbar'></div><div id='";
e[a++]=n.id;
e[a++]="_listview'></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmDumpsterDialog"}
,false);
AjxTemplate.register("share.Widgets#ZmAddShareLink",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<a id="';
e[a++]=n.id;
e[a++]='_addshare_link" href="#">';
e[a++]=ZmMsg.sharedFoldersLink;
e[a++]="</a>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAddShareLink"}
,false);
AjxTemplate.register("share.Widgets#ZmShareProxyToolTip",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<div style="width:250px"><div class="Img';
e[a++]=n.icon;
e[a++]='" style="float:left;vertical-align:top"></div><div style="font-weight:bold;font-size:1.1em;padding:3px;">';
e[a++]=AjxStringUtil.htmlEncode(n.normalizedFolderPath);
e[a++]='</div><div style="clear:both;"><table border="0" cellpadding="0" cellspacing="3"><tr valign="top"><th align="right">';
e[a++]=ZmMsg.ownerLabel;
e[a++]="</th><td>";
e[a++]=AjxStringUtil.htmlEncode(n.normalizedOwnerName);
e[a++]='</td></tr><tr valign="top"><th align="right">';
e[a++]=ZmMsg.granteeLabel;
e[a++]="</th><td>";
e[a++]=AjxStringUtil.htmlEncode(n.normalizedGranteeName);
e[a++]='</td></tr><tr valign="top"><th align="right">';
e[a++]=ZmMsg.roleLabel;
e[a++]="</th><td>";
e[a++]=n.roleName;
e[a++]=" (";
e[a++]=n.roleActions;
e[a++]=')</td></tr><tr height="4"><td></td><td></td></tr><tr valign="top"><th align="right">';
e[a++]=ZmMsg.noteLabel;
e[a++]='</th><td><div style="margin-top:4px;font-size:.9em;">';
e[a++]=AjxMessageFormat.format(ZmMsg.sharedFoldersLinkHint,[AjxStringUtil.htmlEncode(n.defaultMountpointName)]);
e[a++]="</div></td></tr></table></div></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmShareProxyToolTip"}
,false);
AjxTemplate.register("share.Widgets#ZmShareSearchView",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]='<div class="FilterTree" style="width:300px;"><div id="';
e[a++]=n.id;
e[a++]='_FILTER" tabindex="100"></div><div id="';
e[a++]=n.id;
e[a++]='_TREE" tabindex="200"></div></div><table border="0" cellspacing="3" width="100%"><tr><td>';
e[a++]=ZmMsg.sharedFoldersFindLabel;
e[a++]='</td><td><div id="';
e[a++]=n.id;
e[a++]='_EMAIL" tabindex="300"></div></td><td><div id="';
e[a++]=n.id;
e[a++]='_SEARCH" tabindex="400"></div></td></tr><tr><td>';
e[a++]=ZmMsg.includeLabel;
e[a++]=":</td><td colspan='2'><div id="";
e[a++]=n.id;
e[a++]='_APP" tabindex="500"></div></td></tr></table>';
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmShareSearchView"}
,false);
AjxTemplate.register("share.Widgets#ZmAddressInputField",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.holderId;
e[a++]="' class='addrBubbleHolder-empty'><span id='";
e[a++]=n.dragInsertionBarId;
e[a++]="' style='display:none' class='addrBubbleInsertionBar'> </span><input id='";
e[a++]=n.inputId;
e[a++]="'></div>";
return o?e.length:e.join("")
}
,{
id:"share.Widgets#ZmAddressInputField"}
,false)
}
if(AjxPackage.define("zimbra.Widgets")){
AjxTemplate.register("zimbra.Widgets#ZmErrorDialogControls",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<div id='";
e[a++]=n.id;
e[a++]="_buttons' class='DwtDialogButtonBar'>";
if(AjxEnv.isNav){
e[a++]="<input type='button' id='";
e[a++]=n.id;
e[a++]="_focus' style='height:0px;width:0px;display:none;'>"
}
e[a++]="</div>";
return o?e.length:e.join("")
}
,{
id:"zimbra.Widgets#ZmErrorDialogControls",height:"32",width:"20"}
,false);
AjxTemplate.register("zimbra.Widgets",AjxTemplate.getTemplate("zimbra.Widgets#ZmErrorDialogControls"),AjxTemplate.getParams("zimbra.Widgets#ZmErrorDialogControls"));
AjxTemplate.register("zimbra.Widgets#ZmErrorDialogContent",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table width='100%' height='100%'><tr><td>";
e[a++]=n.message;
e[a++]="</td></tr>";
if(n.showDetails){
e[a++]="<tr><td><hr/></td></tr><tr><td style='height:100%;vertical-align:top;'>
";
e[a++]=" ";
e[a++]=n.detail;
e[a++]="
";
e[a++]=" </td></tr>"
}
e[a++]="</table>";
return o?e.length:e.join("")
}
,{
id:"zimbra.Widgets#ZmErrorDialogContent"}
,false);
AjxTemplate.register("zimbra.Widgets#ZmColorMenuItem",function(t,s,n,e){
var o=Boolean(e);
n=(typeof n=="string"?{
id:n}
:n)||{};
e=e||[];
var a=e.length;
e[a++]="<table class='ZWidgetTable ZMenuItemTable ZMenuItemBorder' cellspacing='0' cellpadding='0'><tr><td id='";
e[a++]=n.id;
e[a++]="_title' class='ZWidgetTitle'></td></tr></table>";
return o?e.length:e.join("")
}
,{
id:"zimbra.Widgets#ZmColorMenuItem","class":"ZWidget"}
,false)
};
Zimbra is continuously asking for "Account Authentication"
I'm having the same behaviour.
After the re-enter password request I get the following message:
A network service error has occurred.
Show details:
method: [unknown]
msg: system failure: Google address book authentication failed
code: service.FAILURE
detail: soap:Receiver
trace: com.zimbra.common.service.ServiceException: system failure: Google address book authentication failed ExceptionId:btpool0-55:1433269397060:c453980c7ec194ca Code:service.FAILURE
at com.zimbra.common.service.ServiceException.FAILURE(ServiceException.java:253)
at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:68)
at com.zimbra.cs.offline.ab.gab.GabService.<init>(GabService.java:61)
at com.zimbra.cs.offline.ab.gab.SyncSession.<init>(SyncSession.java:96)
at com.zimbra.cs.offline.ab.gab.GabImport.test(GabImport.java:42)
at com.zimbra.cs.offline.OfflineImport.test(OfflineImport.java:95)
at com.zimbra.cs.offline.GMailImport.test(GMailImport.java:41)
at com.zimbra.cs.datasource.DataSourceManager.test(DataSourceManager.java:209)
at com.zimbra.cs.account.offline.OfflineProvisioning.testDataSource(OfflineProvisioning.java:745)
at com.zimbra.cs.service.offline.OfflineChangePassword.handle(OfflineChangePassword.java:84)
at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:412)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:287)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:158)
at com.zimbra.soap.SoapServlet.doWork(SoapServlet.java:303)
at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:217)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:206)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:814)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:218)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:422)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.rewrite.RewriteHandler.handle(RewriteHandler.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:585)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:988)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:415)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:429)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451) Caused by: com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:614)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:490)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:336)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301)
at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:66) ... 35 more
request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope ... r><context xmlns="urn:zimbra"><userAgent xmlns="" name="ZimbraWebClient - PRISM (Win)" version="7.2.5 GA"/><session xmlns="" id="12"/><notify xmlns="" seq="115"/><account xmlns="" by="name">*************</account><format xmlns="" type="js"/></context></soap:Header><soap:Body><ChangePasswordRequest xmlns="urn:zimbraOffline" id="e0fbc198-c94d-41e7-ba21-a0192a4ef7ed"><password xmlns="">********</password></ChangePasswordRequest></soap:Body></soap:Envelope>
After the re-enter password request I get the following message:
A network service error has occurred.
Show details:
method: [unknown]
msg: system failure: Google address book authentication failed
code: service.FAILURE
detail: soap:Receiver
trace: com.zimbra.common.service.ServiceException: system failure: Google address book authentication failed ExceptionId:btpool0-55:1433269397060:c453980c7ec194ca Code:service.FAILURE
at com.zimbra.common.service.ServiceException.FAILURE(ServiceException.java:253)
at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:68)
at com.zimbra.cs.offline.ab.gab.GabService.<init>(GabService.java:61)
at com.zimbra.cs.offline.ab.gab.SyncSession.<init>(SyncSession.java:96)
at com.zimbra.cs.offline.ab.gab.GabImport.test(GabImport.java:42)
at com.zimbra.cs.offline.OfflineImport.test(OfflineImport.java:95)
at com.zimbra.cs.offline.GMailImport.test(GMailImport.java:41)
at com.zimbra.cs.datasource.DataSourceManager.test(DataSourceManager.java:209)
at com.zimbra.cs.account.offline.OfflineProvisioning.testDataSource(OfflineProvisioning.java:745)
at com.zimbra.cs.service.offline.OfflineChangePassword.handle(OfflineChangePassword.java:84)
at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:412)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:287)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:158)
at com.zimbra.soap.SoapServlet.doWork(SoapServlet.java:303)
at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:217)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:206)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:814)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:218)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:422)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.rewrite.RewriteHandler.handle(RewriteHandler.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:585)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:988)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:415)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:429)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451) Caused by: com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:614)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:490)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:336)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301)
at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:66) ... 35 more
request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope ... r><context xmlns="urn:zimbra"><userAgent xmlns="" name="ZimbraWebClient - PRISM (Win)" version="7.2.5 GA"/><session xmlns="" id="12"/><notify xmlns="" seq="115"/><account xmlns="" by="name">*************</account><format xmlns="" type="js"/></context></soap:Header><soap:Body><ChangePasswordRequest xmlns="urn:zimbraOffline" id="e0fbc198-c94d-41e7-ba21-a0192a4ef7ed"><password xmlns="">********</password></ChangePasswordRequest></soap:Body></soap:Envelope>
-
- Posts: 2
- Joined: Fri May 15, 2015 11:11 am
Zimbra is continuously asking for "Account Authentication"
Similar issue persisting with gmail even after removing AVAST/AV from Windows 7 system
Zimbra Desktop 7.2.5 GA (build 12038)
A network service error has occurred.
method: [unknown]
msg: system failure: Google address book authentication failed
code: service.FAILURE
detail: soap:Receiver
trace: com.zimbra.common.service.ServiceException: system failure: Google address book authentication failed ExceptionId:btpool0-7:1433296002760:b4996911f2480534 Code:service.FAILURE at com.zimbra.common.service.ServiceException.FAILURE(ServiceException.java:253) at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:68) at com.zimbra.cs.offline.ab.gab.GabService.<init>(GabService.java:61) at com.zimbra.cs.offline.ab.gab.SyncSession.<init>(SyncSession.java:96) at com.zimbra.cs.offline.ab.gab.GabImport.test(GabImport.java:42) at com.zimbra.cs.offline.OfflineImport.test(OfflineImport.java:95) at com.zimbra.cs.offline.GMailImport.test(GMailImport.java:41) at com.zimbra.cs.datasource.DataSourceManager.test(DataSourceManager.java:209) at com.zimbra.cs.account.offline.OfflineProvisioning.testDataSource(OfflineProvisioning.java:745) at com.zimbra.cs.service.offline.OfflineChangePassword.handle(OfflineChangePassword.java:84) at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:412) at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:287) at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:158) at com.zimbra.soap.SoapServlet.doWork(SoapServlet.java:303) at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:217) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:206) at javax.servlet.http.HttpServlet.service(HttpServlet.java:814) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:218) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:422) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.rewrite.RewriteHandler.handle(RewriteHandler.java:230) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:585) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:988) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:415) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:429) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451) Caused by: com.google.gdata.util.AuthenticationException: Error authenticating (check service name) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:614) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:490) at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:336) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301) at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:66) ... 35 more
request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope ... r><context xmlns="urn:zimbra"><userAgent xmlns="" name="ZimbraWebClient - PRISM (Win)" version="7.2.5 GA"/><session xmlns="" id="15"/><notify xmlns="" seq="64"/><account xmlns="" by="name">orlando.stevenson@gmail.com</account><format xmlns="" type="js"/></context></soap:Header><soap:Body><ChangePasswordRequest xmlns="urn:zimbraOffline" id="e345b4d3-154b-4f75-acfc-43f2de740783"><password xmlns="">dmdqnbzilndhsqfe</password></ChangePasswordRequest></soap:Body></soap:Envelope>
Sen
Zimbra Desktop 7.2.5 GA (build 12038)
A network service error has occurred.
method: [unknown]
msg: system failure: Google address book authentication failed
code: service.FAILURE
detail: soap:Receiver
trace: com.zimbra.common.service.ServiceException: system failure: Google address book authentication failed ExceptionId:btpool0-7:1433296002760:b4996911f2480534 Code:service.FAILURE at com.zimbra.common.service.ServiceException.FAILURE(ServiceException.java:253) at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:68) at com.zimbra.cs.offline.ab.gab.GabService.<init>(GabService.java:61) at com.zimbra.cs.offline.ab.gab.SyncSession.<init>(SyncSession.java:96) at com.zimbra.cs.offline.ab.gab.GabImport.test(GabImport.java:42) at com.zimbra.cs.offline.OfflineImport.test(OfflineImport.java:95) at com.zimbra.cs.offline.GMailImport.test(GMailImport.java:41) at com.zimbra.cs.datasource.DataSourceManager.test(DataSourceManager.java:209) at com.zimbra.cs.account.offline.OfflineProvisioning.testDataSource(OfflineProvisioning.java:745) at com.zimbra.cs.service.offline.OfflineChangePassword.handle(OfflineChangePassword.java:84) at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:412) at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:287) at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:158) at com.zimbra.soap.SoapServlet.doWork(SoapServlet.java:303) at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:217) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:206) at javax.servlet.http.HttpServlet.service(HttpServlet.java:814) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:218) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:422) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.rewrite.RewriteHandler.handle(RewriteHandler.java:230) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:585) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:988) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:415) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:429) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451) Caused by: com.google.gdata.util.AuthenticationException: Error authenticating (check service name) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:614) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:490) at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:336) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301) at com.zimbra.cs.offline.ab.gab.GabService.authenticate(GabService.java:66) ... 35 more
request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope ... r><context xmlns="urn:zimbra"><userAgent xmlns="" name="ZimbraWebClient - PRISM (Win)" version="7.2.5 GA"/><session xmlns="" id="15"/><notify xmlns="" seq="64"/><account xmlns="" by="name">orlando.stevenson@gmail.com</account><format xmlns="" type="js"/></context></soap:Header><soap:Body><ChangePasswordRequest xmlns="urn:zimbraOffline" id="e345b4d3-154b-4f75-acfc-43f2de740783"><password xmlns="">dmdqnbzilndhsqfe</password></ChangePasswordRequest></soap:Body></soap:Envelope>
Sen
Zimbra is continuously asking for "Account Authentication"
This issue looks like https://bugzilla.zimbra.com/show_bug.cgi?id=99733. This would be addressed in the GA version. For now the work-around is to uncheck "Synchronize all contacts and groups " option from your gmail account settings.
Zimbra is continuously asking for "Account Authentication"
I upgraded to ZD 7.2.7 beta and it's working fine now. I can see the account contacts and I don't have error messages anymore.
https://wiki.zimbra.com/wiki/Zimbra_Desktop_7.2.7_BETA
https://wiki.zimbra.com/wiki/Zimbra_Desktop_7.2.7_BETA