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

HTML Entities Not Decoded in Activity Name for Manual Completion Checkbox

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Deferred
    • Affects Version/s: 3.5.3
    • Fix Version/s: None
    • Component/s: Activity completion
    • Labels:
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      Steps to reproduce
      ===============

      1. Create an Activity with HTML entities in the name, such as:

      A "Test" Activity & Perhaps More & Then Some

      2. Enable course's Completion Tracking and an activity's manual Activity Completion.

      3. Hover over the activity's completion checkbox to see the title text with HTML entities.

      Actual result
      ==========

      For example, when hovering over its checkbox, an incomplete activity having the name from above will show with HTML entities. Note the single "&" is converted to &

      Not complete: A "Test" Activity & Perhaps More & Then Some. Select to mark as complete.

      If you then toggle the checkbox to Incomplete, it will still show with HTML entities as:

      Completed: A "Test" Activity & Perhaps More & Then Some. Select to mark as not complete."

      But notice that only the explicitly specified & stays encoded, while the last ampersand now displays correctly as a single "&", as it was originally in the activity name.

      Expected result
      ============

      All strings with the activity name should always show with decoded HTML entities. In the example above, it should show as it does on the activity page itself:

       A "Test" Activity & Perhaps More & Then Some

      Other points
      ==========

      • The text for the initial page load is handled by course_section_cm_completion() in /course/renderer.php. I imagine the fix might be to just add $imgalt = html_entity_decode($imgalt).
      • However, subsequent clicks to toggle the completion checkbox on and off will go through /course/completion.js. The JS code will also need to decode the HTML entities, since it is pulling the activity name (module name) from the hidden <input name="modulename"> element.
      • Similar issue: https://tracker.moodle.org/browse/MDL-59797

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                nyanginator Nicholas Yang
                Participants:
                Component watchers:
                Sam Marshall, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: