Changed the configurable variable SOGoMailMessageCheck to a general refresh associated to the current view

This commit is contained in:
Alexandre Cloutier
2014-08-29 13:16:30 -04:00
parent 126a05d391
commit d62c504763
37 changed files with 316 additions and 267 deletions

View File

@@ -35,6 +35,7 @@ var categoriesStyleSheet = null;
var clipboard = null;
var eventsToCopy = [];
var refreshViewCheckTimer;
// This should probably go in the generic.js
function printView() {
@@ -1440,6 +1441,26 @@ function refreshEventsAndTasks() {
refreshTasks();
}
function initRefreshViewCheckTimer() {
var refreshViewCheck = UserDefaults["SOGoRefreshViewCheck"];
if (refreshViewCheck && refreshViewCheck != "manually") {
var interval;
if (refreshViewCheck == "once_per_hour")
interval = 3600;
else if (refreshViewCheck == "every_minute")
interval = 60;
else {
interval = parseInt(refreshViewCheck.substr(6)) * 60;
}
refreshViewCheckTimer = window.setInterval(onRefreshViewCheckCallback,
interval * 1000);
}
}
function onRefreshViewCheckCallback(event) {
onCalendarReload();
}
function onCalendarReload() {
if (!reloadWebCalendars()) {
refreshEventsAndTasks();
@@ -3887,6 +3908,7 @@ function initScheduler() {
$("calendarView").on("click", "#listCollapse", onListCollapse);
Event.observe(document, "keydown", onDocumentKeydown);
}
initRefreshViewCheckTimer()
onWindowResize.defer();
Event.observe(window, "resize", onWindowResize);