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.2
--- openacs-4/packages/ams/www/list.tcl 30 Oct 2004 00:23:54 -0000 1.1
+++ openacs-4/packages/ams/www/list.tcl 18 May 2005 17:11:48 -0000 1.2
@@ -1,238 +1,249 @@
-ad_page_contract {
-
- This page lets users manage ams lists
-
- @author Matthew Geddert openacs@geddert.com
- @creation-date 2004-07-28
- @cvs-id $Id$
-
-} {
- package_key:notnull
- object_type:notnull
- list_name:notnull
- groupby:optional
- orderby:optional
- {format "normal"}
- {status "normal"}
-}
-
-set list_id [ams::list::get_list_id -package_key $package_key -object_type $object_type -list_name $list_name]
-ams::list::get -list_id $list_id -array "list_info"
-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" \
- -checkbox_name checkbox \
- -selected_format $format \
- -class "list" \
- -main_class "list" \
- -sub_class "narrow" \
- -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"
- } -bulk_action_export_vars {
- list_id
- } -elements {
- attribute_name {
- label "Attribute"
- display_col attribute_name
- }
- pretty_name {
- label "Pretty Name"
- display_col pretty_name
- link_url_eval $attribute_url
- }
- widget {
- label "Widget"
- display_col widget
- link_url_eval widgets
- }
- action {
- label "Action"
- display_template {
- Unmap
- }
- }
- answer {
- label "Required"
- display_template {
-
-
-
-
-
-
- }
- }
- sort_order {
- label "Ordering"
- display_template {
-
- }
- }
- } -filters {
- } -groupby {
- } -orderby {
- } -formats {
- normal {
- label "Table"
- layout table
- row {
- checkbox {}
- pretty_name {}
- sort_order {}
- answer {}
- action {}
- }
- }
- }
-
-
-# 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 sort_order_key $sort_order_count
- incr sort_order_count 10
-}
-
-
-#----------------------------------------------------------------------
-# List builder
-#----------------------------------------------------------------------
-
-
-
-
-
-list::create \
- -name unmapped_attributes \
- -multirow unmapped_attributes \
- -key ams_attribute_id \
- -row_pretty_plural "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"
- display_col attribute_name
- }
- pretty_name {
- label "Pretty Name"
- display_col pretty_name
- link_url_eval $attribute_url
- }
- widget {
- label "Widget"
- display_col widget_name
- link_url_eval widgets
- }
- action {
- label "Action"
- display_template {
- Map
- }
- }
- } -filters {
- } -groupby {
- } -orderby {
- } -formats {
- normal {
- label "Table"
- layout table
- row {
- checkbox {}
- pretty_name {}
- widget {}
- action {}
- }
- }
- }
-
-
-
-# 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}]"
-
-}
-
-
-
-ad_return_template
-
-
-
-
-
+ad_page_contract {
+
+ This page lets users manage ams lists
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id$
+
+} {
+ 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 "Return to Where You Were"}
+}
+
+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 "The list specified does not exists. You may create it if you like." [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 context [list [list lists Lists] $title]
+
+list::create \
+ -name mapped_attributes \
+ -multirow mapped_attributes \
+ -key attribute_id \
+ -row_pretty_plural "Mapped Attributes" \
+ -checkbox_name checkbox \
+ -selected_format $format \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -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"
+ } -bulk_action_export_vars {
+ list_id
+ } -elements {
+ attribute_name {
+ label "Attribute"
+ display_col attribute_name
+ }
+ pretty_name {
+ label "Pretty Name"
+ display_template {
+ @mapped_attributes.pretty_name@ (Parent Object Type: @mapped_attributes.object_type@)
+ }
+ }
+ widget {
+ label "Widget"
+ display_col widget
+ link_url_eval widgets
+ }
+ section_heading {
+ label "Heading"
+ display_col section_heading
+ }
+ action {
+ label "Action"
+ display_template {
+ Unmap
+ Add HeadingEdit/Delete Heading
+ }
+ }
+ answer {
+ label "Required"
+ display_template {
+
+
+
+
+
+
+ }
+ }
+ sort_order {
+ label "Ordering"
+ display_template {
+
+ }
+ }
+ } -filters {
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ checkbox {}
+ pretty_name {}
+ sort_order {}
+ answer {}
+ action {}
+ section_heading {}
+ }
+ }
+ }
+
+
+
+set sort_order_count 10
+
+db_multirow -extend { sort_order_key attribute_url } -unclobber mapped_attributes select_mapped_attributes {
+ select alam.required_p,
+ alam.section_heading,
+ ams.attribute_id,
+ ams.widget,
+ ams.deprecated_p,
+ ams.attribute_name,
+ ams.pretty_name,
+ ams.pretty_plural,
+ ams.object_type
+ from ams_list_attribute_map alam,
+ ams_attributes ams
+ where alam.list_id = :list_id
+ and alam.attribute_id = ams.attribute_id
+ order by alam.sort_order
+} {
+ set attribute_url "attribute?[export_vars -url {attribute_id}]"
+ set sort_order_key $sort_order_count
+ incr sort_order_count 10
+}
+
+
+#----------------------------------------------------------------------
+# List builder
+#----------------------------------------------------------------------
+
+
+
+
+# } -bulk_actions [list "Map" "list-attributes" "Map the selected attributes"] \
+# -bulk_action_export_vars {
+# list_id
+
+list::create \
+ -name unmapped_attributes \
+ -multirow unmapped_attributes \
+ -key attribute_id \
+ -row_pretty_plural "Unmapped Attributes" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -pass_properties {
+ } -actions {
+ } -elements {
+ attribute_name {
+ label "Attribute"
+ display_col attribute_name
+ }
+ pretty_name {
+ label "Pretty Name"
+ display_col pretty_name
+ link_url_eval $attribute_url
+ }
+ widget {
+ label "Widget"
+ display_col widget
+ link_url_eval widgets
+ }
+ action {
+ label "Action"
+ display_template {
+
+ Define Widget
+
+
+ Map
+
+ }
+ }
+ } -filters {
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ pretty_name {}
+ widget {}
+ action {}
+ }
+ }
+ }
+# checkbox {}
+
+
+
+# This query will override the ad_page_contract value entry_id
+
+db_multirow -extend { attribute_url attribute_add_url } -unclobber unmapped_attributes get_unmapped_attributes "
+ select attribute_id,
+ widget,
+ deprecated_p,
+ attribute_name,
+ pretty_name,
+ pretty_plural,
+ object_type
+ from ams_attributes
+ where attribute_id not in ( select alam.attribute_id from ams_list_attribute_map alam where alam.list_id = :list_id )
+ and object_type in ([ams::object_parents -sql -object_type $object_type])
+" {
+ set return_url $this_url
+ set attribute_add_url [export_vars -base "attribute-add" -url {object_type attribute_name return_url}]
+ set attribute_url [export_vars -base "attribute" -url {attribute_id}]
+}
+
+set return_url $provided_return_url
+set return_url_label $provided_return_url_label
+
+
+ad_return_template
+
+
+
+
+