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

Standard sections edit form allows HTML and quick edit strips it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.5, 3.7
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_37_STABLE

      Description

      The standard sections edit form allows HTML Tags to be saved as the title of the section but the title is stripped of HTML tags before rendering and also the quick edit form strips the tags before saving to the db.

       

      Steps to Reproduce

      1. Create a course with Topics Format.
      2. Edit one of the sections of the course and enter custom name for the title with some HTML tags.
      3. Hit Save
      4. Return to the course page
      5. Turn Editing On and quick edit the previously edited section.
      6. See the tags appearing only in edit mode.
      7. Hit enter
      8. See the tags being stripped.

       

      This is causing a problem during a backup restore operation where the title have HTML Tags in them.

      To replicate the restore error:

      1. Edit a topic name via the 'Edit' -> 'Edit topic'
      2. Check the custom box
      3. Wrap the name in a <div>
      4. Save.
      5. Backup the course
      6. Try to restore the course into a new course and notice the error below.

       

      error/setting_invalid_ui_label

      Stack trace:

      • line 152 of /backup/util/ui/backup_ui_setting.class.php: base_setting_ui_exception thrown
      • line 170 of /backup/moodle2/restore_section_task.class.php: call to base_setting_ui->set_label()
      • line 153 of /backup/util/plan/base_task.class.php: call to restore_section_task->define_settings()
      • line 60 of /backup/util/plan/base_plan.class.php: call to base_task->set_plan()
      • line 173 of /backup/moodle2/restore_plan_builder.class.php: call to base_plan->add_task()
      • line 216 of /backup/moodle2/restore_plan_builder.class.php: call to restore_plan_builder::build_section_plan()
      • line 114 of /backup/moodle2/restore_plan_builder.class.php: call to restore_plan_builder::build_course_plan()
      • line 74 of /backup/util/plan/restore_plan.class.php: call to restore_plan_builder::build_plan()
      • line 513 of /backup/controller/restore_controller.class.php: call to restore_plan->build()
      • line 143 of /backup/controller/restore_controller.class.php: call to restore_controller->load_plan()
      • line 86 of /backup/restore.php: call to restore_controller->__construct()

       

      If the tags are removed then the restore goes smoothly.

        Attachments

        1. quick-edit.png
          quick-edit.png
          19 kB
        2. quick-edit-after.png
          quick-edit-after.png
          5 kB
        3. standard-form.png
          standard-form.png
          9 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gmrsagar Sagar Ghimire
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: