kopia lustrzana https://github.com/magicbug/Cloudlog
Make auto QTH function configurable on frontend
rodzic
e67435d497
commit
ebe05aee8c
|
@ -110,19 +110,3 @@ $config['qso_date_format'] = "d/m/y";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$config['map_6digit_grids'] = FALSE;
|
$config['map_6digit_grids'] = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Automatically populate the QTH
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Setting this to TRUE allows the QTH locator to be pre-filled
|
|
||||||
| based on the person's location when creating new QSO.
|
|
||||||
| OSM's Nominatim API is being used for that purpose
|
|
||||||
|
|
|
||||||
| Default is: FALSE
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$config['qso_auto_qth'] = FALSE;
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
||||||
| be upgraded / downgraded to.
|
| be upgraded / downgraded to.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_version'] = 103;
|
$config['migration_version'] = 104;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -67,6 +67,7 @@ class User extends CI_Controller {
|
||||||
$data['user_timezone'] = $this->input->post('user_timezone');
|
$data['user_timezone'] = $this->input->post('user_timezone');
|
||||||
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
|
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
|
||||||
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
|
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
|
||||||
|
$data['user_qth_lookup'] = $this->input->post('user_qth_lookup');
|
||||||
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
|
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
|
||||||
$data['user_wwff_lookup'] = $this->input->post('user_wwff_lookup');
|
$data['user_wwff_lookup'] = $this->input->post('user_wwff_lookup');
|
||||||
$data['user_show_notes'] = $this->input->post('user_show_notes');
|
$data['user_show_notes'] = $this->input->post('user_show_notes');
|
||||||
|
@ -96,6 +97,7 @@ class User extends CI_Controller {
|
||||||
$this->input->post('user_measurement_base'),
|
$this->input->post('user_measurement_base'),
|
||||||
$this->input->post('user_date_format'),
|
$this->input->post('user_date_format'),
|
||||||
$this->input->post('user_stylesheet'),
|
$this->input->post('user_stylesheet'),
|
||||||
|
$this->input->post('user_qth_lookup'),
|
||||||
$this->input->post('user_sota_lookup'),
|
$this->input->post('user_sota_lookup'),
|
||||||
$this->input->post('user_wwff_lookup'),
|
$this->input->post('user_wwff_lookup'),
|
||||||
$this->input->post('user_show_notes'),
|
$this->input->post('user_show_notes'),
|
||||||
|
@ -134,6 +136,7 @@ class User extends CI_Controller {
|
||||||
$data['user_locator'] = $this->input->post('user_locator');
|
$data['user_locator'] = $this->input->post('user_locator');
|
||||||
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
|
$data['user_measurement_base'] = $this->input->post('user_measurement_base');
|
||||||
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
|
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
|
||||||
|
$data['user_qth_lookup'] = $this->input->post('user_qth_lookup');
|
||||||
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
|
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
|
||||||
$data['user_wwff_lookup'] = $this->input->post('user_wwff_lookup');
|
$data['user_wwff_lookup'] = $this->input->post('user_wwff_lookup');
|
||||||
$data['user_show_notes'] = $this->input->post('user_show_notes');
|
$data['user_show_notes'] = $this->input->post('user_show_notes');
|
||||||
|
@ -302,6 +305,12 @@ class User extends CI_Controller {
|
||||||
$data['user_stylesheet'] = $q->user_stylesheet;
|
$data['user_stylesheet'] = $q->user_stylesheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->input->post('user_qth_lookup')) {
|
||||||
|
$data['user_qth_lookup'] = $this->input->post('user_qth_lookup', true);
|
||||||
|
} else {
|
||||||
|
$data['user_qth_lookup'] = $q->user_qth_lookup;
|
||||||
|
}
|
||||||
|
|
||||||
if($this->input->post('user_sota_lookup')) {
|
if($this->input->post('user_sota_lookup')) {
|
||||||
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup', true);
|
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup', true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -397,6 +406,7 @@ class User extends CI_Controller {
|
||||||
$data['user_locator'] = $this->input->post('user_locator', true);
|
$data['user_locator'] = $this->input->post('user_locator', true);
|
||||||
$data['user_timezone'] = $this->input->post('user_timezone', true);
|
$data['user_timezone'] = $this->input->post('user_timezone', true);
|
||||||
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
|
$data['user_stylesheet'] = $this->input->post('user_stylesheet');
|
||||||
|
$data['user_qth_lookup'] = $this->input->post('user_qth_lookup');
|
||||||
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
|
$data['user_sota_lookup'] = $this->input->post('user_sota_lookup');
|
||||||
$data['user_wwff_lookup'] = $this->input->post('user_wwff_lookup');
|
$data['user_wwff_lookup'] = $this->input->post('user_wwff_lookup');
|
||||||
$data['user_show_notes'] = $this->input->post('user_show_notes');
|
$data['user_show_notes'] = $this->input->post('user_show_notes');
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This adds an option to enable grid and name lookup
|
||||||
|
* for WWFF references
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Migration_user_auto_qth_option extends CI_Migration {
|
||||||
|
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if (!$this->db->field_exists('user_wwff_lookup', 'users')) {
|
||||||
|
$fields = array(
|
||||||
|
'user_wwff_lookup integer DEFAULT 0 AFTER user_sota_lookup',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dbforge->add_column('users', $fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ($this->db->field_exists('user_wwff_lookup', 'users')) {
|
||||||
|
$this->dbforge->drop_column('users', 'user_wwff_lookup');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -112,8 +112,9 @@ class User_Model extends CI_Model {
|
||||||
// FUNCTION: bool add($username, $password, $email, $type)
|
// FUNCTION: bool add($username, $password, $email, $type)
|
||||||
// Add a user
|
// Add a user
|
||||||
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
|
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
|
||||||
$measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_wwff_lookup, $user_show_notes,
|
$measurement, $user_date_format, $user_stylesheet, $user_qth_lookup, $user_sota_lookup, $user_wwff_lookup,
|
||||||
$user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_profile_image) {
|
$user_show_notes, $user_column1, $user_column2, $user_column3, $user_column4, $user_column5,
|
||||||
|
$user_show_profile_image) {
|
||||||
// Check that the user isn't already used
|
// Check that the user isn't already used
|
||||||
if(!$this->exists($username)) {
|
if(!$this->exists($username)) {
|
||||||
$data = array(
|
$data = array(
|
||||||
|
@ -129,6 +130,7 @@ class User_Model extends CI_Model {
|
||||||
'user_measurement_base' => xss_clean($measurement),
|
'user_measurement_base' => xss_clean($measurement),
|
||||||
'user_date_format' => xss_clean($user_date_format),
|
'user_date_format' => xss_clean($user_date_format),
|
||||||
'user_stylesheet' => xss_clean($user_stylesheet),
|
'user_stylesheet' => xss_clean($user_stylesheet),
|
||||||
|
'user_qth_lookup' => xss_clean($user_qth_lookup),
|
||||||
'user_sota_lookup' => xss_clean($user_sota_lookup),
|
'user_sota_lookup' => xss_clean($user_sota_lookup),
|
||||||
'user_wwff_lookup' => xss_clean($user_wwff_lookup),
|
'user_wwff_lookup' => xss_clean($user_wwff_lookup),
|
||||||
'user_show_notes' => xss_clean($user_show_notes),
|
'user_show_notes' => xss_clean($user_show_notes),
|
||||||
|
@ -181,6 +183,7 @@ class User_Model extends CI_Model {
|
||||||
'user_measurement_base' => xss_clean($fields['user_measurement_base']),
|
'user_measurement_base' => xss_clean($fields['user_measurement_base']),
|
||||||
'user_date_format' => xss_clean($fields['user_date_format']),
|
'user_date_format' => xss_clean($fields['user_date_format']),
|
||||||
'user_stylesheet' => xss_clean($fields['user_stylesheet']),
|
'user_stylesheet' => xss_clean($fields['user_stylesheet']),
|
||||||
|
'user_qth_lookup' => xss_clean($fields['user_qth_lookup']),
|
||||||
'user_sota_lookup' => xss_clean($fields['user_sota_lookup']),
|
'user_sota_lookup' => xss_clean($fields['user_sota_lookup']),
|
||||||
'user_wwff_lookup' => xss_clean($fields['user_wwff_lookup']),
|
'user_wwff_lookup' => xss_clean($fields['user_wwff_lookup']),
|
||||||
'user_show_notes' => xss_clean($fields['user_show_notes']),
|
'user_show_notes' => xss_clean($fields['user_show_notes']),
|
||||||
|
@ -297,6 +300,7 @@ class User_Model extends CI_Model {
|
||||||
'user_measurement_base' => $u->row()->user_measurement_base,
|
'user_measurement_base' => $u->row()->user_measurement_base,
|
||||||
'user_date_format' => $u->row()->user_date_format,
|
'user_date_format' => $u->row()->user_date_format,
|
||||||
'user_stylesheet' => $u->row()->user_stylesheet,
|
'user_stylesheet' => $u->row()->user_stylesheet,
|
||||||
|
'user_qth_lookup' => isset($u->row()->user_qth_lookup) ? $u->row()->user_qth_lookup : 0,
|
||||||
'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0,
|
'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0,
|
||||||
'user_wwff_lookup' => isset($u->row()->user_wwff_lookup) ? $u->row()->user_wwff_lookup : 0,
|
'user_wwff_lookup' => isset($u->row()->user_wwff_lookup) ? $u->row()->user_wwff_lookup : 0,
|
||||||
'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1,
|
'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1,
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ $(document).on('keypress',function(e) {
|
||||||
});
|
});
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($this->config->item('qso_auto_qth')) { ?>
|
<?php if ($this->session->userdata('user_qth_lookup') == 1) { ?>
|
||||||
$('#qth').focusout(function() {
|
$('#qth').focusout(function() {
|
||||||
if ($('#locator').val() === '') {
|
if ($('#locator').val() === '') {
|
||||||
var lat = 0;
|
var lat = 0;
|
||||||
|
|
|
@ -130,22 +130,31 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-4">
|
||||||
|
<label for="qthlookup">Location auto lookup.</label>
|
||||||
|
<select class="custom-select" id="qthlookup" name="user_qth_lookup">
|
||||||
|
<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 class="small form-text text-muted">If set, gridsquare is fetched based on location name.</div></td>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
<label for="sotalookup">SOTA auto lookup gridsquare and name for summit.</label>
|
<label for="sotalookup">SOTA auto lookup gridsquare and name for summit.</label>
|
||||||
<select class="custom-select" id="sotalookup" name="user_sota_lookup">
|
<select class="custom-select" id="sotalookup" name="user_sota_lookup">
|
||||||
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
|
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||||
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
|
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<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 class="small form-text text-muted">If set, name and gridsquare is fetched from the API and filled in location and locator.</div></td>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-4">
|
||||||
<label for="wwfflookup">WWFF auto lookup gridsquare and name for reference.</label>
|
<label for="wwfflookup">WWFF auto lookup gridsquare and name for reference.</label>
|
||||||
<select class="custom-select" id="wwfflookup" name="user_wwff_lookup">
|
<select class="custom-select" id="wwfflookup" name="user_wwff_lookup">
|
||||||
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
|
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||||
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
|
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<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 class="small form-text text-muted">If set, name and gridsquare is fetched from the API and filled in location and locator.</div></td>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -285,21 +285,29 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-4">
|
||||||
|
<label for="qthlookup"> Location auto lookup.</label>
|
||||||
|
<select class="custom-select" id="qthlookup" name="user_qth_lookup">
|
||||||
|
<option value="1" <?php if ($user_qth_lookup == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||||
|
<option value="0" <?php if ($user_qth_lookup == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||||
|
</select>
|
||||||
|
<div class="small form-text text-muted">If set, gridsquare is fetched based on location name.</div></td>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
<label for="sotalookup">SOTA auto lookup gridsquare and name for summit.</label>
|
<label for="sotalookup">SOTA auto lookup gridsquare and name for summit.</label>
|
||||||
<select class="custom-select" id="sotalookup" name="user_sota_lookup">
|
<select class="custom-select" id="sotalookup" name="user_sota_lookup">
|
||||||
<option value="1" <?php if ($user_sota_lookup == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
|
<option value="1" <?php if ($user_sota_lookup == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||||
<option value="0" <?php if ($user_sota_lookup == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
|
<option value="0" <?php if ($user_sota_lookup == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<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 class="small form-text text-muted">If set, name and gridsquare is fetched from the API and filled in location and locator.</div></td>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-4">
|
||||||
<label for="wwfflookup">WWFF auto lookup gridsquare and name for summit.</label>
|
<label for="wwfflookup">WWFF auto lookup gridsquare and name for summit.</label>
|
||||||
<select class="custom-select" id="wwfflookup" name="user_wwff_lookup">
|
<select class="custom-select" id="wwfflookup" name="user_wwff_lookup">
|
||||||
<option value="1" <?php if ($user_wwff_lookup == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
|
<option value="1" <?php if ($user_wwff_lookup == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||||
<option value="0" <?php if ($user_wwff_lookup == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
|
<option value="0" <?php if ($user_wwff_lookup == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||||
</select>
|
</select>
|
||||||
<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 class="small form-text text-muted">If set, name and gridsquare is fetched from the API and filled in location and locator.</div></td>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Ładowanie…
Reference in New Issue