Display number of members in room in the admin area

The number should be quite accurate, as it's now counting socket.io peers
master
Daniel Berteaud 10 years ago
parent d27816872f
commit 69c3cd3b5a
  1. 1
      lib/Vroom/I18N/en.pm
  2. 1
      lib/Vroom/I18N/fr.pm
  3. 1
      public/js/vroom.js
  4. 3
      templates/default/admin_manage_rooms.html.ep
  5. 7
      vroom.pl

@ -156,6 +156,7 @@ our %Lexicon = (
"EMAIL_INVITE" => "Email invitation", "EMAIL_INVITE" => "Email invitation",
"DELETE" => "Delete", "DELETE" => "Delete",
"CONFIRM_DELETE" => "Confirm delation", "CONFIRM_DELETE" => "Confirm delation",
"ROOM_WILL_BE_DELETED" => "This room, and its configuration will be deleted",
"LOGOUT" => "Leave the room", "LOGOUT" => "Leave the room",
"LEAVE_THIS_ROOM" => "Leave the room", "LEAVE_THIS_ROOM" => "Leave the room",
"ARE_YOU_SURE_YOU_WANT_TO_LEAVE" => "Are you sure you want to leave this room ?", "ARE_YOU_SURE_YOU_WANT_TO_LEAVE" => "Are you sure you want to leave this room ?",

@ -162,6 +162,7 @@ our %Lexicon = (
"EMAIL_INVITE" => "Invitation par email", "EMAIL_INVITE" => "Invitation par email",
"DELETE" => "Supprimer", "DELETE" => "Supprimer",
"CONFIRM_DELETE" => "Confirmer la suppression", "CONFIRM_DELETE" => "Confirmer la suppression",
"ROOM_WILL_BE_DELETED" => "Le salon, ainsi que sa configuration seront définitivement supprimés",
"LOGOUT" => "Quitter le salon", "LOGOUT" => "Quitter le salon",
"LEAVE_THIS_ROOM" => "Quitter le salon", "LEAVE_THIS_ROOM" => "Quitter le salon",
"ARE_YOU_SURE_YOU_WANT_TO_LEAVE" => "Êtes-vous sûr de vouloir quitter le salon ?", "ARE_YOU_SURE_YOU_WANT_TO_LEAVE" => "Êtes-vous sûr de vouloir quitter le salon ?",

@ -423,6 +423,7 @@ function initAdminRooms(){
.append($('<td>').html(stringEscape(obj.name))) .append($('<td>').html(stringEscape(obj.name)))
.append($('<td>').html(stringEscape(create)).addClass('hidden-xs')) .append($('<td>').html(stringEscape(create)).addClass('hidden-xs'))
.append($('<td>').html(stringEscape(activity)).addClass('hidden-xs')) .append($('<td>').html(stringEscape(activity)).addClass('hidden-xs'))
.append($('<td>').html(obj.members).addClass('hidden-xs'))
.append($('<td>') .append($('<td>')
.append($('<div>').addClass('btn-group') .append($('<div>').addClass('btn-group')
.append($('<a>').addClass('btn btn-default').attr('href',rootUrl + obj.name) .append($('<a>').addClass('btn btn-default').attr('href',rootUrl + obj.name)

@ -34,6 +34,9 @@
<th class="hidden-xs"> <th class="hidden-xs">
<%=l 'LAST_ACTIVITY' %> <%=l 'LAST_ACTIVITY' %>
</th> </th>
<th class="hidden-xs">
<%=l 'NUMBER_OF_PARTICIPANTS' %>
</th>
<th> <th>
<%=l 'MANAGE' %> <%=l 'MANAGE' %>
</th> </th>

@ -1290,11 +1290,16 @@ any '/api' => sub {
# Here are method not tied to a room # Here are method not tied to a room
if ($req->{action} eq 'get_room_list'){ if ($req->{action} eq 'get_room_list'){
my $rooms = $self->get_room_list; my $rooms = $self->get_room_list;
# Blank out a few param we don't need
foreach my $r (keys %{$rooms}){ foreach my $r (keys %{$rooms}){
# Blank out a few param we don't need
foreach my $p (qw/join_password owner_password owner token etherpad_group/){ foreach my $p (qw/join_password owner_password owner token etherpad_group/){
delete $rooms->{$r}->{$p}; delete $rooms->{$r}->{$p};
} }
# Count active users
$rooms->{$r}->{members} = 0;
foreach my $peer (keys %$peers){
$rooms->{$r}->{members}++ if ($peers->{$peer}->{room} eq $r);
}
} }
return $self->render( return $self->render(
json => { json => {

Loading…
Cancel
Save