Commit b9c3dbad authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 87770: make attachment.cgi work with no parameters; patch by…

Patch for bug 87770: make attachment.cgi work with no parameters; patch by GavinS <bugzilla@chimpychompy.org>; r=kiko; a=myk.
parent 2cb580b5
......@@ -68,17 +68,27 @@ my $cgi = Bugzilla->cgi;
# Main Body Execution
################################################################################
# All calls to this script should contain an "action" variable whose value
# determines what the user wants to do. The code below checks the value of
# that variable and runs the appropriate code.
# All calls to this script should contain an "action" variable whose
# value determines what the user wants to do. The code below checks
# the value of that variable and runs the appropriate code. If none is
# supplied, we default to 'view'.
# Determine whether to use the action specified by the user or the default.
my $action = $::FORM{'action'} || 'view';
# Slight awkward extra checks for the case when we came here from the
# attachment/choose.html.tmpl page
if ($action eq 'View') {
$action = 'view';
}
elsif ($action eq 'Edit') {
$action = 'edit';
}
if ($action eq "view")
{
{
validateID();
view();
view();
}
elsif ($action eq "interdiff")
{
......@@ -165,6 +175,17 @@ sub validateID
{
my $param = @_ ? $_[0] : 'id';
# Only do this check for no 'id' parameter if we are trying to
# validate the 'id' parameter
if ($param eq 'id' && !$cgi->param('id')) {
print Bugzilla->cgi->header();
$template->process("attachment/choose.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
exit;
}
# Validate the value of the "id" form field, which must contain an
# integer that is the ID of an existing attachment.
......
......@@ -46,7 +46,7 @@ my $single = !$cgi->param('format')
&& (!$cgi->param('ctype') || $cgi->param('ctype') eq 'html');
# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
if (!defined $cgi->param('id') && $single) {
if (!$cgi->param('id') && $single) {
print Bugzilla->cgi->header();
$template->process("bug/choose.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
......
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Gavin Shelley <bugzilla@chimpychompy.org>
#%]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS global/header.html.tmpl
title = "Locate attachment"
%]
<form method="get" action="attachment.cgi">
<p>Access an attachment by entering its ID into the form below:</p>
<p>Attachment ID: <input name="id" size="6">
<input type="submit" name="action" value="Edit">
<input type="submit" name="action" value="View">
</p>
</form>
<form method="get" action="show_bug.cgi">
<p>Or, access it from the list of attachments in its associated [% terms.bug %] report:</p>
<p>[% terms.Bug %] ID: <input name="id" size="6">
<input type="submit" name="action" value="View">
</p>
</form>
[% PROCESS global/footer.html.tmpl %]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment