Index: openacs-4/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/www/blank-master.tcl 14 Feb 2007 05:26:51 -0000 1.22 +++ openacs-4/www/blank-master.tcl 14 May 2007 20:30:29 -0000 1.23 @@ -1,135 +1,132 @@ -# /www/master-default.tcl -# -# Set basic attributes and provide the logical defaults for variables that -# aren't provided by the slave page. -# -# Author: Kevin Scaldeferri -# Creation Date: 14 Sept 2000 -# $Id$ -# +ad_page_contract { + This is the top level master template. It allows the basic parts of an XHTML + document to be set through convenient data structures without introducing + anything site specific. -# fall back on defaults + You MUST supply the following variables: -# The html element at the beginning of each page should use the -# "lang" attribute to help specify the main language of the text -# on the page (i.e. en, fr, de, etc.). This helps the computer or -# assistive device present information in a way that is -# appropriate to the language and also helps translation software. -set html_lang_attribute [lang::system::language -site_wide] + @property doc(title) The document title, ie. tag. + @property doc(title_lang) The language of the document title, if different + from the document language. -if { [template::util::is_nil doc_type] } { - set doc_type {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">} -} + The document output can be customised by supplying the following variables: -if { [template::util::is_nil title] } { - set title [ad_conn instance_name] -} + @property doc(type) The declared xml DOCTYPE. + @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. -#AG: Markup in <title> tags doesn't render well. -set title [ns_striphtml $title] + 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. -if { ![info exists header_stuff] } { - set header_stuff {} + @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) + + @author Kevin Scaldeferri (kevin@arsdigita.com) + Lee Denison (lee@xarg.co.uk) + @creation-date 14 Sept 2000 + + $Id$ } -if { ![info exists on_load] } { - set on_load {} +if {[template::util::is_nil doc(type)]} { + set doc(type) {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">} } +if {[template::util::is_nil doc(charset)]} { + set doc(charset) [ad_conn charset] +} -# Attributes +# The document language is always set from [ad_conn lang] which by default +# returns the language setting for the current user. This is probably +# not a bad guess, but the rest of OpenACS must override this setting when +# appropriate and set the lang attribute of tags which differ from the language +# of the page. Otherwise we are lying to the browser. +set doc(lang) [ad_conn language] -multirow create attribute key value -set onload $on_load +# AG: Markup in <title> tags doesn't render well. +set doc(title) [ns_striphtml $doc(title)] -# Handle richtext widgets, which needs special javascript and css -# in the page header -multirow create htmlarea_support id -global acs_blank_master__htmlareas acs_blank_master +if {![template::multirow exists meta]} { + template::multirow create meta name content http_equiv scheme lang +} -if {[info exists acs_blank_master__htmlareas] } { - - if {[info exists acs_blank_master(rte)]} { - foreach htmlarea_id [lsort -unique $acs_blank_master__htmlareas] { - lappend onload "acs_rteInit('${htmlarea_id}');" - }} - - 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) - # setting language - set lang [lang::conn::language] - # if there are problems with the language definitions, set lang to "en" - if {$lang ne "en" && $lang ne "de"} {set lang en} - foreach element_id $acs_blank_master__htmlareas { - multirow append htmlarea_support $element_id - } - } +if {![template::multirow exists link]} { + template::multirow create link rel type href title lang media } -if { ![template::util::is_nil focus] } { - # Handle elements where the name contains a dot - if { [regexp {^([^.]*)\.(.*)$} $focus match form_name element_name] } { - lappend onload "acs_Focus('${form_name}', '${element_name}');" - } +if {![template::multirow exists script]} { + template::multirow create script type src charset defer content } +template::multirow append script text/javascript /resources/acs-subsite/core.js "" "" "" -if {$onload ne ""} { - multirow append attribute onload [join $onload " "] +if {![template::multirow exists body_script]} { + template::multirow create body_script type src charset defer content } -# Additional Body Attributes +# Concatenate the javascript event handlers for the body tag +if {[array exists body]} { + foreach name [array names body -glob "on*"] { + append event_handlers " ${name}=\"" -if {[exists_and_not_null body_attributes]} { - foreach body_attribute $body_attributes { - multirow append attribute [lindex $body_attribute 0] [lindex $body_attribute 1] + foreach javascript $body($name) { + append event_handlers "[string trimright $javascript "; "]; " + } + + append event_handlers "\"" } -} else { - set body_attributes "" } -# Header links (stylesheets, javascript) -multirow create header_links rel type href media -multirow append header_links "stylesheet" "text/css" "/resources/acs-templating/lists.css" "all" -multirow append header_links "stylesheet" "text/css" "/resources/acs-templating/forms.css" "all" -multirow append header_links "stylesheet" "text/css" "/resources/acs-subsite/default-master.css" "all" +# DRB: Devsup and dotlrn toolbars moved here temporarily until we rewrite things so packages +# can push tool bars up to the blank master. -# Developer-support: We include that here, so that master template authors don't have to worry about it +# Determine whether developer support is installed and enabled +# +set developer_support_p [expr { + [llength [info procs ::ds_show_p]] == 1 && [ds_show_p] +}] -if { [llength [info procs ::ds_show_p]] == 1 - && [ds_show_p] - } { - set developer_support_p 1 -} else { - set developer_support_p 0 +if {$developer_support_p} { + template::multirow append link \ + stylesheet \ + "text/css" \ + "/resources/acs-developer-support/acs-developer-support.css" \ + "" \ + en \ + "all" } -# dotlrn toolbar : We include that here, so that master template authors don't have to worry about it +# 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 { [llength [namespace eval :: info procs dotlrn_toolbar::show_p]] == 1 } { - multirow append header_links "stylesheet" "text/css" "/resources/dotlrn/dotlrn-toolbar.css" "all" - set dotlrn_toolbar_p 1 -} else { - set dotlrn_toolbar_p 0 +if {$dotlrn_toolbar_p} { + template::multirow append link \ + stylesheet \ + "text/css" \ + "/resources/dotlrn/dotlrn-toolbar.css" \ + "" \ + en \ + "all" } -set translator_mode_p [lang::util::translator_mode_p] - -set openacs_version [ad_acs_version] - -# Toggle translator mode link - -set acs_lang_url [apm_package_url_from_key "acs-lang"] -if { $acs_lang_url eq "" } { - set lang_admin_p 0 -} else { - set lang_admin_p [permission::permission_p \ - -object_id [site_node::get_element -url $acs_lang_url -element object_id] \ - -privilege admin \ - -party_id [ad_conn untrusted_user_id]] -} -set toggle_translator_mode_url [export_vars -base "${acs_lang_url}admin/translator-mode-toggle" { { return_url [ad_return_url] } }] -