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