Monotone-Parent: 6ccdcaac87d66173b1c675ce714a85b4fa7f82b5

Monotone-Revision: a8eaad13df3d9d67b260d73ffe79b6576abb4338

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-30T22:37:57
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau committed 2006-10-30 22:37:57 +00:00
1 parent ee65454c21
commit 30bc88e8d4
9 files changed
+472 -218

No files matched your search

+1
View File
@@ -40,6 +40,7 @@ SchedulerUI_OBJC_FILES = \
UIxCalInlineMonthOverview.m \
UIxComponentEditor.m \
UIxFreeBusyUserSelector.m \
UIxFreeBusyUserSelectorTable.m \
UIxAppointmentView.m \
UIxAppointmentEditor.m \
UIxAppointmentProposal.m \
+2 -14
View File
@@ -29,23 +29,16 @@
@class NSMutableArray;
@class NSCalendarDate;
@class NSNumber;
@class SOGoDateFormatter;
@class iCalPerson;
@interface UIxFreeBusyUserSelector : UIxComponent
{
SOGoDateFormatter *dateFormatter;
NSCalendarDate *startDate;
NSCalendarDate *endDate;
NSNumber *dayStartHour;
NSNumber *dayEndHour;
NSMutableArray *daysToDisplay;
NSMutableArray *hoursToDisplay;
NSCalendarDate *currentDayToDisplay;
NSNumber *currentHourToDisplay;
NSArray *contacts;
iCalPerson *currentContact;
NSString *selectorId;
}
@@ -54,7 +47,9 @@
- (void) setEndDate: (NSCalendarDate *) newEndDate;
- (void) setDayStartHour: (NSNumber *) newDayStartHour;
- (NSNumber *) dayStartHour;
- (void) setDayEndHour: (NSNumber *) newDayEndHour;
- (NSNumber *) dayEndHour;
- (void) setContacts: (NSArray *) contacts;
- (NSArray *) contacts;
@@ -62,13 +57,6 @@
- (void) setSelectorId: (NSString *) newSelectorId;
- (NSString *) selectorId;
- (NSArray *) daysToDisplay;
- (NSArray *) hoursToDisplay;
- (void) setCurrentDayToDisplay: (NSCalendarDate *) newCurrentDayToDisplay;
- (void) setCurrentHourToDisplay: (NSNumber *) newCurrentHourToDisplay;
- (NSCalendarDate *) currentDayToDisplay;
- (NSNumber *) currentHourToDisplay;
@end
#endif /* UIXFREEBUSYUSERSELECTOR_H */
+14 -134
View File
@@ -23,13 +23,12 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSValue.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <NGCards/iCalPerson.h>
#import <NGObjWeb/WORequest.h>
#import <SOGoUI/SOGoDateFormatter.h>
#import <SoObjects/SOGo/AgenorUserManager.h>
#import "UIxComponent+Agenor.h"
#import "UIxFreeBusyUserSelector.h"
@implementation UIxFreeBusyUserSelector
@@ -46,10 +45,6 @@
[dayEndHour retain];
contacts = nil;
selectorId = nil;
daysToDisplay = nil;
hoursToDisplay = nil;
dateFormatter = [[SOGoDateFormatter alloc]
initWithLocale: [self locale]];
}
return self;
@@ -59,26 +54,16 @@
{
[dayStartHour release];
[dayEndHour release];
if (daysToDisplay)
[daysToDisplay release];
if (hoursToDisplay)
[hoursToDisplay release];
if (contacts)
[contacts release];
if (selectorId)
[selectorId release];
[dateFormatter release];
[super dealloc];
}
- (void) setStartDate: (NSCalendarDate *) newStartDate
{
startDate = newStartDate;
if (daysToDisplay)
{
[daysToDisplay release];
daysToDisplay = nil;
}
}
- (NSCalendarDate *) startDate
@@ -89,11 +74,6 @@
- (void) setEndDate: (NSCalendarDate *) newEndDate
{
endDate = newEndDate;
if (daysToDisplay)
{
[daysToDisplay release];
daysToDisplay = nil;
}
}
- (NSCalendarDate *) endDate
@@ -106,11 +86,21 @@
ASSIGN (dayStartHour, newDayStartHour);
}
- (NSNumber *) dayStartHour
{
return dayStartHour;
}
- (void) setDayEndHour: (NSNumber *) newDayEndHour
{
ASSIGN (dayEndHour, newDayEndHour);
}
- (NSNumber *) dayEndHour
{
return dayEndHour;
}
- (void) setSelectorId: (NSString *) newSelectorId
{
ASSIGN (selectorId, newSelectorId);
@@ -132,33 +122,6 @@
}
/* callbacks */
- (NSArray *) getICalPersonsFromValue: (NSString *) selectorValue
{
NSMutableArray *persons;
NSEnumerator *uids;
NSString *uid;
AgenorUserManager *um;
um = [AgenorUserManager sharedUserManager];
persons = [NSMutableArray new];
[persons autorelease];
if ([selectorValue length] > 0)
{
uids = [[selectorValue componentsSeparatedByString: @","]
objectEnumerator];
uid = [uids nextObject];
while (uid)
{
[persons addObject: [um iCalPersonWithUid: uid]];
uid = [uids nextObject];
}
}
return persons;
}
- (void) takeValuesFromRequest: (WORequest *) request
inContext: (WOContext *) context
{
@@ -192,92 +155,9 @@
return [participants componentsJoinedByString: @","];
}
- (void) setCurrentContact: (iCalPerson *) newCurrentContact
- (NSString *) freeBusyViewId
{
currentContact = newCurrentContact;
return [NSString stringWithFormat: @"parentOf%@", [selectorId capitalizedString]];
}
- (iCalPerson *) currentContact
{
return currentContact;
}
- (NSString *) currentContactId
{
return [currentContact cn];
}
- (NSString *) currentContactName
{
return [currentContact cn];
}
- (NSArray *) daysToDisplay
{
NSCalendarDate *currentDay, *finalDay;
if (!daysToDisplay)
{
daysToDisplay = [NSMutableArray new];
finalDay = [endDate dateByAddingYears: 0 months: 0 days: 2];
currentDay = startDate;
[daysToDisplay addObject: currentDay];
while (![currentDay isDateOnSameDay: finalDay])
{
currentDay = [currentDay dateByAddingYears: 0 months: 0 days: 1];
[daysToDisplay addObject: currentDay];
}
}
return daysToDisplay;
}
- (NSArray *) hoursToDisplay
{
NSNumber *currentHour;
if (!hoursToDisplay)
{
hoursToDisplay = [NSMutableArray new];
currentHour = dayStartHour;
[hoursToDisplay addObject: currentHour];
while (![currentHour isEqual: dayEndHour])
{
currentHour = [NSNumber numberWithInt: [currentHour intValue] + 1];
[hoursToDisplay addObject: currentHour];
}
}
return hoursToDisplay;
}
- (void) setCurrentDayToDisplay: (NSCalendarDate *) newCurrentDayToDisplay
{
currentDayToDisplay = newCurrentDayToDisplay;
}
- (void) setCurrentHourToDisplay: (NSNumber *) newCurrentHourToDisplay
{
currentHourToDisplay = newCurrentHourToDisplay;
}
- (NSCalendarDate *) currentDayToDisplay
{
return currentDayToDisplay;
}
- (NSNumber *) currentHourToDisplay
{
return currentHourToDisplay;
}
- (NSString *) currentFormattedDay
{
return [NSString stringWithFormat: @"%@, %.4d-%.2d-%.2d",
[dateFormatter shortDayOfWeek: [currentDayToDisplay dayOfWeek]],
[currentDayToDisplay yearOfCommonEra],
[currentDayToDisplay monthOfYear],
[currentDayToDisplay dayOfMonth]];
}
@end
@@ -0,0 +1,82 @@
/* UIxFreeBusyUserSelectorTable.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 UIXFREEBUSYUSERSELECTORTABLE_H
#define UIXFREEBUSYUSERSELECTORTABLE_H
#import <SOGoUI/UIxComponent.h>
@class NSArray;
@class NSCalendarDate;
@class NSNumber;
@class iCalPerson;
@class SOGoDateFormatter;
@interface UIxFreeBusyUserSelectorTable : UIxComponent
{
BOOL standAlone;
NSMutableArray *daysToDisplay;
NSMutableArray *hoursToDisplay;
SOGoDateFormatter *dateFormatter;
NSArray *contacts;
NSNumber *dayStartHour;
NSNumber *dayEndHour;
NSCalendarDate *startDate;
NSCalendarDate *endDate;
iCalPerson *currentContact;
NSNumber *currentHourToDisplay;
NSCalendarDate *currentDayToDisplay;
}
- (void) setContacts: (NSArray *) newContacts;
- (NSArray *) contacts;
- (void) setStartDate: (NSCalendarDate *) newStartDate;
- (void) setEndDate: (NSCalendarDate *) newEndDate;
- (void) setDayStartHour: (NSNumber *) newDayStartHour;
- (NSNumber *) dayStartHour;
- (void) setDayEndHour: (NSNumber *) newDayEndHour;
- (NSNumber *) dayEndHour;
- (void) setCurrentContact: (iCalPerson *) newCurrentContact;
- (iCalPerson *) currentContact;
- (NSString *) currentContactId;
- (NSString *) currentContactName;
- (void) setCurrentDayToDisplay: (NSCalendarDate *) newCurrentDayToDisplay;
- (NSCalendarDate *) currentDayToDisplay;
- (void) setCurrentHourToDisplay: (NSNumber *) newCurrentHourToDisplay;
- (NSNumber *) currentHourToDisplay;
- (NSString *) currentFormattedDay;
- (NSArray *) daysToDisplay;
- (NSArray *) hoursToDisplay;
@end
#endif /* UIXFREEBUSYUSERSELECTORTABLE_H */
+278
View File
@@ -0,0 +1,278 @@
/* UIxFreeBusyUserSelectorTable.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/NSValue.h>
#import <Foundation/NSString.h>
#import <NGCards/iCalPerson.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <SoObjects/Appointments/SOGoFreeBusyObject.h>
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
#import <SOGoUI/SOGoDateFormatter.h>
#import "UIxComponent+Agenor.h"
#import "UIxFreeBusyUserSelectorTable.h"
@implementation UIxFreeBusyUserSelectorTable
- (id) init
{
if ((self = [super init]))
{
standAlone = NO;
startDate = nil;
endDate = nil;
contacts = nil;
hoursToDisplay = nil;
daysToDisplay = nil;
dateFormatter
= [[SOGoDateFormatter alloc] initWithLocale: [self locale]];
}
return self;
}
- (void) dealloc
{
[dateFormatter release];
if (hoursToDisplay)
[hoursToDisplay release];
if (daysToDisplay)
[daysToDisplay release];
if (standAlone)
{
if (startDate)
[startDate release];
if (endDate)
[endDate release];
if (contacts)
[contacts release];
}
[super dealloc];
}
- (void) setContacts: (NSArray *) newContacts
{
contacts = newContacts;
}
- (NSArray *) contacts
{
return contacts;
}
- (void) setStartDate: (NSCalendarDate *) newStartDate
{
startDate = newStartDate;
if (daysToDisplay)
{
[daysToDisplay release];
daysToDisplay = nil;
}
}
- (NSCalendarDate *) startDate
{
return startDate;
}
- (void) setEndDate: (NSCalendarDate *) newEndDate
{
endDate = newEndDate;
if (daysToDisplay)
{
[daysToDisplay release];
daysToDisplay = nil;
}
}
- (NSCalendarDate *) endDate
{
return endDate;
}
- (void) setDayStartHour: (NSNumber *) newDayStartHour
{
dayStartHour = newDayStartHour;
if (hoursToDisplay)
{
[hoursToDisplay release];
hoursToDisplay = nil;
}
}
- (NSNumber *) dayStartHour
{
return dayStartHour;
}
- (void) setDayEndHour: (NSNumber *) newDayEndHour
{
dayEndHour = newDayEndHour;
if (hoursToDisplay)
{
[hoursToDisplay release];
hoursToDisplay = nil;
}
}
- (NSNumber *) dayEndHour
{
return dayEndHour;
}
/* template operations */
- (NSArray *) daysToDisplay
{
NSCalendarDate *currentDay, *finalDay;
if (!daysToDisplay)
{
daysToDisplay = [NSMutableArray new];
finalDay = [endDate dateByAddingYears: 0 months: 0 days: 2];
currentDay = startDate;
[daysToDisplay addObject: currentDay];
while (![currentDay isDateOnSameDay: finalDay])
{
currentDay = [currentDay dateByAddingYears: 0
months: 0
days: 1];
[daysToDisplay addObject: currentDay];
}
}
return daysToDisplay;
}
- (NSArray *) hoursToDisplay
{
NSNumber *currentHour;
if (!hoursToDisplay)
{
hoursToDisplay = [NSMutableArray new];
currentHour = dayStartHour;
[hoursToDisplay addObject: currentHour];
while (![currentHour isEqual: dayEndHour])
{
currentHour = [NSNumber numberWithInt: [currentHour intValue] + 1];
[hoursToDisplay addObject: currentHour];
}
}
return hoursToDisplay;
}
- (void) setCurrentContact: (iCalPerson *) newCurrentContact
{
currentContact = newCurrentContact;
}
- (iCalPerson *) currentContact
{
return currentContact;
}
- (NSString *) currentContactId
{
return [currentContact cn];
}
- (NSString *) currentContactName
{
return [currentContact cn];
}
- (void) setCurrentDayToDisplay: (NSCalendarDate *) newCurrentDayToDisplay
{
currentDayToDisplay = newCurrentDayToDisplay;
}
- (void) setCurrentHourToDisplay: (NSNumber *) newCurrentHourToDisplay
{
currentHourToDisplay = newCurrentHourToDisplay;
}
- (NSCalendarDate *) currentDayToDisplay
{
return currentDayToDisplay;
}
- (NSNumber *) currentHourToDisplay
{
return currentHourToDisplay;
}
- (NSString *) currentFormattedDay
{
return [NSString stringWithFormat: @"%@, %.4d-%.2d-%.2d",
[dateFormatter shortDayOfWeek: [currentDayToDisplay dayOfWeek]],
[currentDayToDisplay yearOfCommonEra],
[currentDayToDisplay monthOfYear],
[currentDayToDisplay dayOfMonth]];
}
/* as stand-alone component... */
- (id <WOActionResults>) defaultAction
{
SOGoFreeBusyObject *co;
NSString *queryParam;
NSTimeZone *uTZ;
co = [self clientObject];
uTZ = [co userTimeZone];
queryParam = [self queryParameterForKey: @"sday"];
if ([queryParam length] > 0)
{
[self setStartDate: [NSCalendarDate dateFromShortDateString: queryParam
andShortTimeString: @"0000"
inTimeZone: uTZ]];
[startDate retain];
}
queryParam = [self queryParameterForKey: @"eday"];
if ([queryParam length] > 0)
{
[self setEndDate: [NSCalendarDate dateFromShortDateString: queryParam
andShortTimeString: @"0000"
inTimeZone: uTZ]];
[endDate retain];
}
queryParam = [self queryParameterForKey: @"attendees"];
if ([queryParam length] > 0)
{
[self setContacts: [self getICalPersonsFromValue: queryParam]];
[contacts retain];
}
dayStartHour = [NSNumber numberWithInt: 8];
dayEndHour = [NSNumber numberWithInt: 18];
standAlone = YES;
return self;
}
@end
+6 -3
View File
@@ -1,5 +1,5 @@
{
requires = ( MAIN, CommonUI, Appointments, Contacts );
requires = ( MAIN, CommonUI, Appointments, Contacts, ContactsUI );
publicResources = (
previous_week.gif,
@@ -64,7 +64,6 @@
protectedBy = "View";
pageName = "UIxCalMonthView";
};
dayoverview = {
protectedBy = "View";
pageName = "UIxCalDayOverview";
@@ -134,7 +133,11 @@
protectedBy = "View";
pageName = "UIxCalMainView";
actionName = "updateCalendars";
}
};
freeBusyTable = {
protectedBy = "View";
pageName = "UIxFreeBusyUserSelectorTable";
};
};
};
@@ -7,74 +7,19 @@
xmlns:rsrc="OGo:url"
xmlns:label="OGo:label">
<script type="text/javascript" rsrc:src="UIxFreeBusyUserSelector.js"><!-- space --></script>
<div class="freeBusyView">
<input type="hidden"
var:id="selectorId"
var:name="selectorId"
var:value="initialContactsAsString" />
<table class="freeBusy">
<thead>
<tr class="freeBusyHeader1"
><th class="attendees"></th
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><th colspan="11"><var:string value="currentFormattedDay" /></th
></var:foreach
></tr>
<tr class="freeBusyHeader2"
><th class="attendees"></th
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><th><var:string value="currentHourToDisplay" const:numberformat="00:"/>00</th
></var:foreach
></var:foreach
></tr>
<tr class="freeBusyHeader3"
><th class="attendees"></th
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><th><span class="freeBusyZoneElement"><!-- space --></span><span class="freeBusyZoneElement"><!-- space --></span><span class="freeBusyZoneElement"><!-- space --></span><span class="freeBusyZoneElement"><!-- space --></span></th
></var:foreach
></var:foreach
></tr>
</thead>
<tbody>
<var:foreach list="contacts" item="currentContact"
><tr><td class="attendees"><input type="text"
var:value="currentContactName"
var:uid="currentContactId"
class="textField"
onkeyup="onContactKeyUp(this, event);"
onblur="checkAttendee(this);" /></td
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><td></td
></var:foreach
></var:foreach>
</tr></var:foreach>
<tr class="futureAttendee"
><td class="attendees"><input type="text" class="textField"
readonly="readonly"
onclick="newAttendee(this);" /></td
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><td></td
></var:foreach
></var:foreach
></tr>
<tr class="attendeeModel"
><td class="attendees"><input type="text" class="textField"
onkeyup="onContactKeyUp(this, event);"
onblur="checkAttendee(this);" /></td
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><td></td
></var:foreach
></var:foreach
></tr>
</tbody>
</table>
<input type="hidden"
var:id="selectorId"
var:name="selectorId"
var:value="initialContactsAsString" />
<div class="freeBusyView" var:id="freeBusyViewId">
<var:component className="UIxFreeBusyUserSelectorTable"
contacts="contacts"
dayStartHour="dayStartHour"
dayEndHour="dayEndHour"
startDate="startDate"
endDate="endDate" />
</div>
<div class="elvis" onmousedown="return false;">
<div class="legend" onmousedown="return false;">
<hr />
<ul>
<li><img rsrc:src="required-participant.png"
@@ -0,0 +1,68 @@
<?xml version='1.0' standalone='yes'?>
<table class="freeBusy"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:uix="OGo:uix"
xmlns:rsrc="OGo:url"
xmlns:label="OGo:label">
<thead>
<tr class="freeBusyHeader1"
><th class="attendees"></th
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><th colspan="11"><var:string value="currentFormattedDay" /></th
></var:foreach
></tr>
<tr class="freeBusyHeader2"
><th class="attendees"></th
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><th><var:string value="currentHourToDisplay" const:numberformat="00:"/>00</th
></var:foreach
></var:foreach
></tr>
<tr class="freeBusyHeader3"
><th class="attendees"></th
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><th><span class="freeBusyZoneElement"><!-- space --></span><span class="freeBusyZoneElement"><!-- space --></span><span class="freeBusyZoneElement"><!-- space --></span><span class="freeBusyZoneElement"><!-- space --></span></th
></var:foreach
></var:foreach
></tr>
</thead>
<tbody>
<var:foreach list="contacts" item="currentContact"
><tr><td class="attendees"><input type="text"
var:value="currentContactName"
var:uid="currentContactId"
class="textField"
onkeyup="onContactKeyUp(this, event);"
onblur="checkAttendee(this);" /></td
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><td></td
></var:foreach
></var:foreach>
</tr></var:foreach>
<tr class="futureAttendee"
><td class="attendees"><input type="text" class="textField"
readonly="readonly"
onclick="newAttendee(this);" /></td
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><td></td
></var:foreach
></var:foreach
></tr>
<tr class="attendeeModel"
><td class="attendees"><input type="text" class="textField"
onkeyup="onContactKeyUp(this, event);"
onblur="checkAttendee(this);" /></td
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
><td></td
></var:foreach
></var:foreach
></tr>
</tbody>
</table>