Index: openacs-4/contrib/packages/classified-ads/classified-ads.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/classified-ads.info,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/classified-ads/classified-ads.info 16 Jul 2003 04:52:31 -0000 1.1
+++ openacs-4/contrib/packages/classified-ads/classified-ads.info 18 Jul 2003 03:16:49 -0000 1.2
@@ -6,114 +6,23 @@
Classified Ads
f
f
-
-
-
- oracle
- postgresql
-
+
+
+ Roberto Mello
Deds Castillo
Classified Ads Package
+ 2003-07-17
Infiniteinfo
- This package implements a generic classified ads module using the content repository.
+ This package implements a generic classified ads module using the content repository. It features categorization, adding of custom fields, etc.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
Index: openacs-4/contrib/packages/classified-ads/www/ad-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/ad-new.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/classified-ads/www/ad-new.tcl 16 Jul 2003 04:52:32 -0000 1.1
+++ openacs-4/contrib/packages/classified-ads/www/ad-new.tcl 18 Jul 2003 03:16:49 -0000 1.2
@@ -3,78 +3,58 @@
Create a Classified Ads Ad
@author Deds Castillo (deds@infiniteinfo.com)
- @author Roberto Mello (rmello@fslc.usu.edu)
- @creation-date 2003-01-15
+ @modified-by Roberto Mello (rmello@fslc.usu.edu)
+ @creation-date 2002-10-08
@cvs-id $Id$
} {
- keyword_id:integer
+ {keyword_id:integer,optional}
{return_url "one-category"}
}
-form create ad
+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"
+}
-element create ad ad_id \
- -label "Ad ID" \
- -datatype integer \
- -widget hidden
+ad_form -name ad -form {
+ ad_id:key
+ {return_url:text(hidden) {label "return url"}
+ {value $return_url} }
+ {keyword_id:integer(hidden) {label "Keyword ID"}
+ {value $keyword_id} }
+ {title:text(text) {label "Title"}
+ {html {size 60} {maxlength 1000}} }
+ {description:text(textarea) {label "Short Description"}
+ {optional}
+ {html {cols 60 rows 3 wrap soft}} }
+ {data:text(textarea) {label "Content"}
+ {optional}
+ {html {cols 60 rows 10 wrap soft}} }
+} -new_data {
+ set ad_id [classified-ads::ads::new \
+ -item_id_element ad_id \
+ -form_id ad \
+ -category_id $keyword_id]
-element create ad return_url \
- -label "Return URL" \
- -datatype text \
- -widget hidden \
- -value $return_url
+ template::form get_values ad 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 \
- -widget text \
- -html {size 60 maxlength 1000}
+ ad_returnredirect $return_url
+ ad_script_abort
+}
-element create ad description \
- -label "Description" \
- -datatype text \
- -widget textarea \
- -html {cols 60 rows 10 wrap soft} \
- -optional
-
-element create ad data \
- -label "Content" \
- -datatype text \
- -widget textarea \
- -html {cols 60 rows 10 wrap soft} \
- -optional
-
+# Get extra custom widgets, if any
classified-ads::widgets::get_widget_params -content_type "ca_ad" -form_id ad
-
-if {[form is_valid 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
-
- ad_returnredirect "$return_url?keyword_id=$keyword_id"
- ad_script_abort
-}
-
-if { [form is_request ad] } {
- # Pre-fetch the ad_id
- set ad_id [db_nextval acs_object_id_seq]
- 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/ad-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl 18 Jul 2003 02:47:33 -0000 1.2
+++ openacs-4/contrib/packages/classified-ads/www/admin/ad-new.tcl 18 Jul 2003 03:16:49 -0000 1.3
@@ -26,68 +26,35 @@
set title "Place New $category_heading Ad"
}
-form create ad
+ad_form -name ad -form {
+ ad_id:key
+ {return_url:text(hidden) {label "return url"}
+ {value $return_url} }
+ {keyword_id:integer(hidden) {label "Keyword ID"}
+ {value $keyword_id} }
+ {title:text(text) {label "Title"}
+ {html {size 60} {maxlength 1000}} }
+ {description:text(textarea) {label "Short Description"}
+ {optional}
+ {html {cols 60 rows 3 wrap soft}} }
+ {data:text(textarea) {label "Content"}
+ {optional}
+ {html {cols 60 rows 10 wrap soft}} }
+} -new_data {
+ set ad_id [classified-ads::ads::new \
+ -item_id_element ad_id \
+ -form_id ad \
+ -category_id $keyword_id]
-element create ad ad_id \
- -label "Ad ID" \
- -datatype integer \
- -widget hidden
+ template::form get_values ad return_url
-element create ad return_url \
- -label "Return URL" \
- -datatype text \
- -widget hidden \
- -value $return_url
+ ad_returnredirect $return_url
+ ad_script_abort
+}
-element create ad keyword_id \
- -label "keyword id" \
- -datatype text \
- -widget hidden \
- -value $keyword_id
-
-element create ad title \
- -label "Title" \
- -datatype text \
- -widget text \
- -html {size 60 maxlength 1000}
-
-element create ad description \
- -label "Description" \
- -datatype text \
- -widget textarea \
- -html {cols 60 rows 10 wrap soft} \
- -optional
-
-element create ad data \
- -label "Content" \
- -datatype text \
- -widget textarea \
- -html {cols 60 rows 10 wrap soft} \
- -optional
-
+# Get extra custom widgets, if any
classified-ads::widgets::get_widget_params -content_type "ca_ad" -form_id ad
-
-if {[form is_valid 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
-
- ad_returnredirect $return_url
- ad_script_abort
-}
-
-if { [form is_request ad] } {
- # Pre-fetch the ad_id
- set ad_id [db_nextval acs_object_id_seq]
- element set_properties ad ad_id -value $ad_id
-}
-
set context [list [list "ads" "Ads"] $title]
ad_return_template