summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-09-05 03:45:10 +0200
committerlpsolit%gmail.com <>2005-09-05 03:45:10 +0200
commit012dada9941e13b7a1b18875754ec12ee217d433 (patch)
tree232d38f666700bbd284a79a322d6af6058d14b53
parent461409095f1b7e69db65ce9756e5321aa0b3922e (diff)
downloadbugzilla-012dada9941e13b7a1b18875754ec12ee217d433.tar.gz
bugzilla-012dada9941e13b7a1b18875754ec12ee217d433.tar.xz
Bug 304268: edit users form should have an item for "edit this user" - Patch by GavinS <bugzilla@chimpychompy.org> r=wurblzap a=justdave
-rwxr-xr-xeditusers.cgi43
-rw-r--r--template/en/default/admin/users/edit.html.tmpl2
-rw-r--r--template/en/default/admin/users/search.html.tmpl1
3 files changed, 32 insertions, 14 deletions
diff --git a/editusers.cgi b/editusers.cgi
index b7ce52b3e..e6d4fffe8 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 53ea17f21..ce593ee65 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
<a href="editusers.cgi?action=list[% INCLUDE listselectionurlparams %]">back
to the user list</a>,
diff --git a/template/en/default/admin/users/search.html.tmpl b/template/en/default/admin/users/search.html.tmpl
index 748670a68..4cb51ca94 100644
--- a/template/en/default/admin/users/search.html.tmpl
+++ b/template/en/default/admin/users/search.html.tmpl
@@ -41,6 +41,7 @@
<option value="substr" selected="selected">case-insensitive substring</option>
<option value="regexp">case-insensitive regexp</option>
<option value="notregexp">not (case-insensitive regexp)</option>
+ <option value="exact">exact (find this user)</option>
</select>
<input type="submit" value="Search" /></p>