From c7a57233daadec4f174176a474fc7b5018cdf986 Mon Sep 17 00:00:00 2001
From: rich
Date: Thu, 3 Aug 2006 13:52:54 +0000
Subject: [PATCH] Added styling to some pages which previously were "outside"
the site and consequently unstyled. Now most pages that an ordinary punter
can see should have the global styling.
---
html/_css/sitemap.css | 26 +++++++++++++++++++++++
html/_css/standard.css | 26 +----------------------
scripts/lib/cocanwiki_template.ml | 14 ++++++++++---
scripts/page.ml | 41 ++++++++++++++++++++++---------------
templates/forgot_password_form.html | 1 +
templates/login_form.html | 5 +++--
templates/page_email_form.html | 1 +
templates/search.html | 1 +
templates/send_feedback_form.html | 1 +
templates/sitemap.html | 2 ++
10 files changed, 72 insertions(+), 46 deletions(-)
create mode 100644 html/_css/sitemap.css
diff --git a/html/_css/sitemap.css b/html/_css/sitemap.css
new file mode 100644
index 0000000..01516d5
--- /dev/null
+++ b/html/_css/sitemap.css
@@ -0,0 +1,26 @@
+/* Stylesheet for COCANWIKI.
+ * $Id: sitemap.css,v 1.1 2006/08/03 13:52:54 rich Exp $
+ */
+
+ul#sitemap {
+ list-style: none;
+ margin-left: 0px;
+ padding-left: 0px;
+}
+
+ul#sitemap p.content {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ font-size: 0.7em;
+}
+
+ul#sitemap p.info {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ font-size: 0.7em;
+}
+
+ul#sitemap p.info a {
+ color: green;
+ text-decoration: none;
+}
diff --git a/html/_css/standard.css b/html/_css/standard.css
index 9ef08ac..e758566 100644
--- a/html/_css/standard.css
+++ b/html/_css/standard.css
@@ -1,5 +1,5 @@
/* Stylesheet for COCANWIKI.
- * $Id: standard.css,v 1.28 2005/12/13 09:05:51 rich Exp $
+ * $Id: standard.css,v 1.29 2006/08/03 13:52:54 rich Exp $
*/
/* Based on the basic stylesheet. */
@@ -231,30 +231,6 @@ li.wlh_li a {
background: url(/_graphics/wlh.png) center left no-repeat;
}
-/* Sitemap page. */
-ul#sitemap {
- list-style: none;
- margin-left: 0px;
- padding-left: 0px;
-}
-
-ul#sitemap p.content {
- margin-top: 0px;
- margin-bottom: 0px;
- font-size: 0.7em;
-}
-
-ul#sitemap p.info {
- margin-top: 0px;
- margin-bottom: 0px;
- font-size: 0.7em;
-}
-
-ul#sitemap p.info a {
- color: green;
- text-decoration: none;
-}
-
/* Recent changes list. */
ul#recent_changes {
list-style: none;
diff --git a/scripts/lib/cocanwiki_template.ml b/scripts/lib/cocanwiki_template.ml
index 45f739d..1632e18 100644
--- a/scripts/lib/cocanwiki_template.ml
+++ b/scripts/lib/cocanwiki_template.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_template.ml,v 1.7 2006/03/28 18:40:50 rich Exp $
+ * $Id: cocanwiki_template.ml,v 1.8 2006/08/03 13:53:00 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
@@ -84,13 +84,14 @@ let get_template ?page dbh hostid filename =
(* Get standard fields concerning this host from the database. *)
let rows =
PGSQL(dbh) "nullable-results"
- "select h.theme_css, p.name, p.url, h.search_box,
+ "select h.theme_css, h.css is not null,
+ p.name, p.url, h.search_box,
h.brand, h.brand_tagline, h.brand_description,
h.pagebug
from hosts h left outer join powered_by p on h.powered_by = p.id
where h.id = $hostid" in
- let theme_css, powered_by_name, powered_by_url, search_box,
+ let theme_css, has_host_css, powered_by_name, powered_by_url, search_box,
brand, brand_tagline, brand_description, pagebug =
match rows with
| [ row ] -> row
@@ -101,6 +102,11 @@ let get_template ?page dbh hostid filename =
| None -> "/_css/standard.css"
| Some file -> file in
+ let has_host_css =
+ match has_host_css with
+ | Some true -> true
+ | _ -> false in
+
let powered_by_name, powered_by_url =
match powered_by_name, powered_by_url with
| None, None ->
@@ -137,6 +143,7 @@ let get_template ?page dbh hostid filename =
let search_box = match search_box with Some b -> b | _ -> assert false in
template#set "theme_css" theme_css;
+ template#conditional "has_host_css" has_host_css;
template#set "powered_by_name" powered_by_name;
template#set "powered_by_url" powered_by_url;
template#conditional "search_box" search_box;
@@ -179,6 +186,7 @@ let get_template ?page dbh hostid filename =
)
else (* if we have no hostid *) (
template#set "theme_css" "/_css/standard.css";
+ template#conditional "has_host_css" false;
template#set "powered_by_name" (Cocanwiki_version.package ^ " " ^
Cocanwiki_version.version);
template#set "powered_by_url" "http://sandbox.merjis.com/";
diff --git a/scripts/page.ml b/scripts/page.ml
index 47e6ae9..30b72b6 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.50 2006/08/03 13:33:15 rich Exp $
+ * $Id: page.ml,v 1.51 2006/08/03 13:52:58 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
@@ -79,14 +79,15 @@ let run r (q : cgi) dbh hostid
let template_404 = get_template dbh hostid "page_404.html" in
(* Host-specific fields. *)
- let rows = PGSQL(dbh)
- "select css is not null, feedback_email is not null, mailing_list, navigation
- from hosts where id = $hostid" in
- let has_host_css, has_feedback_email, mailing_list, navigation =
+ let rows =
+ PGSQL(dbh)
+ "select feedback_email is not null,
+ mailing_list, navigation
+ from hosts where id = $hostid" in
+ let has_feedback_email, mailing_list, navigation =
match rows with
- | [Some has_host_css, Some has_feedback_email,
- mailing_list, navigation] ->
- has_host_css, has_feedback_email, mailing_list, navigation
+ | [Some has_feedback_email, mailing_list, navigation] ->
+ has_feedback_email, mailing_list, navigation
| _ -> assert false in
(* User permissions. *)
@@ -207,7 +208,6 @@ let run r (q : cgi) dbh hostid
t#conditional "redirected" false
);
- th#conditional "has_host_css" has_host_css;
th#conditional "has_page_css" has_page_css;
(* Are we showing an old version of the page? If so, warn. *)
@@ -317,13 +317,22 @@ let run r (q : cgi) dbh hostid
if pageid <> None then (
match user with
| User (userid, _, _, _) ->
- PGSQL(dbh)
- "delete from recently_visited
- where hostid = $hostid and userid = $userid and url = $page'";
- PGSQL(dbh)
- "insert into recently_visited (hostid, userid, url)
- values ($hostid, $userid, $page')";
- PGOCaml.commit dbh;
+ (try
+ PGSQL(dbh)
+ "delete from recently_visited
+ where hostid = $hostid and userid = $userid
+ and url = $page'";
+ PGSQL(dbh)
+ "insert into recently_visited (hostid, userid, url)
+ values ($hostid, $userid, $page')";
+ PGOCaml.commit dbh;
+ with
+ exn ->
+ (* Exceptions here are non-fatal. Just print them. *)
+ prerr_endline "exception updating recently_visited:";
+ prerr_endline (Printexc.to_string exn);
+ PGOCaml.rollback dbh;
+ );
PGOCaml.begin_work dbh;
| _ -> ()
);
diff --git a/templates/forgot_password_form.html b/templates/forgot_password_form.html
index f0e0d79..57654cd 100644
--- a/templates/forgot_password_form.html
+++ b/templates/forgot_password_form.html
@@ -6,6 +6,7 @@
+::if(has_host_css)::::end::
diff --git a/templates/login_form.html b/templates/login_form.html
index 70053c1..602cc5e 100644
--- a/templates/login_form.html
+++ b/templates/login_form.html
@@ -6,6 +6,7 @@
+::if(has_host_css)::::end::
@@ -44,10 +45,10 @@
Forgotten your password?
-Create an account
-
::if(create_account_anon)::
+Create an account
+