template::list::render (public)

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

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

Simple procedure to render HTML from a list template (That's a lame joke, Don)

Switches:
-name
(required)
The name of the list template.
-style
(optional)
Style template used to render this list template.
Returns:
HTML suitable for display by your favorite browser.

Partial Call Graph (max 5 caller/called nodes):
%3 template::adp_compile template::adp_compile (public) template::adp_eval template::adp_eval (public) template::adp_level template::adp_level (public) template::list::get_reference template::list::get_reference (public) template::list::get_url template::list::get_url (private) template::list::render template::list::render template::list::render->template::adp_compile template::list::render->template::adp_eval template::list::render->template::adp_level template::list::render->template::list::get_reference template::list::render->template::list::get_url

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

    # Creates the '_eval' columns and aggregates
    template::list::prepare_for_rendering -name $name

    # Get an upvar'd reference to list_properties
    get_reference -name $name

    # This gets and actually compiles the dynamic template into the template to use for the output
    # Thus, we need to do the dynamic columns above before this step
    set __adp_output [template -name $name -style $style]

    # set __adp_stub so includes work. Only fully qualified includes will work with this
    set __list_code {
        set __adp_stub ""
    }

    # compile the template (this is the second compilation, if we're using a dynamic template -- I think)
    append __list_code [template::adp_compile -string $__adp_output]

    # Paginator
    if { $list_properties(page_size_variable_p) == 1 } {
        template::util::list_to_multirow page_sizes {{name 10 value 10} {name 20 value 20} {name 50 value 50} {name 100 value 100}}
    }

    if { $list_properties(page_size) ne "" && $list_properties(page_size) != 0 } {

        set current_page $list_properties(filter,page)

        template::paginator get_display_info $list_properties(paginator_name) paginator $current_page

        # Set the URLs which the next/prev page/group links should point to
        foreach elm { next_page previous_page next_group previous_group } {
            if { [info exists paginator($elm)] && $paginator($elm) ne "" } {
                set paginator(${elm}_url) [get_url  -name $list_properties(name)  -override [list [list page $paginator($elm)]]]
            }
        }

        # LARS HACK:
        # Use this if you want to display the pages around the currently selected page,
        # with num_pages pages before and num_pages after the currently selected page.
        # This is an alternative to 'groups' of pages, and should eventually be built
        # into paginator, should we decide that this is a nicer way to do things
        # (I stole the idea from Google).
        # However, for now, it's just commented out with an if 0 ... block.
        if 0 {
            set num_pages 11
            set pages [list]
            for { set i [expr {$current_page - $num_pages}] } { $i < $current_page + $num_pages } { incr i } {
                if { $i > 0 && $i <= $paginator(page_count) } {
                    lappend pages $i
                }
            }
        }

        set pages [template::paginator get_pages  $list_properties(paginator_name)  $paginator(current_group)]

        template::paginator get_context  $list_properties(paginator_name)  paginator_pages  $pages

        # Add URL to the pages
        template::multirow -local extend paginator_pages url

        template::multirow -local foreach paginator_pages {
            set url [get_url -name $list_properties(name) -override [list [list page $page]]]
        }

        # LARS HACK:
        # This gets info for all the groups, in case you want to display all the groups available
        # We don't currently do this, so I've commented it out with an if 0 ... block
        if 0 {
            template::paginator get_context  $list_properties(paginator_name)  paginator_groups  [template::paginator get_groups activities $paginator(current_group) $list_properties(page_groupsize)]
        }
    }

    # Get the multirow upvar'd to this namespace
    template::multirow upvar $list_properties(multirow)

    # Upvar other variables passed in through the pass_properties property
    foreach var $list_properties(pass_properties) {
        upvar #$level $var $var
    }

    # evaluate the code and return the rendered HTML for the list
    set __output [template::adp_eval __list_code]

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