- Publicity: Public Only All
list-procs.tcl
Procs for the list builder.
- Location:
- packages/acs-templating/tcl/list-procs.tcl
- Created:
- 2003-05-16
- Author:
- Lars Pind <lars@collaboraid.biz>
- CVS Identification:
$Id: list-procs.tcl,v 1.100 2024/11/06 12:59:29 antoniop Exp $
Procedures in this file
- template::list::create (public)
- template::list::csv_quote (public, deprecated)
- template::list::element::create (public)
- template::list::element::get_property (public)
- template::list::element::get_reference (public)
- template::list::element::get_refname (public)
- template::list::element::render (public)
- template::list::element::set_properties (public)
- template::list::element::set_property (public)
- template::list::element_select_clauses (public)
- template::list::element_where_clauses (public)
- template::list::filter::create (public)
- template::list::filter::exists_p (public)
- template::list::filter::get_property (public)
- template::list::filter::get_reference (public)
- template::list::filter::get_refname (public)
- template::list::filter::set_properties (public)
- template::list::filter::set_property (public)
- template::list::filter_from_clauses (public)
- template::list::filter_select_clauses (public)
- template::list::filter_where_clauses (public)
- template::list::format::create (public)
- template::list::from_clauses (public)
- template::list::get_reference (public)
- template::list::get_refname (public)
- template::list::get_rowcount (public)
- template::list::multirow_cols (public)
- template::list::orderby::create (public)
- template::list::orderby::get_property (public)
- template::list::orderby::get_reference (public)
- template::list::orderby::get_refname (public)
- template::list::orderby::set_properties (public)
- template::list::orderby::set_property (public)
- template::list::orderby_clause (public)
- template::list::page_get_ids (public)
- template::list::page_get_rowcount (public)
- template::list::page_where_clause (public)
- template::list::prepare (public)
- template::list::render (public)
- template::list::render_filters (public)
- template::list::set_elements_property (public)
- template::list::util_html_to_attributes_string (public)
- template::list::write_csv (public)
- template::list::write_output (public)
Detailed information
template::list::create (public)
template::list::create -name name [ -multirow multirow ] [ -key key ] \ [ -pass_properties pass_properties ] [ -actions actions ] \ [ -bulk_actions bulk_actions ] \ [ -bulk_action_method bulk_action_method ] \ [ -bulk_action_export_vars bulk_action_export_vars ] \ [ -selected_format selected_format ] [ -has_checkboxes ] \ [ -checkbox_name checkbox_name ] [ -orderby_name orderby_name ] \ [ -row_pretty_plural row_pretty_plural ] [ -no_data no_data ] \ [ -main_class main_class ] [ -sub_class sub_class ] \ [ -class class ] [ -html html ] [ -caption caption ] \ [ -page_size page_size ] \ [ -page_size_variable_p page_size_variable_p ] \ [ -page_groupsize page_groupsize ] [ -page_query page_query ] \ [ -page_query_name page_query_name ] \ [ -page_flush_p page_flush_p ] [ -ulevel ulevel ] \ -elements elements [ -filters filters ] [ -groupby groupby ] \ [ -orderby orderby ] [ -formats formats ] \ [ -filter_form filter_form ] \ [ -bulk_action_click_function bulk_action_click_function ] \ [ -aggregation_format aggregation_format ]
Defines a list to be displayed in a template. The list works in conjunction with a multirow, which contains the data for the list. The list is output using the <listtemplate> and <listfilters> templating tags, with the help of <listelement> and <listrow>.
Here's an example of a fairly simple standard list.
template::list::create -name order_lines -multirow order_lines -key item_id -actions [list "Add item" [export_vars -base item-add {order_id}] "Add item to this order"] -bulk_actions { "Remove" "item-remove" "Remove checked items" "Copy" "item-copy" "Copy checked items to clipboard" } -bulk_action_method post -bulk_action_export_vars { order_id } -row_pretty_plural "order items" -elements { quantity { label "Quantity" } item_id { label "Item" display_col item_name link_url_col item_url link_html { title "View this item" } } item_price { label "Price" display_eval {[lc_sepfmt $item_price]} } extended_price { label "Extended Price" display_eval {[lc_sepfmt [expr {$quantity $item_price}]]} } } db_multirow -extend { item_url } order_lines select_order_lines { select l.item_id, l.quantity, i.name as item_name, i.price as item_price from order_lines l, items i where l.order_id = :order_id and i.item_id = l.item_id } { set item_url [export_vars -base "item" { item_id }] }And the ADP template would include this:<listtemplate name="order_lines"></listtemplate>
- Switches:
- -name (required)
- The name of the list you want to build.
- -multirow (optional)
- The name of the multirow which you want to loop over. Defaults to name of the list.
- -key (optional)
- The name of the column holding the primary key/unique identifier for each row. Must be a single column, which must be present in the multirow. This switch is required to have bulk actions.
- -pass_properties (optional)
- A list of variables in the caller's namespace, which should be available to the display_template of elements.
- -actions (optional)
- A list of action buttons to display at the top of the list in the form (label1 url1 title1 label2 url2 title2 ...). The action button will be a simple link to the url.
- -bulk_actions (optional)
- A list of bulk action buttons, operating on the checked rows, to display at the bottom of the list. The format is (label1 url1 title1 label2 url2 title2 ...). A form will be submitted to the url, containing a list of the key values of the checked rows. For example, if 'key' is 'message_id', and rows with message_id 2 4 and 9 are checked, the page will get variables message_id=2&message_id=4&message_id=9. The receiving page should declare message_id:naturalnum,multiple in its ad_page_contract. Note that the 'message_id' local variable will the be a Tcl list.
- -bulk_action_method (optional, defaults to
"get"
)- should a bulk action be a "get" or "post"
- -bulk_action_export_vars (optional)
- A list of additional variables to pass to the receiving page, along with the other variables for the selected keys. This is typically useful if the rows in this list are all hanging off of one row in a parent table. For example, if this list contains the order lines of one particular order, and the primary key of the order lines table is 'order_id, item_id', the key would be 'item_id', and bulk_action_export_vars would be 'order_id', so together they constitute the primary key.
- -selected_format (optional)
- The currently selected display format. See the 'formats' option.
- -has_checkboxes (optional, boolean)
- Set this flag if your table already includes the checkboxes for the bulk actions. If not, and your list has bulk actions, we will add a checkbox column for you as the first column.
- -checkbox_name (optional, defaults to
"checkbox"
)- You can explicitly name the checkbox column here, so you can refer to it and place it where you want it when you specify display formats. Defaults to 'checkbox'. See the 'formats' option.
- -orderby_name (optional, defaults to
"orderby"
)- The page query variable name for the selected orderby is normally named 'orderby', but if you want to, you can override it here.
- -row_pretty_plural (optional, defaults to
"data"
)- The pretty name of the rows in plural. For example 'items' or 'forum postings'. This is used to auto-generate the 'no_data' message to say "No (row_pretty_plural)." Defaults to 'data'. See 'no_data' below.
- -no_data (optional)
- The message to display when the multirow has no rows. Defaults to 'No data.'.
- -main_class (optional, defaults to
"list-table"
)- The main CSS class to be used in the output. The CSS class is constructed by combining the main_class and the sub_class with a dash in between. E.g., main_class could be 'list', and sub_class could be 'narrow', in which case the resulting CSS class used would be 'list-narrow'.
- -sub_class (optional)
- The sub-part of the CSS class to use. See 'main_class' option.
- -class (optional)
- Alternatively, you can specify the CSS class directly. If specified, this overrides main_class/sub_class.
- -html (optional)
- HTML attributes to be output for the table tag, e.g. { align right style "background-color: yellow;" }. Value should be a Tcl list with { name value name value }
- -caption (optional)
- Caption tag that appears right below the table tag. Required for AA. Added 2/27/2007
- -page_size (optional)
- The number of rows to display on each page. If specified, the list will be paginated.
- -page_size_variable_p (optional, defaults to
"0"
)- Displays a selectbox to let the user change the number of rows to display on each page. If specified, the list will be paginated.
- -page_groupsize (optional, defaults to
"10"
)- The page group size for the paginator. See template::paginator::create for more details.
- -page_query (optional)
- The query to get the row IDs and contexts for the entire result set. See template::paginator::create for details.
- -page_query_name (optional)
- Alternatively, you can specify a query name. See template::paginator::create for details.
- -page_flush_p (optional, defaults to
"0"
)- -ulevel (optional, defaults to
"1"
)- The number of levels to uplevel when doing subst on values for elements, filters, groupbys, orderbys and formats below. Defaults to one level up, which means the caller of template::list::create's scope.
- -elements (required)
- The list elements (columns). The value should be an array-list of (element-name, spec) pairs, like in the example above. Each spec, in turn, is an array-list of property-name/value pairs, where the value is 'subst'ed in the caller's environment, except for the *_eval properties, which are 'subst'ed in the multirow context. See template::list::element::create for details.
- -filters (optional)
- Filters for the list. Typically used to slice the data, for example to see only rows by a particular user. Array-list of (filter-name, spec) pairs, like elements. Each spec, in turn, is an array-list of property-name/value pairs, where the value is 'subst'ed in the caller's environment, except for the *_eval properties, which are 'subst'ed in the multirow context. In order for filters to work, you have to specify them in your page's ad_page_contract, typically as filter_name:optional. The list builder will find them from there, by grabbing them from your page's local variables. See template::list::filter::create for details. filters are also the mechanism to export state variables which need to be preserved. If for example you needed user_id to be maintained for the filter and sorting links you would add -filters {user_id {}}
- -groupby (optional)
- Things you can group by, e.g. day, week, user, etc. Automatically creates a filter called 'groupby'. Single array-list of property-name/value pairs, where the value is 'subst'ed in the caller's environment. Groupby is really just a filter with a fixed name, so see above for more details. See template::list::filter::create for details.
- -orderby (optional)
- Things you can order by. You can also specify ordering directly in the elements. Automatically creates a filter called 'orderby'. Array-list of (orderby-name, spec) pairs, like elements. Each spec, in turn, is an array-list of property-name/value pairs, where the value is 'subst'ed in the caller's environment, except for the *_eval properties, which are 'subst'ed in the multirow context. If the name of your orderby is the same as the name of an element, that element's header will be made a link to sort by that column. See template::list::orderby::create for details.
- -formats (optional)
- If no formats are specified, a default format is created. Automatically creates a filter called 'format'. Array-list of (format-name, spec) pairs, like elements. Each spec, in turn, is an array-list of property-name/value pairs, where the value is 'subst'ed in the caller's environment. See template::list::format::create for details.
- -filter_form (optional, defaults to
"0"
)- Whether or not we create the form data structure for the listfilters-form tag to dynamically generate a form to specify filter criteria. Default 0 will not generate form. Set to 1 to generate form to use listfilters-form tag.
- -bulk_action_click_function (optional, defaults to
"acs_ListBulkActionClick"
)- JavaScript function name to call when bulk action buttons are clicked.
- -aggregation_format (optional)
- An option to format the result (number) of an aggregation operation. Default is empty string (result is not formatted). See the Tcl built-in command format for details on the different formatting options.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::csv_quote (public, deprecated)
template::list::csv_quote string
Deprecated. Invoking this procedure generates a warning.
Quote a string for inclusion as a csv element Obsolete when one uses tcllib csv package.
- Parameters:
- string (required)
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::create (public)
template::list::element::create -list_name list_name \ -element_name element_name -spec spec [ -ulevel ulevel ]
Adds an element to a list builder list.
This proc shouldn't be called directly, only through template::list::create.
These are the available properties in the spec:
- label: The label to use in the header.
- hide_p: 1 to hide the element from the default display, 0 (default) to show it.
- aggregate: Aggregate function to use on this column. Can be 'sum', 'average', or 'count'. The aggregate will be displayed at the bottom of the table. If groupby is used, aggregates for each group will also be displayed.
- aggregate_label: The label to use for the aggregate, e.g. "Total".
- aggregate_group_label: The label to use for the group aggregate, e.g. "Subtotal".
- html: HTML attributes to be output for the table element, e.g. { align right style "background-color: yellow;" }. Value should be a Tcl list with { name value name value }
- display_col: The column to display for this element, if not the column with the same name as the element.
- display_template: An ADP chunk used to display the element. This overrides all other display options. You can use @multirow_name.column_name@ to get values of the multirow, and you can directly use the variables specified in the 'pass_properties' argument to the template::list::create.
- display_template_name: theme-able template. If a display_template_name is specified, and a file with this name is available from the resource directory in the display_templates section, then take its countent as display_template. The resource directory is taken from the ResourceDir of the theme (parameter of acs-sub-site) or from the "resources" directory in acs-templating. The display_template_name acts similar to the query names in the database interface: When display_template_name is specified and the file is available, it overrules display_template, which acts as a default.
- link_url_col: Name of column in the multirow which contains the URL to which the cell contents should point. If either link_url_col or link_url_eval is specified, the cell's contents will be made a link to the specified URL, if that URL is nonempty.
- link_url_eval: A chunk of Tcl code which will be evaluated in the context of a template::multirow foreach looping over the dataset multirow, to return the URL to link this cell to. This means that it will have all the columns of the multirow available as local variables. Example: link_url_eval {[acs_community_member_url -user_id $creation_user]}.
- link_html: Attributes to be set on the <a> tag of the link generated as a result of link_url_col or link_url_eval. For example link_html { title "View this user" style "background-color: yellow;" }. Value should be a Tcl list with { name value name value }
- csv_col: The column to return in CSV output.
- sub_class: The second half of the CSS class name. Will be combined with the list's 'main_class' property to form the full CSS class name with a dash in-between, as in 'main-sub'.
- class: Alternatively, you can specify full class here, in which case this will override the sub_class property.
- orderby: The column to use in the order by clause of the query, when sorting by this column. Specifying either this, or 'orderby_asc' and 'orderby_desc' will cause the table's header to become a hyperlink to sort by that column.
- orderby_asc: If you want to be able to sort by this column, but sorting ascending and descending is not just a matter of appending 'asc' or 'desc', you can specify the asc and desc orderby clauses directly. This is useful when you're actually sorting by two database columns.
- orderby_desc: The reverse ordering from 'orderby_asc'.
- default_direction: The default order direction when ordering by this column, 'asc' or 'desc'.
- Switches:
- -list_name (required)
- Name of list.
- -element_name (required)
- Name of the element.
- -spec (required)
- The spec for this filter. This is an array list of property/value pairs, where the right hand side is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow.
- -ulevel (optional, defaults to
"1"
)- Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::get_property (public)
template::list::element::get_property -list_name list_name \ -element_name element_name -property property
- Switches:
- -list_name (required)
- -element_name (required)
- -property (required)
- Returns:
- the element property in the named list.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::get_reference (public)
template::list::element::get_reference -list_name list_name \ -element_name element_name [ -local_name local_name ] [ -create ]
upvar the list element to the callers scope as $local_name
- Switches:
- -list_name (required)
- -element_name (required)
- -local_name (optional, defaults to
"element_properties"
)- -create (optional, boolean)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::get_refname (public)
template::list::element::get_refname -list_name list_name \ -element_name element_name
- Switches:
- -list_name (required)
- -element_name (required)
- Returns:
- the name used for the list element properties array.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::render (public)
template::list::element::render -list_name list_name \ -element_name element_name
Returns an ADP chunk, which must be evaluated
- Switches:
- -list_name (required)
- -element_name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::set_properties (public)
template::list::element::set_properties -list_name list_name \ -element_name element_name -spec spec [ -ulevel ulevel ]
Set a list of properties in array get format for the given list template.
- Switches:
- -list_name (required)
- -element_name (required)
- -spec (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element::set_property (public)
template::list::element::set_property -list_name list_name \ -element_name element_name -property property -value value \ [ -ulevel ulevel ]
Set a property in the named list template.
- Switches:
- -list_name (required)
- -element_name (required)
- -property (required)
- -value (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element_select_clauses (public)
template::list::element_select_clauses -name name [ -comma ]
- Switches:
- -name (required)
- -comma (optional, boolean)
- Set this flag if you want the result to start with a ',' if the list of select clauses returned is nonempty.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::element_where_clauses (public)
template::list::element_where_clauses -name name [ -and ]
- Switches:
- -name (required)
- -and (optional, boolean)
- Set this flag if you want the result to start with an 'and' if the list of where clauses returned is nonempty.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::create (public)
template::list::filter::create -list_name list_name \ -filter_name filter_name -spec spec [ -ulevel ulevel ]
Adds a filter to a list builder list.
This proc shouldn't be called directly, only through template::list::create.
These are the available properties in the spec:
- label: The label of the filter.
- hide_p: Set to 1 to hide this filter from default rendering.
- type: The type of values this filter sets. Also see 'values' below. Valid options are: 'singleval', meaning that the value is a single value of a query variable with the name of the filter; 'multival', meaning the value is really a Tcl list of values, sent to a :multiple page variable; and 'multivar', meaning that the value is a list of (key value) lists, as in { { var1 value1 } { var2 value 2 } }. 'multival' is useful when you're filtering on, say, a date range, in which case you'd send two values, namely the start and end date. 'multivar' is useful when you want the selection of one filter to change the value of another filter, for example when selecting groupby, you also want to order by the grouped by column, otherwise the groupby won't work properly (you'll get a new group each time the value changes, but it's not sorted by that column, so you'll get more than one group per value over the entire list).
- add_url_eval: An expression which will be uplevel subst'ed with a magic variable __filter_value set to the value of the given filter.
- values: A list of lists of possible filter values, as in { { label1 value1 count1 } { label2 value2 count2 } ... }. The 'label' is what's displayed when showing the available filter values. 'value' is what changes filter values, and, depending on 'type' above, can either be a single value, a list of values, or a list of ( name value ) pairs. 'count' is optional, and is the number of rows that match the given filter value.
- has_default_p: If set to 1, it means that this filter has a default value, and thus cannot be cleared. If not set, the list builder will automatically provide a link to clear the currently selected value of this filter. You only need to set this if you specify a default value in your page's ad_page_contract, instead of through the 'default_value' property below.
- default_value: The default value to use when no value is selected for this filter. Automatically sets has_default_p to 1.
- where_clause: What should go in the where clause of your query when filtering on this filter. For example "l.project_id = :project_id".
- where_clause_eval: Same as where_clause, except this gets evaluated in the caller's context.
- other_label: If your values above do not carry all possible values, we can display a special 'other' value when some other value is selected for this filter. You specify here what label should be used for that element.
- form_element_properties: If you are using filter form, additional properties to override the form element declaration. Any valid form properties can be passed using the same names are template::element::create. A list of name value pairs.
In order for filters to work, you have to specify them in your page's ad_page_contract, typically as filter_name:optional. The list builder will find them from there, by grabbing them from your page's local variables.
- Switches:
- -list_name (required)
- Name of list.
- -filter_name (required)
- Name of the filter.
- -spec (required)
- The spec for this filter. This is an array list of property/value pairs, where the right hand side is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow.
- -ulevel (optional, defaults to
"1"
)- Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::exists_p (public)
template::list::filter::exists_p -list_name list_name \ -filter_name filter_name
Determine if a given filter exists for a given list template.
- Switches:
- -list_name (required)
- The name of the list template.
- -filter_name (required)
- The filter name.
- Returns:
- True (1) if the filter exists, false (0) if not.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::get_property (public)
template::list::filter::get_property -list_name list_name \ -filter_name filter_name -property property
Return a property from a given list and filter.
- Switches:
- -list_name (required)
- -filter_name (required)
- -property (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::get_reference (public)
template::list::filter::get_reference -list_name list_name \ -filter_name filter_name [ -local_name local_name ] [ -create ]
Build a reference to the given filter for the given list template.
- Switches:
- -list_name (required)
- -filter_name (required)
- -local_name (optional, defaults to
"filter_properties"
)- -create (optional, boolean)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::get_refname (public)
template::list::filter::get_refname -list_name list_name \ -filter_name filter_name
Build a canonical name from a list and filter name.
- Switches:
- -list_name (required)
- List name.
- -filter_name (required)
- Filter name.
- Returns:
- Canonical name built from list_name and filter_name.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::set_properties (public)
template::list::filter::set_properties -list_name list_name \ -filter_name filter_name -spec spec [ -ulevel ulevel ]
Set multiple properties for the given list and filter from a list in array get format.
- Switches:
- -list_name (required)
- -filter_name (required)
- -spec (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter::set_property (public)
template::list::filter::set_property -list_name list_name \ -filter_name filter_name -property property -value value \ [ -ulevel ulevel ]
Set a property for the given list and filter.
- Switches:
- -list_name (required)
- -filter_name (required)
- -property (required)
- -value (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter_from_clauses (public)
template::list::filter_from_clauses -name name [ -comma ]
- Switches:
- -name (required)
- -comma (optional, boolean)
- Set this flag if you want the result to start with an ',' if the list of from clauses returned is nonempty.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter_select_clauses (public)
template::list::filter_select_clauses -name name [ -comma ]
- Switches:
- -name (required)
- -comma (optional, boolean)
- Set this flag if you want the result to start with a ',' if the list of select clauses returned is nonempty.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::filter_where_clauses (public)
template::list::filter_where_clauses -name name [ -and ]
- Switches:
- -name (required)
- -and (optional, boolean)
- Set this flag if you want the result to start with an 'and' if the list of where clauses returned is nonempty.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::format::create (public)
template::list::format::create -list_name list_name \ -format_name format_name [ -selected_format selected_format ] \ -spec spec [ -ulevel ulevel ]
Adds a format to a list builder list.
This proc shouldn't be called directly, only through template::list::create.
These are the available properties in the spec:
- label: The label.
- layout: The layout, can be 'table' or 'list'.
- style: The name of the template to used to render this format. Defaults to the name of the layout, and can be overridden in the ADP file.
- output: Output format, can be either 'template' or 'csv'. If 'csv'. then the output is streamed directly to the browser and not through the templating system, but you have to call template::list::write_output from your page to make this work.
- page_size: The page size for this format. Leave blank to use the list's page size.
- elements: 'table' layout: An ordered list of elements to display in this format.
- row: 'table' layout: For more complex table layout, you can specify each row individually. The value is an array-list of ( element_name spec ) pairs. You can have more than one 'row' property, in which case your output table will have more than one HTML table row per row in the data set. In the 'spec' part of each element listed in the row, you can specify properties that override the properties defined in the -elements section of template::list::create, thus changing the label, link, display_col, etc.
- template: 'list' layout: An ADP chunk to be used for display of each row of the list. Use <listelement name="element_name"> to output a list element in your template.
- Switches:
- -list_name (required)
- Name of list.
- -format_name (required)
- Name of the format.
- -selected_format (optional)
- -spec (required)
- The spec for this format. This is an array list of property/value pairs, where the right hand side is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow.
- -ulevel (optional, defaults to
"1"
)- Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::from_clauses (public)
template::list::from_clauses -name name [ -comma ]
- Switches:
- -name (required)
- -comma (optional, boolean)
- Set this flag if you want the result to start with an ',' if the list of from clauses returned is nonempty.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::get_reference (public)
template::list::get_reference -name name [ -local_name local_name ] \ [ -create ]
Bind an upvar reference to a variable at the template parse level to a local variable, optionally giving an error message if it doesn't exist.
- Switches:
- -name (required)
- Name of the variable at the template parse level.
- -local_name (optional, defaults to
"list_properties"
)- Name of the local variable to bind the reference to, default "list_properties".
- -create (optional, boolean)
- Boolean which if true suppresses the "not found" error return, for instance when you're building the reference in order to create a new list.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::get_refname (public)
template::list::get_refname -name name
Return a canonical name for the given list template.
- Switches:
- -name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::get_rowcount (public)
template::list::get_rowcount -name name
Gets the full number of rows retrieved from this template::list. This number can exceed number_of_pages * rows_per_page. If list is not paginated, size of the multirow will be returned. Multirow must exist for count to succeed on a not paginated list.
- Switches:
- -name (required)
- Name of the list builder list for which you want the full number of rows.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::multirow_cols (public)
template::list::multirow_cols -name name
Get the list of columns to order by, if ordering in web server. Otherwise returns empty string.
- Switches:
- -name (required)
- List name
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby::create (public)
template::list::orderby::create -list_name list_name \ -orderby_name orderby_name -spec spec [ -ulevel ulevel ]
Adds an orderby to a list builder list.
This proc shouldn't be called directly, only through template::list::create.
These are the available properties in the spec:
It is difficult, but you can sort hierarchical queries.
- label: The label for the orderby.
- orderby: The column to use in the order by clause of the query. If it's not as simple as that, you can also specify 'orderby_asc' and 'orderby_desc' separately.
- orderby_asc: The orderby clause when sorting ascending. This is useful when you're actually sorting by two database columns.
- orderby_desc: The reverse ordering from 'orderby_asc'.
- orderby_name: The name of a named query, same functionality as orderby property.
- orderby_asc_name: The name of a named query, same functionality as orderby_asc property.
- orderby_desc_name: The name of a named query, same functionality as orderby_desc property.
- default_direction: The default order direction, 'asc' or 'desc'. Defaults to 'asc'.
- multirow_cols: If specified, we will sort the multirow in the webserver layer by the given cols.
- Switches:
- -list_name (required)
- Name of list.
- -orderby_name (required)
- Name of the orderby.
- -spec (required)
- The spec for this orderby. This is an array list of property/value pairs, where the right hand side is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow.
- -ulevel (optional, defaults to
"1"
)- Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby::get_property (public)
template::list::orderby::get_property -list_name list_name \ -orderby_name orderby_name -property property
Get a property from an orderby filter for a list template.
- Switches:
- -list_name (required)
- -orderby_name (required)
- -property (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby::get_reference (public)
template::list::orderby::get_reference -list_name list_name \ -orderby_name orderby_name [ -local_name local_name ] [ -create ]
Build a local reference to an orderby filter for a named list template.
- Switches:
- -list_name (required)
- -orderby_name (required)
- -local_name (optional, defaults to
"orderby_properties"
)- -create (optional, boolean)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby::get_refname (public)
template::list::orderby::get_refname -list_name list_name \ -orderby_name orderby_name
Build a canonical name from a list and orderby filter.
- Switches:
- -list_name (required)
- -orderby_name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby::set_properties (public)
template::list::orderby::set_properties -list_name list_name \ -orderby_name orderby_name -spec spec [ -ulevel ulevel ]
Set multiple properties for the given orderby filter in the given list template from a list in array get format.
- Switches:
- -list_name (required)
- -orderby_name (required)
- -spec (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby::set_property (public)
template::list::orderby::set_property -list_name list_name \ -orderby_name orderby_name -property property -value value \ [ -ulevel ulevel ]
Set a property for an orderby filter in the given list template.
- Switches:
- -list_name (required)
- -orderby_name (required)
- -property (required)
- -value (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::orderby_clause (public)
template::list::orderby_clause -name name [ -orderby ]
Get the order by clause for use in your DB query, or returns the empty string if not sorting in the DB.
- Switches:
- -name (required)
- List name
- -orderby (optional, boolean)
- If this is specified, this proc will also spit out the "order by" part, so it can be used directly in the query without saying 'order by' yourself.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::page_get_ids (public)
template::list::page_get_ids -name name [ -tcl_list ]
- Switches:
- -name (required)
- Name of the list builder list for which you want the IDs of the current page.
- -tcl_list (optional, boolean)
- Set this option if you want the IDs as a Tcl list. Otherwise, they'll be returned as a quoted SQL list, ready to be included in an "where foo_id in (...)" expression.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::page_get_rowcount (public)
template::list::page_get_rowcount -name name
Gets the number of rows across all pages in a paginated result set.
- Switches:
- -name (required)
- Name of the list builder list for which you want the number of rows in the result set.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::page_where_clause (public)
template::list::page_where_clause -name name [ -and ] [ -key key ]
- Switches:
- -name (required)
- -and (optional, boolean)
- Set this flag if you want the result to start with an 'and' if the list of where clauses returned is nonempty.
- -key (optional)
- Specify the name of the primary key to be used in the query's where clause, if different from the list builder's key.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::prepare (public)
template::list::prepare -name name [ -ulevel ulevel ]
Prepare list for rendering
- Switches:
- -name (required)
- -ulevel (optional, defaults to
"1"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::render (public)
template::list::render -name name [ -style style ]
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):
- Testcases:
- No testcase defined.
template::list::render_filters (public)
template::list::render_filters -name name [ -style style ]
Render template list filters
- Switches:
- -name (required)
- Name
- -style (optional)
- List filter style
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::set_elements_property (public)
template::list::set_elements_property -list_name list_name \ -element_names element_names -property property -value value
Sets a property on multiple list elements
- Switches:
- -list_name (required)
- Name of the list
- -element_names (required)
- List of element names
- -property (required)
- Which property to set
- -value (required)
- Value to set, all elements in element_names get this value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::util_html_to_attributes_string (public)
template::list::util_html_to_attributes_string html \ [ default_summary_p ]
Takes a list in array get format and builds HTML attributes from them.
- Parameters:
- html (required)
- A misnomer? The input isn't HTML, the output is HTML.
- default_summary_p (optional, defaults to
"0"
)- Include a default summary if one does not exist
- Returns:
- HTML attributes built from the list in array get format 2/28/2007 - Project Zen - Modifying to handle a default value for summary if default_summary_p = 1
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::write_csv (public)
template::list::write_csv -name name [ -label_headers ] \ [ -delimiter delimiter ]
Writes a CSV to the connection
- Switches:
- -name (required)
- template::list name
- -label_headers (optional, boolean, defaults to
"true"
)- -delimiter (optional, defaults to
","
)- CSV delimiter
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::list::write_output (public)
template::list::write_output -name name
Writes the output to the connection if output isn't set to template. Will automatically issue an ad_script_abort, if the output has been written directly to the connection instead of through the templating system.
- Switches:
- -name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.