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.159 -r1.160
--- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 20 Jul 2010 14:03:44 -0000 1.159
+++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 15 Aug 2010 11:13:49 -0000 1.160
@@ -1956,65 +1956,6 @@
#my log OPEN=[lsort [my array names open_node]]
}
-# toc instproc render_list {{-full false} pages} {
-# my get_parameters
-# my instvar navigation page_name
-# #
-# # Build a reduced toc tree based on pure HTML (no javascript or
-# # ajax involved). If an open_page is specified, produce an as
-# # small as possible tree and omit all non-visible nodes.
-# #
-# if {$open_page ne ""} {
-# # TODO: can we allow open_page and reorder?
-# set allow_reorder ""
-# } else {
-# set allow_reorder [my page_reorder_check_allow $allow_reorder]
-# }
-
-# my page_reorder_init_vars -allow_reorder $allow_reorder js last_level ID min_level
-
-# set css_class [expr {$min_level == 1 ? "page_order_region" : "page_order_region_no_target"}]
-# #my log allow_reorder=$allow_reorder,min_level=$min_level,css=$css_class
-# set html "
\n"
-# set prefix_js ""
-# set html [my page_reorder_open_ul -min_level $min_level -ID $ID -prefix_js $prefix_js -1]
-# set level 0
-# foreach o [$pages children] {
-# $o instvar page_order title name
-# if {![regexp {^(.*)[.]([^.]+)} $page_order _ parent]} {set parent ""}
-# set page_number [my page_number $page_order $remove_levels]
-
-# set new_level [regsub -all {[.]} [$o set page_order] _ page_order_js]
-# #my msg "[$o set page_order] [my exists open_node($parent)] || [my exists open_node($page_order)]"
-# if {[my exists open_node($parent)] || [my exists open_node($page_order)]} {
-# if {$new_level > $level} {
-# for {set l $level} {$l < $new_level} {incr l} {
-# regexp {^(.*)_[^_]+$} $page_order_js _ prefix_js
-# append html [my page_reorder_open_ul -min_level $min_level -ID $ID -prefix_js $prefix_js $l]
-# }
-# set level $new_level
-# } elseif {$new_level < $level} {
-# for {set l $new_level} {$l < $level} {incr l} {append html "
\n"}
-# set level $new_level
-# }
-# set href [my href $package_id $book_mode $name]
-# set highlight [if {$open_page eq $name} {set _ "style = 'font-weight:bold;'"} {}]
-# set item_id [my page_reorder_item_id -ID $ID -prefix_js $prefix_js -page_order $page_order js]
-# append html \
-# "" \
-# "$page_number $title\n"
-# }
-# }
-# # close all levels
-# for {set l 0} {$l <= $level} {incr l} {append html "\n"}
-# if {$js ne ""} {append html "\n"}
-
-# return $html
-# }
-
-
-
-
#
# ajax based code for fade-in / fade-out
#
@@ -2216,10 +2157,14 @@
-owner [self] \
$pages
- my page_reorder_init_vars -allow_reorder $allow_reorder js last_level ID min_level
- set js "\nYAHOO.xo_page_order_region.DDApp.package_url = '[$package_id package_url]';"
- set HTML [$tree render -style listdnd -js $js -context [list min_level $min_level]]
-
+ if {$allow_reorder ne ""} {
+ my page_reorder_init_vars -allow_reorder $allow_reorder js last_level ID min_level
+ set js "\nYAHOO.xo_page_order_region.DDApp.package_url = '[$package_id package_url]';"
+ set HTML [$tree render -style listdnd -js $js -context [list min_level $min_level]]
+ } else {
+ set HTML [$tree render -style list]
+ }
+
return $HTML
}
@@ -2232,8 +2177,12 @@
toc instproc include_head_entries {} {
my instvar style renderer
switch -- $renderer {
- list {::xowiki::Tree include_head_entries -renderer listdnd -style $style}
yuitree {::xowiki::Tree include_head_entries -renderer yuitree -style $style}
+ list {
+ my get_parameters
+ set tree_renderer [expr {$allow_reorder eq "" ? "list" : "listdnd"}]
+ ::xowiki::Tree include_head_entries -renderer $tree_renderer -style $style
+ }
none {}
}
}
@@ -2275,6 +2224,11 @@
if {[info command ::__xowiki__MenuBar] ne ""} {
::__xowiki__MenuBar additional_sub_menu -kind folder -pages $pages -owner [self]
}
+ #
+ # TODO: We should call here the appropriate tree-renderer instead
+ # of the toc-specific renderers, but first we have to check, if
+ # these are fully feature-compatible.
+ #
if {[my set renderer] eq "none"} {
} elseif {[my set list_mode]} {
return [my render_list $pages]