kopia lustrzana https://github.com/magicbug/Cloudlog
When you change the QRA field in the QSO input, it will check gridsquare and return whether worked or not based on SAT or if sat_name isn't filled out it will do band/mode
rodzic
b1b4d36f37
commit
02c10858c0
|
@ -161,6 +161,38 @@ class Logbook extends CI_Controller {
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: jsonlookupgrid
|
||||
*
|
||||
* Usage: Used to look up gridsquares when creating a QSO to check whether its needed or not
|
||||
*/
|
||||
function jsonlookupgrid($gridsquare, $type, $band, $mode) {
|
||||
$return = [
|
||||
"workedBefore" => false,
|
||||
];
|
||||
|
||||
if($type == "SAT") {
|
||||
$this->db->where('COL_PROP_MODE', 'SAT');
|
||||
} else {
|
||||
$this->db->where('COL_MODE', $mode);
|
||||
$this->db->where('COL_BAND', $band);
|
||||
$this->db->where('COL_PROP_MODE !=','SAT');
|
||||
|
||||
}
|
||||
|
||||
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
|
||||
$query = $this->db->get($this->config->item('table_name'), 1, 0);
|
||||
foreach ($query->result() as $workedBeforeRow)
|
||||
{
|
||||
$return['workedBefore'] = true;
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($return, JSON_PRETTY_PRINT);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Used to generate maps for displaying on /logbook/ */
|
||||
function qso_map() {
|
||||
|
|
|
@ -384,7 +384,56 @@ $(document).ready(function(){
|
|||
if ($(this).val()) {
|
||||
var qra_input = $(this).val();
|
||||
|
||||
if(qra_input.length > 3) {
|
||||
var qra_lookup = qra_input.substring(0, 4);
|
||||
|
||||
if(qra_lookup.length >= 4) {
|
||||
|
||||
// Check Log if satname is provided
|
||||
if($("#sat_name" ).val() != "") {
|
||||
|
||||
//logbook/jsonlookupgrid/io77/SAT/0/0
|
||||
|
||||
$.getJSON('logbook/jsonlookupgrid/' + qra_lookup.toUpperCase() + '/SAT/0/0', function(result)
|
||||
{
|
||||
// Reset CSS values before updating
|
||||
$('#locator').removeClass("workedGrid");
|
||||
$('#locator').removeClass("newGrid");
|
||||
$('#locator').attr('title', '');
|
||||
|
||||
if (result.workedBefore)
|
||||
{
|
||||
$('#locator').addClass("workedGrid");
|
||||
$('#locator').attr('title', 'Grid was already worked in the past');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#locator').addClass("newGrid");
|
||||
$('#locator').attr('title', 'New grid!');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.getJSON('logbook/jsonlookupgrid/' + qra_lookup.toUpperCase() + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
|
||||
{
|
||||
// Reset CSS values before updating
|
||||
$('#locator').removeClass("workedGrid");
|
||||
$('#locator').removeClass("newGrid");
|
||||
$('#locator').attr('title', '');
|
||||
|
||||
if (result.workedBefore)
|
||||
{
|
||||
$('#locator').addClass("workedGrid");
|
||||
$('#locator').attr('title', 'Grid was already worked in the past');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#locator').addClass("newGrid");
|
||||
$('#locator').attr('title', 'New grid!');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if(qra_input.length >= 4) {
|
||||
$.getJSON('logbook/qralatlngjson/' + $(this).val(), function(result)
|
||||
{
|
||||
// Set Map to Lat/Long
|
||||
|
|
Ładowanie…
Reference in New Issue