Moodle

Dates Disappear when you "turn editing on"

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.7
  • Fix Version/s: 1.7.3, 1.8.3, 1.9
  • Component/s: AJAX
  • Labels:
    None
  • Environment:
    Linux Server Apache 1.3.34, MySQL 4.1.21, PHP, 4.4.4, Also running UTF-8 En, JP, Zn
  • Affected Branches:
    MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

When you turn editing on in any of the courses the Dates disappear. Personally i dont think this is a big problem, but my teachers are nearly about to kill me after upgrading...

  1. format.php.diff
    03/Aug/07 8:45 PM
    1.0 kB
    Matthew Davidson
  2. section_classes.js.diff
    03/Aug/07 8:39 PM
    2 kB
    Matthew Davidson
  1. screenshot-1.jpg
    443 kB
    16/Nov/06 8:34 AM

Issue Links

Activity

Hide
Vy-Shane Sin Fat added a comment -

I've fixed this for non ajax course editing.

However, the dates will still disappear if you are using ajax to edit the course. This is a temporary measure until we are able to update the section dates during drag and drop.

Show
Vy-Shane Sin Fat added a comment - I've fixed this for non ajax course editing. However, the dates will still disappear if you are using ajax to edit the course. This is a temporary measure until we are able to update the section dates during drag and drop.
Hide
Nicolas Martignoni added a comment -

Confirming that this is fixed for NON ajax course editing, with fresh 1.7+ from CVS.

Show
Nicolas Martignoni added a comment - Confirming that this is fixed for NON ajax course editing, with fresh 1.7+ from CVS.
Hide
Martin Dougiamas added a comment -

Assigning to me temporarily because Vy-Shane no longer works for Moodle HQ.

Show
Martin Dougiamas added a comment - Assigning to me temporarily because Vy-Shane no longer works for Moodle HQ.
Hide
Matthew Davidson added a comment -

There are two instances of the following line of code in section_classes.js

main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);

Before each instance add this line.

main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);

Then add this function to section_classes.js

section_class.prototype.swap_dates = function(el){
var i=0;
while(this.getEl().getElementsByTagName("div")[i]) {
if (this.getEl().getElementsByTagName("div")[i].className == "weekdates") {
var tempdate = this.getEl().getElementsByTagName("div")[i].innerHTML;
var permi = i;
}
i++;
}

var j=0;
while(el.getEl().getElementsByTagName("div")[j]) {
if (el.getEl().getElementsByTagName("div")[j].className == "weekdates") {
var permj = j;
}
j++;
}

if(tempdate)
{
this.getEl().getElementsByTagName("div")[permi].innerHTML = el.getEl().getElementsByTagName("div")[permj].innerHTML;
el.getEl().getElementsByTagName("div")[permj].innerHTML = tempdate;
}
}

Also, you will have to change format/weeks/format.php

if (ajaxenabled() && $editing) { // Temporarily hide the dates for the weeks. We do it this way // for now. Eventually, we'll have to modify the javascript code // to handle re-calculation of dates when sections are moved // around. For now, just hide all the dates to avoid confusion. $weekperiod = ''; } else { $weekperiod = $weekday.' - '.$endweekday; }

to just this line
$weekperiod = $weekday.' - '.$endweekday;

Show
Matthew Davidson added a comment - There are two instances of the following line of code in section_classes.js main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]); Before each instance add this line. main.sections[i].swap_dates(main.sections[eval(loopmodifier)]); Then add this function to section_classes.js section_class.prototype.swap_dates = function(el){ var i=0; while(this.getEl().getElementsByTagName("div")[i]) { if (this.getEl().getElementsByTagName("div")[i].className == "weekdates") { var tempdate = this.getEl().getElementsByTagName("div")[i].innerHTML; var permi = i; } i++; } var j=0; while(el.getEl().getElementsByTagName("div")[j]) { if (el.getEl().getElementsByTagName("div")[j].className == "weekdates") { var permj = j; } j++; } if(tempdate) { this.getEl().getElementsByTagName("div")[permi].innerHTML = el.getEl().getElementsByTagName("div")[permj].innerHTML; el.getEl().getElementsByTagName("div")[permj].innerHTML = tempdate; } } Also, you will have to change format/weeks/format.php if (ajaxenabled() && $editing) { // Temporarily hide the dates for the weeks. We do it this way // for now. Eventually, we'll have to modify the javascript code // to handle re-calculation of dates when sections are moved // around. For now, just hide all the dates to avoid confusion. $weekperiod = ''; } else { $weekperiod = $weekday.' - '.$endweekday; } to just this line $weekperiod = $weekday.' - '.$endweekday;
Hide
Richard Webb added a comment - - edited

Matthew Davidson's fix takes care of the problem for those with ajax enabled (at least with Moodle 1.8 x and Moodle 1.9 Beta)!

Show
Richard Webb added a comment - - edited Matthew Davidson's fix takes care of the problem for those with ajax enabled (at least with Moodle 1.8 x and Moodle 1.9 Beta)!
Hide
Martin Dougiamas added a comment -

Hi, Nicolas

Looks like this can just go in as it is. Thanks!

Show
Martin Dougiamas added a comment - Hi, Nicolas Looks like this can just go in as it is. Thanks!
Hide
Nicolas Connault added a comment -

The patch was applied successfully to 1.7, 1.8 and HEAD.

Show
Nicolas Connault added a comment - The patch was applied successfully to 1.7, 1.8 and HEAD.

Dates

  • Created:
    Updated:
    Resolved: