Merge pull request #1222 from AndreasK79/contest_serial_logic_fix
[Contesting] Pushed fix so that serial is not set when serial is not …
这个提交包含在:
当前提交
9548386868
共有 1 个文件被更改,包括 150 次插入 和 132 次删除
|
|
@ -1,37 +1,35 @@
|
||||||
// Callsign always has focus on load
|
// Callsign always has focus on load
|
||||||
$("#callsign").focus();
|
$("#callsign").focus();
|
||||||
|
|
||||||
// Init serial sent as 1 when loading page
|
$(document).ready(function () {
|
||||||
$("#exch_serial_s").val(1);
|
restoreContestSession();
|
||||||
|
setRst($("#mode").val());
|
||||||
$( document ).ready(function() {
|
|
||||||
restoreContestSession();
|
|
||||||
setRst($("#mode").val());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// This erases the contest logging session which is stored in localStorage
|
// This erases the contest logging session which is stored in localStorage
|
||||||
function reset_contest_session() {
|
function reset_contest_session() {
|
||||||
$('#name').val("");
|
$('#name').val("");
|
||||||
$('.callsign-suggestions').text("");
|
$('.callsign-suggestions').text("");
|
||||||
$('#callsign').val("");
|
$('#callsign').val("");
|
||||||
$('#comment').val("");
|
$('#comment').val("");
|
||||||
|
|
||||||
$("#exch_serial_s").val("1");
|
$("#exch_serial_s").val("1");
|
||||||
$("#exch_serial_r").val("");
|
$("#exch_serial_r").val("");
|
||||||
$('#exch_sent').val("");
|
$('#exch_sent').val("");
|
||||||
$('#exch_recv').val("");
|
$('#exch_recv').val("");
|
||||||
$("#exch_gridsquare_r").val("");
|
$("#exch_gridsquare_r").val("");
|
||||||
$("#exch_gridsquare_s").val("");
|
$("#exch_gridsquare_s").val("");
|
||||||
|
|
||||||
$("#callsign").focus();
|
$("#callsign").focus();
|
||||||
setRst($("#mode").val());
|
setRst($("#mode").val());
|
||||||
$("#exchangetype").val("None");
|
$("#exchangetype").val("None");
|
||||||
$("#contestname").val("Other").change();
|
setExchangetype("None");
|
||||||
$(".contest_qso_table_contents").empty();
|
$("#contestname").val("Other").change();
|
||||||
|
$(".contest_qso_table_contents").empty();
|
||||||
|
|
||||||
localStorage.removeItem("contestid");
|
localStorage.removeItem("contestid");
|
||||||
localStorage.removeItem("exchangetype");
|
localStorage.removeItem("exchangetype");
|
||||||
localStorage.removeItem("qso");
|
localStorage.removeItem("qso");
|
||||||
localStorage.removeItem("exchangereceived");
|
localStorage.removeItem("exchangereceived");
|
||||||
localStorage.removeItem("exchangesent");
|
localStorage.removeItem("exchangesent");
|
||||||
localStorage.removeItem("serialreceived");
|
localStorage.removeItem("serialreceived");
|
||||||
|
|
@ -41,67 +39,67 @@ function reset_contest_session() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storing the contestid in contest session
|
// Storing the contestid in contest session
|
||||||
$('#contestname').change(function() {
|
$('#contestname').change(function () {
|
||||||
localStorage.setItem("contestid", $("#contestname").val());
|
localStorage.setItem("contestid", $("#contestname").val());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Storing the exchange type in contest session
|
// Storing the exchange type in contest session
|
||||||
$('#exchangetype').change(function() {
|
$('#exchangetype').change(function () {
|
||||||
localStorage.setItem("exchangetype", $('#exchangetype').val());
|
localStorage.setItem("exchangetype", $('#exchangetype').val());
|
||||||
});
|
});
|
||||||
|
|
||||||
// realtime clock
|
// realtime clock
|
||||||
$(function($) {
|
$(function ($) {
|
||||||
var options = {
|
var options = {
|
||||||
utc: true,
|
utc: true,
|
||||||
format: '%H:%M:%S'
|
format: '%H:%M:%S'
|
||||||
}
|
}
|
||||||
$('.input_time').jclock(options);
|
$('.input_time').jclock(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function($) {
|
$(function ($) {
|
||||||
var options = {
|
var options = {
|
||||||
utc: true,
|
utc: true,
|
||||||
format: '%d-%m-%Y'
|
format: '%d-%m-%Y'
|
||||||
}
|
}
|
||||||
$('.input_date').jclock(options);
|
$('.input_date').jclock(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
// We don't want spaces to be written in callsign
|
// We don't want spaces to be written in callsign
|
||||||
$(function() {
|
$(function () {
|
||||||
$('#callsign').on('keypress', function(e) {
|
$('#callsign').on('keypress', function (e) {
|
||||||
if (e.which == 32){
|
if (e.which == 32) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// We don't want spaces to be written in exchange
|
// We don't want spaces to be written in exchange
|
||||||
$(function() {
|
$(function () {
|
||||||
$('#exch_recv').on('keypress', function(e) {
|
$('#exch_recv').on('keypress', function (e) {
|
||||||
if (e.which == 32){
|
if (e.which == 32) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Here we capture keystrokes to execute functions
|
// Here we capture keystrokes to execute functions
|
||||||
document.onkeyup = function(e) {
|
document.onkeyup = function (e) {
|
||||||
// ALT-W wipe
|
// ALT-W wipe
|
||||||
if (e.altKey && e.which == 87) {
|
if (e.altKey && e.which == 87) {
|
||||||
reset_log_fields();
|
reset_log_fields();
|
||||||
// CTRL-Enter logs QSO
|
// CTRL-Enter logs QSO
|
||||||
} else if ((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey)) {
|
} else if ((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey)) {
|
||||||
logQso();
|
logQso();
|
||||||
// Enter in sent exchange logs QSO
|
// Enter in sent exchange logs QSO
|
||||||
} else if((e.which == 13) && ($(document.activeElement).attr("id") == "exch_recv")) {
|
} else if ((e.which == 13) && ($(document.activeElement).attr("id") == "exch_recv")) {
|
||||||
logQso();
|
logQso();
|
||||||
} else if (e.which == 27) {
|
} else if (e.which == 27) {
|
||||||
reset_log_fields();
|
reset_log_fields();
|
||||||
// Space to jump to either callsign or the various exchanges
|
// Space to jump to either callsign or the various exchanges
|
||||||
} else if (e.which == 32) {
|
} else if (e.which == 32) {
|
||||||
var exchangetype = $("#exchangetype").val();
|
var exchangetype = $("#exchangetype").val();
|
||||||
if (exchangetype == 'Exchange') {
|
if (exchangetype == 'Exchange') {
|
||||||
if ($(document.activeElement).attr("id") == "callsign") {
|
if ($(document.activeElement).attr("id") == "callsign") {
|
||||||
$("#exch_recv").focus();
|
$("#exch_recv").focus();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -153,90 +151,90 @@ document.onkeyup = function(e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// On Key up check and suggest callsigns
|
// On Key up check and suggest callsigns
|
||||||
$("#callsign").keyup(function() {
|
$("#callsign").keyup(function () {
|
||||||
var call = $(this).val();
|
var call = $(this).val();
|
||||||
if (call.length >= 3) {
|
if (call.length >= 3) {
|
||||||
$.get('lookup/scp/' + call.toUpperCase(), function(result) {
|
$.get('lookup/scp/' + call.toUpperCase(), function (result) {
|
||||||
$('.callsign-suggestions').text(result);
|
$('.callsign-suggestions').text(result);
|
||||||
highlight(call.toUpperCase());
|
highlight(call.toUpperCase());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (call.length <= 2) {
|
else if (call.length <= 2) {
|
||||||
$('.callsign-suggestions').text("");
|
$('.callsign-suggestions').text("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function reset_log_fields() {
|
function reset_log_fields() {
|
||||||
$('#name').val("");
|
$('#name').val("");
|
||||||
$('.callsign-suggestions').text("");
|
$('.callsign-suggestions').text("");
|
||||||
$('#callsign').val("");
|
$('#callsign').val("");
|
||||||
$('#comment').val("");
|
$('#comment').val("");
|
||||||
$('#exch_recv').val("");
|
$('#exch_recv').val("");
|
||||||
$('#exch_serial_r').val("");
|
$('#exch_serial_r').val("");
|
||||||
$('#exch_gridsquare_r').val("");
|
$('#exch_gridsquare_r').val("");
|
||||||
$("#callsign").focus();
|
$("#callsign").focus();
|
||||||
setRst($("#mode").val());
|
setRst($("#mode").val());
|
||||||
}
|
}
|
||||||
|
|
||||||
RegExp.escape = function(text) {
|
RegExp.escape = function (text) {
|
||||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||||
}
|
}
|
||||||
|
|
||||||
function highlight(term, base) {
|
function highlight(term, base) {
|
||||||
if (!term) return;
|
if (!term) return;
|
||||||
base = base || document.body;
|
base = base || document.body;
|
||||||
var re = new RegExp("(" + RegExp.escape(term) + ")", "gi");
|
var re = new RegExp("(" + RegExp.escape(term) + ")", "gi");
|
||||||
var replacement = "<span class=\"text-primary\">" + term + "</span>";
|
var replacement = "<span class=\"text-primary\">" + term + "</span>";
|
||||||
$(".callsign-suggestions", base).contents().each( function(i, el) {
|
$(".callsign-suggestions", base).contents().each(function (i, el) {
|
||||||
if (el.nodeType === 3) {
|
if (el.nodeType === 3) {
|
||||||
var data = el.data;
|
var data = el.data;
|
||||||
if (data = data.replace(re, replacement)) {
|
if (data = data.replace(re, replacement)) {
|
||||||
var wrapper = $("<span>").html(data);
|
var wrapper = $("<span>").html(data);
|
||||||
$(el).before(wrapper.contents()).remove();
|
$(el).before(wrapper.contents()).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only set the frequency when not set by userdata/PHP.
|
// Only set the frequency when not set by userdata/PHP.
|
||||||
if ($('#frequency').val() == "")
|
if ($('#frequency').val() == "") {
|
||||||
{
|
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function (result) {
|
||||||
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function(result) {
|
$('#frequency').val(result);
|
||||||
$('#frequency').val(result);
|
$('#frequency_rx').val("");
|
||||||
$('#frequency_rx').val("");
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* on mode change */
|
/* on mode change */
|
||||||
$('#mode').change(function() {
|
$('#mode').change(function () {
|
||||||
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function(result) {
|
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function (result) {
|
||||||
$('#frequency').val(result);
|
$('#frequency').val(result);
|
||||||
$('#frequency_rx').val("");
|
$('#frequency_rx').val("");
|
||||||
});
|
});
|
||||||
setRst($("#mode").val());
|
setRst($("#mode").val());
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Calculate Frequency */
|
/* Calculate Frequency */
|
||||||
/* on band change */
|
/* on band change */
|
||||||
$('#band').change(function() {
|
$('#band').change(function () {
|
||||||
$.get('qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function(result) {
|
$.get('qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function (result) {
|
||||||
$('#frequency').val(result);
|
$('#frequency').val(result);
|
||||||
$('#frequency_rx').val("");
|
$('#frequency_rx').val("");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#exchangetype').change(function(){
|
$('#exchangetype').change(function () {
|
||||||
var exchangetype = $("#exchangetype").val();
|
var exchangetype = $("#exchangetype").val();
|
||||||
setExchangetype(exchangetype);
|
setExchangetype(exchangetype);
|
||||||
});
|
});
|
||||||
|
|
||||||
function setExchangetype(exchangetype) {
|
function setExchangetype(exchangetype) {
|
||||||
if (exchangetype == 'None') {
|
if (exchangetype == 'None') {
|
||||||
|
$("#exch_serial_s").val("");
|
||||||
$(".exchanger").hide();
|
$(".exchanger").hide();
|
||||||
$(".exchanges").hide();
|
$(".exchanges").hide();
|
||||||
$(".serials").hide();
|
$(".serials").hide();
|
||||||
|
|
@ -245,6 +243,7 @@ function setExchangetype(exchangetype) {
|
||||||
$(".gridsquares").hide();
|
$(".gridsquares").hide();
|
||||||
}
|
}
|
||||||
else if (exchangetype == 'Exchange') {
|
else if (exchangetype == 'Exchange') {
|
||||||
|
$("#exch_serial_s").val("");
|
||||||
$(".exchanger").show();
|
$(".exchanger").show();
|
||||||
$(".exchanges").show();
|
$(".exchanges").show();
|
||||||
$(".serials").hide();
|
$(".serials").hide();
|
||||||
|
|
@ -253,6 +252,12 @@ function setExchangetype(exchangetype) {
|
||||||
$(".gridsquares").hide();
|
$(".gridsquares").hide();
|
||||||
}
|
}
|
||||||
else if (exchangetype == 'Serial') {
|
else if (exchangetype == 'Serial') {
|
||||||
|
var serialsent = localStorage.getItem("serialsent");
|
||||||
|
if (serialsent != null) {
|
||||||
|
$("#exch_serial_s").val(serialsent);
|
||||||
|
} else {
|
||||||
|
$("#exch_serial_s").val(1);
|
||||||
|
}
|
||||||
$(".exchanger").hide();
|
$(".exchanger").hide();
|
||||||
$(".exchanges").hide();
|
$(".exchanges").hide();
|
||||||
$(".serials").show();
|
$(".serials").show();
|
||||||
|
|
@ -261,6 +266,12 @@ function setExchangetype(exchangetype) {
|
||||||
$(".gridsquares").hide();
|
$(".gridsquares").hide();
|
||||||
}
|
}
|
||||||
else if (exchangetype == 'Serialexchange') {
|
else if (exchangetype == 'Serialexchange') {
|
||||||
|
var serialsent = localStorage.getItem("serialsent");
|
||||||
|
if (serialsent != null) {
|
||||||
|
$("#exch_serial_s").val(serialsent);
|
||||||
|
} else {
|
||||||
|
$("#exch_serial_s").val(1);
|
||||||
|
}
|
||||||
$(".exchanger").show();
|
$(".exchanger").show();
|
||||||
$(".exchanges").show();
|
$(".exchanges").show();
|
||||||
$(".serials").show();
|
$(".serials").show();
|
||||||
|
|
@ -269,6 +280,12 @@ function setExchangetype(exchangetype) {
|
||||||
$(".gridsquares").hide();
|
$(".gridsquares").hide();
|
||||||
}
|
}
|
||||||
else if (exchangetype == 'Serialgridsquare') {
|
else if (exchangetype == 'Serialgridsquare') {
|
||||||
|
var serialsent = localStorage.getItem("serialsent");
|
||||||
|
if (serialsent != null) {
|
||||||
|
$("#exch_serial_s").val(serialsent);
|
||||||
|
} else {
|
||||||
|
$("#exch_serial_s").val(1);
|
||||||
|
}
|
||||||
$(".exchanger").hide();
|
$(".exchanger").hide();
|
||||||
$(".exchanges").hide();
|
$(".exchanges").hide();
|
||||||
$(".serials").show();
|
$(".serials").show();
|
||||||
|
|
@ -277,6 +294,7 @@ function setExchangetype(exchangetype) {
|
||||||
$(".gridsquares").show();
|
$(".gridsquares").show();
|
||||||
}
|
}
|
||||||
else if (exchangetype == 'Gridsquare') {
|
else if (exchangetype == 'Gridsquare') {
|
||||||
|
$("#exch_serial_s").val("");
|
||||||
$(".exchanger").hide();
|
$(".exchanger").hide();
|
||||||
$(".exchanges").hide();
|
$(".exchanges").hide();
|
||||||
$(".serials").hide();
|
$(".serials").hide();
|
||||||
|
|
@ -305,7 +323,7 @@ function logQso() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = [[
|
var data = [[
|
||||||
$("#start_date").val()+ ' ' + $("#start_time").val(),
|
$("#start_date").val() + ' ' + $("#start_time").val(),
|
||||||
$("#callsign").val().toUpperCase(),
|
$("#callsign").val().toUpperCase(),
|
||||||
$("#band").val(),
|
$("#band").val(),
|
||||||
$("#mode").val(),
|
$("#mode").val(),
|
||||||
|
|
@ -331,7 +349,7 @@ function logQso() {
|
||||||
enctype: 'multipart/form-data',
|
enctype: 'multipart/form-data',
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
if (localStorage.getItem("qso") == null) {
|
if (localStorage.getItem("qso") == null) {
|
||||||
localStorage.setItem("qso", $("#start_date").val()+ ' ' + $("#start_time").val() + ',' + $("#callsign").val().toUpperCase() + ',' + $("#contestname").val());
|
localStorage.setItem("qso", $("#start_date").val() + ' ' + $("#start_time").val() + ',' + $("#callsign").val().toUpperCase() + ',' + $("#contestname").val());
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#name').val("");
|
$('#name').val("");
|
||||||
|
|
@ -411,11 +429,11 @@ function restoreContestSession() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: base_url + 'index.php/contesting/getSessionQsos',
|
url: base_url + 'index.php/contesting/getSessionQsos',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: {'qso': qsodata,},
|
data: { 'qso': qsodata, },
|
||||||
success: function (html) {
|
success: function (html) {
|
||||||
var mode = '';
|
var mode = '';
|
||||||
|
|
||||||
$.each(html, function(){
|
$.each(html, function () {
|
||||||
if (this.col_submode == null || this.col_submode == '') {
|
if (this.col_submode == null || this.col_submode == '') {
|
||||||
mode = this.col_mode;
|
mode = this.col_mode;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -423,29 +441,29 @@ function restoreContestSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".qsotable tbody").prepend('<tr>' +
|
$(".qsotable tbody").prepend('<tr>' +
|
||||||
'<td>'+ this.col_time_on + '</td>' +
|
'<td>' + this.col_time_on + '</td>' +
|
||||||
'<td>'+ this.col_call + '</td>' +
|
'<td>' + this.col_call + '</td>' +
|
||||||
'<td>'+ this.col_band + '</td>' +
|
'<td>' + this.col_band + '</td>' +
|
||||||
'<td>'+ mode + '</td>' +
|
'<td>' + mode + '</td>' +
|
||||||
'<td>'+ this.col_rst_sent + '</td>' +
|
'<td>' + this.col_rst_sent + '</td>' +
|
||||||
'<td>'+ this.col_rst_rcvd + '</td>' +
|
'<td>' + this.col_rst_rcvd + '</td>' +
|
||||||
'<td>'+ this.col_stx_string + '</td>' +
|
'<td>' + this.col_stx_string + '</td>' +
|
||||||
'<td>'+ this.col_srx_string + '</td>' +
|
'<td>' + this.col_srx_string + '</td>' +
|
||||||
'<td>'+ this.col_stx + '</td>' +
|
'<td>' + this.col_stx + '</td>' +
|
||||||
'<td>'+ this.col_srx + '</td>' +
|
'<td>' + this.col_srx + '</td>' +
|
||||||
'<td>'+ this.col_gridsquare + '</td>' +
|
'<td>' + this.col_gridsquare + '</td>' +
|
||||||
'<td>'+ this.col_vucc_grids + '</td>' +
|
'<td>' + this.col_vucc_grids + '</td>' +
|
||||||
'</tr>');
|
'</tr>');
|
||||||
});
|
});
|
||||||
if (!$.fn.DataTable.isDataTable('.qsotable')) {
|
if (!$.fn.DataTable.isDataTable('.qsotable')) {
|
||||||
$('.qsotable').DataTable({
|
$('.qsotable').DataTable({
|
||||||
"pageLength": 25,
|
"pageLength": 25,
|
||||||
responsive: false,
|
responsive: false,
|
||||||
"scrollY": "400px",
|
"scrollY": "400px",
|
||||||
"scrollCollapse": true,
|
"scrollCollapse": true,
|
||||||
"paging": false,
|
"paging": false,
|
||||||
"scrollX": true,
|
"scrollX": true,
|
||||||
"order": [[ 0, "desc" ]]
|
"order": [[0, "desc"]]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用