mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #1577 from filipmelik/dashboard-qso-count
Dashboard QSO count setting
This commit is contained in:
@@ -45,6 +45,9 @@ define('EFORBIDDEN', 'Forbidden');
|
||||
|
||||
define('OK', 'OK');
|
||||
|
||||
define('DASHBOARD_DEFAULT_QSOS_COUNT', 20);
|
||||
define('DASHBOARD_QSOS_COUNT_LIMIT', 50);
|
||||
|
||||
|
||||
/* End of file constants.php */
|
||||
/* Location: ./application/config/constants.php */
|
||||
|
||||
@@ -114,7 +114,11 @@ class Dashboard extends CI_Controller {
|
||||
$data['qrz_sent_today'] = $QSLStatsBreakdownArray['QRZ_Sent_today'];
|
||||
$data['qrz_rcvd_today'] = $QSLStatsBreakdownArray['QRZ_Received_today'];
|
||||
|
||||
$data['last_qsos_list'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array);
|
||||
$last_qso_count = $this->session->userdata('dashboard_last_qso_count');
|
||||
$data['last_qsos_list'] = $this->logbook_model->get_last_qsos(
|
||||
$last_qso_count == '' ? DASHBOARD_DEFAULT_QSOS_COUNT : $last_qso_count,
|
||||
$logbooks_locations_array,
|
||||
);
|
||||
|
||||
$data['vucc'] = $this->vucc->fetchVuccSummary();
|
||||
$data['vuccSAT'] = $this->vucc->fetchVuccSummary('SAT');
|
||||
|
||||
@@ -177,6 +177,10 @@ class User extends CI_Controller {
|
||||
$data['timezones'] = $this->user_model->timezones();
|
||||
$data['user_language'] = 'english';
|
||||
|
||||
// Values for the "dashboard last QSO count" selectbox
|
||||
$data['dashboard_last_qso_count_limit'] = DASHBOARD_QSOS_COUNT_LIMIT;
|
||||
$data['user_dashboard_last_qso_count'] = DASHBOARD_DEFAULT_QSOS_COUNT;
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data['page_title'] = __("Add User");
|
||||
$data['measurement_base'] = $this->config->item('measurement_base');
|
||||
@@ -371,10 +375,14 @@ class User extends CI_Controller {
|
||||
// Get timezones
|
||||
$data['timezones'] = $this->user_model->timezones();
|
||||
|
||||
// Max value to be present in the "dashboard last QSO count" selectbox
|
||||
$data['dashboard_last_qso_count_limit'] = DASHBOARD_QSOS_COUNT_LIMIT;
|
||||
|
||||
$data['page_title'] = __("Edit User");
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
// Prepare data and render the user options view
|
||||
$q = $query->row();
|
||||
|
||||
$data['id'] = $q->user_id;
|
||||
@@ -749,11 +757,13 @@ class User extends CI_Controller {
|
||||
|
||||
$data['user_locations_quickswitch'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'locations_quickswitch'), $this->uri->segment(3))->row()->option_value ?? 'false');
|
||||
$data['user_utc_headermenu'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'utc_headermenu'), $this->uri->segment(3))->row()->option_value ?? 'false');
|
||||
$data['user_dashboard_last_qso_count'] = ($this->user_options_model->get_options('dashboard', array('option_name'=>'last_qso_count', 'option_key' => 'count'), $this->uri->segment(3))->row()->option_value ?? DASHBOARD_DEFAULT_QSOS_COUNT);
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('user/edit', $data);
|
||||
$this->load->view('interface_assets/footer', $footerData);
|
||||
} else {
|
||||
// Data was submitted for saving - save updated options in DB
|
||||
unset($data);
|
||||
switch($this->user_model->edit($this->input->post())) {
|
||||
// Check for errors
|
||||
@@ -844,6 +854,7 @@ class User extends CI_Controller {
|
||||
$data['user_winkey'] = $this->input->post('user_winkey');
|
||||
$data['user_hamsat_key'] = $this->input->post('user_hamsat_key');
|
||||
$data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only');
|
||||
$data['user_dashboard_last_qso_count'] = $this->input->post('user_dashboard_last_qso_count', true);
|
||||
$this->load->view('user/edit');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
@@ -325,6 +325,10 @@ class User_Model extends CI_Model {
|
||||
'winkey' => xss_clean($fields['user_winkey']),
|
||||
);
|
||||
|
||||
// Hard limit safety check for last (recent) QSO count setting
|
||||
$dashboard_last_qso_count = xss_clean($fields['user_dashboard_last_qso_count']);
|
||||
$dashboard_last_qso_count = $dashboard_last_qso_count > DASHBOARD_QSOS_COUNT_LIMIT ? DASHBOARD_QSOS_COUNT_LIMIT : $dashboard_last_qso_count;
|
||||
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','api','".xss_clean($fields['user_hamsat_key'])."');");
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','workable','".xss_clean($fields['user_hamsat_workable_only'])."');");
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','iota','show',".(xss_clean($fields['user_iota_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
|
||||
@@ -333,6 +337,8 @@ class User_Model extends CI_Model {
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','pota','show',".(xss_clean($fields['user_pota_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','sig','show',".(xss_clean($fields['user_sig_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','dok','show',".(xss_clean($fields['user_dok_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
|
||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'dashboard','last_qso_count','count','".$dashboard_last_qso_count."');");
|
||||
$this->session->set_userdata('dashboard_last_qso_count', $dashboard_last_qso_count);
|
||||
|
||||
// Check to see if the user is allowed to change user levels
|
||||
if($this->session->userdata('user_type') == 99) {
|
||||
@@ -516,6 +522,7 @@ class User_Model extends CI_Model {
|
||||
'hasQrzKey' => $this->hasQrzKey($u->row()->user_id),
|
||||
'impersonate' => $this->session->userdata('impersonate') ?? false,
|
||||
'clubstation' => $u->row()->clubstation,
|
||||
'dashboard_last_qso_count' => ($this->session->userdata('dashboard_last_qso_count') ?? '') == '' ? ($this->user_options_model->get_options('dashboard', array('option_name' => 'last_qso_count', 'option_key' => 'count'))->row()->option_value ?? '') : $this->session->userdata('dashboard_last_qso_count'),
|
||||
'source_uid' => $this->session->userdata('source_uid') ?? ''
|
||||
);
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ function getDistance($distance) {
|
||||
<div class="col-sm-8">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover border-top">
|
||||
<table class="table table-striped table-hover border-top mb-2">
|
||||
|
||||
<thead>
|
||||
<tr class="titles">
|
||||
@@ -270,6 +270,9 @@ function getDistance($distance) {
|
||||
<?php $i++; } } ?>
|
||||
</table>
|
||||
</div>
|
||||
<small class="mb-3 me-2" style="float: right;">
|
||||
<?= sprintf(_ngettext("Max. %d previous contact is shown", "Max. %d previous contacts are shown", intval($this->session->userdata('dashboard_last_qso_count'))), intval($this->session->userdata('dashboard_last_qso_count'))); ?>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
|
||||
@@ -830,7 +830,9 @@ function showActivatorsMap(call, count, grids) {
|
||||
<?php } else { ?>
|
||||
var grid = "No";
|
||||
<?php } ?>
|
||||
initmap(grid,'map',{'dataPost':{'nb_qso':'18'}});
|
||||
|
||||
<?php printf("var dashboard_qso_count = '%d';", $this->session->userdata('dashboard_last_qso_count')) ?>
|
||||
initmap(grid,'map',{'dataPost':{'nb_qso': dashboard_qso_count}});
|
||||
|
||||
<?php if ($is_first_login ?? false) : ?>
|
||||
$('#firstLoginWizardModal').modal('show');
|
||||
|
||||
@@ -590,6 +590,23 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Dashboard Settings -->
|
||||
<div class="card">
|
||||
<div class="card-header"><?= __("Dashboard Settings"); ?></div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="mb-3">
|
||||
<label for="dashboard-last-qso-count"><?= __("Select the number of latest QSOs to be displayed on dashboard."); ?></label>
|
||||
<select class="form-select" id="dashboard-last-qso-count" name="user_dashboard_last_qso_count">
|
||||
<?php for ($i = 5 ; $i <= $dashboard_last_qso_count_limit; $i += 5) {
|
||||
$selected_attribute_value = $user_dashboard_last_qso_count == $i ? " selected =\"selected\"" : "";
|
||||
printf("<option value=\"{$i}\"{$selected_attribute_value}>{$i}</option>");
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md">
|
||||
<div class="card">
|
||||
|
||||
Reference in New Issue
Block a user