Search in sources :

Example 11 with DeliveryOptions

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

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 12 with DeliveryOptions

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

the class SPRunController method doInlineIntegration.

private void doInlineIntegration(UserRequest ureq, boolean hasEditRightsTo) {
    boolean allowRelativeLinks = config.getBooleanSafe(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS);
    // create the possibility to float
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(ICourse.class, userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS);
    spCtr = new SinglePageController(ureq, getWindowControl(), courseFolderContainer, fileName, allowRelativeLinks, null, ores, deliveryOptions, userCourseEnv.getCourseEnvironment().isPreview());
    spCtr.setAllowDownload(true);
    // only for inline integration: register for controller event to forward a olatcmd to the course,
    // and also to remember latest position in the script
    listenTo(spCtr);
    // enable edit mode if user has the according rights
    if (hasEditRightsTo) {
        spCtr.allowPageEditing();
        // set the link tree model to internal for the HTML editor
        if (linkTreeModel != null) {
            spCtr.setInternalLinkTreeModel(linkTreeModel);
        }
    }
    // create clone wrapper layout
    CloneLayoutControllerCreatorCallback clccc = new CloneLayoutControllerCreatorCallback() {

        public ControllerCreator createLayoutControllerCreator(UserRequest uureq, final ControllerCreator contentControllerCreator) {
            return BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(uureq, new ControllerCreator() {

                public Controller createController(UserRequest lureq, WindowControl lwControl) {
                    // Wrap in column layout, popup window needs a layout controller
                    Controller ctr = contentControllerCreator.createController(lureq, lwControl);
                    LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
                    layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), userCourseEnv.getCourseEnvironment()));
                    // Controller titledCtrl = TitledWrapperHelper.getWrapper(lureq, lwControl, ctr, courseNode, "o_sp_icon");
                    layoutCtr.addDisposableChildController(ctr);
                    return layoutCtr;
                }
            });
        }
    };
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), spCtr, courseNode, "o_sp_icon");
    if (ctrl instanceof CloneableController) {
        cloneC = new CloneController(ureq, getWindowControl(), (CloneableController) ctrl, clccc);
        listenTo(cloneC);
        main.setContent(cloneC.getInitialComponent());
    } else {
        throw new AssertException("Controller must be cloneable");
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) OLATResourceable(org.olat.core.id.OLATResourceable) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) SinglePageController(org.olat.core.commons.modules.singlepage.SinglePageController) WindowControl(org.olat.core.gui.control.WindowControl) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CloneController(org.olat.core.gui.control.generic.clone.CloneController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) SinglePageController(org.olat.core.commons.modules.singlepage.SinglePageController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) CloneController(org.olat.core.gui.control.generic.clone.CloneController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CloneLayoutControllerCreatorCallback(org.olat.core.gui.control.generic.clone.CloneLayoutControllerCreatorCallback) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) UserRequest(org.olat.core.gui.UserRequest)

Example 13 with DeliveryOptions

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

the class CPRuntimeController method doLayout.

private void doLayout(UserRequest ureq) {
    RepositoryEntry entry = getRepositoryEntry();
    final OLATResource resource = entry.getOlatResource();
    CPPackageConfig cpConfig = cpManager.getCPPackageConfig(resource);
    DeliveryOptions config = cpConfig == null ? null : cpConfig.getDeliveryOptions();
    WindowControl bwControl = getSubWindowControl("Layout");
    final DeliveryOptionsConfigurationController deliveryOptionsCtrl = new DeliveryOptionsConfigurationController(ureq, addToHistory(ureq, bwControl), config, "Knowledge Transfer#_cp_layout");
    deliveryOptionsCtrl.addControllerListener(new ControllerEventListener() {

        @Override
        public void dispatchEvent(UserRequest uureq, Controller source, Event event) {
            if (source == deliveryOptionsCtrl && (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT)) {
                DeliveryOptions newConfig = deliveryOptionsCtrl.getDeliveryOptions();
                CPPackageConfig cConfig = cpManager.getCPPackageConfig(resource);
                if (cConfig == null) {
                    cConfig = new CPPackageConfig();
                }
                cConfig.setDeliveryOptions(newConfig);
                cpManager.setCPPackageConfig(resource, cConfig);
            }
        }
    });
    pushController(ureq, translate("tab.layout"), deliveryOptionsCtrl);
    setActiveTool(deliveryOptionsLink);
}
Also used : ControllerEventListener(org.olat.core.gui.control.ControllerEventListener) OLATResource(org.olat.resource.OLATResource) Event(org.olat.core.gui.control.Event) PopEvent(org.olat.core.gui.components.stack.PopEvent) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) DeliveryOptionsConfigurationController(org.olat.core.gui.control.generic.iframe.DeliveryOptionsConfigurationController) Controller(org.olat.core.gui.control.Controller) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) DeliveryOptionsConfigurationController(org.olat.core.gui.control.generic.iframe.DeliveryOptionsConfigurationController) UserRequest(org.olat.core.gui.UserRequest)

Example 14 with DeliveryOptions

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

the class ImsCPHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    OLATResource res = re.getOlatResource();
    File cpRoot = FileResourceManager.getInstance().unzipFileResource(res);
    final LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
    CPPackageConfig packageConfig = CPManager.getInstance().getCPPackageConfig(res);
    final DeliveryOptions deliveryOptions = (packageConfig == null ? null : packageConfig.getDeliveryOptions());
    return new CPRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            boolean activateFirstPage = true;
            String initialUri = null;
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            CPDisplayController cpCtr = new CPDisplayController(uureq, wwControl, vfsWrapper, true, true, activateFirstPage, true, deliveryOptions, initialUri, entry.getOlatResource(), "", false);
            MainLayout3ColumnsController ctr = new LayoutMain3ColsController(uureq, wwControl, cpCtr.getMenuComponent(), cpCtr.getInitialComponent(), vfsWrapper.getName());
            ctr.addDisposableChildController(cpCtr);
            return ctr;
        }
    });
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) MainLayout3ColumnsController(org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController) CPDisplayController(org.olat.modules.cp.CPDisplayController) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) MainLayout3ColumnsController(org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController) CPContentController(org.olat.ims.cp.ui.CPContentController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CPDisplayController(org.olat.modules.cp.CPDisplayController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) CPRuntimeController(org.olat.ims.cp.ui.CPRuntimeController) CPEditMainController(org.olat.ims.cp.ui.CPEditMainController) Controller(org.olat.core.gui.control.Controller) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) CPRuntimeController(org.olat.ims.cp.ui.CPRuntimeController) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CPPackageConfig(org.olat.ims.cp.ui.CPPackageConfig) File(java.io.File) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) UserRequest(org.olat.core.gui.UserRequest)

Example 15 with DeliveryOptions

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

the class ScormRuntimeController method doLayout.

private void doLayout(UserRequest ureq) {
    RepositoryEntry entry = getRepositoryEntry();
    ScormPackageConfig scormConfig = ScormMainManager.getInstance().getScormPackageConfig(entry.getOlatResource());
    DeliveryOptions config = scormConfig == null ? null : scormConfig.getDeliveryOptions();
    final OLATResource resource = entry.getOlatResource();
    WindowControl bwControl = getSubWindowControl("Layout");
    final DeliveryOptionsConfigurationController deliveryOptionsCtrl = new DeliveryOptionsConfigurationController(ureq, addToHistory(ureq, bwControl), config, "Knowledge Transfer#_scorm_layout");
    deliveryOptionsCtrl.addControllerListener(new ControllerEventListener() {

        @Override
        public void dispatchEvent(UserRequest uureq, Controller source, Event event) {
            if (source == deliveryOptionsCtrl && (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT)) {
                DeliveryOptions newConfig = deliveryOptionsCtrl.getDeliveryOptions();
                ScormPackageConfig sConfig = ScormMainManager.getInstance().getScormPackageConfig(resource);
                if (sConfig == null) {
                    sConfig = new ScormPackageConfig();
                }
                sConfig.setDeliveryOptions(newConfig);
                ScormMainManager.getInstance().setScormPackageConfig(resource, sConfig);
            }
        }
    });
    pushController(ureq, translate("tab.layout"), deliveryOptionsCtrl);
    setActiveTool(deliveryOptionsLink);
}
Also used : ControllerEventListener(org.olat.core.gui.control.ControllerEventListener) OLATResource(org.olat.resource.OLATResource) Event(org.olat.core.gui.control.Event) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) DeliveryOptionsConfigurationController(org.olat.core.gui.control.generic.iframe.DeliveryOptionsConfigurationController) Controller(org.olat.core.gui.control.Controller) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) DeliveryOptionsConfigurationController(org.olat.core.gui.control.generic.iframe.DeliveryOptionsConfigurationController) UserRequest(org.olat.core.gui.UserRequest)

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