* org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
SystemRegistrationManager sysRegMgr = SystemRegistrationManager.getInstance();
PersistedProperties registrationConfig = sysRegMgr.getRegistrationConfiguration();
//
// Add statistics
sendAnonymousStatisticSelection = uifactory.addCheckboxesVertical("registration.sendAnonymousStatisticSelection", null, formLayout,
new String[] { YES }, new String[] { "" }, null, 1);
sendAnonymousStatisticSelection.addActionListener(this, FormEvent.ONCLICK);
boolean sendStats = registrationConfig.getBooleanPropertyValue(SystemRegistrationManager.CONF_KEY_SEND_STATISTICS);
sendAnonymousStatisticSelection.select(YES, sendStats);
this.flc.contextPut("isRegisteredStatistics", Boolean.valueOf(sendStats));
//
// Add website
publishWebSiteSelection = uifactory.addCheckboxesVertical("registration.publishWebSiteSelection", null, formLayout,
new String[] { YES }, new String[] { "" }, null, 1);
publishWebSiteSelection.addActionListener(this, FormEvent.ONCLICK);
boolean publishWebsiteCofig = registrationConfig.getBooleanPropertyValue(SystemRegistrationManager.CONF_KEY_PUBLISH_WEBSITE);
publishWebSiteSelection.select(YES, publishWebsiteCofig);
this.flc.contextPut("isRegisteredWeb", Boolean.valueOf(publishWebsiteCofig));
// Disable statistics as long as website is enabled
if (publishWebsiteCofig) {
sendAnonymousStatisticSelection.select(YES, true);
sendAnonymousStatisticSelection.setEnabled(false);
} else {
sendAnonymousStatisticSelection.setEnabled(true);
}
// Add website description
String webSiteDesc = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_WEBSITE_DESCRIPTION, true);
webSiteDescription = uifactory.addTextAreaElement("registration.webSiteDescription", 5, 60, webSiteDesc, formLayout);
webSiteDescription.addActionListener(this, FormEvent.ONCHANGE);
this.flc.contextPut("webSiteURL", Settings.getServerContextPathURI());
RulesFactory.createHideRule(publishWebSiteSelection, null, webSiteDescription, formLayout);
RulesFactory.createShowRule(publishWebSiteSelection, YES, webSiteDescription, formLayout);
// Add location input
String location = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_LOCATION, true);
locationBox = uifactory.addTextElement("registration.location", "registration.location", -1, location, formLayout);
locationBox.setExampleKey("registration.location.example", null);
String locationCSV = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_LOCATION_COORDS, false);
if(locationCSV != null){
this.flc.contextPut("locationCoordinates", locationCSV);
}
//
// Add announce list
addToAnnounceListSelection = uifactory.addCheckboxesVertical("registration.addToAnnounceListSelection", null, formLayout,
new String[] { YES }, new String[] { "" }, null, 1);
addToAnnounceListSelection.addActionListener(this, FormEvent.ONCLICK);
addToAnnounceListSelection.select(YES, registrationConfig.getBooleanPropertyValue(SystemRegistrationManager.CONF_KEY_NOTIFY_RELEASES));
//
// Add email field
String emailValue = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_EMAIL, true);
email = uifactory.addTextElement("registration.email", "registration.email", 60, emailValue, formLayout);
email.addActionListener(this, FormEvent.ONCHANGE);
RulesFactory.createHideRule(addToAnnounceListSelection, null, email, formLayout);
RulesFactory.createShowRule(addToAnnounceListSelection, YES, email, formLayout);
//
// Add summary field
String summaryText = sysRegMgr.getRegistrationPropertiesMessage(registrationConfig.createPropertiesFromPersistedProperties());
summaryText = StringEscapeUtils.escapeHtml(summaryText).toString();
summary = uifactory.addTextAreaElement("registration.summary", null, -1, 5, 60, true, summaryText, formLayout);
summary.setEnabled(false);
//
// Add submit button