aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2005-05-27 22:52:50 +0000
committerAlexey Shchepin <alexey@process-one.net>2005-05-27 22:52:50 +0000
commitcb9007532739a81cf4e29b6134ea6eaaf6c5f353 (patch)
tree04831d17b4535cd8efd1cb51e99d644c715207b2
parentAdded 0.9.1 release note that was in the release ejabberd-0.9.1 version. (diff)
* src/web/ejabberd_web_admin.erl: Bugfix
SVN Revision: 369
-rw-r--r--ChangeLog4
-rw-r--r--src/web/ejabberd_web_admin.erl48
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 <alexey@sevcom.net>
+
+ * src/web/ejabberd_web_admin.erl: Bugfix
+
2005-05-25 Alexey Shchepin <alexey@sevcom.net>
* 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) ->