if (source == versioningTableCtr) {
/*************************************************************************
* history table events
************************************************************************/
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
if (te.getActionId().equals(ACTION_COMPARE)) {
selectedPage = (WikiPage) versioningTableModel.getObject(te.getRowId());
diffs = wiki.getDiff(page, selectedPage.getVersion() - 1, selectedPage.getVersion());
versioningContent.contextPut("diffs", diffs);
versioningContent.remove(wikiVersionDisplayComp);
versioningContent.contextPut("page", selectedPage);
} else if (te.getActionId().equals(ACTION_SHOW)) {
versioningContent.contextRemove("diffs");
selectedPage = (WikiPage) versioningTableModel.getObject(te.getRowId());
selectedPage = wiki.loadVersion(selectedPage, selectedPage.getVersion());
wikiVersionDisplayComp.setWikiContent(selectedPage.getContent());
wikiVersionDisplayComp.setImageMapperUri(ureq, wikiContainer);
versioningContent.put("versionDisplay", wikiVersionDisplayComp);
versioningContent.contextPut("page", selectedPage);
}
}
} else if (source == fileUplCtr) {
/*************************************************************************
* file upload controller events
************************************************************************/
if (event == Event.DONE_EVENT) {
fileUplCtr.reset();
} else if (event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {
FolderEvent fEvent = (FolderEvent)event;
createMediaMetadataFile(fEvent.getFilename(), ureq.getIdentity().getKey());
editContent.contextPut("fileList", wiki.getMediaFileList());
}
} else if (source == breadCrumpCtr) {
/*************************************************************************
* BreadCrump controller events
************************************************************************/
page = wiki.getPage(event.getCommand(), true);
updatePageContext(page);
setTabsEnabled(true);
breadCrumpCtr.addLink(page.getPageName(), page.getPageName());
tabs.setSelectedPane(0);
} else if (source == removePageDialogCtr) {
if (DialogBoxUIFactory.isOkEvent(event)) {
wiki.removePage(page);
breadCrumpCtr.removeLink(page.getPageName());
WikiManager.getInstance().deleteWikiPage(ores, page);
page = wiki.getPage(WikiPage.WIKI_INDEX_PAGE);
updatePageContext(page);
tabs.setSelectedPane(0);
}
} else if (source == mediaTableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
if (te.getActionId().equals(ACTION_DELETE_MEDIA)) {
List list = new ArrayList(1);
list.add(mediaFilesTableModel.getObject(te.getRowId()));
deleteMediaFile(list, ureq);
} else if (te.getActionId().equals(ACTION_SHOW_MEDIA)) {
// show a selected file from the media folder
MediaFileElement element = (MediaFileElement)mediaFilesTableModel.getObject(te.getRowId());
if (isImage(element.getFilename()) ) { // show images inline as modal overlay
imageDisplay.contextPut("mediaElement", element);
imageDisplay.contextPut("imageUri", wikiArticleComp.getImageBaseUri());
CloseableModalController cmc = new CloseableModalController(getWindowControl(), translate("close"), imageDisplay);
cmc.activate();