Index: openacs-4/packages/ams/www/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/ams/www/list.tcl 30 Oct 2004 00:23:54 -0000 1.1 +++ openacs-4/packages/ams/www/list.tcl 30 Nov 2005 16:21:53 -0000 1.1.2.1 @@ -10,22 +10,45 @@ package_key:notnull object_type:notnull list_name:notnull + {pretty_name ""} + {description ""} groupby:optional orderby:optional {format "normal"} {status "normal"} + {return_url ""} + {return_url_label "[_ ams.lt_Return_to_Where_You_W]"} } +set provided_return_url $return_url +set provided_return_url_label $return_url_label + +set this_url [export_vars -url -base "list" {package_key object_type list_name }] +set code_url [export_vars -url -base "list-code" {package_key object_type list_name return_url return_url_label}] + + + +if { ![ams::list::exists_p -package_key $package_key -object_type $object_type -list_name $list_name] } { + ad_returnredirect -message "[_ ams.lt_The_list_specified_do]" [export_vars -base "list-add" -url {package_key object_type list_name pretty_name description return_url return_url_label}] + ad_script_abort +} set list_id [ams::list::get_list_id -package_key $package_key -object_type $object_type -list_name $list_name] + + +set create_attribute_url [export_vars -base "attribute-add" -url {object_type list_id return_url return_url_label}] + + + + ams::list::get -list_id $list_id -array "list_info" -set title [_ $list_info(pretty_name)] +set title $list_info(pretty_name) set context [list [list lists Lists] $title] list::create \ -name mapped_attributes \ -multirow mapped_attributes \ - -key ams_attribute_id \ - -row_pretty_plural "Mapped Attributes" \ + -key attribute_id \ + -row_pretty_plural "[_ ams.Mapped_Attributes]" \ -checkbox_name checkbox \ -selected_format $format \ -class "list" \ @@ -34,205 +57,174 @@ -pass_properties { } -actions { } -bulk_actions { - "Answer Required" "list-attributes-required" "Require an answer from the checked attributes" - "Answer Optional" "list-attributes-optional" "An answer from the checked attributes is optional" - "Unmap" "list-attributes-unmap" "Unmap check attributes" - "Update Ordering" "list-order-update" "Update ordering from values in list" + "#ams.Answer_Required#" "list-attributes-required" "#ams.lt_Require_an_answer_fro#" + "#ams.Answer_Optional#" "list-attributes-optional" "#ams.lt_An_answer_from_the_ch#" + "#ams.Unmap#" "list-attributes-unmap" "#ams.lt_Unmap_check_attribute#" + "#ams.Update_Ordering#" "list-order-update" "#ams.lt_Update_ordering_from_#" } -bulk_action_export_vars { list_id } -elements { attribute_name { - label "Attribute" + label "[_ ams.Attribute]" display_col attribute_name } pretty_name { - label "Pretty Name" - display_col pretty_name - link_url_eval $attribute_url + label "[_ ams.Pretty_Name_1]" + display_template { + @mapped_attributes.pretty_name@ (Parent Object Type: @mapped_attributes.object_type@) + } } widget { - label "Widget" + label "[_ ams.Widget_1]" display_col widget link_url_eval widgets } + section_heading { + label "[_ ams.Heading]" + display_col section_heading + } + html_options { + label "[_ ams.Html_options]" + display_col html_options + } action { - label "Action" + label "[_ ams.Action]" display_template { - Unmap + [_ ams.Unmap] + [_ ams.Add_Heading][_ ams.EditDelete_Heading] + [_ ams.Add_Html_options][_ ams.EditDelete_Html] } } answer { - label "Required" + label "[_ ams.Required]" display_template { - + - + } } sort_order { - label "Ordering" + label "[_ ams.Ordering]" display_template { - + } } } -filters { } -groupby { } -orderby { } -formats { normal { - label "Table" + label "[_ ams.Table]" layout table row { checkbox {} + attribute_name {} pretty_name {} sort_order {} answer {} action {} + section_heading {} + html_options {} } } } -# Table "public.ams_lists" -# Column | Type | Modifiers -#-----------------------+-------------------------+----------- -# list_id | integer | not null -# package_key | character varying(100) | not null -# object_type | character varying(1000) | not null -# list_name | character varying(100) | not null -# pretty_name | character varying(200) | not null -# description | character varying(200) | -# description_mime_type | character varying(200) | - -# Table "public.ams_list_attribute_map" -# Column | Type | Modifiers -#------------------+------------------------+----------- -# list_id | integer | not null -# ams_attribute_id | integer | not null -# sort_order | integer | not null -# required_p | boolean | not null -# section_heading | character varying(200) | - - set sort_order_count 10 -db_multirow -extend { sort_order_key attribute_url } mapped_attributes select_mapped_attributes { - select alam.required_p, - alam.section_heading, - ams.ams_attribute_id, - ams.widget_name, - ams.deprecated_p, - acs.attribute_name, - acs.pretty_name, - acs.pretty_plural, - acs.object_type - from ams_list_attribute_map alam, - ams_attributes ams, - acs_attributes acs - where alam.list_id = :list_id - and alam.ams_attribute_id = ams.ams_attribute_id - and ams.attribute_id = acs.attribute_id - order by alam.sort_order -} { - set pretty_name [_ $pretty_name] - set attribute_url "attribute?[export_vars -url {ams_attribute_id}]" +set extend_list [list \ + sort_order_key \ + attribute_url \ + unmap_url \ + heading_url \ + required_url \ + optional_url \ + html_options_url] + +db_multirow -extend $extend_list -unclobber mapped_attributes select_mapped_attributes { } { + set attribute_url "attribute?[export_vars -url {attribute_id}]" set sort_order_key $sort_order_count + set unmap_url [export_vars -base "list-attributes-unmap" -url {list_id attribute_id return_url return_url_label}] + set heading_url [export_vars -base "list-attribute-section-heading" -url {list_id attribute_id return_url return_url_label}] + set required_url [export_vars -base "list-attributes-required" -url {list_id attribute_id return_url return_url_label}] + set optional_url [export_vars -base "list-attributes-optional" -url {list_id attribute_id return_url return_url_label}] + set html_options_url [export_vars \ + -base "list-attribute-html-options" \ + -url {list_id attribute_id}] + incr sort_order_count 10 } - -#---------------------------------------------------------------------- -# List builder -#---------------------------------------------------------------------- - - - - - list::create \ -name unmapped_attributes \ -multirow unmapped_attributes \ - -key ams_attribute_id \ - -row_pretty_plural "Unmapped Attributes" \ + -key attribute_id \ + -row_pretty_plural "[_ ams.Unmapped_Attributes]" \ -checkbox_name checkbox \ -selected_format "normal" \ -class "list" \ -main_class "list" \ -sub_class "narrow" \ -pass_properties { } -actions { - } -bulk_actions { - "Map" "list-attributes-map" "Map the selected attributes" - } -bulk_action_export_vars { - list_id } -elements { attribute_name { - label "Attribute" + label "[_ ams.Attribute]" display_col attribute_name } pretty_name { - label "Pretty Name" + label "[_ ams.Pretty_Name_1]" display_col pretty_name link_url_eval $attribute_url } widget { - label "Widget" - display_col widget_name + label "[_ ams.Widget_1]" + display_col widget link_url_eval widgets } action { - label "Action" + label "[_ ams.Action]" display_template { - Map + + [_ ams.Define_Widget] + + + [_ ams.Map] + } } } -filters { } -groupby { } -orderby { } -formats { normal { - label "Table" + label "[_ ams.Table]" layout table row { - checkbox {} pretty_name {} widget {} action {} } } } +# checkbox {} # This query will override the ad_page_contract value entry_id -db_multirow -extend { attribute_url } -unclobber unmapped_attributes get_unmapped_attributes { - select ams.ams_attribute_id, - ams.widget_name, - ams.deprecated_p, - acs.attribute_name, - acs.pretty_name, - acs.pretty_plural, - acs.object_type - from ams_attributes ams, - acs_attributes acs - where ams.ams_attribute_id not in ( select alam.ams_attribute_id from ams_list_attribute_map alam where alam.list_id = :list_id ) - and ams.attribute_id = acs.attribute_id -} { - set pretty_name [_ $pretty_name] - set attribute_url "attribute?[export_vars -url {ams_attribute_id}]" - +db_multirow -extend { attribute_url attribute_add_url map_url } -unclobber unmapped_attributes get_unmapped_attributes " " { + set attribute_add_url [export_vars -base "attribute-add" -url {object_type attribute_name {return_url $this_url}}] + set attribute_url [export_vars -base "attribute" -url {attribute_id}] + set map_url [export_vars -base "list-attributes" -url {list_id attribute_id return_url return_url_label {command "map"}}] } +set return_url $provided_return_url +set return_url_label $provided_return_url_label ad_return_template - - - - -