diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 5cba84a8..9e37858e 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -353,6 +353,35 @@ class QSO extends CI_Controller { echo json_encode($json); } + public function get_wwff() { + $json = []; + + if(!empty($this->input->get("query"))) { + $query = isset($_GET['query']) ? $_GET['query'] : FALSE; + $wwff = strtoupper($query); + + $file = 'assets/json/wwff.txt'; + + if (is_readable($file)) { + $lines = file($file, FILE_IGNORE_NEW_LINES); + $input = preg_quote($wwff, '~'); + $reg = '~^'. $input .'(.*)$~'; + $result = preg_grep($reg, $lines); + $json = []; + $i = 0; + foreach ($result as &$value) { + // Limit to 100 as to not slowdown browser too much + if (count($json) <= 100) { + $json[] = ["name"=>$value]; + } + } + } + } + + header('Content-Type: application/json'); + echo json_encode($json); + } + /* * Function is used for autocompletion of DOK in the QSO entry form */ diff --git a/application/language/english/general_words_lang.php b/application/language/english/general_words_lang.php index 90fbf0b1..605f4f5c 100644 --- a/application/language/english/general_words_lang.php +++ b/application/language/english/general_words_lang.php @@ -103,6 +103,7 @@ $lang['gen_hamradio_dok'] = 'DOK'; $lang['gen_hamradio_state'] = 'State'; $lang['gen_hamradio_iota'] = 'IOTA'; $lang['gen_hamradio_sota'] = 'SOTA'; +$lang['gen_hamradio_sota'] = 'WWFF'; $lang['gen_hamradio_gridsquare'] = 'Gridsquare'; $lang['gen_hamradio_operator'] = 'Operator'; @@ -119,4 +120,4 @@ $lang['gen_from_date'] = 'From date'; $lang['gen_this_qso_was_confirmed_on'] = 'This QSO was confirmed on'; -$lang['error_no_logbook_found'] = 'No logbooks were found. You need to define a logbook under Station Logbooks! Do it here:'; \ No newline at end of file +$lang['error_no_logbook_found'] = 'No logbooks were found. You need to define a logbook under Station Logbooks! Do it here:'; diff --git a/application/language/english/qso_lang.php b/application/language/english/qso_lang.php index 86ee6413..e3613182 100644 --- a/application/language/english/qso_lang.php +++ b/application/language/english/qso_lang.php @@ -12,9 +12,10 @@ $lang['qso_title_image'] = 'Profile Picture'; $lang['qso_transmit_power_helptext'] = 'Give power value in Watts. Include only numbers in the input.'; $lang['qso_sota_ref_helptext'] = 'For example: GM/NS-001.'; +$lang['qso_wwff_ref_helptext'] = 'For example: DLFF-0069.'; -$lang['qso_sig_helptext'] = 'For example: WWFF or POTA'; -$lang['qso_sig_info_helptext'] = 'For example: DLFF-0029'; +$lang['qso_sig_helptext'] = 'For example: POTA'; +$lang['qso_sig_info_helptext'] = 'For example: PA-0150'; $lang['qso_dok_helptext'] = 'For example: Q03'; diff --git a/application/language/german/qso_lang.php b/application/language/german/qso_lang.php index 129fe752..e45cb586 100644 --- a/application/language/german/qso_lang.php +++ b/application/language/german/qso_lang.php @@ -12,9 +12,10 @@ $lang['qso_title_image'] = 'Profilbild'; $lang['qso_transmit_power_helptext'] = 'Gib die Ausgangsleistung in Watt an. Erfasse nur Zahlen bei der Eingabe.'; $lang['qso_sota_ref_helptext'] = 'Zum Beispiel: GM/NS-001.'; +$lang['qso_wwff_ref_helptext'] = 'Zum Beispiel: DLFF-0069.'; -$lang['qso_sig_helptext'] = 'Zum Beispiel: WWFF oder POTA'; -$lang['qso_sig_info_helptext'] = 'Zum Beispiel: DLFF-0029'; +$lang['qso_sig_helptext'] = 'Zum Beispiel: POTA'; +$lang['qso_sig_info_helptext'] = 'Zum Beispiel: PA-0150'; $lang['qso_dok_helptext'] = 'Zum Beispiel: Q03'; diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 84fc2ca3..81d6da17 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2007,6 +2007,34 @@ $(document).ready(function(){ } }); + $('#wwff_ref_edit').selectize({ + maxItems: 1, + closeAfterSelect: true, + loadThrottle: 250, + valueField: 'name', + labelField: 'name', + searchField: 'name', + options: [], + create: false, + load: function(query, callback) { + if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered + $.ajax({ + url: baseURL+'index.php/qso/get_wwff', + type: 'GET', + dataType: 'json', + data: { + query: query, + }, + error: function() { + callback(); + }, + success: function(res) { + callback(res); + } + }); + } + }); + $('#darc_dok_edit').selectize({ maxItems: 1, closeAfterSelect: true, diff --git a/application/views/qso/edit_ajax.php b/application/views/qso/edit_ajax.php index 206c9f17..a83fb359 100644 --- a/application/views/qso/edit_ajax.php +++ b/application/views/qso/edit_ajax.php @@ -394,6 +394,11 @@ +
+ + +
+
diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 36275a1a..ed4619ea 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -387,6 +387,17 @@
+
+
+ + + lang->line('qso_wwff_ref_helptext'); ?> +
+
+ +
+
+
diff --git a/assets/css/general.css b/assets/css/general.css index 890410ee..676c1aac 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -83,6 +83,10 @@ thead > tr > td { text-transform: uppercase; } +.qso_panel #wwff_ref-selectized { + text-transform: uppercase; +} + .qso_panel #darc_dok-selectized { text-transform: uppercase; } @@ -103,6 +107,10 @@ thead > tr > td { text-transform: uppercase; } +.card-body #wwff_ref_edit-selectized { + text-transform: uppercase; +} + .card-body #darc_dok_edit-selectized { text-transform: uppercase; } diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 83a28c43..8c6ff040 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -93,6 +93,39 @@ $( document ).ready(function() { $('#sota_info').attr('title', 'Lookup '+$('#sota_ref').val()+' summit info on sota.org.uk'); }); + $('#wwff_ref').selectize({ + maxItems: 1, + closeAfterSelect: true, + loadThrottle: 250, + valueField: 'name', + labelField: 'name', + searchField: 'name', + options: [], + create: false, + load: function(query, callback) { + if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered + $.ajax({ + url: base_url+'index.php/qso/get_wwff', + type: 'GET', + dataType: 'json', + data: { + query: query, + }, + error: function() { + callback(); + }, + success: function(res) { + callback(res); + } + }); + } + }); + + $('#wwff_ref').change(function(){ + $('#wwff_info').html(''); + $('#wwff_info').attr('title', 'Lookup '+$('#wwff_ref').val()+' reference info on wwff.co'); + }); + $('#darc_dok').selectize({ maxItems: 1, closeAfterSelect: true, @@ -286,6 +319,9 @@ function reset_fields() { $('#input_usa_state').val(""); $('#qso-last-table').show(); $('#partial_view').hide(); + var $select = $('#wwff_ref').selectize(); + var selectize = $select[0].selectize; + selectize.clear(); var $select = $('#darc_dok').selectize(); var selectize = $select[0].selectize; selectize.clear(); diff --git a/images/icons/wwff.co.png b/images/icons/wwff.co.png new file mode 100644 index 00000000..c4e401cd Binary files /dev/null and b/images/icons/wwff.co.png differ