I've got event installed. But when using the month view, fabruary 29 is shown on a Monday instead of Friday. It does not have anything to do with which the day of the week it starts with.

CommentFileSizeAuthor
#10 event.JPG26.24 KBWoeka
#10 event.module.patch1.15 KBWoeka
#1 event_calendar.jpg48.17 KBcjeanson

Comments

cjeanson’s picture

StatusFileSize
new48.17 KB

I can confirm this as well, noticed on the fresh Drupal 6 RC4 installation + event setup I just set up.

cjeanson’s picture

Priority: Normal » Critical

Updating to critical, can't have the calendar displaying improperly!

Wish I knew PHP better, I would try to fix this myself!

wyllie’s picture

Title: February leap year view problem » February leap year view problem - not just February but all months...

Not sure if this helps or not - but it's not just February, but all of the months are displaying incorrectly for the last week of the month.

wyllie’s picture

Hey, I took a look at the code and made the following change in event.module around line 635
which seems to take care of the problem:

if ($cur_date['day'] >= $last_date['day']) {
last;
#$x = 8;
}

Sorry, I'm new to drupal and I have not really figured out how to submit an official patch yet.

Thanks,
Andrew

cjeanson’s picture

What did you change?

Without posing what you changed, I am at a bit of a loss as to what should be done.

wyllie’s picture

Oh,sorry about that.

In the original event.module file, around line 635, the code set $x=8 to get out of the for loop. I changed that to a 'last;' instead which is much cleaner and that's it.

I'm not sure why this really makes a difference because $x is not used again as far as I can tell but that change fixed the problem.

cjeanson’s picture

Hrm, I added the line of code and it didn't seem to make any difference to my site.

I wonder if this will be addressed by an Event coder...

wyllie’s picture

Hey, I haven't tried this one myself, but I saw another fix on the version 5 branch of this module. They changed the conditional statement to look like this:

orig:
if ($cur_date['day'] >= $last_date['day']) {
$x = 8;
}

new:
if ($cur_date['day'] > $last_date['day']) {
$x=8;
}

So, basically they just changed the '>=' to a '>'.

Like I said before, I just change the $x=8 to a last statement:
if ($cur_date['day'] >= $last_date['day']) {
last;
}

maybe that will help?

cjeanson’s picture

Golden!

Now, I will see if I can figure out how to write a proper patch and we'll be good to go!

Woeka’s picture

Title: February leap year view problem - not just February but all months... » February leap year view problem - not just February but all months - showing days of next month
StatusFileSize
new1.15 KB
new26.24 KB

Well I didn't know where to look, but with the pointers from you people I fixed the problem.

The line of code was probably meant to end the loop when the last day of the month is over. Preventing the calender to show days of the next month.

This is what I've changed, somewhere around line 630:

 
    for ($x = $start; $x < 7; $x++) {
      $cur_day = (($week * 7) + ($x + 1) - $offset);
      if ($cur_date['day'] <= $last_date['day']) {
        $row[$x] = array(
          'class' => strtolower($weekdays[$x]['day']) .' day-'. $cur_date['day'] . ($cur_date == $today ? ' today' : '') . ($cur_date['day'] == $day ? ' selected' : ''),
          'data' => $callback($cur_date, $view, $types, $terms, $rewrite_parameter));
      }
      if ($cur_date['day'] == $last_date['day']) {
        $x = 8;
      }
      $cur_date = event_date_later($cur_date, 1);
    }

See also the patch

Woeka’s picture

Assigned: Unassigned » Woeka
Status: Active » Patch (to be ported)
Woeka’s picture

Status: Patch (to be ported) » Needs review
cjeanson’s picture

Code change works really well. The event module is really starting to come along!

mattjabs’s picture

I installed the patch successfully & now everything is working great!

Thanks.

PS...for those of you who don't know how to install a patch (like I didn't), here's how I did it:

On CentOS 5, I installed "patch" via yum with this command:

yum install patch

Then I copied the patch file into the event module directory and ran the following command and all is now good:

patch -bi event.module_58.patch

Sorry to the drup experts for this newbie type post, but I figured it may be helpful to some.

cjeanson’s picture

Title: February leap year view problem - not just February but all months - showing days of next month » Last week in every month does not display properly in month view.

Updated title so a few more people may try out the patch before it is readied to be committed...

PhilUK’s picture

Isn't a better fix - Drupal 6.0 - Events v 1.352

while (event_is_later($last_date, $cur_date)) {
$week = 0;
for ($x = $start; $x < 7 && event_is_later($last_date, $cur_date); $x++) {
$cur_day = (($week * 7) + ($x + 1) - $offset);
$row[$x] = array(
'class' => strtolower($weekdays[$x]['day']) .' day-'. $cur_date['day'] . ($cur_date == $today ? ' today' : '') . ($cur_date['day'] == $day ? ' selected' : ''),
'data' => $callback($cur_date, $view, $types, $terms, $rewrite_parameter));
$cur_date = event_date_later($cur_date, 1);
//if ($cur_date['day'] >= $last_date['day']) {
// last;
//}
}
$week++;
$start = 0;
$tbody[] = array_pad($row, 7, array('class' => 'pad'));
$row = array();
}

As this doesn't then show any of next months proceeding dates? I'm like above a Drupal and PHP noob - so no idea how to get this fix into a release.

drdrup’s picture

I too encountered the same original problem.

I didn't try the patches yet. However, I just updated the event module on another site, with Drupal 5. The calendar display was OK before (ver of 2008.01.01), but the new version (ver of 2008.02.08) of "event" messed it up in the same way.

The difference was only one line, where ">" was changed to ">=" by the author. I have no idea why. I switched it back to ">", and the problem seems to go away.

I don't speak PHP'ish good enough to explore the difference between this and the patches offered above.

--- event.module_20080101       2008-01-01 16:37:57.000000000 -0700
+++ event.module_20080208       2008-02-08 10:06:52.000000000 -0700
@@ -1,5 +1,5 @@
 <?php
-// $Id: event.module,v 1.348 2008/01/01 23:37:57 killes Exp $ 
+// $Id: event.module,v 1.348.2.1 2008/02/08 17:06:52 killes Exp $ 
 
 define('EVENT_API', '5.2');
 define('EVENT_PATH', drupal_get_path('module', 'event'));
@@ -566,7 +566,7 @@
         'class' => strtolower($weekdays[$x]['day']) . ' day-'. $cur_date['day'] . ($cur_date == $today ? ' today' : '') . ($cur_date['day'] == $day ? ' selected' : ''),
         'data' => $callback($cur_date, $view, $types, $terms, $rewrite_parameter));
       $cur_date = event_date_later($cur_date, 1);
-      if ($cur_date['day'] > $last_date['day']) {
+      if ($cur_date['day'] >= $last_date['day']) {
         $x = 8;
       }
     }
Woeka’s picture

Changing only the >= doesn't stop the calender to go on and show days of the next month in the monthly calender. That will only fix the location of the week.

manerhabe’s picture

Changing the >= to > on line 569 seemed to work for me. Thanks!

killes@www.drop.org’s picture

Status: Needs review » Fixed

Thanks, I've fixed this in both 5.2 and D6 dev releases as indicated by PhilUK in #16.

cjeanson’s picture

Status: Fixed » Active

Now I get a list of errors and events don't display in the calendar since the update. They are displayed in list view, but in month view the module appears broken.

This is what I get:

* warning: include(./modules/event/event-node-month.tpl.php) [function.include]: failed to open stream: No such file or directory in [snip]/theme.inc on line 963.
* warning: include() [function.include]: Failed opening './modules/event/event-node-month.tpl.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in [snip]/theme.inc on line 963.
* warning: include(./modules/event/event-node-month.tpl.php) [function.include]: failed to open stream: No such file or directory in [snip]/theme.inc on line 963.
* warning: include() [function.include]: Failed opening './modules/event/event-node-month.tpl.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in [snip]/theme.inc on line 963.

It appears to me the problem is that event-node-month.tpl.php doesn't exist. Not in the current version, or in any other version.

katesouthworth’s picture

i had this problem too -i.e list of errors

* warning: include(./modules/event/event-node-month.tpl.php) [function.include]: failed to open stream: No such file or directory in [snip]/theme.inc on line 963.
* warning: include() [function.include]: Failed opening './modules/event/event-node-month.tpl.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in [snip]/theme.inc on line 963.
* warning: include(./modules/event/event-node-month.tpl.php) [function.include]: failed to open stream: No such file or directory in [snip]/theme.inc on line 963.
* warning: include() [function.include]: Failed opening './modules/event/event-node-month.tpl.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in [snip]/theme.inc on line 963.

. i renamed the event-node-day.tpl.php to event-node-month.tpl.php and uploaded. this removed all the warnings.

i changed all the refs from 'day' to 'month' on the tpl.php - but don't know quite what that will do. 'm an artist not a coder so my logic is a bit different to you guys.

cjeanson’s picture

I will be honest, I didn't even look at how to fix the latest release. I reverted to the previous version and it works great again. I am surprised such an important module doesn't have more active development. I love Event!

macgirvin’s picture

subscribe

killes@www.drop.org’s picture

Status: Active » Fixed

This is fixed. The errors posted were from another issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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