mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-21 09:26:23 +00:00
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:
@@ -1,5 +1,14 @@
|
||||
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
|
||||
implementation of the UIxContactSelector component (added a
|
||||
"remove" button, removed the previous INPUT and replaced them with
|
||||
|
||||
@@ -50,7 +50,6 @@ SchedulerUI_OBJC_FILES = \
|
||||
UIxCalBackForthNavView.m \
|
||||
UIxAppointmentProposal.m \
|
||||
UIxDatePicker.m \
|
||||
UIxTimeSelector.m \
|
||||
UIxTimeDateControl.m \
|
||||
UIxCalInlineAptView.m \
|
||||
UIxCalScheduleOverview.m \
|
||||
|
||||
@@ -20,87 +20,46 @@
|
||||
*/
|
||||
// $Id: UIxTimeDateControl.m 601 2005-02-22 15:45:03Z znek $
|
||||
|
||||
#include <SOGoUI/UIxComponent.h>
|
||||
#import "common.h"
|
||||
|
||||
@interface UIxTimeDateControl : UIxComponent
|
||||
{
|
||||
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"
|
||||
#import "UIxTimeDateControl.h"
|
||||
|
||||
@implementation UIxTimeDateControl
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self->displayTimeControl = YES;
|
||||
displayTimeControl = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self->controlID release];
|
||||
[self->label release];
|
||||
[self->date release];
|
||||
[self->hour release];
|
||||
[self->minute release];
|
||||
[self->second release];
|
||||
[self->day release];
|
||||
[self->month release];
|
||||
[self->year release];
|
||||
[controlID release];
|
||||
[label release];
|
||||
[date release];
|
||||
[hour release];
|
||||
[minute release];
|
||||
[second release];
|
||||
[day release];
|
||||
[month release];
|
||||
[year release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (void)setControlID:(NSString *)_controlID {
|
||||
ASSIGNCOPY(self->controlID, _controlID);
|
||||
ASSIGNCOPY(controlID, _controlID);
|
||||
}
|
||||
- (NSString *)controlID {
|
||||
return self->controlID;
|
||||
return controlID;
|
||||
}
|
||||
- (void)setLabel:(NSString *)_label {
|
||||
ASSIGNCOPY(self->label, _label);
|
||||
ASSIGNCOPY(label, _label);
|
||||
}
|
||||
- (NSString *)label {
|
||||
return self->label;
|
||||
return label;
|
||||
}
|
||||
- (void)setDate:(NSCalendarDate *)_date {
|
||||
if (!_date)
|
||||
@@ -113,75 +72,163 @@
|
||||
[self setDay:[NSNumber numberWithInt:[_date dayOfMonth]]];
|
||||
}
|
||||
- (void)_setDate:(NSCalendarDate *)_date {
|
||||
ASSIGN(self->date, _date);
|
||||
ASSIGN(date, _date);
|
||||
}
|
||||
- (NSCalendarDate *)date {
|
||||
return self->date;
|
||||
return date;
|
||||
}
|
||||
|
||||
- (void)setHour:(id)_hour {
|
||||
ASSIGN(self->hour, _hour);
|
||||
ASSIGN(hour, _hour);
|
||||
}
|
||||
- (id)hour {
|
||||
return self->hour;
|
||||
return hour;
|
||||
}
|
||||
- (void)setMinute:(id)_minute {
|
||||
ASSIGN(self->minute, _minute);
|
||||
ASSIGN(minute, _minute);
|
||||
}
|
||||
- (id)minute {
|
||||
return self->minute;
|
||||
return minute;
|
||||
}
|
||||
- (void)setSecond:(id)_second {
|
||||
ASSIGN(self->second, _second);
|
||||
ASSIGN(second, _second);
|
||||
}
|
||||
- (id)second {
|
||||
return self->second;
|
||||
return second;
|
||||
}
|
||||
|
||||
- (void)setDay:(id)_day {
|
||||
ASSIGN(self->day, _day);
|
||||
ASSIGN(day, _day);
|
||||
}
|
||||
- (id)day {
|
||||
return self->day;
|
||||
return day;
|
||||
}
|
||||
- (void)setMonth:(id)_month {
|
||||
ASSIGN(self->month, _month);
|
||||
ASSIGN(month, _month);
|
||||
}
|
||||
- (id)month {
|
||||
return self->month;
|
||||
return month;
|
||||
}
|
||||
- (void)setYear:(id)_year {
|
||||
ASSIGN(self->year, _year);
|
||||
ASSIGN(year, _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"];
|
||||
}
|
||||
- (NSString *)dateID {
|
||||
|
||||
- (NSString *) dateID
|
||||
{
|
||||
return [[self controlID] stringByAppendingString:@"_date"];
|
||||
}
|
||||
|
||||
- (void)setDisplayTimeControl:(BOOL)_displayTimeControl {
|
||||
self->displayTimeControl = _displayTimeControl;
|
||||
}
|
||||
- (BOOL)displayTimeControl {
|
||||
return self->displayTimeControl;
|
||||
- (void) setDisplayTimeControl: (BOOL) _displayTimeControl
|
||||
{
|
||||
displayTimeControl = _displayTimeControl;
|
||||
}
|
||||
|
||||
#if 0
|
||||
- (NSString *)timeControlStyle {
|
||||
if (self->displayTimeControl)
|
||||
return @"visibility : visible;";
|
||||
return @"visibility : hidden;";
|
||||
- (BOOL) displayTimeControl
|
||||
{
|
||||
return displayTimeControl;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* processing request */
|
||||
|
||||
- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
|
||||
- (void) takeValuesFromRequest: (WORequest *) _rq
|
||||
inContext: (WOContext *) _ctx
|
||||
{
|
||||
NSCalendarDate *d;
|
||||
unsigned _year, _month, _day, _hour, _minute, _second;
|
||||
|
||||
@@ -189,22 +236,26 @@
|
||||
[super takeValuesFromRequest:_rq inContext:_ctx];
|
||||
|
||||
_year = [[self year] intValue];
|
||||
if(_year == 0)
|
||||
return;
|
||||
if (_year > 0)
|
||||
{
|
||||
[self setHour: [_rq formValueForKey: [self hourSelectId]]];
|
||||
[self setMinute: [_rq formValueForKey: [self minuteSelectId]]];
|
||||
|
||||
_month = [[self month] intValue];
|
||||
_day = [[self day] intValue];
|
||||
_hour = [[self hour] intValue];
|
||||
_minute = [[self minute] intValue];
|
||||
_second = [[self second] intValue];
|
||||
d = [NSCalendarDate dateWithYear:_year
|
||||
month:_month
|
||||
day:_day
|
||||
hour:_hour
|
||||
minute:_minute
|
||||
second:_second
|
||||
timeZone:[self viewTimeZone]];
|
||||
[self _setDate:d];
|
||||
_month = [[self month] intValue];
|
||||
_day = [[self day] intValue];
|
||||
_hour = [[self hour] intValue];
|
||||
_minute = [[self minute] intValue];
|
||||
_second = [[self second] intValue];
|
||||
|
||||
d = [NSCalendarDate dateWithYear:_year
|
||||
month:_month
|
||||
day:_day
|
||||
hour:_hour
|
||||
minute:_minute
|
||||
second:_second
|
||||
timeZone:[self viewTimeZone]];
|
||||
[self _setDate:d];
|
||||
}
|
||||
}
|
||||
|
||||
@end /* UIxTimeDateControl */
|
||||
|
||||
@@ -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 */
|
||||
@@ -5,26 +5,36 @@
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:rsrc="OGo:url"
|
||||
>
|
||||
<table cellpadding="0" cellspacing="2">
|
||||
<tr>
|
||||
<var:if condition="displayTimeControl">
|
||||
<td>
|
||||
<var:component className="UIxTimeSelector"
|
||||
timeID="timeID"
|
||||
hour="hour"
|
||||
minute="minute"
|
||||
/>
|
||||
</td>
|
||||
</var:if>
|
||||
<td>
|
||||
<var:component className="UIxDatePicker"
|
||||
dateID="dateID"
|
||||
year="year"
|
||||
month="month"
|
||||
day="day"
|
||||
label="label"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<var:component className="UIxDatePicker"
|
||||
dateID="dateID"
|
||||
year="year"
|
||||
month="month"
|
||||
day="day"
|
||||
label="label"
|
||||
/>
|
||||
<var:if condition="displayTimeControl">
|
||||
<select var:name="hourSelectId">
|
||||
<var:foreach list="selectableHours" item="hourOption"
|
||||
><var:if condition="isCurrentHour"
|
||||
><option var:value="hourValue" selected="selected"
|
||||
><var:string value="hourLabel"
|
||||
/></option></var:if
|
||||
><var:if condition="isCurrentHour" const:negate="YES"
|
||||
><option var:value="hourValue"><var:string value="hourLabel"
|
||||
/></option></var:if>
|
||||
</var:foreach
|
||||
></select>
|
||||
<select var:name="minuteSelectId">
|
||||
<var:foreach list="selectableMinutes" item="minuteOption"
|
||||
><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>
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user