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

Return default templates in the database module instead null values

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Development in progress
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6.2
    • Fix Version/s: None
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, in a new course create a database activity (just fill the mandatory sections for creating the module, do not apply any further configuration)
      2. Enable "Mobile services": Plugins ► Web Services ► Mobile
      3. Create a Token for one student enrolled in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user .
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=3&wsfunction=mod_data_get_databases_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool"

      5. Confirm that
        • All the fields ending in "template": 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate', 'asearchtemplate' are empty (returns a null value)
      6. Now, as admin, open the database module and create at least one field (via the Fields tab)
      7. Execute again the WS request and confirm that:
        • All the fields ending in "template": 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate', 'asearchtemplate' are now returning some HTML code, except, jstemplate and csstemplate that will be empty
      8. Now, as admin, open the database module and edit one of the templates (via the Templates tab). For eample, the single template, adding some random text at the bottom of the text editor
      9. Execute again the WS request and confirm that:
        • The 'singletemplate' field returned by the WS request includes the random text you added at the bottom.
      Show
      As admin, in a new course create a database activity (just fill the mandatory sections for creating the module, do not apply any further configuration) Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one student enrolled in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user . You need to replace the wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=3&wsfunction=mod_data_get_databases_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool" Confirm that All the fields ending in "template": 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate', 'asearchtemplate' are empty (returns a null value) Now, as admin, open the database module and create at least one field (via the Fields tab) Execute again the WS request and confirm that: All the fields ending in "template": 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate', 'asearchtemplate' are now returning some HTML code, except, jstemplate and csstemplate that will be empty Now, as admin, open the database module and edit one of the templates (via the Templates tab). For eample, the single template, adding some random text at the bottom of the text editor Execute again the WS request and confirm that: The 'singletemplate' field returned by the WS request includes the random text you added at the bottom.
    • Affected Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-64654-master

      Description

      We should be returning the default templates instead NULL values so external clients do not have to have them hard-coded .

       

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            jleyva Juan Leyva
            Peer reviewer:
            Albert Gasset
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: