Index: openacs-4/packages/acs-templating/tcl/head-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/head-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-templating/tcl/head-procs.tcl 8 Jan 2008 10:17:58 -0000 1.11 +++ openacs-4/packages/acs-templating/tcl/head-procs.tcl 8 Jan 2008 13:51:27 -0000 1.12 @@ -642,3 +642,28 @@ return $footer } +ad_proc template::get_body_event_handlers { +} { + Get body event handlers specified with template::add_body_handler +} { + # Concatenate the javascript event handlers for the body tag + variable ::template::body_handlers + if {[array exists body_handlers]} { + + foreach name [array names body_handlers] { + set event [lindex [split $name ","] 0] + # ns_log notice "event $event name $name JS !!!$body_handlers($name)!!!" + foreach javascript $body_handlers($name) { + lappend body_handlers($event) "[string trimright $javascript {; }];" + } + unset body_handlers($name) + } + + # Now create the event handlers string + foreach {event script} [array get body_handlers] { + append event_handlers " " $event = \" [join $script { }] \" + } + unset body_handlers + } + return $event_handlers +} \ No newline at end of file Index: openacs-4/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v diff -u -r1.41 -r1.42 --- openacs-4/www/blank-master.tcl 8 Jan 2008 10:17:58 -0000 1.41 +++ openacs-4/www/blank-master.tcl 8 Jan 2008 13:51:26 -0000 1.42 @@ -195,27 +195,8 @@ } } -# Concatenate the javascript event handlers for the body tag -variable ::template::body_handlers -if {[array exists body_handlers]} { - - foreach name [array names body_handlers] { - set event [lindex [split $name ","] 0] - # ns_log notice "event $event name $name JS !!!$body_handlers($name)!!!" - foreach javascript $body_handlers($name) { - lappend body_handlers($event) "[string trimright $javascript {; }];" - } - unset body_handlers($name) - } - - # Now create the event handlers string - foreach {event script} [array get body_handlers] { - append event_handlers " " $event = \" [join $script { }] \" - } - unset body_handlers -} - -# Retrieve headers and footers template::head::prepare_multirows +set event_handlers [template::get_body_event_handlers] +# Retrieve headers and footers set header [template::get_header_html] set footer [template::get_footer_html]