use of org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent in project openolat by klemens.
the class MediaCenterController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (mediaUploadCtrl == source || textUploadCtrl == source || citationUploadCtrl == source) {
if (event == Event.DONE_EVENT) {
loadModel();
tableEl.reloadData();
}
cmc.deactivate();
cleanUp();
if (select || event == Event.DONE_EVENT) {
if (mediaUploadCtrl == source) {
doSelect(ureq, mediaUploadCtrl.getMediaReference().getKey());
} else if (textUploadCtrl == source) {
doSelect(ureq, textUploadCtrl.getMediaReference().getKey());
} else if (citationUploadCtrl == source) {
doSelect(ureq, citationUploadCtrl.getMediaReference().getKey());
}
}
} else if (importArtefactv1Ctrl == source) {
Media media = null;
if (event instanceof EPArtefactChoosenEvent) {
EPArtefactChoosenEvent cEvent = (EPArtefactChoosenEvent) event;
media = doImportArtefactV1(cEvent.getArtefact());
loadModel();
tableEl.reloadData();
} else if (event instanceof EPArtefactListChoosenEvent) {
EPArtefactListChoosenEvent cmEvent = (EPArtefactListChoosenEvent) event;
for (AbstractArtefact artefact : cmEvent.getArtefacts()) {
media = doImportArtefactV1(artefact);
}
if (cmEvent.getArtefacts().size() > 1) {
// only auto select a single media
media = null;
}
loadModel();
tableEl.reloadData();
showInfo("message.imported.successfully", new String[] { Integer.toString(cmEvent.getArtefacts().size()) });
}
cmc.deactivate();
cleanUp();
if (select && media != null) {
doSelect(ureq, media.getKey());
}
} else if (newMediasCtrl == source) {
newMediasCalloutCtrl.deactivate();
if ("add.file".equals(event.getCommand())) {
doAddMedia(ureq, "add.file");
} else if ("add.media".equals(event.getCommand())) {
doAddMedia(ureq, "add.media");
} else if ("add.text".equals(event.getCommand())) {
doAddTextMedia(ureq);
} else if ("add.citation".equals(event.getCommand())) {
doAddCitationMedia(ureq);
} else if ("import.artefactV1".equals(event.getCommand())) {
doChooseArtefactV1(ureq);
}
} else if (detailsCtrl == source) {
if (event instanceof MediaEvent) {
MediaEvent me = (MediaEvent) event;
if (MediaEvent.DELETED.equals(me.getCommand())) {
stackPanel.popUpToController(this);
loadModel();
tableEl.reset(false, true, true);
}
}
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
Aggregations