Fix autorefresh
This commit is contained in:
parent
9532ab3ee7
commit
9b2c6d08be
@ -82,11 +82,13 @@ else {
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<label>
|
||||
<input type="checkbox" onclick="toggleAutoRefresh(this);" id="reloadCB">
|
||||
<?php echo $hesklang['arp']; ?>
|
||||
<span id="timer"></span>
|
||||
</label>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" onclick="toggleAutoRefresh(this);" id="reloadCB">
|
||||
<?php echo $hesklang['arp']; ?>
|
||||
<span id="timer"></span>
|
||||
</label>
|
||||
</div>
|
||||
<script type="text/javascript">heskCheckReloading();</script><br>
|
||||
<?php
|
||||
/* Print tickets? */
|
||||
|
@ -70,6 +70,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<label>
|
||||
<input type="checkbox" onclick="toggleAutoRefresh(this);" id="reloadCB">
|
||||
<?php echo $hesklang['arp']; ?>
|
||||
|
@ -241,50 +241,6 @@ if (is_dir(HESK_PATH . 'install')) {
|
||||
echo '<script src="https://www.google.com/recaptcha/api.js?hl=' . $hesklang['RECAPTCHA'] . '" async defer></script>';
|
||||
}
|
||||
|
||||
// Auto reload
|
||||
if (defined('AUTO_RELOAD') && hesk_checkPermission('can_view_tickets',0) && ! isset($_SESSION['hide']['ticket_list'])) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var count = <?php echo empty($_SESSION['autoreload']) ? 30 : intval($_SESSION['autoreload']); ?>;
|
||||
var reloadcounter;
|
||||
var countstart = count;
|
||||
|
||||
function heskReloadTimer() {
|
||||
count = count-1;
|
||||
if (count <= 0) {
|
||||
clearInterval(reloadcounter);
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById("timer").innerHTML = "(" + count + ")";
|
||||
}
|
||||
|
||||
function heskCheckReloading() {
|
||||
if (<?php if ($_SESSION['autoreload']) echo "getCookie('autorefresh') == null || "; ?>getCookie('autorefresh') == '1') {
|
||||
document.getElementById("reloadCB").checked=true;
|
||||
document.getElementById("timer").innerHTML = "(" + count + ")";
|
||||
reloadcounter = setInterval(heskReloadTimer, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAutoRefresh(cb) {
|
||||
if (cb.checked) {
|
||||
setCookie('autorefresh', '1');
|
||||
document.getElementById("timer").innerHTML = "(" + count + ")";
|
||||
reloadcounter = setInterval(heskReloadTimer, 1000);
|
||||
} else {
|
||||
setCookie('autorefresh', '0');
|
||||
count = countstart;
|
||||
clearInterval(reloadcounter);
|
||||
document.getElementById("timer").innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (defined('VALIDATOR')) {
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/validation-scripts.js"></script>
|
||||
|
@ -210,6 +210,50 @@ $modsForHesk_settings = mfh_getSettings();
|
||||
}
|
||||
}
|
||||
|
||||
// Auto reload
|
||||
if (defined('AUTO_RELOAD') && hesk_checkPermission('can_view_tickets',0) && ! isset($_SESSION['hide']['ticket_list'])) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var count = <?php echo empty($_SESSION['autoreload']) ? 30 : intval($_SESSION['autoreload']); ?>;
|
||||
var reloadcounter;
|
||||
var countstart = count;
|
||||
|
||||
function heskReloadTimer() {
|
||||
count = count-1;
|
||||
if (count <= 0) {
|
||||
clearInterval(reloadcounter);
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById("timer").innerHTML = "(" + count + ")";
|
||||
}
|
||||
|
||||
function heskCheckReloading() {
|
||||
if (<?php if ($_SESSION['autoreload']) echo "getCookie('autorefresh') == null || "; ?>getCookie('autorefresh') == '1') {
|
||||
document.getElementById("reloadCB").checked=true;
|
||||
document.getElementById("timer").innerHTML = "(" + count + ")";
|
||||
reloadcounter = setInterval(heskReloadTimer, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAutoRefresh(cb) {
|
||||
if (cb.checked) {
|
||||
setCookie('autorefresh', '1');
|
||||
document.getElementById("timer").innerHTML = "(" + count + ")";
|
||||
reloadcounter = setInterval(heskReloadTimer, 1000);
|
||||
} else {
|
||||
setCookie('autorefresh', '0');
|
||||
count = countstart;
|
||||
clearInterval(reloadcounter);
|
||||
document.getElementById("timer").innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (defined('MFH_CALENDAR')) { ?>
|
||||
<script src="<?php echo HESK_PATH; ?>js/calendar/moment.js"></script>
|
||||
<script src="<?php echo HESK_PATH; ?>js/calendar/fullcalendar.min.js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user