2004-10-08 Helge Hess <helge.hess@opengroupware.org>
+ * SOGoFolder.m: added facility to define default extensions (v0.9.24)
+
* SOGoObject.m: fixed not implemented return status (501, not 502)
(v0.9.23)
/* reflection */
+- (NSString *)defaultFilenameExtension {
+ /*
+ Override to add an extension to a filename
+
+ Note: be careful with that, needs to be consistent with object lookup!
+ */
+ return nil;
+}
+
- (NSArray *)toOneRelationshipKeys {
/* toOneRelationshipKeys are the 'files' contained in a folder */
- return [self fetchContentObjectNames];
+ NSMutableArray *ma;
+ NSArray *names;
+ NSString *ext;
+ unsigned i, count;
+
+ if ((names = [self fetchContentObjectNames]) == nil)
+ return names;
+
+ if ((count = [names count]) == 0)
+ return names;
+
+ if ((ext = [self defaultFilenameExtension]) == nil)
+ return names;
+
+ ma = [NSMutableArray arrayWithCapacity:count];
+ for (i = 0; i < count; i++) {
+ NSRange r;
+ NSString *name;
+
+ name = [names objectAtIndex:i];
+ r = [name rangeOfString:@"."];
+ if (r.length == 0)
+ name = [[name stringByAppendingString:@"."] stringByAppendingString:ext];
+
+ [ma addObject:name];
+ }
+ return ma;
}
/* WebDAV */