Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-14467

Asset publishers search paginator should ignore the target page that is set in the look and feel configuration

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: 6.0.5 GA, 6.1.30 EE GA3, 6.2.0 CE M5, 7.0.0 M3
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: b69dcdfeec063364921af007e457b2cbbded450f.
      Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: ee4db4a4856fb3ec4a2805490b43cb9dc95d0b67.

      Description

      It's actually logical, when the asset publisher paginates and you click on "next", it shows the next batch of results in it's own portlet.
      But when you go to look-and-feel and change the target page, all links the asset publisher generates will point to that other page. Good for the webcontent elements, not so good for the search paginator links.

      This happens because the searchContainers iteratorURL receives it's value from the responseRenderer which takes the target URL into account.
      So all generated links depend on this setting.

      A quick hack for people dealing with the same problem.
      Change the view.jsp of the assetpublisher. Scroll down where the pagination taglib is called and change it into something like this:

      <c:if test='<%= !paginationType.equals("none") && (searchContainer.getTotal() > searchContainer.getResults().size()) %>'>

      <%
      //by default, the renderResponse will create a url that will contain the "link to layout uuid" feature that is set up by the look and feel properties of the portlet and the target link
      //this is however unwanted behaviour when the asset publisher starts paginating! In this case the asset publisher should construct links in it's own portlet because we only want the target links to work on the webcontent elements, not on the pagination!
      //In other words pagination links should show the next results in the same portlet and ignore the target link/page setting.
      RenderResponseImpl renderResponseImpl = (RenderResponseImpl)renderResponse;
      PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup((Layout)renderResponseImpl.getPortletRequest().getAttribute(WebKeys.LAYOUT), renderResponseImpl.getPortletName());
      String originalLinkToLayoutUuid = portletSetup.getValue("portlet-setup-link-to-layout-uuid", null);

      //remove the target uuid config
      portletSetup.reset("portlet-setup-link-to-layout-uuid");
      portletSetup.store();
      searchContainer.setIteratorURL(renderResponse.createRenderURL());

      %>

      <...... search-paginator searchContainer="<%= searchContainer %>" type="<%= paginationType %>" />

      <%
      //restore the target uuid config
      portletSetup.setValue("portlet-setup-link-to-layout-uuid",originalLinkToLayoutUuid);
      portletSetup.store();
      searchContainer.setIteratorURL(renderResponse.createRenderURL());
      %>

      </c:if>

        Attachments

          Activity

            People

            Assignee:
            joshua.gok Joshua Gok (Inactive)
            Reporter:
            kdejaeger Koen De Jaeger (Inactive)
            Participants of an Issue:
            Recent user:
            Marta Elicegui
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              7 years, 16 weeks, 1 day ago

                Packages

                Version Package