Search in sources :

Example 6 with RichTextElement

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

the class FormUIFactory method addRichTextElementForStringDataMinimalistic.

/**
 * Add a rich text formattable element that offers basic formatting
 * functionality and loads the data form the given string value. Use
 * item.getEditorConfiguration() to add more editor features if you need
 * them
 *
 * @param name
 *            Name of the form item
 * @param i18nLabel
 *            The i18n key of the label or NULL when no label is used
 * @param initialValue
 *            The initial value or NULL if no initial value is available
 * @param rows
 *            The number of lines the editor should offer. Use -1 to
 *            indicate no specific height
 * @param cols
 *            The number of characters width the editor should offer. Use -1
 *            to indicate no specific width
 * @param externalToolbar
 *            true: use an external toolbar that is only visible when the
 *            user clicks into the text area; false: use the static toolbar
 * @param formLayout The form item container where to add the rich
 *          text element
 * @param usess The user session that dispatches the images
 * @param wControl the current window controller
 * @param wControl
 *            the current window controller
 * @return The rich text element instance
 */
public RichTextElement addRichTextElementForStringDataMinimalistic(String name, final String i18nLabel, String initialHTMLValue, final int rows, final int cols, FormItemContainer formLayout, WindowControl wControl) {
    // Create richt text element with bare bone configuration
    RichTextElement rte = new RichTextElementImpl(name, initialHTMLValue, rows, cols, formLayout.getRootForm(), formLayout.getTranslator().getLocale());
    setLabelIfNotNull(i18nLabel, rte);
    // Now configure editor
    rte.getEditorConfiguration().setConfigProfileFormEditorMinimalistic(wControl.getWindowBackOffice().getWindow().getGuiTheme());
    rte.getEditorConfiguration().setPathInStatusBar(false);
    // Add to form and finish
    formLayout.add(rte);
    return rte;
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) RichTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl)

Example 7 with RichTextElement

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

the class FormUIFactory method addRichTextElementForQTI21.

/**
 * This is a version with olat media only. The tiny media is disabled because we need to catch the object
 * tag use by QTI and interpret it as a olat video. It enable the strict uri validation for file names.
 *
 * @param name
 * @param i18nLabel
 * @param initialHTMLValue
 * @param rows
 * @param cols
 * @param baseContainer
 * @param formLayout
 * @param usess
 * @param wControl
 * @return
 */
public RichTextElement addRichTextElementForQTI21(String name, String i18nLabel, String initialHTMLValue, int rows, int cols, VFSContainer baseContainer, FormItemContainer formLayout, UserSession usess, WindowControl wControl) {
    // Create rich text element with bare bone configuration
    RichTextElement rte = new RichTextElementImpl(name, initialHTMLValue, rows, cols, formLayout.getRootForm(), formLayout.getTranslator().getLocale());
    setLabelIfNotNull(i18nLabel, rte);
    // Now configure editor
    Theme theme = wControl.getWindowBackOffice().getWindow().getGuiTheme();
    rte.getEditorConfiguration().setConfigProfileFormCompactEditor(usess, theme, baseContainer);
    rte.getEditorConfiguration().setInvalidElements(RichTextConfiguration.INVALID_ELEMENTS_FORM_FULL_VALUE_UNSAVE_WITH_SCRIPT);
    rte.getEditorConfiguration().setExtendedValidElements("script[src|type|defer]");
    rte.getEditorConfiguration().disableTinyMedia();
    rte.getEditorConfiguration().setFilenameUriValidation(true);
    rte.getEditorConfiguration().setFigCaption(false);
    // Add to form and finish
    formLayout.add(rte);
    return rte;
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) RichTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl) Theme(org.olat.core.gui.themes.Theme)

Example 8 with RichTextElement

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

the class FormUIFactory method addRichTextElementForFileData.

/**
 * Add a rich text formattable element that offers complex formatting
 * functionality and loads the data from the given file path. Use
 * item.getEditorConfiguration() to add more editor features if you need
 * them
 *
 * @param name
 *            Name of the form item
 * @param i18nLabel
 *            The i18n key of the label or NULL when no label is used
 * @param initialValue
 *            The initial value or NULL if no initial value is available
 * @param rows
 *            The number of lines the editor should offer. Use -1 to
 *            indicate no specific height
 * @param cols
 *            The number of characters width the editor should offer. Use -1
 *            to indicate no specific width
 * @param externalToolbar
 *            true: use an external toolbar that is only visible when the
 *            user clicks into the text area; false: use the static toolbar
 * @param baseContainer
 *            The VFS container where to load resources from (images etc) or
 *            NULL to not allow embedding of media files at all
 * @param relFilePath
 *            The path to the file relative to the baseContainer
 * @param customLinkTreeModel
 *            A custom link tree model or NULL not not use a custom model
 * @param formLayout
 *            The form item container where to add the rich text element
 * @param usess
 *            The user session that dispatches the images
 * @param wControl
 *            the current window controller
 * @return The richt text element instance
 */
public RichTextElement addRichTextElementForFileData(String name, final String i18nLabel, String initialValue, final int rows, int cols, VFSContainer baseContainer, String relFilePath, CustomLinkTreeModel customLinkTreeModel, FormItemContainer formLayout, UserSession usess, WindowControl wControl) {
    // Create richt text element with bare bone configuration
    RichTextElement rte = new RichTextElementImpl(name, initialValue, rows, cols, formLayout.getRootForm(), formLayout.getTranslator().getLocale());
    setLabelIfNotNull(i18nLabel, rte);
    // Now configure editor
    rte.getEditorConfiguration().setConfigProfileFileEditor(usess, wControl.getWindowBackOffice().getWindow().getGuiTheme(), baseContainer, relFilePath, customLinkTreeModel);
    // Add to form and finish
    formLayout.add(rte);
    return rte;
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) RichTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl)

Example 9 with RichTextElement

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

the class FormUIFactory method addRichTextElementForStringDataCompact.

public RichTextElement addRichTextElementForStringDataCompact(String name, String i18nLabel, String initialHTMLValue, int rows, int cols, VFSContainer baseContainer, FormItemContainer formLayout, UserSession usess, WindowControl wControl) {
    // Create rich text element with bare bone configuration
    RichTextElement rte = new RichTextElementImpl(name, initialHTMLValue, rows, cols, formLayout.getRootForm(), formLayout.getTranslator().getLocale());
    setLabelIfNotNull(i18nLabel, rte);
    // Now configure editor
    Theme theme = wControl.getWindowBackOffice().getWindow().getGuiTheme();
    rte.getEditorConfiguration().setConfigProfileFormCompactEditor(usess, theme, baseContainer);
    // Add to form and finish
    formLayout.add(rte);
    return rte;
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) RichTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl) Theme(org.olat.core.gui.themes.Theme)

Example 10 with RichTextElement

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

the class FormUIFactory method addRichTextElementForStringData.

/**
 * Add a rich text formattable element that offers simple formatting
 * functionality and loads the data form the given string value. Use
 * item.getEditorConfiguration() to add more editor features if you need
 * them
 *
 * @param name
 *            Name of the form item
 * @param i18nLabel
 *            The i18n key of the label or NULL when no label is used
 * @param initialValue
 *            The initial value or NULL if no initial value is available
 * @param rows
 *            The number of lines the editor should offer. Use -1 to
 *            indicate no specific height
 * @param cols
 *            The number of characters width the editor should offer. Use -1
 *            to indicate no specific width
 * @param externalToolbar
 *            true: use an external toolbar that is only visible when the
 *            user clicks into the text area; false: use the static toolbar
 * @param fullProfile
 *            false: load only the necessary plugins; true: load all plugins
 *            from the full profile
 * @param baseContainer
 *            The VFS container where to load resources from (images etc) or
 *            NULL to not allow embedding of media files at all
 * @param formLayout
 *            The form item container where to add the richt text element
 * @param customLinkTreeModel A custom link tree model or NULL not not use a
 *          custom model
 * @param formLayout The form item container where to add the rich
 *          text element
 * @param usess The user session that dispatches the images
 * @param wControl the current window controller
 * @param wControl
 *            the current window controller
 * @return The rich text element instance
 */
public RichTextElement addRichTextElementForStringData(String name, String i18nLabel, String initialHTMLValue, int rows, int cols, boolean fullProfile, VFSContainer baseContainer, CustomLinkTreeModel customLinkTreeModel, FormItemContainer formLayout, UserSession usess, WindowControl wControl) {
    // Create richt text element with bare bone configuration
    WindowBackOffice backoffice = wControl.getWindowBackOffice();
    RichTextElement rte = new RichTextElementImpl(name, initialHTMLValue, rows, cols, formLayout.getRootForm(), formLayout.getTranslator().getLocale());
    setLabelIfNotNull(i18nLabel, rte);
    // Now configure editor
    Theme theme = backoffice.getWindow().getGuiTheme();
    rte.getEditorConfiguration().setConfigProfileFormEditor(fullProfile, usess, theme, baseContainer, customLinkTreeModel);
    // Add to form and finish
    formLayout.add(rte);
    return rte;
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) RichTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice) Theme(org.olat.core.gui.themes.Theme)

Aggregations

RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)30 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)14 RichTextElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl)12 FlowFormItem (org.olat.ims.qti21.ui.components.FlowFormItem)10 FlowStatic (uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic)10 Theme (org.olat.core.gui.themes.Theme)8 ArrayList (java.util.ArrayList)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 RubricBlock (uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock)4 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)2 FormSubmit (org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit)2 WindowBackOffice (org.olat.core.gui.control.WindowBackOffice)2 ChoiceResponse (org.olat.ims.qti.editor.beecom.objects.ChoiceResponse)2 Material (org.olat.ims.qti.editor.beecom.objects.Material)2 AssessmentSectionEvent (org.olat.ims.qti21.ui.editor.events.AssessmentSectionEvent)2 Ordering (uk.ac.ed.ph.jqtiplus.node.test.Ordering)2 Selection (uk.ac.ed.ph.jqtiplus.node.test.Selection)2