Index: openacs-4/packages/acs-templating/resources/lists/table.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/resources/lists/table.adp,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-templating/resources/lists/table.adp 23 Mar 2005 22:21:23 -0000 1.16 +++ openacs-4/packages/acs-templating/resources/lists/table.adp 21 Apr 2005 17:13:19 -0000 1.17 @@ -1,20 +1,10 @@ - - -
-
- - - - @list_properties.bulk_action_export_chunk;noquote@ -
- - + + +
+
+ + + + @list_properties.bulk_action_export_chunk;noquote@ +
+ + + + + + + Index: openacs-4/packages/acs-templating/tcl/list-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/list-procs.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/acs-templating/tcl/list-procs.tcl 27 Feb 2005 22:45:40 -0000 1.24 +++ openacs-4/packages/acs-templating/tcl/list-procs.tcl 21 Apr 2005 17:13:20 -0000 1.25 @@ -40,6 +40,7 @@ {-class ""} {-html ""} {-page_size ""} + {-page_size_variable_p 0} {-page_groupsize 10} {-page_query ""} {-page_query_name ""} @@ -177,6 +178,8 @@ @param page_size The number of rows to display on each page. If specified, the list will be paginated. + @param page_size_variable_p Displays a selectbox to let the user change the number of rows to display on each page. If specified, the list will be paginated. + @param page_groupsize The page group size for the paginator. See template::paginator::create for more details. @@ -241,6 +244,7 @@ multirow {} style {} page_size {} + page_size_variable_p {} page_groupsize {} page_query {} page_query_name {} @@ -276,6 +280,8 @@ ulevel {} output {} bulk_action_export_chunk {} + page_size_export_chunk {} + url {} } # Set default for no_data @@ -417,7 +423,15 @@ } # Pagination - if { ![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0 } { + if { $list_properties(page_size_variable_p) == 1 } { + # Create a filter for the variable page size + template::list::filter::create \ + -list_name $name \ + -filter_name "page_size" \ + -spec [list label "Page Size" default_value 20 hide_p t] + } + + if { (![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0) || $list_properties(page_size_variable_p) == 1 } { # Check that we have either page_query or page_query_name if { [empty_string_p $list_properties(page_query)] && [empty_string_p $list_properties(page_query_name)] } { error "When specifying a non-zero page_size, you must also provide either page_query or page_query_name" @@ -492,6 +506,12 @@ } # Create the paginator + if { $list_properties(page_size_variable_p) == 1 } { + set list_properties(page_size) $list_properties(filter,page_size) + set list_properties(url) [ad_conn url] + set list_properties(page_size_export_chunk) [uplevel $list_properties(ulevel) [list export_vars -form -exclude {page_size page} $list_properties(filters_export)]] + } + if { ![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0 } { if { [string equal $list_properties(page_query) ""] } { @@ -1078,6 +1098,10 @@ set __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 20 value 20} {name 50 value 50} {name 100 value 100}} + } + if { ![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0 } { set current_page $list_properties(filter,page)
+ + + +
<< @@ -54,12 +44,35 @@ >> - + + @list_properties.page_size_export_chunk;noquote@ + + + + +
@@ -193,6 +206,69 @@ + + + +
+ + + << + + + << + + + +  <  + + +  <  + + + + +   \@paginator_pages.page@ + + +   \@paginator_pages.page@ + + + + +  >  + + +  >  + + + + >> + + + >> + + + + + + + @list_properties.page_size_export_chunk;noquote@ + + + + +