Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Student projects/Presets for Database module.

Student projects/Presets for Database module: Difference between revisions

From MoodleDocs
Line 14: Line 14:
* 'onadd'  called every time something's added to the database.
* 'onadd'  called every time something's added to the database.


Actions
Actions (customizable)
* 'makethumbnail' creates a thumbnail of an image field and stores it in another image field.
* 'makethumbnail' creates a thumbnail of an image field and stores it in another image field.
* 'addzip' adds contents of zip as records.
* 'addzip' adds contents of zip as records.

Revision as of 14:20, 2 June 2006

This project aims to increase the flexibility of the Database module and to add some user friendly preset modes to help users create useful modules quickly. Also, it is important to build a way of importing and exporting presets so admins can customize what is available to the user.

I plan to implement several presets, including a good quality image gallery, a document sharing facility and a glossary.

Goals

Custom Code

To acheive the quality and usability needed, adding customizable code into the database module will be required. For instance, the image gallery will need code to resize images on upload. Therefore, I will create an easy to use interface with events such as onsave(file) and onview(id). These events will be linked to actions which will perform the operation. I propose that the actions should be stored globally and only the links between event and action be stored in the template (see below for explanation). The event driven interface should be easy to work with and use, but also allowing flexability.

Proposed Interface

Events

  • 'onsave' called every time a record is modified.
  • 'onview' called every time a record is viewed.
  • 'onlist' called every time a record appears in a list.
  • 'onadd' called every time something's added to the database.

Actions (customizable)

  • 'makethumbnail' creates a thumbnail of an image field and stores it in another image field.
  • 'addzip' adds contents of zip as records.

The image gallery will definitely use this to generate thumbnails to be used in list view. Also could be used to allow uploads of .zip files containing many images. This idea could also be applied to other databases. Something important to discuss is how the user/admin will edit the code. Obviously it is silly to allow editing of the actual source through the website (for security), hence this event-action scheme.

This may lose a lot of the flexibility though, so I'm not sure yet if this is the best way of doing it.

Presets

  • Image Gallery
  • Document Sharing
  • Glossary

Also, a preset manager will be needed to allow admins to add, remove and modify the presets available to their users. This will be part of the config page for the database module.

Upload and Save

A preset will turn into a template when teachers modify it. Then they will be able to download the template, or upload one to use. This will allow users to create a custom database they can use many times.

Backup and Restore

It is also important for presets to be included in backup and restore, so that modified presets are kept.

Milestones in the Project

  1. Adding the custom code feature to the database module.
    • Design a suitable interface and system for storing the code.
    • Adding the execution code to the database module.
  2. Designing the Image Gallery preset, and the other presets.
    • Designing the UI
    • Writing the custom event code (for adding photos etc.)
    • Maybe create a slideshow type display...
  3. Adding the admin features
    • Preset Manager page
    • Backup and Restore