From: lpsolit%gmail.com <> Date: Mon, 5 Sep 2005 01:45:10 +0000 (+0000) Subject: Bug 304268: edit users form should have an item for "edit this user" - Patch by Gavin... X-Git-Tag: bugzilla-2.21.1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=012dada9941e13b7a1b18875754ec12ee217d433;p=thirdparty%2Fbugzilla.git Bug 304268: edit users form should have an item for "edit this user" - Patch by GavinS r=wurblzap a=justdave --- diff --git a/editusers.cgi b/editusers.cgi index b7ce52b3e4..e6d4fffe85 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -118,6 +118,9 @@ if ($action eq 'search') { } elsif ($matchtype eq 'notregexp') { $query .= $dbh->sql_not_regexp($expr, '?'); $matchstr = '.' unless $matchstr; + } elsif ($matchtype eq 'exact') { + $query .= $expr . ' = ?'; + $matchstr = '.' unless $matchstr; } else { # substr or unknown $query .= $expr . ' like ?'; $matchstr = "%$matchstr%"; @@ -142,10 +145,17 @@ if ($action eq 'search') { $vars->{'users'} = $dbh->selectall_arrayref($query, {'Slice' => {}}, @bindValues); + } - $template->process('admin/users/list.html.tmpl', $vars) - || ThrowTemplateError($template->error()); + if ($matchtype eq 'exact' && scalar(@{$vars->{'users'}}) == 1) { + $otherUserID = $vars->{'users'}[0]->{'userid'}; + $otherUser = new Bugzilla::User($otherUserID); + edit_processing(); + } else { + $template->process('admin/users/list.html.tmpl', $vars) + || ThrowTemplateError($template->error()); + } ########################################################################### } elsif ($action eq 'add') { @@ -198,18 +208,8 @@ if ($action eq 'search') { ########################################################################### } elsif ($action eq 'edit') { - $otherUser - || ThrowCodeError('invalid_user_id', {'userid' => $cgi->param('userid')}); - - $user->can_see_user($otherUser) - || ThrowUserError('auth_failure', {reason => "not_visible", - action => "modify", - object => "user"}); - userDataToVars($otherUserID); - - $template->process('admin/users/edit.html.tmpl', $vars) - || ThrowTemplateError($template->error()); + edit_processing(); ########################################################################### } elsif ($action eq 'update') { @@ -778,3 +778,20 @@ sub userDataToVars { $vars->{'permissions'}{${$_}[0]}{'indirectbless'} = 1; } } + +sub edit_processing +{ + $otherUser + || ThrowCodeError('invalid_user_id', {'userid' => $cgi->param('userid')}); + + $user->can_see_user($otherUser) + || ThrowUserError('auth_failure', {reason => "not_visible", + action => "modify", + object => "user"}); + + userDataToVars($otherUserID); + + $template->process('admin/users/edit.html.tmpl', $vars) + || ThrowTemplateError($template->error()); + +} diff --git a/template/en/default/admin/users/edit.html.tmpl b/template/en/default/admin/users/edit.html.tmpl index 53ea17f210..ce593ee65b 100644 --- a/template/en/default/admin/users/edit.html.tmpl +++ b/template/en/default/admin/users/edit.html.tmpl @@ -140,7 +140,7 @@ [% IF listselectionvalues %], [% END %] [% END %] - [% IF listselectionvalues %] + [% IF listselectionvalues.matchtype != 'exact' %] go back to the user list, diff --git a/template/en/default/admin/users/search.html.tmpl b/template/en/default/admin/users/search.html.tmpl index 748670a68d..4cb51ca947 100644 --- a/template/en/default/admin/users/search.html.tmpl +++ b/template/en/default/admin/users/search.html.tmpl @@ -41,6 +41,7 @@ +