sogo/UI/WebServerResources/js/Preferences.js
2015-12-11 15:44:55 -05:00

2 lines
9.3 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){function m(a){c.go("preferences."+a)}function n(){g.confirm(l("Warning"),l("Save preferences and reload page now?"),{ok:l("Yes"),cancel:l("No")}).then(function(){B().then(function(){b.location.reload(!0)})})}function o(){G.preferences.defaults.SOGoCalendarCategoriesColors["New category"]="#aaa",G.preferences.defaults.SOGoCalendarCategories.push("New category"),f("calendarCategory_"+(G.preferences.defaults.SOGoCalendarCategories.length-1))}function p(a){var b=G.preferences.defaults.SOGoCalendarCategories[a];G.preferences.defaults.SOGoCalendarCategories.splice(a,1),delete G.preferences.defaults.SOGoCalendarCategoriesColors[b]}function q(){G.preferences.defaults.SOGoContactsCategories.push(""),f("contactCategory_"+(G.preferences.defaults.SOGoContactsCategories.length-1))}function r(a){G.preferences.defaults.SOGoContactsCategories.splice(a,1)}function s(a){var b;G.preferences.defaults.AuxiliaryMailAccounts.push({}),b=_.last(G.preferences.defaults.AuxiliaryMailAccounts),b.name=l("New account"),b.identities=[{fullName:"",email:""}],b.receipts={receiptAction:"ignore",receiptNonRecipientAction:"ignore",receiptOutsideDomainAction:"ignore",receiptAnyAction:"ignore"},d.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account=new",targetEvent:a,locals:{defaults:G.preferences.defaults,account:b,accountId:G.preferences.defaults.AuxiliaryMailAccounts.length-1,mailCustomFromEnabled:window.mailCustomFromEnabled}})}function t(a,b){var c=G.preferences.defaults.AuxiliaryMailAccounts[b];d.show({controller:"AccountDialogController",controllerAs:"$AccountDialogController",templateUrl:"editAccount?account="+b,targetEvent:a,locals:{defaults:G.preferences.defaults,account:c,accountId:b,mailCustomFromEnabled:window.mailCustomFromEnabled}}).then(function(){G.preferences.defaults.AuxiliaryMailAccounts[b]=c})}function u(a){G.preferences.defaults.AuxiliaryMailAccounts.splice(a,1)}function v(){var a="_$$"+guid();G.preferences.defaults.SOGoMailLabelsColors[a]=["New label","#aaa"]}function w(a){delete G.preferences.defaults.SOGoMailLabelsColors[a]}function x(a){var b={match:"all"};d.show({templateUrl:"editFilter?filter=new",controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:a,locals:{filter:b,mailboxes:H,labels:G.preferences.defaults.SOGoMailLabelsColors}}).then(function(){G.preferences.defaults.SOGoSieveFilters||(G.preferences.defaults.SOGoSieveFilters=[]),G.preferences.defaults.SOGoSieveFilters.push(b)})}function y(a,b){var c=angular.copy(G.preferences.defaults.SOGoSieveFilters[b]);d.show({templateUrl:"editFilter?filter="+b,controller:"FiltersDialogController",controllerAs:"filterEditor",targetEvent:null,locals:{filter:c,mailboxes:H,labels:G.preferences.defaults.SOGoMailLabelsColors}}).then(function(){G.preferences.defaults.SOGoSieveFilters[b]=c})}function z(a){G.preferences.defaults.SOGoSieveFilters.splice(a,1)}function A(){var a=[];angular.isDefined(G.preferences.defaults.Vacation.autoReplyEmailAddresses)&&(a=G.preferences.defaults.Vacation.autoReplyEmailAddresses.split(",")),G.preferences.defaults.Vacation.autoReplyEmailAddresses=_.union(window.defaultEmailAddresses.split(","),a).join(",")}function B(){var b,c,d,f,h,i;if(c=!0,h=[],window.forwardConstraints>0&&angular.isDefined(G.preferences.defaults.Forward)&&G.preferences.defaults.Forward.enabled&&angular.isDefined(G.preferences.defaults.Forward.forwardAddress))for(d=G.preferences.defaults.Forward.forwardAddress.split(","),f=window.defaultEmailAddresses.split(/, */),_.forEach(f,function(a){var b=a.split("@")[1];b&&h.push(b.toLowerCase())}),b=0;b<d.length&&c;b++)i=d[b].split("@")[1].toLowerCase(),h.indexOf(i)<0&&1==window.forwardConstraints?(g.alert(l("Error"),l("You are not allowed to forward your messages to an external email address.")),c=!1):h.indexOf(i)>=0&&2==window.forwardConstraints&&(g.alert(l("Error"),l("You are not allowed to forward your messages to an internal email address.")),c=!1);return c?G.preferences.$save().then(function(a){e.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 C(){return G.passwords.newPassword&&G.passwords.newPassword.length>0&&G.passwords.newPasswordConfirmation&&G.passwords.newPasswordConfirmation.length&&G.passwords.newPassword==G.passwords.newPasswordConfirmation?!0:!1}function D(){k.changePassword(G.passwords.newPassword).then(function(){var a=d.alert({title:l("Password"),content:l("The password was changed successfully."),ok:l("OK")});d.show(a)["finally"](function(){a=void 0})},function(a){var b=d.alert({title:l("Password"),content:a,ok:l("OK")});d.show(b)["finally"](function(){b=void 0})})}function E(a){return _.filter(G.timeZonesList,function(b){return b.toUpperCase().indexOf(a.toUpperCase())>=0})}var F,G=this,H=[];G.preferences=j,G.passwords={newPassword:null,newPasswordConfirmation:null},G.go=m,G.onLanguageChange=n,G.addCalendarCategory=o,G.removeCalendarCategory=p,G.addContactCategory=q,G.removeContactCategory=r,G.addMailAccount=s,G.editMailAccount=t,G.removeMailAccount=u,G.addMailLabel=v,G.removeMailLabel=w,G.addMailFilter=x,G.editMailFilter=y,G.removeMailFilter=z,G.addDefaultEmailAddresses=A,G.userFilter=h.$filter,G.save=B,G.canChangePassword=C,G.changePassword=D,G.timeZonesList=window.timeZonesList,G.timeZonesListFilter=E,G.timeZonesSearchText="",F=new i({id:0}),F.$getMailboxes().then(function(){for(var a=F.$flattenMailboxes({all:!0}),b=-1,c=a.length;++b<c;)H.push(a[b])}),j.ready().then(function(){j.defaults.SOGoAlternateAvatar&&(h.$alternateAvatar=j.defaults.SOGoAlternateAvatar)})}function b(a,b){a.closeToast=function(){b.hide()}}a.$inject=["$q","$window","$state","$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