]> err.no Git - scalable-opengroupware.org/commitdiff
attendee selector
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 15 Aug 2004 18:03:22 +0000 (18:03 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 15 Aug 2004 18:03:22 +0000 (18:03 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@230 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Anais/AnaisAttendeeSelector.m
SOGo/UI/Anais/AnaisAttendeeSelector.wox
SOGo/UI/Anais/ChangeLog
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxAppointmentEditor.wox
SOGo/UI/Scheduler/Version

index 7bcc8a748eea7b80a4bb0db681f2c9c4420ffdbe..cfcc02c9c827a786e30443053426773aec1312d7 100644 (file)
   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 {
index 76e9b6c55f5f24ae88454905120290f646762179..471a88e204365634c3e830da3e1572e0d16a5b71 100644 (file)
                  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>
index 29eeed14dde8ebfc0495787b75b026eb17b25284..37b725780a51ad01f2e3083480385f0add841a43 100644 (file)
@@ -1,5 +1,8 @@
 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)
index a03d2f807bbf0952648ee1cb8660c2fd730c3651..31a32af28068fe564cd8572b9b4af5d839c22b25 100644 (file)
@@ -1,3 +1,12 @@
+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
index 53a6fbcbc0f06384553134b807fd94f1975dff60..93081f2f92db113281b71664dce2d718f6e7ccd8 100644 (file)
   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:@"%@;%@",
index 46ab1be02ebc0d267b659be97903b01e67f79140..ed544bac91bfa1255506d855196cc76d4248f06d 100644 (file)
       </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>
index 08df903e80a30cf7862f01cd08d4f93daa5cb158..24305041d295b6d9e8bf57b7f790165ec52d12ed 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 
-SUBMINOR_VERSION:=43
+SUBMINOR_VERSION:=44
 
 # v0.9.41 requires libNGObjWeb     v4.2.431
 # v0.9.31 requires libWEExtensions v4.2.52