]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 304268: edit users form should have an item for "edit this user" - Patch by Gavin...
authorlpsolit%gmail.com <>
Mon, 5 Sep 2005 01:45:10 +0000 (01:45 +0000)
committerlpsolit%gmail.com <>
Mon, 5 Sep 2005 01:45:10 +0000 (01:45 +0000)
editusers.cgi
template/en/default/admin/users/edit.html.tmpl
template/en/default/admin/users/search.html.tmpl

index b7ce52b3e4c675741a007fc12cdb2ebada4be6f7..e6d4fffe8550fb00ac0411c4c4aca7e88d6776b1 100755 (executable)
@@ -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());
+
+}
index 53ea17f210e1405fc0417fe01f6932645f9300ac..ce593ee65ba3453a4abbbbf8068d11c35ea58696 100644 (file)
     [% 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>,
index 748670a68dac0b2eaeda5c6d0988c37bbf2ecdb0..4cb51ca947eccf54b2d446c738e3a1a6bee8afa9 100644 (file)
@@ -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>