Index: openacs-4/www/blank-master.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v
diff -u -N -r1.20.2.1 -r1.20.2.2
--- openacs-4/www/blank-master.tcl 19 Feb 2007 23:44:32 -0000 1.20.2.1
+++ openacs-4/www/blank-master.tcl 2 Mar 2007 16:12:35 -0000 1.20.2.2
@@ -1,134 +1,95 @@
-# /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 (kevin@arsdigita.com)
-# 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:
-if { [template::util::is_nil doc_type] } {
- set doc_type {}
-}
+ @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 title] } {
- set title [ad_conn instance_name]
-}
+ The document output can be customised by supplying the following variables:
-#AG: Markup in tags doesn't render well.
-set title [ns_striphtml $title]
+ @property doc(type) The declared xml DOCTYPE.
+ @property doc(xmlns) The declared xml namespace.
+ @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 tags to render.
+ @property link:multirow A multirow of tags to render.
+ @property script:multirow A multirow of tags to render.
+ ad_conn -set language Must be used to override the document language
+ if necessary.
-if { ![info exists header_stuff] } {
- set header_stuff {}
-}
+ 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 on_load] } {
- set on_load {}
-}
+ @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
-# Attributes
-
-multirow create head_attribute key value
-multirow append head_attribute lang [ad_conn language]
-multirow append head_attribute xml:lang [ad_conn language]
-multirow append head_attribute xmlns http://www.w3.org/1999/xhtml
-
-multirow create attribute key value
-set onload $on_load
-
-# 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 {[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
- }
- }
+ $Id$
}
-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::util::is_nil doc(type)]} {
+ set doc(type) {}
}
-if {![empty_string_p $onload]} {
- multirow append attribute onload [join $onload " "]
+if {[template::util::is_nil doc(xmlns)]} {
+ set doc(xmlns) {http://www.w3.org/1999/xhtml}
}
-# Additional Body Attributes
-
-if {[exists_and_not_null body_attributes]} {
- foreach body_attribute $body_attributes {
- multirow append attribute [lindex $body_attribute 0] [lindex $body_attribute 1]
- }
-} else {
- set body_attributes ""
+if {[template::util::is_nil doc(charset)]} {
+ set doc(charset) [ad_conn charset]
}
-# 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"
+# 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]
-# Developer-support: We include that here, so that master template authors don't have to worry about it
+# AG: Markup in tags doesn't render well.
+set doc(title) [ns_striphtml $doc(title)]
-if { [llength [info procs ::ds_show_p]] == 1
- && [ds_show_p]
- } {
- set developer_support_p 1
-} else {
- set developer_support_p 0
+if {![template::multirow exists meta]} {
+ template::multirow create meta name content http_equiv scheme lang
}
-# dotlrn toolbar : We include that here, so that master template authors don't have to worry about it
+if {![template::multirow exists link]} {
+ template::multirow create link rel type href title lang media
+}
-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 {![template::multirow exists script]} {
+ template::multirow create script type src charset defer content
}
-set translator_mode_p [lang::util::translator_mode_p]
+# Concatenate the javascript event handlers for the body tag
+if {[array exists body]} {
+ foreach name [array names body -glob "on*"] {
+ append event_handlers " ${name}=\""
-set openacs_version [ad_acs_version]
+ foreach javascript $body($name) {
+ append event_handlers "[string trimright $javascript "; "]; "
+ }
-# Toggle translator mode link
-
-set acs_lang_url [apm_package_url_from_key "acs-lang"]
-if { [empty_string_p $acs_lang_url] } {
- 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]]
+ append event_handlers "\""
+ }
}
-set toggle_translator_mode_url [export_vars -base "${acs_lang_url}admin/translator-mode-toggle" { { return_url [ad_return_url] } }]
-