diff --git a/UI/WebServerResources/js/Preferences.services.js b/UI/WebServerResources/js/Preferences.services.js index c93b4ec80..beadfc465 100644 --- a/UI/WebServerResources/js/Preferences.services.js +++ b/UI/WebServerResources/js/Preferences.services.js @@ -1,2 +1,2 @@ -!function(){"use strict";function a(){var b=this;this.defaults={},this.settings={},this.defaultsPromise=a.$$resource.fetch("jsonDefaults").then(function(c){var d=_.object(_.map(c.SOGoMailLabelsColors,function(a,b){return"$"==b.charAt(0)?["_"+b,a]:[b,a]}));return c.SOGoMailLabelsColors=d,c.SOGoMailAutoSave=parseInt(c.SOGoMailAutoSave)||0,c.Vacation?(c.Vacation.endDate?c.Vacation.endDate=new Date(1e3*parseInt(c.Vacation.endDate)):(c.Vacation.endDateEnabled=0,c.Vacation.endDate=new Date),c.Vacation.autoReplyEmailAddresses&&c.Vacation.autoReplyEmailAddresses.length?c.Vacation.autoReplyEmailAddresses=c.Vacation.autoReplyEmailAddresses.join(","):delete c.Vacation.autoReplyEmailAddresses):c.Vacation={},angular.isUndefined(c.Vacation.autoReplyEmailAddresses)&&angular.isDefined(window.defaultEmailAddresses)&&(c.Vacation.autoReplyEmailAddresses=window.defaultEmailAddresses),angular.isUndefined(c.Vacation.daysBetweenResponse)&&(c.Vacation.daysBetweenResponse=7),angular.isUndefined(c.Vacation.endDate)&&(c.Vacation.endDateEnabled=0,c.Vacation.endDate=new Date),c.Forward&&c.Forward.forwardAddress&&(c.Forward.forwardAddress=c.Forward.forwardAddress.join(",")),angular.isUndefined(c.SOGoCalendarCategoriesColors)&&(c.SOGoCalendarCategoriesColors={},c.SOGoCalendarCategories=[]),angular.isUndefined(c.SOGoContactsCategories)&&(c.SOGoContactsCategories=[]),angular.extend(b.defaults,c),b.$mdDateLocaleProvider=a.$mdDateLocaleProvider,angular.extend(b.$mdDateLocaleProvider,c.locale),b.$mdDateLocaleProvider.firstDayOfWeek=parseInt(c.SOGoFirstDayOfWeek),b.$mdDateLocaleProvider.weekNumberFormatter=function(a){return l("Week %d",a)},b.$mdDateLocaleProvider.msgCalendar=l("Calender"),b.$mdDateLocaleProvider.msgOpenCalendar=l("Open Calendar"),b.$mdDateLocaleProvider.parseDate=function(a){return a?a.parseDate(b.$mdDateLocaleProvider,c.SOGoShortDateFormat):new Date(NaN)},b.$mdDateLocaleProvider.formatDate=function(a){return a?a.format(b.$mdDateLocaleProvider,c.SOGoShortDateFormat):""},b.$mdDateLocaleProvider.formatTime=function(a){return a?a.format(b.$mdDateLocaleProvider,c.SOGoTimeFormat):""},b.defaults}),this.settingsPromise=a.$$resource.fetch("jsonSettings").then(function(c){return c.Calendar&&(c.Calendar.PreventInvitationsWhitelist?c.Calendar.PreventInvitationsWhitelist=_.map(c.Calendar.PreventInvitationsWhitelist,function(b,c){var d=/^(.+)\s<(\S+)>$/.exec(b);return new a.$User({uid:c,cn:d[1],c_email:d[2]})}):c.Calendar.PreventInvitationsWhitelist=[]),angular.extend(b.settings,c),b.settings})}a.$factory=["$q","$timeout","$log","$mdDateLocale","sgSettings","Resource","User",function(b,c,d,e,f,g,h){return angular.extend(a,{$q:b,$timeout:c,$log:d,$mdDateLocaleProvider:e,$$resource:new g(f.activeUser("folderURL"),f.activeUser()),activeUser:f.activeUser(),$User:h}),new a}];try{angular.module("SOGo.PreferencesUI")}catch(b){angular.module("SOGo.PreferencesUI",["SOGo.Common"])}angular.module("SOGo.PreferencesUI").factory("Preferences",a.$factory),a.prototype.ready=function(){return a.$q.all([this.defaultsPromise,this.settingsPromise])},a.prototype.$save=function(){return a.$$resource.save("Preferences",this.$omit(!0)).then(function(a){return a})},a.prototype.$omit=function(a){var b,c,d;return b={},d={},angular.forEach(this,function(c,d){"constructor"!=d&&"$"!=d[0]&&(a?b[d]=angular.copy(c):b[d]=c)}),c=_.object(_.map(b.defaults.SOGoMailLabelsColors,function(a,b){return"_"==b.charAt(0)&&"$"==b.charAt(1)?b.length>2&&"$"==b.charAt(2)?[a[0].toLowerCase().replace(/[ \(\)\/\{%\*<>\\\"]/g,"_"),a]:[b.substring(1),a]:[b,a]})),b.defaults.SOGoMailLabelsColors=c,b.defaults.Vacation&&(b.defaults.Vacation.endDateEnabled?b.defaults.Vacation.endDate=b.defaults.Vacation.endDate.getTime()/1e3:b.defaults.Vacation.endDate=0,b.defaults.Vacation.autoReplyEmailAddresses?b.defaults.Vacation.autoReplyEmailAddresses=_.filter(b.defaults.Vacation.autoReplyEmailAddresses.split(","),function(a){return a.length}):b.defaults.Vacation.autoReplyEmailAddresses=[]),b.defaults.Forward&&b.defaults.Forward.forwardAddress&&(b.defaults.Forward.forwardAddress=b.defaults.Forward.forwardAddress.split(",")),b.settings.Calendar&&b.settings.Calendar.PreventInvitationsWhitelist&&(_.each(b.settings.Calendar.PreventInvitationsWhitelist,function(a){d[a.uid]=a.$shortFormat()}),b.settings.Calendar.PreventInvitationsWhitelist=d),b}}(); +!function(){"use strict";function a(){var b=this;this.defaults={},this.settings={},this.defaultsPromise=a.$$resource.fetch("jsonDefaults").then(function(c){var d=_.object(_.map(c.SOGoMailLabelsColors,function(a,b){return"$"==b.charAt(0)?["_"+b,a]:[b,a]}));return c.SOGoMailLabelsColors=d,c.SOGoMailAutoSave=parseInt(c.SOGoMailAutoSave)||0,c.SOGoMailComposeFontSizeEnabled=parseInt(c.SOGoMailComposeFontSize)>0,window.CKEDITOR&&c.SOGoMailComposeFontSizeEnabled&&(window.CKEDITOR.config.fontSize_defaultLabel=c.SOGoMailComposeFontSize,window.CKEDITOR.addCss(".cke_editable { font-size: "+c.SOGoMailComposeFontSize+"px; }")),c.Vacation?(c.Vacation.endDate?c.Vacation.endDate=new Date(1e3*parseInt(c.Vacation.endDate)):(c.Vacation.endDateEnabled=0,c.Vacation.endDate=new Date),c.Vacation.autoReplyEmailAddresses&&c.Vacation.autoReplyEmailAddresses.length?c.Vacation.autoReplyEmailAddresses=c.Vacation.autoReplyEmailAddresses.join(","):delete c.Vacation.autoReplyEmailAddresses):c.Vacation={},angular.isUndefined(c.Vacation.autoReplyEmailAddresses)&&angular.isDefined(window.defaultEmailAddresses)&&(c.Vacation.autoReplyEmailAddresses=window.defaultEmailAddresses),angular.isUndefined(c.Vacation.daysBetweenResponse)&&(c.Vacation.daysBetweenResponse=7),angular.isUndefined(c.Vacation.endDate)&&(c.Vacation.endDateEnabled=0,c.Vacation.endDate=new Date),c.Forward&&c.Forward.forwardAddress&&(c.Forward.forwardAddress=c.Forward.forwardAddress.join(",")),angular.isUndefined(c.SOGoCalendarCategoriesColors)&&(c.SOGoCalendarCategoriesColors={},c.SOGoCalendarCategories=[]),angular.isUndefined(c.SOGoContactsCategories)&&(c.SOGoContactsCategories=[]),angular.extend(b.defaults,c),b.$mdDateLocaleProvider=a.$mdDateLocaleProvider,angular.extend(b.$mdDateLocaleProvider,c.locale),b.$mdDateLocaleProvider.firstDayOfWeek=parseInt(c.SOGoFirstDayOfWeek),b.$mdDateLocaleProvider.weekNumberFormatter=function(a){return l("Week %d",a)},b.$mdDateLocaleProvider.msgCalendar=l("Calender"),b.$mdDateLocaleProvider.msgOpenCalendar=l("Open Calendar"),b.$mdDateLocaleProvider.parseDate=function(a){return a?a.parseDate(b.$mdDateLocaleProvider,c.SOGoShortDateFormat):new Date(NaN)},b.$mdDateLocaleProvider.formatDate=function(a){return a?a.format(b.$mdDateLocaleProvider,c.SOGoShortDateFormat):""},b.$mdDateLocaleProvider.formatTime=function(a){return a?a.format(b.$mdDateLocaleProvider,c.SOGoTimeFormat):""},b.defaults}),this.settingsPromise=a.$$resource.fetch("jsonSettings").then(function(c){return c.Calendar&&(c.Calendar.PreventInvitationsWhitelist?c.Calendar.PreventInvitationsWhitelist=_.map(c.Calendar.PreventInvitationsWhitelist,function(b,c){var d=/^(.+)\s<(\S+)>$/.exec(b);return new a.$User({uid:c,cn:d[1],c_email:d[2]})}):c.Calendar.PreventInvitationsWhitelist=[]),angular.extend(b.settings,c),b.settings})}a.$factory=["$q","$timeout","$log","$mdDateLocale","sgSettings","Resource","User",function(b,c,d,e,f,g,h){return angular.extend(a,{$q:b,$timeout:c,$log:d,$mdDateLocaleProvider:e,$$resource:new g(f.activeUser("folderURL"),f.activeUser()),activeUser:f.activeUser(),$User:h}),new a}];try{angular.module("SOGo.PreferencesUI")}catch(b){angular.module("SOGo.PreferencesUI",["SOGo.Common"])}angular.module("SOGo.PreferencesUI").factory("Preferences",a.$factory),a.prototype.ready=function(){return a.$q.all([this.defaultsPromise,this.settingsPromise])},a.prototype.$save=function(){return a.$$resource.save("Preferences",this.$omit(!0)).then(function(a){return a})},a.prototype.$omit=function(a){var b,c,d;return b={},d={},angular.forEach(this,function(c,d){"constructor"!=d&&"$"!=d[0]&&(a?b[d]=angular.copy(c):b[d]=c)}),c=_.object(_.map(b.defaults.SOGoMailLabelsColors,function(a,b){return"_"==b.charAt(0)&&"$"==b.charAt(1)?b.length>2&&"$"==b.charAt(2)?[a[0].toLowerCase().replace(/[ \(\)\/\{%\*<>\\\"]/g,"_"),a]:[b.substring(1),a]:[b,a]})),b.defaults.SOGoMailLabelsColors=c,b.defaults.SOGoMailComposeFontSizeEnabled||(b.defaults.SOGoMailComposeFontSize=0),delete b.defaults.SOGoMailComposeFontSizeEnabled,b.defaults.Vacation&&(b.defaults.Vacation.endDateEnabled?b.defaults.Vacation.endDate=b.defaults.Vacation.endDate.getTime()/1e3:b.defaults.Vacation.endDate=0,b.defaults.Vacation.autoReplyEmailAddresses?b.defaults.Vacation.autoReplyEmailAddresses=_.filter(b.defaults.Vacation.autoReplyEmailAddresses.split(","),function(a){return a.length}):b.defaults.Vacation.autoReplyEmailAddresses=[]),b.defaults.Forward&&b.defaults.Forward.forwardAddress&&(b.defaults.Forward.forwardAddress=b.defaults.Forward.forwardAddress.split(",")),b.settings.Calendar&&b.settings.Calendar.PreventInvitationsWhitelist&&(_.each(b.settings.Calendar.PreventInvitationsWhitelist,function(a){d[a.uid]=a.$shortFormat()}),b.settings.Calendar.PreventInvitationsWhitelist=d),b}}(); //# sourceMappingURL=Preferences.services.js.map \ No newline at end of file diff --git a/UI/WebServerResources/js/Preferences.services.js.map b/UI/WebServerResources/js/Preferences.services.js.map index 4d17bcd75..98ff29599 100644 --- a/UI/WebServerResources/js/Preferences.services.js.map +++ b/UI/WebServerResources/js/Preferences.services.js.map @@ -1 +1 @@ -{"version":3,"sources":["Preferences/Preferences.service.js"],"names":["Preferences","_this","this","defaults","settings","defaultsPromise","$$resource","fetch","then","data","labels","_","object","map","SOGoMailLabelsColors","value","key","charAt","SOGoMailAutoSave","parseInt","Vacation","endDate","Date","endDateEnabled","autoReplyEmailAddresses","length","join","angular","isUndefined","isDefined","window","defaultEmailAddresses","daysBetweenResponse","Forward","forwardAddress","SOGoCalendarCategoriesColors","SOGoCalendarCategories","SOGoContactsCategories","extend","$mdDateLocaleProvider","locale","firstDayOfWeek","SOGoFirstDayOfWeek","weekNumberFormatter","weekNumber","l","msgCalendar","msgOpenCalendar","parseDate","dateString","SOGoShortDateFormat","NaN","formatDate","date","format","formatTime","SOGoTimeFormat","settingsPromise","Calendar","PreventInvitationsWhitelist","match","exec","$User","uid","cn","c_email","$factory","$q","$timeout","$log","Settings","Resource","User","activeUser","module","e","factory","prototype","ready","all","$save","save","$omit","deep","preferences","whitelist","forEach","copy","toLowerCase","replace","substring","getTime","filter","split","v","each","user","$shortFormat"],"mappings":"CAEA,WACE,YAMA,SAASA,KACP,GAAIC,GAAQC,IAEZA,MAAKC,YACLD,KAAKE,YAELF,KAAKG,gBAAkBL,EAAYM,WAAWC,MAAM,gBAAgBC,KAAK,SAASC,GAEhF,GAAIC,GAASC,EAAEC,OAAOD,EAAEE,IAAIJ,EAAKK,qBAAsB,SAASC,EAAOC,GACrE,MAAqB,KAAjBA,EAAIC,OAAO,IACL,IAAMD,EAAKD,IACbC,EAAKD,KAqEf,OAlEAN,GAAKK,qBAAuBJ,EAG5BD,EAAKS,iBAAmBC,SAASV,EAAKS,mBAAqB,EAKvDT,EAAKW,UACHX,EAAKW,SAASC,QAChBZ,EAAKW,SAASC,QAAU,GAAIC,MAAuC,IAAlCH,S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,SAASC,4BAA6B,SAASqC,GACzEX,EAAUW,EAAKjC,KAAOiC,EAAKC,iBAE7Bb,EAAYhF,SAASsD,SAASC,4BAA8B0B,GAGvDD","file":"Preferences.services.js","sourcesContent":["/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n\n(function() {\n 'use strict';\n\n /**\n * @name Preferences\n * @constructor\n */\n function Preferences() {\n var _this = this;\n\n this.defaults = {};\n this.settings = {};\n\n this.defaultsPromise = Preferences.$$resource.fetch(\"jsonDefaults\").then(function(data) {\n // We swap $key -> _$key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)\n var labels = _.object(_.map(data.SOGoMailLabelsColors, function(value, key) {\n if (key.charAt(0) == '$')\n return ['_' + key, value];\n return [key, value];\n }));\n\n data.SOGoMailLabelsColors = labels;\n\n // Mail editor autosave is a number of minutes or 0 if disabled\n data.SOGoMailAutoSave = parseInt(data.SOGoMailAutoSave) || 0;\n\n // We convert our list of autoReplyEmailAddresses/forwardAddress into a string.\n // We also convert our date objects into real date, otherwise we'll have strings\n // or undefined values and the md-datepicker does NOT like this.\n if (data.Vacation) {\n if (data.Vacation.endDate)\n data.Vacation.endDate = new Date(parseInt(data.Vacation.endDate) * 1000);\n else {\n data.Vacation.endDateEnabled = 0;\n data.Vacation.endDate = new Date();\n }\n if (data.Vacation.autoReplyEmailAddresses && data.Vacation.autoReplyEmailAddresses.length)\n data.Vacation.autoReplyEmailAddresses = data.Vacation.autoReplyEmailAddresses.join(\",\");\n else\n delete data.Vacation.autoReplyEmailAddresses;\n } else\n data.Vacation = {};\n\n if (angular.isUndefined(data.Vacation.autoReplyEmailAddresses) &&\n angular.isDefined(window.defaultEmailAddresses))\n data.Vacation.autoReplyEmailAddresses = window.defaultEmailAddresses;\n\n if (angular.isUndefined(data.Vacation.daysBetweenResponse))\n data.Vacation.daysBetweenResponse = 7;\n\n if (angular.isUndefined(data.Vacation.endDate)) {\n data.Vacation.endDateEnabled = 0;\n data.Vacation.endDate = new Date();\n }\n\n if (data.Forward && data.Forward.forwardAddress)\n data.Forward.forwardAddress = data.Forward.forwardAddress.join(\",\");\n\n if (angular.isUndefined(data.SOGoCalendarCategoriesColors)) {\n data.SOGoCalendarCategoriesColors = {};\n data.SOGoCalendarCategories = [];\n }\n\n if (angular.isUndefined(data.SOGoContactsCategories))\n data.SOGoContactsCategories = [];\n\n angular.extend(_this.defaults, data);\n\n // Configure date locale\n _this.$mdDateLocaleProvider = Preferences.$mdDateLocaleProvider;\n angular.extend(_this.$mdDateLocaleProvider, data.locale);\n _this.$mdDateLocaleProvider.firstDayOfWeek = parseInt(data.SOGoFirstDayOfWeek);\n _this.$mdDateLocaleProvider.weekNumberFormatter = function(weekNumber) {\n return l('Week %d', weekNumber);\n };\n _this.$mdDateLocaleProvider.msgCalendar = l('Calender');\n _this.$mdDateLocaleProvider.msgOpenCalendar = l('Open Calendar');\n _this.$mdDateLocaleProvider.parseDate = function(dateString) {\n return dateString? dateString.parseDate(_this.$mdDateLocaleProvider, data.SOGoShortDateFormat) : new Date(NaN);\n };\n _this.$mdDateLocaleProvider.formatDate = function(date) {\n return date? date.format(_this.$mdDateLocaleProvider, data.SOGoShortDateFormat) : '';\n };\n _this.$mdDateLocaleProvider.formatTime = function(date) {\n return date? date.format(_this.$mdDateLocaleProvider, data.SOGoTimeFormat) : '';\n };\n\n return _this.defaults;\n });\n\n this.settingsPromise = Preferences.$$resource.fetch(\"jsonSettings\").then(function(data) {\n // We convert our PreventInvitationsWhitelist hash into a array of user\n if (data.Calendar) {\n if (data.Calendar.PreventInvitationsWhitelist)\n data.Calendar.PreventInvitationsWhitelist = _.map(data.Calendar.PreventInvitationsWhitelist, function(value, key) {\n var match = /^(.+)\\s<(\\S+)>$/.exec(value);\n return new Preferences.$User({uid: key, cn: match[1], c_email: match[2]});\n });\n else\n data.Calendar.PreventInvitationsWhitelist = [];\n }\n\n angular.extend(_this.settings, data);\n\n return _this.settings;\n });\n }\n\n /**\n * @memberof Preferences\n * @desc The factory we'll use to register with Angular\n * @returns the Preferences constructor\n */\n Preferences.$factory = ['$q', '$timeout', '$log', '$mdDateLocale', 'sgSettings', 'Resource', 'User', function($q, $timeout, $log, $mdDateLocaleProvider, Settings, Resource, User) {\n angular.extend(Preferences, {\n $q: $q,\n $timeout: $timeout,\n $log: $log,\n $mdDateLocaleProvider: $mdDateLocaleProvider,\n $$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),\n activeUser: Settings.activeUser(),\n $User: User\n });\n\n return new Preferences(); // return unique instance\n }];\n\n /* Initialize module if necessary */\n try {\n angular.module('SOGo.PreferencesUI');\n }\n catch(e) {\n angular.module('SOGo.PreferencesUI', ['SOGo.Common']);\n }\n\n /* Factory registration in Angular module */\n angular.module('SOGo.PreferencesUI')\n .factory('Preferences', Preferences.$factory);\n\n /**\n * @function ready\n * @memberof Preferences.prototype\n * @desc Combine promises used to load user's defaults and settings.\n * @return a combined promise\n */\n Preferences.prototype.ready = function() {\n return Preferences.$q.all([this.defaultsPromise, this.settingsPromise]);\n };\n\n /**\n * @function $save\n * @memberof Preferences.prototype\n * @desc Save the preferences to the server.\n */\n Preferences.prototype.$save = function() {\n var _this = this;\n\n return Preferences.$$resource.save(\"Preferences\", this.$omit(true))\n .then(function(data) {\n // Make a copy of the data for an eventual reset\n //_this.$shadowData = _this.$omit(true);\n return data;\n });\n };\n\n /**\n * @function $omit\n * @memberof Preferences.prototype\n * @desc Return a sanitized object used to send to the server.\n * @param {Boolean} [deep] - make a deep copy if true\n * @return an object literal copy of the Preferences instance\n */\n Preferences.prototype.$omit = function(deep) {\n var preferences, labels, whitelist;\n\n preferences = {};\n whitelist = {};\n\n angular.forEach(this, function(value, key) {\n if (key != 'constructor' && key[0] != '$') {\n if (deep)\n preferences[key] = angular.copy(value);\n else\n preferences[key] = value;\n }\n });\n\n // We swap _$key -> $key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)\n labels = _.object(_.map(preferences.defaults.SOGoMailLabelsColors, function(value, key) {\n if (key.charAt(0) == '_' && key.charAt(1) == '$') {\n // New key, let's take the value and flatten it\n if (key.length > 2 && key.charAt(2) == '$') {\n return [value[0].toLowerCase().replace(/[ \\(\\)\\/\\{%\\*<>\\\\\\\"]/g, \"_\"), value];\n }\n return [key.substring(1), value];\n }\n return [key, value];\n }));\n\n preferences.defaults.SOGoMailLabelsColors = labels;\n\n if (preferences.defaults.Vacation) {\n if (preferences.defaults.Vacation.endDateEnabled)\n preferences.defaults.Vacation.endDate = preferences.defaults.Vacation.endDate.getTime()/1000;\n else\n preferences.defaults.Vacation.endDate = 0;\n\n if (preferences.defaults.Vacation.autoReplyEmailAddresses)\n preferences.defaults.Vacation.autoReplyEmailAddresses = _.filter(preferences.defaults.Vacation.autoReplyEmailAddresses.split(\",\"), function(v) { return v.length; });\n else\n preferences.defaults.Vacation.autoReplyEmailAddresses = [];\n }\n\n if (preferences.defaults.Forward && preferences.defaults.Forward.forwardAddress)\n preferences.defaults.Forward.forwardAddress = preferences.defaults.Forward.forwardAddress.split(\",\");\n\n if (preferences.settings.Calendar && preferences.settings.Calendar.PreventInvitationsWhitelist) {\n _.each(preferences.settings.Calendar.PreventInvitationsWhitelist, function(user) {\n whitelist[user.uid] = user.$shortFormat();\n });\n preferences.settings.Calendar.PreventInvitationsWhitelist = whitelist;\n }\n\n return preferences;\n };\n\n})();\n"]} \ No newline at end of file +{"version":3,"sources":["Preferences/Preferences.service.js"],"names":["Preferences","_this","this","defaults","settings","defaultsPromise","$$resource","fetch","then","data","labels","_","object","map","SOGoMailLabelsColors","value","key","charAt","SOGoMailAutoSave","parseInt","SOGoMailComposeFontSizeEnabled","SOGoMailComposeFontSize","window","CKEDITOR","config","fontSize_defaultLabel","addCss","Vacation","endDate","Date","endDateEnabled","autoReplyEmailAddresses","length","join","angular","isUndefined","isDefined","defaultEmailAddresses","daysBetweenResponse","Forward","forwardAddress","SOGoCalendarCategoriesColors","SOGoCalendarCategories","SOGoContactsCategories","extend","$mdDateLocaleProvider","locale","firstDayOfWeek","SOGoFirstDayOfWeek","weekNumberFormatter","weekNumber","l","msgCalendar","msgOpenCalendar","parseDate","dateString","SOGoShortDateFormat","NaN","formatDate","date","format","formatTime","SOGoTimeFormat","settingsPromise","Calendar","PreventInvitationsWhitelist","match","exec","$User","uid","cn","c_email","$factory","$q","$timeout","$log","Settings","Resource","User","activeUser","module","e","factory","prototype","ready","all","$save","save","$omit","deep","preferences","whitelist","forEach","copy","toLowerCase","replace","substring","getTime","filter","split","v","each","user","$shortFormat"],"mappings":"CAEA,WACE,YAMA,SAASA,KACP,GAAIC,GAAQC,IAEZA,MAAKC,YACLD,KAAKE,YAELF,KAAKG,gBAAkBL,EAAYM,WAAWC,MAAM,gBAAgBC,KAAK,SAASC,GAEhF,GAAIC,GAASC,EAAEC,OAAOD,EAAEE,IAAIJ,EAAKK,qBAAsB,SAASC,EAAOC,GACrE,MAAqB,KAAjBA,EAAIC,OAAO,IACL,IAAMD,EAAKD,IACbC,EAAKD,KA8Ef,OA3EAN,GAAKK,qBAAuBJ,EAG5BD,EAAKS,iBAAmBC,SAASV,EAAKS,mBAAqB,EAG3DT,EAAKW,+BAAiCD,SAASV,EAAKY,yBAA2B,EAE3EC,OAAOC,UAAYd,EAAKW,iCAE1BE,OAAOC,SAASC,OAAOC,sBAAwBhB,EAAKY,wBACpDC,OAAOC,SAASG,OAAO,8BAAgCjB,EAAKY,wBAA0B,UAMpFZ,EAAKkB,UACHlB,EAAKkB,SAASC,QAChBnB,EAAKkB,SAASC,QAAU,GAAIC,MAAuC,IAAlCV,SAASV,EAAKkB,SAASC,WAExDnB,EAAKkB,SAASG,eAAiB,EAC/BrB,EAAKkB,SAASC,QAAU,GAAIC,OAE1BpB,EAAKkB,SAASI,yBAA2BtB,EAAKkB,SAASI,wBAAwBC,OACjFvB,EAAKkB,SAASI,wBAA0BtB,EAAKkB,SAASI,wBAAwBE,KAAK,WAE5ExB,GAAKkB,SAASI,yBAEvBtB,EAAKkB,YAEHO,QAAQC,YAA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nil; c-basic-offset: 2 -*- */\n\n(function() {\n 'use strict';\n\n /**\n * @name Preferences\n * @constructor\n */\n function Preferences() {\n var _this = this;\n\n this.defaults = {};\n this.settings = {};\n\n this.defaultsPromise = Preferences.$$resource.fetch(\"jsonDefaults\").then(function(data) {\n // We swap $key -> _$key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)\n var labels = _.object(_.map(data.SOGoMailLabelsColors, function(value, key) {\n if (key.charAt(0) == '$')\n return ['_' + key, value];\n return [key, value];\n }));\n\n data.SOGoMailLabelsColors = labels;\n\n // Mail editor autosave is a number of minutes or 0 if disabled\n data.SOGoMailAutoSave = parseInt(data.SOGoMailAutoSave) || 0;\n\n // Specify a base font size for HTML messages when SOGoMailComposeFontSize is not zero\n data.SOGoMailComposeFontSizeEnabled = parseInt(data.SOGoMailComposeFontSize) > 0;\n\n if (window.CKEDITOR && data.SOGoMailComposeFontSizeEnabled) {\n // HTML editor is enabled; set user's preferred font size\n window.CKEDITOR.config.fontSize_defaultLabel = data.SOGoMailComposeFontSize;\n window.CKEDITOR.addCss('.cke_editable { font-size: ' + data.SOGoMailComposeFontSize + 'px; }');\n }\n\n // We convert our list of autoReplyEmailAddresses/forwardAddress into a string.\n // We also convert our date objects into real date, otherwise we'll have strings\n // or undefined values and the md-datepicker does NOT like this.\n if (data.Vacation) {\n if (data.Vacation.endDate)\n data.Vacation.endDate = new Date(parseInt(data.Vacation.endDate) * 1000);\n else {\n data.Vacation.endDateEnabled = 0;\n data.Vacation.endDate = new Date();\n }\n if (data.Vacation.autoReplyEmailAddresses && data.Vacation.autoReplyEmailAddresses.length)\n data.Vacation.autoReplyEmailAddresses = data.Vacation.autoReplyEmailAddresses.join(\",\");\n else\n delete data.Vacation.autoReplyEmailAddresses;\n } else\n data.Vacation = {};\n\n if (angular.isUndefined(data.Vacation.autoReplyEmailAddresses) &&\n angular.isDefined(window.defaultEmailAddresses))\n data.Vacation.autoReplyEmailAddresses = window.defaultEmailAddresses;\n\n if (angular.isUndefined(data.Vacation.daysBetweenResponse))\n data.Vacation.daysBetweenResponse = 7;\n\n if (angular.isUndefined(data.Vacation.endDate)) {\n data.Vacation.endDateEnabled = 0;\n data.Vacation.endDate = new Date();\n }\n\n if (data.Forward && data.Forward.forwardAddress)\n data.Forward.forwardAddress = data.Forward.forwardAddress.join(\",\");\n\n if (angular.isUndefined(data.SOGoCalendarCategoriesColors)) {\n data.SOGoCalendarCategoriesColors = {};\n data.SOGoCalendarCategories = [];\n }\n\n if (angular.isUndefined(data.SOGoContactsCategories))\n data.SOGoContactsCategories = [];\n\n angular.extend(_this.defaults, data);\n\n // Configure date locale\n _this.$mdDateLocaleProvider = Preferences.$mdDateLocaleProvider;\n angular.extend(_this.$mdDateLocaleProvider, data.locale);\n _this.$mdDateLocaleProvider.firstDayOfWeek = parseInt(data.SOGoFirstDayOfWeek);\n _this.$mdDateLocaleProvider.weekNumberFormatter = function(weekNumber) {\n return l('Week %d', weekNumber);\n };\n _this.$mdDateLocaleProvider.msgCalendar = l('Calender');\n _this.$mdDateLocaleProvider.msgOpenCalendar = l('Open Calendar');\n _this.$mdDateLocaleProvider.parseDate = function(dateString) {\n return dateString? dateString.parseDate(_this.$mdDateLocaleProvider, data.SOGoShortDateFormat) : new Date(NaN);\n };\n _this.$mdDateLocaleProvider.formatDate = function(date) {\n return date? date.format(_this.$mdDateLocaleProvider, data.SOGoShortDateFormat) : '';\n };\n _this.$mdDateLocaleProvider.formatTime = function(date) {\n return date? date.format(_this.$mdDateLocaleProvider, data.SOGoTimeFormat) : '';\n };\n\n return _this.defaults;\n });\n\n this.settingsPromise = Preferences.$$resource.fetch(\"jsonSettings\").then(function(data) {\n // We convert our PreventInvitationsWhitelist hash into a array of user\n if (data.Calendar) {\n if (data.Calendar.PreventInvitationsWhitelist)\n data.Calendar.PreventInvitationsWhitelist = _.map(data.Calendar.PreventInvitationsWhitelist, function(value, key) {\n var match = /^(.+)\\s<(\\S+)>$/.exec(value);\n return new Preferences.$User({uid: key, cn: match[1], c_email: match[2]});\n });\n else\n data.Calendar.PreventInvitationsWhitelist = [];\n }\n\n angular.extend(_this.settings, data);\n\n return _this.settings;\n });\n }\n\n /**\n * @memberof Preferences\n * @desc The factory we'll use to register with Angular\n * @returns the Preferences constructor\n */\n Preferences.$factory = ['$q', '$timeout', '$log', '$mdDateLocale', 'sgSettings', 'Resource', 'User', function($q, $timeout, $log, $mdDateLocaleProvider, Settings, Resource, User) {\n angular.extend(Preferences, {\n $q: $q,\n $timeout: $timeout,\n $log: $log,\n $mdDateLocaleProvider: $mdDateLocaleProvider,\n $$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),\n activeUser: Settings.activeUser(),\n $User: User\n });\n\n return new Preferences(); // return unique instance\n }];\n\n /* Initialize module if necessary */\n try {\n angular.module('SOGo.PreferencesUI');\n }\n catch(e) {\n angular.module('SOGo.PreferencesUI', ['SOGo.Common']);\n }\n\n /* Factory registration in Angular module */\n angular.module('SOGo.PreferencesUI')\n .factory('Preferences', Preferences.$factory);\n\n /**\n * @function ready\n * @memberof Preferences.prototype\n * @desc Combine promises used to load user's defaults and settings.\n * @return a combined promise\n */\n Preferences.prototype.ready = function() {\n return Preferences.$q.all([this.defaultsPromise, this.settingsPromise]);\n };\n\n /**\n * @function $save\n * @memberof Preferences.prototype\n * @desc Save the preferences to the server.\n */\n Preferences.prototype.$save = function() {\n var _this = this;\n\n return Preferences.$$resource.save(\"Preferences\", this.$omit(true))\n .then(function(data) {\n // Make a copy of the data for an eventual reset\n //_this.$shadowData = _this.$omit(true);\n return data;\n });\n };\n\n /**\n * @function $omit\n * @memberof Preferences.prototype\n * @desc Return a sanitized object used to send to the server.\n * @param {Boolean} [deep] - make a deep copy if true\n * @return an object literal copy of the Preferences instance\n */\n Preferences.prototype.$omit = function(deep) {\n var preferences, labels, whitelist;\n\n preferences = {};\n whitelist = {};\n\n angular.forEach(this, function(value, key) {\n if (key != 'constructor' && key[0] != '$') {\n if (deep)\n preferences[key] = angular.copy(value);\n else\n preferences[key] = value;\n }\n });\n\n // We swap _$key -> $key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)\n labels = _.object(_.map(preferences.defaults.SOGoMailLabelsColors, function(value, key) {\n if (key.charAt(0) == '_' && key.charAt(1) == '$') {\n // New key, let's take the value and flatten it\n if (key.length > 2 && key.charAt(2) == '$') {\n return [value[0].toLowerCase().replace(/[ \\(\\)\\/\\{%\\*<>\\\\\\\"]/g, \"_\"), value];\n }\n return [key.substring(1), value];\n }\n return [key, value];\n }));\n\n preferences.defaults.SOGoMailLabelsColors = labels;\n\n if (!preferences.defaults.SOGoMailComposeFontSizeEnabled)\n preferences.defaults.SOGoMailComposeFontSize = 0;\n delete preferences.defaults.SOGoMailComposeFontSizeEnabled;\n\n if (preferences.defaults.Vacation) {\n if (preferences.defaults.Vacation.endDateEnabled)\n preferences.defaults.Vacation.endDate = preferences.defaults.Vacation.endDate.getTime()/1000;\n else\n preferences.defaults.Vacation.endDate = 0;\n\n if (preferences.defaults.Vacation.autoReplyEmailAddresses)\n preferences.defaults.Vacation.autoReplyEmailAddresses = _.filter(preferences.defaults.Vacation.autoReplyEmailAddresses.split(\",\"), function(v) { return v.length; });\n else\n preferences.defaults.Vacation.autoReplyEmailAddresses = [];\n }\n\n if (preferences.defaults.Forward && preferences.defaults.Forward.forwardAddress)\n preferences.defaults.Forward.forwardAddress = preferences.defaults.Forward.forwardAddress.split(\",\");\n\n if (preferences.settings.Calendar && preferences.settings.Calendar.PreventInvitationsWhitelist) {\n _.each(preferences.settings.Calendar.PreventInvitationsWhitelist, function(user) {\n whitelist[user.uid] = user.$shortFormat();\n });\n preferences.settings.Calendar.PreventInvitationsWhitelist = whitelist;\n }\n\n return preferences;\n };\n\n})();\n"]} \ No newline at end of file