mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 04:15:26 +00:00
(js) Move Settings to a value in Common ng module
Also removed explicit settings and defaults that were imported in various app modules. We now always use the Preferences ng service.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<container xmlns="http://www.w3.org/1999/xhtml" xmlns:var="http://www.skyrix.com/od/binding" xmlns:const="http://www.skyrix.com/od/constant" xmlns:label="OGo:label">
|
||||
|
||||
<container
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:label="OGo:label">
|
||||
|
||||
<md-content md-scroll-y="true" class="md-padding md-whiteframe-z1 bg-sogoPaper-50">
|
||||
<div class="editor md-padding">
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
const:userDefaultsKeys="SOGoContactsCategories"
|
||||
const:jsFiles="Common.js, Preferences.services.js, Contacts.js, Contacts.services.js"
|
||||
className="UIxPageFrame"
|
||||
title="name">
|
||||
title="title"
|
||||
const:userDefaultsKeys="SOGoContactsCategories"
|
||||
const:jsFiles="Common.js, Preferences.services.js, Contacts.js, Contacts.services.js">
|
||||
<script type="text/javascript">
|
||||
var contactFolders = <var:string value="contactFolders" const:escapeHTML="NO" />;
|
||||
</script>
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
className="UIxPageFrame"
|
||||
title="title"
|
||||
const:userDefaultsKeys="SOGoMailMessageCheck,SOGoRefreshViewCheck,SOGoMailSortByThreads,SOGoMailListViewColumnsOrder,SOGoMailDisplayRemoteInlineImages,SOGoMailComposeMessageType,SOGoMailReplyPlacement,SOGoMailLabelsColors"
|
||||
const:userSettingsKeys="Mail"
|
||||
const:jsFiles="Common.js, Contacts.services.js, Mailer.services.js, Preferences.services.js, Mailer.js, Mailer.services.js, vendor/ckeditor/ckeditor.js, vendor/ckeditor/ck.js, vendor/angular-file-upload.js">
|
||||
<script type="text/javascript">
|
||||
var mailAccounts =<var:string value="mailAccounts" const:escapeHTML="NO" />;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
const:jsFiles="Main.app.js, Common.js"
|
||||
const:popup="YES"
|
||||
>
|
||||
<!--
|
||||
MAIN CONTENT ROW
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:uix="OGo:uix"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
className="UIxPageFrame"
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<!DOCTYPE var:component>
|
||||
<var:component xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:uix="OGo:uix"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
className="UIxPageFrame"
|
||||
title="title"
|
||||
const:userDefaultsKeys="SOGoRefreshViewCheck, SOGoCalendarCategoriesColors, SOGoDefaultCalendar, SOGoTimeFormat"
|
||||
const:userSettingsKeys="Calendar, ShowCompletedTasks"
|
||||
const:jsFiles="Common.js, Preferences.services.js, Contacts.services.js, Mailer.services.js, Scheduler.js, Scheduler.services.js">
|
||||
<var:component
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
className="UIxPageFrame"
|
||||
title="title"
|
||||
const:jsFiles="Common.js, Preferences.services.js, Contacts.services.js, Mailer.services.js, Scheduler.js, Scheduler.services.js">
|
||||
<script type="text/javascript">
|
||||
var firstDayOfWeek = <var:string value="firstDayOfWeek"/>;
|
||||
var dayStartHour = <var:string value="dayStartHour"/>;
|
||||
@@ -176,8 +174,8 @@
|
||||
<p class="sg-item-name">{{calendar.name}}</p>
|
||||
<md-menu class="md-secondary" label:aria-label="Options">
|
||||
<md-icon label:aria-label="Options"
|
||||
ng-click="$mdOpenMenu()"
|
||||
md-menu-origin="md-menu-origin">more_vert</md-icon>
|
||||
ng-click="$mdOpenMenu()"
|
||||
md-menu-origin="md-menu-origin">more_vert</md-icon>
|
||||
<md-menu-content width="2">
|
||||
<md-menu-item>
|
||||
<md-button ng-click="calendars.confirmDelete(calendar)">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
angular.extend(Acl, {
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL, Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),
|
||||
$User: User
|
||||
});
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
function AlarmService($timeout, Settings, Resource, $mdToast) {
|
||||
angular.extend(Alarm, {
|
||||
$timeout: $timeout,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL + 'Calendar', Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Calendar', Settings.activeUser()),
|
||||
$toast: $mdToast
|
||||
});
|
||||
|
||||
|
||||
@@ -4,14 +4,22 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.Common', ['ngMaterial'])
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
activeUser: {
|
||||
login: UserLogin,
|
||||
identification: UserIdentification,
|
||||
language: UserLanguage,
|
||||
folderURL: UserFolderURL,
|
||||
isSuperUser: IsSuperUser
|
||||
.value('sgSettings', {
|
||||
baseURL: function() {
|
||||
return ApplicationBaseURL || null;
|
||||
},
|
||||
activeUser: function(param) {
|
||||
var settings = {
|
||||
login: UserLogin || null,
|
||||
identification: UserIdentification || null,
|
||||
language: UserLanguage || null,
|
||||
folderURL: UserFolderURL || null,
|
||||
isSuperUser: IsSuperUser || null
|
||||
};
|
||||
if (param)
|
||||
return settings[param];
|
||||
else
|
||||
return settings;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
angular.extend(User, {
|
||||
$q: $q,
|
||||
$log: $log,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL, Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),
|
||||
$gravatar: Gravatar
|
||||
});
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
navController.$inject = ['$scope', '$timeout', '$interval', '$http', '$mdSidenav', '$mdBottomSheet', '$mdMedia', '$log', 'sgConstant', 'sgSettings', 'Alarm'];
|
||||
function navController($scope, $timeout, $interval, $http, $mdSidenav, $mdBottomSheet, $mdMedia, $log, sgConstant, sgSettings, Alarm) {
|
||||
|
||||
$scope.activeUser = sgSettings.activeUser;
|
||||
$scope.activeUser = sgSettings.activeUser();
|
||||
|
||||
// Show current day in top bar
|
||||
$scope.currentDay = window.currentDay;
|
||||
@@ -23,7 +23,7 @@
|
||||
$scope.currentDay = data;
|
||||
});
|
||||
}, 24 * 3600 * 1000);
|
||||
}, window.secondsBeforeTomorrow * 1000);
|
||||
}, window.currentDay.secondsBeforeTomorrow * 1000);
|
||||
|
||||
$scope.toggleLeft = function () {
|
||||
$mdSidenav('left').toggle()
|
||||
|
||||
@@ -5,19 +5,8 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'SOGo.Common', 'SOGo.PreferencesUI'])
|
||||
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
activeUser: {
|
||||
login: UserLogin,
|
||||
identification: UserIdentification,
|
||||
language: UserLanguage,
|
||||
folderURL: UserFolderURL,
|
||||
isSuperUser: IsSuperUser
|
||||
}
|
||||
})
|
||||
|
||||
.config(configure);
|
||||
.config(configure)
|
||||
.run(runBlock);
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
@@ -138,4 +127,14 @@
|
||||
return stateAddressbook.$getCard($stateParams.cardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
runBlock.$inject = ['$rootScope'];
|
||||
function runBlock($rootScope) {
|
||||
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
|
||||
console.error(event, current, previous, rejection);
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL + 'Contacts', Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Contacts', Settings.activeUser()),
|
||||
$Card: Card,
|
||||
$$Acl: Acl,
|
||||
$Preferences: Preferences,
|
||||
|
||||
@@ -38,12 +38,17 @@
|
||||
* @desc The factory we'll use to register with Angular.
|
||||
* @returns the Card constructor
|
||||
*/
|
||||
Card.$factory = ['$timeout', 'sgSettings', 'Resource', 'Gravatar', function($timeout, Settings, Resource, Gravatar) {
|
||||
Card.$factory = ['$timeout', 'sgSettings', 'Resource', 'Preferences', 'Gravatar', function($timeout, Settings, Resource, Preferences, Gravatar) {
|
||||
angular.extend(Card, {
|
||||
$$resource: new Resource(Settings.activeUser.folderURL + 'Contacts', Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Contacts', Settings.activeUser()),
|
||||
$timeout: $timeout,
|
||||
$gravatar: Gravatar,
|
||||
$categories: window.UserDefaults.SOGoContactsCategories
|
||||
$gravatar: Gravatar
|
||||
});
|
||||
// Initialize categories from user's defaults
|
||||
Preferences.ready().then(function() {
|
||||
if (Preferences.defaults.SOGoContactsCategories) {
|
||||
Card.$categories = Preferences.defaults.SOGoContactsCategories;
|
||||
}
|
||||
});
|
||||
|
||||
return Card; // return constructor
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$$resource: new Resource(Settings.baseURL, Settings.activeUser),
|
||||
$$resource: new Resource(Settings.baseURL(), Settings.activeUser()),
|
||||
$Mailbox: Mailbox,
|
||||
$Message: Message
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL + 'Mail', Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Mail', Settings.activeUser()),
|
||||
$Message: Message,
|
||||
$$Acl: Acl,
|
||||
$Preferences: Preferences,
|
||||
|
||||
@@ -35,18 +35,20 @@
|
||||
* @desc The factory we'll use to register with Angular
|
||||
* @returns the Message constructor
|
||||
*/
|
||||
Message.$factory = ['$q', '$timeout', '$log', '$sce', 'sgSettings', 'Resource', function($q, $timeout, $log, $sce, Settings, Resource) {
|
||||
Message.$factory = ['$q', '$timeout', '$log', '$sce', 'sgSettings', 'Resource', 'Preferences', function($q, $timeout, $log, $sce, Settings, Resource, Preferences) {
|
||||
angular.extend(Message, {
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$sce: $sce,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL + 'Mail', Settings.activeUser)
|
||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Mail', Settings.activeUser())
|
||||
});
|
||||
// Initialize tags form user's defaults
|
||||
Preferences.ready().then(function() {
|
||||
if (Preferences.defaults.SOGoMailLabelsColors) {
|
||||
Message.$tags = Preferences.defaults.SOGoMailLabelsColors;
|
||||
}
|
||||
});
|
||||
|
||||
if (window.UserDefaults && window.UserDefaults.SOGoMailLabelsColors) {
|
||||
Message.$tags = window.UserDefaults.SOGoMailLabelsColors;
|
||||
}
|
||||
|
||||
return Message; // return constructor
|
||||
}];
|
||||
|
||||
@@ -4,22 +4,9 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.ContactsUI', []);
|
||||
angular.module('SOGo.MailerUI', []);
|
||||
|
||||
angular.module('SOGo.PreferencesUI', ['ngSanitize', 'ui.router', 'SOGo.Common', 'SOGo.MailerUI', 'SOGo.ContactsUI', 'SOGo.Authentication'])
|
||||
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
activeUser: {
|
||||
login: UserLogin,
|
||||
identification: UserIdentification,
|
||||
language: UserLanguage,
|
||||
folderURL: UserFolderURL,
|
||||
isSuperUser: IsSuperUser
|
||||
}
|
||||
})
|
||||
.config(configure);
|
||||
.config(configure)
|
||||
.run(runBlock);
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
@@ -84,5 +71,15 @@
|
||||
function statePreferences(Preferences) {
|
||||
return Preferences;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
runBlock.$inject = ['$rootScope'];
|
||||
function runBlock($rootScope) {
|
||||
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
|
||||
console.error(event, current, previous, rejection);
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL, Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),
|
||||
activeUser: Settings.activeUser,
|
||||
$User: User
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
$q: $q,
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$$resource: new Resource(Settings.activeUser.folderURL + 'Calendar', Settings.activeUser),
|
||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Calendar', Settings.activeUser()),
|
||||
$Component: Component,
|
||||
$$Acl: Acl,
|
||||
activeUser: Settings.activeUser
|
||||
|
||||
@@ -38,24 +38,26 @@
|
||||
$log: $log,
|
||||
$Preferences: Preferences,
|
||||
$gravatar: Gravatar,
|
||||
$$resource: new Resource(Settings.baseURL, Settings.activeUser),
|
||||
$categories: window.UserDefaults.SOGoCalendarCategoriesColors,
|
||||
$$resource: new Resource(Settings.baseURL(), Settings.activeUser()),
|
||||
timeFormat: "%H:%M",
|
||||
// Filter parameters common to events and tasks
|
||||
$query: { value: '', search: 'title_Category_Location' },
|
||||
// Filter paramaters specific to events
|
||||
$queryEvents: { sort: 'start', asc: 1, filterpopup: 'view_next7' },
|
||||
// Filter parameters specific to tasks
|
||||
$queryTasks: { sort: 'status', asc: 1, filterpopup: 'view_incomplete' }
|
||||
$queryTasks: { sort: 'status', asc: 1, filterpopup: 'view_next7' } //'view_incomplete' }
|
||||
});
|
||||
// Initialize filter parameters from user's settings
|
||||
Preferences.ready().then(function() {
|
||||
// Initialize filter parameters from user's settings
|
||||
Component.$queryEvents.filterpopup = Preferences.settings.CalendarDefaultFilter;
|
||||
Component.$queryTasks.show_completed = parseInt(Preferences.settings.ShowCompletedTasks);
|
||||
// Initialize categories from user's defaults
|
||||
Component.$categories = Preferences.defaults.SOGoCalendarCategoriesColors;
|
||||
// Initialize time format from user's defaults
|
||||
if (Preferences.defaults.SOGoTimeFormat) {
|
||||
Component.timeFormat = Preferences.defaults.SOGoTimeFormat;
|
||||
}
|
||||
});
|
||||
if (window.UserDefaults && window.UserDefaults.SOGoTimeFormat)
|
||||
Component.timeFormat = window.UserDefaults.SOGoTimeFormat;
|
||||
else
|
||||
Component.timeFormat = "%H:%M";
|
||||
|
||||
return Component; // return constructor
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user