template::list::prepare_elements (private)

 template::list::prepare_elements -name name [ -ulevel ulevel ] \
    [ -elements elements ]

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

Builds urls, selected_p, etc., for filters

Switches:
-name (required)
-ulevel (optional, defaults to "1")
-elements (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 template::list::prepare template::list::prepare (public) template::list::prepare_elements template::list::prepare_elements template::list::prepare->template::list::prepare_elements _ _ (public) template::list::prepare_elements->_ template::list::element::get_reference template::list::element::get_reference (public) template::list::prepare_elements->template::list::element::get_reference template::list::get_reference template::list::get_reference (public) template::list::prepare_elements->template::list::get_reference template::list::get_url template::list::get_url (private) template::list::prepare_elements->template::list::get_url

Testcases:
No testcase defined.
Source code:
    # Get an upvar'd reference to list_properties
    get_reference -name $name
    if {![info exists elements]} {
        set elements $list_properties(elements)
    }
    foreach element_name $elements {
        template::list::element::get_reference -list_name $name -element_name $element_name

        if { $element_properties(default_direction) ne "" } {

            if {$list_properties(orderby_selected_name) eq $element_name} {
                # We're currently ordering on this column
                set direction [expr {$list_properties(orderby_selected_direction) eq "asc" ? "desc" : "asc"}]
                set element_properties(orderby_url) [get_url  -name $name  -override [list [list $list_properties(orderby_name) "${element_name},$direction"]]]
                set element_properties(orderby_html_title)  [_ acs-templating.reverse_sort_order_of_label [list label $element_properties(label)]]
                set element_properties(ordering_p) "t"
                set element_properties(orderby_direction) $list_properties(orderby_selected_direction)

            } else {
                # We're not currently ordering on this column
                set element_properties(orderby_url) [get_url  -name $name  -override [list [list $list_properties(orderby_name) "${element_name},$element_properties(default_direction)"]]]
                set element_properties(orderby_html_title) [_ acs-templating.sort_the_list_by_label [list label $element_properties(label)]]
            }
        }

        # support dynamic columns
        if {!$element_properties(hide_p)} {
            if {$element_properties(from_clause_eval) ne ""} {
                set evaluated_from_clause [uplevel $list_properties(ulevel) $element_properties($property)]
                if {$evaluated_from_clause ni $list_properties(from_clauses)} {
                    lappend list_properties(from_clauses) $evaluated_from_clause
                }
            } elseif {$element_properties(from_clause) ne ""
                      && $element_properties(from_clause) ni $list_properties(from_clauses)} {
                lappend list_properties(from_clauses) $element_properties(from_clause)
            }
            # get the select clause
            if {$element_properties(select_clause_eval) ne ""
                && [lsearch $list_properties(element_select_clauses) [string trim  [uplevel $list_properties(ulevel) $element_properties(select_clause_eval)]]] < 0} {
                lappend list_properties(element_select_clauses)  [uplevel $list_properties(ulevel) $element_properties(select_clause_eval)]
            } elseif {$element_properties(select_clause) ne ""
                      && [lsearch $list_properties(element_select_clauses) [string trim $element_properties(select_clause)]] < 0} {
                lappend list_properties(element_select_clauses) $element_properties(select_clause)
            }
            # get the where clause
            if {$element_properties(where_clause_eval) ne ""
                && [lsearch $list_properties(element_where_clauses) [string trim [uplevel $list_properties(ulevel) $element_properties(where_clause_eval)]]] < 0} {
                lappend list_properties(element_where_clauses)  [uplevel $list_properties(ulevel) $element_properties(where_clause_eval)]
            } elseif {$element_properties(where_clause) ne ""
                      && [lsearch $list_properties(element_where_clauses) [string trim $element_properties(where_clause)]] < 0} {
                lappend list_properties(element_where_clauses) $element_properties(where_clause)
            }
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: