|
|||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||
Template::head is now done and available in OpenACS 5.4.
I believe the introduction of these apis would:
The template::head::* api manipulates the head section of the document that will be returned to the users client. Packages should use this api to add package specific javascripts, CSS, link tags and meta tags to the HTML document. The api consists of:
Add a script to the head section of the document to be returned to the users client. A script library in an external file may only be included once; subsequent calls to add_script will replace the existing entry. Anonymous script blocks will be added without checking for duplicates; the caller must ensure that anonymous script blocks are not inadvertantly added multiple times. You must supply either src or script.
Add a link tag to the head section of the document to be returned to the users client. A given target document may only be added once for a specific relation; subsequent calls to add_link will replace the existing entry.
Add a meta tag to the head section of the document to be returned to the users client. A meta tag with a given name or http-equiv may only be added once; subsequent calls to add_meta will replace the existing entry. You must supply either name or http_equiv.
Add a script of type 'text/javascript' to the head section of the document to be returned to the users client. This functions is a wrapper around template::head::add_script. You must supply either src or script.
@see template::head::add_script
Add a link tag with relation type 'stylesheet' or 'alternate stylesheet', and type 'text/css' to the head section of the document to be returned to the users client. A given target stylesheet may only be added once; subsequent calls to add_css will replace the existing entry. This function is a wrapper around template::head::add_link.
@see template::head::add_link
Adds javascript code to an event handler in the body tag. Several
javascript code blocks may be assigned to each handler by subsequent calls
to template::add_body_handler.
If your script may only be added once you may supply an identifier.
Subsequent calls to template::add_body_handler with the same identifier
will replace your script rather than appending to it.
event may be one of:
@param event the event during which the supplied script should be
executed
@param script the javascript code to execute
@param identifier a name, if supplied, used to ensure this javascript code
is only added to the handler once
Add a script to the start of the body section of the document to be returned
to the users client. You <strong>must</strong> supply either src or script.
@param type the type attribute of the script tag, eg. 'text/javascript'
@param defer whether execution of the script should be defered until after
the page has been loaded
@param src the src attribute of the script tag, ie. the source url of the
script
@param charset the charset attribute of the script tag, ie. the character
set of the script if it differs from the main document
@param script the inline script for the body of the script tag. This
parameter will be ignored if a value has been supplied for
src
Add a header include to the beginning of the document body. This function
is used by site wide services to add functionality to the beginning of a
page. Examples include the developer support toolbar, acs-lang translation
interface and the acs-templating WYSIWYG editor textarea place holder. If
you are not implementing a site wide service, you should not be using this
function to add content to your page. You must supply either src or html.
@param direction whether the header should be added as the outer most
page content or the inner most
@param src the path to the include
@param params a list of name, value pairs to pass as parameter to the
include
@param html literal html to include in the page. This parameter will
be ignored if a values has been supplied for src.
@see template::add_footer
Add a footer include to the end of the document body. This function
is used by site wide services to add functionality to the end of a
page. Examples include the developer support toolbar, acs-lang translation
interface and the acs-templating WYSIWYG editor textarea place holder. If
you are not implementing a site wide service, you should not be using this
function to add content to your page. You must supply either src or html.
@param direction whether the footer should be added as the outer most
page content or the inner most
@param src the path to the include
@param params a list of name, value pairs to pass as parameter to the
include
@param html literal html to include in the page. This parameter will
be ignored if a values has been supplied for src.
@see template::add_header
Reset all templating variables which must be initialised on every request.
template::reset_request_vars would be called at the beginning of the tcl/adp extension handler (adp_parse_ad_conn_file) to reinitialise the global variables used by this api on each request.