diff --git a/application/config/migration.php b/application/config/migration.php index 67ea7c6a..7c4aa6b1 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'] = 127; +$config['migration_version'] = 128; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Gridmap.php b/application/controllers/Gridmap.php index 7594b98d..cc28c06e 100644 --- a/application/controllers/Gridmap.php +++ b/application/controllers/Gridmap.php @@ -19,6 +19,9 @@ class Gridmap extends CI_Controller { $data['bands'] = $this->bands->get_worked_bands(); $data['sats_available'] = $this->bands->get_worked_sats(); + $data['user_gridmap_default_band'] = $this->session->userdata('user_gridmap_default_band'); + $data['user_gridmap_confirmation'] = $this->session->userdata('user_gridmap_confirmation'); + $data['layer'] = $this->optionslib->get_option('option_map_tile_server'); $data['attribution'] = $this->optionslib->get_option('option_map_tile_server_copyright'); @@ -179,4 +182,4 @@ class Gridmap extends CI_Controller { header('Content-Type: application/json'); echo json_encode($data); } -} \ No newline at end of file +} diff --git a/application/controllers/User.php b/application/controllers/User.php index f29bb11d..69f43a89 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -33,6 +33,7 @@ class User extends CI_Controller { $this->load->model('user_model'); if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $this->load->model('bands'); $this->load->library('form_validation'); $this->form_validation->set_rules('user_name', 'Username', 'required'); @@ -46,6 +47,8 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_locator', 'Locator', 'callback_check_locator'); $this->form_validation->set_rules('user_timezone', 'Timezone', 'required'); + $data['bands'] = $this->bands->get_user_bands(); + // Get themes list $data['themes'] = $this->user_model->getThemes(); @@ -69,8 +72,8 @@ class User extends CI_Controller { $data['user_callsign'] = $this->input->post('user_callsign'); $data['user_locator'] = $this->input->post('user_locator'); $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_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'); @@ -85,6 +88,8 @@ class User extends CI_Controller { $data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type'); $data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload'); $data['user_mastodon_url'] = $this->input->post('user_mastodon_url'); + $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band'); + $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); $this->load->view('user/add', $data); } else { $this->load->view('user/add', $data); @@ -118,7 +123,9 @@ class User extends CI_Controller { $this->input->post('user_show_profile_image'), $this->input->post('user_previous_qsl_type'), $this->input->post('user_amsat_status_upload'), - $this->input->post('user_mastodon_url'))) { + $this->input->post('user_mastodon_url'), + $this->input->post('user_gridmap_default_band'), + ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''))) { // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username '.$this->input->post('user_name').' already in use!'; @@ -146,8 +153,8 @@ class User extends CI_Controller { $data['user_lastname'] = $this->input->post('user_lastname'); $data['user_callsign'] = $this->input->post('user_callsign'); $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_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'); @@ -162,6 +169,8 @@ class User extends CI_Controller { $data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type'); $data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload'); $data['user_mastodon_url'] = $this->input->post('user_mastodon_url'); + $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band'); + $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); $this->load->view('user/add', $data); $this->load->view('interface_assets/footer'); } @@ -172,6 +181,7 @@ class User extends CI_Controller { if((!$this->user_model->authorize(99)) && ($this->session->userdata('user_id') != $this->uri->segment(3))) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } $query = $this->user_model->get_by_id($this->uri->segment(3)); + $this->load->model('bands'); $this->load->library('form_validation'); $this->form_validation->set_rules('user_name', 'Username', 'required|xss_clean'); @@ -186,6 +196,8 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_locator', 'Locator', 'callback_check_locator'); $this->form_validation->set_rules('user_timezone', 'Timezone', 'required'); + $data['bands'] = $this->bands->get_user_bands(); + // Get themes list $data['themes'] = $this->user_model->getThemes(); @@ -303,23 +315,23 @@ class User extends CI_Controller { $data['user_eqsl_password'] = $q->user_eqsl_password; } - if($this->input->post('user_measurement_base')) { - $data['user_measurement_base'] = $this->input->post('user_measurement_base', true); - } else { - $data['user_measurement_base'] = $q->user_measurement_base; - } + if($this->input->post('user_measurement_base')) { + $data['user_measurement_base'] = $this->input->post('user_measurement_base', true); + } else { + $data['user_measurement_base'] = $q->user_measurement_base; + } if($this->input->post('user_date_format')) { - $data['user_date_format'] = $this->input->post('user_date_format', true); - } else { - $data['user_date_format'] = $q->user_date_format; - } + $data['user_date_format'] = $this->input->post('user_date_format', true); + } else { + $data['user_date_format'] = $q->user_date_format; + } - if($this->input->post('user_stylesheet')) { - $data['user_stylesheet'] = $this->input->post('user_stylesheet', true); - } else { - $data['user_stylesheet'] = $q->user_stylesheet; - } + if($this->input->post('user_stylesheet')) { + $data['user_stylesheet'] = $this->input->post('user_stylesheet', true); + } else { + $data['user_stylesheet'] = $q->user_stylesheet; + } if($this->input->post('user_qth_lookup')) { $data['user_qth_lookup'] = $this->input->post('user_qth_lookup', true); @@ -375,6 +387,18 @@ class User extends CI_Controller { $data['user_mastodon_url'] = $q->user_mastodon_url; } + if($this->input->post('user_gridmap_default_band')) { + $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band', false); + } else { + $data['user_gridmap_default_band'] = $q->user_gridmap_default_band; + } + + if($this->input->post('user_gridmap_confirmation')) { + $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); + } else { + $data['user_gridmap_confirmation'] = $q->user_gridmap_confirmation; + } + if($this->input->post('user_column1')) { $data['user_column1'] = $this->input->post('user_column1', true); } else { @@ -445,7 +469,7 @@ class User extends CI_Controller { $data['user_callsign'] = $this->input->post('user_callsign', true); $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_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'); @@ -461,6 +485,8 @@ class User extends CI_Controller { $data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type'); $data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload'); $data['user_mastodon_url'] = $this->input->post('user_mastodon_url'); + $data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band'); + $data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''); $this->load->view('user/edit'); $this->load->view('interface_assets/footer'); } diff --git a/application/language/english/account_lang.php b/application/language/english/account_lang.php index 105853c2..54025f59 100644 --- a/application/language/english/account_lang.php +++ b/application/language/english/account_lang.php @@ -92,3 +92,6 @@ $lang['account_login'] = 'Login'; $lang['account_mastodon'] = 'Mastodonserver'; $lang['account_user_mastodon'] = 'URL of Mastodonserver'; + +$lang['account_gridmap_settings'] = 'Settings for Gridsquare Map'; +$lang['account_gridmap_default_band'] = 'Default Band'; diff --git a/application/language/german/account_lang.php b/application/language/german/account_lang.php index 5bacf6a3..dda2d956 100644 --- a/application/language/german/account_lang.php +++ b/application/language/german/account_lang.php @@ -92,3 +92,6 @@ $lang['account_login'] = 'Anmeldung'; $lang['account_mastodon'] = 'Mastodonserver'; $lang['account_user_mastodon'] = 'URL des Mastodonservers'; + +$lang['account_gridmap_settings'] = 'Einstellung der Planquadratkarte'; +$lang['account_gridmap_default_band'] = 'Standardband'; diff --git a/application/migrations/128_user_default_map_settings.php b/application/migrations/128_user_default_map_settings.php new file mode 100644 index 00000000..e47e868e --- /dev/null +++ b/application/migrations/128_user_default_map_settings.php @@ -0,0 +1,38 @@ +db->field_exists('user_gridmap_default_band', 'users')) { + $fields = array( + 'user_gridmap_default_band varchar(10) default NULL', + ); + $this->dbforge->add_column('users', $fields); + } + if (!$this->db->field_exists('user_gridmap_confirmation', 'users')) { + $fields = array( + 'user_gridmap_confirmation varchar(3) default NULL', + ); + $this->dbforge->add_column('users', $fields); + } + } + + public function down() + { + $this->dbforge->drop_column('users', 'user_gridmap_default_band'); + $this->dbforge->drop_column('users', 'user_gridmap_confirmation'); + } +} + + + diff --git a/application/models/User_model.php b/application/models/User_model.php index 8234f9b2..dc9eff52 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -123,7 +123,8 @@ class User_Model extends CI_Model { function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone, $measurement, $user_date_format, $user_stylesheet, $user_qth_lookup, $user_sota_lookup, $user_wwff_lookup, $user_pota_lookup, $user_show_notes, $user_column1, $user_column2, $user_column3, $user_column4, $user_column5, - $user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url) { + $user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url, + $user_gridmap_default_band, $user_gridmap_confirmation) { // Check that the user isn't already used if(!$this->exists($username)) { $data = array( @@ -153,6 +154,8 @@ class User_Model extends CI_Model { 'user_previous_qsl_type' => xss_clean($user_previous_qsl_type), 'user_amsat_status_upload' => xss_clean($user_amsat_status_upload), 'user_mastodon_url' => xss_clean($user_mastodon_url), + 'user_gridmap_default_band' => xss_clean($user_gridmap_default_band), + 'user_gridmap_confirmation' => xss_clean($user_gridmap_confirmation), ); // Check the password is valid @@ -210,6 +213,8 @@ class User_Model extends CI_Model { 'user_previous_qsl_type' => xss_clean($fields['user_previous_qsl_type']), 'user_amsat_status_upload' => xss_clean($fields['user_amsat_status_upload']), 'user_mastodon_url' => xss_clean($fields['user_mastodon_url']), + 'user_gridmap_default_band' => xss_clean($fields['user_gridmap_default_band']), + 'user_gridmap_confirmation' => (isset($fields['user_gridmap_confirmation_qsl']) ? 'Q' : '').(isset($fields['user_gridmap_confirmation_lotw']) ? 'L' : '').(isset($fields['user_gridmap_confirmation_eqsl']) ? 'E' : ''), ); // Check to see if the user is allowed to change user levels @@ -331,6 +336,8 @@ class User_Model extends CI_Model { 'user_previous_qsl_type' => isset($u->row()->user_previous_qsl_type) ? $u->row()->user_previous_qsl_type: 0, 'user_amsat_status_upload' => isset($u->row()->user_amsat_status_upload) ? $u->row()->user_amsat_status_upload: 0, 'user_mastodon_url' => $u->row()->user_mastodon_url, + 'user_gridmap_default_band' => $u->row()->user_gridmap_default_band, + 'user_gridmap_confirmation' => $u->row()->user_gridmap_confirmation, 'active_station_logbook' => $u->row()->active_station_logbook, ); diff --git a/application/views/gridmap/index.php b/application/views/gridmap/index.php index 2b9e59ef..fb688eae 100644 --- a/application/views/gridmap/index.php +++ b/application/views/gridmap/index.php @@ -50,8 +50,12 @@ @@ -79,15 +83,27 @@