use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class BCCourseNodeEditController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest urequest, Controller source, Event event) {
if (source == uploaderCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = uploaderCondContr.getCondition();
bcNode.setPreConditionUploaders(cond);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == downloaderCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = downloaderCondContr.getCondition();
bcNode.setPreConditionDownloaders(cond);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == folderPathChoose) {
if (bcNode.getModuleConfiguration().getStringValue(CONFIG_SUBPATH, "").startsWith("/_sharedfolder")) {
accessabiliryContent.contextPut("uploadable", false);
} else {
accessabiliryContent.contextPut("uploadable", true);
}
fireEvent(urequest, event);
} else if (cmc == source) {
cleanUp();
}
}
use of org.olat.course.condition.Condition in project openolat by klemens.
the class AbstractCourseNodeWebService method createExpertCondition.
protected Condition createExpertCondition(String conditionId, String expertRules) {
Condition cond = new Condition();
cond.setConditionExpression(expertRules);
cond.setExpertMode(true);
cond.setConditionId(conditionId);
return cond;
}
use of org.olat.course.condition.Condition 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.condition.Condition in project openolat by klemens.
the class LLEditController method event.
/**
* {@inheritDoc}
*/
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = accessibilityCondContr.getCondition();
courseNode.setPreConditionAccess(cond);
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == llFormContr) {
moduleConfiguration = llFormContr.getModuleConfiguration();
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
use of org.olat.course.condition.Condition in project openolat by klemens.
the class CalCourseNode method getConditionExpressions.
@Override
public List<ConditionExpression> getConditionExpressions() {
List<ConditionExpression> parentConditions = super.getConditionExpressions();
List<ConditionExpression> conditions = new ArrayList<>();
if (parentConditions != null && parentConditions.size() > 0) {
conditions.addAll(parentConditions);
}
Condition editCondition = getPreConditionEdit();
if (editCondition != null && StringHelper.containsNonWhitespace(editCondition.getConditionExpression())) {
ConditionExpression ce = new ConditionExpression(editCondition.getConditionId());
ce.setExpressionString(editCondition.getConditionExpression());
conditions.add(ce);
}
return conditions;
}
Aggregations