mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
6 lines
84 KiB
JavaScript
6 lines
84 KiB
JavaScript
|
/*! build Tue Mar 01 2016 10:42:55 */
|
||
|
|
||
|
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",t
|
||
|
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
|
||
|
-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(
|
||
|
//# sourceMappingURL=app.min.js.map
|