Development:Repository API: Difference between revisions
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
==Objectives== | ==Objectives== | ||
# Allow all Moodle users to easily bring content into Moodle from external repositories | # Allow all Moodle users to easily bring content into Moodle from external repositories | ||
==Use cases== | ==Use cases== | ||
Line 78: | Line 66: | ||
==General Architecture== | ==General Architecture== | ||
Each repository plugin (a standard Moodle plugin stored under /repository/xxx) will subclass the standard API and override methods specific to that repository. | Each repository plugin (a standard Moodle plugin stored under /repository/xxx) will subclass the standard API and override methods specific to that repository. | ||
Line 88: | Line 74: | ||
* only return the URL to the file if it's desired to keep it external (but this does present security and integrity risks), or | * only return the URL to the file if it's desired to keep it external (but this does present security and integrity risks), or | ||
* refresh the local file copy regularly and automatically | * refresh the local file copy regularly and automatically | ||
* refresh the file manually if desired | |||
Once in Moodle, it is subject to the [[Development:File API]] for access control like any other file. | |||
Line 130: | Line 109: | ||
* youtube - an interface to [http://youtube.com YouTube] | * youtube - an interface to [http://youtube.com YouTube] | ||
* mahara - an interface to a Mahara installation | * mahara - an interface to a Mahara installation | ||
Line 159: | Line 124: | ||
|- | |- | ||
|'''id''' | |'''id''' | ||
|int(10) | |int(10) | ||
| | | | ||
|autoincrementing | |autoincrementing | ||
Line 174: | Line 139: | ||
|varchar | |varchar | ||
| | | | ||
|The name of the plugin being used | |The name of the plugin being used (1 special case: "local" which covers all files uploaded from desktop) | ||
|- | |- | ||
Line 241: | Line 206: | ||
| | | | ||
|The last time the repository was modified | |The last time the repository was modified | ||
|} | |} | ||
Line 421: | Line 223: | ||
====etc==== | ====etc==== | ||
==See also== | |||
* [[Development:File API]] |
Revision as of 05:56, 3 April 2008
This page describes the specification for a future feature, currently being worked on for Moodle 2.0. This spec is STILL UNDER CONSTRUCTION.
See MDL-13766 to track the status of the implementation.
The page is open for everyone so everyone can help correct mistakes and help evolution of this document. However, if you have questions, problems or major changes to suggest please add them to the page comments, or start a discussion in the Repositories forum. We'll endeavour to merge all such suggestions into the main spec before we start development.
Note that parts of this document have been now split off into a separate Development:File_API
Objectives
- Allow all Moodle users to easily bring content into Moodle from external repositories
Use cases
Teacher adding an external file as a new resource
- Teacher wants to add a new resource to a course
- Teacher clicks the "Choose a resource" button
- Teacher is able to choose from a list of configured repositories (this step will be skipped if there's only one).
- Teacher is presented with a simple file picker to choose a file
- Teacher chooses a file
- File is COPIED into Moodle and included in the course.
- File is marked as owned by that user
- Access controls are automatically added for that file so that only those with privileges to see that course can see that file (the owner can change those permissions anytime)
Student submitting an assignment
- Student needs to submit an assignment and presses the "Choose files" button
- Student sees a "file picker" where they can see files listed on any of several configured repositories
- Student chooses MySpace from the list
- Student is prompted to enter MySpace username/password (a checkbox could be there to "remember this for next time" but for security perhaps not)
- Student sees their files in MySpace and chooses one or more
- Files are copied from MySpace to Moodle
- Assignment module gives the files permissions so that only the Student and assignment graders can see the file (other students would not have permission).
Student attaching an image to a forum
- Student needs to attach an image and presses the "Choose files" button in the posting screen
- Student sees a "file picker" where they can see files listed on any of several configured repositories
- Student chooses Mahara from the list
- Student is prompted to enter MySpace username/password (a checkbox could be there to "remember this for next time" but for security perhaps not)
- Student sees their files in Mahara and chooses one image
- Image is copied to Moodle
- Image file is attached to forum post by Forum module (by reference)
- Forum module gives permissions so that anyone who can read that forum can see that file
Student attaching the same image in another forum
- Student needs to submit an assignment and presses the "Choose files" button
- Student sees a "file picker" where they can see files listed on any of several configured repositories
- Student chooses Mahara from the list
- Student is prompted to enter MySpace username/password (a checkbox could be there to "remember this for next time" but for security perhaps not)
- Student sees their files in Mahara and chooses one image
- Moodle detects that the image already exists in Moodle so it it not copied again (or it's just updated)
- Image file is attached to forum post by Forum module (by reference)
- Forum module adds some permissions so that anyone who can read the current forum can also see that file
User managing their files
- User goes to the "Files" area (similar to current Moodle, but for all users)
- User sees two tabs
- First tab shows listing of current files belonging to self, with buttons to manage them, including buttons to modify the permissions (eg "Allow all people in Course X to see this"). You can also see what repository it came from, including the foreign path, and choose to "update from repository" and get a new copy of the file.
- Second tab shows listing of files belonging to others that you are able to see.
Please add more use cases in this same format
General Architecture
Each repository plugin (a standard Moodle plugin stored under /repository/xxx) will subclass the standard API and override methods specific to that repository.
As is usual in Moodle, there will be admin settings to disable/enable certain repository plugins as standard, as well as user settings so that users can add their own personal repositories to the standard list (eg Yahoo Briefcase or Google Docs) and to select their default repository.
Once a repository has been used the file will usually be copied into Moodle there and then. However there will also be options to:
- only return the URL to the file if it's desired to keep it external (but this does present security and integrity risks), or
- refresh the local file copy regularly and automatically
- refresh the file manually if desired
Once in Moodle, it is subject to the Development:File API for access control like any other file.
Repository requirements
From the Moodle point of view, each repository is just a hierarchy of nodes.
The repository MUST provide:
- A URL to download each node (eg file).
- A list of the nodes (eg files and directories) under a given node (eg directory). This allows Moodle to construct a standard browse interface (much like a standard OS file picker). However some repository plugins may choose to completely override the repository_browse() method and implement their own interface, that's OK, as long as they end up with a URL for the file.
The repository can OPTIONALLY:
- Require some authentication credentials
- Provide more metadata about each node (mime type, size, dates, related files, dublin core stuff, etc)
- Describe a search facility (so that Moodle can construct a search form)
- Provide copyright and usage rules (or just information about the rules)
Repository plugins
Some plugins I'd like to see developed for the first version are:
- local - very similar to the current course-based file manager, except user-based
- moodle - an interface to another Moodle site, accessed over a secure mnet connection
- jsr170 - an interface that can talk to anything that supports jsr170 (eg Alfresco)
- oki - an OKI emulator allowing us to access things with OKI interfaces,like Fedora
- briefcase - an interface to Yahoo Briefcase
- myspace - an interface to MySpace files (perhaps via this MySpace API)
- googledocs - an interface to Google Docs
- skydrive - an interface to Microsoft's SkyDrive files
- facebook - an interface to Facebook files
- merlot - an interface to the learning materials in Merlot.org
- flickr - an interface to flickr
- youtube - an interface to YouTube
- mahara - an interface to a Mahara installation
Tables
repository
This table contains one entry for every configured external repository instance.
Field | Type | Default | Info |
id | int(10) | autoincrementing | |
repositoryname | varchar | A custom name for this reopsitory (non-unique) | |
repositorytype | varchar | The name of the plugin being used (1 special case: "local" which covers all files uploaded from desktop) | |
userid | int(10) | The person who created this repository instance | |
contextid | int(10) | The context that this repository is available to ( = system context for site-wide ones) | |
username | varchar | username to log in with, if required | |
password | varchar | password to log in with, if required | |
option1 | varchar | Other information useful to the plugin | |
option2 | varchar | Other information useful to the plugin | |
option3 | varchar | Other information useful to the plugin | |
option4 | varchar | Other information useful to the plugin | |
option5 | varchar | Other information useful to the plugin | |
timecreated | int(10) | The time this repository was created | |
timemodified | int(10) | The last time the repository was modified |
Class methods
Repository class
This class implements the interface to a particular repository, for browsing, selecting and updating files.