2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: undelete_image_form.ml,v 1.5 2004/09/08 15:46:53 rich Exp $
13 open Cocanwiki_template
15 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ =
16 let template = get_template dbh hostid "undelete_image_form.html" in
18 let id = int_of_string (q#param "id") in
20 let sth = dbh#prepare_cached "select name, name_deleted, width, height, alt
22 where hostid = ? and id = ?" in
23 sth#execute [`Int hostid; `Int id];
25 let name, width, height, alt =
26 match sth#fetch1 () with
27 [ `String name; `Null; `Int width; `Int height; `String alt]
28 | [ `Null; `String name; `Int width; `Int height; `String alt] ->
29 name, width, height, alt
30 | _ -> assert false in
32 template#set "id" (string_of_int id);
33 template#set "name" name;
34 template#set "width" (string_of_int width);
35 template#set "height" (string_of_int height);
36 template#set "alt" alt;
41 register_script ~restrict:[CanEdit] run