(* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. * $Id: cocanwiki_pages.mli,v 1.1 2004/10/11 14:13:04 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 Cocanwiki (* Page (URL) or title. *) type pt = Page of string | Title of string type model = { id : int; (* Original page ID (0 = none). *) pt : pt; (* Page of title (only used if id=0) *) description : string; (* Description. *) redirect : string; (* Redirect to ("" = none). *) contents : (string * string * string) list; (* (sectionname, divname, content) * for each section. *) } exception SaveURLError exception SaveConflict of int * int * string * string val new_page : pt -> model (** Create a new, blank page. *) val new_page_with_title : string -> model (** Friendlier version of {!new_page} which creates a new page from * a title and begins an introductory paragraph for the user. *) val load_page : Dbi.connection -> int -> url:string -> ?version:int -> unit -> model (** Load a page from the database. A non-current version can be * specified with the optional [?version] parameter, otherwise the * latest version is loaded. * * @raise Not_found If the page cannot be found. *) val save_page : Dbi.connection -> int -> ?user:user_t -> ?r:Apache.Request.t -> model -> string * int (** Save a page. If the page is new, this creates a new page in the * database. If the page is old, then the page is edited. * * Notification emails are not sent. * * @raise SaveURLError Duplicate URL or bad URL (happens only when creating * new pages). * * @raise SaveConflict If there was an editing conflict. * * @return (url, pageid) *)