From e5d2bd9537095e99de999ea9091b067737065abd Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Mon, 25 Dec 2023 09:23:30 +0200 Subject: [PATCH] Fixed #25 --- cp/app/Controllers/ContactsController.php | 6 +++--- .../views/partials/js-applications.twig | 12 ++++++++++-- cp/resources/views/partials/js-contacts.twig | 18 +++++++++++------- cp/resources/views/partials/js-domains.twig | 12 ++++++++++-- cp/resources/views/partials/js-hosts.twig | 12 ++++++++++-- docs/install.md | 4 ++-- 6 files changed, 46 insertions(+), 18 deletions(-) diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php index 59df57c..1f4b535 100644 --- a/cp/app/Controllers/ContactsController.php +++ b/cp/app/Controllers/ContactsController.php @@ -1021,7 +1021,7 @@ class ContactsController extends Controller if ($is_linked_registrant) { $this->container->get('flash')->addMessage('error', 'This contact is associated with a domain as a registrant'); - return $response->withHeader('Location', '/hosts')->withStatus(302); + return $response->withHeader('Location', '/contacts')->withStatus(302); } $is_linked_other = $db->selectRow('SELECT contact_id FROM domain_contact_map WHERE contact_id = ?', @@ -1072,7 +1072,7 @@ class ContactsController extends Controller $this->container->get('flash')->addMessage('success', 'Contact ' . $args . ' deleted successfully'); return $response->withHeader('Location', '/contacts')->withStatus(302); } else { - // Redirect to the hosts view + // Redirect to the contacts view return $response->withHeader('Location', '/contacts')->withStatus(302); } @@ -1080,4 +1080,4 @@ class ContactsController extends Controller } -} +} \ No newline at end of file diff --git a/cp/resources/views/partials/js-applications.twig b/cp/resources/views/partials/js-applications.twig index 7249e38..854d278 100644 --- a/cp/resources/views/partials/js-applications.twig +++ b/cp/resources/views/partials/js-applications.twig @@ -23,7 +23,7 @@ actionButtons += ` `; actionButtons += ` `; actionButtons += ` `; - actionButtons += ``; + actionButtons += ``; } else { actionButtons += ` Completed`; } @@ -119,7 +119,15 @@ {title:"Creation Date", width:250, minWidth:150, field:"crdate", headerSort:false, responsive:2}, {title:"Phase", width:150, minWidth:100, field:"phase_type", formatter: phaseFormatter, headerSort:false, responsive:2}, {title:"Status", width:200, field:"application_status", formatter: statusFormatter, headerSort:false, download:false, responsive:2}, - {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }}, + {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick: function(e, cell){ + if (e.target.closest('.delete-btn')) { + e.preventDefault(); // Prevent the default link behavior + if (confirm("Are you sure you want to delete this application?")) { + let deleteUrl = e.target.closest('.delete-btn').getAttribute('data-delete-url'); + window.location.href = deleteUrl; + } + } + }}, ], placeholder:function(){ return this.getHeaderFilters().length ? "No Matching Data" : "No Data"; //set placeholder based on if there are currently any header filters diff --git a/cp/resources/views/partials/js-contacts.twig b/cp/resources/views/partials/js-contacts.twig index a6f80bd..3181275 100644 --- a/cp/resources/views/partials/js-contacts.twig +++ b/cp/resources/views/partials/js-contacts.twig @@ -21,7 +21,7 @@ function actionsFormatter(cell, formatterParams, onRendered) { return ` - + `; } @@ -102,7 +102,15 @@ {title:"Email", field:"email", width:300, minWidth:200, headerSort:false, responsive:2}, {title:"Phone", field:"voice", width:300, minWidth:200, headerSort:false, responsive:2}, {title:"Status", field:"contact_status", width:200, minWidth:100, formatter: statusFormatter, headerSort:false, download:false, responsive:2}, - {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }}, + {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick: function(e, cell){ + if (e.target.closest('.delete-btn')) { + e.preventDefault(); // Prevent the default link behavior + if (confirm("Are you sure you want to delete this contact?")) { + let deleteUrl = e.target.closest('.delete-btn').getAttribute('data-delete-url'); + window.location.href = deleteUrl; + } + } + }}, ], placeholder:function(){ return this.getHeaderFilters().length ? "No Matching Data" : "No Data"; //set placeholder based on if there are currently any header filters @@ -113,11 +121,7 @@ updateSearchTerm(searchInput.value); }); }); - - function deleteRecord(id) { - console.log("Deleting record with ID: " + id); - } - + function downloadCSV() { table.download("csv", "data.csv"); } diff --git a/cp/resources/views/partials/js-domains.twig b/cp/resources/views/partials/js-domains.twig index 6d9fabd..8ca8975 100644 --- a/cp/resources/views/partials/js-domains.twig +++ b/cp/resources/views/partials/js-domains.twig @@ -28,7 +28,7 @@ actionButtons += ``; } else { actionButtons += ` `; - actionButtons += ``; + actionButtons += ``; } return actionButtons; @@ -116,7 +116,15 @@ {title:"Creation Date", width:250, minWidth:150, field:"crdate", headerSort:false, responsive:2}, {title:"Expiration Date", width:250, minWidth:150, field:"exdate", headerSort:false, responsive:2}, {title:"Status", width:150, field:"domain_status", formatter: statusFormatter, headerSort:false, download:false, responsive:2}, - {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }}, + {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick: function(e, cell){ + if (e.target.closest('.delete-btn')) { + e.preventDefault(); // Prevent the default link behavior + if (confirm("Are you sure you want to delete this domain?")) { + let deleteUrl = e.target.closest('.delete-btn').getAttribute('data-delete-url'); + window.location.href = deleteUrl; + } + } + }}, ], placeholder:function(){ return this.getHeaderFilters().length ? "No Matching Data" : "No Data"; //set placeholder based on if there are currently any header filters diff --git a/cp/resources/views/partials/js-hosts.twig b/cp/resources/views/partials/js-hosts.twig index 38c04f4..94520f4 100644 --- a/cp/resources/views/partials/js-hosts.twig +++ b/cp/resources/views/partials/js-hosts.twig @@ -29,7 +29,7 @@ function actionsFormatter(cell, formatterParams, onRendered) { return ` - + `; } @@ -108,7 +108,15 @@ {title:"Name", field:"name", width:300, headerSort:false, formatter: hostLinkFormatter, responsive:0}, {title:"Creation Date", field:"crdate", width:300, minWidth:200, headerSort:false, responsive:2}, {title:"Status", field:"host_status", width:300, minWidth:200, formatter: statusFormatter, headerSort:false, download:false, responsive:2}, - {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0}, + {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick: function(e, cell){ + if (e.target.closest('.delete-btn')) { + e.preventDefault(); // Prevent the default link behavior + if (confirm("Are you sure you want to delete this host?")) { + let deleteUrl = e.target.closest('.delete-btn').getAttribute('data-delete-url'); + window.location.href = deleteUrl; + } + } + }}, ], placeholder:function(){ return this.getHeaderFilters().length ? "No Matching Data" : "No Data"; //set placeholder based on if there are currently any header filters diff --git a/docs/install.md b/docs/install.md index ecf0715..6f9e905 100644 --- a/docs/install.md +++ b/docs/install.md @@ -524,7 +524,7 @@ mkdir /etc/bind/zones ### Generate a TSIG key: -Generate a TSIG key which will be used to authenticate DNS updates between the master and slave servers. +Generate a TSIG key which will be used to authenticate DNS updates between the master and slave servers. **Note: replace ```test``` with your TLD.** ```bash cd /etc/bind @@ -561,7 +561,7 @@ zone "test." { }; ``` -Replace `````` with the actual IP address of your slave server. +Replace `````` with the actual IP address of your slave server. Replace ```test``` with your TLD. Configure and start the ```write-zone.php``` automation script.