template::data::transform::richtext_or_file (public)

 template::data::transform::richtext_or_file element_ref

Defined in packages/acs-templating/tcl/richtext-or-file-procs.tcl

Transform submitted data into a valid richtext_or_file data structure (list)

Parameters:
element_ref (required)
Reference variable to the form element
Returns:
Submitted data in the richtext_or_datafile list form

Partial Call Graph (max 5 caller/called nodes):
%3 template::util::file::get_property template::util::file::get_property (public) template::util::file_transform template::util::file_transform (public) template::data::transform::richtext_or_file template::data::transform::richtext_or_file template::data::transform::richtext_or_file->template::util::file::get_property template::data::transform::richtext_or_file->template::util::file_transform

Testcases:
No testcase defined.
Source code:

    upvar $element_ref element
    set element_id $element(id)

    # We need to return the empty list in order for form builder to think of it
    # as a non-value in case of a required element.

    set storage_type [ns_queryget $element_id.storage_type]
    switch -- $storage_type {
        text {
            set text [ns_queryget $element_id.text]
            if { $text eq "" } {
                return [list]
            }
            set mime_type [ns_queryget $element_id.mime_type]

            return [list [list "text" $mime_type $text {} {} {}]]
        }
        file {
            set file [template::util::file_transform $element_id.file]
            if { $file eq "" } {
                return [list]
            }
            set filename [template::util::file::get_property filename $file]
            set tmp_filename [template::util::file::get_property tmp_filename $file]
            set mime_type [template::util::file::get_property mime_type $file]

            return [list [list "file" $mime_type {} $filename $tmp_filename {}]]
        }
        default {
            return [list]
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: