Search in sources :

Example 91 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class MSCourseNode method getMaxScoreConfiguration.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getMaxScoreConfiguration()
 */
@Override
public Float getMaxScoreConfiguration() {
    if (!hasScoreConfigured()) {
        throw new OLATRuntimeException(MSCourseNode.class, "getMaxScore not defined when hasScore set to false", null);
    }
    ModuleConfiguration config = getModuleConfiguration();
    Float max = (Float) config.get(CONFIG_KEY_SCORE_MAX);
    return max;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 92 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class ProjectBrokerCourseNode method updateModuleConfigDefaults.

/**
 * Init config parameter with default values for a new course node.
 */
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        // use defaults for new course building blocks
        // dropbox defaults
        config.set(CONF_DROPBOX_ENABLED, Boolean.TRUE);
        config.set(CONF_DROPBOX_ENABLEMAIL, Boolean.FALSE);
        config.set(CONF_DROPBOX_CONFIRMATION, "");
        // scoring defaults
        config.set(CONF_SCORING_ENABLED, Boolean.FALSE);
        // returnbox defaults
        config.set(CONF_RETURNBOX_ENABLED, Boolean.TRUE);
        // New config parameter version 2
        config.setBooleanEntry(CONF_TASK_PREVIEW, false);
        MSCourseNode.initDefaultConfig(config);
        config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
    } else {
        int version = config.getConfigurationVersion();
        if (version < CURRENT_CONFIG_VERSION) {
            // Loaded config is older than current config version => migrate
            if (version == 1) {
                // migrate V1 => V2 (remove all condition
                this.setConditionDrop(null);
                this.setConditionReturnbox(null);
                version = 2;
            }
            config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
        }
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 93 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

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)

Example 94 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class STCourseNode method getDisplayOption.

/**
 * @see org.olat.course.nodes.GenericCourseNode#getDefaultTitleOption()
 */
@Override
public String getDisplayOption() {
    // if nothing other defined, view content only, when a structure node
    // contains an html-file.
    OLog logger = Tracing.createLoggerFor(this.getClass());
    ModuleConfiguration config = getModuleConfiguration();
    String thisConf = super.getDisplayOption(false);
    if (thisConf == null && config.get(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE).equals(STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE)) {
        if (logger.isDebug()) {
            logger.debug("no displayOption set, use default (content)", thisConf);
        }
        return CourseNode.DISPLAY_OPTS_CONTENT;
    }
    if (logger.isDebug()) {
        logger.debug("there is a config set, use it: " + thisConf);
    }
    return super.getDisplayOption();
}
Also used : OLog(org.olat.core.logging.OLog) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 95 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class STCourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid()
 */
@Override
public StatusDescription isConfigValid() {
    /*
		 * first check the one click cache
		 */
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    ModuleConfiguration config = getModuleConfiguration();
    StatusDescription sd = StatusDescription.NOERROR;
    if (STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE.equals(config.getStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE))) {
        String fileName = (String) config.get(STCourseNodeEditController.CONFIG_KEY_FILE);
        if (fileName == null || !StringHelper.containsNonWhitespace(fileName)) {
            String shortKey = "error.missingfile.short";
            String longKey = "error.missingfile.long";
            String[] params = new String[] { this.getShortTitle() };
            String translPackage = Util.getPackageName(SPEditController.class);
            sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
            sd.setDescriptionForUnit(getIdent());
            // set which pane is affected by error
            sd.setActivateableViewIdentifier(STCourseNodeEditController.PANE_TAB_ST_CONFIG);
        }
    }
    return sd;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) StatusDescription(org.olat.course.editor.StatusDescription)

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