/* Copyright (C) 2000-2003 SKYRIX Software AG This file is part of OGo OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. OGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with OGo; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id$ #include /* attributes: condition value1 value2 usage: content of if content of elseif content of else .. */ @interface ODR_bind_if : ODNodeRenderer @end @interface ODR_bind_ifnot : ODR_bind_if @end #include #include "common.h" @implementation ODR_bind_if - (BOOL)doShow:(id)_node ctx:(WOContext *)_ctx { BOOL doShow; doShow = YES; if ([self hasAttribute:@"condition" node:_node ctx:_ctx]) { BOOL flag; flag = [self boolFor:@"condition" node:_node ctx:_ctx]; if (!flag) doShow = NO; } if ([self hasAttribute:@"value1" node:_node ctx:_ctx]) { if ([self hasAttribute:@"value2" node:_node ctx:_ctx]) { id value1, value2; BOOL flag; value1 = [self valueFor:@"value1" node:_node ctx:_ctx]; value2 = [self valueFor:@"value2" node:_node ctx:_ctx]; if (value1 == nil && value2 == nil) flag = YES; else flag = [value1 isEqual:value2]; if (!flag) doShow = NO; } } return doShow; } - (NSArray *)_contentOfIfNode:(id)_node { NSArray *children; NSMutableArray *result; int i, cnt; children = (NSArray *)[_node childNodes]; //children = ODRLookupQueryPath(_node, @"-*"); cnt = [children count]; result = [NSMutableArray arrayWithCapacity:cnt]; for (i=0; i