-
-
Notifications
You must be signed in to change notification settings - Fork 253
/
edit.html
423 lines (397 loc) · 17.6 KB
/
edit.html
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">{% trans %}Home{% endtrans %}</a></li>
<li class="breadcrumb-item"><a href="index.php?page=list_zones">{% trans %}Zones{% endtrans %}</a></li>
<li class="breadcrumb-item">
{% if idn_zone_name %}
{{ idn_zone_name }}
{% else %}
{{ zone_name_to_display }}
{% endif %}
</li>
<li class="breadcrumb-item" aria-current="page">{% trans %}Edit{% endtrans %}</li>
</ol>
</nav>
{% if idn_zone_name %}
<h5 class="mb-3">{% trans %}Edit zone{% endtrans %} "{{ idn_zone_name }}" ({{ zone_name_to_display }})</h5>
{% else %}
<h5 class="mb-3">{% trans %}Edit zone{% endtrans %} "{{ zone_name_to_display }}"</h5>
{% endif %}
<div>
{{ pagination | raw }}
</div>
{% if not records %}
<table class="table table-striped table-hover table-sm">
<tr>
<td>{% trans %}This zone does not have any records.{% endtrans %}</td>
</tr>
</table>
<hr>
{% else %}
<form class="needs-validation" method="post" action="" novalidate>
<input type="hidden" name="serial" value="{{ serial }}">
<table class="table table-striped table-hover table-sm">
<tr>
<th><a href="index.php?page=edit&id={{ zone_id }}&record_sort_by=id">{% trans %}Id{% endtrans %}</a>
{% if record_sort_by == 'id' %}<i class="bi bi-arrow-down"></i>{% endif %}
</th>
<th><a href="index.php?page=edit&id={{ zone_id }}&record_sort_by=name">{% trans %}Name{% endtrans %}</a>
{% if record_sort_by == 'name' %}<i class="bi bi-arrow-down"></i>{% endif %}
</th>
<th><a href="index.php?page=edit&id={{ zone_id }}&record_sort_by=type">{% trans %}Type{% endtrans %}</a>
{% if record_sort_by == 'type' %}<i class="bi bi-arrow-down"></i>{% endif %}
</th>
<th><a href="index.php?page=edit&id={{ zone_id }}&record_sort_by=content">{% trans %}Content{% endtrans %}</a>
{% if record_sort_by == 'content' %}<i class="bi bi-arrow-down"></i>{% endif %}
</th>
<th><a href="index.php?page=edit&id={{ zone_id }}&record_sort_by=prio">{% trans %}Priority{% endtrans %}</a>
{% if record_sort_by == 'prio' %}<i class="bi bi-arrow-down"></i>{% endif %}
</th>
<th><a href="index.php?page=edit&id={{ zone_id }}&record_sort_by=ttl">{% trans %}TTL{% endtrans %}</a>
{% if record_sort_by == 'ttl' %}<i class="bi bi-arrow-down"></i>{% endif %}
</th>
<th>{% trans %}Disabled{% endtrans %}</th>
<th> </th>
</tr>
{% for r in records %}
{% if not(r['type'] == "SOA" or (r['type'] == "NS" and perm_edit == "own_as_client")) %}
<input type="hidden" name="record[{{ r['id'] }}][rid]" value="{{ r['id'] }}">
<input type="hidden" name="record[{{ r['id'] }}][zid]" value="{{ zone_id }}">
{% endif %}
<tr>
<td>{{ r['id'] }}</td>
{% if r['type'] == "SOA" or r['type'] == "NS" and perm_edit == "own_as_client" %}
<td class="col-sm-2">{{ r['name'] }}</td>
<td class="col-sm-1">{{ r['type'] }}</td>
<td>{{ r['content'] }}</td>
<td> </td>
<td class="col-sm-1">{{ r['ttl'] }}</td>
<td> </td>
{% else %}
<td class="col-sm-2"><input class="form-control form-control-sm" type="text"
name="record[{{ r['id'] }}][name]" value="{{ r['name'] }}"></td>
<td class="col-sm-1">
<select class="form-select form-select-sm" name="record[{{ r['id'] }}][type]">
{% set found_selected_type = false %}
{% for type_available in types %}
{% if type_available == r['type'] %}
{% set add = "SELECTED" %}
{% set found_selected_type = true %}
{% else %}
{% set add = "" %}
{% endif %}
<option {{ add }} value="{{ type_available }}">{{ type_available }}</option>
{% endfor %}
{% if not found_selected_type %}
<option selected value="{{ r['type'] }}">{{ r['type'] }}</option>
{% endif %}
</select>
</td>
<td><textarea class="form-control form-control-sm" name="record[{{ r['id'] }}][content]" rows="1">{{ r['content'] }}</textarea></td>
<td class="col-sm-1"><input class="form-control form-control-sm" type="number"
id="priority_field_{{ r['id'] }}" name="record[{{ r['id'] }}][prio]"
min="0" max="65535" pattern="[0-9]*" value="{{ r['prio'] }}"></td>
<td class="col-sm-1"><input class="form-control form-control-sm" type="text"
min="0" max="2147483647" pattern="[0-9]*" name="record[{{ r['id'] }}][ttl]"
value="{{ r['ttl'] }}"></td>
<td>
<input class="form-check-input" type="checkbox" name="record[{{ r['id'] }}][disabled]" {% if r['disabled'] == 1 %}checked{% endif %}>
</td>
{% endif %}
{% if domain_type == "SLAVE" or perm_edit == "none" or (perm_edit == "own" or perm_edit ==
"own_as_client") and user_is_zone_owner == "0" %}
<td> </td>
{% elseif r['type'] == "SOA" and perm_edit != "all" or r['type'] == "NS" and perm_edit ==
"own_as_client" %}
<td> </td>
{% else %}
<td class="col-sm-2">
<a class="btn btn-outline-primary btn-sm" href="index.php?page=edit_record&id={{ r['id'] }}&domain={{ zone_id }}">
<i class="bi bi-pencil-square"></i> {% trans %}Edit{% endtrans %}</a>
<a class="btn btn-outline-danger btn-sm" href="index.php?page=delete_record&id={{ r['id'] }}&domain={{ zone_id }}">
<i class="bi bi-trash"></i> {% trans %}Delete{% endtrans %}</a>
</td>
{% endif %}
</tr>
{% endfor %}
{% if iface_zone_comments %}
<tr>
<td> </td>
<td colspan="7">{% trans %}Comments{% endtrans %}:</td>
</tr>
<tr>
<td>
</td>
<td colspan="6"><textarea class="form-control form-control-sm" rows="5" cols="80" name="comment">{{ zone_comment }}</textarea>
</td>
<td colspan="2">
<a class="btn btn-outline-primary btn-sm" href="index.php?page=edit_comment&id={{ zone_id }}">
<i class="bi bi-pencil-square"></i> {% trans %}Edit comment{% endtrans %}</a>
</td>
<tr>
{% endif %}
</table>
{% if perm_edit != "none" %}
<input class="btn btn-primary btn-sm" type="submit" name="commit" value="{% trans %}Update{% endtrans %}">
<input class="btn btn-secondary btn-sm" type="reset" name="reset" value="{% trans %}Reset{% endtrans %}">
{% endif %}
{% if pdnssec_use %}
{% if is_secured %}
<input class="btn btn-secondary btn-sm" type="button" name="dnssec"
onclick="location.href = 'index.php?page=dnssec&id={{ zone_id }}'" value="{% trans %}DNSSEC{% endtrans %}">
<input class="btn btn-secondary btn-sm" type="submit" name="unsign_zone"
value="{% trans %}Unsign this zone{% endtrans %}">
{% else %}
<input class="btn btn-secondary btn-sm" type="submit" name="sign_zone"
value="{% trans %}Sign this zone{% endtrans %}">
{% endif %}
{% endif %}
</form>
<hr>
{% endif %}
{% if perm_edit == "all" or (perm_edit == "own" or perm_edit == "own_as_client") and user_is_zone_owner == "1" %}
{% if domain_type != "SLAVE" %}
<form class="needs-validation" method="post" action="index.php?page=add_record&id={{ zone_id }}" novalidate>
<input type="hidden" name="domain" value="{{ zone_id }}">
<table class="table table-striped table-hover table-sm">
<tr>
<td>{% trans %}Name{% endtrans %}</td>
<td> </td>
<td>{% trans %}Type{% endtrans %}</td>
<td>{% trans %}Content{% endtrans %}</td>
<td>{% trans %}Priority{% endtrans %}</td>
<td>{% trans %}TTL{% endtrans %}</td>
</tr>
<tr>
<td class="col-sm-2"><input class="form-control form-control-sm" type="text" name="name" value="">.{{
idn_zone_name ?: zone_name }}
</td>
<td>IN</td>
<td class="col-sm-1">
<select class="form-select form-select-sm" name="type">
{% set rev = false %}
{% for record_type in record_types %}
{% set add = "" %}
{% if is_rev_zone and record_type == "PTR" %}
{% set add = "SELECTED" %}
{% endif %}
{% if iface_add_reverse_record and record_type == "A" %}
{% set add = "SELECTED" %}
{% set rev = true %}
{% endif %}
<option {{ add }} value="{{ record_type }}">{{ record_type }}</option>
{% endfor %}
</select>
</td>
<td><textarea class="form-control form-control-sm" name="content" rows="1" required></textarea>
<div class="invalid-feedback">{% trans %}Provide content{% endtrans %}</div>
</td>
<td class="col-sm-1"><input class="form-control form-control-sm" type="number" name="prio" value="0"
min="0" max="65535" pattern="[0-9]*"></td>
<td class="col-sm-1"><input class="form-control form-control-sm" type="number" name="ttl"
min="0" max="2147483647" pattern="[0-9]*" value="{{ dns_ttl }}" required>
<div class="invalid-feedback">{% trans %}Provide TTL{% endtrans %}</div>
</td>
</tr>
</table>
<input class="btn btn-outline-secondary btn-sm" type="submit" name="commit"
value="{% trans %}Add record{% endtrans %}">
{% if not is_reverse_zone and rev %}
<span class="align-middle">
<input class="form-check-input" type="checkbox" name="reverse">
<span class="text-secondary"> {% trans %}Add also reverse record{% endtrans %}</span>
</span>
{% endif %}
</form>
<hr>
{% endif %}
{% if perm_zone_master_add and domain_type != "SLAVE"%}
<form method="post" action="">
<table>
<tr>
<td><strong>{% trans %}Save as new template{% endtrans %}</strong></td>
</tr>
<tr>
<td>{% trans %}Template Name{% endtrans %}</td>
<td><input class="form-control form-control-sm" type="text" name="templ_name" value=""></td>
</tr>
<tr>
<td>{% trans %}Template Description{% endtrans %}</td>
<td><input class="form-control form-control-sm" type="text" name="templ_descr" value=""></td>
</tr>
</table>
<input class="btn btn-secondary btn-sm" type="submit" name="save_as"
value="{% trans %}Save as template{% endtrans %}">
{% endif %}
</form>
<hr>
{% endif %}
<div id="meta">
<table>
<tr>
<th colspan="2">{% trans %}Owner of zone{% endtrans %}</th>
</tr>
{% if owners == "-1" %}
<tr>
<td>{% trans %}No owner set for this zone.{% endtrans %}</td>
</tr>
{% else %}
{% if meta_edit %}
{% for owner in owners %}
<tr>
<form method="post" action="index.php?page=edit&id={{ zone_id }}">
<td>
{% if owner["fullname"] %}
{{ owner["fullname"] }}
{% else %}
{{ owner["username"] }}
{% endif %}
</td>
<td>
<input type="hidden" name="delete_owner" value="{{ owner['id'] }}">
<input class="btn btn-outline-danger btn-sm" type="submit" name="co"
value="{% trans %}Delete{% endtrans %}">
</td>
</form>
</tr>
{% endfor %}
{% else %}
{% for owner in owners %}
<tr>
<td>
{% if owner["fullname"] %}
{{ owner["fullname"] }}
{% else %}
{{ owner["username"] }}
{% endif %}
</td>
<td> </td>
</tr>
{% endfor %}
{% endif %}
{% endif %}
{% if meta_edit %}
<form method="post" action="index.php?page=edit&id={{ zone_id }}">
<input type="hidden" name="domain" value="{{ zone_id }}">
<tr>
<td>
<select class="form-select form-select-sm" name="newowner">
{% for user in users %}
{% set add = "" %}
{% if user["id"] == session_userid %}
<option {{ add }} value="{{ user['id'] }}">{{ user["fullname"] }}</option>
{% elseif perm_view_others %}
<option value="{{ user['id'] }}">
{% if user["fullname"] %}
{{ user["fullname"] }}
{% else %}
{{ user["username"] }}
{% endif %}
</option>
{% endif %}
{% endfor %}
</select>
</td>
<td>
<input class="btn btn-outline-secondary btn-sm" type="submit" name="co"
value="{% trans %}Add{% endtrans %}">
</td>
</tr>
</form>
{% endif %}
<tr>
<th colspan="2">{% trans %}Type{% endtrans %}</th>
</tr>
{% if meta_edit %}
<form action="index.php?page=edit&id={{ zone_id }}" method="post">
<input type="hidden" name="domain" value="{{ zone_id }}">
<tr>
<td>
<select class="form-select form-select-sm" name="newtype">
{% for type in zone_types %}
{% set add = '' %}
{% if type == domain_type %}
{% set add = "SELECTED" %}
{% endif %}
<option {{ add }} value="{{ type }}">{{ type | lower }}</option>
{% endfor %}
</select>
</td>
<td>
<input class="btn btn-outline-secondary btn-sm" type="submit" name="type_change"
value="{% trans %}Change{% endtrans %}">
</td>
</tr>
</form>
{% else %}
<tr>
<td>{{ domain_type | lower }}</td>
<td> </td>
</tr>
{% endif %}
{% if domain_type == "SLAVE" %}
<tr>
<th colspan="2">{% trans %}IP address of master NS{% endtrans %}</th>
</tr>
{% if meta_edit %}
<form action="index.php?page=edit&id={{ zone_id }}" method="post">
<input type="hidden" name="domain" value="{{ zone_id }}">
<tr>
<td>
<input class="form-control form-control-sm" type="text" name="new_master"
value="{{ slave_master }}">
</td>
<td>
<input class="btn btn-outline-secondary btn-sm" type="submit" name="slave_master_change"
value="{% trans %}Change{% endtrans %}">
</td>
</tr>
</form>
{% else %}
<tr>
<td>{{ slave_master }}</td>
<td> </td>
</tr>
{% endif %}
{% endif %}
<tr>
<th colspan="2">{% trans %}Template{% endtrans %}</th>
</tr>
{% if meta_edit %}
<form action="index.php?page=edit&id={{ zone_id }}" method="post">
<input type="hidden" name="current_zone_template" value="{{ zone_template_id }}">
<tr>
<td>
<select class="form-select form-select-sm" name="zone_template">
<option value="none">none</option>
{% for zone_template in zone_templates %}
{% set add = '' %}
{% if zone_template['id'] == zone_template_id %}
{% set add = "SELECTED" %}
{% endif %}
<option {{ add }} value="{{ zone_template['id'] }}">{{ zone_template['name'] }}</option>
{% endfor %}
</select>
</td>
<td>
<input class="btn btn-outline-secondary btn-sm" type="submit" name="template_change"
value="{% trans %}Change{% endtrans %}">
</td>
</tr>
</form>
{% else %}
<tr>
<td>
{% if zone_template_details %}
{{ zone_template_details['name'] | lower }}
{% else %}
none
{% endif %}
</td>
<td> </td>
</tr>
{% endif %}
</table>
</div>
<script src="assets/textareaAutoResize.js"></script>