diff options
author | lpsolit%gmail.com <> | 2005-07-11 07:37:05 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-07-11 07:37:05 +0200 |
commit | 50181f709d79780ec54c6ed2b90af08327bbdf5b (patch) | |
tree | 85cf381d0e99f7f5ba34260eb2d6ed7f85f85f23 /process_bug.cgi | |
parent | f7f3311ba8e7c11dd1860c943eadd3a467a4c6f3 (diff) | |
download | bugzilla-50181f709d79780ec54c6ed2b90af08327bbdf5b.tar.gz bugzilla-50181f709d79780ec54c6ed2b90af08327bbdf5b.tar.xz |
Bug 63536: User preference for whether or not to go to the next bug after processing - Patch by byron jones (glob) <bugzilla@glob.com.au> r=LpSolit a=justdave
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-x | process_bug.cgi | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/process_bug.cgi b/process_bug.cgi index 4b6410b2c..58e52f83c 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -193,20 +193,10 @@ if (defined $cgi->param('id')) { } # Set up the vars for nagiavtional <link> elements -my $next_bug; +my @bug_list; if ($cgi->cookie("BUGLIST") && defined $cgi->param('id')) { - my @bug_list = split(/:/, $cgi->cookie("BUGLIST")); + @bug_list = split(/:/, $cgi->cookie("BUGLIST")); $vars->{'bug_list'} = \@bug_list; - my $cur = lsearch(\@bug_list, $cgi->param("id")); - if ($cur >= 0 && $cur < $#bug_list) { - $next_bug = $bug_list[$cur + 1]; - - # Note that we only bother with the bug_id here, and get - # the full bug object at the end, before showing the edit - # page. If you change this, remember that we have not - # done the security checks on the next bug yet - $vars->{'bug'} = { bug_id => $next_bug }; - } } GetVersionTable(); @@ -1829,28 +1819,47 @@ foreach my $id (@idlist) { } } -# now show the next bug -if ($next_bug) { - if (detaint_natural($next_bug) && Bugzilla->user->can_see_bug($next_bug)) { - my $bug = new Bugzilla::Bug($next_bug, $whoid); - ThrowCodeError("bug_error", { bug => $bug }) if $bug->error; +# Determine if Patch Viewer is installed, for Diff link +# (NB: Duplicate code with show_bug.cgi.) +eval { + require PatchReader; + $vars->{'patchviewerinstalled'} = 1; +}; - # next.html.tmpl includes edit.html.tmpl, and therefore we - # need $bug defined in $vars. - $vars->{'bug'} = $bug; +$action = Bugzilla->user->settings->{'post_bug_submit_action'}->{'value'}; - # And we need to determine if Patch Viewer is installed, for - # Diff link (NB: Duplicate code with show_bug.cgi.) - eval { - require PatchReader; - $vars->{'patchviewerinstalled'} = 1; - }; +if ($action eq 'next_bug') { + my $next_bug; + my $cur = lsearch(\@bug_list, $cgi->param("id")); + if ($cur >= 0 && $cur < $#bug_list) { + $next_bug = $bug_list[$cur + 1]; + } + if ($next_bug) { + if (detaint_natural($next_bug) && Bugzilla->user->can_see_bug($next_bug)) { + my $bug = new Bugzilla::Bug($next_bug, $whoid); + ThrowCodeError("bug_error", { bug => $bug }) if $bug->error; - $template->process("bug/process/next.html.tmpl", $vars) - || ThrowTemplateError($template->error()); + $vars->{'bugs'} = [$bug]; + $vars->{'nextbug'} = $bug->bug_id; - exit; + $template->process("bug/show.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + + exit; + } } +} elsif ($action eq 'same_bug') { + my $bug = new Bugzilla::Bug($cgi->param('id'), $whoid); + ThrowCodeError("bug_error", { bug => $bug }) if $bug->error; + + $vars->{'bugs'} = [$bug]; + + $template->process("bug/show.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + + exit; +} elsif ($action ne 'nothing') { + ThrowCodeError("invalid_post_bug_submit_action"); } # End the response page. |