2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
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
26 object // object to focus on
28 Special objects (strings):
36 <var:with js:object="FileManager().loadDocument('/blah.gif')">
37 Title: <var:string value="name"/>
40 <var:with const:object="#">
41 <var:string value="name"/>
45 #include <NGObjDOM/ODNodeRenderer.h>
47 @interface ODR_bind_with : ODNodeRenderer
50 #include "WOContext+Cursor.h"
54 @implementation ODR_bind_with
56 - (id)_objectFromNode:(id)_node inContext:(WOContext *)_ctx {
62 obj = [self valueFor:@"object" node:_node ctx:_ctx];
64 if ([obj isKindOfClass:[NSString class]]) {
65 if ([(NSString *)obj hasPrefix:@"#"]) {
66 if ([obj isEqualToString:@"#"])
67 obj = [_ctx component];
68 else if ([obj isEqualToString:@"#A"])
69 obj = [WOApplication application];
70 else if ([obj isEqualToString:@"#S"])
71 obj = [[_ctx component] session];
78 - (void)takeValuesForNode:(id)_node
79 fromRequest:(WORequest *)_req
80 inContext:(WOContext *)_ctx
82 if ([_node hasChildNodes]) {
83 [_ctx pushCursor:[self _objectFromNode:_node inContext:_ctx]];
85 [self takeValuesForChildNodes:[_node childNodes]
93 - (id)invokeActionForNode:(id)_domNode
94 fromRequest:(WORequest *)_request
95 inContext:(WOContext *)_ctx
97 if ([_domNode hasChildNodes]) {
100 [_ctx pushCursor:[self _objectFromNode:_domNode inContext:_ctx]];
102 result = [self invokeActionForChildNodes:[_domNode childNodes]
114 - (void)appendNode:(id)_domNode
115 toResponse:(WOResponse *)_response
116 inContext:(WOContext *)_ctx
118 if ([_domNode hasChildNodes]) {
121 obj = [self _objectFromNode:_domNode inContext:_ctx];
124 NSLog(@"WARNING(%s): missing cursor object ...", __PRETTY_FUNCTION__);
126 //NSLog(@"%s: using cursor %@", __PRETTY_FUNCTION__, obj);
129 [_ctx pushCursor:obj];
131 NSAssert([_ctx cursor] == obj, @"cursor push failed !!");
134 [self appendChildNodes:[_domNode childNodes]
142 @end /* ODR_bind_with */