Search in sources :

Example 11 with WindowBackOffice

use of org.olat.core.gui.control.WindowBackOffice in project openolat by klemens.

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)

Example 12 with WindowBackOffice

use of org.olat.core.gui.control.WindowBackOffice in project openolat by klemens.

the class AjaxController method createJSON.

private JSONObject createJSON(WindowCommand wc) {
    Command c = wc.getCommand();
    WindowBackOffice wbo = wc.getWindowBackOffice();
    String winId = wbo.getWindow().getDispatchID();
    JSONObject jo = new JSONObject();
    try {
        jo.put("cmd", c.getCommand());
        jo.put("w", winId);
        jo.put("cda", c.getSubJSON());
        return jo;
    } catch (JSONException e) {
        throw new AssertException("json exception:", e);
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) JSONObject(org.json.JSONObject) WindowCommand(org.olat.core.gui.control.pushpoll.WindowCommand) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice) JSONException(org.json.JSONException)

Aggregations

WindowBackOffice (org.olat.core.gui.control.WindowBackOffice)12 Window (org.olat.core.gui.components.Window)6 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)4 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 WindowSettings (org.olat.core.gui.WindowSettings)2 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)2 InvalidRequestParameterException (org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException)2 RichTextElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl)2 ChiefController (org.olat.core.gui.control.ChiefController)2 WindowControl (org.olat.core.gui.control.WindowControl)2 DTab (org.olat.core.gui.control.generic.dtabs.DTab)2 BornSiteInstance (org.olat.core.gui.control.navigation.BornSiteInstance)2 WindowCommand (org.olat.core.gui.control.pushpoll.WindowCommand)2 Theme (org.olat.core.gui.themes.Theme)2 BusinessControl (org.olat.core.id.context.BusinessControl)2 HistoryPoint (org.olat.core.id.context.HistoryPoint)2 AssertException (org.olat.core.logging.AssertException)2