Can be configured on a host basis through 'global settings'.
Added separate "recently visited" table and page to show this.
Updated deps.
Updated MANIFEST.
Bumped version number for release.
scripts/preview.ml
scripts/rebuild_links.ml
scripts/recent.ml
+scripts/recently_visited.ml
scripts/restore.ml
scripts/restore_form.ml
scripts/rss.ml
templates/rebuild_links_done.html
templates/rebuild_links_start.html
templates/recent.html
+templates/recently_visited.html
templates/restore_form.html
templates/rss.xml
templates/send_feedback.txt
--
--- TOC entry 42 (OID 536004)
+-- TOC entry 44 (OID 536004)
-- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 43 (OID 536021)
+-- TOC entry 45 (OID 536021)
-- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich
--
mailing_list boolean DEFAULT false NOT NULL,
is_template boolean DEFAULT false NOT NULL,
search_box boolean DEFAULT true NOT NULL,
- view_anon boolean DEFAULT true NOT NULL
+ view_anon boolean DEFAULT true NOT NULL,
+ navigation boolean DEFAULT false NOT NULL
);
--
--- TOC entry 44 (OID 536371)
+-- TOC entry 46 (OID 536371)
-- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 45 (OID 537151)
+-- TOC entry 47 (OID 537151)
-- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 46 (OID 537166)
+-- TOC entry 48 (OID 537166)
-- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 47 (OID 540816)
+-- TOC entry 49 (OID 540816)
-- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 48 (OID 542605)
+-- TOC entry 50 (OID 542605)
-- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 49 (OID 547939)
+-- TOC entry 51 (OID 547939)
-- Name: templates_id_seq; Type: ACL; Schema: public; Owner: rich
--
--
--- TOC entry 54 (OID 536388)
+-- TOC entry 42 (OID 551123)
+-- Name: recently_visited; Type: TABLE; Schema: public; Owner: rich
+--
+
+CREATE TABLE recently_visited (
+ userid integer NOT NULL,
+ hostid integer NOT NULL,
+ url text NOT NULL,
+ visit_time timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
+);
+
+
+--
+-- TOC entry 43 (OID 551123)
+-- Name: recently_visited; Type: ACL; Schema: public; Owner: rich
+--
+
+REVOKE ALL ON TABLE recently_visited FROM PUBLIC;
+GRANT ALL ON TABLE recently_visited TO "www-data";
+
+
+--
+-- TOC entry 56 (OID 536388)
-- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 55 (OID 536389)
+-- TOC entry 57 (OID 536389)
-- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 51 (OID 536419)
+-- TOC entry 53 (OID 536419)
-- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 56 (OID 536924)
+-- TOC entry 58 (OID 536924)
-- Name: email_notify_email_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 57 (OID 540251)
+-- TOC entry 59 (OID 540251)
-- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 59 (OID 540252)
+-- TOC entry 61 (OID 540252)
-- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 62 (OID 540831)
+-- TOC entry 64 (OID 540831)
-- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 61 (OID 540946)
+-- TOC entry 63 (OID 540946)
-- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 64 (OID 540970)
+-- TOC entry 66 (OID 540970)
-- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 65 (OID 540971)
+-- TOC entry 67 (OID 540971)
-- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 68 (OID 542626)
+-- TOC entry 70 (OID 542626)
-- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 69 (OID 543505)
+-- TOC entry 71 (OID 543505)
-- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 70 (OID 543763)
+-- TOC entry 72 (OID 543763)
-- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 71 (OID 543795)
+-- TOC entry 73 (OID 543795)
-- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 66 (OID 543880)
+-- TOC entry 68 (OID 543880)
-- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 72 (OID 544454)
+-- TOC entry 74 (OID 544454)
-- Name: links_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 73 (OID 547951)
+-- TOC entry 75 (OID 547951)
-- Name: templates_ext_ord_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 75 (OID 547952)
+-- TOC entry 77 (OID 547952)
-- Name: templates_title_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 76 (OID 547953)
+-- TOC entry 78 (OID 547953)
-- Name: templates_url_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 50 (OID 536012)
+-- TOC entry 79 (OID 551151)
+-- Name: recently_visited_uq; Type: INDEX; Schema: public; Owner: rich
+--
+
+CREATE UNIQUE INDEX recently_visited_uq ON recently_visited USING btree (userid, hostid, url);
+
+
+--
+-- TOC entry 52 (OID 536012)
-- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 52 (OID 536027)
+-- TOC entry 54 (OID 536027)
-- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 53 (OID 536377)
+-- TOC entry 55 (OID 536377)
-- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 58 (OID 537158)
+-- TOC entry 60 (OID 537158)
-- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 60 (OID 537173)
+-- TOC entry 62 (OID 537173)
-- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 63 (OID 540825)
+-- TOC entry 65 (OID 540825)
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 67 (OID 542611)
+-- TOC entry 69 (OID 542611)
-- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 74 (OID 547945)
+-- TOC entry 76 (OID 547945)
-- Name: templates_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 81 (OID 536029)
+-- TOC entry 84 (OID 536029)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 84 (OID 536384)
+-- TOC entry 87 (OID 536384)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 82 (OID 536394)
+-- TOC entry 85 (OID 536394)
-- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 77 (OID 536404)
+-- TOC entry 80 (OID 536404)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 85 (OID 536920)
+-- TOC entry 88 (OID 536920)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 86 (OID 537160)
+-- TOC entry 89 (OID 537160)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 87 (OID 537175)
+-- TOC entry 90 (OID 537175)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 78 (OID 539155)
+-- TOC entry 81 (OID 539155)
-- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 88 (OID 540827)
+-- TOC entry 91 (OID 540827)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 89 (OID 540837)
+-- TOC entry 92 (OID 540837)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 79 (OID 540942)
+-- TOC entry 82 (OID 540942)
-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 80 (OID 540947)
+-- TOC entry 83 (OID 540947)
-- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 90 (OID 540966)
+-- TOC entry 93 (OID 540966)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 91 (OID 540972)
+-- TOC entry 94 (OID 540972)
-- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 92 (OID 542613)
+-- TOC entry 95 (OID 542613)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 93 (OID 542622)
+-- TOC entry 96 (OID 542622)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 83 (OID 543506)
+-- TOC entry 86 (OID 543506)
-- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 94 (OID 543759)
+-- TOC entry 97 (OID 543759)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 95 (OID 543764)
+-- TOC entry 98 (OID 543764)
-- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 96 (OID 543791)
+-- TOC entry 99 (OID 543791)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 97 (OID 544450)
+-- TOC entry 100 (OID 544450)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 98 (OID 544455)
+-- TOC entry 101 (OID 544455)
-- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
+-- TOC entry 102 (OID 551129)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY recently_visited
+ ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id);
+
+
+--
+-- TOC entry 103 (OID 551133)
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY recently_visited
+ ADD CONSTRAINT "$2" FOREIGN KEY (hostid) REFERENCES hosts(id);
+
+
+--
+-- TOC entry 104 (OID 551137)
+-- Name: recently_visited_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY recently_visited
+ ADD CONSTRAINT recently_visited_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
+
+
+--
+-- TOC entry 105 (OID 551141)
+-- Name: recently_visited_userid_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY recently_visited
+ ADD CONSTRAINT recently_visited_userid_cn FOREIGN KEY (hostid, userid) REFERENCES users(hostid, id);
+
+
+--
-- TOC entry 3 (OID 2200)
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
-cocanwiki (1.2.1-3) unstable; urgency=low
+cocanwiki (1.2.1-4) unstable; urgency=low
* Initial Release.
/* Stylesheet for COCANWIKI.
- * $Id: standard.css,v 1.12 2004/10/09 15:46:29 rich Exp $
+ * $Id: standard.css,v 1.13 2004/10/10 16:14:43 rich Exp $
*/
body {
display: none;
}
+/* Navigation area.
+ * The navigation_space_div reserves the space for the div and appears
+ * at the beginning of the page (but is empty).
+ */
+div#navigation_space_div {
+ float: right;
+ width: 10em;
+ height: 20em;
+ border: 1px solid #ccc;
+ background: #fff;
+ margin-left: 1em;
+}
+
+div#navigation_div {
+ position: absolute;
+ right: 1em;
+ top: 6em;
+ width: 10em;
+ height: 20em;
+}
+
+div#navigation_div h2 {
+ font-size: 70%;
+ position: relative;
+ top: -1.5em;
+ left: 1.5em;
+ border: 1px solid #ccc;
+ padding-top: 2px;
+ background: #fff;
+ display: inline;
+}
+
+div#navigation_div h3 {
+ margin-left: 1em;
+ margin-top: -0.5em;
+ font-size: 70%;
+}
+
+div#navigation_div ul {
+ font-size: 70%;
+ margin-top: -1em;
+ margin-left: -1em;
+}
+
/* Calendar extension. */
table.cal_month {
border-collapse: collapse;
/* Hide the navigation. */
div#search_div { display: none; }
+ div#navigation_div { display: none; }
ul#topmenu { display: none; }
div#menu_div { display: none; }
p.edit_link { display: none; }
00-TEMPLATE.cmo: cocanwiki.cmo cocanwiki_template.cmi
00-TEMPLATE.cmx: cocanwiki.cmx cocanwiki_template.cmx
+broken_links.cmo: cocanwiki.cmo cocanwiki_template.cmi
+broken_links.cmx: cocanwiki.cmx cocanwiki_template.cmx
change_password.cmo: cocanwiki.cmo cocanwiki_ok.cmo
change_password.cmx: cocanwiki.cmx cocanwiki_ok.cmx
change_password_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
cocanwiki_images.cmi
cocanwiki_images.cmx: cocanwiki_files.cmx cocanwiki_strings.cmx \
cocanwiki_images.cmi
-cocanwiki_links.cmo: wikilib.cmi cocanwiki_links.cmi
-cocanwiki_links.cmx: wikilib.cmx cocanwiki_links.cmi
+cocanwiki_links.cmo: cocanwiki.cmo wikilib.cmi cocanwiki_links.cmi
+cocanwiki_links.cmx: cocanwiki.cmx wikilib.cmx cocanwiki_links.cmi
cocanwiki_ok.cmo: cocanwiki_template.cmi
cocanwiki_ok.cmx: cocanwiki_template.cmx
cocanwiki_template.cmo: cocanwiki_files.cmo cocanwiki_version.cmo \
cocanwiki_template.cmi
mailing_list_view.cmx: cocanwiki.cmx cocanwiki_date.cmx \
cocanwiki_template.cmx
-page.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_ok.cmo \
- cocanwiki_server_settings.cmo cocanwiki_template.cmi wikilib.cmi
-page.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_ok.cmx \
- cocanwiki_server_settings.cmx cocanwiki_template.cmx wikilib.cmx
+page.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_links.cmi \
+ cocanwiki_ok.cmo cocanwiki_server_settings.cmo cocanwiki_template.cmi \
+ wikilib.cmi
+page.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_links.cmx \
+ cocanwiki_ok.cmx cocanwiki_server_settings.cmx cocanwiki_template.cmx \
+ wikilib.cmx
page_email_confirm.cmo: cocanwiki.cmo cocanwiki_ok.cmo
page_email_confirm.cmx: cocanwiki.cmx cocanwiki_ok.cmx
page_email_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
rebuild_links.cmx: cocanwiki.cmx cocanwiki_links.cmx cocanwiki_template.cmx
recent.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_template.cmi
recent.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_template.cmx
+recently_visited.cmo: cocanwiki.cmo cocanwiki_template.cmi
+recently_visited.cmx: cocanwiki.cmx cocanwiki_template.cmx
restore.cmo: cocanwiki.cmo cocanwiki_diff.cmo cocanwiki_emailnotify.cmo \
cocanwiki_links.cmi cocanwiki_ok.cmo
restore.cmx: cocanwiki.cmx cocanwiki_diff.cmx cocanwiki_emailnotify.cmx \
users.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_template.cmx
visualise_links.cmo: cocanwiki.cmo cocanwiki_files.cmo cocanwiki_template.cmi
visualise_links.cmx: cocanwiki.cmx cocanwiki_files.cmx cocanwiki_template.cmx
-what_links_here.cmo: cocanwiki.cmo cocanwiki_template.cmi
-what_links_here.cmx: cocanwiki.cmx cocanwiki_template.cmx
+what_links_here.cmo: cocanwiki.cmo cocanwiki_links.cmi cocanwiki_template.cmi
+what_links_here.cmx: cocanwiki.cmx cocanwiki_links.cmx cocanwiki_template.cmx
wikilib.cmo: cocanwiki_strings.cmo wikilib.cmi
wikilib.cmx: cocanwiki_strings.cmx wikilib.cmi
admin/admin.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_template.cmi
# Makefile for COCANWIKI.
-# $Id: Makefile,v 1.36 2004/10/09 16:25:08 rich Exp $
+# $Id: Makefile,v 1.37 2004/10/10 16:14:43 rich Exp $
include ../Makefile.config
preview.cmo \
rebuild_links.cmo \
recent.cmo \
+ recently_visited.cmo \
restore.cmo \
restore_form.cmo \
rss.cmo \
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_links.ml,v 1.4 2004/10/10 14:44:50 rich Exp $
+ * $Id: cocanwiki_links.ml,v 1.5 2004/10/10 16:14:43 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
let qs = Dbi.placeholders (List.length urls) in
let sth =
dbh#prepare_cached
- ("select li.from_url, p.title
+ ("select li.from_url, p.title, li.from_url = 'index'
from links li, pages p
where li.hostid = ? and li.to_url in " ^ qs ^ "
- and li.hostid = p.hostid and li.from_url = p.url") in
+ and li.hostid = p.hostid and li.from_url = p.url
+ order by 3 desc, 2, 1") in
sth#execute (`Int hostid :: (List.map (fun s -> `String s) urls));
sth#map (function
- | [`String url; `String title] -> url, title
+ | [`String url; `String title; _] -> url, title
| _ -> assert false)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit.ml,v 1.18 2004/10/10 15:33:36 rich Exp $
+ * $Id: edit.ml,v 1.19 2004/10/10 16:14:43 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
let sth =
dbh#prepare_cached
"set constraints pages_redirect_cn, sitemenu_url_cn,
- page_emails_url_cn, links_from_cn deferred" in
+ page_emails_url_cn, links_from_cn, recently_visited_url_cn
+ deferred" in
sth#execute [];
(* Mark the old page as deleted. NB. There is a small race
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_settings.ml,v 1.5 2004/10/04 15:19:56 rich Exp $
+ * $Id: edit_host_settings.ml,v 1.6 2004/10/10 16:14:43 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
let feedback_email = q#param "feedback_email" in
let mailing_list = q#param_true "mailing_list" in
let search_box = q#param_true "search_box" in
+ let navigation = q#param_true "navigation" in
let view_anon = q#param_true "view_anon" in
let theme_css = if theme_css = "" then `Null else `String theme_css in
let sth = dbh#prepare_cached "update hosts set edit_anon = ?,
create_account_anon = ?, theme_css = ?,
feedback_email = ?, mailing_list = ?,
- search_box = ?, view_anon = ?
+ search_box = ?, navigation = ?, view_anon = ?
where id = ?" in
sth#execute [`Bool edit_anon; `Bool create_account_anon;
theme_css; feedback_email; `Bool mailing_list; `Bool search_box;
- `Bool view_anon;
+ `Bool navigation; `Bool view_anon;
`Int hostid];
dbh#commit ();
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_settings_form.ml,v 1.4 2004/10/04 15:19:56 rich Exp $
+ * $Id: edit_host_settings_form.ml,v 1.5 2004/10/10 16:14:43 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
let sth =
dbh#prepare_cached
"select canonical_hostname, edit_anon, create_account_anon, theme_css,
- feedback_email, mailing_list, search_box, view_anon
+ feedback_email, mailing_list, search_box, navigation, view_anon
from hosts where id = ?" in
sth#execute [`Int hostid];
let canonical_hostname, edit_anon, create_account_anon, theme_css,
- feedback_email, mailing_list, search_box, view_anon =
+ feedback_email, mailing_list, search_box, navigation, view_anon =
match sth#fetch1 () with
[ `String canonical_hostname;
`Bool edit_anon; `Bool create_account_anon;
(`String _ | `Null) as theme_css;
(`String _ | `Null) as feedback_email;
- `Bool mailing_list; `Bool search_box; `Bool view_anon ] ->
+ `Bool mailing_list; `Bool search_box; `Bool navigation;
+ `Bool view_anon ] ->
let theme_css =
match theme_css with `String s -> s | `Null -> "" in
let feedback_email =
match feedback_email with `String s -> s | `Null -> "" in
canonical_hostname, edit_anon, create_account_anon, theme_css,
- feedback_email, mailing_list, search_box, view_anon
+ feedback_email, mailing_list, search_box, navigation, view_anon
| _ -> assert false in
template#set "canonical_hostname" canonical_hostname;
template#set "feedback_email" feedback_email;
template#conditional "mailing_list" mailing_list;
template#conditional "search_box" search_box;
+ template#conditional "navigation" navigation;
template#conditional "view_anon" view_anon;
(* Themes table. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_page_css.ml,v 1.11 2004/10/07 11:36:46 rich Exp $
+ * $Id: edit_page_css.ml,v 1.12 2004/10/10 16:14:43 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
let sth = dbh#prepare_cached
"set constraints pages_redirect_cn, sitemenu_url_cn,
- page_emails_url_cn, links_from_cn deferred" in
+ page_emails_url_cn, links_from_cn, recently_visited_url_cn
+ deferred" in
sth#execute [];
let sth = dbh#prepare_cached "update pages set url_deleted = url,
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_page_title.ml,v 1.3 2004/10/07 11:36:46 rich Exp $
+ * $Id: edit_page_title.ml,v 1.4 2004/10/10 16:14:43 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
let sth = dbh#prepare_cached
"set constraints pages_redirect_cn, sitemenu_url_cn,
- page_emails_url_cn, links_from_cn deferred" in
+ page_emails_url_cn, links_from_cn, recently_visited_url_cn
+ deferred" in
sth#execute [];
let sth = dbh#prepare_cached "update pages set url_deleted = url,
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: host_menu.ml,v 1.4 2004/10/04 15:19:56 rich Exp $
+ * $Id: host_menu.ml,v 1.5 2004/10/10 16:14:43 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
"select h.canonical_hostname, h.css is not null, h.edit_anon,
h.create_account_anon, h.theme_css is not null,
t.name, t.description, h.feedback_email, h.mailing_list,
- h.search_box, h.view_anon
+ h.search_box, h.navigation, h.view_anon
from hosts h left outer join themes t on h.theme_css = t.theme_css
where h.id = ?" in
sth#execute [`Int hostid];
let canonical_hostname, has_global_css, edit_anon, create_account_anon,
has_theme_css, theme_name, theme_description, has_feedback_email,
- feedback_email, mailing_list, search_box, view_anon =
+ feedback_email, mailing_list, search_box, navigation, view_anon =
match sth#fetch1 () with
[ `String canonical_hostname; `Bool has_global_css;
`Bool edit_anon; `Bool create_account_anon; `Bool has_theme_css;
(`String _ | `Null) as theme_name;
(`String _ | `Null) as theme_description;
(`String _ | `Null) as feedback_email;
- `Bool mailing_list; `Bool search_box; `Bool view_anon ] ->
+ `Bool mailing_list; `Bool search_box; `Bool navigation;
+ `Bool view_anon ] ->
let theme_name =
match theme_name with `String s -> s | `Null -> "" in
let theme_description =
| `Null -> "", false in
canonical_hostname, has_global_css, edit_anon, create_account_anon,
has_theme_css, theme_name, theme_description, has_feedback_email,
- feedback_email, mailing_list, search_box, view_anon
+ feedback_email, mailing_list, search_box, navigation, view_anon
| _ -> assert false in
template#set "canonical_hostname" canonical_hostname;
template#set "feedback_email" feedback_email;
template#conditional "mailing_list" mailing_list;
template#conditional "search_box" search_box;
+ template#conditional "navigation" navigation;
template#conditional "view_anon" view_anon;
q#template template
(* 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.27 2004/10/10 14:44:50 rich Exp $
+ * $Id: page.ml,v 1.28 2004/10/10 16:14:43 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_ok
open Cocanwiki_date
open Cocanwiki_server_settings
+open Cocanwiki_links
type fp_status = FPOK of int * string * string * Dbi.datetime * bool
| FPRedirect of string
(* Host-specific fields. *)
let sth = dbh#prepare_cached "select css is not null,
feedback_email is not null,
- mailing_list, search_box
+ mailing_list, search_box, navigation
from hosts where id = ?" in
sth#execute [`Int hostid];
- let has_host_css, has_feedback_email, mailing_list, search_box =
+ let has_host_css, has_feedback_email, mailing_list, search_box, navigation =
match sth#fetch1 () with
| [ `Bool has_host_css; `Bool has_feedback_email; `Bool mailing_list;
- `Bool search_box ] ->
- has_host_css, has_feedback_email, mailing_list, search_box
+ `Bool search_box; `Bool navigation ] ->
+ has_host_css, has_feedback_email, mailing_list, search_box,
+ navigation
| _ -> assert false in
(* Can the user edit? Manage users? etc. *)
t#conditional "has_feedback_email" has_feedback_email;
t#conditional "mailing_list" mailing_list;
t#conditional "search_box" search_box;
+ t#conditional "navigation" navigation;
t#conditional "can_edit" can_edit;
t#conditional "can_manage_users" can_manage_users;
t#conditional "user_logged_in" true;
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 ()
+ | _ -> ());
+
+ (* Navigation links. *)
+ if navigation then (
+ let max_links = 15 in (* Show no more links than this. *)
+
+ (* What links here. *)
+ let wlh = what_links_here dbh hostid page' in
+ let wlh_urls = List.map fst wlh in (* Just the URLs ... *)
+
+ let rv =
+ match user with
+ | User (userid, _, _) ->
+ (* Recently visited URLs, but don't repeat any from the 'what
+ * links here' section, and don't link to self.
+ *)
+ let not_urls = page' :: wlh_urls in
+ let qs = Dbi.placeholders (List.length not_urls) in
+ let sth =
+ dbh#prepare_cached
+ ("select rv.url, p.title, rv.visit_time
+ from recently_visited rv, pages p
+ where rv.hostid = ? and rv.userid = ?
+ and rv.url not in " ^ qs ^ "
+ and rv.hostid = p.hostid and rv.url = p.url
+ order by 3 desc
+ limit ?") in
+ let args = List.map (fun s -> `String s) not_urls in
+ sth#execute
+ ([`Int hostid; `Int userid] @ args @ [`Int max_links]);
+ sth#map
+ (function [`String url; `String title; _] ->
+ url, title
+ | _ -> assert false)
+ | _ -> [] in
+
+ (* Links to page. *)
+ let f (page, title) = [ "page", Template.VarString page;
+ "title", Template.VarString title ] in
+ let table = List.map f wlh in
+ t#table "what_links_here" table;
+
+ let table = List.map f rv in
+ t#table "recently_visited" table;
+ );
+
(* If we are coming from a search engine then we want to highlight
* search terms throughout the whole page ...
*)
--- /dev/null
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: recently_visited.ml,v 1.1 2004/10/10 16:14:43 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *)
+
+open Apache
+open Registry
+open Cgi
+open Printf
+
+open Cocanwiki
+open Cocanwiki_template
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid _ user =
+ let template = get_template dbh hostid "recently_visited.html" in
+
+ let userid =
+ match user with
+ User (userid, _, _) -> userid
+ | _ -> assert false in
+
+ let sth = dbh#prepare_cached "select rv.url, p.title, rv.visit_time
+ from recently_visited rv, pages p
+ where rv.hostid = ? and rv.userid = ?
+ and rv.hostid = p.hostid and rv.url = p.url
+ order by 3 desc" in
+ sth#execute [`Int hostid; `Int userid];
+
+ let table = sth#map (function [`String page; `String title; _] ->
+ [ "page", Template.VarString page;
+ "title", Template.VarString title ]
+ | _ -> assert false) in
+ template#table "recently_visited" table;
+
+ q#template template
+
+let () =
+ register_script ~anonymous:false run
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: restore.ml,v 1.12 2004/10/07 11:36:46 rich Exp $
+ * $Id: restore.ml,v 1.13 2004/10/10 16:14:43 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
let sth =
dbh#prepare_cached
"set constraints pages_redirect_cn, sitemenu_url_cn,
- page_emails_url_cn, links_from_cn deferred" in
+ page_emails_url_cn, links_from_cn, recently_visited_url_cn
+ deferred" in
sth#execute [];
let sth = dbh#prepare_cached "update pages set url_deleted = url,
</td>
</tr>
<tr>
+<th> Navigation box: </th>
+<td>
+<input type="checkbox" name="navigation" value="1" ::if(navigation)::checked="checked"::end:: id="navigation"/><label for="navigation">Navigation box on each page</label>
+</td>
+</tr>
+<tr>
<th> Theme: </th>
<td>
<select name="theme_css">
<td> ::if(search_box)::Yes::else::No::end:: </td>
</tr>
<tr>
+<th> Navigation box: </th>
+<td> ::if(navigation)::Yes::else::No::end:: </td>
+</tr>
+<tr>
<th> Theme: </th>
<td> ::if(has_theme_css)::<strong>::theme_name_html::</strong> <br/> ::theme_description_html:: ::else:: Standard wiki theme ::end:: </td>
</tr>
<h1>::title_html::</h1>
+::if(navigation)::<div id="navigation_space_div"></div>::end::
+
::if(redirected)::
<p id="redirected"><em>(Redirected from <a href="/::original_page_html_tag::?no_redirect=1">::original_page_html::</a>)</em></p>
::end::
</div>
::end::
+::if(navigation)::
+<div id="navigation_div">
+<h2>Navigation</h2>
+<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>
+::if(user_logged_in)::
+<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::
+</div>
+::end::
+
<div id="footer_div">
<hr/>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>Recently visited pages</title>
+<meta name="author" content="http://www.merjis.com/" />
+<link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
+</head><body>
+
+<h1>Recently visited pages</h1>
+
+<p>
+List of pages which you have recently visited:
+</p>
+
+<ul>
+::table(recently_visited)::
+<li> <a href="/::page::">::title_html::</a> </li>
+::end::
+</ul>
+
+<ul id="topmenu" class="menu">
+<li class="first"> <a href="/">Home page</a> </li>
+<li> <a href="/_sitemap">Sitemap</a> </li>
+<li> <a href="/_recent">Recent changes</a> </li>
+</ul>
+
+<div id="menu_div">
+<ul id="bottommenu" class="menu">
+<li class="first"> <a href="/">Home page</a> </li>
+::table(sitemenu)::<li> <a href="/::url_html_tag::">::label_html::</a> </li>
+::end::
+<li> <a href="/_sitemap">Sitemap</a> </li>
+</ul>
+</div>
+
+<div id="footer_div">
+<hr/>
+
+<ul id="footer" class="menu">
+<li class="first"> <a href="/copyright">Copyright © ::year::</a> </li>
+<li> Powered by <a href="http://sandbox.merjis.com/">::cocanwiki_package_html:: ::cocanwiki_version_html::</a> </li>
+</ul>
+</div>
+
+</body>
+</html>
\ No newline at end of file