Add jQuery support for ordering playlists instead of using the Scriptaculous/Prototype library
| Project: | Playlist (toolkit, modules) |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
With the incorporation of jQuery as the default javascript library for Drupal 5.0, then include support for the jQuery sortables extension for the drag and drop functionality to order playlists. This means dropping Scriptaculous/Prototype support in future versions of the playlist module.
As stated in this issue, there is an Interface Elements Extension pack for jQuery split licensed under MIT & GPL that adds draggable sorting.
To download click on "Sortables," which will download the "Sortables, Draggables and Droppables" extension packs.
Ayman incorporated some drag and drop functionality into the panels module using this extension pack. This might be helpful in figuring out how to incorporate it into the playlist module. Ayman says:
A while ago I posted an article about creating a drag-and-drop interface using Script.aculo.us and Drupal, many were interested in a more functional module especially that Drupal 5.0 provides better JavaScript support with the inclusion of jQuery. Mark recommended integrating this drag/drop functionality into your panels module, I checked the module and indeed I found it to be an excellent backend for my work.
As stated by zirafa, the 4.7 branch can operate in non-JS mode unless someone takes up properly supporting it with either the SPAJAX module or better yet with the jQuery47 module.
One consideration for backporting this jQuery sorting to 4.7 is that there is a conflict between jQuery library and the 4.7 drupal.js library with the "$" function. The jQuery47 module description says:
First, a note: to make jQuery compatible with Drupal, I had to rename the $ function to JQ. Sorry, there's really no way around this. When Drupal 5.0 comes out, you'll have to rename all your calls to JQ('...') to $('...').
Not sure if the "$" function will be used in incorporating jQuery into the playlist 5.0 version, but this is one consideration for backporting this update back to the 4.7 branch.

#1
Just a note: I took out the scriptaculous library. If you want drag and drop support, you can download scriptaculous and put all the scripts in:
modules/playlist/scripts/
directory and it should still work. If the files aren't there it goes into non-JS mode.
I have had problems with the $ incompatibility with jQuery. In my opinion, the jQuery backport is a hacky solution. The best you can do is rename all $ to $id in all js function calls in drupal core. Then you can use jQuery as normal without conflict. When 5.0 comes out, you update core which uses jQuery $ function calls so there is no longer any inconsistency and all is well.
#2
Just checked out the jQuery47 module. This might be a nice interim solution. Anybody up for it?