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.6.16.7 -r1.6.16.8 --- openacs-4/packages/acs-api-browser/www/proc-view.tcl 5 Sep 2014 10:22:40 -0000 1.6.16.7 +++ openacs-4/packages/acs-api-browser/www/proc-view.tcl 9 Sep 2014 07:42:38 -0000 1.6.16.8 @@ -22,11 +22,12 @@ if { $version_id ne "" } { db_0or1row package_info_from_package_id { select pretty_name, package_key, version_name - from apm_package_version_info - where version_id = :version_id + from apm_package_version_info + where version_id = :version_id } if {[info exists package_id]} { - lappend context [list "package-view?version_id=$version_id&kind=procs" "$pretty_name $version_name"] + lappend context [list "package-view?version_id=$version_id&kind=procs" \ + "$pretty_name $version_name"] } } lappend context [list $proc] @@ -39,69 +40,97 @@ set source_p $default_source_p } -# Try and be helpful about the procedure. -if { ![nsv_exists api_proc_doc $proc] } { - if {[info procs ::$proc] eq "::$proc"} { +if {[string match ::* $proc]} { + set absolute_proc $proc + set relative_proc [string range $proc 2 end] +} else { + set absolute_proc ::$proc + set relative_proc $proc +} + +set documented_call [nsv_exists api_proc_doc $relative_proc] +if {$documented_call} { + set proc_index $relative_proc +} else { + set documented_call [nsv_exists api_proc_doc $absolute_proc] + set proc_index $absolute_proc +} + +if { !$documented_call } { + if {[info procs $absolute_proc] eq $absolute_proc} { + + template::head::add_style -style {pre.code { + background: #fefefa; + border-color: #aaaaaa; + border-style: solid; + border-width: 1px; + }} set error_msg [subst { -

This procedure is defined in the server but not - documented via ad_proc or proc_doc and may be intended as - a private interface.

The procedure is defined as: -

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

- }] - } elseif {[info commands ::$proc] eq "::$proc"} { +

This procedure is defined in the server but not + documented via ad_proc or proc_doc and may be intended as + a private interface.

The procedure is defined as: +

+proc $proc {[info args $proc]} {
+    [ad_quotehtml [info body $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 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 $proc] - - if {$url ne ""} { - ns_log notice "got URL <$url>" - ad_returnredirect -allow_complete_url $url - ad_script_abort - } + 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 "got URL <$url>" + ad_returnredirect -allow_complete_url $url + ad_script_abort + } - set result [util_memoize [list ::util::http::get -url $::apidoc::tcl_api_html_index]] - set page [dict get $result page] + set result [util_memoize [list ::util::http::get -url $::apidoc::tcl_api_html_index]] + set page [dict get $result page] - # Strip the end of the Tcl-URL to obtain the root - regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root - append root / + # Strip the end of the Tcl-URL to obtain the root + regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root + append root / - set url [apidoc::search_on_webindex -page $page \ - -root $root -host $root -proc $proc] - - if {$url ne ""} { - ad_returnredirect -allow_complete_url $url - ad_script_abort - } + set url [apidoc::search_on_webindex -page $page -root $root -host $root -proc $proc] + + if {$url ne ""} { + ad_returnredirect -allow_complete_url $url + ad_script_abort + } set error_msg [subst { -

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

- }] +

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

+ }] } else { set error_msg "

The procedure $proc is not defined in the server.

" } } else { if { $source_p } { - set documentation [api_proc_documentation -script -xql -source $proc] + set documentation [api_proc_documentation -script -xql -source $proc_index] } else { - set documentation [api_proc_documentation -script $proc] + set documentation [api_proc_documentation -script $proc_index] } } + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: