Skip to content

Commit ecb5609

Browse files
authored
Merge pull request wavelog#2673 from int2001/station2front
2 parents 2b7eacf + 2bf74be commit ecb5609

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

application/controllers/Qso.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ public function index() {
3131
show_404();
3232
}
3333

34-
$data['active_station_profile'] = $this->stations->find_active();
34+
if ($this->stations->check_station_is_accessible($this->session->userdata('station_profile_id') ?? 0)) { // Last Station from session accessible? Take it!
35+
$data['active_station_profile'] = $this->session->userdata('station_profile_id');
36+
} else {
37+
$data['active_station_profile'] =$this->stations->find_active();
38+
}
3539

3640
$data['notice'] = false;
3741
$data['stations'] = $this->stations->all_of_user();
@@ -88,6 +92,13 @@ public function index() {
8892
$data['user_dok_to_qso_tab'] = 0;
8993
}
9094

95+
$qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'station','option_key'=>'show'))->result();
96+
if (count($qkey_opt)>0) {
97+
$data['user_station_to_qso_tab'] = $qkey_opt[0]->option_value;
98+
} else {
99+
$data['user_station_to_qso_tab'] = 0;
100+
}
101+
91102
// Get status of DX Waterfall enable option
92103
$qkey_opt=$this->user_options_model->get_options('dxwaterfall',array('option_name'=>'enable','option_key'=>'boolean'))->result();
93104
if (count($qkey_opt)>0) {

application/controllers/User.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ function add() {
238238
$data['user_pota_to_qso_tab'] = $this->input->post('user_pota_to_qso_tab');
239239
$data['user_sig_to_qso_tab'] = $this->input->post('user_sig_to_qso_tab');
240240
$data['user_dok_to_qso_tab'] = $this->input->post('user_dok_to_qso_tab');
241+
$data['user_station_to_qso_tab'] = $this->input->post('user_station_to_qso_tab');
241242
$data['user_language'] = $this->input->post('user_language');
242243
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text') ?? '';
243244
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search') ?? 'off';
@@ -292,6 +293,7 @@ function add() {
292293
$this->input->post('user_pota_to_qso_tab'),
293294
$this->input->post('user_sig_to_qso_tab'),
294295
$this->input->post('user_dok_to_qso_tab'),
296+
$this->input->post('user_station_to_qso_tab'),
295297
$this->input->post('user_lotw_name'),
296298
$this->input->post('user_lotw_password'),
297299
$this->input->post('user_eqsl_name'),
@@ -811,6 +813,14 @@ function edit() {
811813
$data['user_dok_to_qso_tab'] = $qkey_opt[0]->option_value;
812814
}
813815
}
816+
if($this->input->post('user_station_to_qso_tab')) {
817+
$data['user_station_to_qso_tab'] = $this->input->post('user_station_to_qso_tab', false);
818+
} else {
819+
$qkey_opt=$this->user_options_model->get_options('qso_tab',array('option_name'=>'station','option_key'=>'show'), $this->uri->segment(3))->result();
820+
if (count($qkey_opt)>0) {
821+
$data['user_station_to_qso_tab'] = $qkey_opt[0]->option_value;
822+
}
823+
}
814824

815825
if($this->input->post('global_oqrs_text')) {
816826
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text', false);

application/models/User_model.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function add($username, $password, $email, $type, $firstname, $lastname, $callsi
221221
$user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url,
222222
$user_default_band, $user_default_confirmation, $user_qso_end_times, $user_qso_db_search_priority,$user_quicklog, $user_quicklog_enter,
223223
$user_language, $user_hamsat_key, $user_hamsat_workable_only, $user_iota_to_qso_tab, $user_sota_to_qso_tab,
224-
$user_wwff_to_qso_tab, $user_pota_to_qso_tab, $user_sig_to_qso_tab, $user_dok_to_qso_tab,
224+
$user_wwff_to_qso_tab, $user_pota_to_qso_tab, $user_sig_to_qso_tab, $user_dok_to_qso_tab, $user_station_to_qso_tab,
225225
$user_lotw_name, $user_lotw_password, $user_eqsl_name, $user_eqsl_password, $user_clublog_name, $user_clublog_password,
226226
$user_winkey, $on_air_widget_enabled, $on_air_widget_display_last_seen, $on_air_widget_show_only_most_recent_radio,
227227
$qso_widget_display_qso_time, $dashboard_banner, $dashboard_solar, $global_oqrs_text, $oqrs_grouped_search,
@@ -307,6 +307,7 @@ function add($username, $password, $email, $type, $firstname, $lastname, $callsi
307307
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','pota','show',".(xss_clean($user_pota_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
308308
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','sig','show',".(xss_clean($user_sig_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
309309
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','dok','show',".(xss_clean($user_dok_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
310+
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'qso_tab','station','show',".(xss_clean($user_station_to_qso_tab ?? 'off') == "on" ? 1 : 0).");");
310311
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'dashboard','show_map','boolean','".xss_clean($dashboard_map ?? 'Y')."');");
311312
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'dashboard','show_dashboard_banner','boolean','".xss_clean($dashboard_banner ?? 'Y')."');");
312313
$this->db->query("insert into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $insert_id . ", 'dashboard','show_dashboard_solar','boolean','".xss_clean($dashboard_solar ?? 'Y')."');");
@@ -380,6 +381,7 @@ function edit($fields) {
380381
$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).");");
381382
$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).");");
382383
$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).");");
384+
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','station','show',".(xss_clean($fields['user_station_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");");
383385
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'widget','on_air','enabled','".(xss_clean($fields['on_air_widget_enabled'] ?? 'false'))."');");
384386
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'widget','on_air','display_last_seen','".(xss_clean($fields['on_air_widget_display_last_seen'] ?? 'false'))."');");
385387
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'widget','on_air','display_only_most_recent_radio','".(xss_clean($fields['on_air_widget_show_only_most_recent_radio'] ?? 'true'))."');");

application/views/qso/index.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@
123123
<div class="card-body">
124124
<div class="tab-content" id="myTabContent">
125125
<div class="tab-pane fade show active" id="qso" role="tabpanel" aria-labelledby="qso-tab">
126+
127+
<?php if ($user_station_to_qso_tab ?? false) { ?>
128+
<div class="row">
129+
<div class="mb-3 col-md-12">
130+
<label class="col-sm-3 col-form-label" for="stationProfile"><?= __("Station Location"); ?></label>
131+
<select id="stationProfile" class="form-select form-control form-control-sm" name="station_profile" onChange="panMap(this.value);">
132+
<?php
133+
$power = '';
134+
foreach ($stations->result() as $stationrow) {
135+
?>
136+
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; $power = $stationrow->station_power; $station_callsign = $stationrow->station_callsign; } ?>><?php echo $stationrow->station_profile_name; ?></option>
137+
<?php } ?>
138+
</select>
139+
</div>
140+
</div>
141+
<?php } ?>
142+
126143
<!-- HTML for Date/Time -->
127144
<?php if ($this->session->userdata('user_qso_end_times') == 1) { ?>
128145
<div class="row">
@@ -369,6 +386,7 @@
369386

370387
<!-- Station Panel Data -->
371388
<div class="tab-pane fade" id="station" role="tabpanel" aria-labelledby="station-tab">
389+
<?php if (!$user_station_to_qso_tab ?? false) { ?>
372390
<div class="mb-3">
373391
<label for="stationProfile"><?= __("Station Location"); ?></label>
374392
<select id="stationProfile" class="form-select" name="station_profile" onChange="panMap(this.value);">
@@ -380,6 +398,7 @@
380398
<?php } ?>
381399
</select>
382400
</div>
401+
<?php } ?>
383402

384403
<div class="mb-3">
385404
<label for="radio"><?= __("Radio"); ?></label>

application/views/user/edit.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@
684684
</div>
685685
<div class="col-md">
686686
<div class="card">
687-
<div class="card-header"><?= __("Show Reference Fields on QSO Tab"); ?></div>
687+
<div class="card-header"><?= __("Show Fields on QSO Tab"); ?></div>
688688
<div class="card-body">
689689
<div class="row">
690690
<div class="mb-3">
@@ -713,6 +713,10 @@
713713
<input name="user_dok_to_qso_tab" class="form-check-input" type="checkbox" role="switch" id="dokToQsoTab" <?php if ($user_dok_to_qso_tab ?? false) { echo 'checked'; } ?>>
714714
<label class="form-check-label" for="dokToQsoTab" ><?= __("DOK"); ?></label>
715715
</div>
716+
<div class="form-check form-switch">
717+
<input name="user_station_to_qso_tab" class="form-check-input" type="checkbox" role="switch" id="stationToQsoTab" <?php if ($user_station_to_qso_tab ?? false) { echo 'checked'; } ?>>
718+
<label class="form-check-label" for="stationToQsoTab" ><?= __("Station Location"); ?></label>
719+
</div>
716720
</div>
717721
</div>
718722
<button type="button" onclick="clearRefSwitches();" class="btn btn-primary"><i class="fas fa-recycle"></i> <?= __("Reset"); ?></button>

0 commit comments

Comments
 (0)