X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fwhat_links_here.ml;h=f05994cf4086c43254173e0df6de31c2456bc130;hb=019c80476c64b5cd86b6e9d115c86162b2ae462c;hp=ea9b5723917d917225c9e4c9b4bd79b9680be588;hpb=a24ca0230d6c23bdbcddc9690ea66b0682630e84;p=cocanwiki.git diff --git a/scripts/what_links_here.ml b/scripts/what_links_here.ml index ea9b572..f05994c 100644 --- a/scripts/what_links_here.ml +++ b/scripts/what_links_here.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: what_links_here.ml,v 1.1 2004/09/28 11:51:38 rich Exp $ + * $Id: what_links_here.ml,v 1.3 2004/10/04 15:19:56 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 @@ -54,8 +54,19 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = | _ -> assert false) in template#table "pages" table; + template#conditional "pages_empty" (table = []); + + (* Is the page in the site menu? If so, then every other page + * links here, so we should say so. + *) + let sth = dbh#prepare_cached "select 1 from sitemenu + where hostid = ? and url = ?" in + sth#execute [`Int hostid; `String page]; + + let in_sitemenu = try sth#fetch1int () = 1 with Not_found -> false in + template#conditional "in_sitemenu" in_sitemenu; q#template template let () = - register_script run + register_script ~restrict:[CanView] run