RepositoryManager.getInstance().incrementDownloadCounter(repoEntry);
ureq.getDispatchResult().setResultingMediaResource(mr);
return;
} else { // neither launchable nor downloadable -> show details
//REVIEW:pb:replace EntryChangedEvent with a more specific event
fireEvent(ureq, new EntryChangedEvent(repoEntry, EntryChangedEvent.MODIFIED));
return;
}
} else if (command.startsWith(CATCMD_MOVE)) {
String s = command.substring(CATCMD_MOVE.length());
if (s.startsWith(CATENTRY_LEAF)) {
// move a resource in the catalog - moving of catalog leves is triggered by a toolbox action
int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
linkMarkedToBeEdited = (CatalogEntry) childCe.get(pos);
removeAsListenerAndDispose(catEntryMoveController);
boolean ajax = getWindowControl().getWindowBackOffice().getWindowManager().isAjaxEnabled();
if (ajax) {
// fancy ajax tree
catEntryMoveController= new CatalogAjaxMoveController(ureq, getWindowControl(), linkMarkedToBeEdited);
} else {
// old-school selection tree
catEntryMoveController= new CatalogEntryMoveController(getWindowControl(), ureq, linkMarkedToBeEdited, getTranslator());
}
listenTo(catEntryMoveController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), "close", catEntryMoveController.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
} else if (command.startsWith(CATCMD_REMOVE)) {
String s = command.substring(CATCMD_REMOVE.length());
if (s.startsWith(CATENTRY_LEAF)) {
int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
linkMarkedToBeDeleted = (CatalogEntry) childCe.get(pos);
// create modal dialog
String[] trnslP = { linkMarkedToBeDeleted.getName() };
dialogDeleteLink = activateYesNoDialog(ureq, null, getTranslator().translate(NLS_DIALOG_MODAL_LEAF_DELETE_TEXT, trnslP), dialogDeleteLink);
return;
}
} else if (command.startsWith(CATCMD_EDIT)) {
String s = command.substring(CATCMD_EDIT.length());
if (s.startsWith(CATENTRY_LEAF)) {
int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
linkMarkedToBeEdited = (CatalogEntry) childCe.get(pos);
repositoryEditDescriptionController = new RepositoryEditDescriptionController(ureq, getWindowControl(), linkMarkedToBeEdited.getRepositoryEntry(), false);
repositoryEditDescriptionController.addControllerListener(this);
// open form in dialog
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), "close", repositoryEditDescriptionController.getInitialComponent(), true, translate("tools.edit.catalog.category"));
listenTo(cmc);
cmc.activate();
}
} else if (command.startsWith(CATCMD_DETAIL)) {
String s = command.substring(CATCMD_DETAIL.length());
if (s.startsWith(CATENTRY_LEAF)) {
int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
CatalogEntry showDetailForLink = (CatalogEntry) childCe.get(pos);
RepositoryEntry repoEnt = showDetailForLink.getRepositoryEntry();
fireEvent(ureq, new EntryChangedEvent(repoEnt, EntryChangedEvent.MODIFIED));
//TODO [ingkr]
//getWindowControl().getDTabs().activateStatic(ureq, RepositorySite.class.getName(), RepositoryMainController.JUMPFROMEXTERN+RepositoryMainController.JUMPFROMCATALOG+repoEnt.getKey().toString());
return;
}
}