Mini Calendar Block Title Link is wrong after next/prev months link are followed

thePanz - March 20, 2009 - 10:10
Project:Calendar
Version:6.x-2.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I found a related issue with Calendar Block navigation, follow my example:

We're on March, so the block will display "March" (linked to calendar/2009-03)

1. click for display next month in the Block navigation (we'll go to April)
2. the current page will be reloaded, and the block displays the next month events (April's events)
3. if you check, the month name (April) is still linked to calendar/2009-03 and not calendar/2009-04

#1

KarenS - March 20, 2009 - 18:34
Status:active» fixed

Same problem as #406876: Complete Pager Fail, I just committed fixes to cvs.

#2

prunelle - March 31, 2009 - 12:34
Priority:critical» normal
Status:fixed» active

I re-open this issue, because my tests show that that problem still exists with the 6.x-2.x-dev (03/26) version on the default calendar view.

Regards.

#3

thePanz - April 4, 2009 - 13:11

This issue is still in latest -dev (as today 2009-04-04).

#4

thePanz - April 6, 2009 - 07:29

#5

jonline - April 9, 2009 - 05:48

is there any update?

#6

Morn - April 21, 2009 - 08:11

Subscribing...

#7

fpedraza - April 26, 2009 - 17:57

subscribing.

#8

mattHH - April 28, 2009 - 00:50

same problem here (calendar-6.x-2.x-dev, date-6.x-2.x-dev)

quick&dirty workaround:

open sites/all/modules/date/theme/theme.inc
search for: theme_date_nav_title
copy whole function theme_date_nav_title to your template.php and rename it (YOURTHEME_date_nav_title)

function YOURTHEME_date_nav_title($granularity, $view, $link = FALSE, $format = NULL) {
  switch ($granularity) {
    case 'year':
      $title = $view->date_info->year;
      $url = $view->date_info->url .'/'. $view->date_info->year;
      break;
    case 'month':
      $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'F Y' : 'F');
      $title = date_format_date($view->date_info->min_date, 'custom', $format);
      $url = $view->date_info->url .'/'. $view->date_info->year .'-'. date_pad($view->date_info->month);
      break;
    case 'day':
      $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'l, F j Y' : 'l, F j');
      $title = date_format_date($view->date_info->min_date, 'custom', $format);
      $url = $view->date_info->url .'/'. $view->date_info->year .'-'. date_pad($view->date_info->month) .'-'. date_pad($view->date_info->day);
      break;
    case 'week':
        $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'F j Y' : 'F j');
      $title = t('Week of @date', array('@date' => date_format_date($view->date_info->min_date, 'custom', $format)));
        $url = $view->date_info->url .'/'. $view->date_info->year .'-W'. date_pad($view->date_info->week);
        break;
  }
   
    // TODO Update this.
// var_dump($view->date_info); //NEW - for testing
//    echo $view->date_info->url.'<br/>'; //NEW - for testing
//    echo $view->args[0].'<br/>'; //NEW - for testing
//    echo $view->date_info->date_arg.'<br/>';   //NEW - for testing

  if (!empty($view->date_info->mini) || $link) {
  // Month navigation titles are used as links in the mini view.
//  return l($title, $view->date_info->url); //ORIGINAL

     $myurl= str_replace($view->args[0], $view->date_info->date_arg, $view->date_info->url); //NEW
     return l($title, $myurl); //NEW

  }
  else {
    return $title;   
  }
}

#9

Morn - May 11, 2009 - 07:38

.. subscribing (need a patch)

#10

fred0 - May 24, 2009 - 17:54

I'm seeing this on a clean install of Drupal 6.12, Calendar 6.x-2.x-dev (5/12/09), Date 6.x-2.x-dev (5/17/09).
Haven't tried the hack in #8 yet.

#11

Morn - June 22, 2009 - 07:43

is this issue fixed in the dev Version?

#12

hujia - July 2, 2009 - 17:48

Thanks for the workaround solution - I used it and it works!

An associated issue for Mini Calendar Block is this: if you click on the prev. or next navigation arrow and go to another month, like 09/2009 or 06/2009, rather than the current month (like 07/2009 now), and then click on any date or the month in the title of Mini Calendar Block, the content is loaded correctly for that date or month, but then the Mini Calendar will always go back to the current month. Is it possible to keep that month one just navigates to? Thanks, Huj

#13

marcuslim - July 15, 2009 - 01:07

I think the issue is that the correct month argument for the calendar block needs to be specified, otherwise when the page reloads when a date is clicked, the block has no argument, and it will default to using the current month, which is why the calendar block will revert back to the current month.

#14

travisaugust - July 28, 2009 - 18:12

subscribing

#15

jecheve - July 29, 2009 - 20:32

subscribing

#16

francoud - August 21, 2009 - 11:21

I think I still have this problem, or a sort of.

What I can see, is that it works perfectly when I use it on:
windows xp + Mysql 5.0.37 + PHP 5.2.1

I still have the problem on:
linux (centos) + mysql 4.1.20 + php 4.3.0 (+ module: DATE PHP4 6.x-2.x-dev).

I tried using (on the centos server) calendar and date -dev last versions, but still not working. Also the "#8" workaround didnt help:
if the mini-calendar shows "august" and I click on "next", the september's mini calendar is really shown; but the "title" is not refreshed, it still show "august" with the same prev and next links.

I think it could be a "views" issue:
echo $view->date_info->date_arg
correctly does "2009-09" in the working test site, but gives "2009-08" in the not-working production site.

Any suggestion? Does it depend from old version of php (4, not 5)? Something that I could do?

tia

#17

arlinsandbulte - September 15, 2009 - 03:43
Title:Mini Calendar Block displays wrong link if next/prev months link are followed » Mini Calendar Block Title Link is wrong after next/prev months link are followed

I confirm #8 works...
If you apply the changes in #8 to the theme.inc file in located in the DATE module, it also works fine (\sites\all\modules\date\theme\theme.inc)
That actually makes this an issue for the DATE module and not necessarily the calendar module.

Can someone make a patch to test?
That should be pretty simple, but I have never done that before....

#18

webwriter - September 28, 2009 - 03:04

Subscribe

I am also seeing this issue with php4, but not php5 if that helps.

 
 

Drupal is a registered trademark of Dries Buytaert.