diff --git a/CloudLog_logo.png b/CloudLog_logo.png new file mode 100644 index 00000000..0b2fcf0c Binary files /dev/null and b/CloudLog_logo.png differ diff --git a/application/controllers/Calltester.php b/application/controllers/Calltester.php new file mode 100644 index 00000000..b8c99114 --- /dev/null +++ b/application/controllers/Calltester.php @@ -0,0 +1,491 @@ +load->model('logbook_model'); + + $sql = 'select distinct col_country, col_call, col_dxcc, date(col_time_on) date from ' . $this->config->item('table_name'); + $query = $this->db->query($sql); + + $callarray = $query->result(); + + $result = array(); + + $i = 0; + + foreach ($callarray as $call) { + $i++; + $dxcc = $this->logbook_model->dxcc_lookup($call->col_call, $call->date); + + $dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0; + $dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 0; + + if ($call->col_dxcc != $dxcc['adif']) { + $result[] = array( + 'Callsign' => $call->col_call, + 'Expected country' => $call->col_country, + 'Expected adif' => $call->col_dxcc, + 'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"), + 'Result adif' => $dxcc['adif'], + ); + } + } + + // End clock time in seconds + $end_time = microtime(true); + + // Calculate script execution time + $execution_time = ($end_time - $start_time); + + echo " Execution time of script = ".$execution_time." sec
"; + echo $i . " calls tested.
"; + $count = 0; + + if ($result) { + $this->array_to_table($result); + } + + } + + + function array_to_table($table) { + echo ' '; + + echo ''; + + // Table header + foreach ($table[0] as $key=>$value) { + echo ""; + } + + // Table body + foreach ($table as $value) { + echo ""; + foreach ($value as $val) { + echo ""; + } + echo ""; + } + echo "
".$key."
".$val."
"; + } + + function csv() { + set_time_limit(3600); + + // Starting clock time in seconds + $start_time = microtime(true); + + $this->load->model('logbook_model'); + + $file = 'uploads/calls.csv'; + $handle = fopen($file,"r"); + + $data = fgetcsv($handle,1000,","); // Skips firsts line, usually that is the header + $data = fgetcsv($handle,1000,","); + + $result = array(); + + $i = 0; + + do { + if ($data[0]) { + // COL_CALL,COL_DXCC,COL_TIME_ON + $i++; + + $dxcc = $this->logbook_model->dxcc_lookup($data[0], $data[2]); + + $dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0; + $dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 0; + + $data[1] = $data[1] == "NULL" ? 0 : $data[1]; + + if ($data[1] != $dxcc['adif']) { + $result[] = array( + 'Callsign' => $data[0], + 'Expected country' => '', + 'Expected adif' => $data[1], + 'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"), + 'Result adif' => $dxcc['adif'], + ); + } + } + } while ($data = fgetcsv($handle,1000,",")); + + // End clock time in seconds + $end_time = microtime(true); + + // Calculate script execution time + $execution_time = ($end_time - $start_time); + + echo " Execution time of script = ".$execution_time." sec
"; + echo $i . " calls tested.
"; + $count = 0; + + if ($result) { + $this->array_to_table($result); + } + } + + /* + * Uses check_dxcc_table - written to check if that function works + */ + function csv2() { + set_time_limit(3600); + + // Starting clock time in seconds + $start_time = microtime(true); + + $this->load->model('logbook_model'); + + $file = 'uploads/calls.csv'; + $handle = fopen($file,"r"); + + $data = fgetcsv($handle,1000,","); // Skips firsts line, usually that is the header + $data = fgetcsv($handle,1000,","); + + $result = array(); + + $i = 0; + + do { + if ($data[0]) { + // COL_CALL,COL_DXCC,COL_TIME_ON + $i++; + + $dxcc = $this->logbook_model->check_dxcc_table($data[0], $data[2]); + + $data[1] = $data[1] == "NULL" ? 0 : $data[1]; + + if ($data[1] != $dxcc[0]) { + $result[] = array( + 'Callsign' => $data[0], + 'Expected country' => '', + 'Expected adif' => $data[1], + 'Result country' => ucwords(strtolower($dxcc[1]), "- (/"), + 'Result adif' => $dxcc[0], + ); + } + } + } while ($data = fgetcsv($handle,1000,",")); + + // End clock time in seconds + $end_time = microtime(true); + + // Calculate script execution time + $execution_time = ($end_time - $start_time); + + echo " Execution time of script = ".$execution_time." sec
"; + echo $i . " calls tested.
"; + $count = 0; + + if ($result) { + $this->array_to_table($result); + } + } + + function call() { + $testarray = array(); + + $testarray[] = array( + 'Callsign' => 'VE3EY/VP9', + 'Country' => 'Bermuda', + 'Adif' => 64, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'VP2MDG', + 'Country' => 'Montserrat', + 'Adif' => 96, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'VP2EY', + 'Country' => 'Anguilla', + 'Adif' => 12, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'VP2VI', + 'Country' => 'British Virgin Islands.', + 'Adif' => 65, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'VP2V/AA7V', + 'Country' => 'British Virgin Islands', + 'Adif' => 65, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'W8LR/R', + 'Country' => 'United States Of America', + 'Adif' => 291, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'SO1FH', + 'Country' => 'Poland', + 'Adif' => 269, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'KZ1H/PP', + 'Country' => 'Brazil', + 'Adif' => 108, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'K1KW/AM', + 'Country' => 'None', + 'Adif' => 0, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'K1KW/MM', + 'Country' => 'None', + 'Adif' => 0, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'TF/DL2NWK/P', + 'Country' => 'Iceland', + 'Adif' => 242, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'OZ1ALS/A', + 'Country' => 'Denmark', + 'Adif' => 221, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'LA1K', + 'Country' => 'Norway', + 'Adif' => 266, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'K1KW/M', + 'Country' => 'United States Of America', + 'Adif' => 291, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'TF/DL2NWK/M', + 'Country' => 'Iceland', + 'Adif' => 242, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'TF/DL2NWK/MM', + 'Country' => 'None', + 'Adif' => 0, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'TF/DL2NWK/P', + 'Country' => 'Iceland', + 'Adif' => 242, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => '2M0SQL/P', + 'Country' => 'Scotland', + 'Adif' => 279, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'FT8WW', + 'Country' => 'Crozet Island', + 'Adif' => 41, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'RV0AL/0/P', + 'Country' => 'Asiatic Russia', + 'Adif' => 15, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'OH/DJ1YFK', + 'Country' => 'Finland', + 'Adif' => 224, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'N6TR/7', + 'Country' => 'United States Of America', + 'Adif' => 291, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'KH0CW', + 'Country' => 'United States Of America', + 'Adif' => 291, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'R2FM/P', + 'Country' => 'kaliningrad', + 'Adif' => 126, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'R2FM', + 'Country' => 'kaliningrad', + 'Adif' => 126, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'FT5XO', + 'Country' => 'Kerguelen Island', + 'Adif' => 131, + 'Date' => 20050320 + ); + + $testarray[] = array( + 'Callsign' => 'VP8CTR', + 'Country' => 'Antarctica', + 'Adif' => 13, + 'Date' => 19970207 + ); + + $testarray[] = array( + 'Callsign' => 'FO0AAA', + 'Country' => 'Clipperton', + 'Adif' => 36, + 'Date' => '20000302' + ); + + $testarray[] = array( + 'Callsign' => 'CX/PR8KW', + 'Country' => 'Uruguay', + 'Adif' => 144, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'IQ3MV/LH', + 'Country' => 'Italy', + 'Adif' => 248, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'LA1K/QRP', + 'Country' => 'Norway', + 'Adif' => 266, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'LA1K/LGT', + 'Country' => 'Norway', + 'Adif' => 266, + 'Date' => $date = date('Ymd', time()) + ); + + $testarray[] = array( + 'Callsign' => 'SM1K/LH', + 'Country' => 'Sweden', + 'Adif' => 284, + 'Date' => $date = date('Ymd', time()) + ); + + set_time_limit(3600); + + // Starting clock time in seconds + $start_time = microtime(true); + + $this->load->model('logbook_model'); + + $result = array(); + + $i = 0; + + foreach ($testarray as $call) { + $i++; + $dxcc = $this->logbook_model->dxcc_lookup($call['Callsign'], $call['Date']); + + $dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0; + $dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 0; + + if ($call['Adif'] != $dxcc['adif']) { + $result[] = array( + 'Callsign' => $call['Callsign'], + 'Expected country' => $call['Country'], + 'Expected adif' => $call['Adif'], + 'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"), + 'Result adif' => $dxcc['adif'], + ); + } + } + + // End clock time in seconds + $end_time = microtime(true); + + // Calculate script execution time + $execution_time = ($end_time - $start_time); + + echo " Execution time of script = ".$execution_time." sec
"; + echo $i . " calls tested.
"; + $count = 0; + + if ($result) { + $this->array_to_table($result); + } + } +} \ No newline at end of file diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 37e5553c..33eee1ee 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -873,15 +873,15 @@ class Lotw extends CI_Controller { $contents = file_get_contents('https://lotw.arrl.org/lotw-user-activity.csv', true); if($contents === FALSE) { - echo "something went wrong"; + echo "Something went wrong with fetching the LoTW users file."; } else { $file = './updates/lotw_users.csv'; - if(!is_file($file)){ // Some simple example content. - file_put_contents($file, $contents); // Save our content to the file. + if (file_put_contents($file, $contents) !== FALSE) { // Save our content to the file. + echo "LoTW User Data Saved."; + } else { + echo "FAILED: Could not write to LoTW users file"; } - - echo "LoTW User Data Saved."; } } diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 243ff104..12f53678 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -165,7 +165,7 @@ class Update extends CI_Controller { public function dxcc() { $this->update_status("Downloading file"); - // give it 5 minutes... + // give it 10 minutes... set_time_limit(600); // Load Migration data if any. @@ -177,13 +177,21 @@ class Update extends CI_Controller { $url = "https://cdn.clublog.org/cty.php?api=a11c3235cd74b88212ce726857056939d52372bd"; $gz = gzopen($url, 'r'); + if ($gz === FALSE) { + $this->update_status("Something went wrong with fetching the cty.xml file."); + return; + } + $data = ""; while (!gzeof($gz)) { $data .= gzgetc($gz); } gzclose($gz); - file_put_contents($this->make_update_path("cty.xml"), $data); + if (file_put_contents($this->make_update_path("cty.xml"), $data) === FALSE) { + $this->update_status("FAILED: Could not write to LoTW users file"); + return; + } // Clear the tables, ready for new data $this->db->empty_table("dxcc_entities"); @@ -238,6 +246,11 @@ class Update extends CI_Controller { } + public function check_missing_continent() { + $this->load->model('logbook_model'); + $this->logbook_model->check_missing_continent(); + } + public function check_missing_grid($all = false){ $this->load->model('logbook_model'); $this->logbook_model->check_missing_grid_id($all); @@ -247,7 +260,7 @@ class Update extends CI_Controller { $strFile = $this->make_update_path("clublog_scp.txt"); $url = "https://cdn.clublog.org/clublog.scp.gz"; set_time_limit(300); - $this->update_status("Downloading Club Log SCP file"); + echo "Downloading Club Log SCP file...
"; $gz = gzopen($url, 'r'); if ($gz) { @@ -256,21 +269,20 @@ class Update extends CI_Controller { $data .= gzgetc($gz); } gzclose($gz); - file_put_contents($strFile, $data); - if (file_exists($strFile)) + if (file_put_contents($strFile, $data) !== FALSE) { $nCount = count(file($strFile)); if ($nCount > 0) { - $this->update_status("DONE: " . number_format($nCount) . " callsigns loaded" ); + echo "DONE: " . number_format($nCount) . " callsigns loaded"; } else { - $this->update_status("FAILED: Empty file"); + echo "FAILED: Empty file"; } } else { - $this->update_status("FAILED: Could not create Club Log SCP file locally"); + echo "FAILED: Could not write to Club Log SCP file"; } } else { - $this->update_status("FAILED: Could not connect to Club Log"); + echo "FAILED: Could not connect to Club Log"; } } @@ -281,15 +293,15 @@ class Update extends CI_Controller { $contents = file_get_contents('https://lotw.arrl.org/lotw-user-activity.csv', true); if($contents === FALSE) { - echo "something went wrong"; + echo "Something went wrong with fetching the LoTW users file."; } else { $file = './updates/lotw_users.csv'; - if(!is_file($file)){ // Some simple example content. - file_put_contents($file, $contents); // Save our content to the file. + if (file_put_contents($file, $contents) !== FALSE) { // Save our content to the file. + echo "LoTW User Data Saved."; + } else { + echo "FAILED: Could not write to LoTW users file"; } - - echo "LoTW User Data Saved."; } } @@ -318,10 +330,7 @@ class Update extends CI_Controller { } else { $file = './assets/json/dok.txt'; - file_put_contents($file, $contents); // Save our content to the file. - - if (file_exists($file)) - { + if (file_put_contents($file, $contents) !== FALSE) { // Save our content to the file. $nCount = count(file($file)); if ($nCount > 0) { @@ -330,7 +339,7 @@ class Update extends CI_Controller { echo"FAILED: Empty file"; } } else { - echo"FAILED: Could not create dok.txt file locally"; + echo"FAILED: Could not write to dok.txt file"; } } } @@ -343,36 +352,38 @@ class Update extends CI_Controller { $sotafile = './assets/json/sota.txt'; - if($csvfile === FALSE) { + $csvhandle = fopen($csvfile,"r"); + if ($csvhandle === FALSE) { echo "Something went wrong with fetching the SOTA file"; - } else { - $csvhandle = fopen($csvfile,"r"); + return; + } - $data = fgetcsv($csvhandle,1000,","); // Skip line we are not interested in - $data = fgetcsv($csvhandle,1000,","); // Skip line we are not interested in - $data = fgetcsv($csvhandle,1000,","); - $sotafilehandle = fopen($sotafile, 'w'); + $data = fgetcsv($csvhandle,1000,","); // Skip line we are not interested in + $data = fgetcsv($csvhandle,1000,","); // Skip line we are not interested in + $data = fgetcsv($csvhandle,1000,","); + $sotafilehandle = fopen($sotafile, 'w'); - do { - if ($data[0]) { - fwrite($sotafilehandle, $data[0].PHP_EOL); - } - } while ($data = fgetcsv($csvhandle,1000,",")); + if ($sotafilehandle === FALSE) { + echo"FAILED: Could not write to sota.txt file"; + return; + } - fclose($csvhandle); - fclose($sotafilehandle); - if (file_exists($sotafile)) - { - $nCount = count(file($sotafile)); - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " SOTA's saved"; - } else { - echo"FAILED: Empty file"; - } - } else { - echo"FAILED: Could not create sota.txt file locally"; + $$nCount = 0; + do { + if ($data[0]) { + fwrite($sotafilehandle, $data[0].PHP_EOL); + $nCount++; } + } while ($data = fgetcsv($csvhandle,1000,",")); + + fclose($csvhandle); + fclose($sotafilehandle); + + if ($nCount > 0) + { + echo "DONE: " . number_format($nCount) . " SOTA's saved"; + } else { + echo"FAILED: Empty file"; } } @@ -391,29 +402,35 @@ class Update extends CI_Controller { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $csv = curl_exec($ch); curl_close($ch); + if ($csv === FALSE) { + echo "Something went wrong with fetching the WWFF file"; + return; + } $wwfffilehandle = fopen($wwfffile, 'w'); + if ($wwfffilehandle === FALSE) { + echo"FAILED: Could not write to wwff.txt file"; + return; + } + $data = str_getcsv($csv,"\n"); + $nCount = 0; foreach ($data as $idx => $row) { if ($idx == 0) continue; // Skip line we are not interested in $row = str_getcsv($row, ','); if ($row[0]) { fwrite($wwfffilehandle, $row[0].PHP_EOL); + $nCount++; } } fclose($wwfffilehandle); - if (file_exists($wwfffile)) + + if ($nCount > 0) { - $nCount = count(file($wwfffile)); - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " WWFF's saved"; - } else { - echo"FAILED: Empty file"; - } + echo "DONE: " . number_format($nCount) . " WWFF's saved"; } else { - echo"FAILED: Could not create wwff.txt file locally"; + echo"FAILED: Empty file"; } } @@ -429,29 +446,34 @@ class Update extends CI_Controller { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $csv = curl_exec($ch); curl_close($ch); + if ($csv === FALSE) { + echo "Something went wrong with fetching the POTA file"; + return; + } $potafilehandle = fopen($potafile, 'w'); + if ($potafilehandle === FALSE) { + echo"FAILED: Could not write to pota.txt file"; + return; + } $data = str_getcsv($csv,"\n"); + $nCount = 0; foreach ($data as $idx => $row) { if ($idx == 0) continue; // Skip line we are not interested in $row = str_getcsv($row, ','); if ($row[0]) { fwrite($potafilehandle, $row[0].PHP_EOL); + $nCount++; } } fclose($potafilehandle); - if (file_exists($potafile)) + + if ($nCount > 0) { - $nCount = count(file($potafile)); - if ($nCount > 0) - { - echo "DONE: " . number_format($nCount) . " POTA's saved"; - } else { - echo"FAILED: Empty file"; - } + echo "DONE: " . number_format($nCount) . " POTA's saved"; } else { - echo"FAILED: Could not create pota.txt file locally"; + echo"FAILED: Empty file"; } } diff --git a/application/language/english/general_words_lang.php b/application/language/english/general_words_lang.php index e5dc1512..92aad195 100644 --- a/application/language/english/general_words_lang.php +++ b/application/language/english/general_words_lang.php @@ -94,6 +94,7 @@ $lang['gen_hamradio_logbook'] = 'Logbook'; $lang['gen_hamradio_cq_zone'] = 'CQ Zone'; $lang['gen_hamradio_dxcc'] = 'DXCC'; +$lang['gen_hamradio_continent'] = 'Continent'; $lang['gen_hamradio_usa_state'] = 'USA State'; $lang['gen_hamradio_county_reference'] = 'USA County'; $lang['gen_hamradio_iota_reference'] = 'IOTA Reference'; @@ -125,3 +126,11 @@ $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:'; $lang['copy_to_clipboard'] = 'Copy to clipboard'; + +$lang['africa'] = 'Africa'; +$lang['antarctica'] = 'Antarctica'; +$lang['asia'] = 'Asia'; +$lang['europe'] = 'Europe'; +$lang['northamerica'] = 'North America'; +$lang['oceania'] = 'Oceania'; +$lang['southamerica'] = 'South America'; diff --git a/application/language/german/general_words_lang.php b/application/language/german/general_words_lang.php index caf948f7..98e1138f 100644 --- a/application/language/german/general_words_lang.php +++ b/application/language/german/general_words_lang.php @@ -94,6 +94,7 @@ $lang['gen_hamradio_logbook'] = 'Logbuch'; $lang['gen_hamradio_cq_zone'] = 'CQ Zone'; $lang['gen_hamradio_dxcc'] = 'DXCC'; +$lang['gen_hamradio_continent'] = 'Kontinent'; $lang['gen_hamradio_usa_state'] = 'USA-Staat'; $lang['gen_hamradio_county_reference'] = 'USA County'; $lang['gen_hamradio_iota_reference'] = 'IOTA Referenznummer'; @@ -124,3 +125,11 @@ $lang['gen_from_date'] = 'Ab Datum'; $lang['gen_this_qso_was_confirmed_on'] = 'Dieses QSO wurde bestätigt am'; $lang['copy_to_clipboard'] = 'In die Zwischenablage kopieren'; + +$lang['africa'] = 'Afrika'; +$lang['antarctica'] = 'Antarktis'; +$lang['asia'] = 'Asien'; +$lang['europe'] = 'Europa'; +$lang['northamerica'] = 'Nord-Amerika'; +$lang['oceania'] = 'Ozeanien'; +$lang['southamerica'] = 'Süd-Amerika'; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f6ae8ae8..1ca2f4da 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -78,6 +78,19 @@ class Logbook_model extends CI_Model { $dxcc_id = $this->input->post('dxcc_id'); } + if($this->input->post('continent') == "") { + + $dxcc = $this->check_dxcc_table(strtoupper(trim($this->input->post('callsign'))), $datetime); + if (empty($dxcc[3])) { + $continent = null; + } else { + $continent = $dxcc[3]; + } + + } else { + $continent = $this->input->post('continent'); + } + $mode = $this->get_main_mode_if_submode($this->input->post('mode')); if ($mode == null) { $mode = $this->input->post('mode'); @@ -139,6 +152,7 @@ class Logbook_model extends CI_Model { 'COL_SAT_NAME' => strtoupper($this->input->post('sat_name')), 'COL_SAT_MODE' => strtoupper($this->input->post('sat_mode')), 'COL_COUNTRY' => $country, + 'COL_CONT' => $continent, 'COL_QSLSDATE' => $qslsdate, 'COL_QSLRDATE' => $qslrdate, 'COL_QSL_SENT' => $qsl_sent, @@ -161,8 +175,8 @@ class Logbook_model extends CI_Model { 'COL_TX_PWR' => $tx_power, 'COL_STX' => $stx, 'COL_SRX' => $srx, - 'COL_STX_STRING' => $stx_string, - 'COL_SRX_STRING' => $srx_string, + 'COL_STX_STRING' => strtoupper(trim($stx_string)), + 'COL_SRX_STRING' => strtoupper(trim($srx_string)), 'COL_CONTEST_ID' => $contestid, 'COL_NR_BURSTS' => null, 'COL_NR_PINGS' => null, @@ -621,7 +635,7 @@ class Logbook_model extends CI_Model { } else if ($data['COL_BAND'] == '15m') { $sat_name = 'FO-118[H/u]'; } - } else if ($data['COL_SAT_NAME'] == 'ARISS') { + } else if ($data['COL_SAT_NAME'] == 'ARISS' || $data['COL_SAT_NAME'] == 'ISS') { if ($data['COL_MODE'] == 'FM') { $sat_name = 'ISS-FM'; } else if ($data['COL_MODE'] == 'PKT') { @@ -785,6 +799,7 @@ class Logbook_model extends CI_Model { 'COL_COMMENT' => $this->input->post('comment'), 'COL_NAME' => $this->input->post('name'), 'COL_COUNTRY' => $country, + 'COL_CONT' => $this->input->post('continent'), 'COL_DXCC'=> $this->input->post('dxcc_id'), 'COL_CQZ' => $this->input->post('cqz'), 'COL_SAT_NAME' => $this->input->post('sat_name'), @@ -816,8 +831,8 @@ class Logbook_model extends CI_Model { 'COL_QTH' => $this->input->post('qth'), 'COL_PROP_MODE' => $this->input->post('prop_mode'), 'COL_FREQ_RX' => $this->parse_frequency($this->input->post('freq_display_rx')), - 'COL_STX_STRING' => $this->input->post('stx_string'), - 'COL_SRX_STRING' => $this->input->post('srx_string'), + 'COL_STX_STRING' => strtoupper(trim($this->input->post('stx_string'))), + 'COL_SRX_STRING' => strtoupper(trim($this->input->post('srx_string'))), 'COL_STX' => $stx_string, 'COL_SRX' => $srx_string, 'COL_CONTEST_ID' => $this->input->post('contest_name'), @@ -2907,7 +2922,9 @@ class Logbook_model extends CI_Model { */ public function check_dxcc_table($call, $date){ - $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`') + $csadditions = '/^P$|^R$|^A$|^M$/'; + + $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`, `cont`') ->where('call', $call) ->where('(start <= ', $date) ->or_where('start is null)', NULL, false) @@ -2917,12 +2934,14 @@ class Logbook_model extends CI_Model { if ($dxcc_exceptions->num_rows() > 0){ $row = $dxcc_exceptions->row_array(); - return array($row['adif'], $row['entity'], $row['cqz']); + return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); } if (preg_match('/(^KG4)[A-Z09]{3}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 4 or 6 char, it is USA $call = "K"; } elseif (preg_match('/(^OH\/)|(\/OH[1-9]?$)/', $call)) { # non-Aland prefix! $call = "OH"; # make callsign OH = finland + } elseif (preg_match('/(^CX\/)|(\/CX[1-9]?$)/', $call)) { # non-Antarctica prefix! + $call = "CX"; # make callsign CX = Uruguay } elseif (preg_match('/(^3D2R)|(^3D2.+\/R)/', $call)) { # seems to be from Rotuma $call = "3D2/R"; # will match with Rotuma } elseif (preg_match('/^3D2C/', $call)) { # seems to be from Conway Reef @@ -2934,23 +2953,43 @@ class Logbook_model extends CI_Model { } elseif (preg_match('/(^KG4)[A-Z09]{1}/', $call)) { $call = "K"; } elseif (preg_match('/\w\/\w/', $call)) { + if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { + $prefix = $matches[1][0]; + $callsign = $matches[3][0]; + $suffix = $matches[5][0]; + if ($prefix) { + $prefix = substr($prefix, 0, -1); # Remove the / at the end + } + if ($suffix) { + $suffix = substr($suffix, 1); # Remove the / at the beginning + }; + if (preg_match($csadditions, $suffix)) { + if ($prefix) { + $call = $prefix; + } else { + $call = $callsign; + } + } else { $result = $this->wpx($call, 1); # use the wpx prefix instead if ($result == '') { $row['adif'] = 0; $row['entity'] = 'None'; $row['cqz'] = 0; - return array($row['adif'], $row['entity'], $row['cqz']); + $row['cont'] = ''; + return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); } else { $call = $result . "AA"; } + } } + } $len = strlen($call); // query the table, removing a character from the right until a match for ($i = $len; $i > 0; $i--){ //printf("searching for %s\n", substr($call, 0, $i)); - $dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`') + $dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`, `cont`') ->where('call', substr($call, 0, $i)) ->where('(start <= ', $date) ->or_where("start is null)", NULL, false) @@ -2963,24 +3002,26 @@ class Logbook_model extends CI_Model { if ($dxcc_result->num_rows() > 0){ $row = $dxcc_result->row_array(); - return array($row['adif'], $row['entity'], $row['cqz']); + return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); } } return array("Not Found", "Not Found"); - } + + } public function dxcc_lookup($call, $date){ + $csadditions = '/^P$|^R$|^A$|^M$/'; + $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`') ->where('call', $call) - ->where('(start <= CURDATE()') + ->where('(start <= ', $date) ->or_where('start is null)', NULL, false) - ->where('(end >= CURDATE()') + ->where('(end >= ', $date) ->or_where('end is null)', NULL, false) ->get('dxcc_exceptions'); - if ($dxcc_exceptions->num_rows() > 0){ $row = $dxcc_exceptions->row_array(); return $row; @@ -2990,6 +3031,8 @@ class Logbook_model extends CI_Model { $call = "K"; } elseif (preg_match('/(^OH\/)|(\/OH[1-9]?$)/', $call)) { # non-Aland prefix! $call = "OH"; # make callsign OH = finland + } elseif (preg_match('/(^CX\/)|(\/CX[1-9]?$)/', $call)) { # non-Antarctica prefix! + $call = "CX"; # make callsign CX = Uruguay } elseif (preg_match('/(^3D2R)|(^3D2.+\/R)/', $call)) { # seems to be from Rotuma $call = "3D2/R"; # will match with Rotuma } elseif (preg_match('/^3D2C/', $call)) { # seems to be from Conway Reef @@ -3001,18 +3044,37 @@ class Logbook_model extends CI_Model { } elseif (preg_match('/(^KG4)[A-Z09]{1}/', $call)) { $call = "K"; } elseif (preg_match('/\w\/\w/', $call)) { - $result = $this->wpx($call, 1); # use the wpx prefix instead - if ($result == '') { - $row['adif'] = 0; - $row['entity'] = 'None'; - $row['cqz'] = 0; - $row['long'] = '0'; - $row['lat'] = '0'; - return $row; - } else { - $call = $result . "AA"; + if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { + $prefix = $matches[1][0]; + $callsign = $matches[3][0]; + $suffix = $matches[5][0]; + if ($prefix) { + $prefix = substr($prefix, 0, -1); # Remove the / at the end } + if ($suffix) { + $suffix = substr($suffix, 1); # Remove the / at the beginning + }; + if (preg_match($csadditions, $suffix)) { + if ($prefix) { + $call = $prefix; + } else { + $call = $callsign; + } + } else { + $result = $this->wpx($call, 1); # use the wpx prefix instead + if ($result == '') { + $row['adif'] = 0; + $row['entity'] = 'None'; + $row['cqz'] = 0; + $row['long'] = '0'; + $row['lat'] = '0'; + return $row; + } else { + $call = $result . "AA"; + } + } } + } $len = strlen($call); @@ -3046,8 +3108,8 @@ class Logbook_model extends CI_Model { $b = ''; $c = ''; - $lidadditions = '/^QRP|^LGT/'; - $csadditions = '/^P$|^R$|^A$|^M$/'; + $lidadditions = '/^QRP$|^LGT$/'; + $csadditions = '/^P$|^R$|^A$|^M$|^LH$/'; $noneadditions = '/^MM$|^AM$/'; # First check if the call is in the proper format, A/B/C where A and C @@ -3242,6 +3304,16 @@ class Logbook_model extends CI_Model { print("$count updated\n"); } + public function check_missing_continent(){ + // get all records with no COL_CONT + $this->db->trans_start(); + $sql = "UPDATE ".$this->config->item('table_name')." JOIN dxcc_entities ON ".$this->config->item('table_name').".col_dxcc = dxcc_entities.adif SET col_cont = dxcc_entities.cont WHERE COALESCE(".$this->config->item('table_name').".col_cont, '') = ''"; + + $query = $this->db->query($sql); + print($this->db->affected_rows()." updated\n"); + $this->db->trans_complete(); + } + public function check_missing_grid_id($all){ // get all records with no COL_GRIDSQUARE $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); diff --git a/application/views/debug/main.php b/application/views/debug/main.php index 84a12c16..2567611d 100644 --- a/application/views/debug/main.php +++ b/application/views/debug/main.php @@ -161,19 +161,23 @@ COL_COUNTRY; ?>"> + +
+
+ + +
diff --git a/application/views/qso/index.php b/application/views/qso/index.php index f86aab8c..65132bd9 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -222,6 +222,19 @@ +
+ + +
-
- - -
-
- - -
-
- -
- +.form-signin { + width: 100%; + max-width: 430px; + padding: 15px; + margin: auto; +} -

Forgot your password?

+.form-signin input[type="email"] { + margin-bottom: -1px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} -
+.form-signin input[type="password"] { + border-top-left-radius: 0; + border-top-right-radius: 0; +} + +
+ +
+
+

Login to Cloudlog

+
+ form_validation->set_error_delimiters('', ''); ?> + +
+ + +
+
+ + +
+ + + load->view('layout/messages'); ?> + + +
+
+
\ No newline at end of file diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index 7a51fcda..02fcab22 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -188,6 +188,39 @@ + COL_CONT != null) { ?> + + lang->line('gen_hamradio_continent'); ?> + + COL_CONT) { + case "AF": + echo $this->lang->line('africa'); + break; + case "AN": + echo $this->lang->line('antarctica'); + break; + case "AS": + echo $this->lang->line('asia'); + break; + case "EU": + echo $this->lang->line('europe'); + break; + case "NA": + echo $this->lang->line('northamerica'); + break; + case "OC": + echo $this->lang->line('oceania'); + break; + case "SA": + echo $this->lang->line('southamerica'); + break; + } + ?> + + + + COL_CONTEST_ID != null) { ?> lang->line('contesting_contest_name'); ?> diff --git a/assets/css/general.css b/assets/css/general.css index 4099020e..6d5b732c 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -412,3 +412,7 @@ div#station_logbooks_linked_table_paginate { .dropdown-menu { z-index: 2000; } + +.qso_panel .dxccsummary { + margin-bottom: 10px; +} \ No newline at end of file diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index b0cbdc26..b8fbd5b4 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -146,7 +146,7 @@ function qso_edit(id) { labelField: 'name', searchField: 'name', options: [], - create: false, + create: true, load: function(query, callback) { if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered $.ajax({ @@ -174,7 +174,7 @@ function qso_edit(id) { labelField: 'name', searchField: 'name', options: [], - create: false, + create: true, load: function(query, callback) { if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered $.ajax({ @@ -202,7 +202,7 @@ function qso_edit(id) { labelField: 'name', searchField: 'name', options: [], - create: false, + create: true, load: function(query, callback) { if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered $.ajax({ @@ -447,4 +447,4 @@ function getDxccResult(dxcc, name) { $('.dxccsummarybody').append(html); } }); -} \ No newline at end of file +} diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index ca546a0a..3199790a 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -394,8 +394,8 @@ function logQso() { // Store contest session localStorage.setItem("contestid", $("#contestname").val()); localStorage.setItem("exchangetype", $("#exchangetype").val()); - localStorage.setItem("exchangereceived", $("#exch_rcvd").val()); - localStorage.setItem("exchangesent", $("#exch_sent").val()); + localStorage.setItem("exchangereceived", $("#exch_rcvd").val().toUpperCase()); + localStorage.setItem("exchangesent", $("#exch_sent").val().toUpperCase()); localStorage.setItem("serialreceived", $("#exch_serial_r").val()); localStorage.setItem("serialsent", $("#exch_serial_s").val()); localStorage.setItem("gridsquarereceived", $("#exch_gridsquare_r").val()); diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index d0f0b706..126df829 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -68,7 +68,7 @@ $( document ).ready(function() { labelField: 'name', searchField: 'name', options: [], - create: false, + create: true, load: function(query, callback) { if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered $.ajax({ @@ -101,7 +101,7 @@ $( document ).ready(function() { labelField: 'name', searchField: 'name', options: [], - create: false, + create: true, load: function(query, callback) { if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered $.ajax({ @@ -134,7 +134,7 @@ $( document ).ready(function() { labelField: 'name', searchField: 'name', options: [], - create: false, + create: true, load: function(query, callback) { if (!query || query.length < 3) return callback(); // Only trigger if 3 or more characters are entered $.ajax({ @@ -327,6 +327,7 @@ function reset_fields() { $('#locator_info').text(""); $('#country').val(""); + $('#continent').val(""); $('#lotw_info').text(""); $('#qrz_info').text(""); $('#hamqth_info').text(""); @@ -536,6 +537,10 @@ $("#callsign").focusout(function() { $('#name').val(result.callsign_name); } + if($('#continent').val() == "") { + $('#continent').val(result.dxcc.cont); + } + if($('#qth').val() == "") { $('#qth').val(result.callsign_qth); } @@ -772,6 +777,7 @@ function resetDefaultQSOFields() { $('#callsign_info').text(""); $('#locator_info').text(""); $('#country').val(""); + $('#continent').val(""); $('#dxcc_id').val(""); $('#cqz').val(""); $('#name').val("");