Index: openacs-4/packages/xowiki/www/view-book.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-book.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/view-book.tcl 30 Mar 2007 07:00:37 -0000 1.4 +++ openacs-4/packages/xowiki/www/view-book.tcl 30 Mar 2007 10:01:57 -0000 1.5 @@ -1,17 +1,22 @@ set title [[$package_id folder_id] title] -#ns_log notice "--including_page= $__including_page, portlet=$portlet" set toc [$page include_portlet [list toc -open_page $name -decoration plain -remove_levels 1]] set i [$page set __last_includelet] -my log "--last includelet = $i, class=[$i info class] [$page exists __is_book_page]" +#my log "--last includelet = $i, class=[$i info class] [$page exists __is_book_page]" + if {$i ne "" && ![$page exists __is_book_page]} { set p [$i position] set count [$i count] - my log "--toc count=$count size=[$i array size page_name] indices=[lsort -integer [$i array names page_name]]" - if {$count == 0} {set count 1} - set book_relpos [format %.2f%% [expr {100.0 * $p / $count}]] - if {$p>1} {set book_prev_link [$package_id pretty_link [$i page_name [expr {$p - 1}]]]} - if {$p<$count} {set book_next_link [$package_id pretty_link [$i page_name [expr {$p + 1}]]]} + #my log "--toc count=$count size=[$i array size page_name] indices=[lsort -integer [$i array names page_name]]" + if {$count > 0} { + set book_relpos [format %.2f%% [expr {100.0 * $p / $count}]] + + if {$p>1} {set book_prev_link [$package_id pretty_link [$i page_name [expr {$p - 1}]]]} + if {$p<$count} {set book_next_link [$package_id pretty_link [$i page_name [expr {$p + 1}]]]} #ns_log notice "--p=$p, count=$count, relpos=$book_relpos, {100.0 * $p / $count} next=[info exists next_link], prev=[info exists prev_link]" - set page_title "