Index: openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 28 Jul 2004 14:59:49 -0000 1.4 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 4 Aug 2004 09:40:24 -0000 1.5 @@ -15,20 +15,13 @@ subtext varchar(500), -- a short label for use in data output header rows, etc field_code varchar(500), - -- whether Item is released for actual use - enabled_p char(1) default 'f' - constraint as_item_enabled_p_ck - check (enabled_p in ('t','f')), -- whether Item must be answered (default value, can be overriden) required_p char(1) default 'f' constraint as_item_required_p_ck check (required_p in ('t','f')), - -- NOTE Is this correct? - -- optional field that sets what the Item will display when first output (eg text in a textbox; eg the defaults that ad_dateentrywidget expects: "" for "no date", "0" for "today", or else some specific date set by the author; see this example) - item_default varchar(500), + data_type varchar(50), -- optional max number of seconds to perform Item max_time_to_complete integer, - -- NOTE Is this correct? -- a denormalization to cache the generated "widget" for the Item (NB: when any change is made to an as_item_choice related to an as_item, this will have to be updated!) adp_chunk varchar(500) ); Index: openacs-4/packages/assessment/tcl/assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/assessment-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/assessment-procs.tcl 28 Jul 2004 14:59:49 -0000 1.3 +++ openacs-4/packages/assessment/tcl/assessment-procs.tcl 4 Aug 2004 09:40:24 -0000 1.4 @@ -87,7 +87,9 @@ {-title:required} {-description ""} {-type ""} + {-type_attributes ""} {-display ""} + {-display_attributes ""} {-subtext ""} {-field_code ""} {-required_p ""} @@ -105,5 +107,17 @@ set item_item_id [content::item::new -parent_id $folder_id -content_type {as_items} -name $name -title $title ] set as_item_id [content::revision::new -item_id $item_item_id -content_type {as_items} -title $title -attributes [list [list subtext $subtext] [list field_code $field_code] [list required_p $required_p] [list max_time_to_complete $max_time_to_complete] ] ] + if {$type == {mc}} { + set as_item_type_id [as_item_type_mc_new $type_attributes] + } + + if {$display == {rb}} { + set as_item_display_id [as_item_display_rb_new $display_attributes] + } + + # rel display and type to the item + content::item::relate -item_id $as_item_id -object_id $as_item_type_id -relation_tag {as_item_type_rel} + content::item::relate -item_id $as_item_id -object_id $as_item_display_id -relation_tag {as_item_display_rel} + return $as_item_id } Index: openacs-4/packages/assessment/www/assessment-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment-create.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/assessment-create.tcl 28 Jul 2004 14:59:49 -0000 1.3 +++ openacs-4/packages/assessment/www/assessment-create.tcl 4 Aug 2004 09:40:24 -0000 1.4 @@ -13,11 +13,24 @@ if {0} { content::type::create_type -content_type {as_item_choices} -supertype {content_revision} -pretty_name {Assessment Item Choice} -pretty_plural {Assessment Item Choices} -table_name {as_item_choices} -id_column {choice_id} -content::type::create_type -content_type {as_items} -supertype {content_revision} -pretty_name {Assessment Item} -pretty_plural {Assessment Items} -table_name {as_items} -id_column {as_item_id} -content::type::create_type -content_type {as_sections} -supertype {content_revision} -pretty_name {Assessment Section} -pretty_plural {Assessment Sections} -table_name {as_sections} -id_column {section_id} -content::type::create_type -content_type {as_assessments} -supertype {content_revision} -pretty_name {Assessment Assessment} -pretty_plural {Assessment Assessments} -table_name {as_assessments} -id_column {assessment_id} +content::type::create_type -content_type {as_item_type_mc} -supertype {content_revision} -pretty_name {Assessment Item Type Multiple Choice} -pretty_plural {Assessment Item Type Multiple Choice} -table_name {as_item_type_mc} -id_column {as_item_type_id} +content::type::create_type -content_type {as_item_display_rb} -supertype {content_revision} -pretty_name {Assessment Item Display Radio Button} -pretty_plural {Assessment Item Display Radio Button} -table_name {as_item_display_rb} -id_column {as_item_display_id} +content::type::create_type -content_type {as_items} -supertype {content_revision} -pretty_name {Assessment Item} -pretty_plural {Assessment Items} -table_name {as_items} -id_column {as_item_id} +content::type::create_type -content_type {as_sections} -supertype {content_revision} -pretty_name {Assessment Section} -pretty_plural {Assessment Sections} -table_name {as_sections} -id_column {section_id} +content::type::create_type -content_type {as_assessments} -supertype {content_revision} -pretty_name {Assessment Assessment} -pretty_plural {Assessment Assessments} -table_name {as_assessments} -id_column {assessment_id} } +content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)} +content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {choice_orientation} -datatype {string} -pretty_name {Choice Orientation} -column_spec {varchar(20)} +content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {choice_label_orientation} -datatype {string} -pretty_name {Choice Label Orientation} -column_spec {varchar(20)} +content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {sort_order_type} -datatype {string} -pretty_name {Sort Order Type} -column_spec {varchar(20)} +content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {item_answer_alignment} -datatype {string} -pretty_name {Item Answer Alignment} -column_spec {varchar(20)} + +content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {increasing_p} -datatype {boolean} -pretty_name {Increasing} -column_spec {char(1)} +content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {allow_negative_p} -datatype {boolean} -pretty_name {Allow Negative} -column_spec {char(1)} +content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {num_correct_answers} -datatype {number} -pretty_name {Number of Correct Answers} -column_spec {integer} +content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {num_answers} -datatype {number} -pretty_name {Number of Answers} -column_spec {integer} + content::type::create_attribute -content_type {as_item_choices} -attribute_name {parent_id} -datatype {number} -pretty_name {Parent ID} -column_spec {integer} content::type::create_attribute -content_type {as_item_choices} -attribute_name {data_type} -datatype {string} -pretty_name {Data Type} -column_spec {varchar(20)} content::type::create_attribute -content_type {as_item_choices} -attribute_name {numeric_value} -datatype {number} -pretty_name {Numeric Value} -column_spec {numeric} @@ -32,21 +45,25 @@ content::type::create_attribute -content_type {as_items} -attribute_name {subtext} -datatype {string} -pretty_name {Item Subtext} -column_spec {varchar(500)} content::type::create_attribute -content_type {as_items} -attribute_name {field_code} -datatype {string} -pretty_name {Item Field Code} -column_spec {varchar(500)} -content::type::create_attribute -content_type {as_items} -attribute_name {enabled_p} -datatype {boolean} -pretty_name {Item Enabled} -column_spec {char(1)} content::type::create_attribute -content_type {as_items} -attribute_name {required_p} -datatype {boolean} -pretty_name {Item Required} -column_spec {char(1)} -content::type::create_attribute -content_type {as_items} -attribute_name {item_default} -datatype {string} -pretty_name {Item Default} -column_spec {varchar(500)} +content::type::create_attribute -content_type {as_items} -attribute_name {data_type} -datatype {string} -pretty_name {Item Data Type} -column_spec {varchar(50)} content::type::create_attribute -content_type {as_items} -attribute_name {max_time_to_complete} -datatype {number} -pretty_name {Item Max Time to Complate} -column_spec {integer} content::type::create_attribute -content_type {as_items} -attribute_name {adp_chunk} -datatype {string} -pretty_name {Item Adp Chunk} -column_spec {varchar(500)} content::type::create_attribute -content_type {as_sections} -attribute_name {instructions} -datatype {string} -pretty_name {Section Instructions} -column_spec {text} content::type::create_attribute -content_type {as_sections} -attribute_name {enabled_p} -datatype {boolean} -pretty_name {Section Enabled} -column_spec {char(1)} } +content::type::register_relation_type -content_type {as_items} -target_type {as_item_type_mc} -relation_tag {as_item_type_rel} +content::type::register_relation_type -content_type {as_items} -target_type {as_item_display_rb} -relation_tag {as_item_display_rel} + +if {0} { set folder_id [content::folder::new -name {as_items} -package_id [ad_conn package_id] ] content::folder::register_content_type -folder_id $folder_id -content_type {as_item_choices} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_items} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_sections} -include_subtypes t content::folder::register_content_type -folder_id $folder_id -content_type {as_assessments} -include_subtypes t +} set context [list]