(* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. * $Id: cocanwiki_pages.mli,v 1.8 2006/08/17 09:11:31 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 section = string option * string option * string option * string option * string (* (sectionname, divname, divclass, jsgo, content) *) type model = { id : int32; (* Original page ID (0 = none). *) pt : pt; (* Page of title (only used if id=0) *) description : string; (* Description. *) keywords : string option; (* Keywords. *) noodp : bool option; (* NOODP per-page override. *) redirect : string option; (* Redirect to. *) contents_ : section list; (* List of sections. *) } exception SaveURLError exception SaveConflict of int32 * int32 * string * string option (** New version, old version, URL, CSS. *) 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 : PGOCaml.pa_pg_data PGOCaml.t -> int32 -> url:string -> ?version:int32 -> 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 : Apache.Request.t -> PGOCaml.pa_pg_data PGOCaml.t -> int32 -> ?user:user_t -> model -> string * int32 (** 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) *)