mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-12 03:45:08 +00:00
See ChangeLog
Monotone-Parent: ea7589320f5747a3bd1bbec33e1bd8776e4041db Monotone-Revision: cc4b29880c63c661301ca909ec3695f67b0775dd Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-04-21T15:20:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* UIxCalListingActions.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
* Copyright (C) 2006-2009 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
@@ -364,6 +364,75 @@ static NSArray *tasksFields = nil;
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
//
|
||||
// We return:
|
||||
//
|
||||
// {complete Event ID (full path) => Fire date (UTC)}
|
||||
//
|
||||
// Called when each module is loaded or whenever a calendar component is created, modified, deleted
|
||||
// or whenever there's a {un}subscribe to a calendar.
|
||||
//
|
||||
// Workflow :
|
||||
//
|
||||
// - for ALL subscribed and ACTIVE calendars
|
||||
// - returns alarms for which the (event end date > browserTime) OR (browserTime < c_nextalarm)
|
||||
// - if it's a recurring event and that condition isn't met
|
||||
// - set date range from X (now) until Y (now+2 days)
|
||||
// - compute the c_nextalarm and if it is met, store it in c_nextalarm
|
||||
//
|
||||
//
|
||||
- (WOResponse *) alarmsListAction
|
||||
{
|
||||
SOGoAppointmentFolder *currentFolder;
|
||||
SOGoAppointmentFolders *clientObject;
|
||||
NSMutableArray *allAlarms;
|
||||
NSEnumerator *folders;
|
||||
WOResponse *response;
|
||||
int browserTime;
|
||||
|
||||
browserTime = [[[context request] formValueForKey: @"browserTime"] intValue];
|
||||
clientObject = [self clientObject];
|
||||
allAlarms = [NSMutableArray array];
|
||||
|
||||
folders = [[clientObject subFolders] objectEnumerator];
|
||||
while ((currentFolder = [folders nextObject]))
|
||||
{
|
||||
if ([currentFolder isActive])
|
||||
{
|
||||
NSDictionary *entry;;
|
||||
NSArray *alarms;
|
||||
int i, v;
|
||||
|
||||
// Let's compute everything +2 days in case we hit recurring components
|
||||
alarms = [currentFolder fetchFields: [NSArray arrayWithObjects: @"c_nextalarm", @"c_iscycle", nil]
|
||||
from: [NSCalendarDate date]
|
||||
to: [[NSCalendarDate date] dateByAddingYears: 0 months: 0 days: 2 hours: 0 minutes: 0 seconds: 0]
|
||||
title: nil
|
||||
component: nil
|
||||
additionalFilters: nil
|
||||
includeProtectedInformation: NO];
|
||||
for (i = 0; i < [alarms count]; i++)
|
||||
{
|
||||
entry = [alarms objectAtIndex: i];
|
||||
v = [[entry objectForKey: @"c_nextalarm"] intValue];
|
||||
|
||||
if (([[entry objectForKey: @"c_enddate"] intValue] > browserTime) ||
|
||||
browserTime < v)
|
||||
{
|
||||
[allAlarms addObject: [NSDictionary dictionaryWithObject: [entry objectForKey: @"c_nextalarm"]
|
||||
forKey: [entry objectForKey: @"c_name"]]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
response = [self responseWithStatus: 200];
|
||||
[response appendContentString: [allAlarms jsonRepresentation]];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WOResponse *) eventsListAction
|
||||
{
|
||||
NSArray *oldEvent;
|
||||
@@ -885,29 +954,4 @@ _computeBlocksPosition (NSArray *blocks)
|
||||
return [self _responseWithData: filteredTasks];
|
||||
}
|
||||
|
||||
// - (BOOL) shouldDisplayCurrentTask
|
||||
// {
|
||||
// if (!knowsToShow)
|
||||
// {
|
||||
// showCompleted
|
||||
// = [[self queryParameterForKey: @"show-completed"] intValue];
|
||||
// knowsToShow = YES;
|
||||
// }
|
||||
|
||||
// return ([[currentTask objectForKey: @"status"] intValue] != 1
|
||||
// || showCompleted);
|
||||
// }
|
||||
|
||||
// - (BOOL) shouldShowCompletedTasks
|
||||
// {
|
||||
// if (!knowsToShow)
|
||||
// {
|
||||
// showCompleted
|
||||
// = [[self queryParameterForKey: @"show-completed"] intValue];
|
||||
// knowsToShow = YES;
|
||||
// }
|
||||
|
||||
// return showCompleted;
|
||||
// }
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user