mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-02 16:37:52 +01:00
Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro. The macro itself is defined in include/translate.hrl. Example: -module(foo). -export([bar/1]). -include("translate.hrl"). bar(Lang) -> translate:translate(Lang, ?T("baz")).
This commit is contained in:
parent
2d158671c8
commit
00f2a736eb
@ -37,14 +37,12 @@
|
||||
-define(XAC(Name, Attrs, Text),
|
||||
?XAE(Name, Attrs, [?C(Text)])).
|
||||
|
||||
-define(T(Text), translate:translate(Lang, Text)).
|
||||
-define(CT(Text), ?C((translate:translate(Lang, Text)))).
|
||||
|
||||
-define(CT(Text), ?C((?T(Text)))).
|
||||
|
||||
-define(XCT(Name, Text), ?XC(Name, (?T(Text)))).
|
||||
-define(XCT(Name, Text), ?XC(Name, (translate:translate(Lang, Text)))).
|
||||
|
||||
-define(XACT(Name, Attrs, Text),
|
||||
?XAC(Name, Attrs, (?T(Text)))).
|
||||
?XAC(Name, Attrs, (translate:translate(Lang, Text)))).
|
||||
|
||||
-define(LI(Els), ?XE(<<"li">>, Els)).
|
||||
|
||||
@ -53,7 +51,7 @@
|
||||
|
||||
-define(AC(URL, Text), ?A(URL, [?C(Text)])).
|
||||
|
||||
-define(ACT(URL, Text), ?AC(URL, (?T(Text)))).
|
||||
-define(ACT(URL, Text), ?AC(URL, (translate:translate(Lang, Text)))).
|
||||
|
||||
-define(P, ?X(<<"p">>)).
|
||||
|
||||
@ -65,7 +63,7 @@
|
||||
{<<"value">>, Value}])).
|
||||
|
||||
-define(INPUTT(Type, Name, Value),
|
||||
?INPUT(Type, Name, (?T(Value)))).
|
||||
?INPUT(Type, Name, (translate:translate(Lang, Value)))).
|
||||
|
||||
-define(INPUTS(Type, Name, Value, Size),
|
||||
?XA(<<"input">>,
|
||||
@ -73,7 +71,7 @@
|
||||
{<<"value">>, Value}, {<<"size">>, Size}])).
|
||||
|
||||
-define(INPUTST(Type, Name, Value, Size),
|
||||
?INPUT(Type, Name, (?T(Value)), Size)).
|
||||
?INPUT(Type, Name, (translate:translate(Lang, Value)), Size)).
|
||||
|
||||
-define(ACLINPUT(Text),
|
||||
?XE(<<"td">>,
|
||||
@ -90,7 +88,7 @@
|
||||
?XAC(<<"p">>, [{<<"class">>, <<"result">>}], Text)).
|
||||
|
||||
%% Guide Link
|
||||
-define(XREST(Text), ?XRES((?T(Text)))).
|
||||
-define(XREST(Text), ?XRES((translate:translate(Lang, Text)))).
|
||||
|
||||
-define(GL(Ref, Title),
|
||||
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
|
||||
|
@ -52,6 +52,7 @@
|
||||
-include("xmpp.hrl").
|
||||
-include("logger.hrl").
|
||||
-include("mod_roster.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-define(SETS, gb_sets).
|
||||
|
||||
@ -431,7 +432,7 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
|
||||
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
|
||||
?WARNING_MSG("(~s) Forbidden c2s session for ~s",
|
||||
[xmpp_socket:pp(Socket), jid:encode(JID)]),
|
||||
Txt = <<"Access denied by service policy">>,
|
||||
Txt = ?T("Access denied by service policy"),
|
||||
{error, xmpp:err_not_allowed(Txt, Lang), State}
|
||||
end
|
||||
end.
|
||||
@ -670,7 +671,7 @@ process_presence_out(#{lserver := LServer, jid := JID,
|
||||
MyBareJID = jid:remove_resource(JID),
|
||||
case acl:match_rule(LServer, Access, MyBareJID) of
|
||||
deny ->
|
||||
AccessErrTxt = <<"Access denied by service policy">>,
|
||||
AccessErrTxt = ?T("Access denied by service policy"),
|
||||
AccessErr = xmpp:err_forbidden(AccessErrTxt, Lang),
|
||||
send_error(State0, Pres, AccessErr);
|
||||
allow ->
|
||||
@ -682,8 +683,8 @@ process_presence_out(#{lserver := LServer, jid := JID,
|
||||
end,
|
||||
case privacy_check_packet(State1, Pres, out) of
|
||||
deny ->
|
||||
PrivErrTxt = <<"Your active privacy list has denied "
|
||||
"the routing of this stanza.">>,
|
||||
PrivErrTxt = ?T("Your active privacy list has denied "
|
||||
"the routing of this stanza."),
|
||||
PrivErr = xmpp:err_not_acceptable(PrivErrTxt, Lang),
|
||||
send_error(State1, Pres, PrivErr);
|
||||
allow when Type == subscribe; Type == subscribed;
|
||||
@ -827,8 +828,8 @@ broadcast_presence_available(#{jid := JID} = State,
|
||||
check_privacy_then_route(#{lang := Lang} = State, Pkt) ->
|
||||
case privacy_check_packet(State, Pkt, out) of
|
||||
deny ->
|
||||
ErrText = <<"Your active privacy list has denied "
|
||||
"the routing of this stanza.">>,
|
||||
ErrText = ?T("Your active privacy list has denied "
|
||||
"the routing of this stanza."),
|
||||
Err = xmpp:err_not_acceptable(ErrText, Lang),
|
||||
send_error(State, Pkt, Err);
|
||||
allow ->
|
||||
|
@ -45,6 +45,7 @@
|
||||
-include("xmpp.hrl").
|
||||
-include("logger.hrl").
|
||||
-include("ejabberd_http.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-define(CAPTCHA_LIFETIME, 120000).
|
||||
-define(LIMIT_PERIOD, 60*1000*1000).
|
||||
@ -67,7 +68,7 @@ start_link() ->
|
||||
|
||||
-spec captcha_text(binary()) -> binary().
|
||||
captcha_text(Lang) ->
|
||||
translate:translate(Lang, <<"Enter the text you see">>).
|
||||
translate:translate(Lang, ?T("Enter the text you see")).
|
||||
|
||||
-spec mk_ocr_field(binary(), binary(), binary()) -> xdata_field().
|
||||
mk_ocr_field(Lang, CID, Type) ->
|
||||
@ -100,8 +101,8 @@ create_captcha(SID, From, To, Lang, Limiter, Args) ->
|
||||
mk_ocr_field(Lang, CID, Type)],
|
||||
X = #xdata{type = form, fields = Fs},
|
||||
Captcha = #xcaptcha{xdata = X},
|
||||
BodyString = {<<"Your subscription request and/or messages to ~s have been blocked. "
|
||||
"To unblock your subscription request, visit ~s">>, [JID, get_url(Id)]},
|
||||
BodyString = {?T("Your subscription request and/or messages to ~s have been blocked. "
|
||||
"To unblock your subscription request, visit ~s"), [JID, get_url(Id)]},
|
||||
Body = xmpp:mk_text(BodyString, Lang),
|
||||
OOB = #oob_x{url = get_url(Id)},
|
||||
Hint = #hint{type = 'no-store'},
|
||||
@ -123,8 +124,8 @@ create_captcha_x(SID, To, Lang, Limiter, #xdata{fields = Fs} = X) ->
|
||||
CID = <<"sha1+", (str:sha(Image))/binary, "@bob.xmpp.org">>,
|
||||
Data = #bob_data{cid = CID, 'max-age' = 0, type = Type, data = Image},
|
||||
HelpTxt = translate:translate(Lang,
|
||||
<<"If you don't see the CAPTCHA image here, "
|
||||
"visit the web page.">>),
|
||||
?T("If you don't see the CAPTCHA image here, "
|
||||
"visit the web page.")),
|
||||
Imageurl = get_url(<<Id/binary, "/image">>),
|
||||
NewFs = [mk_field(hidden, <<"FORM_TYPE">>, ?NS_CAPTCHA)|Fs] ++
|
||||
[#xdata_field{type = fixed, var = <<"captcha-fallback-text">>, values = [HelpTxt]},
|
||||
@ -132,7 +133,7 @@ create_captcha_x(SID, To, Lang, Limiter, #xdata{fields = Fs} = X) ->
|
||||
values = [<<"workaround-for-psi">>]},
|
||||
#xdata_field{type = 'text-single', var = <<"captcha-fallback-url">>,
|
||||
label = translate:translate(
|
||||
Lang, <<"CAPTCHA web page">>),
|
||||
Lang, ?T("CAPTCHA web page")),
|
||||
values = [Imageurl]},
|
||||
mk_field(hidden, <<"from">>, jid:encode(To)),
|
||||
mk_field(hidden, <<"challenge">>, Id),
|
||||
@ -189,7 +190,7 @@ build_captcha_html(Id, Lang) ->
|
||||
attrs =
|
||||
[{<<"type">>, <<"submit">>},
|
||||
{<<"name">>, <<"enter">>},
|
||||
{<<"value">>, <<"OK">>}],
|
||||
{<<"value">>, ?T("OK")}],
|
||||
children = []}]},
|
||||
{FormEl, {ImgEl, Text, IdEl, KeyEl}};
|
||||
_ -> captcha_not_found
|
||||
@ -220,17 +221,17 @@ process_iq(#iq{type = set, lang = Lang, sub_els = [#xcaptcha{} = El]} = IQ) ->
|
||||
ok ->
|
||||
xmpp:make_iq_result(IQ);
|
||||
{error, malformed} ->
|
||||
Txt = <<"Incorrect CAPTCHA submit">>,
|
||||
Txt = ?T("Incorrect CAPTCHA submit"),
|
||||
xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang));
|
||||
{error, _} ->
|
||||
Txt = <<"The CAPTCHA verification has failed">>,
|
||||
Txt = ?T("The CAPTCHA verification has failed"),
|
||||
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang))
|
||||
end;
|
||||
process_iq(#iq{type = get, lang = Lang} = IQ) ->
|
||||
Txt = <<"Value 'get' of 'type' attribute is not allowed">>,
|
||||
Txt = ?T("Value 'get' of 'type' attribute is not allowed"),
|
||||
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
||||
process_iq(#iq{lang = Lang} = IQ) ->
|
||||
Txt = <<"No module is handling this query">>,
|
||||
Txt = ?T("No module is handling this query"),
|
||||
xmpp:make_error(IQ, xmpp:err_service_unavailable(Txt, Lang)).
|
||||
|
||||
process(_Handlers,
|
||||
@ -272,7 +273,7 @@ process(_Handlers,
|
||||
children =
|
||||
[{xmlcdata,
|
||||
translate:translate(Lang,
|
||||
<<"The CAPTCHA is valid.">>)}]},
|
||||
?T("The CAPTCHA is valid."))}]},
|
||||
ejabberd_web:make_xhtml([Form]);
|
||||
captcha_non_valid -> ejabberd_web:error(not_allowed);
|
||||
captcha_not_found -> ejabberd_web:error(not_found)
|
||||
|
@ -49,6 +49,7 @@
|
||||
-include_lib("stdlib/include/ms_transform.hrl").
|
||||
-include("xmpp.hrl").
|
||||
-include("ejabberd_stacktrace.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
@ -91,7 +92,7 @@ bounce_resource_packet(#message{to = #jid{lresource = <<"">>}, type = headline})
|
||||
ok;
|
||||
bounce_resource_packet(Packet) ->
|
||||
Lang = xmpp:get_lang(Packet),
|
||||
Txt = <<"No available resource found">>,
|
||||
Txt = ?T("No available resource found"),
|
||||
Err = xmpp:err_item_not_found(Txt, Lang),
|
||||
ejabberd_router:route_error(Packet, Err),
|
||||
stop.
|
||||
|
@ -51,14 +51,12 @@
|
||||
oauth_issue_token/3, oauth_list_tokens/0, oauth_revoke_token/1]).
|
||||
|
||||
-include("xmpp.hrl").
|
||||
|
||||
-include("logger.hrl").
|
||||
|
||||
-include("ejabberd_http.hrl").
|
||||
-include("ejabberd_web_admin.hrl").
|
||||
-include("ejabberd_oauth.hrl").
|
||||
|
||||
-include("ejabberd_commands.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-callback init() -> any().
|
||||
-callback store(#oauth_token{}) -> ok | {error, any()}.
|
||||
@ -393,10 +391,10 @@ process(_Handlers,
|
||||
?XAE(<<"form">>,
|
||||
[{<<"action">>, <<"authorization_token">>},
|
||||
{<<"method">>, <<"post">>}],
|
||||
[?LABEL(<<"username">>, [?CT(<<"User (jid)">>), ?C(<<": ">>)]),
|
||||
[?LABEL(<<"username">>, [?CT(?T("User (jid)")), ?C(<<": ">>)]),
|
||||
?INPUTID(<<"text">>, <<"username">>, <<"">>),
|
||||
?BR,
|
||||
?LABEL(<<"password">>, [?CT(<<"Password">>), ?C(<<": ">>)]),
|
||||
?LABEL(<<"password">>, [?CT(?T("Password")), ?C(<<": ">>)]),
|
||||
?INPUTID(<<"password">>, <<"password">>, <<"">>),
|
||||
?INPUT(<<"hidden">>, <<"response_type">>, ResponseType),
|
||||
?INPUT(<<"hidden">>, <<"client_id">>, ClientId),
|
||||
@ -404,7 +402,7 @@ process(_Handlers,
|
||||
?INPUT(<<"hidden">>, <<"scope">>, Scope),
|
||||
?INPUT(<<"hidden">>, <<"state">>, State),
|
||||
?BR,
|
||||
?LABEL(<<"ttl">>, [?CT(<<"Token TTL">>), ?C(<<": ">>)]),
|
||||
?LABEL(<<"ttl">>, [?CT(?T("Token TTL")), ?C(<<": ">>)]),
|
||||
?XAE(<<"select">>, [{<<"name">>, <<"ttl">>}],
|
||||
[
|
||||
?XAC(<<"option">>, [{<<"value">>, <<"3600">>}],<<"1 Hour">>),
|
||||
@ -413,7 +411,7 @@ process(_Handlers,
|
||||
?XAC(<<"option">>, [{<<"selected">>, <<"selected">>},{<<"value">>, <<"31536000">>}],<<"1 Year">>),
|
||||
?XAC(<<"option">>, [{<<"value">>, <<"315360000">>}],<<"10 Years">>)]),
|
||||
?BR,
|
||||
?INPUTT(<<"submit">>, <<"">>, <<"Accept">>)
|
||||
?INPUTT(<<"submit">>, <<"">>, ?T("Accept"))
|
||||
]),
|
||||
Top =
|
||||
?DIV(<<"section">>,
|
||||
|
@ -56,6 +56,7 @@
|
||||
-include("ejabberd_commands.hrl").
|
||||
-include_lib("public_key/include/public_key.hrl").
|
||||
-include("ejabberd_stacktrace.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-define(PKIXEXPLICIT, 'OTP-PUB-KEY').
|
||||
|
||||
@ -361,10 +362,10 @@ do_route(Packet) ->
|
||||
Err = case Reason of
|
||||
policy_violation ->
|
||||
xmpp:err_policy_violation(
|
||||
<<"Server connections to local "
|
||||
"subdomains are forbidden">>, Lang);
|
||||
?T("Server connections to local "
|
||||
"subdomains are forbidden"), Lang);
|
||||
forbidden ->
|
||||
xmpp:err_forbidden(<<"Access denied by service policy">>, Lang);
|
||||
xmpp:err_forbidden(?T("Access denied by service policy"), Lang);
|
||||
internal_server_error ->
|
||||
xmpp:err_internal_server_error()
|
||||
end,
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
-include("xmpp.hrl").
|
||||
-include("logger.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-type state() :: xmpp_stream_out:state().
|
||||
-export_type([state/0]).
|
||||
@ -251,7 +252,7 @@ handle_timeout(#{on_route := Action, lang := Lang} = State) ->
|
||||
case Action of
|
||||
bounce -> stop(State);
|
||||
_ ->
|
||||
Txt = <<"Idle connection">>,
|
||||
Txt = ?T("Idle connection"),
|
||||
send(State, xmpp:serr_connection_timeout(Txt, Lang))
|
||||
end.
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
-include("xmpp.hrl").
|
||||
-include("logger.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-type state() :: xmpp_stream_in:state().
|
||||
-export_type([state/0]).
|
||||
@ -119,7 +120,7 @@ handle_stream_start(_StreamStart,
|
||||
host_opts := HostOpts} = State) ->
|
||||
case ejabberd_router:is_my_host(RemoteServer) of
|
||||
true ->
|
||||
Txt = <<"Unable to register route on existing local domain">>,
|
||||
Txt = ?T("Unable to register route on existing local domain"),
|
||||
xmpp_stream_in:send(State, xmpp:serr_conflict(Txt, Lang));
|
||||
false ->
|
||||
NewHostOpts = case dict:is_key(RemoteServer, HostOpts) of
|
||||
@ -198,7 +199,7 @@ handle_authenticated_packet(Pkt0, #{ip := {IP, _}, lang := Lang} = State)
|
||||
end,
|
||||
State2;
|
||||
false ->
|
||||
Txt = <<"Improper domain part of 'from' attribute">>,
|
||||
Txt = ?T("Improper domain part of 'from' attribute"),
|
||||
Err = xmpp:serr_invalid_from(Txt, Lang),
|
||||
xmpp_stream_in:send(State, Err)
|
||||
end;
|
||||
@ -211,7 +212,7 @@ handle_info({route, Packet}, #{access := Access} = State) ->
|
||||
xmpp_stream_in:send(State, Packet);
|
||||
deny ->
|
||||
Lang = xmpp:get_lang(Packet),
|
||||
Err = xmpp:err_not_allowed(<<"Access denied by service policy">>, Lang),
|
||||
Err = xmpp:err_not_allowed(?T("Access denied by service policy"), Lang),
|
||||
ejabberd_router:route_error(Packet, Err),
|
||||
State
|
||||
end;
|
||||
|
@ -84,12 +84,11 @@
|
||||
handle_info/2, terminate/2, code_change/3]).
|
||||
|
||||
-include("logger.hrl").
|
||||
|
||||
-include("xmpp.hrl").
|
||||
|
||||
-include("ejabberd_commands.hrl").
|
||||
-include("ejabberd_sm.hrl").
|
||||
-include("ejabberd_stacktrace.hrl").
|
||||
-include("translate.hrl").
|
||||
|
||||
-callback init() -> ok | {error, any()}.
|
||||
-callback set_session(#session{}) -> ok | {error, any()}.
|
||||
@ -200,7 +199,7 @@ bounce_offline_message(Acc) ->
|
||||
-spec bounce_sm_packet({bounce | term(), stanza()}) -> any().
|
||||
bounce_sm_packet({bounce, Packet} = Acc) ->
|
||||
Lang = xmpp:get_lang(Packet),
|
||||
Txt = <<"User session not found">>,
|
||||
Txt = ?T("User session not found"),
|
||||
Err = xmpp:err_service_unavailable(Txt, Lang),
|
||||
ejabberd_router:route_error(Packet, Err),
|
||||
{stop, Acc};
|
||||
@ -212,7 +211,7 @@ bounce_sm_packet({_, Packet} = Acc) ->
|
||||
-spec disconnect_removed_user(binary(), binary()) -> ok.
|
||||
|
||||
disconnect_removed_user(User, Server) ->
|
||||
route(jid:make(User, Server), {exit, <<"User removed">>}).
|
||||
route(jid:make(User, Server), {exit, ?T("User removed")}).
|
||||
|
||||
get_user_resources(User, Server) ->
|
||||
LUser = jid:nodeprep(User),
|
||||
@ -442,10 +441,10 @@ get_vh_session_number(Server) ->
|
||||
%% Why the hell do we have so many similar kicks?
|
||||
c2s_handle_info(#{lang := Lang} = State, replaced) ->
|
||||
State1 = State#{replaced => true},
|
||||
Err = xmpp:serr_conflict(<<"Replaced by new connection">>, Lang),
|
||||
Err = xmpp:serr_conflict(?T("Replaced by new connection"), Lang),
|
||||
{stop, ejabberd_c2s:send(State1, Err)};
|
||||
c2s_handle_info(#{lang := Lang} = State, kick) ->
|
||||
Err = xmpp:serr_policy_violation(<<"has been kicked">>, Lang),
|
||||
Err = xmpp:serr_policy_violation(?T("has been kicked"), Lang),
|
||||
c2s_handle_info(State, {kick, kicked_by_admin, Err});
|
||||
c2s_handle_info(State, {kick, _Reason, Err}) ->
|
||||
{stop, ejabberd_c2s:send(State, Err)};
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
-include("ejabberd_web_admin.hrl").
|
||||
|
||||
-include("translate.hrl").
|
||||
|
||||
-define(INPUTATTRS(Type, Name, Value, Attrs),
|
||||
?XA(<<"input">>,
|
||||
(Attrs ++
|
||||
@ -191,7 +193,7 @@ process([<<"server">>, SHost | RPath] = Path,
|
||||
[{<<"WWW-Authenticate">>,
|
||||
<<"basic realm=\"ejabberd\"">>}],
|
||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||
<<"Unauthorized">>)])};
|
||||
?T("Unauthorized"))])};
|
||||
{unauthorized, Error} ->
|
||||
{BadUser, _BadPass} = Auth,
|
||||
{IPT, _Port} = Request#request.ip,
|
||||
@ -203,7 +205,7 @@ process([<<"server">>, SHost | RPath] = Path,
|
||||
<<"basic realm=\"auth error, retry login "
|
||||
"to ejabberd\"">>}],
|
||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||
<<"Unauthorized">>)])}
|
||||
?T("Unauthorized"))])}
|
||||
end;
|
||||
false -> ejabberd_web:error(not_found)
|
||||
end;
|
||||
@ -223,7 +225,7 @@ process(RPath,
|
||||
[{<<"WWW-Authenticate">>,
|
||||
<<"basic realm=\"ejabberd\"">>}],
|
||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||
<<"Unauthorized">>)])};
|
||||
?T("Unauthorized"))])};
|
||||
{unauthorized, Error} ->
|
||||
{BadUser, _BadPass} = Auth,
|
||||
{IPT, _Port} = Request#request.ip,
|
||||
@ -235,7 +237,7 @@ process(RPath,
|
||||
<<"basic realm=\"auth error, retry login "
|
||||
"to ejabberd\"">>}],
|
||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||
<<"Unauthorized">>)])}
|
||||
?T("Unauthorized"))])}
|
||||
end.
|
||||
|
||||
get_auth_admin(Auth, HostHTTP, RPath, Method) ->
|
||||
@ -294,7 +296,7 @@ make_xhtml(Els, Host, Node, Lang, JID) ->
|
||||
children =
|
||||
[#xmlel{name = <<"head">>, attrs = [],
|
||||
children =
|
||||
[?XCT(<<"title">>, <<"ejabberd Web Admin">>),
|
||||
[?XCT(<<"title">>, ?T("ejabberd Web Admin")),
|
||||
#xmlel{name = <<"meta">>,
|
||||
attrs =
|
||||
[{<<"http-equiv">>, <<"Content-Type">>},
|
||||
@ -393,7 +395,7 @@ logo_fill() ->
|
||||
%%%% process_admin
|
||||
|
||||
process_admin(global, #request{path = [], lang = Lang}, AJID) ->
|
||||
make_xhtml((?H1GL((?T(<<"Administration">>)), <<"">>,
|
||||
make_xhtml((?H1GL((translate:translate(Lang, ?T("Administration"))), <<"">>,
|
||||
<<"Contents">>))
|
||||
++
|
||||
[?XE(<<"ul">>,
|
||||
@ -402,7 +404,7 @@ process_admin(global, #request{path = [], lang = Lang}, AJID) ->
|
||||
<- get_menu_items(global, cluster, Lang, AJID)])],
|
||||
global, Lang, AJID);
|
||||
process_admin(Host, #request{path = [], lang = Lang}, AJID) ->
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Administration">>),
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Administration")),
|
||||
?XE(<<"ul">>,
|
||||
[?LI([?ACT(MIU, MIN)])
|
||||
|| {MIU, MIN}
|
||||
@ -435,28 +437,28 @@ process_admin(_Host, #request{path = [<<"additions.js">>]}, _) ->
|
||||
additions_js()};
|
||||
process_admin(global, #request{path = [<<"vhosts">>], lang = Lang}, AJID) ->
|
||||
Res = list_vhosts(Lang, AJID),
|
||||
make_xhtml((?H1GL((?T(<<"Virtual Hosts">>)),
|
||||
<<"virtualhosting">>, <<"Virtual Hosting">>))
|
||||
make_xhtml((?H1GL((translate:translate(Lang, ?T("Virtual Hosts"))),
|
||||
<<"virtualhosting">>, ?T("Virtual Hosting")))
|
||||
++ Res,
|
||||
global, Lang, AJID);
|
||||
process_admin(Host, #request{path = [<<"users">>], q = Query,
|
||||
lang = Lang}, AJID)
|
||||
when is_binary(Host) ->
|
||||
Res = list_users(Host, Query, Lang, fun url_func/1),
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Users">>)] ++ Res, Host,
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Users"))] ++ Res, Host,
|
||||
Lang, AJID);
|
||||
process_admin(Host, #request{path = [<<"users">>, Diap],
|
||||
lang = Lang}, AJID)
|
||||
when is_binary(Host) ->
|
||||
Res = list_users_in_diapason(Host, Diap, Lang,
|
||||
fun url_func/1),
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Users">>)] ++ Res, Host,
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Users"))] ++ Res, Host,
|
||||
Lang, AJID);
|
||||
process_admin(Host, #request{path = [<<"online-users">>],
|
||||
lang = Lang}, AJID)
|
||||
when is_binary(Host) ->
|
||||
Res = list_online_users(Host, Lang),
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Online Users">>)] ++ Res,
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Online Users"))] ++ Res,
|
||||
Host, Lang, AJID);
|
||||
process_admin(Host, #request{path = [<<"last-activity">>],
|
||||
q = Query, lang = Lang}, AJID)
|
||||
@ -471,11 +473,11 @@ process_admin(Host, #request{path = [<<"last-activity">>],
|
||||
list_last_activity(Host, Lang, false, Month);
|
||||
_ -> list_last_activity(Host, Lang, true, Month)
|
||||
end,
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Users Last Activity">>)]
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Users Last Activity"))]
|
||||
++
|
||||
[?XAE(<<"form">>,
|
||||
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
|
||||
[?CT(<<"Period: ">>),
|
||||
[?CT(?T("Period: ")),
|
||||
?XAE(<<"select">>, [{<<"name">>, <<"period">>}],
|
||||
(lists:map(fun ({O, V}) ->
|
||||
Sel = if O == Month ->
|
||||
@ -488,21 +490,21 @@ process_admin(Host, #request{path = [<<"last-activity">>],
|
||||
[{<<"value">>, O}]),
|
||||
V)
|
||||
end,
|
||||
[{<<"month">>, ?T(<<"Last month">>)},
|
||||
{<<"year">>, ?T(<<"Last year">>)},
|
||||
[{<<"month">>, translate:translate(Lang, ?T("Last month"))},
|
||||
{<<"year">>, translate:translate(Lang, ?T("Last year"))},
|
||||
{<<"all">>,
|
||||
?T(<<"All activity">>)}]))),
|
||||
translate:translate(Lang, ?T("All activity"))}]))),
|
||||
?C(<<" ">>),
|
||||
?INPUTT(<<"submit">>, <<"ordinary">>,
|
||||
<<"Show Ordinary Table">>),
|
||||
?T("Show Ordinary Table")),
|
||||
?C(<<" ">>),
|
||||
?INPUTT(<<"submit">>, <<"integral">>,
|
||||
<<"Show Integral Table">>)])]
|
||||
?T("Show Integral Table"))])]
|
||||
++ Res,
|
||||
Host, Lang, AJID);
|
||||
process_admin(Host, #request{path = [<<"stats">>], lang = Lang}, AJID) ->
|
||||
Res = get_stats(Host, Lang),
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Statistics">>)] ++ Res,
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Statistics"))] ++ Res,
|
||||
Host, Lang, AJID);
|
||||
process_admin(Host, #request{path = [<<"user">>, U],
|
||||
q = Query, lang = Lang}, AJID) ->
|
||||
@ -511,7 +513,7 @@ process_admin(Host, #request{path = [<<"user">>, U],
|
||||
Res = user_info(U, Host, Query, Lang),
|
||||
make_xhtml(Res, Host, Lang, AJID);
|
||||
false ->
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Not Found">>)], Host,
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Not Found"))], Host,
|
||||
Lang, AJID)
|
||||
end;
|
||||
process_admin(Host, #request{path = [<<"nodes">>], lang = Lang}, AJID) ->
|
||||
@ -521,7 +523,7 @@ process_admin(Host, #request{path = [<<"node">>, SNode | NPath],
|
||||
q = Query, lang = Lang}, AJID) ->
|
||||
case search_running_node(SNode) of
|
||||
false ->
|
||||
make_xhtml([?XCT(<<"h1">>, <<"Node not found">>)], Host,
|
||||
make_xhtml([?XCT(<<"h1">>, ?T("Node not found"))], Host,
|
||||
Lang, AJID);
|
||||
Node ->
|
||||
Res = get_node(Host, Node, NPath, Query, Lang),
|
||||
@ -567,9 +569,9 @@ list_vhosts2(Lang, Hosts) ->
|
||||
[?XE(<<"table">>,
|
||||
[?XE(<<"thead">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Host">>),
|
||||
?XCT(<<"td">>, <<"Registered Users">>),
|
||||
?XCT(<<"td">>, <<"Online Users">>)])]),
|
||||
[?XCT(<<"td">>, ?T("Host")),
|
||||
?XCT(<<"td">>, ?T("Registered Users")),
|
||||
?XCT(<<"td">>, ?T("Online Users"))])]),
|
||||
?XE(<<"tbody">>,
|
||||
(lists:map(fun (Host) ->
|
||||
OnlineUsers =
|
||||
@ -623,8 +625,8 @@ list_users(Host, Query, Lang, URLFunc) ->
|
||||
end,
|
||||
case Res of
|
||||
%% Parse user creation query and try register:
|
||||
ok -> [?XREST(<<"Submitted">>)];
|
||||
error -> [?XREST(<<"Bad format">>)];
|
||||
ok -> [?XREST(?T("Submitted"))];
|
||||
error -> [?XREST(?T("Bad format"))];
|
||||
nothing -> []
|
||||
end
|
||||
++
|
||||
@ -632,12 +634,12 @@ list_users(Host, Query, Lang, URLFunc) ->
|
||||
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
|
||||
([?XE(<<"table">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XC(<<"td">>, <<(?T(<<"User">>))/binary, ":">>),
|
||||
[?XC(<<"td">>, <<(translate:translate(Lang, ?T("User")))/binary, ":">>),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>, <<"newusername">>, <<"">>)]),
|
||||
?XE(<<"td">>, [?C(<<" @ ", Host/binary>>)])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XC(<<"td">>, <<(?T(<<"Password">>))/binary, ":">>),
|
||||
[?XC(<<"td">>, <<(translate:translate(Lang, ?T("Password")))/binary, ":">>),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"password">>, <<"newuserpassword">>,
|
||||
<<"">>)]),
|
||||
@ -646,7 +648,7 @@ list_users(Host, Query, Lang, URLFunc) ->
|
||||
[?X(<<"td">>),
|
||||
?XAE(<<"td">>, [{<<"class">>, <<"alignright">>}],
|
||||
[?INPUTT(<<"submit">>, <<"addnewuser">>,
|
||||
<<"Add User">>)]),
|
||||
?T("Add User"))]),
|
||||
?X(<<"td">>)])]),
|
||||
?P]
|
||||
++ FUsers))].
|
||||
@ -688,9 +690,9 @@ list_given_users(Host, Users, Prefix, Lang, URLFunc) ->
|
||||
?XE(<<"table">>,
|
||||
[?XE(<<"thead">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"User">>),
|
||||
?XCT(<<"td">>, <<"Offline Messages">>),
|
||||
?XCT(<<"td">>, <<"Last Activity">>)])]),
|
||||
[?XCT(<<"td">>, ?T("User")),
|
||||
?XCT(<<"td">>, ?T("Offline Messages")),
|
||||
?XCT(<<"td">>, ?T("Last Activity"))])]),
|
||||
?XE(<<"tbody">>,
|
||||
(lists:map(fun (_SU = {Server, User}) ->
|
||||
US = {User, Server},
|
||||
@ -708,7 +710,7 @@ list_given_users(Host, Users, Prefix, Lang, URLFunc) ->
|
||||
case mod_last:get_last_info(User,
|
||||
Server)
|
||||
of
|
||||
not_found -> ?T(<<"Never">>);
|
||||
not_found -> translate:translate(Lang, ?T("Never"));
|
||||
{ok, Shift, _Status} ->
|
||||
TimeStamp = {Shift div
|
||||
1000000,
|
||||
@ -726,7 +728,7 @@ list_given_users(Host, Users, Prefix, Lang, URLFunc) ->
|
||||
Minute,
|
||||
Second]))
|
||||
end;
|
||||
_ -> ?T(<<"Online">>)
|
||||
_ -> translate:translate(Lang, ?T("Online"))
|
||||
end,
|
||||
?XE(<<"tr">>,
|
||||
[?XE(<<"td">>,
|
||||
@ -754,7 +756,7 @@ get_offlinemsg_module(Server) ->
|
||||
|
||||
get_lastactivity_menuitem_list(Server) ->
|
||||
case mod_last_opt:db_type(Server) of
|
||||
mnesia -> [{<<"last-activity">>, <<"Last Activity">>}];
|
||||
mnesia -> [{<<"last-activity">>, ?T("Last Activity")}];
|
||||
_ -> []
|
||||
end.
|
||||
|
||||
@ -779,16 +781,16 @@ get_stats(global, Lang) ->
|
||||
[?XAE(<<"table">>, [],
|
||||
[?XE(<<"tbody">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Registered Users:">>),
|
||||
[?XCT(<<"td">>, ?T("Registered Users:")),
|
||||
?XC(<<"td">>, (pretty_string_int(RegisteredUsers)))]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Online Users:">>),
|
||||
[?XCT(<<"td">>, ?T("Online Users:")),
|
||||
?XC(<<"td">>, (pretty_string_int(OnlineUsers)))]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Outgoing s2s Connections:">>),
|
||||
[?XCT(<<"td">>, ?T("Outgoing s2s Connections:")),
|
||||
?XC(<<"td">>, (pretty_string_int(OutS2SNumber)))]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Incoming s2s Connections:">>),
|
||||
[?XCT(<<"td">>, ?T("Incoming s2s Connections:")),
|
||||
?XC(<<"td">>, (pretty_string_int(InS2SNumber)))])])])];
|
||||
get_stats(Host, Lang) ->
|
||||
OnlineUsers =
|
||||
@ -798,10 +800,10 @@ get_stats(Host, Lang) ->
|
||||
[?XAE(<<"table">>, [],
|
||||
[?XE(<<"tbody">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Registered Users:">>),
|
||||
[?XCT(<<"td">>, ?T("Registered Users:")),
|
||||
?XC(<<"td">>, (pretty_string_int(RegisteredUsers)))]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Online Users:">>),
|
||||
[?XCT(<<"td">>, ?T("Online Users:")),
|
||||
?XC(<<"td">>, (pretty_string_int(OnlineUsers)))])])])].
|
||||
|
||||
list_online_users(Host, _Lang) ->
|
||||
@ -824,7 +826,7 @@ user_info(User, Server, Query, Lang) ->
|
||||
Server),
|
||||
FResources =
|
||||
case Resources of
|
||||
[] -> [?CT(<<"None">>)];
|
||||
[] -> [?CT(?T("None"))];
|
||||
_ ->
|
||||
[?XE(<<"ul">>,
|
||||
(lists:map(
|
||||
@ -881,7 +883,7 @@ user_info(User, Server, Query, Lang) ->
|
||||
FPassword = [?INPUT(<<"text">>, <<"password">>, <<"">>),
|
||||
?C(<<" ">>),
|
||||
?INPUTT(<<"submit">>, <<"chpassword">>,
|
||||
<<"Change Password">>)],
|
||||
?T("Change Password"))],
|
||||
UserItems = ejabberd_hooks:run_fold(webadmin_user,
|
||||
LServer, [], [User, Server, Lang]),
|
||||
LastActivity = case ejabberd_sm:get_user_resources(User,
|
||||
@ -889,7 +891,7 @@ user_info(User, Server, Query, Lang) ->
|
||||
of
|
||||
[] ->
|
||||
case mod_last:get_last_info(User, Server) of
|
||||
not_found -> ?T(<<"Never">>);
|
||||
not_found -> translate:translate(Lang, ?T("Never"));
|
||||
{ok, Shift, _Status} ->
|
||||
TimeStamp = {Shift div 1000000,
|
||||
Shift rem 1000000, 0},
|
||||
@ -900,29 +902,29 @@ user_info(User, Server, Query, Lang) ->
|
||||
Hour, Minute,
|
||||
Second]))
|
||||
end;
|
||||
_ -> ?T(<<"Online">>)
|
||||
_ -> translate:translate(Lang, ?T("Online"))
|
||||
end,
|
||||
[?XC(<<"h1">>, (str:format(?T(<<"User ~s">>),
|
||||
[?XC(<<"h1">>, (str:format(translate:translate(Lang, ?T("User ~s")),
|
||||
[us_to_list(US)])))]
|
||||
++
|
||||
case Res of
|
||||
ok -> [?XREST(<<"Submitted">>)];
|
||||
error -> [?XREST(<<"Bad format">>)];
|
||||
ok -> [?XREST(?T("Submitted"))];
|
||||
error -> [?XREST(?T("Bad format"))];
|
||||
nothing -> []
|
||||
end
|
||||
++
|
||||
[?XAE(<<"form">>,
|
||||
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
|
||||
([?XCT(<<"h3">>, <<"Connected Resources:">>)] ++
|
||||
([?XCT(<<"h3">>, ?T("Connected Resources:"))] ++
|
||||
FResources ++
|
||||
[?XCT(<<"h3">>, <<"Password:">>)] ++
|
||||
[?XCT(<<"h3">>, ?T("Password:"))] ++
|
||||
FPassword ++
|
||||
[?XCT(<<"h3">>, <<"Last Activity">>)] ++
|
||||
[?XCT(<<"h3">>, ?T("Last Activity"))] ++
|
||||
[?C(LastActivity)] ++
|
||||
UserItems ++
|
||||
[?P,
|
||||
?INPUTT(<<"submit">>, <<"removeuser">>,
|
||||
<<"Remove User">>)]))].
|
||||
?T("Remove User"))]))].
|
||||
|
||||
user_parse_query(User, Server, Query) ->
|
||||
lists:foldl(fun ({Action, _Value}, Acc)
|
||||
@ -969,7 +971,7 @@ list_last_activity(Host, Lang, Integral, Period) ->
|
||||
{'EXIT', _Reason} -> [];
|
||||
Vals ->
|
||||
Hist = histogram(Vals, Integral),
|
||||
if Hist == [] -> [?CT(<<"No Data">>)];
|
||||
if Hist == [] -> [?CT(?T("No Data"))];
|
||||
true ->
|
||||
Left = if Days == infinity -> 0;
|
||||
true -> Days - length(Hist)
|
||||
@ -1020,7 +1022,7 @@ get_nodes(Lang) ->
|
||||
RunningNodes = ejabberd_cluster:get_nodes(),
|
||||
StoppedNodes = ejabberd_cluster:get_known_nodes()
|
||||
-- RunningNodes,
|
||||
FRN = if RunningNodes == [] -> ?CT(<<"None">>);
|
||||
FRN = if RunningNodes == [] -> ?CT(?T("None"));
|
||||
true ->
|
||||
?XE(<<"ul">>,
|
||||
(lists:map(fun (N) ->
|
||||
@ -1030,7 +1032,7 @@ get_nodes(Lang) ->
|
||||
end,
|
||||
lists:sort(RunningNodes))))
|
||||
end,
|
||||
FSN = if StoppedNodes == [] -> ?CT(<<"None">>);
|
||||
FSN = if StoppedNodes == [] -> ?CT(?T("None"));
|
||||
true ->
|
||||
?XE(<<"ul">>,
|
||||
(lists:map(fun (N) ->
|
||||
@ -1039,9 +1041,9 @@ get_nodes(Lang) ->
|
||||
end,
|
||||
lists:sort(StoppedNodes))))
|
||||
end,
|
||||
[?XCT(<<"h1">>, <<"Nodes">>),
|
||||
?XCT(<<"h3">>, <<"Running Nodes">>), FRN,
|
||||
?XCT(<<"h3">>, <<"Stopped Nodes">>), FSN].
|
||||
[?XCT(<<"h1">>, ?T("Nodes")),
|
||||
?XCT(<<"h3">>, ?T("Running Nodes")), FRN,
|
||||
?XCT(<<"h3">>, ?T("Stopped Nodes")), FSN].
|
||||
|
||||
search_running_node(SNode) ->
|
||||
RunningNodes = ejabberd_cluster:get_nodes(),
|
||||
@ -1059,39 +1061,38 @@ get_node(global, Node, [], Query, Lang) ->
|
||||
Base = get_base_path(global, Node),
|
||||
MenuItems2 = make_menu_items(global, Node, Base, Lang),
|
||||
[?XC(<<"h1">>,
|
||||
(str:format(?T(<<"Node ~p">>), [Node])))]
|
||||
(str:format(translate:translate(Lang, ?T("Node ~p")), [Node])))]
|
||||
++
|
||||
case Res of
|
||||
ok -> [?XREST(<<"Submitted">>)];
|
||||
error -> [?XREST(<<"Bad format">>)];
|
||||
ok -> [?XREST(?T("Submitted"))];
|
||||
error -> [?XREST(?T("Bad format"))];
|
||||
nothing -> []
|
||||
end
|
||||
++
|
||||
[?XE(<<"ul">>,
|
||||
([?LI([?ACT(<<Base/binary, "db/">>, <<"Database">>)]),
|
||||
?LI([?ACT(<<Base/binary, "backup/">>, <<"Backup">>)]),
|
||||
?LI([?ACT(<<Base/binary, "stats/">>,
|
||||
<<"Statistics">>)]),
|
||||
?LI([?ACT(<<Base/binary, "update/">>, <<"Update">>)])]
|
||||
([?LI([?ACT(<<Base/binary, "db/">>, ?T("Database"))]),
|
||||
?LI([?ACT(<<Base/binary, "backup/">>, ?T("Backup"))]),
|
||||
?LI([?ACT(<<Base/binary, "stats/">>, ?T("Statistics"))]),
|
||||
?LI([?ACT(<<Base/binary, "update/">>, ?T("Update"))])]
|
||||
++ MenuItems2)),
|
||||
?XAE(<<"form">>,
|
||||
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
|
||||
[?INPUTT(<<"submit">>, <<"restart">>, <<"Restart">>),
|
||||
[?INPUTT(<<"submit">>, <<"restart">>, ?T("Restart")),
|
||||
?C(<<" ">>),
|
||||
?INPUTT(<<"submit">>, <<"stop">>, <<"Stop">>)])];
|
||||
?INPUTT(<<"submit">>, <<"stop">>, ?T("Stop"))])];
|
||||
get_node(Host, Node, [], _Query, Lang) ->
|
||||
Base = get_base_path(Host, Node),
|
||||
MenuItems2 = make_menu_items(Host, Node, Base, Lang),
|
||||
[?XC(<<"h1">>, (str:format(?T(<<"Node ~p">>), [Node]))),
|
||||
[?XC(<<"h1">>, (str:format(translate:translate(Lang, ?T("Node ~p")), [Node]))),
|
||||
?XE(<<"ul">>, MenuItems2)];
|
||||
get_node(global, Node, [<<"db">>], Query, Lang) ->
|
||||
case ejabberd_cluster:call(Node, mnesia, system_info, [tables]) of
|
||||
{badrpc, _Reason} ->
|
||||
[?XCT(<<"h1">>, <<"RPC Call Error">>)];
|
||||
[?XCT(<<"h1">>, ?T("RPC Call Error"))];
|
||||
Tables ->
|
||||
ResS = case node_db_parse_query(Node, Tables, Query) of
|
||||
nothing -> [];
|
||||
ok -> [?XREST(<<"Submitted">>)]
|
||||
ok -> [?XREST(?T("Submitted"))]
|
||||
end,
|
||||
STables = lists:sort(Tables),
|
||||
Rows = lists:map(fun (Table) ->
|
||||
@ -1138,7 +1139,7 @@ get_node(global, Node, [<<"db">>], Query, Lang) ->
|
||||
end,
|
||||
STables),
|
||||
[?XC(<<"h1">>,
|
||||
(str:format(?T(<<"Database Tables at ~p">>),
|
||||
(str:format(translate:translate(Lang, ?T("Database Tables at ~p")),
|
||||
[Node]))
|
||||
)]
|
||||
++
|
||||
@ -1148,10 +1149,10 @@ get_node(global, Node, [<<"db">>], Query, Lang) ->
|
||||
[?XAE(<<"table">>, [],
|
||||
[?XE(<<"thead">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Name">>),
|
||||
?XCT(<<"td">>, <<"Storage Type">>),
|
||||
?XCT(<<"td">>, <<"Elements">>),
|
||||
?XCT(<<"td">>, <<"Memory">>)])]),
|
||||
[?XCT(<<"td">>, ?T("Name")),
|
||||
?XCT(<<"td">>, ?T("Storage Type")),
|
||||
?XCT(<<"td">>, ?T("Elements")),
|
||||
?XCT(<<"td">>, ?T("Memory"))])]),
|
||||
?XE(<<"tbody">>,
|
||||
(Rows ++
|
||||
[?XE(<<"tr">>,
|
||||
@ -1160,7 +1161,7 @@ get_node(global, Node, [<<"db">>], Query, Lang) ->
|
||||
{<<"class">>, <<"alignright">>}],
|
||||
[?INPUTT(<<"submit">>,
|
||||
<<"submit">>,
|
||||
<<"Submit">>)])])]))])])]
|
||||
?T("Submit"))])])]))])])]
|
||||
end;
|
||||
get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
||||
HomeDirRaw = case {os:getenv("HOME"), os:type()} of
|
||||
@ -1171,77 +1172,77 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
||||
HomeDir = filename:nativename(HomeDirRaw),
|
||||
ResS = case node_backup_parse_query(Node, Query) of
|
||||
nothing -> [];
|
||||
ok -> [?XREST(<<"Submitted">>)];
|
||||
ok -> [?XREST(?T("Submitted"))];
|
||||
{error, Error} ->
|
||||
[?XRES(<<(?T(<<"Error">>))/binary, ": ",
|
||||
[?XRES(<<(translate:translate(Lang, ?T("Error")))/binary, ": ",
|
||||
((str:format("~p", [Error])))/binary>>)]
|
||||
end,
|
||||
[?XC(<<"h1">>, (str:format(?T(<<"Backup of ~p">>), [Node])))]
|
||||
[?XC(<<"h1">>, (str:format(translate:translate(Lang, ?T("Backup of ~p")), [Node])))]
|
||||
++
|
||||
ResS ++
|
||||
[?XCT(<<"p">>,
|
||||
<<"Please note that these options will "
|
||||
"only backup the builtin Mnesia database. "
|
||||
"If you are using the ODBC module, you "
|
||||
"also need to backup your SQL database "
|
||||
"separately.">>),
|
||||
?T("Please note that these options will "
|
||||
"only backup the builtin Mnesia database. "
|
||||
"If you are using the ODBC module, you "
|
||||
"also need to backup your SQL database "
|
||||
"separately.")),
|
||||
?XAE(<<"form">>,
|
||||
[{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
|
||||
[?XAE(<<"table">>, [],
|
||||
[?XE(<<"tbody">>,
|
||||
[?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Store binary backup:">>),
|
||||
[?XCT(<<"td">>, ?T("Store binary backup:")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>, <<"storepath">>,
|
||||
(filename:join(HomeDir,
|
||||
"ejabberd.backup")))]),
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>, <<"store">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>,
|
||||
<<"Restore binary backup immediately:">>),
|
||||
?T("Restore binary backup immediately:")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>, <<"restorepath">>,
|
||||
(filename:join(HomeDir,
|
||||
"ejabberd.backup")))]),
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>, <<"restore">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>,
|
||||
<<"Restore binary backup after next ejabberd "
|
||||
"restart (requires less memory):">>),
|
||||
?T("Restore binary backup after next ejabberd "
|
||||
"restart (requires less memory):")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>, <<"fallbackpath">>,
|
||||
(filename:join(HomeDir,
|
||||
"ejabberd.backup")))]),
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>, <<"fallback">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>, <<"Store plain text backup:">>),
|
||||
[?XCT(<<"td">>, ?T("Store plain text backup:")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>, <<"dumppath">>,
|
||||
(filename:join(HomeDir,
|
||||
"ejabberd.dump")))]),
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>, <<"dump">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>,
|
||||
<<"Restore plain text backup immediately:">>),
|
||||
?T("Restore plain text backup immediately:")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>, <<"loadpath">>,
|
||||
(filename:join(HomeDir,
|
||||
"ejabberd.dump")))]),
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>, <<"load">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>,
|
||||
<<"Import users data from a PIEFXIS file "
|
||||
"(XEP-0227):">>),
|
||||
?T("Import users data from a PIEFXIS file "
|
||||
"(XEP-0227):")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>,
|
||||
<<"import_piefxis_filepath">>,
|
||||
@ -1250,11 +1251,11 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>,
|
||||
<<"import_piefxis_file">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>,
|
||||
<<"Export data of all users in the server "
|
||||
"to PIEFXIS files (XEP-0227):">>),
|
||||
?T("Export data of all users in the server "
|
||||
"to PIEFXIS files (XEP-0227):")),
|
||||
?XE(<<"td">>,
|
||||
[?INPUT(<<"text">>,
|
||||
<<"export_piefxis_dirpath">>,
|
||||
@ -1262,11 +1263,11 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>,
|
||||
<<"export_piefxis_dir">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XE(<<"td">>,
|
||||
[?CT(<<"Export data of users in a host to PIEFXIS "
|
||||
"files (XEP-0227):">>),
|
||||
[?CT(?T("Export data of users in a host to PIEFXIS "
|
||||
"files (XEP-0227):")),
|
||||
?C(<<" ">>),
|
||||
?INPUT(<<"text">>,
|
||||
<<"export_piefxis_host_dirhost">>,
|
||||
@ -1278,11 +1279,11 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>,
|
||||
<<"export_piefxis_host_dir">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XE(<<"td">>,
|
||||
[?CT(<<"Export all tables as SQL queries "
|
||||
"to a file:">>),
|
||||
[?CT(?T("Export all tables as SQL queries "
|
||||
"to a file:")),
|
||||
?C(<<" ">>),
|
||||
?INPUT(<<"text">>,
|
||||
<<"export_sql_filehost">>,
|
||||
@ -1294,28 +1295,28 @@ get_node(global, Node, [<<"backup">>], Query, Lang) ->
|
||||
"db.sql")))]),
|
||||
?XE(<<"td">>,
|
||||
[?INPUTT(<<"submit">>, <<"export_sql_file">>,
|
||||
<<"OK">>)])]),
|
||||
?T("OK"))])]),
|
||||
?XE(<<"tr">>,
|
||||
[?XCT(<<"td">>,
|
||||
<<"Import user data from jabberd14 spool "
|
||||
"file:">>),
|
||||
?T("Import user data from jabberd14 spool "
|
||||
"file:")),
|
||||
?XE(<<"td">>,
|
||||