kopia lustrzana https://github.com/magicbug/Cloudlog
[Account][Winkey] Allows users to enable and disable winkey via their account settings
rodzic
b5bd9f86f6
commit
e6004d0c12
|
@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
|||
|
|
||||
*/
|
||||
|
||||
$config['migration_version'] = 134;
|
||||
$config['migration_version'] = 135;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -455,6 +455,12 @@ class User extends CI_Controller {
|
|||
$data['user_column5'] = $q->user_column5;
|
||||
}
|
||||
|
||||
if($this->input->post('user_winkey')) {
|
||||
$data['user_winkey'] = $this->input->post('user_winkey', true);
|
||||
} else {
|
||||
$data['user_winkey'] = $q->winkey;
|
||||
}
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('user/edit', $data);
|
||||
$this->load->view('interface_assets/footer');
|
||||
|
@ -524,6 +530,7 @@ class User extends CI_Controller {
|
|||
$data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band');
|
||||
$data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : '');
|
||||
$data['language'] = $this->input->post('language');
|
||||
$data['user_winkey'] = $this->input->post('user_winkey');
|
||||
$this->load->view('user/edit');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This adds a field to user-table to hold/persist language-setting per user
|
||||
*/
|
||||
|
||||
class Migration_add_winkey extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
// Check if winkey exists in the user table if not create a boolean field
|
||||
if (!$this->db->field_exists('winkey', 'users')) {
|
||||
$fields = array(
|
||||
'winkey boolean default 0',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('users', $fields);
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->field_exists('winkey', 'users')) {
|
||||
$this->dbforge->drop_column('users', 'winkey');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -218,6 +218,7 @@ class User_Model extends CI_Model {
|
|||
'user_gridmap_default_band' => xss_clean($fields['user_gridmap_default_band']),
|
||||
'user_gridmap_confirmation' => (isset($fields['user_gridmap_confirmation_qsl']) ? 'Q' : '').(isset($fields['user_gridmap_confirmation_lotw']) ? 'L' : '').(isset($fields['user_gridmap_confirmation_eqsl']) ? 'E' : ''),
|
||||
'language' => xss_clean($fields['language']),
|
||||
'winkey' => xss_clean($fields['user_winkey']),
|
||||
);
|
||||
|
||||
// Check to see if the user is allowed to change user levels
|
||||
|
@ -343,6 +344,7 @@ class User_Model extends CI_Model {
|
|||
'user_gridmap_confirmation' => $u->row()->user_gridmap_confirmation,
|
||||
'active_station_logbook' => $u->row()->active_station_logbook,
|
||||
'language' => isset($u->row()->language) ? $u->row()->language: 'english',
|
||||
'isWinkeyEnabled' => $u->row()->winkey,
|
||||
);
|
||||
|
||||
$this->session->set_userdata($userdata);
|
||||
|
|
|
@ -518,6 +518,12 @@
|
|||
<div id="qsomap" style="width: 100%; height: 200px;"></div>
|
||||
</div>
|
||||
|
||||
<!-- Winkey Starts -->
|
||||
|
||||
<?php
|
||||
// if isWinkeyEnabled in session data is true
|
||||
if ($this->session->userdata('isWinkeyEnabled')) { ?>
|
||||
|
||||
<div id="winkey" class="card winkey-settings" style="margin-bottom: 10px;">
|
||||
<div class="card-header">
|
||||
<h4 style="font-size: 16px; font-weight: bold;" class="card-title">Winkey
|
||||
|
@ -548,6 +554,8 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<?php } // end of isWinkeyEnabled if statement ?>
|
||||
<!-- Winkey Ends -->
|
||||
|
||||
<div class="card callsign-suggest">
|
||||
<div class="card-header"><h4 style="font-size: 16px; font-weight: bold;" class="card-title"><?php echo lang('qso_title_suggestions'); ?></h4></div>
|
||||
|
|
|
@ -594,6 +594,33 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Winkeyer <span class="badge badge-danger">Experimental</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
|
||||
<p>Winkeyer support in Cloudlog is very experimental read the wiki first at <a href="https://github.com/magicbug/Cloudlog/wiki/Winkey" target="_blank">https://github.com/magicbug/Cloudlog/wiki/Winkey</a> before enabling.</p>
|
||||
|
||||
<label>Enable Winkey Features</label>
|
||||
|
||||
<select class="custom-select" name="user_winkey" id="user_winkeyer">
|
||||
<option value="0" <?php if ($user_winkey == 0) { echo 'selected="selected"'; } ?>>Disabled</option>
|
||||
<option value="1" <?php if ($user_winkey == 1) { echo 'selected="selected"'; } ?>>Enabled</option>
|
||||
</select>
|
||||
|
||||
<div class="small form-text text-muted"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||
<br>
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-save"></i> <?php echo lang('account_save_account_changes'); ?></button>
|
||||
|
|
Ładowanie…
Reference in New Issue