2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
|
!function(){"use strict";function configure($stateProvider,$urlRouterProvider){$stateProvider.state("mail",{url:"/Mail",views:{mailboxes:{templateUrl:"UIxMailMainFrame",controller:"MailboxesController",controllerAs:"app"}},resolve:{stateAccounts:stateAccounts}}).state("mail.account",{url:"/:accountId","abstract":!0,views:{mailbox:{template:"<ui-view/>"}},resolve:{stateAccount:stateAccount}}).state("mail.account.mailbox",{url:"/:mailboxId",views:{"mailbox@mail":{templateUrl:"UIxMailFolderTemplate",controller:"MailboxController",controllerAs:"mailbox"}},resolve:{stateMailbox:stateMailbox,stateMessages:stateMessages}}).state("mail.account.mailbox.message",{url:"/:messageId",views:{message:{templateUrl:"UIxMailViewTemplate",controller:"MessageController",controllerAs:"viewer"}},resolve:{stateMessage:stateMessage}}),$urlRouterProvider.otherwise("/Mail")}function stateAccounts($q,Account){var accounts=Account.$findAll(mailAccounts),promises=[];return angular.forEach(accounts,function(account,i){var mailboxes=account.$getMailboxes();promises.push(mailboxes.then(function(objects){return account}))}),$q.all(promises)}function stateAccount($stateParams,stateAccounts){return _.find(stateAccounts,function(account){return account.id==$stateParams.accountId})}function stateMailbox($stateParams,stateAccount,decodeUriFilter){var _find,mailboxId=decodeUriFilter($stateParams.mailboxId);return(_find=function(mailboxes){var mailbox=_.find(mailboxes,function(o){return o.path==mailboxId});return mailbox||angular.forEach(mailboxes,function(o){!mailbox&&o.children&&o.children.length>0&&(mailbox=_find(o.children))}),mailbox})(stateAccount.$mailboxes)}function stateMessages(stateMailbox){return stateMailbox.$filter()}function stateMessage(encodeUriFilter,$stateParams,$state,stateMailbox,stateMessages){var message=_.find(stateMailbox.$messages,function(messageObject){return messageObject.uid==$stateParams.messageId});return message?(stateMailbox.selectedMessage=$stateParams.messageId,message.$reload()):void $state.go("mail.account.mailbox",{accountId:stateMailbox.$account.id,mailboxId:encodeUriFilter(stateMailbox.path)})}function runBlock($rootScope){$rootScope.$on("$routeChangeError",function(event,current,previous,rejection){console.error(event,current,previous,rejection)})}angular.module("SOGo.MailerUI",["ngSanitize","ui.router","ck","angularFileUpload","SOGo.Common","SOGo.ContactsUI","ngAnimate","SOGo.PreferencesUI"]).config(configure).run(runBlock),configure.$inject=["$stateProvider","$urlRouterProvider"],stateAccounts.$inject=["$q","Account"],stateAccount.$inject=["$stateParams","stateAccounts"],stateMailbox.$inject=["$stateParams","stateAccount","decodeUriFilter"],stateMessages.$inject=["stateMailbox"],stateMessage.$inject=["encodeUriFilter","$stateParams","$state","stateMailbox","stateMessages"],runBlock.$inject=["$rootScope"]}(),function(){"use strict";function MailboxController($state,$timeout,$mdDialog,stateAccounts,stateAccount,stateMailbox,encodeUriFilter,focus,Dialog,Account,Mailbox){function selectMessage(message){$state.go("mail.account.mailbox.message",{accountId:stateAccount.id,mailboxId:encodeUriFilter(stateMailbox.path),messageId:message.uid})}function unselectMessages(){_.each(vm.selectedFolder.$messages,function(message){message.selected=!1})}function confirmDeleteSelectedMessages(){Dialog.confirm(l("Warning"),l("Are you sure you want to delete the selected messages?")).then(function(){var selectedMessages=_.filter(vm.selectedFolder.$messages,function(message){return message.selected}),selectedUIDs=_.pluck(selectedMessages,"uid");vm.selectedFolder.$deleteMessages(selectedUIDs).then(function(){vm.selectedFolder.$messages=_.difference(vm.selectedFolder.$messages,selectedMessages)},function(error){Dialog.alert(l("Error"),error)})})}function copySelectedMessages(folder){var selectedMessages=_.filter(vm.selectedFolder.$messages,function(message){return message.selected}),selectedUIDs=_.pluck(selectedMessages,"uid");vm.selectedFolder.$copyMessages(selectedUIDs,"/"+folder).then(function(){},function(error){Dialog.alert(l("Error"),e
|
||
|
//# sourceMappingURL=Mailer.js.map
|