Monotone-Parent: 27ade59da309caaf33ffd176d44a95672955e9c4

Monotone-Revision: d3b9346b7ff729aa3e123d710cf798285311dc5c

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2008-02-04T22:22:14
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2008-02-04 22:22:14 +00:00
parent b0f02b25da
commit 200225403a
13 changed files with 261 additions and 49 deletions
+7
View File
@@ -26,6 +26,13 @@
#import <SOGoUI/UIxComponent.h>
@interface UIxContactFoldersView : UIxComponent
{
NSUserDefaults *ud;
NSMutableDictionary *moduleSettings;
}
- (WOResponse *) getDragHandlesStateAction;
- (WOResponse *) saveDragHandleStateAction;
@end
+62
View File
@@ -21,6 +21,7 @@
*/
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/SoObject.h>
@@ -46,6 +47,27 @@
@implementation UIxContactFoldersView
- (void) _setupContext
{
SOGoUser *activeUser;
NSString *module;
SOGoContactFolders *clientObject;
activeUser = [context activeUser];
clientObject = [self clientObject];
module = [clientObject nameInContainer];
ud = [activeUser userSettings];
moduleSettings = [ud objectForKey: module];
if (!moduleSettings)
{
moduleSettings = [NSMutableDictionary new];
[moduleSettings autorelease];
}
[ud setObject: moduleSettings forKey: module];
}
- (id) _selectActionForApplication: (NSString *) actionName
{
SOGoContactFolders *folders;
@@ -247,4 +269,44 @@
// ? contactFolder : nil);
// }
- (WOResponse *) getDragHandlesStateAction
{
NSArray *dragHandles;
NSString *vertical, *horizontal;
[self _setupContext];
vertical = [moduleSettings objectForKey: @"DragHandleVertical"];
horizontal = [moduleSettings objectForKey: @"DragHandleHorizontal"];
dragHandles = [[NSArray alloc] initWithObjects:
vertical ? vertical : @"",
horizontal ? horizontal : @"",
nil];
return [self responseWithStatus: 200
andString: [dragHandles jsonRepresentation]];
}
- (WOResponse *) saveDragHandleStateAction
{
WORequest *request;
NSString *dragHandle;
[self _setupContext];
request = [context request];
if ((dragHandle = [request formValueForKey: @"vertical"]) != nil)
[moduleSettings setObject: dragHandle
forKey: @"DragHandleVertical"];
else if ((dragHandle = [request formValueForKey: @"horizontal"]) != nil)
[moduleSettings setObject: dragHandle
forKey: @"DragHandleHorizontal"];
else
return [self responseWithStatus: 400];
[ud synchronize];
return [self responseWithStatus: 204];
}
@end
+10
View File
@@ -50,6 +50,16 @@
protectedBy = "View";
pageName = "UIxContactsUserFolders";
};
dragHandlesState = {
protectedBy = "<public>";
pageName = "UIxContactFoldersView";
actionName = "getDragHandlesState";
};
saveDragHandleState = {
protectedBy = "View";
pageName = "UIxContactFoldersView";
actionName = "saveDragHandleState";
};
};
};