summaryrefslogtreecommitdiffstats
path: root/template/en/default/attachment
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2005-10-20 05:16:12 +0200
committerbugreport%peshkin.net <>2005-10-20 05:16:12 +0200
commitb2966165174d850b13be0e25eba6e9053142ed00 (patch)
tree76dacbad2b7941d582dc095f7a06352533411ade /template/en/default/attachment
parenta38539a73699a6d03c6d129375cecde85267269a (diff)
downloadbugzilla-b2966165174d850b13be0e25eba6e9053142ed00.tar.gz
bugzilla-b2966165174d850b13be0e25eba6e9053142ed00.tar.xz
Bug 149504 Permit a reference to a URL to be treated as an attachment
Patch by Joel Peshkin <bugreport@peshkin.net> r=lpsolit, a=justdave
Diffstat (limited to 'template/en/default/attachment')
-rw-r--r--template/en/default/attachment/create.html.tmpl76
-rw-r--r--template/en/default/attachment/edit.html.tmpl30
-rw-r--r--template/en/default/attachment/list.html.tmpl2
3 files changed, 99 insertions, 9 deletions
diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl
index 43af6e638..ba725eae7 100644
--- a/template/en/default/attachment/create.html.tmpl
+++ b/template/en/default/attachment/create.html.tmpl
@@ -17,6 +17,8 @@
# Rights Reserved.
#
# Contributor(s): Myk Melez <myk@mozilla.org>
+ # Joel Peshkin <bugreport@peshkin.net>
+ # Erik Stambaugh <erik@dasbistro.com>
#%]
[% PROCESS global/variables.none.tmpl %]
@@ -53,6 +55,58 @@
onload="setContentTypeDisabledState();"
%]
+[% IF Param("allow_attach_url") %]
+ <script type="text/javascript">
+
+ function URLFieldHandler() {
+ var field_attachurl = document.getElementById("attachurl");
+ var greyfields = new Array("data", "ispatch", "autodetect",
+ "list", "manual", "bigfile",
+ "contenttypeselection",
+ "contenttypeentry");
+ var i;
+ if (field_attachurl.value.match(/^\s*$/)) {
+ for (i = 0; i < greyfields.length; i++) {
+ thisfield = document.getElementById(greyfields[i]);
+ if (thisfield) {
+ thisfield.removeAttribute("disabled");
+ }
+ }
+ } else {
+ for (i = 0; i < greyfields.length; i++) {
+ thisfield = document.getElementById(greyfields[i]);
+ if (thisfield) {
+ thisfield.setAttribute("disabled", "disabled");
+ }
+ }
+ }
+ }
+
+ function DataFieldHandler() {
+ var field_data = document.getElementById("data");
+ var greyfields = new Array("attachurl");
+ if (field_data.value.match(/^\s*$/)) {
+ var i;
+ for (i = 0; i < greyfields.length; i++) {
+ thisfield = document.getElementById(greyfields[i]);
+ if (thisfield) {
+ thisfield.removeAttribute("disabled");
+ }
+ }
+ } else {
+ for (i = 0; i < greyfields.length; i++) {
+ thisfield = document.getElementById(greyfields[i]);
+ if (thisfield) {
+ thisfield.setAttribute("disabled", "disabled");
+ }
+ }
+ }
+ }
+
+ </script>
+[% END %]
+
+
<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">
@@ -62,7 +116,11 @@
<th><label for="data">File:</label></th>
<td>
<em>Enter the path to the file on your computer.</em><br>
- <input type="file" id="data" name="data" size="50">
+ <input type="file" id="data" name="data" size="50"
+ [% IF Param("allow_attach_url") %]
+ onchange="DataFieldHandler()"
+ [% END %]
+ >
</td>
</tr>
[% IF Param("maxlocalattachment") %]
@@ -77,6 +135,17 @@
</td>
</tr>
[% END %]
+ [% IF Param("allow_attach_url") %]
+ <tr>
+ <th><label for="attachurl">AttachURL:</label></th>
+ <td>
+ <em>URL to be attached instead.</em><br>
+ <input type="text" id="attachurl" name="attachurl" size="60"
+ maxlength="2000"
+ onkeyup="URLFieldHandler()" onblur="URLFieldHandler()">
+ </td>
+ </tr>
+ [% END %]
<tr>
<th><label for="description">Description:</label></th>
<td>
@@ -104,14 +173,15 @@
<input type="radio" id="list"
name="contenttypemethod" value="list">
<label for="list">select from list:</label>
- <select name="contenttypeselection"
+ <select name="contenttypeselection" id="contenttypeselection"
onchange="this.form.contenttypemethod[1].checked = true;">
[% PROCESS "attachment/content-types.html.tmpl" %]
</select><br>
<input type="radio" id="manual"
name="contenttypemethod" value="manual">
<label for="manual">enter manually:</label>
- <input type="text" name="contenttypeentry" size="30" maxlength="200"
+ <input type="text" name="contenttypeentry" id="contenttypeentry"
+ size="30" maxlength="200"
onchange="if (this.value) this.form.contenttypemethod[2].checked = true;">
</td>
</tr>
diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl
index e46d5e552..7addd3278 100644
--- a/template/en/default/attachment/edit.html.tmpl
+++ b/template/en/default/attachment/edit.html.tmpl
@@ -209,16 +209,21 @@
<b>Description:</b><br>
<textarea rows="3" cols="25" name="description" wrap="soft">[% description FILTER html %]</textarea><br>
- <b>Filename:</b><br>
- <input type="text" size="20" name="filename" value="[% filename FILTER html %]"><br>
- <b>Size: </b>[% datasize FILTER unitconvert %]<br>
+ [% IF isurl %]
+ <input type="hidden" name="filename" value="[% filename FILTER html %]"><br>
+ <input type="hidden" name="contenttypeentry" value="[% contenttype FILTER html %]"><br>
+ [% ELSE %]
+ <b>Filename:</b><br>
+ <input type="text" size="20" name="filename" value="[% filename FILTER html %]"><br>
+ <b>Size: </b>[% datasize FILTER unitconvert %]<br>
- <b>MIME Type:</b><br>
- <input type="text" size="20" name="contenttypeentry" value="[% contenttype FILTER html %]"><br>
+ <b>MIME Type:</b><br>
+ <input type="text" size="20" name="contenttypeentry" value="[% contenttype FILTER html %]"><br>
<input type="checkbox" id="ispatch" name="ispatch" value="1"
[% 'checked="checked"' IF ispatch %]>
<label for="ispatch">patch</label>
+ [% END %]
<input type="checkbox" id="isobsolete" name="isobsolete" value="1"
[% 'checked="checked"' IF isobsolete %]>
<label for="isobsolete">obsolete</label><br>
@@ -237,7 +242,8 @@
</div>
<input type="submit" value="Submit"><br><br>
- <strong>Actions:</strong> <a href="attachment.cgi?id=[% attachid %]">View</a>
+ <strong>Actions:</strong>
+ <a href="attachment.cgi?id=[% attachid %]">View</a>
[% IF ispatch && patchviewerinstalled %]
| <a href="attachment.cgi?id=[% attachid %]&action=diff">Diff</a>
[% END %]
@@ -268,6 +274,18 @@
//-->
</script>
</td>
+ [% ELSIF isurl %]
+ <td width="75%">
+ <a href="[% thedata FILTER html %]">
+ [% IF datasize < 120 %]
+ [% thedata FILTER html %]
+ [% ELSE %]
+ [% thedata FILTER truncate(80) FILTER html %]
+ &nbsp;...
+ [% thedata.match(".*(.{20})$").0 FILTER html %]
+ [% END %]
+ </a>
+ </td>
[% ELSE %]
<td id="noview" width="50%">
<p><b>
diff --git a/template/en/default/attachment/list.html.tmpl b/template/en/default/attachment/list.html.tmpl
index 61b68ee53..7de5fb371 100644
--- a/template/en/default/attachment/list.html.tmpl
+++ b/template/en/default/attachment/list.html.tmpl
@@ -43,6 +43,8 @@
<td valign="top">
[% IF attachment.ispatch %]
<i>patch</i>
+ [% ELSIF attachment.isurl %]
+ <i>url</i>
[% ELSE %]
[% attachment.contenttype FILTER html %]
[% END %]