Search in sources :

Example 6 with EPArtefactChoosenEvent

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);
}
Also used : MediaEvent(org.olat.modules.portfolio.ui.event.MediaEvent) Media(org.olat.modules.portfolio.Media) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) EPArtefactListChoosenEvent(org.olat.portfolio.ui.artefacts.view.EPArtefactListChoosenEvent) EPArtefactChoosenEvent(org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent)

Aggregations

EPArtefactChoosenEvent (org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent)6 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)4 EPArtefactListChoosenEvent (org.olat.portfolio.ui.artefacts.view.EPArtefactListChoosenEvent)4 Media (org.olat.modules.portfolio.Media)2 MediaEvent (org.olat.modules.portfolio.ui.event.MediaEvent)2 EPArtefactDeletedEvent (org.olat.portfolio.ui.artefacts.view.EPArtefactDeletedEvent)2 EPTagBrowseController (org.olat.portfolio.ui.artefacts.view.EPTagBrowseController)2 EPTagBrowseEvent (org.olat.portfolio.ui.artefacts.view.EPTagBrowseEvent)2 EPFilterSelectController (org.olat.portfolio.ui.filter.EPFilterSelectController)2 PortfolioFilterChangeEvent (org.olat.portfolio.ui.filter.PortfolioFilterChangeEvent)2 PortfolioFilterController (org.olat.portfolio.ui.filter.PortfolioFilterController)2 PortfolioFilterEditEvent (org.olat.portfolio.ui.filter.PortfolioFilterEditEvent)2