Fix issues with contextual menu in calendars

Creating an event or a task using the contextual menu will now consider
the day and hour of the menu position (fixes #2557).
The next/previous day/month menu options have been fixed.
The menu will now disappear when clicking outside the contextual menu on
the calendar area.
pull/17/head
Francis Lachapelle 2014-01-28 15:36:48 -05:00
parent 9580a8f8ee
commit 342ad84a24
7 changed files with 31 additions and 19 deletions

1
NEWS
View File

@ -24,6 +24,7 @@ Bug fixes
- don't load 'background' attribute (#2437)
- fixed validation of subscribed folders (#2583)
- fixed display of folder names in messages filter editor (#2569)
- fixed contextual menu of the current calendar view (#2557)
2.1.1b (2013-12-04)
-------------------

View File

@ -22,12 +22,14 @@
<span class="daysHeader">
<span class="day1">
<a href="#"
id="leftNavigationArrow"
var:date="prevDayQueryParameters.day"
onclick="return onCalendarGotoDay(this);"><img rsrc:src="arrow-left.png"/></a>
</span>
<span class="day0"><var:string value="currentDayName"/></span>
<span class="day1">
<a href="#"
id="rightNavigationArrow"
var:date="nextDayQueryParameters.day"
onclick="return onCalendarGotoDay(this);"><img rsrc:src="arrow-right.png"/></a>
</span>

View File

@ -23,6 +23,7 @@
<span class="monthsHeader">
<span class="month1">
<a href="#"
id="leftNavigationArrow"
var:date="prevMonthQueryParameters.month"
onclick="return onCalendarGotoDay(this);"
><img rsrc:src="arrow-left.png"/></a>
@ -30,6 +31,7 @@
<span class="month0"><var:string value="monthNameOfThisMonth" /></span>
<span class="month1">
<a href="#"
id="rightNavigationArrow"
var:date="nextMonthQueryParameters.month"
onclick="return onCalendarGotoDay(this);"><img rsrc:src="arrow-right.png"/></a>
</span>

View File

@ -6,7 +6,7 @@
xmlns:rsrc="OGo:url"
xmlns:label="OGo:label">
<a href="#"
class="leftNavigationArrow"
id="leftNavigationArrow"
var:date="prevDayQueryParameters.day"
onclick="return onCalendarGotoDay(this);"
><img rsrc:src="arrow-left.png"/></a>
@ -34,7 +34,7 @@
/></a></span
></span>
<a href="#"
class="rightNavigationArrow"
id="rightNavigationArrow"
var:date="nextDayQueryParameters.day"
onclick="return onCalendarGotoDay(this);"
><img rsrc:src="arrow-right.png"/></a>

View File

@ -22,12 +22,14 @@
<span class="weeksHeader">
<span class="week1">
<a href="#"
id="leftNavigationArrow"
var:date="prevWeekQueryParameters.day"
onclick="return onCalendarGotoDay(this);"><img rsrc:src="arrow-left.png"/></a>
</span>
<span class="week0"><var:string value="currentWeekName" /></span>
<span class="week1">
<a href="#"
id="rightNavigationArrow"
var:date="nextWeekQueryParameters.day"
onclick="return onCalendarGotoDay(this);"><img rsrc:src="arrow-right.png"/></a>
</span>

View File

@ -151,11 +151,17 @@ function getSelectedFolder() {
}
function onMenuNewEventClick(event) {
newEventFromWidget(this, "event");
var target = document.menuTarget;
if (/(minutes\d{2}|dayHeader)/.test(target.className))
target = target.parentNode;
newEventFromWidget(target, "event");
}
function onMenuNewTaskClick(event) {
newEventFromWidget(this, "task");
var target = document.menuTarget;
if (/(minutes\d{2}|dayHeader)/.test(target.className))
target = target.parentNode;
newEventFromWidget(target, "task");
}
function _editEventId(id, calendar, recurrence) {
@ -718,7 +724,6 @@ function onViewEventCallback(http) {
}
}
else {
view = $("calendarView");
top -= cell.up("DIV.day").scrollTop;
}
@ -1173,13 +1178,11 @@ function restoreCurrentDaySelection(div) {
}
function loadPreviousView(event) {
var previousArrow = $$("A.leftNavigationArrow").first();
onCalendarGotoDay(previousArrow);
onCalendarGotoDay($("leftNavigationArrow"));
}
function loadNextView(event) {
var nextArrow = $$("A.rightNavigationArrow").first();
onCalendarGotoDay(nextArrow);
onCalendarGotoDay($("rightNavigationArrow"));
}
function changeDateSelectorDisplay(day, keepCurrentDay) {
@ -1701,6 +1704,11 @@ function newBaseEventDIV(eventRep, event, eventText) {
var eventCell = createElement("div");
eventCell.cname = event[0];
eventCell.calendar = event[1];
var startDate = new Date(event[5]*1000);
if (startDate) {
eventCell.writeAttribute('day', startDate.getDayString());
eventCell.writeAttribute('hour', startDate.getHourString());
}
// if (event[8] == 1)
// eventCell.addClassName("private");
// else if (event[8] == 2)
@ -2439,8 +2447,7 @@ function onCalendarSelectDay(event) {
// Target is not an event -- unselect all events.
listOfSelection = $("eventsList");
deselectAll();
preventDefault(event);
return false;
return true;
}
if (listOfSelection) {
@ -2778,17 +2785,20 @@ function onMenuSharing(event) {
}
function onMenuCurrentView(event) {
var target = getTarget(event);
$("eventDialog").hide();
if (this.hasClassName('event')) {
// Select event cell
var onClick = onCalendarSelectEvent.bind(this);
onClick(event, true);
target = this;
}
popupMenu(event, 'currentViewMenu', this);
popupMenu(event, 'currentViewMenu', target);
}
function onMenuAllDayView(event) {
$("eventDialog").hide();
popupMenu(event, 'allDayViewMenu', this);
popupMenu(event, 'allDayViewMenu', getTarget(event));
}
function configureDragHandles() {

View File

@ -1007,9 +1007,7 @@ SOGoEventDragController.prototype = {
onDragStart: function SEDC_onDragStart(event) {
var target = getTarget(event);
if (eventIsLeftClick(event) && (target.nodeType == 1)) {
if (target.hasClassName("minutes15") ||
target.hasClassName("minutes30") ||
target.hasClassName("minutes45"))
if (/minutes\d{2}/.test(target.className))
target = target.parentNode;
if ((!this.eventCells
&& (target.hasClassName("clickableHourCell")
@ -1059,11 +1057,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);
}
}
return false;
},
_determineEventInvitation: function SEDC__determineEventType(node) {