Skip to content

Commit

Permalink
feat: Enable 'disabled' state management in single record edigin
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondas committed Dec 3, 2023
1 parent 95ac0a2 commit 786b915
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion edit_record.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ public function saveRecord($zid): void
{
$old_record_info = DnsRecord::get_record_from_id($this->db, $_POST["rid"]);
$dnsRecord = new DnsRecord($this->db, $this->getConfig());
$ret_val = $dnsRecord->edit_record($_POST);

$postData = $_POST;
if (isset($postData['disabled']) && $postData['disabled'] == "on") {
$postData['disabled'] = 1;
} else {
$postData['disabled'] = 0;
}

$ret_val = $dnsRecord->edit_record($postData);
if ($ret_val == "1") {
if ($_POST['type'] != "SOA") {
$dnsRecord = new DnsRecord($this->db, $this->getConfig());
Expand Down
4 changes: 4 additions & 0 deletions templates/edit_record.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ <h5 class="mb-3">{% trans %}Edit record in zone{% endtrans %} "{{ zone_name }}"<
<th>{% trans %}Content{% endtrans %}</th>
<th>{% trans %}Priority{% endtrans %}</th>
<th>{% trans %}TTL{% endtrans %}</th>
<th>{% trans %}Disabled{% endtrans %}</th>
</tr>
</thead>
<tr>
Expand Down Expand Up @@ -74,6 +75,9 @@ <h5 class="mb-3">{% trans %}Edit record in zone{% endtrans %} "{{ zone_name }}"<
pattern="[0-9]*" value="{{ record['prio'] }}"></td>
<td><input class="form-control form-control-sm" type="number" name="ttl" min="0" max="2147483647"
pattern="[0-9]*" value="{{ record['ttl'] }}"></td>
<td>
<input class="form-check-input" type="checkbox" name="disabled" {% if record['disabled'] == 1 %}checked{% endif %}>
</td>
{% endif %}
</tr>
</table>
Expand Down

0 comments on commit 786b915

Please sign in to comment.