Index: openacs-4/packages/ams/www/attribute-option-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-option-delete.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/www/attribute-option-delete.tcl 7 Jun 2005 11:22:23 -0000 1.4 +++ openacs-4/packages/ams/www/attribute-option-delete.tcl 26 Apr 2006 08:40:20 -0000 1.5 @@ -10,6 +10,7 @@ } { option_id:integer,notnull {attribute_id ""} + {purge_p "0"} } -validate { option_has_no_entries -requires {option_id} { if {[empty_string_p $attribute_id]} { @@ -20,18 +21,26 @@ } } -if {[empty_string_p $attribute_id]} { +if {$purge_p} { + db_dml purge_option { delete from ams_options where option_id =:option_id; delete from ams_option_types where option_id = :option_id and attribute_id=:attribute_id} + set message "[_ ams.Option_Purged]" +} else { - # Delete the option for good + if {[empty_string_p $attribute_id]} { + + # Delete the option for good + + db_1row get_option_info { select * from ams_options where option_id = :option_id } + db_dml delete_option { delete from ams_options where option_id = :option_id } + set message "[_ ams.Option_Deleted]" + } else { + + # Just unmap the option - db_1row get_option_info { select * from ams_options where option_id = :option_id } - db_dml delete_option { delete from ams_options where option_id = :option_id } -} else { - - # Just unmap the option - - db_dml unmap_option { delete from ams_option_types where option_id = :option_id and attribute_id = :attribute_id } + db_dml unmap_option { delete from ams_option_types where option_id = :option_id and attribute_id = :attribute_id } + set message "[_ ams.Option_Deleted]" + } } -ad_returnredirect -message "[_ ams.Option_Deleted]" "attribute?[export_vars -url {attribute_id}]" +ad_returnredirect -message "$message" "attribute?[export_vars -url {attribute_id}]"