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

Mirror drag and drop options when importing a resource from MoodleNet (tool_moodlenet all versions)

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 3.9
    • Fix Version/s: None
    • Component/s: Other
    • Testing Instructions:
      Hide

      Pre-requisites:

      1. You'll need the test client to fake POSTs from MoodleNet. Put this in your Moodle web root.

      git pull https://github.com/snake/moodle.git moodlenet_test_client 

      2. Create a course and enrol a teacher.
      3. Configure the test client script (params at top of script) so that it uses:

      • You local site address
      • The id of the course you created in step 2 above
      • Section 0

      Test not authenticated scenario

      1. Make sure you are not logged in to Moodle.
      2. Visit the test client as YOURSITE/testclient.php
      3. Click the second option (the cat png, where course and section ARE provided)
      4. Verify you're taken to the Moodle log in page.
      5. Log in as the teacher
      6. Verify you see an import confirmation page.
      7. Cancel the confirmation
      8 Verify you're taken to the course home for your course.
      9. Log out.
      10. Visit the test client as YOURSITE/testclient.php
      11. Click the second option (the cat png, where course and section ARE provided)
      12. Verify you're taken to the Moodle log in page.
      13. Log in as the teacher
      14. Verify you see an import confirmation page.
      15. Click "Confirm" in the dialog
      16. Verify you're taken to a page asking you to pick from several import options
      17. Click "Cancel"
      18. Verify you're taken to the course home for your course.
      19. Log out.
      20. Visit the test client as YOURSITE/testclient.php
      21. Click the second option (the cat png, where course and section ARE provided)
      22. Verify you're taken to the Moodle log in page.
      23. Log in as the teacher
      24. Verify you see an import confirmation page.
      25. Click "Confirm" in the dialog
      26. Verify you're taken to a page asking you to pick from several import options
      27. Select the "Add media to course page" option and click "Continue"
      28. Verify you're taken to the course and you can see a cat picture in a label in section 0.

      Test authenticated scenario

      1. Make sure you're already logged in to Moodle
      2. Visit the test client as YOURSITE/testclient.php
      3. Click the second option (the cat png, where course and section ARE provided)
      4. Verify you're NOT taken to the Moodle log in page.
      5. Verify you do see an import confirmation page.
      6. Click "confirm"
      7. Verify you're taken to a page asking you to pick from several import options
      8. Select "Create file resource" and click "Continue"
      9. Verify you're taken to the course and you can see a file resource called 'cat' in section 0.
      10. Click the file resource
      11. Verify you see a cat picture.

      Show
      Pre-requisites: 1. You'll need the test client to fake POSTs from MoodleNet. Put this in your Moodle web root. git pull https: //github.com/snake/moodle.git moodlenet_test_client 2. Create a course and enrol a teacher. 3. Configure the test client script (params at top of script) so that it uses: You local site address The id of the course you created in step 2 above Section 0 Test not authenticated scenario 1. Make sure you are not logged in to Moodle. 2. Visit the test client as YOURSITE/testclient.php 3. Click the second option (the cat png, where course and section ARE provided) 4. Verify you're taken to the Moodle log in page. 5. Log in as the teacher 6. Verify you see an import confirmation page. 7. Cancel the confirmation 8 Verify you're taken to the course home for your course. 9. Log out. 10. Visit the test client as YOURSITE/testclient.php 11. Click the second option (the cat png, where course and section ARE provided) 12. Verify you're taken to the Moodle log in page. 13. Log in as the teacher 14. Verify you see an import confirmation page. 15. Click "Confirm" in the dialog 16. Verify you're taken to a page asking you to pick from several import options 17. Click "Cancel" 18. Verify you're taken to the course home for your course. 19. Log out. 20. Visit the test client as YOURSITE/testclient.php 21. Click the second option (the cat png, where course and section ARE provided) 22. Verify you're taken to the Moodle log in page. 23. Log in as the teacher 24. Verify you see an import confirmation page. 25. Click "Confirm" in the dialog 26. Verify you're taken to a page asking you to pick from several import options 27. Select the "Add media to course page" option and click "Continue" 28. Verify you're taken to the course and you can see a cat picture in a label in section 0. Test authenticated scenario 1. Make sure you're already logged in to Moodle 2. Visit the test client as YOURSITE/testclient.php 3. Click the second option (the cat png, where course and section ARE provided) 4. Verify you're NOT taken to the Moodle log in page. 5. Verify you do see an import confirmation page. 6. Click "confirm" 7. Verify you're taken to a page asking you to pick from several import options 8. Select "Create file resource" and click "Continue" 9. Verify you're taken to the course and you can see a file resource called 'cat' in section 0. 10. Click the file resource 11. Verify you see a cat picture.
    • Affected Branches:
      MOODLE_39_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-67889-master
    • Story Points:
      5
    • Sprint:
      Activity Sprint 9, Activity Sprint 10, Activity Sprint 11

      Description

      Once we have received POST data from MoodleNet for a file that is not a backup, we eventually (depending on whether or not we  have the course/section or need to prompt the user for it - but that's another issue) need to present options to the user, asking them what module they'd like to use to handle the file import. We want to provide the same options that are presented during a drag and drop addition to a course. Drag and drop is handled by course module callbacks, specific to drag and drop. The objective here is to make use of that existing set of callbacks and present those same options to users conducting an import from MoodleNet into Moodle. Some notes on the way this works:

      1. Moodle determines what actions are most suitable based on the type of file. Use the {mod_plugin}_dndupload_register() and {mod_plugin}_dndupload_handle() for each module to put their hand up to say they handle a certain type of file.

      So, what we want here is as follows:

      1. A plugin page which presents a list of options to the user, based on the dnd hooks.
      2. The page assumes the course and section have already been passed in (params to the page). E.g. In the workflow where the user starts in Moodle, MoodleNet POSTS back the course and section information to the import.php endpoint, so we have this already.
      3. If the page does not have a valid course and section, show an error.
      4. Once selected, the file should be downloaded (see MDL-68132) and then handed over to {mod_plugin}_dndupload_handle() which will create the relevant content in the course.
      5. Once content is created (as above step), the user should be redirected to the course home page + section.
      6. This issue IS NOT scoped with creation of any course or section selection pages.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jaked Jake Dallimore
              Reporter:
              abgreeve Adrian Greeve
              Peer reviewer:
              Peter Dias
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 weeks, 5 hours, 2 minutes
                  2w 5h 2m