use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ErrorSearchController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormInfo("error.title");
FormLayoutContainer fieldsCont = FormLayoutContainer.createDefaultFormLayout("fields", getTranslator());
formLayout.add(fieldsCont);
formLayout.add("fields", fieldsCont);
Long errCount = Tracing.getErrorCount();
String lastError = "-";
if (errCount > 0) {
String nodeId = StringHelper.containsNonWhitespace(Settings.getNodeInfo()) ? Settings.getNodeInfo() : "N1";
lastError = nodeId + "-E" + errCount;
}
uifactory.addStaticTextElement("error.last", lastError, fieldsCont);
errorNumberEl = uifactory.addTextElement("error.number", "error.number", 32, "", fieldsCont);
dateChooserEl = uifactory.addDateChooser("error.date", "error.date", null, fieldsCont);
FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
fieldsCont.add(buttonCont);
uifactory.addFormSubmitButton("search", "error.retrieve", buttonCont);
if (formLayout instanceof FormLayoutContainer) {
errorCont = createVelocityContainer("error_list");
((FormLayoutContainer) formLayout).put("errors", errorCont);
}
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class InfoMsgForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
msg = uifactory.addRichTextElementForStringData("msg", "infomsg", infomsg, 20, 70, true, staticFolderMgr.getRootContainer(), null, formLayout, ureq.getUserSession(), getWindowControl());
msg.setMaxLength(1024);
RichTextConfiguration richTextConfig = msg.getEditorConfiguration();
// manually enable the source edit button
richTextConfig.enableCode();
// allow script tags...
richTextConfig.setInvalidElements(RichTextConfiguration.INVALID_ELEMENTS_FORM_FULL_VALUE_UNSAVE_WITH_SCRIPT);
richTextConfig.setExtendedValidElements("script[src,type,defer]");
// add style buttons to make alert style available
richTextConfig.setContentCSSFromTheme(getWindowControl().getWindowBackOffice().getWindow().getGuiTheme());
String path = Settings.getServerContextPath() + "/raw/static/";
richTextConfig.setLinkBrowserAbsolutFilePath(path);
FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
formLayout.add(buttonGroupLayout);
uifactory.addFormSubmitButton("submit", "submit", buttonGroupLayout);
uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ImportCalendarByUrlController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormDescription("cal.synchronize.personal.type.url.desc");
int identityLen = ureq.getIdentity().getName().length();
calendarName = uifactory.addTextElement("calname", "cal.import.calname.prompt", 41 - identityLen, "", formLayout);
calendarUrl = uifactory.addTextElement("url", "cal.import.url.prompt", 200, "", formLayout);
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
formLayout.add(buttonLayout);
uifactory.addFormSubmitButton("submit", "cal.form.submitSingle", 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 CalendarEntryForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_cal_entry_form");
setFormTitle("cal.form.title");
setFormContextHelp("Calendar");
chooseCalendar = uifactory.addDropdownSingleselect("cal.form.chooseCalendar", formLayout, calendarKeys, calendarValues, null);
if (choosenWrapper != null) {
chooseCalendar.select(choosenWrapper.getKalendar().getCalendarID(), true);
}
chooseCalendar.setVisible(isNew);
if (event.getManagedFlags() != null && event.getManagedFlags().length > 0) {
chooseCalendar.setEnabled(false);
}
String calName = choosenWrapper == null ? "" : StringHelper.escapeHtml(choosenWrapper.getDisplayName());
calendarName = uifactory.addStaticTextElement("calendarname", "cal.form.calendarname", calName, formLayout);
calendarName.setVisible(!isNew);
boolean fb = readOnly && event.getClassification() == KalendarEvent.CLASS_X_FREEBUSY;
String subject = fb ? translate("cal.form.subject.hidden") : event.getSubject();
if (subject != null && subject.length() > 64) {
subjectEl = uifactory.addTextAreaElement("subject", "cal.form.subject", -1, 3, 40, true, subject, formLayout);
} else {
subjectEl = uifactory.addTextElement("subject", "cal.form.subject", 255, subject, formLayout);
}
subjectEl.setMandatory(true);
subjectEl.setNotEmptyCheck("cal.form.error.mandatory");
subjectEl.setEnabled(!CalendarManagedFlag.isManaged(event, CalendarManagedFlag.subject));
subjectEl.setElementCssClass("o_sel_cal_subject");
String description = event.getDescription();
descriptionEl = uifactory.addTextAreaElement("description", "cal.form.description", -1, 3, 40, true, description, formLayout);
descriptionEl.setEnabled(!CalendarManagedFlag.isManaged(event, CalendarManagedFlag.description));
descriptionEl.setElementCssClass("o_sel_cal_description");
String location = fb ? translate("cal.form.location.hidden") : event.getLocation();
if (location != null && location.length() > 64) {
locationEl = uifactory.addTextAreaElement("location", "cal.form.location", -1, 3, 40, true, location, formLayout);
} else {
locationEl = uifactory.addTextElement("location", "cal.form.location", 255, location, formLayout);
}
locationEl.setEnabled(!CalendarManagedFlag.isManaged(event, CalendarManagedFlag.location));
locationEl.setElementCssClass("o_sel_cal_location");
boolean managedDates = CalendarManagedFlag.isManaged(event, CalendarManagedFlag.dates);
allDayEvent = uifactory.addCheckboxesHorizontal("allday", "cal.form.allday", formLayout, new String[] { "xx" }, new String[] { null });
allDayEvent.select("xx", event.isAllDayEvent());
allDayEvent.addActionListener(FormEvent.ONCHANGE);
allDayEvent.setEnabled(!managedDates);
allDayEvent.setElementCssClass("o_sel_cal_all_day");
begin = uifactory.addDateChooser("begin", "cal.form.begin", null, formLayout);
begin.setDisplaySize(21);
begin.setDateChooserTimeEnabled(!event.isAllDayEvent());
begin.setMandatory(true);
begin.setDate(event.getBegin());
begin.setEnabled(!managedDates);
begin.setElementCssClass("o_sel_cal_begin");
end = uifactory.addDateChooser("end", "cal.form.end", null, formLayout);
end.setDisplaySize(21);
end.setDateChooserTimeEnabled(!event.isAllDayEvent());
end.setMandatory(true);
end.setDate(event.getEnd());
end.setEnabled(!managedDates);
end.setElementCssClass("o_sel_cal_end");
chooseRecurrence = uifactory.addDropdownSingleselect("cal.form.recurrence", formLayout, keysRecurrence, valuesRecurrence, null);
String currentRecur = CalendarUtils.getRecurrence(event.getRecurrenceRule());
boolean rk = currentRecur != null && !currentRecur.equals("");
chooseRecurrence.select(rk ? currentRecur : RECURRENCE_NONE, true);
chooseRecurrence.addActionListener(FormEvent.ONCHANGE);
chooseRecurrence.setEnabled(!managedDates);
chooseRecurrence.setVisible(!StringHelper.containsNonWhitespace(event.getRecurrenceID()));
recurrenceEnd = uifactory.addDateChooser("recurrence", "cal.form.recurrence.end", null, formLayout);
recurrenceEnd.setDisplaySize(21);
recurrenceEnd.setDateChooserTimeEnabled(false);
recurrenceEnd.setMandatory(true);
recurrenceEnd.setElementCssClass("o_sel_cal_until");
Date recurEnd = calendarManager.getRecurrenceEndDate(event.getRecurrenceRule());
if (recurEnd != null) {
recurrenceEnd.setDate(recurEnd);
}
recurrenceEnd.setEnabled(!managedDates);
recurrenceEnd.setVisible(!chooseRecurrence.getSelectedKey().equals(RECURRENCE_NONE));
classification = uifactory.addRadiosVertical("classification", "cal.form.class", formLayout, classKeys, classValues);
classification.setHelpUrlForManualPage("Calendar#_visibility");
// classification.setHelpTextKey("cal.form.class.hover", null);
classification.setEnabled(!CalendarManagedFlag.isManaged(event, CalendarManagedFlag.classification));
switch(event.getClassification()) {
case KalendarEvent.CLASS_PRIVATE:
classification.select("0", true);
break;
case KalendarEvent.CLASS_X_FREEBUSY:
classification.select("1", true);
break;
case KalendarEvent.CLASS_PUBLIC:
classification.select("2", true);
break;
default:
classification.select("0", true);
}
StringBuilder buf = new StringBuilder();
if (event.getCreated() != 0) {
buf.append(StringHelper.formatLocaleDateTime(event.getCreated(), getTranslator().getLocale()));
if (event.getCreatedBy() != null && !event.getCreatedBy().equals("")) {
buf.append(" ");
buf.append(getTranslator().translate("cal.form.created.by"));
buf.append(" ");
buf.append(StringHelper.escapeHtml(event.getCreatedBy()));
}
} else {
buf.append("-");
}
uifactory.addStaticTextElement("cal.form.created.label", buf.toString(), formLayout);
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
formLayout.add(buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
uifactory.addFormSubmitButton(SUBMIT_SINGLE, "cal.form.submitSingle", buttonLayout);
if (readOnly) {
flc.setEnabled(false);
} else if (!isNew) {
deleteEventButton = uifactory.addFormLink("delete", "cal.edit.delete", null, buttonLayout, Link.BUTTON);
deleteEventButton.setElementCssClass("o_sel_cal_delete");
}
}
use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.
the class ImportCalendarFileController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
int identityLen = ureq.getIdentity().getName().length();
calendarName = uifactory.addTextElement("calname", "cal.import.calname.prompt", 41 - identityLen, "", formLayout);
uploadEl = uifactory.addFileElement(getWindowControl(), "upload", "cal.import.form.prompt", formLayout);
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsCont.setRootForm(mainForm);
formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("cal.import.form.submit", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
Aggregations