use of org.olat.course.editor.StatusDescription in project OpenOLAT by OpenOLAT.
the class TACourseNode 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];
}
boolean isValid = true;
Boolean hasScoring = (Boolean) getModuleConfiguration().get(CONF_SCORING_ENABLED);
if (hasScoring.booleanValue()) {
if (!MSEditFormController.isConfigValid(getModuleConfiguration()))
isValid = false;
}
StatusDescription sd = StatusDescription.NOERROR;
if (!isValid) {
// FIXME: refine statusdescriptions by moving the statusdescription
String shortKey = NLS_ERROR_MISSINGSCORECONFIG_SHORT;
String longKey = NLS_ERROR_MISSINGSCORECONFIG_SHORT;
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(MSEditFormController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(TACourseNodeEditController.PANE_TAB_CONF_SCORING);
}
// Check if any group exist make sense only with dropbox, scoring or solution
Boolean hasDropbox = (Boolean) getModuleConfiguration().get(CONF_DROPBOX_ENABLED);
if (hasDropbox == null) {
hasDropbox = new Boolean(false);
}
Boolean hasReturnbox = (Boolean) getModuleConfiguration().get(CONF_RETURNBOX_ENABLED);
if (hasReturnbox == null) {
hasReturnbox = hasDropbox;
}
Boolean hasSolution = (Boolean) getModuleConfiguration().get(CONF_SOLUTION_ENABLED);
if (hasSolution == null) {
hasSolution = new Boolean(false);
}
// remove the error handling for missing groups as you can use the course members
return sd;
}
use of org.olat.course.editor.StatusDescription in project OpenOLAT by OpenOLAT.
the class BasicLTICourseNode 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];
}
String host = (String) getModuleConfiguration().get(LTIConfigForm.CONFIGKEY_HOST);
boolean isValid = host != null;
StatusDescription sd = StatusDescription.NOERROR;
if (!isValid) {
// FIXME: refine statusdescriptions
String[] params = new String[] { this.getShortTitle() };
sd = new StatusDescription(StatusDescription.ERROR, NLS_ERROR_HOSTMISSING_SHORT, NLS_ERROR_HOSTMISSING_LONG, params, translatorPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(LTIEditController.PANE_TAB_LTCONFIG);
}
return sd;
}
use of org.olat.course.editor.StatusDescription in project OpenOLAT by OpenOLAT.
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;
}
use of org.olat.course.editor.StatusDescription in project OpenOLAT by OpenOLAT.
the class COCourseNode method isConfigValid.
/**
* @see org.olat.course.nodes.CourseNode#isConfigValid()
*/
@Override
public StatusDescription isConfigValid() {
updateModuleConfigDefaults(false);
/*
* first check the one click cache
*/
if (oneClickStatusCache != null) {
return oneClickStatusCache[0];
}
/**
* configuration is valid if the provided e-mail container result in at list
* one recipient e-mail adress. Hence we have always to perform the very
* expensive operation to fetch the e-mail adresses for tutors,
* participants, group and area members. simple config here!
*/
@SuppressWarnings("unchecked") List<String> emailList = (List<String>) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOADRESSES);
boolean isValid = (emailList != null && emailList.size() > 0);
Boolean email2owners = getModuleConfiguration().getBooleanEntry(COEditController.CONFIG_KEY_EMAILTOOWNERS);
isValid = isValid || (email2owners != null && email2owners.booleanValue());
String email2AreaCoaches = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA);
isValid = isValid || (StringHelper.containsNonWhitespace(email2AreaCoaches));
String email2GroupCoaches = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP);
isValid = isValid || (StringHelper.containsNonWhitespace(email2GroupCoaches));
isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOCOACHES_ALL, false);
isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOCOACHES_COURSE, false);
String email2AreaParticipants = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA);
isValid = isValid || (StringHelper.containsNonWhitespace(email2AreaParticipants));
String email2GroupParticipants = (String) getModuleConfiguration().get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP);
isValid = isValid || (StringHelper.containsNonWhitespace(email2GroupParticipants));
isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_ALL, false);
isValid = isValid || getModuleConfiguration().getBooleanSafe(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_COURSE, false);
StatusDescription sd = StatusDescription.NOERROR;
if (!isValid) {
String shortKey = "error.norecipients.short";
String longKey = "error.norecipients.long";
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(COEditController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(COEditController.PANE_TAB_COCONFIG);
}
return sd;
}
use of org.olat.course.editor.StatusDescription in project OpenOLAT by OpenOLAT.
the class CourseEditorTreeNode method getIconDecorator1CssClass.
@Override
public String getIconDecorator1CssClass() {
StatusDescription sd = cn.isConfigValid();
String cssClass = null;
if (deleted) {
cssClass = "o_middel";
} else if (sd.isError()) {
cssClass = "o_miderr";
} else if (!sd.isError() && dirty) {
cssClass = "o_midpub";
}
return cssClass;
}
Aggregations