All new templates. Site menu displays basically everywhere.
[cocanwiki.git] / scripts / page.ml
index c34af77..0f85ca8 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI scripts.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: page.ml,v 1.6 2004/09/08 10:42:20 rich Exp $
+ * $Id: page.ml,v 1.10 2004/09/09 09:35:33 rich Exp $
  *)
 
 open Apache
@@ -16,9 +16,6 @@ open Cocanwiki_template
 open Cocanwiki_ok
 open Cocanwiki_date
 
-let template_page = get_template "page.html"
-let template_404  = get_template "page_404.html"
-
 (* Maximum level of redirection. *)
 let max_redirect = 4
 
@@ -26,7 +23,10 @@ type fp_status = FPOK of int * string * string * Dbi.datetime * bool
               | FPRedirect of string
               | FPNotFound
 
-let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, edit_anon) user =
+let run r (q : cgi) (dbh : Dbi.connection) hostid {edit_anon=edit_anon} user =
+  let template_page = get_template dbh hostid "page.html" in
+  let template_404  = get_template dbh hostid "page_404.html" in
+
   let page = q#param "page" in
   let page = if page = "" then "index" else page in
 
@@ -51,8 +51,6 @@ let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, edit_anon) user =
     t#set "description" description;
     t#set "pageid" (string_of_int pageid);
     t#set "last_modified_date" (printable_date last_modified_date);
-    t#set "cocanwiki_package" Cocanwiki_version.package;
-    t#set "cocanwiki_version" Cocanwiki_version.version;
 
     if page <> page' then (* redirection *) (
       t#set "page" page';
@@ -128,7 +126,12 @@ let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, edit_anon) user =
              ('a'..'z' | 'A'..'Z' | '0'..'9') as c -> c
            | _ -> ' ') page in
 
-    template_404#set "search_terms" search_terms;
+    t#set "search_terms" search_terms;
+
+    t#conditional "has_host_css" has_host_css;
+
+    t#conditional "can_edit" can_edit;
+    t#conditional "can_manage_users" can_manage_users;
 
     q#template t
   in