From cb9007532739a81cf4e29b6134ea6eaaf6c5f353 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Fri, 27 May 2005 22:52:50 +0000 Subject: [PATCH] * src/web/ejabberd_web_admin.erl: Bugfix SVN Revision: 369 --- ChangeLog | 4 +++ src/web/ejabberd_web_admin.erl | 48 +++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c27406e0..afbdb36b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-05-28 Alexey Shchepin + + * src/web/ejabberd_web_admin.erl: Bugfix + 2005-05-25 Alexey Shchepin * src/msgs/pt-br.msg: New Brazilian Portuguese translation (thanks diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl index dacbf7817..354dc2d0a 100644 --- a/src/web/ejabberd_web_admin.erl +++ b/src/web/ejabberd_web_admin.erl @@ -1556,7 +1556,7 @@ user_roster_item_parse_query(User, Server, Items, Query) -> nothing. -list_last_activity(_Lang, Integral, Period) -> +list_last_activity(Lang, Integral, Period) -> {MegaSecs, Secs, _MicroSecs} = now(), TimeStamp = MegaSecs * 1000000 + Secs, case Period of @@ -1580,26 +1580,32 @@ list_last_activity(_Lang, Integral, Period) -> []; Vals -> Hist = histogram(Vals, Integral), - Left = case Days of - infinity -> - 0; - _ -> - Days - length(Hist) - end, - Tail = case Integral andalso Hist /= [] of - true -> - lists:duplicate(Left, lists:last(Hist)); - _ -> - lists:duplicate(Left, 0) - end, - Max = lists:max(Hist), - [?XAE("ol", - [{"id", "lastactivity"}, {"start", "0"}], - [?XAE("li", - [{"style", "width:" ++ integer_to_list( - trunc(90 * V / Max)) ++ "%;"}], - [{xmlcdata, integer_to_list(V)}]) - || V <- Hist ++ Tail])] + if + Hist == [] -> + [?CT("No data")]; + true -> + Left = if + Days == infinity -> + 0; + true -> + Days - length(Hist) + end, + Tail = if + Integral -> + lists:duplicate(Left, lists:last(Hist)); + true -> + lists:duplicate(Left, 0) + end, + Max = lists:max(Hist), + [?XAE("ol", + [{"id", "lastactivity"}, {"start", "0"}], + [?XAE("li", + [{"style", + "width:" ++ integer_to_list( + trunc(90 * V / Max)) ++ "%;"}], + [{xmlcdata, integer_to_list(V)}]) + || V <- Hist ++ Tail])] + end end. histogram(Values, Integral) -> -- 2.40.0