From b4d6667f88db6a4f0261d14fb7f661400e3207b0 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 6 Aug 2014 16:03:30 -0400 Subject: [PATCH] Remove duplicated method --- UI/Common/UIxFolderActions.m | 13 +++++++++--- UI/Contacts/UIxContactFolderActions.m | 29 --------------------------- UI/Contacts/product.plist | 7 ++++--- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index 374be4be8..48c684ac0 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -34,6 +34,8 @@ #import #import +#import +#import #import #import #import @@ -193,9 +195,13 @@ - (WOResponse *) renameFolderAction { WOResponse *response; + WORequest *request; + NSDictionary *params, *message; NSString *folderName; - folderName = [[context request] formValueForKey: @"name"]; + request = [context request]; + params = [[request contentAsString] objectFromJSONString]; + folderName = [params objectForKey: @"name"]; if ([folderName length] > 0) { clientObject = [self clientObject]; @@ -204,8 +210,9 @@ } else { - response = [self responseWithStatus: 500]; - [response appendContentString: @"Missing 'name' parameter."]; + message = [NSDictionary dictionaryWithObject: @"Missing name parameter" forKey: @"error"]; + response = [self responseWithStatus: 500 + andString: [message jsonRepresentation]]; } return response; diff --git a/UI/Contacts/UIxContactFolderActions.m b/UI/Contacts/UIxContactFolderActions.m index 178db7579..e45b8d27d 100644 --- a/UI/Contacts/UIxContactFolderActions.m +++ b/UI/Contacts/UIxContactFolderActions.m @@ -292,33 +292,4 @@ return rc; } -- (id ) saveAction -{ - SOGoContactGCSFolder *folder; - WORequest *request; - WOResponse *response; - NSDictionary *params, *message; - NSString *folderName; - - request = [context request]; - NSLog(@"%@", [request contentAsString]); - params = [[request contentAsString] objectFromJSONString]; - - folderName = [params objectForKey: @"name"]; - if ([folderName length] > 0) - { - folder = [self clientObject]; - [folder renameTo: folderName]; - response = [self responseWith204]; - } - else - { - message = [NSDictionary dictionaryWithObject: @"Missing name parameter" forKey: @"error"]; - response = [self responseWithStatus: 500 - andString: [message jsonRepresentation]]; - } - - return response; -} - @end /* UIxContactFolderActions */ diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 32e48e3f9..8ddfa7061 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -116,8 +116,8 @@ }; save = { protectedBy = "Change Permissions"; - actionClass = "UIxContactFolderActions"; - actionName = "save"; + actionClass = "UIxFolderActions"; + actionName = "renameFolder"; }; userRights = { protectedBy = "ReadAcls"; @@ -153,7 +153,7 @@ pageName = "UIxContactEditor"; actionName = "new"; }; - renameFolder = { + save = { protectedBy = "Change Permissions"; actionClass = "UIxFolderActions"; actionName = "renameFolder"; @@ -267,6 +267,7 @@ view = { protectedBy = "Access Contents Information"; pageName = "UIxContactView"; + actionName = "data"; }; edit = { protectedBy = "Access Contents Information";