Commit 7ae7ccb3 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 647158: The Error Console in Firefox reports

"unbalanced tree was written using document.write()" when reporting a new bug or when visiting the "User Authentication" panel in the Parameters page r=glob a=LpSolit
parent 2767ac53
...@@ -309,7 +309,7 @@ function hideElementById(id) ...@@ -309,7 +309,7 @@ function hideElementById(id)
} }
} }
function showElementById(id, val) function showElementById(id)
{ {
var elm = document.getElementById(id); var elm = document.getElementById(id);
if (elm) { if (elm) {
...@@ -345,3 +345,16 @@ function toggle_attachment_details_visibility ( ) ...@@ -345,3 +345,16 @@ function toggle_attachment_details_visibility ( )
} }
} }
/* Used in bug/create.html.tmpl to show/hide the attachment field. */
function handleWantsAttachment(wants_attachment) {
if (wants_attachment) {
hideElementById('attachment_false');
showElementById('attachment_true');
}
else {
showElementById('attachment_false');
hideElementById('attachment_true');
clearAttachmentFields();
}
}
...@@ -62,55 +62,48 @@ ...@@ -62,55 +62,48 @@
[% END %] [% END %]
</select> </select>
[% ELSIF param.type == "o" %] [% ELSIF param.type == "o" %]
<script type="text/javascript"><!--
document.write("<span style=\"display: none\">");
// -->
</script>
<input id="input_[% param.name FILTER html %]" size="80" <input id="input_[% param.name FILTER html %]" size="80"
name="[% param.name FILTER html %]" name="[% param.name FILTER html %]"
value="[% Param(param.name) FILTER html %]"><br> value="[% Param(param.name) FILTER html %]"><br>
<script type="text/javascript"><!--
document.write("<\/span>");
// -->
</script>
[% boxSize = 7 %] [% boxSize = 7 %]
[% boxSize = 3 + param.choices.size IF param.choices.size < 7 %] [% boxSize = 3 + param.choices.size IF param.choices.size < 7 %]
[% plist = Param(param.name).split(',') %] [% plist = Param(param.name).split(',') %]
<script type="text/javascript"><!-- <table id="table_[% param.name FILTER html %]" class="bz_default_hidden">
document.write( <tr>
'<table>' + <td rowspan="2">
' <tr>' + <select id="select_[% param.name FILTER html %]"
' <td rowspan="2">' + name="select_[% param.name FILTER html %]"
' <select id="select_[% param.name FILTER html %]"' + size="[% boxSize FILTER html %]">
' size="[% boxSize FILTER html %]"' + [% FOREACH item = plist %]
' name="select_[% param.name FILTER html %]">' + <option value="[% item FILTER html %]">[% item FILTER html %]</option>
[% FOREACH item = plist %] [% END %]
' <option value="[% item FILTER html %]">[% item FILTER html %]<\/option>' + <option class="sortlist_separator" disabled="disabled"
[% END %] value="[% sortlist_separator %]">active&uarr;&nbsp;&darr;inactive</option>
' <option class="sortlist_separator"' + [% FOREACH item = param.choices %]
' disabled="disabled"' + [% IF lsearch(plist, item) == -1 %]
' value="[% sortlist_separator %]">active&uarr;&nbsp;&darr;inactive<\/option>' + <option value="[% item FILTER html %]">[% item FILTER html %]</option>
[% FOREACH item = param.choices %] [% END %]
[% IF lsearch(plist, item) == -1 %] [% END %]
' <option value="[% item FILTER html %]">[% item FILTER html %]<\/option>' + </select>
[% END %] </td>
[% END %] <td style="vertical-align: bottom">
' <\/select>' + <button type="button"
' <\/td>' + onClick="sortedList_moveItem('[% param.name FILTER html %]', -1, '[% sortlist_separator %]');">&uarr;</button>
' <td style="vertical-align: bottom">' + </td>
' <button type="button"' + </tr>
' onClick="sortedList_moveItem(\'[% param.name FILTER html %]\', -1, \'[% sortlist_separator %]\');">&uarr;<\/button>' +
' <\/td>' + <tr>
' <\/tr>' + <td style="vertical-align: top">
' <tr>' + <button type="button"
' <td style="vertical-align: top">' + onClick="sortedList_moveItem('[% param.name FILTER html %]', +1, '[% sortlist_separator %]');">&darr;</button>
' <button type="button"' + </td>
' onClick="sortedList_moveItem(\'[% param.name FILTER html %]\', +1, \'[% sortlist_separator %]\');">&darr;<\/button>' + </tr>
' <\/td>' + </table>
' <\/tr>' +
'<\/table>'); <script type="text/javascript">
// --> bz_toggleClass("input_[% param.name FILTER html %]", "bz_default_hidden");
bz_toggleClass("table_[% param.name FILTER html %]", "bz_default_hidden");
</script> </script>
[% ELSIF param.type == "s" %] [% ELSIF param.type == "s" %]
<select name="[% param.name FILTER html %]" id="[% param.name FILTER html %]"> <select name="[% param.name FILTER html %]" id="[% param.name FILTER html %]">
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
title = title title = title
message = message message = message
style_urls = ['skins/standard/params.css'] style_urls = ['skins/standard/params.css']
javascript_urls = ['js/params.js'] javascript_urls = ['js/params.js', 'js/util.js']
doc_section = "parameters.html" doc_section = "parameters.html"
%] %]
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
'skins/standard/enter_bug.css' ] 'skins/standard/enter_bug.css' ]
javascript_urls = [ "js/attachment.js", "js/util.js", javascript_urls = [ "js/attachment.js", "js/util.js",
"js/field.js", "js/TUI.js", "js/bug.js" ] "js/field.js", "js/TUI.js", "js/bug.js" ]
onload = 'set_assign_to();' onload = "set_assign_to(); hideElementById('attachment_true');
showElementById('attachment_false'); showElementById('btn_no_attachment');"
%] %]
<script type="text/javascript"> <script type="text/javascript">
...@@ -150,18 +151,6 @@ function set_assign_to() { ...@@ -150,18 +151,6 @@ function set_assign_to() {
} }
} }
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();
}
}
var status_comment_required = new Array(); var status_comment_required = new Array();
[% FOREACH status = bug_status %] [% FOREACH status = bug_status %]
status_comment_required['[% status.name FILTER js %]'] = status_comment_required['[% status.name FILTER js %]'] =
...@@ -605,21 +594,13 @@ TUI_hide_default('attachment_text_field'); ...@@ -605,21 +594,13 @@ TUI_hide_default('attachment_text_field');
<tr> <tr>
<th>Attachment:</th> <th>Attachment:</th>
<td colspan="3"> <td colspan="3">
<script type="text/javascript"> <div id="attachment_false" class="bz_default_hidden">
<!-- <input type="button" value="Add an attachment" onClick="handleWantsAttachment(true)">
document.write( '<div id="attachment_false">' </div>
+ '<input type="button" value="Add an attachment" '
+ 'onClick="handleWantsAttachment(true)"> ' <div id="attachment_true">
+ '<em style="display: none">This button has no ' <input type="button" id="btn_no_attachment" value="Don't add an attachment"
+ 'functionality for you because your browser does ' class="bz_default_hidden" onClick="handleWantsAttachment(false)">
+ '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> <fieldset>
<legend>Add an attachment</legend> <legend>Add an attachment</legend>
<table class="attachment_entry"> <table class="attachment_entry">
...@@ -629,11 +610,7 @@ TUI_hide_default('attachment_text_field'); ...@@ -629,11 +610,7 @@ TUI_hide_default('attachment_text_field');
flag_table_id ="attachment_flags" %] flag_table_id ="attachment_flags" %]
</table> </table>
</fieldset> </fieldset>
<script type="text/javascript"> </div>
<!--
document.write('<\/div>');
//-->
</script>
</td> </td>
</tr> </tr>
[% END %] [% END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment