use of org.olat.course.editor.StatusDescription in project openolat by klemens.
the class ChecklistCourseNode method isConfigValid.
public StatusDescription isConfigValid() {
if (oneClickStatusCache != null) {
return oneClickStatusCache[0];
}
StatusDescription sd = StatusDescription.NOERROR;
String transPackage = ChecklistEditController.class.getPackage().getName();
// no configuration available hence there is no checklist with checkpoints
if (getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST) == null) {
sd = new StatusDescription(ValidationStatus.ERROR, "config.nocheckpoints.short", "config.nocheckpoints.long", null, transPackage);
sd.setDescriptionForUnit(getIdent());
sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
return sd;
}
Checklist checklist = (Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST);
// checklist without any checkpoints makes no sense
if (!checklist.hasCheckpoints()) {
sd = new StatusDescription(ValidationStatus.ERROR, "config.nocheckpoints.short", "config.nocheckpoints.long", null, transPackage);
sd.setDescriptionForUnit(getIdent());
sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
return sd;
}
// information, if all checkpoints are invisible
boolean allUnvisible = true;
boolean noLearners = false;
if (checklist.hasCheckpoints()) {
List<Checkpoint> checkpoints = ((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST)).getCheckpoints();
for (Checkpoint checkpoint : checkpoints) {
if (!checkpoint.getMode().equals(CheckpointMode.MODE_HIDDEN))
allUnvisible = false;
}
if (allUnvisible) {
Condition cond = getPreConditionVisibility();
if (cond.isEasyModeCoachesAndAdmins())
noLearners = true;
if (!noLearners) {
sd = new StatusDescription(ValidationStatus.WARNING, "config.allhidden.short", "config.allhidden.long", null, transPackage);
sd.setDescriptionForUnit(getIdent());
sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
}
}
}
return sd;
}
use of org.olat.course.editor.StatusDescription in project openolat by klemens.
the class DENCourseNode method isConfigValid.
/**
* @see org.olat.course.nodes.CourseNode#isConfigValid()
*/
@Override
public StatusDescription isConfigValid() {
if (oneClickStatusCache != null) {
return oneClickStatusCache[0];
}
StatusDescription sd = StatusDescription.NOERROR;
if (!DENEditController.isConfigValid(getModuleConfiguration())) {
String transPackage = Util.getPackageName(DENEditController.class);
sd = new StatusDescription(StatusDescription.WARNING, "config.nodates.short", "config.nodates.long", null, transPackage);
sd.setDescriptionForUnit(getIdent());
sd.setActivateableViewIdentifier(DENEditController.PANE_TAB_DENCONFIG);
}
return sd;
}
use of org.olat.course.editor.StatusDescription in project openolat by klemens.
the class ENCourseNode method isConfigValid.
/**
* @see org.olat.course.nodes.CourseNode#isConfigValid()
*/
public StatusDescription isConfigValid() {
/*
* first check the one click cache
*/
if (oneClickStatusCache != null) {
return oneClickStatusCache[0];
}
boolean isValid = ENEditController.isConfigValid(getModuleConfiguration());
StatusDescription sd = StatusDescription.NOERROR;
if (!isValid) {
// FIXME: refine statusdescriptions
String shortKey = "error.nogroupdefined.short";
String longKey = "error.nogroupdefined.long";
String[] params = new String[] { getShortTitle() };
String translPackage = Util.getPackageName(ENEditController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(ENEditController.PANE_TAB_ENCONFIG);
}
return sd;
}
use of org.olat.course.editor.StatusDescription in project openolat by klemens.
the class ENCourseNode method addStatusErrorMissing.
private StatusDescription addStatusErrorMissing(List<String> missingObjects) {
String labelKey = missingObjects.size() == 1 ? "error.notfound.name" : "error.notfound.names";
StringBuilder missing = new StringBuilder();
for (String missingObject : missingObjects) {
if (missing.length() > 0)
missing.append(", ");
missing.append(missingObject);
}
StatusDescription sd = new StatusDescription(StatusDescription.WARNING, labelKey, "solution.checkgroupmanagement", new String[] { "NONE", missing.toString() }, PACKAGE_COND);
sd.setDescriptionForUnit(getIdent());
return sd;
}
use of org.olat.course.editor.StatusDescription in project openolat by klemens.
the class ENCourseNode method isConfigValid.
/**
* @see org.olat.course.nodes.CourseNode#isConfigValid(org.olat.course.run.userview.UserCourseEnvironment)
*/
public StatusDescription[] isConfigValid(CourseEditorEnv cev) {
// this must be nulled before isConfigValid() is called!!
oneClickStatusCache = null;
// only here we know which translator to take for translating condition
// error messages
List<StatusDescription> condErrs = isConfigValidWithTranslator(cev, PACKAGE_COND, getConditionExpressions());
List<StatusDescription> missingNames = new ArrayList<StatusDescription>();
/*
* check group and area names for existence
*/
ModuleConfiguration mc = getModuleConfiguration();
String areaNames = (String) mc.get(CONFIG_AREANAME);
List<Long> areaKeys = mc.getList(ENCourseNode.CONFIG_AREA_IDS, Long.class);
List<String> missingAreas = getMissingAreas(areaKeys, areaNames, cev);
if (missingAreas.size() > 0) {
missingNames.add(addStatusErrorMissing(missingAreas));
}
String groupNames = (String) mc.get(CONFIG_GROUPNAME);
List<Long> groupKeys = mc.getList(ENCourseNode.CONFIG_GROUP_IDS, Long.class);
List<String> missingGroups = getMissingBusinessGroups(groupKeys, groupNames, cev);
if (missingGroups.size() > 0) {
missingNames.add(addStatusErrorMissing(missingGroups));
}
missingNames.addAll(condErrs);
/*
* sort -> Errors > Warnings > Infos and remove NOERRORS, if
* Error/Warning/Info around.
*/
oneClickStatusCache = StatusDescriptionHelper.sort(missingNames);
return oneClickStatusCache;
}
Aggregations