git.annexia.org
/
cocanwiki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
262f6a0
)
Allow $field to be substituted in subject lines.
author
rich
<rich>
Tue, 9 May 2006 11:36:16 +0000
(11:36 +0000)
committer
rich
<rich>
Tue, 9 May 2006 11:36:16 +0000
(11:36 +0000)
Makefile.config
patch
|
blob
|
history
scripts/contact.ml
patch
|
blob
|
history
diff --git
a/Makefile.config
b/Makefile.config
index
a66049f
..
bf578b8
100644
(file)
--- a/
Makefile.config
+++ b/
Makefile.config
@@
-1,7
+1,7
@@
-# $Id: Makefile.config,v 1.3
0 2006/03/27 16:43:43
rich Exp $
+# $Id: Makefile.config,v 1.3
1 2006/05/09 11:36:16
rich Exp $
PACKAGE := cocanwiki
PACKAGE := cocanwiki
-VERSION := 1.4.
0
+VERSION := 1.4.
1
# Normally ignored. However, if you are installing centrally (using
# 'make pkg-install'), then the components are installed in the
# Normally ignored. However, if you are installing centrally (using
# 'make pkg-install'), then the components are installed in the
diff --git
a/scripts/contact.ml
b/scripts/contact.ml
index
b64bd56
..
96469ea
100644
(file)
--- a/
scripts/contact.ml
+++ b/
scripts/contact.ml
@@
-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.
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: contact.ml,v 1.1
0 2006/03/27 18:09:4
6 rich Exp $
+ * $Id: contact.ml,v 1.1
1 2006/05/09 11:36:1
6 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
*
* 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
@@
-30,6
+30,8
@@
open Cocanwiki
open Cocanwiki_template
open Cocanwiki_ok
open Cocanwiki_template
open Cocanwiki_ok
+let subj_rex = Pcre.regexp "\\$\\w+"
+
let run r (q : cgi) dbh hostid {hostname = hostname} user =
let template = get_template dbh hostid "contact.txt" in
let run r (q : cgi) dbh hostid {hostname = hostname} user =
let template = get_template dbh hostid "contact.txt" in
@@
-97,6
+99,20
@@
let run r (q : cgi) dbh hostid {hostname = hostname} user =
let not_empty name = (q#upload name).upload_value <> "" in
List.filter not_empty uploads in
let not_empty name = (q#upload name).upload_value <> "" in
List.filter not_empty uploads in
+ (* Substitute any $Field fields in the subject line. The substitution
+ * is very simple-minded.
+ *)
+ let subst pat =
+ let n = String.length pat in
+ assert (n > 0 && pat.[0] = '$');
+ let fieldname = String.sub pat 1 (n-1) in
+ if List.mem fieldname names then
+ q#param fieldname
+ else
+ pat
+ in
+ let subject = Pcre.substitute ~rex:subj_rex ~subst subject in
+
(* Get the IP address for logging purposes. *)
let ip =
try Connection.remote_ip (Request.connection r) with Not_found -> "" in
(* Get the IP address for logging purposes. *)
let ip =
try Connection.remote_ip (Request.connection r) with Not_found -> "" in