/*
* edit current category's ownergroup
*/
else if (event.getCommand().equals(ACTION_EDIT_CTLGCATOWNER)) {
// add ownership management
SecurityGroup secGroup = currentCatalogEntry.getOwnerGroup();
if (secGroup == null) {
CatalogEntry reloaded = cm.loadCatalogEntry(currentCatalogEntry);
currentCatalogEntry = reloaded;// FIXME:pb:?
secGroup = ManagerFactory.getManager().createAndPersistSecurityGroup();
currentCatalogEntry.setOwnerGroup(secGroup);
cm.saveCatalogEntry(currentCatalogEntry);
}
boolean keepAtLeastOne = currentCatalogEntryLevel == 0;
removeAsListenerAndDispose(groupController);
groupController = new GroupController(ureq, getWindowControl(), true, keepAtLeastOne, false, secGroup);
listenTo(groupController);
// open form in dialog
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), "close", groupController.getInitialComponent(), true, translate("tools.edit.catalog.category.ownergroup"));
listenTo(cmc);
cmc.activate();
}
/*
* delete category (subtree)
*/
else if (event.getCommand().equals(ACTION_DELETE_CTLGCATEGORY)) {
catModificationLock = CoordinatorManager.getCoordinator().getLocker().acquireLock(OresHelper.createOLATResourceableType(CatalogController.class), ureq.getIdentity(), LOCK_TOKEN);
if ( ! catModificationLock.isSuccess()) {
showError("catalog.locked.by", catModificationLock.getOwner().getName());
return;
}
String[] trnslP = { currentCatalogEntry.getName() };
dialogDeleteSubtree = activateYesNoDialog(ureq, null, getTranslator().translate(NLS_DIALOG_MODAL_SUBTREE_DELETE_TEXT, trnslP), dialogDeleteSubtree);
return;
}
/*
* contact caretaker, request subcategory, request deletion of an entry,
* etc.
*/
else if (event.getCommand().equals(ACTION_NEW_CTGREQUEST)) {
/*
* find the first caretaker, looking from the leaf towards the root,
* following the selected branch.
*/
Manager mngr = ManagerFactory.getManager();
ContactList caretaker = new ContactList(translate(NLS_CONTACT_TO_GROUPNAME_CARETAKER));
final List emptyList = new ArrayList();
List tmpIdent = new ArrayList();
for (int i = historyStack.size() - 1; i >= 0 && tmpIdent.isEmpty(); i--) {
// start at the selected category, the root category is asserted to
// have the OLATAdministrator
// so we end up having always at least one identity as receiver for a
// request ;-)
CatalogEntry tmp = historyStack.get(i);
SecurityGroup tmpOwn = tmp.getOwnerGroup();
if (tmpOwn != null) tmpIdent = mngr.getIdentitiesOfSecurityGroup(tmpOwn);
else tmpIdent = emptyList;
}
for (int i = tmpIdent.size() - 1; i >= 0; i--) {
caretaker.add((Identity) tmpIdent.get(i));