Select a set of attendees using Anais.
Bindings:
- attendees - array of iCalPerson objects
- selectorID - string to be used as the identifier for form/JS elements
+ attendees - array of iCalPerson objects
+ selectorID - string to be used as the identifier for form/JS elements
+ withCN - show CN of person (eg disabled for resources)
+ division - Anais division
+ emailForUser - default EMail
+ cnForUser - default CN
Sample:
<var:component className="AnaisAttendeeSelector"
NSString *division;
NSArray *attendees;
iCalPerson *attendee;
+ NSString *emailForUser;
+ NSString *cnForUser;
+ struct {
+ int withCN:1;
+ int reserved:31;
+ } flags;
}
@end
#include <NGiCal/NGiCal.h>
+#include <Scheduler/iCalPerson+UIx.h>
#include <NGObjWeb/WOContext.h>
#include "common.h"
@implementation AnaisAttendeeSelector
- (void)dealloc {
- [self->division release];
- [self->selectorID release];
- [self->attendee release];
- [self->attendees release];
+ [self->emailForUser release];
+ [self->cnForUser release];
+ [self->division release];
+ [self->selectorID release];
+ [self->attendee release];
+ [self->attendees release];
[super dealloc];
}
- (NSArray *)attendees {
return self->attendees;
}
+- (BOOL)hasAttendees {
+ return [[self attendees] count] > 0 ? YES : NO;
+}
+- (BOOL)hasNoAttendees {
+ return [[self attendees] count] == 0 ? YES : NO;
+}
+
+- (void)setWithCN:(BOOL)_flag {
+ self->flags.withCN = _flag ? 1 : 0;
+}
+- (BOOL)withCN {
+ return self->flags.withCN ? YES : NO;
+}
- (void)setAttendee:(iCalPerson *)_attendee {
ASSIGN(self->attendee, _attendee);
return self->division;
}
+- (void)setEmailForUser:(NSString *)_value {
+ ASSIGNCOPY(self->emailForUser, _value);
+}
+- (NSString *)emailForUser {
+ return self->emailForUser;
+}
+
+- (void)setCnForUser:(NSString *)_value {
+ ASSIGNCOPY(self->cnForUser, _value);
+}
+- (NSString *)cnForUser {
+ return self->cnForUser;
+}
+
+- (BOOL)showDefaultAttendees {
+ return [self hasNoAttendees] && [[self emailForUser] length] > 0 ? YES : NO;
+}
+
+/* email, cn */
+
+- (NSString *)combinedCNAndEmailForUser {
+ NSString *e, *c;
+
+ e = [self emailForUser];
+ c = [self cnForUser];
+ return [[e stringByAppendingString:@";"] stringByAppendingString:c];
+}
+
+- (NSString *)combinedCNAndEmail {
+ NSString *e, *c;
+
+ e = [[self attendee] rfc822Email];
+ c = [[self attendee] cnForDisplay];
+ return [[e stringByAppendingString:@";"] stringByAppendingString:c];
+}
+
/* id accessors */
- (void)setSelectorID:(NSString *)_value {
var:callback="callbackName" />
<hr />
<table var:id="tableId">
- <var:foreach list="attendees" item="attendee">
+ <var:if condition="showDefaultAttendees">
<tr>
<td><input type="checkbox"
checked="YES"
- var:value="attendee.rfc822Email"
- var:id="attendee.rfc822Email"
+ var:value="combinedCNAndEmailForUser"
+ var:id="emailForUser"
var:name="checkboxId"
- /></td>
+ /></td>
+ <td><var:string value="cnForUser" /></td>
+ </tr>
+ </var:if>
+
+ <var:foreach list="attendees" item="attendee">
+ <tr>
+ <var:if condition="withCN">
+ <td><input type="checkbox"
+ checked="YES"
+ var:value="combinedCNAndEmail"
+ var:id="attendee.rfc822Email"
+ var:name="checkboxId"
+ /></td>
+ </var:if>
+
+ <var:if condition="withCN" const:negate="YES">
+ <td><input type="checkbox"
+ checked="YES"
+ var:value="attendee.rfc822Email"
+ var:id="attendee.rfc822Email"
+ var:name="checkboxId"
+ /></td>
+ </var:if>
+
<td><var:string value="attendee.cnForDisplay" /></td>
</tr>
</var:foreach>
2004-08-15 Helge Hess <helge.hess@skyrix.com>
+ * AnaisAttendeeSelector.m: added support for default attendees (as used
+ by the editor component) (v0.9.6)
+
* AnaisAttendeeSelector.wox: added 'division' binding (v0.9.5)
* added AnaisAttendeeSelector component (v0.9.4)
+2004-08-15 Helge Hess <helge.hess@skyrix.com>
+
+ * v0.9.44
+
+ * UIxAppointmentEditor.m: use new AnaisAttendeeSelector
+
+ * UIxAppointmentEditor.m: replaced formattedAptStartDate with a
+ titleDateFormatter (directly bound to the string element)
+
2004-08-15 Marcus Mueller <znek@mulle-kybernetik.com>
* v0.9.43
return self->item;
}
-- (NSString *)formattedAptStartTime {
- NSCalendarDate *date;
+- (NSFormatter *)titleDateFormatter {
SOGoDateFormatter *fmt;
- NSString *s;
-
- date = [[[[self appointment] startDate] copy] autorelease];
- [date setTimeZone:[self viewTimeZone]];
- fmt = [[SOGoDateFormatter alloc] initWithLocale:[self locale]];
+
+ fmt = [[[SOGoDateFormatter alloc] initWithLocale:[self locale]] autorelease];
[fmt setFullWeekdayNameAndDetails];
- s = [fmt stringForObjectValue:date];
- [fmt release];
- return s;
+ return fmt;
}
- (NSCalendarDate *)aptStartDate {
- NSCalendarDate *date;
-
- date = [[[[self appointment] startDate] copy] autorelease];
- [date setTimeZone:[self viewTimeZone]];
- return date;
+ NSCalendarDate *date;
+
+ date = [[[[self appointment] startDate] copy] autorelease];
+ [date setTimeZone:[self viewTimeZone]];
+ return date;
}
- (NSCalendarDate *)aptEndDate {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- date = [[[[self appointment] endDate] copy] autorelease];
- [date setTimeZone:[self viewTimeZone]];
- return date;
+ date = [[[[self appointment] endDate] copy] autorelease];
+ [date setTimeZone:[self viewTimeZone]];
+ return date;
}
- (BOOL)isNewAppointment {
return [self completeHrefForMethod:uri];
}
-/* email, cn */
+/* email, cn TODO: unused now?*/
- (NSString *)combinedCNAndEmailForUser {
return [NSString stringWithFormat:@"%@;%@",
</tr>
<tr>
<td>
- <table border="0"
- cellpadding="2"
- width="100%"
- cellspacing="0"
+ <table border="0" cellpadding="2" cellspacing="0" width="100%"
bgcolor="#e8e8e0"
>
<tr>
<td align="left" colspan="2">
<span class="aptview_title">
<var:string label:value="Appointment on" />
- <var:string value="formattedAptStartTime" /></span>
+ <var:string formatter="titleDateFormatter"
+ value="aptStartDate" /></span>
</td>
</tr>
<tr valign="top">
</td>
<td align="left" bgcolor="#FFFFF0">
<span class="aptview_text">
- <input type="text"
- name="summary"
- var:value="appointment.summary"
- const:size="40"
- />
+ <input type="text" name="summary" const:size="40"
+ var:value="appointment.summary" />
</span>
</td>
</tr>
</td>
<td align="left" bgcolor="#FFFFF0">
<span class="aptview_text">
- <input type="text"
- name="location"
- var:value="appointment.location"
- const:size="40"
- />
+ <input type="text" name="location" const:size="40"
+ var:value="appointment.location" />
</span>
</td>
</tr>
<var:string label:value="Participants" />:</span>
</td>
<td align="left" bgcolor="#FFFFF0">
- <script language="JavaScript">
- <var:string value="jsCode" const:escapeHTML="NO" />
- </script>
-
<span class="aptview_text">
- <var:component className="AnaisSelector"
- label:title="Search in Anais"
- const:windowId="Participants"
- const:callback="addParticipant"
- const:division="CC"
+ <var:component className="AnaisAttendeeSelector"
+ const:selectorID="participant"
+ const:division="CC"
+ const:withCN="YES"
+ attendees="appointment.participants"
+ var:emailForUser="emailForUser"
+ var:cnForUser="cnForUser"
/>
- <hr />
- <table id="participants">
- <var:if condition="appointment.hasParticipants"
- const:negate="YES"
- >
- <tr>
- <td><input type="checkbox"
- checked="YES"
- var:value="combinedCNAndEmailForUser"
- var:id="emailForUser"
- name="participants"
- /></td>
- <td><var:string value="cnForUser" /></td>
- </tr>
- </var:if>
- <var:if condition="appointment.hasParticipants">
- <var:foreach list="appointment.participants"
- item="item"
- >
- <tr>
- <td><input type="checkbox"
- checked="YES"
- var:value="combinedCNAndEmail"
- var:id="item.rfc822Email"
- name="participants"
- /></td>
- <td><var:string value="item.cnForDisplay" /></td>
- </tr>
- </var:foreach>
- </var:if>
- </table>
</span>
</td>
</tr>
</tr>
<tr>
<td>
- <table border="0"
- cellpadding="2"
- width="100%"
- cellspacing="0"
+ <table border="0" cellpadding="2" cellspacing="0" width="100%"
bgcolor="#e8e8e0"
>
<tr>
</td>
<td align="left" bgcolor="#FFFFF0">
<span class="aptview_text">
- <var:component className="AnaisSelector"
- label:title="Search in Anais"
- const:windowId="Resources"
- const:callback="addResource"
+ <var:component className="AnaisAttendeeSelector"
+ const:selectorID="resource"
+ attendees="appointment.resources"
+ const:division="CC"
/>
- <hr />
- <table id="resources">
- <var:foreach list="appointment.resources"
- item="item"
- >
- <tr>
- <td><input type="checkbox"
- checked="YES"
- var:value="item.rfc822Email"
- var:id="item.rfc822Email"
- name="resources"
- /></td>
- <td><var:string value="item.cnForDisplay" /></td>
- </tr>
- </var:foreach>
- </table>
</span>
</td>
</tr>
</tr>
<tr>
<td>
- <table border="0"
- cellpadding="2"
- width="100%"
- cellspacing="0"
+ <table border="0" cellpadding="2" cellspacing="0" width="100%"
bgcolor="#e8e8e0"
>
<tr>
</td>
<td align="left" bgcolor="#FFFFF0">
<span class="aptview_text">
- <textarea name="comment"
- rows="8"
- cols="80"
- wrap="physical"
- ><var:string value="appointment.comment" /></textarea>
+ <textarea name="comment" rows="8" cols="80" wrap="physical"
+ var:value="appointment.comment" />
</span>
</td>
</tr>
# $Id$
-SUBMINOR_VERSION:=43
+SUBMINOR_VERSION:=44
# v0.9.41 requires libNGObjWeb v4.2.431
# v0.9.31 requires libWEExtensions v4.2.52