コード例 #1
0
  @Override
  public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

    PortletURL portletURL =
        PortalUtil.getControlPanelPortletURL(
            portletRequest, MBPortletKeys.MESSAGE_BOARDS_ADMIN, PortletRequest.ACTION_PHASE);

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/message_boards/edit_message");

    try {
      MBMessage message = ActionUtil.getMessage(portletRequest);

      MBThread thread = message.getThread();

      if (thread.isLocked()) {
        portletURL.setParameter(Constants.CMD, Constants.UNLOCK);
      } else {
        portletURL.setParameter(Constants.CMD, Constants.LOCK);
      }

      portletURL.setParameter("redirect", PortalUtil.getCurrentURL(portletRequest));
      portletURL.setParameter("threadId", String.valueOf(thread.getThreadId()));
    } catch (Exception e) {
      return null;
    }

    return portletURL.toString();
  }
コード例 #2
0
  @Override
  public String getMessage(PortletRequest portletRequest) {
    try {
      MBMessage message = ActionUtil.getMessage(portletRequest);

      MBThread thread = message.getThread();

      String key = "lock";

      if (thread.isLocked()) {
        key = "unlock";
      }

      return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), key);
    } catch (Exception e) {
      return null;
    }
  }