adjustments

This commit is contained in:
HB9HIL
2024-07-23 14:13:56 +02:00
parent ba5796e6ce
commit 5a50a38395
3 changed files with 27 additions and 39 deletions

View File

@@ -46,26 +46,7 @@ class Widgets extends CI_Controller {
}
}
public function oqrs($logbook_slug = null) {
if ($logbook_slug == null || !$this->logbooks_model->public_slug_exists($logbook_slug)) {
show_404(__("Unknown Public Page, please make sure the public slug is correct."));
return;
}
$logbook_id = $this->logbooks_model->public_slug_exists_logbook_id($logbook_slug);
if ($logbook_id == false) {
show_404(__("Unknown Public Page, please make sure the public slug is correct."));
return;
}
$this->load->model('user_model');
$this->load->model('stationsetup_model');
$user_callsign = $this->user_model->get_by_id($this->stationsetup_model->public_slug_exists_userid($logbook_slug))->row()->user_callsign;
if ($user_callsign == false) {
log_message('error', 'No user_id or user_callsign for public slug: '. $logbook_slug);
show_404(__("Can't find any users for this public slug."));
return;
}
public function oqrs($user_callsign) {
$this->load->model('oqrs_model');
$stations = $this->oqrs_model->get_oqrs_stations();
@@ -73,11 +54,22 @@ class Widgets extends CI_Controller {
show_404(__("No stations found that are using Wavelog OQRS."));
return;
}
$slug = $this->security->xss_clean($this->input->get('slug'));
if ($slug != null) {
$data['logo_url'] = site_url() . '/visitor/' . $slug;
} else {
$data['logo_url'] = 'https://github.com/wavelog/wavelog';
}
$theme = $this->security->xss_clean($this->input->get('theme'));
if ($theme != null) {
$data['theme'] = $theme;
} else {
$data['theme'] = $this->config->item('option_theme');
}
$data['slug'] = $logbook_slug;
$data['user_callsign'] = $user_callsign;
$data['groupedSearch'] = $this->optionslib->get_option('groupedSearch');
$this->load->view('oqrs/oqrs_widget', $data);
$this->load->view('widgets/oqrs', $data);
}
}

View File

@@ -119,12 +119,14 @@ class OptionsLib {
}
function get_logo($logo_location) {
function get_logo($logo_location, $theme = null) {
$CI =& get_instance();
// get the theme with the get_theme() function above
$theme = $this->get_theme();
if ($theme == null) {
$theme = $this->get_theme();
}
// load the themes model and fetch the logo name from it
$CI->load->model('Themes_model');

View File

@@ -14,20 +14,14 @@ To use this widget insert this Element:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/darkly/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/darkly/overrides.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $theme; ?>/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $theme; ?>/overrides.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css">
<title><?= __("Wavelog OQRS"); ?></title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
.widget {
background-color: #222222;
color: white;
display: flex;
.widget.container {
max-width: none;
}
.left-column {
@@ -65,7 +59,7 @@ To use this widget insert this Element:
border-bottom: none;
}
.headerLogo {
.widgetLogo {
width: 150px;
height: 150px;
}
@@ -78,9 +72,9 @@ To use this widget insert this Element:
</head>
<body>
<div class="widget">
<div class="widget container d-flex">
<div class="left-column">
<a href="<?php echo (site_url() . '/visitor/' . $slug); ?>" target="_blank"><img class="headerLogo" src="<?php echo base_url(); ?>assets/logo/<?php echo $this->optionslib->get_logo('header_logo'); ?>.png" alt="Logo" /></a>
<a href="<?php echo $logo_url; ?>" target="_blank"><img class="widgetLogo" src="<?php echo base_url(); ?>assets/logo/<?php echo $this->optionslib->get_logo('header_logo', $theme); ?>.png" alt="Logo" /></a>
</div>
<div class="right-column">
<div class="top-right">