Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1)

56870: Merged DEV to V4.1-BUG-FIX (4.1.7)
      50589 : MNT-8908 : Incorrect display number of post in blog pagination.
         - The functionality was introduced to display the "pagination.template.page-report.more" (Showing items {startRecord} - {endRecord} of {totalRecords}++) message for pagination in Share UI, when items (blogs) more than limited (default is 100).


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/V4.2-BUG-FIX/root@56927 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2013-10-22 23:10:17 +00:00
parent 77d655ab82
commit 3fc5ec8bf1
2 changed files with 17 additions and 1 deletions

View File

@@ -91,6 +91,7 @@
},
"externalBlogConfig": ${externalBlogConfig?string}
},
"totalRecordsUpper": ${data.totalRecordsUpper?string("true","false")},
<@gen.pagedResults data=data ; item>
<@blogpostJSON item=item />
</@gen.pagedResults>

View File

@@ -60,6 +60,7 @@ public abstract class AbstractGetBlogWebScript extends AbstractBlogWebScript
// process additional parameters. <index, count>
PagingRequest pagingReq = parsePagingParams(req);
pagingReq.setRequestTotalCountMax(pagingReq.getSkipCount() + pagingReq.getRequestTotalCountMax());
// begin and end date.
// Legacy note: these dates are URL query parameters in int form.
@@ -126,12 +127,26 @@ public abstract class AbstractGetBlogWebScript extends AbstractBlogWebScript
Map<String, Object> blogPostsData = new HashMap<String, Object>();
final Pair<Integer, Integer> totalResultCount = blogPostList.getTotalResultCount();
int total = blogPostList.getPage().size();
if (totalResultCount != null && totalResultCount.getFirst() != null)
{
total = totalResultCount.getFirst();
}
//FIXME What to do? null
blogPostsData.put("total", totalResultCount.getFirst());
blogPostsData.put("total", total);
blogPostsData.put("pageSize", pagingReq.getMaxItems());
blogPostsData.put("startIndex", pagingReq.getSkipCount());
blogPostsData.put("itemCount", blogPostList.getPage().size());
if (total == pagingReq.getRequestTotalCountMax())
{
blogPostsData.put("totalRecordsUpper", true);
}
else
{
blogPostsData.put("totalRecordsUpper", false);
}
List<Map<String, Object>> blogPostDataSets = new ArrayList<Map<String, Object>>(blogPostList.getPage().size());
for (BlogPostInfo postInfo : blogPostList.getPage())
{