Issue Details (XML | Word | Printable)

Key: MDL-10353
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Wen Hao Chuang
Reporter: Alan Trick
Votes: 17
Watchers: 25
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

calendar doesn't remember course properly in moodle (1.6-1.7)

Created: 06/Jul/07 12:28 AM   Updated: 30/Jan/09 09:44 AM
Return to search
Component/s: Calendar
Affects Version/s: 1.5.4, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.7, 1.7.1, 1.7.2
Fix Version/s: 1.8.4, 1.9

File Attachments: 1. Zip Archive calendar15x.zip (29 kB)

Image Attachments:

1. 0_AFTER_clicking_preferences_then_Calendar_breadcrumb.png
(82 kB)

2. 0_BEFORE_clicking_preferences.png
(73 kB)

3. After_click_on_Export_calendar_button.png
(125 kB)

4. after_create_a_new_course_event.png
(122 kB)

5. Before_click_on_Export_calendar_button.png
(136 kB)

6. calendar_course_id_back_to_3.png
(84 kB)

7. Calendar_Day_View.png
(176 kB)

8. Calendar_Editing_event.png
(167 kB)

9. calendar_export_breadcrumb_wrong_parameter.png
(115 kB)

10. calendar_not_listing_global_event.png
(112 kB)

11. when_you_create_a_new_event.png
(122 kB)
Environment: Probably irrelevant, but RHEL4 w/ apache2, php 5.2.0 and a remote MSSQL 2005 database
Issue Links:
Duplicate
 
Relates
 

Participants: Alan Trick, Anthony Borrow, Brad Hong, Chris Fryer, Frédéric Hoogstoel, Jeremy Hopkins, Joseph Rézeau, Ken Bauer, Martin Dougiamas, Nicolas Martignoni, Paul Stokes, Teresa Pomposo, Wen Hao Chuang and Yu Zhang
Security Level: None
QA Assignee: Nicolas Martignoni
Resolved date: 28/Jan/09
Affected Branches: MOODLE_15_STABLE, MOODLE_16_STABLE, MOODLE_17_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
If you go to the detailed view of a calendar from a course, it will include the course id in the url (e.g. calendar/view.php?view=month&course=13&cal_d=1&cal_m=06&cal_y=2007). However, all of the links in the calendar do not have the course parameter so you'll get something like calendar/view.php?view=month&cal_d=1&cal_m=06&cal_y=2007. Oddly enough, it still stores which course you came from because that shows up in the breadcrumb, but it must be in a cookie or something.

This is bad on a number of accounts.
1. If the user bookmarks what they think is their calendar in one course, they come back later and it's another course because the cookie got changed.
2. For admin users who are viewing calendars for courses their not enrolled in, this is a big problem. Only the URLs with the course parameter will display the course's events. So as soon as they try to navigate anywhere in the calendar, they can't see anything anymore.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Paul Stokes added a comment - 18/Jul/07 07:20 PM - edited
See thread http://moodle.org/mod/forum/discuss.php?d=75161

Affects 1.8.2 as well


Ken Bauer added a comment - 15/Aug/07 01:46 AM
I am seeing the same problem on three different installs of 1.8.2.

It appears that the &course=XY parameter is not being carried across on any links or in the javascript in the drop-down box for choosing the course to view.


Wen Hao Chuang added a comment - 20/Sep/07 02:15 AM
I think this is a big problem and it happens to 1.5.x, 1.6.x, 1.7.x and 1.8.x (also 1.9 beta)... should probably bump up the priority level...

Nicolas Martignoni added a comment - 21/Sep/07 08:20 PM
Raising priority, as this impears proper usage of calendar.

Wen Hao Chuang added a comment - 22/Sep/07 02:57 AM
Also adding Martin D to the watch list. Martin do you know if Jon still maintaining calendar? Thanks!

Wen Hao Chuang added a comment - 25/Sep/07 07:57 AM
Martin could you please take a look at this issue please? Thanks!

Wen Hao Chuang added a comment - 29/Sep/07 07:09 AM
This issue seems to be fixed by Yu, as I just did some testing and in 1.9 beta+ it will pass alone the courseid while the most recent moodle_18_stable still have not fixed this issue yet. Yu could you please confirm this? Thanks!

Nicolas Martignoni added a comment - 29/Sep/07 08:28 PM
Wen, I'm seeing the same as you (fixed in 1.9beta+ and NOT fixed in 1.8.x), but can't relate this to a recent commit.

Joseph Rézeau added a comment - 29/Sep/07 09:29 PM
Same as Nicolas, the problem is fixed in 1.9beta+ and NOT fixed in 1.8.x.
Martin or Yu, please can you fix this in 1.8.x ASAP?
JOseph

Brad Hong added a comment - 01/Oct/07 09:46 PM
Can someone fix this issue in 1.8.2 stable please.

Yu Zhang added a comment - 02/Oct/07 02:28 PM - edited
Hi guys, it's actually Derek from the Open University that fixed this. I have backported changes for calendar, please test and let me know if this can be closed.

Cheers,

Yu


Nicolas Martignoni added a comment - 02/Oct/07 07:56 PM
Seems to be partially fixed.

I can still reproduce the following issue:

1) In a course, go to the calendar view.
2) Observe that the course var is correctly set in the URL and the course is correctly selected in the drop down menu.
3) In the Month view (calendars on the right column), click in the title link (name of the month), e.g. "october 2007".
4) Observe that the course var disappears from the URL and that the dropdown menu shows now "All courses".

Thanks for fixing this.


Brad Hong added a comment - 02/Oct/07 10:31 PM
Dear Yu,

Could you let us know the contact detail (email will be good) of David or Derek from Open University. So I can ask him how to fix the bug for Version of 1.8.2. Many thanks.

Best wishes,
Brad


Wen Hao Chuang added a comment - 03/Oct/07 08:27 AM
Hi Brad, you could click on the "Version Control" tab above to see exactly what got committed, and you could use this to generate patch for 1.8.2. Hope this helps.

Nicolas, I agree with you. I did some testing and it IS partially fixed. The problem is that it's not consistent. For example, here is how you can reproduce the still existing problem:
1. Create a GROUP event (as sys admin) for Oct 15 2007
2. Then create a new COURSE event for Oct 22 2007. Here when you are creating the COURSE event, you will notice that the GROUP event that you just created is NOT displayed correctly (see screenshot).
3. After you finish creating the COURSE event, you will notice that the GROUP event that you just created for Oct 15 2007 is now back.

I will do some more testing and report back here..


Wen Hao Chuang added a comment - 03/Oct/07 08:29 AM - edited
by the way can anyone confirm the MDL-9772 is actually a dupe, or it is a different issue? Thanks!

Yu Zhang added a comment - 03/Oct/07 12:26 PM
Hi guys, thanks for the additional reports. These 2 issues should be fixed now, please update and report additional bugs, if any. Cheers, Yu

Nicolas Martignoni added a comment - 03/Oct/07 02:41 PM
Wen Hao, I can't confirm that MDL-9772 is a dupe, as the description of the problem doens't match.

But the problem seems old and I can't test on older versions.


Brad Hong added a comment - 03/Oct/07 05:05 PM - edited
Hi Wen Hao and Yu,

Thanks for letting me know. It seem works fine after download those updates.

Cheers,
Brad


Nicolas Martignoni added a comment - 03/Oct/07 05:34 PM
I can't manage to get group events correctly, neither in 1.8.2 (fresh from CVS) or in 1.9beta+ (fresh from CVS too). Can someone confirm that the bug is still present in this case.

All other issues seems to be gone. Thank you Yu


Joseph Rézeau added a comment - 03/Oct/07 06:12 PM
Just upgraded my moodle 1.8.2. Using calendar/view.php file ref:
<?php // $Id: view.php,v 1.77.2.9 2007/10/02 06:26:58 toyomoyo Exp $
With debugging set as : NORMAL: Show errors, warnings and notices

When I create a new event, upon event being saved I get 2 error messages:

      • Notice: Use of undefined constant CALENDAR_MAXCOURSES - assumed 'CALENDAR_MAXCOURSES' in C:\moodle\www\moodle18\moodle\calendar\view.php on line 264
      • Warning: Division by zero in C:\moodle\www\moodle18\moodle\calendar\view.php on line 264

Joseph


Wen Hao Chuang added a comment - 04/Oct/07 02:49 AM
I was able to reproduce Joseph's problem. I also found another two bugs for the new fix:

1. If you go into the "calendar" view then click on "Preferences" button on the upper-right corner (see screenshot), the course id won't carry over and therefore, if you "save changes" (even that you didn't change anything), then click on "Continue", then you will be redirected to /calendar/view.php without any parameters carry over. I double checked with the /calendar/preferences.php and noticed that it was not changed for this fix

2. If you navigate back to the Moodle Test Case course, then all of your events should now re-appear (as now the course=3 parameter is back), except the Global event (see the screenshot).

Yu could you help fixing these two issues please? Thanks so much!


Yu Zhang added a comment - 04/Oct/07 01:15 PM
Hi Guys,

Fixed in notice and warning, sorry, backported something from HEAD by accident.

Wen,

1) Fixed, but it's set in session not visible in URL, however you should return to the same course view after setting preferences.

2) There's a setting (a preference) "Upcoming events look-ahead" that determines how far ahead to look. I noticed in your screenshot the event is in Nov so you probably don't have it set for more than 30 days.

Cheers,

Yu


Wen Hao Chuang added a comment - 05/Oct/07 03:20 AM - edited
Yu, good job and thanks for fixing this so quickly, we really appreciate that!

Now that the above issues are fixed. I still notice that the calendar/export.php is untouched and so whenever you click on the "export calendar" button then your most of your events would be gone! Also, when you are on the export.php page, if you click on the Calendar link from the Breadcrumbs, again that redirect does not include the course ID (see screenshot #3 "calendar_export_breadcrumb_wrong_parameter.png" above) and therefore you will lost most of your events in the next page view (displayed by view.php). Thanks again for your efforts on fixing this issue!


Yu Zhang added a comment - 05/Oct/07 11:53 AM
Hi Wen,

You are right it's trying to get a course variable which is not being passed in at all. I changed to use the session referrer variable if available. Please test again, thanks!

Cheers,

Yu


Brad Hong added a comment - 05/Oct/07 06:36 PM
Hi guys,

I got a new error msg here after update all the files changed.

The error msg came out when I try to create new event inside calendar's monthly view:

Fatal error: Call to undefined function build_navigation() in /moodle/calendar/event.php on line 274

Any idea?

Cheers,
Brad


Wen Hao Chuang added a comment - 06/Oct/07 03:25 AM
Hi Yu, there are still some glitches (in 1.8):

1. under calendar/view.php at around line #136
$prefsbutton = calendar_preferences_button();
The calendar_preferences_button() does not pass over the course id info

2. under calendar/view.php at around line #165 (//Link to calendar export page), this line should also pass the course id
print_single_button('export.php', false, get_string('exportcalendar', 'calendar'));

By the way, I talked to Yu and I volunteered to backport all these fixes to 1.5 (currently only tested on 1.5), so far it works although I still need some more testing. I will try to clean them up a little bit and post the backported version (for 1.5, and possibly for 1.6, 1.7 too) here so that people could help testing them. Thanks!


Yu Zhang added a comment - 08/Oct/07 08:59 AM
Hi Brad, I don't see the code in 1.8, maybe you accidentally used the version from HEAD?

Wen, preference and export use session variable to keep tracker of the course id (for redirects, and headers). So I wasn't sure why course ids need to be passed in explicitly, please explain. Thanks.

Cheers,

Yu


Brad Hong added a comment - 08/Oct/07 08:47 PM
Hi Wen and Yu,

Thank you for your message. Can't connect with CVS this morning.

I download the wrong version of event.php file.
My moodle is version 1.8.2. So I need the v1.63.2.6 of event.php instead of V1.7.3.

Everything works fine after upload correct file. Many thanks you guys.

What's the V1.7.3 for? Is it for Moodle 1.9?

Cheers,
Brad


Brad Hong added a comment - 08/Oct/07 09:36 PM
Create a new event, works fine.
But if you choose to edit. The course id lost again.

Brad Hong added a comment - 08/Oct/07 09:38 PM
All events gone after edit a exiting event.

Brad Hong added a comment - 08/Oct/07 09:42 PM - edited
Hi guys,

New problem. Please see the attached photo of Calendar_Day_View.png and Calendar_Editing_evet.png.

The course id and events all disappeared after edit a excising event. Moodle version 1.8.2.

Cheers,
Brad


Wen Hao Chuang added a comment - 09/Oct/07 06:18 AM - edited
Just found that Jira would sort attached image files (screenshots) based on the filename so Brad's uploaded images should be #5 and #6 now.

I was able to reproduce the problem Brad reported. I think the switch($action) in event.php does handle case 'new' correctly but not the cases of 'edit' and possibly 'delete', Yu could you please take a look at this please?

Another separate issue. I also created screenshot #3 and #1 to demonstrate it probably still need course ID when you click on the "Export calendar" button (export.php) . As you could see if you login as an admin and login to one of the courses, then click on the "Export calendar" button, as the course ID was not carried over, so on your right hand view ("monthly view") many events will disappear. Same thing with "Preferences" button. Please let me know if you have questions. Thanks!


Nicolas Martignoni added a comment - 10/Oct/07 03:17 PM
The "group" issue for calendar display is dealed MDL-9059.

Nicolas Martignoni added a comment - 10/Oct/07 03:17 PM
Group/calendar issues

Yu Zhang added a comment - 11/Oct/07 01:29 PM
Hi guys,

Fixed the events not showing up problem in export, and when editing existing event. However, I was unable to reproduce the problem in preferences. Wen maybe you can help me there, can you tell me exactly how to reproduce the exact problem in preferences?

Cheers,

Yu


Nicolas Martignoni added a comment - 11/Oct/07 02:48 PM
Hi Yu,

I can't reproduce the preferences problem neither on 1.8.2+ or 1.9beta2. Even if the courseid isn't present in the URL, the session seems to take care of it and keeps the correct course id.

Suggesting closing of this bug, since the remaining problems (group issues with calendar) should be dealed in MDL-9059.


Wen Hao Chuang added a comment - 12/Oct/07 08:57 AM - edited
Yu, I think you fixed the export one. Good job!
However, I still can easily reproduce the preferences bug. Here are steps to reproduce:

Login as admin
1. Create two courses and assign them to one teacher, create whole bunch of events for both courses (very important)
2. Login as that teacher, get into one of the two courses, and click on Calendar, say October 2007 (see screenshot BEFORE_clicking_preferences.png)
3. Click on the "Preferences" button on the upper-right corner
4. Notice now that course ID was not passed over and the preferences.php shows ? at the end (although the session should have passed over), now do NOT click on "Save changes", click on the "Calendar" on the breadcrumb (navigation) bar, now suddenly you will be able to see BOTH course events, and the "Upcoming Events" pull-down menu is now reset to "All courses" (see screenshot AFTER_clicking_preferences_then_Calendar_breadcrumb.png)

It's not a major issue, but it could get teachers confused if they don't know they should use the "Upcoming Events" pull down menu and set it back to one course only. I have identified where need to be fixed. In preferences.php line#61, the $navigation should probably be handled similar to how $nav is handled in both view.php (line#70) or export.php (line#25), what do you think? This should be able to fix this issue. Hope this helps.


Yu Zhang added a comment - 15/Oct/07 12:48 PM
Thanks Wen, should be fixed now. Closing this long bug =)

Wen Hao Chuang added a comment - 16/Oct/07 07:34 AM
Yu, thanks again for everything! By the way I hope that you don't mind me reopen this ticket as this is a critical bug across moodle 1.5.x to 1.9, and I thought it would be a good idea if we could also get it fixed (back port the fix) to 1.5, 1.6, and 1.7. What do you think?

I have back ported the fixes to moodle 1.5.x and I could do the same thing with 1.6.x and 1.7.x too. Attached please find the fix for 1.5. I tested it throughly but it would be good if someone could help testing it before I commit it to the MOODLE_15_STABLE branch. Thanks!


Yu Zhang added a comment - 17/Oct/07 11:09 AM
Hi Wen, not at all! Please keep this opened for as long as you need, cheers!

Teresa Pomposo added a comment - 24/Oct/07 06:34 PM
Hello,
Is there any fix available for 1.8.2?

Thanks.


Wen Hao Chuang added a comment - 26/Oct/07 12:56 AM
Hi Teresa, the fix for 1.8.2 is already committed into MOODLE_18_STABLE. You just need to upgrade your 1.8.2 installation to the latest 1.8.x codes (through moodle cvs or download.moodle.org) and you will be able to get this fix. If you want to manually fix it you could also click on the "Version Control" tab in this ticket to see how to patch your current code. Hope this helps.

Jeremy Hopkins added a comment - 03/Nov/07 12:48 AM
There is still an error in the 1.8 files:

On line the 249 of event.php an HTML representation of the "&" character is used.

This should be changed to a literal value, i.e. change & to &


Chris Fryer added a comment - 05/Nov/07 07:39 PM
In fact, the HTML-encoded ampersand is the only "correct" one on that line. XHTML demands that & be encoded as & even in URLs.

http://www.w3.org/TR/xhtml1/#C_12

So the other ones on that line need changing.


Jeremy Hopkins added a comment - 05/Nov/07 08:03 PM - edited
Hi Chris,

That line of code never render's to (X)HTML, it is used in a redirect.


Nicolas Martignoni added a comment - 07/Feb/08 11:46 PM
Wen,

Can we close this now?


Wen Hao Chuang added a comment - 08/Feb/08 02:26 AM
Nicolas, if it is ok with you let's lower the priority on this one but still keep it open. The thing is, this bug got fixed in 1.8, 1.9, and 1.5 (I backported it), but I haven't got a chance to backport the fix to 1.6 and 1.7 yet so people who are using moodle 1.6 and 1.7 might still find calendar events got disappeared for no reason... Once I'm less busy I will help backporting the fix to 1.6 and 1.7 (or if there is any volunteer that would be great too). thanks!

Nicolas Martignoni added a comment - 08/Feb/08 02:38 AM
OK, no problem. Thanks for your work !

Frédéric Hoogstoel added a comment - 28/Jan/09 07:19 PM
Don't you think that :
Version 1.8.2 should appear in affect version(s) list ?
Versions 1.8.4 and 1.9 should appear in Fix version(s) list ?
the initial title or this issue should ne restored ?

It would be easier to find how to solve this issue when we use version 1.8.2.


Martin Dougiamas added a comment - 28/Jan/09 10:42 PM
Versions fixed.

Frédéric Hoogstoel added a comment - 28/Jan/09 10:59 PM
Thank you Martin for you fast reaction to my comment.
Why did you not add 1.8.2 in affect versions list and why did you remove versions 1.6.9 and 1.7.8 from fix versions list ?

Frédéric Hoogstoel added a comment - 28/Jan/09 11:02 PM
I forgot to explain that, in my opinion, "(1.6-1.7)" should be removed from title now since the bug is fixed.

Anthony Borrow added a comment - 30/Jan/09 09:44 AM
Frédéric - From what I can tell looking at the long history of this issue in the tracker it was originally fixed for Moodle 1.8 and onward (i.e. in HEAD). Some continued tweaking was done after Moodle 1.9 was released and those were applied. Wen had wanted to backport the fixes to Moodle 1.5, 1.6, and 1.7; however, I suspect that after some work on Moodle 1.5 version he became busy and simply was unable to patch the fixes for Moodle 1.6 and 1.7. I suspect Martin came along and wanted to re-close the issue since it is fixed for Moodle 1.8 onward and basically noted that it will not be fixed for Moodle 1.6 or Moodle 1.7. If folks are having difficulty with this issue they should upgrade to Moodle 1.8. There is no need to worry (IMHO) about the reference to 1.6 or 1.7 in the title. That was what the person filing the issue had wanted but it simply is not what happened. Regardless, it is resolved as fixed so I think we can leave things as it is. Let me know if you have any other questions. Peace - Anthony