summaryrefslogtreecommitdiffstats
path: root/template/en/default/admin/custom_fields/edit.html.tmpl
blob: 755c3642c568877c0c007357d8f43dd5e8ecb00a (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
[%# 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.
  #
  # Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
  #%]

[%# INTERFACE:
  # field: Bugzila::Field; the current field being edited
  #%]

[% PROCESS "global/field-descs.none.tmpl" %]

[% title = BLOCK %]
  Edit the Custom Field '[% field.name FILTER html %]' ([% field.description FILTER html %])
[% END %]

[% javascript = BLOCK %]
  [% INCLUDE "admin/custom_fields/cf-js.js.tmpl" %]
[% END %]

[% PROCESS global/header.html.tmpl
           title = title
           onload = "toggleCheckbox(document.getElementById('enter_bug'), 'new_bugmail');"
           javascript_urls = [ 'js/util.js' ]
           doc_section = "custom-fields.html#edit-custom-fields"
           style_urls = ['skins/standard/admin.css']
%]

<p>
  Descriptions are a very short string describing the field and will be used as
  the label for this field in the user interface.
</p>

<form id="edit_field" action="editfields.cgi" method="GET">
  <table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
    <tr>
      <th class="narrow_label">Name:</th>
      <td>[% field.name FILTER html %]</td>

      <th>
        <label for="enter_bug">Can be set on [% terms.bug %] creation:</label>
      </th>
      <td><input type="checkbox" id="enter_bug" name="enter_bug" value="1"
                 [%- " checked" IF field.enter_bug %]
                 onchange="toggleCheckbox(this, 'new_bugmail');"></td>
    </tr>
    <tr>
      <th class="narrow_label"><label for="desc">Description:</label></th>
      <td><input type="text" id="desc" name="desc" size="40"
                 value="[% field.description FILTER html %]"></td>

      <th>
        <label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
      </th>
      <td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"
                 [%- " checked" IF field.mailhead %]></td>
    </tr>
    <tr>
      <th class="narrow_label">Type:</th>
      <td>[% field_types.${field.type} FILTER html %]</td>

      <th><label for="obsolete">Is obsolete:</label></th>
      <td><input type="checkbox" id="obsolete" name="obsolete" value="1"
                 [%- " checked" IF field.obsolete %]></td>
    </tr>
    <tr>
      <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
      <td>
        <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6"
               value="[% field.sortkey FILTER html %]">
      </td>
      <th align="right"><label for="is_mandatory">Is mandatory:</label></th>
      <td><input type="checkbox" id="is_mandatory" name="is_mandatory" value="1"
                 [%- ' checked="checked"' IF field.is_mandatory %]></td>
    </tr>
    <tr>
      [% IF field.type == constants.FIELD_TYPE_BUG_ID %]
        <th class="narrow_label">
          <label for="reverse_desc">Reverse Relationship Description:</label>
        </th>
        <td>
          <input type="text" id="reverse_desc" name="reverse_desc" size="40"
                 value="[% field.reverse_desc FILTER html %]">
          <br/>
          Use this label for the list of [% terms.bugs %] that link to
          [%+ terms.abug %] with this 
          [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %] field.
          For example, if the description is "Is a duplicate of",
          the reverse description would be "Duplicates of this [% terms.bug %]".
          Leave blank to disable the list for this field.
        </td>
      [% ELSE %]
        <td colspan="2">&nbsp;</td>
      [% END %]
      <th>
        <label for="visibility_field_id">Field only appears when:</label>
      </th>
      <td>
        <select name="visibility_field_id" id="visibility_field_id"
                onchange="onChangeVisibilityField()">
          <option></option>
          [% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
            [% NEXT IF sel_field.id == field.id %]
            <option value="[% sel_field.id FILTER html %]"
             [% ' selected="selected"' 
                IF sel_field.id == field.visibility_field.id %]>
              [% sel_field.description FILTER html %]
              ([% sel_field.name FILTER html %])
            </option>
          [% END %]
        </select>
        <label for="visibility_value_id"><strong>is set to:</strong></label>
        <select name="visibility_value_id" id="visibility_value_id">
          [% FOREACH value = field.visibility_field.legal_values %]
            <option value="[% value.id FILTER html %]"
             [% ' selected="selected"' 
                IF field.visibility_value.id == value.id %]>
              [% IF field.visibility_field.name == 'component' %]
                [% display_value('product', value.product.name) FILTER html %]:
              [% END %]
              [%+ display_value(field.visibility_field.name, value.name) FILTER html %]
            </option>
          [% END %]   
        </select>
      </td>
    </tr>
    [% IF field.is_select %]
      <tr>
        <th>&nbsp;</th>
        <td>
          <a href="editvalues.cgi?field=[% field.name FILTER url_quote %]">Edit
            legal values for this field</a>.
        </td>

        <th>
          <label for="value_field_id">
            Field that controls the values<br>
            that appear in this field:
          </label>
        </th>

        <td>
          <select name="value_field_id" id="value_field_id">
            <option></option>
            [% FOREACH sel_field = Bugzilla.get_fields({ is_select => 1 }) %]
              [% NEXT IF sel_field.id == field.id %]
              <option value="[% sel_field.id FILTER html %]"
               [% ' selected="selected"' 
                  IF sel_field.id == field.value_field.id %]>
                [% sel_field.description FILTER html %]
                ([% sel_field.name FILTER html %])
              </option>
            [% END %]
          </select>
        </td>
      </tr>
    [% END %]
  </table>
  <br>
  <input type="hidden" name="action" value="update">
  <input type="hidden" name="name" value="[% field.name FILTER html %]">
  <input type="hidden" name="token" value="[% token FILTER html %]">
  <input type="submit" id="edit" value="Submit">
</form>

[% IF field.obsolete %]
<p>
  <a href="editfields.cgi?action=del&amp;name=[% field.name FILTER html %]">Remove
    this custom field from the database.</a><br>
  This action will only be successful if the custom field has never been used
  in [% terms.abug %].<br>
</p>
[% END %]

<p>
  <a href="editfields.cgi">Back to the list of existing custom fields</a>
</p>

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