2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include <NGObjWeb/NGObjWeb.h>
25 @interface UIxTimeDateControl : WOComponent
38 - (void)setControlID:(NSString *)_controlID;
39 - (NSString *)controlID;
40 - (void)setLabel:(NSString *)_label;
42 - (void)setDate:(NSCalendarDate *)_date;
43 - (NSCalendarDate *)date;
45 - (void)setHour:(id)_hour;
47 - (void)setMinute:(id)_minute;
49 - (void)setSecond:(id)_second;
51 - (void)setDay:(id)_day;
53 - (void)setMonth:(id)_month;
55 - (void)setYear:(id)_year;
61 - (void)_setDate:(NSCalendarDate *)_date;
67 @implementation UIxTimeDateControl
69 static NSTimeZone *MET = nil;
73 MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain];
78 [self->controlID release];
79 [self->label release];
82 [self->minute release];
83 [self->second release];
85 [self->month release];
92 - (void)setControlID:(NSString *)_controlID {
93 ASSIGNCOPY(self->controlID, _controlID);
95 - (NSString *)controlID {
96 return self->controlID;
98 - (void)setLabel:(NSString *)_label {
99 ASSIGNCOPY(self->label, _label);
101 - (NSString *)label {
104 - (void)setDate:(NSCalendarDate *)_date {
105 [self _setDate:_date];
106 [self setHour:[NSNumber numberWithInt:[_date hourOfDay]]];
107 [self setMinute:[NSNumber numberWithInt:[_date minuteOfHour]]];
108 [self setYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]];
109 [self setMonth:[NSNumber numberWithInt:[_date monthOfYear]]];
110 [self setDay:[NSNumber numberWithInt:[_date dayOfMonth]]];
112 - (void)_setDate:(NSCalendarDate *)_date {
113 ASSIGN(self->date, _date);
115 - (NSCalendarDate *)date {
119 - (void)setHour:(id)_hour {
120 ASSIGN(self->hour, _hour);
125 - (void)setMinute:(id)_minute {
126 ASSIGN(self->minute, _minute);
131 - (void)setSecond:(id)_second {
132 ASSIGN(self->second, _second);
138 - (void)setDay:(id)_day {
139 ASSIGN(self->day, _day);
144 - (void)setMonth:(id)_month {
145 ASSIGN(self->month, _month);
150 - (void)setYear:(id)_year {
151 ASSIGN(self->year, _year);
157 - (NSString *)timeID {
158 return [[self controlID] stringByAppendingString:@"_time"];
160 - (NSString *)dateID {
161 return [[self controlID] stringByAppendingString:@"_date"];
164 /* processing request */
166 - (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
168 unsigned _year, _month, _day, _hour, _minute, _second;
170 /* call super, so that the form values are applied on the popups */
171 [super takeValuesFromRequest:_rq inContext:_ctx];
173 _year = [[self year] intValue];
177 _month = [[self month] intValue];
178 _day = [[self day] intValue];
179 _hour = [[self hour] intValue];
180 _minute = [[self minute] intValue];
181 _second = [[self second] intValue];
182 d = [NSCalendarDate dateWithYear:_year
189 [self debugWithFormat:@"%s setting date:%@", __PRETTY_FUNCTION__, d];
193 @end /* UIxTimeDateControl */