diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/select-user.html | 30 | ||||
-rw-r--r-- | httemplate/elements/tr-select-user.html | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html new file mode 100644 index 000000000..bdb92e70f --- /dev/null +++ b/httemplate/elements/select-user.html @@ -0,0 +1,30 @@ +<SELECT NAME="usernum"> + +% unless ( $opt{'multiple'} || $opt{'disable_empty'} ) { + <OPTION VALUE="">all</OPTION> +% } + +% foreach my $otaker ( @{ $opt{'otakers'} } ) { + <OPTION VALUE="<% shift(@{$opt{'usernums'}}) %>"><% $otaker %></OPTION> +% } + +</SELECT> + +<%init> + +my %opt = @_; + +unless ( $opt{'otakers'} ) { + + my $sth = dbh->prepare("SELECT username,usernum FROM access_user". + " WHERE disabled = '' or disabled IS NULL") + or die dbh->errstr; + $sth->execute or die $sth->errstr; + for($sth->fetchall_arrayref) { + $opt{'otakers'} = [ map { $_->[0] } @$_ ]; + $opt{'usernums'} = [ map { $_->[1] } @$_ ]; + } + +} + +</%init> diff --git a/httemplate/elements/tr-select-user.html b/httemplate/elements/tr-select-user.html new file mode 100644 index 000000000..a9572af8f --- /dev/null +++ b/httemplate/elements/tr-select-user.html @@ -0,0 +1,10 @@ +<TR> + <TD ALIGN="right"><% $opt{'label'} || 'Employee: ' %></TD> + <TD><% include('select-user.html', %opt) %></TD> +</TR> + +<%init> + +my %opt = @_; + +</%init> |