use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ParticipantLecturesOverviewController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (withPrint && formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
layoutCont.getFormItemComponent().addListener(this);
layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
if (withTitle) {
setFormTitle("menu.my.lectures.alt");
}
} else if (withTitle) {
setFormTitle("lectures.print.title", new String[] { StringHelper.escapeHtml(userManager.getUserDisplayName(assessedIdentity)) });
}
if (withLog) {
logButton = uifactory.addFormLink("log", formLayout, Link.BUTTON);
logButton.setIconLeftCSS("o_icon o_icon_log");
}
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("authorizedAbsenceEnabled", authorizedAbsenceEnabled);
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.externalRef, "details"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.entry, "details"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.plannedLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.attendedLectures));
if (authorizedAbsenceEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.unauthorizedAbsentLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.authorizedAbsentLectures));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.absentLectures));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.progress, new LectureStatisticsCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.rateWarning, new RateWarningCellRenderer(getTranslator())));
DefaultFlexiColumnModel rateColumn = new DefaultFlexiColumnModel(LecturesCols.rate, new PercentCellRenderer());
rateColumn.setFooterCellRenderer(new PercentCellRenderer());
columnsModel.addFlexiColumnModel(rateColumn);
if (withSelect) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("details", translate("details"), "details"));
}
tableModel = new ParticipantLecturesDataModel(columnsModel, getTranslator(), getLocale());
int paging = withPrint ? 20 : -1;
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, paging, false, getTranslator(), formLayout);
tableEl.setAndLoadPersistedPreferences(ureq, "participant-lectures-overview");
tableEl.setCustomizeColumns(false);
tableEl.setEmtpyTableMessageKey("empty.lectures.list");
tableEl.setFooter(true);
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ParticipantListRepositoryController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer && !printView) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
layoutCont.getFormItemComponent().addListener(this);
layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
}
FlexiTableSortOptions options = new FlexiTableSortOptions();
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.username));
options.setDefaultOrderBy(new SortKey(ParticipantsCols.username.sortKey(), true));
}
int colPos = USER_PROPS_OFFSET;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
FlexiColumnModel col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
columnsModel.addFlexiColumnModel(col);
colPos++;
if (!options.hasDefaultOrderBy()) {
options.setDefaultOrderBy(new SortKey(propName, true));
} else if (UserConstants.LASTNAME.equals(propName)) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.plannedLectures));
if (rollCallEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.attendedLectures));
if (authorizedAbsenceEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.unauthorizedAbsenceLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.authorizedAbsenceLectures));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.absentLectures, new LongCellRenderer("o_sel_absences")));
}
FlexiColumnModel progressCol = new DefaultFlexiColumnModel(ParticipantsCols.progress, new LectureStatisticsCellRenderer());
progressCol.setExportable(false);
columnsModel.addFlexiColumnModel(progressCol);
}
if (rateEnabled) {
FlexiColumnModel warningCol = new DefaultFlexiColumnModel(ParticipantsCols.rateWarning, new RateWarningCellRenderer(getTranslator()));
warningCol.setExportable(false);
columnsModel.addFlexiColumnModel(warningCol);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.rate, new PercentCellRenderer()));
}
FlexiColumnModel infoCol = new DefaultFlexiColumnModel(ParticipantsCols.infos, new ParticipantInfosRenderer(getTranslator(), defaultRate));
infoCol.setExportable(false);
columnsModel.addFlexiColumnModel(infoCol);
if (!printView) {
DefaultFlexiColumnModel editColumn = new DefaultFlexiColumnModel("table.header.edit", -1, "edit", new StaticFlexiCellRenderer("", "edit", "o_icon o_icon-lg o_icon_edit", translate("edit"), null));
editColumn.setExportable(false);
editColumn.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(editColumn);
}
tableModel = new ParticipantListDataModel(columnsModel, getTranslator(), getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(!printView);
tableEl.setEmtpyTableMessageKey("empty.table.participant.list");
tableEl.setSortSettings(options);
tableEl.setAndLoadPersistedPreferences(ureq, "participant-list-repo-entry");
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class LectureRepositorySettingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("lecture.course.admin.title");
setFormContextHelp("Lectures and absences");
formLayout.setElementCssClass("o_sel_repo_lecture_settings_form");
if (lectureConfigManaged) {
String flags = entry.getManagedFlagsString() == null ? "" : entry.getManagedFlagsString().trim();
String flagsFormatted = null;
if (flags.length() > 0) {
// use translator from REST admin package to import managed flags context help strings
Translator managedTrans = Util.createPackageTranslator(RestapiAdminController.class, getLocale(), getTranslator());
StringBuilder flagList = new StringBuilder();
flagList.append("<ul>");
for (String flag : flags.split(",")) {
flagList.append("<li>");
flagList.append(managedTrans.translate("managed.flags.course." + flag));
flagList.append("</li>");
}
flagList.append("</ul>");
flagsFormatted = flagList.toString();
} else {
flagsFormatted = flags;
}
setFormWarning("form.managedflags.intro", new String[] { flagsFormatted });
}
String[] onValues = new String[] { translate("on") };
enableEl = uifactory.addCheckboxesHorizontal("lecture.admin.enabled", formLayout, onKeys, onValues);
enableEl.setEnabled(!lectureConfigManaged);
enableEl.setElementCssClass("o_sel_repo_lecture_enable");
enableEl.addActionListener(FormEvent.ONCHANGE);
if (lectureConfig.isLectureEnabled()) {
enableEl.select(onKeys[0], true);
}
String[] overrideValues = new String[] { translate("config.override.yes"), translate("config.override.no") };
overrideEl = uifactory.addRadiosHorizontal("config.override", formLayout, overrideKeys, overrideValues);
overrideEl.setEnabled(!lectureConfigManaged);
overrideEl.setElementCssClass("o_sel_repo_lecture_override");
overrideEl.addActionListener(FormEvent.ONCHANGE);
if (lectureConfig.isOverrideModuleDefault()) {
// yes
overrideEl.select(overrideKeys[0], true);
} else {
// no
overrideEl.select(overrideKeys[1], true);
}
if (!lectureModule.isCanOverrideStandardConfiguration() && !lectureConfig.isOverrideModuleDefault()) {
overrideEl.setEnabled(false);
}
rollCallEnabledEl = uifactory.addCheckboxesHorizontal("config.rollcall.enabled", formLayout, onKeys, onValues);
rollCallEnabledEl.addActionListener(FormEvent.ONCHANGE);
calculateAttendanceRateEl = uifactory.addCheckboxesHorizontal("config.calculate.attendance.rate", formLayout, onKeys, onValues);
attendanceRateEl = uifactory.addTextElement("lecture.attendance.rate.default", "lecture.attendance.rate.default", 4, "", formLayout);
teacherCalendarSyncEl = uifactory.addCheckboxesHorizontal("config.sync.teacher.calendar", formLayout, onKeys, onValues);
courseCalendarSyncEl = uifactory.addCheckboxesHorizontal("config.sync.course.calendar", formLayout, onKeys, onValues);
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
if (!lectureConfigManaged) {
uifactory.addFormSubmitButton("save", buttonsCont);
}
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class SingleParticipantCallController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
int numOfChecks = lectureBlock.getPlannedLecturesNumber();
List<Integer> absences = rollCall.getLecturesAbsentList();
for (int i = 0; i < numOfChecks; i++) {
String checkId = "check_" + i;
MultipleSelectionElement check = uifactory.addCheckboxesHorizontal(checkId, null, layoutCont, onKeys, onValues);
check.setDomReplacementWrapperRequired(false);
check.addActionListener(FormEvent.ONCHANGE);
if (absences.contains(i)) {
check.select(onKeys[0], true);
}
checks.add(check);
}
layoutCont.contextPut("checks", checks);
DisplayPortraitController portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), calledIdentity, true, false);
listenTo(portraitCtr);
layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
UserShortDescription userDescr = new UserShortDescription(ureq, getWindowControl(), calledIdentity);
listenTo(userDescr);
layoutCont.getFormItemComponent().put("userDescr", userDescr.getInitialComponent());
}
if (autorizedAbsenceEnabled) {
authorizedAbsencedEl = uifactory.addCheckboxesHorizontal("authorized.absence", "authorized.absence", formLayout, onKeys, onValues);
authorizedAbsencedEl.setDomReplacementWrapperRequired(false);
authorizedAbsencedEl.addActionListener(FormEvent.ONCHANGE);
if (rollCall.getAbsenceAuthorized() != null && rollCall.getAbsenceAuthorized().booleanValue()) {
authorizedAbsencedEl.select(onKeys[0], true);
}
String reason = rollCall.getAbsenceReason();
absenceReasonEl = uifactory.addTextAreaElement("absence.reason", "authorized.absence.reason", 2000, 4, 36, false, reason, formLayout);
absenceReasonEl.setDomReplacementWrapperRequired(false);
absenceReasonEl.setPlaceholderKey("authorized.absence.reason", null);
absenceReasonEl.setVisible(authorizedAbsencedEl.isAtLeastSelected(1));
absenceReasonEl.setMandatory(!absenceDefaultAuthorized);
}
String comment = rollCall.getComment();
commentEl = uifactory.addTextAreaElement("comment", "rollcall.comment", 2000, 4, 36, false, comment, formLayout);
commentEl.setPlaceholderKey("rollcall.comment", null);
selectAllLink = uifactory.addFormLink("all", formLayout);
uifactory.addFormSubmitButton("save", "save.next", formLayout);
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class TeacherOverviewSearchController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
searchEl = uifactory.addTextElement("search.text", "search.form.string", 128, "", formLayout);
searchEl.setHelpText(translate("search.form.string.hint"));
searchEl.setVisible(withSearchString);
FormLayoutContainer dateLayout = FormLayoutContainer.createHorizontalFormLayout("dateLayout", getTranslator());
formLayout.add(dateLayout);
startEl = uifactory.addDateChooser("start", "search.form.start", null, dateLayout);
endEl = uifactory.addDateChooser("end", "search.form.end", null, dateLayout);
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsCont.setRootForm(mainForm);
formLayout.add(buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
uifactory.addFormSubmitButton("search", buttonsCont);
}
Aggregations