[Main menu] Added user option to hide notes in the main menu. Fixes #942.

这个提交包含在:
Andreas 2021-03-20 21:19:07 +01:00
父节点 fb679a6117
当前提交 997ae932ec
共有 6 个文件被更改,包括 47 次插入4 次删除

查看文件

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

查看文件

@ -56,6 +56,7 @@ class User extends CI_Controller {
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
$data['user_show_notes'] = $this->input->post('user_show_notes');
$this->load->view('user/add', $data);
} else {
$this->load->view('user/add', $data);
@ -64,7 +65,7 @@ class User extends CI_Controller {
}
else
{
switch($this->user_model->add($this->input->post('user_name'), $this->input->post('user_password'), $this->input->post('user_email'), $this->input->post('user_type'), $this->input->post('user_firstname'), $this->input->post('user_lastname'), $this->input->post('user_callsign'), $this->input->post('user_locator'), $this->input->post('user_timezone'), $this->input->post('user_measurement_base'), $this->input->post('user_date_format'), $this->input->post('user_stylesheet'), $this->input->post('user_sota_lookup'))) {
switch($this->user_model->add($this->input->post('user_name'), $this->input->post('user_password'), $this->input->post('user_email'), $this->input->post('user_type'), $this->input->post('user_firstname'), $this->input->post('user_lastname'), $this->input->post('user_callsign'), $this->input->post('user_locator'), $this->input->post('user_timezone'), $this->input->post('user_measurement_base'), $this->input->post('user_date_format'), $this->input->post('user_stylesheet'), $this->input->post('user_sota_lookup'), $this->input->post('user_show_notes'))) {
// Check for errors
case EUSERNAMEEXISTS:
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
@ -95,6 +96,7 @@ class User extends CI_Controller {
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
$data['user_show_notes'] = $this->input->post('user_show_notes');
$this->load->view('user/add', $data);
$this->load->view('interface_assets/footer');
}
@ -257,6 +259,12 @@ class User extends CI_Controller {
$data['user_sota_lookup'] = $q->user_sota_lookup;
}
if($this->input->post('user_show_notes')) {
$data['user_show_notes'] = $this->input->post('user_show_notes', true);
} else {
$data['user_show_notes'] = $q->user_show_notes;
}
$this->load->view('user/edit', $data);
$this->load->view('interface_assets/footer');
}
@ -299,6 +307,7 @@ class User extends CI_Controller {
$data['user_timezone'] = $this->input->post('user_timezone', true);
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
$data['user_show_notes'] = $this->input->post('user_show_notes');
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
}

查看文件

@ -96,7 +96,7 @@ class User_Model extends CI_Model {
// FUNCTION: bool add($username, $password, $email, $type)
// Add a user
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup) {
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes) {
// Check that the user isn't already used
if(!$this->exists($username)) {
$data = array(
@ -113,6 +113,7 @@ class User_Model extends CI_Model {
'user_date_format' => xss_clean($user_date_format),
'user_stylesheet' => xss_clean($user_stylesheet),
'user_sota_lookup' => xss_clean($user_sota_lookup),
'user_show_notes' => xss_clean($user_show_notes),
);
// Check the password is valid
@ -155,6 +156,7 @@ class User_Model extends CI_Model {
'user_date_format' => xss_clean($fields['user_date_format']),
'user_stylesheet' => xss_clean($fields['user_stylesheet']),
'user_sota_lookup' => xss_clean($fields['user_sota_lookup']),
'user_show_notes' => xss_clean($fields['user_show_notes']),
);
// Check to see if the user is allowed to change user levels
@ -263,6 +265,7 @@ class User_Model extends CI_Model {
'user_date_format' => $u->row()->user_date_format,
'user_stylesheet' => $u->row()->user_stylesheet,
'user_sota_lookup' => $u->row()->user_sota_lookup,
'user_show_notes' => $u->row()->user_show_notes,
);
$this->session->set_userdata($userdata);

查看文件

@ -73,8 +73,9 @@
</li>
<!-- Notes -->
<?php if ($this->session->userdata('user_show_notes') == 1) { ?>
<a class="nav-link" href="<?php echo site_url('notes');?>">Notes</a>
<?php } ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Analytics</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">

查看文件

@ -129,6 +129,14 @@
<div class="small form-text text-muted">If this is set, name and gridsquare is fetched from the API and filled in location and locator.</div></td>
</div>
<div class="form-group">
<label for="shownotes">Show notes in the main menu.</label>
<select class="custom-select" id="shownotes" name="user_show_notes">
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
</select>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
<button type="submit" class="btn btn-primary">Create Account</button>
</form>

查看文件

@ -292,6 +292,28 @@
</div>
</div>
<br>
<div class="row">
<!-- Club Log -->
<div class="col-md">
<div class="card">
<div class="card-header">
Main menu
</div>
<div class="card-body">
<div class="form-group">
<label for="shownotes">Show notes in the main menu.</label>
<select class="custom-select" id="shownotes" name="user_show_notes">
<option value="1" <?php if ($user_show_notes == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
<option value="0" <?php if ($user_show_notes == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
</select>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
<br>