Index: openacs-4/packages/acs-api-browser/acs-api-browser.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/acs-api-browser.info,v diff -u -r1.36.2.7 -r1.36.2.8 --- openacs-4/packages/acs-api-browser/acs-api-browser.info 19 May 2016 08:43:01 -0000 1.36.2.7 +++ openacs-4/packages/acs-api-browser/acs-api-browser.info 2 Aug 2016 10:14:41 -0000 1.36.2.8 @@ -7,7 +7,7 @@ t t - + OpenACS Interactive documentation for the Tcl and SQL APIs. 2015-10-04 @@ -17,7 +17,7 @@ 3 On line interactive documentation for the locally installed Tcl and SQL APIs. Links to the Tcl core and NaviServer/AOLServer online documentation as well. - + Index: openacs-4/packages/acs-api-browser/lib/search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/lib/search.adp,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/acs-api-browser/lib/search.adp 22 May 2016 19:22:51 -0000 1.7.2.1 +++ openacs-4/packages/acs-api-browser/lib/search.adp 2 Aug 2016 10:14:41 -0000 1.7.2.2 @@ -50,10 +50,11 @@ - AOLserver Tcl API Search + NaviServer/AOLserver Tcl API Search + (enter exact procedure name) Browse AOLserver Tcl API Index: openacs-4/packages/acs-api-browser/lib/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/lib/search.tcl,v diff -u -r1.6.12.1 -r1.6.12.2 --- openacs-4/packages/acs-api-browser/lib/search.tcl 10 Sep 2015 08:21:11 -0000 1.6.12.1 +++ openacs-4/packages/acs-api-browser/lib/search.tcl 2 Aug 2016 10:14:41 -0000 1.6.12.2 @@ -9,30 +9,23 @@ if { ![info exists query_string] } { set query_string {} } - -set aolserver_tcl_api_root "http://www.aolserver.com/docs/devel/tcl/api/" - -set tcl_docs_root "http://tcl.tk/man/tcl[info tclversion]/TclCmd/contents.htm" - set package_url [apm_package_url_from_key "acs-api-browser"] -set openacs_search_url "${package_url}proc-search" +set aolserver_tcl_api_root "http://www.aolserver.com/docs/devel/tcl/api/" +set tcl_docs_root "http://tcl.tk/man/tcl[info tclversion]/TclCmd/contents.htm" -set openacs_browse_url "${package_url}proc-browse" - +set openacs_search_url "${package_url}proc-search" +set openacs_browse_url "${package_url}proc-browse" set openacs_plsql_browse_url "${package_url}plsql-subprograms-all" +set aolserver_search_url "${package_url}tcl-proc-view" +set tcl_search_url "${package_url}tcl-doc-search" -set aolserver_search_url "${package_url}tcl-proc-view" - -set tcl_search_url "${package_url}tcl-doc-search" - - switch [db_type] { postgresql { set db_pretty "PostgreSQL [db_version]" set db_doc_url "http://www.postgresql.org/docs/[db_version]/interactive/index.html" - set db_doc_search_url "http://search.postgresql.org/www.search" - set db_doc_search_export [export_vars -form { { ul "http://www.postgresql.org/docs/[db_version]/static/%" } }] + set db_doc_search_url "https://www.postgresql.org/search" + set db_doc_search_export [export_vars -form { { ul "https://www.postgresql.org/docs/[db_version]/static/%" } }] set db_doc_search_query_name "q" } oracle { Index: openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl,v diff -u -r1.30.2.22 -r1.30.2.23 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 14 May 2016 11:47:07 -0000 1.30.2.22 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 2 Aug 2016 10:14:41 -0000 1.30.2.23 @@ -16,9 +16,13 @@ # NaviServer at sourceforge # set ns_api_host "http://naviserver.sourceforge.net/" - set ns_api_index "n/naviserver/files/" - set ns_api_root ${ns_api_host}${ns_api_index} - set ns_api_html_index $ns_api_root/commandlist.html + set ns_api_index [list "n/naviserver/files/" "n/"] + set ns_api_root [list \ + ${ns_api_host}[lindex $ns_api_index 0] \ + ${ns_api_host}[lindex $ns_api_index 1] ] + set ns_api_html_index [list \ + [lindex $ns_api_root 0]commandlist.html \ + [lindex $ns_api_root 1]toc.html ] } else { # # AOLserver wiki on panpotic @@ -1146,6 +1150,35 @@ return $url } + ad_proc -private get_doc_url {-cmd -index -root -host} { + + foreach i $index r $root { + set result [util_memoize [list ::util::http::get -url $i]] + set page [dict get $result page] + + # + # Since man pages contain often a summary of multiple commands, try + # abbreviation in case the full name is not found (e.g. man page "nsv" + # contains "nsv_array", "nsv_set" etc.) + # + set url "" + for {set i [string length $cmd]} {$i > 1} {incr i -1} { + set proc [string range $cmd 0 $i] + set url [apidoc::search_on_webindex \ + -page $page \ + -root $r \ + -host $host \ + -proc $proc] + if {$url ne ""} { + ns_log notice "=== cmd <$cmd> --> $url" + return $url + } + } + } + ns_log notice "=== cmd <$cmd> not found on <$index> root <$root> host <$host>" + return "" + } + ad_proc -private pretty_token {kind token} { Encode the specified token in HTML } { Index: openacs-4/packages/acs-api-browser/www/plsql-subprogram-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/plsql-subprogram-one.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/acs-api-browser/www/plsql-subprogram-one.tcl 10 Sep 2015 08:21:11 -0000 1.6.2.1 +++ openacs-4/packages/acs-api-browser/www/plsql-subprogram-one.tcl 2 Aug 2016 10:14:41 -0000 1.6.2.2 @@ -22,12 +22,8 @@ set source_text "" -db_foreach source_text "select text -from user_source -where name = upper(:name) -and type = upper(:type) -order by line" { - append source_text $text +db_foreach source_text {} { + append source_text $text \n\n\n } switch $type { Index: openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-oracle.xql,v diff -u -r1.1 -r1.1.30.1 --- openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-oracle.xql 17 Feb 2002 22:10:12 -0000 1.1 +++ openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-oracle.xql 2 Aug 2016 10:14:41 -0000 1.1.30.1 @@ -6,7 +6,7 @@ - select object_type as type, object_name as name + select object_type as type, object_name as name, 0 as nargs from user_objects where object_type in ('PACKAGE', 'PROCEDURE', 'FUNCTION') order by Index: openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-postgresql.xql,v diff -u -r1.2 -r1.2.24.1 --- openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-postgresql.xql 17 Jul 2003 02:35:27 -0000 1.2 +++ openacs-4/packages/acs-api-browser/www/plsql-subprograms-all-postgresql.xql 2 Aug 2016 10:14:41 -0000 1.2.24.1 @@ -6,11 +6,11 @@ - select proname as name, 'FUNCTION' as type + select proname as name, 'FUNCTION' as type, pronargs as nargs from pg_proc where proowner=(select usesysid from pg_user where usename = current_user) - order by proname + order by proname, pronargs Index: openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.adp,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.adp 3 Jul 2015 10:25:40 -0000 1.7 +++ openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.adp 2 Aug 2016 10:14:41 -0000 1.7.2.1 @@ -7,7 +7,7 @@ -<%= [string tolower @all_subprograms.name@] %> +@all_subprograms.label@ Index: openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.tcl,v diff -u -r1.4.28.3 -r1.4.28.4 --- openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.tcl 27 Oct 2015 23:05:30 -0000 1.4.28.3 +++ openacs-4/packages/acs-api-browser/www/plsql-subprograms-all.tcl 2 Aug 2016 10:14:41 -0000 1.4.28.4 @@ -18,7 +18,13 @@ # Organize the subprograms und types like FUNCTION, PROCEDURE, and # PACKAGE in oracle or FUNCTION in PostgresSQL # -db_multirow all_subprograms all_subprograms {} +db_multirow -extend { url label } all_subprograms all_subprograms {} { + set url [export_vars -base plsql-subprogram-one {type name}] + set label [string tolower $name] + if {$nargs > 0} { + append label /$nargs + } +} # Local variables: # mode: tcl 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.2.7 -r1.10.2.8 --- openacs-4/packages/acs-api-browser/www/proc-view.tcl 23 May 2016 10:56:49 -0000 1.10.2.7 +++ openacs-4/packages/acs-api-browser/www/proc-view.tcl 2 Aug 2016 10:14:41 -0000 1.10.2.8 @@ -86,31 +86,33 @@ ad_script_abort } - set result [util_memoize [list ::util::http::get -url $::apidoc::ns_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] - 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 - ad_script_abort - } + if {$url eq ""} { - set result [util_memoize [list ::util::http::get -url $::apidoc::tcl_api_html_index]] - set page [dict get $result page] + # + # Try Tcl command documentation + # - # Strip the end of the Tcl-URL to obtain the root - regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root - append root / + regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root + append root / - set url [apidoc::search_on_webindex -page $page -root $root -host $root -proc $proc] - + 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 } @@ -120,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. }] Index: openacs-4/packages/acs-api-browser/www/tcl-doc-search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-doc-search.adp,v diff -u -r1.9.2.2 -r1.9.2.3 --- openacs-4/packages/acs-api-browser/www/tcl-doc-search.adp 22 Jun 2016 07:33:46 -0000 1.9.2.2 +++ openacs-4/packages/acs-api-browser/www/tcl-doc-search.adp 2 Aug 2016 10:14:41 -0000 1.9.2.3 @@ -6,7 +6,7 @@ -You can try searching the Tcl documentation yourself. +You can try searching the Tcl documentation yourself. Index: openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl,v diff -u -r1.8.2.2 -r1.8.2.3 --- openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl 22 May 2016 19:22:51 -0000 1.8.2.2 +++ openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl 2 Aug 2016 10:14:41 -0000 1.8.2.3 @@ -11,28 +11,27 @@ csrf { security::csrf::validate } } -set tcl_docs_root "http://tcl.tk/man/tcl[info tclversion]/TclCmd/" -set tcl_docs_url "${tcl_docs_root}contents.htm" -with_catch errmsg { - set tcl_docs_index_result [util_memoize [list util::http::get -url $tcl_docs_url]] - set tcl_docs_index_page [dict get $tcl_docs_index_result page] -} { - ad_return_error "Cannot Connect" "We're sorry, but we're having problems connecting to the server containing the Tcl documentation: $tcl_docs_url" - ad_script_abort -} +# +# Try Tcl command documentation +# -set tcl_proc [lindex $tcl_proc 0] -set len [string length $tcl_proc] +regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root +append root / -for { set i [expr { $len-1 }] } { $i >= 0 } { incr i -1 } { - set search_for [string range $tcl_proc 0 $i] - if { [regexp "\]+)\">$search_for" $tcl_docs_index_page match relative_url] } { - ad_returnredirect -allow_complete_url "$tcl_docs_root$relative_url" - ad_script_abort - } +set url [apidoc::get_doc_url \ + -cmd $tcl_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 } +set tcl_docs_url $::apidoc::tcl_api_html_index set title "Tcl API Procedure Search for: \"$tcl_proc\"" set context [list "Tcl API Search: $tcl_proc"] Index: openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl,v diff -u -r1.10.2.3 -r1.10.2.4 --- openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 22 May 2016 19:22:51 -0000 1.10.2.3 +++ openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 2 Aug 2016 10:14:41 -0000 1.10.2.4 @@ -11,25 +11,11 @@ csrf { security::csrf::validate } } -set ns_api_index_result [util_memoize [list ::util::http::get -url $::apidoc::ns_api_html_index]] -set ns_api_index_page [dict get $ns_api_index_result page] +set url [apidoc::get_doc_url -cmd $tcl_proc \ + -index $::apidoc::ns_api_html_index \ + -root $::apidoc::ns_api_root \ + -host $::apidoc::ns_api_host] -# -# Since man pages contain often a summary of multiple commands, try -# abbreviation in case the full name is not found (e.g. man page "nsv" -# contains "nsv_array", "nsv_set" etc.) -# -set url "" -for {set i [string length $tcl_proc]} {$i > 1} {incr i -1} { - set proc [string range $tcl_proc 0 $i] - set url [apidoc::search_on_webindex \ - -page $ns_api_index_page \ - -root $::apidoc::ns_api_root \ - -host $::apidoc::ns_api_host \ - -proc $proc] - if {$url ne ""} break -} - if {$url ne ""} { ad_returnredirect -allow_complete_url $url ad_script_abort
<%= [string tolower @all_subprograms.name@] %>
@all_subprograms.label@
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.
-You can try searching the Tcl documentation yourself. +You can try searching the Tcl documentation yourself.
Index: openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl,v diff -u -r1.8.2.2 -r1.8.2.3 --- openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl 22 May 2016 19:22:51 -0000 1.8.2.2 +++ openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl 2 Aug 2016 10:14:41 -0000 1.8.2.3 @@ -11,28 +11,27 @@ csrf { security::csrf::validate } } -set tcl_docs_root "http://tcl.tk/man/tcl[info tclversion]/TclCmd/" -set tcl_docs_url "${tcl_docs_root}contents.htm" -with_catch errmsg { - set tcl_docs_index_result [util_memoize [list util::http::get -url $tcl_docs_url]] - set tcl_docs_index_page [dict get $tcl_docs_index_result page] -} { - ad_return_error "Cannot Connect" "We're sorry, but we're having problems connecting to the server containing the Tcl documentation: $tcl_docs_url" - ad_script_abort -} +# +# Try Tcl command documentation +# -set tcl_proc [lindex $tcl_proc 0] -set len [string length $tcl_proc] +regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root +append root / -for { set i [expr { $len-1 }] } { $i >= 0 } { incr i -1 } { - set search_for [string range $tcl_proc 0 $i] - if { [regexp "\]+)\">$search_for" $tcl_docs_index_page match relative_url] } { - ad_returnredirect -allow_complete_url "$tcl_docs_root$relative_url" - ad_script_abort - } +set url [apidoc::get_doc_url \ + -cmd $tcl_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 } +set tcl_docs_url $::apidoc::tcl_api_html_index set title "Tcl API Procedure Search for: \"$tcl_proc\"" set context [list "Tcl API Search: $tcl_proc"] Index: openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl,v diff -u -r1.10.2.3 -r1.10.2.4 --- openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 22 May 2016 19:22:51 -0000 1.10.2.3 +++ openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 2 Aug 2016 10:14:41 -0000 1.10.2.4 @@ -11,25 +11,11 @@ csrf { security::csrf::validate } } -set ns_api_index_result [util_memoize [list ::util::http::get -url $::apidoc::ns_api_html_index]] -set ns_api_index_page [dict get $ns_api_index_result page] +set url [apidoc::get_doc_url -cmd $tcl_proc \ + -index $::apidoc::ns_api_html_index \ + -root $::apidoc::ns_api_root \ + -host $::apidoc::ns_api_host] -# -# Since man pages contain often a summary of multiple commands, try -# abbreviation in case the full name is not found (e.g. man page "nsv" -# contains "nsv_array", "nsv_set" etc.) -# -set url "" -for {set i [string length $tcl_proc]} {$i > 1} {incr i -1} { - set proc [string range $tcl_proc 0 $i] - set url [apidoc::search_on_webindex \ - -page $ns_api_index_page \ - -root $::apidoc::ns_api_root \ - -host $::apidoc::ns_api_host \ - -proc $proc] - if {$url ne ""} break -} - if {$url ne ""} { ad_returnredirect -allow_complete_url $url ad_script_abort