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.10 -r1.11 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 25 Apr 2003 11:46:01 -0000 1.10 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 17 May 2003 09:38:08 -0000 1.11 @@ -177,7 +177,10 @@ # If it's not a Tcl file, we can't do a heck of a lot yet. Eventually # we'll be able to handle ADPs, at least. - if { ![string equal [file extension $path] ".tcl"] } { + if { [string equal [file extension $path] ".xql"] } { + append out "
DB Query file
\n" + return $out + } elseif { ![string equal [file extension $path] ".tcl"] } { append out "
Delivered as [ns_guesstype $path]
\n" return $out } @@ -393,10 +396,25 @@ return $public_p } +ad_proc -public api_quote_file { + filename +} { + returns a quoted version of the given filename +} { + if {![catch {set fp [open $filename r]} err]} { + set content [ad_quotehtml [read $fp]] + close $fp + return $content + } + return {} +} + + ad_proc -public api_proc_documentation { { -format text/html } -script:boolean -source:boolean + -xql:boolean proc_name } { @@ -405,6 +423,7 @@ @param format the type of documentation to generate. Currently, only text/html and text/plain are supported. @param script include information about what script this proc lives in? + @param xql include the source code for the related xql files? @param source include the source code for the script? @param proc_name the name of the procedure for which to generate documentation. @return the formatted documentation string. @@ -558,8 +577,33 @@
[ns_quotehtml [info body $proc_name]]
 

\n" } + + set xql_base_name [get_server_root]/ + append xql_base_name [file rootname $doc_elements(script)] + if { $xql_p } { + if { [file exists ${xql_base_name}.xql] } { + append out "

Generic XQL file:
+
[api_quote_file ${xql_base_name}.xql]
+

\n" + } else { + append out "

Generic XQL file: ${xql_base_name}.xql does not exist

\n" + } + if { [file exists ${xql_base_name}-postgresql.xql] } { + append out "

Postgresql XQL file:
+
[api_quote_file ${xql_base_name}-postgresql.xql]
+

\n" + } else { + append out "

Postgresql XQL file: ${xql_base_name}-postgresql.xql does not exist

\n" + } + if { [file exists ${xql_base_name}-oracle.xql] } { + append out "

Oracle XQL file:
+
[api_quote_file ${xql_base_name}-oracle.xql]
+

\n" + } else { + append out "

Oracle XQL file: ${xql_base_name}-oracle.xql does not exist

\n" + } } - + # No "see also" yet. append out "" @@ -1000,3 +1044,35 @@ } { return "$proc" } + +ad_proc -private api_xql_links_list { path } { + + Returns list of xql files related to tcl script file + @param path path and filename from [acs_root_dir] + + +} { + + set linkList [list] + set filename "[acs_root_dir]/$path" + set path_dirname [file dirname $path] + set file_dirname [file dirname $filename] + set file_rootname [file rootname [file tail $filename]] + regsub {(-oracle|-postgresql)$} $file_rootname {} file_rootname + set files \ + [lsort -decreasing \ + [glob -nocomplain \ + -directory $file_dirname \ + "${file_rootname}{,-}{,oracle,postgresql}.{adp,tcl,xql}" ]] + + foreach file $files { + lappend linkList [list \ + filename $file \ + link "content-page-view?source_p=1&path=[ns_urlencode "$path_dirname/[file tail $file]"]" \ + ] + + } + + return $linkList + +}