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

Activity completion when Activities have apostrophes breaks alt text

XMLWordPrintable

    • MOODLE_23_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • Hide

      0. Ensure completion tracking is enabled in advanced features.
      1. Create a new empty course with completion tracking enabled (leave other settings default).
      2. Add a new forum to the first week of the course. Set completion to automatic, requiring 1 post. Set name to: argh'"s forum
      3. Turn editing off.
      4. View source. Search for all instances of the string "argh" so as to find the 'argh'"s forum' strings regardless of how they are quoted.

      BEFORE FIX: Some of those instances are invalid HTML code because they contain a single quote inside an attribute that is single-quoted. Firefox displays these in red in its source view.

      EXPECTED: Any instances that are in attributes should be escaped suitably for the surrounding quotes.

      5. Go into the forum and post a message.
      6. Go back to the homepage (the box should be ticked) and view source again to check that the strings are still quoted.

      Show
      0. Ensure completion tracking is enabled in advanced features. 1. Create a new empty course with completion tracking enabled (leave other settings default). 2. Add a new forum to the first week of the course. Set completion to automatic, requiring 1 post. Set name to: argh'"s forum 3. Turn editing off. 4. View source. Search for all instances of the string "argh" so as to find the 'argh'"s forum' strings regardless of how they are quoted. BEFORE FIX: Some of those instances are invalid HTML code because they contain a single quote inside an attribute that is single-quoted. Firefox displays these in red in its source view. EXPECTED: Any instances that are in attributes should be escaped suitably for the surrounding quotes. 5. Go into the forum and post a message. 6. Go back to the homepage (the box should be ticked) and view source again to check that the strings are still quoted.

      This has been fixed for the manual Activity completion case (see MDL-36808), however it hasn't been fixed when the completion is set to automatic.

      This is also fixed for 2.5 due to a refactoring (see MDL-37085), but has yet to be fixed in the 2.4 branch.

      The following code (taken from http://git.moodle.org/gw?p=moodle.git;a=blob;f=course/lib.php;hb=refs/heads/MOODLE_24_STABLE )

      /course/lib.php 1681-1685

                           } else {
                               // In auto mode, or when editing, the icon is just an image
                               echo "<span class='autocompletion'>";
                               echo "<img src='$imgsrc' alt='$imgalt' title='$imgalt' /></span>";
                           }
      

      should be replaced with this (ported from the 2.5 branch)

      Fixed /course/lib.php

                          } else {
                              // In auto mode, or when editing, the icon is just an image
                              $completionpixicon = new pix_icon('i/completion-'.$completionicon, $imgalt, '',
                                      array('title' => $imgalt));
                              echo html_writer::tag('span', $OUTPUT->render($completionpixicon),
                                      array('class' => 'autocompletion'));
                          }
      

            quen Sam Marshall
            jmlsteele Jody Steele
            Mark Nelson Mark Nelson
            Dan Poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.