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.38 -r1.39 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 24 Feb 2005 09:22:11 -0000 1.38 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 11 Mar 2005 18:54:12 -0000 1.39 @@ -133,6 +133,7 @@ Which orientation shall the choices have Title Title + Existing Choice Set Choose the action to perform Condition Confirmation Index: openacs-4/packages/assessment/lib/section-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.adp,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/lib/section-items.adp 9 Feb 2005 10:42:50 -0000 1.13 +++ openacs-4/packages/assessment/lib/section-items.adp 11 Mar 2005 18:54:12 -0000 1.14 @@ -63,16 +63,23 @@
@items.title;noquote@
- - @formgroup.widget;noquote@ @formgroup.label;noquote@
-
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+ + + @formgroup.widget;noquote@ @formgroup.label;noquote@ + +
+
@items.html;noquote@ -
Index: openacs-4/packages/assessment/lib/section-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/lib/section-items.tcl 1 Feb 2005 22:41:54 -0000 1.6 +++ openacs-4/packages/assessment/lib/section-items.tcl 11 Mar 2005 18:54:12 -0000 1.7 @@ -2,24 +2,27 @@ {section_id:text(hidden) {value $section_id}} } -db_multirow -extend { checks_related presentation_type html mc_type} items section_items {} { +db_multirow -extend { checks_related presentation_type html mc_type choice_orientation } items section_items {} { set presentation_type [as::item_form::add_item_to_form -name admin_section -section_id $section_id -item_id $as_item_id] if {$presentation_type == "fitb"} { regsub -all -line -nocase -- { + + + + 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/tcl/as-section-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql 21 Feb 2005 14:32:56 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql 11 Mar 2005 18:54:12 -0000 1.6 @@ -7,9 +7,11 @@ select s.as_item_id, ci.name, r.title, r.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, - r2.title as content_filename, ci2.content_type + r2.title as content_filename, ci2.content_type, + ir.target_rev_id as as_item_type_id from as_session_items s, as_items i, as_item_section_map m, cr_revisions r, - cr_items ci, as_item_rels ar, cr_revisions r2, cr_items ci2 + cr_items ci, as_item_rels ar, cr_revisions r2, cr_items ci2, + as_item_rels ir where ar.item_rev_id(+) = s.as_item_id and ar.rel_type(+) = 'as_item_content_rel' and ar.target_rev_id = r2.revision_id(+) @@ -21,6 +23,8 @@ and ci.item_id = r.item_id and m.as_item_id = s.as_item_id and m.section_id = s.section_id + and ir.item_rev_id = s.as_item_id + and ir.rel_type = 'as_item_type_rel' order by s.sort_order @@ -31,9 +35,10 @@ select i.as_item_id, ci.name, cr.title, cr.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, - r2.title as content_filename, ci2.content_type, m.fixed_position + r2.title as content_filename, ci2.content_type, m.fixed_position, + ir.target_rev_id as as_item_type_id from as_item_section_map m, as_items i, cr_revisions cr, cr_items ci, - as_item_rels ar, cr_revisions r2, cr_items ci2 + as_item_rels ar, cr_revisions r2, cr_items ci2, as_item_rels ir where ar.item_rev_id (+) = i.as_item_id and ar.rel_type (+) = 'as_item_content_rel' and ar.target_rev_id = r2.revision_id (+) @@ -42,6 +47,8 @@ and i.as_item_id = m.as_item_id and m.section_id = :section_id and ci.item_id = cr.item_id + and ir.item_rev_id = i.as_item_id + and ir.rel_type = 'as_item_type_rel' order by m.sort_order Index: openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql 11 Mar 2005 18:54:12 -0000 1.6 @@ -7,9 +7,10 @@ select s.as_item_id, ci.name, r.title, r.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, - r2.title as content_filename, ci2.content_type + r2.title as content_filename, ci2.content_type, + ir.target_rev_id as as_item_type_id from cr_items ci, as_items i, as_item_section_map m, cr_revisions r, - as_session_items s + as_item_rels ir, as_session_items s left outer join as_item_rels ar on (ar.item_rev_id = s.as_item_id and ar.rel_type = 'as_item_content_rel') left outer join cr_revisions r2 on (ar.target_rev_id = r2.revision_id) left outer join cr_items ci2 on (ci2.item_id = r2.item_id) @@ -20,6 +21,8 @@ and ci.item_id = r.item_id and m.as_item_id = s.as_item_id and m.section_id = s.section_id + and ir.item_rev_id = s.as_item_id + and ir.rel_type = 'as_item_type_rel' order by s.sort_order @@ -30,15 +33,19 @@ select i.as_item_id, ci.name, cr.title, cr.description, i.subtext, m.required_p, m.max_time_to_complete, r2.revision_id as content_rev_id, - r2.title as content_filename, ci2.content_type, m.fixed_position - from as_item_section_map m, cr_revisions cr, cr_items ci, as_items i + r2.title as content_filename, ci2.content_type, m.fixed_position, + ir.target_rev_id as as_item_type_id + from as_item_section_map m, cr_revisions cr, cr_items ci, + as_item_rels ir, as_items i left outer join as_item_rels ar on (ar.item_rev_id = i.as_item_id and ar.rel_type = 'as_item_content_rel') left outer join cr_revisions r2 on (ar.target_rev_id = r2.revision_id) left outer join cr_items ci2 on (ci2.item_id = r2.item_id) where cr.revision_id = i.as_item_id and i.as_item_id = m.as_item_id and m.section_id = :section_id and ci.item_id = cr.item_id + and ir.item_rev_id = i.as_item_id + and ir.rel_type = 'as_item_type_rel' order by m.sort_order 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.18 -r1.19 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 21 Feb 2005 14:32:56 -0000 1.18 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 11 Mar 2005 18:54:12 -0000 1.19 @@ -216,7 +216,7 @@ set open_positions "" set max_pos 0 db_foreach section_items {} { - set section_items($as_item_id) [list $name $title $description $subtext $required_p $max_time_to_complete $content_rev_id $content_filename $content_type] + set section_items($as_item_id) [list $name $title $description $subtext $required_p $max_time_to_complete $content_rev_id $content_filename $content_type $as_item_type_id] if {![empty_string_p $fixed_position] && $fixed_position != "0"} { set fixed_positions($fixed_position) $as_item_id if {$max_pos < $fixed_position} { Index: openacs-4/packages/assessment/www/assessment-section-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-section-submit.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/www/assessment-section-submit.adp 10 Feb 2005 14:47:00 -0000 1.4 +++ openacs-4/packages/assessment/www/assessment-section-submit.adp 11 Mar 2005 18:54:12 -0000 1.5 @@ -30,24 +30,51 @@ - @items.name@:#assessment.Question# @items.rownum@: * - @items.title;noquote@ - @items.content;noquote@ - - -
- + @items.name@:#assessment.Question# @items.rownum@: * + @items.title;noquote@ +
@items.content;noquote@
+ + + +
+ + + + +
+ + + + + - @formgroup.widget;noquote@ - @formgroup.label;noquote@ -
+
+ + + + + + + +
@formgroup.label;noquote@
@items.description@ + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+ + +
+ @formgroup.widget;noquote@ @formgroup.label;noquote@ + +
+ + + +
@formgroup.widget;noquote@
+ + - @items.html;noquote@ + @items.html;noquote@ - + @@ -58,10 +85,12 @@
+
-
-

Index: openacs-4/packages/assessment/www/assessment-single-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-single-submit.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/assessment-single-submit.adp 24 Jan 2005 14:54:30 -0000 1.3 +++ openacs-4/packages/assessment/www/assessment-single-submit.adp 11 Mar 2005 18:54:12 -0000 1.4 @@ -37,13 +37,19 @@ @items.content;noquote@ -
+
+ +
@items.description@ - @formgroup.widget;noquote@ - @formgroup.label;noquote@ -
+ + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+ + @formgroup.widget;noquote@ @formgroup.label;noquote@ +
+
@items.html;noquote@ @@ -59,7 +65,9 @@
-
+
+
+

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.39 -r1.40 --- openacs-4/packages/assessment/www/assessment.tcl 2 Mar 2005 22:37:05 -0000 1.39 +++ openacs-4/packages/assessment/www/assessment.tcl 11 Mar 2005 18:54:12 -0000 1.40 @@ -249,15 +249,15 @@ {session_id:text(hidden) {value $session_id}} } -multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content +multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content as_item_type_id choice_orientation next_title set unsubmitted_list [list] set validate_list [list] set required_count 0 foreach one_item $item_list { - util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type - + util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type as_item_type_id + if {$required_p == "t"} { # make sure that mandatory items are answered lappend validate_list "response_to_item.$as_item_id {\[exists_and_not_null response_to_item($as_item_id)\]} \"\[_ assessment.form_element_required\]\"" @@ -338,9 +338,25 @@ } set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] - multirow append items $as_item_id $name $title $description $subtext $required_p $max_time_to_complete $presentation_type "" $submitted_p [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type] + if {$presentation_type == "rb" || $presentation_type == "cb"} { + db_1row choice_orientation {} + } else { + set choice_orientation "" + } + + multirow append items $as_item_id $name $title $description $subtext $required_p $max_time_to_complete $presentation_type "" $submitted_p [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type] $as_item_type_id $choice_orientation "" } +for {set i 1; set j 2} {$i <= ${items:rowcount}} {incr i; incr j} { + upvar 0 items:$i this + if {$i < ${items:rowcount}} { + upvar 0 items:$j next + set this(next_title) $next(title) + } else { + set this(next_title) "" + } +} + if {$display(submit_answer_p) != "t"} { # process multiple submit set template "assessment-section-submit" 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.11 -r1.12 --- openacs-4/packages/assessment/www/assessment.xql 29 Jan 2005 11:03:07 -0000 1.11 +++ openacs-4/packages/assessment/www/assessment.xql 11 Mar 2005 18:54:12 -0000 1.12 @@ -73,6 +73,18 @@ + + + + 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/item-add-mc-choices.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 24 Feb 2005 09:22:12 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 11 Mar 2005 18:54:12 -0000 1.6 @@ -47,9 +47,9 @@ set count_correct 0 db_foreach get_choices {} { if {$correct_answer_p == "t"} { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice]\"\} \{value \"$title \"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" } else { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice]\"\} \{value \"$title \"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" } append ad_form_code "\{selected.$choice_id:text(checkbox),optional \{label \"[_ assessment.Default_Selected]\"\} \{options \$selected_options\} \{help_text \"[_ assessment.Default_Selected_help]\"\}\}\n" append ad_form_code "\{fixed_pos.$choice_id:text,optional,nospell \{label \"[_ assessment.Fixed_Position]\"\} \{html \{size 5 maxlength 5\}\} \{help_text \"[_ assessment.choice_Fixed_Position_help]\"\}\}\n" Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 21 Feb 2005 14:32:56 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 11 Mar 2005 18:54:12 -0000 1.4 @@ -30,10 +30,13 @@ set page_title [_ assessment.add_item_type_mc] set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set folder_id [as::assessment::folder_id -package_id $package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] set correct_options [list [list "[_ assessment.yes]" t]] +set choice_sets [db_list_of_lists existing_choice_sets {}] +set choice_sets [concat [list [list "" ""]] $choice_sets] set display_types [list] foreach display_type [db_list display_types {}] { lappend display_types [list "[_ assessment.item_display_$display_type]" $display_type] @@ -48,6 +51,7 @@ {num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}} {num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} + {mc_id:text(select),optional {label "[_ assessment.Choice_Sets]"} {options $choice_sets} {help_text "[_ assessment.Choice_Sets_help]"}} } # add form entries for each choice @@ -70,6 +74,7 @@ append ad_form_code "\}" eval ad_form -extend -name item_add_mc $ad_form_code + set edit_request "{ set title \"\" set increasing_p f @@ -91,16 +96,20 @@ set edit_data "{ db_transaction { if {!\[db_0or1row item_type {}\] || \$object_type != \"as_item_type_mc\"} { - set mc_id \[as::item_type_mc::new \\ + if {\[empty_string_p \$mc_id\]} { + set new_mc_id \[as::item_type_mc::new \\ -title \$title \\ -increasing_p \$increasing_p \\ -allow_negative_p \$negative_p \\ -num_correct_answers \$num_correct_answers \\ -num_answers \$num_answers\] + } else { + set new_mc_id \$mc_id + } if {!\[info exists object_type\]} { # first item type mapped - as::item_rels::new -item_rev_id \$as_item_id -target_rev_id \$mc_id -type as_item_type_rel + as::item_rels::new -item_rev_id \$as_item_id -target_rev_id \$new_mc_id -type as_item_type_rel } else { # old item type existing set as_item_id \[as::item::new_revision -as_item_id \$as_item_id\] @@ -109,22 +118,27 @@ } else { # old mc item type existing set as_item_id \[as::item::new_revision -as_item_id \$as_item_id\] - set mc_id \[as::item_type_mc::edit \\ + if {\[empty_string_p \$mc_id\]} { + set new_mc_id \[as::item_type_mc::edit \\ -as_item_type_id \$as_item_type_id \\ -title \$title \\ -increasing_p \$increasing_p \\ -allow_negative_p \$negative_p \\ -num_correct_answers \$num_correct_answers \\ -num_answers \$num_answers\] + } else { + set new_mc_id \$mc_id + } db_dml update_item_type {} } set count 0 - foreach i \[lsort -integer \[array names choice\]\] { - if {!\[empty_string_p \$choice(\$i)\]} { - incr count - set choice_id \[as::item_choice::new -mc_id \$mc_id \\ + if {\[empty_string_p \$mc_id\]} { + foreach i \[lsort -integer \[array names choice\]\] { + if {!\[empty_string_p \$choice(\$i)\]} { + incr count + set choice_id \[as::item_choice::new -mc_id \$new_mc_id \\ -title \$choice(\$i) \\ -numeric_value \"\" \\ -text_value \"\" \\ @@ -134,14 +148,19 @@ -correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] \\ -sort_order \$count \\ -percent_score \"\"\] + } } } } }" set after_submit "{ # now go to form to enter choice-specific data - ad_returnredirect \[export_vars -base \"item-add-mc-choices\" {assessment_id section_id as_item_id after mc_id display_type}\] + if {\[empty_string_p \$mc_id\]} { + ad_returnredirect \[export_vars -base \"item-add-mc-choices\" {assessment_id section_id as_item_id after mc_id display_type}\] + } else { + ad_returnredirect \[export_vars -base \"item-add-display-\$display_type\" {assessment_id section_id as_item_id after}\] + } ad_script_abort }" Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 11 Mar 2005 18:54:12 -0000 1.2 @@ -1,6 +1,18 @@ + + + + select r.title, r.revision_id + from cr_revisions r, cr_items i + where r.revision_id = i.latest_revision + and i.parent_id = :folder_id + and i.content_type = 'as_item_type_mc' + + + + @@ -27,7 +39,7 @@ update as_item_rels - set target_rev_id = :mc_id + set target_rev_id = :new_mc_id where item_rev_id = :as_item_id and rel_type = 'as_item_type_rel' Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 21 Feb 2005 14:32:56 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 11 Mar 2005 18:54:12 -0000 1.5 @@ -48,9 +48,9 @@ foreach one_choice $choices { util_unlist $one_choice choice_id title correct_answer_p feedback_text selected_p percent_score fixed_position answer_value content_rev_id content_filename content_name if {$correct_answer_p == "t"} { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice]\"\} \{value \"$title \"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" } else { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice]\"\} \{value \"$title \"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" } if {$selected_p == "t"} { append ad_form_code "\{selected.$choice_id:text(checkbox),optional \{label \"[_ assessment.Default_Selected]\"\} \{options \$selected_options\} \{value \"t\"\} \{help_text \"[_ assessment.Default_Selected_help]\"\}\}\n"