diff --git a/application/config/migration.php b/application/config/migration.php index f11c7f7b..ff4a5901 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 140; +$config['migration_version'] = 141; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 456c3e26..9fc9f54e 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -25,6 +25,7 @@ class Logbookadvanced extends CI_Controller { $this->load->model('bands'); $this->load->model('iota'); $this->load->model('dxcc'); + $this->load->model('user_options_model'); $stationIds = []; @@ -40,6 +41,11 @@ class Logbookadvanced extends CI_Controller { $data['page_title'] = "Advanced logbook"; $data['hasDatePicker'] = true; + $userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result(); + if (isset($userOptions[0])) { + $data['options'] = $userOptions[0]->option_value; + } + $pageData = []; $pageData['datePlaceholder'] = 'DD/MM/YYYY'; $pageData['deOptions'] = $deOptions; @@ -404,4 +410,42 @@ class Logbookadvanced extends CI_Controller { return $data; } + + public function userOptions() { + $this->load->model('user_options_model'); + $userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result(); + if (isset($userOptions[0])) { + $data['options'] = $options = json_decode($userOptions[0]->option_value); + } else { + $data['options'] = null; + } + $this->load->view('logbookadvanced/useroptions', $data); + } + + public function setUserOptions() { + $json_string['datetime']['show'] = $this->input->post('datetime'); + $json_string['de']['show'] = $this->input->post('de'); + $json_string['dx']['show'] = $this->input->post('dx'); + $json_string['mode']['show'] = $this->input->post('mode'); + $json_string['rstr']['show'] = $this->input->post('rstr'); + $json_string['rsts']['show'] = $this->input->post('rsts'); + $json_string['band']['show'] = $this->input->post('band'); + $json_string['myrefs']['show'] = $this->input->post('myrefs'); + $json_string['refs']['show'] = $this->input->post('refs'); + $json_string['name']['show'] = $this->input->post('name'); + $json_string['qslvia']['show'] = $this->input->post('qslvia'); + $json_string['qsl']['show'] = $this->input->post('qsl'); + $json_string['lotw']['show'] = $this->input->post('lotw'); + $json_string['eqsl']['show'] = $this->input->post('eqsl'); + $json_string['qslmsg']['show'] = $this->input->post('qslmsg'); + $json_string['dxcc']['show'] = $this->input->post('dxcc'); + $json_string['state']['show'] = $this->input->post('state'); + $json_string['cqzone']['show'] = $this->input->post('cqzone'); + $json_string['iota']['show'] = $this->input->post('iota'); + + $obj['column_settings']= json_encode($json_string); + + $this->load->model('user_options_model'); + $this->user_options_model->set_option('LogbookAdvanced', 'LogbookAdvanced', $obj); + } } diff --git a/application/migrations/141_alter_user_options_table.php b/application/migrations/141_alter_user_options_table.php new file mode 100644 index 00000000..f62cbba6 --- /dev/null +++ b/application/migrations/141_alter_user_options_table.php @@ -0,0 +1,13 @@ +db->query("ALTER TABLE user_options CHANGE COLUMN option_value option_value text DEFAULT NULL;"); + } + + public function down(){ + } +} diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index bd7fee3b..3506c2bb 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -5,6 +5,12 @@ * */ var custom_date_format = ""; + - +
session->flashdata('message')) { ?> @@ -316,17 +324,35 @@ var custom_date_format = "";
Quick search with selected: - - - - - - - - - - - + dx->show ?? "true") == "true") { + echo ''; + } ?> + dxcc->show ?? "true") == "true") { + echo ''; + } ?> + iota->show ?? "true") == "true") { + echo ''; + } ?> + state->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + } ?> + cqzone->show ?? "true") == "true") { + echo ''; + } ?> + mode->show ?? "true") == "true") { + echo ''; + } ?> + band->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + echo ''; + echo ''; + } ?>
@@ -347,43 +373,76 @@ var custom_date_format = ""; - - + + + +
- +
- - - - - - - - - - - - - session->userdata('user_eqsl_name') != ""){ + datetime->show ?? "true") == "true") { + echo ''; + } ?> + de->show ?? "true") == "true") { + echo ''; + } ?> + dx->show ?? "true") == "true") { + echo ''; + } ?> + mode->show ?? "true") == "true") { + echo ''; + } ?> + rsts->show ?? "true") == "true") { + echo ''; + } ?> + rstr->show ?? "true") == "true") { + echo ''; + } ?> + band->show ?? "true") == "true") { + echo ''; + } ?> + myrefs->show ?? "true") == "true") { + echo ''; + } ?> + refs->show ?? "true") == "true") { + echo ''; + } ?> + name->show ?? "true") == "true") { + echo ''; + } ?> + qslvia->show ?? "true") == "true") { + echo ''; + } ?> + qsl->show ?? "true") == "true") { + echo ''; + } ?> + session->userdata('user_eqsl_name') != "" && ($options->eqsl->show ?? "true") == "true"){ echo ''; } ?> - session->userdata('user_lotw_name') != ""){ + session->userdata('user_lotw_name') != "" && ($options->lotw->show ?? "true") == "true"){ echo ''; } ?> - - - - - + qslmsg->show ?? "true") == "true") { + echo ''; + } ?> + dxcc->show ?? "true") == "true") { + echo ''; + } ?> + state->show ?? "true") == "true") { + echo ''; + } ?> + cqzone->show ?? "true") == "true") { + echo ''; + } ?> + iota->show ?? "true") == "true") { + echo ''; + } ?> diff --git a/application/views/logbookadvanced/useroptions.php b/application/views/logbookadvanced/useroptions.php new file mode 100644 index 00000000..31603b61 --- /dev/null +++ b/application/views/logbookadvanced/useroptions.php @@ -0,0 +1,86 @@ +
-
+
Date/TimeDeDxModeRST (S)RST (R)BandMy RefsRefsNameQSL ViaQSLDate/TimeDeDxModeRST (S)RST (R)BandMy RefsRefsNameQSL ViaQSLeQSLLoTWQSL MsgDXCCStateCQ ZoneIOTAQSL MsgDXCCStateCQ ZoneIOTA
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ColumnShow
Date/Time
datetime->show ?? "true") == "true") { echo 'checked'; } ?>>
De
de->show ?? "true") == "true") { echo 'checked'; } ?>>
Dx
dx->show ?? "true") == "true") { echo 'checked'; } ?>>
Mode
mode->show ?? "true") == "true") { echo 'checked'; } ?>>
RST (S)
rsts->show ?? "true") == "true") { echo 'checked'; } ?>>
RST (R)
rstr->show ?? "true") == "true") { echo 'checked'; } ?>>
Band
band->show ?? "true") == "true") { echo 'checked'; } ?>>
My Refs
myrefs->show ?? "true") == "true") { echo 'checked'; } ?>>
Refs
refs->show ?? "true") == "true") { echo 'checked'; } ?>>
Name
name->show ?? "true") == "true") { echo 'checked'; } ?>>
QSL Via
qslvia->show ?? "true") == "true") { echo 'checked'; } ?>>
QSL
qsl->show ?? "true") == "true") { echo 'checked'; } ?>>
LoTW
lotw->show ?? "true") == "true") { echo 'checked'; } ?>>
eQSL
eqsl->show ?? "true") == "true") { echo 'checked'; } ?>>
QSL Msg
qslmsg->show ?? "true") == "true") { echo 'checked'; } ?>>
DXCC
dxcc->show ?? "true") == "true") { echo 'checked'; } ?>>
State
state->show ?? "true") == "true") { echo 'checked'; } ?>>
CQ Zone
cqzone->show ?? "true") == "true") { echo 'checked'; } ?>>
IOTA
iota->show ?? "true") == "true") { echo 'checked'; } ?>>
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 824da49a..c23287fe 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -24,29 +24,63 @@ function updateRow(qso) { let row = $('#qsoID-' + qso.qsoID); let cells = row.find('td'); let c = 1; - cells.eq(c++).text(qso.qsoDateTime); - cells.eq(c++).text(qso.de); - cells.eq(c++).html(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); - cells.eq(c++).text(qso.mode); - cells.eq(c++).text(qso.rstS); - cells.eq(c++).text(qso.rstR); - cells.eq(c++).text(qso.band); - cells.eq(c++).text(qso.deRefs); - cells.eq(c++).html(qso.dxRefs); - cells.eq(c++).text(qso.name); - cells.eq(c++).text(qso.qslVia); - cells.eq(c++).html(qso.qsl); - if ($(".eqslconfirmation")[0]){ + if (user_options.datetime.show == "true"){ + cells.eq(c++).text(qso.qsoDateTime); + } + if (user_options.de.show == "true"){ + cells.eq(c++).text(qso.de); + } + if (user_options.dx.show == "true"){ + cells.eq(c++).html(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); + } + if (user_options.mode.show == "true"){ + cells.eq(c++).text(qso.mode); + } + if (user_options.rsts.show == "true"){ + cells.eq(c++).text(qso.rstS); + } + if (user_options.rstr.show == "true"){ + cells.eq(c++).text(qso.rstR); + } + if (user_options.band.show == "true"){ + cells.eq(c++).text(qso.band); + } + if (user_options.myrefs.show == "true"){ + cells.eq(c++).text(qso.deRefs); + } + if (user_options.refs.show == "true"){ + cells.eq(c++).html(qso.dxRefs); + } + if (user_options.name.show == "true"){ + cells.eq(c++).text(qso.name); + } + if (user_options.qslvia.show == "true"){ + cells.eq(c++).text(qso.qslVia); + } + if (user_options.qsl.show == "true"){ + cells.eq(c++).html(qso.qsl); + } + if ($(".eqslconfirmation")[0] && user_options.eqsl.show == "true"){ cells.eq(c++).html(qso.eqsl); } - if ($(".lotwconfirmation")[0]){ + if ($(".lotwconfirmation")[0] && user_options.lotw.show == "true"){ cells.eq(c++).html(qso.lotw); } - cells.eq(c++).text(qso.qslMessage); - cells.eq(c++).html(qso.dxcc); - cells.eq(c++).text(qso.state); - cells.eq(c++).html(qso.cqzone); - cells.eq(c++).html(qso.iota); + if (user_options.qslmsg.show == "true"){ + cells.eq(c++).text(qso.qslMessage); + } + if (user_options.dxcc.show == "true"){ + cells.eq(c++).html(qso.dxcc); + } + if (user_options.state.show == "true"){ + cells.eq(c++).text(qso.state); + } + if (user_options.cqzone.show == "true"){ + cells.eq(c++).html(qso.cqzone); + } + if (user_options.iota.show == "true"){ + cells.eq(c++).html(qso.iota); + } $('[data-toggle="tooltip"]').tooltip(); return row; @@ -67,6 +101,10 @@ function loadQSOTable(rows) { "scrollCollapse": true, "paging": false, "scrollX": true, + // colReorder: { + // order: [0, 2,1,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18] + // // order: [0, customsortorder] + // }, }); }); @@ -79,29 +117,63 @@ function loadQSOTable(rows) { var data = []; data.push('
'); - data.push(qso.qsoDateTime); - data.push(qso.de); - data.push(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); - data.push(qso.mode); - data.push(qso.rstS); - data.push(qso.rstR); - data.push(qso.band); - data.push(qso.deRefs); - data.push(qso.dxRefs); - data.push(qso.name); - data.push(qso.qslVia); - data.push(qso.qsl); - if ($(".eqslconfirmation")[0]){ + if (user_options.datetime.show == "true"){ + data.push(qso.qsoDateTime); + } + if (user_options.de.show == "true"){ + data.push(qso.de); + } + if (user_options.dx.show == "true"){ + data.push(''+qso.dx+'' + (qso.callsign == '' ? '' : ' L') + ' Lookup ' + qso.dx + ' on QRZ.com Lookup ' + qso.dx + ' on HamQTH'); + } + if (user_options.mode.show == "true"){ + data.push(qso.mode); + } + if (user_options.rsts.show == "true"){ + data.push(qso.rstS); + } + if (user_options.rstr.show == "true"){ + data.push(qso.rstR); + } + if (user_options.band.show == "true"){ + data.push(qso.band); + } + if (user_options.myrefs.show == "true"){ + data.push(qso.deRefs); + } + if (user_options.refs.show == "true"){ + data.push(qso.dxRefs); + } + if (user_options.name.show == "true"){ + data.push(qso.name); + } + if (user_options.qslvia.show == "true"){ + data.push(qso.qslVia); + } + if (user_options.qsl.show == "true"){ + data.push(qso.qsl); + } + if ($(".eqslconfirmation")[0] && user_options.eqsl.show == "true"){ data.push(qso.eqsl); } - if ($(".lotwconfirmation")[0]){ + if ($(".lotwconfirmation")[0] && user_options.lotw.show == "true"){ data.push(qso.lotw); } - data.push(qso.qslMessage); - data.push(qso.dxcc+(qso.end == null ? '' : ' Deleted DXCC')); - data.push(qso.state); - data.push(qso.cqzone); - data.push(qso.iota); + if (user_options.qslmsg.show == "true"){ + data.push(qso.qslMessage); + } + if (user_options.dxcc.show == "true"){ + data.push(qso.dxcc+(qso.end == null ? '' : ' Deleted DXCC')); + } + if (user_options.state.show == "true"){ + data.push(qso.state); + } + if (user_options.cqzone.show == "true"){ + data.push(qso.cqzone); + } + if (user_options.iota.show == "true"){ + data.push(qso.iota); + } let createdRow = table.row.add(data).index(); table.rows(createdRow).nodes().to$().data('qsoID', qso.qsoID); @@ -423,6 +495,49 @@ $(document).ready(function () { quickSearch('pota'); }); + $('#optionButton').click(function (event) { + $('#optionButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/userOptions', + type: 'post', + success: function (html) { + BootstrapDialog.show({ + title: 'Options for the Advanced Logbook', + size: BootstrapDialog.SIZE_NORMAL, + cssClass: 'options', + nl2br: false, + message: html, + onshown: function(dialog) { + }, + buttons: [{ + label: 'Save', + cssClass: 'btn-primary btn-sm', + id: 'saveButton', + action: function (dialogItself) { + $('#optionButton').prop("disabled", false); + $('#closeButton').prop("disabled", true); + saveOptions(); + dialogItself.close(); + location.reload(); + } + }, + { + label: 'Close', + cssClass: 'btn-sm', + id: 'closeButton', + action: function (dialogItself) { + $('#optionButton').prop("disabled", false); + dialogItself.close(); + } + }], + onhide: function(dialogRef){ + $('#optionButton').prop("disabled", false); + }, + }); + } + }); + }); + $('#qslSlideshow').click(function (event) { var elements = $('#qsoList tbody input:checked'); var nElements = elements.length; @@ -920,3 +1035,40 @@ function loadMap(data) { } return (table += ''); } + + function saveOptions() { + $('#saveButton').prop("disabled", true); + $('#closeButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/setUserOptions', + type: 'post', + data: { + datetime: $('input[name="datetime"]').is(':checked') ? true : false, + de: $('input[name="de"]').is(':checked') ? true : false, + dx: $('input[name="dx"]').is(':checked') ? true : false, + mode: $('input[name="mode"]').is(':checked') ? true : false, + rsts: $('input[name="rsts"]').is(':checked') ? true : false, + rstr: $('input[name="rstr"]').is(':checked') ? true : false, + band: $('input[name="band"]').is(':checked') ? true : false, + myrefs: $('input[name="myrefs"]').is(':checked') ? true : false, + refs: $('input[name="refs"]').is(':checked') ? true : false, + name: $('input[name="name"]').is(':checked') ? true : false, + qslvia: $('input[name="qslvia"]').is(':checked') ? true : false, + qsl: $('input[name="qsl"]').is(':checked') ? true : false, + lotw: $('input[name="lotw"]').is(':checked') ? true : false, + eqsl: $('input[name="eqsl"]').is(':checked') ? true : false, + qslmsg: $('input[name="qslmsg"]').is(':checked') ? true : false, + dxcc: $('input[name="dxcc"]').is(':checked') ? true : false, + state: $('input[name="state"]').is(':checked') ? true : false, + cqzone: $('input[name="cqzone"]').is(':checked') ? true : false, + iota: $('input[name="iota"]').is(':checked') ? true : false, + }, + success: function(data) { + $('#saveButton').prop("disabled", false); + $('#closeButton').prop("disabled", false); + }, + error: function() { + $('#saveButton').prop("disabled", false); + }, + }); + }