Couple of critical bug fixes. Bumped version for release.
authorrich <rich>
Sun, 10 Oct 2004 16:29:23 +0000 (16:29 +0000)
committerrich <rich>
Sun, 10 Oct 2004 16:29:23 +0000 (16:29 +0000)
debian/changelog
scripts/page.ml
templates/page.html

index 1769f76..9f83c52 100644 (file)
@@ -1,4 +1,4 @@
-cocanwiki (1.2.1-4) unstable; urgency=low
+cocanwiki (1.2.1-5) unstable; urgency=low
 
   * Initial Release.
 
index 9a4e8da..e301cae 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: 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
@@ -279,18 +279,20 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid
           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 (
@@ -331,9 +333,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid
                              "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
index 9ab6f77..1fcea3f 100644 (file)
 ::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::