Probably about 1/2 way through now ...
[cocanwiki.git] / scripts / edit_user_form.ml
index ddd7ed1..76ff9bd 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_user_form.ml,v 1.8 2005/11/23 11:32:13 rich Exp $
+ * $Id: edit_user_form.ml,v 1.9 2006/03/27 18:09:46 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,10 +28,10 @@ open Cocanwiki
 open Cocanwiki_template
 open Cocanwiki_date
 
-let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+let run r (q : cgi) dbh hostid _ _ =
   let template = get_template dbh hostid "edit_user_form.html" in
 
-  let userid = int_of_string (q#param "userid") in
+  let userid = Int32.of_string (q#param "userid") in
 
   let sth =
     dbh#prepare_cached
@@ -42,26 +42,26 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
               (select count(*) from pages
                 where logged_user = u.id and url_deleted is null)::int4
          from users u where u.hostid = ? and u.id = ?" in
-  sth#execute [`Int hostid; `Int userid];
+  sth#execute [Some hostid; Some userid];
 
   let name, email, registration_date, can_edit, can_manage_users,
       can_manage_contacts, can_manage_site, can_edit_global_css,
       can_import_mail, nr_edits, nr_edits_live =
     match sth#fetch1 () with
-       [`String name; (`Null | `String _) as email;
+       [Some name; (None | Some _) as email;
         `Date registration_date;
         `Bool can_edit; `Bool can_manage_users; `Bool can_manage_contacts;
         `Bool can_manage_site; `Bool can_edit_global_css;
         `Bool can_import_mail;
-        `Int nr_edits; `Int nr_edits_live] ->
+        Some nr_edits; Some nr_edits_live] ->
          name, email, registration_date, can_edit, can_manage_users,
          can_manage_contacts, can_manage_site, can_edit_global_css,
          can_import_mail, nr_edits, nr_edits_live
       | _ -> assert false in
 
-  template#set "userid" (string_of_int userid);
+  template#set "userid" (Int32.to_string userid);
   template#set "name" name;
-  template#set "email" (match email with `Null -> "" | `String s -> s);
+  template#set "email" (match email with None -> "" | Some s -> s);
   template#set "registration_date" (printable_date' registration_date);
   template#conditional "can_edit" can_edit;
   template#conditional "can_manage_users" can_manage_users;
@@ -69,8 +69,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   template#conditional "can_manage_site" can_manage_site;
   template#conditional "can_edit_global_css" can_edit_global_css;
   template#conditional "can_import_mail" can_import_mail;
-  template#set "nr_edits" (string_of_int nr_edits);
-  template#set "nr_edits_live" (string_of_int nr_edits_live);
+  template#set "nr_edits" (Int32.to_string nr_edits);
+  template#set "nr_edits_live" (Int32.to_string nr_edits_live);
 
   q#template template