sogo/UI/WebServerResources/js/Mailer.js
2017-05-13 01:24:30 -04:00

2 lines
3.6 KiB
JavaScript

!function(){"use strict";function e(e,d){e.state("mail",{url:"/Mail",views:{mailboxes:{templateUrl:"UIxMailMainFrame",controller:"MailboxesController",controllerAs:"app"}},resolve:{stateAccounts:t}}).state("mail.account",{url:"/:accountId",abstract:!0,views:{mailbox:{template:"<ui-view/>"}},resolve:{stateAccount:a}}).state("mail.account.virtualMailbox",{url:"/virtual",views:{"mailbox@mail":{templateUrl:"UIxMailFolderTemplate",controller:"MailboxController",controllerAs:"mailbox"}},resolve:{stateMailbox:r}}).state("mail.account.virtualMailbox.message",{url:"/:mailboxId/:messageId",views:{message:{templateUrl:"UIxMailViewTemplate",controller:"MessageController",controllerAs:"viewer"}},resolve:{stateMailbox:n,stateMessages:i,stateMessage:s},onEnter:c,onExit:u}).state("mail.account.inbox",{url:"/inbox",onEnter:l}).state("mail.account.mailbox",{url:"/:mailboxId",views:{"mailbox@mail":{templateUrl:"UIxMailFolderTemplate",controller:"MailboxController",controllerAs:"mailbox"}},resolve:{stateMailbox:o,stateMessages:i}}).state("mail.account.mailbox.message",{url:"/:messageId",views:{message:{templateUrl:"UIxMailViewTemplate",controller:"MessageController",controllerAs:"viewer"}},onEnter:c,onExit:u,resolve:{stateMessage:s}}),d.otherwise("/Mail/0/inbox")}function t(e,t,a){var o=a.$findAll(e.mailAccounts),l=[];return angular.forEach(o,function(e,t){var a=e.$getMailboxes();0===t?l.push(a.then(function(t){return e})):l.push(e)}),t.all(l)}function a(e,t){return _.find(t,function(t){return t.id==e.accountId})}function o(e,t,a,o,l,i){var r,n,s=l(a.mailboxId);return n=function(e){var t=_.find(e,function(e){return e.path==s});return t||angular.forEach(e,function(e){!t&&e.children&&e.children.length>0&&(t=n(e.children))}),t},i.selectedFolder&&!i.$virtualMode&&(i.selectedFolder.$isLoading=!0),r=n(o.$mailboxes),r?(r.$topIndex=0,r):t.go("mail.account.inbox")}function l(e,t,a,o){o.$mailboxes.length>0?e.location.hash=t.href("mail.account.mailbox",{accountId:o.id,mailboxId:a(o.$mailboxes[0].path)}):t.go("mail")}function i(e,t){return e.$virtualMode?[]:t.$filter()}function r(e,t){return t.$virtualMode?t.selectedFolder:e.reject("No virtual mailbox defined")}function n(e,t,a,o){var l=a(o.mailboxId);return t.$virtualMode?(t.selectedFolder.resetSelectedMessage(),_.find(t.selectedFolder.$mailboxes,function(e){return e.path==l})):e.reject("No virtual mailbox defined for message")}function s(e,t,a,o,l,i){var r;if(r=_.find(l.$messages,function(e){return e.uid==parseInt(a.messageId)}))return r.$reload({useCache:!0});o.go("mail.account.mailbox",{accountId:l.$account.id,mailboxId:t(l.path)})}function c(e,t){t.selectedMessage=parseInt(e.messageId)}function u(e){delete e.selectedMessage}function d(e,t,a,o){e.$on("$stateChangeError",function(e,l,i,r,n,s){t.error(s),e.preventDefault(),o.selectedFolder=!1,a.go("mail")}),e.$on("$routeChangeError",function(e,a,o,l){t.error(e,a,o,l)})}angular.module("SOGo.MailerUI",["ngCookies","ui.router","ck","angularFileUpload","SOGo.Common","SOGo.ContactsUI","SOGo.SchedulerUI","ngAnimate","SOGo.PreferencesUI"]).config(e).run(d),e.$inject=["$stateProvider","$urlRouterProvider"],t.$inject=["$window","$q","Account"],a.$inject=["$stateParams","stateAccounts"],o.$inject=["$q","$state","$stateParams","stateAccount","decodeUriFilter","Mailbox"],l.$inject=["$window","$state","encodeUriFilter","stateAccount"],i.$inject=["Mailbox","stateMailbox"],r.$inject=["$q","Mailbox"],n.$inject=["$q","Mailbox","decodeUriFilter","$stateParams"],s.$inject=["Mailbox","encodeUriFilter","$stateParams","$state","stateMailbox","stateMessages"],c.$inject=["$stateParams","stateMailbox"],u.$inject=["stateMailbox"],d.$inject=["$rootScope","$log","$state","Mailbox"]}();
//# sourceMappingURL=Mailer.js.map