Added styling to some pages which previously were "outside" the site
authorrich <rich>
Thu, 3 Aug 2006 13:52:54 +0000 (13:52 +0000)
committerrich <rich>
Thu, 3 Aug 2006 13:52:54 +0000 (13:52 +0000)
and consequently unstyled.  Now most pages that an ordinary punter
can see should have the global styling.

html/_css/sitemap.css [new file with mode: 0644]
html/_css/standard.css
scripts/lib/cocanwiki_template.ml
scripts/page.ml
templates/forgot_password_form.html
templates/login_form.html
templates/page_email_form.html
templates/search.html
templates/send_feedback_form.html
templates/sitemap.html

diff --git a/html/_css/sitemap.css b/html/_css/sitemap.css
new file mode 100644 (file)
index 0000000..01516d5
--- /dev/null
@@ -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;
+}
index 9ef08ac..e758566 100644 (file)
@@ -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;
index 45f739d..1632e18 100644 (file)
@@ -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.
- * $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/";
index 47e6ae9..30b72b6 100644 (file)
@@ -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.
- * $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;
        | _ -> ()
     );
index f0e0d79..57654cd 100644 (file)
@@ -6,6 +6,7 @@
 <meta name="author" content="http://www.merjis.com/" />
 <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
 <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+::if(has_host_css)::<link rel="stylesheet" href="/_global.css" type="text/css" title="Standard"/>::end::
 <link rel="stylesheet" href="/_css/login.css" type="text/css" title="Standard"/>
 </head><body>
 
index 70053c1..602cc5e 100644 (file)
@@ -6,6 +6,7 @@
 <meta name="author" content="http://www.merjis.com/" />
 <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
 <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+::if(has_host_css)::<link rel="stylesheet" href="/_global.css" type="text/css" title="Standard"/>::end::
 <link rel="stylesheet" href="/_css/login.css" type="text/css" title="Standard"/>
 </head><body>
 
 <a href="/_bin/forgot_password_form.cmo">Forgotten your password?</a>
 </p>
 
-<h2>Create an account</h2>
-
 ::if(create_account_anon)::
 
+<h2>Create an account</h2>
+
 <form method="post" action="/_bin/signup.cmo">
 <table class="create">
 
index 49e9772..34ff159 100644 (file)
@@ -5,6 +5,7 @@
 <meta name="author" content="http://www.merjis.com/" />
 <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
 <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+::if(has_host_css)::<link rel="stylesheet" href="/_global.css" type="text/css" title="Standard"/>::end::
 </head><body>
 
 <h1><span>Send an email when the page is updated</span></h1>
index b6e5a00..3276ca2 100644 (file)
@@ -6,6 +6,7 @@
 <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
 <link rel="stylesheet" href="/_css/search.css" type="text/css" title="Standard"/>
 <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+::if(has_host_css)::<link rel="stylesheet" href="/_global.css" type="text/css" title="Standard"/>::end::
 </head><body onload="document.f.q.focus ()">
 
 <h1><span>Search this site</span></h1>
index 855849c..fbd234f 100644 (file)
@@ -5,6 +5,7 @@
 <meta name="author" content="http://www.merjis.com/" />
 <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
 <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+::if(has_host_css)::<link rel="stylesheet" href="/_global.css" type="text/css" title="Standard"/>::end::
 </head><body>
 
 <h1><span>Send feedback about this page</span></h1>
index 53cd9a8..a13d1b0 100644 (file)
@@ -4,7 +4,9 @@
 <title>Sitemap</title>
 <meta name="author" content="http://www.merjis.com/" />
 <link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
+<link rel="stylesheet" href="/_css/sitemap.css" type="text/css" title="Standard"/>
 <link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+::if(has_host_css)::<link rel="stylesheet" href="/_global.css" type="text/css" title="Standard"/>::end::
 </head><body>
 
 <h1><span>Sitemap</span></h1>