X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fcreate_contact.ml;h=17e70f8c53b499c7bd13f97c3fae504a499ad546;hb=e828b148d6338765d7f5ca8f10567d5d9ef00548;hp=61eebebc7c6579f54443c6a47b77bf40605e0347;hpb=295f2cde3f43ccf7f775d39b95925e10aa4c37cb;p=cocanwiki.git diff --git a/scripts/create_contact.ml b/scripts/create_contact.ml index 61eebeb..17e70f8 100644 --- a/scripts/create_contact.ml +++ b/scripts/create_contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create_contact.ml,v 1.3 2005/03/31 14:24:04 rich Exp $ + * $Id: create_contact.ml,v 1.5 2005/11/24 14:54:11 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 @@ -41,20 +41,22 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if name = "" then ( error ~back_button:true ~title:"Name field missing" - q "You must name your contact form."; + dbh hostid q "You must name your contact form."; return () ); if subject = "" then ( error ~back_button:true ~title:"Subject line missing" - q "You must give a subject line, which appears on contact emails."; + dbh hostid q + "You must give a subject line, which appears on contact emails."; return () ); if emails = [] then ( error ~back_button:true ~title:"No email addresses" - q ("There are no email addresses listed for this contact form. You " ^ - "must list at least one valid email address."); + dbh hostid q + ("There are no email addresses listed for this contact form. You " ^ + "must list at least one valid email address."); return () ); @@ -63,7 +65,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = values (?, ?, ?)" in sth#execute [`Int hostid; `String name; `String subject]; - let contactid = sth#serial "contacts_id_seq" in + let contactid = Int64.to_int (sth#serial "contacts_id_seq") in let sth = dbh#prepare_cached "insert into contact_emails (contactid, email) values (?, ?)" in @@ -80,7 +82,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = Template.StdPages.method_ = None; Template.StdPages.params = [ "id", string_of_int contactid ] } ] in - ok ~title:"Contact form created" ~buttons q msg + ok ~title:"Contact form created" ~buttons dbh hostid q msg let () = register_script ~restrict:[CanManageContacts] run