Added styling to some pages which previously were "outside" the site
[cocanwiki.git] / scripts / lib / cocanwiki_template.ml
index 45f739d..1632e18 100644 (file)
@@ -1,7 +1,7 @@
 (* 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.7 2006/03/28 18:40:50 rich Exp $
+ * $Id: cocanwiki_template.ml,v 1.8 2006/08/03 13:53:00 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
@@ -84,13 +84,14 @@ let get_template ?page dbh hostid filename =
     (* Get standard fields concerning this host from the database. *)
     let rows =
       PGSQL(dbh) "nullable-results"
-       "select h.theme_css, p.name, p.url, h.search_box,
+       "select h.theme_css, h.css is not null,
+                p.name, p.url, h.search_box,
                 h.brand, h.brand_tagline, h.brand_description,
                 h.pagebug
            from hosts h left outer join powered_by p on h.powered_by = p.id
           where h.id = $hostid" in
 
-    let theme_css, powered_by_name, powered_by_url, search_box,
+    let theme_css, has_host_css, powered_by_name, powered_by_url, search_box,
       brand, brand_tagline, brand_description, pagebug =
       match rows with
       | [ row ] -> row
@@ -101,6 +102,11 @@ let get_template ?page dbh hostid filename =
       | None -> "/_css/standard.css"
       | Some file -> file in
 
+    let has_host_css =
+      match has_host_css with
+      | Some true -> true
+      | _ -> false in
+
     let powered_by_name, powered_by_url =
       match powered_by_name, powered_by_url with
       | None, None ->
@@ -137,6 +143,7 @@ let get_template ?page dbh hostid filename =
     let search_box = match search_box with Some b -> b | _ -> assert false in
 
     template#set "theme_css" theme_css;
+    template#conditional "has_host_css" has_host_css;
     template#set "powered_by_name" powered_by_name;
     template#set "powered_by_url" powered_by_url;
     template#conditional "search_box" search_box;
@@ -179,6 +186,7 @@ let get_template ?page dbh hostid filename =
   )
   else (* if we have no hostid *) (
     template#set "theme_css" "/_css/standard.css";
+    template#conditional "has_host_css" false;
     template#set "powered_by_name" (Cocanwiki_version.package ^ " " ^
                                    Cocanwiki_version.version);
     template#set "powered_by_url" "http://sandbox.merjis.com/";