]> err.no Git - scalable-opengroupware.org/blobdiff - SOGo/UI/Scheduler/UIxAppointmentView.m
general enhancements
[scalable-opengroupware.org] / SOGo / UI / Scheduler / UIxAppointmentView.m
index 68f41da4b9c49215356b5a5a0d45e03853eef358..e04dd8668e387cceb59b7a92163fd9edc8d73dca 100644 (file)
@@ -1,15 +1,17 @@
 // $Id$
 
 #include "UIxAppointmentView.h"
-#include "common.h"
 #include <NGiCal/NGiCal.h>
 #include <SOGoLogic/SOGoAppointment.h>
+#include <SOGoUI/SOGoDateFormatter.h>
+#include "common.h"
 
 @implementation UIxAppointmentView
 
 - (void)dealloc {
   [self->appointment release];
   [self->attendee    release];
+  [self->dateFormatter release];
   [super dealloc];
 }
 
   return self->attendee;
 }
 
-/* backend */
-
-- (SOGoAppointment *)appointment {
-  NSString *iCalString;
-  
-  if (self->appointment)
-    return self->appointment;
-  
-  iCalString = [[self clientObject] valueForKey:@"iCalString"];
-  if (![iCalString isNotNull] || [iCalString length] == 0) {
-    [self debugWithFormat:@"ERROR(%s): missing iCal string!", 
-         __PRETTY_FUNCTION__];
-    return nil;
-  }
-  
-  self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
-  return self->appointment;
+- (SOGoDateFormatter *)dateFormatter {
+    if(self->dateFormatter == nil) {
+        self->dateFormatter = \
+        [[SOGoDateFormatter alloc] initWithLocale:[self locale]];
+        [self->dateFormatter setFullWeekdayNameAndDetails];
+    }
+    return self->dateFormatter;
 }
 
-- (NSString *)formattedAptStartTime {
+- (NSCalendarDate *)startTime {
   NSCalendarDate *date;
     
   date = [[self appointment] startDate];
   [date setTimeZone:[self viewTimeZone]];
-  return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+  return date;
 }
 
-- (NSString *)formattedAptEndTime {
+- (NSCalendarDate *)endTime {
   NSCalendarDate *date;
   
   date = [[self appointment] endDate];
   [date setTimeZone:[self viewTimeZone]];
-  return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+  return date;
+}
+
+- (NSString *)resourcesAsString {
+    NSArray *resources, *cns;
+
+    resources = [[self appointment] resources];
+    cns = [resources valueForKey:@"cnForDisplay"];
+    return [cns componentsJoinedByString:@"<br />"];
+}
+
+
+/* backend */
+
+- (SOGoAppointment *)appointment {
+    NSString *iCalString;
+    
+    if (self->appointment)
+        return self->appointment;
+    
+    iCalString = [[self clientObject] valueForKey:@"iCalString"];
+    if (![iCalString isNotNull] || [iCalString length] == 0) {
+        [self debugWithFormat:@"ERROR(%s): missing iCal string!", 
+            __PRETTY_FUNCTION__];
+        return nil;
+    }
+    
+    self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
+    return self->appointment;
 }