2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: undelete_image_form.ml,v 1.1 2004/09/07 10:14:09 rich Exp $
16 let template = get_template "undelete_image_form.html"
18 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _) _ =
19 let id = int_of_string (q#param "id") in
21 let sth = dbh#prepare_cached "select name, name_deleted, width, height, alt
23 where hostid = ? and id = ?" in
24 sth#execute [`Int hostid; `Int id];
26 let name, width, height, alt =
27 match sth#fetch1 () with
28 [ `String name; `Null; `Int width; `Int height; `String alt]
29 | [ `Null; `String name; `Int width; `Int height; `String alt] ->
30 name, width, height, alt
31 | _ -> assert false in
33 template#set "id" (string_of_int id);
34 template#set "name" name;
35 template#set "width" (string_of_int width);
36 template#set "height" (string_of_int height);
37 template#set "alt" alt;