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

Return main file isexternalfile and repositorytype in core_course_get_course_contents

XMLWordPrintable

    • MOODLE_36_STABLE
    • MOODLE_37_STABLE
    • MDL-65019-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Enable the "File system" repository in Moodle, see instructions here: https://docs.moodle.org/36/en/File_system_repository
      3. Add one file to the file system directory
      4. Create a course and enrol one user as student
      5. Inside the course create a "File" resource choosing from the "file resource" file picker a file from the "File system" repository
        1. Make sure to select "Create an alias / shortcut to the file" (Make a copy will not display as a filesystem file)
      6. Create a Token in the mobile app service for the student user from step 4
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. You will have to replace also the courseid to match the one in step 4 (please replace variables that are bold and underlined)

      curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=3&wsfunction=core_course_get_contents&wstoken=3af67232a7596ceb658df4db329e5ad6&options[0][name]=excludecontents&options[0][value]=true' --compressed | python -m "json.tool"

      1. Confirm that in the curl response:
        • The contentsinfo->repositorytype field for the resource you added is set to "filesystem"
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Enable the "File system" repository in Moodle, see instructions here: https://docs.moodle.org/36/en/File_system_repository Add one file to the file system directory Create a course and enrol one user as student Inside the course create a "File" resource choosing from the "file resource" file picker a file from the "File system" repository Make sure to select "Create an alias / shortcut to the file" (Make a copy will not display as a filesystem file) Create a Token in the mobile app service for the student user from step 4 Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. You will have to replace also the courseid to match the one in step 4 (please replace variables that are bold and underlined) curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid= 3 &wsfunction=core_course_get_contents&wstoken= 3af67232a7596ceb658df4db329e5ad6 &options [0] [name] =excludecontents&options [0] [value] =true' --compressed | python -m "json.tool" Confirm that in the curl response: The contentsinfo->repositorytype field for the resource you added is set to "filesystem"

      In the app we need isexternalfile and repositorytype of the main file (first file) to be able to render the modules without retrieving the whole contents.

      This could be included in the contentsinfo property that is already returned (new in 3.7). The app only needs the isexternalfile and repositorytype of the first file (the main file), we don't need to know all the repositories, but maybe some other client wants the full list of repositories so it could be interesting to return the full list (in the right order).

      So IMO the WS should return the list of repositories and whether the first file is external or not.

        1. MDL-65019_Confirmed fixed.PNG
          76 kB
          Gladys Basiana
        2. Test Failed.PNG
          66 kB
          Gladys Basiana

            jleyva Juan Leyva
            dpalou Dani Palou
            Dani Palou Dani Palou
            Adrian Greeve Adrian Greeve
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.