Monotone-Parent: d840398d742d2ea0eea33b8c9140e15c3ba2dd63

Monotone-Revision: 2ad903f7aa0d1a5fd9efc71f4c23eefee39e1bdf

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-08-24T19:17:14
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2006-08-24 19:17:14 +00:00
parent a861c16a0c
commit 50abc82da1
3 changed files with 138 additions and 28 deletions

View File

@ -1,5 +1,17 @@
2006-08-24 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2006-08-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Scheduler/UIxCalWeekView.m ([UIxCalWeekView -weekBeforePrevWeekQueryParameters])
([UIxCalWeekView -prevWeekQueryParameters])
([UIxCalWeekView -nextWeekQueryParameters])
([UIxCalWeekView -weekAfterNextWeekQueryParameters]): new methods
that return the dates relatively to the current day.
([UIxCalWeekView -lastWeekName])
([UIxCalWeekView -currentWeekName])
([UIxCalWeekView -nextWeekName])
([UIxCalWeekView -weekAfterNextWeekName])
([UIxCalWeekView -_weekNumberWithOffsetFromToday:offset]): new
methods that returns the label for the corresponding weeks.
* UI/Scheduler/UIxCalDayTable.[hm]: new class module/component * UI/Scheduler/UIxCalDayTable.[hm]: new class module/component
used by UIxCalDayView and UIxCalWeekView to display the events used by UIxCalDayView and UIxCalWeekView to display the events
occuring in one or more days. occuring in one or more days.

View File

@ -1,4 +1,24 @@
// $Id: UIxCalWeekView.h 191 2004-08-12 16:28:32Z helge $ /* UIxCalWeekView.h - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* 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 __SOGo_UIxCalWeekView_H__ #ifndef __SOGo_UIxCalWeekView_H__
#define __SOGo_UIxCalWeekView_H__ #define __SOGo_UIxCalWeekView_H__
@ -8,13 +28,17 @@
@class NSDictionary; @class NSDictionary;
@interface UIxCalWeekView : UIxCalView @interface UIxCalWeekView : UIxCalView
{
}
/* Query Parameters */ - (NSDictionary *) weekBeforePrevWeekQueryParameters;
- (NSDictionary *) prevWeekQueryParameters;
- (NSDictionary *) nextWeekQueryParameters;
- (NSDictionary *) weekAfterNextWeekQueryParameters;
- (NSDictionary *)prevWeekQueryParameters; - (NSString *) weekBeforeLastWeekName;
- (NSDictionary *)nextWeekQueryParameters; - (NSString *) lastWeekName;
- (NSString *) currentWeekName;
- (NSString *) nextWeekName;
- (NSString *) weekAfterNextWeekName;
@end @end

View File

@ -1,46 +1,120 @@
// $Id: UIxCalWeekView.m 303 2004-09-10 15:23:10Z znek $ /* UIxCalWeekView.m - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* 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 <Foundation/NSArray.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <EOControl/EOQualifier.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <SOGoUI/SOGoDateFormatter.h>
#include "UIxCalWeekView.h" #include "UIxCalWeekView.h"
#include "common.h"
@implementation UIxCalWeekView @implementation UIxCalWeekView
- (NSCalendarDate *)startDate { - (NSCalendarDate *) startDate
return [[[super startDate] mondayOfWeek] beginOfDay]; {
return [[[super startDate] mondayOfWeek] beginOfDay];
} }
- (NSCalendarDate *)endDate { - (NSCalendarDate *) endDate
unsigned offset; {
unsigned offset;
if([self shouldDisplayWeekend]) if([self shouldDisplayWeekend])
offset = 7; offset = 7;
else else
offset = 5; offset = 5;
return [[[self startDate] dateByAddingYears:0 months:0 days:offset return [[[self startDate] dateByAddingYears:0 months:0 days:offset
hours:0 minutes:0 seconds:0] hours:0 minutes:0 seconds:0]
endOfDay]; endOfDay];
} }
- (NSArray *)appointments { - (NSArray *) appointments
{
return [self fetchCoreInfos]; return [self fetchCoreInfos];
} }
/* URLs */ /* URLs */
- (NSDictionary *)prevWeekQueryParameters { - (NSDictionary *) weekBeforePrevWeekQueryParameters
NSCalendarDate *date; {
return [self _dateQueryParametersWithOffset: -14];
date = [[self startDate] dateByAddingYears:0 months:0 days:-7
hours:0 minutes:0 seconds:0];
return [self queryParametersBySettingSelectedDate:date];
} }
- (NSDictionary *)nextWeekQueryParameters { - (NSDictionary *) prevWeekQueryParameters
{
return [self _dateQueryParametersWithOffset: -7];
}
- (NSDictionary *) nextWeekQueryParameters
{
return [self _dateQueryParametersWithOffset: 7];
}
- (NSDictionary *) weekAfterNextWeekQueryParameters
{
return [self _dateQueryParametersWithOffset: 14];
}
- (NSString *) _weekNumberWithOffsetFromToday: (int) offset
{
NSCalendarDate *date; NSCalendarDate *date;
NSString *format;
date = [[self startDate] dateByAddingYears:0 months:0 days:7
hours:0 minutes:0 seconds:0]; date = [[self startDate] dateByAddingYears: 0 months: 0 days: (offset * 7)
return [self queryParametersBySettingSelectedDate:date]; hours:0 minutes: 0 seconds: 0];
format = [self labelForKey: @"Week %d"];
return [NSString stringWithFormat: format, [date weekOfYear]];
}
- (NSString *) weekBeforeLastWeekName
{
return [self _weekNumberWithOffsetFromToday: -2];
}
- (NSString *) lastWeekName
{
return [self _weekNumberWithOffsetFromToday: -1];
}
- (NSString *) currentWeekName
{
return [self _weekNumberWithOffsetFromToday: 0];
}
- (NSString *) nextWeekName
{
return [self _weekNumberWithOffsetFromToday: 1];
}
- (NSString *) weekAfterNextWeekName
{
return [self _weekNumberWithOffsetFromToday: 2];
} }
@end /* UIxCalWeekView */ @end /* UIxCalWeekView */