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.40 -r1.40.2.1
--- openacs-4/packages/acs-api-browser/acs-api-browser.info 25 Jul 2018 13:40:15 -0000 1.40
+++ openacs-4/packages/acs-api-browser/acs-api-browser.info 29 Sep 2019 16:07:19 -0000 1.40.2.1
@@ -7,7 +7,7 @@
t
t
-
+
OpenACS
Interactive documentation for the Tcl and SQL APIs.
2017-08-06
@@ -17,8 +17,8 @@
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/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.72.2.15 -r1.72.2.16
--- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 27 Sep 2019 10:26:06 -0000 1.72.2.15
+++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 29 Sep 2019 16:07:19 -0000 1.72.2.16
@@ -599,8 +599,16 @@
}
append blocks_out [::apidoc::format_common_elements doc_elements]
+ set css {
+ /*svg g a:link {text-decoration: none;}*/
+ div.inner svg {width: 100%; margin: 0 auto;}
+ svg g polygon {fill: transparent;}
+ svg g g ellipse {fill: #eeeef4;}
+ svg g g polygon {fill: #f4f4e4;}
+ }
- set callgraph [api_inline_svg_from_dot [api_call_graph_snippet -proc_name $proc_name -maxnodes 5]]
+ set callgraph [util::inline_svg_from_dot -css $css \
+ [api_call_graph_snippet -proc_name $proc_name -maxnodes 5]]
if {$callgraph ne ""} {
append blocks_out "Partial Call Graph (max 5 caller/called nodes):$callgraph\n"
}
@@ -1093,60 +1101,6 @@
append result "digraph \{api = $dpi;" $dot_code "\}"
}
-ad_proc -private api_inline_svg_from_dot {dot_code} {
-
- Transform a dot source code into an inline svg image based on code
- from xotcl-core; should be probably move later to a different
- place.
-
- @author Gustaf Neumann
-} {
- catch {set dot [::util::which dot]}
- if {$dot ne ""} {
- set dir [ad_tmpdir]/oacs-dotcode
- if {![file isdirectory $dir]} {
- file mkdir $dir
- }
- set dot_signature [ns_md5 $dot_code-svg]
- set stem $dir/$dot_signature
- if {![file exists $stem.svg]} {
- ns_log notice "api_inline_svg_from_dot: generate $stem.svg"
-
- set f [open $stem.dot w]; puts $f $dot_code; close $f
-
- set f [open "|$dot -Tsvg -o $stem.svg" w]; puts $f $dot_code
- try {
- close $f
- } on error {errorMsg} {
- ns_log warning "api_inline_svg_from_dot: dot returned $errorMsg"
- } on ok {result} {
- set f [open $stem.svg]; set svg [read $f]; close $f
- } finally {
- file delete -- $stem.dot
- }
- } else {
- ns_log notice "api_inline_svg_from_dot: try to reuse $stem.svg"
- }
- if {[file exists $stem.svg]} {
- set f [open $stem.svg]; set svg [read $f]; close $f
-
- # delete the first three lines generated from dot
- regsub {^[^\n]+\n[^\n]+\n[^\n]+\n} $svg "" svg
- set css {
- /*svg g a:link {text-decoration: none;}*/
- div.inner svg {width: 100%; margin: 0 auto;}
- svg g polygon {fill: transparent;}
- svg g g ellipse {fill: #eeeef4;}
- svg g g polygon {fill: #f4f4e4;}
- }
- return ""
- } else {
- ns_log warning "cannot create svg file"
- }
- }
- return ""
-}
-
ad_proc -public api_describe_function {
{ -format text/plain }
proc
Index: openacs-4/packages/acs-tcl/acs-tcl.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v
diff -u -r1.95.2.3 -r1.95.2.4
--- openacs-4/packages/acs-tcl/acs-tcl.info 14 Aug 2019 08:06:29 -0000 1.95.2.3
+++ openacs-4/packages/acs-tcl/acs-tcl.info 29 Sep 2019 16:07:19 -0000 1.95.2.4
@@ -9,7 +9,7 @@
f
t
-
+
OpenACS
The Kernel Tcl API library.
2017-08-06
@@ -18,7 +18,7 @@
GPL version 2
3
-
+
Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v
diff -u -r1.189.2.25 -r1.189.2.26
--- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 10 Sep 2019 13:04:11 -0000 1.189.2.25
+++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 29 Sep 2019 16:07:19 -0000 1.189.2.26
@@ -4136,6 +4136,75 @@
return [lsearch -index $sublist_element_pos $list_of_lists $query_string]
}
+namespace eval util {
+
+ ad_proc ::util::inline_svg_from_dot {{-css ""} dot_code} {
+
+ Transform a dot source code into an inline svg image based on
+ code from xotcl-core; should be probably made more
+ configurable in the future.
+
+ @param dot_code grapviz dot code
+ @result graph in HTML markup
+
+ @author Gustaf Neumann
+ } {
+ catch {set dot [::util::which dot]}
+ if {$dot ne ""} {
+ set dir [ad_tmpdir]/oacs-dotcode
+ if {![file isdirectory $dir]} {
+ file mkdir $dir
+ }
+ #
+ # Cache file in the filesystem based on an MD5 checksum
+ # derived from the dot source-cide, the format and the
+ # styling.
+ #
+ # TODO: one should provide a more general - usable for
+ # many applications - file cache with a cleanup of stale
+ # entries (maybe based on last access time, when the prile
+ # system provides it).
+ #
+ set dot_signature [ns_md5 $dot_code-svg-$css]
+ set stem $dir/$dot_signature
+ if {![file exists $stem.svg]} {
+ ns_log notice "inline_svg_from_dot: generate $stem.svg"
+
+ set f [open $stem.dot w]; puts $f $dot_code; close $f
+
+ set f [open "|$dot -Tsvg -o $stem.svg" w]; puts $f $dot_code
+ try {
+ close $f
+ } on error {errorMsg} {
+ ns_log warning "inline_svg_from_dot: dot returned $errorMsg"
+ } on ok {result} {
+ set f [open $stem.svg]; set svg [read $f]; close $f
+ } finally {
+ file delete -- $stem.dot
+ }
+ } else {
+ ns_log notice "inline_svg_from_dot: reuse $stem.svg"
+ }
+ if {[file exists $stem.svg]} {
+ set f [open $stem.svg]; set svg [read $f]; close $f
+ #
+ # Delete the first three lines generated from dot.
+ #
+ regsub {^[^\n]+\n[^\n]+\n[^\n]+\n} $svg "" svg
+ set result ""
+ if {$css ne ""} {
+ append result
+ }
+ append result "$svg
"
+ return $result
+ } else {
+ ns_log warning "cannot create svg file"
+ }
+ }
+ return ""
+ }
+}
+
#
# Management of resource files, to be used in sitewide-admin procs to
# decide between CDN installations and local installations.