我想获得(新建和浏览)的选择页面,以显示分类、产品、组件和 cf_subcomponent 的下拉框。并根据前一个字段的选择填充有效的选择选项。
我不认为我的变量对于 bugzilla 是正确的,并且还认为我的 JS 不正确。
我想在下一页的 URI 中以这个结尾-
http://bugs/buglist.cgi?product=<product1>&component=<component1>&cf_subcomponent=<subcomponent1>
这是我到目前为止所拥有的
[%# INTERFACE:
# classifications: array of hashes, with an 'object' key representing a
# classification object and 'products' the list of
# product objects the user can enter bugs into.
# target: the script that displays this template.
# cloned_bug_id: ID of the bug being cloned.
# format: the desired format to display the target.
#%]
[% IF target == "enter_bug.cgi" %]
[% title = "Enter $terms.Bug" %]
[% h2 = BLOCK %]First, you must pick a product on which to enter [% terms.abug %]: [% END %]
[% ELSIF target == "describecomponents.cgi" %]
[% title = "Browse" %]
[% h2 = "Select a product category to browse:" %]
[% END %]
[% DEFAULT title = "Choose a Product" %]
[% PROCESS global/header.html.tmpl %]
[%# This script displays the descriptions for selected components. %]
var products = new Array([% classification.products.size %]);
var components = new Array([% product.components.size %]);
var comp_desc = new Array([% product.components.size %]);
var flags = new Array([% product.components.size %]);
[% count = 0 %]
[% FOREACH product = classification.products %]
products[[% count %]] = "[% product.name FILTER js %]";
[%- FOREACH c = product.components %]
[% NEXT IF NOT c.is_active %]
components[[% count %]] = "[% c.name FILTER js %]";
comp_desc[[% count %]] = "[% c.description FILTER html_light FILTER js %]";
[% flag_list = [] %]
[% FOREACH f = c.flag_types.bug %]
[% NEXT UNLESS f.is_active %]
[% flag_list.push(f.id) %]
[% END %]
[% FOREACH f = c.flag_types.attachment %]
[% NEXT UNLESS f.is_active %]
[% flag_list.push(f.id) %]
[% END %]
flags[[% count %]] = [[% flag_list.join(",") FILTER js %]];
[% count = count + 1 %]
[%- END %]
[% END %]
function set_assign_to() {
// Based on the selected component, fill the "Assign To:" field
// with the default component owner, and the "QA Contact:" field
// with the default QA Contact. It also selectively enables flags.
var form = document.Create;
var index = -1;
if (form.component.type == 'select-one') {
index = form.component.selectedIndex;
} else if (form.component.type == 'hidden') {
// Assume there is only one component in the list
index = 0;
}
if (index != -1) {
var component = components[index];
document.getElementById('comp_desc').innerHTML = comp_desc[index];
// We show or hide the available flags depending on the selected component.
var flag_rows = YAHOO.util.Dom.getElementsByClassName('bz_flag_type', 'tbody');
for (var i = 0; i 1 ? 1 : 0;
var show = 0;
// Loop through the allowed flag ids for the selected component
// and if we match, then show the row, otherwise hide the row.
for (var j = 0; j
[%# We can't use the select block in these two cases for various reasons. %]
[% classification_desc_url = BLOCK -%]
describecomponents.cgi?
[% END %]
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.classification editable = 1
desc_url =classification_desc_url
%]
[%- FOREACH class = classifications %]
[% NEXT IF NOT class.is_active %]
[% class.name FILTER html -%]
[%- END %]
[%# Enclose the fieldset in a nested table so that its width changes based
# on the length on the classification description. %]
Classification Description
Select a classification to read its description.
[%# We can't use the select block in these two cases for various reasons. %]
[% product_desc_url = BLOCK -%]
describecomponents.cgi?classification=[% classification.name FILTER uri %]
[% END %]
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.product editable = 1
desc_url = product_desc_url
%]
[%- FOREACH p = classification.products %]
[% NEXT IF NOT p.is_active %]
[% p.name FILTER html -%]
[%- END %]
[%# Enclose the fieldset in a nested table so that its width changes based
# on the length on the product description. %]
Product Description
Select a product to read its description.
[%# We can't use the select block in these two cases for various reasons. %]
[% component_desc_url = BLOCK -%]
describecomponents.cgi?product=[% product.name FILTER uri %]
[% END %]
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.component editable = 1
desc_url = component_desc_url
%]
[%# Build the lists of assignees and QA contacts if "usemenuforusers" is enabled. %]
[%- FOREACH c = product.components %]
[% NEXT IF NOT c.is_active %]
[% c.name FILTER html -%]
[%- END %]
[%# Enclose the fieldset in a nested table so that its width changes based
# on the length on the component description. %]
Component Description
Select a component to read its description.
[% USE Bugzilla %]
[% FOREACH field = Bugzilla.active_custom_fields %]
[% IF field.name == "cf_subcomponent" %]
[% NEXT UNLESS field.enter_bug %]
[% SET value = ${field.name}.defined ? ${field.name} : "" %]
[% INCLUDE bug/field.html.tmpl
bug = default, field = field, value = value, editable = 1,
value_span = 3 %]
[% END %]
[% END %]