sogo/UI/WebServerResources/js/Preferences.js

2 lines
9.8 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",["ui.router","ck","SOGo.Common","SOGo.MailerUI","SOGo.ContactsUI","SOGo.Authentication","ng-sortable"]).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(){return o.filter.rules&&o.filter.rules.length>0&&o.filter.actions&&o.filter.actions.length>0}function i(a){c.hide()}function j(a){o.filter.rules||(o.filter.rules=[]),o.filter.rules.push({field:"subject",operator:"contains"})}function k(a){o.filter.rules.splice(a,1)}function m(a){o.filter.actions||(o.filter.actions=[]),o.filter.actions.push({method:"discard"})}function n(a){o.filter.actions.splice(a,1)}var o=this,p=b.sieveCapabilities,q=b.forwardEnabled,r=b.vacationEnabled;o.filter=d,o.mailboxes=e,o.labels=f,o.cancel=g,o.hasRulesAndActions=h,o.save=i,o.addMailFilterRule=j,o.removeMailFilterRule=k,o.addMailFilterAction=m,o.removeMailFilterAction=n,o.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")},p.indexOf("body")>-1&&(o.fieldLabels.body=l("Body")),o.methodLabels={discard:l("Discard the message"),keep:l("Keep the message"),stop:l("Stop processing filter rules")},q&&(o.methodLabels.redirect=l("Forward the message to")),r&&(o.methodLabels.vacation=l("Send a vacation message")),p.indexOf("reject")>-1&&(o.methodLabels.reject=l("Send a reject message")),p.indexOf("fileinto")>-1&&(o.methodLabels.fileinto=l("File the message in")),(p.indexOf("imapflags")>-1||p.indexOf("imap4flags")>-1)&&(o.methodLabels.addflag=l("Flag the message with")),o.numberOperatorLabels={under:l("is under"),over:l("is over")},o.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")},p.indexOf("regex")>-1&&(o.textOperatorLabels.regex=l("matches regex"),o.textOperatorLabels.regex_not=l("does not match regex")),o.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,b){b.$valid&&(d("xs")&&e("left").close(),c.go("preferences."+a))}function p(a){i.confirm(l("Warning"),l("Save preferences and reload page now?"),{ok:l("Yes"),cancel:l("No")}).then(function(){E(a,{quick:!0}).then(function(){b.location.reload(!0)})})}function q(a){J.preferences.defaults.SOGoCalendarCategoriesColors["New category"]="#aaa",J.preferences.defaults.SOGoCalendarCategories.push("New category"),h("calendarCategory_"+(J.preferences.defaults.SOGoCalendarCategories.length-1)),a.$setDirty()}function r(a,b){var c=J.preferences.defaults.SOGoCalendarCategories[a];J.preferences.defaults.SOGoCalendarCategories.splice(a,1),delete J.preferences.defaults.SOGoCalendarCategoriesColors[c],b.$setDirty()}function s(a){J.preferences.defaults.SOGoContactsCategories.push(""),h("contactCategory_"+(J.preferences.defaults.SOGoContactsCategories.length-1)),a.$setDirty()}function t(a,b){J.preferences.defaults.SOGoContactsCategories.splice(a,1),b.$setDirty()}function u(a,b){var c;J.preferences.defaults.AuxiliaryMailAccounts.push({}),c=_.last(J.preferences.defaults.AuxiliaryMailAccounts),c.name=l("New account"),c.identities=[{fullName:"",email:""}],c.receipts={receiptAction:"ignore",receiptNonRecipientAction:"ignore",receiptOutsideDomainAction:"ignore",receiptAnyAction:"ignore"},f.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account=new",targetEvent:a,locals:{defaults:J.preferences.defaults,account:c,accountId:J.preferences.defaults.AuxiliaryMailAccounts.length-1,mailCustomFromEnabled:window.mailCustomFromEnabled}}).then(function(){b.$setDirty()})}function v(a,b,c){var d=J.preferences.defaults.AuxiliaryMailAccounts[b];f.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account="+b,targetEvent:a,locals:{defaults:J.preferences.defaults,account:d,accountId:b,mailCustomFromEnabled:window.mailCustomFromEnabled}}).then(function(){J.preferences.defaults.AuxiliaryMailAccounts[b]=d,c.$setDirty()})}function w(a,b){J.preferences.defaults.AuxiliaryMailAccounts.splice(a,1),b.$setDirty()}function x(a){var b="_$$"+guid();J.preferences.defaults.SOGoMailLabelsColors[b]=["New label","#aaa"],a.$setDirty()}function y(a,b){delete J.preferences.defaults.SOGoMailLabelsColors[a],b.$setDirty()}function z(a,b){var c={match:"all"};f.show({templateUrl:"editFilter?filter=new",controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:a,locals:{filter:c,mailboxes:K,labels:J.preferences.defaults.SOGoMailLabelsColors}}).then(function(){J.preferences.defaults.SOGoSieveFilters||(J.preferences.defaults.SOGoSieveFilters=[]),J.preferences.defaults.SOGoSieveFilters.push(c),b.$setDirty()})}function A(a,b,c){var d=angular.copy(J.preferences.defaults.SOGoSieveFilters[b]);f.show({templateUrl:"editFilter?filter="+b,controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:null,locals:{filter:d,mailboxes:K,labels:J.preferences.defaults.SOGoMailLabelsColors}}).then(function(){J.preferences.defaults.SOGoSieveFilters[b]=d,c.$setDirty()})}function B(a,b){J.preferences.defaults.SOGoSieveFilters.splice(a,1),b.$setDirty()}function C(a){var b=[];angular.isDefined(J.preferences.defaults.Vacation.autoReplyEmailAddresses)&&(b=J.preferences.defaults.Vacation.autoReplyEmailAddresses.split(",")),J.preferences.defaults.Vacation.autoReplyEmailAddresses=_.union(window.defaultEmailAddresses.split(","),b).join(","),a.$setDirty()}function D(a,c){var d;if(c.$dirty){for(a.preventDefault(),a.stopPropagation(),d=a.target;"A"!=d.tagName;)d=d.parentNode;i.confirm(l("Unsaved Changes"),l("Do you want to save your changes made to the configuration?"),{ok:l("Save"),cancel:l("Don't Save")}).then(function(){E(c,{quick:!0}).then(function(){b.location=d.href})},function(){b.location=d.href})}}function E(b,c){var d,e,f,h,j,k;if(e=!0,j=[],window.forwardConstraints>0&&angular.isDefined(J.preferences.defaults.Forward)&&J.preferences.defaults.Forward.enabled&&angular.isDefined(J.preferences.defaults.Forward.forwardAddress))for(f=J.preferences.defaults.Forward.forwardAddress.split(","),h=window.defaultEmailAddresses.split(/, */),_.forEach(h,function(a){var b=a.split("@")[1];b&&j.push(b.toLowerCase())}),d=0;d<f.length&&e;d++)k=f[d].split("@")[1].toLowerCase(),j.indexOf(k)<0&&1==window.forwardConstraints?(i.alert(l("Error"),l("You are not allowed to forward your messages to an external email address.")),e=!1):j.indexOf(k)>=0&&2==window.forwardConstraints&&(i.alert(l("Error"),l("You are not allowed to forward your messages to an internal email address.")),e=!1);return e?J.preferences.$save().then(function(a){c&&c.quick||(g.show(g.simple().content(l("Preferences saved")).position("bottom right").hideDelay(2e3)),b.$setPristine())}):a.reject()}function F(){return!!(J.passwords.newPassword&&J.passwords.newPassword.length>0&&J.passwords.newPasswordConfirmation&&J.passwords.newPasswordConfirmation.length&&J.passwords.newPassword==J.passwords.newPasswordConfirmation)}function G(){n.changePassword(J.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 H(a){return _.filter(J.timeZonesList,function(b){return b.toUpperCase().indexOf(a.toUpperCase())>=0})}var I,J=this,K=[];J.preferences=m,J.passwords={newPassword:null,newPasswordConfirmation:null},J.go=o,J.onLanguageChange=p,J.addCalendarCategory=q,J.removeCalendarCategory=r,J.addContactCategory=s,J.removeContactCategory=t,J.addMailAccount=u,J.editMailAccount=v,J.removeMailAccount=w,J.addMailLabel=x,J.removeMailLabel=y,J.addMailFilter=z,J.editMailFilter=A,J.removeMailFilter=B,J.addDefaultEmailAddresses=C,J.userFilter=j.$filter,J.confirmChanges=D,J.save=E,J.canChangePassword=F,J.changePassword=G,J.timeZonesList=window.timeZonesList,J.timeZonesListFilter=H,J.timeZonesSearchText="",I=new k({id:0}),I.$getMailboxes().then(function(){for(var a=I.$flattenMailboxes({all:!0}),b=-1,c=a.length;++b<c;)K.push(a[b])}),m.ready().then(function(){m.defaults.SOGoAlternateAvatar&&(j.$alternateAvatar=m.defaults.SOGoAlternateAvatar)})}a.$inject=["$q","$window","$state","$mdMedia","$mdSidenav","$mdDialog","$mdToast","sgFocus","Dialog","User","Account","statePreferences","Authentication"],angular.module("SOGo.PreferencesUI").controller("PreferencesController",a)}();
//# sourceMappingURL=Preferences.js.map