All new templates. Site menu displays basically everywhere.
[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.6 2004/09/09 09:35:33 rich Exp $
5  *)
6
7 open Apache
8 open Registry
9 open Cgi
10 open Printf
11
12 open Cocanwiki
13 open Cocanwiki_template
14
15 let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
16   let template = get_template dbh hostid "delete_file_form.html" in
17
18   let id = int_of_string (q#param "id") in
19
20   let sth = dbh#prepare_cached "select name from files
21                                  where hostid = ? and id = ?" in
22   sth#execute [`Int hostid; `Int id];
23
24   let name = sth#fetch1string () in
25
26   template#set "id" (string_of_int id);
27   template#set "name" name;
28
29   q#template template
30
31 let () =
32   register_script ~restrict:[CanEdit] run