Mark dangerous buttons with CSS (#3363)

pull/3368/head
Badlop 2 years ago
parent 65260e2449
commit 864188ad65
  1. 8
      include/ejabberd_web_admin.hrl
  2. 8
      priv/css/admin.css
  3. 4
      src/ejabberd_web_admin.erl
  4. 19
      src/mod_offline.erl
  5. 12
      src/mod_roster.erl
  6. 2
      src/mod_shared_roster.erl

@ -65,6 +65,14 @@
-define(INPUTT(Type, Name, Value),
?INPUT(Type, Name, (translate:translate(Lang, Value)))).
-define(INPUTD(Type, Name, Value),
?XA(<<"input">>,
[{<<"type">>, Type}, {<<"name">>, Name},
{<<"class">>, <<"btn-danger">>}, {<<"value">>, Value}])).
-define(INPUTTD(Type, Name, Value),
?INPUTD(Type, Name, (translate:translate(Lang, Value)))).
-define(INPUTS(Type, Name, Value, Size),
?XA(<<"input">>,
[{<<"type">>, Type}, {<<"name">>, Name},

@ -276,3 +276,11 @@ p.result {
*.alignright {
text-align: right;
}
.btn-danger:hover {
color: #fff;
background-color: #cb2431;
}
.btn-danger {
color: #cb2431;
transition: none;
}

@ -949,7 +949,7 @@ user_info(User, Server, Query, Lang) ->
[?C(LastActivity)] ++
UserItems ++
[?P,
?INPUTT(<<"submit">>, <<"removeuser">>,
?INPUTTD(<<"submit">>, <<"removeuser">>,
?T("Remove User"))]))].
user_parse_query(User, Server, Query) ->
@ -1105,7 +1105,7 @@ get_node(global, Node, [], Query, Lang) ->
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
[?INPUTT(<<"submit">>, <<"restart">>, ?T("Restart")),
?C(<<" ">>),
?INPUTT(<<"submit">>, <<"stop">>, ?T("Stop"))])];
?INPUTTD(<<"submit">>, <<"stop">>, ?T("Stop"))])];
get_node(Host, Node, [], _Query, Lang) ->
Base = get_base_path(Host, Node, 4),
MenuItems2 = make_menu_items(Host, Node, Base, Lang),

@ -1008,7 +1008,7 @@ user_queue(User, Server, Query, Lang) ->
true -> FMsgs
end)]),
?BR,
?INPUTT(<<"submit">>, <<"delete">>,
?INPUTTD(<<"submit">>, <<"delete">>,
?T("Delete Selected"))])].
user_queue_parse_query(LUser, LServer, Query) ->
@ -1070,14 +1070,17 @@ get_messages_subset2(Max, Length, MsgsAll) ->
webadmin_user(Acc, User, Server, Lang) ->
QueueLen = count_offline_messages(jid:nodeprep(User),
jid:nameprep(Server)),
FQueueLen = [?AC(<<"queue/">>,
(integer_to_binary(QueueLen)))],
FQueueLen = ?C(integer_to_binary(QueueLen)),
FQueueView = ?AC(<<"queue/">>,
?T("View Queue")),
Acc ++
[?XCT(<<"h3">>, ?T("Offline Messages:"))] ++
FQueueLen ++
[?C(<<" ">>),
?INPUTT(<<"submit">>, <<"removealloffline">>,
?T("Remove All Offline Messages"))].
[?XCT(<<"h3">>, ?T("Offline Messages:")),
FQueueLen,
?C(<<" | ">>),
FQueueView,
?C(<<" | ">>),
?INPUTTD(<<"submit">>, <<"removealloffline">>,
?T("Remove All Offline Messages"))].
-spec delete_all_msgs(binary(), binary()) -> {atomic, any()}.
delete_all_msgs(User, Server) ->

@ -997,7 +997,7 @@ user_roster(User, Server, Query, Lang) ->
?XAE(<<"td">>,
[{<<"class">>,
<<"valign">>}],
[?INPUTT(<<"submit">>,
[?INPUTTD(<<"submit">>,
<<"remove",
(ejabberd_web_admin:term_to_id(R#roster.jid))/binary>>,
?T("Remove"))])])
@ -1117,9 +1117,15 @@ user_roster_item_parse_query(User, Server, Items,
us_to_list({User, Server}) ->
jid:encode({User, Server, <<"">>}).
webadmin_user(Acc, _User, _Server, Lang) ->
webadmin_user(Acc, User, Server, Lang) ->
QueueLen = length(get_roster(jid:nodeprep(User), jid:nameprep(Server))),
FQueueLen = ?C(integer_to_binary(QueueLen)),
FQueueView = ?AC(<<"roster/">>, ?T("View Roster")),
Acc ++
[?XE(<<"h3">>, [?ACT(<<"roster/">>, ?T("Roster"))])].
[?XCT(<<"h3">>, ?T("Roster:")),
FQueueLen,
?C(<<" | ">>),
FQueueView].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec has_duplicated_groups([binary()]) -> boolean().

@ -935,7 +935,7 @@ list_shared_roster_groups(Host, Query, Lang) ->
[?XAE(<<"form">>,
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
[FGroups, ?BR,
?INPUTT(<<"submit">>, <<"delete">>,
?INPUTTD(<<"submit">>, <<"delete">>,
?T("Delete Selected"))])].
list_sr_groups_parse_query(Host, Query) ->

Loading…
Cancel
Save