]> err.no Git - scalable-opengroupware.org/commitdiff
priority and categories for events
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 6 Oct 2004 10:53:34 +0000 (10:53 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 6 Oct 2004 10:53:34 +0000 (10:53 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@365 d1b88da0-ebda-0310-925b-ed51d893ca5b

17 files changed:
SOGo/SOGo.xcode/project.pbxproj
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/English.lproj/default.strings
SOGo/UI/Scheduler/GNUmakefile
SOGo/UI/Scheduler/SOGoAppointment+UIx.h [new file with mode: 0644]
SOGo/UI/Scheduler/SOGoAppointment+UIx.m [new file with mode: 0644]
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxAppointmentEditor.wox
SOGo/UI/Scheduler/UIxAppointmentView.h
SOGo/UI/Scheduler/UIxAppointmentView.m
SOGo/UI/Scheduler/UIxAppointmentView.wox
SOGo/UI/Scheduler/Version
SOGoLogic/ChangeLog
SOGoLogic/SOGoAppointment.h
SOGoLogic/SOGoAppointment.m
SOGoLogic/SOGoAppointmentICalRenderer.m
SOGoLogic/Version

index d48109fb378f9b0683069404984bb349183eb6ff..5b56d6cd48b209ecc645ebaeec568dc8c6112030 100644 (file)
                        refType = 4;
                        sourceTree = "<group>";
                };
+               ADA63205071330AE0058C21C = {
+                       fileEncoding = 4;
+                       isa = PBXFileReference;
+                       lastKnownFileType = sourcecode.c.h;
+                       path = "SOGoAppointment+UIx.h";
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               ADA63206071330AE0058C21C = {
+                       fileEncoding = 4;
+                       isa = PBXFileReference;
+                       lastKnownFileType = sourcecode.c.objc;
+                       path = "SOGoAppointment+UIx.m";
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
                ADCDE53106ADA8AC00BFCE2B = {
                        fileEncoding = 5;
                        indentWidth = 8;
                                AD73BE7E06CF90EA00226A2D,
                                AD071B3C06CCFA2000A9EEF4,
                                AD071B3D06CCFA2000A9EEF4,
+                               ADA63205071330AE0058C21C,
+                               ADA63206071330AE0058C21C,
                                AD73BE6106CF8CC500226A2D,
                                AD73BE6206CF8CC500226A2D,
                        );
index 1558699b2f09422978b7dc72e53d105b30e60415..a7d13b0d496d07cbb4d338ec1c6e76a6815e3792 100644 (file)
@@ -1,3 +1,15 @@
+2004-10-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.84
+
+       * SOGoAppointment+UIx.[hm]: new class providing UIx convenience methods
+
+       * UIxAppointmentView.[m|wox]: added priority and categories
+
+       * UIxAppointmentEditor.[m|wox]: added priority and categories
+
+       * English.lproj/default.strings: new labels
+
 2004-09-25  Helge Hess  <helge.hess@opengroupware.org>
 
        * UIxCalDateLabel.m: minor code cleanups, fixed compilation on MacOSX
index 3645ee90fe2a3cfe04868ec77800f0bd588fcb48..ecae51a958f8448cdae49462dc22f56a7389a53b 100644 (file)
@@ -97,6 +97,8 @@
 "Name"                 = "Name";
 "Email"                        = "Email";
 "Location"             = "Location";
+"Priority"             = "Priority";
+"Categories"           = "Categories";
 "Duration"             = "Duration";
 "Participants"         = "Participants";
 "Resources"            = "Resources";
 "Chart"                        = "Chart";
 "List"                 = "List";
 "Columns"              = "Columns";
+
+/* Priorities */
+
+"prio_0"               = "Undefined";
+"prio_1"               = "High";
+"prio_2"               = "High";
+"prio_3"               = "High";
+"prio_4"               = "High";
+"prio_5"               = "Normal";
+"prio_6"               = "Low";
+"prio_7"               = "Low";
+"prio_8"               = "Low";
+"prio_9"               = "Low";
+
+/* Appointment categories */
+
+"APPOINTMENT"          = "Appointment";
+"NOT IN OFFICE"                = "Outside";
+"MEETING"              = "Meeting";
+"HOLIDAY"              = "Holiday";
+"PHONE CALL"           = "Phone";
index e4e1372a1fabb0aa3fbcf82dcc8f4f01f4f7dfe8..796a4ca72c0ab0861577cdac21938055e163d070 100644 (file)
@@ -13,6 +13,7 @@ SchedulerUI_OBJC_FILES =              \
        UIxAppointmentFormatter.m       \
        iCalPerson+UIx.m                \
        NSCalendarDate+UIx.m            \
+       SOGoAppointment+UIx.m           \
        UIxComponent+Agenor.m           \
        \
        UIxCalView.m                    \
diff --git a/SOGo/UI/Scheduler/SOGoAppointment+UIx.h b/SOGo/UI/Scheduler/SOGoAppointment+UIx.h
new file mode 100644 (file)
index 0000000..d8792e7
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  Copyright (C) 2000-2004 SKYRIX Software AG
+
+  This file is part of OGo
+
+  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$
+
+
+#ifndef        __SOGoAppointment_UIx_H_
+#define        __SOGoAppointment_UIx_H_
+
+
+#include <SOGoLogic/SOGoAppointment.h>
+
+
+@interface SOGoAppointment (UIx)
+- (NSString *)priorityLabelKey;
+@end
+
+#endif /* __SOGoAppointment_UIx_H_ */
diff --git a/SOGo/UI/Scheduler/SOGoAppointment+UIx.m b/SOGo/UI/Scheduler/SOGoAppointment+UIx.m
new file mode 100644 (file)
index 0000000..d0816cc
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+  Copyright (C) 2000-2004 SKYRIX Software AG
+
+  This file is part of OGo
+
+  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$
+
+
+#include "SOGoAppointment+UIx.h"
+#include "common.h"
+
+@implementation SOGoAppointment (UIx)
+
+- (NSString *)priorityLabelKey {
+    NSString *prio;
+    
+    prio = [self priority];
+    if(!prio) {
+        prio = @"0";
+    }
+    else {
+        NSRange r;
+        
+        r = [prio rangeOfString:@";"];
+        if(r.length > 0) {
+            prio = [prio substringToIndex:r.location];
+        }
+    }
+    return [NSString stringWithFormat:@"prio_%@", prio];
+}
+
+@end
index 016d2ebdcf9218f6ec56c3f86c0e2a0e3358fe08..58ca1ff0dd43525968b4a324e9dbf65bff0fdbb6 100644 (file)
@@ -42,6 +42,8 @@
   NSString       *comment;
   NSArray        *participants; /* array of iCalPerson's */
   NSArray        *resources;    /* array of iCalPerson's */
+  NSString       *priority;
+  NSArray        *categories;
 }
 
 - (NSString *)iCalStringTemplate;
@@ -85,6 +87,8 @@
   [self->title        release];
   [self->location     release];
   [self->comment      release];
+  [self->priority     release];
+  [self->categories   release];
   [self->iCalString   release];
   [self->item         release];
   [super dealloc];
   return self->resources;
 }
 
+/* priorities */
+
+- (NSArray *)priorities {
+  /* 0 == undefined
+     5 == normal
+     1 == high
+  */
+  return [NSArray arrayWithObjects:
+    @"0", @"5", @"1", nil];
+}
+
+- (NSString *)itemPriorityText {
+  NSString *key;
+  
+  key = [NSString stringWithFormat:@"prio_%@", self->item];
+  return [self labelForKey:key];
+}
+
+- (void)setPriority:(NSString *)_priority {
+  ASSIGN(self->priority, _priority);
+}
+- (NSString *)priority {
+  return self->priority;
+}
+
+
+/* categories */
+
+- (NSArray *)categoryItems {
+  // TODO: make this configurable?
+  /*
+   Tasks categories will be modified as follow :
+   – by default (a simple logo or no logo at all),
+   – appointment,
+   – outside,
+   – meeting,
+   – holidays,
+   – phone.
+  */
+  return [NSArray arrayWithObjects:
+    @"APPOINTMENT",
+    @"NOT IN OFFICE",
+    @"MEETING",
+    @"HOLIDAY",
+    @"PHONE CALL",
+    nil];
+}
+
+- (NSString *)itemCategoryText {
+  return [self labelForKey:self->item];
+}
+
+- (void)setCategories:(NSArray *)_categories {
+  ASSIGN(self->categories, _categories);
+}
+- (NSArray *)categories {
+  return self->categories;
+}
+
+
 /* iCal */
 
 - (void)setICalString:(NSString *)_s {
 
 - (NSString *)iCalStringTemplate {
   static NSString *iCalStringTemplate = \
-    @"BEGIN:VCALENDAR\nMETHOD:REQUEST\nPRODID:OpenGroupware.org SOGo 0.9\n"
+    @"BEGIN:VCALENDAR\n"
+    @"METHOD:REQUEST\n"
+    @"PRODID:OpenGroupware.org SOGo 0.9\n"
     @"VERSION:2.0\n"
     @"BEGIN:VEVENT\n"
     @"UID:%@\n"
     @"DTEND:%@\n"
     @"TRANSP:OPAQUE\n"
     @"SEQUENCE:1\n"
+    @"PRIORITY:5\n"
     @"%@"
     @"END:VEVENT\n"
     @"END:VCALENDAR";
   [self->startDate setTimeZone:[self viewTimeZone]];
   [self->endDate   setTimeZone:[self viewTimeZone]];
   
-  self->title    = [[_appointment summary]  copy];
-  self->location = [[_appointment location] copy];
-  self->comment  = [[_appointment comment]  copy];
-  
+  self->title        = [[_appointment summary]  copy];
+  self->location     = [[_appointment location] copy];
+  self->comment      = [[_appointment comment]  copy];
+  self->priority     = [[_appointment priority] copy];
+  self->categories   = [[_appointment categories]   retain];
   self->participants = [[_appointment participants] retain];
   self->resources    = [[_appointment resources]    retain];
 }
   
   [_appointment setSummary:[self title]];
   [_appointment setLocation:[self location]];
-  
+  [_appointment setComment:[self comment]];
+  [_appointment setPriority:[self priority]];
+  [_appointment setCategories:[self categories]];
+
   attendees  = [self participants];
   lResources = [self resources];
   if ([lResources count] > 0) {
index 1a86a1bc01956d2ba25d5a470c0e14396d51fc2d..2797d6bfd18d3c343cb3c80471c0601a2a062320 100644 (file)
                 </span>
               </td>
             </tr>
+            <tr valign="top">
+              <td align="right" width="15%">
+                <span class="aptview_text">
+                  <var:string label:value="Priority" />:
+                </span>
+              </td>
+              <td align="left" bgcolor="#FFFFF0">
+                <span class="aptview_text">
+                  <var:popup list="priorities"
+                             item="item"
+                             string="itemPriorityText"
+                             selection="priority"
+                  />
+                </span>
+              </td>
+            </tr>
+            <tr valign="top">
+              <td align="right" width="15%">
+                <span class="aptview_text">
+                  <var:string label:value="Categories" />:
+                </span>
+              </td>
+              <td align="left" bgcolor="#FFFFF0">
+                <span class="aptview_text">
+                  <var:checkbox-list list="categoryItems"
+                                     item="item"
+                                     suffix="itemCategoryText"
+                                     selections="categories"
+                  />
+                </span>
+              </td>
+            </tr>
           </table>
         </td>
       </tr>
index cdb962fa81b7e282ffb3ac8484191b767f2709dd..fda112b25fe5cbbe774ae452f83391d32579243d 100644 (file)
@@ -13,6 +13,7 @@
   id appointment;
   id attendee;
   SOGoDateFormatter *dateFormatter;
+  id item;
 }
 
 - (id)appointment;
index c99cfce9726967a81d2464df2a36b5152ce4b2a2..e228b3e8cbde6fa26bc653c9b02150a6c4f7d6f7 100644 (file)
 @implementation UIxAppointmentView
 
 - (void)dealloc {
-  [self->appointment release];
-  [self->attendee    release];
+  [self->appointment   release];
+  [self->attendee      release];
   [self->dateFormatter release];
+  [self->item          release];
   [super dealloc];
 }
 
   return self->attendee;
 }
 
+- (void)setItem:(id)_item {
+  ASSIGN(self->item, _item);
+}
+- (id)item {
+  return self->item;
+}
+
 - (SOGoDateFormatter *)dateFormatter {
   if (self->dateFormatter == nil) {
     self->dateFormatter =
index f07ba56ea050992aa6f1af6d56b9b67fc60b4f5b..de15933bc5c8ddad30779ec6da7962594a9411c5 100644 (file)
             <var:string value="appointment.location" />
           </td>
         </tr>
+        <tr valign="top">
+          <td align="right" width="15%" bgcolor="#E8E8E0" class="aptview_text">
+            <var:string label:value="Priority" />:
+          </td>
+          <td align="left" bgcolor="#FFFFF0" class="aptview_text">
+            <var:string label:value="$appointment.priorityLabelKey" />
+          </td>
+        </tr>
         </table>
      </td>
     </tr>
                   />
                 </td>
               </tr>
+              <tr valign="top">
+                <td align="right"
+                    width="15%"
+                    bgcolor="#E8E8E0"
+                    class="aptview_text"
+                >
+                  <var:string label:value="Categories" />:
+                </td>
+                <td align="left" bgcolor="#FFFFF0" class="aptview_text">
+                  <var:foreach list="appointment.categories" item="item">
+                     <var:string label:value="$item"
+                     /><var:entity const:name="nbsp" />
+                  </var:foreach>
+                </td>
+              </tr>
               <tr valign="top">
                 <td align="right"
                     width="15%"
index a8f389c1e096c474df8d76d77af25091192fbaf4..da6507ef58b97d41b162f26208e682986230c555 100644 (file)
@@ -1,7 +1,8 @@
 # $Id$
 
-SUBMINOR_VERSION:=83
+SUBMINOR_VERSION:=84
 
+# v0.9.84 requires libSOGoLogic    v0.9.12
 # v0.9.70 requires libNGExtensions v4.3.107
 # v0.9.67 requires SOPE 4.3
 # v0.9.61 requires libNGExtensions v4.2.102
index 957d79815fae8878c7e314fbe6e12e5fb56921a0..622a81175ed37d74f9768580278087e36e998e5b 100644 (file)
@@ -1,3 +1,13 @@
+2004-10-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.12
+
+       * SOGoAppointment.[hm]: added priority and categories, also fixed bug
+         in setComment:. Introduced hasComment to simplify handling.
+
+       * SOGoAppointmentICalRenderer.m: correctly render priority, categories
+         and comment.
+
 2004-09-25  Helge Hess  <helge.hess@opengroupware.org>
 
        * fixed compilation on MacOSX (v0.9.11)
index 2ab0dbe042e135399a482cd9cf7bd052a50ba9b5..8fcf8cfda8e147cd4636852f602802769d09535a 100644 (file)
 */
 
 @class NSString, NSArray, NSCalendarDate;
-@class iCalPerson;
+@class iCalPerson, iCalEvent;
 
 @interface SOGoAppointment : NSObject
 {
   id calendar;
-  ievent;
+  iCalEvent *event;
   id participants;
 }
 
 
 - (void)setComment:(NSString *)_value;
 - (NSString *)comment;
+- (BOOL)hasComment;
+
+- (void)setPriority:(NSString *)_value;
+- (NSString *)priority;
+- (BOOL)hasPriority;
+
+- (void)setCategories:(NSArray *)_value;
+- (NSArray *)categories;
+- (BOOL)hasCategories;
 
 - (void)setStatus:(NSString *)_value;
 - (NSString *)status;
index 6785ea529402a7b6a4a11462fcd1c2db9c9a5911..15f3db7a60cfa238fbca3a2db3231d2decd83afb 100644 (file)
@@ -155,17 +155,77 @@ static SaxObjectDecoder          *sax   = nil;
 }
 
 - (void)setComment:(NSString *)_value {
+  if([_value length] == 0)
+    _value = nil;
   [self->event setComment:_value];
 }
 - (NSString *)comment {
   return [self->event comment];
 }
+- (BOOL)hasComment {
+  NSString *s = [self comment];
+  if(!s || [s length] == 0)
+    return NO;
+  return YES;
+}
+
+- (void)setPriority:(NSString *)_value {
+  [self->event setPriority:_value];
+}
+- (NSString *)priority {
+  return [self->event priority];
+}
+- (BOOL)hasPriority {
+  NSString *prio = [self priority];
+  NSRange r;
+  
+  if(!prio)
+    return NO;
+  
+  r = [prio rangeOfString:@";"];
+  if(r.length > 0) {
+    prio = [prio substringToIndex:r.location];
+  }
+  return [prio isEqualToString:@"0"] ? NO : YES;
+}
+
+- (void)setCategories:(NSArray *)_value {
+  NSString *catString;
+
+  if(!_value || [_value count] == 0) {
+    [self->event setCategories:nil];
+    return;
+  }
+  _value = [_value sortedArrayUsingSelector:@selector(compareAscending:)];
+  catString = [_value componentsJoinedByString:@","];
+  [self->event setCategories:catString];
+  [catString release];
+}
+- (NSArray *)categories {
+  NSString *catString;
+  NSArray *cats;
+  NSRange r;
+
+  catString = [self->event categories];
+  if(!catString) {
+    return [NSArray array];
+  }
+  r = [catString rangeOfString:@";"];
+  if(r.length > 0) {
+    catString = [catString substringToIndex:r.location];
+  }
+  cats = [catString componentsSeparatedByString:@","];
+  return cats;
+}
+- (BOOL)hasCategories {
+  return [self->event categories] != nil ? YES : NO;
+}
 
 - (void)setStatus:(NSString *)_value {
   [self->event setStatus:_value];
 }
 - (NSString *)status {
-  return [(iCalEvent *)self->event status];
+  return [self->event status];
 }
 
 - (void)setStartDate:(NSCalendarDate *)_date {
index 079359bd00f6e957120a18b37f3c29c15ee56093..b33c269fded0370eb50e2c97323abbd33655250c 100644 (file)
@@ -147,10 +147,29 @@ static SOGoAppointmentICalRenderer *renderer = nil;
     [s appendString:[event duration]];
     [s appendString:@"\n"];
   }
-  
+  if([_apt hasPriority]) {
+    [s appendString:@"PRIORITY:"];
+    [s appendString:[_apt priority]];
+    [s appendString:@"\n"];
+  }
+  if([_apt hasCategories]) {
+    NSString *catString;
+
+    catString = [[_apt categories] componentsJoinedByString:@","];
+    [s appendString:@"CATEGORIES:"];
+    [s appendString:catString];
+    [s appendString:@"\n"];
+  }
+  if([_apt hasComment]) {
+    [s appendString:@"COMMENT:"];
+    [s appendString:[_apt comment]];
+    [s appendString:@"\n"];
+  }
+
   [s appendString:@"STATUS:"];
   [s appendString:[_apt status]];
   [s appendString:@"\n"];
+
   
   /* what's all this? */
   [s appendString:@"TRANSP:OPAQUE\n"]; /* transparency */
index c351558f441a4d159527ee99c46d76a467ff4349..9cef79939ea704d51f0e6725b9964991d0cafe31 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=11
+SUBMINOR_VERSION:=12