Index: openacs-4/packages/assessment/www/asm-admin/results-export.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-export.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/www/asm-admin/results-export.tcl 15 Nov 2007 19:56:32 -0000 1.11 +++ openacs-4/packages/assessment/www/asm-admin/results-export.tcl 29 Aug 2008 19:09:40 -0000 1.12 @@ -67,10 +67,10 @@ lappend session_list $session_id if {$assessment_data(anonymous_p) == "t"} { - set csv_result_list($session_id) [list $percent_score $submission_date] + set csv_result_list($session_id) [list \"[as::assessment::quote_export -text $percent_score]\" \"[as::assessment::quote_export -text $submission_date]\"] } else { set subject_mail [db_string get-email "select email from parties where party_id = :subject_id"] - set csv_result_list($session_id) [list $percent_score $submission_date $subject_id [as::assessment::quote_export -text $subject_mail] [as::assessment::quote_export -text [person::name -person_id $subject_id]]] + set csv_result_list($session_id) [list \"$percent_score\" \"$submission_date\" \"$subject_id \" \"[as::assessment::quote_export -text $subject_mail]\" \"[as::assessment::quote_export -text [person::name -person_id $subject_id]]\"] } } @@ -83,26 +83,26 @@ util_unlist $one_section section_id section_item_id set mc_item_list [list] db_foreach all_section_items {} { - lappend item_list $as_item_item_id + lappend item_list $section_id $as_item_id if {$column_format == "name"} { - set csv_first_row($as_item_item_id) [as::assessment::quote_export -text $field_name] + set csv_first_row($as_item_id) [as::assessment::quote_export -text "$as_item_id __ $field_name"] } else { if {[empty_string_p $description]} { - set csv_first_row($as_item_item_id) [as::assessment::quote_export -text $title] + set csv_first_row($as_item_id) [as::assessment::quote_export -text $title] } else { - set csv_first_row($as_item_item_id) [as::assessment::quote_export -text "$title / $description"] + set csv_first_row($as_item_id) [as::assessment::quote_export -text "$title / $description"] } } set item_type [string range $object_type end-1 end] if {$item_type == "mc"} { - lappend mc_item_list $as_item_item_id + lappend mc_item_list $as_item_id } else { array set results [as::item_type_$item_type\::results -as_item_item_id $as_item_item_id -section_item_id $section_item_id -data_type $data_type -sessions $session_list] foreach session_id $session_list { if {[info exists results($session_id)]} { - set csv_${as_item_item_id}($session_id) [as::assessment::quote_export -text $results($session_id)] + set csv_${section_id}_${as_item_id}($session_id) [as::assessment::quote_export -text $results($session_id)] } else { - set csv_${as_item_item_id}($session_id) "" + set csv_${section_id}_${as_item_id}($session_id) "" } } array unset results @@ -113,31 +113,35 @@ if {![empty_string_p $mc_item_list]} { db_foreach mc_items {} { if {[empty_string_p $text_value]} { - if {[exists_and_not_null csv_${mc_item_id}($session_id)]} { + if {[exists_and_not_null csv_${section_id}_${as_item_id}($session_id)]} { # append list of choices seperated with comma - append csv_${mc_item_id}($session_id) ",[as::assessment::quote_export -text $title]" + append csv_${section_id}_${as_item_id}($session_id) ",[as::assessment::quote_export -text $title]" } else { # just set the choice value - set csv_${mc_item_id}($session_id) [as::assessment::quote_export -text $title] + set csv_${section_id}_${as_item_id}($session_id) [as::assessment::quote_export -text $title] } } else { - set csv_${mc_item_id}($session_id) [as::assessment::quote_export -text $text_value] + if {[exists_and_not_null csv_${section_id}_${as_item_id}($session_id)]} { + append csv_${section_id}_${as_item_id}($session_id) ",[as::assessment::quote_export -text $text_value]" + } else { + set csv_${section_id}_${as_item_id}($session_id) [as::assessment::quote_export -text $text_value] + } } } array unset results } } } - foreach item_id $item_list { + foreach {section_id item_id} $item_list { lappend csv_first_row_list "\"$csv_first_row($item_id)\"" } set csv_text "[join $csv_first_row_list ","]\r\n" foreach session_id $session_list { - foreach item_id $item_list { - if {[exists_and_not_null csv_${item_id}($session_id)]} { - lappend csv_result_list($session_id) "\"[set csv_${item_id}($session_id)]\"" + foreach {section_id item_id} $item_list { + if {[exists_and_not_null csv_${section_id}_${item_id}($session_id)]} { + lappend csv_result_list($session_id) "\"[set csv_${section_id}_${item_id}($session_id)]\"" } else { lappend csv_result_list($session_id) "" }