Skip to content

Commit d8cc21f

Browse files
authored
2.8.3
2 parents d84977f + 7859254 commit d8cc21f

4 files changed

Lines changed: 166 additions & 39 deletions

File tree

application/config/migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
|
2323
*/
2424

25-
$config['migration_version'] = 238;
25+
$config['migration_version'] = 239;
2626

2727
/*
2828
|--------------------------------------------------------------------------
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
defined('BASEPATH') OR exit('No direct script access allowed');
4+
5+
/*
6+
* Tag Cloudlog as 2.8.3 Migration
7+
*/
8+
9+
class Migration_tag_2_8_3 extends CI_Migration {
10+
11+
public function up()
12+
{
13+
14+
// Tag Cloudlog 2.8.3
15+
$this->db->where('option_name', 'version');
16+
$this->db->update('options', array('option_value' => '2.8.3'));
17+
18+
// Trigger Version Info Dialog
19+
$this->db->where('option_type', 'version_dialog');
20+
$this->db->where('option_name', 'confirmed');
21+
$this->db->update('user_options', array('option_value' => 'false'));
22+
23+
}
24+
25+
public function down()
26+
{
27+
$this->db->where('option_name', 'version');
28+
$this->db->update('options', array('option_value' => '2.8.2'));
29+
}
30+
}

application/views/interface_assets/footer.php

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ function toggleMessageLog() {
16051605
setRst($(".mode").val());
16061606

16071607
/* On Page Load */
1608-
var catcher = function() {
1608+
var catcher = function(e) {
16091609
var changed = false;
16101610
$('form').each(function() {
16111611
if ($(this).data('initialForm') != $(this).serialize()) {
@@ -1616,7 +1616,10 @@ function toggleMessageLog() {
16161616
}
16171617
});
16181618
if (changed) {
1619-
return 'Unsaved QSO!';
1619+
// For external navigation (closing tab/window), browsers require native dialog
1620+
e.preventDefault();
1621+
e.returnValue = 'You have unsaved changes. Are you sure you want to leave?';
1622+
return e.returnValue;
16201623
}
16211624
};
16221625

@@ -1641,6 +1644,48 @@ function toggleMessageLog() {
16411644
}
16421645
});
16431646
$(window).bind('beforeunload', catcher);
1647+
1648+
// Intercept internal link clicks to show custom modal
1649+
$(document).on('click', 'a[href]:not([href^="#"]):not([target="_blank"]):not(.no-confirm):not([data-bs-toggle])', function(e) {
1650+
var href = $(this).attr('href');
1651+
1652+
// Skip if it's a javascript: link, empty, or hash link
1653+
if (!href || href === '#' || href.indexOf('javascript:') === 0) {
1654+
return true;
1655+
}
1656+
1657+
// Check if form has unsaved changes
1658+
var hasChanges = false;
1659+
$('form').each(function() {
1660+
if ($(this).data('initialForm') != $(this).serialize()) {
1661+
hasChanges = true;
1662+
return false;
1663+
}
1664+
});
1665+
1666+
if (hasChanges) {
1667+
e.preventDefault();
1668+
1669+
// Check if custom modal element exists in DOM at click time
1670+
var modalEl = document.getElementById('leaveQsoModal');
1671+
if (modalEl && typeof bootstrap !== 'undefined' && bootstrap.Modal) {
1672+
// Use custom modal
1673+
window.pendingNavigation = href;
1674+
var modal = bootstrap.Modal.getInstance(modalEl);
1675+
if (!modal) {
1676+
modal = new bootstrap.Modal(modalEl);
1677+
}
1678+
modal.show();
1679+
} else {
1680+
// Fallback to confirm dialog on pages without custom modal
1681+
if (confirm('You have unsaved changes. Are you sure you want to leave QSO entry?')) {
1682+
$(window).unbind('beforeunload', catcher);
1683+
window.location.href = href;
1684+
}
1685+
}
1686+
return false;
1687+
}
1688+
});
16441689
});
16451690

16461691
// Callsign always has focus on load

application/views/qso/index.php

Lines changed: 88 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
var text_error_timeoff_less_timeon = "<?php echo lang('qso_error_timeoff_less_timeon'); ?>";
55
var lang_qso_title_previous_contacts = "<?php echo lang('qso_title_previous_contacts'); ?>";
66
var lang_qso_title_times_worked_before = "<?php echo lang('qso_title_times_worked_before'); ?>";
7+
8+
// Function to switch between LIVE and POST mode without the beforeunload warning
9+
function switchMode(url) {
10+
// Temporarily unbind the beforeunload event to prevent the "Leave site?" popup
11+
$(window).unbind('beforeunload');
12+
// Navigate to the new URL
13+
window.location.href = url;
14+
}
715
</script>
816

917
<div class="row qsopane">
@@ -16,12 +24,7 @@
1624
<div class="card-header">
1725
<ul style="font-size: 15px;" class="nav nav-tabs card-header-tabs pull-right" id="myTab" role="tablist">
1826
<li class="nav-item">
19-
<a class="nav-link active" id="qsp-tab" data-bs-toggle="tab" href="#qso" role="tab" aria-controls="qso" aria-selected="true"><?php echo lang('gen_hamradio_qso'); ?><?php if ($_GET['manual'] == 0) {
20-
echo " <span class=\"badge text-bg-success\" style=\"cursor: pointer;\" onclick=\"window.location.href='" . site_url('qso') . "?manual=1'\" title=\"Switch to POST mode\">LIVE</span>";
21-
};
22-
if ($_GET['manual'] == 1) {
23-
echo " <span class=\"badge text-bg-danger\" style=\"cursor: pointer;\" onclick=\"window.location.href='" . site_url('qso') . "?manual=0'\" title=\"Switch to LIVE mode\">POST</span>";
24-
} ?></a>
27+
<a class="nav-link active" id="qsp-tab" data-bs-toggle="tab" href="#qso" role="tab" aria-controls="qso" aria-selected="true"><?php echo lang('gen_hamradio_qso'); ?></a>
2528
</li>
2629

2730
<li class="nav-item">
@@ -55,6 +58,15 @@
5558
</div>
5659
</li>
5760

61+
<li class="nav-item ms-auto d-flex align-items-center">
62+
<?php if ($_GET['manual'] == 0) {
63+
echo " <span class=\"badge text-bg-success\" style=\"cursor: pointer; font-size: 0.9rem; padding: 0.4rem 0.9rem;\" onclick=\"switchMode('" . site_url('qso') . "?manual=1')\" title=\"Switch to Manual mode\">LIVE</span>";
64+
};
65+
if ($_GET['manual'] == 1) {
66+
echo " <span class=\"badge text-bg-danger\" style=\"cursor: pointer; font-size: 0.9rem; padding: 0.4rem 0.9rem;\" onclick=\"switchMode('" . site_url('qso') . "?manual=0')\" title=\"Switch to LIVE mode\">POST</span>";
67+
} ?>
68+
</li>
69+
5870
</ul>
5971
</div>
6072

@@ -680,9 +692,9 @@
680692
<div class="card-header">
681693
<h4 style="font-size: 16px; font-weight: bold;" class="card-title">Winkey Web Sockets
682694

683-
<div id="cw_socket_status" class="badge text-bg-danger">
695+
<div id="cw_socket_status" class="badge text-bg-danger">
684696
Status: Disconnected
685-
</div>
697+
</div>
686698

687699
<button id="toggleLogButton" onclick="toggleMessageLog()" class="btn btn-sm btn-outline-secondary" title="Toggle Message Log">
688700
<i class="fas fa-list"></i>
@@ -711,7 +723,7 @@
711723
</div>
712724
</div>
713725
</div>
714-
726+
715727
<!-- CW Speed Control Row -->
716728
<div class="row mb-3">
717729
<div class="col-12">
@@ -725,7 +737,7 @@
725737
</div>
726738
</div>
727739
</div>
728-
740+
729741
<!-- Send Message Row -->
730742
<div class="row mb-3">
731743
<div class="col-12">
@@ -785,7 +797,7 @@
785797
</div>
786798
</div>
787799
</div>
788-
800+
789801
<!-- Send Message Row -->
790802
<div class="row mb-3">
791803
<div class="col-12">
@@ -849,32 +861,72 @@
849861

850862
</div>
851863

864+
<!-- Custom Leave QSO Entry Modal -->
865+
<div class="modal fade" id="leaveQsoModal" tabindex="-1" aria-labelledby="leaveQsoModalLabel" aria-hidden="true">
866+
<div class="modal-dialog modal-dialog-centered">
867+
<div class="modal-content">
868+
<div class="modal-header bg-warning">
869+
<h5 class="modal-title" id="leaveQsoModalLabel">
870+
<i class="fas fa-exclamation-triangle me-2"></i>Leave QSO Entry?
871+
</h5>
872+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
873+
</div>
874+
<div class="modal-body">
875+
<p class="mb-0">Are you sure you want to leave QSO entry? Any unsaved changes will be lost.</p>
876+
</div>
877+
<div class="modal-footer">
878+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
879+
<i class="fas fa-times me-1"></i>Stay on Page
880+
</button>
881+
<button type="button" class="btn btn-warning" id="confirmLeaveQso">
882+
<i class="fas fa-sign-out-alt me-1"></i>Leave Page
883+
</button>
884+
</div>
885+
</div>
886+
</div>
852887
</div>
853888

854-
<script>
855-
function openBandmap() {
856-
// Open bandmap in a new window without URL bar, toolbars, etc.
857-
const width = 500;
858-
const height = 800;
859-
const left = (screen.width - width) / 2;
860-
const top = (screen.height - height) / 2;
861-
862-
// Note: Modern browsers may still show address bar due to security restrictions
863-
// For Chrome, you can use: chrome.exe --app=http://localhost/index.php/dxcluster/bandmap
864-
const features = `width=${width},height=${height},left=${left},top=${top},` +
865-
`toolbar=no,location=no,directories=no,status=no,menubar=no,` +
866-
`scrollbars=yes,resizable=yes,copyhistory=no`;
867-
868-
const popup = window.open('<?php echo site_url('dxcluster/bandmap'); ?>', 'bandmap', features);
869-
870-
// Try to make it fullscreen (user will need to allow this)
871-
if (popup) {
872-
popup.focus();
873-
}
874-
}
889+
</div>
875890

876-
function openBandmapFullscreen() {
877-
// Alternative: Open in current window and go fullscreen
878-
window.location.href = '<?php echo site_url('dxcluster/bandmap'); ?>';
891+
<script>
892+
// Handle the confirm leave button for the custom modal (vanilla JS to avoid jQuery dependency)
893+
document.addEventListener('DOMContentLoaded', function() {
894+
var confirmBtn = document.getElementById('confirmLeaveQso');
895+
if (confirmBtn) {
896+
confirmBtn.addEventListener('click', function() {
897+
if (window.pendingNavigation) {
898+
// Unbind beforeunload to allow navigation
899+
window.jQuery && window.jQuery(window).unbind('beforeunload');
900+
// Navigate to the pending URL
901+
window.location.href = window.pendingNavigation;
879902
}
880-
</script>
903+
});
904+
}
905+
});
906+
907+
function openBandmap() {
908+
// Open bandmap in a new window without URL bar, toolbars, etc.
909+
const width = 500;
910+
const height = 800;
911+
const left = (screen.width - width) / 2;
912+
const top = (screen.height - height) / 2;
913+
914+
// Note: Modern browsers may still show address bar due to security restrictions
915+
// For Chrome, you can use: chrome.exe --app=http://localhost/index.php/dxcluster/bandmap
916+
const features = `width=${width},height=${height},left=${left},top=${top},` +
917+
`toolbar=no,location=no,directories=no,status=no,menubar=no,` +
918+
`scrollbars=yes,resizable=yes,copyhistory=no`;
919+
920+
const popup = window.open('<?php echo site_url('dxcluster/bandmap'); ?>', 'bandmap', features);
921+
922+
// Try to make it fullscreen (user will need to allow this)
923+
if (popup) {
924+
popup.focus();
925+
}
926+
}
927+
928+
function openBandmapFullscreen() {
929+
// Alternative: Open in current window and go fullscreen
930+
window.location.href = '<?php echo site_url('dxcluster/bandmap'); ?>';
931+
}
932+
</script>

0 commit comments

Comments
 (0)