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);
}
if (hasScoring.booleanValue() || hasDropbox.booleanValue() || hasSolution.booleanValue() || hasReturnbox.booleanValue()) {
// check if any group exit for this course
if ((groupMgr != null) && (groupMgr.getAllLearningGroupsFromAllContexts().size() == 0)) {
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(TaskFormController.class);
sd = new StatusDescription(StatusDescription.WARNING, NLS_ERROR_MISSING_GROUP_SHORT, NLS_ERROR_MISSING_GROUP_LONG, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(TACourseNodeEditController.PANE_TAB_ACCESSIBILITY);
} else if (hasDropbox.booleanValue() && ( conditionDrop.getEasyModeGroupAccess() == null || conditionDrop.getEasyModeGroupAccess().equals("") )
&& ( conditionDrop.getEasyModeGroupAreaAccess() == null || conditionDrop.getEasyModeGroupAreaAccess().equals("") )) {
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(TaskFormController.class);
sd = new StatusDescription(StatusDescription.WARNING, NLS_DROPBOX_ERROR_MISSING_GROUP_SHORT, NLS_DROPBOX_ERROR_MISSING_GROUP_LONG, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(TACourseNodeEditController.PANE_TAB_ACCESSIBILITY);
} else if (hasReturnbox.booleanValue() && ( conditionReturnbox.getEasyModeGroupAccess() == null || conditionReturnbox.getEasyModeGroupAccess().equals("") )
&& ( conditionReturnbox.getEasyModeGroupAreaAccess() == null || conditionReturnbox.getEasyModeGroupAreaAccess().equals("") )) {
//show NLS_RETURNBOX_ERROR_MISSING_GROUP error only if the dropCondition is also null, else use same group as for the dropbox
if( conditionDrop.getEasyModeGroupAccess() == null /*|| conditionDrop.getEasyModeGroupAccess().equals("")*/ ) {
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(TaskFormController.class);
sd = new StatusDescription(StatusDescription.WARNING, NLS_RETURNBOX_ERROR_MISSING_GROUP_SHORT, NLS_RETURNBOX_ERROR_MISSING_GROUP_LONG, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(TACourseNodeEditController.PANE_TAB_ACCESSIBILITY);
}
} else if (hasScoring.booleanValue() && ( conditionScoring.getEasyModeGroupAccess() == null || conditionScoring.getEasyModeGroupAccess().equals("") )
&& ( conditionScoring.getEasyModeGroupAreaAccess() == null || conditionScoring.getEasyModeGroupAreaAccess().equals("") )) {
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(TaskFormController.class);
sd = new StatusDescription(StatusDescription.WARNING, NLS_SCORING_ERROR_MISSING_GROUP_SHORT, NLS_SCORING_ERROR_MISSING_GROUP_LONG, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(TACourseNodeEditController.PANE_TAB_ACCESSIBILITY);
} else if (hasSolution.booleanValue() && ( conditionSolution.getEasyModeGroupAccess() == null || conditionSolution.getEasyModeGroupAccess().equals("") )
&& ( conditionSolution.getEasyModeGroupAreaAccess() == null || conditionSolution.getEasyModeGroupAreaAccess().equals("") )) {
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(TaskFormController.class);
sd = new StatusDescription(StatusDescription.WARNING, NLS_SOLUTION_ERROR_MISSING_GROUP_SHORT, NLS_SOLUTION_ERROR_MISSING_GROUP_LONG, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(TACourseNodeEditController.PANE_TAB_ACCESSIBILITY);
}
}
return sd;
}