mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-07 03:19:44 +00:00
Monotone-Parent: 2338a6c35427b6ff10e22c3431c2efc72aea29d2
Monotone-Revision: b16d3e768a1190817b3b58f91b78ac06b1d30248 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-02-12T23:24:24 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
2010-02-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxCalMonthView.m (-currentDayId): new method.
|
||||
(-currentDayNumber): new method.
|
||||
|
||||
* UI/Scheduler/UIxCalDayTable.m (-currentHourId): new method.
|
||||
(-currentAllDayId): new method.
|
||||
(-currentDayId): new method.
|
||||
(-currentHourLineId): removed method because hourlines are no
|
||||
longer present in the template.
|
||||
(-currentDayNumber): new accessor, used in javascript to recover
|
||||
selection faster when the currently selected date is no longer
|
||||
available.
|
||||
|
||||
* UI/WebServerResources/SchedulerUIDnD.js (ScrollController.init):
|
||||
enhanced scrolling by setting a limit of 6 steps rather than 2.
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGo/SOGoDateFormatter.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
@@ -143,9 +144,9 @@
|
||||
return hoursToDisplay;
|
||||
}
|
||||
|
||||
- (NSString *) currentHourLineId
|
||||
- (NSString *) currentHourId
|
||||
{
|
||||
return [NSString stringWithFormat: @"hourLine%d", [currentTableHour intValue]];
|
||||
return [NSString stringWithFormat: @"hour%d", [currentTableHour intValue]];
|
||||
}
|
||||
|
||||
- (NSArray *) daysToDisplay
|
||||
@@ -200,6 +201,21 @@
|
||||
return formatted;
|
||||
}
|
||||
|
||||
- (NSString *) currentAllDayId
|
||||
{
|
||||
return [NSString stringWithFormat: @"allDay%@", [currentTableDay shortDateString]];
|
||||
}
|
||||
|
||||
- (NSString *) currentDayId
|
||||
{
|
||||
return [NSString stringWithFormat: @"day%@", [currentTableDay shortDateString]];
|
||||
}
|
||||
|
||||
- (int) currentDayNumber
|
||||
{
|
||||
return [daysToDisplay indexOfObject: currentTableDay];
|
||||
}
|
||||
|
||||
- (NSString *) currentAppointmentHour
|
||||
{
|
||||
return [NSString stringWithFormat: @"%.2d00", [currentTableHour intValue]];
|
||||
@@ -326,8 +342,6 @@
|
||||
[classes appendString: @" weekEndDay"];
|
||||
if ([currentTableDay isToday])
|
||||
[classes appendString: @" dayOfToday"];
|
||||
if ([[self selectedDate] isDateOnSameDay: currentTableDay])
|
||||
[classes appendString: @" selectedDay"];
|
||||
}
|
||||
|
||||
return classes;
|
||||
|
||||
@@ -214,6 +214,17 @@
|
||||
return currentTableDay;
|
||||
}
|
||||
|
||||
- (NSString *) currentDayId
|
||||
{
|
||||
return [NSString stringWithFormat: @"day%@", [currentTableDay shortDateString]];
|
||||
}
|
||||
|
||||
- (int) currentDayNumber
|
||||
{
|
||||
return ([currentWeek indexOfObject: currentTableDay]
|
||||
+ [weeksToDisplay indexOfObject: currentWeek] * 7);
|
||||
}
|
||||
|
||||
- (void) setCurrentWeek: (NSArray *) newCurrentWeek
|
||||
{
|
||||
ASSIGN (currentWeek, newCurrentWeek);
|
||||
@@ -298,8 +309,6 @@
|
||||
[classes appendString: @" dayOfAnotherMonth"];
|
||||
if ([currentTableDay isToday])
|
||||
[classes appendString: @" dayOfToday"];
|
||||
if ([selectedDate isDateOnSameDay: currentTableDay])
|
||||
[classes appendString: @" selectedDay"];
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
><var:foreach list="daysToDisplay" item="currentTableDay"
|
||||
><div var:class="dayClasses"
|
||||
var:day="currentTableDay.shortDateString"
|
||||
var:id="currentAllDayId"
|
||||
hour="allday"
|
||||
><!-- space --></div
|
||||
></var:foreach
|
||||
@@ -26,30 +27,26 @@
|
||||
</div>
|
||||
|
||||
<div id="daysView" var:class="daysViewClasses">
|
||||
<div class="hours">
|
||||
<var:foreach list="hoursToDisplay" item="currentTableHour"
|
||||
><div class="hour"><var:string value="currentTableHour" /></div
|
||||
></var:foreach>
|
||||
</div>
|
||||
|
||||
<div class="hourLines">
|
||||
<var:foreach list="hoursToDisplay" item="currentTableHour"
|
||||
><div var:id="currentHourLineId" const:class="hourLine"><!-- space --></div
|
||||
></var:foreach>
|
||||
<div class="hours"
|
||||
><var:foreach list="hoursToDisplay" item="currentTableHour"
|
||||
><div class="hour" var:id="currentHourId"
|
||||
><var:string value="currentTableHour"/></div
|
||||
></var:foreach>
|
||||
</div>
|
||||
|
||||
<div class="days">
|
||||
<var:foreach list="daysToDisplay" item="currentTableDay"
|
||||
><div var:class="dayClasses"
|
||||
var:day="currentTableDay.shortDateString"
|
||||
>
|
||||
<div class="events">
|
||||
var:id="currentDayId"
|
||||
var:day-number="currentDayNumber"
|
||||
var:day="currentTableDay.shortDateString">
|
||||
<div class="hourCells">
|
||||
<var:foreach list="hoursToDisplay" item="currentTableHour"
|
||||
><div var:class="clickableHourCellClass"
|
||||
var:day="currentTableDay.shortDateString"
|
||||
var:hour="currentAppointmentHour">
|
||||
</div></var:foreach>
|
||||
</div>
|
||||
</div></var:foreach></div>
|
||||
<div class="events"><!-- space --></div>
|
||||
</div>
|
||||
</var:foreach>
|
||||
</div>
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
><var:foreach list="currentWeek" item="currentTableDay"
|
||||
><div var:class="dayCellClasses"
|
||||
var:day="currentTableDay.shortDateString"
|
||||
var:day-number="currentDayNumber"
|
||||
var:id="currentDayId"
|
||||
><div class="dayHeader"><var:string value="dayHeaderNumber"/></div
|
||||
></div>
|
||||
</var:foreach>
|
||||
|
||||
@@ -512,16 +512,6 @@ DIV.monthView > DIV.headerDay
|
||||
font-weight: bold;
|
||||
background-color: #E7E7E7; }
|
||||
|
||||
DIV.dayOfToday
|
||||
{ background-color: #CCDDEC; }
|
||||
|
||||
DIV.dayOfToday DIV.outOfDay
|
||||
{ background-color: #d6dfe9; }
|
||||
|
||||
DIV.outOfDay, DIV.weekEndDay,
|
||||
DIV.weekEndDay DIV.outOfDay
|
||||
{ background-color: #E6E7E6; }
|
||||
|
||||
DIV.dayOfAnotherMonth
|
||||
{ background-color: #e7efef; }
|
||||
|
||||
@@ -549,12 +539,33 @@ DIV.monthView DIV.day
|
||||
overflow: auto;
|
||||
overflow-x: hidden; }
|
||||
|
||||
DIV.selectedDay,
|
||||
DIV.day DIV.clickableHourCell
|
||||
{ cursor: pointer;
|
||||
height: 39px;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ccc; }
|
||||
|
||||
DIV.day DIV.clickableHourCell.outOfDay,
|
||||
DIV#calendarHeader DIV.days DIV.weekEndDay,
|
||||
DIV.weekEndDay DIV.clickableHourCell,
|
||||
DIV.weekEndDay DIV.clickableHourCell.outOfDay
|
||||
{ background-color: #E6E7E6; }
|
||||
|
||||
DIV#calendarHeader DIV.days DIV.dayOfToday,
|
||||
DIV.dayOfToday DIV.clickableHourCell
|
||||
{ background-color: #ccddec; }
|
||||
|
||||
DIV.dayOfToday DIV.clickableHourCell.outOfDay
|
||||
{ background-color: #d6dfe9; }
|
||||
|
||||
DIV#calendarHeader DIV.days DIV.selectedDay,
|
||||
DIV#monthDaysView DIV.selectedDay,
|
||||
DIV.selectedDay DIV.clickableHourCell,
|
||||
DIV.selectedDay DIV.dayHeader
|
||||
{ background-color: #ffe79c; }
|
||||
|
||||
DIV.selectedDay.weekEndDay,
|
||||
DIV.selectedDay DIV.outOfDay
|
||||
DIV.selectedDay.weekEndDay DIV.clickableHourCell,
|
||||
DIV.selectedDay DIV.clickableHourCell.outOfDay
|
||||
{ background-color: #f5dd92; }
|
||||
|
||||
DIV.weekOf4
|
||||
@@ -658,32 +669,16 @@ DIV.monthView DIV.day6,
|
||||
DIV.daysViewFor7Days DIV.day6
|
||||
{ left: 85.7142%; }
|
||||
|
||||
DIV#daysView > DIV.hours
|
||||
{ position: absolute;
|
||||
DIV#daysView DIV.hour
|
||||
{ position: relative;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 45px;
|
||||
padding-top: 2px;
|
||||
padding-right: 2px;
|
||||
text-align: right;
|
||||
width: 48px;
|
||||
height: 37px;
|
||||
font-weight: bold;
|
||||
padding-top: 5px;
|
||||
padding-right: 5px;
|
||||
color: #666;
|
||||
text-align: right; }
|
||||
|
||||
DIV#daysView > DIV.hours > DIV.hour
|
||||
{ height: 40px; }
|
||||
|
||||
DIV#daysView > DIV.hourLines > DIV.hourLine
|
||||
{ position: relative;
|
||||
height: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
margin-top: 39px;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #ccc; }
|
||||
|
||||
DIV.clickableHourCell
|
||||
{ cursor: pointer;
|
||||
height: 39px;
|
||||
border-bottom: 1px solid #ccc; }
|
||||
|
||||
/* "left" and "width" for #daysView DIV.event are computed in JS code */
|
||||
|
||||
@@ -8,6 +8,8 @@ var selectedCalendarCell;
|
||||
var showCompletedTasks;
|
||||
|
||||
var currentDay = '';
|
||||
var selectedDayNumber = -1;
|
||||
var selectedDayDate = '';
|
||||
|
||||
var cachedDateSelectors = [];
|
||||
|
||||
@@ -659,6 +661,7 @@ function onSelectAll() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* in dateselector */
|
||||
function onDaySelect(node) {
|
||||
var day = node.getAttribute('day');
|
||||
var needRefresh = (listFilter == 'view_selectedday'
|
||||
@@ -677,6 +680,7 @@ function onDaySelect(node) {
|
||||
|
||||
changeCalendarDisplay( { "day": day } );
|
||||
currentDay = day;
|
||||
selectedDayDate = day;
|
||||
if (needRefresh)
|
||||
refreshEvents();
|
||||
|
||||
@@ -889,6 +893,7 @@ function tasksListCallback(http) {
|
||||
log ("tasksListCallback Ajax error");
|
||||
}
|
||||
|
||||
/* in dateselector */
|
||||
function restoreCurrentDaySelection(div) {
|
||||
var elements = $(div).select("TD.activeDay SPAN");
|
||||
if (elements.size()) {
|
||||
@@ -954,7 +959,6 @@ function changeCalendarDisplay(data, newView) {
|
||||
var url = ApplicationBaseURL + newView;
|
||||
var day = null;
|
||||
var scrollEvent = null;
|
||||
|
||||
if (data) {
|
||||
day = data['day'];
|
||||
scrollEvent = data['scrollEvent'];
|
||||
@@ -965,22 +969,10 @@ function changeCalendarDisplay(data, newView) {
|
||||
|
||||
if (day) {
|
||||
if (data) {
|
||||
var divs = $$('div.day[day='+day+']');
|
||||
if (divs.length) {
|
||||
var dayDiv = $("day"+day);
|
||||
if (dayDiv) {
|
||||
// Don't reload the view if the event is present in current view
|
||||
|
||||
// Deselect previous day
|
||||
var selectedDivs = $$('div.day.selectedDay');
|
||||
selectedDivs.each(function(div) {
|
||||
div.removeClassName('selectedDay');
|
||||
});
|
||||
|
||||
// Select new day
|
||||
if (currentView != 'dayview')
|
||||
divs.each(function(div) {
|
||||
div.addClassName('selectedDay');
|
||||
});
|
||||
|
||||
// Deselect day in date selector
|
||||
if (document.selectedDate)
|
||||
document.selectedDate.deselect();
|
||||
@@ -991,7 +983,8 @@ function changeCalendarDisplay(data, newView) {
|
||||
selectedCell = selectedLink[0].getParentWithTagName("td");
|
||||
$(selectedCell).selectElement();
|
||||
document.selectedDate = selectedCell;
|
||||
}
|
||||
} else
|
||||
document.selectedDate = null;
|
||||
|
||||
// Scroll to event
|
||||
if (scrollEvent) {
|
||||
@@ -999,6 +992,8 @@ function changeCalendarDisplay(data, newView) {
|
||||
scrollDayView(scrollEvent);
|
||||
}
|
||||
|
||||
setSelectedDayDate(day);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (day.length == 6) {
|
||||
@@ -1488,6 +1483,8 @@ function calendarDisplayCallback(http) {
|
||||
}
|
||||
attachDragControllers(contentView);
|
||||
|
||||
restoreSelectedDay();
|
||||
|
||||
refreshCalendarEvents(http.callbackData.scrollEvent);
|
||||
|
||||
var days = contentView.select("DIV.day");
|
||||
@@ -1790,13 +1787,9 @@ function onCalendarSelectEvent(event) {
|
||||
|
||||
function onCalendarSelectDay(event) {
|
||||
var day = this.getAttribute("day");
|
||||
var needRefresh = (listFilter == 'view_selectedday'
|
||||
&& day != currentDay);
|
||||
setSelectedDayDate(day);
|
||||
var needRefresh = (listFilter == 'view_selectedday' && day != currentDay);
|
||||
|
||||
if (currentView == 'weekview')
|
||||
changeWeekCalendarDisplayOfSelectedDay(this);
|
||||
else if (currentView == 'monthview')
|
||||
changeMonthCalendarDisplayOfSelectedDay(this);
|
||||
changeDateSelectorDisplay(day);
|
||||
|
||||
if (listOfSelection) {
|
||||
@@ -1810,55 +1803,53 @@ function onCalendarSelectDay(event) {
|
||||
changeCalendarDisplay( { "day": currentDay } );
|
||||
}
|
||||
|
||||
function changeWeekCalendarDisplayOfSelectedDay(node) {
|
||||
var daysView = $("daysView");
|
||||
var daysDiv = daysView.childNodesWithTag("div");
|
||||
for (var i = 0; i < daysDiv.length; i++) {
|
||||
if (daysDiv[i].hasClassName("days")) {
|
||||
var days = daysDiv[i].childNodesWithTag("div");
|
||||
var headerDiv = $($("calendarHeader").childNodesWithTag("div")[1]);
|
||||
var headerDays = headerDiv.childNodesWithTag("div");
|
||||
function setSelectedDayDate(dayDate) {
|
||||
if (selectedDayDate != dayDate) {
|
||||
var day = $("day" + selectedDayDate);
|
||||
if (day)
|
||||
day.removeClassName("selectedDay");
|
||||
var allDay = $("allDay" + selectedDayDate);
|
||||
if (allDay)
|
||||
allDay.removeClassName("selectedDay");
|
||||
|
||||
for (var j = 0; j < days.length; j++) {
|
||||
if (days[j] == node
|
||||
|| headerDays[j] == node) {
|
||||
headerDays[j].addClassName("selectedDay");
|
||||
days[j].addClassName("selectedDay");
|
||||
}
|
||||
else {
|
||||
headerDays[j].removeClassName("selectedDay");
|
||||
days[j].removeClassName("selectedDay");
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedDayDate = dayDate;
|
||||
|
||||
day = $("day" + selectedDayDate);
|
||||
day.addClassName("selectedDay");
|
||||
selectedDayNumber = day.readAttribute("day-number");
|
||||
allDay = $("allDay" + selectedDayDate);
|
||||
if (allDay)
|
||||
allDay.addClassName("selectedDay");
|
||||
}
|
||||
}
|
||||
|
||||
function findMonthCalendarSelectedCell(daysContainer) {
|
||||
var found = false;
|
||||
var i = 0;
|
||||
|
||||
while (!found && i < daysContainer.childNodes.length) {
|
||||
var currentNode = daysContainer.childNodes[i];
|
||||
if (currentNode.tagName == 'DIV'
|
||||
&& currentNode.hasClassName("selectedDay")) {
|
||||
daysContainer.selectedCell = currentNode;
|
||||
found = true;
|
||||
}
|
||||
/* after loading a new view, to reselect the currently selected day */
|
||||
function restoreSelectedDay() {
|
||||
var day = null;
|
||||
if (selectedDayDate.length > 0)
|
||||
day = $("day" + selectedDayDate);
|
||||
if (!day) {
|
||||
if (selectedDayNumber > -1)
|
||||
selectedDayDate = findDateFromDayNumber(selectedDayNumber);
|
||||
else
|
||||
i++;
|
||||
selectedDayDate = currentDay;
|
||||
if (selectedDayDate.length > 0)
|
||||
day = $("day" + selectedDayDate);
|
||||
}
|
||||
if (day) {
|
||||
selectedDayDate = null;
|
||||
setSelectedDayDate(day.id.substr(3));
|
||||
}
|
||||
}
|
||||
|
||||
function changeMonthCalendarDisplayOfSelectedDay(node) {
|
||||
var daysContainer = node.parentNode;
|
||||
if (!daysContainer.selectedCell)
|
||||
findMonthCalendarSelectedCell(daysContainer);
|
||||
|
||||
if (daysContainer.selectedCell)
|
||||
daysContainer.selectedCell.removeClassName("selectedDay");
|
||||
daysContainer.selectedCell = node;
|
||||
node.addClassName("selectedDay");
|
||||
function findDateFromDayNumber(dayNumber) {
|
||||
var view;
|
||||
if (currentView == "monthview")
|
||||
view = $("monthDaysView");
|
||||
else
|
||||
view = $("daysView");
|
||||
var days = view.select(".day");
|
||||
return days[dayNumber].readAttribute("day");
|
||||
}
|
||||
|
||||
function onShowCompletedTasks(event) {
|
||||
|
||||
@@ -112,10 +112,10 @@ _SOGoEventDragUtilities.prototype = {
|
||||
|
||||
getQuarterHeight: function() {
|
||||
if (this.quarterHeight == -1) {
|
||||
var hourLine0 = $("hourLine0");
|
||||
var hourLine23 = $("hourLine23");
|
||||
this.quarterHeight = ((hourLine23.offsetTop - hourLine0.offsetTop)
|
||||
/ (23 * 4));
|
||||
var hour0 = $("hour0");
|
||||
var hour23 = $("hour23");
|
||||
this.quarterHeight = ((hour23.offsetTop - hour0.offsetTop)
|
||||
/ (23 * 4));
|
||||
}
|
||||
|
||||
return this.quarterHeight;
|
||||
@@ -909,8 +909,9 @@ SOGoEventDragController.prototype = {
|
||||
|
||||
dropCallback: null,
|
||||
|
||||
onDragStartBound: null,
|
||||
onDragStopBound: null,
|
||||
moveBound: null,
|
||||
onDragModeBound: null,
|
||||
|
||||
_determineDragMode: null,
|
||||
|
||||
@@ -924,10 +925,9 @@ SOGoEventDragController.prototype = {
|
||||
this.ghostController.setTitle(this.title);
|
||||
this.ghostController.setFolderClass(this.folderClass);
|
||||
|
||||
var onDragStartBound = this.onDragStart.bindAsEventListener(this);
|
||||
this.onDragStartBound = this.onDragStart.bindAsEventListener(this);
|
||||
for (var i = 0; i < eventCells.length; i++) {
|
||||
eventCells[i].observe("mousedown", onDragStartBound,
|
||||
false);
|
||||
eventCells[i].observe("mousedown", this.onDragStartBound, false);
|
||||
if (eventCells[i].editable) {
|
||||
eventCells[i].addClassName("draggable");
|
||||
}
|
||||
@@ -958,9 +958,8 @@ SOGoEventDragController.prototype = {
|
||||
this.ghostController = new SOGoEventDragGhostController();
|
||||
this.ghostController.setTitle(getLabel("New Event"));
|
||||
|
||||
var onDragStartBound
|
||||
= this.onDragStart.bindAsEventListener(this);
|
||||
dayNode.observe("mousedown", onDragStartBound, false);
|
||||
this.onDragStartBound = this.onDragStart.bindAsEventListener(this);
|
||||
dayNode.observe("mousedown", this.onDragStartBound, false);
|
||||
},
|
||||
|
||||
onDragStart: function SEDC_onDragStart(event) {
|
||||
@@ -971,7 +970,6 @@ SOGoEventDragController.prototype = {
|
||||
|| target.hasClassName("day"))
|
||||
|| (this.eventCells && this.eventCells[0].editable))) {
|
||||
var utilities = SOGoEventDragUtilities();
|
||||
utilities.reset();
|
||||
utilities.setEventType(this.eventType);
|
||||
|
||||
this.pointerHandler = new SOGoEventDragPointerHandler();
|
||||
@@ -1013,8 +1011,8 @@ SOGoEventDragController.prototype = {
|
||||
Event.observe(window, "mouseup", this.onDragStopBound);
|
||||
this.onDragModeBound = this.onDragMode.bindAsEventListener(this);
|
||||
Event.observe(document.body, "mousemove", this.onDragModeBound);
|
||||
Event.stop(event);
|
||||
}
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1214,6 +1212,7 @@ SOGoEventDragController.prototype = {
|
||||
this.onDragStopBound = null;
|
||||
this.onDragModeBound = null;
|
||||
|
||||
var utilities = SOGoEventDragUtilities();
|
||||
if (this.dragHasStarted) {
|
||||
this.ghostController.hideGhosts();
|
||||
this.dragHasStarted = false;
|
||||
@@ -1229,7 +1228,6 @@ SOGoEventDragController.prototype = {
|
||||
.originalCoordinates);
|
||||
this.updateDropCallback(this, this.eventCells, delta);
|
||||
} else {
|
||||
var utilities = SOGoEventDragUtilities();
|
||||
var eventContainerNodes = utilities.getEventContainerNodes();
|
||||
var dayNode = eventContainerNodes[this.ghostController
|
||||
.currentCoordinates
|
||||
@@ -1241,6 +1239,7 @@ SOGoEventDragController.prototype = {
|
||||
this.ghostController.currentCoordinates);
|
||||
}
|
||||
}
|
||||
utilities.reset();
|
||||
|
||||
Event.stop(event);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user