Fix modules to work when WebAdmin has custom base URL (#3043)
This commit is contained in:
parent
b7222c8828
commit
20ba631f3e
|
@ -1040,9 +1040,9 @@ web_page_main(_, #request{path=[<<"statsdx">>], lang = Lang} = _Request) ->
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?CT(<<"Top rosters">>)]),
|
[?XE(<<"td">>, [?CT(<<"Top rosters">>)]),
|
||||||
?XE(<<"td">>, [
|
?XE(<<"td">>, [
|
||||||
?ACT(<<"top/roster/30">>, <<"30">>), ?C(<<", ">>),
|
?ACT(<<"top/roster/30/">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/roster/100">>, <<"100">>), ?C(<<", ">>),
|
?ACT(<<"top/roster/100/">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/roster/500">>, <<"500">>) ])]
|
?ACT(<<"top/roster/500/">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
@ -1054,18 +1054,18 @@ web_page_main(_, #request{path=[<<"statsdx">>], lang = Lang} = _Request) ->
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?CT(<<"Top offline message queues">>) ]),
|
[?XE(<<"td">>, [?CT(<<"Top offline message queues">>) ]),
|
||||||
?XE(<<"td">>, [
|
?XE(<<"td">>, [
|
||||||
?ACT(<<"top/offlinemsg/30">>, <<"30">>), ?C(<<", ">>),
|
?ACT(<<"top/offlinemsg/30/">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/offlinemsg/100">>, <<"100">>), ?C(<<", ">>),
|
?ACT(<<"top/offlinemsg/100/">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/offlinemsg/500">>, <<"500">>) ])]
|
?ACT(<<"top/offlinemsg/500/">>, <<"500">>) ])]
|
||||||
),
|
),
|
||||||
do_stat(global, Lang, "vcards"),
|
do_stat(global, Lang, "vcards"),
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?CT(<<"Top vCard sizes">>) ]),
|
[?XE(<<"td">>, [?CT(<<"Top vCard sizes">>) ]),
|
||||||
?XE(<<"td">>, [
|
?XE(<<"td">>, [
|
||||||
?ACT(<<"top/vcard/5">>, <<"5">>), ?C(<<", ">>),
|
?ACT(<<"top/vcard/5/">>, <<"5">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/vcard/30">>, <<"30">>), ?C(<<", ">>),
|
?ACT(<<"top/vcard/30/">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/vcard/100">>, <<"100">>), ?C(<<", ">>),
|
?ACT(<<"top/vcard/100/">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/vcard/500">>, <<"500">>) ])]
|
?ACT(<<"top/vcard/500/">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
@ -1171,7 +1171,11 @@ do_top_table(_Node, Lang, Topic, TopnumberBin, Host) ->
|
||||||
User = binary_to_list(UserB),
|
User = binary_to_list(UserB),
|
||||||
Server = binary_to_list(ServerB),
|
Server = binary_to_list(ServerB),
|
||||||
UserJID = User++"@"++Server,
|
UserJID = User++"@"++Server,
|
||||||
UserJIDUrl = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
Level = case Host of
|
||||||
|
server -> 4;
|
||||||
|
_ -> 6
|
||||||
|
end,
|
||||||
|
UserJIDUrl = lists:duplicate(Level, "../") ++ "server/" ++ Server ++ "/user/" ++ User ++ "/",
|
||||||
ValueString = integer_to_list(Value),
|
ValueString = integer_to_list(Value),
|
||||||
ValueEl = case Topic of
|
ValueEl = case Topic of
|
||||||
<<"offlinemsg">> -> {url, UserJIDUrl++"queue/", ValueString};
|
<<"offlinemsg">> -> {url, UserJIDUrl++"queue/", ValueString};
|
||||||
|
@ -1349,9 +1353,9 @@ web_page_host(_, Host,
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?C(<<"Top rosters">>) ]),
|
[?XE(<<"td">>, [?C(<<"Top rosters">>) ]),
|
||||||
?XE(<<"td">>, [
|
?XE(<<"td">>, [
|
||||||
?ACT(<<"top/roster/30">>, <<"30">>), ?C(<<", ">>),
|
?ACT(<<"top/roster/30/">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/roster/100">>, <<"100">>), ?C(<<", ">>),
|
?ACT(<<"top/roster/100/">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/roster/500">>, <<"500">>) ])]
|
?ACT(<<"top/roster/500/">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
@ -1364,17 +1368,17 @@ web_page_host(_, Host,
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?C(<<"Top offline message queues">>)]),
|
[?XE(<<"td">>, [?C(<<"Top offline message queues">>)]),
|
||||||
?XE(<<"td">>, [
|
?XE(<<"td">>, [
|
||||||
?ACT(<<"top/offlinemsg/30">>, <<"30">>), ?C(<<", ">>),
|
?ACT(<<"top/offlinemsg/30/">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/offlinemsg/100">>, <<"100">>), ?C(<<", ">>),
|
?ACT(<<"top/offlinemsg/100/">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/offlinemsg/500">>, <<"500">>) ])]
|
?ACT(<<"top/offlinemsg/500/">>, <<"500">>) ])]
|
||||||
),
|
),
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?C(<<"Top vCard sizes">>) ]),
|
[?XE(<<"td">>, [?C(<<"Top vCard sizes">>) ]),
|
||||||
?XE(<<"td">>, [
|
?XE(<<"td">>, [
|
||||||
?ACT(<<"top/vcard/5">>, <<"5">>), ?C(<<", ">>),
|
?ACT(<<"top/vcard/5/">>, <<"5">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/vcard/30">>, <<"30">>), ?C(<<", ">>),
|
?ACT(<<"top/vcard/30/">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/vcard/100">>, <<"100">>), ?C(<<", ">>),
|
?ACT(<<"top/vcard/100/">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT(<<"top/vcard/500">>, <<"500">>) ])]
|
?ACT(<<"top/vcard/500/">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
@ -1526,7 +1530,7 @@ make_url(StatLink, L) ->
|
||||||
[L1, L2] = string:tokens(L, "/"),
|
[L1, L2] = string:tokens(L, "/"),
|
||||||
[Stat1, L1, Stat2, L2]
|
[Stat1, L1, Stat2, L2]
|
||||||
end,
|
end,
|
||||||
string:join(List, "/").
|
string:join(List, "/")++["/"].
|
||||||
|
|
||||||
do_stat_table(global, Lang, Stat, Host) ->
|
do_stat_table(global, Lang, Stat, Host) ->
|
||||||
Os = mod_statsdx:get_statistic(global, [Stat, Host]),
|
Os = mod_statsdx:get_statistic(global, [Stat, Host]),
|
||||||
|
@ -1545,7 +1549,11 @@ do_sessions_table(_Node, _Lang, Filter, {Sort_direction, Sort_column}, Host) ->
|
||||||
Lang = list_to_binary(LangS),
|
Lang = list_to_binary(LangS),
|
||||||
User = binary_to_list(JID#jid.luser),
|
User = binary_to_list(JID#jid.luser),
|
||||||
Server = binary_to_list(JID#jid.lserver),
|
Server = binary_to_list(JID#jid.lserver),
|
||||||
UserURL = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
Level = case Host of
|
||||||
|
server -> 1 + length(Filter);
|
||||||
|
_ -> 3 + length(Filter)
|
||||||
|
end,
|
||||||
|
UserURL = lists:duplicate(Level, "../") ++ "server/" ++ Server ++ "/user/" ++ User ++ "/",
|
||||||
?XE(<<"tr">>, [
|
?XE(<<"tr">>, [
|
||||||
?XE(<<"td">>, [?AC(list_to_binary(UserURL), jid:encode(JID))]),
|
?XE(<<"td">>, [?AC(list_to_binary(UserURL), jid:encode(JID))]),
|
||||||
?XCTB("td", atom_to_list(Client_id)),
|
?XCTB("td", atom_to_list(Client_id)),
|
||||||
|
|
|
@ -945,8 +945,8 @@ web_page_host(_, _Host,
|
||||||
lang = Lang} = _Request) ->
|
lang = Lang} = _Request) ->
|
||||||
Res = [?XCT(<<"h1">>, <<"Web Presence">>),
|
Res = [?XCT(<<"h1">>, <<"Web Presence">>),
|
||||||
?XE(<<"ul">>, [
|
?XE(<<"ul">>, [
|
||||||
?LI([?ACT(<<"stats">>, <<"Statistics">>)]),
|
?LI([?ACT(<<"stats/">>, <<"Statistics">>)]),
|
||||||
?LI([?ACT(<<"users">>, <<"Registered Users">>)])])],
|
?LI([?ACT(<<"users/">>, <<"Registered Users">>)])])],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
|
|
||||||
web_page_host(_, Host,
|
web_page_host(_, Host,
|
||||||
|
@ -979,7 +979,7 @@ make_users_table(Records, Lang) ->
|
||||||
TList = lists:map(
|
TList = lists:map(
|
||||||
fun([User, RidUrl, JIDUrl, XML, Avatar, JS, Text, Icon]) ->
|
fun([User, RidUrl, JIDUrl, XML, Avatar, JS, Text, Icon]) ->
|
||||||
?XE(<<"tr">>,
|
?XE(<<"tr">>,
|
||||||
[?XE(<<"td">>, [?AC(?BC([<<"../user/">>, User, <<"/">>]), User)]),
|
[?XE(<<"td">>, [?AC(?BC([<<"../../user/">>, User, <<"/">>]), User)]),
|
||||||
?XC(<<"td">>, iolist_to_binary(atom_to_list(JIDUrl))),
|
?XC(<<"td">>, iolist_to_binary(atom_to_list(JIDUrl))),
|
||||||
?XC(<<"td">>, ridurl_out(RidUrl)),
|
?XC(<<"td">>, ridurl_out(RidUrl)),
|
||||||
?XC(<<"td">>, Icon),
|
?XC(<<"td">>, Icon),
|
||||||
|
|
Loading…
Reference in New Issue