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

New Web Service core_block_get_dashboard_blocks

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Open the console an execute this request, replacing wstoken with the token you just created and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool"

      4. Copy the curl command output into a text file
      5. As the user you created the token for, access your local Moodle installation via the browser (not the app) and go to your "Dashboard" (first option in the flat left menu)
      6. Now, compare the blocks you see in your dashboard with the blocks returned by the CURL request, all the wider blocks at the center of the page should have the "region" field set to content. For the blocks at the right, the "region" field is set to side-pre. The "name" field indicates the shortname of the block (so you can identify it). The order of the blocks returned by the curl request must match the order displayed in the web site.
      7. Now hide one of the blocks in your dashboard in Moodle
      8. Execute the CURL request again and check that the field "visible" for the block is set to "false"

      TESTING ADMIN CAN SEE ANY USER BLOCKS

      1. Now, log-in as admin again to your Moodle site and create a token for the admin user of the site (follow again instructions of point 2 from previous section)
      2. Open the console an execute this request, replacing wstoken with the token you just created and the site url with yours. The userid field must be set to the user you created the token for in the step 2 (not the admin account).

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'userid=X&wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool"

      3. Check that the curl response is exactly the same that the one you originally saved in the text file.

      TESTING STICKY BLOCKS

      1. Now, as admin again, go to the "Site Home" and "Turn editing on" via the cog
      2. Add an HTML Block ensuring than "Where this block appears" -> "Page contexts" is set to "Display throughout the site" and Default region is set to "Right"
      3. Now, execute again the last CURL request and check that you receive the "html" block you just created
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this request, replacing wstoken with the token you just created and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool" Copy the curl command output into a text file As the user you created the token for, access your local Moodle installation via the browser (not the app) and go to your "Dashboard" (first option in the flat left menu) Now, compare the blocks you see in your dashboard with the blocks returned by the CURL request, all the wider blocks at the center of the page should have the "region" field set to content. For the blocks at the right, the "region" field is set to side-pre. The "name" field indicates the shortname of the block (so you can identify it). The order of the blocks returned by the curl request must match the order displayed in the web site. Now hide one of the blocks in your dashboard in Moodle Execute the CURL request again and check that the field "visible" for the block is set to "false" TESTING ADMIN CAN SEE ANY USER BLOCKS Now, log-in as admin again to your Moodle site and create a token for the admin user of the site (follow again instructions of point 2 from previous section) Open the console an execute this request, replacing wstoken with the token you just created and the site url with yours. The userid field must be set to the user you created the token for in the step 2 (not the admin account). curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'userid=X&wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool" Check that the curl response is exactly the same that the one you originally saved in the text file. TESTING STICKY BLOCKS Now, as admin again, go to the "Site Home" and "Turn editing on" via the cog Add an HTML Block ensuring than "Where this block appears" -> "Page contexts" is set to "Display throughout the site" and Default region is set to "Right" Now, execute again the last CURL request and check that you receive the "html" block you just created
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63465-master

      Description

      New WS to retrieve the blocks displayed in the user dashboard, this is necessary to be able to display the correct blocks (in the correct order) for mobile users.

        Attachments

        1. 1.PNG
          1.PNG
          219 kB
        2. 2.PNG
          2.PNG
          230 kB

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Albert Gasset
                Integrator:
                Eloy Lafuente (stronk7)
                Tester:
                Janelle Barcega
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 20 minutes
                  20m