]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for bug 98602: re-implementation of "create attachment" page.
authormyk%mozilla.org <>
Fri, 26 Oct 2001 03:37:50 +0000 (03:37 +0000)
committermyk%mozilla.org <>
Fri, 26 Oct 2001 03:37:50 +0000 (03:37 +0000)
Patch by Myk Melez <myk@mozilla.org>.
r=gerv@mozilla.org,jake@acutex.net

template/default/attachment/contenttypes [new file with mode: 0644]
template/default/attachment/created.atml [new file with mode: 0644]
template/default/attachment/edit.atml
template/default/attachment/enter.atml [new file with mode: 0644]
template/default/attachment/list.atml
template/default/attachment/viewall.atml

diff --git a/template/default/attachment/contenttypes b/template/default/attachment/contenttypes
new file mode 100644 (file)
index 0000000..0328da2
--- /dev/null
@@ -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>
diff --git a/template/default/attachment/created.atml b/template/default/attachment/created.atml
new file mode 100644 (file)
index 0000000..f58884f
--- /dev/null
@@ -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 %]
index 5981a692ff726d9face871e5c76ec9b944528c09..ac9f327d032f06c646e46403750e9babca9acbe7 100755 (executable)
@@ -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
       // 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>$/ , "" );
diff --git a/template/default/attachment/enter.atml b/template/default/attachment/enter.atml
new file mode 100644 (file)
index 0000000..8bbdd3a
--- /dev/null
@@ -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 %]
+
+
+
index 3086c8dc0fc1c5a7cbb9fd43cbd088c7d288de83..9dd3931d0821a3e335b9fcb7779988a075ca05ab 100755 (executable)
@@ -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>
index 9a22b716ac55aa7d65f937d82552d184066ede92..f7284b431d73bf9dabc6380b0469eca28045753d 100755 (executable)
@@ -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>