Handle HRDLog-Disable

This commit is contained in:
int2001
2024-05-16 08:21:03 +00:00
parent bdb2cc6457
commit aed82b2b4d
2 changed files with 46 additions and 39 deletions

View File

@@ -12,12 +12,11 @@ class Hrdlog extends CI_Controller {
* All QSOs not previously uploaded, will then be uploaded, one at a time
*/
function __construct()
{
function __construct() {
parent::__construct();
if (ENVIRONMENT == 'maintenance' && $this->session->userdata('user_id') == '') {
echo "Maintenance Mode is active. Try again later.\n";
echo "Maintenance Mode is active. Try again later.\n";
redirect('user/login');
}
}
@@ -139,32 +138,36 @@ class Hrdlog extends CI_Controller {
* Used for ajax-function when selecting log for upload to hrdlog
*/
public function upload_station() {
$this->setOptions();
$this->load->model('stations');
if (!($this->config->item('disable_manual_hrdlog'))) {
$this->setOptions();
$this->load->model('stations');
$postData = $this->input->post();
$postData = $this->input->post();
$this->load->model('logbook_model');
$result = $this->logbook_model->exists_hrdlog_credentials($postData['station_id']);
$hrdlog_username = $result->hrdlog_username;
$hrdlog_code = $result->hrdlog_code;
header('Content-type: application/json');
$result = $this->mass_upload_qsos($postData['station_id'], $hrdlog_username, $hrdlog_code);
if ($result['status'] == 'OK') {
$stationinfo = $this->stations->stations_with_hrdlog_code();
$info = $stationinfo->result();
$this->load->model('logbook_model');
$result = $this->logbook_model->exists_hrdlog_credentials($postData['station_id']);
$hrdlog_username = $result->hrdlog_username;
$hrdlog_code = $result->hrdlog_code;
header('Content-type: application/json');
$result = $this->mass_upload_qsos($postData['station_id'], $hrdlog_username, $hrdlog_code);
if ($result['status'] == 'OK') {
$stationinfo = $this->stations->stations_with_hrdlog_code();
$info = $stationinfo->result();
$data['status'] = 'OK';
$data['info'] = $info;
$data['infomessage'] = $result['count'] . " QSOs are now uploaded to hrdlog";
$data['errormessages'] = $result['errormessages'];
echo json_encode($data);
} else {
$data['status'] = 'Error';
$data['info'] = 'No QSOs found to upload.';
$data['errormessages'] = $result['errormessages'];
echo json_encode($data);
}
$data['status'] = 'OK';
$data['info'] = $info;
$data['infomessage'] = $result['count'] . " QSOs are now uploaded to hrdlog";
$data['errormessages'] = $result['errormessages'];
echo json_encode($data);
} else {
$data['status'] = 'Error';
$data['info'] = 'No QSOs found to upload.';
$data['errormessages'] = $result['errormessages'];
echo json_encode($data);
}
} else {
redirect('dashboard');
}
}
public function mark_hrdlog() {

View File

@@ -19,10 +19,10 @@
<div class="card-body">
<div class="tab-content">
<div class="tab-pane active" id="export" role="tabpanel" aria-labelledby="export-tab">
<p>Here you can see and upload all QSOs which have not been previously uploaded to a HRDLog logbook.</p>
<p>Here you can see all QSOs which have not been previously uploaded to a HRDLog logbook.</p>
<p>You need to set a HRDLog Logbook API Code in your station profile. Only station profiles with an API Key set are displayed.</p>
<p>The Code can be demanded at <a href="http://www.hrdlog.net/EditUser.aspx" target="new" class="link">http://www.hrdlog.net/EditUser.aspx</a></p>
<p><span class="badge text-bg-warning">Warning</span> This might take a while as QSO uploads are processed sequentially.</p>
<?php if (!($this->config->item('disable_manual_eqsl'))) { echo '<p><span class="badge text-bg-warning">Warning</span> This might take a while as QSO uploads are processed sequentially.</p>'; } ?>
<?php
if ($station_profile->result()) {
@@ -39,16 +39,20 @@
<td>Actions</td>
</thead>
<tbody>';
foreach ($station_profile->result() as $station) { // Fills the table with the data
echo '<tr>';
echo '<td>' . $station->station_profile_name . '</td>';
echo '<td>' . $station->station_callsign . '</td>';
echo '<td id ="modcount'.$station->station_id.'">' . $station->modcount . '</td>';
echo '<td id ="notcount'.$station->station_id.'">' . $station->notcount . '</td>';
echo '<td id ="totcount'.$station->station_id.'">' . $station->totcount . '</td>';
echo '<td><button id="HrdlogUpload" type="button" name="HrdlogUpload" class="btn btn-primary btn-sm ld-ext-right ld-ext-right-'.$station->station_id.'" onclick="ExportHrd('. $station->station_id .')"><i class="fas fa-cloud-upload-alt"></i> Upload<div class="ld ld-ring ld-spin"></div></button></td>';
echo '</tr>';
}
foreach ($station_profile->result() as $station) { // Fills the table with the data
echo '<tr>';
echo '<td>' . $station->station_profile_name . '</td>';
echo '<td>' . $station->station_callsign . '</td>';
echo '<td id ="modcount'.$station->station_id.'">' . $station->modcount . '</td>';
echo '<td id ="notcount'.$station->station_id.'">' . $station->notcount . '</td>';
echo '<td id ="totcount'.$station->station_id.'">' . $station->totcount . '</td>';
if (!($this->config->item('disable_manual_eqsl'))) {
echo '<td><button id="HrdlogUpload" type="button" name="HrdlogUpload" class="btn btn-primary btn-sm ld-ext-right ld-ext-right-'.$station->station_id.'" onclick="ExportHrd('. $station->station_id .')"><i class="fas fa-cloud-upload-alt"></i> Upload<div class="ld ld-ring ld-spin"></div></button></td>';
} else {
echo '<td>&nbsp;</td>';
}
echo '</tr>';
}
echo '</tfoot></table>';
}