+
+@title@
+@context@
+
+Pretty Name: @pretty_name@
+Pretty Plural: @pretty_plural@
+Widget: @attribute_info.widget_name@
+
+
+
+
Index: openacs-4/packages/ams/www/attribute.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/attribute.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,129 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: attribute.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+
+} {
+ {ams_attribute_id:notnull}
+ orderby:optional
+}
+
+ams::attribute::get -ams_attribute_id $ams_attribute_id -array "attribute_info"
+acs_object_type::get -object_type $attribute_info(object_type) -array "object_info"
+
+
+set pretty_name [_ $attribute_info(pretty_name)]
+set pretty_plural [_ $attribute_info(pretty_plural)]
+set title $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 \
+ -key option_id \
+ -row_pretty_plural "Options" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -pass_properties {
+ } -actions {
+ } -bulk_action_export_vars {
+ ams_attribute_id
+ } -bulk_actions {
+ "Update" "attribute-options-update" "Update Options"
+ } -elements {
+ edit {
+ label {}
+ }
+ option {
+ label "Option"
+ display_template {
+
+ @options.option@
+
+
+
+
+ }
+ }
+ sort_order {
+ label "Sort Order"
+ display_template {
+
+ }
+ }
+ actions {
+ label ""
+ display_template {
+
+ }
+ }
+ } -filters {
+ } -groupby {
+ } -orderby {
+ default_value default_sort,asc
+ default_sort {
+ label default_sort
+ multirow_cols {sort_key option}
+ }
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ option {}
+ sort_order {}
+ actions {}
+ }
+ }
+ }
+
+
+set sort_count 10
+set sort_key_count 10000
+db_multirow -extend { sort_order sort_key } options select_options {
+ select option_id, option,
+ CASE WHEN ( select '1' from ams_option_map where ams_option_map.option_id = ams_options.option_id limit 1 ) IS NULL THEN 0 ELSE 1 END as in_use_p
+ from ams_options
+ where ams_attribute_id = :ams_attribute_id
+ order by sort_order
+} {
+ set option [_ $option]
+ set sort_order $sort_count
+ set sort_key $sort_key_count
+ incr sort_count 10
+ incr sort_key_count 1
+}
+
+
+set sort_order $sort_count
+set sort_key $sort_key_count
+template::multirow append options {new1} {} 1 $sort_count $sort_key
+template::multirow append options {new2} {} 1 [incr sort_count 10] [incr sort_key 1]
+template::multirow append options {new3} {} 1 [incr sort_count 10] [incr sort_key 1]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ad_return_template
Index: openacs-4/packages/ams/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/index.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/ams/www/index.adp 24 Oct 2004 23:17:26 -0000 1.2
+++ openacs-4/packages/ams/www/index.adp 30 Oct 2004 00:23:54 -0000 1.3
@@ -2,21 +2,8 @@
@title@
@context@
-This is currently a testing page for the save and retrieval procs
-
-
-@attr_list@
-
-
-
-
-
-
-
-
-
-
- @lists.first_names@ @lists.last_name@ @lists.middle_names@
-
-
-
+
Index: openacs-4/packages/ams/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/index.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/ams/www/index.tcl 24 Oct 2004 23:17:26 -0000 1.4
+++ openacs-4/packages/ams/www/index.tcl 30 Oct 2004 00:23:54 -0000 1.5
@@ -12,40 +12,43 @@
set context {}
-# YOU NEED TO SPECIFY A VALID OBJECT_ID
-#set object_id "2864"
# Once done comment out the error line
-#ad_return_error "You need to specify and valid object id in the packages/ams/www/index.tcl file" "Once done comment out this line."
-set package_key "ams"
-set object_type "ams_list"
-set list_name "ams_list_demo3"
-set pretty_name "The Fields used to Add/Edit a Contact Person"
+# ad_return_error "You need to specify and valid object id in the packages/ams/www/index.tcl file" "Once done comment out this line."
-ams::define_list -package_key $package_key \
- -object_type $object_type \
- -list_name $list_name \
- -pretty_name $pretty_name \
- -attributes {
- {first_names textbox {First Name(s)} {First Names} required}
- {middle_names textbox {Middle Name(s)} {Middle Names}}
- {last_name textbox {Last Name} {Last Names} required}
- {email email {Email Address} {Email Addresses}}
- {url url {Website} {Websites}}
- {home_address address {Home Address} {Home Addresses}}
- {organization_address address {Organization Address} {Organization Addresses}}
- }
-set object_id [ams::list::get_list_id \
- -package_key $package_key \
- -object_type $object_type \
- -list_name $list_name]
-
-#ad_form -name entry \
-# -form [ams::ad_form::elements -package_key $package_key \
-# -object_type $object_type \
-# -list_name $list_name \
-# -key "object_id"] \
+
+#set package_key "ams"
+#set object_type "ams_list"
+#set list_name "ams_list_demo3"
+#set pretty_name "The Fields used to Add/Edit a Contact Person"
+#
+#ams::define_list -package_key $package_key \
+# -object_type $object_type \
+# -list_name $list_name \
+# -pretty_name $pretty_name \
+# -attributes {
+# {first_names textbox {First Name(s)} {First Names} required {description {this is my description of first names}}}
+# {middle_names textbox {Middle Name(s)} {Middle Names}}
+# {last_name textbox {Last Name} {Last Names} required}
+# {email email {Email Address} {Email Addresses}}
+# {url url {Website} {Websites}}
+# {home_address address {Home Address} {Home Addresses}}
+# {organization_address address {Organization Address} {Organization Addresses}}
+# {home_phone telecom_number {Home Phone} {Home Phones}}
+# {gender radio {Gender} {Genders} {options {{Male} {Female}}} required}
+# }
+#
+#set object_id [ams::list::get_list_id \
+# -package_key $package_key \
+# -object_type $object_type \
+# -list_name $list_name]
+#set object_id "452"
+##ad_form -name entry \
+## -form [ams::ad_form::elements -package_key $package_key \
+## -object_type $object_type \
+## -list_name $list_name \
+## -key "object_id"] \
# -edit_request {
# ams::object::attribute::values -vars -object_id $object_id
# } -on_submit {
@@ -60,29 +63,30 @@
# }
# }
#
-
-ams_form -package_key $package_key \
- -object_type $object_type \
- -list_name $list_name \
- -form_name "entry" \
- -object_id $object_id \
- -return_url "./"
-
-set attr_list [ams::object::attribute::values -object_id $object_id]
-
-
-db_multirow lists get_list { select list_id, pretty_name from ams_lists }
-
-ams::multirow::extend \
- -package_key $package_key \
- -object_type $object_type \
- -list_name $list_name \
- -multirow "lists" \
- -key "list_id"
+
+#ams_form -package_key $package_key \
+# -object_type $object_type \
+# -list_name $list_name \
+# -form_name "entry" \
+# -object_id $object_id \
+# -return_url "./"
#
-#template::multirow extend lists [list first_names last_name home_address first_names]
+# set attr_list [ams::object::attribute::values_flush -object_id $object_id]
+#set attr_list [ams::object::attribute::values -object_id $object_id]
#
#
+#db_multirow lists get_list { select list_id, pretty_name from ams_lists }
+#
+#ams::multirow::extend \
+# -package_key $package_key \
+# -object_type $object_type \
+# -list_name $list_name \
+# -multirow "lists" \
+# -key "list_id"
+##
+##template::multirow extend lists [list first_names last_name home_address first_names]
+##
+##
#set key_id "list_id"
#template::multirow foreach lists {
# set object_id [set $key_id]
Index: openacs-4/packages/ams/www/list-add.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-add.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-add.adp 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,11 @@
+
+@title@
+@context@
+
+Note: Adding an AMS List here is primarily for demonstration purposes. In order for AMS Lists to be useful you need to integrated them with your package .
+
+
+
+
+
+
Index: openacs-4/packages/ams/www/list-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-add.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-add.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,65 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list-add.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+} {
+ {object_type:notnull}
+ {package_key ""}
+}
+
+acs_object_type::get -object_type $object_type -array "object_info"
+
+set title "Add List"
+set context [list [list objects Objects] [list "object?object_type=$object_type" $object_info(pretty_name)] "Add List"]
+
+set package_options " [db_list_of_lists select_packages { select package_key, package_key from apm_package_types order by package_key } ]"
+
+if { [exists_and_not_null package_key] && [exists_and_not_null object_type] && [exists_and_not_null list_name] } {
+ ams::list::flush -package_key $package_key -object_type $object_type -list_name $list_name
+}
+
+ad_form -name list_form -form {
+ {list_id:key}
+ {package_key:text(select) {label "Package Key"} {options $package_options}}
+ {object_type:text(inform) {label "Object Type"}}
+ {list_name:text {label "List Name"} {html {size 30 maxlength 100}} {help_text {This name must be lower case, contain only letters and underscores, and contain no spaces}}}
+ {pretty_name:text {label "Pretty Name"} {html {size 30 maxlength 100}}}
+ {pretty_plural:text {label "Pretty Plural"} {html {size 30 maxlength 100}}}
+ {description:text(textarea),optional {label "Description"} {html {cols 55 rows 4}}}
+} -new_request {
+} -edit_request {
+} -validate {
+ # i need to add validation that the attribute isn't already in the database
+ { list_name
+ { [::regexp {^([0-9]|[a-z]|\_){1,}$} $list_name match list_name_validate] }
+ "You have used invalid characters."
+ }
+ { list_name
+ { ![::ams::list::exists_p -package_key $package_key -object_type $object_type -list_name $list_name] }
+ "List name $list_name already exists for $object_info(pretty_name) ."
+ }
+} -on_submit {
+
+ ams::list::flush -package_key $package_key -object_type $object_type -list_name $list_name
+
+ ams::list::new -list_id $list_id \
+ -package_key $package_key \
+ -object_type $object_type \
+ -list_name $list_name \
+ -pretty_name $pretty_name \
+ -description $description \
+ -description_mime_type "text/plain" \
+ -context_id ""
+
+ ams::list::flush -package_key $package_key -object_type $object_type -list_name $list_name
+
+
+} -edit_data {
+} -after_submit {
+ ad_returnredirect "list?[export_vars -url {package_key object_type list_name}]"
+ ad_script_abort
+}
+
+
+ad_return_template
Index: openacs-4/packages/ams/www/list-attributes-map.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes-map.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-attributes-map.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,23 @@
+ad_page_contract {
+
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list-attributes-map.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+} {
+ {ams_attribute_id:integer,multiple}
+ {list_id:integer,notnull}
+}
+
+foreach ams_attribute_id $ams_attribute_id {
+ ams::list::attribute::map -list_id $list_id -ams_attribute_id $ams_attribute_id
+}
+
+ams::list::get -list_id $list_id -array "list_info"
+set package_key $list_info(package_key)
+set object_type $list_info(object_type)
+set list_name $list_info(list_name)
+
+ad_returnredirect "list?[export_vars -url {package_key object_type list_name}]"
+ad_script_abort
Index: openacs-4/packages/ams/www/list-attributes-optional.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes-optional.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-attributes-optional.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,23 @@
+ad_page_contract {
+
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list-attributes-optional.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+} {
+ {ams_attribute_id:integer,multiple,notnull}
+ {list_id:integer,notnull}
+}
+
+foreach ams_attribute_id $ams_attribute_id {
+ ams::list::attribute::optional -list_id $list_id -ams_attribute_id $ams_attribute_id
+}
+
+ams::list::get -list_id $list_id -array "list_info"
+set package_key $list_info(package_key)
+set object_type $list_info(object_type)
+set list_name $list_info(list_name)
+
+ad_returnredirect "list?[export_vars -url {package_key object_type list_name}]"
+ad_script_abort
Index: openacs-4/packages/ams/www/list-attributes-required.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes-required.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-attributes-required.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,23 @@
+ad_page_contract {
+
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list-attributes-required.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+} {
+ {ams_attribute_id:integer,multiple,notnull}
+ {list_id:integer,notnull}
+}
+
+foreach ams_attribute_id $ams_attribute_id {
+ ams::list::attribute::required -list_id $list_id -ams_attribute_id $ams_attribute_id
+}
+
+ams::list::get -list_id $list_id -array "list_info"
+set package_key $list_info(package_key)
+set object_type $list_info(object_type)
+set list_name $list_info(list_name)
+
+ad_returnredirect "list?[export_vars -url {package_key object_type list_name}]"
+ad_script_abort
Index: openacs-4/packages/ams/www/list-attributes-unmap.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes-unmap.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-attributes-unmap.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,22 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list-attributes-unmap.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+} {
+ {ams_attribute_id:integer,multiple}
+ {list_id:integer,notnull}
+}
+
+foreach ams_attribute_id $ams_attribute_id {
+ ams::list::attribute::unmap -list_id $list_id -ams_attribute_id $ams_attribute_id
+}
+
+ams::list::get -list_id $list_id -array "list_info"
+set package_key $list_info(package_key)
+set object_type $list_info(object_type)
+set list_name $list_info(list_name)
+
+ad_returnredirect "list?[export_vars -url {package_key object_type list_name}]"
+ad_script_abort
Index: openacs-4/packages/ams/www/list-order-update.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-order-update.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list-order-update.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,49 @@
+ad_page_contract {
+
+ Update sort order
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list-order-update.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+
+} {
+ sort_key:array
+ list_id:integer,notnull
+}
+
+
+set ams_attribute_ids [db_list get_attribute_ids { select ams_attribute_id from ams_list_attribute_map where list_id = :list_id order by sort_order }]
+
+
+# first we get the highest sort_order so variables without a sort_order can be given one
+set highest_sort 0
+set used_sorts [list]
+foreach ams_attribute_id $ams_attribute_ids {
+ if { $sort_key(${ams_attribute_id}) > $highest_sort } {
+ set highest_sort $sort_key(${ams_attribute_id})
+ }
+}
+
+db_transaction {
+ foreach ams_attribute_id $ams_attribute_ids {
+ set sort_order $sort_key(${ams_attribute_id})
+ incr highest_sort 1
+ db_dml update_sort_order { update ams_list_attribute_map set sort_order = :highest_sort where sort_order = :sort_order and list_id = :list_id }
+ if { ![exists_and_not_null sort_order] } {
+ incr highest_sort 1
+ set sort_order $highest_sort
+ }
+ db_dml update_sort_order { update ams_list_attribute_map set sort_order = :sort_order where ams_attribute_id = :ams_attribute_id and list_id = :list_id }
+ }
+}
+
+ams::list::get -list_id $list_id -array "list_info"
+set package_key $list_info(package_key)
+set object_type $list_info(object_type)
+set list_name $list_info(list_name)
+
+ad_returnredirect "list?[export_vars -url {package_key object_type list_name}]"
+ad_script_abort
+
+ad_returnredirect "object-map?object_id=$object_id"
Index: openacs-4/packages/ams/www/list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list.adp 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,21 @@
+
+@title@
+@context@
+
+
+Package Key: @package_key@
+Object Type: @object_type@
+List Name: @list_name@
+
+Mapped Attributes
+
+
+
+
+Unmapped Attributes
+
+
+
+
Index: openacs-4/packages/ams/www/list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/list.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,238 @@
+ad_page_contract {
+
+ This page lets users manage ams lists
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: list.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+} {
+ 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
+
+
+
+
+
Index: openacs-4/packages/ams/www/lists.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/lists.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/lists.adp 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+@title@
+@context@
+
+You can create a list by selecting an acs_object . Note that list creation should be done with contracting packages. These lists shows what ams can do for your package.
+
+
+
+
+
Index: openacs-4/packages/ams/www/lists.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/lists.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/lists.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,76 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: lists.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+
+} {
+ {orderby "name"}
+}
+
+set title "AMS Lists"
+set context [list $title]
+
+list::create \
+ -name lists \
+ -multirow lists \
+ -key list_id \
+ -row_pretty_plural "AMS Lists" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -actions {
+ } -bulk_actions {
+ } -elements {
+ edit {
+ label {}
+ }
+ pretty_name {
+ display_col pretty_name
+ label "Pretty Name"
+ }
+ package_key {
+ display_col package_key
+ label "Package Key"
+ }
+ list_name {
+ display_col list_name
+ label "List Name"
+ link_url_eval $list_url
+ }
+ object_type {
+ display_col object_type
+ label "Object Type"
+ link_url_eval $object_url
+ }
+ } -filters {
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ package_key {}
+ object_type {}
+ list_name {}
+ pretty_name {}
+ }
+ }
+ }
+
+
+db_multirow -extend { list_url object_url } lists select_lists {
+ select list_id, package_key, object_type, list_name, pretty_name
+ from ams_lists
+} {
+ set object_url "list?[export_vars -url {object_type}]"
+ set list_url "list?[export_vars -url {package_key object_type list_name}]"
+ set pretty_name [_ $pretty_name]
+}
+
+
+ad_return_template
Index: openacs-4/packages/ams/www/object.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/object.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/object.adp 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+@title@
+@context@
+
+
+
+AMS Attributes
+
+
+Attributes not managed by AMS
+
+
+AMS Lists associated with @object_info.pretty_plural@
+
Index: openacs-4/packages/ams/www/object.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/object.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/object.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,296 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: object.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+
+} {
+ {object_type:notnull}
+ orderby:optional
+}
+
+acs_object_type::get -object_type $object_type -array "object_info"
+
+set title "$object_info(pretty_name)"
+set context [list [list objects Objects] $title]
+
+
+list::create \
+ -name object_attributes \
+ -multirow object_attributes \
+ -key attribute_name \
+ -row_pretty_plural "AMS Attributes" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -pass_properties {
+ object_type
+ } -actions [list "Add" "attribute-add?object_type=$object_type" "Add an AMS Attribute"] \
+ -bulk_actions {
+ } -elements {
+ edit {
+ label {}
+ }
+ pretty_name {
+ display_col pretty_name
+ label "Pretty Name"
+ link_url_eval $ams_attribute_url
+ }
+ attribute_name {
+ display_col attribute_name
+ label "Attribute Name"
+ link_url_eval $ams_attribute_url
+ }
+ widget_name {
+ display_col widget_name
+ label "Widget Name"
+ link_url_eval widgets
+ }
+ actions {
+ label ""
+ display_template {
+ Upgrade to AMS Attribute
+ }
+ }
+ } -filters {
+ object_type {}
+ } -groupby {
+ } -orderby {
+ default_value default_sort,asc
+ default_sort {
+ label default_sort
+ multirow_cols {ams_attribute_p pretty_name attribute_name}
+ }
+ pretty_name {
+ label pretty_name
+ multirow_cols {ams_attribute_p pretty_name attribute_name}
+ }
+ attribute_name {
+ label attribute_name
+ multirow_cols {ams_attribute_p attribute_name pretty_name}
+ }
+ widget_name {
+ label widget_name
+ multirow_cols {ams_attribute_p widget_name pretty_name attribute_name}
+ }
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ pretty_name {}
+ attribute_name {}
+ widget_name {}
+ actions {}
+ }
+ }
+ }
+
+
+db_multirow -extend { ams_attribute_url ams_attribute_p } object_attributes select_object_attributes {
+ select acs.attribute_name,
+ acs.pretty_name,
+ acs.pretty_plural,
+ acs.attribute_id,
+ ams.ams_attribute_id,
+ ams.widget_name
+ from acs_attributes acs, ams_attributes ams
+ where acs.object_type = :object_type
+ and acs.attribute_id = ams.attribute_id
+} {
+ if { [exists_and_not_null ams_attribute_id] } { set ams_attribute_p 1 } else { set ams_attribute_p 0 }
+
+ if { [exists_and_not_null ams_attribute_id] } {
+ set ams_attribute_url "attribute?ams_attribute_id=$ams_attribute_id"
+ } else {
+ set ams_attribute_url ""
+ }
+ if { [lang::message::message_exists_p en_US $pretty_name] } {
+ set pretty_name [_ $pretty_name]
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# This code lets me setup AMS Attribute Upgrades for Attributes that were not created by AMS
+#
+# eventually we will allow these attributes to be "upgraded" to ams_attributes. We first need to provision a way
+# for them to not be deleted at package drop time, since other packages created these attributes they may need them.
+
+list::create \
+ -name non_ams_attributes \
+ -multirow non_ams_object_attributes \
+ -key attribute_name \
+ -row_pretty_plural "Attributes not managed by AMS" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -pass_properties {
+ variable
+ } -actions {
+ } -bulk_actions {
+ } -elements {
+ pretty_name {
+ display_col pretty_name
+ label "Pretty Name"
+ }
+ attribute_name {
+ display_col attribute_name
+ label "Attribute Name"
+ }
+ actions {
+ label ""
+ display_template {
+ Upgrade to AMS Attribute
+ }
+ }
+ } -filters {
+ object_type {}
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ pretty_name {}
+ attribute_name {}
+ }
+ }
+ }
+
+
+db_multirow non_ams_object_attributes select_non_ams_object_attributess {
+ select acs.attribute_name,
+ acs.pretty_name,
+ acs.pretty_plural,
+ acs.attribute_id
+ from acs_attributes acs
+ where acs.object_type = :object_type
+ and acs.attribute_id not in ( select attribute_id from ams_attributes )
+} {
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# AMS Lists associated with this object type
+
+list::create \
+ -name ams_lists \
+ -multirow ams_lists \
+ -key list_id \
+ -row_pretty_plural "Attributes not managed by AMS" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -pass_properties {
+ variable
+ } -actions [list "Add" "list-add?object_type=$object_type" "Add an AMS List"] \
+ -bulk_actions {
+ } -elements {
+ package_key {
+ label "Package Key"
+ display_col package_key
+ }
+ object_type {
+ label "Object Type"
+ display_col object_type
+ }
+ list_name {
+ label "List Name"
+ display_col list_name
+ link_url_eval $list_link
+ }
+ pretty_name {
+ display_col pretty_name
+ label "Pretty Name"
+ }
+ description {
+ display_col description_html;noquote
+ label "Description"
+ }
+ actions {
+ label ""
+ display_template {
+
+ }
+ }
+ } -filters {
+ object_type {}
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ package_key {}
+ list_name {}
+ pretty_name {}
+ description {}
+ }
+ }
+ }
+
+
+db_multirow -extend { description_html list_link } ams_lists select_ams_lists {
+ select *
+ from ams_lists
+ where object_type = :object_type
+} {
+ set pretty_name [_ $pretty_name]
+ set list_link "list?[export_vars -url {package_key object_type list_name}]"
+ set description_html [ad_html_text_convert -from $description_mime_type -to "text/html" -truncate_len "175" $description]
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ad_return_template
Index: openacs-4/packages/ams/www/objects.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/objects.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/objects.adp 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+@title@
+@context@
+
+
+
+
+
+
+
Index: openacs-4/packages/ams/www/objects.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/objects.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/objects.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,66 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: objects.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+
+} {
+ {orderby "name"}
+}
+
+set title "Objects"
+set context [list $title]
+
+list::create \
+ -name object_types \
+ -multirow object_types \
+ -key object_type \
+ -row_pretty_plural "Object Types" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -actions {
+ } -bulk_actions {
+ } -elements {
+ edit {
+ label {}
+ }
+ pretty_name {
+ display_col pretty_name
+ label "Pretty Name"
+ link_url_eval $object_attributes_url
+ }
+ object_type {
+ display_col object_type
+ label "Object Type"
+ link_url_eval $object_attributes_url
+ }
+ } -filters {
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ pretty_name {}
+ object_type {}
+ }
+ }
+ }
+
+
+db_multirow -extend { object_attributes_url } object_types select_object_types {
+ select object_type,
+ pretty_name
+ from acs_object_types
+ order by lower(pretty_name)
+} {
+ set object_attributes_url "object?object_type=$object_type"
+}
+
+
+ad_return_template
Index: openacs-4/packages/ams/www/widgets.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/widgets.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/widgets.adp 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,13 @@
+
+@title@
+@context@
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/ams/www/widgets.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/widgets.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ams/www/widgets.tcl 30 Oct 2004 00:23:54 -0000 1.1
@@ -0,0 +1,99 @@
+ad_page_contract {
+
+ @author Matthew Geddert openacs@geddert.com
+ @creation-date 2004-07-28
+ @cvs-id $Id: widgets.tcl,v 1.1 2004/10/30 00:23:54 matthewg Exp $
+
+
+} {
+}
+
+
+set title "Widgets"
+set context [list $title]
+
+
+
+
+list::create \
+ -name widgets \
+ -multirow widgets \
+ -key widget_name \
+ -row_pretty_plural "Object Types" \
+ -checkbox_name checkbox \
+ -selected_format "normal" \
+ -class "list" \
+ -main_class "list" \
+ -sub_class "narrow" \
+ -pass_properties {
+ variable
+ } -actions {
+ } -bulk_actions {
+ } -elements {
+ widget_name {
+ display_col widget_name
+ label "Widget Name"
+ }
+ pretty_name {
+ display_col pretty_name
+ label "Pretty Name"
+ }
+ pretty_plural {
+ display_col pretty_plural
+ label "Pretty Plural"
+ }
+ widget {
+ display_col widget
+ label "Widget"
+ }
+ datatype {
+ display_col datatype
+ label "Datatype"
+ }
+ parameters {
+ display_col parameters
+ label "Parameters"
+ }
+ } -filters {
+ object_type {}
+ } -groupby {
+ } -orderby {
+ } -formats {
+ normal {
+ label "Table"
+ layout table
+ row {
+ widget_name {}
+ pretty_name {}
+ widget {}
+ datatype {}
+ parameters {}
+ }
+ }
+ }
+
+
+db_multirow widgets get_widgets {
+ select *
+ from ams_widgets
+ order by widget_name
+} {
+}
+
+template::multirow foreach widgets {
+ set form_element "${widget_name}_widget:${datatype}(${widget}),optional"
+ if { [string equal $storage_type "ams_options"] } {
+ append form_element { {options { {"Demo Example One" 1} {"Demo Example Two" 2} {"Demo Example Three" 3} {"Demo Example Four" 4} {"Demo Example Five" 5} {"Demo Example Six" 6} }}}
+ }
+ if { [exists_and_not_null parameters] } {
+ append form_element " ${parameters}"
+ }
+ lappend form_element [list "label" "$widget_name
$pretty_plural
widget: $widget datatype: $datatype parameters: $parameters
"]
+ lappend form_elements $form_element
+}
+
+ad_form -name widgets_form -form $form_elements -on_submit {}
+
+
+
+ad_return_template