baseDir, null, formLayout, ureq.getUserSession(), getWindowControl());
RichTextConfiguration richTextConfig = content.getEditorConfiguration();
// set upload dir to the media dir
richTextConfig.setFileBrowserUploadRelPath("media");
final FormLayoutContainer dateAndTimeLayout = FormLayoutContainer.createHorizontalFormLayout("feed.publish.date", getTranslator());
formLayout.add(dateAndTimeLayout);
dateAndTimeLayout.setLabel("feed.publish.date", null);
dateAndTimeLayout.setMandatory(true);
publishDateChooser = uifactory.addDateChooser("publishDateChooser", null, null, dateAndTimeLayout);
publishDateChooser.setNotEmptyCheck("feed.publish.date.is.required");
publishDateChooser.setValidDateCheck("feed.publish.date.invalid");
Calendar cal = Calendar.getInstance(ureq.getLocale());
if (post.getPublishDate() != null) {
cal.setTime(post.getPublishDate());
}
publishDateChooser.setDate(cal.getTime());
hours = uifactory.addIntegerElement("hour", null, cal.get(Calendar.HOUR_OF_DAY), dateAndTimeLayout);
hours.setDisplaySize(2);
hours.setMaxLength(2);
String minutesIn2digits = Long.toString(cal.get(Calendar.MINUTE));
if (minutesIn2digits.length() == 1) {
// always show two digits for minutes
minutesIn2digits = '0' + minutesIn2digits;
}
uifactory.addStaticTextElement("timeSeparator", null, ":", dateAndTimeLayout);
// dTextElement("mins", cal.get(Calendar.MINUTE), dateAndTimeLayout);
mins = uifactory.addTextElement("mins", null, 2, minutesIn2digits, dateAndTimeLayout);
mins.setDisplaySize(2);
mins.setRegexMatchCheck("\\d*", "feed.form.minutes.error");
mins.setNotEmptyCheck("feed.form.minutes.error");
uifactory.addStaticTextElement("o.clock", null, translate("feed.publish.time.o.clock"), dateAndTimeLayout);
// Submit and cancel buttons
final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
this.flc.add(buttonLayout);
uifactory.addFormSubmitButton("feed.publish", buttonLayout);
draftLink = uifactory.addFormLink("feed.save.as.draft", buttonLayout, Link.BUTTON);
draftLink.addActionListener(this, FormEvent.ONCLICK);