X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=lib%2FOnis%2FPlugins%2FUserdetails.pm;h=66e990342ec99f1d28f79edfe135c23333804008;hb=30318d9847fb17c24933f450559ca7998baabaf0;hp=66aa39e2a8a46116ec97ada061b66ae728cd2841;hpb=649037a3363386190b228cf221c27674e91bfcfb;p=onis.git diff --git a/lib/Onis/Plugins/Userdetails.pm b/lib/Onis/Plugins/Userdetails.pm index 66aa39e..66e9903 100644 --- a/lib/Onis/Plugins/Userdetails.pm +++ b/lib/Onis/Plugins/Userdetails.pm @@ -10,6 +10,7 @@ use Onis::Data::Core (qw(get_main_nick register_plugin nick_to_name)); use Onis::Users (qw(ident_to_name get_link get_image)); use Onis::Plugins::Core (qw(get_core_nick_counters get_sorted_nicklist)); +use Onis::Plugins::Weekdays (qw(get_weekdays)); use Onis::Plugins::Conversations (qw(get_conversations)); use Onis::Plugins::Bignumbers (qw(get_bignumbers)); use Onis::Plugins::Interestingnumbers (qw(get_interestingnumbers)); @@ -136,8 +137,6 @@ sub output { my $nicks_ref = get_sorted_nicklist (); - my $max = $PLUGIN_MAX; - my $fh = get_filehandle (); my $trans = translate ('Detailed nick stats'); @@ -145,17 +144,19 @@ sub output my $max_time = 0; my $max_conv = 0; + my $max_weekday = 0; my @nicks = @$nicks_ref; my $nick_data = {}; - splice (@nicks, $max) if (scalar (@nicks) > $max); + splice (@nicks, $PLUGIN_MAX) if (scalar (@nicks) > $PLUGIN_MAX); for (@nicks) { my $nick = $_; $nick_data->{$nick} = get_core_nick_counters ($nick); + $nick_data->{$nick}{'weekdays'} = get_weekdays ($nick); $nick_data->{$nick}{'conversations'} = get_conversations ($nick); $nick_data->{$nick}{'bignumbers'} = get_bignumbers ($nick); $nick_data->{$nick}{'interestingnumbers'} = get_interestingnumbers ($nick); @@ -173,6 +174,17 @@ sub output $num = $ptr->[0] + $ptr->[1] + $ptr->[2] + $ptr->[3]; $max_conv = $num if ($max_conv < $num); } + + for (keys %{$nick_data->{$nick}{'weekdays'}}) + { + my $day = $_; + my $ptr = $nick_data->{$nick}{'weekdays'}{$day}; + + for (my $i = 0; $i < 4; $i++) + { + $max_weekday = $ptr->[$i] if ($max_weekday < $ptr->[$i]); + } + } } my $time_factor = 0; @@ -190,7 +202,7 @@ sub output print $fh qq#\n#, qq# \n#, - qq# \n#, + qq# \n#, qq# \n#; for (@nicks) @@ -201,7 +213,7 @@ sub output my $ptr = $nick_data->{$nick}; print $fh qq# \n#, - qq# \n#, + qq# \n#, qq# \n#, qq# \n#; @@ -304,51 +316,7 @@ sub output printf $fh (" $trans
\n", $num); } - # actions # TODO - # exclamation ratio # TODO - # # of nicks - # - # chats with - # lines per day - - print $fh qq# \n \n \n \n \n
$trans$trans
$print$print
\n#; - - if (defined ($ptr->{'chars'})) - { - print $fh qq# \n \n#; - - for (my $i = 0; $i < 24; $i++) - { - $num = 0; - - my $img = $V_IMAGES[int ($i / 6)]; - my $height; - - $num = $ptr->{'chars'}[$i]; - - $height = sprintf ("%.2f", 95 * $num / $max_time); - - print $fh qq# \n#; - } - - print $fh < - - - - - - -
$num chars
0-56-1112-1718-23
-EOF - } - else - { - print ' '; - } - - print $fh qq#
\n#; + print $fh qq# \n#; if (%{$ptr->{'conversations'}}) { @@ -370,7 +338,7 @@ EOF $trans = translate ('Talks to'); print $fh < + @@ -383,13 +351,14 @@ EOF my $total = 0; print $fh " \n", - qq# \n#, - qq# \n#, + qq# \n \n"; @@ -412,6 +381,92 @@ EOF { print $fh ' '; } + print $fh qq# \n \n#, + qq# \n \n \n \n \n#; } print $fh "
$trans:
$other_name#; + qq# $other_name#; for (my $k = 0; $k < 4; $k++) { my $img = $H_IMAGES[$k]; - my $width = int (0.5 + ($conv_factor * $ptr->{'conversations'}{$other}{'nicks'}{$nick}[$k])) || 1; + my $num = $ptr->{'conversations'}{$other}{'nicks'}{$nick}[$k]; + my $width = sprintf ("%.2f", 95 * $num / $max_conv); print $fh qq##; + print $fh qq#style="width: $width\%;" />#; } print $fh "
\n#; + + if (defined ($ptr->{'chars'})) + { + print $fh qq# \n \n#; + + for (my $i = 0; $i < 24; $i++) + { + $num = 0; + + my $img = $V_IMAGES[int ($i / 6)]; + my $height; + + $num = $ptr->{'chars'}[$i]; + + $height = sprintf ("%.2f", 95 * $num / $max_time); + + print $fh qq# \n#; + } + + print $fh < + + + + + + +
$num chars
0-56-1112-1718-23
+EOF + } + else + { + print ' '; + } + + print $fh qq#
\n#; + + #weekly + if (%{$nick_data->{$nick}{'weekdays'}}) + { + my $data = $nick_data->{$nick}{'weekdays'}; + my @days = (qw(mon tue wed thu fri sat sun)); + + print $fh qq# \n#, + qq# \n#; + + for (@days) + { + my $day = $_; + for (my $i = 0; $i < 4; $i++) + { + my $num = $nick_data->{$nick}{'weekdays'}{$day}[$i]; + my $height = sprintf ("%.2f", 95 * $num / $max_weekday); + my $class = ''; + my $img = $V_IMAGES[$i]; + + print $fh qq# \n#; + } + } + + print $fh qq# \n#, + qq# \n#; + + for (@days) + { + my $day = $_; + my $trans = translate ($day); + + print $fh qq# \n#; + } + + print $fh qq# \n#, + qq#
#, + qq##, + qq#
$trans
\n#; + } + + print $fh qq#
\n#; + + #longterm + print $fh qq#  \n#; + + print $fh qq#
\n\n";