]> err.no Git - sope/blob - sope-appserver/NGObjWeb/SoObjects/SoControlPanel.m
fixed OGo bug #888
[sope] / sope-appserver / NGObjWeb / SoObjects / SoControlPanel.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 "SoControlPanel.h"
24 #include "SoClassSecurityInfo.h"
25 #include "SoProductRegistry.h"
26 #include "SoObject.h"
27 #include <NGObjWeb/WOApplication.h>
28 #include <NGObjWeb/WOResponse.h>
29 #include "common.h"
30
31 @implementation SoControlPanel
32
33 + (int)version {
34   return 1;
35 }
36
37 - (id)handleQueryWithUnboundKey:(NSString *)_key {
38   return [self lookupName:_key 
39                inContext:[[WOApplication application] context]
40                acquire:YES];
41 }
42
43 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_ac {
44   if ([_key isEqualToString:@"Products"])
45     return [SoProductRegistry sharedProductRegistry];
46   
47   return [super lookupName:_key inContext:_ctx acquire:_ac];
48 }
49
50 - (NSArray *)toOneRelationshipKeys {
51   NSArray *a;
52   
53   if ((a = [super toOneRelationshipKeys])) {
54     return ([a containsObject:@"Products"])
55       ? a : [a arrayByAddingObject:@"Products"];
56   }
57   else
58     return [NSArray arrayWithObject:@"Products"];
59 }
60
61 - (NSArray *)manageMenuChildNames {
62   return nil;
63 }
64
65 /* if accessed directly ... */
66
67 - (void)appendToResponse:(WOResponse *)_response inContext:(id)_ctx {
68   // should invoke GETAction in the SMI ...
69   [_response appendContentString:@"<h3>SOPE Control Panel</h3>"];
70   [_response appendContentString:
71                @"<li><a href=\"Products/\">Products</a></li>"];
72 }
73
74 @end /* SoControlPanel */