Bug 137810 - add diff for Large Text Box

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1868 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vkoptev 2013-12-10 11:21:42 +00:00
parent 6b768e4fe8
commit a2dee9c239
4 changed files with 14 additions and 8 deletions

View File

@ -635,7 +635,8 @@ sub sendMail
for my $change (@$diffs)
{
if ($change->{'fieldname'} eq 'longdesc')
my $field = Bugzilla->get_field($change->{'fieldname'});
if (($change->{'fieldname'} eq 'longdesc') || ($field->{'type'} eq FIELD_TYPE_TEXTAREA))
{
my $diff = new Bugzilla::Diff($change->{'removed'}, $change->{'added'});
$change->{'both'} = $diff->get_table;

View File

@ -427,27 +427,30 @@ sub glue_context_i
{
$array->[$i]->{'value'} = TAGS->{$act}->[0] . $array->[$i]->{'value'} . TAGS->{$act}->[1] . $array->[$i+1]->{'value'};
$array->[$i]->{'type'} = TYPE_UNI . $act;
my $result = $self->glue_context_i($i, 'added') if ($what eq 'removed');
splice $array, $i+1, 1;
return $self->glue_context_i($i, 'added') if ($what eq 'removed');
return $result if ($what eq 'removed');
return -1;
}
elsif (substr($array->[$i]->{'type'}, 0, 1) eq TYPE_UNI && $array->[$i+1]->{'type'} eq $act)
{
$array->[$i]->{'value'} = $array->[$i]->{'value'} . TAGS->{$act}->[0] . $array->[$i+1]->{'value'} . TAGS->{$act}->[1];
$array->[$i]->{'type'} = TYPE_UNI . $act;
my $result = $self->glue_context_i($i, 'added') if ($what eq 'removed');
splice $array, $i+1, 1;
return $self->glue_context_i($i, 'added') if ($what eq 'removed');
return $result if ($what eq 'removed');
return -1;
}
elsif (($array->[$i]->{'type'} ne TYPE_SKP) && ($array->[$i+1]->{'type'} ne TYPE_SKP) && ($rarray->[$i]->{'type'} ne $ract) && ($rarray->[$i+1]->{'type'} ne $ract))
{
$array->[$i]->{'value'} = $array->[$i]->{'value'} . $array->[$i+1]->{'value'};
$array->[$i]->{'type'} = (
$array->[$i]->{'type'} ne TYPE_UNI ? $array->[$i]->{'type'} :
($array->[$i+1]->{'type'} ne TYPE_UNI ? $array->[$i+1]->{'type'} : TYPE_UNI)
$array->[$i]->{'type'} ne TYPE_UNI && $array->[$i]->{'type'} ne TYPE_EMP ? $array->[$i]->{'type'} :
($array->[$i+1]->{'type'} ne TYPE_UNI && $array->[$i+1]->{'type'} ne TYPE_EMP ? $array->[$i+1]->{'type'} : TYPE_UNI)
);
my $result = $self->glue_context_i($i, 'added') if ($what eq 'removed');
splice $array, $i+1, 1;
return $self->glue_context_i($i, 'added') if ($what eq 'removed');
return $result if ($what eq 'removed');
return -1;
}
}

View File

@ -263,7 +263,7 @@ if ($action eq 'edit' || (!$action && $product_name)) {
}
$vars->{'product'} = $product;
$vars->{'token'} = issue_session_token('edit_product');
my $controlled_fields = map { $_->id => ($_->has_visibility_value($product) ? $_->description : undef) } values $product->field->controls_visibility_of();
my $controlled_fields = {map { $_->id => ($_->has_visibility_value($product) ? $_->description : undef) } values $product->field->controls_visibility_of()};
for my $i (keys $controlled_fields) {
if (!defined($controlled_fields->{$i})) {
delete $controlled_fields->{$i};

View File

@ -30,6 +30,7 @@ use Bugzilla;
use Bugzilla::Error;
use Bugzilla::Bug;
use Bugzilla::Diff;
use Bugzilla::Constants;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
@ -64,7 +65,8 @@ for (my $i = 0; $i < (scalar @$operations); $i++)
for (my $j = 0; $j < (scalar @{$operations->[$i]->{'changes'}}); $j++)
{
my $change = $operations->[$i]->{'changes'}->[$j];
if ($change->{'fieldname'} eq 'longdesc')
my $field = Bugzilla->get_field($change->{'fieldname'});
if (($change->{'fieldname'} eq 'longdesc') || ($field->{'type'} eq FIELD_TYPE_TEXTAREA))
{
my $diff = new Bugzilla::Diff($change->{'removed'}, $change->{'added'});
$operations->[$i]->{'changes'}->[$j]->{'both'} = $diff->get_table;