use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class Card2BrainCourseNode method createNodeRunConstructionResult.
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
updateModuleConfigDefaults(false);
Controller runCtrl;
if (userCourseEnv.isCourseReadOnly()) {
Translator trans = Util.createPackageTranslator(Card2BrainCourseNode.class, ureq.getLocale());
String title = trans.translate("freezenoaccess.title");
String message = trans.translate("freezenoaccess.message");
runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else if (userCourseEnv.getIdentityEnvironment().getRoles().isGuestOnly()) {
Translator trans = Util.createPackageTranslator(Card2BrainCourseNode.class, ureq.getLocale());
String title = trans.translate("guestnoaccess.title");
String message = trans.translate("guestnoaccess.message");
runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else {
runCtrl = new Card2BrainRunController(ureq, wControl, this.getModuleConfiguration());
}
Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runCtrl, this, "o_card2brain_icon");
return new NodeRunConstructionResult(ctrl);
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class ConditionConfigEasyController method addAssessmentSwitch.
private void addAssessmentSwitch(FormItemContainer formLayout) {
assessSubContainer = FormLayoutContainer.createDefaultFormLayout("assessSubContainer", getTranslator());
formLayout.add(assessSubContainer);
Translator translator = getTranslator();
final String[] assessmentSwitchKeys = new String[] { NODEPASSED_VAL_PASSED, NODEPASSED_VAL_SCORE };
final String[] assessmentSwitchValues = new String[] { translator.translate("form.easy.assessmentSwitch.passed"), translator.translate("form.easy.assessmentSwitch.score") };
String nodePassedInitVal = validatedCondition.getEasyModeNodePassedId();
String cutInitStrValue = validatedCondition.getEasyModeCutValue();
int cutInitValue = 0;
assessmentSwitch = uifactory.addCheckboxesHorizontal("assessmentSwitch", null, formLayout, new String[] { "ison" }, new String[] { translate("form.easy.assessmentSwitch") });
assessmentSwitch.addActionListener(FormEvent.ONCLICK);
boolean selectedNodeIsInList = false;
List<String> keysList = new ArrayList<String>();
List<String> valuesList = new ArrayList<String>();
if (nodeIdentList.size() > 0) {
// there are nodes to be selected
keysList.add(NO_NODE_SELECTED_IDENTIFYER);
valuesList.add("- " + translator.translate("form.easy.nodePassed.select") + " -");
for (int i = 0; i < nodeIdentList.size(); i++) {
CourseNode courseNode = nodeIdentList.get(i);
keysList.add(courseNode.getIdent());
valuesList.add(courseNode.getShortName() + " (Id:" + courseNode.getIdent() + ")");
if (courseNode.getIdent().equals(nodePassedInitVal))
selectedNodeIsInList = true;
}
} else {
// no nodes to be selected
keysList.add(NO_NODE_SELECTED_IDENTIFYER);
valuesList.add("- " + translator.translate("form.easy.nodePassed.noNodes"));
// disable switch
assessmentSwitch.setEnabled(false);
}
// add dummy value if needed
if (nodePassedInitVal != null && !selectedNodeIsInList) {
keysList.add(DELETED_NODE_IDENTIFYER);
valuesList.add("- " + translator.translate("form.easy.nodePassed.deletedNode") + " -");
}
final String[] nodePassedKeys = new String[keysList.size()];
keysList.toArray(nodePassedKeys);
final String[] nodePassedValues = new String[valuesList.size()];
valuesList.toArray(nodePassedValues);
nodePassed = uifactory.addDropdownSingleselect("nodePassed", "form.easy.nodePassed", assessSubContainer, nodePassedKeys, nodePassedValues, null);
if (nodePassedInitVal != null) {
if (selectedNodeIsInList) {
nodePassed.select(nodePassedInitVal, true);
} else {
nodePassed.select(DELETED_NODE_IDENTIFYER, true);
}
} else {
nodePassed.select(NO_NODE_SELECTED_IDENTIFYER, true);
}
assessmentTypeSwitch = uifactory.addRadiosVertical("assessmentTypeSwitch", null, assessSubContainer, assessmentSwitchKeys, assessmentSwitchValues);
assessmentTypeSwitch.setLabel("form.easy.assessmentSwitch.type", null);
assessmentTypeSwitch.addActionListener(FormEvent.ONCLICK);
if (nodePassedInitVal != null) {
// has a node configured
if (cutInitStrValue == null) {
// with cut value
assessmentTypeSwitch.select(NODEPASSED_VAL_PASSED, true);
} else {
cutInitValue = Integer.valueOf(cutInitStrValue);
assessmentTypeSwitch.select(NODEPASSED_VAL_SCORE, true);
}
assessmentSwitch.select("ison", true);
assessmentTypeSwitch.setVisible(true);
} else {
assessmentSwitch.select("ison", false);
assessmentTypeSwitch.setVisible(false);
assessmentTypeSwitch.select(NODEPASSED_VAL_PASSED, true);
}
cutValue = uifactory.addIntegerElement("cutval", "form.easy.cutValue", cutInitValue, assessSubContainer);
cutValue.setDisplaySize(3);
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class ConditionEditController method getWrappedDefaultAccessConditionVC.
/**
* Get the condition editor wrapped as a generic accessability condition editor
* @param title The title of this access condition, displayed as header in the surrounding fieldset
* @return The wrapped condition editor component
*/
public VelocityContainer getWrappedDefaultAccessConditionVC(String title) {
Translator accessTranslator = Util.createPackageTranslator(EditorMainController.class, getLocale());
VelocityContainer defaultAccessConditionView = new VelocityContainer("defaultAccessConditionView", VELOCITY_ROOT + "/defaultaccessedit.html", accessTranslator, null);
defaultAccessConditionView.put("defaultAccessConditionView", myContent);
if (passwordConditionEditController != null) {
defaultAccessConditionView.put("pwcond", passwordConditionEditController.getInitialComponent());
defaultAccessConditionView.contextPut("renderPW", true);
}
defaultAccessConditionView.contextPut("title", title);
return defaultAccessConditionView;
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class DialogCourseNodeConfiguration method getLinkText.
@Override
public String getLinkText(Locale locale) {
Translator fallback = Util.createPackageTranslator(CourseNodeConfiguration.class, locale);
Translator translator = Util.createPackageTranslator(this.getClass(), locale, fallback);
return translator.translate("title_" + DialogCourseNode.TYPE);
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class FileUploadNotificationHandler method createTitleInfo.
@Override
public String createTitleInfo(Subscriber subscriber, Locale locale) {
try {
Translator translator = Util.createPackageTranslator(DialogCourseNodeRunController.class, locale);
String displayname = repositoryManager.lookupDisplayNameByOLATResourceableId(subscriber.getPublisher().getResId());
if (displayname == null) {
checkPublisher(subscriber.getPublisher());
}
return translator.translate("notifications.header", new String[] { displayname });
} catch (Exception e) {
log.error("Error while creating assessment notifications for subscriber: " + subscriber.getKey(), e);
checkPublisher(subscriber.getPublisher());
return "-";
}
}
Aggregations