* add bookmark
*/
else if (event.getCommand().equals(ACTION_ADD_BOOKMARK)){
removeAsListenerAndDispose(bookmarkController);
CatalogManager cm = CatalogManager.getInstance();
OLATResourceable ores = cm.createOLATResouceableFor(currentCatalogEntry);
bookmarkController = new AddAndEditBookmarkController(ureq, getWindowControl(), currentCatalogEntry.getName(), "", ores, CatalogManager.CATALOGENTRY);
listenTo(bookmarkController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), "close", bookmarkController.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
/*
* move catalogentry
*/
else if(event.getCommand().equals(ACTION_MOVE_ENTRY)){
// Move catalog level - moving of resources in the catalog (leafs) is triggered by a velocity command
// so, reset stale link to the current resource first (OLAT-4253), the linkMarkedToBeEdited will be reset
// when an edit or move operation on the resource is done
linkMarkedToBeEdited = null;
//
catModificationLock = CoordinatorManager.getCoordinator().getLocker().acquireLock(OresHelper.createOLATResourceableType(CatalogController.class), ureq.getIdentity(), LOCK_TOKEN);
if ( ! catModificationLock.isSuccess()) {
showError("catalog.locked.by", catModificationLock.getOwner().getName());
return;
}
// check if user surfs in ajax mode
removeAsListenerAndDispose(catEntryMoveController);
boolean ajax = getWindowControl().getWindowBackOffice().getWindowManager().isAjaxEnabled();
if (ajax) {
// fancy ajax tree
catEntryMoveController= new CatalogAjaxMoveController(ureq, getWindowControl(), currentCatalogEntry);
} else {
// old-school selection tree
catEntryMoveController= new CatalogEntryMoveController(getWindowControl(), ureq, currentCatalogEntry, getTranslator());
}
listenTo(catEntryMoveController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), "close", catEntryMoveController.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
}
/*
* from the repository search, a entry was selected to add
*/
else if (source == rsc) {
// remove modal dialog
cmc.deactivate();
if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
/*
* succesfully selected a repository entry which will be a link within
* the current Category
*/
RepositoryEntry re = rsc.getSelectedEntry();
/*
* create, but do not persist a new catalog entry
*/
newLinkNotPersistedYet = cm.createCatalogEntry();
newLinkNotPersistedYet.setName(re.getDisplayname());
newLinkNotPersistedYet.setDescription(re.getDescription());
newLinkNotPersistedYet.setRepositoryEntry(re);
newLinkNotPersistedYet.setType(CatalogEntry.TYPE_LEAF);
/*
* open the confirm form, which allows to change the link-title,
* link-description.
*/
newLinkNotPersistedYet.setOwnerGroup(ManagerFactory.getManager().createAndPersistSecurityGroup());
cm.addCatalogEntry(currentCatalogEntry, newLinkNotPersistedYet);
newLinkNotPersistedYet = null;
updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
updateToolAccessRights(ureq, currentCatalogEntry, currentCatalogEntryLevel);
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (event == Event.CANCELLED_EVENT) {
updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
updateToolAccessRights(ureq, currentCatalogEntry, currentCatalogEntryLevel);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
/*
* from remove subtree dialog -> yes or no
*/
else if (source == dialogDeleteSubtree) {
if (DialogBoxUIFactory.isYesEvent(event)) {
// remember the parent of the subtree being deleted
CatalogEntry parent = currentCatalogEntry.getParent();
// delete the subtree!!!
cm.deleteCatalogEntry(currentCatalogEntry);
// display the parent
historyStack.remove(historyStack.size() - 1);
updateContent(ureq.getIdentity(), parent, historyStack.indexOf(parent));
updateToolAccessRights(ureq, parent, historyStack.indexOf(parent));
fireEvent(ureq, Event.CHANGED_EVENT);
}
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getCoordinator().getLocker().releaseLock(catModificationLock);
catModificationLock = null;
}
}
/*
* from remove link dialog -> yes or no
*/
else if (source == dialogDeleteLink) {
if (DialogBoxUIFactory.isYesEvent(event)) {
cm.deleteCatalogEntry(linkMarkedToBeDeleted);
updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
}
// in any case, remove the lock
if (catModificationLock != null && catModificationLock.isSuccess()) {
CoordinatorManager.getCoordinator().getLocker().releaseLock(catModificationLock);