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 e.g. download file(s) to local computer or 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, intrnalmedia).
ArtefactTypeCloud class extends
ArtefactType and adds/requires