Index: openacs-4/contrib/packages/classified-ads/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/index.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/contrib/packages/classified-ads/www/index.adp 26 Jan 2004 15:39:39 -0000 1.2 +++ openacs-4/contrib/packages/classified-ads/www/index.adp 26 Feb 2004 15:14:56 -0000 1.3 @@ -1,135 +1,19 @@ -@title@ -@context@ +@title;noquote@ +@context;noquote@ - -

- Create a new top-level category -

- - - - - - - - -
- - Categories - -
- - - - - - - - - - - - - - - - - - -
NameSubcategoriesAction
-  @categories.heading@ - - @categories.children_count@ - - edit - -  | delete - -
-
- +

+ +

+

+

Categories

+

+

+ +

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 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. -
+
+ Index: openacs-4/contrib/packages/classified-ads/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/index.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/contrib/packages/classified-ads/www/index.tcl 26 Jan 2004 15:39:39 -0000 1.6 +++ openacs-4/contrib/packages/classified-ads/www/index.tcl 26 Feb 2004 15:14:56 -0000 1.7 @@ -15,44 +15,99 @@ set root_folder_id [classified-ads::get_root_folder_id] set package_category_id [classified-ads::categories::get_package_keyword_id] set package_category_p 0 -set title "Categories" +set package_id [ad_conn package_id] +set title "Most Recent Ads" +# RBM: FIXME: Remove "50" hard-coded number +set ads_to_display 50 if {$keyword_id == 0} { + # + # If no category was selected, let's use the main package category + # set keyword_id $package_category_id set package_category_p 1 + set ads_to_display [parameter::get -package_id $package_id -parameter ads_to_display] + set actions "" + + # + # Now get categories. + # RBM: FIXME: This query seems inneficient. + # FIXME: Bulk actions according to permissions. + # + db_multirow categories select_categories {} + set parent_id $keyword_id + + template::list::create \ + -name categories \ + -multirow categories \ + -key keyword_id \ + -actions [list "Create top-level category" \ + [export_vars -base admin/category-new {parent_id return_url}] \ + "Create category"] \ + -bulk_actions { + "Edit" "admin/category-edit" "Edit checked categories" + "Delete" "admin/category-delete" "Delete checked categories" + } \ + -bulk_action_export_vars { + keyword_id + return_url + } \ + -row_pretty_plural "Categories" \ + -elements { + heading { + label "Name" + link_url_eval "index?keyword_id=$keyword_id" + link_html { title "View ads under this category" } + } + description { + label "Description" + link_url_eval "index?keyword_id=$keyword_id" + link_html { title "View ads under this category" } + } + children_count { + label "Number of subcategories" + } + } + } elseif {[string equal [classified-ads::get_main_keyword_id] $keyword_id]} { + # + # If the selected category is the top-level keyword_id, throw error + # ad_return_complaint 1 "
  • No access to the root id" ad_script_abort + } else { - # Select info for this category + # + # Select info for the selected category + # classified-ads::categories::get -keyword_id $keyword_id -array category_info set title $category_info(heading) + set actions [list "Place Ad" [export_vars -base ad-one {keyword_id}] "Place an Ad"] } +# RBM: FIXME - How should we deal with "unassigned" ads? +# +#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 + # # Get custom fields and set to be the list-builder spec # set custom_fields_list [util_memoize "classified-ads::categories::get_custom_fields -keyword_id $keyword_id"] -set list_builder_spec "" -foreach field $custom_fields_list { - append list_builder_spec "\t[lindex $field 0] { - label \"[lindex $field 1]\" - }" -} - -db_multirow categories select_categories {} - template::util::list_of_ns_sets_to_multirow \ - -rows [classified-ads::ads::get_assigned_ads_by_category -category_id $keyword_id] \ + -rows [classified-ads::ads::get_assigned_ads_by_category \ + -category_id $keyword_id \ + -limit $ads_to_display] \ -var_name assigned_ads template::list::create \ -name assigned_ads \ -multirow assigned_ads \ -key ad_id \ - -actions [list "Place Ad" [export_vars -base ad-one {keyword_id}] "Place an Ad"] \ + -actions $actions \ -row_pretty_plural "Ads" \ -elements { title { @@ -63,6 +118,9 @@ link_url_eval "ad-one?ad_id=$item_id" link_html { title "View this ad" } } + pretty_publish_date { + label "Date Posted" + } } set return_url "[ad_conn url]?[ad_conn query]" 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 -N -r1.5 -r1.6 --- openacs-4/contrib/packages/classified-ads/www/doc/index.adp 25 Jul 2003 02:42:45 -0000 1.5 +++ openacs-4/contrib/packages/classified-ads/www/doc/index.adp 26 Feb 2004 15:14:57 -0000 1.6 @@ -1,11 +1,11 @@ -Classified Ads -{Classified Ads Documentation} +Classified Ads +{Classified Ads Documentation}

    Overview

    -Authors: Deds Castillo and Paul Doerwalds. Roberto Mello made some modifications - and improvements and is now (July 2003) maintaining this package under OpenACS. +Authors: Deds Castillo and Paul Doerwalds. Roberto Mello made several modifications + and improvements and is maintaining this package under OpenACS since July 2003.

    The Classified Ads system can be used for all manner of ads, from buy/sell to wanted to job listings. If one party has something another party wants or vice versa, the Classified Ads system can be used as the basis. @@ -20,11 +20,21 @@

    For Rent -> Apartment Buildings -> 319 Hazel St. -> Unit 205
    -
    Job Listings -> 
     
    -

    More coming here later.

    +

    By Roberto Mello:

    +

    + The package is taking shape, with almost all of the truly hard parts + done. I'm now working on improving the interface, user and administrative. +

    + +

    + While developing I was creating everything under www/admin. That's why it + seems that nothing is "done" under www (the user pages). I am going to move + th funcionality under www/admin under /lib so it can be reused in both places. +

    +

    Features

      @@ -35,25 +45,32 @@
    • Others that I'm probably forgetting.
    -

    What needs to be improved

    +

    What needs to be improved (no particular order)

      -
    • Make it possible to place an ad under a category, instead of placing - under no category then assigning it to one. (DONE - Roberto)
    • Fix all the FIXME's in the code.
    • -
    • Give users a better UI for placing and viewing ads (DONE - Roberto)
    • 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)
    • Give users a confirmation screen when placing new ads. -
    • Main index page shows last x placed ads. -
    • Category index page shows last x placed ads. Select box with all subcategories and +
    • Convert to use list-builder. (index page done) +
    • Category index page shows user-selected number of ads. +
    • Category index page: Select box with all subcategories and number of ads in them. Notifications link. Table on the right shows available actions (Search, Post, Edit/Delete Your Posts, Get E-mail Alerts, New Since Last Visit).
    • general-comments integration. -
    • Make it so custom fields can be added on a per-category basis (DONE - Roberto).
    • general-ratings for users (for the future).
    • Uploading of images with parameter to allow/disallow. +
    • DONE Items: (by done I don't mean it can't be improved, I'm just keeping track + of major things I've done) +
    • Give users a better UI for placing and viewing ads (DONE - Roberto) - + Need to move code that is in /admin to /lib so it can be used in both + www and www/admin. +
    • Make it possible to place an ad under a category, instead of placing + under no category then assigning it to one. (DONE - Roberto)
    • +
    • Main index page shows last x placed ads (DONE - Roberto) +
    • Make it so custom fields can be added on a per-category basis (DONE - Roberto). +
    • Fix data model (DONE (I hope) - Roberto)
      Admin UI: