Search in sources :

Example 16 with FileMediaResource

use of org.olat.core.gui.media.FileMediaResource in project openolat by klemens.

the class ReturnboxFullAccessCallback method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Component source, Event event) {
    if (source == taskLaunchButton) {
        File fTaskfolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(userCourseEnv.getCourseEnvironment(), node));
        if (assignedTask.toLowerCase().endsWith(".html") || assignedTask.toLowerCase().endsWith(".htm") || assignedTask.toLowerCase().endsWith(".txt")) {
            // render content for other users always in iframe
            removeAsListenerAndDispose(iFrameCtr);
            iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), fTaskfolder);
            listenTo(iFrameCtr);
            iFrameCtr.setCurrentURI(assignedTask);
            removeAsListenerAndDispose(cmc);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), iFrameCtr.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        } else {
            ureq.getDispatchResult().setResultingMediaResource(new FileMediaResource(new File(fTaskfolder, assignedTask)));
        }
    } else if (source == cancelTaskButton) {
        // confirm cancel task assignment
        dialogBoxController = this.activateYesNoDialog(ureq, "", translate("task.cancel.reassign"), dialogBoxController);
    }
}
Also used : IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) FileMediaResource(org.olat.core.gui.media.FileMediaResource) File(java.io.File)

Aggregations

FileMediaResource (org.olat.core.gui.media.FileMediaResource)16 File (java.io.File)14 MediaResource (org.olat.core.gui.media.MediaResource)10 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 CustomStaticFolderManager (org.olat.admin.sysinfo.manager.CustomStaticFolderManager)2 SinglePageController (org.olat.core.commons.modules.singlepage.SinglePageController)2 ImageService (org.olat.core.commons.services.image.ImageService)2 IFrameDisplayController (org.olat.core.gui.control.generic.iframe.IFrameDisplayController)2 ForbiddenMediaResource (org.olat.core.gui.media.ForbiddenMediaResource)2 NotFoundMediaResource (org.olat.core.gui.media.NotFoundMediaResource)2 ZippedDirectoryMediaResource (org.olat.fileresource.ZippedDirectoryMediaResource)2