Merge branch 'dxcc_orbit' of https://github.com/AndreasK79/wavelog into dxcc_orbit

This commit is contained in:
Andreas Kristiansen
2024-04-14 17:53:58 +02:00
7 changed files with 83 additions and 24 deletions

View File

@@ -14,9 +14,6 @@ class Visitor extends CI_Controller {
elseif($method == "map") {
$this->map($method);
}
elseif($method == "radio_display_component") {
$this->radio_display_component($method);
}
elseif($method == "satellites") {
$this->satellites($method);
}
@@ -81,8 +78,6 @@ class Visitor extends CI_Controller {
$this->load->model('cat');
$data['radio_status'] = $this->cat->recent_status();
// Store info
$data['todays_qsos'] = $this->logbook_model->todays_qsos($logbooks_locations_array);
$data['total_qsos'] = $this->logbook_model->total_qsos($logbooks_locations_array);
@@ -133,13 +128,6 @@ class Visitor extends CI_Controller {
}
}
public function radio_display_component() {
$this->load->model('cat');
$data['radio_status'] = $this->cat->recent_status();
$this->load->view('components/radio_display_table', $data);
}
public function map() {
$this->load->model('logbook_model');
@@ -421,6 +409,16 @@ class Visitor extends CI_Controller {
public function exportmap() {
$slug = $this->security->xss_clean($this->uri->segment(3));
$lastqso = $this->security->xss_clean($this->uri->segment(4));
if ($lastqso === "lastqso") {
$this->load->model('visitor_model');
$result = $this->visitor_model->getlastqsodate($slug)->row();
header('Content-Type: application/json');
echo json_encode($result);
return;
}
$data['slug'] = $slug;
$data['page_title'] = "Export Map";
@@ -430,7 +428,7 @@ class Visitor extends CI_Controller {
}
public function mapqsos() {
$this->load->model('logbook_model');
$this->load->model('visitor_model');
$this->load->library('qra');
@@ -453,7 +451,7 @@ class Visitor extends CI_Controller {
show_404('Unknown Public Page.');
}
$qsos = $this->logbook_model->get_qsos($qsocount, null, $logbooks_locations_array, $band);
$qsos = $this->visitor_model->get_qsos($qsocount, $logbooks_locations_array, $band);
$userid = $this->stationsetup_model->public_slug_exists_userid($slug);
$user_default_confirmation = $this->get_user_default_confirmation($userid);
@@ -519,12 +517,28 @@ class Visitor extends CI_Controller {
$this->load->model('user_options_model');
$result=$this->user_options_model->get_options('map_custom', null, $userid);
$jsonout=[];
$result = $this->user_options_model->get_options('map_custom', null, $userid);
$jsonout = [];
foreach($result->result() as $options) {
if ($options->option_name=='icon') $jsonout[$options->option_key]=json_decode($options->option_value,true);
else $jsonout[$options->option_name.'_'.$options->option_key]=$options->option_value;
}
if (count($jsonout) == 0) {
$jsonout['qso'] = array(
"icon" => "fas fa-dot-circle",
"color" => "#ff0000"
);
$jsonout['qsoconfirm'] = array(
"icon" => "fas fa-dot-circle",
"color" => "#00aa00"
);
$jsonout['station'] = array(
"icon" => "fas fa-broadcast-tower",
"color" => "#0000ff"
);
}
$jsonout['gridsquare_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'gridsquare_layer','option_key'=>$slug), $userid)->row()->option_value ?? true;
$jsonout['path_lines'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'path_lines','option_key'=>$slug), $userid)->row()->option_value ?? true;
$jsonout['cqzone_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'cqzone_layer','option_key'=>$slug), $userid)->row()->option_value ?? true;

View File

@@ -0,0 +1,48 @@
<?php
class Visitor_model extends CI_Model {
function get_qsos($num, $StationLocationsArray, $band = '') {
$this->db->select($this->config->item('table_name').'.*, station_profile.*');
$this->db->from($this->config->item('table_name'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
if ($band != '') {
if ($band == 'SAT') {
$this->db->where($this->config->item('table_name').'.col_prop_mode', 'SAT');
} else {
$this->db->where($this->config->item('table_name').'.col_prop_mode !="SAT"');
$this->db->where($this->config->item('table_name').'.col_band', $band);
}
}
$this->db->where_in($this->config->item('table_name').'.station_id', $StationLocationsArray);
$this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc");
$this->db->limit($num);
return $this->db->get();
}
function getlastqsodate ($slug) {
$this->load->model('stationsetup_model');
$logbook_id = $this->stationsetup_model->public_slug_exists_logbook_id($slug);
$userid = $this->stationsetup_model->public_slug_exists_userid($slug);
$band = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'band','option_key'=>$slug), $userid)->row()->option_value ?? '';
$sql = "select max(col_time_on) lastqso from " . $this->config->item('table_name') .
" join station_profile on station_profile.station_id = " . $this->config->item('table_name') . ".station_id where 1 = 1";
if ($band != '') {
if ($band == 'SAT') {
$sql .= " and " . $this->config->item('table_name') . ".col_prop_mode = 'SAT'";
} else {
$sql .= " and " . $this->config->item('table_name') . ".col_prop_mode != 'SAT'";
$sql .= " and " . $this->config->item('table_name') . ".col_band = '". $band . "'";
}
}
return $this->db->query($sql);
}
}

View File

@@ -191,7 +191,7 @@ function echo_table_col($row, $name) {
<div class="table-responsive">
<div id="radio_display" hx-get="<?php echo site_url('visitor/radio_display_component'); ?>" hx-trigger="load, every 5s"></div>
<div id="radio_display" hx-get="<?php echo site_url('dashboard/radio_display_component'); ?>" hx-trigger="load, every 5s"></div>
<table class="table table-striped border-top">
<tr class="titles">

View File

@@ -115,8 +115,6 @@ function echo_table_col($row, $name) {
<div class="col-sm-4">
<div class="table-responsive">
<div id="radio_display" hx-get="<?php echo site_url('visitor/radio_display_component'); ?>" hx-trigger="load, every 5s"></div>
<table class="table table-striped">
<tr class="titles">

View File

@@ -8,7 +8,6 @@
<script type="text/javascript" src="<?php echo base_url() ;?>assets/js/darkmodehelpers.js"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrapdialog/js/bootstrap-dialog.min.js"></script>
<script type="text/javascript" src="<?php echo base_url() ;?>assets/js/easyprint.js"></script>
<script src="<?php echo base_url(); ?>assets/js/htmx.min.js"></script>
<script type="text/javascript">
/*

View File

@@ -78,7 +78,7 @@
<ul class="navbar-nav ms-auto">
<?php if($this->optionslib->get_option('public_github_button') != "false") { ?> <!-- != false causes to set it on per default -->
<li class="nav-item">
<a class="btn btn-secondary" href="https://github.com/wavelog/wavelog">Visit Wavelog on Github</a>
<a class="btn btn-secondary" href="https://github.com/wavelog/wavelog" target="_blank">Visit Wavelog on Github</a>
</li>
<?php } ?>
<?php if ($this->uri->segment(1) != "oqrs") { ?>

View File

@@ -281,7 +281,7 @@ global $wavelog_url;
<?php
$maxUploadFileSize = ini_get('upload_max_filesize');
$maxUploadFileSizeBytes = (int)($maxUploadFileSize) * (1024 * 1024); // convert to bytes
if ($maxUploadFileSizeBytes > ($max_upload_file_size * 1024 * 1024)) { // compare with given value in bytes
if ($maxUploadFileSizeBytes >= ($max_upload_file_size * 1024 * 1024)) { // compare with given value in bytes
?>
<span class="badge text-bg-success"><?php echo $maxUploadFileSize; ?></span>
<?php } else {
@@ -300,7 +300,7 @@ global $wavelog_url;
<?php
$maxUploadFileSize = ini_get('post_max_size');
$maxUploadFileSizeBytes = (int)($maxUploadFileSize) * (1024 * 1024); // convert to bytes
if ($maxUploadFileSizeBytes > ($post_max_size * 1024 * 1024)) { // compare with given value in bytes
if ($maxUploadFileSizeBytes >= ($post_max_size * 1024 * 1024)) { // compare with given value in bytes
?>
<span class="badge text-bg-success"><?php echo $maxUploadFileSize; ?></span>
<?php } else {
@@ -438,7 +438,7 @@ global $wavelog_url;
<div class="col">
<div class="mb-3">
<label for="db_hostname" class="form-label">Hostname or IP<i id="callbook_tooltip" data-bs-toggle="tooltip" data-bs-placement="top" title="Directory Hint" class="fas fa-question-circle text-muted ms-2" data-bs-custom-class="custom-tooltip" data-bs-html="true" data-bs-title="Usually 'localhost'. Optional with '...:[port]'. Default Port: 3306"></i></label>
<input type="text" id="db_hostname" value="localhost" class="form-control" name="db_hostname" />
<input type="text" id="db_hostname" placeholder="localhost" class="form-control" name="db_hostname" />
</div>
</div>
<div class="col">