Search in sources :

Example 1 with ScormAPIandDisplayController

use of org.olat.modules.scorm.ScormAPIandDisplayController in project OpenOLAT by OpenOLAT.

the class VarForm 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)
 */
public void event(UserRequest ureq, Component source, Event event) {
    if (source == chooseCPButton || source == changeCPButton) {
        // those must be links
        removeAsListenerAndDispose(searchController);
        searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ScormCPFileResource.TYPE_NAME, translate("command.choosecp"));
        listenTo(searchController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.importcp"));
        listenTo(cmc);
        cmc.activate();
    } else if (source == previewLink) {
        // Preview as modal dialogue
        // only if the config is valid
        RepositoryEntry re = getScormCPReference(config, false);
        if (re == null) {
            // we cannot preview it, because the repository entry
            // had been deleted between the time when it was
            // chosen here, and now
            showError("error.cprepoentrymissing");
        } else {
            File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
            boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
            boolean fullWindow = config.getBooleanSafe(CONFIG_FULLWINDOW, true);
            ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
            ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(), ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, true, fullWindow, false, null);
            // configure some display options
            boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
            previewController.showNavButtons(showNavButtons);
            DeliveryOptions deliveryOptions = deliveryOptionsCtrl.getOptionsForPreview();
            previewController.setDeliveryOptions(deliveryOptions);
            previewController.activate();
        }
    }
}
Also used : ScormAPIandDisplayController(org.olat.modules.scorm.ScormAPIandDisplayController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController) File(java.io.File) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions)

Example 2 with ScormAPIandDisplayController

use of org.olat.modules.scorm.ScormAPIandDisplayController in project openolat by klemens.

the class VarForm 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)
 */
public void event(UserRequest ureq, Component source, Event event) {
    if (source == chooseCPButton || source == changeCPButton) {
        // those must be links
        removeAsListenerAndDispose(searchController);
        searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ScormCPFileResource.TYPE_NAME, translate("command.choosecp"));
        listenTo(searchController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.importcp"));
        listenTo(cmc);
        cmc.activate();
    } else if (source == previewLink) {
        // Preview as modal dialogue
        // only if the config is valid
        RepositoryEntry re = getScormCPReference(config, false);
        if (re == null) {
            // we cannot preview it, because the repository entry
            // had been deleted between the time when it was
            // chosen here, and now
            showError("error.cprepoentrymissing");
        } else {
            File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
            boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
            boolean fullWindow = config.getBooleanSafe(CONFIG_FULLWINDOW, true);
            ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
            ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(), ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, true, fullWindow, false, null);
            // configure some display options
            boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
            previewController.showNavButtons(showNavButtons);
            DeliveryOptions deliveryOptions = deliveryOptionsCtrl.getOptionsForPreview();
            previewController.setDeliveryOptions(deliveryOptions);
            previewController.activate();
        }
    }
}
Also used : ScormAPIandDisplayController(org.olat.modules.scorm.ScormAPIandDisplayController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController) File(java.io.File) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions)

Aggregations

File (java.io.File)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)2 ScormAPIandDisplayController (org.olat.modules.scorm.ScormAPIandDisplayController)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 ReferencableEntriesSearchController (org.olat.repository.controllers.ReferencableEntriesSearchController)2