예제 #1
0
  @Override
  public PortletURL getViewContentURL(HttpServletRequest request, String className, long classPK)
      throws PortalException {

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

    if (!themeDisplay.isSignedIn()
        || !isTrashEnabled(themeDisplay.getScopeGroupId())
        || !PortletPermissionUtil.hasControlPanelAccessPermission(
            themeDisplay.getPermissionChecker(),
            themeDisplay.getScopeGroupId(),
            PortletKeys.TRASH)) {

      return null;
    }

    TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(className);

    if (trashHandler.isInTrashContainer(classPK)) {
      TrashEntry trashEntry = trashHandler.getTrashEntry(classPK);

      className = trashEntry.getClassName();
      classPK = trashEntry.getClassPK();

      trashHandler = TrashHandlerRegistryUtil.getTrashHandler(className);
    }

    TrashRenderer trashRenderer = trashHandler.getTrashRenderer(classPK);

    if (trashRenderer == null) {
      return null;
    }

    Layout layout = themeDisplay.getLayout();

    PortletURL portletURL =
        PortalUtil.getControlPanelPortletURL(
            request, PortletKeys.TRASH, layout.getLayoutId(), PortletRequest.RENDER_PHASE);

    portletURL.setParameter("struts_action", "/trash/view_content");
    portletURL.setParameter("redirect", themeDisplay.getURLCurrent());

    TrashEntry trashEntry = TrashEntryLocalServiceUtil.getEntry(className, classPK);

    if (trashEntry.getRootEntry() != null) {
      portletURL.setParameter("className", className);
      portletURL.setParameter("classPK", String.valueOf(classPK));
    } else {
      portletURL.setParameter("trashEntryId", String.valueOf(trashEntry.getEntryId()));
    }

    portletURL.setParameter("type", trashRenderer.getType());
    portletURL.setParameter("showActions", Boolean.FALSE.toString());
    portletURL.setParameter("showAssetMetadata", Boolean.TRUE.toString());
    portletURL.setParameter("showEditURL", Boolean.FALSE.toString());

    return portletURL;
  }
예제 #2
0
  public static String getControlPanelLink(PortletRequest portletRequest, long folderId)
      throws PortalException {

    PortletURL portletURL =
        PortalUtil.getControlPanelPortletURL(
            portletRequest, BookmarksPortletKeys.BOOKMARKS_ADMIN, 0, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "/bookmarks/view");
    portletURL.setParameter("folderId", String.valueOf(folderId));

    return portletURL.toString();
  }
  @Override
  public PortletURL getURLEdit(
      LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse)
      throws Exception {

    PortletURL editPortletURL =
        PortalUtil.getControlPanelPortletURL(
            liferayPortletRequest, CommentPortletKeys.COMMENT, 0, PortletRequest.RENDER_PHASE);

    editPortletURL.setParameter("mvcPath", "/edit_discussion.jsp");
    editPortletURL.setParameter("commentId", String.valueOf(_workflowableComment.getCommentId()));

    return editPortletURL;
  }
예제 #4
0
  @Override
  public PortletURL getViewURL(HttpServletRequest request) throws PortalException {

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

    String portletId =
        PortletProviderUtil.getPortletId(TrashEntry.class.getName(), PortletProvider.Action.VIEW);

    if (!themeDisplay.isSignedIn()
        || !isTrashEnabled(themeDisplay.getScopeGroupId())
        || !PortletPermissionUtil.hasControlPanelAccessPermission(
            themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), portletId)) {

      return null;
    }

    PortletURL portletURL =
        PortalUtil.getControlPanelPortletURL(request, portletId, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("redirect", themeDisplay.getURLCurrent());

    return portletURL;
  }