(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_settings_form.ml,v 1.2 2004/09/24 16:30:07 rich Exp $
+ * $Id: edit_host_settings_form.ml,v 1.10 2006/12/06 09:46:57 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
open Cocanwiki
open Cocanwiki_template
-let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
- let template = get_template dbh hostid "edit_host_settings_form.html" in
+let run r (q : cgi) dbh hostid _ _ =
+ let template = get_template r dbh hostid "edit_host_settings_form.html" in
(* List of themes. *)
- let sth = dbh#prepare_cached "select theme_css, name, description
- from themes order by 2, 1" in
- sth#execute [];
+ let rows =
+ PGSQL(dbh) "select theme_css, name, description
+ from themes order by 2, 1" in
let themes =
- sth#map (function [`String theme_css; `String name; `String description] ->
- theme_css, (name, description)
- | _ -> assert false) in
+ List.map (fun (theme_css, name, description) ->
+ theme_css, (name, description)) rows in
(* Get lots of host-specific stuff from the database. *)
- let sth =
- dbh#prepare_cached
+ let rows =
+ PGSQL(dbh)
"select canonical_hostname, edit_anon, create_account_anon, theme_css,
- feedback_email, mailing_list
- from hosts where id = ?" in
- sth#execute [`Int hostid];
+ feedback_email, mailing_list, search_box, navigation, view_anon,
+ brand, brand_tagline, brand_description, ie_imagetoolbar_no,
+ global_noodp
+ from hosts where id = $hostid" in
let canonical_hostname, edit_anon, create_account_anon, theme_css,
- feedback_email, mailing_list =
- match sth#fetch1 () with
- [ `String canonical_hostname;
- `Bool edit_anon; `Bool create_account_anon;
- (`String _ | `Null) as theme_css;
- (`String _ | `Null) as feedback_email;
- `Bool mailing_list ] ->
- let theme_css =
- match theme_css with `String s -> s | `Null -> "" in
- let feedback_email =
- match feedback_email with `String s -> s | `Null -> "" in
- canonical_hostname, edit_anon, create_account_anon, theme_css,
- feedback_email, mailing_list
- | _ -> assert false in
+ feedback_email, mailing_list, search_box, navigation, view_anon,
+ brand, brand_tagline, brand_description, ie_imagetoolbar_no,
+ global_noodp =
+ match rows with
+ | [canonical_hostname, edit_anon, create_account_anon, theme_css,
+ feedback_email, mailing_list, search_box, navigation, view_anon,
+ brand, brand_tagline, brand_description, ie_imagetoolbar_no,
+ global_noodp ] ->
+ let theme_css =
+ match theme_css with Some s -> s | None -> "" in
+ let feedback_email =
+ match feedback_email with Some s -> s | None -> "" in
+ let brand =
+ match brand with Some s -> s | None -> "" in
+ let brand_tagline =
+ match brand_tagline with Some s -> s | None -> "" in
+ let brand_description =
+ match brand_description with Some s -> s | None -> "" in
+ canonical_hostname, edit_anon, create_account_anon, theme_css,
+ feedback_email, mailing_list, search_box, navigation, view_anon,
+ brand, brand_tagline, brand_description, ie_imagetoolbar_no,
+ global_noodp
+ | _ -> assert false in
template#set "canonical_hostname" canonical_hostname;
template#conditional "edit_anon" edit_anon;
template#conditional "create_account_anon" create_account_anon;
template#set "feedback_email" feedback_email;
template#conditional "mailing_list" mailing_list;
+ template#conditional "search_box" search_box;
+ template#conditional "ie_imagetoolbar_no" ie_imagetoolbar_no;
+ template#conditional "global_noodp" global_noodp;
+ template#conditional "navigation" navigation;
+ template#conditional "view_anon" view_anon;
+ template#set "brand" brand;
+ template#set "brand_tagline" brand_tagline;
+ template#set "brand_description" brand_description;
(* Themes table. *)
let table =