let list_student env (cgi:Netcgi1_compat.Netcgi_types.cgi_activation) =
let hpr = cgi # output # output_string in
export_type := HtmlJscpt;
handle_export_type cgi;
handle_html_arg cgi "action" (handle_actions cgi);
handle_html_arg cgi "sort" (fun s -> sort_student_list (string_to_sort s));
begin match !export_type with
| HtmlJscpt
| Html -> begin
cgi # set_header ~content_type:"text/html" ();
initialize_html hpr "Student List";
I.print_student_list_html (hpr) !student_list;
hpr "<hr/>";
hpr "<table><tr><td>\n";
reload_student_form hpr;
hpr "</td><td>\n";
save_student_form hpr;
hpr "</td><td>\n";
actions_form hpr;
hpr "</td></tr></table>\n";
display_exports_html hpr cgi;
if (!verbose_mode) then begin
hpr "<hr/>\n";
display_args_html hpr cgi;
display_values_html hpr;
end;
finalize_html hpr;
end;
| Xml -> begin
cgi # set_header ~content_type:"text/xml" ();
I.print_student_list_xml hpr !student_list;
end;
| Text -> begin
cgi # set_header ~content_type:"text/plain" ();
I.print_student_list_txt hpr !student_list;
end;
| Latex -> begin
cgi # set_header ~content_type:"text/plain" ();
I.print_student_list_latex hpr !student_list !num_groups;
end;
| Postscript -> begin
cgi # set_header ~content_type:"application/postscript" ();
let tmp_out_chan = open_out "tmp/test.tex" in
let tmp_out_fun = (fun s -> Printf.fprintf tmp_out_chan "%s" s) in
I.print_student_list_latex tmp_out_fun !student_list !num_groups;
close_out tmp_out_chan;
silent_tex_to_ps "test" "tmp";
input_file_into_hpr hpr "tmp/test.ps";
end;
| _ -> hpr "This export type has not been implemented yet";
end;
cgi # output # commit_work();