diff --git a/.htaccess.sample b/.htaccess.sample new file mode 100644 index 00000000..57dfd443 --- /dev/null +++ b/.htaccess.sample @@ -0,0 +1,8 @@ +# If you want to hide 'index.php' from the URL, rename this file to '.htaccess' on your server +# Then change the following variable in /application/config/config.php +# $config['index_page'] = ''; + +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ /index.php?/$1 [L] \ No newline at end of file diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index ca3b4fff..cbf2f52c 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -82,7 +82,14 @@ class adif extends CI_Controller { $this->load->model('adif_data'); - $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to')); + // Used for exporting QSOs not previously exported to LoTW + if ($this->input->post('exportLotw') == 1) { + $exportLotw = true; + } else { + $exportLotw = false; + } + + $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $exportLotw); $this->load->view('adif/data/exportall', $data); diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index d1e4d9cf..ac9bde3a 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -346,6 +346,7 @@ class Awards extends CI_Controller { } $data['was_array'] = $this->was->get_was_array($bands, $postdata); + $data['was_summary'] = $this->was->get_was_summary(); // Render Page $data['page_title'] = "Awards - WAS (Worked all states)"; diff --git a/application/controllers/Backup.php b/application/controllers/Backup.php index b1bb3a5b..9859c6ab 100644 --- a/application/controllers/Backup.php +++ b/application/controllers/Backup.php @@ -4,14 +4,13 @@ class Backup extends CI_Controller { function __construct() { parent::__construct(); - - $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } } /* User Facing Links to Backup URLs */ public function index() { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } $data['page_title'] = "Backup"; diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 0c4b332d..4064f27c 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -7,13 +7,13 @@ class Lotw extends CI_Controller { { parent::__construct(); $this->load->helper(array('form', 'url')); - - $this->load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } } private function loadFromFile($filepath) { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + // Figure out how we should be marking QSLs confirmed via LoTW $query = $query = $this->db->query('SELECT lotw_rcvd_mark FROM config'); $q = $query->row(); @@ -28,13 +28,14 @@ class Lotw extends CI_Controller { $this->adif_parser->initialize(); - $tableheaders = "
| QSO Date | "; $tableheaders .= "Call | "; $tableheaders .= "Mode | "; $tableheaders .= "LoTW QSL Received | "; $tableheaders .= "Date LoTW Confirmed | "; + $tableheaders .= "State | "; $tableheaders .= "Log Status | "; $tableheaders .= "LoTW Status | "; $tableheaders .= "".$record['mode']." | "; $table .= "".$record['qsl_rcvd']." | "; $table .= "".$qsl_date." | "; + $table .= "".$state." | "; $table .= "QSO Record: ".$status." | "; $table .= "LoTW Record: ".$lotw_status." | "; $table .= ""; @@ -107,6 +115,9 @@ class Lotw extends CI_Controller { } public function import() { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $data['page_title'] = "LoTW ADIF Import"; $config['upload_path'] = './uploads/'; @@ -192,6 +203,9 @@ class Lotw extends CI_Controller { } // end function public function export() { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $data['page_title'] = "LoTW .TQ8 Upload"; $config['upload_path'] = './uploads/'; diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 52c2b9ad..d8d01d34 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -36,7 +36,7 @@ class Qrz extends CI_Controller { } } else { echo "No station_id's with a QRZ API Key found"; - log_message('info', "No station_id's with a QRZ API Key found"); + log_message('error', "No station_id's with a QRZ API Key found"); } } @@ -54,22 +54,38 @@ class Qrz extends CI_Controller { * Adif is build for each qso, and then uploaded, one at a time */ function mass_upload_qsos($station_id, $qrz_api_key) { - $i = 0; $data['qsos'] = $this->logbook_model->get_qrz_qsos($station_id); + $errormessages=array(); if ($data['qsos']) { foreach ($data['qsos'] as $qso) { $adif = $this->logbook_model->create_adif_from_data($qso); - $result = $this->logbook_model->push_qso_to_qrz($qrz_api_key, $adif); - if ($result) { + + if ($qso['COL_QRZCOM_QSO_UPLOAD_STATUS'] == 'M') { + $result = $this->logbook_model->push_qso_to_qrz($qrz_api_key, $adif, true); + } else { + $result = $this->logbook_model->push_qso_to_qrz($qrz_api_key, $adif); + } + + if ($result['status'] == 'OK') { $this->markqso($qso['COL_PRIMARY_KEY']); $i++; + } else { + log_message('error', 'QRZ upload failed for qso: Call: ' . $qso['COL_CALL'] . ' Band: ' . $qso['COL_BAND'] . ' Mode: ' . $qso['COL_MODE'] . ' Time: ' . $qso['COL_TIME_ON']); + log_message('error', 'QRZ upload failed with the following message: ' .$result['message']); + $errormessages[] = $result['message'] . ' Call: ' . $qso['COL_CALL'] . ' Band: ' . $qso['COL_BAND'] . ' Mode: ' . $qso['COL_MODE'] . ' Time: ' . $qso['COL_TIME_ON']; } } - return $i; + $result['status'] = 'OK'; + $result['count'] = $i; + $result['errormessages'] = $errormessages; + return $result; } else { - return $i; + $result['status'] = 'Error'; + $result['count'] = $i; + $result['errormessages'] = $errormessages; + return $result; } } @@ -111,18 +127,20 @@ class Qrz extends CI_Controller { $qrz_api_key = $this->logbook_model->exists_qrz_api_key($postData['station_id']); header('Content-type: application/json'); - if ($i = $this->mass_upload_qsos($postData['station_id'], $qrz_api_key)) { - + $result = $this->mass_upload_qsos($postData['station_id'], $qrz_api_key); + if ($result['status'] == 'OK') { $stationinfo = $this->stations->stations_with_qrz_api_key(); $info = $stationinfo->result(); $data['status'] = 'OK'; $data['info'] = $info; - $data['infomessage'] = $i . " QSOs are now uploaded to QRZ.com"; + $data['infomessage'] = $result['count'] . " QSOs are now uploaded to QRZ.com"; + $data['errormessages'] = $result['errormessages']; echo json_encode($data); } else { $data['status'] = 'Error'; $data['info'] = 'Error, no QSOs to upload found'; + $data['errormessages'] = $result['errormessages']; echo json_encode($data); } } diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index d7550233..4a4084dc 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -60,6 +60,7 @@ class QSO extends CI_Controller { $qso_data = array( 'start_date' => $this->input->post('start_date'), 'start_time' => $this->input->post('start_time'), + 'time_stamp' => time(), 'band' => $this->input->post('band'), 'freq' => $this->input->post('freq_display'), 'freq_rx' => $this->input->post('freq_display_rx'), diff --git a/application/controllers/User.php b/application/controllers/User.php index 7c1db98c..0a9e37be 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -52,7 +52,7 @@ 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'); - $this->load->view('user/add'); + $this->load->view('user/add', $data); } else { $this->load->view('user/add', $data); } @@ -88,7 +88,7 @@ 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'); - $this->load->view('user/add'); + $this->load->view('user/add', $data); $this->load->view('interface_assets/footer'); } } diff --git a/application/controllers/User_Logbooks.php b/application/controllers/User_Logbooks.php index 02e5cf20..08d5c6a8 100644 --- a/application/controllers/User_Logbooks.php +++ b/application/controllers/User_Logbooks.php @@ -16,4 +16,6 @@ class Logbooks extends CI_Controller { public function index() { echo 'Functions to come'; - } \ No newline at end of file + } + +} diff --git a/application/models/Adif_data.php b/application/models/Adif_data.php index 008af8a0..8b15e9f2 100644 --- a/application/models/Adif_data.php +++ b/application/models/Adif_data.php @@ -67,10 +67,9 @@ class adif_data extends CI_Model { return $this->db->get(); } - function export_custom($from, $to) { + function export_custom($from, $to, $exportLotw = false) { $this->load->model('stations'); $active_station_id = $this->stations->find_active(); - $this->db->select(''.$this->config->item('table_name').'.*, station_profile.*'); $this->db->from($this->config->item('table_name')); @@ -87,6 +86,10 @@ class adif_data extends CI_Model { $to = $to->format('Y-m-d'); $this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) <= '".$to."'"); } + if ($exportLotw) { + $this->db->where($this->config->item('table_name').".COL_LOTW_QSL_SENT != 'Y'"); + } + $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC"); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index bee3c509..0b7cfcef 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -123,6 +123,7 @@ class Logbook_model extends CI_Model { 'COL_STATE' => trim($this->input->post('usa_state')), 'COL_SOTA_REF' => trim($this->input->post('sota_ref')), 'COL_DARC_DOK' => trim($this->input->post('darc_dok')), + 'COL_NOTES' => $this->input->post('notes'), ); $station_id = $this->input->post('station_profile'); @@ -335,7 +336,8 @@ class Logbook_model extends CI_Model { // Push qso to qrz if apikey is set if ($apikey = $this->exists_qrz_api_key($data['station_id'])) { $adif = $this->create_adif_from_data($data); - IF ($this->push_qso_to_qrz($apikey, $adif)) { + $result = $this->push_qso_to_qrz($apikey, $adif); + IF ($result['status'] == 'OK') { $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y'; $data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now")); } @@ -368,13 +370,17 @@ class Logbook_model extends CI_Model { * Function uploads a QSO to QRZ with the API given. * $adif contains a line with the QSO in the ADIF format. QSO ends with an
| # | CQ Zone | '; foreach($bands as $band) { echo '' . $band . ' | '; @@ -157,6 +159,7 @@|||||
| ' . $i++ . ' | '. $cq .' | '; foreach ($value as $key) { echo '' . $key . ' | '; diff --git a/application/views/awards/was/index.php b/application/views/awards/was/index.php index bcd79896..b6ec561d 100644 --- a/application/views/awards/was/index.php +++ b/application/views/awards/was/index.php @@ -69,10 +69,12 @@|||||
| # | State | '; foreach($bands as $band) { echo '' . $band . ' | '; @@ -80,16 +82,47 @@ echo '|||||
| ' . $i++ . ' | '. $was .' | '; foreach ($value as $key) { echo '' . $key . ' | '; } echo '
| '; + + foreach ($was_summary as $was) { // Fills the table with the data + echo ' | ' . $was->col_band . ' | '; + } + + echo '
| Total worked | '; + + foreach ($was_summary as $was) { // Fills the table with the data + echo '' . $was->count . ' | '; + } + + echo '
| Total confirmed | '; + foreach ($was_summary as $was) { // Fills the table with the data + echo '' . $was->cfmwas . ' | '; + } + + echo '
| Upload a file | -
- Upload the Exported ADIF file from eQSL from the Download Inbox page, to mark QSOs as confirmed on eQSL. + +
+
+
+ + Upload the Exported ADIF file from eQSL from the Download Inbox page, to mark QSOs as confirmed on eQSL. Important Log files must have the file type .adi - |
-
| Pull eQSL data for me | -
- Cloudlog will use the eQSL username and password stored in your user profile to download confirmations from eQSL for you. We will only download confirmations received since your last eQSL confirmed QSO. - |
-
Cloudlog will use the eQSL username and password stored in your user profile to download confirmations from eQSL for you. We will only download confirmations received since your last eQSL confirmed QSO.
+