Added outline script and template to use as starting points.
Switchable themes - added an 'easyweb' theme.
--- /dev/null
+/* Stylesheet for EWM.
+ * $Id: easyweb.css,v 1.1 2004/09/08 17:07:24 rich Exp $
+ */
+
+/* Based on the standard stylesheet. */
+@import url("/_css/standard.css");
\ No newline at end of file
-/* Stylesheet for COCANWIKI, derived from EWM.
- * $Id: standard.css,v 1.2 2004/09/08 14:01:17 rich Exp $
+/* Stylesheet for COCANWIKI.
+ * $Id: standard.css,v 1.3 2004/09/08 17:07:24 rich Exp $
*/
body {
--- /dev/null
+(* COCANWIKI scripts.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: 00-TEMPLATE.ml,v 1.1 2004/09/08 17:07:24 rich Exp $
+ *)
+
+open Apache
+open Registry
+open Cgi
+open Printf
+
+open Cocanwiki
+open Cocanwiki_template
+
+let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ =
+ let template = get_template dbh hostid "00-TEMPLATE.html" in
+
+
+
+
+
+ q#template template
+
+let () =
+ register_script ~restrict:[CanManageUsers] run
# Makefile for COCANWIKI.
-# $Id: Makefile,v 1.9 2004/09/08 14:47:47 rich Exp $
+# $Id: Makefile,v 1.10 2004/09/08 17:07:24 rich Exp $
include ../Makefile.config
wikilib.cmo \
cgi_expires.cmo
-OBJS := create.cmo \
+OBJS := 00-TEMPLATE.cmo \
+ create.cmo \
create_form.cmo \
delete_file.cmo \
delete_file_form.cmo \
(* COCANWIKI scripts.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_template.ml,v 1.3 2004/09/08 15:46:52 rich Exp $
+ * $Id: cocanwiki_template.ml,v 1.4 2004/09/08 17:07:24 rich Exp $
*
* This module wraps around the Template library. It provides caching
* of templates and fills in standard fields on a host-specific basis.
"(see README file for more details)");
base
+(* The webserver gets restarted regularly enough that this is reasonable. *)
+let { tm_year = year } = gmtime (time ())
+let year = year + 1900
+
(* Cache of precompiled templates, arranged by full path. *)
let cache = Hashtbl.create 32
let template = _get_template filename in
(* Get standard fields concerning this host from the database. *)
- (* XXX *)
+ let sth = dbh#prepare_cached "select theme_css from hosts
+ where id = ?" in
+ sth#execute [`Int hostid];
+
+ let theme_css =
+ match sth#fetch1 () with
+ [ `Null ] -> "/_css/standard.css"
+ | [ `String file ] -> file
+ | _ -> assert false in
+
+ template#set "theme_css" theme_css;
+
+ (* Site menu. *)
+ let sth = dbh#prepare_cached "select url, label, ordering from sitemenu
+ where hostid = ? order by ordering" in
+ sth#execute [`Int hostid];
+
+ let table = sth#map (function [`String url; `String label; _] ->
+ [ "url", Template.VarString url;
+ "label", Template.VarString label ]
+ | _ -> assert false) in
+
+ template#table "sitemenu" table;
+
+ (* Wiki version. *)
+ template#set "cocanwiki_package" Cocanwiki_version.package;
+ template#set "cocanwiki_version" Cocanwiki_version.version;
+
+ (* Copyright year. *)
+ template#set "year" (string_of_int year);
template
(* COCANWIKI scripts.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: page.ml,v 1.8 2004/09/08 15:46:53 rich Exp $
+ * $Id: page.ml,v 1.9 2004/09/08 17:07:24 rich Exp $
*)
open Apache
t#set "description" description;
t#set "pageid" (string_of_int pageid);
t#set "last_modified_date" (printable_date last_modified_date);
- t#set "cocanwiki_package" Cocanwiki_version.package;
- t#set "cocanwiki_version" Cocanwiki_version.version;
if page <> page' then (* redirection *) (
t#set "page" page';
t#conditional "user_logged_in" true;
t#set "username" username);
- (* Site menu. *)
- let sth = dbh#prepare_cached "select url, label, ordering from sitemenu
- where hostid = ? order by ordering" in
- sth#execute [`Int hostid];
-
- let table = sth#map (function [`String url; `String label; _] ->
- [ "url", Template.VarString url;
- "label", Template.VarString label ]
- | _ -> assert false) in
-
- t#table "sitemenu" table;
-
q#template t
in
t#conditional "can_edit" can_edit;
t#conditional "can_manage_users" can_manage_users;
- (* Site menu. *)
- let sth = dbh#prepare_cached "select url, label, ordering from sitemenu
- where hostid = ? order by ordering" in
- sth#execute [`Int hostid];
-
- let table = sth#map (function [`String url; `String label; _] ->
- [ "url", Template.VarString url;
- "label", Template.VarString label ]
- | _ -> assert false) in
-
- t#table "sitemenu" table;
-
q#template t
in
--- /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>XXX TITLE XXX</title>
+<meta name="robots" content="noindex,nofollow"/>
+<meta name="author" content="http://www.merjis.com/" />
+<link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
+</head><body>
+
+<h1>XXX TITLE XXX</h1>
+
+<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>
+
+<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>
+
+<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>
+
+</body>
+</html>
\ No newline at end of file