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

Select categories widgets does not properly handle   entities

    XMLWordPrintable

Details

    • MOODLE_32_STABLE, MOODLE_35_STABLE, MOODLE_37_STABLE
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MDL-57678-master-3
    • Hide
      1. Create a site with several categories.
      2. Set up some course categories under another category.
      3. Go to "Site administration / Plugins / Enrolments"
      4. Enable the "LDAP enrolments" and the "External database" enrolment plugins.
      5. Go to the "Settings" page of the "LDAP enrolments" enrolment plugin.
      6. Under "Automatic course creation settings", expand the "Category" field.
      7. Confirm that the course categories are listed without " ".
      8. Go to the "Settings" page of the "External database" enrolment plugin.
      9. Expand the "Default new course category" field.
      10. Confirm that the course categories are listed without " ".
      Show
      Create a site with several categories. Set up some course categories under another category. Go to " Site administration / Plugins / Enrolments " Enable the " LDAP enrolments " and the " External database " enrolment plugins. Go to the " Settings " page of the " LDAP enrolments " enrolment plugin. Under " Automatic course creation settings ", expand the " Category " field. Confirm that the course categories are listed without "   ". Go to the " Settings " page of the " External database " enrolment plugin. Expand the " Default new course category " field. Confirm that the course categories are listed without "   ".
    • 0
    • International 4.0 - Sprint 1, International 4.0 - Sprint 2

    Description

      We have found a minor regression of MDL-55564 which we stumbled upon while working on one of our plugins but which can also be seen on /admin/settings.php?section=enrolsettingsldap:

      • There is a settings widget to display a list of categories. The content of the widget is fetched from make_categories_options() in /course/lib.php. The function returns a list of categories which is indented by

         

        entities.

      • In 3.2, the list of categories is not correctly indented anymore because the

         

        entities arrive in the browser as

         

        (tested in theme_boost and theme_clean).

      • According to davosmith who investigated this problem for us,

        the reason for the output is MDL-55564 - all the admin settings are now output via templates, which means that the code is automatically cleaned to escape any potentially bad characters (& < >). Unfortunately, this leads to the spaces becoming double-encoded in this case.

      In our plugin, we will handle this problem as an intermediate solution by using

              $categories = make_categories_options();
              foreach ($categories as $id => $category) {
                  $categories[$id] = html_entity_decode($category);
              }
      

      before creating the settings widget (as a reference for the reviewer: https://github.com/moodleuulm/moodle-local_resort_courses/blob/master/settings.php#L64), but it would be nice if this problem could be investigated by Moodle HQ as the function make_categories_options() is designed to output the list indented, but the template rendering doesn't seem to be compatible anymore.

      Thanks,
      Alex

      Attachments

        Issue Links

          Activity

            People

              jpataleta Jun Pataleta
              abias Alexander Bias
              Simey Lameze Simey Lameze
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Janelle Barcega Janelle Barcega
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Sep/20

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours, 27 minutes
                  5h 27m