summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-user.html
blob: ec2341be68d6a91806c66c94096dfceb02ba16c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<SELECT NAME="usernum">

% unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
  <OPTION VALUE="">all</OPTION>
% }

% foreach my $usernum (
%   sort { $opt{'access_user'}->{$a} cmp $opt{'access_user'}->{$b} }
%   keys %{ $opt{'access_user'} }
% ) { 
    <OPTION VALUE="<%$usernum%>"><% $opt{'access_user'}->{$usernum} %></OPTION>
% } 

</SELECT>

<%init>

my %opt = @_;

unless ( $opt{'access_user'} ) {

  my $sth = dbh->prepare("
    SELECT usernum, username FROM access_user
      WHERE disabled = '' or disabled IS NULL
  ") or die dbh->errstr;
  $sth->execute or die $sth->errstr;
  while ( my $row = $sth->fetchrow_arrayref ) {
    $opt{'access_user'}->{$row->[0]} = $row->[1];
  }

}

</%init>