+2005-03-28 Helge Hess <helge.hess@opengroupware.org>
+
+ * WOComponentDefinition.m: moved WONoContentElement and
+ _WOStaticHTMLElement classes to own files in DynamicElements
+ (v4.5.144)
+
2005-03-25 Helge Hess <helge.hess@opengroupware.org>
* WebDAV/SoObjectDataSource.m: fixed a small memory leak (v4.5.143)
WOVBScript.m \
WOEntity.m \
WOSetCursor.m \
+ \
+ WONoContentElement.m \
+ _WOStaticHTMLElement.m \
DynamicElements_OBJC_FILES += \
_WOConstResourceImage.m \
--- /dev/null
+/*
+ Copyright (C) 2000-2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE 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.
+
+ SOPE 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 SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#ifndef __NGObjWeb_WONoContentElement_H__
+#define __NGObjWeb_WONoContentElement_H__
+
+#include <NGObjWeb/WOElement.h>
+
+/*
+ WONoContentElement
+
+ This is a private element used by the WOComponentDefinition.
+*/
+
+@class NSString, NSArray, NSDictionary;
+@class WOComponentDefinition;
+
+@interface WONoContentElement : WOElement
+{
+ WOComponentDefinition *cdef;
+ NSString *element;
+}
+
+- (id)initWithElementName:(NSString *)_elementName
+ attributes:(NSDictionary *)_attributes
+ contentElements:(NSArray *)_subElements
+ componentDefinition:(WOComponentDefinition *)_cdef;
+
+@end
+
+#endif /* __NGObjWeb_WONoContentElement_H__ */
--- /dev/null
+/*
+ Copyright (C) 2000-2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE 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.
+
+ SOPE 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 SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "WONoContentElement.h"
+#include <NGObjWeb/WOComponentDefinition.h>
+#include <NGObjWeb/WOResponse.h>
+#include "common.h"
+
+@implementation WONoContentElement
+
+- (id)initWithElementName:(NSString *)_elementName
+ attributes:(NSDictionary *)_attributes
+ contentElements:(NSArray *)_subElements
+ componentDefinition:(WOComponentDefinition *)_cdef
+{
+ self->cdef = [_cdef retain];
+ self->element = [_elementName copy];
+ return self;
+}
+
+- (void)dealloc {
+ [self->cdef release];
+ [self->element release];
+ [super dealloc];
+}
+
+- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
+ [_response appendContentHTMLString:@"<<missing element '"];
+ [_response appendContentHTMLString:self->element];
+ [_response appendContentHTMLString:@"' in component '"];
+ [_response appendContentHTMLString:[self->cdef componentName]];
+ [_response appendContentHTMLString:@"'>>"];
+}
+
+@end /* WONoContentElement */
--- /dev/null
+/*
+ Copyright (C) 2000-2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE 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.
+
+ SOPE 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 SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#ifndef __DynamicElements__WOStaticHTMLElement_H__
+#define __DynamicElements__WOStaticHTMLElement_H__
+
+#include <NGObjWeb/WOElement.h>
+
+/*
+ _WOStaticHTMLElement
+
+ This element is used by the WOHTMLParser.
+*/
+
+@class NSString;
+
+@interface _WOStaticHTMLElement : WOElement
+{
+ NSString *text;
+}
+
+// TODO: use Unicode?
+- (id)initWithBuffer:(const char *)_buffer length:(unsigned)_len;
+
+@end
+
+#endif /* __DynamicElements__WOStaticHTMLElement_H__ */
--- /dev/null
+/*
+ Copyright (C) 2000-2005 SKYRIX Software AG
+
+ This file is part of SOPE.
+
+ SOPE 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.
+
+ SOPE 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 SOPE; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "_WOStaticHTMLElement.h"
+#include <NGObjWeb/WOResponse.h>
+#include "common.h"
+
+@implementation _WOStaticHTMLElement
+
+static Class StrClass = Nil;
+
++ (void)initialize {
+ StrClass = [NSString class];
+}
+
+- (id)initWithBuffer:(const char *)_buffer length:(unsigned)_len {
+ self->text = (_len > 0)
+ ? [[StrClass alloc] initWithCString:_buffer length:_len]
+ : nil;
+ return self;
+}
+
+- (void)dealloc {
+ [self->text release];
+ [super dealloc];
+}
+
+/* generate response */
+
+- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
+ if (self->text != nil)
+ [_response appendContentString:self->text];
+}
+
+@end /* _WOStaticHTMLElement */
# version file
-SUBMINOR_VERSION:=143
+SUBMINOR_VERSION:=144
# v4.5.122 requires libNGExtensions v4.5.153
# v4.5.91 requires libNGExtensions v4.5.134
}
- (void)setCachingEnabled:(BOOL)_flag {
- self->componentFlags.reloadTemplates = _flag ? NO : YES;
+ self->componentFlags.reloadTemplates = _flag ? 0 : 1;
}
- (BOOL)isCachingEnabled {
- return (self->componentFlags.reloadTemplates == NO) ? YES : NO;
+ return (!self->componentFlags.reloadTemplates) ? YES : NO;
}
- (WOComponent *)pageWithName:(NSString *)_name {
- (WOElement *)_woComponentTemplate {
WOElement *element;
- if ((element = _getExtraVar(self, @"__wotemplate")))
+ // TODO: move to ivar?
+ if ((element = _getExtraVar(self, @"__wotemplate")) != nil)
return element;
return [self templateWithName:[self name]];
#include <NGObjWeb/WOComponentDefinition.h>
#include "WOComponent+private.h"
#include "WOComponentFault.h"
+#include "WONoContentElement.h"
#include <NGObjWeb/WOAssociation.h>
#include <NGObjWeb/WOApplication.h>
#include <NGObjWeb/WOElement.h>
- (void)setBaseURL:(id)_url;
@end
-@interface WONoContentElement : WOElement
-{
- WOComponentDefinition *cdef;
- NSString *element;
-}
-- (id)initWithElementName:(NSString *)_elementName
- attributes:(NSDictionary *)_attributes
- contentElements:(NSArray *)_subElements
- componentDefinition:(WOComponentDefinition *)_cdef;
-@end
-
-@interface _WOStaticHTMLElement : WOElement
-{
- NSString *text;
-}
-- (id)initWithBuffer:(const char *)_buffer length:(unsigned)_len;
-@end
-
@interface WOComponentDefinition(PrivateMethods)
- (BOOL)load;
[_component setBaseURL:self->baseUrl];
if (enableWOOFiles) {
- if (self->template) {
+ if (self->template != nil) {
[self _applyWOOVariables:
[self->template keyValueArchivedTemplateVariables]
onComponent:_component];
Class cClass;
WOComponentScript *script;
- if ((script = [self->template componentScript]))
- cClass = NSClassFromString(@"WOScriptedComponent");
- else
- cClass = [self componentClass];
+ cClass = ((script = [self->template componentScript]) != nil)
+ ? NSClassFromString(@"WOScriptedComponent")
+ : [self componentClass];
if (cClass == nil) {
NSString *tmpPath;
}
@end /* WOComponentDefinition */
-
-@implementation WONoContentElement
-
-- (id)initWithElementName:(NSString *)_elementName
- attributes:(NSDictionary *)_attributes
- contentElements:(NSArray *)_subElements
- componentDefinition:(WOComponentDefinition *)_cdef
-{
- self->cdef = [_cdef retain];
- self->element = [_elementName copy];
- return self;
-}
-
-- (void)dealloc {
- [self->cdef release];
- [self->element release];
- [super dealloc];
-}
-
-- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
- [_response appendContentHTMLString:@"<<missing element '"];
- [_response appendContentHTMLString:self->element];
- [_response appendContentHTMLString:@"' in component '"];
- [_response appendContentHTMLString:[self->cdef componentName]];
- [_response appendContentHTMLString:@"'>>"];
-}
-
-@end /* WONoContentElement */
-
-@implementation _WOStaticHTMLElement
-
-- (id)initWithBuffer:(const char *)_buffer length:(unsigned)_len {
- if (StrClass == Nil)
- StrClass = [NSString class];
-
- self->text = [[StrClass alloc] initWithCString:_buffer length:_len];
- return self;
-}
-
-- (void)dealloc {
- [self->text release];
- [super dealloc];
-}
-
-- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
- if (self->text)
- [_response appendContentString:self->text];
-}
-
-@end /* _WOStaticHTMLElement */