Search in sources :

Example 1 with VCConfiguration

use of de.bps.course.nodes.vc.VCConfiguration in project openolat by klemens.

the class VCCourseNode method handleConfig.

/**
 * To support different virtual classroom implementations it's necessary to
 * check whether the persisted configuration suits to the actual virtual
 * classroom implementation or not. If not a new one will be created and
 * persisted.
 *
 * @param provider
 * @return the persisted configuration or a fresh one
 */
private VCConfiguration handleConfig(final VCProvider provider) {
    getModuleConfiguration().setStringValue(CONF_PROVIDER_ID, provider.getProviderId());
    VCConfiguration config = (VCConfiguration) getModuleConfiguration().get(CONF_VC_CONFIGURATION);
    if (config == null || config.getProviderId() == null || !config.getProviderId().equals(provider.getProviderId())) {
        config = provider.createNewConfiguration();
    }
    getModuleConfiguration().set(CONF_VC_CONFIGURATION, config);
    return config;
}
Also used : VCConfiguration(de.bps.course.nodes.vc.VCConfiguration)

Example 2 with VCConfiguration

use of de.bps.course.nodes.vc.VCConfiguration in project openolat by klemens.

the class VCCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    // check if user is moderator of the virtual classroom
    Roles roles = ureq.getUserSession().getRoles();
    boolean moderator = roles.isOLATAdmin();
    Long key = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    if (!moderator) {
        if (roles.isInstitutionalResourceManager() | roles.isAuthor()) {
            RepositoryManager rm = RepositoryManager.getInstance();
            ICourse course = CourseFactory.loadCourse(key);
            RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            if (re != null) {
                moderator = rm.isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
                if (!moderator) {
                    moderator = rm.isInstitutionalRessourceManagerFor(ureq.getIdentity(), ureq.getUserSession().getRoles(), re);
                }
            }
        }
    }
    // load configuration
    final String providerId = getModuleConfiguration().getStringValue(CONF_PROVIDER_ID);
    VCProvider provider = providerId == null ? VCProviderFactory.createDefaultProvider() : VCProviderFactory.createProvider(providerId);
    VCConfiguration config = handleConfig(provider);
    // create run controller
    Controller runCtr = new VCRunController(ureq, wControl, key + "_" + getIdent(), getShortName(), getLongTitle(), config, provider, moderator, userCourseEnv.isCourseReadOnly());
    Controller controller = TitledWrapperHelper.getWrapper(ureq, wControl, runCtr, this, "o_vc_icon");
    return new NodeRunConstructionResult(controller);
}
Also used : VCRunController(de.bps.course.nodes.vc.VCRunController) Roles(org.olat.core.id.Roles) RepositoryManager(org.olat.repository.RepositoryManager) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) TabbableDefaultController(org.olat.core.gui.control.generic.tabbable.TabbableDefaultController) NoProviderController(de.bps.course.nodes.vc.NoProviderController) VCEditController(de.bps.course.nodes.vc.VCEditController) VCRunController(de.bps.course.nodes.vc.VCRunController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) ConditionEditController(org.olat.course.condition.ConditionEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) VCProvider(de.bps.course.nodes.vc.provider.VCProvider) VCConfiguration(de.bps.course.nodes.vc.VCConfiguration)

Example 3 with VCConfiguration

use of de.bps.course.nodes.vc.VCConfiguration in project OpenOLAT by OpenOLAT.

the class VCCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    // check if user is moderator of the virtual classroom
    Roles roles = ureq.getUserSession().getRoles();
    boolean moderator = roles.isOLATAdmin();
    Long key = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    if (!moderator) {
        if (roles.isInstitutionalResourceManager() | roles.isAuthor()) {
            RepositoryManager rm = RepositoryManager.getInstance();
            ICourse course = CourseFactory.loadCourse(key);
            RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            if (re != null) {
                moderator = rm.isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
                if (!moderator) {
                    moderator = rm.isInstitutionalRessourceManagerFor(ureq.getIdentity(), ureq.getUserSession().getRoles(), re);
                }
            }
        }
    }
    // load configuration
    final String providerId = getModuleConfiguration().getStringValue(CONF_PROVIDER_ID);
    VCProvider provider = providerId == null ? VCProviderFactory.createDefaultProvider() : VCProviderFactory.createProvider(providerId);
    VCConfiguration config = handleConfig(provider);
    // create run controller
    Controller runCtr = new VCRunController(ureq, wControl, key + "_" + getIdent(), getShortName(), getLongTitle(), config, provider, moderator, userCourseEnv.isCourseReadOnly());
    Controller controller = TitledWrapperHelper.getWrapper(ureq, wControl, runCtr, this, "o_vc_icon");
    return new NodeRunConstructionResult(controller);
}
Also used : VCRunController(de.bps.course.nodes.vc.VCRunController) Roles(org.olat.core.id.Roles) RepositoryManager(org.olat.repository.RepositoryManager) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) TabbableDefaultController(org.olat.core.gui.control.generic.tabbable.TabbableDefaultController) NoProviderController(de.bps.course.nodes.vc.NoProviderController) VCEditController(de.bps.course.nodes.vc.VCEditController) VCRunController(de.bps.course.nodes.vc.VCRunController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) ConditionEditController(org.olat.course.condition.ConditionEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) VCProvider(de.bps.course.nodes.vc.provider.VCProvider) VCConfiguration(de.bps.course.nodes.vc.VCConfiguration)

Example 4 with VCConfiguration

use of de.bps.course.nodes.vc.VCConfiguration in project OpenOLAT by OpenOLAT.

the class VCCourseNode method handleConfig.

/**
 * To support different virtual classroom implementations it's necessary to
 * check whether the persisted configuration suits to the actual virtual
 * classroom implementation or not. If not a new one will be created and
 * persisted.
 *
 * @param provider
 * @return the persisted configuration or a fresh one
 */
private VCConfiguration handleConfig(final VCProvider provider) {
    getModuleConfiguration().setStringValue(CONF_PROVIDER_ID, provider.getProviderId());
    VCConfiguration config = (VCConfiguration) getModuleConfiguration().get(CONF_VC_CONFIGURATION);
    if (config == null || config.getProviderId() == null || !config.getProviderId().equals(provider.getProviderId())) {
        config = provider.createNewConfiguration();
    }
    getModuleConfiguration().set(CONF_VC_CONFIGURATION, config);
    return config;
}
Also used : VCConfiguration(de.bps.course.nodes.vc.VCConfiguration)

Example 5 with VCConfiguration

use of de.bps.course.nodes.vc.VCConfiguration in project OpenOLAT by OpenOLAT.

the class VCCourseNode method createEditController.

@Override
public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, ICourse course, UserCourseEnvironment userCourseEnv) {
    updateModuleConfigDefaults(false);
    CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(userCourseEnv.getCourseEditorEnv().getCurrentCourseNodeId());
    // load and check configuration
    String providerId = getModuleConfiguration().getStringValue(CONF_PROVIDER_ID);
    VCProvider provider = providerId == null ? VCProviderFactory.createDefaultProvider() : VCProviderFactory.createProvider(providerId);
    TabbableDefaultController childTabCntrllr;
    if (provider != null) {
        VCConfiguration config = handleConfig(provider);
        // create room if configured to do it immediately
        if (config.isCreateMeetingImmediately()) {
            Long key = course.getResourceableId();
            // here, the config is empty in any case, thus there are no start and end dates
            provider.createClassroom(key + "_" + this.getIdent(), this.getShortName(), this.getLongTitle(), null, null, config);
        }
        // create edit controller
        childTabCntrllr = new VCEditController(ureq, wControl, this, course, userCourseEnv, provider, config);
    } else {
        // empty panel
        childTabCntrllr = new NoProviderController(ureq, wControl);
    }
    NodeEditController nodeEditCtr = new NodeEditController(ureq, wControl, course.getEditorTreeModel(), course, chosenNode, userCourseEnv, childTabCntrllr);
    nodeEditCtr.addControllerListener(childTabCntrllr);
    return nodeEditCtr;
}
Also used : NodeEditController(org.olat.course.editor.NodeEditController) VCEditController(de.bps.course.nodes.vc.VCEditController) CourseNode(org.olat.course.nodes.CourseNode) AbstractAccessableCourseNode(org.olat.course.nodes.AbstractAccessableCourseNode) TabbableDefaultController(org.olat.core.gui.control.generic.tabbable.TabbableDefaultController) VCProvider(de.bps.course.nodes.vc.provider.VCProvider) VCConfiguration(de.bps.course.nodes.vc.VCConfiguration) NoProviderController(de.bps.course.nodes.vc.NoProviderController)

Aggregations

VCConfiguration (de.bps.course.nodes.vc.VCConfiguration)8 VCProvider (de.bps.course.nodes.vc.provider.VCProvider)6 NoProviderController (de.bps.course.nodes.vc.NoProviderController)4 VCEditController (de.bps.course.nodes.vc.VCEditController)4 TabbableDefaultController (org.olat.core.gui.control.generic.tabbable.TabbableDefaultController)4 NodeEditController (org.olat.course.editor.NodeEditController)4 VCRunController (de.bps.course.nodes.vc.VCRunController)2 Controller (org.olat.core.gui.control.Controller)2 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)2 Roles (org.olat.core.id.Roles)2 ICourse (org.olat.course.ICourse)2 ConditionEditController (org.olat.course.condition.ConditionEditController)2 AbstractAccessableCourseNode (org.olat.course.nodes.AbstractAccessableCourseNode)2 CourseNode (org.olat.course.nodes.CourseNode)2 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryManager (org.olat.repository.RepositoryManager)2