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.5 -r1.6 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 4 Aug 2004 09:40:24 -0000 1.5 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 5 Aug 2004 10:33:43 -0000 1.6 @@ -7,17 +7,19 @@ create table as_items ( as_item_id integer - constraint as_item_item_id_pk + constraint as_items_item_id_pk primary key - constraint as_item_item_id_fk + constraint as_items_item_id_fk references cr_revisions(revision_id), -- a secondary label, needed for many kinds of questions subtext varchar(500), -- a short label for use in data output header rows, etc field_code varchar(500), + -- some descriptive text + definition text, -- whether Item must be answered (default value, can be overriden) required_p char(1) default 'f' - constraint as_item_required_p_ck + constraint as_items_required_p_ck check (required_p in ('t','f')), data_type varchar(50), -- optional max number of seconds to perform Item @@ -28,9 +30,9 @@ create table as_item_choices ( choice_id integer - constraint as_item_choice_id_pk + constraint as_item_choices_id_pk primary key - constraint as_item_choice_id_fk + constraint as_item_choices_id_fk references cr_revisions(revision_id), parent_id integer constraint as_item_choices_parent_id_fk @@ -42,21 +44,21 @@ boolean_value boolean, -- references an item in the CR -- for an image, audio file, or video file content_value integer - constraint as_item_choice_content_value_fk + constraint as_item_choices_content_value_fk references cr_revisions, -- where optionally some preset feedback can be specified by the author - feedback_text varchar(500), - correct_answer_p char(1) default 'f' - constraint as_item_choice_correct_answer_p_ck - check (correct_answer_p in ('t','f')), + feedback_text varchar(500), selected_p char(1) default 'f' - constraint as_item_choice_correct_answer_p_ck + constraint as_item_choices_selected_p_ck + check (selected_p in ('t','f')), + correct_answer_p char(1) default 'f' + constraint as_item_choices_correct_answer_ck check (correct_answer_p in ('t','f')), + sort_order integer, -- this is where points are stored - score integer - constraint as_item_choice_value_ck - check (value <= 100), - sort_order integer + percent_score integer + constraint as_item_choices_percent_score_ck + check (percent_score <= 100) ); create table as_item_help_map ( Index: openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql 28 Jul 2004 11:10:31 -0000 1.3 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql 5 Aug 2004 10:33:43 -0000 1.4 @@ -12,8 +12,8 @@ constraint as_item_type_mc_as_item_type_id_fk references cr_revisions(revision_id), increasing_p char(1) default 'f' - constraint as_item_type_mc_point_distrib_p_ck - check (point_distrib_p in ('t','f')), + constraint as_item_type_mc_increasing_p_ck + check (increasing_p in ('t','f')), allow_negative_p char(1) default 'f' constraint as_item_type_mc_allow_negative_p_ck check (allow_negative_p in ('t','f')), @@ -23,18 +23,19 @@ create table as_item_type_oq ( as_item_type_id integer - constraint as_item_type_mc_as_item_type_id_pk + constraint as_item_type_oq_as_item_type_id_pk primary key - constraint as_item_type_mc_as_item_type_id_fk + constraint as_item_type_oq_as_item_type_id_fk references cr_revisions(revision_id), - default_value varchar(500) + default_value varchar(500), + feedback_text varchar(500) ); create table as_item_display_rb ( as_item_display_id integer - constraint as_item_display_mc_as_item_display_id_pk + constraint as_item_display_rb_as_item_display_id_pk primary key - constraint as_item_display_mc_as_item_display_id_fk + constraint as_item_display_rb_as_item_display_id_fk references cr_revisions(revision_id), html_display_options varchar(50), choice_orientation varchar(20), @@ -45,15 +46,15 @@ create table as_item_display_cb ( as_item_display_id integer - constraint as_item_display_mc_as_item_display_id_pk + constraint as_item_display_cb_as_item_display_id_pk primary key - constraint as_item_display_mc_as_item_display_id_fk + constraint as_item_display_cb_as_item_display_id_fk references cr_revisions(revision_id), html_display_options varchar(50), choice_orientation varchar(20), choice_label_orientation varchar(20), allow_multiple_p char(1) default 'f' - constraint as_item_type_mc_allow_multiple_p_ck + constraint as_item_type_cb_allow_multiple_p_ck check (allow_multiple_p in ('t','f')), sort_order_type varchar(20), item_answer_alignment varchar(20) Index: openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 20 Jul 2004 18:11:15 -0000 1.1 +++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 5 Aug 2004 10:33:43 -0000 1.2 @@ -25,7 +25,7 @@ -- May actually be superfluous presentation_type varchar(25), item_aligment varchar(25) - constraint as_section_display_types_ck + constraint as_section_display_types_item_alignment_ck check (item_aligment in ('beside_left','beside_right','below','above')), display_options varchar(25) ); @@ -66,24 +66,38 @@ assessment_id integer constraint as_assessments_assessment_id_pk primary key, - short_name varchar(500), - author varchar(500), - definition text, + creator_id integer, instructions text, - scaled_p char(1) default 'f' - constraint as_assessments_scaled_p_ck - check (scaled_p in ('t','f')), + -- whether this is a standalone assessment (like current surveys), or if it provides an "assessment service" to another OpenACS app, or a "web service" via SOAP etc mode varchar(25), - validate_p char(1) default 'f' - constraint as_assessments_validate_p_ck - check (validate_p in ('t','f')), - enabled_p char(1) default 'f' - constraint as_assessments_enable_p_ck - check (enable_p in ('t','f')), editable_p char(1) default 'f' constraint as_assessments_editable_p_ck check (editable_p in ('t','f')), - as_template integer + anonymous_p char(1) default 'f' + constraint as_assessments_anonymous_p_ck + check (anonymous_p in ('t','f')), + secure_access_p char(1) default 'f' + constraint as_assessments_secure_access_p_ck + check (secure_access_p in ('t','f')), + reuse_responses_p char(1) default 'f' + constraint as_assessments_reuse_responses_p_ck + check (reuse_responses_p in ('t','f')), + show_item_name_p char(1) default 'f' + constraint as_assessments_show_item_name_p_ck + check (show_item_name_p in ('t','f')), + -- The customizable entry page that will be displayed before the first response. + entry_page varchar(50), + -- Customizable exit / thank you page that will be displayed once the assessment has been responded. + exit_page varchar(50), + consent_page text, + return_url varchar(50), + start_time timestamptz, + end_time timestamptz, + number_tries integer, + wait_between_tries integer, + time_for_response integer, + show_feedback varchar(50), + section_navigation varchar(50) ); create table as_assessment_section_map ( @@ -113,7 +127,10 @@ constraint as_item_section_map_required_p_ck check (required_p in ('t','f')), item_default integer, - content_value integer, + -- references CR + content_value integer + constraint as_item_section_map_content_value_fk + references cr_revisions, numeric_value integer, feedback_text text, max_time_to_complete integer, 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.4 -r1.5 --- openacs-4/packages/assessment/tcl/assessment-procs.tcl 4 Aug 2004 09:40:24 -0000 1.4 +++ openacs-4/packages/assessment/tcl/assessment-procs.tcl 5 Aug 2004 10:33:43 -0000 1.5 @@ -5,20 +5,20 @@ } ad_proc -public as_item_choice_new { + {-parent_id:required} {-name:required} {-title:required} - {-description ""} - {-parent_id:required} {-data_type ""} {-numeric_value ""} {-text_value ""} - {-boolean:boolean ""} + {-boolean_value:boolean ""} {-content_value ""} {-feedback_text ""} {-selected_p:boolean ""} - {-corrent_answer_p:boolean ""} - {-score ""} + {-correct_answer_p:boolean ""} {-sort_order ""} + {-percent_score ""} + } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 @@ -30,7 +30,7 @@ # Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (as_item_choice_id) set item_choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name $name -title $title ] - set as_item_choice_id [content::revision::new -item_id $item_choice_id -content_type {as_item_choices} -title $title -attributes [list [list parent_id $parent_id ] [list data_type $data_type ] [list numeric_value $numeric_value ] [list $text_value text_value] [list boolean $boolean] [list content_value $content_value] [list feedback_text $feedback_text] [list selected_p $selected_p] [list corrent_answer_p $corrent_answer_p] [list score $score] [list sort_order $sort_order] ] ] + set as_item_choice_id [content::revision::new -item_id $item_choice_id -content_type {as_item_choices} -title $title -attributes [list [list parent_id $parent_id ] [list data_type $data_type ] [list numeric_value $numeric_value ] [list $text_value text_value] [list boolean_value $boolean_value] [list content_value $content_value] [list feedback_text $feedback_text] [list selected_p $selected_p] [list correct_answer_p $correct_answer_p] [list sort_order $sort_order] [list percent_score $percent_score] ] ] # FIXME too much code repetition here # maybe there are more efficient ways to to it (maybe using hashes to pass the values between functions) return $as_item_choice_id @@ -39,7 +39,6 @@ ad_proc -public as_item_type_mc_new { {-name:required} {-title:required} - {-description ""} {-increasing_p ""} {-allow_negative_p ""} {-num_correct_answers ""} @@ -54,45 +53,48 @@ set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] # Insert as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) - set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name $as_items__name -title $as_items__title ] - set as_item_type_mc_id [content::revision::new -item_id $item_item_id -content_type {as_item_type_mc} -title $as_items__title -attributes [list [list increasing_p $increasing_p] [list allow_negative_p $allow_negative_p] [list num_correct_answers $num_correct_answers] [list num_answers $num_answers] ] ] + set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name $name -title $title ] + set as_item_type_mc_id [content::revision::new -item_id $item_item_type_mc_id -content_type {as_item_type_mc} -title $title -attributes [list [list increasing_p $increasing_p] [list allow_negative_p $allow_negative_p] [list num_correct_answers $num_correct_answers] [list num_answers $num_answers] ] ] + return $as_item_type_mc_id } ad_proc -public as_item_display_rb_new { {-name:required} - {-title:required} - {-description ""} - {-increasing_p ""} - {-allow_negative_p ""} - {-num_correct_answers ""} - {-num_answers ""} + {-html_display_options ""} + {-choice_orientation ""} + {-choice_label_orientation ""} + {-sort_order_type ""} + {-item_answer_alignment ""} } { @author Eduardo Perez (eperez@it.uc3m.es) + @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-07-26 - New Multiple Choice item to the data database + New Item Display RadioButton Type to the data database } { set package_id [ad_conn package_id] set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"] - # Insert as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) - set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name $as_items__name -title $as_items__title ] - set as_item_type_mc_id [content::revision::new -item_id $item_item_id -content_type {as_item_type_mc} -title $as_items__title -attributes [list [list increasing_p $increasing_p] [list allow_negative_p $allow_negative_p] [list num_correct_answers $num_correct_answers] [list num_answers $num_answers] ] ] + # Insert as_item_display_rb in the CR (and as_item_display_rb table) getting the revision_id (as_item_display_id) + set item_item_display_rb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_rb} -name $name] + set as_item_display_rb_id [content::revision::new -item_id $item_item_display_rb_id -content_type {as_item_display_rb} -attributes [list [list html_display_options $html_display_options] [list choice_orientation $choice_orientation] [list choice_label_orientation $choice_label_orientation] [list sort_order_type $sort_order_type] [list item_answer_alignment $item_answer_alignment] ] ] + return $as_item_display_rb_id } ad_proc -public as_item_new { {-name:required} {-title:required} - {-description ""} {-type ""} {-type_attributes ""} {-display ""} {-display_attributes ""} {-subtext ""} {-field_code ""} + {-definition ""} {-required_p ""} + {-data_type ""} {-max_time_to_complete ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @@ -105,7 +107,7 @@ # Insert as_item in the CR (and as_assessments table) getting the revision_id (as_item_id) 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] ] ] + 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 definition $definition] [list required_p $required_p] [list data_type $data_type] [list max_time_to_complete $max_time_to_complete] ] ] if {$type == {mc}} { set as_item_type_id [as_item_type_mc_new $type_attributes] 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.5 -r1.6 --- openacs-4/packages/assessment/www/assessment-create.tcl 5 Aug 2004 07:24:28 -0000 1.5 +++ openacs-4/packages/assessment/www/assessment-create.tcl 5 Aug 2004 10:33:43 -0000 1.6 @@ -57,19 +57,19 @@ content::type::create_attribute -content_type {as_assessments} -attribute_name {creator_id} -datatype {number} -pretty_name {Assessment Creator Identifier} -column_spec {integer} -content::type::create_attribute -content_type {as_assessments} -attribute_name {instructions} -datatype {string} -pretty_name {Assessment Creator Instructions} -column_spec {varchar(500)} -content::type::create_attribute -content_type {as_assessments} -attribute_name {mode} -datatype {string} -pretty_name {Assessment Mode} -column_spec {varchar(500)} +content::type::create_attribute -content_type {as_assessments} -attribute_name {instructions} -datatype {string} -pretty_name {Assessment Creator Instructions} -column_spec {text} +content::type::create_attribute -content_type {as_assessments} -attribute_name {mode} -datatype {string} -pretty_name {Assessment Mode} -column_spec {varchar(25)} content::type::create_attribute -content_type {as_assessments} -attribute_name {enabled_p} -datatype {boolean} -pretty_name {Assessment Enabled} -column_spec {char(1)} content::type::create_attribute -content_type {as_assessments} -attribute_name {anonymous_p} -datatype {boolean} -pretty_name {Assessment Anonymous} -column_spec {char(1)} content::type::create_attribute -content_type {as_assessments} -attribute_name {secure_access_p} -datatype {boolean} -pretty_name {Assessment Secure Access} -column_spec {char(1)} content::type::create_attribute -content_type {as_assessments} -attribute_name {reuse_responses_p} -datatype {boolean} -pretty_name {Assessment Reuse Responses} -column_spec {char(1)} content::type::create_attribute -content_type {as_assessments} -attribute_name {show_item_name_p} -datatype {boolean} -pretty_name {Assessment Show question titles} -column_spec {char(1)} content::type::create_attribute -content_type {as_assessments} -attribute_name {entry_page} -datatype {string} -pretty_name {Assessment Customizable Entry page} -column_spec {varchar(50)} content::type::create_attribute -content_type {as_assessments} -attribute_name {exit_page} -datatype {string} -pretty_name {Assessment Customizable Thank/Exit page} -column_spec {varchar(50)} -content::type::create_attribute -content_type {as_assessments} -attribute_name {consent_page} -datatype {string} -pretty_name {Assessment Consent Pages} -column_spec {varchar(500)} +content::type::create_attribute -content_type {as_assessments} -attribute_name {consent_page} -datatype {string} -pretty_name {Assessment Consent Pages} -column_spec {text} content::type::create_attribute -content_type {as_assessments} -attribute_name {return_url} -datatype {string} -pretty_name {Assessment Return URL} -column_spec {varchar(50)} -content::type::create_attribute -content_type {as_assessments} -attribute_name {start_time} -datatype {number} -pretty_name {Assessment Start Time} -column_spec {integer} -content::type::create_attribute -content_type {as_assessments} -attribute_name {end_time} -datatype {number} -pretty_name {Assessment End Time} -column_spec {integer} +content::type::create_attribute -content_type {as_assessments} -attribute_name {start_time} -datatype {number} -pretty_name {Assessment Start Time} -column_spec {timestamptz} +content::type::create_attribute -content_type {as_assessments} -attribute_name {end_time} -datatype {number} -pretty_name {Assessment End Time} -column_spec {timestamptz} content::type::create_attribute -content_type {as_assessments} -attribute_name {number_tries} -datatype {number} -pretty_name {Assessment Number Tries} -column_spec {integer} content::type::create_attribute -content_type {as_assessments} -attribute_name {wait_between_tries} -datatype {number} -pretty_name {Assessment Wait Between Tries} -column_spec {integer} content::type::create_attribute -content_type {as_assessments} -attribute_name {time_for_response} -datatype {number} -pretty_name {Assessment Time for Response} -column_spec {integer}