]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@225 d1b88da0-ebda-0310-925b-ed51d...
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 15 Aug 2004 17:10:38 +0000 (17:10 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 15 Aug 2004 17:10:38 +0000 (17:10 +0000)
SOGo/UI/Anais/AnaisAttendeeSelector.m [new file with mode: 0644]
SOGo/UI/Anais/AnaisAttendeeSelector.wox [new file with mode: 0644]
SOGo/UI/Anais/AnaisSelector.m
SOGo/UI/Anais/AnaisSelector.wox
SOGo/UI/Anais/ChangeLog
SOGo/UI/Anais/GNUmakefile
SOGo/UI/Anais/Version
SOGo/UI/Anais/bundle-info.plist
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxAppointmentEditor.wox

diff --git a/SOGo/UI/Anais/AnaisAttendeeSelector.m b/SOGo/UI/Anais/AnaisAttendeeSelector.m
new file mode 100644 (file)
index 0000000..df93edd
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+  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: AnaisSelector.m 184 2004-08-11 17:46:10Z znek $
+
+#include <SOGoUI/UIxComponent.h>
+
+/*
+  AnaisAttendeeSelector
+  
+  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
+*/
+
+@class iCalPerson;
+
+@interface AnaisAttendeeSelector : UIxComponent
+{
+  NSString   *selectorID;
+  NSArray    *attendees;
+  iCalPerson *attendee;
+}
+
+@end
+
+#include <NGiCal/NGiCal.h>
+#include <NGObjWeb/WOContext.h>
+#include "common.h"
+
+@implementation AnaisAttendeeSelector
+
+- (void)dealloc {
+  [self->selectorID release];
+  [self->attendee   release];
+  [self->attendees  release];
+  [super dealloc];
+}
+
+/* notifications */
+
+- (void)sleep {
+  [self->attendee release]; self->attendee = nil;
+  [super sleep];
+}
+
+/* accessors */
+
+- (void)setAttendees:(NSArray *)_attendees {
+  ASSIGN(self->attendees, _attendees);
+}
+- (NSArray *)attendees {
+  return self->attendees;
+}
+
+- (void)setAttendee:(iCalPerson *)_attendee {
+  ASSIGN(self->attendee, _attendee);
+}
+- (iCalPerson *)attendee {
+  return self->attendee;
+}
+
+/* id accessors */
+
+- (void)setSelectorID:(NSString *)_value {
+  ASSIGNCOPY(self->selectorID, _value);
+}
+- (NSString *)selectorID {
+  return self->selectorID;
+}
+- (NSString *)capitalizedSelectorID {
+  return [[self selectorID] capitalizedString];
+}
+
+- (NSString *)windowId {
+  /* eg: 'Resources' */
+  return [[self capitalizedSelectorID] stringByAppendingString:@"s"];
+}
+- (NSString *)callbackName {
+  /* eg: 'addResource' */
+  return [@"add" stringByAppendingString:[self capitalizedSelectorID]];
+}
+- (NSString *)tableId {
+  /* eg: 'resources' */
+  return [[self selectorID] stringByAppendingString:@"s"];
+}
+- (NSString *)checkboxId {
+  /* eg: 'resources' */
+  return [self tableId]; /* TODO: znek, is this ok? */
+}
+
+/* handling requests */
+
+- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
+  [self logWithFormat:@"Note: will take values ..."];
+  [super takeValuesFromRequest:_rq inContext:_ctx];
+}
+
+/* response generation */
+
+- (NSString *)jsCode {
+  NSMutableString *ms;
+  WOContext *ctx;
+  NSString *s;
+
+  ms = [NSMutableString stringWithCapacity:128];
+  
+  ctx = [self context];
+  if (![[ctx valueForKey:@"HasAddTableAnaisAttendeeSelector"] boolValue]) {
+    static NSString *script = \
+      @"function addToTable(tableId, type, cn, dn, email, uid, sn) {\n"
+      @"  var test = document.getElementById(email);"
+      @"  if(test)"
+      @"    return;"
+      @""
+      @"  var table = document.getElementById(tableId);"
+      @"  var tr = document.createElement('tr');"
+      @"  var td, checkbox, text;"
+      @""
+      @"  td = document.createElement('td');"
+      @"  checkbox = document.createElement('input');"
+      @"  checkbox.setAttribute('type', 'checkbox');"
+      @"  checkbox.setAttribute('checked', 'checked');"
+      @"  checkbox.setAttribute('value', email + ';' + cn);"
+      @"  checkbox.setAttribute('id', email);"
+      @"  checkbox.setAttribute('name', tableId);"
+      @"  td.appendChild(checkbox);"
+      @"  tr.appendChild(td);"
+      @"  td = document.createElement('td');"
+      @"  text = document.createTextNode(cn);"
+      @"  td.appendChild(text);"
+      @"  tr.appendChild(td);"
+      @"  table.appendChild(tr);"
+      @"}\n";
+    [ms appendString:script];
+    
+    [ctx takeValue:[NSNumber numberWithBool:YES]
+        forKey:@"HasAddTableAnaisAttendeeSelector"];
+  }
+  
+  s = 
+    @"function %@(type, cn, dn, email, uid, sn) {\n"
+    @"  addToTable('%@', type, cn, dn, email, uid, sn);\n"
+    @"}\n";
+  [ms appendFormat:s, [self callbackName], [self tableId]];
+  return ms;
+}
+
+@end /* AnaisAttendeeSelector */
diff --git a/SOGo/UI/Anais/AnaisAttendeeSelector.wox b/SOGo/UI/Anais/AnaisAttendeeSelector.wox
new file mode 100644 (file)
index 0000000..7404717
--- /dev/null
@@ -0,0 +1,30 @@
+<?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"
+  class="aptview_text"
+>
+  <script language="JavaScript">
+    <var:string value="jsCode" const:escapeHTML="NO" />
+  </script>
+  <var:component className="AnaisSelector"
+                 label:title="Search in Anais"
+                 const:windowId="windowId"
+                 var:callback="callbackName" />
+  <hr />
+  <table var:id="tableId">
+    <var:foreach list="attendees" item="attendee">
+      <tr>
+        <td><input type="checkbox"
+                   checked="YES"
+                   var:value="attendee.rfc822Email"
+                   var:id="attendee.rfc822Email"
+                   var:name="checkboxId"
+            /></td>
+        <td><var:string value="attendee.cnForDisplay" /></td>
+      </tr>
+    </var:foreach>
+  </table>
+</span>
index 9cba783fc4250022c4d4b02cf332f191eb8bf481..8b1b34e5e39341b3c95c0ef6c6fb6dc156d18edc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2000-2004 SKYRIX Software AG
+  Copyright (C) 2004 SKYRIX Software AG
 
   This file is part of OpenGroupware.org.
 
@@ -20,7 +20,6 @@
 */
 // $Id$
 
-
 #include <SOGoUI/UIxComponent.h>
 
 @interface AnaisSelector : UIxComponent
 @implementation AnaisSelector
 
 - (id)init {
-    self = [super init];
-    if(self) {
-        [self setTitle:@"Anais"];
-        [self setWindowId:@"Anais"];
-        [self setCallback:@"undefined"];
-    }
-    return self;
+  if ((self = [super init])) {
+    [self setTitle:@"Anais"];
+    [self setWindowId:@"Anais"];
+    [self setCallback:@"undefined"];
+  }
+  return self;
 }
 
 - (void)dealloc {
-    [self->title release];
-    [self->windowId release];
-    [self->division release];
-    [self->callback release];
-    [super dealloc];
+  [self->title    release];
+  [self->windowId release];
+  [self->division release];
+  [self->callback release];
+  [super dealloc];
 }
 
+/* accessors */
+
 - (void)setTitle:(NSString *)_title {
-    ASSIGN(self->title, _title);
+  ASSIGNCOPY(self->title, _title);
 }
 - (NSString *)title {
-    return self->title;
+  return self->title;
 }
 
 - (void)setWindowId:(NSString *)_winId {
-    ASSIGN(self->windowId, _winId);
+  ASSIGNCOPY(self->windowId, _winId);
 }
 - (NSString *)windowId {
-    return self->windowId;
+  return self->windowId;
 }
 
 - (void)setDivision:(NSString *)_division {
-    ASSIGN(self->division, _division);
+  ASSIGNCOPY(self->division, _division);
 }
 - (NSString *)division {
-    return self->division;
+  return self->division;
 }
 
 - (void)setCallback:(NSString *)_callback {
-    ASSIGN(self->callback, _callback);
+  ASSIGNCOPY(self->callback, _callback);
 }
 - (NSString *)callback {
-    return self->callback;
+  return self->callback;
 }
 
-
 /* JavaScript */
 
 - (NSString *)jsFunctionName {
-    return [NSString stringWithFormat:@"openAnaisWindowWithId%@",
+  return [NSString stringWithFormat:@"openAnaisWindowWithId%@",
         [self windowId]];
 }
 
 - (NSString *)jsFunctionHref {
-    return [NSString stringWithFormat:@"javascript:%@()",
+  return [NSString stringWithFormat:@"javascript:%@()",
         [self jsFunctionName]];
 }
 
 - (NSString *)jsCode {
-    static NSString *codeFmt = \
+  static NSString *codeFmt = \
     @"function %@() {\n"
     @"  var url = '/anais/aideAnais.php?m_fonc=%@%@&m_champ=mail,uid,sn#mon_etiquette';\n"
     @"  var anaisWindow = window.open(url, '%@', 'width=350, height=600, left=10, top=10, toolbar=no, dependent=yes, menubar=no, location=no, resizable=yes, scrollbars=yes, directories=no, status=no');\n"
         [self windowId]];
 }
 
-@end
+@end /* AnaisSelector */
index 1f1928695992269d408a06c91969a72fc2ad956e..a868809f5ce24b101e84a4aeb536f286b4eb9ce4 100644 (file)
@@ -1,5 +1,4 @@
 <?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"
index eb3b8da62c9601d0453a10fdedb39760a67eff17..748e83db4ed051ea6bef7920ce2df8f7ffbf117f 100644 (file)
@@ -1,3 +1,7 @@
+2004-08-15  Helge Hess  <helge.hess@skyrix.com>
+
+       * added AnaisAttendeeSelector component (v0.9.4)
+
 2004-08-12  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * AnaisUidSelector.[m|wox]: fixed all known problems (v0.9.3)
index 554bf368cc0bd7e9c5ec4bf256d21104646ad029..ef9450d4dc0b583139abe674bd16eb81ae0fb34c 100644 (file)
@@ -12,14 +12,14 @@ AnaisUI_OBJC_FILES +=               \
        AnaisUIProduct.m        \
        AnaisSelector.m         \
        AnaisUidSelector.m      \
-
+       AnaisAttendeeSelector.m \
 
 AnaisUI_RESOURCE_FILES +=      \
        Version                 \
        product.plist           \
        AnaisSelector.wox       \
        AnaisUidSelector.wox    \
-
+       AnaisAttendeeSelector.wox
 
 ADDITIONAL_INCLUDE_DIRS += \
        -I.. -I../.. -I../../..
index 2d11c00f780fc0be2ddafc8978ae8a254b27a1ee..deba2e259dfd7bb9bdd2d98ebf87d70ad5202c59 100644 (file)
@@ -1,3 +1,3 @@
 # $Id: Version 165 2004-08-05 17:55:50Z znek $
 
-SUBMINOR_VERSION:=3
+SUBMINOR_VERSION:=4
index 050b134f56839cadb84d5feae24172273d025990..bb9ae84f0e5f9ac90a9f018cd9f4c81dc860446b 100644 (file)
 
   provides = {
     classes = (
-      { name = AnaisUIProduct;       },
-      { name = AnaisSelector;        },
+      { name = AnaisUIProduct;        },
+      { name = AnaisSelector;         },
+      { name = AnaisAttendeeSelector; },
     );
 
     WOComponents = (
-      { name = AnaisSelector;  },
+      { name = AnaisSelector;         },
+      { name = AnaisAttendeeSelector; },
     );
   };
 }
index 83853c860c77e45b687e8ffb267eb7cf292f48e7..cbeebb648387f837c853e28ae3bebac3424e829c 100644 (file)
   NSString       *iCalString;
   NSString       *uri;
   NSCalendarDate *sd, *ed;
-  NSArray        *attendees;
+  NSArray        *attendees, *resources;
   WORequest      *req;
-
   
   if (![[self clientObject] respondsToSelector:@selector(saveContentString:)]){
     /* return 400 == Bad Request */
   attendees = [self getICalPersonsFromFormValues:
                      [req formValuesForKey:@"participants"]
                    treatAsResource:NO];
-  [apt setAttendees:attendees];
-  attendees = [self getICalPersonsFromFormValues:
+  resources = [self getICalPersonsFromFormValues:
                      [req formValuesForKey:@"resources"]
                    treatAsResource:YES];
-  [apt appendAttendees:attendees];
+  if ([resources count] > 0) {
+    attendees = ([attendees count] > 0)
+      ? [attendees arrayByAddingObjectsFromArray:resources]
+      : resources;
+  }
+  [apt setAttendees:attendees];
+  
   [apt setOrganizer:[self getOrganizer]];
   
   /* receive current representation for save operation */
index 063e6f32191697704560530dfb0de3aa00a6dba0..322dfa8c9a7bf60a72c5fccef4d51975a0f07460 100644 (file)
       </tr>
       <tr>
         <td>
-          <table border="0"
-                 cellpadding="2"
-                 width="100%"
-                 cellspacing="0"
-                 bgcolor="#e8e8e0"
+          <table border="0" cellpadding="2" cellspacing="0"
+                 width="100%" bgcolor="#e8e8e0"
           >
             <tr>
               <td align="left" colspan="2">