Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -r1.33 -r1.34 --- openacs-4/packages/assessment/assessment.info 3 Mar 2005 22:46:41 -0000 1.33 +++ openacs-4/packages/assessment/assessment.info 9 Apr 2005 22:39:26 -0000 1.34 @@ -7,7 +7,7 @@ f f - + Eduardo Perez Ureta Assessment package that will replace the survey, quizz, complex survey, poll and other data collection packages @@ -17,7 +17,7 @@ Create assessments and evalueate. 0 - + Index: openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml,v diff -u -r1.49 -r1.50 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 7 Apr 2005 20:17:12 -0000 1.49 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 9 Apr 2005 22:39:27 -0000 1.50 @@ -50,6 +50,7 @@ allow multiple Allow Negative Shall a negative percentage be allowed (as the total result). + Allow Randomizing allow %assessment_data.number_tries% Alphabetical AND Index: openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 21 Feb 2005 14:32:55 -0000 1.5 +++ openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 9 Apr 2005 22:39:27 -0000 1.6 @@ -86,6 +86,10 @@ show_item_name_p char(1) default 'f' constraint as_assessments_name_p_ck check (show_item_name_p in ('t','f')), + -- whether the order of section, items, choices can be random + random_p char(1) default 't' + constraint as_assessments_random_p_ck + check (random_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. 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.16 -r1.17 --- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 21 Feb 2005 14:32:55 -0000 1.16 +++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 9 Apr 2005 22:39:27 -0000 1.17 @@ -86,6 +86,10 @@ show_item_name_p char(1) default 'f' constraint as_assessments_show_item_name_p_ck check (show_item_name_p in ('t','f')), + -- whether the order of section, items, choices can be random + random_p char(1) default 't' + constraint as_assessments_random_p_ck + check (random_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. Index: openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql 21 Feb 2005 14:32:56 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql 9 Apr 2005 22:39:27 -0000 1.7 @@ -9,7 +9,7 @@ cr.description, o.creation_user, o.creation_date, a.instructions, a.run_mode, a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, - a.start_time, a.end_time, a.number_tries, a.wait_between_tries, + a.start_time, a.end_time, a.number_tries, a.wait_between_tries, a.random_p, a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p from as_assessments a, cr_revisions cr, cr_items ci, acs_objects o where ci.item_id = :assessment_id Index: openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 9 Apr 2005 22:39:27 -0000 1.7 @@ -9,7 +9,7 @@ cr.description, o.creation_user, o.creation_date, a.instructions, a.run_mode, a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, - a.start_time, a.end_time, a.number_tries, a.wait_between_tries, + a.start_time, a.end_time, a.number_tries, a.wait_between_tries, a.random_p, a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p from as_assessments a, cr_revisions cr, cr_items ci, acs_objects o where ci.item_id = :assessment_id Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 2 Apr 2005 02:36:44 -0000 1.21 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 9 Apr 2005 22:39:27 -0000 1.22 @@ -17,6 +17,7 @@ {-secure_access_p ""} {-reuse_responses_p ""} {-show_item_name_p ""} + {-random_p ""} {-entry_page ""} {-exit_page ""} {-consent_page ""} @@ -60,6 +61,7 @@ [list secure_access_p $secure_access_p] \ [list reuse_responses_p $reuse_responses_p] \ [list show_item_name_p $show_item_name_p] \ + [list random_p $random_p] \ [list entry_page $entry_page] \ [list exit_page $exit_page] \ [list consent_page $consent_page] \ @@ -90,6 +92,7 @@ {-secure_access_p ""} {-reuse_responses_p ""} {-show_item_name_p ""} + {-random_p ""} {-entry_page ""} {-exit_page ""} {-consent_page ""} @@ -125,6 +128,7 @@ [list secure_access_p $secure_access_p] \ [list reuse_responses_p $reuse_responses_p] \ [list show_item_name_p $show_item_name_p] \ + [list random_p $random_p] \ [list entry_page $entry_page] \ [list exit_page $exit_page] \ [list consent_page $consent_page] \ @@ -197,6 +201,7 @@ [list secure_access_p $a(secure_access_p)] \ [list reuse_responses_p $a(reuse_responses_p)] \ [list show_item_name_p $a(show_item_name_p)] \ + [list random_p $a(random_p)] \ [list entry_page $a(entry_page)] \ [list exit_page $a(exit_page)] \ [list consent_page $a(consent_page)] \ @@ -253,6 +258,7 @@ [list secure_access_p $a(secure_access_p)] \ [list reuse_responses_p $a(reuse_responses_p)] \ [list show_item_name_p $a(show_item_name_p)] \ + [list random_p $a(random_p)] \ [list entry_page $a(entry_page)] \ [list exit_page $a(exit_page)] \ [list consent_page $a(consent_page)] \ @@ -302,6 +308,7 @@ {-assessment_id:required} {-session_id:required} {-sort_order_type ""} + {-random_p ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-14 @@ -318,6 +325,10 @@ # get all sections of assessment set all_sections [db_list_of_lists assessment_sections {}] + if {$random_p == "f"} { + set sort_order_type "default path" + } + # sort section positions switch -exact $sort_order_type { randomized { Index: openacs-4/packages/assessment/tcl/as-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-install-procs.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/assessment/tcl/as-install-procs.tcl 1 Apr 2005 10:30:30 -0000 1.28 +++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 9 Apr 2005 22:39:27 -0000 1.29 @@ -149,6 +149,7 @@ content::type::attribute::new -content_type {as_assessments} -attribute_name {secure_access_p} -datatype {boolean} -pretty_name {Assessment Secure Access} -column_spec {char(1)} content::type::attribute::new -content_type {as_assessments} -attribute_name {reuse_responses_p} -datatype {boolean} -pretty_name {Assessment Reuse Responses} -column_spec {char(1)} content::type::attribute::new -content_type {as_assessments} -attribute_name {show_item_name_p} -datatype {boolean} -pretty_name {Assessment Show question titles} -column_spec {char(1)} +content::type::attribute::new -content_type {as_assessments} -attribute_name {random_p} -datatype {boolean} -pretty_name {Assessment Allow Random} -column_spec {char(1)} content::type::attribute::new -content_type {as_assessments} -attribute_name {entry_page} -datatype {string} -pretty_name {Assessment Customizable Entry page} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {exit_page} -datatype {string} -pretty_name {Assessment Customizable Thank/Exit page} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {consent_page} -datatype {text} -pretty_name {Assessment Consent Pages} -column_spec {text} @@ -349,6 +350,8 @@ 0.10d9 0.10d10 { as::actions::update_checks_after_upgrade } + 0.10d10 0.10d11 { + content::type::attribute::new -content_type {as_assessments} -attribute_name {random_p} -datatype {boolean} -pretty_name {Assessment Allow Random} -column_spec {char(1)} + } } - } } Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 25 Feb 2005 09:21:23 -0000 1.10 +++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.11 @@ -100,6 +100,7 @@ {-title ""} {-subtext ""} {-required_p ""} + {-random_p ""} {-default_value ""} {-data ""} } { @@ -108,13 +109,17 @@ Render an Item Display CheckBox Type } { - db_1row display_item_data {} if {[empty_string_p $required_p]} { set required_p f } + array set type [util_memoize [list as::item_display_cb::data -type_id $type_id]] + if {$random_p == "f"} { + set type(sort_order_type) "order_of_entry" + } + # numerical alphabetical randomized order_of_entry - switch -exact $sort_order_type { + switch -exact $type(sort_order_type) { alphabetical { set data [lsort -dictionary -index 0 $data] } @@ -127,8 +132,20 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list values $default_value] [list options $data] [list html $html_display_options]] + set param_list [list [list label $title] [list help_text $subtext] [list values $default_value] [list options $data] [list html $type(html_display_options)]] set element_params [concat [list "$element\:text(checkbox)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] } + +ad_proc -public as::item_display_cb::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Get the Display Data of CheckBox Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 @@ -23,7 +23,7 @@ - + select html_display_options, choice_orientation, choice_label_orientation, Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 25 Feb 2005 09:21:23 -0000 1.10 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.11 @@ -100,6 +100,7 @@ {-title ""} {-subtext ""} {-required_p ""} + {-random_p ""} {-default_value ""} {-data ""} } { @@ -108,13 +109,17 @@ Render an Item Display RadioButton Type } { - db_1row display_item_data {} if {[empty_string_p $required_p]} { set required_p f } + array set type [util_memoize [list as::item_display_rb::data -type_id $type_id]] + if {$random_p == "f"} { + set type(sort_order_type) "order_of_entry" + } + # numerical alphabetical randomized order_of_entry - switch -exact $sort_order_type { + switch -exact $type(sort_order_type) { alphabetical { set data [lsort -dictionary -index 0 $data] } @@ -127,8 +132,20 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list options $data] [list html $html_display_options]] + set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list options $data] [list html $type(html_display_options)]] set element_params [concat [list "$element\:text(radio)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] } + +ad_proc -public as::item_display_rb::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Get the Display Data of RadioButton Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 @@ -23,7 +23,7 @@ - + select html_display_options, choice_orientation, choice_label_orientation, Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 7 Jan 2005 16:10:44 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 9 Apr 2005 22:39:27 -0000 1.7 @@ -89,6 +89,7 @@ {-title ""} {-subtext ""} {-required_p ""} + {-random_p ""} {-default_value ""} {-data ""} } { @@ -97,7 +98,7 @@ Render an Item Display ShortAnswer Type } { - db_1row display_item_data {} + array set type [util_memoize [list as::item_display_sa::data -type_id $type_id]] if {[empty_string_p $required_p]} { set required_p f } @@ -109,11 +110,23 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $html_display_options]] - if {![empty_string_p $abs_size]} { - lappend param_list [list maxlength $abs_size] + set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $type(html_display_options)]] + if {![empty_string_p $type(abs_size)]} { + lappend param_list [list maxlength $type(abs_size)] } set element_params [concat [list "$element\:$datatype\(text)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] } + +ad_proc -public as::item_display_sa::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Get the Display Data of ShortAnswer Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 @@ -22,7 +22,7 @@ - + select html_display_options, abs_size, box_orientation Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 25 Feb 2005 09:21:23 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.9 @@ -99,6 +99,7 @@ {-title ""} {-subtext ""} {-required_p ""} + {-random_p ""} {-default_value ""} {-data ""} } { @@ -107,18 +108,23 @@ Render an Item Display SelectBox Type } { - db_1row display_item_data {} if {[empty_string_p $required_p]} { set required_p f } + + array set type [util_memoize [list as::item_display_sb::data -type_id $type_id]] + if {$random_p == "f"} { + set type(sort_order_type) "order_of_entry" + } + set widget select - if {$multiple_p == "t"} { + if {$type(multiple_p) == "t"} { set widget multiselect } # multiple_p # numerical alphabetical randomized order_of_entry - switch -exact $sort_order_type { + switch -exact $type(sort_order_type) { alphabetical { set data [lsort -dictionary -index 0 $data] } @@ -131,8 +137,20 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list values $default_value] [list options $data] [list html $html_display_options]] + set param_list [list [list label $title] [list help_text $subtext] [list values $default_value] [list options $data] [list html $type(html_display_options)]] set element_params [concat [list "$element\:text($widget)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] } + +ad_proc -public as::item_display_sb::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Get the Display Data of SelectBox Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 @@ -23,7 +23,7 @@ - + select html_display_options, multiple_p, choice_label_orientation, Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 7 Jan 2005 16:10:44 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 9 Apr 2005 22:39:27 -0000 1.7 @@ -94,6 +94,7 @@ {-title ""} {-subtext ""} {-required_p ""} + {-random_p ""} {-default_value ""} {-data ""} } { @@ -102,7 +103,7 @@ Render an Item Display TextArea Type } { - db_1row display_item_data {} + array set type [util_memoize [list as::item_display_ta::data -type_id $type_id]] if {[empty_string_p $required_p]} { set required_p f } @@ -117,11 +118,23 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $html_display_options]] - if {![empty_string_p $abs_size]} { - lappend param_list [list maxlength $abs_size] + set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $type(html_display_options)]] + if {![empty_string_p $type(abs_size)]} { + lappend param_list [list maxlength $type(abs_size)] } set element_params [concat [list "$element\:$datatype\(textarea),nospell$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] } + +ad_proc -public as::item_display_ta::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Get the Display Data of TextArea Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 @@ -22,7 +22,7 @@ - + select html_display_options, abs_size, item_answer_alignment Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 7 Jan 2005 16:10:44 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 9 Apr 2005 22:39:27 -0000 1.7 @@ -89,6 +89,7 @@ {-title ""} {-subtext ""} {-required_p ""} + {-random_p ""} {-default_value ""} {-data ""} } { @@ -97,7 +98,7 @@ Render an Item Display TextBox Type } { - db_1row display_item_data {} + array set type [util_memoize [list as::item_display_tb::data -type_id $type_id]] if {[empty_string_p $required_p]} { set required_p f } @@ -112,11 +113,23 @@ if {$required_p != "t"} { set optional ",optional" } - set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $html_display_options]] - if {![empty_string_p $abs_size]} { - lappend param_list [list maxlength $abs_size] + set param_list [list [list label $title] [list help_text $subtext] [list value $default_value] [list html $type(html_display_options)]] + if {![empty_string_p $type(abs_size)]} { + lappend param_list [list maxlength $type(abs_size)] } set element_params [concat [list "$element\:$datatype\(text)$optional"] $param_list] ad_form -extend -name $form -form [list $element_params] } + +ad_proc -public as::item_display_tb::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Get the Display Data of TextBox Type +} { + db_1row display_item_data {} -column_array type + return [array get type] +} Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 9 Apr 2005 22:39:27 -0000 1.3 @@ -22,7 +22,7 @@ - + select html_display_options, abs_size, item_answer_alignment Index: openacs-4/packages/assessment/tcl/as-item-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 7 Jan 2005 16:10:44 -0000 1.13 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 9 Apr 2005 22:39:27 -0000 1.14 @@ -14,30 +14,50 @@ {-default_value ""} {-show_feedback ""} {-required_p f} + {-random_p ""} } { @author Timo Hentschel (timo@timohentschel.de) - @modified-date 2004-12-10 + @modified-date 2005-04-08 Add items to a form. The form values are stored in response_to_item.item_id } { randomInit [randomRange 20000] set element_name "response_to_item.$item_id" - db_1row item_properties {} - set item_type [string range $item_type end-1 end] - set display_type [string range $display_type end-1 end] + array set item [util_memoize [list as::item_form::item_data -item_id $item_id]] + set item_type [string range $item(item_type) end-1 end] + set display_type [string range $item(display_type) end-1 end] - util_unlist [as::item_type_$item_type\::render -type_id $item_type_id -session_id $session_id -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback] default_value data + if {$random_p == "f"} { + set item_data [util_memoize [list as::item_type_$item_type\::render -type_id $item(item_type_id) -session_id "" -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback]] + } else { + set item_data [as::item_type_$item_type\::render -type_id $item(item_type_id) -session_id $session_id -section_id $section_id -as_item_id $item_id -default_value $default_value -show_feedback $show_feedback] + } + util_unlist $item_data default_value data + as::item_display_$display_type\::render \ -form $name \ -element $element_name \ - -type_id $display_type_id \ - -datatype $data_type \ - -title $title \ - -subtext $subtext \ + -type_id $item(display_type_id) \ + -datatype $item(data_type) \ + -title $item(title) \ + -subtext $item(subtext) \ -required_p $required_p \ + -random_p $random_p \ -default_value $default_value \ -data $data return $display_type } + +ad_proc -private as::item_form::item_data { + -item_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Gets the item type and display +} { + db_1row item_properties {} -column_array item + return [array get item] +} Index: openacs-4/packages/assessment/tcl/as-item-form-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-item-form-procs.xql 7 Jan 2005 16:10:44 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.xql 9 Apr 2005 22:39:27 -0000 1.7 @@ -1,7 +1,7 @@ - + select cr.title, i.subtext, i.data_type, max(oi.object_id) as item_type_id, oi.object_type as item_type, Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 2 Mar 2005 18:10:29 -0000 1.16 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 9 Apr 2005 22:39:27 -0000 1.17 @@ -292,16 +292,13 @@ Process a Response to a Multiple Choice Type } { - db_1row item_type_data {} - - db_foreach check_choices {} { - if {$correct_answer_p == "t"} { - set correct_choices($choice_id) $percent_score - } - set choices($choice_id) $percent_score + array set type [util_memoize [list as::item_type_mc::data -type_id $type_id]] + array set choices $type(choices) + if {[info exists type(correct_choices)]} { + array set correct_choices $type(correct_choices) } - if {$increasing_p == "t"} { + if {$type(increasing_p) == "t"} { # if not all correct answers are given, award fraction of the points set percent 0 foreach choice_id $response { @@ -316,7 +313,7 @@ } } - if {$allow_negative_p == "f" && $percent < 0} { + if {$type(allow_negative_p) == "f" && $percent < 0} { # don't allow negative percentage set percent 0 } @@ -327,6 +324,31 @@ as::session_results::new -target_id $item_data_id -points $points } +ad_proc -public as::item_type_mc::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Return the Data of a Multiple Choice Type +} { + db_1row item_type_data {} -column_array type + + db_foreach check_choices {} { + if {$correct_answer_p == "t"} { + set correct_choices($choice_id) $percent_score + } + set choices($choice_id) $percent_score + } + + set type(choices) [array get choices] + if {[array exists correct_choices]} { + set type(correct_choices) [array get correct_choices] + } + + return [array get type] +} + ad_proc -public as::item_type_mc::results { -as_item_item_id:required -section_item_id:required Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql 26 Jan 2005 11:06:45 -0000 1.9 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql 9 Apr 2005 22:39:27 -0000 1.10 @@ -74,7 +74,7 @@ - + select increasing_p, allow_negative_p @@ -84,7 +84,7 @@ - + select choice_id, correct_answer_p, percent_score Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 24 Feb 2005 09:22:12 -0000 1.15 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 9 Apr 2005 22:39:27 -0000 1.16 @@ -108,7 +108,8 @@ array set values $default_value set default $values(clob_answer) } else { - set default [db_string item_type_data {}] + array set type [util_memoize [list as::item_type_oq::data -type_id $type_id]] + set default $type(default_value) } return [list $default ""] @@ -130,24 +131,37 @@ Process a Response to an Open Question Type } { - db_1row item_type_data {} + array set type [util_memoize [list as::item_type_oq::data -type_id $type_id]] set response [lindex $response 0] - if {[llength $keywords] > 0} { + if {[llength $type(keywords)] > 0} { set points 0 - foreach keyword $keywords { + foreach keyword $type(keywords) { if {[regexp -nocase [string tolower $keyword] $response]} { incr points } } - set points [expr round($max_points * $points / [llength $keywords])] + set points [expr round($max_points * $points / [llength $type(keywords)])] } else { set points "" } - as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -clob_answer $response -points $points -allow_overwrite_p $allow_overwrite_p + set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -clob_answer $response -points $points -allow_overwrite_p $allow_overwrite_p] + as::session_results::new -target_id $item_data_id -points $points } +ad_proc -public as::item_type_oq::data { + -type_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-04-08 + + Return the Data of an Open Question Type +} { + db_1row item_type_data {} -column_array type + return [array get type] +} + ad_proc -public as::item_type_oq::results { -as_item_item_id:required -section_item_id:required Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql 24 Feb 2005 09:22:12 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql 9 Apr 2005 22:39:27 -0000 1.7 @@ -23,26 +23,16 @@ - + - select default_value + select keywords, default_value from as_item_type_oq where as_item_type_id = :type_id - - - - select keywords - from as_item_type_oq - where as_item_type_id = :type_id - - - - Index: openacs-4/packages/assessment/tcl/as-section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 31 Mar 2005 13:04:58 -0000 1.20 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 9 Apr 2005 22:39:27 -0000 1.21 @@ -202,6 +202,7 @@ {-session_id:required} {-sort_order_type ""} {-num_items ""} + {-random_p ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-14 @@ -233,6 +234,10 @@ set max_pos [array size section_items] } + if {$random_p == "f"} { + set sort_order_type "order_by_entry" + } + # sort item positions that are not fixed switch -exact $sort_order_type { alphabetical { Index: openacs-4/packages/assessment/www/assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.tcl,v diff -u -r1.41 -r1.42 --- openacs-4/packages/assessment/www/assessment.tcl 31 Mar 2005 10:15:27 -0000 1.41 +++ openacs-4/packages/assessment/www/assessment.tcl 9 Apr 2005 22:39:28 -0000 1.42 @@ -94,7 +94,7 @@ # get all sections of assessment in correct order - set section_list [as::assessment::sections -assessment_id $assessment_rev_id -session_id $session_id -sort_order_type $assessment_data(section_navigation)] + set section_list [as::assessment::sections -assessment_id $assessment_rev_id -session_id $session_id -sort_order_type $assessment_data(section_navigation) -random_p $assessment_data(random_p)] if {[empty_string_p $section_order]} { # start at the first section @@ -116,7 +116,8 @@ } # get all items of section in correct order - set item_list [as::section::items -section_id $section_id -session_id $session_id -sort_order_type $display(sort_order_type) -num_items $section(num_items)] + set item_list [as::section::items -section_id $section_id -session_id $session_id -sort_order_type $display(sort_order_type) -num_items $section(num_items) -random_p $assessment_data(random_p)] + set section(num_sections) [llength $section_list] set section(num_items) [llength $item_list] if {![empty_string_p $section(max_time_to_complete)]} { @@ -271,7 +272,7 @@ if {$assessment_data(reuse_responses_p) == "t"} { set default_value [as::item_data::get -subject_id $user_id -as_item_id $as_item_id] } - set presentation_type [as::item_form::add_item_to_form -name show_item_form -session_id $session_id -section_id $section_id -item_id $as_item_id -default_value $default_value -required_p $required_p] + set presentation_type [as::item_form::add_item_to_form -name show_item_form -session_id $session_id -section_id $section_id -item_id $as_item_id -default_value $default_value -required_p $required_p -random_p $assessment_data(random_p)] } else { # submit each item seperately @@ -339,7 +340,11 @@ set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] if {$presentation_type == "rb" || $presentation_type == "cb"} { - db_1row choice_orientation {} + array set item [util_memoize [list as::item_form::item_data -item_id $as_item_id]] + array set type [util_memoize [list as::item_display_$presentation_type\::data -type_id $item(display_type_id)]] + set choice_orientation $type(choice_orientation) + array unset item + array unset type } else { set choice_orientation "" } Index: openacs-4/packages/assessment/www/assessment.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/assessment/www/assessment.xql 11 Mar 2005 18:54:12 -0000 1.12 +++ openacs-4/packages/assessment/www/assessment.xql 9 Apr 2005 22:39:28 -0000 1.13 @@ -73,18 +73,6 @@ - - - - select d.choice_orientation - from as_item_rels r, as_item_display_$presentation_type d - where r.item_rev_id = :as_item_id - and r.rel_type = 'as_item_display_rel' - and r.target_rev_id = d.as_item_display_id - - - - Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 8 Apr 2005 00:46:02 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 9 Apr 2005 22:39:28 -0000 1.7 @@ -68,6 +68,7 @@ {secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}} {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}} {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} + {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Return_Url_help]"}} {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}} @@ -89,6 +90,7 @@ set secure_access_p f set reuse_responses_p f set show_item_name_p f + set random_p t set entry_page "" set exit_page "" set consent_page "" @@ -138,6 +140,7 @@ -secure_access_p $secure_access_p \ -reuse_responses_p $reuse_responses_p \ -show_item_name_p $show_item_name_p \ + -random_p $random_p \ -entry_page "" \ -exit_page "" \ -consent_page $consent_page \ @@ -181,6 +184,7 @@ -secure_access_p $secure_access_p \ -reuse_responses_p $reuse_responses_p \ -show_item_name_p $show_item_name_p \ + -random_p $random_p \ -entry_page "" \ -exit_page "" \ -consent_page $consent_page \