Monotone-Parent: 0fe240e59b53ed43169486029f2d23d953547489

Monotone-Revision: 9a9be506022799b03e23c40687bc9fecefe328a9

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-08-30T23:08:15
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2006-08-30 23:08:15 +00:00
parent 63579af5eb
commit da6a95a587
6 changed files with 192 additions and 230 deletions
+9
View File
@@ -1,5 +1,14 @@
2006-08-30 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2006-08-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Scheduler/UIxTimeDateControl.m ([UIxTimeDateControl
-takeValuesFromRequest:_rqinContext:_ctx]): enhanced method to
take the values from the hour and minute INPUTs when data is
POSTed since we no longer use the UIxTimeSelector component.
([UIxTimeDateControl -selectableHours])
([UIxTimeDateControl -selectableMinutes]): new methods used by the
template SELECTs to display reasonable and acceptable values
instead of all the possibilities.
* UI/WebServerResources/generic.js: adapted code for the new * UI/WebServerResources/generic.js: adapted code for the new
implementation of the UIxContactSelector component (added a implementation of the UIxContactSelector component (added a
"remove" button, removed the previous INPUT and replaced them with "remove" button, removed the previous INPUT and replaced them with
-1
View File
@@ -50,7 +50,6 @@ SchedulerUI_OBJC_FILES = \
UIxCalBackForthNavView.m \ UIxCalBackForthNavView.m \
UIxAppointmentProposal.m \ UIxAppointmentProposal.m \
UIxDatePicker.m \ UIxDatePicker.m \
UIxTimeSelector.m \
UIxTimeDateControl.m \ UIxTimeDateControl.m \
UIxCalInlineAptView.m \ UIxCalInlineAptView.m \
UIxCalScheduleOverview.m \ UIxCalScheduleOverview.m \
+151 -100
View File
@@ -20,87 +20,46 @@
*/ */
// $Id: UIxTimeDateControl.m 601 2005-02-22 15:45:03Z znek $ // $Id: UIxTimeDateControl.m 601 2005-02-22 15:45:03Z znek $
#include <SOGoUI/UIxComponent.h> #import "common.h"
@interface UIxTimeDateControl : UIxComponent #import "UIxTimeDateControl.h"
{
NSString *controlID;
NSString *label;
NSCalendarDate *date;
id hour;
id minute;
id second;
id day;
id month;
id year;
BOOL displayTimeControl;
}
- (void)setControlID:(NSString *)_controlID;
- (NSString *)controlID;
- (void)setLabel:(NSString *)_label;
- (NSString *)label;
- (void)setDate:(NSCalendarDate *)_date;
- (NSCalendarDate *)date;
- (void)setHour:(id)_hour;
- (id)hour;
- (void)setMinute:(id)_minute;
- (id)minute;
- (void)setSecond:(id)_second;
- (id)second;
- (void)setDay:(id)_day;
- (id)day;
- (void)setMonth:(id)_month;
- (id)month;
- (void)setYear:(id)_year;
- (id)year;
- (NSString *)timeID;
- (NSString *)dateID;
- (void)_setDate:(NSCalendarDate *)_date;
@end
#include "common.h"
@implementation UIxTimeDateControl @implementation UIxTimeDateControl
- (id)init { - (id)init {
self = [super init]; self = [super init];
if (self) { if (self) {
self->displayTimeControl = YES; displayTimeControl = YES;
} }
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
[self->controlID release]; [controlID release];
[self->label release]; [label release];
[self->date release]; [date release];
[self->hour release]; [hour release];
[self->minute release]; [minute release];
[self->second release]; [second release];
[self->day release]; [day release];
[self->month release]; [month release];
[self->year release]; [year release];
[super dealloc]; [super dealloc];
} }
/* accessors */ /* accessors */
- (void)setControlID:(NSString *)_controlID { - (void)setControlID:(NSString *)_controlID {
ASSIGNCOPY(self->controlID, _controlID); ASSIGNCOPY(controlID, _controlID);
} }
- (NSString *)controlID { - (NSString *)controlID {
return self->controlID; return controlID;
} }
- (void)setLabel:(NSString *)_label { - (void)setLabel:(NSString *)_label {
ASSIGNCOPY(self->label, _label); ASSIGNCOPY(label, _label);
} }
- (NSString *)label { - (NSString *)label {
return self->label; return label;
} }
- (void)setDate:(NSCalendarDate *)_date { - (void)setDate:(NSCalendarDate *)_date {
if (!_date) if (!_date)
@@ -113,75 +72,163 @@
[self setDay:[NSNumber numberWithInt:[_date dayOfMonth]]]; [self setDay:[NSNumber numberWithInt:[_date dayOfMonth]]];
} }
- (void)_setDate:(NSCalendarDate *)_date { - (void)_setDate:(NSCalendarDate *)_date {
ASSIGN(self->date, _date); ASSIGN(date, _date);
} }
- (NSCalendarDate *)date { - (NSCalendarDate *)date {
return self->date; return date;
} }
- (void)setHour:(id)_hour { - (void)setHour:(id)_hour {
ASSIGN(self->hour, _hour); ASSIGN(hour, _hour);
} }
- (id)hour { - (id)hour {
return self->hour; return hour;
} }
- (void)setMinute:(id)_minute { - (void)setMinute:(id)_minute {
ASSIGN(self->minute, _minute); ASSIGN(minute, _minute);
} }
- (id)minute { - (id)minute {
return self->minute; return minute;
} }
- (void)setSecond:(id)_second { - (void)setSecond:(id)_second {
ASSIGN(self->second, _second); ASSIGN(second, _second);
} }
- (id)second { - (id)second {
return self->second; return second;
} }
- (void)setDay:(id)_day { - (void)setDay:(id)_day {
ASSIGN(self->day, _day); ASSIGN(day, _day);
} }
- (id)day { - (id)day {
return self->day; return day;
} }
- (void)setMonth:(id)_month { - (void)setMonth:(id)_month {
ASSIGN(self->month, _month); ASSIGN(month, _month);
} }
- (id)month { - (id)month {
return self->month; return month;
} }
- (void)setYear:(id)_year { - (void)setYear:(id)_year {
ASSIGN(self->year, _year); ASSIGN(year, _year);
} }
- (id)year { - (id)year {
return self->year; return year;
} }
- (NSString *)timeID { - (void) setDayStartHour: (unsigned int) aStartHour
{
startHour = aStartHour;
}
- (void) setDayEndHour: (unsigned int) anEndHour
{
endHour = anEndHour;
}
- (void) setHourOption: (NSNumber *) option
{
currentHour = option;
}
- (BOOL) isCurrentHour
{
return [currentHour isEqual: hour];
}
- (BOOL) isCurrentMinute
{
return [currentMinute isEqual: minute];
}
- (int) hourValue
{
return [currentHour intValue];
}
- (NSString *) hourLabel
{
return [NSString stringWithFormat: @"%.2d", [currentHour intValue]];
}
- (NSArray *) selectableHours
{
NSMutableArray *hours;
unsigned int h;
hours = [NSMutableArray new];
[hours autorelease];
for (h = startHour; h < (endHour + 1); h++)
[hours addObject: [NSNumber numberWithInt: h]];
return hours;
}
- (NSString *) hourSelectId
{
return [[self controlID] stringByAppendingString:@"_time_hour"];
}
- (void) setMinuteOption: (NSNumber *) option
{
currentMinute = option;
}
- (int) minuteValue
{
return [currentMinute intValue];
}
- (NSString *) minuteLabel
{
return [NSString stringWithFormat: @"%.2d", [currentMinute intValue]];
}
- (NSArray *) selectableMinutes
{
NSMutableArray *minutes;
unsigned int m;
minutes = [NSMutableArray new];
[minutes autorelease];
for (m = 0; m < 60; m += 15)
[minutes addObject: [NSNumber numberWithInt: m]];
return minutes;
}
- (NSString *) minuteSelectId
{
return [[self controlID] stringByAppendingString:@"_time_minute"];
}
- (NSString *) timeID
{
return [[self controlID] stringByAppendingString:@"_time"]; return [[self controlID] stringByAppendingString:@"_time"];
} }
- (NSString *)dateID {
- (NSString *) dateID
{
return [[self controlID] stringByAppendingString:@"_date"]; return [[self controlID] stringByAppendingString:@"_date"];
} }
- (void)setDisplayTimeControl:(BOOL)_displayTimeControl { - (void) setDisplayTimeControl: (BOOL) _displayTimeControl
self->displayTimeControl = _displayTimeControl; {
} displayTimeControl = _displayTimeControl;
- (BOOL)displayTimeControl {
return self->displayTimeControl;
} }
#if 0 - (BOOL) displayTimeControl
- (NSString *)timeControlStyle { {
if (self->displayTimeControl) return displayTimeControl;
return @"visibility : visible;";
return @"visibility : hidden;";
} }
#endif
/* processing request */ /* processing request */
- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { - (void) takeValuesFromRequest: (WORequest *) _rq
inContext: (WOContext *) _ctx
{
NSCalendarDate *d; NSCalendarDate *d;
unsigned _year, _month, _day, _hour, _minute, _second; unsigned _year, _month, _day, _hour, _minute, _second;
@@ -189,22 +236,26 @@
[super takeValuesFromRequest:_rq inContext:_ctx]; [super takeValuesFromRequest:_rq inContext:_ctx];
_year = [[self year] intValue]; _year = [[self year] intValue];
if(_year == 0) if (_year > 0)
return; {
[self setHour: [_rq formValueForKey: [self hourSelectId]]];
[self setMinute: [_rq formValueForKey: [self minuteSelectId]]];
_month = [[self month] intValue]; _month = [[self month] intValue];
_day = [[self day] intValue]; _day = [[self day] intValue];
_hour = [[self hour] intValue]; _hour = [[self hour] intValue];
_minute = [[self minute] intValue]; _minute = [[self minute] intValue];
_second = [[self second] intValue]; _second = [[self second] intValue];
d = [NSCalendarDate dateWithYear:_year
month:_month d = [NSCalendarDate dateWithYear:_year
day:_day month:_month
hour:_hour day:_day
minute:_minute hour:_hour
second:_second minute:_minute
timeZone:[self viewTimeZone]]; second:_second
[self _setDate:d]; timeZone:[self viewTimeZone]];
[self _setDate:d];
}
} }
@end /* UIxTimeDateControl */ @end /* UIxTimeDateControl */
-94
View File
@@ -1,94 +0,0 @@
/*
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: UIxTimeSelector.m 247 2004-08-16 09:32:04Z znek $
#include <NGObjWeb/WOComponent.h>
@class NSString, NSCalendarDate, NSArray;
@interface UIxTimeSelector : WOComponent
{
NSString *timeID;
id hour;
id minute;
NSString *minuteInterval;
}
- (void)setTimeID:(NSString *)_timeID;
- (NSString *)timeID;
- (void)setHour:(id)_hour;
- (id)hour;
- (void)setMinute:(id)_minute;
- (id)minute;
- (void)setMinuteInterval:(NSString *)_minuteInterval;
- (NSString *)minuteInterval;
@end
#include "common.h"
@implementation UIxTimeSelector
- (void)dealloc {
[self->timeID release];
[self->hour release];
[self->minute release];
[self->minuteInterval release];
[super dealloc];
}
/* accessors */
- (void)setTimeID:(NSString *)_timeID {
ASSIGNCOPY(self->timeID, _timeID);
}
- (NSString *)timeID {
return self->timeID;
}
- (void)setHour:(id)_hour {
ASSIGN(self->hour, _hour);
}
- (id)hour {
return self->hour;
}
- (void)setMinute:(id)_minute {
ASSIGN(self->minute, _minute);
}
- (id)minute {
return self->minute;
}
- (void)setMinuteInterval:(NSString *)_minuteInterval {
ASSIGNCOPY(self->minuteInterval, _minuteInterval);
}
- (NSString *)minuteInterval {
if(self->minuteInterval == nil)
return @"1";
return self->minuteInterval;
}
- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
/* call super, so that the form values are applied on the popups */
[super takeValuesFromRequest:_rq inContext:_ctx];
}
@end /* UIxTimeSelector */
+32 -22
View File
@@ -5,26 +5,36 @@
xmlns:const="http://www.skyrix.com/od/constant" xmlns:const="http://www.skyrix.com/od/constant"
xmlns:rsrc="OGo:url" xmlns:rsrc="OGo:url"
> >
<table cellpadding="0" cellspacing="2"> <var:component className="UIxDatePicker"
<tr> dateID="dateID"
<var:if condition="displayTimeControl"> year="year"
<td> month="month"
<var:component className="UIxTimeSelector" day="day"
timeID="timeID" label="label"
hour="hour" />
minute="minute" <var:if condition="displayTimeControl">
/> <select var:name="hourSelectId">
</td> <var:foreach list="selectableHours" item="hourOption"
</var:if> ><var:if condition="isCurrentHour"
<td> ><option var:value="hourValue" selected="selected"
<var:component className="UIxDatePicker" ><var:string value="hourLabel"
dateID="dateID" /></option></var:if
year="year" ><var:if condition="isCurrentHour" const:negate="YES"
month="month" ><option var:value="hourValue"><var:string value="hourLabel"
day="day" /></option></var:if>
label="label" </var:foreach
/> ></select>
</td> <select var:name="minuteSelectId">
</tr> <var:foreach list="selectableMinutes" item="minuteOption"
</table> ><var:if condition="isCurrentMinute"
><option var:value="minuteValue" selected="selected"
><var:string value="minuteLabel"
/></option></var:if
><var:if condition="isCurrentMinute" const:negate="YES"
><option var:value="minuteValue"
><var:string value="minuteLabel"
/></option></var:if>
</var:foreach
></select>
</var:if>
</span> </span>
@@ -1,13 +0,0 @@
<?xml version='1.0' standalone='yes'?>
<span xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:rsrc="OGo:url"
var:id="timeID"
>
<var:time-field hour="hour"
minute="minute"
minuteInterval="minuteInterval"
name="timeID"
/>
</span>