Version 1.1.1.
Updated deps.
Updated MANIFEST.
scripts/edit_contact_form.ml
scripts/edit_host_css.ml
scripts/edit_host_css_form.ml
+scripts/edit_host_settings.ml
+scripts/edit_host_settings_form.ml
scripts/edit_page_css.ml
scripts/edit_page_css_form.ml
scripts/edit_sitemenu.ml
templates/edit_conflict.html
templates/edit_contact_form.html
templates/edit_host_css_form.html
+templates/edit_host_settings_form.html
templates/edit_page_css_form.html
templates/edit_sitemenu.html
templates/edit_user_form.html
-# $Id: Makefile.config,v 1.3 2004/09/09 12:07:10 rich Exp $
+# $Id: Makefile.config,v 1.4 2004/09/22 12:04:28 rich Exp $
PACKAGE := cocanwiki
-VERSION := 1.1.0
+VERSION := 1.1.1
# Normally ignored. However, if you are installing centrally (using
# 'make pkg-install'), then the components are installed in the
-cocanwiki (1.1.0-9) unstable; urgency=low
+cocanwiki (1.1.1-1) unstable; urgency=low
* Initial Release.
edit_host_css.cmx: cocanwiki.cmx cocanwiki_ok.cmx cocanwiki_strings.cmx
edit_host_css_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
edit_host_css_form.cmx: cocanwiki.cmx cocanwiki_template.cmx
+edit_host_settings.cmo: cocanwiki.cmo cocanwiki_ok.cmo
+edit_host_settings.cmx: cocanwiki.cmx cocanwiki_ok.cmx
+edit_host_settings_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
+edit_host_settings_form.cmx: cocanwiki.cmx cocanwiki_template.cmx
edit_page_css.cmo: cocanwiki.cmo cocanwiki_diff.cmo cocanwiki_emailnotify.cmo \
cocanwiki_ok.cmo cocanwiki_strings.cmo
edit_page_css.cmx: cocanwiki.cmx cocanwiki_diff.cmx cocanwiki_emailnotify.cmx \
# Makefile for COCANWIKI.
-# $Id: Makefile,v 1.19 2004/09/22 11:41:03 rich Exp $
+# $Id: Makefile,v 1.20 2004/09/22 12:04:28 rich Exp $
include ../Makefile.config
edit_contact_form.cmo \
edit_host_css.cmo \
edit_host_css_form.cmo \
+ edit_host_settings.cmo \
+ edit_host_settings_form.cmo \
edit_page_css.cmo \
edit_page_css_form.cmo \
edit_sitemenu.cmo \
--- /dev/null
+(* 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.1 2004/09/22 12:04:28 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_ok
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
+ (* Cancel? *)
+ if q#param_true "cancel" then (
+ (* Request cancelled. *)
+ q#redirect ("http://" ^ hostname ^ "/_bin/host_menu.cmo");
+ raise CgiExit
+ );
+
+ (* Get parameters. *)
+ let edit_anon = q#param_true "edit_anon" in
+ let create_account_anon = q#param_true "create_account_anon" in
+ let theme_css = q#param "theme_css" in
+ let feedback_email = q#param "feedback_email" in
+
+ let theme_css = if theme_css = "" then `Null else `String theme_css in
+ let feedback_email =
+ if feedback_email = "" then `Null else `String feedback_email in
+
+ (* Update the database. *)
+ let sth = dbh#prepare_cached "update hosts set edit_anon = ?,
+ create_account_anon = ?, theme_css = ?,
+ feedback_email = ?
+ where id = ?" in
+ sth#execute [`Bool edit_anon; `Bool create_account_anon;
+ theme_css; feedback_email;
+ `Int hostid];
+
+ dbh#commit ();
+
+ (* Finish off. *)
+ ok ~title:"Global settings updated"
+ ~buttons:[ok_button "/_bin/host_menu.cmo"]
+ q "The global settings were updated."
+
+let () =
+ register_script ~restrict:[CanManageSite] run
--- /dev/null
+(* 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.1 2004/09/22 12:04:28 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 _ _ =
+ let template = get_template dbh hostid "edit_host_settings_form.html" in
+
+ (* List of themes. *)
+ let sth = dbh#prepare_cached "select theme_css, name, description
+ from themes order by 2, 1" in
+ sth#execute [];
+
+ let themes =
+ sth#map (function [`String theme_css; `String name; `String description] ->
+ theme_css, (name, description)
+ | _ -> assert false) in
+
+ (* Get lots of host-specific stuff from the database. *)
+ let sth =
+ dbh#prepare_cached
+ "select canonical_hostname, edit_anon, create_account_anon, theme_css,
+ feedback_email
+ from hosts where id = ?" in
+ sth#execute [`Int hostid];
+
+ let canonical_hostname, edit_anon, create_account_anon, theme_css,
+ feedback_email =
+ match sth#fetch1 () with
+ [ `String canonical_hostname;
+ `Bool edit_anon; `Bool create_account_anon;
+ (`String _ | `Null) as theme_css;
+ (`String _ | `Null) as feedback_email ] ->
+ 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
+ | _ -> assert false in
+
+ template#set "canonical_hostname" canonical_hostname;
+ template#conditional "edit_anon" edit_anon;
+ template#conditional "create_account_anon" create_account_anon;
+ template#set "feedback_email" feedback_email;
+
+ (* Themes table. *)
+ let table =
+ List.map (fun (css, (name, description)) ->
+ let selected = css = theme_css in
+ [ "theme_css", Template.VarString css;
+ "name", Template.VarString name;
+ "description", Template.VarString description;
+ "selected", Template.VarConditional selected ]) themes in
+ template#table "themes" table;
+
+ q#template template
+
+let () =
+ register_script ~restrict:[CanManageSite] run
--- /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>Edit global settings</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>Edit global settings</h1>
+
+<form method="post" action="edit_host_settings.cmo">
+<table class="left_table">
+<tr>
+<th> Global stylesheet: </th>
+<td> <a href="/_bin/edit_host_css_form.cmo">Edit global stylesheet ...</a> </td>
+</tr>
+<tr>
+<th> Global permissions: </th>
+<td>
+<input type="checkbox" name="edit_anon" value="1" ::if(edit_anon)::checked="checked"::end:: id="edit_anon"/><label for="edit_anon">Allow anonymous edits</label> <br/>
+<input type="checkbox" name="create_account_anon" value="1" ::if(create_account_anon)::checked="checked"::end:: id="create_account_anon"/><label for="create_account_anon">Allow anyone to create accounts</label>
+</td>
+</tr>
+<tr>
+<th> Theme: </th>
+<td>
+<select name="theme_css">
+<option value=""> Standard wiki theme </option>
+::table(themes)::
+<option value="::theme_css_html_tag::" ::if(selected)::selected="selected"::end::> ::name_html:: </option>
+::end::
+</select>
+</td>
+</tr>
+<tr>
+<th> Feedback email address: </th>
+<td> <input name="feedback_email" value="::feedback_email_html_tag::" size="40" /> </td>
+</tr>
+<tr>
+<td></td>
+<td>
+<input type="submit" name="update" value=" Update global settings "/>
+<input type="submit" name="cancel" value=" Cancel "/>
+</table>
+
+<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
<h1>Global settings</h1>
-<table class="top_table">
+<table class="left_table">
<tr>
<th> Canonical hostname: </th>
<td> ::canonical_hostname_html:: </td>
</tr>
<tr>
<th> Theme: </th>
-<td> ::if(has_theme_css)::<strong>::theme_name_html::</strong> <br/> ::theme_description_html:: ::else:: Standard theme ::end:: </td>
+<td> ::if(has_theme_css)::<strong>::theme_name_html::</strong> <br/> ::theme_description_html:: ::else:: Standard wiki theme ::end:: </td>
</tr>
<tr>
<th> Feedback email address: </th>