(* 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.28 2004/10/10 16:14:43 rich Exp $
+ * $Id: page.ml,v 1.29 2004/10/10 16:29:23 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
t#set "username" username);
(* If logged in, we want to update the recently_visited table. *)
- (match user with
- | User (userid, _, _) ->
- let sth = dbh#prepare_cached "delete from recently_visited
- where hostid = ? and userid = ?
- and url = ?" in
- sth#execute [`Int hostid; `Int userid; `String page'];
- let sth = dbh#prepare_cached
- "insert into recently_visited (hostid, userid, url)
- values (?, ?, ?)" in
- sth#execute [`Int hostid; `Int userid; `String page'];
- dbh#commit ()
- | _ -> ());
+ if pageid <> None then (
+ match user with
+ | User (userid, _, _) ->
+ let sth = dbh#prepare_cached "delete from recently_visited
+ where hostid = ? and userid = ?
+ and url = ?" in
+ sth#execute [`Int hostid; `Int userid; `String page'];
+ let sth = dbh#prepare_cached
+ "insert into recently_visited (hostid, userid, url)
+ values (?, ?, ?)" in
+ sth#execute [`Int hostid; `Int userid; `String page'];
+ dbh#commit ()
+ | _ -> ()
+ );
(* Navigation links. *)
if navigation then (
"title", Template.VarString title ] in
let table = List.map f wlh in
t#table "what_links_here" table;
+ t#conditional "has_what_links_here" (wlh <> []);
let table = List.map f rv in
t#table "recently_visited" table;
+ t#conditional "has_recently_visited" (rv <> []);
);
(* If we are coming from a search engine then we want to highlight
::if(navigation)::
<div id="navigation_div">
<h2>Navigation</h2>
+::if(has_what_links_here)::
<h3><a href="/_bin/what_links_here.cmo?page=::page_url::">What links here</a></h3>
<ul>
::table(what_links_here)::<li><a href="/::page::">::title_html::</a></li>::end::
</ul>
+::end::
::if(user_logged_in)::
+::if(has_recently_visited)::
<h3><a href="/_bin/recently_visited.cmo">Recently visited</a></h3>
<ul>
::table(recently_visited)::<li><a href="/::page::">::title_html::</a></li>::end::
</ul>
::end::
+::end::
</div>
::end::