From 5c8aeec966b9ff23c6ab6326aef79944f92b749d Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 7 Oct 2004 21:50:51 +0000 Subject: [PATCH] improved WebDAV support for toManyRelationshipKeys git-svn-id: http://svn.opengroupware.org/SOPE/trunk@229 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- .../Associations/WOLabelAssociation.m | 1 - .../Associations/WOResourceURLAssociation.h | 17 +++++++++++--- sope-appserver/NGObjWeb/ChangeLog | 10 +++++++++ .../NGObjWeb/DynamicElements/WOText.m | 5 ++--- .../NGObjWeb/SoObjects/SoLookupAssociation.h | 16 +++++++++++--- .../NGObjWeb/SoObjects/SoLookupAssociation.m | 5 ++--- sope-appserver/NGObjWeb/Version | 2 +- .../NGObjWeb/WebDAV/SoObject+SoDAV.m | 9 ++++++-- .../NGObjWeb/WebDAV/SoObject+SoDAVQuery.m | 22 ++++++++++++++++--- .../NGObjWeb/WebDAV/SoObjectDataSource.m | 8 +++---- 10 files changed, 72 insertions(+), 23 deletions(-) diff --git a/sope-appserver/NGObjWeb/Associations/WOLabelAssociation.m b/sope-appserver/NGObjWeb/Associations/WOLabelAssociation.m index 9ff2b12d..7b0d282c 100644 --- a/sope-appserver/NGObjWeb/Associations/WOLabelAssociation.m +++ b/sope-appserver/NGObjWeb/Associations/WOLabelAssociation.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "WOLabelAssociation.h" #include diff --git a/sope-appserver/NGObjWeb/Associations/WOResourceURLAssociation.h b/sope-appserver/NGObjWeb/Associations/WOResourceURLAssociation.h index 2794ec0d..9c1a7502 100644 --- a/sope-appserver/NGObjWeb/Associations/WOResourceURLAssociation.h +++ b/sope-appserver/NGObjWeb/Associations/WOResourceURLAssociation.h @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. 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 @@ -18,13 +18,24 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __NGObjWeb_WOResourceURLAssociation_H__ #define __NGObjWeb_WOResourceURLAssociation_H__ #include +/* + WOResourceURLAssociation + + Lookup an association value as a resource URL. Eg for a binding: + + + "image.gif" will be looked up using WOResourceManager and the URL for the + image will be returned. + + Note: you cannot trigger that association in a .wo wrapper template. +*/ + @class NSString; @interface WOResourceURLAssociation : WOAssociation < NSCopying > diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index ceecba90..e4e2cd6f 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,13 @@ +2004-10-07 Helge Hess + + * v4.3.54 + + * WebDAV/SoObject+SoDAV.m: -isCollection now also checks whether + objects are contained in the toManyRelationshipKeys collection + + * WebDAV/SoObject+SoDAVQuery.m: -davChildKeys now returns the values of + both, -toOneRelationshipKeys and -toManyRelationshipKeys + 2004-10-07 Helge Hess * WebDAV/SoObjectWebDAVDispatcher.m: added more debug output (v4.3.53) diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOText.m b/sope-appserver/NGObjWeb/DynamicElements/WOText.m index ba34595e..d90342b8 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOText.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOText.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. 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 @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "WOInput.h" #include "common.h" diff --git a/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.h b/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.h index 21cfc3a6..f6ca2db1 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.h +++ b/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.h @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. 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 @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __SoObjects_SoLookupAssociation_H__ #define __SoObjects_SoLookupAssociation_H__ @@ -29,6 +28,17 @@ SoLookupAssociation This association is experimental, behaviour isn't fixed yet. + TODO: this should probably traverse relative to the clientObject, not to + the component?! + Or we might want to support keypath _and_ lookup path, like: + "component.context.clientObject:+/abc/toolbar/" + + Currently it traverses the path being passed in relative to the component: + [_component traversePathArray:self->traversalPath + acquire:self->acquire]; + + If you prefix the path with a "+" acquisition will be turned on, eg: + Namespace: http://www.skyrix.com/od/so-lookup */ diff --git a/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.m b/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.m index dd021982..ffeb52bc 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoLookupAssociation.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. 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 @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "SoLookupAssociation.h" #include "SoObject.h" diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 531230f6..f96f5d30 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=53 +SUBMINOR_VERSION:=54 # v4.3.42 requires libNGExtensions v4.3.116 # v4.3.40 requires libNGExtensions v4.3.115 diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.m b/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.m index 751c96bb..2219fe65 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.m @@ -62,15 +62,20 @@ - (BOOL)davIsCollection { id v; + if ([self respondsToSelector:@selector(isCollection)]) return [self isCollection]; - if ((v = [self valueForKey:@"NSFileType"])) { + if ([(v = [self valueForKey:@"NSFileType"]) isNotNull]) { if ([v isEqualToString:NSFileTypeDirectory]) return YES; else return NO; } - return [[self toOneRelationshipKeys] count] > 0 ? YES : NO; + if ([[self toManyRelationshipKeys] count] > 0) + return YES; + if ([[self toOneRelationshipKeys] count] > 0) + return YES; + return NO; } - (BOOL)davIsFolder { diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAVQuery.m b/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAVQuery.m index 706a4114..87275dc7 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAVQuery.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAVQuery.m @@ -40,11 +40,27 @@ static int debugBulk = NO; // TODO: set to -1 and use defaults Could return toOneRelationshipKeys+toManyRelationshipKeys ? */ NSClassDescription *cd; + NSArray *t1, *tn; - if ((cd = [self soClassDescription])) - return [[cd toOneRelationshipKeys] objectEnumerator]; + /* + Note: this is done explicitly because the WebDAV class description + can be different to the 'EOF' class description. + */ + if ((cd = [self soClassDescription]) != nil) { + t1 = [cd toOneRelationshipKeys]; + tn = [cd toManyRelationshipKeys]; + } + else { + t1 = [self toOneRelationshipKeys]; + tn = [self toManyRelationshipKeys]; + } + + if ([tn count] == 0) + return [t1 objectEnumerator]; + if ([t1 count] == 0) + return [tn objectEnumerator]; - return [[self toOneRelationshipKeys] objectEnumerator]; + return [[t1 arrayByAddingObjectsFromArray:tn] objectEnumerator]; } - (EODataSource *)contentDataSourceInContext:(id)_ctx { diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m b/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m index abe6a501..6469f89c 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2002-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. 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 @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "SoObjectDataSource.h" #include "SoObjectResultEntry.h" @@ -35,7 +34,7 @@ static BOOL debugOn = NO; + (void)initialize { debugOn = [[NSUserDefaults standardUserDefaults] - boolForKey:@"SoObjectDataSourceDebugEnabled"]; + boolForKey:@"SoObjectDataSourceDebugEnabled"]; } - (id)initWithObject:(id)_object inContext:(id)_ctx { @@ -59,6 +58,7 @@ static BOOL debugOn = NO; - (void)setFetchSpecification:(EOFetchSpecification *)_fetchSpec { if ([_fetchSpec isEqual:self->fspec]) return; + ASSIGN(self->fspec, _fetchSpec); [self postDataSourceChangedNotification]; } -- 2.39.5