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 -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl 18 Jul 2003 02:47:33 -0000 1.2 @@ -105,18 +105,29 @@ } { Gets all the ads assigned to categories - @param category_id_list A list of category ids. The system returns all ads mapped to these categories. + @param category_id_list A list of category ids. + The system returns all ads mapped to these categories, or + all ads if no category is passed. } { # DEDS: FIXME - this uses a subselect. this will get inefficient # when faced with a large db. optimize this. + # + # RBM: I think Deds was referring to the IN clause. It will get + # slow if there are lots of items in the list, but that + # doesn't seem to be the case. I made a small optimization + # to use 'and keyword_id = x' when opnly one category is + # passed. + set condition_stub "" + set n_categories [llength $category_id_list] - if {[llength $category_id_list]} { + if { $n_categories == 1 } { + set condition_stub "and keyword_id = [lindex $category_id_list 0]" + } elseif { $n_categories > 1 } { set condition_stub "and keyword_id in ([join $category_id_list ", "])" } set parent_id [classified-ads::get_folder_id -package_id [ad_conn package_id]] - return [db_list_of_ns_sets select_ads {}] } Index: openacs-4/contrib/packages/classified-ads/tcl/ads-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/ads-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/tcl/ads-procs.xql 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/tcl/ads-procs.xql 18 Jul 2003 02:47:33 -0000 1.2 @@ -7,7 +7,8 @@ select cm.keyword_id, ci.item_id, - cr.title + cr.title, + to_char(cr.publish_date, 'Mon DD, YYYY') as pretty_publish_date from cr_item_keyword_map cm, cr_revisions cr, cr_items ci @@ -27,7 +28,8 @@ select ci.item_id, - cr.title + cr.title, + to_char(cr.publish_date, 'Mon DD, YYYY') as pretty_publish_date from cr_revisions cr, cr_items ci where ci.item_id not in (select item_id Index: openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl 18 Jul 2003 02:47:33 -0000 1.2 @@ -3,13 +3,29 @@ Create a Classified Ads Ad @author Deds Castillo (deds@infiniteinfo.com) + @modified-by Roberto Mello (rmello@fslc.usu.edu) @creation-date 2002-10-08 @cvs-id $Id$ } { + {keyword_id:integer,optional} {return_url "ads"} } +if {![info exists keyword_id]} { + set package_category_id [classified-ads::categories::package_category_exists_p] + set keyword_id $package_category_id + set title "Place New Ad (no category)" +} elseif {[string equal [classified-ads::main_keyword_exists_p] $keyword_id]} { + ad_return_complaint 1 "
  • No access to the root id" + ad_script_abort +} else { + # Select info for this category + classified-ads::categories::get -keyword_id $keyword_id -array category_info + set category_heading $category_info(heading) + set title "Place New $category_heading Ad" +} + form create ad element create ad ad_id \ @@ -23,6 +39,12 @@ -widget hidden \ -value $return_url +element create ad keyword_id \ + -label "keyword id" \ + -datatype text \ + -widget hidden \ + -value $keyword_id + element create ad title \ -label "Title" \ -datatype text \ @@ -48,7 +70,10 @@ if {[form is_valid ad]} { - set ad_id [classified-ads::ads::new -item_id_element ad_id -form_id ad] + set ad_id [classified-ads::ads::new \ + -item_id_element ad_id \ + -form_id ad \ + -category_id $keyword_id] template::form get_values ad \ return_url @@ -63,7 +88,6 @@ element set_properties ad ad_id -value $ad_id } -set title "Create New" set context [list [list "ads" "Ads"] $title] ad_return_template Index: openacs-4/contrib/packages/classified-ads/www/admin/categories.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/categories.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/classified-ads/www/admin/categories.adp 17 Jul 2003 23:11:35 -0000 1.2 +++ openacs-4/contrib/packages/classified-ads/www/admin/categories.adp 18 Jul 2003 02:47:33 -0000 1.3 @@ -51,29 +51,85 @@ - - -

    Ads under this Category

    - -
    - -

    Ads not assigned to any Category

    -
      - -
    • @unassigned_ads.title@ - -
    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Ads Under This Category (place new) + +
    TitlePublished onAction
    +  @assigned_ads.title@ + +  @assigned_ads.pretty_publish_date@ + + Remove +
    + No ads assigned to this category. +
    + Ads Not Assigned to Any Category + +
    TitlePublished onAction
    +  @unassigned_ads.title@ + +  @unassigned_ads.pretty_publish_date@ + + Assign +
    + No unassigned ads. +
    + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/classified-ads/www/admin/category-assign-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/classified-ads/www/admin/category-assign.adp'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/classified-ads/www/admin/category-assign.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/category-assign.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/admin/category-assign.tcl 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/admin/category-assign.tcl 18 Jul 2003 02:47:33 -0000 1.2 @@ -1,22 +1,17 @@ ad_page_contract { Classified Ads Administration + Assign a specific ad to a category. @author Deds Castillo (deds@infiniteinfo.com) @creation-date 2002-10-08 @cvs-id $Id$ } { {keyword_id:notnull,integer} + {item_id:notnull,integer} } -template::util::list_of_ns_sets_to_multirow \ - -rows [classified-ads::ads::get_unassigned_ads_by_category -category_id_list [list $keyword_id]] \ - -var_name unassigned_ads +classified-ads::categories::item_assign -keyword_id $keyword_id -item_id $item_id -set title "Assign an Ad" -set context [classified-ads::categories::generate_trail -keyword_id $keyword_id -append_element $title] - -set context_bar [eval classified-ads::context_bar $context] - -ad_return_template +ad_returnredirect "categories?keyword_id=$keyword_id" Index: openacs-4/contrib/packages/classified-ads/www/doc/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/doc/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/doc/index.adp 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/doc/index.adp 18 Jul 2003 02:47:33 -0000 1.2 @@ -45,7 +45,7 @@
  • Add searching functionality.
  • Integrate with notifications so users can be notified of new ads.
  • Integrate with RSS so news aggregators can pick up new items (crazy idea? -Roberto) -
  • Check validation code for custom items. Seems not to be working.
  • Give users a confirmation screen when placing new ads. +
  • Better admin user interface, especially for managing categories (DONE - Roberto)