Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Wiki_data

module Wiki_data : sig..end

This is the wiki component of Ocsimore. Author(s): Jaap Boender, Piero Furiesi, Vincent Balat


This is the wiki component of Ocsimore.

exception Page_already_exists of Wiki_types.wikibox

Exception raised when a wikipage already exists. The argument is the wikibox for the pre-existing page

exception Css_already_exists
type 'a rights = rights:Wiki_types.wiki_rights -> 'a
val create_wiki : 
  (title:string ->
   descr:string ->
   ?path:string list ->
   ?staticdir:string ->
   ?boxrights:bool ->
   admins:User_sql.Types.user list ->
   readers:User_sql.Types.user list ->
   ?container_text:string ->
   model:Wiki_types.wiki_model -> unit -> Wiki_types.wiki Lwt.t)
  rights

Creates the specified wiki if the user has enough permissions. Raise Permission_denied if it is not the case, and or fails with the same errors as Wiki.create_wiki if the wiki cannot be created. The options are the same as for the this function, except for the field admin, which is used as the author of the container page, and becomes admin of the wiki. By default, no one can read the wiki.

val new_wikitextbox : 
  ?db:Ocsi_sql.db_t ->
  ?have_rights:bool ->
  (content_type:'res Wiki_types.content_type ->
   wiki:Wiki_types.wiki ->
   author:User_sql.Types.userid ->
   comment:string -> content:string -> unit -> Wiki_types.wikibox Lwt.t)
  rights
val save_wikitextbox : 
  old_version:int32 ->
  (content_type:'res Wiki_types.content_type ->
   wb:Wiki_types.wikibox -> content:string option -> int32 Lwt.t)
  rights

The next three functions save a wikibox and returns the new version id of this wikibox. For the css related functions, we check that the argument is indeed a proper css

val save_wikicssbox : 
  old_version:int32 ->
  (wiki:Wiki_types.wiki ->
   content:string option -> wb:Wiki_types.wikibox -> int32 Lwt.t)
  rights
val save_wikipagecssbox : 
  old_version:int32 ->
  (wiki:Wiki_types.wiki ->
   page:string ->
   content:string option -> wb:Wiki_types.wikibox -> int32 Lwt.t)
  rights
val set_wikibox_special_rights : 
  (wb:Wiki_types.wikibox -> special_rights:bool -> unit Lwt.t)
  rights
val create_wikipage : 
  (wiki:Wiki_types.wiki -> page:string -> unit Lwt.t) rights
val add_css : 
  (wiki:Wiki_types.wiki ->
   page:string option ->
   media:Wiki_types.media_type ->
   ?wbcss:Wiki_types.wikibox -> unit -> Wiki_types.wikibox Lwt.t)
  rights
val delete_css : 
  (wiki:Wiki_types.wiki ->
   page:string option -> wb:Wiki_types.wikibox -> unit Lwt.t)
  rights
val update_css : 
  (wiki:Wiki_types.wiki ->
   page:string option ->
   oldwb:Wiki_types.wikibox ->
   newwb:Wiki_types.wikibox ->
   media:Wiki_types.media_type -> rank:int32 -> unit Lwt.t)
  rights
exception Unknown_box of Wiki_types.wikibox * int32 option

Raised in case of a non-existing wikibox. The optional int32 argument is the version number

val wikibox_content : 
  (?version:int32 ->
   Wiki_types.wikibox -> 'res Wiki_types.wikibox_content Lwt.t)
  rights

Returns the content of the wikibox if the user has enough rights, possibly for the given revision

val wikibox_content' : 
  (?version:int32 -> Wiki_types.wikibox -> (string option * int32) Lwt.t)
  rights
val wikibox_history : 
  (wb:Wiki_types.wikibox ->
   < author : < get : unit; nul : Sql.non_nullable; t : Sql.int32_t >
   Sql.t;
   comment : < get : unit; nul : Sql.non_nullable; t : Sql.string_t >
   Sql.t;
   datetime : < get : unit; nul : Sql.non_nullable;
   t : Sql.timestamp_t >
   Sql.t;
   version : < get : unit; nul : Sql.non_nullable; t : Sql.int32_t >
   Sql.t >
   list Lwt.t)
  rights
val wiki_css_boxes_with_content : 
  (wiki:Wiki_types.wiki ->
   (Wiki_types.wikibox * int32) list ->
   (Wiki_types.wikibox * string) list Lwt.t)
  rights

Returns the css for the specified wiki or the wikipage. The CSS are filtered for the ones the user can read

val wikipage_css_boxes_with_content : 
  (wiki:Wiki_types.wiki ->
   page:string ->
   (Wiki_types.wikibox * int32) list ->
   (Wiki_types.wikibox * string) list Lwt.t)
  rights

Same thing for a wikipage

val update_wiki : 
  (?container:Wiki_types.wikibox option ->
   ?staticdir:string option ->
   ?path:string option ->
   ?descr:string ->
   ?boxrights:bool ->
   ?model:Wiki_types.wiki_model ->
   ?siteid:string option -> Wiki_types.wiki -> unit Lwt.t)
  rights

Same as Wiki_sql.update_wiki, except that this function fails with Permission_denied if the user has not enough rights to edit a wiki

val save_wikipage_properties : 
  (?title:string ->
   ?wb:Wiki_types.wikibox option ->
   ?newpage:string -> Wiki_types.wikipage -> unit Lwt.t)
  rights