Search in sources :

Example 41 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class AccessConfigurationController method addConfiguration.

protected void addConfiguration(OfferAccess link) {
    AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
    AccessInfo infos = new AccessInfo(handler.getMethodName(getLocale()), handler.isPaymentMethod(), null, link);
    confControllers.add(infos);
    if (editable) {
        FormLink editLink = uifactory.addFormLink("edit_" + link.getKey(), "edit", "edit", null, confControllerContainer, Link.BUTTON_SMALL);
        editLink.setUserObject(infos);
        editLink.setIconLeftCSS("o_icon o_icon-fw o_icon_edit");
        confControllerContainer.add(editLink.getName(), editLink);
        FormLink delLink = uifactory.addFormLink("del_" + link.getKey(), "delete", "delete", null, confControllerContainer, Link.BUTTON_SMALL);
        delLink.setUserObject(infos);
        delLink.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
        confControllerContainer.add(delLink.getName(), delLink);
    }
    updateConfirmationEmail();
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 42 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class AccessConfigurationController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (addMethods.contains(source)) {
        AccessMethod method = (AccessMethod) source.getUserObject();
        addMethod(ureq, method);
    } else if (source instanceof FormLink) {
        FormLink button = (FormLink) source;
        String cmd = button.getCmd();
        if ("delete".equals(cmd)) {
            AccessInfo infos = (AccessInfo) source.getUserObject();
            removeMethod(infos);
            fireEvent(ureq, Event.CHANGED_EVENT);
        } else if ("edit".equals(cmd)) {
            AccessInfo infos = (AccessInfo) source.getUserObject();
            editMethod(ureq, infos);
        }
    } else if (confirmationEmailEl == source) {
        setConfirmationEmail(confirmationEmailEl.isAtLeastSelected(1));
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : AccessMethod(org.olat.resource.accesscontrol.model.AccessMethod) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 43 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class AccessConfigurationController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // contextHelptexts for Label
    HelpTooltip acMethodsLabelHelp = new HelpTooltip("acMethodsLabelHelp", "Legen Sie fest unter welchen Bedingungen Benutzer diese Ressource buchen können.", "Course Settings#_buchungsmethode", getLocale());
    ((FormLayoutContainer) formLayout).put("acMethodsLabelHelp", acMethodsLabelHelp);
    if (editable) {
        List<AccessMethod> methods = acService.getAvailableMethods(getIdentity(), ureq.getUserSession().getRoles());
        for (AccessMethod method : methods) {
            AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType());
            if (handler.isPaymentMethod() && !allowPaymentMethod) {
                continue;
            }
            String title = handler.getMethodName(getLocale());
            FormLink add = uifactory.addFormLink("create." + handler.getType(), title, null, formLayout, Link.LINK | Link.NONTRANSLATED);
            add.setUserObject(method);
            add.setIconLeftCSS(("o_icon " + method.getMethodCssClass() + "_icon o_icon-lg").intern());
            addMethods.add(add);
            formLayout.add(add.getName(), add);
        }
        ((FormLayoutContainer) formLayout).contextPut("methods", addMethods);
    }
    String[] onValues = new String[] { "" };
    confirmationEmailEl = uifactory.addCheckboxesHorizontal("confirmation.email", formLayout, onKeys, onValues);
    confirmationEmailEl.addActionListener(FormEvent.ONCHANGE);
    confirmationEmailEl.setVisible(false);
    String confPage = velocity_root + "/configuration_list.html";
    confControllerContainer = FormLayoutContainer.createCustomFormLayout("conf-controllers", getTranslator(), confPage);
    confControllerContainer.setRootForm(mainForm);
    formLayout.add(confControllerContainer);
    loadConfigurations();
    confControllerContainer.contextPut("confControllers", confControllers);
    boolean confirmationEmail = false;
    for (AccessInfo info : confControllers) {
        Offer offer = info.getLink().getOffer();
        confirmationEmail |= offer.isConfirmationEmail();
    }
    if (confirmationEmail) {
        confirmationEmailEl.select(onKeys[0], true);
    }
    if (!embbed) {
        setFormTitle("accesscontrol.title");
        if (editable) {
            final FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
            buttonGroupLayout.setRootForm(mainForm);
            formLayout.add(buttonGroupLayout);
            formLayout.add("buttonLayout", buttonGroupLayout);
            uifactory.addFormSubmitButton("save", buttonGroupLayout);
        }
    }
    confControllerContainer.contextPut("emptyConfigGrantsFullAccess", Boolean.valueOf(emptyConfigGrantsFullAccess));
}
Also used : HelpTooltip(org.olat.core.gui.components.helpTooltip.HelpTooltip) AccessMethod(org.olat.resource.accesscontrol.model.AccessMethod) Offer(org.olat.resource.accesscontrol.Offer) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AccessMethodHandler(org.olat.resource.accesscontrol.method.AccessMethodHandler)

Example 44 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class PortfolioResultDetailsController method popupDeadlineBox.

/**
 * @param ureq
 */
private void popupDeadlineBox(UserRequest ureq, EPStructuredMap map) {
    String title = translate("map.deadline.change");
    removeAsListenerAndDispose(deadlineCtr);
    deadlineCtr = new DeadlineController(ureq, getWindowControl(), map);
    listenTo(deadlineCtr);
    removeAsListenerAndDispose(deadlineCalloutCtr);
    FormLink changeDeadlineLink = mapToElements.get(map).changeDeadlineLink;
    deadlineCalloutCtr = new CloseableCalloutWindowController(ureq, getWindowControl(), deadlineCtr.getInitialComponent(), changeDeadlineLink, title, true, "o_ep_deadline_callout");
    listenTo(deadlineCalloutCtr);
    deadlineCalloutCtr.activate();
}
Also used : CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 45 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class CustomfieldsFormController method formInnerEvent.

protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if (link.getName().equals(ADD_FIELD_LINK)) {
            if (customFields.size() < MAX_NBR_CUSTOM_FIELDS) {
                // Add new custom-field
                int indexNewCustomField = customFields.size();
                customFields.add(new CustomField("", "", false));
                // first remove existing submit button, add it again at the end
                flc.remove(formSubmit);
                createFormElemente(this.flc, indexNewCustomField, customFields.get(indexNewCustomField));
                formSubmit = uifactory.addFormSubmitButton("save", this.flc);
            } else {
                this.showInfo("info.max.nbr.custom.fields");
            }
        } else {
            int deleteElementNumber = ((Integer) link.getUserObject()).intValue();
            getLogger().debug("remove customfield #=" + deleteElementNumber);
            customFields.remove(deleteElementNumber);
            initFormElements(flc);
        }
    }
    this.flc.setDirty(true);
}
Also used : CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Aggregations

FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)376 ArrayList (java.util.ArrayList)108 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)64 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)40 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)36 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)34 List (java.util.List)30 FormItem (org.olat.core.gui.components.form.flexible.FormItem)28 HashMap (java.util.HashMap)26 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)24 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)22 Date (java.util.Date)18 Map (java.util.Map)18 Link (org.olat.core.gui.components.link.Link)18 Identity (org.olat.core.id.Identity)18 Component (org.olat.core.gui.components.Component)16 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)16 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)16 Controller (org.olat.core.gui.control.Controller)16 Event (org.olat.core.gui.control.Event)16