• Publicity: Public Only All

head-procs.tcl

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.

Location:
packages/acs-templating/tcl/head-procs.tcl
Created:
2007-05-18
Author:
Lee Denison <lee@xarg.co.uk>

Procedures in this file

Detailed information

template::add_body_handler (public)

 template::add_body_handler -event event -script script \
    [ -identifier identifier ]

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:

  • onload
  • onunload
  • onclick
  • ondblclick
  • onmousedown
  • onmouseup
  • onmouseover
  • onmousemove
  • onmouseout
  • onkeypress
  • onkeydown
  • onkeyup

Switches:
-event (required)
the event during which the supplied script should be executed
-script (required)
the javascript code to execute
-identifier (defaults to "anonymous") (optional)
a name, if supplied, used to ensure this javascript code is only added to the handler once

template::add_body_script (public)

 template::add_body_script [ -async ] [ -charset charset ] \
    [ -crossorigin crossorigin ] [ -defer ] [ -integrity integrity ] \
    [ -script script ] [ -src src ] [ -type type ]

Add a script to the start of the body section of the document to be returned to the users client. You must supply either src or script.

Switches:
-async (boolean) (optional)
whether execution of the script should be executed asynchronously as soon as it is available
-charset (optional)
the charset attribute of the script tag, ie. the character set of the script if it differs from the main document
-crossorigin (optional)
Enumerated attribute to indicate whether CORS (Cross-Origin Resource Sharing) should be used
-defer (boolean) (optional)
whether execution of the script should be defered until after the page has been loaded
-integrity (optional)
provide hash values for W3C Subresource Integrity recommentation
-script (optional)
the inline script for the body of the script tag. This parameter will be ignored if a value has been supplied for src
-src (optional)
the src attribute of the script tag, ie. the source url of the script
-type (defaults to "text/javascript") (optional)
the type attribute of the script tag, eg. 'text/javascript'

template::add_confirm_handler (public)

 template::add_confirm_handler [ -event event ] [ -message message ] \
    [ -CSSclass CSSclass ] [ -id id ] [ -formfield formfield ]

Register an event handler for confirmation dialogs for elements either with a specified ID, CSS class, or for a formfield targeted by form id and field name.

Switches:
-event (defaults to "click") (optional)
register confirm handler for this type of event
-message (defaults to "Are you sure?") (optional)
Message to be displayed in the confirmation dialog
-CSSclass (defaults to "acs-confirm") (optional)
register confirm handler for this CSS class
-id (optional)
register confirm handler for this HTML ID
-formfield (optional)
register confirm handler for this formfield, specified in a list of two elements in the form { form_id field_name }
Author:
Gustaf Neumann

template::add_event_listener (public)

 template::add_event_listener [ -event event ] [ -CSSclass CSSclass ] \
    [ -id id ] [ -formfield formfield ] [ -usecapture ] \
    [ -preventdefault ] -script script

Register an event handler for elements either with a specified ID, CSS class, or for a formfield targeted by form id and field name.

Switches:
-event (defaults to "click") (optional)
register handler for this type of event
-CSSclass (defaults to "acs-listen") (optional)
register handler for this CSS class
-id (optional)
register handler for this HTML ID
-formfield (optional)
register handler for this formfield, specified in a list of two elements in the form { form_id field_name }
-usecapture (boolean) (defaults to "false") (optional)
-preventdefault (boolean) (defaults to "true") (optional)
-script (required)
Author:
Gustaf Neumann

template::add_footer (public)

 template::add_footer [ -direction direction ] [ -src src ] \
    [ -params params ] [ -html html ]

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.

Switches:
-direction (defaults to "outer") (optional)
whether the footer should be added as the outer most page content or the inner most
-src (optional)
the path to the include
-params (optional)
a list of name, value pairs to pass as parameter to the include
-html (optional)
literal html to include in the page. This parameter will be ignored if a values has been supplied for src.

See Also:

template::add_header (public)

 template::add_header [ -direction direction ] [ -src src ] \
    [ -params params ] [ -html html ]

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.

Switches:
-direction (defaults to "outer") (optional)
whether the header should be added as the outer most page content or the inner most
-src (optional)
the path to the include
-params (optional)
a list of name, value pairs to pass as parameter to the include
-html (optional)
literal html to include in the page. This parameter will be ignored if a values has been supplied for src.

See Also:

template::add_script (public)

 template::add_script [ -async ] [ -charset charset ] \
    [ -crossorigin crossorigin ] [ -defer ] [ -integrity integrity ] \
    [ -order order ] [ -script script ] [ -section section ] \
    [ -src src ] [ -type type ]
Switches:
-async (boolean) (optional)
whether execution of the script should be executed asynchronously as soon as it is available
-charset (optional)
the charset attribute of the script tag, ie. the character set of the script if it differs from the main document
-crossorigin (optional)
Enumerated attribute to indicate whether CORS (Cross-Origin Resource Sharing) should be used
-defer (boolean) (optional)
whether execution of the script should be defered until after the page has been loaded
-integrity (optional)
provide hash values for W3C Subresource Integrity recommentation
-order (defaults to "0") (optional)
specify inclusion order
-script (optional)
the inline script for the body of the script tag. This parameter will be ignored if a value has been supplied for src
-section (defaults to "head") (optional)
section, where script is added ("head" or "body")
-src (optional)
the src attribute of the script tag, ie. the source url of the script
-type (defaults to "text/javascript") (optional)
the type attribute of the script tag, eg. 'text/javascript'

template::get_body_event_handlers (public)

 template::get_body_event_handlers

Get body event handlers specified with template::add_body_handler

template::get_footer_html (public)

 template::get_footer_html

Get footers as a chunk of html suitable for insertion into blank-master.adp Called only from blank-master.tcl

template::get_header_html (public)

 template::get_header_html

Get headers as a chunk of html suitable for insertion into blank-master.adp Called only from blank-master.tcl

template::head::add_css (public)

 template::head::add_css [ -alternate ] -href href [ -media media ] \
    [ -title title ] [ -lang lang ] [ -order order ]

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.

Switches:
-alternate (boolean) (optional)
sets the rel attribute of the link tag defining to 'alternate stylesheet' if set, sets it to 'stylesheet' otherwise
-href (required)
the href attribute of the link tag, eg. the target stylesheet
-media (defaults to "all") (optional)
the media attribute of the link tag describing which display media this link is relevant to. This may be a comma separated list of values, eg. 'screen,print,braille'
-title (optional)
the title attribute of the link tag describing the target of this link
-lang (optional)
the lang attribute of the link tag specifying the language of its attributes if they differ from the document language
-order (defaults to "0") (optional)

See Also:

template::head::add_javascript (public)

 template::head::add_javascript [ -async ] [ -charset charset ] \
    [ -crossorigin crossorigin ] [ -defer ] [ -integrity integrity ] \
    [ -order order ] [ -script script ] [ -src src ]

Add a script of type 'text/javascript' to the head section of the document to be returned to the users client. This function is a wrapper around template::head::add_script. You must supply either src or script.

Switches:
-async (boolean) (optional)
whether execution of the script should be executed asynchronously as soon as it is available
-charset (optional)
the charset attribute of the script tag, ie. the character set of the script if it differs from the main document
-crossorigin (optional)
Enumerated attribute to indicate whether CORS (Cross-Origin Resource Sharing) should be used
-defer (boolean) (optional)
whether execution of the script should be defered until after the page has been loaded
-integrity (optional)
provide hash values for W3C Subresource Integrity recommentation
-order (defaults to "0") (optional)
specify inclusion order
-script (optional)
the inline script for the body of the script tag. This parameter will be ignored if a value has been supplied for src
-src (optional)
the src attribute of the script tag, ie. the source url of the script

See Also:

template::head::add_link (public)

 template::head::add_link [ -crossorigin crossorigin ] -href href \
    [ -integrity integrity ] [ -lang lang ] [ -media media ] \
    [ -order order ] -rel rel [ -title title ] [ -type type ]

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 specified relation; subsequent calls to add_link will replace the existing entry.

Switches:
-crossorigin (optional)
Enumerated attribute to indicate whether CORS (Cross-Origin Resource Sharing) should be used
-href (required)
the href attribute of the link tag, eg. the target document of the link
-integrity (optional)
provide hash values for W3C Subresource Integrity recommentation
-lang (optional)
the lang attribute of the link tag specifying the language of its attributes if they differ from the document language
-media (optional)
the media attribute of the link tag describing which display media this link is relevant to. This may be a comma
-order (defaults to "0") (optional)
specify inclusion order
-rel (required)
the rel attribute of the link tag defining the relationship of the linked document to the current one, eg. 'stylesheet'
-title (optional)
the title attribute of the link tag describing the target of this link
-type (optional)
the type attribute of the link tag, eg. 'text/css' separated list of values, eg. 'screen,print,braille'

template::head::add_meta (public)

 template::head::add_meta [ -http_equiv http_equiv ] [ -name name ] \
    [ -scheme scheme ] [ -content content ] [ -lang lang ]

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.

Switches:
-http_equiv (optional)
the http-equiv attribute of the meta tag, ie. the HTTP header which this metadata is equivalent to eg. 'content-type'
-name (optional)
the name attribute of the meta tag, ie. the metadata identifier
-scheme (optional)
the scheme attribute of the meta tag defining which metadata scheme should be used to interpret the metadata, eg. 'DC' for Dublin Core (http://dublincore.org/)
-content (optional)
the content attribute of the meta tag, ie the metadata value
-lang (optional)
the lang attribute of the meta tag specifying the language of its attributes if they differ from the document language

template::head::add_script (public)

 template::head::add_script [ -async ] [ -charset charset ] \
    [ -crossorigin crossorigin ] [ -defer ] [ -integrity integrity ] \
    [ -order order ] [ -script script ] [ -src src ] [ -type type ]

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 inadvertently added multiple times. You must supply either src or script.

Switches:
-async (boolean) (optional)
whether execution of the script should be executed asynchronously as soon as it is available
-charset (optional)
the charset attribute of the script tag, ie. the character set of the script if it differs from the main document
-crossorigin (optional)
Enumerated attribute to indicate whether CORS (Cross-Origin Resource Sharing) should be used
-defer (boolean) (optional)
whether execution of the script should be defered until after the page has been loaded
-integrity (optional)
provide hash values for W3C Subresource Integrity recommentation
-order (defaults to "0") (optional)
specify inclusion order
-script (optional)
the inline script for the body of the script tag. This parameter will be ignored if a value has been supplied for src
-src (optional)
the src attribute of the script tag, ie. the source url of the script
-type (defaults to "text/javascript") (optional)
the type attribute of the script tag, eg. 'text/javascript'

template::head::add_style (public)

 template::head::add_style -style style [ -title title ] [ -lang lang ] \
    [ -media media ] [ -type type ]

Add an embedded css style declaration

Switches:
-style (required)
CSS content to be included in the style tag
-title (optional)
the title attribute of the link tag describing the target of this link
-lang (optional)
the lang attribute of the link tag specifying the language of its attributes if they differ from the document language
-media (optional)
the media attribute of the link tag describing which display media this link is relevant to. This may be a comma separated list of values, eg. 'screen,print,braille'
-type (defaults to "text/css") (optional)
the type attribute of the link tag, eg. 'text/css'
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2007-11-30

template::head::prepare_multirows (public)

 template::head::prepare_multirows

Generate multirows for meta, css, scripts Called only from blank-master.tcl

[ show source ]