Bug 306757: Templatize the 'new' section of editproducts.cgi - Patch by Gabriel Sales de Oliveira <gabriel@async.com.br> r=LpSolit a=justdave

This commit is contained in:
lpsolit%gmail.com 2005-09-12 13:50:42 +00:00
Родитель e6c127026a
Коммит 4f617af311
3 изменённых файлов: 57 добавлений и 31 удалений

Просмотреть файл

@ -377,21 +377,18 @@ if ($action eq 'add') {
# #
if ($action eq 'new') { if ($action eq 'new') {
$template->put_header("Adding new product");
# Cleanups and validity checks # Cleanups and validity checks
my $classification_id = 1; my $classification_id = 1;
if (Param('useclassification')) { if (Param('useclassification')) {
CheckClassification($classification); CheckClassificationNew($classification);
$classification_id = get_classification_id($classification); $classification_id = get_classification_id($classification);
$vars->{'classification'} = $classification;
} }
unless ($product) { unless ($product) {
print "You must enter a name for the new product. Please press\n"; ThrowUserError("product_blank_name");
print "<b>Back</b> and try again.\n";
PutTrailer($localtrailer);
exit;
} }
my $existing_product = TestProduct($product); my $existing_product = TestProduct($product);
@ -400,29 +397,23 @@ if ($action eq 'new') {
# Check for exact case sensitive match: # Check for exact case sensitive match:
if ($existing_product eq $product) { if ($existing_product eq $product) {
print "The product '$product' already exists. Please press\n"; ThrowUserError("prod_name_already_in_use",
print "<b>Back</b> and try again.\n"; {'product' => $product});
PutTrailer($localtrailer);
exit;
} }
# Next check for a case-insensitive match: # Next check for a case-insensitive match:
if (lc($existing_product) eq lc($product)) { if (lc($existing_product) eq lc($product)) {
print "The new product '$product' differs from existing product "; ThrowUserError("prod_name_diff_in_case",
print "'$existing_product' only in case. Please press\n"; {'product' => $product,
print "<b>Back</b> and try again.\n"; 'existing_product' => $existing_product});
PutTrailer($localtrailer);
exit;
} }
} }
my $version = trim($cgi->param('version') || ''); my $version = trim($cgi->param('version') || '');
if ($version eq '') { if ($version eq '') {
print "You must enter a version for product '$product'. Please press\n"; ThrowUserError("product_must_have_version",
print "<b>Back</b> and try again.\n"; {'product' => $product});
PutTrailer($localtrailer);
exit;
} }
my $description = trim($cgi->param('description') || ''); my $description = trim($cgi->param('description') || '');
@ -542,21 +533,12 @@ if ($action eq 'new') {
# Make versioncache flush # Make versioncache flush
unlink "$datadir/versioncache"; unlink "$datadir/versioncache";
print "OK, done.<p>\n"; $vars->{'product'} = $product;
print "<div style='border: 1px red solid; padding: 1ex;'><b>You will need to $template->process("admin/products/created.html.tmpl", $vars)
<a href=\"editcomponents.cgi?action=add&product=" . || ThrowTemplateError($template->error());
url_quote($product) . "\">add at least one
component</a> before you can enter bugs against this product.</b></div>";
PutTrailer($localtrailer,
"<a href=\"editproducts.cgi?action=add\">add</a> a new product",
"<a href=\"editcomponents.cgi?action=add&product=" .
url_quote($product) . $classhtmlvar .
"\">add</a> components to this new product");
exit; exit;
} }
# #
# action='del' -> ask if user really wants to delete # action='del' -> ask if user really wants to delete
# #

Просмотреть файл

@ -0,0 +1,31 @@
[%# 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.
#
# Contributor(s): Gabriel S. Oliveira <gabriel@async.com.br>
#%]
[% PROCESS global/header.html.tmpl
title = 'New Product Created'
%]
<br>
<div style='border: 1px red solid; padding: 1ex;'>
<b>You will need to
<a href="editcomponents.cgi?action=add&product=[% product FILTER url_quote %]">
add at least one component
</a> before you can enter [% terms.bugs %] against this product
</b>
</div>
[% PROCESS "admin/products/footer.html.tmpl" name = product %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -977,6 +977,11 @@
[% title = "Product name already in use" %] [% title = "Product name already in use" %]
The product name '[% product FILTER html %]' is already in use. The product name '[% product FILTER html %]' is already in use.
[% ELSIF error == "prod_name_diff_in_case" %]
[% title = "Product name differs only in case" %]
The product name '[% product FILTER html %]' differs from existing
product '[% existing_product FILTER html %]' only in case.
[% ELSIF error == "prod_must_define_defaultmilestone" %] [% ELSIF error == "prod_must_define_defaultmilestone" %]
[% title = "Must define new default milestone" %] [% title = "Must define new default milestone" %]
[% IF classification %] [% IF classification %]
@ -990,6 +995,10 @@
create the milestone '[% defaultmilestone FILTER html %]'</a> before create the milestone '[% defaultmilestone FILTER html %]'</a> before
it can be made the default milestone for product '[% product FILTER html %]'. it can be made the default milestone for product '[% product FILTER html %]'.
[% ELSIF error == "product_blank_name" %]
[% title = "Blank Product Name Not Allowed" %]
You must enter a name for the new product.
[% ELSIF error == "product_disabled" %] [% ELSIF error == "product_disabled" %]
[% title = BLOCK %]Product closed for [% terms.Bugs %] Entry[% END %] [% title = BLOCK %]Product closed for [% terms.Bugs %] Entry[% END %]
Sorry, entering [% terms.bugs %] into the Sorry, entering [% terms.bugs %] into the
@ -1006,6 +1015,10 @@
You must reassign those [% terms.bugs %] to another product before you You must reassign those [% terms.bugs %] to another product before you
can delete this one. can delete this one.
[% ELSIF error == "product_must_have_version" %]
[% title = "Product needs version" %]
You must enter a version for product '[% product FILTER html %]'.
[% ELSIF error == "product_not_specified" %] [% ELSIF error == "product_not_specified" %]
[% title = "No Product Specified" %] [% title = "No Product Specified" %]
No product specified when trying to edit components, milestones, versions No product specified when trying to edit components, milestones, versions