Moved to merjis/tools/wiki.
[cocanwiki.git] / scripts / delete_file_form.ml
1 (* COCANWIKI scripts.
2  * Written by Richard W.M. Jones <rich@merjis.com>.
3  * Copyright (C) 2004 Merjis Ltd.
4  * $Id: delete_file_form.ml,v 1.1 2004/09/07 10:14:09 rich Exp $
5  *)
6
7 open Apache
8 open Registry
9 open Cgi
10 open Printf
11
12 open Cocanwiki
13
14 open Merjisforwiki
15
16 let template = get_template "delete_file_form.html"
17
18 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _) _ =
19   let id = int_of_string (q#param "id") in
20
21   let sth = dbh#prepare_cached "select name from files
22                                  where hostid = ? and id = ?" in
23   sth#execute [`Int hostid; `Int id];
24
25   let name = sth#fetch1string () in
26
27   template#set "id" (string_of_int id);
28   template#set "name" name;
29
30   q#template template
31
32 let () =
33   register_script run