Browse Source

Closes #35: Autorefresh now working on the ticket dashboards!

merge-requests/2/head
Mike Koch 7 years ago
parent
commit
187db3635e
  1. 2
      admin/profile.php
  2. 21
      inc/ticket_list.inc.php
  3. 7
      js/autorefresh.php
  4. 1
      language/en/text.php

2
admin/profile.php

@ -262,7 +262,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<div class="col-sm-9">
<!-- TODO Contentify the text -->
<input type="text" class="form-control" id="autorefresh" name="autorefresh" value="<?php echo $_SESSION['new']['autorefresh']; ?>">
<span class="help-block">Enter value in milliseconds, or 0 to disable. No fractional values, and value must be 1000 or greater.</span>
<span class="help-block"><?php echo $hesklang['autorefresh_restrictions']; ?></span>
</div>
</div>
<h4><?php echo $hesklang['notn']; ?></h4>

21
inc/ticket_list.inc.php

@ -31,7 +31,7 @@
* a license please visit the page below:
* https://www.hesk.com/buy.php
*******************************************************************************/
define('MINIMUM_REFRESH_THRESHOLD_IN_SECONDS', 1);
/* Check if this is a valid include */
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
@ -116,9 +116,15 @@ if ($total > 0)
$next_page = ($page + 1 > $pages) ? 0 : $page + 1;
$autorefreshInSeconds = $_SESSION['autorefresh']/1000;
$autorefresh = '';
if ($autorefreshInSeconds > 999) {
if ($autorefreshInSeconds >= MINIMUM_REFRESH_THRESHOLD_IN_SECONDS) {
$autorefresh = ' | '.$hesklang['autorefresh'].' '.$autorefreshInSeconds.' '.$hesklang['abbr']['second'];
}
?>
<script>
(function(){
setTimeout("location.reload(true);",<?php echo $_SESSION['autorefresh']; ?>);
})();
</script>
<?php }
echo sprintf($hesklang['tickets_on_pages'],$total,$pages).$autorefresh.' <br />';
if ($pages > 1)
@ -491,8 +497,15 @@ else
echo '<div class="row"><div class="col-sm-12">';
$autorefreshInSeconds = $_SESSION['autorefresh']/1000;
if ($autorefreshInSeconds > 999) {
if ($autorefreshInSeconds >= MINIMUM_REFRESH_THRESHOLD_IN_SECONDS) {
echo $hesklang['autorefresh'].' '.$autorefreshInSeconds.' '.$hesklang['abbr']['second'];
?>
<script>
(function(){
setTimeout("location.reload(true);",<?php echo $_SESSION['autorefresh']; ?>);
})();
</script>
<?php
}
if (isset($is_search) || $href == 'find_tickets.php')

7
js/autorefresh.php

@ -0,0 +1,7 @@
<?php
define('MINIMUM_REFRESH_THRESHOLD_IN_MILLISECONDS', 1000);
if ($_SESSION['autorefresh'] > MINIMUM_REFRESH_THRESHOLD_IN_MILLISECONDS) { ?>
(function(){
setTimeout("location.reload(true);",<?php echo $_SESSION['autorefresh']/1000; ?>);
})();
<?php } ?>

1
language/en/text.php

@ -23,6 +23,7 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
// ADDED OR MODIFIED IN NuMods 1.3.1
$hesklang['autorefresh'] = 'Autorefresh:';
$hesklang['autorefresh_restrictions'] = 'Enter value in milliseconds. Value must be greater than 1000 to use this feature. No fractional values.';
// ADDED OR MODIFIED IN NuMods 1.3.0
$hesklang['show_filters'] = 'Show Column Filters';

Loading…
Cancel
Save