--- templates/bugzilla/trunk/bug/create/create-guided.html.tmpl 2011/01/06 11:48:33 144 +++ templates/bugzilla/trunk/bug/create/create-guided.html.tmpl 2011/01/07 21:07:48 145 @@ -34,22 +34,11 @@ style = "#somebugs { width: 100%; height: 500px }" %] -
- - This is a template used on mozilla.org. This template, and the - comment-guided.txt.tmpl template that formats the data submitted via - the form in this template, are included as a demo of what it's - possible to do with custom templates in general, and custom [% terms.bug %] - entry templates in particular. As much of the text will not apply, - you should alter it - if you want to use this form on your [% terms.Bugzilla %] installation. - -
- -[% tablecolour = "#FFFFCC" %] +[% tablecolour = "#efefef" %] [%# This script displays the descriptions for selected components. %] - -- Please don't skip this step - half of all - [% terms.bugs %] filed are - reported already. - Check the two lists of frequently-reported [% terms.bugs %]: -
+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 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 %]"; + 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; -[%# Include other products if sensible %] -[% IF product.name == "Firefox" %] - [% productstring = "product=Mozilla%20Application%20Suite&product=Firefox" %] -[% ELSIF product.name == "Thunderbird" %] - [% productstring = "product=Mozilla%20Application%20Suite&product=Thunderbird" %] -[% ELSE %] - [% productstring = BLOCK %]product=[% product.name FILTER url_quote %][% END %] +[% IF Param("useqacontact") %] + var qa_contact = form.qa_contact.value; [% END %] -- All-time Top 100 (loaded initially) | - Hot in the last two weeks -
+ 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]; -- If your [% terms.bug %] isn't there, search [% terms.Bugzilla %] by entering - a few key words having to do with your [% terms.bug %] in this box. - For example: pop3 mail or copy paste. - The results will appear above. -
- -[%# All bugs opened inside the past six months %] - + [% 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- Look through the search results. If you get the - [% terms.zeroSearchResults %] message, [% terms.Bugzilla %] - found no [% terms.bugs %] that - match. Check for typing mistakes, or try fewer or different keywords. - If you find [% terms.abug %] that looks the same as yours, please add - any useful extra information you have to it, rather than opening a new one. -
+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(); + } +} +// this is courtesy of John Keller - -Submit a bug using the expert bug form.
-- If you've tried a few searches and your [% terms.bug %] really isn't in - there, tell us all about it. -
[% PROCESS global/footer.html.tmpl %]