template::widget::richtext_or_file (public)
template::widget::richtext_or_file element_reference tag_attributes
Defined in packages/acs-templating/tcl/richtext-or-file-procs.tcl
Render a richtext_or_file widget
- Parameters:
- element_reference (required)
- Reference variable to the form element
- tag_attributes (required)
- Attributes to include in the generated HTML
- Returns:
- Form HTML for the widget
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar $element_reference element array set attributes [::template::widget::merge_tag_attributes element $tag_attributes] if { [info exists element(value)] } { set storage_type [template::util::richtext_or_file::get_property storage_type $element(value)] set mime_type [template::util::richtext_or_file::get_property mime_type $element(value)] set text [template::util::richtext_or_file::get_property text $element(value)] set filename [template::util::richtext_or_file::get_property filename $element(value)] set tmp_filename [template::util::richtext_or_file::get_property tmp_filename $element(value)] set content_url [template::util::richtext_or_file::get_property content_url $element(value)] } else { set storage_type {} set mime_type {} set text {} set filename {} set tmp_filename {} set content_url {} } set output {} if {$element(mode) eq "edit"} { if { $storage_type eq "" } { append output [subst { <input type="radio" name="$element(id).storage_type" id="$element(id).storage_type_text" value="text" checked> <label for="$element(id).storage_type_text">Enter text</label><blockquote> }] template::add_event_listener -id "$element(id).storage_type_file" -script [subst {acs_RichText_Or_File_InputMethodChanged('$element(form_id)', '$element(id)', this);}] } else { append output [subst { <input type="hidden" name="$element(id).storage_type" value="[ns_quotehtml $storage_type]"> }] } ::template::head::add_javascript -src /resources/acs-templating/richtext-or-file.js if { $storage_type eq "" || $storage_type eq "text" } { append output [subst {<script type="text/javascript" nonce='[security::csp::nonce]'><!--}] \n {acs_RichText_WriteButtons(); //--></script>} [textarea_internal "$element(id).text" attributes $text] [subst {<br>Format: [menu "$element(id).mime_type" [template::util::richtext_or_file::format_options] $mime_type attributes]}] } if { $storage_type eq "" } { append output [subst { </blockquote> <input type="radio" name="$element(id).storage_type" id="$element(id).storage_type_file" value="file"> <label for="$element(id).storage_type_file">Upload a file</label> <blockquote> }] template::add_event_listener -id "$element(id).storage_type_file" -script [subst {acs_RichText_Or_File_InputMethodChanged('$element(form_id)', '$element(id)', this);}] } if {$storage_type eq "file"} { append output [template::util::richtext_or_file::get_property html_value $element(value)] "<p>Replace uploaded file: " [subst {<input type="file" name="$element(id).file">}] } if { $storage_type eq "" } { append output [subst {<input type="file" name="$element(id).file" disabled>}] } if { $storage_type eq "" } { append output "</blockquote>" } } else { # Display mode if { [info exists element(value)] } { append output [template::util::richtext_or_file::get_property html_value $element(value)] append output "<input type=\"hidden\" name=\"$element(id).mime_type\" value=\"[ns_quotehtml $mime_type]\">" append output "<input type=\"hidden\" name=\"$element(id).storage_type\" value=\"[ns_quotehtml $storage_type]\">" append output "<input type=\"hidden\" name=\"$element(id).text\" value=\"[ns_quotehtml $text]\">" } } return $outputXQL Not present: Generic, PostgreSQL, Oracle