summaryrefslogtreecommitdiffstats
path: root/template/en/default/attachment/create.html.tmpl
blob: ba725eae70a23021070f034b7b0d7f8dc0ec979e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Bug Tracking System.
  #
  # The Initial Developer of the Original Code is Netscape Communications
  # Corporation. Portions created by Netscape are
  # Copyright (C) 1998 Netscape Communications Corporation. All
  # Rights Reserved.
  #
  # Contributor(s): Myk Melez <myk@mozilla.org>
  #                 Joel Peshkin <bugreport@peshkin.net>
  #                 Erik Stambaugh <erik@dasbistro.com>
  #%]

[% PROCESS global/variables.none.tmpl %]

[%# Define strings that will serve as the title and header of this page %]
[% title = BLOCK %]Create New Attachment for [% terms.Bug %] #[% bugid %][% END %]
[% h1 = BLOCK %]Create New Attachment for
  [%+ GetBugLink(bugid, "$terms.Bug $bugid") %][% END %]
[% h2 = BLOCK %][% bugsummary FILTER html %][% END %]

[% PROCESS global/header.html.tmpl
  title = title
  h1 = h1
  h2 = h2
  style = "
    table.attachment_entry th {
      text-align: right;
      vertical-align: baseline;
      white-space: nowrap;
    }

    table.attachment_entry td {
      text-align: left;
      vertical-align: baseline;
      padding-bottom: 5px;
    }
    
    table#flags th, table#flags td {
      text-align: left;
      vertical-align: baseline;
      font-size: small;
    }
  "
  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">

  <table class="attachment_entry">
    <tr>
      <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"
          [% IF Param("allow_attach_url") %]
            onchange="DataFieldHandler()" 
          [% END %]
        >
      </td>
    </tr>
    [% IF Param("maxlocalattachment") %]
    <tr>
      <th>BigFile:</th>
      <td>
        <input type="checkbox" id="bigfile"
               name="bigfile" value="bigfile">
        <label for="bigfile">
          Big File - Stored locally and may be purged
        </label>
      </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>
        <em>Describe the attachment briefly.</em><br>
        <input type="text" id="description" 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" id="ispatch" name="ispatch" value="1"
               onchange="setContentTypeDisabledState();">
        <label for="ispatch">patch</label><br><br>

        <em>Otherwise, choose a method for determining the content type.</em><br>
        <input type="radio" id="autodetect"
               name="contenttypemethod" value="autodetect">
          <label for="autodetect">auto-detect</label><br>
        <input type="radio" id="list"
               name="contenttypemethod" value="list">
          <label for="list">select from list:</label>
          <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" id="contenttypeentry"
                 size="30" maxlength="200"
                 onchange="if (this.value) this.form.contenttypemethod[2].checked = true;">
      </td>
    </tr>
    [% IF (Param("insidergroup") && UserInGroup(Param("insidergroup"))) %]
      <tr>
        <th>Privacy:</th>
        <td>
          <em>If the attachment is private, check the box below.</em><br>
          <input type="checkbox" name="isprivate" id="isprivate" value="1">
        <label for="isprivate">Private</label>
        </td>
      </tr>
    [% END %]
    <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 %]
            [% IF ((attachment.isprivate == 0) || (Param("insidergroup")
              && UserInGroup(Param("insidergroup")))) %]
              <input type="checkbox" id="[% attachment.id %]"
                   name="obsolete" value="[% attachment.id %]">
              <a href="attachment.cgi?id=[% attachment.id %]&amp;action=edit">[% attachment.id %]: [% attachment.description FILTER html %]</a><br>
            [% END %]
          [% END %]
        [% ELSE %]
            [no attachments can be made obsolete]
        [% END %]
      </td>
    </tr>

    [% IF (user.id != bugassignee_id) AND user.groups.editbugs %]
      <tr>
        <th>Reassignment:</th>
        <td>
          <em>If you want to assign this [% terms.bug %] to yourself,
              check the box below.</em><br>
          <input type="checkbox" id="takebug" name="takebug" value="1">
          <label for="takebug">take [% terms.bug %]</label>
        </td>
      </tr>
    [% END %]
    <tr>
      <td> </td>
      <td>
        [% IF flag_types.size > 0 %]
          [% PROCESS "flag/list.html.tmpl" bug_id=bugid attach_id=attachid %]<br>
        [% END %]
      </td>
    </tr>
    <tr>
      <th><label for="comment">Comment:</label></th>
      <td>
        <em>(optional) Add a comment about this attachment to the [% terms.bug %].</em><br>
        <textarea wrap="soft" id="commment" name="comment" rows="6" cols="80"></textarea>
      </td>
    </tr>
    <tr>
      <th>&nbsp;</th>
      <td><input type="submit" value="Submit"></td>
    </tr>
  </table>

</form>

<script 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>

[% PROCESS global/footer.html.tmpl %]