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), -define(INPUTT(Type, Name, Value),
?INPUT(Type, Name, (translate:translate(Lang, 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), -define(INPUTS(Type, Name, Value, Size),
?XA(<<"input">>, ?XA(<<"input">>,
[{<<"type">>, Type}, {<<"name">>, Name}, [{<<"type">>, Type}, {<<"name">>, Name},

View File

@ -276,3 +276,11 @@ p.result {
*.alignright { *.alignright {
text-align: right; 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)] ++ [?C(LastActivity)] ++
UserItems ++ UserItems ++
[?P, [?P,
?INPUTT(<<"submit">>, <<"removeuser">>, ?INPUTTD(<<"submit">>, <<"removeuser">>,
?T("Remove User"))]))]. ?T("Remove User"))]))].
user_parse_query(User, Server, Query) -> user_parse_query(User, Server, Query) ->
@ -1105,7 +1105,7 @@ get_node(global, Node, [], Query, Lang) ->
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}], [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
[?INPUTT(<<"submit">>, <<"restart">>, ?T("Restart")), [?INPUTT(<<"submit">>, <<"restart">>, ?T("Restart")),
?C(<<" ">>), ?C(<<" ">>),
?INPUTT(<<"submit">>, <<"stop">>, ?T("Stop"))])]; ?INPUTTD(<<"submit">>, <<"stop">>, ?T("Stop"))])];
get_node(Host, Node, [], _Query, Lang) -> get_node(Host, Node, [], _Query, Lang) ->
Base = get_base_path(Host, Node, 4), Base = get_base_path(Host, Node, 4),
MenuItems2 = make_menu_items(Host, Node, Base, Lang), MenuItems2 = make_menu_items(Host, Node, Base, Lang),

View File

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

View File

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

View File

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