Search in sources :

Example 1 with IFrameDisplayController

use of org.olat.core.gui.control.generic.iframe.IFrameDisplayController in project OpenOLAT by OpenOLAT.

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)

Example 2 with IFrameDisplayController

use of org.olat.core.gui.control.generic.iframe.IFrameDisplayController in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method init.

private void init(UserRequest ureq) {
    startButton = LinkFactory.createButton("start", mainVC, this);
    startButton.setElementCssClass("o_sel_start_qti21assessment");
    startButton.setPrimary(true);
    startButton.setVisible(!userCourseEnv.isCourseReadOnly());
    // fetch disclaimer file
    String sDisclaimer = config.getStringValue(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
        VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
        int lastSlash = sDisclaimer.lastIndexOf('/');
        if (lastSlash != -1) {
            baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
            sDisclaimer = sDisclaimer.substring(lastSlash);
            // first check if disclaimer exists on filesystem
            if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
                showWarning("disclaimer.file.invalid", sDisclaimer);
            } else {
                // screenreader do not like iframes, display inline
                IFrameDisplayController iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer);
                // dispose automatically
                listenTo(iFrameCtr);
                disclaimerVC.put("disc", iFrameCtr.getInitialComponent());
                iFrameCtr.setCurrentURI(sDisclaimer);
                disclaimerVC.contextPut("hasDisc", Boolean.TRUE);
                disclaimerVC.contextPut("in-disclaimer", isPanelOpen(ureq, "disclaimer", true));
            }
        }
    }
    if (assessmentType) {
        checkChats(ureq);
        singleUserEventCenter.registerFor(this, getIdentity(), InstantMessagingService.TOWER_EVENT_ORES);
    }
}
Also used : IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) VFSContainer(org.olat.core.util.vfs.VFSContainer)

Example 3 with IFrameDisplayController

use of org.olat.core.gui.control.generic.iframe.IFrameDisplayController in project OpenOLAT by OpenOLAT.

the class IQRunController method init.

private void init(UserRequest ureq) {
    startButton = LinkFactory.createButton("start", myContent, this);
    startButton.setElementCssClass("o_sel_start_qti12_test");
    startButton.setPrimary(true);
    startButton.setVisible(!userCourseEnv.isCourseReadOnly());
    // fetch disclaimer file
    String sDisclaimer = (String) modConfig.get(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
        VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
        int lastSlash = sDisclaimer.lastIndexOf('/');
        if (lastSlash != -1) {
            baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
            sDisclaimer = sDisclaimer.substring(lastSlash);
            // first check if disclaimer exists on filesystem
            if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
                showWarning("disclaimer.file.invalid", sDisclaimer);
            } else {
                // screenreader do not like iframes, display inline
                iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer);
                // dispose automatically
                listenTo(iFrameCtr);
                myContent.put("disc", iFrameCtr.getInitialComponent());
                iFrameCtr.setCurrentURI(sDisclaimer);
                myContent.contextPut("hasDisc", Boolean.TRUE);
                myContent.contextPut("in-disclaimer", isPanelOpen(ureq, "disclaimer", true));
            }
        }
    }
    // push title and learning objectives, only visible on intro page
    myContent.contextPut("menuTitle", courseNode.getShortTitle());
    myContent.contextPut("displayTitle", courseNode.getLongTitle());
    // Adding learning objectives
    String learningObj = courseNode.getLearningObjectives();
    if (learningObj != null) {
        Component learningObjectives = ObjectivesHelper.createLearningObjectivesComponent(learningObj, ureq);
        myContent.put("learningObjectives", learningObjectives);
        // dummy value, just an exists operator
        myContent.contextPut("hasObjectives", learningObj);
    }
    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
        checkChats(ureq);
        singleUserEventCenter.registerFor(this, getIdentity(), InstantMessagingService.TOWER_EVENT_ORES);
    }
}
Also used : IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) VFSContainer(org.olat.core.util.vfs.VFSContainer) Component(org.olat.core.gui.components.Component)

Example 4 with IFrameDisplayController

use of org.olat.core.gui.control.generic.iframe.IFrameDisplayController in project openolat by klemens.

the class IQRunController method init.

private void init(UserRequest ureq) {
    startButton = LinkFactory.createButton("start", myContent, this);
    startButton.setElementCssClass("o_sel_start_qti12_test");
    startButton.setPrimary(true);
    startButton.setVisible(!userCourseEnv.isCourseReadOnly());
    // fetch disclaimer file
    String sDisclaimer = (String) modConfig.get(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
        VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
        int lastSlash = sDisclaimer.lastIndexOf('/');
        if (lastSlash != -1) {
            baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
            sDisclaimer = sDisclaimer.substring(lastSlash);
            // first check if disclaimer exists on filesystem
            if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
                showWarning("disclaimer.file.invalid", sDisclaimer);
            } else {
                // screenreader do not like iframes, display inline
                iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer);
                // dispose automatically
                listenTo(iFrameCtr);
                myContent.put("disc", iFrameCtr.getInitialComponent());
                iFrameCtr.setCurrentURI(sDisclaimer);
                myContent.contextPut("hasDisc", Boolean.TRUE);
                myContent.contextPut("in-disclaimer", isPanelOpen(ureq, "disclaimer", true));
            }
        }
    }
    // push title and learning objectives, only visible on intro page
    myContent.contextPut("menuTitle", courseNode.getShortTitle());
    myContent.contextPut("displayTitle", courseNode.getLongTitle());
    // Adding learning objectives
    String learningObj = courseNode.getLearningObjectives();
    if (learningObj != null) {
        Component learningObjectives = ObjectivesHelper.createLearningObjectivesComponent(learningObj, ureq);
        myContent.put("learningObjectives", learningObjectives);
        // dummy value, just an exists operator
        myContent.contextPut("hasObjectives", learningObj);
    }
    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
        checkChats(ureq);
        singleUserEventCenter.registerFor(this, getIdentity(), InstantMessagingService.TOWER_EVENT_ORES);
    }
}
Also used : IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) VFSContainer(org.olat.core.util.vfs.VFSContainer) Component(org.olat.core.gui.components.Component)

Example 5 with IFrameDisplayController

use of org.olat.core.gui.control.generic.iframe.IFrameDisplayController in project openolat by klemens.

the class QTI21AssessmentRunController method init.

private void init(UserRequest ureq) {
    startButton = LinkFactory.createButton("start", mainVC, this);
    startButton.setElementCssClass("o_sel_start_qti21assessment");
    startButton.setPrimary(true);
    startButton.setVisible(!userCourseEnv.isCourseReadOnly());
    // fetch disclaimer file
    String sDisclaimer = config.getStringValue(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
        VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
        int lastSlash = sDisclaimer.lastIndexOf('/');
        if (lastSlash != -1) {
            baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
            sDisclaimer = sDisclaimer.substring(lastSlash);
            // first check if disclaimer exists on filesystem
            if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
                showWarning("disclaimer.file.invalid", sDisclaimer);
            } else {
                // screenreader do not like iframes, display inline
                IFrameDisplayController iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer);
                // dispose automatically
                listenTo(iFrameCtr);
                disclaimerVC.put("disc", iFrameCtr.getInitialComponent());
                iFrameCtr.setCurrentURI(sDisclaimer);
                disclaimerVC.contextPut("hasDisc", Boolean.TRUE);
                disclaimerVC.contextPut("in-disclaimer", isPanelOpen(ureq, "disclaimer", true));
            }
        }
    }
    if (assessmentType) {
        checkChats(ureq);
        singleUserEventCenter.registerFor(this, getIdentity(), InstantMessagingService.TOWER_EVENT_ORES);
    }
}
Also used : IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) VFSContainer(org.olat.core.util.vfs.VFSContainer)

Aggregations

IFrameDisplayController (org.olat.core.gui.control.generic.iframe.IFrameDisplayController)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 File (java.io.File)2 Component (org.olat.core.gui.components.Component)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 FileMediaResource (org.olat.core.gui.media.FileMediaResource)2