From e124a881df36f865fe40babaec23b4c4801f0d59 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 12 Sep 2009 00:01:52 +0200 Subject: [PATCH] Show pnick in user list --- lib/NDWeb/Controller/Users.pm | 19 ++++++++----------- root/src/users/index.tt2 | 3 ++- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/NDWeb/Controller/Users.pm b/lib/NDWeb/Controller/Users.pm index 67fb97f..bdad4fc 100644 --- a/lib/NDWeb/Controller/Users.pm +++ b/lib/NDWeb/Controller/Users.pm @@ -28,18 +28,15 @@ sub index :Path :Args(0) { my ( $self, $c ) = @_; my $dbh = $c->model; - my $query = $dbh->prepare(qq{SELECT uid,username,array_to_string(array_agg(g.groupname),', ') AS groups - FROM users u LEFT OUTER JOIN (groupmembers gm NATURAL JOIN groups g) USING (uid) - WHERE uid > 0 - GROUP BY u.uid,username - ORDER BY username}); + my $query = $dbh->prepare(q{ +SELECT uid,username,pnick,array_to_string(array_agg(g.groupname),', ') AS groups +FROM users u LEFT OUTER JOIN (groupmembers gm NATURAL JOIN groups g) USING (uid) +WHERE uid > 0 +GROUP BY u.uid,username,pnick +ORDER BY username + }); $query->execute; - - my @users; - while (my $user = $query->fetchrow_hashref){ - push @users, $user; - } - $c->stash(users => \@users); + $c->stash(users => $query->fetchall_arrayref({})); } sub edit : Local { diff --git a/root/src/users/index.tt2 b/root/src/users/index.tt2 index 29127a3..3c8c086 100644 --- a/root/src/users/index.tt2 +++ b/root/src/users/index.tt2 @@ -1,9 +1,10 @@ [% META title = 'User listing' %] - + [% FOR u IN users %] + [% END %] -- 2.39.2
UserGroups
UserP-nickGroups
[% u.username | html %][% u.pnick %] [% u.groups %]