Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-7574

Dates Disappear when you "turn editing on"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.3, 1.8.3, 1.9
    • Component/s: JavaScript
    • 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...

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              vyshane 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
              vyshane 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
              mina Nicolas Martignoni added a comment -

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

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

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

              Show
              dougiamas Martin Dougiamas added a comment - Assigning to me temporarily because Vy-Shane no longer works for Moodle HQ.
              Hide
              syxton 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
              syxton 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
              riwebb 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
              riwebb 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
              dougiamas Martin Dougiamas added a comment -

              Hi, Nicolas

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

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

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

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

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Oct/07