~ubuntu-branches/ubuntu/edgy/sope/edgy

« back to all changes in this revision

Viewing changes to sope-appserver/samples/iCalPortal/DirectAction.m

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Ley
  • Date: 2005-08-19 16:53:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050819165331-hs683wz1osm708pw
Tags: upstream-4.4rc.2
ImportĀ upstreamĀ versionĀ 4.4rc.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2000-2005 SKYRIX Software AG
 
3
 
 
4
  This file is part of SOPE.
 
5
 
 
6
  SOPE 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
  SOPE 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 SOPE; 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 DirectAction : WODirectAction
 
25
@end
 
26
 
 
27
#include "iCalPortalUser.h"
 
28
#include "iCalPortalDatabase.h"
 
29
#include "iCalPortalPage.h"
 
30
#include "common.h"
 
31
 
 
32
@implementation WODirectAction(Ext)
 
33
 
 
34
- (id<WOActionResults>)indexPage {
 
35
  NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
 
36
  WOSession *sn;
 
37
  
 
38
  if ((sn = [self existingSession])) {
 
39
    [sn removeObjectForKey:@"user"];
 
40
    [sn terminate];
 
41
  }
 
42
  
 
43
  if ([ud boolForKey:@"DevMode"])
 
44
    return [[self pageWithName:@"iCalPortalWelcomePage"] performPage];
 
45
  
 
46
  {
 
47
    WOResponse *r;
 
48
    NSString *loc;
 
49
    
 
50
    r = [WOResponse responseWithRequest:[self request]];
 
51
    
 
52
    loc = @"/en/index.xhtml"; // TODO: make configurable!
 
53
    [self debugWithFormat:@"Deployment mode: redirecting to: %@", loc];
 
54
    [r setStatus:302];
 
55
    [r setHeader:loc forKey:@"location"];
 
56
    
 
57
    return r;
 
58
  }
 
59
}
 
60
 
 
61
- (id)logoutAction {
 
62
  return [self indexPage];
 
63
}
 
64
 
 
65
- (id)defaultAction {
 
66
  return [self indexPage];
 
67
}
 
68
 
 
69
@end /* WODirectAction(Ext) */
 
70
 
 
71
@implementation DirectAction
 
72
 
 
73
- (id)showLicenseAction {
 
74
  return [[self pageWithName:@"iCalPortalLicensePage"] performPage];
 
75
}
 
76
 
 
77
- (id)feedbackAction {
 
78
  return [[self pageWithName:@"iCalPortalFeedbackPage"] performPage];
 
79
}
 
80
 
 
81
- (id)editProfileAction {
 
82
  return [[self pageWithName:@"iCalPortalProfilePage"] performPage];
 
83
}
 
84
 
 
85
- (id)homeAction {
 
86
  return [[self pageWithName:@"iCalPortalHomePage"] performPage];
 
87
}
 
88
 
 
89
/* calendars */
 
90
 
 
91
- (id)weekOverviewAction {
 
92
  return [[self pageWithName:@"iCalPortalWeekOverview"] performPage];
 
93
}
 
94
- (id)dayOverviewAction {
 
95
  return [[self pageWithName:@"iCalPortalDayOverview"] performPage];
 
96
}
 
97
- (id)monthViewAction {
 
98
  return [[self pageWithName:@"iCalPortalMonthView"] performPage];
 
99
}
 
100
- (id)todoViewAction {
 
101
  return [[self pageWithName:@"iCalPortalToDoView"] performPage];
 
102
}
 
103
 
 
104
- (id)showCalendarAction {
 
105
  return [self weekOverviewAction];
 
106
}
 
107
 
 
108
@end /* DirectAction */