2 Copyright (C) 2004-2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
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.
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
22 #import <Foundation/NSCalendarDate.h>
23 #import <NGObjWeb/SoObject.h>
24 #import <SoObjects/Mailer/SOGoMailFolder.h>
25 #import <SoObjects/Mailer/SOGoMailObject.h>
26 #import <SOGoUI/UIxComponent.h>
31 This component shows a list of filter scripts and is (usually) attached to
32 a SOGoSieveScriptsFolder object.
35 @interface UIxFilterList : UIxComponent
43 @implementation UIxFilterList
46 [self->filter release];
47 [self->filters release];
54 [self->filter release]; self->filter = nil;
55 [self->filters release]; self->filters = nil;
61 - (void)setFilter:(id)_msg {
62 ASSIGN(self->filter, _msg);
68 - (NSArray *)filters {
72 - (NSString *)panelTitle {
73 return [self labelForKey:@"Mail Filters"];
78 - (NSString *)clickedFilterJS {
79 /* return 'false' aborts processing */
80 return [NSString stringWithFormat:
81 @"clickedFilter(this, '%@'); return false",
85 /* creating scripts */
87 - (NSString *)newScriptName {
90 now = [NSCalendarDate date];
91 return [NSString stringWithFormat:@"MyFilter-%04d%02d%02d-%02d%02d%02d",
92 [now yearOfCommonEra], [now monthOfYear],
94 [now hourOfDay], [now minuteOfHour], [now secondOfMinute]];
100 [self debugWithFormat:@"fetch scripts in: %@", [self clientObject]];
101 self->filters = [[[self clientObject] toOneRelationshipKeys] copy];
108 newURL = [[self clientObject] baseURLInContext:[self context]];
109 if (![newURL hasSuffix:@"/"]) newURL = [newURL stringByAppendingString:@"/"];
110 newURL = [newURL stringByAppendingString:[self newScriptName]];
111 newURL = [newURL stringByAppendingString:@"/edit"];
113 return [self redirectToLocation:newURL];
116 @end /* UIxFilterList */