]> err.no Git - scalable-opengroupware.org/blob - UI/MailPartViewers/UIxMailPartICalAction.m
do not use Anais
[scalable-opengroupware.org] / UI / MailPartViewers / UIxMailPartICalAction.m
1 /*
2   Copyright (C) 2005 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #include <NGObjWeb/WODirectAction.h>
23
24 @interface UIxMailPartICalAction : WODirectAction
25 @end
26
27 #include "common.h"
28
29 @implementation UIxMailPartICalAction
30
31 - (id)redirectToViewerWithError:(NSString *)_error {
32   WOResponse *r;
33   NSString *viewURL;
34   id mail;
35   
36   mail = [[self clientObject] valueForKey:@"mailObject"];
37   [self logWithFormat:@"MAIL: %@", mail];
38   
39   viewURL = [mail baseURLInContext:[self context]];
40   [self logWithFormat:@"  url: %@", viewURL];
41   
42   viewURL = [viewURL stringByAppendingString:
43                        [viewURL hasSuffix:@"/"] ? @"view" : @"/view"];
44
45   if ([_error isNotNull] && [_error length] > 0) {
46     viewURL = [viewURL stringByAppendingString:@"?error="];
47     viewURL = [viewURL stringByAppendingString:
48                          [_error stringByEscapingURL]];
49   }
50   
51   r = [[self context] response];
52   [r setStatus:302 /* moved */];
53   [r setHeader:viewURL forKey:@"location"];
54   return r;
55 }
56
57 - (id)changePartStatusAction:(NSString *)_newStatus {
58   [self logWithFormat:@"TODO: should %@: %@", _newStatus, [self clientObject]];
59   return [self redirectToViewerWithError:
60                  [_newStatus stringByAppendingString:@" not implemented!"]];
61 }
62
63 - (id)markAcceptedAction {
64   return [self changePartStatusAction:@"ACCEPTED"];
65 }
66 - (id)markDeclinedAction {
67   return [self changePartStatusAction:@"DECLINED"];
68 }
69 - (id)markTentativeAction {
70   return [self changePartStatusAction:@"TENTATIVE"];
71 }
72
73 @end /* UIxMailPartICalAction */