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.8 -r1.9
--- openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl 24 Jul 2003 20:20:10 -0000 1.8
+++ openacs-4/contrib/packages/classified-ads/tcl/ads-procs.tcl 25 Jul 2003 02:39:38 -0000 1.9
@@ -53,7 +53,6 @@
@see classified-ads::edit_ca_item
} {
- ns_log notice "RBM: item_id = $item_id_element, form_id = $form_id, isbn exists? [template::element::exists $form_id isbn]"
return [classified-ads::edit_ca_item \
-item_id_element $item_id_element \
-form_id $form_id \
Index: openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl 23 Jul 2003 22:23:47 -0000 1.2
+++ openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl 25 Jul 2003 02:39:38 -0000 1.3
@@ -47,11 +47,11 @@
if {$package_folder_id} {
classified-ads::register_content_type -folder_id $package_folder_id -content_type ca_ad
- ns_log Notice "classified-ads-init: registering ca_ad for $package_folder_id"
+ ns_log Debug "classified-ads-init: registering ca_ad for $package_folder_id"
classified-ads::register_content_type -folder_id $package_folder_id -content_type content_revision
- ns_log Notice "classified-ads-init: registering content_revision for $package_folder_id"
+ ns_log Debug "classified-ads-init: registering content_revision for $package_folder_id"
classified-ads::register_content_type -folder_id $package_folder_id -content_type ca_image
- ns_log Notice "classified-ads-init: registering ca_image for $package_folder_id"
+ ns_log Debug "classified-ads-init: registering ca_image for $package_folder_id"
}
}
}
Index: openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl 24 Jul 2003 20:20:10 -0000 1.6
+++ openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl 25 Jul 2003 02:39:38 -0000 1.7
@@ -392,7 +392,6 @@
# Get the type specific attributes
set type_specific_attr_list [get_attributes -content_type $content_type -storage "type_specific"]
- ns_log notice "RBM: type_specific = $type_specific_attr_list"
if {[llength $type_specific_attr_list]} {
#
@@ -409,10 +408,7 @@
set table_name [ns_set get $one_attribute table_name]
set datatype [ns_set get $one_attribute datatype]
- ns_log notice "RBM: column = $column_name, table = $table_name, datatype = $datatype"
-
if {[template::element::exists $form_id $column_name]} {
- ns_log notice "RBM: Exists in the form"
lappend name_list $column_name
lappend value_list ":$column_name"
@@ -438,15 +434,13 @@
# update the type specific data
- ns_log notice "RBM: plsql_query: $plsql_query"
db_dml update_data {} -bind $type_specific_bind_vars
ns_set free $type_specific_bind_vars
}
# get the generic attributes
set generic_attr_list [get_attributes -content_type $content_type -storage "generic"]
- ns_log notice "RBM: generic = $generic_attr_list"
if {[llength $generic_attr_list]} {
foreach one_attribute $generic_attr_list {
@@ -471,7 +465,7 @@
}
}
} on_error {
- ad_return_complaint 1 "
$errmsg"
+ ad_return_error "Problems" " $errmsg"
ad_script_abort
}
Index: openacs-4/contrib/packages/classified-ads/tcl/widget-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/widget-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/classified-ads/tcl/widget-procs.tcl 24 Jul 2003 20:20:10 -0000 1.4
+++ openacs-4/contrib/packages/classified-ads/tcl/widget-procs.tcl 25 Jul 2003 02:39:38 -0000 1.5
@@ -30,8 +30,6 @@
} {
set package_id [ad_conn package_id]
- set ad_form_spec "ad_form -extend -name $form_id -form {"
- set validate_block ""
if { [empty_string_p $keyword_id] } {
#
@@ -46,80 +44,63 @@
set widget_list [db_list_of_ns_sets select_widgets {}]
foreach one_widget $widget_list {
- set element_name [ns_set get $one_widget attribute_name]
- set element_label [ns_set get $one_widget label]
- set element_datatype [ns_set get $one_widget datatype]
- set element_widget [ns_set get $one_widget widget]
- set element_options [ns_set get $one_widget select_options]
- set element_line "\n{$element_name:$element_datatype\($element_widget\)"
+ set extra_ops ""
- # Is it optional?
-
- if {[string equal [ns_set get $one_widget optional_p] "t"]} {
- append element_line ",optional {label \"$element_label\"}"
- } else {
- append element_line "\t{label \"$element_label\"}"
- }
-
# Were html options passed?
set html_options [ns_set get $one_widget html_options]
if {![empty_string_p $html_options]} {
- append element_line "\n\t{html $html_options}"
+ append extra_ops " -html $html_options"
}
# Is there a default value?
set default_value [ns_set get $one_widget default_value]
if {![empty_string_p $default_value]} {
- append element_line "\n\t{value \"$default_value\"}"
+ append extra_ops " -value $default_value"
}
+ # Is there a validate clause?
+
+ set validate_clause [ns_set get $one_widget validate]
+
+ if {![empty_string_p $validate_clause]} {
+ append extra_ops " -validate $validate_clause"
+ }
+
+ # Is it optional?
+
+ if {[string equal [ns_set get $one_widget optional_p] "t"]} {
+ append extra_ops " -optional"
+ }
+
#
# RBM: Did the user pass extra form builder options?
#
# This is somewhat dangerous, but the admin must know what
# s/he is doing when entering extra options. It was the only
# way I could think of to allow for different options like
- # format, help_text, help, etc. to be added on a per-field basis.
+ # -format, -help_text, -help, etc. to be added on a
+ # per-field basis.
#
set extra_clause [ns_set get $one_widget extra_options]
if { ![empty_string_p $extra_clause] } {
- append element_line "\n\t$extra_clause"
+ append extra_ops " $extra_clause"
}
- # Now end the element list
+ set widget_command "template::element::create $form_id [ns_set get $one_widget attribute_name] \
+ -label \"[ns_set get $one_widget label]\" \
+ -datatype \"[ns_set get $one_widget datatype]\" \
+ -options \"[ns_set get $one_widget select_options]\" \
+ -widget \"[ns_set get $one_widget widget]\" $extra_ops"
- append element_line "}"
-
- # Is there a validate clause?
-
- set validate_clause [ns_set get $one_widget validate]
-
- if {![empty_string_p $validate_clause]} {
- append validate_block "{$element_name {$validate_clause}}"
- }
-
- # Add this element to the ad_form spec
-
- append ad_form_spec $element_line
+ eval $widget_command
}
- # Close the ad_form spec and then add a validate block if not empty
-
- append ad_form_spec "}"
-
- if { ![empty_string_p $validate_block] } {
- append ad_form_spec " -validate { $validate_block }"
- }
-
- ns_log notice "RBM: ad_form: $ad_form_spec"
- eval $ad_form_spec
-
return 0
}