Search in sources :

Example 1 with SelectionElement

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);
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) SelectionElement(org.olat.core.gui.components.form.flexible.elements.SelectionElement) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Example 2 with SelectionElement

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;
}
Also used : UserManager(org.olat.user.UserManager) SelectionElement(org.olat.core.gui.components.form.flexible.elements.SelectionElement)

Example 3 with SelectionElement

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;
}
Also used : Translator(org.olat.core.gui.translator.Translator) UserManager(org.olat.user.UserManager) SelectionElement(org.olat.core.gui.components.form.flexible.elements.SelectionElement)

Example 4 with SelectionElement

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;
}
Also used : UserManager(org.olat.user.UserManager) SelectionElement(org.olat.core.gui.components.form.flexible.elements.SelectionElement)

Example 5 with SelectionElement

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;
}
Also used : Translator(org.olat.core.gui.translator.Translator) UserManager(org.olat.user.UserManager) SelectionElement(org.olat.core.gui.components.form.flexible.elements.SelectionElement)

Aggregations

SelectionElement (org.olat.core.gui.components.form.flexible.elements.SelectionElement)6 UserManager (org.olat.user.UserManager)4 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Translator (org.olat.core.gui.translator.Translator)2 ReferencableEntriesSearchController (org.olat.repository.controllers.ReferencableEntriesSearchController)2