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
bd12f03e
Commit
bd12f03e
authored
Mar 23, 2014
by
Acho Arnold
Committed by
Frédéric Buclin
Mar 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 984999: Move set_assign_to() out of bug/create/create.html.tmpl
r=LpSolit a=justdave
parent
165689a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
73 deletions
+75
-73
bug.js
js/bug.js
+72
-0
create.html.tmpl
template/en/default/bug/create/create.html.tmpl
+3
-73
No files found.
js/bug.js
View file @
bd12f03e
...
...
@@ -118,3 +118,74 @@ YAHOO.bugzilla.dupTable = {
[
dt
,
data
.
product_name
]);
}
};
function
set_assign_to
(
use_qa_contact
)
{
// 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
(
use_qa_contact
)
{
var
qa_contact
=
form
.
qa_contact
.
value
;
}
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
(
use_qa_contact
)
{
var
contact
=
initialqacontacts
[
index
];
if
(
qa_contact
==
last_initialqacontact
||
qa_contact
==
contact
||
qa_contact
==
''
)
{
form
.
qa_contact
.
value
=
contact
;
last_initialqacontact
=
contact
;
}
}
// 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
<
flag_rows
.
length
;
i
++
)
{
// Each flag table row should have one flag form select element
// We get the flag type id from the id attribute of the select.
var
flag_select
=
YAHOO
.
util
.
Dom
.
getElementsByClassName
(
'flag_select'
,
'select'
,
flag_rows
[
i
])[
0
];
var
type_id
=
flag_select
.
id
.
split
(
'-'
)[
1
];
var
can_set
=
flag_select
.
options
.
length
>
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
<
flags
[
index
].
length
;
j
++
)
{
if
(
flags
[
index
][
j
]
==
type_id
)
{
show
=
1
;
break
;
}
}
if
(
show
&&
can_set
)
{
flag_select
.
disabled
=
false
;
YAHOO
.
util
.
Dom
.
removeClass
(
flag_rows
[
i
],
'bz_default_hidden'
);
}
else
{
flag_select
.
disabled
=
true
;
YAHOO
.
util
.
Dom
.
addClass
(
flag_rows
[
i
],
'bz_default_hidden'
);
}
}
}
}
\ No newline at end of file
template/en/default/bug/create/create.html.tmpl
View file @
bd12f03e
...
...
@@ -7,6 +7,7 @@
#%]
[% title = BLOCK %]Enter [% terms.Bug %]: [% product.name FILTER html %][% END %]
[% use_qa_contact = Param("useqacontact") %]
[% PROCESS global/header.html.tmpl
title = title
...
...
@@ -14,7 +15,7 @@
style_urls = ['skins/standard/bug.css']
javascript_urls = [ "js/attachment.js", "js/util.js",
"js/field.js", "js/TUI.js", "js/bug.js" ]
onload = "set_assign_to(); hideElementById('attachment_true');
onload = "set_assign_to(
$use_qa_contact
); hideElementById('attachment_true');
showElementById('attachment_false'); showElementById('btn_no_attachment');"
%]
...
...
@@ -60,77 +61,6 @@ var flags = new Array([% product.components.size %]);
[% 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 %]
// 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 < flag_rows.length; i++) {
// Each flag table row should have one flag form select element
// We get the flag type id from the id attribute of the select.
var flag_select = YAHOO.util.Dom.getElementsByClassName('flag_select',
'select',
flag_rows[i])[0];
var type_id = flag_select.id.split('-')[1];
var can_set = flag_select.options.length > 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 < flags[index].length; j++) {
if (flags[index][j] == type_id) {
show = 1;
break;
}
}
if (show && can_set) {
flag_select.disabled = false;
YAHOO.util.Dom.removeClass(flag_rows[i], 'bz_default_hidden');
} else {
flag_select.disabled = true;
YAHOO.util.Dom.addClass(flag_rows[i], 'bz_default_hidden');
}
}
}
}
var status_comment_required = new Array();
[% FOREACH status = bug_status %]
status_comment_required['[% status.name FILTER js %]'] =
...
...
@@ -199,7 +129,7 @@ TUI_hide_default('attachment_text_field');
desc_url = component_desc_url
%]
<td id="field_container_component">
<select name="component" id="component" onchange="set_assign_to();"
<select name="component" id="component" onchange="set_assign_to(
[% Param("useqacontact") %]
);"
size="7" aria-required="true" class="required">
[%# Build the lists of assignees and QA contacts if "usemenuforusers" is enabled. %]
[% IF Param("usemenuforusers") %]
...
...
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