Index: openacs-4/packages/contacts/www/admin/full-people.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/admin/full-people.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/contacts/www/admin/full-people.tcl 12 Aug 2018 12:30:06 -0000 1.4 +++ openacs-4/packages/contacts/www/admin/full-people.tcl 6 Nov 2024 12:59:29 -0000 1.5 @@ -49,7 +49,9 @@ -object_type person -set output {"Person ID","First Names","Last Name","Email","URL"} +set output [list] + +set headers {"Person ID" "First Names" "Last Name" "Email" "URL"} set extended_columns [list] template::multirow foreach ext { if { ( $type eq "person" || $type eq "party" ) && [lsearch $preset_columns $key] >= 0 } { @@ -68,17 +70,16 @@ # - when there are many related people the size of the column # could be too big for programs like excel (which is one of # the primary programs this export will be looked at in) - append output ",\"[template::list::csv_quote "$type_pretty: $key_pretty"]\"" + lappend headers "$type_pretty: $key_pretty" - # for testing if you want to limit the number of columns you should do it here # you can simply say that if the count of extend columns > n then do not append # to the extend columns list lappend extended_columns "${type}__${key}" } } -set output "$output\n" +lappend output $headers contacts::multirow \ -extend $extended_columns \ @@ -87,16 +88,13 @@ -format "text" -# we create a command here because it more efficient then -# iterating over all the columns in the multirow foreach -set command [list] -foreach column [template::multirow columns people] { - lappend command "\[template::list::csv_quote \$${column}\]" -} -set command "append output \"\\\"[join $command {\",\"}]\\\"\\n\"" - +set __columns [template::multirow columns people] template::multirow foreach people { - eval $command + set __row [list] + foreach __column $__columns { + lappend __row [set $__column] + } + lappend output $__row } # we save the file to /tmp/full-export.csv @@ -107,7 +105,8 @@ # there is a report storage and queueing mechanism set output_file [open /tmp/full-people.csv "w+"] -puts $output_file $output +package require csv +puts $output_file [::csv::joinlist $output ,] close $output_file # now we return the file - just in case it didn't time out for the user