Index: openacs-4/packages/ecommerce/www/admin/products/list-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/list-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/admin/products/list-oracle.xql 10 Jul 2001 20:33:53 -0000 1.1 +++ openacs-4/packages/ecommerce/www/admin/products/list-oracle.xql 14 Aug 2008 10:53:42 -0000 1.2 @@ -3,14 +3,31 @@ oracle8.1.6 + + + select count(*) as product_count +from ec_products ep, ec_items_reportable eir, ec_product_comments epc +where ep.product_id = eir.product_id(+) +and ep.product_id = epc.product_id(+) $category_exclusion_clause + + + + select r.* + from ( + select rownum as r_rownum, q.* + from ( select ep.product_id, ep.product_name, ep.available_date, count(distinct eir.item_id) as n_items_ordered, count(distinct epc.comment_id) as n_comments from ec_products ep, ec_items_reportable eir, ec_product_comments epc where ep.product_id = eir.product_id(+) and ep.product_id = epc.product_id(+) $category_exclusion_clause group by ep.product_id, ep.product_name, ep.available_date $order_by_clause + ) q + ) r + where r_rownum > :start_row + and r_rownum <= :start_row + :how_many Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ecommerce/www/admin/products/list-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/ecommerce/www/admin/products/list.adp'. Fisheye: No comparison available. Pass `N' to diff? 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 "|" +} + Index: openacs-4/packages/ecommerce/www/admin/products/list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/list.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ecommerce/www/admin/products/list.xql 8 Mar 2004 19:46:14 -0000 1.2 +++ openacs-4/packages/ecommerce/www/admin/products/list.xql 14 Aug 2008 10:53:42 -0000 1.3 @@ -6,21 +6,5 @@ select category_name from ec_categories where category_id = :category_id - - - - -select ep.product_id, ep.product_name, ep.available_date, count(distinct eir.item_id) as n_items_ordered, count(distinct epc.comment_id) as n_comments -from ec_products ep - LEFT JOIN ec_items_reportable eir using (product_id) - LEFT JOIN ec_product_comments epc on (ep.product_id = epc.product_id) -group by ep.product_id, ep.product_name, ep.available_date -$category_exclusion_clause -$order_by_clause - - - - -