Index: openacs-4/packages/ecommerce/www/admin/products/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/list.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/ecommerce/www/admin/products/list.tcl 9 Mar 2004 00:59:51 -0000 1.5 +++ openacs-4/packages/ecommerce/www/admin/products/list.tcl 11 Jun 2005 10:18:20 -0000 1.5.2.1 @@ -1,14 +1,19 @@ # www/[ec_url_concat [ec_url] /admin]/products/list.tcl ad_page_contract { - Lists a class of products, ordered to the user's taste. + Lists a class of products, ordered to the user's taste. - @author Philip Greenspun (philg@mit.edu) - @creation-date July 18, 1999 - @cvs-id $Id$ - @author ported by Jerry Asher (jerry@theashergroup.com) + @param how_many How many products to display on the page + @param start_row Where to begin from + + @author Philip Greenspun (philg@mit.edu) + @creation-date July 18, 1999 + @cvs-id $Id$ + @author ported by Jerry Asher (jerry@theashergroup.com) } { - category_id:integer,notnull,optional - order_by:optional + category_id:integer,notnull,optional + order_by:optional + {how_many:naturalnum {[ad_parameter -package_id [ec_id] ProductsToDisplayPerPage ecommerce]}} + {start_row:naturalnum "0"} } ad_require_permission [ad_conn package_id] admin @@ -40,38 +45,67 @@ set ordering_options "sales | name | age | comments" } -doc_body_append "[ad_admin_header $title] +append title ", order by $ordering_options" +set context_bar [ad_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index.tcl" "Products"] $title] -

$title

-[ad_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index.tcl" "Products"] $title] -
+set list_items "" -order by $ordering_options +set have_how_many_more_p f +set count $start_row - +if { $start_row >= $how_many } { + set prev_link "Previous $how_many" +} else { + set prev_link "" +} -[ad_admin_footer] -" +if { $have_how_many_more_p == "t" } { + set next_link "Next $how_many" +} else { + set number_of_remaining_products [expr $product_count - $start_row - $how_many] + if { $number_of_remaining_products > 0 } { + set next_link "Next $number_of_remaining_products" + } else { + set next_link "" + } +} + +if { [empty_string_p $next_link] || [empty_string_p $prev_link] } { + set separator "" +} else { + set separator "|" +} +