+2004-08-12 <helge@agenor.opengroupware.org>
+
+ * v0.9.4
+
+ * SOGoAppointmentFolder.m: added -baseURLForAptWithUID:inContext: for
+ determining the resource URL of an appointment, used by calendar
+ views to locate the viewer page
+
2004-08-11 Helge Hess <helge.hess@skyrix.com>
* SOGoGroupAppointmentFolder: can merge input folders, tracks conflicts
from:(NSCalendarDate *)_startDate
to:(NSCalendarDate *)_endDate;
+/* URL generation */
+
+- (NSString *)baseURLForAptWithUID:(NSString *)_uid inContext:(id)_ctx;
+
@end
#endif /* __Appointments_SOGoAppointmentFolder_H__ */
return [self fetchCoreInfosFromFolder:folder from:_startDate to:_endDate];
}
+/* URL generation */
+
+- (NSString *)baseURLForAptWithUID:(NSString *)_uid inContext:(id)_ctx {
+ NSString *url;
+
+ if ([_uid length] == 0)
+ return nil;
+
+ url = [self baseURLInContext:_ctx];
+ if (![url hasSuffix:@"/"])
+ url = [url stringByAppendingString:@"/"];
+ return [url stringByAppendingString:_uid];
+}
+
/* GET */
- (id)GETAction:(WOContext *)_ctx {
memberFolders:folders];
}
+/* URL generation */
+
+- (NSString *)baseURLForAptWithUID:(NSString *)_uid inContext:(id)_ctx {
+ //NSString *url;
+
+ if ([_uid length] == 0)
+ return nil;
+
+#warning TODO: fix URL generation for aggregate
+ [self logWithFormat:@"FIXME: URL generation for viewer"];
+
+ // need to locate the folder containing the apt, then call it
+ return [super baseURLForAptWithUID:_uid inContext:_ctx];
+}
+
@end /* SOGoGroupAppointmentFolder */
# $Id: Version,v 1.9 2004/05/19 14:30:45 helge Exp $
-SUBMINOR_VERSION:=3
+SUBMINOR_VERSION:=4
2004-08-12 Helge Hess <helge.hess@skyrix.com>
- * added (still empty) proposal component (v0.9.21)
+ * v0.9.22
+ * UIxAppointmentView.m: properly catch invalid appointment references
+ and return a 404 (because SOGoAppointmentObject's are created even
+ for invalid IDs for performance reasons)
+
+ * UIxCalView.m: generate appointment URLs using clientObject (the
+ appointment folder)
+
+ * more cleanups
+
+ * added (still empty) proposal component (v0.9.21)
+
* some code reorganizations, fixed some compile warnings (v0.9.20)
2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
SchedulerUIProduct.m \
UIxAppointmentFormatter.m \
iCalPerson+UIx.m \
+ NSCalendarDate+UIx.m \
+ \
UIxCalView.m \
UIxCalDayView.m \
UIxCalWeekView.m \
UIxCalMonthOverview
UIxCalWeekView
UIxCalWeekOverview
+ UIxCalWeekPrintview
+ UIxCalWeekColumnsview
+ UIxCalWeekListview
+ UIxCalWeekChartview
+ UIxCalDayView
+ UIxCalDayOverview
+ UIxCalDayChartview
UIxAptTableView
SchedulerUIProduct
TBD:
- UIxCalDayView
- UIxCalDayOverview
- UIxCalDayChart
- UIxCalDayHChart
- [UIxCalWeekView]
- UIxCalWeekColumnView
- UIxCalWeekChart
- UIxCalWeekHChart
+ UIxCalDayHChart?
+ UIxCalWeekHChart?
OGoYearOverview - should use aggressive caching in the long run
- editor page (which comes up in a new window)
--- /dev/null
+/*
+ Copyright (C) 2004 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo 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 Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+// $Id: UIxAppointmentEditor.m 181 2004-08-11 15:13:25Z helge $
+
+#ifndef __NSCalendarDate_UIx_H__
+#define __NSCalendarDate_UIx_H__
+
+#import <Foundation/NSCalendarDate.h>
+
+@interface NSCalendarDate(UIx)
+
+- (NSCalendarDate *)dayOfWeeK:(unsigned)_day offsetFromSunday:(unsigned)_off;
+- (NSCalendarDate *)sundayOfWeek;
+
+@end
+
+#endif /* __NSCalendarDate_UIx_H__ */
--- /dev/null
+/*
+ Copyright (C) 2004 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo 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 Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+// $Id: UIxAppointmentEditor.m 181 2004-08-11 15:13:25Z helge $
+
+#include "NSCalendarDate+UIx.h"
+#include "common.h"
+
+@implementation NSCalendarDate(UIx)
+
+- (NSCalendarDate *)dayOfWeeK:(unsigned)_day
+ offsetFromSunday:(unsigned)_offset
+{
+ unsigned dayOfWeek, distance;
+
+ /* perform "locale" correction */
+ dayOfWeek = (7 + [self dayOfWeek] - _offset) % 7;
+
+ _day = (_day % 7);
+ if(_day == dayOfWeek)
+ return self;
+
+ distance = _day - dayOfWeek;
+ return [self dateByAddingYears:0 months:0 days:distance];
+}
+
+/* this implies that monday is the start of week! */
+
+- (NSCalendarDate *)sundayOfWeek {
+ return [self dayOfWeeK:6 offsetFromSunday:1];
+}
+
+@end /* NSCalendarDate(UIx) */
- (SOGoAppointment *)appointment {
- if(self->appointment == nil) {
+ if (self->appointment == nil) {
self->appointment = [[SOGoAppointment alloc]
initWithICalString:[self iCalString]];
}
/* helper */
- (NSString *)uriAsFormat {
+ // TODO: replace that with "-uriToCallMethodNamed:" or sth like this
NSString *uri, *qp;
- NSRange r;
-
+ NSRange r;
+
uri = [[[self context] request] uri];
/* first: identify query parameters */
/* next: append format token */
uri = [uri stringByAppendingString:@"%@"];
- if(qp != nil)
+ if (qp != nil)
uri = [uri stringByAppendingString:qp];
return uri;
}
/* new */
-
- (id)newAction {
/*
This method creates a unique ID and redirects to the "edit" method on the
Note: 'clientObject' is the SOGoAppointmentFolder!
*/
- WORequest *req;
- WOResponse *r;
NSString *uri, *uriFormat, *objectId, *nextMethod;
objectId = [NSClassFromString(@"SOGoAppointmentFolder")
nextMethod = [NSString stringWithFormat:@"%@/edit", objectId];
uriFormat = [self uriAsFormat];
- uri = [[NSString alloc] initWithFormat:uriFormat, nextMethod];
- req = [[self context] request];
- r = [WOResponse responseWithRequest:req];
- [r setStatus:302 /* moved */];
- [r setHeader:uri forKey:@"location"];
- [uri release]; uri = nil;
- return r;
+ uri = [NSString stringWithFormat:uriFormat, nextMethod];
+
+ return [self redirectToLocation:uri];
}
-
/* save */
/* returned dates are in GMT */
- (NSCalendarDate *)_dateFromString:(NSString *)_str {
- NSCalendarDate *date;
-
- date = [NSCalendarDate dateWithString:_str
- calendarFormat:@"%Y-%m-%d %H:%M %Z"];
- [date setTimeZone:[self backendTimeZone]];
- return date;
+ NSCalendarDate *date;
+
+ date = [NSCalendarDate dateWithString:_str
+ calendarFormat:@"%Y-%m-%d %H:%M %Z"];
+ [date setTimeZone:[self backendTimeZone]];
+ return date;
}
- (id)saveAction {
NSCalendarDate *sd, *ed;
NSArray *ps;
unsigned i, count;
- WOResponse *r;
WORequest *req;
-
+
req = [[self context] request];
/* get iCalString from hidden input */
iCalString = [apt iCalString];
[apt release]; apt = nil;
-#if 0
- NSLog(@"%s new iCalString:\n%@", __PRETTY_FUNCTION__, iCalString);
-#else
{
NSException *ex;
if (ex) return ex;
// TODO: add some error handling in form! (eg like in Zope)
}
-#endif
uriFormat = [self uriAsFormat];
uri = [NSString stringWithFormat:uriFormat, @"view"];
-
- r = [WOResponse responseWithRequest:req];
- [r setStatus:302 /* moved */];
- [r setHeader:uri forKey:@"location"];
- return r;
+ return [self redirectToLocation:uri];
}
@end /* UIxAppointmentEditor */
#include "UIxAppointmentView.h"
#include "common.h"
+#include <NGiCal/NGiCal.h>
#include <SOGoLogic/SOGoAppointment.h>
@implementation UIxAppointmentView
if (self->appointment)
return self->appointment;
-
+
iCalString = [[self clientObject] valueForKey:@"iCalString"];
- if ([iCalString length] == 0) {
- [self logWithFormat:@"ERROR(%s): missing iCal string!",
+ if (![iCalString isNotNull] || [iCalString length] == 0) {
+ [self debugWithFormat:@"ERROR(%s): missing iCal string!",
__PRETTY_FUNCTION__];
return nil;
}
}
- (NSString *)debugTabLink {
- return [self completeHrefForMethod:[self ownMethodName]
- withParameter:@"debug"
- forKey:@"tab"];
+ return [self completeHrefForMethod:[self ownMethodName]
+ withParameter:@"debug"
+ forKey:@"tab"];
}
- (NSString *)completeHrefForMethod:(NSString *)_method
withParameter:(NSString *)_param
forKey:(NSString *)_key
{
- NSString *href;
+ NSString *href;
- [self setQueryParameter:_param forKey:_key];
- href = [self completeHrefForMethod:[self ownMethodName]];
- [self setQueryParameter:nil forKey:_key];
- return href;
+ [self setQueryParameter:_param forKey:_key];
+ href = [self completeHrefForMethod:[self ownMethodName]];
+ [self setQueryParameter:nil forKey:_key];
+ return href;
+}
+
+/* action */
+
+- (id)defaultAction {
+ if ([self appointment] == nil) {
+ return [NSException exceptionWithHTTPStatus:404 /* Not Found */
+ reason:@"could not locate appointment"];
+ }
+
+ return self;
}
@end /* UIxAppointmentView */
// $Id$
#include "UIxCalMonthView.h"
-#include <NGExtensions/NGExtensions.h>
+#include "NSCalendarDate+UIx.h"
#include "common.h"
-
-@interface NSCalendarDate (UIxCalMonthViewExtensions)
-- (NSCalendarDate *)dayOfWeeK:(unsigned)_day
- offsetFromSunday:(unsigned)_offset;
-- (NSCalendarDate *)sundayOfWeek;
-@end
-
-@implementation NSCalendarDate (UIxCalMonthViewExtensions)
-- (NSCalendarDate *)dayOfWeeK:(unsigned)_day
- offsetFromSunday:(unsigned)_offset
-{
- unsigned dayOfWeek, distance;
-
- /* perform "locale" correction */
- dayOfWeek = (7 + [self dayOfWeek] - _offset) % 7;
-
- _day = (_day % 7);
- if(_day == dayOfWeek)
- return self;
-
- distance = _day - dayOfWeek;
- return [self dateByAddingYears:0 months:0 days:distance];
-}
-
-/* this implies that monday is the start of week! */
-- (NSCalendarDate *)sundayOfWeek {
- return [self dayOfWeeK:6 offsetFromSunday:1];
-}
-@end
-
@implementation UIxCalMonthView
- (NSCalendarDate *)startOfMonth {
- return [[[super startDate] firstDayOfMonth] beginOfDay];
+ return [[[super startDate] firstDayOfMonth] beginOfDay];
}
- (NSCalendarDate *)startDate {
}
- (NSCalendarDate *)endDate {
- NSCalendarDate *date = [self startOfMonth];
- date = [date dateByAddingYears:0
- months:0
- days:[date numberOfDaysInMonth]
- hours:0
- minutes:0
- seconds:0];
+ NSCalendarDate *date;
+
+ date = [self startOfMonth];
+ date = [date dateByAddingYears:0 months:0 days:[date numberOfDaysInMonth]
+ hours:0 minutes:0 seconds:0];
date = [[date sundayOfWeek] endOfDay];
return date;
}
/* URLs */
-
- (NSDictionary *)prevMonthQueryParameters {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [[self startOfMonth] dateByAddingYears:0
- months:-1
- days:0
- hours:0
- minutes:0
- seconds:0];
- return [self queryParametersBySettingSelectedDate:date];
+ date = [[self startOfMonth] dateByAddingYears:0 months:-1 days:0
+ hours:0 minutes:0 seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
- (NSDictionary *)nextMonthQueryParameters {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [[self startOfMonth] dateByAddingYears:0
- months:1
- days:0
- hours:0
- minutes:0
- seconds:0];
- return [self queryParametersBySettingSelectedDate:date];
+ date = [[self startOfMonth] dateByAddingYears:0 months:1 days:0
+ hours:0 minutes:0 seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
@end /* UIxCalMonthView */
const:selectedTabStyle="tab_selected"
const:bodyStyle="tabview_body"
>
- <uix:tab const:key="day" var:label="dayLabel" var:href="daytabLink">
+ <uix:tab const:key="day" var:label="dayLabel" var:href="daytabLink">
<var:component-content />
- </uix:tab>
- <uix:tab const:key="week" var:label="weekLabel" var:href="weektabLink">
+ </uix:tab>
+ <uix:tab const:key="week" var:label="weekLabel" var:href="weektabLink">
<var:component-content />
- </uix:tab>
- <uix:tab const:key="month" var:label="monthLabel" var:href="monthtabLink">
+ </uix:tab>
+ <uix:tab const:key="month" var:label="monthLabel" var:href="monthtabLink">
<var:component-content />
- </uix:tab>
- <uix:tab const:key="year" var:label="yearLabel" var:href="yeartabLink">
+ </uix:tab>
+ <uix:tab const:key="year" var:label="yearLabel" var:href="yeartabLink">
<var:component-content />
- </uix:tab>
+ </uix:tab>
</uix:tabview>
#include <SOGoUI/UIxComponent.h>
-@class NSArray, NSCalendarDate;
+/*
+ UIxCalView
+
+ Superclass for most components which render a set of appointments coming from
+ a SOPE clientObject (which usually is an SOGoAppointmentFolder).
+*/
+
+@class NSString, NSArray, NSDictionary, NSCalendarDate;
@interface UIxCalView : UIxComponent
{
- NSArray *appointments;
- NSArray *allDayApts;
- id appointment;
+ NSArray *appointments;
+ NSArray *allDayApts;
+ id appointment;
NSCalendarDate *currentDay;
}
- (NSArray *)fetchCoreInfos;
/* date selection */
+
- (NSDictionary *)todayQueryParameters;
- (NSDictionary *)currentDayQueryParameters;
- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date;
- (void)setSelectedDateQueryParameter:(NSCalendarDate *)_newDate
- inDictionary:(NSMutableDictionary *)_qp;
+ inDictionary:(NSMutableDictionary *)_qp;
@end
/* defaults */
-
- (BOOL)showFullNames {
- return YES;
+ return YES;
}
- (BOOL)showAMPMDates {
- return NO;
+ return NO;
}
- (unsigned)dayStartHour {
- return 8;
+ return 8;
}
- (unsigned)dayEndHour {
- return 18;
+ return 18;
}
- (BOOL)shouldDisplayWeekend {
- return NO;
+ return NO;
}
- (NSString *)appointmentViewURL {
id pkey;
- if ((pkey = [[self appointment] valueForKey:@"uid"]) == nil)
+ if (![(pkey = [[self appointment] valueForKey:@"uid"]) isNotNull])
return nil;
- return [NSString stringWithFormat:@"%@/view", pkey];
+ return [[[self clientObject] baseURLForAptWithUID:[pkey stringValue]
+ inContext:[self context]]
+ stringByAppendingString:@"/view"];
}
/* resource URLs (TODO?) */
- (NSString *)resourcePath {
+ // TODO: broken
return @"/sogod.woa/WebServerResources/";
}
/* Actions */
- (NSString *)_userFolderURI {
- WOContext *ctx;
- id obj;
- NSURL *url;
+ WOContext *ctx;
+ id obj;
+ NSURL *url;
- ctx = [self context];
- obj = [[ctx objectTraversalStack] objectAtIndex:1];
- url = [NSURL URLWithString:[obj baseURLInContext:ctx]];
- return [url path];
+ ctx = [self context];
+ obj = [[ctx objectTraversalStack] objectAtIndex:1];
+ url = [NSURL URLWithString:[obj baseURLInContext:ctx]];
+ return [url path];
}
- (id)redirectForUIDsAction {
- NSMutableString *uri;
- NSString *uidsString, *loc, *prevMethod;
- WOResponse *r;
- WORequest *req;
-
- req = [[self context] request];
-
- uidsString = [req formValueForKey:@"anaisUIDString"];
- uidsString = [uidsString stringByTrimmingWhiteSpaces];
- if([uidsString length] == 0) {
- // TODO: improve user experience ... (eg error panel like Zope)
- return [NSException exceptionWithHTTPStatus:400 /* bad request */
- reason:@"missing uids from request"];
- }
- prevMethod = [req formValueForKey:@"previousMethod"];
- if(prevMethod == nil)
- prevMethod = @"";
-
- uri = [[NSMutableString alloc] initWithString:[self _userFolderURI]];
- [uri appendString:@"/Groups/_custom_"];
- [uri appendString:uidsString];
- [uri appendString:@"/Calendar/"];
- [uri appendString:prevMethod];
-
- loc = [self completeHrefForMethod:uri]; /* this might return uri! */
- r = [WOResponse responseWithRequest:req];
- [r setStatus:302 /* moved */];
- [r setHeader:loc forKey:@"location"];
- [uri release];
- return r;
+ NSMutableString *uri;
+ NSString *uidsString, *loc, *prevMethod;
+ WORequest *req;
+
+ req = [[self context] request];
+
+ uidsString = [req formValueForKey:@"anaisUIDString"];
+ uidsString = [uidsString stringByTrimmingWhiteSpaces];
+ if ([uidsString length] == 0) {
+ // TODO: improve user experience ... (eg error panel like Zope)
+ return [NSException exceptionWithHTTPStatus:400 /* bad request */
+ reason:@"missing uids from request"];
+ }
+
+ prevMethod = [req formValueForKey:@"previousMethod"];
+ if (prevMethod == nil)
+ prevMethod = @"";
+
+ uri = [[NSMutableString alloc] initWithString:[self _userFolderURI]];
+ [uri appendString:@"/Groups/_custom_"];
+ [uri appendString:uidsString];
+ [uri appendString:@"/Calendar/"];
+ [uri appendString:prevMethod];
+
+ loc = [self completeHrefForMethod:uri]; /* this might return uri! */
+
+ return [self redirectToLocation:loc];
}
@end /* UIxCalView */
#include "UIxCalWeekView.h"
-#include "common.h"
@interface UIxCalWeekChartview : UIxCalWeekView
{
-
}
@end
+#include "common.h"
@implementation UIxCalWeekChartview
+@end /* UIxCalWeekChartview */
-@end
#include "UIxCalWeekView.h"
-#include "common.h"
@interface UIxCalWeekColumnsview : UIxCalWeekView
{
- int dayIndex;
+ int dayIndex;
}
@end
+#include "common.h"
@implementation UIxCalWeekColumnsview
- (NSArray *)appointments {
- return [self fetchCoreInfos];
+ return [self fetchCoreInfos];
}
- (void)setDayIndex:(char)_idx {
- NSCalendarDate *d;
+ NSCalendarDate *d;
- if ((self->dayIndex == _idx) && (self->currentDay != nil))
- return;
+ if ((self->dayIndex == _idx) && (self->currentDay != nil))
+ return;
- self->dayIndex = _idx;
+ self->dayIndex = _idx;
- if (_idx > 0) {
- d = [[self startDate]
- dateByAddingYears:0 months:0 days:_idx
- hours:0 minutes:0 seconds:0];
- }
- else
- d = [self startDate];
+ if (_idx > 0) {
+ d = [[self startDate] dateByAddingYears:0 months:0 days:_idx
+ hours:0 minutes:0 seconds:0];
+ }
+ else
+ d = [self startDate];
- [self setCurrentDay:d];
+ [self setCurrentDay:d];
}
- (int)dayIndex {
- return self->dayIndex;
+ return self->dayIndex;
}
/* style sheet */
- (NSString *)titleStyle {
- if([self->currentDay isToday])
- return @"weekcolumnsview_title_hilite";
- return @"weekcolumnsview_title";
+ return [self->currentDay isToday]
+ ? @"weekcolumnsview_title_hilite"
+ : @"weekcolumnsview_title";
}
-
- (NSString *)contentStyle {
- if([self->currentDay isToday])
- return @"weekcolumnsview_content_hilite";
- return @"weekcolumnsview_content";
+ return [self->currentDay isToday]
+ ? @"weekcolumnsview_content_hilite"
+ : @"weekcolumnsview_content";
}
-@end
+@end /* UIxCalWeekColumnsview */
*/
// $Id$
-
#include "UIxCalWeekOverview.h"
-
@interface UIxCalWeekPrintview : UIxCalWeekOverview
{
}
#include "UIxCalView.h"
+@class NSDictionary;
+
@interface UIxCalWeekView : UIxCalView
{
}
// $Id$
#include "UIxCalWeekView.h"
-#include <NGExtensions/NGExtensions.h>
#include "common.h"
@implementation UIxCalWeekView
- (NSCalendarDate *)endDate {
return [[[self startDate] dateByAddingYears:0 months:0 days:7
- hours:0 minutes:0 seconds:0]
+ hours:0 minutes:0 seconds:0]
endOfDay];
}
/* URLs */
- (NSDictionary *)prevWeekQueryParameters {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [[self startDate] dateByAddingYears:0 months:0 days:-7
- hours:0 minutes:0 seconds:0];
- return [self queryParametersBySettingSelectedDate:date];
+ date = [[self startDate] dateByAddingYears:0 months:0 days:-7
+ hours:0 minutes:0 seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
- (NSDictionary *)nextWeekQueryParameters {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [[self startDate] dateByAddingYears:0 months:0 days:7
- hours:0 minutes:0 seconds:0];
- return [self queryParametersBySettingSelectedDate:date];
+ date = [[self startDate] dateByAddingYears:0 months:0 days:7
+ hours:0 minutes:0 seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
@end /* UIxCalWeekView */
*/
// $Id$
-
#include <SOGoUI/UIxComponent.h>
-#include <Foundation/Foundation.h>
-#include <NGExtensions/NGExtensions.h>
-
@interface UIxCalYearOverview : UIxComponent
{
- NSArray *row;
- NSCalendarDate *month;
+ NSArray *row;
+ NSCalendarDate *month;
}
- (NSCalendarDate *)startDate;
+
- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date;
+
- (void)setSelectedDateQueryParameter:(NSCalendarDate *)_newDate
- inDictionary:(NSMutableDictionary *)_qp;
+ inDictionary:(NSMutableDictionary *)_qp;
@end
+#include "common.h"
@implementation UIxCalYearOverview
-/* init & dealloc */
-
- (void)dealloc {
[self->row release];
[self->month release];
[super dealloc];
}
-
/* accessors */
- (void)setRow:(NSArray *)_row {
- ASSIGN(self->row, _row);
+ ASSIGN(self->row, _row);
}
-
- (NSArray *)row {
- return self->row;
+ return self->row;
}
- (void)setMonth:(NSCalendarDate *)_date {
- ASSIGN(self->month, _date);
+ ASSIGN(self->month, _date);
}
-
- (NSCalendarDate *)month {
- return self->month;
+ return self->month;
}
- (int)year {
- return [[self selectedDate] yearOfCommonEra];
+ return [[self selectedDate] yearOfCommonEra];
}
- (NSArray *)arrayOfDateArrays {
- NSCalendarDate *startDate;
- NSMutableArray *result, *tmp;
- unsigned rowIdx, columnIdx;
- int monthOffset = 0;
-
- startDate = [self startDate];
- result = [[NSMutableArray alloc] initWithCapacity:3];
- for(rowIdx = 0; rowIdx < 3; rowIdx++) {
- tmp = [[NSMutableArray alloc] initWithCapacity:4];
- for(columnIdx = 0; columnIdx < 4; columnIdx++) {
- NSCalendarDate *date;
-
- date = [startDate dateByAddingYears:0
- months:monthOffset
- days:0];
- [tmp addObject:date];
- monthOffset++;
- }
- [result addObject:tmp];
- [tmp release];
+ NSCalendarDate *startDate;
+ NSMutableArray *result, *tmp;
+ unsigned rowIdx, columnIdx;
+ int monthOffset = 0;
+
+ startDate = [self startDate];
+ result = [NSMutableArray arrayWithCapacity:3];
+
+ for (rowIdx = 0; rowIdx < 3; rowIdx++) {
+ tmp = [[NSMutableArray alloc] initWithCapacity:4];
+
+ for (columnIdx = 0; columnIdx < 4; columnIdx++) {
+ NSCalendarDate *date;
+
+ date = [startDate dateByAddingYears:0 months:monthOffset days:0];
+ [tmp addObject:date];
+ monthOffset++;
}
- return [result autorelease];
+ [result addObject:tmp];
+ [tmp release];
+ }
+ return result;
}
/* date ranges */
- (NSCalendarDate *)startDate {
- return [[[NSCalendarDate alloc] initWithYear:[self year] month:1 day:1
- hour:0 minute:0 second:0
- timeZone:[self viewTimeZone]] autorelease];
+ return [[[NSCalendarDate alloc] initWithYear:[self year] month:1 day:1
+ hour:0 minute:0 second:0
+ timeZone:[self viewTimeZone]] autorelease];
}
-
- (NSCalendarDate *)endDate {
- return nil;
+ return nil;
}
-
/* URLs */
- (NSDictionary *)todayQueryParameters {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [NSCalendarDate date]; /* today */
- return [self queryParametersBySettingSelectedDate:date];
+ date = [NSCalendarDate date]; /* today */
+ return [self queryParametersBySettingSelectedDate:date];
}
-- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date {
- NSMutableDictionary *qp;
+- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date{
+ NSMutableDictionary *qp;
- qp = [[self queryParameters] mutableCopy];
- [self setSelectedDateQueryParameter:_date inDictionary:qp];
- return [qp autorelease];
+ qp = [[self queryParameters] mutableCopy];
+ [self setSelectedDateQueryParameter:_date inDictionary:qp];
+ return [qp autorelease];
}
- (void)setSelectedDateQueryParameter:(NSCalendarDate *)_newDate
- inDictionary:(NSMutableDictionary *)_qp;
+ inDictionary:(NSMutableDictionary *)_qp;
{
- if(_newDate != nil)
- [_qp setObject:[self dateStringForDate:_newDate] forKey:@"day"];
- else
- [_qp removeObjectForKey:@"day"];
+ if (_newDate != nil)
+ [_qp setObject:[self dateStringForDate:_newDate] forKey:@"day"];
+ else
+ [_qp removeObjectForKey:@"day"];
}
- (NSDictionary *)prevYearQueryParameters {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [[self startDate] dateByAddingYears:-1
- months:0
- days:0
- hours:0
- minutes:0
- seconds:0];
- return [self queryParametersBySettingSelectedDate:date];
+ date = [[self startDate] dateByAddingYears:-1 months:0 days:0
+ hours:0 minutes:0 seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
- (NSDictionary *)nextYearQueryParameters {
- NSCalendarDate *date;
-
- date = [[self startDate] dateByAddingYears:1
- months:0
- days:0
- hours:0
- minutes:0
- seconds:0];
- return [self queryParametersBySettingSelectedDate:date];
+ NSCalendarDate *date;
+
+ date = [[self startDate] dateByAddingYears:1 months:0 days:0
+ hours:0 minutes:0 seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
-@end
+@end /* UIxCalYearOverview */
# $Id$
-SUBMINOR_VERSION:=21
+SUBMINOR_VERSION:=22