Index: openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl 8 Sep 2007 14:21:22 -0000 1.9 +++ openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl 14 Aug 2008 00:48:06 -0000 1.10 @@ -8,6 +8,60 @@ namespace eval ah { } +# ********** Use the acs-subsite extra headers callback to load ajaxhelper scripts ****************** + +ad_proc -public -callback subsite::get_extra_headers -impl my_implementation {} { + replaces the ajaxhelper-template include +} { + + global ajax_helper_js_sources + global ajax_helper_yui_js_sources + global ajax_helper_dojo_js_sources + global ajax_helper_custom_scripts + global ajax_helper_init_scripts + + set js_sources "" + set init_body "" + + 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] + + # Yahoo has implemented a theming system, to make the css work, a class must be added + # to the body of the page before any widget is rendered + append init_body [ah::yui::cssclass \ + -varname "yuiclass" \ + -action "add" \ + -element "document.body" \ + -classname "yui-skin-sam" \ + -element_is_var ] + } + + if { [info exists ajax_helper_dojo_js_sources] } { + append js_sources [ah::dojo::load_js_sources -source_list $ajax_helper_dojo_js_sources] + } + + if { ![info exists ajax_helper_custom_scripts] } { set ajax_helper_custom_scripts "" } + if { [info exists ajax_helper_init_scripts] } { append init_body $ajax_helper_init_scripts } + + set js_init_script [ah::create_js_function -name "ah_page_init" -body ${init_body}] + + set script " + ${js_init_script} + ${ajax_helper_custom_scripts} + " + + append js_sources [ah::enclose_in_script -script ${script}] + + return $js_sources + +} + + # ********* Loading Sources ********** ad_proc -private ah::requires {