mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-30 10:47:17 +00:00
Improved read-only tasks/events web view
Monotone-Parent: af17dd6e983493b4bd201d8d0a23bdac014fa84c Monotone-Revision: 08f744da20c99e50446879fca5f5ee8194b2217b Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-07-29T18:46:44 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* UIxAppointmentEditor.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007 Inverse inc.
|
||||
* Copyright (C) 2007-2009 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
@@ -31,11 +31,12 @@
|
||||
@interface UIxAppointmentEditor : UIxComponent
|
||||
{
|
||||
iCalEvent *event;
|
||||
SOGoAppointmentFolder *componentCalendar;
|
||||
BOOL isAllDay, isTransparent;
|
||||
NSCalendarDate *aptStartDate;
|
||||
NSCalendarDate *aptEndDate;
|
||||
NSString *item;
|
||||
SOGoAppointmentFolder *componentCalendar;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
}
|
||||
|
||||
/* template values */
|
||||
@@ -55,6 +56,10 @@
|
||||
- (void) setAptEndDate: (NSCalendarDate *) newAptEndDate;
|
||||
- (NSCalendarDate *) aptEndDate;
|
||||
|
||||
- (NSString *) aptStartDateText;
|
||||
- (NSString *) aptStartDateTimeText;
|
||||
- (NSString *) aptEndDateTimeText;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXAPPOINTMENTEDITOR_H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* UIxAppointmentEditor.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007 Inverse inc.
|
||||
* Copyright (C) 2007-2009 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
@@ -59,6 +59,8 @@
|
||||
|
||||
- (id) init
|
||||
{
|
||||
SOGoUser *user;
|
||||
|
||||
if ((self = [super init]))
|
||||
{
|
||||
aptStartDate = nil;
|
||||
@@ -68,6 +70,9 @@
|
||||
isAllDay = NO;
|
||||
isTransparent = NO;
|
||||
componentCalendar = nil;
|
||||
|
||||
user = [[self context] activeUser];
|
||||
ASSIGN (dateFormatter, [user dateFormatterInContext: context]);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -79,6 +84,7 @@
|
||||
[[event parent] release];
|
||||
[aptStartDate release];
|
||||
[aptEndDate release];
|
||||
[dateFormatter release];
|
||||
[componentCalendar release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -167,6 +173,22 @@
|
||||
ASSIGN (componentCalendar, _componentCalendar);
|
||||
}
|
||||
|
||||
/* read-only event */
|
||||
- (NSString *) aptStartDateText
|
||||
{
|
||||
return [dateFormatter formattedDate: aptStartDate];
|
||||
}
|
||||
|
||||
- (NSString *) aptStartDateTimeText
|
||||
{
|
||||
return [dateFormatter formattedDateAndTime: aptStartDate];
|
||||
}
|
||||
|
||||
- (NSString *) aptEndDateTimeText
|
||||
{
|
||||
return [dateFormatter formattedDateAndTime: aptEndDate];
|
||||
}
|
||||
|
||||
/* actions */
|
||||
- (NSCalendarDate *) newStartDate
|
||||
{
|
||||
@@ -207,11 +229,14 @@
|
||||
{
|
||||
NSCalendarDate *startDate, *endDate;
|
||||
NSString *duration;
|
||||
NSTimeZone *timeZone;
|
||||
unsigned int minutes;
|
||||
SOGoObject <SOGoComponentOccurence> *co;
|
||||
|
||||
[self event];
|
||||
co = [self clientObject];
|
||||
timeZone = [[context activeUser] timeZone];
|
||||
|
||||
if ([co isNew]
|
||||
&& [co isKindOfClass: [SOGoCalendarComponent class]])
|
||||
{
|
||||
@@ -228,7 +253,6 @@
|
||||
else
|
||||
{
|
||||
NSCalendarDate *firstDate;
|
||||
NSTimeZone *timeZone;
|
||||
iCalEvent *master;
|
||||
signed int daylightOffset;
|
||||
|
||||
@@ -241,7 +265,6 @@
|
||||
// saving time with respect to the first occurrence of the recurrent event.
|
||||
master = (iCalEvent*)[[event parent] firstChildWithTag: @"vevent"];
|
||||
firstDate = [master startDate];
|
||||
timeZone = [[context activeUser] timeZone];
|
||||
|
||||
if ([timeZone isDaylightSavingTimeForDate: startDate] != [timeZone isDaylightSavingTimeForDate: firstDate])
|
||||
{
|
||||
@@ -259,7 +282,10 @@
|
||||
isTransparent = ![event isOpaque];
|
||||
}
|
||||
|
||||
[startDate setTimeZone: timeZone];
|
||||
ASSIGN (aptStartDate, startDate);
|
||||
|
||||
[endDate setTimeZone: timeZone];
|
||||
ASSIGN (aptEndDate, endDate);
|
||||
|
||||
return self;
|
||||
@@ -392,7 +418,6 @@
|
||||
NSDictionary *data;
|
||||
NSCalendarDate *firstDate, *eventDate;
|
||||
NSTimeZone *timeZone;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
SOGoUser *user;
|
||||
SOGoCalendarComponent *co;
|
||||
iCalEvent *master;
|
||||
@@ -404,7 +429,6 @@
|
||||
result = [self responseWithStatus: 200];
|
||||
user = [context activeUser];
|
||||
timeZone = [user timeZone];
|
||||
dateFormatter = [user dateFormatterInContext: context];
|
||||
eventDate = [event startDate];
|
||||
[eventDate setTimeZone: timeZone];
|
||||
co = [self clientObject];
|
||||
|
||||
@@ -978,8 +978,14 @@ iRANGE(2);
|
||||
- (NSNumber *) reply
|
||||
{
|
||||
iCalPersonPartStat participationStatus;
|
||||
LDAPUserManager *um;
|
||||
NSString *owner, *ownerEmail;
|
||||
|
||||
participationStatus = [[component findParticipant: [context activeUser]] participationStatus];
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
owner = [componentCalendar ownerInContext: context];
|
||||
ownerEmail = [um getEmailForUID: owner];
|
||||
// We assume the owner is part of the participants
|
||||
participationStatus = [[component findParticipantWithEmail: (id)ownerEmail] participationStatus];
|
||||
return [NSNumber numberWithInt: participationStatus];
|
||||
}
|
||||
|
||||
@@ -2050,49 +2056,4 @@ RANGE(2);
|
||||
return [self getEventRWType] == 1;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) getDateFor: (NSString *) when
|
||||
{
|
||||
NSCalendarDate *startDate, *endDate, *firstDate, *rc;
|
||||
NSTimeZone *timeZone;
|
||||
iCalEvent *master;
|
||||
signed int daylightOffset;
|
||||
|
||||
startDate = [component startDate];
|
||||
daylightOffset = 0;
|
||||
|
||||
if ([component isKindOfClass: [SOGoAppointmentOccurence class]])
|
||||
{
|
||||
master = (iCalEvent*)[[component parent] firstChildWithTag: @"vevent"];
|
||||
firstDate = [master startDate];
|
||||
timeZone = [[context activeUser] timeZone];
|
||||
|
||||
if ([timeZone isDaylightSavingTimeForDate: startDate] != [timeZone isDaylightSavingTimeForDate: firstDate])
|
||||
{
|
||||
daylightOffset = (signed int)[timeZone secondsFromGMTForDate: firstDate]
|
||||
- (signed int)[timeZone secondsFromGMTForDate: startDate];
|
||||
startDate = [startDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:daylightOffset];
|
||||
}
|
||||
}
|
||||
[startDate setTimeZone: [[context activeUser] timeZone]];
|
||||
endDate = [[component endDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:daylightOffset];
|
||||
[endDate setTimeZone: [[context activeUser] timeZone]];
|
||||
|
||||
if ([when isEqualToString: @"start"])
|
||||
rc = startDate;
|
||||
else
|
||||
rc = endDate;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (NSString *) startDateString
|
||||
{
|
||||
return [[self getDateFor: @"start"] description];
|
||||
}
|
||||
|
||||
- (NSString *) endDateString
|
||||
{
|
||||
return [[self getDateFor: @"end"] description];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* UIxTaskEditor.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007 Inverse inc.
|
||||
* Copyright (C) 2007-2009 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
@@ -39,6 +39,7 @@
|
||||
BOOL hasStartDate;
|
||||
BOOL hasDueDate;
|
||||
NSString *item;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
}
|
||||
|
||||
/* template values */
|
||||
@@ -52,6 +53,10 @@
|
||||
- (void) setTaskDueDate: (NSCalendarDate *) _date;
|
||||
- (NSCalendarDate *) taskDueDate;
|
||||
|
||||
- (NSString *) taskStartDateTimeText;
|
||||
- (NSString *) taskDueDateTimeText;
|
||||
- (NSString *) statusDateText;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXAPPOINTMENTEDITOR_H */
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
|
||||
- (id) init
|
||||
{
|
||||
SOGoUser *user;
|
||||
|
||||
if ((self = [super init]))
|
||||
{
|
||||
taskStartDate = nil;
|
||||
@@ -61,6 +63,9 @@
|
||||
statusPercent = nil;
|
||||
item = nil;
|
||||
todo = nil;
|
||||
|
||||
user = [[self context] activeUser];
|
||||
ASSIGN (dateFormatter, [user dateFormatterInContext: context]);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -73,6 +78,7 @@
|
||||
[statusDate release];
|
||||
[status release];
|
||||
[statusPercent release];
|
||||
[dateFormatter release];
|
||||
[[todo parent] release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -165,6 +171,12 @@
|
||||
|
||||
- (NSString *) itemStatusText
|
||||
{
|
||||
if (!item)
|
||||
{
|
||||
item = status;
|
||||
if (!item)
|
||||
item = @"NOT-SPECIFIED";
|
||||
}
|
||||
return [self labelForKey: [NSString stringWithFormat: @"status_%@", item]];
|
||||
}
|
||||
|
||||
@@ -219,6 +231,23 @@
|
||||
return statusPercent;
|
||||
}
|
||||
|
||||
/* viewing read-only tasks */
|
||||
|
||||
- (NSString *) taskStartDateTimeText
|
||||
{
|
||||
return [dateFormatter formattedDateAndTime: taskStartDate];
|
||||
}
|
||||
|
||||
- (NSString *) taskDueDateTimeText
|
||||
{
|
||||
return [dateFormatter formattedDateAndTime: taskDueDate];
|
||||
}
|
||||
|
||||
- (NSString *) statusDateText
|
||||
{
|
||||
return [dateFormatter formattedDate: statusDate];
|
||||
}
|
||||
|
||||
/* actions */
|
||||
- (NSCalendarDate *) newStartDate
|
||||
{
|
||||
@@ -259,20 +288,27 @@
|
||||
{
|
||||
NSCalendarDate *startDate, *dueDate;
|
||||
NSString *duration;
|
||||
NSTimeZone *timeZone;
|
||||
unsigned int minutes;
|
||||
|
||||
[self todo];
|
||||
if (todo)
|
||||
{
|
||||
timeZone = [[context activeUser] timeZone];
|
||||
startDate = [todo startDate];
|
||||
dueDate = [todo due];
|
||||
hasStartDate = (startDate != nil);
|
||||
hasDueDate = (dueDate != nil);
|
||||
ASSIGN (status, [todo status]);
|
||||
if ([status isEqualToString: @"COMPLETED"])
|
||||
ASSIGN (statusDate, [todo completed]);
|
||||
{
|
||||
ASSIGN (statusDate, [todo completed]);
|
||||
[statusDate setTimeZone: timeZone];
|
||||
}
|
||||
else
|
||||
ASSIGN (statusDate, [self newStartDate]);
|
||||
{
|
||||
ASSIGN (statusDate, [self newStartDate]);
|
||||
}
|
||||
ASSIGN (statusPercent, [todo percentComplete]);
|
||||
}
|
||||
else
|
||||
@@ -292,7 +328,10 @@
|
||||
ASSIGN (statusPercent, @"");
|
||||
}
|
||||
|
||||
[startDate setTimeZone: timeZone];
|
||||
ASSIGN (taskStartDate, startDate);
|
||||
|
||||
[dueDate setTimeZone: timeZone];
|
||||
ASSIGN (taskDueDate, dueDate);
|
||||
|
||||
/* here comes the code for initializing repeat, reminder and isAllDay... */
|
||||
@@ -389,7 +428,6 @@
|
||||
NSDictionary *data;
|
||||
NSCalendarDate *startDate, *dueDate;
|
||||
NSTimeZone *timeZone;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
SOGoUser *user;
|
||||
BOOL resetAlarm;
|
||||
|
||||
@@ -398,7 +436,6 @@
|
||||
result = [self responseWithStatus: 200];
|
||||
user = [context activeUser];
|
||||
timeZone = [user timeZone];
|
||||
dateFormatter = [user dateFormatterInContext: context];
|
||||
startDate = [todo startDate];
|
||||
[startDate setTimeZone: timeZone];
|
||||
dueDate = [todo due];
|
||||
|
||||
Reference in New Issue
Block a user