mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 251669: add an option to show users in a drop down menu instead of a text edit field
patch by glob <bugzilla@glob.com.au> r=joel a=justdave
This commit is contained in:
parent
fc4d85247d
commit
a32f5d79d4
@ -21,6 +21,7 @@
|
||||
# Erik Stambaugh <erik@dasbistro.com>
|
||||
# Bradley Baetz <bbaetz@acm.org>
|
||||
# Joel Peshkin <bugreport@peshkin.net>
|
||||
# Byron Jones <bugzilla@glob.com.au>
|
||||
|
||||
################################################################################
|
||||
# Module Initialization
|
||||
@ -888,6 +889,45 @@ sub email_prefs {
|
||||
return $self->{email_prefs};
|
||||
}
|
||||
|
||||
sub get_userlist {
|
||||
my $self = shift;
|
||||
|
||||
return $self->{'userlist'} if defined $self->{'userlist'};
|
||||
|
||||
my $query = "SELECT DISTINCT login_name, realname,";
|
||||
if (&::Param('usevisibilitygroups')) {
|
||||
$query .= " COUNT(group_id) ";
|
||||
} else {
|
||||
$query .= " 1 ";
|
||||
}
|
||||
$query .= "FROM profiles ";
|
||||
if (&::Param('usevisibilitygroups')) {
|
||||
$query .= "LEFT JOIN user_group_map " .
|
||||
"ON user_group_map.user_id = userid AND isbless = 0 " .
|
||||
"AND group_id IN(" .
|
||||
join(', ', (-1, @{$self->visible_groups_inherited})) . ") " .
|
||||
"AND grant_type <> " . GRANT_DERIVED;
|
||||
}
|
||||
$query .= " WHERE disabledtext = '' GROUP BY userid";
|
||||
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute;
|
||||
|
||||
my @userlist;
|
||||
while (my($login, $name, $visible) = $sth->fetchrow_array) {
|
||||
push @userlist, {
|
||||
login => $login,
|
||||
identity => $name ? "$name <$login>" : $login,
|
||||
visible => $visible,
|
||||
};
|
||||
}
|
||||
@userlist = sort { lc $$a{'identity'} cmp lc $$b{'identity'} } @userlist;
|
||||
|
||||
$self->{'userlist'} = \@userlist;
|
||||
return $self->{'userlist'};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
@ -1032,6 +1072,12 @@ the user can select bugs. If the $by_id parameter is true, it returns
|
||||
a hash where the keys are the product ids and the values are the
|
||||
product names.
|
||||
|
||||
=item C<get_userlist>
|
||||
|
||||
Returns a reference to an array of users. The array is populated with hashrefs
|
||||
containing the login, identity and visibility. Users that are not visible to this
|
||||
user will have 'visible' set to zero.
|
||||
|
||||
=item C<visible_groups_inherited>
|
||||
|
||||
Returns a list of all groups whose members should be visible to this user.
|
||||
|
@ -1123,6 +1123,15 @@ Reason: %reason%
|
||||
default => '0'
|
||||
},
|
||||
|
||||
{
|
||||
name => 'usemenuforusers',
|
||||
desc => 'If this option is set, a popup menu will be used where a user' .
|
||||
' needs to be selected. This option should not be enabled on' .
|
||||
' sites where there are a large number of users.',
|
||||
type => 'b',
|
||||
default => '0'
|
||||
},
|
||||
|
||||
{
|
||||
name => 'usermatchmode',
|
||||
desc => 'Allow match strings to be entered for user names when entering ' .
|
||||
|
@ -185,8 +185,12 @@ function set_assign_to() {
|
||||
</strong>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<input name="assigned_to" size="32"
|
||||
value="[% assigned_to FILTER html %]">
|
||||
[% INCLUDE global/userselect.html.tmpl
|
||||
name => "assigned_to"
|
||||
value => assigned_to
|
||||
size => 32
|
||||
emptyok => 1
|
||||
%]
|
||||
<noscript>(Leave blank to assign to default component owner)</noscript>
|
||||
</td>
|
||||
</tr>
|
||||
@ -194,7 +198,12 @@ function set_assign_to() {
|
||||
<tr>
|
||||
<td align="right"><strong>Cc:</strong></td>
|
||||
<td colspan="3">
|
||||
<input name="cc" size="45" value="[% cc FILTER html %]">
|
||||
[% INCLUDE global/userselect.html.tmpl
|
||||
name => "cc"
|
||||
value => cc
|
||||
size => 45
|
||||
emptyok => 1
|
||||
%]
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -163,7 +163,13 @@
|
||||
<b><u>A</u>dd CC:</b>
|
||||
</td>
|
||||
<td>
|
||||
<input name="newcc" size="30" value="" accesskey="a">
|
||||
[% INCLUDE global/userselect.html.tmpl
|
||||
name => "newcc"
|
||||
value => ""
|
||||
accesskey => "a"
|
||||
size => 30
|
||||
emptyok => 1
|
||||
%]
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -270,8 +276,13 @@
|
||||
<b><u>Q</u>A Contact:</b>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input name="qa_contact" accesskey="q"
|
||||
value="[% bug.qa_contact.email FILTER html %]" size="60">
|
||||
[% INCLUDE global/userselect.html.tmpl
|
||||
name => "qa_contact"
|
||||
value => bug.qa_contact.email
|
||||
accesskey => "q"
|
||||
size => 60
|
||||
emptyok => 1
|
||||
%]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
@ -96,12 +96,15 @@
|
||||
<a href="page.cgi?id=fields.html#assigned_to">Reassign</a>
|
||||
[% terms.bug %] to
|
||||
</label>
|
||||
<input name="assigned_to" size="32"
|
||||
onchange="if ((this.value != '[% bug.assigned_to.email FILTER js FILTER html %]') &&
|
||||
(this.value != '')) {
|
||||
document.changeform.knob[[% knum %]].checked=true;
|
||||
}"
|
||||
value="[% bug.assigned_to.email FILTER html %]">
|
||||
[% safe_assigned_to = FILTER js; bug.assigned_to.email; END %]
|
||||
[% INCLUDE global/userselect.html.tmpl
|
||||
name => "assigned_to"
|
||||
value => bug.assigned_to.email
|
||||
size => 32
|
||||
onchange => "if ((this.value != '$safe_assigned_to') && (this.value != '')) {
|
||||
document.changeform.knob[$knum].checked=true;
|
||||
}"
|
||||
%]
|
||||
<br>
|
||||
[% IF bug.isunconfirmed && bug.user.canconfirm %]
|
||||
<input type="checkbox" id="andconfirm" name="andconfirm">
|
||||
|
@ -0,0 +1,55 @@
|
||||
[%# 1.0@bugzilla.org %]
|
||||
[%# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Bug Tracking System.
|
||||
#
|
||||
# Contributor(s): Byron Jones <bugzilla@glob.com.au>
|
||||
#%]
|
||||
|
||||
[%# INTERFACE:
|
||||
# userlist: select only; array reference with list of users and identities
|
||||
# userlist is built by Bugzilla::User::get_userlist()
|
||||
# name: mandatory; field name
|
||||
# value: optional; default field value/selection
|
||||
# onchange: optional; onchange attribute value
|
||||
# accesskey: optional, input only; accesskey attribute value
|
||||
# size: optional, input only; size attribute value
|
||||
# emptyok: optional, select only; if true, prepend menu option to start of select
|
||||
#
|
||||
#%]
|
||||
|
||||
[% IF Param("usemenuforusers") %]
|
||||
<select name="[% name FILTER html %]"
|
||||
[% IF onchange %] onchange="[% onchange FILTER html %]" [% END %]
|
||||
[% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %]
|
||||
>
|
||||
[% IF emptyok %]
|
||||
<option value=""></option>
|
||||
[% END %]
|
||||
[% FOREACH tmpuser = user.get_userlist %]
|
||||
[% IF tmpuser.visible OR value == tmpuser.login %]
|
||||
<option value="[% tmpuser.login FILTER html %]"
|
||||
[% " selected" IF value == tmpuser.login %]
|
||||
>[% tmpuser.identity FILTER html %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
[% ELSE %]
|
||||
<input
|
||||
name="[% name FILTER html %]"
|
||||
value="[% value FILTER html %]"
|
||||
[% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %]
|
||||
[% IF size %] size="[% size FILTER html %]" [% END %]
|
||||
[% IF onchange %] onchange="[% onchange FILTER html %]" [% END %]
|
||||
>
|
||||
[% END %]
|
||||
|
||||
|
@ -302,10 +302,12 @@
|
||||
<label for="knob-reassign"><a href="page.cgi?id=fields.html#assigned_to">
|
||||
Reassign</a> [% terms.bugs %] to
|
||||
</label>
|
||||
<input name="assigned_to"
|
||||
value="[% user.login FILTER html %]"
|
||||
onchange="document.forms.changeform.knob[[% knum %]].checked = true;"
|
||||
size="32"><br>
|
||||
[% INCLUDE global/userselect.html.tmpl
|
||||
name => "assigned_to"
|
||||
value => user.login
|
||||
size => 32
|
||||
onchange => "document.forms.changeform.knob[$knum].checked=true;"
|
||||
%]<br>
|
||||
|
||||
[% knum = knum + 1 %]
|
||||
<input id="knob-reassignbycomponent"
|
||||
|
Loading…
Reference in New Issue
Block a user