groups dialog for documents

This commit is contained in:
j 2020-05-23 16:17:35 +02:00
parent ed977686d1
commit 80390a1f9b

View file

@ -23,6 +23,7 @@ pandora.ui.groupsDialog = function(options) {
canManageGroups = pandora.hasCapability('canManageUsers'), canManageGroups = pandora.hasCapability('canManageUsers'),
isItem = options.type == 'item', isItem = options.type == 'item',
isDocument = options.type == 'document',
$content, $content,
$label, $label,
@ -40,7 +41,11 @@ pandora.ui.groupsDialog = function(options) {
selectedGroups = options.groups; selectedGroups = options.groups;
renderGroups(); renderGroups();
} else { } else {
pandora.api[isItem ? 'get' : 'getUser']({ pandora.api[
isItem ? 'get'
: isDocument ? 'getDocument'
: 'getUser'
]({
id: options.id, id: options.id,
keys: ['groups'] keys: ['groups']
}, function(result) { }, function(result) {
@ -70,8 +75,16 @@ pandora.ui.groupsDialog = function(options) {
return group.name; return group.name;
}); });
// disableElements(); // disableElements();
Ox.Request.clearCache(isItem ? 'get' : 'getUser'); Ox.Request.clearCache(
pandora.api[isItem ? 'edit' : 'editUser']({ isItem ? 'get'
: isDocument ? 'getDocument'
: 'getUser'
);
pandora.api[
isItem ? 'edit'
: isDocument ? 'editDocument'
: 'editUser'
]({
id: options.id, id: options.id,
groups: selectedGroups groups: selectedGroups
}, function(result) { }, function(result) {
@ -198,7 +211,9 @@ pandora.ui.groupsDialog = function(options) {
$label = Ox.Label({ $label = Ox.Label({
textAlign: 'center', textAlign: 'center',
title: Ox._( title: Ox._(
isItem ? pandora.site.itemName.singular : 'User' isItem ? pandora.site.itemName.singular
: isDocument ? 'Document'
: 'User'
) + ': ' + options.name, ) + ': ' + options.name,
width: 552 width: 552
}) })