Search in sources :

Example 66 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class EditParticipantSummaryController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_lecture_participant_summary_form");
    long rate = Math.round(defaultRate * 100.0d);
    uifactory.addStaticTextElement("entry.rate", Long.toString(rate) + "%", formLayout);
    String customRate = "";
    if (participantSummary.getRequiredAttendanceRate() != null) {
        long cRate = Math.round(participantSummary.getRequiredAttendanceRate().doubleValue() * 100.0d);
        customRate = Long.toString(cRate);
    }
    rateEl = uifactory.addTextElement("participant.rate.edit", "participant.rate.edit", 4, customRate, formLayout);
    rateEl.setVisible(rateEnabled);
    Date firstAdmission = participantSummary.getFirstAdmissionDate();
    firstAdmissionEl = uifactory.addDateChooser("first.admission", firstAdmission, formLayout);
    firstAdmissionEl.setElementCssClass("o_sel_lecture_first_admission");
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    if (rateEnabled) {
        removeCustomRateButton = uifactory.addFormLink("remove.custom.rate", "remove.custom.rate", null, buttonsCont, Link.BUTTON);
    }
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) Date(java.util.Date)

Example 67 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class WikiEditArticleForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    wikiContent = uifactory.addTextAreaElement("wikiContentElement", 20, 110, page.getContent(), formLayout);
    wikiContent.setElementCssClass("o_sel_wiki_content");
    wikiContent.setLabel(null, null);
    // OO-31 prevent trimming, so first line can be with inset (wiki pre-formatted)
    wikiContent.preventValueTrim(true);
    wikiContent.setFocus(true);
    updateComment = uifactory.addTextElement("wikiUpdateComment", null, 40, "", formLayout);
    updateComment.setExampleKey("update.comment", null);
    // Button layout
    final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    formLayout.add(buttonLayout);
    FormSubmit submit = uifactory.addFormSubmitButton("save", buttonLayout);
    submit.setElementCssClass("o_sel_wiki_save");
    FormLink saveAndClose = uifactory.addFormLink("save.and.close", buttonLayout, Link.BUTTON);
    saveAndClose.setElementCssClass("o_sel_wiki_save_and_close");
    if (getIdentity().getKey().equals(Long.valueOf(page.getInitalAuthor())) || securityCallback.mayEditWikiMenu()) {
        uifactory.addFormLink("delete.page", buttonLayout, Link.BUTTON);
    }
    uifactory.addFormLink("preview", buttonLayout, Link.BUTTON);
    uifactory.addFormLink("media.upload", buttonLayout, Link.BUTTON);
    uifactory.addFormLink("manage.media", buttonLayout, Link.BUTTON);
    uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
Also used : FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 68 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class FeedFormController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // title might be longer from external source
    String saveTitle = PersistenceHelper.truncateStringDbSave(feed.getTitle(), 256, true);
    title = uifactory.addTextElement("title", "feed.title.label", 256, saveTitle, formLayout);
    title.setElementCssClass("o_sel_feed_title");
    title.setMandatory(true);
    title.setNotEmptyCheck("feed.form.field.is_mandatory");
    description = uifactory.addRichTextElementForStringDataMinimalistic("description", "feed.form.description", feed.getDescription(), 5, -1, formLayout, getWindowControl());
    description.setMaxLength(4000);
    RichTextConfiguration richTextConfig = description.getEditorConfiguration();
    // set upload dir to the media dir
    richTextConfig.setFileBrowserUploadRelPath("media");
    // Add a delete link and an image component to the image container.
    deleteImage = uifactory.addFormLink("feed.image.delete", formLayout, Link.BUTTON);
    deleteImage.setVisible(false);
    file = uifactory.addFileElement(getWindowControl(), "feed.file.label", formLayout);
    file.addActionListener(FormEvent.ONCHANGE);
    file.setPreview(ureq.getUserSession(), true);
    if (feed.getImageName() != null) {
        VFSLeaf imageResource = FeedManager.getInstance().createFeedMediaFile(feed, feed.getImageName(), null);
        if (imageResource instanceof LocalFileImpl) {
            file.setPreview(ureq.getUserSession(), true);
            file.setInitialFile(((LocalFileImpl) imageResource).getBasefile());
            deleteImage.setVisible(true);
        }
    }
    Set<String> mimeTypes = new HashSet<String>();
    mimeTypes.add("image/jpeg");
    mimeTypes.add("image/jpg");
    mimeTypes.add("image/png");
    mimeTypes.add("image/gif");
    file.limitToMimeType(mimeTypes, "feed.form.file.type.error.images", null);
    int maxFileSizeKB = feedQuota.getUlLimitKB().intValue();
    String supportAddr = WebappHelper.getMailConfig("mailQuota");
    file.setMaxUploadSizeKB(maxFileSizeKB, "ULLimitExceeded", new String[] { new Long(maxFileSizeKB / 1024).toString(), supportAddr });
    // if external feed, display feed-url text-element:
    if (feed.isExternal()) {
        feedUrl = uifactory.addTextElement("feedUrl", "feed.form.feedurl", 5000, feed.getExternalFeedUrl(), flc);
        feedUrl.setElementCssClass("o_sel_feed_url");
        feedUrl.setDisplaySize(70);
        String type = feed.getResourceableTypeName();
        if (type != null && type.indexOf("BLOG") >= 0) {
            feedUrl.setExampleKey("feed.form.feedurl.example", null);
        } else {
            feedUrl.setExampleKey("feed.form.feedurl.example_podcast", null);
        }
    }
    // Submit and cancelButton buttons
    final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    formLayout.add(buttonLayout);
    uifactory.addFormSubmitButton("submit", buttonLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonLayout, Link.BUTTON);
}
Also used : RichTextConfiguration(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextConfiguration) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) LocalFileImpl(org.olat.core.util.vfs.LocalFileImpl) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) HashSet(java.util.HashSet)

Example 69 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class ResultsSearchController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    extendedSearchLink = uifactory.addFormLink("switch.advanced.search", formLayout);
    extendedSearchLink.setElementCssClass("o_search_link_extended");
    simpleSearchLink = uifactory.addFormLink("switch.simple.search", formLayout);
    simpleSearchLink.setElementCssClass("o_search_link_simple");
    FormLayoutContainer searchLayout = FormLayoutContainer.createHorizontalFormLayout("search_form", getTranslator());
    formLayout.add(searchLayout);
    super.initForm(searchLayout, listener, ureq);
    FormLayoutContainer extSearchLayout = FormLayoutContainer.createVerticalFormLayout("ext_search_form", getTranslator());
    formLayout.add(extSearchLayout);
    advancedSearchController = new AdvancedSearchInputController(ureq, getWindowControl(), mainForm);
    listenTo(advancedSearchController);
    extSearchLayout.add("adv_search", advancedSearchController.getFormItem());
    contextSelection = uifactory.addRadiosHorizontal("context", "form.search.label.context", formLayout, new String[0], new String[0]);
    resultCtlr = new ResultsController(ureq, getWindowControl(), mainForm);
    listenTo(resultCtlr);
    formLayout.add("resultList", resultCtlr.getFormItem());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 70 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class ShibbolethMigrationForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    login = uifactory.addTextElement("smf_login", "smf.login", 128, authentication.getIdentity().getName(), formLayout);
    login.setEnabled(false);
    password = uifactory.addPasswordElement("smf_password", "smf.password", 255, "", formLayout);
    password.setAutocomplete("new-password");
    FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    formLayout.add(buttonLayout);
    uifactory.addFormSubmitButton("submit", buttonLayout);
    uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Aggregations

FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)844 ArrayList (java.util.ArrayList)96 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)76 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)76 Date (java.util.Date)56 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)56 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)42 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)40 FormItem (org.olat.core.gui.components.form.flexible.FormItem)38 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)32 Translator (org.olat.core.gui.translator.Translator)30 Identity (org.olat.core.id.Identity)30 VFSContainer (org.olat.core.util.vfs.VFSContainer)28 File (java.io.File)26 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)26 BusinessGroup (org.olat.group.BusinessGroup)26 HashMap (java.util.HashMap)22 HashSet (java.util.HashSet)22 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)22 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)20