[Global Options] Added the option to define the Radio Timeout Warning

Radio timeout warning is used to alert users when a radio interface has disconnected and is providing stale info for logging.
pull/1019/head
Peter Goodhall 2021-05-03 14:50:33 +01:00
rodzic bbdd0eadde
commit 4fb2d03913
5 zmienionych plików z 125 dodań i 1 usunięć

Wyświetl plik

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 67;
$config['migration_version'] = 68;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -99,4 +99,50 @@ class Options extends CI_Controller {
}
}
// function used to display the /radio url
function radio() {
$data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Radio Settings";
$this->load->view('interface_assets/header', $data);
$this->load->view('options/radios');
$this->load->view('interface_assets/footer');
}
// Handles saving the radio options to the options system.
function radio_save() {
// Get Language Options
$data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Radio Settings";
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('radioTimeout', 'radioTimeout', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('interface_assets/header', $data);
$this->load->view('options/radios');
$this->load->view('interface_assets/footer');
}
else
{
// Update theme choice within the options system
$radioTimeout_update = $this->optionslib->update('cat_timeout_interval', $this->input->post('radioTimeout'));
// If theme update is complete set a flashsession with a success note
if($radioTimeout_update == TRUE) {
$this->session->set_flashdata('success', 'Radio Timeout Warning changed to '.$this->input->post('radioTimeout').' seconds');
}
// Redirect back to /appearance
redirect('/options/radio');
}
}
}

Wyświetl plik

@ -0,0 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This migration creates a table called options which will hold global options needed within cloudlog
* removing the need for lots of configuration files.
*/
class Migration_add_cat_timeout_to_options extends CI_Migration {
public function up()
{
$data = array(
array('option_name' => "cat_timeout_interval", 'option_value' => "1800", 'autoload' => "yes"),
);
$this->db->insert_batch('options', $data);
}
public function down()
{
// No option to down
}
}

Wyświetl plik

@ -0,0 +1,52 @@
<div class="container settings">
<div class="row">
<!-- Nav Start -->
<?php $this->load->view('options/sidebar') ?>
<!-- Nav End -->
<!-- Content -->
<div class="col-md-9">
<div class="card">
<div class="card-header"><h2><?php echo $page_title; ?> - <?php echo $sub_heading; ?></h2></div>
<div class="card-body">
<?php if($this->session->flashdata('success')) { ?>
<!-- Display Success Message -->
<div class="alert alert-success">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php } ?>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<?php echo $this->session->flashdata('message'); ?>
</div>
<?php } ?>
<?php if(validation_errors()) { ?>
<div class="alert alert-danger">
<a class="close" data-dismiss="alert">x</a>
<?php echo validation_errors(); ?>
</div>
<?php } ?>
<?php echo form_open('options/radio_save'); ?>
<div class="form-group">
<label for="globalSearch">Radio Timeout Warning</label>
<p>The Radio Timeout Warning is used on the QSO entry panel to alert you to radio interface disconnects.</p>
<input type="text" name="radioTimeout" class="form-control" id="radioTimeout" aria-describedby="radioTimeoutHelp" value="<?php echo $this->optionslib->get_option('cat_timeout_interval'); ?>">
<small id="radioTimeoutHelp" class="form-text text-muted">This number is in seconds.</small>
</div>
<!-- Save the Form -->
<input class="btn btn-primary" type="submit" value="Save" />
</form>
</div>
</div>
</div>
</div>
</div>

Wyświetl plik

@ -2,6 +2,7 @@
<div class="card">
<ul class="list-group list-group-flush">
<li class="list-group-item"><a class="nav-link" href="<?php echo site_url('options/appearance'); ?>">Appearance</a></li>
<li class="list-group-item"><a class="nav-link" href="<?php echo site_url('options/radio'); ?>">Radios</a></li>
</ul>
</div>
</div>