template::list::render_filters (public)

 template::list::render_filters -name name [ -style style ]

Defined in packages/acs-templating/tcl/list-procs.tcl

Render template list filters

Switches:
-name
(required)
Name
-style
(optional)
List filter style

Partial Call Graph (max 5 caller/called nodes):
%3 ad_conn ad_conn (public) ad_string_truncate ad_string_truncate (public) apm_package_id_from_key apm_package_id_from_key (public) parameter::get parameter::get (public) template::adp_init template::adp_init (public) template::list::render_filters template::list::render_filters template::list::render_filters->ad_conn template::list::render_filters->ad_string_truncate template::list::render_filters->apm_package_id_from_key template::list::render_filters->parameter::get template::list::render_filters->template::adp_init

Testcases:
No testcase defined.
Source code:
    set level [template::adp_level]

    # Provide a reference to the list properties for use by the list
    # template Get an upvar'd reference to list_properties
    get_reference -name $name

    #
    # Create 'filters' multirow
    #

    # Manually construct a multirow by setting the relevant variables
    set filters:rowcount 0
    template::multirow -local create filters  filter_name  filter_label  filter_clear_url  label  key_value  url  url_html_title  count  add_url  selected_p  type

    foreach filter_ref $list_properties(filter_refs) {

        upvar #$level $filter_ref filter_properties

        if { ![string is true -strict $filter_properties(hide_p)] } {

            # Loop over 'values' and 'url' simultaneously
            foreach  elm $filter_properties(values)  url $filter_properties(urls)  selected_p $filter_properties(selected_p)  add_url $filter_properties(add_urls) {

                    # 'label' is the first element, 'value' the
                    # second.  We do an lrange here, otherwise values
                    # would be set wrong in case someone accidentally
                    # supplies a list with too many elements, because
                    # then the foreach loop would run more than once
                    foreach { label value count } [lrange $elm 0 2] {}

                    if { [string is space $label] } {
                        set label $filter_properties(null_label)
                    }

                    if {$filter_properties(type) eq "multival"} {
                        # We need to ns_urlencode the name to work
                        set filter_properties_name [ns_urlencode $filter_properties(name)]
                    } else {
                        set filter_properties_name $filter_properties(name)
                    }

                    template::multirow -local append filters  $filter_properties_name  $filter_properties(label)  $filter_properties(clear_url)  [ad_string_truncate -len 25 -- $label]  $value  $url  $label  $count  $add_url  $selected_p  $filter_properties(type)
                }
        }
    }

    if {$style eq {}} {
        set style [parameter::get  -package_id [ad_conn subsite_id]  -parameter DefaultListFilterStyle  -default [parameter::get  -package_id [apm_package_id_from_key "acs-templating"]  -parameter DefaultListFilterStyle  -default "filters"]]
    }

    set file_stub [template::resource_path -type lists -style $style]

    #
    # Ensure that the ADP template has been compiled and is
    # up-to-date, and execute it to update __adp_output. The only data
    # source on which this template depends is the "elements" multirow
    # data source.  The output of this procedure will be placed in
    # __adp_output in this stack frame.
    #
    [template::adp_init adp $file_stub]

    return $__adp_output
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: