mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-08 05:17:15 +00:00
(feat) now properties dialog for addressbooks
Now also possible to set the EAS sync flag for addressbooks
This commit is contained in:
1 parent
39601a9cf9
commit
12863f1d2f
8 files changed
+230
-7
No files matched your search
@@ -23,7 +23,8 @@ ContactsUI_OBJC_FILES = \
|
||||
UIxContactsListActions.m \
|
||||
UIxContactFoldersView.m \
|
||||
UIxContactFolderActions.m \
|
||||
UIxContactFolderLinksTemplate.m
|
||||
UIxContactFolderLinksTemplate.m \
|
||||
UIxContactFolderProperties.m
|
||||
|
||||
ContactsUI_RESOURCE_FILES += \
|
||||
product.plist \
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* UIxContactFolderProperties.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2015 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
@class SOGoContactGCSFolder;
|
||||
|
||||
@interface UIxContactFolderProperties : UIxComponent
|
||||
{
|
||||
SOGoContactGCSFolder *addressbook;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,84 @@
|
||||
/* UIxContactFolderProperties.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2015 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
|
||||
#import <Contacts/SOGoContactGCSFolder.h>
|
||||
|
||||
#import "UIxContactFolderProperties.h"
|
||||
|
||||
@implementation UIxContactFolderProperties
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
addressbook = [self clientObject];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /so/:username/Contacts/:addressbookId/save Save addressbook
|
||||
* @apiDescription Save an addressbook's properties.
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName PostSaveProperties
|
||||
* @apiGroup AddressBook
|
||||
*
|
||||
* @apiParam {String} name Human readable name
|
||||
* @apiParam {Number} synchronize 1 if we enable EAS synchronization for this addressbook
|
||||
*/
|
||||
- (WOResponse *) savePropertiesAction
|
||||
{
|
||||
WORequest *request;
|
||||
NSDictionary *params;
|
||||
id o, values;
|
||||
|
||||
request = [context request];
|
||||
params = [[request contentAsString] objectFromJSONString];
|
||||
|
||||
o = [params objectForKey: @"name"];
|
||||
if ([o isKindOfClass: [NSString class]])
|
||||
[addressbook renameTo: o];
|
||||
|
||||
o = [params objectForKey: @"synchronize"];
|
||||
if ([o isKindOfClass: [NSNumber class]])
|
||||
[addressbook setSynchronize: [o boolValue]];
|
||||
|
||||
return [self responseWith204];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -296,7 +296,7 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||
NSDictionary *folderAttrs;
|
||||
id currentFolder;
|
||||
|
||||
BOOL objectCreator, objectEditor, objectEraser;
|
||||
BOOL objectCreator, objectEditor, objectEraser, synchronize;
|
||||
int max, i;
|
||||
|
||||
userLogin = [[context activeUser] login];
|
||||
@@ -333,11 +333,20 @@ Class SOGoContactSourceFolderK, SOGoGCSFolderK;
|
||||
[NSNumber numberWithBool: objectEditor], @"objectEditor",
|
||||
[NSNumber numberWithBool: objectEraser], @"objectEraser", nil];
|
||||
|
||||
if ([currentFolder isKindOfClass: SOGoGCSFolderK])
|
||||
synchronize = [currentFolder synchronize];
|
||||
else
|
||||
synchronize = NO;
|
||||
|
||||
if ([[currentFolder nameInContainer] isEqualToString: @"personal"])
|
||||
synchronize = YES;
|
||||
|
||||
// NOTE: keep urls as the last key/value here, to avoid chopping the dictionary
|
||||
// if it is not a GCS folder
|
||||
folderAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSString stringWithFormat: @"%@", [currentFolder nameInContainer]], @"id",
|
||||
[currentFolder displayName], @"name",
|
||||
[NSNumber numberWithBool: synchronize], @"synchronize",
|
||||
owner, @"owner",
|
||||
[NSNumber numberWithBool: [currentFolder isKindOfClass: SOGoGCSFolderK]], @"isEditable",
|
||||
[NSNumber numberWithBool: [currentFolder isKindOfClass: SOGoContactSourceFolderK]
|
||||
|
||||
@@ -136,6 +136,15 @@
|
||||
protectedBy = "View";
|
||||
pageName = "UIxContactFolderLinksTemplate";
|
||||
};
|
||||
properties = {
|
||||
protectedBy = "Access Contents Information";
|
||||
pageName = "UIxContactFolderProperties";
|
||||
};
|
||||
save = {
|
||||
protectedBy = "Access Contents Information";
|
||||
pageName = "UIxContactFolderProperties";
|
||||
actionName = "saveProperties";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -157,11 +166,6 @@
|
||||
pageName = "UIxContactEditor";
|
||||
actionName = "new";
|
||||
};
|
||||
save = {
|
||||
protectedBy = "Change Permissions";
|
||||
actionClass = "UIxFolderActions";
|
||||
actionName = "renameFolder";
|
||||
};
|
||||
mailer-contacts = {
|
||||
protectedBy = "<public>";
|
||||
pageName = "UIxContactFoldersView";
|
||||
|
||||
Reference in new issue
Block a user