Closed (fixed)
Project:
Event
Version:
6.x-2.x-dev
Component:
Event Views
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
12 Feb 2008 at 17:36 UTC
Updated:
10 May 2008 at 21:21 UTC
Jump to comment: Most recent file
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.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | event.JPG | 26.24 KB | Woeka |
| #10 | event.module.patch | 1.15 KB | Woeka |
| #1 | event_calendar.jpg | 48.17 KB | cjeanson |
Comments
Comment #1
cjeanson commentedI can confirm this as well, noticed on the fresh Drupal 6 RC4 installation + event setup I just set up.
Comment #2
cjeanson commentedUpdating to critical, can't have the calendar displaying improperly!
Wish I knew PHP better, I would try to fix this myself!
Comment #3
wyllie commentedNot 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.
Comment #4
wyllie commentedHey, 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
Comment #5
cjeanson commentedWhat did you change?
Without posing what you changed, I am at a bit of a loss as to what should be done.
Comment #6
wyllie commentedOh,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.
Comment #7
cjeanson commentedHrm, 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...
Comment #8
wyllie commentedHey, 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?
Comment #9
cjeanson commentedGolden!
Now, I will see if I can figure out how to write a proper patch and we'll be good to go!
Comment #10
Woeka commentedWell 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:
See also the patch
Comment #11
Woeka commentedComment #12
Woeka commentedComment #13
cjeanson commentedCode change works really well. The event module is really starting to come along!
Comment #14
mattjabs commentedI 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.
Comment #15
cjeanson commentedUpdated title so a few more people may try out the patch before it is readied to be committed...
Comment #16
PhilUK commentedIsn'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.
Comment #17
drdrup commentedI 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.
Comment #18
Woeka commentedChanging 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.
Comment #19
manerhabe commentedChanging the >= to > on line 569 seemed to work for me. Thanks!
Comment #20
killes@www.drop.org commentedThanks, I've fixed this in both 5.2 and D6 dev releases as indicated by PhilUK in #16.
Comment #21
cjeanson commentedNow 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.
Comment #22
katesouthworth commentedi 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.
Comment #23
cjeanson commentedI 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!
Comment #24
macgirvin commentedsubscribe
Comment #25
killes@www.drop.org commentedThis is fixed. The errors posted were from another issue.
Comment #26
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.