1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
{"version":3,"file":"Mailer.js","sources":["Mailer/Mailer.app.js"],"names":["configure","$stateProvider","$urlRouterProvider","state","url","views","mailboxes","templateUrl","controller","controllerAs","resolve","stateAccounts","abstract","mailbox","template","stateAccount","mailbox@mail","stateMailbox","stateVirtualMailbox","message","stateVirtualMailboxOfMessage","stateMessages","stateMessage","onEnter","onEnterMessage","onExit","onExitMessage","onEnterInbox","otherwise","$q","Account","accounts","$findAll","window","mailAccounts","promises","angular","forEach","account","i","$getMailboxes","push","then","objects","all","$stateParams","_","find","id","accountId","$state","decodeUriFilter","Mailbox","_find","mailboxId","o","path","children","length","selectedFolder","$virtualMode","$isLoading","$mailboxes","$topIndex","go","$window","encodeUriFilter","location","hash","href","$filter","reject","resetSelectedMessage","mailboxObject","$messages","messageObject","uid","parseInt","messageId","$reload","useCache","$account","selectedMessage","runBlock","$rootScope","$log","$on","event","toState","toParams","fromState","fromParams","error","current","previous","rejection","module","config","run","$inject"],"mappings":"CAGA,WACE,YAUA,SAASA,GAAUC,EAAgBC,GACjCD,EACGE,MAAM,QACLC,IAAK,QACLC,OACEC,WACEC,YAAa,mBACbC,WAAY,sBACZC,aAAc,QAGlBC,SACEC,cAAeA,KAGlBR,MAAM,gBACLC,IAAK,cACLQ,YAAU,EACVP,OACEQ,SACEC,SAAU,eAGdJ,SACEK,aAAcA,KAGjBZ,MAAM,+BACLC,IAAK,WACLC,OACEW,gBACET,YAAa,wBACbC,WAAY,oBACZC,aAAc,YAGlBC,SACEO,aAAcC,KAGjBf,MAAM,uCACLC,IAAK,yBACLC,OACGc,SACCZ,YAAa,sBACbC,WAAY,oBACZC,aAAc,WAGlBC,SACEO,aAAcG,EACdC,cAAeA,EACfC,aAAcA,GAEhBC,QAASC,EACTC,OAAQC,IAETvB,MAAM,sBACLC,IAAK,SACLmB,QAASI,IAEVxB,MAAM,wBACLC,IAAK,cACLC,OACEW,gBACET,YAAa,wBACbC,WAAY,oBACZC,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ClF,EAAakF,SAAW,KAAM,SAAU,eAAgB,eAAgB,kBAAmB,WAsC3FxE,EAAawE,SAAW,UAAW,SAAU,kBAAmB,gBAUhE9E,EAAc8E,SAAW,UAAW,gBAoBpCjF,EAAoBiF,SAAW,KAAM,WAYrC/E,EAA6B+E,SAAW,KAAM,UAAW,kBAAmB,gBAiB5E7E,EAAa6E,SAAW,UAAW,kBAAmB,eAAgB,SAAU,eAAgB,iBAoBhG3E,EAAe2E,SAAW,eAAgB,gBAQ1CzE,EAAcyE,SAAW,gBAgBzBhB,EAASgB,SAAW,aAAc,OAAQ","sourcesContent":["/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n/* JavaScript for SOGo.MailerUI module */\n\n(function() {\n 'use strict';\n\n angular.module('SOGo.MailerUI', ['ngCookies', 'ui.router', 'ck', 'angularFileUpload', 'SOGo.Common', 'SOGo.ContactsUI', 'SOGo.SchedulerUI', 'ngAnimate', 'SOGo.PreferencesUI'])\n .config(configure)\n .run(runBlock);\n\n /**\n * @ngInject\n */\n configure.$inject = ['$stateProvider', '$urlRouterProvider'];\n function configure($stateProvider, $urlRouterProvider) {\n $stateProvider\n .state('mail', {\n url: '/Mail',\n views: {\n mailboxes: {\n templateUrl: 'UIxMailMainFrame', // UI/Templates/MailerUI/UIxMailMainFrame.wox\n controller: 'MailboxesController',\n controllerAs: 'app'\n }\n },\n resolve: {\n stateAccounts: stateAccounts\n }\n })\n .state('mail.account', {\n url: '/:accountId',\n abstract: true,\n views: {\n mailbox: {\n template: '<ui-view/>'\n }\n },\n resolve: {\n stateAccount: stateAccount\n }\n })\n .state('mail.account.virtualMailbox', {\n url: '/virtual',\n views: {\n 'mailbox@mail': {\n templateUrl: 'UIxMailFolderTemplate', // UI/Templates/MailerUI/UIxMailFolderTemplate.wox\n controller: 'MailboxController',\n controllerAs: 'mailbox'\n }\n },\n resolve: {\n stateMailbox: stateVirtualMailbox\n }\n })\n .state('mail.account.virtualMailbox.message', {\n url: '/:mailboxId/:messageId',\n views: {\n message: {\n templateUrl: 'UIxMailViewTemplate', // UI/Templates/MailerUI/UIxMailViewTemplate.wox\n controller: 'MessageController',\n controllerAs: 'viewer'\n }\n },\n resolve: {\n stateMailbox: stateVirtualMailboxOfMessage,\n stateMessages: stateMessages,\n stateMessage: stateMessage\n },\n onEnter: onEnterMessage,\n onExit: onExitMessage\n })\n .state('mail.account.inbox', {\n url: '/inbox',\n onEnter: onEnterInbox\n })\n .state('mail.account.mailbox', {\n url: '/:mailboxId',\n views: {\n 'mailbox@mail': {\n templateUrl: 'UIxMailFolderTemplate', // UI/Templates/MailerUI/UIxMailFolderTemplate.wox\n controller: 'MailboxController',\n controllerAs: 'mailbox'\n }\n },\n resolve: {\n stateMailbox: stateMailbox,\n stateMessages: stateMessages\n }\n })\n // .state('mail.account.mailbox.newMessage', {\n // url: '/new',\n // views: {\n // 'mailbox@mail': {\n // templateUrl: 'UIxMailEditor', // UI/Templates/MailerUI/UIxMailEditor.wox\n // controller: 'MessageEditorController',\n // controllerAs: 'editor'\n // }\n // },\n // resolve: {\n // stateMessage: stateNewMessage\n // }\n // })\n .state('mail.account.mailbox.message', {\n url: '/:messageId',\n views: {\n message: {\n templateUrl: 'UIxMailViewTemplate', // UI/Templates/MailerUI/UIxMailViewTemplate.wox\n controller: 'MessageController',\n controllerAs: 'viewer'\n }\n },\n onEnter: onEnterMessage,\n onExit: onExitMessage,\n resolve: {\n stateMessage: stateMessage\n }\n });\n // .state('mail.account.mailbox.message.edit', {\n // url: '/edit',\n // views: {\n // 'mailbox@mail': {\n // templateUrl: 'UIxMailEditor', // UI/Templates/MailerUI/UIxMailEditor.wox\n // controller: 'MessageEditorController',\n // controllerAs: 'editor'\n // }\n // },\n // resolve: {\n // stateContent: stateContent\n // }\n // })\n // .state('mail.account.mailbox.message.action', {\n // url: '/{actionName:(?:reply|replyall|forward)}',\n // views: {\n // 'mailbox@mail': {\n // templateUrl: 'UIxMailEditor', // UI/Templates/MailerUI/UIxMailEditor.wox\n // controller: 'MessageEditorController',\n // controllerAs: 'editor'\n // }\n // }\n // });\n\n // if none of the above states are matched, use this as the fallback\n $urlRouterProvider.otherwise('/Mail/0/inbox');\n }\n\n /**\n * @ngInject\n */\n stateAccounts.$inject = ['$q', 'Account'];\n function stateAccounts($q, Account) {\n var accounts = Account.$findAll(window.mailAccounts),\n promises = [];\n // Fetch list of mailboxes for each account\n angular.forEach(accounts, function(account, i) {\n var mailboxes = account.$getMailboxes();\n promises.push(mailboxes.then(function(objects) {\n return account;\n }));\n });\n return $q.all(promises);\n }\n\n /**\n * @ngInject\n */\n stateAccount.$inject = ['$stateParams', 'stateAccounts'];\n function stateAccount($stateParams, stateAccounts) {\n return _.find(stateAccounts, function(account) {\n return account.id == $stateParams.accountId;\n });\n }\n\n /**\n * @ngInject\n */\n stateMailbox.$inject = ['$q', '$state', '$stateParams', 'stateAccount', 'decodeUriFilter', 'Mailbox'];\n function stateMailbox($q, $state, $stateParams, stateAccount, decodeUriFilter, Mailbox) {\n var mailbox,\n mailboxId = decodeUriFilter($stateParams.mailboxId),\n _find;\n\n // Recursive find function\n _find = function(mailboxes) {\n var mailbox = _.find(mailboxes, function(o) {\n return o.path == mailboxId;\n });\n if (!mailbox) {\n angular.forEach(mailboxes, function(o) {\n if (!mailbox && o.children && o.children.length > 0) {\n mailbox = _find(o.children);\n }\n });\n }\n return mailbox;\n };\n\n if (Mailbox.selectedFolder && !Mailbox.$virtualMode)\n Mailbox.selectedFolder.$isLoading = true;\n\n mailbox = _find(stateAccount.$mailboxes);\n\n if (mailbox) {\n mailbox.$topIndex = 0;\n return mailbox;\n }\n else\n // Mailbox not found\n return $state.go('mail.account.inbox');\n }\n\n /**\n * @ngInject\n */\n onEnterInbox.$inject = ['$window', '$state', 'encodeUriFilter', 'stateAccount'];\n function onEnterInbox($window, $state, encodeUriFilter, stateAccount) {\n $window.location.hash = $state.href('mail.account.mailbox',\n {accountId: stateAccount.id,\n mailboxId: encodeUriFilter(stateAccount.$mailboxes[0].path)});\n }\n\n /**\n * @ngInject\n */\n stateMessages.$inject = ['Mailbox', 'stateMailbox'];\n function stateMessages(Mailbox, stateMailbox) {\n if (Mailbox.$virtualMode)\n return [];\n\n return stateMailbox.$filter();\n }\n\n /**\n * @ngInject\n */\n // stateNewMessage.$inject = ['stateAccount'];\n // function stateNewMessage(stateAccount) {\n // return stateAccount.$newMessage();\n // }\n\n /**\n * Return a VirtualMailbox instance\n * @ngInject\n */\n stateVirtualMailbox.$inject = ['$q', 'Mailbox'];\n function stateVirtualMailbox($q, Mailbox) {\n if (Mailbox.$virtualMode)\n return Mailbox.selectedFolder;\n else\n return $q.reject(\"No virtual mailbox defined\");\n }\n\n /**\n * Return a Mailbox instance from a VirtualMailbox instance\n * @ngInject\n */\n stateVirtualMailboxOfMessage.$inject = ['$q', 'Mailbox', 'decodeUriFilter', '$stateParams'];\n function stateVirtualMailboxOfMessage($q, Mailbox, decodeUriFilter, $stateParams) {\n var mailboxId = decodeUriFilter($stateParams.mailboxId);\n\n if (Mailbox.$virtualMode) {\n Mailbox.selectedFolder.resetSelectedMessage();\n return _.find(Mailbox.selectedFolder.$mailboxes, function(mailboxObject) {\n return mailboxObject.path == mailboxId;\n });\n }\n else\n return $q.reject(\"No virtual mailbox defined for message\");\n }\n\n /**\n * @ngInject\n */\n stateMessage.$inject = ['Mailbox', 'encodeUriFilter', '$stateParams', '$state', 'stateMailbox', 'stateMessages'];\n function stateMessage(Mailbox, encodeUriFilter, $stateParams, $state, stateMailbox, stateMessages) {\n var message;\n\n message = _.find(stateMailbox.$messages, function(messageObject) {\n return messageObject.uid == parseInt($stateParams.messageId);\n });\n\n if (message) {\n return message.$reload({useCache: true});\n }\n else {\n // Message not found\n $state.go('mail.account.mailbox', { accountId: stateMailbox.$account.id, mailboxId: encodeUriFilter(stateMailbox.path) });\n }\n }\n\n /**\n * @ngInject\n */\n onEnterMessage.$inject = ['$stateParams', 'stateMailbox'];\n function onEnterMessage($stateParams, stateMailbox) {\n stateMailbox.selectedMessage = parseInt($stateParams.messageId);\n }\n\n /**\n * @ngInject\n */\n onExitMessage.$inject = ['stateMailbox'];\n function onExitMessage(stateMailbox) {\n delete stateMailbox.selectedMessage;\n }\n\n /**\n * @ngInject\n */\n // stateContent.$inject = ['stateMessage'];\n // function stateContent(stateMessage) {\n // return stateMessage.$editableContent();\n // }\n\n /**\n * @ngInject\n */\n runBlock.$inject = ['$rootScope', '$log', '$state'];\n function runBlock($rootScope, $log, $state) {\n $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {\n $log.error(error);\n //event.preventDefault();\n //if (toState.name != 'mail.account.inbox')\n // $state.go('mail.account.inbox');\n //else\n // $state.go('mail');\n });\n $rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {\n $log.error(event, current, previous, rejection);\n });\n }\n\n})();\n"]} |