Add option for default station power

这个提交包含在:
phl0 2023-04-27 23:02:57 +02:00
父节点 80f8b88c5a
当前提交 75ac1b2620
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 6 个文件被更改,包括 60 次插入3 次删除

查看文件

@ -483,6 +483,15 @@ class QSO extends CI_Controller {
echo $this->wwff->info($wwff);
}
public function get_station_power() {
$this->load->model('stations');
$stationProfile = xss_clean($this->input->post('stationProfile'));
$data = array('station_power' => $this->stations->get_station_power($stationProfile));
header('Content-Type: application/json');
echo json_encode($data);
}
function check_locator($grid) {
$grid = $this->input->post('locator');
// Allow empty locator

查看文件

@ -75,6 +75,7 @@ class Stations extends CI_Model {
'station_sig' => xss_clean(strtoupper($this->input->post('sig', true))),
'station_sig_info' => xss_clean(strtoupper($this->input->post('sig_info', true))),
'station_callsign' => xss_clean($this->input->post('station_callsign', true)),
'station_power' => xss_clean($this->input->post('station_power', true)),
'station_dxcc' => xss_clean($this->input->post('dxcc', true)),
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
'station_cq' => xss_clean($this->input->post('station_cq', true)),
@ -107,6 +108,7 @@ class Stations extends CI_Model {
'station_sig' => xss_clean($this->input->post('sig', true)),
'station_sig_info' => xss_clean($this->input->post('sig_info', true)),
'station_callsign' => xss_clean($this->input->post('station_callsign', true)),
'station_power' => xss_clean($this->input->post('station_power', true)),
'station_dxcc' => xss_clean($this->input->post('dxcc', true)),
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
'station_cq' => xss_clean($this->input->post('station_cq', true)),
@ -418,6 +420,21 @@ class Stations extends CI_Model {
}
return false;
}
public function get_station_power($id) {
$this->db->select('station_power');
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $id);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_power;
}
} else {
return null;
}
}
}
?>

查看文件

@ -1084,6 +1084,22 @@ $(document).on('keypress',function(e) {
});
<?php } ?>
$('#stationProfile').change(function() {
var stationProfile = $('#stationProfile').val();
console.log("TEST "+stationProfile);
$.ajax({
url: base_url+'index.php/qso/get_station_power',
type: 'post',
data: {'stationProfile': stationProfile},
success: function(res) {
$('#transmit_power').val(res.station_power);
},
error: function() {
$('#transmit_power').val('');
},
});
});
<?php if ($this->session->userdata('user_qth_lookup') == 1) { ?>
$('#qth').focusout(function() {
if ($('#locator').val() === '') {

查看文件

@ -156,8 +156,11 @@
<div class="form-group">
<label for="stationProfile"><?php echo $this->lang->line('cloudlog_station_profile'); ?></label>
<select id="stationProfile" class="custom-select" name="station_profile">
<?php foreach ($stations->result() as $stationrow) { ?>
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; } ?>><?php echo $stationrow->station_profile_name; ?></option>
<?php
$power = '';
foreach ($stations->result() as $stationrow) {
?>
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; $power = $stationrow->station_power; } ?>><?php echo $stationrow->station_profile_name; ?></option>
<?php } ?>
</select>
</div>
@ -203,7 +206,7 @@
<div class="form-group">
<label for="transmit_power"><?php echo $this->lang->line('gen_hamradio_transmit_power'); ?></label>
<input type="number" step="0.001" class="form-control" id="transmit_power" name="transmit_power" value="<?php echo $this->session->userdata('transmit_power'); ?>" />
<input type="number" step="0.001" class="form-control" id="transmit_power" name="transmit_power" value="<?php if ($this->session->userdata('transmit_power')) { echo $this->session->userdata('transmit_power'); } else { echo $power; } ?>" />
<small id="powerHelp" class="form-text text-muted"><?php echo $this->lang->line('qso_transmit_power_helptext'); ?></small>
</div>
</div>

查看文件

@ -40,6 +40,12 @@
<small id="stationCallsignInputHelp" class="form-text text-muted">Station callsign. For example: 2M0SQL/P</small>
</div>
<div class="form-group">
<label for="stationPowerInput">Station Power</label>
<input type="number" class="form-control" name="station_power" id="stationPowerInput" step="1" aria-describedby="stationPowerInputHelp" placeholder="10" required>
<small id="stationPowerInputHelp" class="form-text text-muted">Default station power. Overwritten by CAT.</small>
</div>
<div class="form-group">
<label for="stationDXCCInput">Station DXCC</label>
<?php if ($dxcc_list->num_rows() > 0) { ?>

查看文件

@ -47,6 +47,12 @@
<input type="text" class="form-control" name="station_callsign" id="stationCallsignInput" aria-describedby="stationCallsignInputHelp" value="<?php if(set_value('station_callsign') != "") { echo set_value('station_callsign'); } else { echo $my_station_profile->station_callsign; } ?>" required>
<small id="stationCallsignInputHelp" class="form-text text-muted">Station callsign. For example: 2M0SQL/P</small>
</div>
<div class="form-group">
<label for="stationPowerInput">Station Power</label>
<input type="number" class="form-control" name="station_power" step="1" id="stationPowerInput" aria-describedby="stationPowerInputHelp" value="<?php if(set_value('station_power') != "") { echo set_value('station_power'); } else { echo $my_station_profile->station_power; } ?>">
<small id="stationPowerInputHelp" class="form-text text-muted">Default station power. Overwritten by CAT.</small>
</div>
</div>
</div>
</div>