Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-4369

Small Image doesn't appear in asset publisher when descrption is not entered into article's abstract

    Details

      Description

      To reproduce issue you have to:
      1. create new web content
      2. add small image to web content abstact
      3. You must not enter description
      4. Add asset publisher to page
      5. Configure to display web content abstracts

      Result:
      Web content is html stripped and shortened, but there is no small image.

      To fix this:

      in /html/portlet/asset_publisher/display/abstracts.jsp change JournalArticle section to:

      else if (className.equals(JournalArticle.class.getName())) {
      JournalArticleResource articleResource = JournalArticleResourceLocalServiceUtil.getArticleResource(classPK);

      String languageId = LanguageUtil.getLanguageId(request);

      JournalArticleDisplay articleDisplay = JournalContentUtil.getDisplay(articleResource.getGroupId(), articleResource.getArticleId(), null, null, languageId, themeDisplay);

      if (articleDisplay != null) {
      if (Validator.isNull(title))

      { title = articleDisplay.getTitle(); }

      StringBuilder sb = new StringBuilder();

      if (articleDisplay.isSmallImage()) {
      sb.append("<div style=\"float: left; padding-right: 10px;\"><img alt=\"");
      sb.append(LanguageUtil.get(pageContext, "web-content-image"));
      sb.append("\" src=\"");

      if (Validator.isNotNull(articleDisplay.getSmallImageURL()))

      { sb.append(articleDisplay.getSmallImageURL()); }

      else

      { sb.append(themeDisplay.getPathImage()); sb.append("/journal/article?img_id="); sb.append(articleDisplay.getSmallImageId()); sb.append("&t="); sb.append(ImageServletTokenUtil.getToken(articleDisplay.getSmallImageId())); }

      sb.append("\" /></div>");
      }

      String description = articleDisplay.getDescription();

      if (Validator.isNull(description))

      { sb.append(StringUtil.shorten(HtmlUtil.stripHtml(articleDisplay.getContent()), abstractLength)); }

      else

      { sb.append(description); }

      summary = sb.toString();

      viewFullContentURL.setParameter("urlTitle", articleDisplay.getUrlTitle());
      viewFullContentURL.setParameter("type", AssetPublisherUtil.TYPE_CONTENT);

      viewURL = viewFullContentURL.toString();
      viewURLMessage = "read-more";
      cssClassName = AssetPublisherUtil.TYPE_CONTENT;
      }
      else

      { show = false; }

      }

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                9 years, 22 weeks ago

                Packages

                Version Package