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

CommentFileSizeAuthor
#24 date.patch1.3 KBvladsavitsky
#20 date.theme_.inc_.patch2.49 KBufku

Comments

karens’s picture

Status: Active » Fixed

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

prunelle’s picture

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.

thepanz’s picture

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

thepanz’s picture

jonline’s picture

is there any update?

Morn’s picture

Subscribing...

fpedraza’s picture

subscribing.

mattHH’s picture

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;    
  }
}

Morn’s picture

.. subscribing (need a patch)

fred0’s picture

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.

Morn’s picture

is this issue fixed in the dev Version?

hujia’s picture

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

marcuslim’s picture

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.

travisaugust’s picture

subscribing

jecheve’s picture

subscribing

francoud’s picture

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

arlinsandbulte’s picture

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....

webwriter’s picture

Subscribe

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

cledman’s picture

Hi..
in my case, the currently month is always the next month. For example: We´re in november, but the header shows "December". How could I fix that?
I just tried the #8, but no success

ufku’s picture

Project: Calendar » Date
Status: Active » Needs review
StatusFileSize
new2.49 KB

the patch tries to fix the bug by using date_real_url() to create the URL of a navigation title.

cledman’s picture

thanks... I did amost the same thing few days ago.
thanks :)

2ndmile’s picture

I can confirms this problem. The fix in #8 worked for me.

hnln’s picture

subscribe

vladsavitsky’s picture

StatusFileSize
new1.3 KB

This is my patch (the same code in attach).
See also original issue: http://drupal.org/node/700866#comment-2651358

diff -bur ./date_original/theme/theme.inc ./date/theme/theme.inc
--- ./date_original/theme/theme.inc	2010-02-26 21:27:21.440058977 +0200
+++ ./date/theme/theme.inc	2010-02-26 21:15:06.188813107 +0200
@@ -111,7 +111,8 @@
     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);
+      //$url = $view->date_info->url .'/'. $view->date_info->year .'-'. date_pad($view->date_info->month);
+      $url = ((!$view->exposed_input['mini']) ? $view->date_info->url : $view->exposed_input['mini']);
       break;
     case 'day':
       $format = !empty($format) ? $format : (empty($view->date_info->mini) ? 'l, F j Y' : 'l, F j');
@@ -129,7 +130,8 @@
   if (!empty($view->date_info->mini) || $link) {
   	// Month navigation titles are used as links in the mini view.
    $attributes = array('title' => t('View full page month'));
-  	return l($title, $view->date_info->url, array('attributes' => $attributes));
+  	//return l($title, $view->date_info->url, array('attributes' => $attributes));
+    return l($title, $url, array('attributes' => $attributes));
   }
   else {
     return $title;
Sobrino’s picture

This patch (VladSavitsky) don't work for me.

do must be change other things?

vladsavitsky’s picture

Sobrino, did you use fresh Drupal and Date module to test it?

webwriter’s picture

subscribe

robbertnl’s picture

#24 doesn't work for me either, but the quick&dirty #8 works

karinha’s picture

I have php 5, but it is not working with me. Also tried work around #8... but it does not work :(. Anytime I select April, the calendar jumps back to March and the page view does not change... Is this working for anybody, or did I forget to do something?

hawleyal’s picture

subscribing

timjh’s picture

You've had quick & dirty - how about quicker and really filthy? I don't like applying module patches that might get lost at the next upgrade, so I fixed it in date-navigation.tpl.php. It may not work in every context, but you may be able to adapt it.

1. Copy date-navigation.tpl.php from modules/date/theme into your theme directory
2. Reload theme registry, flush every cache in sight
3. Edit your theme copy of date-navigation.tpl.php by replacing the line

<h3><?php print $nav_title ?></h3>

with

<h3><?php
  /* Hack the title link to go where it says instead of to the current month.
   * Method is to recalculate the title link based on the month specified in the "previous" link,
   *   which is always correct.
   * Uses date and mktime to reliably calculate title month, even at end of year.
   * Add a mini-calendar spec to the title link, as on previous and next links,
   *   so that mini-calendar matches main calendar on the new page.
   */
  $ss_title_month = date('Y-m', mktime(0, 0, 0, substr($prev_url,-2) + 1, 1, substr($prev_url,-7,4)));
  print preg_replace('%/calendar/.*?"%',
    "/calendar/$ss_title_month?mini=calendar/$ss_title_month\"",
    $nav_title, 1);
?></h3>
webwriter’s picture

Just updated to most recent dev, still having this issue.

Tried #31, cleared cache, rescanned template files... still not working. I even tried overwriting the tpl file directly in the module, no luck. I still only get the current month whenever the mini-calendar title is clicked, no matter what month is navigated to.

I have also upgraded to php5, but the issue is still active.

Morn’s picture

with #31
Got mktime error:
mktime() expects parameter 6 to be long, string given in /home/www/vtad/sites/all/themes/vtad_thema/date-navigation.tpl.php on line 51.
after going to Link http://www.vtad.de/calendar/2010-03-25?page=2 (or any other day link)

I also had to add if ($block) { .... } else { print $nav_title }
so that the monthly navigation of the "Year View" works.

andrewsuth’s picture

Priority: Normal » Critical

Setting to critical - being able to select the chosen month is a fairly basic expectation from a calendar block, if you ask me.

-martin-’s picture

Category: bug » support

This worked for me:

Date module -> themes -> date-navigation.tpl.php

Replace

<span class="next"> <?php print l('« ' . ($block ? '' : date_t('Prev', 'date_nav')), $prev_url, $prev_options); ?></span>
...
<span class="next"> <?php print l(' »' . ($block ? '' : date_t('Next', 'date_nav')), $next_url, $next_options); ?></span>

width

<span class="next"> <?php print l('« ' . ($block ? '' : date_t('Prev', 'date_nav')), str_replace(array('%2F','%2f','%252F'), array('/','/','/'), $prev_url), $prev_options); ?></span>
...
<span class="next"> <?php print l(' »' . ($block ? '' : date_t('next', 'date_nav')), str_replace(array('%2F','%2f','%252F'), array('/','/','/'), $next_url), $next_options); ?></span>
andrewsuth’s picture

Category: support » bug

Changing back to a bug report.

Finding a hacky solution doesn't change the status of the original problem.

webwriter’s picture

The above solution simply makes my next and previous navigation disappear entirely. I guess that's sort of a solution...

Gendelf_Lugansk’s picture

Worked for me:

in file sites/all/modules/date/theme/theme.inc change code

// TODO Update this.
if (!empty($view->date_info->mini) || $link) {
    // Month navigation titles are used as links in the mini view.
   $attributes = array('title' => t('View full page month'));
   return l($title, $view->date_info->url, array('attributes' => $attributes));
 }

to

// TODO Update this.
if (!empty($view->date_info->mini) || $link) {
   // Month navigation titles are used as links in the mini view.
   $attributes = array('title' => t('View full page month'));
   //return l($title, $view->date_info->url, array('attributes' => $attributes));
   //I don't know how, but this works :D
   return l($title, date_real_url($view, $granularity, $view->date_info->date_arg, true), array('attributes' => $attributes));
 }
gnindl’s picture

Applied patch from #38. Works for me.

hnln’s picture

I fixed it like this (requires no hacking, replace "yourmodule" with the correct module name or do it from the theme layer)

function yourmodule_preprocess_date_navigation(&$vars)
{
  $view = $vars['view'];
  $granularity = $view->date_info->granularity;
  if ($granularity == '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 = date_real_url($view, NULL, date_format($view->date_info->min_date, 'Y-m'), true);
    $vars['nav_title'] = l($title, $url);
  }
}
wmostrey’s picture

The custom function in #40 also fixed it for me, thanks!

Drupal Jedi’s picture

Can confirm that the module solution in #40 works wonderfullly.

karens’s picture

Status: Needs review » Fixed

None of the above was the right fix, which ended up being a little obscure. This should now be working. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.