Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
fc3aa3e7
Commit
fc3aa3e7
authored
Feb 17, 2005
by
mkanat%kerio.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 280412: Templatize the 'list products' bit of editproducts
Patch By Gavin Shelly <bugzilla@chimpychompy.org> r=wurblzap, a=myk
parent
e8e8e839
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
283 additions
and
46 deletions
+283
-46
editproducts.cgi
editproducts.cgi
+57
-43
footer.html.tmpl
template/en/default/admin/products/footer.html.tmpl
+86
-0
list.html.tmpl
template/en/default/admin/products/list.html.tmpl
+119
-0
table.html.tmpl
template/en/default/admin/table.html.tmpl
+12
-3
filterexceptions.pl
template/en/default/filterexceptions.pl
+9
-0
No files found.
editproducts.cgi
View file @
fc3aa3e7
...
...
@@ -22,6 +22,7 @@
# Terry Weissman <terry@mozilla.org>
# Dawn Endico <endico@mozilla.org>
# Joe Robins <jmrobins@tgix.com>
# Gavin Shelley <bugzilla@chimpychompy.org>
#
# Direct any questions on this source code to
#
...
...
@@ -117,6 +118,28 @@ sub CheckClassification ($)
}
}
# For the transition period, as this file is templatised bit by bit,
# we need this routine, which does things properly, and will
# eventually be the only version. (The older versions assume a
# PutHeader() call has been made)
sub
CheckClassificationNew
($)
{
my
$cl
=
shift
;
# do we have a classification?
unless
(
$cl
)
{
ThrowUserError
(
'classification_not_specified'
);
exit
;
}
unless
(
TestClassification
$cl
)
{
ThrowUserError
(
'classification_doesnt_exist'
,
{
'name'
=>
$cl
});
exit
;
}
}
sub
CheckClassificationProduct
($$)
{
my
$cl
=
shift
;
...
...
@@ -308,59 +331,50 @@ if (Param('useclassification')) {
#
unless
(
$action
)
{
if
(
Param
(
'useclassification'
))
{
PutHeader
(
"Select product in "
.
$classification
);
}
else
{
PutHeader
(
"Select product"
);
CheckClassificationNew
(
$classification
);
}
my
$query
=
"SELECT products.name,products.description,disallownew,
votesperuser,maxvotesperbug,votestoconfirm,COUNT(bug_id)
FROM products"
;
my
$dbh
=
Bugzilla
->
dbh
;
my
@execute_params
=
();
my
@products
=
();
my
$query
=
"SELECT products.name,
COALESCE(products.description,'') AS description,
NOT(disallownew) AS status,
votesperuser, maxvotesperbug, votestoconfirm,
COUNT(bug_id) AS bug_count
FROM products"
;
if
(
Param
(
'useclassification'
))
{
$query
.=
",classifications"
;
$query
.=
",
classifications"
;
}
$query
.=
" LEFT JOIN bugs ON products.id = bugs.product_id"
;
if
(
Param
(
'useclassification'
))
{
$query
.=
" WHERE classifications.name="
.
SqlQuote
(
$classification
)
.
" AND classifications.id=products.classification_id"
;
$query
.=
" WHERE classifications.name = ? "
.
" AND classifications.id = products.classification_id"
;
# trick_taint is OK because we use this in a placeholder in a SELECT
trick_taint
(
$classification
);
push
(
@execute_params
,
$classification
);
}
$query
.=
" GROUP BY products.name ORDER BY products.name"
;
SendSQL
(
$query
);
print
"<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0><TR BGCOLOR=\"#6666FF\">\n"
;
print
" <TH ALIGN=\"left\">Edit product ...</TH>\n"
;
print
" <TH ALIGN=\"left\">Description</TH>\n"
;
print
" <TH ALIGN=\"left\">Status</TH>\n"
;
print
" <TH ALIGN=\"left\">Votes<br>per<br>user</TH>\n"
;
print
" <TH ALIGN=\"left\">Max<br>Votes<br>per<br>bug</TH>\n"
;
print
" <TH ALIGN=\"left\">Votes<br>to<br>confirm</TH>\n"
;
print
" <TH ALIGN=\"left\">Bugs</TH>\n"
;
print
" <TH ALIGN=\"left\">Action</TH>\n"
;
print
"</TR>"
;
while
(
MoreSQLData
()
)
{
my
(
$product
,
$description
,
$disallownew
,
$votesperuser
,
$maxvotesperbug
,
$votestoconfirm
,
$bugs
)
=
FetchSQLData
();
$description
||=
"<FONT COLOR=\"red\">missing</FONT>"
;
$disallownew
=
$disallownew
?
'closed'
:
'open'
;
$bugs
||=
'none'
;
print
"<TR>\n"
;
print
" <TD VALIGN=\"top\"><A HREF=\"editproducts.cgi?action=edit&product="
,
url_quote
(
$product
),
$classhtmlvar
,
"\"><B>$product</B></A></TD>\n"
;
print
" <TD VALIGN=\"top\">$description</TD>\n"
;
print
" <TD VALIGN=\"top\">$disallownew</TD>\n"
;
print
" <TD VALIGN=\"top\" ALIGN=\"right\">$votesperuser</TD>\n"
;
print
" <TD VALIGN=\"top\" ALIGN=\"right\">$maxvotesperbug</TD>\n"
;
print
" <TD VALIGN=\"top\" ALIGN=\"right\">$votestoconfirm</TD>\n"
;
print
" <TD VALIGN=\"top\" ALIGN=\"right\">$bugs</TD>\n"
;
print
" <TD VALIGN=\"top\"><A HREF=\"editproducts.cgi?action=del&product="
,
url_quote
(
$product
),
$classhtmlvar
,
"\">Delete</A></TD>\n"
;
print
"</TR>"
;
}
print
"<TR>\n"
;
print
" <TD VALIGN=\"top\" COLSPAN=7>Add a new product</TD>\n"
;
print
" <TD VALIGN=\"top\" ALIGN=\"center\"><A HREF=\"editproducts.cgi?action=add&classification="
,
url_quote
(
$classification
),
"\">Add</A></TD>\n"
;
print
"</TR></TABLE>\n"
;
PutTrailer
();
$vars
->
{
'products'
}
=
$dbh
->
selectall_arrayref
(
$query
,
{
'Slice'
=>
{}},
@execute_params
);
$vars
->
{
'classification'
}
=
$classification
;
$template
->
process
(
"admin/products/list.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
exit
;
}
...
...
template/en/default/admin/products/footer.html.tmpl
0 → 100644
View file @
fc3aa3e7
[%# 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): Gavin Shelley <bugzilla@chimpychompy.org>
#%]
[%# INTERFACE:
# name: string; the name of the product
#
# classification: string; If classifications are enabled, then this is
# the currently selected classification
#
# no_XXX_link: boolean; if defined, then don't show the corresponding
# link. Supported parameters are:
#
# no_edit_product_link
# no_edit_other_products_link
# no_add_product_link
#%]
[% IF classification %]
[% classification_url_part = BLOCK %]&classification=
[%- classification FILTER url_quote %]
[% END %]
[% classification_text = BLOCK %]
of classification '[% classification FILTER html %]'
[% END %]
[% END %]
<p>
<hr>
[% UNLESS no_add_product_link %]
<a title="Add a product"
href="editproducts.cgi?action=add">Add</a> a product
[%# Strictly speaking, we should not have to check for a
classification if they are enabled, but I'm just being paranoid %]
[% IF Param('useclassification') && classification %]
(<a title="Add a product to classification '
[%- classification FILTER html %]'"
href="editproducts.cgi?action=add
[%- classification_url_part %]">to
classification '[% classification FILTER html %]'</a>)
[% END %].
[% END %]
[% IF name && !no_edit_product_link %]
Edit product <a
title="Edit Product '[% name FILTER html %]'
[% classification_text %]"
href="editproducts.cgi?action=edit&product=
[%- name FILTER url_quote %][% classification_url_part %]">
'[% name FILTER html %]'</a>FRED
[% END %]
[% UNLESS no_edit_other_products_link %]
Edit other products [% classification_text %]<a
href="editproducts.cgi?product=
[%- name FILTER url_quote %]
[%- classification_url_part %]">'
[%- classification FILTER html %]'</a>
[% END %]
[% IF Param('useclassification') && classification %]
Edit classification <a href="editclassifications.cgi?action=edit
[%- classification_url_part %]">'
[%- classification FILTER html %]'</a>.
[% END %]
</p>
template/en/default/admin/products/list.html.tmpl
0 → 100644
View file @
fc3aa3e7
[%# 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): Gavin Shelley <bugzilla@chimpychompy.org>
#%]
[%# INTERFACE:
# products: array of hashes having the following properties:
# - name: string; The name of the product
# - description: string; The product description (html allowed)
# - status: boolean; Can new bugs be created for the product?
# - votesperuser: number; The number of votes a user is allowed
# in the product
# - maxvotersperbug: number; Maximum votes allowed per bug in this
# product
# - votestoconfirm: number; The number of votes that are needed to
# auto-confirm a bug in this product
# - bug_count: number; The number of bugs in this product
#
# classification: string; If classifications are enabled, then this is
# the currently selected classification
#%]
[% PROCESS global/variables.none.tmpl %]
[% IF classification %]
[% classification_url_part = BLOCK %]&classification=
[%- classification FILTER url_quote %]
[%- END %]
[% classification_title = BLOCK %]
in classification '[% classification FILTER html %]'
[% END %]
[% END %]
[% PROCESS global/header.html.tmpl
title = "Select product $classification_title"
%]
[% edit_contentlink = BLOCK %]
editproducts.cgi?action=edit&product=%%name%%
[%- classification_url_part %]
[% END %]
[% delete_contentlink = BLOCK %]
editproducts.cgi?action=del&product=%%name%%
[%- classification_url_part %]
[% END %]
[% bug_count_contentlink = BLOCK %]buglist.cgi?product=%%name%%&
[%- classification_url_part %][% END %]
[% columns = [
{
name => "name"
heading => "Edit product..."
contentlink => edit_contentlink
},
{
name => "description"
heading => "Description"
allow_html_content => 1
},
{
name => "status"
heading => "Open For New $terms.Bugs"
yesno_field => 1
},
{
name => "votesperuser"
heading => "Votes Per User"
align => 'right'
},
{
name => "maxvotesperbug"
heading => "Maximum Votes Per $terms.Bug"
align => 'right'
},
{
name => "votestoconfirm"
heading => "Votes To Confirm"
align => 'right'
},
{
name => "bug_count"
heading => "$terms.Bug Count"
align => 'right'
contentlink => bug_count_contentlink
},
]
%]
[% columns.push({
heading => "Action"
content => "Delete"
contentlink => delete_contentlink
})
%]
[% PROCESS admin/table.html.tmpl
columns = columns
data = products
%]
<p>
[% PROCESS admin/products/footer.html.tmpl
no_edit_other_products_link = 1
%]
[% PROCESS global/footer.html.tmpl %]
template/en/default/admin/table.html.tmpl
View file @
fc3aa3e7
...
...
@@ -37,6 +37,7 @@
# text in the column.
# allow_html_content: if defined, then this column allows html content
# so it will not be filtered
# yesno_field: Turn the data from 0/!0 into Yes/No
#
# data:
# array of hashes representing the data for the table.
...
...
@@ -79,10 +80,18 @@
[% IF c.content %]
[% c.content %]
[% ELSE %]
[% IF c.allow_html_content %]
[% row.${c.name} FILTER none %]
[% IF c.yesno_field %]
[% IF row.${c.name} %]
Yes
[% ELSE %]
No
[% END %]
[% ELSE %]
[% row.${c.name} FILTER html %]
[% IF c.allow_html_content %]
[% row.${c.name} FILTER none %]
[% ELSE %]
[% row.${c.name} FILTER html %]
[% END %]
[% END %]
[% END %]
...
...
template/en/default/filterexceptions.pl
View file @
fc3aa3e7
...
...
@@ -526,6 +526,15 @@
'const.CONTROLMAPMANDATORY'
,
],
'admin/products/list.html.tmpl'
=>
[
'classification_url_part'
,
],
'admin/products/footer.html.tmpl'
=>
[
'classification_url_part'
,
'classification_text'
,
],
'admin/keywords/edit.html.tmpl'
=>
[
'keyword_id'
,
'bug_count'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment