Search in sources :

Example 61 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class ForumNodeForumCallback 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
 */
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        ForumModule forumModule = CoreSpringFactory.getImpl(ForumModule.class);
        boolean pseudonymAllowed = forumModule.isAnonymousPostingWithPseudonymEnabled() && forumModule.isPseudonymForCourseEnabledByDefault();
        config.setStringValue(FOCourseNodeEditController.PSEUDONYM_POST_ALLOWED, pseudonymAllowed ? "true" : "false");
        boolean pseudonymDefault = pseudonymAllowed && forumModule.isPseudonymForMessageEnabledByDefault();
        config.setStringValue(FOCourseNodeEditController.PSEUDONYM_POST_DEFAULT, pseudonymDefault ? "true" : "false");
        config.setStringValue(FOCourseNodeEditController.GUEST_POST_ALLOWED, "false");
    }
    if (isNewNode || config.getConfigurationVersion() < 2) {
        // use defaults for new course building blocks
        config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.FALSE.booleanValue());
        config.setConfigurationVersion(2);
    }
    if (config.getConfigurationVersion() < 3) {
        if (config.getStringValue(FOCourseNodeEditController.PSEUDONYM_POST_ALLOWED) == null) {
            config.setStringValue(FOCourseNodeEditController.PSEUDONYM_POST_ALLOWED, "false");
        }
        if (config.getStringValue(FOCourseNodeEditController.GUEST_POST_ALLOWED) == null) {
            config.setStringValue(FOCourseNodeEditController.GUEST_POST_ALLOWED, "false");
        }
        config.setConfigurationVersion(3);
    }
    // else node is up-to-date - nothing to do
    config.remove(NodeEditController.CONFIG_INTEGRATION);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) ForumModule(org.olat.modules.fo.ForumModule)

Example 62 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class IQSELFCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller runController;
    ModuleConfiguration config = getModuleConfiguration();
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
    if (onyx) {
        Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
        runController = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
    } else {
        RepositoryEntry testEntry = getReferencedRepositoryEntry();
        if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
            runController = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
        } else {
            IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
            runController = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this);
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runController, this, "o_iqself_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) AssessmentManager(org.olat.course.assessment.AssessmentManager) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 63 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class IQTESTCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to start tests
    Roles roles = ureq.getUserSession().getRoles();
    Translator trans = Util.createPackageTranslator(IQTESTCourseNode.class, ureq.getLocale());
    if (roles.isGuestOnly()) {
        if (isGuestAllowedForQTI21(getReferencedRepositoryEntry())) {
            controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
        } else {
            String title = trans.translate("guestnoaccess.title");
            String message = trans.translate("guestnoaccess.message");
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
        }
    } else {
        ModuleConfiguration config = getModuleConfiguration();
        boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
        if (onyx) {
            Translator transe = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", transe.translate("error.onyx"));
        } else {
            RepositoryEntry testEntry = getReferencedRepositoryEntry();
            OLATResource ores = testEntry.getOlatResource();
            if (ImsQTI21Resource.TYPE_NAME.equals(ores.getResourceableTypeName())) {
                // QTI 2.1
                controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
            } else {
                // QTI 1.2
                TestFileResource fr = new TestFileResource();
                fr.overrideResourceableId(ores.getResourceableId());
                if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
                    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                    IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
                    controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this, testEntry);
                } else {
                    String title = trans.translate("editor.lock.title");
                    String message = trans.translate("editor.lock.message");
                    controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
                }
            }
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqtest_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) AssessmentManager(org.olat.course.assessment.AssessmentManager) OLATResource(org.olat.resource.OLATResource) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQIdentityListCourseNodeController(org.olat.course.nodes.iq.IQIdentityListCourseNodeController) IQRunController(org.olat.course.nodes.iq.IQRunController) QTI21AssessmentDetailsController(org.olat.ims.qti21.ui.QTI21AssessmentDetailsController) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) QTI12ResultDetailsController(org.olat.ims.qti.QTI12ResultDetailsController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) Controller(org.olat.core.gui.control.Controller) TestFileResource(org.olat.ims.qti.fileresource.TestFileResource) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) Translator(org.olat.core.gui.translator.Translator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Example 64 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class IQTESTCourseNode method createPreviewController.

/**
 * @see org.olat.course.nodes.CourseNode#createPreviewController(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public Controller createPreviewController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
    Controller controller;
    ModuleConfiguration config = getModuleConfiguration();
    boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
    if (onyx) {
        Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
    } else {
        controller = new IQPreviewController(ureq, wControl, userCourseEnv, this);
    }
    return controller;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) Translator(org.olat.core.gui.translator.Translator) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQIdentityListCourseNodeController(org.olat.course.nodes.iq.IQIdentityListCourseNodeController) IQRunController(org.olat.course.nodes.iq.IQRunController) QTI21AssessmentDetailsController(org.olat.ims.qti21.ui.QTI21AssessmentDetailsController) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) QTI12ResultDetailsController(org.olat.ims.qti.QTI12ResultDetailsController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) Controller(org.olat.core.gui.control.Controller)

Example 65 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class EditDueDatesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    ModuleConfiguration config = gtaNode.getModuleConfiguration();
    Date assignmentDueDate = task.getAssignmentDueDate();
    assignmentDueDateEl = uifactory.addDateChooser("assignment.duedate", assignmentDueDate, formLayout);
    assignmentDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardAssignmentDueDate = gtaManager.getAssignmentDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
    setDueDateExplanation(assignmentDueDateEl, standardAssignmentDueDate);
    assignmentDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT));
    Date submissionDueDate = task.getSubmissionDueDate();
    submissionDueDateEl = uifactory.addDateChooser("submission.duedate", submissionDueDate, formLayout);
    submissionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSubmissionDueDate = gtaManager.getSubmissionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
    setDueDateExplanation(submissionDueDateEl, standardSubmissionDueDate);
    boolean submissionDeadline = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    submissionDueDateEl.setVisible(submissionDeadline);
    if (submissionDeadline && task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal()) {
        StaticTextElement warningReopenEl = uifactory.addStaticTextElement("reopen", translate("warning.reopen"), formLayout);
        warningReopenEl.setElementCssClass("o_gta_reopen_warning");
        warningReopenEl.setLabel(null, null);
    }
    Date revisionsDueDate = task.getRevisionsDueDate();
    revisionDueDateEl = uifactory.addDateChooser("revisions.duedate", revisionsDueDate, formLayout);
    revisionDueDateEl.setDateChooserTimeEnabled(true);
    revisionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD));
    Date solutionDueDate = task.getSolutionDueDate();
    solutionDueDateEl = uifactory.addDateChooser("solution.duedate", solutionDueDate, formLayout);
    solutionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSolutionDueDate = gtaManager.getSolutionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, true);
    setDueDateExplanation(solutionDueDateEl, standardSolutionDueDate);
    solutionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION));
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate)

Aggregations

ModuleConfiguration (org.olat.modules.ModuleConfiguration)296 ArrayList (java.util.ArrayList)34 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)28 ICourse (org.olat.course.ICourse)26 CourseNode (org.olat.course.nodes.CourseNode)26 Date (java.util.Date)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 File (java.io.File)20 CheckboxList (org.olat.course.nodes.cl.model.CheckboxList)18 List (java.util.List)16 Identity (org.olat.core.id.Identity)16 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)16 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)16 Translator (org.olat.core.gui.translator.Translator)14 AssessmentManager (org.olat.course.assessment.AssessmentManager)14 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)14 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)14 VFSItem (org.olat.core.util.vfs.VFSItem)12 BusinessGroup (org.olat.group.BusinessGroup)12 Checkbox (org.olat.course.nodes.cl.model.Checkbox)11