2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: create_form.ml,v 1.1 2004/09/07 10:14:09 rich Exp $
17 let template = get_template "create_form.html"
19 let run r (q : cgi) (dbh : Dbi.connection) (hostid, hostname) _ =
20 (* Get the page title. *)
21 let title = q#param "title" in
24 match Wikilib.generate_url_of_title dbh hostid title with
25 Wikilib.GenURL_OK url -> url
26 | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL ->
27 error ~back_button:true ~title:"Bad page name"
28 q "The page name supplied is too short or invalid.";
30 | Wikilib.GenURL_Duplicate url ->
31 q#redirect ("http://" ^ hostname ^ "/" ^ url);
35 template#set "title" title;