(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_hostnames.ml,v 1.10 2006/03/28 16:24:08 rich Exp $
+ * $Id: edit_hostnames.ml,v 1.11 2006/07/26 13:12:11 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
if q#param_true "cancel" then (
let { hostname = hostname } = host' in
q#redirect ("http://" ^ hostname ^ "/_bin/admin/host.cmo?hostid=" ^
- Int32.to_string hostid);
- return ()
+ Int32.to_string hostid)
);
let canonical_hostname = q#param "canonical_hostname" in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: delete_contact.ml,v 1.5 2006/03/27 18:09:46 rich Exp $
+ * $Id: delete_contact.ml,v 1.6 2006/07/26 13:12:10 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
let run r (q : cgi) dbh hostid { hostname = hostname } _ =
(* Cancel? *)
- if q#param_true "cancel" then (
+ if q#param_true "cancel" then
q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo");
- return ()
- );
(* We can delete multiple contact forms from this script, which is
* quite unusual.
*)
let ids = List.map Int32.of_string (q#param_all "delete") in
- if ids = [] then (
+ if ids = [] then
q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo");
- return ()
- );
(* Need to check the contact emails all belong to this host. *)
let rows = PGSQL(dbh)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: delete_contact_form.ml,v 1.3 2006/03/27 18:09:46 rich Exp $
+ * $Id: delete_contact_form.ml,v 1.4 2006/07/26 13:12:10 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
* quite unusual.
*)
let ids = List.map Int32.of_string (q#param_all "delete") in
- if ids = [] then (
+ if ids = [] then
q#redirect ("http://" ^ hostname ^ "/_bin/contacts.cmo");
- return ()
- );
let rows = PGSQL(dbh)
"select id, name, subject from contacts
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: delete_user.ml,v 1.6 2006/03/27 18:09:46 rich Exp $
+ * $Id: delete_user.ml,v 1.7 2006/07/26 13:12:10 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
open Cocanwiki_ok
let run r (q : cgi) dbh hostid {hostname = hostname} self =
- if q#param_true "cancel" then (
+ if q#param_true "cancel" then
(* Request cancelled. *)
q#redirect ("http://" ^ hostname ^ "/_users");
- return ()
- );
let userid = Int32.of_string (q#param "userid") in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit.ml,v 1.28 2006/03/27 18:09:46 rich Exp $
+ * $Id: edit.ml,v 1.29 2006/07/26 13:12:10 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
(* Begin editing with a blank page, typically a template. *)
let begin_editing_new pt =
- let url, title =
- match pt with
- Page url -> url, url
- | Title title ->
- match Wikilib.generate_url_of_title dbh hostid title with
- Wikilib.GenURL_OK url -> url, title
- | Wikilib.GenURL_Duplicate url ->
- q#redirect ("http://" ^ hostname ^ "/" ^ url);
- return ()
- | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL ->
- error ~back_button:true ~title:"Bad page name"
- dbh hostid q
- "The page name supplied is too short or invalid.";
- return () in
+ (* Just check the title. *)
+ (match pt with
+ | Page url -> ()
+ | Title title ->
+ match Wikilib.generate_url_of_title dbh hostid title with
+ | Wikilib.GenURL_OK url -> ()
+ | Wikilib.GenURL_Duplicate url ->
+ q#redirect ("http://" ^ hostname ^ "/" ^ url)
+ | Wikilib.GenURL_TooShort | Wikilib.GenURL_BadURL ->
+ error ~back_button:true ~title:"Bad page name"
+ dbh hostid q
+ "The page name supplied is too short or invalid.";
+ return ()
+ );
let model = match pt with
- Page url -> new_page pt
+ | Page url -> new_page pt
| Title title -> new_page_with_title title in
model_to_template model template
email_notify ~body ~subject ~user dbh hostid;
(* Redirect back to the URL. *)
- q#redirect ("http://" ^ hostname ^ "/" ^ url);
- return ()
+ q#redirect ("http://" ^ hostname ^ "/" ^ url)
);
in
*)
"" in
- q#redirect ("http://" ^ hostname ^ "/" ^ url);
- return ()
+ q#redirect ("http://" ^ hostname ^ "/" ^ url)
in
(* This code decides where we are in the current editing cycle.
(* 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.10 2006/03/27 18:09:46 rich Exp $
+ * $Id: edit_host_settings.ml,v 1.11 2006/07/26 13:12:10 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
let run r (q : cgi) dbh hostid { hostname = hostname } _ =
(* Cancel? *)
- if q#param_true "cancel" then (
+ if q#param_true "cancel" then
(* Request cancelled. *)
q#redirect ("http://" ^ hostname ^ "/_bin/host_menu.cmo");
- return ()
- );
(* Get parameters. *)
let edit_anon = q#param_true "edit_anon" in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_sitemenu.ml,v 1.11 2006/03/27 19:10:29 rich Exp $
+ * $Id: edit_sitemenu.ml,v 1.12 2006/07/26 13:12:10 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
(* Check for errors in the model. *)
let check_for_errors model =
let errors = ref [] in
- let add_error msg = errors := msg :: !errors in
+(* let add_error msg = errors := msg :: !errors in *)
let get_errors () = List.rev !errors in
(* XXX Not implemented yet. *)
* page - the page URL opened newly for editing.
*)
if q#param_true "inedit" then (
- if q#param_true "cancel" then (
+ if q#param_true "cancel" then
cancel ();
- return ()
- );
if q#param_true "save" then (
let ok = try_save () in
if ok then return () (* ... else fall through *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: invite_user.ml,v 1.7 2006/03/28 13:20:00 rich Exp $
+ * $Id: invite_user.ml,v 1.8 2006/07/26 13:12:10 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
let emails = Pcre.split ~rex:split_re emails in
(* This guy's got no friends ... *)
- if emails = [] then (
+ if emails = [] then
q#redirect ("http://" ^ hostname ^ "/");
- return ()
- );
let userid, username, email = match user with
User (userid, username, _, prefs) -> userid, username, prefs.email
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_ext_calendar.ml,v 1.3 2006/03/27 16:43:44 rich Exp $
+ * $Id: cocanwiki_ext_calendar.ml,v 1.4 2006/07/26 13:12:11 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
template#to_string
- | Some ((yyyy, mm, dd) as date) -> (* Single day view. *)
+ | Some (yyyy, mm, dd) -> (* Single day view. *)
let template = day_template in
(* XXX This will change once we start doing date and time events.
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_confirm.ml,v 1.6 2006/03/28 13:20:00 rich Exp $
+ * $Id: mailing_list_confirm.ml,v 1.7 2006/07/26 13:12:10 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
let rows = PGSQL(dbh) "select email from mailing_lists
where hostid = $hostid and pending = $pending" in
- let email =
- match rows with
- | [email] -> email
- | [] ->
- error ~close_button:true ~title:"Email already confirmed"
- dbh hostid q
- "It looks like that email address has already been confirmed.";
- return ()
- | _ -> assert false in
+ (* Already confirmed? *)
+ (match rows with
+ | [_] -> ()
+ | [] ->
+ error ~close_button:true ~title:"Email already confirmed"
+ dbh hostid q
+ "It looks like that email address has already been confirmed.";
+ return ()
+ | _ -> assert false);
(* Update the database. *)
PGSQL(dbh) "update mailing_lists set pending = null
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: rename_page.ml,v 1.5 2006/03/28 16:24:08 rich Exp $
+ * $Id: rename_page.ml,v 1.6 2006/07/26 13:12:10 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
let page = q#param "page" in
(* Cancelled? *)
- if q#param_true "cancel" then (
+ if q#param_true "cancel" then
q#redirect ("http://" ^ hostname ^ "/" ^ page);
- return ()
- );
let new_title = trim (q#param "new_title") in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: send_feedback.ml,v 1.8 2006/03/28 16:24:08 rich Exp $
+ * $Id: send_feedback.ml,v 1.9 2006/07/26 13:12:10 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
let run r (q : cgi) dbh hostid {hostname = hostname} user =
let template = get_template dbh hostid "send_feedback.txt" in
- if q#param_true "cancel" then (
+ if q#param_true "cancel" then
(* Request cancelled. *)
q#redirect ("http://" ^ hostname);
- return ()
- );
(* Get the feedback email for this host. *)
let to_addr = List.hd (