use of org.olat.core.gui.components.form.flexible.elements.SelectionElement in project openolat by klemens.
the class CourseOptionsController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == addGlossaryCommand) {
glossarySearchCtr = new ReferencableEntriesSearchController(getWindowControl(), ureq, GlossaryResource.TYPE_NAME, translate("select"));
listenTo(glossarySearchCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), glossarySearchCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
} else if (source == removeGlossaryCommand) {
doRemoveGlossary();
setSaveButtonDirty();
} else if (source == addFolderCommand) {
if (checkForFolderNodesAdd(ureq)) {
folderSearchCtr = new ReferencableEntriesSearchController(getWindowControl(), ureq, SharedFolderFileResource.TYPE_NAME, translate("select"));
listenTo(folderSearchCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), folderSearchCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
} else if (source == removeFolderCommand) {
if (checkForFolderNodesRemove(ureq)) {
doRemoveSharedFolder();
setSaveButtonDirty();
}
} else if (toolbarEl == source) {
if (!toolbarEl.isSelected(0)) {
showWarning("chkbx.toolbar.off.warning");
}
updateToolbar();
setSaveButtonDirty();
} else if (source instanceof SelectionElement || source == folderReadOnlyEl || source == menuEl) {
setSaveButtonDirty();
} else if (saveButton == source) {
doSave(ureq);
}
}
use of org.olat.core.gui.components.form.flexible.elements.SelectionElement in project openolat by klemens.
the class GenericCheckboxPropertyHandler method addFormItem.
/**
* @see org.olat.user.propertyhandlers.UserPropertyHandler#addFormItem(java.util.Locale, org.olat.core.id.User, java.lang.String, boolean, org.olat.core.gui.components.form.flexible.FormItemContainer)
*/
@Override
public FormItem addFormItem(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser, FormItemContainer formItemContainer) {
SelectionElement sElem = FormUIFactory.getInstance().addCheckboxesHorizontal(getName(), i18nFormElementLabelKey(), formItemContainer, new String[] { getName() }, new String[] { "" });
UserManager um = UserManager.getInstance();
if (um.isUserViewReadOnly(usageIdentifyer, this) && !isAdministrativeUser) {
sElem.setEnabled(false);
}
if (um.isMandatoryUserProperty(usageIdentifyer, this)) {
sElem.setMandatory(true);
}
return sElem;
}
use of org.olat.core.gui.components.form.flexible.elements.SelectionElement in project openolat by klemens.
the class GenericYesNoPropertyHandler method addFormItem.
@Override
public FormItem addFormItem(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser, FormItemContainer formItemContainer) {
SelectionElement sElem = null;
Translator trans = Util.createPackageTranslator(this.getClass(), locale);
sElem = FormUIFactory.getInstance().addRadiosHorizontal(getName(), i18nFormElementLabelKey(), formItemContainer, new String[] { KEY_YES, KEY_NO }, new String[] { trans.translate("yes"), trans.translate("no") });
// pre-select yes/no
String internalValue = getInternalValue(user);
if (isValidValue(user, internalValue, null, null)) {
if (VAL_YES.equals(internalValue))
sElem.select(KEY_YES, true);
if (VAL_NO.equals(internalValue))
sElem.select(KEY_NO, true);
}
UserManager um = UserManager.getInstance();
if (um.isUserViewReadOnly(usageIdentifyer, this) && !isAdministrativeUser) {
sElem.setEnabled(false);
}
if (um.isMandatoryUserProperty(usageIdentifyer, this)) {
sElem.setMandatory(true);
}
return sElem;
}
use of org.olat.core.gui.components.form.flexible.elements.SelectionElement in project OpenOLAT by OpenOLAT.
the class GenericCheckboxPropertyHandler method addFormItem.
/**
* @see org.olat.user.propertyhandlers.UserPropertyHandler#addFormItem(java.util.Locale, org.olat.core.id.User, java.lang.String, boolean, org.olat.core.gui.components.form.flexible.FormItemContainer)
*/
@Override
public FormItem addFormItem(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser, FormItemContainer formItemContainer) {
SelectionElement sElem = FormUIFactory.getInstance().addCheckboxesHorizontal(getName(), i18nFormElementLabelKey(), formItemContainer, new String[] { getName() }, new String[] { "" });
UserManager um = UserManager.getInstance();
if (um.isUserViewReadOnly(usageIdentifyer, this) && !isAdministrativeUser) {
sElem.setEnabled(false);
}
if (um.isMandatoryUserProperty(usageIdentifyer, this)) {
sElem.setMandatory(true);
}
return sElem;
}
use of org.olat.core.gui.components.form.flexible.elements.SelectionElement in project OpenOLAT by OpenOLAT.
the class GenericYesNoPropertyHandler method addFormItem.
@Override
public FormItem addFormItem(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser, FormItemContainer formItemContainer) {
SelectionElement sElem = null;
Translator trans = Util.createPackageTranslator(this.getClass(), locale);
sElem = FormUIFactory.getInstance().addRadiosHorizontal(getName(), i18nFormElementLabelKey(), formItemContainer, new String[] { KEY_YES, KEY_NO }, new String[] { trans.translate("yes"), trans.translate("no") });
// pre-select yes/no
String internalValue = getInternalValue(user);
if (isValidValue(user, internalValue, null, null)) {
if (VAL_YES.equals(internalValue))
sElem.select(KEY_YES, true);
if (VAL_NO.equals(internalValue))
sElem.select(KEY_NO, true);
}
UserManager um = UserManager.getInstance();
if (um.isUserViewReadOnly(usageIdentifyer, this) && !isAdministrativeUser) {
sElem.setEnabled(false);
}
if (um.isMandatoryUserProperty(usageIdentifyer, this)) {
sElem.setMandatory(true);
}
return sElem;
}
Aggregations