(feat) now properties dialog for addressbooks
Now also possible to set the EAS sync flag for addressbookspull/101/head^2
parent
39601a9cf9
commit
12863f1d2f
|
@ -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";
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" standalone="yes"?>
|
||||
<!DOCTYPE container>
|
||||
<container
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:label="OGo:label"
|
||||
>
|
||||
<md-dialog flex-sm="100">
|
||||
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools">
|
||||
<!-- name -->
|
||||
<md-input-container>
|
||||
<label><var:string label:value="Name"/></label>
|
||||
<input type="text"
|
||||
class="md-title"
|
||||
ng-model="properties.addressbook.name"/>
|
||||
</md-input-container>
|
||||
<md-button class="md-icon-button" ng-click="properties.close()">
|
||||
<md-icon aria-label="Close dialog">close</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
|
||||
<md-dialog-content class="md-dialog-content" layout="column">
|
||||
<md-checkbox
|
||||
ng-model="properties.addressbook.synchronize"
|
||||
ng-disabled="properties.addressbook.id == 'personal'"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="Synchronize"/>
|
||||
</md-checkbox>
|
||||
</md-dialog-content>
|
||||
|
||||
<div class="md-actions">
|
||||
<md-button type="button" ng-click="properties.close()"><var:string label:value="Cancel"/></md-button>
|
||||
<md-button ng-click="properties.saveProperties()"><var:string label:value="Save"/></md-button>
|
||||
</div>
|
||||
|
||||
</md-dialog>
|
||||
</container>
|
|
@ -94,6 +94,12 @@
|
|||
<var:string label:value="Sharing..."/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-divider><!-- divider --></md-menu-divider>
|
||||
<md-menu-item>
|
||||
<md-button type="button" ng-click="app.showProperties(folder)">
|
||||
<var:string label:value="Properties"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</md-list-item>
|
||||
|
@ -148,6 +154,12 @@
|
|||
<var:string label:value="Delete"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-divider><!-- divider --></md-menu-divider>
|
||||
<md-menu-item>
|
||||
<md-button type="button" ng-click="app.showProperties(folder)">
|
||||
<var:string label:value="Properties"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</md-list-item>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
vm.importCards = importCards;
|
||||
vm.exportCards = exportCards;
|
||||
vm.showLinks = showLinks;
|
||||
vm.showProperties = showProperties;
|
||||
vm.share = share;
|
||||
vm.subscribeToFolder = subscribeToFolder;
|
||||
|
||||
|
@ -222,6 +223,44 @@
|
|||
}
|
||||
}
|
||||
|
||||
function showProperties(addressbook) {
|
||||
$mdDialog.show({
|
||||
templateUrl: addressbook.id + '/properties',
|
||||
controller: PropertiesDialogController,
|
||||
controllerAs: 'properties',
|
||||
clickOutsideToClose: true,
|
||||
escapeToClose: true,
|
||||
locals: {
|
||||
srcAddressBook: addressbook
|
||||
}
|
||||
}).catch(function() {
|
||||
// Do nothing
|
||||
});
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
PropertiesDialogController.$inject = ['$scope', '$mdDialog', 'srcAddressBook'];
|
||||
function PropertiesDialogController($scope, $mdDialog, srcAddressBook) {
|
||||
var vm = this;
|
||||
|
||||
vm.addressbook = new AddressBook(srcAddressBook.$omit());
|
||||
vm.saveProperties = saveProperties;
|
||||
vm.close = close;
|
||||
|
||||
function saveProperties() {
|
||||
vm.addressbook.$save();
|
||||
// Refresh list instance
|
||||
srcAddressBook.init(vm.addressbook.$omit());
|
||||
$mdDialog.hide();
|
||||
}
|
||||
|
||||
function close() {
|
||||
$mdDialog.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function share(addressbook) {
|
||||
// Fetch list of ACL users
|
||||
addressbook.$acl.$users().then(function() {
|
||||
|
|
Loading…
Reference in New Issue