Search in sources :

Example 26 with StaticTextElement

use of org.olat.core.gui.components.form.flexible.elements.StaticTextElement in project openolat by klemens.

the class EPCollectStepForm00 method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    title = uifactory.addTextElement("title", "artefact.title", 500, artefact.getTitle(), formLayout);
    title.setElementCssClass("o_sel_ep_artefact_metadata_title");
    title.setMandatory(true);
    title.setNotEmptyCheck("artefact.title.not.empty");
    title.setNotLongerThanCheck(512, "artefact.title.too.long");
    title.setVisible(!simpleMode);
    descript = uifactory.addRichTextElementForStringDataMinimalistic("description", "artefact.description", artefact.getDescription(), 7, -1, formLayout, getWindowControl());
    descript.setMaxLength(4000);
    descript.setNotLongerThanCheck(4000, "artefact.description.too.long");
    String artSource = artefact.getSource();
    if (StringHelper.containsNonWhitespace(artSource) && !simpleMode) {
        uifactory.addStaticTextElement("artefact.source", artSource, formLayout);
    }
    Date artDate = artefact.getCreationDate();
    if (artDate == null)
        artDate = new Date();
    StaticTextElement date = uifactory.addStaticTextElement("artefact.date", Formatter.getInstance(getLocale()).formatDateAndTime(artDate), formLayout);
    date.setVisible(!simpleMode);
    String busPath = artefact.getBusinessPath();
    if (StringHelper.containsNonWhitespace(busPath) && !simpleMode) {
        BusinessControlFactory bCF = BusinessControlFactory.getInstance();
        List<ContextEntry> ceList = bCF.createCEListFromString(busPath);
        String busLink = bCF.getAsURIString(ceList, true);
        if (StringHelper.containsNonWhitespace(busLink)) {
            String finalPath = "<a href=\"" + busLink + "\">" + busLink + "</a>";
            uifactory.addStaticTextElement("artefact.link", finalPath, formLayout);
        }
    }
    if (!isUsedInStepWizzard()) {
        // add form buttons
        uifactory.addFormSubmitButton("stepform.submit", formLayout);
    }
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) BusinessControlFactory(org.olat.core.id.context.BusinessControlFactory) Date(java.util.Date) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 27 with StaticTextElement

use of org.olat.core.gui.components.form.flexible.elements.StaticTextElement in project openolat by klemens.

the class PreviewLA method getFormItem.

/**
 * @see org.olat.course.config.ui.courselayout.attribs.AbstractLayoutAttribute#getFormItem(java.lang.String, org.olat.core.gui.components.form.flexible.FormItemContainer)
 */
@Override
public FormItem getFormItem(String compName, FormItemContainer formLayout) {
    FormUIFactory uifact = FormUIFactory.getInstance();
    String textEl = new String("<span style=\"" + getAttributeValue() + "\">" + formLayout.getTranslator().translate("preview.sample") + "</span>");
    StaticTextElement fi = uifact.addStaticTextElement(compName, null, textEl, formLayout);
    return fi;
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) FormUIFactory(org.olat.core.gui.components.form.flexible.FormUIFactory)

Example 28 with StaticTextElement

use of org.olat.core.gui.components.form.flexible.elements.StaticTextElement in project openolat by klemens.

the class FormUIFactory method addStaticTextElement.

/**
 * Add a static text.
 * @param name
 * @param i18nLabel
 * @param translatedText
 * @param formLayout
 * @return
 */
public StaticTextElement addStaticTextElement(String name, String i18nLabel, String translatedText, FormItemContainer formLayout) {
    StaticTextElement ste = new StaticTextElementImpl(name, translatedText == null ? "" : translatedText);
    setLabelIfNotNull(i18nLabel, ste);
    formLayout.add(ste);
    return ste;
}
Also used : StaticTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.StaticTextElementImpl) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement)

Example 29 with StaticTextElement

use of org.olat.core.gui.components.form.flexible.elements.StaticTextElement in project openolat by klemens.

the class EditDueDatesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    ModuleConfiguration config = gtaNode.getModuleConfiguration();
    Date assignmentDueDate = task.getAssignmentDueDate();
    assignmentDueDateEl = uifactory.addDateChooser("assignment.duedate", assignmentDueDate, formLayout);
    assignmentDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardAssignmentDueDate = gtaManager.getAssignmentDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
    setDueDateExplanation(assignmentDueDateEl, standardAssignmentDueDate);
    assignmentDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT));
    Date submissionDueDate = task.getSubmissionDueDate();
    submissionDueDateEl = uifactory.addDateChooser("submission.duedate", submissionDueDate, formLayout);
    submissionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSubmissionDueDate = gtaManager.getSubmissionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
    setDueDateExplanation(submissionDueDateEl, standardSubmissionDueDate);
    boolean submissionDeadline = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    submissionDueDateEl.setVisible(submissionDeadline);
    if (submissionDeadline && task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal()) {
        StaticTextElement warningReopenEl = uifactory.addStaticTextElement("reopen", translate("warning.reopen"), formLayout);
        warningReopenEl.setElementCssClass("o_gta_reopen_warning");
        warningReopenEl.setLabel(null, null);
    }
    Date revisionsDueDate = task.getRevisionsDueDate();
    revisionDueDateEl = uifactory.addDateChooser("revisions.duedate", revisionsDueDate, formLayout);
    revisionDueDateEl.setDateChooserTimeEnabled(true);
    revisionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD));
    Date solutionDueDate = task.getSolutionDueDate();
    solutionDueDateEl = uifactory.addDateChooser("solution.duedate", solutionDueDate, formLayout);
    solutionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSolutionDueDate = gtaManager.getSolutionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, true);
    setDueDateExplanation(solutionDueDateEl, standardSolutionDueDate);
    solutionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION));
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate)

Example 30 with StaticTextElement

use of org.olat.core.gui.components.form.flexible.elements.StaticTextElement in project openolat by klemens.

the class EditMultipleDueDatesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    ModuleConfiguration config = gtaNode.getModuleConfiguration();
    assignmentDueDateEl = uifactory.addDateChooser("assignment.duedate", null, formLayout);
    assignmentDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardAssignmentDueDate = gtaManager.getAssignmentDueDate(null, null, null, gtaNode, courseEntry, false);
    setDueDateExplanation(assignmentDueDateEl, standardAssignmentDueDate);
    assignmentDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT));
    submissionDueDateEl = uifactory.addDateChooser("submission.duedate", null, formLayout);
    submissionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSubmissionDueDate = gtaManager.getSubmissionDueDate(null, null, null, gtaNode, courseEntry, false);
    setDueDateExplanation(submissionDueDateEl, standardSubmissionDueDate);
    boolean submissionDeadline = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    submissionDueDateEl.setVisible(submissionDeadline);
    if (submissionDeadline) {
        for (Task task : tasks) {
            if (task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal()) {
                StaticTextElement warningReopenEl = uifactory.addStaticTextElement("reopen", translate("warning.reopen"), formLayout);
                warningReopenEl.setElementCssClass("o_gta_reopen_warning");
                warningReopenEl.setLabel(null, null);
                break;
            }
        }
    }
    revisionDueDateEl = uifactory.addDateChooser("revisions.duedate", null, formLayout);
    revisionDueDateEl.setDateChooserTimeEnabled(true);
    revisionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD));
    solutionDueDateEl = uifactory.addDateChooser("solution.duedate", null, formLayout);
    solutionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSolutionDueDate = gtaManager.getSolutionDueDate(null, null, null, gtaNode, courseEntry, false);
    setDueDateExplanation(solutionDueDateEl, standardSolutionDueDate);
    solutionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION));
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : Task(org.olat.course.nodes.gta.Task) ModuleConfiguration(org.olat.modules.ModuleConfiguration) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate)

Aggregations

StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)30 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)20 ArrayList (java.util.ArrayList)8 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)8 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)8 Identity (org.olat.core.id.Identity)8 SecurityGroup (org.olat.basesecurity.SecurityGroup)6 Date (java.util.Date)4 DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)4 FormSubmit (org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit)4 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 TaskDueDate (org.olat.course.nodes.gta.TaskDueDate)4 DueDate (org.olat.course.nodes.gta.model.DueDate)4 ModuleConfiguration (org.olat.modules.ModuleConfiguration)4 CollectRestriction (org.olat.portfolio.model.restriction.CollectRestriction)4 EPStructuredMapTemplate (org.olat.portfolio.model.structel.EPStructuredMapTemplate)4 File (java.io.File)2