Forum OpenACS Development: Javascript Toolkits/AJAX

Collapse
Posted by Dave Bauer on
I need to add some drag and drop javascript magic for a client project. Has anyone tried to do this with some of the existing Javascript toolkits?

Here are some that I have found:

(thanks to Patrick G for his comments below)

http://twilightuniverse.com/projects/sack/
I did not find SACK very impressive. It seems to be a very thin layer of functionality.

http://www.modernmethod.com/sajax/
SAJAX seems slightly better but apparently needs a backend, which is not available in TCL, but given that they have PHP, Perl, Ruby backends, it might be relatively trivial to code up a few procs.

http://mochikit.com/
I really liked the MochiKit sortable table - I think it would make an excellent replacement for listbuilder in some cases (Rico has similar functionality, but I don't think it looks as nice).

The Rico stuff also looks good.
http://openrico.org/rico/home.page

http://script.aculo.us/
ScriptAculous has the exact thing we want for drag and drop. Look at the drag and drop shopping cart under the demos... link, as well as the sortable floats demo. That sort of thing is I think what will make for a drag and drop calendar. Might need some stuff ported from Ruby, not sure.

and here are some more links

http://www.ajaxian.com/archives/2005/10/ajax_framework_2.html

Collapse
Posted by Nick Carroll on
I played around with openrico a couple months ago, and found it was quite easy to use. Just include a couple of javascript libraries in the page, and wrap certain elements with CSS and away you go. I just used the examples provided.

I would like to use more ajax stuff with the things I'm working on. Would it be possible to include a library in openacs core?

Collapse
Posted by Nick Carroll on
Dave,

You should also check out the stuff that this guy has done at http://www.walterzorn.com/

His javascript vector graphics library is pretty cool.

Cheers,
Nick.

Collapse
Posted by Rocael Hernández Rizzardini on
Just as a comment, we plan to integrate some ajax stuff into .LRN to facilitate many user interaction areas.
Collapse
Posted by Malte Sussdorff on
Rocael: What and until when? Do you have a timeline already?

Dave: If you get drag and drop working, will you put it into File Storage or where do you need it. If you don't put it into File Storage, can you post what you did. And do you have a timeline as well?

Collapse
Posted by Rocael Hernández Rizzardini on
plan will be settled in november 05, we'll keep posting.
Collapse
Posted by Fridolin Wild on
I had one project in which I applied Walter Zorn's drag&drop library. It was used to enable users to drag around the toolboxes in a 'visual lay-out' CMS.

I intended to add support for dragging the content building blocks as well, Walter even modified the library to support dynamic adding of draggable elements, but unfortunately I never came around...

Dynamic adding means, that you not only can drag elements that exist already at the first time the web page has been called, but that you can add (via javascript) new elements (e.g. a new dhtml layer with a specific content, or a new 'iframe') -- and allow drag & drop for these as well.

Walter's lib can be found at:
http://www.walterzorn.com/dragdrop/dragdrop_e.htm

Best,
Fridolin

Collapse
Posted by Dave Bauer on
Rocael,

Please start listing the requirements you have so we can better coordinate this. It would be best if we could have a Tcl API with corresponding ADP tags or whatever to support these toolkits. Also it would be best if we decide what tools to use so we don't end up with two different drag/drop libraries in OpenACS.

Collapse
Posted by Nick Carroll on
Dave, how do we add a custom ADP tag? I've looked at acs-templating, and I wasn't sure where to start. Would you be able to list the process one would follow to create a custom ADP tag?

Thanks,
Nick.

Collapse
Posted by russ m on
nick - it's dead easy, once you know how... :)

for empty (self-closing) tags -

template_tag tag_name { params } {

  do stuff

  template::adp_append_string $html
}
in the script body, $params is an ns_set of the attributes and properties passed to the custom tag. if the value equals the key it's an attribute, otherwise it's a property. $html is what ends up getting inserted into the page.

tags with content are exactly the same, except for an extra "chunk" parameter that gives you whatever was inside the tag...

template_tag tag_name { chunk params } {

  do stuff

  template::adp_append_string $html
}
Collapse
Posted by Nick Carroll on
Thanks Russell,

So I can just place this stuff in my package's tcl directory, preferably in a *-init.tcl file?

Collapse
Posted by russ m on
chuck it in a -procs.tcl file - template_tag foo ... just creates a proc called template_tag_foo that is called by the oacs adp parser, so it's fine to reload or watch it...