Index: openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl,v diff -u -N -r1.11 -r1.11.2.1 --- openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl 30 Jul 2003 04:56:41 -0000 1.11 +++ openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl 31 Jan 2004 11:12:21 -0000 1.11.2.1 @@ -122,11 +122,13 @@ ad_proc -public classified-ads::ads::get_assigned_ads_by_category { {-category_id ""} + {-limit 0} } { Gets all the ads assigned to a category (or all categories in a package.) @param category_id The system returns all ads mapped to these categories, or all ads if no category is passed. + @param limit The limit of rows to return. 0 means return all rows. @author Roberto Mello } { @@ -140,6 +142,12 @@ set category_id [classified-ads::categories::get_package_keyword_id] } + if { $limit == 0 } { + set limit_clause "" + } else { + set limit_clause "LIMIT $limit" + } + # # Get custom fields for this category. # @@ -159,10 +167,13 @@ ad_proc -public classified-ads::ads::get_unassigned_ads_by_category { {-category_id_list ""} + {-limit 0} } { Gets all the ads NOT assigned to the categories passed. - @param container_id_list A list of category ids. The system returns all ads not mapped to these categories. + @param container_id_list A list of category ids. The system returns all + ads not mapped to these categories. + @param limit The limit of rows to return. 0 means return all rows. } { # DEDS: FIXME - this uses a subselect. this will get inefficient @@ -175,6 +186,12 @@ set parent_id [classified-ads::get_folder_id -package_id [ad_conn package_id]] + if { $limit == 0 } { + set limit_clause "" + } else { + set limit_clause "LIMIT $limit" + } + return [db_list_of_ns_sets select_ads {}] }