From Mahara Wiki
The initial idea behind Repository plugin was to upgrade Mahara in a way that Mahara would allow users to connect to their external cloud repository services (e.g. Box.net, Dropbox, SugarSync, Google Docs/Drive, Windows Live SkyDrive, iCloud, etc.) and that tey would be able to include those files in their pages in similar fashion as they include files from local Mahara file repository.
The idea then developed into supporting not only external cloud repository services but also to support adding "content" from other kind of external cloud services (e.g. references from Zotero). At that point plugin was renamed from Repository into Cloud plugin...
Because the initial idea was to support external repositories, the terms "file" and "folder" were used. They are still in use in the source code, but they now have broader meaning:
- file represents actual file, photo, reference or any other item
- folder represents actual folder, album of photos, collection of references or any other collection of items
After this brief intro, let's look at the spec itself.
The code for Cloud plugin itself is organized in the following way: every external cloud service (for every user) is represented as cloud artefact.
This artefact hold following information:
- artefacttype, owner, etc. - as every other artefact in Mahara
- title - which is basically the name of external cloud service
- description - which contain all the information to access external cloud service, such as: access token, access token secret, refresh token, etc. (depends on which info external service returns)
Manage Cloud Services
External cloud services can be accessed via Mahara's top menus: Content > Services.
This page is kind of dashboard for external services that are installed and enabled by admin. This page shows if the user has granted access to each individual cloud service or not. If the access is granted than the user can:
- check service account information (which include user id, username, email or profile url and quota)
- "manage" cloud service content, which means that a user can:
- download file(s) to local computer
- save file(s) to selected folder in his/her Mahara file repository
To represent tree-like structure of repsitory data (folders, sub-folders and files) a new Pieform element was needed. For the appropriate representation of file, folder and sub-folder data in a table and an option to change the data on-the-fly the jQuery DataTables were chosen.
Individual Cloud Services
To add support for each individual external cloud service the appropriate blocktype should be created in the blocktype sub-folder. This is similat to other Mahara artefacts (e.g. file artefact has the following blocktypes: filedownload, folder, gallery, html, image, internalmedia).
PluginBlocktypeCloud class was created, which extends
PluginBlocktype and adds common methods to acces and work with data from external cloud services:
service_list- method that returns data about cloud service (if the user has granted access or not, etc.)
request_token- method for requesting OAuth request token
access_token- method for acquiring OAuth access token
delete_token- method for deleting token (on Mahara side)
revoke_access- method for revoking access (on Cloud Service's side), if this is supported by Cloud Service
account_info- method which returns info about Cloud Service account (user id, username, quota, etc.)
get_filelist- method that creates list of file which user selected, that are than displayed on a page
get_folder_content- method to dinamically show the content of a folder; used in manage page and blocktpye config form and allows traversing the folder/sub-folder tree on Cloud Service
get_folder_info- method that returns info about folder (folder name, description, id, etc.)
get_file_info- method that returns info about file (file name, description, id, etc.)
download_file- method that allows user to download a file from Cloud Service to local computer
embed_file- method that allows user to embed a file from Cloud Service to Mahara page
Currently supported/implemented Cloud Services
Currently the following Cloud Services are supported/implemented:
The Cloud Service which are currently in development:
- Google Docs/Drive
- Windows Live SkyDrive
Cloud Services that should/will be supported in the future
The following Cloud Services which (in my oppinion) should be supported in the future:
- Alfresco (?)
And the ones that the attendees of MaharaUK 2012 suggested: