2 lines
12 KiB
JavaScript
2 lines
12 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","as.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.defaultPort=143,i.defaults=b,i.account=c,i.accountId=d,i.customFromIsReadonly=f,i.cancel=g,i.save=h,i.account.encryption?"ssl"==i.account.encryption&&(i.defaultPort=993):i.account.encryption="none"}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;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")),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,o){function p(a,b){b.$valid&&(d("xs")&&e("left").close(),c.go("preferences."+a))}function q(a){j.confirm(l("Warning"),l("Save preferences and reload page now?"),{ok:l("Yes"),cancel:l("No")}).then(function(){G(a,{quick:!0}).then(function(){b.location.reload(!0)})})}function r(a){Q.preferences.defaults.SOGoCalendarCategoriesColors["New category"]="#aaa",Q.preferences.defaults.SOGoCalendarCategories.push("New category"),i("calendarCategory_"+(Q.preferences.defaults.SOGoCalendarCategories.length-1)),a.$setDirty()}function s(a,b){var c=Q.preferences.defaults.SOGoCalendarCategories[a];Q.preferences.defaults.SOGoCalendarCategories.splice(a,1),delete Q.preferences.defaults.SOGoCalendarCategoriesColors[c],b.$setDirty()}function t(a){Q.preferences.defaults.SOGoContactsCategories.push(""),i("contactCategory_"+(Q.preferences.defaults.SOGoContactsCategories.length-1)),a.$setDirty()}function u(a,b){Q.preferences.defaults.SOGoContactsCategories.splice(a,1),b.$setDirty()}function v(a,b){var c;Q.preferences.defaults.AuxiliaryMailAccounts.push({}),c=_.last(Q.preferences.defaults.AuxiliaryMailAccounts),angular.extend(c,{name:"",identities:[{fullName:"",email:""}],receipts:{receiptAction:"ignore",receiptNonRecipientAction:"ignore",receiptOutsideDomainAction:"ignore",receiptAnyAction:"ignore"}}),f.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account=new",targetEvent:a,locals:{defaults:Q.preferences.defaults,account:c,accountId:Q.preferences.defaults.AuxiliaryMailAccounts.length-1,mailCustomFromEnabled:window.mailCustomFromEnabled}}).then(function(){b.$setDirty()})["catch"](function(){Q.preferences.defaults.AuxiliaryMailAccounts.pop()})}function w(a,b,c){var d=Q.preferences.defaults.AuxiliaryMailAccounts[b];f.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account="+b,targetEvent:a,locals:{defaults:Q.preferences.defaults,account:d,accountId:b,mailCustomFromEnabled:window.mailCustomFromEnabled}}).then(function(){Q.preferences.defaults.AuxiliaryMailAccounts[b]=d,c.$setDirty()})}function x(a,b){Q.preferences.defaults.AuxiliaryMailAccounts.splice(a,1),b.$setDirty()}function y(a){var b="_$$"+guid();Q.preferences.defaults.SOGoMailLabelsColors[b]=["New label","#aaa"],i("mailLabel_"+(_.size(Q.preferences.defaults.SOGoMailLabelsColors)-1)),a.$setDirty()}function z(a,b){delete Q.preferences.defaults.SOGoMailLabelsColors[a],b.$setDirty()}function A(a,b){var c={match:"all"};f.show({templateUrl:"editFilter?filter=new",controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:a,locals:{filter:c,mailboxes:R,labels:Q.preferences.defaults.SOGoMailLabelsColors}}).then(function(){Q.preferences.defaults.SOGoSieveFilters||(Q.preferences.defaults.SOGoSieveFilters=[]),Q.preferences.defaults.SOGoSieveFilters.push(c),b.$setDirty()})}function B(a,b,c){var d=angular.copy(Q.preferences.defaults.SOGoSieveFilters[b]);f.show({templateUrl:"editFilter?filter="+b,controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:null,locals:{filter:d,mailboxes:R,labels:Q.preferences.defaults.SOGoMailLabelsColors}}).then(function(){Q.preferences.defaults.SOGoSieveFilters[b]=d,c.$setDirty()})}function C(a,b){Q.preferences.defaults.SOGoSieveFilters.splice(a,1),b.$setDirty()}function D(a){var b=[];angular.isDefined(Q.preferences.defaults.Vacation.autoReplyEmailAddresses)&&(b=Q.preferences.defaults.Vacation.autoReplyEmailAddresses.split(",")),Q.preferences.defaults.Vacation.autoReplyEmailAddresses=_.union(window.defaultEmailAddresses.split(","),b).join(","),a.$setDirty()}function E(a,b){return a.length<h.minimumSearchLength()?[]:k.$filter(a,b).then(function(a){return _.forEach(a,function(a){a.$$image||(a.image?a.$$image=a.image:Q.preferences.avatar(a.c_email,32,{no_404:!0}).then(function(b){a.$$image=b}))}),a})}function F(a,c){var d;if(c.$dirty){for(a.preventDefault(),a.stopPropagation(),d=a.target;"A"!=d.tagName;)d=d.parentNode;j.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(){G(c,{quick:!0}).then(function(){b.location=d.href})},function(){b.location=d.href})}}function G(c,d){var e,f,h,i,k,m;if(f=!0,k=[],b.forwardConstraints>0&&angular.isDefined(Q.preferences.defaults.Forward)&&Q.preferences.defaults.Forward.enabled&&angular.isDefined(Q.preferences.defaults.Forward.forwardAddress))for(h=Q.preferences.defaults.Forward.forwardAddress.split(","),i=b.defaultEmailAddresses.split(/, */),_.forEach(i,function(a){var b=a.split("@")[1];b&&k.push(b.toLowerCase())}),e=0;e<h.length&&f;e++)m=h[e].split("@")[1].toLowerCase(),k.indexOf(m)<0&&1==b.forwardConstraints?(j.alert(l("Error"),l("You are not allowed to forward your messages to an external email address.")),f=!1):k.indexOf(m)>=0&&2==b.forwardConstraints&&(j.alert(l("Error"),l("You are not allowed to forward your messages to an internal email address.")),f=!1);return f?Q.preferences.$save().then(function(a){d&&d.quick||(g.show(g.simple().content(l("Preferences saved")).position("bottom right").hideDelay(2e3)),c.$setPristine())}):a.reject()}function H(){return!!(Q.passwords.newPassword&&Q.passwords.newPassword.length>0&&Q.passwords.newPasswordConfirmation&&Q.passwords.newPasswordConfirmation.length&&Q.passwords.newPassword==Q.passwords.newPasswordConfirmation)}function I(){o.changePassword(Q.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 J(a){return _.filter(Q.timeZonesList,function(b){return b.toUpperCase().indexOf(a.toUpperCase())>=0})}function K(){var a=Q.preferences.defaults;a&&a.Vacation&&a.Vacation.enabled&&(L(),M())}function L(){var a;a=Q.preferences.defaults.Vacation,a.startDateEnabled&&(a.endDateEnabled&&a.startDate.getTime()>a.endDate.getTime()&&(a.startDate=new Date(a.endDate.getTime()),a.startDate.addDays(-1)),a.startDate.getTime()<T.getTime()&&(a.startDate=new Date(T.getTime())))}function M(){var a;a=Q.preferences.defaults.Vacation,a.endDateEnabled&&(a.startDateEnabled&&a.endDate.getTime()<a.startDate.getTime()?(a.endDate=new Date(a.startDate.getTime()),a.endDate.addDays(1)):a.endDate.getTime()<T.getTime()&&(a.endDate=new Date(T.getTime())))}function N(a){var b=Q.preferences.defaults,c=!0;return b&&b.Vacation&&b.Vacation.enabled&&b.Vacation.startDateEnabled&&(c=(!b.Vacation.endDateEnabled||a.getTime()<b.Vacation.endDate.getTime())&&a.getTime()>=T.getTime()),c}function O(a){var b=Q.preferences.defaults,c=!0;return b&&b.Vacation&&b.Vacation.enabled&&b.Vacation.endDateEnabled&&(c=(!b.Vacation.startDateEnabled||a.getTime()>b.Vacation.startDate.getTime())&&a.getTime()>=T.getTime()),c}var P,Q=this,R=[],S=new Date,T=S.beginOfDay().addDays(1);Q.preferences=n,Q.passwords={newPassword:null,newPasswordConfirmation:null},Q.go=p,Q.onLanguageChange=q,Q.addCalendarCategory=r,Q.removeCalendarCategory=s,Q.addContactCategory=t,Q.removeContactCategory=u,Q.addMailAccount=v,Q.editMailAccount=w,Q.removeMailAccount=x,Q.addMailLabel=y,Q.removeMailLabel=z,Q.addMailFilter=A,Q.editMailFilter=B,Q.removeMailFilter=C,Q.addDefaultEmailAddresses=D,Q.userFilter=E,Q.confirmChanges=F,Q.save=G,Q.canChangePassword=H,Q.changePassword=I,Q.timeZonesList=window.timeZonesList,Q.timeZonesListFilter=J,Q.timeZonesSearchText="",Q.sieveVariablesCapability=b.sieveCapabilities.indexOf("variables")>=0,Q.updateVacationDates=K,Q.toggleVacationStartDate=L,Q.toggleVacationEndDate=M,Q.validateVacationStartDate=N,Q.validateVacationEndDate=O,P=new m({id:0}),P.$getMailboxes().then(function(){for(var a=P.$flattenMailboxes({all:!0}),b=-1,c=a.length;++b<c;)R.push(a[b])}),n.ready().then(function(){n.defaults.SOGoAlternateAvatar&&(k.$alternateAvatar=n.defaults.SOGoAlternateAvatar),K()})}a.$inject=["$q","$window","$state","$mdMedia","$mdSidenav","$mdDialog","$mdToast","sgSettings","sgFocus","Dialog","User","Account","statePreferences","Authentication"],angular.module("SOGo.PreferencesUI").controller("PreferencesController",a)}();
|
|
//# sourceMappingURL=Preferences.js.map
|