Monotone-Parent: ff18846f2110faddb36e8f63098fe42762b93818
Monotone-Revision: b6904285a3ff5bf86b7f88d154e2996c86c0124e Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-02-09T21:18:28 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
4232f00c25
commit
3c69a1b0a4
|
@ -1,5 +1,11 @@
|
||||||
2007-02-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2007-02-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Contacts/SOGoContactFolders.m ([SOGoContactFolders
|
||||||
|
-appendPersonalSourcesInContext:context]): we now fetch all
|
||||||
|
folders with type "Contact" that belong to the current user.
|
||||||
|
([SOGoContactFolders -newFolderWithName:name]): new method to
|
||||||
|
create a new contact folder.
|
||||||
|
|
||||||
* UI/SOGoUI/UIxComponent.m ([UIxComponent -userFolderPath]): treat
|
* UI/SOGoUI/UIxComponent.m ([UIxComponent -userFolderPath]): treat
|
||||||
resulting url with [NSString+Utilities hostlessURL] instead of
|
resulting url with [NSString+Utilities hostlessURL] instead of
|
||||||
using NSURL. This is because the url in question sometimes has a
|
using NSURL. This is because the url in question sometimes has a
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||||
#import <NGObjWeb/SoUser.h>
|
#import <NGObjWeb/SoUser.h>
|
||||||
|
|
||||||
|
#import <GDLContentStore/GCSFolderManager.h>
|
||||||
|
#import <GDLContentStore/GCSChannelManager.h>
|
||||||
|
#import <GDLAccess/EOAdaptorChannel.h>
|
||||||
|
#import <GDLContentStore/NSURL+GCS.h>
|
||||||
|
|
||||||
#import <SoObjects/SOGo/SOGoPermissions.h>
|
#import <SoObjects/SOGo/SOGoPermissions.h>
|
||||||
|
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
@ -69,13 +74,69 @@
|
||||||
- (void) appendPersonalSourcesInContext: (WOContext *) context;
|
- (void) appendPersonalSourcesInContext: (WOContext *) context;
|
||||||
{
|
{
|
||||||
SOGoContactGCSFolder *ab;
|
SOGoContactGCSFolder *ab;
|
||||||
|
GCSChannelManager *cm;
|
||||||
|
EOAdaptorChannel *fc;
|
||||||
|
NSURL *folderLocation;
|
||||||
|
NSString *sql;
|
||||||
|
NSArray *attrs;
|
||||||
|
NSDictionary *row;
|
||||||
|
|
||||||
ab = [SOGoContactGCSFolder contactFolderWithName: @"personal"
|
cm = [GCSChannelManager defaultChannelManager];
|
||||||
andDisplayName: @"Personal Addressbook"
|
folderLocation
|
||||||
inContainer: self];
|
= [[GCSFolderManager defaultFolderManager] folderInfoLocation];
|
||||||
[ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
fc = [cm acquireOpenChannelForURL: folderLocation];
|
||||||
OCSPath, @"personal"]];
|
if (fc)
|
||||||
[contactFolders setObject: ab forKey: @"personal"];
|
{
|
||||||
|
sql
|
||||||
|
= [NSString stringWithFormat: @"SELECT c_path4, c_foldername FROM %@"
|
||||||
|
@" WHERE c_path2 = '%@' AND c_folder_type = 'Contact'",
|
||||||
|
[folderLocation gcsTableName],
|
||||||
|
[self ownerInContext: nil]];
|
||||||
|
[fc evaluateExpressionX: sql];
|
||||||
|
attrs = [fc describeResults: NO];
|
||||||
|
row = [fc fetchAttributes: attrs withZone: NULL];
|
||||||
|
while (row)
|
||||||
|
{
|
||||||
|
ab = [SOGoContactGCSFolder contactFolderWithName: [row objectForKey: @"c_path4"]
|
||||||
|
andDisplayName: [row objectForKey: @"c_foldername"]
|
||||||
|
inContainer: self];
|
||||||
|
[ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
||||||
|
OCSPath, [row objectForKey: @"c_path4"]]];
|
||||||
|
[contactFolders setObject: ab forKey: [row objectForKey: @"c_path4"]];
|
||||||
|
row = [fc fetchAttributes: attrs withZone: NULL];
|
||||||
|
}
|
||||||
|
|
||||||
|
// sql = [sql stringByAppendingFormat:@" WHERE %@ = '%@'",
|
||||||
|
// uidColumnName, [self uid]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) newFolderWithName: (NSString *) name
|
||||||
|
{
|
||||||
|
SOGoContactGCSFolder *newFolder;
|
||||||
|
WOResponse *response;
|
||||||
|
|
||||||
|
newFolder = [SOGoContactGCSFolder contactFolderWithName: name
|
||||||
|
andDisplayName: name
|
||||||
|
inContainer: [self clientObject]];
|
||||||
|
if ([newFolder isKindOfClass: [NSException class]])
|
||||||
|
response = (WOResponse *) newFolder;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[newFolder setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
||||||
|
OCSPath, name]];
|
||||||
|
if ([newFolder create])
|
||||||
|
{
|
||||||
|
response = [WOResponse new];
|
||||||
|
[response setStatus: 201];
|
||||||
|
[response autorelease];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
response = [NSException exceptionWithHTTPStatus: 400
|
||||||
|
reason: @"The new folder could not be created"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) appendSystemSourcesInContext: (WOContext *) context;
|
- (void) appendSystemSourcesInContext: (WOContext *) context;
|
||||||
|
|
Loading…
Reference in New Issue