create.html.tmpl 6.36 KB
Newer Older
1 2 3
[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
  #
5 6
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
7 8 9 10 11 12 13 14
  #%]

[%# INTERFACE:
  # none
  #%]

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

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

19 20
[% PROCESS global/header.html.tmpl
           title = "Add a new Custom Field"
21
           onload = "document.getElementById('new_bugmail').disabled = true;"
22
           javascript_urls = [ 'js/util.js' ]
23
           doc_section = "custom-fields.html#add-custom-fields"
24
           style_urls = ['skins/standard/admin.css']
25
%]
26

27 28 29 30 31
[%# set initial editability of fields such as Reverse Relationship Description %]
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function() {onChangeType(document.getElementById('type'))});
</script>

32 33 34 35 36 37 38 39 40
<p>
  Adding custom fields can make the interface of [% terms.Bugzilla %] very
  complicated. Many admins who are new to [% terms.Bugzilla %] start off
  adding many custom fields, and then their users complain that the interface
  is "too complex". Please think carefully before adding any custom fields.
  It may be the case that [% terms.Bugzilla %] already does what you need,
  and you just haven't enabled the correct feature yet.
</p>

41 42 43 44 45 46 47 48
<ul>
  <li>Custom field names must begin with "cf_" to distinguish them from
      standard fields. If you omit "cf_" from the beginning of the name, it
      will be added for you.</li>
  <li>Descriptions are a very short string describing the field and will be
      used as the label for this field in the user interface.</li>
</ul>

49
<form id="add_field" action="editfields.cgi" method="GET">
50
  <table border="0" cellspacing="0" cellpadding="5" id="edit_custom_field">
51
    <tr>
52
      <th class="narrow_label"><label for="name">Name:</label></th>
53 54 55 56
      <td>
        <input type="text" id="name" name="name" value="cf_" size="40" maxlength="64">
      </td>

57
      <th>
58 59 60 61 62 63 64 65
        <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"
               onchange="toggleCheckbox(this, 'new_bugmail');">
      </td>
    </tr>
    <tr>
66
      <th class="narrow_label"><label for="desc">Description:</label></th>
67 68
      <td><input type="text" id="desc" name="desc" value="" size="40"></td>

69
      <th>
70
        <label for="new_bugmail">Displayed in [% terms.bug %]mail for new [% terms.bugs %]:</label>
71 72 73 74
      </th>
      <td><input type="checkbox" id="new_bugmail" name="new_bugmail" value="1"></td>
    </tr>
    <tr>
75
      <th class="narrow_label"><label for="type">Type:</label></th>
76
      <td>
77
        <select id="type" name="type" onchange="onChangeType(this)">
78 79 80 81
          [% FOREACH type = field_types.keys %]
            [% NEXT IF type == constants.FIELD_TYPE_UNKNOWN %]
            <option value="[% type FILTER html %]">[% field_types.$type FILTER html %]</option>
          [% END %]
82 83 84
        </select>
      </td>

85
      <th><label for="obsolete">Is obsolete:</label></th>
86 87 88
      <td><input type="checkbox" id="obsolete" name="obsolete" value="1"></td>
    </tr>
    <tr>
89
      <th class="narrow_label"><label for="sortkey">Sortkey:</label></th>
90
      <td>
91
        <input type="text" id="sortkey" name="sortkey" size="6" maxlength="6">
92 93
      </td>

94 95 96 97 98
      <th align="right"><label for="is_mandatory">Is mandatory:</label></th>
      <td><input type="checkbox" id="is_mandatory" name="is_mandatory" value="1"></td>
    </tr>

    <tr>
99
      <th class="narrow_label">Long Description:</th>
100
      <td>
101 102 103 104 105 106 107 108
         [% INCLUDE global/textarea.html.tmpl
          name           = 'long_desc'
          id             = 'long_desc'
          minrows        = 3
          maxrows        = 5
          cols           = 46
          defaultcontent = defaultcontent
        %]
109
      </td>
110
      <th>
111 112 113 114 115 116
        <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>
117
          [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
118 119 120 121 122 123
            <option value="[% sel_field.id FILTER html %]">
              [% sel_field.description FILTER html %]
              ([% sel_field.name FILTER html %])
            </option>
          [% END %]
        </select>
124 125 126 127 128
        <label for="visibility_values">
          <strong>is set to any of:</strong>
        </label>
        <select multiple="multiple" size="5" name="visibility_values"
                id="visibility_values" class="field_value">
129 130 131
          <option value=""></option>
        </select>
      </td>
132
    </tr>
133 134

    <tr>
135 136 137 138 139 140 141 142 143 144 145 146 147
      <th class="narrow_label">
        <label for="reverse_desc">Reverse Relationship Description:</label>
      </th>
      <td>
        <input type="text" id="reverse_desc" name="reverse_desc" value="" size="40" disabled="disabled">
        <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>
148 149 150 151 152 153 154 155 156 157
      <th>
        <label for="value_field_id">
          Field that controls the values<br>
          that appear in this field:
        </label>
      </th>

      <td>
        <select disabled="disabled" name="value_field_id" id="value_field_id">
          <option></option>
158
          [% FOREACH sel_field = Bugzilla.fields({ is_select => 1 }) %]
159 160 161 162 163 164 165 166
            <option value="[% sel_field.id FILTER html %]">
              [% sel_field.description FILTER html %]
              ([% sel_field.name FILTER html %])
            </option>
          [% END %]
        </select>
      </td>
    </tr>
167
  </table>
168 169 170 171 172
  <p>
    <input type="hidden" name="action" value="new">
    <input type="hidden" name="token" value="[% token FILTER html %]">
    <input type="submit" id="create" value="Create">
  </p>
173 174 175 176 177 178 179
</form>

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

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