From fda30f424c8e91df32d591eafea0eaca8e864ae9 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 14:28:14 +0100 Subject: [PATCH 01/35] added winkey js --- application/views/interface_assets/footer.php | 2 +- application/views/qso/index.php | 147 ++++++++++++++++++ assets/js/winkey.js | 131 ++++++++++++++++ 3 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 assets/js/winkey.js diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 202b8787..a454ad5e 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -908,7 +908,7 @@ $(document).on('keypress',function(e) { uri->segment(1) == "qso") { ?> - + Connect
+ +
+ +
@@ -516,6 +655,14 @@
+
+

Winkey

+ +
+ +
+
+

diff --git a/assets/js/winkey.js b/assets/js/winkey.js new file mode 100644 index 00000000..e5949bed --- /dev/null +++ b/assets/js/winkey.js @@ -0,0 +1,131 @@ +let sendText = document.getElementById("sendText"); +let sendButton = document.getElementById("sendButton"); +let receiveText = document.getElementById("receiveText"); +let connectButton = document.getElementById("connectButton"); +let statusBar = document.getElementById("statusBar"); + +//Couple the elements to the Events +connectButton.addEventListener("click", clickConnect) +sendButton.addEventListener("click", clickSend) +helpButton.addEventListener("click", clickHelp) +statusButton.addEventListener("click", clickStatus) + +//When the connectButton is pressed +async function clickConnect() { + if (port) { + //if already connected, disconnect + disconnect(); + + } else { + //otherwise connect + await connect(); + } +} + +//Define outputstream, inputstream and port so they can be used throughout the sketch +var outputStream, inputStream, port; +navigator.serial.addEventListener('connect', e => { + statusBar.innerText = `Connected to ${e.port}`; + connectButton.innerText = "Disconnect" +}); + +navigator.serial.addEventListener('disconnect', e => { + statusBar.innerText = `Disconnected`; + connectButton.innerText = "Connect" +}); + +//Connect to the serial +async function connect() { + + //Optional filter to only see relevant boards + const filter = { + usbVendorId: 0x2341 // Arduino SA + }; + + //Try to connect to the Serial port + try { + port = await navigator.serial.requestPort(/*{ filters: [filter] }*/); + // Continue connecting to |port|. + + // - Wait for the port to open. + await port.open({ baudRate: 1200 }); + + statusBar.innerText = "Connected"; + connectButton.innerText = "Disconnect" + + let decoder = new TextDecoderStream(); + inputDone = port.readable.pipeTo(decoder.writable); + inputStream = decoder.readable; + + const encoder = new TextEncoderStream(); + outputDone = encoder.readable.pipeTo(port.writable); + outputStream = encoder.writable; + + reader = inputStream.getReader(); + readLoop(); + } catch (e) { + //If the pipeTo error appears; clarify the problem by giving suggestions. + if (e == "TypeError: Cannot read property 'pipeTo' of undefined") { + e += "\n Use Google Chrome and enable-experimental-web-platform-features" + } + connectButton.innerText = "Connect" + statusBar.innerText = e; + } +} + +//Write to the Serial port +async function writeToStream(line) { + var enc = new TextEncoder(); // always utf-8 + + const writer = outputStream.getWriter(); + writer.write(enc); + writer.releaseLock(); +} + +//Disconnect from the Serial port +async function disconnect() { + + if (reader) { + await reader.cancel(); + await inputDone.catch(() => { }); + reader = null; + inputDone = null; + } + if (outputStream) { + await outputStream.getWriter().close(); + await outputDone; + outputStream = null; + outputDone = null; + } + statusBar.innerText = "Disconnected"; + connectButton.innerText = "Connect" + //Close the port. + await port.close(); + port = null; +} + +//When the send button is pressed +function clickSend() { + writeToStream(sendText.value); + writeToStream("\r"); + + //and clear the input field, so it's clear it has been sent + sendText.value = ""; + +} + +//Read the incoming data +async function readLoop() { + while (true) { + const { value, done } = await reader.read(); + if (done === true){ + break; + } + + console.log(value); + //When recieved something add it to the big textarea + receiveText.value += value; + //Scroll to the bottom of the text field + receiveText.scrollTop = receiveText.scrollHeight; + } +} \ No newline at end of file From 1f944571714897cf2dfa423e4a2a3300878aeb1e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 14:35:09 +0100 Subject: [PATCH 02/35] Update index.php --- application/views/qso/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 4bc30e27..010185a1 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -42,8 +42,8 @@ //Connect to the serial async function connect() { - //Optional filter to only see relevant boards - + //Optional filter to only see relevant board + //Try to connect to the Serial port try { From 4478c8fb7803d5d4bd53cbb99d294e7a8c73d7db Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 14:38:33 +0100 Subject: [PATCH 03/35] moved to js file --- application/views/interface_assets/footer.php | 2 +- application/views/qso/index.php | 143 +----------------- 2 files changed, 4 insertions(+), 141 deletions(-) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index a454ad5e..6628a27b 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -909,7 +909,7 @@ $(document).on('keypress',function(e) { uri->segment(1) == "qso") { ?> - + load->model('stations'); diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 010185a1..961039fa 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -1,142 +1,3 @@ -
- -
- -
@@ -659,7 +520,9 @@

Winkey

- +
+ +
From ac5bb52cd45a2535fd33815cac65aba5233c3221 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 14:42:53 +0100 Subject: [PATCH 04/35] test button --- application/views/qso/index.php | 1 + assets/js/winkey.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 961039fa..c5b75df8 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -522,6 +522,7 @@

+
diff --git a/assets/js/winkey.js b/assets/js/winkey.js index e5949bed..1e289dc8 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -9,6 +9,7 @@ connectButton.addEventListener("click", clickConnect) sendButton.addEventListener("click", clickSend) helpButton.addEventListener("click", clickHelp) statusButton.addEventListener("click", clickStatus) +cwfunc1Button.addEventListener("click", morsekey_func1) //When the connectButton is pressed async function clickConnect() { @@ -114,6 +115,15 @@ function clickSend() { } +function morsekey_func1() { + writeToStream("CQ CQ 2M0SQL"); + + //and clear the input field, so it's clear it has been sent + sendText.value = ""; + +} + + //Read the incoming data async function readLoop() { while (true) { From 6f93ac6db01c94e37010065679a80a55dfba4d4d Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 14:44:07 +0100 Subject: [PATCH 05/35] Update winkey.js --- assets/js/winkey.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 1e289dc8..f23d9cf5 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -116,6 +116,7 @@ function clickSend() { } function morsekey_func1() { + console.log("send CQ"); writeToStream("CQ CQ 2M0SQL"); //and clear the input field, so it's clear it has been sent From af6ba5f547819008df84e77ecb448366fc76cca9 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 14:46:14 +0100 Subject: [PATCH 06/35] onclick --- application/views/qso/index.php | 2 +- assets/js/winkey.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index c5b75df8..0844840b 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -522,7 +522,7 @@

- +
diff --git a/assets/js/winkey.js b/assets/js/winkey.js index f23d9cf5..dcdc6026 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -9,7 +9,6 @@ connectButton.addEventListener("click", clickConnect) sendButton.addEventListener("click", clickSend) helpButton.addEventListener("click", clickHelp) statusButton.addEventListener("click", clickStatus) -cwfunc1Button.addEventListener("click", morsekey_func1) //When the connectButton is pressed async function clickConnect() { From 4ec722236e676c49f2755872c05e8bd8938c1a64 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 15:35:11 +0100 Subject: [PATCH 07/35] Cleaned up the UI added a settings popup modal --- application/controllers/Qso.php | 4 +++ .../views/qso/components/winkeysettings.php | 16 ++++++++++ application/views/qso/index.php | 30 +++++++++++++++---- assets/js/sections/qso.js | 14 +++++++++ 4 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 application/views/qso/components/winkeysettings.php diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 3189df04..05916d60 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -151,6 +151,10 @@ class QSO extends CI_Controller { } } + function winkeysettings() { + $this->load->view('qso/components/winkeysettings'); + } + function edit_ajax() { $this->load->model('logbook_model'); diff --git a/application/views/qso/components/winkeysettings.php b/application/views/qso/components/winkeysettings.php new file mode 100644 index 00000000..ae80a9f1 --- /dev/null +++ b/application/views/qso/components/winkeysettings.php @@ -0,0 +1,16 @@ + + \ No newline at end of file diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 0844840b..60969b10 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -517,13 +517,33 @@
-

Winkey

+
+

Winkey + + + + +

+
-
- - -
+
+ + + + + + +

+ + +
+
diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index df22c366..50d4d3ab 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -798,3 +798,17 @@ function resetDefaultQSOFields() { $('#callsign-image-content').text(""); $('.dxccsummary').remove(); } + +function closeModal() { + var container = document.getElementById("modals-here") + var backdrop = document.getElementById("modal-backdrop") + var modal = document.getElementById("modal") + + modal.classList.remove("show") + backdrop.classList.remove("show") + + setTimeout(function() { + container.removeChild(backdrop) + container.removeChild(modal) + }, 200) +} \ No newline at end of file From 8dcd74c9784d2698f0e55b8b5fa3bc7767f3f50e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 15 May 2023 16:52:59 +0100 Subject: [PATCH 08/35] stop making life hard --- assets/js/winkey.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index dcdc6026..b483fbe0 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -78,7 +78,7 @@ async function writeToStream(line) { var enc = new TextEncoder(); // always utf-8 const writer = outputStream.getWriter(); - writer.write(enc); + writer.write(line); writer.releaseLock(); } From 96a747e15c2c05b6ac2a09d3b05f3a65f7ba17f6 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 17 May 2023 21:19:18 +0100 Subject: [PATCH 09/35] Change to interface for CW settings --- application/controllers/Qso.php | 4 + .../views/qso/components/winkeysettings.php | 85 ++++++++++++++++++- application/views/qso/index.php | 1 - 3 files changed, 86 insertions(+), 4 deletions(-) diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 05916d60..3e8a0839 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -155,6 +155,10 @@ class QSO extends CI_Controller { $this->load->view('qso/components/winkeysettings'); } + function cwmacrosave(){ + echo "lets save!"; + } + function edit_ajax() { $this->load->model('logbook_model'); diff --git a/application/views/qso/components/winkeysettings.php b/application/views/qso/components/winkeysettings.php index ae80a9f1..f0e7ccff 100644 --- a/application/views/qso/components/winkeysettings.php +++ b/application/views/qso/components/winkeysettings.php @@ -1,16 +1,95 @@ \ No newline at end of file + + diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 60969b10..e61c89c6 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -538,7 +538,6 @@ -

From 65b780e2f37893f251262e3d964f1d8bd490788b Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Fri, 2 Jun 2023 15:43:53 +0100 Subject: [PATCH 10/35] [CW Macros] Database Schema Created --- application/config/migration.php | 2 +- .../migrations/122_create_cwmacros_table.php | 116 ++++++++++++++++++ assets/js/winkey.js | 14 +++ 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 application/migrations/122_create_cwmacros_table.php diff --git a/application/config/migration.php b/application/config/migration.php index 36e3840a..372fbaf2 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 121; +$config['migration_version'] = 122; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/122_create_cwmacros_table.php b/application/migrations/122_create_cwmacros_table.php new file mode 100644 index 00000000..42940d36 --- /dev/null +++ b/application/migrations/122_create_cwmacros_table.php @@ -0,0 +1,116 @@ +db->table_exists('cwmacros')) { + $this->dbforge->add_field(array( + 'id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => TRUE, + 'unique' => TRUE + ), + + 'user_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE + ), + + 'station_location_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE + ), + + 'function1_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function1_macro' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function2_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function2_macro' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function3_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function3_macro' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function4_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function4_macro' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function5_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'function5_macro' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'modified' => array( + 'type' => 'timestamp', + 'null' => TRUE, + ) + )); + + $this->dbforge->add_key('id', TRUE); + $this->dbforge->add_key('user_id', TRUE); + $this->dbforge->add_key('station_location_id', TRUE); + + $this->dbforge->create_table('cwmacros'); + } + } + + public function down() + { + $this->dbforge->drop_table('cwmacros'); + } +} \ No newline at end of file diff --git a/assets/js/winkey.js b/assets/js/winkey.js index b483fbe0..77caa2b7 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -138,4 +138,18 @@ async function readLoop() { //Scroll to the bottom of the text field receiveText.scrollTop = receiveText.scrollHeight; } +} + +function closeModal() { + var container = document.getElementById("modals-here") + var backdrop = document.getElementById("modal-backdrop") + var modal = document.getElementById("modal") + + modal.classList.remove("show") + backdrop.classList.remove("show") + + setTimeout(function() { + container.removeChild(backdrop) + container.removeChild(modal) + }, 200) } \ No newline at end of file From 43bacdc62a6a7953e73ba78f5491b1c48a299237 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 31 Jul 2023 15:52:32 +0100 Subject: [PATCH 11/35] Save and Update Macros from the Database --- application/controllers/Qso.php | 52 +++++++++- application/models/Winkey.php | 34 +++++++ .../views/qso/components/winkeysettings.php | 21 ++-- .../qso/components/winkeysettings_results.php | 96 +++++++++++++++++++ 4 files changed, 191 insertions(+), 12 deletions(-) create mode 100644 application/models/Winkey.php create mode 100644 application/views/qso/components/winkeysettings_results.php diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 3e8a0839..b633c4be 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -152,11 +152,59 @@ class QSO extends CI_Controller { } function winkeysettings() { - $this->load->view('qso/components/winkeysettings'); + + // Load model Winkey + $this->load->model('winkey'); + + // call settings from model winkey + $data['result'] = $this->winkey->settings($this->session->userdata('user_id'), $this->session->userdata('station_profile_id')); + + if ($data['result'] == false) { + $this->load->view('qso/components/winkeysettings', $data); + } else { + $this->load->view('qso/components/winkeysettings_results', $data); + } } function cwmacrosave(){ - echo "lets save!"; + // Get the data from the form + $function1_name = xss_clean($this->input->post('function1_name')); + $function1_macro = xss_clean($this->input->post('function1_macro')); + + $function2_name = xss_clean($this->input->post('function2_name')); + $function2_macro = xss_clean($this->input->post('function2_macro')); + + $function3_name = xss_clean($this->input->post('function3_name')); + $function3_macro = xss_clean($this->input->post('function3_macro')); + + $function4_name = xss_clean($this->input->post('function4_name')); + $function4_macro = xss_clean($this->input->post('function4_macro')); + + $function5_name = xss_clean($this->input->post('function5_name')); + $function5_macro = xss_clean($this->input->post('function5_macro')); + + $data = [ + 'user_id' => $this->session->userdata('user_id'), + 'station_location_id' => $this->session->userdata('station_profile_id'), + 'function1_name' => $function1_name, + 'function1_macro' => $function1_macro, + 'function2_name' => $function2_name, + 'function2_macro' => $function2_macro, + 'function3_name' => $function3_name, + 'function3_macro' => $function3_macro, + 'function4_name' => $function4_name, + 'function4_macro' => $function4_macro, + 'function5_name' => $function5_name, + 'function5_macro' => $function5_macro, + ]; + + // Load model Winkey + $this->load->model('winkey'); + + // save the data + $this->winkey->save($data); + + echo "Macros Saved, Press Close and lets get sending!"; } function edit_ajax() { diff --git a/application/models/Winkey.php b/application/models/Winkey.php new file mode 100644 index 00000000..94c96009 --- /dev/null +++ b/application/models/Winkey.php @@ -0,0 +1,34 @@ +db->where('user_id', $user_id); + $this->db->where('station_location_id', $station_location_id); + $query = $this->db->get('cwmacros'); + + if ($query->num_rows() > 0) { + return $query->row(); + } else { + return false; + } + } + + public function save($data) + { + $this->db->where('user_id', $data['user_id']); + $this->db->where('station_location_id', $data['station_location_id']); + $query = $this->db->get('cwmacros'); + + if ($query->num_rows() > 0) { + $this->db->where('user_id', $data['user_id']); + $this->db->where('station_location_id', $data['station_location_id']); + $this->db->update('cwmacros', $data); + } else { + $this->db->insert('cwmacros', $data); + } + } +} + +?> \ No newline at end of file diff --git a/application/views/qso/components/winkeysettings.php b/application/views/qso/components/winkeysettings.php index f0e7ccff..c65c402a 100644 --- a/application/views/qso/components/winkeysettings.php +++ b/application/views/qso/components/winkeysettings.php @@ -6,18 +6,19 @@ + diff --git a/application/views/qso/components/winkeysettings_results.php b/application/views/qso/components/winkeysettings_results.php new file mode 100644 index 00000000..cd6031c9 --- /dev/null +++ b/application/views/qso/components/winkeysettings_results.php @@ -0,0 +1,96 @@ + + From 9ddcb70588f4c3074659f3baade7147c947129d2 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 11:40:32 +0100 Subject: [PATCH 12/35] Return macros as json --- application/controllers/Qso.php | 10 ++++++++++ application/models/Winkey.php | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index b633c4be..c0f49820 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -207,6 +207,16 @@ class QSO extends CI_Controller { echo "Macros Saved, Press Close and lets get sending!"; } + function cwmacros_json() { + // Load model Winkey + $this->load->model('winkey'); + + header('Content-Type: application/json; charset=utf-8'); + + // Call settings_json from model winkey + echo $this->winkey->settings_json($this->session->userdata('user_id'), $this->session->userdata('station_profile_id')); + } + function edit_ajax() { $this->load->model('logbook_model'); diff --git a/application/models/Winkey.php b/application/models/Winkey.php index 94c96009..43938fd4 100644 --- a/application/models/Winkey.php +++ b/application/models/Winkey.php @@ -7,7 +7,7 @@ class Winkey extends CI_Model $this->db->where('user_id', $user_id); $this->db->where('station_location_id', $station_location_id); $query = $this->db->get('cwmacros'); - + if ($query->num_rows() > 0) { return $query->row(); } else { @@ -15,6 +15,21 @@ class Winkey extends CI_Model } } + public function settings_json($user_id, $station_location_id) + { + $this->db->where('user_id', $user_id); + $this->db->where('station_location_id', $station_location_id); + $query = $this->db->get('cwmacros'); + + if ($query->num_rows() > 0) { + // return $query->row() as json + return json_encode($query->row()); + } else { + // return json with status not found + return json_encode(array('status' => 'not found')); + } + } + public function save($data) { $this->db->where('user_id', $data['user_id']); From ba89628b8c9d41594d5e23810fa7871704a28f33 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 14:07:11 +0100 Subject: [PATCH 13/35] Load the macros into the buttons --- application/views/qso/index.php | 10 ++--- assets/js/winkey.js | 75 +++++++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index e61c89c6..506627c0 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -533,11 +533,11 @@
- - - - - + + + + +

diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 77caa2b7..085230ef 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -1,3 +1,7 @@ +let function1Name, function1Macro, function2Name, function2Macro, function3Name, function3Macro, function4Name, function4Macro, function5Name, function5Macro; + +getMacros(); + let sendText = document.getElementById("sendText"); let sendButton = document.getElementById("sendButton"); let receiveText = document.getElementById("receiveText"); @@ -115,14 +119,41 @@ function clickSend() { } function morsekey_func1() { - console.log("send CQ"); - writeToStream("CQ CQ 2M0SQL"); - + console.log("F1: " + function1Macro); + writeToStream(function1Macro); //and clear the input field, so it's clear it has been sent sendText.value = ""; - } +function morsekey_func2() { + console.log("F2: " + function2Macro); + writeToStream(function2Macro); + //and clear the input field, so it's clear it has been sent + sendText.value = ""; +} + +function morsekey_func3() { + console.log("F3: " + function3Macro); + writeToStream(function3Macro); + //and clear the input field, so it's clear it has been sent + sendText.value = ""; +} + +function morsekey_func4() { + console.log("F4: " + function4Macro); + writeToStream(function4Macro); + //and clear the input field, so it's clear it has been sent + sendText.value = ""; +} + +function morsekey_func5() { + console.log("F5: " + function5Macro); + writeToStream(function5Macro); + //and clear the input field, so it's clear it has been sent + sendText.value = ""; +} + + //Read the incoming data async function readLoop() { @@ -148,8 +179,44 @@ function closeModal() { modal.classList.remove("show") backdrop.classList.remove("show") + getMacros(); + setTimeout(function() { container.removeChild(backdrop) container.removeChild(modal) }, 200) +} + +// Call url and store the returned json data as variables +function getMacros() { + fetch(base_url + 'index.php/qso/cwmacros_json') + .then(response => response.json()) + .then(data => { + function1Name = data.function1_name; + function1Macro = data.function1_macro; + function2Name = data.function2_name; + function2Macro = data.function2_macro; + function3Name = data.function3_name; + function3Macro = data.function3_macro; + function4Name = data.function4_name; + function4Macro = data.function4_macro; + function5Name = data.function5_name; + function5Macro = data.function5_macro; + // Do something with the variables + + const morsekey_func1_Button = document.getElementById('morsekey_func1'); + morsekey_func1_Button.textContent = 'F1 (' + function1Name + ')'; + + const morsekey_func2_Button = document.getElementById('morsekey_func2'); + morsekey_func2_Button.textContent = 'F2 (' + function2Name + ')'; + + const morsekey_func3_Button = document.getElementById('morsekey_func3'); + morsekey_func3_Button.textContent = 'F3 (' + function3Name + ')'; + + const morsekey_func4_Button = document.getElementById('morsekey_func4'); + morsekey_func4_Button.textContent = 'F4 (' + function4Name + ')'; + + const morsekey_func5_Button = document.getElementById('morsekey_func5'); + morsekey_func5_Button.textContent = 'F5 (' + function5Name + ')'; + }); } \ No newline at end of file From b13f2b032c2ad81cd165e0cfb993b3a2117c6a71 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 14:49:43 +0100 Subject: [PATCH 14/35] Implement macro shortcuts --- application/views/interface_assets/footer.php | 2 + assets/js/winkey.js | 84 +++++++++++-------- 2 files changed, 51 insertions(+), 35 deletions(-) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 6628a27b..6855a8e4 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -7,6 +7,8 @@ var base_url = ""; // Base URL var site_url = ""; // Site URL var icon_dot_url = "assets/images/dot.png"; + // get the user_callsign from session + var my_call = "session->userdata('user_callsign'); ?>".toUpperCase(); diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 085230ef..7d3d6126 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -2,6 +2,7 @@ let function1Name, function1Macro, function2Name, function2Macro, function3Name, getMacros(); + let sendText = document.getElementById("sendText"); let sendButton = document.getElementById("sendButton"); let receiveText = document.getElementById("receiveText"); @@ -119,36 +120,36 @@ function clickSend() { } function morsekey_func1() { - console.log("F1: " + function1Macro); - writeToStream(function1Macro); + console.log("F1: " + UpdateMacros(function1Macro)); + writeToStream(UpdateMacros(function1Macro)); //and clear the input field, so it's clear it has been sent sendText.value = ""; } function morsekey_func2() { - console.log("F2: " + function2Macro); - writeToStream(function2Macro); + console.log("F2: " + UpdateMacros(function2Macro)); + writeToStream(UpdateMacros(function2Macro)); //and clear the input field, so it's clear it has been sent sendText.value = ""; } function morsekey_func3() { - console.log("F3: " + function3Macro); - writeToStream(function3Macro); + console.log("F3: " + UpdateMacros(function3Macro)); + writeToStream(UpdateMacros(function3Macro)); //and clear the input field, so it's clear it has been sent sendText.value = ""; } function morsekey_func4() { - console.log("F4: " + function4Macro); - writeToStream(function4Macro); + console.log("F4: " + UpdateMacros(function4Macro)); + writeToStream(UpdateMacros(function4Macro)); //and clear the input field, so it's clear it has been sent sendText.value = ""; } function morsekey_func5() { - console.log("F5: " + function5Macro); - writeToStream(function5Macro); + console.log("F5: " + UpdateMacros(function5Macro)); + writeToStream(UpdateMacros(function5Macro)); //and clear the input field, so it's clear it has been sent sendText.value = ""; } @@ -187,36 +188,49 @@ function closeModal() { }, 200) } +function UpdateMacros(macrotext) { + + // Get the values from the form set to uppercase + let CALL = document.getElementById("callsign").value.toUpperCase(); + let RSTS = document.getElementById("rst_sent").value; + + let newString; + newString = macrotext.replace(/\[MYCALL\]/g, my_call); + newString = newString.replace(/\[CALL\]/g, CALL); + newString = newString.replace(/\[RSTS\]/g, RSTS); + console.log(newString); + return newString; +} + // Call url and store the returned json data as variables function getMacros() { fetch(base_url + 'index.php/qso/cwmacros_json') - .then(response => response.json()) - .then(data => { - function1Name = data.function1_name; - function1Macro = data.function1_macro; - function2Name = data.function2_name; - function2Macro = data.function2_macro; - function3Name = data.function3_name; - function3Macro = data.function3_macro; - function4Name = data.function4_name; - function4Macro = data.function4_macro; - function5Name = data.function5_name; - function5Macro = data.function5_macro; - // Do something with the variables + .then(response => response.json()) + .then(data => { + function1Name = data.function1_name; + function1Macro = data.function1_macro; + function2Name = data.function2_name; + function2Macro = data.function2_macro; + function3Name = data.function3_name; + function3Macro = data.function3_macro; + function4Name = data.function4_name; + function4Macro = data.function4_macro; + function5Name = data.function5_name; + function5Macro = data.function5_macro; - const morsekey_func1_Button = document.getElementById('morsekey_func1'); - morsekey_func1_Button.textContent = 'F1 (' + function1Name + ')'; + const morsekey_func1_Button = document.getElementById('morsekey_func1'); + morsekey_func1_Button.textContent = 'F1 (' + function1Name + ')'; - const morsekey_func2_Button = document.getElementById('morsekey_func2'); - morsekey_func2_Button.textContent = 'F2 (' + function2Name + ')'; + const morsekey_func2_Button = document.getElementById('morsekey_func2'); + morsekey_func2_Button.textContent = 'F2 (' + function2Name + ')'; - const morsekey_func3_Button = document.getElementById('morsekey_func3'); - morsekey_func3_Button.textContent = 'F3 (' + function3Name + ')'; - - const morsekey_func4_Button = document.getElementById('morsekey_func4'); - morsekey_func4_Button.textContent = 'F4 (' + function4Name + ')'; + const morsekey_func3_Button = document.getElementById('morsekey_func3'); + morsekey_func3_Button.textContent = 'F3 (' + function3Name + ')'; + + const morsekey_func4_Button = document.getElementById('morsekey_func4'); + morsekey_func4_Button.textContent = 'F4 (' + function4Name + ')'; - const morsekey_func5_Button = document.getElementById('morsekey_func5'); - morsekey_func5_Button.textContent = 'F5 (' + function5Name + ')'; - }); + const morsekey_func5_Button = document.getElementById('morsekey_func5'); + morsekey_func5_Button.textContent = 'F5 (' + function5Name + ')'; + }); } \ No newline at end of file From c897444913f2275c52efed1b5bfce9efe88555eb Mon Sep 17 00:00:00 2001 From: Byt3 <205er@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:02:48 +0200 Subject: [PATCH 15/35] Correction of typo [DE] Ermuttlung --> Ermittlung --- application/language/german/account_lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/language/german/account_lang.php b/application/language/german/account_lang.php index dda2d956..bd9ef7c6 100644 --- a/application/language/german/account_lang.php +++ b/application/language/german/account_lang.php @@ -44,7 +44,7 @@ $lang['account_location_auto_lookup'] = 'Automatische Ermittlung der Lokation.'; $lang['account_if_set_gridsquare_is_fetched_based_on_location_name'] = 'Wenn aktiviert, wird das Planquadrat basierend auf der Lokation ermittelt.'; $lang['account_sota_auto_lookup_gridsquare_and_name_for_summit'] = 'Automatische Ermittlung von Planquadrat und Lokation anhand des SOTA Gipfels.'; $lang['account_wwff_auto_lookup_gridsquare_and_name_for_reference'] = 'Automatische Ermittlung von Planquadrat und Lokation andhand der WWFF Referenz.'; -$lang['account_pota_auto_lookup_gridsquare_and_name_for_park'] = 'Automatische Ermuttlung des Parknamens anhand der POTA Referenz.'; +$lang['account_pota_auto_lookup_gridsquare_and_name_for_park'] = 'Automatische Ermittlung des Parknamens anhand der POTA Referenz.'; $lang['account_if_set_name_and_gridsquare_is_fetched_from_the_api_and_filled_in_location_and_locator'] = 'Wenn aktiviert, werden Name und Planquadrat über die API ermittelt und gesetzt.'; $lang['account_previous_qsl_type'] = 'QSL Typ der vorherigen QSOs'; From 3e43e613c2cbb44710b0054c7c1a90bcd294254c Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 16:05:30 +0100 Subject: [PATCH 16/35] Macros now work using the F keys --- assets/js/winkey.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 7d3d6126..a91e0489 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -2,6 +2,33 @@ let function1Name, function1Macro, function2Name, function2Macro, function3Name, getMacros(); +document.addEventListener('keydown', function(event) { + + if (event.key === 'F1') { + event.preventDefault(); + morsekey_func1(); + } + + if (event.key === 'F2') { + event.preventDefault(); + morsekey_func2(); + } + + if (event.key === 'F3') { + event.preventDefault(); + morsekey_func3(); + } + + if (event.key === 'F4') { + event.preventDefault(); + morsekey_func4(); + } + + if (event.key === 'F5') { + event.preventDefault(); + morsekey_func5(); + } + }); let sendText = document.getElementById("sendText"); let sendButton = document.getElementById("sendButton"); From 59689f80cca22597b05bf46681b4b04887df7ac0 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 16:18:56 +0100 Subject: [PATCH 17/35] Only show CW functions if using SSL and only when mode is CW --- application/views/qso/index.php | 2 +- assets/js/winkey.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 506627c0..585fe0c8 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -516,7 +516,7 @@
-
+

Winkey diff --git a/assets/js/winkey.js b/assets/js/winkey.js index a91e0489..daa04398 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -1,3 +1,34 @@ +// Lets see if CW is selected + +const ModeSelected = document.getElementById('mode'); + +if (location.protocol == 'http:') { + // Do something if the page is being served over SSL + $('#winkey').hide(); // Hide the CW buttons +} + +if (ModeSelected.value == 'CW') { + // Show the CW buttons + $('#winkey').show(); +} else { + // Hide the CW buttons + $('#winkey').hide(); +} + +ModeSelected.addEventListener('change', (event) => { + + if (event.target.value == 'CW') { + // Show the CW buttons + $('#winkey').show(); + + } else { + // Hide the CW buttons + $('#winkey').hide(); + } +}); + + + let function1Name, function1Macro, function2Name, function2Macro, function3Name, function3Macro, function4Name, function4Macro, function5Name, function5Macro; getMacros(); From c5cf2b27f5a25e5082ce3ae2116e87ff97add9dd Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 16:22:03 +0100 Subject: [PATCH 18/35] Getting ready for merge --- application/config/migration.php | 2 +- ..._create_cwmacros_table.php => 132_create_cwmacros_table.php} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename application/migrations/{122_create_cwmacros_table.php => 132_create_cwmacros_table.php} (100%) diff --git a/application/config/migration.php b/application/config/migration.php index 372fbaf2..63cb55ec 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 122; +$config['migration_version'] = 132; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/122_create_cwmacros_table.php b/application/migrations/132_create_cwmacros_table.php similarity index 100% rename from application/migrations/122_create_cwmacros_table.php rename to application/migrations/132_create_cwmacros_table.php From b79229f326303c2721595081e99fbad74a57229c Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 16:37:57 +0100 Subject: [PATCH 19/35] Hide winkey buttons --- application/views/qso/index.php | 2 +- assets/js/winkey.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index abda171c..da268c9b 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -533,7 +533,7 @@

-
+
diff --git a/assets/js/winkey.js b/assets/js/winkey.js index daa04398..db8aba5d 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -1,5 +1,11 @@ -// Lets see if CW is selected +let isWinkeyConnected = false; +// if isWinkeyConnected is false +if (!isWinkeyConnected) { + $('#winkey_buttons').hide(); +} + +// Lets see if CW is selected const ModeSelected = document.getElementById('mode'); if (location.protocol == 'http:') { @@ -70,7 +76,6 @@ let statusBar = document.getElementById("statusBar"); //Couple the elements to the Events connectButton.addEventListener("click", clickConnect) sendButton.addEventListener("click", clickSend) -helpButton.addEventListener("click", clickHelp) statusButton.addEventListener("click", clickStatus) //When the connectButton is pressed @@ -78,10 +83,11 @@ async function clickConnect() { if (port) { //if already connected, disconnect disconnect(); - + $('#winkey_buttons').hide(); } else { //otherwise connect await connect(); + $('#winkey_buttons').show(); } } @@ -107,6 +113,8 @@ async function connect() { //Try to connect to the Serial port try { + isWinkeyConnected = true; + $('#winkey_buttons').show(); port = await navigator.serial.requestPort(/*{ filters: [filter] }*/); // Continue connecting to |port|. From 1ea935692393cbedf22d526e431004bab20f251d Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 16:55:31 +0100 Subject: [PATCH 20/35] test --- assets/js/winkey.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index db8aba5d..18f6cd37 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -1,10 +1,3 @@ -let isWinkeyConnected = false; - -// if isWinkeyConnected is false -if (!isWinkeyConnected) { - $('#winkey_buttons').hide(); -} - // Lets see if CW is selected const ModeSelected = document.getElementById('mode'); @@ -114,7 +107,6 @@ async function connect() { //Try to connect to the Serial port try { isWinkeyConnected = true; - $('#winkey_buttons').show(); port = await navigator.serial.requestPort(/*{ filters: [filter] }*/); // Continue connecting to |port|. From 3d14dde83a101e9e70f3ca988aa8d038a657f0cc Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:07:29 +0100 Subject: [PATCH 21/35] more code removed --- assets/js/winkey.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 18f6cd37..c7ef035b 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -106,7 +106,6 @@ async function connect() { //Try to connect to the Serial port try { - isWinkeyConnected = true; port = await navigator.serial.requestPort(/*{ filters: [filter] }*/); // Continue connecting to |port|. From e6ee8cd9e292b29be98969214266d88ef5453d95 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:17:31 +0100 Subject: [PATCH 22/35] try turning on rts --- assets/js/winkey.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index c7ef035b..3f1112d5 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -111,6 +111,7 @@ async function connect() { // - Wait for the port to open. await port.open({ baudRate: 1200 }); + await port.setSignals({ requestToSend: true }); statusBar.innerText = "Connected"; connectButton.innerText = "Disconnect" From 569ca8218327b7bac9e25d9bcb661301d9e19470 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:18:34 +0100 Subject: [PATCH 23/35] Oops meant DTR --- assets/js/winkey.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 3f1112d5..e6f29209 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -111,7 +111,7 @@ async function connect() { // - Wait for the port to open. await port.open({ baudRate: 1200 }); - await port.setSignals({ requestToSend: true }); + await port.setSignals({ dataTerminalReady: true }); statusBar.innerText = "Connected"; connectButton.innerText = "Disconnect" From abd04d581a60d07a084b547ea2e8b107dee5a183 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:48:31 +0100 Subject: [PATCH 24/35] no idea if this works --- assets/js/winkey.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index e6f29209..3391ebb1 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -96,6 +96,11 @@ navigator.serial.addEventListener('disconnect', e => { connectButton.innerText = "Connect" }); +let debug = 0; +let speed = 24; +let minSpeed = 20; +let maxSpeed = 40; + //Connect to the serial async function connect() { @@ -123,6 +128,9 @@ async function connect() { const encoder = new TextEncoderStream(); outputDone = encoder.readable.pipeTo(port.writable); outputStream = encoder.writable; + + writeToByte("0x00, 0x02"); + writeToByte("0x02, 0x00"); reader = inputStream.getReader(); readLoop(); @@ -145,6 +153,15 @@ async function writeToStream(line) { writer.releaseLock(); } +async function writeToByte(line) { + var enc = new TextEncoder(); // always utf-8 + + const writer = outputStream.getWriter(); + const data = new Uint8Array([line]); + writer.write(line); + writer.releaseLock(); +} + //Disconnect from the Serial port async function disconnect() { From 4a60e002b8ed29133f37207bd5cd405c5aaa0856 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:53:40 +0100 Subject: [PATCH 25/35] hide cw buttons if not connected --- assets/js/winkey.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 3391ebb1..bbb54c39 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -1,6 +1,8 @@ // Lets see if CW is selected const ModeSelected = document.getElementById('mode'); +$('#winkey_buttons').hide(); + if (location.protocol == 'http:') { // Do something if the page is being served over SSL $('#winkey').hide(); // Hide the CW buttons @@ -132,6 +134,8 @@ async function connect() { writeToByte("0x00, 0x02"); writeToByte("0x02, 0x00"); + $('#winkey_buttons').show(); + reader = inputStream.getReader(); readLoop(); } catch (e) { @@ -154,8 +158,6 @@ async function writeToStream(line) { } async function writeToByte(line) { - var enc = new TextEncoder(); // always utf-8 - const writer = outputStream.getWriter(); const data = new Uint8Array([line]); writer.write(line); From 5d3dea438ab8d31c608946a64c67746275f37a2c Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:58:57 +0100 Subject: [PATCH 26/35] visual clean up --- application/views/qso/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index da268c9b..db6a8b9a 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -518,7 +518,7 @@
-
+

Winkey From c7f945bd673ecddfb987492d930f2ea9730711b5 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 18:03:55 +0100 Subject: [PATCH 27/35] Allow function key window to display when buttons arent shown --- application/views/qso/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index db6a8b9a..6f5305df 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -533,8 +533,9 @@

-
+ +
From c814399fc1c498e93b625552b1337dd8784a12f1 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 18:04:35 +0100 Subject: [PATCH 28/35] Fixed a typo --- application/views/qso/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 6f5305df..b08c0324 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -518,7 +518,7 @@
-
+

Winkey From c8d152090584db530faecaf552edc093ce667635 Mon Sep 17 00:00:00 2001 From: int2001 Date: Tue, 1 Aug 2023 19:13:40 +0000 Subject: [PATCH 29/35] When inserting qso via API (or logging) set get_qso to trusted --- application/models/Logbook_model.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 75e12b96..3c27aff0 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -536,7 +536,7 @@ class Logbook_model extends CI_Model { if (isset($result->hrdlog_code) && $result->hrdlogrealtime == 1) { $CI =& get_instance(); $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id)->result(); + $qso = $this->get_qso($last_id,true)->result(); $adif = $CI->adifhelper->getAdifLine($qso[0]); $result = $this->push_qso_to_hrdlog($result->hrdlog_code, $data['COL_STATION_CALLSIGN'], $adif); @@ -550,7 +550,7 @@ class Logbook_model extends CI_Model { if (isset($result->qrzapikey) && $result->qrzrealtime == 1) { $CI =& get_instance(); $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id)->result(); + $qso = $this->get_qso($last_id,true)->result(); $adif = $CI->adifhelper->getAdifLine($qso[0]); $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); @@ -564,7 +564,7 @@ class Logbook_model extends CI_Model { if (isset($result->webadifapikey) && $result->webadifrealtime == 1) { $CI =& get_instance(); $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id)->result(); + $qso = $this->get_qso($last_id,true)->result(); $adif = $CI->adifhelper->getAdifLine($qso[0]); $result = $this->push_qso_to_webadif( @@ -1446,8 +1446,8 @@ class Logbook_model extends CI_Model { return $this->db->get(); } - function get_qso($id) { - if ($this->logbook_model->check_qso_is_accessible($id)) { + function get_qso($id, $trusted = false) { + if ($trusted || ($this->logbook_model->check_qso_is_accessible($id))) { $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file, lotw_users.callsign as lotwuser, lotw_users.lastupload'); $this->db->from($this->config->item('table_name')); $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); From c8ea174030895a148929468bcc183ab5565fbfe9 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 2 Aug 2023 06:34:12 +0000 Subject: [PATCH 30/35] Implemented Userlanguages with a lot of help from @AndreasK79 --- application/config/config.sample.php | 57 ++++++++- application/config/migration.php | 2 +- application/controllers/User.php | 89 +++++++++---- .../migrations/133_add_user_language.php | 29 +++++ application/models/User_model.php | 21 ++-- application/views/maintenance/main.php | 117 +++++++++++------- application/views/user/edit.php | 21 +++- 7 files changed, 250 insertions(+), 86 deletions(-) create mode 100644 application/migrations/133_add_user_language.php diff --git a/application/config/config.sample.php b/application/config/config.sample.php index 081a62e8..06b0f77c 100644 --- a/application/config/config.sample.php +++ b/application/config/config.sample.php @@ -151,9 +151,62 @@ $config['url_suffix'] = ''; | there is an available translation if you intend to use something other | than english. | -*/ -$config['language'] = 'english'; + */ +$lang = 'english'; // this language will be used per default +if (isset($_COOKIE["language"])) { + $tmp_value = $_COOKIE["language"]; + if (!empty($tmp_value)) { $lang = $tmp_value; } +} +switch ($lang) { // do this for security-reasons! parse only langs, which are known to us +case 'dutch': + $config['language'] = $lang; + break; +case 'chinese_simplified': + $config['language'] = $lang; + break; +case 'spanish': + $config['language'] = $lang; + break; +case 'czech': + $config['language'] = $lang; + break; +case 'bulgarian': + $config['language'] = $lang; + break; +case 'turkish': + $config['language'] = $lang; + break; +case 'swedish': + $config['language'] = $lang; + break; +case 'polish': + $config['language'] = $lang; + break; +case 'italian': + $config['language'] = $lang; + break; +case 'greek': + $config['language'] = $lang; + break; +case 'french': + $config['language'] = $lang; + break; +case 'finnish': + $config['language'] = $lang; + break; +case 'russian': + $config['language'] = $lang; + break; +case 'english': + $config['language'] = $lang; + break; +case 'german': + $config['language'] = $lang; + break; +} + +$config['cl_multilanguage']=true; /* |-------------------------------------------------------------------------- | Default Character Set diff --git a/application/config/migration.php b/application/config/migration.php index 688dfffe..6a1ed952 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 132; +$config['migration_version'] = 133; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/User.php b/application/controllers/User.php index e713146c..41cda39f 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -7,12 +7,12 @@ class User extends CI_Controller { parent::__construct(); // Load language files - $this->lang->load(array( - 'account', - 'lotw', - 'eqsl', - 'admin', - )); + // $this->lang->load(array( + // 'account', + // 'lotw', + // 'eqsl', + // 'admin', + // )); } public function index() @@ -90,6 +90,7 @@ class User extends CI_Controller { $data['user_mastodon_url'] = $this->input->post('user_mastodon_url'); $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band'); $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); + $data['language'] = $this->input->post('language'); $this->load->view('user/add', $data); } else { $this->load->view('user/add', $data); @@ -125,6 +126,7 @@ class User extends CI_Controller { $this->input->post('user_amsat_status_upload'), $this->input->post('user_mastodon_url'), $this->input->post('user_gridmap_default_band'), + $this->input->post('language'), ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''))) { // Check for errors case EUSERNAMEEXISTS: @@ -171,16 +173,35 @@ class User extends CI_Controller { $data['user_mastodon_url'] = $this->input->post('user_mastodon_url'); $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band'); $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); + $data['language'] = $this->input->post('language'); $this->load->view('user/add', $data); $this->load->view('interface_assets/footer'); } } + function find() { + $existing_langs = array(); + $lang_path = APPPATH.'language'; + + $results = scandir($lang_path); + + foreach ($results as $result) { + if ($result === '.' or $result === '..') continue; + + if (is_dir(APPPATH.'language' . '/' . $result)) { + $dirs[] = $result; + } + } + return $dirs; + } + function edit() { $this->load->model('user_model'); if ( ($this->session->userdata('user_id') == '') || ((!$this->user_model->authorize(99)) && ($this->session->userdata('user_id') != $this->uri->segment(3))) ) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } $query = $this->user_model->get_by_id($this->uri->segment(3)); + $data['existing_languages'] = $this->find(); + $this->load->model('bands'); $this->load->library('form_validation'); @@ -208,7 +229,6 @@ class User extends CI_Controller { { $data['page_title'] = "Edit User"; - $this->load->view('interface_assets/header', $data); $q = $query->row(); $data['id'] = $q->user_id; @@ -327,6 +347,13 @@ class User extends CI_Controller { $data['user_date_format'] = $q->user_date_format; } + if($this->input->post('language')) { + $data['language'] = $this->input->post('language', true); + } else { + $data['language'] = $q->language; + } + + if($this->input->post('user_stylesheet')) { $data['user_stylesheet'] = $this->input->post('user_stylesheet', true); } else { @@ -429,11 +456,10 @@ class User extends CI_Controller { $data['user_column5'] = $q->user_column5; } + $this->load->view('interface_assets/header', $data); $this->load->view('user/edit', $data); $this->load->view('interface_assets/footer'); - } - else - { + } else { unset($data); switch($this->user_model->edit($this->input->post())) { // Check for errors @@ -448,6 +474,17 @@ class User extends CI_Controller { break; // All okay, return to user screen case OK: + if ($this->session->userdata('user_id') == $this->uri->segment(3)) { // Editing own User? Set cookie! + $cookie= array( + + 'name' => 'language', + 'value' => $this->input->post('language', true), + 'expire' => time()+1000 + // 'secure' => TRUE + + ); + $this->input->set_cookie($cookie); + } if($this->session->userdata('user_id') == $this->input->post('id', true)) { $this->session->set_flashdata('success', 'User '.$this->input->post('user_name', true).' edited'); redirect('user/edit/'.$this->uri->segment(3)); @@ -487,6 +524,7 @@ class User extends CI_Controller { $data['user_mastodon_url'] = $this->input->post('user_mastodon_url'); $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band'); $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); + $data['language'] = $this->input->post('language'); $this->load->view('user/edit'); $this->load->view('interface_assets/footer'); } @@ -557,19 +595,26 @@ class User extends CI_Controller { $data['user'] = $query->row(); - if ($this->form_validation->run() == FALSE) - { + + if ($this->form_validation->run() == FALSE) { $data['page_title'] = "Login"; $this->load->view('interface_assets/mini_header', $data); $this->load->view('user/login'); $this->load->view('interface_assets/footer'); - } - else - { + } else { if($this->user_model->login() == 1) { $this->session->set_flashdata('notice', 'User logged in'); $this->user_model->update_session($data['user']->user_id); + $cookie= array( + + 'name' => 'language', + 'value' => $data['user']->language, + 'expire' => '9999', + 'secure' => TRUE + + ); + $this->input->set_cookie($cookie); redirect('dashboard'); } else { $this->session->set_flashdata('error', 'Incorrect username or password!'); @@ -591,9 +636,9 @@ class User extends CI_Controller { /** * Function: forgot_password - * + * * Allows users to input an email address and a password will be sent to that address. - * + * */ function forgot_password() { @@ -614,7 +659,7 @@ class User extends CI_Controller { { // Check email address exists $this->load->model('user_model'); - + $check_email = $this->user_model->check_email_address($this->input->post('email', true)); if($check_email == TRUE) { @@ -623,7 +668,7 @@ class User extends CI_Controller { $reset_code = random_string('alnum', 50); $this->user_model->set_password_reset_code($this->input->post('email', true), $reset_code); - + // Send email with reset code $this->data['reset_code'] = $reset_code; @@ -676,10 +721,10 @@ class User extends CI_Controller { $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); - + $this->form_validation->set_rules('password', 'Password', 'required'); $this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required|matches[password]'); - + if ($this->form_validation->run() == FALSE) { $data['page_title'] = "Reset Password"; @@ -691,7 +736,7 @@ class User extends CI_Controller { { // Lets reset the password! $this->load->model('user_model'); - + $this->user_model->reset_password($this->input->post('password', true), $reset_code); $this->session->set_flashdata('notice', 'Password Reset.'); redirect('user/login'); diff --git a/application/migrations/133_add_user_language.php b/application/migrations/133_add_user_language.php new file mode 100644 index 00000000..2e5c7609 --- /dev/null +++ b/application/migrations/133_add_user_language.php @@ -0,0 +1,29 @@ +db->field_exists('language', 'users')) { + $fields = array( + 'language varchar(32) default "english"', + ); + + $this->dbforge->add_column('users', $fields); + } + } + + public function down() + { + if ($this->db->field_exists('language', 'users')) { + $this->dbforge->drop_column('users', 'language'); + } + } +} diff --git a/application/models/User_model.php b/application/models/User_model.php index dc9eff52..b1f1511d 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -57,9 +57,9 @@ class User_Model extends CI_Model { /* * Function: check_email_address - * + * * Checks if an email address is already in use - * + * * @param string $email */ function check_email_address($email) { @@ -68,7 +68,7 @@ class User_Model extends CI_Model { $this->db->where('user_email', $clean_email); $query = $this->db->get($this->config->item('auth_table')); - + if ($query->num_rows() > 0) { return true; } else { @@ -80,7 +80,7 @@ class User_Model extends CI_Model { $this->db->where('station_id', $station_id); $this->db->join('station_profile', 'station_profile.user_id = '.$this->config->item('auth_table').'.user_id'); $query = $this->db->get($this->config->item('auth_table')); - + $ret = $query->row(); return $ret->user_email; } @@ -124,7 +124,7 @@ class User_Model extends CI_Model { $measurement, $user_date_format, $user_stylesheet, $user_qth_lookup, $user_sota_lookup, $user_wwff_lookup, $user_pota_lookup, $user_show_notes, $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url, - $user_gridmap_default_band, $user_gridmap_confirmation) { + $user_gridmap_default_band, $user_gridmap_confirmation, $language) { // Check that the user isn't already used if(!$this->exists($username)) { $data = array( @@ -156,6 +156,7 @@ class User_Model extends CI_Model { 'user_mastodon_url' => xss_clean($user_mastodon_url), 'user_gridmap_default_band' => xss_clean($user_gridmap_default_band), 'user_gridmap_confirmation' => xss_clean($user_gridmap_confirmation), + 'language' => xss_clean($language), ); // Check the password is valid @@ -215,6 +216,7 @@ class User_Model extends CI_Model { 'user_mastodon_url' => xss_clean($fields['user_mastodon_url']), 'user_gridmap_default_band' => xss_clean($fields['user_gridmap_default_band']), 'user_gridmap_confirmation' => (isset($fields['user_gridmap_confirmation_qsl']) ? 'Q' : '').(isset($fields['user_gridmap_confirmation_lotw']) ? 'L' : '').(isset($fields['user_gridmap_confirmation_eqsl']) ? 'E' : ''), + 'language' => xss_clean($fields['language']), ); // Check to see if the user is allowed to change user levels @@ -339,6 +341,7 @@ class User_Model extends CI_Model { 'user_gridmap_default_band' => $u->row()->user_gridmap_default_band, 'user_gridmap_confirmation' => $u->row()->user_gridmap_confirmation, 'active_station_logbook' => $u->row()->active_station_logbook, + 'language' => isset($u->row()->language) ? $u->row()->language: 'english', ); $this->session->set_userdata($userdata); @@ -439,7 +442,7 @@ class User_Model extends CI_Model { * * Stores generated password reset code in the database and sets the date to exactly * when the sql query runs. - * + * * @param string $user_email * @return string $reset_code */ @@ -448,7 +451,7 @@ class User_Model extends CI_Model { 'reset_password_code' => $reset_code, 'reset_password_date' => date('Y-m-d H:i:s') ); - + $this->db->where('user_email', $user_email); $this->db->update('users', $data); } @@ -457,7 +460,7 @@ class User_Model extends CI_Model { * FUNCTION: reset_password * * Sets new password for users account where the reset code matches then clears the password reset code and password reset date. - * + * * @param string $password * @return string $reset_code */ @@ -467,7 +470,7 @@ class User_Model extends CI_Model { 'reset_password_code' => NULL, 'reset_password_date' => NULL ); - + $this->db->where('reset_password_code', $reset_code); $this->db->update('users', $data); } diff --git a/application/views/maintenance/main.php b/application/views/maintenance/main.php index bcc2b22a..354cc2b4 100644 --- a/application/views/maintenance/main.php +++ b/application/views/maintenance/main.php @@ -1,57 +1,78 @@
-
- session->flashdata('message')) { ?> - -
-

session->flashdata('message'); ?>

-
- - -

- -
-
- Maintenance -
-= 1) { ?> - -
-

Please reassign those QSOs to an existing station location:

- - -
- - - - - - - - - - + session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + +

+ +
+
+ QSO-DB Maintenance +
+ = 1) { ?> + +
+

Please reassign those QSOs to an existing station location:

+ + +
+
CallTarget LocationReassign
+ + + + + + + + + '; } ?> -
CallTarget LocationReassign
'.$call['COL_STATION_CALLSIGN'].'
-
-
- - + + +
+
+ + +

-
- - +
+
+ Settings Maintenance +
+ config->item('cl_multilanguage')) { ?> + +
+

Please edit your ./application/config/config.php File and add some rows to it:

+ Go to your application/config Folder and compare config.sample.php with your config.php
+ You'll probably find a block with language-settings. Please include this block into your current config.php +

+
+ + + + +
diff --git a/application/views/user/edit.php b/application/views/user/edit.php index 23c1d781..a3710050 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -73,11 +73,11 @@ $levels = $this->config->item('auth_level'); foreach ($levels as $key => $value) { echo ''; - } + } ?>
+ + config->item('cl_multilanguage')) { ?> +
+ + + Choose Cloudlog language. +
+
From 5d98554999f759634b6651e5dad643303ef40587 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 2 Aug 2023 06:37:56 +0000 Subject: [PATCH 31/35] Fixed lifetime of cookie and language-loading --- application/controllers/User.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index 41cda39f..d279da46 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -6,13 +6,12 @@ class User extends CI_Controller { { parent::__construct(); - // Load language files - // $this->lang->load(array( - // 'account', - // 'lotw', - // 'eqsl', - // 'admin', - // )); + $this->lang->load(array( + 'account', + 'lotw', + 'eqsl', + 'admin', + )); } public function index() @@ -479,8 +478,8 @@ class User extends CI_Controller { 'name' => 'language', 'value' => $this->input->post('language', true), - 'expire' => time()+1000 - // 'secure' => TRUE + 'expire' => time()+1000, + 'secure' => FALSE ); $this->input->set_cookie($cookie); @@ -610,8 +609,8 @@ class User extends CI_Controller { 'name' => 'language', 'value' => $data['user']->language, - 'expire' => '9999', - 'secure' => TRUE + 'expire' => time()+1000, + 'secure' => FALSE ); $this->input->set_cookie($cookie); From bca73b12950e89aa066fdc3afbc7fc240e8caf88 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 2 Aug 2023 07:06:34 +0000 Subject: [PATCH 32/35] Commented migscript, Added lang-choser to Useradd --- application/controllers/User.php | 16 ++++++++-------- application/migrations/133_add_user_language.php | 3 +-- application/views/user/add.php | 12 ++++++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index d279da46..3c417c5f 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -32,6 +32,8 @@ class User extends CI_Controller { $this->load->model('user_model'); if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $data['existing_languages'] = $this->find(); + $this->load->model('bands'); $this->load->library('form_validation'); @@ -53,15 +55,14 @@ class User extends CI_Controller { // Get timezones $data['timezones'] = $this->user_model->timezones(); + $data['language'] = 'english'; - if ($this->form_validation->run() == FALSE) - { + if ($this->form_validation->run() == FALSE) { $data['page_title'] = "Add User"; $data['measurement_base'] = $this->config->item('measurement_base'); $this->load->view('interface_assets/header', $data); - if($this->input->post('user_name')) - { + if($this->input->post('user_name')) { $data['user_name'] = $this->input->post('user_name'); $data['user_email'] = $this->input->post('user_email'); $data['user_password'] = $this->input->post('user_password'); @@ -95,9 +96,7 @@ class User extends CI_Controller { $this->load->view('user/add', $data); } $this->load->view('interface_assets/footer'); - } - else - { + } else { switch($this->user_model->add($this->input->post('user_name'), $this->input->post('user_password'), $this->input->post('user_email'), @@ -125,8 +124,9 @@ class User extends CI_Controller { $this->input->post('user_amsat_status_upload'), $this->input->post('user_mastodon_url'), $this->input->post('user_gridmap_default_band'), + ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''), $this->input->post('language'), - ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''))) { + )) { // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username '.$this->input->post('user_name').' already in use!'; diff --git a/application/migrations/133_add_user_language.php b/application/migrations/133_add_user_language.php index 2e5c7609..b6222b7f 100644 --- a/application/migrations/133_add_user_language.php +++ b/application/migrations/133_add_user_language.php @@ -3,8 +3,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); /* - * This adds an option to enable grid and name lookup - * for WWFF references + * This adds a field to user-table to hold/persist language-setting per user */ class Migration_add_user_language extends CI_Migration { diff --git a/application/views/user/add.php b/application/views/user/add.php index a7bd8897..c71104d9 100644 --- a/application/views/user/add.php +++ b/application/views/user/add.php @@ -190,6 +190,18 @@
+ config->item('cl_multilanguage')) { ?> +
+ + + Choose Cloudlog language. +
+
From 6b732dfa12478e7420a7d04ea9f3696c9036e52e Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:20:51 +0200 Subject: [PATCH 33/35] Updated readme about PHP8.2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f7fee13..e94862bb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Website: [http://www.cloudlog.co.uk](http://www.cloudlog.co.uk) ## Requirements * Linux based Operating System * Apache (Nginx should work) -* PHP Version 7.4 (PHP 8.0 is working, 8.1 might have some undetected issues, please report so we can fix) +* PHP Version 7.4 (PHP 8.2 works) * MySQL (MySQL 5.7 or higher) Notes From 36f0a30923e65436386153a5744487288af8a1eb Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 2 Aug 2023 13:29:04 +0100 Subject: [PATCH 34/35] Updated the install config with the latest parts for language. --- install/config/config.php | 58 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/install/config/config.php b/install/config/config.php index 9a17f463..1950c5af 100644 --- a/install/config/config.php +++ b/install/config/config.php @@ -153,8 +153,62 @@ $config['url_suffix'] = ''; | there is an available translation if you intend to use something other | than english. | -*/ -$config['language'] = 'english'; + */ +$lang = 'english'; // this language will be used per default + +if (isset($_COOKIE["language"])) { + $tmp_value = $_COOKIE["language"]; + if (!empty($tmp_value)) { $lang = $tmp_value; } +} +switch ($lang) { // do this for security-reasons! parse only langs, which are known to us +case 'dutch': + $config['language'] = $lang; + break; +case 'chinese_simplified': + $config['language'] = $lang; + break; +case 'spanish': + $config['language'] = $lang; + break; +case 'czech': + $config['language'] = $lang; + break; +case 'bulgarian': + $config['language'] = $lang; + break; +case 'turkish': + $config['language'] = $lang; + break; +case 'swedish': + $config['language'] = $lang; + break; +case 'polish': + $config['language'] = $lang; + break; +case 'italian': + $config['language'] = $lang; + break; +case 'greek': + $config['language'] = $lang; + break; +case 'french': + $config['language'] = $lang; + break; +case 'finnish': + $config['language'] = $lang; + break; +case 'russian': + $config['language'] = $lang; + break; +case 'english': + $config['language'] = $lang; + break; +case 'german': + $config['language'] = $lang; + break; +} + +$config['cl_multilanguage']=true; /* |-------------------------------------------------------------------------- From 8e93b2a874392deb4a523fbcd211b29de8db2804 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 2 Aug 2023 14:44:37 +0100 Subject: [PATCH 35/35] [Maintenance] Cleaned up the bottom margin leaving white space --- application/views/maintenance/main.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/views/maintenance/main.php b/application/views/maintenance/main.php index 354cc2b4..fef8627d 100644 --- a/application/views/maintenance/main.php +++ b/application/views/maintenance/main.php @@ -9,12 +9,12 @@

-
+
QSO-DB Maintenance
= 1) { ?> -