diff --git a/ChangeLog b/ChangeLog index fc928d7fa..f8ec23eb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-10-13 Francis Lachapelle + + * UI/Scheduler/NSArray+Scheduler.h: added index constants for + events fields. + (compareEventsCalendarNameAscending): new method to sort by + calendar name. + + * UI/Scheduler/UIxCalListingActions.m: now uses the above + mentioned constants. + (+initialize): added calendar name to events fields. + (eventsListAction): added sort by calendar name. + + * UI/WebServerResources/SchedulerUI.js (eventsListCallback): added + calendar name column. + (onCalendarSelectEvent): improved list selection. + 2010-10-13 Wolfgang Sourdeau * SoObjects/Mailer/SOGoMailBaseObject.m (-imap4Connection): split diff --git a/UI/Scheduler/NSArray+Scheduler.h b/UI/Scheduler/NSArray+Scheduler.h index 1d2f2b657..e5308d2e4 100644 --- a/UI/Scheduler/NSArray+Scheduler.h +++ b/UI/Scheduler/NSArray+Scheduler.h @@ -1,6 +1,6 @@ /* NSArray+Scheduler.m - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. + * Copyright (C) 2007-2010 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -25,12 +25,36 @@ #import +// See [UIxCalListingActions initialize] +#define eventNameIndex 0 +#define eventFolderIndex 1 +#define eventCalendarNameIndex 2 +#define eventStatusIndex 3 +#define eventTitleIndex 4 +#define eventStartDateIndex 5 +#define eventEndDateIndex 6 +#define eventLocationIndex 7 +#define eventIsAllDayIndex 8 +#define eventClassificationIndex 9 +#define eventCategoryIndex 10 +#define eventPartMailsIndex 11 +#define eventPartStatesIndex 12 +#define eventOwnerIndex 13 +#define eventIsCycleIndex 14 +#define eventNextAlarmIndex 15 +#define eventRecurrenceIdIndex 16 +#define eventIsExceptionIndex 17 +#define eventEditableIndex 18 +#define eventErasableIndex 19 +#define eventOwnerIsOrganizerIndex 20 + @interface NSArray (SOGoEventComparison) - (NSComparisonResult) compareEventsStartDateAscending: (NSArray *) otherEvent; - (NSComparisonResult) compareEventsEndDateAscending: (NSArray *) otherEvent; - (NSComparisonResult) compareEventsTitleAscending: (NSArray *) otherEvent; - (NSComparisonResult) compareEventsLocationAscending: (NSArray *) otherEvent; +- (NSComparisonResult) compareEventsCalendarNameAscending: (NSArray *) otherEvent; - (NSComparisonResult) compareTasksAscending: (NSArray *) otherTask; - (NSArray *) reversedArray; diff --git a/UI/Scheduler/NSArray+Scheduler.m b/UI/Scheduler/NSArray+Scheduler.m index 030dd1f02..0dfd5bcf2 100644 --- a/UI/Scheduler/NSArray+Scheduler.m +++ b/UI/Scheduler/NSArray+Scheduler.m @@ -55,8 +55,8 @@ NSComparisonResult result; unsigned int selfTime, otherTime; - selfTime = [[self objectAtIndex: 4] intValue]; - otherTime = [[otherEvent objectAtIndex: 4] intValue]; + selfTime = [[self objectAtIndex: eventStartDateIndex] intValue]; + otherTime = [[otherEvent objectAtIndex: eventStartDateIndex] intValue]; if (selfTime > otherTime) result = NSOrderedDescending; else if (selfTime < otherTime) @@ -72,8 +72,8 @@ NSComparisonResult result; unsigned int selfTime, otherTime; - selfTime = [[self objectAtIndex: 5] intValue]; - otherTime = [[otherEvent objectAtIndex: 5] intValue]; + selfTime = [[self objectAtIndex: eventEndDateIndex] intValue]; + otherTime = [[otherEvent objectAtIndex: eventEndDateIndex] intValue]; if (selfTime > otherTime) result = NSOrderedDescending; else if (selfTime < otherTime) @@ -88,8 +88,8 @@ { NSString *selfTitle, *otherTitle; - selfTitle = [self objectAtIndex: 3]; - otherTitle = [otherEvent objectAtIndex: 3]; + selfTitle = [self objectAtIndex: eventTitleIndex]; + otherTitle = [otherEvent objectAtIndex: eventTitleIndex]; return [selfTitle caseInsensitiveCompare: otherTitle]; } @@ -98,12 +98,22 @@ { NSString *selfTitle, *otherTitle; - selfTitle = [self objectAtIndex: 6]; - otherTitle = [otherEvent objectAtIndex: 6]; + selfTitle = [self objectAtIndex: eventLocationIndex]; + otherTitle = [otherEvent objectAtIndex: eventLocationIndex]; return [selfTitle caseInsensitiveCompare: otherTitle]; } +- (NSComparisonResult) compareEventsCalendarNameAscending: (NSArray *) otherEvent +{ + NSString *selfCalendarName, *otherCalendarName; + + selfCalendarName = [self objectAtIndex: eventCalendarNameIndex]; + otherCalendarName = [otherEvent objectAtIndex: eventCalendarNameIndex]; + + return [selfCalendarName caseInsensitiveCompare: otherCalendarName]; +} + - (NSComparisonResult) compareTasksAscending: (NSArray *) otherTask { NSComparisonResult result; diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 8e4df8e5d..f095a3f9f 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -80,6 +80,7 @@ static NSArray *tasksFields = nil; if (!eventsFields) { eventsFields = [NSArray arrayWithObjects: @"c_name", @"c_folder", + @"calendarName", @"c_status", @"c_title", @"c_startdate", @"c_enddate", @"c_location", @"c_isallday", @"c_classification", @"c_category", @@ -368,6 +369,8 @@ static NSArray *tasksFields = nil; forKey: @"c_folder"]; [newInfo setObject: [currentFolder ownerInContext: context] forKey: @"c_owner"]; + [newInfo setObject: [currentFolder displayName] + forKey: @"calendarName"]; if (![[newInfo objectForKey: @"c_title"] length]) [self _fixComponentTitle: newInfo withType: component]; // Possible improvement: only call _fixDates if event is recurrent @@ -510,13 +513,13 @@ static NSArray *tasksFields = nil; while ((oldEvent = [events nextObject])) { newEvent = [NSMutableArray arrayWithArray: oldEvent]; - isAllDay = [[oldEvent objectAtIndex: 7] boolValue]; - interval = [[oldEvent objectAtIndex: 4] intValue]; + isAllDay = [[oldEvent objectAtIndex: eventIsAllDayIndex] boolValue]; + interval = [[oldEvent objectAtIndex: eventStartDateIndex] intValue]; [newEvent addObject: [self _formattedDateForSeconds: interval - forAllDay: isAllDay]]; - interval = [[oldEvent objectAtIndex: 5] intValue]; + forAllDay: isAllDay]]; + interval = [[oldEvent objectAtIndex: eventEndDateIndex] intValue]; [newEvent addObject: [self _formattedDateForSeconds: interval - forAllDay: isAllDay]]; + forAllDay: isAllDay]]; [newEvents addObject: newEvent]; } @@ -527,6 +530,8 @@ static NSArray *tasksFields = nil; [newEvents sortUsingSelector: @selector (compareEventsEndDateAscending:)]; else if ([sort isEqualToString: @"location"]) [newEvents sortUsingSelector: @selector (compareEventsLocationAscending:)]; + else if ([sort isEqualToString: @"calendar"]) + [newEvents sortUsingSelector: @selector (compareEventsCalendarNameAscending:)]; else [newEvents sortUsingSelector: @selector (compareEventsStartDateAscending:)]; @@ -616,8 +621,8 @@ _userStateInEvent (NSArray *event) participants = nil; state = iCalPersonPartStatOther; - partList = [event objectAtIndex: 10]; - stateList = [event objectAtIndex: 11]; + partList = [event objectAtIndex: eventPartMailsIndex]; + stateList = [event objectAtIndex: eventPartStatesIndex]; if ([partList length] && [stateList length]) { participants = [partList componentsSeparatedByString: @"\n"]; @@ -626,7 +631,7 @@ _userStateInEvent (NSArray *event) max = [participants count]; while (state == iCalPersonPartStatOther && count < max) { - user = [SOGoUser userWithLogin: [event objectAtIndex: 12] + user = [SOGoUser userWithLogin: [event objectAtIndex: eventOwnerIndex] roles: nil]; if ([user hasEmail: [participants objectAtIndex: count]]) state = [[states objectAtIndex: count] intValue]; @@ -648,16 +653,16 @@ _userStateInEvent (NSArray *event) NSMutableDictionary *eventBlock; iCalPersonPartStat userState; - eventStart = [[event objectAtIndex: 4] intValue]; + eventStart = [[event objectAtIndex: eventStartDateIndex] intValue]; if (eventStart < 0) [self errorWithFormat: @"event '%@' has negative start: %d (skipped)", - [event objectAtIndex: 0], eventStart]; + [event objectAtIndex: eventNameIndex], eventStart]; else { - eventEnd = [[event objectAtIndex: 5] intValue]; + eventEnd = [[event objectAtIndex: eventEndDateIndex] intValue]; if (eventEnd < 0) [self errorWithFormat: @"event '%@' has negative end: %d (skipped)", - [event objectAtIndex: 0], eventEnd]; + [event objectAtIndex: eventNameIndex], eventEnd]; else { if (eventEnd < eventStart) @@ -666,14 +671,14 @@ _userStateInEvent (NSArray *event) eventStart = eventEnd; eventEnd = swap; [self warnWithFormat: @"event '%@' has end < start: %d < %d", - [event objectAtIndex: 0], eventEnd, eventStart]; + [event objectAtIndex: eventNameIndex], eventEnd, eventStart]; } startSecs = (unsigned int) [startDate timeIntervalSince1970]; endsSecs = (unsigned int) [endDate timeIntervalSince1970]; - if ([[event objectAtIndex: 13] boolValue]) // c_iscycle - recurrenceTime = [[event objectAtIndex: 15] unsignedIntValue]; // c_recurrence_id + if ([[event objectAtIndex: eventIsCycleIndex] boolValue]) + recurrenceTime = [[event objectAtIndex: eventRecurrenceIdIndex] unsignedIntValue]; else recurrenceTime = 0; @@ -689,7 +694,7 @@ _userStateInEvent (NSArray *event) if (offset >= [blocks count]) [self errorWithFormat: "event '%@' has a computed offset that" @" overflows the amount of blocks (skipped)", - [event objectAtIndex: 0]]; + [event objectAtIndex: eventNameIndex]]; else { currentDay = [blocks objectAtIndex: offset]; @@ -955,7 +960,7 @@ _computeBlocksPosition (NSArray *blocks) { event = [events objectAtIndex: count]; eventNbr = [NSNumber numberWithUnsignedInt: count]; - isAllDay = [[event objectAtIndex: 7] boolValue]; + isAllDay = [[event objectAtIndex: eventIsAllDayIndex] boolValue]; if (dayBasedView && isAllDay) [self _fillBlocks: allDayBlocks withEvent: event withNumber: eventNbr]; else diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 61928ac30..4a32c2e53 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -168,6 +168,7 @@ + diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css index 14f7546fa..63cb47aaf 100644 --- a/UI/WebServerResources/SchedulerUI.css +++ b/UI/WebServerResources/SchedulerUI.css @@ -1318,7 +1318,7 @@ DIV.gradient > IMG min-height: 15px; /* for 15-minute events */ width: 100%; } -DIV.text SPAN +DIV.text SPAN.icons { float: right; } DIV.text SPAN IMG diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index cc288ca56..af88ef125 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -218,7 +218,7 @@ function deleteEvent() { var sortedNodes = []; var calendars = []; for (var i = 0; i < nodes.length; i++) { - canDelete = nodes[i].erasable || IsSuperUser; + canDelete = nodes[i].erasable; if (canDelete) { var calendar = nodes[i].calendar; if (!sortedNodes[calendar]) { @@ -254,7 +254,7 @@ function deleteEvent() { var sortedNodes = []; var calendars = []; for (var i = 0; i < selectedCalendarCell.length; i++) { - canDelete = selectedCalendarCell[i].erasable || IsSuperUser; + canDelete = selectedCalendarCell[i].erasable; if (canDelete) { var calendar = selectedCalendarCell[i].calendar; if (!sortedNodes[calendar]) { @@ -865,7 +865,7 @@ function eventsListCallback(http) { var row = createElement("tr"); table.tBodies[0].appendChild(row); row.addClassName("eventRow"); - var rTime = data[i][15]; + var rTime = data[i][16]; var id = escape(data[i][1] + "-" + data[i][0]); if (rTime) id += "-" + escape(rTime); @@ -874,17 +874,17 @@ function eventsListCallback(http) { row.calendar = escape(data[i][1]); if (rTime) row.recurrenceTime = escape(rTime); - row.isException = data[i][16]; - row.editable = data[i][17]; - row.erasable = data[i][18]; + row.isException = data[i][17]; + row.editable = data[i][18]; + row.erasable = data[i][19] || IsSuperUser; var startDate = new Date(); - startDate.setTime(data[i][4] * 1000); + startDate.setTime(data[i][5] * 1000); row.day = startDate.getDayString(); - if (!data[i][7]) + if (!data[i][8]) row.hour = startDate.getHourString(); // event is not all day row.observe("mousedown", onRowClick); row.observe("selectstart", listRowMouseDownHandler); - if (data[i][2] != null) + if (data[i][3] != null) // Status is defined -- event is readable row.observe("dblclick", editDoubleClickedEvent); row.attachMenu("eventsListMenu"); @@ -892,26 +892,31 @@ function eventsListCallback(http) { var td = createElement("td"); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); - td.appendChild(document.createTextNode(data[i][3])); // title + td.appendChild(document.createTextNode(data[i][4])); // title td = createElement("td"); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); - td.appendChild(document.createTextNode(data[i][20])); // start date + td.appendChild(document.createTextNode(data[i][21])); // start date td = createElement("td"); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); - td.appendChild(document.createTextNode(data[i][21])); // end date + td.appendChild(document.createTextNode(data[i][22])); // end date td = createElement("td"); row.appendChild(td); td.observe("mousedown", listRowMouseDownHandler, true); - if (data[i][6]) - td.appendChild(document.createTextNode(data[i][6])); // location + if (data[i][7]) + td.appendChild(document.createTextNode(data[i][7])); // location + + td = createElement("td"); + row.appendChild(td); + td.observe("mousedown", listRowMouseDownHandler, true); + td.appendChild(document.createTextNode(data[i][2])); // calendar } - if (sorting["attribute"] && sorting["attribute"].length > 0) { + if (sorting["attribute"] && sorting["attribute"].length > 0) { log ("sort " + sorting["attribute"]); var sortHeader = $(sorting["attribute"] + "Header"); if (sortHeader) { @@ -964,7 +969,7 @@ function tasksListCallback(http) { listItem.calendar = calendar; listItem.addClassName("calendarFolder" + calendar); listItem.cname = cname; - listItem.erasable = data[i][7]; + listItem.erasable = data[i][7] || IsSuperUser; var input = createElement("input"); input.setAttribute("type", "checkbox"); if (parseInt(data[i][6]) == 0) // editable? @@ -1179,21 +1184,23 @@ function scrollDayView(scrollEvent) { var contentView; var eventRow = $(scrollEvent); var eventBlocks = selectCalendarEvent(eventRow.calendar, eventRow.cname, eventRow.recurrenceTime); - var firstEvent = eventBlocks.first(); + if (eventBlocks) { + var firstEvent = eventBlocks.first(); - if (currentView == "monthview") - contentView = firstEvent.up("DIV.day"); - else - contentView = $("daysView"); - - // Don't scroll to an all-day event - if (typeof eventRow.hour != "undefined") { - var top = firstEvent.cumulativeOffset()[1] - contentView.scrollTop; - // Don't scroll if the event is visible to the user - if (top < contentView.cumulativeOffset()[1]) - contentView.scrollTop = firstEvent.cumulativeOffset()[1] - contentView.cumulativeOffset()[1]; - else if (top > contentView.cumulativeOffset()[1] + contentView.getHeight() - firstEvent.getHeight()) - contentView.scrollTop = firstEvent.cumulativeOffset()[1] - contentView.cumulativeOffset()[1]; + if (currentView == "monthview") + contentView = firstEvent.up("DIV.day"); + else + contentView = $("daysView"); + + // Don't scroll to an all-day event + if (typeof eventRow.hour != "undefined") { + var top = firstEvent.cumulativeOffset()[1] - contentView.scrollTop; + // Don't scroll if the event is visible to the user + if (top < contentView.cumulativeOffset()[1]) + contentView.scrollTop = firstEvent.cumulativeOffset()[1] - contentView.cumulativeOffset()[1]; + else if (top > contentView.cumulativeOffset()[1] + contentView.getHeight() - firstEvent.getHeight()) + contentView.scrollTop = firstEvent.cumulativeOffset()[1] - contentView.cumulativeOffset()[1]; + } } } else if (currentView != "monthview") { @@ -1379,24 +1386,25 @@ function resetCategoriesStyles() { function newBaseEventDIV(eventRep, event, eventText) { // log ("0 cname = " + event[0]); // log ("1 calendar = " + event[1]); - // log ("2 status = " + event[2]); - // log ("3 title = " + event[3]); - // log ("4 start = " + event[4]); - // log ("5 end = " + event[5]); - // log ("6 location = " + event[6]); - // log ("7 isallday = " + event[7]); - // log ("8 classification = " + event[8]); // 0 = public, 1 = private, 2 = confidential - // log ("9 category = " + event[9]); - // log ("10 participants emails = " + event[10]); - // log ("11 participants states = " + event[11]); - // log ("12 owner = " + event[12]); - // log ("13 iscycle = " + event[13]); - // log ("14 nextalarm = " + event[14]); - // log ("15 recurrenceid = " + event[15]); - // log ("16 isexception = " + event[16]); - // log ("17 editable = " + event[17]); - // log ("18 erasable = " + event[18]); - // log ("19 ownerisorganizer = " + event[19]); + // log ("2 calendar name = " + event[2]); + // log ("3 status = " + event[3]); + // log ("4 title = " + event[4]); + // log ("5 start = " + event[5]); + // log ("6 end = " + event[6]); + // log ("7 location = " + event[7]); + // log ("8 isallday = " + event[8]); + // log ("9 classification = " + event[9]); // 0 = public, 1 = private, 2 = confidential + // log ("10 category = " + event[10]); + // log ("11 participants emails = " + event[11]); + // log ("12 participants states = " + event[12]); + // log ("13 owner = " + event[13]); + // log ("14 iscycle = " + event[14]); + // log ("15 nextalarm = " + event[15]); + // log ("16 recurrenceid = " + event[16]); + // log ("17 isexception = " + event[17]); + // log ("18 editable = " + event[18]); + // log ("19 erasable = " + event[19]); + // log ("20 ownerisorganizer = " + event[20]); var eventCell = createElement("div"); eventCell.cname = event[0]; @@ -1408,10 +1416,10 @@ function newBaseEventDIV(eventRep, event, eventText) { if (eventRep.recurrenceTime) eventCell.recurrenceTime = eventRep.recurrenceTime; //eventCell.owner = event[12]; - eventCell.isException = event[16]; - eventCell.editable = event[17]; - eventCell.erasable = event[18]; - eventCell.ownerIsOrganizer = event[19]; + eventCell.isException = event[17]; + eventCell.editable = event[18]; + eventCell.erasable = event[19] || IsSuperUser; + eventCell.ownerIsOrganizer = event[20]; eventCell.addClassName("event"); // if (event[14] > 0) // eventCell.addClassName("alarm"); @@ -1434,29 +1442,29 @@ function newBaseEventDIV(eventRep, event, eventText) { var textDiv = createElement("div"); innerDiv.appendChild(textDiv); textDiv.addClassName("text"); - var iconSpan = createElement("span"); + var iconSpan = createElement("span", null, "icons"); textDiv.appendChild(iconSpan); textDiv.appendChild(document.createTextNode(eventText.replace(/(\\r)?\\n/g, "
"))); // Add alarm and classification icons - if (event[8] == 1) + if (event[9] == 1) createElement("img", null, null, {src: ResourcesURL + "/private.png"}, null, iconSpan); - else if (event[8] == 2) + else if (event[9] == 2) createElement("img", null, null, {src: ResourcesURL + "/confidential.png"}, null, iconSpan); - if (event[14] > 0) + if (event[15] > 0) createElement("img", null, null, {src: ResourcesURL + "/alarm.png"}, null, iconSpan); - if (event[9] != null) { - var categoryStyle = categoriesStyles.get(event[9]); + if (event[10] != null) { + var categoryStyle = categoriesStyles.get(event[10]); if (!categoryStyle) { categoryStyle = 'category_' + categoriesStyles.keys().length; - categoriesStyles.set([event[9]], categoryStyle); + categoriesStyles.set([event[10]], categoryStyle); } innerDiv.addClassName(categoryStyle); } eventCell.observe("contextmenu", onMenuCurrentView); - if (event[2] == null) { + if (event[3] == null) { // Status field is not defined -- user can't read event eventCell.observe("selectstart", listRowMouseDownHandler); eventCell.observe("click", onCalendarSelectEvent); @@ -1493,7 +1501,7 @@ function _drawCalendarAllDayEvents(events, eventsData) { function newAllDayEventDIV(eventRep, event) { // cname, calendar, starts, lasts, // startHour, endHour, title) { - var eventCell = newBaseEventDIV(eventRep, event, event[3]); + var eventCell = newBaseEventDIV(eventRep, event, event[4]); return eventCell; } @@ -1519,7 +1527,7 @@ function _drawCalendarEvents(events, eventsData) { } function newEventDIV(eventRep, event) { - var eventCell = newBaseEventDIV(eventRep, event, event[3]); + var eventCell = newBaseEventDIV(eventRep, event, event[4]); var pc = 100 / eventRep.siblings; var left = Math.floor(eventRep.position * pc); @@ -1529,12 +1537,12 @@ function newEventDIV(eventRep, event) { eventCell.addClassName("starts" + eventRep.start); eventCell.addClassName("lasts" + eventRep.length); - if (event[6]) { + if (event[7]) { var inside = eventCell.childNodesWithTag("div")[0]; var textDiv = inside.childNodesWithTag("div")[1]; textDiv.appendChild(createElement("br")); var span = createElement("span", null, "location"); - var text = _("Location:") + " " + event[6]; + var text = _("Location:") + " " + event[7]; span.appendChild(document.createTextNode(text)); textDiv.appendChild(span); } @@ -1558,8 +1566,8 @@ function _drawMonthCalendarEvents(events, eventsData) { function newMonthEventDIV(eventRep, event) { var eventText; - if (event[7]) // all-day event - eventText = event[3]; + if (event[8]) // all-day event + eventText = event[4]; else eventText = eventRep.starthour + " - " + event[3]; @@ -1745,9 +1753,11 @@ function popupCalendar(node) { function onEventsSelectionChange() { listOfSelection = this; this.removeClassName("_unfocused"); - $("tasksList").addClassName("_unfocused"); - deselectAll(true); + var tasksList = $("tasksList"); + tasksList.addClassName("_unfocused"); + deselectAll(tasksList); + var rows = $(this.tBodies[0]).getSelectedNodes(); if (rows.length == 1) { var row = rows[0]; @@ -1767,7 +1777,9 @@ function onEventsSelectionChange() { function onTasksSelectionChange() { listOfSelection = this; this.removeClassName("_unfocused"); - $("eventsList").addClassName("_unfocused"); + var eventsList = $("eventsList"); + eventsList.addClassName("_unfocused"); + deselectAll(eventsList); } function _loadEventHref(href) { @@ -1812,6 +1824,8 @@ function onHeaderClick(event) { newSortAttribute = "end"; else if (headerId == "locationHeader") newSortAttribute = "location"; + else if (headerId == "calendarNameHeader") + newSortAttribute = "calendar"; else newSortAttribute = "start"; @@ -1940,7 +1954,7 @@ function _eventBlocksMatching(calendar, cname, recurrenceTime) { if (recurrenceTime) { for (var i = 0; i < occurences.length; i++) { var occurence = occurences[i]; - if (occurence[15] == recurrenceTime) + if (occurence[16] == recurrenceTime) blocks = occurence.blocks; } } @@ -1957,8 +1971,8 @@ function _eventBlocksMatching(calendar, cname, recurrenceTime) { return blocks; } +/** Select event in calendar view */ function selectCalendarEvent(calendar, cname, recurrenceTime) { - // Select event in calendar view var selection = _eventBlocksMatching(calendar, cname, recurrenceTime); if (selection) { for (var i = 0; i < selection.length; i++) @@ -1996,9 +2010,13 @@ function onSelectAll(event) { return false; } -function deselectAll(cellsOnly) { - if (!cellsOnly && listOfSelection) { - listOfSelection.deselectAll(); +function deselectAll(list) { + if (list) { + list.deselectAll(); + } + else { + $("eventsList").deselectAll(); + $("tasksList").deselectAll(); } if (selectedCalendarCell) { for (var i = 0; i < selectedCalendarCell.length; i++) @@ -2007,6 +2025,7 @@ function deselectAll(cellsOnly) { } } +/** Click on an event in the calendar view */ function onCalendarSelectEvent(event, willShowContextualMenu) { var alreadySelected = false; @@ -2042,8 +2061,8 @@ function onCalendarSelectEvent(event, willShowContextualMenu) { // Unselect entries in events list and calendar view, unless : // - Shift key is pressed; // - Or right button is clicked and event is already selected. - listOfSelection = null; deselectAll(); + listOfSelection = $("eventsList"); this.selectElement(); if (alreadySelected) selectedCalendarCell = [this]; @@ -2077,14 +2096,12 @@ function onCalendarSelectDay(event) { // Target is not an event -- unselect all events. listOfSelection = $("eventsList"); deselectAll(); - listOfSelection = null; preventDefault(event); return false; } if (listOfSelection) { listOfSelection.addClassName("_unfocused"); - listOfSelection = null; } changeCalendarDisplay( { "day": currentDay } ); diff --git a/UI/WebServerResources/generic.css b/UI/WebServerResources/generic.css index 65634446d..d2db09ff8 100644 --- a/UI/WebServerResources/generic.css +++ b/UI/WebServerResources/generic.css @@ -380,10 +380,12 @@ TD.headerDateTime { min-width: 30em; } TD.headerTitle -{ width: 30%; } +{ width: 20%; } -TD.headerLocation -{ min-width: 20em; } +TD.headerLocation, +TD.headerCalendarName +{ min-width: 15em; + width: 15em; } td img.tbtv_sortcell { float: right;