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 -r1.40 -r1.41 --- openacs-4/packages/acs-templating/tcl/head-procs.tcl 25 Jul 2018 20:58:32 -0000 1.40 +++ openacs-4/packages/acs-templating/tcl/head-procs.tcl 2 Aug 2018 06:52:50 -0000 1.41 @@ -43,10 +43,25 @@ processing the url can be neglected. } { - set ::template::head::urn($urn) $resource - ns_log notice "add URN: $urn <$resource>" + set key ::template::head::urn($urn) + if {[info exists $key]} { + set old_resource [set $key] + # + # Prefer local URNs over non-local ones + # + if {[string match //* $old_resource] || [string match http* $old_resource]} { + ns_log notice "overwrite URN: $urn <$old_resource> with <$resource>" + set $key $resource + } else { + ns_log notice "keep old URN: $urn <$old_resource> instead of <$resource>" + } + } else { + set $key $resource + ns_log notice "add URN: $urn <$resource>" + } } + ad_proc -public template::add_script { {-async:boolean} {-charset ""} @@ -76,6 +91,7 @@ script @param type the type attribute of the script tag, e.g. 'text/javascript' } { + if {$section eq "head"} { # # A head script @@ -146,6 +162,8 @@ set key ::template::head::urn($src) if {[info exists $key]} { set src [set $key] + } elseif {[string match urn:* $src]} { + ns_log error "URN <$src> could not be resolved" } if {$src eq ""} { @@ -173,7 +191,7 @@ ad_proc -public template::head::flush_script { {-src:required} } { - + Flush a script tag, which was previously set in the head section via template::add_script. One can delete multiple entries by providing a glob pattern.