Index: openacs-4/packages/acs-api-browser/www/proc-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/proc-view.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-api-browser/www/proc-view.tcl 2 Jul 2015 19:21:43 -0000 1.10 +++ openacs-4/packages/acs-api-browser/www/proc-view.tcl 7 Aug 2017 23:47:46 -0000 1.11 @@ -3,7 +3,7 @@ @cvs-id $Id$ } { - proc:token,trim + proc:nohtml,trim source_p:boolean,optional,trim {version_id:naturalnum,optional ""} } -properties { @@ -36,8 +36,9 @@ set return_url [export_vars -base [ad_conn url] {proc version_id}] set error_msg "" -if { ![info exists source_p] } { +if { ![info exists source_p] || $source_p eq ""} { set source_p $default_source_p + if {$source_p eq ""} {set source_p 0} } if {[string match ::* $proc]} { @@ -71,37 +72,47 @@ a private interface.

The procedure is defined as:

 proc $proc {[info args $proc]} {
-    [ad_quotehtml [info body $proc]]
+    [ns_quotehtml [info body $proc]]
 }
 

}] - } elseif {[info commands $absolute_proc] eq $absolute_proc} { + } elseif {[info commands $absolute_proc] eq $absolute_proc} { - set result [util_memoize [list ::util::http::get -url $::apidoc::ns_api_html_index]] - set page [dict get $result page] - - set url [apidoc::search_on_webindex \ - -page $page \ - -root $::apidoc::ns_api_root \ - -host $::apidoc::ns_api_host \ - -proc $relative_proc] - - if {$url ne ""} { - ns_log notice "api-doc/www/proc-view got URL <$url>" - ad_returnredirect -allow_complete_url $url + # + # In case the cmd is an object, redirect to the object browser + # + if {[info commands ::nsf::is] ne "" && [nsf::is object $absolute_proc]} { + ad_returnredirect [export_vars -base /xotcl/show-object {{object $absolute_proc}}] ad_script_abort } - set result [util_memoize [list ::util::http::get -url $::apidoc::tcl_api_html_index]] - set page [dict get $result page] + # + # Try NaviSever API documentation + # + set url [apidoc::get_doc_url \ + -cmd $relative_proc \ + -index $::apidoc::ns_api_html_index \ + -root $::apidoc::ns_api_root \ + -host $::apidoc::ns_api_host] - # Strip the end of the Tcl-URL to obtain the root - regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root - append root / + if {$url eq ""} { - set url [apidoc::search_on_webindex -page $page -root $root -host $root -proc $proc] - + # + # Try Tcl command documentation + # + + regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root + append root / + + set url [apidoc::get_doc_url \ + -cmd $proc \ + -index $::apidoc::tcl_api_html_index \ + -root $root \ + -host $root] + } + if {$url ne ""} { + ns_log notice "api-doc/www/proc-view got URL <$url>" ad_returnredirect -allow_complete_url $url ad_script_abort } @@ -111,7 +122,7 @@

The command $proc is an available command on the server and might be found in the Tcl - or [ns_info name] + or [ns_info name] documentation or in documentation for a loadable module.

}] @@ -127,6 +138,8 @@ set documentation [api_proc_documentation -script $proc_index] } } +set procViewToggleURL [export_vars -base proc-view [list proc [list source_p [expr {!$source_p}]] version_id]] +set setDefaultURL [export_vars -base set-default [list source_p return_url]] # # Local variables: