protected String getSaveAndContinueRedirect(
      PortletConfig portletConfig,
      ActionRequest actionRequest,
      FileEntry fileEntry,
      String redirect)
      throws Exception {

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

    PortletURLImpl portletURL =
        new PortletURLImpl(
            actionRequest,
            portletConfig.getPortletName(),
            themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "/document_library/edit_file_entry");
    portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter("groupId", String.valueOf(fileEntry.getGroupId()), false);
    portletURL.setParameter("fileEntryId", String.valueOf(fileEntry.getFileEntryId()), false);
    portletURL.setParameter("version", String.valueOf(fileEntry.getVersion()), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
  }
  protected String getSaveAndContinueRedirect(
      PortletConfig portletConfig, ActionRequest actionRequest, DDMStructure structure)
      throws Exception {

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

    PortletURLImpl portletURL =
        new PortletURLImpl(
            actionRequest,
            portletConfig.getPortletName(),
            themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("struts_action", "/dynamic_data_mapping/copy_structure");

    long classNameId = PortalUtil.getClassNameId(DDMStructure.class);

    portletURL.setParameter("classNameId", String.valueOf(classNameId), false);

    portletURL.setParameter("classPK", String.valueOf(structure.getStructureId()), false);
    portletURL.setParameter(
        "copyFormTemplates", ParamUtil.getString(actionRequest, "copyFormTemplates"), false);
    portletURL.setParameter(
        "copyDisplayTemplates", ParamUtil.getString(actionRequest, "copyDisplayTemplates"), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
  }
  protected String getSaveAndContinueRedirect(
      ActionRequest actionRequest, BlogsEntry entry, String redirect) throws Exception {

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

    PortletConfig portletConfig =
        (PortletConfig) actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);

    String backURL = ParamUtil.getString(actionRequest, "backURL");

    PortletURLImpl portletURL =
        new PortletURLImpl(
            actionRequest,
            portletConfig.getPortletName(),
            themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "/blogs/edit_entry");

    portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter("backURL", backURL, false);
    portletURL.setParameter("groupId", String.valueOf(entry.getGroupId()), false);
    portletURL.setParameter("entryId", String.valueOf(entry.getEntryId()), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
  }
Пример #4
0
  private String _convert(NodeFilter filter, String content) throws IOException {

    if (content == null) {
      return StringPool.BLANK;
    }

    StringWriter out = new StringWriter();

    filter.filter(new StringReader(content), out);

    String newContent = out.toString();

    String portletURLToString = StringPool.BLANK;

    PortletURLImpl portletURL = (PortletURLImpl) filter.getPortletURL();

    if (portletURL != null) {
      portletURL.setParameter("node_id", filter.getNodeId());

      Iterator itr = filter.getTitles().keySet().iterator();

      while (itr.hasNext()) {
        String title = (String) itr.next();

        portletURL.setParameter("page_title", title, false);

        portletURLToString = portletURL.toString();

        newContent =
            StringUtil.replace(
                newContent,
                "[$BEGIN_PAGE_TITLE$]" + title + "[$END_PAGE_TITLE$]",
                portletURLToString);
      }
    }

    return newContent;
  }
Пример #5
0
  protected String getSaveAndContinueRedirect(
      PortletConfig portletConfig, ActionRequest actionRequest, BlogsEntry entry, String redirect)
      throws Exception {

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

    String backURL = ParamUtil.getString(actionRequest, "backURL");

    boolean preview = ParamUtil.getBoolean(actionRequest, "preview");

    PortletURLImpl portletURL =
        new PortletURLImpl(
            actionRequest,
            portletConfig.getPortletName(),
            themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    portletURL.setWindowState(actionRequest.getWindowState());

    String portletName = portletConfig.getPortletName();

    if (portletName.equals(PortletKeys.BLOGS_ADMIN)) {
      portletURL.setParameter("struts_action", "/blogs_admin/edit_entry");
    } else {
      portletURL.setParameter("struts_action", "/blogs/edit_entry");
    }

    portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter("backURL", backURL, false);
    portletURL.setParameter("groupId", String.valueOf(entry.getGroupId()), false);
    portletURL.setParameter("entryId", String.valueOf(entry.getEntryId()), false);
    portletURL.setParameter("preview", String.valueOf(preview), false);

    return portletURL.toString();
  }
Пример #6
0
  private String _getURL(
      HttpServletRequest request, boolean resetMaxState, boolean resetRenderParameters)
      throws PortalException, SystemException {

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

    if (resetMaxState) {
      Layout layout = themeDisplay.getLayout();

      LayoutTypePortlet layoutTypePortlet = null;

      if (layout.equals(this)) {
        layoutTypePortlet = themeDisplay.getLayoutTypePortlet();
      } else {
        try {
          layoutTypePortlet = _getLayoutTypePortletClone(request);
        } catch (IOException ioe) {
          _log.error("Unable to clone layout settings", ioe);

          layoutTypePortlet = (LayoutTypePortlet) getLayoutType();
        }
      }

      if (layoutTypePortlet.hasStateMax()) {
        String portletId = StringUtil.split(layoutTypePortlet.getStateMax())[0];

        PortletURLImpl portletURLImpl =
            new PortletURLImpl(request, portletId, getPlid(), PortletRequest.ACTION_PHASE);

        try {
          portletURLImpl.setWindowState(WindowState.NORMAL);
          portletURLImpl.setPortletMode(PortletMode.VIEW);
        } catch (PortletException pe) {
          throw new SystemException(pe);
        }

        portletURLImpl.setAnchor(false);

        if (PropsValues.LAYOUT_DEFAULT_P_L_RESET && !resetRenderParameters) {

          portletURLImpl.setParameter("p_l_reset", "0");
        } else if (!PropsValues.LAYOUT_DEFAULT_P_L_RESET && resetRenderParameters) {

          portletURLImpl.setParameter("p_l_reset", "1");
        }

        return portletURLImpl.toString();
      }
    }

    String portalURL = PortalUtil.getPortalURL(request);

    String url = PortalUtil.getLayoutURL(this, themeDisplay);

    if (!CookieKeys.hasSessionId(request)
        && (url.startsWith(portalURL) || url.startsWith(StringPool.SLASH))) {

      url = PortalUtil.getURLWithSessionId(url, request.getSession().getId());
    }

    if (!resetMaxState) {
      return url;
    }

    if (PropsValues.LAYOUT_DEFAULT_P_L_RESET && !resetRenderParameters) {
      url = HttpUtil.addParameter(url, "p_l_reset", 0);
    } else if (!PropsValues.LAYOUT_DEFAULT_P_L_RESET && resetRenderParameters) {

      url = HttpUtil.addParameter(url, "p_l_reset", 1);
    }

    return url;
  }
  protected String getSaveAndContinueRedirect(
      ActionRequest actionRequest, JournalArticle article, String redirect) throws Exception {

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

    String referringPortletResource =
        ParamUtil.getString(actionRequest, "referringPortletResource");

    PortletURLImpl portletURL =
        new PortletURLImpl(
            actionRequest,
            JournalPortletKeys.JOURNAL,
            themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcPath", "/edit_article.jsp");
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter("referringPortletResource", referringPortletResource, false);
    portletURL.setParameter("resourcePrimKey", String.valueOf(article.getResourcePrimKey()), false);
    portletURL.setParameter("groupId", String.valueOf(article.getGroupId()), false);
    portletURL.setParameter("folderId", String.valueOf(article.getFolderId()), false);
    portletURL.setParameter("articleId", article.getArticleId(), false);
    portletURL.setParameter("version", String.valueOf(article.getVersion()), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
  }
  protected String getPortletURL(HttpServletRequest request) throws Exception {

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

    String cacheability = ParamUtil.getString(request, "cacheability");
    boolean copyCurrentRenderParameters =
        ParamUtil.getBoolean(request, "copyCurrentRenderParameters");
    long doAsGroupId = ParamUtil.getLong(request, "doAsGroupId");
    long doAsUserId = ParamUtil.getLong(request, "doAsUserId");
    String doAsUserLanguageId = ParamUtil.getString(request, "doAsUserLanguageId");
    // boolean encrypt = ParamUtil.getBoolean(request, "encrypt");
    boolean escapeXml = ParamUtil.getBoolean(request, "escapeXml");
    String lifecycle = ParamUtil.getString(request, "lifecycle");
    String name = ParamUtil.getString(request, "name");
    boolean portletConfiguration = ParamUtil.getBoolean(request, "portletConfiguration");
    String portletId = ParamUtil.getString(request, "portletId");
    String portletMode = ParamUtil.getString(request, "portletMode");
    String resourceId = ParamUtil.getString(request, "resourceId");
    String returnToFullPageURL = ParamUtil.getString(request, "returnToFullPageURL");
    boolean secure = ParamUtil.getBoolean(request, "secure", request.isSecure());
    String windowState = ParamUtil.getString(request, "windowState");

    PortletURLImpl portletURL =
        new PortletURLImpl(request, portletId, themeDisplay.getPlid(), lifecycle);

    if (Validator.isNotNull(cacheability)) {
      portletURL.setCacheability(cacheability);
    }

    portletURL.setCopyCurrentRenderParameters(copyCurrentRenderParameters);

    if (doAsGroupId > 0) {
      portletURL.setDoAsGroupId(doAsGroupId);
    }

    if (doAsUserId > 0) {
      // portletURL.setDoAsUserId(doAsUserId);
    }

    if (Validator.isNotNull(doAsUserLanguageId)) {
      portletURL.setDoAsUserLanguageId(doAsUserLanguageId);
    }

    // portletURL.setEncrypt(encrypt);
    portletURL.setEscapeXml(escapeXml);

    if (lifecycle.equals(PortletRequest.ACTION_PHASE) && Validator.isNotNull(name)) {

      portletURL.setParameter(ActionRequest.ACTION_NAME, name);
    }

    portletURL.setPortletId(portletId);

    if (portletConfiguration) {
      String portletResource = ParamUtil.getString(request, "portletResource");
      String previewWidth = ParamUtil.getString(request, "previewWidth");

      portletURL.setParameter("struts_action", "/portlet_configuration/edit_configuration");
      portletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
      portletURL.setParameter("portletResource", portletResource);
      portletURL.setParameter("previewWidth", previewWidth);
    }

    if (Validator.isNotNull(portletMode)) {
      portletURL.setPortletMode(PortletModeFactory.getPortletMode(portletMode));
    }

    if (Validator.isNotNull(resourceId)) {
      portletURL.setResourceID(resourceId);
    }

    if (!themeDisplay.isStateMaximized()) {
      if (Validator.isNotNull(returnToFullPageURL)) {
        portletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
      }
    }

    portletURL.setSecure(secure);

    if (Validator.isNotNull(windowState)) {
      portletURL.setWindowState(WindowStateFactory.getWindowState(windowState));
    }

    String parameterMapString = ParamUtil.getString(request, "parameterMap");

    if (Validator.isNotNull(parameterMapString)) {
      Map<String, String> parameterMap =
          (Map<String, String>) JSONFactoryUtil.deserialize(parameterMapString);

      for (Map.Entry<String, String> entry : parameterMap.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();

        if ((key != null) && (value != null)) {
          portletURL.setParameter(key, value);
        }
      }
    }

    return portletURL.toString();
  }