Index: openacs-4/packages/acs-subsite/www/resources/core.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/resources/core.js,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-subsite/www/resources/core.js 29 Mar 2011 15:48:46 -0000 1.13 +++ openacs-4/packages/acs-subsite/www/resources/core.js 21 May 2015 09:55:38 -0000 1.14 @@ -1,23 +1,14 @@ -/* Emulate getElementById on document.all only browsers. Requires - that IDs are unique to the page and do not coincide with NAME - attributes on other elements:- - Source: http://www.litotes.demon.co.uk/js_info/faq_notes/alt_dynwrite.html#getEl -*/ -if((!document.getElementById) && document.all){ - document.getElementById = function(id){return document.all[id];}; -} - +/* The function acs_Focus is included in blank-master.tcl function acs_Focus(form_name, element_name) { if (document.forms == null) return; if (document.forms[form_name] == null) return; if (document.forms[form_name].elements[element_name] == null) return; if (document.forms[form_name].elements[element_name].type == 'hidden') return; document.forms[form_name].elements[element_name].focus(); -} +} */ - function acs_FormRefresh(form_name) { if (document.forms == null) return; if (document.forms[form_name] == null) return; Index: openacs-4/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v diff -u -r1.54 -r1.55 --- openacs-4/www/blank-master.tcl 27 Apr 2015 15:29:05 -0000 1.54 +++ openacs-4/www/blank-master.tcl 21 May 2015 09:55:38 -0000 1.55 @@ -73,13 +73,22 @@ # Add standard javascript # -# Antonio Pisano 2015-03-27: current web guidelines discourage references to -# 'big' libraries into head, as they block page rendering until they are downloaded. -# Move core.js inclusion to the bottom of the body. -# See http://www.openacs.org/forums/message-view?message_id=4266252 +# Include core.js inclusion to the bottom of the body. +# The only function needed alread onload is acs_Focus() +# template::add_body_script -type "text/javascript" -src "/resources/acs-subsite/core.js" -# template::head::add_javascript -src "/resources/acs-subsite/core.js" +template::head::add_javascript -script { + function acs_Focus(form_name, element_name) { + if (document.forms == null) return; + if (document.forms[form_name] == null) return; + if (document.forms[form_name].elements[element_name] == null) return; + if (document.forms[form_name].elements[element_name].type == 'hidden') return; + + document.forms[form_name].elements[element_name].focus(); + } +} + # The following (forms, list and xinha) should # be done in acs-templating. @@ -255,6 +264,5 @@ # Retrieve headers and footers set header [template::get_header_html] set footer [template::get_footer_html] - template::head::prepare_multirows set event_handlers [template::get_body_event_handlers]