From e208ee3fdef30b13adb28cf3915a7809975df0c9 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 28 Jul 2015 20:45:46 -0400 Subject: [PATCH] (feat) Open events from day and week views --- UI/Scheduler/UIxCalListingActions.m | 17 ++++++------- UI/Templates/SchedulerUI/UIxCalDayTable.wox | 1 + .../Scheduler/sgCalendarDayBlock.directive.js | 24 ++++++++++++------- .../Scheduler/sgCalendarDayTable.directive.js | 14 +++++++---- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 34179ed6b..3b588c6de 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -356,7 +356,7 @@ static NSArray *tasksFields = nil; NSMutableDictionary *newInfo; NSMutableArray *infos, *quickInfos, *allInfos, *quickInfosName; NSNull *marker; - NSString *owner, *role, *calendarName, *iCalString; + NSString *owner, *role, *calendarName, *iCalString, *recurrenceTime; NSRange match; iCalCalendar *calendar; iCalObject *master; @@ -504,7 +504,12 @@ static NSArray *tasksFields = nil; if (![[newInfo objectForKey: @"c_title"] length]) [self _fixComponentTitle: newInfo withType: component]; - // Possible improvement: only call _fixDates if event is recurrent + // Add prefix to recurrence id + if ((recurrenceTime = [newInfo objectForKey: @"c_recurrence_id"])) + [newInfo setObject: [NSString stringWithFormat: @"occurence%@", recurrenceTime] + forKey: @"c_recurrence_id"]; + + // Possible improvement: only call _fixDates if event is recurrent // or the view range span a daylight saving time change [self _fixDates: newInfo]; @@ -723,10 +728,6 @@ static NSArray *tasksFields = nil; while ((oldEvent = [events nextObject])) { newEvent = [NSMutableArray arrayWithArray: oldEvent]; - if (![[oldEvent objectAtIndex: eventRecurrenceIdIndex] isKindOfClass: [NSNull class]]) - [newEvent replaceObjectAtIndex: eventRecurrenceIdIndex - withObject: [NSString stringWithFormat: @"occurence%@", - [oldEvent objectAtIndex: eventRecurrenceIdIndex]]]; isAllDay = [[oldEvent objectAtIndex: eventIsAllDayIndex] boolValue]; interval = [[oldEvent objectAtIndex: eventStartDateIndex] intValue]; [newEvent addObject: [self _formattedDateForSeconds: interval @@ -1430,10 +1431,6 @@ _computeBlocksPosition (NSArray *blocks) if (statusCode != 1 || showCompleted) { filteredTask = [NSMutableArray arrayWithArray: task]; - if (![[task objectAtIndex: taskRecurrenceIdIndex] isKindOfClass: [NSNull class]]) - [filteredTask replaceObjectAtIndex: taskRecurrenceIdIndex - withObject: [NSString stringWithFormat: @"occurence%@", - [task objectAtIndex: taskRecurrenceIdIndex]]]; endDateStamp = [[task objectAtIndex: taskEndDateIndex] intValue]; statusFlag = [self _getStatusClassForStatusCode: statusCode andEndDateStamp: endDateStamp]; diff --git a/UI/Templates/SchedulerUI/UIxCalDayTable.wox b/UI/Templates/SchedulerUI/UIxCalDayTable.wox index a095d22b2..d212250dd 100644 --- a/UI/Templates/SchedulerUI/UIxCalDayTable.wox +++ b/UI/Templates/SchedulerUI/UIxCalDayTable.wox @@ -103,6 +103,7 @@
diff --git a/UI/WebServerResources/js/Scheduler/sgCalendarDayBlock.directive.js b/UI/WebServerResources/js/Scheduler/sgCalendarDayBlock.directive.js index df3c437d1..5405551b3 100644 --- a/UI/WebServerResources/js/Scheduler/sgCalendarDayBlock.directive.js +++ b/UI/WebServerResources/js/Scheduler/sgCalendarDayBlock.directive.js @@ -8,30 +8,38 @@ * @memberof SOGo.Common * @restrict element * @param {object} sgBlock - the event block definition - * @ngInject + * @param {function} sgClick - the function to call when clicking on a block. + * Two variables are available: clickEvent (the event that triggered the mouse click), + * and clickComponent (a Component object) + * * @example: + ng-repeat="block in blocks[day]" + sg-block="block" + sg-click="open(clickEvent, clickComponent)" /> */ function sgCalendarDayBlock() { return { restrict: 'E', scope: { - block: '=sgBlock' + block: '=sgBlock', + clickBlock: '&sgClick' }, replace: true, template: [ '
', - '
', + '
', '
', '
', '
{{ block.component.c_title }}', ' ', - ' ', - ' ', - ' ', + // Component has an alarm + ' ', + // Component is confidential + ' ', + // Component is private + ' ', '
', '
', '
', diff --git a/UI/WebServerResources/js/Scheduler/sgCalendarDayTable.directive.js b/UI/WebServerResources/js/Scheduler/sgCalendarDayTable.directive.js index 224f978f9..86fb28054 100644 --- a/UI/WebServerResources/js/Scheduler/sgCalendarDayTable.directive.js +++ b/UI/WebServerResources/js/Scheduler/sgCalendarDayTable.directive.js @@ -9,24 +9,30 @@ * @restrict element * @param {object} sgBlocks - the events blocks definitions for the current view * @param {string} sgDay - the day of the events to display - * @ngInject + * @param {function} sgClick - the function to call when clicking on a block. + * Two variables are available: event (the event that triggered the mouse click), + * and component (a Component object) + * * @example: + sg-day="20150330" + sg-click="open({ event: clickEvent, component: clickComponent })"/> */ function sgCalendarDayTable() { return { restrict: 'E', scope: { blocks: '=sgBlocks', - day: '@sgDay' + day: '@sgDay', + clickBlock: '&sgClick' }, template: [ '' + ' sg-block="block"', + ' sg-click="clickBlock({event: clickEvent, component: clickComponent})"/>' ].join('') }; }