aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xattachment.cgi31
-rwxr-xr-xshow_bug.cgi2
-rw-r--r--template/en/default/attachment/choose.html.tmpl43
3 files changed, 70 insertions, 6 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 61565f01f..d851e537e 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -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.
diff --git a/show_bug.cgi b/show_bug.cgi
index 9093550ef..7a568e3f5 100755
--- a/show_bug.cgi
+++ b/show_bug.cgi
@@ -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());
diff --git a/template/en/default/attachment/choose.html.tmpl b/template/en/default/attachment/choose.html.tmpl
new file mode 100644
index 000000000..b48664653
--- /dev/null
+++ b/template/en/default/attachment/choose.html.tmpl
@@ -0,0 +1,43 @@
+[%# 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 %]