Index: openacs-4/www/site-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/site-master.tcl,v diff -u -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" +}