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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/admin/categories.adp 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/admin/categories.adp 17 Jul 2003 23:11:35 -0000 1.2 @@ -2,18 +2,56 @@ @title@ @context@ + +

Categories

+

-

+ Create a new + + top-level category + + subcategory + +

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

Ads under this Category

-
\ No newline at end of file + Index: openacs-4/contrib/packages/classified-ads/www/admin/categories.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/categories.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/admin/categories.tcl 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/admin/categories.tcl 17 Jul 2003 23:11:35 -0000 1.2 @@ -13,13 +13,18 @@ set root_folder_id [classified-ads::get_root_folder_id] set package_category_id [classified-ads::categories::package_category_exists_p] set package_category_p 0 +set title "Categories" if {[empty_string_p $keyword_id]} { set keyword_id $package_category_id set package_category_p 1 } elseif {[string equal [classified-ads::main_keyword_exists_p] $keyword_id]} { - ad_return_complaint 1 "
  • no access to the root 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 title $category_info(heading) } db_multirow categories select_categories {} @@ -33,8 +38,6 @@ -var_name assigned_ads set return_url "[ad_conn url]?[ad_conn query]" - -set title "Categories" set context [classified-ads::categories::generate_trail -keyword_id $keyword_id] ad_return_template Index: openacs-4/contrib/packages/classified-ads/www/admin/category-assign.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/Attic/category-assign.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/admin/category-assign.adp 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/admin/category-assign.adp 17 Jul 2003 23:11:35 -0000 1.2 @@ -1,7 +1,6 @@ @title@ @context@ -@context_bar@

    @@ -11,4 +10,4 @@

  • [assign] @unassigned_ads.title@ - \ No newline at end of file + Index: openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl 17 Jul 2003 23:11:35 -0000 1.2 @@ -11,65 +11,35 @@ {return_url "categories"} } -form create category +ad_form -name category -form { + keyword_id:key + {parent_id:integer(hidden) {label "Parent ID"} + {value $parent_id} } + {return_url:text(hidden) {label "Return URL"} + {value $return_url} } + {heading:text(text) {label "Category"} + {html {size 60} {maxlength 6000}} } + {description:text(textarea) {label "Description"} + {optional} + {html {cols 60 rows 10 wrap soft}} } +} -new_data { + if {[catch {set keyword_id \ + [classified-ads::categories::new -keyword_id $keyword_id \ + -heading $heading \ + -parent_id $parent_id \ + -description $description \ + ]} errmsg] + } { + ad_return_error "Problems processing this page" \ + "We had problems processing this page. Administration has been notified" + ad_script_abort + } -element create category keyword_id \ - -label "Keyword ID" \ - -datatype integer \ - -widget hidden - -element create category parent_id \ - -label "Parent ID" \ - -datatype integer \ - -widget hidden - -element create category return_url \ - -label "Return URL" \ - -datatype text \ - -widget hidden \ - -value $return_url - -element create category heading \ - -label "Category" \ - -datatype text \ - -widget text \ - -html {size 60} {maxlength 600} - -element create category description \ - -label "Description" \ - -datatype text \ - -widget textarea \ - -html {cols 60 rows 10 wrap soft} \ - -optional - -if {[form is_valid category]} { - template::form get_values category \ - keyword_id parent_id return_url heading description - - if {[catch {set keyword_id [classified-ads::categories::new -keyword_id $keyword_id \ - -heading $heading \ - -parent_id $parent_id \ - -description $description \ - ]} errmsg] - } { - # DEDS: FIXME - do this better via select and compare of keyword id - # double click protection - ad_return_complaint 1 "
  • you probably clicked the submit button more than once" - ad_script_abort - } - - ad_returnredirect $return_url - ad_script_abort + ad_returnredirect $return_url + ad_script_abort } -if { [form is_request category] } { - # Pre-fetch the keyword_id - set keyword_id [db_nextval acs_object_id_seq] - element set_properties category keyword_id -value $keyword_id - element set_properties category parent_id -value $parent_id -} - -set title "Create" +set title "Create Category" set context [classified-ads::categories::generate_trail -keyword_id $parent_id -append_element $title] ad_return_template