%# Your life would be very empty if you had nothing to regret. % my $Window = 'frm' . int(rand(10000)); <& /Edit/Elements/104Header, OnLoad => ( (keys %ARGS > 1 and !$ARGS{cname}) ? '' : $m->scomp('/Edit/Elements/NewWindow', "Search.html?Target=$Window", 500, 280, $Window) ), Buttons => [ Add => '', Save => '', Delete => '', Copy => '', Search => $m->scomp('/Edit/Elements/NewWindow', "Search.html?Target=$Window", 500, 280, $Window), ], &>

<& /Edit/Elements/Tab, Text => 'Users' &>
<& Top, Item => $Item &> <& List, List => $List, Begin => $Begin, Item => $Item, Show => $Show, ARGS => \%ARGS &> |  |
<& /Edit/Elements/Tabs, Map => $Map, Show => $Show, Begin => $Begin, User => $User &>
<& $Show, %ARGS, Item => $Item &>

<%INIT> my $List = []; $Show ||= 'Info'; die unless $Show =~ /^(?:Info|System|Group|Queue|Delegate)$/; if ($DoSearch) { my $users = RT::Users->new($session{'CurrentUser'}); $users->{'find_disabled_rows'} = 1 if $FindDisabledUsers; $users->Limit( FIELD => 'ExternalAuthId', OPERATOR => '!=', VALUE => '0'); if ($Limit) { $users->Limit( FIELD => 'Email', OPERATOR => 'LIKE', VALUE => $Email ) if length $Email; $users->Limit( FIELD => 'Name', OPERATOR => 'LIKE', VALUE => $Name ) if length $Name; } $List = $users->ItemsArrayRef; if ($Limit) { if ($GroupId) { my $Group = RT::Group->new($session{'CurrentUser'}); $Group->Load($GroupId) || Abort(loc('Could not load group' . $GroupId)); my $department = $Group->Description; @$List = grep { $_->val('department') == $department } @$List; } if ($IdMin and $IdMax) { @$List = grep { $_->get('no') ge $IdMin and $_->get('no') le $IdMax } @$List; } elsif ($IdMin or $IdMax) { my $Id = $IdMin || $IdMax; @$List = grep { $_->get('no') eq $Id } @$List; } } # Schwartzian transform! @$List = ( map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_->Id => $_->get('no') ] } @$List ); $session{'CurrentEditUserSearch'} = [ @$List ]; } elsif ( keys %ARGS > 1 and !$ARGS{cname} ) { $List = $session{'CurrentEditUserSearch'} || []; } my $Item = $RT::Nothing; if ($User) { $Item = RT::User->new($session{'CurrentUser'}); $Item->Load( $User ); } my $Map = [ Info => 'Basics', # loc System => 'System Rights', # loc Group => 'Group Rights', # loc Queue => 'Queue Rights', # loc Delegate => 'Delegates', # loc ]; <%ARGS> $DoSearch => undef $Limit => undef $IdMin => undef $IdMax => undef $Name => undef $Email => undef $GroupId => undef $FindDisabledUsers => 0 $Begin => 0 $User => undef $Show => 'Info'