use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class MailTemplateAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("mail.template.title");
setFormDescription("mail.template.description");
setFormContextHelp("E-Mail Settings#_template");
String def = mailManager.getMailTemplate();
templateEl = uifactory.addTextAreaElement("mail.template", "mail.template", -1, 25, 50, true, def, formLayout);
final FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
buttonGroupLayout.setRootForm(mainForm);
formLayout.add(buttonGroupLayout);
uifactory.addFormSubmitButton("save", buttonGroupLayout);
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ChooseGroupController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormDescription("select.group.desc");
String[] theKeys = new String[1 + relatedGroups.size()];
theKeys[0] = "all";
String[] theValues = new String[1 + relatedGroups.size()];
theValues[0] = translate("select.group.all");
for (int i = 0; i < relatedGroups.size(); i++) {
theKeys[i + 1] = Integer.toString(i);
theValues[i + 1] = StringHelper.escapeHtml(relatedGroups.get(i).getName());
}
selectGroupEl = uifactory.addDropdownSingleselect("select.group", formLayout, theKeys, theValues, null);
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
formLayout.add(buttonLayout);
buttonLayout.setRootForm(mainForm);
uifactory.addFormSubmitButton("ok", buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class AssessmentModeAdminListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// search form
FormLayoutContainer searchLeftForm = FormLayoutContainer.createDefaultFormLayout("left_1", getTranslator());
searchLeftForm.setRootForm(mainForm);
formLayout.add("left_1", searchLeftForm);
idAndRefsEl = uifactory.addTextElement("mode.id", "assessment.mode.id", 128, null, searchLeftForm);
nameEl = uifactory.addTextElement("mode.name", "assessment.mode.name", 128, null, searchLeftForm);
FormLayoutContainer searchRightForm = FormLayoutContainer.createDefaultFormLayout("right_1", getTranslator());
searchRightForm.setRootForm(mainForm);
formLayout.add("right_1", searchRightForm);
dateEl = uifactory.addDateChooser("assessment.mode.date", null, searchRightForm);
dateEl.setDateChooserTimeEnabled(true);
// search button
FormLayoutContainer searchButtons = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
searchButtons.setRootForm(mainForm);
formLayout.add("button_layout", searchButtons);
searchButton = uifactory.addFormLink("search", searchButtons, Link.BUTTON);
searchButton.setPrimary(true);
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.status.i18nKey(), Cols.status.ordinal(), true, Cols.status.name(), new ModeStatusCellRenderer()));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("select", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.course.i18nKey(), Cols.course.ordinal(), "select", true, Cols.course.name(), renderer));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18nKey(), Cols.externalId.ordinal(), true, Cols.externalId.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalRef.i18nKey(), Cols.externalRef.ordinal(), true, Cols.externalRef.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.name.i18nKey(), Cols.name.ordinal(), true, Cols.name.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.begin.i18nKey(), Cols.begin.ordinal(), true, Cols.begin.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.end.i18nKey(), Cols.end.ordinal(), true, Cols.end.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.leadTime.i18nKey(), Cols.leadTime.ordinal(), true, Cols.leadTime.name(), new TimeCellRenderer(getTranslator())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.followupTime.i18nKey(), Cols.followupTime.ordinal(), true, Cols.followupTime.name(), new TimeCellRenderer(getTranslator())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.target.i18nKey(), Cols.target.ordinal(), true, Cols.target.name(), new TargetAudienceCellRenderer(getTranslator())));
model = new AssessmentModeListModel(columnsModel, getTranslator(), assessmentModeCoordinationService);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setMultiSelect(false);
tableEl.setAndLoadPersistedPreferences(ureq, "assessment-mode-admin");
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class AssessmentModeEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_assessment_mode_edit_form");
setFormContextHelp("Assessment mode");
if (StringHelper.containsNonWhitespace(assessmentMode.getName())) {
setFormTitle("form.mode.title", new String[] { assessmentMode.getName() });
} else {
setFormTitle("form.mode.title.add");
}
setFormDescription("form.mode.description");
ICourse course = CourseFactory.loadCourse(courseOres);
if (StringHelper.containsNonWhitespace(assessmentMode.getStartElement())) {
CourseNode startElement = course.getRunStructure().getNode(assessmentMode.getStartElement());
if (startElement == null) {
setFormWarning("warning.missing.start.element");
}
}
if (StringHelper.containsNonWhitespace(assessmentMode.getElementList())) {
String elements = assessmentMode.getElementList();
for (String element : elements.split(",")) {
CourseNode node = course.getRunStructure().getNode(element);
if (node == null) {
setFormWarning("warning.missing.element");
}
}
}
Status status = assessmentMode.getStatus();
String name = assessmentMode.getName();
nameEl = uifactory.addTextElement("mode.name", "mode.name", 255, name, formLayout);
nameEl.setElementCssClass("o_sel_assessment_mode_name");
nameEl.setMandatory(true);
nameEl.setEnabled(status != Status.followup && status != Status.end);
String desc = assessmentMode.getDescription();
descriptionEl = uifactory.addRichTextElementForStringData("mode.description", "mode.description", desc, 6, -1, false, null, null, formLayout, ureq.getUserSession(), getWindowControl());
descriptionEl.setEnabled(status != Status.followup && status != Status.end);
beginEl = uifactory.addDateChooser("mode.begin", assessmentMode.getBegin(), formLayout);
beginEl.setElementCssClass("o_sel_assessment_mode_begin");
beginEl.setDateChooserTimeEnabled(true);
beginEl.setMandatory(true);
beginEl.setEnabled(status == Status.none || status == Status.leadtime);
int leadTime = assessmentMode.getLeadTime();
if (leadTime < 0) {
leadTime = 0;
}
leadTimeEl = uifactory.addIntegerElement("mode.leadTime", leadTime, formLayout);
leadTimeEl.setElementCssClass("o_sel_assessment_mode_leadtime");
leadTimeEl.setDisplaySize(3);
leadTimeEl.setEnabled(status == Status.none || status == Status.leadtime);
endEl = uifactory.addDateChooser("mode.end", assessmentMode.getEnd(), formLayout);
endEl.setElementCssClass("o_sel_assessment_mode_end");
endEl.setDateChooserTimeEnabled(true);
endEl.setDefaultValue(beginEl);
endEl.setMandatory(true);
endEl.setEnabled(status != Status.end);
int followupTime = assessmentMode.getFollowupTime();
if (followupTime < 0) {
followupTime = 0;
}
followupTimeEl = uifactory.addIntegerElement("mode.followupTime", followupTime, formLayout);
followupTimeEl.setElementCssClass("o_sel_assessment_mode_followuptime");
followupTimeEl.setDisplaySize(3);
followupTimeEl.setEnabled(status != Status.end);
String[] startModeValues = new String[] { translate("mode.beginend.automatic"), translate("mode.beginend.manual") };
startModeEl = uifactory.addDropdownSingleselect("mode.beginend", formLayout, startModeKeys, startModeValues, null);
startModeEl.setElementCssClass("o_sel_assessment_mode_start_mode");
if (assessmentMode.isManualBeginEnd()) {
startModeEl.select(startModeKeys[1], true);
} else {
startModeEl.select(startModeKeys[0], true);
}
startModeEl.setEnabled(status != Status.end);
String[] audienceKeys = new String[] { AssessmentMode.Target.courseAndGroups.name(), AssessmentMode.Target.course.name(), AssessmentMode.Target.groups.name() };
String[] audienceValues = new String[] { translate("target.courseAndGroups"), translate("target.course"), translate("target.groups") };
targetEl = uifactory.addRadiosVertical("audience", "mode.target", formLayout, audienceKeys, audienceValues);
targetEl.setElementCssClass("o_sel_assessment_mode_audience");
targetEl.setEnabled(status != Status.end);
Target target = assessmentMode.getTargetAudience();
if (target != null) {
for (String audienceKey : audienceKeys) {
if (audienceKey.equals(target.name())) {
targetEl.select(audienceKey, true);
}
}
}
if (!targetEl.isOneSelected()) {
targetEl.select(audienceKeys[0], true);
}
// choose groups
String groupPage = velocity_root + "/choose_groups.html";
chooseGroupsCont = FormLayoutContainer.createCustomFormLayout("chooseGroups", getTranslator(), groupPage);
chooseGroupsCont.setRootForm(mainForm);
formLayout.add(chooseGroupsCont);
chooseGroupsButton = uifactory.addFormLink("choose.groups", chooseGroupsCont, Link.BUTTON);
chooseGroupsButton.setEnabled(status != Status.end);
chooseAreasButton = uifactory.addFormLink("choose.areas", chooseGroupsCont, Link.BUTTON);
chooseAreasButton.setEnabled(status != Status.end);
groupKeys = new ArrayList<>();
groupNames = new ArrayList<>();
for (AssessmentModeToGroup modeToGroup : assessmentMode.getGroups()) {
BusinessGroup group = modeToGroup.getBusinessGroup();
groupKeys.add(group.getKey());
groupNames.add(StringHelper.escapeHtml(group.getName()));
}
chooseGroupsCont.getFormItemComponent().contextPut("groupNames", groupNames);
areaKeys = new ArrayList<>();
areaNames = new ArrayList<>();
for (AssessmentModeToArea modeToArea : assessmentMode.getAreas()) {
BGArea area = modeToArea.getArea();
areaKeys.add(area.getKey());
areaNames.add(StringHelper.escapeHtml(area.getName()));
}
chooseGroupsCont.getFormItemComponent().contextPut("areaNames", areaNames);
// course elements
courseElementsRestrictionEl = uifactory.addCheckboxesHorizontal("cer", "mode.course.element.restriction", formLayout, onKeys, onValues);
courseElementsRestrictionEl.addActionListener(FormEvent.ONCHANGE);
courseElementsRestrictionEl.select(onKeys[0], assessmentMode.isRestrictAccessElements());
courseElementsRestrictionEl.setEnabled(status != Status.end);
String coursePage = velocity_root + "/choose_elements.html";
chooseElementsCont = FormLayoutContainer.createCustomFormLayout("chooseElements", getTranslator(), coursePage);
chooseElementsCont.setRootForm(mainForm);
formLayout.add(chooseElementsCont);
chooseElementsCont.setVisible(assessmentMode.isRestrictAccessElements());
CourseEditorTreeModel treeModel = course.getEditorTreeModel();
elementKeys = new ArrayList<>();
elementNames = new ArrayList<>();
String elements = assessmentMode.getElementList();
if (StringHelper.containsNonWhitespace(elements)) {
for (String element : elements.split(",")) {
String courseNodeName = getCourseNodeName(element, treeModel);
if (StringHelper.containsNonWhitespace(courseNodeName)) {
elementKeys.add(element);
elementNames.add(courseNodeName);
}
}
}
chooseElementsCont.getFormItemComponent().contextPut("elementNames", elementNames);
chooseElementsButton = uifactory.addFormLink("choose.elements", chooseElementsCont, Link.BUTTON);
chooseElementsButton.setEnabled(status != Status.end);
startElementKey = assessmentMode.getStartElement();
String startElementName = "";
if (StringHelper.containsNonWhitespace(startElementKey)) {
startElementName = getCourseNodeName(startElementKey, treeModel);
}
startElementEl = uifactory.addStaticTextElement("mode.start.element", "mode.start.element", startElementName, formLayout);
chooseStartElementButton = uifactory.addFormLink("choose.start.element", formLayout, Link.BUTTON);
chooseStartElementButton.setEnabled(status != Status.end);
// ips
ipsEl = uifactory.addCheckboxesHorizontal("ips", "mode.ips", formLayout, onKeys, onValues);
ipsEl.select(onKeys[0], assessmentMode.isRestrictAccessIps());
ipsEl.addActionListener(FormEvent.ONCHANGE);
ipsEl.setEnabled(status != Status.end);
String ipList = assessmentMode.getIpList();
ipListEl = uifactory.addTextAreaElement("mode.ips.list", "mode.ips.list", 4096, 4, 60, false, ipList, formLayout);
ipListEl.setVisible(assessmentMode.isRestrictAccessIps());
ipListEl.setEnabled(status != Status.end);
safeExamBrowserEl = uifactory.addCheckboxesHorizontal("safeexam", "mode.safeexambrowser", formLayout, onKeys, onValues);
safeExamBrowserEl.select(onKeys[0], assessmentMode.isSafeExamBrowser());
safeExamBrowserEl.addActionListener(FormEvent.ONCHANGE);
safeExamBrowserEl.setEnabled(status != Status.end);
String key = assessmentMode.getSafeExamBrowserKey();
safeExamBrowserKeyEl = uifactory.addTextAreaElement("safeexamkey", "mode.safeexambrowser.key", 4096, 6, 60, false, key, formLayout);
safeExamBrowserKeyEl.setVisible(assessmentMode.isSafeExamBrowser());
safeExamBrowserKeyEl.setEnabled(status != Status.end);
String hint = assessmentMode.getSafeExamBrowserHint();
safeExamBrowserHintEl = uifactory.addRichTextElementForStringData("safeexamhint", "mode.safeexambrowser.hint", hint, 10, -1, false, null, null, formLayout, ureq.getUserSession(), getWindowControl());
safeExamBrowserHintEl.setVisible(assessmentMode.isSafeExamBrowser());
safeExamBrowserHintEl.setEnabled(status != Status.end);
forCoachEl = uifactory.addCheckboxesHorizontal("forcoach", "mode.for.coach", formLayout, onKeys, onValues);
forCoachEl.select(onKeys[0], assessmentMode.isApplySettingsForCoach());
forCoachEl.setEnabled(status != Status.end);
FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("button", getTranslator());
formLayout.add(buttonCont);
if (status != Status.end) {
uifactory.addFormSubmitButton("save", buttonCont);
}
uifactory.addFormCancelButton("cancel", buttonCont, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ChooseColumnsStepForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("chooseColumns.title");
setFormDescription("chooseColumns.description");
setFormContextHelp("Using Course Tools#bulkassessment_map");
AssessableCourseNode courseNode = (AssessableCourseNode) getFromRunContext("courseNode");
BulkAssessmentSettings settings = new BulkAssessmentSettings(courseNode);
String[] usernameKeys = new String[numOfColumns];
String[] usernameValues = new String[numOfColumns];
String[] otherKeys = new String[numOfColumns + 1];
String[] otherValues = new String[numOfColumns + 1];
for (int i = 0; i < numOfColumns; i++) {
usernameKeys[i] = "col" + i;
usernameValues[i] = translate("column", Integer.toString(i + 1));
otherKeys[i] = "col" + i;
otherValues[i] = translate("column", Integer.toString(i + 1));
}
otherKeys[otherKeys.length - 1] = "col9999";
otherValues[otherValues.length - 1] = translate("column.dontuse");
FormLayoutContainer choosersCont = FormLayoutContainer.createDefaultFormLayout("choosers", getTranslator());
choosersCont.setElementCssClass("o_sel_bulk_assessment_columns");
choosersCont.setRootForm(mainForm);
formLayout.add(choosersCont);
int pos = 0;
userNameColumnEl = uifactory.addDropdownSingleselect("table.header.identifier", choosersCont, usernameKeys, usernameValues, null);
if (columnsSettings != null && columnsSettings.getUsernameColumn() < usernameKeys.length) {
userNameColumnEl.select(getSelectedKey(pos++, columnsSettings.getUsernameColumn(), usernameKeys), true);
} else if (usernameKeys.length > 0) {
userNameColumnEl.select(usernameKeys[Math.min(pos++, usernameKeys.length - 1)], true);
}
if (settings.isHasScore()) {
scoreColumnEl = uifactory.addDropdownSingleselect("table.header.score", choosersCont, otherKeys, otherValues, null);
if (columnsSettings != null && columnsSettings.getScoreColumn() < otherKeys.length) {
scoreColumnEl.select(getSelectedKey(pos++, columnsSettings.getScoreColumn(), otherKeys), true);
} else if (otherKeys.length > 0) {
scoreColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
}
}
if (settings.isHasPassed() && settings.getCut() == null) {
passedColumnEl = uifactory.addDropdownSingleselect("table.header.passed", choosersCont, otherKeys, otherValues, null);
if (columnsSettings != null && columnsSettings.getPassedColumn() < otherKeys.length) {
passedColumnEl.select(getSelectedKey(pos++, columnsSettings.getPassedColumn(), otherKeys), true);
} else if (otherKeys.length > 0) {
passedColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
}
}
if (settings.isHasUserComment()) {
commentColumnEl = uifactory.addDropdownSingleselect("table.header.comment", choosersCont, otherKeys, otherValues, null);
if (columnsSettings != null && columnsSettings.getCommentColumn() < otherKeys.length) {
commentColumnEl.select(getSelectedKey(pos++, columnsSettings.getCommentColumn(), otherKeys), true);
} else if (otherKeys.length > 0) {
commentColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
}
}
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
for (int i = 0; i < numOfColumns; i++) {
DefaultFlexiColumnModel colModel = new DefaultFlexiColumnModel("ccc" + (i + 1), i);
tableColumnModel.addFlexiColumnModel(colModel);
}
overviewDataModel.setTableColumnModel(tableColumnModel);
FlexiTableElement tableEl = uifactory.addTableElement(getWindowControl(), "overviewList", overviewDataModel, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
}
Aggregations