download_metadata_widget (public)

 download_metadata_widget data_type name metadata_id [ user_value ]

Defined in packages/download/tcl/download-procs.tcl

Return a widget to take input of the given data_type

Parameters:
data_type
name
metadata_id
user_value (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 packages/download/www/archive-add.tcl packages/download/ www/archive-add.tcl download_metadata_widget download_metadata_widget packages/download/www/archive-add.tcl->download_metadata_widget packages/download/www/archive-version-add.tcl packages/download/ www/archive-version-add.tcl packages/download/www/archive-version-add.tcl->download_metadata_widget ad_dateentrywidget ad_dateentrywidget (public, deprecated) download_metadata_widget->ad_dateentrywidget ad_decode ad_decode (public) download_metadata_widget->ad_decode db_foreach db_foreach (public) download_metadata_widget->db_foreach

Testcases:
No testcase defined.
Source code:
    set html ""
    set element_name "metadata.$metadata_id"
    switch -- $data_type {
        "number" {
            append html "<input type=text name=$element_name value=\"[ns_quotehtml $user_value]\" size=10>"
        }
        "integer" {
            append html "<input type=text name=$element_name value=\"[ns_quotehtml $user_value]\" size=10>"
        }
        "shorttext" {
            append html "<input type=text name=$element_name value=\"[ns_quotehtml $user_value]\" size=20>"
        }

        "text" {
            append html "<textarea name=$element_name cols=70 rows=10>$user_value</textarea>"
        }
        "date" {
            append html "[ad_dateentrywidget $element_name $user_value]"
        }
        "boolean" {
            append html "<select name=$element_name>
            <option value=\"\">Select One</option>
            <option value=\"t\" [ad_decode $user_value "t" "selected" ""]>True</option>
            <option value=\"f\" [ad_decode $user_value "f" "selected" ""]>False</option>
            </select>
            "
        }
        "choice" {
            append html "<select name=$element_name>
            <option value=\"\">Select One</option>\n"
            db_foreach download_metadata_choices "select choice_id, label
            from download_metadata_choices
            where metadata_id = :metadata_id
            order by sort_order" {
                if { $user_value == $choice_id } {
                    append html "<option value=$choice_id selected>$label</option>\n"
                } else {
                    append html "<option value=$choice_id>$label</option>\n"
                }
            }
            append html "</select>"
        }
    }
    return "
            <tr><th align=right valign=top>$name</th>
                <td>$html</td>
            </tr>"
Generic XQL file:
<fullquery name="download_metadata_widget.download_metadata_choices">
    <querytext>

select choice_id, label
from download_metadata_choices
where metadata_id = :metadata_id
order by sort_order

</querytext>
</fullquery>
packages/download/tcl/download-procs.xql

PostgreSQL XQL file:
packages/download/tcl/download-procs-postgresql.xql

Oracle XQL file:
packages/download/tcl/download-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: