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.2 -r1.3 --- openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 21 May 2005 21:18:04 -0000 1.2 +++ openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 28 May 2005 15:37:26 -0000 1.3 @@ -1,8 +1,32 @@ + ACS Attribute ID + ACS Attribute IDs + Action + Add + Add an AMS Attribute + Add Attribute + Add Heading + Add List Address + AMS Attribute + AMS Attribute ID + AMS Attribute IDs + AMS Attributes + AMS List + AMS Lists + AMS Option + AMS Options + Answer Optional + Answer Required + Attribute + Attribute Name Checkbox - Multiple Options Allowed + Social Security Number + Social Security Numbers + Work Motivation + Work Motivations Country Andorra United Arab Emirates @@ -243,24 +267,140 @@ South Africa Zambia Zimbabwe + Datatype Date + Define Options + Define Widget + Delete Heading Street + Demo Example Five + Demo Example Four + Demo Example One + Demo Example Six + Demo Example Three + Demo Example Two + Deprecated + Description + Descriptions + Documentation + Edit/Delete Heading Email + Form Preview + Heading Integer is not a valid Canadian postal code is not a valid U.S. State is not a valid U.S. zip code + List Name: + List Name + List Names + Lists + Add a Heading Above: ${attribute_pretty_name} + AMS Attribute <a href=\"attribute?[export_vars -url {ams_attribute_id}]\">$pretty_name</a> Created and Mapped. + AMS Attribute <a href=\"attribute?[export_vars -url {ams_attribute_id}]\">$pretty_name</a> Created. + AMS Lists associated with %object_info.pretty_plural% + An answer from the checked attributes is optional + Attribute Management System + Create and map a new attribute + Description Mime Type + Descriptions Mime Types + Dynamic (added by AMS UI?) + Export code to recreate this list + Here is the code necessary to re-create this ams-list on a new system. You may insert this into your appliation code if you would like to. + If you need to add more options you will be able to do so by editing this attributes again ($default_number_of_options new fields are added to the preexisting count each time you edit an attribute) + List name <a href=\"list?[export_vars -url {package_key object_type list_name}]\">$list_name</a> already exists for <a href=\"object?[export_vars -url {object_type}]\">$object_info(pretty_name)</a>. + Require an answer from the checked attributes + Return to Where You Were + Submitting the preview form does not save any information. + The attribute name automatically generated for conflicts with an attribute that is already in the database. Please make sure you are not creating a duplicate attribute and change the name if not. + The list specified does not exists. You may create it if you like. + The widget specified does not exist + There was a problem with your input + This attribute name already exists. Please make sure you are not creating a duplicate attribute and change the name if not. + This name must be lower case, contain only letters and underscores, and contain no spaces + Unmap check attributes + Update ordering from values in list + You can create a list by <a href="objects">selecting an acs_object</a>. Note that list creation should be done with contracting packages. These lists shows what ams can do for your package. + You cannot delete an option that already has entries on it + You have used invalid characters. + Map + Mapped Attributes Menu - Multiple Options Allowed City + Note: + Object Type: + Object Type + Object Types + Objects + Option + Option 1 + Option 2 + Option 3 + Option 4 + Option 5 + Option 6 + Option 7 + Option 8 + Option 9 + Option Deleted + Option $i + Optional + Options + Options Updated + Ordering + Organization Name + Organization Names + Package Key: + Package Key + Package Keys + Parameters + Email Address + Email Addresses + #acs-kernel.URL# + #acs-kernel.URLs# + Address + Address + #acs-subsite.Biography# + Biography Mime Type + Biography Mime Types + #acs-subsite.Biographies# + Last Name + Last Names + First Names + First Names + erwer + WETGSDFG Zip/Postal Code + Predefined Options + Pretty Name: + Pretty Name + Pretty Names + Pretty Plural: + Pretty Plural + Preview Input Form Radio Buttons - One Option Allowed State/Province + Required Richtext + Save Drop Down List - One Option Allowed Select One + Sort Order + Sort Orders + Table Phone Number Invalid phone number format. Phone Numbers must by either formatted as AAA-999-9999xEEEE for Country Code "1" (i.e. the United States, Canada, etc.) or 011-CCC-AAA-99999999xEEEE for numbers outside country code "1". Where "C" is country code, "A" is area code, "9" is the phone number and "E" is the extension number. Textarea Textbox + Unmap + Unmapped Attributes + Update + Update Options + Update Ordering Website Url + Widget: + Widget + Widget Name + Widgets + Yes Index: openacs-4/packages/ams/sql/postgresql/ams-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/ams-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/ams/sql/postgresql/ams-create.sql 18 May 2005 17:11:48 -0000 1.5 +++ openacs-4/packages/ams/sql/postgresql/ams-create.sql 28 May 2005 15:37:27 -0000 1.6 @@ -1,475 +1,475 @@ --- --- packages/ams/sql/postgresql/ams-create.sql --- --- @author Matthew Geddert openacs@geddert.com --- @creation-date 2004-09-07 --- @cvs-id $Id$ --- --- - - ------- Widgets --------------------------------------------------------------------- --- --- each widget needs to have a ams::widget::${widget} proc associated with it --- --- the value_method is a reference to a proc that will convert the value_id into a useable string for --- the tcl procs. If possible it is best to have a value_method, since this substantailly decreases --- the number of trips that are needed to go the the database. See the example of widgets that come --- with AMS for more details. - -create table ams_widgets ( - widget varchar(100) - constraint ams_widgets_name_pk primary key, - pretty_name varchar(100) - constraint ams_widgets_pretty_name_nn not null, - value_method varchar(100), - active_p boolean -); - - ------- Attributes --------------------------------------------------------------------- - -create table ams_attribute_items ( - attribute_id integer - constraint ams_attribute_items_attribute_id_fk references acs_attributes(attribute_id) - constraint ams_attribute_items_attribute_id_nn not null, - ams_attribute_id integer - constraint ams_attribute_items_ams_attribute_id_fk references acs_objects(object_id) - constraint ams_attribute_items_ams_attribute_id_pk primary key, - widget varchar(100) - constraint ams_attribute_items_widget_fk references ams_widgets(widget) - constraint ams_attribute_items_widget_nn not null, - dynamic_p boolean default 'f' - constraint ams_attribute_items_dynamic_p_nn not null, - deprecated_p boolean default 'f' - constraint ams_attribute_items_deprecated_nn not null, - UNIQUE(attribute_id) -); - -create view ams_attributes as - select acs_attributes.*, - ams_attribute_items.ams_attribute_id, - ams_attribute_items.widget, - ams_attribute_items.dynamic_p, - ams_attribute_items.deprecated_p - from acs_attributes left join ams_attribute_items on ( acs_attributes.attribute_id = ams_attribute_items.attribute_id ); - -select acs_object_type__create_type ( - 'ams_attribute', -- object_type - 'AMS Attribute', -- pretty_name - 'AMS Attributes ', -- pretty_plural - 'acs_object', -- supertype - 'ams_attribute_items', -- table_name - 'ams_attribute_id', -- id_column - 'ams_attribute', -- package_name - 'f', -- abstract_p - null, -- type_extension_table - 'ams_attribute__name' -- name_method -); - -select acs_attribute__create_attribute ( - 'ams_attribute', -- object_type - 'attribute_id', -- attribute_name - 'integer', -- datatype - 'ACS Attribute ID', -- pretty_name - 'ACS Attribute IDs', -- pretty_plural -- default null - null, -- table_name -- default null - 'attribute_id', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_attribute', -- object_type - 'widget', -- attribute_name - 'string', -- datatype - 'Widget', -- pretty_name - 'Widgets', -- pretty_plural -- default null - null, -- table_name -- default null - 'widget', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - --- if uninstalled we can delete acs_attributes dynamically created by --- the ams ui. Howerver we cannot remove attributes added by other --- packages because it could break those packages. - -select acs_attribute__create_attribute ( - 'ams_attribute', -- object_type - 'dynamic_p', -- attribute_name - 'boolean', -- datatype - 'Dynamic (added by AMS UI?)', -- pretty_name - 'Dynamic (added by AMS UI?)', -- pretty_plural -- default null - null, -- table_name -- default null - 'deprecated_p', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_attribute', -- object_type - 'deprecated_p', -- attribute_name - 'boolean', -- datatype - 'Deprecated', -- pretty_name - 'Deprecated', -- pretty_plural -- default null - null, -- table_name -- default null - 'deprecated_p', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - - - ------- Attribute Values --------------------------------------------------------------------- - - - -create table ams_attribute_values ( - object_id integer - constraint ams_attribute_values_object_id_fk references acs_objects(object_id) - constraint ams_attribute_values_object_id_nn not null, - attribute_id integer - constraint ams_attribute_values_attribute_id_fk references acs_attributes(attribute_id) - constraint ams_attribute_values_attribute_id_nn not null, - value_id integer - constraint ams_attribute_values_nn not null -); - - ------- Options --------------------------------------------------------------------- - --- create sequence ams_options_seq; - replace with object key - -create table ams_option_types ( - option_id integer - constraint ams_options_option_id_fk references acs_objects(object_id) - constraint ams_options_option_id_pk primary key, - attribute_id integer - constraint ams_options_attribute_id_nn not null - constraint ams_options_attribute_id_nn references acs_attributes (attribute_id), - option varchar(200) - constraint ams_options_option_nn not null, - sort_order integer - constraint ams_options_sort_order not null, - deprecated_p boolean default 'f' - constraint ams_options_deprecated_nn not null, - unique (attribute_id,sort_order) -); - - -select acs_object_type__create_type ( - 'ams_option', -- object_type - 'AMS Option', -- pretty_name - 'AMS Options', -- pretty_plural - 'acs_object', -- supertype - 'ams_option_types', -- table_name - 'option_id', -- id_column - 'ams_option', -- package_name - 'f', -- abstract_p - null, -- type_extension_table - 'ams_option__name' -- name_method -); - -select acs_attribute__create_attribute ( - 'ams_option', -- object_type - 'attribute_id', -- attribute_name - 'integer', -- datatype - 'AMS Attribute ID', -- pretty_name - 'AMS Attribute IDs', -- pretty_plural -- default null - null, -- table_name -- default null - 'attribute_id', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_option', -- object_type - 'option', -- attribute_name - 'string', -- datatype - 'Option', -- pretty_name - 'Options', -- pretty_plural -- default null - null, -- table_name -- default null - 'option', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_option', -- object_type - 'sort_order', -- attribute_name - 'integer', -- datatype - 'Sort Order', -- pretty_name - 'Sort Orders', -- pretty_plural -- default null - null, -- table_name -- default null - 'sort_order', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_option', -- object_type - 'deprecated_p', -- attribute_name - 'boolean', -- datatype - 'Deprecated', -- pretty_name - 'Deprecated', -- pretty_plural -- default null - null, -- table_name -- default null - 'deprecated_p', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -create table ams_option_ids ( - value_id integer - constraint ams_options_map_ids_value_id_pk primary key -); - -create table ams_options ( - value_id integer - constraint ams_options_value_id_fk references ams_option_ids(value_id) - constraint ams_options_value_id_nn not null, - option_id integer - constraint ams_option_option_id_fk references ams_option_types(option_id) - constraint ams_option_map_option_id_nn not null, - unique (value_id,option_id) -); - ------- AMS Texts --------------------------------------------------------------------- - --- use object_id sequence with object_id this allows --- for future use of option values being converted into objects. - -create table ams_texts ( - value_id integer - constraint ams_texts_text_format_pk primary key, - text text - constraint ams_texts_text_format_nn not null, - text_format varchar(200) default 'text/plain' - constraint ams_texts_text_format_nn not null -); - ------- AMS Times --------------------------------------------------------------------- - --- use object_id sequence with object_id this allows --- for future use of option values being converted into objects. - -create table ams_times ( - value_id integer - constraint ams_times_id_pk primary key, - time timestamptz - constraint ams_times_time_nn not null -); - ------- AMS Numbers --------------------------------------------------------------------- - --- use object_id sequence with object_id this allows --- for future use of option values being converted into objects. - -create table ams_numbers ( - value_id integer - constraint ams_numbers_id_pk primary key, - number numeric - constraint ams_numbers_number_nn not null -); - - - - - ------- Lists --------------------------------------------------------------------- - --- We now create groupings of ams attributes, we call them lists --- since these groupings will be used to create lists of elements --- for ad_form as well as lists of certain attributes to be used --- by other applications. - -create table ams_lists ( - list_id integer - constraint ams_lists_list_id_fk references acs_objects(object_id) - constraint ams_lists_list_id_pk primary key, - package_key varchar(100) - constraint ams_lists_package_key_fk references apm_package_types(package_key) - constraint ams_lists_package_key_nn not null, - object_type varchar(1000) - constraint ams_lists_object_type_fk references acs_object_types(object_type) - constraint ams_lists_object_type_nn not null, - list_name varchar(100) - constraint ams_lists_list_name_nn not null, - pretty_name varchar(200) - constraint ams_lists_pretty_name_nn not null, - description varchar(200), - description_mime_type varchar(200) - constraint ams_lists_description_mime_type_fk references cr_mime_types(mime_type), - UNIQUE(package_key,object_type,list_name) -); - -select acs_object_type__create_type ( - 'ams_list', -- object_type - 'AMS List', -- pretty_name - 'AMS Lists ', -- pretty_plural - 'acs_object', -- supertype - 'ams_lists', -- table_name - 'list_id', -- id_column - 'ams_list', -- package_name - 'f', -- abstract_p - null, -- type_extension_table - 'ams_list__name' -- name_method -); - -select acs_attribute__create_attribute ( - 'ams_list', -- object_type - 'package_key', -- attribute_name - 'string', -- datatype - 'Package Key', -- pretty_name - 'Package Keys', -- pretty_plural -- default null - null, -- table_name -- default null - 'object_type', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_list', -- object_type - 'object_type', -- attribute_name - 'string', -- datatype - 'Object Type', -- pretty_name - 'Object Types', -- pretty_plural -- default null - null, -- table_name -- default null - 'object_type', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_list', -- object_type - 'list_name', -- attribute_name - 'string', -- datatype - 'List Name', -- pretty_name - 'List Names', -- pretty_plural -- default null - null, -- table_name -- default null - 'list_name', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_list', -- object_type - 'pretty_name', -- attribute_name - 'string', -- datatype - 'Pretty Name', -- pretty_name - 'Pretty Names', -- pretty_plural -- default null - null, -- table_name -- default null - 'pretty_name', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_list', -- object_type - 'description', -- attribute_name - 'text', -- datatype - 'Description', -- pretty_name - 'Descriptions', -- pretty_plural -- default null - null, -- table_name -- default null - 'description', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - -select acs_attribute__create_attribute ( - 'ams_list', -- object_type - 'description_mime_type', -- attribute_name - 'text', -- datatype - 'Description Mime Type', -- pretty_name - 'Descriptions Mime Types', -- pretty_plural -- default null - null, -- table_name -- default null - 'description_mime_type', -- column_name -- default null - null, -- default_value -- default null - '1', -- min_n_values -- default 1 - '1', -- max_n_values -- default 1 - null, -- sort_order -- default null - 'type_specific', -- storage -- default 'type_specific' - null -- static_p -- default 'f' -); - --- create sequence ams_list_attribute_sort_order_seq; - -create table ams_list_attribute_map ( - list_id integer - constraint ams_list_attribute_map_list_id_fk references ams_lists(list_id) - constraint ams_list_attribute_map_list_id_nn not null, - attribute_id integer - constraint ams_list_attribute_map_attribute_id_fk references acs_attributes(attribute_id) - constraint ams_list_attribute_map_attribute_id_nn not null, - sort_order integer - constraint ams_list_attribute_map_sort_order_nn not null, - required_p boolean - constraint ams_list_attribute_map_required_p_nn not null, - section_heading varchar(200), - UNIQUE(list_id,attribute_id), - UNIQUE(list_id,sort_order) -); - -\i ams-package-create.sql --- \i populate.sql -\i telecom-number-missing-plsql.sql +-- +-- packages/ams/sql/postgresql/ams-create.sql +-- +-- @author Matthew Geddert openacs@geddert.com +-- @creation-date 2004-09-07 +-- @cvs-id $Id$ +-- +-- + + +------ Widgets +-------------------------------------------------------------------- +-- +-- each widget needs to have a ams::widget::${widget} proc associated with it +-- +-- the value_method is a reference to a proc that will convert the value_id into a useable string for +-- the tcl procs. If possible it is best to have a value_method, since this substantailly decreases +-- the number of trips that are needed to go the the database. See the example of widgets that come +-- with AMS for more details. + +create table ams_widgets ( + widget varchar(100) + constraint ams_widgets_name_pk primary key, + pretty_name varchar(100) + constraint ams_widgets_pretty_name_nn not null, + value_method varchar(100), + active_p boolean +); + + +------ Attributes +-------------------------------------------------------------------- + +create table ams_attribute_items ( + attribute_id integer + constraint ams_attribute_items_attribute_id_fk references acs_attributes(attribute_id) + constraint ams_attribute_items_attribute_id_nn not null, + ams_attribute_id integer + constraint ams_attribute_items_ams_attribute_id_fk references acs_objects(object_id) + constraint ams_attribute_items_ams_attribute_id_pk primary key, + widget varchar(100) + constraint ams_attribute_items_widget_fk references ams_widgets(widget) + constraint ams_attribute_items_widget_nn not null, + dynamic_p boolean default 'f' + constraint ams_attribute_items_dynamic_p_nn not null, + deprecated_p boolean default 'f' + constraint ams_attribute_items_deprecated_nn not null, + UNIQUE(attribute_id) +); + +create view ams_attributes as + select acs_attributes.*, + ams_attribute_items.ams_attribute_id, + ams_attribute_items.widget, + ams_attribute_items.dynamic_p, + ams_attribute_items.deprecated_p + from acs_attributes left join ams_attribute_items on ( acs_attributes.attribute_id = ams_attribute_items.attribute_id ); + +select acs_object_type__create_type ( + 'ams_attribute', -- object_type + '#ams.AMS_Attribute#', -- pretty_name + '#ams.AMS_Attributes#', -- pretty_plural + 'acs_object', -- supertype + 'ams_attribute_items', -- table_name + 'ams_attribute_id', -- id_column + 'ams_attribute', -- package_name + 'f', -- abstract_p + null, -- type_extension_table + 'ams_attribute__name' -- name_method +); + +select acs_attribute__create_attribute ( + 'ams_attribute', -- object_type + 'attribute_id', -- attribute_name + 'integer', -- datatype + '#ams.ACS_Attribute_ID#', -- pretty_name + '#ams.ACS_Attribute_IDs#', -- pretty_plural -- default null + null, -- table_name -- default null + 'attribute_id', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_attribute', -- object_type + 'widget', -- attribute_name + 'string', -- datatype + '#ams.Widget_1#', -- pretty_name + '#ams.Widgets#', -- pretty_plural -- default null + null, -- table_name -- default null + 'widget', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +-- if uninstalled we can delete acs_attributes dynamically created by +-- the ams ui. Howerver we cannot remove attributes added by other +-- packages because it could break those packages. + +select acs_attribute__create_attribute ( + 'ams_attribute', -- object_type + 'dynamic_p', -- attribute_name + 'boolean', -- datatype + '#ams.lt_Dynamic_added_by_AMS_#', -- pretty_name + '#ams.lt_Dynamic_added_by_AMS_#', -- pretty_plural -- default null + null, -- table_name -- default null + 'deprecated_p', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_attribute', -- object_type + 'deprecated_p', -- attribute_name + 'boolean', -- datatype + '#ams.Deprecated#', -- pretty_name + '#ams.Deprecated#', -- pretty_plural -- default null + null, -- table_name -- default null + 'deprecated_p', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + + + +------ Attribute Values +-------------------------------------------------------------------- + + + +create table ams_attribute_values ( + object_id integer + constraint ams_attribute_values_object_id_fk references acs_objects(object_id) + constraint ams_attribute_values_object_id_nn not null, + attribute_id integer + constraint ams_attribute_values_attribute_id_fk references acs_attributes(attribute_id) + constraint ams_attribute_values_attribute_id_nn not null, + value_id integer + constraint ams_attribute_values_nn not null +); + + +------ Options +-------------------------------------------------------------------- + +-- create sequence ams_options_seq; - replace with object key + +create table ams_option_types ( + option_id integer + constraint ams_options_option_id_fk references acs_objects(object_id) + constraint ams_options_option_id_pk primary key, + attribute_id integer + constraint ams_options_attribute_id_nn not null + constraint ams_options_attribute_id_nn references acs_attributes (attribute_id), + option varchar(200) + constraint ams_options_option_nn not null, + sort_order integer + constraint ams_options_sort_order not null, + deprecated_p boolean default 'f' + constraint ams_options_deprecated_nn not null, + unique (attribute_id,sort_order) +); + + +select acs_object_type__create_type ( + 'ams_option', -- object_type + '#ams.AMS_Option#', -- pretty_name + '#ams.AMS_Options#', -- pretty_plural + 'acs_object', -- supertype + 'ams_option_types', -- table_name + 'option_id', -- id_column + 'ams_option', -- package_name + 'f', -- abstract_p + null, -- type_extension_table + 'ams_option__name' -- name_method +); + +select acs_attribute__create_attribute ( + 'ams_option', -- object_type + 'attribute_id', -- attribute_name + 'integer', -- datatype + '#ams.AMS_Attribute_ID#', -- pretty_name + '#ams.AMS_Attribute_IDs#', -- pretty_plural -- default null + null, -- table_name -- default null + 'attribute_id', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_option', -- object_type + 'option', -- attribute_name + 'string', -- datatype + '#ams.Option#', -- pretty_name + '#ams.Options#', -- pretty_plural -- default null + null, -- table_name -- default null + 'option', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_option', -- object_type + 'sort_order', -- attribute_name + 'integer', -- datatype + '#ams.Sort_Order#', -- pretty_name + '#ams.Sort_Orders#', -- pretty_plural -- default null + null, -- table_name -- default null + 'sort_order', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_option', -- object_type + 'deprecated_p', -- attribute_name + 'boolean', -- datatype + '#ams.Deprecated#', -- pretty_name + '#ams.Deprecated#', -- pretty_plural -- default null + null, -- table_name -- default null + 'deprecated_p', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +create table ams_option_ids ( + value_id integer + constraint ams_options_map_ids_value_id_pk primary key +); + +create table ams_options ( + value_id integer + constraint ams_options_value_id_fk references ams_option_ids(value_id) + constraint ams_options_value_id_nn not null, + option_id integer + constraint ams_option_option_id_fk references ams_option_types(option_id) + constraint ams_option_map_option_id_nn not null, + unique (value_id,option_id) +); + +------ AMS Texts +-------------------------------------------------------------------- + +-- use object_id sequence with object_id this allows +-- for future use of option values being converted into objects. + +create table ams_texts ( + value_id integer + constraint ams_texts_text_format_pk primary key, + text text + constraint ams_texts_text_format_nn not null, + text_format varchar(200) default 'text/plain' + constraint ams_texts_text_format_nn not null +); + +------ AMS Times +-------------------------------------------------------------------- + +-- use object_id sequence with object_id this allows +-- for future use of option values being converted into objects. + +create table ams_times ( + value_id integer + constraint ams_times_id_pk primary key, + time timestamptz + constraint ams_times_time_nn not null +); + +------ AMS Numbers +-------------------------------------------------------------------- + +-- use object_id sequence with object_id this allows +-- for future use of option values being converted into objects. + +create table ams_numbers ( + value_id integer + constraint ams_numbers_id_pk primary key, + number numeric + constraint ams_numbers_number_nn not null +); + + + + + +------ Lists +-------------------------------------------------------------------- + +-- We now create groupings of ams attributes, we call them lists +-- since these groupings will be used to create lists of elements +-- for ad_form as well as lists of certain attributes to be used +-- by other applications. + +create table ams_lists ( + list_id integer + constraint ams_lists_list_id_fk references acs_objects(object_id) + constraint ams_lists_list_id_pk primary key, + package_key varchar(100) + constraint ams_lists_package_key_fk references apm_package_types(package_key) + constraint ams_lists_package_key_nn not null, + object_type varchar(1000) + constraint ams_lists_object_type_fk references acs_object_types(object_type) + constraint ams_lists_object_type_nn not null, + list_name varchar(100) + constraint ams_lists_list_name_nn not null, + pretty_name varchar(200) + constraint ams_lists_pretty_name_nn not null, + description varchar(200), + description_mime_type varchar(200) + constraint ams_lists_description_mime_type_fk references cr_mime_types(mime_type), + UNIQUE(package_key,object_type,list_name) +); + +select acs_object_type__create_type ( + 'ams_list', -- object_type + '#ams.AMS_List#', -- pretty_name + '#ams.AMS_Lists#', -- pretty_plural + 'acs_object', -- supertype + 'ams_lists', -- table_name + 'list_id', -- id_column + 'ams_list', -- package_name + 'f', -- abstract_p + null, -- type_extension_table + 'ams_list__name' -- name_method +); + +select acs_attribute__create_attribute ( + 'ams_list', -- object_type + 'package_key', -- attribute_name + 'string', -- datatype + '#ams.Package_Key_1#', -- pretty_name + '#ams.Package_Keys#', -- pretty_plural -- default null + null, -- table_name -- default null + 'object_type', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_list', -- object_type + 'object_type', -- attribute_name + 'string', -- datatype + '#ams.Object_Type_1#', -- pretty_name + '#ams.Object_Types#', -- pretty_plural -- default null + null, -- table_name -- default null + 'object_type', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_list', -- object_type + 'list_name', -- attribute_name + 'string', -- datatype + '#ams.List_Name_1#', -- pretty_name + '#ams.List_Names#', -- pretty_plural -- default null + null, -- table_name -- default null + 'list_name', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_list', -- object_type + 'pretty_name', -- attribute_name + 'string', -- datatype + '#ams.Pretty_Name_1#', -- pretty_name + '#ams.Pretty_Names#', -- pretty_plural -- default null + null, -- table_name -- default null + 'pretty_name', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_list', -- object_type + 'description', -- attribute_name + 'text', -- datatype + '#ams.Description#', -- pretty_name + '#ams.Descriptions#', -- pretty_plural -- default null + null, -- table_name -- default null + 'description', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +select acs_attribute__create_attribute ( + 'ams_list', -- object_type + 'description_mime_type', -- attribute_name + 'text', -- datatype + '#ams.lt_Description_Mime_Type#', -- pretty_name + '#ams.lt_Descriptions_Mime_Typ#', -- pretty_plural -- default null + null, -- table_name -- default null + 'description_mime_type', -- column_name -- default null + null, -- default_value -- default null + '1', -- min_n_values -- default 1 + '1', -- max_n_values -- default 1 + null, -- sort_order -- default null + 'type_specific', -- storage -- default 'type_specific' + null -- static_p -- default 'f' +); + +-- create sequence ams_list_attribute_sort_order_seq; + +create table ams_list_attribute_map ( + list_id integer + constraint ams_list_attribute_map_list_id_fk references ams_lists(list_id) + constraint ams_list_attribute_map_list_id_nn not null, + attribute_id integer + constraint ams_list_attribute_map_attribute_id_fk references acs_attributes(attribute_id) + constraint ams_list_attribute_map_attribute_id_nn not null, + sort_order integer + constraint ams_list_attribute_map_sort_order_nn not null, + required_p boolean + constraint ams_list_attribute_map_required_p_nn not null, + section_heading varchar(200), + UNIQUE(list_id,attribute_id), + UNIQUE(list_id,sort_order) +); + +\i ams-package-create.sql +-- \i populate.sql +\i telecom-number-missing-plsql.sql Index: openacs-4/packages/ams/sql/postgresql/ams-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/ams-drop.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/sql/postgresql/ams-drop.sql 18 May 2005 17:11:48 -0000 1.4 +++ openacs-4/packages/ams/sql/postgresql/ams-drop.sql 28 May 2005 15:37:27 -0000 1.5 @@ -1,86 +1,86 @@ --- --- packages/ams/sql/postgresql/ams-drop.sql --- --- @author Matthew Geddert openacs@geddert.com --- @creation-date 2004-09-07 --- @cvs-id $Id$ --- --- - - - - -create or replace function inline_1 () -returns varchar as ' -declare - rec RECORD; -begin - - FOR rec IN - select value_id - from ams_attribute_values - LOOP - delete from ams_attribute_values where address_id = rec.value_id; - PERFORM postal_address__del (rec.value_id); - END LOOP; - - return ''All Postal Addresses associated with AMS have been deleted''; -end;' language 'plpgsql'; - -select inline_1() as Notice; -drop function inline_1(); - -create or replace function inline_2 () -returns varchar as ' -declare - rec RECORD; -begin - - FOR rec IN - select value_id - from ams_attribute_values - where value_id is not null - LOOP - delete from ams_attribute_values where number_id = rec.value_id; - PERFORM telecom_number__del (rec.value_id); - END LOOP; - - - return ''All Telecom Numbers Addresses associated with AMS have been deleted''; -end;' language 'plpgsql'; - -select inline_2() as Notice; -drop function inline_2(); - - -delete from ams_attribute_values; -select ams_attribute__delete(attribute_id) - from ams_attributes - where ams_attribute_id is not null; - -select drop_package('ams_option'); -select drop_package('ams_attribute'); -select drop_package('ams_list'); -select drop_package('ams_value'); -select drop_package('ams_widget'); - --- select acs_object__delete(address_id) from ams_attribute_values where address_id is not null; --- select acs_object__delete(number_id) from ams_attribute_values where number_id is not null; - -drop table ams_list_attribute_map; -drop table ams_lists; -drop table ams_options; -drop table ams_option_ids; -drop table ams_numbers; -drop table ams_times; -drop table ams_texts; -drop table ams_option_types; -drop table ams_attribute_values; -drop view ams_attributes; -drop table ams_attribute_items; -drop table ams_widgets; - -delete from acs_objects where object_type in ('ams_attribute','ams_list','ams_option'); -select acs_object_type__drop_type('ams_attribute','f'); -select acs_object_type__drop_type('ams_list','f'); -select acs_object_type__drop_type('ams_option','f'); +-- +-- packages/ams/sql/postgresql/ams-drop.sql +-- +-- @author Matthew Geddert openacs@geddert.com +-- @creation-date 2004-09-07 +-- @cvs-id $Id$ +-- +-- + + + + +create or replace function inline_1 () +returns varchar as ' +declare + rec RECORD; +begin + + FOR rec IN + select value_id + from ams_attribute_values + LOOP + delete from ams_attribute_values where address_id = rec.value_id; + PERFORM postal_address__del (rec.value_id); + END LOOP; + + return ''All Postal Addresses associated with AMS have been deleted''; +end;' language 'plpgsql'; + +select inline_1() as Notice; +drop function inline_1(); + +create or replace function inline_2 () +returns varchar as ' +declare + rec RECORD; +begin + + FOR rec IN + select value_id + from ams_attribute_values + where value_id is not null + LOOP + delete from ams_attribute_values where number_id = rec.value_id; + PERFORM telecom_number__del (rec.value_id); + END LOOP; + + + return ''All Telecom Numbers Addresses associated with AMS have been deleted''; +end;' language 'plpgsql'; + +select inline_2() as Notice; +drop function inline_2(); + + +delete from ams_attribute_values; +select ams_attribute__delete(attribute_id) + from ams_attributes + where ams_attribute_id is not null; + +select drop_package('ams_option'); +select drop_package('ams_attribute'); +select drop_package('ams_list'); +select drop_package('ams_value'); +select drop_package('ams_widget'); + +-- select acs_object__delete(address_id) from ams_attribute_values where address_id is not null; +-- select acs_object__delete(number_id) from ams_attribute_values where number_id is not null; + +drop table ams_list_attribute_map; +drop table ams_lists; +drop table ams_options; +drop table ams_option_ids; +drop table ams_numbers; +drop table ams_times; +drop table ams_texts; +drop table ams_option_types; +drop table ams_attribute_values; +drop view ams_attributes; +drop table ams_attribute_items; +drop table ams_widgets; + +delete from acs_objects where object_type in ('ams_attribute','ams_list','ams_option'); +select acs_object_type__drop_type('ams_attribute','f'); +select acs_object_type__drop_type('ams_list','f'); +select acs_object_type__drop_type('ams_option','f'); Index: openacs-4/packages/ams/sql/postgresql/populate.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/populate.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ams/sql/postgresql/populate.sql 18 May 2005 17:11:48 -0000 1.3 +++ openacs-4/packages/ams/sql/postgresql/populate.sql 28 May 2005 15:37:27 -0000 1.4 @@ -1,430 +1,430 @@ --- --- packages/ams/sql/postgresql/populate.sql --- --- @author Matthew Geddert openacs@geddert.com --- @creation-date 2004-09-07 --- @cvs-id $Id$ --- --- - -insert into ams_storage_types ( storage_type ) values ( 'telecom_number' ); -insert into ams_storage_types ( storage_type ) values ( 'postal_address' ); -insert into ams_storage_types ( storage_type ) values ( 'ams_options' ); -insert into ams_storage_types ( storage_type ) values ( 'time' ); -insert into ams_storage_types ( storage_type ) values ( 'value' ); -insert into ams_storage_types ( storage_type ) values ( 'value_with_mime_type' ); - --- --- Note, I am very open to adding new unique widgets. --- I am simply adding those I personally could imagine --- needing in the near future for my projects. I am sure --- that there will be others that other programmers need. --- So, If you would like a new widget and possibly a new --- storage type added to the default configuration of --- this package please contact me. --- -- Matthew --- - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'postal_address', - '#ams.Address#', - '#ams.Addresses#', - 'postal_address', - 'string', - 'address', - 'address', - null -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'telecom_number', - '#ams.Telecom_Number#', - '#ams.Telecom_Numbers#', - 'telecom_number', - 'string', - 'telecom_number', - 'telecom_number', - '{html {size 12 maxlenth 50}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'date', - '#ams.Date#', - '#ams.Date#', - 'time', - 'date', - 'date', - 'date', - '{help}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'select', - '#ams.Select# - #ams.One_Option_Allowed#', - '#ams.Selects# - #ams.One_Option_Allowed#', - 'ams_options', - 'string', - 'select', - 'integer', - null -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'radio', - '#ams.Radio# - #ams.One_Option_Allowed#', - '#ams.Radios# - #ams.One_Option_Allowed#', - 'ams_options', - 'string', - 'radio', - 'integer', - null -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'checkbox', - '#ams.Checkboxes# - #ams.Multiple_Options_Allowed#', - '#ams.Checkboxes# - #ams.Multiple_Options_Allowed#', - 'ams_options', - 'string', - 'checkbox', - 'integer', - '{multiple}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'multiselect', - '#ams.Multiselect# - #ams.Multiple_Options_Allowed#', - '#ams.Multiselects# - #ams.Multiple_Options_Allowed#', - 'ams_options', - 'string', - 'multiselect', - 'integer', - '{multiple}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'multiselect_single', - '#ams.Multiselect# - #ams.One_Option_Allowed#', - '#ams.Multiselects# - #ams.One_Option_Allowed#', - 'ams_options', - 'string', - 'multiselect', - 'integer', - null -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'integer', - '#ams.Integer#', - '#ams.Integers#', - 'value', - 'integer', - 'text', - 'integer', - '{html {size 6}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textbox_small', - '#ams.Textbox# - #ams.Small#', - '#ams.Textboxes# - #ams.Small#', - 'value', - 'string', - 'text', - 'text', - '{html {size 18}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textbox_medium', - '#ams.Textbox# - #ams.Medium#', - '#ams.Textboxes# - #ams.Medium#', - 'value', - 'string', - 'text', - 'text', - '{html {size 30}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textbox_large', - '#ams.Textbox# - #ams.Large#', - '#ams.Textboxes# - #ams.Large#', - 'value', - 'string', - 'text', - 'text', - '{html {size 50}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textarea_small', - '#ams.Textarea# - #ams.Small#', - '#ams.Textareas# - #ams.Small#', - 'value', - 'text', - 'textarea', - 'text', - '{html {cols 60 rows 6}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textarea_small_nospell', - '#ams.Textarea# - #ams.Small# - #ams.No_Spellcheck#', - '#ams.Textareas# - #ams.Small# - #ams.No_Spellcheck#', - 'value', - 'text', - 'textarea', - 'text', - '{html {cols 60 rows 6}} {nospell}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textarea_medium', - '#ams.Textarea# - #ams.Medium#', - '#ams.Textareas# - #ams.Medium#', - 'value', - 'text', - 'textarea', - 'text', - '{html {cols 80 rows 10}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'textarea_large', - '#ams.Textarea# - #ams.Large#', - '#ams.Textareas# - #ams.Large#', - 'value', - 'text', - 'textarea', - 'text', - '{html {cols 80 rows 24}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'richtext_medium', - '#ams.Richtext# - #ams.Medium#', - '#ams.Richtexts# - #ams.Medium#', - 'value_with_mime_type', - 'text', - 'richtext', - 'richtext', - '{html {cols 80 rows 10}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'richtext_large', - '#ams.Richtext# - #ams.Large#', - '#ams.Richtexts# - #ams.Large#', - 'value_with_mime_type', - 'text', - 'richtext', - 'richtext', - '{html {cols 80 rows 24}}' -); - - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'email', - '#ams.Email_Address#', - '#ams.Email_Addresses#', - 'value', - 'email', - 'text', - 'email', - '{html {size 30}}' -); - -insert into ams_widgets ( - widget_name, - pretty_name, - pretty_plural, - storage_type, - acs_datatype, - widget, - datatype, - parameters -) values ( - 'url', - '#ams.Url#', - '#ams.Urls#', - 'value', - 'url', - 'text', - 'url', - '{html {size 30}}' -); - - - +-- +-- packages/ams/sql/postgresql/populate.sql +-- +-- @author Matthew Geddert openacs@geddert.com +-- @creation-date 2004-09-07 +-- @cvs-id $Id$ +-- +-- + +insert into ams_storage_types ( storage_type ) values ( 'telecom_number' ); +insert into ams_storage_types ( storage_type ) values ( 'postal_address' ); +insert into ams_storage_types ( storage_type ) values ( 'ams_options' ); +insert into ams_storage_types ( storage_type ) values ( 'time' ); +insert into ams_storage_types ( storage_type ) values ( 'value' ); +insert into ams_storage_types ( storage_type ) values ( 'value_with_mime_type' ); + +-- +-- Note, I am very open to adding new unique widgets. +-- I am simply adding those I personally could imagine +-- needing in the near future for my projects. I am sure +-- that there will be others that other programmers need. +-- So, If you would like a new widget and possibly a new +-- storage type added to the default configuration of +-- this package please contact me. +-- -- Matthew +-- + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'postal_address', + '#ams.Address#', + '#ams.Addresses#', + 'postal_address', + 'string', + 'address', + 'address', + null +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'telecom_number', + '#ams.Telecom_Number#', + '#ams.Telecom_Numbers#', + 'telecom_number', + 'string', + 'telecom_number', + 'telecom_number', + '{html {size 12 maxlenth 50}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'date', + '#ams.Date#', + '#ams.Date#', + 'time', + 'date', + 'date', + 'date', + '{help}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'select', + '#ams.Select# - #ams.One_Option_Allowed#', + '#ams.Selects# - #ams.One_Option_Allowed#', + 'ams_options', + 'string', + 'select', + 'integer', + null +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'radio', + '#ams.Radio# - #ams.One_Option_Allowed#', + '#ams.Radios# - #ams.One_Option_Allowed#', + 'ams_options', + 'string', + 'radio', + 'integer', + null +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'checkbox', + '#ams.Checkboxes# - #ams.Multiple_Options_Allowed#', + '#ams.Checkboxes# - #ams.Multiple_Options_Allowed#', + 'ams_options', + 'string', + 'checkbox', + 'integer', + '{multiple}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'multiselect', + '#ams.Multiselect# - #ams.Multiple_Options_Allowed#', + '#ams.Multiselects# - #ams.Multiple_Options_Allowed#', + 'ams_options', + 'string', + 'multiselect', + 'integer', + '{multiple}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'multiselect_single', + '#ams.Multiselect# - #ams.One_Option_Allowed#', + '#ams.Multiselects# - #ams.One_Option_Allowed#', + 'ams_options', + 'string', + 'multiselect', + 'integer', + null +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'integer', + '#ams.Integer#', + '#ams.Integers#', + 'value', + 'integer', + 'text', + 'integer', + '{html {size 6}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textbox_small', + '#ams.Textbox# - #ams.Small#', + '#ams.Textboxes# - #ams.Small#', + 'value', + 'string', + 'text', + 'text', + '{html {size 18}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textbox_medium', + '#ams.Textbox# - #ams.Medium#', + '#ams.Textboxes# - #ams.Medium#', + 'value', + 'string', + 'text', + 'text', + '{html {size 30}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textbox_large', + '#ams.Textbox# - #ams.Large#', + '#ams.Textboxes# - #ams.Large#', + 'value', + 'string', + 'text', + 'text', + '{html {size 50}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textarea_small', + '#ams.Textarea# - #ams.Small#', + '#ams.Textareas# - #ams.Small#', + 'value', + 'text', + 'textarea', + 'text', + '{html {cols 60 rows 6}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textarea_small_nospell', + '#ams.Textarea# - #ams.Small# - #ams.No_Spellcheck#', + '#ams.Textareas# - #ams.Small# - #ams.No_Spellcheck#', + 'value', + 'text', + 'textarea', + 'text', + '{html {cols 60 rows 6}} {nospell}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textarea_medium', + '#ams.Textarea# - #ams.Medium#', + '#ams.Textareas# - #ams.Medium#', + 'value', + 'text', + 'textarea', + 'text', + '{html {cols 80 rows 10}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'textarea_large', + '#ams.Textarea# - #ams.Large#', + '#ams.Textareas# - #ams.Large#', + 'value', + 'text', + 'textarea', + 'text', + '{html {cols 80 rows 24}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'richtext_medium', + '#ams.Richtext# - #ams.Medium#', + '#ams.Richtexts# - #ams.Medium#', + 'value_with_mime_type', + 'text', + 'richtext', + 'richtext', + '{html {cols 80 rows 10}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'richtext_large', + '#ams.Richtext# - #ams.Large#', + '#ams.Richtexts# - #ams.Large#', + 'value_with_mime_type', + 'text', + 'richtext', + 'richtext', + '{html {cols 80 rows 24}}' +); + + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'email', + '#ams.Email_Address#', + '#ams.Email_Addresses#', + 'value', + 'email', + 'text', + 'email', + '{html {size 30}}' +); + +insert into ams_widgets ( + widget_name, + pretty_name, + pretty_plural, + storage_type, + acs_datatype, + widget, + datatype, + parameters +) values ( + 'url', + '#ams.Url#', + '#ams.Urls#', + 'value', + 'url', + 'text', + 'url', + '{html {size 30}}' +); + + + Index: openacs-4/packages/ams/sql/postgresql/telecom-number-missing-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/telecom-number-missing-plsql.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/sql/postgresql/telecom-number-missing-plsql.sql 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/sql/postgresql/telecom-number-missing-plsql.sql 28 May 2005 15:37:27 -0000 1.3 @@ -1,43 +1,43 @@ --- --- packages/ams/sql/postgresql/telecom-number-missing-plsql.sql --- --- @author Matthew Geddert openacs@geddert.com --- @creation-date 2004-09-07 --- @cvs-id $Id$ --- --- - --- --- This file can safely be deleted once telecom number fixes a bug #2099 --- I filed that has this code commented out --- - -create function inline_0 () -returns integer as ' -declare - v_telecom_number_p boolean; -begin - v_telecom_number_p := ''1'' from acs_object_types where object_type = ''telecom_number''; - - if v_telecom_number_p then - else - PERFORM acs_object_type__create_type ( - ''telecom_number'', -- object_type - ''Telecom Number'', -- pretty_name - ''Telecom Number'', -- pretty_plural - ''acs_object'', -- supertype - ''telecom_numbers'', -- table_name - ''number_id'', -- id_column - ''telecom_number'', -- package_name - ''f'', -- abstract_p - null, -- type_extension_table - null -- name_method - ); - end if; - - return 0; -end;' language 'plpgsql'; - -select inline_0 (); - -drop function inline_0 (); +-- +-- packages/ams/sql/postgresql/telecom-number-missing-plsql.sql +-- +-- @author Matthew Geddert openacs@geddert.com +-- @creation-date 2004-09-07 +-- @cvs-id $Id$ +-- +-- + +-- +-- This file can safely be deleted once telecom number fixes a bug #2099 +-- I filed that has this code commented out +-- + +create function inline_0 () +returns integer as ' +declare + v_telecom_number_p boolean; +begin + v_telecom_number_p := ''1'' from acs_object_types where object_type = ''telecom_number''; + + if v_telecom_number_p then + else + PERFORM acs_object_type__create_type ( + ''telecom_number'', -- object_type + ''Telecom Number'', -- pretty_name + ''Telecom Number'', -- pretty_plural + ''acs_object'', -- supertype + ''telecom_numbers'', -- table_name + ''number_id'', -- id_column + ''telecom_number'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + end if; + + return 0; +end;' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); Index: openacs-4/packages/ams/tcl/ams-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-init.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ams/tcl/ams-init.tcl 18 May 2005 17:11:48 -0000 1.1 +++ openacs-4/packages/ams/tcl/ams-init.tcl 28 May 2005 15:37:27 -0000 1.2 @@ -1,9 +1,9 @@ -ad_library { - Initialization for ams. - - @creation-date 2005-02-10 - @author Matthew Geddert (openacs@geddert.com) - @cvs-id $Id$ -} - -ams::widgets_init +ad_library { + Initialization for ams. + + @creation-date 2005-02-10 + @author Matthew Geddert (openacs@geddert.com) + @cvs-id $Id$ +} + +ams::widgets_init Index: openacs-4/packages/ams/tcl/ams-list-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-list-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ams/tcl/ams-list-procs.tcl 18 May 2005 17:11:48 -0000 1.1 +++ openacs-4/packages/ams/tcl/ams-list-procs.tcl 28 May 2005 15:37:27 -0000 1.2 @@ -1,232 +1,232 @@ -ad_library { - - list procs for the ams package - - @author Matthew Geddert openacs@geddert.com - @creation-date 2005-02-14 - @cvs-id $Id$ - -} - -namespace eval ams:: {} -namespace eval ams::list:: {} -namespace eval ams::list::attribute:: {} - -ad_proc -public ams::list::url { - -package_key:required - -object_type:required - -list_name:required - {-pretty_name ""} - {-description ""} - {-return_url ""} - {-return_url_label "Return to Where You Were"} -} { -} { - return [export_vars -base "/ams/list" -url {package_key object_type list_name pretty_name description return_url return_url_label}] -} - -ad_proc -public ams::list::get { - -list_id:required - -array:required -} { - Get the info on an ams_attribute -} { - upvar 1 $array row - db_1row select_list_info {} -column_array row -} - -ad_proc -private ams::list::ams_attribute_ids_not_cached { - -list_id:required -} { - Get a list of ams_attributes. - - @return list of ams_attribute_ids, in the correct order - - @see ams::list::ams_attribute_ids - @see ams::list::ams_attribute_ids_flush -} { - return [db_list ams_attribute_ids {}] -} - -ad_proc -private ams::list::ams_attribute_ids { - -list_id:required -} { - get this lists ams_attribute_ids. Cached. - - @return list of ams_attribute_ids, in the correct order - - @see ams::list::ams_attribute_ids_not_cached - @see ams::list::ams_attribute_ids_flush -} { - return [util_memoize [list ams::list::ams_attribute_ids_not_cached -list_id $list_id]] -} - -ad_proc -private ams::list::ams_attribute_ids_flush { - -list_id:required -} { - Flush this lists ams_attribute_ids cache. - - @return list of ams_attribute_ids, in the correct order - - @see ams::list::ams_attribute_ids_not_cached - @see ams::list::ams_attribute_ids -} { - return [util_memoize_flush [list ams::list::ams_attribute_ids_not_cached -list_id $list_id]] -} - - - -ad_proc -private ams::list::exists_p { - -package_key:required - -object_type:required - -list_name:required -} { - does an ams list like this exist? - - @return 1 if the list exists for this object_type and package_key and 0 if the does not exist -} { - set list_id [ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name] - if { [exists_and_not_null list_id] } { - return 1 - } else { - return 0 - } -} - -ad_proc -private ams::list::flush { - -package_key:required - -object_type:required - -list_name:required -} { - flush all inte info we have on an ams_list - - @return 1 if the list exists for this object_type and package_key and 0 if the does not exist -} { - ams::list::ams_attribute_ids_flush -list_id [ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name] - ams::list::get_list_id_flush -package_key $package_key -object_type $object_type -list_name $list_name -} - -ad_proc -private ams::list::get_list_id { - -package_key:required - -object_type:required - -list_name:required -} { - - return the list_id for the given parameters. Chached. - - @return list_id if none exists then it returns blank -} { - return [util_memoize [list ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name]] -} - - -ad_proc -private ams::list::get_list_id_not_cached { - -package_key:required - -object_type:required - -list_name:required -} { - return the list_id for the given parameters - - @return list_id if none exists then it returns blank -} { - - return [db_string get_list_id {} -default {}] -} - -ad_proc -private ams::list::get_list_id_flush { - -package_key:required - -object_type:required - -list_name:required -} { - - flush the memorized list_id for the given parameters. - - @return list_id if none exists then it returns blank -} { - return [util_memoize_flush [list ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name]] -} - -ad_proc -public ams::list::new { - {-list_id ""} - -package_key:required - -object_type:required - -list_name:required - -pretty_name:required - {-description ""} - {-description_mime_type "text/plain"} - {-context_id ""} -} { - create a new ams_group - - @return group_id -} { - if { [empty_string_p $context_id] } { - set context_id [ams::package_id] - } - if { ![exists_and_not_null description] } { - set description_mime_type "" - } - - set extra_vars [ns_set create] - oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list { list_id package_key object_type list_name pretty_name description description_mime_type } - set list_id [package_instantiate_object -extra_vars $extra_vars ams_list] - - return $list_id -} - - - -ad_proc -public ams::list::attribute::map { - -list_id:required - -attribute_id:required - {-sort_order ""} - {-required_p "f"} - {-section_heading ""} -} { - Map an ams option for an attribute to an option_map_id, if no value is supplied for option_map_id a new option_map_id will be created. - - @param sort_order if null then the attribute will be placed as the last attribute in this groups sort order - - @return option_map_id -} { - if { ![exists_and_not_null sort_order] } { - set sort_order [expr 1 + [db_string get_highest_sort_order {} -default "0"]] - } - return [db_exec_plsql ams_list_attribute_map {}] -} - -ad_proc -public ams::list::attribute::unmap { - -list_id:required - -attribute_id:required -} { - Unmap an ams option from an ams list -} { - db_dml ams_list_attribute_unmap {} -} - -ad_proc -public ams::list::attribute::required { - -list_id:required - -attribute_id:required -} { - Specify and ams_attribute as required in an ams list -} { - db_dml ams_list_attribute_required {} -} - -ad_proc -public ams::list::attribute::optional { - -list_id:required - -attribute_id:required -} { - Specify and ams_attribute as optional in an ams list -} { - db_dml ams_list_attribute_optional {} -} - - - - - - - - - +ad_library { + + list procs for the ams package + + @author Matthew Geddert openacs@geddert.com + @creation-date 2005-02-14 + @cvs-id $Id$ + +} + +namespace eval ams:: {} +namespace eval ams::list:: {} +namespace eval ams::list::attribute:: {} + +ad_proc -public ams::list::url { + -package_key:required + -object_type:required + -list_name:required + {-pretty_name ""} + {-description ""} + {-return_url ""} + {-return_url_label "Return to Where You Were"} +} { +} { + return [export_vars -base "/ams/list" -url {package_key object_type list_name pretty_name description return_url return_url_label}] +} + +ad_proc -public ams::list::get { + -list_id:required + -array:required +} { + Get the info on an ams_attribute +} { + upvar 1 $array row + db_1row select_list_info {} -column_array row +} + +ad_proc -private ams::list::ams_attribute_ids_not_cached { + -list_id:required +} { + Get a list of ams_attributes. + + @return list of ams_attribute_ids, in the correct order + + @see ams::list::ams_attribute_ids + @see ams::list::ams_attribute_ids_flush +} { + return [db_list ams_attribute_ids {}] +} + +ad_proc -private ams::list::ams_attribute_ids { + -list_id:required +} { + get this lists ams_attribute_ids. Cached. + + @return list of ams_attribute_ids, in the correct order + + @see ams::list::ams_attribute_ids_not_cached + @see ams::list::ams_attribute_ids_flush +} { + return [util_memoize [list ams::list::ams_attribute_ids_not_cached -list_id $list_id]] +} + +ad_proc -private ams::list::ams_attribute_ids_flush { + -list_id:required +} { + Flush this lists ams_attribute_ids cache. + + @return list of ams_attribute_ids, in the correct order + + @see ams::list::ams_attribute_ids_not_cached + @see ams::list::ams_attribute_ids +} { + return [util_memoize_flush [list ams::list::ams_attribute_ids_not_cached -list_id $list_id]] +} + + + +ad_proc -private ams::list::exists_p { + -package_key:required + -object_type:required + -list_name:required +} { + does an ams list like this exist? + + @return 1 if the list exists for this object_type and package_key and 0 if the does not exist +} { + set list_id [ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name] + if { [exists_and_not_null list_id] } { + return 1 + } else { + return 0 + } +} + +ad_proc -private ams::list::flush { + -package_key:required + -object_type:required + -list_name:required +} { + flush all inte info we have on an ams_list + + @return 1 if the list exists for this object_type and package_key and 0 if the does not exist +} { + ams::list::ams_attribute_ids_flush -list_id [ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name] + ams::list::get_list_id_flush -package_key $package_key -object_type $object_type -list_name $list_name +} + +ad_proc -private ams::list::get_list_id { + -package_key:required + -object_type:required + -list_name:required +} { + + return the list_id for the given parameters. Chached. + + @return list_id if none exists then it returns blank +} { + return [util_memoize [list ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name]] +} + + +ad_proc -private ams::list::get_list_id_not_cached { + -package_key:required + -object_type:required + -list_name:required +} { + return the list_id for the given parameters + + @return list_id if none exists then it returns blank +} { + + return [db_string get_list_id {} -default {}] +} + +ad_proc -private ams::list::get_list_id_flush { + -package_key:required + -object_type:required + -list_name:required +} { + + flush the memorized list_id for the given parameters. + + @return list_id if none exists then it returns blank +} { + return [util_memoize_flush [list ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $list_name]] +} + +ad_proc -public ams::list::new { + {-list_id ""} + -package_key:required + -object_type:required + -list_name:required + -pretty_name:required + {-description ""} + {-description_mime_type "text/plain"} + {-context_id ""} +} { + create a new ams_group + + @return group_id +} { + if { [empty_string_p $context_id] } { + set context_id [ams::package_id] + } + if { ![exists_and_not_null description] } { + set description_mime_type "" + } + + set extra_vars [ns_set create] + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list { list_id package_key object_type list_name pretty_name description description_mime_type } + set list_id [package_instantiate_object -extra_vars $extra_vars ams_list] + + return $list_id +} + + + +ad_proc -public ams::list::attribute::map { + -list_id:required + -attribute_id:required + {-sort_order ""} + {-required_p "f"} + {-section_heading ""} +} { + Map an ams option for an attribute to an option_map_id, if no value is supplied for option_map_id a new option_map_id will be created. + + @param sort_order if null then the attribute will be placed as the last attribute in this groups sort order + + @return option_map_id +} { + if { ![exists_and_not_null sort_order] } { + set sort_order [expr 1 + [db_string get_highest_sort_order {} -default "0"]] + } + return [db_exec_plsql ams_list_attribute_map {}] +} + +ad_proc -public ams::list::attribute::unmap { + -list_id:required + -attribute_id:required +} { + Unmap an ams option from an ams list +} { + db_dml ams_list_attribute_unmap {} +} + +ad_proc -public ams::list::attribute::required { + -list_id:required + -attribute_id:required +} { + Specify and ams_attribute as required in an ams list +} { + db_dml ams_list_attribute_required {} +} + +ad_proc -public ams::list::attribute::optional { + -list_id:required + -attribute_id:required +} { + Specify and ams_attribute as optional in an ams list +} { + db_dml ams_list_attribute_optional {} +} + + + + + + + + + Index: openacs-4/packages/ams/tcl/recurrence-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/recurrence-widget-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ams/tcl/recurrence-widget-procs.tcl 18 May 2005 17:11:48 -0000 1.1 +++ openacs-4/packages/ams/tcl/recurrence-widget-procs.tcl 28 May 2005 15:37:27 -0000 1.2 @@ -1,265 +1,265 @@ -ad_library { - - Address input widget and datatype for the OpenACS templating system. - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-09-28 - @cvs-id $Id$ - -} - -namespace eval template {} -namespace eval template::data {} -namespace eval template::data::transform {} -namespace eval template::data::validate {} -namespace eval template::util {} -namespace eval template::util::recurrence {} -namespace eval template::widget {} - -ad_proc -public template::util::recurrence { command args } { - Dispatch procedure for the recurrence object -} { - eval template::util::recurrence::$command $args -} - -ad_proc -public template::util::recurrence::create { - {every_n {}} - {interval_type {}} - {days_of_week {}} - {recur_until {}} -} { - return [list $every_n $interval_type $days_of_week $recur_until] -} - -ad_proc -public template::util::recurrence::html_view { - {every_n {}} - {interval_type {}} - {days_of_week {}} - {recur_until {}} -} { - set recurrence "Every $every_n $interval_type" - if { [exists_and_not_null days_of_week] } { - append recurrence $days_of_week - } - if { [exists_and_not_null recur_until] } { - append recurrence $recur_until - } - return [ad_text_to_html $recurrence] -} - -ad_proc -public template::util::recurrence::acquire { type { value "" } } { - Create a new recurrence value with some predefined value - Basically, create and set the recurrence value -} { - set recurrence_list [template::util::recurrence::create] - return [template::util::recurrence::set_property $type $recurrence_list $value] -} - - -ad_proc -public template::data::validate::recurrence { value_ref message_ref } { - - upvar 2 $message_ref message $value_ref recurrence_list - - set delivery_recurrence [template::util::recurrence::get_property delivery_recurrence $recurrence_list] - set municipality [template::util::recurrence::get_property municipality $recurrence_list] - set region [template::util::recurrence::get_property region $recurrence_list] - set postal_code [template::util::recurrence::get_property postal_code $recurrence_list] - set country_code [template::util::recurrence::get_property country_code $recurrence_list] - set additional_text [template::util::recurrence::get_property additional_text $recurrence_list] - set postal_type [template::util::recurrence::get_property postal_type $recurrence_list] - - set message "" - # this is used to make sure there are no invalid characters in the recurrence - set recurrence_temp "$delivery_recurrence $municipality $region $postal_code $country_code $additional_text $postal_type" - if { [::string match "\{" $recurrence_temp] || [::string match "\}" $recurrence_temp] } { - # for built in display purposes these characters are not allowed, if you need it - # to be allowed make SURE that retrieval procs in AMS are also updated - # to deal with this change - if { [exists_and_not_null message_temp] } { append message " " } - append message "[_ ams.Your_entry_must_not_contain_the_following_characters]: \{ \}." - } - if { $country_code == "US" } { - # this should check a cached list - # this proc cannot for some reason go in the postgresql file... - if { ![db_0or1row validate_state { - select 1 from us_states where abbrev = upper(:region) or state_name = upper(:region) -} ] } { - if { [exists_and_not_null message_temp] } { append message " " } - append message "\"$region\" [_ ams.is_not_a_valid_US_state]." - } - } - if { [exists_and_not_null message_temp] } { - return 0 - } else { - return 1 - } -} - - -ad_proc -public template::data::transform::recurrence { element_ref } { - - upvar $element_ref element - set element_id $element(id) - - set every_n [ns_queryget $element_id.delivery_recurrence] - set interval_type [ns_queryget $element_id.municipality] - set days_of_week [ns_queryget $element_id.region] - set recur_until [ns_queryget $element_id.postal_code] - - if { [empty_string_p $every_n] } { - # We need to return the empty list in order for form builder to think of it - # as a non-value in case of a required element. - return [list] - } else { - return [list [list $every_n $interval_type $days_of_week $recur_until]] - } -} - -ad_proc -public template::util::recurrence::set_property { what recurrence_list value } { - Set a property of the recurrence datatype. - - @param what One of - - - @param recurrence_list the recurrence list to modify - @param value the new value - - @return the modified list -} { - - set every_n [template::util::recurrence::get_property every_n $recurrence_list] - set interval_type [template::util::recurrence::get_property interval_type $recurrence_list] - set days_of_week [template::util::recurrence::get_property days_of_week $recurrence_list] - set recur_until [template::util::recurrence::get_property recur_until $recurrence_list] - - switch $what { - every_n { - return [list $value $interval_type $days_of_week $recur_until] - } - interval_type { - return [list $every_n $value $days_of_week $recur_until] - } - days_of_week { - return [list $every_n $interval_type $value $recur_until] - } - recur_until { - return [list $every_n $interval_type $days_of_week $value ] - } - default { - error "Parameter supplied to util::recurrence::set_property 'what' must be one of: 'every_n', 'interval_type', 'days_of_week', 'recur_until', 'html_view'. You specified: '$what'." - } - } -} - -ad_proc -public template::util::recurrence::get_property { what recurrence_list } { - - Get a property of the recurrence datatype. Valid properties are: - - @param what the name of the property. Must be one of: - - @param recurrence_list a recurrence datatype value, usually created with ad_form. -} { - - switch $what { - every_n { - return [lindex $recurrence_list 0] - } - interval_type { - return [lindex $recurrence_list 1] - } - days_of_week { - return [lindex $recurrence_list 2] - } - recur_until { - return [lindex $recurrence_list 3] - } - html_view { - set every_n [template::util::recurrence::get_property every_n $recurrence_list] - set interval_type [template::util::recurrence::get_property interval_type $recurrence_list] - set days_of_week [template::util::recurrence::get_property days_of_week $recurrence_list] - set recur_until [template::util::recurrence::get_property recur_until $recurrence_list] - return [template::util::recurrence::html_view $every_n $interval_type $days_of_week $recur_until] - } - default { - error "Parameter supplied to util::recurrence::get_property 'what' must be one of: 'every_n', 'interval_type', 'days_of_week', 'recur_until', 'html_view'. You specified: '$what'." - } - - } -} - -ad_proc -public template::widget::recurrence { element_reference tag_attributes } { - Implements the recurrence widget. - -} { - - upvar $element_reference element - - if { [info exists element(value)] } { - set every_n [template::util::recurrence::get_property delivery_recurrence $element(value)] - set interval_type [template::util::recurrence::get_property postal_code $element(value)] - set days_of_week [template::util::recurrence::get_property municipality $element(value)] - set recur_until [template::util::recurrence::get_property region $element(value)] - } else { - set every_n {} - set interval_type {} - set days_of_week {} - set recur_until {} - } - - set output {} - - if { [string equal $element(mode) "edit"] } { - - set every_n_options { - {"Every" 1} - {"Every Other" 2} - {"Every Third" 3} - {"Every Forth" 4} - } - - set interval_type_options { - {"Day" day} - {"Week" week} - {"Month on this Date" month_by_date} - {"Month on this Day" month_by_day} - {"Year" year} - } - - set menuattributes(id) \"recurrence__$element(form_id)__$element(id)\" - set dateattributes [list "name" "$element(id).recur_until"] - - append output " - - - - - - - -
Repeat [menu $element(id).every_n $every_n_options $every_n menuattributes] [menu $element(id).interval_type $interval_type_options $interval_type menuattributes]
Until [text $element(id).recur_until $dateattributes]
-" - - } else { - # Display mode - if { [info exists element(value)] } { - append output [template::util::recurrence::get_property html_view $element(value)] - append output "" - append output "" - append output "" - append output "" - } - } - - return $output -} +ad_library { + + Address input widget and datatype for the OpenACS templating system. + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-09-28 + @cvs-id $Id$ + +} + +namespace eval template {} +namespace eval template::data {} +namespace eval template::data::transform {} +namespace eval template::data::validate {} +namespace eval template::util {} +namespace eval template::util::recurrence {} +namespace eval template::widget {} + +ad_proc -public template::util::recurrence { command args } { + Dispatch procedure for the recurrence object +} { + eval template::util::recurrence::$command $args +} + +ad_proc -public template::util::recurrence::create { + {every_n {}} + {interval_type {}} + {days_of_week {}} + {recur_until {}} +} { + return [list $every_n $interval_type $days_of_week $recur_until] +} + +ad_proc -public template::util::recurrence::html_view { + {every_n {}} + {interval_type {}} + {days_of_week {}} + {recur_until {}} +} { + set recurrence "Every $every_n $interval_type" + if { [exists_and_not_null days_of_week] } { + append recurrence $days_of_week + } + if { [exists_and_not_null recur_until] } { + append recurrence $recur_until + } + return [ad_text_to_html $recurrence] +} + +ad_proc -public template::util::recurrence::acquire { type { value "" } } { + Create a new recurrence value with some predefined value + Basically, create and set the recurrence value +} { + set recurrence_list [template::util::recurrence::create] + return [template::util::recurrence::set_property $type $recurrence_list $value] +} + + +ad_proc -public template::data::validate::recurrence { value_ref message_ref } { + + upvar 2 $message_ref message $value_ref recurrence_list + + set delivery_recurrence [template::util::recurrence::get_property delivery_recurrence $recurrence_list] + set municipality [template::util::recurrence::get_property municipality $recurrence_list] + set region [template::util::recurrence::get_property region $recurrence_list] + set postal_code [template::util::recurrence::get_property postal_code $recurrence_list] + set country_code [template::util::recurrence::get_property country_code $recurrence_list] + set additional_text [template::util::recurrence::get_property additional_text $recurrence_list] + set postal_type [template::util::recurrence::get_property postal_type $recurrence_list] + + set message "" + # this is used to make sure there are no invalid characters in the recurrence + set recurrence_temp "$delivery_recurrence $municipality $region $postal_code $country_code $additional_text $postal_type" + if { [::string match "\{" $recurrence_temp] || [::string match "\}" $recurrence_temp] } { + # for built in display purposes these characters are not allowed, if you need it + # to be allowed make SURE that retrieval procs in AMS are also updated + # to deal with this change + if { [exists_and_not_null message_temp] } { append message " " } + append message "[_ ams.Your_entry_must_not_contain_the_following_characters]: \{ \}." + } + if { $country_code == "US" } { + # this should check a cached list + # this proc cannot for some reason go in the postgresql file... + if { ![db_0or1row validate_state { + select 1 from us_states where abbrev = upper(:region) or state_name = upper(:region) +} ] } { + if { [exists_and_not_null message_temp] } { append message " " } + append message "\"$region\" [_ ams.is_not_a_valid_US_state]." + } + } + if { [exists_and_not_null message_temp] } { + return 0 + } else { + return 1 + } +} + + +ad_proc -public template::data::transform::recurrence { element_ref } { + + upvar $element_ref element + set element_id $element(id) + + set every_n [ns_queryget $element_id.delivery_recurrence] + set interval_type [ns_queryget $element_id.municipality] + set days_of_week [ns_queryget $element_id.region] + set recur_until [ns_queryget $element_id.postal_code] + + if { [empty_string_p $every_n] } { + # We need to return the empty list in order for form builder to think of it + # as a non-value in case of a required element. + return [list] + } else { + return [list [list $every_n $interval_type $days_of_week $recur_until]] + } +} + +ad_proc -public template::util::recurrence::set_property { what recurrence_list value } { + Set a property of the recurrence datatype. + + @param what One of + + + @param recurrence_list the recurrence list to modify + @param value the new value + + @return the modified list +} { + + set every_n [template::util::recurrence::get_property every_n $recurrence_list] + set interval_type [template::util::recurrence::get_property interval_type $recurrence_list] + set days_of_week [template::util::recurrence::get_property days_of_week $recurrence_list] + set recur_until [template::util::recurrence::get_property recur_until $recurrence_list] + + switch $what { + every_n { + return [list $value $interval_type $days_of_week $recur_until] + } + interval_type { + return [list $every_n $value $days_of_week $recur_until] + } + days_of_week { + return [list $every_n $interval_type $value $recur_until] + } + recur_until { + return [list $every_n $interval_type $days_of_week $value ] + } + default { + error "Parameter supplied to util::recurrence::set_property 'what' must be one of: 'every_n', 'interval_type', 'days_of_week', 'recur_until', 'html_view'. You specified: '$what'." + } + } +} + +ad_proc -public template::util::recurrence::get_property { what recurrence_list } { + + Get a property of the recurrence datatype. Valid properties are: + + @param what the name of the property. Must be one of: + + @param recurrence_list a recurrence datatype value, usually created with ad_form. +} { + + switch $what { + every_n { + return [lindex $recurrence_list 0] + } + interval_type { + return [lindex $recurrence_list 1] + } + days_of_week { + return [lindex $recurrence_list 2] + } + recur_until { + return [lindex $recurrence_list 3] + } + html_view { + set every_n [template::util::recurrence::get_property every_n $recurrence_list] + set interval_type [template::util::recurrence::get_property interval_type $recurrence_list] + set days_of_week [template::util::recurrence::get_property days_of_week $recurrence_list] + set recur_until [template::util::recurrence::get_property recur_until $recurrence_list] + return [template::util::recurrence::html_view $every_n $interval_type $days_of_week $recur_until] + } + default { + error "Parameter supplied to util::recurrence::get_property 'what' must be one of: 'every_n', 'interval_type', 'days_of_week', 'recur_until', 'html_view'. You specified: '$what'." + } + + } +} + +ad_proc -public template::widget::recurrence { element_reference tag_attributes } { + Implements the recurrence widget. + +} { + + upvar $element_reference element + + if { [info exists element(value)] } { + set every_n [template::util::recurrence::get_property delivery_recurrence $element(value)] + set interval_type [template::util::recurrence::get_property postal_code $element(value)] + set days_of_week [template::util::recurrence::get_property municipality $element(value)] + set recur_until [template::util::recurrence::get_property region $element(value)] + } else { + set every_n {} + set interval_type {} + set days_of_week {} + set recur_until {} + } + + set output {} + + if { [string equal $element(mode) "edit"] } { + + set every_n_options { + {"Every" 1} + {"Every Other" 2} + {"Every Third" 3} + {"Every Forth" 4} + } + + set interval_type_options { + {"Day" day} + {"Week" week} + {"Month on this Date" month_by_date} + {"Month on this Day" month_by_day} + {"Year" year} + } + + set menuattributes(id) \"recurrence__$element(form_id)__$element(id)\" + set dateattributes [list "name" "$element(id).recur_until"] + + append output " + + + + + + + +
Repeat [menu $element(id).every_n $every_n_options $every_n menuattributes] [menu $element(id).interval_type $interval_type_options $interval_type menuattributes]
Until [text $element(id).recur_until $dateattributes]
+" + + } else { + # Display mode + if { [info exists element(value)] } { + append output [template::util::recurrence::get_property html_view $element(value)] + append output "" + append output "" + append output "" + append output "" + } + } + + return $output +} Index: openacs-4/packages/ams/www/attribute-add-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-add-2.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/attribute-add-2.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/attribute-add-2.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,8 +1,8 @@ - -@title@ -@context@ - - - - - + +@title@ +@context@ + + + + + Index: openacs-4/packages/ams/www/attribute-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-add-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ams/www/attribute-add-2.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/attribute-add-2.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,121 +1,121 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ -} { - {ams_attribute_id:integer,notnull} - {object_type:notnull} - {widget_name:notnull} - {attribute_name:notnull} - {pretty_name:notnull} - {pretty_plural:notnull} - {list_id:integer} - {description ""} -} - -acs_object_type::get -object_type $object_type -array "object_info" - -set title "Define Options" -set context [list [list objects Objects] [list "object?object_type=$object_type" $object_info(pretty_name)] [list "attribute-add?object_type=$object_type" "Add Attribute"] $title] - -db_1row select_widget_pretty_and_storage_type { select storage_type from ams_widgets where widget_name = :widget_name } - -acs_object_type::get -object_type $object_type -array "object_info" - - - - -if { [exists_and_not_null list_id] } { - set return_url "list-attributes-map?[export_vars -url {ams_attribute_id list_id}]" - set user_message "AMS Attribute $pretty_name Created and Mapped." -} else { - set return_url "object?[export_vars -url {object_type}]" - set user_message "AMS Attribute $pretty_name Created." -} - - - - -if { ![string equal $storage_type "ams_options"] } { - - ams::attribute::new \ - -ams_attribute_id $ams_attribute_id \ - -object_type $object_type \ - -attribute_name $attribute_name \ - -pretty_name $pretty_name \ - -pretty_plural $pretty_plural \ - -description $description \ - -widget_name $widget_name - -# {-options} - - util_user_message -html -message $user_message - ad_returnredirect $return_url - ad_script_abort -} - -ad_form -name attribute_form -form { - {ams_attribute_id:key} - {list_id:integer(hidden)} - {object_type:text(hidden)} - {widget_name:text(inform) {label "Widget"}} - {attribute_name:text(inform) {label "Attribute Name"}} - {pretty_name:text(inform) {label "Pretty Name"}} - {pretty_plural:text(inform) {label "Pretty Plural"}} -} - -if { [exists_and_not_null description] } { - ad_form -extend -name attribute_form -form { - {description:text(inform) {label "Description"}} - } -} else { - ad_form -extend -name attribute_form -form { - {description:text(hidden),optional} - } -} - -ad_form -extend -name attribute_form -form { - {option1:text {label "Option 1"} {html {size 50}}} - {option2:text,optional {label "Option 2"} {html {size 50}}} - {option3:text,optional {label "Option 3"} {html {size 50}}} - {option4:text,optional {label "Option 4"} {html {size 50}}} - {option5:text,optional {label "Option 5"} {html {size 50}}} - {option6:text,optional {label "Option 6"} {html {size 50}}} - {option7:text,optional {label "Option 7"} {html {size 50}}} - {option8:text,optional {label "Option 8"} {html {size 50}}} - {option9:text,optional {label "Option 9"} {html {size 50}} {help_text {If you need to add more options you will be able to do so by editing this attributes details}}} -} -new_request { -} -edit_request { -} -validate { -} -on_submit { - - set i 1 - set options [list] - while { $i <= "9" } { - set option_value [string trim [set option${i}]] - ns_log notice $option_value - if { [exists_and_not_null option_value] } { - lappend options $option_value - } - incr i - } - - ams::attribute::new \ - -ams_attribute_id $ams_attribute_id \ - -object_type $object_type \ - -attribute_name $attribute_name \ - -pretty_name $pretty_name \ - -pretty_plural $pretty_plural \ - -description $description \ - -widget_name $widget_name \ - -options $options - -} -after_submit { - util_user_message -html -message $user_message - ad_returnredirect $return_url - ad_script_abort -} - - -ad_return_template +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ +} { + {ams_attribute_id:integer,notnull} + {object_type:notnull} + {widget_name:notnull} + {attribute_name:notnull} + {pretty_name:notnull} + {pretty_plural:notnull} + {list_id:integer} + {description ""} +} + +acs_object_type::get -object_type $object_type -array "object_info" + +set title "[_ ams.Define_Options]" +set context [list [list objects Objects] [list "object?object_type=$object_type" $object_info(pretty_name)] [list "attribute-add?object_type=$object_type" "[_ ams.Add_Attribute]"] $title] + +db_1row select_widget_pretty_and_storage_type { select storage_type from ams_widgets where widget_name = :widget_name } + +acs_object_type::get -object_type $object_type -array "object_info" + + + + +if { [exists_and_not_null list_id] } { + set return_url "list-attributes-map?[export_vars -url {ams_attribute_id list_id}]" + set user_message "[_ ams.lt_AMS_Attribute_a_hrefa]" +} else { + set return_url "object?[export_vars -url {object_type}]" + set user_message "[_ ams.lt_AMS_Attribute_a_hrefa_1]" +} + + + + +if { ![string equal $storage_type "ams_options"] } { + + ams::attribute::new \ + -ams_attribute_id $ams_attribute_id \ + -object_type $object_type \ + -attribute_name $attribute_name \ + -pretty_name $pretty_name \ + -pretty_plural $pretty_plural \ + -description $description \ + -widget_name $widget_name + +# {-options} + + util_user_message -html -message $user_message + ad_returnredirect $return_url + ad_script_abort +} + +ad_form -name attribute_form -form { + {ams_attribute_id:key} + {list_id:integer(hidden)} + {object_type:text(hidden)} + {widget_name:text(inform) {label "[_ ams.Widget_1]"}} + {attribute_name:text(inform) {label "[_ ams.Attribute_Name]"}} + {pretty_name:text(inform) {label "[_ ams.Pretty_Name_1]"}} + {pretty_plural:text(inform) {label "[_ ams.Pretty_Plural_1]"}} +} + +if { [exists_and_not_null description] } { + ad_form -extend -name attribute_form -form { + {description:text(inform) {label "[_ ams.Description]"}} + } +} else { + ad_form -extend -name attribute_form -form { + {description:text(hidden),optional} + } +} + +ad_form -extend -name attribute_form -form { + {option1:text {label "[_ ams.Option_1]"} {html {size 50}}} + {option2:text,optional {label "[_ ams.Option_2]"} {html {size 50}}} + {option3:text,optional {label "[_ ams.Option_3]" } {html {size 50}}} + {option4:text,optional {label "[_ ams.Option_4]" } {html {size 50}}} + {option5:text,optional {label "[_ ams.Option_5]"} {html {size 50}}} + {option6:text,optional {label "[_ ams.Option_6]"} {html {size 50}}} + {option7:text,optional {label "[_ ams.Option_7]"} {html {size 50}}} + {option8:text,optional {label "[_ ams.Option_8]"} {html {size 50}}} + {option9:text,optional {label "[_ ams.Option_9]"} {html {size 50}} {help_text {If you need to add more options you will be able to do so by editing this attributes details}}} +} -new_request { +} -edit_request { +} -validate { +} -on_submit { + + set i 1 + set options [list] + while { $i <= "9" } { + set option_value [string trim [set option${i}]] + ns_log notice $option_value + if { [exists_and_not_null option_value] } { + lappend options $option_value + } + incr i + } + + ams::attribute::new \ + -ams_attribute_id $ams_attribute_id \ + -object_type $object_type \ + -attribute_name $attribute_name \ + -pretty_name $pretty_name \ + -pretty_plural $pretty_plural \ + -description $description \ + -widget_name $widget_name \ + -options $options + +} -after_submit { + util_user_message -html -message $user_message + ad_returnredirect $return_url + ad_script_abort +} + + +ad_return_template Index: openacs-4/packages/ams/www/attribute-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-add.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/attribute-add.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/attribute-add.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,9 +1,9 @@ - -@title@ -@context@ - - - - - - + +@title@ +@context@ + + + + + + Index: openacs-4/packages/ams/www/attribute-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-add.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/www/attribute-add.tcl 26 May 2005 07:02:22 -0000 1.4 +++ openacs-4/packages/ams/www/attribute-add.tcl 28 May 2005 15:37:27 -0000 1.5 @@ -1,218 +1,218 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ -} { - {return_url:optional ""} - {return_url_label:optional ""} - {list_id:optional ""} - {object_type:notnull} - {widget:optional ""} - {attribute_name:optional ""} -} - -acs_object_type::get -object_type $object_type -array "object_info" - -set title "Add Attribute" -set context [list [list objects Objects] [list "object?object_type=$object_type" $object_info(pretty_name)] "Add Attribute"] - -ad_form -name attribute_form -form { - {ams_attribute_id:key} - {return_url:text(hidden),optional} - {return_url_label:text(hidden),optional} - {list_id:integer(hidden),optional} - {object_type:text(hidden)} - {mode:text(hidden),optional} - {widget:text(radio),optional {label "Widget"} {options {[lsort [::ams::widget_list]]}}} - {attribute_name:text,optional {label "Attribute Name"} {html {size 30 maxlength 100}} {help_text {This name must be lower case, contain only letters and underscores, and contain no spaces. If not specified one will be generated for you.}}} - {pretty_name:text,optional {label "Pretty Name"} {html {size 30 maxlength 100}}} - {pretty_plural:text,optional {label "Pretty Plural"} {html {size 30 maxlength 100}}} -} - - -#if { [ams::widget_has_options_p -widget $widget] } { -# foreach elemement [list option1 option2 option3 option4 option4] { -# ::template::element::set_properties attribute_form $element -widget text -# } -#} -if { [ams::widget_has_options_p -widget $widget] } { - set default_number_of_options 5 - set option_fields_count $default_number_of_options - set i 1 - set elements [list] - lappend elements [list option_fields_count:integer(hidden) [list value $option_fields_count]] -# lappend elements [list options_on_last_screen:integer(hidden),optional] - while { $i <= $option_fields_count } { - set element [list option${i}:text(text),optional [list label "Option $i"] [list html [list size 50]]] - if { $i == $option_fields_count } { - lappend element [list help_text "If you need to add more options you will be able to do so by editing this attributes again ($default_number_of_options new fields are added to the preexisting count each time you edit an attribute)"] - } - if { $i == 1 } { - lappend element [list section "Predefined Options"] - } - lappend elements $element - incr i - } - ad_form -extend -name attribute_form -form $elements -} - - - -ad_form -extend -name attribute_form -on_request { - set mode "new" - if { [::attribute::exists_p -convert_p 0 $object_type $attribute_name] } { - # this attribute already exists - so we are in "edit" mode for - ::template::element::set_properties attribute_form attribute_name -mode display - db_1row get_attr_info { select pretty_name, pretty_plural from acs_attributes where attribute_name = :attribute_name and object_type = :object_type } - set mode "edit" - } - if { [exists_and_not_null widget] } { - if { [string is false [ams::widget_proc_exists_p -widget $widget]] } { - ad_return_error "There was a problem with your input" "The widget specified does not exist" - } - ::template::element::set_properties attribute_form widget -widget select -mode display - } - set option_on_last_screen 1 -#::template::element set_properties attribute_form pretty_plural -widget hidden -# foreach field [list attribute_name pretty_name pretty_plural] { -# ::template::element set_properties attribute_form $field -mode display -# } -} -on_submit { - ams::widgets_init - if { [exists_and_not_null attribute_name] } { - if { [string is false [::regexp {^([0-9]|[a-z]|\_){1,}$} $attribute_name match attribute_name_matcher]] } { - ::template::form::set_error attribute_form attribute_name "You have used invalid characters." - } else { - ::template::element::set_properties attribute_form attribute_name -mode display - } - } else { - if { [exists_and_not_null pretty_name] } { - set attribute_name [util_text_to_url -replacement "_" -text $pretty_name] - set attribute_name_generated_p 1 - ::template::element::set_value attribute_form attribute_name $attribute_name - } - } - set required_fields [list widget pretty_name pretty_plural] - if { [exists_and_not_null option_fields_count] } { - lappend required_fields "option1" - } - foreach required_field $required_fields { - if { [string is false [exists_and_not_null ${required_field}]] } { - ::template::form::set_error attribute_form $required_field "[::template::element::get_property attribute_form $required_field label] is required" - } - } - - - # Internationalising of Attributes. This is done by storing the attribute with it's acs-lang key - set message_key "${object_type}_${attribute_name}" - - # Register the language keys - lang::message::register en_US ams $message_key $pretty_name - lang::message::register en_US ams "${message_key}_plural" $pretty_plural - - # Register the language key in the current user locale as well - # Usually you would only register the key in the locale that the user is using - # But we can't do this as the system depends on english language keys first. - # If Timo manages to get the service contract with babblefish or dict.leo.org working - # We might have an automatic translation first :). - set user_locale [lang::user::locale] - if {[exists_and_not_null user_locale]} { - if {$user_locale != "en_US"} { - lang::message::register $user_locale ams $message_key $pretty_name - lang::message::register $user_locale ams "${message_key}_plural" $pretty_plural - } - } - - # Replace the pretty_name and pretty_plural with the message key, so it is inserted correctly in the database - set pretty_name "#ams.${message_key}#" - set pretty_plural "#ams.${message_key}_plural#" - - if { [exists_and_not_null widget] } { - ::template::element::set_properties attribute_form widget -widget select -mode display - } - if { $mode == "new" } { - if { [::attribute::exists_p -convert_p 0 $object_type $attribute_name] } { - if { [exists_and_not_null attribute_name_generated_p] } { - set message "The attribute name automatically generated for conflicts with an attribute that is already in the database. Please make sure you are not creating a duplicate attribute and change the name if not." - } else { - set message "This attribute name already exists. Please make sure you are not creating a duplicate attribute and change the name if not." - } - ::template::element::set_error attribute_form attribute_name $message - ::template::element::set_properties attribute_form attribute_name -mode edit - } - } -# ::template::form::set_error attribute_form attribute_name "$mode $attribute_name $object_type" - -# element::create attribute_form change_widget -datatype text -widget submit -label "Change Widget" -# { ![::attribute::exists_p $object_type $attribute_name] } -# "Attribute $attribute_name already exists for $object_info(pretty_name)." - -# if { [exists_and_not_null option_fields_count] } { -# if { xists_and_not_null options_on_last_screen] && [string is false [exists_and_not_null option1]] } { -# ::template::form::set_error attribute_form option1 "Option 1 is required" -# } else { -# ::template::element::set_value attribute_form options_on_last_screen 1 -# } -# } - - - if { [::template::form::is_valid attribute_form] } { - - - db_transaction { - # the form has passed all validation blocks -# ::template::element::set_error attribute_form attribute_name "valid" - if { $mode == "new" } { - set attribute_id [attribute::new \ - -object_type $object_type \ - -attribute_name $attribute_name \ - -datatype [::ams::widget -widget $widget -request "widget_datatypes"] \ - -pretty_name $pretty_name \ - -pretty_plural $pretty_plural] - set dynamic_p 1 - } else { - set attribute_id [attribute::id \ - -object_type $object_type \ - -attribute_name $attribute_name] - set dynamic_p 0 - } - ams::attribute::new \ - -attribute_id $attribute_id \ - -ams_attribute_id $ams_attribute_id \ - -widget $widget \ - -dynamic_p $dynamic_p - - if { [ams::widget_has_options_p -widget $widget] && [exists_and_not_null option_fields_count] } { - set i 1 - while { $i <= $option_fields_count } { - set option [set "option${i}"] - if { [exists_and_not_null option] } { - ams::option::new \ - -attribute_id $attribute_id \ - -option $option - } - incr i - } - } - } - } else { - break - } -} -after_submit { - if { [exists_and_not_null list_id] } { - ams::list::attribute::map -list_id $list_id -attribute_id $attribute_id - ams::list::get -list_id $list_id -array list_info - set list_name $list_info(list_name) - set object_type $list_info(object_type) - set package_key $list_info(package_key) - set return_url [export_vars -base "list" -url {list_name object_type package_key return_url return_url_label}] - } else { - set return_url [export_vars -base "object" -url {object_type return_url return_url_label}] - } - ad_returnredirect -message "$pretty_name has been added as an attribute to $object_type" $return_url - ad_script_abort -} - - -ad_return_template +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ +} { + {return_url:optional ""} + {return_url_label:optional ""} + {list_id:optional ""} + {object_type:notnull} + {widget:optional ""} + {attribute_name:optional ""} +} + +acs_object_type::get -object_type $object_type -array "object_info" + +set title "[_ ams.Add_Attribute]" +set context [list [list objects Objects] [list "object?object_type=$object_type" $object_info(pretty_name)] "[_ ams.Add_Attribute]"] + +ad_form -name attribute_form -form { + {ams_attribute_id:key} + {return_url:text(hidden),optional} + {return_url_label:text(hidden),optional} + {list_id:integer(hidden),optional} + {object_type:text(hidden)} + {mode:text(hidden),optional} + {widget:text(radio),optional {label "[_ ams.Widget_1]"} {options {[lsort [::ams::widget_list]]}}} + {attribute_name:text,optional {label "[_ ams.Attribute_Name]"} {html {size 30 maxlength 100}} {help_text {This name must be lower case, contain only letters and underscores, and contain no spaces. If not specified one will be generated for you.}}} + {pretty_name:text,optional {label "[_ ams.Pretty_Name_1]"} {html {size 30 maxlength 100}}} + {pretty_plural:text,optional {label "[_ ams.Pretty_Plural_1]"} {html {size 30 maxlength 100}}} +} + + +#if { [ams::widget_has_options_p -widget $widget] } { +# foreach elemement [list option1 option2 option3 option4 option4] { +# ::template::element::set_properties attribute_form $element -widget text +# } +#} +if { [ams::widget_has_options_p -widget $widget] } { + set default_number_of_options 5 + set option_fields_count $default_number_of_options + set i 1 + set elements [list] + lappend elements [list option_fields_count:integer(hidden) [list value $option_fields_count]] +# lappend elements [list options_on_last_screen:integer(hidden),optional] + while { $i <= $option_fields_count } { + set element [list option${i}:text(text),optional [list label "[_ ams.Option_i]"] [list html [list size 50]]] + if { $i == $option_fields_count } { + lappend element [list help_text "[_ ams.lt_If_you_need_to_add_mo]"] + } + if { $i == 1 } { + lappend element [list section "[_ ams.Predefined_Options]"] + } + lappend elements $element + incr i + } + ad_form -extend -name attribute_form -form $elements +} + + + +ad_form -extend -name attribute_form -on_request { + set mode "new" + if { [::attribute::exists_p -convert_p 0 $object_type $attribute_name] } { + # this attribute already exists - so we are in "edit" mode for + ::template::element::set_properties attribute_form attribute_name -mode display + db_1row get_attr_info { select pretty_name, pretty_plural from acs_attributes where attribute_name = :attribute_name and object_type = :object_type } + set mode "edit" + } + if { [exists_and_not_null widget] } { + if { [string is false [ams::widget_proc_exists_p -widget $widget]] } { + ad_return_error "[_ ams.lt_There_was_a_problem_w]" "[_ ams.lt_The_widget_specified_]" + } + ::template::element::set_properties attribute_form widget -widget select -mode display + } + set option_on_last_screen 1 +#::template::element set_properties attribute_form pretty_plural -widget hidden +# foreach field [list attribute_name pretty_name pretty_plural] { +# ::template::element set_properties attribute_form $field -mode display +# } +} -on_submit { + ams::widgets_init + if { [exists_and_not_null attribute_name] } { + if { [string is false [::regexp {^([0-9]|[a-z]|\_){1,}$} $attribute_name match attribute_name_matcher]] } { + ::template::form::set_error attribute_form attribute_name "[_ ams.lt_You_have_used_invalid]" + } else { + ::template::element::set_properties attribute_form attribute_name -mode display + } + } else { + if { [exists_and_not_null pretty_name] } { + set attribute_name [util_text_to_url -replacement "_" -text $pretty_name] + set attribute_name_generated_p 1 + ::template::element::set_value attribute_form attribute_name $attribute_name + } + } + set required_fields [list widget pretty_name pretty_plural] + if { [exists_and_not_null option_fields_count] } { + lappend required_fields "option1" + } + foreach required_field $required_fields { + if { [string is false [exists_and_not_null ${required_field}]] } { + ::template::form::set_error attribute_form $required_field "[::template::element::get_property attribute_form $required_field label] is required" + } + } + + + # Internationalising of Attributes. This is done by storing the attribute with it's acs-lang key + set message_key "${object_type}_${attribute_name}" + + # Register the language keys + lang::message::register en_US ams $message_key $pretty_name + lang::message::register en_US ams "${message_key}_plural" $pretty_plural + + # Register the language key in the current user locale as well + # Usually you would only register the key in the locale that the user is using + # But we can't do this as the system depends on english language keys first. + # If Timo manages to get the service contract with babblefish or dict.leo.org working + # We might have an automatic translation first :). + set user_locale [lang::user::locale] + if {[exists_and_not_null user_locale]} { + if {$user_locale != "en_US"} { + lang::message::register $user_locale ams $message_key $pretty_name + lang::message::register $user_locale ams "${message_key}_plural" $pretty_plural + } + } + + # Replace the pretty_name and pretty_plural with the message key, so it is inserted correctly in the database + set pretty_name "#ams.${message_key}#" + set pretty_plural "#ams.${message_key}_plural#" + + if { [exists_and_not_null widget] } { + ::template::element::set_properties attribute_form widget -widget select -mode display + } + if { $mode == "new" } { + if { [::attribute::exists_p -convert_p 0 $object_type $attribute_name] } { + if { [exists_and_not_null attribute_name_generated_p] } { + set message "[_ ams.lt_The_attribute_name_au]" + } else { + set message "[_ ams.lt_This_attribute_name_a]" + } + ::template::element::set_error attribute_form attribute_name $message + ::template::element::set_properties attribute_form attribute_name -mode edit + } + } +# ::template::form::set_error attribute_form attribute_name "$mode $attribute_name $object_type" + +# element::create attribute_form change_widget -datatype text -widget submit -label "Change Widget" +# { ![::attribute::exists_p $object_type $attribute_name] } +# "Attribute $attribute_name already exists for $object_info(pretty_name)." + +# if { [exists_and_not_null option_fields_count] } { +# if { xists_and_not_null options_on_last_screen] && [string is false [exists_and_not_null option1]] } { +# ::template::form::set_error attribute_form option1 "Option 1 is required" +# } else { +# ::template::element::set_value attribute_form options_on_last_screen 1 +# } +# } + + + if { [::template::form::is_valid attribute_form] } { + + + db_transaction { + # the form has passed all validation blocks +# ::template::element::set_error attribute_form attribute_name "valid" + if { $mode == "new" } { + set attribute_id [attribute::new \ + -object_type $object_type \ + -attribute_name $attribute_name \ + -datatype [::ams::widget -widget $widget -request "widget_datatypes"] \ + -pretty_name $pretty_name \ + -pretty_plural $pretty_plural] + set dynamic_p 1 + } else { + set attribute_id [attribute::id \ + -object_type $object_type \ + -attribute_name $attribute_name] + set dynamic_p 0 + } + ams::attribute::new \ + -attribute_id $attribute_id \ + -ams_attribute_id $ams_attribute_id \ + -widget $widget \ + -dynamic_p $dynamic_p + + if { [ams::widget_has_options_p -widget $widget] && [exists_and_not_null option_fields_count] } { + set i 1 + while { $i <= $option_fields_count } { + set option [set "option${i}"] + if { [exists_and_not_null option] } { + ams::option::new \ + -attribute_id $attribute_id \ + -option $option + } + incr i + } + } + } + } else { + break + } +} -after_submit { + if { [exists_and_not_null list_id] } { + ams::list::attribute::map -list_id $list_id -attribute_id $attribute_id + ams::list::get -list_id $list_id -array list_info + set list_name $list_info(list_name) + set object_type $list_info(object_type) + set package_key $list_info(package_key) + set return_url [export_vars -base "list" -url {list_name object_type package_key return_url return_url_label}] + } else { + set return_url [export_vars -base "object" -url {object_type return_url return_url_label}] + } + ad_returnredirect -message "$pretty_name has been added as an attribute to $object_type#>" $return_url + ad_script_abort +} + + +ad_return_template 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.2 -r1.3 --- openacs-4/packages/ams/www/attribute-option-delete.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/attribute-option-delete.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,25 +1,25 @@ -ad_page_contract { - - Update sort order - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - option_id:integer,notnull -} -validate { - option_has_no_entries -requires {option_id} { - if { ![string match [db_string get_count { select count(*) from ams_option_map where option_id = :option_id } -default {0}] {0}] } { - ad_complain {You cannot delete an option that already has entries on it} - } - } -} - -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 } - - -ad_returnredirect -message "Option Deleted" "attribute?[export_vars -url {ams_attribute_id}]" +ad_page_contract { + + Update sort order + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + option_id:integer,notnull +} -validate { + option_has_no_entries -requires {option_id} { + if { ![string match [db_string get_count { select count(*) from ams_option_map where option_id = :option_id } -default {0}] {0}] } { + ad_complain {[_ ams.lt_You_cannot_delete_an_]} + } + } +} + +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 } + + +ad_returnredirect -message "[_ ams.Option_Deleted]" "attribute?[export_vars -url {ams_attribute_id}]" Index: openacs-4/packages/ams/www/attribute-options-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-options-update.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/attribute-options-update.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/attribute-options-update.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,50 +1,50 @@ -ad_page_contract { - - Update sort order - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - option:array - sort_key:array - attribute_id:integer,notnull -} -# first we check to see if there are new options. -# if yes we add them -foreach option_key [list new1 new2 new3] { - set option_string [string trim $option(${option_key})] - if { [exists_and_not_null option_string] } { - set option_id [ams::option::new -attribute_id $attribute_id -option $option_string] - set sort_key(${option_id}) $sort_key(${option_key}) - } -} - -# now that all the options are in the database we get the "old" sort order -# if not value for sort_key is provided we will keep the same order as before -set option_ids [db_list get_option_ids { select option_id from ams_option_types where attribute_id = :attribute_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 -foreach option_id $option_ids { - if { $sort_key(${option_id}) > $highest_sort } { - set highest_sort $sort_key(${option_id}) - } -} - - -db_transaction { - foreach option_id $option_ids { - set sort_order $sort_key(${option_id}) - incr highest_sort - db_dml update_sort_order { update ams_option_types set sort_order = :highest_sort where sort_order = :sort_order and attribute_id = :attribute_id } - if { ![exists_and_not_null sort_order] } { - incr highest_sort 1 - set sort_order $highest_sort - } - db_dml update_sort_order { update ams_option_types set sort_order = :sort_order where option_id = :option_id } - } -} -ad_returnredirect -message "Options Updated" "attribute?[export_vars -url {attribute_id}]" +ad_page_contract { + + Update sort order + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + option:array + sort_key:array + attribute_id:integer,notnull +} +# first we check to see if there are new options. +# if yes we add them +foreach option_key [list new1 new2 new3] { + set option_string [string trim $option(${option_key})] + if { [exists_and_not_null option_string] } { + set option_id [ams::option::new -attribute_id $attribute_id -option $option_string] + set sort_key(${option_id}) $sort_key(${option_key}) + } +} + +# now that all the options are in the database we get the "old" sort order +# if not value for sort_key is provided we will keep the same order as before +set option_ids [db_list get_option_ids { select option_id from ams_option_types where attribute_id = :attribute_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 +foreach option_id $option_ids { + if { $sort_key(${option_id}) > $highest_sort } { + set highest_sort $sort_key(${option_id}) + } +} + + +db_transaction { + foreach option_id $option_ids { + set sort_order $sort_key(${option_id}) + incr highest_sort + db_dml update_sort_order { update ams_option_types set sort_order = :highest_sort where sort_order = :sort_order and attribute_id = :attribute_id } + if { ![exists_and_not_null sort_order] } { + incr highest_sort 1 + set sort_order $highest_sort + } + db_dml update_sort_order { update ams_option_types set sort_order = :sort_order where option_id = :option_id } + } +} +ad_returnredirect -message "[_ ams.Options_Updated]" "attribute?[export_vars -url {attribute_id}]" Index: openacs-4/packages/ams/www/attribute.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/attribute.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/attribute.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,13 +1,14 @@ - - -@title@ -@context@ - -

Pretty Name: @pretty_name@

-

Pretty Plural: @pretty_plural@

-

Widget: @attribute_info.widget@

- - - - - + + +@title@ +@context@ + +

#ams.Pretty_Name# @pretty_name@

+

#ams.Pretty_Plural# @pretty_plural@

+

#ams.Widget# @attribute_info.widget@

+ + + + + + Index: openacs-4/packages/ams/www/attribute.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/attribute.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/attribute.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,108 +1,108 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - -} { - {attribute_id:notnull} - orderby:optional -} - -#db_1row get_attribute_info {} -ams::attribute::get -attribute_id $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 { - 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 { - Delete - } - } - } -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_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 - where attribute_id = :attribute_id - order by sort_order -} { - set sort_order $sort_count - set sort_key $sort_key_count - incr sort_count 10 - incr sort_key_count 1 -} - -if { [template::multirow size options] > 0 } { - 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 +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + +} { + {attribute_id:notnull} + orderby:optional +} + +#db_1row get_attribute_info {} +ams::attribute::get -attribute_id $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 "[_ ams.Options]" \ + -checkbox_name checkbox \ + -selected_format "normal" \ + -class "list" \ + -main_class "list" \ + -sub_class "narrow" \ + -pass_properties { + } -actions { + } -bulk_action_export_vars { + attribute_id + } -bulk_actions { + "[_ acs-kernel.common_Update]" "attribute-options-update" "[_ ams.Update_Options]" + } -elements { + edit { + label {} + } + option { + label "[_ ams.Option]" + display_template { + + @options.option@ + + + + + } + } + sort_order { + label "[_ ams.Sort_Order]" + display_template { + + } + } + actions { + label "" + display_template { + Delete + } + } + } -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_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 + where attribute_id = :attribute_id + order by sort_order +} { + set sort_order $sort_count + set sort_key $sort_key_count + incr sort_count 10 + incr sort_key_count 1 +} + +if { [template::multirow size options] > 0 } { + 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 -r1.4 -r1.5 --- openacs-4/packages/ams/www/index.adp 18 May 2005 17:11:48 -0000 1.4 +++ openacs-4/packages/ams/www/index.adp 28 May 2005 15:37:27 -0000 1.5 @@ -1,9 +1,9 @@ - -@title@ -@context@ -@fred@ - + +@title@ +@context@ + + Index: openacs-4/packages/ams/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/index.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/ams/www/index.tcl 18 May 2005 17:11:48 -0000 1.6 +++ openacs-4/packages/ams/www/index.tcl 28 May 2005 15:37:27 -0000 1.7 @@ -1,112 +1,15 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { -} - -set title "Attribute Management System" -set context {} - - - -# 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" -# -#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 { -# ams::ad_form::save -package_key $package_key \ -# -object_type $object_type \ -# -list_name $list_name \ -# -form_name "entry" \ -# -object_id $object_id -# } -after_submit { -# if { ![exists_and_not_null return_url] } { -# set return_url "./" -# } -# } -# - -#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_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] -# ams::object::attribute::values -vars -object_id $object_id -#} -## set attr_list $rowcount -#template::multirow foreach lists { -# ns_log Notice "$first_names $last_name $home_address" -#} - - -set fred "" - -foreach { arg_parser procedure } [info procs "::ams::widget::*"] { - regsub "::ams::widget::" $procedure "" widget - if { [exists_and_not_null widget] } { - lappend fred $widget - } -} -set fred "date" -set fred [info procs "::ams::widget::${fred}"] - -ad_return_template +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { +} + +# MS (2005-05-29): Removed a ton of code that is unnecessary +set title "[_ ams.lt_Attribute_Management_]" +set context {} + +ad_return_template 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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/list-add.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/list-add.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,11 +1,12 @@ - -@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.

- - - - - - + +@title@ +@context@ + +

#ams.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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-add.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-add.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,98 +1,98 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ -} { - {object_type:notnull} - {package_key ""} - {list_name ""} - {pretty_name ""} - {description ""} - {return_url ""} - {return_url_label ""} -} - -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}}} - {description:text(textarea),optional {label "Description"} {html {cols 55 rows 4}}} - return_url:text(hidden),optional - return_url_label:text(hidden),optional -} -new_request { - set uneditable_attributes [list package_key object_type list_name pretty_name description] - set blank_required_attributes [list] - foreach attribute $uneditable_attributes { - if { [set $attribute] != "" } { - template::element::set_properties list_form $attribute mode display - } else { - if { $attribute != "description" } { - lappend blank_required_attributes $attribute - } - } - } - # if the only blank attribute is description we can create this list (since all the data was - # provided by the request of this page - if { [string is false [exists_and_not_null blank_required_attributes]] } { - util_user_message -replace - ams::list::flush -package_key $package_key -object_type $object_type -list_name $list_name - ams::list::new -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 - ad_returnredirect "list?[export_vars -url {package_key object_type list_name return_url return_url_label}]" - ad_script_abort - } -} -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 return_url return_url_label}]" - ad_script_abort -} - - -ad_return_template +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ +} { + {object_type:notnull} + {package_key ""} + {list_name ""} + {pretty_name ""} + {description ""} + {return_url ""} + {return_url_label ""} +} + +acs_object_type::get -object_type $object_type -array "object_info" + +set title "[_ ams.Add_List]" +set context [list [list objects Objects] [list "object?object_type=$object_type" $object_info(pretty_name)] "[_ ams.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 "[_ ams.Package_Key_1]"} {options $package_options}} + {object_type:text(inform) {label "[_ ams.Object_Type_1]"}} + {list_name:text {label "[_ ams.List_Name_1]"} {html {size 30 maxlength 100}} {help_text {[_ ams.lt_This_name_must_be_low]}}} + {pretty_name:text {label "[_ ams.Pretty_Name_1]"} {html {size 30 maxlength 100}}} + {description:text(textarea),optional {label "[_ ams.Description]"} {html {cols 55 rows 4}}} + return_url:text(hidden),optional + return_url_label:text(hidden),optional +} -new_request { + set uneditable_attributes [list package_key object_type list_name pretty_name description] + set blank_required_attributes [list] + foreach attribute $uneditable_attributes { + if { [set $attribute] != "" } { + template::element::set_properties list_form $attribute mode display + } else { + if { $attribute != "description" } { + lappend blank_required_attributes $attribute + } + } + } + # if the only blank attribute is description we can create this list (since all the data was + # provided by the request of this page + if { [string is false [exists_and_not_null blank_required_attributes]] } { + util_user_message -replace + ams::list::flush -package_key $package_key -object_type $object_type -list_name $list_name + ams::list::new -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 + ad_returnredirect "list?[export_vars -url {package_key object_type list_name return_url return_url_label}]" + ad_script_abort + } +} -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] } + "[_ ams.lt_You_have_used_invalid]" + } + { list_name + { ![::ams::list::exists_p -package_key $package_key -object_type $object_type -list_name $list_name] } + "[_ ams.lt_List_name_a_hrefliste]" + } +} -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 return_url return_url_label}]" + ad_script_abort +} + + +ad_return_template Index: openacs-4/packages/ams/www/list-attribute-section-heading.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attribute-section-heading.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ams/www/list-attribute-section-heading.adp 18 May 2005 17:11:48 -0000 1.1 +++ openacs-4/packages/ams/www/list-attribute-section-heading.adp 28 May 2005 15:37:27 -0000 1.2 @@ -1,10 +1,10 @@ - -@title@ -@context@ - - - - - - - + +@title@ +@context@ + + + + + + + Index: openacs-4/packages/ams/www/list-attribute-section-heading.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attribute-section-heading.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/list-attribute-section-heading.tcl 26 May 2005 07:35:29 -0000 1.2 +++ openacs-4/packages/ams/www/list-attribute-section-heading.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,55 +1,55 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ -} { - {list_id:integer,notnull} - {attribute_id:integer,notnull} - return_url:optional - return_url_label:optional -} - -db_0or1row get_heading { select aa.pretty_name as attribute_pretty_name, - al.package_key, - al.object_type, - al.list_name, - al.pretty_name as list_pretty_name, - alam.section_heading - from ams_list_attribute_map alam, - ams_attributes aa, - ams_lists al - where alam.attribute_id = aa.attribute_id - and alam.list_id = al.list_id - and alam.list_id = :list_id - and alam.attribute_id = :attribute_id -} -set title "Add a Heading Above: ${attribute_pretty_name}" -set context [list [list lists Lists] [list [ams::list::url -package_key $package_key -object_type $object_type -list_name $list_name] ${list_pretty_name}] $title] - -set package_options " [db_list_of_lists select_packages { select package_key, package_key from apm_package_types order by package_key } ]" - -ad_form -name list_form -form { - list_id:integer(hidden) - attribute_id:integer(hidden) - {section_heading:text {label "Heading"} {html {size 40 maxlength 200}}} - {save:text(submit) {label "Save"}} - {delete:text(submit) {label "Delete Heading"}} -} -on_request { -} -on_submit { - if { [string is true [exists_and_not_null delete]] } { - set section_heading "" - } - db_dml update_section_heading { - update ams_list_attribute_map - set section_heading = :section_heading - where list_id = :list_id - and attribute_id = :attribute_id - } -} -after_submit { - ad_returnredirect "list?[export_vars -url {package_key object_type list_name return_url return_url_label}]" - ad_script_abort -} - - -ad_return_template +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ +} { + {list_id:integer,notnull} + {attribute_id:integer,notnull} + return_url:optional + return_url_label:optional +} + +db_0or1row get_heading { select aa.pretty_name as attribute_pretty_name, + al.package_key, + al.object_type, + al.list_name, + al.pretty_name as list_pretty_name, + alam.section_heading + from ams_list_attribute_map alam, + ams_attributes aa, + ams_lists al + where alam.attribute_id = aa.attribute_id + and alam.list_id = al.list_id + and alam.list_id = :list_id + and alam.attribute_id = :attribute_id +} +set title "[_ ams.lt_Add_a_Heading_Above_a]" +set context [list [list lists Lists] [list [ams::list::url -package_key $package_key -object_type $object_type -list_name $list_name] ${list_pretty_name}] $title] + +set package_options " [db_list_of_lists select_packages { select package_key, package_key from apm_package_types order by package_key } ]" + +ad_form -name list_form -form { + list_id:integer(hidden) + attribute_id:integer(hidden) + {section_heading:text {label "[_ ams.Heading]"} {html {size 40 maxlength 200}}} + {save:text(submit) {label "[_ acs-kernel.common_Save]"}} + {delete:text(submit) {label "[_ ams.Delete_Heading]"}} +} -on_request { +} -on_submit { + if { [string is true [exists_and_not_null delete]] } { + set section_heading "" + } + db_dml update_section_heading { + update ams_list_attribute_map + set section_heading = :section_heading + where list_id = :list_id + and attribute_id = :attribute_id + } +} -after_submit { + ad_returnredirect "list?[export_vars -url {package_key object_type list_name return_url return_url_label}]" + 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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-attributes-map.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-attributes-map.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,22 +1,22 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - -} { - {attribute_id:integer,multiple} - {list_id:integer,notnull} -} - -foreach attribute_id $attribute_id { - ams::list::attribute::map -list_id $list_id -attribute_id $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 +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + +} { + {attribute_id:integer,multiple} + {list_id:integer,notnull} +} + +foreach attribute_id $attribute_id { + ams::list::attribute::map -list_id $list_id -attribute_id $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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-attributes-optional.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-attributes-optional.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,23 +1,23 @@ -ad_page_contract { - - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - -} { - {attribute_id:integer,multiple,notnull} - {list_id:integer,notnull} -} - -foreach attribute_id $attribute_id { - ams::list::attribute::optional -list_id $list_id -attribute_id $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 +ad_page_contract { + + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + +} { + {attribute_id:integer,multiple,notnull} + {list_id:integer,notnull} +} + +foreach attribute_id $attribute_id { + ams::list::attribute::optional -list_id $list_id -attribute_id $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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-attributes-required.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-attributes-required.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,23 +1,23 @@ -ad_page_contract { - - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - -} { - {attribute_id:integer,multiple,notnull} - {list_id:integer,notnull} -} - -foreach attribute_id $attribute_id { - ams::list::attribute::required -list_id $list_id -attribute_id $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 +ad_page_contract { + + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + +} { + {attribute_id:integer,multiple,notnull} + {list_id:integer,notnull} +} + +foreach attribute_id $attribute_id { + ams::list::attribute::required -list_id $list_id -attribute_id $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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-attributes-unmap.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-attributes-unmap.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,24 +1,24 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - -} { - {attribute_id:integer,multiple} - {list_id:integer,notnull} - return_url:optional - return_url_label:optional -} - -foreach attribute_id $attribute_id { - ams::list::attribute::unmap -list_id $list_id -attribute_id $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 return_url return_url_label}]" -ad_script_abort +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + +} { + {attribute_id:integer,multiple} + {list_id:integer,notnull} + return_url:optional + return_url_label:optional +} + +foreach attribute_id $attribute_id { + ams::list::attribute::unmap -list_id $list_id -attribute_id $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 return_url return_url_label}]" +ad_script_abort Index: openacs-4/packages/ams/www/list-attributes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/list-attributes.tcl 26 May 2005 07:35:29 -0000 1.2 +++ openacs-4/packages/ams/www/list-attributes.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,25 +1,25 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - -} { - {attribute_id:integer,multiple} - {list_id:integer,notnull} - {command "map"} - return_url:optional - return_url_label:optional -} - -foreach attribute_id $attribute_id { - ams::list::attribute::${command} -list_id $list_id -attribute_id $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 return_url return_url_label}]" -ad_script_abort +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + +} { + {attribute_id:integer,multiple} + {list_id:integer,notnull} + {command "map"} + return_url:optional + return_url_label:optional +} + +foreach attribute_id $attribute_id { + ams::list::attribute::${command} -list_id $list_id -attribute_id $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 return_url return_url_label}]" +ad_script_abort Index: openacs-4/packages/ams/www/list-code.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-code.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/list-code.adp 25 May 2005 10:47:53 -0000 1.2 +++ openacs-4/packages/ams/www/list-code.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,51 +1,52 @@ - -@title@ -@context@ - -

Here is the code necessary to re-create this ams-list on a new system. You may insert this into your appliation code if you would like to.

-
-set list_id [ams::list::new \
-                -package_key "@list_info.package_key@" \
-                -object_type "@list_info.object_type@" \
-                -list_name "@list_info.list_name@" \
-                -pretty_name "@list_info.pretty_name@" \
-                -description "@list_info.description@" \
-                -description_mime_type "@list_info.description_mime_type@"]
-
-
-
-
-
-set attribute_id [attribute::new \
-              -object_type "@attributes.object_type@" \
-              -attribute_name "@attributes.attribute_name@" \
-              -datatype "@attributes.datatype@" \
-              -pretty_name "\#@attributes.pretty_name@#" \
-              -pretty_plural "\#@attributes.pretty_plural@#" \
-              -table_name "@attributes.table_name@" \
-              -column_name "@attributes.column_name@" \
-              -default_value "@attributes.default_value@" \
-              -min_n_values "@attributes.min_n_values@" \
-              -max_n_values "@attributes.max_n_values@" \
-              -sort_order "@attributes.sort_order@" \
-              -storage "@attributes.storage@" \
-              -static_p "@attributes.static_p@" \
-              -if_does_not_exist]
-
-lang::message::register en_US ams @attributes.message_key@ @attributes.true_pretty@ 
-lang::message::register en_US ams @attributes.message_key@_plural @attributes.true_plural@ 
-
-ams::attribute::new \
-              -attribute_id $attribute_id \
-              -widget "@attributes.widget@" \
-              -dynamic_p "@attributes.dynamic_p@"
-
-ams::list::attribute::map \
-              -list_id $list_id \
-              -attribute_id $attribute_id \
-              -sort_order "@attributes.list_sort_order@" \
-              -required_p "@attributes.required_p@" \
-              -section_heading "@attributes.section_heading@"
-
-
-
+ +@title@ +@context@ + +

#ams.lt_Here_is_the_code_nece#

+
+set list_id [ams::list::new \
+                -package_key "@list_info.package_key@" \
+                -object_type "@list_info.object_type@" \
+                -list_name "@list_info.list_name@" \
+                -pretty_name "@list_info.pretty_name@" \
+                -description "@list_info.description@" \
+                -description_mime_type "@list_info.description_mime_type@"]
+
+
+
+
+
+set attribute_id [attribute::new \
+              -object_type "@attributes.object_type@" \
+              -attribute_name "@attributes.attribute_name@" \
+              -datatype "@attributes.datatype@" \
+              -pretty_name "\#@attributes.pretty_name@#" \
+              -pretty_plural "\#@attributes.pretty_plural@#" \
+              -table_name "@attributes.table_name@" \
+              -column_name "@attributes.column_name@" \
+              -default_value "@attributes.default_value@" \
+              -min_n_values "@attributes.min_n_values@" \
+              -max_n_values "@attributes.max_n_values@" \
+              -sort_order "@attributes.sort_order@" \
+              -storage "@attributes.storage@" \
+              -static_p "@attributes.static_p@" \
+              -if_does_not_exist]
+
+lang::message::register en_US ams @attributes.message_key@ @attributes.true_pretty@ 
+lang::message::register en_US ams @attributes.message_key@_plural @attributes.true_plural@ 
+
+ams::attribute::new \
+              -attribute_id $attribute_id \
+              -widget "@attributes.widget@" \
+              -dynamic_p "@attributes.dynamic_p@"
+
+ams::list::attribute::map \
+              -list_id $list_id \
+              -attribute_id $attribute_id \
+              -sort_order "@attributes.list_sort_order@" \
+              -required_p "@attributes.required_p@" \
+              -section_heading "@attributes.section_heading@"
+
+
+
+ Index: openacs-4/packages/ams/www/list-code.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-code.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-code.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-code.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,56 +1,49 @@ -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"} -} - -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] - -regsub -all {"} $list_info(description) {\"} list_info(description) - - -db_multirow -extend {message_key true_pretty true_plural} -unclobber attributes select_mapped_attributes { - select alam.required_p, - alam.section_heading, - alam.sort_order as list_sort_order, - ams.* - 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 -} { - regsub -all {"} $section_heading {\"} section_heading - set message_key "${object_type}_${attribute_name}" - set pretty_name ams.$message_key - set pretty_plural ams.${message_key}_plural - set true_pretty [lang::message::lookup en_US ams.$message_key] - set true_plural [lang::message::lookup en_US ams.${message_key}_plural] -} - - - - -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"} +} + +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] + +regsub -all {"} $list_info(description) {\"} list_info(description) + + +db_multirow -extend {message_key true_pretty true_plural} -unclobber attributes select_mapped_attributes { + select alam.required_p, + alam.section_heading, + alam.sort_order as list_sort_order, + ams.* + 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 +} { + regsub -all {"} $section_heading {\"} section_heading + set message_key "${object_type}_${attribute_name}" + set pretty_name ams.$message_key + set pretty_plural ams.${message_key}_plural + set true_pretty [lang::message::lookup en_US ams.$message_key] + set true_plural [lang::message::lookup en_US ams.${message_key}_plural] +} + +ad_return_template + Index: openacs-4/packages/ams/www/list-form-preview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-form-preview.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ams/www/list-form-preview.adp 18 May 2005 17:11:48 -0000 1.1 +++ openacs-4/packages/ams/www/list-form-preview.adp 28 May 2005 15:37:27 -0000 1.2 @@ -1,9 +1,9 @@ - -@title@ -@context@ - - - - - - + +@title@ +@context@ + + + + + + Index: openacs-4/packages/ams/www/list-form-preview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-form-preview.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/list-form-preview.tcl 26 May 2005 07:35:29 -0000 1.2 +++ openacs-4/packages/ams/www/list-form-preview.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,139 +1,31 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - list_id:integer,notnull -} - - -ams::list::get -list_id $list_id -array list_info -set list_name $list_info(list_name) -set object_type $list_info(object_type) -set package_key $list_info(package_key) -set pretty_name [_ $list_info(pretty_name)] - -set title "Form Preview" -set context [list [list lists Lists] [list [export_vars -base "list" -url {package_key object_type list_name}] $pretty_name] $title] -#ams::widget_options -attribute_id "130" -ad_form -name form_preview \ - -form [ams::ad_form::elements -package_key $package_key \ - -object_type $object_type \ - -list_name $list_name -key list_id] \ - -edit_request { -# ams::ad_form::values -package_key $package_key \ -# -object_type $object_type \ -# -list_name $list_name \ -# -form_name "form_preview" \ -# -object_id $list_id - } -on_submit { -# ams::ad_form::save -package_key $package_key \ -# -object_type $object_type \ -# -list_name $list_name \ -# -form_name "form_preview" \ -# -object_id $list_id - } -after_submit { - ad_returnredirect -message "Submitting the preview form does not save any information." [export_vars -base "list" -url {list_name object_type package_key}] - } - - -# 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" -# -#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 { -# ams::ad_form::save -package_key $package_key \ -# -object_type $object_type \ -# -list_name $list_name \ -# -form_name "entry" \ -# -object_id $object_id -# } -after_submit { -# if { ![exists_and_not_null return_url] } { -# set return_url "./" -# } -# } -# - -#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_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] -# ams::object::attribute::values -vars -object_id $object_id -#} -## set attr_list $rowcount -#template::multirow foreach lists { -# ns_log Notice "$first_names $last_name $home_address" -#} - - -#set fred "" - -#foreach { arg_parser procedure } [info procs "::ams::widget::*"] { -# regsub "::ams::widget::" $procedure "" widget -# if { [exists_and_not_null widget] } { -# lappend fred $widget -# } -#} -#set fred "date" -#set fred [info procs "::ams::widget::${fred}"] - -ad_return_template +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + list_id:integer,notnull +} + + +ams::list::get -list_id $list_id -array list_info +set list_name $list_info(list_name) +set object_type $list_info(object_type) +set package_key $list_info(package_key) +set pretty_name [_ $list_info(pretty_name)] + +set title "[_ ams.Form_Preview]" +set context [list [list lists Lists] [list [export_vars -base "list" -url {package_key object_type list_name}] $pretty_name] $title] +ad_form -name form_preview \ + -form [ams::ad_form::elements -package_key $package_key \ + -object_type $object_type \ + -list_name $list_name -key list_id] \ + -edit_request { + } -on_submit { + } -after_submit { + ad_returnredirect -message "[_ ams.lt_Submitting_the_previe]" [export_vars -base "list" -url {list_name object_type package_key}] + } + +ad_return_template 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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list-order-update.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list-order-update.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,49 +1,49 @@ -ad_page_contract { - - Update sort order - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - sort_key:array - list_id:integer,notnull -} - - -set attribute_ids [db_list get_attribute_ids { select 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 attribute_id $attribute_ids { - if { $sort_key(${attribute_id}) > $highest_sort } { - set highest_sort $sort_key(${attribute_id}) - } -} - -db_transaction { - foreach attribute_id $attribute_ids { - set sort_order $sort_key(${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 attribute_id = :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" +ad_page_contract { + + Update sort order + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + sort_key:array + list_id:integer,notnull +} + + +set attribute_ids [db_list get_attribute_ids { select 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 attribute_id $attribute_ids { + if { $sort_key(${attribute_id}) > $highest_sort } { + set highest_sort $sort_key(${attribute_id}) + } +} + +db_transaction { + foreach attribute_id $attribute_ids { + set sort_order $sort_key(${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 attribute_id = :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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/list.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/list.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,30 +1,31 @@ - -@title@ -@context@ - - - -

- -@return_url_label@ - -Preview Input Form -

- -

Package Key: @package_key@

-

Object Type: @object_type@

-

List Name: @list_name@

- -

Mapped Attributes

- - - - -

Unmapped Attributes

- - - - + +@title@ +@context@ + + + +

+ +@return_url_label@ + +#ams.Preview_Input_Form# +

+ +

#ams.Package_Key# @package_key@

+

#ams.Object_Type# @object_type@

+

#ams.List_Name# @list_name@

+ +

#ams.Mapped_Attributes#

+ + + + +

#ams.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 -r1.3 -r1.4 --- openacs-4/packages/ams/www/list.tcl 26 May 2005 07:35:29 -0000 1.3 +++ openacs-4/packages/ams/www/list.tcl 28 May 2005 15:37:27 -0000 1.4 @@ -1,251 +1,239 @@ -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 unmap_url heading_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 - 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}] - 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 map_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 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 - - - - - +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 "[_ 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 context [list [list lists Lists] $title] + +list::create \ + -name mapped_attributes \ + -multirow mapped_attributes \ + -key attribute_id \ + -row_pretty_plural "[_ ams.Mapped_Attributes]" \ + -checkbox_name checkbox \ + -selected_format $format \ + -class "list" \ + -main_class "list" \ + -sub_class "narrow" \ + -pass_properties { + } -actions { + } -bulk_actions { + "[_ 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 "[_ ams.Attribute]" + display_col attribute_name + } + pretty_name { + label "[_ ams.Pretty_Name_1]" + display_template { + @mapped_attributes.pretty_name@ (Parent Object Type: @mapped_attributes.object_type@) + } + } + widget { + label "[_ ams.Widget_1]" + display_col widget + link_url_eval widgets + } + section_heading { + label "[_ ams.Heading]" + display_col section_heading + } + action { + label "[_ ams.Action]" + display_template { + [_ ams.Unmap] + [_ ams.Add_Heading][_ ams.EditDelete_Heading] + } + } + answer { + label "[_ ams.Required]" + display_template { + + + + + + + } + } + sort_order { + label "[_ ams.Ordering]" + display_template { + + } + } + } -filters { + } -groupby { + } -orderby { + } -formats { + normal { + label "[_ ams.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 unmap_url heading_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 + 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}] + incr sort_order_count 10 +} + +list::create \ + -name unmapped_attributes \ + -multirow 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 { + } -elements { + attribute_name { + label "[_ ams.Attribute]" + display_col attribute_name + } + pretty_name { + label "[_ ams.Pretty_Name_1]" + display_col pretty_name + link_url_eval $attribute_url + } + widget { + label "[_ ams.Widget_1]" + display_col widget + link_url_eval widgets + } + action { + label "[_ ams.Action]" + display_template { + + [_ ams.Define_Widget] + + + [_ ams.Map] + + } + } + } -filters { + } -groupby { + } -orderby { + } -formats { + normal { + label "[_ ams.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 map_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 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 + + + + + Index: openacs-4/packages/ams/www/lists.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/lists.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/lists.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/lists.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,11 +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.

- - - - - + + +@title@ +@context@ + +

#ams.lt_You_can_create_a_list#

+ + + + + Index: openacs-4/packages/ams/www/lists.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/lists.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/lists.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/lists.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,76 +1,76 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - {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 +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + {orderby "name"} +} + +set title "[_ ams.AMS_Lists]" +set context [list $title] + +list::create \ + -name lists \ + -multirow lists \ + -key list_id \ + -row_pretty_plural "[_ ams.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 "[_ ams.Pretty_Name_1]" + } + package_key { + display_col package_key + label "[_ ams.Package_Key_1]" + } + list_name { + display_col list_name + label "[_ ams.List_Name_1]" + link_url_eval $list_url + } + object_type { + display_col object_type + label "[_ ams.Object_Type_1]" + link_url_eval $object_url + } + } -filters { + } -groupby { + } -orderby { + } -formats { + normal { + label "[_ ams.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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/object.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/object.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,13 +1,14 @@ - - -@title@ -@context@ - - - -

AMS Attributes

- - - -

AMS Lists associated with @object_info.pretty_plural@

- + + +@title@ +@context@ + + + +

#ams.AMS_Attributes#

+ + + +

#ams.lt_AMS_Lists_associated_#

+ + Index: openacs-4/packages/ams/www/object.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/object.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/www/object.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/object.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,213 +1,213 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - {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" - } - widget { - label "Widget" - display_template { - Define Widget@object_attributes.widget@ - } - } - } -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 { - label widget_name - multirow_cols {ams_attribute_p widget pretty_name attribute_name} - } - } -formats { - normal { - label "Table" - layout table - row { - pretty_name {} - attribute_name {} - widget {} - } - } - } - - -db_multirow -extend { ams_attribute_url ams_attribute_p } object_attributes select_object_attributes { - select attribute_name, - pretty_name, - pretty_plural, - attribute_id, - widget - from ams_attributes - where object_type = :object_type - order by upper(pretty_name) -} { - if { [exists_and_not_null ams_attribute_id] } { set ams_attribute_p 1 } else { set ams_attribute_p 0 } - set ams_attribute_url "attribute?attribute_id=$attribute_id" - if { [lang::message::message_exists_p en_US $pretty_name] } { - set pretty_name [_ $pretty_name] - } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 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 +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + {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.AMS_Attributes]" \ + -checkbox_name checkbox \ + -selected_format "normal" \ + -class "list" \ + -main_class "list" \ + -sub_class "narrow" \ + -pass_properties { + object_type + } -actions [list "[_ acs-kernel.common_Add]" "attribute-add?object_type=$object_type" "[_ ams.Add_an_AMS_Attribute]"] \ + -bulk_actions { + } -elements { + edit { + label {} + } + pretty_name { + display_col pretty_name + label "[_ ams.Pretty_Name_1]" + link_url_eval $ams_attribute_url + } + attribute_name { + display_col attribute_name + label "[_ ams.Attribute_Name]" + } + widget { + label "[_ ams.Widget_1]" + display_template { + [_ ams.Define_Widget]@object_attributes.widget@ + } + } + } -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 { + label widget_name + multirow_cols {ams_attribute_p widget pretty_name attribute_name} + } + } -formats { + normal { + label "[_ ams.Table]" + layout table + row { + pretty_name {} + attribute_name {} + widget {} + } + } + } + + +db_multirow -extend { ams_attribute_url ams_attribute_p } object_attributes select_object_attributes { + select attribute_name, + pretty_name, + pretty_plural, + attribute_id, + widget + from ams_attributes + where object_type = :object_type + order by upper(pretty_name) +} { + if { [exists_and_not_null ams_attribute_id] } { set ams_attribute_p 1 } else { set ams_attribute_p 0 } + set ams_attribute_url "attribute?attribute_id=$attribute_id" + if { [lang::message::message_exists_p en_US $pretty_name] } { + set pretty_name [_ $pretty_name] + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# 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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/objects.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/objects.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,11 +1,11 @@ - - -@title@ -@context@ - - - - - - - + + +@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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/objects.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/objects.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,66 +1,66 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { - {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 +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { + {orderby "name"} +} + +set title "[_ ams.Objects]" +set context [list $title] + +list::create \ + -name object_types \ + -multirow object_types \ + -key object_type \ + -row_pretty_plural "[_ ams.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 "[_ ams.Pretty_Name_1]" + link_url_eval $object_attributes_url + } + object_type { + display_col object_type + label "[_ ams.Object_Type_1]" + link_url_eval $object_attributes_url + } + } -filters { + } -groupby { + } -orderby { + } -formats { + normal { + label "[_ ams.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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/widgets.adp 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/widgets.adp 28 May 2005 15:37:27 -0000 1.3 @@ -1,13 +1,13 @@ - -@title@ -@context@ - - - - - - - - - - + +@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 -r1.2 -r1.3 --- openacs-4/packages/ams/www/widgets.tcl 18 May 2005 17:11:48 -0000 1.2 +++ openacs-4/packages/ams/www/widgets.tcl 28 May 2005 15:37:27 -0000 1.3 @@ -1,99 +1,99 @@ -ad_page_contract { - - @author Matthew Geddert openacs@geddert.com - @creation-date 2004-07-28 - @cvs-id $Id$ - - -} { -} - - -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 +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id$ + + +} { +} + + +set title "[_ ams.Widgets]" +set context [list $title] + + + + +list::create \ + -name widgets \ + -multirow widgets \ + -key widget_name \ + -row_pretty_plural "[_ ams.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 "[_ ams.Widget_Name]" + } + pretty_name { + display_col pretty_name + label "[_ ams.Pretty_Name_1]" + } + pretty_plural { + display_col pretty_plural + label "[_ ams.Pretty_Plural_1]" + } + widget { + display_col widget + label "[_ ams.Widget_1]" + } + datatype { + display_col datatype + label "[_ ams.Datatype]" + } + parameters { + display_col parameters + label "[_ ams.Parameters]" + } + } -filters { + object_type {} + } -groupby { + } -orderby { + } -formats { + normal { + label "[_ ams.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 { {"[_ ams.Demo_Example_One]" 1} {"[_ ams.Demo_Example_Two]" 2} {"[_ ams.Demo_Example_Three]" 3} {"[_ ams.Demo_Example_Four]" 4} {"[_ ams.Demo_Example_Five]" 5} {"[_ ams.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