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