- Publicity: Public Only All
form-field-procs.tcl
XoWiki - form fields
This file defines the following Objects and Classes: ::xowiki::formfield::FormField, ::xowiki::formfield::localized_text, ::xowiki::formfield::range, ::xowiki::formfield::numeric, ::xowiki::formfield::localized_richtext, ::xowiki::formfield::richtext::tinymce, ::xowiki::formfield::ShuffleField, ::xowiki::formfield::text_fields, ::xowiki::formfield::candidate_box_select, ::xowiki::formfield::FormField, ::xowiki::formfield::localized_text, ::xowiki::formfield::range, ::xowiki::formfield::numeric, ::xowiki::formfield::localized_richtext, ::xowiki::formfield::richtext::tinymce, ::xowiki::formfield::ShuffleField, ::xowiki::formfield::text_fields, ::xowiki::formfield::candidate_box_select
- Location:
- packages/xowiki/tcl/form-field-procs.tcl
- Created:
- 2007-06-22
- Author:
- Gustaf Neumann
- CVS Identification:
$Id: form-field-procs.tcl,v 1.284.2.260 2024/08/06 09:43:17 gustafn Exp $
Procedures in this file
- Class ::xowiki::formfield::FormField (public)
- Class ::xowiki::formfield::ShuffleField (public)
- Class ::xowiki::formfield::candidate_box_select (public)
- Class ::xowiki::formfield::localized_richtext (public)
- Class ::xowiki::formfield::localized_text (public)
- Class ::xowiki::formfield::numeric (public)
- Class ::xowiki::formfield::range (public)
- Class ::xowiki::formfield::richtext::tinymce (public)
- Class ::xowiki::formfield::text_fields (public)
- xowiki::formfield::CompoundField instproc get_named_sub_component_value (public)
- xowiki::formfield::child_components (public)
- xowiki::formfield::dict_to_fc (public)
- xowiki::formfield::dict_to_spec (public)
- xowiki::formfield::dict_value (public)
- xowiki::formfield::enumeration instproc scores (public)
- xowiki::formfield::fc_to_dict (public)
Detailed information
Class ::xowiki::formfield::FormField (public)
::xotcl::Class ::xowiki::formfield::FormField \ [ -language_specific language_specific ]
Base FormField class. FormFields are objects, which can be outputted as well in ad_forms or asHTML included in wiki pages. FormFields support: - validation - help_text - error messages - internationalized pretty_values and inherit properties of the original datatypes via slots (e.g. for boolean entries). FormFields can be subclassed to ensure tailor-ability and high reuse. todo: at some later time, this could go into xotcl-core.
- Switches:
- -language_specific
(optional)- this parameter decides that the value collected by this formfield should be transparently stored as a message key. The translation language is that of the current package, determined by 'use_connection_locale' package parameter, connection locale and system settings.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::ShuffleField (public)
::xotcl::Class ::xowiki::formfield::ShuffleField \ [ -shuffle_kind shuffle_kind ]
An abstract class for shuffling options and answers. The options can be used a content of checkboxes, radioboxes and the like. This is particular useful when creating quizzes.
- Switches:
- -shuffle_kind
(optional)- none|peruser|always
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::candidate_box_select (public)
::xotcl::Class ::xowiki::formfield::candidate_box_select \ [ -as_box as_box ] [ -keep_order keep_order ] [ -dnd dnd ]
XOTcl class for selecting a subset from a list of candidates.
- Switches:
- -as_box
(optional)- makes something like in info box in wikipedia (right floated)
- -keep_order
(optional)- when set, the user provided order is preserved, otherwise the order from the candidates is used.
- -dnd
(optional)- allow drag and drop
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::localized_richtext (public)
::xotcl::Class ::xowiki::formfield::localized_richtext
This class can be used to provide an interface for specifying internationalized text strings saved in message keys via input from a form. Very similar to localized_text
- See Also:
- xowiki::formfield::localized_text
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::localized_text (public)
::xotcl::Class ::xowiki::formfield::localized_text
This class can be used to provide an interface for specifying internationalized text strings saved in message keys via input from a form. When editing the content provided via the input field is saved together with an item-specific message keys in the message key tables via lang::util::convert_to_i18n. This formfield class is especially useful for xowiki items which have no language-prefix (e.g. folders or links). In other cases it is probably still a better idea to create same named pages with different language prefixes.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::numeric (public)
::xotcl::Class ::xowiki::formfield::numeric [ -format format ] \ [ -connection_locale connection_locale ] [ -strict strict ] \ [ -keep_string_rep keep_string_rep ]
Field with numeric content. Depending on the format, the accepted value can be either an integer or a floating point number. The widget performs localization based on the setting of :locale. In case 'keep_string_rep' is not true, the widget converts the value to an internal representation to be able to evaluate numeric expressions by this. When 'keep_string_rep' is true, the original string representation is kept, and only validation is performed.
- Switches:
- -format
(optional)- format for output and determining integer property
- -connection_locale
(optional)- when set, use the connection locale as source for internationalized input
- -strict
(optional)- when set, use just use the locale for input checking. Otherwise, always accept as fallback what is accepted by en_US.
- -keep_string_rep
(optional)- when true, do not convert from and to the internal representation, but preserve the original string.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::range (public)
::xotcl::Class ::xowiki::formfield::range [ -min min ] [ -max max ] \ [ -step step ] [ -with_output with_output ] \ [ -output_prefix output_prefix ] [ -output_suffix output_suffix ]
HTML5 range input field. The range input is rendered as a slider by the actual browsers.
- Switches:
- -min
(optional)- minimum value of the value range
- -max
(optional)- maximum value of the value range
- -step
(optional)- increment steps when moving the slider
- -with_output
(optional)- add an output box with show the actual slider value (requires JavaScript)
- -output_prefix
(optional)- prepend string value to the actual slider value in the output display
- -output_suffix
(optional)- append string value to the actual slider value in the output display
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::richtext::tinymce (public)
::xotcl::Class ::xowiki::formfield::richtext::tinymce \ [ -extraPlugins extraPlugins ] [ -customConfig customConfig ] \ [ -additionalConfig additionalConfig ]
TinyMCE XoWiki richtext-editor integration.
- Switches:
- -extraPlugins
(optional)- a list of couples 'pluginId' 'pluginURL' specifying additional plugins.
- -customConfig
(optional)- a configuration dict that will completely override configuration coming from the parameters.
- -additionalConfig
(optional)- a configuration dict that will be merged with configuration coming from the parameters. Values specified here will take precedence on the parameter values.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Class ::xowiki::formfield::text_fields (public)
::xotcl::Class ::xowiki::formfield::text_fields
Provide multiple text and short text entries. This field is a compound field which create for every text field a sub component. When the components are rendered, the items can be shuffled.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::formfield::CompoundField instproc get_named_sub_component_value (public)
<instance of xowiki::formfield::CompoundField> get_named_sub_component_value \ [ -from_repeat ] [ -default default ] args [ args... ]
Return the value of a named subcomponent. When the named subcomponent is a repeated item, and the value of the 0th element of the repeat (the template element) is omitted from the returned value.
- Switches:
- -from_repeat
(optional)- skip template element from repeated values
- -default
(optional)- default value, when component is not found
- Parameters:
- args - space separated path of elements names in a potentially nested component structure (similar to dict)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_test_items
xowiki::formfield::child_components (public)
xowiki::formfield::child_components [ -filter filter ] objs
For every form-field obj in the provided objs, return a list of all child components (potentially leaf components of compound fields). The result list is filtered by the optional filter expression, which can refer to the current object via variable $_.
- Switches:
- -filter
(defaults to"true"
) (optional)- Parameters:
- objs - input form-field objs
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::formfield::dict_to_fc (public)
xowiki::formfield::dict_to_fc [ -name name ] [ -type type ] dict
Convert the provided dict into form_constraint syntax (comma separated). The other direction would be more complex, since the fcs are interpreted from left to right, overwriting potentially previous values. The fc-interpretation creates already the form fields, produces intended errors, when certain attributes are not allowed, etc.
- Switches:
- -name
(optional)- optional form-field name
- -type
(optional)- type of the form-field; if not specified, take it from key "_type" of the dict
- Parameters:
- dict - dict to be converted.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- dict_to_xx
xowiki::formfield::dict_to_spec (public)
xowiki::formfield::dict_to_spec [ -aspair ] [ -name name ] dict
Convert the provided dict into a form-field spec together with the form-field name. When "-aspair" is specified the spec is returned in the list format as used by "create_components". If "-name" is not specified, the name has to be provided via dict member "_name", otherwise an exception is triggered.
- Switches:
- -aspair
(boolean) (defaults to"false"
) (optional)- -name
(optional)- Parameters:
- dict
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- dict_to_xx
xowiki::formfield::dict_value (public)
xowiki::formfield::dict_value dict key [ default ]
Return the dict value of the specified "key" when this member exists. Otherwise return the default.
- Parameters:
- dict
key
default (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- dict_to_xx
xowiki::formfield::enumeration instproc scores (public)
<instance of xowiki::formfield::enumeration> scores [ -r r ] \ [ -f f ] [ -rk rk ] [ -fk fk ] [ -R R ] [ -W W ]
- Switches:
- -r
(defaults to"0"
) (optional)- number of answers which are true
- -f
(defaults to"0"
) (optional)- number of answers which are false
- -rk
(defaults to"0"
) (optional)- number checkmarks to a true answer
- -fk
(defaults to"0"
) (optional)- number checkmarks to a false answer
- -R
(optional)- number correct answered
- -W
(optional)- number incorrect answered
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_test_items
xowiki::formfield::fc_to_dict (public)
xowiki::formfield::fc_to_dict form_constraints
Convert from form_constraint syntax to a dict. This is just a partial implementation to be probably extended in the future. it expects that the type is the first element and ignores everything not in the syntax "*=*", or skips "@*" fields. Don't expect this to be fully reversible.
- Parameters:
- form_constraints
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- dict_to_xx