Bug 81185, Bug 70605 - Fix chfield <select>
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1300 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
f8d92a0850
commit
a50fa41f30
|
@ -319,7 +319,7 @@ sub SPECIAL_ORDER
|
||||||
return $cache->{special_order} = $special_order;
|
return $cache->{special_order} = $special_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Backward-compatibility for old field names. Goes old_name => new_name.
|
# Backwards-compatibility for old field names. Goes old_name => new_name.
|
||||||
sub COLUMN_ALIASES
|
sub COLUMN_ALIASES
|
||||||
{
|
{
|
||||||
my $cache = Bugzilla->cache_fields;
|
my $cache = Bugzilla->cache_fields;
|
||||||
|
@ -460,7 +460,7 @@ sub STATIC_COLUMNS
|
||||||
}
|
}
|
||||||
|
|
||||||
# Do the actual column-getting from fielddefs, now.
|
# Do the actual column-getting from fielddefs, now.
|
||||||
my @bugsjoin;
|
my @bugid_fields;
|
||||||
foreach my $field (Bugzilla->get_fields)
|
foreach my $field (Bugzilla->get_fields)
|
||||||
{
|
{
|
||||||
my $id = $field->name;
|
my $id = $field->name;
|
||||||
|
@ -470,19 +470,19 @@ sub STATIC_COLUMNS
|
||||||
$columns->{$id}->{nocharts} = $field->obsolete;
|
$columns->{$id}->{nocharts} = $field->obsolete;
|
||||||
if ($field->type == FIELD_TYPE_BUG_ID)
|
if ($field->type == FIELD_TYPE_BUG_ID)
|
||||||
{
|
{
|
||||||
push @bugsjoin, $field;
|
push @bugid_fields, $field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fields of bugs related to selected by some BUG_ID type field
|
# Fields of bugs related to selected by some BUG_ID type field
|
||||||
foreach my $field (@bugsjoin)
|
foreach my $field (@bugid_fields)
|
||||||
{
|
{
|
||||||
my $id = $field->name;
|
my $id = $field->name;
|
||||||
my $join = [ "LEFT JOIN bugs bugs_$id ON bugs_$id.bug_id=bugs.$id" ];
|
my $join = [ "LEFT JOIN bugs bugs_$id ON bugs_$id.bug_id=bugs.$id" ];
|
||||||
foreach my $subfield (Bugzilla->get_fields({ obsolete => 0, buglist => 1 }))
|
foreach my $subfield (Bugzilla->get_fields({ obsolete => 0, buglist => 1 }))
|
||||||
{
|
{
|
||||||
my $subid = $subfield->name;
|
my $subid = $subfield->name;
|
||||||
if ($columns->{$subid}->{name} eq "bugs.$subid")
|
if ($subid ne 'bug_id' && $columns->{$subid}->{name} eq "bugs.$subid")
|
||||||
{
|
{
|
||||||
$columns->{$id.'_'.$subid} = {
|
$columns->{$id.'_'.$subid} = {
|
||||||
name => "bugs_$id.".$subfield->name,
|
name => "bugs_$id.".$subfield->name,
|
||||||
|
|
|
@ -807,25 +807,50 @@ sub create {
|
||||||
lc_messages => Bugzilla->messages,
|
lc_messages => Bugzilla->messages,
|
||||||
|
|
||||||
# HTML <select>
|
# HTML <select>
|
||||||
|
# html_select(name, { <attr> => <value> }, <selected value>, (
|
||||||
|
# [ { id => <option value>, name => <option text> }, ... ]
|
||||||
|
# OR
|
||||||
|
# { <option value> => <option text>, ... } # will be sorted on text
|
||||||
|
# OR
|
||||||
|
# [ <option value>, ... ], { <option value> => <option text>, ... }
|
||||||
|
# ))
|
||||||
html_select => sub
|
html_select => sub
|
||||||
{
|
{
|
||||||
my ($name, $values, $valuenames, $selected, $args) = @_;
|
my ($name, $selected, $values, $valuenames, $attrs) = @_;
|
||||||
|
$selected = '' if !defined $selected;
|
||||||
|
$selected = { map { $_ => 1 } list $selected };
|
||||||
$name = html_quote($name);
|
$name = html_quote($name);
|
||||||
my $html = '<select name="'.$name.'" id="'.$name.'">';
|
my $html = '<select name="'.$name.'" id="'.$name.'"';
|
||||||
if (ref $valuenames eq 'ARRAY')
|
if ($attrs)
|
||||||
{
|
{
|
||||||
$values = [ map { $_->{name} } @$valuenames ];
|
$html .= ' '.html_quote($_).'="'.html_quote($attrs->{$_}).'"' for keys %$attrs;
|
||||||
$valuenames = { map { $_->{name} => $_->{title} } @$valuenames };
|
}
|
||||||
|
$html .= '>';
|
||||||
|
if (ref $values eq 'HASH')
|
||||||
|
{
|
||||||
|
$valuenames = $values;
|
||||||
|
$values = [ sort { $values->{$a} cmp $values->{$b} } keys %$values ];
|
||||||
|
}
|
||||||
|
if (!$values || !@$values)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
elsif (!ref $values->[0])
|
||||||
|
{
|
||||||
|
for (@$values)
|
||||||
|
{
|
||||||
|
$html .= '<option value="'.html_quote($_).'"';
|
||||||
|
$html .= ' selected="selected"' if $selected->{$_};
|
||||||
|
$html .= '>'.html_quote($valuenames->{$_}).'</option>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$values ||= [ keys %$valuenames ];
|
for (@$values)
|
||||||
}
|
{
|
||||||
for (@$values)
|
$html .= '<option value="'.html_quote($_->{id}).'"';
|
||||||
{
|
$html .= ' selected="selected"' if $selected->{$_->{id}};
|
||||||
$html .= '<option value="'.html_quote($_).'"';
|
$html .= '>'.html_quote($_->{name}).'</option>';
|
||||||
$html .= ' selected="selected"' if $selected eq $_;
|
}
|
||||||
$html .= '>'.html_quote($valuenames->{$_}).'</option>';
|
|
||||||
}
|
}
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
return $html;
|
return $html;
|
||||||
|
|
|
@ -173,7 +173,11 @@ if (!@{$default->{chfieldto}} || $default->{chfieldto}->[0] eq '')
|
||||||
}
|
}
|
||||||
|
|
||||||
# "where one or more of the following changed:"
|
# "where one or more of the following changed:"
|
||||||
$vars->{chfield} = [ map { $_->name } @{ Bugzilla::Search->CHANGEDFROMTO_FIELDS } ];
|
$vars->{chfield} = [
|
||||||
|
sort { $a->{name} cmp $b->{name} }
|
||||||
|
map { { id => $_->{name}, name => $_->{description} } }
|
||||||
|
@{ Bugzilla::Search->CHANGEDFROMTO_FIELDS }
|
||||||
|
];
|
||||||
|
|
||||||
# Boolean charts
|
# Boolean charts
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# | -------------------------- |
|
# | -------------------------- |
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
#
|
#
|
||||||
# If there is single term inside some AND/OR, it is shown without fieldset.
|
# If there is just a single term inside some AND/OR, it is shown without fieldset.
|
||||||
# So, if the whole chart consists of a single term, the form would look like:
|
# So, if the whole chart consists of a single term, the form would look like:
|
||||||
#
|
#
|
||||||
# "field type value [OR] [AND] [NOT] [OR]"
|
# "field type value [OR] [AND] [NOT] [OR]"
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
[% FOREACH col = row %]
|
[% FOREACH col = row %]
|
||||||
[% J = loop.count - 1 %]
|
[% J = loop.count - 1 %]
|
||||||
[% "<br />" IF J %]
|
[% "<br />" IF J %]
|
||||||
[% html_select("field$C-$I-$J", '', chart_fields, col.field) %]
|
[% html_select("field$C-$I-$J", col.field, chart_fields) %]
|
||||||
[%- html_select("type$C-$I-$J", chart_types, lc_messages.operator_descs, col.type)
|
[%- html_select("type$C-$I-$J", col.type, chart_types, lc_messages.operator_descs)
|
||||||
%]<input id="[% "value$C-$I-$J" %]" name="[% "value$C-$I-$J" %]" value="[% col.value | html %]" size="40" />
|
%]<input id="[% "value$C-$I-$J" %]" name="[% "value$C-$I-$J" %]" value="[% col.value | html %]" size="40" />
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ addListener(window, 'load', function() {
|
||||||
<th align="right">
|
<th align="right">
|
||||||
<label for="short_desc" accesskey="s"><u>S</u>ummary</label>:
|
<label for="short_desc" accesskey="s"><u>S</u>ummary</label>:
|
||||||
</th>
|
</th>
|
||||||
<td>[% html_select('short_desc_type', text_types, lc_messages.operator_descs, default.short_desc_type.0) %]</td>
|
<td>[% html_select('short_desc_type', default.short_desc_type.0, text_types, lc_messages.operator_descs) %]</td>
|
||||||
<td>
|
<td>
|
||||||
<input name="short_desc" id="short_desc" size="40"
|
<input name="short_desc" id="short_desc" size="40"
|
||||||
value="[% default.short_desc.0 FILTER html %]">
|
value="[% default.short_desc.0 FILTER html %]">
|
||||||
|
@ -219,7 +219,7 @@ addListener(window, 'load', function() {
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
[% t = field.name _ '_type' %]
|
[% t = field.name _ '_type' %]
|
||||||
[% html_select(t, text_types, lc_messages.operator_descs, default.$t.0) %]
|
[% html_select(t, default.$t.0, text_types, lc_messages.operator_descs) %]
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input name="[% field.name %]" id="[% field.name %]" size="40"
|
<input name="[% field.name %]" id="[% field.name %]" size="40"
|
||||||
|
@ -236,7 +236,7 @@ addListener(window, 'load', function() {
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
[% keywords_types = ['allwords', 'anywords', 'nowords', 'regexp', 'notregexp'] %]
|
[% keywords_types = ['allwords', 'anywords', 'nowords', 'regexp', 'notregexp'] %]
|
||||||
[% html_select('keywords_type', keywords_types, lc_messages.operator_descs, default.keywords_type.0) %]
|
[% html_select('keywords_type', default.keywords_type.0, keywords_types, lc_messages.operator_descs) %]
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input name="keywords" id="keywords" size="40"
|
<input name="keywords" id="keywords" size="40"
|
||||||
|
@ -442,18 +442,13 @@ addListener(window, 'load', function() {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select name="emailtype[% n %]">
|
[% html_select('emailtype' _ n, default.emailtype.$n, [
|
||||||
[% FOREACH qv = [
|
{ id => "exact", name => "is" },
|
||||||
{ name => "exact", description => "is" },
|
{ id => "substring", name => "contains" },
|
||||||
{ name => "substring", description => "contains" },
|
{ id => "notequals", name => "is not" },
|
||||||
{ name => "notequals", description => "is not" },
|
{ id => "regexp", name => "matches regexp" },
|
||||||
{ name => "regexp", description => "matches regexp" },
|
{ id => "notregexp", name => "doesn't match regexp" }
|
||||||
{ name => "notregexp", description => "doesn't match regexp" } ] %]
|
]) %]
|
||||||
|
|
||||||
<option value="[% qv.name %]"
|
|
||||||
[% " selected" IF default.emailtype.$n == qv.name %]>[% qv.description %]</option>
|
|
||||||
[% END %]
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -492,8 +487,7 @@ addListener(window, 'load', function() {
|
||||||
<label for="votes">Only [% terms.bugs %] with at least</label>:
|
<label for="votes">Only [% terms.bugs %] with at least</label>:
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input name="votes" id="votes" size="3"
|
<input name="votes" id="votes" size="3" value="[% default.votes.0 FILTER html %]" />
|
||||||
value="[% default.votes.0 FILTER html %]">
|
|
||||||
votes
|
votes
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -517,25 +511,12 @@ addListener(window, 'load', function() {
|
||||||
<input name="chfieldfrom" id="chfieldfrom"
|
<input name="chfieldfrom" id="chfieldfrom"
|
||||||
size="10" value="[% default.chfieldfrom.0 FILTER html %]">
|
size="10" value="[% default.chfieldfrom.0 FILTER html %]">
|
||||||
and <input name="chfieldto" size="10" value="[% default.chfieldto.0 FILTER html %]">
|
and <input name="chfieldto" size="10" value="[% default.chfieldto.0 FILTER html %]">
|
||||||
<br>(YYYY-MM-DD or relative dates)
|
<br />(YYYY-MM-DD or relative dates)
|
||||||
</dd>
|
</dd>
|
||||||
<dt><label for="chfieldwho">By user:</label></dt>
|
<dt><label for="chfieldwho">By user:</label></dt>
|
||||||
<dd><input name="chfieldwho" id="chfieldwho" size="20" value="[% default.chfieldwho.0 | html %]" /> (user login)</dd>
|
<dd><input name="chfieldwho" id="chfieldwho" size="20" value="[% default.chfieldwho.0 | html %]" /> (user login)</dd>
|
||||||
<dt><label for="chfield">where one or more of the following changed</label>:</dt>
|
<dt><label for="chfield">where one or more of the following changed</label>:</dt>
|
||||||
<dd>
|
<dd>[% html_select('chfield', default.chfield, chfield, '', { multiple => 'multiple' }) %]</dd>
|
||||||
[% chfields = [] %]
|
|
||||||
[% FOREACH field = chfield %]
|
|
||||||
[% chfields.push({value => field, desc => (field_descs.$field || field) }) %]
|
|
||||||
[% END %]
|
|
||||||
|
|
||||||
<select name="chfield" id="chfield" multiple="multiple" size="4">
|
|
||||||
[% FOREACH field = chfields.sort('desc') %]
|
|
||||||
<option value="[% field.value FILTER html %]"
|
|
||||||
[% " selected" IF lsearch(default.chfield, field.value) != -1 %]>
|
|
||||||
[% field.desc FILTER html %]</option>
|
|
||||||
[% END %]
|
|
||||||
</select>
|
|
||||||
</dd>
|
|
||||||
<dt>and <label for="chfieldvalue">the new value was</label>:</dt>
|
<dt>and <label for="chfieldvalue">the new value was</label>:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input name="chfieldvalue" id="chfieldvalue"
|
<input name="chfieldvalue" id="chfieldvalue"
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
and remember these as my default search options
|
and remember these as my default search options
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[% IF userdefaultquery %]
|
[% IF userdefaultquery %]
|
||||||
<p>
|
<p>
|
||||||
<a href="query.cgi?nukedefaultquery=1">
|
<a href="query.cgi?nukedefaultquery=1">
|
||||||
|
|
Loading…
Reference in New Issue