The archive.module have a bug in the archive_page() function: the line 258 is:

$result = db_query_range($sql, $date, $date_end, 0, 20);

In this way if there is more than 20 objects in the query, only the first 20 are selected (and printed on the page), the others are lost... the problem is also in Drupal 4.6.5.

Comments

dopry’s picture

Status: Active » Needs review
StatusFileSize
new1.3 KB

patch to add pager functionality to archive_page.

finex’s picture

I've tried the patch on CVS (updated 10 minutes ago). The patch work perfectly! :-)

merlinofchaos’s picture

The patch looks good.

It does a drupal_goto() which is kind of annoying, but the archive module uses a POST in order to get the date, and the pager can't really do that. Drupal won't take GET arguments from POST either. And the pager won't take an alternative URL, even though it will allow you to pass through a series of variables to pass through to the URL. And that'd require a little more code to parse those.

I'm ok with the drupal_goto() until pager can be changed to allow alternative URL.

+1

finex’s picture

+1

dries’s picture

Can we put some thought/effort in eliminating the drupal_goto()?

dopry’s picture

Assigned: Unassigned » dopry

The prior solutions I thought of were using $_SESSION to store the selection state, converting the form to use _GET, or adding an alternative URL to theme_pager, or passing the date info as a query string to archive page.

The get and querystring options break the nice clean URL's when using the date selector.

Adding an alternative URL to theme_pager means changing something in core for a single use case, which doesn't seem prudent, unless there is use for this functionality else where (other forms using post selectors and theme_pager may have a user for it).

Using SESSION is easiest and quickest, but its a session variable that will only be used for the archive_page and does nothing else most of the time, breaks clean urls for deep linking, but does bring you back to the same location when you return to the archive page.

The may be some form api wizardry that can do the job that I am not aware of.

The important part is the date selection must persist along side the pager data.

I'm not sure what would be the best route... Would appreciate an opinion on which direction to concentrate my effort.

killes@www.drop.org’s picture

Priority: Critical » Normal

not critical.

killes@www.drop.org’s picture

Version: 4.7.0-beta1 » 4.7.0

I am considering this as a short term bugfix for 4.7.

drumm’s picture

Status: Needs review » Needs work

It seems like the formapi changes have removed the POST-only behavior and the URLs always have the date anyway. I think this means we can throw out the drupal_goto() part.

merlinofchaos’s picture

Unless it was very recently changed, I can say with some assurance that forms API doesn't get along well with using get args. You can tell it to use get as the method, but annoyingly it will not read form values from $_GET.

killes@www.drop.org’s picture

I've wanted to apply it to 4.7 but it doesn't apply to it anymore.

gábor hojtsy’s picture

Version: 4.7.0 » 4.7.3

This is relevant for the 4.7.x branch, if updated. Please update the patch.

edmund.kwok’s picture

Version: 4.7.3 » 4.7.4
Status: Needs work » Needs review
StatusFileSize
new1.36 KB

Patch for 4.7.4. Removed drupal_goto(). The rest remains unchanged. After patch, archive page has pager function.

killes@www.drop.org’s picture

Status: Needs review » Fixed

applied

Anonymous’s picture

Status: Fixed » Closed (fixed)