Index: openacs-4/packages/contacts/www/admin/attribute-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/Attic/attribute-ae.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/contacts/www/admin/attribute-ae.tcl 19 Aug 2004 01:21:41 -0000 1.1.2.3 +++ openacs-4/packages/contacts/www/admin/attribute-ae.tcl 22 Aug 2004 23:57:54 -0000 1.1.2.4 @@ -15,9 +15,9 @@ set attr_exists_p 0 if { [exists_and_not_null attribute_id] } { - set attr_exists_p [db_0or1row select_attr_exists_p { select 1 from contact_attributes where attribute_id = :attribute_id } ] + set attr_exists_p [db_0or1row attr_exists_p {} ] if { ![exists_and_not_null widget_id] } { - db_1row get_widget_id { select widget_id from contact_attributes where attribute_id = :attribute_id } + db_1row get_widget_id {} } } @@ -26,12 +26,9 @@ ad_abort_script } -db_1row get_widget_description { select description as widget_description from contact_widgets where widget_id = :widget_id } +db_1row get_widget_description {} -db_1row get_options_p { select CASE WHEN storage_column = 'option_map_id' THEN '1' ELSE '0' END as options_p - from contact_widgets - where widget_id = :widget_id -} +db_1row get_options_p {} set languages [lang::system::get_locale_options] @@ -57,11 +54,11 @@ ad_form -extend -name attribute_form -new_request { set title "Add an Attribute" } -edit_request { - db_1row select_attribute_properties { select * from contact_attributes where attribute_id = :attribute_id } - db_1row select_attribute_properties { select * from contact_attribute_names where attribute_id = :attribute_id and locale = :locale } + db_1row select_attribute_info {} + db_1row select_attribute_name {} if { [string is true $options_p] } { set options "" - db_foreach get_options { select option from contact_attribute_options where attribute_id = :attribute_id } { + db_foreach get_attribute_options {} { append options "$option\r" } @@ -75,48 +72,23 @@ set peeraddr [ad_conn peeraddr] set context_id [ad_conn package_id] set attribute [util_text_to_url -text $name] - db_1row create_new_attribute_and_get_id { - select contact__attribute_create ( - :attribute_id, - :attribute, - :widget_id, - 'f', - now(), - :user_id, - :peeraddr, - :context_id - ) - } - db_1row save_attribute_name { - select contact__attribute_name_save ( - :attribute_id, - :language, - :name, - :help_text - ); - } + set attribute_id [db_string attribute_create {} + db_1row attribute_name_save {} if { [string is true $options_p] } { set sort_order "1" set options [string trim $options] foreach option [split $options "\n"] { set option [string trim $option] if { ![empty_string_p $option] } { - db_1row create_option { select contact__attribute_option_create (:attribute_id,:option,:sort_order) } + db_1row attribute_option_create {} incr sort_order } } } ad_returnredirect -message "Added attribute '$name'" attributes ad_script_abort } -edit_data { - db_1row save_attribute_name { - select contact__attribute_name_save ( - :attribute_id, - :language, - :name, - :help_text - ); - } + db_1row attribute_name_save {} ad_returnredirect -message "Updated attribute '$name'" attributes } -after_submit { ad_returnredirect "attributes"