Added user option for enabling QSO end time logging

pull/2632/head
phl0 2023-11-01 13:55:04 +01:00
rodzic 36d9a95ebb
commit f670a06059
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 48EA1E640798CA9A
9 zmienionych plików z 88 dodań i 6 usunięć

Wyświetl plik

@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
$config['migration_version'] = 147;
$config['migration_version'] = 148;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -90,6 +90,7 @@ class User extends CI_Controller {
$data['user_mastodon_url'] = $this->input->post('user_mastodon_url');
$data['user_default_band'] = $this->input->post('user_default_band');
$data['user_default_confirmation'] = ($this->input->post('user_default_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_default_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_default_confirmation_eqsl') !== null ? 'E' : '');
$data['user_qso_end_times'] = $this->input->post('user_qso_end_times');
$data['language'] = $this->input->post('language');
$this->load->view('user/add', $data);
} else {
@ -125,6 +126,7 @@ class User extends CI_Controller {
$this->input->post('user_mastodon_url'),
$this->input->post('user_default_band'),
($this->input->post('user_default_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_default_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_default_confirmation_eqsl') !== null ? 'E' : ''),
$this->input->post('user_qso_end_times'),
$this->input->post('language'),
)) {
// Check for errors
@ -172,6 +174,7 @@ class User extends CI_Controller {
$data['user_mastodon_url'] = $this->input->post('user_mastodon_url');
$data['user_default_band'] = $this->input->post('user_default_band');
$data['user_default_confirmation'] = ($this->input->post('user_default_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_default_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_default_confirmation_eqsl') !== null ? 'E' : '');
$data['user_qso_end_times'] = $this->input->post('user_qso_end_times');
$data['language'] = $this->input->post('language');
$this->load->view('user/add', $data);
$this->load->view('interface_assets/footer');
@ -389,6 +392,12 @@ class User extends CI_Controller {
$data['user_show_notes'] = $q->user_show_notes;
}
if($this->input->post('user_qso_end_times')) {
$data['user_qso_end_times'] = $this->input->post('user_qso_end_times', true);
} else {
$data['user_qso_end_times'] = $q->user_qso_end_times;
}
if($this->input->post('user_show_profile_image')) {
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image', false);
} else {
@ -529,6 +538,7 @@ class User extends CI_Controller {
$data['user_mastodon_url'] = $this->input->post('user_mastodon_url');
$data['user_default_band'] = $this->input->post('user_default_band');
$data['user_default_confirmation'] = ($this->input->post('user_default_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_default_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_default_confirmation_eqsl') !== null ? 'E' : '');
$data['user_qso_end_times'] = $this->input->post('user_qso_end_times');
$data['language'] = $this->input->post('language');
$data['user_winkey'] = $this->input->post('user_winkey');
$this->load->view('user/edit');

Wyświetl plik

@ -33,6 +33,8 @@ $lang['account_gridsquare'] = 'Gridsquare';
$lang['account_cloudlog_preferences'] = 'Cloudlog Preferences';
$lang['account_timezone'] = 'Timezone';
$lang['account_date_format'] = 'Date Format';
$lang['account_log_end_time'] = 'Log End Times for QSOs Separately';
$lang['account_log_end_time_hint'] = 'Choose yes here if you want to log QSO start and end times separately. If set to \'No\' the end time will be the same as start time.';
$lang['account_measurement_preferences'] = 'Measurement preference';
$lang['account_select_how_you_would_like_dates_shown_when_logged_into_your_account'] = 'Select how you would like dates shown when logged into your account.';
$lang['account_choose_which_unit_distances_will_be_shown_in'] = 'Choose which unit distances will be shown in';

Wyświetl plik

@ -0,0 +1,29 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This adds an option to enable grid lookup
* by location entered
*/
class Migration_qso_end_times extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('user_qso_end_times', 'users')) {
$fields = array(
'user_qso_end_times integer DEFAULT 0 AFTER user_default_confirmation',
);
$this->dbforge->add_column('users', $fields);
}
}
public function down()
{
if ($this->db->field_exists('user_qso_end_times', 'users')) {
$this->dbforge->drop_column('users', 'user_qso_end_times');
}
}
}

Wyświetl plik

@ -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_default_band, $user_default_confirmation, $language) {
$user_default_band, $user_default_confirmation, $user_qso_end_times, $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_default_band' => xss_clean($user_default_band),
'user_default_confirmation' => xss_clean($user_default_confirmation),
'user_qso_end_times' => xss_clean($user_qso_end_times),
'language' => xss_clean($language),
);
@ -217,6 +218,7 @@ class User_Model extends CI_Model {
'user_mastodon_url' => xss_clean($fields['user_mastodon_url']),
'user_default_band' => xss_clean($fields['user_default_band']),
'user_default_confirmation' => (isset($fields['user_default_confirmation_qsl']) ? 'Q' : '').(isset($fields['user_default_confirmation_lotw']) ? 'L' : '').(isset($fields['user_default_confirmation_eqsl']) ? 'E' : ''),
'user_qso_end_times' => xss_clean($fields['user_qso_end_times']),
'language' => xss_clean($fields['language']),
'winkey' => xss_clean($fields['user_winkey']),
);
@ -343,6 +345,7 @@ class User_Model extends CI_Model {
'user_mastodon_url' => $u->row()->user_mastodon_url,
'user_default_band' => $u->row()->user_default_band,
'user_default_confirmation' => $u->row()->user_default_confirmation,
'user_qso_end_times' => isset($u->row()->user_qso_end_times) ? $u->row()->user_qso_end_times : 1,
'active_station_logbook' => $u->row()->active_station_logbook,
'language' => isset($u->row()->language) ? $u->row()->language: 'english',
'isWinkeyEnabled' => $u->row()->winkey,

Wyświetl plik

@ -1116,6 +1116,7 @@ $(document).on('keypress',function(e) {
}
});
<?php if ($this->session->userdata('user_qso_end_times') == 1) { ?>
$('#callsign').focusout(function() {
if (! manual && $('#callsign').val() != '') {
clearInterval(handleStart);
@ -1127,6 +1128,7 @@ $(document).on('keypress',function(e) {
$('#end_time').val($('#start_time').val());
}
});
<?php } ?>
jQuery(function($) {
var input = $('#callsign');

Wyświetl plik

@ -51,6 +51,7 @@
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="qso" role="tabpanel" aria-labelledby="qso-tab">
<!-- HTML for Date/Time -->
<?php if ($this->session->userdata('user_qso_end_times') == 1) { ?>
<div class="form-row">
<div class="form-group col-md-3">
<label for="start_date"><?php echo lang('general_word_date'); ?></label>
@ -59,22 +60,39 @@
<div class="form-group col-md-3">
<label for="start_time"><?php echo lang('general_word_time_on'); ?></label> <?php if ($_GET['manual'] != 1) { ?><i id="reset_time" data-toggle="tooltip" data-original-title="Reset start time" class="fas fa-stopwatch"></i><?php } ?>
<input type="text" class="form-control form-control-sm input_start_time" name="start_time" id="start_time" value="<?php if (($this->session->userdata('start_time') != NULL && ((time() - $this->session->userdata('time_stamp')) < 24 * 60 * 60))) { echo substr($this->session->userdata('start_time'),0,5); } else {echo date('H:i'); } ?>" size="7" <?php echo ($_GET['manual'] == 0 ? "disabled" : ""); ?> required pattern="[0-2][0-9]:[0-5][0-9]">
<input type="text" class="form-control form-control-sm input_start_time" name="start_time" id="start_time" value="<?php if (($this->session->userdata('start_time') != NULL && ((time() - $this->session->userdata('time_stamp')) < 24 * 60 * 60))) { echo substr($this->session->userdata('start_time'),0,5); } else { echo $_GET['manual'] == 0 ? date('H:i:s') : date('H:i'); } ?>" size="7" <?php echo ($_GET['manual'] == 0 ? "disabled" : ""); ?> required pattern="[0-2][0-9]:[0-5][0-9]">
</div>
<div class="form-group col-md-3">
<label for="end_time"><?php echo lang('general_word_time_off'); ?></label>
<input type="text" class="form-control form-control-sm input_end_time" name="end_time" id="end_time" value="<?php if (($this->session->userdata('end_time') != NULL && ((time() - $this->session->userdata('time_stamp')) < 24 * 60 * 60))) { echo substr($this->session->userdata('end_time'),0,5); } else {echo date('H:i'); } ?>" size="7" <?php echo ($_GET['manual'] == 0 ? "disabled" : ""); ?> required pattern="[0-2][0-9]:[0-5][0-9]">
<input type="text" class="form-control form-control-sm input_end_time" name="end_time" id="end_time" value="<?php if (($this->session->userdata('end_time') != NULL && ((time() - $this->session->userdata('time_stamp')) < 24 * 60 * 60))) { echo substr($this->session->userdata('end_time'),0,5); } else { echo $_GET['manual'] == 0 ? date('H:i:s') : date('H:i'); } ?>" size="7" <?php echo ($_GET['manual'] == 0 ? "disabled" : ""); ?> required pattern="[0-2][0-9]:[0-5][0-9]">
</div>
<?php if ( $_GET['manual'] == 0 ) { ?>
<input class="input_start_time" type="hidden" id="start_time" name="start_time"value="<?php echo date('H:i'); ?>" />
<input class="input_end_time" type="hidden" id="end_time" name="end_time"value="<?php echo date('H:i'); ?>" />
<input class="input_start_time" type="hidden" id="start_time" name="start_time"value="<?php echo date('H:i:s'); ?>" />
<input class="input_end_time" type="hidden" id="end_time" name="end_time"value="<?php echo date('H:i:s'); ?>" />
<input class="input_date" type="hidden" id="start_date" name="start_date" value="<?php echo date('d-m-Y'); ?>" />
<?php } ?>
</div>
<?php } else {?>
<div class="form-row">
<div class="form-group col-md-6">
<label for="start_date"><?php echo lang('general_word_date'); ?></label>
<input type="text" class="form-control form-control-sm input_date" name="start_date" id="start_date" value="<?php if (($this->session->userdata('start_date') != NULL && ((time() - $this->session->userdata('time_stamp')) < 24 * 60 * 60))) { echo $this->session->userdata('start_date'); } else { echo date('d-m-Y');}?>" <?php echo ($_GET['manual'] == 0 ? "disabled" : ""); ?> required pattern="[0-3][0-9]-[0-1][0-9]-[0-9]{4}">
</div>
<div class="form-group col-md-6">
<label for="start_time"><?php echo lang('general_word_time'); ?></label>
<input type="text" class="form-control form-control-sm input_start_time" name="start_time" id="start_time" value="<?php if (($this->session->userdata('start_time') != NULL && ((time() - $this->session->userdata('time_stamp')) < 24 * 60 * 60))) { echo substr($this->session->userdata('start_time'),0,5); } else { echo $_GET['manual'] == 0 ? date('H:i:s') : date('H:i'); } ?>" size="7" <?php echo ($_GET['manual'] == 0 ? "disabled" : ""); ?> required pattern="[0-2][0-9]:[0-5][0-9]">
</div>
<?php if ( $_GET['manual'] == 0 ) { ?>
<input class="input_start_time" type="hidden" id="start_time" name="start_time"value="<?php echo date('H:i:s'); ?>" />
<input class="input_date" type="hidden" id="start_date" name="start_date" value="<?php echo date('d-m-Y'); ?>" />
<?php } ?>
</div>
<?php } ?>
<!-- Callsign Input -->
<div class="form-row">

Wyświetl plik

@ -156,6 +156,15 @@
?>
</div>
<div class="form-group">
<label for="logendtime"><?php echo lang('account_log_end_time'); ?></label>
<select class="custom-select" id="logendtime" name="user_qso_end_times">
<option value="0"><?php echo lang('general_word_no'); ?></option>
<option value="1"><?php echo lang('general_word_yes'); ?></option>
</select>
<small id="SelectDateFormatHelp" class="form-text text-muted"><?php echo lang('account_log_end_time_hint'); ?></small>
</div>
<div class="form-group">
<label for="SelectDateFormat"><?php echo lang('account_date_format'); ?></label>
<select name="user_date_format" class="custom-select" id="SelectDateFormat"

Wyświetl plik

@ -165,6 +165,15 @@
<?php echo form_dropdown('user_timezone', $timezones, $user_timezone); ?>
</div>
<div class="form-group">
<label for="logendtime"><?php echo lang('account_log_end_time'); ?></label>
<select class="custom-select" id="logendtimes" name="user_qso_end_times">
<option value="1" <?php if ($user_qso_end_times == 1) { echo " selected =\"selected\""; } ?>><?php echo lang('general_word_yes'); ?></option>
<option value="0" <?php if ($user_qso_end_times == 0) { echo " selected =\"selected\""; } ?>><?php echo lang('general_word_no'); ?></option>
</select>
<small id="SelectDateFormatHelp" class="form-text text-muted"><?php echo lang('account_log_end_time_hint'); ?></small>
</div>
<div class="form-group">
<label for="SelectDateFormat"><?php echo lang('account_date_format'); ?></label>
<select name="user_date_format" class="custom-select" id="SelectDateFormat" aria-describedby="SelectDateFormatHelp">