Some more fixes for ID fields, fix field list style

master
Vitaliy Filippov 2014-04-15 16:27:37 +04:00
parent 684a8cde1a
commit 7ec8a7d39f
16 changed files with 93 additions and 75 deletions

View File

@ -2153,14 +2153,17 @@ sub _set_select_field
{
my ($self, $value, $field) = @_;
my $field_obj = Bugzilla->get_field($field);
# Allow empty values, but only for nullable or invisible fields
if ((!defined $value || !length $value) &&
($field_obj->nullable || !$field_obj->check_visibility($self)))
{
$self->{$field.'_obj'} = undef;
return $self->{$field} = undef;
}
my $t = Bugzilla::Field::Choice->type($field_obj);
if (!defined $value || !length $value)
{
# Allow empty values, but only for nullable or invisible fields
if ($field_obj->nullable || !$field_obj->check_visibility($self))
{
$self->{$field.'_obj'} = undef;
return $self->{$field} = undef;
}
ThrowUserError('object_not_specified', { class => $t });
}
my $value_obj = $t->new({ name => $value });
if (!$value_obj)
{

View File

@ -678,6 +678,7 @@ sub check_visibility
my $bug = shift || return 1;
my $vf = $self->visibility_field || return 1;
my $m = $vf->name;
$m = Bugzilla::Bug->OVERRIDE_ID_FIELD->{$m} || $m;
my $value = blessed $bug ? $bug->$m : $bug->{$m};
return 1 unless $value;
if (!blessed $value)
@ -1079,7 +1080,7 @@ sub populate_field_definitions
{
my $dbh = Bugzilla->dbh;
my ($has_clone_bug) = $dbh->selectrow_array('SELECT 1 FROM fielddefs WHERE clone_bug AND NOT custom');
my ($has_nullable) = $dbh->selectrow_array('SELECT 1 FROM fielddefs WHERE nullable AND NOT custom');
# Add/update field definitions
foreach my $def (DEFAULT_FIELDS)
@ -1091,8 +1092,8 @@ sub populate_field_definitions
$field->set_in_new_bugmail($def->{in_new_bugmail});
$field->set_buglist($def->{buglist});
$field->_set_type($def->{type}) if $def->{type};
$field->set_clone_bug($def->{clone_bug}) if !$has_clone_bug;
$field->set_nullable($def->{nullable}) if !$has_clone_bug;
$field->set_clone_bug($def->{clone_bug}) if !$has_nullable;
$field->set_nullable($def->{nullable}) if !$has_nullable;
$field->update();
}
else

View File

@ -296,7 +296,7 @@ foreach my $b (@bug_objects)
my $gid = $group->id;
if (defined $ARGS->{"bit-$gid"} || defined $ARGS->{"defined_bit-$gid"})
{
$g ||= { map { $_->id => 1 } @{$b->groups} };
$g ||= { map { $_->{bit} => 1 } @{$b->groups} };
# Check ! first to avoid having to check defined below.
if (!$ARGS->{"bit-$gid"})
{

View File

@ -29,7 +29,7 @@
color: #000;
background: #fff url("global/body-back.gif") repeat-x;
}
body, td, th, input, select {
body, td, th, input, select, textarea {
font-family: Verdana, sans-serif;
font-size: small;
}

View File

@ -44,15 +44,38 @@
},
{
name => "enter_bug"
heading => "Editable on $terms.Bug Creation"
heading => "Entry"
hint => "Can be set on $terms.Bug Creation"
content_values => { '0' => '', '1' => 'Yes' }
align => 'center'
},
{
name => "mailhead"
heading => "In ${terms.Bug}mail on $terms.Bug Creation"
heading => "${terms.Bug}mail",
hint => "Included in ${terms.bug}mail for new $terms.bugs"
content_values => { '0' => '', '1' => 'Yes' }
align => 'center'
},
{
name => "obsolete"
heading => "Is Obsolete"
heading => "Obsolete"
hint => "Is disabled and unused"
content_values => { '0' => '', '1' => 'Yes' }
align => 'center'
},
{
name => "clone_bug"
heading => "Cloned"
hint => "Is copied into the cloned bug"
content_values => { '0' => '', '1' => 'Yes' }
align => 'center'
},
{
name => "nullable"
heading => "Nullable"
hint => "Allows empty (NULL) value"
content_values => { '0' => '', '1' => 'Yes' }
align => 'center'
},
{
name => "action"
@ -99,34 +122,10 @@
<h2>Standard fields</h2>
[% columns = [
{
name => "name"
heading => "Edit field..."
contentlink => "editfields.cgi?action=edit&amp;name=%%name%%"
},
{
name => "description"
heading => "Description"
},
{
name => "sortkey"
heading => "Sortkey"
},
{
name => "type"
heading => "Type"
},
{
name => "mailhead"
heading => "In ${terms.Bug}mail on $terms.Bug Creation"
},
{
name => "obsolete"
heading => "Is Obsolete"
},
]
%]
[%# Remove 'action' and 'entry' columns %]
[%# FIXME: 'entry' column should be filled for standard fields %]
[% SET c = columns.pop() %]
[% SET c = columns.splice(4, 1) %]
[% PROCESS admin/table.html.tmpl
columns = columns

View File

@ -29,7 +29,7 @@
[% END %]
<tr>
<th align="left"><label for="product">Name:</label></th>
<th align="left"><label for="product">Product:</label></th>
<td><input size="64" maxlength="64" name="product" id="product" value="[% product.name | html %]" /></td>
</tr>

View File

@ -88,7 +88,13 @@
[% FOREACH c = columns %]
[%# Default to align left for headers %]
<th align="[% (c.align || 'left') FILTER html %]">
[% c.heading FILTER html %]
[% IF c.hint %]
<abbr title="[% c.hint | html %]">
[% c.heading FILTER html %]
</abbr>
[% ELSE %]
[% c.heading FILTER html %]
[% END %]
</th>
[% END %]
</tr>

View File

@ -113,12 +113,12 @@
];
function onchange_bug_status()
{
showHideStatusItems('[% "is_duplicate" IF bug.dup_id %]', '[% bug.bug_status | js %]');
showHideStatusItems('[% "is_duplicate" IF bug.dup_id %]', '[% bug.bug_status_obj.name | js %]');
}
addListener('bug_status', 'change', onchange_bug_status);
addListener('resolution', 'change', showDuplicateItem);
addListener(window, 'load', function() {
showHideStatusItems('[% "is_duplicate" IF bug.dup_id %]', '[% bug.bug_status | js %]');
showHideStatusItems('[% "is_duplicate" IF bug.dup_id %]', '[% bug.bug_status_obj.name | js %]');
});
</script>

View File

@ -146,9 +146,9 @@
[% END %]
[% BLOCK buginfo %]
[% bug.bug_status FILTER html -%] [%+ bug.resolution FILTER html %];
[% bug.bug_status_obj.name FILTER html -%] [%+ bug.resolution_obj.name FILTER html IF bug.resolution %];
[%-%] assigned to [% bug.assigned_to.login FILTER email FILTER html %]
[%-%][% "; Target: " _ bug.target_milestone IF bug.target_milestone %]
[%-%][% "; Target: " _ bug.target_milestone_obj.name FILTER html IF bug.target_milestone %]
[% END %]
[%###########################################################################%]

View File

@ -33,8 +33,8 @@
[% filtered_desc = bug.short_desc FILTER html %]
[% subheader = filtered_desc %]
[% filtered_timestamp = bug.delta_ts FILTER time %]
[% filtered_prodcomp = bug.product _ '/' _ bug.component | html %]
[% filtered_stat = bug.bug_status _ ' ' _ bug.resolution | html %]
[% filtered_prodcomp = bug.product_obj.name _ '/' _ bug.component_obj.name | html %]
[% filtered_stat = bug.bug_status_obj.name _ ' ' _ bug.resolution_obj.name | html %]
[% title = "$terms.Bug $bug.bug_id &ndash; $filtered_desc &ndash; $filtered_prodcomp &ndash; $filtered_stat" %]
[% header = "$terms.Bug&nbsp;$bug.bug_id" %]
[% header_addl_info = "Last modified: $filtered_timestamp" %]
@ -43,9 +43,9 @@
[% doc_section = "bug_page.html" %]
[% bodyclasses = ['bz_bug',
"bz_status_$bug.bug_status",
"bz_product_$bug.product",
"bz_component_$bug.component",
"bz_status_${bug.bug_status_obj.name}",
"bz_product_${bug.product_obj.name}",
"bz_component_${bug.component_obj.name}",
"bz_bug_$bug.bug_id",
] %]
[% FOREACH group = bug.groups_in %]

View File

@ -184,7 +184,7 @@
<td width="80" valign="top">
<b>[% "$terms.Bug $id" FILTER bug_link(id) FILTER none %]</b>
</td>
<td width="100"><b>[% bugs.$id.bug_status FILTER html %]</b></td>
<td width="100"><b>[% bugs.$id.bug_status_obj.name FILTER html %]</b></td>
<td colspan="2">[% bugs.$id.short_desc FILTER html %]</td>
[% IF extra %]
<td align="right" valign="top">[% bugdata.total_time FILTER html %]</td>

View File

@ -103,17 +103,17 @@
</td>
<td class="count">[% item.count FILTER html %]</td>
<td class="delta">[% item.delta FILTER html %]</td>
<td class="component">[% bug.component FILTER html %]</td>
<td class="component">[% bug.component_obj.name FILTER html %]</td>
<td class="bug_severity">
[%- bug.bug_severity FILTER html %]
[%- bug.bug_severity_obj.name FILTER html IF bug.bug_severity %]
</td>
[% IF Param('useopsys') %]
<td class="op_sys">
[%- bug.op_sys FILTER html %]
[%- bug.op_sys_obj.name FILTER html IF bug.op_sys %]
</td>
[% END %]
<td class="target_milestone">
[% bug.target_milestone FILTER html %]
[% bug.target_milestone_obj.name FILTER html IF bug.target_milestone %]
</td>
<td class="short_desc">[% bug.short_desc FILTER html %]</td>
</tr>

View File

@ -59,17 +59,23 @@ X-Bugzilla-Classification: [% bug.classification %]
X-Bugzilla-Product: [% bug.product %]
X-Bugzilla-Component: [% bug.component %]
X-Bugzilla-Keywords: [% bug.keywords %]
X-Bugzilla-Severity: [% bug.bug_severity %]
[% IF bug.bug_severity %]
X-Bugzilla-Severity: [% bug.bug_severity_obj.name %]
[% END %]
X-Bugzilla-Who: [% user.email %]
X-Bugzilla-Status: [% bug.bug_status %]
X-Bugzilla-Priority: [% bug.priority %]
X-Bugzilla-Status: [% bug.bug_status_obj.name %]
[% IF bug.priority %]
X-Bugzilla-Priority: [% bug.priority_obj.name %]
[% END %]
[% IF bug.assigned_to %]
X-Bugzilla-Assigned-To: [% bug.assigned_to.email %]
[% END %]
[% IF Param('useqacontact') AND bug.qa_contact %]
X-Bugzilla-QA-Contact: [% bug.qa_contact.email %]
[% END %]
X-Bugzilla-Target-Milestone: [% bug.target_milestone %]
[% IF bug.target_milestone %]
X-Bugzilla-Target-Milestone: [% bug.target_milestone_obj.name %]
[% END %]
[%+ threadingmarker %]
[% USE date %]
[% SET boundary = "--" _ date.now %]
@ -143,7 +149,10 @@ body { font-family: Segoe UI, sans-serif; }
[% END %]
</p>
<p><a style="font-size: 120%" href="[% urlbase %]show_bug.cgi?id=[% bug.bug_id %]#[% flag ? flag.creation_date : old_flag.creation_date | timestamp %]">[% terms.Bug %] [%+ bugidsummary %]</a>
<br /><span style="font-size: 90%">(prod:[% bug.product %].[% bug.component %], pri:[% bug.priority %], sev:[% bug.bug_severity %], miles:[% bug.target_milestone %])</span>
<br /><span style="font-size: 90%">(prod:[% bug.product %].[% bug.component -%]
[%- IF bug.priority %], pri:[% bug.priority_obj.name %][% END -%]
[%- IF bug.bug_severity %], sev:[% bug.bug_severity %][% END -%]
[%- IF bug.target_milestone %], miles:[% bug.target_milestone %][% END -%])</span>
[% IF attachment %]
<br /><a href="[%+ urlbase %]attachment.cgi?id=[% attachment.id %]&action=edit">Attachment [% attidsummary %]</a>
[% END %]

View File

@ -71,12 +71,12 @@
<tr>
<td align="left"><a href="[%+ urlbase FILTER html %]show_bug.cgi?id=
[%- bug.bug_id %]">[% bug.bug_id %]</a></td>
<td align="left">[% bug.bug_severity FILTER html %]</td>
<td align="left">[% bug.priority FILTER html %]</td>
<td align="left">[% bug.rep_platform FILTER html %]</td>
<td align="left">[% bug.bug_severity_obj.name FILTER html %]</td>
<td align="left">[% bug.priority_obj.name FILTER html %]</td>
<td align="left">[% bug.rep_platform_obj.name FILTER html %]</td>
<td align="left">[% bug.assigned_to FILTER html %]</td>
<td align="left">[% bug.bug_status FILTER html %]</td>
<td align="left">[% bug.resolution FILTER html %]</td>
<td align="left">[% bug.bug_status_obj.name FILTER html %]</td>
<td align="left">[% bug.resolution_obj.name FILTER html %]</td>
<td align="left">[% bug.short_desc FILTER html %]</td>
</tr>
[% END %]

View File

@ -46,12 +46,12 @@
[% FOREACH bug=query.bugs %]
[% terms.Bug +%] [%+ bug.bug_id %]:
[%+ urlbase %]show_bug.cgi?id=[% bug.bug_id +%]
Priority: [%+ bug.priority -%]
Severity: [%+ bug.bug_severity -%]
Platform: [%+ bug.rep_platform %]
Priority: [%+ bug.priority_obj.name -%]
Severity: [%+ bug.bug_severity_obj.name -%]
Platform: [%+ bug.rep_platform_obj.name %]
Assignee: [%+ bug.assigned_to %]
Status: [%+ bug.bug_status %]
[%- IF bug.resolution -%] Resolution: [% bug.resolution -%]
Status: [%+ bug.bug_status_obj.name %]
[%- IF bug.resolution -%] Resolution: [% bug.resolution_obj.name -%]
[%- END %]
Summary: [% bug.short_desc %]

View File

@ -63,7 +63,7 @@
[% FOREACH bug = bugs %]
[% parity = (parity+1) % 3 %]
<tr class="row[% bug.priority %]">
<tr class="row[% bug.priority_obj.name %]">
<td class="first-child" align="right">
[% bug.bug_id FILTER bug_link(bug.bug_id) %]
</td>