Bug 45485 - MSIE doesnt support document.evaluate, allow to delete estimates

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@858 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-07-08 11:23:19 +00:00
parent 8ae26b1c58
commit 6a276d91e1
2 changed files with 22 additions and 10 deletions

View File

@ -79,12 +79,20 @@ if (defined $sprint && defined $type)
if ($cgi->param('save'))
{
my $estimate = {};
my $del = {};
foreach ($cgi->param)
{
if (/^estimate_(\d+)$/s && $cgi->param($_))
if (/^estimate_(\d+)$/s)
{
$estimate->{$1} = $cgi->param($_);
trick_taint($estimate->{$1});
if ($cgi->param($_))
{
$estimate->{$1} = $cgi->param($_);
trick_taint($estimate->{$1});
}
else
{
$del->{$1} = 1;
}
}
}
if (%$estimate)
@ -94,6 +102,12 @@ if (defined $sprint && defined $type)
@bind = map { ($_, $sprint, $type, $estimate->{$_}) } keys %$estimate;
$dbh->do($sql, undef, @bind);
}
if (%$del)
{
$sql = 'DELETE FROM scrum_cards WHERE bug_id IN ('.join(',', ('?') x keys %$del).')';
@bind = keys %$del;
$dbh->do($sql, undef, @bind);
}
print $cgi->redirect(-location => 'editscrum.cgi?sprint_select=1&type_select=1&sprint='.url_quote($sprint).'&type='.url_quote($type).'&id='.join(',', map { $_->id } @bug_objects));
exit;
}

View File

@ -34,7 +34,7 @@
[% ELSE %]
<td style="background-color: #c0c0c0; color: gray">&lt;empty&gt;</td>
[% END %]
<td><input type="text" name="estimate_[% b.id %]" value="[% estimates.${b.id} | html %]" onchange="update_hours_total()" /></td>
<td><input type="text" id="estimate_[% loop.count %]" name="estimate_[% b.id %]" value="[% estimates.${b.id} | html %]" onchange="update_hours_total()" /></td>
</tr>
[% END %]
<tr>
@ -45,15 +45,13 @@
<script language="JavaScript">
function update_hours_total()
{
var r = document.evaluate('//table[@id="estimates_table"]//input[starts-with(@name,"estimate_")]', document, null, XPathResult.ANY_TYPE, null);
var i;
var s = 0;
var v;
while (i = r.iterateNext())
var i = 1, e, v, s = 0;
while (e = document.getElementById('estimate_'+i))
{
v = parseInt(i.value);
v = parseInt(e.value);
if (v == v)
s += v;
i++;
}
document.getElementById('hours_total').innerHTML = s;
}