コード例 #1
0
  @Override
  public String getSearchSummary(Locale locale) {
    if (_message.isFormatBBCode()) {
      return HtmlUtil.extractText(BBCodeTranslatorUtil.getHTML(_message.getBody()));
    }

    return getSummary(null, null);
  }
コード例 #2
0
  @Override
  public String getBody(boolean translate) {
    String body = null;

    if (translate) {
      body = BBCodeTranslatorUtil.getHTML(getBody());
    } else {
      body = getBody();
    }

    return body;
  }
コード例 #3
0
ファイル: MBUtil.java プロジェクト: narigone/liferay-portal
 public static String getBBCodeHTML(String msgBody, String pathThemeImages) {
   return StringUtil.replace(
       BBCodeTranslatorUtil.getHTML(msgBody),
       ThemeConstants.TOKEN_THEME_IMAGES_PATH + EMOTICONS,
       pathThemeImages + EMOTICONS);
 }
コード例 #4
0
  protected String exportToRSS(
      String name,
      String description,
      String type,
      double version,
      String displayStyle,
      String feedURL,
      String entryURL,
      List<MBMessage> messages,
      ThemeDisplay themeDisplay)
      throws SystemException {

    SyndFeed syndFeed = new SyndFeedImpl();

    syndFeed.setDescription(description);

    List<SyndEntry> syndEntries = new ArrayList<SyndEntry>();

    syndFeed.setEntries(syndEntries);

    for (MBMessage message : messages) {
      SyndEntry syndEntry = new SyndEntryImpl();

      if (!message.isAnonymous()) {
        String author = PortalUtil.getUserName(message);

        syndEntry.setAuthor(author);
      }

      SyndContent syndContent = new SyndContentImpl();

      syndContent.setType(RSSUtil.ENTRY_TYPE_DEFAULT);

      String value = null;

      if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) {
        value =
            StringUtil.shorten(
                HtmlUtil.extractText(message.getBody()),
                PropsValues.MESSAGE_BOARDS_RSS_ABSTRACT_LENGTH,
                StringPool.BLANK);
      } else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) {
        value = StringPool.BLANK;
      } else if (message.isFormatBBCode()) {
        value = BBCodeTranslatorUtil.getHTML(message.getBody());

        value = MBUtil.replaceMessageBodyPaths(themeDisplay, value);
      } else {
        value = message.getBody();
      }

      syndContent.setValue(value);

      syndEntry.setDescription(syndContent);

      syndEntry.setLink(entryURL + "&messageId=" + message.getMessageId());
      syndEntry.setPublishedDate(message.getCreateDate());
      syndEntry.setTitle(message.getSubject());
      syndEntry.setUpdatedDate(message.getModifiedDate());
      syndEntry.setUri(syndEntry.getLink());

      syndEntries.add(syndEntry);
    }

    syndFeed.setFeedType(RSSUtil.getFeedType(type, version));

    List<SyndLink> syndLinks = new ArrayList<SyndLink>();

    syndFeed.setLinks(syndLinks);

    SyndLink selfSyndLink = new SyndLinkImpl();

    syndLinks.add(selfSyndLink);

    selfSyndLink.setHref(feedURL);
    selfSyndLink.setRel("self");

    syndFeed.setPublishedDate(new Date());
    syndFeed.setTitle(name);
    syndFeed.setUri(feedURL);

    try {
      return RSSUtil.export(syndFeed);
    } catch (FeedException fe) {
      throw new SystemException(fe);
    }
  }