add option to turn on websockets for winkey
这个提交包含在:
父节点
e2006a936f
当前提交
7156b185e1
共有 5 个文件被更改,包括 56 次插入 和 15 次删除
|
|
@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$config['migration_version'] = 196;
|
$config['migration_version'] = 197;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -576,6 +576,12 @@ class User extends CI_Controller
|
||||||
$data['user_winkey'] = $q->winkey;
|
$data['user_winkey'] = $q->winkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->input->post('user_winkey_websocket')) {
|
||||||
|
$data['user_winkey_websocket'] = $this->input->post('user_winkey_websocket', true);
|
||||||
|
} else {
|
||||||
|
$data['user_winkey_websocket'] = $q->winkey_websocket;
|
||||||
|
}
|
||||||
|
|
||||||
$this->load->model('user_options_model');
|
$this->load->model('user_options_model');
|
||||||
$callbook_type_object = $this->user_options_model->get_options('callbook')->result();
|
$callbook_type_object = $this->user_options_model->get_options('callbook')->result();
|
||||||
|
|
||||||
|
|
@ -730,7 +736,13 @@ class User extends CI_Controller
|
||||||
$this->load->view('interface_assets/footer');
|
$this->load->view('interface_assets/footer');
|
||||||
} else {
|
} else {
|
||||||
unset($data);
|
unset($data);
|
||||||
switch ($this->user_model->edit($this->input->post())) {
|
|
||||||
|
|
||||||
|
$post_data = $this->input->post();
|
||||||
|
if (!isset($post_data['user_winkey_websocket'])) {
|
||||||
|
$post_data['user_winkey_websocket'] = '0';
|
||||||
|
}
|
||||||
|
switch ($this->user_model->edit($post_data)) {
|
||||||
// Check for errors
|
// Check for errors
|
||||||
case EUSERNAMEEXISTS:
|
case EUSERNAMEEXISTS:
|
||||||
$data['username_error'] = 'Username <b>' . $this->input->post('user_name', true) . '</b> already in use!';
|
$data['username_error'] = 'Username <b>' . $this->input->post('user_name', true) . '</b> already in use!';
|
||||||
|
|
@ -892,6 +904,7 @@ class User extends CI_Controller
|
||||||
$data['user_quicklog_enter'] = $this->input->post('user_quicklog_enter');
|
$data['user_quicklog_enter'] = $this->input->post('user_quicklog_enter');
|
||||||
$data['language'] = $this->input->post('language');
|
$data['language'] = $this->input->post('language');
|
||||||
$data['user_winkey'] = $this->input->post('user_winkey');
|
$data['user_winkey'] = $this->input->post('user_winkey');
|
||||||
|
$data['user_winkey_websocket'] = $this->input->post('user_winkey_websocket');
|
||||||
$data['user_hamsat_key'] = $this->input->post('user_hamsat_key');
|
$data['user_hamsat_key'] = $this->input->post('user_hamsat_key');
|
||||||
$data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only');
|
$data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This adds a field to user-table to hold winkey websocket setting
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Migration: 197_add_winkey_websocket
|
||||||
|
class Migration_add_winkey_websocket extends CI_Migration {
|
||||||
|
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
// Check if winkey_websocket exists in the user table if not create a boolean field
|
||||||
|
if (!$this->db->field_exists('winkey_websocket', 'users')) {
|
||||||
|
$fields = array(
|
||||||
|
'winkey_websocket boolean default 0',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dbforge->add_column('users', $fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ($this->db->field_exists('winkey_websocket', 'users')) {
|
||||||
|
$this->dbforge->drop_column('users', 'winkey_websocket');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -267,6 +267,7 @@ class User_Model extends CI_Model {
|
||||||
'user_quicklog_enter' => xss_clean($fields['user_quicklog_enter']),
|
'user_quicklog_enter' => xss_clean($fields['user_quicklog_enter']),
|
||||||
'language' => xss_clean($fields['language']),
|
'language' => xss_clean($fields['language']),
|
||||||
'winkey' => xss_clean($fields['user_winkey']),
|
'winkey' => xss_clean($fields['user_winkey']),
|
||||||
|
'winkey_websocket' => xss_clean($fields['user_winkey_websocket']),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','api','".xss_clean($fields['user_hamsat_key'])."');");
|
$this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','api','".xss_clean($fields['user_hamsat_key'])."');");
|
||||||
|
|
|
||||||
|
|
@ -1205,10 +1205,7 @@
|
||||||
<hr />
|
<hr />
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<?php if (!isset($user_winkey_websocket)) {
|
<input name="user_winkey_websocket" class="form-check-input" type="checkbox" role="switch" id="user_winkey_websocket" value="1" <?php if ($user_winkey_websocket == 1) {
|
||||||
$user_winkey_websocket = '0';
|
|
||||||
} ?>
|
|
||||||
<input name="user_winkey_websocket" class="form-check-input" type="checkbox" role="switch" id="user_winkey_websocket" value="1" <?php if (isset($user_winkey_websocket) && $user_winkey_websocket == 1) {
|
|
||||||
echo 'checked';
|
echo 'checked';
|
||||||
} ?>>
|
} ?>>
|
||||||
<label class="form-check-label" for="user_winkey_websocket">Winkey Web Sockets</label>
|
<label class="form-check-label" for="user_winkey_websocket">Winkey Web Sockets</label>
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用