Example usage for com.liferay.portal.kernel.editor.configuration EditorOptions setUploadURL

List of usage examples for com.liferay.portal.kernel.editor.configuration EditorOptions setUploadURL

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.editor.configuration EditorOptions setUploadURL.

Prototype

public void setUploadURL(String uploadURL) 

Source Link

Usage

From source file:com.liferay.blogs.editor.configuration.internal.BlogsContentEditorOptionsContributor.java

License:Open Source License

@Override
public void populateEditorOptions(EditorOptions editorOptions, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    if (Validator.isNull(portletDisplay.getId())) {
        return;/*from w  ww. j a va  2  s.c o  m*/
    }

    PortletURL portletURL = requestBackedPortletURLFactory.createActionURL(portletDisplay.getId());

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/blogs/upload_temp_image");

    editorOptions.setUploadURL(portletURL.toString());
}

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

License:Open Source License

@Override
public void populateEditorOptions(EditorOptions editorOptions, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    if (Validator.isNull(portletDisplay.getId())) {
        return;/* w ww . j a v a 2s.  c o m*/
    }

    PortletURL portletURL = requestBackedPortletURLFactory.createActionURL(portletDisplay.getId());

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/journal/upload_image");

    editorOptions.setUploadURL(portletURL.toString());
}

From source file:com.liferay.message.boards.editor.configuration.internal.MBEditorOptionsContributor.java

License:Open Source License

@Override
public void populateEditorOptions(EditorOptions editorOptions, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    PortletURL portletURL = requestBackedPortletURLFactory.createActionURL(PortletKeys.MESSAGE_BOARDS);

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/message_boards/upload_temp_image");

    Map<String, String> fileBrowserParamsMap = (Map<String, String>) inputEditorTaglibAttributes
            .get("liferay-ui:input-editor:fileBrowserParams");

    long categoryId = 0;

    if (fileBrowserParamsMap != null) {
        categoryId = GetterUtil.getLong(fileBrowserParamsMap.get("categoryId"));
    }/* www.j a  va2 s.  c  o m*/

    portletURL.setParameter("categoryId", String.valueOf(categoryId));

    editorOptions.setUploadURL(portletURL.toString());
}

From source file:com.liferay.wiki.editor.configuration.internal.WikiAttachmentEditorOptionsContributor.java

License:Open Source License

@Override
public void populateEditorOptions(EditorOptions editorOptions, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    if (Validator.isNull(portletDisplay.getId())) {
        return;/*from  w w  w  . j a  va 2  s.com*/
    }

    Map<String, String> fileBrowserParamsMap = (Map<String, String>) inputEditorTaglibAttributes
            .get("liferay-ui:input-editor:fileBrowserParams");

    long wikiPageResourcePrimKey = 0;

    if (fileBrowserParamsMap != null) {
        wikiPageResourcePrimKey = GetterUtil.getLong(fileBrowserParamsMap.get("wikiPageResourcePrimKey"));
    }

    if (wikiPageResourcePrimKey == 0) {
        return;
    }

    PortletURL portletURL = requestBackedPortletURLFactory.createActionURL(WikiPortletKeys.WIKI);

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/wiki/upload_page_attachment");
    portletURL.setParameter("resourcePrimKey", String.valueOf(wikiPageResourcePrimKey));
    portletURL.setParameter("mimeTypes", PropsValues.DL_FILE_ENTRY_PREVIEW_IMAGE_MIME_TYPES);

    editorOptions.setUploadURL(portletURL.toString());
}