Index: openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl 10 Jan 2007 21:22:12 -0000 1.17 +++ openacs-4/packages/acs-templating/tcl/acs-integration-procs.tcl 15 Sep 2007 07:22:40 -0000 1.18 @@ -23,7 +23,7 @@ @param string If specified, will return the resulting page to the caller string instead sending it to the connection. } { - if {$template ne ""} { + if {![empty_string_p $template]} { template::set_file \ [template::util::url_to_file $template [ad_conn file]] } @@ -97,10 +97,11 @@ } { namespace eval template variable parse_level "" #ns_log debug "adp_parse_ad_conn_file => file '[file root [ad_conn file]]'" + template::reset_request_vars set parsed_template [template::adp_parse [file root [ad_conn file]] {}] - if {$parsed_template ne ""} { + if {![empty_string_p $parsed_template]} { # # acs-lang translator mode @@ -123,18 +124,18 @@ if { [string first "... while { [regexp -indices {\x002\(\x001([^\x001]*)\x001\)\x002} $parsed_template indices key] } { - set before [string range $parsed_template 0 [expr {[lindex $indices 0] - 1}]] - set after [string range $parsed_template [expr {[lindex $indices 1] + 1}] end] + set before [string range $parsed_template 0 [expr [lindex $indices 0] - 1]] + set after [string range $parsed_template [expr [lindex $indices 1] + 1] end] set key [string range $parsed_template [lindex $key 0] [lindex $key 1]] 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/tcl/head-procs.tcl 15 Sep 2007 07:22:40 -0000 1.1 @@ -0,0 +1,398 @@ +ad_library { + + 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. + + @author Lee Denison (lee@xarg.co.uk) + @creation-date 2007-05-18 + +} + +namespace eval template {} +namespace eval template::head {} + +ad_proc -private template::reset_request_vars {} { + Resets all global datastructures used to manage the head section of the + returned document. This should be called at the beginning of any request + handled by the templating system. +} { + variable ::template::head::scripts + array unset scripts + array set scripts [list] + + variable ::template::head::links + array unset links + array set links [list] + + variable ::template::head::metas + array unset metas + array set metas [list] + + variable ::template::body_handlers + array unset body_handlers + array set body_handlers [list] + + variable ::template::body_scripts + array unset body_scripts + set body_scripts [list] + + variable ::template::headers + set headers [list] + variable ::template::footers + set footers [list] +} + +ad_proc -public template::head::add_script { + {-type:required} + {-defer:boolean} + {-src ""} + {-charset ""} + {-script ""} + {-order "0"} +} { + 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. + + @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 +} { + variable ::template::head::scripts + + if {$defer_p} { + set defer defer + } else { + set defer "" + } + + if {$src eq ""} { + if {$script eq ""} { + error "You must supply either -src or -script." + } + + lappend scripts(anonymous) $type "" $charset $defer $script $order + } else { + set scripts($src) [list $type $src $charset $defer "" $order] + } +} + +ad_proc -public template::head::add_link { + {-rel:required} + {-href:required} + {-type ""} + {-media ""} + {-title ""} + {-lang ""} +} { + 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. + + @param rel the rel attribute of the link tag defining the relationship + of the linked document to the current one, eg. 'stylesheet' + @param href the href attribute of the link tag, eg. the target document + of the link + @param type the type attribute of the link tag, eg. 'text/css' + @param media 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' + @param title the title attribute of the link tag describing the target of + this link + @param lang the lang attribute of the link tag specifying the language + of its attributes if they differ from the document language +} { + variable ::template::head::links + + set links($rel,$href) [list $rel $href $type $media $title $lang] +} + +ad_proc -public template::head::add_meta { + {-http_equiv ""} + {-name ""} + {-scheme ""} + {-content ""} + {-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. + + @param http_equiv the http-equiv attribute of the meta tag, ie. the + HTTP header which this metadata is equivalent to + eg. 'content-type' + @param name the name attribute of the meta tag, ie. the metadata + identifier + @param scheme 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/) + @param content the content attribute of the meta tag, ie the metadata + value + @param lang the lang attribute of the meta tag specifying the language + of its attributes if they differ from the document language +} { + variable ::template::head::metas + + if {$http_equiv eq "" && $name eq ""} { + error "You must supply either -http_equiv or -name." + } + + set scripts($http_equiv,$name) [list \ + $http_equiv \ + $name \ + $scheme \ + $content \ + $lang \ + ] +} + +ad_proc -public template::head::add_javascript { + {-defer:boolean} + {-src ""} + {-charset ""} + {-script ""} + {-order "0"} +} { + 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. + + @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 + + @see template::head::add_script +} { + template::head::add_script -defer=$defer_p \ + -type text/javascript \ + -src $src \ + -charset $charset \ + -script $script \ + -order $order +} + +ad_proc -public template::head::add_css { + {-alternate:boolean} + {-href:required} + {-media ""} + {-title ""} + {-lang ""} +} { + 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. + + @param href the href attribute of the link tag, eg. the target + stylesheet + @param alternate sets the rel attribute of the link tag defining to + 'alternate stylesheet' if set, sets it to 'stylesheet' + otherwise + @param media 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' + @param title the title attribute of the link tag describing the target + of this link + @param lang the lang attribute of the link tag specifying the language + of its attributes if they differ from the document language + + @see template::head::add_link +} { + if {$alternate_p} { + set rel "alternate stylesheet" + } else { + set rel "stylesheet" + } + + template::head::add_link -rel $rel \ + -type text/css \ + -href $href \ + -media $media \ + -title $title \ + -lang $lang +} + +ad_proc -public template::add_body_handler { + {-event:required} + {-script:required} + {-identifier anonymous} +} { + 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 +} { + variable ::template::body_handlers + + if {$identifier eq "anonymous"} { + lappend body_handlers($event,anonymous) $script + } else { + set body_handers($event,$identifier) $script + } +} + +ad_proc -public template::add_body_script { + {-type:required} + {-defer:boolean} + {-src ""} + {-charset ""} + {-script ""} +} { + 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. + + @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 +} { + variable ::template::body_scripts + + if {$defer_p} { + set defer defer + } else { + set defer "" + } + + if {$src eq "" && $script eq ""} { + error "You must supply either -src or -script." + } + + lappend body_scripts $type $src $charset $defer $script +} + +ad_proc -public template::add_header { + {-direction "outer"} + {-src ""} + {-params ""} + {-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. + + @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 +} { + variable ::template::headers + + if {$src eq ""} { + if {$html eq ""} { + error "You must supply either -src or -html." + } + + set values [list literal $html ""] + } else { + set values [list include $src $params] + } + + if {$direction eq "outer"} { + set headers [concat [list $values] $headers] + } else { + lappend headers $values + } +} + +ad_proc -public template::add_footer { + {-direction "outer"} + {-src ""} + {-params ""} + {-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. + + @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_footer +} { + variable ::template::footers + + if {$src eq ""} { + if {$html eq ""} { + error "You must supply either -src or -html." + } + + set values [list literal $html ""] + } else { + set values [list include $src $params] + } + + if {$direction eq "outer"} { + lappend footers $values + } else { + set footers [concat [list $values] $headers] + } +} Index: openacs-4/www/blank-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.adp,v diff -u -N -r1.23 -r1.24 --- openacs-4/www/blank-master.adp 14 May 2007 20:30:29 -0000 1.23 +++ openacs-4/www/blank-master.adp 15 Sep 2007 07:22:40 -0000 1.24 @@ -3,30 +3,25 @@ lang="@doc.title_lang;noquote@">@doc.title;noquote@ - http-equiv="@meta.http_equiv;noquote" name="@meta.name;noquote@" scheme="@meta.scheme;noquote@" lang="@meta.lang;noquote@" content="@meta.content@"> + http-equiv="@meta.http_equiv;noquote@" name="@meta.name;noquote@" scheme="@meta.scheme;noquote@" lang="@meta.lang;noquote@" content="@meta.content@"> lang="@link.lang;noquote@" title="@link.title;noquote@" type="@link.type;noquote@" media="@link.media@"> - + + @head;noquote@ class="@body.class;noquote@" id="@body.id;noquote@"@event_handlers;noquote@> + + @header;noquote@ + + + + @footer;noquote@ + - - - - - - - - - - - - Index: openacs-4/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v diff -u -N -r1.23 -r1.24 --- openacs-4/www/blank-master.tcl 14 May 2007 20:30:29 -0000 1.23 +++ openacs-4/www/blank-master.tcl 15 Sep 2007 07:22:40 -0000 1.24 @@ -4,7 +4,15 @@ anything site specific. You MUST supply the following variables: + You should NEVER need to modify this file. + + Most of the time your pages or master templates should not directly set this + file in their tag. They should instead use site-master with + provides a set of standard OpenACS content. Only pages which need to return + raw HTML should use this template directly. + When using this template directly you MUST supply the following variables: + @property doc(title) The document title, ie. tag. @property doc(title_lang) The language of the document title, if different from the document language. @@ -15,31 +23,36 @@ @property doc(charset) The document character set. @property body(id) The id attribute of the body tag. @property body(class) The class of the body tag. - @property meta:multirow A multirow of <meta> tags to render. - @property link:multirow A multirow of <link> tags to render. - @property script:multirow A multirow of <script> tags to render in the head. - @property body_script:multirow A multirow of <script> tags to render in the body. ad_conn -set language Must be used to override the document language if necessary. - The following event handlers can be customised by supplying the appropriate - variable. Each variable is a list of valid javascript code fragments to be - executed in order. + To add a CSS or Javascripts to the <head> section of the document you can + call the corresponding template::head::add_* functions within your page. - @property body(onload) - @property body(onunload) - @property body(onclick) - @property body(ondblclick) - @property body(onmousedown) - @property body(onmouseup) - @property body(onmouseover) - @property body(onmousemove) - @property body(onmouseout) - @property body(onkeypress) - @property body(onkeydown) - @property body(onkeyup) + @see template::head::add_css + @see template::head::add_javascript + More generally, meta, link and script tags can be added to the <head> section + of the document by calling their template::head::add_* function within your + page. + + @see template::head::add_meta + @see template::head::add_link + @see template::head::add_script + + Javascript event handlers, such as onload, an be added to the <body> tag by + calling template::add_body_handler within your page. + + @see template::add_body_handler + + Finally, for more advanced functionality see the documentation for + template::add_body_script, template::add_header and template::add_footer. + + @see template::add_body_script + @see template::add_header + @see template::add_footer + @author Kevin Scaldeferri (kevin@arsdigita.com) Lee Denison (lee@xarg.co.uk) @creation-date 14 Sept 2000 @@ -65,68 +78,117 @@ # AG: Markup in <title> tags doesn't render well. set doc(title) [ns_striphtml $doc(title)] -if {![template::multirow exists meta]} { - template::multirow create meta name content http_equiv scheme lang +# Generate the <meta /> tag multirow +variable ::template::head::metas +template::multirow create meta name content http_equiv scheme lang +template::multirow append meta \ + "" \ + "text/html; charset=$doc(charset)" \ + "content-type" + +if {[array exists metas]} { + foreach name [array names metas] { + foreach {http_equiv name scheme content lang} $metas($name) { + template::multirow append meta \ + $name \ + $content \ + $http_equiv \ + $scheme \ + $lang + } + } } -if {![template::multirow exists link]} { - template::multirow create link rel type href title lang media +# Generate the <link /> tag multirow +variable ::template::head::links +template::multirow create link rel type href title lang media +if {[array exists links]} { + foreach name [array names links] { + foreach {rel href type media title lang} $links($name) { + template::multirow append link \ + $rel \ + $type \ + $href \ + $title \ + $lang \ + $media + } + } } -if {![template::multirow exists script]} { - template::multirow create script type src charset defer content +# Generate the head <script /> tag multirow +variable ::template::head::scripts +template::multirow create script type src charset defer content +if {[array exists scripts]} { + foreach name [array names scripts] { + foreach {type src charset script defer} $scripts($name) { + template::multirow append script \ + $type \ + $src \ + $charset \ + $defer \ + $content + } + } } -template::multirow append script text/javascript /resources/acs-subsite/core.js "" "" "" -if {![template::multirow exists body_script]} { - template::multirow create body_script type src charset defer content +# Generate the body <script /> tag multirow +variable ::template::body_scripts +template::multirow create body_script type src charset defer content +if {[info exists body_scripts]} { + foreach {type src charset script defer} $body_scripts { + template::multirow append body_script \ + $type \ + $src \ + $charset \ + $defer \ + $content + } } # Concatenate the javascript event handlers for the body tag -if {[array exists body]} { - foreach name [array names body -glob "on*"] { - append event_handlers " ${name}=\"" +variable ::template::body_handlers +if {[array exists body_handlers]} { + set names [array names body_handlers] - foreach javascript $body($name) { - append event_handlers "[string trimright $javascript "; "]; " + foreach name $names { + set event [lindex [split $name ","] 0] + + foreach javascript $body_handlers($name) { + lappend body_handlers($event) "[string trimright $javascript "; "];" } - append event_handlers "\"" - } + unset body_handlers($name) + } } -# DRB: Devsup and dotlrn toolbars moved here temporarily until we rewrite things so packages -# can push tool bars up to the blank master. - -# Determine whether developer support is installed and enabled -# -set developer_support_p [expr { - [llength [info procs ::ds_show_p]] == 1 && [ds_show_p] -}] - -if {$developer_support_p} { - template::multirow append link \ - stylesheet \ - "text/css" \ - "/resources/acs-developer-support/acs-developer-support.css" \ - "" \ - en \ - "all" +# Now create the event handlers string +foreach {event script} [array get body_handlers] { + append event_handlers " ${event}=\"$script\"" } - -# Determine whether or not to show the dotlrn toolbar. -# -set dotlrn_toolbar_p [expr { - [llength [namespace eval :: info procs dotlrn_toolbar::show_p]] == 1 -}] - -if {$dotlrn_toolbar_p} { - template::multirow append link \ - stylesheet \ - "text/css" \ - "/resources/dotlrn/dotlrn-toolbar.css" \ - "" \ - en \ - "all" + +# Generate the body headers +variable ::template::headers +set header [list] +if {[info exists headers]} { + foreach {type src params} $headers { + if {$type eq "literal"} { + lappend header $src + } else { + lappend header [template::adp_include $src $params] + } + } } +# Generate the body footers +variable ::template::footers +set footer [list] +if {[info exists footers]} { + foreach {type src params} $footers { + if {$type eq "literal"} { + lappend footer $src + } else { + lappend footer [template::adp_include $src $params] + } + } +} \ No newline at end of file Index: openacs-4/www/default-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/default-master.tcl,v diff -u -N -r1.20 -r1.21 --- openacs-4/www/default-master.tcl 14 May 2007 20:30:29 -0000 1.20 +++ openacs-4/www/default-master.tcl 15 Sep 2007 07:22:40 -0000 1.21 @@ -30,7 +30,7 @@ # Create standard top level navigation # if {![info exists navigation_groups]} { - set navigation_groups [list main sub] + set navigation_groups [list] } if {![template::multirow exists navigation]} { @@ -47,6 +47,14 @@ tabindex } +for {set i 1} {$i <= [template::multirow size navigation]} {incr i} { + template::multirow get navigation $i + + if {[lsearch $navigation_groups $navigation(group)] < 0} { + lappend navigation_groups $navigation(group) + } +} + # # Add standard css # Index: openacs-4/www/site-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/site-master.adp,v diff -u -N -r1.28 -r1.29 --- openacs-4/www/site-master.adp 17 Jun 2007 09:20:13 -0000 1.28 +++ openacs-4/www/site-master.adp 15 Sep 2007 07:22:40 -0000 1.29 @@ -1,57 +1,6 @@ <master src="/www/blank-master"> -<if @meta:rowcount@ not nil><property name="&meta">meta</property></if> -<if @link:rowcount@ not nil><property name="&link">link</property></if> -<if @script:rowcount@ not nil><property name="&script">script</property></if> <if @doc@ defined><property name="&doc">doc</property></if> <if @body@ defined><property name="&body">body</property></if> <if @head@ not nil><property name="head">@head;noquote@</property></if> -<if @acs_blank_master.rte@ not nil and @acs_blank_master__htmlareas@ not nil> -<script language="JavaScript" type="text/javascript"> -<!-- - initRTE("/resources/acs-templating/rte/images/", - "/resources/acs-templating/rte/", - "/resources/acs-templating/rte/rte.css"); -// --> -</script> -</if> - -<if @acs_blank_master.xinha@ not nil and @acs_blank_master__htmlareas@ not nil> -<script type="text/javascript"> -<!-- - xinha_editors = null; - xinha_init = null; - xinha_config = null; - xinha_plugins = null; - xinha_init = xinha_init ? xinha_init : function() { - xinha_plugins = xinha_plugins ? xinha_plugins : [@xinha_plugins;noquote@]; - // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :) - if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; - xinha_editors = xinha_editors ? xinha_editors : - [ - @htmlarea_ids@ - ]; - xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config(); - @xinha_params;noquote@ - @xinha_options;noquote@ - xinha_editors = - HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); - HTMLArea.startEditors(xinha_editors); - } - window.onload = xinha_init; -// --> -</script> -</if> - -<if @skip_link@ not nil><div id="skiptocontent"><a href="@skip_link;noquote@" title="#acs-subsite.skip_to_content#" accesskey="#acs-subsite.skiptocontent_accesskey#">#acs-subsite.skip_to_content#</a></div></if> -<if @acs_blank_master__htmlareas@ not nil><textarea id="holdtext" style="display: none;" rows="1" cols="1"></textarea></if> - -<comment> - TODO: remove this and add a more systematic / package independent way - TODO of getting this content here -</comment> -<slave> - -<if @translator_mode_p@ true> - <include src="/packages/acs-lang/lib/messages-to-translate"> -</if> +<slave> \ No newline at end of file Index: openacs-4/www/site-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/site-master.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/www/site-master.tcl 17 Jun 2007 09:20:13 -0000 1.25 +++ openacs-4/www/site-master.tcl 15 Sep 2007 07:22:40 -0000 1.26 @@ -1,6 +1,17 @@ ad_page_contract { This is the highest level site specific master template. + site-master adds site wide OpenACS functionality to every page. + You should NOT need to modify this file unless you are adding functionality + for a site wide service. + + If you want to customise the look and feel of your site you probably want to + modify /www/default-master. + + Note: currently site wide service content is hard coded in this file. At + some point we will want to determine this content dynamically which will + change the content of this file significantly. + @author Lee Denison (lee@xarg.co.uk) $Id$ @@ -15,127 +26,82 @@ set doc(title_lang) [lindex [split [lang::system::site_wide_locale] _] 0] } -if {![info exists body(onload)]} { - set body(onload) [list] -} -if {![template::multirow exists meta]} { - template::multirow create meta name content http_equiv scheme lang -} - -if {![template::multirow exists link]} { - template::multirow create link rel type href title lang media -} - -if {![template::multirow exists script]} { - template::multirow create script type src charset defer content -} - # # Add standard meta tags # -template::multirow append meta \ - generator \ - "OpenACS version [ad_acs_version]" \ - {} \ - {} \ - en +template::head::add_meta \ + -name generator \ + -lang en \ + -content "OpenACS version [ad_acs_version]" # # Add standard css # -template::multirow append link \ - stylesheet \ - "text/css" \ - "/resources/acs-templating/lists.css" \ - "" \ - en \ - "all" +template::head::add_css \ + -href "/resources/acs-subsite/site-master.css" \ + -media "all" -template::multirow append link \ - stylesheet \ - "text/css" \ - "/resources/acs-templating/forms.css" \ - "" \ - en \ - "all" +template::head::add_css \ + -href "/resources/acs-templating/lists.css" \ + -media "all" -template::multirow append link \ - stylesheet \ - "text/css" \ - "/resources/acs-subsite/site-master.css" \ - "Standard OpenACS Styles" \ - en \ - "all" +template::head::add_css \ + -href "/resources/acs-templating/forms.css" \ + -media "all" +# Add standard javascript # -# Process focus variable in onload -# -if { ![template::util::is_nil focus] } { - # Handle elements where the name contains a dot - if { [regexp {^([^.]*)\.(.*)$} $focus match form_name element_name] } { - lappend body(onload) "acs_Focus('${form_name}', '${element_name}');" - } -} +template::head::add_javascript -src "/resources/acs-subsite/core.js" # # Fire subsite callbacks to get header content -# -# TODO: LJD - these callbacks should append to the relevant multirows to ensure -# TODO accessibility standards compliant output +# FIXME: it's not clear why these callbacks are scoped to subsite or if +# FIXME callbacks are the right way to add content of this type. Either way +# FIXME using the @head@ property or indeed having a callback for every +# FIXME possible javascript event handler is probably not the right way to go. # append head [join [callback subsite::get_extra_headers] "\n"] -set body(onload) [concat $body(onload) [callback subsite::header_onload]] +set onload_handlers [callback subsite::header_onload] +foreach onload_handler $onload_handlers { + template::add_body_handler -event onload -script $onload_handler +} -# -# Add WYSIWYG editor content +# Determine if we should be displaying the translation UI # -global acs_blank_master__htmlareas acs_blank_master +if {[lang::util::translator_mode_p]} { + template::add_footer -src "/packages/acs-lang/lib/messages-to-translate" +} -if {[info exists acs_blank_master__htmlareas] - && [llength $acs_blank_master__htmlareas] > 0} { - - # - # Add RTE scripts if we are using RTE - # - if {[info exists acs_blank_master(rte)]} { - foreach htmlarea_id [lsort -unique $acs_blank_master__htmlareas] { - lappend body(onload) "acs_rteInit('${htmlarea_id}')" - } +# +# Determine if we should be displaying the dotLRN toolbar +# +set dotlrn_toolbar_p [expr { + [llength [namespace eval :: info procs dotlrn_toolbar::show_p]] == 1 +}] - template::multirow append script \ - "text/javascript" \ - "/resources/acs-templating/rte/richtext.js" - } +if {$dotlrn_toolbar_p} { + template::head::add_css \ + -href "/resources/dotlrn/dotlrn-toolbar.css" \ + -media "all" - # - # Add Xinha scripts if we are using Xinha - # - if {[info exists acs_blank_master(xinha)]} { - set xinha_dir /resources/acs-templating/xinha-nightly/ - set xinha_plugins $acs_blank_master(xinha.plugins) - set xinha_params "" - set xinha_options $acs_blank_master(xinha.options) - set xinha_lang [lang::conn::language] - - if {$xinha_lang ne "en" && $xinha_lang ne "de"} { - set xinha_lang en - } - - template::multirow append script "text/javascript" {} {} {} " - _editor_url = \"$xinha_dir\"; - _editor_lang = \"$xinha_lang\";" - - template::multirow append script \ - "text/javascript" \ - "${xinha_dir}htmlarea.js" - - set htmlarea_ids '[join $acs_blank_master__htmlareas "','"]' - } + template::add_header -src "/packages/dotlrn/lib/toolbar" } - + +# DRB: Devsup and dotlrn toolbars moved here temporarily until we rewrite +# things so packages can push tool bars up to the blank master. # -# Determine if we should be displaying the translation UI +# Determine if developer support is installed and enabled # -set translator_mode_p [lang::util::translator_mode_p] +set developer_support_p [expr { + [llength [info procs ::ds_show_p]] == 1 && [ds_show_p] +}] +if {$developer_support_p} { + template::head::add_css \ + -href "/resources/acs-developer-support/acs-developer-support.css" \ + -media "all" + + template::add_header -src "/packages/acs-developer-support/lib/toolbar" + template::add_footer -src "/packages/acs-developer-support/lib/footer" +}