Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v diff -u -r1.239.2.83 -r1.239.2.84 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 3 Feb 2022 18:26:22 -0000 1.239.2.83 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 8 Feb 2022 14:50:08 -0000 1.239.2.84 @@ -2269,6 +2269,7 @@ {-allow_reorder ""} {-include_in_foldertree "true"} {-CSSclass_top_ul ""} + {-CSSclass_ul ""} }} id } -ad_doc { @@ -2294,6 +2295,7 @@ @param allow_reorder @param include_in_foldertree @param CSSclass_top_ul CSS class for top-level UL element + @param CSSclass_ul CSS class for all UL elements } #"select page_id, page_order, name, title, \ @@ -2676,6 +2678,7 @@ -remove_levels $remove_levels \ -book_mode $book_mode -open_page $open_page -expand_all $expand_all \ -owner [self] \ + -properties ${:render_properties} \ $pages if {$allow_reorder ne ""} { @@ -2713,6 +2716,7 @@ :get_parameters array set :navigation {count 0 position 0 current ""} set list_mode 0 + dict set :render_properties CSSclass_ul $CSSclass_ul dict set :render_properties CSSclass_top_ul $CSSclass_top_ul # @@ -2722,18 +2726,18 @@ # if {$renderer eq ""} { switch -- $style { - "menu" {set style "menu"; set renderer yuitree} - "folders" {set style "folders"; set renderer yuitree} + "menu" {set renderer yuitree} + "folders" {set renderer yuitree} + "yuitree" {set renderer "yuitree"} "list" {set style ""; set list_mode 1; set renderer list} "none" {set style ""; set renderer none} - "yuitree" {set renderer "yuitree"} "default" {set style ""; set list_mode 1; set renderer list # - # Fall back to "xowiki-tree" for "CSSclass_top_ul" only when - # value was not specified. + # Fall back to "xowiki-tree" for "CSSclass_ul" only when + # value was not specified as a parameter. # - if {$CSSclass_top_ul eq ""} { - dict set :render_properties CSSclass_top_ul xowiki-tree + if {$CSSclass_ul eq ""} { + dict set :render_properties CSSclass_ul xowiki-tree } } } Index: openacs-4/packages/xowiki/tcl/tree-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/tree-procs.tcl,v diff -u -r1.23.2.11 -r1.23.2.12 --- openacs-4/packages/xowiki/tcl/tree-procs.tcl 3 Feb 2022 18:26:22 -0000 1.23.2.11 +++ openacs-4/packages/xowiki/tcl/tree-procs.tcl 8 Feb 2022 14:50:08 -0000 1.23.2.12 @@ -97,26 +97,39 @@ {-book_mode false} {-open_page ""} {-expand_all false} + {-properties ""} -owner pages } { set tree(-1) [self] set :open_node($tree(-1)) 1 set pos 0 - if {${:verbose}} {:log "add_pages want to add [llength [$pages children]] pages"} + if {${:verbose}} { + :log "add_pages want to add [llength [$pages children]] pages" + } + if {[dict exists $properties CSSclass_ul]} { + set extra_flags "-ul_class [dict get $properties CSSclass_ul]" + } else { + set extra_flags "" + } foreach o [$pages children] { $o instvar page_order title name - if {![regexp {^(.*)[.]([^.]+)} $page_order _ parent]} {set parent ""} + if {![regexp {^(.*)[.]([^.]+)} $page_order _ parent]} { + set parent "" + } set page_number [$owner page_number $page_order $remove_levels] set level [regsub -all -- {[.]} [$o set page_order] _ page_order_js] - if {${:verbose}} {:log "... work on [$o set page_order] level $level full $full"} + if {${:verbose}} { + :log "... work on [$o set page_order] level $level full $full" + } if {$full || [info exists :open_node($parent)] || [info exists :open_node($page_order)]} { set href [$owner href $book_mode $name] set is_current [expr {$open_page eq $name}] set is_open [expr {$is_current || $expand_all}] set c [::xowiki::TreeNode new -orderby pos -pos [incr pos] -level $level \ -object $o -owner [self] \ + {*}$extra_flags \ -label $title -prefix $page_number -href $href \ -highlight $is_current \ -expanded $is_open \ @@ -125,7 +138,9 @@ set tree($level) $c for {set l [expr {$level - 1}]} {![info exists tree($l)]} {incr l -1} {} $tree($l) add $c - if {$is_open} {$c open_tree} + if {$is_open} { + $c open_tree + } } } return $tree(-1) @@ -215,6 +230,13 @@ foreach c [$tree children] {append content [$c render] \n} return $content } + TreeRenderer instproc get_property {properties property {default ""}} { + set value $default + if {[dict exists $properties $property]} { + set value [dict get $properties $property] + } + return $value + } # # The renderers should provide the following methods as procs @@ -245,11 +267,10 @@ # specialized renders could provide their head entries. } TreeRenderer=list proc render {{-properties ""} tree} { - set ul_class [expr {[dict exists $properties CSSclass_top_ul] - && [dict get $properties CSSclass_top_ul] ne "" - ? "class='[dict get $properties CSSclass_top_ul]' " - : ""}] - return "