mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-31 08:04:54 +00:00
See ChangeLog
Monotone-Parent: c4a5b31204ccd4c09e85262d9b5609b788a8380a Monotone-Revision: 9057f51730136ddbcf1d8e64c8029ea9a4e6c991 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-04-22T21:02:11 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -34,9 +34,11 @@
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
|
||||
#import <NGCards/iCalAlarm.h>
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalEvent.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/iCalTrigger.h>
|
||||
#import <NGCards/iCalRecurrenceRule.h>
|
||||
|
||||
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
|
||||
@@ -394,6 +396,7 @@
|
||||
SOGoUser *user;
|
||||
SOGoCalendarComponent *co;
|
||||
iCalEvent *master;
|
||||
BOOL resetAlarm;
|
||||
signed int daylightOffset;
|
||||
|
||||
[self event];
|
||||
@@ -406,6 +409,19 @@
|
||||
[eventDate setTimeZone: timeZone];
|
||||
co = [self clientObject];
|
||||
|
||||
resetAlarm = [[[context request] formValueForKey: @"resetAlarm"] boolValue];
|
||||
if (resetAlarm && [event hasAlarms] && ![event hasRecurrenceRules])
|
||||
{
|
||||
iCalAlarm *anAlarm;
|
||||
iCalTrigger *aTrigger;
|
||||
|
||||
anAlarm = [[event alarms] objectAtIndex: 0];
|
||||
aTrigger = [anAlarm trigger];
|
||||
[aTrigger setValue: 0 ofAttribute: @"x-webstatus" to: @"triggered"];
|
||||
|
||||
[co saveComponent: event];
|
||||
}
|
||||
|
||||
if ([co isNew] && [co isKindOfClass: [SOGoAppointmentOccurence class]])
|
||||
{
|
||||
// This is a new exception in a recurrent event -- compute the daylight
|
||||
@@ -421,6 +437,7 @@
|
||||
}
|
||||
}
|
||||
data = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[event tag], @"component",
|
||||
[dateFormatter formattedDate: eventDate], @"startDate",
|
||||
[dateFormatter formattedTime: eventDate], @"startTime",
|
||||
([event hasRecurrenceRules]? @"1": @"0"), @"isReccurent",
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentFolders.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
|
||||
|
||||
#import <UI/Common/WODirectAction+SOGo.h>
|
||||
|
||||
@@ -367,7 +368,7 @@ static NSArray *tasksFields = nil;
|
||||
//
|
||||
// We return:
|
||||
//
|
||||
// {complete Event ID (full path) => Fire date (UTC)}
|
||||
// [[calendar name (full path), 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.
|
||||
@@ -375,11 +376,9 @@ static NSArray *tasksFields = nil;
|
||||
// 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
|
||||
//
|
||||
// - returns alarms that will occur in the next 48 hours or the non-triggered alarms
|
||||
// for non-completed events
|
||||
// - recurring events are currently ignored
|
||||
//
|
||||
- (WOResponse *) alarmsListAction
|
||||
{
|
||||
@@ -388,9 +387,11 @@ static NSArray *tasksFields = nil;
|
||||
NSMutableArray *allAlarms;
|
||||
NSEnumerator *folders;
|
||||
WOResponse *response;
|
||||
int browserTime;
|
||||
unsigned int browserTime, laterTime;
|
||||
|
||||
// We look for alarms in the next 48 hours
|
||||
browserTime = [[[context request] formValueForKey: @"browserTime"] intValue];
|
||||
laterTime = browserTime + 60*60*48;
|
||||
clientObject = [self clientObject];
|
||||
allAlarms = [NSMutableArray array];
|
||||
|
||||
@@ -399,34 +400,32 @@ static NSArray *tasksFields = nil;
|
||||
{
|
||||
if ([currentFolder isActive])
|
||||
{
|
||||
NSDictionary *entry;;
|
||||
NSDictionary *entry;
|
||||
NSArray *alarms;
|
||||
int i, v;
|
||||
BOOL isCycle;
|
||||
int i;
|
||||
|
||||
// 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];
|
||||
alarms = [currentFolder fetchAlarmInfosFrom: [NSNumber numberWithInt: browserTime]
|
||||
to: [NSNumber numberWithInt: laterTime]];
|
||||
|
||||
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)
|
||||
isCycle = [[entry objectForKey: @"c_iscycle"] boolValue];
|
||||
|
||||
if (!isCycle)
|
||||
{
|
||||
[allAlarms addObject: [NSDictionary dictionaryWithObject: [entry objectForKey: @"c_nextalarm"]
|
||||
forKey: [entry objectForKey: @"c_name"]]];
|
||||
[allAlarms addObject: [NSArray arrayWithObjects:
|
||||
[currentFolder nameInContainer],
|
||||
[entry objectForKey: @"c_name"],
|
||||
[entry objectForKey: @"c_nextalarm"],
|
||||
nil]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
response = [self responseWithStatus: 200];
|
||||
[response appendContentString: [allAlarms jsonRepresentation]];
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
#import <NGObjWeb/SoPermissions.h>
|
||||
#import <NGObjWeb/SoSecurityManager.h>
|
||||
@@ -28,12 +30,16 @@
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
|
||||
#import <NGCards/iCalAlarm.h>
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalToDo.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/iCalToDo.h>
|
||||
#import <NGCards/iCalTrigger.h>
|
||||
|
||||
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoContentObject.h>
|
||||
#import <SoObjects/SOGo/SOGoDateFormatter.h>
|
||||
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
|
||||
#import <SoObjects/Appointments/SOGoTaskObject.h>
|
||||
|
||||
@@ -377,6 +383,59 @@
|
||||
// return [self jsCloseWithRefreshMethod: @"refreshTasks()"];
|
||||
// }
|
||||
|
||||
- (id <WOActionResults>) viewAction
|
||||
{
|
||||
WOResponse *result;
|
||||
NSDictionary *data;
|
||||
NSCalendarDate *startDate, *dueDate;
|
||||
NSTimeZone *timeZone;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
SOGoUser *user;
|
||||
BOOL resetAlarm;
|
||||
|
||||
[self todo];
|
||||
|
||||
result = [self responseWithStatus: 200];
|
||||
user = [context activeUser];
|
||||
timeZone = [user timeZone];
|
||||
dateFormatter = [user dateFormatterInContext: context];
|
||||
startDate = [todo startDate];
|
||||
[startDate setTimeZone: timeZone];
|
||||
dueDate = [todo due];
|
||||
[dueDate setTimeZone: timeZone];
|
||||
|
||||
resetAlarm = [[[context request] formValueForKey: @"resetAlarm"] boolValue];
|
||||
if (resetAlarm && [todo hasAlarms] && ![todo hasRecurrenceRules])
|
||||
{
|
||||
iCalAlarm *anAlarm;
|
||||
iCalTrigger *aTrigger;
|
||||
SOGoCalendarComponent *co;
|
||||
|
||||
anAlarm = [[todo alarms] objectAtIndex: 0];
|
||||
aTrigger = [anAlarm trigger];
|
||||
[aTrigger setValue: 0 ofAttribute: @"x-webstatus" to: @"triggered"];
|
||||
|
||||
co = [self clientObject];
|
||||
[co saveComponent: todo];
|
||||
}
|
||||
|
||||
data = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[todo tag], @"component",
|
||||
(startDate? [dateFormatter formattedDate: startDate] : @""), @"startDate",
|
||||
(startDate? [dateFormatter formattedTime: startDate] : @""), @"startTime",
|
||||
(dueDate? [dateFormatter formattedDate: dueDate] : @""), @"dueDate",
|
||||
(dueDate? [dateFormatter formattedTime: dueDate] : @""), @"dueTime",
|
||||
([todo hasRecurrenceRules]? @"1": @"0"), @"isReccurent",
|
||||
[todo summary], @"summary",
|
||||
[todo location], @"location",
|
||||
[todo comment], @"description",
|
||||
nil];
|
||||
|
||||
[result appendContentString: [data jsonRepresentation]];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request
|
||||
inContext: (WOContext*) context
|
||||
{
|
||||
|
||||
@@ -216,6 +216,11 @@
|
||||
};
|
||||
};
|
||||
methods = {
|
||||
view = {
|
||||
protectedBy = "ViewAllComponent";
|
||||
pageName = "UIxTaskEditor";
|
||||
actionName = "view";
|
||||
};
|
||||
edit = {
|
||||
protectedBy = "ViewAllComponent";
|
||||
pageName = "UIxTaskEditor";
|
||||
|
||||
Reference in New Issue
Block a user