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

generate_warning function in assignment external API is returning incorrect values

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.3.2
    • 3.2.6, 3.3.3
    • Assignment
    • MOODLE_33_STABLE
    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • MDL-60233-master
    • Hide
      1. Create an assignment activity configured to allow only to allow only text (Submission types field set to Online text)
      2. Just under the previous setting, set the field Word limit to 1
      3. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token in the mobile app service for one student in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, assignmentid with the assignment activity instance id and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignmentid=37&plugindata%5Bonlinetext_editor%5D%5Btext%5D=%3Cp%3Easdf%20asdf%3C%2Fp%3E%0A&plugindata%5Bonlinetext_editor%5D%5Bformat%5D=1&plugindata%5Bonlinetext_editor%5D%5Bitemid%5D=0&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=mod_assign_save_submission&wstoken=12a2a65aeea2a177055e233f9e303218' --compressed | python -m "json.tool"

          # Check that as curl response you receive a valid json. The first element of the json response array contains the field "warningcode" set to couldnotsavesubmission, and the "item" field containing a text with HTML characters encoded.

      Show
      Create an assignment activity configured to allow only to allow only text (Submission types field set to Online text) Just under the previous setting, set the field Word limit to 1 As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one student in the course: 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, assignmentid with the assignment activity instance id and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'assignmentid=37&plugindata%5Bonlinetext_editor%5D%5Btext%5D=%3Cp%3Easdf%20asdf%3C%2Fp%3E%0A&plugindata%5Bonlinetext_editor%5D%5Bformat%5D=1&plugindata%5Bonlinetext_editor%5D%5Bitemid%5D=0&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=mod_assign_save_submission&wstoken=12a2a65aeea2a177055e233f9e303218' --compressed | python -m "json.tool" # Check that as curl response you receive a valid json. The first element of the json response array contains the field "warningcode" set to couldnotsavesubmission, and the "item" field containing a text with HTML characters encoded.

    Description

      The detail parameter some times may content HTML but this parameter is defined as PARAM_TEXT

      We can't change the param type because is defined in the external_warning structure so, at least, we must be sure that the strings returned there don't contain HTML.

      Attachments

        Activity

          People

            jleyva Juan Leyva
            jleyva Juan Leyva
            Adrian Greeve Adrian Greeve
            David Monllaó David Monllaó
            Ryan Wyllie Ryan Wyllie
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              13/Nov/17