sogo/UI/WebServerResources/js/Preferences.js
2015-12-18 11:46:19 -05:00

2 lines
9.4 KiB
JavaScript

!function(){"use strict";function a(a,c){a.state("preferences",{"abstract":!0,views:{preferences:{templateUrl:"preferences.html",controller:"PreferencesController",controllerAs:"app"}},resolve:{statePreferences:b}}).state("preferences.general",{url:"/general",views:{module:{templateUrl:"generalPreferences.html"}}}).state("preferences.calendars",{url:"/calendars",views:{module:{templateUrl:"calendarsPreferences.html"}}}).state("preferences.addressbooks",{url:"/addressbooks",views:{module:{templateUrl:"addressbooksPreferences.html"}}}).state("preferences.mailer",{url:"/mailer",views:{module:{templateUrl:"mailerPreferences.html"}}}),c.otherwise("/general")}function b(a){return a}function c(a){a.$on("$routeChangeError",function(a,b,c,d){console.error(a,b,c,d)})}angular.module("SOGo.PreferencesUI",["ngSanitize","ui.router","ck","SOGo.Common","SOGo.MailerUI","SOGo.ContactsUI","SOGo.Authentication"]).config(a).run(c),a.$inject=["$stateProvider","$urlRouterProvider"],b.$inject=["Preferences"],c.$inject=["$rootScope"]}(),function(){"use strict";function a(a,b,c,d,e){function f(){return d>0?!1:!e}function g(){a.cancel()}function h(){a.hide()}var i=this;i.defaults=b,i.account=c,i.accountId=d,i.customFromIsReadonly=f,i.cancel=g,i.save=h}a.$inject=["$mdDialog","defaults","account","accountId","mailCustomFromEnabled"],angular.module("SOGo.PreferencesUI").controller("AccountDialogController",a)}(),function(){"use strict";function a(a,b,c,d,e,f){function g(){c.cancel()}function h(a){c.hide()}function i(a){n.filter.rules||(n.filter.rules=[]),n.filter.rules.push({field:"subject",operator:"contains"})}function j(a){n.filter.rules.splice(a,1)}function k(a){n.filter.actions||(n.filter.actions=[]),n.filter.actions.push({method:"discard"})}function m(a){n.filter.actions.splice(a,1)}var n=this,o=b.sieveCapabilities;n.filter=d,n.mailboxes=e,n.labels=f,n.cancel=g,n.save=h,n.addMailFilterRule=i,n.removeMailFilterRule=j,n.addMailFilterAction=k,n.removeMailFilterAction=m,n.fieldLabels={subject:l("Subject"),from:l("From"),to:l("To"),cc:l("Cc"),to_or_cc:l("To or Cc"),size:l("Size (Kb)"),header:l("Header")},o.indexOf("body")>-1&&(n.fieldLabels.body=l("Body")),n.methodLabels={discard:l("Discard the message"),keep:l("Keep the message"),redirect:l("Forward the message to"),vacation:l("Send a vacation message"),stop:l("Stop processing filter rules")},o.indexOf("reject")>-1&&(n.methodLabels.reject=l("Send a reject message")),o.indexOf("fileinto")>-1&&(n.methodLabels.fileinto=l("File the message in")),(o.indexOf("imapflags")>-1||o.indexOf("imap4flags")>-1)&&(n.methodLabels.addflag=l("Flag the message with")),n.numberOperatorLabels={under:l("is under"),over:l("is over")},n.textOperatorLabels={is:l("is"),is_not:l("is not"),contains:l("contains"),contains_not:l("does not contain"),matches:l("matches"),matches_not:l("does not match")},o.indexOf("regex")>-1&&(n.textOperatorLabels.regex=l("matches regex"),n.textOperatorLabels.regex_not=l("does not match regex")),n.flagLabels={seen:l("Seen"),deleted:l("Deleted"),answered:l("Answered"),flagged:l("Flagged"),junk:l("Junk"),not_junk:l("Not Junk")}}a.$inject=["$scope","$window","$mdDialog","filter","mailboxes","labels"],angular.module("SOGo.PreferencesUI").controller("FiltersDialogController",a)}(),function(){"use strict";function a(a,b,c,d,e,f,g,h,i,j,k,m,n){function o(a){d("xs")&&e("left").close(),c.go("preferences."+a)}function p(){i.confirm(l("Warning"),l("Save preferences and reload page now?"),{ok:l("Yes"),cancel:l("No")}).then(function(){D().then(function(){b.location.reload(!0)})})}function q(){I.preferences.defaults.SOGoCalendarCategoriesColors["New category"]="#aaa",I.preferences.defaults.SOGoCalendarCategories.push("New category"),h("calendarCategory_"+(I.preferences.defaults.SOGoCalendarCategories.length-1))}function r(a){var b=I.preferences.defaults.SOGoCalendarCategories[a];I.preferences.defaults.SOGoCalendarCategories.splice(a,1),delete I.preferences.defaults.SOGoCalendarCategoriesColors[b]}function s(){I.preferences.defaults.SOGoContactsCategories.push(""),h("contactCategory_"+(I.preferences.defaults.SOGoContactsCategories.length-1))}function t(a){I.preferences.defaults.SOGoContactsCategories.splice(a,1)}function u(a){var b;I.preferences.defaults.AuxiliaryMailAccounts.push({}),b=_.last(I.preferences.defaults.AuxiliaryMailAccounts),b.name=l("New account"),b.identities=[{fullName:"",email:""}],b.receipts={receiptAction:"ignore",receiptNonRecipientAction:"ignore",receiptOutsideDomainAction:"ignore",receiptAnyAction:"ignore"},f.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account=new",targetEvent:a,locals:{defaults:I.preferences.defaults,account:b,accountId:I.preferences.defaults.AuxiliaryMailAccounts.length-1,mailCustomFromEnabled:window.mailCustomFromEnabled}})}function v(a,b){var c=I.preferences.defaults.AuxiliaryMailAccounts[b];f.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account="+b,targetEvent:a,locals:{defaults:I.preferences.defaults,account:c,accountId:b,mailCustomFromEnabled:window.mailCustomFromEnabled}}).then(function(){I.preferences.defaults.AuxiliaryMailAccounts[b]=c})}function w(a){I.preferences.defaults.AuxiliaryMailAccounts.splice(a,1)}function x(){var a="_$$"+guid();I.preferences.defaults.SOGoMailLabelsColors[a]=["New label","#aaa"]}function y(a){delete I.preferences.defaults.SOGoMailLabelsColors[a]}function z(a){var b={match:"all"};f.show({templateUrl:"editFilter?filter=new",controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:a,locals:{filter:b,mailboxes:J,labels:I.preferences.defaults.SOGoMailLabelsColors}}).then(function(){I.preferences.defaults.SOGoSieveFilters||(I.preferences.defaults.SOGoSieveFilters=[]),I.preferences.defaults.SOGoSieveFilters.push(b)})}function A(a,b){var c=angular.copy(I.preferences.defaults.SOGoSieveFilters[b]);f.show({templateUrl:"editFilter?filter="+b,controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:null,locals:{filter:c,mailboxes:J,labels:I.preferences.defaults.SOGoMailLabelsColors}}).then(function(){I.preferences.defaults.SOGoSieveFilters[b]=c})}function B(a){I.preferences.defaults.SOGoSieveFilters.splice(a,1)}function C(){var a=[];angular.isDefined(I.preferences.defaults.Vacation.autoReplyEmailAddresses)&&(a=I.preferences.defaults.Vacation.autoReplyEmailAddresses.split(",")),I.preferences.defaults.Vacation.autoReplyEmailAddresses=_.union(window.defaultEmailAddresses.split(","),a).join(",")}function D(){var b,c,d,e,f,h;if(c=!0,f=[],window.forwardConstraints>0&&angular.isDefined(I.preferences.defaults.Forward)&&I.preferences.defaults.Forward.enabled&&angular.isDefined(I.preferences.defaults.Forward.forwardAddress))for(d=I.preferences.defaults.Forward.forwardAddress.split(","),e=window.defaultEmailAddresses.split(/, */),_.forEach(e,function(a){var b=a.split("@")[1];b&&f.push(b.toLowerCase())}),b=0;b<d.length&&c;b++)h=d[b].split("@")[1].toLowerCase(),f.indexOf(h)<0&&1==window.forwardConstraints?(i.alert(l("Error"),l("You are not allowed to forward your messages to an external email address.")),c=!1):f.indexOf(h)>=0&&2==window.forwardConstraints&&(i.alert(l("Error"),l("You are not allowed to forward your messages to an internal email address.")),c=!1);return c?I.preferences.$save().then(function(a){g.show({controller:"savePreferencesToastCtrl",template:["<md-toast>",' <div class="md-toast-content">'," <span flex>"+l("Preferences saved")+"</span>",' <md-button class="md-icon-button md-primary" ng-click="closeToast()">'," <md-icon>close</md-icon>"," </md-button>"," </div>","</md-toast>"].join(""),hideDelay:2e3,position:"top right"})}):a.reject()}function E(){return I.passwords.newPassword&&I.passwords.newPassword.length>0&&I.passwords.newPasswordConfirmation&&I.passwords.newPasswordConfirmation.length&&I.passwords.newPassword==I.passwords.newPasswordConfirmation?!0:!1}function F(){n.changePassword(I.passwords.newPassword).then(function(){var a=f.alert({title:l("Password"),content:l("The password was changed successfully."),ok:l("OK")});f.show(a)["finally"](function(){a=void 0})},function(a){var b=f.alert({title:l("Password"),content:a,ok:l("OK")});f.show(b)["finally"](function(){b=void 0})})}function G(a){return _.filter(I.timeZonesList,function(b){return b.toUpperCase().indexOf(a.toUpperCase())>=0})}var H,I=this,J=[];I.preferences=m,I.passwords={newPassword:null,newPasswordConfirmation:null},I.go=o,I.onLanguageChange=p,I.addCalendarCategory=q,I.removeCalendarCategory=r,I.addContactCategory=s,I.removeContactCategory=t,I.addMailAccount=u,I.editMailAccount=v,I.removeMailAccount=w,I.addMailLabel=x,I.removeMailLabel=y,I.addMailFilter=z,I.editMailFilter=A,I.removeMailFilter=B,I.addDefaultEmailAddresses=C,I.userFilter=j.$filter,I.save=D,I.canChangePassword=E,I.changePassword=F,I.timeZonesList=window.timeZonesList,I.timeZonesListFilter=G,I.timeZonesSearchText="",H=new k({id:0}),H.$getMailboxes().then(function(){for(var a=H.$flattenMailboxes({all:!0}),b=-1,c=a.length;++b<c;)J.push(a[b])}),m.ready().then(function(){m.defaults.SOGoAlternateAvatar&&(j.$alternateAvatar=m.defaults.SOGoAlternateAvatar)})}function b(a,b){a.closeToast=function(){b.hide()}}a.$inject=["$q","$window","$state","$mdMedia","$mdSidenav","$mdDialog","$mdToast","sgFocus","Dialog","User","Account","statePreferences","Authentication"],b.$inject=["$scope","$mdToast"],angular.module("SOGo.PreferencesUI").controller("savePreferencesToastCtrl",b).controller("PreferencesController",a)}();
//# sourceMappingURL=Preferences.js.map