Fix for bug 98602: re-implementation of "create attachment" page.

Patch by Myk Melez <myk@mozilla.org>.
r=gerv@mozilla.org,jake@acutex.net
This commit is contained in:
myk%mozilla.org 2001-10-25 20:37:53 +00:00
Родитель d3dd71447e
Коммит e41d92589f
6 изменённых файлов: 160 добавлений и 10 удалений

Просмотреть файл

@ -0,0 +1,6 @@
<option value="text/plain">plain text (text/plain)</option>
<option value="text/html">HTML source (text/html)</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,35 @@
[% INCLUDE global/header
title = "Changes Submitted"
style = "th { text-align: left; }"
%]
<table border="1">
<tr>
<td>
<h2>
<a title="[% description %]" href="attachment.cgi?id=[% attachid %]&action=edit">Attachment #[% attachid %]</a>
to <a href="show_bug.cgi?id=[% bugid %]">Bug #[% bugid %]</a> Created
</h2>
[% mailresults %]
[% IF contenttypemethod == 'autodetect' %]
<p>
<b>Note:</b> Bugzilla automatically detected the content type
<em>[% contenttype %]</em> for this attachment. If this is
incorrect, correct the value by
<a href="attachment.cgi?id=[% attachid %]&action=edit">editing the attachment</a>.
</p>
[% END %]
</td>
<td>
<a href="show_bug.cgi?id=[% bugid %]">Go back to bug #[% bugid %]</a>
</td>
</tr>
</table>
<p>
<a href="attachment.cgi?bugid=[% bugid %]&action=enter">Create Another Attachment to Bug #[% bugid %]</a>
</p>
[% INCLUDE global/footer %]

Просмотреть файл

@ -19,6 +19,7 @@
<form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
<input type="hidden" name="id" value="[% attachid %]">
<input type="hidden" name="action" value="update">
<input type="hidden" name="contenttypemethod" value="manual">
<table width="100%">
@ -29,7 +30,7 @@
<textarea rows="3" cols="25" name="description" wrap="soft">[% description %]</textarea><br>
<b>MIME Type:</b><br>
<input type="text" size="20" name="mimetype" value="[% mimetype %]"><br>
<input type="text" size="20" name="contenttypeentry" value="[% contenttype %]"><br>
<b>Flags:</b><br>
<input type="checkbox" name="ispatch" value="1"[% " checked" IF ispatch %]>patch
@ -100,8 +101,8 @@
// If this is a plaintext document, remove cruft that Mozilla adds
// because it treats it as an HTML document with a big PRE section.
// http://bugzilla.mozilla.org/show_bug.cgi?id=86012
var mimeType = '[% mimetype %]';
if ( mimeType == 'text/plain' )
var contentType = '[% contenttype %]';
if ( contentType == 'text/plain' )
{
theContent = theContent.replace( /^<html><head\/><body><pre>/ , "" );
theContent = theContent.replace( /<\/pre><\/body><\/html>$/ , "" );

Просмотреть файл

@ -0,0 +1,108 @@
[%# Define strings that will serve as the title and header of this page %]
[% title = BLOCK %]Create New Attachment for Bug #[% bugid %][% END %]
[% h1 = BLOCK %]Create New Attachment for <a href="show_bug.cgi?id=[% bugid %]">Bug #[% bugid %]</a>[% END %]
[% h2 = BLOCK %][% bugsummary FILTER html %][% END %]
[% INCLUDE global/header
title = title
h1 = h1
h2 = h2
style = "
th { text-align: right; vertical-align: baseline; white-space: nowrap; }
td { text-align: left; vertical-align: baseline; padding-bottom: 5px; }
"
%]
<form name="entryform" method="post" action="attachment.cgi" enctype="multipart/form-data">
<input type="hidden" name="bugid" value="[% bugid %]">
<input type="hidden" name="action" value="insert">
<table>
<tr>
<th>File:</th>
<td>
<em>Enter the path to the file on your computer.</em><br>
<input type="file" name="data" size="50">
</td>
</tr>
<tr>
<th>Description:</th>
<td>
<em>Describe the attachment briefly.</em><br>
<input type="text" name="description" size="60" maxlength="200">
</td>
</tr>
<tr>
<th></th>
<td>
</td>
</tr>
<tr>
<th>Content Type:</th>
<td>
<em>If the attachment is a patch, check the box below.</em><br>
<input type="checkbox" name="ispatch" value="1" onchange="setContentTypeDisabledState();"> patch<br><br>
<em>Otherwise, choose a method for determining the content type.</em><br>
<input type="radio" name="contenttypemethod" value="autodetect">
auto-detect<br>
<input type="radio" name="contenttypemethod" value="list">
select from list: <select name="contenttypeselection" onchange="this.form.contenttypemethod[1].checked = true;">
[% PROCESS attachment/contenttypes %]
</select><br>
<input type="radio" name="contenttypemethod" value="manual">
enter manually: <input type="text" name="contenttypeentry" size="30" maxlength="200" onchange="if (this.value) this.form.contenttypemethod[2].checked = true;">
</td>
</tr>
<tr>
<th>Obsoletes:</th>
<td>
<em>(optional) Check each existing attachment made obsolete by your new attachment.</em><br>
[% IF attachments.size %]
[% FOREACH attachment = attachments %]
<input type="checkbox" name="obsolete" value="[% attachment.id %]">
<a href="attachment.cgi?id=[% attachment.id %]&action=edit">[% attachment.id %]: [% attachment.description FILTER html %]</a><br>
[% END %]
[% ELSE %]
[no attachments can be made obsolete]
[% END %]
</td>
</tr>
<tr>
<th>Comment:</th>
<td>
<em>(optional) Add a comment about this attachment to the bug.</em><br>
<textarea wrap="soft" name="comment" rows="6" cols="80"></textarea>
</td>
</tr>
<tr>
<th>&nbsp;</th>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
<!--
function setContentTypeDisabledState()
{
var entryform = document.entryform;
var isdisabled = false;
if (entryform.ispatch.checked)
isdisabled = true;
for (var i=0 ; i<entryform.contenttypemethod.length ; i++)
entryform.contenttypemethod[i].disabled = isdisabled;
entryform.contenttypeselection.disabled = isdisabled;
entryform.contenttypeentry.disabled = isdisabled;
}
//-->
</script>
[% INCLUDE global/footer %]

Просмотреть файл

@ -12,9 +12,9 @@
<tr>
<td valign="top">
[% IF attachment.isobsolete %]
<strike><a href="attachment.cgi?id=[% attachment.attachid %]&action=view">[% attachment.description %]</a></strike>
<strike><a href="attachment.cgi?id=[% attachment.attachid %]&action=view">[% attachment.description FILTER html %]</a></strike>
[% ELSE %]
<a href="attachment.cgi?id=[% attachment.attachid %]&action=view">[% attachment.description %]</a>
<a href="attachment.cgi?id=[% attachment.attachid %]&action=view">[% attachment.description FILTER html %]</a>
[% END %]
</td>
@ -22,7 +22,7 @@
[% IF attachment.ispatch %]
<i>patch</i>
[% ELSE %]
[% attachment.mimetype %]
[% attachment.contenttype %]
[% END %]
</td>
@ -48,7 +48,7 @@
<tr>
<td colspan="4">
<a href="createattachment.cgi?id=[% bugid %]">Create a new attachment</a> (proposed patch, testcase, etc.)
<a href="attachment.cgi?bugid=[% bugid %]&action=enter">Create a New Attachment</a> (proposed patch, testcase, etc.)
</td>
<td colspan="1">
<a href="attachment.cgi?bugid=[% bugid %]&action=viewall">View All</a>

Просмотреть файл

@ -24,9 +24,9 @@
<tr>
<td valign="top">
[% IF a.isobsolete %]
<strike>[% a.description %]</strike>
<strike>[% a.description FILTER html %]</strike>
[% ELSE %]
[% a.description %]
[% a.description FILTER html %]
[% END %]
</td>
@ -34,7 +34,7 @@
[% IF a.ispatch %]
<i>patch</i>
[% ELSE %]
[% a.mimetype %]
[% a.contenttype FILTER html %]
[% END %]
</td>