Index: openacs-4/packages/ajaxhelper/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/doc/index.html,v diff -u -r1.6 -r1.7 --- openacs-4/packages/ajaxhelper/www/doc/index.html 25 Dec 2006 16:39:50 -0000 1.6 +++ openacs-4/packages/ajaxhelper/www/doc/index.html 8 Sep 2007 14:21:22 -0000 1.7 @@ -3,159 +3,96 @@ Ajax Helper

Ajax Helper

Hamilton G. Chua (ham@solutiongrove.com)
- November 2006
- v0.8d
+ September 2007
+ v0.87d

Components :
- Prototype v1.5.0_rc_1 (http://prototype.conio.net/)
- Scriptaculous v1.6.4 (http://script.aculo.us/)
+ Prototype v1.5.1 (http://prototype.conio.net/)
+ Scriptaculous v1.7.3 Beta (http://script.aculo.us/)
-Overlibmws (http://www.macridesweb.com/oltest/)
-Curvey Corners (http://www.curvycorners.net/)
-Yahoo User Interface Library 0.11.4 (http://developer.yahoo.com/yui/)
+Overlibmws (http://www.macridesweb.com/oltest/)
+Curvey Corners (http://www.curvycorners.net/)
+Yahoo User Interface Library 2.3.0 (http://developer.yahoo.com/yui/)
Dojo Toolkit - 0.4 (http://dojotoolkit.com)
-
-
- Introduction :
-
-
The Ajax Helper package provides TCL API to generate the - javascript from the above components to enable their various features - for use in OpenACS applications. - The motivation for this package is to easily enable Web 2.0 like - features in OpenACS applications using the most popular javascript - libraries.
-
- Prerequisites :
-
-
The ajax helper package must be installed and mounted in /ajax - to be able ot use these features. The installer should automatically - mount the ajax helper in /ajax upon installation of the package.
-

-Javascript Sources :

-

As of version 0.8d, required javascript sources will be loaded automatically depending on the wrapper function used. The following piece of code must be present in the blank-master.tcl template file to make this automated loading of javascript source files possible.

-

TCL File (blank-master.tcl) :

-

-if { ![info exists header_stuff] } {
-    set header_stuff {} 
-}
+0.4 (http://dojotoolkit.com) 
+ExtJs 1.1.1 (http://extjs.com) +

+

What's New :

+

0.87d

-# HAM : lets check ajaxhelper globals *********************** + +


+ Introduction :
+
+
The Ajax Helper package provides helper TCL API procs to generate the + javascript from the above listed components to enable their various features + for use in OpenACS applications. + The motivation for this package is to easily enable Web 2.0 like + features in OpenACS applications using the most popular javascript + libraries.
+
+ Prerequisites :
+
+
The ajax helper package must be installed and mounted in /ajax + . The installer should automatically +mount the ajax helper in /ajax/ upon installation of the package.

+

Lee Denison's template::head code must be available. This code will soon be committed to CVS head after consulting the community and some more testing.

+

In the mean time, you can find the files you need to implement template head from packages/ajaxhlper/www/docs. You should copy the files into the following locations

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
acs-integration-procs.tcl
openacs_root/packages/acs-templatng/tcl/
head-procs.tcl
openacs_root/packages/acs-templatng/tcl/
blank-master.adp
openacs_root/www/

blank-master.tcl

openacs_root/www/
site-master.adp
openacs_root/www/
site-master.tcl
openacs_root/www/
default-master.tcl
openacs_root/www/
default-master.adp
openacs_root/www/
+


+ Javascript Sources :

+

-global ajax_helper_js_sources -global ajax_helper_yui_js_sources -global ajax_helper_dojo_js_sources -set js_sources "" - -if { [info exists ajax_helper_js_sources] || [info exists ajax_helper_yui_js_sources] || [info exists ajax_helper_dojo_js_sources] } { - - # if we're using ajax, let's use doc_type strict so we can get - # consistent results accross standards compliant browsers - set doc_type { <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> } - - if { [info exists ajax_helper_js_sources] } { - append js_sources [ah::load_js_sources -source_list $ajax_helper_js_sources] - } - - if { [info exists ajax_helper_yui_js_sources] } { - append js_sources [ah::yui::load_js_sources -source_list $ajax_helper_yui_js_sources] - } - - if { [info exists ajax_helper_dojo_js_sources] } { - append js_sources [ah::dojo::load_js_sources -source_list $ajax_helper_dojo_js_sources] - } -} - -# ***********************************************************
- -# Attributes - -multirow create attribute key value -set onload {} -
-

ADP File (blank-master.adp):

-

@js_sources;noquote@
- @header_stuff;noquote@

-

Automated loading will work only if you are using a wrapper script.

-

Alternatively if you wish to have more control of what javascript sources are loaded, you can still use the ah::js_sources procedure.

-

To have the ajax helper generate - the javascript declaration ....
-
- TCL File (e.g blank-master.tcl) :
-
-    set ah_sources [ah::js_sources -default]
-
- ADP File (eg. blank-master.adp):
-
-    @ah_sources;noquote@
-
- Compiled Template:
-
- <script type="text/javascript" src="/ajax/prototype/prototype.js"></script>
- <script type="text/javascript" src="/ajax/scriptaculous/builder.js"></script>
- <script type="text/javascript" src="/ajax/scriptaculous/controls.js"></script>
- <script type="text/javascript" src="/ajax/scriptaculous/dragdrop.js"></script>
- <script type="text/javascript" src="/ajax/scriptaculous/effects.js"></script>
- <script type="text/javascript" src="/ajax/scriptaculous/slider.js"></script>
- <script type="text/javascript" src="/ajax/scriptaculous/scriptaculous.js"></script>
-
The above TCL API generates the default -sources that must be declared for you to be able to use the javascript -libraries
+As of 0.87d, all required sources and stylesheets are loaded automatically using Lee Denison's template::head code.

- -To generate the javscript sources for Overlibmws :
-
-    set ah_sources [ah::js_sources -source "overlibmws"]
-
-The functions that are responsible for rounded corners has been -extracted into rounded.js to work with scriptaculous.
- -
-    set ah_sources [ah::js_sources -source "rounder"]
-
-NOTE :
-
-You can combine sources by specifying them in the source parameter separated by commas.
-
- - set ah_sources [ah::js_sources -source -"default,overlibmws"]
-
-The above code will generate the overlibmws javascript source -declaration with the default declarations.
-
-
-Ajax Procedures :
-
+ Ajax Procedures :
+
Prototype
has a pair of javascript functions that alllow programmers to use XMLHTTP. The ajax.updater and ajax.request functions. See
The TCL API is used like this
-
-    set request [ah::ajaxrequest -url -"/url/to/call"  \
-            -            -            -            -     -pars -"parameter1=parameter_value&parameter1=parameter_value"  ]
-
+


+set request [ah::ajaxrequest -url "/url/to/call" -pars "parameter1=parameter_value&parameter1=parameter_value"]
+
The above api will generate an ajax.request javascript function that is best placed in an  event like "onClick".
-
-    <a href="#" onClick="@request;noquote@">
-
+

+<a href="#" onClick="@request;noquote@">Send Request</a>
+
Consult the api-doc for more information about other parameters you can pass on to the ah::ajaxrequest proc.

@@ -190,25 +120,19 @@ response text of the xmlhttp request.

Here's an example :
-
-       set js_update_connections -[ah::ajaxupdate -container "connections"  \
-            -    -url "/url/to/call" \
-            -    -enclose  \
-            -    -pars -"'effects=$effects&limit_n=$limit_n'"  \
-                --effect "Fade" \
-            -    -effectopts "duration: 0.5"]
-
+

+set js_update_connections [ah::ajaxupdate -container "connections" \
+				-url "/url/to/call \
+				-enclose \
+				-pars "'effects=$effects&limit_n=$limit_n'" \
+				-effect "Fade" \
+				-effectopts "duration: 0.5"]
+
On the adp side, you can just put
+

+<a href="#" onClick="@js_update_connections;noquote@">Update</a>
+

-      @js_update_connections;noquote@
-
The "-enclose" parameter tells the procedure to enclose the resulting script in script tags <script></script>. This is another option in addition to putting the scripts in html event attributes like @@ -229,58 +153,47 @@ Use ah::effects to generate javascript that allows you to implement transitional and cinematic effects to html elements. You will need to consult the scriptaculous documentation -http://wiki.script.aculo.us/scriptaculous/tags/effects to know what +
http://wiki.script.aculo.us/scriptaculous/tags/effects to know what kinds of effects and what kinds of options you can pass to the effect script.

-The procedure is called in this manner :
-
-    set effect [ah::effect -element "container"
-            -            -               --effect "Fade"
-            -            -        -       -options "duration: 1.5"]
-NOTE :
-The Effect name and the options are case sensitive.
-
-

-DHTML Callouts :
-
-
There is currently basic support for overlibmws. Right now we -are able to create bubble type call outs.
-
-In your tcl file ...
-
-   set onmouseover [ah::bubblecallout -text " Contents of My -Popup" ]
-
-The adp file should have something like this ....
-  
-   <a href="#" @onmouseover;noquote@ >Link with -Popup</a>
-
-Drag and Drop Sortables :
-
-
Sortables are documented in the scriptaculous wiki +set effect [ah::effect -element "container" -effect "Fade" -options "duration: 1.5"] + +

On the adp file you must put the javascript on a click event

+

+<a href="#" onClick="@effect;noquote@">Show Effect</a>
+

NOTE :
+ The Effect name and the options are case sensitive.
+
+

+ DHTML Callouts :
+
+
There is currently basic support for overlibmws. Right now we + are able to create bubble type call outs.
+
+In your tcl file ... +


+   set onmouseover [ah::bubblecallout -text " Contents of My Popup" ]
+
+ The adp file should have something like this ....
+

+<a href="#" @onmouseover;noquote@ >Link with Popup</a>
+
+
+ Drag and Drop Sortables :
+
+
Sortables are documented in the scriptaculous wiki
http://wiki.script.aculo.us/scriptaculous/show/Sortables.
-For sortables to work you will need to define a container which will -hold the elements you want to be sortable.
-
-Here is what the script looks like
-
-    append scripts [ah::sortable -element "container"
-            -            -            -            -     -options -"tag:'div',only:'portlet',overlap:'horizontal',constraint:false,ghosting:false"]
-
-You adp page should contain a div with id attribute container. This "container" should have subcontainers which the above script will make -sortable.

+ For sortables to work you will need to define a container which will + hold the elements you want to be sortable.
+
+ Here is what the script looks like
+

+append scripts [ah::sortable -element "container" -options "tag:'div',only:'portlet',overlap:'horizontal',constraint:false,ghosting:false"]
+
+ You adp page should contain a div with id attribute container. This "container" should have subcontainers which the above script will make + sortable.