(新規および参照) の選択ページを取得して、分類、製品、コンポーネント、および 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 %]