]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@126 d1b88da0-ebda-0310-925b-ed51d...
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 30 Jun 2004 15:21:37 +0000 (15:21 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 30 Jun 2004 15:21:37 +0000 (15:21 +0000)
SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxAppointmentFormatter.m
SOGo/UI/Scheduler/UIxAppointmentView.m
SOGo/UI/Scheduler/UIxAppointmentView.wox
SOGo/UI/Scheduler/UIxCalView.m
SOGo/UI/Scheduler/UIxCalWeekOverview.wox

index 9ae531e56a63c719fd56f153631670fab4b103f9..4c9eef0d7751559f5ac488e276eb46152ed069b4 100644 (file)
@@ -21,6 +21,7 @@
 // $Id$
 
 #include "SOGoAppointmentFolder.h"
+#include <OGoContentStore/OCSFolder.h>
 #include "common.h"
 #include <unistd.h>
 #include <stdlib.h>
@@ -96,17 +97,85 @@ printf( "%x", *(int *) &f);
 
 /* fetching */
 
+- (NSMutableDictionary *)fixupRecord:(NSDictionary *)_record {
+  NSMutableDictionary *md;
+  id tmp;
+  
+  md = [[_record mutableCopy] autorelease];
+  
+  if ((tmp = [_record objectForKey:@"startdate"])) {
+    tmp = [[NSCalendarDate alloc] initWithTimeIntervalSince1970:
+                                   (NSTimeInterval)[tmp unsignedIntValue]];
+    if (tmp) [md setObject:tmp forKey:@"startDate"];
+    [tmp release];
+  }
+  else
+    [self logWithFormat:@"missing 'startdate' in record?"];
+  
+  if ((tmp = [_record objectForKey:@"enddate"])) {
+    tmp = [[NSCalendarDate alloc] initWithTimeIntervalSince1970:
+                                   (NSTimeInterval)[tmp unsignedIntValue]];
+    if (tmp) [md setObject:tmp forKey:@"endDate"];
+    [tmp release];
+  }
+  else
+    [self logWithFormat:@"missing 'enddate' in record?"];
+  
+  return md;
+}
+
+- (NSArray *)fixupRecords:(NSArray *)_records {
+  NSMutableArray *ma;
+  unsigned i, count;
+
+  if (_records == nil) return nil;
+  if ((count = [_records count]) == 0)
+    return _records;
+  
+  ma = [NSMutableArray arrayWithCapacity:count];
+  for (i = 0; i < count; i++) {
+    id row;
+    
+    row = [self fixupRecord:[_records objectAtIndex:i]];
+    if (row) [ma addObject:row];
+  }
+  return ma;
+}
+
 - (NSArray *)fetchCoreInfosFrom:(NSCalendarDate *)_startDate
   to:(NSCalendarDate *)_endDate 
 {
-  id appointments;
+  OCSFolder   *folder;
+  EOQualifier *qualifier;
+  NSArray     *fields, *records;
+  NSString    *sql;
+  
+  if ((folder = [self ocsFolder]) == nil) {
+    [self logWithFormat:@"ERROR(%s): missing folder for fetch!",
+           __PRETTY_FUNCTION__];
+    return nil;
+  }
   
   [self logWithFormat:@"should fetch (%@ => %@) ...", _startDate, _endDate];
   
-#warning TODO: IMPLEMENT!
+  sql = [NSString stringWithFormat:@"(startdate < %d) AND (enddate > %d)",
+                 (unsigned int)[_endDate   timeIntervalSince1970],
+                 (unsigned int)[_startDate timeIntervalSince1970]];
+  qualifier = [EOQualifier qualifierWithQualifierFormat:sql];
+  
+  fields = [NSArray arrayWithObjects:
+                     @"uid", @"startdate", @"enddate",
+                     @"title", @"participants", nil];
+  
+  records = [folder fetchFields:fields matchingQualifier:qualifier];
+  if (records == nil) {
+    [self logWithFormat:@"ERROR(%s): fetch failed!", __PRETTY_FUNCTION__];
+    return nil;
+  }
   
-  [self logWithFormat:@"fetched %i records.", [appointments count]];
-  return appointments;
+  records = [self fixupRecords:records];
+  [self logWithFormat:@"fetched %i records: %@", [records count], records];
+  return records;
 }
 
 @end /* SOGoAppointmentFolder */
index 55c14f34e25d6b391d65e229b293f2b96af5b0e6..8ce1d8025b9c7e1e8958197379452985c21b9663 100644 (file)
@@ -1,5 +1,7 @@
 2004-06-30  Helge Hess  <helge.hess@opengroupware.org>
 
+       * UIxAppointmentView.wox: made the attendee emails clickable
+
        * UIxCalView.m: removed -fetchGIDs, moved -fetchCoreInfos to client
          object
 
index 1380448754a83212d7bdd28975d883abc1d039e6..b2f937d1a79cd8d5d286f2ddce9e3201cb6a1dfa 100644 (file)
@@ -58,7 +58,6 @@
   return AUTORELEASE([[UIxAppointmentFormatter alloc] init]);
 }
 
-#if !LIB_FOUNDATION_BOEHM_GC
 - (void)dealloc {
   RELEASE(self->formatString);
   RELEASE(self->dateFormat);
@@ -71,7 +70,6 @@
 
   [super dealloc];
 }
-#endif
 
 // accessors
 
index 45fb80a864fe6aae0301de48158db59a62b26c31..62fd16a2c9a9535683890f8890e3b7bfa2a3c306 100644 (file)
 }
 
 
+- (NSString *)attendeeEmail {
+  NSString *s;
+  
+  s = [[self attendee] email];
+  if (![s hasPrefix:@"mailto:"]) return s;
+  return [s substringFromIndex:7];
+}
+
 /* backend */
 
 - (SOGoAppointment *)appointment {
index 2764e2e95edb3edd3bf93a04010e015783731cb2..775a5c5f5eba8b0edf4d2a324a3f15f5e17c5d91 100644 (file)
               <tr valign="top">
                 <td align="left" bgcolor="#FFFFF0">
                   <span class="aptview_text">
-                    <var:string value="attendee.email" />
+                    <a var:href="attendee.email"
+                       ><var:string value="attendeeEmail" /></a>
                   </span>
                 </td>
               </tr>
index 9510fc3308b216123ce27b592d3667ac4dac4326..26120a93015eab5c1531b4b70a0765b636936471 100644 (file)
 }
 
 - (NSString *)shortTextForApt {
-    UIxAppointmentFormatter *f;
-    
-    f = [UIxAppointmentFormatter formatterWithFormat:
+#if 1
+  NSCalendarDate *startDate;
+  NSString *ms;
+  
+  startDate = [[self appointment] valueForKey:@"startDate"];
+  ms = [NSString stringWithFormat:@"%02i:%02i %@",
+                [startDate hourOfDay],
+                [startDate minuteOfHour],
+                [[self appointment] valueForKey:@"title"]];
+  return ms;
+#else
+  UIxAppointmentFormatter *f;
+  
+  f = [UIxAppointmentFormatter formatterWithFormat:
         @"%S - %E;\n%T;\n%L;\n%5P;\n%50R"];
-    [f setRelationDate:[self referenceDateForFormatter]];
-    [f setShowFullNames:[self showFullNames]];
-    if([self showAMPMDates])
+  [f setRelationDate:[self referenceDateForFormatter]];
+  [f setShowFullNames:[self showFullNames]];
+  if([self showAMPMDates])
         [f switchToAMPMTimes:YES];
     
-    return [NSString stringWithFormat:@"%@:\n%@",
+  return [NSString stringWithFormat:@"%@:\n%@",
         [self aptTypeLabel],
         [f stringForObjectValue:self->appointment]];
+#endif
 }
 
 - (NSString *)shortTitleForApt {
 }
 
 - (NSArray *)fetchCoreInfos {
-  return [[self clientObject] fetchCoreInfosFrom:[self startDate] 
-                             to:[self endDate]];
+  if (self->appointments)
+    return self->appointments;
+
+  self->appointments =
+    [[[self clientObject] fetchCoreInfosFrom:[self startDate] 
+                         to:[self endDate]] retain];
+  return self->appointments;
 }
 
 /* date selection & conversion */
index 37417854feaf062dbd8bc189f27101c0acda899a..b07f74e83f35e30153dd4681c52cf456c458470a 100644 (file)
         <var:if condition="hasDayInfo">
             <var:week-info>
                 <var:if condition="hasHolidayInfo">
-                    <var:string value="holidayInfo" const:class="weekoverview_holidayinfo" />
+                    <var:string value="holidayInfo" 
+                               const:class="weekoverview_holidayinfo" />
                 </var:if>
                 <var:foreach list="allDayApts" item="appointment">
                     <a var:href="appointmentViewURL"