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

merge-requests/2/head
Mike Koch 10 years ago
parent 93a72804f9
commit 187db3635e

@ -262,7 +262,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<div class="col-sm-9"> <div class="col-sm-9">
<!-- TODO Contentify the text --> <!-- TODO Contentify the text -->
<input type="text" class="form-control" id="autorefresh" name="autorefresh" value="<?php echo $_SESSION['new']['autorefresh']; ?>"> <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>
</div> </div>
<h4><?php echo $hesklang['notn']; ?></h4> <h4><?php echo $hesklang['notn']; ?></h4>

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

@ -23,6 +23,7 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
// ADDED OR MODIFIED IN NuMods 1.3.1 // ADDED OR MODIFIED IN NuMods 1.3.1
$hesklang['autorefresh'] = 'Autorefresh:'; $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 // ADDED OR MODIFIED IN NuMods 1.3.0
$hesklang['show_filters'] = 'Show Column Filters'; $hesklang['show_filters'] = 'Show Column Filters';

Loading…
Cancel
Save