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

Implement the book_exports_contents function

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.3
    • Fix Version/s: 2.9
    • Component/s: Book, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a new course with just one section, create a new book resource with at least two chapters, one subchapter and images in at least one chapter.
      2. Enable "Mobile services": Plugins ► Web Services ► External services
      3. Create a Token for the user (student) your are going to test with:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Click add, select user and service (Mobile Service)
      5. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the wstoken and the URL of your moodle instance and the course id

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'courseid=4&wsfunction=core_course_get_contents&wstoken=1b9cc9f44630b554bb2c9428b8744338' --compressed
          

      6. Confirm that:
      Show
      Create a new course with just one section, create a new book resource with at least two chapters, one subchapter and images in at least one chapter. Enable "Mobile services": Plugins ► Web Services ► External services Create a Token for the user (student) your are going to test with: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Next, you can do a CURL REST call simulating a WS client: You need to replace the wstoken and the URL of your moodle instance and the course id curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'courseid=4&wsfunction=core_course_get_contents&wstoken=1b9cc9f44630b554bb2c9428b8744338' --compressed Confirm that: You receive a list of course sections including your book resource information, the book module has a field named "contents" with a list of files including one file per chapter and one file for image. Confirm that you can download the html files or images appending ?token=yourtoken to the URL, example: http://localhost/m/stable_master/webservice/pluginfile.php/234/mod_book/chapter/2/index.html?token=1b9cc9f44630b554bb2c9428b8744338 You may use www.jsonlint.com for validate and view the json returned.
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48717-master

      Description

      This function is used by the Web Service (course_get_contents) to retrieve all the contents of a course.

      The function should return an ordered list of files and resources (images, etc..) used in a book in a similar way is done in the page or resource module.

      The returned information should allow a remote site to create an structured view of the book chapters, this means that in the returned information the chapter/subchater information must be included

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/15