Search in sources :

Example 21 with DeliveryOptions

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

the class CPRunController method doLaunch.

private void doLaunch(UserRequest ureq) {
    DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(CPEditController.CONFIG_DELIVERYOPTIONS);
    if (cpRoot == null) {
        // it is the first time we start the contentpackaging from this instance
        // of this controller.
        // need to be strict when launching -> "true"
        RepositoryEntry re = CPEditController.getCPReference(config, false);
        if (re == null) {
            showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
            return;
        }
        cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
        // nodes reference them
        if (cpRoot == null) {
            showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
            return;
        }
        if (deliveryOptions != null && deliveryOptions.getInherit() != null && deliveryOptions.getInherit().booleanValue()) {
            CPPackageConfig packageConfig = CPManager.getInstance().getCPPackageConfig(re.getOlatResource());
            if (packageConfig != null && packageConfig.getDeliveryOptions() != null) {
                deliveryOptions = packageConfig.getDeliveryOptions();
            }
        }
    }
    // else cpRoot is already set (save some db access if the user opens /
    // closes / reopens the cp from the same CPRuncontroller instance)
    boolean activateFirstPage = true;
    if ((nodecmd != null) && !nodecmd.equals("")) {
        activateFirstPage = false;
    }
    boolean showNavigation = !config.getBooleanSafe(NodeEditController.CONFIG_COMPONENT_MENU);
    cpDispC = CPUIFactory.getInstance().createContentOnlyCPDisplayController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), activateFirstPage, showNavigation, deliveryOptions, nodecmd, courseResource, cpNode.getIdent(), preview);
    cpDispC.setContentEncoding(deliveryOptions.getContentEncoding());
    cpDispC.setJSEncoding(deliveryOptions.getJavascriptEncoding());
    cpDispC.addControllerListener(this);
    main.setContent(cpDispC.getInitialComponent());
    if (isExternalMenuConfigured()) {
        treeModel = cpDispC.getTreeModel();
        treeNodeClickListener = this;
        if (activateFirstPage) {
            selNodeId = cpDispC.getInitialSelectedNodeId();
        } else {
            String uri = nodecmd;
            if (uri.startsWith("/")) {
                uri = uri.substring(1, uri.length());
            }
            selNodeId = cpDispC.getNodeByUri(uri);
        }
    }
}
Also used : CPPackageConfig(org.olat.ims.cp.ui.CPPackageConfig) RepositoryEntry(org.olat.repository.RepositoryEntry) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 22 with DeliveryOptions

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

the class SPEditController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest urequest, Controller source, Event event) {
    if (source instanceof NodeEditController) {
        if (combiLinkCtr != null && combiLinkCtr.isDoProposal()) {
            combiLinkCtr.setRelFilePath(CourseEditorHelper.createUniqueRelFilePathFromShortTitle(courseNode, courseFolderBaseContainer));
        }
    } else if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == deliveryOptionsCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            DeliveryOptions config = deliveryOptionsCtrl.getDeliveryOptions();
            if (config != null) {
                moduleConfiguration.set(CONFIG_KEY_DELIVERYOPTIONS, config);
                fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
            }
        }
    } else if (source == combiLinkCtr) {
        if (event == Event.DONE_EVENT) {
            String relPath = VFSManager.getRelativeItemPath(combiLinkCtr.getFile(), courseFolderBaseContainer, null);
            combiLinkCtr.setEditable(hasEditRights(relPath));
            moduleConfiguration.set(CONFIG_KEY_FILE, relPath);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
            if (!myTabbedPane.containsTab(deliveryOptionsCtrl.getInitialComponent())) {
                myTabbedPane.addTab(translate(PANE_TAB_DELIVERYOPTIONS), deliveryOptionsCtrl.getInitialComponent());
            }
            myContent.contextPut("editorEnabled", combiLinkCtr.isEditorEnabled());
        }
    } else if (source == securitySettingForm) {
        if (event == Event.DONE_EVENT) {
            boolean allowRelativeLinks = securitySettingForm.getAllowRelativeLinksConfig();
            moduleConfiguration.set(CONFIG_KEY_ALLOW_RELATIVE_LINKS, allowRelativeLinks);
            moduleConfiguration.set(CONFIG_KEY_ALLOW_COACH_EDIT, securitySettingForm.getAllowCoachEditConfig());
            combiLinkCtr.setAllowEditorRelativeLinks(allowRelativeLinks);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) NodeEditController(org.olat.course.editor.NodeEditController) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions)

Example 23 with DeliveryOptions

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

the class TaskHelper method getStandardDeliveryOptions.

public static DeliveryOptions getStandardDeliveryOptions() {
    DeliveryOptions config = new DeliveryOptions();
    config.setjQueryEnabled(Boolean.TRUE);
    config.setOpenolatCss(Boolean.TRUE);
    return config;
}
Also used : DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions)

Example 24 with DeliveryOptions

use of org.olat.core.gui.control.generic.iframe.DeliveryOptions 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 25 with DeliveryOptions

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

the class SPCourseNode method updateModuleConfigDefaults.

/**
 * Update the module configuration to have all mandatory configuration flags
 * set to usefull default values
 *
 * @param isNewNode true: an initial configuration is set; false: upgrading
 *          from previous node configuration version, set default to maintain
 *          previous behaviour
 */
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        // use defaults for new course building blocks
        config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, false);
        config.setBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, false);
        DeliveryOptions defaultOptions = DeliveryOptions.defaultWithGlossary();
        config.set(SPEditController.CONFIG_KEY_DELIVERYOPTIONS, defaultOptions);
        // new since config version 3
        config.setConfigurationVersion(4);
    } else {
        config.remove(NodeEditController.CONFIG_INTEGRATION);
        int version = config.getConfigurationVersion();
        if (version < 2) {
            // use values accoring to previous functionality
            config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.FALSE.booleanValue());
            config.setBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, Boolean.FALSE.booleanValue());
            config.setConfigurationVersion(2);
        }
        if (version < 4) {
            if (config.get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS) == null) {
                DeliveryOptions defaultOptions = DeliveryOptions.defaultWithGlossary();
                config.set(SPEditController.CONFIG_KEY_DELIVERYOPTIONS, defaultOptions);
            }
            config.setConfigurationVersion(4);
        }
    // there was a version 3 but all keys new in this version have been removed
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions)

Aggregations

DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)34 RepositoryEntry (org.olat.repository.RepositoryEntry)18 UserRequest (org.olat.core.gui.UserRequest)10 Controller (org.olat.core.gui.control.Controller)10 WindowControl (org.olat.core.gui.control.WindowControl)10 File (java.io.File)8 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)8 CPPackageConfig (org.olat.ims.cp.ui.CPPackageConfig)8 ModuleConfiguration (org.olat.modules.ModuleConfiguration)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)6 OLATResource (org.olat.resource.OLATResource)6 SinglePageController (org.olat.core.commons.modules.singlepage.SinglePageController)4 ControllerEventListener (org.olat.core.gui.control.ControllerEventListener)4 Event (org.olat.core.gui.control.Event)4 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)4 CloneController (org.olat.core.gui.control.generic.clone.CloneController)4 CloneLayoutControllerCreatorCallback (org.olat.core.gui.control.generic.clone.CloneLayoutControllerCreatorCallback)4 CloneableController (org.olat.core.gui.control.generic.clone.CloneableController)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 DeliveryOptionsConfigurationController (org.olat.core.gui.control.generic.iframe.DeliveryOptionsConfigurationController)4