Index: openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl 15 Apr 2008 09:14:45 -0000 1.32 +++ openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl 17 Aug 2008 01:21:56 -0000 1.33 @@ -837,8 +837,12 @@ # templating and CSS # Class create Page - Page proc requireCSS name {set ::_xo_need_css($name) 1} - Page proc requireStyle s {set ::_xo_need_style($s) 1} + Page proc requireCSS {{-order 1} name} { + set ::_xo_need_css($name) [expr {[array size ::_xo_need_css]+1000*$order}] + } + Page proc requireStyle {{-order 1} s} { + set ::_xo_need_style($s) [expr {[array size ::_xo_need_style]+1000*$order}] + } Page proc requireJS name { if {![info exists ::_xo_need_js($name)]} {lappend ::_xo_js_order $name} set ::_xo_need_js($name) 1 @@ -858,15 +862,26 @@ } return [list] } + Page proc sort_keys_by_value {{-comparison integer} {-direction increasing} pairs} { + set result [list] + set a [list] + foreach {key value} $pairs { + lappend a [list $key $value] + } + foreach pair [lsort -index 1 -$comparison -$direction $a] { + lappend result [lindex $pair 0] + } + return $result + } Page proc header_stuff {} { set result "" foreach link [array names ::_xo_need_link] { append result "\n" } - foreach style [array names ::_xo_need_style] { + foreach style [my sort_keys_by_value [array get ::_xo_need_style]] { append result "\n" } - foreach file [array names ::_xo_need_css] { + foreach file [my sort_keys_by_value [array get ::_xo_need_css]] { append result "\n" } if {[info exists ::_xo_js_order]} { Index: openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 1 Mar 2008 18:18:59 -0000 1.20 +++ openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 17 Aug 2008 01:21:56 -0000 1.21 @@ -56,12 +56,12 @@ property_doc - @header_stuff;noquote@[my extra_header_stuff] + [my extra_header_stuff]@header_stuff;noquote@ [my ajax_tag_definition] - @header_stuff;noquote@[my extra_header_stuff] + [my extra_header_stuff]@header_stuff;noquote@ [my ajax_tag_definition] }]\n } Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v diff -u -r1.156 -r1.157 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 15 Aug 2008 17:10:33 -0000 1.156 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 17 Aug 2008 01:21:56 -0000 1.157 @@ -208,7 +208,7 @@ } else { # use adp file - foreach css [$package_id get_parameter extra_css ""] {::xo::Page requireCSS $css} + foreach css [$package_id get_parameter extra_css ""] {::xo::Page requireCSS -order 10 $css} # refetch it, since it might have been changed via set-parameter set template_file [my query_parameter "template_file" \ [::$package_id get_parameter template_file view-default]]