]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@115 d1b88da0-ebda-0310-925b-ed51d...
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 30 Jun 2004 11:57:37 +0000 (11:57 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 30 Jun 2004 11:57:37 +0000 (11:57 +0000)
OGoContentStore/ChangeLog
OGoContentStore/GNUmakefile
SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m
SOGo/SoObjects/SOGo/SOGoContentObject.h
SOGo/SoObjects/SOGo/SOGoContentObject.m
SOGo/SoObjects/SOGo/SOGoFolder.h
SOGo/SoObjects/SOGo/SOGoFolder.m
SOGo/SoObjects/SOGo/SOGoUserFolder.m

index 96c1bc141978dc319e7af2c45d7fed1a89dd4f70..197bb36b6f0cbbfafe49798988ee2e6d764c1ef8 100644 (file)
@@ -1,5 +1,8 @@
 2004-06-30  Helge Hess  <helge.hess@opengroupware.org>
 
+       * GNUmakefile (libOGoContentStore_HEADER_FILES_INSTALL_DIR): install
+         headers in OGoContentStore
+
        * GNUmakefile.preamble (ocs_ls_TOOL_LIBS): added static dependencies
          for OSX
 
index 4f71ff72067e2d6fb0c15fd42f1233d223b8fe41..5e9c06518b710f0fd7cc9721ea7c8aa2ddb0c92f 100644 (file)
@@ -6,6 +6,9 @@ include ./Version
 LIBRARY_NAME = libOGoContentStore
 TOOL_NAME = ocs_ls ocs_mkdir ocs_cat
 
+libOGoContentStore_HEADER_FILES_DIR         = .
+libOGoContentStore_HEADER_FILES_INSTALL_DIR = /OGoContentStore
+
 libOGoContentStore_HEADER_FILES += \
        NSURL+OCS.h             \
        EOAdaptorChannel+OCS.h  \
index 9182664a6b762dd4f8fda8331ece5e2e74f6e5ed..83162aca28484331a0284b8c222f0ee0a5596c17 100644 (file)
 
 /* name lookup */
 
+- (BOOL)isValidAppointmentName:(NSString *)_key {
+  if ([_key length] == 0)
+    return NO;
+  
+  return YES;
+}
+
+- (id)appointmentWithName:(NSString *)_key inContext:(id)_ctx {
+  static Class aptClass = Nil;
+  id apt;
+  
+  if (aptClass == Nil)
+    aptClass = NSClassFromString(@"SOGoAppointmentObject");
+  if (aptClass == Nil) {
+    [self logWithFormat:@"ERROR: missing SOGoAppointmentObject class!"];
+    return nil;
+  }
+  
+  apt = [[aptClass alloc] initWithName:_key inContainer:self];
+  return [apt autorelease];
+}
+
 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
   id obj;
   
   /* first check attributes directly bound to the application */
   if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
     return obj;
-
-  [self logWithFormat:@"CHECK KEY: %@", _key];
+  
+  if ([self isValidAppointmentName:_key])
+    return [self appointmentWithName:_key inContext:_ctx];
   
   /* return 404 to stop acquisition */
   return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
index 2f8d7f2f7115bb1a70ba6cc8252aad72a587f6c6..d86fa82695809c217f072a5ec2451f3b064f6d50 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <SOGo/SOGoObject.h>
 
+@class NSString;
+
 @interface SOGoContentObject : SOGoObject
 {
   NSString *ocsPath;
 - (void)setOCSPath:(NSString *)_path;
 - (NSString *)ocsPath;
 
+- (NSString *)ocsPathOfContainer;
+
+- (OCSFolder *)ocsFolder;
+
 @end
 
 #endif /* __SOGo_SOGoContentObject_H__ */
index c29c43915f143a402373f180d752b8a02a91714d..c5ec77af8f13ec6e892d253d045838486dd3ec89 100644 (file)
   
   ASSIGNCOPY(self->ocsPath, _path);
 }
+
 - (NSString *)ocsPath {
+  if (self->ocsPath == nil) {
+    NSString *p;
+    
+    if ((p = [self ocsPathOfContainer]) != nil) {
+      if (![p hasSuffix:@"/"]) p = [p stringByAppendingString:@"/"];
+      p = [p stringByAppendingString:[self nameInContainer]];
+      self->ocsPath = [p copy];
+    }
+  }
   return self->ocsPath;
 }
 
+- (NSString *)ocsPathOfContainer {
+  if (![[self container] respondsToSelector:@selector(ocsPath)])
+    return nil;
+
+  return [[self container] ocsPath];
+}
+
+- (OCSFolder *)ocsFolder {
+  if (![[self container] respondsToSelector:@selector(ocsFolder)])
+    return nil;
+  
+  return [[self container] ocsFolder];
+}
+
 /* description */
 
 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
index c62459f22b561832c1dac42cb2426514d3812929..912fadd2ed8cc36fe8e6a4dab8b2abfc6621eea3 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <SOGo/SOGoObject.h>
 
+@class OCSFolder;
+
 @interface SOGoFolder : SOGoObject
 {
   NSString *ocsPath;
@@ -35,6 +37,8 @@
 - (void)setOCSPath:(NSString *)_Path;
 - (NSString *)ocsPath;
 
+- (OCSFolder *)ocsFolder;
+
 @end
 
 #endif /* __SOGo_SOGoFolder_H__ */
index a0ef5b14b829edac4d7dba462c752dae12dd91da..c40c45e84ddc6d47af12b58fd4aee0fe9e5c44c2 100644 (file)
 
 #include "SOGoFolder.h"
 #include "common.h"
+#include <OGoContentStore/OCSFolderManager.h>
+#include <OGoContentStore/OCSFolder.h>
 
 @implementation SOGoFolder
 
 - (void)dealloc {
-  [self->ocsPath release];
+  [self->ocsFolder release];
+  [self->ocsPath   release];
   [super dealloc];
 }
 
   return self->ocsPath;
 }
 
+- (OCSFolderManager *)folderManager {
+  return [OCSFolderManager defaultFolderManager];
+}
+- (OCSFolder *)ocsFolder {
+  if (self->ocsFolder != nil)
+    return [self->ocsFolder isNotNull] ? self->ocsFolder : nil;
+  
+  self->ocsFolder = 
+    [[[self folderManager] folderAtPath:[self ocsPath]] retain];
+  return self->ocsFolder;
+}
+
 /* description */
 
 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
index b8dd3478bbd00ca9230a9db60b3b35e5283c914d..f67aab943d5f301d961faa5dd132130155d16924 100644 (file)
@@ -68,7 +68,7 @@
   if (calClass == Nil)
     calClass = NSClassFromString(@"SOGoAppointmentFolder");
   if (calClass == Nil) {
-    [self logWithFormat:@"ERROR: missing SOGoAppointmentFolder!"];
+    [self logWithFormat:@"ERROR: missing SOGoAppointmentFolder class!"];
     return nil;
   }