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

Activity dates string should render raw unescaped HTML

XMLWordPrintable

    • MOODLE_402_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78704-401
    • MDL-78704-master
    • Hide

      Pre-condition:

      1. Update the following strings in lang/en/langconfig.php to:

      $string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p <strong>(UTC%z)</strong>';
      $string['strftimedatetime'] = '%d %B %Y, %I:%M %p  <strong>(UTC%z)</strong>';
      

      (You can also do this from the lang customisation page from the web interface if logged in as an admin.)

      2. Create an activity (eg Assignment) and set start and due dates.

      3. Also set a date availability restriction for this activity.

       

      Without the patch:

      1. View the activity on the course page.
      2. For the activity date, you should see the html <strong> element displayed instead of the text being bold.
      3. The date restriction is displayed with bold formatting. You do not see any html elements.

       

      With the patch:

      1. View the activity on the course page.
      2. For the activity date, you should see the date with the timezone in bold. You do not see any html elements.
      3. The date restriction is displayed with bold formatting. You do not see any html elements.
      Show
      Pre-condition: 1. Update the following strings in lang/en/langconfig.php to: $string [ 'strftimedaydatetime' ] = '%A, %d %B %Y, %I:%M %p <strong>(UTC%z)</strong>' ; $string [ 'strftimedatetime' ] = '%d %B %Y, %I:%M %p  <strong>(UTC%z)</strong>' ; (You can also do this from the lang customisation page from the web interface if logged in as an admin.) 2. Create an activity (eg Assignment) and set start and due dates. 3. Also set a date availability restriction for this activity.   Without the patch: View the activity on the course page. For the activity date, you should see the html <strong> element displayed instead of the text being bold. The date restriction is displayed with bold formatting. You do not see any html elements.   With the patch: View the activity on the course page. For the activity date, you should see the date with the timezone in bold. You do not see any html elements. The date restriction is displayed with bold formatting. You do not see any html elements.

      When activity dates are rendered by the mustache template, it is HTML escaped.

      If you have a lang string customisation such as given below, then you see HTML snippets when the date is rendered.

      $string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p <strong>(UTC%z)</strong>';

       

      The availability conditions, on the other hand, render the html correctly.

            rjnl Rajneel Totaram
            rjnl Rajneel Totaram
            Amaia Anabitarte Amaia Anabitarte
            Andrew Lyons Andrew Lyons
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 1 minute
                1h 1m

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