Search in sources :

Example 26 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class TUCourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid()
 */
public StatusDescription isConfigValid() {
    /*
		 * first check the one click cache
		 */
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    String host = (String) getModuleConfiguration().get(TUConfigForm.CONFIGKEY_HOST);
    boolean isValid = host != null;
    StatusDescription sd = StatusDescription.NOERROR;
    if (!isValid) {
        // FIXME: refine statusdescriptions
        String[] params = new String[] { this.getShortTitle() };
        String translPackage = Util.getPackageName(TUConfigForm.class);
        sd = new StatusDescription(StatusDescription.ERROR, NLS_ERROR_HOSTMISSING_SHORT, NLS_ERROR_HOSTMISSING_LONG, params, translPackage);
        sd.setDescriptionForUnit(getIdent());
        // set which pane is affected by error
        sd.setActivateableViewIdentifier(TUEditController.PANE_TAB_TUCONFIG);
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Example 27 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class WikiCourseNode method isConfigValid.

@Override
public StatusDescription isConfigValid() {
    /*
		 * first check the one click cache
		 */
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    StatusDescription sd = StatusDescription.NOERROR;
    boolean isValid = WikiEditController.isModuleConfigValid(getModuleConfiguration());
    if (!isValid) {
        String shortKey = "error.noreference.short";
        String longKey = "error.noreference.long";
        String[] params = new String[] { this.getShortTitle() };
        String translPackage = Util.getPackageName(WikiEditController.class);
        sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
        sd.setDescriptionForUnit(getIdent());
        // set which pane is affected by error
        sd.setActivateableViewIdentifier(WikiEditController.PANE_TAB_WIKICONFIG);
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Example 28 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class BlogCourseNode method isConfigValid.

@Override
public StatusDescription isConfigValid() {
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    StatusDescription status = StatusDescription.NOERROR;
    boolean invalid = config.get(CONFIG_KEY_REPOSITORY_SOFTKEY) == null;
    if (invalid) {
        String[] params = new String[] { this.getShortTitle() };
        String shortKey = "error.no.reference.short";
        String longKey = "error.no.reference.long";
        String translationPackage = Util.getPackageName(BlogNodeEditController.class);
        status = new StatusDescription(ValidationStatus.ERROR, shortKey, longKey, params, translationPackage);
        status.setDescriptionForUnit(getIdent());
        // Set which pane is affected by error
        status.setActivateableViewIdentifier(FeedNodeEditController.PANE_TAB_FEED);
    }
    return status;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Example 29 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class COCourseNode method isConfigValid.

/**
 * @see org.olat.course.nodes.CourseNode#isConfigValid(org.olat.course.run.userview.UserCourseEnvironment)
 */
public StatusDescription[] isConfigValid(CourseEditorEnv cev) {
    oneClickStatusCache = null;
    // only here we know which translator to take for translating condition
    // error messages
    String translatorStr = Util.getPackageName(ConditionEditController.class);
    List<StatusDescription> condErrs = isConfigValidWithTranslator(cev, translatorStr, getConditionExpressions());
    List<StatusDescription> missingNames = new ArrayList<StatusDescription>();
    /*
         * check group and area names for existence
         */
    String nodeId = getIdent();
    ModuleConfiguration mc = getModuleConfiguration();
    @SuppressWarnings("unchecked") List<Long> areaKeys = (List<Long>) mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA_IDS);
    if (areaKeys != null) {
        BGAreaManager areaManager = CoreSpringFactory.getImpl(BGAreaManager.class);
        List<BGArea> areas = areaManager.loadAreas(areaKeys);
        a_a: for (Long areaKey : areaKeys) {
            for (BGArea area : areas) {
                if (area.getKey().equals(areaKey)) {
                    continue a_a;
                }
            }
            StatusDescription sd = new StatusDescription(StatusDescription.WARNING, "error.notfound.name", "solution.checkgroupmanagement", new String[] { "NONE", areaKey.toString() }, translatorStr);
            sd.setDescriptionForUnit(nodeId);
            missingNames.add(sd);
        }
    } else {
        String areaStr = (String) mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA);
        if (areaStr != null) {
            String[] areas = areaStr.split(",");
            for (int i = 0; i < areas.length; i++) {
                String trimmed = areas[i] != null ? areas[i].trim() : areas[i];
                if (!trimmed.equals("") && !cev.existsArea(trimmed)) {
                    StatusDescription sd = new StatusDescription(StatusDescription.WARNING, "error.notfound.name", "solution.checkgroupmanagement", new String[] { "NONE", trimmed }, translatorStr);
                    sd.setDescriptionForUnit(nodeId);
                    missingNames.add(sd);
                }
            }
        }
    }
    @SuppressWarnings("unchecked") List<Long> groupKeys = (List<Long>) mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP_ID);
    if (groupKeys != null) {
        BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
        List<BusinessGroupShort> groups = bgs.loadShortBusinessGroups(groupKeys);
        a_a: for (Long activeGroupKey : groupKeys) {
            for (BusinessGroupShort group : groups) {
                if (group.getKey().equals(activeGroupKey)) {
                    continue a_a;
                }
            }
            StatusDescription sd = new StatusDescription(StatusDescription.WARNING, "error.notfound.name", "solution.checkgroupmanagement", new String[] { "NONE", activeGroupKey.toString() }, translatorStr);
            sd.setDescriptionForUnit(nodeId);
            missingNames.add(sd);
        }
    } else {
        String groupStr = (String) mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP);
        if (groupStr != null) {
            String[] groups = groupStr.split(",");
            for (int i = 0; i < groups.length; i++) {
                String trimmed = groups[i] != null ? groups[i].trim() : groups[i];
                if (!trimmed.equals("") && !cev.existsGroup(trimmed)) {
                    StatusDescription sd = new StatusDescription(StatusDescription.WARNING, "error.notfound.name", "solution.checkgroupmanagement", new String[] { "NONE", trimmed }, translatorStr);
                    sd.setDescriptionForUnit(nodeId);
                    missingNames.add(sd);
                }
            }
        }
    }
    missingNames.addAll(condErrs);
    oneClickStatusCache = StatusDescriptionHelper.sort(missingNames);
    return oneClickStatusCache;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) ArrayList(java.util.ArrayList) BGArea(org.olat.group.area.BGArea) BusinessGroupService(org.olat.group.BusinessGroupService) StatusDescription(org.olat.course.editor.StatusDescription) ArrayList(java.util.ArrayList) List(java.util.List) BusinessGroupShort(org.olat.group.BusinessGroupShort) BGAreaManager(org.olat.group.area.BGAreaManager)

Example 30 with StatusDescription

use of org.olat.course.editor.StatusDescription in project openolat by klemens.

the class CPCourseNode 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];
    }
    StatusDescription sd = StatusDescription.NOERROR;
    boolean isValid = CPEditController.isModuleConfigValid(getModuleConfiguration());
    if (!isValid) {
        // FIXME: refine statusdescriptions
        String shortKey = "error.noreference.short";
        String longKey = "error.noreference.long";
        String[] params = new String[] { this.getShortTitle() };
        String translPackage = Util.getPackageName(CPEditController.class);
        sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
        sd.setDescriptionForUnit(getIdent());
        // set which pane is affected by error
        sd.setActivateableViewIdentifier(CPEditController.PANE_TAB_CPCONFIG);
    }
    return sd;
}
Also used : StatusDescription(org.olat.course.editor.StatusDescription)

Aggregations

StatusDescription (org.olat.course.editor.StatusDescription)82 ArrayList (java.util.ArrayList)20 ModuleConfiguration (org.olat.modules.ModuleConfiguration)10 List (java.util.List)4 Condition (org.olat.course.condition.Condition)4 PublishProcess (org.olat.course.editor.PublishProcess)4 PublishSetInformations (org.olat.course.editor.PublishSetInformations)4 CourseNode (org.olat.course.nodes.CourseNode)4 CourseEditorTreeModel (org.olat.course.tree.CourseEditorTreeModel)4 BusinessGroupService (org.olat.group.BusinessGroupService)4 ChecklistEditController (de.bps.course.nodes.cl.ChecklistEditController)2 VCEditController (de.bps.course.nodes.vc.VCEditController)2 VCProvider (de.bps.course.nodes.vc.provider.VCProvider)2 Checklist (de.bps.olat.modules.cl.Checklist)2 Checkpoint (de.bps.olat.modules.cl.Checkpoint)2 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 IdentityRef (org.olat.basesecurity.IdentityRef)2 CollaborationTools (org.olat.collaboration.CollaborationTools)2