Example usage for com.liferay.portal.kernel.xuggler XugglerUtil isEnabled

List of usage examples for com.liferay.portal.kernel.xuggler XugglerUtil isEnabled

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.xuggler XugglerUtil isEnabled.

Prototype

public static boolean isEnabled() 

Source Link

Usage

From source file:com.liferay.frontend.editor.ckeditor.web.editor.configuration.CKEditorConfigContributor.java

License:Open Source License

protected JSONArray getToolbarLiferayArticleJSONArray(Map<String, Object> inputEditorTaglibAttributes) {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    jsonArray.put(toJSONArray("['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', "
            + "'Superscript', '-', 'RemoveFormat']"));
    jsonArray.put(toJSONArray("['TextColor', 'BGColor']"));
    jsonArray.put(toJSONArray("['JustifyLeft', 'JustifyCenter', 'JustifyRight', " + "'JustifyBlock']"));
    jsonArray.put(//from   w  ww. ja va2s  .c  o  m
            toJSONArray("['NumberedList', 'BulletedList', '-' ,'Outdent', 'Indent', " + "'-', 'Blockquote']"));
    jsonArray.put("/");
    jsonArray.put(toJSONArray("['Styles', 'FontSize']"));
    jsonArray.put(toJSONArray("['Link', 'Unlink', 'Anchor']"));

    String buttons = "['Table', '-', 'ImageSelector',";

    if (XugglerUtil.isEnabled()) {
        buttons += " 'AudioSelector', 'VideoSelector',";
    }

    buttons += " 'Flash', '-', 'LiferayPageBreak', '-', " + "'Smiley', 'SpecialChar']";

    jsonArray.put(toJSONArray(buttons));

    jsonArray.put("/");
    jsonArray.put(toJSONArray("['Cut', 'Copy', 'Paste', '-', 'PasteText', 'PasteFromWord', "
            + "'-', 'SelectAll' , '-', 'Undo', 'Redo']"));
    jsonArray.put(toJSONArray("['Find', 'Replace', '-', 'SpellChecker', 'Scayt']"));

    if (isShowSource(inputEditorTaglibAttributes)) {
        jsonArray.put(toJSONArray("['Source']"));
    }

    jsonArray.put(toJSONArray("['A11YBtn']"));

    return jsonArray;
}

From source file:com.liferay.frontend.editor.ckeditor.web.editor.configuration.CKEditorConfigContributor.java

License:Open Source License

protected JSONArray getToolbarLiferayJSONArray(Map<String, Object> inputEditorTaglibAttributes) {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    jsonArray.put(toJSONArray("['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', "
            + "'Superscript', '-', 'RemoveFormat']"));
    jsonArray.put(toJSONArray("['TextColor', 'BGColor']"));
    jsonArray.put(toJSONArray("['JustifyLeft', 'JustifyCenter', 'JustifyRight', " + "'JustifyBlock']"));
    jsonArray.put(toJSONArray("['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent']"));
    jsonArray.put("/");
    jsonArray.put(toJSONArray("['Styles', 'FontSize']"));
    jsonArray.put(toJSONArray("['Link', 'Unlink', 'Anchor']"));

    String buttons = "['Table', '-', 'ImageSelector',";

    if (XugglerUtil.isEnabled()) {
        buttons = buttons.concat(" 'AudioSelector', 'VideoSelector',");
    }/*  w w  w. ja va2 s .  c o  m*/

    buttons = buttons.concat(" 'Flash', '-', 'Smiley', 'SpecialChar']");

    jsonArray.put(toJSONArray(buttons));

    jsonArray.put("/");

    boolean inlineEdit = GetterUtil
            .getBoolean((String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:inlineEdit"));

    if (inlineEdit) {
        jsonArray.put(toJSONArray("['AjaxSave', '-', 'Restore']"));
    }

    jsonArray.put(toJSONArray("['Cut', 'Copy', 'Paste', '-', 'PasteText', 'PasteFromWord', "
            + "'-', 'SelectAll' , '-', 'Undo', 'Redo']"));
    jsonArray.put(toJSONArray("['Find', 'Replace', '-', 'SpellChecker', 'Scayt']"));

    if (!inlineEdit && isShowSource(inputEditorTaglibAttributes)) {
        jsonArray.put(toJSONArray("['Source']"));
    }

    jsonArray.put(toJSONArray("['A11YBtn']"));

    return jsonArray;
}

From source file:com.liferay.frontend.editor.ckeditor.web.internal.editor.configuration.CKEditorConfigContributor.java

License:Open Source License

protected JSONArray getToolbarLiferayArticleJSONArray(Map<String, Object> inputEditorTaglibAttributes) {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    jsonArray.put(toJSONArray("['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', "
            + "'Superscript', '-', 'RemoveFormat']"));
    jsonArray.put(toJSONArray("['TextColor', 'BGColor']"));
    jsonArray.put(toJSONArray("['JustifyLeft', 'JustifyCenter', 'JustifyRight', " + "'JustifyBlock']"));
    jsonArray.put(//from   w  w  w  . ja v a  2  s.c o  m
            toJSONArray("['NumberedList', 'BulletedList', '-' ,'Outdent', 'Indent', " + "'-', 'Blockquote']"));
    jsonArray.put("/");
    jsonArray.put(toJSONArray("['Styles', 'FontSize']"));
    jsonArray.put(toJSONArray("['Link', 'Unlink', 'Anchor']"));

    String buttons = "['Table', '-', 'ImageSelector',";

    if (XugglerUtil.isEnabled()) {
        buttons += " 'AudioSelector', 'VideoSelector',";
    }

    buttons += " 'Flash', '-', 'LiferayPageBreak', '-', 'Smiley', " + "'SpecialChar']";

    jsonArray.put(toJSONArray(buttons));

    jsonArray.put("/");
    jsonArray.put(toJSONArray("['Cut', 'Copy', 'Paste', '-', 'PasteText', 'PasteFromWord', "
            + "'-', 'SelectAll' , '-', 'Undo', 'Redo']"));
    jsonArray.put(toJSONArray("['Find', 'Replace', '-', 'SpellChecker', 'Scayt']"));

    if (isShowSource(inputEditorTaglibAttributes)) {
        jsonArray.put(toJSONArray("['Source']"));
    }

    jsonArray.put(toJSONArray("['A11YBtn']"));

    return jsonArray;
}

From source file:com.liferay.journal.editor.configuration.internal.JournalMediaEditorConfigContributor.java

License:Open Source License

@Override
public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    if (!XugglerUtil.isEnabled()) {
        return;/*  w  w w .j  a  va 2 s. c o  m*/
    }

    JSONObject toolbarsJSONObject = jsonObject.getJSONObject("toolbars");

    if (toolbarsJSONObject == null) {
        toolbarsJSONObject = JSONFactoryUtil.createJSONObject();
    }

    JSONObject addJSONObject = toolbarsJSONObject.getJSONObject("add");

    if (addJSONObject == null) {
        addJSONObject = JSONFactoryUtil.createJSONObject();
    }

    JSONArray buttonsJSONArray = addJSONObject.getJSONArray("buttons");

    if (buttonsJSONArray == null) {
        buttonsJSONArray = JSONFactoryUtil.createJSONArray();
    }

    buttonsJSONArray.put("video");
    buttonsJSONArray.put("audio");

    addJSONObject.put("buttons", buttonsJSONArray);

    toolbarsJSONObject.put("add", addJSONObject);

    jsonObject.put("toolbars", toolbarsJSONObject);
}