Moodle

Add full support for FILE_INTERNAL and FILE_EXTERNAL to all repositories

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Repositories
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

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.

Activity

Hide
Dongsheng Cai added a comment -

Martin, I renamed FILE to MOODLE to avoid variable name conflict

Show
Dongsheng Cai added a comment - Martin, I renamed FILE to MOODLE to avoid variable name conflict
Hide
Martin Dougiamas added a comment -

Good call, DS, I updated the description here.

Show
Martin Dougiamas added a comment - Good call, DS, I updated the description here.
Hide
Martin Dougiamas added a comment -

Sorry!!!!! FILE_LOCAL would be better as FILE_INTERNAL

(The opposite of LOCAL would be REMOTE)

Show
Martin Dougiamas added a comment - Sorry!!!!! FILE_LOCAL would be better as FILE_INTERNAL (The opposite of LOCAL would be REMOTE)
Hide
Dongsheng Cai added a comment -

implemented, testing and reviewing are welcomed, feel free to reopen it if you find any problem

Show
Dongsheng Cai added a comment - implemented, testing and reviewing are welcomed, feel free to reopen it if you find any problem

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: