-
Sub-task
-
Resolution: Fixed
-
Blocker
-
2.0
-
None
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
The way repositories are selected is a combination of
- what file types they support (mimetypes)
- what format the calling field expects
The second of these breaks into two main formats:
- FILE_INTERNAL (a Moodle file object with ID, local url etc)
- FILE_EXTERNAL (a url to somewhere outside of Moodle)
There are three different combinations of these used in Moodle:
A) The image and media dialogs in the editor require either FILE_INTERNAL (specifically the URL) or FILE_EXTERNAL
B) The filemanager form element requires only FILE_INTERNAL
C) The URL resource module requires only FILE_EXTERNAL
If we pass this requirement to the filepicker, then we can
1) Hide repository instances that don't support the required format
2) If local and external URLs are allowed (A), and the module supports external URLs, then add a checkbox to the last screen to return an external URL (no copying into File API)
3) If External URLs are required (C), then hide that checkbox option and proceed as if it was selected.
The settings can be implemented in each repository class by:
- A function like support_return_value() that returns one or more supported values
- A function like get_file() that does the correct actions and returns the right data.