(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: page.ml,v 1.44 2006/03/28 13:20:00 rich Exp $
+ * $Id: page.ml,v 1.47 2006/07/26 13:19:49 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_server_settings
open Cocanwiki_links
-type fp_status = FPOK of int * string * string * Dbi.datetime * bool
+type fp_status = FPOK of int32 * string * string * Calendar.t * bool
| FPInternalRedirect of string
| FPExternalRedirect of string
| FPNotFound
* and background images while we compose the page.
*)
q#header ();
- print_string r th#to_string;
- Request.rflush r;
+ ignore (print_string r th#to_string);
+ ignore (Request.rflush r);
t#conditional "has_feedback_email" has_feedback_email;
t#conditional "mailing_list" mailing_list;
None -> []
| Some pageid ->
let rows = PGSQL(dbh)
- "select ordering, sectionname, content, divname
+ "select ordering, sectionname, content, divname, jsgo
from contents where pageid = $pageid order by ordering" in
List.map
- (fun (ordering, sectionname, content, divname) ->
+ (fun (ordering, sectionname, content, divname, jsgo) ->
let divname, has_divname =
match divname with
| None -> "", false
| Some divname -> divname, true in
+ let jsgo, has_jsgo =
+ match jsgo with
+ | None -> "", false
+ | Some jsgo -> jsgo, true in
let sectionname, has_sectionname =
match sectionname with
| None -> "", false
Template.VarString
(Wikilib.xhtml_of_content dbh hostid content);
"has_divname", Template.VarConditional has_divname;
- "divname", Template.VarString divname ]) rows in
+ "divname", Template.VarString divname;
+ "has_jsgo", Template.VarConditional has_jsgo;
+ "jsgo", Template.VarString jsgo ]) rows in
(* Call an extension to generate the first section in this page? *)
let sections =
"content", Template.VarString content;
"has_divname", Template.VarConditional true;
"divname", Template.VarString "form_div";
+ "has_jsgo", Template.VarConditional false;
+ "jsgo", Template.VarString "";
] in
section :: sections in
t#conditional "user_logged_in" true;
t#set "username" username);
+ (* Can anonymous users create accounts? If not them we don't
+ * want to offer to create accounts for them.
+ *)
+ t#conditional "create_account_anon" host.create_account_anon;
+
(* If logged in, we want to update the recently_visited table. *)
if pageid <> None then (
match user with
from pages
where hostid = $hostid and lower (url) = lower ($page)" in
match rows with
- | [page', _, _, _, _, _, _]
+ | [Some page', _, _, _, _, _, _]
when page <> page' -> (* different case *)
FPExternalRedirect page'
| [ _, None, id, title, description,
| FPInternalRedirect page' ->
loop page' (i+1)
| FPExternalRedirect page' ->
- (* This normally happens when a user has request an uppercase
+ (* This normally happens when a user has requested an uppercase
* page name. We redirect to the true (lowercase) version.
*)
- q#redirect ("http://" ^ host.hostname ^ "/" ^ page');
- return ()
+ q#redirect ("http://" ^ host.hostname ^ "/" ^ page')
| FPNotFound ->
(* Might be a templated page with no content in it. *)
let extension = get_extension page' in