2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: users.ml,v 1.1 2004/09/08 10:42:20 rich Exp $
13 open Cocanwiki_template
16 let template = get_template "users.html"
18 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ =
21 "select id, name, email, registration_date, can_edit, can_manage_users
22 from users where hostid = ? order by name" in
23 sth#execute [`Int hostid];
28 [`Int userid; `String name; (`Null | `String _) as email;
29 `Date registration_date;
30 `Bool can_edit; `Bool can_manage_users] ->
31 let email = match email with `Null -> "" | `String s -> s in
32 [ "userid", Template.VarString (string_of_int userid);
33 "name", Template.VarString name;
34 "email", Template.VarString email;
36 Template.VarString (printable_date' registration_date);
37 "can_edit", Template.VarConditional can_edit;
38 "can_manage_users", Template.VarConditional can_manage_users ]
39 | _ -> assert false) in
41 template#table "users" table;
46 register_script ~restrict:[CanManageUsers] run