2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: edit_host_css.ml,v 1.3 2004/09/07 14:58:34 rich Exp $
14 open Cocanwiki_strings
16 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ =
17 let hostid = int_of_string (q#param "hostid") in
19 let css = q#param "css" in
21 let css = if string_is_whitespace css then `Null else `String css in
23 (* XXX We should version the global stylesheet. However this requires
24 * some fairly non-trivial coding.
26 let sth = dbh#prepare_cached "update hosts set css = ? where id = ?" in
27 sth#execute [css; `Int hostid];
32 { StdPages.label = "OK";
33 StdPages.link = "/_bin/admin/host.cmo";
34 StdPages.method_ = None;
35 StdPages.params = [ "hostid", string_of_int hostid ] };
36 { StdPages.label = "Edit stylesheet again";
37 StdPages.link = "/_bin/admin/edit_host_css_form.cmo";
38 StdPages.method_ = None;
39 StdPages.params = [ "hostid", string_of_int hostid ] }
42 ok ~title:"Stylesheet changed" ~buttons
43 q ("The stylesheet was changed successfully. " ^
44 "Note: You must RELOAD the page to see changes to stylesheets.")