From a7ee086197d178d2e91c435414c643c91930106e Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 11 Nov 2024 17:48:54 +0100 Subject: [PATCH] Add LoTW accepted to edit/create functions --- application/controllers/Satellite.php | 9 +++++++-- application/models/Satellite_model.php | 19 ++++++++++--------- application/views/satellite/create.php | 8 ++++++++ application/views/satellite/edit.php | 13 +++++++++++++ assets/js/sections/satellite.js | 2 ++ 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index 04e26a918..d7f18cc83 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -77,10 +77,15 @@ class Satellite extends CI_Controller { $satellite['name'] = $this->security->xss_clean($this->input->post('name')); $satellite['exportname'] = $this->security->xss_clean($this->input->post('exportname')); $satellite['orbit'] = $this->security->xss_clean($this->input->post('orbit')); + if ($this->security->xss_clean($this->input->post('lotw')) == 'Y') { + $satellite['lotw'] = 'Y'; + } else {; + $satellite['lotw'] = 'N'; + } - $this->satellite_model->saveupdatedsatellite($id, $satellite); + $this->satellite_model->saveupdatedsatellite($id, $satellite); echo json_encode(array('message' => 'OK')); - return; + return; } public function delete() { diff --git a/application/models/Satellite_model.php b/application/models/Satellite_model.php index c2e567b86..07fd82409 100644 --- a/application/models/Satellite_model.php +++ b/application/models/Satellite_model.php @@ -38,19 +38,15 @@ class Satellite_model extends CI_Model { } function saveupdatedsatellite($id, $satellite) { - $this->db->where('satellite.id', $id); - - $this->db->update('satellite', $satellite); - - return true; + $this->db->where('satellite.id', $id); + $this->db->update('satellite', $satellite); + return true; } function saveSatelliteMode($id, $satmode) { $this->db->where('satellitemode.id', $id); - - $this->db->update('satellitemode', $satmode); - - return true; + $this->db->update('satellitemode', $satmode); + return true; } function add() { @@ -59,6 +55,11 @@ class Satellite_model extends CI_Model { 'exportname' => xss_clean($this->input->post('exportname', true)), 'orbit' => xss_clean($this->input->post('orbit', true)), ); + if (xss_clean($this->input->post('lotw', true)) == 'Y') { + $data['lotw'] = 'Y'; + } else { + $data['lotw'] = 'N'; + } $this->db->where('name', xss_clean($this->input->post('name', true))); $result = $this->db->get('satellite'); diff --git a/application/views/satellite/create.php b/application/views/satellite/create.php index 0a71b7683..115d9f5d3 100644 --- a/application/views/satellite/create.php +++ b/application/views/satellite/create.php @@ -65,6 +65,14 @@ +
+ + + +
diff --git a/application/views/satellite/edit.php b/application/views/satellite/edit.php index 3a353994f..763bd6509 100644 --- a/application/views/satellite/edit.php +++ b/application/views/satellite/edit.php @@ -20,6 +20,19 @@ orbit; } ?>" required> +
+ + + +
diff --git a/assets/js/sections/satellite.js b/assets/js/sections/satellite.js index 4723dae2a..0ec6ee21f 100644 --- a/assets/js/sections/satellite.js +++ b/assets/js/sections/satellite.js @@ -71,6 +71,7 @@ function createSatellite(form) { 'uplinkfrequency': form.uplinkFrequency.value, 'downlinkmode': form.downlinkMode.value, 'downlinkfrequency': form.downlinkFrequency.value, + 'lotw': form.lotwAccepted.value, }, success: function (html) { location.reload(); @@ -117,6 +118,7 @@ function saveUpdatedSatellite(form) { data: {'id': form.id.value, 'name': form.nameInput.value, 'exportname': form.exportNameInput.value, + 'lotw': form.lotwAccepted.value, 'orbit': form.orbit.value, }, success: function (html) {