Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 977ee55e authored by Stephane Glondu's avatar Stephane Glondu

Cosmetic changes on election_admin page

parent f539ab6f
...@@ -64,7 +64,8 @@ let election_setup_auth_genpwd = post_coservice ~fallback:election_setup ~post_p ...@@ -64,7 +64,8 @@ let election_setup_auth_genpwd = post_coservice ~fallback:election_setup ~post_p
let election_home = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "")) () let election_home = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "")) ()
let election_admin = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "admin")) () let election_admin = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "admin")) ()
let election_login = service ~path:["elections"] ~get_params:(suffix_prod (uuid "uuid" ** suffix_const "login") (opt (string "service"))) () let election_login = service ~path:["elections"] ~get_params:(suffix_prod (uuid "uuid" ** suffix_const "login") (opt (string "service"))) ()
let election_set_state = post_coservice ~fallback:election_admin ~post_params:(bool "state") () let election_open = post_coservice ~fallback:election_admin ~post_params:unit ()
let election_close = post_coservice ~fallback:election_admin ~post_params:unit ()
let election_update_credential = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "update-cred")) () let election_update_credential = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "update-cred")) ()
let election_update_credential_post = post_service ~fallback:election_update_credential ~post_params:(string "old_credential" ** string "new_credential") () let election_update_credential_post = post_service ~fallback:election_update_credential ~post_params:(string "old_credential" ** string "new_credential") ()
let election_vote = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "vote")) () let election_vote = service ~path:["elections"] ~get_params:(suffix (uuid "uuid" ** suffix_const "vote")) ()
......
...@@ -970,10 +970,7 @@ let () = ...@@ -970,10 +970,7 @@ let () =
| _ -> forbidden () | _ -> forbidden ()
) )
let () = let election_set_state state (uuid, ()) () =
Any.register
~service:election_set_state
(fun (uuid, ()) state ->
let uuid_s = Uuidm.to_string uuid in let uuid_s = Uuidm.to_string uuid in
let w = SMap.find uuid_s !election_table in let w = SMap.find uuid_s !election_table in
let module W = (val w : WEB_ELECTION) in let module W = (val w : WEB_ELECTION) in
...@@ -989,7 +986,10 @@ let () = ...@@ -989,7 +986,10 @@ let () =
in in
let state = if state then `Open else `Closed in let state = if state then `Open else `Closed in
Web_persist.set_election_state uuid_s state >> Web_persist.set_election_state uuid_s state >>
Redirection.send (preapply election_admin (uuid, ()))) Redirection.send (preapply election_admin (uuid, ()))
let () = Any.register ~service:election_open (election_set_state true)
let () = Any.register ~service:election_close (election_set_state false)
let () = let () =
Any.register Any.register
......
...@@ -889,13 +889,20 @@ let election_admin w ~is_featured state () = ...@@ -889,13 +889,20 @@ let election_admin w ~is_featured state () =
let title = W.election.e_params.e_name ^ " — Administration" in let title = W.election.e_params.e_name ^ " — Administration" in
let uuid_s = Uuidm.to_string W.election.e_params.e_uuid in let uuid_s = Uuidm.to_string W.election.e_params.e_uuid in
let state_form checked = let state_form checked =
let service, value, msg =
if checked then
election_close, "Close election",
"The election is open. Voters can vote. "
else
election_open, "Open election",
"The election is closed. No one can vote. "
in
post_form post_form
~service:election_set_state ~service
(fun name -> (fun () ->
[ [
bool_checkbox ~name ~checked (); pcdata msg;
pcdata "Open this election "; string_input ~input_type:`Submit ~value ();
string_input ~input_type:`Submit ~value:"Apply" ();
]) (W.election.e_params.e_uuid, ()) ]) (W.election.e_params.e_uuid, ())
in in
lwt state_div = lwt state_div =
...@@ -912,8 +919,9 @@ let election_admin w ~is_featured state () = ...@@ -912,8 +919,9 @@ let election_admin w ~is_featured state () =
(fun () -> (fun () ->
[string_input [string_input
~input_type:`Submit ~input_type:`Submit
~value:"Compute encrypted tally" ~value:"Tally the election"
() ();
pcdata " (Warning, this action is irreversible.)";
]) (W.election.e_params.e_uuid, ()); ]) (W.election.e_params.e_uuid, ());
] ]
| `EncryptedTally (npks, _, hash) -> | `EncryptedTally (npks, _, hash) ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment