(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_template.ml,v 1.1 2004/10/21 11:42:05 rich Exp $
+ * $Id: cocanwiki_template.ml,v 1.2 2004/10/23 10:13:20 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
let template = _get_template filename in
(* Get standard fields concerning this host from the database. *)
- let sth = dbh#prepare_cached "select theme_css from hosts
- where id = ?" in
+ let sth =
+ dbh#prepare_cached
+ "select h.theme_css, p.name, p.url
+ from hosts h left outer join powered_by p on h.powered_by = p.id
+ where h.id = ?" in
sth#execute [`Int hostid];
- let theme_css =
+ let theme_css, powered_by_name, powered_by_url =
match sth#fetch1 () with
- [ `Null ] -> "/_css/standard.css"
- | [ `String file ] -> file
+ | [ a; b; c] -> a, b, c
+ | _ -> assert false in
+ let theme_css =
+ match theme_css with
+ | `Null -> "/_css/standard.css"
+ | `String file -> file
+ | _ -> assert false in
+ let powered_by_name, powered_by_url =
+ match powered_by_name, powered_by_url with
+ | `Null, `Null ->
+ let url = "http://sandbox.merjis.com/" in
+ let name = Cocanwiki_version.package ^ " " ^
+ Cocanwiki_version.version in
+ name, url
+ | `String name, `String url -> name, url
| _ -> assert false in
template#set "theme_css" theme_css;
+ template#set "powered_by_name" powered_by_name;
+ template#set "powered_by_url" powered_by_url;
(* Site menu. *)
let sth = dbh#prepare_cached "select url, label, ordering from sitemenu