@Override
  public String getRestoreLink(PortletRequest portletRequest, long classPK)
      throws PortalException, SystemException {

    String portletId = PortletKeys.WIKI;

    WikiPage page = WikiPageLocalServiceUtil.getPage(classPK);

    long plid = PortalUtil.getPlidFromPortletId(page.getGroupId(), PortletKeys.WIKI);

    if (plid == LayoutConstants.DEFAULT_PLID) {
      plid = PortalUtil.getControlPanelPlid(portletRequest);

      portletId = PortletKeys.WIKI_ADMIN;
    }

    PortletURL portletURL =
        PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);

    WikiNode node = page.getNode();

    portletURL.setParameter("struts_action", "/wiki/view");
    portletURL.setParameter("nodeName", node.getName());
    portletURL.setParameter("title", HtmlUtil.unescape(page.getTitle()));

    return portletURL.toString();
  }
  protected PortletURL getRestoreURL(
      PortletRequest portletRequest, long classPK, boolean isContainerModel)
      throws PortalException, SystemException {

    String portletId = PortletKeys.MESSAGE_BOARDS;

    MBThread thread = MBThreadLocalServiceUtil.getThread(classPK);

    long plid = PortalUtil.getPlidFromPortletId(thread.getGroupId(), PortletKeys.MESSAGE_BOARDS);

    if (plid == LayoutConstants.DEFAULT_PLID) {
      portletId = PortletKeys.MESSAGE_BOARDS_ADMIN;

      plid = PortalUtil.getControlPanelPlid(portletRequest);
    }

    PortletURL portletURL =
        PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);

    if (isContainerModel) {
      if (portletId.equals(PortletKeys.MESSAGE_BOARDS)) {
        portletURL.setParameter("struts_action", "/message_boards/view");
      } else {
        portletURL.setParameter("struts_action", "/message_boards_admin/view");
      }
    } else {
      if (portletId.equals(PortletKeys.MESSAGE_BOARDS)) {
        portletURL.setParameter("struts_action", "/message_boards/view_message");
      } else {
        portletURL.setParameter("struts_action", "/message_boards_admin/view_message");
      }
    }

    return portletURL;
  }
Beispiel #3
0
  @Override
  public String getDLFolderControlPanelLink(PortletRequest portletRequest, long folderId)
      throws PortalException, SystemException {

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

    PortletURL portletURL =
        PortletURLFactoryUtil.create(
            portletRequest,
            PortletKeys.DOCUMENT_LIBRARY,
            PortalUtil.getControlPanelPlid(themeDisplay.getCompanyId()),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("struts_action", "/document_library/view");
    portletURL.setParameter("folderId", String.valueOf(folderId));

    return portletURL.toString();
  }
  public static String getMBControlPanelLink(PortletRequest portletRequest, long mbCategoryId)
      throws PortalException, SystemException {

    ThemeDisplay themeDisplay =
        (ThemeDisplay)
            portletRequest.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);

    PortletURL portletURL =
        PortletURLFactoryUtil.create(
            portletRequest,
            PortletKeys.MESSAGE_BOARDS_ADMIN,
            PortalUtil.getControlPanelPlid(themeDisplay.getCompanyId()),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("struts_action", "/message_boards_admin/view");
    portletURL.setParameter("mbCategoryId", String.valueOf(mbCategoryId));

    return portletURL.toString();
  }
  @Override
  public String getURLEditWorkflowTask(long workflowTaskId, ServiceContext serviceContext)
      throws PortalException, SystemException {

    try {
      LiferayPortletURL liferayPortletURL =
          PortletURLFactoryUtil.create(
              serviceContext.getRequest(),
              PortletKeys.MY_WORKFLOW_TASKS,
              PortalUtil.getControlPanelPlid(serviceContext.getCompanyId()),
              PortletRequest.RENDER_PHASE);

      liferayPortletURL.setControlPanelCategory("my");
      liferayPortletURL.setParameter("struts_action", "/my_workflow_tasks/edit_workflow_task");
      liferayPortletURL.setParameter("workflowTaskId", String.valueOf(workflowTaskId));
      liferayPortletURL.setWindowState(WindowState.MAXIMIZED);

      return liferayPortletURL.toString();
    } catch (WindowStateException wse) {
      throw new PortalException(wse);
    }
  }
  @Override
  public String getRestoreLink(PortletRequest portletRequest, long classPK)
      throws PortalException, SystemException {

    String portletId = PortletKeys.MESSAGE_BOARDS;

    MBThread thread = MBThreadLocalServiceUtil.getThread(classPK);

    long plid = PortalUtil.getPlidFromPortletId(thread.getGroupId(), PortletKeys.MESSAGE_BOARDS);

    if (plid == LayoutConstants.DEFAULT_PLID) {
      portletId = PortletKeys.MESSAGE_BOARDS_ADMIN;

      plid = PortalUtil.getControlPanelPlid(portletRequest);
    }

    PortletURL portletURL =
        PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("struts_action", "/message_boards_admin/view");
    portletURL.setParameter("mbCategoryId", String.valueOf(thread.getCategoryId()));

    return portletURL.toString();
  }