git.annexia.org
/
cocanwiki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a24ca02
)
Improved this script so it also notes if a page is used in the site menu.
author
rich
<rich>
Tue, 28 Sep 2004 11:56:52 +0000
(11:56 +0000)
committer
rich
<rich>
Tue, 28 Sep 2004 11:56:52 +0000
(11:56 +0000)
scripts/what_links_here.ml
patch
|
blob
|
history
templates/what_links_here.html
patch
|
blob
|
history
diff --git
a/scripts/what_links_here.ml
b/scripts/what_links_here.ml
index
ea9b572
..
0202ee9
100644
(file)
--- 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 <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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.
2 2004/09/28 11:56:52
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
*
* 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,6
+54,17
@@
let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
| _ -> assert false) in
template#table "pages" table;
| _ -> 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
q#template template
diff --git
a/templates/what_links_here.html
b/templates/what_links_here.html
index
16ed0bf
..
f3d22dd
100644
(file)
--- a/
templates/what_links_here.html
+++ b/
templates/what_links_here.html
@@
-10,15
+10,26
@@
<h1>What links to ::title_html::</h1>
<p>
<h1>What links to ::title_html::</h1>
<p>
-List of pages which link to
+List of pages which link
directly
to
<a href="/::page_html_tag::">::title_html::</a>:
</p>
<a href="/::page_html_tag::">::title_html::</a>:
</p>
+::if(pages_empty)::
+<p><em>(No pages directly link here.)</em></p>
+::else::
<ul>
::table(pages)::
<li> <a href="/::page_html_tag::">::title_html::</a> </li>
::end::
</ul>
<ul>
::table(pages)::
<li> <a href="/::page_html_tag::">::title_html::</a> </li>
::end::
</ul>
+::end::
+
+::if(in_sitemenu)::
+<p>
+In addition, this page is in the site-wide menu, which
+effectively means that every page links to it.
+</p>
+::end::
<ul id="topmenu" class="menu">
<li class="first"> <a href="/">Home page</a> </li>
<ul id="topmenu" class="menu">
<li class="first"> <a href="/">Home page</a> </li>