diff --git a/ChangeLog b/ChangeLog index c44ce423b..f6d2bd851 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-10-11 Wolfgang Sourdeau + * UI/Scheduler/UIxCalTasksListView.[hm]: clone of + UIxCalAptListView adapted for the handling of tasks. + * UI/Scheduler/UIxTaskProposal.[hm], UI/Scheduler/UIxTaskView.[hm], UI/Scheduler/UIxTaskEditor.[hm]: clones of the UIxAppointment* classes for the handling of tasks. diff --git a/UI/Scheduler/UIxCalTasksListView.h b/UI/Scheduler/UIxCalTasksListView.h new file mode 100644 index 000000000..dd1ab3fd8 --- /dev/null +++ b/UI/Scheduler/UIxCalTasksListView.h @@ -0,0 +1,46 @@ +/* UIxCalTasksListView.h - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXCALTASKSLISTVIEW_H +#define UIXCALTASKSLISTVIEW_H + +#import "UIxCalView.h" + +@class NSDictionary; + +@interface UIxCalTasksListView : UIxCalView +{ + NSCalendarDate *startDate; + NSCalendarDate *endDate; + + BOOL knowsToHide; + BOOL hideCompleted; + + NSDictionary *currentTask; +} + +- (void) setCurrentTask: (NSDictionary *) task; +- (NSDictionary *) currentTask; + +@end + +#endif /* UIXCALTASKSLIST_H */ diff --git a/UI/Scheduler/UIxCalTasksListView.m b/UI/Scheduler/UIxCalTasksListView.m new file mode 100644 index 000000000..c91fd527b --- /dev/null +++ b/UI/Scheduler/UIxCalTasksListView.m @@ -0,0 +1,133 @@ +/* UIxCalTasksListView.m - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import +#import + +#import +#import + +#import + +#import "UIxCalTasksListView.h" + +@implementation UIxCalTasksListView + +- (id) init +{ + if ((self = [super init])) + { + startDate = nil; + endDate = nil; + knowsToHide = NO; + hideCompleted = NO; + } + + return self; +} + +- (void) setCurrentTask: (NSDictionary *) task +{ + currentTask = task; +} + +- (NSDictionary *) currentTask +{ + return currentTask; +} + +- (NSCalendarDate *) startDate +{ + return nil; +} + +- (NSCalendarDate *) endDate +{ + return nil; +} + +- (NSString *) currentStatusClass +{ + NSCalendarDate *taskDate, *now; + NSString *statusClass; + NSNumber *taskDueStamp; + + if ([[currentTask objectForKey: @"status"] intValue] == 1) + statusClass = @"completed"; + else + { + taskDueStamp = [currentTask objectForKey: @"enddate"]; + if ([taskDueStamp intValue]) + { + now = [NSCalendarDate calendarDate]; + taskDate = [NSCalendarDate dateWithTimeIntervalSince1970: + [taskDueStamp intValue]]; + if ([taskDate earlierDate: now] == taskDate) + statusClass = @"overdue"; + else + { + if ([taskDate isToday]) + statusClass = @"duetoday"; + else + statusClass = @"duelater"; + } + } + else + statusClass = @"duelater"; + } + + return statusClass; +} + +- (BOOL) shouldDisplayCurrentTask +{ + if (!knowsToHide) + { + hideCompleted + = [[self queryParameterForKey: @"hide-completed"] intValue]; + knowsToHide = YES; + } + + return !(hideCompleted + && [[currentTask objectForKey: @"status"] intValue] == 1); +} + +- (BOOL) shouldHideCompletedTasks +{ + if (!knowsToHide) + { + hideCompleted + = [[self queryParameterForKey: @"hide-completed"] intValue]; + knowsToHide = YES; + } + + return hideCompleted; +} + +- (BOOL) isCurrentTaskCompleted +{ + return ([[currentTask objectForKey: @"status"] intValue] == 1); +} + +@end diff --git a/UI/Templates/SchedulerUI/UIxCalTasksListView.wox b/UI/Templates/SchedulerUI/UIxCalTasksListView.wox new file mode 100644 index 000000000..ddcba251f --- /dev/null +++ b/UI/Templates/SchedulerUI/UIxCalTasksListView.wox @@ -0,0 +1,31 @@ + + +

Tasks

+ +
    +
  • +
    +
+