]> err.no Git - sope/blob - sope-appserver/samples/iCalPortal/Pages/iCalPortalCalTabs.m
renamed packages as discussed in the developer list
[sope] / sope-appserver / samples / iCalPortal / Pages / iCalPortalCalTabs.m
1 /*
2   Copyright (C) 2000-2004 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 // $Id$
22
23 #include "iCalPortalPage.h"
24
25 @interface iCalPortalCalTabs : iCalPortalPage
26 {
27   NSString *selection;
28   NSString *calendarName;
29 }
30
31 @end
32
33 #include "common.h"
34
35 @implementation iCalPortalCalTabs
36
37 - (void)dealloc {
38   [self->selection    release];
39   [self->calendarName release];
40   [super dealloc];
41 }
42
43 /* accessors */
44
45 - (void)setSelection:(NSString *)_sel {
46   ASSIGN(self->selection, _sel);
47 }
48 - (NSString *)selection {
49   return self->selection;
50 }
51
52 - (void)setCalendarName:(NSString *)_sel {
53   ASSIGN(self->calendarName, _sel);
54 }
55 - (NSString *)calendarName {
56   return self->calendarName;
57 }
58
59 /* tab state */
60
61 - (BOOL)isDaySelected {
62   return [self->selection isEqualToString:@"day"] ? YES : NO;
63 }
64 - (BOOL)isWeekSelected {
65   return [self->selection isEqualToString:@"week"] ? YES : NO;
66 }
67 - (BOOL)isMonthSelected {
68   return [self->selection isEqualToString:@"month"] ? YES : NO;
69 }
70 - (BOOL)isToDoSelected {
71   return [self->selection isEqualToString:@"todo"] ? YES : NO;
72 }
73
74 - (NSString *)_url:(NSString *)_name {
75   return [NSString stringWithFormat:
76                      @"/iCalPortal.woa/WebServerResources/English.lproj/"
77                      @"tab_%@.gif", _name];
78 }
79
80 - (NSString *)dayTabURL {
81   return [self _url:[self isDaySelected] ? @"selected":@"left"];
82 }
83 - (NSString *)weekTabURL {
84   return [self _url:[self isWeekSelected] ? @"selected" : @""];
85 }
86 - (NSString *)monthTabURL {
87   return [self _url:[self isMonthSelected] ? @"selected" : @""];
88 }
89 - (NSString *)todoTabURL {
90   return [self _url:[self isToDoSelected] ? @"selected" : @""];
91 }
92
93 /* actions */
94
95 @end /* iCalPortalCalTabs */