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

Lesson content is incorrectly filtered in external functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3.2
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a lesson in a course with just a true/false question page
      2. In the page contents insert a youtube video using the Atto editor "Media" button, selecting the "Video" tab add adding the youtube link in "Video source URL".
      3. Insert the same video in the Correct response "answer" and "response" rich text editors
      4. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token in the mobile app service for one user enrolled in the course as teacher where the lesson is:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, the lesson id with the lesson instance id, the pageid with the content page where the video is created id and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=31&pageid=221&review=0&returncontents=1&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=mod_lesson_get_page_data&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool"

      7. Now, check in the response that the data-setup-lazy attribute is present in the video tag in the "pagecontent" field, in the page->contents field and in the answers->answer and answers->response of the correct answer (it should be the first one in the data returned)
      Show
      Create a lesson in a course with just a true/false question page In the page contents insert a youtube video using the Atto editor "Media" button, selecting the "Video" tab add adding the youtube link in "Video source URL". Insert the same video in the Correct response "answer" and "response" rich text editors As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one user enrolled in the course as teacher where the lesson is: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, the lesson id with the lesson instance id, the pageid with the content page where the video is created id and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=31&pageid=221&review=0&returncontents=1&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=mod_lesson_get_page_data&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool" Now, check in the response that the data-setup-lazy attribute is present in the video tag in the "pagecontent" field, in the page->contents field and in the answers->answer and answers->response of the correct answer (it should be the first one in the data returned)
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59453-master

      Description

      The lesson content for branchpages (contentpages) is always filtered by format_text but passing as parameter: $options->noclean = true;

      In external functions (function get_page_fields) the text is returned but with noclean set to false, this is creating some unexpected results like youtube embedded videos not working in the app (see MOBILE-2155)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Sep/17