25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Mark dangerous buttons with CSS (#3363)

This commit is contained in:
Badlop 2020-08-24 13:38:51 +02:00
parent 65260e2449
commit 864188ad65
6 changed files with 39 additions and 14 deletions

View File

@ -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},

View File

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

View File

@ -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),

View File

@ -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,13 +1070,16 @@ 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">>,
[?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()}.

View File

@ -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().

View File

@ -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) ->