Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | [# Use raw format because the title variable will be escaped when used.] |
| 2 | [define title]Component [format "raw"][component_def.path][end][end] |
| 3 | [define category_css]css/ph_detail.css[end] |
| 4 | [include "../framework/header.ezt" "showtabs"] |
| 5 | |
| 6 | <a href="/p/[projectname]/adminComponents">‹ Back to component list</a><br><br> |
| 7 | |
| 8 | |
| 9 | <h4>Component</h4> |
| 10 | [if-any creator] |
| 11 | Created by <a href="[creator.profile_url]">[creator.display_name]</a> [created]<br/> |
| 12 | [end] |
| 13 | [if-any modifier] |
| 14 | Last modified by <a href="[modifier.profile_url]">[modifier.display_name]</a> [modified]<br/> |
| 15 | [end] |
| 16 | |
| 17 | <br/> |
| 18 | <form action="detail.do" method="POST"> |
| 19 | <input type="hidden" name="token" value="[form_token]"> |
| 20 | <input type="hidden" name="component" value="[component_def.path]"> |
| 21 | <table cellspacing="8" class="rowmajor vt"> |
| 22 | <tr> |
| 23 | <th width="1%">Name:</th> |
| 24 | <td> |
| 25 | [if-any allow_edit] |
| 26 | [if-any component_def.parent_path][component_def.parent_path]>[end] |
| 27 | <input id="leaf_name" name="leaf_name" value="[initial_leaf_name]" size="30" class="acob"> |
| 28 | <span id="leafnamefeedback" class="fielderror" style="margin-left:1em"> |
| 29 | [if-any errors.leaf_name][errors.leaf_name][end] |
| 30 | </span> |
| 31 | [else] |
| 32 | [component_def.path] |
| 33 | [end] |
| 34 | </td> |
| 35 | </tr> |
| 36 | |
| 37 | <tr> |
| 38 | <th>Description:</th> |
| 39 | <td> |
| 40 | [if-any allow_edit] |
| 41 | <textarea name="docstring" rows="4" cols="75">[initial_docstring]</textarea> |
| 42 | [else] |
| 43 | [component_def.docstring] |
| 44 | [end] |
| 45 | </td> |
| 46 | </tr> |
| 47 | |
| 48 | <tr> |
| 49 | <th>Admins:</th> |
| 50 | <td> |
| 51 | [if-any allow_edit] |
| 52 | <textarea id="member_admins" name="admins" rows="3" cols="75">[for initial_admins][initial_admins], [end]</textarea> |
| 53 | <span id="memberadminsfeedback" class="fielderror" style="margin-left:1em"> |
| 54 | [if-any errors.member_admins][errors.member_admins][end] |
| 55 | </span> |
| 56 | [else] |
| 57 | [for component_def.admins] |
| 58 | <div>[include "../framework/user-link.ezt" component_def.admins]</div> |
| 59 | [end] |
| 60 | [end] |
| 61 | </td> |
| 62 | </tr> |
| 63 | |
| 64 | <tr> |
| 65 | <th>Auto Cc:</th> |
| 66 | <td> |
| 67 | [if-any allow_edit] |
| 68 | <textarea id="member_cc" name="cc" rows="3" cols="75">[for initial_cc][initial_cc], [end]</textarea> |
| 69 | <span id="memberccfeedback" class="fielderror" style="margin-left:1em"> |
| 70 | [if-any errors.member_cc][errors.member_cc][end] |
| 71 | </span> |
| 72 | [else] |
| 73 | [for component_def.cc] |
| 74 | <div>[include "../framework/user-link.ezt" component_def.cc]</div> |
| 75 | [end] |
| 76 | [end] |
| 77 | </td> |
| 78 | </tr> |
| 79 | |
| 80 | <tr> |
| 81 | <th>Add Labels:</th> |
| 82 | <td> |
| 83 | [if-any allow_edit] |
| 84 | <textarea id="labels" name="labels" rows="3" cols="75">[for initial_labels][initial_labels], [end]</textarea> |
| 85 | <span id="labelsfeedback" class="fielderror" style="margin-left:1em"> |
| 86 | [if-any errors.labels][errors.labels][end] |
| 87 | </span> |
| 88 | [else] |
| 89 | [for component_def.labels] |
| 90 | <div>[component_def.labels]</div> |
| 91 | [end] |
| 92 | [end] |
| 93 | </td> |
| 94 | </tr> |
| 95 | |
| 96 | <tr> |
| 97 | <th>Deprecated:</th> |
| 98 | <td> |
| 99 | <input type="checkbox" id="deprecated" name="deprecated" [if-any initial_deprecated]checked="checked"[end] |
| 100 | [if-any allow_edit][else]disabled[end]> |
| 101 | </td> |
| 102 | </tr> |
| 103 | |
| 104 | <tr> |
| 105 | <td></td> |
| 106 | <td> |
| 107 | [if-any allow_edit] |
| 108 | <div> |
| 109 | <span style="float:left;"> |
| 110 | <input type="submit" name="submit" id="submit_btn" value="Submit changes"> |
| 111 | <input type="submit" class="secondary" name="deletecomponent" value="Delete component" |
| 112 | [if-any allow_delete][else]disabled[end] |
| 113 | id="deletecomponent"> |
| 114 | </span> |
| 115 | <span style="float:right;"> |
| 116 | <a href="/p/[projectname]/components/create?component=[component_def.path]">Create new subcomponent</a> |
| 117 | </span> |
| 118 | <div style="clear:both;"></div> |
| 119 | </div> |
| 120 | [if-any allow_delete][else] |
| 121 | <br/><br/> |
| 122 | <b>Note:</b> |
| 123 | [if-any subcomponents] |
| 124 | <br/> |
| 125 | Can not delete this component because it has the following subcomponents:<br/> |
| 126 | [for subcomponents]<div style="margin-left:1em">[subcomponents.path]</div>[end] |
| 127 | [end] |
| 128 | [if-any templates] |
| 129 | <br/> |
| 130 | Can not delete this component because it is listed in the following templates:<br/> |
| 131 | [for templates]<div style="margin-left:1em">[templates.name]</div>[end] |
| 132 | [end] |
| 133 | [end] |
| 134 | [end] |
| 135 | </td> |
| 136 | </tr> |
| 137 | |
| 138 | </table> |
| 139 | </form> |
| 140 | |
| 141 | [if-any allow_edit] |
| 142 | <script type="text/javascript" nonce="[nonce]"> |
| 143 | runOnLoad(function() { |
| 144 | function checkSubmit() { |
| 145 | _checkLeafName('[format "js"][projectname][end]', '[format "js"][component_def.parent_path][end]', '[format "js"][component_def.leaf_name][end]', CS_env.token); |
| 146 | } |
| 147 | setInterval(checkSubmit, 700); |
| 148 | |
| 149 | if ($("deletecomponent")) { |
| 150 | $("deletecomponent").addEventListener("click", function(event) { |
| 151 | if (!confirm("Are you sure you want to delete [component_def.path]?\nThis operation cannot be undone.")) |
| 152 | event.preventDefault(); |
| 153 | }); |
| 154 | } |
| 155 | |
| 156 | var acobElements = document.getElementsByClassName("acob"); |
| 157 | for (var i = 0; i < acobElements.length; ++i) { |
| 158 | var el = acobElements[[]i]; |
| 159 | el.addEventListener("focus", function(event) { |
| 160 | _acrob(null); |
| 161 | _acof(event); |
| 162 | }); |
| 163 | } |
| 164 | }); |
| 165 | </script> |
| 166 | [end] |
| 167 | |
| 168 | |
| 169 | [include "../framework/footer.ezt"] |