Example usage for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_FORMAT

List of usage examples for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_FORMAT

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_FORMAT.

Prototype

String DISCUSSION_COMMENTS_FORMAT

To view the source code for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_FORMAT.

Click Source Link

Usage

From source file:com.liferay.blogs.web.internal.trackback.Trackback.java

License:Open Source License

protected String buildBody(ThemeDisplay themeDisplay, String excerpt, String url) {

    if (PropsValues.DISCUSSION_COMMENTS_FORMAT.equals("bbcode")) {
        return buildBBCodeBody(themeDisplay, excerpt, url);
    }// ww w.java  2  s.  c om

    return buildHTMLBody(themeDisplay, excerpt, url);
}

From source file:com.liferay.comment.editor.configuration.internal.CommentEditorConfigContributor.java

License:Open Source License

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

    jsonObject.put("allowedContent", PropsValues.DISCUSSION_COMMENTS_ALLOWED_CONTENT);
    jsonObject.put("toolbars", JSONFactoryUtil.createJSONObject());

    if (PropsValues.DISCUSSION_COMMENTS_FORMAT.equals("bbcode")) {
        String extraPlugins = jsonObject.getString("extraPlugins");

        if (Validator.isNull(extraPlugins)) {
            extraPlugins = "bbcode";
        } else if (!extraPlugins.contains("bbcode")) {
            extraPlugins = extraPlugins + ",bbcode";
        }//from w  w w .  j  a  v a 2  s  .  com

        jsonObject.put("extraPlugins", extraPlugins);
    }
}

From source file:com.liferay.message.boards.internal.service.MBDiscussionMBMessageLocalServiceWrapper.java

License:Open Source License

@Override
public MBMessage addDiscussionMessage(long userId, String userName, long groupId, String className,
        long classPK, long threadId, long parentMessageId, String subject, String body,
        ServiceContext serviceContext) throws PortalException {

    super.addDiscussionMessage(userId, userName, groupId, className, classPK, threadId, parentMessageId,
            subject, body, serviceContext);

    // Message/*from   www  .ja v  a  2 s.  c o  m*/

    validateDiscussionMaxComments(className, classPK);

    long categoryId = MBCategoryConstants.DISCUSSION_CATEGORY_ID;
    subject = getDiscussionMessageSubject(subject, body);
    List<ObjectValuePair<String, InputStream>> inputStreamOVPs = Collections.emptyList();
    boolean anonymous = false;
    double priority = 0.0;
    boolean allowPingbacks = false;

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);
    serviceContext.setAttribute("className", className);
    serviceContext.setAttribute("classPK", String.valueOf(classPK));

    Date now = new Date();

    if (serviceContext.getCreateDate() == null) {
        serviceContext.setCreateDate(now);
    }

    if (serviceContext.getModifiedDate() == null) {
        serviceContext.setModifiedDate(now);
    }

    MBMessage message = addMessage(userId, userName, groupId, categoryId, threadId, parentMessageId, subject,
            body, PropsValues.DISCUSSION_COMMENTS_FORMAT, inputStreamOVPs, anonymous, priority, allowPingbacks,
            serviceContext);

    // Discussion

    if (parentMessageId == MBMessageConstants.DEFAULT_PARENT_MESSAGE_ID) {
        long classNameId = _classNameLocalService.getClassNameId(className);

        MBDiscussion discussion = _mbDiscussionLocalService.fetchDiscussion(classNameId, classPK);

        if (discussion == null) {
            _mbDiscussionLocalService.addDiscussion(userId, groupId, classNameId, classPK,
                    message.getThreadId(), serviceContext);
        }
    }

    return message;
}