mkanat%bugzilla.org 407dc7e4ac Bug 578241: Use the same ID in enter_bug.cgi and show_bug.cgi for group checkboxes
r=reed a=LpSolit


git-svn-id: svn://10.0.0.236/trunk@260722 18797224-902f-48f8-a5cc-f745e15eee43
2010-07-13 01:03:13 +00:00

757 lines
24 KiB
Cheetah

[%# 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): Gervase Markham <gerv@gerv.net>
# Ville Skyttä <ville.skytta@iki.fi>
# Shane H. W. Travis <travis@sedsystems.ca>
# Marc Schumann <wurblzap@gmail.com>
# Akamai Technologies <bugzilla-dev@akamai.com>
# Max Kanat-Alexander <mkanat@bugzilla.org>
# Frédéric Buclin <LpSolit@gmail.com>
#%]
[% PROCESS "global/field-descs.none.tmpl" %]
[% title = BLOCK %]Enter [% terms.Bug %]: [% product.name FILTER html %][% END %]
[% PROCESS global/header.html.tmpl
title = title
yui = [ 'autocomplete', 'calendar', 'datatable' ]
style_urls = [ 'skins/standard/attachment.css',
'skins/standard/enter_bug.css' ]
javascript_urls = [ "js/attachment.js", "js/util.js",
"js/field.js", "js/TUI.js", "js/bug.js" ]
onload = 'set_assign_to();'
%]
<script type="text/javascript">
<!--
var initialowners = new Array([% product.components.size %]);
var last_initialowner;
var initialccs = new Array([% product.components.size %]);
var components = new Array([% product.components.size %]);
var comp_desc = new Array([% product.components.size %]);
var flags = new Array([% product.components.size %]);
[% IF Param("useqacontact") %]
var initialqacontacts = new Array([% product.components.size %]);
var last_initialqacontact;
[% END %]
[% count = 0 %]
[%- FOREACH c = product.components %]
components[[% count %]] = "[% c.name FILTER js %]";
comp_desc[[% count %]] = "[% c.description FILTER html_light FILTER js %]";
initialowners[[% count %]] = "[% c.default_assignee.login 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 %]];
[% IF Param("useqacontact") %]
initialqacontacts[[% count %]] = "[% c.default_qa_contact.login FILTER js %]";
[% END %]
[% SET initial_cc_list = [] %]
[% FOREACH cc_user = c.initial_cc %]
[% initial_cc_list.push(cc_user.login) %]
[% END %]
initialccs[[% count %]] = "[% initial_cc_list.join(', ') FILTER js %]";
[% count = count + 1 %]
[%- 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 assigned_to = form.assigned_to.value;
[% IF Param("useqacontact") %]
var qa_contact = form.qa_contact.value;
[% END %]
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 owner = initialowners[index];
var component = components[index];
if (assigned_to == last_initialowner
|| assigned_to == owner
|| assigned_to == '') {
form.assigned_to.value = owner;
last_initialowner = owner;
}
document.getElementById('initial_cc').innerHTML = initialccs[index];
document.getElementById('comp_desc').innerHTML = comp_desc[index];
[% IF Param("useqacontact") %]
var contact = initialqacontacts[index];
if (qa_contact == last_initialqacontact
|| qa_contact == contact
|| qa_contact == '') {
form.qa_contact.value = contact;
last_initialqacontact = contact;
}
[% END %]
// First, we disable all flags. Then we re-enable those
// which are available for the selected component.
var inputElements = document.getElementsByTagName("select");
var inputElement, flagField;
for ( var i=0 ; i<inputElements.length ; i++ ) {
inputElement = inputElements.item(i);
if (inputElement.name.search(/^flag_type-(\d+)$/) != -1) {
var id = inputElement.name.replace(/^flag_type-(\d+)$/, "$1");
inputElement.disabled = true;
// Also disable the requestee field, if it exists.
inputElement = document.getElementById("requestee_type-" + id);
if (inputElement) inputElement.disabled = true;
}
}
// Now enable flags available for the selected component.
for (var i = 0; i < flags[index].length; i++) {
flagField = document.getElementById("flag_type-" + flags[index][i]);
// Do not enable flags the user cannot set nor request.
if (flagField && flagField.options.length > 1) {
flagField.disabled = false;
// Re-enabling the requestee field depends on the status
// of the flag.
toggleRequesteeField(flagField, 1);
}
}
}
}
function handleWantsAttachment(wants_attachment) {
if (wants_attachment) {
document.getElementById('attachment_false').style.display = 'none';
document.getElementById('attachment_true').style.display = 'block';
}
else {
document.getElementById('attachment_false').style.display = 'block';
document.getElementById('attachment_true').style.display = 'none';
clearAttachmentFields();
}
}
TUI_alternates['expert_fields'] = 'Show Advanced Fields';
// Hide the Advanced Fields by default, unless the user has a cookie
// that specifies otherwise.
TUI_hide_default('expert_fields');
-->
</script>
<form name="Create" id="Create" method="post" action="post_bug.cgi"
class="enter_bug_form" enctype="multipart/form-data">
<input type="hidden" name="product" value="[% product.name FILTER html %]">
<input type="hidden" name="token" value="[% token FILTER html %]">
<table>
<tbody>
<tr>
<td colspan="4">
[%# Migration note: The following file corresponds to the old Param
# 'entryheaderhtml'
#%]
[% PROCESS 'bug/create/user-message.html.tmpl' %]
</td>
</tr>
<tr>
<td colspan="2">
<a id="expert_fields_controller" class="controller bz_default_hidden"
href="javascript:TUI_toggle_class('expert_fields')">Hide
Advanced Fields</a>
[%# Show the link if the browser supports JS %]
<script type="text/javascript">
YAHOO.util.Dom.removeClass('expert_fields_controller',
'bz_default_hidden');
</script>
</td>
<td colspan="2">
(<span class="required_star">*</span> =
<span class="required_explanation">Required Field</span>)
</td>
</tr>
<tr>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.product, editable = 0,
value = product.name %]
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.reporter, editable = 0,
value = user.login %]
</tr>
[%# We can't use the select block in these two cases for various reasons. %]
<tr>
[% component_desc_url = BLOCK -%]
describecomponents.cgi?product=[% product.name FILTER url_quote %]
[% END %]
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.component editable = 1
desc_url = component_desc_url
%]
<td id="field_container_component">
<select name="component" id="component" onchange="set_assign_to();"
size="7" aria-required="true" class="required">
[%# Build the lists of assignees and QA contacts if "usemenuforusers" is enabled. %]
[% IF Param("usemenuforusers") %]
[% assignees_list = user.get_userlist.clone %]
[% qa_contacts_list = user.get_userlist.clone %]
[% END %]
[%- FOREACH c = product.components %]
<option value="[% c.name FILTER html %]"
id="v[% c.id FILTER html %]_component"
[% IF c.name == default.component_ %]
[%# This is for bug/field.html.tmpl, for visibility-related
# controls. %]
[% default.component_id = c.id %]
selected="selected"
[% END %]>
[% c.name FILTER html -%]
</option>
[% IF Param("usemenuforusers") %]
[% INCLUDE build_userlist default_user = c.default_assignee,
userlist = assignees_list %]
[% INCLUDE build_userlist default_user = c.default_qa_contact,
userlist = qa_contacts_list %]
[% END %]
[%- END %]
</select>
<script type="text/javascript">
<!--
[%+ INCLUDE "bug/field-events.js.tmpl"
field = bug_fields.component %]
//-->
</script>
</td>
<td colspan="2" id="comp_desc_container">
[%# Enclose the fieldset in a nested table so that its width changes based
# on the length on the component description. %]
<table>
<tr>
<td>
<fieldset>
<legend>Component Description</legend>
<div id="comp_desc" class="comment">Select a component to read its description.</div>
</fieldset>
</td>
</tr>
</table>
</td>
</tr>
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.version editable = 1 rowspan = 3
%]
<td rowspan="3">
<select name="version" size="5">
[%- FOREACH v = version %]
<option value="[% v FILTER html %]"
[% ' selected="selected"' IF v == default.version %]>[% v FILTER html -%]
</option>
[%- END %]
</select>
</td>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.bug_severity, editable = 1,
value = default.bug_severity %]
</tr>
<tr>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.rep_platform, editable = 1,
value = default.rep_platform %]
</tr>
<tr>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.op_sys, editable = 1,
value = default.op_sys %]
</tr>
[% IF !Param('defaultplatform') || !Param('defaultopsys') %]
<tr>
<td colspan="3">&nbsp;</th>
<td id="os_guess_note" class="comment">
<div>We've made a guess at your
[% IF Param('defaultplatform') %]
operating system. Please check it
[% ELSIF Param('defaultopsys') %]
platform. Please check it
[% ELSE %]
operating system and platform. Please check them
[% END %]
and make any corrections if necessary.</div>
</td>
</tr>
[% END %]
</tbody>
<tbody class="expert_fields">
<tr>
[% IF Param('usetargetmilestone') && Param('letsubmitterchoosemilestone') %]
[% INCLUDE select field = bug_fields.target_milestone %]
[% ELSE %]
<td colspan="2">&nbsp;</td>
[% END %]
[% IF Param('letsubmitterchoosepriority') %]
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.priority, editable = 1,
value = default.priority %]
[% ELSE %]
<td colspan="2">&nbsp;</td>
[% END %]
</tr>
</tbody>
<tbody class="expert_fields">
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.bug_status,
editable = (bug_status.size > 1), value = default.bug_status
override_legal_values = bug_status %]
<td>&nbsp;</td>
[%# Calculate the number of rows we can use for flags %]
[% num_rows = 6 + (Param("useqacontact") ? 1 : 0) +
(user.is_timetracker ? 3 : 0) +
(Param("usebugaliases") ? 1 : 0)
%]
<td rowspan="[% num_rows FILTER html %]">
[% IF product.flag_types.bug.size > 0 %]
[% display_flag_headers = 0 %]
[% any_flags_requesteeble = 0 %]
[% FOREACH flag_type = product.flag_types.bug %]
[% NEXT UNLESS flag_type.is_active %]
[% display_flag_headers = 1 %]
[% SET any_flags_requesteeble = 1 IF flag_type.is_requestable && flag_type.is_requesteeble %]
[% END %]
[% IF display_flag_headers %]
[% PROCESS "flag/list.html.tmpl" flag_types = product.flag_types.bug
any_flags_requesteeble = any_flags_requesteeble
flag_table_id = "bug_flags"
%]
[% END %]
[% END %]
</td>
</tr>
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.assigned_to editable = 1
%]
<td colspan="2">
[% INCLUDE global/userselect.html.tmpl
id => "assigned_to"
name => "assigned_to"
value => assigned_to
disabled => assigned_to_disabled
size => 30
emptyok => 1
custom_userlist => assignees_list
%]
<noscript>(Leave blank to assign to component's default assignee)</noscript>
</td>
</tr>
[% IF Param("useqacontact") %]
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.qa_contact editable = 1
%]
<td colspan="2">
[% INCLUDE global/userselect.html.tmpl
id => "qa_contact"
name => "qa_contact"
value => qa_contact
disabled => qa_contact_disabled
size => 30
emptyok => 1
custom_userlist => qa_contacts_list
%]
<noscript>(Leave blank to assign to default qa contact)</noscript>
</td>
</tr>
[% END %]
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.cc editable = 1
%]
<td colspan="2">
[% INCLUDE global/userselect.html.tmpl
id => "cc"
name => "cc"
value => cc
disabled => cc_disabled
size => 30
multiple => 5
%]
</td>
</tr>
<tr>
<th>Default [% field_descs.cc FILTER html %]:</th>
<td colspan="2">
<div id="initial_cc">
</div>
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
[% IF user.is_timetracker %]
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.estimated_time editable = 1
%]
<td colspan="2">
<input name="estimated_time" size="6" maxlength="6" value="[% estimated_time FILTER html %]">
</td>
</tr>
<tr>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.deadline, value = deadline,
editable = 1, value_span = 2 %]
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
[% END %]
[% IF Param("usebugaliases") %]
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.alias editable = 1
%]
<td colspan="2">
<input name="alias" size="20" value="[% alias FILTER html %]">
</td>
</tr>
[% END %]
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.bug_file_loc editable = 1
%]
<td colspan="2">
<input name="bug_file_loc" size="40"
value="[% bug_file_loc FILTER html %]">
</td>
</tr>
</tbody>
<tbody>
[% USE Bugzilla %]
[% FOREACH field = Bugzilla.active_custom_fields %]
[% NEXT UNLESS field.enter_bug %]
[% SET value = ${field.name}.defined ? ${field.name} : "" %]
<tr [% 'class="expert_fields"' IF !field.is_mandatory %]>
[% INCLUDE bug/field.html.tmpl
bug = default, field = field, value = value, editable = 1,
value_span = 3 %]
</tr>
[% END %]
</tbody>
<tbody>
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.short_desc editable = 1
%]
<td colspan="3">
<input name="short_desc" size="70" value="[% short_desc FILTER html %]"
maxlength="255" spellcheck="true" aria-required="true"
class="required" id="short_desc">
</td>
</tr>
[% IF feature_enabled('jsonrpc') AND !cloned_bug_id %]
<tr id="possible_duplicates_container" class="bz_default_hidden">
<th>Possible<br>Duplicates:</th>
<td colspan="3">
<div id="possible_duplicates"></div>
<script type="text/javascript">
var dt_columns = [
{ key: "id", label: "[% field_descs.bug_id FILTER js %]",
formatter: YAHOO.bugzilla.dupTable.formatBugLink },
{ key: "summary",
label: "[% field_descs.short_desc FILTER js %]" },
{ key: "status",
label: "[% field_descs.bug_status FILTER js %]",
formatter: YAHOO.bugzilla.dupTable.formatStatus },
{ key: "update_token", label: '',
formatter: YAHOO.bugzilla.dupTable.formatCcButton }
];
YAHOO.bugzilla.dupTable.addCcMessage = "Add Me to the CC List";
YAHOO.bugzilla.dupTable.init({
container: 'possible_duplicates',
columns: dt_columns,
product_name: '[% product.name FILTER js %]',
summary_field: 'short_desc',
options: {
MSG_LOADING: 'Searching for possible duplicates...',
MSG_EMPTY: 'No possible duplicates found.',
SUMMARY: 'Possible Duplicates'
},
});
</script>
</td>
</tr>
[% END %]
<tr>
<th>Description:</th>
<td colspan="3">
[% defaultcontent = BLOCK %]
[% IF cloned_bug_id %]
+++ This [% terms.bug %] was initially created as a clone of [% terms.Bug %] #[% cloned_bug_id %] +++
[% END %]
[%-# We are within a BLOCK. The comment will be correctly HTML-escaped
# by global/textarea.html.tmpl. So we must not escape the comment here. %]
[% comment FILTER none %]
[%- END %]
[% INCLUDE global/textarea.html.tmpl
name = 'comment'
id = 'comment'
minrows = 10
maxrows = 25
cols = constants.COMMENT_COLS
defaultcontent = defaultcontent
%]
<br>
</td>
</tr>
[% IF user.is_insider %]
<tr class="expert_fields">
<th>&nbsp;</th>
<td colspan="3">
&nbsp;&nbsp;
<input type="checkbox" id="commentprivacy" name="commentprivacy"
[% " checked=\"checked\"" IF commentprivacy %]>
<label for="commentprivacy">
Make description private (visible only to members of the
<strong>[% Param('insidergroup') FILTER html %]</strong> group)
</label>
</td>
</tr>
[% END %]
[% IF Param("maxattachmentsize") %]
<tr>
<th>Attachment:</th>
<td colspan="3">
<script type="text/javascript">
<!--
document.write( '<div id="attachment_false">'
+ '<input type="button" value="Add an attachment" '
+ 'onClick="handleWantsAttachment(true)"> '
+ '<em style="display: none">This button has no '
+ 'functionality for you because your browser does '
+ 'not support CSS or does not use it.<\/em>'
+ '<\/div>'
+ '<div id="attachment_true" style="display: none">'
+ '<input type="button" '
+ 'value="Don\'t add an attachment " '
+ 'onClick="handleWantsAttachment(false)">');
//-->
</script>
<fieldset>
<legend>Add an attachment</legend>
<table class="attachment_entry">
[% PROCESS attachment/createformcontents.html.tmpl
flag_types = product.flag_types.attachment
any_flags_requesteeble = 1
flag_table_id ="attachment_flags" %]
</table>
</fieldset>
<script type="text/javascript">
<!--
document.write('<\/div>');
//-->
</script>
</td>
</tr>
[% END %]
</tbody>
<tbody class="expert_fields">
[% IF user.in_group('editbugs', product.id) %]
[% IF use_keywords %]
<tr>
[% INCLUDE bug/field.html.tmpl
bug = default, field = bug_fields.keywords, editable = 1,
value = keywords, desc_url = "describekeywords.cgi",
value_span = 2
%]
</tr>
[% END %]
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.dependson editable = 1
%]
<td colspan="3">
<input name="dependson" accesskey="d" value="[% dependson FILTER html %]">
</td>
</tr>
<tr>
[% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.blocked editable = 1
%]
<td colspan="3">
<input name="blocked" accesskey="b" value="[% blocked FILTER html %]">
</td>
</tr>
[% END %]
</tbody>
<tbody class="expert_fields">
[% IF product.groups_available.size %]
<tr>
<th>&nbsp;</th>
<td colspan="3">
<br>
<strong>
Only users in all of the selected groups can view this
[%+ terms.bug %]:
</strong>
<br>
<font size="-1">
(Leave all boxes unchecked to make this a public [% terms.bug %].)
</font>
<br>
<br>
<!-- Checkboxes -->
[% FOREACH group = product.groups_available %]
<input type="checkbox" id="group_[% group.id FILTER html %]"
name="groups" value="[% group.name FILTER html %]"
[% ' checked="checked"' IF default.groups.contains(group.name)
OR group.is_default %]>
<label for="group_[% group.id FILTER html %]">
[%- group.description FILTER html_light %]</label><br>
[% END %]
</td>
</tr>
[% END %]
</tbody>
<tbody>
[%# Form controls for entering additional data about the bug being created. %]
[% Hook.process("form") %]
<tr>
<th>&nbsp;</th>
<td colspan="3">
<input type="submit" id="commit" value="Submit [% terms.Bug %]"
onclick="if (this.form.short_desc.value == '')
{ alert('Please enter a summary sentence for this [% terms.bug %].');
return false; } return true;">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="maketemplate" id="maketemplate"
value="Remember values as bookmarkable template"
class="expert_fields">
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="form_name" value="enter_bug">
</form>
[%# Links or content with more information about the bug being created. %]
[% Hook.process("end") %]
[% PROCESS global/footer.html.tmpl %]
[%############################################################################%]
[%# Block for SELECT fields #%]
[%############################################################################%]
[% BLOCK select %]
[% INCLUDE "bug/field-label.html.tmpl"
field = field editable = 1
%]
<td>
<select name="[% field.name FILTER html %]"
id="[% field.name FILTER html %]">
[%- FOREACH x = ${field.name} %]
<option value="[% x FILTER html %]"
[% " selected=\"selected\"" IF x == default.${field.name} %]>
[% display_value(field.name, x) FILTER html %]
</option>
[% END %]
</select>
</td>
[% END %]
[% BLOCK build_userlist %]
[% user_found = 0 %]
[% default_login = default_user.login %]
[% RETURN UNLESS default_login %]
[% FOREACH user = userlist %]
[% IF user.login == default_login %]
[% user_found = 1 %]
[% LAST %]
[% END %]
[% END %]
[% userlist.push({login => default_login,
identity => default_user.identity,
visible => 1})
UNLESS user_found %]
[% END %]