From 5d7005d1fd0c9587762cd5dbb2c9fc3fd4947915 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sun, 19 Oct 2014 13:10:11 +0200 Subject: [PATCH] Some essential fixes in admin area --- templates/default/admin.html.ep | 5 ++--- templates/default/manage_room.html.ep | 2 +- vroom.pl | 15 +++++---------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/templates/default/admin.html.ep b/templates/default/admin.html.ep index 35571c2..ec9d882 100644 --- a/templates/default/admin.html.ep +++ b/templates/default/admin.html.ep @@ -20,9 +20,8 @@ <% - my @rooms = $self->get_all_rooms(); - foreach my $room (@rooms){ - my $data = $self->get_room($room); + my $rooms = $self->get_room_list(); + foreach my $room (keys %{$rooms}){ %> diff --git a/templates/default/manage_room.html.ep b/templates/default/manage_room.html.ep index 8f6a676..1effbed 100644 --- a/templates/default/manage_room.html.ep +++ b/templates/default/manage_room.html.ep @@ -37,7 +37,7 @@
<%=l 'ROOM_DETAILS' %>
- <% my $data = $self->get_room($room); %> + <% my $data = $self->get_room_by_name($room); %> diff --git a/vroom.pl b/vroom.pl index b244bfd..5d55ee8 100755 --- a/vroom.pl +++ b/vroom.pl @@ -312,12 +312,12 @@ helper get_participants_list => sub { return 0; } my $sth = eval { - $self->db->prepare('SELECT `participant` + $self->db->prepare('SELECT `participant`,`room_id` FROM `room_participants` WHERE `room_id`=?'); }; $sth->execute($room->{id}); - return $sth->fetchall_hashref('room_id')->{$room->{id}}; + return $sth->fetchall_hashref('room_id'); }; # Set the role of a peer @@ -495,19 +495,14 @@ helper delete_room => sub { }; # Retrieve the list of rooms -# TODO: rewrite to return a hashref with full room data -helper get_all_rooms => sub { +helper get_room_list => sub { my $self = shift; - my @rooms; my $sth = eval { - $self->db->prepare('SELECT `name` + $self->db->prepare('SELECT * FROM `rooms`'); }; $sth->execute; - while (my $name = $sth->fetchrow_array){ - push @rooms, $name; - } - return @rooms; + return $sth->fetchall_hashref('name'); }; # Just update the activity timestamp