| [define title]Field [field_def.field_name][end] |
| [define category_css]css/ph_detail.css[end] |
| [include "../framework/header.ezt" "showtabs"] |
| |
| <a href="/p/[projectname]/adminLabels">‹ Back to field list</a><br><br> |
| |
| |
| <h4>Custom field</h4> |
| |
| <form action="detail.do" method="POST"> |
| <input type="hidden" name="token" value="[form_token]"> |
| <input type="hidden" name="field" value="[field_def.field_name]"> |
| |
| <table cellspacing="8" class="rowmajor vt"> |
| <tr> |
| <th width="1%">Name:</th> |
| <td> |
| [if-any uneditable_name] |
| <input type="hidden" name="name" value="[field_def.field_name]"> |
| [field_def.field_name] |
| [else][if-any allow_edit] |
| <input name="name" value="[field_def.field_name]" size="30" class="acob"> |
| [else] |
| [field_def.field_name] |
| [end][end] |
| </td> |
| </tr> |
| |
| <tr> |
| <th>Description:</th> |
| <td> |
| [if-any allow_edit] |
| <textarea name="docstring" rows="4" cols="75">[field_def.docstring]</textarea> |
| [else] |
| [field_def.docstring] |
| [end] |
| </td> |
| </tr> |
| |
| <tr> |
| <th>Type:</th> |
| [# TODO(jrobbins): make field types editable someday.] |
| <td>[field_def.type_name]</td> |
| </tr> |
| |
| [is field_def.type_name "APPROVAL_TYPE"] |
| <tr> |
| <th>Approvers:</th> |
| <td> |
| [if-any allow_edit] |
| <input id="member_approvers" name="approver_names" size="75" value="[initial_approvers]" |
| autocomplete="off"> |
| <span class="fielderror" style="margin-left:1em"> |
| [if-any errors.approvers][errors.approvers][end] |
| </span> |
| [else] |
| [for field_def.approvers] |
| <div>[include "../framework/user-link.ezt" field_def.approvers]</div> |
| [end] |
| [end] |
| </td> |
| </tr> |
| <tr> |
| <th>Survey:</th> |
| <td> |
| [if-any allow_edit] |
| <textarea name="survey" rows="4" cols="75">[field_def.survey]</textarea> |
| [else] |
| <table cellspacing="4" cellpadding="0" style="padding: 2px; border:2px solid #eee"> |
| [for field_def.survey_questions] |
| <tr><td>[field_def.survey_questions]</td></tr> |
| [end] |
| </table> |
| [end] |
| </td> |
| </tr> |
| |
| [if-any approval_subfields] |
| <tr> |
| <th>Subfields:</th> |
| <td> |
| [for approval_subfields] |
| <div><a href="/p/[projectname]/fields/detail?field=[approval_subfields.field_name]"> |
| [approval_subfields.field_name] |
| </a></div> |
| [end] |
| </td> |
| </tr> |
| [end] |
| [else] |
| |
| <tr> |
| <th>Issue Gate field:</th> |
| <td> |
| [if-any field_def.is_phase_field]Yes[else]No[end] |
| </td> |
| </tr> |
| |
| [is field_def.field_name "Type"][else] |
| <tr> |
| <th>Applicable:</th> |
| <td>When issue type is: |
| [if-any allow_edit] |
| [define oddball_applicability]Yes[end] |
| <select id="applicable_type" name="applicable_type"> |
| <option value="" |
| [is initial_applicable_type ""] |
| selected="selected" |
| [define oddball_applicability]No[end] |
| [end] |
| >Anything</option> |
| <option disabled="disabled">----</option> |
| [for well_known_issue_types] |
| <option value="[well_known_issue_types]" |
| [is initial_applicable_type well_known_issue_types] |
| selected="selected" |
| [define oddball_applicability]No[end] |
| [end] |
| >[well_known_issue_types]</option> |
| [end] |
| [# If an oddball type was used, keep it.] |
| [is oddball_applicability "Yes"] |
| <option value="[initial_applicable_type]" selected="selected" |
| >[initial_applicable_type]</option> |
| [end] |
| </select> |
| [else] |
| [initial_applicable_type] |
| [end] |
| [# TODO(jrobbins): editable applicable_predicate.] |
| </td> |
| </tr> |
| [end] |
| |
| <tr> |
| <th>Importance:</th> |
| <td> |
| [if-any allow_edit] |
| <select id="importance" name="importance"> |
| <option value="required" [is field_def.importance "required"]selected[end]>Required when applicable</option> |
| <option value="normal" [is field_def.importance "normal"]selected[end]>Offered when applicable</option> |
| <option value="niche" [is field_def.importance "niche"]selected[end]>Under "Show all fields" when applicable</option> |
| </select> |
| [else] |
| [is field_def.importance "required"]Required when applicable[end] |
| [is field_def.importance "normal"]Offered when applicable[end] |
| [is field_def.importance "niche"]Under "Show all fields" when applicable[end] |
| [end] |
| </td> |
| </tr> |
| |
| <tr> |
| <th>Multivalued:</th> |
| <td> |
| [if-any allow_edit] |
| <input type="checkbox" name="is_multivalued" class="acob" |
| [if-any field_def.is_multivalued_bool]checked="checked"[end]> |
| [else] |
| [if-any field_def.is_multivalued_bool]Yes[else]No[end] |
| [end] |
| </td> |
| </tr> |
| [end] |
| |
| [# TODO(jrobbins): dynamically display validation info as field type is edited.] |
| [is field_def.type_name "ENUM_TYPE"] |
| <tr> |
| <th>Choices:</th> |
| <td> |
| [if-any allow_edit] |
| <textarea name="choices" rows="10" cols="75" style="tab-size:18" [if-any allow_edit][else]disabled="disabled"[end] |
| >[initial_choices]</textarea> |
| [else] |
| <table cellspacing="4" cellpadding="0" style="padding: 2px; border:2px solid #eee"> |
| [for field_def.choices] |
| <tr> |
| <td>[field_def.choices.name]</td> |
| <td>[if-any field_def.choices.docstring]= [end][field_def.choices.docstring]</td> |
| </tr> |
| [end] |
| </table> |
| [end] |
| </td> |
| </tr> |
| [end] |
| |
| [is field_def.type_name "INT_TYPE"] |
| <tr id="int_row"> |
| <th>Validation:</th> |
| <td> |
| Min value: |
| <input type="number" name="min_value" style="text-align:right; width: 4em" |
| value="[field_def.min_value]" class="acob" |
| [if-any allow_edit][else]disabled="disabled"[end]> |
| |
| Max value: |
| <input type="number" name="max_value" style="text-align:right; width: 4em" |
| value="[field_def.max_value]" class="acob" |
| [if-any allow_edit][else]disabled="disabled"[end]> |
| <span class="fielderror" style="margin-left:1em"> |
| [if-any errors.min_value][errors.min_value][end]</span><br> |
| </td> |
| </tr> |
| [end] |
| |
| [is field_def.type_name "STR_TYPE"] |
| <tr id="str_row"> |
| <th>Validation:</th> |
| <td> |
| Regex: <input type="text" name="regex" size="30" value="[field_def.regex]" class="acob"><br> |
| <span class="fielderror" style="margin-left:1em" |
| >[if-any errors.regex][errors.regex][end]</span> |
| </td> |
| </tr> |
| [end] |
| |
| [is field_def.type_name "USER_TYPE"] |
| <tr id="user_row"> |
| <th>Validation:</th> |
| <td> |
| <input type="checkbox" name="needs_member" id="needs_member" class="acob" |
| [if-any allow_edit][else]disabled="disabled"[end] |
| [if-any field_def.needs_member_bool]checked="checked"[end]> |
| <label for="needs_member">User must be a project member</label><br> |
| <span id="needs_perm_span" style="margin-left:1em">Required permission: |
| <input type="text" name="needs_perm" id="needs_perm" size="20" |
| value="[field_def.needs_perm]" autocomplete="off" class="acob" |
| [if-any allow_edit][else]disabled="disabled"[end]></span><br> |
| </td> |
| </tr> |
| <tr id="user_row2"> |
| <th>Permissions:</th> |
| <td> |
| The users named in this field is granted this permission on this issue:<br> |
| [# TODO(jrobbins): one-click way to specify View vs. EditIssue vs. any custom perm.] |
| <input type="text" name="grants_perm" id="grants_perm" class="acob" |
| size="20" value="[field_def.grants_perm]" autocomplete="off" |
| [if-any allow_edit][else]disabled[end]> |
| </td> |
| </tr> |
| <tr id="user_row3"> |
| <th>Notification:</th> |
| <td> |
| The users named in this field will be notified via email whenever:<br> |
| <select name="notify_on" [if-any allow_edit][else]disabled[end] |
| class="acrob"> |
| <option value="never" [is field_def.notify_on "0"]selected="selected"[end] |
| >No notifications</option> |
| <option value="any_comment" [is field_def.notify_on "1"]selected="selected"[end] |
| >Any change or comment is added</option> |
| </select> |
| </td> |
| </tr> |
| [end] |
| |
| [is field_def.type_name "DATE_TYPE"] |
| <tr id="date_row"> |
| <th>Action:</th> |
| <td> |
| [if-any allow_edit] |
| <select name="date_action"> |
| <option value="no_action" [is field_def.date_action_str "no_action"]selected="selected"[end] |
| >No action</option> |
| [# TODO(jrobbins): owner-only option.] |
| <option value="ping_participants" [is field_def.date_action_str "ping_participants"]selected="selected"[end] |
| >Post a comment and notify all issue participants</option> |
| </select> |
| [else] |
| [is field_def.date_action_str "no_action"]No action[end] |
| [# TODO(jrobbins): owner-only option.] |
| [is field_def.date_action_str "ping_participants"]Post a comment and notify all issue participants[end] |
| [end] |
| </td> |
| </tr> |
| [end] |
| |
| [if-any field_def.is_approval_subfield] |
| <tr> |
| <th>Parent Approval:</th> |
| <td> |
| <a href="/p/[projectname]/fields/detail?field=[field_def.parent_approval_name]"> |
| [field_def.parent_approval_name] |
| </a> |
| </td> |
| </tr> |
| [end] |
| |
| <th>Admins:</th> |
| <td> |
| [if-any allow_edit] |
| <input id="member_admins" name="admin_names" size="75" value="[initial_admins]" |
| autocomplete="off" class="acob"> |
| <span class="fielderror" style="margin-left:1em"> |
| [if-any errors.field_admins][errors.field_admins][end] |
| </span> |
| [else] |
| [for field_def.admins] |
| <div>[include "../framework/user-link.ezt" field_def.admins]</div> |
| [end] |
| [end] |
| </td> |
| </tr> |
| |
| [is field_def.type_name "APPROVAL_TYPE"][else] |
| |
| <tr id="editors_restriction"> |
| <th>Restriction |
| <i id="editors_tooltip" class="material-icons inline-icon" style="font-size:14px; vertical-align: text-bottom" |
| title="Project owners and field admins can always edit the values of a custom field."> |
| info_outline</i> : |
| </th> |
| <td style="display:flex; align-items:center"> |
| [if-any allow_edit] |
| <input id="editors_checkbox" type="checkbox" name="is_restricted_field" class="acob" |
| [if-any field_def.is_restricted_field]checked="checked"[end]> |
| Restrict users that can edit values of this custom field. |
| [else] |
| [if-any field_def.is_restricted_field]Yes[else]No[end] |
| [end] |
| </td> |
| </tr> |
| <tr id="editors_input" |
| [if-any field_def.is_restricted_field][else]style="display:none"[end]> |
| <th>Editors:</th> |
| <td> |
| [if-any allow_edit] |
| <input id="member_editors" name="editor_names" size="75" value="[initial_editors]" |
| autocomplete="off" class="acob" |
| [if-any field_def.is_restricted_field][else]disabled[end]> |
| <span class="fielderror" style="margin-left:1em"> |
| [if-any errors.field_editors][errors.field_editors][end] |
| </span> |
| [else] |
| [for field_def.editors] |
| <div>[include "../framework/user-link.ezt" field_def.editors]</div> |
| [end] |
| [end] |
| </td> |
| </tr> |
| |
| [end] |
| |
| <tr> |
| <td></td> |
| <td> |
| [if-any allow_edit] |
| <input type="submit" name="submit" value="Save changes"> |
| <input type="submit" class="secondary" name="deletefield" value="Delete Field" |
| id="deletefield"> |
| [end] |
| </td> |
| </tr> |
| |
| </table> |
| </form> |
| |
| |
| <script type="text/javascript" nonce="[nonce]"> |
| runOnLoad(function() { |
| var needs_perm_span = document.getElementById('needs_perm_span'); |
| var needs_perm = document.getElementById('needs_perm'); |
| var needs_member = document.getElementById('needs_member'); |
| function enableNeedsPerm(enable) { |
| needs_perm_span.style.color = enable ? 'inherit' : '#999'; |
| needs_perm.disabled = enable ? '' : 'disabled'; |
| if (!enable) needs_perm.value = ''; |
| } |
| [if-any allow_edit] |
| if (needs_perm) |
| enableNeedsPerm(needs_member.checked); |
| [end] |
| |
| if ($("deletefield")) { |
| $("deletefield").addEventListener("click", function(event) { |
| var msg = ("Are you sure you want to delete [field_def.field_name]?\n" + |
| "This operation cannot be undone. " + |
| "[if-any approval_subfields]\nAll subfields will also be deleted.[end]" + |
| "[is field_def.type_name "ENUM_TYPE"]\nEnum values will be retained on issues as labels.[end]"); |
| if (!confirm(msg)) |
| event.preventDefault(); |
| }); |
| } |
| |
| [is field_def.type_name "APPROVAL_TYPE"][else] |
| //Enable editors input only when restricting the field. |
| document.getElementById('editors_checkbox').onchange = function() { |
| var member_editors = document.getElementById('member_editors'); |
| var editors_input = document.getElementById('editors_input'); |
| if (this.checked) { |
| editors_input.style.display = ''; |
| } else { |
| editors_input.style.display = 'none'; |
| } |
| member_editors.disabled = !this.checked; |
| }; |
| [end] |
| |
| var acobElements = document.getElementsByClassName("acob"); |
| for (var i = 0; i < acobElements.length; ++i) { |
| var el = acobElements[[]i]; |
| el.addEventListener("focus", function(event) { |
| _acrob(null); |
| _acof(event); |
| }); |
| } |
| |
| [is field_def.type_name "APPROVAL_TYPE"] |
| $('member_approvers').addEventListener("focus", function(event) { |
| _acof(event); |
| }); |
| [end] |
| |
| if ($("needs_member")) { |
| $("needs_member").addEventListener("change", function(event) { |
| enableNeedsPerm($("needs_member").checked); |
| }); |
| } |
| }); |
| </script> |
| |
| [include "../framework/footer.ezt"] |