if (repoEntry == null) throw new AssertException("a leaf did not have a repositoryentry! catalogEntry = key:" + cur.getKey()
+ ", title " + cur.getName());
// launch entry if launchable, otherwise offer it as download / launch
// it as non-html in browser
String displayName = cur.getName();
RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repoEntry);
OLATResource ores = repoEntry.getOlatResource();
if (ores == null) throw new AssertException("repoEntry had no olatresource, repoKey = " + repoEntry.getKey());
if (repoEntry.getCanLaunch()) {
// we can create a controller and launch
// it in OLAT, e.g. if it is a
// content-packacking or a course
//was brasato:: DTabs dts = getWindowControl().getDTabs();
DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
DTab dt = dts.getDTab(ores);
if (dt == null) {
// does not yet exist -> create and add
dt = dts.createDTab(ores, displayName);
if (dt == null) return;
Controller launchController = ControllerFactory.createLaunchController(ores, null, ureq, dt.getWindowControl(), true);
dt.setController(launchController);
dts.addDTab(dt);
}
dts.activate(ureq, dt, null); // null: start with main entry point of controller
} else if (repoEntry.getCanDownload()) {
// else not launchable in olat, but downloadable -> send the document
// directly to browser but "downloadable" (pdf, word, excel)
MediaResource mr = handler.getAsMediaResource(ores);
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