Merge pull request #1022 from AndreasK79/fifth_column

[User selectable columns] Added a fifth column, used only in logbook …
这个提交包含在:
Peter Goodhall 2021-05-07 21:50:38 +01:00 提交者 GitHub
当前提交 91bb142acb
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 9 个文件被更改,包括 95 次插入14 次删除

查看文件

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

查看文件

@ -70,6 +70,7 @@ class User extends CI_Controller {
$data['user_column2'] = $this->input->post('user_column2');
$data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$this->load->view('user/add', $data);
} else {
$this->load->view('user/add', $data);
@ -95,7 +96,8 @@ class User extends CI_Controller {
$this->input->post('user_column1'),
$this->input->post('user_column2'),
$this->input->post('user_column3'),
$this->input->post('user_column4'))) {
$this->input->post('user_column4'),
$this->input->post('user_column5'))) {
// Check for errors
case EUSERNAMEEXISTS:
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
@ -131,6 +133,7 @@ class User extends CI_Controller {
$data['user_column2'] = $this->input->post('user_column2');
$data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$this->load->view('user/add', $data);
$this->load->view('interface_assets/footer');
}
@ -323,6 +326,12 @@ class User extends CI_Controller {
$data['user_column4'] = $q->user_column4;
}
if($this->input->post('user_column5')) {
$data['user_column5'] = $this->input->post('user_column5', true);
} else {
$data['user_column5'] = $q->user_column5;
}
$this->load->view('user/edit', $data);
$this->load->view('interface_assets/footer');
}
@ -370,6 +379,8 @@ class User extends CI_Controller {
$data['user_column2'] = $this->input->post('user_column2');
$data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
}

查看文件

@ -7,3 +7,4 @@ $lang['account_column1_text'] = 'Choose column 1';
$lang['account_column2_text'] = 'Choose column 2';
$lang['account_column3_text'] = 'Choose column 3';
$lang['account_column4_text'] = 'Choose column 4';
$lang['account_column5_text'] = 'Choose column 5 (only for logbook)';

查看文件

@ -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_fifth_column extends CI_Migration {
public function up()
{
$fields = array(
'user_column5 varchar(32) default "Country"',
);
$this->dbforge->add_column('users', $fields);
}
public function down()
{
$this->dbforge->drop_column('users', 'user_column5');
}
}

查看文件

@ -96,7 +96,9 @@ 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, $user_show_notes) {
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
$measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes,
$user_column1, $user_column2, $user_column3, $user_column4, $user_column5) {
// Check that the user isn't already used
if(!$this->exists($username)) {
$data = array(
@ -118,6 +120,7 @@ class User_Model extends CI_Model {
'user_column2' => xss_clean($user_column2),
'user_column3' => xss_clean($user_column3),
'user_column4' => xss_clean($user_column4),
'user_column5' => xss_clean($user_column5),
);
// Check the password is valid
@ -165,6 +168,7 @@ class User_Model extends CI_Model {
'user_column2' => xss_clean($fields['user_column2']),
'user_column3' => xss_clean($fields['user_column3']),
'user_column4' => xss_clean($fields['user_column4']),
'user_column5' => xss_clean($fields['user_column5']),
);
// Check to see if the user is allowed to change user levels
@ -278,6 +282,7 @@ class User_Model extends CI_Model {
'user_column2' => $u->row()->user_column2,
'user_column3' => $u->row()->user_column3,
'user_column4' => $u->row()->user_column4,
'user_column5' => $u->row()->user_column5,
);
$this->session->set_userdata($userdata);

查看文件

@ -126,7 +126,7 @@
case 'RSTR': echo '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD; if ($row->COL_SRX_STRING) { echo '<span class="label">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}
@ -138,7 +138,7 @@
case 'RSTR': echo '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD; if ($row->COL_SRX_STRING) { echo '<span class="label">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}
@ -150,7 +150,7 @@
case 'RSTR': echo '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD; if ($row->COL_SRX_STRING) { echo '<span class="label">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}
@ -162,7 +162,7 @@
case 'RSTR': echo '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD; if ($row->COL_SRX_STRING) { echo '<span class="label">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}

查看文件

@ -191,6 +191,21 @@
<option value="State"><?php echo $this->lang->line('gen_hamradio_state'); ?></option>
<option value="Grid"><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
</select>
</div>
<div class="form-group col-md-3">
<label for="column5"><?php echo $this->lang->line('account_column5_text'); ?></label>
<select class="custom-select" id="column5" name="user_column5">
<option value="Band"> <?php echo $this->lang->line('gen_hamradio_band'); ?></option>
<option value="Mode"> <?php echo $this->lang->line('gen_hamradio_mode'); ?></option>
<option value="RSTS"><?php echo $this->lang->line('gen_hamradio_rsts'); ?></option>
<option value="RSTR"><?php echo $this->lang->line('gen_hamradio_rstr'); ?></option>
<option value="Country" selected ='selected'><?php echo $this->lang->line('general_word_country'); ?></option>
<option value="IOTA"><?php echo $this->lang->line('gen_hamradio_iota'); ?></option>
<option value="State"><?php echo $this->lang->line('gen_hamradio_state'); ?></option>
<option value="Grid"><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
</select>
</div>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />

查看文件

@ -378,6 +378,19 @@
<option value="Grid" <?php if ($user_column4 == "Grid") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
</select>
</div>
<div class="form-group col-md-3">
<label for="column5"><?php echo $this->lang->line('account_column5_text'); ?></label>
<select class="custom-select" id="column5" name="user_column5">
<option value="Band" <?php if ($user_column5 == "Band") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_band'); ?></option>
<option value="Mode" <?php if ($user_column5 == "Mode") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_mode'); ?></option>
<option value="RSTS" <?php if ($user_column5 == "RSTS") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_rsts'); ?></option>
<option value="RSTR" <?php if ($user_column5 == "RSTR") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_rstr'); ?></option>
<option value="Country" <?php if ($user_column5 == "Country") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_country'); ?></option>
<option value="IOTA" <?php if ($user_column5 == "IOTA") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_iota'); ?></option>
<option value="State" <?php if ($user_column5 == "State") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_state'); ?></option>
<option value="Grid" <?php if ($user_column5 == "Grid") { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></option>
</select>
</div>
</div>
</div>

查看文件

@ -55,9 +55,20 @@
case 'Band': echo $this->lang->line('gen_hamradio_band'); break;
}
echo '</td>';
?>
<td><?php echo $this->lang->line('general_word_country'); ?></td>
<?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
echo '<td>';
switch($this->session->userdata('user_column5')==""?'Country':$this->session->userdata('user_column5')) {
case 'Mode': echo $this->lang->line('gen_hamradio_mode'); break;
case 'RSTS': echo $this->lang->line('gen_hamradio_rsts'); break;
case 'RSTR': echo $this->lang->line('gen_hamradio_rstr'); break;
case 'Country': echo $this->lang->line('general_word_country'); break;
case 'IOTA': echo $this->lang->line('gen_hamradio_iota'); break;
case 'State': echo $this->lang->line('gen_hamradio_state'); break;
case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break;
case 'Band': echo $this->lang->line('gen_hamradio_band'); break;
}
echo '</td>';
if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?>
<td>QSL</td>
<?php if($this->session->userdata('user_eqsl_name') != "") { ?>
<td>eQSL</td>
@ -99,7 +110,7 @@
case 'RSTR': echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}
@ -110,7 +121,7 @@
case 'RSTR': echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}
@ -122,7 +133,7 @@
case 'RSTR': echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}
@ -133,7 +144,7 @@
case 'RSTR': echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span class="badge badge-light">' . $row->COL_SRX . '</span>';}if ($row->COL_SRX_STRING) { echo '<span class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';}; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA); break;
case 'Grid': echo '<td>' . ($row->COL_GRIDSQUARE); break;
case 'Grid': echo '<td>'; echo strlen($row->COL_GRIDSQUARE)==0?$row->COL_VUCC_GRIDS:$row->COL_GRIDSQUARE; break;
case 'Band': echo '<td>'; if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); }; break;
case 'State': echo '<td>' . ($row->COL_STATE); break;
}