]> err.no Git - sope/blob - sope-appserver/NGObjWeb/DynamicElements/WOHiddenField.m
added svn:keywords and svn:ignore where appropriate. removed CVS artifacts.
[sope] / sope-appserver / NGObjWeb / DynamicElements / WOHiddenField.m
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
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 "WOInput.h"
24 #include "common.h"
25
26 @interface WOHiddenField : WOInput
27 {
28   // WODynamicElement: extraAttributes
29   // WODynamicElement: otherTagString
30   // WOInput:    name
31   // WOInput:    value
32   // WOInput:    disabled
33 }
34
35 @end /* WOHiddenField */
36
37 @implementation WOHiddenField
38
39 // responder
40
41 - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
42   if (![[_ctx request] isFromClientComponent]) {
43     BOOL isDisabled;
44
45     isDisabled = [self->disabled boolValueInComponent:[_ctx component]];
46     
47     if (isDisabled) {
48       NSString *s;
49
50       s = [self->value stringValueInComponent:[_ctx component]];
51       [_response appendContentHTMLString:s];
52     }
53     else {
54       NSString *v;
55
56       v = [self->value stringValueInComponent:[_ctx component]];
57       
58       WOResponse_AddCString(_response, "<input type=\"hidden\" name=\"");
59       [_response appendContentHTMLAttributeValue:OWFormElementName(self, _ctx)];
60       WOResponse_AddCString(_response, "\" value=\"");
61       [_response appendContentHTMLAttributeValue:v];
62       WOResponse_AddChar(_response, '"');
63       [self appendExtraAttributesToResponse:_response inContext:_ctx];
64       if (self->otherTagString) {
65         WOResponse_AddString(_response,
66                              [self->otherTagString stringValueInComponent:
67                                   [_ctx component]]);
68       }
69       WOResponse_AddCString(_response, " />");
70     }
71   }
72 }
73
74 @end /* WOHiddenField */