コード例 #1
0
  protected String getBody(String className, long classPK, ServiceContext serviceContext)
      throws Exception {

    StringBundler sb = new StringBundler(11);

    sb.append("<div class=\"activity-body document\">");
    sb.append("<span class=\"document-thumbnail\"><img src=\"");

    FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(classPK);

    FileVersion fileVersion = fileEntry.getFileVersion();

    String thumbnailSrc =
        DLUtil.getThumbnailSrc(fileEntry, fileVersion, null, serviceContext.getThemeDisplay());

    sb.append(thumbnailSrc);
    sb.append("\"></span>");
    sb.append("<div class=\"document-container\"><div class=\"title\">");
    sb.append(getPageTitle(className, classPK, serviceContext));
    sb.append("</div><div class=\"version\">");
    sb.append(serviceContext.translate("version-x", fileVersion.getVersion()));
    sb.append("</div><div class=\"document-content\">");

    AssetRenderer assetRenderer = getAssetRenderer(className, classPK);

    sb.append(StringUtil.shorten(assetRenderer.getSummary(serviceContext.getLocale()), 200));

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

    return sb.toString();
  }
コード例 #2
0
  @Override
  public String getThumbnailPath(PortletRequest portletRequest) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    String thumbnailSrc = DLUtil.getThumbnailSrc(_fileEntry, themeDisplay);

    if (Validator.isNotNull(thumbnailSrc)) {
      return thumbnailSrc;
    }

    return themeDisplay.getPathThemeImages() + "/file_system/large/document.png";
  }