[?XE("ul",
[?LI([?ACT("/admin/acls/", "Access Control Lists")]),
?LI([?ACT("/admin/access/", "Access Rules")]),
+ ?LI([?ACT("/admin/vhosts/", "Virtual Hosts")]),
?LI([?ACT("/admin/nodes/", "Nodes")]),
?LI([?ACT("/admin/stats/", "Statistics")])
]
?ACT("/admin/acls-raw/", "(raw)")]),
?LI([?ACT("/admin/access/", "Access Rules"), ?C(" "),
?ACT("/admin/access-raw/", "(raw)")]),
+ ?LI([?ACT("/admin/vhosts/", "Virtual Hosts")]),
?LI([?ACT("/admin/nodes/", "Nodes")]),
?LI([?ACT("/admin/stats/", "Statistics")])
]
])
], Host, Lang);
+process_admin(global,
+ #request{us = US,
+ path = ["vhosts"],
+ q = Query,
+ lang = Lang} = Request) ->
+ Res = list_vhosts(Lang),
+ make_xhtml([?XCT("h1", "ejabberd virtual hosts")] ++ Res, global, Lang);
+
process_admin(Host,
#request{us = US,
- path = ["users"],
- q = Query,
- lang = Lang} = Request) when is_list(Host) ->
+ path = ["users"],
+ q = Query,
+ lang = Lang} = Request) when is_list(Host) ->
Res = list_users(Host, Query, Lang),
make_xhtml([?XCT("h1", "ejabberd users")] ++ Res, Host, Lang);
process_admin(Host,
#request{us = US,
- path = ["online-users"],
- q = Query,
- lang = Lang} = Request) when is_list(Host) ->
+ path = ["online-users"],
+ q = Query,
+ lang = Lang} = Request) when is_list(Host) ->
Res = list_online_users(Host, Lang),
make_xhtml([?XCT("h1", "ejabberd users")] ++ Res, Host, Lang);
process_admin(Host,
#request{us = US,
- path = ["shared-roster"],
- q = Query,
- lang = Lang} = Request) ->
+ path = ["shared-roster"],
+ q = Query,
+ lang = Lang} = Request) ->
Res = list_shared_roster_groups(Query, Lang),
make_xhtml(Res, Host, Lang);
process_admin(Host,
#request{us = US,
- path = ["shared-roster", Group],
- q = Query,
- lang = Lang} = Request) ->
+ path = ["shared-roster", Group],
+ q = Query,
+ lang = Lang} = Request) ->
Res = shared_roster_group(Group, Query, Lang),
make_xhtml(Res, Host, Lang);
end.
+list_vhosts(Lang) ->
+ Hosts = ?MYHOSTS,
+ SHosts = lists:sort(Hosts),
+ [?XE("table",
+ [?XE("thead",
+ [?XE("tr",
+ [?XCT("td", "Host"),
+ ?XCT("td", "Registered users"),
+ ?XCT("td", "Online users")
+ ])]),
+ ?XE("tbody",
+ lists:map(
+ fun(Host) ->
+ OnlineUsers =
+ length(ejabberd_sm:get_vh_session_list(Host)),
+ RegisteredUsers =
+ length(ejabberd_auth:get_vh_registered_users(Host)),
+ ?XE("tr",
+ [?XE("td", [?AC("../server/" ++ Host ++ "/", Host)]),
+ ?XC("td", integer_to_list(RegisteredUsers)),
+ ?XC("td", integer_to_list(OnlineUsers))
+ ])
+ end, SHosts)
+ )])].
list_users(Host, Query, Lang) ->