diff --git a/application/config/cloudlog.php b/application/config/cloudlog.php index df5fa98b..117deac2 100644 --- a/application/config/cloudlog.php +++ b/application/config/cloudlog.php @@ -110,19 +110,3 @@ $config['qso_date_format'] = "d/m/y"; */ $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; diff --git a/application/config/migration.php b/application/config/migration.php index aa4f71e3..dd736cc4 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 103; +$config['migration_version'] = 104; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/User.php b/application/controllers/User.php index c3a5c41d..f68d5434 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -67,6 +67,7 @@ class User extends CI_Controller { $data['user_timezone'] = $this->input->post('user_timezone'); $data['user_measurement_base'] = $this->input->post('user_measurement_base'); $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_wwff_lookup'] = $this->input->post('user_wwff_lookup'); $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_date_format'), $this->input->post('user_stylesheet'), + $this->input->post('user_qth_lookup'), $this->input->post('user_sota_lookup'), $this->input->post('user_wwff_lookup'), $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_measurement_base'] = $this->input->post('user_measurement_base'); $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_wwff_lookup'] = $this->input->post('user_wwff_lookup'); $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; } + 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')) { $data['user_sota_lookup'] = $this->input->post('user_sota_lookup', true); } else { @@ -397,6 +406,7 @@ class User extends CI_Controller { $data['user_locator'] = $this->input->post('user_locator', true); $data['user_timezone'] = $this->input->post('user_timezone', true); $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_wwff_lookup'] = $this->input->post('user_wwff_lookup'); $data['user_show_notes'] = $this->input->post('user_show_notes'); diff --git a/application/migrations/104_user_auto_qth_option.php b/application/migrations/104_user_auto_qth_option.php new file mode 100644 index 00000000..815b10f1 --- /dev/null +++ b/application/migrations/104_user_auto_qth_option.php @@ -0,0 +1,29 @@ +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'); + } + } +} diff --git a/application/models/User_model.php b/application/models/User_model.php index cc61d322..ae8053a9 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -112,8 +112,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_wwff_lookup, $user_show_notes, - $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_profile_image) { + $measurement, $user_date_format, $user_stylesheet, $user_qth_lookup, $user_sota_lookup, $user_wwff_lookup, + $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 if(!$this->exists($username)) { $data = array( @@ -129,6 +130,7 @@ class User_Model extends CI_Model { 'user_measurement_base' => xss_clean($measurement), 'user_date_format' => xss_clean($user_date_format), 'user_stylesheet' => xss_clean($user_stylesheet), + 'user_qth_lookup' => xss_clean($user_qth_lookup), 'user_sota_lookup' => xss_clean($user_sota_lookup), 'user_wwff_lookup' => xss_clean($user_wwff_lookup), '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_date_format' => xss_clean($fields['user_date_format']), '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_wwff_lookup' => xss_clean($fields['user_wwff_lookup']), '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_date_format' => $u->row()->user_date_format, '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_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, diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 65c53d5f..61c8f59f 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1109,7 +1109,7 @@ $(document).on('keypress',function(e) { }); -config->item('qso_auto_qth')) { ?> +session->userdata('user_qth_lookup') == 1) { ?> $('#qth').focusout(function() { if ($('#locator').val() === '') { var lat = 0; diff --git a/application/views/user/add.php b/application/views/user/add.php index 209e4188..3c8b3570 100644 --- a/application/views/user/add.php +++ b/application/views/user/add.php @@ -130,22 +130,31 @@
-
+
+ + +
If set, gridsquare is fetched based on location name.
+
+ +
-
If this is set, name and gridsquare is fetched from the API and filled in location and locator.
+
If set, name and gridsquare is fetched from the API and filled in location and locator.
-
+
-
If this is set, name and gridsquare is fetched from the API and filled in location and locator.
+
If set, name and gridsquare is fetched from the API and filled in location and locator.
diff --git a/application/views/user/edit.php b/application/views/user/edit.php index 1e34a254..c3ef01e9 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -285,21 +285,29 @@
-
+
+ + +
If set, gridsquare is fetched based on location name.
+
+
-
If this is set, name and gridsquare is fetched from the API and filled in location and locator.
+
If set, name and gridsquare is fetched from the API and filled in location and locator.
-
+
-
If this is set, name and gridsquare is fetched from the API and filled in location and locator.
+
If set, name and gridsquare is fetched from the API and filled in location and locator.