Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v
diff -u -r1.239.2.23 -r1.239.2.24
--- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 1 Oct 2019 19:54:08 -0000 1.239.2.23
+++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 21 Oct 2019 16:39:29 -0000 1.239.2.24
@@ -87,7 +87,7 @@
}
}
::xowiki::Includelet proc available_includelets {} {
- if {[array exists :html]} {:array unset html}
+ if {[array exists :html]} {array unset :html}
:describe_includelets [::xowiki::Includelet info subclass]
set result "
"
foreach d [lsort [array names :html]] {
@@ -394,6 +394,86 @@
namespace eval ::xowiki::includelet {
#############################################################################
+ ::xowiki::IncludeletClass create available-formfields \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "The following formfield types can be used in xowiki::Forms"}
+ {parameter_declaration {
+ {-flat:boolean false}
+ }}
+ } -ad_doc {
+ List the available form field types of this installation.
+
+ @param flat when "true" display a flat list structure instead
+ of a tree (default)
+ }
+
+ available-formfields instproc render {} {
+ :get_parameters
+
+ foreach cl [lsort [::xowiki::formfield::FormField info subclass -closure]] {
+ set result ""
+ set superClassName [namespace tail [$cl info superclass]]
+ set className [namespace tail $cl]
+ append result \
+ "$className " \
+ "(superclass $superClassName)\n" \
+ "\n"
+ foreach p [lsort [$cl info parameter]] {
+ if {[llength $p] == 2} {
+ lassign $p name value
+ append result "- -$name [ns_quotehtml $value]
\n"
+ } else {
+ append result "- -$p
"
+ }
+ }
+ append result "
\n"
+ set index [::xo::api object_index "" $cl]
+ if {[nsv_exists api_library_doc $index]} {
+ set doc_elements [nsv_get api_library_doc $index]
+ append result [lindex [dict get $doc_elements main] 0]
+ } else {
+ append result
+ }
+ set :html($className) $result
+ }
+ if {$flat} {
+ #
+ # Output as flat list
+ #
+ set result
+ foreach className [lsort [array names :html]] {
+ append result "- [set :html($className)]
\n"
+ }
+ append result "
"
+ } else {
+ #
+ # Output as tree
+ #
+ set result [:render_as_tree ::xowiki::formfield::FormField [::xowiki::formfield::FormField info subclass]]
+
+ }
+ return $result
+ }
+
+ available-formfields instproc render_as_tree {cl subclasses} {
+ set subclassHTML ""
+ foreach subcl [lsort $subclasses] {
+ append subclassHTML - [:render_as_tree $subcl [$subcl info subclass]]
+ }
+ if {[llength $subclasses] > 0} {
+ set subclassHTML
+ }
+ set className [namespace tail $cl]
+ append result \
+ [set :html([namespace tail $cl])] \
+ $subclassHTML \
+
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
# Page Fragment Cache
#
# The following mixin-class implements page fragment caching in the