mk_corpus_page.ml 1.82 KB
Newer Older
Idir Lankri's avatar
Idir Lankri committed
1
(**************************************************************************)
2
(*                                                                        *)
Idir Lankri's avatar
Idir Lankri committed
3 4 5 6 7 8 9
(*                     The Sanskrit Heritage Platform                     *)
(*                                                                        *)
(*                              Idir Lankri                               *)
(*                                                                        *)
(* ©2017 Institut National de Recherche en Informatique et en Automatique *)
(**************************************************************************)

10 11
(* This program produces the pages corpus.html (Corpus interface).  *)

12 13 14
open Html;
open Web;

15 16
value permission_selection =
  let selection permissions =
Gérard Huet's avatar
Gérard Huet committed
17 18
      List.map select permissions 
      where select permission =
19
        let permission_str = Web_corpus.string_of_permission permission in
20
        (String.capitalize_ascii permission_str, permission_str, 
Gérard Huet's avatar
Gérard Huet committed
21
         permission = Web_corpus.Reader) in
22 23 24 25
  let read_only_permissions = [ Web_corpus.Reader ] in
  let other_permissions = Web_corpus.[ Annotator; Manager ] in
  let all_permissions = read_only_permissions @ other_permissions in
  selection (if corpus_read_only then read_only_permissions else all_permissions)
26
;
27
value make lang =
Gérard Huet's avatar
Gérard Huet committed
28
  let title_str = "Sanskrit Corpus" in do
29 30 31 32 33
  { open_html_file (corpus_page lang) (title title_str)
  ; body_begin Chamois_back |> pl
  ; open_page_with_margin 15
  ; h1_title title_str |> print_title (Some lang)
  ; center_begin |> pl
34
  ; cgi_begin corpus_manager_cgi "" ^
35 36
    "Capacity: " ^
    option_select_default Params.corpus_permission permission_selection ^ " " ^
37 38
    submit_input "OK" ^
    cgi_end |> pl
39 40 41
  ; center_end |> pl
  ; close_page_with_margin ()
  ; close_html_file lang True
42 43
  }
;
Gérard Huet's avatar
Gérard Huet committed
44
value main = do
45 46
  { make English
  ; make French
47 48
  }
;