Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Student projects/AJAX course format

From MoodleDocs

Current Progress

I am currently working on research and planning.

Research and planning

There has been some discussion on the forums about the want to use a RIA library, this would be a more elegant solution than homebrew but more research needs to be done as to whether one can be found that does not cause the same compatibility issues as Scriptaculous has been shown too by extending the built-in Array and Object classes.

RIA libraries

Several people have hacked RIA libraries,such as Scriptaculous, into their moodle installations to add functionality such as drag-and-drop. We need to determine which would be best to Integrate into the moodle codebase.

These are some of the most popular: (while this may not be a popularity contest I believe that we want to work with one that is well supported and has a decent community following)

Scriptaculous

Site: http://script.aculo.us/

Licence:MIT (GPL compatible)

  • Drag and Drop
  • Auto Complete
  • Sorting
  • Effects

Pros: This has already been implemented in some user's Moodle installations and is known to work (aside from the problems mentioned below)

Cons: One of the major drawbacks of Scriptaculous(and the prototype toolkit which it uses) is that it uses the prototype object to extend javascripts built in Array object which can cause strange behaviors. As far as I know this has only caused problems with moodle's texteditor but having odd behavior like this exist is something I would prefer to avoid as opposed to asking developers to be sure and code around it.

It also currently supports a rather small feature set.

DOJO

Site: http://dojotoolkit.org/

Licence: Dual - AFL and BSD(GPL compatible)

Features:

  • Drag and drop
  • Effects (wipe,fade etc...)
  • offline Storage
  • rather complete Widget Set

Pros:

This Library seems a bit more refined than scriptaculous, it also has big name backing(IBM,AOL,OpenLazlo...et al) which is a good sign that it will be around for a while. The offline storage component is a novel concept which none of the others seem to have.

Cons:

Their [Documentation] is not complete(~60%).

MochiKit

Site: http://mochikit.com/

License: Dual - AFL or MIT(GPL compatible)

Published Compatibility: Safari, IE 6+, FF 1.0+

Features:(well documented by them on the following page) http://mochikit.com/doc/html/MochiKit/index.html

  • extended DOM Manipulation
  • Logging
  • Full Async Request handling
  • Visual Effects
  • Sorting
  • Drag and Drop
  • Event Handling


Pros They stress reliability and Documentation.More of a library in a traditional sense, the functions are well organized and very reusable. They also claim compatibility with other libraries. Their library is setup well for any extensions anyone wants to make to it(the documentation helps a lot too). Very developer friendly.


Cons: Drag and drop was adapted for scriptaculous so it may have the same issues that they had.

  • Note, actually I don't think there are any cons. I have checked out the difference between the 'Prototype' and 'Mochikit' scriptaculous drag and drop implementations. Mochikit will not break Moodle - here's why:

Scriptaculous drag and drop uses prototyped array functions - e.g.

   this.drops.each( function(drop) {

Mochikit drag and drop (based on Scriptaculous) uses non prototyped array functions - e.g.

   MochiKit.Iter.forEach(this.drops, function (drop) {

Both lines of code achieve exactly the same results but MochiKit does not prototype the array object. Notice how Mochikit passes the array object into the forEach function rather than calling a prototyped 'each' function. Hail to Mochikit. Its fantastic. Also, it has a swanky logger function that is amazing for debugging.

Rico

Site:openRico.org

Licence:Apache 2.0(incompatible with GPL [[1]]) {I see no point to review further}

Yahoo Library (YUI)

Site: http://developer.yahoo.com/yui/

Licence: BSD(gpl compatible)

  • full ASYNC request management
  • DOM functions(mostly design oriented)
  • Animation
  • Drag and Drop
  • Event Handling
  • Autocomplete
  • Menus/Sliders/Trees

Pros: Fairly well documented and seems rather mature for a recent release.

Cons: Library is still kind of young, community support is lacking. Would be depending on yahoo to continue support.

Recommendation

After reading through their sites and materials I feel that mochiKit would be the best implementation for moodle. I feel that it's framework fits in well with moodle's general design(as I have seen it). I was particularly impressed by their level of documentation, their obsession with reliability (which surprisingly neither of these concepts were particularly stressed by the other toolkits) and also by how extensible they designed their library to be.

PHP Ajax Libraries

XAJAX

Site: http://xajaxproject.org/

Licence: LGPL

This library allows for better integration of php and javascript using AJAX. For example it will allow you to pass arrays/ associative arrays/ and objects(although it will convert these to associative arrays of properties) between the two, allows you to specify on the PHP side elements to update on the javascript, or commands to run. Eleminates the need to write javascript return Handlers.

Would be moderately usefull but not nessicary

Pros: Rather Well documented.

Specifications

Other Links to spec discussions

Would love to implement(perhapes beyond scope of project)

I was thinking that a javscript "Widget" type system would be great to impliment. To allow teachers to enable these widgets for their students to use. Perhapes start out with some standard ones, a Calculator, Periodic table, dictionary, etc... and allow a easy api for custom class-specific ones.

Just thinking though, any work on that would have to be after the rest.

Project suggestion

From Student projects:

AJAX course format
Background
 
The current course formats are designed to work on lower browsers and older technologies. They are highly compatible with browsers but can    
really slow down the course creation process.
Overview
 
Design a clean, extensible method for implementing a course format using AJAX. This may require development of a web service to service   
the Javascript front end.
Details

  1. It should be optional and accessible, so that it can drop back to the current interface on browsers that are incapable of dealing with dynamic pages.
  2. Blocks can be dragged and dropped.
  3. Sections can be dragged and dropped, made hidden or visible.
  4. Activities and resources can be dragged and dropped, made hidden or visible, have the group status changed, etc. 

Mentors: Martin Dougiamas and Urs Hunkler

Programmer: Edward Coyne