Email notify when page is renamed.
authorrich <rich>
Mon, 22 Nov 2004 11:11:52 +0000 (11:11 +0000)
committerrich <rich>
Mon, 22 Nov 2004 11:11:52 +0000 (11:11 +0000)
scripts/rename_page.ml

index 8de584f..579369c 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: rename_page.ml,v 1.1 2004/11/22 11:07:32 rich Exp $
+ * $Id: rename_page.ml,v 1.2 2004/11/22 11:11:52 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
@@ -28,6 +28,7 @@ open Cocanwiki
 open Cocanwiki_ok
 open Cocanwiki_pages
 open Cocanwiki_strings
+open Cocanwiki_emailnotify
 
 let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
   let page = q#param "page" in
@@ -99,6 +100,15 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
   (* Finish off XXX *)
   dbh#commit ();
 
+  (* Email notification. *)
+  let subject = "Page " ^ page ^ " has been renamed" in
+
+  let body = fun () ->
+    "Old title: " ^ old_title ^ "\n" ^
+    "New title: " ^ new_title in
+
+  email_notify ~body ~subject ~user dbh hostid;
+
   let buttons = [ ok_button ("/" ^ new_page) ] in
   ok ~title:"Page renamed" ~buttons
     q "That page was renamed."