コード例 #1
0
  protected String processURL(
      JournalFeed feed, String url, ThemeDisplay themeDisplay, SyndEntry syndEntry) {

    url =
        StringUtil.replace(
            url,
            new String[] {"@group_id@", "@image_path@", "@main_path@"},
            new String[] {
              String.valueOf(feed.getGroupId()),
              themeDisplay.getPathImage(),
              themeDisplay.getPathMain()
            });

    List<SyndEnclosure> syndEnclosures =
        JournalRSSUtil.getDLEnclosures(themeDisplay.getURLPortal(), url);

    syndEnclosures.addAll(JournalRSSUtil.getIGEnclosures(themeDisplay.getURLPortal(), url));

    syndEntry.setEnclosures(syndEnclosures);

    List<SyndLink> syndLinks = JournalRSSUtil.getDLLinks(themeDisplay.getURLPortal(), url);

    syndLinks.addAll(JournalRSSUtil.getIGLinks(themeDisplay.getURLPortal(), url));

    syndEntry.setLinks(syndLinks);

    return url;
  }
コード例 #2
0
ファイル: MBUtil.java プロジェクト: JamesLefeu/liferay-portal
  public static String replaceMessageBodyPaths(ThemeDisplay themeDisplay, String messageBody) {

    return StringUtil.replace(
        messageBody,
        new String[] {"@theme_images_path@", "href=\"/", "src=\"/"},
        new String[] {
          themeDisplay.getPathThemeImages(),
          "href=\"" + themeDisplay.getURLPortal() + "/",
          "src=\"" + themeDisplay.getURLPortal() + "/"
        });
  }
コード例 #3
0
ファイル: MBUtil.java プロジェクト: narigone/liferay-portal
  public static String replaceMessageBodyPaths(ThemeDisplay themeDisplay, String messageBody) {

    return StringUtil.replace(
        messageBody,
        new String[] {ThemeConstants.TOKEN_THEME_IMAGES_PATH, "href=\"/", "src=\"/"},
        new String[] {
          themeDisplay.getPathThemeImages(),
          "href=\"" + themeDisplay.getURLPortal() + "/",
          "src=\"" + themeDisplay.getURLPortal() + "/"
        });
  }
コード例 #4
0
  protected String processContent(
      JournalFeed feed,
      JournalArticle article,
      String languageId,
      ThemeDisplay themeDisplay,
      SyndEntry syndEntry,
      SyndContent syndContent)
      throws Exception {

    String content = article.getDescription(languageId);

    String contentField = feed.getContentField();

    if (contentField.equals(JournalFeedConstants.RENDERED_WEB_CONTENT)) {
      String rendererTemplateId = article.getTemplateId();

      if (Validator.isNotNull(feed.getRendererTemplateId())) {
        rendererTemplateId = feed.getRendererTemplateId();
      }

      JournalArticleDisplay articleDisplay =
          JournalContentUtil.getDisplay(
              feed.getGroupId(),
              article.getArticleId(),
              rendererTemplateId,
              null,
              languageId,
              themeDisplay,
              1,
              _XML_REQUUEST);

      if (articleDisplay != null) {
        content = articleDisplay.getContent();
      }
    } else if (!contentField.equals(JournalFeedConstants.WEB_CONTENT_DESCRIPTION)) {

      Document document = SAXReaderUtil.read(article.getContentByLocale(languageId));

      contentField = HtmlUtil.escapeXPathAttribute(contentField);

      XPath xPathSelector =
          SAXReaderUtil.createXPath("//dynamic-element[@name=" + contentField + "]");

      List<Node> results = xPathSelector.selectNodes(document);

      if (results.size() == 0) {
        return content;
      }

      Element element = (Element) results.get(0);

      String elType = element.attributeValue("type");

      if (elType.equals("document_library")) {
        String url = element.elementText("dynamic-content");

        url = processURL(feed, url, themeDisplay, syndEntry);
      } else if (elType.equals("image") || elType.equals("image_gallery")) {
        String url = element.elementText("dynamic-content");

        url = processURL(feed, url, themeDisplay, syndEntry);

        content =
            content + "<br /><br /><img alt='' src='" + themeDisplay.getURLPortal() + url + "' />";
      } else if (elType.equals("text_box")) {
        syndContent.setType("text");

        content = element.elementText("dynamic-content");
      } else {
        content = element.elementText("dynamic-content");
      }
    }

    return content;
  }