From: rich Date: Sun, 10 Oct 2004 16:14:43 +0000 (+0000) Subject: Added the navigation box (see email). X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=5b036c1119e5871a8996c98639cd861ea7d93e75;p=cocanwiki.git Added the navigation box (see email). 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. --- diff --git a/MANIFEST b/MANIFEST index 00fe625..f27f15d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -133,6 +133,7 @@ scripts/pagestyle.ml scripts/preview.ml scripts/rebuild_links.ml scripts/recent.ml +scripts/recently_visited.ml scripts/restore.ml scripts/restore_form.ml scripts/rss.ml @@ -213,6 +214,7 @@ templates/rebuild_links.html 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 diff --git a/cocanwiki.sql b/cocanwiki.sql index 61f301d..6a96318 100644 --- a/cocanwiki.sql +++ b/cocanwiki.sql @@ -48,7 +48,7 @@ GRANT ALL ON TABLE pages TO "www-data"; -- --- TOC entry 42 (OID 536004) +-- TOC entry 44 (OID 536004) -- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -81,7 +81,7 @@ GRANT ALL ON TABLE contents TO "www-data"; -- --- TOC entry 43 (OID 536021) +-- TOC entry 45 (OID 536021) -- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -105,7 +105,8 @@ CREATE TABLE hosts ( 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 ); @@ -119,7 +120,7 @@ GRANT ALL ON TABLE hosts TO "www-data"; -- --- TOC entry 44 (OID 536371) +-- TOC entry 46 (OID 536371) -- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -204,7 +205,7 @@ GRANT ALL ON TABLE images TO "www-data"; -- --- TOC entry 45 (OID 537151) +-- TOC entry 47 (OID 537151) -- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -239,7 +240,7 @@ GRANT ALL ON TABLE files TO "www-data"; -- --- TOC entry 46 (OID 537166) +-- TOC entry 48 (OID 537166) -- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -278,7 +279,7 @@ GRANT ALL ON TABLE users TO "www-data"; -- --- TOC entry 47 (OID 540816) +-- TOC entry 49 (OID 540816) -- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -351,7 +352,7 @@ GRANT ALL ON TABLE contacts TO "www-data"; -- --- TOC entry 48 (OID 542605) +-- TOC entry 50 (OID 542605) -- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -516,7 +517,7 @@ GRANT SELECT ON TABLE templates TO "www-data"; -- --- TOC entry 49 (OID 547939) +-- TOC entry 51 (OID 547939) -- Name: templates_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -524,7 +525,29 @@ REVOKE ALL ON TABLE templates_id_seq FROM PUBLIC; -- --- 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 -- @@ -532,7 +555,7 @@ CREATE UNIQUE INDEX hostnames_hostid_name_uq ON hostnames USING btree (hostid, n -- --- TOC entry 55 (OID 536389) +-- TOC entry 57 (OID 536389) -- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -540,7 +563,7 @@ CREATE UNIQUE INDEX hostnams_name_uq ON hostnames USING btree (name); -- --- TOC entry 51 (OID 536419) +-- TOC entry 53 (OID 536419) -- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -548,7 +571,7 @@ CREATE UNIQUE INDEX pages_url_uq ON pages USING btree (hostid, url); -- --- TOC entry 56 (OID 536924) +-- TOC entry 58 (OID 536924) -- Name: email_notify_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -556,7 +579,7 @@ CREATE UNIQUE INDEX email_notify_email_uq ON email_notify USING btree (hostid, e -- --- TOC entry 57 (OID 540251) +-- TOC entry 59 (OID 540251) -- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -564,7 +587,7 @@ CREATE UNIQUE INDEX images_name_uq ON images USING btree (hostid, name); -- --- TOC entry 59 (OID 540252) +-- TOC entry 61 (OID 540252) -- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -572,7 +595,7 @@ CREATE UNIQUE INDEX files_name_uq ON files USING btree (hostid, name); -- --- TOC entry 62 (OID 540831) +-- TOC entry 64 (OID 540831) -- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -580,7 +603,7 @@ CREATE UNIQUE INDEX users_name_uq ON users USING btree (hostid, name); -- --- TOC entry 61 (OID 540946) +-- TOC entry 63 (OID 540946) -- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -588,7 +611,7 @@ CREATE UNIQUE INDEX users_id_uq ON users USING btree (hostid, id); -- --- TOC entry 64 (OID 540970) +-- TOC entry 66 (OID 540970) -- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -596,7 +619,7 @@ CREATE UNIQUE INDEX sitemenu_ordering_uq ON sitemenu USING btree (hostid, orderi -- --- TOC entry 65 (OID 540971) +-- TOC entry 67 (OID 540971) -- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -604,7 +627,7 @@ CREATE UNIQUE INDEX sitemenu_url_uq ON sitemenu USING btree (hostid, url); -- --- TOC entry 68 (OID 542626) +-- TOC entry 70 (OID 542626) -- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -612,7 +635,7 @@ CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, -- --- TOC entry 69 (OID 543505) +-- TOC entry 71 (OID 543505) -- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -620,7 +643,7 @@ CREATE UNIQUE INDEX themes_theme_css_uq ON themes USING btree (theme_css); -- --- TOC entry 70 (OID 543763) +-- TOC entry 72 (OID 543763) -- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -628,7 +651,7 @@ CREATE UNIQUE INDEX page_emails_email_uq ON page_emails USING btree (hostid, url -- --- TOC entry 71 (OID 543795) +-- TOC entry 73 (OID 543795) -- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -636,7 +659,7 @@ CREATE UNIQUE INDEX mailing_lists_email_uq ON mailing_lists USING btree (hostid, -- --- TOC entry 66 (OID 543880) +-- TOC entry 68 (OID 543880) -- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -644,7 +667,7 @@ CREATE UNIQUE INDEX contacts_name_uq ON contacts USING btree (hostid, name); -- --- TOC entry 72 (OID 544454) +-- TOC entry 74 (OID 544454) -- Name: links_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -652,7 +675,7 @@ CREATE UNIQUE INDEX links_uq ON links USING btree (hostid, from_url, to_url); -- --- TOC entry 73 (OID 547951) +-- TOC entry 75 (OID 547951) -- Name: templates_ext_ord_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -660,7 +683,7 @@ CREATE UNIQUE INDEX templates_ext_ord_uq ON templates USING btree (extension, or -- --- TOC entry 75 (OID 547952) +-- TOC entry 77 (OID 547952) -- Name: templates_title_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -668,7 +691,7 @@ CREATE UNIQUE INDEX templates_title_uq ON templates USING btree (title_regexp); -- --- TOC entry 76 (OID 547953) +-- TOC entry 78 (OID 547953) -- Name: templates_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -676,7 +699,15 @@ CREATE UNIQUE INDEX templates_url_uq ON templates USING btree (url_regexp); -- --- 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 -- @@ -685,7 +716,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 52 (OID 536027) +-- TOC entry 54 (OID 536027) -- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -694,7 +725,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 53 (OID 536377) +-- TOC entry 55 (OID 536377) -- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -703,7 +734,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 58 (OID 537158) +-- TOC entry 60 (OID 537158) -- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -712,7 +743,7 @@ ALTER TABLE ONLY images -- --- TOC entry 60 (OID 537173) +-- TOC entry 62 (OID 537173) -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -721,7 +752,7 @@ ALTER TABLE ONLY files -- --- TOC entry 63 (OID 540825) +-- TOC entry 65 (OID 540825) -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -730,7 +761,7 @@ ALTER TABLE ONLY users -- --- TOC entry 67 (OID 542611) +-- TOC entry 69 (OID 542611) -- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -739,7 +770,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 74 (OID 547945) +-- TOC entry 76 (OID 547945) -- Name: templates_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -748,7 +779,7 @@ ALTER TABLE ONLY templates -- --- TOC entry 81 (OID 536029) +-- TOC entry 84 (OID 536029) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -757,7 +788,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 84 (OID 536384) +-- TOC entry 87 (OID 536384) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -766,7 +797,7 @@ ALTER TABLE ONLY hostnames -- --- TOC entry 82 (OID 536394) +-- TOC entry 85 (OID 536394) -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -775,7 +806,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 77 (OID 536404) +-- TOC entry 80 (OID 536404) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -784,7 +815,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 85 (OID 536920) +-- TOC entry 88 (OID 536920) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -793,7 +824,7 @@ ALTER TABLE ONLY email_notify -- --- TOC entry 86 (OID 537160) +-- TOC entry 89 (OID 537160) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -802,7 +833,7 @@ ALTER TABLE ONLY images -- --- TOC entry 87 (OID 537175) +-- TOC entry 90 (OID 537175) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -811,7 +842,7 @@ ALTER TABLE ONLY files -- --- TOC entry 78 (OID 539155) +-- TOC entry 81 (OID 539155) -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -820,7 +851,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 88 (OID 540827) +-- TOC entry 91 (OID 540827) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -829,7 +860,7 @@ ALTER TABLE ONLY users -- --- TOC entry 89 (OID 540837) +-- TOC entry 92 (OID 540837) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -838,7 +869,7 @@ ALTER TABLE ONLY usercookies -- --- TOC entry 79 (OID 540942) +-- TOC entry 82 (OID 540942) -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -847,7 +878,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 80 (OID 540947) +-- TOC entry 83 (OID 540947) -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -856,7 +887,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 90 (OID 540966) +-- TOC entry 93 (OID 540966) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -865,7 +896,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 91 (OID 540972) +-- TOC entry 94 (OID 540972) -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -874,7 +905,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 92 (OID 542613) +-- TOC entry 95 (OID 542613) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -883,7 +914,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 93 (OID 542622) +-- TOC entry 96 (OID 542622) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -892,7 +923,7 @@ ALTER TABLE ONLY contact_emails -- --- TOC entry 83 (OID 543506) +-- TOC entry 86 (OID 543506) -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -901,7 +932,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 94 (OID 543759) +-- TOC entry 97 (OID 543759) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -910,7 +941,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 95 (OID 543764) +-- TOC entry 98 (OID 543764) -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -919,7 +950,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 96 (OID 543791) +-- TOC entry 99 (OID 543791) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -928,7 +959,7 @@ ALTER TABLE ONLY mailing_lists -- --- TOC entry 97 (OID 544450) +-- TOC entry 100 (OID 544450) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -937,7 +968,7 @@ ALTER TABLE ONLY links -- --- TOC entry 98 (OID 544455) +-- TOC entry 101 (OID 544455) -- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -946,6 +977,42 @@ ALTER TABLE ONLY links -- +-- 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 -- diff --git a/debian/changelog b/debian/changelog index 4cc38fa..1769f76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.2.1-3) unstable; urgency=low +cocanwiki (1.2.1-4) unstable; urgency=low * Initial Release. diff --git a/html/_css/standard.css b/html/_css/standard.css index c53955f..93a5897 100644 --- a/html/_css/standard.css +++ b/html/_css/standard.css @@ -1,5 +1,5 @@ /* 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 { @@ -281,6 +281,50 @@ div#form_div p.edit_link { 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; @@ -448,6 +492,7 @@ table.cal_day a.cal_day_right { /* 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; } diff --git a/scripts/.depend b/scripts/.depend index c182665..6ade698 100644 --- a/scripts/.depend +++ b/scripts/.depend @@ -1,5 +1,7 @@ 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 @@ -18,8 +20,8 @@ cocanwiki_images.cmo: cocanwiki_files.cmo cocanwiki_strings.cmo \ 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 \ @@ -140,10 +142,12 @@ mailing_list_view.cmo: cocanwiki.cmo cocanwiki_date.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 @@ -162,6 +166,8 @@ rebuild_links.cmo: cocanwiki.cmo cocanwiki_links.cmi 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 \ @@ -218,8 +224,8 @@ users.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_template.cmi 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 diff --git a/scripts/Makefile b/scripts/Makefile index fd210a3..9e92ca2 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -1,5 +1,5 @@ # 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 @@ -88,6 +88,7 @@ OBJS := \ preview.cmo \ rebuild_links.cmo \ recent.cmo \ + recently_visited.cmo \ restore.cmo \ restore_form.cmo \ rss.cmo \ diff --git a/scripts/cocanwiki_links.ml b/scripts/cocanwiki_links.ml index 99ee987..cd3b13f 100644 --- a/scripts/cocanwiki_links.ml +++ b/scripts/cocanwiki_links.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -162,12 +162,13 @@ let what_links_here (dbh : Dbi.connection) hostid page = 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) diff --git a/scripts/edit.ml b/scripts/edit.ml index 952e9ef..df0242e 100644 --- a/scripts/edit.ml +++ b/scripts/edit.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -529,7 +529,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = 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 diff --git a/scripts/edit_host_settings.ml b/scripts/edit_host_settings.ml index 0e2ffde..135bd30 100644 --- a/scripts/edit_host_settings.ml +++ b/scripts/edit_host_settings.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -42,6 +42,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = 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 @@ -52,11 +53,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = 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 (); diff --git a/scripts/edit_host_settings_form.ml b/scripts/edit_host_settings_form.ml index 3da216e..d6932bb 100644 --- a/scripts/edit_host_settings_form.ml +++ b/scripts/edit_host_settings_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -44,24 +44,25 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = 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; @@ -70,6 +71,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = 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. *) diff --git a/scripts/edit_page_css.ml b/scripts/edit_page_css.ml index 6a02a23..b9f1ecd 100644 --- a/scripts/edit_page_css.ml +++ b/scripts/edit_page_css.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -63,7 +63,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = 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, diff --git a/scripts/edit_page_title.ml b/scripts/edit_page_title.ml index ec1a3b1..a410d5c 100644 --- a/scripts/edit_page_title.ml +++ b/scripts/edit_page_title.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -95,7 +95,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = 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, diff --git a/scripts/host_menu.ml b/scripts/host_menu.ml index 8dd3462..4a03afa 100644 --- a/scripts/host_menu.ml +++ b/scripts/host_menu.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -36,21 +36,22 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = "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 = @@ -61,7 +62,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = | `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; @@ -75,6 +76,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = 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 diff --git a/scripts/page.ml b/scripts/page.ml index 29dd3bb..9a4e8da 100644 --- a/scripts/page.ml +++ b/scripts/page.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -31,6 +31,7 @@ open Cocanwiki_template 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 @@ -63,14 +64,15 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid (* 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. *) @@ -196,6 +198,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid 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; @@ -275,6 +278,64 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid 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 ... *) diff --git a/scripts/recently_visited.ml b/scripts/recently_visited.ml new file mode 100644 index 0000000..6e689fc --- /dev/null +++ b/scripts/recently_visited.ml @@ -0,0 +1,54 @@ +(* COCANWIKI - a wiki written in Objective CAML. + * Written by Richard W.M. Jones . + * 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 diff --git a/scripts/restore.ml b/scripts/restore.ml index d30ff2b..33f0774 100644 --- a/scripts/restore.ml +++ b/scripts/restore.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -61,7 +61,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user = 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, diff --git a/templates/edit_host_settings_form.html b/templates/edit_host_settings_form.html index 3ad8626..7911959 100644 --- a/templates/edit_host_settings_form.html +++ b/templates/edit_host_settings_form.html @@ -35,6 +35,12 @@ + Navigation box: + + + + + Theme: