| |
127 |
127 |
array unset results |
| |
128 |
128 |
} |
| |
129 |
129 |
} |
| |
130 |
130 |
} |
| |
131 |
131 |
|
| |
132 |
132 |
foreach item_id $item_list { |
| |
133 |
133 |
lappend csv_first_row_list $csv_first_row($item_id) |
| |
134 |
134 |
} |
| |
135 |
135 |
set csv_text "[join $csv_first_row_list ";"]\r\n" |
| |
136 |
136 |
|
| |
137 |
137 |
foreach session_id $session_list { |
| |
138 |
138 |
foreach item_id $item_list { |
| |
139 |
139 |
if {[exists_and_not_null csv_${item_id}($session_id)]} { |
| |
140 |
140 |
lappend csv_result_list($session_id) "[set csv_${item_id}($session_id)]" |
| |
141 |
141 |
} else { |
| |
142 |
142 |
lappend csv_result_list($session_id) "" |
| |
143 |
143 |
} |
| |
144 |
144 |
} |
| |
145 |
145 |
append csv_text "[join $csv_result_list($session_id) ";"]\r\n" |
| |
146 |
146 |
} |
| |
147 |
|
set csv_text [string map {\xe4 � \xfc � \xf6 � \xdf � \xc4 � \xdc � \xd6 �} $csv_text] |
| |
|
147 |
set csv_text [string map {\xe4 ä \xfc ü \xf6 ö \xdf ß \xc4 Ä \xdc Ü \xd6 Ö} $csv_text] |
| |
148 |
148 |
} -after_submit { |
| |
149 |
149 |
set tmp_filename [ns_tmpnam] |
| |
150 |
150 |
set tmp_csv_filename "$tmp_filename.csv" |
| |
151 |
151 |
set fp [open $tmp_csv_filename w] |
| |
152 |
152 |
puts $fp "$csv_text" |
| |
153 |
153 |
close $fp |
| |
154 |
154 |
ns_set put [ad_conn outputheaders] Content-Disposition "attachment;filename=results.csv" |
| |
155 |
155 |
ns_return 200 "text/plain" [encoding convertfrom iso8859-1 "$csv_text"] |
| |
156 |
156 |
ns_returnfile 200 text/csv $tmp_csv_filename |
| |
157 |
157 |
# iso-8859-1 |
| |
158 |
158 |
} |
| |
159 |
159 |
|
| |
160 |
160 |
ad_return_template |