Index: openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml,v
diff -u -r1.23 -r1.24
--- openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 26 Apr 2006 06:24:55 -0000 1.23
+++ openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 26 Apr 2006 08:40:20 -0000 1.24
@@ -277,6 +277,7 @@
Dates of Inquiry
Applicatoin Recieved Date
Application Recieved Dates
+ Default
Define Widget
Degree From Previous School
Degree From Previous Schools
@@ -359,6 +360,8 @@
Object Type
Objects
Option
+ Option Deleted
+ Option Purged
Optional
Options Updated
Ordering
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}]"
Index: openacs-4/packages/ams/www/attribute.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/ams/www/attribute.tcl 7 Apr 2006 07:57:42 -0000 1.11
+++ openacs-4/packages/ams/www/attribute.tcl 26 Apr 2006 08:40:20 -0000 1.12
@@ -36,7 +36,6 @@
set title $attribute_info(pretty_name)
set context [list [list objects Objects] [list "object?object_type=$attribute_info(object_type)" $object_info(pretty_name)] $title]
-
list::create \
-name options \
-multirow options \
@@ -61,16 +60,13 @@
label "[_ ams.Option]"
display_template {
- @options.option@
+ @options.pretty_name@
}
}
- pretty_name {
- label "[_ ams.Pretty_Name]"
- }
sort_order {
label "[_ ams.Sort_Order]"
display_template {
@@ -90,6 +86,7 @@
display_template {
+ | Purge
}
}
} -filters {
@@ -116,9 +113,9 @@
set sort_count 10
set sort_key_count 10000
-db_multirow -extend { sort_order sort_key delete_url edit_url default_p default_url } options select_options {
+db_multirow -extend { sort_order sort_key delete_url edit_url default_p purge_url default_url swa_p} options select_options {
select option_id, option, title as pretty_name,
- CASE WHEN ( select '1' from ams_options where ams_options.option_id = ams_option_types.option_id limit 1 ) IS NULL THEN 0 ELSE 1 END as in_use_p
+ (select '1' from ams_options where ams_options.option_id = ams_option_types.option_id limit 1 ) as in_use_p
from ams_option_types aot, acs_objects o
where attribute_id = :attribute_id
and aot.option_id = o.object_id
@@ -129,12 +126,14 @@
incr sort_count 10
incr sort_key_count 1
set delete_url [export_vars -base "attribute-option-delete" -url {attribute_id option_id}]
- set edit_url [lang::util::edit_lang_key_url -message $option]
+ set purge_url [export_vars -base "attribute-option-delete" -url {attribute_id option_id {purge_p 1}}]
+ set edit_url [lang::util::edit_lang_key_url -message $pretty_name]
if { $option_id eq $default_option_id } {
set default_p 1
} else {
set default_p 0
}
+ set swa_p [acs_user::site_wide_admin_p]
set default_url [export_vars -base "attribute" -url {attribute_id {set_default_option_id $option_id}}]
}