(feat) Open events from day and week views

pull/91/head
Francis Lachapelle 2015-07-28 20:45:46 -04:00
parent 571be37c1d
commit e208ee3fde
4 changed files with 34 additions and 22 deletions

View File

@ -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];

View File

@ -103,6 +103,7 @@
</var:foreach>
<sg-calendar-day-table
sg-blocks="calendar.blocks"
sg-click="list.openEvent(event, component)"
var:sg-day="currentTableDay.shortDateString" />
</div>
<div class="events"><!-- space --></div>

View File

@ -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:
<sg-calendar-day-block
ng-repeat="block in blocks[day]"
sg-block="block"/>
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: [
'<div class="event draggable">',
' <div class="eventInside">',
' <div class="eventInside" ng-click="clickBlock({clickEvent: $event, clickComponent: block.component})">',
' <div class="gradient">',
' </div>',
' <div class="text">{{ block.component.c_title }}',
' <span class="icons">',
' <i ng-if="block.component.c_nextalarm" class="md-icon-alarm"></i>',
' <i ng-if="block.component.c_classification == 1" class="md-icon-visibility-off"></i>',
' <i ng-if="block.component.c_classification == 2" class="md-icon-vpn-key"></i>',
// Component has an alarm
' <md-icon ng-if="block.component.c_nextalarm" class="material-icons icon-alarm"></md-icon>',
// Component is confidential
' <md-icon ng-if="block.component.c_classification == 1" class="material-icons icon-visibility-off"></md-icon>',
// Component is private
' <md-icon ng-if="block.component.c_classification == 2" class="material-icons icon-vpn-key"></md-icon>',
' </span></div>',
' </div>',
' <div class="topDragGrip"></div>',

View File

@ -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-calendar-day-table
sg-blocks="calendar.blocks"
sg-day="20150330" />
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-calendar-day-block class="event draggable"',
' ng-repeat="block in blocks[day]"',
' sg-block="block"/>'
' sg-block="block"',
' sg-click="clickBlock({event: clickEvent, component: clickComponent})"/>'
].join('')
};
}