]> err.no Git - scalable-opengroupware.org/blob - UI/Contacts/UIxContactsFilterPanel.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1305 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / Contacts / UIxContactsFilterPanel.m
1 /*
2  Copyright (C) 2000-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 #import <SOGoUI/UIxComponent.h>
23
24 @interface UIxContactsFilterPanel : UIxComponent
25 {
26   NSString *searchText;
27   NSString *searchCriteria;
28 }
29
30 @end
31
32 @implementation UIxContactsFilterPanel
33
34 static NSArray      *filters           = nil;
35
36 + (void) initialize
37 {
38   NSMutableDictionary *md;
39   NSMutableArray *ma;
40   
41   md = [[NSMutableDictionary alloc] initWithCapacity:8];
42   ma = [[NSMutableArray alloc] initWithCapacity:4];
43
44   filters           = [ma copy];
45   [md release]; md = nil;
46   [ma release]; ma = nil;
47 }
48
49 - (id) init
50 {
51   if ((self = [super init]))
52     {
53       searchText = nil;
54       searchCriteria = nil;
55     }
56
57   return self;
58 }
59
60 - (void) dealloc
61 {
62   [searchCriteria release];
63   [searchText release];
64   [super dealloc];
65 }
66
67 /* accessors */
68
69 - (void) setSearchText: (NSString *)_txt
70 {
71   ASSIGNCOPY(searchText, _txt);
72 }
73
74 - (void) setSearchCriteria: (NSString *)_txt
75 {
76   ASSIGNCOPY(searchText, _txt);
77 }
78
79 - (NSString *) searchText
80 {
81   if (!searchText)
82     searchText = [[self queryParameterForKey: @"search"] copy];
83
84   return searchText;
85 }
86
87 - (NSString *) searchCriteria
88 {
89   if (!searchCriteria)
90     searchCriteria = [[self queryParameterForKey: @"criteria"] copy];
91
92   return searchCriteria;
93 }
94
95 /* filters */
96
97 - (NSArray *) filters
98 {
99   return filters;
100 }
101
102 /* qualifiers */
103
104 - (NSString *) filterLabel
105 {
106 #if 1
107   return [[[self context] page] labelForKey: @"filter"];
108 #else
109   return [self valueForKey: @"filter"];
110 #endif
111 }
112
113 - (NSString *) selectedFilter
114 {
115   return [self queryParameterForKey: @"filterpopup"];
116 }
117
118 @end /* UIxContactsFilterPanel */