]> err.no Git - scalable-opengroupware.org/blobdiff - UI/MainUI/SOGoUserHomePage.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1170 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / MainUI / SOGoUserHomePage.m
index f64869933f8b3b01a2a1f92d0364f693672d8c8d..910155833657e00b828dfd829a45025f7c4a8425 100644 (file)
 #import <Foundation/NSURL.h>
 #import <Foundation/NSUserDefaults.h>
 #import <Foundation/NSValue.h>
+#import <NGObjWeb/WOCookie.h>
 #import <NGObjWeb/WORequest.h>
 #import <NGObjWeb/WOResponse.h>
 #import <NGExtensions/NSCalendarDate+misc.h>
 #import <NGExtensions/NSObject+Logs.h>
 
 #import <Appointments/SOGoFreeBusyObject.h>
-#import <SOGo/SOGoUser.h>
-#import <SOGo/NSCalendarDate+SOGo.h>
+#import <SoObjects/SOGo/SOGoWebAuthenticator.h>
+#import <SoObjects/SOGo/SOGoUser.h>
+#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
 #import <SOGoUI/UIxComponent.h>
 
 static NSString *defaultModule = nil;
@@ -97,9 +99,9 @@ static NSString *defaultModule = nil;
   record = [records nextObject];
   while (record)
     {
-      status = [record objectForKey: @"status"];
+      status = [record objectForKey: @"c_status"];
  
-      value = [[record objectForKey: @"startdate"] intValue];
+      value = [[record objectForKey: @"c_startdate"] intValue];
       currentDate = [NSCalendarDate dateWithTimeIntervalSince1970: value];
       if ([currentDate earlierDate: startDate] == currentDate)
         startInterval = 0;
@@ -107,7 +109,7 @@ static NSString *defaultModule = nil;
         startInterval
           = ([currentDate timeIntervalSinceDate: startDate] / 900);
 
-      value = [[record objectForKey: @"enddate"] intValue];
+      value = [[record objectForKey: @"c_enddate"] intValue];
       currentDate = [NSCalendarDate dateWithTimeIntervalSince1970: value];
       if ([currentDate earlierDate: endDate] == endDate)
         endInterval = [items count] - 1;
@@ -198,4 +200,29 @@ static NSString *defaultModule = nil;
   return response;
 }
 
+- (id <WOActionResults>) logoffAction
+{
+  WOResponse *response;
+  WOCookie *cookie;
+  SOGoWebAuthenticator *auth;
+  id container;
+  NSCalendarDate *date;
+
+  container = [[self clientObject] container];
+
+  response = [context response];
+  [response setStatus: 302];
+  [response setHeader: [container baseURLInContext: context]
+           forKey: @"location"];
+  auth = [[self clientObject] authenticatorInContext: context];
+  cookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
+                    value: @"discard"];
+  [cookie setPath: @"/"];
+  date = [NSCalendarDate calendarDate];
+  [cookie setExpires: [date yesterday]];
+  [response addCookie: cookie];
+
+  return response;
+}
+
 @end