Moodle

Ajax vs. weekly format

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 1.9.5, 1.9.6
  • Component/s: AJAX
  • Labels:
    None
  • Environment:
    apache, php 4.3.2, mysql 4.1.16
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

If I enable Ajax, I can't see the dates in the weekly format of a course.

  1. format.php.diff
    03/Aug/07 8:45 PM
    1.0 kB
    Matthew Davidson
  2. section_classes.js.diff
    03/Aug/07 8:45 PM
    2 kB
    Matthew Davidson

Issue Links

Activity

Hide
Matthew Davidson added a comment - - edited

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 - - edited 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
Nicolas Connault added a comment -

It appears that this patch has already been applied to 1.9...

Show
Nicolas Connault added a comment - It appears that this patch has already been applied to 1.9...
Hide
Nicolas Connault added a comment -

This patch is already applied to 1.7, 1.8 and 1.9, and works fine (I ought to know, I applied the patch and tested this myself 3 weeks ago!). Please explain why this report is coming up again, and provide some screenshots if possible.

Show
Nicolas Connault added a comment - This patch is already applied to 1.7, 1.8 and 1.9, and works fine (I ought to know, I applied the patch and tested this myself 3 weeks ago!). Please explain why this report is coming up again, and provide some screenshots if possible.
Hide
Rossiani Wijaya added a comment -

Resolved

Closing

Show
Rossiani Wijaya added a comment - Resolved Closing

People

Dates

  • Created:
    Updated:
    Resolved: