mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-12 07:17:12 +00:00
Monotone-Parent: 6303f532fa4bb3c36fe2f298f62f659c4fc71b18
Monotone-Revision: c111ae7ec8c39efb8d0cc56ff4627bb958ff0cc8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-04-18T20:03:07
This commit is contained in:
1 parent
bd982aa4c3
commit
c804d5ccfe
6 files changed
+359
-64
No files matched your search
@@ -20,12 +20,13 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
|
||||
#import <Appointments/SOGoAppointmentFolder.h>
|
||||
#import <Appointments/SOGoWebAppointmentFolder.h>
|
||||
#import <Appointments/SOGoAppointmentFolderICS.h>
|
||||
|
||||
#import "UIxCalFolderActions.h"
|
||||
@@ -95,4 +96,43 @@
|
||||
return response;
|
||||
}
|
||||
|
||||
/* These methods are only available on instance of SOGoWebAppointmentFolder. */
|
||||
- (WOResponse *) reloadAction
|
||||
{
|
||||
WOResponse *response;
|
||||
NSDictionary *results;
|
||||
|
||||
response = [self responseWithStatus: 200];
|
||||
[response setHeader: @"application/json" forKey: @"content-type"];
|
||||
results = [[self clientObject] loadWebCalendar];
|
||||
[response appendContentString: [results jsonRepresentation]];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WOResponse *) setCredentialsAction
|
||||
{
|
||||
WORequest *request;
|
||||
WOResponse *response;
|
||||
NSString *username, *password;
|
||||
|
||||
request = [context request];
|
||||
|
||||
username = [[request formValueForKey: @"username"] stringByTrimmingSpaces];
|
||||
password = [[request formValueForKey: @"password"] stringByTrimmingSpaces];
|
||||
if ([username length] > 0 && [password length] > 0)
|
||||
{
|
||||
[[self clientObject] setUsername: username
|
||||
andPassword: password];
|
||||
response = [self responseWith204];
|
||||
}
|
||||
else
|
||||
response
|
||||
= (WOResponse *) [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'username' and/or"
|
||||
@" 'password' parameters"];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@end /* UIxCalFolderActions */
|
||||
@@ -60,51 +60,41 @@
|
||||
WORequest *r;
|
||||
WOResponse *response;
|
||||
SOGoWebAppointmentFolder *folder;
|
||||
NSURL *url;
|
||||
NSString *urlString, *displayName;
|
||||
NSMutableDictionary *rc;
|
||||
SOGoAppointmentFolders *folders;
|
||||
int imported = 0;
|
||||
|
||||
r = [context request];
|
||||
rc = [NSMutableDictionary dictionary];
|
||||
|
||||
// Just a check
|
||||
urlString = [r formValueForKey: @"url"];
|
||||
url = [NSURL URLWithString: urlString];
|
||||
if (url)
|
||||
urlString = [[r formValueForKey: @"url"] stringByTrimmingSpaces];
|
||||
if ([urlString length] > 0)
|
||||
{
|
||||
folders = [self clientObject];
|
||||
displayName = [self displayNameForUrl: [r formValueForKey: @"url"]];
|
||||
displayName = [self displayNameForUrl: urlString];
|
||||
folder = [folders newWebCalendarWithName: displayName
|
||||
atURL: urlString];
|
||||
if (folder)
|
||||
{
|
||||
imported = [folder loadWebCalendar];
|
||||
if (imported >= 0)
|
||||
{
|
||||
[rc setObject: displayName forKey: @"displayname"];
|
||||
[rc setObject: [folder nameInContainer] forKey: @"name"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[folder delete];
|
||||
}
|
||||
[rc setObject: [NSNumber numberWithInt: imported]
|
||||
forKey: @"imported"];
|
||||
response = [self responseWithStatus: 200];
|
||||
[response setHeader: @"application/json" forKey: @"content-type"];
|
||||
|
||||
rc = [NSMutableDictionary dictionary];
|
||||
[rc setObject: [folder displayName] forKey: @"name"];
|
||||
[rc setObject: [folder folderReference] forKey: @"folderID"];
|
||||
[response appendContentString: [rc jsonRepresentation]];
|
||||
}
|
||||
else
|
||||
response = (WOResponse *)
|
||||
[NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"folder was not created"];
|
||||
}
|
||||
else
|
||||
response = (WOResponse *)
|
||||
[NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'url' parameter"];
|
||||
|
||||
response = [self responseWithStatus: 200];
|
||||
[response appendContentString: [rc jsonRepresentation]];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WOResponse *) reloadWebCalendarsAction
|
||||
{
|
||||
[[self clientObject] reloadWebCalendars: YES];
|
||||
|
||||
return [self responseWith204];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -45,11 +45,6 @@
|
||||
actionClass = "UIxCalMainActions";
|
||||
actionName = "addWebCalendar";
|
||||
};
|
||||
reloadWebCalendars = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxCalMainActions";
|
||||
actionName = "reloadWebCalendars";
|
||||
};
|
||||
saveDragHandleState = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxCalMainView";
|
||||
@@ -176,6 +171,21 @@
|
||||
};
|
||||
};
|
||||
|
||||
SOGoWebAppointmentFolder = {
|
||||
methods = {
|
||||
reload = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxCalFolderActions";
|
||||
actionName = "reload";
|
||||
};
|
||||
"set-credentials" = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxCalFolderActions";
|
||||
actionName = "setCredentials";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
SOGoAppointmentFolderICS = {
|
||||
methods = {
|
||||
export = {
|
||||
|
||||
Reference in new issue
Block a user