Index: openacs-4/packages/ams/www/attribute.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/ams/www/attribute.tcl 22 Mar 2006 10:00:31 -0000 1.10
+++ openacs-4/packages/ams/www/attribute.tcl 7 Apr 2006 07:57:42 -0000 1.11
@@ -6,9 +6,23 @@
} {
{attribute_id:notnull}
+ {set_default_option_id:integer,optional}
orderby:optional
}
+
+set default_option_id [attribute::default_value -attribute_id $attribute_id]
+if { [exists_and_not_null set_default_option_id] } {
+ if { $default_option_id eq $set_default_option_id } {
+ # they are removing the option_id as the default
+ set set_default_option_id ""
+ }
+ attribute::default_value_set -attribute_id $attribute_id -default_value $set_default_option_id
+ attribute::default_value_flush -attribute_id $attribute_id
+ ad_returnredirect [export_vars -base "attribute" -url {attribute_id}]
+
+}
+
#db_1row get_attribute_info {}
ams::attribute::get -attribute_id $attribute_id -array "attribute_info"
set attribute_info(help_text) [attribute::help_text -attribute_id $attribute_id]
@@ -63,6 +77,14 @@
}
}
+ default_p {
+ label "[_ ams.Default]"
+ display_template {
+
+
+
+ }
+ }
actions {
label ""
display_template {
@@ -84,8 +106,8 @@
layout table
row {
option {}
- pretty_name {}
sort_order {}
+ default_p {}
actions {}
}
}
@@ -94,7 +116,7 @@
set sort_count 10
set sort_key_count 10000
-db_multirow -extend { sort_order sort_key delete_url edit_url } options select_options {
+db_multirow -extend { sort_order sort_key delete_url edit_url default_p default_url } 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
from ams_option_types aot, acs_objects o
@@ -108,6 +130,12 @@
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]
+ if { $option_id eq $default_option_id } {
+ set default_p 1
+ } else {
+ set default_p 0
+ }
+ set default_url [export_vars -base "attribute" -url {attribute_id {set_default_option_id $option_id}}]
}
set sort_order $sort_count