sogo/UI/WebServerResources/js/Preferences.services.js.map
2016-11-01 01:20:13 -04:00

1 line
18 KiB
Plaintext

{"version":3,"sources":["Preferences/Preferences.service.js"],"names":["Preferences","_this","this","defaults","settings","defaultsPromise","$$resource","fetch","then","response","data","labels","_","fromPairs","map","SOGoMailLabelsColors","value","key","charAt","SOGoRememberLastModule","SOGoLoginModule","SOGoMailAutoSave","parseInt","SOGoMailComposeFontSizeEnabled","SOGoMailComposeFontSize","window","CKEDITOR","config","fontSize_defaultLabel","addCss","Vacation","startDate","Date","startDateEnabled","beginOfDay","addDays","endDate","endDateEnabled","getTime","autoReplyEmailAddresses","length","join","angular","isUndefined","isDefined","defaultEmailAddresses","daysBetweenResponse","Forward","forwardAddress","SOGoCalendarCategoriesColors","SOGoCalendarCategories","SOGoContactsCategories","extend","$mdDateLocaleProvider","locale","firstDayOfWeek","SOGoFirstDayOfWeek","firstWeekOfYear","SOGoFirstWeekOfYear","weekNumberFormatter","weekNumber","l","msgCalendar","msgOpenCalendar","parseDate","dateString","SOGoShortDateFormat","NaN","formatDate","date","format","$dateFormat","parseTime","timeString","SOGoTimeFormat","formatTime","settingsPromise","Calendar","PreventInvitationsWhitelist","match","exec","user","$User","uid","cn","c_email","$$image","avatar","no_404","url","$factory","$q","$timeout","$log","Settings","Gravatar","Resource","User","$gravatar","activeUser","$resourcesURL","resourcesURL","module","e","factory","prototype","ready","all","email","size","options","alternate_avatar","SOGoAlternateAvatar","SOGoGravatarEnabled","dstObject","dstAttr","$save","save","$omit","deep","preferences","whitelist","forEach","copy","toLowerCase","replace","substring","filter","split","v","$shortFormat"],"mappings":"CAEA,WACE,YAMA,SAASA,KACP,GAAIC,GAAQC,IAEZA,MAAKC,YACLD,KAAKE,YAELF,KAAKG,gBAAkBL,EAAYM,WAAWC,MAAM,gBAAgBC,KAAK,SAASC,GAChF,GAAIC,GAAOD,MAGPE,EAASC,EAAEC,UAAUD,EAAEE,IAAIJ,EAAKK,qBAAsB,SAASC,EAAOC,GACxE,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CuF,EAAYrH,SAAS2B,SAASC,UAAYyF,EAAYrH,SAAS2B,SAASC,UAAUO,UAAU,IAE5FkF,EAAYrH,SAAS2B,SAASC,UAAY,EACxCyF,EAAYrH,SAAS2B,SAASO,eAChCmF,EAAYrH,SAAS2B,SAASM,QAAUoF,EAAYrH,SAAS2B,SAASM,QAAQE,UAAU,IAExFkF,EAAYrH,SAAS2B,SAASM,QAAU,EAEtCoF,EAAYrH,SAAS2B,SAASS,wBAChCiF,EAAYrH,SAAS2B,SAASS,wBAA0B3B,EAAEmH,OAAOP,EAAYrH,SAAS2B,SAASS,wBAAwByF,MAAM,KAAM,SAASC,GAAK,MAAOA,GAAEzF,SAE1JgF,EAAYrH,SAAS2B,SAASS,4BAG9BiF,EAAYrH,SAAS4C,SAAWyE,EAAYrH,SAAS4C,QAAQC,iBAC/DwE,EAAYrH,SAAS4C,QAAQC,eAAiBwE,EAAYrH,SAAS4C,QAAQC,eAAegF,MAAM,MAE9FR,EAAYpH,SAASyE,UAAY2C,EAAYpH,SAASyE,SAASC,8BACjElE,EAAE8G,QAAQF,EAAYpH,SAASyE,SAASC,4BAA6B,SAASG,GAC5EwC,EAAUxC,EAAKE,KAAOF,EAAKiD,iBAE7BV,EAAYpH,SAASyE,SAASC,4BAA8B2C,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(response) {\n var data = response || {};\n\n // We swap $key -> _$key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)\n var labels = _.fromPairs(_.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 if (data.SOGoRememberLastModule)\n data.SOGoLoginModule = \"Last\";\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.startDate)\n data.Vacation.startDate = new Date(parseInt(data.Vacation.startDate) * 1000);\n else {\n data.Vacation.startDateEnabled = 0;\n data.Vacation.startDate = new Date();\n data.Vacation.startDate = data.Vacation.startDate.beginOfDay();\n data.Vacation.startDate.addDays(1);\n }\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(data.Vacation.startDate.getTime());\n data.Vacation.endDate.addDays(1);\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.startDate)) {\n data.Vacation.startDateEnabled = 0;\n data.Vacation.startDate = new Date();\n }\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 angular.extend(_this.$mdDateLocaleProvider, {\n firstDayOfWeek: data.SOGoFirstDayOfWeek,\n firstWeekOfYear: data.SOGoFirstWeekOfYear\n });\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, date.$dateFormat || data.SOGoShortDateFormat) : '';\n };\n _this.$mdDateLocaleProvider.parseTime = function(timeString) {\n return timeString? timeString.parseDate(_this.$mdDateLocaleProvider, data.SOGoTimeFormat) : new Date(NaN);\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 user = new Preferences.$User({uid: key, cn: match[1], c_email: match[2]});\n if (!user.$$image)\n _this.avatar(user.c_email, 32, {no_404: true}).then(function(url) {\n user.$$image = url;\n });\n return user;\n });\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', 'Gravatar', 'Resource', 'User', function($q, $timeout, $log, $mdDateLocaleProvider, Settings, Gravatar, Resource, User) {\n angular.extend(Preferences, {\n $q: $q,\n $timeout: $timeout,\n $log: $log,\n $mdDateLocaleProvider: $mdDateLocaleProvider,\n $gravatar: Gravatar,\n $$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),\n $resourcesURL: Settings.resourcesURL(),\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 avatar\n * @memberof Preferences.prototype\n * @desc Get the avatar URL associated to an email address\n * @return a combined promise\n */\n Preferences.prototype.avatar = function(email, size, options) {\n var _this = this;\n return this.ready().then(function() {\n var alternate_avatar = _this.defaults.SOGoAlternateAvatar, url;\n if (_this.defaults.SOGoGravatarEnabled)\n url = Preferences.$gravatar(email, size, alternate_avatar, options);\n else\n url = [Preferences.$resourcesURL, 'img', 'ic_person_grey_24px.svg'].join('/');\n if (options && options.dstObject && options.dstAttr)\n options.dstObject[options.dstAttr] = url;\n return url;\n });\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 = _.fromPairs(_.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.startDateEnabled)\n preferences.defaults.Vacation.startDate = preferences.defaults.Vacation.startDate.getTime()/1000;\n else\n preferences.defaults.Vacation.startDate = 0;\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 _.forEach(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"]}