Paging problem in 4.4 version

Author Message

Aleksy Goroszko

Monday 06 December 2010 3:01:46 pm

Hi,

I've just upgraded 4.2 to 4.4 and found problem with paging when inserting file to the article:

in my Media folders are some subfolders with files. One of them contains 32 files. So I want to insert some files to my article.

Edit article > Insert/Edit object button > (popup appears) > tab "Browse" > Media > Files > some my folders > Files list

This files list contains 10 files and "Next >>". I expect that it switches to the next page and that's happening. But next page contains next 10 files and only "Previous" link (no Next link). When I click Previous, I am back on the first page. But then, when I click Next again, I can see only empty page with no files.

I think that there is a bug, or did I miss something? Did anyone struggle with that?

Aleksy

Christian Pfeffer Gjengedal

Tuesday 07 December 2010 1:00:48 am

If you take a look at the Net section of Firebug, do you see any errors in the XHR communication with the server?

Nicolas Pastorino

Tuesday 07 December 2010 1:14:43 am

Hi Aleksy, and welcome for you first post here !

Let us know if Christian's hint helped find the issue,
Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Aleksy Goroszko

Tuesday 07 December 2010 1:38:47 pm

"

If you take a look at the Net section of Firebug, do you see any errors in the XHR communication with the server?

"

Hi, Christian

No, there are no errors. It just look like paging could be calculated wrong. When I follow JSON messaging of POST requests, I can see that:

1. When I open the first page (10 files + pager 'Next' ), there are parameters of call:

- content.count = 10

- content.limit = 10

- content.offset = 0

- content.total_count = 28

2. When I click "Next", I see next 10 files and pager "Previous", but no "Next" (I'd expect it - the number of files is 28 in this folder). This page contains files no 9,10 from previous page on positions 1,2. And parameters are:

- content.count = 10

- content.limit = 10

- content.offset = 8 (I think it should be 10, for elements 11-20, but it explains why files 9,10 from previous page are visible here again)

- content.total_count = 28

3. When I click "Previous", I come back to first page, but I see 10 files starting from file no 3 (!). First two from step 1 are skipped. Parameters are:

- content.count = 10

- content.limit = 10

- content.offset = -2 (sure, 8 - 10 = -2 but it has to be 0)

- content.total_count = 28

4. And now... When I click again to the "Next" pager, I can see only empty page with "Next" pager shown (clicking on it takes no effect). Parameters are:

- content.count = 0 (sure, no files on the page)

- content.limit = 10

- content.offset = -210 (!!!)

- content.total_count = 28

As I see, when I click "Next" pager, offset is calculated wrong. And it is not possible to go to the pages 3, 4, ... Maybe I need to report it as a bug?

Christian Pfeffer Gjengedal

Wednesday 08 December 2010 1:06:23 am

Hi Aleksy, yes, this sounds like a bug.

Could you please register an issue for this in http://issues.ez.no and paste the issue number into this thread?

Łukasz Kęska

Wednesday 11 May 2011 7:43:57 am

"

Hi Aleksy, yes, this sounds like a bug.

Could you please register an issue for this in http://issues.ez.no and paste the issue number into this thread?

"

Well, I've check the problem and found the solution.

The problem is in browseCallBack function of eZOEPopupUtils class - there's a part with adding offset and limit variables to get the next part of list (e.g. offset value is 10 and limit is 10, we should get the sum of 20), but instead of adding integers, they join strings together (so with numbers above we will get 1010 instead 20).

This is how it looks:

if ( (data.content['offset'] + data.content['limit']) < data.content['total_count'] )
{
tag = document.createElement("a");
tag.setAttribute('href', 'JavaScript:eZOEPopupUtils.' + fn + (data.content['offset'] + data.content['limit']) + ');');

...

To fix a problem, change the code as below:

if ( (parseInt(data.content['offset']) + parseInt(data.content['limit'])) < data.content['total_count'] )
{
tag = document.createElement("a");
tag.setAttribute('href', 'JavaScript:eZOEPopupUtils.' + fn + (parseInt(data.content['offset']) + parseInt(data.content['limit'])) + ');' );
...

greetz

Lucas

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:10:43
Script start
Timing: Jan 18 2025 02:10:43
Module start 'layout'
Timing: Jan 18 2025 02:10:43
Module start 'content'
Timing: Jan 18 2025 02:10:43
Module end 'content'
Timing: Jan 18 2025 02:10:43
Script end

Main resources:

Total runtime0.6799 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 587.9063152.6250
Module start 'layout' 0.00520.0033 740.531339.4531
Module start 'content' 0.00860.6699 779.9844669.6172
Module end 'content' 0.67850.0014 1,449.601620.1641
Script end 0.6798  1,469.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4659160.0002
Check MTime0.00140.1999160.0001
Mysql Total
Database connection0.00090.131810.0009
Mysqli_queries0.598187.9761720.0083
Looping result0.00080.1130700.0000
Template Total0.648295.320.3241
Template load0.00230.332020.0011
Template processing0.645995.004020.3230
Template load and register function0.00030.037810.0003
states
state_id_array0.00120.176510.0012
state_identifier_array0.00110.165020.0006
Override
Cache load0.00200.2876730.0000
Sytem overhead
Fetch class attribute can translate value0.00060.089040.0002
Fetch class attribute name0.00130.193290.0001
XML
Image XML parsing0.00320.471940.0008
class_abstraction
Instantiating content class attribute0.00010.0081110.0000
General
dbfile0.00260.3765280.0001
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
2content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 35
 Number of unique templates used: 9

Time used to render debug report: 0.0001 secs