This issue deals with creating workflow management code. This issue assumes the core API for passing content to modules exists (MDL needs to be created still). The goal of the workflow code is to provide a means to track the state of an import/upload and to provide methods to start/end this process for a user.
Create a core resource import manager:
- A method to commence a file import (keeping in mind there may be other import types in future), which takes a file_provider type object (see MDL-68360 for details on this interface), stores it in the session along with the import state of "in progress" (or other suitable status)
- A method to query the state of the import for a user. in progress, none started, etc.
- Core change to set a notification on every page load if the user is in the process of importing/uploading. This should call the manager to check the status (which itself checks just a session var) and should leverage the notifications API changes in MDL-68358 to present a notification with a cancel option and which cannot be closed.
- This "cancel" link in the notification will need to contain some js which fires a web service call to cancel the import ( see below)
- On cancel the user should stay on the current page.
- Provide a method to cancel the import/upload and handle cleanup of session details.
- Provide a web service for cancelling an import for a user. To be used by the notification's cancel link (see above)