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

Course content download - add site admin and course level settings, implement in course user interface

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisites/setup

      1. Have the ability to run 3 Moodle sessions at once (eg one browser with incognito/private browsing mode, and a second browser).
      2. Have the ability to add a PHP file to the backend of your test site.
      3. Create a new course, with at least one editing teacher and one student enrolled.
      4. CONFIRM you are able to create the course without any errors.
      5. Add the following activities to the course:
        1. Forum.
        2. Two File activities, one smaller than 500KB and one larger than 500KB.
        3. Page.
        4. Folder.
        5. Label.
      6. Download the exporter.php file attached to this issue (it will be used in the final test).
      7. Make sure debugging is disabled on your Moodle site (Site administration > Development > Debugging, set "Debug messages" to "NONE" and save).
      8. Open your site's version.php file in your IDE and bump the version number.
      9. Log in as admin and perform the upgrade steps when prompted, then clear all caches.
      10. Note: References to the action menu are the action menu cog in Boost, or the left margin navigation in Classic.

      Testing - download UI and site level settings

      1. Log in as admin (this will be referred to as the "admin window").
      2. In a separate session (eg in incognito/private browsing mode) also log in as the teacher (this will be referred to as the teacher window).
      3. In a separate session (eg in a different browser) also log in as the student (this will be referred to as the student window).
      4. In the admin window, navigate to Site administration > Courses > Download course content.
      5. CONFIRM "Download course content feature available" checkbox is unchecked, then press "Save changes".
      6. In the teacher window, navigate to the course and expand the actions menu.
      7. CONFIRM you do not see the "Download course content" option in the menu.
      8. In the actions menu, select "Edit course".
      9. Under the General section, CONFIRM you do not see "Enable download course content" below "Course visibility".
      10. Return to the course homepage.
      11. In the student window, log in and navigate to the course.
      12. CONFIRM you do not see a "Download course content" button at the top right of the course page.
      13. In the admin window, check the "Download course content feature available" checkbox, and set "Maximum size per file when downloading course content" to "500 KB", then press "Save changes".
      14. On the same page, click on the hyperlink to "Course default settings" (in the description for "Download course content feature available").
      15. CONFIRM you are taken to the "Course default settings" page in a new tab.
      16. Set the "Enable download course content" setting to "No" and press "Save changes".
      17. In the student window, refresh the course page and CONFIRM you still do not see a "Download course content" button at the top right of the course page.
      18. In the teacher window, refresh the course homepage, expand the actions menu and CONFIRM you still do not see the "Download course content" option in the menu.
      19. Select the "Edit course" option.
      20. Under the General section, CONFIRM you do see "Enable download course content" below "Course visibility", and CONFIRM it is set to "Site default (No)".
      21. In the admin window, change the "Enable download course content" setting to "Yes" and press "Save changes".
      22. In the teacher window, refresh the edit course page and CONFIRM the "Enable download course content" value is now set to "Site default (Yes)".
      23. In the student window, refresh the course homepage and CONFIRM you now see a "Download course content" button at the top right of the course page.
      24. In the teacher window, return to the course homepage, open the actions menu and CONFIRM the "Download course content" option is now available.
      25. Click "Download course content".
      26. CONFIRM you see a "Download course content" modal and CONFIRM the end of the text says "(excluding any files larger than 500KB)" (paying attention to ensure the size mentioned is "500KB").
      27. Click "Cancel" on the modal and CONFIRM you are returned to the course page.
      28. Again click the "Download course content" from the action menu.
      29. Click the "Download" button in the modal.
      30. CONFIRM you are prompted to download the zip file, then download it.
      31. CONFIRM you are then returned to the course homepage.
      32. Extract the zip file you just downloaded.
      33. Navigate into the extracted folder, and open the index.html file in one of your web browsers, so you can view it.
      34. CONFIRM the index page shows the correct course name/short name and CONFIRM the six activities you created in the course during setup are all listed.
      35. In the student window, click the "Download course content" button, and CONFIRM you see a modal with the same text as in step 26.
      36. Repeat steps 29-34 and CONFIRM you see the same results.

      Testing - Further course settings and capabilities

      1. In the admin window (the tab titled "Course default settings"), change the "Enable download course content" setting to "No" and press "Save changes".
      2. In the teacher window, select "edit course" from the actions menu.
      3. CONFIRM "Enable download course content" is set to "Site default (No)".
      4. Change the "Enable download course content" to "No" and press "Save and Display".
      5. When you are redirected to the course homepage, CONFIRM the "Download course content" option is not available in the actions menu.
      6. Select "edit course" from the actions menu.
      7. Change the "Enable download course content" to "Yes" and press "Save and Display".
      8. When you are redirected to the course homepage, CONFIRM the "Download course content" option is available in the actions menu.
      9. Right click on the "Download course content" option, and choose "inspect element".
      10. Find the "data-download-link" value for that element, which will be a URL in the format <wwwroot>/course/downloadcontent.php?contextid=xxxx&download=1. Copy that URL and paste it into a new tab in the teacher window, then press enter (to load it).
      11. CONFIRM you receive a sesskey error. You can now close just that one tab.
      12. In the admin window, return to the first browser tab (the one titled "Download course content").
      13. Uncheck the "Download course content feature available" checkbox, then press "Save changes".
      14. In the student window, refresh the course homepage and CONFIRM the "Download course content" button is not visible on the page (this confirms disabling on the site overrides course-level settings).
      15. In the admin window,check the "Download course content feature available" checkbox again, then press "Save changes".
      16. In the student window, refresh the course homepage and CONFIRM the "Download course content" button is visible on the page.
      17. In the admin window, remove the "moodle/course:downloadcontentexport" capability from both the editing teacher and student roles.
      18. Also remove the "moodle/course:configurecontentexport" capability from the editing teacher role.
      19. In the student window, do not refresh the page, but click the "Download course content" button.
      20. CONFIRM a new tab opens, but is immediately redirected to the course homepage.
      21. CONFIRM on that page, the "Download course content" button is no longer available.
      22. In the teacher window, refresh the page and CONFIRM the "Download course content" option has been removed from the action menu.
      23. Select the "Edit course" option from the menu.
      24. CONFIRM you can see the "Enable download course content" item in the General section, but are no longer able to modify it.

      Testing - developer debugging displays errors

      1. In the admin window, navigate to Site administration > Development > Debugging and set the following:
        1. Set Debug messages to DEVELOPER.
        2. Check/enable Display debug messages.
      2. Press "Save changes".
      3. Navigate to the course homepage (still in the admin window).
      4. In the actions menu, press "Download course content" and then press "Download" in the modal popup.
      5. CONFIRM the zip file downloads and CONFIRM you are able to extract that zip file.
      6. Also CONFIRM you are redirected back to the course homepage.
      7. Either in your IDE or whichever directory explorer you use on your computer, open up/navigate to /path/to/wwwroot/mod/label/classes/.
      8. Create a new directory in that classes directory called "content", then navigate into that directory.
      9. At the start of testing, you downloaded a test exporter.php file from this issue. Move that into the "content" directory you just created.
      10. Do a version bump, either with this plugin or a main version bump.
      11. Again from the course homepage, in the actions menu, press "Download course content" and then press "Download" in the modal popup.
      12. CONFIRM you now see an error message and CONFIRM no zip file is downloaded.

      Testing - course creation throws no exceptions

      1. In the admin window, navigate to Site administration > Courses > Download course content.
      2. If the "Download course content feature available" checkbox is unchecked, check it and press "Save changes".
      3. Navigate to Site administration > Courses > Add a new course.
      4. CONFIRM the add course page loads without errors and CONFIRM you can see "Enable download course content " under the General section.
      5. Fill in the form with some test details, but set "Enable download course content " to "No" and press "Save and display".
      6. CONFIRM the course creates without errors.
      7. In the new course, navigate to "Edit course" and CONFIRM that "Enable download course content " is set to "No".
      Show
      Prerequisites/setup Have the ability to run 3 Moodle sessions at once (eg one browser with incognito/private browsing mode, and a second browser). Have the ability to add a PHP file to the backend of your test site. Create a new course, with at least one editing teacher and one student enrolled. CONFIRM you are able to create the course without any errors. Add the following activities to the course: Forum. Two File activities, one smaller than 500KB and one larger than 500KB. Page. Folder. Label. Download the exporter.php file attached to this issue (it will be used in the final test). Make sure debugging is disabled on your Moodle site (Site administration > Development > Debugging, set "Debug messages" to "NONE" and save). Open your site's version.php file in your IDE and bump the version number. Log in as admin and perform the upgrade steps when prompted, then clear all caches. Note: References to the action menu are the action menu cog in Boost, or the left margin navigation in Classic. Testing - download UI and site level settings Log in as admin (this will be referred to as the "admin window"). In a separate session (eg in incognito/private browsing mode) also log in as the teacher (this will be referred to as the teacher window). In a separate session (eg in a different browser) also log in as the student (this will be referred to as the student window). In the admin window, navigate to Site administration > Courses > Download course content. CONFIRM "Download course content feature available" checkbox is unchecked, then press "Save changes". In the teacher window, navigate to the course and expand the actions menu. CONFIRM you do not see the "Download course content" option in the menu. In the actions menu, select "Edit course". Under the General section, CONFIRM you do not see "Enable download course content" below "Course visibility". Return to the course homepage. In the student window, log in and navigate to the course. CONFIRM you do not see a "Download course content" button at the top right of the course page. In the admin window, check the "Download course content feature available" checkbox, and set "Maximum size per file when downloading course content" to "500 KB", then press "Save changes". On the same page, click on the hyperlink to "Course default settings" (in the description for "Download course content feature available"). CONFIRM you are taken to the "Course default settings" page in a new tab. Set the "Enable download course content" setting to "No" and press "Save changes". In the student window, refresh the course page and CONFIRM you still do not see a "Download course content" button at the top right of the course page. In the teacher window, refresh the course homepage, expand the actions menu and CONFIRM you still do not see the "Download course content" option in the menu. Select the "Edit course" option. Under the General section, CONFIRM you do see "Enable download course content" below "Course visibility", and CONFIRM it is set to "Site default (No)". In the admin window, change the "Enable download course content" setting to "Yes" and press "Save changes". In the teacher window, refresh the edit course page and CONFIRM the "Enable download course content" value is now set to "Site default (Yes)". In the student window, refresh the course homepage and CONFIRM you now see a "Download course content" button at the top right of the course page. In the teacher window, return to the course homepage, open the actions menu and CONFIRM the "Download course content" option is now available. Click "Download course content". CONFIRM you see a "Download course content" modal and CONFIRM the end of the text says "(excluding any files larger than 500KB)" (paying attention to ensure the size mentioned is "500KB"). Click "Cancel" on the modal and CONFIRM you are returned to the course page. Again click the "Download course content" from the action menu. Click the "Download" button in the modal. CONFIRM you are prompted to download the zip file, then download it. CONFIRM you are then returned to the course homepage. Extract the zip file you just downloaded. Navigate into the extracted folder, and open the index.html file in one of your web browsers, so you can view it. CONFIRM the index page shows the correct course name/short name and CONFIRM the six activities you created in the course during setup are all listed. In the student window, click the "Download course content" button, and CONFIRM you see a modal with the same text as in step 26. Repeat steps 29-34 and CONFIRM you see the same results. Testing - Further course settings and capabilities In the admin window (the tab titled "Course default settings"), change the "Enable download course content" setting to "No" and press "Save changes". In the teacher window, select "edit course" from the actions menu. CONFIRM "Enable download course content" is set to "Site default (No)". Change the "Enable download course content" to "No" and press "Save and Display". When you are redirected to the course homepage, CONFIRM the "Download course content" option is not available in the actions menu. Select "edit course" from the actions menu. Change the "Enable download course content" to "Yes" and press "Save and Display". When you are redirected to the course homepage, CONFIRM the "Download course content" option is available in the actions menu. Right click on the "Download course content" option, and choose "inspect element". Find the "data-download-link" value for that element, which will be a URL in the format <wwwroot>/course/downloadcontent.php?contextid=xxxx&download=1 . Copy that URL and paste it into a new tab in the teacher window, then press enter (to load it). CONFIRM you receive a sesskey error. You can now close just that one tab. In the admin window, return to the first browser tab (the one titled "Download course content"). Uncheck the "Download course content feature available" checkbox, then press "Save changes". In the student window, refresh the course homepage and CONFIRM the "Download course content" button is not visible on the page (this confirms disabling on the site overrides course-level settings). In the admin window,check the "Download course content feature available" checkbox again, then press "Save changes". In the student window, refresh the course homepage and CONFIRM the "Download course content" button is visible on the page. In the admin window, remove the "moodle/course:downloadcontentexport" capability from both the editing teacher and student roles. Also remove the "moodle/course:configurecontentexport" capability from the editing teacher role. In the student window, do not refresh the page, but click the "Download course content" button. CONFIRM a new tab opens, but is immediately redirected to the course homepage. CONFIRM on that page, the "Download course content" button is no longer available. In the teacher window, refresh the page and CONFIRM the "Download course content" option has been removed from the action menu. Select the "Edit course" option from the menu. CONFIRM you can see the "Enable download course content" item in the General section, but are no longer able to modify it. Testing - developer debugging displays errors In the admin window, navigate to Site administration > Development > Debugging and set the following: Set Debug messages to DEVELOPER. Check/enable Display debug messages. Press "Save changes". Navigate to the course homepage (still in the admin window). In the actions menu, press "Download course content" and then press "Download" in the modal popup. CONFIRM the zip file downloads and CONFIRM you are able to extract that zip file. Also CONFIRM you are redirected back to the course homepage. Either in your IDE or whichever directory explorer you use on your computer, open up/navigate to /path/to/wwwroot/mod/label/classes/ . Create a new directory in that classes directory called "content", then navigate into that directory. At the start of testing, you downloaded a test exporter.php file from this issue. Move that into the "content" directory you just created. Do a version bump, either with this plugin or a main version bump. Again from the course homepage, in the actions menu, press "Download course content" and then press "Download" in the modal popup. CONFIRM you now see an error message and CONFIRM no zip file is downloaded. Testing - course creation throws no exceptions In the admin window, navigate to Site administration > Courses > Download course content. If the "Download course content feature available" checkbox is unchecked, check it and press "Save changes". Navigate to Site administration > Courses > Add a new course. CONFIRM the add course page loads without errors and CONFIRM you can see "Enable download course content " under the General section. Fill in the form with some test details, but set "Enable download course content " to "No" and press "Save and display". CONFIRM the course creates without errors. In the new course, navigate to "Edit course" and CONFIRM that "Enable download course content " is set to "No".
    • Affected Branches:
      MOODLE_310_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull 3.10 Branch:
      MDL-69559-310-7
    • Pull Master Branch:
      MDL-69559-master-7
    • Story Points:
      2
    • Sprint:
      International 4.0 - Sprint 5, International 4.0 - Sprint 6, International 4.0 - Sprint 7

      Description

      As per mockups at https://projects.invisionapp.com/share/PTY9T7SVG4C/screens/427139438#/screens/427139439

      Path to be: Home => Site administration => Courses => Course download

      Settings include:

      1. Enable course download
      2. Maximum download file size (maximum size of any individual file)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michaelh Michael Hawkins
              Reporter:
              dobedobedoh Andrew Lyons
              Peer reviewer:
              Simey Lameze Simey Lameze
              Integrator:
              Adrian Greeve Adrian Greeve
              Tester:
              Peter Dias Peter Dias
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 weeks, 4 days, 5 hours, 40 minutes
                  3w 4d 5h 40m