Bug 91404 - Split takebug/reopen in create attachment form, fix ctrl-enter on attachment form

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1486 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-12-27 13:55:22 +00:00
parent 9b1c21aaeb
commit c94db8378b
2 changed files with 55 additions and 45 deletions

View File

@ -443,7 +443,8 @@ sub enter {
}
# Insert a new attachment into the database.
sub insert {
sub insert
{
my $dbh = Bugzilla->dbh;
my $user = Bugzilla->user;
@ -471,7 +472,7 @@ sub insert {
if ($old_attach_id) {
$vars->{'bugid'} = $bugid;
$vars->{'attachid'} = $old_attach_id;
$template->process("attachment/cancel-create-dupe.html.tmpl", $vars)
$template->process("attachment/cancel-create-dupe.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
@ -498,8 +499,9 @@ sub insert {
if (Bugzilla->params->{utf8})
{
# CGI::upload() will probably return non-UTF8 string, so set UTF8 flag on
# utf8::decode() and Encode::_utf8_on() do not work on tainted scalars...
# CGI::upload() will probably return non-UTF8 string, so set UTF8 flag on it.
# Trick taint as utf8::decode() and Encode::_utf8_on() don't work on scalars
# which were once tainted...
$filename = trick_taint_copy($filename);
Encode::_utf8_on($filename);
}
@ -537,20 +539,20 @@ sub insert {
work_time => scalar $cgi->param('work_time'),
extra_data => $attachment->id });
# Assign the bug to the user, if they are allowed to take it
my $owner = "";
if ($cgi->param('takebug') && $user->in_group('editbugs', $bug->product_id)) {
# When taking a bug, we have to follow the workflow.
my $bug_status = $cgi->param('bug_status') || '';
($bug_status) = grep {$_->name eq $bug_status} @{$bug->status->can_change_to};
# When changing the bug status, we have to follow the workflow.
my $bug_status = $cgi->param('bug_status');
($bug_status) = grep { $_->name eq $bug_status } @{$bug->status->can_change_to};
if ($bug_status && $bug_status->is_open
&& ($bug_status->name ne 'UNCONFIRMED' || $bug->product_obj->allows_unconfirmed))
{
$bug->set_status($bug_status->name);
$bug->clear_resolution();
}
if ($bug_status && $bug_status->is_open
&& ($bug_status->name ne 'UNCONFIRMED'
|| $bug->product_obj->allows_unconfirmed))
{
$bug->set_status($bug_status->name);
$bug->clear_resolution();
}
# Assign the bug to the user, if they are allowed to take it
my $owner = '';
if ($cgi->param('takebug'))
{
# Make sure the person we are taking the bug from gets mail.
$owner = $bug->assigned_to->login;
$bug->set_assigned_to($user);

View File

@ -66,33 +66,38 @@
</td>
</tr>
[% IF (user.id != bug.assigned_to.id) AND user.in_group("editbugs", bug.product_id) %]
<tr>
<th>Reassignment:</th>
<td>
<em>If you want to assign this [% terms.bug %] to yourself,
check the box below.</em><br>
<input type="checkbox" id="takebug" name="takebug" value="1">
<label for="takebug">take [% terms.bug %]</label>
[% bug_statuses = [] %]
[% FOREACH bug_status = bug.status.can_change_to %]
[% NEXT IF bug_status.name == "UNCONFIRMED"
&& !bug.product_obj.allows_unconfirmed %]
[% bug_statuses.push(bug_status) IF bug_status.is_open %]
[% END %]
[% IF bug_statuses.size %]
<label for="takebug">and set the [% terms.bug %] status to</label>
<select id="bug_status" name="bug_status">
<option value="[% bug.status.name FILTER html %]">[% bug.status.name FILTER html %] (current)</option>
[% FOREACH bug_status = bug_statuses %]
[% NEXT IF bug_status.id == bug.status.id %]
<option value="[% bug_status.name FILTER html %]">[% bug_status.name FILTER html %]</option>
[% END %]
</select>
[% END %]
</td>
</tr>
[% IF user.id != bug.assigned_to.id %]
<tr>
<th>Reassignment:</th>
<td>
<em>If you want to assign this [% terms.bug %] to yourself,
check the box below.</em><br />
<input type="checkbox" id="takebug" name="takebug" value="1">
<label for="takebug">take [% terms.bug %]</label>
</td>
</tr>
[% END %]
[% bug_statuses = [] %]
[% FOREACH bug_status = bug.status.can_change_to %]
[% NEXT IF bug_status.name == "UNCONFIRMED" && !bug.product_obj.allows_unconfirmed %]
[% bug_statuses.push(bug_status) IF bug_status.is_open %]
[% END %]
[% IF bug_statuses.size %]
<tr>
<th><label for="bug_status">Change bug status to:</label></th>
<td>
<select id="bug_status" name="bug_status">
<option value="[% bug.status.name FILTER html %]">[% bug.status.name FILTER html %] (current)</option>
[% FOREACH bug_status = bug_statuses %]
[% NEXT IF bug_status.id == bug.status.id %]
<option value="[% bug_status.name FILTER html %]">[% bug_status.name FILTER html %]</option>
[% END %]
</select>
</td>
</tr>
[% END %]
<tr>
<th><label for="work_time">Hours Worked:</label></th>
<td><input type="text" size="10" value="0.0" name="work_time" id="work_time" /></td>
@ -120,7 +125,7 @@
<th>Privacy:</th>
<td>
<input type="checkbox" name="isprivate" id="isprivate"
value="1" onClick="updateCommentPrivacy(this)">
value="1" onClick="updateCommentPrivacy(this)" />
<label for="isprivate">
Make attachment and comment private (visible only to members of
the <strong>[% Param('insidergroup') FILTER html %]</strong>
@ -131,7 +136,10 @@
[% END %]
<tr>
<th>&nbsp;</th>
<td><input type="submit" id="create" value="Submit"> <input type="button" value="Preview comment" onclick="showcommentpreview()" tabindex="-1" /></td>
<td>
<input type="submit" id="commit" value="Submit" />
<input type="button" value="Preview comment" onclick="showcommentpreview()" tabindex="-1" />
</td>
</tr>
</table>