Fix scrolling issues and useless Ajax calls in Calendar web view

Monotone-Parent: fa7d871f17a70530eb91cb1db11d03a8fa643108
Monotone-Revision: a8698cc119066cef660b176c3e956b5d0d843e7f

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-08-27T16:51:30
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2009-08-27 16:51:30 +00:00
parent 4803ab33b9
commit a38722d9cb
1 changed files with 12 additions and 18 deletions

View File

@ -562,7 +562,6 @@ function dateSelectorCallback(http) {
var content = http.responseText;
setDateSelectorContent(content);
cachedDateSelectors[http.callbackData] = content;
changeCalendarDisplay( { "day": currentDay } );
}
else
log ("dateSelectorCallback Ajax error");
@ -822,7 +821,8 @@ function changeCalendarDisplay(data, newView) {
}
// Scroll to event
scrollDayView(scrollEvent);
if (scrollEvent)
scrollDayView(scrollEvent);
return false;
}
@ -916,19 +916,17 @@ function refreshCalendarEvents(scrollEvent) {
var todayDate = new Date();
var sd;
var ed;
if (!currentDay)
currentDay = todayDate.getDayString();
if (currentView == "dayview") {
if (currentDay)
sd = currentDay;
else
sd = todayDate.getDayString();
sd = currentDay;
ed = sd;
}
else if (currentView == "weekview") {
var startDate;
if (currentDay)
startDate = currentDay.asDate();
else
startDate = todayDate;
startDate = currentDay.asDate();
startDate = startDate.beginOfWeek();
sd = startDate.getDayString();
var endDate = new Date();
@ -938,10 +936,7 @@ function refreshCalendarEvents(scrollEvent) {
}
else {
var monthDate;
if (currentDay)
monthDate = currentDay.asDate();
else
monthDate = todayDate;
monthDate = currentDay.asDate();
monthDate.setDate(1);
sd = monthDate.beginOfWeek().getDayString();
@ -1155,12 +1150,11 @@ function calendarDisplayCallback(http) {
var daysView = $("daysView");
var position = -1;
// Check the previous view to restore the scrolling position
if (daysView)
position = daysView.scrollTop;
if (position != -1)
preventAutoScroll = true;
preventAutoScroll = (position != -1);
if (http.readyState == 4
&& http.status == 200) {
document.dayDisplayAjaxRequest = null;