Search in sources :

Example 1 with CollectArtefactController

use of org.olat.modules.portfolio.ui.wizard.CollectArtefactController in project OpenOLAT by OpenOLAT.

the class CertificateAndEfficiencyStatementListController method doCollectMedia.

private void doCollectMedia(UserRequest ureq, String title, Long efficiencyStatementKey) {
    if (collectorCtrl != null)
        return;
    EfficiencyStatement fullStatement = esm.getUserEfficiencyStatementByKey(efficiencyStatementKey);
    collectorCtrl = new CollectArtefactController(ureq, getWindowControl(), fullStatement, mediaHandler, "");
    listenTo(collectorCtrl);
    cmc = new CloseableModalController(getWindowControl(), null, collectorCtrl.getInitialComponent(), true, title, true);
    cmc.addControllerListener(this);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CollectArtefactController(org.olat.modules.portfolio.ui.wizard.CollectArtefactController) EfficiencyStatement(org.olat.course.assessment.EfficiencyStatement) CertificateAndEfficiencyStatement(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)

Example 2 with CollectArtefactController

use of org.olat.modules.portfolio.ui.wizard.CollectArtefactController in project OpenOLAT by OpenOLAT.

the class CmdAddToEPortfolioImpl method execute.

/**
 * might return NULL!, if item clicked was removed meanwhile or if portfolio is disabled or if only the folder-artefact-handler is disabled.
 *
 * @see org.olat.core.commons.modules.bc.commands.FolderCommand#execute(org.olat.core.commons.modules.bc.components.FolderComponent,
 *      org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.core.gui.translator.Translator)
 */
@Override
public Controller execute(FolderComponent folderComponent, UserRequest ureq, WindowControl wControl, Translator translator) {
    String pos = ureq.getParameter(ListRenderer.PARAM_EPORT);
    if (!StringHelper.containsNonWhitespace(pos)) {
        // somehow parameter did not make it to us
        status = FolderCommandStatus.STATUS_FAILED;
        getWindowControl().setError(translator.translate("failed"));
        return null;
    }
    status = FolderCommandHelper.sanityCheck(wControl, folderComponent);
    if (status == FolderCommandStatus.STATUS_SUCCESS) {
        currentItem = folderComponent.getCurrentContainerChildren().get(Integer.parseInt(pos));
        status = FolderCommandHelper.sanityCheck2(wControl, folderComponent, currentItem);
    }
    if (status == FolderCommandStatus.STATUS_FAILED) {
        return null;
    }
    if (portfolioV2Module.isEnabled()) {
        PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
        MediaHandler handler = null;
        String extension = FileUtils.getFileSuffix(currentItem.getName());
        if (StringHelper.containsNonWhitespace(extension)) {
            if ("jpg".equalsIgnoreCase(extension) || "jpeg".equalsIgnoreCase(extension) || "png".equalsIgnoreCase(extension) || "gif".equalsIgnoreCase(extension)) {
                handler = portfolioService.getMediaHandler(ImageHandler.IMAGE_TYPE);
            }
        // TODO video
        }
        if (handler == null) {
            handler = portfolioService.getMediaHandler(FileHandler.FILE_TYPE);
        }
        collectStepsCtrl = new CollectArtefactController(ureq, wControl, currentItem, handler, "");
    } else {
        EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(FileArtefact.FILE_ARTEFACT_TYPE);
        AbstractArtefact artefact = artHandler.createArtefact();
        artHandler.prefillArtefactAccordingToSource(artefact, currentItem);
        artefact.setAuthor(getIdentity());
        collectStepsCtrl = new ArtefactWizzardStepsController(ureq, wControl, artefact, currentItem.getParentContainer());
    }
    return collectStepsCtrl;
}
Also used : PortfolioService(org.olat.modules.portfolio.PortfolioService) MediaHandler(org.olat.modules.portfolio.MediaHandler) CollectArtefactController(org.olat.modules.portfolio.ui.wizard.CollectArtefactController) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact)

Example 3 with CollectArtefactController

use of org.olat.modules.portfolio.ui.wizard.CollectArtefactController in project OpenOLAT by OpenOLAT.

the class MediaCollectorComponent method doOpenCollector.

private void doOpenCollector(UserRequest ureq) {
    collectorCtrl = new CollectArtefactController(ureq, wControl, media, handler, businessPath);
    collectorCtrl.addControllerListener(this);
    String title = "Media";
    cmc = new CloseableModalController(wControl, null, collectorCtrl.getInitialComponent(), true, title, true);
    cmc.addControllerListener(this);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CollectArtefactController(org.olat.modules.portfolio.ui.wizard.CollectArtefactController)

Example 4 with CollectArtefactController

use of org.olat.modules.portfolio.ui.wizard.CollectArtefactController in project openolat by klemens.

the class CmdAddToEPortfolioImpl method execute.

/**
 * might return NULL!, if item clicked was removed meanwhile or if portfolio is disabled or if only the folder-artefact-handler is disabled.
 *
 * @see org.olat.core.commons.modules.bc.commands.FolderCommand#execute(org.olat.core.commons.modules.bc.components.FolderComponent,
 *      org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.core.gui.translator.Translator)
 */
@Override
public Controller execute(FolderComponent folderComponent, UserRequest ureq, WindowControl wControl, Translator translator) {
    String pos = ureq.getParameter(ListRenderer.PARAM_EPORT);
    if (!StringHelper.containsNonWhitespace(pos)) {
        // somehow parameter did not make it to us
        status = FolderCommandStatus.STATUS_FAILED;
        getWindowControl().setError(translator.translate("failed"));
        return null;
    }
    status = FolderCommandHelper.sanityCheck(wControl, folderComponent);
    if (status == FolderCommandStatus.STATUS_SUCCESS) {
        currentItem = folderComponent.getCurrentContainerChildren().get(Integer.parseInt(pos));
        status = FolderCommandHelper.sanityCheck2(wControl, folderComponent, currentItem);
    }
    if (status == FolderCommandStatus.STATUS_FAILED) {
        return null;
    }
    if (portfolioV2Module.isEnabled()) {
        PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
        MediaHandler handler = null;
        String extension = FileUtils.getFileSuffix(currentItem.getName());
        if (StringHelper.containsNonWhitespace(extension)) {
            if ("jpg".equalsIgnoreCase(extension) || "jpeg".equalsIgnoreCase(extension) || "png".equalsIgnoreCase(extension) || "gif".equalsIgnoreCase(extension)) {
                handler = portfolioService.getMediaHandler(ImageHandler.IMAGE_TYPE);
            }
        // TODO video
        }
        if (handler == null) {
            handler = portfolioService.getMediaHandler(FileHandler.FILE_TYPE);
        }
        collectStepsCtrl = new CollectArtefactController(ureq, wControl, currentItem, handler, "");
    } else {
        EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(FileArtefact.FILE_ARTEFACT_TYPE);
        AbstractArtefact artefact = artHandler.createArtefact();
        artHandler.prefillArtefactAccordingToSource(artefact, currentItem);
        artefact.setAuthor(getIdentity());
        collectStepsCtrl = new ArtefactWizzardStepsController(ureq, wControl, artefact, currentItem.getParentContainer());
    }
    return collectStepsCtrl;
}
Also used : PortfolioService(org.olat.modules.portfolio.PortfolioService) MediaHandler(org.olat.modules.portfolio.MediaHandler) CollectArtefactController(org.olat.modules.portfolio.ui.wizard.CollectArtefactController) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact)

Example 5 with CollectArtefactController

use of org.olat.modules.portfolio.ui.wizard.CollectArtefactController in project openolat by klemens.

the class MediaCollectorComponent method doOpenCollector.

private void doOpenCollector(UserRequest ureq) {
    collectorCtrl = new CollectArtefactController(ureq, wControl, media, handler, businessPath);
    collectorCtrl.addControllerListener(this);
    String title = "Media";
    cmc = new CloseableModalController(wControl, null, collectorCtrl.getInitialComponent(), true, title, true);
    cmc.addControllerListener(this);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CollectArtefactController(org.olat.modules.portfolio.ui.wizard.CollectArtefactController)

Aggregations

CollectArtefactController (org.olat.modules.portfolio.ui.wizard.CollectArtefactController)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 EfficiencyStatement (org.olat.course.assessment.EfficiencyStatement)2 CertificateAndEfficiencyStatement (org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListModel.CertificateAndEfficiencyStatement)2 MediaHandler (org.olat.modules.portfolio.MediaHandler)2 PortfolioService (org.olat.modules.portfolio.PortfolioService)2 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2