egroupware_official/mail/js/app.min.js

12 lines
84 KiB
JavaScript

/*!
* EGroupware (http://www.egroupware.org/) minified Javascript
*
* full sources are available under https://svn.stylite.de/viewvc/egroupware/
*
* build Wed Mar 02 2016 15:23:59
*/
app.classes.mail=AppJS.extend({appname:"mail",et2:null,doStatus:null,mail_queuedFolders:[],mail_queuedFoldersIndex:0,mail_selectedMails:[],mail_currentlyFocussed:"",mail_previewAreaActive:!0,nm_index:"nm",mail_fileSelectorWindow:null,mail_isMainWindow:!0,preview_preload:{timeout:null,request:null},subscription_treeLastState:"",aclCommonRights:["lrs","lprs","ilprs","ilprsw","aeiklprstwx","custom"],aclRights:["l","r","s","w","i","p","c","d","a"],W_INTERVALS:[],init:function(){this._super.apply(this,arguments),this.egw.is_popup()||this.egw.dataCacheRegister("mail",this.nm_cache,function(server_query){server_query||this.unlock_tree()},this)},destroy:function(){if(null!=this.et2){var nm=this.et2.getWidgetById(this.nm_index);null!=nm&&$j(nm).off("refresh")}this.egw.dataCacheUnregister("mail"),delete this.et2_obj,this._super.apply(this,arguments)},checkET2:function(){if(!this.et2)try{this.et2=etemplate2.getByApplication("mail")[0].widgetContainer}catch(e){return!1}return!0},et2_ready:function(et2,_name){switch(this._super.apply(this,arguments),this.et2_obj=et2,_name){case"mail.sieve.vacation":this.vacationFilterStatusChange();break;case"mail.mobile_index":case"mail.index":var self=this;jQuery("iframe#mail-index_messageIFRAME").on("load",function(){self.mailvelopeAvailable(self.mailvelopeDisplay),self.mail_prepare_print()});var nm=this.et2.getWidgetById(this.nm_index);if(this.mail_isMainWindow=!0,this.mail_disablePreviewArea(!0),this.mail_refreshFolderStatus(void 0,void 0,!1),null!=nm&&("undefined"==typeof jQuery._data(nm).events||"undefined"==typeof jQuery._data(nm).events.refresh)){var self=this;$j(nm).on("refresh",function(){self.mail_refreshFolderStatus.call(self,void 0,void 0,!1)})}var tree_wdg=this.et2.getWidgetById(this.nm_index+"[foldertree]");tree_wdg&&(tree_wdg.set_onopenstart(jQuery.proxy(this.openstart_tree,this)),tree_wdg.set_onopenend(jQuery.proxy(this.openend_tree,this))),this.mail_callRefreshVacationNotice();break;case"mail.display":var self=this;jQuery("iframe#mail-display_mailDisplayBodySrc").on("load",function(e){self.mailvelopeAvailable(self.mailvelopeDisplay),self.mail_prepare_print(),window.location.search.search("&print=")>=0&&jQuery(this.contentWindow.document.body).children().length>0&&self.mail_print()}),this.mail_isMainWindow=!1,this.mail_display(),this.register_for_drag(this.et2.getArrayMgr("content").getEntry("mail_id"),this.et2.getArrayMgr("content").getEntry("mail_displayattachments"));break;case"mail.compose":(this.et2.getWidgetById("composeToolbar")._actionManager.getActionById("pgp")&&this.et2.getWidgetById("composeToolbar")._actionManager.getActionById("pgp").checked||this.et2.getArrayMgr("content").data.mail_plaintext&&-1!=this.et2.getArrayMgr("content").data.mail_plaintext.indexOf(this.begin_pgp_message))&&this.mailvelopeAvailable(this.mailvelopeCompose),et2.menuaction="mail_compose::ajax_send";var that=this,textAreaWidget=this.et2.getWidgetById("mail_htmltext");this.mail_isMainWindow=!1,this.compose_fieldExpander_init(),this.check_sharing_filemode(),this.subject2title(),this.W_INTERVALS.push(window.setInterval(function(){that.saveAsDraft(null,"autosaving")},12e4)),jQuery("#mail-compose_subject").on({focus:function(){that.compose_fieldExpander_init(),that.compose_fieldExpander()}}),jQuery("#mail-compose").on("load",function(){textAreaWidget&&textAreaWidget.ckeditor?textAreaWidget.ckeditor.on("instanceReady",function(){that.compose_fieldExpander(),egwIsMobile()&&jQuery(jQuery("iframe.cke_wysiwyg_frame")[0].contentWindow.document.body).css({margin:"0"})}):that.compose_fieldExpander()}),jQuery(window).on("resize",function(){that.compose_resizeHandler()}),this.init_dndCompose();var to=this.et2.getWidgetById("to");if(to&&to.get_value()&&""!=to.get_value()){var content=this.et2.getArrayMgr("content").data;if(content.is_plain){var plainText=this.et2.getWidgetById("mail_plaintext");jQuery(plainText.node).focus(),"undefined"!=typeof plainText.node.setSelectionRange&&plainText.node.setSelectionRange(0)}else textAreaWidget.ckeditor.on("instanceReady",function(e){this.focus()})}else to&&jQuery("input",to.node).focus();break;case"mail.subscribe":if(""!=this.subscription_treeLastState){var tree=this.et2.getWidgetById("foldertree"),state=jQuery.parseJSON(this.subscription_treeLastState);tree.input.loadJSONObject(tree._htmlencode_node(state))}break;case"mail.folder_management":this.egw.message(this.egw.lang("If you would like to select multiple folders in one action, you can hold ctrl key then select a folder as start range and another folder within a same level as end range, all folders in between will be selected or unselected based on their current status."),"info",!0)}},observer:function(_msg,_app,_id,_type,_msg_type,_links){switch(_app){case"mail":if("sieve"===_id){var iframe=this.et2.getWidgetById("extra_iframe");if(iframe&&iframe.getDOMNode()){var contentWindow=iframe.getDOMNode().contentWindow;contentWindow&&contentWindow.app&&contentWindow.app.mail&&contentWindow.app.mail.sieve_refresh()}return!1}break;case"emailadmin":var tree=this.et2?this.et2.getWidgetById(this.nm_index+"[foldertree]"):null;if(!tree)break;var node=tree.getNode(_id);switch(_type){case"delete":node&&tree.deleteItem(_id);break;case"update":case"edit":node&&egw.json("mail.mail_ui.ajax_reloadNode",[_id]).sendRequest(!0);break;case"add":tree.refreshItem(0)}}},nm_cache:function(query_context){return query_context&&query_context.start||0!=query_context.count||!query_context.filters||!query_context.filters.selectedFolder||!query_context.filters||query_context.filters.search?!1:this.egw.jsonEncode({selectedFolder:query_context.filters.selectedFolder||"",cat_id:query_context.filters.cat_id||"",filter:query_context.filters.filter||"",filter2:query_context.filters.filter2||"",sort:query_context.filters.sort})},mail_rebuildActionsOnList:function(_actions){this.et2.getWidgetById(this.nm_index).set_actions(_actions)},mail_fetchCurrentlyFocussed:function(_selected,_reset){if(1==_reset||"undefined"==typeof _selected){if(1==_reset){""!=this.mail_currentlyFocussed&&egw.dataRefreshUID(this.mail_currentlyFocussed);for(var k=0;k<this.mail_selectedMails.length;k++)egw.dataRefreshUID(this.mail_selectedMails[k])}return this.mail_selectedMails=[],this.mail_currentlyFocussed="",""}for(var k=0;k<_selected.length;k++)if(-1==jQuery.inArray(_selected[k],this.mail_selectedMails)){this.mail_currentlyFocussed=_selected[k];break}return this.mail_selectedMails=_selected,this.mail_currentlyFocussed},mail_open:function(_action,_senders,_mode){if("undefined"==typeof _senders||0==_senders.length){if(this.et2.getArrayMgr("content").getEntry("mail_id")){var _senders=[];_senders.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _senders||0==_senders.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _senders=[];_senders.push({id:this.mail_currentlyFocussed})}}var _id=_senders[0].id;"tryastext"!=_mode&&"tryashtml"!=_mode&&"view"!=_mode&&"print"!=_mode&&(_mode="view"),this.mail_selectedMails=[],this.mail_selectedMails.push(_id),this.mail_currentlyFocussed=_id;var dataElem=egw.dataGetUIDdata(_id),subject=dataElem.data.subject,h=egw().open(_id,"mail","view",_mode+"="+_id.replace(/=/g,"_")+"&mode="+_mode);egw(h).ready(function(){h.document.title=subject});var messages={};messages.msg=[_id],"undefined"!=typeof dataElem&&"undefined"!=typeof dataElem.data&&"undefined"!=typeof dataElem.data.flags&&"undefined"!=typeof dataElem.data.flags.read&&(dataElem.data.flags.read="read"),"undefined"!=typeof dataElem&&"undefined"!=typeof dataElem.data&&"undefined"!=typeof dataElem.data.class&&(dataElem.data.class.indexOf("unseen")>=0||dataElem.data.class.indexOf("recent")>=0)&&(this.mail_removeRowClass(messages,"recent"),this.mail_removeRowClass(messages,"unseen"),this.mail_reduceCounterWithoutServerRoundtrip())},mail_openAsHtml:function(_action,_elems){this.mail_open(_action,_elems,"tryashtml")},mail_openAsText:function(_action,_elems){this.mail_open(_action,_elems,"tryastext")},mail_compose:function(_action,_elems){if("undefined"==typeof _elems||0==_elems.length){if(this.et2&&this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var settings={id:"",from:""};switch(settings.id="undefined"==typeof _elems?"":_elems[0].id,_action.id){case"compose":if(1!=_elems.length)return this.mail_compose("forward",_elems);break;case"forward":case"forwardinline":case"forwardasattach":if(_elems.length>1||"forwardasattach"==_action.id){if(settings.from="forward",settings.mode="forwardasattach","undefined"!=typeof _elems&&_elems.length>1)for(var j=1;j<_elems.length;j++)settings.id=settings.id+","+_elems[j].id}else settings.from="forward",settings.mode="forwardinline";break;default:settings.from=_action.id}var compose_list=egw.getOpenWindows("mail",/^compose_/),window_name="compose_"+compose_list.length+"_"+(settings.from||"")+"_"+settings.id;return egw().open("","mail","add",settings,window_name,"mail")},setCompose:function(window_name,content){var compose=window.open("",window_name);if(!compose||compose.closed)return!1;var compose_et2=compose.etemplate2.getByApplication("mail");if(!compose_et2||1!=compose_et2.length||!compose_et2[0].widgetContainer)return!1;var success=!0,arrContent=[];for(var field in content)try{var widget=compose_et2[0].widgetContainer.getWidgetById(field),value=widget.getValue()||content[field];if(jQuery.isArray(value))if(jQuery.isArray(content[field]))value.concat(content[field]);else{arrContent=content[field].split(",");for(var k=0;k<arrContent.length;k++)value.push(arrContent[k])}widget.set_value(value)}catch(e){egw.log("error","Unable to set field %s to '%s' in window '%s'",field,content[field],window_name),success=!1;continue}return(content.cc||content.bcc)&&(this.compose_fieldExpander(),this.compose_fieldExpander_init()),success},mail_disablePreviewArea:function(_value){var splitter=this.et2.getWidgetById("mailSplitter");"undefined"!=typeof splitter&&null!=splitter&&(splitter.isDocked()&&(this.mail_previewAreaActive=!1),this.et2.getWidgetById("mailPreview").set_disabled(_value),1==_value?(this.mail_previewAreaActive&&splitter.dock(),this.mail_previewAreaActive=!1):(this.mail_previewAreaActive||(splitter.undock(),window.setTimeout(function(){splitter.left.trigger("resize.et2_split.mailSplitter")},200)),this.mail_previewAreaActive=!0))},url_email_expandOnClick:function(_expContent,_dataElem){for(var j=0;j<_expContent.length;j++){var field=_expContent[j]||[],content=_dataElem.data[field.data]||[];"undefined"!=typeof field.data_one&&field.data!=field.data_one&&(jQuery.isArray(_dataElem.data[field.data_one])?content=content.concat(_dataElem.data[field.data_one]):content.unshift(_dataElem.data[field.data_one]),content=content.filter(function(value,index,self){return self.indexOf(value)===index}));var line=this.et2.getWidgetById(field.line);null!=line&&line.set_disabled(0==content.length);var widget=this.et2.getWidgetById(field.widget);if(null!=widget){if($j(widget.getDOMNode()).removeClass("visible"),field.build_children){for(var children=widget.getChildren(),i=children.length-1;i>=0;i--)children[i].destroy(),widget.removeChild(children[i]);1==content.length&&"undefined"!=typeof content[0]&&content[0]&&(content=content[0].split(","));for(var remembervalue="",i=0;i<content.length;i++)if("string"==typeof content[i]&&content[i])if(content[i].indexOf("@")<0)remembervalue=content[i];else{var value=remembervalue+(remembervalue?",":"")+content[i],email=et2_createWidget("url-email",{id:widget.id+"_"+i,value:value,readonly:!0,contact_plus:!0},widget);email.loadingFinished(),remembervalue=""}}else widget.set_value({content:content});line.iterateOver(function(button){button.getParent()==line&&button.set_disabled(content.length<=1||$j(widget.getDOMNode()).innerWidth()>=widget.getDOMNode().scrollWidth&&$j(widget.getDOMNode()).innerHeight()>=widget.getDOMNode().scrollHeight)},this,et2_button)}}return _dataElem},mail_display:function(){var dataElem={data:{FROM:"",SENDER:"",TO:"",CC:"",BCC:""}},content=this.et2.getArrayMgr("content").data,expand_content=[{build_children:!0,data_one:"FROM",data:"FROM",widget:"FROM",line:"mailDisplayHeadersFrom"},{build_children:!0,data:"SENDER",widget:"SENDER",line:"mailDisplayHeadersSender"},{build_children:!0,data:"TO",widget:"TO",line:"mailDisplayHeadersTo"},{build_children:!0,data:"CC",widget:"CC",line:"mailDisplayHeadersCc"},{build_children:!0,data:"BCC",widget:"BCC",line:"mailDisplayHeadersBcc"}];if("undefiend"!=typeof content){dataElem.data=jQuery.extend(dataElem.data,content),this.url_email_expandOnClick(expand_content,dataElem);var toolbaractions="undefined"!=typeof dataElem&&"undefined"!=typeof dataElem.data&&"undefined"!=typeof dataElem.data.displayToolbaractions?JSON.parse(dataElem.data.displayToolbaractions):void 0;toolbaractions&&this.et2.getWidgetById("displayToolbar").set_actions(toolbaractions)}},mail_preview:function(selected,nextmatch){var dataElem={data:{subject:"",fromaddress:"",toaddress:"",ccaddress:"",date:"",attachmentsBlock:""}},attachmentArea=this.et2.getWidgetById("previewAttachmentArea");if("undefined"!=typeof selected&&1==selected.length){var _id=this.mail_fetchCurrentlyFocussed(selected);dataElem=jQuery.extend(dataElem,egw.dataGetUIDdata(_id)),dataElem.data&&dataElem.data.attachmentsBlock[0]&&dataElem.data.attachmentsBlock[0].winmailFlag&&("application/ms-tnef"==dataElem.data.attachmentsBlock[0].mimetype||"winmail.dat"==dataElem.data.attachmentsBlock[0].filename)&&(attachmentArea.getDOMNode().classList.add("loading"),this.egw.jsonq("mail.mail_ui.ajax_resolveWinmail",[_id],jQuery.proxy(function(_data){attachmentArea.getDOMNode().classList.remove("loading"),"object"==typeof _data?(attachmentArea.set_value({content:_data}),this.data.attachmentsBlock=_data,egw.dataStoreUID(this.data.uid,this.data),set_prev_iframe_top()):console.log("Can not resolve the winmail.data!")},dataElem)))}var $preview_iframe=jQuery("#mail-index_mailPreviewContainer"),set_prev_iframe_top=function(){window.setTimeout(function(){for(var lastEl=$preview_iframe.prev().prev(),iframeTop=$preview_iframe.offset().top;"none"===lastEl.css("display");)lastEl=lastEl.prev();var offset=iframeTop-(lastEl.offset().top+lastEl.height())||130;$preview_iframe.css("top",$preview_iframe.position().top-offset+10)},50)};if(attachmentArea&&"undefined"!=typeof _id&&""!=_id&&"undefined"!=typeof dataElem){set_prev_iframe_top();var data_widgets={previewFromAddress:"fromaddress",previewDate:"date",previewSubject:"subject"};for(var id in data_widgets){var widget=this.et2.getWidgetById(id);null!=widget&&widget.set_value(dataElem.data[data_widgets[id]]||"")}var IframeHandle=this.et2.getWidgetById("messageIFRAME");IframeHandle.set_src("about:blank"),jQuery(IframeHandle.getDOMNode()).show().next(this.mailvelope_iframe_selector).remove();var expand_content=[{build_children:!0,data_one:"toaddress",data:"additionaltoaddress",widget:"additionalToAddress",line:"mailPreviewHeadersTo"},{build_children:!0,data:"ccaddress",widget:"additionalCCAddress",line:"mailPreviewHeadersCC"},{build_children:!1,data:"attachmentsBlock",widget:"previewAttachmentArea",line:"mailPreviewHeadersAttachments"}];dataElem=this.url_email_expandOnClick(expand_content,dataElem),this.mail_selectedMails.indexOf(_id)<0&&this.mail_selectedMails.push(_id),this.mail_disablePreviewArea(!1),IframeHandle.set_src(egw.link("/index.php",{menuaction:"mail.mail_ui.loadEmailBody",_messageID:_id}));var messages={};if(messages.msg=[_id],"undefined"!=typeof dataElem&&"undefined"!=typeof dataElem.data&&"undefined"!=typeof dataElem.data.flags&&"undefined"!=typeof dataElem.data.flags.read&&(dataElem.data.flags.read="read"),"undefined"!=typeof dataElem&&"undefined"!=typeof dataElem.data&&"undefined"!=typeof dataElem.data.class&&(dataElem.data.class.indexOf("unseen")>=0||dataElem.data.class.indexOf("recent")>=0)){if(this.mail_removeRowClass(messages,"recent"),this.mail_removeRowClass(messages,"unseen"),this.mail_reduceCounterWithoutServerRoundtrip(),"undefined"!=typeof dataElem.data.dispositionnotificationto&&dataElem.data.dispositionnotificationto&&"undefined"==typeof dataElem.data.flags.mdnsent&&"undefined"==typeof dataElem.data.flags.mdnnotsent){var buttons=[{text:this.egw.lang("Yes"),id:"mdnsent"},{text:this.egw.lang("No"),id:"mdnnotsent"}];et2_dialog.show_dialog(function(_button_id,_value){switch(_button_id){case"mdnsent":return egw.jsonq("mail.mail_ui.ajax_sendMDN",[messages]),void egw.jsonq("mail.mail_ui.ajax_flagMessages",["mdnsent",messages,!0]);case"mdnnotsent":egw.jsonq("mail.mail_ui.ajax_flagMessages",["mdnnotsent",messages,!0])}},this.egw.lang("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?"),this.egw.lang("Confirm"),messages,buttons)}egw.jsonq("mail.mail_ui.ajax_flagMessages",["read",messages,!1])}}else{var prevAttchArea=this.et2.getWidgetById("previewAttachmentArea");if(prevAttchArea){prevAttchArea.set_value({content:[]}),this.et2.getWidgetById("previewAttachmentArea").set_class("previewAttachmentArea noContent mail_DisplayNone");var IframeHandle=this.et2.getWidgetById("messageIFRAME");IframeHandle.set_src("about:blank"),this.mail_disablePreviewArea(!0)}}},showAllHeader:function(event,widget,button){var list=jQuery(button).prev();list.toggleClass("visible"),$j("body").one("click",list,function(ev){ev.data.removeClass("visible")})},mail_setMailBody:function(content){var IframeHandle=this.et2.getWidgetById("messageIFRAME");IframeHandle.set_value("")},mail_refreshFolderStatus:function(_nodeID,mode,_refreshGridArea,_refreshQuotaDisplay){"undefined"!=typeof _nodeID&&"undefined"!=typeof _nodeID[_nodeID]&&_nodeID[_nodeID]&&(_refreshGridArea=_nodeID[_refreshGridArea],mode=_nodeID[mode],_nodeID=_nodeID[_nodeID]);var nodeToRefresh=0,mode2use="none";"undefined"==typeof _refreshGridArea&&(_refreshGridArea=!0),"undefined"==typeof _refreshQuotaDisplay&&(_refreshQuotaDisplay=!0),_nodeID&&(nodeToRefresh=_nodeID),mode&&"forced"==mode&&(mode2use=mode);try{var tree_wdg=this.et2.getWidgetById(this.nm_index+"[foldertree]"),activeFolders=tree_wdg.getTreeNodeOpenItems(nodeToRefresh,mode2use);this.mail_queueRefreshFolderList("thisfolderonly"==mode&&nodeToRefresh?[_nodeID]:activeFolders),_refreshGridArea&&this.mail_refreshMessageGrid(),_refreshQuotaDisplay&&this.mail_refreshQuotaDisplay()}catch(e){}},mail_refreshQuotaDisplay:function(_server){egw.json("mail.mail_ui.ajax_refreshQuotaDisplay",[_server]).sendRequest(!0)},mail_setQuotaDisplay:function(_data){if(this.et2||this.checkET2()){var quotabox=this.et2.getWidgetById(this.nm_index+"[quotainpercent]");quotabox&&(quotabox.set_class(_data.data.quotaclass),quotabox.set_value(_data.data.quotainpercent),quotabox.set_label(_data.data.quota))}},mail_callRefreshVacationNotice:function(_server){egw.jsonq("mail_ui::ajax_refreshVacationNotice",[_server])},register_for_drag:function(mail_id,attachments){var data={};if(attachments)for(var i=0;i<attachments.length;i++){var data=attachments[i]||{};data.filename&&data.type&&(data.mime=data.type,data.download_url=egw.link("/index.php",{menuaction:"mail.mail_ui.getAttachment",id:mail_id,part:data.partID,is_winmail:data.winmailFlag}),data.name=data.filename)}},drag_attachment:function(_action,_elems){var div=$j(document.createElement("div")).css({position:"absolute",top:"0px",left:"0px",width:"300px"}),data=_elems[0].data||{},text=$j(document.createElement("div")).css({left:"30px",position:"absolute"});if(text.text(_elems.length>1?_elems.length+" "+this.egw.lang("files"):data.name||""),div.append(text),window.FileReader&&"draggable"in document.createElement("span")&&navigator&&navigator.userAgent.indexOf("Chrome")>=0){var key=["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform)<0?"Ctrl":"Command";text.append("<br />"+this.egw.lang("Hold %1 to drag files to your computer",key))}return div},mail_refreshVacationNotice:function(_data){(this.et2||this.checkET2())&&(null==_data?(this.et2.getWidgetById(this.nm_index+"[vacationnotice]").set_value(""),this.et2.getWidgetById(this.nm_index+"[vacationrange]").set_value("")):(this.et2.getWidgetById(this.nm_index+"[vacationnotice]").set_value(_data.vacationnotice),this.et2.getWidgetById(this.nm_index+"[vacationrange]").set_value(_data.vacationrange)))},mail_refreshFilter2Options:function(_data){if(null!=_data&&(this.et2||this.checkET2())){var filter2=this.et2.getWidgetById("filter2"),current=filter2.value,currentexists=!1;for(var k in _data)k==current&&(currentexists=!0);currentexists||filter2.set_value(""),filter2.set_select_options(_data)}},mail_refreshFilterOptions:function(_data){if(null!=_data&&(this.et2||this.checkET2())){var filter=this.et2.getWidgetById("filter"),current=filter.value,currentexists=!1;for(var k in _data)k==current&&(currentexists=!0);currentexists||filter.set_value("any"),filter.set_select_options(_data)}},mail_refreshCatIdOptions:function(_data){if(null!=_data&&(this.et2||this.checkET2())){var filter=this.et2.getWidgetById("cat_id"),current=filter.value,currentexists=!1;for(var k in _data)k==current&&(currentexists=!0);currentexists||filter.set_value("quick"),filter.set_select_options(_data)}},mail_queueRefreshFolderList:function(_folders){var self=this;window.setTimeout(function(){egw.jsonq("mail.mail_ui.ajax_setFolderStatus",[_folders],function(){self.unlock_tree()})},100)},mail_CheckFolderNoSelect:function(action,_senders,_currentNode){var ftree,node;return ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),ftree&&(node=ftree.getNode(_senders[0].id)),!node||-1===node.im0.indexOf("NoSelect")},spamfolder_enabled:function(_action,_senders,_currentNode){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),acc_id=_senders[0].id.split("::")[0],node=ftree?ftree.getNode(acc_id):null;return node&&node.data&&node.data.spamfolder},sieve_enabled:function(_action,_senders,_currentNode){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),acc_id=_senders[0].id.split("::")[0],node=ftree?ftree.getNode(acc_id):null;return node&&node.data&&node.data.sieve},acl_enabled:function(_action,_senders,_currentNode){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),inbox=_senders[0].id.split("::")[0]+"::INBOX",node=ftree?ftree.getNode(inbox):null;return node&&node.data.acl&&this.mail_CheckFolderNoSelect(_action,_senders,_currentNode)},mail_setFolderStatus:function(_status){if(this.et2||this.checkET2()){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]");for(var i in _status)ftree.setLabel(i,_status[i]),ftree.setStyle(i,"font-weight: "+(_status[i].match(this._unseen_regexp)?"bold":"normal"))}},mail_setLeaf:function(_status){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),selectedNode=ftree.getSelectedNode();for(var i in _status)if("undefined"!=typeof _status[i].olddesc&&"#skip-user-interaction-message#"!==_status[i].olddesc&&this.egw.message(this.egw.lang("Renamed Folder %1 to %2",_status[i].olddesc,_status[i].desc)),ftree.renameItem(i,_status[i].id,_status[i].desc),ftree.setStyle(i,"font-weight: "+(_status[i].desc.match(this._unseen_regexp)?"bold":"normal")),_status[i].id==selectedNode.id){var nm=this.et2.getWidgetById(this.nm_index);nm.activeFilters.selectedFolder=_status[i].id,nm.applyFilters()}},mail_removeLeaf:function(_status){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),selectedNode=ftree.getSelectedNode();for(var i in _status){"undefined"!=typeof _status[i]&&"#skip-user-interaction-message#"!==_status[i]&&this.egw.message(this.egw.lang("Removed Folder %1 ",_status[i])),ftree.deleteItem(i,selectedNode.id==i);var selectedNodeAfter=ftree.getSelectedNode();if(selectedNodeAfter.id!=selectedNode.id&&selectedNode.id==i){var nm=this.et2.getWidgetById(this.nm_index);nm.activeFilters.selectedFolder=selectedNodeAfter.id,nm.applyFilters()}}},mail_reloadNode:function(_status){var ftree=this.et2?this.et2.getWidgetById(this.nm_index+"[foldertree]"):null;if(ftree){var selectedNode=ftree.getSelectedNode();for(var i in _status)"undefined"!=typeof _status[i]&&"#skip-user-interaction-message#"!==_status[i]&&("undefined"!=typeof _status[i].parent?this.egw.message(this.egw.lang("Reloaded Folder %1","string"==typeof _status[i]?_status[i].replace(this._unseen_regexp,""):_status[i].text.replace(this._unseen_regexp,""))):this.egw.message(this.egw.lang("Reloaded Account %1","string"==typeof _status[i]?_status[i].replace(this._unseen_regexp,""):_status[i].text.replace(this._unseen_regexp,"")))),ftree.refreshItem(i,"object"==typeof _status[i]?_status[i]:null),"string"==typeof _status[i]&&ftree.setStyle(i,"font-weight: "+(_status[i].match(this._unseen_regexp)?"bold":"normal"));var selectedNodeAfter=ftree.getSelectedNode();if(null!=selectedNodeAfter&&selectedNodeAfter.id!=selectedNode.id){var nm=this.et2.getWidgetById(this.nm_index);nm.activeFilters.selectedFolder=selectedNodeAfter.id,nm.applyFilters()}}},mail_refreshMessageGrid:function(_isPopup){"undefined"==typeof _isPopup&&(_isPopup=!1);var nm;nm=_isPopup&&!this.mail_isMainWindow?window.opener.etemplate2.getByApplication("mail")[0].widgetContainer.getWidgetById(this.nm_index):this.et2.getWidgetById(this.nm_index),nm.applyFilters()},mail_getMsg:function(){var msg_wdg=this.et2.getWidgetById("msg");return msg_wdg?msg_wdg.valueOf().htmlNode[0].innerHTML:""},mail_setMsg:function(myMsg){var msg_wdg=this.et2.getWidgetById("msg");msg_wdg&&(msg_wdg.set_value(myMsg),msg_wdg.set_disabled(0==myMsg.trim().length))},mail_delete:function(_action,_elems){this.mail_checkAllSelected(_action,_elems,null,!0)},mail_callDelete:function(_action,_elems,_allMessagesChecked){var calledFromPopup=!1;if("undefined"==typeof _allMessagesChecked&&(_allMessagesChecked=!1),"undefined"==typeof _elems||0==_elems.length){if(calledFromPopup=!0,this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var msg=this.mail_getFormData(_elems);return msg.all=_allMessagesChecked,"cancel"==msg.all?!1:(msg.all&&(msg.activeFilters=this.mail_getActiveFilters(_action)),calledFromPopup||this.mail_setRowClass(_elems,"deleted"),this.mail_deleteMessages(msg,"no",calledFromPopup),void(calledFromPopup&&0==this.mail_isMainWindow&&egw(window).close()))},mail_reduceCounterWithoutServerRoundtrip:function(){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),_foldernode=ftree.getSelectedNode(),counter=_foldernode.label.match(this._unseen_regexp),icounter=0;if(counter&&(icounter=parseInt(counter[0].replace(" (","").replace(")",""))),icounter>0){var newcounter=icounter-1;newcounter>0&&(_foldernode.label=_foldernode.label.replace(" ("+String(icounter)+")"," ("+String(newcounter)+")")),0==newcounter&&(_foldernode.label=_foldernode.label.replace(" ("+String(icounter)+")","")),ftree.setLabel(_foldernode.id,_foldernode.label)}},_unseen_regexp:/ \([0-9]+\)$/,mail_splitRowId:function(_rowID){var res=_rowID.split("::");return 4!=res.length||isNaN(parseInt(res[0]))||res.unshift("mail"),res},mail_deleteMessages:function(_msg,_action,_calledFromPopup){var message,ftree,_foldernode,displayname;ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),ftree?(_foldernode=ftree.getSelectedNode(),displayname=_foldernode.label.replace(this._unseen_regexp,"")):(message=this.mail_splitRowId(_msg.msg[0]),message[3]&&(_foldernode=displayname=jQuery.base64Decode(message[3]))),egw.json("mail.mail_ui.ajax_deleteMessages",[_msg,"undefined"==typeof _action?"no":_action]).sendRequest(!0),_msg.all&&this.egw.refresh(this.egw.lang("deleted %1 messages in %2",_msg.all?egw.lang("all"):_msg.msg.length,displayname?displayname:egw.lang("current folder")),"mail"),this.egw.message(this.egw.lang("deleted %1 messages in %2",_msg.all?egw.lang("all"):_msg.msg.length,displayname?displayname:egw.lang("current Folder")))},mail_deleteMessagesShowResult:function(_msg){for(var ids=[],i=0;i<_msg.msg.length;i++)ids.push(_msg.msg[i].replace(/mail::/,""));_msg.all?this.egw.refresh(_msg.egw_message,"mail"):(this.egw.refresh(_msg.egw_message,"mail",ids,"delete"),this.et2.getWidgetById(this.nm_index).controller._selectionMgr.resetSelection())},mail_retryForcedDelete:function(responseObject){var reason=responseObject.response,messageList=responseObject.messageList;confirm(reason)?this.mail_deleteMessages(messageList,"remove_immediately"):(this.egw.message(this.egw.lang("canceled deletion due to userinteraction")),this.mail_removeRowClass(messageList,"deleted")),this.mail_refreshMessageGrid(),this.mail_preview()},mail_undeleteMessages:function(_messageList){},mail_emptySpam:function(action,_senders){var server=_senders[0].iface.id.split("::"),activeFilters=this.mail_getActiveFilters(),self=this;if(this.egw.message(this.egw.lang("empty junk")),egw.json("mail.mail_ui.ajax_emptySpam",[server[0],activeFilters.selectedFolder?activeFilters.selectedFolder:null],function(){self.unlock_tree()}).sendRequest(!0),window.localStorage)for(var i=0;i<window.localStorage.length;i++){var key=window.localStorage.key(i);0==key.indexOf('cached_fetch_mail::{"selectedFolder":"'+server[0]+"::")&&key.toLowerCase().indexOf(egw.lang("junk").toLowerCase())>0&&window.localStorage.removeItem(key)}},mail_emptyTrash:function(action,_senders){var server=_senders[0].iface.id.split("::"),activeFilters=this.mail_getActiveFilters(),self=this;if(this.egw.message(this.egw.lang("empty trash")),egw.json("mail.mail_ui.ajax_emptyTrash",[server[0],activeFilters.selectedFolder?activeFilters.selectedFolder:null],function(){self.unlock_tree()}).sendRequest(!0),window.localStorage)for(var i=0;i<window.localStorage.length;i++){var key=window.localStorage.key(i);0==key.indexOf('cached_fetch_mail::{"selectedFolder":"'+server[0]+"::")&&key.toLowerCase().indexOf(egw.lang("trash").toLowerCase())>0&&window.localStorage.removeItem(key)}},mail_compressFolder:function(action,_senders){this.egw.message(this.egw.lang("compress folder")),egw.jsonq("mail.mail_ui.ajax_compressFolder",[_senders[0].iface.id])},mail_changeProfile:function(folder,_widget,getFolders){return"undefined"==typeof getFolders&&(getFolders=!0),this.egw.message(this.egw.lang("Connect to Profile %1",_widget.getSelectedLabel().replace(this._unseen_regexp,""))),_widget.openItem(folder,!0),this.lock_tree(),egw.json("mail_ui::ajax_changeProfile",[folder,getFolders,this.et2._inst.etemplate_exec_id],jQuery.proxy(function(){var inbox=folder+"::INBOX";_widget.reSelectItem(inbox),this.mail_changeFolder(inbox,_widget,""),this.unlock_tree()},this)).sendRequest(!0),!0},mail_changeFolder:function(_folder,_widget,_previous){this.loadIframe();var img=_widget.getSelectedNode().images[0];if(-1!==img.indexOf("NoSelect"))return void _widget.reSelectItem(_previous);var server=_folder.split("::"),previousServer=_previous.split("::"),profile_selected=-1===_folder.indexOf("::");if(server[0]!=previousServer[0]&&profile_selected)return this.mail_changeProfile(_folder,_widget,0==_widget.getSelectedNode().childsCount);var nm=_widget.getRoot().getWidgetById(this.nm_index);if(nm&&(this.lock_tree(),nm.applyFilters({selectedFolder:_folder})),!profile_selected){var displayname=_widget.getSelectedLabel(),myMsg=(displayname?displayname:_folder).replace(this._unseen_regexp,"")+" "+this.egw.lang("selected");this.egw.message(myMsg)}this.mail_refreshFolderStatus(_folder,"forced",!1,!1),this.mail_refreshQuotaDisplay(server[0]),this.mail_preview(),server[0]!=previousServer[0]&&(this.mail_callRefreshVacationNotice(server[0]),egw.jsonq("mail.mail_ui.ajax_refreshFilters",[server[0]]))},mail_checkAllSelected:function(_action,_elems,_target,_confirm){"undefined"==typeof _confirm&&(_confirm=!1);var obj_manager=egw_getObjectManager(this.appname).getObjectById(this.nm_index),that=this,rvMain=!1;
if(obj_manager&&_elems.length>1&&obj_manager.getAllSelected()&&!_action.paste||"readall"==_action.id){if(_confirm){var buttons=[{text:this.egw.lang("Yes"),id:"all",class:"ui-priority-primary",default:!0},{text:this.egw.lang("Cancel"),id:"cancel"}],messageToDisplay="",actionlabel=_action.id;switch(_action.id){case"readall":messageToDisplay=this.egw.lang("Do you really want to mark ALL messages as read in the current folder?")+" ";break;case"unlabel":messageToDisplay=this.egw.lang("Do you really want to remove ALL labels from ALL messages in the current folder?")+" ";break;case"label1":"label1"==_action.id&&(actionlabel="important");case"label2":"label2"==_action.id&&(actionlabel="job");case"label3":"label3"==_action.id&&(actionlabel="personal");case"label4":"label4"==_action.id&&(actionlabel="to do");case"label5":"label5"==_action.id&&(actionlabel="later");case"flagged":case"read":case"undelete":messageToDisplay=this.egw.lang("Do you really want to toggle flag %1 for ALL messages in the current view?",this.egw.lang(actionlabel))+" ","label"==_action.id.substr(0,5)&&(messageToDisplay=this.egw.lang("Do you really want to toggle label %1 for ALL messages in the current view?",this.egw.lang(actionlabel))+" ");break;default:var type=null;"move"!=_action.id.substr(0,4)&&"drop_move_mail"!==_action.id||(type="Move"),"copy"!=_action.id.substr(0,4)&&"drop_copy_mail"!==_action.id||(type="Copy"),messageToDisplay=this.egw.lang("Do you really want to apply %1 to ALL messages in the current view?",this.egw.lang(type?type:_action.id))+" "}return et2_dialog.show_dialog(function(_button_id){var rv=!1;switch(_button_id){case"all":rv=!0;break;case"cancel":rv="cancel"}switch("cancel"!=rv&&that.lock_tree(),_action.id){case"delete":that.mail_callDelete(_action,_elems,rv);break;case"readall":case"unlabel":case"label1":case"label2":case"label3":case"label4":case"label5":case"flagged":case"read":case"undelete":that.mail_callFlagMessages(_action,_elems,rv);break;case"drop_move_mail":that.mail_callMove(_action,_elems,_target,rv);break;case"drop_copy_mail":that.mail_callCopy(_action,_elems,_target,rv);break;default:"move"==_action.id.substr(0,4)&&that.mail_callMove(_action,_elems,_target,rv),"copy"==_action.id.substr(0,4)&&that.mail_callCopy(_action,_elems,_target,rv)}},messageToDisplay,this.egw.lang("Confirm"),_action.id,buttons)}rvMain=!0}switch(_action.id){case"delete":this.mail_callDelete(_action,_elems,rvMain);break;case"unlabel":case"label1":case"label2":case"label3":case"label4":case"label5":case"flagged":case"read":case"undelete":this.mail_callFlagMessages(_action,_elems,rvMain);break;case"drop_move_mail":this.mail_callMove(_action,_elems,_target,rvMain);break;case"drop_copy_mail":this.mail_callCopy(_action,_elems,_target,rvMain);break;default:"move"==_action.id.substr(0,4)&&this.mail_callMove(_action,_elems,_target,rvMain),"copy"==_action.id.substr(0,4)&&this.mail_callCopy(_action,_elems,_target,rvMain)}},mail_doActionCall:function(_action,_elems){},mail_getActiveFilters:function(_action){var obj_manager=egw_getObjectManager(this.appname).getObjectById(this.nm_index);return obj_manager&&obj_manager.manager&&obj_manager.manager.data&&obj_manager.manager.data.nextmatch&&obj_manager.manager.data.nextmatch.activeFilters?obj_manager.manager.data.nextmatch.activeFilters:!1},mail_flag:function(_action,_elems){this.mail_checkAllSelected(_action,_elems,null,!0)},mail_callFlagMessages:function(_action,_elems,_allMessagesChecked){var folder="",tree={},formData={},data={msg:[this.et2.getArrayMgr("content").getEntry("mail_id")]||"",all:_allMessagesChecked||!1,popup:egw(window).is_popup()||!1,activeFilters:"readall"==_action.id?!1:this.mail_getActiveFilters(_action)},rowClass=_action.id;switch("undefined"==typeof _elems||0==_elems.length?this.mail_isMainWindow&&this.mail_currentlyFocussed&&(data.msg=[this.mail_currentlyFocussed],_elems=data,data.msg=this.mail_getFormData(_elems).msg):data.msg=this.mail_getFormData(_elems).msg,_action.id){case"read":rowClass="seen",tree=data.popup?opener.etemplate2.getByApplication("mail")[0].widgetContainer.getWidgetById(this.nm_index+"[foldertree]"):this.et2.getWidgetById(this.nm_index+"[foldertree]"),folder=tree.getSelectedNode().id;break;case"readall":rowClass="seen";break;case"label1":rowClass="labelone";break;case"label2":rowClass="labeltwo";break;case"label3":rowClass="labelthree";break;case"label4":rowClass="labelfour";break;case"label5":rowClass="labelfive"}if(jQuery(data).extend({},data,formData),"cancel"==data.all)return!1;if("un"==_action.id.substring(0,2))if("unlabel"==_action.id){for(var labels=["labelone","labeltwo","labelthree","labelfour","labelfive"],i=0;i<labels.length;i++)this.mail_removeRowClass(_elems,labels[i]);this.mail_flagMessages(_action.id,data)}else this.mail_removeRowClass(_elems,_action.id.substring(2)),this.mail_setRowClass(_elems,_action.id),this.mail_flagMessages(_action.id,data);else{if("readall"!=_action.id){for(var dataElem,flags,msg_set={msg:[]},msg_unset={msg:[]},classes="",i=0;i<data.msg.length;i++)dataElem=egw.dataGetUIDdata(data.msg[i]),"undefined"==typeof dataElem.data.flags&&(dataElem.data.flags={}),flags=dataElem.data.flags,classes=dataElem.data.class||"",classes=classes.split(" "),classes.indexOf(rowClass)>=0&&classes.splice(classes.indexOf(rowClass),1),classes.indexOf("un"+rowClass)>=0&&classes.splice(classes.indexOf("un"+rowClass),1),flags[_action.id]?(msg_unset.msg.push(data.msg[i]),classes.push("un"+rowClass),delete flags[_action.id]):(msg_set.msg.push(data.msg[i]),flags[_action.id]=_action.id,classes.push(rowClass)),dataElem.data.class=classes.join(" "),egw.dataStoreUID(data.msg[i],dataElem.data),this.updateFilter_data(data.msg[i],_action.id,data.activeFilters);return msg_unset.msg&&msg_unset.msg.length&&(data.all||this.mail_flagMessages("un"+_action.id,msg_unset)),msg_set.msg&&msg_set.msg.length&&(data.all||this.mail_flagMessages(_action.id,msg_set)),data.all&&this.mail_flagMessages(_action.id,data),void("read"==_action.id&&this.mail_refreshFolderStatus(folder,"thisfolderonly",!1,!0))}this.mail_flagMessages("read",data)}},updateFilter_data:function(_uid,_actionId,_filters){var uid=_uid.replace("mail::",""),action="";switch(_actionId){case"flagged":action="flagged";break;case"read":"seen"==_filters.filter?action="seen":"unseen"==_filters.filter&&(action="unseen");break;case"label1":action="keyword1";break;case"label2":action="keyword2";break;case"label3":action="keyword3";break;case"label4":action="keyword4";break;case"label4":action="keyword4"}action==_filters.filter&&egw.refresh("","mail",uid,"delete")},mail_flagMessages:function(_flag,_elems,_isPopup){egw.jsonq("mail.mail_ui.ajax_flagMessages",[_flag,_elems])},mail_displayHeaderLines:function(_url){egw_openWindowCentered(_url,"mail_display_headerLines","870","600",window.outerWidth/2,window.outerHeight/2)},mail_header:function(_action,_elems){if("undefined"==typeof _elems||0==_elems.length){if(this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var url=window.egw_webserverUrl+"/index.php?";url+="menuaction=mail.mail_ui.displayHeader",url+="&id="+_elems[0].id,this.mail_displayHeaderLines(url)},mail_mailsource:function(_action,_elems){if("undefined"==typeof _elems||0==_elems.length){if(this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var url=window.egw_webserverUrl+"/index.php?";url+="menuaction=mail.mail_ui.saveMessage",url+="&id="+_elems[0].id,url+="&location=display",this.mail_displayHeaderLines(url)},mail_save:function(_action,_elems){if("undefined"==typeof _elems||0==_elems.length){if(this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var url=window.egw_webserverUrl+"/index.php?";url+="menuaction=mail.mail_ui.saveMessage",url+="&id="+_elems[0].id,this.et2._inst.download(url)},address_click:function(tag_info,widget){},displayAttachment:function(tag_info,widget,calledForCompose){var mailid,attgrid;if("undefined"!=typeof calledForCompose&&"object"!=typeof calledForCompose||(calledForCompose=!1),calledForCompose===!1)if(this.mail_isMainWindow){mailid=this.mail_currentlyFocussed;var p=widget.getParent(),cont=p.getArrayMgr("content").data;attgrid=cont[widget.id.replace(/\[filename\]/,"")]}else mailid=this.et2.getArrayMgr("content").getEntry("mail_id"),attgrid=this.et2.getArrayMgr("content").getEntry("mail_displayattachments")[widget.id.replace(/\[filename\]/,"")];if(calledForCompose===!0){attgrid=this.et2.getArrayMgr("content").getEntry("attachments")[widget.id.replace(/\[name\]/,"")];var mailids=this.et2.getArrayMgr("content").getEntry("processedmail_id"),mailida=mailids.split(",");if(mailid=1==mailida.length?mailida[0]:mailida[widget.id.replace(/\[name\]/,"")],"undefined"!=typeof attgrid.uid&&attgrid.uid&&-1==mailid.indexOf(attgrid.uid))for(var i=0;i<mailida.length;i++)mailida[i].indexOf("::"+attgrid.uid)>-1&&(mailid=mailida[i])}var width,height,url=window.egw_webserverUrl+"/index.php?",windowName="mail";switch(attgrid.type.toUpperCase()){case"MESSAGE/RFC822":url+="menuaction=mail.mail_ui.displayMessage",url+="&mode=display",url+="&id="+mailid,url+="&part="+attgrid.partID,url+="&is_winmail="+attgrid.winmailFlag,windowName=windowName+"displayMessage_"+mailid+"_"+attgrid.partID,width=870,height=egw_getWindowOuterHeight();break;case"IMAGE/JPEG":case"IMAGE/PNG":case"IMAGE/GIF":case"IMAGE/BMP":case"APPLICATION/PDF":case"TEXT/PLAIN":case"TEXT/HTML":case"TEXT/DIRECTORY":case"TEXT/X-VCARD":case"TEXT/VCARD":case"TEXT/CALENDAR":case"TEXT/X-VCALENDAR":url+="menuaction=mail.mail_ui.getAttachment",url+="&id="+mailid,url+="&part="+attgrid.partID,url+="&is_winmail="+attgrid.winmailFlag,windowName=windowName+"displayAttachment_"+mailid+"_"+attgrid.partID;var reg2,reg="800x600";"TEXT/CALENDAR"==attgrid.type.toUpperCase()&&(windowName="maildisplayEvent_"+mailid+"_"+attgrid.partID,reg2=egw.link_get_registry("calendar"),"undefined"!=typeof reg2.view&&"undefined"!=typeof reg2.view_popup&&(reg=reg2.view_popup)),"TEXT/X-VCARD"!=attgrid.type.toUpperCase()&&"TEXT/VCARD"!=attgrid.type.toUpperCase()||(windowName="maildisplayContact_"+mailid+"_"+attgrid.partID,reg2=egw.link_get_registry("addressbook"),"undefined"!=typeof reg2.add&&"undefined"!=typeof reg2.add_popup&&(reg=reg2.add_popup));var w_h=reg.split("x");width=w_h[0],height=w_h[1];break;default:url+="menuaction=mail.mail_ui.getAttachment",url+="&id="+mailid,url+="&part="+attgrid.partID,url+="&is_winmail="+attgrid.winmailFlag,windowName=windowName+"displayAttachment_"+mailid+"_"+attgrid.partID,width=870,height=600}egw_openWindowCentered(url,windowName,width,height)},displayUploadedFile:function(tag_info,widget){var attgrid;if(attgrid=this.et2.getArrayMgr("content").getEntry("attachments")[widget.id.replace(/\[name\]/,"")],attgrid.uid&&(attgrid.partID||attgrid.folder))return void this.displayAttachment(tag_info,widget,!0);var width,height,get_param={menuaction:"mail.mail_compose.getAttachment",tmpname:attgrid.tmp_name,etemplate_exec_id:this.et2._inst.etemplate_exec_id},windowName="maildisplayAttachment_"+attgrid.file.replace(/\//g,"_");switch(attgrid.type.toUpperCase()){case"IMAGE/JPEG":case"IMAGE/PNG":case"IMAGE/GIF":case"IMAGE/BMP":case"APPLICATION/PDF":case"TEXT/PLAIN":case"TEXT/HTML":case"TEXT/DIRECTORY":case"TEXT/X-VCARD":case"TEXT/VCARD":case"TEXT/CALENDAR":case"TEXT/X-VCALENDAR":var reg2,reg="800x600";"TEXT/CALENDAR"==attgrid.type.toUpperCase()&&(windowName="maildisplayEvent_"+attgrid.file.replace(/\//g,"_"),reg2=egw.link_get_registry("calendar"),"undefined"!=typeof reg2.view&&"undefined"!=typeof reg2.view_popup&&(reg=reg2.view_popup)),"TEXT/X-VCARD"!=attgrid.type.toUpperCase()&&"TEXT/VCARD"!=attgrid.type.toUpperCase()||(windowName="maildisplayContact_"+attgrid.file.replace(/\//g,"_"),reg2=egw.link_get_registry("addressbook"),"undefined"!=typeof reg2.add&&"undefined"!=typeof reg2.add_popup&&(reg=reg2.add_popup));var w_h=reg.split("x");width=w_h[0],height=w_h[1];break;case"MESSAGE/RFC822":default:get_param.mode="save",width=870,height=600}egw.openPopup(egw.link("/index.php",get_param),width,height,windowName)},saveAttachment:function(tag_info,widget){var mailid,attgrid;if(this.mail_isMainWindow){mailid=this.mail_currentlyFocussed;var p=widget.getParent(),cont=p.getArrayMgr("content").data;attgrid=cont[widget.id.replace(/\[save\]/,"")]}else mailid=this.et2.getArrayMgr("content").getEntry("mail_id"),attgrid=this.et2.getArrayMgr("content").getEntry("mail_displayattachments")[widget.id.replace(/\[save\]/,"")];var url=window.egw_webserverUrl+"/index.php?";url+="menuaction=mail.mail_ui.getAttachment",url+="&mode=save",url+="&id="+mailid,url+="&part="+attgrid.partID,url+="&is_winmail="+attgrid.winmailFlag,this.et2._inst.download(url)},saveAllAttachmentsToZip:function(tag_info,widget){var mailid,attgrid;if(this.mail_isMainWindow){mailid=this.mail_currentlyFocussed;var p=widget.getParent(),cont=p.getArrayMgr("content").data;attgrid=cont[widget.id.replace(/\[save\]/,"")]}else mailid=this.et2.getArrayMgr("content").getEntry("mail_id"),attgrid=this.et2.getArrayMgr("content").getEntry("mail_displayattachments")[widget.id.replace(/\[save\]/,"")];var url=window.egw_webserverUrl+"/index.php?";url+="menuaction=mail.mail_ui.download_zip",url+="&mode=save",url+="&id="+mailid,this.et2._inst.download(url)},saveAttachmentToVFS:function(tag_info,widget){var mailid,attgrid;if(this.mail_isMainWindow){mailid=this.mail_currentlyFocussed;var p=widget.getParent(),cont=p.getArrayMgr("content").data;attgrid=cont[widget.id.replace(/\[saveAsVFS\]/,"")]}else mailid=this.et2.getArrayMgr("content").getEntry("mail_id"),attgrid=this.et2.getArrayMgr("content").getEntry("mail_displayattachments")[widget.id.replace(/\[saveAsVFS\]/,"")];var url=window.egw_webserverUrl+"/index.php?",width=640,height=570,windowName="mail";url+="menuaction=filemanager.filemanager_select.select",url+="&mode=saveas",url+="&id="+mailid+"::"+attgrid.partID+"::"+attgrid.winmailFlag,url+="&name="+attgrid.filename,url+="&type="+attgrid.type.toLowerCase(),url+="&method=mail.mail_ui.vfsSaveAttachment",url+="&label="+egw.lang("Save"),egw_openWindowCentered(url,windowName,width,height)},saveAllAttachmentsToVFS:function(tag_info,widget){var mailid,attgrid;if(this.mail_isMainWindow){mailid=this.mail_currentlyFocussed;var p=widget.getParent();attgrid=p.getArrayMgr("content").data}else mailid=this.et2.getArrayMgr("content").getEntry("mail_id"),attgrid=this.et2.getArrayMgr("content").getEntry("mail_displayattachments");var url=window.egw_webserverUrl+"/index.php?",width=640,height=570,windowName="mail";url+="menuaction=filemanager.filemanager_select.select",url+="&mode=select-dir",url+="&method=mail.mail_ui.vfsSaveAttachment",url+="&label="+egw.lang("Save all");for(var i=0;i<attgrid.length;i++)null!=attgrid[i]&&(url+="&id["+i+"]="+mailid+"::"+attgrid[i].partID+"::"+attgrid[i].winmailFlag+"::"+attgrid[i].filename);egw_openWindowCentered(url,windowName,width,height)},mail_save2fm:function(_action,_elems){if("undefined"==typeof _elems||0==_elems.length){if(this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var _id=_elems[0].id,dataElem=egw.dataGetUIDdata(_id),url=window.egw_webserverUrl+"/index.php?";url+="menuaction=filemanager.filemanager_select.select",url+="&mode=saveas";var subject=dataElem?dataElem.data.subject:_elems[0].subject,filename=subject.replace(/[\f\n\t\v]/g,"_")||"unknown";url+="&name="+encodeURIComponent(filename+".eml"),url+="&mime=message"+encodeURIComponent("/")+"rfc822",url+="&method=mail.mail_ui.vfsSaveMessage",url+="&id="+_elems[0].id,url+="&label=Save",egw_openWindowCentered(url,"vfs_save_message_"+_elems[0].id,"680","400",window.outerWidth/2,window.outerHeight/2)},mail_integrate:function(_action,_elems){var app=_action.id,w_h=["750","580"];if("undefined"!=typeof _action.data&&("undefined"!=typeof _action.data.popup&&_action.data.popup&&(w_h=_action.data.popup.split("x")),"undefined"!=typeof _action.data.mail_import))var mail_import_hook=_action.data.mail_import;if("undefined"==typeof _elems||0==_elems.length){if(this.et2.getArrayMgr("content").getEntry("mail_id")){var _elems=[];_elems.push({id:this.et2.getArrayMgr("content").getEntry("mail_id")||""})}if(("undefined"==typeof _elems||0==_elems.length)&&this.mail_isMainWindow&&this.mail_currentlyFocussed){var _elems=[];_elems.push({id:this.mail_currentlyFocussed})}}var url=window.egw_webserverUrl+"/index.php?menuaction=mail.mail_integration.integrate&rowid="+_elems[0].id+"&app="+app;check_app_entry=function(_title,_appName,_appCheckCallback){var data=egw.dataGetUIDdata(_elems[0].id),subject=data&&"undefined"!=typeof data.data?data.data.subject:"";egw.json(_appCheckCallback,subject,function(_entryId){if(_entryId)egw_openWindowCentered(url,"import_mail_"+_elems[0].id,w_h[0],w_h[1]);else{var buttons=[{text:"Append",id:"append",image:"check",default:!0},{text:"Add as new",id:"new",image:"check"},{text:"Cancel",id:"cancel",image:"check"}];et2_createWidget("dialog",{callback:function(_buttons,_value){"cancel"!=_buttons&&("append"==_buttons&&_value&&(url+="&entry_id="+_value.id),egw_openWindowCentered(url,"import_mail_"+_elems[0].id,w_h[0],w_h[1]))},title:egw.lang(_title),buttons:buttons||et2_dialog.BUTTONS_OK_CANCEL,value:{content:{appName:_appName}},template:egw.webserverUrl+"/mail/templates/default/integration_to_entry_dialog.xet"},et2_dialog._create_parent("mail"))}},this,!0,this).sendRequest()},mail_import_hook&&"undefined"!=typeof mail_import_hook.app_entry_method?check_app_entry("Select "+app+" entry",app,mail_import_hook.app_entry_method):egw_openWindowCentered(url,"import_mail_"+_elems[0].id,w_h[0],w_h[1])},mail_getFormData:function(_actionObjects){var messages={};if("undefined"!=typeof _actionObjects.msg&&_actionObjects.msg.length>0)return _actionObjects;_actionObjects.length>0&&(messages.msg=[]);for(var i=0;i<_actionObjects.length;i++)_actionObjects[i].id.length>0&&(messages.msg[i]=_actionObjects[i].id);return messages},mail_setRowClass:function(_actionObjects,_class){if("undefined"==typeof _class)return!1;if("undefined"==typeof _actionObjects.msg){for(var i=0;i<_actionObjects.length;i++)if(_actionObjects[i].id.length>0&&_actionObjects[i].iface){var dataElem=$j(_actionObjects[i].iface.getDOMNode());dataElem.addClass(_class)}}else for(var i=0;i<_actionObjects.msg.length;i++){var mail_uid=_actionObjects.msg[i],dataElem=egw.dataGetUIDdata(mail_uid);if(null==dataElem||void 0==typeof dataElem)return;switch(dataElem.data.class+=" "+_class,_class){case"unseen":delete dataElem.data.flags.read}egw.dataStoreUID(mail_uid,dataElem.data)}},mail_removeRowClass:function(_actionObjects,_class){if("undefined"==typeof _class)return!1;if("undefined"==typeof _actionObjects.msg){for(var i=0;i<_actionObjects.length;i++)if(_actionObjects[i].id.length>0){var dataElem=$j(_actionObjects[i].iface.getDOMNode());dataElem.removeClass(_class)}}else for(var i=0;i<_actionObjects.msg.length;i++){var mail_uid=_actionObjects.msg[i],dataElem=egw.dataGetUIDdata(mail_uid);if(null==dataElem||void 0==typeof dataElem)return;var classes=dataElem.data.class||"";if(classes=classes.split(" "),classes.indexOf(_class)>=0){switch(classes.splice(classes.indexOf(_class),1),dataElem.data.class=classes.join(" "),_class){case"unseen":dataElem.data.flags.read=!0}egw.dataStoreUID(mail_uid,dataElem.data)}}},mail_move2folder:function(_action,_elems){this.mail_move(_action,_elems,null)},mail_move:function(_action,_senders,_target){this.mail_checkAllSelected(_action,_senders,_target,!0)},mail_callMove:function(_action,_senders,_target,_allMessagesChecked){var target="drop_move_mail"==_action.id?_target.iface.id:_action.id.substr(5),messages=this.mail_getFormData(_senders);if("undefined"==typeof _allMessagesChecked&&(_allMessagesChecked=!1),window.localStorage)for(var i=0;i<window.localStorage.length;i++){var key=window.localStorage.key(i);0==key.indexOf('cached_fetch_mail::{"selectedFolder":"'+target+'"')&&window.localStorage.removeItem(key)}if(messages.all=_allMessagesChecked,"cancel"==messages.all)return!1;messages.all&&(messages.activeFilters=this.mail_getActiveFilters(_action)),target.match(/::/g)||(target+="::INBOX");var self=this,nm=this.et2.getWidgetById(this.nm_index);egw.json("mail.mail_ui.ajax_copyMessages",[target,messages,"move"],function(){self.unlock_tree(),nm.controller._selectionMgr.resetSelection();var tree=self.et2.getWidgetById("nm[foldertree]");nm&&tree&&target==tree.getValue()&&nm.refresh()}).sendRequest(),this.mail_setRowClass(_senders,"deleted")},mail_copy:function(_action,_senders,_target){this.mail_checkAllSelected(_action,_senders,_target,!0)},mail_callCopy:function(_action,_senders,_target,_allMessagesChecked){var target="drop_copy_mail"==_action.id?_target.iface.id:_action.id.substr(5),messages=this.mail_getFormData(_senders);if("undefined"==typeof _allMessagesChecked&&(_allMessagesChecked=!1),messages.all=_allMessagesChecked,"cancel"==messages.all)return!1;messages.all&&(messages.activeFilters=this.mail_getActiveFilters(_action));var self=this;egw.json("mail.mail_ui.ajax_copyMessages",[target,messages],function(){self.unlock_tree()}).sendRequest()},mail_AddFolder:function(_action,_senders){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),OldFolderName=ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,""),buttons=[{text:this.egw.lang("Add"),id:"add",class:"ui-priority-primary",default:!0},{text:this.egw.lang("Cancel"),id:"cancel"}];et2_dialog.show_prompt(function(_button_id,_value){var NewFolderName=null;if(_value.length>0&&(NewFolderName=_value),NewFolderName&&NewFolderName.length>0)switch(_button_id){case"add":return void egw.json("mail.mail_ui.ajax_addFolder",[_senders[0].id,NewFolderName]).sendRequest(!0);case"cancel":}},this.egw.lang("Enter the name for the new Folder:"),this.egw.lang("Add a new Folder to %1:",OldFolderName),"",buttons)},mail_RenameFolder:function(_action,_senders){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),OldFolderName=ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,""),buttons=[{text:this.egw.lang("Rename"),id:"rename",class:"ui-priority-primary",image:"edit",default:!0},{text:this.egw.lang("Cancel"),id:"cancel"}];et2_dialog.show_prompt(function(_button_id,_value){var NewFolderName=null;if(_value.length>0&&(NewFolderName=_value),NewFolderName&&NewFolderName.length>0)switch(_button_id){case"rename":return void egw.json("mail.mail_ui.ajax_renameFolder",[_senders[0].id,NewFolderName]).sendRequest(!0);case"cancel":}},this.egw.lang("Rename Folder %1 to:",OldFolderName),this.egw.lang("Rename Folder %1 ?",OldFolderName),OldFolderName,buttons)},mail_MoveFolder:function(_action,_senders,destination){if(!destination||!destination.id)return void egw.debug("warn","Move folder, but no target");var sourceProfile=_senders[0].id.split("::"),targetProfile=destination.id.split("::");if(sourceProfile[0]!=targetProfile[0])return void egw.message(this.egw.lang("Moving Folders from one Mailaccount to another is not supported"),"error");var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),src_label=_senders[0].id.replace(/^[0-9]+::/,""),dest_label=destination.id.replace(/^[0-9]+::/,""),callback=function(_button){if(_button==et2_dialog.YES_BUTTON){egw.appName="mail",egw.message(egw.lang("Folder %1 is moving to folder %2",src_label,dest_label)),egw.loading_prompt("mail_moveFolder",!0,"","#egw_fw_basecontainer");for(var i=0;i<_senders.length;i++)egw.jsonq("mail.mail_ui.ajax_MoveFolder",[_senders[i].id,destination.id],function(){var id=destination.id.split("::");ftree.refreshItem(id[0],null),egw.loading_prompt("mail_moveFolder",!1)})}};et2_dialog.show_dialog(callback,this.egw.lang("Are you sure you want to move folder %1 to folder %2?",src_label,dest_label),this.egw.lang("Move folder"),{},et2_dialog.BUTTONS_YES_NO,et2_dialog.WARNING_MESSAGE)},mail_DeleteFolder:function(_action,_senders){var ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]"),OldFolderName=ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,""),buttons=[{text:this.egw.lang("Yes"),id:"delete",class:"ui-priority-primary",default:!0},{text:this.egw.lang("Cancel"),id:"cancel"}];et2_dialog.show_dialog(function(_button_id,_value){switch(_button_id){case"delete":return void egw.json("mail.mail_ui.ajax_deleteFolder",[_senders[0].id]).sendRequest(!0);case"cancel":}},this.egw.lang("Do you really want to DELETE Folder %1 ?",OldFolderName)+" "+(ftree.hasChildren(_senders[0].id)?this.egw.lang("All subfolders will be deleted too, and all messages in all affected folders will be lost"):this.egw.lang("All messages in the folder will be lost")),this.egw.lang("DELETE Folder %1 ?",OldFolderName),OldFolderName,buttons)},uploadForImport:function(_event,_file_count,_path){if(_file_count&&!jQuery.isEmptyObject(_event.data.getValue())){_event.data;this.et2_obj.submit()}},uploadForCompose:function(_event,_file_count,_path){if(_file_count&&!jQuery.isEmptyObject(_event.data.getValue())){_event.data;this.et2_obj.submit()}},composeUploadStart:function(){var boxAttachment=this.et2.getWidgetById("attachments");if(boxAttachment){var groupbox=boxAttachment.getParent();groupbox&&groupbox.set_disabled(!1)}var self=this;return setTimeout(function(){self.compose_resizeHandler()},100),!0},vfsUploadForImport:function(_egw,_widget,_window){jQuery.isEmptyObject(_widget)||jQuery.isEmptyObject(_widget.getValue())||this.et2_obj.submit()},vfsUploadForCompose:function(_egw,_widget,_window){jQuery.isEmptyObject(_widget)||jQuery.isEmptyObject(_widget.getValue())||this.et2_obj.submit()},submitOnChange:function(_egw,_widget){if(!jQuery.isEmptyObject(_widget)){if("undefined"!=typeof _widget.id)var widgetId=_widget.id;switch(widgetId){case"mimeType":this.et2_obj.submit();break;default:jQuery.isEmptyObject(_widget.getValue())||this.et2_obj.submit()}}},saveAsDraft:function(_egw_action,_action){var content=this.et2.getArrayMgr("content").data,action=_action;_egw_action&&"autosaving"!==_action&&(action=_egw_action.id);var widgets=["from","to","cc","bcc","subject","folder","replyto","mailaccount","mail_htmltext","mail_plaintext","lastDrafted","filemode","expiration","password"],widget={};for(var index in widgets)widget=this.et2.getWidgetById(widgets[index]),widget&&(content[widgets[index]]=widget.get_value());var self=this;if(content){if(this.mailvelope_editor)return this.mailvelope_editor.encrypt([]).then(function(_armored){content.mail_plaintext=_armored,self.egw.json("mail.mail_compose.ajax_saveAsDraft",[content,action],function(_data){self.savingDraft_response(_data,action)}).sendRequest(!0)},function(_err){self.egw.message(_err.message,"error")}),!1;this.egw.json("mail.mail_compose.ajax_saveAsDraft",[content,action],function(_data){self.savingDraft_response(_data,action)}).sendRequest(!0)}},savingDraft_response:function(_responseData,_action){if(jQuery.isEmptyObject(_responseData))return this.egw.message("Could not saved the message. Because, the response from server failed.","error"),!1;if(_responseData.success){var content=this.et2.getArrayMgr("content"),lastDrafted=this.et2.getWidgetById("lastDrafted"),folderTree="undefined"!=typeof opener.etemplate2.getByApplication("mail")[0]?opener.etemplate2.getByApplication("mail")[0].widgetContainer.getWidgetById("nm[foldertree]"):null,activeFolder=folderTree?folderTree.getSelectedNode():null;if(content){var prevDraftedId=content.data.lastDrafted;switch(content.data.lastDrafted=_responseData.draftedId,this.et2.setArrayMgr("content",content),lastDrafted.set_value(_responseData.draftedId),folderTree&&activeFolder&&"undefined"!=typeof activeFolder.id&&_responseData.draftfolder==activeFolder.id&&(prevDraftedId&&opener.egw_refresh(_responseData.message,"mail",prevDraftedId,"delete"),this.egw.refresh(_responseData.message,"mail",_responseData.draftedId)),_action){case"button[saveAsDraftAndPrint]":this.mail_compose_print("mail::"+_responseData.draftedId),this.egw.message(_responseData.message);break;case"autosaving":default:this.egw.message(_responseData.message)}}}else this.egw.message(_responseData.message,"error")},sieve_focus_radioBtn:function(_ev,_widget){_widget.getRoot().getWidgetById("action").set_value(_widget.id.replace(/^action_([^_]+)_text$/,"$1"))},sieve_vac_all_aliases:function(){var aliases=[],tmp=[],addr=this.et2.getWidgetById("addresses"),addresses=this.et2.getArrayMgr("sel_options").data.addresses;for(var id in addresses)aliases.push(id);if(addr){tmp=aliases.concat(addr.get_value());var deDuplicator=function(item,pos){return tmp.indexOf(item)==pos};aliases=tmp.filter(deDuplicator),addr.set_value(aliases)}},vacationFilterStatusChange:function(){var status=this.et2.getWidgetById("status"),s_date=this.et2.getWidgetById("start_date"),e_date=this.et2.getWidgetById("end_date"),by_date_label=this.et2.getWidgetById("by_date_label");status&&s_date&&e_date&&by_date_label&&(s_date.set_disabled("by_date"!=status.get_value()),e_date.set_disabled("by_date"!=status.get_value()),by_date_label.set_disabled("by_date"!=status.get_value()))},action:function(_type,_selected){var actionData,that=this,typeId=_type.id,linkData="",ruleID=_selected[0].id.split("_").pop()-1;if(_type)switch(_type.id){case"delete":var callbackDeleteDialog=function(button_id){button_id==et2_dialog.YES_BUTTON&&(actionData=_type.parent.data.widget.getArrayMgr("content"),that._do_action(typeId,actionData.data,ruleID))};et2_dialog.show_dialog(callbackDeleteDialog,this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"),{},et2_dialog.BUTTONS_YES_CANCEL,et2_dialog.WARNING_MESSAGE);break;case"add":linkData="mail.mail_sieve.edit",this.egw.open_link(linkData,"_blank","600x480");break;case"edit":linkData="mail.mail_sieve.edit&ruleID="+ruleID,this.egw.open_link(linkData,"_blank","600x480");break;case"enable":actionData=_type.parent.data.widget.getArrayMgr("content"),this._do_action(typeId,actionData.data,ruleID);break;case"disable":actionData=_type.parent.data.widget.getArrayMgr("content"),this._do_action(typeId,actionData.data,ruleID)}},_do_action:function(_typeID,_data,_selectedID,_msg){if(_typeID&&_data){var request=this.egw.json("mail.mail_sieve.ajax_action",[_typeID,_selectedID,_msg],null,null,!0);request.sendRequest()}},sieve_refresh:function(){this.et2._inst.submit()},acl_common_rights_selector:function(event,widget){var rowId=widget.id.replace(/[^0-9.]+/g,""),rights=[];switch(widget.get_value()){case"custom":break;case"aeiklprstwx":rights=widget.get_value().replace(/[k,x,t,e]/g,"cd").split("");break;default:rights=widget.get_value().split("")}if(rights.length>0)for(var i=0;i<this.aclRights.length;i++){var rightsWidget=this.et2.getWidgetById(rowId+"[acl_"+this.aclRights[i]+"]");rightsWidget.set_value(-1!=jQuery.inArray(this.aclRights[i],rights))}},acl_common_rights:function(event,widget){for(var rowId=widget.id.replace(/[^0-9.]+/g,""),aclCommonWidget=this.et2.getWidgetById(rowId+"[acl]"),rights="",i=0;i<this.aclRights.length;i++){var rightsWidget=this.et2.getWidgetById(rowId+"[acl_"+this.aclRights[i]+"]");"true"==rightsWidget.get_value()&&(rights+=this.aclRights[i])}for(var i=0;i<this.aclCommonRights.length;i++)rights.split("").sort().toString()==this.aclCommonRights[i].split("").sort().toString()&&(rights=this.aclCommonRights[i]);
-1==jQuery.inArray(rights,this.aclCommonRights)&&"lrswipcda"!=rights?aclCommonWidget.set_value("custom"):"lrswipcda"==rights?aclCommonWidget.set_value("aeiklprstwx"):aclCommonWidget.set_value(rights)},edit_sieve:function(_action,_senders){var acc_id=parseInt(_senders[0].id),url=this.egw.link("/index.php",{menuaction:"mail.mail_sieve.index",acc_id:acc_id,ajax:"true"});"undefined"==typeof window.framework?this.egw.open_link(url):this.loadIframe(url)},loadIframe:function(_url,_iFrame){var mailSplitter=this.et2.getWidgetById("mail.index.spliter"),quotaipercent=this.et2.getWidgetById("nm[quotainpercent]"),iframe=_iFrame||this.et2.getWidgetById("extra_iframe");if("undefined"!=typeof iframe&&iframe){if(_url&&iframe.set_src(_url),"undefined"!=typeof mailSplitter&&mailSplitter&&"undefined"!=typeof quotaipercent&&(mailSplitter.set_disabled(!!_url),quotaipercent.set_disabled(!!_url),iframe.set_disabled(!_url)),"extra_iframe"==iframe.id){if(egwIsMobile()){var nm=this.et2.getWidgetById(this.nm_index);nm.set_disabled(!!_url),iframe.set_disabled(!_url)}iframe.disabled?iframe.set_class(""):iframe.set_class("mail-index-extra-iframe")}return!0}return!1},edit_vacation:function(_action,_senders){var acc_id=parseInt(_senders[0].id);this.egw.open_link("mail.mail_sieve.editVacation&acc_id="+acc_id,"_blank","700x480")},subscription_refresh:function(_data){console.log(_data)},subscription_apply:function(_egw,_widget){var tree=etemplate2.getByApplication("mail")[0].widgetContainer.getWidgetById("foldertree");tree&&(tree.input._xfullXML=!0,this.subscription_treeLastState=tree.input.serializeTreeToJSON()),this.et2._inst.submit(_widget)},subscription_autoloadingStart:function(_id,_widget){var node=_widget.input._globalIdStorageFind(_id);if(node&&"undefined"!=typeof node.htmlNode){var img=jQuery("img",node.htmlNode)[0];img.src=egw.image("ajax-loader","admin")}return!0},subscription_autoloadingEnd:function(){return!0},edit_subscribe:function(_action,_senders){var acc_id=parseInt(_senders[0].id);this.egw.open_link("mail.mail_ui.subscription&acc_id="+acc_id,"_blank","720x500")},subscribe_folder:function(_action,_senders){var mailbox=_senders[0].id.split("::"),folder=mailbox[1],acc_id=mailbox[0],ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]");this.egw.message(this.egw.lang("Subscribe to Folder %1",ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,""))),egw.json("mail.mail_ui.ajax_foldersubscription",[acc_id,folder,!0]).sendRequest()},unsubscribe_folder:function(_action,_senders){var mailbox=_senders[0].id.split("::"),folder=mailbox[1],acc_id=mailbox[0],ftree=this.et2.getWidgetById(this.nm_index+"[foldertree]");this.egw.message(this.egw.lang("Unsubscribe from Folder %1",ftree.getLabel(_senders[0].id).replace(this._unseen_regexp,""))),egw.json("mail.mail_ui.ajax_foldersubscription",[acc_id,folder,!1]).sendRequest()},subscribe_onclick:function(_id,_widget){_widget.setSubChecked(_id,"toggle")},edit_acl:function(_action,_senders){var mailbox=_senders[0].id.split("::"),folder=mailbox[1]||"INBOX",acc_id=mailbox[0];this.egw.open_link("mail.mail_acl.edit&mailbox="+jQuery.base64Encode(folder)+"&acc_id="+acc_id,"_blank","640x480")},acl_folderChange:function(){var mailbox=this.et2.getWidgetById("mailbox");mailbox&&mailbox.taglist.getValue().length>0&&this.et2._inst.submit()},edit_account:function(_action,_senders){var acc_id=parseInt(_senders[0].id);this.egw.open_link("mail.mail_wizard.edit&acc_id="+acc_id,"_blank","720x500")},compose_fieldExpander_init:function(){var widgets={cc:{widget:{},jQClass:".mailComposeJQueryCc"},bcc:{widget:{},jQClass:".mailComposeJQueryBcc"},folder:{widget:{},jQClass:".mailComposeJQueryFolder"},replyto:{widget:{},jQClass:".mailComposeJQueryReplyto"}};for(var widget in widgets){var expanderBtn=widget+"_expander";widgets[widget].widget=this.et2.getWidgetById(widget),widgets[expanderBtn]={widget:this.et2.getWidgetById(expanderBtn)},"undefined"!=typeof widgets[widget].widget&&"undefined"!=typeof widgets[expanderBtn].widget&&0==widgets[widget].widget.get_value().length&&(widgets[expanderBtn].widget.set_disabled(!1),jQuery(widgets[widget].jQClass).hide())}},compose_resizeHandler:function(){if(!egwIsMobile())try{var bodyH=egw_getWindowInnerHeight(),textArea=this.et2.getWidgetById("mail_plaintext"),$headerSec=jQuery(".mailComposeHeaderSection"),attachments=this.et2.getWidgetById("attachments"),content=this.et2.getArrayMgr("content").data,prgV_H=150,attchV_H=68;if("undefined"!=typeof textArea&&null!=textArea){textArea.getParent().disabled&&(textArea=this.et2.getWidgetById("mail_htmltext"));var textAreaDelta="mail_htmltext"==textArea.id?20:40,delta=attachments.table.find("li").length>0&&attachments.table.height()>0?prgV_H:content.attachments?attchV_H:textAreaDelta,bodySize=bodyH-Math.round($headerSec.height()+$headerSec.offset().top)-delta;"mail_htmltext"!=textArea.id?(textArea.getParent().set_height(bodySize),textArea.set_height(bodySize)):"undefined"!=typeof textArea&&"mail_htmltext"==textArea.id?textArea.ckeditor.resize("100%",bodySize):textArea.set_height(bodySize-90)}}catch(e){}},compose_fieldExpander:function(event,widget){var expWidgets={cc:{},bcc:{},folder:{},replyto:{}};for(var name in expWidgets)expWidgets[name]=this.et2.getWidgetById(name+"_expander");if("undefined"!=typeof widget)switch(widget.id){case"cc_expander":jQuery(".mailComposeJQueryCc").show(),"undefined"!=typeof expWidgets.cc&&expWidgets.cc.set_disabled(!0);break;case"bcc_expander":jQuery(".mailComposeJQueryBcc").show(),"undefined"!=typeof expWidgets.bcc&&expWidgets.bcc.set_disabled(!0);break;case"folder_expander":jQuery(".mailComposeJQueryFolder").show(),"undefined"!=typeof expWidgets.folder&&expWidgets.folder.set_disabled(!0);break;case"replyto_expander":jQuery(".mailComposeJQueryReplyto").show(),"undefined"!=typeof expWidgets.replyto&&expWidgets.replyto.set_disabled(!0)}else if("undefined"==typeof widget){var widgets={cc:{},bcc:{},folder:{},replyto:{}};for(var widget in widgets)if(widgets[widget]=this.et2.getWidgetById(widget),widgets[widget].get_value().length)switch(widget){case"cc":jQuery(".mailComposeJQueryCc").show(),"undefiend"!=typeof expWidgets.cc&&expWidgets.cc.set_disabled(!0);break;case"bcc":jQuery(".mailComposeJQueryBcc").show(),"undefiend"!=typeof expWidgets.bcc&&expWidgets.bcc.set_disabled(!0);break;case"folder":jQuery(".mailComposeJQueryFolder").show(),"undefiend"!=typeof expWidgets.folder&&expWidgets.folder.set_disabled(!0);break;case"replyto":jQuery(".mailComposeJQueryReplyto").show(),"undefiend"!=typeof expWidgets.replyto&&expWidgets.replyto.set_disabled(!0)}}this.compose_resizeHandler()},lock_tree:function(){if(!document.getElementById("mail_folder_lock_div")){var parent=jQuery("#mail-index_nm\\[foldertree\\]"),lock_div=jQuery(document.createElement("div"));lock_div.attr("id","mail_folder_lock_div").addClass("mail_folder_lock"),parent.prepend(lock_div)}},unlock_tree:function(){jQuery("#mail_folder_lock_div").remove()},openstart_tree:function(_id,_widget,_hasChildren){return-1!=_id.indexOf("::")||_hasChildren||this.lock_tree(),!0},openend_tree:function(_id,_widget,_hasChildren){-1==_id.indexOf("::")&&1==_hasChildren&&this.unlock_tree()},mail_print:function(_action,_senders){var currentTemp=this.et2._inst.name;switch(currentTemp){case"mail.index":this.mail_prev_print(_action,_senders);break;case"mail.display":this.mail_display_print()}},mail_compose_print:function(_id){this.egw.open(_id,"mail","view","&print="+_id+"&mode=print")},print_for_compose:function(){var afterprint=function(){egw(window).close()};window.onafterprint?window.onafterprint=afterprint:setTimeout(function(){egw(window).close()},2e3)},mail_prepare_print:function(){var mainIframe=jQuery("#mail-display_mailDisplayBodySrc"),tmpPrintDiv=jQuery("#tempPrintDiv");if(0==tmpPrintDiv.length&&tmpPrintDiv.children()){tmpPrintDiv=jQuery(document.createElement("div")).attr("id","tempPrintDiv").addClass("tmpPrintDiv");var notAttached=!0}mainIframe&&(tmpPrintDiv[0].innerHTML=mainIframe.contents().find("body").html()),notAttached&&jQuery("#mail-display_mailDisplayBodySrc").after(tmpPrintDiv),tmpPrintDiv.find("#divAppboxHeader").remove()},mail_display_print:function(){this.egw.message("Printing...."),setTimeout(function(){egw(window).window.print()},100)},mail_prev_print:function(_action,_elems){this.mail_open(_action,_elems,"print")},vacation_change_account:function(_egw,_widget){_widget.getInstanceManager().submit()},recipients_onchange:function(){if(this.mailvelope_editor){var self=this;this.mailvelopeGetCheckRecipients().catch(function(_err){self.egw.message(_err.message,"error")})}this.set_dragging_dndCompose()},set_dragging_dndCompose:function(){var zIndex=100,dragItems=jQuery("div.ms-sel-item:not(div.ui-draggable)");dragItems.each(function(i,item){var $isErr=jQuery(item).find(".ui-state-error");$isErr.length>0&&delete dragItems.splice(i,1)}),dragItems.length>0&&(dragItems.draggable({appendTo:"body",containment:"document",distance:0,cursor:"move",cursorAt:{left:2},cancel:".ms-close-btn",delay:"300",revert:function(){return this.parent().find(".ms-sel-item").css("position","relative"),!0},start:function(event,ui){var dragItem=jQuery(this);(event.ctrlKey||event.metaKey)&&dragItem.addClass("mailCompose_copyEmail").css("cursor","copy"),dragItem.css("z-index",zIndex++),dragItem.css("position","absolute")},create:function(event,ui){jQuery(this).css("css","move")}}).draggable("disable"),window.setTimeout(function(){dragItems&&dragItems.data()&&"undefined"!=typeof dragItems.data().uiDraggable&&dragItems.draggable("enable")},100))},init_dndCompose:function(){var self=this,emailTags=jQuery("#mail-compose_to,#mail-compose_cc,#mail-compose_bcc");emailTags.hover(function(){self.set_dragging_dndCompose()}),emailTags.droppable({accept:".ms-sel-item",drop:function(event,ui){var emails,widget=self.et2.getWidgetById(this.getAttribute("name")),distLists=[],fromWidget={},parentWidgetDOM=ui.draggable.parentsUntil('div[id^="mail-compoe_"]',".ui-droppable");"undefined"!=parentWidgetDOM&&parentWidgetDOM.length>0&&(fromWidget=self.et2.getWidgetById(parentWidgetDOM.attr("name")));var draggedValue=ui.draggable.text(),dValueKey=draggedValue,distItem=ui.draggable.find(".mailinglist");if(distItem.length>0){var distItemId=parseInt(distItem.attr("data"));if(distItemId)for(var fromDistLists=resolveDistList(fromWidget),i=0;i<fromDistLists.length;i++)distItemId==fromDistLists[i].id&&(draggedValue=fromDistLists[i],dValueKey=fromDistLists[i].id)}if("undefined"!=typeof widget){emails=widget.get_value(),emails&&(emails=emails.concat([draggedValue])),distLists=resolveDistList(widget,emails),emails&&widget.set_value(emails),distLists.length>0&&widget.taglist.addToSelection(distLists),jQuery.isEmptyObject(fromWidget)||ui.draggable.attr("class").search("mailCompose_copyEmail")>-1?ui.draggable.removeClass("mailCompose_copyEmail").css("cursor","move"):_removeDragged(fromWidget,dValueKey)||jQuery(ui.draggable).draggable("option","revert",!0);var dragItems=jQuery("div.ms-sel-item");dragItems.each(function(i,item){var $isErr=jQuery(item).find(".ui-state-error");$isErr.length>0&&delete dragItems.splice(i,1)}),dragItems.draggable("destroy")}}});var _removeDragged=function(_widget,_value){if(_widget&&_value){var emails=_widget.get_value(),itemIndex=emails.indexOf(_value),dist=[];if(!(itemIndex>-1))return!1;emails.splice(itemIndex,1);var dist=resolveDistList(_widget,emails);if(_widget.set_value(emails),dist){for(var i=0;i<dist.length;i++)dist[i].id==_value&&dist.splice(i,1);_widget.taglist.addToSelection(dist)}}return!0},resolveDistList=function(_widget,_emails){for(var list=[],selectedList=_widget.taglist.getSelection(),i=0;i<selectedList.length;i++)isNaN(selectedList[i].id)||"mailinglist"!==selectedList[i].class||list.push(selectedList[i]);for(var key in _emails)isNaN(_emails[key])||_emails.splice(key,1);return list}},check_sharing_filemode:function(_node,_widget){_widget||(_widget=this.et2.getWidgetById("filemode"));var extended_settings="attach"!=_widget.get_value()&&this.egw.app("stylite");this.et2.getWidgetById("expiration").set_readonly(!extended_settings),this.et2.getWidgetById("password").set_readonly(!extended_settings),"share_rw"!=_widget.get_value()||this.egw.app("stylite")||(this.egw.message(this.egw.lang("Writable sharing requires EPL version!"),"info"),_widget.set_value("share_ro"))},subject2title:function(_node,_widget){_widget||(_widget=this.et2.getWidgetById("subject")),_widget&&_widget.get_value()&&(document.title=_widget.get_value())},clearIntevals:function(){for(var i=0;i<this.W_INTERVALS.length;i++)clearInterval(this.W_INTERVALS[i]),delete this.W_INTERVALS[i]},getWindowTitle:function(){var widget={};switch(this.et2._inst.name){case"mail.display":if(widget=this.et2.getWidgetById("mail_displaysubject"))return widget.options.value;break;case"mail.compose":if(widget=this.et2.getWidgetById("subject"))return widget.get_value()}},prepareMailvelopePrint:function(){var tempPrint=jQuery("div#tempPrintDiv"),mailvelopeTopContainer=jQuery("div.mailDisplayContainer"),originFrame=jQuery("#mail-display_mailDisplayBodySrc"),iframe=jQuery(this.mailvelope_iframe_selector);tempPrint.length>0&&(iframe.addClass("mailvelopeIframe").height(originFrame[0].contentWindow.document.body.scrollHeight+400),tempPrint.hide(),mailvelopeTopContainer.addClass("mailvelopeTopContainer"))},mailvelopeDisplay:function(_keyring){var self=this,mailvelope=window.mailvelope,iframe=jQuery("iframe#mail-display_mailDisplayBodySrc,iframe#mail-index_messageIFRAME"),armored=iframe.contents().find("td.td_display > pre").text().trim();if(""!=armored&&-1!==armored.indexOf(this.begin_pgp_message)){var container=iframe.parent()[0],container_selector=container.id?"#"+container.id:"div.mailDisplayContainer";options={showExternalContent:1==this.egw.preference("allowExternalIMGs")};var from_widget=this.et2.getWidgetById("FROM_0")||this.et2.getWidgetById("previewFromAddress");from_widget&&from_widget.value&&(options.senderAddress=from_widget.value.replace(/^.*<([^<>]+)>$/,"$1")),mailvelope.createDisplayContainer(container_selector,armored,_keyring,options).then(function(){iframe.hide(),self.prepareMailvelopePrint()},function(_err){self.egw.message(_err.message,"error")})}},mailvelope_editor:void 0,mailvelopeCompose:function(_keyring){delete this.mailvelope_editor;var mimeType=this.et2.getWidgetById("mimeType"),is_html=mimeType.get_value(),container=is_html?".mailComposeHtmlContainer":".mailComposeTextContainer",editor=this.et2.getWidgetById(is_html?"mail_htmltext":"mail_plaintext"),options={predefinedText:editor.get_value()},start_pgp=options.predefinedText.indexOf(this.begin_pgp_message);if(-1!=start_pgp){var end_pgp=options.predefinedText.indexOf(this.end_pgp_message);if(-1!=end_pgp){options={quotedMailHeader:options.predefinedText.slice(0,start_pgp).replace(/> /gm,"").trim()+"\n",quotedMail:options.predefinedText.slice(start_pgp,end_pgp+this.end_pgp_message.length+1).replace(/> /gm,""),quotedMailIndent:0!=start_pgp,predefinedText:options.predefinedText.slice(end_pgp+this.end_pgp_message.length+1).replace(/^> \s*/m,""),signMsg:!0};var composeToolbar=this.et2.getWidgetById("composeToolbar");composeToolbar.checkbox("pgp")||composeToolbar.checkbox("pgp",!0)}}var self=this;mailvelope.createEditorContainer(container,_keyring,options).then(function(_editor){self.mailvelope_editor=_editor,editor.set_disabled(!0),mimeType.set_readonly(!0)},function(_err){self.egw.message(_err.message,"error")})},togglePgpEncrypt:function(_action){var self=this;if(_action.checked){if("undefined"==typeof mailvelope)return this.mailvelopeInstallationOffer(),this.et2.getWidgetById("composeToolbar")._actionManager.getActionById("pgp").set_checked(!1),void jQuery("button#composeToolbar-pgp").toggleClass("toolbar_toggled");this.mailvelopeGetCheckRecipients().then(function(_recipients){var mimeType=self.et2.getWidgetById("mimeType");return mimeType.get_value()?(mimeType.set_value(!1),void self.et2._inst.submit()):void self.mailvelopeOpenKeyring().then(function(_keyring){self.mailvelopeCompose(_keyring)})}).catch(function(_err){self.egw.message(_err.message,"error"),self.et2.getWidgetById("composeToolbar")._actionManager.getActionById("pgp").set_checked(!1),jQuery("button#composeToolbar-pgp").toggleClass("toolbar_toggled")})}else et2_dialog.show_dialog(function(_button_id){_button_id==et2_dialog.YES_BUTTON?(self.et2.getWidgetById("mimeType").set_readonly(!1),self.et2.getWidgetById("mail_plaintext").set_disabled(!1),jQuery(self.mailvelope_iframe_selector).remove()):self.et2.getWidgetById("composeToolbar").checkbox("pgp",!0)},this.egw.lang("You will loose current message body, unless you save it to your clipboard!"),this.egw.lang("Switch off encryption?"),{},et2_dialog.BUTTON_YES_NO,et2_dialog.WARNING_MESSAGE,void 0,this.egw)},mailvelopeGetCheckRecipients:function(){var recipients=this.et2.getWidgetById("to").get_value();return recipients=recipients.concat(this.et2.getWidgetById("cc").get_value()),recipients=recipients.concat(this.et2.getWidgetById("bcc").get_value()),this._super.call(this,recipients)},compose_submitAction:function(_action){if(this.mailvelope_editor){var self=this;return this.mailvelopeGetCheckRecipients().then(function(_recipients){return self.mailvelope_editor.encrypt(_recipients)}).then(function(_armored){self.et2.getWidgetById("mimeType").set_value(!1),self.et2.getWidgetById("mail_plaintext").set_disabled(!1),self.et2.getWidgetById("mail_plaintext").set_value(_armored),self.et2._inst.submit(null,null,!0)}).catch(function(_err){self.egw.message(_err.message,"error")}),!1}this.et2._inst.submit(null,null,!0)},compose_setToggle:function(_action){var widget=this.et2.getWidgetById(_action.id);widget&&"undefined"!=typeof _action.checkbox&&_action.checkbox&&widget.set_value(_action.checked?"on":"off")},compose_priorityChange:function(_action){var widget=this.et2.getWidgetById("priority");widget&&widget.set_value(_action.id)},compose_triggerWidget:function(_action){var widget=this.et2.getWidgetById(_action.id);if(widget)switch(widget.id){case"uploadForCompose":document.getElementById("mail-compose_uploadForCompose").click();break;default:widget.click()}},compose_saveDraft2fm:function(_action){var content=this.et2.getArrayMgr("content").data,subject=this.et2.getWidgetById("subject"),elem={0:{id:"",subject:""}};"undefined"!=typeof content&&content.lastDrafted&&subject?(elem[0].id=content.lastDrafted,elem[0].subject=subject.get_value(),this.mail_save2fm(_action,elem)):et2_dialog.alert("You need to save the message as draft first before to be able to save it into VFS","Save into VFS","info")},folderManagement:function(_action,_senders){var acc_id=parseInt(_senders[0].id);this.egw.open_link("mail.mail_ui.folderManagement&acc_id="+acc_id,"_blank","720x500")},folderMgmt_autoloadingStart:function(_id,_widget){return this.subscription_autoloadingStart(_id,_widget)},folderMgmt_autoloadingEnd:function(_id,_widget){return!0},folderMgmt_onSelect:function(_ids,_widget){var resetSelection=!1,self=this,rangeSelector=function(_a,_b,_branch){var branchItems=_branch.split(_widget.input.dlmtr),_aIndex=_widget.input.getIndexById(_a),_bIndex=_widget.input.getIndexById(_b);if(_aIndex>_bIndex){var tmpIndex=_aIndex;_aIndex=_bIndex,_bIndex=tmpIndex}for(var i=_aIndex;_bIndex>=i;i++)self.folderMgmt_setCheckbox(_widget,branchItems[i],!_widget.input.isItemChecked(branchItems[i]))},itemIds=_ids.split(_widget.input.dlmtr);if(2==itemIds.length){var branch=_widget.input.getSubItems(_widget.input.getParentId(itemIds[0]));rangeSelector(itemIds[0],itemIds[1],branch)}else 1!=itemIds.length&&(resetSelection=!0);resetSelection&&_widget.input._unselectItems()},folderMgmt_setCheckbox:function(_widget,_itemId,_stat){_widget&&(_widget.input.setCheck(_itemId,_stat),_widget.input.setSubChecked(_itemId,_stat))},folderMgmt_onCheck:function(_id,_widget){var selected=_widget.input.getAllChecked();selected&&selected.split(_widget.input.dlmtr).length>5&&egw.message(egw.lang("If you would like to select multiple folders in one action, you can hold ctrl key then select a folder as start range and another folder within a same level as end range, all folders in between will be selected or unselected based on their current status."))},folderMgmt_deleteBtn:function(){var tree=etemplate2.getByApplication("mail")[0].widgetContainer.getWidgetById("tree"),menuaction="mail.mail_ui.ajax_folderMgmt_delete",callbackDialog=function(_btn){if(egw.appName="mail",_btn===et2_dialog.YES_BUTTON&&tree){var selFolders=tree.input.getAllChecked();if(selFolders){var selFldArr=selFolders.split(tree.input.dlmtr),msg=egw.lang("Deleting %1 folders in progress ...",selFldArr.length);return et2_dialog.long_task(function(_val,_resp){if(console.log(_val,_resp),_val&&"error"!==_resp.type){for(var stat=[],folderName="",i=0;i<selFldArr.length;i++)folderName=selFldArr[i].split("::"),stat[selFldArr[i]]=folderName[1];egw.window.app.mail.mail_removeLeaf(stat)}else etemplate2.getByApplication("mail")[0].widgetContainer._inst.submit()},msg,egw.lang("Deleting folders"),menuaction,selFldArr,"mail"),!0}}};et2_dialog.show_dialog(callbackDialog,this.egw.lang("Are you sure you want to delete all selected folders?"),this.egw.lang("Delete folder"),{},et2_dialog.BUTTON_YES_NO,et2_dialog.WARNING_MESSAGE,void 0,egw)}});
//# sourceMappingURL=app.min.js.map