Bug 75772 - Print stack traces in TT errors
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1239 6955db30-a419-402b-8a0d-67ecbb4d7f56master v2011.03
parent
188b5a68f5
commit
e4b255cfc9
19
Bugzilla.pm
19
Bugzilla.pm
|
@ -160,6 +160,25 @@ sub encode_mime_header($$;$) {
|
|||
*Encode::MIME::Header::encode = *Bugzilla::encode_mime_header;
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# Another hack: install Template Toolkit error handler with stack traces
|
||||
#####################################################################
|
||||
|
||||
sub _tt_exc_new
|
||||
{
|
||||
my ($class, $type, $info, $textref) = @_;
|
||||
bless [ $type, $info, $textref, Devel::StackTrace->new->as_string ], $class;
|
||||
}
|
||||
|
||||
sub _tt_exc_as_string
|
||||
{
|
||||
my $self = shift;
|
||||
return $self->[0] . ' error - ' . $self->[1] . "\n" . $self->[3];
|
||||
}
|
||||
|
||||
*Template::Exception::new = *Bugzilla::_tt_exc_new;
|
||||
*Template::Exception::as_string = *Bugzilla::_tt_exc_as_string;
|
||||
|
||||
#####################################################################
|
||||
# Global Code
|
||||
#####################################################################
|
||||
|
|
|
@ -21,6 +21,17 @@
|
|||
* Marc Schumann <wurblzap@gmail.com>
|
||||
*/
|
||||
|
||||
function switch_aft(n)
|
||||
{
|
||||
var f = document.getElementById('form_type_file'+n);
|
||||
var u = document.getElementById('form_type_url'+n);
|
||||
var t = document.getElementById('form_type_text'+n);
|
||||
document.getElementById('tr_file'+n).style.display = f && f.checked ? '' : 'none';
|
||||
document.getElementById('tr_text'+n).style.display = t && t.checked ? '' : 'none';
|
||||
if (u)
|
||||
document.getElementById('tr_url'+n).style.display = u.checked ? '' : 'none';
|
||||
}
|
||||
|
||||
function validateAttachmentForm(theform) {
|
||||
var desc_value = YAHOO.lang.trim(theform.description.value);
|
||||
if (desc_value == '') {
|
||||
|
@ -39,19 +50,6 @@ function updateCommentPrivacy(checkbox) {
|
|||
}
|
||||
}
|
||||
|
||||
function setContentTypeDisabledState(form)
|
||||
{
|
||||
var isdisabled = false;
|
||||
if (form.ispatch.checked)
|
||||
isdisabled = true;
|
||||
|
||||
for (var i=0 ; i<form.contenttypemethod.length ; i++)
|
||||
form.contenttypemethod[i].disabled = isdisabled;
|
||||
|
||||
form.contenttypeselection.disabled = isdisabled;
|
||||
form.contenttypeentry.disabled = isdisabled;
|
||||
}
|
||||
|
||||
function URLFieldHandler() {
|
||||
var field_attachurl = document.getElementById("attachurl");
|
||||
var greyfields = new Array("data", "ispatch", "autodetect",
|
||||
|
|
|
@ -419,6 +419,10 @@ dl dl > dt {
|
|||
border: 1px solid #333333;
|
||||
}
|
||||
|
||||
.attach_multi p {
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
.bz_attach_extra_info {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
# Contributor(s): Myk Melez <myk@mozilla.org>
|
||||
#%]
|
||||
|
||||
<option value="text/plain">plain text (text/plain)</option>
|
||||
<option value="text/html">HTML source (text/html)</option>
|
||||
<option value="application/xml">XML source (application/xml)</option>
|
||||
<option value="image/gif">GIF image (image/gif)</option>
|
||||
<option value="image/jpeg">JPEG image (image/jpeg)</option>
|
||||
<option value="image/png">PNG image (image/png)</option>
|
||||
<option value="application/octet-stream">binary file (application/octet-stream)</option>
|
||||
<option value="text/plain">Plain text (text/plain)</option>
|
||||
<option value="text/html">HTML source (text/html)</option>
|
||||
<option value="application/xml">XML source (application/xml)</option>
|
||||
<option value="image/gif">GIF image (image/gif)</option>
|
||||
<option value="image/jpeg">JPEG image (image/jpeg)</option>
|
||||
<option value="image/png">PNG image (image/png)</option>
|
||||
<option value="application/octet-stream">Binary file (application/octet-stream)</option>
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
[%# Author: Vitaliy Filippov <vitalif@mail.ru>
|
||||
# License: MPL 1.1 %]
|
||||
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = "Create Multiple Attachments to Bug " _ bug_id
|
||||
header = "Create Multiple Attachments to Bug " _ bug_id
|
||||
doc_section = "attachments.html"
|
||||
%]
|
||||
|
||||
[% fileX = BLOCK %]
|
||||
<td>
|
||||
<span id="cont_XXX"><input type="file" id="data_XXX" name="data_XXX" onchange="file_onchange(this)" /></span>
|
||||
<input type="button" id="del_XXX" onclick="file_clear('data_XXX')" style="display: none" value="clear" />
|
||||
</td>
|
||||
<td><input type="text" id="description_XXX" name="description_XXX" size="40" onchange="this._changed=true" /></td>
|
||||
<td>
|
||||
<input type="hidden" id="contenttypemethod_XXX" name="contenttypemethod_XXX" value="list" />
|
||||
<select name="contenttypeselection_XXX" id="contenttypeselection_XXX">
|
||||
<option value="">Detect automatically</option>
|
||||
<option value="text/x-diff">Patch</option>
|
||||
[% PROCESS "attachment/content-types.html.tmpl" %]
|
||||
</select>
|
||||
</td>
|
||||
[% END %]
|
||||
|
||||
<form action="attachments-multi.cgi?post=1" method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="token" value="[% token %]" />
|
||||
<table class="attach_multi">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Description</th>
|
||||
<th>Content type</th>
|
||||
</tr>
|
||||
<tr id="fileX" style="display: none">
|
||||
[% fileX %]
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="files">
|
||||
<tr id="file0">[% fileX.replace('_XXX', '_0') %]</tr>
|
||||
</tbody>
|
||||
<tbody id="common">
|
||||
<tr><td colspan="3" style="text-align: center">
|
||||
<p>Additional file selection boxes will appear as you select more files.</p>
|
||||
<p><b>Add comment to the [% terms.bug %]:</b></p>
|
||||
[% INCLUDE global/textarea.html.tmpl
|
||||
name = 'comment'
|
||||
id = 'comment_textarea'
|
||||
minrows = 6
|
||||
maxrows = 15
|
||||
wrap = 'soft'
|
||||
style = 'width: 100%'
|
||||
%]
|
||||
[% PROCESS "bug/comment-preview-div.html.tmpl" %]
|
||||
<p><input type="submit" value="Upload files as attachments to [% terms.bug %] [%+ bug_id %]" /></p>
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script language="JavaScript">
|
||||
function file_clear(e)
|
||||
{
|
||||
e = document.getElementById(e);
|
||||
var ci = e.id.substr(5);
|
||||
e.parentNode.innerHTML = e.parentNode.innerHTML;
|
||||
document.getElementById('del_'+ci).style.display = 'none';
|
||||
document.getElementById('description_'+ci).value = '';
|
||||
document.getElementById('contenttypeselection_'+ci).selectedIndex = 0;
|
||||
}
|
||||
function file_onchange(e)
|
||||
{
|
||||
var ci = e.id.substr(5);
|
||||
document.getElementById('del_'+ci).style.display = e.value ? '' : 'none';
|
||||
if (e.value)
|
||||
{
|
||||
// Fill description from file name if it wasn't changed by user
|
||||
var e1 = document.getElementById('description_'+ci);
|
||||
if (!e1._changed)
|
||||
{
|
||||
var p = e.value;
|
||||
var slash = p.lastIndexOf('/');
|
||||
var backslash = p.lastIndexOf('\\');
|
||||
var fname;
|
||||
if (slash == -1 && backslash == -1)
|
||||
fname = p;
|
||||
else if (slash > backslash)
|
||||
fname = p.substr(slash+1);
|
||||
else
|
||||
fname = p.substr(backslash+1);
|
||||
e1.value = fname;
|
||||
}
|
||||
// Add a new empty field if there are no empty fields
|
||||
var i = 0;
|
||||
var f;
|
||||
while (f = document.getElementById('data_'+i))
|
||||
{
|
||||
if (!f.value)
|
||||
{
|
||||
i = -1;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i > 0)
|
||||
{
|
||||
// Copy innerHTML of fileX
|
||||
var tr = document.createElement('tr');
|
||||
tr.id = 'file'+i;
|
||||
tr.innerHTML = document.getElementById('fileX').innerHTML.replace(/_XXX/g, '_'+i);
|
||||
document.getElementById('files').appendChild(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
[% PROCESS global/footer.html.tmpl %]
|
Loading…
Reference in New Issue