From 2b4b869d6a6967cb6c150bc35d1e71d38530f756 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:42:19 +0100 Subject: [PATCH] Can edit visitor link --- application/controllers/Stationsetup.php | 19 ++++++++++++++ application/models/Stationsetup_model.php | 14 +++++++++++ application/views/interface_assets/footer.php | 18 +++---------- .../views/stationsetup/stationsetup.php | 1 + application/views/stationsetup/visitor.php | 11 ++------ assets/js/sections/stationsetup.js | 25 +++++++++++++++++++ 6 files changed, 64 insertions(+), 24 deletions(-) diff --git a/application/controllers/Stationsetup.php b/application/controllers/Stationsetup.php index f724baf3f..44f1e9b69 100644 --- a/application/controllers/Stationsetup.php +++ b/application/controllers/Stationsetup.php @@ -190,6 +190,11 @@ class Stationsetup extends CI_Controller { $this->load->view('stationsetup/visitor', $data); } + public function saveVisitorLink() { + $this->load->model('stationsetup_model'); + $this->stationsetup_model->saveVisitorLink(); + } + public function newLocation() { $this->load->model('stations'); $this->load->model('dxcc'); @@ -348,4 +353,18 @@ class Stationsetup extends CI_Controller { return $returntext; } + public function remove_publicslug() { + $id = xss_clean($this->input->post('id',true)); + if ($id ?? '' != '') { + $this->load->model('stationsetup_model'); + $this->stationsetup_model->remove_public_slug($id); + $data['success']=1; + } else { + $data['success']=0; + $data['flashdata']='Not allowed'; + } + echo json_encode($data); + } + + } diff --git a/application/models/Stationsetup_model.php b/application/models/Stationsetup_model.php index 80435f6fe..f728be95f 100644 --- a/application/models/Stationsetup_model.php +++ b/application/models/Stationsetup_model.php @@ -20,6 +20,20 @@ class Stationsetup_model extends CI_Model { $this->db->where('logbook_id', xss_clean($this->input->post('id', true))); $this->db->update('station_logbooks', $data); } + + function remove_public_slug($logbook_id) { + $this->db->set('public_slug', null); + $this->db->where('user_id', $this->session->userdata('user_id')); + $this->db->where('logbook_id', xss_clean($logbook_id)); + $this->db->update('station_logbooks'); + } + + function saveVisitorLink() { + $this->db->set('public_slug', xss_clean($this->input->post('name', true))); + $this->db->where('user_id', $this->session->userdata('user_id')); + $this->db->where('logbook_id', xss_clean($this->input->post('id', true))); + $this->db->update('station_logbooks'); + } } ?> diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 78343f764..2c5687d8d 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -153,18 +153,6 @@ if($this->session->userdata('user_id') != null) { -uri->segment(1) == "logbooks" && $this->uri->segment(2) == "edit") { ?> - - - @@ -1906,9 +1894,9 @@ $(document).ready(function(){