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.6 --- 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 14 Aug 2008 10:53:42 -0000 1.6 @@ -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 @@ -27,51 +32,89 @@ if { ![info exists order_by] || [empty_string_p $order_by] || $order_by == "name"} { set order_by_clause "order by upper(product_name)" - set ordering_options "sales | name | age | comments" + set ordering_options "sales | name | age | comments | last modified" } elseif { $order_by == "sales" } { set order_by_clause "order by n_items_ordered desc" - set ordering_options "sales | name | age | comments" + set ordering_options "sales | name | age | comments | last modified" } elseif { $order_by == "comments" } { set order_by_clause "order by n_comments desc" - set ordering_options "sales | name | age | comments" + set ordering_options "sales | name | age | comments | last modified" +} elseif { $order_by == "last_edit_date" } { + set order_by_clause "order by last_modified desc" + set ordering_options "sales | name | age | comments | last modified" } else { # must be age set order_by_clause "order by available_date desc" - set ordering_options "sales | name | age | comments" + set ordering_options "sales | name | age | comments | last modified" } -doc_body_append "[ad_admin_header $title] +set header " order by $ordering_options" +set context [list [list index 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 "|" +} +