Index: openacs-4/packages/xowiki/tcl/test/test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/test-procs.tcl,v diff -u -r1.15.2.9 -r1.15.2.10 --- openacs-4/packages/xowiki/tcl/test/test-procs.tcl 3 Jul 2019 19:54:08 -0000 1.15.2.9 +++ openacs-4/packages/xowiki/tcl/test/test-procs.tcl 18 Sep 2019 19:30:40 -0000 1.15.2.10 @@ -44,12 +44,16 @@ ad_proc -private ::xowiki::test::get_url_from_location {d} { set location [ns_set iget [dict get $d headers] Location ""] - set url [ns_parseurl $location] - #aa_log "parse url [ns_parseurl $location]" - if {[dict get $url tail] ne ""} { - set url [dict get $url path]/[dict get $url tail] + if {$location ne ""} { + set url [ns_parseurl $location] + #aa_log "parse url '$location' => $url" + if {[dict get $url tail] ne ""} { + set url [dict get $url path]/[dict get $url tail] + } else { + set url [dict get $url path] + } } else { - set url [dict get $url path] + set url "" } return $url } @@ -71,8 +75,9 @@ return [$node selectNodes string(//form\[contains(@class,'$className')\]/@action)] } - - # "require_folder" and "require_page" are here just for testing + # + # "require_folder", "require_page" and "require_link" are here just for testing + # ad_proc -private ::xowiki::test::require_folder {name parent_id package_id} { set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] @@ -88,20 +93,17 @@ aa_log " $name => $item_id\n" return $item_id } - - ad_proc -private ::xowiki::test::require_link {name parent_id package_id target_id} { + + ad_proc -private ::xowiki::test::require_link {name parent_id package_id target_ref} { set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] if {$item_id == 0} { set form_id [::xowiki::Weblog instantiate_forms -forms en:link.form -package_id $package_id] - set target [::xo::db::CrClass get_instance_from_db -item_id $target_id] - set item_ref [[$target package_id] external_name -parent_id [$target parent_id] [$target name]] - set f [::$form_id create_form_page_instance \ -name $name \ -nls_language en_US \ - -instance_attributes [list link $item_ref] \ - -default_variables [list title "Link $name" parent_id $parent_id package_id $package_id]] + -instance_attributes [list link $target_ref] \ + -default_variables [list title "Link $name -> $target_ref" parent_id $parent_id package_id $package_id]] $f save_new set item_id [$f item_id] }