2016-03-16 06:33:49 +01:00
|
|
|
!function(){"use strict";function a(b){"function"!=typeof b.then&&(angular.extend(this,b),_.forEach(this.identities,function(a){a.fullName?a.full=a.fullName+" <"+a.email+">":a.full="<"+a.email+">"}),a.$log.debug("Account: "+JSON.stringify(b,void 0,2)))}a.$factory=["$q","$timeout","$log","sgSettings","Resource","Preferences","Mailbox","Message",function(b,c,d,e,f,g,h,i){return angular.extend(a,{$q:b,$timeout:c,$log:d,$$resource:new f(e.activeUser("folderURL")+"Mail",e.activeUser()),$Preferences:g,$Mailbox:h,$Message:i}),a}];try{angular.module("SOGo.MailerUI")}catch(b){angular.module("SOGo.MailerUI",["SOGo.Common"])}angular.module("SOGo.MailerUI").factory("Account",a.$factory),a.$findAll=function(b){return b?a.$unwrapCollection(b):a.$$resource.fetch("","mailAccounts").then(function(b){return a.$unwrapCollection(b)})},a.$unwrapCollection=function(b){var c=[];return angular.forEach(b,function(b,d){b.id=d,c[d]=new a(b)}),c},a.prototype.$getMailboxes=function(b){var c=this;return!this.$mailboxes||b&&b.reload?a.$Mailbox.$find(this).then(function(b){return c.$mailboxes=b,a.$Preferences.ready().then(function(){var b,d=function(a){_.forEach(a,function(a){a.$expanded=b.indexOf("/"+a.id)>=0,a.children&&a.children.length>0&&d(a.children)})};a.$Preferences.settings.Mail.ExpandedFolders&&(b=angular.isString(a.$Preferences.settings.Mail.ExpandedFolders)?angular.fromJson(a.$Preferences.settings.Mail.ExpandedFolders):a.$Preferences.settings.Mail.ExpandedFolders,b.length>0&&d(c.$mailboxes)),c.$flattenMailboxes({reload:!0})}),c.$mailboxes}):a.$q.when(this.$mailboxes)},a.prototype.$flattenMailboxes=function(b){var c=this,d=[],e=[],f=function(a){_.forEach(a,function(a){d.push(a),(b&&b.all||a.$expanded)&&a.children&&a.children.length>0&&f(a.children)})};return!this.$$flattenMailboxes||b&&(b.reload||b.all)?(f(this.$mailboxes),b&&b.all||(c.$$flattenMailboxes=d,b&&b.saveState&&(_.reduce(d,function(a,b){return b.$expanded&&a.push("/"+b.id),a},e),a.$$resource.post(null,"saveFoldersState",e)))):d=this.$$flattenMailboxes,d},a.prototype.$getMailboxByType=function(a){var b,c=function(b){var d=_.find(b,function(b){return b.type==a});return d||angular.forEach(b,function(a){!d&&a.children&&a.children.length>0&&(d=c(a.children))}),d};return b=c(this.$mailboxes)},a.prototype.$getMailboxByPath=function(a){var b=null,c=function(b){var d=_.find(b,function(b){return b.path==a});return d||angular.forEach(b,function(a){!d&&a.children&&a.children.length>0&&(d=c(a.children))}),d};return b=c(this.$mailboxes)},a.prototype.$newMailbox=function(b,c){var d=this;return a.$$resource.post(b.toString(),"createFolder",{name:c}).then(function(){d.$getMailboxes({reload:!0})})},a.prototype.updateQuota=function(a){var b,c,d;b=Math.round(1e4*a.usedSpace/a.maxQuota)/100,c=l("quotasFormat"),d=c.formatted(b,Math.round(a.maxQuota/10.24)/100),this.$quota={percent:b,description:d}},a.prototype.$newMessage=function(){var b=this;return a.$$resource.fetch(this.id.toString(),"compose").then(function(c){a.$log.debug("New message (compose): "+JSON.stringify(c,void 0,2));var d=new a.$Message(c.accountId,b.$getMailboxByPath(c.mailboxPath),c);return d}).then(function(b){return a.$$resource.fetch(b.$absolutePath({asDraft:!0}),"edit").then(function(c){return a.$log.debug("New message (edit): "+JSON.stringify(c,void 0,2)),angular.extend(b.editable,c),b.isNew=!0,b})})},a.prototype.$addDelegate=function(b){var c=this,d=a.$q.defer(),e={uid:b.uid};return!b.uid||_.indexOf(_.map(this.delegates,"uid"),b.uid)>-1?d.resolve():a.$$resource.fetch(this.id.toString(),"addDelegate",e).then(function(){c.delegates.push(b),d.resolve(c.users)},function(a,b){d.reject(l("An error occured please try again."))}),d.promise},a.prototype.$removeDelegate=function(b){var c=this,d={uid:b};return a.$$resource.fetch(this.id.toString(),"removeDelegate",d).then(function(){var a=_.indexOf(_.map(c.delegates,"uid"),b);a>=0&&c.delegates.splice(a,1)})}}(),function(){"use strict";function a(b,c){if(this.$account=b,"function"!=typeof c.then){if(this.init(c),this.name&&!this.path){var d=a.$$resource.create("createFolder",this.name);this
|
|
|
|
var a=p.defaults.SOGoRefreshViewCheck;a&&"manually"!=a&&b(N.refreshUnseenCount,1e3*a.timeInterval())})}var L,M,N=this;N.service=m,N.accounts=q,N.newFolder=w,N.delegate=x,N.editFolder=y,N.revertEditing=z,N.selectFolder=A,N.saveFolder=B,N.compactFolder=C,N.emptyTrashFolder=D,N.exportMails=E,N.confirmDelete=F,N.markFolderRead=G,N.share=H,N.metadataForFolder=I,N.setFolderAs=J,N.refreshUnseenCount=K,N.showingAdvancedSearch=!1,N.currentSearchParam="",N.addSearchParam=u,N.newSearchParam=v,N.showAdvancedSearch=r,N.hideAdvancedSearch=s,N.toggleAdvancedSearch=t,N.search={options:{"":l("Select a criteria"),subject:l("Enter Subject"),from:l("Enter From"),to:l("Enter To"),cc:l("Enter Cc"),body:l("Enter Body")},mailbox:"INBOX",subfolders:1,match:"AND",params:[]},N.refreshUnseenCount()}a.$inject=["$state","$timeout","$mdDialog","$mdToast","$mdMedia","$mdSidenav","sgFocus","encodeUriFilter","Dialog","sgSettings","Account","Mailbox","VirtualMailbox","User","Preferences","stateAccounts"],angular.module("SOGo.MailerUI").controller("MailboxesController",a)}(),function(){"use strict";function a(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){function r(){var b,c,d={};return a.opener&&a.opener.$mailboxController&&a.opener.$mailboxController.selectedFolder.$id()==g.$id()&&(c=a.opener.$mailboxController,d.mailboxCtrl=c,a.opener.$messageController&&a.opener.$messageController.message.uid==h.uid&&(b=a.opener.$messageController,d.messageCtrl=b)),d}function s(a){J.$showDetailedRecipients=!J.$showDetailedRecipients,a.stopPropagation(),a.preventDefault()}function t(){var a,b,d,e,f,i=r();i.messageCtrl?(a=i.mailboxCtrl.selectedFolder,b=i.messageCtrl.message,d=i.messageCtrl.$state):(a=g,b=h,d=c),a.$deleteMessages([b]).then(function(c){var g=c;if(b=null,angular.isDefined(d)){c>0&&(g-=1,e=a.$messages[g]),c<a.$messages.length&&(f=a.$messages[c]),e?e.isread&&f&&!f.isread&&(g=c,e=f):f&&(g=c,e=f);try{e?(d.go("mail.account.mailbox.message",{messageId:e.uid}),g<a.$topIndex?a.$topIndex=g:g>a.$lastVisibleIndex&&(a.$topIndex=g-(a.$lastVisibleIndex-a.$topIndex))):d.go("mail.account.mailbox")}catch(h){}}B()})}function u(a,b,c){null===K&&(angular.isDefined(c)||(c=[]),K=d.show({parent:angular.element(document.body),targetEvent:a,clickOutsideToClose:!1,escapeToClose:!1,templateUrl:"UIxMailEditor",controller:"MessageEditorController",controllerAs:"editor",locals:{stateAccounts:J.accounts,stateAccount:J.account,stateMessage:b,stateRecipients:c}})["finally"](function(){K=null,B()}))}function v(){c.go("mail.account.mailbox").then(function(){J.message=null,delete g.selectedMessage})}function w(a){var b=J.message.$reply();u(a,b)}function x(a){var b=J.message.$replyAll();u(a,b)}function y(a){var b=J.message.$forward();u(a,b)}function z(a){J.message.$editableContent().then(function(){u(a,J.message)})}function A(){var b=[j.baseURL(),"UIxMailPopupView#/Mail",J.message.accountId,i(i(J.message.$mailbox.path)),J.message.uid].join("/"),c=J.message.$absolutePath();L=a.open(b,c,["width=680","height=520","resizable=1","scrollbars=1","toolbar=0","location=0","directories=0","status=0","menubar=0","copyhistory=0"].join(","))}function B(){a.opener&&a.close()}function C(a,b){var c=J.account.$newMessage();u(a,c,[b]),a.stopPropagation(),a.preventDefault()}function D(){window.location.href=ApplicationBaseURL+"/"+J.mailbox.id+"/saveMessages?uid="+J.message.uid}function E(a){J.showRawSource||J.rawSource?J.showRawSource=!J.showRawSource:q.$$resource.post(J.message.id,"viewsource").then(function(a){J.rawSource=a,J.showRawSource=!0})}function F(b){a.print()}function G(a){return I(a,"appointment")}function H(a){return I(a,"task")}function I(a,b){J.message.$plainContent().then(function(c){var e={pid:m.$defaultCalendar(),type:b,summary:c.subject,comment:c.content},f=new n(e),g=[j.activeUser("folderURL"),"Calendar","UIx"+b.capitalize()+"EditorTemplate"].join("/");return d.show({parent:angular.element(document.body),targetEvent:a,clickOutsideToClose:!0,escapeToClose:!0,templateUrl:g,controller:"ComponentEditorController",controllerAs:"editor",locals:{stateComponent:f}})})}var J=this,K=null,L=null;a.$messageControl
|