Show all changed fields in the diff report.
[cocanwiki.git] / scripts / lib / cocanwiki_pages.ml
index 31bb251..70eb525 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: cocanwiki_pages.ml,v 1.7 2006/07/27 16:46:55 rich Exp $
+ * $Id: cocanwiki_pages.ml,v 1.8 2006/08/04 12:20:07 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
@@ -26,6 +26,10 @@ open Cocanwiki_strings
 
 type pt = Page of string | Title of string
 
+type section =
+    string option * string option * string option * string
+    (* (sectionname, divname, jsgo, content) *)
+
 type model = {
   id : int32;                          (* Original page ID (0 = none). *)
   pt : pt;                             (* Page of title (only used if id=0) *)
@@ -34,12 +38,11 @@ type model = {
   (* NB. Don't call this 'contents' because that clashes with the
    * Pervasives.contents fields of the ref type.
    *)
-  contents_ : (string option * string option * string option * string) list;
-          (* (sectionname, divname, jsgo, content) for each section. *)
+  contents_ : section list;
 }
 
 exception SaveURLError
-exception SaveConflict of int32 * int32 * string * string
+exception SaveConflict of int32 * int32 * string * string option
 
 let new_page pt =
   let description =
@@ -183,10 +186,8 @@ let save_page r dbh hostid ?user model =
 
       let edited = max_id <> model_id in
 
-      if edited then (
-       let css = match css with None -> "" | Some css -> css in
-       raise (SaveConflict (max_id, model_id, url, css))
-      );
+      if edited then
+       raise (SaveConflict (max_id, model_id, url, css));
 
       (* Defer the pages_redirect_cn constraint because that would
        * temporarily fail on the next UPDATE.