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 -N -r1.239.2.84 -r1.239.2.85 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 8 Feb 2022 14:50:08 -0000 1.239.2.84 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 7 Mar 2022 19:00:24 -0000 1.239.2.85 @@ -2618,7 +2618,7 @@ set :js [:yui_non_ajax] } - set tree [::xowiki::Tree new -destroy_on_cleanup -orderby pos -id [:id]] + set tree [::xowiki::Tree new -destroy_on_cleanup -id [:id]] $tree array set open_node [array get :open_node] $tree add_pages -full $full -remove_levels $remove_levels \ -book_mode $book_mode -open_page $open_page -expand_all $expand_all \ @@ -2633,7 +2633,6 @@ toc instproc render_tree {{-full false} pages} { :get_parameters set tree [::xowiki::Tree new -destroy_on_cleanup \ - -orderby pos \ -id [:id] \ -verbose 0 \ -owner [self]] @@ -2672,7 +2671,7 @@ } else { set allow_reorder [:page_reorder_check_allow -with_head_entries false $allow_reorder] } - set tree [::xowiki::Tree new -destroy_on_cleanup -orderby pos -id [:id]] + set tree [::xowiki::Tree new -destroy_on_cleanup -id [:id]] $tree array set open_node [array get :open_node] $tree add_pages -full $full \ -remove_levels $remove_levels \ @@ -2769,6 +2768,10 @@ # set pages [:build_toc $package_id $locale $source $range] + #foreach p [$pages children] { + # ns_log notice "... [$p set page_order] [$p set name]" + #} + # # Build the general navigation structure using associative arrays # Index: openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/Attic/includelet-test-procs.tcl,v diff -u -N -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl 7 Mar 2022 16:00:36 -0000 1.1.2.2 +++ openacs-4/packages/xowiki/tcl/test/includelet-test-procs.tcl 7 Mar 2022 19:00:24 -0000 1.1.2.3 @@ -1,34 +1,28 @@ - - aa_register_case \ -cats {smoke production_safe} \ -procs { "::acs::test::require_package_instance" "::xo::PackageMgr instproc initialize" + "::xowiki::Page instproc include" - "::acs::root_of_host" - "::ad_host" - "::api_page_documentation_mode_p" - "::auth::require_login" - "::export_vars" - "::site_node::get_url_from_object_id" - "::xo::ConnectionContext instproc user_id" - "::xo::Context instproc export_vars" - "::xo::Context instproc original_url_and_query" - "::xowiki::Package instproc normalize_path" - "::xo::PackageMgr proc get_package_class_from_package_key" + "::xo::OrderedComposite::IndexCompare instproc __compare" + "::xowiki::includelet::toc instproc build_toc" + "::xowiki::includelet::toc instproc initialize" + "::xowiki::includelet::toc instproc render" + "::xowiki::includelet::toc instproc render_list" + "::xowiki::includelet::toc instproc render_yui_list" } \ includelet_toc { test toc includelet. } { + set system_locale [lang::system::locale] set instance /xowiki-test set package_id [::acs::test::require_package_instance \ -package_key xowiki \ -empty \ -instance_name $instance] - try { ::xowiki::Package initialize -package $package_id @@ -39,61 +33,63 @@ "toc-folder" $root_folder_id $package_id] # - # Create a trivial ToC page with "list" style and - # check that this won't return an error + # Create pages for toc testing, including page_order comparsions # - foreach {po} { + foreach po { 1 1.1 - 1.2 - 1.10 1.1.1 + 1.10 + 1.2 + 10 + 10.1 + 100 2 2.1 3 3.1 4 - 5 - 6 - 7 - 8 9 - 10 - 10.1 - 100 } { set id($po) [xowiki::test::require_page \ - -page_order $po \ - en:p$po \ - $f_id $package_id] - } + -page_order $po \ + en:p$po \ + $f_id $package_id] + } ::xo::db::CrClass get_instance_from_db -item_id $id(1) - - set HTML [$id(1) include {toc -full 1 -decoration plain}] - ns_log notice R0=$HTML - - acs::test::dom_html root $HTML { - set elements [lmap node [$root selectNodes //li] {lindex [$node asText] 0}] + + foreach includelet { + {toc -full 1 -decoration plain} + {toc -style list -expand_all true -decoration plain} + {toc -style yuitree -decoration none} + } { + aa_section "$includelet" + + set HTML [$id(1) include $includelet] + #ns_log notice "R $includelet => $HTML " + + acs::test::dom_html root $HTML { + set elements [lmap node [$root selectNodes //li] {lindex [$node asText] 0}] + } + aa_log "elements: $elements" + + aa_true "find 1.1" {[lsearch $elements 1.1] > -1} + aa_true "find 1.2" {[lsearch $elements 1.2] > -1} + aa_true "find 1.10" {[lsearch $elements 1.10] > -1} + aa_true "find 9" {[lsearch $elements 9] > -1} + aa_true "find 100" {[lsearch $elements 100] > -1} + + aa_true "1.1 before 1.2" {[lsearch $elements 1.1] < [lsearch $elements 1.2]} + aa_true "1.2 before 1.10" {[lsearch $elements 1.2] < [lsearch $elements 1.10]} + aa_true "3.1 before 9" {[lsearch $elements 3.1] < [lsearch $elements 9]} + aa_true "2 before 100" {[lsearch $elements 2] < [lsearch $elements 100]} } - aa_log elements=$elements - aa_true "find 1.1" {[lsearch $elements 1.1] > -1} - aa_true "find 1.2" {[lsearch $elements 1.2] > -1} - aa_true "find 1.10" {[lsearch $elements 1.10] > -1} - aa_true "1.1 before 1.2" {[lsearch $elements 1.1] < [lsearch $elements 1.2]} - aa_true "1.2 before 1.10" {[lsearch $elements 1.2] < [lsearch $elements 1.10]} - aa_true "3.1 before 9" {[lsearch $elements 3.1] < [lsearch $elements 9]} - aa_true "2 before 100" {[lsearch $elements 2] < [lsearch $elements 100]} - - #set HTML [$id(1) include {toc -style list -full 1 -decoration plain}] - #ns_log notice R1=$HTML - - #set HTML [$id(1) include {toc -style list -expand_all true -decoration plain}] - #ns_log notice R2=$HTML - + } finally { + lang::system::set_locale $system_locale + # set node_id [site_node::get_node_id -url /$instance] # site_node::unmount -node_id $node_id # site_node::delete -node_id $node_id -delete_package } - }